marko 6.4.0 → 6.4.1
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 +1 -1
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/reserved-id.d.ts +5 -0
- package/dist/common/errors.d.ts +1 -1
- package/dist/common/types.d.ts +3 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-BRO5aArp.js → dom-ClV4kVOO.js} +32 -16
- package/dist/debug/{dom-Btj2QJhk.mjs → dom-LFrKxOk5.mjs} +32 -16
- package/dist/debug/dom.js +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html.js +277 -222
- package/dist/debug/html.mjs +275 -220
- package/dist/dom/catch.feat.js +1 -1
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/signals.d.ts +3 -2
- package/dist/{dom-BSsI9OPC.js → dom-CNglVi8P.js} +13 -4
- package/dist/{dom-B-v8Gw6T.mjs → dom-DfP3MCo0.mjs} +13 -4
- package/dist/dom.js +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/html/attrs.d.ts +2 -2
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/inlined-runtimes.d.ts +1 -1
- package/dist/html/inlined-runtimes.debug.d.ts +1 -1
- package/dist/html/serializer.d.ts +1 -1
- package/dist/html/writer.d.ts +34 -22
- package/dist/html.d.ts +1 -1
- package/dist/html.js +224 -167
- package/dist/html.mjs +224 -167
- package/dist/translator/core/html-comment.d.ts +0 -7
- package/dist/translator/core/let.d.ts +0 -5
- package/dist/translator/core/show.d.ts +2 -5
- package/dist/translator/core/style.d.ts +6 -8
- package/dist/translator/index.d.ts +9 -0
- package/dist/translator/index.js +8573 -8458
- package/dist/translator/util/binding-has-prop.d.ts +1 -1
- package/dist/translator/util/binding-prop-tree.d.ts +4 -4
- package/dist/translator/util/bindings.d.ts +127 -0
- package/dist/translator/util/body-to-text-literal.d.ts +1 -2
- package/dist/translator/util/branch-tag.d.ts +7 -7
- package/dist/translator/util/constants/binding-type.d.ts +5 -6
- package/dist/translator/util/constants/slot-kind.d.ts +14 -0
- package/dist/translator/util/constants/structure-kind.d.ts +1 -1
- package/dist/translator/util/evaluate.d.ts +11 -10
- package/dist/translator/util/finalize-references.d.ts +4 -0
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +3 -1
- package/dist/translator/util/get-declared-binding-expression.d.ts +2 -2
- package/dist/translator/util/is-core-tag.d.ts +0 -3
- package/dist/translator/util/is-only-child-in-parent.d.ts +2 -7
- package/dist/translator/util/known-tag.d.ts +8 -7
- package/dist/translator/util/read-replacement.d.ts +3 -0
- package/dist/translator/util/reasons.d.ts +32 -0
- package/dist/translator/util/references.d.ts +67 -166
- package/dist/translator/util/scope-accessor.d.ts +14 -0
- package/dist/translator/util/scope-read.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +48 -48
- package/dist/translator/util/set-tag-derived-from.d.ts +7 -0
- package/dist/translator/util/setup-work.d.ts +1 -2
- package/dist/translator/util/signals.d.ts +3 -5
- package/dist/translator/util/slots.d.ts +50 -0
- package/dist/translator/util/solve-reasons.d.ts +10 -0
- package/dist/translator/util/sources.d.ts +21 -0
- package/dist/translator/util/structure.d.ts +5 -2
- package/dist/translator/util/tag-facts.d.ts +21 -0
- package/dist/translator/util/tag-name-type.d.ts +4 -1
- package/dist/translator/util/translate-attrs.d.ts +2 -0
- package/dist/translator/util/translate-var.d.ts +3 -0
- package/dist/translator/util/write-guard.d.ts +12 -0
- package/dist/translator/util/writer.d.ts +3 -3
- package/dist/translator/visitors/export-declaration.d.ts +9 -0
- package/dist/translator/visitors/function.d.ts +5 -4
- package/dist/translator/visitors/import-declaration.d.ts +2 -2
- package/dist/translator/visitors/placeholder.d.ts +0 -3
- package/dist/translator/visitors/program/index.d.ts +13 -3
- package/dist/translator/visitors/referenced-identifier.d.ts +2 -1
- package/dist/translator/visitors/tag/custom-tag.d.ts +1 -1
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -3
- package/dist/translator/visitors/tag/index.d.ts +2 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +26 -12
- package/package.json +2 -2
- package/dist/translator/util/insertion-context.d.ts +0 -1
- package/dist/translator/util/is-non-html-text.d.ts +0 -3
- package/dist/translator/util/serialize-guard.d.ts +0 -11
- package/dist/translator/util/serialize-reasons.d.ts +0 -37
- package/dist/translator/util/set-tag-sections-downstream.d.ts +0 -6
package/dist/html.js
CHANGED
|
@@ -248,8 +248,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
248
248
|
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
249
249
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
250
250
|
return state.needsMainRuntime = !0, countResumeWrite($chunk), Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
251
|
-
}, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs,
|
|
252
|
-
let shouldResume =
|
|
251
|
+
}, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard) => {
|
|
252
|
+
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
253
253
|
if (typeof renderer == "string") {
|
|
254
254
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
255
255
|
rendered = !0, (() => {
|
|
@@ -258,7 +258,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
258
258
|
if (renderer === "textarea") _html(_attrs_textarea_value(branchId, "a", input));
|
|
259
259
|
else {
|
|
260
260
|
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
261
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0,
|
|
261
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard);
|
|
262
262
|
}
|
|
263
263
|
_html(`</${renderer}>`);
|
|
264
264
|
}
|
|
@@ -268,12 +268,12 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
268
268
|
} else {
|
|
269
269
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
270
270
|
if (renderer) try {
|
|
271
|
-
return
|
|
271
|
+
return _set_scope_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
272
272
|
...inputOrArgs,
|
|
273
273
|
content
|
|
274
274
|
} : inputOrArgs);
|
|
275
275
|
} finally {
|
|
276
|
-
|
|
276
|
+
_set_scope_reason(void 0);
|
|
277
277
|
}
|
|
278
278
|
else if (content) return content();
|
|
279
279
|
};
|
|
@@ -335,7 +335,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
335
335
|
flushScript($global, chunk) {
|
|
336
336
|
chunk ||= this.createChunk($global);
|
|
337
337
|
let { boundary } = chunk, scripts = boundary.flush() === 0 ? chunk.flushScript(boundary).scripts : "";
|
|
338
|
-
if (boundary.
|
|
338
|
+
if (boundary.aborted) throw boundary.reason;
|
|
339
339
|
if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
340
340
|
return scripts;
|
|
341
341
|
},
|
|
@@ -356,11 +356,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
356
356
|
let scopeId = _peek_scope_id();
|
|
357
357
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
360
360
|
try {
|
|
361
361
|
renderer(normalizedInput);
|
|
362
362
|
} finally {
|
|
363
|
-
|
|
363
|
+
_set_scope_reason(void 0);
|
|
364
364
|
}
|
|
365
365
|
let asyncOut = classAPIOut.beginAsync({
|
|
366
366
|
last: !0,
|
|
@@ -368,7 +368,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
368
368
|
});
|
|
369
369
|
classAPIOut.onLast((next) => {
|
|
370
370
|
(boundary.onNext = () => {
|
|
371
|
-
boundary.
|
|
371
|
+
boundary.aborted ? (asyncOut.error(boundary.reason), boundary.onNext = NOOP) : boundary.count || (boundary.onNext = NOOP, head = head.consume(boundary), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "", completeChunks.push(head), next());
|
|
372
372
|
})();
|
|
373
373
|
});
|
|
374
374
|
});
|
|
@@ -474,12 +474,6 @@ function forUntil(until, from, step, cb) {
|
|
|
474
474
|
}
|
|
475
475
|
//#endregion
|
|
476
476
|
//#region src/common/opt.ts
|
|
477
|
-
function forEach(opt, cb) {
|
|
478
|
-
if (opt) {
|
|
479
|
-
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
480
|
-
else cb(opt);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
477
|
function push(opt, item) {
|
|
484
478
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
485
479
|
}
|
|
@@ -609,13 +603,13 @@ function writeAssigned(state) {
|
|
|
609
603
|
let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
610
604
|
if (writeProp(state, mutation.object, null, "")) {
|
|
611
605
|
let objectRef = state.refs.get(mutation.object);
|
|
612
|
-
objectRef && objectRef.scopeId === void 0 && (objectRef.id ?
|
|
606
|
+
objectRef && objectRef.scopeId === void 0 && (!objectRef.id && !isAncestorChannelRef(state, objectRef) ? (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")) : hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")));
|
|
613
607
|
} else state.buf.push("void 0");
|
|
614
608
|
let valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
615
609
|
if (mutation.value !== void 0) {
|
|
616
610
|
if (writeProp(state, mutation.value, null, "")) {
|
|
617
611
|
let valueRef = typeof mutation.value == "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
618
|
-
valueRef && !valueRef.id && valueRef.scopeId === void 0 && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
612
|
+
valueRef && !valueRef.id && valueRef.scopeId === void 0 && !isAncestorChannelRef(state, valueRef) && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
619
613
|
} else state.buf.push("void 0");
|
|
620
614
|
}
|
|
621
615
|
state.buf.push(")");
|
|
@@ -628,7 +622,7 @@ function writeCallArg(state, val) {
|
|
|
628
622
|
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
629
623
|
else if (writeProp(state, val, null, "")) {
|
|
630
624
|
let ref = state.refs.get(val) || state.strs.get(val);
|
|
631
|
-
ref &&
|
|
625
|
+
ref && ensureId(state, ref);
|
|
632
626
|
} else state.buf.push("void 0");
|
|
633
627
|
}
|
|
634
628
|
function hasChannelMutations(state) {
|
|
@@ -680,7 +674,7 @@ function writeRegistered(state, val, parent, accessor, registered) {
|
|
|
680
674
|
let locals = registered.locals?.(state.boundary.state.scope);
|
|
681
675
|
if (locals) {
|
|
682
676
|
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
683
|
-
for (let local of locals) state.buf.push(","),
|
|
677
|
+
for (let local of locals) state.buf.push(","), writePlainObject(state, local, newArgReference(state, ref, local));
|
|
684
678
|
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
685
679
|
state.buf.push(")");
|
|
686
680
|
} else state.buf.push(registered.access);
|
|
@@ -880,6 +874,16 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
880
874
|
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
881
875
|
state.buf.push(")");
|
|
882
876
|
}
|
|
877
|
+
function newArgReference(state, parent, val) {
|
|
878
|
+
for (let key in val) {
|
|
879
|
+
let member = val[key];
|
|
880
|
+
if (isDedupedMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
881
|
+
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
882
|
+
return state.buf.push(ref.id + "="), ref;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
886
|
+
}
|
|
883
887
|
function isDedupedMember(val) {
|
|
884
888
|
switch (typeof val) {
|
|
885
889
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
@@ -983,14 +987,10 @@ function writeResponse(state, val, ref) {
|
|
|
983
987
|
return !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
|
|
984
988
|
}
|
|
985
989
|
function writeIntl(state, val, name, ref) {
|
|
986
|
-
let { locale, ...options } = val.resolvedOptions()
|
|
987
|
-
for (let key in options) if (isDedupedMember(options[key])) {
|
|
988
|
-
needsId = !0;
|
|
989
|
-
break;
|
|
990
|
-
}
|
|
990
|
+
let { locale, ...options } = val.resolvedOptions();
|
|
991
991
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
992
|
-
let optionsRef;
|
|
993
|
-
return
|
|
992
|
+
let optionsRef = newArgReference(state, ref, options);
|
|
993
|
+
return state.buf.push("{"), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
994
994
|
}
|
|
995
995
|
function writeIntlLocale(state, val) {
|
|
996
996
|
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
@@ -1001,7 +1001,7 @@ function writeTemporal(state, val, name) {
|
|
|
1001
1001
|
function writeReadableStream(state, val, ref) {
|
|
1002
1002
|
if (val.locked) return !1;
|
|
1003
1003
|
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1004
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1004
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1005
1005
|
}, onRejected = (reason) => {
|
|
1006
1006
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1007
1007
|
};
|
|
@@ -1027,19 +1027,16 @@ function writeGenerator(state, iter, ref) {
|
|
|
1027
1027
|
if (heldReturn) {
|
|
1028
1028
|
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1029
1029
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
1030
|
-
} else if (returnValue !== void 0) {
|
|
1031
|
-
let
|
|
1032
|
-
|
|
1033
|
-
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1034
|
-
retRef && !retRef.id && retRef.scopeId === void 0 && (retRef.id = nextRefAccess(state), state.buf[sepIndex] = "," + retRef.id + "=");
|
|
1035
|
-
}
|
|
1030
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isDedupedMember(returnValue))) {
|
|
1031
|
+
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1032
|
+
retRef && ensureId(state, retRef);
|
|
1036
1033
|
}
|
|
1037
1034
|
return state.buf.push(")"), !0;
|
|
1038
1035
|
}
|
|
1039
1036
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1040
1037
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1041
1038
|
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1042
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1039
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1043
1040
|
}, onRejected = (reason) => {
|
|
1044
1041
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1045
1042
|
};
|
|
@@ -1070,7 +1067,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1070
1067
|
return sep;
|
|
1071
1068
|
}
|
|
1072
1069
|
function writeAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1073
|
-
boundary.
|
|
1070
|
+
boundary.aborted || (state.mutated.push({
|
|
1074
1071
|
value,
|
|
1075
1072
|
object: handle,
|
|
1076
1073
|
property: method,
|
|
@@ -1088,6 +1085,9 @@ function trackChannel(state, ref) {
|
|
|
1088
1085
|
}
|
|
1089
1086
|
return !1;
|
|
1090
1087
|
}
|
|
1088
|
+
function isAncestorChannelRef(state, ref) {
|
|
1089
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
1090
|
+
}
|
|
1091
1091
|
function abortRender(boundary, err) {
|
|
1092
1092
|
for (; boundary.parent;) boundary = boundary.parent;
|
|
1093
1093
|
boundary.abort(err);
|
|
@@ -1171,7 +1171,7 @@ function quote(str, startPos) {
|
|
|
1171
1171
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1172
1172
|
}
|
|
1173
1173
|
function writeRef(state, ref) {
|
|
1174
|
-
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId,
|
|
1174
|
+
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) && !isAncestorChannelRef(state, ref) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, state.buf.push(ref.path)) : state.buf.push(ensureId(state, ref));
|
|
1175
1175
|
}
|
|
1176
1176
|
function ensureId(state, ref) {
|
|
1177
1177
|
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
@@ -1182,14 +1182,14 @@ function accessId(state, ref) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
function assignId(state, ref) {
|
|
1184
1184
|
let { pos } = ref;
|
|
1185
|
-
return
|
|
1185
|
+
return pos !== null && ref.flushId === state.flushId ? (ref.id = nextRefAccess(state), pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : isAncestorChannelRef(state, ref) ? ref.path || accessPath(state, ref) : (ref.id = nextRefAccess(state), ref.id + "=" + (ref.path || accessPath(state, ref)));
|
|
1186
1186
|
}
|
|
1187
1187
|
function accessPath(state, ref) {
|
|
1188
1188
|
let cur = ref, accessPrevValue = "";
|
|
1189
1189
|
do {
|
|
1190
1190
|
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1191
1191
|
let parent = cur.parent;
|
|
1192
|
-
if (parent.id
|
|
1192
|
+
if (parent.id) return trackChannel(state, parent), parent.id + accessPrevValue;
|
|
1193
1193
|
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1194
1194
|
cur = parent;
|
|
1195
1195
|
} while (cur);
|
|
@@ -1341,8 +1341,8 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
return result;
|
|
1343
1343
|
}
|
|
1344
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName,
|
|
1345
|
-
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1344
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1345
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1346
1346
|
}
|
|
1347
1347
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1348
1348
|
let partial = {};
|
|
@@ -1352,8 +1352,8 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1354
1354
|
}
|
|
1355
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName,
|
|
1356
|
-
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1355
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1356
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1357
1357
|
}
|
|
1358
1358
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1359
1359
|
writeScope(scopeId, serializeType ? {
|
|
@@ -1486,8 +1486,8 @@ function _html(html) {
|
|
|
1486
1486
|
function writeScript(script) {
|
|
1487
1487
|
$chunk.writeScript(script);
|
|
1488
1488
|
}
|
|
1489
|
-
function _script(scopeId, registryId,
|
|
1490
|
-
|
|
1489
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
1490
|
+
markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1491
1491
|
}
|
|
1492
1492
|
function _trailers(html) {
|
|
1493
1493
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1528,8 +1528,8 @@ function _resume_branch(scopeId) {
|
|
|
1528
1528
|
let branchId = $chunk.context?.[kBranchId];
|
|
1529
1529
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1530
1530
|
}
|
|
1531
|
-
function _attr_content(nodeAccessor, scopeId, content,
|
|
1532
|
-
let shouldResume =
|
|
1531
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1532
|
+
let shouldResume = markerGuard !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1533
1533
|
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1534
1534
|
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1535
1535
|
["D" + nodeAccessor]: rendererKey(render)
|
|
@@ -1548,48 +1548,48 @@ function writeScopePassive(scopeId, partialScope) {
|
|
|
1548
1548
|
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1549
1549
|
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1550
1550
|
}
|
|
1551
|
-
function _show_start(display,
|
|
1552
|
-
display ?
|
|
1551
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
1552
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1553
1553
|
}
|
|
1554
|
-
function _show_end(scopeId, accessor, display,
|
|
1554
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1555
1555
|
let branchId = _scope_id(), wrap = !display;
|
|
1556
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor,
|
|
1556
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1557
1557
|
}
|
|
1558
|
-
function _for_of(list, cb, by, scopeId, accessor,
|
|
1558
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1559
1559
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
1560
1560
|
let itemKey = forOfBy(by, item, index);
|
|
1561
1561
|
each(itemKey, itemKey === index, () => cb(item, index));
|
|
1562
|
-
}) : forOf(list, cb), scopeId, accessor,
|
|
1562
|
+
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1563
1563
|
}
|
|
1564
|
-
function _for_in(obj, cb, by, scopeId, accessor,
|
|
1564
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1565
1565
|
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
1566
1566
|
each(forInBy(by, key, value), !1, () => cb(key, value));
|
|
1567
|
-
}) : forIn(obj, cb), scopeId, accessor,
|
|
1567
|
+
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1568
1568
|
}
|
|
1569
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor,
|
|
1569
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1570
1570
|
forBranches(by, (each) => {
|
|
1571
1571
|
let index = 0;
|
|
1572
1572
|
return each ? forTo(to, from, step, (value) => {
|
|
1573
1573
|
let itemKey = forStepBy(by, value);
|
|
1574
1574
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1575
1575
|
}) : forTo(to, from, step, cb);
|
|
1576
|
-
}, scopeId, accessor,
|
|
1576
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1577
1577
|
}
|
|
1578
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor,
|
|
1578
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1579
1579
|
forBranches(by, (each) => {
|
|
1580
1580
|
let index = 0;
|
|
1581
1581
|
return each ? forUntil(to, from, step, (value) => {
|
|
1582
1582
|
let itemKey = forStepBy(by, value);
|
|
1583
1583
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1584
1584
|
}) : forUntil(to, from, step, cb);
|
|
1585
|
-
}, scopeId, accessor,
|
|
1585
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1586
1586
|
}
|
|
1587
|
-
function forBranches(by, iterate, scopeId, accessor,
|
|
1588
|
-
if (
|
|
1589
|
-
iterate(0), writeBranchEnd(scopeId, accessor,
|
|
1587
|
+
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1588
|
+
if (branchGuard === 0) {
|
|
1589
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
1590
1590
|
return;
|
|
1591
1591
|
}
|
|
1592
|
-
let { state } = $chunk.boundary, resumeKeys =
|
|
1592
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
1593
1593
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1594
1594
|
let branchId = _peek_scope_id();
|
|
1595
1595
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1597,14 +1597,14 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1597
1597
|
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
1598
1598
|
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
1599
1599
|
});
|
|
1600
|
-
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor,
|
|
1600
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1601
1601
|
}
|
|
1602
|
-
function _if(cb, scopeId, accessor,
|
|
1603
|
-
let resumeBranch =
|
|
1602
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1603
|
+
let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1604
1604
|
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1605
1605
|
["D" + accessor]: branchIndex || void 0,
|
|
1606
1606
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1607
|
-
}), writeBranchEnd(scopeId, accessor,
|
|
1607
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1608
1608
|
}
|
|
1609
1609
|
function deferBranchStart(chunk) {
|
|
1610
1610
|
let beforeBranch = chunk.html;
|
|
@@ -1613,14 +1613,15 @@ function deferBranchStart(chunk) {
|
|
|
1613
1613
|
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1614
1614
|
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
1617
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
1618
|
+
}
|
|
1619
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
1617
1620
|
let endTag = parentEndTag || "";
|
|
1618
|
-
if (
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1623
|
-
} else $chunk.writeHTML(endTag);
|
|
1621
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
1622
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1623
|
+
$chunk.writeHTML(mark + endTag);
|
|
1624
|
+
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1624
1625
|
}
|
|
1625
1626
|
function _existing_scope(scopeId) {
|
|
1626
1627
|
return writeScope(scopeId, {});
|
|
@@ -1632,28 +1633,28 @@ function scopeWithId(state, scopeId) {
|
|
|
1632
1633
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1633
1634
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1634
1635
|
}
|
|
1635
|
-
function _subscribe(subscribers, scope, resumeId,
|
|
1636
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1636
1637
|
if (subscribers) {
|
|
1637
1638
|
let { serializer } = $chunk.boundary.state;
|
|
1638
|
-
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId,
|
|
1639
|
+
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId, markerGuard) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1639
1640
|
}
|
|
1640
1641
|
return scope;
|
|
1641
1642
|
}
|
|
1642
1643
|
function maskGroup(mask, group) {
|
|
1643
1644
|
return mask === 715827883 ? 1 : typeof mask == "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
|
|
1644
1645
|
}
|
|
1645
|
-
function
|
|
1646
|
-
$chunk.boundary.state.
|
|
1646
|
+
function _set_scope_reason(reason) {
|
|
1647
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
1647
1648
|
}
|
|
1648
1649
|
function _scope_reason() {
|
|
1649
|
-
let reason = $chunk.boundary.state.
|
|
1650
|
-
return $chunk.boundary.state.
|
|
1650
|
+
let reason = $chunk.boundary.state.scopeReason;
|
|
1651
|
+
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1651
1652
|
}
|
|
1652
|
-
function
|
|
1653
|
+
function _write_if(condition, key) {
|
|
1653
1654
|
return condition && maskGroup(condition, key) ? 1 : void 0;
|
|
1654
1655
|
}
|
|
1655
|
-
function
|
|
1656
|
-
return
|
|
1656
|
+
function _write_guard(condition, key) {
|
|
1657
|
+
return _write_if(condition, key) || 0;
|
|
1657
1658
|
}
|
|
1658
1659
|
function writeWaitReady(readyId, renderer, input) {
|
|
1659
1660
|
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
@@ -1663,10 +1664,11 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
1663
1664
|
writeScopes: {},
|
|
1664
1665
|
flushScopes: !1
|
|
1665
1666
|
}), bodyEnd = body.render(renderer, input);
|
|
1667
|
+
if (boundary.aborted) throw boundary.reason;
|
|
1666
1668
|
body === bodyEnd ? (chunk.writeHTML(body.html), body.deferOwnReady(), chunk.deferredReady = push(chunk.deferredReady, body)) : (bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next), chunk.next = body);
|
|
1667
1669
|
}
|
|
1668
|
-
function _await(scopeId, accessor, promise, content,
|
|
1669
|
-
let resumeMarker =
|
|
1670
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
1671
|
+
let resumeMarker = markerGuard !== 0;
|
|
1670
1672
|
if (!isPromise(promise)) {
|
|
1671
1673
|
if (resumeMarker) {
|
|
1672
1674
|
let branchId = _peek_scope_id();
|
|
@@ -1676,15 +1678,18 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1676
1678
|
}
|
|
1677
1679
|
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1678
1680
|
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1679
|
-
chunk.async && (chunk.async = !1, boundary.
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1681
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
1682
|
+
let { state } = boundary;
|
|
1683
|
+
chunk.render(() => {
|
|
1684
|
+
if (resumeMarker) {
|
|
1685
|
+
let branchId = _peek_scope_id();
|
|
1686
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1687
|
+
} else {
|
|
1688
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1689
|
+
withIsAsync(async, content, value), async.visit = renderedSince && (after.html || after.next) ? $chunk.boundary.state.mark("]", scopeId + " " + accessor) : "", async.resumed && $chunk.writeHTML(async.visit), async.end = $chunk;
|
|
1690
|
+
}
|
|
1691
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
1692
|
+
}
|
|
1688
1693
|
}, (err) => {
|
|
1689
1694
|
chunk.async = !1, boundary.abort(err);
|
|
1690
1695
|
});
|
|
@@ -1708,29 +1713,39 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1708
1713
|
};
|
|
1709
1714
|
}
|
|
1710
1715
|
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1711
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1712
|
-
if (catchBoundary.
|
|
1716
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, void 0, boundary), body = chunk.fork(catchBoundary, null), bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
1717
|
+
if (catchBoundary.aborted) {
|
|
1718
|
+
if (!catchContent) throw catchBoundary.reason;
|
|
1719
|
+
return catchContent(catchBoundary.reason), !0;
|
|
1720
|
+
}
|
|
1713
1721
|
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1714
1722
|
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1715
1723
|
chunk.next = body, boundary.startAsync();
|
|
1716
|
-
let reorderId = catchContent ? state.nextReorderId() : ""
|
|
1717
|
-
return reorderId && (chunk.
|
|
1718
|
-
|
|
1719
|
-
|
|
1724
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
1725
|
+
return reorderId && (chunk.catchRange = {
|
|
1726
|
+
id: reorderId,
|
|
1727
|
+
end: bodyEnd
|
|
1728
|
+
}, captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1729
|
+
if (!boundary.aborted) {
|
|
1730
|
+
if (catchBoundary.aborted) {
|
|
1720
1731
|
if (!reorderId) {
|
|
1721
|
-
boundary.abort(catchBoundary.
|
|
1732
|
+
boundary.abort(catchBoundary.reason);
|
|
1722
1733
|
return;
|
|
1723
1734
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1735
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1736
|
+
chunk.catchRange = null;
|
|
1737
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1738
|
+
if (boundary.aborted) return;
|
|
1739
|
+
if (bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1740
|
+
else {
|
|
1741
|
+
let reorder = null;
|
|
1742
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
1743
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
1744
|
+
for (; cut.consumed;) cut = cut.next;
|
|
1745
|
+
cut.async = !1, cut.next = inOrder ? catchChunk : bodyNext, cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker, cut.scripts = cut.effects = cut.lastEffect = "", cut.placeholder = cut.reorderId = cut.catchRange = null, cut.deferredReorder = reorder, inOrder && (catchChunk.next = bodyNext);
|
|
1730
1746
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), boundary.endAsync());
|
|
1747
|
+
boundary.endAsync();
|
|
1748
|
+
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
1734
1749
|
}
|
|
1735
1750
|
}, renderersAtSettle;
|
|
1736
1751
|
}
|
|
@@ -1769,7 +1784,7 @@ var State = class {
|
|
|
1769
1784
|
flushScopes = !1;
|
|
1770
1785
|
writeScopes = {};
|
|
1771
1786
|
readyIds = null;
|
|
1772
|
-
|
|
1787
|
+
scopeReason;
|
|
1773
1788
|
$global;
|
|
1774
1789
|
constructor($global) {
|
|
1775
1790
|
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
@@ -1810,28 +1825,40 @@ var State = class {
|
|
|
1810
1825
|
mark(code, str) {
|
|
1811
1826
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1812
1827
|
}
|
|
1813
|
-
}, Boundary = class
|
|
1828
|
+
}, Boundary = class {
|
|
1814
1829
|
onNext = NOOP$2;
|
|
1815
1830
|
count = 0;
|
|
1816
1831
|
resumeWrites = 0;
|
|
1817
1832
|
state;
|
|
1818
1833
|
parent;
|
|
1834
|
+
aborted = !1;
|
|
1835
|
+
reason;
|
|
1836
|
+
pendingReorders;
|
|
1837
|
+
children;
|
|
1819
1838
|
constructor(state, signal, parent) {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1839
|
+
this.state = state, this.parent = parent, parent ? parent.aborted ? this.abort(parent.reason) : (parent.children ||= []).push(this) : signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort", this));
|
|
1840
|
+
}
|
|
1841
|
+
abort(reason) {
|
|
1842
|
+
if (this.aborted) return;
|
|
1843
|
+
let { state } = this;
|
|
1844
|
+
if (this.aborted = !0, this.reason = reason, this.pendingReorders) {
|
|
1845
|
+
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1846
|
+
this.pendingReorders = void 0;
|
|
1847
|
+
}
|
|
1848
|
+
if (this.count = 0, this.state = new State(state.$global), this.children) for (let child of this.children) child.abort(reason);
|
|
1849
|
+
this.onNext();
|
|
1823
1850
|
}
|
|
1824
1851
|
handleEvent(event) {
|
|
1825
1852
|
this.abort(event.target.reason);
|
|
1826
1853
|
}
|
|
1827
1854
|
flush() {
|
|
1828
|
-
return this.
|
|
1855
|
+
return this.aborted || flushSerializer(this, this.state), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1829
1856
|
}
|
|
1830
1857
|
startAsync() {
|
|
1831
|
-
this.
|
|
1858
|
+
this.aborted || this.count++;
|
|
1832
1859
|
}
|
|
1833
1860
|
endAsync() {
|
|
1834
|
-
this.
|
|
1861
|
+
this.aborted || (this.count--, this.onNext());
|
|
1835
1862
|
}
|
|
1836
1863
|
}, Chunk = class Chunk {
|
|
1837
1864
|
html = "";
|
|
@@ -1840,9 +1867,10 @@ var State = class {
|
|
|
1840
1867
|
lastEffect = "";
|
|
1841
1868
|
async = !1;
|
|
1842
1869
|
consumed = !1;
|
|
1843
|
-
needsWalk = !1;
|
|
1844
1870
|
reorderId = null;
|
|
1845
1871
|
deferredReady = null;
|
|
1872
|
+
deferredReorder = null;
|
|
1873
|
+
catchRange = null;
|
|
1846
1874
|
placeholder = null;
|
|
1847
1875
|
boundary;
|
|
1848
1876
|
next;
|
|
@@ -1864,7 +1892,7 @@ var State = class {
|
|
|
1864
1892
|
this.scripts = concatScripts(this.scripts, script);
|
|
1865
1893
|
}
|
|
1866
1894
|
append(chunk) {
|
|
1867
|
-
this.html += chunk.html, this.
|
|
1895
|
+
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
|
|
1868
1896
|
}
|
|
1869
1897
|
takeDeferredReady() {
|
|
1870
1898
|
let { deferredReady } = this;
|
|
@@ -1876,25 +1904,59 @@ var State = class {
|
|
|
1876
1904
|
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1877
1905
|
}
|
|
1878
1906
|
}
|
|
1879
|
-
|
|
1907
|
+
renderPlaceholders(boundary) {
|
|
1908
|
+
let { state } = boundary;
|
|
1909
|
+
restart: for (;;) {
|
|
1910
|
+
let reorders = null;
|
|
1911
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
1912
|
+
if (cur.renderPlaceholder(state)) {
|
|
1913
|
+
if (boundary.aborted) return;
|
|
1914
|
+
continue restart;
|
|
1915
|
+
}
|
|
1916
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1917
|
+
}
|
|
1918
|
+
if (state.writeReorders) {
|
|
1919
|
+
for (let reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === !1) {
|
|
1920
|
+
if (boundary.aborted) return;
|
|
1921
|
+
continue restart;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === !1) {
|
|
1925
|
+
if (boundary.aborted) return;
|
|
1926
|
+
continue restart;
|
|
1927
|
+
}
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
renderPlaceholder(state) {
|
|
1880
1932
|
let { placeholder } = this;
|
|
1881
|
-
if (placeholder)
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1933
|
+
if (!placeholder || (this.placeholder = null, this.boundary.aborted)) return !1;
|
|
1934
|
+
let { body } = placeholder, end = body;
|
|
1935
|
+
for (; end.next && !end.async;) end = end.next;
|
|
1936
|
+
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
1937
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
1938
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
1939
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1940
|
+
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
|
|
1941
|
+
let stateful = this.effects !== effects;
|
|
1942
|
+
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), end.writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
|
|
1943
|
+
}
|
|
1944
|
+
markCatchRange() {
|
|
1945
|
+
let { catchRange } = this;
|
|
1946
|
+
if (catchRange) {
|
|
1947
|
+
let { state } = this.boundary;
|
|
1948
|
+
this.catchRange = null, this.writeHTML(state.mark("!^", catchRange.id)), catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
1892
1949
|
}
|
|
1893
1950
|
}
|
|
1894
|
-
|
|
1895
|
-
let
|
|
1896
|
-
|
|
1897
|
-
|
|
1951
|
+
queueDeferredReorder() {
|
|
1952
|
+
let { deferredReorder } = this;
|
|
1953
|
+
deferredReorder && (this.deferredReorder = null, deferredReorder.boundary.state.reorder(deferredReorder));
|
|
1954
|
+
}
|
|
1955
|
+
consume(boundary) {
|
|
1956
|
+
this.renderPlaceholders(boundary);
|
|
1957
|
+
let cur = this, html = "", effects = "", scripts = "", lastEffect = "", deferredReady;
|
|
1958
|
+
for (; cur.next && !cur.async;) cur.markCatchRange(), cur.queueDeferredReorder(), html += cur.html, cur.serializeState.readyId ? deferredReady = push(deferredReady, cur) : (effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect), deferredReady = concat(deferredReady, cur.takeDeferredReady()), cur.consumed = !0, cur = cur.next;
|
|
1959
|
+
return cur.deferOwnReady(), cur.deferredReady = concat(deferredReady, cur.deferredReady), cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect ||= lastEffect, cur;
|
|
1898
1960
|
}
|
|
1899
1961
|
render(content, val) {
|
|
1900
1962
|
let prev = $chunk;
|
|
@@ -1908,10 +1970,9 @@ var State = class {
|
|
|
1908
1970
|
}
|
|
1909
1971
|
}
|
|
1910
1972
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1911
|
-
let { serializeState } = this, { readyId } = serializeState, scripts = "";
|
|
1912
|
-
if (
|
|
1913
|
-
|
|
1914
|
-
}), readyId && !this.async) {
|
|
1973
|
+
let { serializeState } = this, { readyId } = serializeState, scripts = "", held = this.takeDeferredReady();
|
|
1974
|
+
if (held) for (let chunk of Array.isArray(held) ? held : [held]) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
|
|
1975
|
+
if (readyId && !this.async) {
|
|
1915
1976
|
let { state } = boundary;
|
|
1916
1977
|
flushSerializer(boundary, serializeState);
|
|
1917
1978
|
let deps = state.serializer.takeChannelDeps(), effects = holdEffects ? "" : this.effects, { resumes } = serializeState, chunkScripts = this.scripts;
|
|
@@ -1931,7 +1992,7 @@ var State = class {
|
|
|
1931
1992
|
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1932
1993
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1933
1994
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1934
|
-
for (let channel; !boundary.
|
|
1995
|
+
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1935
1996
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1936
1997
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1937
1998
|
}
|
|
@@ -1940,40 +2001,36 @@ var State = class {
|
|
|
1940
2001
|
state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"");
|
|
1941
2002
|
let reordered = "", needsResumeArray = !1;
|
|
1942
2003
|
if (state.writeReorders) {
|
|
1943
|
-
let carried = null;
|
|
1944
2004
|
for (let reorderedChunk of state.writeReorders) {
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
(carried ||= []).push(reorderedChunk);
|
|
1950
|
-
continue;
|
|
1951
|
-
}
|
|
1952
|
-
reorderedChunk.async = !1;
|
|
1953
|
-
}
|
|
1954
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1955
|
-
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1956
|
-
for (reorderedChunk.reorderId = null;;) {
|
|
1957
|
-
cur.flushPlaceholder(), cur.deferOwnReady();
|
|
2005
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
2006
|
+
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2007
|
+
for (reorderedChunk.reorderId = null; cur;) {
|
|
2008
|
+
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
1958
2009
|
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
1959
|
-
|
|
1960
|
-
else break;
|
|
2010
|
+
this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), (cur.boundary.pendingReorders ||= /* @__PURE__ */ new Set()).add(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), cur = next;
|
|
1961
2011
|
}
|
|
1962
2012
|
reorderEffects && (this.async ? (this.effects = concatEffects(this.effects, reorderEffects), this.lastEffect = "") : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
1963
2013
|
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
1964
2014
|
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1965
2015
|
}
|
|
1966
|
-
state.writeReorders =
|
|
2016
|
+
state.writeReorders = null;
|
|
1967
2017
|
}
|
|
1968
2018
|
return flushSerializer(boundary, state), (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1969
2019
|
}
|
|
1970
2020
|
flushHTML(boundary) {
|
|
1971
2021
|
let { state } = boundary;
|
|
1972
|
-
this.
|
|
2022
|
+
this.flushScript(boundary);
|
|
1973
2023
|
let { html, scripts } = this;
|
|
1974
2024
|
return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
|
|
1975
2025
|
}
|
|
1976
2026
|
};
|
|
2027
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
2028
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
2029
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return !1;
|
|
2030
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
2031
|
+
}
|
|
2032
|
+
return reorders;
|
|
2033
|
+
}
|
|
1977
2034
|
function flushSerializer(boundary, serializeState) {
|
|
1978
2035
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1979
2036
|
if (serializeState.flushScopes || pending) {
|
|
@@ -2224,11 +2281,11 @@ var ServerRendered = class {
|
|
|
2224
2281
|
(boundary.onNext = () => {
|
|
2225
2282
|
switch (!boundary.count && boundary.flush()) {
|
|
2226
2283
|
case 2:
|
|
2227
|
-
settle(boundary), reject(boundary.
|
|
2284
|
+
settle(boundary), reject(boundary.reason);
|
|
2228
2285
|
break;
|
|
2229
2286
|
case 0:
|
|
2230
|
-
if (head = head.consume(), boundary.
|
|
2231
|
-
html += head.flushHTML(boundary), boundary.count || boundary.
|
|
2287
|
+
if (head = head.consume(boundary), boundary.aborted) break;
|
|
2288
|
+
html += head.flushHTML(boundary), boundary.count || boundary.aborted || (settle(boundary), resolve(html));
|
|
2232
2289
|
}
|
|
2233
2290
|
})();
|
|
2234
2291
|
});
|
|
@@ -2249,13 +2306,13 @@ var ServerRendered = class {
|
|
|
2249
2306
|
again = !1;
|
|
2250
2307
|
let status = boundary.flush();
|
|
2251
2308
|
if (status === 2) {
|
|
2252
|
-
tick || offTick(onNext), settle(boundary), onAbort(boundary.
|
|
2309
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
|
|
2253
2310
|
return;
|
|
2254
2311
|
}
|
|
2255
2312
|
if (write || status === 0) {
|
|
2256
|
-
if (head = head.consume(), boundary.
|
|
2313
|
+
if (head = head.consume(boundary), boundary.aborted) continue;
|
|
2257
2314
|
let html = head.flushHTML(boundary);
|
|
2258
|
-
if (boundary.
|
|
2315
|
+
if (boundary.aborted) continue;
|
|
2259
2316
|
if (html && onWrite(html), !boundary.count) {
|
|
2260
2317
|
tick || offTick(onNext), settle(boundary), onClose();
|
|
2261
2318
|
return;
|
|
@@ -2270,8 +2327,8 @@ var ServerRendered = class {
|
|
|
2270
2327
|
toString() {
|
|
2271
2328
|
let head = this.#head;
|
|
2272
2329
|
if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
|
|
2273
|
-
let { boundary } = head, html = boundary.flush() === 0 ? head.consume().flushHTML(boundary) : "";
|
|
2274
|
-
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.
|
|
2330
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2331
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2275
2332
|
return html;
|
|
2276
2333
|
}
|
|
2277
2334
|
};
|
|
@@ -2351,4 +2408,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
|
|
|
2351
2408
|
get: function() {
|
|
2352
2409
|
return _dynamic_tag;
|
|
2353
2410
|
}
|
|
2354
|
-
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports.
|
|
2411
|
+
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._set_scope_reason = _set_scope_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._text_resume = _text_resume, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports._write_guard = _write_guard, exports._write_if = _write_if, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|