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