@pithyjs/core 0.1.0-beta.2 → 0.1.0-beta.21

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 (239) hide show
  1. package/README.md +46 -8
  2. package/dist/a11y/focus-trap.d.ts +11 -3
  3. package/dist/a11y/focus-trap.d.ts.map +1 -1
  4. package/dist/a11y/focus-trap.js +55 -10
  5. package/dist/a11y/focus-trap.js.map +1 -1
  6. package/dist/a11y/index.d.ts +4 -4
  7. package/dist/a11y/index.js +4 -4
  8. package/dist/a11y/index.js.map +1 -1
  9. package/dist/a11y/keyboard-utils.js.map +1 -1
  10. package/dist/a11y/roving-tabindex.js.map +1 -1
  11. package/dist/a11y/skip-link.js.map +1 -1
  12. package/dist/compile/bindSwitchCases.d.ts +8 -3
  13. package/dist/compile/bindSwitchCases.d.ts.map +1 -1
  14. package/dist/compile/bindSwitchCases.js +137 -183
  15. package/dist/compile/bindSwitchCases.js.map +1 -1
  16. package/dist/compile/binds/bindAfterComponents.d.ts +4 -0
  17. package/dist/compile/binds/bindAfterComponents.d.ts.map +1 -0
  18. package/dist/compile/binds/bindAfterComponents.js +26 -0
  19. package/dist/compile/binds/bindAfterComponents.js.map +1 -0
  20. package/dist/compile/binds/bindAfterProjection.d.ts +7 -0
  21. package/dist/compile/binds/bindAfterProjection.d.ts.map +1 -0
  22. package/dist/compile/binds/bindAfterProjection.js +15 -0
  23. package/dist/compile/binds/bindAfterProjection.js.map +1 -0
  24. package/dist/compile/binds/bindBoundAttributes.d.ts +8 -0
  25. package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
  26. package/dist/compile/binds/bindBoundAttributes.js +227 -21
  27. package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
  28. package/dist/compile/binds/bindClassDirectives.d.ts +3 -2
  29. package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
  30. package/dist/compile/binds/bindClassDirectives.js +58 -21
  31. package/dist/compile/binds/bindClassDirectives.js.map +1 -1
  32. package/dist/compile/binds/bindComponentsTags.d.ts +2 -0
  33. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
  34. package/dist/compile/binds/bindComponentsTags.js +186 -74
  35. package/dist/compile/binds/bindComponentsTags.js.map +1 -1
  36. package/dist/compile/binds/bindConditionals.d.ts +2 -2
  37. package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
  38. package/dist/compile/binds/bindConditionals.js +22 -5
  39. package/dist/compile/binds/bindConditionals.js.map +1 -1
  40. package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
  41. package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
  42. package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
  43. package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
  44. package/dist/compile/binds/bindDeferDirectives.js +21 -19
  45. package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
  46. package/dist/compile/binds/bindErrorBoundary.d.ts +61 -0
  47. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
  48. package/dist/compile/binds/bindErrorBoundary.js +272 -16
  49. package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
  50. package/dist/compile/binds/bindEventHandlers.d.ts.map +1 -1
  51. package/dist/compile/binds/bindEventHandlers.js +15 -5
  52. package/dist/compile/binds/bindEventHandlers.js.map +1 -1
  53. package/dist/compile/binds/bindRefDirectives.d.ts.map +1 -1
  54. package/dist/compile/binds/bindRefDirectives.js +2 -1
  55. package/dist/compile/binds/bindRefDirectives.js.map +1 -1
  56. package/dist/compile/binds/bindStyleDirectives.d.ts +17 -0
  57. package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -0
  58. package/dist/compile/binds/bindStyleDirectives.js +48 -0
  59. package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
  60. package/dist/compile/binds/bindTextInterpolations.d.ts +4 -2
  61. package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
  62. package/dist/compile/binds/bindTextInterpolations.js +87 -35
  63. package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
  64. package/dist/compile/binds/declaredDirective.d.ts +12 -0
  65. package/dist/compile/binds/declaredDirective.d.ts.map +1 -0
  66. package/dist/compile/binds/declaredDirective.js +42 -0
  67. package/dist/compile/binds/declaredDirective.js.map +1 -0
  68. package/dist/compile/binds/directiveRegistry.js.map +1 -1
  69. package/dist/compile/binds/forwardedAttrs.d.ts +4 -2
  70. package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -1
  71. package/dist/compile/binds/forwardedAttrs.js +10 -2
  72. package/dist/compile/binds/forwardedAttrs.js.map +1 -1
  73. package/dist/compile/binds/propNames.d.ts +14 -0
  74. package/dist/compile/binds/propNames.d.ts.map +1 -0
  75. package/dist/compile/binds/propNames.js +116 -0
  76. package/dist/compile/binds/propNames.js.map +1 -0
  77. package/dist/compile/binds/staleRowProps.d.ts +9 -0
  78. package/dist/compile/binds/staleRowProps.d.ts.map +1 -0
  79. package/dist/compile/binds/staleRowProps.js +86 -0
  80. package/dist/compile/binds/staleRowProps.js.map +1 -0
  81. package/dist/compile/compileExpression.js.map +1 -1
  82. package/dist/compile/compileNodes.d.ts.map +1 -1
  83. package/dist/compile/compileNodes.js +16 -7
  84. package/dist/compile/compileNodes.js.map +1 -1
  85. package/dist/compile/compileTemplate.d.ts +3 -4
  86. package/dist/compile/compileTemplate.d.ts.map +1 -1
  87. package/dist/compile/compileTemplate.js +36 -54
  88. package/dist/compile/compileTemplate.js.map +1 -1
  89. package/dist/compile/componentResult.js.map +1 -1
  90. package/dist/compile/contentProjection.d.ts +15 -3
  91. package/dist/compile/contentProjection.d.ts.map +1 -1
  92. package/dist/compile/contentProjection.js +90 -9
  93. package/dist/compile/contentProjection.js.map +1 -1
  94. package/dist/compile/disposeOrder.d.ts +35 -0
  95. package/dist/compile/disposeOrder.d.ts.map +1 -0
  96. package/dist/compile/disposeOrder.js +81 -0
  97. package/dist/compile/disposeOrder.js.map +1 -0
  98. package/dist/compile/evalDiagnostics.d.ts +7 -0
  99. package/dist/compile/evalDiagnostics.d.ts.map +1 -0
  100. package/dist/compile/evalDiagnostics.js +8 -0
  101. package/dist/compile/evalDiagnostics.js.map +1 -0
  102. package/dist/compile/forLoops/bindForLoops.d.ts +3 -3
  103. package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
  104. package/dist/compile/forLoops/bindForLoops.js +18 -13
  105. package/dist/compile/forLoops/bindForLoops.js.map +1 -1
  106. package/dist/compile/forLoops/createLoopManager.d.ts +3 -3
  107. package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
  108. package/dist/compile/forLoops/createLoopManager.js +44 -26
  109. package/dist/compile/forLoops/createLoopManager.js.map +1 -1
  110. package/dist/compile/forLoops/index.d.ts +5 -5
  111. package/dist/compile/forLoops/index.js +5 -5
  112. package/dist/compile/forLoops/index.js.map +1 -1
  113. package/dist/compile/forLoops/loopHelpers.js.map +1 -1
  114. package/dist/compile/forLoops/loopSignals.d.ts.map +1 -1
  115. package/dist/compile/forLoops/loopSignals.js +15 -1
  116. package/dist/compile/forLoops/loopSignals.js.map +1 -1
  117. package/dist/compile/forLoops/loopTraversal.js +2 -2
  118. package/dist/compile/forLoops/loopTraversal.js.map +1 -1
  119. package/dist/compile/handleConditionalChain.d.ts +2 -2
  120. package/dist/compile/handleConditionalChain.d.ts.map +1 -1
  121. package/dist/compile/handleConditionalChain.js +23 -89
  122. package/dist/compile/handleConditionalChain.js.map +1 -1
  123. package/dist/compile/index.d.ts +17 -17
  124. package/dist/compile/index.js +14 -14
  125. package/dist/compile/index.js.map +1 -1
  126. package/dist/compile/injectScopedStyle.js.map +1 -1
  127. package/dist/compile/nodeExpando.d.ts +28 -0
  128. package/dist/compile/nodeExpando.d.ts.map +1 -1
  129. package/dist/compile/nodeExpando.js +12 -0
  130. package/dist/compile/nodeExpando.js.map +1 -1
  131. package/dist/compile/parseHtml.js +12 -6
  132. package/dist/compile/parseHtml.js.map +1 -1
  133. package/dist/compile/pithyTreeToDom.d.ts.map +1 -1
  134. package/dist/compile/pithyTreeToDom.js +17 -12
  135. package/dist/compile/pithyTreeToDom.js.map +1 -1
  136. package/dist/compile/renderBranch.d.ts +13 -0
  137. package/dist/compile/renderBranch.d.ts.map +1 -0
  138. package/dist/compile/renderBranch.js +72 -0
  139. package/dist/compile/renderBranch.js.map +1 -0
  140. package/dist/compile/renderChildren.d.ts +12 -2
  141. package/dist/compile/renderChildren.d.ts.map +1 -1
  142. package/dist/compile/renderChildren.js +33 -4
  143. package/dist/compile/renderChildren.js.map +1 -1
  144. package/dist/compile/ssrCrashes.d.ts +65 -37
  145. package/dist/compile/ssrCrashes.d.ts.map +1 -1
  146. package/dist/compile/ssrCrashes.js +344 -39
  147. package/dist/compile/ssrCrashes.js.map +1 -1
  148. package/dist/compile/ssrMode.js +1 -1
  149. package/dist/compile/ssrMode.js.map +1 -1
  150. package/dist/compile/textValue.js.map +1 -1
  151. package/dist/compile/trimBlankEdges.d.ts +2 -0
  152. package/dist/compile/trimBlankEdges.d.ts.map +1 -0
  153. package/dist/compile/trimBlankEdges.js +15 -0
  154. package/dist/compile/trimBlankEdges.js.map +1 -0
  155. package/dist/config/index.js.map +1 -1
  156. package/dist/index.d.ts +6 -6
  157. package/dist/index.js +6 -6
  158. package/dist/index.js.map +1 -1
  159. package/dist/interfaces/index.d.ts +2 -2
  160. package/dist/interfaces/index.js +2 -2
  161. package/dist/interfaces/index.js.map +1 -1
  162. package/dist/interfaces/ref-signal.interface.js.map +1 -1
  163. package/dist/interfaces/ref.interface.js.map +1 -1
  164. package/dist/runtime/applyBindings.d.ts +9 -5
  165. package/dist/runtime/applyBindings.d.ts.map +1 -1
  166. package/dist/runtime/applyBindings.js +130 -43
  167. package/dist/runtime/applyBindings.js.map +1 -1
  168. package/dist/runtime/bindings/applyComponent.d.ts +2 -2
  169. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
  170. package/dist/runtime/bindings/applyComponent.js +143 -87
  171. package/dist/runtime/bindings/applyComponent.js.map +1 -1
  172. package/dist/runtime/bindings/applyDefer.d.ts +1 -1
  173. package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
  174. package/dist/runtime/bindings/applyDefer.js +16 -15
  175. package/dist/runtime/bindings/applyDefer.js.map +1 -1
  176. package/dist/runtime/bindings/applySimple.d.ts +10 -1
  177. package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
  178. package/dist/runtime/bindings/applySimple.js +117 -46
  179. package/dist/runtime/bindings/applySimple.js.map +1 -1
  180. package/dist/runtime/bindings/applyStructural.d.ts +1 -1
  181. package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
  182. package/dist/runtime/bindings/applyStructural.js +140 -124
  183. package/dist/runtime/bindings/applyStructural.js.map +1 -1
  184. package/dist/runtime/bindings/helpers.d.ts +8 -1
  185. package/dist/runtime/bindings/helpers.d.ts.map +1 -1
  186. package/dist/runtime/bindings/helpers.js +36 -2
  187. package/dist/runtime/bindings/helpers.js.map +1 -1
  188. package/dist/runtime/bindings/index.d.ts +6 -6
  189. package/dist/runtime/bindings/index.d.ts.map +1 -1
  190. package/dist/runtime/bindings/index.js +5 -5
  191. package/dist/runtime/bindings/index.js.map +1 -1
  192. package/dist/runtime/bindings/types.d.ts +2 -0
  193. package/dist/runtime/bindings/types.d.ts.map +1 -1
  194. package/dist/runtime/bindings/types.js.map +1 -1
  195. package/dist/runtime/bootstrap.d.ts +1 -1
  196. package/dist/runtime/bootstrap.js +1 -1
  197. package/dist/runtime/bootstrap.js.map +1 -1
  198. package/dist/runtime/createContextProxy.js.map +1 -1
  199. package/dist/runtime/deferHelpers.d.ts +1 -1
  200. package/dist/runtime/deferHelpers.js.map +1 -1
  201. package/dist/runtime/html.js +7 -7
  202. package/dist/runtime/html.js.map +1 -1
  203. package/dist/runtime/index.d.ts +6 -6
  204. package/dist/runtime/index.js +6 -6
  205. package/dist/runtime/index.js.map +1 -1
  206. package/dist/runtime/lazy.js +1 -1
  207. package/dist/runtime/lazy.js.map +1 -1
  208. package/dist/runtime/module-cache.js.map +1 -1
  209. package/dist/runtime/onDestroy.d.ts +7 -0
  210. package/dist/runtime/onDestroy.d.ts.map +1 -1
  211. package/dist/runtime/onDestroy.js +16 -1
  212. package/dist/runtime/onDestroy.js.map +1 -1
  213. package/dist/runtime/parseIdentifiersFromTemplate.js +1 -1
  214. package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -1
  215. package/dist/runtime/resource/createAction.d.ts +1 -1
  216. package/dist/runtime/resource/createAction.js +1 -1
  217. package/dist/runtime/resource/createAction.js.map +1 -1
  218. package/dist/runtime/resource/createResource.d.ts +1 -1
  219. package/dist/runtime/resource/createResource.d.ts.map +1 -1
  220. package/dist/runtime/resource/createResource.js +3 -4
  221. package/dist/runtime/resource/createResource.js.map +1 -1
  222. package/dist/runtime/resource/engine.d.ts +1 -1
  223. package/dist/runtime/resource/engine.js.map +1 -1
  224. package/dist/runtime/resource/index.d.ts +3 -3
  225. package/dist/runtime/resource/index.js +2 -2
  226. package/dist/runtime/resource/index.js.map +1 -1
  227. package/dist/runtime/resource/types.js.map +1 -1
  228. package/dist/types/globals.d.ts +10 -2
  229. package/dist/types/globals.d.ts.map +1 -1
  230. package/dist/types/globals.js.map +1 -1
  231. package/dist/types/index.js.map +1 -1
  232. package/dist/utilities/index.d.ts +2 -2
  233. package/dist/utilities/index.js +2 -2
  234. package/dist/utilities/index.js.map +1 -1
  235. package/dist/utilities/ref-signal.utility.d.ts +1 -1
  236. package/dist/utilities/ref-signal.utility.js.map +1 -1
  237. package/dist/utilities/ref.untility.d.ts +1 -1
  238. package/dist/utilities/ref.untility.js.map +1 -1
  239. package/package.json +11 -6
@@ -1,19 +1,28 @@
1
- import { compileExpression } from '../../compile/compileExpression';
2
- import { boundaryForElement, runWithBoundary, } from '../../compile/binds/bindErrorBoundary';
3
- import { collectForwardedAttrs, applyForwardedAttrs, } from '../../compile/binds/forwardedAttrs';
1
+ import { compileExpression } from '../../compile/compileExpression.js';
2
+ import { boundaryForElement, replaceHidden, runWithBoundary, withSlotBoundary, slotContentHidden, } from '../../compile/binds/bindErrorBoundary.js';
3
+ import { linkOuterSlotMap, } from '../../compile/contentProjection.js';
4
+ import { collectForwardedAttrs, applyForwardedAttrs, } from '../../compile/binds/forwardedAttrs.js';
4
5
  import { nativeTags } from '@pithyjs/compiler';
5
6
  import { createRoot, untrack } from '@pithyjs/signals';
6
- import { nearestCtx } from './helpers';
7
- import { pithyGlobals } from '../../types/globals';
8
- import { isSSRMode } from '../../compile/ssrMode';
9
- import { isRenderableComponentEl } from '../../compile/componentResult';
10
- import { clearSSRRenderCrash, reportComponentFailure, } from '../../compile/ssrCrashes';
7
+ import { nearestCtx } from './helpers.js';
8
+ import { trimBlankEdges } from '../../compile/trimBlankEdges.js';
9
+ import { pithyGlobals } from '../../types/globals.js';
10
+ import { isSSRMode } from '../../compile/ssrMode.js';
11
+ import { isRenderableComponentEl } from '../../compile/componentResult.js';
12
+ import { clearSSRRenderCrash, reportComponentFailure, resolveBeforeFallback, } from '../../compile/ssrCrashes.js';
13
+ import { isolateDestroyCallbacks } from '../onDestroy.js';
14
+ import { parsePropNames } from '../../compile/binds/propNames.js';
15
+ import { watchStaleRowProp } from '../../compile/binds/staleRowProps.js';
16
+ import { markForwardTarget, nodeExpando } from '../../compile/nodeExpando.js';
17
+ import { anchorDisposer, componentDisposer } from '../../compile/disposeOrder.js';
18
+ import { invalidRenderError, invalidRenderMessage, propEvalMessage, } from '../../compile/evalDiagnostics.js';
11
19
  /** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */
12
20
  function normalizePropName(authored, expectedProps) {
13
- if (expectedProps.length === 0)
21
+ if (expectedProps.includes(authored))
14
22
  return authored;
15
- const map = new Map(expectedProps.map(p => [p.toLowerCase(), p]));
16
- return map.get(authored.toLowerCase()) ?? authored;
23
+ const lower = authored.toLowerCase();
24
+ const matches = expectedProps.filter(p => p.toLowerCase() === lower);
25
+ return matches.length === 1 ? matches[0] : authored;
17
26
  }
18
27
  /** Cache for extractExpectedPropNames to avoid re-parsing the same function. */
19
28
  const propNamesCache = new WeakMap();
@@ -29,18 +38,8 @@ function extractExpectedPropNames(fn) {
29
38
  if (cached)
30
39
  return cached;
31
40
  try {
32
- const src = fn.toString();
33
- const m = src.match(/\(\s*\{\s*([^}]*)\s*\}/);
34
- if (!m) {
35
- propNamesCache.set(fn, []);
36
- return [];
37
- }
38
- const names = m[1]
39
- .split(',')
40
- .map(s => s.trim())
41
- .filter(Boolean)
42
- .filter(s => !s.startsWith('...'))
43
- .map(s => s.split(/[:=]/)[0].trim());
41
+ const parsed = parsePropNames(fn.toString());
42
+ const names = parsed.fromParam ? parsed.names : [];
44
43
  // Detect likely minification: single-char names suggest mangled output
45
44
  if (import.meta.env?.DEV &&
46
45
  names.length > 0 &&
@@ -54,13 +53,76 @@ function extractExpectedPropNames(fn) {
54
53
  return [];
55
54
  }
56
55
  }
57
- export function applyComponent(d, el, ctx, disposers, pidMap) {
56
+ /** Runs a slot factory against the parent's context, owned by the mount's disposers. */
57
+ function renderSlot(factory, ctx, disposers, anchor, host) {
58
+ const g = pithyGlobals();
59
+ const rendering = g.__pithyComponentContext;
60
+ // Otherwise mergeContexts would read the child's names into the slot's context.
61
+ g.__pithyComponentContext = undefined;
62
+ try {
63
+ const { el, destroy } = withSlotBoundary(anchor, host, () => isolateDestroyCallbacks(() => factory(ctx)));
64
+ disposers.push(anchorDisposer(destroy, anchor ?? el.firstChild));
65
+ // Bound already: a runtime-compiled child's binders must not bind it again.
66
+ el.childNodes.forEach(node => (nodeExpando(node).__pithyComponentDom = true));
67
+ return el;
68
+ }
69
+ finally {
70
+ g.__pithyComponentContext = rendering;
71
+ }
72
+ }
73
+ /**
74
+ * Slot content serialized into the placeholder, from a descriptor without
75
+ * `slots`. The nodes are moved, so each slot can be mounted only once.
76
+ */
77
+ function slotsFromChildren(el, slotMap) {
78
+ const slotGroups = new Map();
79
+ for (const child of Array.from(el.childNodes)) {
80
+ const slotName = child.nodeType === Node.ELEMENT_NODE
81
+ ? child.getAttribute('slot') || ''
82
+ : '';
83
+ const group = slotGroups.get(slotName);
84
+ if (group)
85
+ group.push(child);
86
+ else
87
+ slotGroups.set(slotName, [child]);
88
+ }
89
+ const defaultSlot = slotGroups.get('');
90
+ if (defaultSlot) {
91
+ const content = trimBlankEdges(defaultSlot, node => node.nodeType === Node.TEXT_NODE ? node.textContent : null);
92
+ if (content.length)
93
+ slotGroups.set('', content);
94
+ else
95
+ slotGroups.delete('');
96
+ }
97
+ // `renderChildren()` and `<slot>` must share one fragment, or the later
98
+ // consumer steals the nodes out of the first.
99
+ let injection;
100
+ for (const [slotName, nodes] of slotGroups) {
101
+ if (slotName === '') {
102
+ injection = document.createDocumentFragment();
103
+ for (const node of nodes)
104
+ injection.appendChild(node);
105
+ const shared = injection;
106
+ slotMap.set('', () => shared);
107
+ continue;
108
+ }
109
+ slotMap.set(slotName, () => {
110
+ const frag = document.createDocumentFragment();
111
+ for (const node of nodes)
112
+ frag.appendChild(node);
113
+ return frag;
114
+ });
115
+ }
116
+ return injection;
117
+ }
118
+ export function applyComponent(d, el, ctx, disposers, pidMap, scope) {
58
119
  // Skip native HTML elements — prevents <div> matching a `div` in context.
59
120
  // Only apply when the authored tag is already lowercase; PascalCase tags like
60
121
  // <Button> are valid components even though "button" is a native tag.
61
122
  const tagLower = d.tag.toLowerCase();
62
123
  if (d.tag === tagLower && nativeTags.has(tagLower))
63
124
  return;
125
+ resolveBeforeFallback(el);
64
126
  // Exact case first: the context holds the template's own locals alongside its
65
127
  // components, so a prop named `icon` sits next to the `Icon` component and
66
128
  // collides case-insensitively. The JIT path lowercases into a Map, where the
@@ -87,64 +149,55 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
87
149
  }
88
150
  if (typeof candidate !== 'function')
89
151
  return;
152
+ // Hidden like a sibling an activated boundary detached: never rendered.
153
+ if (slotContentHidden(el))
154
+ return;
90
155
  const componentFn = candidate;
91
- const localCtx = nearestCtx(el, ctx);
156
+ const localCtx = scope ?? nearestCtx(el, ctx);
92
157
  // Extract expected props for case-insensitive normalization
93
158
  const expectedProps = extractExpectedPropNames(componentFn);
94
159
  // Evaluate prop expressions with prop name normalization
95
160
  const props = {};
161
+ const staleWatchers = [];
96
162
  for (const [rawName, expr] of Object.entries(d.props)) {
97
163
  const propName = normalizePropName(rawName, expectedProps);
98
164
  try {
99
165
  const fn = compileExpression(expr, localCtx);
100
166
  props[propName] = untrack(fn);
167
+ if (import.meta.env?.DEV) {
168
+ const value = props[propName];
169
+ staleWatchers.push(() => watchStaleRowProp(localCtx, d, d.tag, propName, expr, value, fn, disposers));
170
+ }
101
171
  }
102
- catch {
172
+ catch (err) {
173
+ if (import.meta.env?.DEV)
174
+ console.warn(propEvalMessage(propName, expr), err);
103
175
  // Leave undefined — child uses defaults
104
176
  }
105
177
  }
106
- // Collect slot content from el's children — move original nodes instead
107
- // of cloning to preserve any expandos (__pithyCtx) and event listeners.
108
- // The placeholder el is about to be replaced, so its children are orphaned anyway.
109
178
  const slotMap = new Map();
110
- const children = Array.from(el.childNodes);
111
- const slotGroups = new Map();
112
- for (const child of children) {
113
- const slotName = child.nodeType === Node.ELEMENT_NODE
114
- ? child.getAttribute('slot') || ''
115
- : '';
116
- if (!slotGroups.has(slotName))
117
- slotGroups.set(slotName, []);
118
- slotGroups.get(slotName).push(child);
119
- }
120
- // AOT has no runtime AST, so default-slot content reaches the component two
121
- // ways: `renderChildren()` reads the injection fragment off the global, and
122
- // `<slot>` reads it through the slot map. Both must reference the SAME
123
- // fragment — a DOM node lives in one place, so two fragments would let the
124
- // later consumer steal the nodes out of the first.
179
+ linkOuterSlotMap(slotMap, localCtx);
125
180
  let injection;
126
- for (const [slotName, nodes] of slotGroups) {
127
- if (slotName === '') {
128
- injection = document.createDocumentFragment();
129
- for (const node of nodes)
130
- injection.appendChild(node);
131
- const shared = injection;
132
- slotMap.set('', () => shared);
133
- continue;
134
- }
135
- slotMap.set(slotName, () => {
136
- const frag = document.createDocumentFragment();
137
- for (const node of nodes) {
138
- frag.appendChild(node);
139
- }
140
- return frag;
141
- });
181
+ if (d.slots) {
182
+ for (const [name, factory] of Object.entries(d.slots))
183
+ slotMap.set(name, (ds = disposers, at) => renderSlot(factory, localCtx, ds, at, el));
184
+ }
185
+ else {
186
+ injection = slotsFromChildren(el, slotMap);
142
187
  }
188
+ let invoking = true;
189
+ const childrenFactory = d.children;
190
+ const childFactory = childrenFactory
191
+ ? (ctx, wrap) => invoking
192
+ ? childrenFactory(ctx, wrap)
193
+ : isolateDestroyCallbacks(() => childrenFactory(ctx, wrap))
194
+ : undefined;
143
195
  const componentContext = {
144
196
  ...localCtx,
145
197
  __slotMap: slotMap,
146
198
  __childAstNodes: undefined,
147
- __childFactory: d.children,
199
+ __childFactory: childFactory,
200
+ __slotHost: el,
148
201
  };
149
202
  // Find nearest error boundary
150
203
  const boundaryEl = el.closest('[data-error]');
@@ -170,6 +223,7 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
170
223
  g.__pithyComponentContext = originalContext;
171
224
  g.__pithyRenderingComponent = wasRendering;
172
225
  g.__pithyProjectedChildren = prevInjection;
226
+ invoking = false;
173
227
  }
174
228
  });
175
229
  }
@@ -182,24 +236,19 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
182
236
  reportComponentFailure(el, d.tag, error, boundary);
183
237
  return;
184
238
  }
185
- // No boundary in scope *yet*. Degrade in both modes — an AOT branch
186
- // factory renders detached, so `closest()` here cannot see a boundary the
187
- // element will sit under once the branch is inserted, and throwing would
188
- // only be swallowed by the structural handler's own catch
189
- // (`applyStructural.ts`) anyway.
239
+ // No boundary reachable through the DOM. A branch, slot or component
240
+ // built detached knows the one it will sit under (`deferCrash`).
241
+ // Otherwise degrade in both modes — throwing would only be swallowed by
242
+ // the structural handler's own catch (`applyStructural.ts`).
190
243
  //
191
244
  // A static/server render records the crash instead: dropping the component
192
245
  // silently shipped HTML with <${d.tag}> left raw while `pithy-ssg` counted
193
246
  // the route as rendered and exited 0 (BUG-018). Anything still recorded
194
247
  // when the render finishes fails the route.
195
- //
196
- // Note this path cannot reach a boundary at all when the element is inside
197
- // a detached structural branch: `el.closest('[data-error]')` above found
198
- // nothing, and no later pass re-binds it, so the boundary never receives
199
- // the error even though the nodes are inserted underneath it. That is
200
- // BUG-023; recording is what stops it from shipping silently.
201
- reportComponentFailure(el, d.tag, err instanceof Error ? err : new Error(String(err)), null);
202
- console.error(`[AOT] Component <${d.tag}> crashed:`, err);
248
+ const error = err instanceof Error ? err : new Error(String(err));
249
+ const message = `[AOT] Component <${d.tag}> crashed:`;
250
+ if (!reportComponentFailure(el, d.tag, error, null, { message }))
251
+ console.error(message, err);
203
252
  return;
204
253
  }
205
254
  if (!out ||
@@ -212,7 +261,9 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
212
261
  // Same funnel as a throw — see `bindComponentTags`. Recording without
213
262
  // offering it to the boundary left an AOT component under `@error-boundary`
214
263
  // failing its route with the boundary signal unset.
215
- reportComponentFailure(el, d.tag, new Error(`Invalid render result from <${d.tag}>; expected { el, destroy }`), boundary);
264
+ reportComponentFailure(el, d.tag, invalidRenderError(d.tag), boundary);
265
+ if (import.meta.env?.DEV)
266
+ console.warn(invalidRenderMessage(d.tag));
216
267
  disposeSetup?.();
217
268
  return;
218
269
  }
@@ -222,23 +273,24 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
222
273
  const forwardedAttrs = collectForwardedAttrs(el);
223
274
  const renderedRoot = renderedEl instanceof DocumentFragment
224
275
  ? renderedEl.firstElementChild
225
- : renderedEl instanceof HTMLElement
276
+ : renderedEl instanceof Element
226
277
  ? renderedEl
227
278
  : null;
279
+ const nodes = renderedEl instanceof DocumentFragment
280
+ ? Array.from(renderedEl.childNodes)
281
+ : [renderedEl];
228
282
  let replaced = true;
229
283
  try {
230
- if (renderedEl instanceof DocumentFragment) {
231
- el.replaceWith(...Array.from(renderedEl.childNodes));
232
- }
233
- else {
234
- el.replaceWith(renderedEl);
235
- }
284
+ // A boundary that caught a crash in this render may have hidden `el`.
285
+ if (!replaceHidden(el, nodes))
286
+ el.replaceWith(...nodes);
236
287
  }
237
288
  catch (err) {
238
289
  // The raw <${d.tag}> is left exactly where a crash would have left it, so
239
290
  // this is the same content loss and is recorded the same way.
240
291
  replaced = false;
241
- reportComponentFailure(el, d.tag, err instanceof Error ? err : new Error(String(err)), boundary);
292
+ const error = err instanceof Error ? err : new Error(String(err));
293
+ reportComponentFailure(el, d.tag, error, boundary);
242
294
  console.error(`[AOT] Failed to replace <${d.tag}>:`, err);
243
295
  }
244
296
  // Retracted only here, and in the boundary catch above. This is the point at
@@ -261,6 +313,7 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
261
313
  // forwarded from the placeholder to the rendered root.
262
314
  if (renderedRoot) {
263
315
  pidMap.set(d.pid, renderedRoot);
316
+ markForwardTarget(renderedRoot, localCtx, new Set(forwardedAttrs.map(([name]) => name)));
264
317
  }
265
318
  else {
266
319
  if (import.meta.env?.DEV &&
@@ -271,9 +324,12 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
271
324
  }
272
325
  pidMap.delete(d.pid);
273
326
  }
274
- if (disposeSetup)
275
- disposers.push(disposeSetup);
276
- if (typeof destroy === 'function')
277
- disposers.push(destroy);
327
+ if (replaced)
328
+ for (const watch of staleWatchers)
329
+ watch();
330
+ const teardown = componentDisposer(destroy, disposeSetup, nodes[0] ?? (replaced ? null : el));
331
+ if (teardown)
332
+ disposers.push(teardown);
333
+ return replaced ? nodes : undefined;
278
334
  }
279
335
  //# sourceMappingURL=applyComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"applyComponent.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;A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IAED,IAAI,QAAQ;QAAE,KAAK,MAAM,KAAK,IAAI,aAAa;YAAE,KAAK,EAAE,CAAC;IAEzD,MAAM,QAAQ,GAAG,iBAAiB,CAChC,OAAO,EACP,YAAY,EACZ,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CACnC,CAAC;IACF,IAAI,QAAQ;QAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC","sourcesContent":["import { compileExpression } from '../../compile/compileExpression';\nimport {\n boundaryForElement,\n replaceHidden,\n runWithBoundary,\n withSlotBoundary,\n slotContentHidden,\n} from '../../compile/binds/bindErrorBoundary';\nimport {\n linkOuterSlotMap,\n type SlotMap,\n} from '../../compile/contentProjection';\nimport {\n collectForwardedAttrs,\n applyForwardedAttrs,\n} from '../../compile/binds/forwardedAttrs';\nimport { nativeTags } from '@pithyjs/compiler';\nimport { createRoot, untrack } from '@pithyjs/signals';\nimport type { CompDesc, BindingContext, ChildFactory } from './types';\nimport { nearestCtx } from './helpers';\nimport { trimBlankEdges } from '../../compile/trimBlankEdges';\nimport { pithyGlobals } from '../../types/globals';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { isRenderableComponentEl } from '../../compile/componentResult';\nimport {\n clearSSRRenderCrash,\n reportComponentFailure,\n resolveBeforeFallback,\n} from '../../compile/ssrCrashes';\nimport { isolateDestroyCallbacks } from '../onDestroy';\nimport { parsePropNames } from '../../compile/binds/propNames';\nimport { watchStaleRowProp } from '../../compile/binds/staleRowProps';\nimport { markForwardTarget, nodeExpando } from '../../compile/nodeExpando';\nimport { anchorDisposer, componentDisposer } from '../../compile/disposeOrder';\nimport {\n invalidRenderError,\n invalidRenderMessage,\n propEvalMessage,\n} from '../../compile/evalDiagnostics';\n\ninterface ComponentResult {\n /** Any DOM node — see the `Component` type for why this is not narrower. */\n el: Node;\n destroy?: () => void;\n}\ntype ComponentFn = (props: Record<string, unknown>) => ComponentResult;\n\n/** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */\nfunction normalizePropName(authored: string, expectedProps: string[]): string {\n if (expectedProps.includes(authored)) return authored;\n const lower = authored.toLowerCase();\n const matches = expectedProps.filter(p => p.toLowerCase() === lower);\n return matches.length === 1 ? matches[0] : authored;\n}\n\n/** Cache for extractExpectedPropNames to avoid re-parsing the same function. */\nconst propNamesCache = new WeakMap<ComponentFn, string[]>();\n\n/**\n * Extract destructured prop names from component function signature.\n * NOTE: Uses fn.toString() which may return mangled names under aggressive\n * minification (Terser). In that case, prop name normalization becomes a\n * no-op and props are passed as-is (kebab/lowered). This is acceptable\n * because Vite's default esbuild minifier preserves parameter names.\n */\nfunction extractExpectedPropNames(fn: ComponentFn): string[] {\n const cached = propNamesCache.get(fn);\n if (cached) return cached;\n try {\n const parsed = parsePropNames(fn.toString());\n const names = parsed.fromParam ? parsed.names : [];\n // Detect likely minification: single-char names suggest mangled output\n if (\n import.meta.env?.DEV &&\n names.length > 0 &&\n names.every(n => n.length === 1)\n ) {\n console.warn(\n `[AOT] extractExpectedPropNames: detected single-char names (${names.join(',')}) — prop normalization may not work under minification`\n );\n }\n propNamesCache.set(fn, names);\n return names;\n } catch {\n return [];\n }\n}\n\n/** Runs a slot factory against the parent's context, owned by the mount's disposers. */\nfunction renderSlot(\n factory: ChildFactory,\n ctx: BindingContext,\n disposers: (() => void)[],\n anchor?: Node,\n host?: Element\n): DocumentFragment {\n const g = pithyGlobals();\n const rendering = g.__pithyComponentContext;\n // Otherwise mergeContexts would read the child's names into the slot's context.\n g.__pithyComponentContext = undefined;\n try {\n const { el, destroy } = withSlotBoundary(anchor, host, () =>\n isolateDestroyCallbacks(() => factory(ctx))\n );\n disposers.push(anchorDisposer(destroy, anchor ?? el.firstChild));\n // Bound already: a runtime-compiled child's binders must not bind it again.\n el.childNodes.forEach(\n node => (nodeExpando(node).__pithyComponentDom = true)\n );\n return el;\n } finally {\n g.__pithyComponentContext = rendering;\n }\n}\n\n/**\n * Slot content serialized into the placeholder, from a descriptor without\n * `slots`. The nodes are moved, so each slot can be mounted only once.\n */\nfunction slotsFromChildren(\n el: Element,\n slotMap: SlotMap\n): DocumentFragment | undefined {\n const slotGroups = new Map<string, Node[]>();\n for (const child of Array.from(el.childNodes)) {\n const slotName =\n child.nodeType === Node.ELEMENT_NODE\n ? (child as Element).getAttribute('slot') || ''\n : '';\n const group = slotGroups.get(slotName);\n if (group) group.push(child);\n else slotGroups.set(slotName, [child]);\n }\n const defaultSlot = slotGroups.get('');\n if (defaultSlot) {\n const content = trimBlankEdges(defaultSlot, node =>\n node.nodeType === Node.TEXT_NODE ? node.textContent : null\n );\n if (content.length) slotGroups.set('', content);\n else slotGroups.delete('');\n }\n // `renderChildren()` and `<slot>` must share one fragment, or the later\n // consumer steals the nodes out of the first.\n let injection: DocumentFragment | undefined;\n for (const [slotName, nodes] of slotGroups) {\n if (slotName === '') {\n injection = document.createDocumentFragment();\n for (const node of nodes) injection.appendChild(node);\n const shared = injection;\n slotMap.set('', () => shared);\n continue;\n }\n slotMap.set(slotName, () => {\n const frag = document.createDocumentFragment();\n for (const node of nodes) frag.appendChild(node);\n return frag;\n });\n }\n return injection;\n}\n\nexport function applyComponent(\n d: CompDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[],\n pidMap: Map<string, Element>,\n scope?: BindingContext\n): Node[] | undefined {\n // Skip native HTML elements — prevents <div> matching a `div` in context.\n // Only apply when the authored tag is already lowercase; PascalCase tags like\n // <Button> are valid components even though \"button\" is a native tag.\n const tagLower = d.tag.toLowerCase();\n if (d.tag === tagLower && nativeTags.has(tagLower)) return;\n resolveBeforeFallback(el);\n\n // Exact case first: the context holds the template's own locals alongside its\n // components, so a prop named `icon` sits next to the `Icon` component and\n // collides case-insensitively. The JIT path lowercases into a Map, where the\n // components — appended last — overwrite the locals; matching that ordering is\n // why `<Icon>` resolves in dev, and breaking on the first match is why it did\n // not in a build. Falling back last-wins keeps the two paths agreeing.\n let candidate: unknown = Object.prototype.hasOwnProperty.call(ctx, d.tag)\n ? ctx[d.tag]\n : undefined;\n if (candidate === undefined) {\n for (const key of Object.keys(ctx)) {\n if (key.toLowerCase() === tagLower) candidate = ctx[key];\n }\n }\n if (!candidate) return;\n\n // Support default exports\n if (\n candidate &&\n typeof candidate === 'object' &&\n 'default' in candidate &&\n typeof candidate.default === 'function'\n ) {\n candidate = candidate.default;\n }\n if (typeof candidate !== 'function') return;\n // Hidden like a sibling an activated boundary detached: never rendered.\n if (slotContentHidden(el)) return;\n\n const componentFn = candidate as ComponentFn;\n const localCtx = scope ?? nearestCtx(el, ctx);\n\n // Extract expected props for case-insensitive normalization\n const expectedProps = extractExpectedPropNames(componentFn);\n\n // Evaluate prop expressions with prop name normalization\n const props: Record<string, unknown> = {};\n const staleWatchers: (() => void)[] = [];\n for (const [rawName, expr] of Object.entries(d.props)) {\n const propName = normalizePropName(rawName, expectedProps);\n try {\n const fn = compileExpression(expr, localCtx);\n props[propName] = untrack(fn);\n if (import.meta.env?.DEV) {\n const value = props[propName];\n staleWatchers.push(() =>\n watchStaleRowProp(\n localCtx,\n d,\n d.tag,\n propName,\n expr,\n value,\n fn,\n disposers\n )\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.warn(propEvalMessage(propName, expr), err);\n // Leave undefined — child uses defaults\n }\n }\n\n const slotMap: SlotMap = new Map();\n linkOuterSlotMap(slotMap, localCtx);\n let injection: DocumentFragment | undefined;\n if (d.slots) {\n for (const [name, factory] of Object.entries(d.slots))\n slotMap.set(name, (ds = disposers, at) =>\n renderSlot(factory, localCtx, ds, at, el)\n );\n } else {\n injection = slotsFromChildren(el, slotMap);\n }\n\n let invoking = true;\n const childrenFactory = d.children;\n const childFactory: ChildFactory | undefined = childrenFactory\n ? (ctx, wrap) =>\n invoking\n ? childrenFactory(ctx, wrap)\n : isolateDestroyCallbacks(() => childrenFactory(ctx, wrap))\n : undefined;\n\n const componentContext = {\n ...localCtx,\n __slotMap: slotMap,\n __childAstNodes: undefined,\n __childFactory: childFactory,\n __slotHost: el,\n };\n\n // Find nearest error boundary\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n\n let out: ComponentResult | undefined;\n let disposeSetup: (() => void) | undefined;\n try {\n out = runWithBoundary(boundary, () => {\n const g = pithyGlobals();\n const originalContext = g.__pithyComponentContext;\n const wasRendering = g.__pithyRenderingComponent;\n const prevInjection = g.__pithyProjectedChildren;\n g.__pithyComponentContext = componentContext;\n g.__pithyRenderingComponent = true;\n g.__pithyProjectedChildren = injection;\n try {\n return createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return componentFn(props);\n });\n } finally {\n g.__pithyComponentContext = originalContext;\n g.__pithyRenderingComponent = wasRendering;\n g.__pithyProjectedChildren = prevInjection;\n invoking = false;\n }\n });\n } catch (err) {\n if (boundary) {\n const error = err instanceof Error ? err : new Error(String(err));\n // See `setBoundaryError`: an already-active boundary with no free ancestor\n // drops the error rather than taking it, which is the normal case for a\n // component rendering inside that boundary's `@fallback`.\n reportComponentFailure(el, d.tag, error, boundary);\n return;\n }\n\n // No boundary reachable through the DOM. A branch, slot or component\n // built detached knows the one it will sit under (`deferCrash`).\n // Otherwise degrade in both modes — throwing would only be swallowed by\n // the structural handler's own catch (`applyStructural.ts`).\n //\n // A static/server render records the crash instead: dropping the component\n // silently shipped HTML with <${d.tag}> left raw while `pithy-ssg` counted\n // the route as rendered and exited 0 (BUG-018). Anything still recorded\n // when the render finishes fails the route.\n const error = err instanceof Error ? err : new Error(String(err));\n const message = `[AOT] Component <${d.tag}> crashed:`;\n if (!reportComponentFailure(el, d.tag, error, null, { message }))\n console.error(message, err);\n return;\n }\n\n if (\n !out ||\n typeof out !== 'object' ||\n !('el' in out) ||\n !isRenderableComponentEl(out.el, el)\n ) {\n // Not a throw, but the same outcome: the raw <${d.tag}> is left in place\n // and the subtree never renders, which under SSR is content silently\n // missing from the emitted HTML. Recorded exactly like a crash (BUG-018).\n // Same funnel as a throw — see `bindComponentTags`. Recording without\n // offering it to the boundary left an AOT component under `@error-boundary`\n // failing its route with the boundary signal unset.\n reportComponentFailure(el, d.tag, invalidRenderError(d.tag), boundary);\n if (import.meta.env?.DEV) console.warn(invalidRenderMessage(d.tag));\n disposeSetup?.();\n return;\n }\n\n const { el: renderedEl, destroy } = out;\n\n // Capture rendered root element before fragment is consumed by replaceWith\n const forwardedClass = el.getAttribute('class');\n const forwardedAttrs = collectForwardedAttrs(el);\n const renderedRoot: Element | null =\n renderedEl instanceof DocumentFragment\n ? renderedEl.firstElementChild\n : renderedEl instanceof Element\n ? renderedEl\n : null;\n\n const nodes =\n renderedEl instanceof DocumentFragment\n ? Array.from(renderedEl.childNodes)\n : [renderedEl];\n let replaced = true;\n try {\n // A boundary that caught a crash in this render may have hidden `el`.\n if (!replaceHidden(el, nodes)) el.replaceWith(...nodes);\n } catch (err) {\n // The raw <${d.tag}> is left exactly where a crash would have left it, so\n // this is the same content loss and is recorded the same way.\n replaced = false;\n const error = err instanceof Error ? err : new Error(String(err));\n reportComponentFailure(el, d.tag, error, boundary);\n console.error(`[AOT] Failed to replace <${d.tag}>:`, err);\n }\n\n // Retracted only here, and in the boundary catch above. This is the point at\n // which the component is known to have produced a usable node AND to have\n // reached the document.\n if (isSSRMode() && replaced) clearSSRRenderCrash(el);\n\n if (forwardedClass && renderedRoot) {\n for (const cls of forwardedClass.split(/\\s+/)) {\n if (cls) renderedRoot.classList.add(cls);\n }\n }\n\n if (forwardedAttrs.length > 0 && renderedRoot) {\n applyForwardedAttrs(renderedRoot, forwardedAttrs, d.tag);\n }\n\n // Re-target the component pid to the rendered root so subsequent binding\n // passes (event, bound, class, style) apply to the component's actual DOM\n // element. This matches the JIT path where data-on-* attributes are\n // forwarded from the placeholder to the rendered root.\n if (renderedRoot) {\n pidMap.set(d.pid, renderedRoot);\n markForwardTarget(\n renderedRoot,\n localCtx,\n new Set(forwardedAttrs.map(([name]) => name))\n );\n } else {\n if (\n import.meta.env?.DEV &&\n (forwardedClass ||\n forwardedAttrs.length > 0 ||\n (d.props && Object.keys(d.props).length > 0))\n ) {\n console.warn(\n `[AOT] <${d.tag}> has forwarded attributes but returns a fragment with no single root element — forwarding skipped.`\n );\n }\n pidMap.delete(d.pid);\n }\n\n if (replaced) for (const watch of staleWatchers) watch();\n\n const teardown = componentDisposer(\n destroy,\n disposeSetup,\n nodes[0] ?? (replaced ? null : el)\n );\n if (teardown) disposers.push(teardown);\n return replaced ? nodes : undefined;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { DeferDesc, BindingContext } from './types';
1
+ import type { DeferDesc, BindingContext } from './types.js';
2
2
  /**
3
3
  * Apply @defer directive from a binding descriptor.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"applyDefer.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AASzD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAkfN"}
1
+ {"version":3,"file":"applyDefer.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAUzD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAkfN"}
@@ -1,12 +1,13 @@
1
1
  import { createRoot, effect } from '@pithyjs/signals';
2
- import { compileExpression } from '../../compile/compileExpression';
3
- import { isSSRMode } from '../../compile/ssrMode';
4
- import { boundaryForElement, setBoundaryError, } from '../../compile/binds/bindErrorBoundary';
2
+ import { compileExpression } from '../../compile/compileExpression.js';
3
+ import { isSSRMode } from '../../compile/ssrMode.js';
4
+ import { boundaryForElement, setBoundaryError, } from '../../compile/binds/bindErrorBoundary.js';
5
5
  import { DEFAULT_LAZY_TIMEOUT, } from '@pithyjs/compiler';
6
- import { isLazyHandle } from '../lazy';
6
+ import { isLazyHandle } from '../lazy.js';
7
7
  import { observeVisibilityOnce, DEFAULT_VISIBILITY_MARGIN, } from '@pithyjs/shared';
8
- import { nearestCtx } from './helpers';
9
- import { loadWithTimeout, scheduleByPriority } from '../deferHelpers';
8
+ import { nearestCtx } from './helpers.js';
9
+ import { loadWithTimeout, scheduleByPriority } from '../deferHelpers.js';
10
+ import { setStyleProp } from '../../compile/binds/bindBoundAttributes.js';
10
11
  // ─── Defer directive handler ──────────────────────────────────────────────────
11
12
  /** Unique ID counter for defer elements (AOT path). */
12
13
  let aotDeferIdCounter = 0;
@@ -138,7 +139,7 @@ export function applyDefer(d, element, ctx, disposers) {
138
139
  errorEl = slotError;
139
140
  errorEl.removeAttribute('slot');
140
141
  errorEl.setAttribute('data-defer-error', deferId);
141
- errorEl.style.display = 'none';
142
+ setStyleProp(errorEl, 'display', 'none');
142
143
  }
143
144
  // ─── Insert placeholder into DOM ────────────────────────────────
144
145
  const parent = element.parentNode;
@@ -147,7 +148,7 @@ export function applyDefer(d, element, ctx, disposers) {
147
148
  if (placeholderEl) {
148
149
  // For @defer="when", placeholder starts hidden (only shows during loading)
149
150
  if (trigger === 'when' && placeholderEl instanceof HTMLElement) {
150
- placeholderEl.style.display = 'none';
151
+ setStyleProp(placeholderEl, 'display', 'none');
151
152
  }
152
153
  parent.insertBefore(placeholderEl, element);
153
154
  }
@@ -155,7 +156,7 @@ export function applyDefer(d, element, ctx, disposers) {
155
156
  parent.insertBefore(errorEl, element);
156
157
  }
157
158
  // Hide the original element
158
- element.style.display = 'none';
159
+ setStyleProp(element, 'display', 'none');
159
160
  // ─── Mount lifecycle state ────────────────────────────────────────
160
161
  let mountedDestroy = null;
161
162
  let disposeMountedSetup = null;
@@ -205,7 +206,7 @@ export function applyDefer(d, element, ctx, disposers) {
205
206
  insertedNodes = [];
206
207
  isMounted = false;
207
208
  if (placeholderEl && placeholderEl instanceof HTMLElement) {
208
- placeholderEl.style.display = 'none';
209
+ setStyleProp(placeholderEl, 'display', 'none');
209
210
  }
210
211
  element.setAttribute('data-defer-state', 'pending');
211
212
  }
@@ -225,14 +226,14 @@ export function applyDefer(d, element, ctx, disposers) {
225
226
  setBoundaryError(boundary, error);
226
227
  }
227
228
  else if (errorEl) {
228
- errorEl.style.display = '';
229
+ setStyleProp(errorEl, 'display', null);
229
230
  }
230
231
  element.dispatchEvent(new CustomEvent('error', {
231
232
  detail: {
232
233
  error,
233
234
  retry: () => {
234
235
  if (errorEl)
235
- errorEl.style.display = 'none';
236
+ setStyleProp(errorEl, 'display', 'none');
236
237
  void mountComponent();
237
238
  },
238
239
  },
@@ -251,7 +252,7 @@ export function applyDefer(d, element, ctx, disposers) {
251
252
  element.setAttribute('data-defer-state', 'loading');
252
253
  // Show placeholder during loading
253
254
  if (placeholderEl && placeholderEl instanceof HTMLElement) {
254
- placeholderEl.style.display = '';
255
+ setStyleProp(placeholderEl, 'display', null);
255
256
  }
256
257
  try {
257
258
  const effectiveTimeout = typeof timeout === 'number' && Number.isFinite(timeout) && timeout > 0
@@ -390,7 +391,7 @@ export function applyDefer(d, element, ctx, disposers) {
390
391
  !isMounting &&
391
392
  elementState === 'error') {
392
393
  if (errorEl)
393
- errorEl.style.display = 'none';
394
+ setStyleProp(errorEl, 'display', 'none');
394
395
  mountComponent();
395
396
  }
396
397
  });
@@ -438,7 +439,7 @@ export function applyDefer(d, element, ctx, disposers) {
438
439
  unmountComponent();
439
440
  }
440
441
  if (errorEl)
441
- errorEl.style.display = 'none';
442
+ setStyleProp(errorEl, 'display', 'none');
442
443
  }
443
444
  });
444
445
  disposers.push(() => {