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.mjs
CHANGED
|
@@ -247,8 +247,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
247
247
|
}, 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) => {
|
|
248
248
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
249
249
|
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;
|
|
250
|
-
}, 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,
|
|
251
|
-
let shouldResume =
|
|
250
|
+
}, 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) => {
|
|
251
|
+
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
252
252
|
if (typeof renderer == "string") {
|
|
253
253
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
254
254
|
rendered = !0, (() => {
|
|
@@ -257,7 +257,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
257
257
|
if (renderer === "textarea") _html(_attrs_textarea_value(branchId, "a", input));
|
|
258
258
|
else {
|
|
259
259
|
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
-
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,
|
|
260
|
+
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);
|
|
261
261
|
}
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
@@ -267,12 +267,12 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
269
269
|
if (renderer) try {
|
|
270
|
-
return
|
|
270
|
+
return _set_scope_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
271
271
|
...inputOrArgs,
|
|
272
272
|
content
|
|
273
273
|
} : inputOrArgs);
|
|
274
274
|
} finally {
|
|
275
|
-
|
|
275
|
+
_set_scope_reason(void 0);
|
|
276
276
|
}
|
|
277
277
|
else if (content) return content();
|
|
278
278
|
};
|
|
@@ -334,7 +334,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
334
334
|
flushScript($global, chunk) {
|
|
335
335
|
chunk ||= this.createChunk($global);
|
|
336
336
|
let { boundary } = chunk, scripts = boundary.flush() === 0 ? chunk.flushScript(boundary).scripts : "";
|
|
337
|
-
if (boundary.
|
|
337
|
+
if (boundary.aborted) throw boundary.reason;
|
|
338
338
|
if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
339
339
|
return scripts;
|
|
340
340
|
},
|
|
@@ -355,11 +355,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
355
355
|
let scopeId = _peek_scope_id();
|
|
356
356
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
357
357
|
}
|
|
358
|
-
|
|
358
|
+
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
359
359
|
try {
|
|
360
360
|
renderer(normalizedInput);
|
|
361
361
|
} finally {
|
|
362
|
-
|
|
362
|
+
_set_scope_reason(void 0);
|
|
363
363
|
}
|
|
364
364
|
let asyncOut = classAPIOut.beginAsync({
|
|
365
365
|
last: !0,
|
|
@@ -367,7 +367,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
367
367
|
});
|
|
368
368
|
classAPIOut.onLast((next) => {
|
|
369
369
|
(boundary.onNext = () => {
|
|
370
|
-
boundary.
|
|
370
|
+
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());
|
|
371
371
|
})();
|
|
372
372
|
});
|
|
373
373
|
});
|
|
@@ -472,12 +472,6 @@ function forUntil(until, from, step, cb) {
|
|
|
472
472
|
}
|
|
473
473
|
//#endregion
|
|
474
474
|
//#region src/common/opt.ts
|
|
475
|
-
function forEach(opt, cb) {
|
|
476
|
-
if (opt) {
|
|
477
|
-
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
478
|
-
else cb(opt);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
475
|
function push(opt, item) {
|
|
482
476
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
483
477
|
}
|
|
@@ -607,13 +601,13 @@ function writeAssigned(state) {
|
|
|
607
601
|
let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
608
602
|
if (writeProp(state, mutation.object, null, "")) {
|
|
609
603
|
let objectRef = state.refs.get(mutation.object);
|
|
610
|
-
objectRef && objectRef.scopeId === void 0 && (objectRef.id ?
|
|
604
|
+
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(")")));
|
|
611
605
|
} else state.buf.push("void 0");
|
|
612
606
|
let valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
613
607
|
if (mutation.value !== void 0) {
|
|
614
608
|
if (writeProp(state, mutation.value, null, "")) {
|
|
615
609
|
let valueRef = typeof mutation.value == "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
616
|
-
valueRef && !valueRef.id && valueRef.scopeId === void 0 && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
610
|
+
valueRef && !valueRef.id && valueRef.scopeId === void 0 && !isAncestorChannelRef(state, valueRef) && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
617
611
|
} else state.buf.push("void 0");
|
|
618
612
|
}
|
|
619
613
|
state.buf.push(")");
|
|
@@ -626,7 +620,7 @@ function writeCallArg(state, val) {
|
|
|
626
620
|
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
627
621
|
else if (writeProp(state, val, null, "")) {
|
|
628
622
|
let ref = state.refs.get(val) || state.strs.get(val);
|
|
629
|
-
ref &&
|
|
623
|
+
ref && ensureId(state, ref);
|
|
630
624
|
} else state.buf.push("void 0");
|
|
631
625
|
}
|
|
632
626
|
function hasChannelMutations(state) {
|
|
@@ -678,7 +672,7 @@ function writeRegistered(state, val, parent, accessor, registered) {
|
|
|
678
672
|
let locals = registered.locals?.(state.boundary.state.scope);
|
|
679
673
|
if (locals) {
|
|
680
674
|
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
681
|
-
for (let local of locals) state.buf.push(","),
|
|
675
|
+
for (let local of locals) state.buf.push(","), writePlainObject(state, local, newArgReference(state, ref, local));
|
|
682
676
|
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
683
677
|
state.buf.push(")");
|
|
684
678
|
} else state.buf.push(registered.access);
|
|
@@ -878,6 +872,16 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
878
872
|
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
879
873
|
state.buf.push(")");
|
|
880
874
|
}
|
|
875
|
+
function newArgReference(state, parent, val) {
|
|
876
|
+
for (let key in val) {
|
|
877
|
+
let member = val[key];
|
|
878
|
+
if (isDedupedMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
879
|
+
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
880
|
+
return state.buf.push(ref.id + "="), ref;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
884
|
+
}
|
|
881
885
|
function isDedupedMember(val) {
|
|
882
886
|
switch (typeof val) {
|
|
883
887
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
@@ -981,14 +985,10 @@ function writeResponse(state, val, ref) {
|
|
|
981
985
|
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;
|
|
982
986
|
}
|
|
983
987
|
function writeIntl(state, val, name, ref) {
|
|
984
|
-
let { locale, ...options } = val.resolvedOptions()
|
|
985
|
-
for (let key in options) if (isDedupedMember(options[key])) {
|
|
986
|
-
needsId = !0;
|
|
987
|
-
break;
|
|
988
|
-
}
|
|
988
|
+
let { locale, ...options } = val.resolvedOptions();
|
|
989
989
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
990
|
-
let optionsRef;
|
|
991
|
-
return
|
|
990
|
+
let optionsRef = newArgReference(state, ref, options);
|
|
991
|
+
return state.buf.push("{"), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
992
992
|
}
|
|
993
993
|
function writeIntlLocale(state, val) {
|
|
994
994
|
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
@@ -999,7 +999,7 @@ function writeTemporal(state, val, name) {
|
|
|
999
999
|
function writeReadableStream(state, val, ref) {
|
|
1000
1000
|
if (val.locked) return !1;
|
|
1001
1001
|
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1002
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1002
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1003
1003
|
}, onRejected = (reason) => {
|
|
1004
1004
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1005
1005
|
};
|
|
@@ -1025,19 +1025,16 @@ function writeGenerator(state, iter, ref) {
|
|
|
1025
1025
|
if (heldReturn) {
|
|
1026
1026
|
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1027
1027
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
1028
|
-
} else if (returnValue !== void 0) {
|
|
1029
|
-
let
|
|
1030
|
-
|
|
1031
|
-
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1032
|
-
retRef && !retRef.id && retRef.scopeId === void 0 && (retRef.id = nextRefAccess(state), state.buf[sepIndex] = "," + retRef.id + "=");
|
|
1033
|
-
}
|
|
1028
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isDedupedMember(returnValue))) {
|
|
1029
|
+
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1030
|
+
retRef && ensureId(state, retRef);
|
|
1034
1031
|
}
|
|
1035
1032
|
return state.buf.push(")"), !0;
|
|
1036
1033
|
}
|
|
1037
1034
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1038
1035
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1039
1036
|
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1040
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1037
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1041
1038
|
}, onRejected = (reason) => {
|
|
1042
1039
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1043
1040
|
};
|
|
@@ -1068,7 +1065,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1068
1065
|
return sep;
|
|
1069
1066
|
}
|
|
1070
1067
|
function writeAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1071
|
-
boundary.
|
|
1068
|
+
boundary.aborted || (state.mutated.push({
|
|
1072
1069
|
value,
|
|
1073
1070
|
object: handle,
|
|
1074
1071
|
property: method,
|
|
@@ -1086,6 +1083,9 @@ function trackChannel(state, ref) {
|
|
|
1086
1083
|
}
|
|
1087
1084
|
return !1;
|
|
1088
1085
|
}
|
|
1086
|
+
function isAncestorChannelRef(state, ref) {
|
|
1087
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
1088
|
+
}
|
|
1089
1089
|
function abortRender(boundary, err) {
|
|
1090
1090
|
for (; boundary.parent;) boundary = boundary.parent;
|
|
1091
1091
|
boundary.abort(err);
|
|
@@ -1169,7 +1169,7 @@ function quote(str, startPos) {
|
|
|
1169
1169
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1170
1170
|
}
|
|
1171
1171
|
function writeRef(state, ref) {
|
|
1172
|
-
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,
|
|
1172
|
+
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));
|
|
1173
1173
|
}
|
|
1174
1174
|
function ensureId(state, ref) {
|
|
1175
1175
|
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
@@ -1180,14 +1180,14 @@ function accessId(state, ref) {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
function assignId(state, ref) {
|
|
1182
1182
|
let { pos } = ref;
|
|
1183
|
-
return
|
|
1183
|
+
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)));
|
|
1184
1184
|
}
|
|
1185
1185
|
function accessPath(state, ref) {
|
|
1186
1186
|
let cur = ref, accessPrevValue = "";
|
|
1187
1187
|
do {
|
|
1188
1188
|
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1189
1189
|
let parent = cur.parent;
|
|
1190
|
-
if (parent.id
|
|
1190
|
+
if (parent.id) return trackChannel(state, parent), parent.id + accessPrevValue;
|
|
1191
1191
|
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1192
1192
|
cur = parent;
|
|
1193
1193
|
} while (cur);
|
|
@@ -1339,8 +1339,8 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
return result;
|
|
1341
1341
|
}
|
|
1342
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName,
|
|
1343
|
-
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1342
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1343
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1344
1344
|
}
|
|
1345
1345
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1346
1346
|
let partial = {};
|
|
@@ -1350,8 +1350,8 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1350
1350
|
}
|
|
1351
1351
|
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1352
1352
|
}
|
|
1353
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName,
|
|
1354
|
-
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1353
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1354
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1355
1355
|
}
|
|
1356
1356
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1357
1357
|
writeScope(scopeId, serializeType ? {
|
|
@@ -1484,8 +1484,8 @@ function _html(html) {
|
|
|
1484
1484
|
function writeScript(script) {
|
|
1485
1485
|
$chunk.writeScript(script);
|
|
1486
1486
|
}
|
|
1487
|
-
function _script(scopeId, registryId,
|
|
1488
|
-
|
|
1487
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
1488
|
+
markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1489
1489
|
}
|
|
1490
1490
|
function _trailers(html) {
|
|
1491
1491
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1526,8 +1526,8 @@ function _resume_branch(scopeId) {
|
|
|
1526
1526
|
let branchId = $chunk.context?.[kBranchId];
|
|
1527
1527
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1528
1528
|
}
|
|
1529
|
-
function _attr_content(nodeAccessor, scopeId, content,
|
|
1530
|
-
let shouldResume =
|
|
1529
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1530
|
+
let shouldResume = markerGuard !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1531
1531
|
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1532
1532
|
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1533
1533
|
["D" + nodeAccessor]: rendererKey(render)
|
|
@@ -1546,48 +1546,48 @@ function writeScopePassive(scopeId, partialScope) {
|
|
|
1546
1546
|
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1547
1547
|
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1548
1548
|
}
|
|
1549
|
-
function _show_start(display,
|
|
1550
|
-
display ?
|
|
1549
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
1550
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1551
1551
|
}
|
|
1552
|
-
function _show_end(scopeId, accessor, display,
|
|
1552
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1553
1553
|
let branchId = _scope_id(), wrap = !display;
|
|
1554
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor,
|
|
1554
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1555
1555
|
}
|
|
1556
|
-
function _for_of(list, cb, by, scopeId, accessor,
|
|
1556
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1557
1557
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
1558
1558
|
let itemKey = forOfBy(by, item, index);
|
|
1559
1559
|
each(itemKey, itemKey === index, () => cb(item, index));
|
|
1560
|
-
}) : forOf(list, cb), scopeId, accessor,
|
|
1560
|
+
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1561
1561
|
}
|
|
1562
|
-
function _for_in(obj, cb, by, scopeId, accessor,
|
|
1562
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1563
1563
|
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
1564
1564
|
each(forInBy(by, key, value), !1, () => cb(key, value));
|
|
1565
|
-
}) : forIn(obj, cb), scopeId, accessor,
|
|
1565
|
+
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1566
1566
|
}
|
|
1567
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor,
|
|
1567
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1568
1568
|
forBranches(by, (each) => {
|
|
1569
1569
|
let index = 0;
|
|
1570
1570
|
return each ? forTo(to, from, step, (value) => {
|
|
1571
1571
|
let itemKey = forStepBy(by, value);
|
|
1572
1572
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1573
1573
|
}) : forTo(to, from, step, cb);
|
|
1574
|
-
}, scopeId, accessor,
|
|
1574
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1575
1575
|
}
|
|
1576
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor,
|
|
1576
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1577
1577
|
forBranches(by, (each) => {
|
|
1578
1578
|
let index = 0;
|
|
1579
1579
|
return each ? forUntil(to, from, step, (value) => {
|
|
1580
1580
|
let itemKey = forStepBy(by, value);
|
|
1581
1581
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1582
1582
|
}) : forUntil(to, from, step, cb);
|
|
1583
|
-
}, scopeId, accessor,
|
|
1583
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1584
1584
|
}
|
|
1585
|
-
function forBranches(by, iterate, scopeId, accessor,
|
|
1586
|
-
if (
|
|
1587
|
-
iterate(0), writeBranchEnd(scopeId, accessor,
|
|
1585
|
+
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1586
|
+
if (branchGuard === 0) {
|
|
1587
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
1588
1588
|
return;
|
|
1589
1589
|
}
|
|
1590
|
-
let { state } = $chunk.boundary, resumeKeys =
|
|
1590
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
1591
1591
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1592
1592
|
let branchId = _peek_scope_id();
|
|
1593
1593
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1595,14 +1595,14 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1595
1595
|
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
1596
1596
|
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
1597
1597
|
});
|
|
1598
|
-
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor,
|
|
1598
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1599
1599
|
}
|
|
1600
|
-
function _if(cb, scopeId, accessor,
|
|
1601
|
-
let resumeBranch =
|
|
1600
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1601
|
+
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;
|
|
1602
1602
|
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1603
1603
|
["D" + accessor]: branchIndex || void 0,
|
|
1604
1604
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1605
|
-
}), writeBranchEnd(scopeId, accessor,
|
|
1605
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1606
1606
|
}
|
|
1607
1607
|
function deferBranchStart(chunk) {
|
|
1608
1608
|
let beforeBranch = chunk.html;
|
|
@@ -1611,14 +1611,15 @@ function deferBranchStart(chunk) {
|
|
|
1611
1611
|
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1612
1612
|
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
1615
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
1616
|
+
}
|
|
1617
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
1615
1618
|
let endTag = parentEndTag || "";
|
|
1616
|
-
if (
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1621
|
-
} else $chunk.writeHTML(endTag);
|
|
1619
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
1620
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1621
|
+
$chunk.writeHTML(mark + endTag);
|
|
1622
|
+
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1622
1623
|
}
|
|
1623
1624
|
function _existing_scope(scopeId) {
|
|
1624
1625
|
return writeScope(scopeId, {});
|
|
@@ -1630,28 +1631,28 @@ function scopeWithId(state, scopeId) {
|
|
|
1630
1631
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1631
1632
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1632
1633
|
}
|
|
1633
|
-
function _subscribe(subscribers, scope, resumeId,
|
|
1634
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1634
1635
|
if (subscribers) {
|
|
1635
1636
|
let { serializer } = $chunk.boundary.state;
|
|
1636
|
-
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId,
|
|
1637
|
+
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId, markerGuard) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1637
1638
|
}
|
|
1638
1639
|
return scope;
|
|
1639
1640
|
}
|
|
1640
1641
|
function maskGroup(mask, group) {
|
|
1641
1642
|
return mask === 715827883 ? 1 : typeof mask == "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
|
|
1642
1643
|
}
|
|
1643
|
-
function
|
|
1644
|
-
$chunk.boundary.state.
|
|
1644
|
+
function _set_scope_reason(reason) {
|
|
1645
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
1645
1646
|
}
|
|
1646
1647
|
function _scope_reason() {
|
|
1647
|
-
let reason = $chunk.boundary.state.
|
|
1648
|
-
return $chunk.boundary.state.
|
|
1648
|
+
let reason = $chunk.boundary.state.scopeReason;
|
|
1649
|
+
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1649
1650
|
}
|
|
1650
|
-
function
|
|
1651
|
+
function _write_if(condition, key) {
|
|
1651
1652
|
return condition && maskGroup(condition, key) ? 1 : void 0;
|
|
1652
1653
|
}
|
|
1653
|
-
function
|
|
1654
|
-
return
|
|
1654
|
+
function _write_guard(condition, key) {
|
|
1655
|
+
return _write_if(condition, key) || 0;
|
|
1655
1656
|
}
|
|
1656
1657
|
function writeWaitReady(readyId, renderer, input) {
|
|
1657
1658
|
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
@@ -1661,10 +1662,11 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
1661
1662
|
writeScopes: {},
|
|
1662
1663
|
flushScopes: !1
|
|
1663
1664
|
}), bodyEnd = body.render(renderer, input);
|
|
1665
|
+
if (boundary.aborted) throw boundary.reason;
|
|
1664
1666
|
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);
|
|
1665
1667
|
}
|
|
1666
|
-
function _await(scopeId, accessor, promise, content,
|
|
1667
|
-
let resumeMarker =
|
|
1668
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
1669
|
+
let resumeMarker = markerGuard !== 0;
|
|
1668
1670
|
if (!isPromise(promise)) {
|
|
1669
1671
|
if (resumeMarker) {
|
|
1670
1672
|
let branchId = _peek_scope_id();
|
|
@@ -1674,15 +1676,18 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1674
1676
|
}
|
|
1675
1677
|
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1676
1678
|
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1677
|
-
chunk.async && (chunk.async = !1, boundary.
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1679
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
1680
|
+
let { state } = boundary;
|
|
1681
|
+
chunk.render(() => {
|
|
1682
|
+
if (resumeMarker) {
|
|
1683
|
+
let branchId = _peek_scope_id();
|
|
1684
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1685
|
+
} else {
|
|
1686
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1687
|
+
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;
|
|
1688
|
+
}
|
|
1689
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
1690
|
+
}
|
|
1686
1691
|
}, (err) => {
|
|
1687
1692
|
chunk.async = !1, boundary.abort(err);
|
|
1688
1693
|
});
|
|
@@ -1706,29 +1711,39 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1706
1711
|
};
|
|
1707
1712
|
}
|
|
1708
1713
|
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1709
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1710
|
-
if (catchBoundary.
|
|
1714
|
+
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));
|
|
1715
|
+
if (catchBoundary.aborted) {
|
|
1716
|
+
if (!catchContent) throw catchBoundary.reason;
|
|
1717
|
+
return catchContent(catchBoundary.reason), !0;
|
|
1718
|
+
}
|
|
1711
1719
|
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1712
1720
|
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1713
1721
|
chunk.next = body, boundary.startAsync();
|
|
1714
|
-
let reorderId = catchContent ? state.nextReorderId() : ""
|
|
1715
|
-
return reorderId && (chunk.
|
|
1716
|
-
|
|
1717
|
-
|
|
1722
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
1723
|
+
return reorderId && (chunk.catchRange = {
|
|
1724
|
+
id: reorderId,
|
|
1725
|
+
end: bodyEnd
|
|
1726
|
+
}, captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1727
|
+
if (!boundary.aborted) {
|
|
1728
|
+
if (catchBoundary.aborted) {
|
|
1718
1729
|
if (!reorderId) {
|
|
1719
|
-
boundary.abort(catchBoundary.
|
|
1730
|
+
boundary.abort(catchBoundary.reason);
|
|
1720
1731
|
return;
|
|
1721
1732
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1733
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1734
|
+
chunk.catchRange = null;
|
|
1735
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1736
|
+
if (boundary.aborted) return;
|
|
1737
|
+
if (bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1738
|
+
else {
|
|
1739
|
+
let reorder = null;
|
|
1740
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
1741
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
1742
|
+
for (; cut.consumed;) cut = cut.next;
|
|
1743
|
+
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);
|
|
1728
1744
|
}
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), boundary.endAsync());
|
|
1745
|
+
boundary.endAsync();
|
|
1746
|
+
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
1732
1747
|
}
|
|
1733
1748
|
}, renderersAtSettle;
|
|
1734
1749
|
}
|
|
@@ -1767,7 +1782,7 @@ var State = class {
|
|
|
1767
1782
|
flushScopes = !1;
|
|
1768
1783
|
writeScopes = {};
|
|
1769
1784
|
readyIds = null;
|
|
1770
|
-
|
|
1785
|
+
scopeReason;
|
|
1771
1786
|
$global;
|
|
1772
1787
|
constructor($global) {
|
|
1773
1788
|
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
@@ -1808,28 +1823,40 @@ var State = class {
|
|
|
1808
1823
|
mark(code, str) {
|
|
1809
1824
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1810
1825
|
}
|
|
1811
|
-
}, Boundary = class
|
|
1826
|
+
}, Boundary = class {
|
|
1812
1827
|
onNext = NOOP$2;
|
|
1813
1828
|
count = 0;
|
|
1814
1829
|
resumeWrites = 0;
|
|
1815
1830
|
state;
|
|
1816
1831
|
parent;
|
|
1832
|
+
aborted = !1;
|
|
1833
|
+
reason;
|
|
1834
|
+
pendingReorders;
|
|
1835
|
+
children;
|
|
1817
1836
|
constructor(state, signal, parent) {
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1837
|
+
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));
|
|
1838
|
+
}
|
|
1839
|
+
abort(reason) {
|
|
1840
|
+
if (this.aborted) return;
|
|
1841
|
+
let { state } = this;
|
|
1842
|
+
if (this.aborted = !0, this.reason = reason, this.pendingReorders) {
|
|
1843
|
+
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1844
|
+
this.pendingReorders = void 0;
|
|
1845
|
+
}
|
|
1846
|
+
if (this.count = 0, this.state = new State(state.$global), this.children) for (let child of this.children) child.abort(reason);
|
|
1847
|
+
this.onNext();
|
|
1821
1848
|
}
|
|
1822
1849
|
handleEvent(event) {
|
|
1823
1850
|
this.abort(event.target.reason);
|
|
1824
1851
|
}
|
|
1825
1852
|
flush() {
|
|
1826
|
-
return this.
|
|
1853
|
+
return this.aborted || flushSerializer(this, this.state), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1827
1854
|
}
|
|
1828
1855
|
startAsync() {
|
|
1829
|
-
this.
|
|
1856
|
+
this.aborted || this.count++;
|
|
1830
1857
|
}
|
|
1831
1858
|
endAsync() {
|
|
1832
|
-
this.
|
|
1859
|
+
this.aborted || (this.count--, this.onNext());
|
|
1833
1860
|
}
|
|
1834
1861
|
}, Chunk = class Chunk {
|
|
1835
1862
|
html = "";
|
|
@@ -1838,9 +1865,10 @@ var State = class {
|
|
|
1838
1865
|
lastEffect = "";
|
|
1839
1866
|
async = !1;
|
|
1840
1867
|
consumed = !1;
|
|
1841
|
-
needsWalk = !1;
|
|
1842
1868
|
reorderId = null;
|
|
1843
1869
|
deferredReady = null;
|
|
1870
|
+
deferredReorder = null;
|
|
1871
|
+
catchRange = null;
|
|
1844
1872
|
placeholder = null;
|
|
1845
1873
|
boundary;
|
|
1846
1874
|
next;
|
|
@@ -1862,7 +1890,7 @@ var State = class {
|
|
|
1862
1890
|
this.scripts = concatScripts(this.scripts, script);
|
|
1863
1891
|
}
|
|
1864
1892
|
append(chunk) {
|
|
1865
|
-
this.html += chunk.html, this.
|
|
1893
|
+
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());
|
|
1866
1894
|
}
|
|
1867
1895
|
takeDeferredReady() {
|
|
1868
1896
|
let { deferredReady } = this;
|
|
@@ -1874,25 +1902,59 @@ var State = class {
|
|
|
1874
1902
|
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1875
1903
|
}
|
|
1876
1904
|
}
|
|
1877
|
-
|
|
1905
|
+
renderPlaceholders(boundary) {
|
|
1906
|
+
let { state } = boundary;
|
|
1907
|
+
restart: for (;;) {
|
|
1908
|
+
let reorders = null;
|
|
1909
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
1910
|
+
if (cur.renderPlaceholder(state)) {
|
|
1911
|
+
if (boundary.aborted) return;
|
|
1912
|
+
continue restart;
|
|
1913
|
+
}
|
|
1914
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1915
|
+
}
|
|
1916
|
+
if (state.writeReorders) {
|
|
1917
|
+
for (let reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === !1) {
|
|
1918
|
+
if (boundary.aborted) return;
|
|
1919
|
+
continue restart;
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === !1) {
|
|
1923
|
+
if (boundary.aborted) return;
|
|
1924
|
+
continue restart;
|
|
1925
|
+
}
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
renderPlaceholder(state) {
|
|
1878
1930
|
let { placeholder } = this;
|
|
1879
|
-
if (placeholder)
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1931
|
+
if (!placeholder || (this.placeholder = null, this.boundary.aborted)) return !1;
|
|
1932
|
+
let { body } = placeholder, end = body;
|
|
1933
|
+
for (; end.next && !end.async;) end = end.next;
|
|
1934
|
+
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
1935
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
1936
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
1937
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1938
|
+
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
|
|
1939
|
+
let stateful = this.effects !== effects;
|
|
1940
|
+
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;
|
|
1941
|
+
}
|
|
1942
|
+
markCatchRange() {
|
|
1943
|
+
let { catchRange } = this;
|
|
1944
|
+
if (catchRange) {
|
|
1945
|
+
let { state } = this.boundary;
|
|
1946
|
+
this.catchRange = null, this.writeHTML(state.mark("!^", catchRange.id)), catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
1890
1947
|
}
|
|
1891
1948
|
}
|
|
1892
|
-
|
|
1893
|
-
let
|
|
1894
|
-
|
|
1895
|
-
|
|
1949
|
+
queueDeferredReorder() {
|
|
1950
|
+
let { deferredReorder } = this;
|
|
1951
|
+
deferredReorder && (this.deferredReorder = null, deferredReorder.boundary.state.reorder(deferredReorder));
|
|
1952
|
+
}
|
|
1953
|
+
consume(boundary) {
|
|
1954
|
+
this.renderPlaceholders(boundary);
|
|
1955
|
+
let cur = this, html = "", effects = "", scripts = "", lastEffect = "", deferredReady;
|
|
1956
|
+
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;
|
|
1957
|
+
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;
|
|
1896
1958
|
}
|
|
1897
1959
|
render(content, val) {
|
|
1898
1960
|
let prev = $chunk;
|
|
@@ -1906,10 +1968,9 @@ var State = class {
|
|
|
1906
1968
|
}
|
|
1907
1969
|
}
|
|
1908
1970
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1909
|
-
let { serializeState } = this, { readyId } = serializeState, scripts = "";
|
|
1910
|
-
if (
|
|
1911
|
-
|
|
1912
|
-
}), readyId && !this.async) {
|
|
1971
|
+
let { serializeState } = this, { readyId } = serializeState, scripts = "", held = this.takeDeferredReady();
|
|
1972
|
+
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)));
|
|
1973
|
+
if (readyId && !this.async) {
|
|
1913
1974
|
let { state } = boundary;
|
|
1914
1975
|
flushSerializer(boundary, serializeState);
|
|
1915
1976
|
let deps = state.serializer.takeChannelDeps(), effects = holdEffects ? "" : this.effects, { resumes } = serializeState, chunkScripts = this.scripts;
|
|
@@ -1929,7 +1990,7 @@ var State = class {
|
|
|
1929
1990
|
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1930
1991
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1931
1992
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1932
|
-
for (let channel; !boundary.
|
|
1993
|
+
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1933
1994
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1934
1995
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1935
1996
|
}
|
|
@@ -1938,40 +1999,36 @@ var State = class {
|
|
|
1938
1999
|
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 + "\"");
|
|
1939
2000
|
let reordered = "", needsResumeArray = !1;
|
|
1940
2001
|
if (state.writeReorders) {
|
|
1941
|
-
let carried = null;
|
|
1942
2002
|
for (let reorderedChunk of state.writeReorders) {
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
(carried ||= []).push(reorderedChunk);
|
|
1948
|
-
continue;
|
|
1949
|
-
}
|
|
1950
|
-
reorderedChunk.async = !1;
|
|
1951
|
-
}
|
|
1952
|
-
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 + ")"));
|
|
1953
|
-
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1954
|
-
for (reorderedChunk.reorderId = null;;) {
|
|
1955
|
-
cur.flushPlaceholder(), cur.deferOwnReady();
|
|
2003
|
+
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 + ")"));
|
|
2004
|
+
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2005
|
+
for (reorderedChunk.reorderId = null; cur;) {
|
|
2006
|
+
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
1956
2007
|
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
1957
|
-
|
|
1958
|
-
else break;
|
|
2008
|
+
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;
|
|
1959
2009
|
}
|
|
1960
2010
|
reorderEffects && (this.async ? (this.effects = concatEffects(this.effects, reorderEffects), this.lastEffect = "") : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
1961
2011
|
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
1962
2012
|
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1963
2013
|
}
|
|
1964
|
-
state.writeReorders =
|
|
2014
|
+
state.writeReorders = null;
|
|
1965
2015
|
}
|
|
1966
2016
|
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;
|
|
1967
2017
|
}
|
|
1968
2018
|
flushHTML(boundary) {
|
|
1969
2019
|
let { state } = boundary;
|
|
1970
|
-
this.
|
|
2020
|
+
this.flushScript(boundary);
|
|
1971
2021
|
let { html, scripts } = this;
|
|
1972
2022
|
return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
|
|
1973
2023
|
}
|
|
1974
2024
|
};
|
|
2025
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
2026
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
2027
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return !1;
|
|
2028
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
2029
|
+
}
|
|
2030
|
+
return reorders;
|
|
2031
|
+
}
|
|
1975
2032
|
function flushSerializer(boundary, serializeState) {
|
|
1976
2033
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1977
2034
|
if (serializeState.flushScopes || pending) {
|
|
@@ -2222,11 +2279,11 @@ var ServerRendered = class {
|
|
|
2222
2279
|
(boundary.onNext = () => {
|
|
2223
2280
|
switch (!boundary.count && boundary.flush()) {
|
|
2224
2281
|
case 2:
|
|
2225
|
-
settle(boundary), reject(boundary.
|
|
2282
|
+
settle(boundary), reject(boundary.reason);
|
|
2226
2283
|
break;
|
|
2227
2284
|
case 0:
|
|
2228
|
-
if (head = head.consume(), boundary.
|
|
2229
|
-
html += head.flushHTML(boundary), boundary.count || boundary.
|
|
2285
|
+
if (head = head.consume(boundary), boundary.aborted) break;
|
|
2286
|
+
html += head.flushHTML(boundary), boundary.count || boundary.aborted || (settle(boundary), resolve(html));
|
|
2230
2287
|
}
|
|
2231
2288
|
})();
|
|
2232
2289
|
});
|
|
@@ -2247,13 +2304,13 @@ var ServerRendered = class {
|
|
|
2247
2304
|
again = !1;
|
|
2248
2305
|
let status = boundary.flush();
|
|
2249
2306
|
if (status === 2) {
|
|
2250
|
-
tick || offTick(onNext), settle(boundary), onAbort(boundary.
|
|
2307
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
|
|
2251
2308
|
return;
|
|
2252
2309
|
}
|
|
2253
2310
|
if (write || status === 0) {
|
|
2254
|
-
if (head = head.consume(), boundary.
|
|
2311
|
+
if (head = head.consume(boundary), boundary.aborted) continue;
|
|
2255
2312
|
let html = head.flushHTML(boundary);
|
|
2256
|
-
if (boundary.
|
|
2313
|
+
if (boundary.aborted) continue;
|
|
2257
2314
|
if (html && onWrite(html), !boundary.count) {
|
|
2258
2315
|
tick || offTick(onNext), settle(boundary), onClose();
|
|
2259
2316
|
return;
|
|
@@ -2268,8 +2325,8 @@ var ServerRendered = class {
|
|
|
2268
2325
|
toString() {
|
|
2269
2326
|
let head = this.#head;
|
|
2270
2327
|
if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
|
|
2271
|
-
let { boundary } = head, html = boundary.flush() === 0 ? head.consume().flushHTML(boundary) : "";
|
|
2272
|
-
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.
|
|
2328
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2329
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2273
2330
|
return html;
|
|
2274
2331
|
}
|
|
2275
2332
|
};
|
|
@@ -2345,4 +2402,4 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2345
2402
|
}
|
|
2346
2403
|
function NOOP() {}
|
|
2347
2404
|
//#endregion
|
|
2348
|
-
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script,
|
|
2405
|
+
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|