marko 6.4.10 → 6.4.12
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 +0 -3
- package/dist/common/accessor.debug.d.ts +0 -3
- package/dist/common/attr-tag.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +3 -1
- package/dist/common/types.d.ts +4 -3
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/compat.feat.js +143 -0
- package/dist/debug/dom/compat.feat.mjs +141 -0
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/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-DNB5yq3U.js → dom-CtXOr4Nm.js} +257 -230
- package/dist/debug/{dom-C1V5vpFs.mjs → dom-DaHYZpf2.mjs} +238 -229
- package/dist/debug/dom.js +8 -134
- package/dist/debug/dom.mjs +5 -126
- package/dist/debug/html/compat.feat.js +222 -0
- package/dist/debug/html/compat.feat.mjs +220 -0
- package/dist/debug/html-DMo6pc_h.mjs +3931 -0
- package/dist/debug/html-DfZjMkhx.js +4513 -0
- package/dist/debug/html.js +83 -4239
- package/dist/debug/html.mjs +1 -4152
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
- package/dist/dom/compat.feat.js +101 -0
- package/dist/dom/compat.feat.mjs +100 -0
- package/dist/dom/control-flow.d.ts +4 -5
- 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.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dom.d.ts +2 -1
- 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 +1 -1
- 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/load.d.ts +3 -4
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +1 -2
- package/dist/dom/resume.d.ts +3 -1
- package/dist/dom/signals.d.ts +5 -7
- package/dist/{dom-C2-Flitp.js → dom-BB-Te-3z.js} +222 -239
- package/dist/{dom-DsHYWMCR.mjs → dom-BO-0hzLZ.mjs} +124 -146
- package/dist/dom.d.ts +1 -2
- package/dist/dom.js +17 -95
- package/dist/dom.mjs +6 -79
- package/dist/html/assets.d.ts +3 -4
- package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
- package/dist/html/compat.feat.js +165 -0
- package/dist/html/compat.feat.mjs +164 -0
- package/dist/html/dynamic-tag.d.ts +1 -2
- package/dist/html/for.d.ts +0 -1
- package/dist/html/writer.d.ts +4 -3
- package/dist/html-DMDc0zKs.mjs +2404 -0
- package/dist/html-DrHsybFm.js +2880 -0
- package/dist/html.d.ts +1 -2
- package/dist/html.js +2 -2578
- package/dist/html.mjs +3 -2573
- package/dist/translator/index.d.ts +0 -1
- package/dist/translator/index.js +4889 -4733
- package/dist/translator/interop/out-global.d.ts +5 -0
- package/dist/translator/util/assert.d.ts +6 -0
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/entry-builder.d.ts +1 -1
- package/dist/translator/util/finalize-references.d.ts +2 -1
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +10 -1
- package/dist/translator/util/optional.d.ts +0 -1
- package/dist/translator/util/reasons.d.ts +0 -1
- package/dist/translator/util/references.d.ts +12 -5
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +11 -2
- package/dist/translator/util/signals.d.ts +2 -1
- package/dist/translator/util/style-interpolation.d.ts +1 -1
- package/dist/translator/util/tag-facts.d.ts +2 -0
- package/dist/translator/util/tag-name-type.d.ts +1 -0
- package/dist/translator/util/translate-attrs.d.ts +1 -4
- package/dist/translator/util/visitors.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/program/index.d.ts +2 -6
- package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
- package/index.d.ts +2 -7
- package/package.json +4 -4
- package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
- package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
// src/common/attr-tag.ts
|
|
2
|
+
const empty = [];
|
|
3
|
+
const rest = Symbol("Attribute Tag");
|
|
4
|
+
function attrTag(attrs) {
|
|
5
|
+
attrs[Symbol.iterator] = attrTagIterator;
|
|
6
|
+
attrs[rest] = empty;
|
|
7
|
+
return attrs;
|
|
8
|
+
}
|
|
9
|
+
function attrTags(first, attrs) {
|
|
10
|
+
if (first) {
|
|
11
|
+
if (first[rest] === empty) first[rest] = [attrs];
|
|
12
|
+
else first[rest].push(attrs);
|
|
13
|
+
return first;
|
|
14
|
+
}
|
|
15
|
+
return attrTag(attrs);
|
|
16
|
+
}
|
|
17
|
+
function isAttrTag(value) {
|
|
18
|
+
return !!value?.[rest];
|
|
19
|
+
}
|
|
20
|
+
function* attrTagIterator() {
|
|
21
|
+
yield this;
|
|
22
|
+
yield* this[rest];
|
|
23
|
+
}
|
|
1
24
|
// src/common/constants/accessor-prefix.debug.ts
|
|
2
25
|
const BranchScopes$1 = "BranchScopes:";
|
|
3
26
|
const ClosureScopes = "ClosureScopes:";
|
|
@@ -51,8 +74,6 @@ const Changed = "Changed";
|
|
|
51
74
|
const ScopesAccessor = "scopesAccessor";
|
|
52
75
|
const SignalIndexAccessor = "signalIndexAccessor";
|
|
53
76
|
const Index = "index";
|
|
54
|
-
// src/common/constants/keyed-scopes-prop.debug.ts
|
|
55
|
-
const PreviousKey = "PreviousKey:";
|
|
56
77
|
const Scope = "scope";
|
|
57
78
|
const Signal = "signal";
|
|
58
79
|
const Value = "value";
|
|
@@ -133,7 +154,7 @@ function escapeStyleValue(str) {
|
|
|
133
154
|
else if (c === closers[0]) closers = closers.slice(1);
|
|
134
155
|
return result + closers;
|
|
135
156
|
}
|
|
136
|
-
|
|
157
|
+
function toDelimitedString(val, delimiter, stringify) {
|
|
137
158
|
let str = "";
|
|
138
159
|
let sep = "";
|
|
139
160
|
let part;
|
|
@@ -155,7 +176,7 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
|
|
|
155
176
|
}
|
|
156
177
|
}
|
|
157
178
|
return str;
|
|
158
|
-
}
|
|
179
|
+
}
|
|
159
180
|
function isEventHandler(name) {
|
|
160
181
|
return /^on[A-Z-]/.test(name);
|
|
161
182
|
}
|
|
@@ -168,15 +189,20 @@ function isNotNullishOrFalse(value) {
|
|
|
168
189
|
function isPromise(value) {
|
|
169
190
|
return value != null && typeof value.then === "function";
|
|
170
191
|
}
|
|
192
|
+
let classAPIRenderer;
|
|
193
|
+
function setClassAPIRenderer(render) {
|
|
194
|
+
classAPIRenderer = render;
|
|
195
|
+
}
|
|
171
196
|
function normalizeDynamicRenderer(value) {
|
|
172
197
|
if (value) {
|
|
173
198
|
if (typeof value === "string") return value;
|
|
174
199
|
const normalized = value.content || value.default || value;
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if ("id" in normalized) return normalized;
|
|
200
|
+
if (typeof normalized !== "object" && typeof normalized !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received ${normalized === value ? `a ${typeof value}` : `an object whose \`content\` or \`default\` is a ${typeof normalized}`}.`);
|
|
201
|
+
if (classAPIRenderer) {
|
|
202
|
+
const renderer = classAPIRenderer(normalized);
|
|
203
|
+
if (renderer || false) return renderer;
|
|
204
|
+
} else if ("id" in normalized) return normalized;
|
|
205
|
+
if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
|
|
180
206
|
}
|
|
181
207
|
}
|
|
182
208
|
let branchesEnabled;
|
|
@@ -287,6 +313,12 @@ function assertNoValueBindingOnCheckable(type, valueChange) {
|
|
|
287
313
|
function assertHandlerIsFunction(name, value) {
|
|
288
314
|
if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
|
|
289
315
|
}
|
|
316
|
+
function assertNoNativeAttrTags(tagName, input) {
|
|
317
|
+
for (const name in input) if (name !== "content" && isAttrTag(input[name])) throw new Error(`A dynamic tag passed the native \`<${tagName}>\` tag an [attribute tag](https://markojs.com/docs/reference/language#attribute-tags) as \`${name}\`, but [native tags](https://markojs.com/docs/reference/native-tag) do not support attribute tags.`);
|
|
318
|
+
}
|
|
319
|
+
function assertValidContent(value, renderer) {
|
|
320
|
+
if (value && !renderer?.["id"]) throw new Error(`The \`content\` attribute on a [native tag](https://markojs.com/docs/reference/native-tag#content) must be body content, a \`<define>\` tag variable or attribute tag holding it, or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
|
|
321
|
+
}
|
|
290
322
|
function assertValidTagName(tagName) {
|
|
291
323
|
if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) throw new Error(`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`);
|
|
292
324
|
}
|
|
@@ -434,9 +466,9 @@ function prepareEffects(fn) {
|
|
|
434
466
|
}
|
|
435
467
|
return preparedEffects;
|
|
436
468
|
}
|
|
437
|
-
let runEffects = (
|
|
469
|
+
let runEffects = (effects) => {
|
|
438
470
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
439
|
-
}
|
|
471
|
+
};
|
|
440
472
|
let runRender = (render) => {
|
|
441
473
|
if (!branchesEnabled || render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) render[Signal](render[Scope], render[Value]);
|
|
442
474
|
};
|
|
@@ -486,7 +518,7 @@ function $signal(scope, id) {
|
|
|
486
518
|
return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
|
|
487
519
|
}
|
|
488
520
|
/** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
|
|
489
|
-
function
|
|
521
|
+
function onAbort(scope, id, abort) {
|
|
490
522
|
abortsEnabled = 1;
|
|
491
523
|
trackCleanup(scope);
|
|
492
524
|
(scope[AbortControllers] ||= {})[id] = { abort };
|
|
@@ -585,7 +617,7 @@ function skipScope() {
|
|
|
585
617
|
return nextScopeId++;
|
|
586
618
|
}
|
|
587
619
|
function destroyBranch(branch) {
|
|
588
|
-
branch[ParentBranch]?.[BranchScopes]
|
|
620
|
+
branch[ParentBranch]?.[BranchScopes].delete(branch);
|
|
589
621
|
destroyNestedScopes(branch);
|
|
590
622
|
}
|
|
591
623
|
function destroyScope(scope) {
|
|
@@ -594,11 +626,11 @@ function destroyScope(scope) {
|
|
|
594
626
|
cleanupScope(scope);
|
|
595
627
|
}
|
|
596
628
|
}
|
|
597
|
-
|
|
629
|
+
function destroyNestedScopes(scope) {
|
|
598
630
|
scope[Gen$1] = 0;
|
|
599
631
|
scope[BranchScopes]?.forEach(destroyNestedScopes);
|
|
600
632
|
scope[AbortScopes]?.forEach(cleanupScope);
|
|
601
|
-
}
|
|
633
|
+
}
|
|
602
634
|
function cleanupScope(scope) {
|
|
603
635
|
if (subscriptionsEnabled) scope[Subscriptions]?.forEach(unsubscribe, scope);
|
|
604
636
|
if (abortsEnabled) for (const id in scope[AbortControllers]) $signalReset(scope, id);
|
|
@@ -690,7 +722,8 @@ function _const(valueAccessor, fn) {
|
|
|
690
722
|
}
|
|
691
723
|
});
|
|
692
724
|
}
|
|
693
|
-
function _or(id, fn, defaultPending = 1, scopeIdAccessor
|
|
725
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor) {
|
|
726
|
+
scopeIdAccessor = scopeIdAccessor ? scopeIdAccessor : "#Id";
|
|
694
727
|
return (scope) => {
|
|
695
728
|
if (scope["#Gen"] === runId) {
|
|
696
729
|
if (~id in scope) {
|
|
@@ -699,36 +732,33 @@ function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
|
|
|
699
732
|
} else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
700
733
|
};
|
|
701
734
|
}
|
|
702
|
-
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
735
|
+
function _for_closure(ownerLoopNodeAccessor, fn, id, scopeIdAccessor) {
|
|
736
|
+
scopeIdAccessor = scopeIdAccessor ? scopeIdAccessor : "#Id";
|
|
703
737
|
const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
|
|
704
|
-
const
|
|
705
|
-
const
|
|
706
|
-
queueRender(ownerScope, (_) => {
|
|
707
|
-
for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
|
|
708
|
-
}, -1);
|
|
738
|
+
const render = (ownerScope) => {
|
|
739
|
+
for (const scope of toArray(ownerScope[scopeAccessor])) if (scope["#Gen"] < runId) fn(scope);
|
|
709
740
|
};
|
|
741
|
+
const ownerSignal = (ownerScope) => queueRender(ownerScope, render, id, 0, ownerScope[scopeIdAccessor]);
|
|
710
742
|
ownerSignal._ = (scope) => queueRender(scope, fn, -1);
|
|
711
743
|
return ownerSignal;
|
|
712
744
|
}
|
|
713
|
-
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
|
|
745
|
+
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn, getValueScope) {
|
|
714
746
|
const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
|
|
715
747
|
const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
|
|
716
|
-
const
|
|
748
|
+
const prevKey = Symbol(ownerValueAccessor);
|
|
717
749
|
const ownerSignal = (ownerScope) => {
|
|
718
750
|
if (ownerScope["#Gen"] < runId) {
|
|
719
|
-
const nextKey = ownerScope[ownerValueAccessor];
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
if (map) map[prevKeyProp] = nextKey;
|
|
731
|
-
}, -1);
|
|
751
|
+
const nextKey = (getValueScope ? getValueScope(ownerScope) : ownerScope)[ownerValueAccessor];
|
|
752
|
+
const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
|
|
753
|
+
if (map && prevKey in ownerScope) {
|
|
754
|
+
const prevScope = map.get(ownerScope[prevKey]);
|
|
755
|
+
const nextScope = map.get(nextKey);
|
|
756
|
+
if (prevScope !== nextScope) {
|
|
757
|
+
queueLiveBranch(prevScope, fn);
|
|
758
|
+
queueLiveBranch(nextScope, fn);
|
|
759
|
+
}
|
|
760
|
+
} else for (const scope of toArray(ownerScope[scopeAccessor])) queueLiveBranch(scope, fn);
|
|
761
|
+
ownerScope[prevKey] = nextKey;
|
|
732
762
|
}
|
|
733
763
|
};
|
|
734
764
|
ownerSignal._ = (scope) => queueRender(scope, fn, -1);
|
|
@@ -743,8 +773,8 @@ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
|
|
|
743
773
|
}
|
|
744
774
|
return map;
|
|
745
775
|
}
|
|
746
|
-
function
|
|
747
|
-
if (scope
|
|
776
|
+
function queueLiveBranch(scope, fn) {
|
|
777
|
+
if (scope?.["#Gen"] < runId) queueRender(scope, fn, -1);
|
|
748
778
|
}
|
|
749
779
|
function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
750
780
|
const scopeAccessor = BranchScopes$1 + ownerConditionalNodeAccessor;
|
|
@@ -813,9 +843,7 @@ function _id(scope, accessor) {
|
|
|
813
843
|
}
|
|
814
844
|
function _script(id, fn) {
|
|
815
845
|
_resumed[id] = fn;
|
|
816
|
-
return (scope) =>
|
|
817
|
-
queueEffect(scope, fn);
|
|
818
|
-
};
|
|
846
|
+
return (scope) => queueEffect(scope, fn);
|
|
819
847
|
}
|
|
820
848
|
function _global_read($global, key) {
|
|
821
849
|
if (!(key in $global)) console.error(`\`$global.${key}\` is not serialized to the client, so this read is \`undefined\`. Serialized globals are embedded in the page: add \`${key}\` to \`serializedGlobals\` at the render call only if it holds no secrets; otherwise copy the field the client needs into its own \`$global\` key and serialize that.`);
|
|
@@ -855,7 +883,7 @@ function walk(startNode, walkCodes, branch) {
|
|
|
855
883
|
currentNode = startNode;
|
|
856
884
|
walkInternal(0, walkCodes, branch);
|
|
857
885
|
}
|
|
858
|
-
|
|
886
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
859
887
|
let value;
|
|
860
888
|
let currentMultiplier;
|
|
861
889
|
let storedMultiplier = 0;
|
|
@@ -891,7 +919,7 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
891
919
|
storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
892
920
|
}
|
|
893
921
|
}
|
|
894
|
-
}
|
|
922
|
+
}
|
|
895
923
|
function getDebugKey(index, node) {
|
|
896
924
|
if (typeof node === "string") return `${node}/${index}`;
|
|
897
925
|
else if (node.nodeType === 3) return `#text/${index}`;
|
|
@@ -943,168 +971,166 @@ function init(runtimeId = "M") {
|
|
|
943
971
|
}
|
|
944
972
|
const renders = self[runtimeId];
|
|
945
973
|
const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
|
|
946
|
-
const initRuntime = (renders) => {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
scopeId++;
|
|
972
|
-
}
|
|
974
|
+
const initRuntime = (renders) => defineRuntime({ value: curRenders = ((renderId) => {
|
|
975
|
+
const render = curRenders[renderId] = renders[renderId] || renders(renderId);
|
|
976
|
+
const walk = render.w;
|
|
977
|
+
const scopeLookup = {};
|
|
978
|
+
const pending = [];
|
|
979
|
+
const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
|
|
980
|
+
const initGlobal = (_) => scopeLookup[0] ||= {
|
|
981
|
+
runtimeId,
|
|
982
|
+
renderId
|
|
983
|
+
};
|
|
984
|
+
const initScope = (scope) => {
|
|
985
|
+
scope[Gen$1] ??= 1;
|
|
986
|
+
scope[Global] = initGlobal();
|
|
987
|
+
if (branchesEnabled && scope["#ClosestBranchId"]) scope[ClosestBranch] = getScope(scope[ClosestBranchId]);
|
|
988
|
+
return scope;
|
|
989
|
+
};
|
|
990
|
+
const applyScopes = (partials) => {
|
|
991
|
+
let scopeId = partials[0];
|
|
992
|
+
for (let i = 1; i < partials.length; i++) {
|
|
993
|
+
const partial = partials[i];
|
|
994
|
+
if (typeof partial === "number") scopeId += partial;
|
|
995
|
+
else {
|
|
996
|
+
if (scopeId) initScope(Object.assign(scopeLookup[scopeId] ||= (partial["#Id"] = scopeId, partial), partial));
|
|
997
|
+
else Object.assign(initGlobal(), partial);
|
|
998
|
+
scopeId++;
|
|
973
999
|
}
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
startVisit = branchStarts.pop();
|
|
1007
|
-
if (parent !== startVisit.parentNode) parent.prepend(startVisit);
|
|
1008
|
-
branch[StartNode] = startVisit;
|
|
1009
|
-
branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
|
|
1003
|
+
const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
|
|
1004
|
+
return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
|
|
1005
|
+
if (visitType === "*") {
|
|
1006
|
+
while (reorderBranch && pending.length >= reorderDepth) adopt(pending.pop(), reorderBranch);
|
|
1007
|
+
if (reorderBranch = +lastToken && visitScope) reorderDepth = pending.push(reorderBranch);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
if (visitType !== "[") {
|
|
1011
|
+
visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit;
|
|
1012
|
+
accessor = BranchScopes$1 + (nodeAccessor = lastToken);
|
|
1013
|
+
singleNode = visitType !== "]" && visitType !== ")";
|
|
1014
|
+
nextToken();
|
|
1015
|
+
}
|
|
1016
|
+
while (branchId = +lastToken) {
|
|
1017
|
+
(endedBranches ||= []).push(branch = getScope(branchId));
|
|
1018
|
+
setParentBranch(branch, branch[ClosestBranch]);
|
|
1019
|
+
if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
|
|
1020
|
+
if (singleNode) {
|
|
1021
|
+
while (startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1);
|
|
1022
|
+
branch["_"] ??= visitScope;
|
|
1023
|
+
branch[EndNode] = branch[StartNode] = startVisit;
|
|
1024
|
+
if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
|
|
1025
|
+
} else {
|
|
1026
|
+
branch[BranchAccessor] = nodeAccessor;
|
|
1027
|
+
curBranchScopes = push(curBranchScopes, branch);
|
|
1028
|
+
if (accessor) {
|
|
1029
|
+
visitScope[accessor] = curBranchScopes;
|
|
1030
|
+
forEach(curBranchScopes, (scope) => scope["_"] ??= visitScope);
|
|
1031
|
+
curBranchScopes = branchScopesStack.pop();
|
|
1010
1032
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1033
|
+
startVisit = branchStarts.pop();
|
|
1034
|
+
if (parent !== startVisit.parentNode) parent.prepend(startVisit);
|
|
1035
|
+
branch[StartNode] = startVisit;
|
|
1036
|
+
branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
1013
1037
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1038
|
+
while (pending.at(-1)?.["#Id"] >= branchId) adopt(pending.pop(), branch);
|
|
1039
|
+
nextToken();
|
|
1040
|
+
}
|
|
1041
|
+
if (endedBranches) {
|
|
1042
|
+
for (const ended of endedBranches) pending.push(ended);
|
|
1043
|
+
if (singleNode) visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
|
|
1044
|
+
}
|
|
1045
|
+
if (visitType === "[") {
|
|
1046
|
+
if (!endedBranches) {
|
|
1047
|
+
branchScopesStack.push(curBranchScopes);
|
|
1048
|
+
curBranchScopes = void 0;
|
|
1017
1049
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
branchScopesStack.push(curBranchScopes);
|
|
1021
|
-
curBranchScopes = void 0;
|
|
1022
|
-
}
|
|
1023
|
-
branchStarts.push(visit);
|
|
1024
|
-
} else pending.push(visitScope);
|
|
1025
|
-
};
|
|
1050
|
+
branchStarts.push(visit);
|
|
1051
|
+
} else pending.push(visitScope);
|
|
1026
1052
|
};
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1053
|
+
};
|
|
1054
|
+
const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
|
|
1055
|
+
const processResumes = (resumes = [], effects) => {
|
|
1056
|
+
let i = 0;
|
|
1057
|
+
for (; i < resumes.length; i++) {
|
|
1058
|
+
const serialized = resumes[i];
|
|
1059
|
+
if (typeof serialized === "string") {
|
|
1060
|
+
lastTokenIndex = 0;
|
|
1061
|
+
visitText = serialized;
|
|
1062
|
+
while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
|
|
1063
|
+
else effects.push(lastEffect, getScope(lastToken));
|
|
1064
|
+
} else if (readyIds && typeof serialized !== "function") {
|
|
1065
|
+
if (typeof serialized === "number" || !Object.keys(serialized).every((dep) => readyIds.has(dep) && (render.b[dep]?.n || 0) >= serialized[dep])) break;
|
|
1066
|
+
} else {
|
|
1067
|
+
if (readyIds) resumes.n = (resumes.n || 0) + 1;
|
|
1068
|
+
const scopes = serialized(serializeContext);
|
|
1069
|
+
if (Array.isArray(scopes)) applyScopes(scopes);
|
|
1044
1070
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1071
|
+
}
|
|
1072
|
+
resumes.splice(0, i);
|
|
1073
|
+
return i;
|
|
1074
|
+
};
|
|
1075
|
+
let lastEffect;
|
|
1076
|
+
let visits;
|
|
1077
|
+
let visit;
|
|
1078
|
+
let visitText;
|
|
1079
|
+
let visitType;
|
|
1080
|
+
let visitScope;
|
|
1081
|
+
let lastToken;
|
|
1082
|
+
let lastTokenIndex;
|
|
1083
|
+
let visitBranches;
|
|
1084
|
+
let htmlStart;
|
|
1085
|
+
let embedAnchor;
|
|
1086
|
+
serializeContext._ = _resumed;
|
|
1087
|
+
if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
|
|
1088
|
+
for (const otherId in curRenders) if (otherId !== renderId && (otherId.startsWith(renderId) || renderId.startsWith(otherId))) console.error(`Marko rendered with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as both ${JSON.stringify(otherId)} and ${JSON.stringify(renderId)}, so one render claims the other's resume comments. Ensure no $global.renderId in a page starts another.`);
|
|
1089
|
+
render.m = (effects) => {
|
|
1090
|
+
processResumes(render.r, effects);
|
|
1091
|
+
if (readyIds && render.b) for (let progress = 1; progress;) {
|
|
1092
|
+
progress = 0;
|
|
1093
|
+
for (const readyId of readyIds) {
|
|
1094
|
+
const resumes = render.b[readyId];
|
|
1095
|
+
if (resumes && processResumes(resumes, effects)) progress = 1;
|
|
1070
1096
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
if (visit.parentNode !== htmlStart.parentNode) console.error("An unescaped placeholder (`$!{}`) rendered HTML that does not parse as a balanced fragment where it is placed (an unclosed, stray or misnested tag), so updating it removes the wrong nodes.");
|
|
1081
|
-
visitScope[nextToken()] = htmlStart;
|
|
1082
|
-
visitScope[DynamicHTMLLastChild + lastToken] = visit;
|
|
1083
|
-
if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
|
|
1084
|
-
}
|
|
1085
|
-
} else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
|
|
1086
|
-
else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
|
|
1097
|
+
}
|
|
1098
|
+
let retained = 0;
|
|
1099
|
+
for (visit of visits = render.v) {
|
|
1100
|
+
lastTokenIndex = render.i.length;
|
|
1101
|
+
visitText = visit.data;
|
|
1102
|
+
visitType = visitText[lastTokenIndex++];
|
|
1103
|
+
visitScope = getScope(nextToken());
|
|
1104
|
+
if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") {
|
|
1105
|
+
if (visitType === "&") htmlStart = visit;
|
|
1087
1106
|
else {
|
|
1088
|
-
|
|
1107
|
+
if (visit.parentNode !== htmlStart.parentNode) console.error("An unescaped placeholder (`$!{}`) rendered HTML that does not parse as a balanced fragment where it is placed (an unclosed, stray or misnested tag), so updating it removes the wrong nodes.");
|
|
1108
|
+
visitScope[nextToken()] = htmlStart;
|
|
1109
|
+
visitScope[DynamicHTMLLastChild + lastToken] = visit;
|
|
1089
1110
|
if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
|
|
1090
1111
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
visitBranches();
|
|
1112
|
+
} else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
|
|
1113
|
+
else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
|
|
1114
|
+
else {
|
|
1115
|
+
visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling;
|
|
1116
|
+
if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
|
|
1097
1117
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1118
|
+
if (embedRenders && !embedAnchor && visit.parentNode) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
|
|
1119
|
+
}
|
|
1120
|
+
if (branchesEnabled && visitBranches) {
|
|
1121
|
+
visitType = "*";
|
|
1122
|
+
lastToken = "";
|
|
1123
|
+
visitBranches();
|
|
1124
|
+
}
|
|
1125
|
+
visits.length = retained;
|
|
1126
|
+
return effects;
|
|
1127
|
+
};
|
|
1128
|
+
render.w = (_) => {
|
|
1129
|
+
walk();
|
|
1130
|
+
runResumeEffects(render);
|
|
1131
|
+
};
|
|
1132
|
+
return render;
|
|
1133
|
+
}) });
|
|
1108
1134
|
if (renders) {
|
|
1109
1135
|
initRuntime(renders);
|
|
1110
1136
|
for (const renderId in renders) runResumeEffects(curRenders(renderId));
|
|
@@ -1135,7 +1161,7 @@ function _el(id, accessor) {
|
|
|
1135
1161
|
function _dynamic_tag_var_resume(accessor) {
|
|
1136
1162
|
_resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
|
|
1137
1163
|
const node = scope[accessor];
|
|
1138
|
-
return _el_read(node.nodeType
|
|
1164
|
+
return _el_read(node.nodeType > 1 ? node.previousSibling : node);
|
|
1139
1165
|
};
|
|
1140
1166
|
}
|
|
1141
1167
|
// src/dom/renderer.ts
|
|
@@ -1169,11 +1195,8 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1169
1195
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
|
1170
1196
|
setup = setup ? setup._ || setup : void 0;
|
|
1171
1197
|
params ||= void 0;
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
} : (branch) => {
|
|
1175
|
-
walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
|
|
1176
|
-
};
|
|
1198
|
+
const cloneables = {};
|
|
1199
|
+
const clone = template ? (branch, ns) => (cloneables[ns] ||= createCloneableHTML(template, walks, ns))(branch) : (branch) => walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
|
|
1177
1200
|
return _resumed[id] = (owner) => {
|
|
1178
1201
|
return {
|
|
1179
1202
|
["id"]: id,
|
|
@@ -1213,14 +1236,11 @@ function _content_closures(renderer, closureFns) {
|
|
|
1213
1236
|
return instance;
|
|
1214
1237
|
};
|
|
1215
1238
|
}
|
|
1216
|
-
|
|
1217
|
-
function createCloneableHTML(html, ns) {
|
|
1239
|
+
function createCloneableHTML(html, walks, ns) {
|
|
1218
1240
|
const { firstChild, lastChild } = parseHTML(html, ns);
|
|
1219
1241
|
const parent = new DocumentFragment();
|
|
1220
1242
|
insertChildNodes(parent, null, firstChild, lastChild);
|
|
1221
|
-
return firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
|
|
1222
|
-
walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch);
|
|
1223
|
-
} : (branch, walks) => {
|
|
1243
|
+
return firstChild === lastChild && firstChild.nodeType < 8 ? (branch) => walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch) : (branch) => {
|
|
1224
1244
|
const clone = parent.cloneNode(true);
|
|
1225
1245
|
clone.namespaceURI = ns;
|
|
1226
1246
|
walk(clone.firstChild, walks, branch);
|
|
@@ -1357,8 +1377,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
1357
1377
|
}
|
|
1358
1378
|
}
|
|
1359
1379
|
}
|
|
1360
|
-
function _attr_content(scope, nodeAccessor,
|
|
1361
|
-
|
|
1380
|
+
function _attr_content(scope, nodeAccessor, content) {
|
|
1381
|
+
var value = content;
|
|
1382
|
+
content = content?.content || content;
|
|
1383
|
+
if (classAPIRenderer && content) content = classAPIRenderer(content);
|
|
1384
|
+
assertValidContent(value, content);
|
|
1362
1385
|
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
|
|
1363
1386
|
setBranch(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1364
1387
|
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
@@ -1393,13 +1416,6 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
|
|
|
1393
1416
|
removeChildNodes(firstChild, lastChild);
|
|
1394
1417
|
}
|
|
1395
1418
|
});
|
|
1396
|
-
function normalizeClientRender(value) {
|
|
1397
|
-
const renderer = normalizeDynamicRenderer(value);
|
|
1398
|
-
if (renderer) {
|
|
1399
|
-
if (renderer["id"]) return renderer;
|
|
1400
|
-
else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
1419
|
function normalizeAttrValue(value) {
|
|
1404
1420
|
if (isNotNullishOrFalse(value)) return value === true ? "" : value + "";
|
|
1405
1421
|
}
|
|
@@ -1416,7 +1432,7 @@ function _lifecycle(scope, thisObj, index = 0) {
|
|
|
1416
1432
|
Object.assign(thisObj, thisObj.onMount?.());
|
|
1417
1433
|
for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
|
|
1418
1434
|
}
|
|
1419
|
-
|
|
1435
|
+
onAbort(scope, accessor, (_) => thisObj.onDestroy?.());
|
|
1420
1436
|
}
|
|
1421
1437
|
}
|
|
1422
1438
|
function removeChildNodes(startNode, endNode) {
|
|
@@ -1778,7 +1794,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1778
1794
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1779
1795
|
if (!scope[tryAccessor]) {
|
|
1780
1796
|
scope[tryAccessor] = tryBranch;
|
|
1781
|
-
|
|
1797
|
+
onAbort(scope, promiseAccessor, (_) => {
|
|
1782
1798
|
scope[promiseAccessor] = 0;
|
|
1783
1799
|
if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
|
|
1784
1800
|
});
|
|
@@ -1956,7 +1972,7 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
|
|
|
1956
1972
|
const rangeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1957
1973
|
return (scope, display) => {
|
|
1958
1974
|
const referenceNode = scope[nodeAccessor];
|
|
1959
|
-
const onlyChild = referenceNode.nodeType
|
|
1975
|
+
const onlyChild = referenceNode.nodeType < 3;
|
|
1960
1976
|
const parentNode = onlyChild ? referenceNode : referenceNode.parentNode;
|
|
1961
1977
|
let range = scope[rangeAccessor];
|
|
1962
1978
|
if (!range) {
|
|
@@ -1977,9 +1993,6 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
|
|
|
1977
1993
|
function rendererKey(renderer) {
|
|
1978
1994
|
return renderer?.["owner"] ? renderer["id"] + " " + renderer[Owner]["#Id"] : renderer?.["id"] || renderer;
|
|
1979
1995
|
}
|
|
1980
|
-
function patchDynamicTag(fn) {
|
|
1981
|
-
_dynamic_tag = fn(_dynamic_tag);
|
|
1982
|
-
}
|
|
1983
1996
|
let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
|
|
1984
1997
|
const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
|
|
1985
1998
|
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
@@ -1993,12 +2006,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1993
2006
|
bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
|
|
1994
2007
|
}
|
|
1995
2008
|
if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
|
|
1996
|
-
else if (getContent) {
|
|
1997
|
-
const content = getContent(scope);
|
|
1998
|
-
const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
|
|
1999
|
-
setBranch(branch, elementAccessor, content, createAndSetupBranch);
|
|
2000
|
-
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
|
|
2001
|
-
}
|
|
2009
|
+
else if (getContent) _attr_content(branch, `#${tagNameOrRenderer.toLowerCase()}/0`, getContent(scope));
|
|
2002
2010
|
return branch;
|
|
2003
2011
|
};
|
|
2004
2012
|
return (scope, newRenderer, getInput) => {
|
|
@@ -2017,6 +2025,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
2017
2025
|
const args = getInput?.();
|
|
2018
2026
|
if (typeof normalizedRenderer === "string") {
|
|
2019
2027
|
const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
|
|
2028
|
+
assertNoNativeAttrTags(normalizedRenderer, inputIsArgs ? args[0] : args);
|
|
2020
2029
|
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope[nodeAccessor].tagName]);
|
|
2021
2030
|
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
2022
2031
|
} else {
|
|
@@ -2094,7 +2103,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
|
|
|
2094
2103
|
const oldScope = oldScopes[i];
|
|
2095
2104
|
let branch = oldLen && (oldScopesByKey || key !== (oldScope?.["#LoopKey"] ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope["#LoopIndex"] = j, map.set(scope["#LoopKey"] ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
2096
2105
|
if (branch) {
|
|
2097
|
-
hasPotentialMoves =
|
|
2106
|
+
hasPotentialMoves = 1;
|
|
2098
2107
|
oldScopesByKey?.delete(key);
|
|
2099
2108
|
branch[LoopKey] = key;
|
|
2100
2109
|
} else {
|
|
@@ -2210,4 +2219,4 @@ function bySecondArg(_item, index) {
|
|
|
2210
2219
|
function byFirstArg(name) {
|
|
2211
2220
|
return name;
|
|
2212
2221
|
}
|
|
2213
|
-
export {
|
|
2222
|
+
export { _attrs as $, PLACEHOLDER_DISMISS_REGISTER_ID as $t, _attr_input_value_attribute_default as A, Returns as An, _const as At, _controllable_textarea as B, Load as Bn, _let_change as Bt, _attr_input_checked as C, setClassAPIRenderer as Cn, init as Ct, _attr_input_checked_default as D, LocalClosures as Dn, withLazy as Dt, _attr_input_checkedValue_script as E, Lazy as En, readyFailed as Et, _attr_select_value_default as F, BranchRenders as Fn, _hoist as Ft, _attr_class_item as G, PlaceholderBranch as Gn, _var as Gt, controllableSpreadHelpers as H, PendingEffectScopes as Hn, _return as Ht, _attr_select_value_script as I, ClosestBranch as In, _hoist_resume as It, _attr_content as J, attrTag as Jn, destroyBranch as Jt, _attr_class_items as K, StartNode as Kn, _var_change as Kt, _controllable_input as L, EndNode as Ln, _id as Lt, _attr_input_value_dynamic_default as M, Pending as Mn, _for_closure as Mt, _attr_input_value_script as N, Scope as Nn, _for_selector as Nt, _attr_input_checked_script as O, Owner as On, _closure as Ot, _attr_select_value as P, AwaitCounter as Pn, _global_read as Pt, _attr_style_items as Q, DYNAMIC_TAG_SCRIPT_REGISTER_ID as Qt, _controllable_open as R, Gen$1 as Rn, _if_closure as Rt, _attr_details_or_dialog_open_script as S, _call as Sn, getRegisteredWithScope as St, _attr_input_checkedValue_default as T, Clone as Tn, ready as Tt, _attr as U, PendingEffects as Un, _return_change as Ut, controllableScripts as V, ParentBranch as Vn, _or as Vt, _attr_class as W, PendingRenders as Wn, _script as Wt, _attr_style as X, removeAndDestroyBranch as Xt, _attr_nonce as Y, attrTags as Yn, insertBranchBefore as Yt, _attr_style_item as Z, syncGen as Zt, renderCatch as _, forTo as _n, setupBranch as _t, _for_in as a, installBranchRenders as an, _lifecycle as at, _attr_details_or_dialog_open as b, _assert_hoist as bn, _resumed as bt, _for_to as c, queueAsyncRender as cn, _text as ct, _for_until_unkeyed as d, rendering as dn, _content as dt, _on as en, _attrs_content as et, _if as f, run as fn, _content_closures as ft, installDynamicTagVar as g, forOf as gn, createBranch as gt, dynamicTagScript as h, forIn as hn, createAndSetupBranch as ht, _dynamic_tag_content as i, createBranchRenders as in, _html as it, _attr_input_value_default as j, Setup as jn, _el_read as jt, _attr_input_value as k, Params as kn, _closure_get as kt, _for_to_unkeyed as l, queueEffect as ln, _text_content as lt, _try as m, runId as mn, _return_setup as mt, _await_promise as n, $signalReset as nn, _attrs_partial_content as nt, _for_of as o, installCatch as on, _style_rule_item as ot, _show as p, runEffects as pn, _content_resume as pt, _attr_class_names as q, TagVariable as qn, _assert_init as qt, _dynamic_tag as r, onAbort as rn, _attrs_script as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_shell as st, _await_content as t, $signal as tn, _attrs_partial as tt, _for_until as u, queueRender as un, _to_text as ut, runPendingEffects as v, forUntil as vn, _dynamic_tag_var_resume as vt, _attr_input_checkedValue as w, withBranches as wn, initEmbedded as wt, _attr_details_or_dialog_open_default as x, _hoist_read_error as xn, _var_resume as xt, startAwait as y, _assert_class_toggles as yn, _el as yt, _controllable_select as z, Global as zn, _let as zt };
|