@toyz/loom 0.4.0 → 0.6.0

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.
Files changed (113) hide show
  1. package/dist/app.d.ts +4 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +9 -9
  4. package/dist/app.js.map +1 -1
  5. package/dist/decorators/create.d.ts +16 -25
  6. package/dist/decorators/create.d.ts.map +1 -1
  7. package/dist/decorators/create.js +25 -34
  8. package/dist/decorators/create.js.map +1 -1
  9. package/dist/decorators/events.d.ts +10 -8
  10. package/dist/decorators/events.d.ts.map +1 -1
  11. package/dist/decorators/events.js +53 -43
  12. package/dist/decorators/events.js.map +1 -1
  13. package/dist/decorators/index.d.ts +1 -0
  14. package/dist/decorators/index.d.ts.map +1 -1
  15. package/dist/decorators/index.js +1 -0
  16. package/dist/decorators/index.js.map +1 -1
  17. package/dist/decorators/symbols.d.ts +2 -0
  18. package/dist/decorators/symbols.d.ts.map +1 -1
  19. package/dist/decorators/symbols.js +2 -0
  20. package/dist/decorators/symbols.js.map +1 -1
  21. package/dist/di/decorators.d.ts +15 -15
  22. package/dist/di/decorators.d.ts.map +1 -1
  23. package/dist/di/decorators.js +23 -33
  24. package/dist/di/decorators.js.map +1 -1
  25. package/dist/di/watch.d.ts +5 -20
  26. package/dist/di/watch.d.ts.map +1 -1
  27. package/dist/di/watch.js +5 -38
  28. package/dist/di/watch.js.map +1 -1
  29. package/dist/element/decorators.d.ts +26 -10
  30. package/dist/element/decorators.d.ts.map +1 -1
  31. package/dist/element/decorators.js +75 -31
  32. package/dist/element/decorators.js.map +1 -1
  33. package/dist/element/element.d.ts.map +1 -1
  34. package/dist/element/element.js +15 -3
  35. package/dist/element/element.js.map +1 -1
  36. package/dist/element/form.d.ts +63 -0
  37. package/dist/element/form.d.ts.map +1 -0
  38. package/dist/element/form.js +167 -0
  39. package/dist/element/form.js.map +1 -0
  40. package/dist/element/icon.d.ts +3 -3
  41. package/dist/element/icon.d.ts.map +1 -1
  42. package/dist/element/icon.js +131 -74
  43. package/dist/element/icon.js.map +1 -1
  44. package/dist/element/index.d.ts +8 -1
  45. package/dist/element/index.d.ts.map +1 -1
  46. package/dist/element/index.js +9 -1
  47. package/dist/element/index.js.map +1 -1
  48. package/dist/element/lazy.d.ts +31 -0
  49. package/dist/element/lazy.d.ts.map +1 -0
  50. package/dist/element/lazy.js +71 -0
  51. package/dist/element/lazy.js.map +1 -0
  52. package/dist/element/lifecycle.d.ts +27 -29
  53. package/dist/element/lifecycle.d.ts.map +1 -1
  54. package/dist/element/lifecycle.js +60 -79
  55. package/dist/element/lifecycle.js.map +1 -1
  56. package/dist/element/slots.d.ts +23 -0
  57. package/dist/element/slots.d.ts.map +1 -0
  58. package/dist/element/slots.js +54 -0
  59. package/dist/element/slots.js.map +1 -0
  60. package/dist/element/timing.d.ts +10 -7
  61. package/dist/element/timing.d.ts.map +1 -1
  62. package/dist/element/timing.js +67 -52
  63. package/dist/element/timing.js.map +1 -1
  64. package/dist/element/transition.d.ts +32 -0
  65. package/dist/element/transition.d.ts.map +1 -0
  66. package/dist/element/transition.js +70 -0
  67. package/dist/element/transition.js.map +1 -0
  68. package/dist/element/virtual.js +235 -194
  69. package/dist/element/virtual.js.map +1 -1
  70. package/dist/index.d.ts +3 -2
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +2 -1
  73. package/dist/index.js.map +1 -1
  74. package/dist/router/decorators.d.ts +9 -38
  75. package/dist/router/decorators.d.ts.map +1 -1
  76. package/dist/router/decorators.js +7 -52
  77. package/dist/router/decorators.js.map +1 -1
  78. package/dist/router/link.d.ts +4 -4
  79. package/dist/router/link.d.ts.map +1 -1
  80. package/dist/router/link.js +134 -72
  81. package/dist/router/link.js.map +1 -1
  82. package/dist/router/outlet.d.ts +2 -2
  83. package/dist/router/outlet.d.ts.map +1 -1
  84. package/dist/router/outlet.js +188 -138
  85. package/dist/router/outlet.js.map +1 -1
  86. package/dist/router/route-lifecycle.d.ts +2 -2
  87. package/dist/router/route-lifecycle.d.ts.map +1 -1
  88. package/dist/router/route-lifecycle.js +18 -8
  89. package/dist/router/route-lifecycle.js.map +1 -1
  90. package/dist/router/route.d.ts +1 -1
  91. package/dist/router/route.d.ts.map +1 -1
  92. package/dist/router/router.js +2 -2
  93. package/dist/router/router.js.map +1 -1
  94. package/dist/store/decorators.d.ts +32 -24
  95. package/dist/store/decorators.d.ts.map +1 -1
  96. package/dist/store/decorators.js +98 -117
  97. package/dist/store/decorators.js.map +1 -1
  98. package/dist/store/watch.d.ts +24 -11
  99. package/dist/store/watch.d.ts.map +1 -1
  100. package/dist/store/watch.js +43 -16
  101. package/dist/store/watch.js.map +1 -1
  102. package/dist/testing.d.ts +55 -0
  103. package/dist/testing.d.ts.map +1 -0
  104. package/dist/testing.js +99 -0
  105. package/dist/testing.js.map +1 -0
  106. package/dist/transform/transform.d.ts +7 -3
  107. package/dist/transform/transform.d.ts.map +1 -1
  108. package/dist/transform/transform.js +17 -9
  109. package/dist/transform/transform.js.map +1 -1
  110. package/dist/transform/typed.d.ts +1 -1
  111. package/dist/transform/typed.d.ts.map +1 -1
  112. package/dist/transform/typed.js.map +1 -1
  113. package/package.json +5 -1
@@ -1,57 +1,55 @@
1
1
  /**
2
- * Loom — Element lifecycle decorators
2
+ * Loom — Lifecycle decorators (TC39 Stage 3)
3
3
  *
4
- * @catch_ — Error boundary
5
- * @suspend — Async suspense
6
- * @mount — connectedCallback hook
7
- * @unmount — disconnectedCallback hook
4
+ * @catch_ — Wrap update() with a try/catch, render fallback on error
5
+ * @suspend — Show fallback until method resolves
6
+ * @mount — Run method on connectedCallback
7
+ * @unmount — Run method on disconnectedCallback
8
8
  */
9
- type CatchFn = (error: Error, element: any) => void;
9
+ /** Function called when update() throws */
10
+ type CatchFn = (error: unknown, element: HTMLElement & {
11
+ shadow: ShadowRoot;
12
+ }) => void;
10
13
  /**
11
- * Error boundary. Wraps lifecycle methods with try/catch, renders fallback on error.
12
- * Named catch_ since `catch` is reserved.
14
+ * Error-boundary decorator. If update() throws, catches the error
15
+ * and calls the handler with (error, element).
13
16
  *
14
17
  * ```ts
15
- * @component("my-widget")
16
- * @catch_((err, el) => {
17
- * el.shadow.replaceChildren(<div>{err.message}</div>);
18
- * })
19
- * class MyWidget extends LoomElement { ... }
18
+ * @component("my-page")
19
+ * @catch_((err, el) => { el.shadow.innerHTML = `<p>Error: ${err}</p>`; })
20
+ * class MyPage extends LoomElement { ... }
20
21
  * ```
21
22
  */
22
- export declare const catch_: (handler: CatchFn) => (ctor: any) => void;
23
+ export declare function catch_(handler: CatchFn): (value: Function, _context: ClassDecoratorContext) => void;
23
24
  /**
24
- * Async suspense. Wraps async methods to auto-manage loading/error state.
25
- * Expects the component to have @reactive loading and @reactive error fields.
25
+ * Suspend decorator. Wraps an async method with loading/error state
26
+ * management. Sets `this.loading = true` before the call, and
27
+ * `this.loading = false` after. Captures errors on `this.error`.
26
28
  *
29
+ * Use as `@suspend()` on a method:
27
30
  * ```ts
28
31
  * @suspend()
29
- * async fetchUser() {
30
- * const res = await fetch(`/api/users/${this.userId}`);
31
- * this.user = await res.json();
32
- * }
32
+ * async fetchData() { this.result = await api.get(); }
33
33
  * ```
34
34
  */
35
- export declare function suspend(): (_target: any, _key: string, desc: PropertyDescriptor) => void;
35
+ export declare function suspend(): (method: Function, context: ClassMethodDecoratorContext) => (this: any, ...args: any[]) => Promise<any>;
36
36
  /**
37
- * Lifecycle: runs when element connects to the DOM.
38
- * Multiple @mount methods per class allowed. No need to call super.
37
+ * Run decorated method when the element connects to the DOM.
39
38
  *
40
39
  * ```ts
41
40
  * @mount
42
- * setup() { this.ctx = this.canvas.getContext("2d"); }
41
+ * setup() { this.shadow.adoptedStyleSheets = [myStyles]; }
43
42
  * ```
44
43
  */
45
- export declare function mount(target: any, key: string): void;
44
+ export declare function mount(method: Function, context: ClassMethodDecoratorContext): void;
46
45
  /**
47
- * Lifecycle: runs when element disconnects from the DOM.
48
- * Multiple @unmount methods per class allowed. Runs BEFORE track() cleanup.
46
+ * Run decorated method when the element disconnects from the DOM.
49
47
  *
50
48
  * ```ts
51
49
  * @unmount
52
- * saveState() { localStorage.setItem("state", JSON.stringify(this.state)); }
50
+ * teardown() { console.log("removed!"); }
53
51
  * ```
54
52
  */
55
- export declare function unmount(target: any, key: string): void;
53
+ export declare function unmount(method: Function, context: ClassMethodDecoratorContext): void;
56
54
  export {};
57
55
  //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/element/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,YAEA,OAAO,YACR,GAAG,SA4BjB,CAAC;AAEL;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,KACb,SAAS,GAAG,EAAE,MAAM,MAAM,EAAE,MAAM,kBAAkB,UAkB7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAMtD"}
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/element/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,2CAA2C;AAC3C,KAAK,OAAO,GAAG,CACb,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,GAAG;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,KAC1C,IAAI,CAAC;AAEV;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,IAC7B,OAAO,QAAQ,EAAE,UAAU,qBAAqB,UAWzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,KACb,QAAQ,QAAQ,EAAE,SAAS,2BAA2B,MAC3C,MAAM,GAAG,EAAE,GAAG,MAAM,GAAG,EAAE,kBAkB7C;AAGD;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,QAO3E;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,QAQ7E"}
@@ -1,120 +1,101 @@
1
1
  /**
2
- * Loom — Element lifecycle decorators
2
+ * Loom — Lifecycle decorators (TC39 Stage 3)
3
3
  *
4
- * @catch_ — Error boundary
5
- * @suspend — Async suspense
6
- * @mount — connectedCallback hook
7
- * @unmount — disconnectedCallback hook
4
+ * @catch_ — Wrap update() with a try/catch, render fallback on error
5
+ * @suspend — Show fallback until method resolves
6
+ * @mount — Run method on connectedCallback
7
+ * @unmount — Run method on disconnectedCallback
8
8
  */
9
- import { CATCH_HANDLER } from "../decorators/symbols";
9
+ import { CONNECT_HOOKS } from "../decorators/symbols";
10
10
  /**
11
- * Error boundary. Wraps lifecycle methods with try/catch, renders fallback on error.
12
- * Named catch_ since `catch` is reserved.
11
+ * Error-boundary decorator. If update() throws, catches the error
12
+ * and calls the handler with (error, element).
13
13
  *
14
14
  * ```ts
15
- * @component("my-widget")
16
- * @catch_((err, el) => {
17
- * el.shadow.replaceChildren(<div>{err.message}</div>);
18
- * })
19
- * class MyWidget extends LoomElement { ... }
15
+ * @component("my-page")
16
+ * @catch_((err, el) => { el.shadow.innerHTML = `<p>Error: ${err}</p>`; })
17
+ * class MyPage extends LoomElement { ... }
20
18
  * ```
21
19
  */
22
- export const catch_ = (function () {
23
- // Manual implementation since createDecorator import would add unnecessary dep
24
- return (handler) => {
25
- return (ctor) => {
26
- ctor[CATCH_HANDLER] = handler;
27
- // Wrap update()
28
- const origUpdate = ctor.prototype.update;
29
- if (origUpdate) {
30
- ctor.prototype.update = function () {
31
- try {
32
- return origUpdate.call(this);
33
- }
34
- catch (err) {
35
- handler(err, this);
36
- }
37
- };
20
+ export function catch_(handler) {
21
+ return (value, _context) => {
22
+ const origUpdate = value.prototype.update;
23
+ value.prototype.update = function () {
24
+ try {
25
+ return origUpdate.call(this);
38
26
  }
39
- // Wrap connectedCallback()
40
- const origConnect = ctor.prototype.connectedCallback;
41
- if (origConnect) {
42
- ctor.prototype.connectedCallback = function () {
43
- try {
44
- origConnect.call(this);
45
- }
46
- catch (err) {
47
- handler(err, this);
48
- }
49
- };
27
+ catch (err) {
28
+ handler(err, this);
29
+ return null;
50
30
  }
51
31
  };
52
32
  };
53
- })();
33
+ }
54
34
  /**
55
- * Async suspense. Wraps async methods to auto-manage loading/error state.
56
- * Expects the component to have @reactive loading and @reactive error fields.
35
+ * Suspend decorator. Wraps an async method with loading/error state
36
+ * management. Sets `this.loading = true` before the call, and
37
+ * `this.loading = false` after. Captures errors on `this.error`.
57
38
  *
39
+ * Use as `@suspend()` on a method:
58
40
  * ```ts
59
41
  * @suspend()
60
- * async fetchUser() {
61
- * const res = await fetch(`/api/users/${this.userId}`);
62
- * this.user = await res.json();
63
- * }
42
+ * async fetchData() { this.result = await api.get(); }
64
43
  * ```
65
44
  */
66
45
  export function suspend() {
67
- return (_target, _key, desc) => {
68
- const orig = desc.value;
69
- desc.value = async function (...args) {
46
+ return (method, context) => {
47
+ return function (...args) {
70
48
  this.loading = true;
71
49
  this.error = null;
72
- try {
73
- const result = await orig.apply(this, args);
50
+ this.scheduleUpdate?.();
51
+ return Promise.resolve()
52
+ .then(() => method.call(this, ...args))
53
+ .then((result) => {
54
+ this.loading = false;
55
+ this.scheduleUpdate?.();
74
56
  return result;
75
- }
76
- catch (err) {
77
- this.error = err;
78
- const handler = this.constructor[CATCH_HANDLER];
79
- if (handler)
80
- handler(err, this);
81
- }
82
- finally {
57
+ })
58
+ .catch((err) => {
83
59
  this.loading = false;
84
- }
60
+ this.error = err;
61
+ this.scheduleUpdate?.();
62
+ });
85
63
  };
86
64
  };
87
65
  }
88
66
  /**
89
- * Lifecycle: runs when element connects to the DOM.
90
- * Multiple @mount methods per class allowed. No need to call super.
67
+ * Run decorated method when the element connects to the DOM.
91
68
  *
92
69
  * ```ts
93
70
  * @mount
94
- * setup() { this.ctx = this.canvas.getContext("2d"); }
71
+ * setup() { this.shadow.adoptedStyleSheets = [myStyles]; }
95
72
  * ```
96
73
  */
97
- export function mount(target, key) {
98
- const orig = target.connectedCallback;
99
- target.connectedCallback = function () {
100
- orig?.call(this);
101
- this[key]();
102
- };
74
+ export function mount(method, context) {
75
+ context.addInitializer(function () {
76
+ if (!this[CONNECT_HOOKS])
77
+ this[CONNECT_HOOKS] = [];
78
+ this[CONNECT_HOOKS].push((el) => {
79
+ method.call(el);
80
+ });
81
+ });
103
82
  }
104
83
  /**
105
- * Lifecycle: runs when element disconnects from the DOM.
106
- * Multiple @unmount methods per class allowed. Runs BEFORE track() cleanup.
84
+ * Run decorated method when the element disconnects from the DOM.
107
85
  *
108
86
  * ```ts
109
87
  * @unmount
110
- * saveState() { localStorage.setItem("state", JSON.stringify(this.state)); }
88
+ * teardown() { console.log("removed!"); }
111
89
  * ```
112
90
  */
113
- export function unmount(target, key) {
114
- const orig = target.connectedCallback;
115
- target.connectedCallback = function () {
116
- orig?.call(this);
117
- this.track(() => this[key]());
118
- };
91
+ export function unmount(method, context) {
92
+ context.addInitializer(function () {
93
+ if (!this[CONNECT_HOOKS])
94
+ this[CONNECT_HOOKS] = [];
95
+ // Return a cleanup function that calls the unmount method
96
+ this[CONNECT_HOOKS].push((el) => {
97
+ return () => method.call(el);
98
+ });
99
+ });
119
100
  }
120
101
  //# sourceMappingURL=lifecycle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/element/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA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AI,CAAC,cAAc,EAAE,EAAE,CAAC;YAC1B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAGD;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,MAAgB,EAAE,OAAoC;IAC1E,OAAO,CAAC,cAAc,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAO,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,MAAgB,EAAE,OAAoC;IAC5E,OAAO,CAAC,cAAc,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QACnD,0DAA0D;QAC1D,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAO,EAAE,EAAE;YACnC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Loom — @slot<...T> decorator (TC39 Stage 3)
3
+ *
4
+ * Auto-accessor decorator that provides typed access to slot-assigned elements.
5
+ *
6
+ * ```ts
7
+ * // Default slot
8
+ * @slot()
9
+ * accessor content!: Element[];
10
+ *
11
+ * // Typed single
12
+ * @slot<CardHeader>("header")
13
+ * accessor headers!: CardHeader[];
14
+ *
15
+ * // Spread — heterogeneous
16
+ * @slot<CardHeader, CardBody, CardFooter>("content")
17
+ * accessor sections!: (CardHeader | CardBody | CardFooter)[];
18
+ * ```
19
+ */
20
+ export declare function slot<T extends Element[] = [Element]>(name?: string): <This extends {
21
+ shadow: ShadowRoot;
22
+ }>(_target: ClassAccessorDecoratorTarget<This, T[number][]>, context: ClassAccessorDecoratorContext<This, T[number][]>) => ClassAccessorDecoratorResult<This, T[number][]>;
23
+ //# sourceMappingURL=slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/element/slots.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,IACzD,IAAI,SAAS;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,EACzC,SAAS,4BAA4B,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EACxD,SAAS,6BAA6B,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KACxD,4BAA4B,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAmCnD"}
@@ -0,0 +1,54 @@
1
+ import { CONNECT_HOOKS } from "../decorators/symbols";
2
+ /**
3
+ * Loom — @slot<...T> decorator (TC39 Stage 3)
4
+ *
5
+ * Auto-accessor decorator that provides typed access to slot-assigned elements.
6
+ *
7
+ * ```ts
8
+ * // Default slot
9
+ * @slot()
10
+ * accessor content!: Element[];
11
+ *
12
+ * // Typed single
13
+ * @slot<CardHeader>("header")
14
+ * accessor headers!: CardHeader[];
15
+ *
16
+ * // Spread — heterogeneous
17
+ * @slot<CardHeader, CardBody, CardFooter>("content")
18
+ * accessor sections!: (CardHeader | CardBody | CardFooter)[];
19
+ * ```
20
+ */
21
+ export function slot(name) {
22
+ return (_target, context) => {
23
+ const storageKey = Symbol(`slot:${String(context.name)}`);
24
+ context.addInitializer(function () {
25
+ if (!this[CONNECT_HOOKS])
26
+ this[CONNECT_HOOKS] = [];
27
+ this[CONNECT_HOOKS].push((el) => {
28
+ // Defer to allow update() to render the slot elements first
29
+ queueMicrotask(() => {
30
+ const selector = name ? `slot[name="${name}"]` : "slot:not([name])";
31
+ const slotEl = el.shadow.querySelector(selector);
32
+ if (!slotEl)
33
+ return;
34
+ const updateSlotted = () => {
35
+ el[storageKey] = slotEl.assignedElements({ flatten: true });
36
+ el.scheduleUpdate?.();
37
+ };
38
+ updateSlotted();
39
+ slotEl.addEventListener("slotchange", updateSlotted);
40
+ el.track(() => slotEl.removeEventListener("slotchange", updateSlotted));
41
+ });
42
+ });
43
+ });
44
+ return {
45
+ get() {
46
+ return this[storageKey] ?? [];
47
+ },
48
+ set(val) {
49
+ this[storageKey] = val;
50
+ },
51
+ };
52
+ };
53
+ }
54
+ //# sourceMappingURL=slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/element/slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,UAAU,IAAI,CAAkC,IAAa;IACjE,OAAO,CACL,OAAwD,EACxD,OAAyD,EACR,EAAE;QACnD,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1D,OAAO,CAAC,cAAc,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;YACnD,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAO,EAAE,EAAE;gBACnC,4DAA4D;gBAC5D,cAAc,CAAC,GAAG,EAAE;oBAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC;oBACpE,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAA2B,CAAC;oBAE3E,IAAI,CAAC,MAAM;wBAAE,OAAO;oBAEpB,MAAM,aAAa,GAAG,GAAG,EAAE;wBACzB,EAAE,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;wBAC5D,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC;oBACxB,CAAC,CAAC;oBAEF,aAAa,EAAE,CAAC;oBAEhB,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;oBACrD,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;gBAC1E,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,GAAG;gBACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YAChC,CAAC;YACD,GAAG,CAAY,GAAgB;gBAC7B,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;YACzB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Loom — Element timing decorators
2
+ * Loom — Element timing decorators (TC39 Stage 3)
3
3
  *
4
4
  * @interval — Auto-cleaned setInterval
5
5
  * @timeout — Auto-cleaned setTimeout
@@ -16,7 +16,7 @@
16
16
  * tick() { this.time = new Date(); }
17
17
  * ```
18
18
  */
19
- export declare const interval: (ms: number) => (target: any, key: string, desc?: PropertyDescriptor) => void;
19
+ export declare const interval: (ms: number) => (method: Function, context: ClassMethodDecoratorContext) => void;
20
20
  /**
21
21
  * Auto-cleaned setTimeout. Runs the method once after `ms` milliseconds.
22
22
  * Timer is started on connect, cleared on disconnect via track().
@@ -26,7 +26,7 @@ export declare const interval: (ms: number) => (target: any, key: string, desc?:
26
26
  * hideWelcome() { this.$(".welcome")?.remove(); }
27
27
  * ```
28
28
  */
29
- export declare const timeout: (ms: number) => (target: any, key: string, desc?: PropertyDescriptor) => void;
29
+ export declare const timeout: (ms: number) => (method: Function, context: ClassMethodDecoratorContext) => void;
30
30
  /**
31
31
  * Debounce a method — delays execution until `ms` of inactivity.
32
32
  * Auto-cancels pending timer on disconnect.
@@ -36,7 +36,7 @@ export declare const timeout: (ms: number) => (target: any, key: string, desc?:
36
36
  * onInput(e: Event) { this.query = (e.target as HTMLInputElement).value; }
37
37
  * ```
38
38
  */
39
- export declare const debounce: (ms: number) => (target: any, key: string, desc?: PropertyDescriptor) => void;
39
+ export declare function debounce(ms: number): (method: Function, context: ClassMethodDecoratorContext) => (this: any, ...args: unknown[]) => void;
40
40
  /**
41
41
  * Throttle a method — fires at most once per `ms` milliseconds.
42
42
  * Uses trailing-edge: the last call within the window always fires.
@@ -47,7 +47,7 @@ export declare const debounce: (ms: number) => (target: any, key: string, desc?:
47
47
  * onScroll() { this.offset = this.scrollTop; }
48
48
  * ```
49
49
  */
50
- export declare const throttle: (ms: number) => (target: any, key: string, desc?: PropertyDescriptor) => void;
50
+ export declare function throttle(ms: number): (method: Function, context: ClassMethodDecoratorContext) => (this: any, ...args: unknown[]) => void;
51
51
  /**
52
52
  * Centralized rAF loop via RenderLoop. Method receives (deltaTime, timestamp).
53
53
  * Use layer to control execution order (lower = earlier).
@@ -58,8 +58,11 @@ export declare const throttle: (ms: number) => (target: any, key: string, desc?:
58
58
  *
59
59
  * @animationFrame() // default layer 0
60
60
  * physics(dt: number) { ... }
61
+ *
62
+ * @animationFrame // also valid
63
+ * render(dt: number) { ... }
61
64
  * ```
62
65
  */
63
- export declare function animationFrame(layer?: number): (target: any, key: string) => void;
64
- export declare function animationFrame(target: any, key: string): void;
66
+ export declare function animationFrame(layer?: number): (method: Function, context: ClassMethodDecoratorContext) => void;
67
+ export declare function animationFrame(method: Function, context: ClassMethodDecoratorContext): void;
65
68
  //# sourceMappingURL=timing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/element/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,iDAwDpB,CAAD,6BAnDE,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,iDAwCnB,CAAD,6BAnCE,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,iDAwBpB,CAAD,6BAVE,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,iDAFpB,CAAD,6BA2BE,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AACnF,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/element/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,kFAKnB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,kFAKlB,CAAC;AAEH;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IACzB,QAAQ,QAAQ,EAAE,SAAS,2BAA2B,YAIjC,GAAG,WAAW,OAAO,EAAE,UAerD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IACzB,QAAQ,QAAQ,EAAE,SAAS,2BAA2B,YAKjC,GAAG,WAAW,OAAO,EAAE,UAyBrD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;AACjH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Loom — Element timing decorators
2
+ * Loom — Element timing decorators (TC39 Stage 3)
3
3
  *
4
4
  * @interval — Auto-cleaned setInterval
5
5
  * @timeout — Auto-cleaned setTimeout
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { renderLoop } from "../render-loop";
11
11
  import { createDecorator } from "../decorators/create";
12
+ import { CONNECT_HOOKS } from "../decorators/symbols";
12
13
  /**
13
14
  * Auto-cleaned setInterval. Runs the method every `ms` milliseconds.
14
15
  * Timer is started on connect, cleared on disconnect via track().
@@ -18,9 +19,9 @@ import { createDecorator } from "../decorators/create";
18
19
  * tick() { this.time = new Date(); }
19
20
  * ```
20
21
  */
21
- export const interval = createDecorator((_proto, key, ms) => {
22
+ export const interval = createDecorator((method, _key, ms) => {
22
23
  return (el) => {
23
- const id = setInterval(() => el[key](), ms);
24
+ const id = setInterval(() => method.call(el), ms);
24
25
  return () => clearInterval(id);
25
26
  };
26
27
  });
@@ -33,9 +34,9 @@ export const interval = createDecorator((_proto, key, ms) => {
33
34
  * hideWelcome() { this.$(".welcome")?.remove(); }
34
35
  * ```
35
36
  */
36
- export const timeout = createDecorator((_proto, key, ms) => {
37
+ export const timeout = createDecorator((method, _key, ms) => {
37
38
  return (el) => {
38
- const id = setTimeout(() => el[key](), ms);
39
+ const id = setTimeout(() => method.call(el), ms);
39
40
  return () => clearTimeout(id);
40
41
  };
41
42
  });
@@ -48,19 +49,25 @@ export const timeout = createDecorator((_proto, key, ms) => {
48
49
  * onInput(e: Event) { this.query = (e.target as HTMLInputElement).value; }
49
50
  * ```
50
51
  */
51
- export const debounce = createDecorator((proto, key, ms) => {
52
- const original = proto[key];
53
- const timerKey = `__debounce_${key}`;
54
- // Define-time: replace method with debounced version
55
- proto[key] = function (...args) {
56
- clearTimeout(this[timerKey]);
57
- this[timerKey] = setTimeout(() => original.apply(this, args), ms);
58
- };
59
- // Lifecycle: cancel pending timer on disconnect
60
- return (el) => {
61
- return () => clearTimeout(el[timerKey]);
52
+ export function debounce(ms) {
53
+ return (method, context) => {
54
+ const timerKey = `__debounce_${String(context.name)}`;
55
+ // Replace with debounced version
56
+ function replacement(...args) {
57
+ clearTimeout(this[timerKey]);
58
+ this[timerKey] = setTimeout(() => method.apply(this, args), ms);
59
+ }
60
+ // Lifecycle: cancel pending timer on disconnect
61
+ context.addInitializer(function () {
62
+ if (!this[CONNECT_HOOKS])
63
+ this[CONNECT_HOOKS] = [];
64
+ this[CONNECT_HOOKS].push((el) => {
65
+ return () => clearTimeout(el[timerKey]);
66
+ });
67
+ });
68
+ return replacement;
62
69
  };
63
- });
70
+ }
64
71
  /**
65
72
  * Throttle a method — fires at most once per `ms` milliseconds.
66
73
  * Uses trailing-edge: the last call within the window always fires.
@@ -71,46 +78,54 @@ export const debounce = createDecorator((proto, key, ms) => {
71
78
  * onScroll() { this.offset = this.scrollTop; }
72
79
  * ```
73
80
  */
74
- export const throttle = createDecorator((proto, key, ms) => {
75
- const original = proto[key];
76
- const lastKey = `__throttle_last_${key}`;
77
- const timerKey = `__throttle_timer_${key}`;
78
- // Define-time: replace method with throttled version
79
- proto[key] = function (...args) {
80
- const now = Date.now();
81
- if (!this[lastKey] || now - this[lastKey] >= ms) {
82
- this[lastKey] = now;
83
- original.apply(this, args);
81
+ export function throttle(ms) {
82
+ return (method, context) => {
83
+ const lastKey = `__throttle_last_${String(context.name)}`;
84
+ const timerKey = `__throttle_timer_${String(context.name)}`;
85
+ // Replace with throttled version
86
+ function replacement(...args) {
87
+ const now = Date.now();
88
+ if (!this[lastKey] || now - this[lastKey] >= ms) {
89
+ this[lastKey] = now;
90
+ method.apply(this, args);
91
+ }
92
+ else {
93
+ clearTimeout(this[timerKey]);
94
+ this[timerKey] = setTimeout(() => {
95
+ this[lastKey] = Date.now();
96
+ method.apply(this, args);
97
+ }, ms - (now - this[lastKey]));
98
+ }
84
99
  }
85
- else {
86
- clearTimeout(this[timerKey]);
87
- this[timerKey] = setTimeout(() => {
88
- this[lastKey] = Date.now();
89
- original.apply(this, args);
90
- }, ms - (now - this[lastKey]));
91
- }
92
- };
93
- // Lifecycle: cancel pending timer on disconnect
94
- return (el) => {
95
- return () => clearTimeout(el[timerKey]);
100
+ // Lifecycle: cancel pending timer on disconnect
101
+ context.addInitializer(function () {
102
+ if (!this[CONNECT_HOOKS])
103
+ this[CONNECT_HOOKS] = [];
104
+ this[CONNECT_HOOKS].push((el) => {
105
+ return () => clearTimeout(el[timerKey]);
106
+ });
107
+ });
108
+ return replacement;
96
109
  };
97
- });
98
- export function animationFrame(targetOrLayer, key) {
99
- // Called as @animationFrame (no parens)
100
- if (typeof targetOrLayer === "object" && typeof key === "string") {
101
- wireAnimationFrame(targetOrLayer, key, 0);
110
+ }
111
+ export function animationFrame(methodOrLayer, context) {
112
+ // Called as @animationFrame (no parens) — method is first arg
113
+ if (typeof methodOrLayer === "function" && context) {
114
+ wireAnimationFrame(methodOrLayer, context, 0);
102
115
  return;
103
116
  }
104
117
  // Called as @animationFrame() or @animationFrame(layer)
105
- const layer = typeof targetOrLayer === "number" ? targetOrLayer : 0;
106
- return (target, key) => wireAnimationFrame(target, key, layer);
118
+ const layer = typeof methodOrLayer === "number" ? methodOrLayer : 0;
119
+ return (method, ctx) => wireAnimationFrame(method, ctx, layer);
107
120
  }
108
- /** Internal: uses createDecorator pattern manually for overload support */
109
- function wireAnimationFrame(target, key, layer) {
110
- const orig = target.connectedCallback;
111
- target.connectedCallback = function () {
112
- orig?.call(this);
113
- this.track(renderLoop.add(layer, (dt, t) => this[key](dt, t)));
114
- };
121
+ /** Internal: wire rAF lifecycle via addInitializer */
122
+ function wireAnimationFrame(method, context, layer) {
123
+ context.addInitializer(function () {
124
+ if (!this[CONNECT_HOOKS])
125
+ this[CONNECT_HOOKS] = [];
126
+ this[CONNECT_HOOKS].push((el) => {
127
+ return renderLoop.add(layer, (dt, t) => method.call(el, dt, t));
128
+ });
129
+ });
115
130
  }
116
131
  //# sourceMappingURL=timing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"timing.js","sourceRoot":"","sources":["../../src/element/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAe,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;IACxE,OAAO,CAAC,EAAO,EAAE,EAAE;QACjB,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAe,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;IACvE,OAAO,CAAC,EAAO,EAAE,EAAE;QACjB,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3C,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAe,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,E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