marko 6.4.4 → 6.4.6
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/dist/common/errors.d.ts +2 -1
- package/dist/common/helpers.d.ts +7 -7
- package/dist/debug/dom/catch.feat.js +3 -3
- package/dist/debug/dom/catch.feat.mjs +3 -3
- 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 +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- 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-CUxvM4i9.js → dom-CNgQ6lj9.js} +52 -52
- package/dist/debug/{dom-BeY1nGUb.mjs → dom-o9jQjchF.mjs} +43 -43
- package/dist/debug/dom.js +4 -4
- package/dist/debug/dom.mjs +4 -4
- package/dist/debug/html.js +721 -654
- package/dist/debug/html.mjs +721 -654
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +3 -3
- package/dist/dom/control-flow.d.ts +2 -2
- 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 +2 -2
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/signals.d.ts +4 -1
- package/dist/{dom-Diu8MpmL.js → dom-60R4bRWD.js} +40 -40
- package/dist/{dom-DefWmvQB.mjs → dom-Ci2W4l1P.mjs} +33 -33
- package/dist/dom.js +6 -6
- package/dist/dom.mjs +4 -4
- package/dist/html/assets.d.ts +1 -1
- package/dist/html/compat.d.ts +2 -1
- package/dist/html/control-flow.d.ts +20 -0
- package/dist/html/serializer.d.ts +63 -16
- package/dist/html/writer.d.ts +47 -35
- package/dist/html.d.ts +2 -1
- package/dist/html.js +517 -466
- package/dist/html.mjs +517 -466
- 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 +8104 -8108
- package/dist/translator/util/analyze-errors.d.ts +2 -1
- package/dist/translator/util/assert.d.ts +8 -1
- package/dist/translator/util/bindings.d.ts +13 -9
- 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/entry-builder.d.ts +16 -5
- package/dist/translator/util/finalize-references.d.ts +3 -2
- package/dist/translator/util/generate-uid.d.ts +3 -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 +10 -8
- 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 +6 -1
- package/dist/translator/util/params-tree.d.ts +18 -0
- package/dist/translator/util/reasons.d.ts +10 -8
- package/dist/translator/util/references.d.ts +23 -28
- 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 +16 -16
- package/dist/translator/util/setup-work.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +22 -11
- package/dist/translator/util/simplify-fn.d.ts +1 -0
- package/dist/translator/util/slots.d.ts +2 -2
- package/dist/translator/util/solve-reasons.d.ts +1 -3
- package/dist/translator/util/sources.d.ts +2 -1
- 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 +6 -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 +0 -16
- 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/tag/custom-tag.d.ts +0 -14
- 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
|
@@ -71,7 +71,7 @@ const Returns = "returns";
|
|
|
71
71
|
const Lazy = "lazy";
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/common/helpers.ts
|
|
74
|
-
const
|
|
74
|
+
const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
75
75
|
const knownWrongAttrs = {
|
|
76
76
|
className: "class",
|
|
77
77
|
classList: "class",
|
|
@@ -113,11 +113,11 @@ function _call(fn, v) {
|
|
|
113
113
|
fn(v);
|
|
114
114
|
return v;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function stringifyClassEntry(name, value) {
|
|
117
117
|
return value ? name : "";
|
|
118
118
|
}
|
|
119
119
|
const warnedStyleKeys = /* @__PURE__ */ new Set();
|
|
120
|
-
function
|
|
120
|
+
function stringifyStyleEntry(name, value) {
|
|
121
121
|
if (/[A-Z]/.test(name) && !name.includes("-") && !warnedStyleKeys.has(name)) {
|
|
122
122
|
warnedStyleKeys.add(name);
|
|
123
123
|
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-")}\`.`);
|
|
@@ -164,10 +164,10 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
|
|
|
164
164
|
function isEventHandler(name) {
|
|
165
165
|
return /^on[A-Z-]/.test(name);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function getEventType(name) {
|
|
168
168
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function isNotNullishOrFalse(value) {
|
|
171
171
|
return value != null && value !== false;
|
|
172
172
|
}
|
|
173
173
|
function isPromise(value) {
|
|
@@ -196,9 +196,9 @@ function withDynamicHtml(runtime) {
|
|
|
196
196
|
}
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region src/common/errors.ts
|
|
199
|
-
const
|
|
199
|
+
const lowercaseOnAttrReg = /^on[a-z]/;
|
|
200
200
|
function assertValidAttrValue(name, value) {
|
|
201
|
-
if (value && typeof value !== "string" &&
|
|
201
|
+
if (value && typeof value !== "string" && lowercaseOnAttrReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
|
|
202
202
|
if (typeof value === "function") throw new Error(`The \`${name}\` attribute cannot be a function.${/Change$/.test(name) ? " A change handler is only used when its matching controllable attribute combination applies." : ""}`);
|
|
203
203
|
const unrenderable = describeUnrenderable(value);
|
|
204
204
|
if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
|
|
@@ -237,7 +237,7 @@ function describeUnrenderable(value) {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
function assertValidLoopKey(key, seenKeys) {
|
|
240
|
-
if (typeof key !== "string" && typeof key !== "number") throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null ?
|
|
240
|
+
if (typeof key !== "string" && typeof key !== "number" || key !== key) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null || key !== key ? key : `type "${typeof key}"`}.`);
|
|
241
241
|
if (seenKeys) {
|
|
242
242
|
if (seenKeys.has(key)) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a unique value for each item, but \`${key}\` was used more than once.`);
|
|
243
243
|
seenKeys.add(key);
|
|
@@ -246,7 +246,7 @@ function assertValidLoopKey(key, seenKeys) {
|
|
|
246
246
|
function assertValidList(value) {
|
|
247
247
|
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)}.`);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function assertOptionalRangeNumber(name, value) {
|
|
250
250
|
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)}.`);
|
|
251
251
|
}
|
|
252
252
|
function assertValidRangeBound(name, value) {
|
|
@@ -256,7 +256,7 @@ function describeForValue(value) {
|
|
|
256
256
|
return typeof value === "number" || typeof value === "bigint" ? `\`${value}\`` : value === null ? "null" : `type "${typeof value}"`;
|
|
257
257
|
}
|
|
258
258
|
function assertValidAttrName(name) {
|
|
259
|
-
if (
|
|
259
|
+
if (invalidNativeAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
|
|
260
260
|
const suggestion = getWrongAttrSuggestion(name);
|
|
261
261
|
if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
|
|
262
262
|
}
|
|
@@ -324,16 +324,16 @@ function forOf(list, cb) {
|
|
|
324
324
|
}
|
|
325
325
|
function forTo(to, from, step, cb) {
|
|
326
326
|
assertValidRangeBound("to", to);
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
assertOptionalRangeNumber("from", from);
|
|
328
|
+
assertOptionalRangeNumber("step", step);
|
|
329
329
|
const start = from || 0;
|
|
330
330
|
const delta = step || 1;
|
|
331
331
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
332
332
|
}
|
|
333
333
|
function forUntil(until, from, step, cb) {
|
|
334
334
|
assertValidRangeBound("until", until);
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
assertOptionalRangeNumber("from", from);
|
|
336
|
+
assertOptionalRangeNumber("step", step);
|
|
337
337
|
const start = from || 0;
|
|
338
338
|
const delta = step || 1;
|
|
339
339
|
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
@@ -1271,7 +1271,7 @@ function setAttribute(element, name, value) {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
1273
|
function _attr_class(element, value) {
|
|
1274
|
-
setAttribute(element, "class", toDelimitedString(value, " ",
|
|
1274
|
+
setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassEntry) || void 0);
|
|
1275
1275
|
}
|
|
1276
1276
|
function _attr_class_items(element, items) {
|
|
1277
1277
|
for (const key in items) _attr_class_item(element, key, items[key]);
|
|
@@ -1288,7 +1288,7 @@ function _attr_class_names(element, names, value) {
|
|
|
1288
1288
|
} while (start = end + 1);
|
|
1289
1289
|
}
|
|
1290
1290
|
function _attr_style(element, value) {
|
|
1291
|
-
setAttribute(element, "style", toDelimitedString(value, ";",
|
|
1291
|
+
setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleEntry) || void 0);
|
|
1292
1292
|
}
|
|
1293
1293
|
function _attr_style_items(element, items) {
|
|
1294
1294
|
for (const key in items) _attr_style_item(element, key, items[key]);
|
|
@@ -1345,7 +1345,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
|
1345
1345
|
if (!skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
|
|
1346
1346
|
}
|
|
1347
1347
|
for (const name in nextAttrs) {
|
|
1348
|
-
const key = isEventHandler(name) ? `on-${
|
|
1348
|
+
const key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
|
|
1349
1349
|
if (!skip[key]) partial[key] = nextAttrs[name];
|
|
1350
1350
|
}
|
|
1351
1351
|
assertExclusiveAttrs({
|
|
@@ -1379,7 +1379,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
1379
1379
|
break;
|
|
1380
1380
|
default:
|
|
1381
1381
|
assertValidAttrName(name);
|
|
1382
|
-
if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[
|
|
1382
|
+
if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventType(name)] = value;
|
|
1383
1383
|
else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) _attr(el, name, value);
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
@@ -1387,7 +1387,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
1387
1387
|
function _attr_content(scope, nodeAccessor, value) {
|
|
1388
1388
|
const content = normalizeClientRender(value);
|
|
1389
1389
|
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
|
|
1390
|
-
|
|
1390
|
+
setBranch(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1391
1391
|
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
1392
1392
|
}
|
|
1393
1393
|
content?.[LocalClosures]?.(scope[BranchScopes$1 + nodeAccessor]);
|
|
@@ -1428,7 +1428,7 @@ function normalizeClientRender(value) {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
1430
|
function normalizeAttrValue(value) {
|
|
1431
|
-
if (
|
|
1431
|
+
if (isNotNullishOrFalse(value)) return value === true ? "" : value + "";
|
|
1432
1432
|
}
|
|
1433
1433
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
1434
1434
|
const accessor = Lifecycle + index;
|
|
@@ -1489,7 +1489,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
|
|
|
1489
1489
|
let inputType = "";
|
|
1490
1490
|
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
1491
1491
|
const el = scope[nodeAccessor];
|
|
1492
|
-
const normalizedChecked =
|
|
1492
|
+
const normalizedChecked = isNotNullishOrFalse(checked);
|
|
1493
1493
|
if (el.defaultChecked !== normalizedChecked) {
|
|
1494
1494
|
const restoreValue = scope["#Gen"] < runId ? el.checked : normalizedChecked;
|
|
1495
1495
|
el.defaultChecked = normalizedChecked;
|
|
@@ -1501,11 +1501,11 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
|
1501
1501
|
* resolves the kind at run time). */
|
|
1502
1502
|
const controllableScripts = {};
|
|
1503
1503
|
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
1504
|
-
* a statically named tag passes its
|
|
1505
|
-
const
|
|
1504
|
+
* a statically named tag passes its helper to `_attrs` instead. */
|
|
1505
|
+
const controllableSpreadHelpers = {};
|
|
1506
1506
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
1507
1507
|
const el = scope[nodeAccessor];
|
|
1508
|
-
const normalizedChecked =
|
|
1508
|
+
const normalizedChecked = isNotNullishOrFalse(checked);
|
|
1509
1509
|
assertHandlerIsFunction("checkedChange", checkedChange);
|
|
1510
1510
|
scope[ControlledHandler + nodeAccessor] = checkedChange;
|
|
1511
1511
|
scope[ControlledType + nodeAccessor] = checkedChange ? 0 : 5;
|
|
@@ -1670,7 +1670,7 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
}
|
|
1672
1672
|
syncControllableFormInput(el, hasSelectChanged, onChange);
|
|
1673
|
-
|
|
1673
|
+
observeControlled(scope, nodeAccessor, {
|
|
1674
1674
|
childList: true,
|
|
1675
1675
|
subtree: true
|
|
1676
1676
|
}, () => {
|
|
@@ -1690,10 +1690,10 @@ function assertSelectValueMatchesOption(el, normalizedValue, value) {
|
|
|
1690
1690
|
if ((Array.isArray(normalizedValue) ? normalizedValue : [normalizedValue]).some((v) => v && !options.includes(v))) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
|
|
1691
1691
|
}
|
|
1692
1692
|
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
1693
|
-
if (scope["#Gen"] === runId) scope[nodeAccessor].open =
|
|
1693
|
+
if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotNullishOrFalse(open);
|
|
1694
1694
|
}
|
|
1695
1695
|
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
1696
|
-
const normalizedOpen = scope[ControlledValue + nodeAccessor] =
|
|
1696
|
+
const normalizedOpen = scope[ControlledValue + nodeAccessor] = isNotNullishOrFalse(open);
|
|
1697
1697
|
assertHandlerIsFunction("openChange", openChange);
|
|
1698
1698
|
scope[ControlledHandler + nodeAccessor] = openChange;
|
|
1699
1699
|
scope[ControlledType + nodeAccessor] = openChange ? 4 : 5;
|
|
@@ -1702,7 +1702,7 @@ function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
|
1702
1702
|
}
|
|
1703
1703
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
1704
1704
|
const el = scope[nodeAccessor];
|
|
1705
|
-
|
|
1705
|
+
observeControlled(scope, nodeAccessor, {
|
|
1706
1706
|
attributes: true,
|
|
1707
1707
|
attributeFilter: ["open"]
|
|
1708
1708
|
}, () => {
|
|
@@ -1715,7 +1715,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
});
|
|
1717
1717
|
}
|
|
1718
|
-
function
|
|
1718
|
+
function observeControlled(scope, nodeAccessor, init, callback) {
|
|
1719
1719
|
(scope[ControlledObserver + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
1720
1720
|
}
|
|
1721
1721
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
@@ -1820,7 +1820,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1820
1820
|
if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
|
|
1821
1821
|
});
|
|
1822
1822
|
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1823
|
-
if (tryBranch !== awaitBranch) awaitCounter =
|
|
1823
|
+
if (tryBranch !== awaitBranch) awaitCounter = startAwait(scope, tryBranch);
|
|
1824
1824
|
else {
|
|
1825
1825
|
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1826
1826
|
if (tryBranch === scope[branchAccessor]) {
|
|
@@ -1832,7 +1832,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
1834
|
});
|
|
1835
|
-
|
|
1835
|
+
countAwait(awaitCounter, scope, () => {
|
|
1836
1836
|
if (!awaitBranch["#DetachedAwait"]) {
|
|
1837
1837
|
awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
|
|
1838
1838
|
tempDetachBranch(tryBranch);
|
|
@@ -1883,18 +1883,18 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1883
1883
|
if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
|
|
1884
1884
|
};
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
|
|
1887
1887
|
if (!tryBranch) return;
|
|
1888
1888
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1889
1889
|
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1890
|
-
|
|
1890
|
+
countAwait(awaitCounter, tryBranch, () => {
|
|
1891
1891
|
(tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
|
|
1892
1892
|
insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
|
|
1893
1893
|
tempDetachBranch(tryBranch);
|
|
1894
1894
|
});
|
|
1895
1895
|
return awaitCounter;
|
|
1896
1896
|
}
|
|
1897
|
-
function
|
|
1897
|
+
function countAwait(awaitCounter, scope, render) {
|
|
1898
1898
|
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
|
|
1899
1899
|
}
|
|
1900
1900
|
function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
|
|
@@ -1945,7 +1945,7 @@ function _try(nodeAccessor, template, walks, setup, placeholderContent, catchCon
|
|
|
1945
1945
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1946
1946
|
const renderer = _content("", template, walks, setup)();
|
|
1947
1947
|
return (scope) => {
|
|
1948
|
-
|
|
1948
|
+
setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1949
1949
|
const branch = scope[branchAccessor];
|
|
1950
1950
|
branch[BranchAccessor] = nodeAccessor;
|
|
1951
1951
|
branch[CatchContent] = catchContent;
|
|
@@ -1964,7 +1964,7 @@ function renderCatch(scope, error) {
|
|
|
1964
1964
|
destroyBranch(tryWithCatch);
|
|
1965
1965
|
}
|
|
1966
1966
|
const catchContent = tryWithCatch[CatchContent]();
|
|
1967
|
-
|
|
1967
|
+
setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createAndSetupBranch);
|
|
1968
1968
|
catchContent[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
@@ -1984,7 +1984,7 @@ const _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
|
|
|
1984
1984
|
let i = 0;
|
|
1985
1985
|
while (i < branchesArgs.length) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
|
|
1986
1986
|
return (scope, newBranch) => {
|
|
1987
|
-
if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0)))
|
|
1987
|
+
if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
|
|
1988
1988
|
};
|
|
1989
1989
|
});
|
|
1990
1990
|
const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
|
|
@@ -2034,7 +2034,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
2034
2034
|
const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
2035
2035
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
|
2036
2036
|
const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
|
|
2037
|
-
|
|
2037
|
+
setBranch(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
|
|
2038
2038
|
if (getTagVar) {
|
|
2039
2039
|
if (normalizedRenderer) {
|
|
2040
2040
|
scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
@@ -2044,7 +2044,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
2044
2044
|
if (typeof renderer === "string") {
|
|
2045
2045
|
if (getContent) {
|
|
2046
2046
|
const content = getContent(scope);
|
|
2047
|
-
|
|
2047
|
+
setBranch(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
|
|
2048
2048
|
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
|
|
2049
2049
|
}
|
|
2050
2050
|
} else if (renderer) {
|
|
@@ -2057,7 +2057,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
2057
2057
|
const args = getInput?.();
|
|
2058
2058
|
if (typeof normalizedRenderer === "string") {
|
|
2059
2059
|
const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
|
|
2060
|
-
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {},
|
|
2060
|
+
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope[nodeAccessor].tagName]);
|
|
2061
2061
|
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
2062
2062
|
} else {
|
|
2063
2063
|
normalizedRenderer[LocalClosures]?.(childScope);
|
|
@@ -2080,7 +2080,7 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
|
|
|
2080
2080
|
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
2081
2081
|
return (scope, renderer) => {
|
|
2082
2082
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer))) {
|
|
2083
|
-
|
|
2083
|
+
setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
2084
2084
|
if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
2085
2085
|
}
|
|
2086
2086
|
renderer?.[LocalClosures]?.(scope[childScopeAccessor]);
|
|
@@ -2093,7 +2093,7 @@ function installDynamicTagVar(bind) {
|
|
|
2093
2093
|
function dynamicTagScript(branch) {
|
|
2094
2094
|
_attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
|
|
2095
2095
|
}
|
|
2096
|
-
function
|
|
2096
|
+
function setBranch(scope, nodeAccessor, newRenderer, createBranch) {
|
|
2097
2097
|
const referenceNode = scope[nodeAccessor];
|
|
2098
2098
|
const prevBranch = scope[BranchScopes$1 + nodeAccessor];
|
|
2099
2099
|
const parentNode = referenceNode.nodeType > 1 ? (prevBranch?.["#StartNode"] || referenceNode).parentNode : referenceNode;
|
|
@@ -2250,4 +2250,4 @@ function byFirstArg(name) {
|
|
|
2250
2250
|
return name;
|
|
2251
2251
|
}
|
|
2252
2252
|
//#endregion
|
|
2253
|
-
export { _attr_style_items as $, insertBranchBefore as $t, _attr_input_value as A, Params as An, withLazy as At, _controllable_select as B, Global as Bn, _hoist_resume as Bt, _attr_details_or_dialog_open_script as C, _assert_hoist as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, Clone as Dn, initEmbedded as Dt, _attr_input_checkedValue_default as E, withBranches as En, init as Et, _attr_select_value as F, AwaitCounter as Fn, _el_read as Ft, _attr_class as G, PendingRenders as Gn, _or as Gt,
|
|
2253
|
+
export { _attr_style_items as $, insertBranchBefore as $t, _attr_input_value as A, Params as An, withLazy as At, _controllable_select as B, Global as Bn, _hoist_resume as Bt, _attr_details_or_dialog_open_script as C, _assert_hoist as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, Clone as Dn, initEmbedded as Dt, _attr_input_checkedValue_default as E, withBranches as En, init as Et, _attr_select_value as F, AwaitCounter as Fn, _el_read as Ft, _attr_class as G, PendingRenders as Gn, _or as Gt, controllableScripts as H, ParentBranch as Hn, _if_closure as Ht, _attr_select_value_default as I, BranchRenders as In, _for_closure as It, _attr_class_names as J, TagVariable as Jn, _script as Jt, _attr_class_item as K, PlaceholderBranch as Kn, _return as Kt, _attr_select_value_script as L, ClosestBranch as Ln, _for_selector as Lt, _attr_input_value_default as M, Setup as Mn, _closure as Mt, _attr_input_value_dynamic_default as N, Pending as Nn, _closure_get as Nt, _attr_input_checked_default as O, Lazy as On, ready as Ot, _attr_input_value_script as P, Scope as Pn, _const as Pt, _attr_style_item as Q, destroyBranch as Qt, _controllable_input as R, EndNode as Rn, _global_read as Rt, _attr_details_or_dialog_open_default as S, _assert_class_toggles as Sn, _el as St, _attr_input_checkedValue as T, _call as Tn, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, PendingEffectScopes as Un, _let as Ut, _controllable_textarea as V, Load as Vn, _id as Vt, _attr as W, PendingEffects as Wn, _let_change as Wt, _attr_nonce as X, _var_change as Xt, _attr_content as Y, _var as Yt, _attr_style as Z, _assert_init as Zt, patchDynamicTag as _, runId as _n, _return_setup as _t, _for_in as a, $signal as an, _html as at, startAwait as b, forTo as bn, setupBranch as bt, _for_to as c, installBranchRenders as cn, _style_shell as ct, _for_until_unkeyed as d, queueAsyncRender as dn, _to_text as dt, removeAndDestroyBranch as en, _attrs as et, _if as f, queueEffect as fn, insertChildNodes as ft, installDynamicTagVar as g, runEffects as gn, _content_resume as gt, dynamicTagScript as h, run as hn, _content_closures as ht, _dynamic_tag_content as i, _on as in, _attrs_script as it, _attr_input_value_attribute_default as j, Returns as jn, _child_setup as jt, _attr_input_checked_script as k, Owner as kn, readyFailed as kt, _for_to_unkeyed as l, installCatch as ln, _text as lt, _try as m, rendering as mn, _content as mt, _await_promise as n, DYNAMIC_TAG_SCRIPT_REGISTER_ID as nn, _attrs_partial as nt, _for_of as o, $signalReset as on, _lifecycle as ot, _show as p, queueRender as pn, toInsertNode as pt, _attr_class_items as q, StartNode as qn, _return_change as qt, _dynamic_tag as r, PLACEHOLDER_DISMISS_REGISTER_ID as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, createBranchRenders as sn, _style_rule_item as st, _await_content as t, syncGen as tn, _attrs_content as tt, _for_until as u, prepareEffects as un, _text_content as ut, renderCatch as v, forIn as vn, createAndSetupBranch as vt, _attr_input_checked as w, _hoist_read_error as wn, _var_resume as wt, _attr_details_or_dialog_open as x, forUntil as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, forOf as yn, createBranch as yt, _controllable_open as z, Gen$1 as zn, _hoist as zt };
|
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-CNgQ6lj9.js");
|
|
4
4
|
//#region src/common/attr-tag.ts
|
|
5
5
|
const empty = [];
|
|
6
6
|
const rest = Symbol("Attribute Tag");
|
|
@@ -198,7 +198,7 @@ const noop = (_) => 0;
|
|
|
198
198
|
function _load_template(id, load) {
|
|
199
199
|
let pending;
|
|
200
200
|
const lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
201
|
-
const awaitCounter = require_control_flow.
|
|
201
|
+
const awaitCounter = require_control_flow.startAwait(branch);
|
|
202
202
|
branch[require_control_flow.Load] ||= /* @__PURE__ */ new Map();
|
|
203
203
|
(pending ||= load()).then((renderer) => {
|
|
204
204
|
Object.assign(lazyTemplate, renderer);
|
|
@@ -215,7 +215,7 @@ function _load_setup(load) {
|
|
|
215
215
|
return (owner, child, marker) => {
|
|
216
216
|
if (renderer) require_control_flow.queueRender(child, insertCached, -1, marker);
|
|
217
217
|
else {
|
|
218
|
-
const awaitCounter = require_control_flow.
|
|
218
|
+
const awaitCounter = require_control_flow.startAwait(owner);
|
|
219
219
|
child[require_control_flow.Load] ||= /* @__PURE__ */ new Map();
|
|
220
220
|
(pending ||= load()).then((mod) => {
|
|
221
221
|
renderer ||= require_control_flow._content("", ...mod._)();
|
|
@@ -236,7 +236,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
236
236
|
};
|
|
237
237
|
let remaining;
|
|
238
238
|
if (remaining = values?.size) {
|
|
239
|
-
awaitCounter ||= require_control_flow.
|
|
239
|
+
awaitCounter ||= require_control_flow.startAwait(branch);
|
|
240
240
|
const fail = loadFailed(branch, awaitCounter);
|
|
241
241
|
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.queueAsyncRender(branch, (branch) => {
|
|
242
242
|
clone();
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as _attr_style_items, $t as insertBranchBefore, A as _attr_input_value, An as Params, B as _controllable_select, Bn as Global, Bt as _hoist_resume, C as _attr_details_or_dialog_open_script, Cn as _assert_hoist, Ct as _resumed, D as _attr_input_checkedValue_script, Dn as Clone, Dt as initEmbedded, E as _attr_input_checkedValue_default, Et as init, F as _attr_select_value, Ft as _el_read, G as _attr_class, Gt as _or, Ht as _if_closure, I as _attr_select_value_default, It as _for_closure, J as _attr_class_names, Jn as TagVariable, Jt as _script, K as _attr_class_item, Kt as _return, L as _attr_select_value_script, Lt as _for_selector, M as _attr_input_value_default, Mn as Setup, Mt as _closure, N as _attr_input_value_dynamic_default, Nt as _closure_get, O as _attr_input_checked_default, On as Lazy, Ot as ready, P as _attr_input_value_script, Pt as _const, Q as _attr_style_item, Qt as destroyBranch, R as _controllable_input, Rn as EndNode, Rt as _global_read, S as _attr_details_or_dialog_open_default, Sn as _assert_class_toggles, St as _el, T as _attr_input_checkedValue, Tn as _call, Tt as getRegisteredWithScope, Ut as _let, V as _controllable_textarea, Vn as Load, Vt as _id, W as _attr, Wt as _let_change, X as _attr_nonce, Xt as _var_change, Y as _attr_content, Yt as _var, Z as _attr_style, Zt as _assert_init, _n as runId, _t as _return_setup, a as _for_in, an as $signal, at as _html, bn as forTo, bt as setupBranch, c as _for_to, ct as _style_shell, d as _for_until_unkeyed, dn as queueAsyncRender, dt as _to_text, en as removeAndDestroyBranch, et as _attrs, f as _if, fn as queueEffect, ft as insertChildNodes, gn as runEffects, gt as _content_resume,
|
|
1
|
+
import { $ as _attr_style_items, $t as insertBranchBefore, A as _attr_input_value, An as Params, B as _controllable_select, Bn as Global, Bt as _hoist_resume, C as _attr_details_or_dialog_open_script, Cn as _assert_hoist, Ct as _resumed, D as _attr_input_checkedValue_script, Dn as Clone, Dt as initEmbedded, E as _attr_input_checkedValue_default, Et as init, F as _attr_select_value, Ft as _el_read, G as _attr_class, Gt as _or, Ht as _if_closure, I as _attr_select_value_default, It as _for_closure, J as _attr_class_names, Jn as TagVariable, Jt as _script, K as _attr_class_item, Kt as _return, L as _attr_select_value_script, Lt as _for_selector, M as _attr_input_value_default, Mn as Setup, Mt as _closure, N as _attr_input_value_dynamic_default, Nt as _closure_get, O as _attr_input_checked_default, On as Lazy, Ot as ready, P as _attr_input_value_script, Pt as _const, Q as _attr_style_item, Qt as destroyBranch, R as _controllable_input, Rn as EndNode, Rt as _global_read, S as _attr_details_or_dialog_open_default, Sn as _assert_class_toggles, St as _el, T as _attr_input_checkedValue, Tn as _call, Tt as getRegisteredWithScope, Ut as _let, V as _controllable_textarea, Vn as Load, Vt as _id, W as _attr, Wt as _let_change, X as _attr_nonce, Xt as _var_change, Y as _attr_content, Yt as _var, Z as _attr_style, Zt as _assert_init, _ as patchDynamicTag, _n as runId, _t as _return_setup, a as _for_in, an as $signal, at as _html, b as startAwait, bn as forTo, bt as setupBranch, c as _for_to, ct as _style_shell, d as _for_until_unkeyed, dn as queueAsyncRender, dt as _to_text, en as removeAndDestroyBranch, et as _attrs, f as _if, fn as queueEffect, ft as insertChildNodes, gn as runEffects, gt as _content_resume, hn as run, ht as _content_closures, i as _dynamic_tag_content, in as _on, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _child_setup, k as _attr_input_checked_script, kn as Owner, kt as readyFailed, l as _for_to_unkeyed, lt as _text, m as _try, mn as rendering, mt as _content, n as _await_promise, nt as _attrs_partial, o as _for_of, on as $signalReset, ot as _lifecycle, p as _show, pn as queueRender, pt as toInsertNode, q as _attr_class_items, qn as StartNode, qt as _return_change, r as _dynamic_tag, rt as _attrs_partial_content, s as _for_of_unkeyed, st as _style_rule_item, t as _await_content, tn as syncGen, tt as _attrs_content, u as _for_until, un as prepareEffects, ut as _text_content, v as renderCatch, vn as forIn, vt as createAndSetupBranch, w as _attr_input_checked, wn as _hoist_read_error, wt as _var_resume, x as _attr_details_or_dialog_open, xn as forUntil, xt as _dynamic_tag_var_resume, yn as forOf, yt as createBranch, z as _controllable_open, zt as _hoist } from "./dom-o9jQjchF.mjs";
|
|
2
2
|
//#region src/common/attr-tag.ts
|
|
3
3
|
const empty = [];
|
|
4
4
|
const rest = Symbol("Attribute Tag");
|
|
@@ -196,7 +196,7 @@ const noop = (_) => 0;
|
|
|
196
196
|
function _load_template(id, load) {
|
|
197
197
|
let pending;
|
|
198
198
|
const lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
199
|
-
const awaitCounter =
|
|
199
|
+
const awaitCounter = startAwait(branch);
|
|
200
200
|
branch[Load] ||= /* @__PURE__ */ new Map();
|
|
201
201
|
(pending ||= load()).then((renderer) => {
|
|
202
202
|
Object.assign(lazyTemplate, renderer);
|
|
@@ -213,7 +213,7 @@ function _load_setup(load) {
|
|
|
213
213
|
return (owner, child, marker) => {
|
|
214
214
|
if (renderer) queueRender(child, insertCached, -1, marker);
|
|
215
215
|
else {
|
|
216
|
-
const awaitCounter =
|
|
216
|
+
const awaitCounter = startAwait(owner);
|
|
217
217
|
child[Load] ||= /* @__PURE__ */ new Map();
|
|
218
218
|
(pending ||= load()).then((mod) => {
|
|
219
219
|
renderer ||= _content("", ...mod._)();
|
|
@@ -234,7 +234,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
234
234
|
};
|
|
235
235
|
let remaining;
|
|
236
236
|
if (remaining = values?.size) {
|
|
237
|
-
awaitCounter ||=
|
|
237
|
+
awaitCounter ||= startAwait(branch);
|
|
238
238
|
const fail = loadFailed(branch, awaitCounter);
|
|
239
239
|
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && queueAsyncRender(branch, (branch) => {
|
|
240
240
|
clone();
|