marko 6.0.49 → 6.0.51
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/common/types.d.ts +1 -0
- package/dist/debug/dom.js +131 -127
- package/dist/debug/dom.mjs +131 -127
- package/dist/debug/html.js +53 -47
- package/dist/debug/html.mjs +53 -47
- package/dist/dom/walker.d.ts +1 -0
- package/dist/dom.js +105 -102
- package/dist/dom.mjs +105 -102
- package/dist/html.js +39 -31
- package/dist/html.mjs +39 -31
- package/dist/translator/index.js +9 -5
- package/package.json +1 -1
package/dist/common/types.d.ts
CHANGED
package/dist/debug/dom.js
CHANGED
@@ -248,6 +248,132 @@ function stripSpacesAndPunctuation(str) {
|
|
248
248
|
var DEFAULT_RUNTIME_ID = "M";
|
249
249
|
var DEFAULT_RENDER_ID = "_";
|
250
250
|
|
251
|
+
// src/dom/scope.ts
|
252
|
+
function createScope($global, closestBranch) {
|
253
|
+
const scope = {
|
254
|
+
___id: $global.___nextScopeId++,
|
255
|
+
___creating: 1,
|
256
|
+
___closestBranch: closestBranch,
|
257
|
+
$global
|
258
|
+
};
|
259
|
+
pendingScopes.push(scope);
|
260
|
+
return scope;
|
261
|
+
}
|
262
|
+
function skipScope(scope) {
|
263
|
+
return scope.$global.___nextScopeId++;
|
264
|
+
}
|
265
|
+
function findBranchWithKey(scope, key) {
|
266
|
+
let branch = scope.___closestBranch;
|
267
|
+
while (branch && !branch[key]) {
|
268
|
+
branch = branch.___parentBranch;
|
269
|
+
}
|
270
|
+
return branch;
|
271
|
+
}
|
272
|
+
function destroyBranch(branch) {
|
273
|
+
branch.___parentBranch?.___branchScopes?.delete(branch);
|
274
|
+
destroyNestedBranches(branch);
|
275
|
+
}
|
276
|
+
function destroyNestedBranches(branch) {
|
277
|
+
branch.___destroyed = 1;
|
278
|
+
branch.___branchScopes?.forEach(destroyNestedBranches);
|
279
|
+
branch.___abortScopes?.forEach((scope) => {
|
280
|
+
for (const id in scope.___abortControllers) {
|
281
|
+
scope.___abortControllers[id]?.abort();
|
282
|
+
}
|
283
|
+
});
|
284
|
+
}
|
285
|
+
function removeAndDestroyBranch(branch) {
|
286
|
+
destroyBranch(branch);
|
287
|
+
removeChildNodes(branch.___startNode, branch.___endNode);
|
288
|
+
}
|
289
|
+
function insertBranchBefore(branch, parentNode, nextSibling) {
|
290
|
+
insertChildNodes(
|
291
|
+
parentNode,
|
292
|
+
nextSibling,
|
293
|
+
branch.___startNode,
|
294
|
+
branch.___endNode
|
295
|
+
);
|
296
|
+
}
|
297
|
+
function tempDetachBranch(branch) {
|
298
|
+
const fragment = new DocumentFragment();
|
299
|
+
fragment.namespaceURI = branch.___startNode.parentNode.namespaceURI;
|
300
|
+
insertChildNodes(fragment, null, branch.___startNode, branch.___endNode);
|
301
|
+
}
|
302
|
+
|
303
|
+
// src/dom/walker.ts
|
304
|
+
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
305
|
+
function walk(startNode, walkCodes, branch) {
|
306
|
+
walker.currentNode = startNode;
|
307
|
+
walkInternal(0, walkCodes, branch);
|
308
|
+
}
|
309
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
310
|
+
let value2;
|
311
|
+
let storedMultiplier = 0;
|
312
|
+
let currentMultiplier = 0;
|
313
|
+
let currentScopeIndex = 0;
|
314
|
+
for (; currentWalkIndex < walkCodes.length; ) {
|
315
|
+
value2 = walkCodes.charCodeAt(currentWalkIndex++);
|
316
|
+
currentMultiplier = storedMultiplier;
|
317
|
+
storedMultiplier = 0;
|
318
|
+
if (value2 === 32 /* Get */) {
|
319
|
+
const node = walker.currentNode;
|
320
|
+
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
321
|
+
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
322
|
+
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */) {
|
323
|
+
walker.currentNode.replaceWith(
|
324
|
+
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
325
|
+
);
|
326
|
+
if (value2 === 49 /* DynamicTagWithVar */) {
|
327
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
328
|
+
}
|
329
|
+
} else if (value2 === 38 /* EndChild */) {
|
330
|
+
return currentWalkIndex;
|
331
|
+
} else if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */) {
|
332
|
+
currentWalkIndex = walkInternal(
|
333
|
+
currentWalkIndex,
|
334
|
+
walkCodes,
|
335
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
336
|
+
);
|
337
|
+
if (value2 === 48 /* BeginChildWithVar */) {
|
338
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
339
|
+
}
|
340
|
+
} else if (value2 < 91 /* NextEnd */ + 1) {
|
341
|
+
value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */;
|
342
|
+
while (value2--) {
|
343
|
+
walker.nextNode();
|
344
|
+
}
|
345
|
+
} else if (value2 < 106 /* OverEnd */ + 1) {
|
346
|
+
value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */;
|
347
|
+
while (value2--) {
|
348
|
+
walker.nextSibling();
|
349
|
+
}
|
350
|
+
} else if (value2 < 116 /* OutEnd */ + 1) {
|
351
|
+
value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */;
|
352
|
+
while (value2--) {
|
353
|
+
walker.parentNode();
|
354
|
+
}
|
355
|
+
walker.nextSibling();
|
356
|
+
} else {
|
357
|
+
if (value2 < 117 /* Multiplier */ || value2 > 126 /* MultiplierEnd */) {
|
358
|
+
throw new Error(`Unknown walk code: ${value2}`);
|
359
|
+
}
|
360
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}
|
364
|
+
function getDebugKey(index, node) {
|
365
|
+
if (typeof node === "string") {
|
366
|
+
return `${node}/${index}`;
|
367
|
+
} else if (node.nodeType === 3 /* Text */) {
|
368
|
+
return `#text/${index}`;
|
369
|
+
} else if (node.nodeType === 8 /* Comment */) {
|
370
|
+
return `#comment/${index}`;
|
371
|
+
} else if (node.nodeType === 1 /* Element */) {
|
372
|
+
return `#${node.tagName.toLowerCase()}/${index}`;
|
373
|
+
}
|
374
|
+
return index;
|
375
|
+
}
|
376
|
+
|
251
377
|
// src/dom/resume.ts
|
252
378
|
var registeredValues = {};
|
253
379
|
var branchesEnabled;
|
@@ -329,6 +455,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
329
455
|
);
|
330
456
|
curNode = endBranch(childScopeId, curNode).___endNode;
|
331
457
|
parentBranchIds.set(childScopeId, scopeId);
|
458
|
+
if (visitToken === "'" /* BranchNativeTag */) {
|
459
|
+
const childBranch = scopeLookup[childScopeId];
|
460
|
+
childBranch[true ? getDebugKey(0, curNode) : 0] = childBranch.___startNode = childBranch.___endNode = curNode;
|
461
|
+
}
|
332
462
|
}
|
333
463
|
}
|
334
464
|
},
|
@@ -739,58 +869,6 @@ function parseHTML(html2, ns) {
|
|
739
869
|
return parser.content || parser;
|
740
870
|
}
|
741
871
|
|
742
|
-
// src/dom/scope.ts
|
743
|
-
function createScope($global, closestBranch) {
|
744
|
-
const scope = {
|
745
|
-
___id: $global.___nextScopeId++,
|
746
|
-
___creating: 1,
|
747
|
-
___closestBranch: closestBranch,
|
748
|
-
$global
|
749
|
-
};
|
750
|
-
pendingScopes.push(scope);
|
751
|
-
return scope;
|
752
|
-
}
|
753
|
-
function skipScope(scope) {
|
754
|
-
return scope.$global.___nextScopeId++;
|
755
|
-
}
|
756
|
-
function findBranchWithKey(scope, key) {
|
757
|
-
let branch = scope.___closestBranch;
|
758
|
-
while (branch && !branch[key]) {
|
759
|
-
branch = branch.___parentBranch;
|
760
|
-
}
|
761
|
-
return branch;
|
762
|
-
}
|
763
|
-
function destroyBranch(branch) {
|
764
|
-
branch.___parentBranch?.___branchScopes?.delete(branch);
|
765
|
-
destroyNestedBranches(branch);
|
766
|
-
}
|
767
|
-
function destroyNestedBranches(branch) {
|
768
|
-
branch.___destroyed = 1;
|
769
|
-
branch.___branchScopes?.forEach(destroyNestedBranches);
|
770
|
-
branch.___abortScopes?.forEach((scope) => {
|
771
|
-
for (const id in scope.___abortControllers) {
|
772
|
-
scope.___abortControllers[id]?.abort();
|
773
|
-
}
|
774
|
-
});
|
775
|
-
}
|
776
|
-
function removeAndDestroyBranch(branch) {
|
777
|
-
destroyBranch(branch);
|
778
|
-
removeChildNodes(branch.___startNode, branch.___endNode);
|
779
|
-
}
|
780
|
-
function insertBranchBefore(branch, parentNode, nextSibling) {
|
781
|
-
insertChildNodes(
|
782
|
-
parentNode,
|
783
|
-
nextSibling,
|
784
|
-
branch.___startNode,
|
785
|
-
branch.___endNode
|
786
|
-
);
|
787
|
-
}
|
788
|
-
function tempDetachBranch(branch) {
|
789
|
-
const fragment = new DocumentFragment();
|
790
|
-
fragment.namespaceURI = branch.___startNode.parentNode.namespaceURI;
|
791
|
-
insertChildNodes(fragment, null, branch.___startNode, branch.___endNode);
|
792
|
-
}
|
793
|
-
|
794
872
|
// src/dom/schedule.ts
|
795
873
|
var runTask;
|
796
874
|
var isScheduled;
|
@@ -1026,80 +1104,6 @@ function hoist(...path) {
|
|
1026
1104
|
};
|
1027
1105
|
}
|
1028
1106
|
|
1029
|
-
// src/dom/walker.ts
|
1030
|
-
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
1031
|
-
function walk(startNode, walkCodes, branch) {
|
1032
|
-
walker.currentNode = startNode;
|
1033
|
-
walkInternal(0, walkCodes, branch);
|
1034
|
-
}
|
1035
|
-
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
1036
|
-
let value2;
|
1037
|
-
let storedMultiplier = 0;
|
1038
|
-
let currentMultiplier = 0;
|
1039
|
-
let currentScopeIndex = 0;
|
1040
|
-
for (; currentWalkIndex < walkCodes.length; ) {
|
1041
|
-
value2 = walkCodes.charCodeAt(currentWalkIndex++);
|
1042
|
-
currentMultiplier = storedMultiplier;
|
1043
|
-
storedMultiplier = 0;
|
1044
|
-
if (value2 === 32 /* Get */) {
|
1045
|
-
const node = walker.currentNode;
|
1046
|
-
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
1047
|
-
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
1048
|
-
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */) {
|
1049
|
-
walker.currentNode.replaceWith(
|
1050
|
-
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
1051
|
-
);
|
1052
|
-
if (value2 === 49 /* DynamicTagWithVar */) {
|
1053
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
1054
|
-
}
|
1055
|
-
} else if (value2 === 38 /* EndChild */) {
|
1056
|
-
return currentWalkIndex;
|
1057
|
-
} else if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */) {
|
1058
|
-
currentWalkIndex = walkInternal(
|
1059
|
-
currentWalkIndex,
|
1060
|
-
walkCodes,
|
1061
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
1062
|
-
);
|
1063
|
-
if (value2 === 48 /* BeginChildWithVar */) {
|
1064
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
1065
|
-
}
|
1066
|
-
} else if (value2 < 91 /* NextEnd */ + 1) {
|
1067
|
-
value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */;
|
1068
|
-
while (value2--) {
|
1069
|
-
walker.nextNode();
|
1070
|
-
}
|
1071
|
-
} else if (value2 < 106 /* OverEnd */ + 1) {
|
1072
|
-
value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */;
|
1073
|
-
while (value2--) {
|
1074
|
-
walker.nextSibling();
|
1075
|
-
}
|
1076
|
-
} else if (value2 < 116 /* OutEnd */ + 1) {
|
1077
|
-
value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */;
|
1078
|
-
while (value2--) {
|
1079
|
-
walker.parentNode();
|
1080
|
-
}
|
1081
|
-
walker.nextSibling();
|
1082
|
-
} else {
|
1083
|
-
if (value2 < 117 /* Multiplier */ || value2 > 126 /* MultiplierEnd */) {
|
1084
|
-
throw new Error(`Unknown walk code: ${value2}`);
|
1085
|
-
}
|
1086
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
1087
|
-
}
|
1088
|
-
}
|
1089
|
-
}
|
1090
|
-
function getDebugKey(index, node) {
|
1091
|
-
if (typeof node === "string") {
|
1092
|
-
return `${node}/${index}`;
|
1093
|
-
} else if (node.nodeType === 3 /* Text */) {
|
1094
|
-
return `#text/${index}`;
|
1095
|
-
} else if (node.nodeType === 8 /* Comment */) {
|
1096
|
-
return `#comment/${index}`;
|
1097
|
-
} else if (node.nodeType === 1 /* Element */) {
|
1098
|
-
return `#${node.tagName.toLowerCase()}/${index}`;
|
1099
|
-
}
|
1100
|
-
return index;
|
1101
|
-
}
|
1102
|
-
|
1103
1107
|
// src/dom/renderer.ts
|
1104
1108
|
function createBranch($global, renderer, parentScope, parentNode) {
|
1105
1109
|
const branch = createScope($global);
|
@@ -1877,7 +1881,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1877
1881
|
const childScope = scope[childScopeAccessor];
|
1878
1882
|
const args = getInput?.();
|
1879
1883
|
if (typeof normalizedRenderer === "string") {
|
1880
|
-
attrs(
|
1884
|
+
(getContent ? attrs : attrsAndContent)(
|
1881
1885
|
childScope,
|
1882
1886
|
true ? `#${normalizedRenderer}/0` : 0,
|
1883
1887
|
(inputIsArgs ? args[0] : args) || {}
|
package/dist/debug/dom.mjs
CHANGED
@@ -152,6 +152,132 @@ function stripSpacesAndPunctuation(str) {
|
|
152
152
|
var DEFAULT_RUNTIME_ID = "M";
|
153
153
|
var DEFAULT_RENDER_ID = "_";
|
154
154
|
|
155
|
+
// src/dom/scope.ts
|
156
|
+
function createScope($global, closestBranch) {
|
157
|
+
const scope = {
|
158
|
+
___id: $global.___nextScopeId++,
|
159
|
+
___creating: 1,
|
160
|
+
___closestBranch: closestBranch,
|
161
|
+
$global
|
162
|
+
};
|
163
|
+
pendingScopes.push(scope);
|
164
|
+
return scope;
|
165
|
+
}
|
166
|
+
function skipScope(scope) {
|
167
|
+
return scope.$global.___nextScopeId++;
|
168
|
+
}
|
169
|
+
function findBranchWithKey(scope, key) {
|
170
|
+
let branch = scope.___closestBranch;
|
171
|
+
while (branch && !branch[key]) {
|
172
|
+
branch = branch.___parentBranch;
|
173
|
+
}
|
174
|
+
return branch;
|
175
|
+
}
|
176
|
+
function destroyBranch(branch) {
|
177
|
+
branch.___parentBranch?.___branchScopes?.delete(branch);
|
178
|
+
destroyNestedBranches(branch);
|
179
|
+
}
|
180
|
+
function destroyNestedBranches(branch) {
|
181
|
+
branch.___destroyed = 1;
|
182
|
+
branch.___branchScopes?.forEach(destroyNestedBranches);
|
183
|
+
branch.___abortScopes?.forEach((scope) => {
|
184
|
+
for (const id in scope.___abortControllers) {
|
185
|
+
scope.___abortControllers[id]?.abort();
|
186
|
+
}
|
187
|
+
});
|
188
|
+
}
|
189
|
+
function removeAndDestroyBranch(branch) {
|
190
|
+
destroyBranch(branch);
|
191
|
+
removeChildNodes(branch.___startNode, branch.___endNode);
|
192
|
+
}
|
193
|
+
function insertBranchBefore(branch, parentNode, nextSibling) {
|
194
|
+
insertChildNodes(
|
195
|
+
parentNode,
|
196
|
+
nextSibling,
|
197
|
+
branch.___startNode,
|
198
|
+
branch.___endNode
|
199
|
+
);
|
200
|
+
}
|
201
|
+
function tempDetachBranch(branch) {
|
202
|
+
const fragment = new DocumentFragment();
|
203
|
+
fragment.namespaceURI = branch.___startNode.parentNode.namespaceURI;
|
204
|
+
insertChildNodes(fragment, null, branch.___startNode, branch.___endNode);
|
205
|
+
}
|
206
|
+
|
207
|
+
// src/dom/walker.ts
|
208
|
+
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
209
|
+
function walk(startNode, walkCodes, branch) {
|
210
|
+
walker.currentNode = startNode;
|
211
|
+
walkInternal(0, walkCodes, branch);
|
212
|
+
}
|
213
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
214
|
+
let value2;
|
215
|
+
let storedMultiplier = 0;
|
216
|
+
let currentMultiplier = 0;
|
217
|
+
let currentScopeIndex = 0;
|
218
|
+
for (; currentWalkIndex < walkCodes.length; ) {
|
219
|
+
value2 = walkCodes.charCodeAt(currentWalkIndex++);
|
220
|
+
currentMultiplier = storedMultiplier;
|
221
|
+
storedMultiplier = 0;
|
222
|
+
if (value2 === 32 /* Get */) {
|
223
|
+
const node = walker.currentNode;
|
224
|
+
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
225
|
+
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
226
|
+
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */) {
|
227
|
+
walker.currentNode.replaceWith(
|
228
|
+
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
229
|
+
);
|
230
|
+
if (value2 === 49 /* DynamicTagWithVar */) {
|
231
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
232
|
+
}
|
233
|
+
} else if (value2 === 38 /* EndChild */) {
|
234
|
+
return currentWalkIndex;
|
235
|
+
} else if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */) {
|
236
|
+
currentWalkIndex = walkInternal(
|
237
|
+
currentWalkIndex,
|
238
|
+
walkCodes,
|
239
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
240
|
+
);
|
241
|
+
if (value2 === 48 /* BeginChildWithVar */) {
|
242
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
243
|
+
}
|
244
|
+
} else if (value2 < 91 /* NextEnd */ + 1) {
|
245
|
+
value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */;
|
246
|
+
while (value2--) {
|
247
|
+
walker.nextNode();
|
248
|
+
}
|
249
|
+
} else if (value2 < 106 /* OverEnd */ + 1) {
|
250
|
+
value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */;
|
251
|
+
while (value2--) {
|
252
|
+
walker.nextSibling();
|
253
|
+
}
|
254
|
+
} else if (value2 < 116 /* OutEnd */ + 1) {
|
255
|
+
value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */;
|
256
|
+
while (value2--) {
|
257
|
+
walker.parentNode();
|
258
|
+
}
|
259
|
+
walker.nextSibling();
|
260
|
+
} else {
|
261
|
+
if (value2 < 117 /* Multiplier */ || value2 > 126 /* MultiplierEnd */) {
|
262
|
+
throw new Error(`Unknown walk code: ${value2}`);
|
263
|
+
}
|
264
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
function getDebugKey(index, node) {
|
269
|
+
if (typeof node === "string") {
|
270
|
+
return `${node}/${index}`;
|
271
|
+
} else if (node.nodeType === 3 /* Text */) {
|
272
|
+
return `#text/${index}`;
|
273
|
+
} else if (node.nodeType === 8 /* Comment */) {
|
274
|
+
return `#comment/${index}`;
|
275
|
+
} else if (node.nodeType === 1 /* Element */) {
|
276
|
+
return `#${node.tagName.toLowerCase()}/${index}`;
|
277
|
+
}
|
278
|
+
return index;
|
279
|
+
}
|
280
|
+
|
155
281
|
// src/dom/resume.ts
|
156
282
|
var registeredValues = {};
|
157
283
|
var branchesEnabled;
|
@@ -233,6 +359,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
233
359
|
);
|
234
360
|
curNode = endBranch(childScopeId, curNode).___endNode;
|
235
361
|
parentBranchIds.set(childScopeId, scopeId);
|
362
|
+
if (visitToken === "'" /* BranchNativeTag */) {
|
363
|
+
const childBranch = scopeLookup[childScopeId];
|
364
|
+
childBranch[true ? getDebugKey(0, curNode) : 0] = childBranch.___startNode = childBranch.___endNode = curNode;
|
365
|
+
}
|
236
366
|
}
|
237
367
|
}
|
238
368
|
},
|
@@ -643,58 +773,6 @@ function parseHTML(html2, ns) {
|
|
643
773
|
return parser.content || parser;
|
644
774
|
}
|
645
775
|
|
646
|
-
// src/dom/scope.ts
|
647
|
-
function createScope($global, closestBranch) {
|
648
|
-
const scope = {
|
649
|
-
___id: $global.___nextScopeId++,
|
650
|
-
___creating: 1,
|
651
|
-
___closestBranch: closestBranch,
|
652
|
-
$global
|
653
|
-
};
|
654
|
-
pendingScopes.push(scope);
|
655
|
-
return scope;
|
656
|
-
}
|
657
|
-
function skipScope(scope) {
|
658
|
-
return scope.$global.___nextScopeId++;
|
659
|
-
}
|
660
|
-
function findBranchWithKey(scope, key) {
|
661
|
-
let branch = scope.___closestBranch;
|
662
|
-
while (branch && !branch[key]) {
|
663
|
-
branch = branch.___parentBranch;
|
664
|
-
}
|
665
|
-
return branch;
|
666
|
-
}
|
667
|
-
function destroyBranch(branch) {
|
668
|
-
branch.___parentBranch?.___branchScopes?.delete(branch);
|
669
|
-
destroyNestedBranches(branch);
|
670
|
-
}
|
671
|
-
function destroyNestedBranches(branch) {
|
672
|
-
branch.___destroyed = 1;
|
673
|
-
branch.___branchScopes?.forEach(destroyNestedBranches);
|
674
|
-
branch.___abortScopes?.forEach((scope) => {
|
675
|
-
for (const id in scope.___abortControllers) {
|
676
|
-
scope.___abortControllers[id]?.abort();
|
677
|
-
}
|
678
|
-
});
|
679
|
-
}
|
680
|
-
function removeAndDestroyBranch(branch) {
|
681
|
-
destroyBranch(branch);
|
682
|
-
removeChildNodes(branch.___startNode, branch.___endNode);
|
683
|
-
}
|
684
|
-
function insertBranchBefore(branch, parentNode, nextSibling) {
|
685
|
-
insertChildNodes(
|
686
|
-
parentNode,
|
687
|
-
nextSibling,
|
688
|
-
branch.___startNode,
|
689
|
-
branch.___endNode
|
690
|
-
);
|
691
|
-
}
|
692
|
-
function tempDetachBranch(branch) {
|
693
|
-
const fragment = new DocumentFragment();
|
694
|
-
fragment.namespaceURI = branch.___startNode.parentNode.namespaceURI;
|
695
|
-
insertChildNodes(fragment, null, branch.___startNode, branch.___endNode);
|
696
|
-
}
|
697
|
-
|
698
776
|
// src/dom/schedule.ts
|
699
777
|
var runTask;
|
700
778
|
var isScheduled;
|
@@ -930,80 +1008,6 @@ function hoist(...path) {
|
|
930
1008
|
};
|
931
1009
|
}
|
932
1010
|
|
933
|
-
// src/dom/walker.ts
|
934
|
-
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
935
|
-
function walk(startNode, walkCodes, branch) {
|
936
|
-
walker.currentNode = startNode;
|
937
|
-
walkInternal(0, walkCodes, branch);
|
938
|
-
}
|
939
|
-
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
940
|
-
let value2;
|
941
|
-
let storedMultiplier = 0;
|
942
|
-
let currentMultiplier = 0;
|
943
|
-
let currentScopeIndex = 0;
|
944
|
-
for (; currentWalkIndex < walkCodes.length; ) {
|
945
|
-
value2 = walkCodes.charCodeAt(currentWalkIndex++);
|
946
|
-
currentMultiplier = storedMultiplier;
|
947
|
-
storedMultiplier = 0;
|
948
|
-
if (value2 === 32 /* Get */) {
|
949
|
-
const node = walker.currentNode;
|
950
|
-
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
951
|
-
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
952
|
-
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */) {
|
953
|
-
walker.currentNode.replaceWith(
|
954
|
-
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
955
|
-
);
|
956
|
-
if (value2 === 49 /* DynamicTagWithVar */) {
|
957
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
958
|
-
}
|
959
|
-
} else if (value2 === 38 /* EndChild */) {
|
960
|
-
return currentWalkIndex;
|
961
|
-
} else if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */) {
|
962
|
-
currentWalkIndex = walkInternal(
|
963
|
-
currentWalkIndex,
|
964
|
-
walkCodes,
|
965
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
966
|
-
);
|
967
|
-
if (value2 === 48 /* BeginChildWithVar */) {
|
968
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
969
|
-
}
|
970
|
-
} else if (value2 < 91 /* NextEnd */ + 1) {
|
971
|
-
value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */;
|
972
|
-
while (value2--) {
|
973
|
-
walker.nextNode();
|
974
|
-
}
|
975
|
-
} else if (value2 < 106 /* OverEnd */ + 1) {
|
976
|
-
value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */;
|
977
|
-
while (value2--) {
|
978
|
-
walker.nextSibling();
|
979
|
-
}
|
980
|
-
} else if (value2 < 116 /* OutEnd */ + 1) {
|
981
|
-
value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */;
|
982
|
-
while (value2--) {
|
983
|
-
walker.parentNode();
|
984
|
-
}
|
985
|
-
walker.nextSibling();
|
986
|
-
} else {
|
987
|
-
if (value2 < 117 /* Multiplier */ || value2 > 126 /* MultiplierEnd */) {
|
988
|
-
throw new Error(`Unknown walk code: ${value2}`);
|
989
|
-
}
|
990
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
991
|
-
}
|
992
|
-
}
|
993
|
-
}
|
994
|
-
function getDebugKey(index, node) {
|
995
|
-
if (typeof node === "string") {
|
996
|
-
return `${node}/${index}`;
|
997
|
-
} else if (node.nodeType === 3 /* Text */) {
|
998
|
-
return `#text/${index}`;
|
999
|
-
} else if (node.nodeType === 8 /* Comment */) {
|
1000
|
-
return `#comment/${index}`;
|
1001
|
-
} else if (node.nodeType === 1 /* Element */) {
|
1002
|
-
return `#${node.tagName.toLowerCase()}/${index}`;
|
1003
|
-
}
|
1004
|
-
return index;
|
1005
|
-
}
|
1006
|
-
|
1007
1011
|
// src/dom/renderer.ts
|
1008
1012
|
function createBranch($global, renderer, parentScope, parentNode) {
|
1009
1013
|
const branch = createScope($global);
|
@@ -1781,7 +1785,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1781
1785
|
const childScope = scope[childScopeAccessor];
|
1782
1786
|
const args = getInput?.();
|
1783
1787
|
if (typeof normalizedRenderer === "string") {
|
1784
|
-
attrs(
|
1788
|
+
(getContent ? attrs : attrsAndContent)(
|
1785
1789
|
childScope,
|
1786
1790
|
true ? `#${normalizedRenderer}/0` : 0,
|
1787
1791
|
(inputIsArgs ? args[0] : args) || {}
|