@marko/runtime-tags 0.1.16 → 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 {};
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,
@@ -57,6 +59,7 @@ __export(dom_exports, {
57
59
  nextTagId: () => nextTagId,
58
60
  nodeRef: () => nodeRef,
59
61
  on: () => on,
62
+ partialAttrs: () => partialAttrs,
60
63
  prepare: () => prepare,
61
64
  props: () => props,
62
65
  queueControllableSource: () => queueControllableSource,
@@ -75,6 +78,30 @@ __export(dom_exports, {
75
78
  });
76
79
  module.exports = __toCommonJS(dom_exports);
77
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
+
78
105
  // src/common/for.ts
79
106
  function forIn(obj, cb) {
80
107
  for (const key in obj) {
@@ -484,12 +511,29 @@ function data(node, value2) {
484
511
  }
485
512
  function attrs(scope, elementAccessor, nextAttrs) {
486
513
  const element = scope[elementAccessor];
487
- let events;
488
514
  for (const { name } of element.attributes) {
489
515
  if (!(nextAttrs && name in nextAttrs)) {
490
516
  element.removeAttribute(name);
491
517
  }
492
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];
493
537
  for (const name in nextAttrs) {
494
538
  const value2 = nextAttrs[name];
495
539
  switch (name) {
@@ -1,3 +1,27 @@
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
+
1
25
  // src/common/for.ts
2
26
  function forIn(obj, cb) {
3
27
  for (const key in obj) {
@@ -407,12 +431,29 @@ function data(node, value2) {
407
431
  }
408
432
  function attrs(scope, elementAccessor, nextAttrs) {
409
433
  const element = scope[elementAccessor];
410
- let events;
411
434
  for (const { name } of element.attributes) {
412
435
  if (!(nextAttrs && name in nextAttrs)) {
413
436
  element.removeAttribute(name);
414
437
  }
415
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];
416
457
  for (const name in nextAttrs) {
417
458
  const value2 = nextAttrs[name];
418
459
  switch (name) {
@@ -1595,6 +1636,8 @@ function mount(input = {}, reference, position) {
1595
1636
  }
1596
1637
  export {
1597
1638
  attr,
1639
+ attrTag,
1640
+ attrTags,
1598
1641
  attrs,
1599
1642
  attrsEvents,
1600
1643
  changeHandler,
@@ -1631,6 +1674,7 @@ export {
1631
1674
  nextTagId,
1632
1675
  nodeRef,
1633
1676
  on,
1677
+ partialAttrs,
1634
1678
  prepare,
1635
1679
  props,
1636
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,
@@ -47,6 +49,7 @@ __export(html_exports, {
47
49
  nextTagId: () => nextTagId,
48
50
  nodeRef: () => nodeRef,
49
51
  normalizeDynamicRenderer: () => normalizeDynamicRenderer,
52
+ partialAttrs: () => partialAttrs,
50
53
  peekNextScope: () => peekNextScope,
51
54
  register: () => register2,
52
55
  styleAttr: () => styleAttr,
@@ -60,6 +63,30 @@ __export(html_exports, {
60
63
  });
61
64
  module.exports = __toCommonJS(html_exports);
62
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
+
63
90
  // src/common/for.ts
64
91
  function forIn(obj, cb) {
65
92
  for (const key in obj) {
@@ -1975,6 +2002,13 @@ function attrs(data, elementAccessor, scopeId) {
1975
2002
  }
1976
2003
  return result;
1977
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
+ }
1978
2012
  function stringAttr(name, val) {
1979
2013
  return val && ` ${name}=${escapeAttrValue(val)}`;
1980
2014
  }
@@ -2068,7 +2102,7 @@ function dynamicTagArgs(scope, tag, args) {
2068
2102
  }
2069
2103
  return renderer(...args);
2070
2104
  }
2071
- var getDynamicRenderer = (tag) => tag.renderBody || tag;
2105
+ var getDynamicRenderer = normalizeDynamicRenderer;
2072
2106
  var createRenderer = (fn) => fn;
2073
2107
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
2074
2108
  getDynamicRenderer = newGetDynamicRenderer;
@@ -2264,10 +2298,12 @@ var ServerRenderResult = class {
2264
2298
  },
2265
2299
  (err) => {
2266
2300
  const socket = "socket" in stream && stream.socket;
2267
- if (typeof socket.destroySoon === "function") {
2301
+ if (socket && typeof socket.destroySoon === "function") {
2268
2302
  socket.destroySoon();
2269
2303
  }
2270
- stream.emit?.("error", err);
2304
+ if (!stream.emit?.("error", err)) {
2305
+ throw err;
2306
+ }
2271
2307
  },
2272
2308
  () => {
2273
2309
  stream.end();
@@ -2365,6 +2401,8 @@ var ServerRenderResult = class {
2365
2401
  // Annotate the CommonJS export names for ESM import in node:
2366
2402
  0 && (module.exports = {
2367
2403
  attr,
2404
+ attrTag,
2405
+ attrTags,
2368
2406
  attrs,
2369
2407
  classAttr,
2370
2408
  compat,
@@ -2391,6 +2429,7 @@ var ServerRenderResult = class {
2391
2429
  nextTagId,
2392
2430
  nodeRef,
2393
2431
  normalizeDynamicRenderer,
2432
+ partialAttrs,
2394
2433
  peekNextScope,
2395
2434
  register,
2396
2435
  styleAttr,
@@ -1,3 +1,27 @@
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
+
1
25
  // src/common/for.ts
2
26
  function forIn(obj, cb) {
3
27
  for (const key in obj) {
@@ -1913,6 +1937,13 @@ function attrs(data, elementAccessor, scopeId) {
1913
1937
  }
1914
1938
  return result;
1915
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
+ }
1916
1947
  function stringAttr(name, val) {
1917
1948
  return val && ` ${name}=${escapeAttrValue(val)}`;
1918
1949
  }
@@ -2006,7 +2037,7 @@ function dynamicTagArgs(scope, tag, args) {
2006
2037
  }
2007
2038
  return renderer(...args);
2008
2039
  }
2009
- var getDynamicRenderer = (tag) => tag.renderBody || tag;
2040
+ var getDynamicRenderer = normalizeDynamicRenderer;
2010
2041
  var createRenderer = (fn) => fn;
2011
2042
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
2012
2043
  getDynamicRenderer = newGetDynamicRenderer;
@@ -2202,10 +2233,12 @@ var ServerRenderResult = class {
2202
2233
  },
2203
2234
  (err) => {
2204
2235
  const socket = "socket" in stream && stream.socket;
2205
- if (typeof socket.destroySoon === "function") {
2236
+ if (socket && typeof socket.destroySoon === "function") {
2206
2237
  socket.destroySoon();
2207
2238
  }
2208
- stream.emit?.("error", err);
2239
+ if (!stream.emit?.("error", err)) {
2240
+ throw err;
2241
+ }
2209
2242
  },
2210
2243
  () => {
2211
2244
  stream.end();
@@ -2302,6 +2335,8 @@ var ServerRenderResult = class {
2302
2335
  };
2303
2336
  export {
2304
2337
  attr,
2338
+ attrTag,
2339
+ attrTags,
2305
2340
  attrs,
2306
2341
  classAttr,
2307
2342
  compat,
@@ -2328,6 +2363,7 @@ export {
2328
2363
  nextTagId,
2329
2364
  nodeRef,
2330
2365
  normalizeDynamicRenderer,
2366
+ partialAttrs,
2331
2367
  peekNextScope,
2332
2368
  register2 as register,
2333
2369
  styleAttr,
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,9 +1,10 @@
1
+ export { attrTag, attrTags } from "./common/attr-tag";
1
2
  export { forIn, forOf, forTo } from "./common/for";
2
3
  export type { Scope } from "./common/types";
3
4
  export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
4
5
  export { compat } from "./dom/compat";
5
6
  export { conditional, conditionalOnlyChild, inConditionalScope, inLoopScope, loopIn, loopOf, loopTo, } from "./dom/control-flow";
6
- 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";
7
8
  export { on } from "./dom/event";
8
9
  export { prepare, queueControllableSource, queueEffect, queueSource, run, runEffects, } from "./dom/queue";
9
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,
@@ -54,6 +56,7 @@ __export(dom_exports, {
54
56
  nextTagId: () => nextTagId,
55
57
  nodeRef: () => nodeRef,
56
58
  on: () => on,
59
+ partialAttrs: () => partialAttrs,
57
60
  prepare: () => prepare,
58
61
  props: () => props,
59
62
  queueControllableSource: () => queueControllableSource,
@@ -72,6 +75,18 @@ __export(dom_exports, {
72
75
  });
73
76
  module.exports = __toCommonJS(dom_exports);
74
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
+
75
90
  // src/common/for.ts
76
91
  function forIn(obj, cb) {
77
92
  for (let key in obj)
@@ -322,9 +337,21 @@ function data(node, value2) {
322
337
  node.data !== normalizedValue && (node.data = normalizedValue);
323
338
  }
324
339
  function attrs(scope, elementAccessor, nextAttrs) {
325
- let element = scope[elementAccessor], events;
340
+ let element = scope[elementAccessor];
326
341
  for (let { name } of element.attributes)
327
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];
328
355
  for (let name in nextAttrs) {
329
356
  let value2 = nextAttrs[name];
330
357
  switch (name) {
package/dist/dom.mjs CHANGED
@@ -1,3 +1,15 @@
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
+
1
13
  // src/common/for.ts
2
14
  function forIn(obj, cb) {
3
15
  for (let key in obj)
@@ -248,9 +260,21 @@ function data(node, value2) {
248
260
  node.data !== normalizedValue && (node.data = normalizedValue);
249
261
  }
250
262
  function attrs(scope, elementAccessor, nextAttrs) {
251
- let element = scope[elementAccessor], events;
263
+ let element = scope[elementAccessor];
252
264
  for (let { name } of element.attributes)
253
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];
254
278
  for (let name in nextAttrs) {
255
279
  let value2 = nextAttrs[name];
256
280
  switch (name) {
@@ -995,6 +1019,8 @@ function mount(input = {}, reference, position) {
995
1019
  }
996
1020
  export {
997
1021
  attr,
1022
+ attrTag,
1023
+ attrTags,
998
1024
  attrs,
999
1025
  attrsEvents,
1000
1026
  changeHandler,
@@ -1031,6 +1057,7 @@ export {
1031
1057
  nextTagId,
1032
1058
  nodeRef,
1033
1059
  on,
1060
+ partialAttrs,
1034
1061
  prepare,
1035
1062
  props,
1036
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,6 +1,7 @@
1
+ export { attrTag, attrTags } from "./common/attr-tag";
1
2
  export { forIn, forOf, forTo } from "./common/for";
2
3
  export { normalizeDynamicRenderer } from "./common/helpers";
3
- export { attr, attrs, classAttr, styleAttr } from "./html/attrs";
4
+ export { attr, attrs, classAttr, partialAttrs, styleAttr } from "./html/attrs";
4
5
  export { compat } from "./html/compat";
5
6
  export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
6
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,
@@ -44,6 +46,7 @@ __export(html_exports, {
44
46
  nextTagId: () => nextTagId,
45
47
  nodeRef: () => nodeRef,
46
48
  normalizeDynamicRenderer: () => normalizeDynamicRenderer,
49
+ partialAttrs: () => partialAttrs,
47
50
  peekNextScope: () => peekNextScope,
48
51
  register: () => register2,
49
52
  styleAttr: () => styleAttr,
@@ -57,6 +60,18 @@ __export(html_exports, {
57
60
  });
58
61
  module.exports = __toCommonJS(html_exports);
59
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
+
60
75
  // src/common/for.ts
61
76
  function forIn(obj, cb) {
62
77
  for (let key in obj)
@@ -1286,6 +1301,12 @@ function attrs(data, elementAccessor, scopeId) {
1286
1301
  }
1287
1302
  return events && elementAccessor && (ensureScopeWithId(scopeId)[elementAccessor + "~" /* EventAttributes */] = events), result;
1288
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
+ }
1289
1310
  function stringAttr(name, val) {
1290
1311
  return val && ` ${name}=${escapeAttrValue(val)}`;
1291
1312
  }
@@ -1338,7 +1359,7 @@ function dynamicTagArgs(scope, tag, args) {
1338
1359
  }
1339
1360
  return getDynamicRenderer(tag)(...args);
1340
1361
  }
1341
- var getDynamicRenderer = (tag) => tag.renderBody || tag, createRenderer = (fn) => fn;
1362
+ var getDynamicRenderer = normalizeDynamicRenderer, createRenderer = (fn) => fn;
1342
1363
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
1343
1364
  getDynamicRenderer = newGetDynamicRenderer, createRenderer = newCreateRenderer;
1344
1365
  }
@@ -1470,7 +1491,8 @@ var ServerRenderResult = class {
1470
1491
  },
1471
1492
  (err) => {
1472
1493
  let socket = "socket" in stream && stream.socket;
1473
- 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;
1474
1496
  },
1475
1497
  () => {
1476
1498
  stream.end();
@@ -1545,6 +1567,8 @@ var ServerRenderResult = class {
1545
1567
  // Annotate the CommonJS export names for ESM import in node:
1546
1568
  0 && (module.exports = {
1547
1569
  attr,
1570
+ attrTag,
1571
+ attrTags,
1548
1572
  attrs,
1549
1573
  classAttr,
1550
1574
  compat,
@@ -1571,6 +1595,7 @@ var ServerRenderResult = class {
1571
1595
  nextTagId,
1572
1596
  nodeRef,
1573
1597
  normalizeDynamicRenderer,
1598
+ partialAttrs,
1574
1599
  peekNextScope,
1575
1600
  register,
1576
1601
  styleAttr,
package/dist/html.mjs CHANGED
@@ -1,3 +1,15 @@
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
+
1
13
  // src/common/for.ts
2
14
  function forIn(obj, cb) {
3
15
  for (let key in obj)
@@ -1227,6 +1239,12 @@ function attrs(data, elementAccessor, scopeId) {
1227
1239
  }
1228
1240
  return events && elementAccessor && (ensureScopeWithId(scopeId)[elementAccessor + "~" /* EventAttributes */] = events), result;
1229
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
+ }
1230
1248
  function stringAttr(name, val) {
1231
1249
  return val && ` ${name}=${escapeAttrValue(val)}`;
1232
1250
  }
@@ -1279,7 +1297,7 @@ function dynamicTagArgs(scope, tag, args) {
1279
1297
  }
1280
1298
  return getDynamicRenderer(tag)(...args);
1281
1299
  }
1282
- var getDynamicRenderer = (tag) => tag.renderBody || tag, createRenderer = (fn) => fn;
1300
+ var getDynamicRenderer = normalizeDynamicRenderer, createRenderer = (fn) => fn;
1283
1301
  function patchDynamicTag(newGetDynamicRenderer, newCreateRenderer) {
1284
1302
  getDynamicRenderer = newGetDynamicRenderer, createRenderer = newCreateRenderer;
1285
1303
  }
@@ -1411,7 +1429,8 @@ var ServerRenderResult = class {
1411
1429
  },
1412
1430
  (err) => {
1413
1431
  let socket = "socket" in stream && stream.socket;
1414
- 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;
1415
1434
  },
1416
1435
  () => {
1417
1436
  stream.end();
@@ -1485,6 +1504,8 @@ var ServerRenderResult = class {
1485
1504
  };
1486
1505
  export {
1487
1506
  attr,
1507
+ attrTag,
1508
+ attrTags,
1488
1509
  attrs,
1489
1510
  classAttr,
1490
1511
  compat,
@@ -1511,6 +1532,7 @@ export {
1511
1532
  nextTagId,
1512
1533
  nodeRef,
1513
1534
  normalizeDynamicRenderer,
1535
+ partialAttrs,
1514
1536
  peekNextScope,
1515
1537
  register2 as register,
1516
1538
  styleAttr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",