marko 6.3.33 → 6.3.35
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 +37 -33
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/types.d.ts +10 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- 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 +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/{dom-BJ93mcSe.mjs → dom-B57LrRnX.mjs} +89 -46
- package/dist/debug/{dom-CiFITSPN.js → dom-Bt4OoZ-j.js} +89 -46
- package/dist/debug/dom.js +3 -1
- package/dist/debug/dom.mjs +3 -1
- package/dist/debug/html.js +205 -98
- package/dist/debug/html.mjs +205 -98
- package/dist/dom/catch.feat.js +1 -1
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +4 -1
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/signals.d.ts +3 -3
- package/dist/{dom-Cj4HQ7T_.mjs → dom-BP2XSglG.mjs} +46 -33
- package/dist/{dom-CI-06TZb.js → dom-BeF9xIzO.js} +46 -33
- package/dist/dom.js +3 -1
- package/dist/dom.mjs +3 -1
- package/dist/html/compat.d.ts +4 -2
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/serializer.d.ts +9 -1
- package/dist/html/template.d.ts +1 -0
- package/dist/html/writer.d.ts +1 -0
- package/dist/html.js +88 -63
- package/dist/html.mjs +88 -63
- package/dist/translator/core/client.d.ts +1 -2
- package/dist/translator/core/server.d.ts +1 -2
- package/dist/translator/core/static.d.ts +1 -2
- package/dist/translator/index.js +514 -314
- package/dist/translator/util/constants/binding-type.d.ts +1 -0
- package/dist/translator/util/references.d.ts +8 -1
- package/dist/translator/util/serialize-reasons.d.ts +4 -4
- package/dist/translator/util/signals.d.ts +5 -0
- package/dist/translator/util/statement-tag.d.ts +2 -0
- package/dist/translator/util/translate-var.d.ts +1 -1
- package/dist/translator/visitors/export-declaration.d.ts +8 -0
- package/dist/translator/visitors/program/index.d.ts +0 -1
- package/package.json +5 -4
- package/tags/html-comment.d.marko +2 -0
- package/tags/html-script.d.marko +2 -0
- package/tags/html-style.d.marko +2 -0
- package/tags/let.d.marko +4 -5
- package/tags/show.d.marko +6 -0
- package/tags/try.d.marko +1 -1
- package/tags-html.d.ts +6 -1
- /package/dist/translator/util/{get-accessor-char.d.ts → get-accessor-enums.d.ts} +0 -0
|
@@ -113,6 +113,7 @@ function stringifyStyleObject(name, value) {
|
|
|
113
113
|
warnedStyleKeys.add(name);
|
|
114
114
|
console.warn(`\`${name}\` is not a CSS property name; \`style\` object keys are written verbatim, so it renders as invalid CSS. Use \`${name.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^ms-/, "-ms-")}\`.`);
|
|
115
115
|
}
|
|
116
|
+
if (value !== value || typeof value === "bigint" && !value) console.warn(`The \`${name}\` style value \`${value !== value ? "NaN" : "0n"}\` drops the declaration; convert it to a string or number to render it.`);
|
|
116
117
|
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
117
118
|
}
|
|
118
119
|
const unsafeStyleAttrReg = /[\\;]/g;
|
|
@@ -189,6 +190,13 @@ function assertValidAttrValue(name, value) {
|
|
|
189
190
|
function assertValidTextValue(value) {
|
|
190
191
|
const unrenderable = describeUnrenderable(value);
|
|
191
192
|
if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
|
|
193
|
+
if (isSilentlyDropped(value)) console.warn(`Text content of \`${describeDropped(value)}\` renders as nothing; convert it to a string or number to render it.`);
|
|
194
|
+
}
|
|
195
|
+
function isSilentlyDropped(value) {
|
|
196
|
+
return value !== value || typeof value === "bigint" && !value;
|
|
197
|
+
}
|
|
198
|
+
function describeDropped(value) {
|
|
199
|
+
return value !== value ? "NaN" : "0n";
|
|
192
200
|
}
|
|
193
201
|
function describeUnrenderable(value) {
|
|
194
202
|
if (typeof value === "symbol") return "a symbol";
|
|
@@ -212,6 +220,9 @@ function assertValidLoopKey(key, seenKeys) {
|
|
|
212
220
|
function assertValidList(value) {
|
|
213
221
|
if (value && typeof value[Symbol.iterator] !== "function") throw new Error(`A \`<for>\` tag's \`of\` attribute must be an iterable, such as an array, but received ${describeForValue(value)}.`);
|
|
214
222
|
}
|
|
223
|
+
function assertValidRangeStart(name, value) {
|
|
224
|
+
if (value && (typeof value !== "number" || !isFinite(value))) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
|
|
225
|
+
}
|
|
215
226
|
function assertValidRangeBound(name, value) {
|
|
216
227
|
if (!isFinite(value)) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
|
|
217
228
|
}
|
|
@@ -243,10 +254,16 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
243
254
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
244
255
|
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
245
256
|
}
|
|
246
|
-
if (attrs.valueChange)
|
|
257
|
+
if (attrs.valueChange) {
|
|
258
|
+
(exclusiveAttrs ||= []).push("valueChange");
|
|
259
|
+
if ("checked" in attrs && !exclusiveAttrs.includes("checked")) exclusiveAttrs.push("checked");
|
|
260
|
+
}
|
|
247
261
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
248
262
|
}
|
|
249
263
|
}
|
|
264
|
+
function assertNoValueBindingOnCheckable(type, valueChange) {
|
|
265
|
+
if (valueChange && /^(?:button|checkbox|hidden|image|radio|reset|submit)$/i.test(type)) console.error(`\`valueChange\` cannot be used on a \`type="${type}"\` \`<input>\` — user interaction can never change its \`value\`.` + (/^[cr]/i.test(type) ? " Bind `checked` or `checkedValue` instead." : ""));
|
|
266
|
+
}
|
|
250
267
|
function assertHandlerIsFunction(name, value) {
|
|
251
268
|
if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
|
|
252
269
|
}
|
|
@@ -278,12 +295,16 @@ function forOf(list, cb) {
|
|
|
278
295
|
}
|
|
279
296
|
function forTo(to, from, step, cb) {
|
|
280
297
|
assertValidRangeBound("to", to);
|
|
298
|
+
assertValidRangeStart("from", from);
|
|
299
|
+
assertValidRangeStart("step", step);
|
|
281
300
|
const start = from || 0;
|
|
282
301
|
const delta = step || 1;
|
|
283
302
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
284
303
|
}
|
|
285
304
|
function forUntil(until, from, step, cb) {
|
|
286
305
|
assertValidRangeBound("until", until);
|
|
306
|
+
assertValidRangeStart("from", from);
|
|
307
|
+
assertValidRangeStart("step", step);
|
|
287
308
|
const start = from || 0;
|
|
288
309
|
const delta = step || 1;
|
|
289
310
|
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
@@ -441,10 +462,10 @@ function push(opt, item) {
|
|
|
441
462
|
//#region src/dom/event.ts
|
|
442
463
|
function _on(element, type, handler) {
|
|
443
464
|
assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
|
|
444
|
-
if (element[
|
|
445
|
-
element[
|
|
465
|
+
if (element[1 + type] === void 0) delegate(type, handleDelegated);
|
|
466
|
+
element[1 + type] = handler || null;
|
|
446
467
|
}
|
|
447
|
-
const delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, true), 1);
|
|
468
|
+
const delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, true), 1);
|
|
448
469
|
function handleDelegated(ev) {
|
|
449
470
|
let target = !rendering && ev.target;
|
|
450
471
|
Object.defineProperty(ev, "currentTarget", {
|
|
@@ -455,7 +476,7 @@ function handleDelegated(ev) {
|
|
|
455
476
|
}
|
|
456
477
|
});
|
|
457
478
|
while (target) {
|
|
458
|
-
target[
|
|
479
|
+
target[1 + ev.type]?.(ev, target);
|
|
459
480
|
target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
|
460
481
|
}
|
|
461
482
|
delete ev.currentTarget;
|
|
@@ -720,17 +741,23 @@ function _var(scope, childAccessor, signal) {
|
|
|
720
741
|
}
|
|
721
742
|
const _return = (scope, value) => scope[TagVariable]?.(value);
|
|
722
743
|
function _return_change(scope, changeHandler) {
|
|
723
|
-
|
|
744
|
+
scope[TagVariableChange] = changeHandler || void 0;
|
|
724
745
|
}
|
|
725
746
|
const _var_change = (scope, value, name = "This") => {
|
|
726
747
|
if (typeof scope["#TagVariableChange"] !== "function") throw new TypeError(`${name} is a readonly tag variable.`);
|
|
727
748
|
scope[TagVariableChange](value);
|
|
728
749
|
};
|
|
729
750
|
const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
|
730
|
-
function _id(
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
751
|
+
function _id(scope, accessor) {
|
|
752
|
+
let id = accessor !== void 0 && scope[accessor];
|
|
753
|
+
if (!id) {
|
|
754
|
+
const $global = scope[Global];
|
|
755
|
+
const n = tagIdsByGlobal.get($global) || 0;
|
|
756
|
+
tagIdsByGlobal.set($global, n + 1);
|
|
757
|
+
id = "c" + $global.runtimeId + $global.renderId + n.toString(36);
|
|
758
|
+
if (accessor !== void 0) scope[accessor] = id;
|
|
759
|
+
}
|
|
760
|
+
return id;
|
|
734
761
|
}
|
|
735
762
|
function _script(id, fn) {
|
|
736
763
|
_resume(id, fn);
|
|
@@ -742,19 +769,19 @@ function _el_read(value) {
|
|
|
742
769
|
if (rendering) _el_read_error();
|
|
743
770
|
return value;
|
|
744
771
|
}
|
|
745
|
-
function* traverse(scope, path, i = path.length - 1) {
|
|
772
|
+
function* traverse(scope, path, args, i = path.length - 1) {
|
|
746
773
|
if (rendering) _hoist_read_error();
|
|
747
|
-
if (scope) if (Symbol.iterator in scope) for (const childScope of scope.values()) yield* traverse(childScope, path, i);
|
|
774
|
+
if (scope) if (Symbol.iterator in scope) for (const childScope of scope.values()) yield* traverse(childScope, path, args, i);
|
|
748
775
|
else {
|
|
749
776
|
const item = scope[path[i]];
|
|
750
|
-
if (i) yield* traverse(item, path, i - 1);
|
|
751
|
-
else yield typeof item === "function" ? item() : item;
|
|
777
|
+
if (i) yield* traverse(item, path, args, i - 1);
|
|
778
|
+
else yield typeof item === "function" ? item(...args) : item;
|
|
752
779
|
}
|
|
753
780
|
}
|
|
754
781
|
function _hoist(...path) {
|
|
755
782
|
return (scope) => {
|
|
756
|
-
const fn = () => traverse(scope, path).next().value;
|
|
757
|
-
fn[Symbol.iterator] = () => traverse(scope, path);
|
|
783
|
+
const fn = (...args) => traverse(scope, path, args).next().value;
|
|
784
|
+
fn[Symbol.iterator] = () => traverse(scope, path, []);
|
|
758
785
|
return fn;
|
|
759
786
|
};
|
|
760
787
|
}
|
|
@@ -1056,7 +1083,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1056
1083
|
setup = setup ? setup._ || setup : void 0;
|
|
1057
1084
|
params ||= void 0;
|
|
1058
1085
|
const clone = template ? (branch, ns) => {
|
|
1059
|
-
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
1086
|
+
((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
1060
1087
|
} : (branch) => {
|
|
1061
1088
|
walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
|
|
1062
1089
|
};
|
|
@@ -1176,7 +1203,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
|
1176
1203
|
const partial = {};
|
|
1177
1204
|
for (let i = el.attributes.length; i--;) {
|
|
1178
1205
|
const { name } = el.attributes.item(i);
|
|
1179
|
-
if (!skip[name] && !(nextAttrs && name in nextAttrs)) el.removeAttribute(name);
|
|
1206
|
+
if (!skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
|
|
1180
1207
|
}
|
|
1181
1208
|
for (const name in nextAttrs) {
|
|
1182
1209
|
const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
@@ -1221,7 +1248,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
1221
1248
|
}
|
|
1222
1249
|
function _attr_content(scope, nodeAccessor, value) {
|
|
1223
1250
|
const content = normalizeClientRender(value);
|
|
1224
|
-
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = content
|
|
1251
|
+
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
|
|
1225
1252
|
setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1226
1253
|
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
1227
1254
|
}
|
|
@@ -1290,17 +1317,16 @@ function toInsertNode(startNode, endNode) {
|
|
|
1290
1317
|
}
|
|
1291
1318
|
//#endregion
|
|
1292
1319
|
//#region src/dom/resolve-cursor-position.ts
|
|
1293
|
-
const R = /[
|
|
1320
|
+
const R = /[\p{L}\p{N}]/gu;
|
|
1294
1321
|
function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
|
|
1295
1322
|
if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
|
|
1296
1323
|
const before = initialValue.slice(0, initialPosition);
|
|
1297
1324
|
const after = initialValue.slice(initialPosition);
|
|
1298
1325
|
if (updatedValue.startsWith(before)) return initialPosition;
|
|
1299
1326
|
if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
|
|
1300
|
-
let count = before.
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
return pos;
|
|
1327
|
+
let count = before.match(R)?.length;
|
|
1328
|
+
while (count && R.test(updatedValue)) count--;
|
|
1329
|
+
return count ? updatedValue.length : R.lastIndex;
|
|
1304
1330
|
}
|
|
1305
1331
|
return -1;
|
|
1306
1332
|
}
|
|
@@ -1402,17 +1428,19 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault =
|
|
|
1402
1428
|
const el = scope[nodeAccessor];
|
|
1403
1429
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1404
1430
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
1431
|
+
assertNoValueBindingOnCheckable(el.type, valueChange);
|
|
1405
1432
|
scope[ControlledHandler + nodeAccessor] = valueChange;
|
|
1406
1433
|
scope[ControlledValue + nodeAccessor] = normalizedValue;
|
|
1407
1434
|
scope[ControlledType + nodeAccessor] = valueChange ? 2 : 5;
|
|
1408
1435
|
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1409
|
-
else setDefault(scope, nodeAccessor,
|
|
1436
|
+
else setDefault(scope, nodeAccessor, value);
|
|
1410
1437
|
}
|
|
1411
1438
|
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1412
1439
|
_attr(scope[nodeAccessor], "value", value);
|
|
1413
1440
|
}
|
|
1414
1441
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1415
1442
|
const el = scope[nodeAccessor];
|
|
1443
|
+
assertNoValueBindingOnCheckable(el.type, scope[ControlledHandler + nodeAccessor]);
|
|
1416
1444
|
if (isResuming) scope[ControlledValue + nodeAccessor] = el.defaultValue;
|
|
1417
1445
|
syncControllableFormInput(el, hasValueChanged, (ev) => {
|
|
1418
1446
|
const valueChange = scope[ControlledHandler + nodeAccessor];
|
|
@@ -1644,12 +1672,12 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1644
1672
|
if (!scope[promiseAccessor]) {
|
|
1645
1673
|
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1646
1674
|
if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
|
|
1647
|
-
else
|
|
1675
|
+
else scheduleAwaitFrame(awaitCounter, scope, () => {
|
|
1648
1676
|
if (!awaitBranch["#DetachedAwait"]) {
|
|
1649
|
-
awaitBranch[
|
|
1677
|
+
awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
|
|
1650
1678
|
tempDetachBranch(tryBranch);
|
|
1651
1679
|
}
|
|
1652
|
-
}
|
|
1680
|
+
});
|
|
1653
1681
|
}
|
|
1654
1682
|
const thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1655
1683
|
if (thisPromise === scope[promiseAccessor]) {
|
|
@@ -1714,12 +1742,15 @@ function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, Placeholder
|
|
|
1714
1742
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1715
1743
|
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1716
1744
|
placeholderShown.add(pendingEffects);
|
|
1717
|
-
|
|
1718
|
-
insertBranchBefore(tryBranch[
|
|
1745
|
+
scheduleAwaitFrame(awaitCounter, tryBranch, () => {
|
|
1746
|
+
insertBranchBefore(tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent], tryBranch["_"], tryBranch[StartNode].parentNode), tryBranch[StartNode].parentNode, tryBranch[StartNode]);
|
|
1719
1747
|
tempDetachBranch(tryBranch);
|
|
1720
|
-
}
|
|
1748
|
+
});
|
|
1721
1749
|
return awaitCounter;
|
|
1722
1750
|
}
|
|
1751
|
+
function scheduleAwaitFrame(awaitCounter, scope, render) {
|
|
1752
|
+
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1753
|
+
}
|
|
1723
1754
|
function createAwaitCounter(tryBranch, done) {
|
|
1724
1755
|
const awaitCounter = tryBranch[AwaitCounter] = {
|
|
1725
1756
|
i: 0,
|
|
@@ -1817,6 +1848,9 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNo
|
|
|
1817
1848
|
}
|
|
1818
1849
|
};
|
|
1819
1850
|
});
|
|
1851
|
+
function rendererKey(renderer) {
|
|
1852
|
+
return renderer?.["owner"] ? renderer["id"] + " " + renderer[Owner]["#Id"] : renderer?.["id"] || renderer;
|
|
1853
|
+
}
|
|
1820
1854
|
function patchDynamicTag(fn) {
|
|
1821
1855
|
_dynamic_tag = fn(_dynamic_tag);
|
|
1822
1856
|
}
|
|
@@ -1825,14 +1859,15 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1825
1859
|
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1826
1860
|
return (scope, newRenderer, getInput) => {
|
|
1827
1861
|
const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
1828
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer
|
|
1862
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
|
1829
1863
|
setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer);
|
|
1830
|
-
if (getTagVar) scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1864
|
+
if (getTagVar) if (scope[childScopeAccessor]) scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1865
|
+
else getTagVar()(scope, void 0);
|
|
1831
1866
|
if (typeof normalizedRenderer === "string") {
|
|
1832
1867
|
if (getContent) {
|
|
1833
1868
|
const content = getContent(scope);
|
|
1834
|
-
setConditionalRenderer(scope[childScopeAccessor], `#${normalizedRenderer}/0`, content, createAndSetupBranch);
|
|
1835
|
-
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${normalizedRenderer}/0`]);
|
|
1869
|
+
setConditionalRenderer(scope[childScopeAccessor], `#${normalizedRenderer.toLowerCase()}/0`, content, createAndSetupBranch);
|
|
1870
|
+
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${normalizedRenderer.toLowerCase()}/0`]);
|
|
1836
1871
|
}
|
|
1837
1872
|
} else if (normalizedRenderer?.["accessor"]) subscribeToScopeSet(normalizedRenderer[Owner], normalizedRenderer[Accessor], scope[childScopeAccessor]);
|
|
1838
1873
|
}
|
|
@@ -1840,7 +1875,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1840
1875
|
const childScope = scope[childScopeAccessor];
|
|
1841
1876
|
const args = getInput?.();
|
|
1842
1877
|
if (typeof normalizedRenderer === "string") {
|
|
1843
|
-
const nodeAccessor = `#${normalizedRenderer}/0`;
|
|
1878
|
+
const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
|
|
1844
1879
|
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope[nodeAccessor].tagName]);
|
|
1845
1880
|
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
1846
1881
|
} else {
|
|
@@ -1861,18 +1896,16 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
|
|
|
1861
1896
|
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1862
1897
|
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1863
1898
|
return (scope, renderer) => {
|
|
1864
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer
|
|
1899
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer))) {
|
|
1865
1900
|
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1866
1901
|
if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
1867
1902
|
}
|
|
1868
1903
|
if (renderer) for (const accessor in renderer[LocalClosures]) renderer[LocalClosures][accessor](scope[childScopeAccessor], renderer[LocalClosureValues][accessor]);
|
|
1869
1904
|
};
|
|
1870
1905
|
});
|
|
1871
|
-
|
|
1872
|
-
_resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
|
|
1873
|
-
}
|
|
1906
|
+
const _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript));
|
|
1874
1907
|
function dynamicTagScript(branch) {
|
|
1875
|
-
_attrs_script(branch, `#${branch[Renderer]}/0`);
|
|
1908
|
+
_attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
|
|
1876
1909
|
}
|
|
1877
1910
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
|
|
1878
1911
|
const referenceNode = scope[nodeAccessor];
|
|
@@ -1993,17 +2026,27 @@ const loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, wa
|
|
|
1993
2026
|
}
|
|
1994
2027
|
};
|
|
1995
2028
|
});
|
|
1996
|
-
const _for_of = /*@__PURE__*/ loop(([all, by
|
|
2029
|
+
const _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
|
|
2030
|
+
by ||= bySecondArg;
|
|
1997
2031
|
if (typeof by === "string") forOf(all, (item, i) => cb(item[by], [item, i]));
|
|
1998
2032
|
else forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
1999
2033
|
});
|
|
2000
|
-
const _for_in = /*@__PURE__*/ loop(([obj, by
|
|
2001
|
-
|
|
2002
|
-
|
|
2034
|
+
const _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
|
|
2035
|
+
by ||= byFirstArg;
|
|
2036
|
+
forIn(obj, (key, value) => cb(by(key, value), [key, value]));
|
|
2037
|
+
});
|
|
2038
|
+
const _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
|
|
2039
|
+
by ||= byFirstArg;
|
|
2040
|
+
forTo(to, from, step, (v) => cb(by(v), [v]));
|
|
2041
|
+
});
|
|
2042
|
+
const _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
|
|
2043
|
+
by ||= byFirstArg;
|
|
2044
|
+
forUntil(until, from, step, (v) => cb(by(v), [v]));
|
|
2045
|
+
});
|
|
2003
2046
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
2004
2047
|
if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
|
|
2005
2048
|
const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
2006
|
-
if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
|
|
2049
|
+
if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer.toLowerCase()}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
|
|
2007
2050
|
else setupBranch(tagNameOrRenderer, branch);
|
|
2008
2051
|
return branch;
|
|
2009
2052
|
}
|
package/dist/debug/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_control_flow = require("./dom-
|
|
3
|
+
const require_control_flow = require("./dom-Bt4OoZ-j.js");
|
|
4
4
|
//#region src/common/attr-tag.ts
|
|
5
5
|
const empty = [];
|
|
6
6
|
const rest = Symbol("Attribute Tag");
|
|
@@ -35,6 +35,7 @@ const classIdToBranch = /* @__PURE__ */ new Map();
|
|
|
35
35
|
let classEventResolver;
|
|
36
36
|
const scopesByRender = /* @__PURE__ */ new WeakMap();
|
|
37
37
|
const getRenderScopes = ($global) => {
|
|
38
|
+
require_control_flow.init($global.runtimeId);
|
|
38
39
|
const render = self[$global.runtimeId]?.[$global.renderId];
|
|
39
40
|
let scopes = render && scopesByRender.get(render);
|
|
40
41
|
if (render && !scopes) scopesByRender.set(render, scopes = {});
|
|
@@ -96,6 +97,7 @@ const compat = {
|
|
|
96
97
|
return renderer;
|
|
97
98
|
},
|
|
98
99
|
render(out, component, renderer, args) {
|
|
100
|
+
require_control_flow.init(out.global.runtimeId);
|
|
99
101
|
let branch = component.scope;
|
|
100
102
|
let created = 0;
|
|
101
103
|
if (!branch && (branch = classIdToBranch.get(component.id))) {
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as _html, $t as queueEffect, A as _attr_select_value, At as _id, B as _attr_class, Bt as _assert_init, C as _attr_input_checked_default, Ct as _closure_get, D as _attr_input_value_default, Dt as _for_selector, E as _attr_input_value_attribute_default, Et as _for_closure, F as _controllable_select, Ft as _return, G as _attr_style, Gt as _on, H as _attr_class_items, Ht as insertBranchBefore, I as _controllable_textarea, It as _return_change, J as _attrs, K as _attr_style_item, Kt as $signal, Lt as _script, M as _attr_select_value_script, Mt as _let, N as _controllable_input, Nt as _let_change, O as _attr_input_value_dynamic_default, Ot as _hoist, P as _controllable_open, Pt as _or, Q as _attrs_script, Qt as queueAsyncRender, Rt as _var, S as _attr_input_checkedValue_script, St as _closure, T as _attr_input_value, Tn as TagVariable, Tt as _el_read, U as _attr_content, Ut as removeAndDestroyBranch, V as _attr_class_item, Vt as destroyBranch, W as _attr_nonce, Wt as syncGen, X as _attrs_partial, Y as _attrs_content, Z as _attrs_partial_content, Zt as prepareEffects, _ as _attr_details_or_dialog_open_default, _n as EndNode, _t as getRegisteredWithScope, a as _for_in, an as forTo, at as _to_text, b as _attr_input_checkedValue, bn as Load, bt as ready, c as _for_until, cn as _call, ct as _content, d as _show, dn as Params, dt as createAndSetupBranch, en as run, et as _lifecycle, f as _try, fn as Setup, ft as createBranch, g as _attr_details_or_dialog_open, gt as _var_resume, h as renderCatch, ht as _resume, i as _dynamic_tag_content, in as forOf, it as _text_content, j as _attr_select_value_default, jt as _if_closure, k as _attr_input_value_script, kt as _hoist_resume, l as _if, ln as Clone, lt as _content_closures, m as patchDynamicTag, mt as _el, n as _await_promise, nn as runId, nt as _style_shell, o as _for_of, on as forUntil, ot as insertChildNodes, p as addAwaitCounter, pt as setupBranch, q as _attr_style_items, qt as $signalReset, r as _dynamic_tag, rn as forIn, rt as _text, s as _for_to, sn as _assert_hoist, st as toInsertNode, t as _await_content, tn as runEffects, tt as _style_rule_item, u as _resume_dynamic_tag, un as Owner, ut as _content_resume, v as _attr_details_or_dialog_open_script, vt as init, w as _attr_input_checked_script, wn as StartNode, wt as _const, x as _attr_input_checkedValue_default, xt as _child_setup, y as _attr_input_checked, yn as Global, yt as initEmbedded, z as _attr, zt as _var_change } from "./dom-
|
|
1
|
+
import { $ as _html, $t as queueEffect, A as _attr_select_value, At as _id, B as _attr_class, Bt as _assert_init, C as _attr_input_checked_default, Ct as _closure_get, D as _attr_input_value_default, Dt as _for_selector, E as _attr_input_value_attribute_default, Et as _for_closure, F as _controllable_select, Ft as _return, G as _attr_style, Gt as _on, H as _attr_class_items, Ht as insertBranchBefore, I as _controllable_textarea, It as _return_change, J as _attrs, K as _attr_style_item, Kt as $signal, Lt as _script, M as _attr_select_value_script, Mt as _let, N as _controllable_input, Nt as _let_change, O as _attr_input_value_dynamic_default, Ot as _hoist, P as _controllable_open, Pt as _or, Q as _attrs_script, Qt as queueAsyncRender, Rt as _var, S as _attr_input_checkedValue_script, St as _closure, T as _attr_input_value, Tn as TagVariable, Tt as _el_read, U as _attr_content, Ut as removeAndDestroyBranch, V as _attr_class_item, Vt as destroyBranch, W as _attr_nonce, Wt as syncGen, X as _attrs_partial, Y as _attrs_content, Z as _attrs_partial_content, Zt as prepareEffects, _ as _attr_details_or_dialog_open_default, _n as EndNode, _t as getRegisteredWithScope, a as _for_in, an as forTo, at as _to_text, b as _attr_input_checkedValue, bn as Load, bt as ready, c as _for_until, cn as _call, ct as _content, d as _show, dn as Params, dt as createAndSetupBranch, en as run, et as _lifecycle, f as _try, fn as Setup, ft as createBranch, g as _attr_details_or_dialog_open, gt as _var_resume, h as renderCatch, ht as _resume, i as _dynamic_tag_content, in as forOf, it as _text_content, j as _attr_select_value_default, jt as _if_closure, k as _attr_input_value_script, kt as _hoist_resume, l as _if, ln as Clone, lt as _content_closures, m as patchDynamicTag, mt as _el, n as _await_promise, nn as runId, nt as _style_shell, o as _for_of, on as forUntil, ot as insertChildNodes, p as addAwaitCounter, pt as setupBranch, q as _attr_style_items, qt as $signalReset, r as _dynamic_tag, rn as forIn, rt as _text, s as _for_to, sn as _assert_hoist, st as toInsertNode, t as _await_content, tn as runEffects, tt as _style_rule_item, u as _resume_dynamic_tag, un as Owner, ut as _content_resume, v as _attr_details_or_dialog_open_script, vt as init, w as _attr_input_checked_script, wn as StartNode, wt as _const, x as _attr_input_checkedValue_default, xt as _child_setup, y as _attr_input_checked, yn as Global, yt as initEmbedded, z as _attr, zt as _var_change } from "./dom-B57LrRnX.mjs";
|
|
2
2
|
//#region src/common/attr-tag.ts
|
|
3
3
|
const empty = [];
|
|
4
4
|
const rest = Symbol("Attribute Tag");
|
|
@@ -33,6 +33,7 @@ const classIdToBranch = /* @__PURE__ */ new Map();
|
|
|
33
33
|
let classEventResolver;
|
|
34
34
|
const scopesByRender = /* @__PURE__ */ new WeakMap();
|
|
35
35
|
const getRenderScopes = ($global) => {
|
|
36
|
+
init($global.runtimeId);
|
|
36
37
|
const render = self[$global.runtimeId]?.[$global.renderId];
|
|
37
38
|
let scopes = render && scopesByRender.get(render);
|
|
38
39
|
if (render && !scopes) scopesByRender.set(render, scopes = {});
|
|
@@ -94,6 +95,7 @@ const compat = {
|
|
|
94
95
|
return renderer;
|
|
95
96
|
},
|
|
96
97
|
render(out, component, renderer, args) {
|
|
98
|
+
init(out.global.runtimeId);
|
|
97
99
|
let branch = component.scope;
|
|
98
100
|
let created = 0;
|
|
99
101
|
if (!branch && (branch = classIdToBranch.get(component.id))) {
|