@pithyjs/core 0.1.0-beta.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 (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +513 -0
  3. package/dist/a11y/focus-trap.d.ts +109 -0
  4. package/dist/a11y/focus-trap.d.ts.map +1 -0
  5. package/dist/a11y/focus-trap.js +246 -0
  6. package/dist/a11y/focus-trap.js.map +1 -0
  7. package/dist/a11y/index.d.ts +12 -0
  8. package/dist/a11y/index.d.ts.map +1 -0
  9. package/dist/a11y/index.js +16 -0
  10. package/dist/a11y/index.js.map +1 -0
  11. package/dist/a11y/keyboard-utils.d.ts +165 -0
  12. package/dist/a11y/keyboard-utils.d.ts.map +1 -0
  13. package/dist/a11y/keyboard-utils.js +321 -0
  14. package/dist/a11y/keyboard-utils.js.map +1 -0
  15. package/dist/a11y/roving-tabindex.d.ts +118 -0
  16. package/dist/a11y/roving-tabindex.d.ts.map +1 -0
  17. package/dist/a11y/roving-tabindex.js +249 -0
  18. package/dist/a11y/roving-tabindex.js.map +1 -0
  19. package/dist/a11y/skip-link.d.ts +55 -0
  20. package/dist/a11y/skip-link.d.ts.map +1 -0
  21. package/dist/a11y/skip-link.js +164 -0
  22. package/dist/a11y/skip-link.js.map +1 -0
  23. package/dist/compile/bindSwitchCases.d.ts +16 -0
  24. package/dist/compile/bindSwitchCases.d.ts.map +1 -0
  25. package/dist/compile/bindSwitchCases.js +323 -0
  26. package/dist/compile/bindSwitchCases.js.map +1 -0
  27. package/dist/compile/binds/bindBoundAttributes.d.ts +14 -0
  28. package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -0
  29. package/dist/compile/binds/bindBoundAttributes.js +57 -0
  30. package/dist/compile/binds/bindBoundAttributes.js.map +1 -0
  31. package/dist/compile/binds/bindClassDirectives.d.ts +20 -0
  32. package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -0
  33. package/dist/compile/binds/bindClassDirectives.js +94 -0
  34. package/dist/compile/binds/bindClassDirectives.js.map +1 -0
  35. package/dist/compile/binds/bindComponentsTags.d.ts +17 -0
  36. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -0
  37. package/dist/compile/binds/bindComponentsTags.js +355 -0
  38. package/dist/compile/binds/bindComponentsTags.js.map +1 -0
  39. package/dist/compile/binds/bindConditionals.d.ts +16 -0
  40. package/dist/compile/binds/bindConditionals.d.ts.map +1 -0
  41. package/dist/compile/binds/bindConditionals.js +102 -0
  42. package/dist/compile/binds/bindConditionals.js.map +1 -0
  43. package/dist/compile/binds/bindDefaultTwoWay.d.ts +35 -0
  44. package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -0
  45. package/dist/compile/binds/bindDefaultTwoWay.js +128 -0
  46. package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -0
  47. package/dist/compile/binds/bindDeferDirectives.d.ts +21 -0
  48. package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -0
  49. package/dist/compile/binds/bindDeferDirectives.js +465 -0
  50. package/dist/compile/binds/bindDeferDirectives.js.map +1 -0
  51. package/dist/compile/binds/bindErrorBoundary.d.ts +71 -0
  52. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -0
  53. package/dist/compile/binds/bindErrorBoundary.js +389 -0
  54. package/dist/compile/binds/bindErrorBoundary.js.map +1 -0
  55. package/dist/compile/binds/bindEventHandlers.d.ts +17 -0
  56. package/dist/compile/binds/bindEventHandlers.d.ts.map +1 -0
  57. package/dist/compile/binds/bindEventHandlers.js +174 -0
  58. package/dist/compile/binds/bindEventHandlers.js.map +1 -0
  59. package/dist/compile/binds/bindRefDirectives.d.ts +14 -0
  60. package/dist/compile/binds/bindRefDirectives.d.ts.map +1 -0
  61. package/dist/compile/binds/bindRefDirectives.js +35 -0
  62. package/dist/compile/binds/bindRefDirectives.js.map +1 -0
  63. package/dist/compile/binds/bindTextInterpolations.d.ts +16 -0
  64. package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -0
  65. package/dist/compile/binds/bindTextInterpolations.js +408 -0
  66. package/dist/compile/binds/bindTextInterpolations.js.map +1 -0
  67. package/dist/compile/binds/directiveRegistry.d.ts +46 -0
  68. package/dist/compile/binds/directiveRegistry.d.ts.map +1 -0
  69. package/dist/compile/binds/directiveRegistry.js +50 -0
  70. package/dist/compile/binds/directiveRegistry.js.map +1 -0
  71. package/dist/compile/compileExpression.d.ts +10 -0
  72. package/dist/compile/compileExpression.d.ts.map +1 -0
  73. package/dist/compile/compileExpression.js +26 -0
  74. package/dist/compile/compileExpression.js.map +1 -0
  75. package/dist/compile/compileNodes.d.ts +32 -0
  76. package/dist/compile/compileNodes.d.ts.map +1 -0
  77. package/dist/compile/compileNodes.js +104 -0
  78. package/dist/compile/compileNodes.js.map +1 -0
  79. package/dist/compile/compileTemplate.d.ts +64 -0
  80. package/dist/compile/compileTemplate.d.ts.map +1 -0
  81. package/dist/compile/compileTemplate.js +157 -0
  82. package/dist/compile/compileTemplate.js.map +1 -0
  83. package/dist/compile/contentProjection.d.ts +29 -0
  84. package/dist/compile/contentProjection.d.ts.map +1 -0
  85. package/dist/compile/contentProjection.js +210 -0
  86. package/dist/compile/contentProjection.js.map +1 -0
  87. package/dist/compile/forLoops/bindForLoops.d.ts +21 -0
  88. package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -0
  89. package/dist/compile/forLoops/bindForLoops.js +151 -0
  90. package/dist/compile/forLoops/bindForLoops.js.map +1 -0
  91. package/dist/compile/forLoops/createLoopManager.d.ts +51 -0
  92. package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -0
  93. package/dist/compile/forLoops/createLoopManager.js +429 -0
  94. package/dist/compile/forLoops/createLoopManager.js.map +1 -0
  95. package/dist/compile/forLoops/index.d.ts +6 -0
  96. package/dist/compile/forLoops/index.d.ts.map +1 -0
  97. package/dist/compile/forLoops/index.js +8 -0
  98. package/dist/compile/forLoops/index.js.map +1 -0
  99. package/dist/compile/forLoops/loopHelpers.d.ts +33 -0
  100. package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -0
  101. package/dist/compile/forLoops/loopHelpers.js +69 -0
  102. package/dist/compile/forLoops/loopHelpers.js.map +1 -0
  103. package/dist/compile/forLoops/loopSignals.d.ts +36 -0
  104. package/dist/compile/forLoops/loopSignals.d.ts.map +1 -0
  105. package/dist/compile/forLoops/loopSignals.js +64 -0
  106. package/dist/compile/forLoops/loopSignals.js.map +1 -0
  107. package/dist/compile/forLoops/loopTraversal.d.ts +18 -0
  108. package/dist/compile/forLoops/loopTraversal.d.ts.map +1 -0
  109. package/dist/compile/forLoops/loopTraversal.js +38 -0
  110. package/dist/compile/forLoops/loopTraversal.js.map +1 -0
  111. package/dist/compile/handleConditionalChain.d.ts +15 -0
  112. package/dist/compile/handleConditionalChain.d.ts.map +1 -0
  113. package/dist/compile/handleConditionalChain.js +181 -0
  114. package/dist/compile/handleConditionalChain.js.map +1 -0
  115. package/dist/compile/index.d.ts +15 -0
  116. package/dist/compile/index.d.ts.map +1 -0
  117. package/dist/compile/index.js +19 -0
  118. package/dist/compile/index.js.map +1 -0
  119. package/dist/compile/injectScopedStyle.d.ts +16 -0
  120. package/dist/compile/injectScopedStyle.d.ts.map +1 -0
  121. package/dist/compile/injectScopedStyle.js +50 -0
  122. package/dist/compile/injectScopedStyle.js.map +1 -0
  123. package/dist/compile/nodeExpando.d.ts +12 -0
  124. package/dist/compile/nodeExpando.d.ts.map +1 -0
  125. package/dist/compile/nodeExpando.js +4 -0
  126. package/dist/compile/nodeExpando.js.map +1 -0
  127. package/dist/compile/parseHtml.d.ts +70 -0
  128. package/dist/compile/parseHtml.d.ts.map +1 -0
  129. package/dist/compile/parseHtml.js +164 -0
  130. package/dist/compile/parseHtml.js.map +1 -0
  131. package/dist/compile/pithyTreeToDom.d.ts +16 -0
  132. package/dist/compile/pithyTreeToDom.d.ts.map +1 -0
  133. package/dist/compile/pithyTreeToDom.js +118 -0
  134. package/dist/compile/pithyTreeToDom.js.map +1 -0
  135. package/dist/compile/renderChildren.d.ts +50 -0
  136. package/dist/compile/renderChildren.d.ts.map +1 -0
  137. package/dist/compile/renderChildren.js +76 -0
  138. package/dist/compile/renderChildren.js.map +1 -0
  139. package/dist/compile/ssrMode.d.ts +17 -0
  140. package/dist/compile/ssrMode.d.ts.map +1 -0
  141. package/dist/compile/ssrMode.js +20 -0
  142. package/dist/compile/ssrMode.js.map +1 -0
  143. package/dist/compile/textValue.d.ts +28 -0
  144. package/dist/compile/textValue.d.ts.map +1 -0
  145. package/dist/compile/textValue.js +30 -0
  146. package/dist/compile/textValue.js.map +1 -0
  147. package/dist/config/index.d.ts +37 -0
  148. package/dist/config/index.d.ts.map +1 -0
  149. package/dist/config/index.js +16 -0
  150. package/dist/config/index.js.map +1 -0
  151. package/dist/index.d.ts +7 -0
  152. package/dist/index.d.ts.map +1 -0
  153. package/dist/index.js +7 -0
  154. package/dist/index.js.map +1 -0
  155. package/dist/interfaces/index.d.ts +3 -0
  156. package/dist/interfaces/index.d.ts.map +1 -0
  157. package/dist/interfaces/index.js +3 -0
  158. package/dist/interfaces/index.js.map +1 -0
  159. package/dist/interfaces/ref-signal.interface.d.ts +6 -0
  160. package/dist/interfaces/ref-signal.interface.d.ts.map +1 -0
  161. package/dist/interfaces/ref-signal.interface.js +2 -0
  162. package/dist/interfaces/ref-signal.interface.js.map +1 -0
  163. package/dist/interfaces/ref.interface.d.ts +5 -0
  164. package/dist/interfaces/ref.interface.d.ts.map +1 -0
  165. package/dist/interfaces/ref.interface.js +2 -0
  166. package/dist/interfaces/ref.interface.js.map +1 -0
  167. package/dist/runtime/applyBindings.d.ts +36 -0
  168. package/dist/runtime/applyBindings.d.ts.map +1 -0
  169. package/dist/runtime/applyBindings.js +165 -0
  170. package/dist/runtime/applyBindings.js.map +1 -0
  171. package/dist/runtime/bindings/applyComponent.d.ts +3 -0
  172. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -0
  173. package/dist/runtime/bindings/applyComponent.js +190 -0
  174. package/dist/runtime/bindings/applyComponent.js.map +1 -0
  175. package/dist/runtime/bindings/applyDefer.d.ts +11 -0
  176. package/dist/runtime/bindings/applyDefer.d.ts.map +1 -0
  177. package/dist/runtime/bindings/applyDefer.js +422 -0
  178. package/dist/runtime/bindings/applyDefer.js.map +1 -0
  179. package/dist/runtime/bindings/applySimple.d.ts +11 -0
  180. package/dist/runtime/bindings/applySimple.d.ts.map +1 -0
  181. package/dist/runtime/bindings/applySimple.js +346 -0
  182. package/dist/runtime/bindings/applySimple.js.map +1 -0
  183. package/dist/runtime/bindings/applyStructural.d.ts +5 -0
  184. package/dist/runtime/bindings/applyStructural.d.ts.map +1 -0
  185. package/dist/runtime/bindings/applyStructural.js +312 -0
  186. package/dist/runtime/bindings/applyStructural.js.map +1 -0
  187. package/dist/runtime/bindings/helpers.d.ts +56 -0
  188. package/dist/runtime/bindings/helpers.d.ts.map +1 -0
  189. package/dist/runtime/bindings/helpers.js +121 -0
  190. package/dist/runtime/bindings/helpers.js.map +1 -0
  191. package/dist/runtime/bindings/index.d.ts +7 -0
  192. package/dist/runtime/bindings/index.d.ts.map +1 -0
  193. package/dist/runtime/bindings/index.js +6 -0
  194. package/dist/runtime/bindings/index.js.map +1 -0
  195. package/dist/runtime/bindings/types.d.ts +105 -0
  196. package/dist/runtime/bindings/types.d.ts.map +1 -0
  197. package/dist/runtime/bindings/types.js +5 -0
  198. package/dist/runtime/bindings/types.js.map +1 -0
  199. package/dist/runtime/bootstrap.d.ts +59 -0
  200. package/dist/runtime/bootstrap.d.ts.map +1 -0
  201. package/dist/runtime/bootstrap.js +82 -0
  202. package/dist/runtime/bootstrap.js.map +1 -0
  203. package/dist/runtime/createContextProxy.d.ts +10 -0
  204. package/dist/runtime/createContextProxy.d.ts.map +1 -0
  205. package/dist/runtime/createContextProxy.js +45 -0
  206. package/dist/runtime/createContextProxy.js.map +1 -0
  207. package/dist/runtime/deferHelpers.d.ts +49 -0
  208. package/dist/runtime/deferHelpers.d.ts.map +1 -0
  209. package/dist/runtime/deferHelpers.js +65 -0
  210. package/dist/runtime/deferHelpers.js.map +1 -0
  211. package/dist/runtime/html.d.ts +23 -0
  212. package/dist/runtime/html.d.ts.map +1 -0
  213. package/dist/runtime/html.js +97 -0
  214. package/dist/runtime/html.js.map +1 -0
  215. package/dist/runtime/index.d.ts +8 -0
  216. package/dist/runtime/index.d.ts.map +1 -0
  217. package/dist/runtime/index.js +21 -0
  218. package/dist/runtime/index.js.map +1 -0
  219. package/dist/runtime/lazy.d.ts +144 -0
  220. package/dist/runtime/lazy.d.ts.map +1 -0
  221. package/dist/runtime/lazy.js +295 -0
  222. package/dist/runtime/lazy.js.map +1 -0
  223. package/dist/runtime/module-cache.d.ts +78 -0
  224. package/dist/runtime/module-cache.d.ts.map +1 -0
  225. package/dist/runtime/module-cache.js +109 -0
  226. package/dist/runtime/module-cache.js.map +1 -0
  227. package/dist/runtime/onDestroy.d.ts +29 -0
  228. package/dist/runtime/onDestroy.d.ts.map +1 -0
  229. package/dist/runtime/onDestroy.js +66 -0
  230. package/dist/runtime/onDestroy.js.map +1 -0
  231. package/dist/runtime/parseIdentifiersFromTemplate.d.ts +17 -0
  232. package/dist/runtime/parseIdentifiersFromTemplate.d.ts.map +1 -0
  233. package/dist/runtime/parseIdentifiersFromTemplate.js +68 -0
  234. package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -0
  235. package/dist/types/globals.d.ts +18 -0
  236. package/dist/types/globals.d.ts.map +1 -0
  237. package/dist/types/globals.js +4 -0
  238. package/dist/types/globals.js.map +1 -0
  239. package/dist/types/index.d.ts +11 -0
  240. package/dist/types/index.d.ts.map +1 -0
  241. package/dist/types/index.js +2 -0
  242. package/dist/types/index.js.map +1 -0
  243. package/dist/utilities/index.d.ts +3 -0
  244. package/dist/utilities/index.d.ts.map +1 -0
  245. package/dist/utilities/index.js +3 -0
  246. package/dist/utilities/index.js.map +1 -0
  247. package/dist/utilities/ref-signal.utility.d.ts +32 -0
  248. package/dist/utilities/ref-signal.utility.d.ts.map +1 -0
  249. package/dist/utilities/ref-signal.utility.js +46 -0
  250. package/dist/utilities/ref-signal.utility.js.map +1 -0
  251. package/dist/utilities/ref.untility.d.ts +37 -0
  252. package/dist/utilities/ref.untility.d.ts.map +1 -0
  253. package/dist/utilities/ref.untility.js +47 -0
  254. package/dist/utilities/ref.untility.js.map +1 -0
  255. package/package.json +55 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindTextInterpolations.js","sourceRoot":"","sources":["../../../src/compile/binds/bindTextInterpolations.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEjD;;;;GAIG;AACH,iOAAiO;AACjO,MAAM,UAAU,sBAAsB,CACpC,IAAgC,EAChC,GAA4B,EAC5B,SAAyB;IAEzB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IACxC,+BAA+B,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AACxD,CAAC;AAED;;gFAEgF;AAChF,SAAS,eAAe,CAAC,IAAgC;IACvD,IAAI,IAAI,YAAY,OAAO;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9D,yEAAyE;IACzE,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC1B,IAAI,CAAC,CAAC,QAAQ,KAA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I,CAAC,GAAmB,IAAI,YAAY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAC5E,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe;YAAE,OAAO,IAAI,CAAC;QAChD,IACE,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EACtD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,46 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.core.directive-registry",
4
+ "title": "Custom Directive Registry",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * Custom Directive Registry
10
+ *
11
+ * Allows external packages (like @pithyjs/router) to register custom directive
12
+ * binders that will be called during template compilation. This breaks the
13
+ * circular dependency between core and router.
14
+ *
15
+ * @module compile/binds/directiveRegistry
16
+ */
17
+ /**
18
+ * Type for a custom directive binder function
19
+ */
20
+ export type DirectiveBinder = (root: Element | DocumentFragment, context: Record<string, unknown>, disposers: Array<() => void>) => void;
21
+ /**
22
+ * Register a custom directive binder
23
+ * Called by external packages to register their directive binding logic
24
+ *
25
+ * @param binder - The directive binder function to register
26
+ */
27
+ /** @codexApi {"parent":"pithy.core.directive-registry","name":"registerDirectiveBinder","stability":"stable","signature":"(binder: DirectiveBinder) => void"} */
28
+ export declare function registerDirectiveBinder(binder: DirectiveBinder): void;
29
+ /**
30
+ * Unregister a custom directive binder
31
+ *
32
+ * @param binder - The directive binder function to unregister
33
+ */
34
+ /** @codexApi {"parent":"pithy.core.directive-registry","name":"unregisterDirectiveBinder","stability":"stable","signature":"(binder: DirectiveBinder) => void"} */
35
+ export declare function unregisterDirectiveBinder(binder: DirectiveBinder): void;
36
+ /**
37
+ * Execute all registered directive binders
38
+ * Called by compileTemplate during the binding phase
39
+ *
40
+ * @param root - The root element or fragment to bind directives in
41
+ * @param context - The template context
42
+ * @param disposers - Array to collect cleanup functions
43
+ */
44
+ /** @codexApi {"parent":"pithy.core.directive-registry","name":"executeCustomDirectiveBinders","stability":"stable","signature":"(root: Element | DocumentFragment, context: Record<string, unknown>, disposers: Array<() => void>) => void"} */
45
+ export declare function executeCustomDirectiveBinders(root: Element | DocumentFragment, context: Record<string, unknown>, disposers: Array<() => void>): void;
46
+ //# sourceMappingURL=directiveRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directiveRegistry.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/directiveRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,KACzB,IAAI,CAAC;AAOV;;;;;GAKG;AACH,iKAAiK;AACjK,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAIrE;AAED;;;;GAIG;AACH,mKAAmK;AACnK,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAKvE;AAED;;;;;;;GAOG;AACH,gPAAgP;AAChP,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAC3B,IAAI,CAIN"}
@@ -0,0 +1,50 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.core.directive-registry",
4
+ "title": "Custom Directive Registry",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * Registry of custom directive binders
10
+ */
11
+ const directiveBinders = [];
12
+ /**
13
+ * Register a custom directive binder
14
+ * Called by external packages to register their directive binding logic
15
+ *
16
+ * @param binder - The directive binder function to register
17
+ */
18
+ /** @codexApi {"parent":"pithy.core.directive-registry","name":"registerDirectiveBinder","stability":"stable","signature":"(binder: DirectiveBinder) => void"} */
19
+ export function registerDirectiveBinder(binder) {
20
+ if (!directiveBinders.includes(binder)) {
21
+ directiveBinders.push(binder);
22
+ }
23
+ }
24
+ /**
25
+ * Unregister a custom directive binder
26
+ *
27
+ * @param binder - The directive binder function to unregister
28
+ */
29
+ /** @codexApi {"parent":"pithy.core.directive-registry","name":"unregisterDirectiveBinder","stability":"stable","signature":"(binder: DirectiveBinder) => void"} */
30
+ export function unregisterDirectiveBinder(binder) {
31
+ const index = directiveBinders.indexOf(binder);
32
+ if (index !== -1) {
33
+ directiveBinders.splice(index, 1);
34
+ }
35
+ }
36
+ /**
37
+ * Execute all registered directive binders
38
+ * Called by compileTemplate during the binding phase
39
+ *
40
+ * @param root - The root element or fragment to bind directives in
41
+ * @param context - The template context
42
+ * @param disposers - Array to collect cleanup functions
43
+ */
44
+ /** @codexApi {"parent":"pithy.core.directive-registry","name":"executeCustomDirectiveBinders","stability":"stable","signature":"(root: Element | DocumentFragment, context: Record<string, unknown>, disposers: Array<() => void>) => void"} */
45
+ export function executeCustomDirectiveBinders(root, context, disposers) {
46
+ for (const binder of directiveBinders) {
47
+ binder(root, context, disposers);
48
+ }
49
+ }
50
+ //# sourceMappingURL=directiveRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directiveRegistry.js","sourceRoot":"","sources":["../../../src/compile/binds/directiveRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAqBF;;GAEG;AACH,MAAM,gBAAgB,GAAsB,EAAE,CAAC;AAE/C;;;;;GAKG;AACH,iKAAiK;AACjK,MAAM,UAAU,uBAAuB,CAAC,MAAuB;IAC7D,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,mKAAmK;AACnK,MAAM,UAAU,yBAAyB,CAAC,MAAuB;IAC/D,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,gPAAgP;AAChP,MAAM,UAAU,6BAA6B,CAC3C,IAAgC,EAChC,OAAgC,EAChC,SAA4B;IAE5B,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.compiler.expression",
4
+ "title": "Expression Compiler",
5
+ "category": "compiler"
6
+ }
7
+ */
8
+ /** @codexApi {"parent":"pithy.compiler.expression","name":"compileExpression","stability":"stable","signature":"<T = unknown>(expr: string, ctx: Record<string, unknown>, fallback?: T) => () => T"} */
9
+ export declare function compileExpression<T = unknown>(expr: string, ctx: Record<string, unknown>, fallback?: T): () => T;
10
+ //# sourceMappingURL=compileExpression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileExpression.d.ts","sourceRoot":"","sources":["../../src/compile/compileExpression.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,wMAAwM;AACxM,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAC3C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,QAAQ,CAAC,EAAE,CAAC,GACX,MAAM,CAAC,CAkBT"}
@@ -0,0 +1,26 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.compiler.expression",
4
+ "title": "Expression Compiler",
5
+ "category": "compiler"
6
+ }
7
+ */
8
+ /** @codexApi {"parent":"pithy.compiler.expression","name":"compileExpression","stability":"stable","signature":"<T = unknown>(expr: string, ctx: Record<string, unknown>, fallback?: T) => () => T"} */
9
+ export function compileExpression(expr, ctx, fallback) {
10
+ // Handle empty expressions
11
+ if (!expr || expr.trim() === '') {
12
+ return () => fallback;
13
+ }
14
+ try {
15
+ // eslint-disable-next-line no-new-func -- JIT template expression evaluation is a core framework feature
16
+ const fn = new Function('ctx', `with(ctx) { return (${expr}) }`);
17
+ return () => fn(ctx);
18
+ }
19
+ catch (err) {
20
+ if (import.meta.env?.DEV) {
21
+ console.warn(`[PithyJS] ❌ Failed to compile expression "${expr}":`, err);
22
+ }
23
+ return () => fallback;
24
+ }
25
+ }
26
+ //# sourceMappingURL=compileExpression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileExpression.js","sourceRoot":"","sources":["../../src/compile/compileExpression.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,wMAAwM;AACxM,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,GAA4B,EAC5B,QAAY;IAEZ,2BAA2B;IAC3B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAChC,OAAO,GAAG,EAAE,CAAC,QAAa,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC;QACH,yGAAyG;QACzG,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,uBAAuB,IAAI,KAAK,CAEzD,CAAC;QACP,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,6CAA6C,IAAI,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,GAAG,EAAE,CAAC,QAAa,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.compile-nodes",
4
+ "title": "AST Node Compiler",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import type { PithyNode } from '@pithyjs/compiler';
9
+ /**
10
+ * Compiles an array of PithyNode AST nodes into live DOM with full binding pipeline.
11
+ *
12
+ * This is the AST counterpart to `compileTemplate`:
13
+ * - `compileTemplate`: HTML string → parse → AST → DOM → structural → non-structural
14
+ * - `compileNodes`: AST → DOM → structural → non-structural
15
+ *
16
+ * Use when you already have AST nodes (e.g. from `__childAstNodes` in component context)
17
+ * and need the full compilation pipeline including structural directives (@if, @switch, @for).
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { compileNodes } from "@pithyjs/core";
22
+ * const { el, destroy } = compileNodes(astNodes, context);
23
+ * document.body.appendChild(el);
24
+ * // later: destroy();
25
+ * ```
26
+ */
27
+ /** @codexApi {"parent":"pithy.runtime.compile-nodes","name":"compileNodes","stability":"stable","signature":"(nodes: PithyNode[], context: Record<string, unknown>) => { el: DocumentFragment; destroy: () => void }"} */
28
+ export declare function compileNodes(nodes: PithyNode[], context: Record<string, unknown>): {
29
+ el: DocumentFragment;
30
+ destroy: () => void;
31
+ };
32
+ //# sourceMappingURL=compileNodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileNodes.d.ts","sourceRoot":"","sources":["../../src/compile/compileNodes.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQnD;;;;;;;;;;;;;;;;;GAiBG;AACH,0NAA0N;AAC1N,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAAE,EAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B;IAAE,EAAE,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAwE/C"}
@@ -0,0 +1,104 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.compile-nodes",
4
+ "title": "AST Node Compiler",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import { pithyTreeToDom } from './pithyTreeToDom';
9
+ import { bindStructuralDirectives, bindTemplateDirectives, } from './compileTemplate';
10
+ import { drainDestroyCallbacks } from '../runtime/onDestroy';
11
+ /**
12
+ * Compiles an array of PithyNode AST nodes into live DOM with full binding pipeline.
13
+ *
14
+ * This is the AST counterpart to `compileTemplate`:
15
+ * - `compileTemplate`: HTML string → parse → AST → DOM → structural → non-structural
16
+ * - `compileNodes`: AST → DOM → structural → non-structural
17
+ *
18
+ * Use when you already have AST nodes (e.g. from `__childAstNodes` in component context)
19
+ * and need the full compilation pipeline including structural directives (@if, @switch, @for).
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { compileNodes } from "@pithyjs/core";
24
+ * const { el, destroy } = compileNodes(astNodes, context);
25
+ * document.body.appendChild(el);
26
+ * // later: destroy();
27
+ * ```
28
+ */
29
+ /** @codexApi {"parent":"pithy.runtime.compile-nodes","name":"compileNodes","stability":"stable","signature":"(nodes: PithyNode[], context: Record<string, unknown>) => { el: DocumentFragment; destroy: () => void }"} */
30
+ export function compileNodes(nodes, context) {
31
+ // Drain onDestroy() callbacks — prevents leaks when compileNodes is used
32
+ // as a standalone entry point (renderChildren, ErrorBoundary).
33
+ const destroyCallbacks = drainDestroyCallbacks();
34
+ const disposers = [];
35
+ let fragment;
36
+ try {
37
+ // 1. AST → unbound DOM
38
+ fragment = pithyTreeToDom(nodes, context);
39
+ // 2. Structural directives (@switch, @if/@else, @for)
40
+ bindStructuralDirectives(nodes, fragment, context, disposers);
41
+ // 3. Non-structural bindings (refs, error boundaries, components, text, events, etc.)
42
+ bindTemplateDirectives(fragment, context, disposers);
43
+ }
44
+ catch (err) {
45
+ // Clean up any disposers already registered during partial compilation
46
+ for (let i = disposers.length - 1; i >= 0; i--) {
47
+ try {
48
+ disposers[i]();
49
+ }
50
+ catch {
51
+ /* ignore */
52
+ }
53
+ }
54
+ // Run drained callbacks LIFO before rethrowing so partially-initialized
55
+ // resources are still cleaned up.
56
+ for (let i = destroyCallbacks.length - 1; i >= 0; i--) {
57
+ try {
58
+ destroyCallbacks[i]();
59
+ }
60
+ catch {
61
+ /* ignore */
62
+ }
63
+ }
64
+ throw err;
65
+ }
66
+ // Fast path when no onDestroy was called
67
+ if (destroyCallbacks.length === 0) {
68
+ return {
69
+ el: fragment,
70
+ destroy() {
71
+ for (let i = disposers.length - 1; i >= 0; i--) {
72
+ try {
73
+ disposers[i]();
74
+ }
75
+ catch {
76
+ /* ignore */
77
+ }
78
+ }
79
+ },
80
+ };
81
+ }
82
+ return {
83
+ el: fragment,
84
+ destroy() {
85
+ for (let i = disposers.length - 1; i >= 0; i--) {
86
+ try {
87
+ disposers[i]();
88
+ }
89
+ catch {
90
+ /* ignore */
91
+ }
92
+ }
93
+ for (let i = destroyCallbacks.length - 1; i >= 0; i--) {
94
+ try {
95
+ destroyCallbacks[i]();
96
+ }
97
+ catch {
98
+ /* ignore */
99
+ }
100
+ }
101
+ },
102
+ };
103
+ }
104
+ //# sourceMappingURL=compileNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileNodes.js","sourceRoot":"","sources":["../../src/compile/compileNodes.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;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CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC/C,IAAI,CAAC;wBACH,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;oBACjB,CAAC;oBAAC,MAAM,CAAC;wBACP,YAAY;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,QAAQ;QACZ,OAAO;YACL,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,IAAI,CAAC;oBACH,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,YAAY;gBACd,CAAC;YACH,CAAC;YACD,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtD,IAAI,CAAC;oBACH,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxB,CAAC;gBAAC,MAAM,CAAC;oBACP,YAAY;gBACd,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,64 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.renderer",
4
+ "title": "Template Compiler & Renderer",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * Runs all structural directive bindings on a fragment.
10
+ *
11
+ * Ordering:
12
+ * 1) Switch cases first — they clone pristine DOM before conditionals replace elements
13
+ * 2) Conditionals (@if/@else) — returns processed node IDs
14
+ * 3) Switch cases again — for cases nested inside conditionals
15
+ * 4) For loops — skips nodes already processed by conditionals
16
+ */
17
+ export declare function bindStructuralDirectives(nodes: import('@pithyjs/compiler').PithyNode[], fragment: DocumentFragment, context: Record<string, unknown>, disposers: (() => void)[]): void;
18
+ /**
19
+ * Compiles a raw HTML template into live DOM nodes with signal bindings,
20
+ * event handlers, and optional styles.
21
+ *
22
+ * Pipeline overview:
23
+ * 1) parseHtml → returns a DocumentFragment + AST nodes (pithyNodes)
24
+ * 2) structural directives first: @if/@else, @switch, @for (they shape the DOM)
25
+ * 3) inject CSS (scoped)
26
+ * 4) run remaining binders in an order that avoids double-binding and cross-contamination:
27
+ * - refs (so later passes can access refs if needed)
28
+ * - components (instantiate/replace custom tags BEFORE binding into their subtree)
29
+ * - two-way (default model bindings for inputs)
30
+ * - text interpolations
31
+ * - events
32
+ * - classes
33
+ * - bound attributes
34
+ *
35
+ * @param html - Raw HTML template string
36
+ * @param context - Reactive context object (signals, methods, components)
37
+ * @param css - Optional CSS string to scope and inject
38
+ * @param scopeId - Optional scope id for CSS scoping
39
+ * @param importedIdentifiers - Optional set of ids exposed to expressions
40
+ */
41
+ /** @codexApi {"parent":"pithy.runtime.renderer","name":"compileTemplate","stability":"stable","signature":"(html: string, context: Record<string, any>, css?: string, scopeId?: string, importedIdentifiers?: Set<string>) => { el: HTMLElement | DocumentFragment; destroy: () => void }"} */
42
+ export declare function compileTemplate(html: string, context: Record<string, unknown>, css?: string, scopeId?: string, importedIdentifiers?: Set<string>): {
43
+ el: HTMLElement | DocumentFragment;
44
+ destroy: () => void;
45
+ };
46
+ /**
47
+ * Applies all non-structural bindings to the compiled fragment.
48
+ *
49
+ * Ordering rationale:
50
+ * - refs: collected early, sometimes needed by subsequent binders
51
+ * - error boundaries: register boundaries before components render (enables error capture)
52
+ * - projection: mount projected content into slot anchors BEFORE component binding,
53
+ * so nested component tags in projected content get processed
54
+ * - components: instantiate/replace custom tags (including those in projected content);
55
+ * prevents parent binders from walking into raw component tags
56
+ * - two-way: attach default v-model-ish behavior on real inputs (not inside components)
57
+ * - text: {{ ... }} bindings (skips nested loops / component subtrees via flags)
58
+ * - events: add listeners (idempotent; supports modifiers; nearest ctx; $event/$el)
59
+ * - classes: dynamic class toggles
60
+ * - attributes: remaining [attr]="..." bindings
61
+ */
62
+ /** @codexApi {"parent":"pithy.runtime.renderer","name":"bindTemplateDirectives","stability":"stable","signature":"(fragment: DocumentFragment, context: Record<string, any>, disposers: (() => void)[]) => void"} */
63
+ export declare function bindTemplateDirectives(fragment: DocumentFragment, context: Record<string, unknown>, disposers: (() => void)[]): void;
64
+ //# sourceMappingURL=compileTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileTemplate.d.ts","sourceRoot":"","sources":["../../src/compile/compileTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAuBF;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,mBAAmB,EAAE,SAAS,EAAE,EAC9C,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAWN;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+RAA+R;AAC/R,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAChC;IAAE,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA4C7D;AAED;;;;;;;;;;;;;;;GAeG;AACH,qNAAqN;AACrN,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CA6CN"}
@@ -0,0 +1,157 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.renderer",
4
+ "title": "Template Compiler & Renderer",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import { parseHtml } from './parseHtml';
9
+ import { injectScopedStyle } from './injectScopedStyle';
10
+ import { bindTextInterpolations } from './binds/bindTextInterpolations';
11
+ import { bindEventHandlers } from './binds/bindEventHandlers';
12
+ import { bindClassDirectives } from './binds/bindClassDirectives';
13
+ import { bindComponentTags } from './binds/bindComponentsTags';
14
+ import { bindConditionals } from './binds/bindConditionals';
15
+ import { bindBoundAttributes } from './binds/bindBoundAttributes';
16
+ import { bindRefDirectives } from './binds/bindRefDirectives';
17
+ import { bindDefaultTwoWay } from './binds/bindDefaultTwoWay';
18
+ import { bindErrorBoundary } from './binds/bindErrorBoundary';
19
+ import { bindDeferDirectives } from './binds/bindDeferDirectives';
20
+ import { bindForLoops } from './forLoops/bindForLoops';
21
+ import { bindSwitchCases } from './bindSwitchCases';
22
+ import { extractSlotDefs, mountProjection, } from './contentProjection';
23
+ import { executeCustomDirectiveBinders } from './binds/directiveRegistry';
24
+ /**
25
+ * Runs all structural directive bindings on a fragment.
26
+ *
27
+ * Ordering:
28
+ * 1) Switch cases first — they clone pristine DOM before conditionals replace elements
29
+ * 2) Conditionals (@if/@else) — returns processed node IDs
30
+ * 3) Switch cases again — for cases nested inside conditionals
31
+ * 4) For loops — skips nodes already processed by conditionals
32
+ */
33
+ export function bindStructuralDirectives(nodes, fragment, context, disposers) {
34
+ bindSwitchCases(nodes, fragment, context, new Set(), disposers);
35
+ const conditionalProcessedIds = bindConditionals(nodes, fragment, context, new Set(), disposers);
36
+ bindSwitchCases(nodes, fragment, context, new Set(), disposers);
37
+ bindForLoops(nodes, fragment, context, disposers, conditionalProcessedIds);
38
+ }
39
+ /**
40
+ * Compiles a raw HTML template into live DOM nodes with signal bindings,
41
+ * event handlers, and optional styles.
42
+ *
43
+ * Pipeline overview:
44
+ * 1) parseHtml → returns a DocumentFragment + AST nodes (pithyNodes)
45
+ * 2) structural directives first: @if/@else, @switch, @for (they shape the DOM)
46
+ * 3) inject CSS (scoped)
47
+ * 4) run remaining binders in an order that avoids double-binding and cross-contamination:
48
+ * - refs (so later passes can access refs if needed)
49
+ * - components (instantiate/replace custom tags BEFORE binding into their subtree)
50
+ * - two-way (default model bindings for inputs)
51
+ * - text interpolations
52
+ * - events
53
+ * - classes
54
+ * - bound attributes
55
+ *
56
+ * @param html - Raw HTML template string
57
+ * @param context - Reactive context object (signals, methods, components)
58
+ * @param css - Optional CSS string to scope and inject
59
+ * @param scopeId - Optional scope id for CSS scoping
60
+ * @param importedIdentifiers - Optional set of ids exposed to expressions
61
+ */
62
+ /** @codexApi {"parent":"pithy.runtime.renderer","name":"compileTemplate","stability":"stable","signature":"(html: string, context: Record<string, any>, css?: string, scopeId?: string, importedIdentifiers?: Set<string>) => { el: HTMLElement | DocumentFragment; destroy: () => void }"} */
63
+ export function compileTemplate(html, context, css, scopeId, importedIdentifiers) {
64
+ const id = scopeId ?? `pithy-${Math.random().toString(36).slice(2, 8)}`;
65
+ const disposers = [];
66
+ let fragment;
67
+ try {
68
+ // Parse into fragment + AST
69
+ const parsed = parseHtml(html, id, context, importedIdentifiers);
70
+ fragment = parsed.fragment;
71
+ // Structural transforms first (they change the DOM shape and add anchors)
72
+ bindStructuralDirectives(parsed.pithyNodes, fragment, context, disposers);
73
+ // Scoped CSS after structure is stable
74
+ if (css) {
75
+ injectScopedStyle(css, id);
76
+ }
77
+ // Remaining directives/bindings in carefully chosen order
78
+ bindTemplateDirectives(fragment, context, disposers);
79
+ }
80
+ catch (err) {
81
+ // Clean up any disposers registered during partial compilation
82
+ for (let i = disposers.length - 1; i >= 0; i--) {
83
+ try {
84
+ disposers[i]();
85
+ }
86
+ catch {
87
+ /* ignore */
88
+ }
89
+ }
90
+ throw err;
91
+ }
92
+ return {
93
+ el: fragment,
94
+ destroy() {
95
+ for (let i = disposers.length - 1; i >= 0; i--) {
96
+ try {
97
+ disposers[i]();
98
+ }
99
+ catch {
100
+ /* ignore */
101
+ }
102
+ }
103
+ },
104
+ };
105
+ }
106
+ /**
107
+ * Applies all non-structural bindings to the compiled fragment.
108
+ *
109
+ * Ordering rationale:
110
+ * - refs: collected early, sometimes needed by subsequent binders
111
+ * - error boundaries: register boundaries before components render (enables error capture)
112
+ * - projection: mount projected content into slot anchors BEFORE component binding,
113
+ * so nested component tags in projected content get processed
114
+ * - components: instantiate/replace custom tags (including those in projected content);
115
+ * prevents parent binders from walking into raw component tags
116
+ * - two-way: attach default v-model-ish behavior on real inputs (not inside components)
117
+ * - text: {{ ... }} bindings (skips nested loops / component subtrees via flags)
118
+ * - events: add listeners (idempotent; supports modifiers; nearest ctx; $event/$el)
119
+ * - classes: dynamic class toggles
120
+ * - attributes: remaining [attr]="..." bindings
121
+ */
122
+ /** @codexApi {"parent":"pithy.runtime.renderer","name":"bindTemplateDirectives","stability":"stable","signature":"(fragment: DocumentFragment, context: Record<string, any>, disposers: (() => void)[]) => void"} */
123
+ export function bindTemplateDirectives(fragment, context, disposers) {
124
+ // 1) refs first — enables grabbing component roots/elements if needed
125
+ bindRefDirectives(fragment, context, disposers);
126
+ // 2) error boundaries — register before components so they can catch component errors
127
+ bindErrorBoundary(fragment, context, disposers);
128
+ // 3) content projection — mount projected content into slot anchors BEFORE components.
129
+ // Projected content may contain component tags (e.g., nested <Show> inside <Show>).
130
+ // If components ran first, those nested component tags would never be processed.
131
+ // Only run if we have a SlotMap (meaning we're inside a component with projected content)
132
+ // Use 'in' operator to check via Proxy's has() trap without triggering the get() warning
133
+ const slotMap = ('__slotMap' in context ? context.__slotMap : undefined);
134
+ if (slotMap) {
135
+ const slotDefs = extractSlotDefs(fragment);
136
+ if (slotDefs.length > 0) {
137
+ mountProjection(slotDefs, slotMap, disposers);
138
+ }
139
+ }
140
+ // 4) components — materialize custom tags, including those in projected content
141
+ bindComponentTags(fragment, context, disposers);
142
+ // 5) two-way model bindings for native controls at this level
143
+ bindDefaultTwoWay(fragment, context, disposers);
144
+ // 6) text interpolations — our binder already skips nested loops & component roots
145
+ bindTextInterpolations(fragment, context, disposers);
146
+ // 7) events (idempotent; supports modifiers; nearest ctx; $event/$el)
147
+ bindEventHandlers(fragment, context, disposers);
148
+ // 8) classes
149
+ bindClassDirectives(fragment, context, disposers);
150
+ // 9) bound attributes
151
+ bindBoundAttributes(fragment, context, disposers);
152
+ // 10) custom directives — allows external packages (router, etc.) to register binders
153
+ executeCustomDirectiveBinders(fragment, context, disposers);
154
+ // 11) defer directives — lazy loading with @defer, @load, @placeholder
155
+ bindDeferDirectives(fragment, context, disposers);
156
+ }
157
+ //# sourceMappingURL=compileTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileTemplate.js","sourceRoot":"","sources":["../../src/compile/compileTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,e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1F,yFAAyF;IACzF,MAAM,OAAO,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAE1D,CAAC;IACd,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,gFAAgF;IAChF,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAEhD,8DAA8D;IAC9D,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAEhD,mFAAmF;IACnF,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAErD,sEAAsE;IACtE,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAEhD,aAAa;IACb,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAElD,sBAAsB;IACtB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAElD,sFAAsF;IACtF,6BAA6B,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAE5D,uEAAuE;IACvE,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.feature.content-projection",
4
+ "title": "Content Projection System",
5
+ "category": "feature"
6
+ }
7
+ */
8
+ import { PithyNode } from '@pithyjs/compiler';
9
+ /**
10
+ * SlotMap contains renderer functions for each slot name.
11
+ * Each entry is a factory that returns a DocumentFragment of the slot's content.
12
+ */
13
+ export type SlotMap = Map<string, () => DocumentFragment>;
14
+ /**
15
+ * SlotDef describes a slot anchor and its fallback content
16
+ */
17
+ export type FallbackFactory = () => HTMLElement | DocumentFragment | undefined;
18
+ export interface SlotDef {
19
+ name: string;
20
+ anchor: Comment;
21
+ fallbackFactory?: FallbackFactory;
22
+ }
23
+ /** @codexApi {"parent":"pithy.feature.content-projection","name":"collectSlotMap","stability":"stable","signature":"(children: PithyNode[], parentContext: Record<string, any>) => SlotMap"} */
24
+ export declare function collectSlotMap(children: PithyNode[], parentContext: Record<string, unknown>): SlotMap;
25
+ /** @codexApi {"parent":"pithy.feature.content-projection","name":"extractSlotDefs","stability":"stable","signature":"(fragment: DocumentFragment) => SlotDef[]"} */
26
+ export declare function extractSlotDefs(fragment: DocumentFragment): SlotDef[];
27
+ /** @codexApi {"parent":"pithy.feature.content-projection","name":"mountProjection","stability":"stable","signature":"(slotDefs: SlotDef[], slotMap: SlotMap, disposers: (() => void)[]) => void"} */
28
+ export declare function mountProjection(slotDefs: SlotDef[], slotMap: SlotMap, disposers: (() => void)[]): void;
29
+ //# sourceMappingURL=contentProjection.d.ts.map
@@ -0,0 +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"}