marko 6.3.55 → 6.4.0
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 -2
- package/dist/common/accessor.d.ts +3 -0
- package/dist/common/accessor.debug.d.ts +3 -0
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/accessor-prop.d.ts +3 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +3 -0
- package/dist/common/constants/closure-scopes-prop.d.ts +4 -0
- package/dist/common/constants/closure-scopes-prop.debug.d.ts +4 -0
- package/dist/common/types.d.ts +9 -3
- 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-CI0Vojyk.js → dom-BRO5aArp.js} +248 -193
- package/dist/debug/{dom-tl43c2wO.mjs → dom-Btj2QJhk.mjs} +225 -176
- package/dist/debug/dom.js +15 -13
- package/dist/debug/dom.mjs +15 -13
- package/dist/debug/html.js +605 -523
- package/dist/debug/html.mjs +604 -524
- 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 +2 -2
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom/signals.d.ts +1 -1
- package/dist/{dom-4udEPZaj.mjs → dom-B-v8Gw6T.mjs} +122 -92
- package/dist/{dom-C1mr-TA7.js → dom-BSsI9OPC.js} +218 -187
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +59 -56
- package/dist/dom.mjs +35 -33
- package/dist/html/attrs.d.ts +2 -0
- package/dist/html/writer.d.ts +5 -11
- package/dist/html.d.ts +1 -1
- package/dist/html.js +367 -327
- package/dist/html.mjs +366 -327
- package/dist/translator/index.js +866 -748
- package/dist/translator/util/binding-has-prop.d.ts +2 -0
- package/dist/translator/util/entry-builder.d.ts +2 -0
- package/dist/translator/util/generate-uid.d.ts +5 -0
- package/dist/translator/util/optional.d.ts +1 -3
- package/dist/translator/util/references.d.ts +6 -2
- package/dist/translator/util/runtime.d.ts +3 -3
- package/dist/translator/util/sections.d.ts +8 -2
- package/dist/translator/util/serialize-reasons.d.ts +3 -1
- package/dist/translator/util/setup-work.d.ts +5 -0
- package/dist/translator/util/signals.d.ts +5 -7
- package/dist/translator/util/translate-attrs.d.ts +2 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +1 -0
- package/package.json +3 -3
- package/tags-html.d.ts +4 -3
- 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,17 +245,17 @@ 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,
|
|
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, serializeReason) => {
|
|
251
252
|
let shouldResume = serializeReason !== 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
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, serializeReason) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
@@ -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.signal.aborted) throw boundary.signal.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];
|
|
@@ -455,27 +454,44 @@ 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
|
-
|
|
457
|
+
//#region src/common/for.ts
|
|
458
|
+
function forIn(obj, cb) {
|
|
459
|
+
for (let key in obj) cb(key, obj[key]);
|
|
461
460
|
}
|
|
462
|
-
function
|
|
463
|
-
|
|
461
|
+
function forOf(list, cb) {
|
|
462
|
+
if (list) {
|
|
463
|
+
let i = 0;
|
|
464
|
+
for (let item of list) cb(item, i++);
|
|
465
|
+
}
|
|
464
466
|
}
|
|
465
|
-
function
|
|
466
|
-
|
|
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);
|
|
467
470
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
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);
|
|
470
474
|
}
|
|
471
|
-
|
|
472
|
-
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/common/opt.ts
|
|
477
|
+
function forEach(opt, cb) {
|
|
478
|
+
if (opt) {
|
|
479
|
+
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
480
|
+
else cb(opt);
|
|
481
|
+
}
|
|
473
482
|
}
|
|
474
|
-
function
|
|
475
|
-
return
|
|
483
|
+
function push(opt, item) {
|
|
484
|
+
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
476
485
|
}
|
|
477
|
-
function
|
|
478
|
-
|
|
486
|
+
function concat(opt, other) {
|
|
487
|
+
if (!opt) return other;
|
|
488
|
+
if (!other) return opt;
|
|
489
|
+
if (Array.isArray(opt)) {
|
|
490
|
+
if (Array.isArray(other)) for (let item of other) opt.push(item);
|
|
491
|
+
else opt.push(other);
|
|
492
|
+
return opt;
|
|
493
|
+
}
|
|
494
|
+
return Array.isArray(other) ? [opt, ...other] : [opt, other];
|
|
479
495
|
}
|
|
480
496
|
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
481
497
|
var State$1 = class {
|
|
@@ -486,7 +502,7 @@ var State$1 = class {
|
|
|
486
502
|
strs = /* @__PURE__ */ new Map();
|
|
487
503
|
refs = /* @__PURE__ */ new WeakMap();
|
|
488
504
|
pendingAssignments = /* @__PURE__ */ new Set();
|
|
489
|
-
boundary
|
|
505
|
+
boundary;
|
|
490
506
|
channel = void 0;
|
|
491
507
|
channelDeps = null;
|
|
492
508
|
mutated = [];
|
|
@@ -515,6 +531,8 @@ var State$1 = class {
|
|
|
515
531
|
stringifyScopes(flushes, boundary, channel) {
|
|
516
532
|
try {
|
|
517
533
|
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes);
|
|
534
|
+
} catch (err) {
|
|
535
|
+
return abortRender(boundary, err), "";
|
|
518
536
|
} finally {
|
|
519
537
|
this.#state.flushId++, this.#state.buf = [];
|
|
520
538
|
}
|
|
@@ -594,10 +612,12 @@ function writeAssigned(state) {
|
|
|
594
612
|
objectRef && objectRef.scopeId === void 0 && (objectRef.id ? hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")) : (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")));
|
|
595
613
|
} else state.buf.push("void 0");
|
|
596
614
|
let valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
597
|
-
if (mutation.value !== void 0)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
615
|
+
if (mutation.value !== void 0) {
|
|
616
|
+
if (writeProp(state, mutation.value, null, "")) {
|
|
617
|
+
let valueRef = typeof mutation.value == "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
618
|
+
valueRef && !valueRef.id && valueRef.scopeId === void 0 && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
619
|
+
} else state.buf.push("void 0");
|
|
620
|
+
}
|
|
601
621
|
state.buf.push(")");
|
|
602
622
|
}
|
|
603
623
|
state.mutated = remaining;
|
|
@@ -717,7 +737,8 @@ function writeUnknownObject(state, val, ref) {
|
|
|
717
737
|
let proto = Object.getPrototypeOf(val);
|
|
718
738
|
if (proto === objectProto) return writePlainObject(state, val, ref);
|
|
719
739
|
if (proto === arrayProto) return writeArray(state, val, ref);
|
|
720
|
-
|
|
740
|
+
let constructor = proto?.constructor;
|
|
741
|
+
switch (constructor) {
|
|
721
742
|
case void 0: return writeNullObject(state, val, ref);
|
|
722
743
|
case Object: return writePlainObject(state, val, ref);
|
|
723
744
|
case Array: return writeArray(state, val, ref);
|
|
@@ -734,7 +755,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
734
755
|
case ReferenceError:
|
|
735
756
|
case SyntaxError:
|
|
736
757
|
case TypeError:
|
|
737
|
-
case URIError: return writeError(state, val, ref);
|
|
758
|
+
case URIError: return writeError(state, val, constructor.name, ref);
|
|
738
759
|
case AggregateError: return writeAggregateError(state, val, ref);
|
|
739
760
|
case ArrayBuffer: return writeArrayBuffer(state, val);
|
|
740
761
|
case Int8Array:
|
|
@@ -747,7 +768,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
747
768
|
case Float32Array:
|
|
748
769
|
case Float64Array:
|
|
749
770
|
case BigInt64Array:
|
|
750
|
-
case BigUint64Array: return writeTypedArray(state, val, ref);
|
|
771
|
+
case BigUint64Array: return writeTypedArray(state, val, constructor.name, ref);
|
|
751
772
|
case DataView: return writeDataView(state, val, ref);
|
|
752
773
|
case WeakSet: return writeWeakSet(state);
|
|
753
774
|
case WeakMap: return writeWeakMap(state);
|
|
@@ -798,9 +819,7 @@ function writeRegExp(state, val) {
|
|
|
798
819
|
return source.includes("<") ? state.buf.push(`RegExp(${quote(source, 0)}${val.flags ? ",\"" + val.flags + "\"" : ""})`) : state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
799
820
|
}
|
|
800
821
|
function writePromise(state, val, ref) {
|
|
801
|
-
let { boundary, channel } = state;
|
|
802
|
-
if (!boundary) return !1;
|
|
803
|
-
let pId = nextRefAccess(state), handle = newAsyncHandle(state, ref, pId);
|
|
822
|
+
let { boundary, channel } = state, pId = nextRefAccess(state), handle = newAsyncHandle(state, ref, pId);
|
|
804
823
|
return state.buf.push("(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"), val.then((v) => writeAsyncCall(state, boundary, handle, "f", v, channel, pId), (v) => writeAsyncCall(state, boundary, handle, "r", v, channel, pId)), boundary.startAsync(), !0;
|
|
805
824
|
}
|
|
806
825
|
function newAsyncHandle(state, parent, id) {
|
|
@@ -887,12 +906,12 @@ function writeArrayBuffer(state, val) {
|
|
|
887
906
|
} else result = "new ArrayBuffer";
|
|
888
907
|
return state.buf.push(result), !0;
|
|
889
908
|
}
|
|
890
|
-
function writeTypedArray(state, val, ref) {
|
|
909
|
+
function writeTypedArray(state, val, name, ref) {
|
|
891
910
|
if (val.byteOffset || val.byteLength < val.buffer.byteLength || state.refs.has(val.buffer)) {
|
|
892
911
|
if (!canWriteBuffer(state, val.buffer, ref)) return !1;
|
|
893
912
|
let needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
|
|
894
|
-
state.buf.push("new " +
|
|
895
|
-
} else state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null)), state.buf.push("new " +
|
|
913
|
+
state.buf.push("new " + name + "("), writeProp(state, val.buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
|
|
914
|
+
} 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)) + ")"));
|
|
896
915
|
return !0;
|
|
897
916
|
}
|
|
898
917
|
function writeWeakSet(state) {
|
|
@@ -901,8 +920,8 @@ function writeWeakSet(state) {
|
|
|
901
920
|
function writeWeakMap(state) {
|
|
902
921
|
return state.buf.push("new WeakMap"), !0;
|
|
903
922
|
}
|
|
904
|
-
function writeError(state, val, ref) {
|
|
905
|
-
let result = "new " +
|
|
923
|
+
function writeError(state, val, name, ref) {
|
|
924
|
+
let result = "new " + name + "(" + quote(val.message + "", 0);
|
|
906
925
|
if (val.cause !== void 0) {
|
|
907
926
|
let pos = state.buf.push(result + ",{cause:") - 1;
|
|
908
927
|
writeProp(state, val.cause, ref, "cause") ? state.buf.push("})") : state.buf[pos] = state.buf[pos].slice(0, -8) + ")";
|
|
@@ -980,9 +999,8 @@ function writeTemporal(state, val, name) {
|
|
|
980
999
|
return state.buf.push("Temporal." + name + ".from(" + quote(val.toString(), 0) + ")"), !0;
|
|
981
1000
|
}
|
|
982
1001
|
function writeReadableStream(state, val, ref) {
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
let reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1002
|
+
if (val.locked) return !1;
|
|
1003
|
+
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
986
1004
|
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.signal.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
987
1005
|
}, onRejected = (reason) => {
|
|
988
1006
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
@@ -1020,9 +1038,7 @@ function writeGenerator(state, iter, ref) {
|
|
|
1020
1038
|
}
|
|
1021
1039
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1022
1040
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1023
|
-
let { boundary, channel } = state
|
|
1024
|
-
if (!boundary) return !1;
|
|
1025
|
-
let iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1041
|
+
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1026
1042
|
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.signal.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1027
1043
|
}, onRejected = (reason) => {
|
|
1028
1044
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
@@ -1072,6 +1088,10 @@ function trackChannel(state, ref) {
|
|
|
1072
1088
|
}
|
|
1073
1089
|
return !1;
|
|
1074
1090
|
}
|
|
1091
|
+
function abortRender(boundary, err) {
|
|
1092
|
+
for (; boundary.parent;) boundary = boundary.parent;
|
|
1093
|
+
boundary.abort(err);
|
|
1094
|
+
}
|
|
1075
1095
|
function isCircular(parent, ref) {
|
|
1076
1096
|
let cur = parent;
|
|
1077
1097
|
for (; cur;) {
|
|
@@ -1084,16 +1104,17 @@ function toObjectKey(name) {
|
|
|
1084
1104
|
if (name === "") return "\"\"";
|
|
1085
1105
|
if (name === "__proto__") return "[\"__proto__\"]";
|
|
1086
1106
|
let len = name.length, c0 = name.charCodeAt(0);
|
|
1087
|
-
if (c0 >= 48 && c0 <= 57)
|
|
1088
|
-
if (
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
let
|
|
1092
|
-
|
|
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);
|
|
1093
1116
|
}
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
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++) {
|
|
1097
1118
|
let c = name.charCodeAt(i);
|
|
1098
1119
|
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36)) return quote(name, i);
|
|
1099
1120
|
}
|
|
@@ -1186,7 +1207,7 @@ function nextRefAccess(state) {
|
|
|
1186
1207
|
function nextId(state) {
|
|
1187
1208
|
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = state.ids++, r = c[n % 53];
|
|
1188
1209
|
for (n = n / 53 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1189
|
-
return r;
|
|
1210
|
+
return r === "name" ? nextId(state) : r;
|
|
1190
1211
|
}
|
|
1191
1212
|
function hasSymbolIterator(value) {
|
|
1192
1213
|
return Symbol.iterator in value;
|
|
@@ -1224,42 +1245,161 @@ function patchIteratorNext(proto) {
|
|
|
1224
1245
|
}, proto.next[kTouchedIterator] = !0;
|
|
1225
1246
|
}
|
|
1226
1247
|
//#endregion
|
|
1227
|
-
//#region src/
|
|
1228
|
-
function
|
|
1229
|
-
|
|
1248
|
+
//#region src/html/attrs.ts
|
|
1249
|
+
function _attr_class(value) {
|
|
1250
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassObject));
|
|
1230
1251
|
}
|
|
1231
|
-
function
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
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;
|
|
1235
1289
|
}
|
|
1236
1290
|
}
|
|
1237
|
-
function
|
|
1238
|
-
let
|
|
1239
|
-
|
|
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" : "";
|
|
1240
1294
|
}
|
|
1241
|
-
function
|
|
1242
|
-
|
|
1243
|
-
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;
|
|
1244
1297
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
if (opt) if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
1249
|
-
else cb(opt);
|
|
1298
|
+
function _style_html(decls) {
|
|
1299
|
+
let id = _id();
|
|
1300
|
+
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1250
1301
|
}
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1302
|
+
function _attr(name, value) {
|
|
1303
|
+
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1253
1304
|
}
|
|
1254
|
-
function
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
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/>"'=]/);
|
|
1261
1329
|
}
|
|
1262
|
-
|
|
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, serializeReason) {
|
|
1345
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
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, serializeReason) {
|
|
1356
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
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 + "" : "";
|
|
1263
1403
|
}
|
|
1264
1404
|
//#endregion
|
|
1265
1405
|
//#region src/html/for.ts
|
|
@@ -1325,14 +1465,20 @@ function withContext(key, value, cb, cbValue) {
|
|
|
1325
1465
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1326
1466
|
}
|
|
1327
1467
|
}
|
|
1468
|
+
function captureContext(chunk) {
|
|
1469
|
+
chunk.context?.[kPendingContexts] && (chunk.context = {
|
|
1470
|
+
...chunk.context,
|
|
1471
|
+
[kPendingContexts]: 0
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1328
1474
|
function isInResumedBranch() {
|
|
1329
1475
|
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1330
1476
|
}
|
|
1331
1477
|
function withBranchId(branchId, cb, cbValue) {
|
|
1332
1478
|
return withContext(kBranchId, branchId, cb, cbValue);
|
|
1333
1479
|
}
|
|
1334
|
-
function withIsAsync(cb, value) {
|
|
1335
|
-
return withContext(kIsAsync,
|
|
1480
|
+
function withIsAsync(async, cb, value) {
|
|
1481
|
+
return withContext(kIsAsync, async, cb, value);
|
|
1336
1482
|
}
|
|
1337
1483
|
function _html(html) {
|
|
1338
1484
|
$chunk.writeHTML(html);
|
|
@@ -1469,11 +1615,12 @@ function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
|
1469
1615
|
}
|
|
1470
1616
|
function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, branchIds) {
|
|
1471
1617
|
let endTag = parentEndTag || "";
|
|
1472
|
-
if (serializeMarker !== 0)
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1618
|
+
if (serializeMarker !== 0) {
|
|
1619
|
+
if (!parentEndTag || serializeStateful !== 0) {
|
|
1620
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1621
|
+
$chunk.writeHTML(mark + endTag);
|
|
1622
|
+
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1623
|
+
} else $chunk.writeHTML(endTag);
|
|
1477
1624
|
}
|
|
1478
1625
|
function _existing_scope(scopeId) {
|
|
1479
1626
|
return writeScope(scopeId, {});
|
|
@@ -1527,26 +1674,24 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1527
1674
|
} else content(promise);
|
|
1528
1675
|
return;
|
|
1529
1676
|
}
|
|
1530
|
-
let chunk = $chunk, { boundary } = chunk;
|
|
1531
|
-
chunk.
|
|
1532
|
-
...chunk.context,
|
|
1533
|
-
[kPendingContexts]: 0
|
|
1534
|
-
}), boundary.startAsync(), promise.then((value) => {
|
|
1677
|
+
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1678
|
+
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1535
1679
|
chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(() => {
|
|
1536
1680
|
if (resumeMarker) {
|
|
1537
1681
|
let branchId = _peek_scope_id();
|
|
1538
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync(content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1539
|
-
} else
|
|
1682
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1683
|
+
} else {
|
|
1684
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1685
|
+
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;
|
|
1686
|
+
}
|
|
1540
1687
|
}), boundary.endAsync()));
|
|
1541
1688
|
}, (err) => {
|
|
1542
1689
|
chunk.async = !1, boundary.abort(err);
|
|
1543
1690
|
});
|
|
1544
1691
|
}
|
|
1545
|
-
function _try(scopeId, accessor, content,
|
|
1546
|
-
let
|
|
1547
|
-
|
|
1548
|
-
let rendered = chunk !== $chunk || boundary.resumeWrites !== resumeWrites;
|
|
1549
|
-
applyBranchStart(chunk, beforeBranch, rendered), rendered && (renderersAtSettle || writeTryRenderers(branchId, catchContent, placeholderContent), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
1692
|
+
function _try(scopeId, accessor, content, placeholderContent, catchContent, placeholderId, catchId) {
|
|
1693
|
+
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;
|
|
1694
|
+
applyBranchStart(chunk, beforeBranch, rendered), rendered && (renderersWritten || renderers(), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
1550
1695
|
}
|
|
1551
1696
|
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
1552
1697
|
let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
|
|
@@ -1554,7 +1699,7 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1554
1699
|
chunk.append(body);
|
|
1555
1700
|
return;
|
|
1556
1701
|
}
|
|
1557
|
-
chunk.next = $chunk = chunk.fork(boundary, chunk.next), chunk.placeholder = {
|
|
1702
|
+
chunk.next = $chunk = chunk.fork(boundary, chunk.next), captureContext(chunk), chunk.placeholder = {
|
|
1558
1703
|
body,
|
|
1559
1704
|
render: placeholder,
|
|
1560
1705
|
branchId,
|
|
@@ -1562,29 +1707,31 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1562
1707
|
placeholderBranchId
|
|
1563
1708
|
};
|
|
1564
1709
|
}
|
|
1565
|
-
function tryBoundary(content, catchContent,
|
|
1566
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, boundary.signal, boundary), body = chunk.fork(catchBoundary, null), bodyEnd =
|
|
1567
|
-
if (catchBoundary.signal.aborted) return catchContent
|
|
1710
|
+
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1711
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, boundary.signal, boundary), body = chunk.fork(catchBoundary, null), bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
1712
|
+
if (catchBoundary.signal.aborted) return catchContent ? catchContent(catchBoundary.signal.reason) : boundary.abort(catchBoundary.signal.reason), !0;
|
|
1568
1713
|
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1569
1714
|
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1570
1715
|
chunk.next = body, boundary.startAsync();
|
|
1571
|
-
let reorderId = catchContent
|
|
1572
|
-
return reorderId && (chunk.writeHTML(state.mark("!^", reorderId)), bodyEnd.writeHTML(endMarker)), catchBoundary.onNext = () => {
|
|
1573
|
-
if (!boundary.signal.aborted)
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1716
|
+
let reorderId = catchContent ? state.nextReorderId() : "", endMarker = reorderId && state.mark("!", reorderId);
|
|
1717
|
+
return reorderId && (chunk.writeHTML(state.mark("!^", reorderId)), bodyEnd.writeHTML(endMarker), captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1718
|
+
if (!boundary.signal.aborted) {
|
|
1719
|
+
if (catchBoundary.signal.aborted) {
|
|
1720
|
+
if (!reorderId) {
|
|
1721
|
+
boundary.abort(catchBoundary.signal.reason);
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
if (!bodyEnd.consumed) {
|
|
1725
|
+
let cur = body, writeMarker = !0;
|
|
1726
|
+
do {
|
|
1727
|
+
let next = cur.next;
|
|
1728
|
+
cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.needsWalk = !0, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholder = cur.reorderId = cur.deferredReady = null), cur = next;
|
|
1729
|
+
} while (cur !== bodyNext);
|
|
1730
|
+
}
|
|
1731
|
+
let catchChunk = chunk.fork(boundary, null);
|
|
1732
|
+
catchChunk.reorderId = reorderId, catchChunk.render(catchContent, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
|
|
1733
|
+
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), boundary.endAsync());
|
|
1734
|
+
}
|
|
1588
1735
|
}, renderersAtSettle;
|
|
1589
1736
|
}
|
|
1590
1737
|
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
@@ -1593,8 +1740,12 @@ function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
|
1593
1740
|
Q: placeholderContent
|
|
1594
1741
|
});
|
|
1595
1742
|
}
|
|
1596
|
-
function countResumeWrite(
|
|
1597
|
-
for (; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
1743
|
+
function countResumeWrite(chunk) {
|
|
1744
|
+
for (let boundary = chunk.boundary; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
1745
|
+
for (let async = getAsyncContent(chunk); async && !async.resumed; async = async.parent) async.resumed = !0, async.end?.writeHTML(async.visit);
|
|
1746
|
+
}
|
|
1747
|
+
function getAsyncContent(chunk) {
|
|
1748
|
+
return chunk.context?.[kIsAsync];
|
|
1598
1749
|
}
|
|
1599
1750
|
var State = class {
|
|
1600
1751
|
tagId = 1;
|
|
@@ -1668,9 +1819,10 @@ var State = class {
|
|
|
1668
1819
|
constructor(state, signal, parent) {
|
|
1669
1820
|
super(), this.state = state, this.parent = parent, this.signal.addEventListener("abort", () => {
|
|
1670
1821
|
this.count = 0, this.state = new State(this.state.$global), this.onNext();
|
|
1671
|
-
}), signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort",
|
|
1672
|
-
|
|
1673
|
-
|
|
1822
|
+
}), signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort", this));
|
|
1823
|
+
}
|
|
1824
|
+
handleEvent(event) {
|
|
1825
|
+
this.abort(event.target.reason);
|
|
1674
1826
|
}
|
|
1675
1827
|
flush() {
|
|
1676
1828
|
return this.signal.aborted || flushSerializer(this, this.state), this.count ? 1 : this.signal.aborted ? 2 : 0;
|
|
@@ -1679,7 +1831,7 @@ var State = class {
|
|
|
1679
1831
|
this.signal.aborted || this.count++;
|
|
1680
1832
|
}
|
|
1681
1833
|
endAsync() {
|
|
1682
|
-
|
|
1834
|
+
this.signal.aborted || (this.count--, this.onNext());
|
|
1683
1835
|
}
|
|
1684
1836
|
}, Chunk = class Chunk {
|
|
1685
1837
|
html = "";
|
|
@@ -1706,7 +1858,7 @@ var State = class {
|
|
|
1706
1858
|
this.html += html;
|
|
1707
1859
|
}
|
|
1708
1860
|
writeEffect(scopeId, registryId) {
|
|
1709
|
-
countResumeWrite(this
|
|
1861
|
+
countResumeWrite(this), this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1710
1862
|
}
|
|
1711
1863
|
writeScript(script) {
|
|
1712
1864
|
this.scripts = concatScripts(this.scripts, script);
|
|
@@ -1727,14 +1879,16 @@ var State = class {
|
|
|
1727
1879
|
flushPlaceholder() {
|
|
1728
1880
|
let { placeholder } = this;
|
|
1729
1881
|
if (placeholder) {
|
|
1882
|
+
this.placeholder = null;
|
|
1730
1883
|
let body = placeholder.body.consume();
|
|
1731
1884
|
if (body.async) {
|
|
1732
1885
|
let { state } = this.boundary, { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
1733
1886
|
this.writeHTML(state.mark("!^", reorderId));
|
|
1734
|
-
let { effects } = this, beforeBranch = deferBranchStart(this)
|
|
1735
|
-
|
|
1887
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1888
|
+
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.signal.aborted) return;
|
|
1889
|
+
let stateful = this.effects !== effects;
|
|
1890
|
+
applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), body.writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
1736
1891
|
} else body.next = this.next, this.next = body;
|
|
1737
|
-
this.placeholder = null;
|
|
1738
1892
|
}
|
|
1739
1893
|
}
|
|
1740
1894
|
consume() {
|
|
@@ -1753,10 +1907,10 @@ var State = class {
|
|
|
1753
1907
|
$chunk = prev;
|
|
1754
1908
|
}
|
|
1755
1909
|
}
|
|
1756
|
-
flushReadyScripts(reservations, holdEffects) {
|
|
1757
|
-
let {
|
|
1910
|
+
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1911
|
+
let { serializeState } = this, { readyId } = serializeState, scripts = "";
|
|
1758
1912
|
if (forEach(this.takeDeferredReady(), (chunk) => {
|
|
1759
|
-
scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk));
|
|
1913
|
+
scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk));
|
|
1760
1914
|
}), readyId && !this.async) {
|
|
1761
1915
|
let { state } = boundary;
|
|
1762
1916
|
flushSerializer(boundary, serializeState);
|
|
@@ -1773,11 +1927,11 @@ var State = class {
|
|
|
1773
1927
|
}
|
|
1774
1928
|
return scripts;
|
|
1775
1929
|
}
|
|
1776
|
-
flushScript() {
|
|
1777
|
-
let {
|
|
1930
|
+
flushScript(boundary) {
|
|
1931
|
+
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1778
1932
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1779
|
-
let readyResumeScripts = this.flushReadyScripts(void 0, this.async);
|
|
1780
|
-
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
1933
|
+
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1934
|
+
for (let channel; !boundary.signal.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1781
1935
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1782
1936
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1783
1937
|
}
|
|
@@ -1801,7 +1955,7 @@ var State = class {
|
|
|
1801
1955
|
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1802
1956
|
for (reorderedChunk.reorderId = null;;) {
|
|
1803
1957
|
cur.flushPlaceholder(), cur.deferOwnReady();
|
|
1804
|
-
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(readyReservations, this.async);
|
|
1958
|
+
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
1805
1959
|
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;
|
|
1806
1960
|
else break;
|
|
1807
1961
|
}
|
|
@@ -1813,9 +1967,9 @@ var State = class {
|
|
|
1813
1967
|
}
|
|
1814
1968
|
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;
|
|
1815
1969
|
}
|
|
1816
|
-
flushHTML() {
|
|
1817
|
-
let {
|
|
1818
|
-
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
1970
|
+
flushHTML(boundary) {
|
|
1971
|
+
let { state } = boundary;
|
|
1972
|
+
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript(boundary);
|
|
1819
1973
|
let { html, scripts } = this;
|
|
1820
1974
|
return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
|
|
1821
1975
|
}
|
|
@@ -1906,159 +2060,30 @@ function flushTickQueue() {
|
|
|
1906
2060
|
}
|
|
1907
2061
|
}
|
|
1908
2062
|
//#endregion
|
|
1909
|
-
//#region src/html/
|
|
1910
|
-
function
|
|
1911
|
-
return
|
|
1912
|
-
}
|
|
1913
|
-
function _attr_style(value) {
|
|
1914
|
-
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1915
|
-
}
|
|
1916
|
-
function _attr_option_value(value) {
|
|
1917
|
-
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1918
|
-
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1919
|
-
}
|
|
1920
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1921
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value ?? "", content);
|
|
1922
|
-
}
|
|
1923
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1924
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _textarea_value(value);
|
|
1925
|
-
}
|
|
1926
|
-
function _textarea_value(value) {
|
|
1927
|
-
let escaped = _escape(normalizeStrAttrValue(value));
|
|
1928
|
-
return escaped[0] === "\n" ? "\n" + escaped : escaped;
|
|
1929
|
-
}
|
|
1930
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1931
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1932
|
-
}
|
|
1933
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1934
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1935
|
-
}
|
|
1936
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1937
|
-
let valueAttr = _attr("value", value);
|
|
1938
|
-
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1939
|
-
}
|
|
1940
|
-
function getCheckedValueRef(checkedValue) {
|
|
1941
|
-
if (Array.isArray(checkedValue)) {
|
|
1942
|
-
let ref = checkedValuesRefs.get(checkedValue);
|
|
1943
|
-
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1947
|
-
let normalizedOpen = isNotVoid(open);
|
|
1948
|
-
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1949
|
-
}
|
|
1950
|
-
function _attr_nonce() {
|
|
1951
|
-
return getChunk().boundary.state.nonceAttr;
|
|
1952
|
-
}
|
|
1953
|
-
function _style_html(decls) {
|
|
1954
|
-
let id = _id();
|
|
1955
|
-
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1956
|
-
}
|
|
1957
|
-
function _attr(name, value) {
|
|
1958
|
-
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1959
|
-
}
|
|
1960
|
-
function _attr_and(name, value, attr) {
|
|
1961
|
-
return value ? attr : _attr(name, value);
|
|
1962
|
-
}
|
|
1963
|
-
function _attr_or(name, value, attr) {
|
|
1964
|
-
return value ? _attr(name, value) : attr;
|
|
1965
|
-
}
|
|
1966
|
-
function _attr_nullish(name, value, attr) {
|
|
1967
|
-
return value == null ? attr : _attr(name, value);
|
|
1968
|
-
}
|
|
1969
|
-
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1970
|
-
let result = "", skip = /[\s/>"'=]/, events;
|
|
1971
|
-
switch (data && tagName) {
|
|
1972
|
-
case "input":
|
|
1973
|
-
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/>"'=]/);
|
|
1974
|
-
break;
|
|
1975
|
-
case "select":
|
|
1976
|
-
case "textarea":
|
|
1977
|
-
("value" in data || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1978
|
-
break;
|
|
1979
|
-
case "option":
|
|
1980
|
-
"value" in data && (result += _attr_option_value(data.value), skip = /^value$|[\s/>"'=]/);
|
|
1981
|
-
break;
|
|
1982
|
-
case "details":
|
|
1983
|
-
case "dialog":
|
|
1984
|
-
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1985
|
-
break;
|
|
1986
|
-
}
|
|
1987
|
-
for (let name in data) {
|
|
1988
|
-
let value = data[name];
|
|
1989
|
-
switch (name) {
|
|
1990
|
-
case "class":
|
|
1991
|
-
result += _attr_class(value);
|
|
1992
|
-
break;
|
|
1993
|
-
case "style":
|
|
1994
|
-
result += _attr_style(value);
|
|
1995
|
-
break;
|
|
1996
|
-
default:
|
|
1997
|
-
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));
|
|
1998
|
-
break;
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
return result;
|
|
2002
|
-
}
|
|
2003
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
2004
|
-
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
2005
|
-
}
|
|
2006
|
-
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
2007
|
-
let partial = {};
|
|
2008
|
-
for (let name in data) {
|
|
2009
|
-
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
2010
|
-
skip[key] || (partial[key] = data[name]);
|
|
2011
|
-
}
|
|
2012
|
-
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
2013
|
-
}
|
|
2014
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
2015
|
-
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
2016
|
-
}
|
|
2017
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2018
|
-
writeScope(scopeId, serializeType ? {
|
|
2019
|
-
["F" + nodeAccessor]: type,
|
|
2020
|
-
["G" + nodeAccessor]: value,
|
|
2021
|
-
["E" + nodeAccessor]: valueChange
|
|
2022
|
-
} : {
|
|
2023
|
-
["G" + nodeAccessor]: value,
|
|
2024
|
-
["E" + nodeAccessor]: valueChange
|
|
2025
|
-
});
|
|
2026
|
-
}
|
|
2027
|
-
function stringAttr(name, value) {
|
|
2028
|
-
return value && " " + name + attrAssignment(value);
|
|
2029
|
-
}
|
|
2030
|
-
function nonVoidAttr(name, value) {
|
|
2031
|
-
switch (typeof value) {
|
|
2032
|
-
case "string": return " " + name + attrAssignment(value);
|
|
2033
|
-
case "boolean": return " " + name;
|
|
2034
|
-
case "number": return " " + name + "=" + value;
|
|
2035
|
-
}
|
|
2036
|
-
return " " + name + attrAssignment(value + "");
|
|
2063
|
+
//#region src/html/content.ts
|
|
2064
|
+
function _to_text(val) {
|
|
2065
|
+
return val || val === 0 ? val + "" : "";
|
|
2037
2066
|
}
|
|
2038
|
-
function
|
|
2039
|
-
return
|
|
2067
|
+
function _unescaped(val) {
|
|
2068
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
2040
2069
|
}
|
|
2041
|
-
function
|
|
2042
|
-
return
|
|
2070
|
+
function _escape(val) {
|
|
2071
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
2043
2072
|
}
|
|
2044
|
-
function
|
|
2045
|
-
return
|
|
2073
|
+
function _escape_script(val) {
|
|
2074
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
2046
2075
|
}
|
|
2047
|
-
function
|
|
2048
|
-
return
|
|
2076
|
+
function _escape_style(val) {
|
|
2077
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
2049
2078
|
}
|
|
2050
|
-
function
|
|
2051
|
-
return
|
|
2079
|
+
function _escape_style_value(val) {
|
|
2080
|
+
return val || val === 0 ? escapeStyleValue(val + "") : "";
|
|
2052
2081
|
}
|
|
2053
|
-
function
|
|
2054
|
-
|
|
2055
|
-
if (Array.isArray(a)) {
|
|
2056
|
-
for (let item of a) if (normalizeStrAttrValue(item) === value) return !0;
|
|
2057
|
-
} else if (normalizeStrAttrValue(a) === value) return !0;
|
|
2058
|
-
return !1;
|
|
2082
|
+
function escapeCommentStr(str) {
|
|
2083
|
+
return unsafeCommentReg.test(str) && (str = str.replace(unsafeCommentReg, ">")), str.startsWith(getState().commentPrefix) ? "&#" + str.charCodeAt(0) + ";" + str.slice(1) : str;
|
|
2059
2084
|
}
|
|
2060
|
-
function
|
|
2061
|
-
return
|
|
2085
|
+
function _escape_comment(val) {
|
|
2086
|
+
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
2062
2087
|
}
|
|
2063
2088
|
//#endregion
|
|
2064
2089
|
//#region src/html/dynamic-tag.ts
|
|
@@ -2132,11 +2157,11 @@ var ServerRendered = class {
|
|
|
2132
2157
|
done: !1
|
|
2133
2158
|
};
|
|
2134
2159
|
return value = "", Promise.resolve(result);
|
|
2135
|
-
}
|
|
2160
|
+
}
|
|
2161
|
+
return done ? Promise.resolve({
|
|
2136
2162
|
value: "",
|
|
2137
2163
|
done
|
|
2138
|
-
});
|
|
2139
|
-
else return new Promise(exec);
|
|
2164
|
+
}) : new Promise(exec);
|
|
2140
2165
|
},
|
|
2141
2166
|
throw(error) {
|
|
2142
2167
|
return done || aborted || boundary?.abort(error), Promise.resolve({
|
|
@@ -2195,49 +2220,64 @@ var ServerRendered = class {
|
|
|
2195
2220
|
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
2196
2221
|
let head = this.#head;
|
|
2197
2222
|
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error(CONSUMED_RESULT_MESSAGE));
|
|
2198
|
-
let { boundary } = head;
|
|
2223
|
+
let { boundary } = head, html = "";
|
|
2199
2224
|
(boundary.onNext = () => {
|
|
2200
2225
|
switch (!boundary.count && boundary.flush()) {
|
|
2201
2226
|
case 2:
|
|
2202
|
-
boundary
|
|
2203
|
-
break;
|
|
2204
|
-
case 0: {
|
|
2205
|
-
let consumed = head.consume();
|
|
2206
|
-
boundary.signal.aborted || resolve(consumed.flushHTML());
|
|
2227
|
+
settle(boundary), reject(boundary.signal.reason);
|
|
2207
2228
|
break;
|
|
2208
|
-
|
|
2229
|
+
case 0:
|
|
2230
|
+
if (head = head.consume(), boundary.signal.aborted) break;
|
|
2231
|
+
html += head.flushHTML(boundary), boundary.count || boundary.signal.aborted || (settle(boundary), resolve(html));
|
|
2209
2232
|
}
|
|
2210
2233
|
})();
|
|
2211
2234
|
});
|
|
2212
2235
|
}
|
|
2213
2236
|
#read(onWrite, onAbort, onClose) {
|
|
2214
|
-
let tick = !0, head = this.#head;
|
|
2237
|
+
let tick = !0, flushing = !1, again = !1, head = this.#head;
|
|
2215
2238
|
if (this.#head = null, !head) {
|
|
2216
2239
|
onAbort(/* @__PURE__ */ Error(CONSUMED_RESULT_MESSAGE));
|
|
2217
2240
|
return;
|
|
2218
2241
|
}
|
|
2219
2242
|
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2243
|
+
if (flushing) {
|
|
2244
|
+
again = !0;
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2247
|
+
flushing = !0;
|
|
2248
|
+
do {
|
|
2249
|
+
again = !1;
|
|
2250
|
+
let status = boundary.flush();
|
|
2251
|
+
if (status === 2) {
|
|
2252
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.signal.reason);
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
if (write || status === 0) {
|
|
2256
|
+
if (head = head.consume(), boundary.signal.aborted) continue;
|
|
2257
|
+
let html = head.flushHTML(boundary);
|
|
2258
|
+
if (boundary.signal.aborted) continue;
|
|
2259
|
+
if (html && onWrite(html), !boundary.count) {
|
|
2260
|
+
tick || offTick(onNext), settle(boundary), onClose();
|
|
2261
|
+
return;
|
|
2262
|
+
}
|
|
2263
|
+
write && (tick = !0);
|
|
2264
|
+
} else tick && (tick = !1, queueTick(onNext));
|
|
2265
|
+
} while (again);
|
|
2266
|
+
flushing = !1;
|
|
2227
2267
|
};
|
|
2228
2268
|
return onNext(), boundary;
|
|
2229
2269
|
}
|
|
2230
2270
|
toString() {
|
|
2231
2271
|
let head = this.#head;
|
|
2232
2272
|
if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
|
|
2233
|
-
let { boundary } = head;
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
case 1: throw Error("Cannot consume asynchronous render with 'toString'");
|
|
2237
|
-
}
|
|
2238
|
-
return head.consume().flushHTML();
|
|
2273
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume().flushHTML(boundary) : "";
|
|
2274
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.signal.aborted) throw boundary.signal.reason;
|
|
2275
|
+
return html;
|
|
2239
2276
|
}
|
|
2240
2277
|
};
|
|
2278
|
+
function settle(boundary) {
|
|
2279
|
+
boundary.onNext = NOOP$1, boundary.state.$global.signal?.removeEventListener("abort", boundary);
|
|
2280
|
+
}
|
|
2241
2281
|
function NOOP$1() {}
|
|
2242
2282
|
//#endregion
|
|
2243
2283
|
//#region src/html/assets.ts
|
|
@@ -2250,7 +2290,7 @@ function withLoadAssets(renderer, assetId, triggers) {
|
|
|
2250
2290
|
function withPageAssets(template, runtime, assetId, runtimeId) {
|
|
2251
2291
|
return assetFlush = runtime, Object.assign((input) => {
|
|
2252
2292
|
let g = $global();
|
|
2253
|
-
return runtimeId && (g.runtimeId = runtimeId), addAsset(g, assetId), g.__flush__ ? (_html(flush(g, "")), writeWaitReady(assetId, template, input)) : (g.__flush__ = flush, template(input));
|
|
2293
|
+
return runtimeId && (g[kAssets] || (g.runtimeId = runtimeId)), addAsset(g, assetId), g.__flush__ ? (_html(flush(g, "")), writeWaitReady(assetId, template, input)) : (g.__flush__ = flush, template(input));
|
|
2254
2294
|
}, template);
|
|
2255
2295
|
}
|
|
2256
2296
|
function _flush_head() {
|
|
@@ -2306,7 +2346,7 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2306
2346
|
pending.length = 0;
|
|
2307
2347
|
}
|
|
2308
2348
|
function NOOP() {}
|
|
2309
|
-
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", {
|
|
2349
|
+
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", {
|
|
2310
2350
|
enumerable: !0,
|
|
2311
2351
|
get: function() {
|
|
2312
2352
|
return _dynamic_tag;
|