@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":"applyStructural.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyStructural.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,iFAAiF;AAEjF,MAAM,UAAU,OAAO,CACrB,CAAS,EACT,UAAgC,EAChC,GAAmB,EACnB,SAAyB;IAEzB,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,IAAI,YAAY,GAAW,EAAE,CAAC;IAC9B,IAAI,gBAAgB,GAAmB,EAAE,CAAC;IAE1C,SAAS,YAAY;QACnB,KAAK,MAAM,EAAE,IAAI,gBAAgB,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,EAAE,EAAE,CAAC;YACP,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC;QACD,gBAAgB,GAAG,EAAE,CAAC;QACtB,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,UAAU;gBAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;QACD,YAAY,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,IAAI,SAAS,EAAE,EAAE,CAAC;QAChB,mCAAmC;QACnC,I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QAEf,IAAI,UAAU,IAAI,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAChD,IAAI,MAAM,EAAE,EAAE,EAAE,CAAC;oBACf,MAAM,KAAK,GACT,MAAM,CAAC,EAAE,YAAY,gBAAgB;wBACnC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC;wBAClC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBAClB,KAAK,MAAM,IAAI,IAAI,KAAK;wBAAE,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBACxD,YAAY,GAAG,KAAK,CAAC;oBACrB,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU;wBACtC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC1C,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;oBACtB,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7B,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,56 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.binding-helpers",
4
+ "title": "AOT Binding Helpers",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * Shared helper utilities for AOT binding application.
10
+ *
11
+ * Provides DOM lookup maps, context merging, and expression compilation
12
+ * used by both the JIT path (`html.ts`) and the AOT path (`applyBindings.ts`).
13
+ *
14
+ * @module runtime/bindings/helpers
15
+ */
16
+ import type { BindingContext } from './types';
17
+ /**
18
+ * Build a map of pid → Element from data-pid attributes in the fragment.
19
+ * @param fragment - The DOM fragment to scan
20
+ * @returns Map from pid string to the corresponding Element
21
+ */
22
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"buildPidMap","stability":"internal","signature":"(fragment: DocumentFragment) => Map<string, Element>"} */
23
+ export declare function buildPidMap(fragment: DocumentFragment): Map<string, Element>;
24
+ /**
25
+ * Build a map of comment anchor id → Comment for structural directives.
26
+ * @param fragment - The DOM fragment to scan
27
+ * @returns Map from comment text (e.g. "if:r0") to the Comment node
28
+ */
29
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"buildCommentMap","stability":"internal","signature":"(fragment: DocumentFragment) => Map<string, Comment>"} */
30
+ export declare function buildCommentMap(fragment: DocumentFragment): Map<string, Comment>;
31
+ /**
32
+ * Walk up the DOM to find the nearest local PithyJS context.
33
+ * Falls back to the provided root context.
34
+ * @param el - Starting DOM node
35
+ * @param rootCtx - Fallback context if no local context is found
36
+ * @returns The nearest context object
37
+ */
38
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"nearestCtx","stability":"internal","signature":"(el: Node, rootCtx: BindingContext) => BindingContext"} */
39
+ export declare function nearestCtx(el: Node, rootCtx: BindingContext): BindingContext;
40
+ /**
41
+ * Merge parent component and async (SSR) contexts into the explicit context.
42
+ * Single source of truth used by both `html.ts` and `applyBindings.ts`.
43
+ * @param context - The explicit context from the call site
44
+ * @returns Merged context with parent component and async contexts
45
+ */
46
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"mergeContexts","stability":"internal","signature":"(context: BindingContext) => BindingContext"} */
47
+ export declare function mergeContexts(context: BindingContext): BindingContext;
48
+ /**
49
+ * Compile expression with $event and $el support for event handlers.
50
+ * @param expr - The expression string to compile
51
+ * @param ctx - The reactive context for variable resolution
52
+ * @returns A function that accepts (event, element) and evaluates the expression
53
+ */
54
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"compileWithEvent","stability":"internal","signature":"(expr: string, ctx: BindingContext) => (ev: Event, el: Element) => unknown"} */
55
+ export declare function compileWithEvent(expr: string, ctx: BindingContext): (ev: Event, el: Element) => unknown;
56
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C;;;;GAIG;AACH,0KAA0K;AAC1K,wBAAgB,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAS5E;AAED;;;;GAIG;AACH,8KAA8K;AAC9K,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,GACzB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAatB;AAED;;;;;;GAMG;AACH,0KAA0K;AAC1K,wBAAgB,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,GAAG,cAAc,CAe5E;AAED;;;;;GAKG;AACH,mKAAmK;AACnK,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAyBrE;AAED;;;;;GAKG;AACH,qMAAqM;AACrM,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,cAAc,GAClB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,KAAK,OAAO,CAgBrC"}
@@ -0,0 +1,121 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.binding-helpers",
4
+ "title": "AOT Binding Helpers",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import { pithyGlobals } from '../../types/globals';
9
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
10
+ /**
11
+ * Build a map of pid → Element from data-pid attributes in the fragment.
12
+ * @param fragment - The DOM fragment to scan
13
+ * @returns Map from pid string to the corresponding Element
14
+ */
15
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"buildPidMap","stability":"internal","signature":"(fragment: DocumentFragment) => Map<string, Element>"} */
16
+ export function buildPidMap(fragment) {
17
+ const map = new Map();
18
+ const walker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT);
19
+ let node;
20
+ while ((node = walker.nextNode())) {
21
+ const pid = node.getAttribute('data-pid');
22
+ if (pid)
23
+ map.set(pid, node);
24
+ }
25
+ return map;
26
+ }
27
+ /**
28
+ * Build a map of comment anchor id → Comment for structural directives.
29
+ * @param fragment - The DOM fragment to scan
30
+ * @returns Map from comment text (e.g. "if:r0") to the Comment node
31
+ */
32
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"buildCommentMap","stability":"internal","signature":"(fragment: DocumentFragment) => Map<string, Comment>"} */
33
+ export function buildCommentMap(fragment) {
34
+ const map = new Map();
35
+ const walker = document.createTreeWalker(fragment, NodeFilter.SHOW_COMMENT);
36
+ let node;
37
+ while ((node = walker.nextNode())) {
38
+ const text = node.textContent ?? '';
39
+ // Structural anchors: "if:pid", "for:pid", "slot:name"
40
+ const colonIdx = text.indexOf(':');
41
+ if (colonIdx > 0) {
42
+ map.set(text, node);
43
+ }
44
+ }
45
+ return map;
46
+ }
47
+ /**
48
+ * Walk up the DOM to find the nearest local PithyJS context.
49
+ * Falls back to the provided root context.
50
+ * @param el - Starting DOM node
51
+ * @param rootCtx - Fallback context if no local context is found
52
+ * @returns The nearest context object
53
+ */
54
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"nearestCtx","stability":"internal","signature":"(el: Node, rootCtx: BindingContext) => BindingContext"} */
55
+ export function nearestCtx(el, rootCtx) {
56
+ // Walk parentNode (not parentElement) so context is found on Text/Comment
57
+ // nodes — needed when JIT-projected content is slotted into AOT components.
58
+ // NOTE: In @for loops, only Element nodes receive loop-item __pithyCtx
59
+ // (see applyStructural.ts / createLoopManager.ts). Text nodes inside loop
60
+ // items inherit context from their parent Element, which works correctly
61
+ // because AOT text nodes don't have __pithyCtx set (factories use raw
62
+ // createTextNode), and JIT text nodes are children of tagged Elements.
63
+ let n = el;
64
+ while (n) {
65
+ const local = n.__pithyCtx;
66
+ if (local)
67
+ return local;
68
+ n = n.parentNode;
69
+ }
70
+ return rootCtx;
71
+ }
72
+ /**
73
+ * Merge parent component and async (SSR) contexts into the explicit context.
74
+ * Single source of truth used by both `html.ts` and `applyBindings.ts`.
75
+ * @param context - The explicit context from the call site
76
+ * @returns Merged context with parent component and async contexts
77
+ */
78
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"mergeContexts","stability":"internal","signature":"(context: BindingContext) => BindingContext"} */
79
+ export function mergeContexts(context) {
80
+ const g = pithyGlobals();
81
+ const getContextFn = g.__getComponentContext;
82
+ const asyncContext = typeof getContextFn === 'function' ? getContextFn() : undefined;
83
+ const parentComponentContext = g.__pithyComponentContext;
84
+ let parentData;
85
+ if (parentComponentContext && typeof parentComponentContext === 'object') {
86
+ parentData = {};
87
+ for (const key of Object.keys(parentComponentContext)) {
88
+ if (key.startsWith('__') ||
89
+ typeof parentComponentContext[key] === 'function') {
90
+ parentData[key] = parentComponentContext[key];
91
+ }
92
+ }
93
+ if (Object.keys(parentData).length === 0)
94
+ parentData = undefined;
95
+ }
96
+ if (asyncContext || parentData) {
97
+ return { ...(parentData || {}), ...(asyncContext || {}), ...context };
98
+ }
99
+ return context;
100
+ }
101
+ /**
102
+ * Compile expression with $event and $el support for event handlers.
103
+ * @param expr - The expression string to compile
104
+ * @param ctx - The reactive context for variable resolution
105
+ * @returns A function that accepts (event, element) and evaluates the expression
106
+ */
107
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"compileWithEvent","stability":"internal","signature":"(expr: string, ctx: BindingContext) => (ev: Event, el: Element) => unknown"} */
108
+ export function compileWithEvent(expr, ctx) {
109
+ try {
110
+ // eslint-disable-next-line no-new-func -- JIT event-handler expression evaluation is a core framework feature
111
+ const fn = new Function('ctx', '$event', '$el', `with (ctx) { return (${expr}); }`);
112
+ return (ev, el) => fn(ctx, ev, el);
113
+ }
114
+ catch (err) {
115
+ if (import.meta.env?.DEV) {
116
+ console.warn(`[AOT bindEvent] Failed to compile "${expr}"`, err);
117
+ }
118
+ return (_ev, _el) => undefined;
119
+ }
120
+ }
121
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/runtime/bindings/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAYF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,iFAAiF;AAEjF;;;;GAIG;AACH,0KAA0K;AAC1K,MAAM,UAAU,WAAW,CAAC,QAA0B;IACpD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAmB,CAAC;IACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAC5E,IAAI,IAAoB,CAAC;IACzB,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAoB,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,GAAG;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,8KAA8K;AAC9K,MAAM,UAAU,eAAe,CAC7B,QAA0B;IAE1B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAmB,CAAC;IACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAC5E,IAAI,IAAoB,CAAC;IACzB,OAAO,CAAC,IAAI,GAAG,MAA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,7 @@
1
+ export type { EventDesc, InterpDesc, ClassDesc, StyleDesc, BoundDesc, RefDesc, BindDesc, CompDesc, DeferDesc, ErrorDesc, ProjDesc, IfDesc, ForDesc, SwitchDesc, Desc, } from './types';
2
+ export { buildPidMap, buildCommentMap, mergeContexts } from './helpers';
3
+ export { applyRef, applyError, applyProjection, applyBind, applyInterpolation, applyEvent, applyClass, applyStyle, applyBound, } from './applySimple';
4
+ export { applyComponent } from './applyComponent';
5
+ export { applyIf, applyFor, applySwitch } from './applyStructural';
6
+ export { applyDefer } from './applyDefer';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,IAAI,GACL,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { buildPidMap, buildCommentMap, mergeContexts } from './helpers';
2
+ export { applyRef, applyError, applyProjection, applyBind, applyInterpolation, applyEvent, applyClass, applyStyle, applyBound, } from './applySimple';
3
+ export { applyComponent } from './applyComponent';
4
+ export { applyIf, applyFor, applySwitch } from './applyStructural';
5
+ export { applyDefer } from './applyDefer';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/bindings/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,105 @@
1
+ export type BindingContext = Record<string, unknown>;
2
+ export interface FactoryResult {
3
+ el?: HTMLElement | DocumentFragment;
4
+ destroy?: () => void;
5
+ }
6
+ export type Factory = (ctx: BindingContext) => FactoryResult | null | undefined;
7
+ export interface EventDesc {
8
+ t: 'event';
9
+ pid: string;
10
+ event: string;
11
+ expr: string;
12
+ mods?: string[];
13
+ }
14
+ export interface InterpDesc {
15
+ t: 'interp';
16
+ pid: string;
17
+ parts: ({
18
+ s: string;
19
+ } | {
20
+ e: string;
21
+ })[];
22
+ }
23
+ export interface ClassDesc {
24
+ t: 'class';
25
+ pid: string;
26
+ name: string;
27
+ expr: string;
28
+ }
29
+ export interface StyleDesc {
30
+ t: 'style';
31
+ pid: string;
32
+ prop: string;
33
+ expr: string;
34
+ }
35
+ export interface BoundDesc {
36
+ t: 'bound';
37
+ pid: string;
38
+ attr: string;
39
+ expr: string;
40
+ }
41
+ export interface RefDesc {
42
+ t: 'ref';
43
+ pid: string;
44
+ name: string;
45
+ }
46
+ export interface BindDesc {
47
+ t: 'bind';
48
+ pid: string;
49
+ expr: string;
50
+ }
51
+ export interface CompDesc {
52
+ t: 'comp';
53
+ pid: string;
54
+ tag: string;
55
+ props: Record<string, string>;
56
+ }
57
+ export interface DeferDesc {
58
+ t: 'defer';
59
+ pid: string;
60
+ trigger: string;
61
+ load: string;
62
+ placeholder?: string;
63
+ when?: string;
64
+ priority?: string;
65
+ timeout?: number;
66
+ }
67
+ export interface ErrorDesc {
68
+ t: 'error';
69
+ pid: string;
70
+ expr: string;
71
+ }
72
+ export interface ProjDesc {
73
+ t: 'proj';
74
+ pid: string;
75
+ name: string;
76
+ fallback?: Factory;
77
+ }
78
+ export interface IfDesc {
79
+ t: 'if';
80
+ pid: string;
81
+ branches: {
82
+ expr?: string;
83
+ factory: Factory;
84
+ }[];
85
+ }
86
+ export interface ForDesc {
87
+ t: 'for';
88
+ pid: string;
89
+ item: string;
90
+ index?: string;
91
+ expr: string;
92
+ trackBy?: string;
93
+ factory: Factory;
94
+ }
95
+ export interface SwitchDesc {
96
+ t: 'switch';
97
+ pid: string;
98
+ expr: string;
99
+ cases: {
100
+ val?: string;
101
+ factory: Factory;
102
+ }[];
103
+ }
104
+ export type Desc = EventDesc | InterpDesc | ClassDesc | StyleDesc | BoundDesc | RefDesc | BindDesc | CompDesc | DeferDesc | ErrorDesc | ProjDesc | IfDesc | ForDesc | SwitchDesc;
105
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,WAAW,GAAG,gBAAgB,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,aAAa,GAAG,IAAI,G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AAA;KAAE,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,IAAI,GACZ,SAAS,GACT,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ // ─── Descriptor types (mirror codegen output) ────────────────────────────────
2
+ // These describe the shape of the compact binding arrays emitted by the AOT
3
+ // codegen in generateBindings.ts. Handlers narrow inside via the `t` discriminant.
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/bindings/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,mFAAmF"}
@@ -0,0 +1,59 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.bootstrap",
4
+ "title": "App Bootstrap (Fresh Mount)",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * @pithyjs/core - Fresh-mount Bootstrap
10
+ *
11
+ * Handles the standard app startup sequence for non-SSR apps:
12
+ * 1. Initialize design system (if configured)
13
+ * 2. Render App component and mount to DOM
14
+ * 3. Create router (after App succeeds to avoid leaking listeners)
15
+ * 4. Mount router (finds outlet, enables navigation)
16
+ *
17
+ * For SSR hydration, use `bootstrap` from `@pithyjs/ssr/client` instead —
18
+ * it wraps this function and adds hydration detection.
19
+ */
20
+ import type { Component } from '../types';
21
+ import type { PithyConfig, RouteNode, RouterFactory } from '@pithyjs/shared';
22
+ export interface BootstrapOptions {
23
+ /** The root App component */
24
+ App: Component;
25
+ /** Route tree (from virtual:pithy/routes.gen) */
26
+ routes: RouteNode[];
27
+ /** App configuration (from pithy.config.ts) */
28
+ config: PithyConfig;
29
+ /**
30
+ * Router factory — pass `createRouter` from `@pithyjs/router`.
31
+ *
32
+ * Injected rather than imported so core never depends on the router
33
+ * package, breaking the core ↔ router circular dependency.
34
+ */
35
+ createRouter: RouterFactory;
36
+ }
37
+ /**
38
+ * Bootstrap a PithyJS app with fresh mount (no hydration).
39
+ *
40
+ * In dev mode, automatically loads the JIT compiler (parse5) for runtime
41
+ * `html\`\`` templates. In production, JIT is not loaded — templates must
42
+ * be AOT-compiled. If your production app uses runtime `html()` templates,
43
+ * call `loadJITCompiler()` from `@pithyjs/core/compile/parseHtml` before
44
+ * calling `bootstrap()`.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * import { bootstrap } from '@pithyjs/core';
49
+ * import { createRouter } from '@pithyjs/router';
50
+ * import config from '../pithy.config';
51
+ * import { routes } from 'virtual:pithy/routes.gen';
52
+ * import App from './App';
53
+ *
54
+ * await bootstrap({ App, routes, config, createRouter });
55
+ * ```
56
+ */
57
+ /** @codexApi {"parent":"pithy.runtime.bootstrap","name":"bootstrap","stability":"stable","signature":"(options: BootstrapOptions) => Promise<void>"} */
58
+ export declare function bootstrap(options: BootstrapOptions): Promise<void>;
59
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAO7E,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,GAAG,EAAE,SAAS,CAAC;IACf,iDAAiD;IACjD,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,+CAA+C;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB;;;;;OAKG;IACH,YAAY,EAAE,aAAa,CAAC;CAC7B;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wJAAwJ;AACxJ,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+DxE"}
@@ -0,0 +1,82 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.bootstrap",
4
+ "title": "App Bootstrap (Fresh Mount)",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import { initDesignSystem } from '@pithyjs/design-system';
9
+ // =============================================================================
10
+ // Implementation
11
+ // =============================================================================
12
+ /**
13
+ * Bootstrap a PithyJS app with fresh mount (no hydration).
14
+ *
15
+ * In dev mode, automatically loads the JIT compiler (parse5) for runtime
16
+ * `html\`\`` templates. In production, JIT is not loaded — templates must
17
+ * be AOT-compiled. If your production app uses runtime `html()` templates,
18
+ * call `loadJITCompiler()` from `@pithyjs/core/compile/parseHtml` before
19
+ * calling `bootstrap()`.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { bootstrap } from '@pithyjs/core';
24
+ * import { createRouter } from '@pithyjs/router';
25
+ * import config from '../pithy.config';
26
+ * import { routes } from 'virtual:pithy/routes.gen';
27
+ * import App from './App';
28
+ *
29
+ * await bootstrap({ App, routes, config, createRouter });
30
+ * ```
31
+ */
32
+ /** @codexApi {"parent":"pithy.runtime.bootstrap","name":"bootstrap","stability":"stable","signature":"(options: BootstrapOptions) => Promise<void>"} */
33
+ export async function bootstrap(options) {
34
+ const { App, routes, config } = options;
35
+ // 0. Validate preconditions before any side effects (fail fast — don't leave
36
+ // a partially-mounted app if an untyped/JS caller omits a required option).
37
+ // `createRouter` is required by TS, but a JS caller could omit it; surface
38
+ // a clear, actionable error here rather than "createRouter is not a function"
39
+ // after App has already mounted.
40
+ if (typeof options.createRouter !== 'function') {
41
+ throw new Error("[pithy] bootstrap() requires a 'createRouter' option — pass `createRouter` from '@pithyjs/router'.");
42
+ }
43
+ const appId = config.appId ?? 'app';
44
+ const target = document.getElementById(appId);
45
+ if (!target) {
46
+ throw new Error(`[pithy] Container element #${appId} not found`);
47
+ }
48
+ // 1. In dev mode, templates use JIT compilation (parse5 in the browser via Vite).
49
+ // AOT is disabled in dev (`aot: false` when config.command !== "build"), so
50
+ // parse5 must be loaded before any component renders.
51
+ // In production builds this block is dead-code-eliminated (import.meta.env.DEV → false).
52
+ if (import.meta.env?.DEV) {
53
+ const { loadJITCompiler } = await import('../compile/parseHtml');
54
+ await loadJITCompiler();
55
+ }
56
+ // 2. Initialize design system
57
+ if (config.designSystem) {
58
+ initDesignSystem(config.designSystem);
59
+ }
60
+ // 3. Apply entrance animation preset (before App mount — sections
61
+ // read data-entrance during observeEntrance() at component init)
62
+ if (config.entrance?.preset) {
63
+ const validPresets = ['none', 'subtle', 'standard', 'expressive'];
64
+ const preset = validPresets.includes(config.entrance.preset)
65
+ ? config.entrance.preset
66
+ : 'standard';
67
+ document.documentElement.setAttribute('data-entrance', preset);
68
+ }
69
+ // 4. Mount App component (before router so if App() throws,
70
+ // no router listeners are leaked)
71
+ const app = App();
72
+ target.appendChild(app.el);
73
+ // 5. Create router (after App succeeds — constructor installs
74
+ // global history listeners and link interceptors).
75
+ // The factory is injected via options (pass `createRouter` from
76
+ // @pithyjs/router) so core never imports the router package — breaking
77
+ // the core ↔ router circular dependency. (Presence validated at step 0.)
78
+ const router = options.createRouter(routes, (config.router ?? {}));
79
+ // 6. Mount router (finds outlet, sets global, handles HMR)
80
+ router.mount(target);
81
+ }
82
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAiBF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAsB1D,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wJAAwJ;AACxJ,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAyB;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EA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ACjE,CAAC;IAED,4DAA4D;IAC5D,qCAAqC;IACrC,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC;IAClB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE3B,8DAA8D;IAC9D,sDAAsD;IACtD,mEAAmE;IACnE,0EAA0E;IAC1E,4EAA4E;IAC5E,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CACjC,MAAM,EACN,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAA4B,CACjD,CAAC;IAEF,2DAA2D;IAC3D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.context",
4
+ "title": "Context Proxy System",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /** @codexApi {"parent":"pithy.runtime.context","name":"createContextProxy","stability":"stable","signature":"(contexts: Record<string, unknown>[]) => Record<string, unknown>"} */
9
+ export declare function createContextProxy(contexts: Record<string, unknown>[]): Record<string, unknown>;
10
+ //# sourceMappingURL=createContextProxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createContextProxy.d.ts","sourceRoot":"","sources":["../../src/runtime/createContextProxy.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,mLAAmL;AACnL,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAClC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2CzB"}
@@ -0,0 +1,45 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.context",
4
+ "title": "Context Proxy System",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ // Wraps local variables, props, signals, and functions into one unified context.
9
+ /** @codexApi {"parent":"pithy.runtime.context","name":"createContextProxy","stability":"stable","signature":"(contexts: Record<string, unknown>[]) => Record<string, unknown>"} */
10
+ export function createContextProxy(contexts) {
11
+ return new Proxy({}, {
12
+ get(_, key) {
13
+ for (const ctx of contexts) {
14
+ if (key in ctx) {
15
+ return ctx[key];
16
+ }
17
+ }
18
+ if (import.meta.env?.DEV) {
19
+ if (typeof key !== 'symbol') {
20
+ console.warn(`[pithy] Context key not found: ${key}`);
21
+ }
22
+ }
23
+ return undefined;
24
+ },
25
+ has(_, key) {
26
+ return contexts.some(ctx => key in ctx);
27
+ },
28
+ ownKeys(_) {
29
+ const allKeys = new Set();
30
+ for (const ctx of contexts) {
31
+ Reflect.ownKeys(ctx).forEach(key => allKeys.add(key));
32
+ }
33
+ return Array.from(allKeys);
34
+ },
35
+ getOwnPropertyDescriptor(_, key) {
36
+ for (const ctx of contexts) {
37
+ if (Object.prototype.hasOwnProperty.call(ctx, key)) {
38
+ return Object.getOwnPropertyDescriptor(ctx, key);
39
+ }
40
+ }
41
+ return undefined;
42
+ },
43
+ });
44
+ }
45
+ //# sourceMappingURL=createContextProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createContextProxy.js","sourceRoot":"","sources":["../../src/runtime/createContextProxy.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,iFAAiF;AACjF,mLAAmL;AACnL,MAAM,UAAU,kBAAkB,CAChC,QAAmC;IAEnC,OAAO,IAAI,KAAK,CACd,EAAE,EACF;QACE,GAAG,CAAC,CAAC,EAAE,GAAoB;YACzB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;oBACf,OAAO,GAAG,CAAC,GAAuB,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;gBACzB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;oBAC5B,OAAO,CAAC,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,GAAG,CAAC,CAAC,EAAE,GAAW;YAChB,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,CAAC,CAAC;YACP,MAAM,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;YAE3C,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACxD,CAAC;YAED,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QAED,wBAAwB,CAAC,CAAC,EAAE,GAAG;YAC7B,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;oBACnD,OAAO,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.defer-helpers",
4
+ "title": "Shared Defer Loading Helpers",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * Shared helpers for lazy-loading defer directives.
10
+ *
11
+ * Used by both the JIT path (`bindDeferDirectives.ts`) and the AOT path
12
+ * (`bindings/applyDefer.ts`) to avoid duplicating timeout and scheduling logic.
13
+ *
14
+ * @module runtime/deferHelpers
15
+ */
16
+ import type { LoadingPriority } from '@pithyjs/compiler';
17
+ import type { LazyHandle } from './lazy';
18
+ /**
19
+ * Load a lazy handle with timeout support.
20
+ * Rejects with a timeout error if loading exceeds the given duration.
21
+ *
22
+ * @param handle - The lazy handle to load
23
+ * @param timeoutMs - Maximum time in milliseconds before timeout
24
+ * @returns Promise resolving to the loaded module
25
+ */
26
+ /** @codexApi {"parent":"pithy.runtime.defer-helpers","name":"loadWithTimeout","stability":"internal","signature":"<T>(handle: LazyHandle<T>, timeoutMs: number) => Promise<T>"} */
27
+ export declare function loadWithTimeout<T>(handle: LazyHandle<T>, timeoutMs: number): Promise<T>;
28
+ /**
29
+ * Schedule a callback based on loading priority.
30
+ *
31
+ * - `"high"`: Execute synchronously (immediate)
32
+ * - `"low"`: `requestIdleCallback` (fires when browser is idle)
33
+ * - default (`undefined`): `queueMicrotask` (reliable, async enough for DOM settling)
34
+ *
35
+ * Deferring by default is critical: `bindDeferDirectives` runs BEFORE
36
+ * `bindComponentTags.replaceWith()` moves the element into the real DOM.
37
+ * Synchronous mount would capture a stale `parentNode` (the compilation fragment).
38
+ *
39
+ * NOTE: `requestIdleCallback` without a timeout can be starved indefinitely when
40
+ * the page is busy (HMR, long-running tasks). Default priority uses
41
+ * `queueMicrotask` which reliably fires after the current synchronous execution.
42
+ *
43
+ * @param callback - Function to execute
44
+ * @param priority - Loading priority level
45
+ * @returns Idle callback ID (if `"low"` priority), or `undefined`
46
+ */
47
+ /** @codexApi {"parent":"pithy.runtime.defer-helpers","name":"scheduleByPriority","stability":"internal","signature":"(callback: () => void, priority: LoadingPriority | undefined) => number | void"} */
48
+ export declare function scheduleByPriority(callback: () => void, priority: LoadingPriority | undefined): number | void;
49
+ //# sourceMappingURL=deferHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deferHelpers.d.ts","sourceRoot":"","sources":["../../src/runtime/deferHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;;;;GAOG;AACH,mLAAmL;AACnL,wBAAsB,eAAe,CAAC,CAAC,EACrC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,yMAAyM;AACzM,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,IAAI,EACpB,QAAQ,EAAE,eAAe,GAAG,SAAS,GACpC,MAAM,GAAG,IAAI,CASf"}