@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
@@ -5,7 +5,12 @@
5
5
  "category": "feature"
6
6
  }
7
7
  */
8
+ import { pithyGlobals } from '../../types/globals.js';
9
+ import { declaredValue } from './declaredDirective.js';
8
10
  import { effect, untrack } from '@pithyjs/signals';
11
+ import { setStyleProp } from './bindBoundAttributes.js';
12
+ import { nodeExpando } from '../nodeExpando.js';
13
+ const boundElements = new WeakSet();
9
14
  /**
10
15
  * Global registry of active error boundaries
11
16
  */
@@ -14,6 +19,8 @@ const activeBoundaries = [];
14
19
  * Current boundary context for async error routing (used in later phases)
15
20
  */
16
21
  let currentBoundaryContext = null;
22
+ let slotFrame = null;
23
+ let openBranches = 0;
17
24
  /**
18
25
  * Flag to ensure timer patching happens only once
19
26
  */
@@ -25,29 +32,260 @@ let timersPatched = false;
25
32
  */
26
33
  /** @codexApi {"parent":"pithy.feature.error-boundary","name":"boundaryForElement","stability":"stable","signature":"(el: Element | null) => BoundaryInfo | null"} */
27
34
  export function boundaryForElement(el) {
28
- if (!el)
29
- return null;
30
- // Find the closest boundary element
31
- const boundaryEl = el.closest('[data-error]');
35
+ const boundaryEl = el?.closest('[data-error]');
36
+ // A crash in a branch built inside the slot is attributed (`deferCrash`), so
37
+ // the boundary does not hide the slot before its components are bound.
32
38
  if (!boundaryEl)
33
- return null;
39
+ return openBranches === slotFrame?.branches ? slotFrameBoundary() : null;
34
40
  // Find the registered boundary info
35
41
  return (activeBoundaries.find(boundary => boundary.element === boundaryEl) || null);
36
42
  }
43
+ function slotFrameBoundary() {
44
+ return slotFrame && boundaryContext() === slotFrame.context
45
+ ? slotFrame.boundary
46
+ : null;
47
+ }
48
+ function liveSlotParent(boundary) {
49
+ const parent = boundary.slotParent;
50
+ return parent && activeBoundaries.includes(parent) ? parent : null;
51
+ }
52
+ /**
53
+ * Renders a slot whose receiving `<slot>` sits at `anchor`, mounted by the
54
+ * component placeholder `host`. Its content is detached while it renders, so
55
+ * boundaries are resolved through the anchor, then the host's render. Without an
56
+ * anchor (`renderChildren()`), the host is the frame's anchor.
57
+ */
58
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"withSlotBoundary","stability":"experimental","signature":"<T>(anchor: Node | undefined, host: Element | undefined, fn: () => T) => T"} */
59
+ export function withSlotBoundary(anchor, host, fn) {
60
+ const outer = slotFrame;
61
+ const outerContext = boundaryContext();
62
+ const at = anchor ?? host;
63
+ if (at) {
64
+ // An anchor an earlier crash hid has no parent to resolve from.
65
+ const hider = hiderOf(at);
66
+ const own = hider ?? registeredClosest(anchor?.parentElement);
67
+ if (own)
68
+ setContext(own.element);
69
+ const boundary = own ?? outer?.boundary ?? currentBoundaryContext;
70
+ slotFrame =
71
+ boundary === outer?.boundary
72
+ ? {
73
+ ...outer,
74
+ anchor: at,
75
+ host,
76
+ outer,
77
+ own: false,
78
+ direct: false,
79
+ context: boundaryContext(),
80
+ }
81
+ : {
82
+ boundary,
83
+ anchor: at,
84
+ host,
85
+ outer,
86
+ own: true,
87
+ context: boundaryContext(),
88
+ branches: openBranches,
89
+ direct: hider
90
+ ? hider.contentPlaceholders.has(at)
91
+ : (anchor ?? host)?.parentElement === boundary?.element,
92
+ isContent: !!hider || !boundary?.fallbackElement?.contains(at),
93
+ };
94
+ }
95
+ const owner = slotFrame?.boundary?.element ?? boundaryContext();
96
+ try {
97
+ const output = fn();
98
+ if (owner)
99
+ markSlotOutput(output, owner);
100
+ return output;
101
+ }
102
+ finally {
103
+ slotFrame = outer;
104
+ setContext(outerContext);
105
+ }
106
+ }
107
+ function markSlotOutput(output, owner) {
108
+ var _a;
109
+ const el = output instanceof Node ? output : output?.el;
110
+ if (!(el instanceof Node))
111
+ return;
112
+ const nodes = el.nodeType === Node.DOCUMENT_FRAGMENT_NODE
113
+ ? Array.from(el.childNodes)
114
+ : [el];
115
+ for (const node of nodes)
116
+ (_a = nodeExpando(node)).__pithySlotOwner ?? (_a.__pithySlotOwner = owner);
117
+ }
118
+ /** The boundary element of the slot that rendered `node`, if a slot did. */
119
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"slotOwnerOf","stability":"internal","signature":"(node: Node) => Element | null"} */
120
+ export function slotOwnerOf(node) {
121
+ for (let at = node; at; at = at.parentNode) {
122
+ const owner = nodeExpando(at).__pithySlotOwner;
123
+ if (owner)
124
+ return owner;
125
+ }
126
+ return null;
127
+ }
128
+ /**
129
+ * The boundary element that what is being rendered will sit under. A branch,
130
+ * slot or component built detached cannot `closest()` it, so each sets this
131
+ * while it runs; a crash takes the innermost one (`deferCrash`).
132
+ */
133
+ // On `globalThis` with the attributed crashes, so a component another copy of
134
+ // core binds inside this copy's branch is attributed to the same boundary.
135
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"boundaryContext","stability":"internal","signature":"() => Element | null"} */
136
+ export function boundaryContext() {
137
+ return pithyGlobals().__pithyBoundaryContext ?? null;
138
+ }
139
+ function setContext(element) {
140
+ pithyGlobals().__pithyBoundaryContext = element;
141
+ }
142
+ /**
143
+ * Builds an `@if`/`@case` branch or `@for` item that will be inserted beside
144
+ * `anchor`, or inside it when `inside`. A detached landing place (a component's
145
+ * own template) keeps the enclosing context; an attached one with no boundary
146
+ * has none.
147
+ */
148
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"withBranchBoundary","stability":"internal","signature":"<T>(anchor: Node, fn: () => T, inside?: boolean) => T"} */
149
+ export function withBranchBoundary(anchor, fn, inside = false) {
150
+ const into = inside ? anchor : anchor.parentNode;
151
+ const outer = boundaryContext();
152
+ const at = into?.nodeType === Node.ELEMENT_NODE ? into : null;
153
+ setContext(at?.closest('[data-error]') ?? (into?.isConnected ? null : outer));
154
+ openBranches++;
155
+ try {
156
+ return fn();
157
+ }
158
+ finally {
159
+ openBranches--;
160
+ setContext(outer);
161
+ }
162
+ }
163
+ /** Whether a boundary has hidden the detached subtree `node` belongs to. */
164
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"isInHiddenContent","stability":"internal","signature":"(node: Node) => boolean"} */
165
+ export function isInHiddenContent(node) {
166
+ return !!hiderOf(node);
167
+ }
168
+ /** The registered boundary of `el`'s nearest `[data-error]`, ignoring slot frames. */
169
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"registeredClosest","stability":"internal","signature":"(el: Element | null | undefined) => BoundaryInfo | null"} */
170
+ export function registeredClosest(el) {
171
+ const boundaryEl = el?.closest('[data-error]');
172
+ return ((boundaryEl && activeBoundaries.find(b => b.element === boundaryEl)) || null);
173
+ }
174
+ /** Whether `el`, in the slot being rendered, is normal content an active fallback has replaced. */
175
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"slotContentHidden","stability":"experimental","signature":"(el: Element) => boolean"} */
176
+ export function slotContentHidden(el) {
177
+ // Every boundary the slot frames pass through can hide it, not just the nearest.
178
+ const inner = slotFrame;
179
+ let up = 0;
180
+ for (let frame = inner; frame; up++) {
181
+ if (frame.isContent && frame.boundary?.isActive) {
182
+ // As `hideContent`: an active nested boundary stays visible beside the fallback.
183
+ const child = receiverChild(el, inner, up);
184
+ if (!activeBoundaries.some(b => b.element === child && b.isActive))
185
+ return true;
186
+ }
187
+ while (!frame.own && frame.outer)
188
+ frame = frame.outer;
189
+ frame = frame.outer;
190
+ }
191
+ return false;
192
+ }
193
+ /**
194
+ * The direct child of a boundary element that will hold `node`: the boundary
195
+ * of `frame` when `up` is 0, else that many boundary changes further out.
196
+ */
197
+ function receiverChild(node, frame, up) {
198
+ const top = rootOf(node);
199
+ if (frame.own && up === 0)
200
+ return frame.direct ? top : null;
201
+ if (!frame.host || !frame.outer)
202
+ return null;
203
+ const hostChild = receiverChild(frame.host, frame.outer, frame.own ? up - 1 : up);
204
+ if (hostChild !== frame.host)
205
+ return hostChild;
206
+ // The host's output replaces it; a bare slot puts this content in its place.
207
+ // Anchorless (`renderChildren()`), the host is the anchor: whether it wraps its
208
+ // children is unknown while they render, so they count as unwrapped.
209
+ // A boundary may have hidden the anchor since: its stand-in holds the place.
210
+ const at = standInOf(frame.anchor) ?? frame.anchor;
211
+ const anchorTop = rootOf(at);
212
+ return anchorTop === at ? top : anchorTop;
213
+ }
214
+ function standInOf(node) {
215
+ for (const boundary of activeBoundaries) {
216
+ const standIn = boundary.contentPlaceholders.get(node);
217
+ if (standIn)
218
+ return standIn;
219
+ }
220
+ return undefined;
221
+ }
222
+ function rootOf(node) {
223
+ let top = node;
224
+ while (top.parentNode &&
225
+ top.parentNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE)
226
+ top = top.parentNode;
227
+ return top;
228
+ }
229
+ function hiderOf(node) {
230
+ let top = node;
231
+ while (top.parentNode)
232
+ top = top.parentNode;
233
+ return activeBoundaries.find(b => b.contentPlaceholders.has(top));
234
+ }
235
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"isHiddenByBoundary","stability":"experimental","signature":"(node: Node) => boolean"} */
236
+ export function isHiddenByBoundary(node) {
237
+ return activeBoundaries.some(b => !!b.contentPlaceholders.get(node)?.parentNode);
238
+ }
239
+ /**
240
+ * Inserts `content` after `anchor` when an active boundary has hidden the
241
+ * anchor, which a crash during a slot's render can do, and hides it too.
242
+ */
243
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"insertBesideHidden","stability":"experimental","signature":"(anchor: Node, content: Node) => boolean"} */
244
+ export function insertBesideHidden(anchor, content) {
245
+ for (const boundary of activeBoundaries) {
246
+ const standIn = boundary.contentPlaceholders.get(anchor);
247
+ if (!standIn?.parentNode)
248
+ continue;
249
+ standIn.parentNode.insertBefore(content, standIn.nextSibling);
250
+ if (boundary.isActive)
251
+ hideContent(boundary);
252
+ return true;
253
+ }
254
+ return false;
255
+ }
256
+ /**
257
+ * Puts `content` in the place of `node` when an active boundary has hidden it,
258
+ * which a crash during `node`'s own render can do, and hides it there instead.
259
+ */
260
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"replaceHidden","stability":"experimental","signature":"(node: Node, content: Node[]) => boolean"} */
261
+ export function replaceHidden(node, content) {
262
+ for (const boundary of activeBoundaries) {
263
+ const standIn = boundary.contentPlaceholders.get(node);
264
+ if (!standIn?.parentNode)
265
+ continue;
266
+ boundary.contentPlaceholders.delete(node);
267
+ standIn.replaceWith(...content);
268
+ if (boundary.isActive)
269
+ hideContent(boundary);
270
+ return true;
271
+ }
272
+ return false;
273
+ }
37
274
  /**
38
275
  * Finds the parent boundary for a given boundary (for error escalation)
39
276
  * @param childBoundary - The child boundary to find parent for
40
277
  * @returns Parent BoundaryInfo if found, null otherwise
41
278
  */
42
- function findParentBoundary(childBoundary) {
279
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"findParentBoundary","stability":"internal","signature":"(childBoundary: BoundaryInfo) => BoundaryInfo | null"} */
280
+ export function findParentBoundary(childBoundary) {
43
281
  // Start searching from the child boundary's parent element
44
282
  const parentEl = childBoundary.element.parentElement;
45
283
  if (!parentEl)
46
- return null;
284
+ return liveSlotParent(childBoundary);
47
285
  // Find the closest ancestor boundary element
48
286
  const parentBoundaryEl = parentEl.closest('[data-error]');
49
287
  if (!parentBoundaryEl)
50
- return null;
288
+ return liveSlotParent(childBoundary);
51
289
  // Find the registered boundary info
52
290
  return (activeBoundaries.find(boundary => boundary.element === parentBoundaryEl) ||
53
291
  null);
@@ -97,6 +335,11 @@ export function setBoundaryError(boundary, error) {
97
335
  boundary.errorSignal.set(error);
98
336
  return true;
99
337
  }
338
+ /** The boundary the component being rendered sits under. */
339
+ /** @codexApi {"parent":"pithy.feature.error-boundary","name":"currentBoundary","stability":"experimental","signature":"() => BoundaryInfo | null"} */
340
+ export function currentBoundary() {
341
+ return currentBoundaryContext;
342
+ }
100
343
  /**
101
344
  * Runs a function within the context of a specific boundary
102
345
  * Used for scoping async operations to the correct boundary
@@ -106,13 +349,20 @@ export function setBoundaryError(boundary, error) {
106
349
  */
107
350
  /** @codexApi {"parent":"pithy.feature.error-boundary","name":"runWithBoundary","stability":"stable","signature":"<T>(boundary: BoundaryInfo | null, fn: () => T) => T"} */
108
351
  export function runWithBoundary(boundary, fn) {
352
+ return runUnder(boundary, fn, true);
353
+ }
354
+ function runUnder(boundary, fn, attribute) {
109
355
  const previousContext = currentBoundaryContext;
356
+ const previous = boundaryContext();
110
357
  currentBoundaryContext = boundary;
358
+ if (boundary && attribute)
359
+ setContext(boundary.element);
111
360
  try {
112
361
  return fn();
113
362
  }
114
363
  finally {
115
364
  currentBoundaryContext = previousContext;
365
+ setContext(previous);
116
366
  }
117
367
  }
118
368
  function patchTimersOnce() {
@@ -129,7 +379,8 @@ function patchTimersOnce() {
129
379
  const capturedBoundary = currentBoundaryContext;
130
380
  const fn = callback;
131
381
  const wrappedCallback = (...callbackArgs) => {
132
- return runWithBoundary(capturedBoundary, () => {
382
+ // `false`: a detached render in a timer is not part of the render that scheduled it.
383
+ return runUnder(capturedBoundary, () => {
133
384
  try {
134
385
  return fn(...callbackArgs);
135
386
  }
@@ -142,7 +393,7 @@ function patchTimersOnce() {
142
393
  throw error;
143
394
  }
144
395
  }
145
- });
396
+ }, false);
146
397
  };
147
398
  return originalSetTimeout(wrappedCallback, delay, ...args);
148
399
  });
@@ -156,7 +407,7 @@ function patchTimersOnce() {
156
407
  const capturedBoundary = currentBoundaryContext;
157
408
  const fn = callback;
158
409
  const wrappedCallback = (...callbackArgs) => {
159
- return runWithBoundary(capturedBoundary, () => {
410
+ return runUnder(capturedBoundary, () => {
160
411
  try {
161
412
  return fn(...callbackArgs);
162
413
  }
@@ -169,7 +420,7 @@ function patchTimersOnce() {
169
420
  throw error;
170
421
  }
171
422
  }
172
- });
423
+ }, false);
173
424
  };
174
425
  return originalSetInterval(wrappedCallback, delay, ...args);
175
426
  });
@@ -252,7 +503,7 @@ function hideContent(boundary) {
252
503
  }
253
504
  // Always show the fallback element if it exists
254
505
  if (fallbackElement) {
255
- fallbackElement.style.display = '';
506
+ setStyleProp(fallbackElement, 'display', null);
256
507
  }
257
508
  }
258
509
  /**
@@ -266,7 +517,7 @@ function restoreContent(boundary) {
266
517
  contentPlaceholders.delete(node);
267
518
  }
268
519
  if (fallbackElement) {
269
- fallbackElement.style.display = 'none';
520
+ setStyleProp(fallbackElement, 'display', 'none');
270
521
  }
271
522
  }
272
523
  /**
@@ -274,7 +525,7 @@ function restoreContent(boundary) {
274
525
  * @param fallbackEl - The fallback element to hide
275
526
  */
276
527
  function hideFallback(fallbackEl) {
277
- fallbackEl.style.display = 'none';
528
+ setStyleProp(fallbackEl, 'display', 'none');
278
529
  }
279
530
  /**
280
531
  * Creates and registers an error boundary
@@ -291,6 +542,7 @@ function createBoundary(boundaryEl, errorSignal, disposers) {
291
542
  fallbackElement: fallbackEl,
292
543
  contentPlaceholders: new Map(),
293
544
  isActive: false,
545
+ slotParent: slotFrame?.boundary ?? null,
294
546
  };
295
547
  // Register BEFORE effect so nested lookups can find us
296
548
  activeBoundaries.push(boundary);
@@ -374,7 +626,9 @@ export function bindErrorBoundary(fragment, context, disposers) {
374
626
  patchTimersOnce();
375
627
  const boundaryElements = Array.from(fragment.querySelectorAll('[data-error]'));
376
628
  for (const boundaryEl of boundaryElements) {
377
- const signalName = boundaryEl.getAttribute('data-error');
629
+ if (boundElements.has(boundaryEl))
630
+ continue;
631
+ const signalName = declaredValue(boundaryEl, 'data-error');
378
632
  if (!signalName)
379
633
  continue;
380
634
  const errorSignal = context[signalName];
@@ -394,6 +648,8 @@ export function bindErrorBoundary(fragment, context, disposers) {
394
648
  }
395
649
  // Create and register the boundary (registration happens inside createBoundary)
396
650
  createBoundary(boundaryEl, errorSignal, disposers);
651
+ boundElements.add(boundaryEl);
652
+ disposers.push(() => boundElements.delete(boundaryEl));
397
653
  }
398
654
  }
399
655
  //# sourceMappingURL=bindErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bindErrorBoundary.js","sourceRoot":"","sources":["../../../src/compile/binds/bindErrorBoundary.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,MAAM,EAAU,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAa3D;;GAEG;AACH,MAAM,gBAAgB,GAAmB,EAAE,CAAC;AAE5C;;GAEG;AACH,IAAI,sBAAsB,GAAwB,IAAI,CAAC;AAEvD;;GAEG;AACH,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;;;;GAIG;AACH,qKAAqK;AACrK,MAAM,UAAU,kBAAkB,CAAC,EAAkB;IACnD,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IAErB,oCAAoC;IACpC,MAAM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AAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC9B,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACzD,CAAC;AACH,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.feature.error-boundary\",\n \"title\": \"Error Boundary System\",\n \"category\": \"feature\"\n}\n*/\n\nimport { pithyGlobals } from '../../types/globals';\nimport { declaredValue } from './declaredDirective';\nimport { effect, Signal, untrack } from '@pithyjs/signals';\nimport { setStyleProp } from './bindBoundAttributes';\nimport { nodeExpando } from '../nodeExpando';\n\nconst boundElements = new WeakSet<Element>();\n\n/**\n * Represents an active error boundary in the DOM\n */\nexport interface BoundaryInfo {\n element: Element;\n errorSignal: Signal<Error | null>;\n fallbackElement: Element | null;\n contentPlaceholders: Map<Node, Comment>;\n isActive: boolean;\n /** The receiving boundary of the slot this one was rendered in, detached. */\n slotParent?: BoundaryInfo | null;\n}\n\n/**\n * Global registry of active error boundaries\n */\nconst activeBoundaries: BoundaryInfo[] = [];\n\n/**\n * Current boundary context for async error routing (used in later phases)\n */\nlet currentBoundaryContext: BoundaryInfo | null = null;\n\n/** A slot being rendered, detached, so its content cannot `closest()` its boundary. */\ninterface SlotFrame {\n boundary: BoundaryInfo | null;\n anchor: Node;\n /** The component placeholder whose render mounts this slot. */\n host: Element | undefined;\n /** The slot rendering `host`. */\n outer: SlotFrame | null;\n /** Whether `boundary` was resolved here rather than inherited from `outer`. */\n own: boolean;\n /** Whether the slot's nodes land directly in `boundary.element`, when `own`. */\n direct: boolean;\n /** Whether the slot is the boundary's normal content, which its fallback replaces. */\n isContent: boolean;\n /** The boundary context when the frame opened; a later one is nearer. */\n context: Element | null;\n /** Branches open when the boundary's frame opened; a crash in a later one is deferred. */\n branches: number;\n}\nlet slotFrame: SlotFrame | null = null;\nlet openBranches = 0;\n\n/**\n * Flag to ensure timer patching happens only once\n */\nlet timersPatched = false;\n\n/**\n * Finds the BoundaryInfo for a given DOM element by traversing up the tree\n * @param el - Element to find boundary for\n * @returns BoundaryInfo if found, null otherwise\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"boundaryForElement\",\"stability\":\"stable\",\"signature\":\"(el: Element | null) => BoundaryInfo | null\"} */\nexport function boundaryForElement(el: Element | null): BoundaryInfo | null {\n const boundaryEl = el?.closest('[data-error]');\n // A crash in a branch built inside the slot is attributed (`deferCrash`), so\n // the boundary does not hide the slot before its components are bound.\n if (!boundaryEl)\n return openBranches === slotFrame?.branches ? slotFrameBoundary() : null;\n\n // Find the registered boundary info\n return (\n activeBoundaries.find(boundary => boundary.element === boundaryEl) || null\n );\n}\n\nfunction slotFrameBoundary(): BoundaryInfo | null {\n return slotFrame && boundaryContext() === slotFrame.context\n ? slotFrame.boundary\n : null;\n}\n\nfunction liveSlotParent(boundary: BoundaryInfo): BoundaryInfo | null {\n const parent = boundary.slotParent;\n return parent && activeBoundaries.includes(parent) ? parent : null;\n}\n\n/**\n * Renders a slot whose receiving `<slot>` sits at `anchor`, mounted by the\n * component placeholder `host`. Its content is detached while it renders, so\n * boundaries are resolved through the anchor, then the host's render. Without an\n * anchor (`renderChildren()`), the host is the frame's anchor.\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"withSlotBoundary\",\"stability\":\"experimental\",\"signature\":\"<T>(anchor: Node | undefined, host: Element | undefined, fn: () => T) => T\"} */\nexport function withSlotBoundary<T>(\n anchor: Node | undefined,\n host: Element | undefined,\n fn: () => T\n): T {\n const outer = slotFrame;\n const outerContext = boundaryContext();\n const at = anchor ?? host;\n if (at) {\n // An anchor an earlier crash hid has no parent to resolve from.\n const hider = hiderOf(at);\n const own = hider ?? registeredClosest(anchor?.parentElement);\n if (own) setContext(own.element);\n const boundary = own ?? outer?.boundary ?? currentBoundaryContext;\n slotFrame =\n boundary === outer?.boundary\n ? {\n ...outer,\n anchor: at,\n host,\n outer,\n own: false,\n direct: false,\n context: boundaryContext(),\n }\n : {\n boundary,\n anchor: at,\n host,\n outer,\n own: true,\n context: boundaryContext(),\n branches: openBranches,\n direct: hider\n ? hider.contentPlaceholders.has(at)\n : (anchor ?? host)?.parentElement === boundary?.element,\n isContent: !!hider || !boundary?.fallbackElement?.contains(at),\n };\n }\n const owner = slotFrame?.boundary?.element ?? boundaryContext();\n try {\n const output = fn();\n if (owner) markSlotOutput(output, owner);\n return output;\n } finally {\n slotFrame = outer;\n setContext(outerContext);\n }\n}\n\nfunction markSlotOutput(output: unknown, owner: Element): void {\n const el = output instanceof Node ? output : (output as { el?: unknown })?.el;\n if (!(el instanceof Node)) return;\n const nodes =\n el.nodeType === Node.DOCUMENT_FRAGMENT_NODE\n ? Array.from(el.childNodes)\n : [el];\n for (const node of nodes) nodeExpando(node).__pithySlotOwner ??= owner;\n}\n\n/** The boundary element of the slot that rendered `node`, if a slot did. */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"slotOwnerOf\",\"stability\":\"internal\",\"signature\":\"(node: Node) => Element | null\"} */\nexport function slotOwnerOf(node: Node): Element | null {\n for (let at: Node | null = node; at; at = at.parentNode) {\n const owner = nodeExpando(at).__pithySlotOwner;\n if (owner) return owner;\n }\n return null;\n}\n\n/**\n * The boundary element that what is being rendered will sit under. A branch,\n * slot or component built detached cannot `closest()` it, so each sets this\n * while it runs; a crash takes the innermost one (`deferCrash`).\n */\n// On `globalThis` with the attributed crashes, so a component another copy of\n// core binds inside this copy's branch is attributed to the same boundary.\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"boundaryContext\",\"stability\":\"internal\",\"signature\":\"() => Element | null\"} */\nexport function boundaryContext(): Element | null {\n return pithyGlobals().__pithyBoundaryContext ?? null;\n}\n\nfunction setContext(element: Element | null): void {\n pithyGlobals().__pithyBoundaryContext = element;\n}\n\n/**\n * Builds an `@if`/`@case` branch or `@for` item that will be inserted beside\n * `anchor`, or inside it when `inside`. A detached landing place (a component's\n * own template) keeps the enclosing context; an attached one with no boundary\n * has none.\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"withBranchBoundary\",\"stability\":\"internal\",\"signature\":\"<T>(anchor: Node, fn: () => T, inside?: boolean) => T\"} */\nexport function withBranchBoundary<T>(\n anchor: Node,\n fn: () => T,\n inside = false\n): T {\n const into = inside ? anchor : anchor.parentNode;\n const outer = boundaryContext();\n const at = into?.nodeType === Node.ELEMENT_NODE ? (into as Element) : null;\n setContext(at?.closest('[data-error]') ?? (into?.isConnected ? null : outer));\n openBranches++;\n try {\n return fn();\n } finally {\n openBranches--;\n setContext(outer);\n }\n}\n\n/** Whether a boundary has hidden the detached subtree `node` belongs to. */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"isInHiddenContent\",\"stability\":\"internal\",\"signature\":\"(node: Node) => boolean\"} */\nexport function isInHiddenContent(node: Node): boolean {\n return !!hiderOf(node);\n}\n\n/** The registered boundary of `el`'s nearest `[data-error]`, ignoring slot frames. */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"registeredClosest\",\"stability\":\"internal\",\"signature\":\"(el: Element | null | undefined) => BoundaryInfo | null\"} */\nexport function registeredClosest(\n el: Element | null | undefined\n): BoundaryInfo | null {\n const boundaryEl = el?.closest('[data-error]');\n return (\n (boundaryEl && activeBoundaries.find(b => b.element === boundaryEl)) || null\n );\n}\n\n/** Whether `el`, in the slot being rendered, is normal content an active fallback has replaced. */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"slotContentHidden\",\"stability\":\"experimental\",\"signature\":\"(el: Element) => boolean\"} */\nexport function slotContentHidden(el: Element): boolean {\n // Every boundary the slot frames pass through can hide it, not just the nearest.\n const inner = slotFrame;\n let up = 0;\n for (let frame = inner; frame; up++) {\n if (frame.isContent && frame.boundary?.isActive) {\n // As `hideContent`: an active nested boundary stays visible beside the fallback.\n const child = receiverChild(el, inner as SlotFrame, up);\n if (!activeBoundaries.some(b => b.element === child && b.isActive))\n return true;\n }\n while (!frame.own && frame.outer) frame = frame.outer;\n frame = frame.outer;\n }\n return false;\n}\n\n/**\n * The direct child of a boundary element that will hold `node`: the boundary\n * of `frame` when `up` is 0, else that many boundary changes further out.\n */\nfunction receiverChild(node: Node, frame: SlotFrame, up: number): Node | null {\n const top = rootOf(node);\n if (frame.own && up === 0) return frame.direct ? top : null;\n if (!frame.host || !frame.outer) return null;\n const hostChild = receiverChild(\n frame.host,\n frame.outer,\n frame.own ? up - 1 : up\n );\n if (hostChild !== frame.host) return hostChild;\n // The host's output replaces it; a bare slot puts this content in its place.\n // Anchorless (`renderChildren()`), the host is the anchor: whether it wraps its\n // children is unknown while they render, so they count as unwrapped.\n // A boundary may have hidden the anchor since: its stand-in holds the place.\n const at = standInOf(frame.anchor) ?? frame.anchor;\n const anchorTop = rootOf(at);\n return anchorTop === at ? top : anchorTop;\n}\n\nfunction standInOf(node: Node): Comment | undefined {\n for (const boundary of activeBoundaries) {\n const standIn = boundary.contentPlaceholders.get(node);\n if (standIn) return standIn;\n }\n return undefined;\n}\n\nfunction rootOf(node: Node): Node {\n let top = node;\n while (\n top.parentNode &&\n top.parentNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE\n )\n top = top.parentNode;\n return top;\n}\n\nfunction hiderOf(node: Node): BoundaryInfo | undefined {\n let top = node;\n while (top.parentNode) top = top.parentNode;\n return activeBoundaries.find(b => b.contentPlaceholders.has(top));\n}\n\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"isHiddenByBoundary\",\"stability\":\"experimental\",\"signature\":\"(node: Node) => boolean\"} */\nexport function isHiddenByBoundary(node: Node): boolean {\n return activeBoundaries.some(\n b => !!b.contentPlaceholders.get(node)?.parentNode\n );\n}\n\n/**\n * Inserts `content` after `anchor` when an active boundary has hidden the\n * anchor, which a crash during a slot's render can do, and hides it too.\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"insertBesideHidden\",\"stability\":\"experimental\",\"signature\":\"(anchor: Node, content: Node) => boolean\"} */\nexport function insertBesideHidden(anchor: Node, content: Node): boolean {\n for (const boundary of activeBoundaries) {\n const standIn = boundary.contentPlaceholders.get(anchor);\n if (!standIn?.parentNode) continue;\n standIn.parentNode.insertBefore(content, standIn.nextSibling);\n if (boundary.isActive) hideContent(boundary);\n return true;\n }\n return false;\n}\n\n/**\n * Puts `content` in the place of `node` when an active boundary has hidden it,\n * which a crash during `node`'s own render can do, and hides it there instead.\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"replaceHidden\",\"stability\":\"experimental\",\"signature\":\"(node: Node, content: Node[]) => boolean\"} */\nexport function replaceHidden(node: Node, content: Node[]): boolean {\n for (const boundary of activeBoundaries) {\n const standIn = boundary.contentPlaceholders.get(node);\n if (!standIn?.parentNode) continue;\n boundary.contentPlaceholders.delete(node);\n standIn.replaceWith(...content);\n if (boundary.isActive) hideContent(boundary);\n return true;\n }\n return false;\n}\n\n/**\n * Finds the parent boundary for a given boundary (for error escalation)\n * @param childBoundary - The child boundary to find parent for\n * @returns Parent BoundaryInfo if found, null otherwise\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"findParentBoundary\",\"stability\":\"internal\",\"signature\":\"(childBoundary: BoundaryInfo) => BoundaryInfo | null\"} */\nexport function findParentBoundary(\n childBoundary: BoundaryInfo\n): BoundaryInfo | null {\n // Start searching from the child boundary's parent element\n const parentEl = childBoundary.element.parentElement;\n if (!parentEl) return liveSlotParent(childBoundary);\n\n // Find the closest ancestor boundary element\n const parentBoundaryEl = parentEl.closest('[data-error]');\n if (!parentBoundaryEl) return liveSlotParent(childBoundary);\n\n // Find the registered boundary info\n return (\n activeBoundaries.find(boundary => boundary.element === parentBoundaryEl) ||\n null\n );\n}\n\n/**\n * Clears the error state of a boundary, restoring normal content\n * @param boundary - The boundary to clear\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"clearBoundaryError\",\"stability\":\"stable\",\"signature\":\"(boundary: BoundaryInfo) => void\"} */\nexport function clearBoundaryError(boundary: BoundaryInfo): void {\n if (untrack(() => boundary.errorSignal()) !== null) {\n boundary.errorSignal.set(null);\n }\n}\n\n/**\n * Sets an error on a boundary with escalation logic\n * If the boundary is already in error state, escalates to parent boundary\n * Matches React behavior: first error wins, subsequent errors ignored\n *\n * @param boundary - The boundary to set error on\n * @param error - The error to set\n * @returns `true` if some boundary took ownership of `error`; `false` if it was\n * dropped because this boundary was already showing an error and no ancestor\n * boundary was free to take it.\n *\n * Callers must not assume the error was handled. A component rendering inside an\n * *active* boundary's `@fallback` hits exactly the `false` path — the fallback is\n * the part the user actually sees, so a crash there that nobody records ships a\n * visibly broken page with a green build. `bindComponentTags` and\n * `applyComponent` use the return value to decide between retracting an SSR\n * crash record and adding one.\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"setBoundaryError\",\"stability\":\"stable\",\"signature\":\"(boundary: BoundaryInfo, error: Error) => boolean\"} */\nexport function setBoundaryError(\n boundary: BoundaryInfo,\n error: Error\n): boolean {\n // Check if this boundary is already in error state\n if (untrack(() => boundary.errorSignal()) !== null) {\n // Escalate to parent boundary\n const parentBoundary = findParentBoundary(boundary);\n if (parentBoundary) {\n return setBoundaryError(parentBoundary, error);\n }\n // IGNORE subsequent errors (React behavior - first error wins).\n // Nobody owns this error now, and the caller needs to know.\n return false;\n }\n\n // Set the error on this boundary\n boundary.errorSignal.set(error);\n return true;\n}\n\n/** The boundary the component being rendered sits under. */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"currentBoundary\",\"stability\":\"experimental\",\"signature\":\"() => BoundaryInfo | null\"} */\nexport function currentBoundary(): BoundaryInfo | null {\n return currentBoundaryContext;\n}\n\n/**\n * Runs a function within the context of a specific boundary\n * Used for scoping async operations to the correct boundary\n * @param boundary - Boundary to run within\n * @param fn - Function to execute\n * @returns Result of function execution\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"runWithBoundary\",\"stability\":\"stable\",\"signature\":\"<T>(boundary: BoundaryInfo | null, fn: () => T) => T\"} */\nexport function runWithBoundary<T>(\n boundary: BoundaryInfo | null,\n fn: () => T\n): T {\n return runUnder(boundary, fn, true);\n}\n\nfunction runUnder<T>(\n boundary: BoundaryInfo | null,\n fn: () => T,\n attribute: boolean\n): T {\n const previousContext = currentBoundaryContext;\n const previous = boundaryContext();\n currentBoundaryContext = boundary;\n if (boundary && attribute) setContext(boundary.element);\n try {\n return fn();\n } finally {\n currentBoundaryContext = previousContext;\n setContext(previous);\n }\n}\n\nfunction patchTimersOnce(): void {\n if (timersPatched) return;\n timersPatched = true;\n\n // Patch setTimeout\n const originalSetTimeout = window.setTimeout;\n window.setTimeout = ((\n callback: TimerHandler,\n delay?: number,\n ...args: unknown[]\n ) => {\n // Don't wrap string callbacks; let the browser handle them\n if (typeof callback !== 'function') {\n return originalSetTimeout(callback, delay, ...args);\n }\n\n const capturedBoundary = currentBoundaryContext;\n const fn = callback as (...callbackArgs: unknown[]) => unknown;\n const wrappedCallback = (...callbackArgs: unknown[]) => {\n // `false`: a detached render in a timer is not part of the render that scheduled it.\n return runUnder(\n capturedBoundary,\n () => {\n try {\n return fn(...callbackArgs);\n } catch (error) {\n if (capturedBoundary) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n setBoundaryError(capturedBoundary, err);\n } else {\n throw error;\n }\n }\n },\n false\n );\n };\n return originalSetTimeout(wrappedCallback, delay, ...args);\n }) as typeof window.setTimeout;\n\n // Patch setInterval\n const originalSetInterval = window.setInterval;\n window.setInterval = ((\n callback: TimerHandler,\n delay?: number,\n ...args: unknown[]\n ) => {\n // Don't wrap string callbacks; let the browser handle them\n if (typeof callback !== 'function') {\n return originalSetInterval(callback, delay, ...args);\n }\n\n const capturedBoundary = currentBoundaryContext;\n const fn = callback as (...callbackArgs: unknown[]) => unknown;\n const wrappedCallback = (...callbackArgs: unknown[]) => {\n return runUnder(\n capturedBoundary,\n () => {\n try {\n return fn(...callbackArgs);\n } catch (error) {\n if (capturedBoundary) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n setBoundaryError(capturedBoundary, err);\n } else {\n throw error;\n }\n }\n },\n false\n );\n };\n return originalSetInterval(wrappedCallback, delay, ...args);\n }) as typeof window.setInterval;\n}\n\n/**\n * Finds the fallback element within a boundary\n * @param boundaryEl - The boundary element to search within\n * @returns The fallback element or null if not found\n */\nfunction findFallbackElement(boundaryEl: Element): Element | null {\n // Look through direct children first to avoid nested boundary fallbacks\n for (const child of Array.from(boundaryEl.children)) {\n if (child.hasAttribute('data-fallback')) {\n // Double-check that this fallback belongs to this boundary\n const fallbackBoundary = child.closest('[data-error]');\n if (fallbackBoundary === boundaryEl) {\n return child;\n }\n }\n }\n\n // If no direct child fallback found, search deeper but be more careful\n const allFallbacks = Array.from(\n boundaryEl.querySelectorAll('[data-fallback]')\n );\n for (const fallback of allFallbacks) {\n const fallbackBoundary = fallback.closest('[data-error]');\n if (fallbackBoundary === boundaryEl) {\n return fallback;\n }\n }\n\n if (import.meta.env?.DEV) {\n console.warn(\n `[ErrorBoundary] No fallback element found for boundary`,\n boundaryEl.tagName,\n 'Available children:',\n Array.from(boundaryEl.children).map(\n c =>\n c.tagName +\n (c.hasAttribute('data-fallback') ? '[fallback]' : '') +\n (c.hasAttribute('data-error') ? '[boundary]' : '')\n )\n );\n }\n\n return null;\n}\n\n/**\n * Gets current content nodes (excluding fallback) - recomputed each time\n * @param boundaryEl - The boundary element\n * @param fallbackEl - The fallback element to exclude\n * @returns Array of content nodes\n */\nfunction getCurrentContentNodes(\n boundaryEl: Element,\n fallbackEl: Element | null\n): Node[] {\n return Array.from(boundaryEl.childNodes).filter(n => {\n // Exclude the fallback element for this boundary\n if (n === fallbackEl) return false;\n\n // Exclude placeholder comments from other boundaries\n if (\n n.nodeType === Node.COMMENT_NODE &&\n (n as Comment).data === 'pithy-boundary-hidden'\n ) {\n return false;\n }\n\n // Don't hide nested boundary elements that are currently showing their fallback\n if (n.nodeType === Node.ELEMENT_NODE) {\n const element = n as Element;\n if (element.hasAttribute('data-error')) {\n // This is a nested boundary - check if it's currently in error state\n const nestedBoundary = activeBoundaries.find(\n b => b.element === element\n );\n if (nestedBoundary && nestedBoundary.isActive) {\n // If a nested boundary is already active, keep it visible instead of replacing with our fallback\n return false;\n }\n }\n }\n\n return true;\n });\n}\n\n/**\n * Hides content by replacing nodes with comment placeholders\n * @param boundary - The boundary info\n */\nfunction hideContent(boundary: BoundaryInfo): void {\n const { element, fallbackElement, contentPlaceholders } = boundary;\n const nodes = getCurrentContentNodes(element, fallbackElement);\n\n for (const node of nodes) {\n if (contentPlaceholders.has(node)) continue;\n const placeholder = document.createComment('pithy-boundary-hidden');\n node.parentNode?.replaceChild(placeholder, node);\n contentPlaceholders.set(node, placeholder);\n }\n\n // Always show the fallback element if it exists\n if (fallbackElement) {\n setStyleProp(fallbackElement, 'display', null);\n }\n}\n\n/**\n * Restores content by replacing comment placeholders with original nodes\n * @param boundary - The boundary info\n */\nfunction restoreContent(boundary: BoundaryInfo): void {\n const { fallbackElement, contentPlaceholders } = boundary;\n\n for (const [node, placeholder] of Array.from(contentPlaceholders.entries())) {\n placeholder.parentNode?.replaceChild(node, placeholder);\n contentPlaceholders.delete(node);\n }\n\n if (fallbackElement) {\n setStyleProp(fallbackElement, 'display', 'none');\n }\n}\n\n/**\n * Hides the fallback element\n * @param fallbackEl - The fallback element to hide\n */\nfunction hideFallback(fallbackEl: Element): void {\n setStyleProp(fallbackEl, 'display', 'none');\n}\n\n/**\n * Creates and registers an error boundary\n * @param boundaryEl - The boundary element\n * @param errorSignal - The error signal from context\n * @param disposers - Array to add cleanup functions to\n * @returns The created BoundaryInfo\n */\nfunction createBoundary(\n boundaryEl: Element,\n errorSignal: Signal<Error | null>,\n disposers: (() => void)[]\n): BoundaryInfo {\n const fallbackEl = findFallbackElement(boundaryEl);\n\n const boundary: BoundaryInfo = {\n element: boundaryEl,\n errorSignal,\n fallbackElement: fallbackEl,\n contentPlaceholders: new Map(),\n isActive: false,\n slotParent: slotFrame?.boundary ?? null,\n };\n\n // Register BEFORE effect so nested lookups can find us\n activeBoundaries.push(boundary);\n\n // Initially hide fallback\n if (fallbackEl) {\n hideFallback(fallbackEl);\n }\n\n // Set up reactive effect to toggle content/fallback based on error state\n const dispose = effect(() => {\n const error = errorSignal();\n const hasError = error !== null;\n\n if (hasError && !boundary.isActive) {\n // Show error state\n boundary.isActive = true;\n hideContent(boundary);\n } else if (!hasError && boundary.isActive) {\n // Show normal state\n boundary.isActive = false;\n restoreContent(boundary);\n }\n });\n\n // Add cleanup function\n disposers.push(() => {\n dispose();\n\n // Restore any hidden content\n if (boundary.isActive) {\n restoreContent(boundary);\n }\n\n // Remove from registry\n const index = activeBoundaries.indexOf(boundary);\n if (index >= 0) {\n activeBoundaries.splice(index, 1);\n }\n });\n\n return boundary;\n}\n\n/**\n * Register a single element as an error boundary.\n * Used by AOT applyBindings where the boundary element is known directly\n * (unlike bindErrorBoundary which scans children via querySelectorAll).\n *\n * @param boundaryEl - The element with data-error attribute\n * @param context - Reactive context containing error signals\n * @param disposers - Array to add cleanup functions to\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"registerBoundary\",\"stability\":\"stable\",\"signature\":\"(boundaryEl: Element, context: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function registerBoundary(\n boundaryEl: Element,\n context: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n patchTimersOnce();\n\n const signalName = boundaryEl.getAttribute('data-error');\n if (!signalName) return;\n\n const errorSignal = context[signalName] as Signal<Error | null> | undefined;\n if (!errorSignal || typeof errorSignal !== 'function') {\n if (import.meta.env?.DEV) {\n console.warn(\n `[ErrorBoundary] Signal \"${signalName}\" not found in context for boundary ${boundaryEl.tagName}`\n );\n }\n return;\n }\n\n // Validate that the signal is writable — computed signals or non-signal\n // functions will throw at runtime when setBoundaryError calls .set()\n if (typeof errorSignal.set !== 'function') {\n if (import.meta.env?.DEV) {\n console.warn(\n `[ErrorBoundary] Signal \"${signalName}\" is not writable (no .set method) for boundary ${boundaryEl.tagName}`\n );\n }\n return;\n }\n\n createBoundary(boundaryEl, errorSignal, disposers);\n}\n\n/**\n * Binds error boundaries in the DOM fragment\n * Scans for [data-error] elements and sets up error boundary behavior\n *\n * @param fragment - DOM fragment to scan\n * @param context - Reactive context containing error signals\n * @param disposers - Array to add cleanup functions to\n */\n/** @codexApi {\"parent\":\"pithy.feature.error-boundary\",\"name\":\"bindErrorBoundary\",\"stability\":\"stable\",\"signature\":\"(fragment: Element | DocumentFragment, context: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function bindErrorBoundary(\n fragment: Element | DocumentFragment,\n context: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n // Patch timers on first boundary registration\n patchTimersOnce();\n\n const boundaryElements = Array.from(\n fragment.querySelectorAll('[data-error]')\n );\n\n for (const boundaryEl of boundaryElements) {\n if (boundElements.has(boundaryEl)) continue;\n const signalName = declaredValue(boundaryEl, 'data-error');\n if (!signalName) continue;\n\n const errorSignal = context[signalName] as Signal<Error | null> | undefined;\n if (!errorSignal || typeof errorSignal !== 'function') {\n if (import.meta.env?.DEV) {\n console.warn(\n `[ErrorBoundary] Signal \"${signalName}\" not found in context for boundary ${boundaryEl.tagName}`\n );\n }\n continue;\n }\n\n // Validate that the signal is writable — computed signals or non-signal\n // functions will throw at runtime when setBoundaryError calls .set()\n if (typeof errorSignal.set !== 'function') {\n if (import.meta.env?.DEV) {\n console.warn(\n `[ErrorBoundary] Signal \"${signalName}\" is not writable (no .set method) for boundary ${boundaryEl.tagName}`\n );\n }\n continue;\n }\n\n // Create and register the boundary (registration happens inside createBoundary)\n createBoundary(boundaryEl, errorSignal, disposers);\n boundElements.add(boundaryEl);\n disposers.push(() => boundElements.delete(boundaryEl));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bindEventHandlers.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindEventHandlers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAyGF;;;;;;GAMG;AACH,wNAAwN;AACxN,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAgFN"}
1
+ {"version":3,"file":"bindEventHandlers.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindEventHandlers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AA0GF;;;;;;GAMG;AACH,wNAAwN;AACxN,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAyFN"}
@@ -5,8 +5,9 @@
5
5
  "category": "runtime"
6
6
  }
7
7
  */
8
- import { boundaryForElement, setBoundaryError } from './bindErrorBoundary';
9
- import { nodeExpando } from '../nodeExpando';
8
+ import { isDeclaredDirective } from './declaredDirective.js';
9
+ import { boundaryForElement, setBoundaryError } from './bindErrorBoundary.js';
10
+ import { forwardEventKey, nodeExpando } from '../nodeExpando.js';
10
11
  /**
11
12
  * Walk up the DOM to find the nearest local PithyJS context attached by loops/components.
12
13
  * Falls back to the provided root context.
@@ -97,7 +98,7 @@ export function bindEventHandlers(root, rootCtx, disposers) {
97
98
  forEachElement(root, el => {
98
99
  // Iterate attributes once; bind any data-on-* handlers
99
100
  for (const attr of Array.from(el.attributes)) {
100
- if (!attr.name.startsWith('data-on-'))
101
+ if (!attr.name.startsWith('data-on-') || !isDeclaredDirective(attr))
101
102
  continue;
102
103
  const { type: eventName, mods } = parseEventAttr(attr.name);
103
104
  const handlerExpr = attr.value.trim();
@@ -105,10 +106,15 @@ export function bindEventHandlers(root, rootCtx, disposers) {
105
106
  continue;
106
107
  // Idempotency key includes attr name (mods) + expression
107
108
  const boundSet = getBoundSet(el, eventName);
108
- const boundKey = `${attr.name}=${handlerExpr}`;
109
+ const plainKey = `${attr.name}=${handlerExpr}`;
110
+ const fwdCtx = nodeExpando(el).__pithyForwardCtx;
111
+ const forwarded = !!fwdCtx && !!nodeExpando(el).__pithyForwardAttrs?.has(attr.name);
112
+ const boundKey = forwarded ? forwardEventKey(el, plainKey) : plainKey;
109
113
  if (boundSet.has(boundKey))
110
114
  continue;
111
- const ctx = nearestCtx(el, rootCtx);
115
+ // An outer level's pass must not rebind this forwarded value as its own.
116
+ const claimsPlain = forwarded && !boundSet.has(plainKey);
117
+ const ctx = forwarded ? fwdCtx : nearestCtx(el, rootCtx);
112
118
  const isSimpleIdentifier = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(handlerExpr);
113
119
  // If the expression is a bare identifier and resolves to a function on ctx,
114
120
  // we'll call it directly (browser passes the event), preserving 'this' as ctx.
@@ -161,12 +167,16 @@ export function bindEventHandlers(root, rootCtx, disposers) {
161
167
  };
162
168
  el.addEventListener(eventName, listener, options);
163
169
  boundSet.add(boundKey);
170
+ if (claimsPlain)
171
+ boundSet.add(plainKey);
164
172
  disposers.push(() => {
165
173
  // Note: removeEventListener only considers `capture`; `once`/`passive` are ignored here.
166
174
  el.removeEventListener(eventName, listener, {
167
175
  capture: !!mods.capture,
168
176
  });
169
177
  boundSet.delete(boundKey);
178
+ if (claimsPlain)
179
+ boundSet.delete(plainKey);
170
180
  });
171
181
  }
172
182
  });