@pithyjs/core 0.1.0-beta.0 → 0.1.0-beta.10

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 (226) hide show
  1. package/README.md +37 -6
  2. package/dist/a11y/focus-trap.d.ts.map +1 -1
  3. package/dist/a11y/focus-trap.js +2 -0
  4. package/dist/a11y/focus-trap.js.map +1 -1
  5. package/dist/a11y/index.d.ts +4 -4
  6. package/dist/a11y/index.js +4 -4
  7. package/dist/a11y/index.js.map +1 -1
  8. package/dist/a11y/keyboard-utils.js.map +1 -1
  9. package/dist/a11y/roving-tabindex.js.map +1 -1
  10. package/dist/a11y/skip-link.js.map +1 -1
  11. package/dist/compile/bindSwitchCases.d.ts +8 -3
  12. package/dist/compile/bindSwitchCases.d.ts.map +1 -1
  13. package/dist/compile/bindSwitchCases.js +113 -177
  14. package/dist/compile/bindSwitchCases.js.map +1 -1
  15. package/dist/compile/binds/bindBoundAttributes.d.ts +1 -0
  16. package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
  17. package/dist/compile/binds/bindBoundAttributes.js +24 -2
  18. package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
  19. package/dist/compile/binds/bindClassDirectives.d.ts +3 -0
  20. package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
  21. package/dist/compile/binds/bindClassDirectives.js +59 -21
  22. package/dist/compile/binds/bindClassDirectives.js.map +1 -1
  23. package/dist/compile/binds/bindComponentsTags.d.ts +2 -0
  24. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
  25. package/dist/compile/binds/bindComponentsTags.js +171 -74
  26. package/dist/compile/binds/bindComponentsTags.js.map +1 -1
  27. package/dist/compile/binds/bindConditionals.d.ts +2 -2
  28. package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
  29. package/dist/compile/binds/bindConditionals.js +22 -5
  30. package/dist/compile/binds/bindConditionals.js.map +1 -1
  31. package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
  32. package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
  33. package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
  34. package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
  35. package/dist/compile/binds/bindDeferDirectives.js +45 -15
  36. package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
  37. package/dist/compile/binds/bindErrorBoundary.d.ts +13 -2
  38. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
  39. package/dist/compile/binds/bindErrorBoundary.js +25 -10
  40. package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
  41. package/dist/compile/binds/bindEventHandlers.js +2 -2
  42. package/dist/compile/binds/bindEventHandlers.js.map +1 -1
  43. package/dist/compile/binds/bindRefDirectives.js.map +1 -1
  44. package/dist/compile/binds/bindStyleDirectives.d.ts +17 -0
  45. package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -0
  46. package/dist/compile/binds/bindStyleDirectives.js +47 -0
  47. package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
  48. package/dist/compile/binds/bindTextInterpolations.d.ts +2 -1
  49. package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
  50. package/dist/compile/binds/bindTextInterpolations.js +55 -17
  51. package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
  52. package/dist/compile/binds/directiveRegistry.js.map +1 -1
  53. package/dist/compile/binds/forwardedAttrs.d.ts +22 -0
  54. package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -0
  55. package/dist/compile/binds/forwardedAttrs.js +66 -0
  56. package/dist/compile/binds/forwardedAttrs.js.map +1 -0
  57. package/dist/compile/binds/propNames.d.ts +14 -0
  58. package/dist/compile/binds/propNames.d.ts.map +1 -0
  59. package/dist/compile/binds/propNames.js +116 -0
  60. package/dist/compile/binds/propNames.js.map +1 -0
  61. package/dist/compile/compileExpression.js.map +1 -1
  62. package/dist/compile/compileNodes.d.ts.map +1 -1
  63. package/dist/compile/compileNodes.js +6 -3
  64. package/dist/compile/compileNodes.js.map +1 -1
  65. package/dist/compile/compileTemplate.d.ts +3 -4
  66. package/dist/compile/compileTemplate.d.ts.map +1 -1
  67. package/dist/compile/compileTemplate.js +28 -31
  68. package/dist/compile/compileTemplate.js.map +1 -1
  69. package/dist/compile/componentResult.d.ts +100 -0
  70. package/dist/compile/componentResult.d.ts.map +1 -0
  71. package/dist/compile/componentResult.js +138 -0
  72. package/dist/compile/componentResult.js.map +1 -0
  73. package/dist/compile/contentProjection.d.ts +1 -1
  74. package/dist/compile/contentProjection.d.ts.map +1 -1
  75. package/dist/compile/contentProjection.js +32 -15
  76. package/dist/compile/contentProjection.js.map +1 -1
  77. package/dist/compile/forLoops/bindForLoops.d.ts +2 -2
  78. package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
  79. package/dist/compile/forLoops/bindForLoops.js +9 -22
  80. package/dist/compile/forLoops/bindForLoops.js.map +1 -1
  81. package/dist/compile/forLoops/createLoopManager.d.ts +6 -3
  82. package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
  83. package/dist/compile/forLoops/createLoopManager.js +144 -114
  84. package/dist/compile/forLoops/createLoopManager.js.map +1 -1
  85. package/dist/compile/forLoops/index.d.ts +5 -5
  86. package/dist/compile/forLoops/index.js +5 -5
  87. package/dist/compile/forLoops/index.js.map +1 -1
  88. package/dist/compile/forLoops/loopHelpers.d.ts +6 -0
  89. package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -1
  90. package/dist/compile/forLoops/loopHelpers.js +17 -0
  91. package/dist/compile/forLoops/loopHelpers.js.map +1 -1
  92. package/dist/compile/forLoops/loopSignals.js +2 -2
  93. package/dist/compile/forLoops/loopSignals.js.map +1 -1
  94. package/dist/compile/forLoops/loopTraversal.js +2 -2
  95. package/dist/compile/forLoops/loopTraversal.js.map +1 -1
  96. package/dist/compile/handleConditionalChain.d.ts +2 -2
  97. package/dist/compile/handleConditionalChain.d.ts.map +1 -1
  98. package/dist/compile/handleConditionalChain.js +21 -83
  99. package/dist/compile/handleConditionalChain.js.map +1 -1
  100. package/dist/compile/index.d.ts +17 -14
  101. package/dist/compile/index.d.ts.map +1 -1
  102. package/dist/compile/index.js +28 -12
  103. package/dist/compile/index.js.map +1 -1
  104. package/dist/compile/injectScopedStyle.js.map +1 -1
  105. package/dist/compile/nodeExpando.d.ts +6 -0
  106. package/dist/compile/nodeExpando.d.ts.map +1 -1
  107. package/dist/compile/nodeExpando.js.map +1 -1
  108. package/dist/compile/parseHtml.d.ts.map +1 -1
  109. package/dist/compile/parseHtml.js +2 -2
  110. package/dist/compile/parseHtml.js.map +1 -1
  111. package/dist/compile/pithyTreeToDom.js +1 -1
  112. package/dist/compile/pithyTreeToDom.js.map +1 -1
  113. package/dist/compile/renderBranch.d.ts +13 -0
  114. package/dist/compile/renderBranch.d.ts.map +1 -0
  115. package/dist/compile/renderBranch.js +65 -0
  116. package/dist/compile/renderBranch.js.map +1 -0
  117. package/dist/compile/renderChildren.d.ts +17 -0
  118. package/dist/compile/renderChildren.d.ts.map +1 -1
  119. package/dist/compile/renderChildren.js +22 -3
  120. package/dist/compile/renderChildren.js.map +1 -1
  121. package/dist/compile/ssrCrashes.d.ts +116 -0
  122. package/dist/compile/ssrCrashes.d.ts.map +1 -0
  123. package/dist/compile/ssrCrashes.js +173 -0
  124. package/dist/compile/ssrCrashes.js.map +1 -0
  125. package/dist/compile/ssrMode.js +1 -1
  126. package/dist/compile/ssrMode.js.map +1 -1
  127. package/dist/compile/textValue.js.map +1 -1
  128. package/dist/compile/trimBlankEdges.d.ts +2 -0
  129. package/dist/compile/trimBlankEdges.d.ts.map +1 -0
  130. package/dist/compile/trimBlankEdges.js +15 -0
  131. package/dist/compile/trimBlankEdges.js.map +1 -0
  132. package/dist/config/index.js.map +1 -1
  133. package/dist/index.d.ts +6 -6
  134. package/dist/index.js +6 -6
  135. package/dist/index.js.map +1 -1
  136. package/dist/interfaces/index.d.ts +2 -2
  137. package/dist/interfaces/index.js +2 -2
  138. package/dist/interfaces/index.js.map +1 -1
  139. package/dist/interfaces/ref-signal.interface.js.map +1 -1
  140. package/dist/interfaces/ref.interface.js.map +1 -1
  141. package/dist/runtime/applyBindings.d.ts +5 -5
  142. package/dist/runtime/applyBindings.d.ts.map +1 -1
  143. package/dist/runtime/applyBindings.js +97 -21
  144. package/dist/runtime/applyBindings.js.map +1 -1
  145. package/dist/runtime/bindings/applyComponent.d.ts +2 -2
  146. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
  147. package/dist/runtime/bindings/applyComponent.js +137 -39
  148. package/dist/runtime/bindings/applyComponent.js.map +1 -1
  149. package/dist/runtime/bindings/applyDefer.d.ts +1 -1
  150. package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
  151. package/dist/runtime/bindings/applyDefer.js +46 -18
  152. package/dist/runtime/bindings/applyDefer.js.map +1 -1
  153. package/dist/runtime/bindings/applySimple.d.ts +2 -1
  154. package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
  155. package/dist/runtime/bindings/applySimple.js +70 -14
  156. package/dist/runtime/bindings/applySimple.js.map +1 -1
  157. package/dist/runtime/bindings/applyStructural.d.ts +1 -1
  158. package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
  159. package/dist/runtime/bindings/applyStructural.js +58 -68
  160. package/dist/runtime/bindings/applyStructural.js.map +1 -1
  161. package/dist/runtime/bindings/helpers.d.ts +1 -1
  162. package/dist/runtime/bindings/helpers.js +1 -1
  163. package/dist/runtime/bindings/helpers.js.map +1 -1
  164. package/dist/runtime/bindings/index.d.ts +6 -6
  165. package/dist/runtime/bindings/index.d.ts.map +1 -1
  166. package/dist/runtime/bindings/index.js +5 -5
  167. package/dist/runtime/bindings/index.js.map +1 -1
  168. package/dist/runtime/bindings/types.d.ts +12 -1
  169. package/dist/runtime/bindings/types.d.ts.map +1 -1
  170. package/dist/runtime/bindings/types.js.map +1 -1
  171. package/dist/runtime/bootstrap.d.ts +1 -1
  172. package/dist/runtime/bootstrap.js +1 -1
  173. package/dist/runtime/bootstrap.js.map +1 -1
  174. package/dist/runtime/createContextProxy.js.map +1 -1
  175. package/dist/runtime/deferHelpers.d.ts +1 -1
  176. package/dist/runtime/deferHelpers.js.map +1 -1
  177. package/dist/runtime/html.d.ts.map +1 -1
  178. package/dist/runtime/html.js +6 -5
  179. package/dist/runtime/html.js.map +1 -1
  180. package/dist/runtime/index.d.ts +6 -5
  181. package/dist/runtime/index.d.ts.map +1 -1
  182. package/dist/runtime/index.js +7 -5
  183. package/dist/runtime/index.js.map +1 -1
  184. package/dist/runtime/lazy.js +1 -1
  185. package/dist/runtime/lazy.js.map +1 -1
  186. package/dist/runtime/module-cache.js.map +1 -1
  187. package/dist/runtime/onDestroy.d.ts +7 -0
  188. package/dist/runtime/onDestroy.d.ts.map +1 -1
  189. package/dist/runtime/onDestroy.js +16 -1
  190. package/dist/runtime/onDestroy.js.map +1 -1
  191. package/dist/runtime/parseIdentifiersFromTemplate.js +1 -1
  192. package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -1
  193. package/dist/runtime/resource/createAction.d.ts +44 -0
  194. package/dist/runtime/resource/createAction.d.ts.map +1 -0
  195. package/dist/runtime/resource/createAction.js +102 -0
  196. package/dist/runtime/resource/createAction.js.map +1 -0
  197. package/dist/runtime/resource/createResource.d.ts +56 -0
  198. package/dist/runtime/resource/createResource.d.ts.map +1 -0
  199. package/dist/runtime/resource/createResource.js +102 -0
  200. package/dist/runtime/resource/createResource.js.map +1 -0
  201. package/dist/runtime/resource/engine.d.ts +136 -0
  202. package/dist/runtime/resource/engine.d.ts.map +1 -0
  203. package/dist/runtime/resource/engine.js +363 -0
  204. package/dist/runtime/resource/engine.js.map +1 -0
  205. package/dist/runtime/resource/index.d.ts +19 -0
  206. package/dist/runtime/resource/index.d.ts.map +1 -0
  207. package/dist/runtime/resource/index.js +18 -0
  208. package/dist/runtime/resource/index.js.map +1 -0
  209. package/dist/runtime/resource/types.d.ts +240 -0
  210. package/dist/runtime/resource/types.d.ts.map +1 -0
  211. package/dist/runtime/resource/types.js +9 -0
  212. package/dist/runtime/resource/types.js.map +1 -0
  213. package/dist/types/globals.d.ts +10 -1
  214. package/dist/types/globals.d.ts.map +1 -1
  215. package/dist/types/globals.js.map +1 -1
  216. package/dist/types/index.d.ts +15 -1
  217. package/dist/types/index.d.ts.map +1 -1
  218. package/dist/types/index.js.map +1 -1
  219. package/dist/utilities/index.d.ts +2 -2
  220. package/dist/utilities/index.js +2 -2
  221. package/dist/utilities/index.js.map +1 -1
  222. package/dist/utilities/ref-signal.utility.d.ts +1 -1
  223. package/dist/utilities/ref-signal.utility.js.map +1 -1
  224. package/dist/utilities/ref.untility.d.ts +1 -1
  225. package/dist/utilities/ref.untility.js.map +1 -1
  226. package/package.json +14 -9
@@ -0,0 +1,138 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.compile.component-result",
4
+ "title": "Component Result Validation",
5
+ "category": "compiler",
6
+ "risk": "high"
7
+ }
8
+ */
9
+ /**
10
+ * Is `value` something a binder can actually put into the document?
11
+ *
12
+ * A component contract is `{ el, destroy }`, and both binders used to accept it
13
+ * on the strength of `'el' in out` alone. That is a presence check, not a type
14
+ * check: `{ el: null }` satisfies it, and `el.replaceWith(null)` does not throw
15
+ * — the DOM stringifies the argument, so the page ships the literal text
16
+ * `null` where the component should have been.
17
+ *
18
+ * Measured before this guard existed, in SSR:
19
+ *
20
+ * ```
21
+ * records = 0 html = <div ...>null</div>
22
+ * ```
23
+ *
24
+ * Zero crashes reported, exit 0, and visible garbage in the output — worse than
25
+ * the raw unrendered tag BUG-018 was about, because that at least renders as
26
+ * nothing. TypeScript does not help: an app can be JavaScript, or can cast.
27
+ *
28
+ * `nodeType` alone is not enough, because it is just a property any object can
29
+ * have. `{ nodeType: 1, toString: () => 'BROKEN' }` passed an earlier version of
30
+ * this guard, and `replaceWith` then stringified it into the page exactly like
31
+ * `null` did:
32
+ *
33
+ * ```
34
+ * records = 0 html = <div ...>BROKEN</div>
35
+ * ```
36
+ *
37
+ * So the value must also really be a `Node`. That check has to work ACROSS
38
+ * realms, because a component may legitimately return a node built by another
39
+ * `Window` — an iframe's `contentDocument`, or a module-level `document`
40
+ * captured under a previous route's happy-dom window. A plain
41
+ * `instanceof Node` rejects those, and since both binders run this guard in the
42
+ * browser too, that would turn working components into "invalid render result".
43
+ *
44
+ * Two checks, in order of strength:
45
+ *
46
+ * 1. `instanceof` against the `Node` of `reference`'s realm — the placeholder
47
+ * the binder is replacing, which is by construction a real node in the
48
+ * document being rendered. This is the common case and the strongest
49
+ * signal. The realm comes from `reference` and NEVER from `value`: an
50
+ * earlier version read `value.ownerDocument.defaultView.Node`, which let the
51
+ * candidate nominate its own validator (`{ Node: Object }` passes trivially).
52
+ *
53
+ * 2. Failing that, a structural brand that survives realm boundaries. Real
54
+ * nodes expose `nodeType`, `nodeName` and `cloneNode` through their
55
+ * prototype; a hand-made object carries them as OWN properties, which is
56
+ * what separates a foreign `HTMLSpanElement` from
57
+ * `{ nodeType: 1, toString: () => 'BROKEN' }` — measured, both branches are
58
+ * tested.
59
+ *
60
+ * KNOWN LIMIT, stated rather than glossed: this is defeated by a deliberate
61
+ * forgery. `Object.create({ nodeType: 1, nodeName: 'SPAN', cloneNode() {} })`
62
+ * puts the whole shape on the prototype, so the own-vs-inherited test says
63
+ * "real node", and `replaceWith` then stringifies it into the page.
64
+ *
65
+ * The guard is not escalated further because every stronger static test is
66
+ * worse: `instanceof` alone rejects genuine foreign nodes, and `Symbol.toStringTag`
67
+ * defeats a `[object HTMLDivElement]` brand just as easily. The one check that
68
+ * cannot be forged is observing whether the node actually landed after
69
+ * `replaceWith` — that was implemented and REVERTED, because the JIT binds a
70
+ * structural branch on a detached tree first, where `replaceWith` legitimately
71
+ * does nothing and the retry does the real work: the observation could not tell
72
+ * that apart from stringification and failed `apps/gliora-dashboard`'s `/login`
73
+ * route, whose emitted HTML is in fact complete (4 form-field elements, 2 labels,
74
+ * 2 inputs, no raw tags).
75
+ *
76
+ * So the scope here is ACCIDENT, not adversary: a component returning the wrong
77
+ * shape by mistake — `{ el: null }`, `{ el: undefined }`, a bare options object —
78
+ * which is the failure that actually occurs. A component in your own app that
79
+ * deliberately forges DOM internals is not a threat this layer can address, and
80
+ * pretending otherwise would cost working pages. Tracked in docs/BACKLOG.md.
81
+ *
82
+ * Deliberately **not** an allowlist of node types. The question here is "is this
83
+ * a node at all", not "is it a node I like": a component returning
84
+ * `document.createTextNode('hi')` renders correctly through `replaceWith`, and
85
+ * an earlier version that admitted only elements and fragments silently narrowed
86
+ * the contract and dropped such a subtree. Anything that is a real node but
87
+ * cannot actually be inserted — a `Document`, say — throws inside `replaceWith`,
88
+ * which is already recorded as a failed replacement and gives a truthful error.
89
+ *
90
+ * Fails **open** when nothing can be resolved to check against. A guard that
91
+ * cannot check must not reject everything: with neither a realm on `reference`
92
+ * nor an ambient `Node`, rejecting would record a crash for every component and
93
+ * fail every route — far worse than the malformed output this guards against.
94
+ *
95
+ * @param value - the `el` a component returned
96
+ * @param reference - a node known to be real, whose realm defines `Node`
97
+ */
98
+ /** @codexApi {"parent":"pithy.compile.component-result","name":"isRenderableComponentEl","stability":"internal","signature":"(value: unknown, reference?: Node | null) => boolean"} */
99
+ export function isRenderableComponentEl(value, reference) {
100
+ if (!value || typeof value !== 'object')
101
+ return false;
102
+ if (typeof value.nodeType !== 'number') {
103
+ return false;
104
+ }
105
+ const NodeCtor = trustedNodeConstructor(reference);
106
+ if (typeof NodeCtor !== 'function')
107
+ return true;
108
+ if (value instanceof NodeCtor)
109
+ return true;
110
+ return hasCrossRealmNodeBrand(value);
111
+ }
112
+ /**
113
+ * Does `value` carry the DOM's own shape rather than a hand-made imitation of
114
+ * it? Used only for nodes from another realm, where `instanceof` cannot help.
115
+ *
116
+ * The discriminator is *own* versus *inherited*: a real node — local or foreign
117
+ * — gets these from `Node.prototype`, so `hasOwnProperty` is false for all of
118
+ * them, while an object literal has to declare each one itself.
119
+ */
120
+ function hasCrossRealmNodeBrand(value) {
121
+ const own = (key) => Object.prototype.hasOwnProperty.call(value, key);
122
+ if (own('nodeType') || own('nodeName') || own('cloneNode'))
123
+ return false;
124
+ const candidate = value;
125
+ return (typeof candidate.nodeName === 'string' &&
126
+ typeof candidate.cloneNode === 'function');
127
+ }
128
+ /**
129
+ * The `Node` constructor from `reference`'s realm, falling back to the ambient
130
+ * global. Deliberately never reads anything off the value being validated.
131
+ */
132
+ function trustedNodeConstructor(reference) {
133
+ const view = reference?.ownerDocument?.defaultView?.Node;
134
+ if (typeof view === 'function')
135
+ return view;
136
+ return globalThis.Node;
137
+ }
138
+ //# sourceMappingURL=componentResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentResult.js","sourceRoot":"","sources":["../../src/compile/componentResult.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,uLAAuL;AACvL,MAAM,UAAU,uBAAuB,CACrC,KAAc,EACd,SAAuB;IAEvB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,OAAQ,KAAgC,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAChD,IAAI,KAAK,YAAY,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3C,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,KAAa;IAC3C,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9E,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IAEzE,MAAM,SAAS,GAAG,KAAoD,CAAC;IACvE,OAAO,CACL,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU,CAC1C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,SAAuB;IACrD,MAAM,IAAI,GACR,SACD,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,CAAC;IACpC,IAAI,OAAO,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAE5C,OAAQ,UAAiC,CAAC,IAAI,CAAC;AACjD,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.compile.component-result\",\n \"title\": \"Component Result Validation\",\n \"category\": \"compiler\",\n \"risk\": \"high\"\n}\n*/\n\n/**\n * Is `value` something a binder can actually put into the document?\n *\n * A component contract is `{ el, destroy }`, and both binders used to accept it\n * on the strength of `'el' in out` alone. That is a presence check, not a type\n * check: `{ el: null }` satisfies it, and `el.replaceWith(null)` does not throw\n * — the DOM stringifies the argument, so the page ships the literal text\n * `null` where the component should have been.\n *\n * Measured before this guard existed, in SSR:\n *\n * ```\n * records = 0 html = <div ...>null</div>\n * ```\n *\n * Zero crashes reported, exit 0, and visible garbage in the output — worse than\n * the raw unrendered tag BUG-018 was about, because that at least renders as\n * nothing. TypeScript does not help: an app can be JavaScript, or can cast.\n *\n * `nodeType` alone is not enough, because it is just a property any object can\n * have. `{ nodeType: 1, toString: () => 'BROKEN' }` passed an earlier version of\n * this guard, and `replaceWith` then stringified it into the page exactly like\n * `null` did:\n *\n * ```\n * records = 0 html = <div ...>BROKEN</div>\n * ```\n *\n * So the value must also really be a `Node`. That check has to work ACROSS\n * realms, because a component may legitimately return a node built by another\n * `Window` — an iframe's `contentDocument`, or a module-level `document`\n * captured under a previous route's happy-dom window. A plain\n * `instanceof Node` rejects those, and since both binders run this guard in the\n * browser too, that would turn working components into \"invalid render result\".\n *\n * Two checks, in order of strength:\n *\n * 1. `instanceof` against the `Node` of `reference`'s realm — the placeholder\n * the binder is replacing, which is by construction a real node in the\n * document being rendered. This is the common case and the strongest\n * signal. The realm comes from `reference` and NEVER from `value`: an\n * earlier version read `value.ownerDocument.defaultView.Node`, which let the\n * candidate nominate its own validator (`{ Node: Object }` passes trivially).\n *\n * 2. Failing that, a structural brand that survives realm boundaries. Real\n * nodes expose `nodeType`, `nodeName` and `cloneNode` through their\n * prototype; a hand-made object carries them as OWN properties, which is\n * what separates a foreign `HTMLSpanElement` from\n * `{ nodeType: 1, toString: () => 'BROKEN' }` — measured, both branches are\n * tested.\n *\n * KNOWN LIMIT, stated rather than glossed: this is defeated by a deliberate\n * forgery. `Object.create({ nodeType: 1, nodeName: 'SPAN', cloneNode() {} })`\n * puts the whole shape on the prototype, so the own-vs-inherited test says\n * \"real node\", and `replaceWith` then stringifies it into the page.\n *\n * The guard is not escalated further because every stronger static test is\n * worse: `instanceof` alone rejects genuine foreign nodes, and `Symbol.toStringTag`\n * defeats a `[object HTMLDivElement]` brand just as easily. The one check that\n * cannot be forged is observing whether the node actually landed after\n * `replaceWith` — that was implemented and REVERTED, because the JIT binds a\n * structural branch on a detached tree first, where `replaceWith` legitimately\n * does nothing and the retry does the real work: the observation could not tell\n * that apart from stringification and failed `apps/gliora-dashboard`'s `/login`\n * route, whose emitted HTML is in fact complete (4 form-field elements, 2 labels,\n * 2 inputs, no raw tags).\n *\n * So the scope here is ACCIDENT, not adversary: a component returning the wrong\n * shape by mistake — `{ el: null }`, `{ el: undefined }`, a bare options object —\n * which is the failure that actually occurs. A component in your own app that\n * deliberately forges DOM internals is not a threat this layer can address, and\n * pretending otherwise would cost working pages. Tracked in docs/BACKLOG.md.\n *\n * Deliberately **not** an allowlist of node types. The question here is \"is this\n * a node at all\", not \"is it a node I like\": a component returning\n * `document.createTextNode('hi')` renders correctly through `replaceWith`, and\n * an earlier version that admitted only elements and fragments silently narrowed\n * the contract and dropped such a subtree. Anything that is a real node but\n * cannot actually be inserted — a `Document`, say — throws inside `replaceWith`,\n * which is already recorded as a failed replacement and gives a truthful error.\n *\n * Fails **open** when nothing can be resolved to check against. A guard that\n * cannot check must not reject everything: with neither a realm on `reference`\n * nor an ambient `Node`, rejecting would record a crash for every component and\n * fail every route — far worse than the malformed output this guards against.\n *\n * @param value - the `el` a component returned\n * @param reference - a node known to be real, whose realm defines `Node`\n */\n/** @codexApi {\"parent\":\"pithy.compile.component-result\",\"name\":\"isRenderableComponentEl\",\"stability\":\"internal\",\"signature\":\"(value: unknown, reference?: Node | null) => boolean\"} */\nexport function isRenderableComponentEl(\n value: unknown,\n reference?: Node | null\n): boolean {\n if (!value || typeof value !== 'object') return false;\n if (typeof (value as { nodeType?: unknown }).nodeType !== 'number') {\n return false;\n }\n\n const NodeCtor = trustedNodeConstructor(reference);\n if (typeof NodeCtor !== 'function') return true;\n if (value instanceof NodeCtor) return true;\n\n return hasCrossRealmNodeBrand(value);\n}\n\n/**\n * Does `value` carry the DOM's own shape rather than a hand-made imitation of\n * it? Used only for nodes from another realm, where `instanceof` cannot help.\n *\n * The discriminator is *own* versus *inherited*: a real node — local or foreign\n * — gets these from `Node.prototype`, so `hasOwnProperty` is false for all of\n * them, while an object literal has to declare each one itself.\n */\nfunction hasCrossRealmNodeBrand(value: object): boolean {\n const own = (key: string) => Object.prototype.hasOwnProperty.call(value, key);\n if (own('nodeType') || own('nodeName') || own('cloneNode')) return false;\n\n const candidate = value as { nodeName?: unknown; cloneNode?: unknown };\n return (\n typeof candidate.nodeName === 'string' &&\n typeof candidate.cloneNode === 'function'\n );\n}\n\n/**\n * The `Node` constructor from `reference`'s realm, falling back to the ambient\n * global. Deliberately never reads anything off the value being validated.\n */\nfunction trustedNodeConstructor(reference?: Node | null): unknown {\n const view = (\n reference as { ownerDocument?: { defaultView?: { Node?: unknown } } | null }\n )?.ownerDocument?.defaultView?.Node;\n if (typeof view === 'function') return view;\n\n return (globalThis as { Node?: unknown }).Node;\n}\n"]}
@@ -10,7 +10,7 @@ import { PithyNode } from '@pithyjs/compiler';
10
10
  * SlotMap contains renderer functions for each slot name.
11
11
  * Each entry is a factory that returns a DocumentFragment of the slot's content.
12
12
  */
13
- export type SlotMap = Map<string, () => DocumentFragment>;
13
+ export type SlotMap = Map<string, (disposers?: (() => void)[]) => DocumentFragment>;
14
14
  /**
15
15
  * SlotDef describes a slot anchor and its fallback content
16
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"contentProjection.d.ts","sourceRoot":"","sources":["../../src/compile/contentProjection.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE/E,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAaD,gMAAgM;AAChM,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,EAAE,EACrB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAiET;AAED,oKAAoK;AACpK,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,EAAE,CA6BrE;AAED,qMAAqM;AACrM,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAyJN"}
1
+ {"version":3,"file":"contentProjection.d.ts","sourceRoot":"","sources":["../../src/compile/contentProjection.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQ9C;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CACvB,MAAM,EACN,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,KAAK,gBAAgB,CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE/E,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAaD,gMAAgM;AAChM,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,EAAE,EACrB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAkFT;AAED,oKAAoK;AACpK,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,EAAE,CA6BrE;AAED,qMAAqM;AACrM,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAmKN"}
@@ -5,8 +5,12 @@
5
5
  "category": "feature"
6
6
  }
7
7
  */
8
- import { pithyTreeToDom } from './pithyTreeToDom';
9
- import { pithyGlobals } from '../types/globals';
8
+ import { pithyTreeToDom } from './pithyTreeToDom.js';
9
+ import { bindStructuralDirectives } from './compileTemplate.js';
10
+ import { nodeExpando } from './nodeExpando.js';
11
+ import { bindErrorBoundary } from './binds/bindErrorBoundary.js';
12
+ import { pithyGlobals } from '../types/globals.js';
13
+ import { trimBlankEdges } from './trimBlankEdges.js';
10
14
  function expando(node) {
11
15
  return node;
12
16
  }
@@ -22,6 +26,14 @@ export function collectSlotMap(children, parentContext) {
22
26
  }
23
27
  slotGroups.get(slotName).push(child);
24
28
  }
29
+ const defaultSlot = slotGroups.get('');
30
+ if (defaultSlot) {
31
+ const content = trimBlankEdges(defaultSlot, node => node.type === 'text' ? (node.textContent ?? '') : null);
32
+ if (content.length)
33
+ slotGroups.set('', content);
34
+ else
35
+ slotGroups.delete('');
36
+ }
25
37
  // Validate slot usage in DEV mode
26
38
  if (import.meta.env?.DEV) {
27
39
  const slotNames = Array.from(slotGroups.keys());
@@ -45,11 +57,15 @@ export function collectSlotMap(children, parentContext) {
45
57
  // Capture nodes and context in closure for stable reference
46
58
  const capturedNodes = nodes;
47
59
  const capturedContext = parentContext;
48
- const render = () => {
60
+ const render = (disposers = []) => {
49
61
  if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {
50
62
  console.log(`[PithyJS:Projection] Rendering slot "${slotName}" with ${capturedNodes.length} nodes`);
51
63
  }
52
- return pithyTreeToDom(capturedNodes, capturedContext);
64
+ const fragment = pithyTreeToDom(capturedNodes, capturedContext);
65
+ bindStructuralDirectives(capturedNodes, fragment, capturedContext, disposers);
66
+ bindErrorBoundary(fragment, capturedContext, disposers);
67
+ nodeExpando(fragment).__pithyCtx = capturedContext;
68
+ return fragment;
53
69
  };
54
70
  slotMap.set(slotName, render);
55
71
  }
@@ -107,7 +123,7 @@ export function mountProjection(slotDefs, slotMap, disposers) {
107
123
  let isProjectedContent = false;
108
124
  if (renderer) {
109
125
  // Use projected content
110
- contentFragment = renderer();
126
+ contentFragment = renderer(disposers);
111
127
  isProjectedContent = true;
112
128
  if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {
113
129
  console.log(`[PithyJS:Projection] Mounting projected content for slot "${name}"`);
@@ -116,6 +132,13 @@ export function mountProjection(slotDefs, slotMap, disposers) {
116
132
  else if (fallbackFactory) {
117
133
  // Use fallback content
118
134
  contentFragment = fallbackFactory() ?? null;
135
+ const slotNode = nodeExpando(anchor).__pithyNode;
136
+ if (contentFragment instanceof DocumentFragment &&
137
+ slotNode?.fallbackChildren) {
138
+ const fallbackCtx = nodeExpando(anchor).__pithyCtx ?? {};
139
+ bindStructuralDirectives(slotNode.fallbackChildren, contentFragment, fallbackCtx, disposers);
140
+ bindErrorBoundary(contentFragment, fallbackCtx, disposers);
141
+ }
119
142
  if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {
120
143
  console.log(`[PithyJS:Projection] Mounting fallback content for slot "${name}"`);
121
144
  }
@@ -151,18 +174,12 @@ export function mountProjection(slotDefs, slotMap, disposers) {
151
174
  current.textContent?.startsWith('slot:')) {
152
175
  break;
153
176
  }
154
- // Only remove nodes that belong to this slot
155
- if (expando(current).__slotName === name) {
156
- existingNodes.push(current);
157
- }
158
- else if (existingNodes.length === 0) {
159
- // First content after anchor should belong to this slot
160
- existingNodes.push(current);
161
- }
162
- else {
163
- // Hit content from different slot
177
+ // A sibling no projection marked is the component's own markup.
178
+ const meta = expando(current);
179
+ if (meta.__projectedContent === undefined || meta.__slotName !== name) {
164
180
  break;
165
181
  }
182
+ existingNodes.push(current);
166
183
  current = current.nextSibling;
167
184
  }
168
185
  // Simple diffing: only replace if content appears different
@@ -1 +1 @@
1
- {"version":3,"file":"contentProjection.js","sourceRoot":"","sources":["../../src/compile/contentProjection.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0BhD,SAAS,OAAO,CAAC,IAAU;IACzB,OAAO,IAAgC,CAAC;AAC1C,CAAC;AAED,gMAAgM;AAChM,MAAM,UAAU,cAAc,CAC5B,QAAqB,EACrB,aAAsC;IAEtC,MAAM,OAAO,GAAY,IAAI,GAAG,EAAE,CAAC;IACnC,MAAM,UAAU,GAAG,IAAI,GAA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T,0CAA0C,IAAI,oCAAoC,CACnF,CAAC;YACJ,CAAC;YACD,SAAS;QACX,CAAC;QAED,0BAA0B;QAC1B,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAEzD,iEAAiE;QACjE,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;YAClB,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;gBACjC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;oBACpB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,YAAY,EAAE,CAAC,sBAAsB,EAAE,CAAC;gBAClE,OAAO,CAAC,GAAG,CAAC,yCAAyC,IAAI,GAAG,CAAC,CAAC;YAChE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,YAAY,EAAE,CAAC,sBAAsB,EAAE,CAAC;YAClE,OAAO,CAAC,GAAG,CACT,6CAA6C,aAAa,CAAC,MAAM,oBAAoB,IAAI,GAAG,CAC7F,CAAC;QACJ,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,sEAAsE;IACtE,uEAAuE;IACvE,qEAAqE;IACrE,gDAAgD;AAClD,CAAC"}
1
+ {"version":3,"file":"contentProjection.js","sourceRoot":"","sources":["../../src/compile/contentProjection.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,OAAO,EAAE,c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C;QACJ,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,sEAAsE;IACtE,uEAAuE;IACvE,qEAAqE;IACrE,gDAAgD;AAClD,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.feature.content-projection\",\n \"title\": \"Content Projection System\",\n \"category\": \"feature\"\n}\n*/\n\nimport { PithyNode } from '@pithyjs/compiler';\nimport { pithyTreeToDom } from './pithyTreeToDom';\nimport { bindStructuralDirectives } from './compileTemplate';\nimport { nodeExpando } from './nodeExpando';\nimport { bindErrorBoundary } from './binds/bindErrorBoundary';\nimport { pithyGlobals } from '../types/globals';\nimport { trimBlankEdges } from './trimBlankEdges';\n\n/**\n * SlotMap contains renderer functions for each slot name.\n * Each entry is a factory that returns a DocumentFragment of the slot's content.\n */\nexport type SlotMap = Map<\n string,\n (disposers?: (() => void)[]) => DocumentFragment\n>;\n\n/**\n * SlotDef describes a slot anchor and its fallback content\n */\nexport type FallbackFactory = () => HTMLElement | DocumentFragment | undefined;\n\nexport interface SlotDef {\n name: string;\n anchor: Comment;\n fallbackFactory?: FallbackFactory;\n}\n\ninterface ProjectionExpando {\n __slotName?: string;\n __fallbackFactory?: FallbackFactory;\n __projectionProcessed?: boolean;\n __projectedContent?: boolean;\n}\n\nfunction expando(node: Node): ProjectionExpando {\n return node as Node & ProjectionExpando;\n}\n\n/** @codexApi {\"parent\":\"pithy.feature.content-projection\",\"name\":\"collectSlotMap\",\"stability\":\"stable\",\"signature\":\"(children: PithyNode[], parentContext: Record<string, any>) => SlotMap\"} */\nexport function collectSlotMap(\n children: PithyNode[],\n parentContext: Record<string, unknown>\n): SlotMap {\n const slotMap: SlotMap = new Map();\n const slotGroups = new Map<string, PithyNode[]>();\n\n // Group children by slot attribute\n for (const child of children) {\n const slotName = child.directives?.slot || ''; // default slot if no slot attribute\n\n if (!slotGroups.has(slotName)) {\n slotGroups.set(slotName, []);\n }\n slotGroups.get(slotName)!.push(child);\n }\n const defaultSlot = slotGroups.get('');\n if (defaultSlot) {\n const content = trimBlankEdges(defaultSlot, node =>\n node.type === 'text' ? (node.textContent ?? '') : null\n );\n if (content.length) slotGroups.set('', content);\n else slotGroups.delete('');\n }\n\n // Validate slot usage in DEV mode\n if (import.meta.env?.DEV) {\n const slotNames = Array.from(slotGroups.keys());\n const duplicateSlots = slotNames.filter(\n name => name !== '' && slotGroups.get(name)!.length > 1\n );\n if (duplicateSlots.length > 0) {\n console.warn(\n `[ContentProjection] Multiple content nodes targeting the same slot. This is allowed but may indicate a mistake:`,\n duplicateSlots\n );\n }\n }\n\n // Create renderer functions for each slot group.\n // NOTE: We intentionally do NOT cache or clone DocumentFragments here.\n // Using fragment caching + cloneNode(true) would strip custom JS properties\n // like __pithyCtx that binders rely on to resolve projected content\n // expressions (including interpolation, [class], and [attr] bindings)\n // against the *parent* component's context.\n //\n // This behavior is relied upon by regression tests that exercise projected\n // nodes containing such bindings; changing this to reuse or clone\n // fragments will cause those tests to fail and break content projection.\n // pithyTreeToDom is cheap (just creates DOM nodes), so recreating is fine.\n\n for (const [slotName, nodes] of slotGroups) {\n // Capture nodes and context in closure for stable reference\n const capturedNodes = nodes;\n const capturedContext = parentContext;\n\n const render = (disposers: (() => void)[] = []): DocumentFragment => {\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Rendering slot \"${slotName}\" with ${capturedNodes.length} nodes`\n );\n }\n\n const fragment = pithyTreeToDom(capturedNodes, capturedContext);\n bindStructuralDirectives(\n capturedNodes,\n fragment,\n capturedContext,\n disposers\n );\n bindErrorBoundary(fragment, capturedContext, disposers);\n nodeExpando(fragment).__pithyCtx = capturedContext;\n return fragment;\n };\n\n slotMap.set(slotName, render);\n }\n\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Collected SlotMap with slots:`,\n Array.from(slotMap.keys())\n );\n }\n return slotMap;\n}\n\n/** @codexApi {\"parent\":\"pithy.feature.content-projection\",\"name\":\"extractSlotDefs\",\"stability\":\"stable\",\"signature\":\"(fragment: DocumentFragment) => SlotDef[]\"} */\nexport function extractSlotDefs(fragment: DocumentFragment): SlotDef[] {\n const slotDefs: SlotDef[] = [];\n const walker = document.createTreeWalker(fragment, NodeFilter.SHOW_COMMENT, {\n acceptNode: node => {\n const comment = node as Comment;\n return comment.textContent?.startsWith('slot:')\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT;\n },\n });\n\n let node: Comment | null;\n while ((node = walker.nextNode() as Comment | null)) {\n const slotName = expando(node).__slotName || '';\n const fallbackFactory = expando(node).__fallbackFactory;\n\n slotDefs.push({\n name: slotName,\n anchor: node,\n fallbackFactory,\n });\n }\n\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Extracted ${slotDefs.length} slot definitions`\n );\n }\n return slotDefs;\n}\n\n/** @codexApi {\"parent\":\"pithy.feature.content-projection\",\"name\":\"mountProjection\",\"stability\":\"stable\",\"signature\":\"(slotDefs: SlotDef[], slotMap: SlotMap, disposers: (() => void)[]) => void\"} */\nexport function mountProjection(\n slotDefs: SlotDef[],\n slotMap: SlotMap,\n disposers: (() => void)[]\n): void {\n for (const slotDef of slotDefs) {\n const { name, anchor, fallbackFactory } = slotDef;\n const renderer = slotMap.get(name);\n\n // Skip if this slot has already been processed\n if (expando(anchor).__projectionProcessed) {\n continue;\n }\n\n // Mark this slot as processed to prevent multiple passes\n expando(anchor).__projectionProcessed = true;\n\n const parent = anchor.parentNode;\n if (!parent) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[ContentProjection] Slot anchor \"${name}\" has no parent node - skipping`\n );\n }\n continue;\n }\n\n // Determine which content to render\n let contentFragment: HTMLElement | DocumentFragment | null = null;\n let isProjectedContent = false;\n\n if (renderer) {\n // Use projected content\n contentFragment = renderer(disposers);\n isProjectedContent = true;\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Mounting projected content for slot \"${name}\"`\n );\n }\n } else if (fallbackFactory) {\n // Use fallback content\n contentFragment = fallbackFactory() ?? null;\n const slotNode = nodeExpando(anchor).__pithyNode;\n if (\n contentFragment instanceof DocumentFragment &&\n slotNode?.fallbackChildren\n ) {\n const fallbackCtx = nodeExpando(anchor).__pithyCtx ?? {};\n bindStructuralDirectives(\n slotNode.fallbackChildren,\n contentFragment,\n fallbackCtx,\n disposers\n );\n bindErrorBoundary(contentFragment, fallbackCtx, disposers);\n }\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Mounting fallback content for slot \"${name}\"`\n );\n }\n } else {\n // No content to mount\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(`[PithyJS:Projection] No content for slot \"${name}\"`);\n }\n continue;\n }\n\n // Validate content\n if (!contentFragment || contentFragment.childNodes.length === 0) {\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Empty content for slot \"${name}\" - skipping`\n );\n }\n continue;\n }\n\n // CRITICAL: Collect nodes BEFORE inserting into DOM (for cleanup tracking)\n // Once inserted, the fragment's childNodes will be empty\n const nodesToInsert: Node[] = Array.from(contentFragment.childNodes);\n\n // Mark nodes for tracking\n for (const node of nodesToInsert) {\n expando(node).__projectedContent = isProjectedContent;\n expando(node).__slotName = name;\n }\n\n // Find and remove any existing content for this slot\n const existingNodes: Node[] = [];\n let current = anchor.nextSibling;\n\n while (current) {\n // Stop if we hit another slot anchor\n if (\n current.nodeType === Node.COMMENT_NODE &&\n (current as Comment).textContent?.startsWith('slot:')\n ) {\n break;\n }\n\n // A sibling no projection marked is the component's own markup.\n const meta = expando(current);\n if (meta.__projectedContent === undefined || meta.__slotName !== name) {\n break;\n }\n existingNodes.push(current);\n\n current = current.nextSibling;\n }\n\n // Simple diffing: only replace if content appears different\n // Compare node count and types as a basic heuristic\n const shouldReplace =\n existingNodes.length !== nodesToInsert.length ||\n existingNodes.some(\n (node, i) => node.nodeType !== nodesToInsert[i]?.nodeType\n );\n\n if (!shouldReplace && existingNodes.length > 0) {\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Content for slot \"${name}\" unchanged - skipping replacement`\n );\n }\n continue;\n }\n\n // Remove existing content\n for (const node of existingNodes) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }\n\n // Insert new content after the anchor comment\n parent.insertBefore(contentFragment, anchor.nextSibling);\n\n // Track cleanup - remove projected nodes when component unmounts\n disposers.push(() => {\n for (const node of nodesToInsert) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(`[PithyJS:Projection] Cleaned up slot \"${name}\"`);\n }\n });\n\n if (import.meta.env?.DEV && pithyGlobals().PITHY_DEBUG_PROJECTION) {\n console.log(\n `[PithyJS:Projection] Successfully mounted ${nodesToInsert.length} nodes for slot \"${name}\"`\n );\n }\n }\n\n // DEV: Validate slot usage\n // NOTE: We intentionally do NOT warn about unmatched projected slots here.\n // When a component uses @if/@else with different <slot> elements in each\n // branch (e.g., Show has <slot> in @if and <slot name=\"fallback\"> in @else),\n // the currently-rendered branch may not include all slot targets. The\n // projected \"fallback\" content is legitimate — it will be mounted when\n // the @else branch activates. Warnings here would be false positives\n // and fire repeatedly on every reactive toggle.\n}\n"]}
@@ -16,6 +16,6 @@ import type { PithyNode } from '@pithyjs/compiler';
16
16
  * - trackBy is compiled once per loop node and re-used.
17
17
  * - Each loop gets its own LoopManager which does minimal DOM moves and cleanup on dispose.
18
18
  */
19
- /** @codexApi {"parent":"pithy.directive.for","name":"bindForLoops","stability":"stable","signature":"(nodes: PithyNode[], rootEl: HTMLElement | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>) => void"} */
20
- export declare function bindForLoops(nodes: PithyNode[], rootEl: HTMLElement | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>): void;
19
+ /** @codexApi {"parent":"pithy.directive.for","name":"bindForLoops","stability":"stable","signature":"(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>) => void"} */
20
+ export declare function bindForLoops(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>): void;
21
21
  //# sourceMappingURL=bindForLoops.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bindForLoops.d.ts","sourceRoot":"","sources":["../../../src/compile/forLoops/bindForLoops.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQnD;;;;;;;;;GASG;AACH,yQAAyQ;AACzQ,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,WAAW,GAAG,gBAAgB,EACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,GAAE,CAAC,MAAM,IAAI,CAAC,EAAO,EAC9B,gBAAgB,GAAE,GAAG,CAAC,MAAM,CAAa,GACxC,IAAI,CAuJN"}
1
+ {"version":3,"file":"bindForLoops.d.ts","sourceRoot":"","sources":["../../../src/compile/forLoops/bindForLoops.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AASnD;;;;;;;;;GASG;AACH,qQAAqQ;AACrQ,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,OAAO,GAAG,gBAAgB,EAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,GAAE,CAAC,MAAM,IAAI,CAAC,EAAO,EAC9B,gBAAgB,GAAE,GAAG,CAAC,MAAM,CAAa,GACxC,IAAI,CAgIN"}
@@ -5,12 +5,13 @@
5
5
  "category": "directive"
6
6
  }
7
7
  */
8
- import { compileExpression } from '../compileExpression';
9
- import { createLoopManager } from './createLoopManager';
8
+ import { compileExpression } from '../compileExpression.js';
9
+ import { createLoopManager } from './createLoopManager.js';
10
10
  import { effect } from '@pithyjs/signals';
11
- import { findAllNestedLoopNodes } from './loopTraversal';
12
- import { isSSRMode } from '../ssrMode';
13
- import { nodeExpando } from '../nodeExpando';
11
+ import { findAllNestedLoopNodes } from './loopTraversal.js';
12
+ import { isSSRMode } from '../ssrMode.js';
13
+ import { nodeExpando } from '../nodeExpando.js';
14
+ import { compileTrackBy } from './loopHelpers.js';
14
15
  /**
15
16
  * Bind all @for loops found under `rootEl` using the parsed AST nodes.
16
17
  *
@@ -21,16 +22,14 @@ import { nodeExpando } from '../nodeExpando';
21
22
  * - trackBy is compiled once per loop node and re-used.
22
23
  * - Each loop gets its own LoopManager which does minimal DOM moves and cleanup on dispose.
23
24
  */
24
- /** @codexApi {"parent":"pithy.directive.for","name":"bindForLoops","stability":"stable","signature":"(nodes: PithyNode[], rootEl: HTMLElement | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>) => void"} */
25
+ /** @codexApi {"parent":"pithy.directive.for","name":"bindForLoops","stability":"stable","signature":"(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>) => void"} */
25
26
  export function bindForLoops(nodes, rootEl, ctx, disposers = [], processedNodeIds = new Set()) {
26
27
  // ---------------------------------------------------------------------------
27
28
  // Build a map of nodeId -> DOM anchor (either an element with data-pid or a comment node)
28
29
  // ---------------------------------------------------------------------------
29
30
  const nodeMap = new Map();
30
31
  // Elements: [data-pid="..."]
31
- rootEl
32
- .querySelectorAll?.('[data-pid]')
33
- .forEach(el => {
32
+ rootEl.querySelectorAll?.('[data-pid]').forEach(el => {
34
33
  const pid = el.getAttribute('data-pid');
35
34
  if (pid)
36
35
  nodeMap.set(pid, el);
@@ -88,19 +87,7 @@ export function bindForLoops(nodes, rootEl, ctx, disposers = [], processedNodeId
88
87
  const trackExpr = node.directives.for.trackBy || node.attrs?.track;
89
88
  // Compile collection getter once (closes over ctx)
90
89
  const getCollection = compileExpression(collectionExpr, ctx);
91
- // Compile trackBy once, avoiding TDZ by using internal param names (__it/__idx)
92
- const getTrackBy = trackExpr
93
- ? (() => {
94
- // Returns a stable string key for each (item, index)
95
- // eslint-disable-next-line no-new-func -- trackBy key compilation is a core framework feature
96
- const fn = new Function('ctx', '__it', '__idx', `with (ctx) {
97
- const ${itemVar} = __it;
98
- ${indexVar ? `const ${indexVar} = __idx;` : ''}
99
- return (${trackExpr});
100
- }`);
101
- return (item, idx) => String(fn(ctx, item, idx));
102
- })()
103
- : (_item, idx) => String(idx);
90
+ const getTrackBy = compileTrackBy(trackExpr, itemVar, indexVar, ctx);
104
91
  // Create a loop manager for this loop anchor
105
92
  const loopManager = createLoopManager({
106
93
  anchor,
@@ -1 +1 @@
1
- {"version":3,"file":"bindForLoops.js","sourceRoot":"","sources":["../../../src/compile/forLoops/bindForLoops.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;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oBACL,CAAC;oBACD,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,2FAA2F;gBAC3F,IACE,CAAC,CAAC,GAAG,YAAY,cAAc,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EACtE,CAAC;oBACD,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,CAAC;gBACnE,CAAC;gBACD,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,IAAI,SAAS,EAAE,EAAE,CAAC;YAChB,6DAA6D;YAC7D,iBAAiB,EAAE,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,yDAAyD;YACzD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE;gBACvB,iBAAiB,EAAE,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.directive.for\",\n \"title\": \"For Loop Directive\",\n \"category\": \"directive\"\n}\n*/\n\nimport type { PithyNode } from '@pithyjs/compiler';\nimport { compileExpression } from '../compileExpression';\nimport { createLoopManager } from './createLoopManager';\nimport { effect } from '@pithyjs/signals';\nimport { findAllNestedLoopNodes } from './loopTraversal';\nimport { isSSRMode } from '../ssrMode';\nimport { nodeExpando } from '../nodeExpando';\nimport { compileTrackBy } from './loopHelpers';\n\n/**\n * Bind all @for loops found under `rootEl` using the parsed AST nodes.\n *\n * Key points:\n * - We build a nodeId -> DOM \"anchor\" map for both element placeholders ([data-pid]) and\n * comment anchors (set by the compiler/runtime) so we can locate the correct insertion point.\n * - We cache nested loop nodes on the AST node (`__nested`) to avoid repeated deep traversals.\n * - trackBy is compiled once per loop node and re-used.\n * - Each loop gets its own LoopManager which does minimal DOM moves and cleanup on dispose.\n */\n/** @codexApi {\"parent\":\"pithy.directive.for\",\"name\":\"bindForLoops\",\"stability\":\"stable\",\"signature\":\"(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, disposers?: (() => void)[], processedNodeIds?: Set<string>) => void\"} */\nexport function bindForLoops(\n nodes: PithyNode[],\n rootEl: Element | DocumentFragment,\n ctx: Record<string, unknown>,\n disposers: (() => void)[] = [],\n processedNodeIds: Set<string> = new Set()\n): void {\n // ---------------------------------------------------------------------------\n // Build a map of nodeId -> DOM anchor (either an element with data-pid or a comment node)\n // ---------------------------------------------------------------------------\n const nodeMap = new Map<string, Element | Comment>();\n\n // Elements: [data-pid=\"...\"]\n rootEl.querySelectorAll?.('[data-pid]').forEach(el => {\n const pid = el.getAttribute('data-pid');\n if (pid) nodeMap.set(pid, el);\n });\n\n // Comment anchors: walk all comment nodes and read the private __nodeId we attach during compile\n const walker = document.createTreeWalker(rootEl, NodeFilter.SHOW_COMMENT);\n let comment: Comment | null;\n while ((comment = walker.nextNode() as Comment | null)) {\n const nodeId = nodeExpando(comment).__nodeId;\n if (nodeId) nodeMap.set(nodeId, comment);\n }\n\n // ---------------------------------------------------------------------------\n // Collect all loop nodes (top-level + nested) with caching per AST node\n // ---------------------------------------------------------------------------\n const allLoopNodes: PithyNode[] = [];\n\n // top-level loops - also check processedNodeIds to skip loops already handled by conditionals\n for (const node of nodes) {\n if (node.type === 'element' && node.directives?.for) {\n // Skip if this loop was already processed (e.g., by handleConditionalChain)\n if (node.nodeId && processedNodeIds.has(node.nodeId)) {\n continue;\n }\n allLoopNodes.push(node);\n }\n }\n\n // nested loops inside each node (cache once per AST node)\n // IMPORTANT: Only process nested loops for non-loop nodes (like conditionals).\n // Loops inside other loops will be handled by the parent loop's createLoopItem.\n for (const node of nodes) {\n // Skip finding nested loops if this node itself is a loop\n // (nested loops inside a loop will be handled by createLoopItem)\n if (node.type === 'element' && node.directives?.for) {\n continue;\n }\n\n const cacheNode = node as PithyNode & { __nested?: PithyNode[] };\n const nested: PithyNode[] =\n cacheNode.__nested ?? (cacheNode.__nested = findAllNestedLoopNodes(node));\n\n if (nested && nested.length) {\n // Filter out any nested loops that were already processed by conditionals\n const unprocessedNested = nested.filter(\n n => !n.nodeId || !processedNodeIds.has(n.nodeId)\n );\n\n allLoopNodes.push(...unprocessedNested);\n }\n }\n\n // ---------------------------------------------------------------------------\n // Bind each loop node found\n // ---------------------------------------------------------------------------\n for (const node of allLoopNodes) {\n const anchor = node.nodeId ? nodeMap.get(node.nodeId) : null;\n\n if (!(anchor instanceof Comment)) {\n continue; // loop anchor must be a comment\n }\n\n if (!node.directives?.for) continue; // safety\n\n const { itemVar, indexVar, collectionExpr } = node.directives.for;\n const trackExpr = node.directives.for.trackBy || node.attrs?.track;\n\n // Compile collection getter once (closes over ctx)\n const getCollection = compileExpression(collectionExpr, ctx);\n\n const getTrackBy = compileTrackBy(trackExpr, itemVar, indexVar, ctx);\n\n // Create a loop manager for this loop anchor\n const loopManager = createLoopManager({\n anchor,\n trackByFn: getTrackBy,\n parentCtx: ctx,\n itemVar,\n indexVar,\n });\n\n // Ensure we can dispose everything later\n disposers.push(() => loopManager.destroyAll());\n\n // Shared logic for evaluating and updating the loop\n function evaluateAndUpdate() {\n try {\n const coll = getCollection();\n if (Array.isArray(coll)) {\n loopManager.update(coll, node);\n } else {\n if (import.meta.env?.DEV) {\n console.warn('[bindForLoops] collection is not an array:', coll, {\n node,\n });\n }\n loopManager.update([], node);\n }\n } catch (err: unknown) {\n // Suppress TDZ/ReferenceErrors for nested loops (they'll be bound when child ctx is ready)\n if (\n !(err instanceof ReferenceError && /is not defined/.test(err.message))\n ) {\n console.error('[bindForLoops] error evaluating collection', err);\n }\n loopManager.update([], node);\n }\n }\n\n if (isSSRMode()) {\n // SSR mode: evaluate once synchronously, no reactive effects\n evaluateAndUpdate();\n } else {\n // Client mode: reactive subscription for dynamic updates\n const stop = effect(() => {\n evaluateAndUpdate();\n });\n disposers.push(stop);\n }\n }\n}\n"]}
@@ -19,10 +19,12 @@
19
19
  * - Dev-time duplicate key detection.
20
20
  */
21
21
  import type { PithyNode } from '@pithyjs/compiler';
22
- import { LoopSignals } from './loopSignals';
22
+ import type { ChildFactory } from '../../runtime/bindings/types.js';
23
+ import { LoopSignals } from './loopSignals.js';
24
+ export type { ChildFactory };
23
25
  export interface LoopItem {
24
26
  key: string;
25
- fragment: DocumentFragment | HTMLElement;
27
+ fragment: DocumentFragment | Element;
26
28
  signals: LoopSignals;
27
29
  start: Comment;
28
30
  end: Comment;
@@ -41,11 +43,12 @@ export interface LoopManagerOptions<T> {
41
43
  evenVar?: string;
42
44
  oddVar?: string;
43
45
  templateNodes?: PithyNode[];
46
+ itemFactory?: ChildFactory;
44
47
  }
45
48
  export interface LoopManager<T = unknown> {
46
49
  update: (collection: T[], node?: PithyNode) => void;
47
50
  destroyAll: () => void;
48
51
  }
49
52
  /** @codexApi {"parent":"pithy.directive.loop-manager","name":"createLoopManager","stability":"stable","signature":"<T>(options: LoopManagerOptions<T>) => LoopManager<T>"} */
50
- export declare function createLoopManager<T>({ anchor, trackByFn, parentCtx, itemVar, indexVar, countVar, firstVar, lastVar, evenVar, oddVar, templateNodes, }: LoopManagerOptions<T>): LoopManager<T>;
53
+ export declare function createLoopManager<T>({ anchor, trackByFn, parentCtx, itemVar, indexVar, countVar, firstVar, lastVar, evenVar, oddVar, templateNodes, itemFactory, }: LoopManagerOptions<T>): LoopManager<T>;
51
54
  //# sourceMappingURL=createLoopManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createLoopManager.d.ts","sourceRoot":"","sources":["../../../src/compile/forLoops/createLoopManager.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQnD,OAAO,EACL,WAAW,EAIZ,MAAM,eAAe,CAAC;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