@marko/runtime-tags 0.1.15 → 0.1.17

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.
@@ -0,0 +1,8 @@
1
+ type Attrs = Record<PropertyKey, unknown>;
2
+ type AttrTag = Attrs & {
3
+ [rest]: Attrs[];
4
+ };
5
+ declare const rest: unique symbol;
6
+ export declare function attrTag(attrs: Attrs): AttrTag;
7
+ export declare function attrTags(first: undefined | AttrTag, attrs: Attrs): AttrTag;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ type Falsy = undefined | null | false | 0 | "";
2
+ export declare function forIn<V extends {}>(obj: Falsy | V, cb: <K extends keyof V>(key: K, value: V[K]) => void): void;
3
+ export declare function forOf<T, V extends Iterable<T>>(list: Falsy | V, cb: (item: T, index: number) => void): void;
4
+ export declare function forTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void): void;
5
+ export {};
package/dist/debug/dom.js CHANGED
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var dom_exports = {};
22
22
  __export(dom_exports, {
23
23
  attr: () => attr,
24
+ attrTag: () => attrTag,
25
+ attrTags: () => attrTags,
24
26
  attrs: () => attrs,
25
27
  attrsEvents: () => attrsEvents,
26
28
  changeHandler: () => changeHandler,
@@ -38,6 +40,9 @@ __export(dom_exports, {
38
40
  dynamicClosure: () => dynamicClosure,
39
41
  dynamicSubscribers: () => dynamicSubscribers,
40
42
  dynamicTagAttrs: () => dynamicTagAttrs,
43
+ forIn: () => forIn,
44
+ forOf: () => forOf,
45
+ forTo: () => forTo,
41
46
  getAbortSignal: () => getAbortSignal,
42
47
  html: () => html,
43
48
  inChild: () => inChild,
@@ -54,6 +59,7 @@ __export(dom_exports, {
54
59
  nextTagId: () => nextTagId,
55
60
  nodeRef: () => nodeRef,
56
61
  on: () => on,
62
+ partialAttrs: () => partialAttrs,
57
63
  prepare: () => prepare,
58
64
  props: () => props,
59
65
  queueControllableSource: () => queueControllableSource,
@@ -72,6 +78,52 @@ __export(dom_exports, {
72
78
  });
73
79
  module.exports = __toCommonJS(dom_exports);
74
80
 
81
+ // src/common/attr-tag.ts
82
+ var empty = [];
83
+ var rest = true ? Symbol("Attribute Tag") : Symbol();
84
+ function attrTag(attrs2) {
85
+ attrs2[Symbol.iterator] = attrTagIterator;
86
+ attrs2[rest] = empty;
87
+ return attrs2;
88
+ }
89
+ function attrTags(first, attrs2) {
90
+ if (first) {
91
+ if (first[rest] === empty) {
92
+ first[rest] = [attrs2];
93
+ } else {
94
+ first[rest].push(attrs2);
95
+ }
96
+ return first;
97
+ }
98
+ return attrTag(attrs2);
99
+ }
100
+ function* attrTagIterator() {
101
+ yield this;
102
+ yield* this[rest];
103
+ }
104
+
105
+ // src/common/for.ts
106
+ function forIn(obj, cb) {
107
+ for (const key in obj) {
108
+ cb(key, obj[key]);
109
+ }
110
+ }
111
+ function forOf(list, cb) {
112
+ if (list) {
113
+ let i = 0;
114
+ for (const item of list) {
115
+ cb(item, i++);
116
+ }
117
+ }
118
+ }
119
+ function forTo(to, from, step, cb) {
120
+ const start = from || 0;
121
+ const delta = step || 1;
122
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
123
+ cb(start + i * delta);
124
+ }
125
+ }
126
+
75
127
  // src/dom/scope.ts
76
128
  var debugID = 0;
77
129
  function createScope($global) {
@@ -459,12 +511,29 @@ function data(node, value2) {
459
511
  }
460
512
  function attrs(scope, elementAccessor, nextAttrs) {
461
513
  const element = scope[elementAccessor];
462
- let events;
463
514
  for (const { name } of element.attributes) {
464
515
  if (!(nextAttrs && name in nextAttrs)) {
465
516
  element.removeAttribute(name);
466
517
  }
467
518
  }
519
+ attrsInternal(scope, elementAccessor, nextAttrs);
520
+ }
521
+ function partialAttrs(scope, elementAccessor, nextAttrs, skip) {
522
+ const element = scope[elementAccessor];
523
+ const partial = {};
524
+ for (const { name } of element.attributes) {
525
+ if (!skip[name] && !(nextAttrs && name in nextAttrs)) {
526
+ element.removeAttribute(name);
527
+ }
528
+ }
529
+ for (const key in nextAttrs) {
530
+ if (!skip[key]) partial[key] = nextAttrs[key];
531
+ }
532
+ attrsInternal(scope, elementAccessor, partial);
533
+ }
534
+ function attrsInternal(scope, elementAccessor, nextAttrs) {
535
+ let events;
536
+ const element = scope[elementAccessor];
468
537
  for (const name in nextAttrs) {
469
538
  const value2 = nextAttrs[name];
470
539
  switch (name) {
@@ -1049,33 +1118,34 @@ var emptyMarkerArray = [
1049
1118
  var emptyMap = /* @__PURE__ */ new Map();
1050
1119
  var emptyArray = [];
1051
1120
  function loopOf(nodeAccessor, renderer) {
1052
- return loop(nodeAccessor, renderer, (value2, cb) => {
1053
- const [all, by = bySecondArg] = value2;
1054
- let i = 0;
1055
- for (const item of all) {
1056
- cb(by(item, i), [item, i, all]);
1057
- i++;
1121
+ return loop(
1122
+ nodeAccessor,
1123
+ renderer,
1124
+ ([all, by = bySecondArg], cb) => {
1125
+ if (typeof by === "string") {
1126
+ forOf(
1127
+ all,
1128
+ (item, i) => cb(item[by], [item, i])
1129
+ );
1130
+ } else {
1131
+ forOf(all, (item, i) => cb(by(item, i), [item, i]));
1132
+ }
1058
1133
  }
1059
- });
1134
+ );
1060
1135
  }
1061
1136
  function loopIn(nodeAccessor, renderer) {
1062
- return loop(nodeAccessor, renderer, (value2, cb) => {
1063
- const [all, by = byFirstArg] = value2;
1064
- for (const key in all) {
1065
- const v = all[key];
1066
- cb(by(key, v), [key, v, all]);
1067
- }
1068
- });
1137
+ return loop(
1138
+ nodeAccessor,
1139
+ renderer,
1140
+ ([obj, by = byFirstArg], cb) => forIn(obj, (key, value2) => cb(by(key, value2), [key, value2]))
1141
+ );
1069
1142
  }
1070
1143
  function loopTo(nodeAccessor, renderer) {
1071
- return loop(nodeAccessor, renderer, (value2, cb) => {
1072
- const [to, from = 0, step = 1, by = byFirstArg] = value2;
1073
- const steps = (to - from) / step;
1074
- for (let i = 0; i <= steps; i++) {
1075
- const v = from + i * step;
1076
- cb(by(v), [v]);
1077
- }
1078
- });
1144
+ return loop(
1145
+ nodeAccessor,
1146
+ renderer,
1147
+ ([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
1148
+ );
1079
1149
  }
1080
1150
  function loop(nodeAccessor, renderer, forEach) {
1081
1151
  const loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */;
@@ -1,3 +1,49 @@
1
+ // src/common/attr-tag.ts
2
+ var empty = [];
3
+ var rest = true ? Symbol("Attribute Tag") : Symbol();
4
+ function attrTag(attrs2) {
5
+ attrs2[Symbol.iterator] = attrTagIterator;
6
+ attrs2[rest] = empty;
7
+ return attrs2;
8
+ }
9
+ function attrTags(first, attrs2) {
10
+ if (first) {
11
+ if (first[rest] === empty) {
12
+ first[rest] = [attrs2];
13
+ } else {
14
+ first[rest].push(attrs2);
15
+ }
16
+ return first;
17
+ }
18
+ return attrTag(attrs2);
19
+ }
20
+ function* attrTagIterator() {
21
+ yield this;
22
+ yield* this[rest];
23
+ }
24
+
25
+ // src/common/for.ts
26
+ function forIn(obj, cb) {
27
+ for (const key in obj) {
28
+ cb(key, obj[key]);
29
+ }
30
+ }
31
+ function forOf(list, cb) {
32
+ if (list) {
33
+ let i = 0;
34
+ for (const item of list) {
35
+ cb(item, i++);
36
+ }
37
+ }
38
+ }
39
+ function forTo(to, from, step, cb) {
40
+ const start = from || 0;
41
+ const delta = step || 1;
42
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
43
+ cb(start + i * delta);
44
+ }
45
+ }
46
+
1
47
  // src/dom/scope.ts
2
48
  var debugID = 0;
3
49
  function createScope($global) {
@@ -385,12 +431,29 @@ function data(node, value2) {
385
431
  }
386
432
  function attrs(scope, elementAccessor, nextAttrs) {
387
433
  const element = scope[elementAccessor];
388
- let events;
389
434
  for (const { name } of element.attributes) {
390
435
  if (!(nextAttrs && name in nextAttrs)) {
391
436
  element.removeAttribute(name);
392
437
  }
393
438
  }
439
+ attrsInternal(scope, elementAccessor, nextAttrs);
440
+ }
441
+ function partialAttrs(scope, elementAccessor, nextAttrs, skip) {
442
+ const element = scope[elementAccessor];
443
+ const partial = {};
444
+ for (const { name } of element.attributes) {
445
+ if (!skip[name] && !(nextAttrs && name in nextAttrs)) {
446
+ element.removeAttribute(name);
447
+ }
448
+ }
449
+ for (const key in nextAttrs) {
450
+ if (!skip[key]) partial[key] = nextAttrs[key];
451
+ }
452
+ attrsInternal(scope, elementAccessor, partial);
453
+ }
454
+ function attrsInternal(scope, elementAccessor, nextAttrs) {
455
+ let events;
456
+ const element = scope[elementAccessor];
394
457
  for (const name in nextAttrs) {
395
458
  const value2 = nextAttrs[name];
396
459
  switch (name) {
@@ -975,33 +1038,34 @@ var emptyMarkerArray = [
975
1038
  var emptyMap = /* @__PURE__ */ new Map();
976
1039
  var emptyArray = [];
977
1040
  function loopOf(nodeAccessor, renderer) {
978
- return loop(nodeAccessor, renderer, (value2, cb) => {
979
- const [all, by = bySecondArg] = value2;
980
- let i = 0;
981
- for (const item of all) {
982
- cb(by(item, i), [item, i, all]);
983
- i++;
1041
+ return loop(
1042
+ nodeAccessor,
1043
+ renderer,
1044
+ ([all, by = bySecondArg], cb) => {
1045
+ if (typeof by === "string") {
1046
+ forOf(
1047
+ all,
1048
+ (item, i) => cb(item[by], [item, i])
1049
+ );
1050
+ } else {
1051
+ forOf(all, (item, i) => cb(by(item, i), [item, i]));
1052
+ }
984
1053
  }
985
- });
1054
+ );
986
1055
  }
987
1056
  function loopIn(nodeAccessor, renderer) {
988
- return loop(nodeAccessor, renderer, (value2, cb) => {
989
- const [all, by = byFirstArg] = value2;
990
- for (const key in all) {
991
- const v = all[key];
992
- cb(by(key, v), [key, v, all]);
993
- }
994
- });
1057
+ return loop(
1058
+ nodeAccessor,
1059
+ renderer,
1060
+ ([obj, by = byFirstArg], cb) => forIn(obj, (key, value2) => cb(by(key, value2), [key, value2]))
1061
+ );
995
1062
  }
996
1063
  function loopTo(nodeAccessor, renderer) {
997
- return loop(nodeAccessor, renderer, (value2, cb) => {
998
- const [to, from = 0, step = 1, by = byFirstArg] = value2;
999
- const steps = (to - from) / step;
1000
- for (let i = 0; i <= steps; i++) {
1001
- const v = from + i * step;
1002
- cb(by(v), [v]);
1003
- }
1004
- });
1064
+ return loop(
1065
+ nodeAccessor,
1066
+ renderer,
1067
+ ([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
1068
+ );
1005
1069
  }
1006
1070
  function loop(nodeAccessor, renderer, forEach) {
1007
1071
  const loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */;
@@ -1572,6 +1636,8 @@ function mount(input = {}, reference, position) {
1572
1636
  }
1573
1637
  export {
1574
1638
  attr,
1639
+ attrTag,
1640
+ attrTags,
1575
1641
  attrs,
1576
1642
  attrsEvents,
1577
1643
  changeHandler,
@@ -1589,6 +1655,9 @@ export {
1589
1655
  dynamicClosure,
1590
1656
  dynamicSubscribers,
1591
1657
  dynamicTagAttrs,
1658
+ forIn,
1659
+ forOf,
1660
+ forTo,
1592
1661
  getAbortSignal,
1593
1662
  html,
1594
1663
  inChild,
@@ -1605,6 +1674,7 @@ export {
1605
1674
  nextTagId,
1606
1675
  nodeRef,
1607
1676
  on,
1677
+ partialAttrs,
1608
1678
  prepare,
1609
1679
  props,
1610
1680
  queueControllableSource,
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var html_exports = {};
22
22
  __export(html_exports, {
23
23
  attr: () => attr,
24
+ attrTag: () => attrTag,
25
+ attrTags: () => attrTags,
24
26
  attrs: () => attrs,
25
27
  classAttr: () => classAttr,
26
28
  compat: () => compat,
@@ -32,6 +34,9 @@ __export(html_exports, {
32
34
  escapeScript: () => escapeScript,
33
35
  escapeStyle: () => escapeStyle,
34
36
  escapeXML: () => escapeXML,
37
+ forIn: () => forIn,
38
+ forOf: () => forOf,
39
+ forTo: () => forTo,
35
40
  fork: () => fork,
36
41
  getScopeById: () => getScopeById,
37
42
  getStreamData: () => getStreamData,
@@ -44,6 +49,7 @@ __export(html_exports, {
44
49
  nextTagId: () => nextTagId,
45
50
  nodeRef: () => nodeRef,
46
51
  normalizeDynamicRenderer: () => normalizeDynamicRenderer,
52
+ partialAttrs: () => partialAttrs,
47
53
  peekNextScope: () => peekNextScope,
48
54
  register: () => register2,
49
55
  styleAttr: () => styleAttr,
@@ -57,6 +63,52 @@ __export(html_exports, {
57
63
  });
58
64
  module.exports = __toCommonJS(html_exports);
59
65
 
66
+ // src/common/attr-tag.ts
67
+ var empty = [];
68
+ var rest = true ? Symbol("Attribute Tag") : Symbol();
69
+ function attrTag(attrs2) {
70
+ attrs2[Symbol.iterator] = attrTagIterator;
71
+ attrs2[rest] = empty;
72
+ return attrs2;
73
+ }
74
+ function attrTags(first, attrs2) {
75
+ if (first) {
76
+ if (first[rest] === empty) {
77
+ first[rest] = [attrs2];
78
+ } else {
79
+ first[rest].push(attrs2);
80
+ }
81
+ return first;
82
+ }
83
+ return attrTag(attrs2);
84
+ }
85
+ function* attrTagIterator() {
86
+ yield this;
87
+ yield* this[rest];
88
+ }
89
+
90
+ // src/common/for.ts
91
+ function forIn(obj, cb) {
92
+ for (const key in obj) {
93
+ cb(key, obj[key]);
94
+ }
95
+ }
96
+ function forOf(list, cb) {
97
+ if (list) {
98
+ let i = 0;
99
+ for (const item of list) {
100
+ cb(item, i++);
101
+ }
102
+ }
103
+ }
104
+ function forTo(to, from, step, cb) {
105
+ const start = from || 0;
106
+ const delta = step || 1;
107
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
108
+ cb(start + i * delta);
109
+ }
110
+ }
111
+
60
112
  // src/common/helpers.ts
61
113
  function classValue(value) {
62
114
  return toDelimitedString(value, " ", stringifyClassObject);
@@ -1950,6 +2002,13 @@ function attrs(data, elementAccessor, scopeId) {
1950
2002
  }
1951
2003
  return result;
1952
2004
  }
2005
+ function partialAttrs(data, skip, elementAccessor, scopeId) {
2006
+ const partial = {};
2007
+ for (const key in data) {
2008
+ if (!skip[key]) partial[key] = data[key];
2009
+ }
2010
+ return attrs(partial, elementAccessor, scopeId);
2011
+ }
1953
2012
  function stringAttr(name, val) {
1954
2013
  return val && ` ${name}=${escapeAttrValue(val)}`;
1955
2014
  }
@@ -2043,7 +2102,7 @@ function dynamicTagArgs(scope, tag, args) {
2043
2102
  }
2044
2103
  return renderer(...args);
2045
2104
  }
2046
- var getDynamicRenderer = (tag) => tag.renderBody || tag;
2105
+ var getDynamicRenderer = normalizeDynamicRenderer;
2047
2106
  var createRenderer = (fn) => fn;
2048
2107
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
2049
2108
  getDynamicRenderer = newGetDynamicRenderer;
@@ -2239,10 +2298,12 @@ var ServerRenderResult = class {
2239
2298
  },
2240
2299
  (err) => {
2241
2300
  const socket = "socket" in stream && stream.socket;
2242
- if (typeof socket.destroySoon === "function") {
2301
+ if (socket && typeof socket.destroySoon === "function") {
2243
2302
  socket.destroySoon();
2244
2303
  }
2245
- stream.emit?.("error", err);
2304
+ if (!stream.emit?.("error", err)) {
2305
+ throw err;
2306
+ }
2246
2307
  },
2247
2308
  () => {
2248
2309
  stream.end();
@@ -2340,6 +2401,8 @@ var ServerRenderResult = class {
2340
2401
  // Annotate the CommonJS export names for ESM import in node:
2341
2402
  0 && (module.exports = {
2342
2403
  attr,
2404
+ attrTag,
2405
+ attrTags,
2343
2406
  attrs,
2344
2407
  classAttr,
2345
2408
  compat,
@@ -2351,6 +2414,9 @@ var ServerRenderResult = class {
2351
2414
  escapeScript,
2352
2415
  escapeStyle,
2353
2416
  escapeXML,
2417
+ forIn,
2418
+ forOf,
2419
+ forTo,
2354
2420
  fork,
2355
2421
  getScopeById,
2356
2422
  getStreamData,
@@ -2363,6 +2429,7 @@ var ServerRenderResult = class {
2363
2429
  nextTagId,
2364
2430
  nodeRef,
2365
2431
  normalizeDynamicRenderer,
2432
+ partialAttrs,
2366
2433
  peekNextScope,
2367
2434
  register,
2368
2435
  styleAttr,
@@ -1,3 +1,49 @@
1
+ // src/common/attr-tag.ts
2
+ var empty = [];
3
+ var rest = true ? Symbol("Attribute Tag") : Symbol();
4
+ function attrTag(attrs2) {
5
+ attrs2[Symbol.iterator] = attrTagIterator;
6
+ attrs2[rest] = empty;
7
+ return attrs2;
8
+ }
9
+ function attrTags(first, attrs2) {
10
+ if (first) {
11
+ if (first[rest] === empty) {
12
+ first[rest] = [attrs2];
13
+ } else {
14
+ first[rest].push(attrs2);
15
+ }
16
+ return first;
17
+ }
18
+ return attrTag(attrs2);
19
+ }
20
+ function* attrTagIterator() {
21
+ yield this;
22
+ yield* this[rest];
23
+ }
24
+
25
+ // src/common/for.ts
26
+ function forIn(obj, cb) {
27
+ for (const key in obj) {
28
+ cb(key, obj[key]);
29
+ }
30
+ }
31
+ function forOf(list, cb) {
32
+ if (list) {
33
+ let i = 0;
34
+ for (const item of list) {
35
+ cb(item, i++);
36
+ }
37
+ }
38
+ }
39
+ function forTo(to, from, step, cb) {
40
+ const start = from || 0;
41
+ const delta = step || 1;
42
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
43
+ cb(start + i * delta);
44
+ }
45
+ }
46
+
1
47
  // src/common/helpers.ts
2
48
  function classValue(value) {
3
49
  return toDelimitedString(value, " ", stringifyClassObject);
@@ -1891,6 +1937,13 @@ function attrs(data, elementAccessor, scopeId) {
1891
1937
  }
1892
1938
  return result;
1893
1939
  }
1940
+ function partialAttrs(data, skip, elementAccessor, scopeId) {
1941
+ const partial = {};
1942
+ for (const key in data) {
1943
+ if (!skip[key]) partial[key] = data[key];
1944
+ }
1945
+ return attrs(partial, elementAccessor, scopeId);
1946
+ }
1894
1947
  function stringAttr(name, val) {
1895
1948
  return val && ` ${name}=${escapeAttrValue(val)}`;
1896
1949
  }
@@ -1984,7 +2037,7 @@ function dynamicTagArgs(scope, tag, args) {
1984
2037
  }
1985
2038
  return renderer(...args);
1986
2039
  }
1987
- var getDynamicRenderer = (tag) => tag.renderBody || tag;
2040
+ var getDynamicRenderer = normalizeDynamicRenderer;
1988
2041
  var createRenderer = (fn) => fn;
1989
2042
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
1990
2043
  getDynamicRenderer = newGetDynamicRenderer;
@@ -2180,10 +2233,12 @@ var ServerRenderResult = class {
2180
2233
  },
2181
2234
  (err) => {
2182
2235
  const socket = "socket" in stream && stream.socket;
2183
- if (typeof socket.destroySoon === "function") {
2236
+ if (socket && typeof socket.destroySoon === "function") {
2184
2237
  socket.destroySoon();
2185
2238
  }
2186
- stream.emit?.("error", err);
2239
+ if (!stream.emit?.("error", err)) {
2240
+ throw err;
2241
+ }
2187
2242
  },
2188
2243
  () => {
2189
2244
  stream.end();
@@ -2280,6 +2335,8 @@ var ServerRenderResult = class {
2280
2335
  };
2281
2336
  export {
2282
2337
  attr,
2338
+ attrTag,
2339
+ attrTags,
2283
2340
  attrs,
2284
2341
  classAttr,
2285
2342
  compat,
@@ -2291,6 +2348,9 @@ export {
2291
2348
  escapeScript,
2292
2349
  escapeStyle,
2293
2350
  escapeXML,
2351
+ forIn,
2352
+ forOf,
2353
+ forTo,
2294
2354
  fork,
2295
2355
  getScopeById,
2296
2356
  getStreamData,
@@ -2303,6 +2363,7 @@ export {
2303
2363
  nextTagId,
2304
2364
  nodeRef,
2305
2365
  normalizeDynamicRenderer,
2366
+ partialAttrs,
2306
2367
  peekNextScope,
2307
2368
  register2 as register,
2308
2369
  styleAttr,
@@ -8,7 +8,7 @@ export declare function setConditionalRenderer<ChildScope extends Scope>(scope:
8
8
  export declare let conditionalOnlyChild: (nodeAccessor: Accessor, fn?: (scope: Scope) => void, getIntersection?: () => IntersectionSignal) => ValueSignal<Renderer | string | undefined>;
9
9
  export declare function setConditionalRendererOnlyChild(scope: Scope, nodeAccessor: Accessor, newRenderer: Renderer | string | undefined): void;
10
10
  export declare const emptyMarkerArray: Scope[];
11
- export declare function loopOf(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: [unknown, (...args: unknown[]) => unknown] | SignalOp) => void;
12
- export declare function loopIn(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: [unknown, (...args: unknown[]) => unknown] | SignalOp) => void;
13
- export declare function loopTo(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: [unknown, (...args: unknown[]) => unknown] | SignalOp) => void;
11
+ export declare function loopOf(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: SignalOp | [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
12
+ export declare function loopIn(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: SignalOp | [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
13
+ export declare function loopTo(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: SignalOp | [to: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
14
14
  export declare function inLoopScope(signal: IntersectionSignal, loopNodeAccessor: Accessor): (scope: Scope, op: SignalOp) => void;
package/dist/dom/dom.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare function classAttr(element: Element, value: unknown): void;
5
5
  export declare function styleAttr(element: Element, value: unknown): void;
6
6
  export declare function data(node: Text | Comment, value: unknown): void;
7
7
  export declare function attrs(scope: Scope, elementAccessor: Accessor, nextAttrs: Record<string, unknown>): void;
8
+ export declare function partialAttrs(scope: Scope, elementAccessor: Accessor, nextAttrs: Record<string, unknown>, skip: Record<string, 1>): void;
8
9
  export declare function attrsEvents(scope: Scope, elementAccessor: Accessor): void;
9
10
  export declare function html(scope: Scope, value: unknown, index: Accessor): void;
10
11
  export declare function props(scope: Scope, nodeIndex: number, index: number): void;
package/dist/dom.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ export { attrTag, attrTags } from "./common/attr-tag";
2
+ export { forIn, forOf, forTo } from "./common/for";
1
3
  export type { Scope } from "./common/types";
2
4
  export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
3
5
  export { compat } from "./dom/compat";
4
6
  export { conditional, conditionalOnlyChild, inConditionalScope, inLoopScope, loopIn, loopOf, loopTo, } from "./dom/control-flow";
5
- export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, props, styleAttr, } from "./dom/dom";
7
+ export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, } from "./dom/dom";
6
8
  export { on } from "./dom/event";
7
9
  export { prepare, queueControllableSource, queueEffect, queueSource, run, runEffects, } from "./dom/queue";
8
10
  export { createRenderer, createRendererWithOwner, dynamicTagAttrs, } from "./dom/renderer";
package/dist/dom.js CHANGED
@@ -18,6 +18,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
18
18
  var dom_exports = {};
19
19
  __export(dom_exports, {
20
20
  attr: () => attr,
21
+ attrTag: () => attrTag,
22
+ attrTags: () => attrTags,
21
23
  attrs: () => attrs,
22
24
  attrsEvents: () => attrsEvents,
23
25
  changeHandler: () => changeHandler,
@@ -35,6 +37,9 @@ __export(dom_exports, {
35
37
  dynamicClosure: () => dynamicClosure,
36
38
  dynamicSubscribers: () => dynamicSubscribers,
37
39
  dynamicTagAttrs: () => dynamicTagAttrs,
40
+ forIn: () => forIn,
41
+ forOf: () => forOf,
42
+ forTo: () => forTo,
38
43
  getAbortSignal: () => getAbortSignal,
39
44
  html: () => html,
40
45
  inChild: () => inChild,
@@ -51,6 +56,7 @@ __export(dom_exports, {
51
56
  nextTagId: () => nextTagId,
52
57
  nodeRef: () => nodeRef,
53
58
  on: () => on,
59
+ partialAttrs: () => partialAttrs,
54
60
  prepare: () => prepare,
55
61
  props: () => props,
56
62
  queueControllableSource: () => queueControllableSource,
@@ -69,6 +75,36 @@ __export(dom_exports, {
69
75
  });
70
76
  module.exports = __toCommonJS(dom_exports);
71
77
 
78
+ // src/common/attr-tag.ts
79
+ var empty = [], rest = Symbol();
80
+ function attrTag(attrs2) {
81
+ return attrs2[Symbol.iterator] = attrTagIterator, attrs2[rest] = empty, attrs2;
82
+ }
83
+ function attrTags(first, attrs2) {
84
+ return first ? (first[rest] === empty ? first[rest] = [attrs2] : first[rest].push(attrs2), first) : attrTag(attrs2);
85
+ }
86
+ function* attrTagIterator() {
87
+ yield this, yield* this[rest];
88
+ }
89
+
90
+ // src/common/for.ts
91
+ function forIn(obj, cb) {
92
+ for (let key in obj)
93
+ cb(key, obj[key]);
94
+ }
95
+ function forOf(list, cb) {
96
+ if (list) {
97
+ let i = 0;
98
+ for (let item of list)
99
+ cb(item, i++);
100
+ }
101
+ }
102
+ function forTo(to, from, step, cb) {
103
+ let start = from || 0, delta = step || 1;
104
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
105
+ cb(start + i * delta);
106
+ }
107
+
72
108
  // src/dom/scope.ts
73
109
  function createScope($global) {
74
110
  return {
@@ -301,9 +337,21 @@ function data(node, value2) {
301
337
  node.data !== normalizedValue && (node.data = normalizedValue);
302
338
  }
303
339
  function attrs(scope, elementAccessor, nextAttrs) {
304
- let element = scope[elementAccessor], events;
340
+ let element = scope[elementAccessor];
305
341
  for (let { name } of element.attributes)
306
342
  nextAttrs && name in nextAttrs || element.removeAttribute(name);
343
+ attrsInternal(scope, elementAccessor, nextAttrs);
344
+ }
345
+ function partialAttrs(scope, elementAccessor, nextAttrs, skip) {
346
+ let element = scope[elementAccessor], partial = {};
347
+ for (let { name } of element.attributes)
348
+ !skip[name] && !(nextAttrs && name in nextAttrs) && element.removeAttribute(name);
349
+ for (let key in nextAttrs)
350
+ skip[key] || (partial[key] = nextAttrs[key]);
351
+ attrsInternal(scope, elementAccessor, partial);
352
+ }
353
+ function attrsInternal(scope, elementAccessor, nextAttrs) {
354
+ let events, element = scope[elementAccessor];
307
355
  for (let name in nextAttrs) {
308
356
  let value2 = nextAttrs[name];
309
357
  switch (name) {
@@ -668,29 +716,30 @@ var emptyMarkerMap = /* @__PURE__ */ new Map([[Symbol(), getEmptyScope(void 0)]]
668
716
  /* @__PURE__ */ getEmptyScope(void 0)
669
717
  ], emptyMap = /* @__PURE__ */ new Map(), emptyArray = [];
670
718
  function loopOf(nodeAccessor, renderer) {
671
- return loop(nodeAccessor, renderer, (value2, cb) => {
672
- let [all, by = bySecondArg] = value2, i = 0;
673
- for (let item of all)
674
- cb(by(item, i), [item, i, all]), i++;
675
- });
719
+ return loop(
720
+ nodeAccessor,
721
+ renderer,
722
+ ([all, by = bySecondArg], cb) => {
723
+ typeof by == "string" ? forOf(
724
+ all,
725
+ (item, i) => cb(item[by], [item, i])
726
+ ) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
727
+ }
728
+ );
676
729
  }
677
730
  function loopIn(nodeAccessor, renderer) {
678
- return loop(nodeAccessor, renderer, (value2, cb) => {
679
- let [all, by = byFirstArg] = value2;
680
- for (let key in all) {
681
- let v = all[key];
682
- cb(by(key, v), [key, v, all]);
683
- }
684
- });
731
+ return loop(
732
+ nodeAccessor,
733
+ renderer,
734
+ ([obj, by = byFirstArg], cb) => forIn(obj, (key, value2) => cb(by(key, value2), [key, value2]))
735
+ );
685
736
  }
686
737
  function loopTo(nodeAccessor, renderer) {
687
- return loop(nodeAccessor, renderer, (value2, cb) => {
688
- let [to, from = 0, step = 1, by = byFirstArg] = value2, steps = (to - from) / step;
689
- for (let i = 0; i <= steps; i++) {
690
- let v = from + i * step;
691
- cb(by(v), [v]);
692
- }
693
- });
738
+ return loop(
739
+ nodeAccessor,
740
+ renderer,
741
+ ([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
742
+ );
694
743
  }
695
744
  function loop(nodeAccessor, renderer, forEach) {
696
745
  let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, closureSignals = renderer.c, params = renderer.e;
package/dist/dom.mjs CHANGED
@@ -1,3 +1,33 @@
1
+ // src/common/attr-tag.ts
2
+ var empty = [], rest = Symbol();
3
+ function attrTag(attrs2) {
4
+ return attrs2[Symbol.iterator] = attrTagIterator, attrs2[rest] = empty, attrs2;
5
+ }
6
+ function attrTags(first, attrs2) {
7
+ return first ? (first[rest] === empty ? first[rest] = [attrs2] : first[rest].push(attrs2), first) : attrTag(attrs2);
8
+ }
9
+ function* attrTagIterator() {
10
+ yield this, yield* this[rest];
11
+ }
12
+
13
+ // src/common/for.ts
14
+ function forIn(obj, cb) {
15
+ for (let key in obj)
16
+ cb(key, obj[key]);
17
+ }
18
+ function forOf(list, cb) {
19
+ if (list) {
20
+ let i = 0;
21
+ for (let item of list)
22
+ cb(item, i++);
23
+ }
24
+ }
25
+ function forTo(to, from, step, cb) {
26
+ let start = from || 0, delta = step || 1;
27
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
28
+ cb(start + i * delta);
29
+ }
30
+
1
31
  // src/dom/scope.ts
2
32
  function createScope($global) {
3
33
  return {
@@ -230,9 +260,21 @@ function data(node, value2) {
230
260
  node.data !== normalizedValue && (node.data = normalizedValue);
231
261
  }
232
262
  function attrs(scope, elementAccessor, nextAttrs) {
233
- let element = scope[elementAccessor], events;
263
+ let element = scope[elementAccessor];
234
264
  for (let { name } of element.attributes)
235
265
  nextAttrs && name in nextAttrs || element.removeAttribute(name);
266
+ attrsInternal(scope, elementAccessor, nextAttrs);
267
+ }
268
+ function partialAttrs(scope, elementAccessor, nextAttrs, skip) {
269
+ let element = scope[elementAccessor], partial = {};
270
+ for (let { name } of element.attributes)
271
+ !skip[name] && !(nextAttrs && name in nextAttrs) && element.removeAttribute(name);
272
+ for (let key in nextAttrs)
273
+ skip[key] || (partial[key] = nextAttrs[key]);
274
+ attrsInternal(scope, elementAccessor, partial);
275
+ }
276
+ function attrsInternal(scope, elementAccessor, nextAttrs) {
277
+ let events, element = scope[elementAccessor];
236
278
  for (let name in nextAttrs) {
237
279
  let value2 = nextAttrs[name];
238
280
  switch (name) {
@@ -597,29 +639,30 @@ var emptyMarkerMap = /* @__PURE__ */ new Map([[Symbol(), getEmptyScope(void 0)]]
597
639
  /* @__PURE__ */ getEmptyScope(void 0)
598
640
  ], emptyMap = /* @__PURE__ */ new Map(), emptyArray = [];
599
641
  function loopOf(nodeAccessor, renderer) {
600
- return loop(nodeAccessor, renderer, (value2, cb) => {
601
- let [all, by = bySecondArg] = value2, i = 0;
602
- for (let item of all)
603
- cb(by(item, i), [item, i, all]), i++;
604
- });
642
+ return loop(
643
+ nodeAccessor,
644
+ renderer,
645
+ ([all, by = bySecondArg], cb) => {
646
+ typeof by == "string" ? forOf(
647
+ all,
648
+ (item, i) => cb(item[by], [item, i])
649
+ ) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
650
+ }
651
+ );
605
652
  }
606
653
  function loopIn(nodeAccessor, renderer) {
607
- return loop(nodeAccessor, renderer, (value2, cb) => {
608
- let [all, by = byFirstArg] = value2;
609
- for (let key in all) {
610
- let v = all[key];
611
- cb(by(key, v), [key, v, all]);
612
- }
613
- });
654
+ return loop(
655
+ nodeAccessor,
656
+ renderer,
657
+ ([obj, by = byFirstArg], cb) => forIn(obj, (key, value2) => cb(by(key, value2), [key, value2]))
658
+ );
614
659
  }
615
660
  function loopTo(nodeAccessor, renderer) {
616
- return loop(nodeAccessor, renderer, (value2, cb) => {
617
- let [to, from = 0, step = 1, by = byFirstArg] = value2, steps = (to - from) / step;
618
- for (let i = 0; i <= steps; i++) {
619
- let v = from + i * step;
620
- cb(by(v), [v]);
621
- }
622
- });
661
+ return loop(
662
+ nodeAccessor,
663
+ renderer,
664
+ ([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
665
+ );
623
666
  }
624
667
  function loop(nodeAccessor, renderer, forEach) {
625
668
  let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, closureSignals = renderer.c, params = renderer.e;
@@ -976,6 +1019,8 @@ function mount(input = {}, reference, position) {
976
1019
  }
977
1020
  export {
978
1021
  attr,
1022
+ attrTag,
1023
+ attrTags,
979
1024
  attrs,
980
1025
  attrsEvents,
981
1026
  changeHandler,
@@ -993,6 +1038,9 @@ export {
993
1038
  dynamicClosure,
994
1039
  dynamicSubscribers,
995
1040
  dynamicTagAttrs,
1041
+ forIn,
1042
+ forOf,
1043
+ forTo,
996
1044
  getAbortSignal,
997
1045
  html,
998
1046
  inChild,
@@ -1009,6 +1057,7 @@ export {
1009
1057
  nextTagId,
1010
1058
  nodeRef,
1011
1059
  on,
1060
+ partialAttrs,
1012
1061
  prepare,
1013
1062
  props,
1014
1063
  queueControllableSource,
@@ -3,4 +3,5 @@ export declare function classAttr(val: unknown): string;
3
3
  export declare function styleAttr(val: unknown): string;
4
4
  export declare function attr(name: string, val: unknown): string;
5
5
  export declare function attrs(data: Record<string, unknown>, elementAccessor?: Accessor, scopeId?: number): string;
6
+ export declare function partialAttrs(data: Record<string, unknown>, skip: Record<string, 1>, elementAccessor?: Accessor, scopeId?: number): string;
6
7
  export declare function escapeAttrValue(str: string): string;
@@ -6,7 +6,7 @@ interface RenderBodyObject {
6
6
  }
7
7
  export declare function dynamicTagInput(scope: PartialScope, tag: unknown | string | ServerRenderer | RenderBodyObject, input: Record<string, unknown>, renderBody?: () => void, tagVar?: unknown): unknown;
8
8
  export declare function dynamicTagArgs(scope: PartialScope, tag: unknown | string | ServerRenderer | RenderBodyObject, args: unknown[]): unknown;
9
- declare let getDynamicRenderer: (tag: unknown | string | ServerRenderer | RenderBodyObject) => ServerRenderer;
9
+ declare let getDynamicRenderer: (value: any) => string | ServerRenderer | undefined;
10
10
  export declare let createRenderer: (fn: ServerRenderer) => ServerRenderer;
11
11
  export declare function patchDynamicTag(newGetDynamicRenderer: typeof getDynamicRenderer, newCreateRenderer: typeof createRenderer): void;
12
12
  export {};
package/dist/html.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ export { attrTag, attrTags } from "./common/attr-tag";
2
+ export { forIn, forOf, forTo } from "./common/for";
1
3
  export { normalizeDynamicRenderer } from "./common/helpers";
2
- export { attr, attrs, classAttr, styleAttr } from "./html/attrs";
4
+ export { attr, attrs, classAttr, partialAttrs, styleAttr } from "./html/attrs";
3
5
  export { compat } from "./html/compat";
4
6
  export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
5
7
  export { createRenderer, dynamicTagArgs, dynamicTagInput, } from "./html/dynamic-tag";
package/dist/html.js CHANGED
@@ -18,6 +18,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
18
18
  var html_exports = {};
19
19
  __export(html_exports, {
20
20
  attr: () => attr,
21
+ attrTag: () => attrTag,
22
+ attrTags: () => attrTags,
21
23
  attrs: () => attrs,
22
24
  classAttr: () => classAttr,
23
25
  compat: () => compat,
@@ -29,6 +31,9 @@ __export(html_exports, {
29
31
  escapeScript: () => escapeScript,
30
32
  escapeStyle: () => escapeStyle,
31
33
  escapeXML: () => escapeXML,
34
+ forIn: () => forIn,
35
+ forOf: () => forOf,
36
+ forTo: () => forTo,
32
37
  fork: () => fork,
33
38
  getScopeById: () => getScopeById,
34
39
  getStreamData: () => getStreamData,
@@ -41,6 +46,7 @@ __export(html_exports, {
41
46
  nextTagId: () => nextTagId,
42
47
  nodeRef: () => nodeRef,
43
48
  normalizeDynamicRenderer: () => normalizeDynamicRenderer,
49
+ partialAttrs: () => partialAttrs,
44
50
  peekNextScope: () => peekNextScope,
45
51
  register: () => register2,
46
52
  styleAttr: () => styleAttr,
@@ -54,6 +60,36 @@ __export(html_exports, {
54
60
  });
55
61
  module.exports = __toCommonJS(html_exports);
56
62
 
63
+ // src/common/attr-tag.ts
64
+ var empty = [], rest = Symbol();
65
+ function attrTag(attrs2) {
66
+ return attrs2[Symbol.iterator] = attrTagIterator, attrs2[rest] = empty, attrs2;
67
+ }
68
+ function attrTags(first, attrs2) {
69
+ return first ? (first[rest] === empty ? first[rest] = [attrs2] : first[rest].push(attrs2), first) : attrTag(attrs2);
70
+ }
71
+ function* attrTagIterator() {
72
+ yield this, yield* this[rest];
73
+ }
74
+
75
+ // src/common/for.ts
76
+ function forIn(obj, cb) {
77
+ for (let key in obj)
78
+ cb(key, obj[key]);
79
+ }
80
+ function forOf(list, cb) {
81
+ if (list) {
82
+ let i = 0;
83
+ for (let item of list)
84
+ cb(item, i++);
85
+ }
86
+ }
87
+ function forTo(to, from, step, cb) {
88
+ let start = from || 0, delta = step || 1;
89
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
90
+ cb(start + i * delta);
91
+ }
92
+
57
93
  // src/common/helpers.ts
58
94
  function classValue(value) {
59
95
  return toDelimitedString(value, " ", stringifyClassObject);
@@ -1265,6 +1301,12 @@ function attrs(data, elementAccessor, scopeId) {
1265
1301
  }
1266
1302
  return events && elementAccessor && (ensureScopeWithId(scopeId)[elementAccessor + "~" /* EventAttributes */] = events), result;
1267
1303
  }
1304
+ function partialAttrs(data, skip, elementAccessor, scopeId) {
1305
+ let partial = {};
1306
+ for (let key in data)
1307
+ skip[key] || (partial[key] = data[key]);
1308
+ return attrs(partial, elementAccessor, scopeId);
1309
+ }
1268
1310
  function stringAttr(name, val) {
1269
1311
  return val && ` ${name}=${escapeAttrValue(val)}`;
1270
1312
  }
@@ -1317,7 +1359,7 @@ function dynamicTagArgs(scope, tag, args) {
1317
1359
  }
1318
1360
  return getDynamicRenderer(tag)(...args);
1319
1361
  }
1320
- var getDynamicRenderer = (tag) => tag.renderBody || tag, createRenderer = (fn) => fn;
1362
+ var getDynamicRenderer = normalizeDynamicRenderer, createRenderer = (fn) => fn;
1321
1363
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
1322
1364
  getDynamicRenderer = newGetDynamicRenderer, createRenderer = newCreateRenderer;
1323
1365
  }
@@ -1449,7 +1491,8 @@ var ServerRenderResult = class {
1449
1491
  },
1450
1492
  (err) => {
1451
1493
  let socket = "socket" in stream && stream.socket;
1452
- typeof socket.destroySoon == "function" && socket.destroySoon(), stream.emit?.("error", err);
1494
+ if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err))
1495
+ throw err;
1453
1496
  },
1454
1497
  () => {
1455
1498
  stream.end();
@@ -1524,6 +1567,8 @@ var ServerRenderResult = class {
1524
1567
  // Annotate the CommonJS export names for ESM import in node:
1525
1568
  0 && (module.exports = {
1526
1569
  attr,
1570
+ attrTag,
1571
+ attrTags,
1527
1572
  attrs,
1528
1573
  classAttr,
1529
1574
  compat,
@@ -1535,6 +1580,9 @@ var ServerRenderResult = class {
1535
1580
  escapeScript,
1536
1581
  escapeStyle,
1537
1582
  escapeXML,
1583
+ forIn,
1584
+ forOf,
1585
+ forTo,
1538
1586
  fork,
1539
1587
  getScopeById,
1540
1588
  getStreamData,
@@ -1547,6 +1595,7 @@ var ServerRenderResult = class {
1547
1595
  nextTagId,
1548
1596
  nodeRef,
1549
1597
  normalizeDynamicRenderer,
1598
+ partialAttrs,
1550
1599
  peekNextScope,
1551
1600
  register,
1552
1601
  styleAttr,
package/dist/html.mjs CHANGED
@@ -1,3 +1,33 @@
1
+ // src/common/attr-tag.ts
2
+ var empty = [], rest = Symbol();
3
+ function attrTag(attrs2) {
4
+ return attrs2[Symbol.iterator] = attrTagIterator, attrs2[rest] = empty, attrs2;
5
+ }
6
+ function attrTags(first, attrs2) {
7
+ return first ? (first[rest] === empty ? first[rest] = [attrs2] : first[rest].push(attrs2), first) : attrTag(attrs2);
8
+ }
9
+ function* attrTagIterator() {
10
+ yield this, yield* this[rest];
11
+ }
12
+
13
+ // src/common/for.ts
14
+ function forIn(obj, cb) {
15
+ for (let key in obj)
16
+ cb(key, obj[key]);
17
+ }
18
+ function forOf(list, cb) {
19
+ if (list) {
20
+ let i = 0;
21
+ for (let item of list)
22
+ cb(item, i++);
23
+ }
24
+ }
25
+ function forTo(to, from, step, cb) {
26
+ let start = from || 0, delta = step || 1;
27
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
28
+ cb(start + i * delta);
29
+ }
30
+
1
31
  // src/common/helpers.ts
2
32
  function classValue(value) {
3
33
  return toDelimitedString(value, " ", stringifyClassObject);
@@ -1209,6 +1239,12 @@ function attrs(data, elementAccessor, scopeId) {
1209
1239
  }
1210
1240
  return events && elementAccessor && (ensureScopeWithId(scopeId)[elementAccessor + "~" /* EventAttributes */] = events), result;
1211
1241
  }
1242
+ function partialAttrs(data, skip, elementAccessor, scopeId) {
1243
+ let partial = {};
1244
+ for (let key in data)
1245
+ skip[key] || (partial[key] = data[key]);
1246
+ return attrs(partial, elementAccessor, scopeId);
1247
+ }
1212
1248
  function stringAttr(name, val) {
1213
1249
  return val && ` ${name}=${escapeAttrValue(val)}`;
1214
1250
  }
@@ -1261,7 +1297,7 @@ function dynamicTagArgs(scope, tag, args) {
1261
1297
  }
1262
1298
  return getDynamicRenderer(tag)(...args);
1263
1299
  }
1264
- var getDynamicRenderer = (tag) => tag.renderBody || tag, createRenderer = (fn) => fn;
1300
+ var getDynamicRenderer = normalizeDynamicRenderer, createRenderer = (fn) => fn;
1265
1301
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
1266
1302
  getDynamicRenderer = newGetDynamicRenderer, createRenderer = newCreateRenderer;
1267
1303
  }
@@ -1393,7 +1429,8 @@ var ServerRenderResult = class {
1393
1429
  },
1394
1430
  (err) => {
1395
1431
  let socket = "socket" in stream && stream.socket;
1396
- typeof socket.destroySoon == "function" && socket.destroySoon(), stream.emit?.("error", err);
1432
+ if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err))
1433
+ throw err;
1397
1434
  },
1398
1435
  () => {
1399
1436
  stream.end();
@@ -1467,6 +1504,8 @@ var ServerRenderResult = class {
1467
1504
  };
1468
1505
  export {
1469
1506
  attr,
1507
+ attrTag,
1508
+ attrTags,
1470
1509
  attrs,
1471
1510
  classAttr,
1472
1511
  compat,
@@ -1478,6 +1517,9 @@ export {
1478
1517
  escapeScript,
1479
1518
  escapeStyle,
1480
1519
  escapeXML,
1520
+ forIn,
1521
+ forOf,
1522
+ forTo,
1481
1523
  fork,
1482
1524
  getScopeById,
1483
1525
  getStreamData,
@@ -1490,6 +1532,7 @@ export {
1490
1532
  nextTagId,
1491
1533
  nodeRef,
1492
1534
  normalizeDynamicRenderer,
1535
+ partialAttrs,
1493
1536
  peekNextScope,
1494
1537
  register2 as register,
1495
1538
  styleAttr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",