@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 +1 @@
1
- {"version":3,"file":"bindEventHandlers.js","sourceRoot":"","sources":["../../../src/compile/binds/bindEventHandlers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,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C,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.events\",\n \"title\": \"Event Handler Binding System\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { isDeclaredDirective } from './declaredDirective';\nimport { boundaryForElement, setBoundaryError } from './bindErrorBoundary';\nimport { forwardEventKey, nodeExpando } from '../nodeExpando';\n\n/**\n * Walk up the DOM to find the nearest local PithyJS context attached by loops/components.\n * Falls back to the provided root context.\n */\nfunction nearestCtx(\n el: Element,\n rootCtx: Record<string, unknown>\n): Record<string, unknown> {\n let n: Element | null = el;\n while (n) {\n const local = nodeExpando(n).__pithyCtx;\n if (local) return local;\n n = n.parentElement;\n }\n return rootCtx;\n}\n\ntype Mods = {\n once?: boolean;\n prevent?: boolean;\n stop?: boolean;\n self?: boolean;\n capture?: boolean;\n passive?: boolean;\n};\n\nfunction parseEventAttr(name: string): { type: string; mods: Mods } {\n // \"data-on-click\" or \"data-on-click.once.prevent\"\n const raw = name.slice('data-on-'.length);\n const parts = raw.split('.');\n const type = parts[0];\n const mods: Mods = {};\n for (let i = 1; i < parts.length; i++) {\n const p = parts[i];\n if (p === 'once') mods.once = true;\n else if (p === 'prevent') mods.prevent = true;\n else if (p === 'stop') mods.stop = true;\n else if (p === 'self') mods.self = true;\n else if (p === 'capture') mods.capture = true;\n else if (p === 'passive') mods.passive = true;\n }\n return { type, mods };\n}\n\n/**\n * Per-element, per-event registry of bound expressions,\n * so we don't double-attach listeners when DOM is moved or reprocessed.\n */\nconst BOUND_KEY: unique symbol = Symbol('pithy:bound');\n\nfunction getBoundSet(el: Element, type: string) {\n const host = el as Element & { [BOUND_KEY]?: Record<string, Set<string>> };\n const store =\n host[BOUND_KEY] ??\n (host[BOUND_KEY] = Object.create(null) as Record<string, Set<string>>);\n return (store[type] ??= new Set<string>());\n}\n\n/**\n * Compile an expression so it can see ctx + $event + $el.\n * We intentionally do not use compileExpression here so we can inject $event/$el.\n */\nfunction compileWithEvent(\n expr: string,\n ctx: Record<string, unknown>\n): (ev: Event, el: Element) => unknown {\n try {\n // Build a function that accepts (ctx, $event, $el) and returns the expression result.\n // `with(ctx)` makes identifiers resolve against the provided context object.\n // eslint-disable-next-line no-new-func -- JIT event-handler expression evaluation is a core framework feature\n const fn = new Function(\n 'ctx',\n '$event',\n '$el',\n `with (ctx) { return (${expr}); }`\n ) as (ctx: Record<string, unknown>, ev: Event, el: Element) => unknown;\n return (ev: Event, el: Element) => fn(ctx, ev, el);\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn(`[bindEventHandlers] ❌ Failed to compile \"${expr}\"`, err);\n }\n // Return a noop runner\n return (_ev: Event, _el: Element) => undefined;\n }\n}\n\n/**\n * Traverse all elements under `root` (Element or DocumentFragment) using a TreeWalker.\n */\nfunction forEachElement(\n root: Element | DocumentFragment,\n cb: (el: Element) => void\n) {\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);\n let node: Node | null;\n while ((node = walker.nextNode())) {\n cb(node as Element);\n }\n}\n\n/**\n * Binds DOM event handlers within `root`.\n * - Uses nearest element context (e.g., loop item ctx) when present.\n * - Idempotent: won't re-bind the same element/event/expression+modifiers combo.\n * - Supports modifiers: .once .prevent .stop .self .capture .passive\n * - Injects `$event` and `$el` for expression handlers (e.g., @click=\"doThing($event)\")\n */\n/** @codexApi {\"parent\":\"pithy.runtime.events\",\"name\":\"bindEventHandlers\",\"stability\":\"stable\",\"signature\":\"(root: Element | DocumentFragment, rootCtx: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function bindEventHandlers(\n root: Element | DocumentFragment,\n rootCtx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n forEachElement(root, el => {\n // Iterate attributes once; bind any data-on-* handlers\n for (const attr of Array.from(el.attributes)) {\n if (!attr.name.startsWith('data-on-') || !isDeclaredDirective(attr))\n continue;\n\n const { type: eventName, mods } = parseEventAttr(attr.name);\n const handlerExpr = attr.value.trim();\n if (!handlerExpr) continue;\n\n // Idempotency key includes attr name (mods) + expression\n const boundSet = getBoundSet(el, eventName);\n const plainKey = `${attr.name}=${handlerExpr}`;\n const fwdCtx = nodeExpando(el).__pithyForwardCtx;\n const forwarded =\n !!fwdCtx && !!nodeExpando(el).__pithyForwardAttrs?.has(attr.name);\n const boundKey = forwarded ? forwardEventKey(el, plainKey) : plainKey;\n if (boundSet.has(boundKey)) continue;\n // An outer level's pass must not rebind this forwarded value as its own.\n const claimsPlain = forwarded && !boundSet.has(plainKey);\n\n const ctx = forwarded ? fwdCtx : nearestCtx(el, rootCtx);\n const isSimpleIdentifier = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(handlerExpr);\n\n // If the expression is a bare identifier and resolves to a function on ctx,\n // we'll call it directly (browser passes the event), preserving 'this' as ctx.\n const directFn =\n isSimpleIdentifier && typeof ctx[handlerExpr] === 'function'\n ? (ctx[handlerExpr] as EventListener)\n : null;\n\n // Otherwise, compile an event-aware evaluator that can see `$event` & `$el`.\n const runWithEvent = directFn ? null : compileWithEvent(handlerExpr, ctx);\n\n // Final listener with modifiers + $event/$el support + error boundary capture\n const listener: EventListener = (ev: Event) => {\n if (mods.self && ev.target !== el) return;\n if (mods.prevent) ev.preventDefault();\n if (mods.stop) ev.stopPropagation();\n\n try {\n if (directFn) {\n // Call the function from ctx with ctx as 'this'\n return directFn.call(ctx, ev);\n } else if (runWithEvent) {\n const out = runWithEvent(ev, el);\n // If expression returns a function, treat that as a handler and pass the event\n if (typeof out === 'function') {\n return (out as (e: Event) => unknown).call(ctx, ev);\n }\n return out;\n }\n } catch (error) {\n // Find the nearest error boundary and set its error signal with escalation\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n if (boundary) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n setBoundaryError(boundary, err);\n } else {\n // No boundary found, re-throw to maintain original behavior\n throw error;\n }\n }\n };\n\n // Attach with appropriate options\n const options = {\n capture: !!mods.capture,\n passive: !!mods.passive,\n once: !!mods.once,\n } as AddEventListenerOptions;\n\n el.addEventListener(eventName, listener, options);\n\n boundSet.add(boundKey);\n if (claimsPlain) boundSet.add(plainKey);\n disposers.push(() => {\n // Note: removeEventListener only considers `capture`; `once`/`passive` are ignored here.\n el.removeEventListener(eventName, listener, {\n capture: !!mods.capture,\n });\n boundSet.delete(boundKey);\n if (claimsPlain) boundSet.delete(plainKey);\n });\n }\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bindRefDirectives.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindRefDirectives.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,0NAA0N;AAC1N,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,gBAAgB,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAyBN"}
1
+ {"version":3,"file":"bindRefDirectives.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindRefDirectives.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,0NAA0N;AAC1N,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,gBAAgB,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CA0BN"}
@@ -1,3 +1,4 @@
1
+ import { isDeclaredDirective } from './declaredDirective.js';
1
2
  /**
2
3
  * Binds ref directives to DOM elements using [data-ref] attributes.
3
4
  *
@@ -13,7 +14,7 @@
13
14
  export function bindRefDirectives(fragment, context, disposers) {
14
15
  fragment.querySelectorAll('[data-ref]').forEach(el => {
15
16
  Array.from(el.attributes).forEach(attr => {
16
- if (!attr.name.startsWith('data-ref'))
17
+ if (!attr.name.startsWith('data-ref') || !isDeclaredDirective(attr))
17
18
  return;
18
19
  const refName = attr.value;
19
20
  // Skip empty refs
@@ -1 +1 @@
1
- {"version":3,"file":"bindRefDirectives.js","sourceRoot":"","sources":["../../../src/compile/binds/bindRefDirectives.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,0NAA0N;AAC1N,MAAM,UAAU,iBAAiB,CAC/B,QAAoC,EACpC,OAAgC,EAChC,SAAyB;IAEzB,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;gBAAE,OAAO;YAE9C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;YAE3B,kBAAkB;YAClB,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAmB,CAAC;YAE/C,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;gBACzC,gCAAgC;gBAChC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAEZ,qEAAqE;gBACrE,mEAAmE;gBACnE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE9B,qCAAqC;gBACrC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"bindRefDirectives.js","sourceRoot":"","sources":["../../../src/compile/binds/bindRefDirectives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;;;;;;;;;GAUG;AAEH,0NAA0N;AAC1N,MAAM,UAAU,iBAAiB,CAC/B,QAAoC,EACpC,OAAgC,EAChC,SAAyB;IAEzB,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC;gBACjE,OAAO;YAET,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;YAE3B,kBAAkB;YAClB,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAmB,CAAC;YAE/C,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;gBACzC,gCAAgC;gBAChC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAEZ,qEAAqE;gBACrE,mEAAmE;gBACnE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE9B,qCAAqC;gBACrC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isDeclaredDirective } from './declaredDirective';\nimport type { Ref } from '../../interfaces/ref.interface';\n\n/**\n * Binds ref directives to DOM elements using [data-ref] attributes.\n *\n * This function handles element references by binding elements with [data-ref]\n * attributes to their corresponding Ref objects in the context. It automatically\n * sets up cleanup when elements are removed.\n *\n * @param fragment - The root DOM node to search for ref directives\n * @param context - Context object containing Ref objects for element references\n * @param disposers - Array to collect cleanup functions that clear references\n */\n\n/** @codexApi {\"parent\":\"pithy.feature.refs\",\"name\":\"bindRefDirectives\",\"stability\":\"stable\",\"signature\":\"(fragment: Element | DocumentFragment, context: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function bindRefDirectives(\n fragment: Element | DocumentFragment,\n context: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n fragment.querySelectorAll('[data-ref]').forEach(el => {\n Array.from(el.attributes).forEach(attr => {\n if (!attr.name.startsWith('data-ref') || !isDeclaredDirective(attr))\n return;\n\n const refName = attr.value;\n\n // Skip empty refs\n if (!refName) return;\n\n const ref = context[refName] as Ref<typeof el>;\n\n if (ref && typeof ref.set === 'function') {\n // Set the reference immediately\n ref.set(el);\n\n // Consume the attribute so a re-scan from an ancestor pipeline can't\n // re-bind this element against another component's same-named ref.\n el.removeAttribute(attr.name);\n\n // Add cleanup to the disposers array\n disposers.push(() => ref.set(null));\n }\n });\n });\n}\n"]}
@@ -0,0 +1,17 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.styles",
4
+ "title": "Style Directive Binding",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /** @codexApi {"parent":"pithy.runtime.styles","name":"bindStyleProperties","stability":"internal","signature":"(el: Element, ctx: Record<string, unknown>, disposers: (() => void)[]) => void"} */
9
+ /**
10
+ * Binds `[style.prop]="expr"`, which the parser emits as `data-style-prop`,
11
+ * through the same `applyStyle` a build uses. Only names the element declared
12
+ * are bound; an author's own `data-style-*` attribute is left alone.
13
+ */
14
+ export declare function bindStyleProperties(el: Element, ctx: Record<string, unknown>, disposers: (() => void)[]): void;
15
+ /** @codexApi {"parent":"pithy.runtime.styles","name":"declaredName","stability":"internal","signature":"(attrName: string, declared: string[]) => string | undefined"} */
16
+ export declare function declaredName(attrName: string, declared: string[]): string | undefined;
17
+ //# sourceMappingURL=bindStyleDirectives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindStyleDirectives.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindStyleDirectives.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAQF,mMAAmM;AACnM;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAwBN;AAMD,0KAA0K;AAC1K,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,SAAS,CAGpB"}
@@ -0,0 +1,48 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.runtime.styles",
4
+ "title": "Style Directive Binding",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ import { isDeclaredDirective } from './declaredDirective.js';
9
+ import { applyStyle } from '../../runtime/bindings/applySimple.js';
10
+ import { nodeExpando } from '../nodeExpando.js';
11
+ const PREFIX = 'data-style-';
12
+ /** @codexApi {"parent":"pithy.runtime.styles","name":"bindStyleProperties","stability":"internal","signature":"(el: Element, ctx: Record<string, unknown>, disposers: (() => void)[]) => void"} */
13
+ /**
14
+ * Binds `[style.prop]="expr"`, which the parser emits as `data-style-prop`,
15
+ * through the same `applyStyle` a build uses. Only names the element declared
16
+ * are bound; an author's own `data-style-*` attribute is left alone.
17
+ */
18
+ export function bindStyleProperties(el, ctx, disposers) {
19
+ let declared;
20
+ for (const attr of Array.from(el.attributes)) {
21
+ if (!attr.name.startsWith(PREFIX))
22
+ continue;
23
+ const expando = nodeExpando(el);
24
+ declared ?? (declared = [
25
+ ...(expando.__styleProps ?? []),
26
+ ...Object.keys(expando.__pithyNode?.directives?.styleMap ?? {}),
27
+ ]);
28
+ const prop = declaredName(attr.name.slice(PREFIX.length), declared);
29
+ if (!prop || !isDeclaredDirective(attr))
30
+ continue;
31
+ el.removeAttribute(attr.name);
32
+ applyStyle({
33
+ t: 'style',
34
+ pid: '',
35
+ prop,
36
+ expr: attr.value,
37
+ }, el, ctx, disposers);
38
+ }
39
+ }
40
+ const asciiLower = (s) => s.replace(/[A-Z]/g, c => c.toLowerCase());
41
+ // HTML lowercases an attribute name and SVG keeps it, both ASCII only, so
42
+ // match the same way: toLowerCase() would merge `Öl` and `öl`.
43
+ /** @codexApi {"parent":"pithy.runtime.styles","name":"declaredName","stability":"internal","signature":"(attrName: string, declared: string[]) => string | undefined"} */
44
+ export function declaredName(attrName, declared) {
45
+ const lower = asciiLower(attrName);
46
+ return declared.find(d => asciiLower(d) === lower);
47
+ }
48
+ //# sourceMappingURL=bindStyleDirectives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindStyleDirectives.js","sourceRoot":"","sources":["../../../src/compile/binds/bindStyleDirectives.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,GAAG,aAAa,CAAC;AAE7B,mMAAmM;AACnM;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,EAAW,EACX,GAA4B,EAC5B,SAAyB;IAEzB,IAAI,QAA8B,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,SAAS;QAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAChC,QAAQ,KAAR,QAAQ,GAAK;YACX,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;YAC/B,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC;SAChE,EAAC;QACF,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAAE,SAAS;QAClD,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,UAAU,CACR;YACE,CAAC,EAAE,OAAO;YACV,GAAG,EAAE,EAAE;YACP,IAAI;YACJ,IAAI,EAAE,IAAI,CAAC,KAAK;SACjB,EACD,EAAE,EACF,GAAG,EACH,SAAS,CACV,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAE5E,0EAA0E;AAC1E,+DAA+D;AAC/D,0KAA0K;AAC1K,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,QAAkB;IAElB,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.styles\",\n \"title\": \"Style Directive Binding\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { isDeclaredDirective } from './declaredDirective';\nimport { applyStyle } from '../../runtime/bindings/applySimple';\nimport { nodeExpando } from '../nodeExpando';\n\nconst PREFIX = 'data-style-';\n\n/** @codexApi {\"parent\":\"pithy.runtime.styles\",\"name\":\"bindStyleProperties\",\"stability\":\"internal\",\"signature\":\"(el: Element, ctx: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\n/**\n * Binds `[style.prop]=\"expr\"`, which the parser emits as `data-style-prop`,\n * through the same `applyStyle` a build uses. Only names the element declared\n * are bound; an author's own `data-style-*` attribute is left alone.\n */\nexport function bindStyleProperties(\n el: Element,\n ctx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n let declared: string[] | undefined;\n for (const attr of Array.from(el.attributes)) {\n if (!attr.name.startsWith(PREFIX)) continue;\n const expando = nodeExpando(el);\n declared ??= [\n ...(expando.__styleProps ?? []),\n ...Object.keys(expando.__pithyNode?.directives?.styleMap ?? {}),\n ];\n const prop = declaredName(attr.name.slice(PREFIX.length), declared);\n if (!prop || !isDeclaredDirective(attr)) continue;\n el.removeAttribute(attr.name);\n applyStyle(\n {\n t: 'style',\n pid: '',\n prop,\n expr: attr.value,\n },\n el,\n ctx,\n disposers\n );\n }\n}\n\nconst asciiLower = (s: string) => s.replace(/[A-Z]/g, c => c.toLowerCase());\n\n// HTML lowercases an attribute name and SVG keeps it, both ASCII only, so\n// match the same way: toLowerCase() would merge `Öl` and `öl`.\n/** @codexApi {\"parent\":\"pithy.runtime.styles\",\"name\":\"declaredName\",\"stability\":\"internal\",\"signature\":\"(attrName: string, declared: string[]) => string | undefined\"} */\nexport function declaredName(\n attrName: string,\n declared: string[]\n): string | undefined {\n const lower = asciiLower(attrName);\n return declared.find(d => asciiLower(d) === lower);\n}\n"]}
@@ -7,10 +7,12 @@
7
7
  */
8
8
  /**
9
9
  * Bind all text interpolations (e.g. "Hello {{name()}}") under `root`.
10
+ * - Binds only text still as the template parser created it.
10
11
  * - Skips nested-loop subtrees (tagged with __pithySkipText) and real @for/data-for hosts.
12
+ * - Skips DOM a component rendered (__pithyComponentDom); the component bound it itself.
11
13
  * - Binds per-text-node updates with fine-grained effects.
12
14
  */
13
15
  /** @codexApi {"parent":"pithy.runtime.interpolations","name":"bindTextInterpolations","stability":"stable","signature":"(root: Element | DocumentFragment, ctx: Record<string, unknown>, disposers: (() => void)[]) => void"} */
14
- export declare function bindTextInterpolations(root: Element | DocumentFragment, ctx: Record<string, unknown>, disposers: (() => void)[]): void;
15
- export declare function flashUpdate(node: Text | HTMLElement): void;
16
+ export declare function bindTextInterpolations(root: Element | DocumentFragment, _ctx: Record<string, unknown>, disposers: (() => void)[]): void;
17
+ export declare function flashUpdate(node: Text | Element): void;
16
18
  //# sourceMappingURL=bindTextInterpolations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bindTextInterpolations.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindTextInterpolations.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAWF;;;;GAIG;AACH,iOAAiO;AACjO,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAGN;AA6UD,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,IAAI,CAU1D"}
1
+ {"version":3,"file":"bindTextInterpolations.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindTextInterpolations.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAYF;;;;;;GAMG;AACH,iOAAiO;AACjO,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAGN;AA0UD,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CActD"}
@@ -5,22 +5,25 @@
5
5
  "category": "runtime"
6
6
  }
7
7
  */
8
- import { defaultConfig } from '../../config';
8
+ import { defaultConfig } from '../../config/index.js';
9
9
  import { effect, isSignal } from '@pithyjs/signals';
10
- import { toTextValue } from '../textValue';
11
- import { compileExpression } from '../compileExpression';
12
- import { isSSRMode } from '../ssrMode';
13
- import { nodeExpando } from '../nodeExpando';
10
+ import { toTextValue } from '../textValue.js';
11
+ import { compileExpression } from '../compileExpression.js';
12
+ import { isSSRMode } from '../ssrMode.js';
13
+ import { textEvalMessage } from '../evalDiagnostics.js';
14
+ import { nodeExpando } from '../nodeExpando.js';
14
15
  const INTERPOLATION_RE = /{{\s*([\s\S]*?)\s*}}/g;
15
16
  /**
16
17
  * Bind all text interpolations (e.g. "Hello {{name()}}") under `root`.
18
+ * - Binds only text still as the template parser created it.
17
19
  * - Skips nested-loop subtrees (tagged with __pithySkipText) and real @for/data-for hosts.
20
+ * - Skips DOM a component rendered (__pithyComponentDom); the component bound it itself.
18
21
  * - Binds per-text-node updates with fine-grained effects.
19
22
  */
20
23
  /** @codexApi {"parent":"pithy.runtime.interpolations","name":"bindTextInterpolations","stability":"stable","signature":"(root: Element | DocumentFragment, ctx: Record<string, unknown>, disposers: (() => void)[]) => void"} */
21
- export function bindTextInterpolations(root, ctx, disposers) {
22
- processChildNodes(root, ctx, disposers);
23
- bindRemainingTextInterpolations(root, ctx, disposers);
24
+ export function bindTextInterpolations(root, _ctx, disposers) {
25
+ processChildNodes(root, disposers);
26
+ bindRemainingTextInterpolations(root, disposers);
24
27
  }
25
28
  /* -----------------------------------------------------------------------------
26
29
  * Internal: robust child iteration (Element | DocumentFragment)
@@ -41,36 +44,40 @@ function childElementsOf(root) {
41
44
  * We purposely avoid stepping into nested-loop subtrees to prevent compiling
42
45
  * expressions like {{ item() }} against the parent context.
43
46
  */
44
- function processChildNodes(root, ctx, disposers) {
47
+ function processChildNodes(root, disposers) {
45
48
  for (const child of childElementsOf(root)) {
46
49
  // Fast-path: if the child itself is a loop host, we skip it entirely.
47
- if (child.hasAttribute?.('@for') || nodeExpando(child).__pithySkipText)
50
+ if (child.hasAttribute?.('@for') ||
51
+ nodeExpando(child).__pithySkipText ||
52
+ nodeExpando(child).__pithyComponentDom)
48
53
  continue;
49
54
  const walker = document.createTreeWalker(child, NodeFilter.SHOW_TEXT);
50
55
  const targets = [];
51
56
  let textNode;
52
57
  while ((textNode = walker.nextNode())) {
53
- const rawText = textNode?.nodeValue || '';
54
- if (!rawText.includes('{{'))
58
+ if (!isTemplateText(textNode))
55
59
  continue;
56
60
  // Skip anything inside a nested loop host or explicit @for/data-for
57
- if (isInsideSkippedZone(textNode))
61
+ if (isInsideSkippedZone(textNode, root))
58
62
  continue;
59
63
  targets.push(textNode);
60
64
  }
61
65
  // Mutate after collecting to avoid invalidating the walker during traversal.
62
66
  for (const node of targets) {
67
+ // An earlier interpolation in this loop can write into a queued node.
68
+ if (!isTemplateText(node))
69
+ continue;
63
70
  const rawText = node.nodeValue || '';
64
71
  const parts = parseTextIntoParts(rawText);
65
72
  const parent = node.parentElement;
66
73
  const nextSibling = node.nextSibling;
67
74
  if (!parent)
68
75
  continue;
69
- // Use the node's own __pithyCtx when available (set by pithyTreeToDom).
76
+ // Use the node's own __pithyCtx (set by pithyTreeToDom).
70
77
  // Projected slot content carries the *parent* component's context this way,
71
- // while the passed `ctx` is the *child* component's context.
78
+ // not the context of the component whose template holds the slot.
72
79
  // This mirrors the nearestCtx pattern used by bindEventHandlers.
73
- const nodeCtx = nodeExpando(node).__pithyCtx || ctx;
80
+ const nodeCtx = nodeExpando(node).__pithyCtx;
74
81
  parent.removeChild(node);
75
82
  for (const part of parts) {
76
83
  if (part.type === 'static') {
@@ -107,23 +114,25 @@ function processChildNodes(root, ctx, disposers) {
107
114
  * Second pass: text nodes directly under `root` (e.g., loose text, or nodes
108
115
  * not caught by processChildNodes). Also respects skip zones.
109
116
  */
110
- function bindRemainingTextInterpolations(root, ctx, disposers) {
117
+ function bindRemainingTextInterpolations(root, disposers) {
111
118
  const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
112
119
  let node;
113
120
  while ((node = walker.nextNode())) {
114
- const rawText = node?.nodeValue;
115
- if (!rawText || !rawText.includes('{{'))
121
+ if (!isTemplateText(node))
116
122
  continue;
123
+ const rawText = node.nodeValue;
117
124
  // Robust skip: private flag, @for, or data-for anywhere up the chain.
118
- if (isInsideSkippedZone(node))
125
+ if (isInsideSkippedZone(node, root))
119
126
  continue;
120
127
  INTERPOLATION_RE.lastIndex = 0;
121
128
  const matches = [...rawText.matchAll(INTERPOLATION_RE)];
122
129
  if (matches.length === 0)
123
130
  continue;
124
- // Use the node's own __pithyCtx when available (projected slot content
131
+ // Use the node's own __pithyCtx (projected slot content
125
132
  // carries the parent component's context via this property).
126
- const nodeCtx = nodeExpando(node).__pithyCtx || ctx;
133
+ const nodeCtx = nodeExpando(node).__pithyCtx;
134
+ // The node keeps its identity and now holds a value: an outer pass must not read it.
135
+ nodeExpando(node).__pithyCtx = undefined;
127
136
  const renderFns = [];
128
137
  const matchStrings = [];
129
138
  const expressions = [];
@@ -179,8 +188,8 @@ function bindTextNodeUpdates(node, rawText, expressions, matchStrings, renderFns
179
188
  // must be inserted verbatim (e.g. literal code like `str.replace(/a/, '$&')`).
180
189
  output = output.replace(matchStrings[i], () => toTextValue(result));
181
190
  }
182
- catch {
183
- // On evaluation failure, blank out the interpolation instead of throwing
191
+ catch (err) {
192
+ console.error(textEvalMessage(expressions[i]), err);
184
193
  output = output.replace(matchStrings[i], '');
185
194
  }
186
195
  });
@@ -215,7 +224,7 @@ function bindDynamicTextNode(textNode, expression, ctx, disposers, highlightTarg
215
224
  textNode.nodeValue = toTextValue(compiledFn());
216
225
  }
217
226
  catch (err) {
218
- console.error(`[bindDynamicTextNode] ❌ Error evaluating '${expression}'`, err);
227
+ console.error(textEvalMessage(expression), err);
219
228
  textNode.nodeValue = '';
220
229
  }
221
230
  }
@@ -238,15 +247,16 @@ function bindDynamicTextNode(textNode, expression, ctx, disposers, highlightTarg
238
247
  }
239
248
  }
240
249
  catch (err) {
241
- console.error(`[bindDynamicTextNode] ❌ Error evaluating '${expression}'`, err);
250
+ console.error(textEvalMessage(expression), err);
242
251
  textNode.nodeValue = '';
252
+ lastValue = '';
243
253
  }
244
254
  });
245
255
  disposers.push(stop);
246
256
  }
247
257
  }
248
258
  catch (err) {
249
- console.error(`[bindDynamicTextNode] ❌ Failed to compile: ${expression}`, err);
259
+ console.error(`[PithyJS] ❌ Failed to compile: ${expression}`, err);
250
260
  }
251
261
  }
252
262
  /* -----------------------------------------------------------------------------
@@ -259,7 +269,7 @@ export function flashUpdate(node) {
259
269
  const { highlightColor, highlightDuration, devHighlightDomUpdates } = defaultConfig;
260
270
  if (!import.meta.env?.DEV || !devHighlightDomUpdates)
261
271
  return;
262
- if (node instanceof Text) {
272
+ if (node.nodeType === Node.TEXT_NODE) {
263
273
  flashTextNode(node, highlightColor || '', highlightDuration || 0.2);
264
274
  }
265
275
  else {
@@ -273,6 +283,7 @@ let flashScheduled = false;
273
283
  // one (rapidly-updating bindings flash the same element in overlapping
274
284
  // windows).
275
285
  const flashTimers = new WeakMap();
286
+ const flashOriginals = new WeakMap();
276
287
  function enqueueFlash(el, color, duration) {
277
288
  flashQueue.add(el);
278
289
  if (flashScheduled)
@@ -287,17 +298,44 @@ function enqueueFlash(el, color, duration) {
287
298
  if (pending.clear !== undefined)
288
299
  clearTimeout(pending.clear);
289
300
  }
290
- t.style.transition = `background-color ${duration}s ease-out`;
291
- t.style.backgroundColor = color;
301
+ const { style } = t;
302
+ let original = flashOriginals.get(t);
303
+ if (!original) {
304
+ original = {
305
+ transition: style.transition,
306
+ backgroundColor: style.backgroundColor,
307
+ flashTransition: '',
308
+ flashBackground: '',
309
+ };
310
+ flashOriginals.set(t, original);
311
+ }
312
+ else {
313
+ if (style.transition !== original.flashTransition) {
314
+ original.transition = style.transition;
315
+ }
316
+ if (style.backgroundColor !== original.flashBackground) {
317
+ original.backgroundColor = style.backgroundColor;
318
+ }
319
+ }
320
+ const saved = original;
321
+ style.transition = `background-color ${duration}s ease-out`;
322
+ style.backgroundColor = color;
323
+ saved.flashTransition = style.transition;
324
+ saved.flashBackground = style.backgroundColor;
292
325
  const fade = setTimeout(() => {
293
- // Clear, don't set "transparent" — an explicit inline value would
326
+ // Restore, don't set "transparent" — an explicit inline value would
294
327
  // permanently override the element's stylesheet background. Runs
295
328
  // even for disconnected nodes so a reattached element doesn't keep
296
329
  // stale inline highlight styles.
297
- t.style.backgroundColor = '';
330
+ if (style.backgroundColor === saved.flashBackground) {
331
+ style.backgroundColor = saved.backgroundColor;
332
+ }
298
333
  const clear = setTimeout(() => {
299
- t.style.transition = '';
334
+ if (style.transition === saved.flashTransition) {
335
+ style.transition = saved.transition;
336
+ }
300
337
  flashTimers.delete(t);
338
+ flashOriginals.delete(t);
301
339
  }, duration * 1000);
302
340
  flashTimers.set(t, { fade, clear });
303
341
  }, 80);
@@ -369,6 +407,13 @@ function parseTextIntoParts(rawText) {
369
407
  }
370
408
  return parts;
371
409
  }
410
+ function isTemplateText(node) {
411
+ const { __pithyCtx, __pithyNode } = nodeExpando(node);
412
+ return (__pithyCtx !== undefined &&
413
+ !__pithyNode?.inert &&
414
+ __pithyNode?.textContent === node.nodeValue &&
415
+ !!node.nodeValue?.includes('{{'));
416
+ }
372
417
  /**
373
418
  * Is the expression a signal call? (e.g., count(), user.tags())
374
419
  * We compile the callee (without "()") and ask isSignal() on the result.
@@ -390,12 +435,19 @@ function isSignalExpression(expr, ctx) {
390
435
  /**
391
436
  * Returns true if `node` is inside any subtree we must not text-bind now:
392
437
  * - A nested-loop host we tagged earlier: __pithySkipText
438
+ * - A node a component rendered, or one inside it: __pithyComponentDom
393
439
  * - An element that still carries @for or data-for (depending on compiler phase)
394
440
  */
395
- function isInsideSkippedZone(node) {
441
+ function isInsideSkippedZone(node, root) {
442
+ if (nodeExpando(node).__pithyComponentDom)
443
+ return true;
444
+ let insideRoot = true;
396
445
  let p = node instanceof Element ? node : node.parentElement;
397
446
  while (p) {
398
- if (nodeExpando(p).__pithySkipText)
447
+ if (p === root)
448
+ insideRoot = false;
449
+ if (nodeExpando(p).__pithySkipText ||
450
+ (insideRoot && nodeExpando(p).__pithyComponentDom))
399
451
  return true;
400
452
  if (p.hasAttribute &&
401
453
  (p.hasAttribute('@for') || p.hasAttribute('data-for'))) {
@@ -1 +1 @@
1
- {"version":3,"file":"bindTextInterpolations.js","sourceRoot":"","sources":["../../../src/compile/binds/bindTextInterpolations.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEjD;;;;GAIG;AACH,iOAAiO;AACjO,MAAM,UAAU,sBAAsB,CACpC,IAAgC,EAChC,GAA4B,EAC5B,SAAyB;IAEzB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IACxC,+BAA+B,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AACxD,CAAC;AAED;;gFAEgF;AAChF,SAAS,eAAe,CAAC,IAAgC;IACvD,IAAI,IAAI,YAAY,OAAO;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9D,yEAAyE;IACzE,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC1B,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAAE,GAAG,CAAC,IAAI,CAAC,CAAY,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CACxB,IAAgC,EAChC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CAAC;QACT,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe;YAAE,OAAO,IAAI,CAAC;QAChD,IACE,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EACtD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"bindTextInterpolations.js","sourceRoot":"","sources":["../../../src/compile/binds/bindTextInterpolations.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEjD;;;;;;GAMG;AACH,iOAAiO;AACjO,MAAM,UAAU,sBAAsB,CACpC,IAAgC,EAChC,IAA6B,EAC7B,SAAyB;IAEzB,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnC,+BAA+B,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED;;gFAEgF;AAChF,SAAS,eAAe,CAAC,IAAgC;IACvD,IAAI,IAAI,YAAY,OAAO;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9D,yEAAyE;IACzE,MAA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AK,CAAC;AACf,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.interpolations\",\n \"title\": \"Text Interpolation Binding System\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { defaultConfig } from '../../config';\nimport { effect, isSignal } from '@pithyjs/signals';\nimport { toTextValue } from '../textValue';\nimport { compileExpression } from '../compileExpression';\nimport { isSSRMode } from '../ssrMode';\nimport { textEvalMessage } from '../evalDiagnostics';\nimport { nodeExpando } from '../nodeExpando';\n\nconst INTERPOLATION_RE = /{{\\s*([\\s\\S]*?)\\s*}}/g;\n\n/**\n * Bind all text interpolations (e.g. \"Hello {{name()}}\") under `root`.\n * - Binds only text still as the template parser created it.\n * - Skips nested-loop subtrees (tagged with __pithySkipText) and real @for/data-for hosts.\n * - Skips DOM a component rendered (__pithyComponentDom); the component bound it itself.\n * - Binds per-text-node updates with fine-grained effects.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.interpolations\",\"name\":\"bindTextInterpolations\",\"stability\":\"stable\",\"signature\":\"(root: Element | DocumentFragment, ctx: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function bindTextInterpolations(\n root: Element | DocumentFragment,\n _ctx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n processChildNodes(root, disposers);\n bindRemainingTextInterpolations(root, disposers);\n}\n\n/* -----------------------------------------------------------------------------\n * Internal: robust child iteration (Element | DocumentFragment)\n * ---------------------------------------------------------------------------*/\nfunction childElementsOf(root: Element | DocumentFragment): Element[] {\n if (root instanceof Element) return Array.from(root.children);\n // DocumentFragment doesn't have .children; filter childNodes to elements\n const out: Element[] = [];\n root.childNodes.forEach(n => {\n if (n.nodeType === Node.ELEMENT_NODE) out.push(n as Element);\n });\n return out;\n}\n\n/**\n * Walk immediate children and process text nodes inside them.\n * We purposely avoid stepping into nested-loop subtrees to prevent compiling\n * expressions like {{ item() }} against the parent context.\n */\nfunction processChildNodes(\n root: Element | DocumentFragment,\n disposers: (() => void)[]\n): void {\n for (const child of childElementsOf(root)) {\n // Fast-path: if the child itself is a loop host, we skip it entirely.\n if (\n child.hasAttribute?.('@for') ||\n nodeExpando(child).__pithySkipText ||\n nodeExpando(child).__pithyComponentDom\n )\n continue;\n\n const walker = document.createTreeWalker(child, NodeFilter.SHOW_TEXT);\n const targets: Text[] = [];\n let textNode: Text | null;\n\n while ((textNode = walker.nextNode() as Text | null)) {\n if (!isTemplateText(textNode)) continue;\n\n // Skip anything inside a nested loop host or explicit @for/data-for\n if (isInsideSkippedZone(textNode, root)) continue;\n\n targets.push(textNode);\n }\n\n // Mutate after collecting to avoid invalidating the walker during traversal.\n for (const node of targets) {\n // An earlier interpolation in this loop can write into a queued node.\n if (!isTemplateText(node)) continue;\n const rawText = node.nodeValue || '';\n const parts = parseTextIntoParts(rawText);\n const parent = node.parentElement;\n const nextSibling = node.nextSibling;\n if (!parent) continue;\n\n // Use the node's own __pithyCtx (set by pithyTreeToDom).\n // Projected slot content carries the *parent* component's context this way,\n // not the context of the component whose template holds the slot.\n // This mirrors the nearestCtx pattern used by bindEventHandlers.\n const nodeCtx = nodeExpando(node).__pithyCtx!;\n\n parent.removeChild(node);\n\n for (const part of parts) {\n if (part.type === 'static') {\n insertStaticTextNode(parent, nextSibling, part.value);\n } else {\n // Determine interpolation mode based on config\n const mode = defaultConfig.textInterpolationMode || 'text-node';\n const isSignal = isSignalExpression(part.value, nodeCtx);\n\n // Choose insertion strategy\n if (mode === 'span') {\n // Always use span wrappers\n insertDynamicSpan(\n parent,\n nextSibling,\n part.value,\n nodeCtx,\n disposers\n );\n } else if (mode === 'text-node') {\n // Always use text nodes with comment anchors\n insertDynamicTextNode(\n parent,\n nextSibling,\n part.value,\n nodeCtx,\n disposers\n );\n } else {\n // 'auto' mode: span for signals if autoWrapSignals is true, text node otherwise\n if (isSignal && defaultConfig.autoWrapSignals) {\n insertDynamicSpan(\n parent,\n nextSibling,\n part.value,\n nodeCtx,\n disposers\n );\n } else {\n insertDynamicTextNode(\n parent,\n nextSibling,\n part.value,\n nodeCtx,\n disposers\n );\n }\n }\n }\n }\n }\n }\n}\n\n/**\n * Second pass: text nodes directly under `root` (e.g., loose text, or nodes\n * not caught by processChildNodes). Also respects skip zones.\n */\nfunction bindRemainingTextInterpolations(\n root: Element | DocumentFragment,\n disposers: (() => void)[]\n): void {\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n\n let node: Text | null;\n while ((node = walker.nextNode() as Text | null)) {\n if (!isTemplateText(node)) continue;\n const rawText = node.nodeValue!;\n\n // Robust skip: private flag, @for, or data-for anywhere up the chain.\n if (isInsideSkippedZone(node, root)) continue;\n\n INTERPOLATION_RE.lastIndex = 0;\n const matches = [...rawText.matchAll(INTERPOLATION_RE)];\n if (matches.length === 0) continue;\n\n // Use the node's own __pithyCtx (projected slot content\n // carries the parent component's context via this property).\n const nodeCtx = nodeExpando(node).__pithyCtx!;\n // The node keeps its identity and now holds a value: an outer pass must not read it.\n nodeExpando(node).__pithyCtx = undefined;\n\n const renderFns: (() => unknown)[] = [];\n const matchStrings: string[] = [];\n const expressions: string[] = [];\n\n for (const match of matches) {\n const expr = match[1].trim();\n matchStrings.push(match[0]);\n expressions.push(expr);\n renderFns.push(compileExpression(expr, nodeCtx));\n }\n\n bindTextNodeUpdates(\n node,\n rawText,\n expressions,\n matchStrings,\n renderFns,\n disposers\n );\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Node insertion helpers\n * ---------------------------------------------------------------------------*/\nfunction insertStaticTextNode(\n parent: Element,\n nextSibling: ChildNode | null,\n text: string\n): void {\n const staticNode = document.createTextNode(text);\n parent.insertBefore(staticNode, nextSibling);\n}\n\nfunction insertDynamicSpan(\n parent: Element,\n nextSibling: ChildNode | null,\n expression: string,\n ctx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n const span = document.createElement('span');\n span.className = 'r-pithy';\n span.style.display = 'inline';\n\n const textNode = document.createTextNode('');\n span.appendChild(textNode);\n parent.insertBefore(span, nextSibling);\n\n bindDynamicTextNode(textNode, expression, ctx, disposers, span);\n}\n\nfunction insertDynamicTextNode(\n parent: Element,\n nextSibling: ChildNode | null,\n expression: string,\n ctx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n // Create comment anchors for structural markers (Solid.js approach)\n // This provides better debugging and potential future optimizations\n const startComment = document.createComment('t');\n const textNode = document.createTextNode('');\n const endComment = document.createComment('/t');\n\n // Insert in order: start comment, text node, end comment\n parent.insertBefore(startComment, nextSibling);\n parent.insertBefore(textNode, nextSibling);\n parent.insertBefore(endComment, nextSibling);\n\n bindDynamicTextNode(textNode, expression, ctx, disposers);\n}\n\n/* -----------------------------------------------------------------------------\n * Binding helpers\n * ---------------------------------------------------------------------------*/\nfunction bindTextNodeUpdates(\n node: Text,\n rawText: string,\n expressions: string[],\n matchStrings: string[],\n renderFns: (() => unknown)[],\n disposers: (() => void)[]\n): void {\n function evaluate() {\n let output = rawText;\n\n // Evaluate each {{ expr }} and replace into the original text\n expressions.forEach((_, i) => {\n try {\n const result = renderFns[i](); // compileExpression already closes over ctx\n // Function replacer: never let `$&`, `$$`, `$\\``, `$'`, `$n` in the\n // value be interpreted as String.replace special patterns — the value\n // must be inserted verbatim (e.g. literal code like `str.replace(/a/, '$&')`).\n output = output.replace(matchStrings[i], () => toTextValue(result));\n } catch (err) {\n console.error(textEvalMessage(expressions[i]), err);\n output = output.replace(matchStrings[i], '');\n }\n });\n\n return output;\n }\n\n if (isSSRMode()) {\n // SSR mode: evaluate once synchronously, no reactive effects\n node.nodeValue = evaluate();\n } else {\n let lastInterpolatedText: string | undefined;\n\n const stop = effect(() => {\n const output = evaluate();\n\n if (output !== lastInterpolatedText) {\n node.nodeValue = output;\n flashUpdate(node);\n lastInterpolatedText = output;\n }\n });\n\n disposers.push(stop);\n }\n}\n\n/**\n * Bind a single dynamic expression into a text node, with optional highlight target (e.g., wrapper span).\n */\nfunction bindDynamicTextNode(\n textNode: Text,\n expression: string,\n ctx: Record<string, unknown>,\n disposers: (() => void)[],\n highlightTarget?: HTMLElement\n): void {\n try {\n const compiledFn = compileExpression(expression, ctx);\n\n if (isSSRMode()) {\n // SSR mode: evaluate once synchronously, no reactive effects\n try {\n textNode.nodeValue = toTextValue(compiledFn());\n } catch (err) {\n console.error(textEvalMessage(expression), err);\n textNode.nodeValue = '';\n }\n } else {\n let lastValue: string | undefined;\n\n const stop = effect(() => {\n try {\n const result = compiledFn(); // re-evaluates reactively\n const next = toTextValue(result); // ensure string\n\n if (next !== lastValue) {\n // only mutate/flash on change\n textNode.nodeValue = next;\n\n if (highlightTarget) {\n flashUpdate(highlightTarget);\n } else {\n flashUpdate(textNode);\n }\n\n lastValue = next;\n }\n } catch (err) {\n console.error(textEvalMessage(expression), err);\n textNode.nodeValue = '';\n lastValue = '';\n }\n });\n\n disposers.push(stop);\n }\n } catch (err) {\n console.error(`[PithyJS] ❌ Failed to compile: ${expression}`, err);\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Batched flashing (dev only). Reduces style/layout churn vs per-node inline updates.\n *\n * For text nodes, we create temporary positioned overlays at the exact text location\n * to provide visual feedback without adding permanent DOM nodes or flashing parent elements.\n * ---------------------------------------------------------------------------*/\nexport function flashUpdate(node: Text | Element): void {\n const { highlightColor, highlightDuration, devHighlightDomUpdates } =\n defaultConfig;\n if (!import.meta.env?.DEV || !devHighlightDomUpdates) return;\n\n if (node.nodeType === Node.TEXT_NODE) {\n flashTextNode(node as Text, highlightColor || '', highlightDuration || 0.2);\n } else {\n enqueueFlash(\n node as HTMLElement,\n highlightColor || '',\n highlightDuration || 0.2\n );\n }\n}\n\nconst flashQueue = new Set<HTMLElement>();\nlet flashScheduled = false;\n// Pending cleanup timers per element — cancelled on re-flash so a previous\n// flash's timers can't clear the background/transition mid-fade of a newer\n// one (rapidly-updating bindings flash the same element in overlapping\n// windows).\nconst flashTimers = new WeakMap<\n HTMLElement,\n { fade: ReturnType<typeof setTimeout>; clear?: ReturnType<typeof setTimeout> }\n>();\nconst flashOriginals = new WeakMap<\n HTMLElement,\n {\n transition: string;\n backgroundColor: string;\n flashTransition: string;\n flashBackground: string;\n }\n>();\n\nfunction enqueueFlash(el: HTMLElement, color: string, duration: number) {\n flashQueue.add(el);\n if (flashScheduled) return;\n flashScheduled = true;\n\n requestAnimationFrame(() => {\n // Apply highlight to all queued nodes at once\n flashQueue.forEach(t => {\n const pending = flashTimers.get(t);\n if (pending) {\n clearTimeout(pending.fade);\n if (pending.clear !== undefined) clearTimeout(pending.clear);\n }\n const { style } = t;\n let original = flashOriginals.get(t);\n if (!original) {\n original = {\n transition: style.transition,\n backgroundColor: style.backgroundColor,\n flashTransition: '',\n flashBackground: '',\n };\n flashOriginals.set(t, original);\n } else {\n if (style.transition !== original.flashTransition) {\n original.transition = style.transition;\n }\n if (style.backgroundColor !== original.flashBackground) {\n original.backgroundColor = style.backgroundColor;\n }\n }\n const saved = original;\n\n style.transition = `background-color ${duration}s ease-out`;\n style.backgroundColor = color;\n saved.flashTransition = style.transition;\n saved.flashBackground = style.backgroundColor;\n\n const fade = setTimeout(() => {\n // Restore, don't set \"transparent\" — an explicit inline value would\n // permanently override the element's stylesheet background. Runs\n // even for disconnected nodes so a reattached element doesn't keep\n // stale inline highlight styles.\n if (style.backgroundColor === saved.flashBackground) {\n style.backgroundColor = saved.backgroundColor;\n }\n const clear = setTimeout(() => {\n if (style.transition === saved.flashTransition) {\n style.transition = saved.transition;\n }\n flashTimers.delete(t);\n flashOriginals.delete(t);\n }, duration * 1000);\n flashTimers.set(t, { fade, clear });\n }, 80);\n flashTimers.set(t, { fade });\n });\n\n flashQueue.clear();\n flashScheduled = false;\n });\n}\n\n/**\n * Flash a text node update by creating a temporary positioned overlay.\n * This provides visual feedback for text-node mode without permanent DOM nodes.\n */\nfunction flashTextNode(textNode: Text, color: string, duration: number) {\n if (!textNode.parentElement) return;\n\n // Get the exact bounding rect of the text node\n const range = document.createRange();\n range.selectNodeContents(textNode);\n const rect = range.getBoundingClientRect();\n range.detach();\n\n // Skip if text has no dimensions (empty or not rendered)\n if (rect.width === 0 || rect.height === 0) return;\n\n // Create temporary overlay positioned exactly over the text\n const overlay = document.createElement('div');\n overlay.style.cssText = `\n position: fixed;\n left: ${rect.left}px;\n top: ${rect.top}px;\n width: ${rect.width}px;\n height: ${rect.height}px;\n background-color: ${color};\n pointer-events: none;\n z-index: 999999;\n transition: opacity ${duration}s ease-out;\n opacity: 0.6;\n border-radius: 2px;\n `;\n\n document.body.appendChild(overlay);\n\n // Fade out and remove\n requestAnimationFrame(() => {\n overlay.style.opacity = '0';\n\n setTimeout(() => {\n overlay.remove();\n }, duration * 1000);\n });\n}\n\n/* -----------------------------------------------------------------------------\n * Text parsing & expression helpers\n * ---------------------------------------------------------------------------*/\nfunction parseTextIntoParts(\n rawText: string\n): { type: 'static' | 'dynamic'; value: string }[] {\n const parts: { type: 'static' | 'dynamic'; value: string }[] = [];\n\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n INTERPOLATION_RE.lastIndex = 0;\n while ((match = INTERPOLATION_RE.exec(rawText)) !== null) {\n if (match.index > lastIndex) {\n parts.push({\n type: 'static',\n value: rawText.slice(lastIndex, match.index),\n });\n }\n parts.push({ type: 'dynamic', value: match[1].trim() });\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < rawText.length) {\n parts.push({ type: 'static', value: rawText.slice(lastIndex) });\n }\n\n return parts;\n}\n\nfunction isTemplateText(node: Text): boolean {\n const { __pithyCtx, __pithyNode } = nodeExpando(node);\n return (\n __pithyCtx !== undefined &&\n !__pithyNode?.inert &&\n __pithyNode?.textContent === node.nodeValue &&\n !!node.nodeValue?.includes('{{')\n );\n}\n\n/**\n * Is the expression a signal call? (e.g., count(), user.tags())\n * We compile the callee (without \"()\") and ask isSignal() on the result.\n */\nfunction isSignalExpression(\n expr: string,\n ctx: Record<string, unknown>\n): boolean {\n // Quick test: must end with \"()\"\n if (!/\\(\\)$/.test(expr)) return false;\n\n try {\n const functionExpr = expr.replace(/\\(\\)$/, '');\n const compiledFn = compileExpression(functionExpr, ctx);\n const signalFunction = compiledFn();\n return isSignal(signalFunction);\n } catch {\n return false;\n }\n}\n\n/**\n * Returns true if `node` is inside any subtree we must not text-bind now:\n * - A nested-loop host we tagged earlier: __pithySkipText\n * - A node a component rendered, or one inside it: __pithyComponentDom\n * - An element that still carries @for or data-for (depending on compiler phase)\n */\nfunction isInsideSkippedZone(\n node: Node,\n root: Element | DocumentFragment\n): boolean {\n if (nodeExpando(node).__pithyComponentDom) return true;\n let insideRoot = true;\n let p: Element | null = node instanceof Element ? node : node.parentElement;\n while (p) {\n if (p === root) insideRoot = false;\n if (\n nodeExpando(p).__pithySkipText ||\n (insideRoot && nodeExpando(p).__pithyComponentDom)\n )\n return true;\n if (\n p.hasAttribute &&\n (p.hasAttribute('@for') || p.hasAttribute('data-for'))\n ) {\n return true;\n }\n p = p.parentElement;\n }\n return false;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Whether a directive attribute holds what a template wrote. A binder may
3
+ * compile the value only then: `[data-on-click]` or a component can put data
4
+ * into the same attribute, and a nested pass sees it. The value is compared
5
+ * as well as the name, since such a write can replace a declared directive.
6
+ */
7
+ export declare function isDeclaredDirective(attr: Attr): boolean;
8
+ /** Whether a template wrote this attribute as a plain, unbound attribute. */
9
+ export declare function isTemplateAttr({ name, value, ownerElement }: Attr): boolean;
10
+ /** The value of `name` on `el`, if a template wrote it. */
11
+ export declare function declaredValue(el: Element, name: string): string | undefined;
12
+ //# sourceMappingURL=declaredDirective.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaredDirective.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/declaredDirective.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAgBvD;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,IAAI,GAAG,OAAO,CAG3E;AAED,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG3E"}
@@ -0,0 +1,42 @@
1
+ import { forEachDirectiveAttr } from '@pithyjs/compiler';
2
+ import { nodeExpando } from '../nodeExpando.js';
3
+ const asciiLower = (s) => s.replace(/[A-Z]/g, c => c.toLowerCase());
4
+ /**
5
+ * Whether a directive attribute holds what a template wrote. A binder may
6
+ * compile the value only then: `[data-on-click]` or a component can put data
7
+ * into the same attribute, and a nested pass sees it. The value is compared
8
+ * as well as the name, since such a write can replace a declared directive.
9
+ */
10
+ export function isDeclaredDirective(attr) {
11
+ const { name, value, ownerElement: el } = attr;
12
+ if (!el)
13
+ return false;
14
+ const expando = nodeExpando(el);
15
+ if (expando.__forwardedDirectives?.get(name) === value)
16
+ return true;
17
+ const node = expando.__pithyNode;
18
+ if (!node || node.inert)
19
+ return false;
20
+ if (isTemplateAttr(attr))
21
+ return true;
22
+ let declared = false;
23
+ if (node.directives) {
24
+ const lower = asciiLower(name);
25
+ forEachDirectiveAttr(node.directives, (attrName, expr) => {
26
+ if (expr === value && asciiLower(attrName) === lower)
27
+ declared = true;
28
+ });
29
+ }
30
+ return declared;
31
+ }
32
+ /** Whether a template wrote this attribute as a plain, unbound attribute. */
33
+ export function isTemplateAttr({ name, value, ownerElement }) {
34
+ const attrs = ownerElement && nodeExpando(ownerElement).__pithyNode?.attrs;
35
+ return attrs?.[name] === value || attrs?.[asciiLower(name)] === value;
36
+ }
37
+ /** The value of `name` on `el`, if a template wrote it. */
38
+ export function declaredValue(el, name) {
39
+ const attr = el.getAttributeNode(name);
40
+ return attr && isDeclaredDirective(attr) ? attr.value : undefined;
41
+ }
42
+ //# sourceMappingURL=declaredDirective.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaredDirective.js","sourceRoot":"","sources":["../../../src/compile/binds/declaredDirective.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAA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AAQ;IAChE,MAAM,KAAK,GAAG,YAAY,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC;IAC3E,OAAO,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC;AACxE,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,aAAa,CAAC,EAAW,EAAE,IAAY;IACrD,MAAM,IAAI,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,IAAI,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC","sourcesContent":["import { forEachDirectiveAttr } from '@pithyjs/compiler';\nimport { nodeExpando } from '../nodeExpando';\n\nconst asciiLower = (s: string) => s.replace(/[A-Z]/g, c => c.toLowerCase());\n\n/**\n * Whether a directive attribute holds what a template wrote. A binder may\n * compile the value only then: `[data-on-click]` or a component can put data\n * into the same attribute, and a nested pass sees it. The value is compared\n * as well as the name, since such a write can replace a declared directive.\n */\nexport function isDeclaredDirective(attr: Attr): boolean {\n const { name, value, ownerElement: el } = attr;\n if (!el) return false;\n const expando = nodeExpando(el);\n if (expando.__forwardedDirectives?.get(name) === value) return true;\n const node = expando.__pithyNode;\n if (!node || node.inert) return false;\n if (isTemplateAttr(attr)) return true;\n let declared = false;\n if (node.directives) {\n const lower = asciiLower(name);\n forEachDirectiveAttr(node.directives, (attrName, expr) => {\n if (expr === value && asciiLower(attrName) === lower) declared = true;\n });\n }\n return declared;\n}\n\n/** Whether a template wrote this attribute as a plain, unbound attribute. */\nexport function isTemplateAttr({ name, value, ownerElement }: Attr): boolean {\n const attrs = ownerElement && nodeExpando(ownerElement).__pithyNode?.attrs;\n return attrs?.[name] === value || attrs?.[asciiLower(name)] === value;\n}\n\n/** The value of `name` on `el`, if a template wrote it. */\nexport function declaredValue(el: Element, name: string): string | undefined {\n const attr = el.getAttributeNode(name);\n return attr && isDeclaredDirective(attr) ? attr.value : undefined;\n}\n"]}