marko 6.0.91 → 6.0.93
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 +3 -0
- package/dist/common/types.d.ts +1 -3
- package/dist/debug/dom.js +54 -19
- package/dist/debug/dom.mjs +54 -19
- package/dist/debug/html.js +33 -13
- package/dist/debug/html.mjs +30 -13
- package/dist/dom/scope.d.ts +1 -1
- package/dist/dom/signals.d.ts +1 -0
- package/dist/dom.d.ts +2 -1
- package/dist/dom.js +93 -82
- package/dist/dom.mjs +93 -82
- package/dist/html/writer.d.ts +4 -3
- package/dist/html.d.ts +1 -0
- package/dist/html.js +17 -6
- package/dist/html.mjs +14 -6
- package/dist/translator/core/html-comment.d.ts +0 -2
- package/dist/translator/core/html-script.d.ts +0 -2
- package/dist/translator/core/html-style.d.ts +0 -2
- package/dist/translator/index.js +271 -367
- package/dist/translator/util/get-defined-binding-expression.d.ts +1 -1
- package/dist/translator/util/references.d.ts +2 -1
- package/dist/translator/util/sections.d.ts +1 -0
- package/dist/translator/util/signals.d.ts +2 -1
- package/dist/translator/util/translate-var.d.ts +2 -0
- package/dist/translator/visitors/program/html.d.ts +1 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +0 -2
- package/package.json +1 -1
package/dist/dom.js
CHANGED
|
@@ -19,6 +19,7 @@ var dom_exports = {};
|
|
|
19
19
|
__export(dom_exports, {
|
|
20
20
|
$signal: () => $signal,
|
|
21
21
|
$signalReset: () => $signalReset,
|
|
22
|
+
_assert_hoist: () => _assert_hoist,
|
|
22
23
|
_attr: () => _attr,
|
|
23
24
|
_attr_class: () => _attr_class,
|
|
24
25
|
_attr_class_item: () => _attr_class_item,
|
|
@@ -57,6 +58,7 @@ __export(dom_exports, {
|
|
|
57
58
|
_content_resume: () => _content_resume,
|
|
58
59
|
_dynamic_tag: () => _dynamic_tag,
|
|
59
60
|
_el: () => _el,
|
|
61
|
+
_el_read: () => _el_read,
|
|
60
62
|
_enable_catch: () => _enable_catch,
|
|
61
63
|
_for_closure: () => _for_closure,
|
|
62
64
|
_for_in: () => _for_in,
|
|
@@ -107,6 +109,10 @@ function* attrTagIterator() {
|
|
|
107
109
|
yield this, yield* this[rest];
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
// src/common/errors.ts
|
|
113
|
+
function _assert_hoist(value) {
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
// src/common/for.ts
|
|
111
117
|
function forIn(obj, cb) {
|
|
112
118
|
for (let key in obj)
|
|
@@ -216,31 +222,32 @@ function stripSpacesAndPunctuation(str) {
|
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
// src/dom/scope.ts
|
|
225
|
+
var nextScopeId = 1e6;
|
|
219
226
|
function createScope($global, closestBranch) {
|
|
220
227
|
let scope = {
|
|
221
|
-
l:
|
|
222
|
-
|
|
228
|
+
l: nextScopeId++,
|
|
229
|
+
n: 1,
|
|
223
230
|
k: closestBranch,
|
|
224
231
|
$global
|
|
225
232
|
};
|
|
226
233
|
return pendingScopes.push(scope), scope;
|
|
227
234
|
}
|
|
228
|
-
function skipScope(
|
|
229
|
-
return
|
|
235
|
+
function skipScope() {
|
|
236
|
+
return nextScopeId++;
|
|
230
237
|
}
|
|
231
238
|
function findBranchWithKey(scope, key) {
|
|
232
239
|
let branch = scope.k;
|
|
233
240
|
for (; branch && !branch[key]; )
|
|
234
|
-
branch = branch.
|
|
241
|
+
branch = branch.x;
|
|
235
242
|
return branch;
|
|
236
243
|
}
|
|
237
244
|
function destroyBranch(branch) {
|
|
238
|
-
branch.y?.
|
|
245
|
+
branch.x?.y?.delete(branch), destroyNestedBranches(branch);
|
|
239
246
|
}
|
|
240
247
|
function destroyNestedBranches(branch) {
|
|
241
|
-
branch.
|
|
242
|
-
for (let id in scope.
|
|
243
|
-
scope
|
|
248
|
+
branch.z = 1, branch.y?.forEach(destroyNestedBranches), branch.I?.forEach((scope) => {
|
|
249
|
+
for (let id in scope.A)
|
|
250
|
+
$signalReset(scope, id);
|
|
244
251
|
});
|
|
245
252
|
}
|
|
246
253
|
function removeAndDestroyBranch(branch) {
|
|
@@ -273,7 +280,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
273
280
|
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */)
|
|
274
281
|
walker.currentNode.replaceWith(
|
|
275
282
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
|
276
|
-
), value === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(
|
|
283
|
+
), value === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope());
|
|
277
284
|
else {
|
|
278
285
|
if (value === 38 /* EndChild */)
|
|
279
286
|
return currentWalkIndex;
|
|
@@ -282,7 +289,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
282
289
|
currentWalkIndex,
|
|
283
290
|
walkCodes,
|
|
284
291
|
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
|
285
|
-
), value === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(
|
|
292
|
+
), value === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope());
|
|
286
293
|
else if (value < 92)
|
|
287
294
|
for (value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */; value--; )
|
|
288
295
|
walker.nextNode();
|
|
@@ -327,16 +334,18 @@ function init(runtimeId = "M") {
|
|
|
327
334
|
orphanBranches.splice(i, claimed);
|
|
328
335
|
};
|
|
329
336
|
return {
|
|
330
|
-
|
|
337
|
+
J() {
|
|
331
338
|
visitType === "[" /* BranchStart */ ? (endBranch(), branchStarts.push(visit)) : (visitScope[
|
|
332
|
-
nextToken()
|
|
339
|
+
"j" /* Getter */ + nextToken()
|
|
333
340
|
/* read accessor */
|
|
334
|
-
] =
|
|
341
|
+
] = /* @__PURE__ */ ((node) => () => node)(
|
|
342
|
+
visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
|
|
343
|
+
), nextToken(), endBranch(
|
|
335
344
|
visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */
|
|
336
345
|
));
|
|
337
346
|
},
|
|
338
|
-
|
|
339
|
-
scope.k = scopeLookup[scope.g || branchParents.get(scopeId)], branchParents.has(scopeId) && (scope.k && ((scope.
|
|
347
|
+
q(scope) {
|
|
348
|
+
scope.k = scopeLookup[scope.g || branchParents.get(scopeId)], branchParents.has(scopeId) && (scope.k && ((scope.x = scope.k).y ||= /* @__PURE__ */ new Set()).add(scope), scope.k = scope);
|
|
340
349
|
}
|
|
341
350
|
};
|
|
342
351
|
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, nextToken = () => lastToken = visitText.slice(
|
|
@@ -350,7 +359,7 @@ function init(runtimeId = "M") {
|
|
|
350
359
|
for (visit of visits = render.v)
|
|
351
360
|
lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], (scopeId = +nextToken()) && (visitScope = scopeLookup[scopeId] ||= {
|
|
352
361
|
l: scopeId
|
|
353
|
-
}), visitType === "*" /* Node */ ? visitScope["j" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && branches.
|
|
362
|
+
}), visitType === "*" /* Node */ ? visitScope["j" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && branches.J();
|
|
354
363
|
for (let serialized of resumes = render.r || [])
|
|
355
364
|
if (typeof serialized == "string")
|
|
356
365
|
lastEffect = serialized;
|
|
@@ -366,7 +375,7 @@ function init(runtimeId = "M") {
|
|
|
366
375
|
$global ? typeof scope == "number" ? lastScopeId += scope : (scopeId = ++lastScopeId, scope.$global = $global, scope.l = scopeId, scopeLookup[scopeId] !== scope && (scopeLookup[scopeId] = Object.assign(
|
|
367
376
|
scope,
|
|
368
377
|
scopeLookup[scopeId]
|
|
369
|
-
)), branchesEnabled && branches.
|
|
378
|
+
)), branchesEnabled && branches.q(scope)) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId);
|
|
370
379
|
} finally {
|
|
371
380
|
isResuming = visits.length = resumes.length = 0;
|
|
372
381
|
}
|
|
@@ -612,7 +621,7 @@ function _let(valueAccessor, fn) {
|
|
|
612
621
|
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value) => {
|
|
613
622
|
scope[valueAccessor] !== value && (scope[valueAccessor] = value, fn && fn(scope, value));
|
|
614
623
|
};
|
|
615
|
-
return (scope, value, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value ||
|
|
624
|
+
return (scope, value, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope.n) && (scope[valueAccessor] = value, fn && fn(scope, value)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value) : (schedule(), queueRender(
|
|
616
625
|
scope,
|
|
617
626
|
update,
|
|
618
627
|
valueAccessor,
|
|
@@ -627,7 +636,7 @@ function _const(valueAccessor, fn = () => {
|
|
|
627
636
|
}
|
|
628
637
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
|
629
638
|
return (scope) => {
|
|
630
|
-
scope.
|
|
639
|
+
scope.n ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
631
640
|
};
|
|
632
641
|
}
|
|
633
642
|
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
@@ -637,7 +646,7 @@ function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
|
637
646
|
ownerScope,
|
|
638
647
|
() => {
|
|
639
648
|
for (let scope of scopes)
|
|
640
|
-
!scope.
|
|
649
|
+
!scope.n && !scope.z && childSignal(scope);
|
|
641
650
|
},
|
|
642
651
|
-1,
|
|
643
652
|
0,
|
|
@@ -649,7 +658,7 @@ function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
|
649
658
|
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
|
650
659
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
|
651
660
|
let ifScope = scope[scopeAccessor];
|
|
652
|
-
ifScope && !ifScope.
|
|
661
|
+
ifScope && !ifScope.n && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, childSignal, -1);
|
|
653
662
|
};
|
|
654
663
|
return ownerSignal._ = childSignal, ownerSignal;
|
|
655
664
|
}
|
|
@@ -661,13 +670,13 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
|
661
670
|
));
|
|
662
671
|
}
|
|
663
672
|
function _closure(...closureSignals) {
|
|
664
|
-
let [{
|
|
673
|
+
let [{ D: ___scopeInstancesAccessor, E: ___signalIndexAccessor }] = closureSignals;
|
|
665
674
|
for (let i = closureSignals.length; i--; )
|
|
666
|
-
closureSignals[i].
|
|
675
|
+
closureSignals[i].K = i;
|
|
667
676
|
return (scope) => {
|
|
668
677
|
if (scope[___scopeInstancesAccessor])
|
|
669
678
|
for (let childScope of scope[___scopeInstancesAccessor])
|
|
670
|
-
childScope.
|
|
679
|
+
childScope.n || queueRender(
|
|
671
680
|
childScope,
|
|
672
681
|
closureSignals[childScope[___signalIndexAccessor]],
|
|
673
682
|
-1
|
|
@@ -676,13 +685,13 @@ function _closure(...closureSignals) {
|
|
|
676
685
|
}
|
|
677
686
|
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
|
678
687
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = ((scope) => {
|
|
679
|
-
scope[closureSignal.
|
|
688
|
+
scope[closureSignal.E] = closureSignal.K, childSignal(scope), subscribeToScopeSet(
|
|
680
689
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
|
681
|
-
closureSignal.
|
|
690
|
+
closureSignal.D,
|
|
682
691
|
scope
|
|
683
692
|
);
|
|
684
693
|
});
|
|
685
|
-
return closureSignal.
|
|
694
|
+
return closureSignal.D = "a" /* ClosureScopes */ + valueAccessor, closureSignal.E = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
|
|
686
695
|
}
|
|
687
696
|
function closure(valueAccessor, fn, getOwnerScope) {
|
|
688
697
|
return (scope) => {
|
|
@@ -714,6 +723,9 @@ function _script(id, fn) {
|
|
|
714
723
|
queueEffect(scope, fn);
|
|
715
724
|
};
|
|
716
725
|
}
|
|
726
|
+
function _el_read(value) {
|
|
727
|
+
return rendering && void 0, value;
|
|
728
|
+
}
|
|
717
729
|
function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
718
730
|
if (scope)
|
|
719
731
|
if (Symbol.iterator in scope)
|
|
@@ -723,7 +735,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
|
723
735
|
}
|
|
724
736
|
function _hoist(...path) {
|
|
725
737
|
return (scope) => {
|
|
726
|
-
let getOne = (...args) => iterator().next().value(...args), iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
|
738
|
+
let getOne = (...args) => iterator().next().value?.(...args), iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
|
727
739
|
return getOne;
|
|
728
740
|
};
|
|
729
741
|
}
|
|
@@ -731,7 +743,7 @@ function _hoist(...path) {
|
|
|
731
743
|
// src/dom/renderer.ts
|
|
732
744
|
function createBranch($global, renderer, parentScope, parentNode) {
|
|
733
745
|
let branch = createScope($global), parentBranch = parentScope?.k;
|
|
734
|
-
return branch._ = renderer.
|
|
746
|
+
return branch._ = renderer.t || parentScope, branch.k = branch, parentBranch && (branch.x = parentBranch, (parentBranch.y ||= /* @__PURE__ */ new Set()).add(branch)), renderer.B?.(
|
|
735
747
|
branch,
|
|
736
748
|
parentNode.namespaceURI
|
|
737
749
|
), branch;
|
|
@@ -743,7 +755,7 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
|
743
755
|
);
|
|
744
756
|
}
|
|
745
757
|
function setupBranch(renderer, branch) {
|
|
746
|
-
return renderer.
|
|
758
|
+
return renderer.C && queueRender(branch, renderer.C, -1), branch;
|
|
747
759
|
}
|
|
748
760
|
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
749
761
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
|
@@ -761,11 +773,11 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
761
773
|
};
|
|
762
774
|
return (owner) => ({
|
|
763
775
|
l: id,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
776
|
+
B: clone,
|
|
777
|
+
t: owner,
|
|
778
|
+
C: setup,
|
|
767
779
|
m: params,
|
|
768
|
-
|
|
780
|
+
o: dynamicScopesAccessor
|
|
769
781
|
});
|
|
770
782
|
}
|
|
771
783
|
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
@@ -780,7 +792,7 @@ function _content_closures(renderer, closureFns) {
|
|
|
780
792
|
closureSignals[key] = _const(key, closureFns[key]);
|
|
781
793
|
return (owner, closureValues) => {
|
|
782
794
|
let instance = renderer(owner);
|
|
783
|
-
return instance.
|
|
795
|
+
return instance.F = closureSignals, instance.L = closureValues, instance;
|
|
784
796
|
};
|
|
785
797
|
}
|
|
786
798
|
function _content_branch(template, walks, setup, params) {
|
|
@@ -937,9 +949,9 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
937
949
|
}
|
|
938
950
|
function _attr_content(scope, nodeAccessor, value) {
|
|
939
951
|
let content = normalizeClientRender(value), rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
|
940
|
-
scope[rendererAccessor] !== (scope[rendererAccessor] = content?.l) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.
|
|
941
|
-
content.
|
|
942
|
-
content.
|
|
952
|
+
scope[rendererAccessor] !== (scope[rendererAccessor] = content?.l) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.o && subscribeToScopeSet(
|
|
953
|
+
content.t,
|
|
954
|
+
content.o,
|
|
943
955
|
scope["d" /* ConditionalScope */ + nodeAccessor]
|
|
944
956
|
));
|
|
945
957
|
}
|
|
@@ -1096,8 +1108,8 @@ function _await(nodeAccessor, renderer) {
|
|
|
1096
1108
|
scope,
|
|
1097
1109
|
"d" /* PlaceholderContent */
|
|
1098
1110
|
), awaitBranch = scope[branchAccessor];
|
|
1099
|
-
tryWithPlaceholder ? (placeholderShown.add(pendingEffects), !scope[promiseAccessor] && (tryWithPlaceholder.
|
|
1100
|
-
() => tryWithPlaceholder.
|
|
1111
|
+
tryWithPlaceholder ? (placeholderShown.add(pendingEffects), !scope[promiseAccessor] && (tryWithPlaceholder.p = (tryWithPlaceholder.p || 0) + 1) === 1 && requestAnimationFrame(
|
|
1112
|
+
() => tryWithPlaceholder.p && runEffects(
|
|
1101
1113
|
prepareEffects(
|
|
1102
1114
|
() => queueRender(
|
|
1103
1115
|
tryWithPlaceholder,
|
|
@@ -1137,21 +1149,22 @@ function _await(nodeAccessor, renderer) {
|
|
|
1137
1149
|
),
|
|
1138
1150
|
referenceNode.parentNode,
|
|
1139
1151
|
referenceNode
|
|
1140
|
-
), referenceNode.remove()), renderer.m?.(awaitBranch, [data]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.
|
|
1152
|
+
), referenceNode.remove()), renderer.m?.(awaitBranch, [data]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.p)) {
|
|
1141
1153
|
let placeholderBranch = tryWithPlaceholder.c;
|
|
1142
1154
|
tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
|
|
1143
1155
|
tryWithPlaceholder.h.parentNode,
|
|
1144
1156
|
placeholderBranch.h
|
|
1145
|
-
), removeAndDestroyBranch(placeholderBranch))
|
|
1146
|
-
|
|
1147
|
-
|
|
1157
|
+
), removeAndDestroyBranch(placeholderBranch)), queueEffect(tryWithPlaceholder, (scope2) => {
|
|
1158
|
+
let pendingEffects2 = scope2.G;
|
|
1159
|
+
pendingEffects2 && (scope2.G = [], runEffects(pendingEffects2, !0));
|
|
1160
|
+
});
|
|
1148
1161
|
}
|
|
1149
1162
|
},
|
|
1150
1163
|
-1
|
|
1151
1164
|
));
|
|
1152
1165
|
},
|
|
1153
1166
|
(error) => {
|
|
1154
|
-
thisPromise === scope[promiseAccessor] && (tryWithPlaceholder && (tryWithPlaceholder.
|
|
1167
|
+
thisPromise === scope[promiseAccessor] && (tryWithPlaceholder && (tryWithPlaceholder.p = 0), scope[promiseAccessor] = 0, schedule(), queueRender(scope, renderCatch, -1, error));
|
|
1155
1168
|
}
|
|
1156
1169
|
);
|
|
1157
1170
|
};
|
|
@@ -1175,7 +1188,7 @@ function renderCatch(scope, error) {
|
|
|
1175
1188
|
let tryWithCatch = findBranchWithKey(scope, "b" /* CatchContent */);
|
|
1176
1189
|
if (tryWithCatch) {
|
|
1177
1190
|
let owner = tryWithCatch._, placeholderBranch = tryWithCatch.c;
|
|
1178
|
-
placeholderBranch && (tryWithCatch.
|
|
1191
|
+
placeholderBranch && (tryWithCatch.p = 0, owner["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
|
|
1179
1192
|
owner,
|
|
1180
1193
|
tryWithCatch.a,
|
|
1181
1194
|
tryWithCatch.b,
|
|
@@ -1219,15 +1232,15 @@ var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
|
1219
1232
|
0,
|
|
1220
1233
|
content,
|
|
1221
1234
|
createAndSetupBranch
|
|
1222
|
-
), content.
|
|
1223
|
-
content.
|
|
1224
|
-
content.
|
|
1235
|
+
), content.o && subscribeToScopeSet(
|
|
1236
|
+
content.t,
|
|
1237
|
+
content.o,
|
|
1225
1238
|
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
|
1226
1239
|
);
|
|
1227
1240
|
}
|
|
1228
|
-
} else normalizedRenderer?.
|
|
1229
|
-
normalizedRenderer.
|
|
1230
|
-
normalizedRenderer.
|
|
1241
|
+
} else normalizedRenderer?.o && subscribeToScopeSet(
|
|
1242
|
+
normalizedRenderer.t,
|
|
1243
|
+
normalizedRenderer.o,
|
|
1231
1244
|
scope[childScopeAccessor]
|
|
1232
1245
|
);
|
|
1233
1246
|
if (normalizedRenderer) {
|
|
@@ -1239,10 +1252,10 @@ var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
|
1239
1252
|
(inputIsArgs ? args[0] : args) || {}
|
|
1240
1253
|
);
|
|
1241
1254
|
else {
|
|
1242
|
-
for (let accessor in normalizedRenderer.
|
|
1243
|
-
normalizedRenderer.
|
|
1255
|
+
for (let accessor in normalizedRenderer.F)
|
|
1256
|
+
normalizedRenderer.F[accessor](
|
|
1244
1257
|
childScope,
|
|
1245
|
-
normalizedRenderer.
|
|
1258
|
+
normalizedRenderer.L[accessor]
|
|
1246
1259
|
);
|
|
1247
1260
|
if (normalizedRenderer.m)
|
|
1248
1261
|
if (inputIsArgs)
|
|
@@ -1336,17 +1349,17 @@ var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caugh
|
|
|
1336
1349
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope.l) {
|
|
1337
1350
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
|
1338
1351
|
if (existingRender)
|
|
1339
|
-
existingRender.
|
|
1352
|
+
existingRender.H = value;
|
|
1340
1353
|
else {
|
|
1341
1354
|
let render = {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1355
|
+
u: key,
|
|
1356
|
+
q: scope,
|
|
1357
|
+
M: signal,
|
|
1358
|
+
H: value
|
|
1346
1359
|
}, i = pendingRenders.push(render) - 1;
|
|
1347
1360
|
for (; i; ) {
|
|
1348
1361
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
|
1349
|
-
if (key - parent.
|
|
1362
|
+
if (key - parent.u >= 0) break;
|
|
1350
1363
|
pendingRenders[i] = parent, i = parentIndex;
|
|
1351
1364
|
}
|
|
1352
1365
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
|
@@ -1385,54 +1398,54 @@ function runRenders() {
|
|
|
1385
1398
|
for (; pendingRenders.length; ) {
|
|
1386
1399
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
|
1387
1400
|
if (render !== item) {
|
|
1388
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
|
1401
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).u;
|
|
1389
1402
|
for (; i < mid; ) {
|
|
1390
1403
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
|
1391
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
|
1404
|
+
if (right < pendingRenders.length && pendingRenders[right].u - pendingRenders[bestChild].u < 0 && (bestChild = right), pendingRenders[bestChild].u - key >= 0)
|
|
1392
1405
|
break;
|
|
1393
1406
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
|
1394
1407
|
}
|
|
1395
1408
|
pendingRenders[i] = item;
|
|
1396
1409
|
}
|
|
1397
|
-
render.
|
|
1410
|
+
render.q.k?.z || runRender(render);
|
|
1398
1411
|
}
|
|
1399
1412
|
for (let scope of pendingScopes)
|
|
1400
|
-
scope.
|
|
1413
|
+
scope.n = 0;
|
|
1401
1414
|
pendingScopes = [];
|
|
1402
1415
|
}
|
|
1403
|
-
var runRender = (render) => render.
|
|
1416
|
+
var runRender = (render) => render.M(render.q, render.H), _enable_catch = () => {
|
|
1404
1417
|
_enable_catch = () => {
|
|
1405
1418
|
}, enableBranches();
|
|
1406
1419
|
let handlePendingTry = (fn, scope, branch) => {
|
|
1407
1420
|
for (; branch; ) {
|
|
1408
|
-
if (branch.
|
|
1409
|
-
return (branch.
|
|
1410
|
-
branch = branch.
|
|
1421
|
+
if (branch.p)
|
|
1422
|
+
return (branch.G ||= []).push(fn, scope);
|
|
1423
|
+
branch = branch.x;
|
|
1411
1424
|
}
|
|
1412
1425
|
};
|
|
1413
1426
|
runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
1414
1427
|
if (checkPending || caughtError.has(effects)) {
|
|
1415
1428
|
let i = 0, fn, scope, branch;
|
|
1416
1429
|
for (; i < effects.length; )
|
|
1417
|
-
fn = effects[i++], scope = effects[i++], branch = scope.k, !branch?.
|
|
1430
|
+
fn = effects[i++], scope = effects[i++], branch = scope.k, !branch?.z && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope, scope);
|
|
1418
1431
|
} else
|
|
1419
1432
|
runEffects2(effects);
|
|
1420
1433
|
})(runEffects), runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
|
1421
1434
|
try {
|
|
1422
1435
|
runRender2(render);
|
|
1423
1436
|
} catch (error) {
|
|
1424
|
-
renderCatch(render.
|
|
1437
|
+
renderCatch(render.q, error);
|
|
1425
1438
|
}
|
|
1426
1439
|
})(runRender);
|
|
1427
1440
|
};
|
|
1428
1441
|
|
|
1429
1442
|
// src/dom/abort-signal.ts
|
|
1430
1443
|
function $signalReset(scope, id) {
|
|
1431
|
-
let ctrl = scope.
|
|
1432
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
|
1444
|
+
let ctrl = scope.A?.[id];
|
|
1445
|
+
ctrl && (queueEffect(ctrl, abort), scope.A[id] = void 0);
|
|
1433
1446
|
}
|
|
1434
1447
|
function $signal(scope, id) {
|
|
1435
|
-
return scope.k && (scope.k.
|
|
1448
|
+
return scope.k && (scope.k.I ||= /* @__PURE__ */ new Set()).add(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
1436
1449
|
}
|
|
1437
1450
|
function abort(ctrl) {
|
|
1438
1451
|
ctrl.abort();
|
|
@@ -1454,7 +1467,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
|
1454
1467
|
_resume(RENDERER_REGISTER_ID, fn);
|
|
1455
1468
|
},
|
|
1456
1469
|
isRenderer(renderer) {
|
|
1457
|
-
return renderer.
|
|
1470
|
+
return renderer.B;
|
|
1458
1471
|
},
|
|
1459
1472
|
getStartNode(branch) {
|
|
1460
1473
|
return branch.h;
|
|
@@ -1476,7 +1489,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
|
1476
1489
|
},
|
|
1477
1490
|
createRenderer(params, clone) {
|
|
1478
1491
|
let renderer = _content_branch(0, 0, 0, params);
|
|
1479
|
-
return renderer.
|
|
1492
|
+
return renderer.B = (branch) => {
|
|
1480
1493
|
let cloned = clone();
|
|
1481
1494
|
branch.h = cloned.startNode, branch.j = cloned.endNode;
|
|
1482
1495
|
}, renderer;
|
|
@@ -1489,10 +1502,10 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
|
1489
1502
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
1490
1503
|
}
|
|
1491
1504
|
if (component.effects = prepareEffects(() => {
|
|
1492
|
-
branch || (created = 1,
|
|
1505
|
+
branch || (created = 1, branch = component.scope = createAndSetupBranch(
|
|
1493
1506
|
out.global,
|
|
1494
1507
|
renderer,
|
|
1495
|
-
renderer.
|
|
1508
|
+
renderer.t,
|
|
1496
1509
|
document.body
|
|
1497
1510
|
)), renderer.m?.(branch, renderer._ ? args[0] : args);
|
|
1498
1511
|
}), created)
|
|
@@ -1514,12 +1527,10 @@ var _template = (id, template, walks, setup, inputSignal) => {
|
|
|
1514
1527
|
function mount(input = {}, reference, position) {
|
|
1515
1528
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
|
1516
1529
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
|
1517
|
-
p: 0,
|
|
1518
1530
|
runtimeId: "M",
|
|
1519
1531
|
renderId: "_",
|
|
1520
1532
|
...$global
|
|
1521
1533
|
}) : $global = {
|
|
1522
|
-
p: 0,
|
|
1523
1534
|
runtimeId: "M",
|
|
1524
1535
|
renderId: "_"
|
|
1525
1536
|
}, position) {
|
|
@@ -1541,7 +1552,7 @@ function mount(input = {}, reference, position) {
|
|
|
1541
1552
|
parentNode
|
|
1542
1553
|
), branch.e = (newValue) => {
|
|
1543
1554
|
curValue = newValue;
|
|
1544
|
-
}, this.
|
|
1555
|
+
}, this.C?.(branch), args?.(branch, input);
|
|
1545
1556
|
});
|
|
1546
1557
|
return insertChildNodes(
|
|
1547
1558
|
parentNode,
|