marko 6.0.0-next.3.60 → 6.0.0-next.3.61
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/accessor.d.ts +24 -0
- package/dist/common/accessor.debug.d.ts +24 -0
- package/dist/common/types.d.ts +2 -23
- package/dist/debug/dom.js +83 -83
- package/dist/debug/dom.mjs +83 -83
- package/dist/debug/html.js +11 -11
- package/dist/debug/html.mjs +11 -11
- package/dist/dom.js +68 -68
- package/dist/dom.mjs +68 -68
- package/dist/html.js +7 -7
- package/dist/html.mjs +7 -7
- package/dist/translator/index.js +82 -16
- package/dist/translator/util/get-accessor-char.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +1 -1
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -155,7 +155,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
155
155
|
}, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
156
156
|
if (token === "*" /* Node */) {
|
157
157
|
let node = scope[data2] = visit.previousSibling;
|
158
|
-
scope[
|
158
|
+
scope["j" /* Getter */ + data2] = () => node;
|
159
159
|
} else if (token === "$" /* ClosestBranch */)
|
160
160
|
closestBranchMarkers.set(scopeId, visit);
|
161
161
|
else if (token === "[" /* BranchStart */)
|
@@ -200,7 +200,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
200
200
|
let parentBranchId = parentBranchIds.get(scopeId);
|
201
201
|
if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
202
202
|
let branch = scope, parentBranch = branch.c;
|
203
|
-
scope.c = branch, parentBranch && (branch.g = parentBranch, (parentBranch.
|
203
|
+
scope.c = branch, parentBranch && (branch.g = parentBranch, (parentBranch.p ||= /* @__PURE__ */ new Set()).add(
|
204
204
|
branch
|
205
205
|
));
|
206
206
|
}
|
@@ -256,7 +256,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
256
256
|
function controllable_input_checked_effect(scope, nodeAccessor) {
|
257
257
|
let el = scope[nodeAccessor];
|
258
258
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
259
|
-
let checkedChange = scope[
|
259
|
+
let checkedChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
260
260
|
if (checkedChange) {
|
261
261
|
let newValue = el.checked;
|
262
262
|
el.checked = !newValue, checkedChange(newValue), run();
|
@@ -264,7 +264,7 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
264
264
|
});
|
265
265
|
}
|
266
266
|
function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
|
267
|
-
scope[
|
267
|
+
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue, attr(scope[nodeAccessor], "value", value2), setCheckboxValue(
|
268
268
|
scope,
|
269
269
|
nodeAccessor,
|
270
270
|
1 /* InputCheckedValue */,
|
@@ -275,9 +275,9 @@ function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, chec
|
|
275
275
|
function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
276
276
|
let el = scope[nodeAccessor];
|
277
277
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
278
|
-
let checkedValueChange = scope[
|
278
|
+
let checkedValueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
279
279
|
if (checkedValueChange) {
|
280
|
-
let oldValue = scope[
|
280
|
+
let oldValue = scope["g" /* ControlledValue */ + nodeAccessor], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
281
281
|
if (el.name && el.type[0] === "r")
|
282
282
|
for (let radio of el.getRootNode().querySelectorAll(
|
283
283
|
`[type=radio][name=${CSS.escape(el.name)}]`
|
@@ -291,23 +291,23 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
291
291
|
}
|
292
292
|
function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
|
293
293
|
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value2);
|
294
|
-
scope[
|
294
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] = value2, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
|
295
295
|
}
|
296
296
|
function controllable_input_value_effect(scope, nodeAccessor) {
|
297
297
|
let el = scope[nodeAccessor];
|
298
|
-
isResuming && (scope[
|
299
|
-
let valueChange = scope[
|
298
|
+
isResuming && (scope["g" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
299
|
+
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
300
300
|
if (valueChange) {
|
301
301
|
let newValue = el.value;
|
302
302
|
inputType = ev?.inputType, setValueAndUpdateSelection(
|
303
303
|
el,
|
304
|
-
scope[
|
304
|
+
scope["g" /* ControlledValue */ + nodeAccessor]
|
305
305
|
), valueChange(newValue), run(), inputType = "";
|
306
306
|
}
|
307
307
|
});
|
308
308
|
}
|
309
309
|
function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
310
|
-
scope[
|
310
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] = value2) : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, pendingEffects.unshift(
|
311
311
|
() => setSelectOptions(
|
312
312
|
scope[nodeAccessor],
|
313
313
|
value2,
|
@@ -318,20 +318,20 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
318
318
|
}
|
319
319
|
function controllable_select_value_effect(scope, nodeAccessor) {
|
320
320
|
let el = scope[nodeAccessor], onChange = () => {
|
321
|
-
let valueChange = scope[
|
321
|
+
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
322
322
|
if (valueChange) {
|
323
323
|
let newValue = Array.isArray(
|
324
|
-
scope[
|
324
|
+
scope["g" /* ControlledValue */ + nodeAccessor]
|
325
325
|
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
326
326
|
setSelectOptions(
|
327
327
|
el,
|
328
|
-
scope[
|
328
|
+
scope["g" /* ControlledValue */ + nodeAccessor],
|
329
329
|
valueChange
|
330
330
|
), valueChange(newValue), run();
|
331
331
|
}
|
332
332
|
};
|
333
333
|
el._ || new MutationObserver(() => {
|
334
|
-
let value2 = scope[
|
334
|
+
let value2 = scope["g" /* ControlledValue */ + nodeAccessor];
|
335
335
|
(Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) && onChange();
|
336
336
|
}).observe(el, {
|
337
337
|
childList: !0,
|
@@ -354,16 +354,16 @@ function setSelectOptions(el, value2, valueChange) {
|
|
354
354
|
}
|
355
355
|
}
|
356
356
|
function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange) {
|
357
|
-
scope[
|
357
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = openChange, openChange ? scope["f" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */ : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, scope[nodeAccessor].open = scope["g" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
358
358
|
}
|
359
359
|
function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
360
|
-
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope[
|
360
|
+
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope["g" /* ControlledValue */ + nodeAccessor];
|
361
361
|
syncControllable(
|
362
362
|
el,
|
363
363
|
el.tagName === "DIALOG" ? "close" : "toggle",
|
364
364
|
hasChanged,
|
365
365
|
() => {
|
366
|
-
let openChange = scope[
|
366
|
+
let openChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
367
367
|
if (openChange && hasChanged()) {
|
368
368
|
let newValue = el.open;
|
369
369
|
el.open = !newValue, openChange(newValue), run();
|
@@ -384,7 +384,7 @@ function setValueAndUpdateSelection(el, value2) {
|
|
384
384
|
}
|
385
385
|
}
|
386
386
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
387
|
-
scope[
|
387
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = checkedChange, checkedChange ? (scope["f" /* ControlledType */ + nodeAccessor] = type, scope[nodeAccessor].checked = checked) : (scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
|
388
388
|
}
|
389
389
|
var controllableDelegate = createDelegator();
|
390
390
|
function syncControllable(el, event, hasChanged, onChange) {
|
@@ -548,13 +548,13 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
548
548
|
case "content":
|
549
549
|
break;
|
550
550
|
default:
|
551
|
-
isEventHandler(name) ? (events ||= scope[
|
551
|
+
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value2 : skip?.test(name) || attr(el, name, value2);
|
552
552
|
}
|
553
553
|
}
|
554
554
|
}
|
555
555
|
function attrsEvents(scope, nodeAccessor) {
|
556
|
-
let el = scope[nodeAccessor], events = scope[
|
557
|
-
switch (scope[
|
556
|
+
let el = scope[nodeAccessor], events = scope["i" /* EventAttributes */ + nodeAccessor];
|
557
|
+
switch (scope["f" /* ControlledType */ + nodeAccessor]) {
|
558
558
|
case 0 /* InputChecked */:
|
559
559
|
controllable_input_checked_effect(scope, nodeAccessor);
|
560
560
|
break;
|
@@ -575,7 +575,7 @@ function attrsEvents(scope, nodeAccessor) {
|
|
575
575
|
on(el, name, events[name]);
|
576
576
|
}
|
577
577
|
function html(scope, value2, accessor) {
|
578
|
-
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope[
|
578
|
+
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["h" /* DynamicPlaceholderLastChild */ + accessor] || firstChild, newContent = parseHTML(
|
579
579
|
value2 || value2 === 0 ? value2 + "" : "",
|
580
580
|
parentNode.namespaceURI
|
581
581
|
);
|
@@ -583,7 +583,7 @@ function html(scope, value2, accessor) {
|
|
583
583
|
parentNode,
|
584
584
|
firstChild,
|
585
585
|
scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()),
|
586
|
-
scope[
|
586
|
+
scope["h" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
587
587
|
), removeChildNodes(firstChild, lastChild);
|
588
588
|
}
|
589
589
|
function props(scope, nodeIndex, index) {
|
@@ -606,7 +606,7 @@ function lifecycle(scope, index, thisObj) {
|
|
606
606
|
let instance = scope[index];
|
607
607
|
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(), getAbortSignal(
|
608
608
|
scope,
|
609
|
-
"
|
609
|
+
"k" /* LifecycleAbortController */ + index
|
610
610
|
).onabort = () => thisObj.onDestroy?.());
|
611
611
|
}
|
612
612
|
function removeChildNodes(startNode, endNode) {
|
@@ -649,10 +649,10 @@ function finishPendingScopes() {
|
|
649
649
|
pendingScopes = [];
|
650
650
|
}
|
651
651
|
function destroyBranch(branch) {
|
652
|
-
branch.g?.
|
652
|
+
branch.g?.p?.delete(branch), destroyNestedBranches(branch);
|
653
653
|
}
|
654
654
|
function destroyNestedBranches(branch) {
|
655
|
-
branch.k = 1, branch.
|
655
|
+
branch.k = 1, branch.p?.forEach(destroyNestedBranches), branch.B?.forEach((scope) => {
|
656
656
|
for (let id in scope.l)
|
657
657
|
scope.l[id]?.abort();
|
658
658
|
});
|
@@ -670,7 +670,7 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
670
670
|
}
|
671
671
|
function tempDetatchBranch(branch) {
|
672
672
|
insertChildNodes(
|
673
|
-
|
673
|
+
new DocumentFragment(),
|
674
674
|
null,
|
675
675
|
branch.a,
|
676
676
|
branch.b
|
@@ -762,7 +762,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
762
762
|
for (; currentWalkIndex < walkCodes.length; )
|
763
763
|
if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
|
764
764
|
let node = walker.currentNode;
|
765
|
-
scope[currentScopeIndex] = node, scope[
|
765
|
+
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
766
766
|
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
|
767
767
|
walker.currentNode.replaceWith(
|
768
768
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
@@ -794,7 +794,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
794
794
|
// src/dom/renderer.ts
|
795
795
|
function createBranch($global, renderer, parentScope, parentNode) {
|
796
796
|
let branch = createScope($global), parentBranch = parentScope?.c;
|
797
|
-
return branch._ = renderer.m || parentScope, branch.c = branch, parentBranch && (branch.g = parentBranch, (parentBranch.
|
797
|
+
return branch._ = renderer.m || parentScope, branch.c = branch, parentBranch && (branch.g = parentBranch, (parentBranch.p ||= /* @__PURE__ */ new Set()).add(branch)), renderer.q?.(
|
798
798
|
branch,
|
799
799
|
parentNode.namespaceURI
|
800
800
|
), branch;
|
@@ -806,10 +806,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
806
806
|
);
|
807
807
|
}
|
808
808
|
function setupBranch(renderer, branch) {
|
809
|
-
return (renderer.
|
809
|
+
return (renderer.t || renderer.x) && queueRender(
|
810
810
|
branch,
|
811
811
|
(branch2) => {
|
812
|
-
renderer.
|
812
|
+
renderer.t?.(branch2), renderer.x?.(branch2);
|
813
813
|
},
|
814
814
|
-1
|
815
815
|
), branch;
|
@@ -830,11 +830,11 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
830
830
|
};
|
831
831
|
return (owner) => ({
|
832
832
|
e: id,
|
833
|
-
|
833
|
+
q: clone,
|
834
834
|
m: owner,
|
835
|
-
|
835
|
+
t: setup,
|
836
836
|
d: params,
|
837
|
-
|
837
|
+
x: closures,
|
838
838
|
n: dynamicScopesAccessor
|
839
839
|
});
|
840
840
|
}
|
@@ -891,7 +891,7 @@ function triggerMacroTask() {
|
|
891
891
|
function state(valueAccessor, fn) {
|
892
892
|
if (0)
|
893
893
|
var id;
|
894
|
-
let valueChangeAccessor =
|
894
|
+
let valueChangeAccessor = "@" /* TagVariableChange */ + valueAccessor, update = (scope, value2) => {
|
895
895
|
scope[valueAccessor] !== value2 && (scope[valueAccessor] = value2, fn(scope, value2));
|
896
896
|
};
|
897
897
|
return (scope, value2, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value2 || !(valueAccessor in scope)) && (scope[valueAccessor] = value2, fn(scope, value2)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value2) : (schedule(), queueRender(
|
@@ -913,7 +913,7 @@ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__
|
|
913
913
|
};
|
914
914
|
}
|
915
915
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
916
|
-
let childSignal = closure(valueAccessor, fn), loopScopeAccessor =
|
916
|
+
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
917
917
|
let scopes = ownerScope[loopScopeAccessor] || ownerScope[loopScopeMapAccessor]?.values() || [], [firstScope] = scopes;
|
918
918
|
firstScope && queueRender(
|
919
919
|
ownerScope,
|
@@ -929,7 +929,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
929
929
|
return ownerSignal._ = childSignal, ownerSignal;
|
930
930
|
}
|
931
931
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
932
|
-
let childSignal = closure(valueAccessor, fn), scopeAccessor =
|
932
|
+
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
933
933
|
let ifScope = scope[scopeAccessor];
|
934
934
|
ifScope && !ifScope.h && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
935
935
|
};
|
@@ -943,9 +943,9 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
943
943
|
));
|
944
944
|
}
|
945
945
|
function dynamicClosure(...closureSignals) {
|
946
|
-
let [{
|
946
|
+
let [{ y: ___scopeInstancesAccessor, z: ___signalIndexAccessor }] = closureSignals;
|
947
947
|
for (let i = closureSignals.length; i--; )
|
948
|
-
closureSignals[i].
|
948
|
+
closureSignals[i].C = i;
|
949
949
|
return (scope) => {
|
950
950
|
if (scope[___scopeInstancesAccessor])
|
951
951
|
for (let childScope of scope[___scopeInstancesAccessor])
|
@@ -958,13 +958,13 @@ function dynamicClosure(...closureSignals) {
|
|
958
958
|
}
|
959
959
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
960
960
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
961
|
-
scope[closureSignal.
|
961
|
+
scope[closureSignal.z] = closureSignal.C, childSignal(scope), subscribeToScopeSet(
|
962
962
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
963
|
-
closureSignal.
|
963
|
+
closureSignal.y,
|
964
964
|
scope
|
965
965
|
);
|
966
966
|
};
|
967
|
-
return closureSignal.
|
967
|
+
return closureSignal.y = "a" /* ClosureScopes */ + valueAccessor, closureSignal.z = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
|
968
968
|
}
|
969
969
|
function closure(valueAccessor, fn, getOwnerScope) {
|
970
970
|
return (scope) => {
|
@@ -1004,7 +1004,7 @@ function hoist(...path) {
|
|
1004
1004
|
|
1005
1005
|
// src/dom/control-flow.ts
|
1006
1006
|
function awaitTag(nodeAccessor, renderer) {
|
1007
|
-
let promiseAccessor =
|
1007
|
+
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1008
1008
|
return (scope, promise) => {
|
1009
1009
|
let tryBranch = scope.c, awaitBranch = scope[branchAccessor], referenceNode = scope[nodeAccessor], namespaceNode = (awaitBranch?.a ?? referenceNode).parentNode;
|
1010
1010
|
for (; tryBranch && !tryBranch["%" /* PlaceholderContent */]; )
|
@@ -1026,7 +1026,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1026
1026
|
), referenceNode.remove()), renderer.d?.(awaitBranch, [data2]);
|
1027
1027
|
});
|
1028
1028
|
if (tryBranch) {
|
1029
|
-
if (!--tryBranch
|
1029
|
+
if (!--tryBranch.o) {
|
1030
1030
|
let placeholderBranch = tryBranch["#" /* PlaceholderBranch */];
|
1031
1031
|
placeholderBranch ? (insertBranchBefore(
|
1032
1032
|
tryBranch,
|
@@ -1050,14 +1050,14 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1050
1050
|
tryBranch2["^" /* CatchContent */],
|
1051
1051
|
createAndSetupBranch
|
1052
1052
|
), tryBranch2["^" /* CatchContent */].d?.(
|
1053
|
-
tryBranch2._[
|
1053
|
+
tryBranch2._["d" /* ConditionalScope */ + tryBranch2["*" /* BranchAccessor */]],
|
1054
1054
|
[error]
|
1055
1055
|
)) : setTimeout(() => {
|
1056
1056
|
throw error;
|
1057
1057
|
});
|
1058
1058
|
});
|
1059
|
-
tryBranch ? (tryBranch
|
1060
|
-
if (tryBranch
|
1059
|
+
tryBranch ? (tryBranch.o || (tryBranch.o = 0, requestAnimationFrame(() => {
|
1060
|
+
if (tryBranch.o && !tryBranch.k) {
|
1061
1061
|
let placeholderBranch = tryBranch["#" /* PlaceholderBranch */] = createAndSetupBranch(
|
1062
1062
|
scope.$global,
|
1063
1063
|
tryBranch["%" /* PlaceholderContent */],
|
@@ -1070,14 +1070,14 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1070
1070
|
tryBranch.a
|
1071
1071
|
), tempDetatchBranch(tryBranch);
|
1072
1072
|
}
|
1073
|
-
})), tryBranch
|
1073
|
+
})), tryBranch.o++) : awaitBranch && (awaitBranch.a.parentNode.insertBefore(
|
1074
1074
|
referenceNode,
|
1075
1075
|
awaitBranch.a
|
1076
1076
|
), tempDetatchBranch(awaitBranch));
|
1077
1077
|
};
|
1078
1078
|
}
|
1079
1079
|
function createTry(nodeAccessor, tryContent) {
|
1080
|
-
let branchAccessor =
|
1080
|
+
let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1081
1081
|
return (scope, input) => {
|
1082
1082
|
scope[branchAccessor] || setConditionalRenderer(
|
1083
1083
|
scope,
|
@@ -1092,7 +1092,7 @@ function createTry(nodeAccessor, tryContent) {
|
|
1092
1092
|
};
|
1093
1093
|
}
|
1094
1094
|
function conditional(nodeAccessor, ...branches) {
|
1095
|
-
let branchAccessor =
|
1095
|
+
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1096
1096
|
return (scope, newBranch) => {
|
1097
1097
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
1098
1098
|
scope,
|
@@ -1106,7 +1106,7 @@ function patchDynamicTag(fn) {
|
|
1106
1106
|
dynamicTag = fn(dynamicTag);
|
1107
1107
|
}
|
1108
1108
|
var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1109
|
-
let childScopeAccessor =
|
1109
|
+
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1110
1110
|
return (scope, newRenderer, getInput) => {
|
1111
1111
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1112
1112
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.e || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
|
@@ -1126,7 +1126,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1126
1126
|
), content.n && subscribeToScopeSet(
|
1127
1127
|
content.m,
|
1128
1128
|
content.n,
|
1129
|
-
scope[childScopeAccessor][
|
1129
|
+
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
1130
1130
|
);
|
1131
1131
|
}
|
1132
1132
|
} else normalizedRenderer?.n && subscribeToScopeSet(
|
@@ -1162,7 +1162,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1162
1162
|
};
|
1163
1163
|
};
|
1164
1164
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
1165
|
-
let referenceNode = scope[nodeAccessor], prevBranch = scope[
|
1165
|
+
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.a || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
|
1166
1166
|
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.a) : parentNode.insertBefore(referenceNode, prevBranch.a), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
1167
1167
|
}
|
1168
1168
|
function loopOf(nodeAccessor, renderer) {
|
@@ -1194,9 +1194,9 @@ function loopTo(nodeAccessor, renderer) {
|
|
1194
1194
|
function loop(nodeAccessor, renderer, forEach) {
|
1195
1195
|
let params = renderer.d;
|
1196
1196
|
return (scope, value2) => {
|
1197
|
-
let referenceNode = scope[nodeAccessor], oldMap = scope[
|
1197
|
+
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1198
1198
|
...oldMap.values()
|
1199
|
-
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].a.parentNode : referenceNode, newMap = scope[
|
1199
|
+
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].a.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
|
1200
1200
|
forEach(value2, (key, args) => {
|
1201
1201
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1202
1202
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
@@ -1229,13 +1229,13 @@ var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendi
|
|
1229
1229
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.e) {
|
1230
1230
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1231
1231
|
if (existingRender)
|
1232
|
-
existingRender.
|
1232
|
+
existingRender.A = value2;
|
1233
1233
|
else {
|
1234
1234
|
let render = {
|
1235
1235
|
j: key,
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1236
|
+
u: scope,
|
1237
|
+
D: signal,
|
1238
|
+
A: value2
|
1239
1239
|
}, i = pendingRenders.push(render) - 1;
|
1240
1240
|
for (; i; ) {
|
1241
1241
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -1287,17 +1287,17 @@ function runRenders() {
|
|
1287
1287
|
}
|
1288
1288
|
pendingRenders[i] = item;
|
1289
1289
|
}
|
1290
|
-
render.
|
1290
|
+
render.u.c?.k || runRender(render);
|
1291
1291
|
}
|
1292
1292
|
finishPendingScopes();
|
1293
1293
|
}
|
1294
|
-
var runRender = (render) => render.
|
1294
|
+
var runRender = (render) => render.D(render.u, render.A), enableCatch = () => {
|
1295
1295
|
enableCatch = () => {
|
1296
1296
|
}, runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
1297
1297
|
try {
|
1298
1298
|
runRender2(render);
|
1299
1299
|
} catch (error) {
|
1300
|
-
let branch = render.
|
1300
|
+
let branch = render.u.c;
|
1301
1301
|
for (; branch && !branch["^" /* CatchContent */]; )
|
1302
1302
|
branch = branch.g;
|
1303
1303
|
if (branch)
|
@@ -1307,7 +1307,7 @@ var runRender = (render) => render.C(render.t, render.z), enableCatch = () => {
|
|
1307
1307
|
branch["^" /* CatchContent */],
|
1308
1308
|
createAndSetupBranch
|
1309
1309
|
), branch["^" /* CatchContent */].d?.(
|
1310
|
-
branch._[
|
1310
|
+
branch._["d" /* ConditionalScope */ + branch["*" /* BranchAccessor */]],
|
1311
1311
|
[error]
|
1312
1312
|
);
|
1313
1313
|
else
|
@@ -1322,7 +1322,7 @@ function resetAbortSignal(scope, id) {
|
|
1322
1322
|
ctrl && (queueEffect(ctrl, abort), scope.l[id] = void 0);
|
1323
1323
|
}
|
1324
1324
|
function getAbortSignal(scope, id) {
|
1325
|
-
return scope.c && (scope.c.
|
1325
|
+
return scope.c && (scope.c.B ||= /* @__PURE__ */ new Set()).add(scope), ((scope.l ||= {})[id] ||= new AbortController()).signal;
|
1326
1326
|
}
|
1327
1327
|
function abort(ctrl) {
|
1328
1328
|
ctrl.abort();
|
@@ -1344,7 +1344,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1344
1344
|
register(RENDERER_REGISTER_ID, fn);
|
1345
1345
|
},
|
1346
1346
|
isRenderer(renderer) {
|
1347
|
-
return renderer.
|
1347
|
+
return renderer.q;
|
1348
1348
|
},
|
1349
1349
|
getStartNode(branch) {
|
1350
1350
|
return branch.a;
|
@@ -1369,7 +1369,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1369
1369
|
},
|
1370
1370
|
createRenderer(params, clone) {
|
1371
1371
|
let renderer = createRenderer(0, 0, 0, params);
|
1372
|
-
return renderer.
|
1372
|
+
return renderer.q = (branch) => {
|
1373
1373
|
let cloned = clone();
|
1374
1374
|
branch.a = cloned.startNode, branch.b = cloned.endNode;
|
1375
1375
|
}, renderer;
|
@@ -1434,7 +1434,7 @@ function mount(input = {}, reference, position) {
|
|
1434
1434
|
this,
|
1435
1435
|
void 0,
|
1436
1436
|
parentNode
|
1437
|
-
), this.
|
1437
|
+
), this.t?.(branch), args?.(branch, input);
|
1438
1438
|
});
|
1439
1439
|
return insertChildNodes(
|
1440
1440
|
parentNode,
|
package/dist/html.js
CHANGED
@@ -1256,7 +1256,7 @@ function fork(scopeId, accessor, promise, content) {
|
|
1256
1256
|
$chunk.writeHTML(
|
1257
1257
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1258
1258
|
), content(promise), writeScope(scopeId, {
|
1259
|
-
[
|
1259
|
+
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1260
1260
|
}), $chunk.writeHTML(
|
1261
1261
|
$chunk.boundary.state.mark(
|
1262
1262
|
"]" /* BranchEnd */,
|
@@ -1278,7 +1278,7 @@ function fork(scopeId, accessor, promise, content) {
|
|
1278
1278
|
), content(value), boundary.state.serializer.writeAssign(
|
1279
1279
|
writeScope(branchId, {}),
|
1280
1280
|
ensureScopeWithId(scopeId),
|
1281
|
-
|
1281
|
+
"d" /* ConditionalScope */ + accessor
|
1282
1282
|
), $chunk.writeHTML(
|
1283
1283
|
$chunk.boundary.state.mark(
|
1284
1284
|
"]" /* BranchEnd */,
|
@@ -1306,7 +1306,7 @@ function tryContent(scopeId, accessor, content, input) {
|
|
1306
1306
|
"^": catchContent,
|
1307
1307
|
"%": placeholderContent
|
1308
1308
|
}), writeScope(scopeId, {
|
1309
|
-
[
|
1309
|
+
["d" /* ConditionalScope */ + accessor]: getScopeById(branchId)
|
1310
1310
|
}), $chunk.writeHTML(
|
1311
1311
|
$chunk.boundary.state.mark(
|
1312
1312
|
"]" /* BranchEnd */,
|
@@ -1703,7 +1703,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1703
1703
|
break;
|
1704
1704
|
default:
|
1705
1705
|
isVoid(value) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
1706
|
-
[
|
1706
|
+
["i" /* EventAttributes */ + nodeAccessor]: events
|
1707
1707
|
})), events[getEventHandlerName(name)] = value) : skip.test(name) || (result += nonVoidAttr(name, value)));
|
1708
1708
|
break;
|
1709
1709
|
}
|
@@ -1718,9 +1718,9 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1718
1718
|
}
|
1719
1719
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
1720
1720
|
writeScope(scopeId, {
|
1721
|
-
[
|
1722
|
-
[
|
1723
|
-
[
|
1721
|
+
["f" /* ControlledType */ + nodeAccessor]: type,
|
1722
|
+
["g" /* ControlledValue */ + nodeAccessor]: value,
|
1723
|
+
["e" /* ControlledHandler */ + nodeAccessor]: valueChange
|
1724
1724
|
});
|
1725
1725
|
}
|
1726
1726
|
function stringAttr(name, value) {
|
package/dist/html.mjs
CHANGED
@@ -1175,7 +1175,7 @@ function fork(scopeId, accessor, promise, content) {
|
|
1175
1175
|
$chunk.writeHTML(
|
1176
1176
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1177
1177
|
), content(promise), writeScope(scopeId, {
|
1178
|
-
[
|
1178
|
+
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1179
1179
|
}), $chunk.writeHTML(
|
1180
1180
|
$chunk.boundary.state.mark(
|
1181
1181
|
"]" /* BranchEnd */,
|
@@ -1197,7 +1197,7 @@ function fork(scopeId, accessor, promise, content) {
|
|
1197
1197
|
), content(value), boundary.state.serializer.writeAssign(
|
1198
1198
|
writeScope(branchId, {}),
|
1199
1199
|
ensureScopeWithId(scopeId),
|
1200
|
-
|
1200
|
+
"d" /* ConditionalScope */ + accessor
|
1201
1201
|
), $chunk.writeHTML(
|
1202
1202
|
$chunk.boundary.state.mark(
|
1203
1203
|
"]" /* BranchEnd */,
|
@@ -1225,7 +1225,7 @@ function tryContent(scopeId, accessor, content, input) {
|
|
1225
1225
|
"^": catchContent,
|
1226
1226
|
"%": placeholderContent
|
1227
1227
|
}), writeScope(scopeId, {
|
1228
|
-
[
|
1228
|
+
["d" /* ConditionalScope */ + accessor]: getScopeById(branchId)
|
1229
1229
|
}), $chunk.writeHTML(
|
1230
1230
|
$chunk.boundary.state.mark(
|
1231
1231
|
"]" /* BranchEnd */,
|
@@ -1622,7 +1622,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1622
1622
|
break;
|
1623
1623
|
default:
|
1624
1624
|
isVoid(value) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
1625
|
-
[
|
1625
|
+
["i" /* EventAttributes */ + nodeAccessor]: events
|
1626
1626
|
})), events[getEventHandlerName(name)] = value) : skip.test(name) || (result += nonVoidAttr(name, value)));
|
1627
1627
|
break;
|
1628
1628
|
}
|
@@ -1637,9 +1637,9 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1637
1637
|
}
|
1638
1638
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
1639
1639
|
writeScope(scopeId, {
|
1640
|
-
[
|
1641
|
-
[
|
1642
|
-
[
|
1640
|
+
["f" /* ControlledType */ + nodeAccessor]: type,
|
1641
|
+
["g" /* ControlledValue */ + nodeAccessor]: value,
|
1642
|
+
["e" /* ControlledHandler */ + nodeAccessor]: valueChange
|
1643
1643
|
});
|
1644
1644
|
}
|
1645
1645
|
function stringAttr(name, value) {
|