marko 6.4.5 → 6.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cheatsheet.md +2 -1
- package/dist/common/errors.d.ts +3 -1
- package/dist/common/helpers.d.ts +7 -7
- package/dist/debug/dom/catch.feat.js +4 -4
- package/dist/debug/dom/catch.feat.mjs +4 -4
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +5 -5
- package/dist/debug/dom/controllable.feat.mjs +5 -5
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
- 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-BeY1nGUb.mjs → dom-CFCBDift.mjs} +133 -135
- package/dist/debug/{dom-CUxvM4i9.js → dom-D8znnhpf.js} +148 -150
- package/dist/debug/dom.js +21 -22
- package/dist/debug/dom.mjs +22 -22
- package/dist/debug/html.js +736 -664
- package/dist/debug/html.mjs +736 -665
- package/dist/dom/catch.feat.js +5 -5
- package/dist/dom/catch.feat.mjs +4 -4
- package/dist/dom/control-flow.d.ts +3 -3
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.d.ts +4 -4
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +2 -2
- package/dist/dom/dom.d.ts +5 -5
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +2 -2
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/renderer.d.ts +1 -3
- package/dist/dom/resume.d.ts +2 -3
- package/dist/dom/signals.d.ts +6 -8
- package/dist/{dom-Diu8MpmL.js → dom-Bpkm72vV.js} +157 -166
- package/dist/{dom-DefWmvQB.mjs → dom-CVAevsbz.mjs} +103 -107
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +37 -37
- package/dist/dom.mjs +22 -22
- package/dist/html/assets.d.ts +2 -2
- package/dist/html/compat.d.ts +2 -1
- package/dist/html/control-flow.d.ts +20 -0
- package/dist/html/inlined-runtimes.d.ts +2 -2
- package/dist/html/inlined-runtimes.debug.d.ts +2 -2
- package/dist/html/serializer.d.ts +63 -16
- package/dist/html/template.d.ts +1 -1
- package/dist/html/writer.d.ts +47 -35
- package/dist/html.d.ts +3 -2
- package/dist/html.js +531 -484
- package/dist/html.mjs +531 -484
- package/dist/translator/core/for.d.ts +0 -4
- package/dist/translator/core/return.d.ts +0 -3
- package/dist/translator/core/style.d.ts +2 -2
- package/dist/translator/index.js +8093 -8021
- package/dist/translator/util/analyze-errors.d.ts +2 -1
- package/dist/translator/util/assert.d.ts +15 -1
- package/dist/translator/util/bindings.d.ts +24 -12
- package/dist/translator/util/body-to-text.d.ts +9 -0
- package/dist/translator/util/branch-tag.d.ts +10 -3
- package/dist/translator/util/build-string-expression.d.ts +4 -0
- package/dist/translator/util/content-derives.d.ts +7 -0
- package/dist/translator/util/cyclic-memo.d.ts +6 -2
- package/dist/translator/util/entry-builder.d.ts +6 -3
- package/dist/translator/util/finalize-references.d.ts +6 -3
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +4 -2
- package/dist/translator/util/get-root.d.ts +3 -3
- package/dist/translator/util/get-tag-name.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +14 -9
- package/dist/translator/util/module-read.d.ts +0 -3
- package/dist/translator/util/module-registrations.d.ts +44 -0
- package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +7 -2
- package/dist/translator/util/params-tree.d.ts +18 -0
- package/dist/translator/util/reasons.d.ts +13 -8
- package/dist/translator/util/references.d.ts +23 -27
- package/dist/translator/util/runtime.d.ts +0 -12
- package/dist/translator/util/scope-accessor.d.ts +0 -1
- package/dist/translator/util/scope-read.d.ts +3 -0
- package/dist/translator/util/section-renderer.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +21 -21
- package/dist/translator/util/setup-work.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +16 -14
- package/dist/translator/util/simplify-fn.d.ts +1 -0
- package/dist/translator/util/slots.d.ts +4 -4
- package/dist/translator/util/solve-reasons.d.ts +1 -3
- package/dist/translator/util/sources.d.ts +2 -1
- package/dist/translator/util/state.d.ts +4 -2
- package/dist/translator/util/statement-tag.d.ts +2 -0
- package/dist/translator/util/static-text.d.ts +2 -1
- package/dist/translator/util/structure.d.ts +0 -10
- package/dist/translator/util/tag-facts.d.ts +8 -1
- package/dist/translator/util/tag-import.d.ts +20 -0
- package/dist/translator/util/tag-name-type.d.ts +9 -2
- package/dist/translator/util/to-only-or-block.d.ts +3 -0
- package/dist/translator/util/to-property-name.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +7 -5
- package/dist/translator/util/translate-var.d.ts +2 -0
- package/dist/translator/util/traverse.d.ts +1 -2
- package/dist/translator/util/visitors.d.ts +4 -1
- package/dist/translator/util/with-previous-location.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -2
- package/dist/translator/util/writer.d.ts +1 -2
- package/dist/translator/visitors/export-declaration.d.ts +2 -3
- package/dist/translator/visitors/function.d.ts +0 -35
- package/dist/translator/visitors/import-declaration.d.ts +1 -15
- package/dist/translator/visitors/placeholder.d.ts +2 -1
- package/dist/translator/visitors/program/html.d.ts +0 -1
- package/dist/translator/visitors/program/index.d.ts +4 -5
- package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
- package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
- package/package.json +4 -4
- package/dist/translator/util/binding-has-prop.d.ts +0 -8
- package/dist/translator/util/binding-prop-tree.d.ts +0 -18
- package/dist/translator/util/body-to-text-literal.d.ts +0 -9
- package/dist/translator/util/import-reference.d.ts +0 -3
- package/dist/translator/util/normalize-string-expression.d.ts +0 -4
- package/dist/translator/util/plugin-hooks.d.ts +0 -4
- package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
- package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
- package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
- package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
package/dist/debug/html.mjs
CHANGED
|
@@ -38,7 +38,7 @@ const Embed = "embed";
|
|
|
38
38
|
const Lazy = "lazy";
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/common/helpers.ts
|
|
41
|
-
const
|
|
41
|
+
const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
42
42
|
const knownWrongAttrs = {
|
|
43
43
|
className: "class",
|
|
44
44
|
classList: "class",
|
|
@@ -76,11 +76,11 @@ function getWrongAttrSuggestion(name) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function stringifyClassEntry(name, value) {
|
|
80
80
|
return value ? name : "";
|
|
81
81
|
}
|
|
82
82
|
const warnedStyleKeys = /* @__PURE__ */ new Set();
|
|
83
|
-
function
|
|
83
|
+
function stringifyStyleEntry(name, value) {
|
|
84
84
|
if (/[A-Z]/.test(name) && !name.includes("-") && !warnedStyleKeys.has(name)) {
|
|
85
85
|
warnedStyleKeys.add(name);
|
|
86
86
|
console.warn(`\`${name}\` is not a CSS property name; \`style\` object keys are written verbatim, so it renders as invalid CSS. Use \`${name.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^ms-/, "-ms-")}\`.`);
|
|
@@ -127,17 +127,17 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
|
|
|
127
127
|
function isEventHandler(name) {
|
|
128
128
|
return /^on[A-Z-]/.test(name);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function getEventType(name) {
|
|
131
131
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
132
132
|
}
|
|
133
133
|
function hasKeys(obj) {
|
|
134
134
|
for (const _ in obj) return true;
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function isNullishOrFalse(value) {
|
|
138
138
|
return value == null || value === false;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function isNotNullishOrFalse(value) {
|
|
141
141
|
return value != null && value !== false;
|
|
142
142
|
}
|
|
143
143
|
function isPromise(value) {
|
|
@@ -156,9 +156,9 @@ function normalizeDynamicRenderer(value) {
|
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/common/errors.ts
|
|
159
|
-
const
|
|
159
|
+
const lowercaseOnAttrReg = /^on[a-z]/;
|
|
160
160
|
function assertValidAttrValue(name, value) {
|
|
161
|
-
if (value && typeof value !== "string" &&
|
|
161
|
+
if (value && typeof value !== "string" && lowercaseOnAttrReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
|
|
162
162
|
if (typeof value === "function") throw new Error(`The \`${name}\` attribute cannot be a function.${/Change$/.test(name) ? " A change handler is only used when its matching controllable attribute combination applies." : ""}`);
|
|
163
163
|
const unrenderable = describeUnrenderable(value);
|
|
164
164
|
if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
|
|
@@ -197,7 +197,7 @@ function describeUnrenderable(value) {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
function assertValidLoopKey(key, seenKeys) {
|
|
200
|
-
if (typeof key !== "string" && typeof key !== "number") throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null ?
|
|
200
|
+
if (typeof key !== "string" && typeof key !== "number" || key !== key) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null || key !== key ? key : `type "${typeof key}"`}.`);
|
|
201
201
|
if (seenKeys) {
|
|
202
202
|
if (seenKeys.has(key)) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a unique value for each item, but \`${key}\` was used more than once.`);
|
|
203
203
|
seenKeys.add(key);
|
|
@@ -206,7 +206,7 @@ function assertValidLoopKey(key, seenKeys) {
|
|
|
206
206
|
function assertValidList(value) {
|
|
207
207
|
if (value && typeof value[Symbol.iterator] !== "function") throw new Error(`A \`<for>\` tag's \`of\` attribute must be an iterable, such as an array, but received ${describeForValue(value)}.`);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function assertOptionalRangeNumber(name, value) {
|
|
210
210
|
if (value && (typeof value !== "number" || !isFinite(value))) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
|
|
211
211
|
}
|
|
212
212
|
function assertValidRangeBound(name, value) {
|
|
@@ -216,7 +216,7 @@ function describeForValue(value) {
|
|
|
216
216
|
return typeof value === "number" || typeof value === "bigint" ? `\`${value}\`` : value === null ? "null" : `type "${typeof value}"`;
|
|
217
217
|
}
|
|
218
218
|
function assertValidAttrName(name) {
|
|
219
|
-
if (
|
|
219
|
+
if (invalidNativeAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
|
|
220
220
|
const suggestion = getWrongAttrSuggestion(name);
|
|
221
221
|
if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
|
|
222
222
|
}
|
|
@@ -226,6 +226,9 @@ function _el_read_error() {
|
|
|
226
226
|
function _hoist_read_error() {
|
|
227
227
|
throw new Error("Hoisted values can only be read in scripts and event handlers.");
|
|
228
228
|
}
|
|
229
|
+
function _signal_read_error() {
|
|
230
|
+
throw new Error("Cannot use $signal in a server render.");
|
|
231
|
+
}
|
|
229
232
|
function _assert_hoist(value) {
|
|
230
233
|
if (value !== void 0 && typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
|
|
231
234
|
}
|
|
@@ -276,34 +279,6 @@ const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
|
|
|
276
279
|
const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
|
|
277
280
|
const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
|
|
278
281
|
//#endregion
|
|
279
|
-
//#region src/common/for.ts
|
|
280
|
-
function forIn(obj, cb) {
|
|
281
|
-
for (const key in obj) cb(key, obj[key]);
|
|
282
|
-
}
|
|
283
|
-
function forOf(list, cb) {
|
|
284
|
-
assertValidList(list);
|
|
285
|
-
if (list) {
|
|
286
|
-
let i = 0;
|
|
287
|
-
for (const item of list) cb(item, i++);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
function forTo(to, from, step, cb) {
|
|
291
|
-
assertValidRangeBound("to", to);
|
|
292
|
-
assertValidRangeStart("from", from);
|
|
293
|
-
assertValidRangeStart("step", step);
|
|
294
|
-
const start = from || 0;
|
|
295
|
-
const delta = step || 1;
|
|
296
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
297
|
-
}
|
|
298
|
-
function forUntil(until, from, step, cb) {
|
|
299
|
-
assertValidRangeBound("until", until);
|
|
300
|
-
assertValidRangeStart("from", from);
|
|
301
|
-
assertValidRangeStart("step", step);
|
|
302
|
-
const start = from || 0;
|
|
303
|
-
const delta = step || 1;
|
|
304
|
-
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
305
|
-
}
|
|
306
|
-
//#endregion
|
|
307
282
|
//#region src/common/opt.ts
|
|
308
283
|
function reduce(opt, cb, acc) {
|
|
309
284
|
if (opt) {
|
|
@@ -579,15 +554,57 @@ var State$1 = class {
|
|
|
579
554
|
buf = [];
|
|
580
555
|
strs = /* @__PURE__ */ new Map();
|
|
581
556
|
refs = /* @__PURE__ */ new WeakMap();
|
|
582
|
-
|
|
557
|
+
deferredRefs = /* @__PURE__ */ new Set();
|
|
583
558
|
boundary;
|
|
584
559
|
channel = void 0;
|
|
585
560
|
channelDeps = null;
|
|
586
|
-
|
|
561
|
+
queuedCalls = [];
|
|
562
|
+
queuedReadyCalls = [];
|
|
563
|
+
scopeRef(scope, scopeId) {
|
|
564
|
+
return this.refs.get(scope) || newScopeReference(this, scope, scopeId);
|
|
565
|
+
}
|
|
566
|
+
writeScopeProps(props, ref) {
|
|
567
|
+
return writeObjectProps(this, props, ref);
|
|
568
|
+
}
|
|
569
|
+
scopesCursor(scopeId) {
|
|
570
|
+
return scopeId + ",";
|
|
571
|
+
}
|
|
572
|
+
writeTrailing(scopesIndex) {
|
|
573
|
+
const { buf } = this;
|
|
574
|
+
if (~scopesIndex) {
|
|
575
|
+
buf[scopesIndex] = "_([" + buf[scopesIndex];
|
|
576
|
+
buf.push("])");
|
|
577
|
+
}
|
|
578
|
+
writeDeferred(this);
|
|
579
|
+
return ",0)";
|
|
580
|
+
}
|
|
581
|
+
wrapPayload(result, extras) {
|
|
582
|
+
const arrow = this.wroteUndefined ? "(_,$)=>" : "_=>";
|
|
583
|
+
this.wroteUndefined = false;
|
|
584
|
+
return extras ? arrow + result : arrow + "[" + result + "]";
|
|
585
|
+
}
|
|
586
|
+
writeScopedRegistration(val, parent, accessor, registered) {
|
|
587
|
+
const ref = new Reference(parent, accessor, this.flushId, this.buf.length);
|
|
588
|
+
ref.channel = this.channel;
|
|
589
|
+
this.refs.set(val, ref);
|
|
590
|
+
ref.debug = DEBUG.get(val);
|
|
591
|
+
const scope = registered.scope;
|
|
592
|
+
const scopeId = scope[K_SCOPE_ID];
|
|
593
|
+
trackScope(this, scope, scopeId);
|
|
594
|
+
const locals = registered.locals?.(this.boundary.state.scope);
|
|
595
|
+
if (locals) {
|
|
596
|
+
this.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
597
|
+
for (const local of locals) {
|
|
598
|
+
this.buf.push(",");
|
|
599
|
+
writePlainObject(this, local, newArgReference(this, ref, local));
|
|
600
|
+
}
|
|
601
|
+
} else this.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
602
|
+
this.buf.push(")");
|
|
603
|
+
}
|
|
587
604
|
};
|
|
588
605
|
var Reference = class {
|
|
589
606
|
assignments = null;
|
|
590
|
-
|
|
607
|
+
deferredMembers = null;
|
|
591
608
|
scopeId = void 0;
|
|
592
609
|
channel = void 0;
|
|
593
610
|
parent;
|
|
@@ -623,109 +640,86 @@ function setDebugSlotName(obj, accessor, name) {
|
|
|
623
640
|
slots: { [accessor]: name }
|
|
624
641
|
});
|
|
625
642
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
this.#state.channel = channel;
|
|
638
|
-
return writeScopesRoot(this.#state, flushes);
|
|
639
|
-
} catch (err) {
|
|
640
|
-
abortRender(boundary, err);
|
|
641
|
-
return "";
|
|
642
|
-
} finally {
|
|
643
|
-
this.#state.flushId++;
|
|
644
|
-
this.#state.buf = [];
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
written(val) {
|
|
648
|
-
return this.#state.refs.has(val);
|
|
649
|
-
}
|
|
650
|
-
takeChannelDeps() {
|
|
651
|
-
const deps = this.#state.channelDeps;
|
|
652
|
-
this.#state.channelDeps = null;
|
|
653
|
-
return deps;
|
|
654
|
-
}
|
|
655
|
-
writeCall(value, object, property, channel) {
|
|
656
|
-
this.#state.mutated.push({
|
|
657
|
-
value,
|
|
658
|
-
object,
|
|
659
|
-
property,
|
|
660
|
-
channel
|
|
661
|
-
});
|
|
643
|
+
function stringifyScopes(state, flushes, boundary, channel) {
|
|
644
|
+
try {
|
|
645
|
+
state.boundary = boundary;
|
|
646
|
+
state.channel = channel;
|
|
647
|
+
return writeScopesRoot(state, flushes);
|
|
648
|
+
} catch (err) {
|
|
649
|
+
abortRender(boundary, err);
|
|
650
|
+
return "";
|
|
651
|
+
} finally {
|
|
652
|
+
state.flushId++;
|
|
653
|
+
state.buf = [];
|
|
662
654
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
655
|
+
}
|
|
656
|
+
function pendingReadyChannel(state) {
|
|
657
|
+
const calls = state.queuedReadyCalls;
|
|
658
|
+
return calls.length ? calls[0].channel : void 0;
|
|
659
|
+
}
|
|
660
|
+
function takeChannelDeps(state) {
|
|
661
|
+
const deps = state.channelDeps;
|
|
662
|
+
state.channelDeps = null;
|
|
663
|
+
return deps;
|
|
664
|
+
}
|
|
665
|
+
function queueCall(state, value, object, method, channel) {
|
|
666
|
+
(channel?.readyId ? state.queuedReadyCalls : state.queuedCalls).push({
|
|
667
|
+
method,
|
|
668
|
+
value,
|
|
669
|
+
object,
|
|
670
|
+
channel,
|
|
671
|
+
valueId: null
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
function dropQueuedCall(state, value, object, method, channel) {
|
|
675
|
+
const queuedCalls = channel?.readyId ? state.queuedReadyCalls : state.queuedCalls;
|
|
676
|
+
for (let i = 0; i < queuedCalls.length; i++) {
|
|
677
|
+
const call = queuedCalls[i];
|
|
678
|
+
if (call.value === value && call.object === object && call.method === method) {
|
|
679
|
+
queuedCalls.splice(i, 1);
|
|
680
|
+
return true;
|
|
671
681
|
}
|
|
672
|
-
return false;
|
|
673
682
|
}
|
|
674
|
-
|
|
675
|
-
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
function register(id, val, scope, locals, access = "_._" + toAccess(toObjectKey(id))) {
|
|
676
686
|
REGISTRY.set(val, {
|
|
677
687
|
id,
|
|
678
688
|
scope,
|
|
679
689
|
locals,
|
|
680
|
-
access
|
|
690
|
+
access
|
|
681
691
|
});
|
|
682
692
|
return val;
|
|
683
693
|
}
|
|
684
|
-
function getRegistered(val) {
|
|
685
|
-
const registered = REGISTRY.get(val);
|
|
686
|
-
if (registered) return {
|
|
687
|
-
id: registered.id,
|
|
688
|
-
scope: registered.scope
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
694
|
function writeScopesRoot(state, flushes) {
|
|
692
695
|
const { buf } = state;
|
|
693
696
|
let nextSlotId = -1;
|
|
694
|
-
let
|
|
697
|
+
let scopesIndex = -1;
|
|
695
698
|
for (const flush of flushes) {
|
|
696
699
|
const scopeId = flush[0];
|
|
697
700
|
const scope = flush[1];
|
|
698
|
-
const ref = state.
|
|
701
|
+
const ref = state.scopeRef(scope, scopeId);
|
|
699
702
|
const openIndex = buf.push("") - 1;
|
|
700
|
-
if (
|
|
701
|
-
buf[openIndex] = nextSlotId === -1 ? scopeId + "
|
|
702
|
-
if (
|
|
703
|
+
if (state.writeScopeProps(flush[2], ref)) {
|
|
704
|
+
buf[openIndex] = nextSlotId === -1 ? state.scopesCursor(scopeId) + "{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
|
|
705
|
+
if (scopesIndex === -1) scopesIndex = openIndex;
|
|
703
706
|
nextSlotId = scopeId + 1;
|
|
704
707
|
buf.push("}");
|
|
705
708
|
} else buf.pop();
|
|
706
709
|
}
|
|
707
710
|
let extras = "";
|
|
708
|
-
if (state.
|
|
709
|
-
extras = ",0)";
|
|
710
|
-
if (fillIndex !== -1) {
|
|
711
|
-
buf[fillIndex] = "_([" + buf[fillIndex];
|
|
712
|
-
buf.push("])");
|
|
713
|
-
}
|
|
714
|
-
writeAssigned(state);
|
|
715
|
-
}
|
|
711
|
+
if (state.deferredRefs.size || hasChannelCalls(state)) extras = state.writeTrailing(scopesIndex);
|
|
716
712
|
let result = extras && "(";
|
|
717
713
|
for (const chunk of buf) result += chunk;
|
|
718
714
|
result += extras;
|
|
719
715
|
if (!result) return "";
|
|
720
|
-
|
|
721
|
-
state.wroteUndefined = false;
|
|
722
|
-
return extras ? arrow + result : arrow + "[" + result + "]";
|
|
716
|
+
return state.wrapPayload(result, extras);
|
|
723
717
|
}
|
|
724
|
-
function
|
|
718
|
+
function writeDeferred(state) {
|
|
725
719
|
let sep = state.buf.length ? "," : "";
|
|
726
|
-
if (state.
|
|
727
|
-
const pending = state.
|
|
728
|
-
state.
|
|
720
|
+
if (state.deferredRefs.size) {
|
|
721
|
+
const pending = state.deferredRefs;
|
|
722
|
+
state.deferredRefs = /* @__PURE__ */ new Set();
|
|
729
723
|
let buf = "";
|
|
730
724
|
let hasCalls = false;
|
|
731
725
|
for (const ref of pending) {
|
|
@@ -734,77 +728,88 @@ function writeAssigned(state) {
|
|
|
734
728
|
ref.assignments = null;
|
|
735
729
|
sep = ",";
|
|
736
730
|
}
|
|
737
|
-
hasCalls ||= ref.
|
|
731
|
+
hasCalls ||= ref.deferredMembers !== null;
|
|
738
732
|
}
|
|
739
733
|
if (buf) state.buf.push(buf);
|
|
740
734
|
if (hasCalls) for (const ref of pending) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
if (a) state.buf.push(",");
|
|
746
|
-
writeCallArg(state, args[a]);
|
|
747
|
-
}
|
|
748
|
-
state.buf.push(")");
|
|
735
|
+
const members = ref.deferredMembers;
|
|
736
|
+
if (members) {
|
|
737
|
+
writeDeferredMembers(state, ref.id, members);
|
|
738
|
+
ref.deferredMembers = null;
|
|
749
739
|
}
|
|
750
|
-
ref.calls = null;
|
|
751
740
|
}
|
|
752
741
|
}
|
|
753
|
-
|
|
742
|
+
const readyId = state.channel?.readyId;
|
|
743
|
+
let calls = state.queuedCalls;
|
|
744
|
+
if (readyId) {
|
|
745
|
+
calls = [];
|
|
754
746
|
const remaining = [];
|
|
755
|
-
for (const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
747
|
+
for (const call of state.queuedReadyCalls) (call.channel.readyId === readyId ? calls : remaining).push(call);
|
|
748
|
+
state.queuedReadyCalls = remaining;
|
|
749
|
+
} else if (calls.length) state.queuedCalls = [];
|
|
750
|
+
for (const call of calls) {
|
|
751
|
+
const objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
752
|
+
if (writeProp(state, call.object, null, "")) {
|
|
753
|
+
const objectRef = state.refs.get(call.object);
|
|
754
|
+
if (!objectRef.id && !isAncestorChannelRef(state, objectRef)) {
|
|
755
|
+
objectRef.id = nextRefAccess(state);
|
|
756
|
+
state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex];
|
|
757
|
+
state.buf.push(")");
|
|
758
|
+
} else if (objectRef.id && state.buf[objectStartIndex] !== objectRef.id) {
|
|
759
|
+
state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex];
|
|
760
|
+
state.buf.push(")");
|
|
759
761
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
} else state.buf.push("void 0");
|
|
783
|
-
state.buf.push(")");
|
|
784
|
-
}
|
|
785
|
-
state.mutated = remaining;
|
|
762
|
+
} else state.buf.push("void 0");
|
|
763
|
+
state.buf.push("." + call.method + "(");
|
|
764
|
+
if (call.value !== void 0) writeCallArg(state, call.value, call.valueId);
|
|
765
|
+
state.buf.push(")");
|
|
766
|
+
}
|
|
767
|
+
if (state.deferredRefs.size) writeDeferred(state);
|
|
768
|
+
}
|
|
769
|
+
function writeDeferredMembers(state, id, { collection, first, rest }) {
|
|
770
|
+
if (collection instanceof Map) {
|
|
771
|
+
writeDeferredEntry(state, id, first);
|
|
772
|
+
for (const entry of rest) writeDeferredEntry(state, id, entry);
|
|
773
|
+
} else {
|
|
774
|
+
writeDeferredMember(state, id, first);
|
|
775
|
+
for (const member of rest) writeDeferredMember(state, id, member);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
function writeDeferredEntry(state, id, [key, value]) {
|
|
779
|
+
state.buf.push("," + id + ".set(");
|
|
780
|
+
if (key !== void 0 || value !== void 0) writeCallArg(state, key, null);
|
|
781
|
+
if (value !== void 0) {
|
|
782
|
+
state.buf.push(",");
|
|
783
|
+
writeCallArg(state, value, null);
|
|
786
784
|
}
|
|
787
|
-
|
|
785
|
+
state.buf.push(")");
|
|
786
|
+
}
|
|
787
|
+
function writeDeferredMember(state, id, member) {
|
|
788
|
+
state.buf.push("," + id + ".add(");
|
|
789
|
+
if (member !== void 0) writeCallArg(state, member, null);
|
|
790
|
+
state.buf.push(")");
|
|
788
791
|
}
|
|
789
|
-
function writeCallArg(state, val) {
|
|
792
|
+
function writeCallArg(state, val, valueId) {
|
|
793
|
+
const startIndex = state.buf.length;
|
|
790
794
|
if (val === void 0) {
|
|
791
795
|
state.wroteUndefined = true;
|
|
792
796
|
state.buf.push("$");
|
|
793
797
|
} else if (writeProp(state, val, null, "")) {
|
|
794
|
-
const ref = state.
|
|
795
|
-
if (ref
|
|
798
|
+
const ref = typeof val === "string" ? state.strs.get(val) : state.refs.get(val);
|
|
799
|
+
if (ref && !ref.id && ref.scopeId === void 0 && !isAncestorChannelRef(state, ref)) {
|
|
800
|
+
ref.id = valueId || nextRefAccess(state);
|
|
801
|
+
state.buf[startIndex] = ref.id + "=" + state.buf[startIndex];
|
|
802
|
+
}
|
|
796
803
|
} else state.buf.push("void 0");
|
|
797
804
|
}
|
|
798
|
-
function
|
|
799
|
-
return
|
|
805
|
+
function hasChannelCalls(state) {
|
|
806
|
+
return hasMatchingCalls(state, state.channel?.readyId);
|
|
800
807
|
}
|
|
801
|
-
function
|
|
802
|
-
|
|
808
|
+
function hasMatchingCalls(state, readyId) {
|
|
809
|
+
if (!readyId) return state.queuedCalls.length > 0;
|
|
810
|
+
for (const call of state.queuedReadyCalls) if (call.channel.readyId === readyId) return true;
|
|
803
811
|
return false;
|
|
804
812
|
}
|
|
805
|
-
function mutationMatchesReadyId(mutation, readyId) {
|
|
806
|
-
return mutation.channel?.readyId ? mutation.channel.readyId === readyId : !readyId;
|
|
807
|
-
}
|
|
808
813
|
function writeProp(state, val, parent, accessor) {
|
|
809
814
|
switch (typeof val) {
|
|
810
815
|
case "string": return writeString(state, val, parent, accessor);
|
|
@@ -827,8 +832,8 @@ function writeReferenceOr(state, write, val, parent, accessor) {
|
|
|
827
832
|
return false;
|
|
828
833
|
}
|
|
829
834
|
if (parent && isCircular(parent, ref)) {
|
|
830
|
-
|
|
831
|
-
state.
|
|
835
|
+
ensureRefAccess(state, ref);
|
|
836
|
+
state.deferredRefs.add(ref);
|
|
832
837
|
addAssignment(ref, accessId(state, parent) + toAccess(accessor));
|
|
833
838
|
return false;
|
|
834
839
|
}
|
|
@@ -862,23 +867,8 @@ function quoteRegisterId(id) {
|
|
|
862
867
|
}
|
|
863
868
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
864
869
|
const { scope } = registered;
|
|
865
|
-
if (scope)
|
|
866
|
-
|
|
867
|
-
ref.channel = state.channel;
|
|
868
|
-
state.refs.set(val, ref);
|
|
869
|
-
ref.debug = DEBUG.get(val);
|
|
870
|
-
const scopeId = scope[K_SCOPE_ID];
|
|
871
|
-
trackScope(state, scope, scopeId);
|
|
872
|
-
const locals = registered.locals?.(state.boundary.state.scope);
|
|
873
|
-
if (locals) {
|
|
874
|
-
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
875
|
-
for (const local of locals) {
|
|
876
|
-
state.buf.push(",");
|
|
877
|
-
writePlainObject(state, local, newArgReference(state, ref, local));
|
|
878
|
-
}
|
|
879
|
-
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
880
|
-
state.buf.push(")");
|
|
881
|
-
} else state.buf.push(registered.access);
|
|
870
|
+
if (scope) state.writeScopedRegistration(val, parent, accessor, registered);
|
|
871
|
+
else state.buf.push(registered.access);
|
|
882
872
|
return true;
|
|
883
873
|
}
|
|
884
874
|
const STRING_DEDUP_LENGTH = 12;
|
|
@@ -1072,7 +1062,7 @@ function writePromise(state, val, ref) {
|
|
|
1072
1062
|
const pId = nextRefAccess(state);
|
|
1073
1063
|
const handle = newAsyncHandle(state, ref, pId);
|
|
1074
1064
|
state.buf.push("(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()");
|
|
1075
|
-
val.then((v) =>
|
|
1065
|
+
val.then((v) => queueAsyncCall(state, boundary, handle, "f", v, channel, pId), (v) => queueAsyncCall(state, boundary, handle, "r", v, channel, pId));
|
|
1076
1066
|
boundary.startAsync();
|
|
1077
1067
|
return true;
|
|
1078
1068
|
}
|
|
@@ -1091,14 +1081,18 @@ function writeMap(state, val, ref) {
|
|
|
1091
1081
|
const items = [];
|
|
1092
1082
|
let assignments;
|
|
1093
1083
|
let needsId;
|
|
1094
|
-
let deferring = false;
|
|
1095
1084
|
let i = 0;
|
|
1085
|
+
const entries = val.entries();
|
|
1096
1086
|
if (val.size < 25) {
|
|
1097
|
-
for (
|
|
1098
|
-
|
|
1099
|
-
if (
|
|
1100
|
-
|
|
1101
|
-
|
|
1087
|
+
for (const entry of entries) {
|
|
1088
|
+
let [itemKey, itemValue] = entry;
|
|
1089
|
+
if (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) {
|
|
1090
|
+
deferMembers(state, ref, val, entry, entries);
|
|
1091
|
+
if (!i) {
|
|
1092
|
+
state.buf.push("new Map");
|
|
1093
|
+
return true;
|
|
1094
|
+
}
|
|
1095
|
+
break;
|
|
1102
1096
|
}
|
|
1103
1097
|
if (itemKey === val) {
|
|
1104
1098
|
itemKey = void 0;
|
|
@@ -1108,16 +1102,20 @@ function writeMap(state, val, ref) {
|
|
|
1108
1102
|
itemValue = void 0;
|
|
1109
1103
|
(assignments ||= []).push("a[" + i + "][1]");
|
|
1110
1104
|
}
|
|
1111
|
-
needsId ||=
|
|
1105
|
+
needsId ||= isReusableMember(itemKey) || isReusableMember(itemValue);
|
|
1112
1106
|
i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
|
|
1113
1107
|
}
|
|
1114
1108
|
writeArrayArg(state, ref, items, assignments && "((m,a)=>(" + assignmentsToString(assignments, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
|
|
1115
1109
|
} else {
|
|
1116
|
-
for (
|
|
1117
|
-
|
|
1118
|
-
if (
|
|
1119
|
-
|
|
1120
|
-
|
|
1110
|
+
for (const entry of entries) {
|
|
1111
|
+
let [itemKey, itemValue] = entry;
|
|
1112
|
+
if (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) {
|
|
1113
|
+
deferMembers(state, ref, val, entry, entries);
|
|
1114
|
+
if (!i) {
|
|
1115
|
+
state.buf.push("new Map");
|
|
1116
|
+
return true;
|
|
1117
|
+
}
|
|
1118
|
+
break;
|
|
1121
1119
|
}
|
|
1122
1120
|
if (itemKey === val) {
|
|
1123
1121
|
itemKey = 0;
|
|
@@ -1127,7 +1125,7 @@ function writeMap(state, val, ref) {
|
|
|
1127
1125
|
itemValue = 0;
|
|
1128
1126
|
(assignments ||= []).push("a[" + (i + 1) + "]");
|
|
1129
1127
|
}
|
|
1130
|
-
needsId ||=
|
|
1128
|
+
needsId ||= isReusableMember(itemKey) || isReusableMember(itemValue);
|
|
1131
1129
|
i = items.push(itemKey, itemValue);
|
|
1132
1130
|
}
|
|
1133
1131
|
writeArrayArg(state, ref, items, assignments && "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignmentsToString(assignments, "new Map") + "))(", "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(", needsId);
|
|
@@ -1142,18 +1140,21 @@ function writeSet(state, val, ref) {
|
|
|
1142
1140
|
const items = [];
|
|
1143
1141
|
let assignments;
|
|
1144
1142
|
let needsId;
|
|
1145
|
-
let deferring = false;
|
|
1146
1143
|
let i = 0;
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
if (
|
|
1150
|
-
|
|
1151
|
-
|
|
1144
|
+
const members = val.values();
|
|
1145
|
+
for (let item of members) {
|
|
1146
|
+
if (item !== val && isAncestorMember(state, ref, item)) {
|
|
1147
|
+
deferMembers(state, ref, val, item, members);
|
|
1148
|
+
if (!i) {
|
|
1149
|
+
state.buf.push("new Set");
|
|
1150
|
+
return true;
|
|
1151
|
+
}
|
|
1152
|
+
break;
|
|
1152
1153
|
}
|
|
1153
1154
|
if (item === val) {
|
|
1154
1155
|
item = 0;
|
|
1155
1156
|
(assignments ||= []).push("i[" + i + "]");
|
|
1156
|
-
} else needsId ||=
|
|
1157
|
+
} else needsId ||= isReusableMember(item);
|
|
1157
1158
|
i = items.push(item);
|
|
1158
1159
|
}
|
|
1159
1160
|
writeArrayArg(state, ref, items, assignments && "((s,i)=>(" + assignmentsToString(assignments, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
|
|
@@ -1164,13 +1165,14 @@ function isAncestorMember(state, container, member) {
|
|
|
1164
1165
|
const ref = state.refs.get(member);
|
|
1165
1166
|
return ref !== void 0 && isCircular(container, ref);
|
|
1166
1167
|
}
|
|
1167
|
-
function
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1168
|
+
function deferMembers(state, ref, collection, first, rest) {
|
|
1169
|
+
ensureRefAccess(state, ref);
|
|
1170
|
+
ref.deferredMembers = {
|
|
1171
|
+
collection,
|
|
1172
|
+
first,
|
|
1173
|
+
rest
|
|
1174
|
+
};
|
|
1175
|
+
state.deferredRefs.add(ref);
|
|
1174
1176
|
}
|
|
1175
1177
|
function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
1176
1178
|
if (assignsPrefix || needsId) {
|
|
@@ -1186,7 +1188,7 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
1186
1188
|
function newArgReference(state, parent, val) {
|
|
1187
1189
|
for (const key in val) {
|
|
1188
1190
|
const member = val[key];
|
|
1189
|
-
if (
|
|
1191
|
+
if (isReusableMember(member) && !(typeof member === "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
1190
1192
|
const ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
1191
1193
|
state.buf.push(ref.id + "=");
|
|
1192
1194
|
return ref;
|
|
@@ -1194,7 +1196,7 @@ function newArgReference(state, parent, val) {
|
|
|
1194
1196
|
}
|
|
1195
1197
|
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
1196
1198
|
}
|
|
1197
|
-
function
|
|
1199
|
+
function isReusableMember(val) {
|
|
1198
1200
|
switch (typeof val) {
|
|
1199
1201
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
1200
1202
|
case "function":
|
|
@@ -1265,7 +1267,7 @@ function writeAggregateError(state, val, ref) {
|
|
|
1265
1267
|
if (inlined) {
|
|
1266
1268
|
const errorsRef = state.refs.get(val.errors);
|
|
1267
1269
|
if (errorsRef?.id) {
|
|
1268
|
-
state.
|
|
1270
|
+
state.deferredRefs.add(errorsRef);
|
|
1269
1271
|
addAssignment(errorsRef, accessId(state, ref) + toAccess("errors"));
|
|
1270
1272
|
}
|
|
1271
1273
|
}
|
|
@@ -1325,7 +1327,7 @@ function writeRequest(state, val, ref) {
|
|
|
1325
1327
|
}
|
|
1326
1328
|
const seenHeaders = state.refs.get(val.headers);
|
|
1327
1329
|
if (seenHeaders) {
|
|
1328
|
-
options += sep + "headers:" +
|
|
1330
|
+
options += sep + "headers:" + ensureRefAccess(state, seenHeaders);
|
|
1329
1331
|
sep = ",";
|
|
1330
1332
|
} else {
|
|
1331
1333
|
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
@@ -1375,7 +1377,7 @@ function writeResponse(state, val, ref) {
|
|
|
1375
1377
|
sep = ",";
|
|
1376
1378
|
}
|
|
1377
1379
|
const seenHeaders = state.refs.get(val.headers);
|
|
1378
|
-
if (seenHeaders) options += sep + "headers:" +
|
|
1380
|
+
if (seenHeaders) options += sep + "headers:" + ensureRefAccess(state, seenHeaders);
|
|
1379
1381
|
else {
|
|
1380
1382
|
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
1381
1383
|
const headers = stringEntriesToHeadersInit(val.headers);
|
|
@@ -1415,15 +1417,15 @@ function writeReadableStream(state, val, ref) {
|
|
|
1415
1417
|
const iterId = nextRefAccess(state);
|
|
1416
1418
|
const handle = newAsyncHandle(state, ref, iterId);
|
|
1417
1419
|
const onFulfilled = ({ value, done }) => {
|
|
1418
|
-
if (done)
|
|
1420
|
+
if (done) queueAsyncCall(state, boundary, handle, "r", value, channel);
|
|
1419
1421
|
else if (!boundary.aborted) {
|
|
1420
1422
|
reader.read().then(onFulfilled, onRejected);
|
|
1421
1423
|
boundary.startAsync();
|
|
1422
|
-
|
|
1424
|
+
queueAsyncCall(state, boundary, handle, "f", value, channel);
|
|
1423
1425
|
}
|
|
1424
1426
|
};
|
|
1425
1427
|
const onRejected = (reason) => {
|
|
1426
|
-
|
|
1428
|
+
queueAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1427
1429
|
};
|
|
1428
1430
|
state.buf.push("new ReadableStream({start(c){(async(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()]))=>{for(i of a)v=await i,i==l?c.close():c.enqueue(v)})(" + iterId + "={}).catch(e=>c.error(e))}})");
|
|
1429
1431
|
reader.read().then(onFulfilled, onRejected);
|
|
@@ -1444,7 +1446,7 @@ function writeGenerator(state, iter, ref) {
|
|
|
1444
1446
|
returnValue = value;
|
|
1445
1447
|
break;
|
|
1446
1448
|
}
|
|
1447
|
-
needsId ||=
|
|
1449
|
+
needsId ||= isReusableMember(value);
|
|
1448
1450
|
yields.push(value);
|
|
1449
1451
|
}
|
|
1450
1452
|
if (returnValue === void 0 && !yields.length) {
|
|
@@ -1464,9 +1466,9 @@ function writeGenerator(state, iter, ref) {
|
|
|
1464
1466
|
writeProp(state, returnValue, holder, "v");
|
|
1465
1467
|
} else if (returnValue !== void 0) {
|
|
1466
1468
|
state.buf.push(",");
|
|
1467
|
-
if (writeProp(state, returnValue, ref, "") &&
|
|
1469
|
+
if (writeProp(state, returnValue, ref, "") && isReusableMember(returnValue)) {
|
|
1468
1470
|
const retRef = typeof returnValue === "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1469
|
-
if (retRef)
|
|
1471
|
+
if (retRef) ensureRefAccess(state, retRef);
|
|
1470
1472
|
}
|
|
1471
1473
|
}
|
|
1472
1474
|
state.buf.push(")");
|
|
@@ -1481,15 +1483,15 @@ function writeAsyncGenerator(state, iter, ref) {
|
|
|
1481
1483
|
const iterId = nextRefAccess(state);
|
|
1482
1484
|
const handle = newAsyncHandle(state, ref, iterId);
|
|
1483
1485
|
const onFulfilled = ({ value, done }) => {
|
|
1484
|
-
if (done)
|
|
1486
|
+
if (done) queueAsyncCall(state, boundary, handle, "r", value, channel);
|
|
1485
1487
|
else if (!boundary.aborted) {
|
|
1486
1488
|
iter.next().then(onFulfilled, onRejected);
|
|
1487
1489
|
boundary.startAsync();
|
|
1488
|
-
|
|
1490
|
+
queueAsyncCall(state, boundary, handle, "f", value, channel);
|
|
1489
1491
|
}
|
|
1490
1492
|
};
|
|
1491
1493
|
const onRejected = (reason) => {
|
|
1492
|
-
|
|
1494
|
+
queueAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1493
1495
|
};
|
|
1494
1496
|
state.buf.push("(async function*(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()])){for(i of a)v=await i,i!=l&&(yield v);return v})(" + iterId + "={})");
|
|
1495
1497
|
iter.next().then(onFulfilled, onRejected);
|
|
@@ -1528,12 +1530,12 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1528
1530
|
}
|
|
1529
1531
|
return sep;
|
|
1530
1532
|
}
|
|
1531
|
-
function
|
|
1533
|
+
function queueAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1532
1534
|
if (boundary.aborted) return;
|
|
1533
|
-
state.
|
|
1535
|
+
(channel?.readyId ? state.queuedReadyCalls : state.queuedCalls).push({
|
|
1536
|
+
method,
|
|
1534
1537
|
value,
|
|
1535
1538
|
object: handle,
|
|
1536
|
-
property: method,
|
|
1537
1539
|
channel,
|
|
1538
1540
|
valueId
|
|
1539
1541
|
});
|
|
@@ -1727,9 +1729,9 @@ function writeRef(state, ref) {
|
|
|
1727
1729
|
ref.pos = state.buf.length;
|
|
1728
1730
|
ref.flushId = state.flushId;
|
|
1729
1731
|
state.buf.push(ref.path);
|
|
1730
|
-
} else state.buf.push(
|
|
1732
|
+
} else state.buf.push(ensureRefAccess(state, ref));
|
|
1731
1733
|
}
|
|
1732
|
-
function
|
|
1734
|
+
function ensureRefAccess(state, ref) {
|
|
1733
1735
|
if (ref.scopeId !== void 0) {
|
|
1734
1736
|
trackChannel(state, ref);
|
|
1735
1737
|
return "_(" + ref.scopeId + ")";
|
|
@@ -1738,13 +1740,13 @@ function ensureId(state, ref) {
|
|
|
1738
1740
|
trackChannel(state, ref);
|
|
1739
1741
|
return ref.id;
|
|
1740
1742
|
}
|
|
1741
|
-
return
|
|
1743
|
+
return claimRefAccess(state, ref);
|
|
1742
1744
|
}
|
|
1743
1745
|
function accessId(state, ref) {
|
|
1744
|
-
const id =
|
|
1746
|
+
const id = ensureRefAccess(state, ref);
|
|
1745
1747
|
return id === ref.id || ref.scopeId !== void 0 ? id : "(" + id + ")";
|
|
1746
1748
|
}
|
|
1747
|
-
function
|
|
1749
|
+
function claimRefAccess(state, ref) {
|
|
1748
1750
|
const { pos } = ref;
|
|
1749
1751
|
if (pos !== null && ref.flushId === state.flushId) {
|
|
1750
1752
|
ref.id = nextRefAccess(state);
|
|
@@ -1841,10 +1843,10 @@ function patchIteratorNext(proto) {
|
|
|
1841
1843
|
//#endregion
|
|
1842
1844
|
//#region src/html/attrs.ts
|
|
1843
1845
|
function _attr_class(value) {
|
|
1844
|
-
return stringAttr("class", toDelimitedString(value, " ",
|
|
1846
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
|
|
1845
1847
|
}
|
|
1846
1848
|
function _attr_style(value) {
|
|
1847
|
-
return stringAttr("style", toDelimitedString(value, ";",
|
|
1849
|
+
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleEntry));
|
|
1848
1850
|
}
|
|
1849
1851
|
function _attr_option_value(value) {
|
|
1850
1852
|
const valueAttr = _attr("value", value);
|
|
@@ -1892,7 +1894,7 @@ function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeT
|
|
|
1892
1894
|
}
|
|
1893
1895
|
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1894
1896
|
if (checkedChange) writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType);
|
|
1895
|
-
return
|
|
1897
|
+
return isNotNullishOrFalse(checked) ? " checked" : "";
|
|
1896
1898
|
}
|
|
1897
1899
|
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1898
1900
|
const valueAttr = _attr("value", value);
|
|
@@ -1911,7 +1913,7 @@ function getCheckedValueRef(checkedValue) {
|
|
|
1911
1913
|
}
|
|
1912
1914
|
}
|
|
1913
1915
|
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1914
|
-
const normalizedOpen =
|
|
1916
|
+
const normalizedOpen = isNotNullishOrFalse(open);
|
|
1915
1917
|
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType);
|
|
1916
1918
|
return normalizedOpen ? " open" : "";
|
|
1917
1919
|
}
|
|
@@ -1923,7 +1925,7 @@ function _style_html(decls) {
|
|
|
1923
1925
|
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1924
1926
|
}
|
|
1925
1927
|
function _attr(name, value) {
|
|
1926
|
-
return
|
|
1928
|
+
return isNullishOrFalse(value) ? "" : stringifyAttr(name, value);
|
|
1927
1929
|
}
|
|
1928
1930
|
function _attr_and(name, value, attr) {
|
|
1929
1931
|
return value ? attr : _attr(name, value);
|
|
@@ -1980,14 +1982,14 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1980
1982
|
break;
|
|
1981
1983
|
default:
|
|
1982
1984
|
if (name) assertValidAttrName(name);
|
|
1983
|
-
if (name && !(
|
|
1985
|
+
if (name && !(isNullishOrFalse(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
|
|
1984
1986
|
if (isEventHandler(name)) {
|
|
1985
1987
|
if (!events) {
|
|
1986
1988
|
events = {};
|
|
1987
1989
|
writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
|
|
1988
1990
|
}
|
|
1989
|
-
events[
|
|
1990
|
-
} else result +=
|
|
1991
|
+
events[getEventType(name)] = value;
|
|
1992
|
+
} else result += stringifyAttr(name, value);
|
|
1991
1993
|
}
|
|
1992
1994
|
}
|
|
1993
1995
|
}
|
|
@@ -2000,7 +2002,7 @@ function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
|
2000
2002
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
2001
2003
|
const partial = {};
|
|
2002
2004
|
for (const name in data) {
|
|
2003
|
-
const key = isEventHandler(name) ? `on-${
|
|
2005
|
+
const key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
|
|
2004
2006
|
if (!skip[key]) partial[key] = data[name];
|
|
2005
2007
|
}
|
|
2006
2008
|
assertExclusiveAttrs({
|
|
@@ -2034,7 +2036,7 @@ function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, s
|
|
|
2034
2036
|
function stringAttr(name, value) {
|
|
2035
2037
|
return value && " " + name + attrAssignment(value);
|
|
2036
2038
|
}
|
|
2037
|
-
function
|
|
2039
|
+
function stringifyAttr(name, value) {
|
|
2038
2040
|
assertValidAttrValue(name, value);
|
|
2039
2041
|
switch (typeof value) {
|
|
2040
2042
|
case "string": return " " + name + attrAssignment(value);
|
|
@@ -2069,18 +2071,7 @@ function normalizedValueMatches(a, b) {
|
|
|
2069
2071
|
return false;
|
|
2070
2072
|
}
|
|
2071
2073
|
function normalizeStrAttrValue(value) {
|
|
2072
|
-
return
|
|
2073
|
-
}
|
|
2074
|
-
//#endregion
|
|
2075
|
-
//#region src/html/for.ts
|
|
2076
|
-
function forOfBy(by, item, index) {
|
|
2077
|
-
return by ? typeof by === "string" ? item[by] : by(item, index) : index;
|
|
2078
|
-
}
|
|
2079
|
-
function forInBy(by, name, value) {
|
|
2080
|
-
return by ? by(name, value) : name;
|
|
2081
|
-
}
|
|
2082
|
-
function forStepBy(by, index) {
|
|
2083
|
-
return by ? by(index) : index;
|
|
2074
|
+
return isNotNullishOrFalse(value) && value !== true ? value + "" : "";
|
|
2084
2075
|
}
|
|
2085
2076
|
//#endregion
|
|
2086
2077
|
//#region src/html/inlined-runtimes.debug.ts
|
|
@@ -2098,7 +2089,6 @@ const WALKER_RUNTIME_CODE = `((runtimeId) => (self[runtimeId] ||= (
|
|
|
2098
2089
|
) =>
|
|
2099
2090
|
doc = (self[runtimeId][renderId] = {
|
|
2100
2091
|
i: prefix,
|
|
2101
|
-
d: doc,
|
|
2102
2092
|
l: lookup,
|
|
2103
2093
|
v: visits,
|
|
2104
2094
|
x() {},
|
|
@@ -2142,7 +2132,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
|
|
|
2142
2132
|
(placeholders[id] = placeholder).i++;
|
|
2143
2133
|
} else if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
|
|
2144
2134
|
nextSibling = node.nextSibling;
|
|
2145
|
-
onNextSibling = () => {
|
|
2135
|
+
onNextSibling = (_) => {
|
|
2146
2136
|
node.remove();
|
|
2147
2137
|
placeholderRoot || replace(id, node);
|
|
2148
2138
|
placeholder.c();
|
|
@@ -2175,7 +2165,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
|
|
|
2175
2165
|
// repurpose "op" for callbacks ...carefully
|
|
2176
2166
|
if ((op = runtime.j[id])) {
|
|
2177
2167
|
placeholderCb = placeholder.c;
|
|
2178
|
-
placeholder.c = () => placeholderCb() || op(runtime.r);
|
|
2168
|
+
placeholder.c = (_) => placeholderCb() || op(runtime.r);
|
|
2179
2169
|
}
|
|
2180
2170
|
}
|
|
2181
2171
|
};
|
|
@@ -2225,13 +2215,13 @@ function _peek_scope_id() {
|
|
|
2225
2215
|
return $chunk.boundary.state.scopeId;
|
|
2226
2216
|
}
|
|
2227
2217
|
const kPendingContexts = Symbol("Pending Contexts");
|
|
2228
|
-
function withContext(key, value, cb, cbValue) {
|
|
2218
|
+
function withContext(key, value, cb, cbValue, cbValue2) {
|
|
2229
2219
|
const ctx = $chunk.context ||= { [kPendingContexts]: 0 };
|
|
2230
2220
|
const prev = ctx[key];
|
|
2231
2221
|
ctx[kPendingContexts]++;
|
|
2232
2222
|
ctx[key] = value;
|
|
2233
2223
|
try {
|
|
2234
|
-
return cb(cbValue);
|
|
2224
|
+
return cb(cbValue, cbValue2);
|
|
2235
2225
|
} finally {
|
|
2236
2226
|
ctx[kPendingContexts]--;
|
|
2237
2227
|
ctx[key] = prev;
|
|
@@ -2244,15 +2234,15 @@ function captureContext(chunk) {
|
|
|
2244
2234
|
};
|
|
2245
2235
|
}
|
|
2246
2236
|
const kBranchId = Symbol("Branch Id");
|
|
2247
|
-
const
|
|
2237
|
+
const kAsyncContent = Symbol("Async Content");
|
|
2248
2238
|
function isInResumedBranch() {
|
|
2249
2239
|
return $chunk?.context?.[kBranchId] !== void 0;
|
|
2250
2240
|
}
|
|
2251
|
-
function withBranchId(branchId, cb, cbValue) {
|
|
2252
|
-
return withContext(kBranchId, branchId, cb, cbValue);
|
|
2241
|
+
function withBranchId(branchId, cb, cbValue, cbValue2) {
|
|
2242
|
+
return withContext(kBranchId, branchId, cb, cbValue, cbValue2);
|
|
2253
2243
|
}
|
|
2254
|
-
function
|
|
2255
|
-
return withContext(
|
|
2244
|
+
function withAsyncContent(async, cb, value) {
|
|
2245
|
+
return withContext(kAsyncContent, async, cb, value);
|
|
2256
2246
|
}
|
|
2257
2247
|
function _html(html) {
|
|
2258
2248
|
$chunk.writeHTML(html);
|
|
@@ -2270,9 +2260,8 @@ function mayDrop(written) {
|
|
|
2270
2260
|
return false;
|
|
2271
2261
|
}
|
|
2272
2262
|
function _script(scopeId, registryId, markerGuard) {
|
|
2273
|
-
if (markerGuard === 0 && ($chunk.
|
|
2274
|
-
$chunk.boundary.state.
|
|
2275
|
-
$chunk.writeEffect(scopeId, registryId);
|
|
2263
|
+
if (markerGuard === 0 && ($chunk.channel.readyId || $chunk.context?.[kAsyncContent])) _resume_branch(scopeId);
|
|
2264
|
+
$chunk.boundary.state.queueEffect(scopeId, registryId);
|
|
2276
2265
|
}
|
|
2277
2266
|
function _trailers(html) {
|
|
2278
2267
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -2292,27 +2281,27 @@ function _hoist(scopeId, id) {
|
|
|
2292
2281
|
getter[Symbol.iterator] = _hoist_read_error;
|
|
2293
2282
|
return _resume(getter, id, scopeId);
|
|
2294
2283
|
}
|
|
2295
|
-
function _el_resume(scopeId, accessor,
|
|
2296
|
-
if (
|
|
2284
|
+
function _el_resume(scopeId, accessor, markerGuard) {
|
|
2285
|
+
if (markerGuard === 0) return "";
|
|
2297
2286
|
const { state } = $chunk.boundary;
|
|
2298
|
-
state.
|
|
2287
|
+
state.needsWalkerRuntime = true;
|
|
2299
2288
|
return state.mark("$", scopeId + " " + accessor);
|
|
2300
2289
|
}
|
|
2301
|
-
function _text_resume(scopeId, accessor, val,
|
|
2302
|
-
return markText(scopeId, accessor, _escape(val),
|
|
2290
|
+
function _text_resume(scopeId, accessor, val, markerGuard) {
|
|
2291
|
+
return markText(scopeId, accessor, _escape(val), markerGuard);
|
|
2303
2292
|
}
|
|
2304
|
-
function _html_resume(scopeId, accessor, val,
|
|
2293
|
+
function _html_resume(scopeId, accessor, val, markerGuard) {
|
|
2305
2294
|
const html = _unescaped(val);
|
|
2306
|
-
if (
|
|
2295
|
+
if (markerGuard === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, markerGuard);
|
|
2307
2296
|
const { state } = $chunk.boundary;
|
|
2308
|
-
state.
|
|
2297
|
+
state.needsWalkerRuntime = true;
|
|
2309
2298
|
return state.mark("&", "") + html + state.mark("'", scopeId + " " + accessor);
|
|
2310
2299
|
}
|
|
2311
|
-
function markText(scopeId, accessor, text,
|
|
2312
|
-
if (
|
|
2300
|
+
function markText(scopeId, accessor, text, markerGuard) {
|
|
2301
|
+
if (markerGuard === 0) return text;
|
|
2313
2302
|
const { state } = $chunk.boundary;
|
|
2314
|
-
state.
|
|
2315
|
-
return text ? (
|
|
2303
|
+
state.needsWalkerRuntime = true;
|
|
2304
|
+
return text ? (markerGuard === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
2316
2305
|
}
|
|
2317
2306
|
function _resume_branch(scopeId) {
|
|
2318
2307
|
const branchId = $chunk.context?.[kBranchId];
|
|
@@ -2323,7 +2312,7 @@ function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
|
2323
2312
|
const render = normalizeServerRender(content);
|
|
2324
2313
|
const branchId = _peek_scope_id();
|
|
2325
2314
|
if (render) try {
|
|
2326
|
-
_set_scope_reason(shouldResume ?
|
|
2315
|
+
_set_scope_reason(shouldResume ? ALL_GROUPS : 0);
|
|
2327
2316
|
if (shouldResume) withBranchId(branchId, render);
|
|
2328
2317
|
else render();
|
|
2329
2318
|
} finally {
|
|
@@ -2349,137 +2338,21 @@ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, node
|
|
|
2349
2338
|
if (nodeAccessor !== void 0) writeScope(parentScopeId, { [BranchScopes + nodeAccessor]: childScope });
|
|
2350
2339
|
}
|
|
2351
2340
|
function writeScopePassive(scopeId, partialScope) {
|
|
2352
|
-
const target = $chunk.
|
|
2341
|
+
const target = $chunk.channel;
|
|
2353
2342
|
const scope = _scope_with_id(scopeId);
|
|
2354
|
-
const passive = target.passiveScopes ||= {};
|
|
2355
2343
|
Object.assign(scope, partialScope);
|
|
2356
|
-
|
|
2344
|
+
$chunk.boundary.state.queuePassiveScope(target, scopeId, partialScope);
|
|
2357
2345
|
return scope;
|
|
2358
2346
|
}
|
|
2359
|
-
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
2360
|
-
if (display) {
|
|
2361
|
-
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
2362
|
-
} else $chunk.writeHTML("<t hidden>");
|
|
2363
|
-
}
|
|
2364
|
-
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2365
|
-
const branchId = _scope_id();
|
|
2366
|
-
const wrap = !display;
|
|
2367
|
-
if (wrap) $chunk.writeHTML("</t>");
|
|
2368
|
-
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
2369
|
-
}
|
|
2370
|
-
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2371
|
-
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
2372
|
-
const itemKey = forOfBy(by, item, index);
|
|
2373
|
-
each(itemKey, itemKey === index, () => cb(item, index));
|
|
2374
|
-
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2375
|
-
}
|
|
2376
|
-
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2377
|
-
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
2378
|
-
each(forInBy(by, key, value), false, () => cb(key, value));
|
|
2379
|
-
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2380
|
-
}
|
|
2381
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2382
|
-
forBranches(by, (each) => {
|
|
2383
|
-
let index = 0;
|
|
2384
|
-
return each ? forTo(to, from, step, (value) => {
|
|
2385
|
-
const itemKey = forStepBy(by, value);
|
|
2386
|
-
each(itemKey, itemKey === index++, () => cb(value));
|
|
2387
|
-
}) : forTo(to, from, step, cb);
|
|
2388
|
-
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2389
|
-
}
|
|
2390
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2391
|
-
forBranches(by, (each) => {
|
|
2392
|
-
let index = 0;
|
|
2393
|
-
return each ? forUntil(to, from, step, (value) => {
|
|
2394
|
-
const itemKey = forStepBy(by, value);
|
|
2395
|
-
each(itemKey, itemKey === index++, () => cb(value));
|
|
2396
|
-
}) : forUntil(to, from, step, cb);
|
|
2397
|
-
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2398
|
-
}
|
|
2399
|
-
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2400
|
-
if (by) {
|
|
2401
|
-
const run = iterate;
|
|
2402
|
-
const seenKeys = /* @__PURE__ */ new Set();
|
|
2403
|
-
iterate = (each) => run((itemKey, sameAsIndex, render) => {
|
|
2404
|
-
assertValidLoopKey(itemKey, seenKeys);
|
|
2405
|
-
if (each) each(itemKey, sameAsIndex, render);
|
|
2406
|
-
else render();
|
|
2407
|
-
});
|
|
2408
|
-
}
|
|
2409
|
-
if (branchGuard === 0) {
|
|
2410
|
-
iterate(0);
|
|
2411
|
-
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
2412
|
-
return;
|
|
2413
|
-
}
|
|
2414
|
-
const { state } = $chunk.boundary;
|
|
2415
|
-
const resumeKeys = markerGuard !== 0;
|
|
2416
|
-
const resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag);
|
|
2417
|
-
let flushBranchIds = "";
|
|
2418
|
-
let loopScopes;
|
|
2419
|
-
iterate((itemKey, sameAsIndex, render) => {
|
|
2420
|
-
const branchId = _peek_scope_id();
|
|
2421
|
-
if (resumeMarker) {
|
|
2422
|
-
if (singleNode) flushBranchIds = " " + branchId + flushBranchIds;
|
|
2423
|
-
else {
|
|
2424
|
-
$chunk.writeHTML(state.mark("[", flushBranchIds));
|
|
2425
|
-
flushBranchIds = branchId + "";
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
withBranchId(branchId, () => {
|
|
2429
|
-
render();
|
|
2430
|
-
const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { [LoopKey]: itemKey } : {});
|
|
2431
|
-
if (!resumeMarker) loopScopes = push(loopScopes, branchScope);
|
|
2432
|
-
});
|
|
2433
|
-
});
|
|
2434
|
-
if (loopScopes) writeScope(scopeId, { [BranchScopes + accessor]: loopScopes });
|
|
2435
|
-
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
2436
|
-
}
|
|
2437
|
-
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2438
|
-
const resumeBranch = branchGuard !== 0;
|
|
2439
|
-
const resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag);
|
|
2440
|
-
const branchId = _peek_scope_id();
|
|
2441
|
-
const chunk = $chunk;
|
|
2442
|
-
const beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0;
|
|
2443
|
-
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
|
2444
|
-
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
2445
|
-
if (beforeBranch !== void 0) applyBranchStart(chunk, beforeBranch, shouldWriteBranch);
|
|
2446
|
-
if (shouldWriteBranch && (branchIndex || !resumeMarker)) writeScope(scopeId, {
|
|
2447
|
-
[ConditionalRenderer + accessor]: branchIndex || void 0,
|
|
2448
|
-
[BranchScopes + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
2449
|
-
});
|
|
2450
|
-
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
2451
|
-
}
|
|
2452
|
-
function deferBranchStart(chunk) {
|
|
2453
|
-
const beforeBranch = chunk.html;
|
|
2454
|
-
chunk.html = "";
|
|
2455
|
-
return beforeBranch;
|
|
2456
|
-
}
|
|
2457
|
-
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
2458
|
-
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
2459
|
-
}
|
|
2460
|
-
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
2461
|
-
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
2462
|
-
}
|
|
2463
|
-
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
2464
|
-
const endTag = parentEndTag || "";
|
|
2465
|
-
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
2466
|
-
const { state } = $chunk.boundary;
|
|
2467
|
-
const mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
2468
|
-
$chunk.writeHTML(mark + endTag);
|
|
2469
|
-
} else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
2470
|
-
else $chunk.writeHTML(endTag);
|
|
2471
|
-
}
|
|
2472
2347
|
let writeScope = (scopeId, partialScope) => {
|
|
2473
2348
|
const { state } = $chunk.boundary;
|
|
2474
|
-
const target = $chunk.
|
|
2349
|
+
const target = $chunk.channel;
|
|
2475
2350
|
const scope = scopeWithId(state, scopeId);
|
|
2476
|
-
|
|
2477
|
-
state.needsMainRuntime = true;
|
|
2351
|
+
state.needsWalkerRuntime = true;
|
|
2478
2352
|
countResumeWrite($chunk);
|
|
2353
|
+
writeAsyncVisits($chunk);
|
|
2479
2354
|
Object.assign(scope, partialScope);
|
|
2480
|
-
|
|
2481
|
-
else target.writeScopes[scopeId] = partialScope;
|
|
2482
|
-
target.flushScopes = true;
|
|
2355
|
+
state.queueScope(target, scopeId, partialScope);
|
|
2483
2356
|
return scope;
|
|
2484
2357
|
};
|
|
2485
2358
|
writeScope = ((writeScope) => (scopeId, partialScope, file, loc, vars) => {
|
|
@@ -2501,18 +2374,18 @@ function scopeWithId(state, scopeId) {
|
|
|
2501
2374
|
}
|
|
2502
2375
|
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
2503
2376
|
if (subscribers) {
|
|
2504
|
-
const { boundary,
|
|
2377
|
+
const { boundary, channel } = $chunk;
|
|
2505
2378
|
const { serializer } = boundary.state;
|
|
2506
|
-
if (!
|
|
2379
|
+
if (!channel.readyId && !serializer.refs.has(subscribers)) subscribers.add(scope);
|
|
2507
2380
|
else if (resumeId) _script(scope[K_SCOPE_ID], resumeId, markerGuard);
|
|
2508
|
-
else serializer
|
|
2509
|
-
if (boundary.withinCatch) (boundary.subscribed ||= []).push(subscribers, scope,
|
|
2381
|
+
else queueCall(serializer, scope, subscribers, "add", channel);
|
|
2382
|
+
if (boundary.withinCatch) (boundary.subscribed ||= []).push(subscribers, scope, channel);
|
|
2510
2383
|
}
|
|
2511
2384
|
return scope;
|
|
2512
2385
|
}
|
|
2513
|
-
const
|
|
2514
|
-
function
|
|
2515
|
-
return
|
|
2386
|
+
const ALL_GROUPS = 715827883;
|
|
2387
|
+
function getGroupReason(reason, group) {
|
|
2388
|
+
return reason === 715827883 ? 1 : typeof reason === "number" ? group < 15 ? reason >>> 1 + 2 * group & 3 : 0 : reason[group] ?? 0;
|
|
2516
2389
|
}
|
|
2517
2390
|
function _set_scope_reason(reason) {
|
|
2518
2391
|
$chunk.boundary.state.scopeReason = reason;
|
|
@@ -2522,18 +2395,18 @@ function _scope_reason() {
|
|
|
2522
2395
|
$chunk.boundary.state.scopeReason = void 0;
|
|
2523
2396
|
return reason;
|
|
2524
2397
|
}
|
|
2525
|
-
function _write_if(
|
|
2526
|
-
return
|
|
2398
|
+
function _write_if(reason, group) {
|
|
2399
|
+
return reason && getGroupReason(reason, group) ? 1 : void 0;
|
|
2527
2400
|
}
|
|
2528
|
-
function _write_guard(
|
|
2529
|
-
return _write_if(
|
|
2401
|
+
function _write_guard(reason, group) {
|
|
2402
|
+
return _write_if(reason, group) || 0;
|
|
2530
2403
|
}
|
|
2531
2404
|
function writeWaitReady(readyId, renderer, input) {
|
|
2532
2405
|
const chunk = $chunk;
|
|
2533
2406
|
const { boundary } = chunk;
|
|
2534
2407
|
const body = new Chunk(boundary, null, chunk.context, {
|
|
2535
2408
|
readyId,
|
|
2536
|
-
parent: chunk.
|
|
2409
|
+
parent: chunk.channel,
|
|
2537
2410
|
resumes: "",
|
|
2538
2411
|
writeScopes: {},
|
|
2539
2412
|
flushScopes: false
|
|
@@ -2545,209 +2418,58 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
2545
2418
|
body.deferOwnReady();
|
|
2546
2419
|
chunk.deferredReady = push(chunk.deferredReady, body);
|
|
2547
2420
|
} else {
|
|
2548
|
-
bodyEnd.next =
|
|
2421
|
+
bodyEnd.next = chunk.forkRest(boundary);
|
|
2549
2422
|
chunk.next = body;
|
|
2550
2423
|
}
|
|
2551
2424
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
const branchId = _peek_scope_id();
|
|
2557
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
2558
|
-
withBranchId(branchId, content, promise);
|
|
2559
|
-
$chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2560
|
-
} else content(promise);
|
|
2561
|
-
return;
|
|
2562
|
-
}
|
|
2563
|
-
const chunk = $chunk;
|
|
2564
|
-
const { boundary } = chunk;
|
|
2565
|
-
const startId = _peek_scope_id();
|
|
2566
|
-
const after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
2567
|
-
chunk.async = true;
|
|
2568
|
-
captureContext(chunk);
|
|
2569
|
-
boundary.startAsync();
|
|
2570
|
-
promise.then((value) => {
|
|
2571
|
-
if (chunk.async) {
|
|
2572
|
-
chunk.async = false;
|
|
2573
|
-
if (!boundary.aborted) {
|
|
2574
|
-
const { state } = boundary;
|
|
2575
|
-
chunk.render(() => {
|
|
2576
|
-
if (resumeMarker) {
|
|
2577
|
-
const branchId = _peek_scope_id();
|
|
2578
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
2579
|
-
withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value));
|
|
2580
|
-
$chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2581
|
-
} else {
|
|
2582
|
-
const renderedSince = _peek_scope_id() !== startId;
|
|
2583
|
-
const async = { parent: getAsyncContent(chunk) };
|
|
2584
|
-
withIsAsync(async, content, value);
|
|
2585
|
-
async.visit = renderedSince && (after.html || after.next) ? $chunk.boundary.state.mark("]", scopeId + " " + accessor) : "";
|
|
2586
|
-
if (async.resumed) $chunk.writeHTML(async.visit);
|
|
2587
|
-
async.end = $chunk;
|
|
2588
|
-
}
|
|
2589
|
-
});
|
|
2590
|
-
if (!chunk.async && boundary.pendingReorders?.delete(chunk)) state.reorder(chunk);
|
|
2591
|
-
boundary.endAsync();
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
}, (err) => {
|
|
2595
|
-
chunk.async = false;
|
|
2596
|
-
boundary.abort(err);
|
|
2597
|
-
});
|
|
2425
|
+
function deferBranchStart(chunk) {
|
|
2426
|
+
const beforeBranch = chunk.html;
|
|
2427
|
+
chunk.html = "";
|
|
2428
|
+
return beforeBranch;
|
|
2598
2429
|
}
|
|
2599
|
-
function
|
|
2600
|
-
|
|
2601
|
-
const branchId = _peek_scope_id();
|
|
2602
|
-
const chunk = $chunk;
|
|
2603
|
-
const { boundary } = chunk;
|
|
2604
|
-
const { state } = boundary;
|
|
2605
|
-
const { resumeWrites } = boundary;
|
|
2606
|
-
const beforeBranch = deferBranchStart(chunk);
|
|
2607
|
-
const renderers = () => writeTryRenderers(branchId, catchContent && _resume(catchContent, catchId), placeholderContent && _resume(placeholderContent, placeholderId));
|
|
2608
|
-
const renderersWritten = tryBoundary(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent, branchId, renderers);
|
|
2609
|
-
const rendered = chunk !== $chunk || boundary.resumeWrites !== resumeWrites;
|
|
2610
|
-
applyBranchStart(chunk, beforeBranch, rendered);
|
|
2611
|
-
if (!rendered) return;
|
|
2612
|
-
if (!renderersWritten) renderers();
|
|
2613
|
-
$chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2614
|
-
}
|
|
2615
|
-
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
2616
|
-
const chunk = $chunk;
|
|
2617
|
-
const { boundary } = chunk;
|
|
2618
|
-
const body = chunk.fork(boundary, null);
|
|
2619
|
-
if (body === body.render(content)) {
|
|
2620
|
-
chunk.append(body);
|
|
2621
|
-
return;
|
|
2622
|
-
}
|
|
2623
|
-
chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
2624
|
-
captureContext(chunk);
|
|
2625
|
-
chunk.placeholder = {
|
|
2626
|
-
body,
|
|
2627
|
-
render: placeholder,
|
|
2628
|
-
branchId,
|
|
2629
|
-
scopeId,
|
|
2630
|
-
placeholderBranchId
|
|
2631
|
-
};
|
|
2632
|
-
}
|
|
2633
|
-
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
2634
|
-
const chunk = $chunk;
|
|
2635
|
-
const { boundary } = chunk;
|
|
2636
|
-
const { state } = boundary;
|
|
2637
|
-
const catchBoundary = new Boundary(state, void 0, boundary);
|
|
2638
|
-
if (catchContent) catchBoundary.withinCatch = true;
|
|
2639
|
-
const body = chunk.fork(catchBoundary, null);
|
|
2640
|
-
const bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
2641
|
-
if (catchBoundary.aborted) {
|
|
2642
|
-
if (!catchContent) throw catchBoundary.reason;
|
|
2643
|
-
catchContent(catchBoundary.reason);
|
|
2644
|
-
return true;
|
|
2645
|
-
}
|
|
2646
|
-
if (body === bodyEnd) {
|
|
2647
|
-
chunk.append(body);
|
|
2648
|
-
return false;
|
|
2649
|
-
}
|
|
2650
|
-
const renderersAtSettle = !catchBoundary.resumeWrites;
|
|
2651
|
-
const bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
2652
|
-
chunk.next = body;
|
|
2653
|
-
boundary.startAsync();
|
|
2654
|
-
const reorderId = catchContent ? state.nextReorderId() : "";
|
|
2655
|
-
if (reorderId) {
|
|
2656
|
-
chunk.catchRange = {
|
|
2657
|
-
id: reorderId,
|
|
2658
|
-
end: bodyEnd
|
|
2659
|
-
};
|
|
2660
|
-
captureContext(chunk);
|
|
2661
|
-
}
|
|
2662
|
-
catchBoundary.onNext = () => {
|
|
2663
|
-
if (boundary.aborted) return;
|
|
2664
|
-
if (catchBoundary.aborted) {
|
|
2665
|
-
if (!reorderId) {
|
|
2666
|
-
boundary.abort(catchBoundary.reason);
|
|
2667
|
-
return;
|
|
2668
|
-
}
|
|
2669
|
-
const streamed = !chunk.catchRange;
|
|
2670
|
-
const catchChunk = chunk.fork(boundary, null);
|
|
2671
|
-
chunk.catchRange = null;
|
|
2672
|
-
if (!renderersAtSettle) catchChunk.render(clearTryRenderers, branchId);
|
|
2673
|
-
const inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
2674
|
-
if (boundary.aborted) return;
|
|
2675
|
-
if (bodyEnd.consumed || !inOrder) catchChunk.reorderBranch = branchId;
|
|
2676
|
-
if (bodyEnd.consumed) {
|
|
2677
|
-
catchChunk.reorderId = reorderId;
|
|
2678
|
-
state.reorder(catchChunk);
|
|
2679
|
-
} else {
|
|
2680
|
-
let reorder = null;
|
|
2681
|
-
if (!inOrder) reorder = catchChunk;
|
|
2682
|
-
else if (streamed) reorder = chunk.fork(boundary, null);
|
|
2683
|
-
if (reorder) reorder.reorderId = reorderId;
|
|
2684
|
-
const endMarker = state.mark("!", reorderId);
|
|
2685
|
-
let cut = body;
|
|
2686
|
-
while (cut.consumed) cut = cut.next;
|
|
2687
|
-
cut.async = false;
|
|
2688
|
-
cut.next = inOrder ? catchChunk : bodyNext;
|
|
2689
|
-
cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker;
|
|
2690
|
-
cut.scripts = cut.effects = cut.lastEffect = "";
|
|
2691
|
-
cut.placeholder = cut.reorderId = cut.catchRange = null;
|
|
2692
|
-
cut.deferredReorder = reorder;
|
|
2693
|
-
if (inOrder) catchChunk.next = bodyNext;
|
|
2694
|
-
}
|
|
2695
|
-
boundary.endAsync();
|
|
2696
|
-
} else if (!catchBoundary.count) {
|
|
2697
|
-
if (renderersAtSettle && catchBoundary.resumeWrites) bodyEnd.render(renderers);
|
|
2698
|
-
chunk.catchRange = null;
|
|
2699
|
-
boundary.endAsync();
|
|
2700
|
-
} else boundary.onNext();
|
|
2701
|
-
};
|
|
2702
|
-
return renderersAtSettle;
|
|
2430
|
+
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
2431
|
+
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
2703
2432
|
}
|
|
2704
2433
|
function unsubscribe(subscribed, serializer) {
|
|
2705
2434
|
for (let i = 0; i < subscribed.length; i += 3) {
|
|
2706
2435
|
const subscribers = subscribed[i];
|
|
2707
2436
|
const scope = subscribed[i + 1];
|
|
2708
|
-
if (!serializer.
|
|
2709
|
-
else
|
|
2437
|
+
if (!serializer.refs.has(subscribers)) subscribers.delete(scope);
|
|
2438
|
+
else {
|
|
2439
|
+
const channel = subscribed[i + 2];
|
|
2440
|
+
if (!dropQueuedCall(serializer, scope, subscribers, "add", channel)) queueCall(serializer, scope, subscribers, "delete", channel);
|
|
2441
|
+
}
|
|
2710
2442
|
}
|
|
2711
2443
|
}
|
|
2712
|
-
function clearTryRenderers(branchId) {
|
|
2713
|
-
writeScope(branchId, {
|
|
2714
|
-
[CatchContent]: 0,
|
|
2715
|
-
[PlaceholderContent]: _scope_with_id(branchId)["#PlaceholderContent"] && 0
|
|
2716
|
-
});
|
|
2717
|
-
}
|
|
2718
|
-
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
2719
|
-
writeScope(branchId, {
|
|
2720
|
-
[CatchContent]: catchContent,
|
|
2721
|
-
[PlaceholderContent]: placeholderContent
|
|
2722
|
-
});
|
|
2723
|
-
}
|
|
2724
2444
|
const NOOP$2 = () => {};
|
|
2725
2445
|
function countResumeWrite(chunk) {
|
|
2726
2446
|
for (let boundary = chunk.boundary; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
2447
|
+
}
|
|
2448
|
+
function writeAsyncVisits(chunk) {
|
|
2727
2449
|
for (let async = getAsyncContent(chunk); async && !async.resumed; async = async.parent) {
|
|
2728
2450
|
async.resumed = true;
|
|
2729
2451
|
async.end?.writeHTML(async.visit);
|
|
2730
2452
|
}
|
|
2731
2453
|
}
|
|
2732
2454
|
function getAsyncContent(chunk) {
|
|
2733
|
-
return chunk.context?.[
|
|
2455
|
+
return chunk.context?.[kAsyncContent];
|
|
2734
2456
|
}
|
|
2735
2457
|
var State = class {
|
|
2736
2458
|
tagId = 1;
|
|
2737
2459
|
scopeId = 1;
|
|
2738
2460
|
reorderId = 1;
|
|
2739
2461
|
readyGate = 1;
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2462
|
+
hasWrittenGlobals = false;
|
|
2463
|
+
needsWalkerRuntime = false;
|
|
2464
|
+
hasWalkerRuntime = false;
|
|
2465
|
+
hasWrittenReady = false;
|
|
2744
2466
|
hasReorderRuntime = false;
|
|
2745
2467
|
hasWrittenResume = false;
|
|
2746
2468
|
walkOnNextFlush = false;
|
|
2747
2469
|
trailerHTML = "";
|
|
2748
2470
|
resumes = "";
|
|
2749
2471
|
nonceAttr = "";
|
|
2750
|
-
serializer = new
|
|
2472
|
+
serializer = new State$1();
|
|
2751
2473
|
writeReorders = null;
|
|
2752
2474
|
scopes = /* @__PURE__ */ new Map();
|
|
2753
2475
|
scope = (scopeId) => scopeWithId(this, scopeId);
|
|
@@ -2760,7 +2482,7 @@ var State = class {
|
|
|
2760
2482
|
this.$global = $global;
|
|
2761
2483
|
if ($global.cspNonce) this.nonceAttr = " nonce" + attrAssignment($global.cspNonce);
|
|
2762
2484
|
}
|
|
2763
|
-
|
|
2485
|
+
joinFlush(html, scripts, pending) {
|
|
2764
2486
|
const { $global, nonceAttr } = this;
|
|
2765
2487
|
const { __flush__ } = $global;
|
|
2766
2488
|
if (scripts) html += "<script" + nonceAttr + ">" + scripts + "<\/script>";
|
|
@@ -2773,6 +2495,32 @@ var State = class {
|
|
|
2773
2495
|
walkScript() {
|
|
2774
2496
|
return this.runtimePrefix + ".w()";
|
|
2775
2497
|
}
|
|
2498
|
+
addResumes(channel, resumes) {
|
|
2499
|
+
channel.resumes = concatSequence(channel.resumes, resumes);
|
|
2500
|
+
}
|
|
2501
|
+
queueScope(target, scopeId, partialScope) {
|
|
2502
|
+
const pending = target.writeScopes[scopeId];
|
|
2503
|
+
if (pending && pending !== partialScope) Object.assign(pending, partialScope);
|
|
2504
|
+
else target.writeScopes[scopeId] = partialScope;
|
|
2505
|
+
target.flushScopes = true;
|
|
2506
|
+
}
|
|
2507
|
+
queuePassiveScope(target, scopeId, partialScope) {
|
|
2508
|
+
const passive = target.passiveScopes ||= {};
|
|
2509
|
+
passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
|
|
2510
|
+
}
|
|
2511
|
+
queueEffect(scopeId, registryId) {
|
|
2512
|
+
this.needsWalkerRuntime = true;
|
|
2513
|
+
$chunk.writeEffect(scopeId, registryId);
|
|
2514
|
+
}
|
|
2515
|
+
serializeFlush(boundary) {
|
|
2516
|
+
flushSerializer(boundary, this);
|
|
2517
|
+
}
|
|
2518
|
+
runtimeScript() {
|
|
2519
|
+
return WALKER_RUNTIME_CODE + "(\"" + this.$global.runtimeId + "\")(\"" + this.$global.renderId + "\")";
|
|
2520
|
+
}
|
|
2521
|
+
keepsTryMarks(chunk, resumeWrites) {
|
|
2522
|
+
return chunk !== $chunk || chunk.boundary.resumeWrites !== resumeWrites;
|
|
2523
|
+
}
|
|
2776
2524
|
resumeScript(resumes) {
|
|
2777
2525
|
if (this.hasWrittenResume) return this.runtimePrefix + ".r.push(" + resumes + ")";
|
|
2778
2526
|
this.hasWrittenResume = true;
|
|
@@ -2789,16 +2537,16 @@ var State = class {
|
|
|
2789
2537
|
reorder(chunk) {
|
|
2790
2538
|
if (this.writeReorders) this.writeReorders.push(chunk);
|
|
2791
2539
|
else {
|
|
2792
|
-
this.
|
|
2540
|
+
this.needsWalkerRuntime = true;
|
|
2793
2541
|
this.writeReorders = [chunk];
|
|
2794
2542
|
}
|
|
2795
2543
|
}
|
|
2796
|
-
|
|
2544
|
+
readyScript(id, resumes) {
|
|
2797
2545
|
const readyKey = toObjectKey(id);
|
|
2798
2546
|
if (this.readyIds?.has(id)) return this.readyAccess(readyKey) + ".push(" + resumes + ")";
|
|
2799
2547
|
(this.readyIds ||= /* @__PURE__ */ new Set()).add(id);
|
|
2800
|
-
if (this.
|
|
2801
|
-
this.
|
|
2548
|
+
if (this.hasWrittenReady) return this.readyAccess(readyKey) + "=[" + resumes + "]";
|
|
2549
|
+
this.hasWrittenReady = true;
|
|
2802
2550
|
return this.runtimePrefix + ".b={" + readyKey + ":[" + resumes + "]}";
|
|
2803
2551
|
}
|
|
2804
2552
|
readyAccess(readyKey) {
|
|
@@ -2858,7 +2606,7 @@ var Boundary = class {
|
|
|
2858
2606
|
this.abort(event.target.reason);
|
|
2859
2607
|
}
|
|
2860
2608
|
flush() {
|
|
2861
|
-
if (!this.aborted)
|
|
2609
|
+
if (!this.aborted) this.state.serializeFlush(this);
|
|
2862
2610
|
return this.count ? 1 : this.aborted ? 2 : 0;
|
|
2863
2611
|
}
|
|
2864
2612
|
startAsync() {
|
|
@@ -2889,21 +2637,25 @@ var Chunk = class Chunk {
|
|
|
2889
2637
|
boundary;
|
|
2890
2638
|
next;
|
|
2891
2639
|
context;
|
|
2892
|
-
|
|
2893
|
-
constructor(boundary, next, context,
|
|
2640
|
+
channel;
|
|
2641
|
+
constructor(boundary, next, context, channel) {
|
|
2894
2642
|
this.boundary = boundary;
|
|
2895
2643
|
this.next = next;
|
|
2896
2644
|
this.context = context;
|
|
2897
|
-
this.
|
|
2645
|
+
this.channel = channel;
|
|
2898
2646
|
}
|
|
2899
2647
|
fork(boundary, next) {
|
|
2900
|
-
return new Chunk(boundary, next, this.context, this.
|
|
2648
|
+
return new Chunk(boundary, next, this.context, this.channel);
|
|
2649
|
+
}
|
|
2650
|
+
forkRest(boundary) {
|
|
2651
|
+
return $chunk = this.fork(boundary, this.next);
|
|
2901
2652
|
}
|
|
2902
2653
|
writeHTML(html) {
|
|
2903
2654
|
this.html += html;
|
|
2904
2655
|
}
|
|
2905
2656
|
writeEffect(scopeId, registryId) {
|
|
2906
2657
|
countResumeWrite(this);
|
|
2658
|
+
writeAsyncVisits(this);
|
|
2907
2659
|
if (this.lastEffect === registryId) this.effects = concatEffects(this.effects, scopeId + "");
|
|
2908
2660
|
else {
|
|
2909
2661
|
this.lastEffect = registryId;
|
|
@@ -2931,7 +2683,7 @@ var Chunk = class Chunk {
|
|
|
2931
2683
|
return deferredReady;
|
|
2932
2684
|
}
|
|
2933
2685
|
deferOwnReady() {
|
|
2934
|
-
if (this.
|
|
2686
|
+
if (this.channel.readyId && (this.effects || this.scripts || this.channel.flushScopes)) {
|
|
2935
2687
|
const deferred = this.fork(this.boundary, null);
|
|
2936
2688
|
deferred.effects = this.effects;
|
|
2937
2689
|
deferred.scripts = this.scripts;
|
|
@@ -2981,12 +2733,12 @@ var Chunk = class Chunk {
|
|
|
2981
2733
|
this.writeHTML(state.mark("!^", reorderId));
|
|
2982
2734
|
const { effects } = this;
|
|
2983
2735
|
const beforeBranch = deferBranchStart(this);
|
|
2984
|
-
if (this.render(
|
|
2736
|
+
if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this) this.boundary.abort(/* @__PURE__ */ new Error("An @placeholder cannot contain async content."));
|
|
2985
2737
|
if (this.boundary.aborted) return true;
|
|
2986
2738
|
const stateful = this.effects !== effects;
|
|
2987
2739
|
applyBranchStart(this, beforeBranch, stateful);
|
|
2988
2740
|
if (stateful) {
|
|
2989
|
-
this.render(
|
|
2741
|
+
this.render(writeScope, branchId, { [PlaceholderBranch]: scopeWithId(state, placeholderBranchId) });
|
|
2990
2742
|
this.writeHTML(state.mark("]", scopeId + " " + (PlaceholderBranch + branchId) + " " + placeholderBranchId));
|
|
2991
2743
|
dismissChunk(end, body).writeEffect(branchId, PLACEHOLDER_DISMISS_REGISTER_ID);
|
|
2992
2744
|
}
|
|
@@ -3020,12 +2772,12 @@ var Chunk = class Chunk {
|
|
|
3020
2772
|
let heldEffects = this.heldEffects;
|
|
3021
2773
|
let deferredReady;
|
|
3022
2774
|
this.heldEffects = null;
|
|
3023
|
-
if (this.
|
|
2775
|
+
if (this.channel.readyId && this.effects) followHeldEffects(this);
|
|
3024
2776
|
while (cur.next && !cur.async) {
|
|
3025
2777
|
cur.markCatchRange();
|
|
3026
2778
|
cur.queueDeferredReorder();
|
|
3027
2779
|
html += cur.html;
|
|
3028
|
-
if (cur.
|
|
2780
|
+
if (cur.channel.readyId) deferredReady = push(deferredReady, cur);
|
|
3029
2781
|
else {
|
|
3030
2782
|
if (cur.effects) {
|
|
3031
2783
|
if (effectsEnd && effectsEnd.boundary !== cur.boundary) {
|
|
@@ -3043,7 +2795,7 @@ var Chunk = class Chunk {
|
|
|
3043
2795
|
}
|
|
3044
2796
|
cur.deferOwnReady();
|
|
3045
2797
|
if (effects) {
|
|
3046
|
-
if (cur.
|
|
2798
|
+
if (cur.channel.readyId) heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects);
|
|
3047
2799
|
else if (effectsEnd.boundary !== cur.boundary) {
|
|
3048
2800
|
heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects);
|
|
3049
2801
|
if (isWithin(cur.boundary, effectsEnd.boundary)) cur.lastEffect ||= effectsEnd.lastEffect;
|
|
@@ -3058,11 +2810,11 @@ var Chunk = class Chunk {
|
|
|
3058
2810
|
cur.scripts = concatScripts(scripts, cur.scripts);
|
|
3059
2811
|
return cur;
|
|
3060
2812
|
}
|
|
3061
|
-
render(content, val) {
|
|
2813
|
+
render(content, val, val2) {
|
|
3062
2814
|
const prev = $chunk;
|
|
3063
2815
|
$chunk = this;
|
|
3064
2816
|
try {
|
|
3065
|
-
content(val);
|
|
2817
|
+
content(val, val2);
|
|
3066
2818
|
return $chunk;
|
|
3067
2819
|
} catch (err) {
|
|
3068
2820
|
this.boundary.abort(err);
|
|
@@ -3072,8 +2824,8 @@ var Chunk = class Chunk {
|
|
|
3072
2824
|
}
|
|
3073
2825
|
}
|
|
3074
2826
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
3075
|
-
const {
|
|
3076
|
-
const { readyId } =
|
|
2827
|
+
const { channel } = this;
|
|
2828
|
+
const { readyId } = channel;
|
|
3077
2829
|
let scripts = "";
|
|
3078
2830
|
const held = this.takeDeferredReady();
|
|
3079
2831
|
if (held) for (const chunk of Array.isArray(held) ? held : [held]) {
|
|
@@ -3083,46 +2835,46 @@ var Chunk = class Chunk {
|
|
|
3083
2835
|
}
|
|
3084
2836
|
if (readyId && !this.async) {
|
|
3085
2837
|
const { state } = boundary;
|
|
3086
|
-
flushSerializer(boundary,
|
|
3087
|
-
const deps = state.serializer
|
|
2838
|
+
flushSerializer(boundary, channel);
|
|
2839
|
+
const deps = takeChannelDeps(state.serializer);
|
|
3088
2840
|
const effects = holdEffects ? "" : this.effects;
|
|
3089
|
-
const { resumes } =
|
|
2841
|
+
const { resumes } = channel;
|
|
3090
2842
|
const chunkScripts = this.scripts;
|
|
3091
|
-
|
|
2843
|
+
channel.resumes = this.scripts = "";
|
|
3092
2844
|
if (effects) this.effects = this.lastEffect = "";
|
|
3093
2845
|
if (resumes || effects) {
|
|
3094
|
-
state.
|
|
2846
|
+
state.needsWalkerRuntime = true;
|
|
3095
2847
|
const batch = concatSequence(depsMarker(deps), concatSequence(resumes, effects && `"${effects}"`));
|
|
3096
2848
|
if (reservations) {
|
|
3097
2849
|
const gate = state.readyGate++;
|
|
3098
|
-
reservations.push(state.
|
|
2850
|
+
reservations.push(state.readyScript(readyId, gate + ""));
|
|
3099
2851
|
scripts = concatScripts(scripts, "(b=>b.splice(b.indexOf(" + gate + "),1," + batch + "))(" + state.readyAccess(toObjectKey(readyId)) + ")");
|
|
3100
|
-
} else scripts = concatScripts(scripts, state.
|
|
2852
|
+
} else scripts = concatScripts(scripts, state.readyScript(readyId, batch));
|
|
3101
2853
|
}
|
|
3102
2854
|
scripts = concatScripts(scripts, chunkScripts);
|
|
3103
2855
|
}
|
|
3104
2856
|
return scripts;
|
|
3105
2857
|
}
|
|
3106
|
-
|
|
2858
|
+
flush(boundary) {
|
|
3107
2859
|
const { state } = boundary;
|
|
3108
|
-
const {
|
|
2860
|
+
const { runtimePrefix } = state;
|
|
3109
2861
|
let needsWalk = state.walkOnNextFlush;
|
|
3110
2862
|
if (needsWalk) state.walkOnNextFlush = false;
|
|
3111
2863
|
flushSerializer(boundary, state);
|
|
3112
2864
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
3113
|
-
for (let channel; !boundary.aborted && (channel = state.serializer
|
|
3114
|
-
const resumes = state.serializer
|
|
3115
|
-
const deps = state.serializer
|
|
3116
|
-
state.
|
|
3117
|
-
readyResumeScripts = concatScripts(readyResumeScripts, state.
|
|
2865
|
+
for (let channel; !boundary.aborted && (channel = pendingReadyChannel(state.serializer));) {
|
|
2866
|
+
const resumes = stringifyScopes(state.serializer, [], boundary, channel);
|
|
2867
|
+
const deps = takeChannelDeps(state.serializer);
|
|
2868
|
+
state.needsWalkerRuntime = true;
|
|
2869
|
+
readyResumeScripts = concatScripts(readyResumeScripts, state.readyScript(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
3118
2870
|
}
|
|
3119
2871
|
if (readyResumeScripts) needsWalk = true;
|
|
3120
2872
|
const effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects);
|
|
3121
2873
|
let { html, scripts } = this;
|
|
3122
2874
|
if (html && state.hasReorderRuntime) html = state.mark("*", "") + html;
|
|
3123
|
-
if (state.
|
|
3124
|
-
state.
|
|
3125
|
-
scripts = concatScripts(scripts,
|
|
2875
|
+
if (state.needsWalkerRuntime && !state.hasWalkerRuntime) {
|
|
2876
|
+
state.hasWalkerRuntime = true;
|
|
2877
|
+
scripts = concatScripts(scripts, state.runtimeScript());
|
|
3126
2878
|
}
|
|
3127
2879
|
scripts = concatScripts(scripts, readyResumeScripts);
|
|
3128
2880
|
if (effects) {
|
|
@@ -3199,10 +2951,10 @@ var Chunk = class Chunk {
|
|
|
3199
2951
|
}
|
|
3200
2952
|
flushHTML(boundary) {
|
|
3201
2953
|
const { state } = boundary;
|
|
3202
|
-
this.
|
|
2954
|
+
this.flush(boundary);
|
|
3203
2955
|
const { html, scripts } = this;
|
|
3204
2956
|
this.html = this.scripts = "";
|
|
3205
|
-
return state.
|
|
2957
|
+
return state.joinFlush(html, scripts, boundary.count);
|
|
3206
2958
|
}
|
|
3207
2959
|
};
|
|
3208
2960
|
function renderReorderPlaceholders(reorder, reorders) {
|
|
@@ -3224,7 +2976,7 @@ function followHeldEffects(chunk) {
|
|
|
3224
2976
|
}
|
|
3225
2977
|
}
|
|
3226
2978
|
function lastHeldOf(held, cur) {
|
|
3227
|
-
return cur.
|
|
2979
|
+
return cur.channel === held.channel && cur.boundary === held.boundary ? cur : held;
|
|
3228
2980
|
}
|
|
3229
2981
|
function holdEffectsOn(heldEffects, chunk, effects) {
|
|
3230
2982
|
chunk.effects = effects;
|
|
@@ -3235,7 +2987,7 @@ function isWithin(boundary, outer) {
|
|
|
3235
2987
|
return !!boundary;
|
|
3236
2988
|
}
|
|
3237
2989
|
function holdReorderEffects(head, boundary, effects) {
|
|
3238
|
-
if (!head.
|
|
2990
|
+
if (!head.channel.readyId) {
|
|
3239
2991
|
if (head.effects) head.heldEffects = holdEffectsOn(head.heldEffects, head.fork(head.boundary, null), head.effects);
|
|
3240
2992
|
head.effects = head.lastEffect = "";
|
|
3241
2993
|
}
|
|
@@ -3247,13 +2999,12 @@ function joinHeldEffects(heldEffects, effects) {
|
|
|
3247
2999
|
function joinUncaught(joined, held) {
|
|
3248
3000
|
return held.boundary.aborted ? joined : concatEffects(joined, held.effects);
|
|
3249
3001
|
}
|
|
3250
|
-
function flushSerializer(boundary,
|
|
3002
|
+
function flushSerializer(boundary, channel) {
|
|
3251
3003
|
const { state } = boundary;
|
|
3252
3004
|
const { serializer } = state;
|
|
3253
|
-
const pending = serializer.
|
|
3254
|
-
if (
|
|
3255
|
-
const { writeScopes, passiveScopes } =
|
|
3256
|
-
const isBlockingState = serializeState !== state;
|
|
3005
|
+
const pending = hasMatchingCalls(serializer, channel.readyId);
|
|
3006
|
+
if (channel.flushScopes || pending) {
|
|
3007
|
+
const { writeScopes, passiveScopes } = channel;
|
|
3257
3008
|
const flushes = [];
|
|
3258
3009
|
if (passiveScopes) for (const key in passiveScopes) {
|
|
3259
3010
|
const props = writeScopes[key];
|
|
@@ -3262,8 +3013,8 @@ function flushSerializer(boundary, serializeState) {
|
|
|
3262
3013
|
delete passiveScopes[key];
|
|
3263
3014
|
}
|
|
3264
3015
|
}
|
|
3265
|
-
if (!
|
|
3266
|
-
state.
|
|
3016
|
+
if (!channel.readyId && !state.hasWrittenGlobals) {
|
|
3017
|
+
state.hasWrittenGlobals = true;
|
|
3267
3018
|
const globals = getFilteredGlobals(state.$global);
|
|
3268
3019
|
if (globals) flushes.push([
|
|
3269
3020
|
0,
|
|
@@ -3281,11 +3032,11 @@ function flushSerializer(boundary, serializeState) {
|
|
|
3281
3032
|
]);
|
|
3282
3033
|
}
|
|
3283
3034
|
if (flushes.length || pending) {
|
|
3284
|
-
if (
|
|
3285
|
-
|
|
3035
|
+
if (channel.readyId && !state.hasWrittenGlobals) flushSerializerGlobals(boundary);
|
|
3036
|
+
state.addResumes(channel, stringifyScopes(serializer, flushes, boundary, channel));
|
|
3286
3037
|
}
|
|
3287
|
-
|
|
3288
|
-
|
|
3038
|
+
channel.writeScopes = {};
|
|
3039
|
+
channel.flushScopes = false;
|
|
3289
3040
|
if (pending) state.walkOnNextFlush = true;
|
|
3290
3041
|
}
|
|
3291
3042
|
}
|
|
@@ -3293,9 +3044,9 @@ function flushSerializerGlobals(boundary) {
|
|
|
3293
3044
|
const { state } = boundary;
|
|
3294
3045
|
const globals = getFilteredGlobals(state.$global);
|
|
3295
3046
|
if (globals) {
|
|
3296
|
-
state.
|
|
3297
|
-
state.
|
|
3298
|
-
state.resumes = concatSequence(state.resumes, state.serializer
|
|
3047
|
+
state.hasWrittenGlobals = true;
|
|
3048
|
+
state.needsWalkerRuntime = true;
|
|
3049
|
+
state.resumes = concatSequence(state.resumes, stringifyScopes(state.serializer, [[
|
|
3299
3050
|
0,
|
|
3300
3051
|
globals,
|
|
3301
3052
|
globals
|
|
@@ -3453,7 +3204,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, m
|
|
|
3453
3204
|
const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
|
|
3454
3205
|
const render = () => {
|
|
3455
3206
|
if (renderer) try {
|
|
3456
|
-
_set_scope_reason(shouldResume ?
|
|
3207
|
+
_set_scope_reason(shouldResume ? ALL_GROUPS : 0);
|
|
3457
3208
|
return inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
3458
3209
|
...inputOrArgs,
|
|
3459
3210
|
content
|
|
@@ -3485,10 +3236,10 @@ function _content_resume(id, fn, scopeId, locals) {
|
|
|
3485
3236
|
return _resume(_content(id, fn, scopeId), id, scopeId, locals);
|
|
3486
3237
|
}
|
|
3487
3238
|
const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
3488
|
-
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs,
|
|
3239
|
+
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, markerGuard, tagVar) => {
|
|
3489
3240
|
const patched = patch(tag, scopeId, accessor);
|
|
3490
3241
|
if (patched !== tag) patched["id"] = tag;
|
|
3491
|
-
return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs,
|
|
3242
|
+
return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, markerGuard, tagVar);
|
|
3492
3243
|
};
|
|
3493
3244
|
})(_dynamic_tag);
|
|
3494
3245
|
//#endregion
|
|
@@ -3742,7 +3493,7 @@ var ServerRendered = class {
|
|
|
3742
3493
|
toString() {
|
|
3743
3494
|
const head = this.#head;
|
|
3744
3495
|
this.#head = null;
|
|
3745
|
-
if (!head) throw new Error(CONSUMED_RESULT_MESSAGE);
|
|
3496
|
+
if (!head) throw /* @__PURE__ */ new Error(CONSUMED_RESULT_MESSAGE);
|
|
3746
3497
|
const { boundary } = head;
|
|
3747
3498
|
const html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
3748
3499
|
if (boundary.count) boundary.abort(/* @__PURE__ */ new Error("Cannot consume asynchronous render with 'toString'"));
|
|
@@ -3760,20 +3511,20 @@ function NOOP$1() {}
|
|
|
3760
3511
|
//#region src/html/assets.ts
|
|
3761
3512
|
const kAssets = Symbol();
|
|
3762
3513
|
const kHead = Symbol();
|
|
3763
|
-
function withLoadAssets(
|
|
3764
|
-
|
|
3514
|
+
function withLoadAssets(template, id, flush, assetId, triggers) {
|
|
3515
|
+
const renderer = (input) => {
|
|
3765
3516
|
writeLoadAsset(assetId, flush, triggers);
|
|
3766
|
-
return writeWaitReady(assetId,
|
|
3767
|
-
}
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3517
|
+
return writeWaitReady(assetId, template(), input);
|
|
3518
|
+
};
|
|
3519
|
+
renderer[Lazy] = 1;
|
|
3520
|
+
_template(id, renderer);
|
|
3521
|
+
return renderer;
|
|
3771
3522
|
}
|
|
3772
3523
|
function writeLoadAsset(assetId, flush, triggers) {
|
|
3773
3524
|
const g = $global();
|
|
3774
3525
|
writeAsset(g, addAsset(g, assetId, flush, triggers));
|
|
3775
3526
|
}
|
|
3776
|
-
function withPageAssets(template,
|
|
3527
|
+
function withPageAssets(template, flush, assetId, runtimeId) {
|
|
3777
3528
|
return Object.assign((input) => {
|
|
3778
3529
|
const g = $global();
|
|
3779
3530
|
if (runtimeId) {
|
|
@@ -3782,7 +3533,7 @@ function withPageAssets(template, runtime, assetId, runtimeId) {
|
|
|
3782
3533
|
g.runtimeId = runtimeId;
|
|
3783
3534
|
} else if (g.runtimeId !== runtimeId) console.error(`A page entry compiled with runtimeId "${runtimeId}" is nested in a render using runtimeId "${g.runtimeId}", so its content cannot resume.`);
|
|
3784
3535
|
}
|
|
3785
|
-
const asset = addAsset(g, assetId,
|
|
3536
|
+
const asset = addAsset(g, assetId, flush);
|
|
3786
3537
|
if (g.__flush__) {
|
|
3787
3538
|
writeAsset(g, asset);
|
|
3788
3539
|
return writeWaitReady(assetId, template, input);
|
|
@@ -3882,6 +3633,326 @@ function toObjectExpression(options) {
|
|
|
3882
3633
|
const SET_SCOPE_REGISTER_ID = "$compat_setScope";
|
|
3883
3634
|
const RENDER_BODY_ID = "$compat_renderBody";
|
|
3884
3635
|
//#endregion
|
|
3636
|
+
//#region src/common/for.ts
|
|
3637
|
+
function forIn(obj, cb) {
|
|
3638
|
+
for (const key in obj) cb(key, obj[key]);
|
|
3639
|
+
}
|
|
3640
|
+
function forOf(list, cb) {
|
|
3641
|
+
assertValidList(list);
|
|
3642
|
+
if (list) {
|
|
3643
|
+
let i = 0;
|
|
3644
|
+
for (const item of list) cb(item, i++);
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
function forTo(to, from, step, cb) {
|
|
3648
|
+
assertValidRangeBound("to", to);
|
|
3649
|
+
assertOptionalRangeNumber("from", from);
|
|
3650
|
+
assertOptionalRangeNumber("step", step);
|
|
3651
|
+
const start = from || 0;
|
|
3652
|
+
const delta = step || 1;
|
|
3653
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
3654
|
+
}
|
|
3655
|
+
function forUntil(until, from, step, cb) {
|
|
3656
|
+
assertValidRangeBound("until", until);
|
|
3657
|
+
assertOptionalRangeNumber("from", from);
|
|
3658
|
+
assertOptionalRangeNumber("step", step);
|
|
3659
|
+
const start = from || 0;
|
|
3660
|
+
const delta = step || 1;
|
|
3661
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
3662
|
+
}
|
|
3663
|
+
//#endregion
|
|
3664
|
+
//#region src/html/for.ts
|
|
3665
|
+
function forOfBy(by, item, index) {
|
|
3666
|
+
return by ? typeof by === "string" ? item[by] : by(item, index) : index;
|
|
3667
|
+
}
|
|
3668
|
+
function forInBy(by, name, value) {
|
|
3669
|
+
return by ? by(name, value) : name;
|
|
3670
|
+
}
|
|
3671
|
+
function forStepBy(by, index) {
|
|
3672
|
+
return by ? by(index) : index;
|
|
3673
|
+
}
|
|
3674
|
+
//#endregion
|
|
3675
|
+
//#region src/html/control-flow.ts
|
|
3676
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
3677
|
+
if (display) {
|
|
3678
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
3679
|
+
} else $chunk.writeHTML("<t hidden>");
|
|
3680
|
+
}
|
|
3681
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3682
|
+
const branchId = _scope_id();
|
|
3683
|
+
const wrap = !display;
|
|
3684
|
+
if (wrap) $chunk.writeHTML("</t>");
|
|
3685
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
3686
|
+
}
|
|
3687
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3688
|
+
forBranches(by, cb, iterateForOf(list, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
3689
|
+
}
|
|
3690
|
+
function iterateForOf(list, cb, by) {
|
|
3691
|
+
return (each) => each ? forOf(list, (item, index) => {
|
|
3692
|
+
const itemKey = forOfBy(by, item, index);
|
|
3693
|
+
each(itemKey, itemKey === index, item, index);
|
|
3694
|
+
}) : forOf(list, cb);
|
|
3695
|
+
}
|
|
3696
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3697
|
+
forBranches(by, cb, iterateForIn(obj, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
3698
|
+
}
|
|
3699
|
+
function iterateForIn(obj, cb, by) {
|
|
3700
|
+
return (each) => each ? forIn(obj, (key, value) => {
|
|
3701
|
+
each(forInBy(by, key, value), false, key, value);
|
|
3702
|
+
}) : forIn(obj, cb);
|
|
3703
|
+
}
|
|
3704
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3705
|
+
forBranches(by, cb, iterateForTo(to, from, step, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
3706
|
+
}
|
|
3707
|
+
function iterateForTo(to, from, step, cb, by) {
|
|
3708
|
+
return (each) => {
|
|
3709
|
+
let index = 0;
|
|
3710
|
+
return each ? forTo(to, from, step, (value) => {
|
|
3711
|
+
const itemKey = forStepBy(by, value);
|
|
3712
|
+
each(itemKey, itemKey === index++, value);
|
|
3713
|
+
}) : forTo(to, from, step, cb);
|
|
3714
|
+
};
|
|
3715
|
+
}
|
|
3716
|
+
function _for_until(until, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3717
|
+
forBranches(by, cb, iterateForUntil(until, from, step, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
3718
|
+
}
|
|
3719
|
+
function iterateForUntil(until, from, step, cb, by) {
|
|
3720
|
+
return (each) => {
|
|
3721
|
+
let index = 0;
|
|
3722
|
+
return each ? forUntil(until, from, step, (value) => {
|
|
3723
|
+
const itemKey = forStepBy(by, value);
|
|
3724
|
+
each(itemKey, itemKey === index++, value);
|
|
3725
|
+
}) : forUntil(until, from, step, cb);
|
|
3726
|
+
};
|
|
3727
|
+
}
|
|
3728
|
+
function checkLoopKeys(cb, iterate) {
|
|
3729
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
3730
|
+
return (each) => iterate((itemKey, sameAsIndex, a, b) => {
|
|
3731
|
+
assertValidLoopKey(itemKey, seenKeys);
|
|
3732
|
+
if (each) each(itemKey, sameAsIndex, a, b);
|
|
3733
|
+
else cb(a, b);
|
|
3734
|
+
});
|
|
3735
|
+
}
|
|
3736
|
+
function forBranches(by, cb, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3737
|
+
if (by) iterate = checkLoopKeys(cb, iterate);
|
|
3738
|
+
if (branchGuard === 0) {
|
|
3739
|
+
iterate(0);
|
|
3740
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
3741
|
+
return;
|
|
3742
|
+
}
|
|
3743
|
+
const { state } = $chunk.boundary;
|
|
3744
|
+
const resumeKeys = markerGuard !== 0;
|
|
3745
|
+
const resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag);
|
|
3746
|
+
let flushBranchIds = "";
|
|
3747
|
+
let loopScopes;
|
|
3748
|
+
iterate((itemKey, sameAsIndex, a, b) => {
|
|
3749
|
+
const branchId = _peek_scope_id();
|
|
3750
|
+
if (resumeMarker) {
|
|
3751
|
+
if (singleNode) flushBranchIds = " " + branchId + flushBranchIds;
|
|
3752
|
+
else {
|
|
3753
|
+
$chunk.writeHTML(state.mark("[", flushBranchIds));
|
|
3754
|
+
flushBranchIds = branchId + "";
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
withBranchId(branchId, cb, a, b);
|
|
3758
|
+
const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { [LoopKey]: itemKey } : {});
|
|
3759
|
+
if (!resumeMarker) loopScopes = push(loopScopes, branchScope);
|
|
3760
|
+
});
|
|
3761
|
+
if (loopScopes) writeScope(scopeId, { [BranchScopes + accessor]: loopScopes });
|
|
3762
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
3763
|
+
}
|
|
3764
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
3765
|
+
const resumeBranch = branchGuard !== 0;
|
|
3766
|
+
const resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag);
|
|
3767
|
+
const branchId = _peek_scope_id();
|
|
3768
|
+
const chunk = $chunk;
|
|
3769
|
+
const beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0;
|
|
3770
|
+
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
|
3771
|
+
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
3772
|
+
if (beforeBranch !== void 0) applyBranchStart(chunk, beforeBranch, shouldWriteBranch);
|
|
3773
|
+
if (shouldWriteBranch && (branchIndex || !resumeMarker)) writeScope(scopeId, {
|
|
3774
|
+
[ConditionalRenderer + accessor]: branchIndex || void 0,
|
|
3775
|
+
[BranchScopes + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
3776
|
+
});
|
|
3777
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
3778
|
+
}
|
|
3779
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
3780
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
3781
|
+
}
|
|
3782
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
3783
|
+
const endTag = parentEndTag || "";
|
|
3784
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
3785
|
+
const { state } = $chunk.boundary;
|
|
3786
|
+
const mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
3787
|
+
$chunk.writeHTML(mark + endTag);
|
|
3788
|
+
} else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
3789
|
+
else $chunk.writeHTML(endTag);
|
|
3790
|
+
}
|
|
3791
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
3792
|
+
const resumeMarker = markerGuard !== 0;
|
|
3793
|
+
if (!isPromise(promise)) {
|
|
3794
|
+
if (resumeMarker) {
|
|
3795
|
+
const branchId = _peek_scope_id();
|
|
3796
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
3797
|
+
withBranchId(branchId, content, promise);
|
|
3798
|
+
$chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
3799
|
+
} else content(promise);
|
|
3800
|
+
return;
|
|
3801
|
+
}
|
|
3802
|
+
const chunk = $chunk;
|
|
3803
|
+
const { boundary } = chunk;
|
|
3804
|
+
const startId = _peek_scope_id();
|
|
3805
|
+
const after = chunk.next = chunk.forkRest(boundary);
|
|
3806
|
+
chunk.async = true;
|
|
3807
|
+
captureContext(chunk);
|
|
3808
|
+
boundary.startAsync();
|
|
3809
|
+
promise.then((value) => {
|
|
3810
|
+
if (chunk.async) {
|
|
3811
|
+
chunk.async = false;
|
|
3812
|
+
if (!boundary.aborted) {
|
|
3813
|
+
const { state } = boundary;
|
|
3814
|
+
chunk.render(() => {
|
|
3815
|
+
if (resumeMarker) {
|
|
3816
|
+
const branchId = _peek_scope_id();
|
|
3817
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
3818
|
+
withBranchId(branchId, () => withAsyncContent({ parent: getAsyncContent(chunk) }, content, value));
|
|
3819
|
+
$chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
3820
|
+
} else {
|
|
3821
|
+
const renderedSince = _peek_scope_id() !== startId;
|
|
3822
|
+
const async = { parent: getAsyncContent(chunk) };
|
|
3823
|
+
withAsyncContent(async, content, value);
|
|
3824
|
+
async.visit = renderedSince && (after.html || after.next) ? $chunk.boundary.state.mark("]", scopeId + " " + accessor) : "";
|
|
3825
|
+
if (async.resumed) $chunk.writeHTML(async.visit);
|
|
3826
|
+
async.end = $chunk;
|
|
3827
|
+
}
|
|
3828
|
+
});
|
|
3829
|
+
if (!chunk.async && boundary.pendingReorders?.delete(chunk)) state.reorder(chunk);
|
|
3830
|
+
boundary.endAsync();
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
}, (err) => {
|
|
3834
|
+
chunk.async = false;
|
|
3835
|
+
boundary.abort(err);
|
|
3836
|
+
});
|
|
3837
|
+
}
|
|
3838
|
+
function _try(scopeId, accessor, content, placeholderContent, catchContent, placeholderId, catchId) {
|
|
3839
|
+
const placeholderBranchId = placeholderContent ? _scope_id() : 0;
|
|
3840
|
+
const branchId = _peek_scope_id();
|
|
3841
|
+
const chunk = $chunk;
|
|
3842
|
+
const { boundary } = chunk;
|
|
3843
|
+
const { state } = boundary;
|
|
3844
|
+
const { resumeWrites } = boundary;
|
|
3845
|
+
const beforeBranch = deferBranchStart(chunk);
|
|
3846
|
+
const renderers = () => writeTryRenderers(branchId, catchContent && _resume(catchContent, catchId), placeholderContent && _resume(placeholderContent, placeholderId));
|
|
3847
|
+
const writesRenderers = tryBoundary(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent, branchId, renderers);
|
|
3848
|
+
const keepsMarks = state.keepsTryMarks(chunk, resumeWrites);
|
|
3849
|
+
applyBranchStart(chunk, beforeBranch, keepsMarks);
|
|
3850
|
+
if (!keepsMarks) return;
|
|
3851
|
+
if (!writesRenderers) renderers();
|
|
3852
|
+
$chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
3853
|
+
}
|
|
3854
|
+
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
3855
|
+
const chunk = $chunk;
|
|
3856
|
+
const { boundary } = chunk;
|
|
3857
|
+
const body = chunk.fork(boundary, null);
|
|
3858
|
+
if (body === body.render(content)) {
|
|
3859
|
+
chunk.append(body);
|
|
3860
|
+
return;
|
|
3861
|
+
}
|
|
3862
|
+
chunk.next = chunk.forkRest(boundary);
|
|
3863
|
+
captureContext(chunk);
|
|
3864
|
+
chunk.placeholder = {
|
|
3865
|
+
body,
|
|
3866
|
+
render: placeholder,
|
|
3867
|
+
branchId,
|
|
3868
|
+
scopeId,
|
|
3869
|
+
placeholderBranchId
|
|
3870
|
+
};
|
|
3871
|
+
}
|
|
3872
|
+
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
3873
|
+
const chunk = $chunk;
|
|
3874
|
+
const { boundary } = chunk;
|
|
3875
|
+
const { state } = boundary;
|
|
3876
|
+
const bodyBoundary = new Boundary(state, void 0, boundary);
|
|
3877
|
+
if (catchContent) bodyBoundary.withinCatch = true;
|
|
3878
|
+
const body = chunk.fork(bodyBoundary, null);
|
|
3879
|
+
const bodyEnd = body.render(withBranchId, branchId, content);
|
|
3880
|
+
if (bodyBoundary.aborted) {
|
|
3881
|
+
if (!catchContent) throw bodyBoundary.reason;
|
|
3882
|
+
catchContent(bodyBoundary.reason);
|
|
3883
|
+
return true;
|
|
3884
|
+
}
|
|
3885
|
+
if (body === bodyEnd) {
|
|
3886
|
+
chunk.append(body);
|
|
3887
|
+
return false;
|
|
3888
|
+
}
|
|
3889
|
+
const renderersAtSettle = !bodyBoundary.resumeWrites;
|
|
3890
|
+
const bodyNext = bodyEnd.next = chunk.forkRest(boundary);
|
|
3891
|
+
chunk.next = body;
|
|
3892
|
+
boundary.startAsync();
|
|
3893
|
+
const reorderId = catchContent ? state.nextReorderId() : "";
|
|
3894
|
+
if (reorderId) {
|
|
3895
|
+
chunk.catchRange = {
|
|
3896
|
+
id: reorderId,
|
|
3897
|
+
end: bodyEnd
|
|
3898
|
+
};
|
|
3899
|
+
captureContext(chunk);
|
|
3900
|
+
}
|
|
3901
|
+
bodyBoundary.onNext = () => {
|
|
3902
|
+
if (boundary.aborted) return;
|
|
3903
|
+
if (bodyBoundary.aborted) {
|
|
3904
|
+
if (!reorderId) {
|
|
3905
|
+
boundary.abort(bodyBoundary.reason);
|
|
3906
|
+
return;
|
|
3907
|
+
}
|
|
3908
|
+
const streamed = !chunk.catchRange;
|
|
3909
|
+
const catchChunk = chunk.fork(boundary, null);
|
|
3910
|
+
chunk.catchRange = null;
|
|
3911
|
+
if (!renderersAtSettle) catchChunk.render(clearTryRenderers, branchId);
|
|
3912
|
+
const inOrder = catchChunk === catchChunk.render(catchContent, bodyBoundary.reason);
|
|
3913
|
+
if (boundary.aborted) return;
|
|
3914
|
+
if (bodyEnd.consumed || !inOrder) catchChunk.reorderBranch = branchId;
|
|
3915
|
+
if (bodyEnd.consumed) {
|
|
3916
|
+
catchChunk.reorderId = reorderId;
|
|
3917
|
+
state.reorder(catchChunk);
|
|
3918
|
+
} else {
|
|
3919
|
+
let reorder = null;
|
|
3920
|
+
if (!inOrder) reorder = catchChunk;
|
|
3921
|
+
else if (streamed) reorder = chunk.fork(boundary, null);
|
|
3922
|
+
if (reorder) reorder.reorderId = reorderId;
|
|
3923
|
+
const endMarker = state.mark("!", reorderId);
|
|
3924
|
+
let cut = body;
|
|
3925
|
+
while (cut.consumed) cut = cut.next;
|
|
3926
|
+
cut.async = false;
|
|
3927
|
+
cut.next = inOrder ? catchChunk : bodyNext;
|
|
3928
|
+
cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker;
|
|
3929
|
+
cut.scripts = cut.effects = cut.lastEffect = "";
|
|
3930
|
+
cut.placeholder = cut.reorderId = cut.catchRange = null;
|
|
3931
|
+
cut.deferredReorder = reorder;
|
|
3932
|
+
if (inOrder) catchChunk.next = bodyNext;
|
|
3933
|
+
}
|
|
3934
|
+
boundary.endAsync();
|
|
3935
|
+
} else if (!bodyBoundary.count) {
|
|
3936
|
+
if (renderersAtSettle && bodyBoundary.resumeWrites) bodyEnd.render(renderers);
|
|
3937
|
+
chunk.catchRange = null;
|
|
3938
|
+
boundary.endAsync();
|
|
3939
|
+
} else boundary.onNext();
|
|
3940
|
+
};
|
|
3941
|
+
return renderersAtSettle;
|
|
3942
|
+
}
|
|
3943
|
+
function clearTryRenderers(branchId) {
|
|
3944
|
+
writeScope(branchId, {
|
|
3945
|
+
[CatchContent]: 0,
|
|
3946
|
+
[PlaceholderContent]: _scope_with_id(branchId)["#PlaceholderContent"] && 0
|
|
3947
|
+
});
|
|
3948
|
+
}
|
|
3949
|
+
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
3950
|
+
writeScope(branchId, {
|
|
3951
|
+
[CatchContent]: catchContent,
|
|
3952
|
+
[PlaceholderContent]: placeholderContent
|
|
3953
|
+
});
|
|
3954
|
+
}
|
|
3955
|
+
//#endregion
|
|
3885
3956
|
//#region src/html/compat.ts
|
|
3886
3957
|
const K_TAGS_API_STATE = Symbol();
|
|
3887
3958
|
const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
@@ -3930,7 +4001,7 @@ const compat = {
|
|
|
3930
4001
|
return function toJSON() {
|
|
3931
4002
|
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
3932
4003
|
if (!compatRegistered) {
|
|
3933
|
-
const registered =
|
|
4004
|
+
const registered = REGISTRY.get(this);
|
|
3934
4005
|
if (registered) {
|
|
3935
4006
|
const scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
3936
4007
|
if (scopeId !== void 0) _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
@@ -3974,9 +4045,9 @@ const compat = {
|
|
|
3974
4045
|
let html = "";
|
|
3975
4046
|
let scripts = "";
|
|
3976
4047
|
if (reorders) for (const reorder of reorders) state.reorder(reorder);
|
|
3977
|
-
if (boundary.flush() === 0) ({html, scripts} = chunk.
|
|
4048
|
+
if (boundary.flush() === 0) ({html, scripts} = chunk.flush(boundary));
|
|
3978
4049
|
if (boundary.aborted) throw boundary.reason;
|
|
3979
|
-
if (boundary.count) throw new Error("Cannot serialize promise across tags/class compat layer.");
|
|
4050
|
+
if (boundary.count) throw /* @__PURE__ */ new Error("Cannot serialize promise across tags/class compat layer.");
|
|
3980
4051
|
return {
|
|
3981
4052
|
html,
|
|
3982
4053
|
scripts
|
|
@@ -4011,7 +4082,7 @@ const compat = {
|
|
|
4011
4082
|
}
|
|
4012
4083
|
});
|
|
4013
4084
|
head.render(() => {
|
|
4014
|
-
_set_scope_reason(willRerender ?
|
|
4085
|
+
_set_scope_reason(willRerender ? ALL_GROUPS : 0);
|
|
4015
4086
|
try {
|
|
4016
4087
|
renderer(normalizedInput);
|
|
4017
4088
|
} finally {
|
|
@@ -4059,7 +4130,7 @@ const compat = {
|
|
|
4059
4130
|
registerClassFunctions(input) {
|
|
4060
4131
|
for (const key in input) {
|
|
4061
4132
|
const value = input[key];
|
|
4062
|
-
if (typeof value === "function" && !
|
|
4133
|
+
if (typeof value === "function" && !REGISTRY.has(value)) register(RENDER_BODY_ID, value);
|
|
4063
4134
|
}
|
|
4064
4135
|
},
|
|
4065
4136
|
registerClassFunction($global, id, fn, hostId) {
|
|
@@ -4090,4 +4161,4 @@ function swapReorders(state, reorders) {
|
|
|
4090
4161
|
}
|
|
4091
4162
|
function NOOP() {}
|
|
4092
4163
|
//#endregion
|
|
4093
|
-
export { $global, _assert_class_toggles, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|
|
4164
|
+
export { $global, _assert_class_toggles, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _signal_read_error, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|