marko 6.3.14 → 6.3.15
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/dist/debug/html.js +162 -157
- package/dist/debug/html.mjs +162 -157
- package/dist/html/writer.d.ts +36 -36
- package/dist/html.js +117 -113
- package/dist/html.mjs +117 -113
- package/dist/translator/index.js +62 -50
- package/package.json +1 -1
package/dist/html.js
CHANGED
|
@@ -238,24 +238,26 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk,
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
242
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
243
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
|
-
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/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, serializeReason) => {
|
|
244
|
+
}, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/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, serializeReason) => {
|
|
245
245
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
246
246
|
if (typeof renderer == "string") {
|
|
247
247
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (
|
|
253
|
-
|
|
248
|
+
rendered = !0, (() => {
|
|
249
|
+
if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
250
|
+
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
251
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
252
|
+
else if (renderContent) {
|
|
253
|
+
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
254
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
255
|
+
}
|
|
256
|
+
_html(`</${renderer}>`);
|
|
254
257
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
needsScript && (writeScope(branchId, { R: renderer }), _script(branchId, "d")), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
258
|
+
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
259
|
+
needsScript && (writeScope(branchId, { R: renderer }), _script(branchId, "d")), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
260
|
+
})();
|
|
259
261
|
} else {
|
|
260
262
|
shouldResume && _html(state.mark("[", ""));
|
|
261
263
|
let render = () => {
|
|
@@ -1123,35 +1125,21 @@ function getState() {
|
|
|
1123
1125
|
function getScopeId(scope) {
|
|
1124
1126
|
return scope[K_SCOPE_ID];
|
|
1125
1127
|
}
|
|
1126
|
-
function
|
|
1127
|
-
$chunk.
|
|
1128
|
-
}
|
|
1129
|
-
function writeScript(script) {
|
|
1130
|
-
$chunk.writeScript(script);
|
|
1128
|
+
function getScopeById(scopeId) {
|
|
1129
|
+
if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
|
|
1131
1130
|
}
|
|
1132
|
-
function
|
|
1133
|
-
|
|
1134
|
-
readyId,
|
|
1135
|
-
parent: chunk.serializeState,
|
|
1136
|
-
resumes: "",
|
|
1137
|
-
writeScopes: {},
|
|
1138
|
-
flushScopes: !1
|
|
1139
|
-
}), bodyEnd = body.render(renderer, input);
|
|
1140
|
-
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);
|
|
1131
|
+
function $global() {
|
|
1132
|
+
return $chunk.boundary.state.$global;
|
|
1141
1133
|
}
|
|
1142
|
-
function
|
|
1143
|
-
|
|
1134
|
+
function _id() {
|
|
1135
|
+
let state = $chunk.boundary.state, { $global } = state;
|
|
1136
|
+
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1144
1137
|
}
|
|
1145
|
-
function
|
|
1146
|
-
|
|
1147
|
-
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1148
|
-
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1149
|
-
["D" + nodeAccessor]: render?.a
|
|
1150
|
-
});
|
|
1138
|
+
function _scope_id() {
|
|
1139
|
+
return $chunk.boundary.state.scopeId++;
|
|
1151
1140
|
}
|
|
1152
|
-
function
|
|
1153
|
-
|
|
1154
|
-
if (renderer && typeof renderer == "function") return renderer;
|
|
1141
|
+
function _peek_scope_id() {
|
|
1142
|
+
return $chunk.boundary.state.scopeId;
|
|
1155
1143
|
}
|
|
1156
1144
|
function withContext(key, value, cb, cbValue) {
|
|
1157
1145
|
let ctx = $chunk.context ||= { [kPendingContexts]: 0 }, prev = ctx[key];
|
|
@@ -1162,43 +1150,36 @@ function withContext(key, value, cb, cbValue) {
|
|
|
1162
1150
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1163
1151
|
}
|
|
1164
1152
|
}
|
|
1165
|
-
function
|
|
1166
|
-
|
|
1167
|
-
let childScope = writeScopePassive(childScopeId, { T: _resume({}, registryId, parentScopeId) });
|
|
1168
|
-
nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1169
|
-
}
|
|
1170
|
-
function writeScopePassive(scopeId, partialScope) {
|
|
1171
|
-
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1172
|
-
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1153
|
+
function isInResumedBranch() {
|
|
1154
|
+
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1173
1155
|
}
|
|
1174
|
-
function
|
|
1175
|
-
return
|
|
1156
|
+
function withBranchId(branchId, cb) {
|
|
1157
|
+
return withContext(kBranchId, branchId, cb);
|
|
1176
1158
|
}
|
|
1177
|
-
function
|
|
1178
|
-
|
|
1179
|
-
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1159
|
+
function withIsAsync(cb, value) {
|
|
1160
|
+
return withContext(kIsAsync, !0, cb, value);
|
|
1180
1161
|
}
|
|
1181
|
-
function
|
|
1182
|
-
|
|
1162
|
+
function _html(html) {
|
|
1163
|
+
$chunk.writeHTML(html);
|
|
1183
1164
|
}
|
|
1184
|
-
function
|
|
1185
|
-
|
|
1165
|
+
function writeScript(script) {
|
|
1166
|
+
$chunk.writeScript(script);
|
|
1186
1167
|
}
|
|
1187
|
-
function
|
|
1188
|
-
|
|
1168
|
+
function _script(scopeId, registryId) {
|
|
1169
|
+
($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1189
1170
|
}
|
|
1190
|
-
function
|
|
1191
|
-
$chunk.boundary.state.
|
|
1171
|
+
function _trailers(html) {
|
|
1172
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1192
1173
|
}
|
|
1193
|
-
function
|
|
1194
|
-
|
|
1195
|
-
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1174
|
+
function _resume(val, id, scopeId) {
|
|
1175
|
+
return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
|
|
1196
1176
|
}
|
|
1197
|
-
function
|
|
1198
|
-
return
|
|
1177
|
+
function _el(scopeId, id) {
|
|
1178
|
+
return _resume(() => void 0, id, scopeId);
|
|
1199
1179
|
}
|
|
1200
|
-
function
|
|
1201
|
-
|
|
1180
|
+
function _hoist(scopeId, id) {
|
|
1181
|
+
let getter = () => void 0;
|
|
1182
|
+
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1202
1183
|
}
|
|
1203
1184
|
function _el_resume(scopeId, accessor, shouldResume) {
|
|
1204
1185
|
if (shouldResume === 0) return "";
|
|
@@ -1208,25 +1189,36 @@ function _el_resume(scopeId, accessor, shouldResume) {
|
|
|
1208
1189
|
function _sep(shouldResume) {
|
|
1209
1190
|
return shouldResume === 0 ? "" : "<!>";
|
|
1210
1191
|
}
|
|
1211
|
-
function _el(scopeId, id) {
|
|
1212
|
-
return _resume(() => void 0, id, scopeId);
|
|
1213
|
-
}
|
|
1214
|
-
function _hoist(scopeId, id) {
|
|
1215
|
-
let getter = () => void 0;
|
|
1216
|
-
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1217
|
-
}
|
|
1218
1192
|
function _resume_branch(scopeId) {
|
|
1219
1193
|
let branchId = $chunk.context?.[kBranchId];
|
|
1220
1194
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1221
1195
|
}
|
|
1222
|
-
function
|
|
1223
|
-
|
|
1196
|
+
function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
|
|
1197
|
+
let shouldResume = serializeReason !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1198
|
+
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1199
|
+
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1200
|
+
["D" + nodeAccessor]: render?.a
|
|
1201
|
+
});
|
|
1224
1202
|
}
|
|
1225
|
-
function
|
|
1226
|
-
|
|
1203
|
+
function normalizeServerRender(value) {
|
|
1204
|
+
let renderer = normalizeDynamicRenderer(value);
|
|
1205
|
+
if (renderer && typeof renderer == "function") return renderer;
|
|
1227
1206
|
}
|
|
1228
|
-
function
|
|
1229
|
-
|
|
1207
|
+
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
|
|
1208
|
+
writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
|
|
1209
|
+
let childScope = writeScopePassive(childScopeId, { T: _resume({}, registryId, parentScopeId) });
|
|
1210
|
+
nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1211
|
+
}
|
|
1212
|
+
function writeScopePassive(scopeId, partialScope) {
|
|
1213
|
+
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1214
|
+
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1215
|
+
}
|
|
1216
|
+
function _show_start(display, mark) {
|
|
1217
|
+
display ? mark && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1218
|
+
}
|
|
1219
|
+
function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1220
|
+
let branchId = _scope_id(), wrap = !display;
|
|
1221
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1230
1222
|
}
|
|
1231
1223
|
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1232
1224
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
@@ -1289,13 +1281,6 @@ function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, p
|
|
|
1289
1281
|
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1290
1282
|
else $chunk.writeHTML(endTag);
|
|
1291
1283
|
}
|
|
1292
|
-
function _show_start(display, mark) {
|
|
1293
|
-
display ? mark && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1294
|
-
}
|
|
1295
|
-
function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1296
|
-
let branchId = _scope_id(), wrap = !display;
|
|
1297
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1298
|
-
}
|
|
1299
1284
|
function _existing_scope(scopeId) {
|
|
1300
1285
|
return writeScope(scopeId, {});
|
|
1301
1286
|
}
|
|
@@ -1306,8 +1291,35 @@ function scopeWithId(state, scopeId) {
|
|
|
1306
1291
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1307
1292
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1308
1293
|
}
|
|
1309
|
-
function
|
|
1310
|
-
|
|
1294
|
+
function _subscribe(subscribers, scope) {
|
|
1295
|
+
if (subscribers) {
|
|
1296
|
+
let { serializer } = $chunk.boundary.state;
|
|
1297
|
+
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1298
|
+
}
|
|
1299
|
+
return scope;
|
|
1300
|
+
}
|
|
1301
|
+
function _set_serialize_reason(reason) {
|
|
1302
|
+
$chunk.boundary.state.serializeReason = reason;
|
|
1303
|
+
}
|
|
1304
|
+
function _scope_reason() {
|
|
1305
|
+
let reason = $chunk.boundary.state.serializeReason;
|
|
1306
|
+
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1307
|
+
}
|
|
1308
|
+
function _serialize_if(condition, key) {
|
|
1309
|
+
return condition && (condition === 1 || (typeof condition == "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
|
|
1310
|
+
}
|
|
1311
|
+
function _serialize_guard(condition, key) {
|
|
1312
|
+
return _serialize_if(condition, key) || 0;
|
|
1313
|
+
}
|
|
1314
|
+
function writeWaitReady(readyId, renderer, input) {
|
|
1315
|
+
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
1316
|
+
readyId,
|
|
1317
|
+
parent: chunk.serializeState,
|
|
1318
|
+
resumes: "",
|
|
1319
|
+
writeScopes: {},
|
|
1320
|
+
flushScopes: !1
|
|
1321
|
+
}), bodyEnd = body.render(renderer, input);
|
|
1322
|
+
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);
|
|
1311
1323
|
}
|
|
1312
1324
|
function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1313
1325
|
let resumeMarker = serializeMarker !== 0;
|
|
@@ -1634,8 +1646,20 @@ function depsMarker(deps) {
|
|
|
1634
1646
|
}
|
|
1635
1647
|
return marker;
|
|
1636
1648
|
}
|
|
1637
|
-
function
|
|
1638
|
-
|
|
1649
|
+
function getFilteredGlobals($global) {
|
|
1650
|
+
if (!$global) return 0;
|
|
1651
|
+
let serializedGlobals = $global.serializedGlobals;
|
|
1652
|
+
if (!serializedGlobals) return 0;
|
|
1653
|
+
let filtered = 0;
|
|
1654
|
+
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1655
|
+
let value = $global[key];
|
|
1656
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1657
|
+
}
|
|
1658
|
+
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1659
|
+
let value = $global[key];
|
|
1660
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1661
|
+
}
|
|
1662
|
+
return filtered;
|
|
1639
1663
|
}
|
|
1640
1664
|
function concatEffects(a, b) {
|
|
1641
1665
|
return a ? b ? a + " " + b : a : b;
|
|
@@ -1657,28 +1681,6 @@ function flushTickQueue() {
|
|
|
1657
1681
|
tickQueue = void 0;
|
|
1658
1682
|
for (let cb of queue) cb(!0);
|
|
1659
1683
|
}
|
|
1660
|
-
function getFilteredGlobals($global) {
|
|
1661
|
-
if (!$global) return 0;
|
|
1662
|
-
let serializedGlobals = $global.serializedGlobals;
|
|
1663
|
-
if (!serializedGlobals) return 0;
|
|
1664
|
-
let filtered = 0;
|
|
1665
|
-
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1666
|
-
let value = $global[key];
|
|
1667
|
-
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1668
|
-
}
|
|
1669
|
-
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1670
|
-
let value = $global[key];
|
|
1671
|
-
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1672
|
-
}
|
|
1673
|
-
return filtered;
|
|
1674
|
-
}
|
|
1675
|
-
function _subscribe(subscribers, scope) {
|
|
1676
|
-
if (subscribers) {
|
|
1677
|
-
let { serializer } = $chunk.boundary.state;
|
|
1678
|
-
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1679
|
-
}
|
|
1680
|
-
return scope;
|
|
1681
|
-
}
|
|
1682
1684
|
//#endregion
|
|
1683
1685
|
//#region src/html/attrs.ts
|
|
1684
1686
|
function _attr_class(value) {
|
|
@@ -1959,9 +1961,11 @@ var ServerRendered = class {
|
|
|
1959
1961
|
case 2:
|
|
1960
1962
|
boundary.onNext = NOOP$1, reject(boundary.signal.reason);
|
|
1961
1963
|
break;
|
|
1962
|
-
case 0:
|
|
1963
|
-
|
|
1964
|
+
case 0: {
|
|
1965
|
+
let consumed = head.consume();
|
|
1966
|
+
boundary.signal.aborted || resolve(consumed.flushHTML());
|
|
1964
1967
|
break;
|
|
1968
|
+
}
|
|
1965
1969
|
}
|
|
1966
1970
|
})();
|
|
1967
1971
|
});
|
package/dist/html.mjs
CHANGED
|
@@ -238,24 +238,26 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk,
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
242
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
243
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
|
-
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/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, serializeReason) => {
|
|
244
|
+
}, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/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, serializeReason) => {
|
|
245
245
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
246
246
|
if (typeof renderer == "string") {
|
|
247
247
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (
|
|
253
|
-
|
|
248
|
+
rendered = !0, (() => {
|
|
249
|
+
if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
250
|
+
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
251
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
252
|
+
else if (renderContent) {
|
|
253
|
+
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
254
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
255
|
+
}
|
|
256
|
+
_html(`</${renderer}>`);
|
|
254
257
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
needsScript && (writeScope(branchId, { R: renderer }), _script(branchId, "d")), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
258
|
+
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
259
|
+
needsScript && (writeScope(branchId, { R: renderer }), _script(branchId, "d")), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
260
|
+
})();
|
|
259
261
|
} else {
|
|
260
262
|
shouldResume && _html(state.mark("[", ""));
|
|
261
263
|
let render = () => {
|
|
@@ -1122,35 +1124,21 @@ function getState() {
|
|
|
1122
1124
|
function getScopeId(scope) {
|
|
1123
1125
|
return scope[K_SCOPE_ID];
|
|
1124
1126
|
}
|
|
1125
|
-
function
|
|
1126
|
-
$chunk.
|
|
1127
|
-
}
|
|
1128
|
-
function writeScript(script) {
|
|
1129
|
-
$chunk.writeScript(script);
|
|
1127
|
+
function getScopeById(scopeId) {
|
|
1128
|
+
if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
|
|
1130
1129
|
}
|
|
1131
|
-
function
|
|
1132
|
-
|
|
1133
|
-
readyId,
|
|
1134
|
-
parent: chunk.serializeState,
|
|
1135
|
-
resumes: "",
|
|
1136
|
-
writeScopes: {},
|
|
1137
|
-
flushScopes: !1
|
|
1138
|
-
}), bodyEnd = body.render(renderer, input);
|
|
1139
|
-
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);
|
|
1130
|
+
function $global() {
|
|
1131
|
+
return $chunk.boundary.state.$global;
|
|
1140
1132
|
}
|
|
1141
|
-
function
|
|
1142
|
-
|
|
1133
|
+
function _id() {
|
|
1134
|
+
let state = $chunk.boundary.state, { $global } = state;
|
|
1135
|
+
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1143
1136
|
}
|
|
1144
|
-
function
|
|
1145
|
-
|
|
1146
|
-
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1147
|
-
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1148
|
-
["D" + nodeAccessor]: render?.a
|
|
1149
|
-
});
|
|
1137
|
+
function _scope_id() {
|
|
1138
|
+
return $chunk.boundary.state.scopeId++;
|
|
1150
1139
|
}
|
|
1151
|
-
function
|
|
1152
|
-
|
|
1153
|
-
if (renderer && typeof renderer == "function") return renderer;
|
|
1140
|
+
function _peek_scope_id() {
|
|
1141
|
+
return $chunk.boundary.state.scopeId;
|
|
1154
1142
|
}
|
|
1155
1143
|
function withContext(key, value, cb, cbValue) {
|
|
1156
1144
|
let ctx = $chunk.context ||= { [kPendingContexts]: 0 }, prev = ctx[key];
|
|
@@ -1161,43 +1149,36 @@ function withContext(key, value, cb, cbValue) {
|
|
|
1161
1149
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1162
1150
|
}
|
|
1163
1151
|
}
|
|
1164
|
-
function
|
|
1165
|
-
|
|
1166
|
-
let childScope = writeScopePassive(childScopeId, { T: _resume({}, registryId, parentScopeId) });
|
|
1167
|
-
nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1168
|
-
}
|
|
1169
|
-
function writeScopePassive(scopeId, partialScope) {
|
|
1170
|
-
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1171
|
-
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1152
|
+
function isInResumedBranch() {
|
|
1153
|
+
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1172
1154
|
}
|
|
1173
|
-
function
|
|
1174
|
-
return
|
|
1155
|
+
function withBranchId(branchId, cb) {
|
|
1156
|
+
return withContext(kBranchId, branchId, cb);
|
|
1175
1157
|
}
|
|
1176
|
-
function
|
|
1177
|
-
|
|
1178
|
-
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1158
|
+
function withIsAsync(cb, value) {
|
|
1159
|
+
return withContext(kIsAsync, !0, cb, value);
|
|
1179
1160
|
}
|
|
1180
|
-
function
|
|
1181
|
-
|
|
1161
|
+
function _html(html) {
|
|
1162
|
+
$chunk.writeHTML(html);
|
|
1182
1163
|
}
|
|
1183
|
-
function
|
|
1184
|
-
|
|
1164
|
+
function writeScript(script) {
|
|
1165
|
+
$chunk.writeScript(script);
|
|
1185
1166
|
}
|
|
1186
|
-
function
|
|
1187
|
-
|
|
1167
|
+
function _script(scopeId, registryId) {
|
|
1168
|
+
($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1188
1169
|
}
|
|
1189
|
-
function
|
|
1190
|
-
$chunk.boundary.state.
|
|
1170
|
+
function _trailers(html) {
|
|
1171
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1191
1172
|
}
|
|
1192
|
-
function
|
|
1193
|
-
|
|
1194
|
-
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1173
|
+
function _resume(val, id, scopeId) {
|
|
1174
|
+
return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
|
|
1195
1175
|
}
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1176
|
+
function _el(scopeId, id) {
|
|
1177
|
+
return _resume(() => void 0, id, scopeId);
|
|
1198
1178
|
}
|
|
1199
|
-
function
|
|
1200
|
-
|
|
1179
|
+
function _hoist(scopeId, id) {
|
|
1180
|
+
let getter = () => void 0;
|
|
1181
|
+
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1201
1182
|
}
|
|
1202
1183
|
function _el_resume(scopeId, accessor, shouldResume) {
|
|
1203
1184
|
if (shouldResume === 0) return "";
|
|
@@ -1207,25 +1188,36 @@ function _el_resume(scopeId, accessor, shouldResume) {
|
|
|
1207
1188
|
function _sep(shouldResume) {
|
|
1208
1189
|
return shouldResume === 0 ? "" : "<!>";
|
|
1209
1190
|
}
|
|
1210
|
-
function _el(scopeId, id) {
|
|
1211
|
-
return _resume(() => void 0, id, scopeId);
|
|
1212
|
-
}
|
|
1213
|
-
function _hoist(scopeId, id) {
|
|
1214
|
-
let getter = () => void 0;
|
|
1215
|
-
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1216
|
-
}
|
|
1217
1191
|
function _resume_branch(scopeId) {
|
|
1218
1192
|
let branchId = $chunk.context?.[kBranchId];
|
|
1219
1193
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1220
1194
|
}
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1195
|
+
function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
|
|
1196
|
+
let shouldResume = serializeReason !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1197
|
+
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1198
|
+
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1199
|
+
["D" + nodeAccessor]: render?.a
|
|
1200
|
+
});
|
|
1223
1201
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1202
|
+
function normalizeServerRender(value) {
|
|
1203
|
+
let renderer = normalizeDynamicRenderer(value);
|
|
1204
|
+
if (renderer && typeof renderer == "function") return renderer;
|
|
1226
1205
|
}
|
|
1227
|
-
function
|
|
1228
|
-
|
|
1206
|
+
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
|
|
1207
|
+
writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
|
|
1208
|
+
let childScope = writeScopePassive(childScopeId, { T: _resume({}, registryId, parentScopeId) });
|
|
1209
|
+
nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1210
|
+
}
|
|
1211
|
+
function writeScopePassive(scopeId, partialScope) {
|
|
1212
|
+
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1213
|
+
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1214
|
+
}
|
|
1215
|
+
function _show_start(display, mark) {
|
|
1216
|
+
display ? mark && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1217
|
+
}
|
|
1218
|
+
function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1219
|
+
let branchId = _scope_id(), wrap = !display;
|
|
1220
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1229
1221
|
}
|
|
1230
1222
|
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1231
1223
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
@@ -1288,13 +1280,6 @@ function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, p
|
|
|
1288
1280
|
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1289
1281
|
else $chunk.writeHTML(endTag);
|
|
1290
1282
|
}
|
|
1291
|
-
function _show_start(display, mark) {
|
|
1292
|
-
display ? mark && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1293
|
-
}
|
|
1294
|
-
function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1295
|
-
let branchId = _scope_id(), wrap = !display;
|
|
1296
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1297
|
-
}
|
|
1298
1283
|
function _existing_scope(scopeId) {
|
|
1299
1284
|
return writeScope(scopeId, {});
|
|
1300
1285
|
}
|
|
@@ -1305,8 +1290,35 @@ function scopeWithId(state, scopeId) {
|
|
|
1305
1290
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1306
1291
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1307
1292
|
}
|
|
1308
|
-
function
|
|
1309
|
-
|
|
1293
|
+
function _subscribe(subscribers, scope) {
|
|
1294
|
+
if (subscribers) {
|
|
1295
|
+
let { serializer } = $chunk.boundary.state;
|
|
1296
|
+
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1297
|
+
}
|
|
1298
|
+
return scope;
|
|
1299
|
+
}
|
|
1300
|
+
function _set_serialize_reason(reason) {
|
|
1301
|
+
$chunk.boundary.state.serializeReason = reason;
|
|
1302
|
+
}
|
|
1303
|
+
function _scope_reason() {
|
|
1304
|
+
let reason = $chunk.boundary.state.serializeReason;
|
|
1305
|
+
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1306
|
+
}
|
|
1307
|
+
function _serialize_if(condition, key) {
|
|
1308
|
+
return condition && (condition === 1 || (typeof condition == "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
|
|
1309
|
+
}
|
|
1310
|
+
function _serialize_guard(condition, key) {
|
|
1311
|
+
return _serialize_if(condition, key) || 0;
|
|
1312
|
+
}
|
|
1313
|
+
function writeWaitReady(readyId, renderer, input) {
|
|
1314
|
+
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
1315
|
+
readyId,
|
|
1316
|
+
parent: chunk.serializeState,
|
|
1317
|
+
resumes: "",
|
|
1318
|
+
writeScopes: {},
|
|
1319
|
+
flushScopes: !1
|
|
1320
|
+
}), bodyEnd = body.render(renderer, input);
|
|
1321
|
+
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);
|
|
1310
1322
|
}
|
|
1311
1323
|
function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1312
1324
|
let resumeMarker = serializeMarker !== 0;
|
|
@@ -1633,8 +1645,20 @@ function depsMarker(deps) {
|
|
|
1633
1645
|
}
|
|
1634
1646
|
return marker;
|
|
1635
1647
|
}
|
|
1636
|
-
function
|
|
1637
|
-
|
|
1648
|
+
function getFilteredGlobals($global) {
|
|
1649
|
+
if (!$global) return 0;
|
|
1650
|
+
let serializedGlobals = $global.serializedGlobals;
|
|
1651
|
+
if (!serializedGlobals) return 0;
|
|
1652
|
+
let filtered = 0;
|
|
1653
|
+
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1654
|
+
let value = $global[key];
|
|
1655
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1656
|
+
}
|
|
1657
|
+
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1658
|
+
let value = $global[key];
|
|
1659
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1660
|
+
}
|
|
1661
|
+
return filtered;
|
|
1638
1662
|
}
|
|
1639
1663
|
function concatEffects(a, b) {
|
|
1640
1664
|
return a ? b ? a + " " + b : a : b;
|
|
@@ -1656,28 +1680,6 @@ function flushTickQueue() {
|
|
|
1656
1680
|
tickQueue = void 0;
|
|
1657
1681
|
for (let cb of queue) cb(!0);
|
|
1658
1682
|
}
|
|
1659
|
-
function getFilteredGlobals($global) {
|
|
1660
|
-
if (!$global) return 0;
|
|
1661
|
-
let serializedGlobals = $global.serializedGlobals;
|
|
1662
|
-
if (!serializedGlobals) return 0;
|
|
1663
|
-
let filtered = 0;
|
|
1664
|
-
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1665
|
-
let value = $global[key];
|
|
1666
|
-
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1667
|
-
}
|
|
1668
|
-
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1669
|
-
let value = $global[key];
|
|
1670
|
-
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1671
|
-
}
|
|
1672
|
-
return filtered;
|
|
1673
|
-
}
|
|
1674
|
-
function _subscribe(subscribers, scope) {
|
|
1675
|
-
if (subscribers) {
|
|
1676
|
-
let { serializer } = $chunk.boundary.state;
|
|
1677
|
-
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1678
|
-
}
|
|
1679
|
-
return scope;
|
|
1680
|
-
}
|
|
1681
1683
|
//#endregion
|
|
1682
1684
|
//#region src/html/attrs.ts
|
|
1683
1685
|
function _attr_class(value) {
|
|
@@ -1958,9 +1960,11 @@ var ServerRendered = class {
|
|
|
1958
1960
|
case 2:
|
|
1959
1961
|
boundary.onNext = NOOP$1, reject(boundary.signal.reason);
|
|
1960
1962
|
break;
|
|
1961
|
-
case 0:
|
|
1962
|
-
|
|
1963
|
+
case 0: {
|
|
1964
|
+
let consumed = head.consume();
|
|
1965
|
+
boundary.signal.aborted || resolve(consumed.flushHTML());
|
|
1963
1966
|
break;
|
|
1967
|
+
}
|
|
1964
1968
|
}
|
|
1965
1969
|
})();
|
|
1966
1970
|
});
|