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.
@@ -45,48 +45,44 @@ function forTo(to, from, step, cb) {
45
45
  }
46
46
 
47
47
  // src/common/helpers.ts
48
- function classValue(value2) {
49
- return toDelimitedString(value2, " ", stringifyClassObject);
48
+ function classValue(classValue2) {
49
+ return toDelimitedString(classValue2, " ", stringifyClassObject);
50
50
  }
51
51
  function stringifyClassObject(name, value2) {
52
52
  return value2 ? name : "";
53
53
  }
54
- function styleValue(value2) {
55
- return toDelimitedString(value2, ";", stringifyStyleObject);
54
+ function styleValue(styleValue2) {
55
+ return toDelimitedString(styleValue2, ";", stringifyStyleObject);
56
56
  }
57
57
  function stringifyStyleObject(name, value2) {
58
- return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value2 + "px" : value2}` : "";
58
+ 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}` : "";
59
59
  }
60
60
  function toDelimitedString(val, delimiter, stringify) {
61
- switch (typeof val) {
62
- case "string":
63
- return val;
64
- case "object":
65
- if (val !== null) {
66
- let result = "";
67
- let curDelimiter = "";
68
- if (Array.isArray(val)) {
69
- for (const v of val) {
70
- const part = toDelimitedString(v, delimiter, stringify);
71
- if (part !== "") {
72
- result += curDelimiter + part;
73
- curDelimiter = delimiter;
74
- }
75
- }
76
- } else {
77
- for (const name in val) {
78
- const v = val[name];
79
- const part = stringify(name, v);
80
- if (part !== "") {
81
- result += curDelimiter + part;
82
- curDelimiter = delimiter;
83
- }
84
- }
61
+ let str = "";
62
+ let sep = "";
63
+ let part;
64
+ if (val) {
65
+ if (typeof val !== "object") {
66
+ str += val;
67
+ } else if (Array.isArray(val)) {
68
+ for (const v of val) {
69
+ part = toDelimitedString(v, delimiter, stringify);
70
+ if (part) {
71
+ str += sep + part;
72
+ sep = delimiter;
73
+ }
74
+ }
75
+ } else {
76
+ for (const name in val) {
77
+ part = stringify(name, val[name]);
78
+ if (part) {
79
+ str += sep + part;
80
+ sep = delimiter;
85
81
  }
86
- return result;
87
82
  }
83
+ }
88
84
  }
89
- return "";
85
+ return str;
90
86
  }
91
87
  function isEventHandler(name) {
92
88
  return /^on[A-Z-]/.test(name);
@@ -165,15 +161,15 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
165
161
  `Invalid runtimeId: "${runtimeId}". The runtimeId must be a valid JavaScript identifier.`
166
162
  );
167
163
  }
168
- const descriptor = Object.getOwnPropertyDescriptor(window, runtimeId);
164
+ const descriptor = Object.getOwnPropertyDescriptor(self, runtimeId);
169
165
  if (descriptor && (descriptor.set || descriptor.configurable === false)) {
170
166
  throw new Error(
171
167
  `Marko initialized multiple times with the same $global.runtimeId of ${JSON.stringify(runtimeId)}. It could be that there are multiple copies of Marko running on the page.`
172
168
  );
173
169
  }
174
170
  }
175
- const renders = window[runtimeId];
176
- const defineRuntime = (desc) => Object.defineProperty(window, runtimeId, desc);
171
+ const renders = self[runtimeId];
172
+ const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
177
173
  let resumeRender;
178
174
  const initRuntime = (renders2) => {
179
175
  defineRuntime({
@@ -188,34 +184,28 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
188
184
  };
189
185
  const branchIds = /* @__PURE__ */ new Set();
190
186
  const parentBranchIds = /* @__PURE__ */ new Map();
191
- let lastEffect;
187
+ const branchEnd = (branchId, reference) => {
188
+ const branch = scopeLookup[branchId] ||= {};
189
+ let endNode = reference;
190
+ let prevNode;
191
+ while ((prevNode = endNode.previousSibling) !== branch.___startNode && ~visits.indexOf(endNode = prevNode)) ;
192
+ branch.___endNode = lastEndNode = endNode === lastEndNode ? reference.parentNode.insertBefore(new Text(), reference) : endNode;
193
+ branch.___startNode ||= lastEndNode;
194
+ branchIds.add(branchId);
195
+ return branch;
196
+ };
192
197
  let currentBranchId;
193
198
  let $global;
194
199
  let lastScopeId = 0;
200
+ let lastEffect;
201
+ let lastEndNode;
202
+ let visits;
203
+ let resumes;
195
204
  render.w = () => {
196
- walk2.call(render);
197
- const visits = render.v;
198
- const resumes = render.r;
199
- if (visits.length) {
200
- const visitNodes = new Set(visits);
201
- let lastEndNode;
202
- visits.length = 0;
203
- const branchEnd = (branchId, reference) => {
204
- const branch = scopeLookup[branchId] ||= {};
205
- let endNode = reference;
206
- while (endNode.previousSibling !== branch.___startNode && visitNodes.has(endNode = endNode.previousSibling)) ;
207
- if (endNode === lastEndNode) {
208
- endNode = reference.parentNode.insertBefore(
209
- new Text(),
210
- reference
211
- );
212
- }
213
- branch.___endNode = lastEndNode = endNode;
214
- branch.___startNode ||= endNode;
215
- branchIds.add(branchId);
216
- return branch;
217
- };
218
- for (const visit of visitNodes) {
205
+ try {
206
+ walk2();
207
+ isResuming = 1;
208
+ for (const visit of visits = render.v) {
219
209
  const commentText = visit.data;
220
210
  const dataIndex = commentText.indexOf(" ") + 1;
221
211
  const scopeId = +commentText.slice(
@@ -268,67 +258,58 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
268
258
  }
269
259
  }
270
260
  }
271
- }
272
- if (resumes) {
273
- try {
274
- render.r = [];
275
- isResuming = 1;
276
- for (let i = 0; i < resumes.length; i++) {
277
- let serialized = resumes[i];
278
- if (typeof serialized === "function") {
279
- for (const scope of serialized(serializeContext)) {
280
- if (!$global) {
281
- $global = scope || {};
282
- $global.runtimeId = runtimeId;
283
- $global.renderId = renderId;
284
- $global.___nextScopeId = 1e6;
285
- } else if (typeof scope === "number") {
286
- lastScopeId += scope;
287
- } else {
288
- const scopeId = ++lastScopeId;
289
- const prevScope = scopeLookup[scopeId];
290
- scope.$global = $global;
291
- scope.___id = scopeId;
292
- if (prevScope !== scope) {
293
- scopeLookup[scopeId] = Object.assign(
294
- scope,
295
- prevScope
261
+ for (const serialized of resumes = render.r || []) {
262
+ if (typeof serialized === "string") {
263
+ lastEffect = serialized;
264
+ } else if (typeof serialized === "number") {
265
+ registeredValues[lastEffect](
266
+ scopeLookup[serialized],
267
+ scopeLookup[serialized]
268
+ );
269
+ } else {
270
+ for (const scope of serialized(serializeContext)) {
271
+ if (!$global) {
272
+ $global = scope || {};
273
+ $global.runtimeId = runtimeId;
274
+ $global.renderId = renderId;
275
+ $global.___nextScopeId = 1e6;
276
+ } else if (typeof scope === "number") {
277
+ lastScopeId += scope;
278
+ } else {
279
+ const scopeId = ++lastScopeId;
280
+ const prevScope = scopeLookup[scopeId];
281
+ scope.$global = $global;
282
+ scope.___id = scopeId;
283
+ if (prevScope !== scope) {
284
+ scopeLookup[scopeId] = Object.assign(
285
+ scope,
286
+ prevScope
287
+ );
288
+ }
289
+ const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
290
+ if (parentBranchId) {
291
+ scope.___closestBranch = scopeLookup[parentBranchId];
292
+ }
293
+ if (branchIds.has(scopeId)) {
294
+ const branch = scope;
295
+ const parentBranch = branch.___closestBranch;
296
+ scope.___closestBranch = branch;
297
+ if (parentBranch) {
298
+ branch.___parentBranch = parentBranch;
299
+ (parentBranch.___branchScopes ||= /* @__PURE__ */ new Set()).add(
300
+ branch
296
301
  );
297
302
  }
298
- const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
299
- if (parentBranchId) {
300
- scope.___closestBranch = scopeLookup[parentBranchId];
301
- }
302
- if (branchIds.has(scopeId)) {
303
- const branch = scope;
304
- const parentBranch = branch.___closestBranch;
305
- scope.___closestBranch = branch;
306
- if (parentBranch) {
307
- branch.___parentBranch = parentBranch;
308
- (parentBranch.___branchScopes ||= /* @__PURE__ */ new Set()).add(
309
- branch
310
- );
311
- }
312
- }
313
- if (true) {
314
- scope.___debugId = "server-" + scopeId;
315
- }
303
+ }
304
+ if (true) {
305
+ scope.___debugId = "server-" + scopeId;
316
306
  }
317
307
  }
318
- } else {
319
- if (typeof serialized === "string") {
320
- lastEffect = serialized;
321
- serialized = resumes[++i];
322
- }
323
- registeredValues[lastEffect](
324
- scopeLookup[serialized],
325
- scopeLookup[serialized]
326
- );
327
308
  }
328
309
  }
329
- } finally {
330
- isResuming = 0;
331
310
  }
311
+ } finally {
312
+ isResuming = visits.length = resumes.length = 0;
332
313
  }
333
314
  };
334
315
  return render;
@@ -660,9 +641,28 @@ function setAttribute(element, name, value2) {
660
641
  function classAttr(element, value2) {
661
642
  setAttribute(element, "class", classValue(value2) || void 0);
662
643
  }
644
+ function classItems(element, items) {
645
+ for (const key in items) {
646
+ classItem(element, key, items[key]);
647
+ }
648
+ }
649
+ function classItem(element, name, value2) {
650
+ element.classList.toggle(name, !!value2);
651
+ }
663
652
  function styleAttr(element, value2) {
664
653
  setAttribute(element, "style", styleValue(value2) || void 0);
665
654
  }
655
+ function styleItems(element, items) {
656
+ for (const key in items) {
657
+ styleItem(element, key, items[key]);
658
+ }
659
+ }
660
+ function styleItem(element, name, value2) {
661
+ element.style.setProperty(name, value2 || value2 === 0 ? value2 + "" : "");
662
+ }
663
+ function styleItemValue(value2) {
664
+ return value2 && typeof value2 === "number" ? value2 + "px" : value2;
665
+ }
666
666
  function data(node, value2) {
667
667
  const normalizedValue = normalizeString(value2);
668
668
  if (node.data !== normalizedValue) {
@@ -895,7 +895,6 @@ function toInsertNode(startNode, endNode) {
895
895
  }
896
896
 
897
897
  // src/dom/scope.ts
898
- var pendingScopes = [];
899
898
  function createScope($global, closestBranch) {
900
899
  const scope = {
901
900
  ___id: $global.___nextScopeId++,
@@ -909,12 +908,6 @@ function createScope($global, closestBranch) {
909
908
  function skipScope(scope) {
910
909
  return scope.$global.___nextScopeId++;
911
910
  }
912
- function finishPendingScopes() {
913
- for (const scope of pendingScopes) {
914
- scope.___creating = 0;
915
- }
916
- pendingScopes = [];
917
- }
918
911
  function findBranchWithKey(scope, key) {
919
912
  let branch = scope.___closestBranch;
920
913
  while (branch && !branch[key]) {
@@ -1298,21 +1291,8 @@ function createCloneableHTML(html2, ns) {
1298
1291
 
1299
1292
  // src/dom/schedule.ts
1300
1293
  var runTask;
1301
- var port2 = /* @__PURE__ */ (() => {
1302
- const { port1, port2: port22 } = new MessageChannel();
1303
- port1.onmessage = () => {
1304
- isScheduled = 0;
1305
- if (true) {
1306
- const run2 = runTask;
1307
- runTask = void 0;
1308
- run2();
1309
- } else {
1310
- run();
1311
- }
1312
- };
1313
- return port22;
1314
- })();
1315
1294
  var isScheduled;
1295
+ var channel;
1316
1296
  function schedule() {
1317
1297
  if (!isScheduled) {
1318
1298
  if (true) {
@@ -1336,7 +1316,20 @@ function flushAndWaitFrame() {
1336
1316
  requestAnimationFrame(triggerMacroTask);
1337
1317
  }
1338
1318
  function triggerMacroTask() {
1339
- port2.postMessage(0);
1319
+ if (!channel) {
1320
+ channel = new MessageChannel();
1321
+ channel.port1.onmessage = () => {
1322
+ isScheduled = 0;
1323
+ if (true) {
1324
+ const run2 = runTask;
1325
+ runTask = void 0;
1326
+ run2();
1327
+ } else {
1328
+ run();
1329
+ }
1330
+ };
1331
+ }
1332
+ channel.port2.postMessage(0);
1340
1333
  }
1341
1334
 
1342
1335
  // src/dom/signals.ts
@@ -1881,6 +1874,7 @@ var pendingRendersLookup = /* @__PURE__ */ new Map();
1881
1874
  var caughtError = /* @__PURE__ */ new WeakSet();
1882
1875
  var placeholderShown = /* @__PURE__ */ new WeakSet();
1883
1876
  var pendingEffects = [];
1877
+ var pendingScopes = [];
1884
1878
  var rendering;
1885
1879
  var scopeKeyOffset = 1e3;
1886
1880
  function queueRender(scope, signal, signalKey, value2, scopeKey = scope.___id) {
@@ -1977,7 +1971,10 @@ function runRenders() {
1977
1971
  runRender(render);
1978
1972
  }
1979
1973
  }
1980
- finishPendingScopes();
1974
+ for (const scope of pendingScopes) {
1975
+ scope.___creating = 0;
1976
+ }
1977
+ pendingScopes = [];
1981
1978
  }
1982
1979
  var runRender = (render) => render.___signal(render.___scope, render.___value);
1983
1980
  var enableCatch = () => {
@@ -2081,7 +2078,7 @@ var compat = {
2081
2078
  if (Array.isArray(value2) && typeof value2[0] === "string") {
2082
2079
  return getRegisteredWithScope(
2083
2080
  value2[0],
2084
- value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
2081
+ value2.length === 2 && self[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
2085
2082
  );
2086
2083
  }
2087
2084
  return value2;
@@ -2226,6 +2223,8 @@ export {
2226
2223
  attrsEvents,
2227
2224
  awaitTag,
2228
2225
  classAttr,
2226
+ classItem,
2227
+ classItems,
2229
2228
  compat,
2230
2229
  conditional,
2231
2230
  conditionalClosure,
@@ -2278,6 +2277,9 @@ export {
2278
2277
  setTagVarChange,
2279
2278
  state,
2280
2279
  styleAttr,
2280
+ styleItem,
2281
+ styleItemValue,
2282
+ styleItems,
2281
2283
  tagVarSignal,
2282
2284
  tagVarSignalChange,
2283
2285
  textContent,
@@ -108,48 +108,44 @@ function* attrTagIterator() {
108
108
  }
109
109
 
110
110
  // src/common/helpers.ts
111
- function classValue(value) {
112
- return toDelimitedString(value, " ", stringifyClassObject);
111
+ function classValue(classValue2) {
112
+ return toDelimitedString(classValue2, " ", stringifyClassObject);
113
113
  }
114
114
  function stringifyClassObject(name, value) {
115
115
  return value ? name : "";
116
116
  }
117
- function styleValue(value) {
118
- return toDelimitedString(value, ";", stringifyStyleObject);
117
+ function styleValue(styleValue2) {
118
+ return toDelimitedString(styleValue2, ";", stringifyStyleObject);
119
119
  }
120
120
  function stringifyStyleObject(name, value) {
121
- return value || value === 0 ? `${name}:${typeof value === "number" && value && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
121
+ 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}` : "";
122
122
  }
123
123
  function toDelimitedString(val, delimiter, stringify) {
124
- switch (typeof val) {
125
- case "string":
126
- return val;
127
- case "object":
128
- if (val !== null) {
129
- let result = "";
130
- let curDelimiter = "";
131
- if (Array.isArray(val)) {
132
- for (const v of val) {
133
- const part = toDelimitedString(v, delimiter, stringify);
134
- if (part !== "") {
135
- result += curDelimiter + part;
136
- curDelimiter = delimiter;
137
- }
138
- }
139
- } else {
140
- for (const name in val) {
141
- const v = val[name];
142
- const part = stringify(name, v);
143
- if (part !== "") {
144
- result += curDelimiter + part;
145
- curDelimiter = delimiter;
146
- }
147
- }
124
+ let str = "";
125
+ let sep = "";
126
+ let part;
127
+ if (val) {
128
+ if (typeof val !== "object") {
129
+ str += val;
130
+ } else if (Array.isArray(val)) {
131
+ for (const v of val) {
132
+ part = toDelimitedString(v, delimiter, stringify);
133
+ if (part) {
134
+ str += sep + part;
135
+ sep = delimiter;
136
+ }
137
+ }
138
+ } else {
139
+ for (const name in val) {
140
+ part = stringify(name, val[name]);
141
+ if (part) {
142
+ str += sep + part;
143
+ sep = delimiter;
148
144
  }
149
- return result;
150
145
  }
146
+ }
151
147
  }
152
- return "";
148
+ return str;
153
149
  }
154
150
  function isEventHandler(name) {
155
151
  return /^on[A-Z-]/.test(name);
@@ -249,7 +245,7 @@ var WALKER_RUNTIME_CODE = true ? (
249
245
  129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,
250
246
  ),
251
247
  ) =>
252
- (self[runtimeId][renderId] = {
248
+ doc = (self[runtimeId][renderId] = {
253
249
  i: prefix,
254
250
  d: doc,
255
251
  l: lookup,
@@ -257,7 +253,7 @@ var WALKER_RUNTIME_CODE = true ? (
257
253
  x() {},
258
254
  w(node, op, id) {
259
255
  while ((node = walker.nextNode())) {
260
- this.x(
256
+ doc.x(
261
257
  (op =
262
258
  (op = node.data) &&
263
259
  !op.indexOf(prefix) &&
@@ -274,7 +270,7 @@ var WALKER_RUNTIME_CODE = true ? (
274
270
  })),
275
271
  self[runtimeId]
276
272
  ))`
277
- ) : `(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))`;
273
+ ) : `(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]))`;
278
274
  var REORDER_RUNTIME_CODE = true ? (
279
275
  /* js */
280
276
  `((runtime) => {
@@ -23,48 +23,44 @@ function* attrTagIterator() {
23
23
  }
24
24
 
25
25
  // src/common/helpers.ts
26
- function classValue(value) {
27
- return toDelimitedString(value, " ", stringifyClassObject);
26
+ function classValue(classValue2) {
27
+ return toDelimitedString(classValue2, " ", stringifyClassObject);
28
28
  }
29
29
  function stringifyClassObject(name, value) {
30
30
  return value ? name : "";
31
31
  }
32
- function styleValue(value) {
33
- return toDelimitedString(value, ";", stringifyStyleObject);
32
+ function styleValue(styleValue2) {
33
+ return toDelimitedString(styleValue2, ";", stringifyStyleObject);
34
34
  }
35
35
  function stringifyStyleObject(name, value) {
36
- return value || value === 0 ? `${name}:${typeof value === "number" && value && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
36
+ 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}` : "";
37
37
  }
38
38
  function toDelimitedString(val, delimiter, stringify) {
39
- switch (typeof val) {
40
- case "string":
41
- return val;
42
- case "object":
43
- if (val !== null) {
44
- let result = "";
45
- let curDelimiter = "";
46
- if (Array.isArray(val)) {
47
- for (const v of val) {
48
- const part = toDelimitedString(v, delimiter, stringify);
49
- if (part !== "") {
50
- result += curDelimiter + part;
51
- curDelimiter = delimiter;
52
- }
53
- }
54
- } else {
55
- for (const name in val) {
56
- const v = val[name];
57
- const part = stringify(name, v);
58
- if (part !== "") {
59
- result += curDelimiter + part;
60
- curDelimiter = delimiter;
61
- }
62
- }
39
+ let str = "";
40
+ let sep = "";
41
+ let part;
42
+ if (val) {
43
+ if (typeof val !== "object") {
44
+ str += val;
45
+ } else if (Array.isArray(val)) {
46
+ for (const v of val) {
47
+ part = toDelimitedString(v, delimiter, stringify);
48
+ if (part) {
49
+ str += sep + part;
50
+ sep = delimiter;
51
+ }
52
+ }
53
+ } else {
54
+ for (const name in val) {
55
+ part = stringify(name, val[name]);
56
+ if (part) {
57
+ str += sep + part;
58
+ sep = delimiter;
63
59
  }
64
- return result;
65
60
  }
61
+ }
66
62
  }
67
- return "";
63
+ return str;
68
64
  }
69
65
  function isEventHandler(name) {
70
66
  return /^on[A-Z-]/.test(name);
@@ -164,7 +160,7 @@ var WALKER_RUNTIME_CODE = true ? (
164
160
  129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,
165
161
  ),
166
162
  ) =>
167
- (self[runtimeId][renderId] = {
163
+ doc = (self[runtimeId][renderId] = {
168
164
  i: prefix,
169
165
  d: doc,
170
166
  l: lookup,
@@ -172,7 +168,7 @@ var WALKER_RUNTIME_CODE = true ? (
172
168
  x() {},
173
169
  w(node, op, id) {
174
170
  while ((node = walker.nextNode())) {
175
- this.x(
171
+ doc.x(
176
172
  (op =
177
173
  (op = node.data) &&
178
174
  !op.indexOf(prefix) &&
@@ -189,7 +185,7 @@ var WALKER_RUNTIME_CODE = true ? (
189
185
  })),
190
186
  self[runtimeId]
191
187
  ))`
192
- ) : `(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))`;
188
+ ) : `(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]))`;
193
189
  var REORDER_RUNTIME_CODE = true ? (
194
190
  /* js */
195
191
  `((runtime) => {
package/dist/dom/dom.d.ts CHANGED
@@ -2,7 +2,12 @@ import { type Accessor, type Scope } from "../common/types";
2
2
  export declare function attr(element: Element, name: string, value: unknown): void;
3
3
  export declare function setAttribute(element: Element, name: string, value: string | undefined): void;
4
4
  export declare function classAttr(element: Element, value: unknown): void;
5
+ export declare function classItems(element: Element, items: Record<string, unknown>): void;
6
+ export declare function classItem(element: Element, name: string, value: unknown): void;
5
7
  export declare function styleAttr(element: Element, value: unknown): void;
8
+ export declare function styleItems(element: HTMLElement, items: Record<string, unknown>): void;
9
+ export declare function styleItem(element: HTMLElement, name: string, value: unknown): void;
10
+ export declare function styleItemValue(value: unknown): unknown;
6
11
  export declare function data(node: Text | Comment, value: unknown): void;
7
12
  export declare function textContent(node: ParentNode, value: unknown): void;
8
13
  export declare function attrs(scope: Scope, nodeAccessor: Accessor, nextAttrs: Record<string, unknown>): void;
@@ -4,6 +4,7 @@ type ExecFn<S extends Scope = Scope> = (scope: S, arg?: any) => void;
4
4
  export declare const caughtError: WeakSet<unknown[]>;
5
5
  export declare const placeholderShown: WeakSet<unknown[]>;
6
6
  export declare let pendingEffects: unknown[];
7
+ export declare let pendingScopes: Scope[];
7
8
  export declare let rendering: undefined | 0 | 1;
8
9
  export declare function queueRender<T>(scope: Scope, signal: Signal<T>, signalKey: number, value?: T, scopeKey?: number): void;
9
10
  export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
@@ -1,7 +1,6 @@
1
1
  import type { BranchScope, Scope } from "../common/types";
2
2
  export declare function createScope($global: Scope["$global"], closestBranch?: BranchScope): Scope;
3
3
  export declare function skipScope(scope: Scope): number;
4
- export declare function finishPendingScopes(): void;
5
4
  export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
6
5
  export declare function destroyBranch(branch: BranchScope): void;
7
6
  export declare function removeAndDestroyBranch(branch: BranchScope): void;
package/dist/dom.d.ts CHANGED
@@ -4,7 +4,7 @@ export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
4
4
  export { compat } from "./dom/compat";
5
5
  export { awaitTag, conditional, createTry, dynamicTag, loopIn, loopOf, loopTo, } from "./dom/control-flow";
6
6
  export { controllable_detailsOrDialog_open, controllable_detailsOrDialog_open_effect, controllable_input_checked, controllable_input_checked_effect, controllable_input_checkedValue, controllable_input_checkedValue_effect, controllable_input_value, controllable_input_value_effect, controllable_select_value, controllable_select_value_effect, controllable_textarea_value, controllable_textarea_value_effect, } from "./dom/controllable";
7
- export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, textContent, } from "./dom/dom";
7
+ export { attr, attrs, attrsEvents, classAttr, classItem, classItems, data, html, lifecycle, partialAttrs, props, styleAttr, styleItem, styleItems, styleItemValue, textContent, } from "./dom/dom";
8
8
  export { on } from "./dom/event";
9
9
  export { enableCatch, run } from "./dom/queue";
10
10
  export { createContent, createRenderer, registerContent } from "./dom/renderer";