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
|
@@ -112,6 +112,7 @@ function stringifyStyleObject(name, value) {
|
|
|
112
112
|
warnedStyleKeys.add(name);
|
|
113
113
|
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-")}\`.`);
|
|
114
114
|
}
|
|
115
|
+
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.`);
|
|
115
116
|
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
116
117
|
}
|
|
117
118
|
const unsafeStyleAttrReg = /[\\;]/g;
|
|
@@ -188,6 +189,13 @@ function assertValidAttrValue(name, value) {
|
|
|
188
189
|
function assertValidTextValue(value) {
|
|
189
190
|
const unrenderable = describeUnrenderable(value);
|
|
190
191
|
if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
|
|
192
|
+
if (isSilentlyDropped(value)) console.warn(`Text content of \`${describeDropped(value)}\` renders as nothing; convert it to a string or number to render it.`);
|
|
193
|
+
}
|
|
194
|
+
function isSilentlyDropped(value) {
|
|
195
|
+
return value !== value || typeof value === "bigint" && !value;
|
|
196
|
+
}
|
|
197
|
+
function describeDropped(value) {
|
|
198
|
+
return value !== value ? "NaN" : "0n";
|
|
191
199
|
}
|
|
192
200
|
function describeUnrenderable(value) {
|
|
193
201
|
if (typeof value === "symbol") return "a symbol";
|
|
@@ -211,6 +219,9 @@ function assertValidLoopKey(key, seenKeys) {
|
|
|
211
219
|
function assertValidList(value) {
|
|
212
220
|
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)}.`);
|
|
213
221
|
}
|
|
222
|
+
function assertValidRangeStart(name, value) {
|
|
223
|
+
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)}.`);
|
|
224
|
+
}
|
|
214
225
|
function assertValidRangeBound(name, value) {
|
|
215
226
|
if (!isFinite(value)) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
|
|
216
227
|
}
|
|
@@ -242,10 +253,16 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
242
253
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
243
254
|
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
244
255
|
}
|
|
245
|
-
if (attrs.valueChange)
|
|
256
|
+
if (attrs.valueChange) {
|
|
257
|
+
(exclusiveAttrs ||= []).push("valueChange");
|
|
258
|
+
if ("checked" in attrs && !exclusiveAttrs.includes("checked")) exclusiveAttrs.push("checked");
|
|
259
|
+
}
|
|
246
260
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
247
261
|
}
|
|
248
262
|
}
|
|
263
|
+
function assertNoValueBindingOnCheckable(type, valueChange) {
|
|
264
|
+
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." : ""));
|
|
265
|
+
}
|
|
249
266
|
function assertHandlerIsFunction(name, value) {
|
|
250
267
|
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}".`);
|
|
251
268
|
}
|
|
@@ -277,12 +294,16 @@ function forOf(list, cb) {
|
|
|
277
294
|
}
|
|
278
295
|
function forTo(to, from, step, cb) {
|
|
279
296
|
assertValidRangeBound("to", to);
|
|
297
|
+
assertValidRangeStart("from", from);
|
|
298
|
+
assertValidRangeStart("step", step);
|
|
280
299
|
const start = from || 0;
|
|
281
300
|
const delta = step || 1;
|
|
282
301
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
283
302
|
}
|
|
284
303
|
function forUntil(until, from, step, cb) {
|
|
285
304
|
assertValidRangeBound("until", until);
|
|
305
|
+
assertValidRangeStart("from", from);
|
|
306
|
+
assertValidRangeStart("step", step);
|
|
286
307
|
const start = from || 0;
|
|
287
308
|
const delta = step || 1;
|
|
288
309
|
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
@@ -440,10 +461,10 @@ function push(opt, item) {
|
|
|
440
461
|
//#region src/dom/event.ts
|
|
441
462
|
function _on(element, type, handler) {
|
|
442
463
|
assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
|
|
443
|
-
if (element[
|
|
444
|
-
element[
|
|
464
|
+
if (element[1 + type] === void 0) delegate(type, handleDelegated);
|
|
465
|
+
element[1 + type] = handler || null;
|
|
445
466
|
}
|
|
446
|
-
const delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, true), 1);
|
|
467
|
+
const delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, true), 1);
|
|
447
468
|
function handleDelegated(ev) {
|
|
448
469
|
let target = !rendering && ev.target;
|
|
449
470
|
Object.defineProperty(ev, "currentTarget", {
|
|
@@ -454,7 +475,7 @@ function handleDelegated(ev) {
|
|
|
454
475
|
}
|
|
455
476
|
});
|
|
456
477
|
while (target) {
|
|
457
|
-
target[
|
|
478
|
+
target[1 + ev.type]?.(ev, target);
|
|
458
479
|
target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
|
459
480
|
}
|
|
460
481
|
delete ev.currentTarget;
|
|
@@ -719,17 +740,23 @@ function _var(scope, childAccessor, signal) {
|
|
|
719
740
|
}
|
|
720
741
|
const _return = (scope, value) => scope[TagVariable]?.(value);
|
|
721
742
|
function _return_change(scope, changeHandler) {
|
|
722
|
-
|
|
743
|
+
scope[TagVariableChange] = changeHandler || void 0;
|
|
723
744
|
}
|
|
724
745
|
const _var_change = (scope, value, name = "This") => {
|
|
725
746
|
if (typeof scope["#TagVariableChange"] !== "function") throw new TypeError(`${name} is a readonly tag variable.`);
|
|
726
747
|
scope[TagVariableChange](value);
|
|
727
748
|
};
|
|
728
749
|
const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
|
729
|
-
function _id(
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
750
|
+
function _id(scope, accessor) {
|
|
751
|
+
let id = accessor !== void 0 && scope[accessor];
|
|
752
|
+
if (!id) {
|
|
753
|
+
const $global = scope[Global];
|
|
754
|
+
const n = tagIdsByGlobal.get($global) || 0;
|
|
755
|
+
tagIdsByGlobal.set($global, n + 1);
|
|
756
|
+
id = "c" + $global.runtimeId + $global.renderId + n.toString(36);
|
|
757
|
+
if (accessor !== void 0) scope[accessor] = id;
|
|
758
|
+
}
|
|
759
|
+
return id;
|
|
733
760
|
}
|
|
734
761
|
function _script(id, fn) {
|
|
735
762
|
_resume(id, fn);
|
|
@@ -741,19 +768,19 @@ function _el_read(value) {
|
|
|
741
768
|
if (rendering) _el_read_error();
|
|
742
769
|
return value;
|
|
743
770
|
}
|
|
744
|
-
function* traverse(scope, path, i = path.length - 1) {
|
|
771
|
+
function* traverse(scope, path, args, i = path.length - 1) {
|
|
745
772
|
if (rendering) _hoist_read_error();
|
|
746
|
-
if (scope) if (Symbol.iterator in scope) for (const childScope of scope.values()) yield* traverse(childScope, path, i);
|
|
773
|
+
if (scope) if (Symbol.iterator in scope) for (const childScope of scope.values()) yield* traverse(childScope, path, args, i);
|
|
747
774
|
else {
|
|
748
775
|
const item = scope[path[i]];
|
|
749
|
-
if (i) yield* traverse(item, path, i - 1);
|
|
750
|
-
else yield typeof item === "function" ? item() : item;
|
|
776
|
+
if (i) yield* traverse(item, path, args, i - 1);
|
|
777
|
+
else yield typeof item === "function" ? item(...args) : item;
|
|
751
778
|
}
|
|
752
779
|
}
|
|
753
780
|
function _hoist(...path) {
|
|
754
781
|
return (scope) => {
|
|
755
|
-
const fn = () => traverse(scope, path).next().value;
|
|
756
|
-
fn[Symbol.iterator] = () => traverse(scope, path);
|
|
782
|
+
const fn = (...args) => traverse(scope, path, args).next().value;
|
|
783
|
+
fn[Symbol.iterator] = () => traverse(scope, path, []);
|
|
757
784
|
return fn;
|
|
758
785
|
};
|
|
759
786
|
}
|
|
@@ -1055,7 +1082,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1055
1082
|
setup = setup ? setup._ || setup : void 0;
|
|
1056
1083
|
params ||= void 0;
|
|
1057
1084
|
const clone = template ? (branch, ns) => {
|
|
1058
|
-
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
1085
|
+
((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
1059
1086
|
} : (branch) => {
|
|
1060
1087
|
walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
|
|
1061
1088
|
};
|
|
@@ -1175,7 +1202,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
|
1175
1202
|
const partial = {};
|
|
1176
1203
|
for (let i = el.attributes.length; i--;) {
|
|
1177
1204
|
const { name } = el.attributes.item(i);
|
|
1178
|
-
if (!skip[name] && !(nextAttrs && name in nextAttrs)) el.removeAttribute(name);
|
|
1205
|
+
if (!skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
|
|
1179
1206
|
}
|
|
1180
1207
|
for (const name in nextAttrs) {
|
|
1181
1208
|
const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
@@ -1220,7 +1247,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
1220
1247
|
}
|
|
1221
1248
|
function _attr_content(scope, nodeAccessor, value) {
|
|
1222
1249
|
const content = normalizeClientRender(value);
|
|
1223
|
-
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = content
|
|
1250
|
+
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
|
|
1224
1251
|
setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1225
1252
|
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
1226
1253
|
}
|
|
@@ -1289,17 +1316,16 @@ function toInsertNode(startNode, endNode) {
|
|
|
1289
1316
|
}
|
|
1290
1317
|
//#endregion
|
|
1291
1318
|
//#region src/dom/resolve-cursor-position.ts
|
|
1292
|
-
const R = /[
|
|
1319
|
+
const R = /[\p{L}\p{N}]/gu;
|
|
1293
1320
|
function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
|
|
1294
1321
|
if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
|
|
1295
1322
|
const before = initialValue.slice(0, initialPosition);
|
|
1296
1323
|
const after = initialValue.slice(initialPosition);
|
|
1297
1324
|
if (updatedValue.startsWith(before)) return initialPosition;
|
|
1298
1325
|
if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
|
|
1299
|
-
let count = before.
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
return pos;
|
|
1326
|
+
let count = before.match(R)?.length;
|
|
1327
|
+
while (count && R.test(updatedValue)) count--;
|
|
1328
|
+
return count ? updatedValue.length : R.lastIndex;
|
|
1303
1329
|
}
|
|
1304
1330
|
return -1;
|
|
1305
1331
|
}
|
|
@@ -1401,17 +1427,19 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault =
|
|
|
1401
1427
|
const el = scope[nodeAccessor];
|
|
1402
1428
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1403
1429
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
1430
|
+
assertNoValueBindingOnCheckable(el.type, valueChange);
|
|
1404
1431
|
scope[ControlledHandler + nodeAccessor] = valueChange;
|
|
1405
1432
|
scope[ControlledValue + nodeAccessor] = normalizedValue;
|
|
1406
1433
|
scope[ControlledType + nodeAccessor] = valueChange ? 2 : 5;
|
|
1407
1434
|
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1408
|
-
else setDefault(scope, nodeAccessor,
|
|
1435
|
+
else setDefault(scope, nodeAccessor, value);
|
|
1409
1436
|
}
|
|
1410
1437
|
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1411
1438
|
_attr(scope[nodeAccessor], "value", value);
|
|
1412
1439
|
}
|
|
1413
1440
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1414
1441
|
const el = scope[nodeAccessor];
|
|
1442
|
+
assertNoValueBindingOnCheckable(el.type, scope[ControlledHandler + nodeAccessor]);
|
|
1415
1443
|
if (isResuming) scope[ControlledValue + nodeAccessor] = el.defaultValue;
|
|
1416
1444
|
syncControllableFormInput(el, hasValueChanged, (ev) => {
|
|
1417
1445
|
const valueChange = scope[ControlledHandler + nodeAccessor];
|
|
@@ -1643,12 +1671,12 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1643
1671
|
if (!scope[promiseAccessor]) {
|
|
1644
1672
|
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1645
1673
|
if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
|
|
1646
|
-
else
|
|
1674
|
+
else scheduleAwaitFrame(awaitCounter, scope, () => {
|
|
1647
1675
|
if (!awaitBranch["#DetachedAwait"]) {
|
|
1648
|
-
awaitBranch[
|
|
1676
|
+
awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
|
|
1649
1677
|
tempDetachBranch(tryBranch);
|
|
1650
1678
|
}
|
|
1651
|
-
}
|
|
1679
|
+
});
|
|
1652
1680
|
}
|
|
1653
1681
|
const thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1654
1682
|
if (thisPromise === scope[promiseAccessor]) {
|
|
@@ -1713,12 +1741,15 @@ function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, Placeholder
|
|
|
1713
1741
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1714
1742
|
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1715
1743
|
placeholderShown.add(pendingEffects);
|
|
1716
|
-
|
|
1717
|
-
insertBranchBefore(tryBranch[
|
|
1744
|
+
scheduleAwaitFrame(awaitCounter, tryBranch, () => {
|
|
1745
|
+
insertBranchBefore(tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent], tryBranch["_"], tryBranch[StartNode].parentNode), tryBranch[StartNode].parentNode, tryBranch[StartNode]);
|
|
1718
1746
|
tempDetachBranch(tryBranch);
|
|
1719
|
-
}
|
|
1747
|
+
});
|
|
1720
1748
|
return awaitCounter;
|
|
1721
1749
|
}
|
|
1750
|
+
function scheduleAwaitFrame(awaitCounter, scope, render) {
|
|
1751
|
+
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1752
|
+
}
|
|
1722
1753
|
function createAwaitCounter(tryBranch, done) {
|
|
1723
1754
|
const awaitCounter = tryBranch[AwaitCounter] = {
|
|
1724
1755
|
i: 0,
|
|
@@ -1816,6 +1847,9 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNo
|
|
|
1816
1847
|
}
|
|
1817
1848
|
};
|
|
1818
1849
|
});
|
|
1850
|
+
function rendererKey(renderer) {
|
|
1851
|
+
return renderer?.["owner"] ? renderer["id"] + " " + renderer[Owner]["#Id"] : renderer?.["id"] || renderer;
|
|
1852
|
+
}
|
|
1819
1853
|
function patchDynamicTag(fn) {
|
|
1820
1854
|
_dynamic_tag = fn(_dynamic_tag);
|
|
1821
1855
|
}
|
|
@@ -1824,14 +1858,15 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1824
1858
|
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1825
1859
|
return (scope, newRenderer, getInput) => {
|
|
1826
1860
|
const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
1827
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer
|
|
1861
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
|
1828
1862
|
setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer);
|
|
1829
|
-
if (getTagVar) scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1863
|
+
if (getTagVar) if (scope[childScopeAccessor]) scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1864
|
+
else getTagVar()(scope, void 0);
|
|
1830
1865
|
if (typeof normalizedRenderer === "string") {
|
|
1831
1866
|
if (getContent) {
|
|
1832
1867
|
const content = getContent(scope);
|
|
1833
|
-
setConditionalRenderer(scope[childScopeAccessor], `#${normalizedRenderer}/0`, content, createAndSetupBranch);
|
|
1834
|
-
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${normalizedRenderer}/0`]);
|
|
1868
|
+
setConditionalRenderer(scope[childScopeAccessor], `#${normalizedRenderer.toLowerCase()}/0`, content, createAndSetupBranch);
|
|
1869
|
+
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${normalizedRenderer.toLowerCase()}/0`]);
|
|
1835
1870
|
}
|
|
1836
1871
|
} else if (normalizedRenderer?.["accessor"]) subscribeToScopeSet(normalizedRenderer[Owner], normalizedRenderer[Accessor], scope[childScopeAccessor]);
|
|
1837
1872
|
}
|
|
@@ -1839,7 +1874,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1839
1874
|
const childScope = scope[childScopeAccessor];
|
|
1840
1875
|
const args = getInput?.();
|
|
1841
1876
|
if (typeof normalizedRenderer === "string") {
|
|
1842
|
-
const nodeAccessor = `#${normalizedRenderer}/0`;
|
|
1877
|
+
const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
|
|
1843
1878
|
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope[nodeAccessor].tagName]);
|
|
1844
1879
|
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
1845
1880
|
} else {
|
|
@@ -1860,18 +1895,16 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
|
|
|
1860
1895
|
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1861
1896
|
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1862
1897
|
return (scope, renderer) => {
|
|
1863
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer
|
|
1898
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer))) {
|
|
1864
1899
|
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1865
1900
|
if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
1866
1901
|
}
|
|
1867
1902
|
if (renderer) for (const accessor in renderer[LocalClosures]) renderer[LocalClosures][accessor](scope[childScopeAccessor], renderer[LocalClosureValues][accessor]);
|
|
1868
1903
|
};
|
|
1869
1904
|
});
|
|
1870
|
-
|
|
1871
|
-
_resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
|
|
1872
|
-
}
|
|
1905
|
+
const _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript));
|
|
1873
1906
|
function dynamicTagScript(branch) {
|
|
1874
|
-
_attrs_script(branch, `#${branch[Renderer]}/0`);
|
|
1907
|
+
_attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
|
|
1875
1908
|
}
|
|
1876
1909
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
|
|
1877
1910
|
const referenceNode = scope[nodeAccessor];
|
|
@@ -1992,17 +2025,27 @@ const loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, wa
|
|
|
1992
2025
|
}
|
|
1993
2026
|
};
|
|
1994
2027
|
});
|
|
1995
|
-
const _for_of = /*@__PURE__*/ loop(([all, by
|
|
2028
|
+
const _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
|
|
2029
|
+
by ||= bySecondArg;
|
|
1996
2030
|
if (typeof by === "string") forOf(all, (item, i) => cb(item[by], [item, i]));
|
|
1997
2031
|
else forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
1998
2032
|
});
|
|
1999
|
-
const _for_in = /*@__PURE__*/ loop(([obj, by
|
|
2000
|
-
|
|
2001
|
-
|
|
2033
|
+
const _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
|
|
2034
|
+
by ||= byFirstArg;
|
|
2035
|
+
forIn(obj, (key, value) => cb(by(key, value), [key, value]));
|
|
2036
|
+
});
|
|
2037
|
+
const _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
|
|
2038
|
+
by ||= byFirstArg;
|
|
2039
|
+
forTo(to, from, step, (v) => cb(by(v), [v]));
|
|
2040
|
+
});
|
|
2041
|
+
const _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
|
|
2042
|
+
by ||= byFirstArg;
|
|
2043
|
+
forUntil(until, from, step, (v) => cb(by(v), [v]));
|
|
2044
|
+
});
|
|
2002
2045
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
2003
2046
|
if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
|
|
2004
2047
|
const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
2005
|
-
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);
|
|
2048
|
+
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);
|
|
2006
2049
|
else setupBranch(tagNameOrRenderer, branch);
|
|
2007
2050
|
return branch;
|
|
2008
2051
|
}
|