marko 6.3.56 → 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 +3 -3
- package/dist/common/constants/accessor-prefix.d.ts +2 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +2 -0
- package/dist/common/constants/accessor-prop.d.ts +3 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +3 -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 +11 -2
- package/dist/debug/dom/catch.feat.js +12 -14
- package/dist/debug/dom/catch.feat.mjs +12 -14
- 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 +4 -0
- package/dist/debug/dom/lazy.feat.mjs +4 -0
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-DcwejnYg.js → dom-ClV4kVOO.js} +263 -193
- package/dist/debug/{dom-BeCNT5R5.mjs → dom-LFrKxOk5.mjs} +246 -182
- package/dist/debug/dom.js +14 -12
- package/dist/debug/dom.mjs +14 -12
- package/dist/debug/html.js +826 -685
- package/dist/debug/html.mjs +822 -683
- package/dist/dom/abort-signal.d.ts +2 -0
- package/dist/dom/catch.feat.js +6 -7
- package/dist/dom/catch.feat.mjs +5 -7
- package/dist/dom/control-flow.d.ts +3 -5
- package/dist/dom/controllable-input.feat.js +3 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +3 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +3 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +3 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +3 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +3 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +2 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.d.ts +1 -0
- package/dist/dom/lazy.feat.js +4 -0
- package/dist/dom/lazy.feat.mjs +4 -0
- package/dist/dom/load.d.ts +3 -3
- package/dist/dom/placeholder.feat.js +4 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +2 -4
- package/dist/dom/resume.d.ts +1 -1
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom/signals.d.ts +3 -2
- package/dist/{dom-QEF0csuC.js → dom-CNglVi8P.js} +222 -185
- package/dist/{dom-BwNsIevR.mjs → dom-DfP3MCo0.mjs} +126 -90
- package/dist/dom.js +59 -56
- package/dist/dom.mjs +34 -32
- package/dist/html/attrs.d.ts +4 -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 +39 -33
- package/dist/html.d.ts +2 -2
- package/dist/html.js +526 -424
- package/dist/html.mjs +524 -423
- 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 +8195 -7939
- package/dist/translator/util/binding-has-prop.d.ts +3 -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/entry-builder.d.ts +2 -0
- 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 +7 -0
- 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 +69 -167
- package/dist/translator/util/runtime.d.ts +3 -3
- 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 +56 -50
- package/dist/translator/util/set-tag-derived-from.d.ts +7 -0
- package/dist/translator/util/setup-work.d.ts +4 -0
- package/dist/translator/util/signals.d.ts +8 -12
- 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 -11
- package/package.json +3 -3
- 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/translator/util/setup-statements.d.ts +0 -5
package/dist/html.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
|
|
2
3
|
let str = "", sep = "", part;
|
|
3
|
-
if (val)
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
if (val) {
|
|
5
|
+
if (typeof val != "object") str += val;
|
|
6
|
+
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
7
|
+
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
8
|
+
}
|
|
6
9
|
return str;
|
|
7
|
-
},
|
|
10
|
+
}, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (/* @__PURE__ */ (function* () {})()).constructor, AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
|
|
8
11
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
9
12
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
10
13
|
let symbol = Symbol[name];
|
|
@@ -80,7 +83,6 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
80
83
|
[Function, "Function"],
|
|
81
84
|
[globalThis.atob, "atob"],
|
|
82
85
|
[globalThis.btoa, "btoa"],
|
|
83
|
-
[globalThis.clearImmediate, "clearImmediate"],
|
|
84
86
|
[globalThis.clearInterval, "clearInterval"],
|
|
85
87
|
[globalThis.clearTimeout, "clearTimeout"],
|
|
86
88
|
[globalThis.crypto?.getRandomValues, "crypto.getRandomValues"],
|
|
@@ -88,7 +90,6 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
88
90
|
[globalThis.fetch, "fetch"],
|
|
89
91
|
[globalThis.performance?.now, "performance.now"],
|
|
90
92
|
[globalThis.queueMicrotask, "queueMicrotask"],
|
|
91
|
-
[globalThis.setImmediate, "setImmediate"],
|
|
92
93
|
[globalThis.setInterval, "setInterval"],
|
|
93
94
|
[globalThis.setTimeout, "setTimeout"],
|
|
94
95
|
[globalThis.structuredClone, "structuredClone"],
|
|
@@ -244,20 +245,20 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
244
245
|
if (ch === "\0") return "\\x00";
|
|
245
246
|
let code = ch.charCodeAt(0);
|
|
246
247
|
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
247
|
-
}, 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) => {
|
|
248
|
+
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
248
249
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
249
|
-
return state.needsMainRuntime = !0, countResumeWrite($chunk
|
|
250
|
-
}, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue,
|
|
251
|
-
let shouldResume =
|
|
250
|
+
return state.needsMainRuntime = !0, countResumeWrite($chunk), Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
251
|
+
}, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard) => {
|
|
252
|
+
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
252
253
|
if (typeof renderer == "string") {
|
|
253
254
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
254
255
|
rendered = !0, (() => {
|
|
255
256
|
if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
256
257
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
257
|
-
if (renderer === "textarea") _html(
|
|
258
|
+
if (renderer === "textarea") _html(_attrs_textarea_value(branchId, "a", input));
|
|
258
259
|
else {
|
|
259
260
|
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0,
|
|
261
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard);
|
|
261
262
|
}
|
|
262
263
|
_html(`</${renderer}>`);
|
|
263
264
|
}
|
|
@@ -267,12 +268,12 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
267
268
|
} else {
|
|
268
269
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
269
270
|
if (renderer) try {
|
|
270
|
-
return
|
|
271
|
+
return _set_scope_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
271
272
|
...inputOrArgs,
|
|
272
273
|
content
|
|
273
274
|
} : inputOrArgs);
|
|
274
275
|
} finally {
|
|
275
|
-
|
|
276
|
+
_set_scope_reason(void 0);
|
|
276
277
|
}
|
|
277
278
|
else if (content) return content();
|
|
278
279
|
};
|
|
@@ -303,8 +304,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
303
304
|
},
|
|
304
305
|
onFlush(fn) {
|
|
305
306
|
let { flushHTML } = Chunk.prototype;
|
|
306
|
-
Chunk.prototype.flushHTML = function() {
|
|
307
|
-
return fn(this), flushHTML.call(this);
|
|
307
|
+
Chunk.prototype.flushHTML = function(boundary) {
|
|
308
|
+
return fn(this), flushHTML.call(this, boundary);
|
|
308
309
|
};
|
|
309
310
|
},
|
|
310
311
|
patchDynamicTag,
|
|
@@ -333,15 +334,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
333
334
|
},
|
|
334
335
|
flushScript($global, chunk) {
|
|
335
336
|
chunk ||= this.createChunk($global);
|
|
336
|
-
let { boundary } = chunk;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
return chunk.flushScript().scripts;
|
|
337
|
+
let { boundary } = chunk, scripts = boundary.flush() === 0 ? chunk.flushScript(boundary).scripts : "";
|
|
338
|
+
if (boundary.aborted) throw boundary.reason;
|
|
339
|
+
if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
340
|
+
return scripts;
|
|
342
341
|
},
|
|
343
342
|
render(renderer, willRerender, classAPIOut, component, input, completeChunks, registerChildScope) {
|
|
344
|
-
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state), head = new Chunk(boundary, null,
|
|
343
|
+
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state), context = getChunk()?.context ?? null, head = new Chunk(boundary, new Chunk(boundary, null, context, state), context, state), normalizedInput = input;
|
|
345
344
|
if ("renderBody" in input) {
|
|
346
345
|
normalizedInput = {};
|
|
347
346
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
@@ -357,11 +356,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
357
356
|
let scopeId = _peek_scope_id();
|
|
358
357
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
359
358
|
}
|
|
360
|
-
|
|
359
|
+
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
361
360
|
try {
|
|
362
361
|
renderer(normalizedInput);
|
|
363
362
|
} finally {
|
|
364
|
-
|
|
363
|
+
_set_scope_reason(void 0);
|
|
365
364
|
}
|
|
366
365
|
let asyncOut = classAPIOut.beginAsync({
|
|
367
366
|
last: !0,
|
|
@@ -369,7 +368,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
369
368
|
});
|
|
370
369
|
classAPIOut.onLast((next) => {
|
|
371
370
|
(boundary.onNext = () => {
|
|
372
|
-
boundary.
|
|
371
|
+
boundary.aborted ? (asyncOut.error(boundary.reason), boundary.onNext = NOOP) : boundary.count || (boundary.onNext = NOOP, head = head.consume(boundary), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "", completeChunks.push(head), next());
|
|
373
372
|
})();
|
|
374
373
|
});
|
|
375
374
|
});
|
|
@@ -455,27 +454,38 @@ function _el_read_error() {}
|
|
|
455
454
|
function _hoist_read_error() {}
|
|
456
455
|
function _assert_hoist(value) {}
|
|
457
456
|
//#endregion
|
|
458
|
-
//#region src/
|
|
459
|
-
function
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
function _unescaped(val) {
|
|
463
|
-
return val ? val + "" : val === 0 ? "0" : "";
|
|
457
|
+
//#region src/common/for.ts
|
|
458
|
+
function forIn(obj, cb) {
|
|
459
|
+
for (let key in obj) cb(key, obj[key]);
|
|
464
460
|
}
|
|
465
|
-
function
|
|
466
|
-
|
|
461
|
+
function forOf(list, cb) {
|
|
462
|
+
if (list) {
|
|
463
|
+
let i = 0;
|
|
464
|
+
for (let item of list) cb(item, i++);
|
|
465
|
+
}
|
|
467
466
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
467
|
+
function forTo(to, from, step, cb) {
|
|
468
|
+
let start = from || 0, delta = step || 1;
|
|
469
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
|
|
471
|
+
function forUntil(until, from, step, cb) {
|
|
472
|
+
let start = from || 0, delta = step || 1;
|
|
473
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
473
474
|
}
|
|
474
|
-
|
|
475
|
-
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/common/opt.ts
|
|
477
|
+
function push(opt, item) {
|
|
478
|
+
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
476
479
|
}
|
|
477
|
-
function
|
|
478
|
-
|
|
480
|
+
function concat(opt, other) {
|
|
481
|
+
if (!opt) return other;
|
|
482
|
+
if (!other) return opt;
|
|
483
|
+
if (Array.isArray(opt)) {
|
|
484
|
+
if (Array.isArray(other)) for (let item of other) opt.push(item);
|
|
485
|
+
else opt.push(other);
|
|
486
|
+
return opt;
|
|
487
|
+
}
|
|
488
|
+
return Array.isArray(other) ? [opt, ...other] : [opt, other];
|
|
479
489
|
}
|
|
480
490
|
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
481
491
|
var State$1 = class {
|
|
@@ -515,6 +525,8 @@ var State$1 = class {
|
|
|
515
525
|
stringifyScopes(flushes, boundary, channel) {
|
|
516
526
|
try {
|
|
517
527
|
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes);
|
|
528
|
+
} catch (err) {
|
|
529
|
+
return abortRender(boundary, err), "";
|
|
518
530
|
} finally {
|
|
519
531
|
this.#state.flushId++, this.#state.buf = [];
|
|
520
532
|
}
|
|
@@ -591,13 +603,15 @@ function writeAssigned(state) {
|
|
|
591
603
|
let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
592
604
|
if (writeProp(state, mutation.object, null, "")) {
|
|
593
605
|
let objectRef = state.refs.get(mutation.object);
|
|
594
|
-
objectRef && objectRef.scopeId === void 0 && (objectRef.id ?
|
|
606
|
+
objectRef && objectRef.scopeId === void 0 && (!objectRef.id && !isAncestorChannelRef(state, objectRef) ? (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")) : hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")));
|
|
595
607
|
} else state.buf.push("void 0");
|
|
596
608
|
let valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
597
|
-
if (mutation.value !== void 0)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
609
|
+
if (mutation.value !== void 0) {
|
|
610
|
+
if (writeProp(state, mutation.value, null, "")) {
|
|
611
|
+
let valueRef = typeof mutation.value == "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
612
|
+
valueRef && !valueRef.id && valueRef.scopeId === void 0 && !isAncestorChannelRef(state, valueRef) && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
613
|
+
} else state.buf.push("void 0");
|
|
614
|
+
}
|
|
601
615
|
state.buf.push(")");
|
|
602
616
|
}
|
|
603
617
|
state.mutated = remaining;
|
|
@@ -608,7 +622,7 @@ function writeCallArg(state, val) {
|
|
|
608
622
|
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
609
623
|
else if (writeProp(state, val, null, "")) {
|
|
610
624
|
let ref = state.refs.get(val) || state.strs.get(val);
|
|
611
|
-
ref &&
|
|
625
|
+
ref && ensureId(state, ref);
|
|
612
626
|
} else state.buf.push("void 0");
|
|
613
627
|
}
|
|
614
628
|
function hasChannelMutations(state) {
|
|
@@ -660,7 +674,7 @@ function writeRegistered(state, val, parent, accessor, registered) {
|
|
|
660
674
|
let locals = registered.locals?.(state.boundary.state.scope);
|
|
661
675
|
if (locals) {
|
|
662
676
|
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
663
|
-
for (let local of locals) state.buf.push(","),
|
|
677
|
+
for (let local of locals) state.buf.push(","), writePlainObject(state, local, newArgReference(state, ref, local));
|
|
664
678
|
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
665
679
|
state.buf.push(")");
|
|
666
680
|
} else state.buf.push(registered.access);
|
|
@@ -717,7 +731,8 @@ function writeUnknownObject(state, val, ref) {
|
|
|
717
731
|
let proto = Object.getPrototypeOf(val);
|
|
718
732
|
if (proto === objectProto) return writePlainObject(state, val, ref);
|
|
719
733
|
if (proto === arrayProto) return writeArray(state, val, ref);
|
|
720
|
-
|
|
734
|
+
let constructor = proto?.constructor;
|
|
735
|
+
switch (constructor) {
|
|
721
736
|
case void 0: return writeNullObject(state, val, ref);
|
|
722
737
|
case Object: return writePlainObject(state, val, ref);
|
|
723
738
|
case Array: return writeArray(state, val, ref);
|
|
@@ -734,7 +749,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
734
749
|
case ReferenceError:
|
|
735
750
|
case SyntaxError:
|
|
736
751
|
case TypeError:
|
|
737
|
-
case URIError: return writeError(state, val, ref);
|
|
752
|
+
case URIError: return writeError(state, val, constructor.name, ref);
|
|
738
753
|
case AggregateError: return writeAggregateError(state, val, ref);
|
|
739
754
|
case ArrayBuffer: return writeArrayBuffer(state, val);
|
|
740
755
|
case Int8Array:
|
|
@@ -747,7 +762,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
747
762
|
case Float32Array:
|
|
748
763
|
case Float64Array:
|
|
749
764
|
case BigInt64Array:
|
|
750
|
-
case BigUint64Array: return writeTypedArray(state, val, ref);
|
|
765
|
+
case BigUint64Array: return writeTypedArray(state, val, constructor.name, ref);
|
|
751
766
|
case DataView: return writeDataView(state, val, ref);
|
|
752
767
|
case WeakSet: return writeWeakSet(state);
|
|
753
768
|
case WeakMap: return writeWeakMap(state);
|
|
@@ -859,6 +874,16 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
859
874
|
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
860
875
|
state.buf.push(")");
|
|
861
876
|
}
|
|
877
|
+
function newArgReference(state, parent, val) {
|
|
878
|
+
for (let key in val) {
|
|
879
|
+
let member = val[key];
|
|
880
|
+
if (isDedupedMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
881
|
+
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
882
|
+
return state.buf.push(ref.id + "="), ref;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
886
|
+
}
|
|
862
887
|
function isDedupedMember(val) {
|
|
863
888
|
switch (typeof val) {
|
|
864
889
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
@@ -885,12 +910,12 @@ function writeArrayBuffer(state, val) {
|
|
|
885
910
|
} else result = "new ArrayBuffer";
|
|
886
911
|
return state.buf.push(result), !0;
|
|
887
912
|
}
|
|
888
|
-
function writeTypedArray(state, val, ref) {
|
|
913
|
+
function writeTypedArray(state, val, name, ref) {
|
|
889
914
|
if (val.byteOffset || val.byteLength < val.buffer.byteLength || state.refs.has(val.buffer)) {
|
|
890
915
|
if (!canWriteBuffer(state, val.buffer, ref)) return !1;
|
|
891
916
|
let needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
|
|
892
|
-
state.buf.push("new " +
|
|
893
|
-
} else state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null)), state.buf.push("new " +
|
|
917
|
+
state.buf.push("new " + name + "("), writeProp(state, val.buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
|
|
918
|
+
} else state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null)), state.buf.push("new " + name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"));
|
|
894
919
|
return !0;
|
|
895
920
|
}
|
|
896
921
|
function writeWeakSet(state) {
|
|
@@ -899,8 +924,8 @@ function writeWeakSet(state) {
|
|
|
899
924
|
function writeWeakMap(state) {
|
|
900
925
|
return state.buf.push("new WeakMap"), !0;
|
|
901
926
|
}
|
|
902
|
-
function writeError(state, val, ref) {
|
|
903
|
-
let result = "new " +
|
|
927
|
+
function writeError(state, val, name, ref) {
|
|
928
|
+
let result = "new " + name + "(" + quote(val.message + "", 0);
|
|
904
929
|
if (val.cause !== void 0) {
|
|
905
930
|
let pos = state.buf.push(result + ",{cause:") - 1;
|
|
906
931
|
writeProp(state, val.cause, ref, "cause") ? state.buf.push("})") : state.buf[pos] = state.buf[pos].slice(0, -8) + ")";
|
|
@@ -962,14 +987,10 @@ function writeResponse(state, val, ref) {
|
|
|
962
987
|
return !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
|
|
963
988
|
}
|
|
964
989
|
function writeIntl(state, val, name, ref) {
|
|
965
|
-
let { locale, ...options } = val.resolvedOptions()
|
|
966
|
-
for (let key in options) if (isDedupedMember(options[key])) {
|
|
967
|
-
needsId = !0;
|
|
968
|
-
break;
|
|
969
|
-
}
|
|
990
|
+
let { locale, ...options } = val.resolvedOptions();
|
|
970
991
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
971
|
-
let optionsRef;
|
|
972
|
-
return
|
|
992
|
+
let optionsRef = newArgReference(state, ref, options);
|
|
993
|
+
return state.buf.push("{"), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
973
994
|
}
|
|
974
995
|
function writeIntlLocale(state, val) {
|
|
975
996
|
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
@@ -980,7 +1001,7 @@ function writeTemporal(state, val, name) {
|
|
|
980
1001
|
function writeReadableStream(state, val, ref) {
|
|
981
1002
|
if (val.locked) return !1;
|
|
982
1003
|
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
983
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1004
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
984
1005
|
}, onRejected = (reason) => {
|
|
985
1006
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
986
1007
|
};
|
|
@@ -1006,19 +1027,16 @@ function writeGenerator(state, iter, ref) {
|
|
|
1006
1027
|
if (heldReturn) {
|
|
1007
1028
|
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1008
1029
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
1009
|
-
} else if (returnValue !== void 0) {
|
|
1010
|
-
let
|
|
1011
|
-
|
|
1012
|
-
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1013
|
-
retRef && !retRef.id && retRef.scopeId === void 0 && (retRef.id = nextRefAccess(state), state.buf[sepIndex] = "," + retRef.id + "=");
|
|
1014
|
-
}
|
|
1030
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isDedupedMember(returnValue))) {
|
|
1031
|
+
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1032
|
+
retRef && ensureId(state, retRef);
|
|
1015
1033
|
}
|
|
1016
1034
|
return state.buf.push(")"), !0;
|
|
1017
1035
|
}
|
|
1018
1036
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1019
1037
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1020
1038
|
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1021
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1039
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1022
1040
|
}, onRejected = (reason) => {
|
|
1023
1041
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1024
1042
|
};
|
|
@@ -1049,7 +1067,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1049
1067
|
return sep;
|
|
1050
1068
|
}
|
|
1051
1069
|
function writeAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1052
|
-
boundary.
|
|
1070
|
+
boundary.aborted || (state.mutated.push({
|
|
1053
1071
|
value,
|
|
1054
1072
|
object: handle,
|
|
1055
1073
|
property: method,
|
|
@@ -1067,6 +1085,13 @@ function trackChannel(state, ref) {
|
|
|
1067
1085
|
}
|
|
1068
1086
|
return !1;
|
|
1069
1087
|
}
|
|
1088
|
+
function isAncestorChannelRef(state, ref) {
|
|
1089
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
1090
|
+
}
|
|
1091
|
+
function abortRender(boundary, err) {
|
|
1092
|
+
for (; boundary.parent;) boundary = boundary.parent;
|
|
1093
|
+
boundary.abort(err);
|
|
1094
|
+
}
|
|
1070
1095
|
function isCircular(parent, ref) {
|
|
1071
1096
|
let cur = parent;
|
|
1072
1097
|
for (; cur;) {
|
|
@@ -1079,16 +1104,17 @@ function toObjectKey(name) {
|
|
|
1079
1104
|
if (name === "") return "\"\"";
|
|
1080
1105
|
if (name === "__proto__") return "[\"__proto__\"]";
|
|
1081
1106
|
let len = name.length, c0 = name.charCodeAt(0);
|
|
1082
|
-
if (c0 >= 48 && c0 <= 57)
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
let
|
|
1087
|
-
|
|
1107
|
+
if (c0 >= 48 && c0 <= 57) {
|
|
1108
|
+
if (c0 === 48) {
|
|
1109
|
+
if (len !== 1) return quote(name, 1);
|
|
1110
|
+
} else {
|
|
1111
|
+
for (let i = 1; i < len; i++) {
|
|
1112
|
+
let c = name.charCodeAt(i);
|
|
1113
|
+
if (c < 48 || c > 57) return quote(name, i);
|
|
1114
|
+
}
|
|
1115
|
+
if (len > 15 && "" + +name !== name) return quote(name, 0);
|
|
1088
1116
|
}
|
|
1089
|
-
|
|
1090
|
-
}
|
|
1091
|
-
else if (c0 >= 97 && c0 <= 122 || c0 >= 65 && c0 <= 90 || c0 === 95 || c0 === 36) for (let i = 1; i < len; i++) {
|
|
1117
|
+
} else if (c0 >= 97 && c0 <= 122 || c0 >= 65 && c0 <= 90 || c0 === 95 || c0 === 36) for (let i = 1; i < len; i++) {
|
|
1092
1118
|
let c = name.charCodeAt(i);
|
|
1093
1119
|
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36)) return quote(name, i);
|
|
1094
1120
|
}
|
|
@@ -1145,7 +1171,7 @@ function quote(str, startPos) {
|
|
|
1145
1171
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1146
1172
|
}
|
|
1147
1173
|
function writeRef(state, ref) {
|
|
1148
|
-
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId,
|
|
1174
|
+
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) && !isAncestorChannelRef(state, ref) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, state.buf.push(ref.path)) : state.buf.push(ensureId(state, ref));
|
|
1149
1175
|
}
|
|
1150
1176
|
function ensureId(state, ref) {
|
|
1151
1177
|
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
@@ -1156,14 +1182,14 @@ function accessId(state, ref) {
|
|
|
1156
1182
|
}
|
|
1157
1183
|
function assignId(state, ref) {
|
|
1158
1184
|
let { pos } = ref;
|
|
1159
|
-
return
|
|
1185
|
+
return pos !== null && ref.flushId === state.flushId ? (ref.id = nextRefAccess(state), pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : isAncestorChannelRef(state, ref) ? ref.path || accessPath(state, ref) : (ref.id = nextRefAccess(state), ref.id + "=" + (ref.path || accessPath(state, ref)));
|
|
1160
1186
|
}
|
|
1161
1187
|
function accessPath(state, ref) {
|
|
1162
1188
|
let cur = ref, accessPrevValue = "";
|
|
1163
1189
|
do {
|
|
1164
1190
|
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1165
1191
|
let parent = cur.parent;
|
|
1166
|
-
if (parent.id
|
|
1192
|
+
if (parent.id) return trackChannel(state, parent), parent.id + accessPrevValue;
|
|
1167
1193
|
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1168
1194
|
cur = parent;
|
|
1169
1195
|
} while (cur);
|
|
@@ -1181,7 +1207,7 @@ function nextRefAccess(state) {
|
|
|
1181
1207
|
function nextId(state) {
|
|
1182
1208
|
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = state.ids++, r = c[n % 53];
|
|
1183
1209
|
for (n = n / 53 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1184
|
-
return r;
|
|
1210
|
+
return r === "name" ? nextId(state) : r;
|
|
1185
1211
|
}
|
|
1186
1212
|
function hasSymbolIterator(value) {
|
|
1187
1213
|
return Symbol.iterator in value;
|
|
@@ -1219,42 +1245,161 @@ function patchIteratorNext(proto) {
|
|
|
1219
1245
|
}, proto.next[kTouchedIterator] = !0;
|
|
1220
1246
|
}
|
|
1221
1247
|
//#endregion
|
|
1222
|
-
//#region src/
|
|
1223
|
-
function
|
|
1224
|
-
|
|
1248
|
+
//#region src/html/attrs.ts
|
|
1249
|
+
function _attr_class(value) {
|
|
1250
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassObject));
|
|
1225
1251
|
}
|
|
1226
|
-
function
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1252
|
+
function _attr_style(value) {
|
|
1253
|
+
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1254
|
+
}
|
|
1255
|
+
function _attr_option_value(value) {
|
|
1256
|
+
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1257
|
+
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1258
|
+
}
|
|
1259
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1260
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value ?? "", content);
|
|
1261
|
+
}
|
|
1262
|
+
function _attrs_select_value(scopeId, nodeAccessor, data, content) {
|
|
1263
|
+
data && ("value" in data || data.valueChange) ? _attr_select_value(scopeId, nodeAccessor, data.value, data.valueChange, content, 1) : content();
|
|
1264
|
+
}
|
|
1265
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1266
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _textarea_value(value);
|
|
1267
|
+
}
|
|
1268
|
+
function _attrs_textarea_value(scopeId, nodeAccessor, data) {
|
|
1269
|
+
return _attr_textarea_value(scopeId, nodeAccessor, data?.value, data?.valueChange, 1);
|
|
1270
|
+
}
|
|
1271
|
+
function _textarea_value(value) {
|
|
1272
|
+
let escaped = _escape(normalizeStrAttrValue(value));
|
|
1273
|
+
return escaped[0] === "\n" ? "\n" + escaped : escaped;
|
|
1274
|
+
}
|
|
1275
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1276
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1277
|
+
}
|
|
1278
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1279
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1280
|
+
}
|
|
1281
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1282
|
+
let valueAttr = _attr("value", value);
|
|
1283
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1284
|
+
}
|
|
1285
|
+
function getCheckedValueRef(checkedValue) {
|
|
1286
|
+
if (Array.isArray(checkedValue)) {
|
|
1287
|
+
let ref = checkedValuesRefs.get(checkedValue);
|
|
1288
|
+
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1230
1289
|
}
|
|
1231
1290
|
}
|
|
1232
|
-
function
|
|
1233
|
-
let
|
|
1234
|
-
|
|
1291
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1292
|
+
let normalizedOpen = isNotVoid(open);
|
|
1293
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1235
1294
|
}
|
|
1236
|
-
function
|
|
1237
|
-
|
|
1238
|
-
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
1295
|
+
function _attr_nonce() {
|
|
1296
|
+
return getChunk().boundary.state.nonceAttr;
|
|
1239
1297
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
if (opt) if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
1244
|
-
else cb(opt);
|
|
1298
|
+
function _style_html(decls) {
|
|
1299
|
+
let id = _id();
|
|
1300
|
+
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1245
1301
|
}
|
|
1246
|
-
function
|
|
1247
|
-
return
|
|
1302
|
+
function _attr(name, value) {
|
|
1303
|
+
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1248
1304
|
}
|
|
1249
|
-
function
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1305
|
+
function _attr_and(name, value, attr) {
|
|
1306
|
+
return value ? attr : _attr(name, value);
|
|
1307
|
+
}
|
|
1308
|
+
function _attr_or(name, value, attr) {
|
|
1309
|
+
return value ? _attr(name, value) : attr;
|
|
1310
|
+
}
|
|
1311
|
+
function _attr_nullish(name, value, attr) {
|
|
1312
|
+
return value == null ? attr : _attr(name, value);
|
|
1313
|
+
}
|
|
1314
|
+
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1315
|
+
let result = "", skip = /[\s/>"'=]/, events;
|
|
1316
|
+
switch (data && tagName) {
|
|
1317
|
+
case "input":
|
|
1318
|
+
data.checkedChange ? (result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/) : "checkedValue" in data || data.checkedValueChange ? (result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/) : data.valueChange && (result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1319
|
+
break;
|
|
1320
|
+
case "select":
|
|
1321
|
+
case "textarea":
|
|
1322
|
+
("value" in data || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1323
|
+
break;
|
|
1324
|
+
case "option":
|
|
1325
|
+
"value" in data && (result += _attr_option_value(data.value), skip = /^value$|[\s/>"'=]/);
|
|
1326
|
+
break;
|
|
1327
|
+
case "details":
|
|
1328
|
+
case "dialog": data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1256
1329
|
}
|
|
1257
|
-
|
|
1330
|
+
for (let name in data) {
|
|
1331
|
+
let value = data[name];
|
|
1332
|
+
switch (name) {
|
|
1333
|
+
case "class":
|
|
1334
|
+
result += _attr_class(value);
|
|
1335
|
+
break;
|
|
1336
|
+
case "style":
|
|
1337
|
+
result += _attr_style(value);
|
|
1338
|
+
break;
|
|
1339
|
+
default: name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventHandlerName(name)] = value) : result += nonVoidAttr(name, value));
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
return result;
|
|
1343
|
+
}
|
|
1344
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1345
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1346
|
+
}
|
|
1347
|
+
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1348
|
+
let partial = {};
|
|
1349
|
+
for (let name in data) {
|
|
1350
|
+
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
1351
|
+
skip[key] || (partial[key] = data[name]);
|
|
1352
|
+
}
|
|
1353
|
+
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1354
|
+
}
|
|
1355
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1356
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1357
|
+
}
|
|
1358
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1359
|
+
writeScope(scopeId, serializeType ? {
|
|
1360
|
+
["F" + nodeAccessor]: type,
|
|
1361
|
+
["G" + nodeAccessor]: value,
|
|
1362
|
+
["E" + nodeAccessor]: valueChange
|
|
1363
|
+
} : {
|
|
1364
|
+
["G" + nodeAccessor]: value,
|
|
1365
|
+
["E" + nodeAccessor]: valueChange
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
function stringAttr(name, value) {
|
|
1369
|
+
return value && " " + name + attrAssignment(value);
|
|
1370
|
+
}
|
|
1371
|
+
function nonVoidAttr(name, value) {
|
|
1372
|
+
switch (typeof value) {
|
|
1373
|
+
case "string": return " " + name + attrAssignment(value);
|
|
1374
|
+
case "boolean": return " " + name;
|
|
1375
|
+
case "number": return " " + name + "=" + value;
|
|
1376
|
+
}
|
|
1377
|
+
return " " + name + attrAssignment(value + "");
|
|
1378
|
+
}
|
|
1379
|
+
function attrAssignment(value) {
|
|
1380
|
+
return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, "\"") ? "='" + escapeSingleQuotedAttrValue(value) + "'" : "=\"" + escapeDoubleQuotedAttrValue(value) + "\"" : "=" + value : "";
|
|
1381
|
+
}
|
|
1382
|
+
function escapeSingleQuotedAttrValue(value) {
|
|
1383
|
+
return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
|
|
1384
|
+
}
|
|
1385
|
+
function replaceUnsafeSingleQuoteAttrChar(match) {
|
|
1386
|
+
return match === "'" ? "'" : match === "\r" ? " " : "&";
|
|
1387
|
+
}
|
|
1388
|
+
function escapeDoubleQuotedAttrValue(value) {
|
|
1389
|
+
return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
|
|
1390
|
+
}
|
|
1391
|
+
function replaceUnsafeDoubleQuoteAttrChar(match) {
|
|
1392
|
+
return match === "\"" ? """ : match === "\r" ? " " : "&";
|
|
1393
|
+
}
|
|
1394
|
+
function normalizedValueMatches(a, b) {
|
|
1395
|
+
let value = normalizeStrAttrValue(b);
|
|
1396
|
+
if (Array.isArray(a)) {
|
|
1397
|
+
for (let item of a) if (normalizeStrAttrValue(item) === value) return !0;
|
|
1398
|
+
} else if (normalizeStrAttrValue(a) === value) return !0;
|
|
1399
|
+
return !1;
|
|
1400
|
+
}
|
|
1401
|
+
function normalizeStrAttrValue(value) {
|
|
1402
|
+
return isNotVoid(value) && value !== !0 ? value + "" : "";
|
|
1258
1403
|
}
|
|
1259
1404
|
//#endregion
|
|
1260
1405
|
//#region src/html/for.ts
|
|
@@ -1320,14 +1465,20 @@ function withContext(key, value, cb, cbValue) {
|
|
|
1320
1465
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1321
1466
|
}
|
|
1322
1467
|
}
|
|
1468
|
+
function captureContext(chunk) {
|
|
1469
|
+
chunk.context?.[kPendingContexts] && (chunk.context = {
|
|
1470
|
+
...chunk.context,
|
|
1471
|
+
[kPendingContexts]: 0
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1323
1474
|
function isInResumedBranch() {
|
|
1324
1475
|
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1325
1476
|
}
|
|
1326
1477
|
function withBranchId(branchId, cb, cbValue) {
|
|
1327
1478
|
return withContext(kBranchId, branchId, cb, cbValue);
|
|
1328
1479
|
}
|
|
1329
|
-
function withIsAsync(cb, value) {
|
|
1330
|
-
return withContext(kIsAsync,
|
|
1480
|
+
function withIsAsync(async, cb, value) {
|
|
1481
|
+
return withContext(kIsAsync, async, cb, value);
|
|
1331
1482
|
}
|
|
1332
1483
|
function _html(html) {
|
|
1333
1484
|
$chunk.writeHTML(html);
|
|
@@ -1335,8 +1486,8 @@ function _html(html) {
|
|
|
1335
1486
|
function writeScript(script) {
|
|
1336
1487
|
$chunk.writeScript(script);
|
|
1337
1488
|
}
|
|
1338
|
-
function _script(scopeId, registryId,
|
|
1339
|
-
|
|
1489
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
1490
|
+
markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1340
1491
|
}
|
|
1341
1492
|
function _trailers(html) {
|
|
1342
1493
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1377,8 +1528,8 @@ function _resume_branch(scopeId) {
|
|
|
1377
1528
|
let branchId = $chunk.context?.[kBranchId];
|
|
1378
1529
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1379
1530
|
}
|
|
1380
|
-
function _attr_content(nodeAccessor, scopeId, content,
|
|
1381
|
-
let shouldResume =
|
|
1531
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1532
|
+
let shouldResume = markerGuard !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1382
1533
|
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1383
1534
|
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1384
1535
|
["D" + nodeAccessor]: rendererKey(render)
|
|
@@ -1397,48 +1548,48 @@ function writeScopePassive(scopeId, partialScope) {
|
|
|
1397
1548
|
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1398
1549
|
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1399
1550
|
}
|
|
1400
|
-
function _show_start(display,
|
|
1401
|
-
display ?
|
|
1551
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
1552
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1402
1553
|
}
|
|
1403
|
-
function _show_end(scopeId, accessor, display,
|
|
1554
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1404
1555
|
let branchId = _scope_id(), wrap = !display;
|
|
1405
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor,
|
|
1556
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1406
1557
|
}
|
|
1407
|
-
function _for_of(list, cb, by, scopeId, accessor,
|
|
1558
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1408
1559
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
1409
1560
|
let itemKey = forOfBy(by, item, index);
|
|
1410
1561
|
each(itemKey, itemKey === index, () => cb(item, index));
|
|
1411
|
-
}) : forOf(list, cb), scopeId, accessor,
|
|
1562
|
+
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1412
1563
|
}
|
|
1413
|
-
function _for_in(obj, cb, by, scopeId, accessor,
|
|
1564
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1414
1565
|
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
1415
1566
|
each(forInBy(by, key, value), !1, () => cb(key, value));
|
|
1416
|
-
}) : forIn(obj, cb), scopeId, accessor,
|
|
1567
|
+
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1417
1568
|
}
|
|
1418
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor,
|
|
1569
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1419
1570
|
forBranches(by, (each) => {
|
|
1420
1571
|
let index = 0;
|
|
1421
1572
|
return each ? forTo(to, from, step, (value) => {
|
|
1422
1573
|
let itemKey = forStepBy(by, value);
|
|
1423
1574
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1424
1575
|
}) : forTo(to, from, step, cb);
|
|
1425
|
-
}, scopeId, accessor,
|
|
1576
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1426
1577
|
}
|
|
1427
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor,
|
|
1578
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1428
1579
|
forBranches(by, (each) => {
|
|
1429
1580
|
let index = 0;
|
|
1430
1581
|
return each ? forUntil(to, from, step, (value) => {
|
|
1431
1582
|
let itemKey = forStepBy(by, value);
|
|
1432
1583
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1433
1584
|
}) : forUntil(to, from, step, cb);
|
|
1434
|
-
}, scopeId, accessor,
|
|
1585
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1435
1586
|
}
|
|
1436
|
-
function forBranches(by, iterate, scopeId, accessor,
|
|
1437
|
-
if (
|
|
1438
|
-
iterate(0), writeBranchEnd(scopeId, accessor,
|
|
1587
|
+
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1588
|
+
if (branchGuard === 0) {
|
|
1589
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
1439
1590
|
return;
|
|
1440
1591
|
}
|
|
1441
|
-
let { state } = $chunk.boundary, resumeKeys =
|
|
1592
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
1442
1593
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1443
1594
|
let branchId = _peek_scope_id();
|
|
1444
1595
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1446,14 +1597,14 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1446
1597
|
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
1447
1598
|
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
1448
1599
|
});
|
|
1449
|
-
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor,
|
|
1600
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1450
1601
|
}
|
|
1451
|
-
function _if(cb, scopeId, accessor,
|
|
1452
|
-
let resumeBranch =
|
|
1602
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1603
|
+
let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1453
1604
|
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1454
1605
|
["D" + accessor]: branchIndex || void 0,
|
|
1455
1606
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1456
|
-
}), writeBranchEnd(scopeId, accessor,
|
|
1607
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1457
1608
|
}
|
|
1458
1609
|
function deferBranchStart(chunk) {
|
|
1459
1610
|
let beforeBranch = chunk.html;
|
|
@@ -1462,13 +1613,15 @@ function deferBranchStart(chunk) {
|
|
|
1462
1613
|
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1463
1614
|
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1464
1615
|
}
|
|
1465
|
-
function
|
|
1616
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
1617
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
1618
|
+
}
|
|
1619
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
1466
1620
|
let endTag = parentEndTag || "";
|
|
1467
|
-
if (
|
|
1621
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
1468
1622
|
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1469
1623
|
$chunk.writeHTML(mark + endTag);
|
|
1470
|
-
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1471
|
-
else $chunk.writeHTML(endTag);
|
|
1624
|
+
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1472
1625
|
}
|
|
1473
1626
|
function _existing_scope(scopeId) {
|
|
1474
1627
|
return writeScope(scopeId, {});
|
|
@@ -1480,28 +1633,28 @@ function scopeWithId(state, scopeId) {
|
|
|
1480
1633
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1481
1634
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1482
1635
|
}
|
|
1483
|
-
function _subscribe(subscribers, scope, resumeId,
|
|
1636
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1484
1637
|
if (subscribers) {
|
|
1485
1638
|
let { serializer } = $chunk.boundary.state;
|
|
1486
|
-
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId,
|
|
1639
|
+
!$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId, markerGuard) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
|
|
1487
1640
|
}
|
|
1488
1641
|
return scope;
|
|
1489
1642
|
}
|
|
1490
1643
|
function maskGroup(mask, group) {
|
|
1491
1644
|
return mask === 715827883 ? 1 : typeof mask == "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
|
|
1492
1645
|
}
|
|
1493
|
-
function
|
|
1494
|
-
$chunk.boundary.state.
|
|
1646
|
+
function _set_scope_reason(reason) {
|
|
1647
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
1495
1648
|
}
|
|
1496
1649
|
function _scope_reason() {
|
|
1497
|
-
let reason = $chunk.boundary.state.
|
|
1498
|
-
return $chunk.boundary.state.
|
|
1650
|
+
let reason = $chunk.boundary.state.scopeReason;
|
|
1651
|
+
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1499
1652
|
}
|
|
1500
|
-
function
|
|
1653
|
+
function _write_if(condition, key) {
|
|
1501
1654
|
return condition && maskGroup(condition, key) ? 1 : void 0;
|
|
1502
1655
|
}
|
|
1503
|
-
function
|
|
1504
|
-
return
|
|
1656
|
+
function _write_guard(condition, key) {
|
|
1657
|
+
return _write_if(condition, key) || 0;
|
|
1505
1658
|
}
|
|
1506
1659
|
function writeWaitReady(readyId, renderer, input) {
|
|
1507
1660
|
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
@@ -1511,10 +1664,11 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
1511
1664
|
writeScopes: {},
|
|
1512
1665
|
flushScopes: !1
|
|
1513
1666
|
}), bodyEnd = body.render(renderer, input);
|
|
1667
|
+
if (boundary.aborted) throw boundary.reason;
|
|
1514
1668
|
body === bodyEnd ? (chunk.writeHTML(body.html), body.deferOwnReady(), chunk.deferredReady = push(chunk.deferredReady, body)) : (bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next), chunk.next = body);
|
|
1515
1669
|
}
|
|
1516
|
-
function _await(scopeId, accessor, promise, content,
|
|
1517
|
-
let resumeMarker =
|
|
1670
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
1671
|
+
let resumeMarker = markerGuard !== 0;
|
|
1518
1672
|
if (!isPromise(promise)) {
|
|
1519
1673
|
if (resumeMarker) {
|
|
1520
1674
|
let branchId = _peek_scope_id();
|
|
@@ -1522,26 +1676,27 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1522
1676
|
} else content(promise);
|
|
1523
1677
|
return;
|
|
1524
1678
|
}
|
|
1525
|
-
let chunk = $chunk, { boundary } = chunk;
|
|
1526
|
-
chunk.
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1679
|
+
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1680
|
+
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1681
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
1682
|
+
let { state } = boundary;
|
|
1683
|
+
chunk.render(() => {
|
|
1684
|
+
if (resumeMarker) {
|
|
1685
|
+
let branchId = _peek_scope_id();
|
|
1686
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1687
|
+
} else {
|
|
1688
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1689
|
+
withIsAsync(async, content, value), async.visit = renderedSince && (after.html || after.next) ? $chunk.boundary.state.mark("]", scopeId + " " + accessor) : "", async.resumed && $chunk.writeHTML(async.visit), async.end = $chunk;
|
|
1690
|
+
}
|
|
1691
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
1692
|
+
}
|
|
1536
1693
|
}, (err) => {
|
|
1537
1694
|
chunk.async = !1, boundary.abort(err);
|
|
1538
1695
|
});
|
|
1539
1696
|
}
|
|
1540
|
-
function _try(scopeId, accessor, content,
|
|
1541
|
-
let
|
|
1542
|
-
|
|
1543
|
-
let rendered = chunk !== $chunk || boundary.resumeWrites !== resumeWrites;
|
|
1544
|
-
applyBranchStart(chunk, beforeBranch, rendered), rendered && (renderersAtSettle || writeTryRenderers(branchId, catchContent, placeholderContent), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
1697
|
+
function _try(scopeId, accessor, content, placeholderContent, catchContent, placeholderId, catchId) {
|
|
1698
|
+
let placeholderBranchId = placeholderContent ? _scope_id() : 0, branchId = _peek_scope_id(), chunk = $chunk, { boundary } = chunk, { state } = boundary, { resumeWrites } = boundary, beforeBranch = deferBranchStart(chunk), renderers = () => writeTryRenderers(branchId, catchContent && _resume(catchContent, catchId), placeholderContent && _resume(placeholderContent, placeholderId)), renderersWritten = tryBoundary(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent, branchId, renderers), rendered = chunk !== $chunk || boundary.resumeWrites !== resumeWrites;
|
|
1699
|
+
applyBranchStart(chunk, beforeBranch, rendered), rendered && (renderersWritten || renderers(), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
1545
1700
|
}
|
|
1546
1701
|
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
1547
1702
|
let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
|
|
@@ -1549,7 +1704,7 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1549
1704
|
chunk.append(body);
|
|
1550
1705
|
return;
|
|
1551
1706
|
}
|
|
1552
|
-
chunk.next = $chunk = chunk.fork(boundary, chunk.next), chunk.placeholder = {
|
|
1707
|
+
chunk.next = $chunk = chunk.fork(boundary, chunk.next), captureContext(chunk), chunk.placeholder = {
|
|
1553
1708
|
body,
|
|
1554
1709
|
render: placeholder,
|
|
1555
1710
|
branchId,
|
|
@@ -1557,29 +1712,41 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1557
1712
|
placeholderBranchId
|
|
1558
1713
|
};
|
|
1559
1714
|
}
|
|
1560
|
-
function tryBoundary(content, catchContent,
|
|
1561
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1562
|
-
if (catchBoundary.
|
|
1715
|
+
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1716
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, void 0, boundary), body = chunk.fork(catchBoundary, null), bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
1717
|
+
if (catchBoundary.aborted) {
|
|
1718
|
+
if (!catchContent) throw catchBoundary.reason;
|
|
1719
|
+
return catchContent(catchBoundary.reason), !0;
|
|
1720
|
+
}
|
|
1563
1721
|
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1564
1722
|
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1565
1723
|
chunk.next = body, boundary.startAsync();
|
|
1566
|
-
let reorderId = catchContent
|
|
1567
|
-
return reorderId && (chunk.
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1724
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
1725
|
+
return reorderId && (chunk.catchRange = {
|
|
1726
|
+
id: reorderId,
|
|
1727
|
+
end: bodyEnd
|
|
1728
|
+
}, captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1729
|
+
if (!boundary.aborted) {
|
|
1730
|
+
if (catchBoundary.aborted) {
|
|
1731
|
+
if (!reorderId) {
|
|
1732
|
+
boundary.abort(catchBoundary.reason);
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1736
|
+
chunk.catchRange = null;
|
|
1737
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1738
|
+
if (boundary.aborted) return;
|
|
1739
|
+
if (bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1740
|
+
else {
|
|
1741
|
+
let reorder = null;
|
|
1742
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
1743
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
1744
|
+
for (; cut.consumed;) cut = cut.next;
|
|
1745
|
+
cut.async = !1, cut.next = inOrder ? catchChunk : bodyNext, cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker, cut.scripts = cut.effects = cut.lastEffect = "", cut.placeholder = cut.reorderId = cut.catchRange = null, cut.deferredReorder = reorder, inOrder && (catchChunk.next = bodyNext);
|
|
1746
|
+
}
|
|
1747
|
+
boundary.endAsync();
|
|
1748
|
+
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
1749
|
+
}
|
|
1583
1750
|
}, renderersAtSettle;
|
|
1584
1751
|
}
|
|
1585
1752
|
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
@@ -1588,8 +1755,12 @@ function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
|
1588
1755
|
Q: placeholderContent
|
|
1589
1756
|
});
|
|
1590
1757
|
}
|
|
1591
|
-
function countResumeWrite(
|
|
1592
|
-
for (; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
1758
|
+
function countResumeWrite(chunk) {
|
|
1759
|
+
for (let boundary = chunk.boundary; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
1760
|
+
for (let async = getAsyncContent(chunk); async && !async.resumed; async = async.parent) async.resumed = !0, async.end?.writeHTML(async.visit);
|
|
1761
|
+
}
|
|
1762
|
+
function getAsyncContent(chunk) {
|
|
1763
|
+
return chunk.context?.[kIsAsync];
|
|
1593
1764
|
}
|
|
1594
1765
|
var State = class {
|
|
1595
1766
|
tagId = 1;
|
|
@@ -1613,7 +1784,7 @@ var State = class {
|
|
|
1613
1784
|
flushScopes = !1;
|
|
1614
1785
|
writeScopes = {};
|
|
1615
1786
|
readyIds = null;
|
|
1616
|
-
|
|
1787
|
+
scopeReason;
|
|
1617
1788
|
$global;
|
|
1618
1789
|
constructor($global) {
|
|
1619
1790
|
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
@@ -1654,27 +1825,40 @@ var State = class {
|
|
|
1654
1825
|
mark(code, str) {
|
|
1655
1826
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1656
1827
|
}
|
|
1657
|
-
}, Boundary = class
|
|
1828
|
+
}, Boundary = class {
|
|
1658
1829
|
onNext = NOOP$2;
|
|
1659
1830
|
count = 0;
|
|
1660
1831
|
resumeWrites = 0;
|
|
1661
1832
|
state;
|
|
1662
1833
|
parent;
|
|
1834
|
+
aborted = !1;
|
|
1835
|
+
reason;
|
|
1836
|
+
pendingReorders;
|
|
1837
|
+
children;
|
|
1663
1838
|
constructor(state, signal, parent) {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1839
|
+
this.state = state, this.parent = parent, parent ? parent.aborted ? this.abort(parent.reason) : (parent.children ||= []).push(this) : signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort", this));
|
|
1840
|
+
}
|
|
1841
|
+
abort(reason) {
|
|
1842
|
+
if (this.aborted) return;
|
|
1843
|
+
let { state } = this;
|
|
1844
|
+
if (this.aborted = !0, this.reason = reason, this.pendingReorders) {
|
|
1845
|
+
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1846
|
+
this.pendingReorders = void 0;
|
|
1847
|
+
}
|
|
1848
|
+
if (this.count = 0, this.state = new State(state.$global), this.children) for (let child of this.children) child.abort(reason);
|
|
1849
|
+
this.onNext();
|
|
1850
|
+
}
|
|
1851
|
+
handleEvent(event) {
|
|
1852
|
+
this.abort(event.target.reason);
|
|
1669
1853
|
}
|
|
1670
1854
|
flush() {
|
|
1671
|
-
return this.
|
|
1855
|
+
return this.aborted || flushSerializer(this, this.state), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1672
1856
|
}
|
|
1673
1857
|
startAsync() {
|
|
1674
|
-
this.
|
|
1858
|
+
this.aborted || this.count++;
|
|
1675
1859
|
}
|
|
1676
1860
|
endAsync() {
|
|
1677
|
-
|
|
1861
|
+
this.aborted || (this.count--, this.onNext());
|
|
1678
1862
|
}
|
|
1679
1863
|
}, Chunk = class Chunk {
|
|
1680
1864
|
html = "";
|
|
@@ -1683,9 +1867,10 @@ var State = class {
|
|
|
1683
1867
|
lastEffect = "";
|
|
1684
1868
|
async = !1;
|
|
1685
1869
|
consumed = !1;
|
|
1686
|
-
needsWalk = !1;
|
|
1687
1870
|
reorderId = null;
|
|
1688
1871
|
deferredReady = null;
|
|
1872
|
+
deferredReorder = null;
|
|
1873
|
+
catchRange = null;
|
|
1689
1874
|
placeholder = null;
|
|
1690
1875
|
boundary;
|
|
1691
1876
|
next;
|
|
@@ -1701,13 +1886,13 @@ var State = class {
|
|
|
1701
1886
|
this.html += html;
|
|
1702
1887
|
}
|
|
1703
1888
|
writeEffect(scopeId, registryId) {
|
|
1704
|
-
countResumeWrite(this
|
|
1889
|
+
countResumeWrite(this), this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1705
1890
|
}
|
|
1706
1891
|
writeScript(script) {
|
|
1707
1892
|
this.scripts = concatScripts(this.scripts, script);
|
|
1708
1893
|
}
|
|
1709
1894
|
append(chunk) {
|
|
1710
|
-
this.html += chunk.html, this.
|
|
1895
|
+
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
|
|
1711
1896
|
}
|
|
1712
1897
|
takeDeferredReady() {
|
|
1713
1898
|
let { deferredReady } = this;
|
|
@@ -1719,23 +1904,59 @@ var State = class {
|
|
|
1719
1904
|
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1720
1905
|
}
|
|
1721
1906
|
}
|
|
1722
|
-
|
|
1907
|
+
renderPlaceholders(boundary) {
|
|
1908
|
+
let { state } = boundary;
|
|
1909
|
+
restart: for (;;) {
|
|
1910
|
+
let reorders = null;
|
|
1911
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
1912
|
+
if (cur.renderPlaceholder(state)) {
|
|
1913
|
+
if (boundary.aborted) return;
|
|
1914
|
+
continue restart;
|
|
1915
|
+
}
|
|
1916
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1917
|
+
}
|
|
1918
|
+
if (state.writeReorders) {
|
|
1919
|
+
for (let reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === !1) {
|
|
1920
|
+
if (boundary.aborted) return;
|
|
1921
|
+
continue restart;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === !1) {
|
|
1925
|
+
if (boundary.aborted) return;
|
|
1926
|
+
continue restart;
|
|
1927
|
+
}
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
renderPlaceholder(state) {
|
|
1723
1932
|
let { placeholder } = this;
|
|
1724
|
-
if (placeholder)
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1933
|
+
if (!placeholder || (this.placeholder = null, this.boundary.aborted)) return !1;
|
|
1934
|
+
let { body } = placeholder, end = body;
|
|
1935
|
+
for (; end.next && !end.async;) end = end.next;
|
|
1936
|
+
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
1937
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
1938
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
1939
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1940
|
+
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
|
|
1941
|
+
let stateful = this.effects !== effects;
|
|
1942
|
+
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), end.writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
|
|
1943
|
+
}
|
|
1944
|
+
markCatchRange() {
|
|
1945
|
+
let { catchRange } = this;
|
|
1946
|
+
if (catchRange) {
|
|
1947
|
+
let { state } = this.boundary;
|
|
1948
|
+
this.catchRange = null, this.writeHTML(state.mark("!^", catchRange.id)), catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
1733
1949
|
}
|
|
1734
1950
|
}
|
|
1735
|
-
|
|
1736
|
-
let
|
|
1737
|
-
|
|
1738
|
-
|
|
1951
|
+
queueDeferredReorder() {
|
|
1952
|
+
let { deferredReorder } = this;
|
|
1953
|
+
deferredReorder && (this.deferredReorder = null, deferredReorder.boundary.state.reorder(deferredReorder));
|
|
1954
|
+
}
|
|
1955
|
+
consume(boundary) {
|
|
1956
|
+
this.renderPlaceholders(boundary);
|
|
1957
|
+
let cur = this, html = "", effects = "", scripts = "", lastEffect = "", deferredReady;
|
|
1958
|
+
for (; cur.next && !cur.async;) cur.markCatchRange(), cur.queueDeferredReorder(), html += cur.html, cur.serializeState.readyId ? deferredReady = push(deferredReady, cur) : (effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect), deferredReady = concat(deferredReady, cur.takeDeferredReady()), cur.consumed = !0, cur = cur.next;
|
|
1959
|
+
return cur.deferOwnReady(), cur.deferredReady = concat(deferredReady, cur.deferredReady), cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect ||= lastEffect, cur;
|
|
1739
1960
|
}
|
|
1740
1961
|
render(content, val) {
|
|
1741
1962
|
let prev = $chunk;
|
|
@@ -1748,11 +1969,10 @@ var State = class {
|
|
|
1748
1969
|
$chunk = prev;
|
|
1749
1970
|
}
|
|
1750
1971
|
}
|
|
1751
|
-
flushReadyScripts(reservations, holdEffects) {
|
|
1752
|
-
let {
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
}), readyId && !this.async) {
|
|
1972
|
+
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1973
|
+
let { serializeState } = this, { readyId } = serializeState, scripts = "", held = this.takeDeferredReady();
|
|
1974
|
+
if (held) for (let chunk of Array.isArray(held) ? held : [held]) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
|
|
1975
|
+
if (readyId && !this.async) {
|
|
1756
1976
|
let { state } = boundary;
|
|
1757
1977
|
flushSerializer(boundary, serializeState);
|
|
1758
1978
|
let deps = state.serializer.takeChannelDeps(), effects = holdEffects ? "" : this.effects, { resumes } = serializeState, chunkScripts = this.scripts;
|
|
@@ -1768,11 +1988,11 @@ var State = class {
|
|
|
1768
1988
|
}
|
|
1769
1989
|
return scripts;
|
|
1770
1990
|
}
|
|
1771
|
-
flushScript() {
|
|
1772
|
-
let {
|
|
1991
|
+
flushScript(boundary) {
|
|
1992
|
+
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1773
1993
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1774
|
-
let readyResumeScripts = this.flushReadyScripts(void 0, this.async);
|
|
1775
|
-
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
1994
|
+
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1995
|
+
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1776
1996
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1777
1997
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1778
1998
|
}
|
|
@@ -1781,40 +2001,36 @@ var State = class {
|
|
|
1781
2001
|
state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"");
|
|
1782
2002
|
let reordered = "", needsResumeArray = !1;
|
|
1783
2003
|
if (state.writeReorders) {
|
|
1784
|
-
let carried = null;
|
|
1785
2004
|
for (let reorderedChunk of state.writeReorders) {
|
|
1786
|
-
if (
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
}
|
|
1793
|
-
reorderedChunk.async = !1;
|
|
1794
|
-
}
|
|
1795
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1796
|
-
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1797
|
-
for (reorderedChunk.reorderId = null;;) {
|
|
1798
|
-
cur.flushPlaceholder(), cur.deferOwnReady();
|
|
1799
|
-
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(readyReservations, this.async);
|
|
1800
|
-
if (this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), state.reorder(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next) cur = next;
|
|
1801
|
-
else break;
|
|
2005
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
2006
|
+
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2007
|
+
for (reorderedChunk.reorderId = null; cur;) {
|
|
2008
|
+
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
2009
|
+
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
2010
|
+
this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), (cur.boundary.pendingReorders ||= /* @__PURE__ */ new Set()).add(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), cur = next;
|
|
1802
2011
|
}
|
|
1803
2012
|
reorderEffects && (this.async ? (this.effects = concatEffects(this.effects, reorderEffects), this.lastEffect = "") : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
1804
2013
|
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
1805
2014
|
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1806
2015
|
}
|
|
1807
|
-
state.writeReorders =
|
|
2016
|
+
state.writeReorders = null;
|
|
1808
2017
|
}
|
|
1809
2018
|
return flushSerializer(boundary, state), (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1810
2019
|
}
|
|
1811
|
-
flushHTML() {
|
|
1812
|
-
let {
|
|
1813
|
-
this.
|
|
2020
|
+
flushHTML(boundary) {
|
|
2021
|
+
let { state } = boundary;
|
|
2022
|
+
this.flushScript(boundary);
|
|
1814
2023
|
let { html, scripts } = this;
|
|
1815
2024
|
return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
|
|
1816
2025
|
}
|
|
1817
2026
|
};
|
|
2027
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
2028
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
2029
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return !1;
|
|
2030
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
2031
|
+
}
|
|
2032
|
+
return reorders;
|
|
2033
|
+
}
|
|
1818
2034
|
function flushSerializer(boundary, serializeState) {
|
|
1819
2035
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1820
2036
|
if (serializeState.flushScopes || pending) {
|
|
@@ -1901,159 +2117,30 @@ function flushTickQueue() {
|
|
|
1901
2117
|
}
|
|
1902
2118
|
}
|
|
1903
2119
|
//#endregion
|
|
1904
|
-
//#region src/html/
|
|
1905
|
-
function
|
|
1906
|
-
return
|
|
1907
|
-
}
|
|
1908
|
-
function _attr_style(value) {
|
|
1909
|
-
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1910
|
-
}
|
|
1911
|
-
function _attr_option_value(value) {
|
|
1912
|
-
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1913
|
-
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1914
|
-
}
|
|
1915
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1916
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value ?? "", content);
|
|
1917
|
-
}
|
|
1918
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1919
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _textarea_value(value);
|
|
1920
|
-
}
|
|
1921
|
-
function _textarea_value(value) {
|
|
1922
|
-
let escaped = _escape(normalizeStrAttrValue(value));
|
|
1923
|
-
return escaped[0] === "\n" ? "\n" + escaped : escaped;
|
|
1924
|
-
}
|
|
1925
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1926
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1927
|
-
}
|
|
1928
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1929
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1930
|
-
}
|
|
1931
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1932
|
-
let valueAttr = _attr("value", value);
|
|
1933
|
-
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1934
|
-
}
|
|
1935
|
-
function getCheckedValueRef(checkedValue) {
|
|
1936
|
-
if (Array.isArray(checkedValue)) {
|
|
1937
|
-
let ref = checkedValuesRefs.get(checkedValue);
|
|
1938
|
-
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1942
|
-
let normalizedOpen = isNotVoid(open);
|
|
1943
|
-
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1944
|
-
}
|
|
1945
|
-
function _attr_nonce() {
|
|
1946
|
-
return getChunk().boundary.state.nonceAttr;
|
|
1947
|
-
}
|
|
1948
|
-
function _style_html(decls) {
|
|
1949
|
-
let id = _id();
|
|
1950
|
-
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1951
|
-
}
|
|
1952
|
-
function _attr(name, value) {
|
|
1953
|
-
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1954
|
-
}
|
|
1955
|
-
function _attr_and(name, value, attr) {
|
|
1956
|
-
return value ? attr : _attr(name, value);
|
|
1957
|
-
}
|
|
1958
|
-
function _attr_or(name, value, attr) {
|
|
1959
|
-
return value ? _attr(name, value) : attr;
|
|
1960
|
-
}
|
|
1961
|
-
function _attr_nullish(name, value, attr) {
|
|
1962
|
-
return value == null ? attr : _attr(name, value);
|
|
1963
|
-
}
|
|
1964
|
-
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1965
|
-
let result = "", skip = /[\s/>"'=]/, events;
|
|
1966
|
-
switch (data && tagName) {
|
|
1967
|
-
case "input":
|
|
1968
|
-
data.checkedChange ? (result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/) : "checkedValue" in data || data.checkedValueChange ? (result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/) : data.valueChange && (result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1969
|
-
break;
|
|
1970
|
-
case "select":
|
|
1971
|
-
case "textarea":
|
|
1972
|
-
("value" in data || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1973
|
-
break;
|
|
1974
|
-
case "option":
|
|
1975
|
-
"value" in data && (result += _attr_option_value(data.value), skip = /^value$|[\s/>"'=]/);
|
|
1976
|
-
break;
|
|
1977
|
-
case "details":
|
|
1978
|
-
case "dialog":
|
|
1979
|
-
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1980
|
-
break;
|
|
1981
|
-
}
|
|
1982
|
-
for (let name in data) {
|
|
1983
|
-
let value = data[name];
|
|
1984
|
-
switch (name) {
|
|
1985
|
-
case "class":
|
|
1986
|
-
result += _attr_class(value);
|
|
1987
|
-
break;
|
|
1988
|
-
case "style":
|
|
1989
|
-
result += _attr_style(value);
|
|
1990
|
-
break;
|
|
1991
|
-
default:
|
|
1992
|
-
name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventHandlerName(name)] = value) : result += nonVoidAttr(name, value));
|
|
1993
|
-
break;
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
return result;
|
|
1997
|
-
}
|
|
1998
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1999
|
-
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
2000
|
-
}
|
|
2001
|
-
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
2002
|
-
let partial = {};
|
|
2003
|
-
for (let name in data) {
|
|
2004
|
-
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
2005
|
-
skip[key] || (partial[key] = data[name]);
|
|
2006
|
-
}
|
|
2007
|
-
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
2008
|
-
}
|
|
2009
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
2010
|
-
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
2011
|
-
}
|
|
2012
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2013
|
-
writeScope(scopeId, serializeType ? {
|
|
2014
|
-
["F" + nodeAccessor]: type,
|
|
2015
|
-
["G" + nodeAccessor]: value,
|
|
2016
|
-
["E" + nodeAccessor]: valueChange
|
|
2017
|
-
} : {
|
|
2018
|
-
["G" + nodeAccessor]: value,
|
|
2019
|
-
["E" + nodeAccessor]: valueChange
|
|
2020
|
-
});
|
|
2021
|
-
}
|
|
2022
|
-
function stringAttr(name, value) {
|
|
2023
|
-
return value && " " + name + attrAssignment(value);
|
|
2024
|
-
}
|
|
2025
|
-
function nonVoidAttr(name, value) {
|
|
2026
|
-
switch (typeof value) {
|
|
2027
|
-
case "string": return " " + name + attrAssignment(value);
|
|
2028
|
-
case "boolean": return " " + name;
|
|
2029
|
-
case "number": return " " + name + "=" + value;
|
|
2030
|
-
}
|
|
2031
|
-
return " " + name + attrAssignment(value + "");
|
|
2120
|
+
//#region src/html/content.ts
|
|
2121
|
+
function _to_text(val) {
|
|
2122
|
+
return val || val === 0 ? val + "" : "";
|
|
2032
2123
|
}
|
|
2033
|
-
function
|
|
2034
|
-
return
|
|
2124
|
+
function _unescaped(val) {
|
|
2125
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
2035
2126
|
}
|
|
2036
|
-
function
|
|
2037
|
-
return
|
|
2127
|
+
function _escape(val) {
|
|
2128
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
2038
2129
|
}
|
|
2039
|
-
function
|
|
2040
|
-
return
|
|
2130
|
+
function _escape_script(val) {
|
|
2131
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
2041
2132
|
}
|
|
2042
|
-
function
|
|
2043
|
-
return
|
|
2133
|
+
function _escape_style(val) {
|
|
2134
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
2044
2135
|
}
|
|
2045
|
-
function
|
|
2046
|
-
return
|
|
2136
|
+
function _escape_style_value(val) {
|
|
2137
|
+
return val || val === 0 ? escapeStyleValue(val + "") : "";
|
|
2047
2138
|
}
|
|
2048
|
-
function
|
|
2049
|
-
|
|
2050
|
-
if (Array.isArray(a)) {
|
|
2051
|
-
for (let item of a) if (normalizeStrAttrValue(item) === value) return !0;
|
|
2052
|
-
} else if (normalizeStrAttrValue(a) === value) return !0;
|
|
2053
|
-
return !1;
|
|
2139
|
+
function escapeCommentStr(str) {
|
|
2140
|
+
return unsafeCommentReg.test(str) && (str = str.replace(unsafeCommentReg, ">")), str.startsWith(getState().commentPrefix) ? "&#" + str.charCodeAt(0) + ";" + str.slice(1) : str;
|
|
2054
2141
|
}
|
|
2055
|
-
function
|
|
2056
|
-
return
|
|
2142
|
+
function _escape_comment(val) {
|
|
2143
|
+
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
2057
2144
|
}
|
|
2058
2145
|
//#endregion
|
|
2059
2146
|
//#region src/html/dynamic-tag.ts
|
|
@@ -2127,11 +2214,11 @@ var ServerRendered = class {
|
|
|
2127
2214
|
done: !1
|
|
2128
2215
|
};
|
|
2129
2216
|
return value = "", Promise.resolve(result);
|
|
2130
|
-
}
|
|
2217
|
+
}
|
|
2218
|
+
return done ? Promise.resolve({
|
|
2131
2219
|
value: "",
|
|
2132
2220
|
done
|
|
2133
|
-
});
|
|
2134
|
-
else return new Promise(exec);
|
|
2221
|
+
}) : new Promise(exec);
|
|
2135
2222
|
},
|
|
2136
2223
|
throw(error) {
|
|
2137
2224
|
return done || aborted || boundary?.abort(error), Promise.resolve({
|
|
@@ -2190,49 +2277,64 @@ var ServerRendered = class {
|
|
|
2190
2277
|
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
2191
2278
|
let head = this.#head;
|
|
2192
2279
|
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error(CONSUMED_RESULT_MESSAGE));
|
|
2193
|
-
let { boundary } = head;
|
|
2280
|
+
let { boundary } = head, html = "";
|
|
2194
2281
|
(boundary.onNext = () => {
|
|
2195
2282
|
switch (!boundary.count && boundary.flush()) {
|
|
2196
2283
|
case 2:
|
|
2197
|
-
boundary
|
|
2198
|
-
break;
|
|
2199
|
-
case 0: {
|
|
2200
|
-
let consumed = head.consume();
|
|
2201
|
-
boundary.signal.aborted || resolve(consumed.flushHTML());
|
|
2284
|
+
settle(boundary), reject(boundary.reason);
|
|
2202
2285
|
break;
|
|
2203
|
-
|
|
2286
|
+
case 0:
|
|
2287
|
+
if (head = head.consume(boundary), boundary.aborted) break;
|
|
2288
|
+
html += head.flushHTML(boundary), boundary.count || boundary.aborted || (settle(boundary), resolve(html));
|
|
2204
2289
|
}
|
|
2205
2290
|
})();
|
|
2206
2291
|
});
|
|
2207
2292
|
}
|
|
2208
2293
|
#read(onWrite, onAbort, onClose) {
|
|
2209
|
-
let tick = !0, head = this.#head;
|
|
2294
|
+
let tick = !0, flushing = !1, again = !1, head = this.#head;
|
|
2210
2295
|
if (this.#head = null, !head) {
|
|
2211
2296
|
onAbort(/* @__PURE__ */ Error(CONSUMED_RESULT_MESSAGE));
|
|
2212
2297
|
return;
|
|
2213
2298
|
}
|
|
2214
2299
|
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2300
|
+
if (flushing) {
|
|
2301
|
+
again = !0;
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
flushing = !0;
|
|
2305
|
+
do {
|
|
2306
|
+
again = !1;
|
|
2307
|
+
let status = boundary.flush();
|
|
2308
|
+
if (status === 2) {
|
|
2309
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
|
|
2310
|
+
return;
|
|
2311
|
+
}
|
|
2312
|
+
if (write || status === 0) {
|
|
2313
|
+
if (head = head.consume(boundary), boundary.aborted) continue;
|
|
2314
|
+
let html = head.flushHTML(boundary);
|
|
2315
|
+
if (boundary.aborted) continue;
|
|
2316
|
+
if (html && onWrite(html), !boundary.count) {
|
|
2317
|
+
tick || offTick(onNext), settle(boundary), onClose();
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
write && (tick = !0);
|
|
2321
|
+
} else tick && (tick = !1, queueTick(onNext));
|
|
2322
|
+
} while (again);
|
|
2323
|
+
flushing = !1;
|
|
2222
2324
|
};
|
|
2223
2325
|
return onNext(), boundary;
|
|
2224
2326
|
}
|
|
2225
2327
|
toString() {
|
|
2226
2328
|
let head = this.#head;
|
|
2227
2329
|
if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
|
|
2228
|
-
let { boundary } = head;
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
case 1: throw Error("Cannot consume asynchronous render with 'toString'");
|
|
2232
|
-
}
|
|
2233
|
-
return head.consume().flushHTML();
|
|
2330
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2331
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2332
|
+
return html;
|
|
2234
2333
|
}
|
|
2235
2334
|
};
|
|
2335
|
+
function settle(boundary) {
|
|
2336
|
+
boundary.onNext = NOOP$1, boundary.state.$global.signal?.removeEventListener("abort", boundary);
|
|
2337
|
+
}
|
|
2236
2338
|
function NOOP$1() {}
|
|
2237
2339
|
//#endregion
|
|
2238
2340
|
//#region src/html/assets.ts
|
|
@@ -2245,7 +2347,7 @@ function withLoadAssets(renderer, assetId, triggers) {
|
|
|
2245
2347
|
function withPageAssets(template, runtime, assetId, runtimeId) {
|
|
2246
2348
|
return assetFlush = runtime, Object.assign((input) => {
|
|
2247
2349
|
let g = $global();
|
|
2248
|
-
return runtimeId && (g.runtimeId = runtimeId), addAsset(g, assetId), g.__flush__ ? (_html(flush(g, "")), writeWaitReady(assetId, template, input)) : (g.__flush__ = flush, template(input));
|
|
2350
|
+
return runtimeId && (g[kAssets] || (g.runtimeId = runtimeId)), addAsset(g, assetId), g.__flush__ ? (_html(flush(g, "")), writeWaitReady(assetId, template, input)) : (g.__flush__ = flush, template(input));
|
|
2249
2351
|
}, template);
|
|
2250
2352
|
}
|
|
2251
2353
|
function _flush_head() {
|
|
@@ -2301,9 +2403,9 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2301
2403
|
pending.length = 0;
|
|
2302
2404
|
}
|
|
2303
2405
|
function NOOP() {}
|
|
2304
|
-
exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_and = _attr_and, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_nullish = _attr_nullish, exports._attr_option_value = _attr_option_value, exports._attr_or = _attr_or, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
2406
|
+
exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_and = _attr_and, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_nullish = _attr_nullish, exports._attr_option_value = _attr_option_value, exports._attr_or = _attr_or, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_select_value = _attrs_select_value, exports._attrs_textarea_value = _attrs_textarea_value, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
2305
2407
|
enumerable: !0,
|
|
2306
2408
|
get: function() {
|
|
2307
2409
|
return _dynamic_tag;
|
|
2308
2410
|
}
|
|
2309
|
-
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports.
|
|
2411
|
+
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._set_scope_reason = _set_scope_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._text_resume = _text_resume, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports._write_guard = _write_guard, exports._write_if = _write_if, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|