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/debug/html.js
CHANGED
|
@@ -220,18 +220,18 @@ function _hoist_read_error() {
|
|
|
220
220
|
function _assert_hoist(value) {
|
|
221
221
|
if (value !== void 0 && typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
|
|
222
222
|
}
|
|
223
|
-
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
223
|
+
function assertExclusiveAttrs(attrs, onError = throwErr, isSet = isTruthy) {
|
|
224
224
|
if (attrs) {
|
|
225
225
|
let exclusiveAttrs;
|
|
226
|
-
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
226
|
+
if (isSet(attrs.checkedChange)) (exclusiveAttrs ||= []).push("checkedChange");
|
|
227
227
|
if ("checkedValue" in attrs) {
|
|
228
228
|
(exclusiveAttrs ||= []).push("checkedValue");
|
|
229
229
|
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
230
|
-
} else if (attrs.checkedValueChange) {
|
|
230
|
+
} else if (isSet(attrs.checkedValueChange)) {
|
|
231
231
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
232
232
|
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
233
233
|
}
|
|
234
|
-
if (attrs.valueChange) {
|
|
234
|
+
if (isSet(attrs.valueChange)) {
|
|
235
235
|
(exclusiveAttrs ||= []).push("valueChange");
|
|
236
236
|
if ("checked" in attrs && !exclusiveAttrs.includes("checked")) exclusiveAttrs.push("checked");
|
|
237
237
|
}
|
|
@@ -247,6 +247,9 @@ function assertHandlerIsFunction(name, value) {
|
|
|
247
247
|
function assertValidTagName(tagName) {
|
|
248
248
|
if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) throw new Error(`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`);
|
|
249
249
|
}
|
|
250
|
+
function isTruthy(value) {
|
|
251
|
+
return value;
|
|
252
|
+
}
|
|
250
253
|
function throwErr(msg) {
|
|
251
254
|
throw new Error(msg);
|
|
252
255
|
}
|
|
@@ -293,12 +296,6 @@ function forUntil(until, from, step, cb) {
|
|
|
293
296
|
}
|
|
294
297
|
//#endregion
|
|
295
298
|
//#region src/common/opt.ts
|
|
296
|
-
function forEach(opt, cb) {
|
|
297
|
-
if (opt) {
|
|
298
|
-
if (Array.isArray(opt)) for (const item of opt) cb(item);
|
|
299
|
-
else cb(opt);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
299
|
function push(opt, item) {
|
|
303
300
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
304
301
|
}
|
|
@@ -740,7 +737,7 @@ function writeAssigned(state) {
|
|
|
740
737
|
if (writeProp(state, mutation.object, null, "")) {
|
|
741
738
|
const objectRef = state.refs.get(mutation.object);
|
|
742
739
|
if (objectRef && objectRef.scopeId === void 0) {
|
|
743
|
-
if (!objectRef.id) {
|
|
740
|
+
if (!objectRef.id && !isAncestorChannelRef(state, objectRef)) {
|
|
744
741
|
objectRef.id = nextRefAccess(state);
|
|
745
742
|
state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex];
|
|
746
743
|
state.buf.push(")");
|
|
@@ -753,7 +750,7 @@ function writeAssigned(state) {
|
|
|
753
750
|
const valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
754
751
|
if (mutation.value === void 0) {} else if (writeProp(state, mutation.value, null, "")) {
|
|
755
752
|
const valueRef = typeof mutation.value === "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
756
|
-
if (valueRef && !valueRef.id && valueRef.scopeId === void 0) {
|
|
753
|
+
if (valueRef && !valueRef.id && valueRef.scopeId === void 0 && !isAncestorChannelRef(state, valueRef)) {
|
|
757
754
|
valueRef.id = mutation.valueId || nextRefAccess(state);
|
|
758
755
|
state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex];
|
|
759
756
|
}
|
|
@@ -770,7 +767,7 @@ function writeCallArg(state, val) {
|
|
|
770
767
|
state.buf.push("$");
|
|
771
768
|
} else if (writeProp(state, val, null, "")) {
|
|
772
769
|
const ref = state.refs.get(val) || state.strs.get(val);
|
|
773
|
-
if (ref
|
|
770
|
+
if (ref) ensureId(state, ref);
|
|
774
771
|
} else state.buf.push("void 0");
|
|
775
772
|
}
|
|
776
773
|
function hasChannelMutations(state) {
|
|
@@ -852,8 +849,7 @@ function writeRegistered(state, val, parent, accessor, registered) {
|
|
|
852
849
|
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
853
850
|
for (const local of locals) {
|
|
854
851
|
state.buf.push(",");
|
|
855
|
-
|
|
856
|
-
else state.buf.push("0");
|
|
852
|
+
writePlainObject(state, local, newArgReference(state, ref, local));
|
|
857
853
|
}
|
|
858
854
|
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
859
855
|
state.buf.push(")");
|
|
@@ -1162,6 +1158,17 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
1162
1158
|
}
|
|
1163
1159
|
state.buf.push(")");
|
|
1164
1160
|
}
|
|
1161
|
+
function newArgReference(state, parent, val) {
|
|
1162
|
+
for (const key in val) {
|
|
1163
|
+
const member = val[key];
|
|
1164
|
+
if (isDedupedMember(member) && !(typeof member === "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
1165
|
+
const ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
1166
|
+
state.buf.push(ref.id + "=");
|
|
1167
|
+
return ref;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
1171
|
+
}
|
|
1165
1172
|
function isDedupedMember(val) {
|
|
1166
1173
|
switch (typeof val) {
|
|
1167
1174
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
@@ -1358,20 +1365,9 @@ function writeResponse(state, val, ref) {
|
|
|
1358
1365
|
}
|
|
1359
1366
|
function writeIntl(state, val, name, ref) {
|
|
1360
1367
|
const { locale, ...options } = val.resolvedOptions();
|
|
1361
|
-
let needsId = false;
|
|
1362
|
-
for (const key in options) if (isDedupedMember(options[key])) {
|
|
1363
|
-
needsId = true;
|
|
1364
|
-
break;
|
|
1365
|
-
}
|
|
1366
1368
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
optionsRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1370
|
-
state.buf.push(optionsRef.id + "={");
|
|
1371
|
-
} else {
|
|
1372
|
-
optionsRef = new Reference(ref, null, state.flushId, state.buf.length);
|
|
1373
|
-
state.buf.push("{");
|
|
1374
|
-
}
|
|
1369
|
+
const optionsRef = newArgReference(state, ref, options);
|
|
1370
|
+
state.buf.push("{");
|
|
1375
1371
|
writeObjectProps(state, options, optionsRef);
|
|
1376
1372
|
state.buf.push("})");
|
|
1377
1373
|
return true;
|
|
@@ -1395,7 +1391,7 @@ function writeReadableStream(state, val, ref) {
|
|
|
1395
1391
|
const handle = newAsyncHandle(state, ref, iterId);
|
|
1396
1392
|
const onFulfilled = ({ value, done }) => {
|
|
1397
1393
|
if (done) writeAsyncCall(state, boundary, handle, "r", value, channel);
|
|
1398
|
-
else if (!boundary.
|
|
1394
|
+
else if (!boundary.aborted) {
|
|
1399
1395
|
reader.read().then(onFulfilled, onRejected);
|
|
1400
1396
|
boundary.startAsync();
|
|
1401
1397
|
writeAsyncCall(state, boundary, handle, "f", value, channel);
|
|
@@ -1442,13 +1438,10 @@ function writeGenerator(state, iter, ref) {
|
|
|
1442
1438
|
state.buf.push("," + holder.id + "={}");
|
|
1443
1439
|
writeProp(state, returnValue, holder, "v");
|
|
1444
1440
|
} else if (returnValue !== void 0) {
|
|
1445
|
-
|
|
1441
|
+
state.buf.push(",");
|
|
1446
1442
|
if (writeProp(state, returnValue, ref, "") && isDedupedMember(returnValue)) {
|
|
1447
1443
|
const retRef = typeof returnValue === "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1448
|
-
if (retRef
|
|
1449
|
-
retRef.id = nextRefAccess(state);
|
|
1450
|
-
state.buf[sepIndex] = "," + retRef.id + "=";
|
|
1451
|
-
}
|
|
1444
|
+
if (retRef) ensureId(state, retRef);
|
|
1452
1445
|
}
|
|
1453
1446
|
}
|
|
1454
1447
|
state.buf.push(")");
|
|
@@ -1464,7 +1457,7 @@ function writeAsyncGenerator(state, iter, ref) {
|
|
|
1464
1457
|
const handle = newAsyncHandle(state, ref, iterId);
|
|
1465
1458
|
const onFulfilled = ({ value, done }) => {
|
|
1466
1459
|
if (done) writeAsyncCall(state, boundary, handle, "r", value, channel);
|
|
1467
|
-
else if (!boundary.
|
|
1460
|
+
else if (!boundary.aborted) {
|
|
1468
1461
|
iter.next().then(onFulfilled, onRejected);
|
|
1469
1462
|
boundary.startAsync();
|
|
1470
1463
|
writeAsyncCall(state, boundary, handle, "f", value, channel);
|
|
@@ -1511,7 +1504,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1511
1504
|
return sep;
|
|
1512
1505
|
}
|
|
1513
1506
|
function writeAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1514
|
-
if (boundary.
|
|
1507
|
+
if (boundary.aborted) return;
|
|
1515
1508
|
state.mutated.push({
|
|
1516
1509
|
value,
|
|
1517
1510
|
object: handle,
|
|
@@ -1569,6 +1562,7 @@ const accessorPrefixDescriptions = {
|
|
|
1569
1562
|
ControlledType: "the controlled type",
|
|
1570
1563
|
ControlledValue: "the controlled value",
|
|
1571
1564
|
DynamicHTMLLastChild: "the dynamic html",
|
|
1565
|
+
DynamicHTMLValue: "the dynamic html value",
|
|
1572
1566
|
EventAttributes: "the event handlers",
|
|
1573
1567
|
IdFallback: "the generated id",
|
|
1574
1568
|
KeyedScopes: "the keyed scopes",
|
|
@@ -1607,6 +1601,9 @@ function trackChannel(state, ref) {
|
|
|
1607
1601
|
}
|
|
1608
1602
|
return false;
|
|
1609
1603
|
}
|
|
1604
|
+
function isAncestorChannelRef(state, ref) {
|
|
1605
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
1606
|
+
}
|
|
1610
1607
|
function abortUnreachableChannel(state, val) {
|
|
1611
1608
|
const err = new TypeError("Unable to serialize a value shared between independently lazy loaded content. Values shared this way must also be serialized by content that is not lazily loaded, or by a common parent.", { cause: val });
|
|
1612
1609
|
err.stack = void 0;
|
|
@@ -1700,11 +1697,10 @@ function quote(str, startPos) {
|
|
|
1700
1697
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1701
1698
|
}
|
|
1702
1699
|
function writeRef(state, ref) {
|
|
1703
|
-
if (ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId)) {
|
|
1700
|
+
if (ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) && !isAncestorChannelRef(state, ref)) {
|
|
1704
1701
|
ref.path = accessPath(state, ref);
|
|
1705
1702
|
ref.pos = state.buf.length;
|
|
1706
1703
|
ref.flushId = state.flushId;
|
|
1707
|
-
ref.channel = state.channel;
|
|
1708
1704
|
state.buf.push(ref.path);
|
|
1709
1705
|
} else state.buf.push(ensureId(state, ref));
|
|
1710
1706
|
}
|
|
@@ -1725,23 +1721,26 @@ function accessId(state, ref) {
|
|
|
1725
1721
|
}
|
|
1726
1722
|
function assignId(state, ref) {
|
|
1727
1723
|
const { pos } = ref;
|
|
1728
|
-
ref.id = nextRefAccess(state);
|
|
1729
1724
|
if (pos !== null && ref.flushId === state.flushId) {
|
|
1725
|
+
ref.id = nextRefAccess(state);
|
|
1730
1726
|
if (pos === 0) state.buf[0] = ref.id + "=" + state.buf[0];
|
|
1731
1727
|
else state.buf[pos - 1] += ref.id + "=";
|
|
1732
1728
|
return ref.id;
|
|
1733
1729
|
}
|
|
1734
|
-
ref.
|
|
1730
|
+
if (isAncestorChannelRef(state, ref)) return ref.path || accessPath(state, ref);
|
|
1731
|
+
ref.id = nextRefAccess(state);
|
|
1735
1732
|
return ref.id + "=" + (ref.path || accessPath(state, ref));
|
|
1736
1733
|
}
|
|
1737
1734
|
function accessPath(state, ref) {
|
|
1738
1735
|
let cur = ref;
|
|
1739
1736
|
let accessPrevValue = "";
|
|
1740
1737
|
do {
|
|
1738
|
+
if (cur.accessor === null) throw new Error("Unable to serialize a reused value: no access path reaches where it was first written, and it has no id.");
|
|
1741
1739
|
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1742
1740
|
const parent = cur.parent;
|
|
1743
1741
|
if (parent.id) {
|
|
1744
|
-
|
|
1742
|
+
trackChannel(state, parent);
|
|
1743
|
+
return parent.id + accessPrevValue;
|
|
1745
1744
|
}
|
|
1746
1745
|
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1747
1746
|
cur = parent;
|
|
@@ -1969,9 +1968,9 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1969
1968
|
}
|
|
1970
1969
|
return result;
|
|
1971
1970
|
}
|
|
1972
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName,
|
|
1971
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1973
1972
|
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`);
|
|
1974
|
-
_attr_content(nodeAccessor, scopeId, data?.content,
|
|
1973
|
+
_attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1975
1974
|
}
|
|
1976
1975
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1977
1976
|
const partial = {};
|
|
@@ -1985,9 +1984,9 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1985
1984
|
});
|
|
1986
1985
|
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1987
1986
|
}
|
|
1988
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName,
|
|
1987
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1989
1988
|
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`);
|
|
1990
|
-
_attr_content(nodeAccessor, scopeId, data?.content,
|
|
1989
|
+
_attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1991
1990
|
}
|
|
1992
1991
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1993
1992
|
var handlerName = [
|
|
@@ -2116,11 +2115,6 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
|
|
|
2116
2115
|
|
|
2117
2116
|
if (op == "#") {
|
|
2118
2117
|
(placeholders[id] = placeholder).i++;
|
|
2119
|
-
} else if (op == "!") {
|
|
2120
|
-
if (runtime.l[id] && placeholders[id]) {
|
|
2121
|
-
nextSibling = node.nextSibling;
|
|
2122
|
-
onNextSibling = () => placeholders[id].c();
|
|
2123
|
-
}
|
|
2124
2118
|
} else if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
|
|
2125
2119
|
nextSibling = node.nextSibling;
|
|
2126
2120
|
onNextSibling = () => {
|
|
@@ -2132,7 +2126,8 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
|
|
|
2132
2126
|
placeholders[id] ||
|
|
2133
2127
|
(placeholderRoot = placeholders[id] =
|
|
2134
2128
|
{
|
|
2135
|
-
|
|
2129
|
+
// The writer streams a reorder only after its markers.
|
|
2130
|
+
i: 1,
|
|
2136
2131
|
r: id,
|
|
2137
2132
|
// Resume may still walk markers inside the dropped placeholder, so
|
|
2138
2133
|
// park it in any detached parent (a bare <t> clone is the cheapest).
|
|
@@ -2240,8 +2235,8 @@ function _html(html) {
|
|
|
2240
2235
|
function writeScript(script) {
|
|
2241
2236
|
$chunk.writeScript(script);
|
|
2242
2237
|
}
|
|
2243
|
-
function _script(scopeId, registryId,
|
|
2244
|
-
if (
|
|
2238
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
2239
|
+
if (markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync])) _resume_branch(scopeId);
|
|
2245
2240
|
$chunk.boundary.state.needsMainRuntime = true;
|
|
2246
2241
|
$chunk.writeEffect(scopeId, registryId);
|
|
2247
2242
|
}
|
|
@@ -2289,8 +2284,8 @@ function _resume_branch(scopeId) {
|
|
|
2289
2284
|
const branchId = $chunk.context?.[kBranchId];
|
|
2290
2285
|
if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { [ClosestBranchId]: branchId });
|
|
2291
2286
|
}
|
|
2292
|
-
function _attr_content(nodeAccessor, scopeId, content,
|
|
2293
|
-
const shouldResume =
|
|
2287
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
2288
|
+
const shouldResume = markerGuard !== 0;
|
|
2294
2289
|
const render = normalizeServerRender(content);
|
|
2295
2290
|
const branchId = _peek_scope_id();
|
|
2296
2291
|
if (render) {
|
|
@@ -2324,47 +2319,47 @@ function writeScopePassive(scopeId, partialScope) {
|
|
|
2324
2319
|
passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
|
|
2325
2320
|
return scope;
|
|
2326
2321
|
}
|
|
2327
|
-
function _show_start(display,
|
|
2322
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
2328
2323
|
if (display) {
|
|
2329
|
-
if (
|
|
2324
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
2330
2325
|
} else $chunk.writeHTML("<t hidden>");
|
|
2331
2326
|
}
|
|
2332
|
-
function _show_end(scopeId, accessor, display,
|
|
2327
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2333
2328
|
const branchId = _scope_id();
|
|
2334
2329
|
const wrap = !display;
|
|
2335
2330
|
if (wrap) $chunk.writeHTML("</t>");
|
|
2336
|
-
writeBranchEnd(scopeId, accessor,
|
|
2331
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
2337
2332
|
}
|
|
2338
|
-
function _for_of(list, cb, by, scopeId, accessor,
|
|
2333
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2339
2334
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
2340
2335
|
const itemKey = forOfBy(by, item, index);
|
|
2341
2336
|
each(itemKey, itemKey === index, () => cb(item, index));
|
|
2342
|
-
}) : forOf(list, cb), scopeId, accessor,
|
|
2337
|
+
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2343
2338
|
}
|
|
2344
|
-
function _for_in(obj, cb, by, scopeId, accessor,
|
|
2339
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2345
2340
|
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
2346
2341
|
each(forInBy(by, key, value), false, () => cb(key, value));
|
|
2347
|
-
}) : forIn(obj, cb), scopeId, accessor,
|
|
2342
|
+
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2348
2343
|
}
|
|
2349
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor,
|
|
2344
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2350
2345
|
forBranches(by, (each) => {
|
|
2351
2346
|
let index = 0;
|
|
2352
2347
|
return each ? forTo(to, from, step, (value) => {
|
|
2353
2348
|
const itemKey = forStepBy(by, value);
|
|
2354
2349
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
2355
2350
|
}) : forTo(to, from, step, cb);
|
|
2356
|
-
}, scopeId, accessor,
|
|
2351
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2357
2352
|
}
|
|
2358
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor,
|
|
2353
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2359
2354
|
forBranches(by, (each) => {
|
|
2360
2355
|
let index = 0;
|
|
2361
2356
|
return each ? forUntil(to, from, step, (value) => {
|
|
2362
2357
|
const itemKey = forStepBy(by, value);
|
|
2363
2358
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
2364
2359
|
}) : forUntil(to, from, step, cb);
|
|
2365
|
-
}, scopeId, accessor,
|
|
2360
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2366
2361
|
}
|
|
2367
|
-
function forBranches(by, iterate, scopeId, accessor,
|
|
2362
|
+
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2368
2363
|
if (by) {
|
|
2369
2364
|
const run = iterate;
|
|
2370
2365
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
@@ -2374,14 +2369,14 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
2374
2369
|
else render();
|
|
2375
2370
|
});
|
|
2376
2371
|
}
|
|
2377
|
-
if (
|
|
2372
|
+
if (branchGuard === 0) {
|
|
2378
2373
|
iterate(0);
|
|
2379
|
-
writeBranchEnd(scopeId, accessor,
|
|
2374
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
2380
2375
|
return;
|
|
2381
2376
|
}
|
|
2382
2377
|
const { state } = $chunk.boundary;
|
|
2383
|
-
const resumeKeys =
|
|
2384
|
-
const resumeMarker =
|
|
2378
|
+
const resumeKeys = markerGuard !== 0;
|
|
2379
|
+
const resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag);
|
|
2385
2380
|
let flushBranchIds = "";
|
|
2386
2381
|
let loopScopes;
|
|
2387
2382
|
iterate((itemKey, sameAsIndex, render) => {
|
|
@@ -2400,11 +2395,11 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
2400
2395
|
});
|
|
2401
2396
|
});
|
|
2402
2397
|
if (loopScopes) writeScope(scopeId, { [BranchScopes + accessor]: loopScopes });
|
|
2403
|
-
writeBranchEnd(scopeId, accessor,
|
|
2398
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
2404
2399
|
}
|
|
2405
|
-
function _if(cb, scopeId, accessor,
|
|
2406
|
-
const resumeBranch =
|
|
2407
|
-
const resumeMarker =
|
|
2400
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2401
|
+
const resumeBranch = branchGuard !== 0;
|
|
2402
|
+
const resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag);
|
|
2408
2403
|
const branchId = _peek_scope_id();
|
|
2409
2404
|
const chunk = $chunk;
|
|
2410
2405
|
const beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0;
|
|
@@ -2415,7 +2410,7 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
|
|
|
2415
2410
|
[ConditionalRenderer + accessor]: branchIndex || void 0,
|
|
2416
2411
|
[BranchScopes + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
2417
2412
|
});
|
|
2418
|
-
writeBranchEnd(scopeId, accessor,
|
|
2413
|
+
writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
2419
2414
|
}
|
|
2420
2415
|
function deferBranchStart(chunk) {
|
|
2421
2416
|
const beforeBranch = chunk.html;
|
|
@@ -2425,15 +2420,17 @@ function deferBranchStart(chunk) {
|
|
|
2425
2420
|
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
2426
2421
|
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
2427
2422
|
}
|
|
2428
|
-
function
|
|
2423
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
2424
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
2425
|
+
}
|
|
2426
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
2429
2427
|
const endTag = parentEndTag || "";
|
|
2430
|
-
if (
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
} else $chunk.writeHTML(endTag);
|
|
2428
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
2429
|
+
const { state } = $chunk.boundary;
|
|
2430
|
+
const mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
2431
|
+
$chunk.writeHTML(mark + endTag);
|
|
2432
|
+
} else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
2433
|
+
else $chunk.writeHTML(endTag);
|
|
2437
2434
|
}
|
|
2438
2435
|
let writeScope = (scopeId, partialScope) => {
|
|
2439
2436
|
const { state } = $chunk.boundary;
|
|
@@ -2465,11 +2462,11 @@ function scopeWithId(state, scopeId) {
|
|
|
2465
2462
|
if (!scope) scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId });
|
|
2466
2463
|
return scope;
|
|
2467
2464
|
}
|
|
2468
|
-
function _subscribe(subscribers, scope, resumeId,
|
|
2465
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
2469
2466
|
if (subscribers) {
|
|
2470
2467
|
const { serializer } = $chunk.boundary.state;
|
|
2471
2468
|
if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
|
|
2472
|
-
else if (resumeId) _script(scope[K_SCOPE_ID], resumeId,
|
|
2469
|
+
else if (resumeId) _script(scope[K_SCOPE_ID], resumeId, markerGuard);
|
|
2473
2470
|
else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
2474
2471
|
}
|
|
2475
2472
|
return scope;
|
|
@@ -2478,19 +2475,19 @@ const CLIENT_ALL = 715827883;
|
|
|
2478
2475
|
function maskGroup(mask, group) {
|
|
2479
2476
|
return mask === 715827883 ? 1 : typeof mask === "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
|
|
2480
2477
|
}
|
|
2481
|
-
function
|
|
2482
|
-
$chunk.boundary.state.
|
|
2478
|
+
function _set_scope_reason(reason) {
|
|
2479
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
2483
2480
|
}
|
|
2484
2481
|
function _scope_reason() {
|
|
2485
|
-
const reason = $chunk.boundary.state.
|
|
2486
|
-
$chunk.boundary.state.
|
|
2482
|
+
const reason = $chunk.boundary.state.scopeReason;
|
|
2483
|
+
$chunk.boundary.state.scopeReason = void 0;
|
|
2487
2484
|
return reason;
|
|
2488
2485
|
}
|
|
2489
|
-
function
|
|
2486
|
+
function _write_if(condition, key) {
|
|
2490
2487
|
return condition && maskGroup(condition, key) ? 1 : void 0;
|
|
2491
2488
|
}
|
|
2492
|
-
function
|
|
2493
|
-
return
|
|
2489
|
+
function _write_guard(condition, key) {
|
|
2490
|
+
return _write_if(condition, key) || 0;
|
|
2494
2491
|
}
|
|
2495
2492
|
function writeWaitReady(readyId, renderer, input) {
|
|
2496
2493
|
const chunk = $chunk;
|
|
@@ -2503,6 +2500,7 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
2503
2500
|
flushScopes: false
|
|
2504
2501
|
});
|
|
2505
2502
|
const bodyEnd = body.render(renderer, input);
|
|
2503
|
+
if (boundary.aborted) throw boundary.reason;
|
|
2506
2504
|
if (body === bodyEnd) {
|
|
2507
2505
|
chunk.writeHTML(body.html);
|
|
2508
2506
|
body.deferOwnReady();
|
|
@@ -2512,8 +2510,8 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
2512
2510
|
chunk.next = body;
|
|
2513
2511
|
}
|
|
2514
2512
|
}
|
|
2515
|
-
function _await(scopeId, accessor, promise, content,
|
|
2516
|
-
const resumeMarker =
|
|
2513
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
2514
|
+
const resumeMarker = markerGuard !== 0;
|
|
2517
2515
|
if (!isPromise(promise)) {
|
|
2518
2516
|
if (resumeMarker) {
|
|
2519
2517
|
const branchId = _peek_scope_id();
|
|
@@ -2533,7 +2531,8 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
2533
2531
|
promise.then((value) => {
|
|
2534
2532
|
if (chunk.async) {
|
|
2535
2533
|
chunk.async = false;
|
|
2536
|
-
if (!boundary.
|
|
2534
|
+
if (!boundary.aborted) {
|
|
2535
|
+
const { state } = boundary;
|
|
2537
2536
|
chunk.render(() => {
|
|
2538
2537
|
if (resumeMarker) {
|
|
2539
2538
|
const branchId = _peek_scope_id();
|
|
@@ -2549,6 +2548,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
2549
2548
|
async.end = $chunk;
|
|
2550
2549
|
}
|
|
2551
2550
|
});
|
|
2551
|
+
if (!chunk.async && boundary.pendingReorders?.delete(chunk)) state.reorder(chunk);
|
|
2552
2552
|
boundary.endAsync();
|
|
2553
2553
|
}
|
|
2554
2554
|
}
|
|
@@ -2595,12 +2595,12 @@ function tryBoundary(content, catchContent, branchId, renderers) {
|
|
|
2595
2595
|
const chunk = $chunk;
|
|
2596
2596
|
const { boundary } = chunk;
|
|
2597
2597
|
const { state } = boundary;
|
|
2598
|
-
const catchBoundary = new Boundary(state,
|
|
2598
|
+
const catchBoundary = new Boundary(state, void 0, boundary);
|
|
2599
2599
|
const body = chunk.fork(catchBoundary, null);
|
|
2600
2600
|
const bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
2601
|
-
if (catchBoundary.
|
|
2602
|
-
if (catchContent)
|
|
2603
|
-
|
|
2601
|
+
if (catchBoundary.aborted) {
|
|
2602
|
+
if (!catchContent) throw catchBoundary.reason;
|
|
2603
|
+
catchContent(catchBoundary.reason);
|
|
2604
2604
|
return true;
|
|
2605
2605
|
}
|
|
2606
2606
|
if (body === bodyEnd) {
|
|
@@ -2612,44 +2612,48 @@ function tryBoundary(content, catchContent, branchId, renderers) {
|
|
|
2612
2612
|
chunk.next = body;
|
|
2613
2613
|
boundary.startAsync();
|
|
2614
2614
|
const reorderId = catchContent ? state.nextReorderId() : "";
|
|
2615
|
-
const endMarker = reorderId && state.mark("!", reorderId);
|
|
2616
2615
|
if (reorderId) {
|
|
2617
|
-
chunk.
|
|
2618
|
-
|
|
2616
|
+
chunk.catchRange = {
|
|
2617
|
+
id: reorderId,
|
|
2618
|
+
end: bodyEnd
|
|
2619
|
+
};
|
|
2619
2620
|
captureContext(chunk);
|
|
2620
2621
|
}
|
|
2621
2622
|
catchBoundary.onNext = () => {
|
|
2622
|
-
if (boundary.
|
|
2623
|
-
if (catchBoundary.
|
|
2623
|
+
if (boundary.aborted) return;
|
|
2624
|
+
if (catchBoundary.aborted) {
|
|
2624
2625
|
if (!reorderId) {
|
|
2625
|
-
boundary.abort(catchBoundary.
|
|
2626
|
+
boundary.abort(catchBoundary.reason);
|
|
2626
2627
|
return;
|
|
2627
2628
|
}
|
|
2628
|
-
|
|
2629
|
-
let cur = body;
|
|
2630
|
-
let writeMarker = true;
|
|
2631
|
-
do {
|
|
2632
|
-
const next = cur.next;
|
|
2633
|
-
if (cur.boundary !== catchBoundary) cur.boundary.abort(catchBoundary.signal.reason);
|
|
2634
|
-
if (writeMarker && !cur.consumed) {
|
|
2635
|
-
writeMarker = false;
|
|
2636
|
-
cur.async = false;
|
|
2637
|
-
cur.next = bodyNext;
|
|
2638
|
-
cur.needsWalk = true;
|
|
2639
|
-
cur.html = endMarker;
|
|
2640
|
-
cur.scripts = cur.effects = cur.lastEffect = "";
|
|
2641
|
-
cur.placeholder = cur.reorderId = cur.deferredReady = null;
|
|
2642
|
-
}
|
|
2643
|
-
cur = next;
|
|
2644
|
-
} while (cur !== bodyNext);
|
|
2645
|
-
}
|
|
2629
|
+
const streamed = !chunk.catchRange;
|
|
2646
2630
|
const catchChunk = chunk.fork(boundary, null);
|
|
2647
|
-
|
|
2648
|
-
catchChunk.render(catchContent, catchBoundary.
|
|
2649
|
-
|
|
2631
|
+
chunk.catchRange = null;
|
|
2632
|
+
const inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
2633
|
+
if (boundary.aborted) return;
|
|
2634
|
+
if (bodyEnd.consumed) {
|
|
2635
|
+
catchChunk.reorderId = reorderId;
|
|
2636
|
+
state.reorder(catchChunk);
|
|
2637
|
+
} else {
|
|
2638
|
+
let reorder = null;
|
|
2639
|
+
if (!inOrder) reorder = catchChunk;
|
|
2640
|
+
else if (streamed) reorder = chunk.fork(boundary, null);
|
|
2641
|
+
if (reorder) reorder.reorderId = reorderId;
|
|
2642
|
+
const endMarker = state.mark("!", reorderId);
|
|
2643
|
+
let cut = body;
|
|
2644
|
+
while (cut.consumed) cut = cut.next;
|
|
2645
|
+
cut.async = false;
|
|
2646
|
+
cut.next = inOrder ? catchChunk : bodyNext;
|
|
2647
|
+
cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker;
|
|
2648
|
+
cut.scripts = cut.effects = cut.lastEffect = "";
|
|
2649
|
+
cut.placeholder = cut.reorderId = cut.catchRange = null;
|
|
2650
|
+
cut.deferredReorder = reorder;
|
|
2651
|
+
if (inOrder) catchChunk.next = bodyNext;
|
|
2652
|
+
}
|
|
2650
2653
|
boundary.endAsync();
|
|
2651
2654
|
} else if (!catchBoundary.count) {
|
|
2652
2655
|
if (renderersAtSettle && catchBoundary.resumeWrites) bodyEnd.render(renderers);
|
|
2656
|
+
chunk.catchRange = null;
|
|
2653
2657
|
boundary.endAsync();
|
|
2654
2658
|
} else boundary.onNext();
|
|
2655
2659
|
};
|
|
@@ -2694,7 +2698,7 @@ var State = class {
|
|
|
2694
2698
|
flushScopes = false;
|
|
2695
2699
|
writeScopes = {};
|
|
2696
2700
|
readyIds = null;
|
|
2697
|
-
|
|
2701
|
+
scopeReason;
|
|
2698
2702
|
$global;
|
|
2699
2703
|
constructor($global) {
|
|
2700
2704
|
this.$global = $global;
|
|
@@ -2755,38 +2759,53 @@ var State = class {
|
|
|
2755
2759
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
2756
2760
|
}
|
|
2757
2761
|
};
|
|
2758
|
-
var Boundary = class
|
|
2762
|
+
var Boundary = class {
|
|
2759
2763
|
onNext = NOOP$2;
|
|
2760
2764
|
count = 0;
|
|
2761
2765
|
resumeWrites = 0;
|
|
2762
2766
|
state;
|
|
2763
2767
|
parent;
|
|
2768
|
+
aborted = false;
|
|
2769
|
+
reason;
|
|
2770
|
+
pendingReorders;
|
|
2771
|
+
children;
|
|
2764
2772
|
constructor(state, signal, parent) {
|
|
2765
|
-
super();
|
|
2766
2773
|
this.state = state;
|
|
2767
2774
|
this.parent = parent;
|
|
2768
|
-
|
|
2769
|
-
this.
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
});
|
|
2773
|
-
if (signal) {
|
|
2775
|
+
if (parent) {
|
|
2776
|
+
if (parent.aborted) this.abort(parent.reason);
|
|
2777
|
+
else (parent.children ||= []).push(this);
|
|
2778
|
+
} else if (signal) {
|
|
2774
2779
|
if (signal.aborted) this.abort(signal.reason);
|
|
2775
2780
|
else signal.addEventListener("abort", this);
|
|
2776
2781
|
}
|
|
2777
2782
|
}
|
|
2783
|
+
abort(reason) {
|
|
2784
|
+
if (this.aborted) return;
|
|
2785
|
+
const { state } = this;
|
|
2786
|
+
this.aborted = true;
|
|
2787
|
+
this.reason = reason;
|
|
2788
|
+
if (this.pendingReorders) {
|
|
2789
|
+
for (const reorder of this.pendingReorders) state.reorder(reorder);
|
|
2790
|
+
this.pendingReorders = void 0;
|
|
2791
|
+
}
|
|
2792
|
+
this.count = 0;
|
|
2793
|
+
this.state = new State(state.$global);
|
|
2794
|
+
if (this.children) for (const child of this.children) child.abort(reason);
|
|
2795
|
+
this.onNext();
|
|
2796
|
+
}
|
|
2778
2797
|
handleEvent(event) {
|
|
2779
2798
|
this.abort(event.target.reason);
|
|
2780
2799
|
}
|
|
2781
2800
|
flush() {
|
|
2782
|
-
if (!this.
|
|
2783
|
-
return this.count ? 1 : this.
|
|
2801
|
+
if (!this.aborted) flushSerializer(this, this.state);
|
|
2802
|
+
return this.count ? 1 : this.aborted ? 2 : 0;
|
|
2784
2803
|
}
|
|
2785
2804
|
startAsync() {
|
|
2786
|
-
if (!this.
|
|
2805
|
+
if (!this.aborted) this.count++;
|
|
2787
2806
|
}
|
|
2788
2807
|
endAsync() {
|
|
2789
|
-
if (!this.
|
|
2808
|
+
if (!this.aborted) {
|
|
2790
2809
|
if (!this.count) throw new Error("A boundary ended more async work than it started.");
|
|
2791
2810
|
this.count--;
|
|
2792
2811
|
this.onNext();
|
|
@@ -2800,9 +2819,10 @@ var Chunk = class Chunk {
|
|
|
2800
2819
|
lastEffect = "";
|
|
2801
2820
|
async = false;
|
|
2802
2821
|
consumed = false;
|
|
2803
|
-
needsWalk = false;
|
|
2804
2822
|
reorderId = null;
|
|
2805
2823
|
deferredReady = null;
|
|
2824
|
+
deferredReorder = null;
|
|
2825
|
+
catchRange = null;
|
|
2806
2826
|
placeholder = null;
|
|
2807
2827
|
boundary;
|
|
2808
2828
|
next;
|
|
@@ -2833,7 +2853,6 @@ var Chunk = class Chunk {
|
|
|
2833
2853
|
}
|
|
2834
2854
|
append(chunk) {
|
|
2835
2855
|
this.html += chunk.html;
|
|
2836
|
-
this.needsWalk ||= chunk.needsWalk;
|
|
2837
2856
|
this.effects = concatEffects(this.effects, chunk.effects);
|
|
2838
2857
|
this.scripts = concatScripts(this.scripts, chunk.scripts);
|
|
2839
2858
|
this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
@@ -2853,46 +2872,88 @@ var Chunk = class Chunk {
|
|
|
2853
2872
|
this.deferredReady = concat(deferred, this.deferredReady);
|
|
2854
2873
|
}
|
|
2855
2874
|
}
|
|
2856
|
-
|
|
2857
|
-
const {
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
applyBranchStart(this, beforeBranch, stateful);
|
|
2872
|
-
if (stateful) {
|
|
2873
|
-
this.render(() => writeScope(branchId, { [PlaceholderBranch]: scopeWithId(state, placeholderBranchId) }));
|
|
2874
|
-
this.writeHTML(state.mark("]", scopeId + " " + (PlaceholderBranch + branchId) + " " + placeholderBranchId));
|
|
2875
|
-
body.writeEffect(branchId, PLACEHOLDER_DISMISS_REGISTER_ID);
|
|
2875
|
+
renderPlaceholders(boundary) {
|
|
2876
|
+
const { state } = boundary;
|
|
2877
|
+
restart: for (;;) {
|
|
2878
|
+
let reorders = null;
|
|
2879
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
2880
|
+
if (cur.renderPlaceholder(state)) {
|
|
2881
|
+
if (boundary.aborted) return;
|
|
2882
|
+
continue restart;
|
|
2883
|
+
}
|
|
2884
|
+
if (cur.deferredReorder) (reorders ||= []).push(cur.deferredReorder);
|
|
2885
|
+
}
|
|
2886
|
+
if (state.writeReorders) {
|
|
2887
|
+
for (const reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === false) {
|
|
2888
|
+
if (boundary.aborted) return;
|
|
2889
|
+
continue restart;
|
|
2876
2890
|
}
|
|
2877
|
-
this.writeHTML(state.mark("!", reorderId));
|
|
2878
|
-
state.reorder(body);
|
|
2879
|
-
} else {
|
|
2880
|
-
body.next = this.next;
|
|
2881
|
-
this.next = body;
|
|
2882
2891
|
}
|
|
2892
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === false) {
|
|
2893
|
+
if (boundary.aborted) return;
|
|
2894
|
+
continue restart;
|
|
2895
|
+
}
|
|
2896
|
+
return;
|
|
2883
2897
|
}
|
|
2884
2898
|
}
|
|
2885
|
-
|
|
2899
|
+
renderPlaceholder(state) {
|
|
2900
|
+
const { placeholder } = this;
|
|
2901
|
+
if (!placeholder) return false;
|
|
2902
|
+
this.placeholder = null;
|
|
2903
|
+
if (this.boundary.aborted) return false;
|
|
2904
|
+
const { body } = placeholder;
|
|
2905
|
+
let end = body;
|
|
2906
|
+
while (end.next && !end.async) end = end.next;
|
|
2907
|
+
if (!end.async) {
|
|
2908
|
+
end.next = this.next;
|
|
2909
|
+
this.next = body;
|
|
2910
|
+
return false;
|
|
2911
|
+
}
|
|
2912
|
+
const { branchId, scopeId, placeholderBranchId } = placeholder;
|
|
2913
|
+
const reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
2914
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
2915
|
+
const { effects } = this;
|
|
2916
|
+
const beforeBranch = deferBranchStart(this);
|
|
2917
|
+
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this) this.boundary.abort(/* @__PURE__ */ new Error("An @placeholder cannot contain async content."));
|
|
2918
|
+
if (this.boundary.aborted) return true;
|
|
2919
|
+
const stateful = this.effects !== effects;
|
|
2920
|
+
applyBranchStart(this, beforeBranch, stateful);
|
|
2921
|
+
if (stateful) {
|
|
2922
|
+
this.render(() => writeScope(branchId, { [PlaceholderBranch]: scopeWithId(state, placeholderBranchId) }));
|
|
2923
|
+
this.writeHTML(state.mark("]", scopeId + " " + (PlaceholderBranch + branchId) + " " + placeholderBranchId));
|
|
2924
|
+
end.writeEffect(branchId, PLACEHOLDER_DISMISS_REGISTER_ID);
|
|
2925
|
+
}
|
|
2926
|
+
this.writeHTML(state.mark("!", reorderId));
|
|
2927
|
+
this.deferredReorder = body;
|
|
2928
|
+
return false;
|
|
2929
|
+
}
|
|
2930
|
+
markCatchRange() {
|
|
2931
|
+
const { catchRange } = this;
|
|
2932
|
+
if (catchRange) {
|
|
2933
|
+
const { state } = this.boundary;
|
|
2934
|
+
this.catchRange = null;
|
|
2935
|
+
this.writeHTML(state.mark("!^", catchRange.id));
|
|
2936
|
+
catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
queueDeferredReorder() {
|
|
2940
|
+
const { deferredReorder } = this;
|
|
2941
|
+
if (deferredReorder) {
|
|
2942
|
+
this.deferredReorder = null;
|
|
2943
|
+
deferredReorder.boundary.state.reorder(deferredReorder);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
consume(boundary) {
|
|
2947
|
+
this.renderPlaceholders(boundary);
|
|
2886
2948
|
let cur = this;
|
|
2887
2949
|
let html = "";
|
|
2888
2950
|
let effects = "";
|
|
2889
2951
|
let scripts = "";
|
|
2890
2952
|
let lastEffect = "";
|
|
2891
|
-
let needsWalk = false;
|
|
2892
2953
|
let deferredReady;
|
|
2893
2954
|
while (cur.next && !cur.async) {
|
|
2894
|
-
cur.
|
|
2895
|
-
|
|
2955
|
+
cur.markCatchRange();
|
|
2956
|
+
cur.queueDeferredReorder();
|
|
2896
2957
|
html += cur.html;
|
|
2897
2958
|
if (cur.serializeState.readyId) deferredReady = push(deferredReady, cur);
|
|
2898
2959
|
else {
|
|
@@ -2906,7 +2967,6 @@ var Chunk = class Chunk {
|
|
|
2906
2967
|
}
|
|
2907
2968
|
cur.deferOwnReady();
|
|
2908
2969
|
cur.deferredReady = concat(deferredReady, cur.deferredReady);
|
|
2909
|
-
cur.needsWalk ||= needsWalk;
|
|
2910
2970
|
cur.html = html + cur.html;
|
|
2911
2971
|
cur.effects = concatEffects(effects, cur.effects);
|
|
2912
2972
|
cur.scripts = concatScripts(scripts, cur.scripts);
|
|
@@ -2930,10 +2990,12 @@ var Chunk = class Chunk {
|
|
|
2930
2990
|
const { serializeState } = this;
|
|
2931
2991
|
const { readyId } = serializeState;
|
|
2932
2992
|
let scripts = "";
|
|
2933
|
-
|
|
2993
|
+
const held = this.takeDeferredReady();
|
|
2994
|
+
if (held) for (const chunk of Array.isArray(held) ? held : [held]) {
|
|
2995
|
+
if (chunk.boundary.aborted) continue;
|
|
2934
2996
|
scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects));
|
|
2935
2997
|
if (chunk.effects || chunk.deferredReady) this.deferredReady = push(this.deferredReady, chunk);
|
|
2936
|
-
}
|
|
2998
|
+
}
|
|
2937
2999
|
if (readyId && !this.async) {
|
|
2938
3000
|
const { state } = boundary;
|
|
2939
3001
|
flushSerializer(boundary, serializeState);
|
|
@@ -2962,7 +3024,7 @@ var Chunk = class Chunk {
|
|
|
2962
3024
|
let needsWalk = state.walkOnNextFlush;
|
|
2963
3025
|
if (needsWalk) state.walkOnNextFlush = false;
|
|
2964
3026
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
2965
|
-
for (let channel; !boundary.
|
|
3027
|
+
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
2966
3028
|
const resumes = state.serializer.stringifyScopes([], boundary, channel);
|
|
2967
3029
|
const deps = state.serializer.takeChannelDeps();
|
|
2968
3030
|
state.needsMainRuntime = true;
|
|
@@ -2983,17 +3045,7 @@ var Chunk = class Chunk {
|
|
|
2983
3045
|
let reordered = "";
|
|
2984
3046
|
let needsResumeArray = false;
|
|
2985
3047
|
if (state.writeReorders) {
|
|
2986
|
-
let carried = null;
|
|
2987
3048
|
for (const reorderedChunk of state.writeReorders) {
|
|
2988
|
-
if (reorderedChunk.async && reorderedChunk.consumed) {
|
|
2989
|
-
let aborted = reorderedChunk.boundary;
|
|
2990
|
-
while (aborted && !aborted.signal.aborted) aborted = aborted.parent;
|
|
2991
|
-
if (!aborted) {
|
|
2992
|
-
(carried ||= []).push(reorderedChunk);
|
|
2993
|
-
continue;
|
|
2994
|
-
}
|
|
2995
|
-
reorderedChunk.async = false;
|
|
2996
|
-
}
|
|
2997
3049
|
needsWalk = true;
|
|
2998
3050
|
if (!state.hasReorderRuntime) {
|
|
2999
3051
|
state.hasReorderRuntime = true;
|
|
@@ -3004,10 +3056,11 @@ var Chunk = class Chunk {
|
|
|
3004
3056
|
let reorderHTML = "";
|
|
3005
3057
|
let reorderEffects = "";
|
|
3006
3058
|
let reorderScripts = "";
|
|
3007
|
-
let cur = reorderedChunk;
|
|
3059
|
+
let cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
3008
3060
|
reorderedChunk.reorderId = null;
|
|
3009
|
-
|
|
3010
|
-
cur.
|
|
3061
|
+
while (cur) {
|
|
3062
|
+
cur.markCatchRange();
|
|
3063
|
+
cur.queueDeferredReorder();
|
|
3011
3064
|
cur.deferOwnReady();
|
|
3012
3065
|
const { next } = cur;
|
|
3013
3066
|
const readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
@@ -3018,12 +3071,11 @@ var Chunk = class Chunk {
|
|
|
3018
3071
|
reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts));
|
|
3019
3072
|
if (cur.async) {
|
|
3020
3073
|
reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId());
|
|
3021
|
-
|
|
3074
|
+
(cur.boundary.pendingReorders ||= /* @__PURE__ */ new Set()).add(cur);
|
|
3022
3075
|
cur.html = cur.effects = cur.scripts = cur.lastEffect = "";
|
|
3023
3076
|
cur.next = null;
|
|
3024
3077
|
}
|
|
3025
|
-
|
|
3026
|
-
else break;
|
|
3078
|
+
cur = next;
|
|
3027
3079
|
}
|
|
3028
3080
|
if (reorderEffects) {
|
|
3029
3081
|
if (this.async) {
|
|
@@ -3038,7 +3090,7 @@ var Chunk = class Chunk {
|
|
|
3038
3090
|
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}");
|
|
3039
3091
|
html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
3040
3092
|
}
|
|
3041
|
-
state.writeReorders =
|
|
3093
|
+
state.writeReorders = null;
|
|
3042
3094
|
}
|
|
3043
3095
|
flushSerializer(boundary, state);
|
|
3044
3096
|
if (state.resumes || needsResumeArray && !state.hasWrittenResume) scripts = concatScripts(scripts, state.resumeScript(state.resumes));
|
|
@@ -3052,16 +3104,19 @@ var Chunk = class Chunk {
|
|
|
3052
3104
|
}
|
|
3053
3105
|
flushHTML(boundary) {
|
|
3054
3106
|
const { state } = boundary;
|
|
3055
|
-
if (this.needsWalk) {
|
|
3056
|
-
this.needsWalk = false;
|
|
3057
|
-
state.walkOnNextFlush = true;
|
|
3058
|
-
}
|
|
3059
3107
|
this.flushScript(boundary);
|
|
3060
3108
|
const { html, scripts } = this;
|
|
3061
3109
|
this.html = this.scripts = "";
|
|
3062
3110
|
return state.flushChunk(html, scripts, boundary.count);
|
|
3063
3111
|
}
|
|
3064
3112
|
};
|
|
3113
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
3114
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
3115
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return false;
|
|
3116
|
+
if (cur.deferredReorder) (reorders ||= []).push(cur.deferredReorder);
|
|
3117
|
+
}
|
|
3118
|
+
return reorders;
|
|
3119
|
+
}
|
|
3065
3120
|
function flushSerializer(boundary, serializeState) {
|
|
3066
3121
|
const { state } = boundary;
|
|
3067
3122
|
const { serializer } = state;
|
|
@@ -3223,8 +3278,8 @@ function _escape_comment(val) {
|
|
|
3223
3278
|
//#endregion
|
|
3224
3279
|
//#region src/html/dynamic-tag.ts
|
|
3225
3280
|
const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
|
3226
|
-
let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs,
|
|
3227
|
-
const shouldResume =
|
|
3281
|
+
let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard) => {
|
|
3282
|
+
const shouldResume = markerGuard !== 0;
|
|
3228
3283
|
const renderer = normalizeDynamicRenderer(tag);
|
|
3229
3284
|
const state = getState();
|
|
3230
3285
|
const branchId = _peek_scope_id();
|
|
@@ -3244,8 +3299,8 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
3244
3299
|
_html(_attrs_textarea_value(branchId, `#${renderer.toLowerCase()}/0`, input));
|
|
3245
3300
|
} else {
|
|
3246
3301
|
if (renderContent && typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
3247
|
-
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0,
|
|
3248
|
-
else if (renderContent) _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0,
|
|
3302
|
+
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, markerGuard) : void 0, 1);
|
|
3303
|
+
else if (renderContent) _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, markerGuard);
|
|
3249
3304
|
}
|
|
3250
3305
|
_html(`</${renderer}>`);
|
|
3251
3306
|
} else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
@@ -3264,13 +3319,13 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
3264
3319
|
const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
|
|
3265
3320
|
const render = () => {
|
|
3266
3321
|
if (renderer) try {
|
|
3267
|
-
|
|
3322
|
+
_set_scope_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0);
|
|
3268
3323
|
return inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
3269
3324
|
...inputOrArgs,
|
|
3270
3325
|
content
|
|
3271
3326
|
} : inputOrArgs);
|
|
3272
3327
|
} finally {
|
|
3273
|
-
|
|
3328
|
+
_set_scope_reason(void 0);
|
|
3274
3329
|
}
|
|
3275
3330
|
else if (content) return content();
|
|
3276
3331
|
};
|
|
@@ -3486,13 +3541,13 @@ var ServerRendered = class {
|
|
|
3486
3541
|
switch (!boundary.count && boundary.flush()) {
|
|
3487
3542
|
case 2:
|
|
3488
3543
|
settle(boundary);
|
|
3489
|
-
reject(boundary.
|
|
3544
|
+
reject(boundary.reason);
|
|
3490
3545
|
break;
|
|
3491
3546
|
case 0:
|
|
3492
|
-
head = head.consume();
|
|
3493
|
-
if (boundary.
|
|
3547
|
+
head = head.consume(boundary);
|
|
3548
|
+
if (boundary.aborted) break;
|
|
3494
3549
|
html += head.flushHTML(boundary);
|
|
3495
|
-
if (!(boundary.count || boundary.
|
|
3550
|
+
if (!(boundary.count || boundary.aborted)) {
|
|
3496
3551
|
settle(boundary);
|
|
3497
3552
|
resolve(html);
|
|
3498
3553
|
}
|
|
@@ -3523,14 +3578,14 @@ var ServerRendered = class {
|
|
|
3523
3578
|
if (status === 2) {
|
|
3524
3579
|
if (!tick) offTick(onNext);
|
|
3525
3580
|
settle(boundary);
|
|
3526
|
-
onAbort(boundary.
|
|
3581
|
+
onAbort(boundary.reason);
|
|
3527
3582
|
return;
|
|
3528
3583
|
}
|
|
3529
3584
|
if (write || status === 0) {
|
|
3530
|
-
head = head.consume();
|
|
3531
|
-
if (boundary.
|
|
3585
|
+
head = head.consume(boundary);
|
|
3586
|
+
if (boundary.aborted) continue;
|
|
3532
3587
|
const html = head.flushHTML(boundary);
|
|
3533
|
-
if (boundary.
|
|
3588
|
+
if (boundary.aborted) continue;
|
|
3534
3589
|
if (html) onWrite(html);
|
|
3535
3590
|
if (!boundary.count) {
|
|
3536
3591
|
if (!tick) offTick(onNext);
|
|
@@ -3554,10 +3609,10 @@ var ServerRendered = class {
|
|
|
3554
3609
|
this.#head = null;
|
|
3555
3610
|
if (!head) throw new Error(CONSUMED_RESULT_MESSAGE);
|
|
3556
3611
|
const { boundary } = head;
|
|
3557
|
-
const html = boundary.flush() === 0 ? head.consume().flushHTML(boundary) : "";
|
|
3612
|
+
const html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
3558
3613
|
if (boundary.count) boundary.abort(/* @__PURE__ */ new Error("Cannot consume asynchronous render with 'toString'"));
|
|
3559
3614
|
settle(boundary);
|
|
3560
|
-
if (boundary.
|
|
3615
|
+
if (boundary.aborted) throw boundary.reason;
|
|
3561
3616
|
return html;
|
|
3562
3617
|
}
|
|
3563
3618
|
};
|
|
@@ -3731,7 +3786,7 @@ const compat = {
|
|
|
3731
3786
|
chunk ||= this.createChunk($global);
|
|
3732
3787
|
const { boundary } = chunk;
|
|
3733
3788
|
const scripts = boundary.flush() === 0 ? chunk.flushScript(boundary).scripts : "";
|
|
3734
|
-
if (boundary.
|
|
3789
|
+
if (boundary.aborted) throw boundary.reason;
|
|
3735
3790
|
if (boundary.count) throw new Error("Cannot serialize promise across tags/class compat layer.");
|
|
3736
3791
|
return scripts;
|
|
3737
3792
|
},
|
|
@@ -3760,11 +3815,11 @@ const compat = {
|
|
|
3760
3815
|
writeScope(scopeId, { m5c: component.id });
|
|
3761
3816
|
_script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
3762
3817
|
}
|
|
3763
|
-
|
|
3818
|
+
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
3764
3819
|
try {
|
|
3765
3820
|
renderer(normalizedInput);
|
|
3766
3821
|
} finally {
|
|
3767
|
-
|
|
3822
|
+
_set_scope_reason(void 0);
|
|
3768
3823
|
}
|
|
3769
3824
|
const asyncOut = classAPIOut.beginAsync({
|
|
3770
3825
|
last: true,
|
|
@@ -3772,12 +3827,12 @@ const compat = {
|
|
|
3772
3827
|
});
|
|
3773
3828
|
classAPIOut.onLast((next) => {
|
|
3774
3829
|
(boundary.onNext = () => {
|
|
3775
|
-
if (boundary.
|
|
3776
|
-
asyncOut.error(boundary.
|
|
3830
|
+
if (boundary.aborted) {
|
|
3831
|
+
asyncOut.error(boundary.reason);
|
|
3777
3832
|
boundary.onNext = NOOP;
|
|
3778
3833
|
} else if (!boundary.count) {
|
|
3779
3834
|
boundary.onNext = NOOP;
|
|
3780
|
-
head = head.consume();
|
|
3835
|
+
head = head.consume(boundary);
|
|
3781
3836
|
asyncOut.write(head.html);
|
|
3782
3837
|
asyncOut.script(head.scripts);
|
|
3783
3838
|
asyncOut.end();
|
|
@@ -3889,9 +3944,7 @@ exports._scope_id = _scope_id;
|
|
|
3889
3944
|
exports._scope_reason = _scope_reason;
|
|
3890
3945
|
exports._scope_with_id = _scope_with_id;
|
|
3891
3946
|
exports._script = _script;
|
|
3892
|
-
exports.
|
|
3893
|
-
exports._serialize_if = _serialize_if;
|
|
3894
|
-
exports._set_serialize_reason = _set_serialize_reason;
|
|
3947
|
+
exports._set_scope_reason = _set_scope_reason;
|
|
3895
3948
|
exports._show_end = _show_end;
|
|
3896
3949
|
exports._show_start = _show_start;
|
|
3897
3950
|
exports._style_html = _style_html;
|
|
@@ -3904,6 +3957,8 @@ exports._trailers = _trailers;
|
|
|
3904
3957
|
exports._try = _try;
|
|
3905
3958
|
exports._unescaped = _unescaped;
|
|
3906
3959
|
exports._var = _var;
|
|
3960
|
+
exports._write_guard = _write_guard;
|
|
3961
|
+
exports._write_if = _write_if;
|
|
3907
3962
|
exports.attrTag = attrTag;
|
|
3908
3963
|
exports.attrTags = attrTags;
|
|
3909
3964
|
exports.compat = compat;
|