Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions extra/LocalDev/runtime-src/Lamdera/Live.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1726,10 +1726,14 @@ mapDocument model msg { title, body } =
{ title = title
, body =
List.map (Html.map msg) body
++ lamderaUI
model.devbar
model.resetModelNames
model.nodeType
++ [ Html.node "lamdera-devbar"
[]
(lamderaUI
model.devbar
model.resetModelNames
model.nodeType
)
]
}


Expand Down
32 changes: 32 additions & 0 deletions extra/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,38 @@
import * as Sockette from 'sockette';
import * as Cookie from 'js-cookie';

// Custom element that isolates Lamdera's dev overlay from user CSS.
// Elm's vdom patcher calls standard DOM methods (appendChild, childNodes, etc.)
// on parent nodes. By proxying these to a container inside a shadow root, Elm
// renders seamlessly while the shadow boundary blocks external stylesheets.
// Inherited CSS properties are cut off by `all: initial` on the host.
if (typeof customElements !== 'undefined') {
class LamderaDevbar extends HTMLElement {
constructor() {
super();
var shadow = this.attachShadow({ mode: 'open' });
var style = document.createElement('style');
style.textContent = ':host { all: initial; display: block; }';
shadow.appendChild(style);
this._c = document.createElement('div');
shadow.appendChild(this._c);
}
appendChild(n) { return this._c.appendChild(n); }
insertBefore(n, r) { return this._c.insertBefore(n, r); }
removeChild(n) { return this._c.removeChild(n); }
replaceChild(n, o) { return this._c.replaceChild(n, o); }
get childNodes() { return this._c.childNodes; }
get firstChild() { return this._c.firstChild; }
get lastChild() { return this._c.lastChild; }
get children() { return this._c.children; }
get innerHTML() { return this._c.innerHTML; }
set innerHTML(v) { this._c.innerHTML = v; }
get textContent() { return this._c.textContent; }
set textContent(v) { this._c.textContent = v; }
}
customElements.define('lamdera-devbar', LamderaDevbar);
}

var clientId = ""
const sessionId = getSessionId()
var connected = false
Expand Down