marko 6.0.4 → 6.0.6
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/helpers.d.ts +2 -2
- package/dist/debug/dom.js +138 -136
- package/dist/debug/dom.mjs +138 -136
- package/dist/debug/html.js +30 -34
- package/dist/debug/html.mjs +30 -34
- package/dist/dom/dom.d.ts +5 -0
- package/dist/dom/queue.d.ts +1 -0
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +85 -90
- package/dist/dom.mjs +85 -90
- package/dist/html.js +17 -26
- package/dist/html.mjs +17 -26
- package/dist/translator/index.js +572 -338
- package/dist/translator/util/css-px-props.d.ts +2 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -2
- package/package.json +1 -1
package/dist/dom.js
CHANGED
@@ -24,6 +24,8 @@ __export(dom_exports, {
|
|
24
24
|
attrsEvents: () => attrsEvents,
|
25
25
|
awaitTag: () => awaitTag,
|
26
26
|
classAttr: () => classAttr,
|
27
|
+
classItem: () => classItem,
|
28
|
+
classItems: () => classItems,
|
27
29
|
compat: () => compat,
|
28
30
|
conditional: () => conditional,
|
29
31
|
conditionalClosure: () => conditionalClosure,
|
@@ -76,6 +78,9 @@ __export(dom_exports, {
|
|
76
78
|
setTagVarChange: () => setTagVarChange,
|
77
79
|
state: () => state,
|
78
80
|
styleAttr: () => styleAttr,
|
81
|
+
styleItem: () => styleItem,
|
82
|
+
styleItemValue: () => styleItemValue,
|
83
|
+
styleItems: () => styleItems,
|
79
84
|
tagVarSignal: () => tagVarSignal,
|
80
85
|
tagVarSignalChange: () => tagVarSignalChange,
|
81
86
|
textContent: () => textContent,
|
@@ -114,39 +119,30 @@ function forTo(to, from, step, cb) {
|
|
114
119
|
}
|
115
120
|
|
116
121
|
// src/common/helpers.ts
|
117
|
-
function classValue(
|
118
|
-
return toDelimitedString(
|
122
|
+
function classValue(classValue2) {
|
123
|
+
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
119
124
|
}
|
120
125
|
function stringifyClassObject(name, value2) {
|
121
126
|
return value2 ? name : "";
|
122
127
|
}
|
123
|
-
function styleValue(
|
124
|
-
return toDelimitedString(
|
128
|
+
function styleValue(styleValue2) {
|
129
|
+
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
125
130
|
}
|
126
131
|
function stringifyStyleObject(name, value2) {
|
127
|
-
return value2 || value2 === 0 ? `${name}:${typeof value2 == "number" &&
|
132
|
+
return value2 || value2 === 0 ? `${name}:${value2 && typeof value2 == "number" && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value2 + "px" : value2}` : "";
|
128
133
|
}
|
129
134
|
function toDelimitedString(val, delimiter, stringify) {
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
else
|
142
|
-
for (let name in val) {
|
143
|
-
let v = val[name], part = stringify(name, v);
|
144
|
-
part !== "" && (result += curDelimiter + part, curDelimiter = delimiter);
|
145
|
-
}
|
146
|
-
return result;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
return "";
|
135
|
+
let str = "", sep = "", part;
|
136
|
+
if (val)
|
137
|
+
if (typeof val != "object")
|
138
|
+
str += val;
|
139
|
+
else if (Array.isArray(val))
|
140
|
+
for (let v of val)
|
141
|
+
part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
142
|
+
else
|
143
|
+
for (let name in val)
|
144
|
+
part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
145
|
+
return str;
|
150
146
|
}
|
151
147
|
function isEventHandler(name) {
|
152
148
|
return /^on[A-Z-]/.test(name);
|
@@ -208,27 +204,20 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
|
208
204
|
// src/dom/resume.ts
|
209
205
|
var registeredValues = {};
|
210
206
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
211
|
-
let renders =
|
207
|
+
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
212
208
|
defineRuntime({
|
213
209
|
value: resumeRender = (renderId) => {
|
214
210
|
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
|
215
211
|
_: registeredValues
|
216
|
-
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(),
|
212
|
+
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), branchEnd = (branchId, reference) => {
|
213
|
+
let branch = scopeLookup[branchId] ||= {}, endNode = reference, prevNode;
|
214
|
+
for (; (prevNode = endNode.previousSibling) !== branch.h && ~visits.indexOf(endNode = prevNode); ) ;
|
215
|
+
return branch.j = lastEndNode = endNode === lastEndNode ? reference.parentNode.insertBefore(new Text(), reference) : endNode, branch.h ||= lastEndNode, branchIds.add(branchId), branch;
|
216
|
+
}, currentBranchId, $global, lastScopeId = 0, lastEffect, lastEndNode, visits, resumes;
|
217
217
|
return render.w = () => {
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
let visitNodes = new Set(visits), lastEndNode;
|
222
|
-
visits.length = 0;
|
223
|
-
let branchEnd = (branchId, reference) => {
|
224
|
-
let branch = scopeLookup[branchId] ||= {}, endNode = reference;
|
225
|
-
for (; endNode.previousSibling !== branch.h && visitNodes.has(endNode = endNode.previousSibling); ) ;
|
226
|
-
return endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
227
|
-
new Text(),
|
228
|
-
reference
|
229
|
-
)), branch.j = lastEndNode = endNode, branch.h ||= endNode, branchIds.add(branchId), branch;
|
230
|
-
};
|
231
|
-
for (let visit of visitNodes) {
|
218
|
+
try {
|
219
|
+
walk2(), isResuming = 1;
|
220
|
+
for (let visit of visits = render.v) {
|
232
221
|
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = +commentText.slice(
|
233
222
|
commentPrefixLen + 1,
|
234
223
|
dataIndex ? dataIndex - 1 : commentText.length
|
@@ -260,41 +249,37 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
260
249
|
}
|
261
250
|
}
|
262
251
|
}
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
252
|
+
for (let serialized of resumes = render.r || [])
|
253
|
+
if (typeof serialized == "string")
|
254
|
+
lastEffect = serialized;
|
255
|
+
else if (typeof serialized == "number")
|
256
|
+
registeredValues[lastEffect](
|
257
|
+
scopeLookup[serialized],
|
258
|
+
scopeLookup[serialized]
|
259
|
+
);
|
260
|
+
else
|
261
|
+
for (let scope of serialized(serializeContext))
|
262
|
+
if (!$global)
|
263
|
+
$global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.o = 1e6;
|
264
|
+
else if (typeof scope == "number")
|
265
|
+
lastScopeId += scope;
|
266
|
+
else {
|
267
|
+
let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
|
268
|
+
scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
269
|
+
scope,
|
270
|
+
prevScope
|
271
|
+
));
|
272
|
+
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
273
|
+
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
274
|
+
let branch = scope, parentBranch = branch.k;
|
275
|
+
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
276
|
+
branch
|
280
277
|
));
|
281
|
-
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
282
|
-
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
283
|
-
let branch = scope, parentBranch = branch.k;
|
284
|
-
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
285
|
-
branch
|
286
|
-
));
|
287
|
-
}
|
288
278
|
}
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
);
|
294
|
-
}
|
295
|
-
} finally {
|
296
|
-
isResuming = 0;
|
297
|
-
}
|
279
|
+
}
|
280
|
+
} finally {
|
281
|
+
isResuming = visits.length = resumes.length = 0;
|
282
|
+
}
|
298
283
|
}, render;
|
299
284
|
}
|
300
285
|
});
|
@@ -526,9 +511,26 @@ function setAttribute(element, name, value2) {
|
|
526
511
|
function classAttr(element, value2) {
|
527
512
|
setAttribute(element, "class", classValue(value2) || void 0);
|
528
513
|
}
|
514
|
+
function classItems(element, items) {
|
515
|
+
for (let key in items)
|
516
|
+
classItem(element, key, items[key]);
|
517
|
+
}
|
518
|
+
function classItem(element, name, value2) {
|
519
|
+
element.classList.toggle(name, !!value2);
|
520
|
+
}
|
529
521
|
function styleAttr(element, value2) {
|
530
522
|
setAttribute(element, "style", styleValue(value2) || void 0);
|
531
523
|
}
|
524
|
+
function styleItems(element, items) {
|
525
|
+
for (let key in items)
|
526
|
+
styleItem(element, key, items[key]);
|
527
|
+
}
|
528
|
+
function styleItem(element, name, value2) {
|
529
|
+
element.style.setProperty(name, value2 || value2 === 0 ? value2 + "" : "");
|
530
|
+
}
|
531
|
+
function styleItemValue(value2) {
|
532
|
+
return value2 && typeof value2 == "number" ? value2 + "px" : value2;
|
533
|
+
}
|
532
534
|
function data(node, value2) {
|
533
535
|
let normalizedValue = normalizeString(value2);
|
534
536
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
@@ -708,7 +710,6 @@ function toInsertNode(startNode, endNode) {
|
|
708
710
|
}
|
709
711
|
|
710
712
|
// src/dom/scope.ts
|
711
|
-
var pendingScopes = [];
|
712
713
|
function createScope($global, closestBranch) {
|
713
714
|
let scope = {
|
714
715
|
m: $global.o++,
|
@@ -721,11 +722,6 @@ function createScope($global, closestBranch) {
|
|
721
722
|
function skipScope(scope) {
|
722
723
|
return scope.$global.o++;
|
723
724
|
}
|
724
|
-
function finishPendingScopes() {
|
725
|
-
for (let scope of pendingScopes)
|
726
|
-
scope.p = 0;
|
727
|
-
pendingScopes = [];
|
728
|
-
}
|
729
725
|
function findBranchWithKey(scope, key) {
|
730
726
|
let branch = scope.k;
|
731
727
|
for (; branch && !branch[key]; )
|
@@ -951,12 +947,7 @@ function createCloneableHTML(html2, ns) {
|
|
951
947
|
}
|
952
948
|
|
953
949
|
// src/dom/schedule.ts
|
954
|
-
var
|
955
|
-
let { port1, port2: port22 } = new MessageChannel();
|
956
|
-
return port1.onmessage = () => {
|
957
|
-
isScheduled = 0, run();
|
958
|
-
}, port22;
|
959
|
-
})(), isScheduled;
|
950
|
+
var isScheduled, channel;
|
960
951
|
function schedule() {
|
961
952
|
isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
|
962
953
|
}
|
@@ -964,7 +955,9 @@ function flushAndWaitFrame() {
|
|
964
955
|
run(), requestAnimationFrame(triggerMacroTask);
|
965
956
|
}
|
966
957
|
function triggerMacroTask() {
|
967
|
-
|
958
|
+
channel || (channel = new MessageChannel(), channel.port1.onmessage = () => {
|
959
|
+
isScheduled = 0, run();
|
960
|
+
}), channel.port2.postMessage(0);
|
968
961
|
}
|
969
962
|
|
970
963
|
// src/dom/signals.ts
|
@@ -1313,7 +1306,7 @@ function byFirstArg(name) {
|
|
1313
1306
|
}
|
1314
1307
|
|
1315
1308
|
// src/dom/queue.ts
|
1316
|
-
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], rendering, scopeKeyOffset = 1e3;
|
1309
|
+
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
|
1317
1310
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.m) {
|
1318
1311
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1319
1312
|
if (existingRender)
|
@@ -1377,7 +1370,9 @@ function runRenders() {
|
|
1377
1370
|
}
|
1378
1371
|
render.D.k?.A || runRender(render);
|
1379
1372
|
}
|
1380
|
-
|
1373
|
+
for (let scope of pendingScopes)
|
1374
|
+
scope.p = 0;
|
1375
|
+
pendingScopes = [];
|
1381
1376
|
}
|
1382
1377
|
var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
|
1383
1378
|
enableCatch = () => {
|
@@ -1453,7 +1448,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1453
1448
|
}) {
|
1454
1449
|
return Array.isArray(value2) && typeof value2[0] == "string" ? getRegisteredWithScope(
|
1455
1450
|
value2[0],
|
1456
|
-
value2.length === 2 &&
|
1451
|
+
value2.length === 2 && self[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
|
1457
1452
|
) : value2;
|
1458
1453
|
},
|
1459
1454
|
createRenderer(params, clone) {
|
package/dist/dom.mjs
CHANGED
@@ -29,39 +29,30 @@ function forTo(to, from, step, cb) {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
// src/common/helpers.ts
|
32
|
-
function classValue(
|
33
|
-
return toDelimitedString(
|
32
|
+
function classValue(classValue2) {
|
33
|
+
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
34
34
|
}
|
35
35
|
function stringifyClassObject(name, value2) {
|
36
36
|
return value2 ? name : "";
|
37
37
|
}
|
38
|
-
function styleValue(
|
39
|
-
return toDelimitedString(
|
38
|
+
function styleValue(styleValue2) {
|
39
|
+
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
40
40
|
}
|
41
41
|
function stringifyStyleObject(name, value2) {
|
42
|
-
return value2 || value2 === 0 ? `${name}:${typeof value2 == "number" &&
|
42
|
+
return value2 || value2 === 0 ? `${name}:${value2 && typeof value2 == "number" && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value2 + "px" : value2}` : "";
|
43
43
|
}
|
44
44
|
function toDelimitedString(val, delimiter, stringify) {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
else
|
57
|
-
for (let name in val) {
|
58
|
-
let v = val[name], part = stringify(name, v);
|
59
|
-
part !== "" && (result += curDelimiter + part, curDelimiter = delimiter);
|
60
|
-
}
|
61
|
-
return result;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
return "";
|
45
|
+
let str = "", sep = "", part;
|
46
|
+
if (val)
|
47
|
+
if (typeof val != "object")
|
48
|
+
str += val;
|
49
|
+
else if (Array.isArray(val))
|
50
|
+
for (let v of val)
|
51
|
+
part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
52
|
+
else
|
53
|
+
for (let name in val)
|
54
|
+
part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
55
|
+
return str;
|
65
56
|
}
|
66
57
|
function isEventHandler(name) {
|
67
58
|
return /^on[A-Z-]/.test(name);
|
@@ -123,27 +114,20 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
|
123
114
|
// src/dom/resume.ts
|
124
115
|
var registeredValues = {};
|
125
116
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
126
|
-
let renders =
|
117
|
+
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
127
118
|
defineRuntime({
|
128
119
|
value: resumeRender = (renderId) => {
|
129
120
|
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
|
130
121
|
_: registeredValues
|
131
|
-
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(),
|
122
|
+
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), branchEnd = (branchId, reference) => {
|
123
|
+
let branch = scopeLookup[branchId] ||= {}, endNode = reference, prevNode;
|
124
|
+
for (; (prevNode = endNode.previousSibling) !== branch.h && ~visits.indexOf(endNode = prevNode); ) ;
|
125
|
+
return branch.j = lastEndNode = endNode === lastEndNode ? reference.parentNode.insertBefore(new Text(), reference) : endNode, branch.h ||= lastEndNode, branchIds.add(branchId), branch;
|
126
|
+
}, currentBranchId, $global, lastScopeId = 0, lastEffect, lastEndNode, visits, resumes;
|
132
127
|
return render.w = () => {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
let visitNodes = new Set(visits), lastEndNode;
|
137
|
-
visits.length = 0;
|
138
|
-
let branchEnd = (branchId, reference) => {
|
139
|
-
let branch = scopeLookup[branchId] ||= {}, endNode = reference;
|
140
|
-
for (; endNode.previousSibling !== branch.h && visitNodes.has(endNode = endNode.previousSibling); ) ;
|
141
|
-
return endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
142
|
-
new Text(),
|
143
|
-
reference
|
144
|
-
)), branch.j = lastEndNode = endNode, branch.h ||= endNode, branchIds.add(branchId), branch;
|
145
|
-
};
|
146
|
-
for (let visit of visitNodes) {
|
128
|
+
try {
|
129
|
+
walk2(), isResuming = 1;
|
130
|
+
for (let visit of visits = render.v) {
|
147
131
|
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = +commentText.slice(
|
148
132
|
commentPrefixLen + 1,
|
149
133
|
dataIndex ? dataIndex - 1 : commentText.length
|
@@ -175,41 +159,37 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
175
159
|
}
|
176
160
|
}
|
177
161
|
}
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
162
|
+
for (let serialized of resumes = render.r || [])
|
163
|
+
if (typeof serialized == "string")
|
164
|
+
lastEffect = serialized;
|
165
|
+
else if (typeof serialized == "number")
|
166
|
+
registeredValues[lastEffect](
|
167
|
+
scopeLookup[serialized],
|
168
|
+
scopeLookup[serialized]
|
169
|
+
);
|
170
|
+
else
|
171
|
+
for (let scope of serialized(serializeContext))
|
172
|
+
if (!$global)
|
173
|
+
$global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.o = 1e6;
|
174
|
+
else if (typeof scope == "number")
|
175
|
+
lastScopeId += scope;
|
176
|
+
else {
|
177
|
+
let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
|
178
|
+
scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
179
|
+
scope,
|
180
|
+
prevScope
|
181
|
+
));
|
182
|
+
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
183
|
+
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
184
|
+
let branch = scope, parentBranch = branch.k;
|
185
|
+
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
186
|
+
branch
|
195
187
|
));
|
196
|
-
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
197
|
-
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
198
|
-
let branch = scope, parentBranch = branch.k;
|
199
|
-
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
200
|
-
branch
|
201
|
-
));
|
202
|
-
}
|
203
188
|
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
);
|
209
|
-
}
|
210
|
-
} finally {
|
211
|
-
isResuming = 0;
|
212
|
-
}
|
189
|
+
}
|
190
|
+
} finally {
|
191
|
+
isResuming = visits.length = resumes.length = 0;
|
192
|
+
}
|
213
193
|
}, render;
|
214
194
|
}
|
215
195
|
});
|
@@ -441,9 +421,26 @@ function setAttribute(element, name, value2) {
|
|
441
421
|
function classAttr(element, value2) {
|
442
422
|
setAttribute(element, "class", classValue(value2) || void 0);
|
443
423
|
}
|
424
|
+
function classItems(element, items) {
|
425
|
+
for (let key in items)
|
426
|
+
classItem(element, key, items[key]);
|
427
|
+
}
|
428
|
+
function classItem(element, name, value2) {
|
429
|
+
element.classList.toggle(name, !!value2);
|
430
|
+
}
|
444
431
|
function styleAttr(element, value2) {
|
445
432
|
setAttribute(element, "style", styleValue(value2) || void 0);
|
446
433
|
}
|
434
|
+
function styleItems(element, items) {
|
435
|
+
for (let key in items)
|
436
|
+
styleItem(element, key, items[key]);
|
437
|
+
}
|
438
|
+
function styleItem(element, name, value2) {
|
439
|
+
element.style.setProperty(name, value2 || value2 === 0 ? value2 + "" : "");
|
440
|
+
}
|
441
|
+
function styleItemValue(value2) {
|
442
|
+
return value2 && typeof value2 == "number" ? value2 + "px" : value2;
|
443
|
+
}
|
447
444
|
function data(node, value2) {
|
448
445
|
let normalizedValue = normalizeString(value2);
|
449
446
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
@@ -623,7 +620,6 @@ function toInsertNode(startNode, endNode) {
|
|
623
620
|
}
|
624
621
|
|
625
622
|
// src/dom/scope.ts
|
626
|
-
var pendingScopes = [];
|
627
623
|
function createScope($global, closestBranch) {
|
628
624
|
let scope = {
|
629
625
|
m: $global.o++,
|
@@ -636,11 +632,6 @@ function createScope($global, closestBranch) {
|
|
636
632
|
function skipScope(scope) {
|
637
633
|
return scope.$global.o++;
|
638
634
|
}
|
639
|
-
function finishPendingScopes() {
|
640
|
-
for (let scope of pendingScopes)
|
641
|
-
scope.p = 0;
|
642
|
-
pendingScopes = [];
|
643
|
-
}
|
644
635
|
function findBranchWithKey(scope, key) {
|
645
636
|
let branch = scope.k;
|
646
637
|
for (; branch && !branch[key]; )
|
@@ -866,12 +857,7 @@ function createCloneableHTML(html2, ns) {
|
|
866
857
|
}
|
867
858
|
|
868
859
|
// src/dom/schedule.ts
|
869
|
-
var
|
870
|
-
let { port1, port2: port22 } = new MessageChannel();
|
871
|
-
return port1.onmessage = () => {
|
872
|
-
isScheduled = 0, run();
|
873
|
-
}, port22;
|
874
|
-
})(), isScheduled;
|
860
|
+
var isScheduled, channel;
|
875
861
|
function schedule() {
|
876
862
|
isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
|
877
863
|
}
|
@@ -879,7 +865,9 @@ function flushAndWaitFrame() {
|
|
879
865
|
run(), requestAnimationFrame(triggerMacroTask);
|
880
866
|
}
|
881
867
|
function triggerMacroTask() {
|
882
|
-
|
868
|
+
channel || (channel = new MessageChannel(), channel.port1.onmessage = () => {
|
869
|
+
isScheduled = 0, run();
|
870
|
+
}), channel.port2.postMessage(0);
|
883
871
|
}
|
884
872
|
|
885
873
|
// src/dom/signals.ts
|
@@ -1228,7 +1216,7 @@ function byFirstArg(name) {
|
|
1228
1216
|
}
|
1229
1217
|
|
1230
1218
|
// src/dom/queue.ts
|
1231
|
-
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], rendering, scopeKeyOffset = 1e3;
|
1219
|
+
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
|
1232
1220
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.m) {
|
1233
1221
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1234
1222
|
if (existingRender)
|
@@ -1292,7 +1280,9 @@ function runRenders() {
|
|
1292
1280
|
}
|
1293
1281
|
render.D.k?.A || runRender(render);
|
1294
1282
|
}
|
1295
|
-
|
1283
|
+
for (let scope of pendingScopes)
|
1284
|
+
scope.p = 0;
|
1285
|
+
pendingScopes = [];
|
1296
1286
|
}
|
1297
1287
|
var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
|
1298
1288
|
enableCatch = () => {
|
@@ -1368,7 +1358,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1368
1358
|
}) {
|
1369
1359
|
return Array.isArray(value2) && typeof value2[0] == "string" ? getRegisteredWithScope(
|
1370
1360
|
value2[0],
|
1371
|
-
value2.length === 2 &&
|
1361
|
+
value2.length === 2 && self[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
|
1372
1362
|
) : value2;
|
1373
1363
|
},
|
1374
1364
|
createRenderer(params, clone) {
|
@@ -1466,6 +1456,8 @@ export {
|
|
1466
1456
|
attrsEvents,
|
1467
1457
|
awaitTag,
|
1468
1458
|
classAttr,
|
1459
|
+
classItem,
|
1460
|
+
classItems,
|
1469
1461
|
compat,
|
1470
1462
|
conditional,
|
1471
1463
|
conditionalClosure,
|
@@ -1518,6 +1510,9 @@ export {
|
|
1518
1510
|
setTagVarChange,
|
1519
1511
|
state,
|
1520
1512
|
styleAttr,
|
1513
|
+
styleItem,
|
1514
|
+
styleItemValue,
|
1515
|
+
styleItems,
|
1521
1516
|
tagVarSignal,
|
1522
1517
|
tagVarSignalChange,
|
1523
1518
|
textContent,
|
package/dist/html.js
CHANGED
@@ -93,39 +93,30 @@ function* attrTagIterator() {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
// src/common/helpers.ts
|
96
|
-
function classValue(
|
97
|
-
return toDelimitedString(
|
96
|
+
function classValue(classValue2) {
|
97
|
+
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
98
98
|
}
|
99
99
|
function stringifyClassObject(name, value) {
|
100
100
|
return value ? name : "";
|
101
101
|
}
|
102
|
-
function styleValue(
|
103
|
-
return toDelimitedString(
|
102
|
+
function styleValue(styleValue2) {
|
103
|
+
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
104
104
|
}
|
105
105
|
function stringifyStyleObject(name, value) {
|
106
|
-
return value || value === 0 ? `${name}:${typeof value == "number" &&
|
106
|
+
return value || value === 0 ? `${name}:${value && typeof value == "number" && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
|
107
107
|
}
|
108
108
|
function toDelimitedString(val, delimiter, stringify) {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
else
|
121
|
-
for (let name in val) {
|
122
|
-
let v = val[name], part = stringify(name, v);
|
123
|
-
part !== "" && (result += curDelimiter + part, curDelimiter = delimiter);
|
124
|
-
}
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
return "";
|
109
|
+
let str = "", sep = "", part;
|
110
|
+
if (val)
|
111
|
+
if (typeof val != "object")
|
112
|
+
str += val;
|
113
|
+
else if (Array.isArray(val))
|
114
|
+
for (let v of val)
|
115
|
+
part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
116
|
+
else
|
117
|
+
for (let name in val)
|
118
|
+
part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
119
|
+
return str;
|
129
120
|
}
|
130
121
|
function isEventHandler(name) {
|
131
122
|
return /^on[A-Z-]/.test(name);
|
@@ -190,7 +181,7 @@ function forToBy(by, index) {
|
|
190
181
|
}
|
191
182
|
|
192
183
|
// src/html/inlined-runtimes.ts
|
193
|
-
var WALKER_RUNTIME_CODE = '(e=>(self[e]=(l,
|
184
|
+
var WALKER_RUNTIME_CODE = '(e=>(self[e]=(l,d=e+l,f=d.length,o={},n=[],s=document,t=s.createTreeWalker(s,129))=>s=self[e][l]={i:d,d:s,l:o,v:n,x(){},w(e,l,x){for(;e=t.nextNode();)s.x(l=(l=e.data)&&!l.indexOf(d)&&(o[x=l.slice(f+1)]=e,l[f]),x,e),l>"#"&&n.push(e)}},self[e]))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
|
194
185
|
|
195
186
|
// src/html/serializer.ts
|
196
187
|
var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = function* () {
|