marko 6.4.5 → 6.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cheatsheet.md +2 -1
- package/dist/common/errors.d.ts +3 -1
- package/dist/common/helpers.d.ts +7 -7
- package/dist/debug/dom/catch.feat.js +4 -4
- package/dist/debug/dom/catch.feat.mjs +4 -4
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +5 -5
- package/dist/debug/dom/controllable.feat.mjs +5 -5
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-BeY1nGUb.mjs → dom-CFCBDift.mjs} +133 -135
- package/dist/debug/{dom-CUxvM4i9.js → dom-D8znnhpf.js} +148 -150
- package/dist/debug/dom.js +21 -22
- package/dist/debug/dom.mjs +22 -22
- package/dist/debug/html.js +736 -664
- package/dist/debug/html.mjs +736 -665
- package/dist/dom/catch.feat.js +5 -5
- package/dist/dom/catch.feat.mjs +4 -4
- package/dist/dom/control-flow.d.ts +3 -3
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.d.ts +4 -4
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +2 -2
- package/dist/dom/dom.d.ts +5 -5
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +2 -2
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/renderer.d.ts +1 -3
- package/dist/dom/resume.d.ts +2 -3
- package/dist/dom/signals.d.ts +6 -8
- package/dist/{dom-Diu8MpmL.js → dom-Bpkm72vV.js} +157 -166
- package/dist/{dom-DefWmvQB.mjs → dom-CVAevsbz.mjs} +103 -107
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +37 -37
- package/dist/dom.mjs +22 -22
- package/dist/html/assets.d.ts +2 -2
- package/dist/html/compat.d.ts +2 -1
- package/dist/html/control-flow.d.ts +20 -0
- package/dist/html/inlined-runtimes.d.ts +2 -2
- package/dist/html/inlined-runtimes.debug.d.ts +2 -2
- package/dist/html/serializer.d.ts +63 -16
- package/dist/html/template.d.ts +1 -1
- package/dist/html/writer.d.ts +47 -35
- package/dist/html.d.ts +3 -2
- package/dist/html.js +531 -484
- package/dist/html.mjs +531 -484
- package/dist/translator/core/for.d.ts +0 -4
- package/dist/translator/core/return.d.ts +0 -3
- package/dist/translator/core/style.d.ts +2 -2
- package/dist/translator/index.js +8093 -8021
- package/dist/translator/util/analyze-errors.d.ts +2 -1
- package/dist/translator/util/assert.d.ts +15 -1
- package/dist/translator/util/bindings.d.ts +24 -12
- package/dist/translator/util/body-to-text.d.ts +9 -0
- package/dist/translator/util/branch-tag.d.ts +10 -3
- package/dist/translator/util/build-string-expression.d.ts +4 -0
- package/dist/translator/util/content-derives.d.ts +7 -0
- package/dist/translator/util/cyclic-memo.d.ts +6 -2
- package/dist/translator/util/entry-builder.d.ts +6 -3
- package/dist/translator/util/finalize-references.d.ts +6 -3
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +4 -2
- package/dist/translator/util/get-root.d.ts +3 -3
- package/dist/translator/util/get-tag-name.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +14 -9
- package/dist/translator/util/module-read.d.ts +0 -3
- package/dist/translator/util/module-registrations.d.ts +44 -0
- package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +7 -2
- package/dist/translator/util/params-tree.d.ts +18 -0
- package/dist/translator/util/reasons.d.ts +13 -8
- package/dist/translator/util/references.d.ts +23 -27
- package/dist/translator/util/runtime.d.ts +0 -12
- package/dist/translator/util/scope-accessor.d.ts +0 -1
- package/dist/translator/util/scope-read.d.ts +3 -0
- package/dist/translator/util/section-renderer.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +21 -21
- package/dist/translator/util/setup-work.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +16 -14
- package/dist/translator/util/simplify-fn.d.ts +1 -0
- package/dist/translator/util/slots.d.ts +4 -4
- package/dist/translator/util/solve-reasons.d.ts +1 -3
- package/dist/translator/util/sources.d.ts +2 -1
- package/dist/translator/util/state.d.ts +4 -2
- package/dist/translator/util/statement-tag.d.ts +2 -0
- package/dist/translator/util/static-text.d.ts +2 -1
- package/dist/translator/util/structure.d.ts +0 -10
- package/dist/translator/util/tag-facts.d.ts +8 -1
- package/dist/translator/util/tag-import.d.ts +20 -0
- package/dist/translator/util/tag-name-type.d.ts +9 -2
- package/dist/translator/util/to-only-or-block.d.ts +3 -0
- package/dist/translator/util/to-property-name.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +7 -5
- package/dist/translator/util/translate-var.d.ts +2 -0
- package/dist/translator/util/traverse.d.ts +1 -2
- package/dist/translator/util/visitors.d.ts +4 -1
- package/dist/translator/util/with-previous-location.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -2
- package/dist/translator/util/writer.d.ts +1 -2
- package/dist/translator/visitors/export-declaration.d.ts +2 -3
- package/dist/translator/visitors/function.d.ts +0 -35
- package/dist/translator/visitors/import-declaration.d.ts +1 -15
- package/dist/translator/visitors/placeholder.d.ts +2 -1
- package/dist/translator/visitors/program/html.d.ts +0 -1
- package/dist/translator/visitors/program/index.d.ts +4 -5
- package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
- package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
- package/package.json +4 -4
- package/dist/translator/util/binding-has-prop.d.ts +0 -8
- package/dist/translator/util/binding-prop-tree.d.ts +0 -18
- package/dist/translator/util/body-to-text-literal.d.ts +0 -9
- package/dist/translator/util/import-reference.d.ts +0 -3
- package/dist/translator/util/normalize-string-expression.d.ts +0 -4
- package/dist/translator/util/plugin-hooks.d.ts +0 -4
- package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
- package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
- package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
- package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
|
@@ -26,17 +26,17 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
26
26
|
else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
27
27
|
else if (value === 38) return currentWalkIndex;
|
|
28
28
|
else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
29
|
-
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;)
|
|
29
|
+
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) if (currentNode.firstChild) currentNode = currentNode.firstChild;
|
|
30
|
+
else {
|
|
31
|
+
for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
|
|
32
|
+
walkNextSibling();
|
|
33
|
+
}
|
|
30
34
|
else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walkNextSibling();
|
|
31
35
|
else if (value < 117) {
|
|
32
36
|
for (value = 10 * currentMultiplier + value - 107; value--;) currentNode = currentNode.parentNode || currentNode;
|
|
33
37
|
walkNextSibling();
|
|
34
38
|
} else storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
35
|
-
},
|
|
36
|
-
if (currentNode.firstChild) return currentNode = currentNode.firstChild;
|
|
37
|
-
for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
|
|
38
|
-
walkNextSibling();
|
|
39
|
-
}, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
|
|
39
|
+
}, walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
|
|
40
40
|
let prevValue = scope["R" + accessor];
|
|
41
41
|
if (prevValue !== (scope["R" + accessor] = _to_text(value))) {
|
|
42
42
|
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(scope["R" + accessor], parentNode.namespaceURI);
|
|
@@ -48,12 +48,12 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
48
48
|
let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
|
|
49
49
|
branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
|
|
50
50
|
}
|
|
51
|
-
}), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {},
|
|
51
|
+
}), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableSpreadHelpers = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
|
|
52
52
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
53
53
|
let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
|
|
54
54
|
for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
|
|
55
55
|
return (scope, newBranch) => {
|
|
56
|
-
newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) &&
|
|
56
|
+
newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
|
|
57
57
|
};
|
|
58
58
|
}), _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
|
|
59
59
|
nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor)), endNodeAccessor !== void 0 && (endNodeAccessor = decodeAccessor(endNodeAccessor));
|
|
@@ -72,21 +72,24 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
72
72
|
}), _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
|
|
73
73
|
let scopeOffsetAccessor = getTagVar && decodeAccessor(nodeAccessor + 1);
|
|
74
74
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
75
|
-
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor
|
|
75
|
+
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor, createTagBranch = ($global, tagNameOrRenderer, scope, parentNode) => {
|
|
76
|
+
let branch = createBranch($global, tagNameOrRenderer, scope, parentNode);
|
|
77
|
+
if (typeof tagNameOrRenderer == "string" && (branch.a = branch.S = branch.K = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer)), getTagVar && (branch.T = (value) => getTagVar()(scope, value), bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer)), typeof tagNameOrRenderer != "string") setupBranch(tagNameOrRenderer, branch);
|
|
78
|
+
else if (getContent) {
|
|
79
|
+
let content = getContent(scope);
|
|
80
|
+
setBranch(branch, "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, branch.Aa);
|
|
81
|
+
}
|
|
82
|
+
return branch;
|
|
83
|
+
};
|
|
76
84
|
return (scope, newRenderer, getInput) => {
|
|
77
85
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
78
86
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
|
79
|
-
let renderer = normalizedRenderer
|
|
80
|
-
|
|
81
|
-
if (getContent) {
|
|
82
|
-
let content = getContent(scope);
|
|
83
|
-
setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
|
|
84
|
-
}
|
|
85
|
-
} else renderer && (setupBranch(renderer, scope[childScopeAccessor]), renderer.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor]));
|
|
87
|
+
let renderer = normalizedRenderer;
|
|
88
|
+
renderer ? setBranch(scope, nodeAccessor, renderer, createTagBranch) : (getTagVar && getTagVar()(scope), setBranch(scope, nodeAccessor, renderer = getContent ? getContent(scope) : void 0, createAndSetupBranch)), typeof renderer != "string" && renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor]);
|
|
86
89
|
}
|
|
87
90
|
if (normalizedRenderer) {
|
|
88
91
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
|
89
|
-
if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {},
|
|
92
|
+
if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope.a.tagName]), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
|
|
90
93
|
else if (normalizedRenderer.g?.(childScope), normalizedRenderer.d) {
|
|
91
94
|
if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
|
|
92
95
|
else {
|
|
@@ -103,19 +106,19 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
103
106
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
104
107
|
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
|
|
105
108
|
return (scope, renderer) => {
|
|
106
|
-
scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (
|
|
109
|
+
scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setBranch(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer?.g?.(scope[childScopeAccessor]);
|
|
107
110
|
};
|
|
108
111
|
}), bindTagVar, loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, template, walks, setup, params) => {
|
|
109
112
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
110
113
|
let scopesAccessor = "A" + nodeAccessor, keyedScopesAccessor = "O" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
111
114
|
return (scope, value) => {
|
|
112
|
-
let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes =
|
|
115
|
+
let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes = [];
|
|
113
116
|
scope[keyedScopesAccessor] = null;
|
|
114
117
|
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves, start = 0;
|
|
115
118
|
forEach(value, (key, args) => {
|
|
116
119
|
let i = newScopes.length, oldScope = oldScopes[i], branch = oldLen && (oldScopesByKey || key !== (oldScope?.M ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope.I = j, map.set(scope.M ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
117
|
-
branch ? (hasPotentialMoves = !0, oldScopesByKey?.delete(key)) : branch =
|
|
118
|
-
});
|
|
120
|
+
branch ? (hasPotentialMoves = !0, oldScopesByKey?.delete(key), branch.M = key) : ((branch = createBranch(scope.$, renderer, scope, parentNode)).M = key, setupBranch(renderer, branch)), newScopes.push(branch), params?.(branch, args);
|
|
121
|
+
}), scope[scopesAccessor] = newScopes;
|
|
119
122
|
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1;
|
|
120
123
|
if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
|
|
121
124
|
oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
|
|
@@ -144,10 +147,10 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
144
147
|
function _call(fn, v) {
|
|
145
148
|
return fn(v), v;
|
|
146
149
|
}
|
|
147
|
-
function
|
|
150
|
+
function stringifyClassEntry(name, value) {
|
|
148
151
|
return value ? name : "";
|
|
149
152
|
}
|
|
150
|
-
function
|
|
153
|
+
function stringifyStyleEntry(name, value) {
|
|
151
154
|
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
152
155
|
}
|
|
153
156
|
function escapeStyleAttr(str) {
|
|
@@ -161,10 +164,10 @@ function escapeStyleValue(str) {
|
|
|
161
164
|
function isEventHandler(name) {
|
|
162
165
|
return /^on[A-Z-]/.test(name);
|
|
163
166
|
}
|
|
164
|
-
function
|
|
167
|
+
function getEventType(name) {
|
|
165
168
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
166
169
|
}
|
|
167
|
-
function
|
|
170
|
+
function isNotNullishOrFalse(value) {
|
|
168
171
|
return value != null && value !== !1;
|
|
169
172
|
}
|
|
170
173
|
function isPromise(value) {
|
|
@@ -329,7 +332,7 @@ function push(opt, item) {
|
|
|
329
332
|
//#endregion
|
|
330
333
|
//#region src/dom/event.ts
|
|
331
334
|
function _on(element, type, handler) {
|
|
332
|
-
|
|
335
|
+
delegate(type, handleDelegated), element[1 + type] = handler || null;
|
|
333
336
|
}
|
|
334
337
|
function handleDelegated(ev) {
|
|
335
338
|
let target = !rendering && ev.target;
|
|
@@ -401,7 +404,7 @@ function flushAndWaitFrame() {
|
|
|
401
404
|
requestAnimationFrame(triggerMacroTask), run();
|
|
402
405
|
}
|
|
403
406
|
function triggerMacroTask() {
|
|
404
|
-
channel || (channel = new MessageChannel(), channel.port1.onmessage = () => {
|
|
407
|
+
channel || (channel = new MessageChannel(), channel.port1.onmessage = (_) => {
|
|
405
408
|
isScheduled = 0, run();
|
|
406
409
|
}), channel.port2.postMessage(0);
|
|
407
410
|
}
|
|
@@ -429,19 +432,19 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
429
432
|
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor);
|
|
430
433
|
let scopeAccessor = "A" + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
|
431
434
|
let scopes = toArray(ownerScope[scopeAccessor]);
|
|
432
|
-
queueRender(ownerScope, () => {
|
|
435
|
+
queueRender(ownerScope, (_) => {
|
|
433
436
|
for (let scope of scopes) scope.H > 0 && scope.H < runId && fn(scope);
|
|
434
437
|
}, -1);
|
|
435
438
|
};
|
|
436
|
-
return ownerSignal._ = fn, ownerSignal;
|
|
439
|
+
return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
|
|
437
440
|
}
|
|
438
|
-
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor,
|
|
439
|
-
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), ownerValueAccessor = decodeAccessor(ownerValueAccessor)
|
|
441
|
+
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
|
|
442
|
+
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), ownerValueAccessor = decodeAccessor(ownerValueAccessor);
|
|
440
443
|
let scopeAccessor = "A" + ownerLoopNodeAccessor, mapAccessor = "O" + ownerLoopNodeAccessor, prevKeyProp = `_${ownerValueAccessor}`, ownerSignal = (ownerScope) => {
|
|
441
444
|
if (ownerScope.H < runId) {
|
|
442
445
|
let nextKey = ownerScope[ownerValueAccessor];
|
|
443
|
-
queueRender(ownerScope, () => {
|
|
444
|
-
let map = keyedScopes(ownerScope, scopeAccessor, mapAccessor
|
|
446
|
+
queueRender(ownerScope, (_) => {
|
|
447
|
+
let map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
|
|
445
448
|
if (map && prevKeyProp in map) {
|
|
446
449
|
let prevScope = map.get(map[prevKeyProp]), nextScope = map.get(nextKey);
|
|
447
450
|
prevScope !== nextScope && (runLiveBranch(prevScope, fn), runLiveBranch(nextScope, fn));
|
|
@@ -450,14 +453,14 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
|
|
|
450
453
|
}, -1);
|
|
451
454
|
}
|
|
452
455
|
};
|
|
453
|
-
return ownerSignal._ = fn, ownerSignal;
|
|
456
|
+
return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
|
|
454
457
|
}
|
|
455
|
-
function keyedScopes(ownerScope, scopeAccessor, mapAccessor
|
|
458
|
+
function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
|
|
456
459
|
let map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
|
|
457
460
|
if (!map.size) for (let scope of toArray(ownerScope[scopeAccessor])) {
|
|
458
|
-
let key = scope.M
|
|
461
|
+
let key = scope.M;
|
|
459
462
|
if (key === void 0) return ownerScope[mapAccessor] = null;
|
|
460
|
-
|
|
463
|
+
map.set(key, scope);
|
|
461
464
|
}
|
|
462
465
|
return map;
|
|
463
466
|
}
|
|
@@ -470,10 +473,10 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
470
473
|
let ifScope = scope[scopeAccessor];
|
|
471
474
|
ifScope && ifScope.H > 0 && ifScope.H < runId && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, fn, -1);
|
|
472
475
|
};
|
|
473
|
-
return ownerSignal._ = fn, ownerSignal;
|
|
476
|
+
return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
|
|
474
477
|
}
|
|
475
|
-
function subscribeToScopeSet(
|
|
476
|
-
let subscribers =
|
|
478
|
+
function subscribeToScopeSet(owner, accessor, scope) {
|
|
479
|
+
let subscribers = owner[accessor] ||= /* @__PURE__ */ new Set(), { size } = subscribers;
|
|
477
480
|
subscribers.add(scope).size !== size && trackCleanup(scope, subscribers);
|
|
478
481
|
}
|
|
479
482
|
function _closure(...closureSignals) {
|
|
@@ -482,7 +485,7 @@ function _closure(...closureSignals) {
|
|
|
482
485
|
return (scope) => {
|
|
483
486
|
if (scope[scopeInstances]) {
|
|
484
487
|
scope[scopeInstances]._ = 1;
|
|
485
|
-
for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId &&
|
|
488
|
+
for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId && closureSignals[childScope[signalIndex] || 0](childScope);
|
|
486
489
|
}
|
|
487
490
|
};
|
|
488
491
|
}
|
|
@@ -490,15 +493,10 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
|
490
493
|
valueAccessor = decodeAccessor(valueAccessor);
|
|
491
494
|
let closureSignal = ((scope, resumed) => {
|
|
492
495
|
let ownerScope = getOwnerScope ? getOwnerScope(scope) : scope._;
|
|
493
|
-
scope[closureSignal.b] = closureSignal.c, resumed ? ownerScope[closureSignal.a]._ && queueAsyncRender(scope,
|
|
496
|
+
scope[closureSignal.b] = closureSignal.c, subscribeToScopeSet(ownerScope, closureSignal.a, scope), resumed ? ownerScope[closureSignal.a]._ && queueAsyncRender(scope, fn) : queueRender(scope, fn, -1);
|
|
494
497
|
});
|
|
495
498
|
return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (_resumed[resumeId] = (scope) => closureSignal(scope, 1)), closureSignal;
|
|
496
499
|
}
|
|
497
|
-
function _child_setup(setup) {
|
|
498
|
-
return setup._ = (scope, owner) => {
|
|
499
|
-
scope._ ||= owner, queueRender(scope, setup, -1);
|
|
500
|
-
}, setup;
|
|
501
|
-
}
|
|
502
500
|
function _var(scope, childAccessor, signal) {
|
|
503
501
|
let childScope = scope[decodeAccessor(childAccessor)];
|
|
504
502
|
childScope.T = (value) => signal(scope, value), "RV" in childScope && signal(scope, childScope.RV);
|
|
@@ -507,10 +505,10 @@ function _return_change(scope, changeHandler) {
|
|
|
507
505
|
scope.U = changeHandler || void 0;
|
|
508
506
|
}
|
|
509
507
|
function _id(scope, accessor) {
|
|
510
|
-
let id = accessor
|
|
508
|
+
let id = accessor && scope[accessor];
|
|
511
509
|
if (!id) {
|
|
512
510
|
let $global = scope.$, n = tagIdsByGlobal.get($global) || 0;
|
|
513
|
-
tagIdsByGlobal.set($global, n + 1), id = "c" + $global.runtimeId + $global.renderId + n.toString(36), accessor
|
|
511
|
+
tagIdsByGlobal.set($global, n + 1), id = "c" + $global.runtimeId + $global.renderId + n.toString(36), accessor && (scope[accessor] = id);
|
|
514
512
|
}
|
|
515
513
|
return id;
|
|
516
514
|
}
|
|
@@ -537,7 +535,7 @@ function* traverse(scope, path, args, i = path.length - 1) {
|
|
|
537
535
|
function _hoist(...path) {
|
|
538
536
|
return path = path.map((p) => typeof p == "number" ? decodeAccessor(p) : p), (scope) => {
|
|
539
537
|
let fn = (...args) => traverse(scope, path, args).next().value;
|
|
540
|
-
return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
|
|
538
|
+
return fn[Symbol.iterator] = (_) => traverse(scope, path, []), fn;
|
|
541
539
|
};
|
|
542
540
|
}
|
|
543
541
|
function _hoist_resume(id, ...path) {
|
|
@@ -560,7 +558,7 @@ function withLazy() {
|
|
|
560
558
|
lazyEnabled = 1;
|
|
561
559
|
}
|
|
562
560
|
function initEmbedded(readyId, runtimeId) {
|
|
563
|
-
embedRenders || (embedRenders = /* @__PURE__ */ new Map(), new MutationObserver(() => {
|
|
561
|
+
embedRenders || (embedRenders = /* @__PURE__ */ new Map(), new MutationObserver((_) => {
|
|
564
562
|
for (let [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
|
|
565
563
|
embedRenders.delete(anchor), delete curRenders[renderId];
|
|
566
564
|
for (let id in scopes) destroyScope(scopes[id]);
|
|
@@ -574,7 +572,7 @@ function init(runtimeId = "M") {
|
|
|
574
572
|
if (curRenders) return;
|
|
575
573
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
|
|
576
574
|
defineRuntime({ value: curRenders = ((renderId) => {
|
|
577
|
-
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
|
|
575
|
+
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = (_) => scopeLookup[0] ||= {
|
|
578
576
|
runtimeId,
|
|
579
577
|
renderId
|
|
580
578
|
}, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
@@ -602,7 +600,7 @@ function init(runtimeId = "M") {
|
|
|
602
600
|
singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
|
|
603
601
|
}
|
|
604
602
|
visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
|
|
605
|
-
}, nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
|
|
603
|
+
}, nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
|
|
606
604
|
let i = 0;
|
|
607
605
|
for (; i < resumes.length; i++) {
|
|
608
606
|
let serialized = resumes[i];
|
|
@@ -628,7 +626,7 @@ function init(runtimeId = "M") {
|
|
|
628
626
|
let retained = 0;
|
|
629
627
|
for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)), embedRenders && !embedAnchor && visit.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
|
|
630
628
|
return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), visits.length = retained, effects;
|
|
631
|
-
}, render.w = () => {
|
|
629
|
+
}, render.w = (_) => {
|
|
632
630
|
walk(), runResumeEffects(render);
|
|
633
631
|
}, render;
|
|
634
632
|
}) });
|
|
@@ -655,10 +653,10 @@ function _var_resume(id, signal) {
|
|
|
655
653
|
return _resumed[id] = (scope) => (value) => signal(scope, value), signal;
|
|
656
654
|
}
|
|
657
655
|
function _el(id, accessor) {
|
|
658
|
-
return accessor = decodeAccessor(accessor), _resumed[id] = (scope) => () => scope[accessor];
|
|
656
|
+
return accessor = decodeAccessor(accessor), _resumed[id] = (scope) => (_) => scope[accessor];
|
|
659
657
|
}
|
|
660
658
|
function _dynamic_tag_var_resume(accessor) {
|
|
661
|
-
accessor = decodeAccessor(accessor), _resumed["-" + accessor] = (scope) => () => {
|
|
659
|
+
accessor = decodeAccessor(accessor), _resumed["-" + accessor] = (scope) => (_) => {
|
|
662
660
|
let node = scope[accessor];
|
|
663
661
|
return node.nodeType === 8 ? node.previousSibling : node;
|
|
664
662
|
};
|
|
@@ -676,7 +674,7 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
|
676
674
|
return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
|
|
677
675
|
}
|
|
678
676
|
function setupBranch(renderer, branch) {
|
|
679
|
-
return renderer.c
|
|
677
|
+
return renderer.c?.(branch), branch;
|
|
680
678
|
}
|
|
681
679
|
function _return_setup(setup) {
|
|
682
680
|
return setup;
|
|
@@ -711,11 +709,11 @@ function _content_closures(renderer, closureFns) {
|
|
|
711
709
|
let closureSignals = {};
|
|
712
710
|
for (let key in closureFns) closureSignals[key] = _const(+key, closureFns[key]);
|
|
713
711
|
return (owner, closureValues) => {
|
|
714
|
-
let instance = renderer(owner),
|
|
712
|
+
let instance = renderer(owner), setup = instance.c, setClosures = instance.g = (branch) => {
|
|
715
713
|
for (let key in closureSignals) closureSignals[key](branch, closureValues[key]);
|
|
716
714
|
};
|
|
717
|
-
return instance.
|
|
718
|
-
|
|
715
|
+
return instance.c = (branch) => {
|
|
716
|
+
setup?.(branch), setClosures(branch);
|
|
719
717
|
}, instance;
|
|
720
718
|
};
|
|
721
719
|
}
|
|
@@ -740,7 +738,7 @@ function setAttribute(element, name, value) {
|
|
|
740
738
|
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
|
741
739
|
}
|
|
742
740
|
function _attr_class(element, value) {
|
|
743
|
-
setAttribute(element, "class", toDelimitedString(value, " ",
|
|
741
|
+
setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassEntry) || void 0);
|
|
744
742
|
}
|
|
745
743
|
function _attr_class_items(element, items) {
|
|
746
744
|
for (let key in items) _attr_class_item(element, key, items[key]);
|
|
@@ -755,7 +753,7 @@ function _attr_class_names(element, names, value) {
|
|
|
755
753
|
while (start = end + 1);
|
|
756
754
|
}
|
|
757
755
|
function _attr_style(element, value) {
|
|
758
|
-
setAttribute(element, "style", toDelimitedString(value, ";",
|
|
756
|
+
setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleEntry) || void 0);
|
|
759
757
|
}
|
|
760
758
|
function _attr_style_items(element, items) {
|
|
761
759
|
for (let key in items) _attr_style_item(element, key, items[key]);
|
|
@@ -803,7 +801,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
|
803
801
|
!skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs))) && el.removeAttribute(name);
|
|
804
802
|
}
|
|
805
803
|
for (let name in nextAttrs) {
|
|
806
|
-
let key = isEventHandler(name) ? `on-${
|
|
804
|
+
let key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
|
|
807
805
|
skip[key] || (partial[key] = nextAttrs[name]);
|
|
808
806
|
}
|
|
809
807
|
attrsInternal(scope, nodeAccessor, partial, controllable);
|
|
@@ -824,13 +822,13 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
824
822
|
case "style":
|
|
825
823
|
_attr_style(el, value);
|
|
826
824
|
break;
|
|
827
|
-
default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[
|
|
825
|
+
default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventType(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
828
826
|
}
|
|
829
827
|
}
|
|
830
828
|
}
|
|
831
829
|
function _attr_content(scope, nodeAccessor, value) {
|
|
832
830
|
let content = normalizeClientRender(value);
|
|
833
|
-
scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (
|
|
831
|
+
scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setBranch(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
|
|
834
832
|
}
|
|
835
833
|
function _attrs_script(scope, nodeAccessor) {
|
|
836
834
|
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
@@ -842,11 +840,11 @@ function normalizeClientRender(value) {
|
|
|
842
840
|
if (renderer && renderer.a) return renderer;
|
|
843
841
|
}
|
|
844
842
|
function normalizeAttrValue(value) {
|
|
845
|
-
if (
|
|
843
|
+
if (isNotNullishOrFalse(value)) return value === !0 ? "" : value + "";
|
|
846
844
|
}
|
|
847
845
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
848
846
|
let accessor = "K" + index, instance = scope[accessor];
|
|
849
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, () => thisObj.onDestroy?.()));
|
|
847
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, (_) => thisObj.onDestroy?.()));
|
|
850
848
|
}
|
|
851
849
|
function removeChildNodes(startNode, endNode) {
|
|
852
850
|
let stop = endNode.nextSibling;
|
|
@@ -885,7 +883,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
|
|
|
885
883
|
//#endregion
|
|
886
884
|
//#region src/dom/controllable.ts
|
|
887
885
|
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
888
|
-
let el = scope[nodeAccessor], normalizedChecked =
|
|
886
|
+
let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
|
|
889
887
|
if (el.defaultChecked !== normalizedChecked) {
|
|
890
888
|
let restoreValue = scope.H < runId ? el.checked : normalizedChecked;
|
|
891
889
|
el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
|
|
@@ -895,14 +893,14 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
|
895
893
|
* page carries only the control kinds its tags can be (`_attrs_script`
|
|
896
894
|
* resolves the kind at run time). */
|
|
897
895
|
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
898
|
-
* a statically named tag passes its
|
|
896
|
+
* a statically named tag passes its helper to `_attrs` instead. */
|
|
899
897
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
900
|
-
let el = scope[nodeAccessor], normalizedChecked =
|
|
898
|
+
let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
|
|
901
899
|
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
902
900
|
}
|
|
903
901
|
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
904
902
|
let el = scope[nodeAccessor];
|
|
905
|
-
syncControllableFormInput(el, hasCheckboxChanged, () => {
|
|
903
|
+
syncControllableFormInput(el, hasCheckboxChanged, (_) => {
|
|
906
904
|
let checkedChange = scope["E" + nodeAccessor];
|
|
907
905
|
if (checkedChange) {
|
|
908
906
|
let newValue = el.checked;
|
|
@@ -920,7 +918,7 @@ function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValu
|
|
|
920
918
|
}
|
|
921
919
|
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
922
920
|
let el = scope[nodeAccessor];
|
|
923
|
-
isResuming && el.defaultChecked && (scope["G" + nodeAccessor] ? scope["G" + nodeAccessor].push(el.value) : scope["G" + nodeAccessor] = el.value), syncControllableFormInput(el, hasCheckboxChanged, () => {
|
|
921
|
+
isResuming && el.defaultChecked && (scope["G" + nodeAccessor] ? scope["G" + nodeAccessor].push(el.value) : scope["G" + nodeAccessor] = el.value), syncControllableFormInput(el, hasCheckboxChanged, (_) => {
|
|
924
922
|
let checkedValueChange = scope["E" + nodeAccessor];
|
|
925
923
|
if (checkedValueChange) {
|
|
926
924
|
let controlledValueKey = "G" + nodeAccessor, oldValue = scope[controlledValueKey], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
@@ -963,7 +961,7 @@ function setInputValue(el, value) {
|
|
|
963
961
|
}
|
|
964
962
|
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
965
963
|
let restoreValue, el = scope[nodeAccessor], live = scope.H < runId, multiple = Array.isArray(value), normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
966
|
-
pendingEffects.unshift(() => {
|
|
964
|
+
pendingEffects.unshift((_) => {
|
|
967
965
|
for (let opt of el.options) {
|
|
968
966
|
let selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
969
967
|
opt.defaultSelected !== selected && (live && (restoreValue ??= getSelectValue(el, multiple)), opt.defaultSelected = selected);
|
|
@@ -973,10 +971,10 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
|
973
971
|
}
|
|
974
972
|
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
975
973
|
let el = scope[nodeAccessor], existing = scope.H < runId, multiple = Array.isArray(value), normalizedValue = scope["G" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
976
|
-
scope["E" + nodeAccessor] = valueChange, scope["F" + nodeAccessor] = valueChange ? 3 : 5, valueChange && existing ? pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope) : _attr_select_value_default(scope, nodeAccessor, normalizedValue);
|
|
974
|
+
scope["E" + nodeAccessor] = valueChange, scope["F" + nodeAccessor] = valueChange ? 3 : 5, valueChange && existing ? pendingEffects.unshift((_) => setSelectValue(el, normalizedValue, multiple), scope) : _attr_select_value_default(scope, nodeAccessor, normalizedValue);
|
|
977
975
|
}
|
|
978
976
|
function _attr_select_value_script(scope, nodeAccessor) {
|
|
979
|
-
let el = scope[nodeAccessor], onChange = () => {
|
|
977
|
+
let el = scope[nodeAccessor], onChange = (_) => {
|
|
980
978
|
let valueChange = scope["E" + nodeAccessor];
|
|
981
979
|
if (valueChange) {
|
|
982
980
|
let oldValue = scope["G" + nodeAccessor], multiple = Array.isArray(oldValue), newValue = getSelectValue(el, multiple);
|
|
@@ -995,10 +993,10 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
995
993
|
}
|
|
996
994
|
}
|
|
997
995
|
}
|
|
998
|
-
syncControllableFormInput(el, hasSelectChanged, onChange),
|
|
996
|
+
syncControllableFormInput(el, hasSelectChanged, onChange), observeControlled(scope, nodeAccessor, {
|
|
999
997
|
childList: !0,
|
|
1000
998
|
subtree: !0
|
|
1001
|
-
}, () => {
|
|
999
|
+
}, (_) => {
|
|
1002
1000
|
let value = scope["G" + nodeAccessor];
|
|
1003
1001
|
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) && onChange();
|
|
1004
1002
|
});
|
|
@@ -1011,18 +1009,18 @@ function getSelectValue(el, multiple) {
|
|
|
1011
1009
|
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
1012
1010
|
}
|
|
1013
1011
|
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
1014
|
-
scope.H === runId && (scope[nodeAccessor].open =
|
|
1012
|
+
scope.H === runId && (scope[nodeAccessor].open = isNotNullishOrFalse(open));
|
|
1015
1013
|
}
|
|
1016
1014
|
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
1017
|
-
let normalizedOpen = scope["G" + nodeAccessor] =
|
|
1015
|
+
let normalizedOpen = scope["G" + nodeAccessor] = isNotNullishOrFalse(open);
|
|
1018
1016
|
scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange && scope.H < runId ? scope[nodeAccessor].open = normalizedOpen : _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
|
|
1019
1017
|
}
|
|
1020
1018
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
1021
1019
|
let el = scope[nodeAccessor];
|
|
1022
|
-
|
|
1020
|
+
observeControlled(scope, nodeAccessor, {
|
|
1023
1021
|
attributes: !0,
|
|
1024
1022
|
attributeFilter: ["open"]
|
|
1025
|
-
}, () => {
|
|
1023
|
+
}, (_) => {
|
|
1026
1024
|
let openChange = scope["E" + nodeAccessor];
|
|
1027
1025
|
if (openChange && el.open === !scope["G" + nodeAccessor]) {
|
|
1028
1026
|
let newValue = el.open;
|
|
@@ -1030,7 +1028,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
|
1030
1028
|
}
|
|
1031
1029
|
});
|
|
1032
1030
|
}
|
|
1033
|
-
function
|
|
1031
|
+
function observeControlled(scope, nodeAccessor, init, callback) {
|
|
1034
1032
|
(scope["N" + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
1035
1033
|
}
|
|
1036
1034
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
@@ -1042,7 +1040,7 @@ function handleChange(ev) {
|
|
|
1042
1040
|
function handleFormReset(ev) {
|
|
1043
1041
|
let handlers = [];
|
|
1044
1042
|
for (let el of ev.target.elements || []) el._ && el.c(el) && handlers.push(el._);
|
|
1045
|
-
requestAnimationFrame(() => {
|
|
1043
|
+
requestAnimationFrame((_) => {
|
|
1046
1044
|
if (!ev.defaultPrevented) for (let change of handlers) change();
|
|
1047
1045
|
});
|
|
1048
1046
|
}
|
|
@@ -1085,18 +1083,18 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1085
1083
|
isPromise(scope[promiseAccessor]) || (scope[promiseAccessor] = 0);
|
|
1086
1084
|
let awaitBranch = scope[branchAccessor], tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
|
|
1087
1085
|
if (!tryBranch) {
|
|
1088
|
-
let deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter = findTryWithPlaceholder(scope)?.O;
|
|
1086
|
+
let deferred = scope[promiseAccessor] = (_) => deferred === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter = findTryWithPlaceholder(scope)?.O;
|
|
1089
1087
|
if (awaitCounter?.i) {
|
|
1090
1088
|
let complete = awaitCounter.c;
|
|
1091
|
-
awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
|
|
1089
|
+
awaitCounter.c = (_) => complete() || queueAsyncRender(scope, deferred);
|
|
1092
1090
|
}
|
|
1093
1091
|
return;
|
|
1094
1092
|
}
|
|
1095
1093
|
if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1096
1094
|
let awaitCounter = tryBranch.O;
|
|
1097
|
-
scope[tryAccessor] || (scope[tryAccessor] = tryBranch, trackAbort(scope, promiseAccessor, () => {
|
|
1095
|
+
scope[tryAccessor] || (scope[tryAccessor] = tryBranch, trackAbort(scope, promiseAccessor, (_) => {
|
|
1098
1096
|
scope[promiseAccessor] = 0, scope[tryAccessor] && queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
|
|
1099
|
-
}), awaitBranch && (awaitBranch.W ||= []), tryBranch === awaitBranch ? (awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1097
|
+
}), awaitBranch && (awaitBranch.W ||= []), tryBranch === awaitBranch ? (awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, (_) => {
|
|
1100
1098
|
if (tryBranch === scope[branchAccessor]) {
|
|
1101
1099
|
let anchor = scope[nodeAccessor];
|
|
1102
1100
|
if (anchor.parentNode) {
|
|
@@ -1104,13 +1102,13 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1104
1102
|
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
1105
1103
|
}
|
|
1106
1104
|
}
|
|
1107
|
-
})),
|
|
1105
|
+
})), countAwait(awaitCounter, scope, (_) => {
|
|
1108
1106
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
1109
|
-
})) : awaitCounter =
|
|
1107
|
+
})) : awaitCounter = startAwait(scope, tryBranch));
|
|
1110
1108
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1111
1109
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1112
1110
|
let referenceNode = scope[nodeAccessor];
|
|
1113
|
-
scope[promiseAccessor] = 0, scope[branchAccessor] ? queueAsyncRender(scope, () => {
|
|
1111
|
+
scope[promiseAccessor] = 0, scope[branchAccessor] ? queueAsyncRender(scope, (_) => {
|
|
1114
1112
|
if (!scope[promiseAccessor]) {
|
|
1115
1113
|
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1116
1114
|
let pendingRenders = awaitBranch.W;
|
|
@@ -1126,21 +1124,21 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1126
1124
|
}
|
|
1127
1125
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1128
1126
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1129
|
-
let branchAccessor = "A" + nodeAccessor,
|
|
1127
|
+
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1130
1128
|
return (scope) => {
|
|
1131
|
-
let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
|
|
1132
|
-
scope[branchAccessor].Y = pendingScopes
|
|
1129
|
+
let pendingScopes = collectScopes((_) => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
|
|
1130
|
+
scope[branchAccessor].Y = pendingScopes;
|
|
1133
1131
|
};
|
|
1134
1132
|
}
|
|
1135
|
-
function
|
|
1133
|
+
function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
|
|
1136
1134
|
if (!tryBranch) return;
|
|
1137
1135
|
let awaitCounter = tryBranch.O;
|
|
1138
|
-
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))),
|
|
1136
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch))), countAwait(awaitCounter, tryBranch, (_) => {
|
|
1139
1137
|
(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1140
1138
|
}), awaitCounter;
|
|
1141
1139
|
}
|
|
1142
|
-
function
|
|
1143
|
-
awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1140
|
+
function countAwait(awaitCounter, scope, render) {
|
|
1141
|
+
awaitCounter.i++ || requestAnimationFrame((_) => awaitCounter.i && runEffects(prepareEffects((_) => queueRender(scope, render, -1))));
|
|
1144
1142
|
}
|
|
1145
1143
|
function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
|
|
1146
1144
|
queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch.L + 1e9);
|
|
@@ -1177,11 +1175,11 @@ function dismissPlaceholder(tryBranch) {
|
|
|
1177
1175
|
}
|
|
1178
1176
|
function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
|
|
1179
1177
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1180
|
-
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks
|
|
1178
|
+
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks)();
|
|
1181
1179
|
return (scope) => {
|
|
1182
|
-
|
|
1180
|
+
setBranch(scope, nodeAccessor, renderer, createBranch);
|
|
1183
1181
|
let branch = scope[branchAccessor];
|
|
1184
|
-
branch.C = nodeAccessor, branch.E = catchContent, branch.Q = placeholderContent || void 0;
|
|
1182
|
+
branch.C = nodeAccessor, branch.E = catchContent, branch.Q = placeholderContent || void 0, setup && queueRender(branch, setup, -1);
|
|
1185
1183
|
};
|
|
1186
1184
|
}
|
|
1187
1185
|
function renderCatch(scope, error) {
|
|
@@ -1190,7 +1188,9 @@ function renderCatch(scope, error) {
|
|
|
1190
1188
|
let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
|
|
1191
1189
|
placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch));
|
|
1192
1190
|
let catchContent = tryWithCatch.E();
|
|
1193
|
-
|
|
1191
|
+
setBranch(owner, tryWithCatch.C, catchContent, createBranch), queueRender(owner["A" + tryWithCatch.C], (branch) => {
|
|
1192
|
+
setupBranch(catchContent, branch), catchContent.d?.(branch, [error]);
|
|
1193
|
+
}, -1);
|
|
1194
1194
|
} else throw error;
|
|
1195
1195
|
}
|
|
1196
1196
|
function findTryWithPlaceholder(scope) {
|
|
@@ -1215,7 +1215,7 @@ function installDynamicTagVar(bind) {
|
|
|
1215
1215
|
function dynamicTagScript(branch) {
|
|
1216
1216
|
_attrs_script(branch, "a");
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function setBranch(scope, nodeAccessor, newRenderer, createBranch) {
|
|
1219
1219
|
let referenceNode = scope[nodeAccessor], prevBranch = scope["A" + nodeAccessor], parentNode = referenceNode.nodeType > 1 ? (prevBranch?.S || referenceNode).parentNode : referenceNode, newBranch = scope["A" + nodeAccessor] = newRenderer && createBranch(scope.$, newRenderer, scope, parentNode);
|
|
1220
1220
|
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.S) : parentNode.insertBefore(referenceNode, prevBranch.S), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
|
1221
1221
|
}
|
|
@@ -1232,10 +1232,6 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
|
|
|
1232
1232
|
for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
|
|
1233
1233
|
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
|
|
1234
1234
|
}
|
|
1235
|
-
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
1236
|
-
let branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
1237
|
-
return typeof tagNameOrRenderer == "string" && (branch.a = branch.S = branch.K = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer)), branch;
|
|
1238
|
-
}
|
|
1239
1235
|
function bySecondArg(_item, index) {
|
|
1240
1236
|
return index;
|
|
1241
1237
|
}
|
|
@@ -1243,4 +1239,4 @@ function byFirstArg(name) {
|
|
|
1243
1239
|
return name;
|
|
1244
1240
|
}
|
|
1245
1241
|
//#endregion
|
|
1246
|
-
export { _attr_style_items as $,
|
|
1242
|
+
export { _attr_style_items as $, removeAndDestroyBranch as $t, _attr_input_value as A, withLazy as At, _controllable_select as B, _id as Bt, _attr_details_or_dialog_open_script as C, withBranches as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, initEmbedded as Dt, _attr_input_checkedValue_default as E, init as Et, _attr_select_value as F, _for_closure as Ft, _attr_class as G, _return as Gt, controllableScripts as H, _let as Ht, _attr_select_value_default as I, _for_selector as It, _attr_class_names as J, _var as Jt, _attr_class_item as K, _return_change as Kt, _attr_select_value_script as L, _global_read as Lt, _attr_input_value_default as M, _closure_get as Mt, _attr_input_value_dynamic_default as N, _const as Nt, _attr_input_checked_default as O, ready as Ot, _attr_input_value_script as P, _el_read as Pt, _attr_style_item as Q, insertBranchBefore as Qt, _controllable_input as R, _hoist as Rt, _attr_details_or_dialog_open_default as S, _call as Sn, _el as St, _attr_input_checkedValue as T, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, _let_change as Ut, _controllable_textarea as V, _if_closure as Vt, _attr as W, _or as Wt, _attr_nonce as X, _assert_init as Xt, _attr_content as Y, _var_change as Yt, _attr_style as Z, destroyBranch as Zt, patchDynamicTag as _, forTo as _n, _return_setup as _t, _for_in as a, installBranchRenders as an, _html as at, startAwait as b, _assert_hoist as bn, setupBranch as bt, _for_to as c, queueAsyncRender as cn, _style_shell as ct, _for_until_unkeyed as d, rendering as dn, _to_text as dt, syncGen as en, _attrs as et, _if as f, run as fn, insertChildNodes as ft, installDynamicTagVar as g, forOf as gn, _content_resume as gt, dynamicTagScript as h, forIn as hn, _content_closures as ht, _dynamic_tag_content as i, createBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, _closure as jt, _attr_input_checked_script as k, readyFailed as kt, _for_to_unkeyed as l, queueEffect as ln, _text as lt, _try as m, runId as mn, _content as mt, _await_promise as n, $signal as nn, _attrs_partial as nt, _for_of as o, installCatch as on, _lifecycle as ot, _show as p, runEffects as pn, toInsertNode as pt, _attr_class_items as q, _script as qt, _dynamic_tag as r, $signalReset as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_rule_item as st, _await_content as t, _on as tn, _attrs_content as tt, _for_until as u, queueRender as un, _text_content as ut, renderCatch as v, forUntil as vn, createAndSetupBranch as vt, _attr_input_checked as w, _var_resume as wt, _attr_details_or_dialog_open as x, _hoist_read_error as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, _assert_class_toggles as yn, createBranch as yt, _controllable_open as z, _hoist_resume as zt };
|
package/dist/dom.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export { run } from "./dom/queue";
|
|
|
13
13
|
export { _content, _content_closures, _content_resume, _return_setup, } from "./dom/renderer";
|
|
14
14
|
export { _dynamic_tag_var_resume, _el, _resumed, _var_resume, init, initEmbedded, ready, readyFailed, } from "./dom/resume";
|
|
15
15
|
export { _assert_init } from "./dom/scope";
|
|
16
|
-
export {
|
|
16
|
+
export { _closure, _closure_get, _const, _el_read, _global_read, _for_closure, _for_selector, _hoist, _hoist_resume, _id, _if_closure, _let, _let_change, _or, _return, _return_change, _script, _var, _var_change, } from "./dom/signals";
|
|
17
17
|
export { _template } from "./dom/template";
|