@miurajs/miura-render 0.1.0 → 0.2.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 (263) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +14 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +13 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/src/binding-manager/binding-manager.d.ts +30 -0
  7. package/dist/src/binding-manager/binding-manager.d.ts.map +1 -0
  8. package/dist/src/binding-manager/binding-manager.js +245 -0
  9. package/dist/src/binding-manager/binding-manager.js.map +1 -0
  10. package/dist/src/binding-manager/binding-type.d.ts +24 -0
  11. package/dist/src/binding-manager/binding-type.d.ts.map +1 -0
  12. package/dist/src/binding-manager/binding-type.js +25 -0
  13. package/dist/src/binding-manager/binding-type.js.map +1 -0
  14. package/dist/src/binding-manager/bindings/async-binding.d.ts +23 -0
  15. package/dist/src/binding-manager/bindings/async-binding.d.ts.map +1 -0
  16. package/dist/src/binding-manager/bindings/async-binding.js +67 -0
  17. package/dist/src/binding-manager/bindings/async-binding.js.map +1 -0
  18. package/dist/src/binding-manager/bindings/attribute-binding.d.ts +41 -0
  19. package/dist/src/binding-manager/bindings/attribute-binding.d.ts.map +1 -0
  20. package/dist/src/binding-manager/bindings/attribute-binding.js +79 -0
  21. package/dist/src/binding-manager/bindings/attribute-binding.js.map +1 -0
  22. package/dist/src/binding-manager/bindings/bind-binding.d.ts +30 -0
  23. package/dist/src/binding-manager/bindings/bind-binding.d.ts.map +1 -0
  24. package/dist/src/binding-manager/bindings/bind-binding.js +81 -0
  25. package/dist/src/binding-manager/bindings/bind-binding.js.map +1 -0
  26. package/dist/src/binding-manager/bindings/binding.d.ts +6 -0
  27. package/dist/src/binding-manager/bindings/binding.d.ts.map +1 -0
  28. package/dist/src/binding-manager/bindings/binding.js +2 -0
  29. package/dist/src/binding-manager/bindings/binding.js.map +1 -0
  30. package/dist/src/binding-manager/bindings/boolean-binding.d.ts +18 -0
  31. package/dist/src/binding-manager/bindings/boolean-binding.d.ts.map +1 -0
  32. package/dist/src/binding-manager/bindings/boolean-binding.js +65 -0
  33. package/dist/src/binding-manager/bindings/boolean-binding.js.map +1 -0
  34. package/dist/src/binding-manager/bindings/class-binding.d.ts +10 -0
  35. package/dist/src/binding-manager/bindings/class-binding.d.ts.map +1 -0
  36. package/dist/src/binding-manager/bindings/class-binding.js +68 -0
  37. package/dist/src/binding-manager/bindings/class-binding.js.map +1 -0
  38. package/dist/src/binding-manager/bindings/directive-binding.d.ts +15 -0
  39. package/dist/src/binding-manager/bindings/directive-binding.d.ts.map +1 -0
  40. package/dist/src/binding-manager/bindings/directive-binding.js +70 -0
  41. package/dist/src/binding-manager/bindings/directive-binding.js.map +1 -0
  42. package/dist/src/binding-manager/bindings/event-binding.d.ts +14 -0
  43. package/dist/src/binding-manager/bindings/event-binding.d.ts.map +1 -0
  44. package/dist/src/binding-manager/bindings/event-binding.js +73 -0
  45. package/dist/src/binding-manager/bindings/event-binding.js.map +1 -0
  46. package/dist/src/binding-manager/bindings/node-binding.d.ts +36 -0
  47. package/dist/src/binding-manager/bindings/node-binding.d.ts.map +1 -0
  48. package/dist/src/binding-manager/bindings/node-binding.js +235 -0
  49. package/dist/src/binding-manager/bindings/node-binding.js.map +1 -0
  50. package/dist/src/binding-manager/bindings/object-class-binding.d.ts +16 -0
  51. package/dist/src/binding-manager/bindings/object-class-binding.d.ts.map +1 -0
  52. package/dist/src/binding-manager/bindings/object-class-binding.js +42 -0
  53. package/dist/src/binding-manager/bindings/object-class-binding.js.map +1 -0
  54. package/dist/src/binding-manager/bindings/object-style-binding.d.ts +16 -0
  55. package/dist/src/binding-manager/bindings/object-style-binding.d.ts.map +1 -0
  56. package/dist/src/binding-manager/bindings/object-style-binding.js +38 -0
  57. package/dist/src/binding-manager/bindings/object-style-binding.js.map +1 -0
  58. package/dist/src/binding-manager/bindings/property-binding.d.ts +12 -0
  59. package/dist/src/binding-manager/bindings/property-binding.d.ts.map +1 -0
  60. package/dist/src/binding-manager/bindings/property-binding.js +44 -0
  61. package/dist/src/binding-manager/bindings/property-binding.js.map +1 -0
  62. package/dist/src/binding-manager/bindings/reference-binding.d.ts +14 -0
  63. package/dist/src/binding-manager/bindings/reference-binding.d.ts.map +1 -0
  64. package/dist/src/binding-manager/bindings/reference-binding.js +44 -0
  65. package/dist/src/binding-manager/bindings/reference-binding.js.map +1 -0
  66. package/dist/src/binding-manager/bindings/spread-binding.d.ts +16 -0
  67. package/dist/src/binding-manager/bindings/spread-binding.d.ts.map +1 -0
  68. package/dist/src/binding-manager/bindings/spread-binding.js +40 -0
  69. package/dist/src/binding-manager/bindings/spread-binding.js.map +1 -0
  70. package/dist/src/binding-manager/bindings/style-binding.d.ts +10 -0
  71. package/dist/src/binding-manager/bindings/style-binding.d.ts.map +1 -0
  72. package/dist/src/binding-manager/bindings/style-binding.js +44 -0
  73. package/dist/src/binding-manager/bindings/style-binding.js.map +1 -0
  74. package/dist/src/compiler/code-factory.d.ts +45 -0
  75. package/dist/src/compiler/code-factory.d.ts.map +1 -0
  76. package/dist/src/compiler/code-factory.js +211 -0
  77. package/dist/src/compiler/code-factory.js.map +1 -0
  78. package/dist/src/compiler/compiler.d.ts +77 -0
  79. package/dist/src/compiler/compiler.d.ts.map +1 -0
  80. package/dist/src/compiler/compiler.js +77 -0
  81. package/dist/src/compiler/compiler.js.map +1 -0
  82. package/dist/src/compiler/constants.d.ts +5 -0
  83. package/dist/src/compiler/constants.d.ts.map +1 -0
  84. package/dist/src/compiler/constants.js +9 -0
  85. package/dist/src/compiler/constants.js.map +1 -0
  86. package/dist/src/css-result.d.ts +27 -0
  87. package/dist/src/css-result.d.ts.map +1 -0
  88. package/dist/src/css-result.js +56 -0
  89. package/dist/src/css-result.js.map +1 -0
  90. package/dist/src/css.d.ts +26 -0
  91. package/dist/src/css.d.ts.map +1 -0
  92. package/dist/src/css.js +62 -0
  93. package/dist/src/css.js.map +1 -0
  94. package/dist/src/directives/animate.directive.d.ts +42 -0
  95. package/dist/src/directives/animate.directive.d.ts.map +1 -0
  96. package/dist/src/directives/animate.directive.js +349 -0
  97. package/dist/src/directives/animate.directive.js.map +1 -0
  98. package/dist/src/directives/await.d.ts +68 -0
  99. package/dist/src/directives/await.d.ts.map +1 -0
  100. package/dist/src/directives/await.js +70 -0
  101. package/dist/src/directives/await.js.map +1 -0
  102. package/dist/src/directives/choose.d.ts +28 -0
  103. package/dist/src/directives/choose.d.ts.map +1 -0
  104. package/dist/src/directives/choose.js +30 -0
  105. package/dist/src/directives/choose.js.map +1 -0
  106. package/dist/src/directives/decorator-example.d.ts +8 -0
  107. package/dist/src/directives/decorator-example.d.ts.map +1 -0
  108. package/dist/src/directives/decorator-example.js +32 -0
  109. package/dist/src/directives/decorator-example.js.map +1 -0
  110. package/dist/src/directives/decorators.d.ts +3 -0
  111. package/dist/src/directives/decorators.d.ts.map +1 -0
  112. package/dist/src/directives/decorators.js +17 -0
  113. package/dist/src/directives/decorators.js.map +1 -0
  114. package/dist/src/directives/directive-manager.d.ts +26 -0
  115. package/dist/src/directives/directive-manager.d.ts.map +1 -0
  116. package/dist/src/directives/directive-manager.js +114 -0
  117. package/dist/src/directives/directive-manager.js.map +1 -0
  118. package/dist/src/directives/directive.d.ts +38 -0
  119. package/dist/src/directives/directive.d.ts.map +1 -0
  120. package/dist/src/directives/directive.js +18 -0
  121. package/dist/src/directives/directive.js.map +1 -0
  122. package/dist/src/directives/focus.directive.d.ts +16 -0
  123. package/dist/src/directives/focus.directive.d.ts.map +1 -0
  124. package/dist/src/directives/focus.directive.js +29 -0
  125. package/dist/src/directives/focus.directive.js.map +1 -0
  126. package/dist/src/directives/gesture.directive.d.ts +58 -0
  127. package/dist/src/directives/gesture.directive.d.ts.map +1 -0
  128. package/dist/src/directives/gesture.directive.js +331 -0
  129. package/dist/src/directives/gesture.directive.js.map +1 -0
  130. package/dist/src/directives/index.d.ts +34 -0
  131. package/dist/src/directives/index.d.ts.map +1 -0
  132. package/dist/src/directives/index.js +35 -0
  133. package/dist/src/directives/index.js.map +1 -0
  134. package/dist/src/directives/intersection.directive.d.ts +18 -0
  135. package/dist/src/directives/intersection.directive.d.ts.map +1 -0
  136. package/dist/src/directives/intersection.directive.js +50 -0
  137. package/dist/src/directives/intersection.directive.js.map +1 -0
  138. package/dist/src/directives/keyed-diff.d.ts +30 -0
  139. package/dist/src/directives/keyed-diff.d.ts.map +1 -0
  140. package/dist/src/directives/keyed-diff.js +185 -0
  141. package/dist/src/directives/keyed-diff.js.map +1 -0
  142. package/dist/src/directives/lazy-setup.d.ts +3 -0
  143. package/dist/src/directives/lazy-setup.d.ts.map +1 -0
  144. package/dist/src/directives/lazy-setup.js +55 -0
  145. package/dist/src/directives/lazy-setup.js.map +1 -0
  146. package/dist/src/directives/lazy.directive.d.ts +19 -0
  147. package/dist/src/directives/lazy.directive.d.ts.map +1 -0
  148. package/dist/src/directives/lazy.directive.js +73 -0
  149. package/dist/src/directives/lazy.directive.js.map +1 -0
  150. package/dist/src/directives/media.directive.d.ts +31 -0
  151. package/dist/src/directives/media.directive.d.ts.map +1 -0
  152. package/dist/src/directives/media.directive.js +105 -0
  153. package/dist/src/directives/media.directive.js.map +1 -0
  154. package/dist/src/directives/mutation.directive.d.ts +11 -0
  155. package/dist/src/directives/mutation.directive.d.ts.map +1 -0
  156. package/dist/src/directives/mutation.directive.js +56 -0
  157. package/dist/src/directives/mutation.directive.js.map +1 -0
  158. package/dist/src/directives/repeat.d.ts +50 -0
  159. package/dist/src/directives/repeat.d.ts.map +1 -0
  160. package/dist/src/directives/repeat.js +47 -0
  161. package/dist/src/directives/repeat.js.map +1 -0
  162. package/dist/src/directives/resize.directive.d.ts +14 -0
  163. package/dist/src/directives/resize.directive.d.ts.map +1 -0
  164. package/dist/src/directives/resize.directive.js +81 -0
  165. package/dist/src/directives/resize.directive.js.map +1 -0
  166. package/dist/src/directives/setup.d.ts +9 -0
  167. package/dist/src/directives/setup.d.ts.map +1 -0
  168. package/dist/src/directives/setup.js +9 -0
  169. package/dist/src/directives/setup.js.map +1 -0
  170. package/dist/src/directives/structural/async.directive.d.ts +39 -0
  171. package/dist/src/directives/structural/async.directive.d.ts.map +1 -0
  172. package/dist/src/directives/structural/async.directive.js +115 -0
  173. package/dist/src/directives/structural/async.directive.js.map +1 -0
  174. package/dist/src/directives/structural/for.directive.d.ts +37 -0
  175. package/dist/src/directives/structural/for.directive.d.ts.map +1 -0
  176. package/dist/src/directives/structural/for.directive.js +209 -0
  177. package/dist/src/directives/structural/for.directive.js.map +1 -0
  178. package/dist/src/directives/structural/if.directive.d.ts +54 -0
  179. package/dist/src/directives/structural/if.directive.d.ts.map +1 -0
  180. package/dist/src/directives/structural/if.directive.js +210 -0
  181. package/dist/src/directives/structural/if.directive.js.map +1 -0
  182. package/dist/src/directives/structural/structural.directive.d.ts +11 -0
  183. package/dist/src/directives/structural/structural.directive.d.ts.map +1 -0
  184. package/dist/src/directives/structural/structural.directive.js +29 -0
  185. package/dist/src/directives/structural/structural.directive.js.map +1 -0
  186. package/dist/src/directives/structural/switch.directive.d.ts +12 -0
  187. package/dist/src/directives/structural/switch.directive.d.ts.map +1 -0
  188. package/dist/src/directives/structural/switch.directive.js +69 -0
  189. package/dist/src/directives/structural/switch.directive.js.map +1 -0
  190. package/dist/src/directives/structural/virtual-scroll.directive.d.ts +50 -0
  191. package/dist/src/directives/structural/virtual-scroll.directive.d.ts.map +1 -0
  192. package/dist/src/directives/structural/virtual-scroll.directive.js +165 -0
  193. package/dist/src/directives/structural/virtual-scroll.directive.js.map +1 -0
  194. package/dist/src/directives/utils.d.ts +61 -0
  195. package/dist/src/directives/utils.d.ts.map +1 -0
  196. package/dist/src/directives/utils.js +121 -0
  197. package/dist/src/directives/utils.js.map +1 -0
  198. package/dist/src/directives/validate.directive.d.ts +41 -0
  199. package/dist/src/directives/validate.directive.d.ts.map +1 -0
  200. package/dist/src/directives/validate.directive.js +161 -0
  201. package/dist/src/directives/validate.directive.js.map +1 -0
  202. package/dist/src/directives/virtual-scroll.d.ts +91 -0
  203. package/dist/src/directives/virtual-scroll.d.ts.map +1 -0
  204. package/dist/src/directives/virtual-scroll.js +78 -0
  205. package/dist/src/directives/virtual-scroll.js.map +1 -0
  206. package/dist/src/directives/when.d.ts +24 -0
  207. package/dist/src/directives/when.d.ts.map +1 -0
  208. package/dist/src/directives/when.js +25 -0
  209. package/dist/src/directives/when.js.map +1 -0
  210. package/dist/src/html.d.ts +23 -0
  211. package/dist/src/html.d.ts.map +1 -0
  212. package/dist/src/html.js +37 -0
  213. package/dist/src/html.js.map +1 -0
  214. package/dist/src/modifiers/capture-modifier.d.ts +6 -0
  215. package/dist/src/modifiers/capture-modifier.d.ts.map +1 -0
  216. package/dist/src/modifiers/capture-modifier.js +14 -0
  217. package/dist/src/modifiers/capture-modifier.js.map +1 -0
  218. package/dist/src/modifiers/event-modifiers.d.ts +38 -0
  219. package/dist/src/modifiers/event-modifiers.d.ts.map +1 -0
  220. package/dist/src/modifiers/event-modifiers.js +90 -0
  221. package/dist/src/modifiers/event-modifiers.js.map +1 -0
  222. package/dist/src/modifiers/key-modifiers.d.ts +8 -0
  223. package/dist/src/modifiers/key-modifiers.d.ts.map +1 -0
  224. package/dist/src/modifiers/key-modifiers.js +29 -0
  225. package/dist/src/modifiers/key-modifiers.js.map +1 -0
  226. package/dist/src/modifiers/mouse-modifiers.d.ts +8 -0
  227. package/dist/src/modifiers/mouse-modifiers.d.ts.map +1 -0
  228. package/dist/src/modifiers/mouse-modifiers.js +15 -0
  229. package/dist/src/modifiers/mouse-modifiers.js.map +1 -0
  230. package/dist/src/modifiers/once-modifier.d.ts +6 -0
  231. package/dist/src/modifiers/once-modifier.d.ts.map +1 -0
  232. package/dist/src/modifiers/once-modifier.js +11 -0
  233. package/dist/src/modifiers/once-modifier.js.map +1 -0
  234. package/dist/src/modifiers/passive-modifier.d.ts +6 -0
  235. package/dist/src/modifiers/passive-modifier.d.ts.map +1 -0
  236. package/dist/src/modifiers/passive-modifier.js +14 -0
  237. package/dist/src/modifiers/passive-modifier.js.map +1 -0
  238. package/dist/src/processor/parser.d.ts +74 -0
  239. package/dist/src/processor/parser.d.ts.map +1 -0
  240. package/dist/src/processor/parser.js +345 -0
  241. package/dist/src/processor/parser.js.map +1 -0
  242. package/dist/src/processor/processor.d.ts +68 -0
  243. package/dist/src/processor/processor.d.ts.map +1 -0
  244. package/dist/src/processor/processor.js +138 -0
  245. package/dist/src/processor/processor.js.map +1 -0
  246. package/dist/src/processor/template-result.d.ts +74 -0
  247. package/dist/src/processor/template-result.d.ts.map +1 -0
  248. package/dist/src/processor/template-result.js +53 -0
  249. package/dist/src/processor/template-result.js.map +1 -0
  250. package/dist/src/processor/types.d.ts +16 -0
  251. package/dist/src/processor/types.d.ts.map +1 -0
  252. package/dist/src/processor/types.js +13 -0
  253. package/dist/src/processor/types.js.map +1 -0
  254. package/dist/src/utils/debug.d.ts +7 -0
  255. package/dist/src/utils/debug.d.ts.map +1 -0
  256. package/dist/src/utils/debug.js +7 -0
  257. package/dist/src/utils/debug.js.map +1 -0
  258. package/dist/src/utils/performance.d.ts +50 -0
  259. package/dist/src/utils/performance.d.ts.map +1 -0
  260. package/dist/src/utils/performance.js +51 -0
  261. package/dist/src/utils/performance.js.map +1 -0
  262. package/dist/tsconfig.tsbuildinfo +1 -0
  263. package/package.json +8 -10
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Marker object returned by repeat(). Detected by NodeBinding
3
+ * to trigger keyed reconciliation instead of full teardown+rebuild.
4
+ */
5
+ export class RepeatResult {
6
+ items;
7
+ keyFn;
8
+ templateFn;
9
+ constructor(items, keyFn, templateFn) {
10
+ this.items = items;
11
+ this.keyFn = keyFn;
12
+ this.templateFn = templateFn;
13
+ }
14
+ }
15
+ /**
16
+ * Keyed list rendering directive.
17
+ *
18
+ * Usage:
19
+ * ```ts
20
+ * html`
21
+ * <ul>
22
+ * ${repeat(
23
+ * this.items,
24
+ * item => item.id,
25
+ * (item, index) => html`<li>${item.name}</li>`
26
+ * )}
27
+ * </ul>
28
+ * `
29
+ * ```
30
+ *
31
+ * When items change, the diff algorithm:
32
+ * - Reuses DOM for items with the same key (calls instance.update())
33
+ * - Creates new DOM only for genuinely new items
34
+ * - Removes DOM only for items that disappeared
35
+ * - Moves DOM nodes to match the new order
36
+ *
37
+ * This is dramatically faster than the default array rendering
38
+ * which tears down and rebuilds all DOM on every update.
39
+ *
40
+ * @param items - The array of items to render
41
+ * @param keyFn - Function that returns a unique key for each item
42
+ * @param templateFn - Function that returns a TemplateResult for each item
43
+ */
44
+ export function repeat(items, keyFn, templateFn) {
45
+ return new RepeatResult(items, keyFn, templateFn);
46
+ }
47
+ //# sourceMappingURL=repeat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../src/directives/repeat.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,OAAO,YAAY;IAED;IACA;IACA;IAHpB,YACoB,KAAyB,EACzB,KAAiB,EACjB,UAA2B;QAF3B,UAAK,GAAL,KAAK,CAAoB;QACzB,UAAK,GAAL,KAAK,CAAY;QACjB,eAAU,GAAV,UAAU,CAAiB;IAC5C,CAAC;CACP;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,MAAM,CAClB,KAAmB,EACnB,KAAe,EACf,UAAyB;IAEzB,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { BaseDirective } from './directive';
2
+ interface ResizeCallback {
3
+ (entry: ResizeObserverEntry): void;
4
+ }
5
+ export declare class ResizeDirective extends BaseDirective {
6
+ private observer;
7
+ private callback;
8
+ constructor(element: Element);
9
+ mount(element: Element): void;
10
+ update(callback: ResizeCallback): void;
11
+ unmount(): void;
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=resize.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resize.directive.d.ts","sourceRoot":"","sources":["../../../src/directives/resize.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,UAAU,cAAc;IACpB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACtC;AAED,qBAAa,eAAgB,SAAQ,aAAa;IAC9C,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,QAAQ,CAA+B;gBAEnC,OAAO,EAAE,OAAO;IAK5B,KAAK,CAAC,OAAO,EAAE,OAAO;IA6CtB,MAAM,CAAC,QAAQ,EAAE,cAAc;IA4B/B,OAAO;CAOV"}
@@ -0,0 +1,81 @@
1
+ import { BaseDirective } from './directive';
2
+ import { debugLog } from '../utils/debug';
3
+ export class ResizeDirective extends BaseDirective {
4
+ observer = null;
5
+ callback = null;
6
+ constructor(element) {
7
+ super(element);
8
+ debugLog('resize', ' 🟣 Constructor', { element });
9
+ }
10
+ mount(element) {
11
+ debugLog('resize', 'Mount', { element });
12
+ this.observer = new ResizeObserver((entries) => {
13
+ debugLog('resize', 'Observer callback', { entries });
14
+ const [entry] = entries;
15
+ if (!entry)
16
+ return;
17
+ let width = 0;
18
+ let height = 0;
19
+ if (entry.borderBoxSize && entry.borderBoxSize[0]) {
20
+ width = entry.borderBoxSize[0].inlineSize;
21
+ height = entry.borderBoxSize[0].blockSize;
22
+ }
23
+ else if (entry.contentRect) {
24
+ width = entry.contentRect.width;
25
+ height = entry.contentRect.height;
26
+ }
27
+ debugLog('resize', 'Size changed', { width, height });
28
+ if (this.callback) {
29
+ this.callback({
30
+ contentRect: {
31
+ width,
32
+ height,
33
+ x: 0,
34
+ y: 0,
35
+ top: 0,
36
+ right: width,
37
+ bottom: height,
38
+ left: 0
39
+ },
40
+ borderBoxSize: entry.borderBoxSize || [],
41
+ contentBoxSize: entry.contentBoxSize || [],
42
+ devicePixelContentBoxSize: entry.devicePixelContentBoxSize || [],
43
+ target: element
44
+ });
45
+ }
46
+ });
47
+ this.observer.observe(element);
48
+ }
49
+ update(callback) {
50
+ debugLog('resize', 'Update', {
51
+ hasCallback: !!callback,
52
+ element: this.element
53
+ });
54
+ this.callback = callback;
55
+ if (this.element) {
56
+ const rect = this.element.getBoundingClientRect();
57
+ debugLog('resize', 'Initial size', { rect });
58
+ this.callback({
59
+ contentRect: rect,
60
+ borderBoxSize: [{
61
+ inlineSize: rect.width,
62
+ blockSize: rect.height
63
+ }],
64
+ contentBoxSize: [{
65
+ inlineSize: rect.width,
66
+ blockSize: rect.height
67
+ }],
68
+ devicePixelContentBoxSize: [],
69
+ target: this.element
70
+ });
71
+ }
72
+ }
73
+ unmount() {
74
+ debugLog('resize', 'Unmount');
75
+ if (this.observer) {
76
+ this.observer.disconnect();
77
+ this.observer = null;
78
+ }
79
+ }
80
+ }
81
+ //# sourceMappingURL=resize.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resize.directive.js","sourceRoot":"","sources":["../../../src/directives/resize.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAM1C,MAAM,OAAO,eAAgB,SAAQ,aAAa;IACtC,QAAQ,GAA0B,IAAI,CAAC;IACvC,QAAQ,GAA0B,IAAI,CAAC;IAE/C,YAAY,OAAgB;QACxB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,OAAgB;QAClB,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAEzC,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3C,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,EAAE,EAAE,OAAO,E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,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,QAAwB;QAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE;YACzB,WAAW,EAAE,CAAC,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAClD,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAE7C,IAAI,CAAC,QAAQ,CAAC;gBACV,WAAW,EAAE,IAAuB;gBACpC,aAAa,EAAE,CAAC;wBACZ,UAAU,EAAE,IAAI,CAAC,KAAK;wBACtB,SAAS,EAAE,IAAI,CAAC,MAAM;qBACzB,CAAC;gBACF,cAAc,EAAE,CAAC;wBACb,UAAU,EAAE,IAAI,CAAC,KAAK;wBACtB,SAAS,EAAE,IAAI,CAAC,MAAM;qBACzB,CAAC;gBACF,yBAAyB,EAAE,EAAE;gBAC7B,MAAM,EAAE,IAAI,CAAC,OAAO;aACvB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,OAAO;QACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,9 @@
1
+ import { ResizeDirective } from './resize.directive';
2
+ import { IntersectionDirective } from './intersection.directive';
3
+ import { FocusDirective } from './focus.directive';
4
+ import { MutationDirective } from './mutation.directive';
5
+ import { IfDirective } from './structural/if.directive';
6
+ import { ForDirective } from './structural/for.directive';
7
+ import { SwitchDirective } from './structural/switch.directive';
8
+ export { ResizeDirective, IntersectionDirective, FocusDirective, MutationDirective, IfDirective, ForDirective, SwitchDirective };
9
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/directives/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EAClB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ResizeDirective } from './resize.directive';
2
+ import { IntersectionDirective } from './intersection.directive';
3
+ import { FocusDirective } from './focus.directive';
4
+ import { MutationDirective } from './mutation.directive';
5
+ import { IfDirective } from './structural/if.directive';
6
+ import { ForDirective } from './structural/for.directive';
7
+ import { SwitchDirective } from './structural/switch.directive';
8
+ export { ResizeDirective, IntersectionDirective, FocusDirective, MutationDirective, IfDirective, ForDirective, SwitchDirective };
9
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/directives/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EAClB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { BaseDirective } from '../directive';
2
+ /**
3
+ * Async directive that tracks a Promise and renders the matching
4
+ * `<template>` branch — pending, resolved, or rejected.
5
+ *
6
+ * Usage:
7
+ * ```html
8
+ * <div #async=${this.userPromise}>
9
+ * <template pending>
10
+ * <p>Loading…</p>
11
+ * </template>
12
+ * <template resolved>
13
+ * <p>User loaded!</p>
14
+ * </template>
15
+ * <template rejected>
16
+ * <p>Something went wrong</p>
17
+ * </template>
18
+ * </div>
19
+ * ```
20
+ *
21
+ * The directive scans child `<template>` elements for the `pending`,
22
+ * `resolved`, and `rejected` attributes — exactly like `#switch` scans
23
+ * for `case` / `default`.
24
+ */
25
+ export declare class AsyncDirective extends BaseDirective {
26
+ private pendingTemplate;
27
+ private resolvedTemplate;
28
+ private rejectedTemplate;
29
+ private activeTemplate;
30
+ private currentPromise;
31
+ private generation;
32
+ mount(element: Element): void;
33
+ update(value: unknown): void;
34
+ unmount(): void;
35
+ private showTemplate;
36
+ private clearRendered;
37
+ }
38
+ export type AsyncDirectiveConfig = never;
39
+ //# sourceMappingURL=async.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.directive.d.ts","sourceRoot":"","sources":["../../../../src/directives/structural/async.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC7C,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,gBAAgB,CAAoC;IAC5D,OAAO,CAAC,gBAAgB,CAAoC;IAC5D,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,cAAc,CAAiC;IACvD,OAAO,CAAC,UAAU,CAAK;IAIvB,KAAK,CAAC,OAAO,EAAE,OAAO;IAuBtB,MAAM,CAAC,KAAK,EAAE,OAAO;IAiCrB,OAAO;IAaP,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,aAAa;CAUxB;AAGD,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { BaseDirective } from '../directive';
2
+ import { debugLog } from '../../utils/debug';
3
+ /**
4
+ * Async directive that tracks a Promise and renders the matching
5
+ * `<template>` branch — pending, resolved, or rejected.
6
+ *
7
+ * Usage:
8
+ * ```html
9
+ * <div #async=${this.userPromise}>
10
+ * <template pending>
11
+ * <p>Loading…</p>
12
+ * </template>
13
+ * <template resolved>
14
+ * <p>User loaded!</p>
15
+ * </template>
16
+ * <template rejected>
17
+ * <p>Something went wrong</p>
18
+ * </template>
19
+ * </div>
20
+ * ```
21
+ *
22
+ * The directive scans child `<template>` elements for the `pending`,
23
+ * `resolved`, and `rejected` attributes — exactly like `#switch` scans
24
+ * for `case` / `default`.
25
+ */
26
+ export class AsyncDirective extends BaseDirective {
27
+ pendingTemplate = null;
28
+ resolvedTemplate = null;
29
+ rejectedTemplate = null;
30
+ activeTemplate = null;
31
+ currentPromise = null;
32
+ generation = 0;
33
+ // ── Lifecycle ────────────────────────────────────────
34
+ mount(element) {
35
+ debugLog('async', 'Mounting async directive');
36
+ this.element = element;
37
+ // Scan child <template> elements for pending / resolved / rejected
38
+ const templates = Array.from(element.querySelectorAll('template'));
39
+ for (const tpl of templates) {
40
+ if (tpl.hasAttribute('pending')) {
41
+ this.pendingTemplate = tpl;
42
+ }
43
+ else if (tpl.hasAttribute('resolved')) {
44
+ this.resolvedTemplate = tpl;
45
+ }
46
+ else if (tpl.hasAttribute('rejected')) {
47
+ this.rejectedTemplate = tpl;
48
+ }
49
+ }
50
+ debugLog('async', 'Templates found', {
51
+ pending: !!this.pendingTemplate,
52
+ resolved: !!this.resolvedTemplate,
53
+ rejected: !!this.rejectedTemplate,
54
+ });
55
+ }
56
+ update(value) {
57
+ if (!(value instanceof Promise)) {
58
+ debugLog('async', 'Value is not a Promise', { value });
59
+ return;
60
+ }
61
+ // Same promise reference — already tracking
62
+ if (value === this.currentPromise) {
63
+ return;
64
+ }
65
+ this.currentPromise = value;
66
+ const gen = ++this.generation;
67
+ // Show pending template immediately
68
+ this.showTemplate(this.pendingTemplate);
69
+ debugLog('async', 'Tracking promise', { generation: gen });
70
+ value.then((_resolved) => {
71
+ if (gen !== this.generation)
72
+ return;
73
+ debugLog('async', 'Promise resolved', { generation: gen });
74
+ this.showTemplate(this.resolvedTemplate);
75
+ }, (_error) => {
76
+ if (gen !== this.generation)
77
+ return;
78
+ debugLog('async', 'Promise rejected', { generation: gen });
79
+ this.showTemplate(this.rejectedTemplate);
80
+ });
81
+ }
82
+ unmount() {
83
+ this.generation++;
84
+ this.clearRendered();
85
+ this.pendingTemplate = null;
86
+ this.resolvedTemplate = null;
87
+ this.rejectedTemplate = null;
88
+ this.activeTemplate = null;
89
+ this.currentPromise = null;
90
+ this.element = null;
91
+ }
92
+ // ── Internal ─────────────────────────────────────────
93
+ showTemplate(tpl) {
94
+ if (!this.element)
95
+ return;
96
+ // Remove previously cloned content (non-<template> children)
97
+ this.clearRendered();
98
+ if (tpl) {
99
+ const content = tpl.content.cloneNode(true);
100
+ this.element.appendChild(content);
101
+ this.activeTemplate = tpl;
102
+ }
103
+ }
104
+ clearRendered() {
105
+ if (!this.element)
106
+ return;
107
+ const nonTemplates = Array.from(this.element.children)
108
+ .filter(child => !(child instanceof HTMLTemplateElement));
109
+ for (const child of nonTemplates) {
110
+ child.remove();
111
+ }
112
+ this.activeTemplate = null;
113
+ }
114
+ }
115
+ //# sourceMappingURL=async.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.directive.js","sourceRoot":"","sources":["../../../../src/directives/structural/async.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,cAAe,SAAQ,aAAa;IACrC,eAAe,GAA+B,IAAI,CAAC;IACnD,gBAAgB,GAA+B,IAAI,CAAC;IACpD,gBAAgB,GAA+B,IAAI,CAAC;IACpD,cAAc,GAA+B,IAAI,CAAC;IAClD,cAAc,GAA4B,IAAI,CAAC;IAC/C,UAAU,GAAG,CAAC,CAAC;IAEvB,wDAAwD;IAExD,KAAK,CAAC,OAAgB;QAClB,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,mEAAmE;QACnE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;QACnE,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;YAC1B,IAAI,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9B,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;YAC/B,CAAC;iBAAM,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;YAChC,CAAC;iBAAM,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;YAChC,CAAC;QACL,CAAC;QAED,QAAQ,CAAC,OAAO,EAAE,iBAAiB,EAAE;YACjC,OAAO,EAAE,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Callback mode (existing)
6
+ * ```html
7
+ * <li #for=${[this.items, (item) => html`<div>${item}</div>`]}></li>
8
+ * ```
9
+ *
10
+ * ## Template mode
11
+ * Pass just the items array. The directive clones the child `<template>`
12
+ * for each item, interpolating `{{$item}}` / `{{$index}}` tokens:
13
+ * ```html
14
+ * <ul #for=${this.users}>
15
+ * <template>
16
+ * <li>{{$index}}. {{$item.name}} — {{$item.email}}</li>
17
+ * </template>
18
+ * </ul>
19
+ * ```
20
+ */
21
+ export declare class ForDirective extends StructuralDirective {
22
+ private callback;
23
+ private itemsData;
24
+ private childInstances;
25
+ private get processor();
26
+ private startMarker;
27
+ private endMarker;
28
+ /** The `<template>` child found inside the host element (grabbed before mount replaces it) */
29
+ private itemTemplate;
30
+ mount(element: Element): void;
31
+ protected updateContent(items: unknown[]): Promise<void>;
32
+ private updateContentFromTemplate;
33
+ update(value: unknown): Promise<void>;
34
+ private clearChildren;
35
+ unmount(): void;
36
+ }
37
+ //# sourceMappingURL=for.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"for.directive.d.ts","sourceRoot":"","sources":["../../../../src/directives/structural/for.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA6D7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,YAAa,SAAQ,mBAAmB;IACjD,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,cAAc,CAAa;IAEnC,OAAO,KAAK,SAAS,GAEpB;IACD,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,SAAS,CAAwB;IAGzC,8FAA8F;IAC9F,OAAO,CAAC,YAAY,CAAoC;IAExD,KAAK,CAAC,OAAO,EAAE,OAAO;cAmBN,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C9D,OAAO,CAAC,yBAAyB;IAgC3B,MAAM,CAAC,KAAK,EAAE,OAAO;IAqB3B,OAAO,CAAC,aAAa;IAoBrB,OAAO;CAeV"}
@@ -0,0 +1,209 @@
1
+ import { StructuralDirective } from './structural.directive';
2
+ import { debugLog } from '../../utils/debug';
3
+ import { TemplateResult } from '../../processor/template-result';
4
+ import { getDefaultProcessor } from '../../processor/types';
5
+ /**
6
+ * Resolve a dotted property path like "$item.name" against a scope object.
7
+ * Returns the resolved value, or '' if any segment is undefined.
8
+ */
9
+ function resolvePath(scope, path) {
10
+ const parts = path.split('.');
11
+ let current = scope;
12
+ for (const part of parts) {
13
+ if (current === null || current === undefined)
14
+ return '';
15
+ current = current[part];
16
+ }
17
+ return current === null || current === undefined ? '' : String(current);
18
+ }
19
+ /**
20
+ * Replace all `{{$item}}`, `{{$item.prop.sub}}`, and `{{$index}}`
21
+ * tokens in a string with values from the given scope.
22
+ */
23
+ function interpolate(text, scope) {
24
+ return text.replace(/\{\{(\$[a-zA-Z0-9_.]+)\}\}/g, (_match, expr) => {
25
+ return resolvePath(scope, expr);
26
+ });
27
+ }
28
+ /**
29
+ * Walk every Text node and attribute value in a DOM tree and interpolate
30
+ * `{{$item}}` / `{{$index}}` tokens.
31
+ */
32
+ function interpolateDOM(root, scope) {
33
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT);
34
+ let node = root;
35
+ while (node) {
36
+ if (node.nodeType === Node.TEXT_NODE) {
37
+ const text = node;
38
+ if (text.nodeValue && text.nodeValue.includes('{{')) {
39
+ text.nodeValue = interpolate(text.nodeValue, scope);
40
+ }
41
+ }
42
+ else if (node.nodeType === Node.ELEMENT_NODE) {
43
+ const el = node;
44
+ for (const attr of Array.from(el.attributes)) {
45
+ if (attr.value.includes('{{')) {
46
+ attr.value = interpolate(attr.value, scope);
47
+ }
48
+ }
49
+ }
50
+ node = walker.nextNode();
51
+ }
52
+ }
53
+ /**
54
+ * For directive — list iteration.
55
+ *
56
+ * ## Callback mode (existing)
57
+ * ```html
58
+ * <li #for=${[this.items, (item) => html`<div>${item}</div>`]}></li>
59
+ * ```
60
+ *
61
+ * ## Template mode
62
+ * Pass just the items array. The directive clones the child `<template>`
63
+ * for each item, interpolating `{{$item}}` / `{{$index}}` tokens:
64
+ * ```html
65
+ * <ul #for=${this.users}>
66
+ * <template>
67
+ * <li>{{$index}}. {{$item.name}} — {{$item.email}}</li>
68
+ * </template>
69
+ * </ul>
70
+ * ```
71
+ */
72
+ export class ForDirective extends StructuralDirective {
73
+ callback = null;
74
+ itemsData = null;
75
+ childInstances = [];
76
+ get processor() {
77
+ return getDefaultProcessor();
78
+ }
79
+ startMarker = null;
80
+ endMarker = null;
81
+ // ── Template mode ────────────────────────────────────
82
+ /** The `<template>` child found inside the host element (grabbed before mount replaces it) */
83
+ itemTemplate = null;
84
+ mount(element) {
85
+ // Grab the <template> child BEFORE super.mount() replaces the element
86
+ const tpl = element.querySelector('template');
87
+ if (tpl) {
88
+ this.itemTemplate = tpl;
89
+ debugLog('for', 'Found <template> child — entering template mode');
90
+ }
91
+ super.mount(element);
92
+ // Create start/end markers to delimit the list region
93
+ this.startMarker = document.createComment('for-start');
94
+ this.endMarker = document.createComment('for-end');
95
+ this.comment.parentNode.insertBefore(this.startMarker, this.comment);
96
+ this.comment.parentNode.insertBefore(this.endMarker, this.comment);
97
+ }
98
+ // ── Callback mode (existing) ─────────────────────────
99
+ async updateContent(items) {
100
+ if (!Array.isArray(items) || !this.startMarker?.parentNode || !this.callback) {
101
+ debugLog('for', 'Cannot update: missing requirements', {
102
+ isArray: Array.isArray(items),
103
+ hasMarker: !!this.startMarker,
104
+ hasCallback: !!this.callback,
105
+ items: items
106
+ });
107
+ return;
108
+ }
109
+ debugLog('for', 'Updating for directive (callback mode)', {
110
+ items,
111
+ currentItems: this.childInstances.length,
112
+ callback: this.callback
113
+ });
114
+ // Disconnect and remove previous items
115
+ this.clearChildren();
116
+ // Render each item through the TemplateProcessor to preserve bindings
117
+ const fragment = document.createDocumentFragment();
118
+ for (let index = 0; index < items.length; index++) {
119
+ const item = items[index];
120
+ debugLog('for', 'Rendering item', { item, index });
121
+ const result = this.callback(item, index);
122
+ if (result instanceof TemplateResult && this.processor) {
123
+ const instance = await this.processor.createInstance(result, { item, index });
124
+ this.childInstances.push(instance);
125
+ fragment.appendChild(instance.getFragment());
126
+ }
127
+ else {
128
+ fragment.appendChild(document.createTextNode(String(result)));
129
+ }
130
+ }
131
+ // Insert all rendered items between the markers
132
+ this.endMarker.parentNode.insertBefore(fragment, this.endMarker);
133
+ }
134
+ // ── Template mode (new) ──────────────────────────────
135
+ updateContentFromTemplate(items) {
136
+ if (!Array.isArray(items) || !this.startMarker?.parentNode || !this.itemTemplate) {
137
+ return;
138
+ }
139
+ debugLog('for', 'Updating for directive (template mode)', {
140
+ itemCount: items.length,
141
+ });
142
+ this.clearChildren();
143
+ const fragment = document.createDocumentFragment();
144
+ for (let index = 0; index < items.length; index++) {
145
+ const item = items[index];
146
+ const clone = this.itemTemplate.content.cloneNode(true);
147
+ // Build scope: {{$item}}, {{$item.name}}, {{$index}}
148
+ const scope = {
149
+ $item: item,
150
+ $index: index,
151
+ };
152
+ interpolateDOM(clone, scope);
153
+ fragment.appendChild(clone);
154
+ }
155
+ this.endMarker.parentNode.insertBefore(fragment, this.endMarker);
156
+ }
157
+ // ── Dispatch ─────────────────────────────────────────
158
+ async update(value) {
159
+ debugLog('for', 'Update called with', { value, type: typeof value });
160
+ // Callback mode: [items, callback]
161
+ if (Array.isArray(value) && value.length === 2 && typeof value[1] === 'function') {
162
+ this.itemsData = value[0];
163
+ this.callback = value[1];
164
+ await this.updateContent(this.itemsData);
165
+ return;
166
+ }
167
+ // Template mode: plain array + <template> child
168
+ if (Array.isArray(value) && this.itemTemplate) {
169
+ this.itemsData = value;
170
+ this.updateContentFromTemplate(value);
171
+ return;
172
+ }
173
+ debugLog('for', 'Unrecognised value shape', { value });
174
+ }
175
+ clearChildren() {
176
+ // Disconnect all child template instances
177
+ for (const instance of this.childInstances) {
178
+ if (instance.disconnect) {
179
+ instance.disconnect();
180
+ }
181
+ }
182
+ this.childInstances = [];
183
+ // Remove DOM nodes between markers
184
+ if (this.startMarker && this.endMarker) {
185
+ let node = this.startMarker.nextSibling;
186
+ while (node && node !== this.endMarker) {
187
+ const next = node.nextSibling;
188
+ node.parentNode?.removeChild(node);
189
+ node = next;
190
+ }
191
+ }
192
+ }
193
+ unmount() {
194
+ this.clearChildren();
195
+ if (this.startMarker?.parentNode) {
196
+ this.startMarker.parentNode.removeChild(this.startMarker);
197
+ }
198
+ if (this.endMarker?.parentNode) {
199
+ this.endMarker.parentNode.removeChild(this.endMarker);
200
+ }
201
+ this.startMarker = null;
202
+ this.endMarker = null;
203
+ this.callback = null;
204
+ this.itemsData = null;
205
+ this.itemTemplate = null;
206
+ super.unmount();
207
+ }
208
+ }
209
+ //# sourceMappingURL=for.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"for.directive.js","sourceRoot":"","sources":["../../../../src/directives/structural/for.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAMhF;;;GAGG;AACH,SAAS,WAAW,CAAC,KAA8B,EAAE,IAAY;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,OAAO,GAAY,KAAK,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACzD,OAAO,GAAI,OAAmC,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,OAAO,KA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