@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,355 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.components",
4
+ "title": "Component Tag Binding System",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import { compileExpression } from '../compileExpression';
9
+ import { boundaryForElement, runWithBoundary, setBoundaryError, } from './bindErrorBoundary';
10
+ import { collectSlotMap } from '../contentProjection';
11
+ import { nativeTags } from '@pithyjs/compiler';
12
+ import { nodeExpando } from '../nodeExpando';
13
+ import { pithyGlobals } from '../../types/globals';
14
+ /**
15
+ * Find the closest element-scoped context we attach in createLoopItem().
16
+ * This is what exposes item(), gIdx(), count(), etc.
17
+ */
18
+ // Warn once per component/tag pair — the same idiom re-renders constantly
19
+ // (e.g. a panel importing Button while using a native <button>), and
20
+ // repeating the warning drowns out real ones.
21
+ const warnedComponentTags = new Set();
22
+ function nearestCtx(el, rootCtx) {
23
+ let n = el;
24
+ while (n) {
25
+ const local = nodeExpando(n).__pithyCtx;
26
+ if (local)
27
+ return local;
28
+ n = n.parentElement;
29
+ }
30
+ return rootCtx;
31
+ }
32
+ /**
33
+ * Detect whether a node is inside a subtree that represents a NOT-YET-EXPANDED nested loop.
34
+ * Those hosts are tagged in createLoopManager.createLoopItem() via `__pithySkipText`,
35
+ * and real templates may also still carry @for / data-for before expansion.
36
+ * We must *defer* binding for anything under such a host, otherwise expressions like item()
37
+ * will throw ReferenceError (because inner loop ctx isn’t created yet).
38
+ */
39
+ function isInsidePendingLoopZone(node) {
40
+ let p = node;
41
+ while (p) {
42
+ if (nodeExpando(p).__pithySkipText)
43
+ return true;
44
+ if (p.hasAttribute &&
45
+ (p.hasAttribute('@for') || p.hasAttribute('data-for'))) {
46
+ return true;
47
+ }
48
+ p = p.parentElement;
49
+ }
50
+ return false;
51
+ }
52
+ /** Evaluate `expr` in `ctx`. Try engine compiler first, then args-style fallback. */
53
+ function evalInCtx(expr, ctx) {
54
+ // 1) Preferred: compileExpression uses `with(ctx) { return (...) }`
55
+ try {
56
+ const f = compileExpression(expr, ctx);
57
+ try {
58
+ return f();
59
+ }
60
+ catch {
61
+ /* fall through to fallback */
62
+ }
63
+ }
64
+ catch {
65
+ /* fall through to fallback */
66
+ }
67
+ // 2) Fallback: args-style evaluator (robust even if compileExpression throws)
68
+ const keys = Object.keys(ctx);
69
+ const vals = keys.map(k => ctx[k]);
70
+ // eslint-disable-next-line no-new-func -- args-style template expression evaluation is a core framework feature
71
+ const fn = new Function(...keys, `return (${expr});`);
72
+ return fn(...vals);
73
+ }
74
+ const propNameCache = new WeakMap();
75
+ /** Extract destructured prop names from `function Comp({ a, b = 1 }: Props) {}` */
76
+ function extractExpectedPropNames(componentFn) {
77
+ const cached = propNameCache.get(componentFn);
78
+ if (cached)
79
+ return cached;
80
+ let result;
81
+ try {
82
+ const src = componentFn.toString();
83
+ const m = src.match(/\(\s*\{\s*([^}]*)\s*\}/);
84
+ if (!m) {
85
+ result = [];
86
+ }
87
+ else {
88
+ result = m[1]
89
+ .split(',')
90
+ .map(s => s.trim())
91
+ .filter(Boolean)
92
+ .filter(s => !s.startsWith('...'))
93
+ .map(s => s.split(/[:=]/)[0].trim());
94
+ }
95
+ }
96
+ catch {
97
+ result = [];
98
+ }
99
+ propNameCache.set(componentFn, result);
100
+ return result;
101
+ }
102
+ /** Dev warnings for unexpected props (only if destructuring is present). */
103
+ function validateComponentProps(componentFn, props, componentName) {
104
+ const allNames = extractExpectedPropNames(componentFn);
105
+ if (allNames.length === 0)
106
+ return;
107
+ const passed = Object.keys(props);
108
+ const expectedSet = new Set(allNames);
109
+ const unexpected = passed.filter(p => !expectedSet.has(p));
110
+ if (unexpected.length) {
111
+ console.warn(`[PithyJS] 🔍 Component <${componentName}> received unexpected props: ${unexpected.join(', ')}\nExpected props: ${allNames.join(', ')}\nPassed props: ${passed.join(', ')}`);
112
+ }
113
+ // NOTE: We intentionally do NOT warn about "missing" props here.
114
+ // In template-driven usage, props are assembled at runtime by
115
+ // bindComponentTags(), so TypeScript cannot catch missing required
116
+ // props in this path. Components should self-validate critical
117
+ // props where appropriate (e.g. Toggle warns on empty label).
118
+ }
119
+ /** Map lowercased DOM attr name to expected prop name (case-insensitive). */
120
+ function normalizePropName(authoredName, expectedProps) {
121
+ if (expectedProps.length === 0)
122
+ return authoredName;
123
+ const map = new Map(expectedProps.map(p => [p.toLowerCase(), p]));
124
+ return map.get(authoredName.toLowerCase()) ?? authoredName;
125
+ }
126
+ /**
127
+ * Replace custom component tags (<Counter/>, <NestedComponent/>) with rendered output.
128
+ * - Skips anything under a pending nested loop host (bind after loop expansion)
129
+ * - Evaluates prop expressions in nearest loop ctx
130
+ * - Case-insensitive prop name normalization
131
+ * - No raw-string fallback (prevents things like calling count() on a string)
132
+ */
133
+ /** @codexApi {"parent":"pithy.runtime.components","name":"bindComponentTags","stability":"stable","signature":"(root: Element | DocumentFragment, rootCtx: Record<string, unknown>, disposers: (() => void)[]) => void"} */
134
+ export function bindComponentTags(root, rootCtx, disposers) {
135
+ // case-insensitive tag lookup from context
136
+ const tagMap = new Map(Object.keys(rootCtx).map(k => [k.toLowerCase(), rootCtx[k]]));
137
+ const scope = root instanceof Element ? root : root;
138
+ const elements = Array.from(scope.querySelectorAll('*'));
139
+ for (const el of elements) {
140
+ // Skip elements removed from the tree by a parent component's render
141
+ if (!scope.contains(el))
142
+ continue;
143
+ // Defer components inside not-yet-expanded loops
144
+ if (isInsidePendingLoopZone(el))
145
+ continue;
146
+ const tag = el.tagName.toLowerCase();
147
+ // Check if the parser marked this element as a component
148
+ // This is the authoritative source - it checks originalTagName starts with uppercase
149
+ // AND the tag name exists in importedIdentifiers
150
+ const pithyNode = nodeExpando(el).__pithyNode;
151
+ if (pithyNode) {
152
+ // Parser processed this element - use its isComponent flag
153
+ if (!pithyNode.isComponent) {
154
+ // DEV: Warn if there's a component that matches case-insensitively
155
+ // This helps developers catch typos like <button> when they meant <Button>
156
+ // Skip warning if we're inside a component's render (the component might
157
+ // legitimately use native elements like <button> in its implementation)
158
+ const isInsideComponentRender = !!pithyGlobals().__pithyRenderingComponent;
159
+ if (import.meta.env?.DEV && !isInsideComponentRender) {
160
+ const matchingComponent = tagMap.get(tag);
161
+ if (matchingComponent && typeof matchingComponent === 'function') {
162
+ // Find the actual component name from context
163
+ const componentName = Object.keys(rootCtx).find(k => k.toLowerCase() === tag && rootCtx[k] === matchingComponent);
164
+ const warnKey = `${componentName}:${pithyNode.originalTagName}`;
165
+ if (componentName &&
166
+ componentName !== pithyNode.originalTagName &&
167
+ !warnedComponentTags.has(warnKey)) {
168
+ warnedComponentTags.add(warnKey);
169
+ console.warn(`[PithyJS] ⚠️ Component '${componentName}' is imported but used as '<${pithyNode.originalTagName}>'. ` +
170
+ `Components must use PascalCase. Use '<${componentName}>' instead.`);
171
+ }
172
+ }
173
+ }
174
+ continue;
175
+ }
176
+ }
177
+ else {
178
+ // Fallback for elements not processed by our parser:
179
+ // Skip native HTML elements to prevent <button> matching Button component
180
+ if (nativeTags.has(tag))
181
+ continue;
182
+ }
183
+ let candidate = tagMap.get(tag);
184
+ if (!candidate)
185
+ continue;
186
+ // Support default exports
187
+ if (candidate &&
188
+ typeof candidate === 'object' &&
189
+ 'default' in candidate &&
190
+ typeof candidate.default === 'function') {
191
+ candidate = candidate.default;
192
+ }
193
+ if (typeof candidate !== 'function')
194
+ continue;
195
+ const componentFn = candidate;
196
+ const localCtx = nearestCtx(el, rootCtx); // crucial for item(), gIdx(), etc.
197
+ // Extract expected props for validation (DEV) and prop name normalization (always)
198
+ // This ensures case-insensitive matching works even when originalAttrs is unavailable
199
+ const expectedProps = extractExpectedPropNames(componentFn);
200
+ // Preserve originally-authored attribute names/casing from the parsed template
201
+ // (pithyNode already extracted above for isComponent check)
202
+ const originalAttrs = pithyNode?.originalAttrs;
203
+ const props = {};
204
+ // Evaluate attributes as expressions in localCtx
205
+ for (const attr of Array.from(el.attributes)) {
206
+ const name = attr.name;
207
+ const raw = attr.value;
208
+ // Skip internal/behavioral attributes
209
+ if (name.startsWith('data-'))
210
+ continue;
211
+ if (name === 'class' || name === 'style')
212
+ continue;
213
+ // Prefer originally-authored name (preserve casing), else DOM name
214
+ const authored = originalAttrs?.[name] ?? name;
215
+ const propName = normalizePropName(authored, expectedProps);
216
+ try {
217
+ const value = evalInCtx(raw, localCtx);
218
+ props[propName] = value; // only set when evaluation succeeds
219
+ }
220
+ catch (err) {
221
+ if (import.meta.env?.DEV) {
222
+ console.warn(`[PithyJS] ⚠️ Failed to evaluate prop "${propName}" = "${raw}"`, err);
223
+ }
224
+ // IMPORTANT: do NOT set a raw string fallback here.
225
+ // Leaving it undefined lets the child use defaults and avoids count()-on-string.
226
+ }
227
+ }
228
+ // Validate props for all components in DEV mode.
229
+ // Native elements are already filtered out earlier (line 197 for fallback, line 171 for parser).
230
+ if (import.meta.env?.DEV) {
231
+ const displayTag = pithyNode?.originalTagName || tag;
232
+ validateComponentProps(componentFn, props, displayTag);
233
+ }
234
+ // Collect content projection SlotMap from component children
235
+ const pithyChildren = pithyNode?.children || [];
236
+ const slotMap = collectSlotMap(pithyChildren, localCtx);
237
+ // Create enhanced context with SlotMap for content projection
238
+ const componentContext = {
239
+ ...localCtx,
240
+ __slotMap: slotMap,
241
+ __childAstNodes: pithyChildren,
242
+ };
243
+ // Find nearest error boundary for this component
244
+ const boundaryEl = el.closest('[data-error]');
245
+ const boundary = boundaryForElement(boundaryEl);
246
+ // Invoke component under boundary context; expect { el, destroy }
247
+ let out;
248
+ try {
249
+ out = runWithBoundary(boundary, () => {
250
+ // Store the enhanced context globally for the component's html() calls to access.
251
+ // This per-component context contains __slotMap for content projection.
252
+ //
253
+ // In SSR, there are TWO context sources that html() merges:
254
+ // 1. AsyncLocalStorage context (__getComponentContext) - request-level isolation
255
+ // 2. This global context (__pithyComponentContext) - per-component __slotMap
256
+ //
257
+ // Both are needed: AsyncLocalStorage provides request isolation, while this
258
+ // global provides the __slotMap that changes for each component render.
259
+ const g = pithyGlobals();
260
+ const originalContext = g.__pithyComponentContext;
261
+ const wasRendering = g.__pithyRenderingComponent;
262
+ g.__pithyComponentContext = componentContext;
263
+ // Mark that we're rendering a component to suppress casing warnings for
264
+ // native elements used in component implementations (e.g., <button> in Button)
265
+ g.__pithyRenderingComponent = true;
266
+ try {
267
+ const result = componentFn(props);
268
+ return result;
269
+ }
270
+ finally {
271
+ // Restore original context
272
+ g.__pithyComponentContext = originalContext;
273
+ g.__pithyRenderingComponent = wasRendering;
274
+ }
275
+ });
276
+ }
277
+ catch (err) {
278
+ // Route sync render errors to the nearest boundary with escalation
279
+ if (boundary) {
280
+ const error = err instanceof Error ? err : new Error(String(err));
281
+ setBoundaryError(boundary, error);
282
+ if (import.meta.env?.DEV) {
283
+ console.log(`[ErrorBoundary] Captured sync render error in <${tag}>:`, error.message);
284
+ }
285
+ continue;
286
+ }
287
+ else {
288
+ console.error(`❌ Component <${tag}> crashed during render:`, err);
289
+ continue;
290
+ }
291
+ }
292
+ if (!out || typeof out !== 'object' || !('el' in out)) {
293
+ console.warn(`❌ Invalid render result from <${tag}>. Expected { el, destroy }`);
294
+ continue;
295
+ }
296
+ const { el: renderedEl, destroy } = out;
297
+ // Capture class and directive attributes for forwarding to rendered root.
298
+ // Directive prefixes: data-on-* (events), data-bind-* (bound attrs like
299
+ // [aria-expanded]), data-class-toggle-* ([class.foo]), data-classes,
300
+ // data-style-* (inline style bindings).
301
+ const forwardedClass = el.getAttribute('class');
302
+ const directiveAttrs = [];
303
+ for (const attr of Array.from(el.attributes)) {
304
+ if (attr.name.startsWith('data-on-') ||
305
+ attr.name.startsWith('data-bind-') ||
306
+ attr.name.startsWith('data-class-toggle-') ||
307
+ attr.name === 'data-classes' ||
308
+ attr.name.startsWith('data-style-')) {
309
+ directiveAttrs.push([attr.name, attr.value]);
310
+ }
311
+ }
312
+ let forwardTarget = null;
313
+ const hasForwardables = !!(forwardedClass || directiveAttrs.length > 0);
314
+ if (hasForwardables) {
315
+ if (renderedEl instanceof DocumentFragment) {
316
+ forwardTarget = renderedEl.firstElementChild;
317
+ if (import.meta.env?.DEV && !forwardTarget) {
318
+ const displayTag = pithyNode?.originalTagName || tag;
319
+ console.warn(`[PithyJS] <${displayTag}> has class or directive attributes but returns a fragment with no element children — forwarding skipped.`);
320
+ }
321
+ }
322
+ else if (renderedEl instanceof HTMLElement) {
323
+ forwardTarget = renderedEl;
324
+ }
325
+ }
326
+ try {
327
+ if (renderedEl instanceof DocumentFragment) {
328
+ el.replaceWith(...Array.from(renderedEl.childNodes));
329
+ }
330
+ else {
331
+ el.replaceWith(renderedEl);
332
+ }
333
+ }
334
+ catch (err) {
335
+ console.error(`❌ Failed to replace <${tag}> with rendered DOM:`, err);
336
+ }
337
+ // Forward class from component tag onto the rendered root element
338
+ if (forwardedClass && forwardTarget) {
339
+ for (const cls of forwardedClass.split(/\s+/)) {
340
+ if (cls)
341
+ forwardTarget.classList.add(cls);
342
+ }
343
+ }
344
+ // Forward directive attributes so subsequent binders can attach them
345
+ if (directiveAttrs.length > 0 && forwardTarget) {
346
+ for (const [name, value] of directiveAttrs) {
347
+ forwardTarget.setAttribute(name, value);
348
+ }
349
+ }
350
+ if (typeof destroy === 'function') {
351
+ disposers.push(destroy);
352
+ }
353
+ }
354
+ }
355
+ //# sourceMappingURL=bindComponentsTags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindComponentsTags.js","sourceRoot":"","sources":["../../../src/compile/binds/bindComponentsTags.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OA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Y,WAAW,EAAE,CAAC;gBAC7C,aAAa,GAAG,UAAU,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,IAAI,CAAC;YACH,IAAI,UAAU,YAAY,gBAAgB,EAAE,CAAC;gBAC3C,EAAE,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,GAAG,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACxE,CAAC;QAED,kEAAkE;QAClE,IAAI,cAAc,IAAI,aAAa,EAAE,CAAC;YACpC,KAAK,MAAM,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9C,IAAI,GAAG;oBAAE,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,qEAAqE;QACrE,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,EAAE,CAAC;YAC/C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,cAAc,EAAE,CAAC;gBAC3C,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.directive.if",
4
+ "title": "@if conditional directive",
5
+ "category": "directive"
6
+ }
7
+ */
8
+ import { type PithyNode } from '@pithyjs/compiler';
9
+ /**
10
+ * Processes conditional directives (@if, @else-if, @else) in the template.
11
+ * Identifies conditional chains and delegates their handling to handleConditionalChain.
12
+ */
13
+ /** @codexApi {"parent":"pithy.directive.if","name":"bindConditionals","stability":"stable","signature":"(nodes: PithyNode[], rootEl: HTMLElement | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, disposers?: (() => void)[]) => Set<string>"} */
14
+ export declare function bindConditionals(nodes: PithyNode[], rootEl: HTMLElement | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, // Track already processed nodes
15
+ disposers?: (() => void)[]): Set<string>;
16
+ //# sourceMappingURL=bindConditionals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindConditionals.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindConditionals.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInE;;;GAGG;AACH,mRAAmR;AACnR,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,WAAW,GAAG,gBAAgB,EACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,gBAAgB,GAAE,GAAG,CAAC,MAAM,CAAa,EAAE,gCAAgC;AAC3E,SAAS,GAAE,CAAC,MAAM,IAAI,CAAC,EAAO,GAC7B,GAAG,CAAC,MAAM,CAAC,CA6Gb"}
@@ -0,0 +1,102 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.directive.if",
4
+ "title": "@if conditional directive",
5
+ "category": "directive"
6
+ }
7
+ */
8
+ import { collectIfChain } from '@pithyjs/compiler';
9
+ import { handleConditionalChain } from '../handleConditionalChain';
10
+ import { findAllNestedLoopNodes } from '../forLoops/loopTraversal';
11
+ /**
12
+ * Processes conditional directives (@if, @else-if, @else) in the template.
13
+ * Identifies conditional chains and delegates their handling to handleConditionalChain.
14
+ */
15
+ /** @codexApi {"parent":"pithy.directive.if","name":"bindConditionals","stability":"stable","signature":"(nodes: PithyNode[], rootEl: HTMLElement | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, disposers?: (() => void)[]) => Set<string>"} */
16
+ export function bindConditionals(nodes, rootEl, ctx, processedNodeIds = new Set(), // Track already processed nodes
17
+ disposers = [] // Collect disposers for cleanup
18
+ ) {
19
+ // Performance optimization: Create a Map of all elements by data-pid
20
+ // This makes element lookups O(1) instead of O(n) with querySelector
21
+ const elMap = new Map();
22
+ if (rootEl instanceof HTMLElement || rootEl instanceof DocumentFragment) {
23
+ const elements = rootEl.querySelectorAll('[data-pid]');
24
+ elements.forEach(el => {
25
+ const pid = el.getAttribute('data-pid');
26
+ if (pid) {
27
+ elMap.set(pid, el);
28
+ }
29
+ });
30
+ }
31
+ // Identify all conditional chains using shared utility from @pithyjs/compiler
32
+ const chains = [];
33
+ for (let i = 0; i < nodes.length; i++) {
34
+ const node = nodes[i];
35
+ if (node.type === 'element' && node.directives?.if !== undefined) {
36
+ const chain = collectIfChain(nodes, i);
37
+ chains.push({ chain, startIndex: i });
38
+ i += chain.length - 1; // Skip consumed siblings
39
+ }
40
+ }
41
+ // Process each chain and track processed nodes
42
+ chains.forEach(({ chain }) => {
43
+ chain.forEach(node => {
44
+ // Mark this node as processed
45
+ if (node.nodeId) {
46
+ processedNodeIds.add(node.nodeId);
47
+ }
48
+ // Also mark all loops inside this conditional as processed
49
+ // They will be bound by handleConditionalChain when the condition is true
50
+ const nestedLoops = findAllNestedLoopNodes(node);
51
+ for (const loopNode of nestedLoops) {
52
+ if (loopNode.nodeId) {
53
+ processedNodeIds.add(loopNode.nodeId);
54
+ }
55
+ }
56
+ });
57
+ // Find the DOM elements for this chain using our optimized Map
58
+ const domElements = chain
59
+ .map(node => {
60
+ if (!node.nodeId) {
61
+ return null;
62
+ }
63
+ // Use the Map for O(1) lookup instead of querySelector
64
+ const element = elMap.get(node.nodeId);
65
+ if (!element) {
66
+ return null;
67
+ }
68
+ return element;
69
+ })
70
+ .filter((el) => el !== null);
71
+ // Verify we found all DOM elements
72
+ if (domElements.length !== chain.length) {
73
+ return;
74
+ }
75
+ // Handle the chain and collect all processed node IDs
76
+ // Pass disposers array so effects can be properly cleaned up
77
+ handleConditionalChain(domElements, chain, ctx, processedNodeIds, disposers);
78
+ });
79
+ // Recursively process children of all nodes, skipping those already processed in chains
80
+ for (let i = 0; i < nodes.length; i++) {
81
+ const node = nodes[i];
82
+ // Skip nodes that were already processed as part of a conditional chain
83
+ if (node.nodeId && processedNodeIds.has(node.nodeId)) {
84
+ continue;
85
+ }
86
+ // Skip @for nodes - their children (including conditionals) will be processed
87
+ // by the loop manager's createLoopItem with the proper loop context (item, index, etc.)
88
+ if (node.directives?.for !== undefined) {
89
+ continue;
90
+ }
91
+ if (node.type === 'element' && node.children?.length) {
92
+ // Use the Map for O(1) lookup
93
+ const element = node.nodeId ? elMap.get(node.nodeId) : null;
94
+ if (element instanceof HTMLElement) {
95
+ // Pass the processedNodeIds Set and disposers to avoid duplicate processing
96
+ bindConditionals(node.children, element, ctx, processedNodeIds, disposers);
97
+ }
98
+ }
99
+ }
100
+ return processedNodeIds;
101
+ }
102
+ //# sourceMappingURL=bindConditionals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindConditionals.js","sourceRoot":"","sources":["../../../src/compile/binds/bindConditionals.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE;;;GAGG;AACH,mRAAmR;AACnR,MAAM,UAAU,gBAAgB,CAC9B,KAAkB,EAClB,MAAsC,EACtC,GAA4B,EAC5B,mBAAgC,IAAI,GAAG,EAAE,EAAE,gCAAgC;AAC3E,YAA4B,EAAE,CAAC,gCAAgC;;IAE/D,qEAAqE;IACrE,qEAAq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BAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACrD,SAAS;QACX,CAAC;QAED,8EAA8E;QAC9E,wFAAwF;QACxF,IAAI,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YACvC,SAAS;QACX,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;YACrD,8BAA8B;YAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAE5D,IAAI,OAAO,YAAY,WAAW,EAAE,CAAC;gBACnC,4EAA4E;gBAC5E,gBAAgB,CACd,IAAI,CAAC,QAAQ,EACb,OAAO,EACP,GAAG,EACH,gBAAgB,EAChB,SAAS,CACV,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.two-way-binding",
4
+ "title": "Two-Way Data Binding System",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * Establishes two-way data binding between HTML elements with `data-bind` attributes and writable signals.
10
+ *
11
+ * This function scans the provided fragment for elements with `data-bind` attributes and creates
12
+ * bidirectional synchronization between the DOM elements and their corresponding signals in the context.
13
+ *
14
+ * **How it works:**
15
+ * 1. Finds all elements with `data-bind` attributes within the fragment
16
+ * 2. For each element, retrieves the corresponding signal from the context using the attribute value
17
+ * 3. Sets up reactive updates: when the signal changes, the DOM element is updated
18
+ * 4. Sets up event listeners: when the user interacts with the element, the signal is updated
19
+ * 5. Automatically infers the appropriate property and event based on the element type
20
+ *
21
+ * **Supported elements:**
22
+ * - `<input>` elements: binds to `value` property (or `checked` for checkboxes/radio buttons)
23
+ * - `<textarea>` elements: binds to `value` property
24
+ * - `<select>` elements: binds to `value` property
25
+ * - Other elements: falls back to `value` property
26
+ *
27
+ * @param fragment - The DOM fragment or element to search for bindable elements
28
+ * @param context - Object containing the signals referenced by `data-bind` attributes
29
+ * @param disposers - Array to collect cleanup functions for proper resource disposal
30
+ *
31
+ * @throws Will log warnings for elements that are not HTMLElements or signals that are not writable
32
+ */
33
+ /** @codexApi {"parent":"pithy.runtime.two-way-binding","name":"bindDefaultTwoWay","stability":"stable","signature":"(fragment: Element | DocumentFragment, context: Record<string, unknown>, disposers: (() => void)[]) => void"} */
34
+ export declare function bindDefaultTwoWay(fragment: Element | DocumentFragment, context: Record<string, unknown>, disposers: (() => void)[]): void;
35
+ //# sourceMappingURL=bindDefaultTwoWay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindDefaultTwoWay.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindDefaultTwoWay.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,qOAAqO;AACrO,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,gBAAgB,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAuDN"}