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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +37 -6
  2. package/dist/a11y/focus-trap.d.ts.map +1 -1
  3. package/dist/a11y/focus-trap.js +2 -0
  4. package/dist/a11y/focus-trap.js.map +1 -1
  5. package/dist/a11y/index.d.ts +4 -4
  6. package/dist/a11y/index.js +4 -4
  7. package/dist/a11y/index.js.map +1 -1
  8. package/dist/a11y/keyboard-utils.js.map +1 -1
  9. package/dist/a11y/roving-tabindex.js.map +1 -1
  10. package/dist/a11y/skip-link.js.map +1 -1
  11. package/dist/compile/bindSwitchCases.d.ts +8 -3
  12. package/dist/compile/bindSwitchCases.d.ts.map +1 -1
  13. package/dist/compile/bindSwitchCases.js +113 -177
  14. package/dist/compile/bindSwitchCases.js.map +1 -1
  15. package/dist/compile/binds/bindBoundAttributes.d.ts +1 -0
  16. package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
  17. package/dist/compile/binds/bindBoundAttributes.js +24 -2
  18. package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
  19. package/dist/compile/binds/bindClassDirectives.d.ts +3 -0
  20. package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
  21. package/dist/compile/binds/bindClassDirectives.js +59 -21
  22. package/dist/compile/binds/bindClassDirectives.js.map +1 -1
  23. package/dist/compile/binds/bindComponentsTags.d.ts +2 -0
  24. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
  25. package/dist/compile/binds/bindComponentsTags.js +171 -74
  26. package/dist/compile/binds/bindComponentsTags.js.map +1 -1
  27. package/dist/compile/binds/bindConditionals.d.ts +2 -2
  28. package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
  29. package/dist/compile/binds/bindConditionals.js +22 -5
  30. package/dist/compile/binds/bindConditionals.js.map +1 -1
  31. package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
  32. package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
  33. package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
  34. package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
  35. package/dist/compile/binds/bindDeferDirectives.js +45 -15
  36. package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
  37. package/dist/compile/binds/bindErrorBoundary.d.ts +13 -2
  38. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
  39. package/dist/compile/binds/bindErrorBoundary.js +25 -10
  40. package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
  41. package/dist/compile/binds/bindEventHandlers.js +2 -2
  42. package/dist/compile/binds/bindEventHandlers.js.map +1 -1
  43. package/dist/compile/binds/bindRefDirectives.js.map +1 -1
  44. package/dist/compile/binds/bindStyleDirectives.d.ts +17 -0
  45. package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -0
  46. package/dist/compile/binds/bindStyleDirectives.js +47 -0
  47. package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
  48. package/dist/compile/binds/bindTextInterpolations.d.ts +2 -1
  49. package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
  50. package/dist/compile/binds/bindTextInterpolations.js +55 -17
  51. package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
  52. package/dist/compile/binds/directiveRegistry.js.map +1 -1
  53. package/dist/compile/binds/forwardedAttrs.d.ts +22 -0
  54. package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -0
  55. package/dist/compile/binds/forwardedAttrs.js +66 -0
  56. package/dist/compile/binds/forwardedAttrs.js.map +1 -0
  57. package/dist/compile/binds/propNames.d.ts +14 -0
  58. package/dist/compile/binds/propNames.d.ts.map +1 -0
  59. package/dist/compile/binds/propNames.js +116 -0
  60. package/dist/compile/binds/propNames.js.map +1 -0
  61. package/dist/compile/compileExpression.js.map +1 -1
  62. package/dist/compile/compileNodes.d.ts.map +1 -1
  63. package/dist/compile/compileNodes.js +6 -3
  64. package/dist/compile/compileNodes.js.map +1 -1
  65. package/dist/compile/compileTemplate.d.ts +3 -4
  66. package/dist/compile/compileTemplate.d.ts.map +1 -1
  67. package/dist/compile/compileTemplate.js +28 -31
  68. package/dist/compile/compileTemplate.js.map +1 -1
  69. package/dist/compile/componentResult.d.ts +100 -0
  70. package/dist/compile/componentResult.d.ts.map +1 -0
  71. package/dist/compile/componentResult.js +138 -0
  72. package/dist/compile/componentResult.js.map +1 -0
  73. package/dist/compile/contentProjection.d.ts +1 -1
  74. package/dist/compile/contentProjection.d.ts.map +1 -1
  75. package/dist/compile/contentProjection.js +32 -15
  76. package/dist/compile/contentProjection.js.map +1 -1
  77. package/dist/compile/forLoops/bindForLoops.d.ts +2 -2
  78. package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
  79. package/dist/compile/forLoops/bindForLoops.js +9 -22
  80. package/dist/compile/forLoops/bindForLoops.js.map +1 -1
  81. package/dist/compile/forLoops/createLoopManager.d.ts +6 -3
  82. package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
  83. package/dist/compile/forLoops/createLoopManager.js +144 -114
  84. package/dist/compile/forLoops/createLoopManager.js.map +1 -1
  85. package/dist/compile/forLoops/index.d.ts +5 -5
  86. package/dist/compile/forLoops/index.js +5 -5
  87. package/dist/compile/forLoops/index.js.map +1 -1
  88. package/dist/compile/forLoops/loopHelpers.d.ts +6 -0
  89. package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -1
  90. package/dist/compile/forLoops/loopHelpers.js +17 -0
  91. package/dist/compile/forLoops/loopHelpers.js.map +1 -1
  92. package/dist/compile/forLoops/loopSignals.js +2 -2
  93. package/dist/compile/forLoops/loopSignals.js.map +1 -1
  94. package/dist/compile/forLoops/loopTraversal.js +2 -2
  95. package/dist/compile/forLoops/loopTraversal.js.map +1 -1
  96. package/dist/compile/handleConditionalChain.d.ts +2 -2
  97. package/dist/compile/handleConditionalChain.d.ts.map +1 -1
  98. package/dist/compile/handleConditionalChain.js +21 -83
  99. package/dist/compile/handleConditionalChain.js.map +1 -1
  100. package/dist/compile/index.d.ts +17 -14
  101. package/dist/compile/index.d.ts.map +1 -1
  102. package/dist/compile/index.js +28 -12
  103. package/dist/compile/index.js.map +1 -1
  104. package/dist/compile/injectScopedStyle.js.map +1 -1
  105. package/dist/compile/nodeExpando.d.ts +6 -0
  106. package/dist/compile/nodeExpando.d.ts.map +1 -1
  107. package/dist/compile/nodeExpando.js.map +1 -1
  108. package/dist/compile/parseHtml.d.ts.map +1 -1
  109. package/dist/compile/parseHtml.js +2 -2
  110. package/dist/compile/parseHtml.js.map +1 -1
  111. package/dist/compile/pithyTreeToDom.js +1 -1
  112. package/dist/compile/pithyTreeToDom.js.map +1 -1
  113. package/dist/compile/renderBranch.d.ts +13 -0
  114. package/dist/compile/renderBranch.d.ts.map +1 -0
  115. package/dist/compile/renderBranch.js +65 -0
  116. package/dist/compile/renderBranch.js.map +1 -0
  117. package/dist/compile/renderChildren.d.ts +17 -0
  118. package/dist/compile/renderChildren.d.ts.map +1 -1
  119. package/dist/compile/renderChildren.js +22 -3
  120. package/dist/compile/renderChildren.js.map +1 -1
  121. package/dist/compile/ssrCrashes.d.ts +116 -0
  122. package/dist/compile/ssrCrashes.d.ts.map +1 -0
  123. package/dist/compile/ssrCrashes.js +173 -0
  124. package/dist/compile/ssrCrashes.js.map +1 -0
  125. package/dist/compile/ssrMode.js +1 -1
  126. package/dist/compile/ssrMode.js.map +1 -1
  127. package/dist/compile/textValue.js.map +1 -1
  128. package/dist/compile/trimBlankEdges.d.ts +2 -0
  129. package/dist/compile/trimBlankEdges.d.ts.map +1 -0
  130. package/dist/compile/trimBlankEdges.js +15 -0
  131. package/dist/compile/trimBlankEdges.js.map +1 -0
  132. package/dist/config/index.js.map +1 -1
  133. package/dist/index.d.ts +6 -6
  134. package/dist/index.js +6 -6
  135. package/dist/index.js.map +1 -1
  136. package/dist/interfaces/index.d.ts +2 -2
  137. package/dist/interfaces/index.js +2 -2
  138. package/dist/interfaces/index.js.map +1 -1
  139. package/dist/interfaces/ref-signal.interface.js.map +1 -1
  140. package/dist/interfaces/ref.interface.js.map +1 -1
  141. package/dist/runtime/applyBindings.d.ts +5 -5
  142. package/dist/runtime/applyBindings.d.ts.map +1 -1
  143. package/dist/runtime/applyBindings.js +97 -21
  144. package/dist/runtime/applyBindings.js.map +1 -1
  145. package/dist/runtime/bindings/applyComponent.d.ts +2 -2
  146. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
  147. package/dist/runtime/bindings/applyComponent.js +137 -39
  148. package/dist/runtime/bindings/applyComponent.js.map +1 -1
  149. package/dist/runtime/bindings/applyDefer.d.ts +1 -1
  150. package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
  151. package/dist/runtime/bindings/applyDefer.js +46 -18
  152. package/dist/runtime/bindings/applyDefer.js.map +1 -1
  153. package/dist/runtime/bindings/applySimple.d.ts +2 -1
  154. package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
  155. package/dist/runtime/bindings/applySimple.js +70 -14
  156. package/dist/runtime/bindings/applySimple.js.map +1 -1
  157. package/dist/runtime/bindings/applyStructural.d.ts +1 -1
  158. package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
  159. package/dist/runtime/bindings/applyStructural.js +58 -68
  160. package/dist/runtime/bindings/applyStructural.js.map +1 -1
  161. package/dist/runtime/bindings/helpers.d.ts +1 -1
  162. package/dist/runtime/bindings/helpers.js +1 -1
  163. package/dist/runtime/bindings/helpers.js.map +1 -1
  164. package/dist/runtime/bindings/index.d.ts +6 -6
  165. package/dist/runtime/bindings/index.d.ts.map +1 -1
  166. package/dist/runtime/bindings/index.js +5 -5
  167. package/dist/runtime/bindings/index.js.map +1 -1
  168. package/dist/runtime/bindings/types.d.ts +12 -1
  169. package/dist/runtime/bindings/types.d.ts.map +1 -1
  170. package/dist/runtime/bindings/types.js.map +1 -1
  171. package/dist/runtime/bootstrap.d.ts +1 -1
  172. package/dist/runtime/bootstrap.js +1 -1
  173. package/dist/runtime/bootstrap.js.map +1 -1
  174. package/dist/runtime/createContextProxy.js.map +1 -1
  175. package/dist/runtime/deferHelpers.d.ts +1 -1
  176. package/dist/runtime/deferHelpers.js.map +1 -1
  177. package/dist/runtime/html.d.ts.map +1 -1
  178. package/dist/runtime/html.js +6 -5
  179. package/dist/runtime/html.js.map +1 -1
  180. package/dist/runtime/index.d.ts +6 -5
  181. package/dist/runtime/index.d.ts.map +1 -1
  182. package/dist/runtime/index.js +7 -5
  183. package/dist/runtime/index.js.map +1 -1
  184. package/dist/runtime/lazy.js +1 -1
  185. package/dist/runtime/lazy.js.map +1 -1
  186. package/dist/runtime/module-cache.js.map +1 -1
  187. package/dist/runtime/onDestroy.d.ts +7 -0
  188. package/dist/runtime/onDestroy.d.ts.map +1 -1
  189. package/dist/runtime/onDestroy.js +16 -1
  190. package/dist/runtime/onDestroy.js.map +1 -1
  191. package/dist/runtime/parseIdentifiersFromTemplate.js +1 -1
  192. package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -1
  193. package/dist/runtime/resource/createAction.d.ts +44 -0
  194. package/dist/runtime/resource/createAction.d.ts.map +1 -0
  195. package/dist/runtime/resource/createAction.js +102 -0
  196. package/dist/runtime/resource/createAction.js.map +1 -0
  197. package/dist/runtime/resource/createResource.d.ts +56 -0
  198. package/dist/runtime/resource/createResource.d.ts.map +1 -0
  199. package/dist/runtime/resource/createResource.js +102 -0
  200. package/dist/runtime/resource/createResource.js.map +1 -0
  201. package/dist/runtime/resource/engine.d.ts +136 -0
  202. package/dist/runtime/resource/engine.d.ts.map +1 -0
  203. package/dist/runtime/resource/engine.js +363 -0
  204. package/dist/runtime/resource/engine.js.map +1 -0
  205. package/dist/runtime/resource/index.d.ts +19 -0
  206. package/dist/runtime/resource/index.d.ts.map +1 -0
  207. package/dist/runtime/resource/index.js +18 -0
  208. package/dist/runtime/resource/index.js.map +1 -0
  209. package/dist/runtime/resource/types.d.ts +240 -0
  210. package/dist/runtime/resource/types.d.ts.map +1 -0
  211. package/dist/runtime/resource/types.js +9 -0
  212. package/dist/runtime/resource/types.js.map +1 -0
  213. package/dist/types/globals.d.ts +10 -1
  214. package/dist/types/globals.d.ts.map +1 -1
  215. package/dist/types/globals.js.map +1 -1
  216. package/dist/types/index.d.ts +15 -1
  217. package/dist/types/index.d.ts.map +1 -1
  218. package/dist/types/index.js.map +1 -1
  219. package/dist/utilities/index.d.ts +2 -2
  220. package/dist/utilities/index.js +2 -2
  221. package/dist/utilities/index.js.map +1 -1
  222. package/dist/utilities/ref-signal.utility.d.ts +1 -1
  223. package/dist/utilities/ref-signal.utility.js.map +1 -1
  224. package/dist/utilities/ref.untility.d.ts +1 -1
  225. package/dist/utilities/ref.untility.js.map +1 -1
  226. package/package.json +14 -9
@@ -1,6 +1,9 @@
1
- import { effect } from '@pithyjs/signals';
2
- import { compileExpression } from '../../compile/compileExpression';
3
- import { isSSRMode } from '../../compile/ssrMode';
1
+ import { createRoot, effect } from '@pithyjs/signals';
2
+ import { compileExpression } from '../../compile/compileExpression.js';
3
+ import { isSSRMode } from '../../compile/ssrMode.js';
4
+ import { createLoopManager } from '../../compile/forLoops/createLoopManager.js';
5
+ import { compileTrackBy } from '../../compile/forLoops/loopHelpers.js';
6
+ import { createLoopContext, createLoopSignals, } from '../../compile/forLoops/loopSignals.js';
4
7
  // ─── Structural directive handlers ────────────────────────────────────────────
5
8
  export function applyIf(d, commentMap, ctx, disposers) {
6
9
  const anchor = commentMap.get(`if:${d.pid}`);
@@ -84,7 +87,11 @@ export function applyIf(d, commentMap, ctx, disposers) {
84
87
  clearCurrent();
85
88
  if (matchIndex >= 0) {
86
89
  try {
87
- const result = d.branches[matchIndex].factory(ctx);
90
+ const { factory } = d.branches[matchIndex];
91
+ const result = createRoot(disposeRoot => {
92
+ currentDisposers.push(disposeRoot);
93
+ return factory(ctx);
94
+ });
88
95
  if (result?.el) {
89
96
  const nodes = result.el instanceof DocumentFragment
90
97
  ? Array.from(result.el.childNodes)
@@ -98,6 +105,8 @@ export function applyIf(d, commentMap, ctx, disposers) {
98
105
  currentNodes = nodes;
99
106
  if (typeof result.destroy === 'function')
100
107
  currentDisposers.push(result.destroy);
108
+ else if (import.meta.env?.DEV)
109
+ console.warn('[AOT @if] branch factory returned no destroy(); effects its nested directives create will outlive the branch');
101
110
  }
102
111
  }
103
112
  catch (err) {
@@ -113,21 +122,6 @@ export function applyFor(d, commentMap, ctx, disposers) {
113
122
  const anchor = commentMap.get(`for:${d.pid}`);
114
123
  if (!anchor)
115
124
  return;
116
- if (import.meta.env?.DEV && d.trackBy) {
117
- console.warn(`[AOT @for] trackBy="${d.trackBy}" is not yet implemented — falling back to full re-render`);
118
- }
119
- // Track rendered items
120
- let itemEntries = [];
121
- function clearAll() {
122
- for (const entry of itemEntries) {
123
- entry.destroy();
124
- for (const node of entry.nodes) {
125
- if (node.parentNode)
126
- node.parentNode.removeChild(node);
127
- }
128
- }
129
- itemEntries = [];
130
- }
131
125
  if (isSSRMode()) {
132
126
  const collFn = compileExpression(d.expr, ctx, []);
133
127
  const collection = collFn() ?? [];
@@ -156,57 +150,39 @@ export function applyFor(d, commentMap, ctx, disposers) {
156
150
  }
157
151
  return;
158
152
  }
159
- // Pre-compile collection expression once outside effect
160
153
  const collFn = compileExpression(d.expr, ctx, []);
154
+ const loopManager = createLoopManager({
155
+ anchor,
156
+ trackByFn: compileTrackBy(d.trackBy, d.item, d.index, ctx),
157
+ parentCtx: ctx,
158
+ itemVar: d.item,
159
+ indexVar: d.index,
160
+ itemFactory: itemCtx => {
161
+ const result = d.factory(itemCtx);
162
+ const el = document.createDocumentFragment();
163
+ if (result?.el)
164
+ el.append(result.el);
165
+ return { el, destroy: result?.destroy ?? (() => { }) };
166
+ },
167
+ });
161
168
  const stopEffect = effect(() => {
162
- const collection = collFn() ?? [];
163
- clearAll();
164
- const parent = anchor.parentNode;
165
- if (!parent)
166
- return;
167
- const insertBefore = anchor.nextSibling;
168
- for (let i = 0; i < collection.length; i++) {
169
- const itemCtx = buildItemContext(ctx, d, collection[i], i, collection.length);
170
- try {
171
- const result = d.factory(itemCtx);
172
- if (!result?.el)
173
- continue;
174
- const nodes = result.el instanceof DocumentFragment
175
- ? Array.from(result.el.childNodes)
176
- : [result.el];
177
- // Set __pithyCtx on root elements for nearestCtx resolution
178
- for (const node of nodes) {
179
- if (node instanceof Element)
180
- node.__pithyCtx =
181
- itemCtx;
182
- parent.insertBefore(node, insertBefore);
183
- }
184
- const destroy = typeof result.destroy === 'function' ? result.destroy : () => { };
185
- itemEntries.push({ nodes, destroy });
186
- }
187
- catch (err) {
188
- if (import.meta.env?.DEV)
189
- console.error(`[AOT @for] Factory error at index ${i}:`, err);
190
- }
169
+ try {
170
+ const collection = collFn();
171
+ if (!Array.isArray(collection) && import.meta.env?.DEV)
172
+ console.warn('[AOT @for] collection is not an array:', collection);
173
+ loopManager.update(Array.isArray(collection) ? collection : []);
174
+ }
175
+ catch (err) {
176
+ if (import.meta.env?.DEV)
177
+ console.error('[AOT @for] update failed:', err);
178
+ loopManager.update([]);
191
179
  }
192
180
  });
193
- disposers.push(clearAll);
181
+ disposers.push(() => loopManager.destroyAll());
194
182
  disposers.push(stopEffect);
195
183
  }
196
184
  function buildItemContext(parentCtx, d, item, index, length) {
197
- const itemCtx = { ...parentCtx };
198
- // Expose item as a getter function (signal-like API)
199
- itemCtx[d.item] = () => item;
200
- if (d.index)
201
- itemCtx[d.index] = () => index;
202
- // Standard loop metadata
203
- itemCtx.$index = () => index;
204
- itemCtx.$count = () => length;
205
- itemCtx.$first = () => index === 0;
206
- itemCtx.$last = () => index === length - 1;
207
- itemCtx.$even = () => index % 2 === 0;
208
- itemCtx.$odd = () => index % 2 !== 0;
209
- return itemCtx;
185
+ return createLoopContext(parentCtx, createLoopSignals(item, index, length), d.item, d.index);
210
186
  }
211
187
  export function applySwitch(d, pidMap, ctx, disposers) {
212
188
  const containerEl = pidMap.get(d.pid);
@@ -233,11 +209,13 @@ export function applySwitch(d, pidMap, ctx, disposers) {
233
209
  if (isSSRMode()) {
234
210
  const switchVal = compileExpression(d.expr, ctx)();
235
211
  let matchIndex = -1;
212
+ let defaultIndex = -1;
236
213
  for (let i = 0; i < d.cases.length; i++) {
237
214
  const c = d.cases[i];
238
215
  if (c.val === undefined) {
239
- matchIndex = i;
240
- break;
216
+ if (defaultIndex === -1)
217
+ defaultIndex = i;
218
+ continue;
241
219
  }
242
220
  const caseVal = compileExpression(c.val, ctx)();
243
221
  if (caseVal === switchVal) {
@@ -245,6 +223,8 @@ export function applySwitch(d, pidMap, ctx, disposers) {
245
223
  break;
246
224
  }
247
225
  }
226
+ if (matchIndex === -1)
227
+ matchIndex = defaultIndex;
248
228
  if (matchIndex >= 0) {
249
229
  try {
250
230
  const result = d.cases[matchIndex].factory(ctx);
@@ -272,23 +252,31 @@ export function applySwitch(d, pidMap, ctx, disposers) {
272
252
  const stopEffect = effect(() => {
273
253
  const switchVal = switchEval();
274
254
  let matchIndex = -1;
255
+ let defaultIndex = -1;
275
256
  for (let i = 0; i < d.cases.length; i++) {
276
257
  if (caseEvals[i] === null) {
277
- matchIndex = i;
278
- break;
258
+ if (defaultIndex === -1)
259
+ defaultIndex = i;
260
+ continue;
279
261
  }
280
262
  if (caseEvals[i]() === switchVal) {
281
263
  matchIndex = i;
282
264
  break;
283
265
  }
284
266
  }
267
+ if (matchIndex === -1)
268
+ matchIndex = defaultIndex;
285
269
  if (matchIndex === previousMatchIndex)
286
270
  return;
287
271
  previousMatchIndex = matchIndex;
288
272
  clearCurrent();
289
273
  if (matchIndex >= 0) {
290
274
  try {
291
- const result = d.cases[matchIndex].factory(ctx);
275
+ const { factory } = d.cases[matchIndex];
276
+ const result = createRoot(disposeRoot => {
277
+ currentDisposers.push(disposeRoot);
278
+ return factory(ctx);
279
+ });
292
280
  if (result?.el) {
293
281
  const nodes = result.el instanceof DocumentFragment
294
282
  ? Array.from(result.el.childNodes)
@@ -298,6 +286,8 @@ export function applySwitch(d, pidMap, ctx, disposers) {
298
286
  currentNodes = nodes;
299
287
  if (typeof result.destroy === 'function')
300
288
  currentDisposers.push(result.destroy);
289
+ else if (import.meta.env?.DEV)
290
+ console.warn('[AOT @switch] branch factory returned no destroy(); effects its nested directives create will outlive the branch');
301
291
  }
302
292
  }
303
293
  catch (err) {
@@ -1 +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,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;QACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EA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AAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import { createRoot, effect } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { createLoopManager } from '../../compile/forLoops/createLoopManager';\nimport { compileTrackBy } from '../../compile/forLoops/loopHelpers';\nimport {\n createLoopContext,\n createLoopSignals,\n} from '../../compile/forLoops/loopSignals';\nimport type { IfDesc, ForDesc, SwitchDesc, BindingContext } from './types';\n\n// ─── Structural directive handlers ────────────────────────────────────────────\n\nexport function applyIf(\n d: IfDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`if:${d.pid}`);\n if (!anchor) return;\n\n let currentNodes: Node[] = [];\n let currentDisposers: (() => void)[] = [];\n\n function clearCurrent() {\n for (const fn of currentDisposers) {\n try {\n fn();\n } catch {\n /* ignore */\n }\n }\n currentDisposers = [];\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n currentNodes = [];\n }\n\n if (isSSRMode()) {\n // SSR: evaluate once synchronously\n let matchIndex = -1;\n for (let i = 0; i < d.branches.length; i++) {\n const b = d.branches[i];\n if (b.expr === undefined) {\n matchIndex = i;\n break;\n }\n const fn = compileExpression(b.expr, ctx, false);\n if (fn()) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex >= 0) {\n try {\n const result = d.branches[matchIndex].factory(ctx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n const parent = anchor.parentNode;\n if (parent) {\n const insertRef = anchor.nextSibling;\n for (const node of nodes) parent.insertBefore(node, insertRef);\n }\n if (typeof result.destroy === 'function')\n disposers.push(result.destroy);\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @if] Factory error:`, err);\n }\n }\n return;\n }\n\n // Pre-compile branch expressions once outside effect\n const branchEvaluators = d.branches.map(b =>\n b.expr !== undefined ? compileExpression(b.expr, ctx, false) : null\n );\n\n let previousMatchIndex = -1;\n\n const stopEffect = effect(() => {\n let matchIndex = -1;\n for (let i = 0; i < d.branches.length; i++) {\n if (branchEvaluators[i] === null) {\n matchIndex = i;\n break;\n }\n if (branchEvaluators[i]!()) {\n matchIndex = i;\n break;\n }\n }\n\n if (matchIndex === previousMatchIndex) return;\n previousMatchIndex = matchIndex;\n\n clearCurrent();\n\n if (matchIndex >= 0) {\n try {\n const { factory } = d.branches[matchIndex];\n const result = createRoot(disposeRoot => {\n currentDisposers.push(disposeRoot);\n return factory(ctx);\n });\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n const parent = anchor.parentNode;\n if (parent) {\n const insertRef = anchor.nextSibling;\n for (const node of nodes) parent.insertBefore(node, insertRef);\n }\n currentNodes = nodes;\n if (typeof result.destroy === 'function')\n currentDisposers.push(result.destroy);\n else if (import.meta.env?.DEV)\n console.warn(\n '[AOT @if] branch factory returned no destroy(); effects its nested directives create will outlive the branch'\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @if] Factory error:`, err);\n }\n }\n });\n\n disposers.push(clearCurrent);\n disposers.push(stopEffect);\n}\n\nexport function applyFor(\n d: ForDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`for:${d.pid}`);\n if (!anchor) return;\n\n if (isSSRMode()) {\n const collFn = compileExpression<unknown[]>(d.expr, ctx, []);\n const collection = collFn() ?? [];\n const parent = anchor.parentNode;\n if (!parent) return;\n\n const insertBefore: Node | null = anchor.nextSibling;\n for (let i = 0; i < collection.length; i++) {\n const itemCtx = buildItemContext(\n ctx,\n d,\n collection[i],\n i,\n collection.length\n );\n try {\n const result = d.factory(itemCtx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n if (typeof result.destroy === 'function')\n disposers.push(result.destroy);\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @for] Factory error at index ${i}:`, err);\n }\n }\n return;\n }\n\n const collFn = compileExpression<unknown[]>(d.expr, ctx, []);\n const loopManager = createLoopManager({\n anchor,\n trackByFn: compileTrackBy(d.trackBy, d.item, d.index, ctx),\n parentCtx: ctx,\n itemVar: d.item,\n indexVar: d.index,\n itemFactory: itemCtx => {\n const result = d.factory(itemCtx);\n const el = document.createDocumentFragment();\n if (result?.el) el.append(result.el);\n return { el, destroy: result?.destroy ?? (() => {}) };\n },\n });\n\n const stopEffect = effect(() => {\n try {\n const collection = collFn();\n if (!Array.isArray(collection) && import.meta.env?.DEV)\n console.warn('[AOT @for] collection is not an array:', collection);\n loopManager.update(Array.isArray(collection) ? collection : []);\n } catch (err) {\n if (import.meta.env?.DEV) console.error('[AOT @for] update failed:', err);\n loopManager.update([]);\n }\n });\n\n disposers.push(() => loopManager.destroyAll());\n disposers.push(stopEffect);\n}\n\nfunction buildItemContext(\n parentCtx: BindingContext,\n d: ForDesc,\n item: unknown,\n index: number,\n length: number\n): BindingContext {\n return createLoopContext(\n parentCtx,\n createLoopSignals(item, index, length),\n d.item,\n d.index\n );\n}\n\nexport function applySwitch(\n d: SwitchDesc,\n pidMap: Map<string, Element>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const containerEl = pidMap.get(d.pid);\n if (!containerEl) return;\n\n let currentNodes: Node[] = [];\n let currentDisposers: (() => void)[] = [];\n\n function clearCurrent() {\n for (const fn of currentDisposers) {\n try {\n fn();\n } catch {\n /* ignore */\n }\n }\n currentDisposers = [];\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n currentNodes = [];\n }\n\n if (isSSRMode()) {\n const switchVal = compileExpression(d.expr, ctx)();\n let matchIndex = -1;\n let defaultIndex = -1;\n for (let i = 0; i < d.cases.length; i++) {\n const c = d.cases[i];\n if (c.val === undefined) {\n if (defaultIndex === -1) defaultIndex = i;\n continue;\n }\n const caseVal = compileExpression(c.val, ctx)();\n if (caseVal === switchVal) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex === -1) matchIndex = defaultIndex;\n if (matchIndex >= 0) {\n try {\n const result = d.cases[matchIndex].factory(ctx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) containerEl.appendChild(node);\n if (typeof result.destroy === 'function')\n disposers.push(result.destroy);\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @switch] Factory error:`, err);\n }\n }\n return;\n }\n\n // Pre-compile switch expression and case values once outside effect\n const switchEval = compileExpression(d.expr, ctx);\n const caseEvals = d.cases.map(c =>\n c.val !== undefined ? compileExpression(c.val, ctx) : null\n );\n\n let previousMatchIndex = -1;\n\n const stopEffect = effect(() => {\n const switchVal = switchEval();\n let matchIndex = -1;\n let defaultIndex = -1;\n for (let i = 0; i < d.cases.length; i++) {\n if (caseEvals[i] === null) {\n if (defaultIndex === -1) defaultIndex = i;\n continue;\n }\n if (caseEvals[i]!() === switchVal) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex === -1) matchIndex = defaultIndex;\n\n if (matchIndex === previousMatchIndex) return;\n previousMatchIndex = matchIndex;\n\n clearCurrent();\n\n if (matchIndex >= 0) {\n try {\n const { factory } = d.cases[matchIndex];\n const result = createRoot(disposeRoot => {\n currentDisposers.push(disposeRoot);\n return factory(ctx);\n });\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) containerEl.appendChild(node);\n currentNodes = nodes;\n if (typeof result.destroy === 'function')\n currentDisposers.push(result.destroy);\n else if (import.meta.env?.DEV)\n console.warn(\n '[AOT @switch] branch factory returned no destroy(); effects its nested directives create will outlive the branch'\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @switch] Factory error:`, err);\n }\n }\n });\n\n disposers.push(clearCurrent);\n disposers.push(stopEffect);\n}\n"]}
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @module runtime/bindings/helpers
15
15
  */
16
- import type { BindingContext } from './types';
16
+ import type { BindingContext } from './types.js';
17
17
  /**
18
18
  * Build a map of pid → Element from data-pid attributes in the fragment.
19
19
  * @param fragment - The DOM fragment to scan
@@ -5,7 +5,7 @@
5
5
  "category": "runtime"
6
6
  }
7
7
  */
8
- import { pithyGlobals } from '../../types/globals';
8
+ import { pithyGlobals } from '../../types/globals.js';
9
9
  // ─── Helpers ──────────────────────────────────────────────────────────────────
10
10
  /**
11
11
  * Build a map of pid → Element from data-pid attributes in the fragment.
@@ -1 +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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I,CAAC;gBACpB,OAAO,sBAAsB,CAAC,GAAG,CAAC,KAAK,UAAU,EACjD,CAAC;gBACD,UAAU,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,UAAU,GAAG,SAAS,CAAC;IACnE,CAAC;IAED,IAAI,YAAY,IAAI,UAAU,EAAE,CAAC;QAC/B,OAAO,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,qMAAqM;AACrM,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,GAAmB;IAEnB,IAAI,CAAC;QACH,8GAA8G;QAC9G,MAAM,EAAE,GAAG,IAAI,QAAQ,CACrB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,wBAAwB,IAAI,MAAM,CACyB,CAAC;QAC9D,OAAO,CAAC,EAAS,EAAE,EAAW,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,sCAAsC,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,CAAC,GAAU,EAAE,GAAY,EAAE,EAAE,CAAC,SAAS,CAAC;IACjD,CAAC;AACH,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.binding-helpers\",\n \"title\": \"AOT Binding Helpers\",\n \"category\": \"runtime\"\n}\n*/\n\n/**\n * Shared helper utilities for AOT binding application.\n *\n * Provides DOM lookup maps, context merging, and expression compilation\n * used by both the JIT path (`html.ts`) and the AOT path (`applyBindings.ts`).\n *\n * @module runtime/bindings/helpers\n */\n\nimport type { BindingContext } from './types';\nimport { pithyGlobals } from '../../types/globals';\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\n/**\n * Build a map of pid → Element from data-pid attributes in the fragment.\n * @param fragment - The DOM fragment to scan\n * @returns Map from pid string to the corresponding Element\n */\n/** @codexApi {\"parent\":\"pithy.runtime.binding-helpers\",\"name\":\"buildPidMap\",\"stability\":\"internal\",\"signature\":\"(fragment: DocumentFragment) => Map<string, Element>\"} */\nexport function buildPidMap(fragment: DocumentFragment): Map<string, Element> {\n const map = new Map<string, Element>();\n const walker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT);\n let node: Element | null;\n while ((node = walker.nextNode() as Element | null)) {\n const pid = node.getAttribute('data-pid');\n if (pid) map.set(pid, node);\n }\n return map;\n}\n\n/**\n * Build a map of comment anchor id → Comment for structural directives.\n * @param fragment - The DOM fragment to scan\n * @returns Map from comment text (e.g. \"if:r0\") to the Comment node\n */\n/** @codexApi {\"parent\":\"pithy.runtime.binding-helpers\",\"name\":\"buildCommentMap\",\"stability\":\"internal\",\"signature\":\"(fragment: DocumentFragment) => Map<string, Comment>\"} */\nexport function buildCommentMap(\n fragment: DocumentFragment\n): Map<string, Comment> {\n const map = new Map<string, Comment>();\n const walker = document.createTreeWalker(fragment, NodeFilter.SHOW_COMMENT);\n let node: Comment | null;\n while ((node = walker.nextNode() as Comment | null)) {\n const text = node.textContent ?? '';\n // Structural anchors: \"if:pid\", \"for:pid\", \"slot:name\"\n const colonIdx = text.indexOf(':');\n if (colonIdx > 0) {\n map.set(text, node);\n }\n }\n return map;\n}\n\n/**\n * Walk up the DOM to find the nearest local PithyJS context.\n * Falls back to the provided root context.\n * @param el - Starting DOM node\n * @param rootCtx - Fallback context if no local context is found\n * @returns The nearest context object\n */\n/** @codexApi {\"parent\":\"pithy.runtime.binding-helpers\",\"name\":\"nearestCtx\",\"stability\":\"internal\",\"signature\":\"(el: Node, rootCtx: BindingContext) => BindingContext\"} */\nexport function nearestCtx(el: Node, rootCtx: BindingContext): BindingContext {\n // Walk parentNode (not parentElement) so context is found on Text/Comment\n // nodes — needed when JIT-projected content is slotted into AOT components.\n // NOTE: In @for loops, only Element nodes receive loop-item __pithyCtx\n // (see applyStructural.ts / createLoopManager.ts). Text nodes inside loop\n // items inherit context from their parent Element, which works correctly\n // because AOT text nodes don't have __pithyCtx set (factories use raw\n // createTextNode), and JIT text nodes are children of tagged Elements.\n let n: Node | null = el;\n while (n) {\n const local = (n as Node & { __pithyCtx?: BindingContext }).__pithyCtx;\n if (local) return local;\n n = n.parentNode;\n }\n return rootCtx;\n}\n\n/**\n * Merge parent component and async (SSR) contexts into the explicit context.\n * Single source of truth used by both `html.ts` and `applyBindings.ts`.\n * @param context - The explicit context from the call site\n * @returns Merged context with parent component and async contexts\n */\n/** @codexApi {\"parent\":\"pithy.runtime.binding-helpers\",\"name\":\"mergeContexts\",\"stability\":\"internal\",\"signature\":\"(context: BindingContext) => BindingContext\"} */\nexport function mergeContexts(context: BindingContext): BindingContext {\n const g = pithyGlobals();\n const getContextFn = g.__getComponentContext;\n const asyncContext =\n typeof getContextFn === 'function' ? getContextFn() : undefined;\n const parentComponentContext = g.__pithyComponentContext;\n\n let parentData: BindingContext | undefined;\n if (parentComponentContext && typeof parentComponentContext === 'object') {\n parentData = {};\n for (const key of Object.keys(parentComponentContext)) {\n if (\n key.startsWith('__') ||\n typeof parentComponentContext[key] === 'function'\n ) {\n parentData[key] = parentComponentContext[key];\n }\n }\n if (Object.keys(parentData).length === 0) parentData = undefined;\n }\n\n if (asyncContext || parentData) {\n return { ...(parentData || {}), ...(asyncContext || {}), ...context };\n }\n return context;\n}\n\n/**\n * Compile expression with $event and $el support for event handlers.\n * @param expr - The expression string to compile\n * @param ctx - The reactive context for variable resolution\n * @returns A function that accepts (event, element) and evaluates the expression\n */\n/** @codexApi {\"parent\":\"pithy.runtime.binding-helpers\",\"name\":\"compileWithEvent\",\"stability\":\"internal\",\"signature\":\"(expr: string, ctx: BindingContext) => (ev: Event, el: Element) => unknown\"} */\nexport function compileWithEvent(\n expr: string,\n ctx: BindingContext\n): (ev: Event, el: Element) => unknown {\n try {\n // eslint-disable-next-line no-new-func -- JIT event-handler expression evaluation is a core framework feature\n const fn = new Function(\n 'ctx',\n '$event',\n '$el',\n `with (ctx) { return (${expr}); }`\n ) as (ctx: BindingContext, ev: Event, el: Element) => unknown;\n return (ev: Event, el: Element) => fn(ctx, ev, el);\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT bindEvent] Failed to compile \"${expr}\"`, err);\n }\n return (_ev: Event, _el: Element) => undefined;\n }\n}\n"]}
@@ -1,7 +1,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';
1
+ export type { EventDesc, InterpDesc, ClassDesc, ClassesDesc, StyleDesc, BoundDesc, RefDesc, BindDesc, CompDesc, DeferDesc, ErrorDesc, ProjDesc, IfDesc, ForDesc, SwitchDesc, Desc, } from './types.js';
2
+ export { buildPidMap, buildCommentMap, mergeContexts, nearestCtx, } from './helpers.js';
3
+ export { applyRef, applyError, applyProjection, applyBind, applyInterpolation, applyEvent, applyClass, applyClasses, applyStyle, applyBound, } from './applySimple.js';
4
+ export { applyComponent } from './applyComponent.js';
5
+ export { applyIf, applyFor, applySwitch } from './applyStructural.js';
6
+ export { applyDefer } from './applyDefer.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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,WAAW,EACX,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,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,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"}
@@ -1,6 +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';
1
+ export { buildPidMap, buildCommentMap, mergeContexts, nearestCtx, } from './helpers.js';
2
+ export { applyRef, applyError, applyProjection, applyBind, applyInterpolation, applyEvent, applyClass, applyClasses, applyStyle, applyBound, } from './applySimple.js';
3
+ export { applyComponent } from './applyComponent.js';
4
+ export { applyIf, applyFor, applySwitch } from './applyStructural.js';
5
+ export { applyDefer } from './applyDefer.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/bindings/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,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","sourcesContent":["export type {\n EventDesc,\n InterpDesc,\n ClassDesc,\n ClassesDesc,\n StyleDesc,\n BoundDesc,\n RefDesc,\n BindDesc,\n CompDesc,\n DeferDesc,\n ErrorDesc,\n ProjDesc,\n IfDesc,\n ForDesc,\n SwitchDesc,\n Desc,\n} from './types';\n\nexport {\n buildPidMap,\n buildCommentMap,\n mergeContexts,\n nearestCtx,\n} from './helpers';\n\nexport {\n applyRef,\n applyError,\n applyProjection,\n applyBind,\n applyInterpolation,\n applyEvent,\n applyClass,\n applyClasses,\n applyStyle,\n applyBound,\n} from './applySimple';\n\nexport { applyComponent } from './applyComponent';\n\nexport { applyIf, applyFor, applySwitch } from './applyStructural';\n\nexport { applyDefer } from './applyDefer';\n"]}
@@ -4,6 +4,11 @@ export interface FactoryResult {
4
4
  destroy?: () => void;
5
5
  }
6
6
  export type Factory = (ctx: BindingContext) => FactoryResult | null | undefined;
7
+ /** @codexApi {"parent":"pithy.runtime.compile-nodes","name":"ChildFactory","stability":"experimental","signature":"type ChildFactory = (ctx: BindingContext, wrap?: (nodes: DocumentFragment) => DocumentFragment) => { el: DocumentFragment; destroy: () => void }"} */
8
+ export type ChildFactory = (ctx: BindingContext, wrap?: (nodes: DocumentFragment) => DocumentFragment) => {
9
+ el: DocumentFragment;
10
+ destroy: () => void;
11
+ };
7
12
  export interface EventDesc {
8
13
  t: 'event';
9
14
  pid: string;
@@ -26,6 +31,11 @@ export interface ClassDesc {
26
31
  name: string;
27
32
  expr: string;
28
33
  }
34
+ export interface ClassesDesc {
35
+ t: 'classes';
36
+ pid: string;
37
+ expr: string;
38
+ }
29
39
  export interface StyleDesc {
30
40
  t: 'style';
31
41
  pid: string;
@@ -53,6 +63,7 @@ export interface CompDesc {
53
63
  pid: string;
54
64
  tag: string;
55
65
  props: Record<string, string>;
66
+ children?: ChildFactory;
56
67
  }
57
68
  export interface DeferDesc {
58
69
  t: 'defer';
@@ -101,5 +112,5 @@ export interface SwitchDesc {
101
112
  factory: Factory;
102
113
  }[];
103
114
  }
104
- export type Desc = EventDesc | InterpDesc | ClassDesc | StyleDesc | BoundDesc | RefDesc | BindDesc | CompDesc | DeferDesc | ErrorDesc | ProjDesc | IfDesc | ForDesc | SwitchDesc;
115
+ export type Desc = EventDesc | InterpDesc | ClassDesc | ClassesDesc | StyleDesc | BoundDesc | RefDesc | BindDesc | CompDesc | DeferDesc | ErrorDesc | ProjDesc | IfDesc | ForDesc | SwitchDesc;
105
116
  //# sourceMappingURL=types.d.ts.map
@@ -1 +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,GAAG,SAAS,CAAC;AAEhF,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,OAAO,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI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AM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,MAAM;IACrB,CAAC,EAAE,IAAI,CAAC;IACR,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CACjD;AACD,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,KAAK,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AACD,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,QAAQ,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,IAAI,GACZ,SAAS,GACT,UAAU,GACV,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/bindings/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,mFAAmF"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/bindings/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,mFAAmF","sourcesContent":["// ─── Descriptor types (mirror codegen output) ────────────────────────────────\n// These describe the shape of the compact binding arrays emitted by the AOT\n// codegen in generateBindings.ts. Handlers narrow inside via the `t` discriminant.\n\nexport type BindingContext = Record<string, unknown>;\n\nexport interface FactoryResult {\n el?: HTMLElement | DocumentFragment;\n destroy?: () => void;\n}\n\nexport type Factory = (ctx: BindingContext) => FactoryResult | null | undefined;\n\n/** @codexApi {\"parent\":\"pithy.runtime.compile-nodes\",\"name\":\"ChildFactory\",\"stability\":\"experimental\",\"signature\":\"type ChildFactory = (ctx: BindingContext, wrap?: (nodes: DocumentFragment) => DocumentFragment) => { el: DocumentFragment; destroy: () => void }\"} */\nexport type ChildFactory = (\n ctx: BindingContext,\n wrap?: (nodes: DocumentFragment) => DocumentFragment\n) => { el: DocumentFragment; destroy: () => void };\n\nexport interface EventDesc {\n t: 'event';\n pid: string;\n event: string;\n expr: string;\n mods?: string[];\n}\nexport interface InterpDesc {\n t: 'interp';\n pid: string;\n parts: ({ s: string } | { e: string })[];\n}\nexport interface ClassDesc {\n t: 'class';\n pid: string;\n name: string;\n expr: string;\n}\nexport interface ClassesDesc {\n t: 'classes';\n pid: string;\n expr: string;\n}\nexport interface StyleDesc {\n t: 'style';\n pid: string;\n prop: string;\n expr: string;\n}\nexport interface BoundDesc {\n t: 'bound';\n pid: string;\n attr: string;\n expr: string;\n}\nexport interface RefDesc {\n t: 'ref';\n pid: string;\n name: string;\n}\nexport interface BindDesc {\n t: 'bind';\n pid: string;\n expr: string;\n}\nexport interface CompDesc {\n t: 'comp';\n pid: string;\n tag: string;\n props: Record<string, string>;\n children?: ChildFactory;\n}\nexport interface DeferDesc {\n t: 'defer';\n pid: string;\n trigger: string;\n load: string;\n placeholder?: string;\n when?: string;\n priority?: string;\n timeout?: number;\n}\nexport interface ErrorDesc {\n t: 'error';\n pid: string;\n expr: string;\n}\nexport interface ProjDesc {\n t: 'proj';\n pid: string;\n name: string;\n fallback?: Factory;\n}\nexport interface IfDesc {\n t: 'if';\n pid: string;\n branches: { expr?: string; factory: Factory }[];\n}\nexport interface ForDesc {\n t: 'for';\n pid: string;\n item: string;\n index?: string;\n expr: string;\n trackBy?: string;\n factory: Factory;\n}\nexport interface SwitchDesc {\n t: 'switch';\n pid: string;\n expr: string;\n cases: { val?: string; factory: Factory }[];\n}\n\nexport type Desc =\n | EventDesc\n | InterpDesc\n | ClassDesc\n | ClassesDesc\n | StyleDesc\n | BoundDesc\n | RefDesc\n | BindDesc\n | CompDesc\n | DeferDesc\n | ErrorDesc\n | ProjDesc\n | IfDesc\n | ForDesc\n | SwitchDesc;\n"]}
@@ -17,7 +17,7 @@
17
17
  * For SSR hydration, use `bootstrap` from `@pithyjs/ssr/client` instead —
18
18
  * it wraps this function and adds hydration detection.
19
19
  */
20
- import type { Component } from '../types';
20
+ import type { Component } from '../types/index.js';
21
21
  import type { PithyConfig, RouteNode, RouterFactory } from '@pithyjs/shared';
22
22
  export interface BootstrapOptions {
23
23
  /** The root App component */
@@ -50,7 +50,7 @@ export async function bootstrap(options) {
50
50
  // parse5 must be loaded before any component renders.
51
51
  // In production builds this block is dead-code-eliminated (import.meta.env.DEV → false).
52
52
  if (import.meta.env?.DEV) {
53
- const { loadJITCompiler } = await import('../compile/parseHtml');
53
+ const { loadJITCompiler } = await import('../compile/parseHtml.js');
54
54
  await loadJITCompiler();
55
55
  }
56
56
  // 2. Initialize design system
@@ -1 +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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\"title\": \"App Bootstrap (Fresh Mount)\",\n \"category\": \"runtime\"\n}\n*/\n\n/**\n * @pithyjs/core - Fresh-mount Bootstrap\n *\n * Handles the standard app startup sequence for non-SSR apps:\n * 1. Initialize design system (if configured)\n * 2. Render App component and mount to DOM\n * 3. Create router (after App succeeds to avoid leaking listeners)\n * 4. Mount router (finds outlet, enables navigation)\n *\n * For SSR hydration, use `bootstrap` from `@pithyjs/ssr/client` instead —\n * it wraps this function and adds hydration detection.\n */\n\nimport type { Component } from '../types';\nimport type { PithyConfig, RouteNode, RouterFactory } from '@pithyjs/shared';\nimport { initDesignSystem } from '@pithyjs/design-system';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface BootstrapOptions {\n /** The root App component */\n App: Component;\n /** Route tree (from virtual:pithy/routes.gen) */\n routes: RouteNode[];\n /** App configuration (from pithy.config.ts) */\n config: PithyConfig;\n /**\n * Router factory — pass `createRouter` from `@pithyjs/router`.\n *\n * Injected rather than imported so core never depends on the router\n * package, breaking the core ↔ router circular dependency.\n */\n createRouter: RouterFactory;\n}\n\n// =============================================================================\n// Implementation\n// =============================================================================\n\n/**\n * Bootstrap a PithyJS app with fresh mount (no hydration).\n *\n * In dev mode, automatically loads the JIT compiler (parse5) for runtime\n * `html\\`\\`` templates. In production, JIT is not loaded — templates must\n * be AOT-compiled. If your production app uses runtime `html()` templates,\n * call `loadJITCompiler()` from `@pithyjs/core/compile/parseHtml` before\n * calling `bootstrap()`.\n *\n * @example\n * ```ts\n * import { bootstrap } from '@pithyjs/core';\n * import { createRouter } from '@pithyjs/router';\n * import config from '../pithy.config';\n * import { routes } from 'virtual:pithy/routes.gen';\n * import App from './App';\n *\n * await bootstrap({ App, routes, config, createRouter });\n * ```\n */\n/** @codexApi {\"parent\":\"pithy.runtime.bootstrap\",\"name\":\"bootstrap\",\"stability\":\"stable\",\"signature\":\"(options: BootstrapOptions) => Promise<void>\"} */\nexport async function bootstrap(options: BootstrapOptions): Promise<void> {\n const { App, routes, config } = options;\n\n // 0. Validate preconditions before any side effects (fail fast — don't leave\n // a partially-mounted app if an untyped/JS caller omits a required option).\n // `createRouter` is required by TS, but a JS caller could omit it; surface\n // a clear, actionable error here rather than \"createRouter is not a function\"\n // after App has already mounted.\n if (typeof options.createRouter !== 'function') {\n throw new Error(\n \"[pithy] bootstrap() requires a 'createRouter' option — pass `createRouter` from '@pithyjs/router'.\"\n );\n }\n\n const appId = config.appId ?? 'app';\n const target = document.getElementById(appId);\n if (!target) {\n throw new Error(`[pithy] Container element #${appId} not found`);\n }\n\n // 1. In dev mode, templates use JIT compilation (parse5 in the browser via Vite).\n // AOT is disabled in dev (`aot: false` when config.command !== \"build\"), so\n // parse5 must be loaded before any component renders.\n // In production builds this block is dead-code-eliminated (import.meta.env.DEV → false).\n if (import.meta.env?.DEV) {\n const { loadJITCompiler } = await import('../compile/parseHtml');\n await loadJITCompiler();\n }\n\n // 2. Initialize design system\n if (config.designSystem) {\n initDesignSystem(\n config.designSystem as Parameters<typeof initDesignSystem>[0]\n );\n }\n\n // 3. Apply entrance animation preset (before App mount — sections\n // read data-entrance during observeEntrance() at component init)\n if (config.entrance?.preset) {\n const validPresets = ['none', 'subtle', 'standard', 'expressive'];\n const preset = validPresets.includes(config.entrance.preset)\n ? config.entrance.preset\n : 'standard';\n document.documentElement.setAttribute('data-entrance', preset);\n }\n\n // 4. Mount App component (before router so if App() throws,\n // no router listeners are leaked)\n const app = App();\n target.appendChild(app.el);\n\n // 5. Create router (after App succeeds — constructor installs\n // global history listeners and link interceptors).\n // The factory is injected via options (pass `createRouter` from\n // @pithyjs/router) so core never imports the router package — breaking\n // the core ↔ router circular dependency. (Presence validated at step 0.)\n const router = options.createRouter(\n routes,\n (config.router ?? {}) as Record<string, unknown>\n );\n\n // 6. Mount router (finds outlet, sets global, handles HMR)\n router.mount(target);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createContextProxy.js","sourceRoot":"","sources":["../../src/runtime/createContextProxy.ts"],"names":[],"mappings":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AAC,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","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.context\",\n \"title\": \"Context Proxy System\",\n \"category\": \"runtime\"\n}\n*/\n\n// Wraps local variables, props, signals, and functions into one unified context.\n/** @codexApi {\"parent\":\"pithy.runtime.context\",\"name\":\"createContextProxy\",\"stability\":\"stable\",\"signature\":\"(contexts: Record<string, unknown>[]) => Record<string, unknown>\"} */\nexport function createContextProxy(\n contexts: Record<string, unknown>[]\n): Record<string, unknown> {\n return new Proxy(\n {},\n {\n get(_, key: string | symbol) {\n for (const ctx of contexts) {\n if (key in ctx) {\n return ctx[key as keyof typeof ctx];\n }\n }\n\n if (import.meta.env?.DEV) {\n if (typeof key !== 'symbol') {\n console.warn(`[pithy] Context key not found: ${key}`);\n }\n }\n\n return undefined;\n },\n has(_, key: string) {\n return contexts.some(ctx => key in ctx);\n },\n\n ownKeys(_) {\n const allKeys = new Set<string | symbol>();\n\n for (const ctx of contexts) {\n Reflect.ownKeys(ctx).forEach(key => allKeys.add(key));\n }\n\n return Array.from(allKeys);\n },\n\n getOwnPropertyDescriptor(_, key) {\n for (const ctx of contexts) {\n if (Object.prototype.hasOwnProperty.call(ctx, key)) {\n return Object.getOwnPropertyDescriptor(ctx, key);\n }\n }\n return undefined;\n },\n }\n );\n}\n"]}
@@ -14,7 +14,7 @@
14
14
  * @module runtime/deferHelpers
15
15
  */
16
16
  import type { LoadingPriority } from '@pithyjs/compiler';
17
- import type { LazyHandle } from './lazy';
17
+ import type { LazyHandle } from './lazy.js';
18
18
  /**
19
19
  * Load a lazy handle with timeout support.
20
20
  * Rejects with a timeout error if loading exceeds the given duration.
@@ -1 +1 @@
1
- {"version":3,"file":"deferHelpers.js","sourceRoot":"","sources":["../../src/runtime/deferHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAcF;;;;;;;GAOG;AACH,mLAAmL;AACnL,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,SAAiB;IAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,SAAS,IAAI,CAAC,CAAC,CAAC;QAChE,CAAC,EAAE,SAAS,CAAC,CAAC;QAEd,MAAM;aACH,IAAI,EAAE;aACN,IAAI,CAAC,MAAM,CAAC,EAAE;YACb,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,CAAC,EAAE;YACX,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,yMAAyM;AACzM,MAAM,UAAU,kBAAkB,CAChC,QAAoB,EACpB,QAAqC;IAErC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,QAAQ,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,IAAI,QAAQ,KAAK,KAAK,IAAI,OAAO,mBAAmB,KAAK,WAAW,EAAE,CAAC;QACrE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"deferHelpers.js","sourceRoot":"","sources":["../../src/runtime/deferHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAcF;;;;;;;GAOG;AACH,mLAAmL;AACnL,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,SAAiB;IAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,SAAS,IAAI,CAAC,CAAC,CAAC;QAChE,CAAC,EAAE,SAAS,CAAC,CAAC;QAEd,MAAM;aACH,IAAI,EAAE;aACN,IAAI,CAAC,MAAM,CAAC,EAAE;YACb,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,CAAC,EAAE;YACX,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,yMAAyM;AACzM,MAAM,UAAU,kBAAkB,CAChC,QAAoB,EACpB,QAAqC;IAErC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,QAAQ,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,IAAI,QAAQ,KAAK,KAAK,IAAI,OAAO,mBAAmB,KAAK,WAAW,EAAE,CAAC;QACrE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.defer-helpers\",\n \"title\": \"Shared Defer Loading Helpers\",\n \"category\": \"runtime\"\n}\n*/\n\n/**\n * Shared helpers for lazy-loading defer directives.\n *\n * Used by both the JIT path (`bindDeferDirectives.ts`) and the AOT path\n * (`bindings/applyDefer.ts`) to avoid duplicating timeout and scheduling logic.\n *\n * @module runtime/deferHelpers\n */\n\nimport type { LoadingPriority } from '@pithyjs/compiler';\nimport type { LazyHandle } from './lazy';\n\n/**\n * Load a lazy handle with timeout support.\n * Rejects with a timeout error if loading exceeds the given duration.\n *\n * @param handle - The lazy handle to load\n * @param timeoutMs - Maximum time in milliseconds before timeout\n * @returns Promise resolving to the loaded module\n */\n/** @codexApi {\"parent\":\"pithy.runtime.defer-helpers\",\"name\":\"loadWithTimeout\",\"stability\":\"internal\",\"signature\":\"<T>(handle: LazyHandle<T>, timeoutMs: number) => Promise<T>\"} */\nexport async function loadWithTimeout<T>(\n handle: LazyHandle<T>,\n timeoutMs: number\n): Promise<T> {\n return new Promise((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n handle.cancel();\n reject(new Error(`Lazy load timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n\n handle\n .load()\n .then(result => {\n clearTimeout(timeoutId);\n resolve(result);\n })\n .catch(err => {\n clearTimeout(timeoutId);\n reject(err);\n });\n });\n}\n\n/**\n * Schedule a callback based on loading priority.\n *\n * - `\"high\"`: Execute synchronously (immediate)\n * - `\"low\"`: `requestIdleCallback` (fires when browser is idle)\n * - default (`undefined`): `queueMicrotask` (reliable, async enough for DOM settling)\n *\n * Deferring by default is critical: `bindDeferDirectives` runs BEFORE\n * `bindComponentTags.replaceWith()` moves the element into the real DOM.\n * Synchronous mount would capture a stale `parentNode` (the compilation fragment).\n *\n * NOTE: `requestIdleCallback` without a timeout can be starved indefinitely when\n * the page is busy (HMR, long-running tasks). Default priority uses\n * `queueMicrotask` which reliably fires after the current synchronous execution.\n *\n * @param callback - Function to execute\n * @param priority - Loading priority level\n * @returns Idle callback ID (if `\"low\"` priority), or `undefined`\n */\n/** @codexApi {\"parent\":\"pithy.runtime.defer-helpers\",\"name\":\"scheduleByPriority\",\"stability\":\"internal\",\"signature\":\"(callback: () => void, priority: LoadingPriority | undefined) => number | void\"} */\nexport function scheduleByPriority(\n callback: () => void,\n priority: LoadingPriority | undefined\n): number | void {\n if (priority === 'high') {\n callback();\n return;\n }\n if (priority === 'low' && typeof requestIdleCallback !== 'undefined') {\n return requestIdleCallback(callback);\n }\n queueMicrotask(callback);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/runtime/html.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAQF;;;;;;;;;GASG;AACH,wRAAwR;AACxR,wBAAgB,IAAI,CAClB,QAAQ,EAAE,oBAAoB,GAAG,MAAM,EACvC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAC/C,kBAAkB,CAAC,EAAE,MAAM,GAC1B;IAAE,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAwF7D"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/runtime/html.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAQF;;;;;;;;;GASG;AACH,wRAAwR;AACxR,wBAAgB,IAAI,CAClB,QAAQ,EAAE,oBAAoB,GAAG,MAAM,EACvC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAC/C,kBAAkB,CAAC,EAAE,MAAM,GAC1B;IAAE,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAyF7D"}
@@ -5,11 +5,11 @@
5
5
  "category": "runtime"
6
6
  }
7
7
  */
8
- import { compileTemplate } from '../compile/compileTemplate';
9
- import { createContextProxy } from './createContextProxy';
10
- import { parseIdentifiersFromTemplate } from './parseIdentifiersFromTemplate';
11
- import { mergeContexts } from './bindings/helpers';
12
- import { drainDestroyCallbacks } from './onDestroy';
8
+ import { compileTemplate } from '../compile/compileTemplate.js';
9
+ import { createContextProxy } from './createContextProxy.js';
10
+ import { parseIdentifiersFromTemplate } from './parseIdentifiersFromTemplate.js';
11
+ import { mergeContexts } from './bindings/helpers.js';
12
+ import { drainDestroyCallbacks } from './onDestroy.js';
13
13
  /**
14
14
  * Tagged template function for creating reactive DOM from HTML strings.
15
15
  * Parses the template, binds reactive directives, and returns a live DOM fragment.
@@ -91,6 +91,7 @@ export function html(template, contextOrCss, cssIfContextPassed) {
91
91
  /* ignore disposal errors */
92
92
  }
93
93
  }
94
+ destroyCallbacks.length = 0;
94
95
  },
95
96
  };
96
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/runtime/html.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;GASG;AACH,wRAAwR;AACxR,MAAM,UAAU,IAAI,CAClB,QAAuC,EACvC,YAA+C,EAC/C,kBAA2B;IAE3B,wEAAwE;IACxE,gFAAgF;IAChF,MAAM,gBAAgB,GAAG,qBAAqB,EAAE,CAAC;IAEjD,MAAM,OAAO,GACX,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEjE,IAAI,OAAO,GAA4B,EAAE,CAAC;IAC1C,IAAI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,MAAmE,CAAC;IACxE,IAAI,CAAC;QACH,MAAM,GAAG,eAAe,CACtB,OAAO,EACP,cAAc,EACd,GAAG,EACH,SAAS,EACT,mBAAmB,CACpB,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wEAAwE;QACxE,6DAA6D;QAC7D,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,IAAI,CAAC;gBACH,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;IAED,uDAAuD;IACvD,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAEjD,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,OAAO;YACL,IAAI,CAAC;gBACH,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;YAAC,MAAM,CAAC;gBACP,4BAA4B;YAC9B,CAAC;YACD,0CAA0C;YAC1C,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,4BAA4B;gBAC9B,CAAC;YACH,CAAC;YACD,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.html\",\n \"title\": \"HTML Template Helper\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { compileTemplate } from '../compile/compileTemplate';\nimport { createContextProxy } from './createContextProxy';\nimport { parseIdentifiersFromTemplate } from './parseIdentifiersFromTemplate';\nimport { mergeContexts } from './bindings/helpers';\nimport { drainDestroyCallbacks } from './onDestroy';\n\n/**\n * Tagged template function for creating reactive DOM from HTML strings.\n * Parses the template, binds reactive directives, and returns a live DOM fragment.\n * Requires `loadJITCompiler()` to be called first (to load parse5 dynamically).\n *\n * @param template - Template literal or raw HTML string\n * @param contextOrCss - Reactive context object or CSS string\n * @param cssIfContextPassed - CSS string when context is the second argument\n * @returns Object with `el` (live DOM) and `destroy` (cleanup function)\n */\n/** @codexApi {\"parent\":\"pithy.runtime.html\",\"name\":\"html\",\"stability\":\"stable\",\"signature\":\"(template: TemplateStringsArray | string, contextOrCss?: Record<string, unknown> | string, cssIfContextPassed?: string) => { el: HTMLElement | DocumentFragment; destroy: () => void }\"} */\nexport function html(\n template: TemplateStringsArray | string,\n contextOrCss?: Record<string, unknown> | string,\n cssIfContextPassed?: string\n): { el: HTMLElement | DocumentFragment; destroy: () => void } {\n // Drain onDestroy() callbacks BEFORE compileTemplate — child components\n // instantiated during compilation will drain their own callbacks independently.\n const destroyCallbacks = drainDestroyCallbacks();\n\n const rawHtml =\n typeof template === 'string' ? template : String.raw(template);\n\n let context: Record<string, unknown> = {};\n let css: string | undefined;\n\n if (typeof contextOrCss === 'object') {\n context = contextOrCss;\n css = cssIfContextPassed;\n } else if (typeof contextOrCss === 'string') {\n css = contextOrCss;\n }\n\n // Merge with component context if available (for content projection and\n // nested component resolution). Uses the shared mergeContexts helper\n // (single source of truth with applyBindings.ts).\n context = mergeContexts(context);\n\n // Dev fallback\n if (import.meta.env?.DEV && Object.keys(context).length === 0) {\n const identifiers = parseIdentifiersFromTemplate(rawHtml);\n identifiers.forEach(name => {\n context[name] = undefined;\n console.warn(\n `[PithyJS html()] Dev fallback: '${name}' will be undefined unless injected by plugin.`\n );\n });\n }\n\n // Extract imported identifiers from context if provided by Babel plugin\n const importedIdentifiers = context.__importedIdentifiers as\n | Set<string>\n | undefined;\n\n // Remove the special property from context before creating proxy\n const cleanContext = { ...context };\n delete cleanContext.__importedIdentifiers;\n\n const proxiedContext = createContextProxy([cleanContext]);\n\n let result: { el: HTMLElement | DocumentFragment; destroy: () => void };\n try {\n result = compileTemplate(\n rawHtml,\n proxiedContext,\n css,\n undefined,\n importedIdentifiers\n );\n } catch (err) {\n // Run drained callbacks LIFO before rethrowing so partially-initialized\n // resources (effects, event listeners) are still cleaned up.\n for (let i = destroyCallbacks.length - 1; i >= 0; i--) {\n try {\n destroyCallbacks[i]();\n } catch {\n /* ignore */\n }\n }\n throw err;\n }\n\n // Zero-overhead fast path when no onDestroy was called\n if (destroyCallbacks.length === 0) return result;\n\n return {\n el: result.el,\n destroy() {\n try {\n result.destroy();\n } catch {\n /* ignore disposal errors */\n }\n // LIFO order — last-registered runs first\n for (let i = destroyCallbacks.length - 1; i >= 0; i--) {\n try {\n destroyCallbacks[i]();\n } catch {\n /* ignore disposal errors */\n }\n }\n destroyCallbacks.length = 0;\n },\n };\n}\n"]}
@@ -1,8 +1,9 @@
1
- export { html } from './html';
2
- export { onDestroy } from './onDestroy';
3
- export { loadModule, getModuleRecord, invalidateModule, getResolvedModuleKeys, clearModuleCache, type ModuleRecord, } from './module-cache';
4
- export { lazy, isLazyHandle, preloadLazy, type LazyState, type LazyOptions, type LazyHandle, } from './lazy';
1
+ export { html } from './html.js';
2
+ export { onDestroy } from './onDestroy.js';
3
+ export { loadModule, getModuleRecord, invalidateModule, getResolvedModuleKeys, clearModuleCache, type ModuleRecord, } from './module-cache.js';
4
+ export { lazy, isLazyHandle, preloadLazy, type LazyState, type LazyOptions, type LazyHandle, } from './lazy.js';
5
+ export { createResource, createAction, type ResourceStatus, type ResourceFetcher, type ResourceOptions, type ResourceHandle, type ActionPerformer, type ActionOverlap, type ActionOptions, type ActionHandle, type ActionResult, } from './resource/index.js';
5
6
  export { DEFAULT_VISIBILITY_MARGIN, observeVisibilityOnce, } from '@pithyjs/shared';
6
- export { bootstrap, type BootstrapOptions } from './bootstrap';
7
+ export { bootstrap, type BootstrapOptions } from './bootstrap.js';
7
8
  export { defineConfig, type PithyConfig } from '@pithyjs/shared';
8
9
  //# sourceMappingURL=index.d.ts.map