marko 6.3.20 → 6.3.21
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 +29 -3
- package/dist/common/accessor.d.ts +21 -75
- package/dist/common/accessor.debug.d.ts +21 -75
- package/dist/common/constants/accessor-prefix.d.ts +16 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +16 -0
- package/dist/common/constants/accessor-prop.d.ts +30 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +30 -0
- package/dist/common/constants/closure-signal-prop.d.ts +6 -0
- package/dist/common/constants/closure-signal-prop.debug.d.ts +6 -0
- package/dist/common/constants/controlled-type.d.ts +9 -0
- package/dist/common/constants/keyed-scopes-prop.d.ts +4 -0
- package/dist/common/constants/keyed-scopes-prop.debug.d.ts +4 -0
- package/dist/common/constants/load-signal-value.d.ts +5 -0
- package/dist/common/constants/load-signal-value.debug.d.ts +5 -0
- package/dist/common/constants/node-type.d.ts +7 -0
- package/dist/common/constants/pending-render-prop.d.ts +9 -0
- package/dist/common/constants/pending-render-prop.debug.d.ts +9 -0
- package/dist/common/constants/renderer-prop.d.ts +12 -0
- package/dist/common/constants/renderer-prop.debug.d.ts +12 -0
- package/dist/common/constants/resume-symbol.d.ts +10 -0
- package/dist/common/constants/walk-code.d.ts +17 -0
- package/dist/common/constants/walk-range-size.d.ts +7 -0
- package/dist/common/types.d.ts +15 -45
- package/dist/debug/dom.js +291 -225
- package/dist/debug/dom.mjs +291 -225
- package/dist/debug/html.js +184 -41
- package/dist/debug/html.mjs +184 -41
- package/dist/dom/compat.d.ts +1 -1
- package/dist/dom/control-flow.d.ts +1 -1
- package/dist/dom/renderer.d.ts +2 -2
- package/dist/dom/scope.d.ts +1 -1
- package/dist/dom.js +8 -6
- package/dist/dom.mjs +8 -6
- package/dist/html/constants/char.d.ts +11 -0
- package/dist/html/constants/flush-status.d.ts +6 -0
- package/dist/html/constants/mark.d.ts +6 -0
- package/dist/html/constants/runtime-key.d.ts +7 -0
- package/dist/html/writer.d.ts +19 -23
- package/dist/html.js +127 -28
- package/dist/html.mjs +127 -28
- package/dist/translator/core/if.d.ts +7 -7
- package/dist/translator/core/index.d.ts +7 -7
- package/dist/translator/index.d.ts +9 -9
- package/dist/translator/index.js +185 -132
- package/dist/translator/interop/constants/feature-type.d.ts +5 -0
- package/dist/translator/interop/index.d.ts +2 -2
- package/dist/translator/util/body-to-text-literal.d.ts +2 -2
- package/dist/translator/util/constants/binding-type.d.ts +10 -0
- package/dist/translator/util/constants/compile-stage.d.ts +8 -0
- package/dist/translator/util/constants/content-type.d.ts +8 -0
- package/dist/translator/util/constants/step.d.ts +5 -0
- package/dist/translator/util/constants/tag-name-type.d.ts +7 -0
- package/dist/translator/util/is-static.d.ts +1 -1
- package/dist/translator/util/references.d.ts +5 -12
- package/dist/translator/util/sections.d.ts +4 -8
- package/dist/translator/util/signals.d.ts +1 -0
- package/dist/translator/util/tag-name-type.d.ts +4 -7
- package/dist/translator/util/walks.d.ts +4 -6
- package/dist/translator/visitors/constants/sibling-text.d.ts +7 -0
- package/dist/translator/visitors/placeholder.d.ts +2 -6
- package/dist/translator/visitors/tag/constants/class-hydration.d.ts +5 -0
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +2 -4
- package/package.json +15 -15
- package/tags-html.d.ts +98 -22
package/dist/debug/html.js
CHANGED
|
@@ -21,6 +21,24 @@ function* attrTagIterator() {
|
|
|
21
21
|
yield* this[rest];
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
+
//#region src/common/constants/accessor-prefix.debug.ts
|
|
25
|
+
const BranchScopes = "BranchScopes:";
|
|
26
|
+
const ConditionalRenderer = "ConditionalRenderer:";
|
|
27
|
+
const ControlledHandler = "ControlledHandler:";
|
|
28
|
+
const ControlledType = "ControlledType:";
|
|
29
|
+
const ControlledValue = "ControlledValue:";
|
|
30
|
+
const EventAttributes = "EventAttributes:";
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/common/constants/accessor-prop.debug.ts
|
|
33
|
+
const BranchAccessor = "#BranchAccessor";
|
|
34
|
+
const CatchContent = "#CatchContent";
|
|
35
|
+
const ClosestBranchId = "#ClosestBranchId";
|
|
36
|
+
const LoopKey = "#LoopKey";
|
|
37
|
+
const PlaceholderContent = "#PlaceholderContent";
|
|
38
|
+
const Renderer = "#Renderer";
|
|
39
|
+
const TagVariable = "#TagVariable";
|
|
40
|
+
const Embed = "embed";
|
|
41
|
+
//#endregion
|
|
24
42
|
//#region src/common/helpers.ts
|
|
25
43
|
const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
26
44
|
const knownWrongAttrs = {
|
|
@@ -523,14 +541,15 @@ var State$1 = class {
|
|
|
523
541
|
mutated = [];
|
|
524
542
|
};
|
|
525
543
|
var Reference = class {
|
|
544
|
+
assigns = null;
|
|
545
|
+
calls = null;
|
|
546
|
+
scopeId = void 0;
|
|
547
|
+
channel = void 0;
|
|
526
548
|
parent;
|
|
527
549
|
accessor;
|
|
528
550
|
flush;
|
|
529
551
|
pos;
|
|
530
552
|
id;
|
|
531
|
-
assigns = null;
|
|
532
|
-
scopeId = void 0;
|
|
533
|
-
channel = void 0;
|
|
534
553
|
constructor(parent, accessor, flush, pos = null, id = null) {
|
|
535
554
|
this.parent = parent;
|
|
536
555
|
this.accessor = accessor;
|
|
@@ -635,14 +654,31 @@ function writeScopesRoot(state, flushes) {
|
|
|
635
654
|
function writeAssigned(state) {
|
|
636
655
|
let sep = state.buf.length ? "," : "";
|
|
637
656
|
if (state.assigned.size) {
|
|
657
|
+
const assigned = state.assigned;
|
|
658
|
+
state.assigned = /* @__PURE__ */ new Set();
|
|
638
659
|
let buf = "";
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
ref.assigns
|
|
642
|
-
|
|
660
|
+
let hasCalls = false;
|
|
661
|
+
for (const ref of assigned) {
|
|
662
|
+
if (ref.assigns) {
|
|
663
|
+
buf += sep + assignsToString(ref.assigns, ref.id);
|
|
664
|
+
ref.assigns = null;
|
|
665
|
+
sep = ",";
|
|
666
|
+
}
|
|
667
|
+
hasCalls ||= ref.calls !== null;
|
|
668
|
+
}
|
|
669
|
+
if (buf) state.buf.push(buf);
|
|
670
|
+
if (hasCalls) for (const ref of assigned) {
|
|
671
|
+
if (!ref.calls) continue;
|
|
672
|
+
for (const { method, args } of ref.calls) {
|
|
673
|
+
state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
|
|
674
|
+
for (let a = 0; a < args.length; a++) {
|
|
675
|
+
if (a) state.buf.push(",");
|
|
676
|
+
writeCallArg(state, args[a]);
|
|
677
|
+
}
|
|
678
|
+
state.buf.push(")");
|
|
679
|
+
}
|
|
680
|
+
ref.calls = null;
|
|
643
681
|
}
|
|
644
|
-
state.buf.push(buf);
|
|
645
|
-
state.assigned = /* @__PURE__ */ new Set();
|
|
646
682
|
}
|
|
647
683
|
if (hasChannelMutations(state)) {
|
|
648
684
|
const remaining = [];
|
|
@@ -677,8 +713,14 @@ function writeAssigned(state) {
|
|
|
677
713
|
state.buf.push(")");
|
|
678
714
|
}
|
|
679
715
|
state.mutated = remaining;
|
|
680
|
-
if (state.assigned.size) writeAssigned(state);
|
|
681
716
|
}
|
|
717
|
+
if (state.assigned.size) writeAssigned(state);
|
|
718
|
+
}
|
|
719
|
+
function writeCallArg(state, val) {
|
|
720
|
+
if (val === void 0) {
|
|
721
|
+
state.wroteUndefined = true;
|
|
722
|
+
state.buf.push("$");
|
|
723
|
+
} else if (!writeProp(state, val, null, "")) state.buf.push("void 0");
|
|
682
724
|
}
|
|
683
725
|
function hasChannelMutations(state) {
|
|
684
726
|
return hasMatchingMutations(state.mutated, state.channel?.readyId);
|
|
@@ -873,6 +915,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
873
915
|
case Float64Array:
|
|
874
916
|
case BigInt64Array:
|
|
875
917
|
case BigUint64Array: return writeTypedArray(state, val, ref);
|
|
918
|
+
case DataView: return writeDataView(state, val, ref);
|
|
876
919
|
case WeakSet: return writeWeakSet(state);
|
|
877
920
|
case WeakMap: return writeWeakMap(state);
|
|
878
921
|
case globalThis.URL: return writeURL(state, val);
|
|
@@ -882,6 +925,24 @@ function writeUnknownObject(state, val, ref) {
|
|
|
882
925
|
case globalThis.ReadableStream: return writeReadableStream(state, val, ref);
|
|
883
926
|
case globalThis.Request: return writeRequest(state, val, ref);
|
|
884
927
|
case globalThis.Response: return writeResponse(state, val, ref);
|
|
928
|
+
case globalThis.Intl?.NumberFormat: return writeIntl(state, val, "NumberFormat", ref);
|
|
929
|
+
case globalThis.Intl?.DateTimeFormat: return writeIntl(state, val, "DateTimeFormat", ref);
|
|
930
|
+
case globalThis.Intl?.Collator: return writeIntl(state, val, "Collator", ref);
|
|
931
|
+
case globalThis.Intl?.PluralRules: return writeIntl(state, val, "PluralRules", ref);
|
|
932
|
+
case globalThis.Intl?.RelativeTimeFormat: return writeIntl(state, val, "RelativeTimeFormat", ref);
|
|
933
|
+
case globalThis.Intl?.ListFormat: return writeIntl(state, val, "ListFormat", ref);
|
|
934
|
+
case globalThis.Intl?.DisplayNames: return writeIntl(state, val, "DisplayNames", ref);
|
|
935
|
+
case globalThis.Intl?.Segmenter: return writeIntl(state, val, "Segmenter", ref);
|
|
936
|
+
case globalThis.Intl?.DurationFormat: return writeIntl(state, val, "DurationFormat", ref);
|
|
937
|
+
case globalThis.Intl?.Locale: return writeIntlLocale(state, val);
|
|
938
|
+
case globalThis.Temporal?.Instant: return writeTemporal(state, val, "Instant");
|
|
939
|
+
case globalThis.Temporal?.Duration: return writeTemporal(state, val, "Duration");
|
|
940
|
+
case globalThis.Temporal?.PlainDate: return writeTemporal(state, val, "PlainDate");
|
|
941
|
+
case globalThis.Temporal?.PlainDateTime: return writeTemporal(state, val, "PlainDateTime");
|
|
942
|
+
case globalThis.Temporal?.PlainMonthDay: return writeTemporal(state, val, "PlainMonthDay");
|
|
943
|
+
case globalThis.Temporal?.PlainTime: return writeTemporal(state, val, "PlainTime");
|
|
944
|
+
case globalThis.Temporal?.PlainYearMonth: return writeTemporal(state, val, "PlainYearMonth");
|
|
945
|
+
case globalThis.Temporal?.ZonedDateTime: return writeTemporal(state, val, "ZonedDateTime");
|
|
885
946
|
}
|
|
886
947
|
throwUnserializable(state, val, ref);
|
|
887
948
|
return false;
|
|
@@ -950,9 +1011,15 @@ function writeMap(state, val, ref) {
|
|
|
950
1011
|
const items = [];
|
|
951
1012
|
let assigns;
|
|
952
1013
|
let needsId;
|
|
1014
|
+
let deferring = false;
|
|
953
1015
|
let i = 0;
|
|
954
1016
|
if (val.size < 25) {
|
|
955
1017
|
for (let [itemKey, itemValue] of val) {
|
|
1018
|
+
if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue))) deferring = true;
|
|
1019
|
+
if (deferring) {
|
|
1020
|
+
deferCall(state, ref, "set", [itemKey, itemValue]);
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
956
1023
|
if (itemKey === val) {
|
|
957
1024
|
itemKey = void 0;
|
|
958
1025
|
(assigns ||= []).push("a[" + i + "][0]");
|
|
@@ -967,6 +1034,11 @@ function writeMap(state, val, ref) {
|
|
|
967
1034
|
writeArrayArg(state, ref, items, assigns && "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
|
|
968
1035
|
} else {
|
|
969
1036
|
for (let [itemKey, itemValue] of val) {
|
|
1037
|
+
if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue))) deferring = true;
|
|
1038
|
+
if (deferring) {
|
|
1039
|
+
deferCall(state, ref, "set", [itemKey, itemValue]);
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
970
1042
|
if (itemKey === val) {
|
|
971
1043
|
itemKey = 0;
|
|
972
1044
|
(assigns ||= []).push("a[" + i + "]");
|
|
@@ -990,8 +1062,14 @@ function writeSet(state, val, ref) {
|
|
|
990
1062
|
const items = [];
|
|
991
1063
|
let assigns;
|
|
992
1064
|
let needsId;
|
|
1065
|
+
let deferring = false;
|
|
993
1066
|
let i = 0;
|
|
994
1067
|
for (let item of val) {
|
|
1068
|
+
if (!deferring && item !== val && isAncestorMember(state, ref, item)) deferring = true;
|
|
1069
|
+
if (deferring) {
|
|
1070
|
+
deferCall(state, ref, "add", [item]);
|
|
1071
|
+
continue;
|
|
1072
|
+
}
|
|
995
1073
|
if (item === val) {
|
|
996
1074
|
item = 0;
|
|
997
1075
|
(assigns ||= []).push("i[" + i + "]");
|
|
@@ -1001,6 +1079,19 @@ function writeSet(state, val, ref) {
|
|
|
1001
1079
|
writeArrayArg(state, ref, items, assigns && "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
|
|
1002
1080
|
return true;
|
|
1003
1081
|
}
|
|
1082
|
+
function isAncestorMember(state, container, member) {
|
|
1083
|
+
if (member === null || typeof member !== "object" && typeof member !== "function") return false;
|
|
1084
|
+
const ref = state.refs.get(member);
|
|
1085
|
+
return ref !== void 0 && isCircular(container, ref);
|
|
1086
|
+
}
|
|
1087
|
+
function deferCall(state, ref, method, args) {
|
|
1088
|
+
ensureId(state, ref);
|
|
1089
|
+
(ref.calls ||= []).push({
|
|
1090
|
+
method,
|
|
1091
|
+
args
|
|
1092
|
+
});
|
|
1093
|
+
state.assigned.add(ref);
|
|
1094
|
+
}
|
|
1004
1095
|
function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
1005
1096
|
if (assignsPrefix || needsId) {
|
|
1006
1097
|
const arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
|
|
@@ -1021,6 +1112,20 @@ function isDedupedMember(val) {
|
|
|
1021
1112
|
default: return false;
|
|
1022
1113
|
}
|
|
1023
1114
|
}
|
|
1115
|
+
function canWriteBuffer(state, buffer, ref) {
|
|
1116
|
+
if (Object.getPrototypeOf(buffer)?.constructor === ArrayBuffer) return true;
|
|
1117
|
+
throwUnserializable(state, buffer, ref, "buffer");
|
|
1118
|
+
return false;
|
|
1119
|
+
}
|
|
1120
|
+
function writeDataView(state, val, ref) {
|
|
1121
|
+
const { buffer } = val;
|
|
1122
|
+
if (!canWriteBuffer(state, buffer, ref)) return false;
|
|
1123
|
+
const needsLength = val.byteOffset + val.byteLength < buffer.byteLength;
|
|
1124
|
+
state.buf.push("new DataView(");
|
|
1125
|
+
writeProp(state, buffer, ref, "buffer");
|
|
1126
|
+
state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.byteLength : "") : "") + ")");
|
|
1127
|
+
return true;
|
|
1128
|
+
}
|
|
1024
1129
|
function writeArrayBuffer(state, val) {
|
|
1025
1130
|
let result;
|
|
1026
1131
|
if (val.byteLength) {
|
|
@@ -1032,6 +1137,7 @@ function writeArrayBuffer(state, val) {
|
|
|
1032
1137
|
}
|
|
1033
1138
|
function writeTypedArray(state, val, ref) {
|
|
1034
1139
|
if (val.byteOffset || val.byteLength < val.buffer.byteLength || state.refs.has(val.buffer)) {
|
|
1140
|
+
if (!canWriteBuffer(state, val.buffer, ref)) return false;
|
|
1035
1141
|
const needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
|
|
1036
1142
|
state.buf.push("new " + val.constructor.name + "(");
|
|
1037
1143
|
writeProp(state, val.buffer, ref, "buffer");
|
|
@@ -1191,6 +1297,34 @@ function writeResponse(state, val, ref) {
|
|
|
1191
1297
|
}
|
|
1192
1298
|
return true;
|
|
1193
1299
|
}
|
|
1300
|
+
function writeIntl(state, val, name, ref) {
|
|
1301
|
+
const { locale, ...options } = val.resolvedOptions();
|
|
1302
|
+
let needsId = false;
|
|
1303
|
+
for (const key in options) if (isDedupedMember(options[key])) {
|
|
1304
|
+
needsId = true;
|
|
1305
|
+
break;
|
|
1306
|
+
}
|
|
1307
|
+
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
1308
|
+
let optionsRef;
|
|
1309
|
+
if (needsId) {
|
|
1310
|
+
optionsRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
|
|
1311
|
+
state.buf.push(optionsRef.id + "={");
|
|
1312
|
+
} else {
|
|
1313
|
+
optionsRef = new Reference(ref, null, state.flush, state.buf.length);
|
|
1314
|
+
state.buf.push("{");
|
|
1315
|
+
}
|
|
1316
|
+
writeObjectProps(state, options, optionsRef);
|
|
1317
|
+
state.buf.push("})");
|
|
1318
|
+
return true;
|
|
1319
|
+
}
|
|
1320
|
+
function writeIntlLocale(state, val) {
|
|
1321
|
+
state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")");
|
|
1322
|
+
return true;
|
|
1323
|
+
}
|
|
1324
|
+
function writeTemporal(state, val, name) {
|
|
1325
|
+
state.buf.push("Temporal." + name + ".from(" + quote(val.toString(), 0) + ")");
|
|
1326
|
+
return true;
|
|
1327
|
+
}
|
|
1194
1328
|
function writeReadableStream(state, val, ref) {
|
|
1195
1329
|
const { boundary, channel } = state;
|
|
1196
1330
|
if (!boundary || val.locked) return false;
|
|
@@ -1345,6 +1479,7 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
|
|
|
1345
1479
|
if (accessor) access = toAccess(accessor) + access;
|
|
1346
1480
|
if (access[0] === ".") access = access.slice(1);
|
|
1347
1481
|
if (access) message += ` (reading ${access})`;
|
|
1482
|
+
message += ". Values referenced in the browser must be serializable.";
|
|
1348
1483
|
const err = new TypeError(message, { cause });
|
|
1349
1484
|
err.stack = void 0;
|
|
1350
1485
|
state.boundary.abort(err);
|
|
@@ -1797,7 +1932,7 @@ function _sep(shouldResume) {
|
|
|
1797
1932
|
}
|
|
1798
1933
|
function _resume_branch(scopeId) {
|
|
1799
1934
|
const branchId = $chunk.context?.[kBranchId];
|
|
1800
|
-
if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { [
|
|
1935
|
+
if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { [ClosestBranchId]: branchId });
|
|
1801
1936
|
}
|
|
1802
1937
|
function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
|
|
1803
1938
|
const shouldResume = serializeReason !== 0;
|
|
@@ -1807,8 +1942,8 @@ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
|
|
|
1807
1942
|
else render();
|
|
1808
1943
|
if (_peek_scope_id() !== branchId) {
|
|
1809
1944
|
if (shouldResume) writeScope(scopeId, {
|
|
1810
|
-
[
|
|
1811
|
-
[
|
|
1945
|
+
[BranchScopes + nodeAccessor]: writeScope(branchId, {}),
|
|
1946
|
+
[ConditionalRenderer + nodeAccessor]: render?.["id"]
|
|
1812
1947
|
});
|
|
1813
1948
|
} else _scope_id();
|
|
1814
1949
|
}
|
|
@@ -1819,8 +1954,8 @@ function normalizeServerRender(value) {
|
|
|
1819
1954
|
}
|
|
1820
1955
|
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
|
|
1821
1956
|
writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
|
|
1822
|
-
const childScope = writeScopePassive(childScopeId, { [
|
|
1823
|
-
if (nodeAccessor !== void 0) writeScope(parentScopeId, { [
|
|
1957
|
+
const childScope = writeScopePassive(childScopeId, { [TagVariable]: _resume({}, registryId, parentScopeId) });
|
|
1958
|
+
if (nodeAccessor !== void 0) writeScope(parentScopeId, { [BranchScopes + nodeAccessor]: childScope });
|
|
1824
1959
|
}
|
|
1825
1960
|
function writeScopePassive(scopeId, partialScope) {
|
|
1826
1961
|
const target = $chunk.serializeState;
|
|
@@ -1896,11 +2031,11 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1896
2031
|
}
|
|
1897
2032
|
withBranchId(branchId, () => {
|
|
1898
2033
|
render();
|
|
1899
|
-
const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { [
|
|
2034
|
+
const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { [LoopKey]: itemKey } : {});
|
|
1900
2035
|
if (!resumeMarker) loopScopes = push(loopScopes, branchScope);
|
|
1901
2036
|
});
|
|
1902
2037
|
});
|
|
1903
|
-
if (loopScopes) writeScope(scopeId, { [
|
|
2038
|
+
if (loopScopes) writeScope(scopeId, { [BranchScopes + accessor]: loopScopes });
|
|
1904
2039
|
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1905
2040
|
}
|
|
1906
2041
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
@@ -1912,8 +2047,8 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
|
|
|
1912
2047
|
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
|
1913
2048
|
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1914
2049
|
if (shouldWriteBranch && (branchIndex || !resumeMarker)) writeScope(scopeId, {
|
|
1915
|
-
[
|
|
1916
|
-
[
|
|
2050
|
+
[ConditionalRenderer + accessor]: branchIndex || void 0,
|
|
2051
|
+
[BranchScopes + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1917
2052
|
});
|
|
1918
2053
|
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1919
2054
|
}
|
|
@@ -2046,9 +2181,9 @@ function _try(scopeId, accessor, content, input) {
|
|
|
2046
2181
|
else if (placeholderContent) tryPlaceholder(content, placeholderContent, branchId);
|
|
2047
2182
|
else content();
|
|
2048
2183
|
writeScope(branchId, {
|
|
2049
|
-
[
|
|
2050
|
-
[
|
|
2051
|
-
[
|
|
2184
|
+
[BranchAccessor]: accessor,
|
|
2185
|
+
[CatchContent]: catchContent,
|
|
2186
|
+
[PlaceholderContent]: placeholderContent
|
|
2052
2187
|
});
|
|
2053
2188
|
$chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2054
2189
|
}
|
|
@@ -2121,7 +2256,6 @@ function tryCatch(content, catchContent) {
|
|
|
2121
2256
|
}
|
|
2122
2257
|
const NOOP$2 = () => {};
|
|
2123
2258
|
var State = class {
|
|
2124
|
-
$global;
|
|
2125
2259
|
tagId = 1;
|
|
2126
2260
|
scopeId = 1;
|
|
2127
2261
|
reorderId = 1;
|
|
@@ -2143,6 +2277,7 @@ var State = class {
|
|
|
2143
2277
|
writeScopes = {};
|
|
2144
2278
|
readyIds = null;
|
|
2145
2279
|
serializeReason;
|
|
2280
|
+
$global;
|
|
2146
2281
|
constructor($global) {
|
|
2147
2282
|
this.$global = $global;
|
|
2148
2283
|
if ($global.cspNonce) this.nonceAttr = " nonce" + attrAssignment($global.cspNonce);
|
|
@@ -2185,10 +2320,10 @@ var State = class {
|
|
|
2185
2320
|
}
|
|
2186
2321
|
};
|
|
2187
2322
|
var Boundary = class extends AbortController {
|
|
2188
|
-
state;
|
|
2189
|
-
parent;
|
|
2190
2323
|
onNext = NOOP$2;
|
|
2191
2324
|
count = 0;
|
|
2325
|
+
state;
|
|
2326
|
+
parent;
|
|
2192
2327
|
constructor(state, signal, parent) {
|
|
2193
2328
|
super();
|
|
2194
2329
|
this.state = state;
|
|
@@ -2218,10 +2353,6 @@ var Boundary = class extends AbortController {
|
|
|
2218
2353
|
}
|
|
2219
2354
|
};
|
|
2220
2355
|
var Chunk = class Chunk {
|
|
2221
|
-
boundary;
|
|
2222
|
-
next;
|
|
2223
|
-
context;
|
|
2224
|
-
serializeState;
|
|
2225
2356
|
html = "";
|
|
2226
2357
|
scripts = "";
|
|
2227
2358
|
effects = "";
|
|
@@ -2232,6 +2363,10 @@ var Chunk = class Chunk {
|
|
|
2232
2363
|
reorderId = null;
|
|
2233
2364
|
deferredReady = null;
|
|
2234
2365
|
placeholder = null;
|
|
2366
|
+
boundary;
|
|
2367
|
+
next;
|
|
2368
|
+
context;
|
|
2369
|
+
serializeState;
|
|
2235
2370
|
constructor(boundary, next, context, serializeState) {
|
|
2236
2371
|
this.boundary = boundary;
|
|
2237
2372
|
this.next = next;
|
|
@@ -2727,7 +2862,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2727
2862
|
if (isEventHandler(name)) {
|
|
2728
2863
|
if (!events) {
|
|
2729
2864
|
events = {};
|
|
2730
|
-
writeScope(scopeId, { [
|
|
2865
|
+
writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
|
|
2731
2866
|
}
|
|
2732
2867
|
events[getEventHandlerName(name)] = value;
|
|
2733
2868
|
} else result += nonVoidAttr(name, value);
|
|
@@ -2756,12 +2891,12 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
|
|
|
2756
2891
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2757
2892
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
2758
2893
|
writeScope(scopeId, serializeType ? {
|
|
2759
|
-
[
|
|
2760
|
-
[
|
|
2761
|
-
[
|
|
2894
|
+
[ControlledType + nodeAccessor]: type,
|
|
2895
|
+
[ControlledValue + nodeAccessor]: value,
|
|
2896
|
+
[ControlledHandler + nodeAccessor]: valueChange
|
|
2762
2897
|
} : {
|
|
2763
|
-
[
|
|
2764
|
-
[
|
|
2898
|
+
[ControlledValue + nodeAccessor]: value,
|
|
2899
|
+
[ControlledHandler + nodeAccessor]: valueChange
|
|
2765
2900
|
});
|
|
2766
2901
|
}
|
|
2767
2902
|
function stringAttr(name, value) {
|
|
@@ -2836,7 +2971,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2836
2971
|
const childScope = getScopeById(branchId);
|
|
2837
2972
|
const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
|
|
2838
2973
|
if (needsScript) {
|
|
2839
|
-
writeScope(branchId, { [
|
|
2974
|
+
writeScope(branchId, { [Renderer]: renderer });
|
|
2840
2975
|
_script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
|
|
2841
2976
|
}
|
|
2842
2977
|
if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
@@ -2861,7 +2996,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2861
2996
|
if (shouldResume) _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : "")));
|
|
2862
2997
|
}
|
|
2863
2998
|
if (rendered) {
|
|
2864
|
-
if (shouldResume) writeScope(scopeId, { [
|
|
2999
|
+
if (shouldResume) writeScope(scopeId, { [ConditionalRenderer + accessor]: renderer?.["id"] || renderer });
|
|
2865
3000
|
} else _scope_id();
|
|
2866
3001
|
return result;
|
|
2867
3002
|
};
|
|
@@ -2884,7 +3019,7 @@ const patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
|
2884
3019
|
const CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result";
|
|
2885
3020
|
const _template = (templateId, renderer, page) => {
|
|
2886
3021
|
renderer.render = render;
|
|
2887
|
-
renderer[
|
|
3022
|
+
renderer[Embed] = !page;
|
|
2888
3023
|
renderer._ = renderer;
|
|
2889
3024
|
renderer.mount = () => {
|
|
2890
3025
|
throw new Error(`mount() is not implemented for the HTML compilation of a Marko template`);
|
|
@@ -2938,7 +3073,9 @@ var ServerRendered = class {
|
|
|
2938
3073
|
const boundary = this.#read((html) => {
|
|
2939
3074
|
value += html;
|
|
2940
3075
|
if (resolve) {
|
|
2941
|
-
resolve
|
|
3076
|
+
const settle = resolve;
|
|
3077
|
+
resolve = reject = void 0;
|
|
3078
|
+
settle({
|
|
2942
3079
|
value,
|
|
2943
3080
|
done
|
|
2944
3081
|
});
|
|
@@ -2947,11 +3084,17 @@ var ServerRendered = class {
|
|
|
2947
3084
|
}, (err) => {
|
|
2948
3085
|
aborted = true;
|
|
2949
3086
|
reason = err;
|
|
2950
|
-
if (reject)
|
|
3087
|
+
if (reject) {
|
|
3088
|
+
const settle = reject;
|
|
3089
|
+
resolve = reject = void 0;
|
|
3090
|
+
settle(err);
|
|
3091
|
+
}
|
|
2951
3092
|
}, () => {
|
|
2952
3093
|
done = true;
|
|
2953
3094
|
if (resolve) {
|
|
2954
|
-
resolve
|
|
3095
|
+
const settle = resolve;
|
|
3096
|
+
resolve = reject = void 0;
|
|
3097
|
+
settle({
|
|
2955
3098
|
value,
|
|
2956
3099
|
done: !value
|
|
2957
3100
|
});
|