marko 6.3.33 → 6.3.34
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 +37 -33
- package/dist/common/errors.d.ts +1 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/{dom-CiFITSPN.js → dom-Bj58jt8y.js} +55 -30
- package/dist/debug/{dom-BJ93mcSe.mjs → dom-klf8Ec_o.mjs} +55 -30
- package/dist/debug/dom.js +3 -1
- package/dist/debug/dom.mjs +3 -1
- package/dist/debug/html.js +119 -79
- package/dist/debug/html.mjs +119 -79
- package/dist/dom/catch.feat.js +1 -1
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +3 -1
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/{dom-Cj4HQ7T_.mjs → dom-6hBvZW7X.mjs} +27 -21
- package/dist/{dom-CI-06TZb.js → dom-B-XpL2_H.js} +27 -21
- package/dist/dom.js +3 -1
- package/dist/dom.mjs +3 -1
- package/dist/html/compat.d.ts +4 -2
- package/dist/html.js +73 -54
- package/dist/html.mjs +73 -54
- package/dist/translator/core/client.d.ts +1 -2
- package/dist/translator/core/server.d.ts +1 -2
- package/dist/translator/core/static.d.ts +1 -2
- package/dist/translator/index.js +377 -244
- package/dist/translator/util/constants/binding-type.d.ts +1 -0
- package/dist/translator/util/references.d.ts +8 -1
- package/dist/translator/util/serialize-reasons.d.ts +4 -4
- package/dist/translator/util/signals.d.ts +3 -0
- package/dist/translator/util/statement-tag.d.ts +2 -0
- package/dist/translator/visitors/program/index.d.ts +0 -1
- package/package.json +5 -4
- package/tags/html-comment.d.marko +2 -0
- package/tags/html-script.d.marko +2 -0
- package/tags/html-style.d.marko +2 -0
- package/tags/let.d.marko +2 -2
- package/tags/show.d.marko +6 -0
- package/tags/try.d.marko +1 -1
- package/tags-html.d.ts +6 -1
- /package/dist/translator/util/{get-accessor-char.d.ts → get-accessor-enums.d.ts} +0 -0
package/dist/html.js
CHANGED
|
@@ -247,7 +247,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
247
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
248
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
249
249
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
250
|
-
}, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
250
|
+
}, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, 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, 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
251
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
252
252
|
if (typeof renderer == "string") {
|
|
253
253
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
@@ -293,6 +293,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
293
293
|
peekNextScopeId: _peek_scope_id,
|
|
294
294
|
isInResumedBranch,
|
|
295
295
|
withChunk,
|
|
296
|
+
getChunk,
|
|
296
297
|
ensureState($global) {
|
|
297
298
|
let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
298
299
|
return state || ($global.runtimeId ||= "M", $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_", $global[K_TAGS_API_STATE] = state = new State($global)), state;
|
|
@@ -326,10 +327,18 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
326
327
|
return compatRegistered;
|
|
327
328
|
};
|
|
328
329
|
},
|
|
329
|
-
|
|
330
|
-
let state = this.ensureState($global)
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
createChunk($global) {
|
|
331
|
+
let state = this.ensureState($global);
|
|
332
|
+
return new Chunk(new Boundary(state), null, null, state);
|
|
333
|
+
},
|
|
334
|
+
flushScript($global, chunk) {
|
|
335
|
+
chunk ||= this.createChunk($global);
|
|
336
|
+
let { boundary } = chunk;
|
|
337
|
+
switch (boundary.flush()) {
|
|
338
|
+
case 2: throw boundary.signal.reason;
|
|
339
|
+
case 1: throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
340
|
+
}
|
|
341
|
+
return chunk.flushScript().scripts;
|
|
333
342
|
},
|
|
334
343
|
render(renderer, willRerender, classAPIOut, component, input, completeChunks, registerChildScope) {
|
|
335
344
|
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state), head = new Chunk(boundary, null, getChunk()?.context ?? null, state), normalizedInput = input;
|
|
@@ -450,28 +459,28 @@ function _escape_comment(val) {
|
|
|
450
459
|
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
451
460
|
var State$1 = class {
|
|
452
461
|
ids = 0;
|
|
453
|
-
|
|
462
|
+
flushId = 0;
|
|
454
463
|
wroteUndefined = !1;
|
|
455
464
|
buf = [];
|
|
456
465
|
strs = /* @__PURE__ */ new Map();
|
|
457
466
|
refs = /* @__PURE__ */ new WeakMap();
|
|
458
|
-
|
|
467
|
+
pendingAssignments = /* @__PURE__ */ new Set();
|
|
459
468
|
boundary = void 0;
|
|
460
469
|
channel = void 0;
|
|
461
470
|
channelDeps = null;
|
|
462
471
|
mutated = [];
|
|
463
472
|
}, Reference = class {
|
|
464
|
-
|
|
473
|
+
assignments = null;
|
|
465
474
|
calls = null;
|
|
466
475
|
scopeId = void 0;
|
|
467
476
|
channel = void 0;
|
|
468
477
|
parent;
|
|
469
478
|
accessor;
|
|
470
|
-
|
|
479
|
+
flushId;
|
|
471
480
|
pos;
|
|
472
481
|
id;
|
|
473
|
-
constructor(parent, accessor,
|
|
474
|
-
this.parent = parent, this.accessor = accessor, this.
|
|
482
|
+
constructor(parent, accessor, flushId, pos = null, id = null) {
|
|
483
|
+
this.parent = parent, this.accessor = accessor, this.flushId = flushId, this.pos = pos, this.id = id;
|
|
475
484
|
}
|
|
476
485
|
}, Serializer = class {
|
|
477
486
|
#state = new State$1();
|
|
@@ -485,7 +494,7 @@ var State$1 = class {
|
|
|
485
494
|
try {
|
|
486
495
|
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes);
|
|
487
496
|
} finally {
|
|
488
|
-
this.#state.
|
|
497
|
+
this.#state.flushId++, this.#state.buf = [];
|
|
489
498
|
}
|
|
490
499
|
}
|
|
491
500
|
written(val) {
|
|
@@ -526,20 +535,20 @@ function writeScopesRoot(state, flushes) {
|
|
|
526
535
|
}
|
|
527
536
|
nextSlotId !== -1 && buf.push("]");
|
|
528
537
|
let extras = "";
|
|
529
|
-
(state.
|
|
538
|
+
(state.pendingAssignments.size || hasChannelMutations(state)) && (extras = ",0)", fillIndex !== -1 && (buf[fillIndex] = "_(" + buf[fillIndex], buf.push(")")), writeAssigned(state));
|
|
530
539
|
let result = extras && "(";
|
|
531
540
|
for (let chunk of buf) result += chunk;
|
|
532
541
|
return result += extras, result ? state.wroteUndefined ? (state.wroteUndefined = !1, "(_,$)=>" + result) : "_=>" + result : "";
|
|
533
542
|
}
|
|
534
543
|
function writeAssigned(state) {
|
|
535
544
|
let sep = state.buf.length ? "," : "";
|
|
536
|
-
if (state.
|
|
537
|
-
let
|
|
538
|
-
state.
|
|
545
|
+
if (state.pendingAssignments.size) {
|
|
546
|
+
let pending = state.pendingAssignments;
|
|
547
|
+
state.pendingAssignments = /* @__PURE__ */ new Set();
|
|
539
548
|
let buf = "", hasCalls = !1;
|
|
540
|
-
for (let ref of
|
|
549
|
+
for (let ref of pending) ref.assignments && (buf += sep + assignmentsToString(ref.assignments, ref.id), ref.assignments = null, sep = ","), hasCalls ||= ref.calls !== null;
|
|
541
550
|
if (buf && state.buf.push(buf), hasCalls) {
|
|
542
|
-
for (let ref of
|
|
551
|
+
for (let ref of pending) if (ref.calls) {
|
|
543
552
|
for (let { method, args } of ref.calls) {
|
|
544
553
|
state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
|
|
545
554
|
for (let a = 0; a < args.length; a++) a && state.buf.push(","), writeCallArg(state, args[a]);
|
|
@@ -570,10 +579,14 @@ function writeAssigned(state) {
|
|
|
570
579
|
}
|
|
571
580
|
state.mutated = remaining;
|
|
572
581
|
}
|
|
573
|
-
state.
|
|
582
|
+
state.pendingAssignments.size && writeAssigned(state);
|
|
574
583
|
}
|
|
575
584
|
function writeCallArg(state, val) {
|
|
576
|
-
val === void 0
|
|
585
|
+
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
586
|
+
else if (writeProp(state, val, null, "")) {
|
|
587
|
+
let ref = state.refs.get(val) || state.strs.get(val);
|
|
588
|
+
ref && ref.id === null && assignId(state, ref);
|
|
589
|
+
} else state.buf.push("void 0");
|
|
577
590
|
}
|
|
578
591
|
function hasChannelMutations(state) {
|
|
579
592
|
return hasMatchingMutations(state.mutated, state.channel?.readyId);
|
|
@@ -599,22 +612,22 @@ function writeProp(state, val, parent, accessor) {
|
|
|
599
612
|
}
|
|
600
613
|
function writeReferenceOr(state, write, val, parent, accessor) {
|
|
601
614
|
let ref = state.refs.get(val);
|
|
602
|
-
if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.
|
|
615
|
+
if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (state.buf.push(ensureId(state, ref)), !0) : !1;
|
|
603
616
|
let registered = REGISTRY.get(val);
|
|
604
|
-
return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.
|
|
617
|
+
return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
|
|
605
618
|
}
|
|
606
619
|
function trackScope(state, val, scopeId) {
|
|
607
620
|
let ref = state.refs.get(val);
|
|
608
621
|
ref ? trackChannel(state, ref) : newScopeReference(state, val, scopeId);
|
|
609
622
|
}
|
|
610
623
|
function newScopeReference(state, val, scopeId) {
|
|
611
|
-
let ref = new Reference(null, null, state.
|
|
624
|
+
let ref = new Reference(null, null, state.flushId);
|
|
612
625
|
return ref.scopeId = scopeId, ref.channel = state.channel, state.refs.set(val, ref), ref;
|
|
613
626
|
}
|
|
614
627
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
615
628
|
let { scope } = registered;
|
|
616
629
|
if (scope) {
|
|
617
|
-
let ref = new Reference(parent, accessor, state.
|
|
630
|
+
let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
|
|
618
631
|
ref.channel = state.channel, state.refs.set(val, ref);
|
|
619
632
|
let scopeId = scope[K_SCOPE_ID];
|
|
620
633
|
trackScope(state, scope, scopeId), state.buf.push("_(" + scopeId + "," + quote(registered.id, 0) + ")");
|
|
@@ -627,7 +640,7 @@ function writeString(state, val, parent, accessor) {
|
|
|
627
640
|
if (ref) {
|
|
628
641
|
if (trackChannel(state, ref)) return state.buf.push(ensureId(state, ref)), !0;
|
|
629
642
|
} else {
|
|
630
|
-
let ref = new Reference(parent, accessor, state.
|
|
643
|
+
let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
|
|
631
644
|
ref.channel = state.channel, state.strs.set(val, ref);
|
|
632
645
|
}
|
|
633
646
|
}
|
|
@@ -759,44 +772,44 @@ function writePromise(state, val, ref) {
|
|
|
759
772
|
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;
|
|
760
773
|
}
|
|
761
774
|
function newAsyncHandle(state, parent, id) {
|
|
762
|
-
let handle = {}, handleRef = new Reference(parent, null, state.
|
|
775
|
+
let handle = {}, handleRef = new Reference(parent, null, state.flushId, null, id);
|
|
763
776
|
return handleRef.channel = state.channel, state.refs.set(handle, handleRef), handle;
|
|
764
777
|
}
|
|
765
778
|
function writeMap(state, val, ref) {
|
|
766
779
|
if (!val.size) return state.buf.push("new Map"), !0;
|
|
767
|
-
let items = [],
|
|
780
|
+
let items = [], assignments, needsId, deferring = !1, i = 0;
|
|
768
781
|
if (val.size < 25) {
|
|
769
782
|
for (let [itemKey, itemValue] of val) {
|
|
770
783
|
if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) && (deferring = !0), deferring) {
|
|
771
784
|
deferCall(state, ref, "set", [itemKey, itemValue]);
|
|
772
785
|
continue;
|
|
773
786
|
}
|
|
774
|
-
itemKey === val && (itemKey = void 0, (
|
|
787
|
+
itemKey === val && (itemKey = void 0, (assignments ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assignments ||= []).push("a[" + i + "][1]")), needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue), i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
|
|
775
788
|
}
|
|
776
|
-
writeArrayArg(state, ref, items,
|
|
789
|
+
writeArrayArg(state, ref, items, assignments && "((m,a)=>(" + assignmentsToString(assignments, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
|
|
777
790
|
} else {
|
|
778
791
|
for (let [itemKey, itemValue] of val) {
|
|
779
792
|
if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) && (deferring = !0), deferring) {
|
|
780
793
|
deferCall(state, ref, "set", [itemKey, itemValue]);
|
|
781
794
|
continue;
|
|
782
795
|
}
|
|
783
|
-
itemKey === val && (itemKey = 0, (
|
|
796
|
+
itemKey === val && (itemKey = 0, (assignments ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assignments ||= []).push("a[" + (i + 1) + "]")), needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue), i = items.push(itemKey, itemValue);
|
|
784
797
|
}
|
|
785
|
-
writeArrayArg(state, ref, items,
|
|
798
|
+
writeArrayArg(state, ref, items, assignments && "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignmentsToString(assignments, "new Map") + "))(", "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(", needsId);
|
|
786
799
|
}
|
|
787
800
|
return !0;
|
|
788
801
|
}
|
|
789
802
|
function writeSet(state, val, ref) {
|
|
790
803
|
if (!val.size) return state.buf.push("new Set"), !0;
|
|
791
|
-
let items = [],
|
|
804
|
+
let items = [], assignments, needsId, deferring = !1, i = 0;
|
|
792
805
|
for (let item of val) {
|
|
793
806
|
if (!deferring && item !== val && isAncestorMember(state, ref, item) && (deferring = !0), deferring) {
|
|
794
807
|
deferCall(state, ref, "add", [item]);
|
|
795
808
|
continue;
|
|
796
809
|
}
|
|
797
|
-
item === val ? (item = 0, (
|
|
810
|
+
item === val ? (item = 0, (assignments ||= []).push("i[" + i + "]")) : needsId ||= isDedupedMember(item), i = items.push(item);
|
|
798
811
|
}
|
|
799
|
-
return writeArrayArg(state, ref, items,
|
|
812
|
+
return writeArrayArg(state, ref, items, assignments && "((s,i)=>(" + assignmentsToString(assignments, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId), !0;
|
|
800
813
|
}
|
|
801
814
|
function isAncestorMember(state, container, member) {
|
|
802
815
|
if (member === null || typeof member != "object" && typeof member != "function") return !1;
|
|
@@ -807,13 +820,13 @@ function deferCall(state, ref, method, args) {
|
|
|
807
820
|
ensureId(state, ref), (ref.calls ||= []).push({
|
|
808
821
|
method,
|
|
809
822
|
args
|
|
810
|
-
}), state.
|
|
823
|
+
}), state.pendingAssignments.add(ref);
|
|
811
824
|
}
|
|
812
825
|
function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
813
826
|
if (assignsPrefix || needsId) {
|
|
814
|
-
let arrayRef = new Reference(ref, null, state.
|
|
827
|
+
let arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
815
828
|
state.buf.push((assignsPrefix || plainPrefix) + arrayRef.id + "="), writeArray(state, items, arrayRef);
|
|
816
|
-
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.
|
|
829
|
+
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
817
830
|
state.buf.push(")");
|
|
818
831
|
}
|
|
819
832
|
function isDedupedMember(val) {
|
|
@@ -847,7 +860,7 @@ function writeTypedArray(state, val, ref) {
|
|
|
847
860
|
if (!canWriteBuffer(state, val.buffer, ref)) return !1;
|
|
848
861
|
let needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
|
|
849
862
|
state.buf.push("new " + val.constructor.name + "("), writeProp(state, val.buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
|
|
850
|
-
} else state.refs.set(val.buffer, new Reference(ref, "buffer", state.
|
|
863
|
+
} else state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null)), state.buf.push("new " + val.constructor.name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"));
|
|
851
864
|
return !0;
|
|
852
865
|
}
|
|
853
866
|
function writeWeakSet(state) {
|
|
@@ -869,7 +882,7 @@ function writeAggregateError(state, val, ref) {
|
|
|
869
882
|
let inlined = writeProp(state, val.errors, ref, "errors");
|
|
870
883
|
if (inlined || state.buf.push("[]"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), inlined) {
|
|
871
884
|
let errorsRef = state.refs.get(val.errors);
|
|
872
|
-
errorsRef?.id && (state.
|
|
885
|
+
errorsRef?.id && (state.pendingAssignments.add(errorsRef), addAssignment(errorsRef, accessId(state, ref) + toAccess("errors")));
|
|
873
886
|
}
|
|
874
887
|
return !0;
|
|
875
888
|
}
|
|
@@ -900,7 +913,7 @@ function writeRequest(state, val, ref) {
|
|
|
900
913
|
let seenHeaders = state.refs.get(val.headers);
|
|
901
914
|
if (seenHeaders) options += sep + "headers:" + ensureId(state, seenHeaders), sep = ",";
|
|
902
915
|
else {
|
|
903
|
-
state.refs.set(val.headers, new Reference(ref, "headers", state.
|
|
916
|
+
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
904
917
|
let headers = stringEntriesToHeadersInit(val.headers);
|
|
905
918
|
headers && (options += sep + "headers:" + headers, sep = ",");
|
|
906
919
|
}
|
|
@@ -912,7 +925,7 @@ function writeResponse(state, val, ref) {
|
|
|
912
925
|
let seenHeaders = state.refs.get(val.headers);
|
|
913
926
|
if (seenHeaders) options += sep + "headers:" + ensureId(state, seenHeaders);
|
|
914
927
|
else {
|
|
915
|
-
state.refs.set(val.headers, new Reference(ref, "headers", state.
|
|
928
|
+
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
916
929
|
let headers = stringEntriesToHeadersInit(val.headers);
|
|
917
930
|
headers && (options += sep + "headers:" + headers);
|
|
918
931
|
}
|
|
@@ -926,7 +939,7 @@ function writeIntl(state, val, name, ref) {
|
|
|
926
939
|
}
|
|
927
940
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
928
941
|
let optionsRef;
|
|
929
|
-
return needsId ? (optionsRef = new Reference(ref, null, state.
|
|
942
|
+
return needsId ? (optionsRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state)), state.buf.push(optionsRef.id + "={")) : (optionsRef = new Reference(ref, null, state.flushId, state.buf.length), state.buf.push("{")), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
930
943
|
}
|
|
931
944
|
function writeIntlLocale(state, val) {
|
|
932
945
|
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
@@ -958,11 +971,11 @@ function writeGenerator(state, iter, ref) {
|
|
|
958
971
|
if (returnValue === void 0 && !yields.length) return state.buf.push("(function*(){})()"), !0;
|
|
959
972
|
let heldReturn = returnValue !== void 0 && isAncestorMember(state, ref, returnValue);
|
|
960
973
|
if (state.buf.push(returnValue === void 0 ? "(function*(a){yield*a})(" : heldReturn ? "(function*(a,r){yield*a;return r.v})(" : "(function*(a,r){yield*a;return r})("), needsId) {
|
|
961
|
-
let arrayRef = new Reference(ref, null, state.
|
|
974
|
+
let arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
962
975
|
state.buf.push(arrayRef.id + "="), writeArray(state, yields, arrayRef);
|
|
963
|
-
} else writeArray(state, yields, new Reference(ref, null, state.
|
|
976
|
+
} else writeArray(state, yields, new Reference(ref, null, state.flushId, state.buf.length));
|
|
964
977
|
if (heldReturn) {
|
|
965
|
-
let holder = new Reference(ref, null, state.
|
|
978
|
+
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
966
979
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
967
980
|
} else if (returnValue !== void 0) {
|
|
968
981
|
let sepIndex = state.buf.push(",") - 1;
|
|
@@ -1001,7 +1014,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1001
1014
|
let yieldSelf = "", iterArr = [];
|
|
1002
1015
|
for (let item of val) item === val && !(yieldSelf || iterArr.length) ? yieldSelf = "yield this;" : iterArr.push(item);
|
|
1003
1016
|
if (iterArr.length) {
|
|
1004
|
-
let iterRef = new Reference(ref, null, state.
|
|
1017
|
+
let iterRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1005
1018
|
state.buf.push(sep + "*[(" + iterRef.id + "="), writeArray(state, iterArr, iterRef), state.buf.push(",Symbol.iterator)](){" + yieldSelf + "yield*" + iterRef.id + "}");
|
|
1006
1019
|
} else state.buf.push(sep + "*[Symbol.iterator](){" + yieldSelf.slice(0, -1) + "}");
|
|
1007
1020
|
sep = ",";
|
|
@@ -1113,7 +1126,7 @@ function accessId(state, ref) {
|
|
|
1113
1126
|
}
|
|
1114
1127
|
function assignId(state, ref) {
|
|
1115
1128
|
let { pos } = ref;
|
|
1116
|
-
if (ref.id = nextRefAccess(state), pos !== null && ref.
|
|
1129
|
+
if (ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId) return pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id;
|
|
1117
1130
|
ref.channel = state.channel;
|
|
1118
1131
|
let cur = ref, accessPrevValue = "";
|
|
1119
1132
|
do {
|
|
@@ -1123,7 +1136,7 @@ function assignId(state, ref) {
|
|
|
1123
1136
|
accessPrevValue = parent.id + accessPrevValue;
|
|
1124
1137
|
break;
|
|
1125
1138
|
}
|
|
1126
|
-
if (parent.
|
|
1139
|
+
if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
|
|
1127
1140
|
accessPrevValue = accessId(state, parent) + accessPrevValue;
|
|
1128
1141
|
break;
|
|
1129
1142
|
}
|
|
@@ -1131,11 +1144,11 @@ function assignId(state, ref) {
|
|
|
1131
1144
|
} while (cur);
|
|
1132
1145
|
return ref.id + "=" + accessPrevValue;
|
|
1133
1146
|
}
|
|
1134
|
-
function
|
|
1135
|
-
return
|
|
1147
|
+
function assignmentsToString(assignments, value) {
|
|
1148
|
+
return assignments.length > 100 ? "($=>(" + assignments.join("=$,") + "=$))(" + value + ")" : assignments.join("=") + "=" + value;
|
|
1136
1149
|
}
|
|
1137
1150
|
function addAssignment(ref, assign) {
|
|
1138
|
-
ref.
|
|
1151
|
+
ref.assignments ? ref.assignments.push(assign) : ref.assignments = [assign];
|
|
1139
1152
|
}
|
|
1140
1153
|
function nextRefAccess(state) {
|
|
1141
1154
|
return "_." + nextId(state);
|
|
@@ -1816,7 +1829,13 @@ function offTick(cb) {
|
|
|
1816
1829
|
function flushTickQueue() {
|
|
1817
1830
|
let queue = tickQueue;
|
|
1818
1831
|
tickQueue = void 0;
|
|
1819
|
-
for (let cb of queue)
|
|
1832
|
+
for (let cb of queue) try {
|
|
1833
|
+
cb(!0);
|
|
1834
|
+
} catch (err) {
|
|
1835
|
+
tick(() => {
|
|
1836
|
+
throw err;
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1820
1839
|
}
|
|
1821
1840
|
//#endregion
|
|
1822
1841
|
//#region src/html/attrs.ts
|
|
@@ -1955,13 +1974,13 @@ function escapeSingleQuotedAttrValue(value) {
|
|
|
1955
1974
|
return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
|
|
1956
1975
|
}
|
|
1957
1976
|
function replaceUnsafeSingleQuoteAttrChar(match) {
|
|
1958
|
-
return match === "'" ? "'" : "&";
|
|
1977
|
+
return match === "'" ? "'" : match === "\r" ? " " : "&";
|
|
1959
1978
|
}
|
|
1960
1979
|
function escapeDoubleQuotedAttrValue(value) {
|
|
1961
1980
|
return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
|
|
1962
1981
|
}
|
|
1963
1982
|
function replaceUnsafeDoubleQuoteAttrChar(match) {
|
|
1964
|
-
return match === "\"" ? """ : "&";
|
|
1983
|
+
return match === "\"" ? """ : match === "\r" ? " " : "&";
|
|
1965
1984
|
}
|
|
1966
1985
|
function normalizedValueMatches(a, b) {
|
|
1967
1986
|
let value = normalizeStrAttrValue(b);
|