From a2aadd1454c96de68734f6cdd589604f476df667 Mon Sep 17 00:00:00 2001 From: Stephen Date: Mon, 14 Oct 2024 16:30:02 +0200 Subject: [PATCH] Updates to Signal.frame, dom elements() --- element/element.js | 1 + literal-element/modules/lifecycle.js | 24 +++++++------ literal-html/module.js | 53 ++++++++-------------------- literal-html/test.html | 2 ++ modules/compile/compile-node.js | 2 -- modules/dom/get-by-id.js | 4 +-- modules/renderer/cue.js | 8 ++--- modules/renderer/renderer.js | 18 +++++----- modules/template.js | 8 ++--- 9 files changed, 48 insertions(+), 72 deletions(-) diff --git a/element/element.js b/element/element.js index c1f8d83..4e3f20b 100644 --- a/element/element.js +++ b/element/element.js @@ -121,6 +121,7 @@ export default function LiteralElement(tag, lifecycle = {}, properties = {}) { const consts = { host: this, shadow, internals }; const renderer = Literal.fromFragment(name, template.content, this, consts); + shadow.appendChild(renderer.content); // Call lifecycle.construct() diff --git a/literal-element/modules/lifecycle.js b/literal-element/modules/lifecycle.js index 1d17db0..1a86cdc 100644 --- a/literal-element/modules/lifecycle.js +++ b/literal-element/modules/lifecycle.js @@ -39,16 +39,18 @@ export default { internals.attributes.reduce(assignProperty, {}) : nothing ; - if (internals.src) { - internals.src.then((module) => { - // TODO: can't we just pass module as scope? Why not? - const scope = assign({}, module); - delete scope.default; - defineElement(internals.tag, this, module.default || {}, attributes, scope) - }); - } - else { - defineElement(internals.tag, this, {}, attributes, {}); - } + return [render(() => { + if (internals.src) { + internals.src.then((module) => { + // TODO: can't we just pass module as scope? Why not? + const scope = assign({}, module); + delete scope.default; + defineElement(internals.tag, this, module.default || {}, attributes, scope) + }); + } + else { + defineElement(internals.tag, this, {}, attributes, {}); + } + })]; } } diff --git a/literal-html/module.js b/literal-html/module.js index 89c5da3..fd7cd52 100644 --- a/literal-html/module.js +++ b/literal-html/module.js @@ -16,9 +16,10 @@ library provides another template, `