marko 6.0.154 → 6.0.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/debug/dom.js +75 -16
- package/dist/debug/dom.mjs +75 -16
- package/dist/debug/html.js +45 -8
- package/dist/debug/html.mjs +45 -8
- package/dist/dom/resume.d.ts +5 -1
- package/dist/dom/scope.d.ts +1 -0
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +89 -55
- package/dist/dom.mjs +89 -55
- package/dist/html/serializer.d.ts +1 -0
- package/dist/html/template.d.ts +2 -1
- package/dist/html/writer.d.ts +1 -0
- package/dist/html.js +30 -10
- package/dist/html.mjs +30 -10
- package/dist/translator/index.js +25 -5
- package/dist/translator/util/entry-builder.d.ts +1 -0
- package/package.json +3 -2
- package/tags-html.d.ts +6 -0
- package/translator.js +8 -0
package/dist/debug/dom.js
CHANGED
|
@@ -108,6 +108,7 @@ __export(dom_exports, {
|
|
|
108
108
|
forTo: () => forTo,
|
|
109
109
|
forUntil: () => forUntil,
|
|
110
110
|
init: () => init,
|
|
111
|
+
initEmbedded: () => initEmbedded,
|
|
111
112
|
run: () => run
|
|
112
113
|
});
|
|
113
114
|
module.exports = __toCommonJS(dom_exports);
|
|
@@ -412,12 +413,18 @@ function destroyBranch(branch) {
|
|
|
412
413
|
branch["#ParentBranch" /* ParentBranch */]?.["#BranchScopes" /* BranchScopes */]?.delete(
|
|
413
414
|
branch
|
|
414
415
|
);
|
|
415
|
-
|
|
416
|
+
destroyNestedScopes(branch);
|
|
416
417
|
}
|
|
417
|
-
function
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
418
|
+
function destroyScope(scope) {
|
|
419
|
+
if (!scope["#Destroyed" /* Destroyed */]) {
|
|
420
|
+
destroyNestedScopes(scope);
|
|
421
|
+
resetControllers(scope);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function destroyNestedScopes(scope) {
|
|
425
|
+
scope["#Destroyed" /* Destroyed */] = 1;
|
|
426
|
+
scope["#BranchScopes" /* BranchScopes */]?.forEach(destroyNestedScopes);
|
|
427
|
+
scope["#AbortScopes" /* AbortScopes */]?.forEach(resetControllers);
|
|
421
428
|
}
|
|
422
429
|
function resetControllers(scope) {
|
|
423
430
|
for (const id in scope["#AbortControllers" /* AbortControllers */]) {
|
|
@@ -887,22 +894,49 @@ function createCloneableHTML(html, ns) {
|
|
|
887
894
|
|
|
888
895
|
// src/dom/resume.ts
|
|
889
896
|
var registeredValues = {};
|
|
897
|
+
var curRuntimeId;
|
|
898
|
+
var readyLookup;
|
|
890
899
|
var branchesEnabled;
|
|
900
|
+
var embedEnabled;
|
|
891
901
|
function enableBranches() {
|
|
892
902
|
branchesEnabled = 1;
|
|
893
903
|
}
|
|
904
|
+
var ready = /* @__PURE__ */ ((_) => (id) => {
|
|
905
|
+
readyLookup[id]?.();
|
|
906
|
+
readyLookup[id] = 1;
|
|
907
|
+
})(readyLookup = {});
|
|
908
|
+
function initEmbedded(readyId, runtimeId) {
|
|
909
|
+
embedEnabled = 1;
|
|
910
|
+
ready(readyId);
|
|
911
|
+
init(runtimeId);
|
|
912
|
+
new MutationObserver(() => {
|
|
913
|
+
const renders = self[curRuntimeId];
|
|
914
|
+
for (const renderId in renders) {
|
|
915
|
+
const { s, n } = renders[renderId];
|
|
916
|
+
if (n && !n.isConnected) {
|
|
917
|
+
delete renders[renderId];
|
|
918
|
+
for (const id in s) {
|
|
919
|
+
destroyScope(s[id]);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
924
|
+
}
|
|
894
925
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
895
|
-
if (
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
926
|
+
if (curRuntimeId) {
|
|
927
|
+
if (true) {
|
|
928
|
+
if (curRuntimeId !== runtimeId) {
|
|
929
|
+
throw new Error(
|
|
930
|
+
`Marko initialized multiple times with different $global.runtimeId's of ${JSON.stringify(runtimeId)} and ${JSON.stringify(curRuntimeId)}.`
|
|
931
|
+
);
|
|
932
|
+
}
|
|
901
933
|
}
|
|
934
|
+
return;
|
|
902
935
|
}
|
|
936
|
+
curRuntimeId = runtimeId;
|
|
937
|
+
let resumeRender;
|
|
903
938
|
const renders = self[runtimeId];
|
|
904
939
|
const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
|
|
905
|
-
let resumeRender;
|
|
906
940
|
const initRuntime = (renders2) => {
|
|
907
941
|
defineRuntime({
|
|
908
942
|
value: resumeRender = ((renderId) => {
|
|
@@ -976,6 +1010,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
976
1010
|
}
|
|
977
1011
|
};
|
|
978
1012
|
})();
|
|
1013
|
+
const nextToken = () => lastToken = visitText.slice(
|
|
1014
|
+
lastTokenIndex,
|
|
1015
|
+
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1
|
|
1016
|
+
);
|
|
979
1017
|
let $global;
|
|
980
1018
|
let lastEffect;
|
|
981
1019
|
let visits;
|
|
@@ -987,11 +1025,26 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
987
1025
|
let lastToken;
|
|
988
1026
|
let lastTokenIndex;
|
|
989
1027
|
let lastScopeId = 0;
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1028
|
+
if (true) {
|
|
1029
|
+
if (render.m) {
|
|
1030
|
+
throw new Error(
|
|
1031
|
+
`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
994
1035
|
render.m = (effects = []) => {
|
|
1036
|
+
if (readyLookup) {
|
|
1037
|
+
for (const readyId in render.b) {
|
|
1038
|
+
if (readyLookup[readyId] !== 1) {
|
|
1039
|
+
readyLookup[readyId] = /* @__PURE__ */ ((prev) => () => {
|
|
1040
|
+
render.m();
|
|
1041
|
+
prev?.();
|
|
1042
|
+
})(readyLookup[readyId]);
|
|
1043
|
+
return effects;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
render.b = 0;
|
|
1047
|
+
}
|
|
995
1048
|
for (const serialized of resumes = render.r || []) {
|
|
996
1049
|
if (typeof serialized === "string") {
|
|
997
1050
|
lastTokenIndex = 0;
|
|
@@ -1038,6 +1091,12 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
1038
1091
|
visitBranches();
|
|
1039
1092
|
}
|
|
1040
1093
|
}
|
|
1094
|
+
if (embedEnabled) {
|
|
1095
|
+
render.n ||= visit?.parentNode.insertBefore(
|
|
1096
|
+
new Text(),
|
|
1097
|
+
visit.nextSibling
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1041
1100
|
visits.length = resumes.length = 0;
|
|
1042
1101
|
return effects;
|
|
1043
1102
|
};
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -298,12 +298,18 @@ function destroyBranch(branch) {
|
|
|
298
298
|
branch["#ParentBranch" /* ParentBranch */]?.["#BranchScopes" /* BranchScopes */]?.delete(
|
|
299
299
|
branch
|
|
300
300
|
);
|
|
301
|
-
|
|
301
|
+
destroyNestedScopes(branch);
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
function destroyScope(scope) {
|
|
304
|
+
if (!scope["#Destroyed" /* Destroyed */]) {
|
|
305
|
+
destroyNestedScopes(scope);
|
|
306
|
+
resetControllers(scope);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function destroyNestedScopes(scope) {
|
|
310
|
+
scope["#Destroyed" /* Destroyed */] = 1;
|
|
311
|
+
scope["#BranchScopes" /* BranchScopes */]?.forEach(destroyNestedScopes);
|
|
312
|
+
scope["#AbortScopes" /* AbortScopes */]?.forEach(resetControllers);
|
|
307
313
|
}
|
|
308
314
|
function resetControllers(scope) {
|
|
309
315
|
for (const id in scope["#AbortControllers" /* AbortControllers */]) {
|
|
@@ -773,22 +779,49 @@ function createCloneableHTML(html, ns) {
|
|
|
773
779
|
|
|
774
780
|
// src/dom/resume.ts
|
|
775
781
|
var registeredValues = {};
|
|
782
|
+
var curRuntimeId;
|
|
783
|
+
var readyLookup;
|
|
776
784
|
var branchesEnabled;
|
|
785
|
+
var embedEnabled;
|
|
777
786
|
function enableBranches() {
|
|
778
787
|
branchesEnabled = 1;
|
|
779
788
|
}
|
|
789
|
+
var ready = /* @__PURE__ */ ((_) => (id) => {
|
|
790
|
+
readyLookup[id]?.();
|
|
791
|
+
readyLookup[id] = 1;
|
|
792
|
+
})(readyLookup = {});
|
|
793
|
+
function initEmbedded(readyId, runtimeId) {
|
|
794
|
+
embedEnabled = 1;
|
|
795
|
+
ready(readyId);
|
|
796
|
+
init(runtimeId);
|
|
797
|
+
new MutationObserver(() => {
|
|
798
|
+
const renders = self[curRuntimeId];
|
|
799
|
+
for (const renderId in renders) {
|
|
800
|
+
const { s, n } = renders[renderId];
|
|
801
|
+
if (n && !n.isConnected) {
|
|
802
|
+
delete renders[renderId];
|
|
803
|
+
for (const id in s) {
|
|
804
|
+
destroyScope(s[id]);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
809
|
+
}
|
|
780
810
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
811
|
+
if (curRuntimeId) {
|
|
812
|
+
if (true) {
|
|
813
|
+
if (curRuntimeId !== runtimeId) {
|
|
814
|
+
throw new Error(
|
|
815
|
+
`Marko initialized multiple times with different $global.runtimeId's of ${JSON.stringify(runtimeId)} and ${JSON.stringify(curRuntimeId)}.`
|
|
816
|
+
);
|
|
817
|
+
}
|
|
787
818
|
}
|
|
819
|
+
return;
|
|
788
820
|
}
|
|
821
|
+
curRuntimeId = runtimeId;
|
|
822
|
+
let resumeRender;
|
|
789
823
|
const renders = self[runtimeId];
|
|
790
824
|
const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
|
|
791
|
-
let resumeRender;
|
|
792
825
|
const initRuntime = (renders2) => {
|
|
793
826
|
defineRuntime({
|
|
794
827
|
value: resumeRender = ((renderId) => {
|
|
@@ -862,6 +895,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
862
895
|
}
|
|
863
896
|
};
|
|
864
897
|
})();
|
|
898
|
+
const nextToken = () => lastToken = visitText.slice(
|
|
899
|
+
lastTokenIndex,
|
|
900
|
+
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1
|
|
901
|
+
);
|
|
865
902
|
let $global;
|
|
866
903
|
let lastEffect;
|
|
867
904
|
let visits;
|
|
@@ -873,11 +910,26 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
873
910
|
let lastToken;
|
|
874
911
|
let lastTokenIndex;
|
|
875
912
|
let lastScopeId = 0;
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
913
|
+
if (true) {
|
|
914
|
+
if (render.m) {
|
|
915
|
+
throw new Error(
|
|
916
|
+
`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
880
920
|
render.m = (effects = []) => {
|
|
921
|
+
if (readyLookup) {
|
|
922
|
+
for (const readyId in render.b) {
|
|
923
|
+
if (readyLookup[readyId] !== 1) {
|
|
924
|
+
readyLookup[readyId] = /* @__PURE__ */ ((prev) => () => {
|
|
925
|
+
render.m();
|
|
926
|
+
prev?.();
|
|
927
|
+
})(readyLookup[readyId]);
|
|
928
|
+
return effects;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
render.b = 0;
|
|
932
|
+
}
|
|
881
933
|
for (const serialized of resumes = render.r || []) {
|
|
882
934
|
if (typeof serialized === "string") {
|
|
883
935
|
lastTokenIndex = 0;
|
|
@@ -924,6 +976,12 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
924
976
|
visitBranches();
|
|
925
977
|
}
|
|
926
978
|
}
|
|
979
|
+
if (embedEnabled) {
|
|
980
|
+
render.n ||= visit?.parentNode.insertBefore(
|
|
981
|
+
new Text(),
|
|
982
|
+
visit.nextSibling
|
|
983
|
+
);
|
|
984
|
+
}
|
|
927
985
|
visits.length = resumes.length = 0;
|
|
928
986
|
return effects;
|
|
929
987
|
};
|
|
@@ -2619,5 +2677,6 @@ export {
|
|
|
2619
2677
|
forTo,
|
|
2620
2678
|
forUntil,
|
|
2621
2679
|
init,
|
|
2680
|
+
initEmbedded,
|
|
2622
2681
|
run
|
|
2623
2682
|
};
|
package/dist/debug/html.js
CHANGED
|
@@ -2476,6 +2476,7 @@ var State2 = class {
|
|
|
2476
2476
|
writeReorders = null;
|
|
2477
2477
|
scopes = /* @__PURE__ */ new Map();
|
|
2478
2478
|
writeScopes = null;
|
|
2479
|
+
ensureReady = null;
|
|
2479
2480
|
serializeReason;
|
|
2480
2481
|
get runtimePrefix() {
|
|
2481
2482
|
const { $global: $global2 } = this;
|
|
@@ -2665,6 +2666,26 @@ var Chunk = class {
|
|
|
2665
2666
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
2666
2667
|
);
|
|
2667
2668
|
}
|
|
2669
|
+
if (state.ensureReady && state.hasMainRuntime) {
|
|
2670
|
+
let first = true;
|
|
2671
|
+
for (const id in state.ensureReady) {
|
|
2672
|
+
if (state.ensureReady[id]) {
|
|
2673
|
+
state.ensureReady[id] = 0;
|
|
2674
|
+
if (first) {
|
|
2675
|
+
scripts = concatScripts(
|
|
2676
|
+
scripts,
|
|
2677
|
+
"(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1"
|
|
2678
|
+
);
|
|
2679
|
+
} else {
|
|
2680
|
+
scripts = concatScripts(
|
|
2681
|
+
scripts,
|
|
2682
|
+
runtimePrefix + ".b" /* Blocking */ + toAccess(toObjectKey(id)) + "=1"
|
|
2683
|
+
);
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
first = false;
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2668
2689
|
if (effects) {
|
|
2669
2690
|
needsWalk = true;
|
|
2670
2691
|
state.resumes = state.resumes ? state.resumes + ',"' + effects + '"' : '"' + effects + '"';
|
|
@@ -3454,8 +3475,9 @@ function NOOP2() {
|
|
|
3454
3475
|
}
|
|
3455
3476
|
|
|
3456
3477
|
// src/html/template.ts
|
|
3457
|
-
var _template = (templateId, renderer) => {
|
|
3478
|
+
var _template = (templateId, renderer, page) => {
|
|
3458
3479
|
renderer.render = render;
|
|
3480
|
+
renderer.___embed = !page;
|
|
3459
3481
|
renderer._ = renderer;
|
|
3460
3482
|
if (true) {
|
|
3461
3483
|
renderer.mount = () => {
|
|
@@ -3472,7 +3494,7 @@ function render(input = {}) {
|
|
|
3472
3494
|
({ $global: $global2, ...input } = input);
|
|
3473
3495
|
$global2 = {
|
|
3474
3496
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
3475
|
-
renderId:
|
|
3497
|
+
renderId: getDefaultRenderId(this),
|
|
3476
3498
|
...$global2
|
|
3477
3499
|
};
|
|
3478
3500
|
if (true) {
|
|
@@ -3488,16 +3510,31 @@ function render(input = {}) {
|
|
|
3488
3510
|
}
|
|
3489
3511
|
}
|
|
3490
3512
|
} else {
|
|
3491
|
-
$global2 = {
|
|
3513
|
+
$global2 = {
|
|
3514
|
+
runtimeId: DEFAULT_RUNTIME_ID,
|
|
3515
|
+
renderId: getDefaultRenderId(this)
|
|
3516
|
+
};
|
|
3517
|
+
}
|
|
3518
|
+
const state = new State2($global2);
|
|
3519
|
+
const head = new Chunk(new Boundary(state, $global2.signal), null, null);
|
|
3520
|
+
if (this.___embed) {
|
|
3521
|
+
(state.ensureReady ||= {})[this.___id] = 1;
|
|
3492
3522
|
}
|
|
3493
|
-
const head = new Chunk(
|
|
3494
|
-
new Boundary(new State2($global2), $global2.signal),
|
|
3495
|
-
null,
|
|
3496
|
-
null
|
|
3497
|
-
);
|
|
3498
3523
|
head.render(this, input);
|
|
3499
3524
|
return new ServerRendered(head);
|
|
3500
3525
|
}
|
|
3526
|
+
function getDefaultRenderId(template) {
|
|
3527
|
+
if (template.___embed) {
|
|
3528
|
+
const ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
|
|
3529
|
+
let n = Math.random() * 4294967296 >>> 0;
|
|
3530
|
+
let r = ENCODE_CHARS[n % 53];
|
|
3531
|
+
for (n = n / 53 | 0; n; n >>>= 6) {
|
|
3532
|
+
r += ENCODE_CHARS[n & 63];
|
|
3533
|
+
}
|
|
3534
|
+
return r;
|
|
3535
|
+
}
|
|
3536
|
+
return DEFAULT_RENDER_ID;
|
|
3537
|
+
}
|
|
3501
3538
|
var ServerRendered = class {
|
|
3502
3539
|
#head;
|
|
3503
3540
|
#cachedPromise = null;
|
package/dist/debug/html.mjs
CHANGED
|
@@ -2383,6 +2383,7 @@ var State2 = class {
|
|
|
2383
2383
|
writeReorders = null;
|
|
2384
2384
|
scopes = /* @__PURE__ */ new Map();
|
|
2385
2385
|
writeScopes = null;
|
|
2386
|
+
ensureReady = null;
|
|
2386
2387
|
serializeReason;
|
|
2387
2388
|
get runtimePrefix() {
|
|
2388
2389
|
const { $global: $global2 } = this;
|
|
@@ -2572,6 +2573,26 @@ var Chunk = class {
|
|
|
2572
2573
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
2573
2574
|
);
|
|
2574
2575
|
}
|
|
2576
|
+
if (state.ensureReady && state.hasMainRuntime) {
|
|
2577
|
+
let first = true;
|
|
2578
|
+
for (const id in state.ensureReady) {
|
|
2579
|
+
if (state.ensureReady[id]) {
|
|
2580
|
+
state.ensureReady[id] = 0;
|
|
2581
|
+
if (first) {
|
|
2582
|
+
scripts = concatScripts(
|
|
2583
|
+
scripts,
|
|
2584
|
+
"(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1"
|
|
2585
|
+
);
|
|
2586
|
+
} else {
|
|
2587
|
+
scripts = concatScripts(
|
|
2588
|
+
scripts,
|
|
2589
|
+
runtimePrefix + ".b" /* Blocking */ + toAccess(toObjectKey(id)) + "=1"
|
|
2590
|
+
);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
first = false;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2575
2596
|
if (effects) {
|
|
2576
2597
|
needsWalk = true;
|
|
2577
2598
|
state.resumes = state.resumes ? state.resumes + ',"' + effects + '"' : '"' + effects + '"';
|
|
@@ -3361,8 +3382,9 @@ function NOOP2() {
|
|
|
3361
3382
|
}
|
|
3362
3383
|
|
|
3363
3384
|
// src/html/template.ts
|
|
3364
|
-
var _template = (templateId, renderer) => {
|
|
3385
|
+
var _template = (templateId, renderer, page) => {
|
|
3365
3386
|
renderer.render = render;
|
|
3387
|
+
renderer.___embed = !page;
|
|
3366
3388
|
renderer._ = renderer;
|
|
3367
3389
|
if (true) {
|
|
3368
3390
|
renderer.mount = () => {
|
|
@@ -3379,7 +3401,7 @@ function render(input = {}) {
|
|
|
3379
3401
|
({ $global: $global2, ...input } = input);
|
|
3380
3402
|
$global2 = {
|
|
3381
3403
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
3382
|
-
renderId:
|
|
3404
|
+
renderId: getDefaultRenderId(this),
|
|
3383
3405
|
...$global2
|
|
3384
3406
|
};
|
|
3385
3407
|
if (true) {
|
|
@@ -3395,16 +3417,31 @@ function render(input = {}) {
|
|
|
3395
3417
|
}
|
|
3396
3418
|
}
|
|
3397
3419
|
} else {
|
|
3398
|
-
$global2 = {
|
|
3420
|
+
$global2 = {
|
|
3421
|
+
runtimeId: DEFAULT_RUNTIME_ID,
|
|
3422
|
+
renderId: getDefaultRenderId(this)
|
|
3423
|
+
};
|
|
3424
|
+
}
|
|
3425
|
+
const state = new State2($global2);
|
|
3426
|
+
const head = new Chunk(new Boundary(state, $global2.signal), null, null);
|
|
3427
|
+
if (this.___embed) {
|
|
3428
|
+
(state.ensureReady ||= {})[this.___id] = 1;
|
|
3399
3429
|
}
|
|
3400
|
-
const head = new Chunk(
|
|
3401
|
-
new Boundary(new State2($global2), $global2.signal),
|
|
3402
|
-
null,
|
|
3403
|
-
null
|
|
3404
|
-
);
|
|
3405
3430
|
head.render(this, input);
|
|
3406
3431
|
return new ServerRendered(head);
|
|
3407
3432
|
}
|
|
3433
|
+
function getDefaultRenderId(template) {
|
|
3434
|
+
if (template.___embed) {
|
|
3435
|
+
const ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
|
|
3436
|
+
let n = Math.random() * 4294967296 >>> 0;
|
|
3437
|
+
let r = ENCODE_CHARS[n % 53];
|
|
3438
|
+
for (n = n / 53 | 0; n; n >>>= 6) {
|
|
3439
|
+
r += ENCODE_CHARS[n & 63];
|
|
3440
|
+
}
|
|
3441
|
+
return r;
|
|
3442
|
+
}
|
|
3443
|
+
return DEFAULT_RENDER_ID;
|
|
3444
|
+
}
|
|
3408
3445
|
var ServerRendered = class {
|
|
3409
3446
|
#head;
|
|
3410
3447
|
#cachedPromise = null;
|
package/dist/dom/resume.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export interface RenderData {
|
|
|
12
12
|
r?: (string | ResumeFn)[];
|
|
13
13
|
s?: Record<string, Scope>;
|
|
14
14
|
w(): void;
|
|
15
|
-
m(): unknown[];
|
|
15
|
+
m?(): unknown[];
|
|
16
|
+
n?: Text;
|
|
17
|
+
b?: 0 | Record<string, 1 | 0>;
|
|
16
18
|
d: never;
|
|
17
19
|
l: never;
|
|
18
20
|
x: never;
|
|
@@ -20,6 +22,8 @@ export interface RenderData {
|
|
|
20
22
|
p?: Record<string | number, AwaitCounter>;
|
|
21
23
|
}
|
|
22
24
|
export declare function enableBranches(): void;
|
|
25
|
+
export declare const ready: (id: string) => void;
|
|
26
|
+
export declare function initEmbedded(readyId: string, runtimeId?: string): void;
|
|
23
27
|
export declare function init(runtimeId?: string): void;
|
|
24
28
|
export declare let isResuming: undefined | 0 | 1;
|
|
25
29
|
export declare function getRegisteredWithScope(id: string, scope?: Scope): unknown;
|
package/dist/dom/scope.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function createScope($global: Scope[AccessorProp.Global], closest
|
|
|
3
3
|
export declare function skipScope(): number;
|
|
4
4
|
export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
|
|
5
5
|
export declare function destroyBranch(branch: BranchScope): void;
|
|
6
|
+
export declare function destroyScope(scope: Scope): void;
|
|
6
7
|
export declare function removeAndDestroyBranch(branch: BranchScope): void;
|
|
7
8
|
export declare function insertBranchBefore(branch: BranchScope, parentNode: ParentNode, nextSibling: Node | null): void;
|
|
8
9
|
export declare function tempDetachBranch(branch: BranchScope): void;
|
package/dist/dom.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export { _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content,
|
|
|
10
10
|
export { _on } from "./dom/event";
|
|
11
11
|
export { _enable_catch as _enable_catch, run } from "./dom/queue";
|
|
12
12
|
export { _content, _content_closures, _content_resume } from "./dom/renderer";
|
|
13
|
-
export { _el, _resume, _var_resume, init } from "./dom/resume";
|
|
13
|
+
export { _el, _resume, _var_resume, init, initEmbedded } from "./dom/resume";
|
|
14
14
|
export { _child_setup, _closure, _closure_get, _const, _el_read, _for_closure, _hoist, _hoist_resume, _id, _if_closure, _let, _or, _return, _return_change, _script, _var, _var_change, } from "./dom/signals";
|
|
15
15
|
export { _template } from "./dom/template";
|