@ecopages/radiant 0.3.0-alpha.1 → 0.3.0-alpha.11

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 (465) hide show
  1. package/README.md +71 -60
  2. package/dist/LICENSE +21 -0
  3. package/dist/client/app-bootstrap.d.ts +19 -0
  4. package/dist/client/app-bootstrap.js +3 -0
  5. package/dist/client/app-bootstrap.js.map +10 -0
  6. package/dist/client/hydrator.d.ts +1 -1
  7. package/dist/client/hydrator.js +2 -2
  8. package/dist/client/hydrator.js.map +5 -3
  9. package/dist/client/install-hydrator.js +2 -2
  10. package/dist/client/install-hydrator.js.map +5 -3
  11. package/dist/context/context-consumer-bootstrap.d.ts +7 -6
  12. package/dist/context/context-consumer-bootstrap.js +2 -2
  13. package/dist/context/context-consumer-bootstrap.js.map +8 -3
  14. package/dist/context/context-consumer-runtime.d.ts +21 -8
  15. package/dist/context/context-consumer-runtime.js +2 -2
  16. package/dist/context/context-consumer-runtime.js.map +6 -3
  17. package/dist/context/context-host.d.ts +25 -0
  18. package/dist/context/context-host.js +3 -0
  19. package/dist/context/context-host.js.map +10 -0
  20. package/dist/context/context-provider.d.ts +10 -6
  21. package/dist/context/context-provider.js +2 -2
  22. package/dist/context/context-provider.js.map +9 -3
  23. package/dist/context/context-ssr-bridge.js +2 -2
  24. package/dist/context/context-ssr-bridge.js.map +4 -3
  25. package/dist/context/create-context.js +2 -2
  26. package/dist/context/create-context.js.map +4 -3
  27. package/dist/context/decorators/consume-context.d.ts +5 -2
  28. package/dist/context/decorators/consume-context.js +2 -2
  29. package/dist/context/decorators/consume-context.js.map +13 -3
  30. package/dist/context/decorators/context-selection-delivery.d.ts +1 -1
  31. package/dist/context/decorators/context-selection-delivery.js +2 -2
  32. package/dist/context/decorators/context-selection-delivery.js.map +5 -3
  33. package/dist/context/decorators/context-selector.d.ts +6 -6
  34. package/dist/context/decorators/context-selector.js +2 -2
  35. package/dist/context/decorators/context-selector.js.map +15 -3
  36. package/dist/context/decorators/legacy/consume-context.d.ts +2 -2
  37. package/dist/context/decorators/legacy/consume-context.js +2 -2
  38. package/dist/context/decorators/legacy/consume-context.js.map +10 -3
  39. package/dist/context/decorators/legacy/context-selector-field.d.ts +2 -2
  40. package/dist/context/decorators/legacy/context-selector-field.js +2 -2
  41. package/dist/context/decorators/legacy/context-selector-field.js.map +11 -3
  42. package/dist/context/decorators/legacy/context-selector.d.ts +2 -2
  43. package/dist/context/decorators/legacy/context-selector.js +2 -2
  44. package/dist/context/decorators/legacy/context-selector.js.map +11 -3
  45. package/dist/context/decorators/legacy/provide-context.d.ts +2 -2
  46. package/dist/context/decorators/legacy/provide-context.js +2 -2
  47. package/dist/context/decorators/legacy/provide-context.js.map +11 -3
  48. package/dist/context/decorators/on-context-update.d.ts +5 -5
  49. package/dist/context/decorators/on-context-update.js +2 -2
  50. package/dist/context/decorators/on-context-update.js.map +14 -3
  51. package/dist/context/decorators/provide-context.d.ts +5 -2
  52. package/dist/context/decorators/provide-context.js +2 -2
  53. package/dist/context/decorators/provide-context.js.map +14 -3
  54. package/dist/context/decorators/standard/consume-context.d.ts +2 -2
  55. package/dist/context/decorators/standard/consume-context.js +2 -2
  56. package/dist/context/decorators/standard/consume-context.js.map +9 -3
  57. package/dist/context/decorators/standard/context-selector-field.d.ts +2 -2
  58. package/dist/context/decorators/standard/context-selector-field.js +2 -2
  59. package/dist/context/decorators/standard/context-selector-field.js.map +10 -3
  60. package/dist/context/decorators/standard/context-selector.d.ts +2 -3
  61. package/dist/context/decorators/standard/context-selector.js +2 -2
  62. package/dist/context/decorators/standard/context-selector.js.map +10 -3
  63. package/dist/context/decorators/standard/provide-context.d.ts +2 -2
  64. package/dist/context/decorators/standard/provide-context.js +2 -2
  65. package/dist/context/decorators/standard/provide-context.js.map +10 -3
  66. package/dist/context/events.d.ts +18 -11
  67. package/dist/context/events.js +2 -2
  68. package/dist/context/events.js.map +4 -3
  69. package/dist/context/hydration-script.js +2 -2
  70. package/dist/context/hydration-script.js.map +6 -3
  71. package/dist/context/index.d.ts +8 -0
  72. package/dist/context/index.js +3 -0
  73. package/dist/context/index.js.map +35 -0
  74. package/dist/controller-registry.d.ts +38 -0
  75. package/dist/controller-registry.js +3 -0
  76. package/dist/controller-registry.js.map +11 -0
  77. package/dist/core/controller-metadata.d.ts +3 -0
  78. package/dist/core/controller-metadata.js +3 -0
  79. package/dist/core/controller-metadata.js.map +10 -0
  80. package/dist/core/custom-element-metadata.d.ts +11 -0
  81. package/dist/core/custom-element-metadata.js +2 -2
  82. package/dist/core/custom-element-metadata.js.map +4 -3
  83. package/dist/core/hydration-codec.d.ts +8 -1
  84. package/dist/core/hydration-codec.js +2 -2
  85. package/dist/core/hydration-codec.js.map +5 -3
  86. package/dist/core/radiant-component-ssr-registry.d.ts +13 -13
  87. package/dist/core/radiant-component-ssr-registry.js +2 -2
  88. package/dist/core/radiant-component-ssr-registry.js.map +4 -3
  89. package/dist/core/radiant-component-ssr.d.ts +3 -3
  90. package/dist/core/radiant-component-ssr.js +2 -2
  91. package/dist/core/radiant-component-ssr.js.map +8 -3
  92. package/dist/core/radiant-controller.d.ts +128 -0
  93. package/dist/core/radiant-controller.js +3 -0
  94. package/dist/core/radiant-controller.js.map +13 -0
  95. package/dist/core/radiant-element.d.ts +80 -41
  96. package/dist/core/radiant-element.js +2 -2
  97. package/dist/core/radiant-element.js.map +13 -3
  98. package/dist/core/radiant-hydrator-state.d.ts +1 -1
  99. package/dist/core/radiant-hydrator-state.js +2 -2
  100. package/dist/core/radiant-hydrator-state.js.map +4 -3
  101. package/dist/core/reactive-host.d.ts +137 -0
  102. package/dist/core/reactive-host.js +3 -0
  103. package/dist/core/reactive-host.js.map +10 -0
  104. package/dist/core/reactive-jsx-value.js +2 -2
  105. package/dist/core/reactive-jsx-value.js.map +4 -3
  106. package/dist/core/reactive-prop-metadata.js +2 -2
  107. package/dist/core/reactive-prop-metadata.js.map +4 -3
  108. package/dist/core/slot-projection-runtime.js +2 -2
  109. package/dist/core/slot-projection-runtime.js.map +6 -3
  110. package/dist/core/ssr-preparation.js +2 -2
  111. package/dist/core/ssr-preparation.js.map +4 -3
  112. package/dist/decorators/attr.d.ts +6 -0
  113. package/dist/decorators/attr.js +3 -0
  114. package/dist/decorators/attr.js.map +16 -0
  115. package/dist/decorators/bound.d.ts +4 -2
  116. package/dist/decorators/bound.js +2 -2
  117. package/dist/decorators/bound.js.map +7 -3
  118. package/dist/decorators/bridge.d.ts +11 -7
  119. package/dist/decorators/bridge.js +2 -2
  120. package/dist/decorators/bridge.js.map +4 -3
  121. package/dist/decorators/controller.d.ts +2 -0
  122. package/dist/decorators/controller.js +3 -0
  123. package/dist/decorators/controller.js.map +12 -0
  124. package/dist/decorators/custom-element.d.ts +4 -2
  125. package/dist/decorators/custom-element.js +2 -2
  126. package/dist/decorators/custom-element.js.map +7 -3
  127. package/dist/decorators/debounce.d.ts +5 -2
  128. package/dist/decorators/debounce.js +2 -2
  129. package/dist/decorators/debounce.js.map +8 -3
  130. package/dist/decorators/event.d.ts +5 -2
  131. package/dist/decorators/event.js +2 -2
  132. package/dist/decorators/event.js.map +10 -3
  133. package/dist/decorators/legacy/attr.d.ts +2 -0
  134. package/dist/decorators/legacy/attr.js +3 -0
  135. package/dist/decorators/legacy/attr.js.map +13 -0
  136. package/dist/decorators/legacy/bound.js +2 -2
  137. package/dist/decorators/legacy/bound.js.map +4 -3
  138. package/dist/decorators/legacy/custom-element.js +2 -2
  139. package/dist/decorators/legacy/custom-element.js.map +5 -3
  140. package/dist/decorators/legacy/debounce.js +2 -2
  141. package/dist/decorators/legacy/debounce.js.map +5 -3
  142. package/dist/decorators/legacy/event.js +2 -2
  143. package/dist/decorators/legacy/event.js.map +7 -3
  144. package/dist/decorators/legacy/instance-initializers.d.ts +3 -4
  145. package/dist/decorators/legacy/instance-initializers.js +2 -2
  146. package/dist/decorators/legacy/instance-initializers.js.map +4 -3
  147. package/dist/decorators/legacy/on-event.d.ts +2 -2
  148. package/dist/decorators/legacy/on-event.js +2 -2
  149. package/dist/decorators/legacy/on-event.js.map +7 -3
  150. package/dist/decorators/legacy/on-updated.d.ts +7 -2
  151. package/dist/decorators/legacy/on-updated.js +2 -2
  152. package/dist/decorators/legacy/on-updated.js.map +5 -3
  153. package/dist/decorators/legacy/query-slot.d.ts +1 -1
  154. package/dist/decorators/legacy/query-slot.js +2 -2
  155. package/dist/decorators/legacy/query-slot.js.map +7 -3
  156. package/dist/decorators/legacy/query.d.ts +7 -2
  157. package/dist/decorators/legacy/query.js +2 -2
  158. package/dist/decorators/legacy/query.js.map +6 -3
  159. package/dist/decorators/legacy/reactive-field.d.ts +2 -2
  160. package/dist/decorators/legacy/reactive-field.js +2 -2
  161. package/dist/decorators/legacy/reactive-field.js.map +5 -3
  162. package/dist/decorators/legacy/reactive-prop.d.ts +10 -16
  163. package/dist/decorators/legacy/reactive-prop.js +2 -2
  164. package/dist/decorators/legacy/reactive-prop.js.map +7 -3
  165. package/dist/decorators/legacy/signal.d.ts +4 -3
  166. package/dist/decorators/legacy/signal.js +2 -2
  167. package/dist/decorators/legacy/signal.js.map +9 -3
  168. package/dist/decorators/on-event.d.ts +6 -3
  169. package/dist/decorators/on-event.js +2 -2
  170. package/dist/decorators/on-event.js.map +10 -3
  171. package/dist/decorators/on-updated.d.ts +12 -2
  172. package/dist/decorators/on-updated.js +2 -2
  173. package/dist/decorators/on-updated.js.map +8 -3
  174. package/dist/decorators/prop.d.ts +19 -7
  175. package/dist/decorators/prop.js +2 -2
  176. package/dist/decorators/prop.js.map +10 -3
  177. package/dist/decorators/query-slot.d.ts +7 -3
  178. package/dist/decorators/query-slot.js +2 -2
  179. package/dist/decorators/query-slot.js.map +10 -3
  180. package/dist/decorators/query.d.ts +9 -2
  181. package/dist/decorators/query.js +2 -2
  182. package/dist/decorators/query.js.map +9 -3
  183. package/dist/decorators/shared/reactive-attr.d.ts +25 -0
  184. package/dist/decorators/shared/reactive-attr.js +3 -0
  185. package/dist/decorators/shared/reactive-attr.js.map +11 -0
  186. package/dist/decorators/signal.d.ts +10 -4
  187. package/dist/decorators/signal.js +2 -2
  188. package/dist/decorators/signal.js.map +11 -3
  189. package/dist/decorators/standard/attr.d.ts +2 -0
  190. package/dist/decorators/standard/attr.js +3 -0
  191. package/dist/decorators/standard/attr.js.map +12 -0
  192. package/dist/decorators/standard/bound.js +2 -2
  193. package/dist/decorators/standard/bound.js.map +4 -3
  194. package/dist/decorators/standard/custom-element.js +2 -2
  195. package/dist/decorators/standard/custom-element.js.map +5 -3
  196. package/dist/decorators/standard/debounce.js +2 -2
  197. package/dist/decorators/standard/debounce.js.map +5 -3
  198. package/dist/decorators/standard/event.js +2 -2
  199. package/dist/decorators/standard/event.js.map +6 -3
  200. package/dist/decorators/standard/on-event.d.ts +2 -1
  201. package/dist/decorators/standard/on-event.js +2 -2
  202. package/dist/decorators/standard/on-event.js.map +6 -3
  203. package/dist/decorators/standard/on-updated.d.ts +5 -1
  204. package/dist/decorators/standard/on-updated.js +2 -2
  205. package/dist/decorators/standard/on-updated.js.map +4 -3
  206. package/dist/decorators/standard/query-slot.d.ts +1 -1
  207. package/dist/decorators/standard/query-slot.js +2 -2
  208. package/dist/decorators/standard/query-slot.js.map +5 -3
  209. package/dist/decorators/standard/query.d.ts +2 -1
  210. package/dist/decorators/standard/query.js +2 -2
  211. package/dist/decorators/standard/query.js.map +5 -3
  212. package/dist/decorators/standard/reactive-field.d.ts +2 -2
  213. package/dist/decorators/standard/reactive-field.js +2 -2
  214. package/dist/decorators/standard/reactive-field.js.map +4 -3
  215. package/dist/decorators/standard/reactive-prop.d.ts +13 -2
  216. package/dist/decorators/standard/reactive-prop.js +2 -2
  217. package/dist/decorators/standard/reactive-prop.js.map +6 -3
  218. package/dist/decorators/standard/signal.d.ts +4 -3
  219. package/dist/decorators/standard/signal.js +2 -2
  220. package/dist/decorators/standard/signal.js.map +8 -3
  221. package/dist/decorators/state.d.ts +6 -5
  222. package/dist/decorators/state.js +2 -2
  223. package/dist/decorators/state.js.map +8 -3
  224. package/dist/helpers/create-event-listener.d.ts +11 -2
  225. package/dist/helpers/create-event-listener.js +2 -2
  226. package/dist/helpers/create-event-listener.js.map +5 -3
  227. package/dist/helpers/create-event.js +2 -2
  228. package/dist/helpers/create-event.js.map +5 -3
  229. package/dist/helpers/create-query-slot.d.ts +2 -2
  230. package/dist/helpers/create-query-slot.js +2 -2
  231. package/dist/helpers/create-query-slot.js.map +4 -3
  232. package/dist/helpers/create-query.d.ts +14 -3
  233. package/dist/helpers/create-query.js +2 -2
  234. package/dist/helpers/create-query.js.map +4 -3
  235. package/dist/helpers/debounce.js +2 -2
  236. package/dist/helpers/debounce.js.map +4 -3
  237. package/dist/helpers/index.js +2 -2
  238. package/dist/helpers/index.js.map +10 -3
  239. package/dist/index.d.ts +4 -12
  240. package/dist/index.js +2 -2
  241. package/dist/index.js.map +66 -3
  242. package/dist/package.json +206 -0
  243. package/dist/server/context-ssr.js +2 -2
  244. package/dist/server/context-ssr.js.map +5 -3
  245. package/dist/server/html-parser.js +2 -2
  246. package/dist/server/html-parser.js.map +4 -3
  247. package/dist/server/install-light-dom-shim.js +2 -2
  248. package/dist/server/install-light-dom-shim.js.map +5 -3
  249. package/dist/server/light-dom-shim.d.ts +9 -0
  250. package/dist/server/light-dom-shim.js +2 -2
  251. package/dist/server/light-dom-shim.js.map +5 -3
  252. package/dist/server/project-root.js +2 -2
  253. package/dist/server/project-root.js.map +2 -2
  254. package/dist/server/radiant-component-ssr-runtime.d.ts +2 -2
  255. package/dist/server/radiant-component-ssr-runtime.js +2 -2
  256. package/dist/server/radiant-component-ssr-runtime.js.map +11 -3
  257. package/dist/server/render-component.d.ts +3 -13
  258. package/dist/server/render-component.js +2 -2
  259. package/dist/server/render-component.js.map +14 -4
  260. package/dist/server/render-controller.d.ts +57 -0
  261. package/dist/server/render-controller.js +3 -0
  262. package/dist/server/render-controller.js.map +23 -0
  263. package/dist/server/slot-projection-html.js +2 -2
  264. package/dist/server/slot-projection-html.js.map +7 -3
  265. package/dist/signals/host-resource.js +2 -2
  266. package/dist/signals/host-resource.js.map +2 -2
  267. package/dist/signals/host-signal.d.ts +4 -2
  268. package/dist/signals/host-signal.js +2 -2
  269. package/dist/signals/host-signal.js.map +7 -3
  270. package/dist/signals/hydration-script.js +2 -2
  271. package/dist/signals/hydration-script.js.map +6 -3
  272. package/dist/tools/escape-css-identifier.d.ts +1 -0
  273. package/dist/tools/escape-css-identifier.js +3 -0
  274. package/dist/tools/escape-css-identifier.js.map +10 -0
  275. package/dist/tools/escape-script-json.js +2 -2
  276. package/dist/tools/escape-script-json.js.map +4 -3
  277. package/dist/tools/event-emitter.js +2 -2
  278. package/dist/tools/event-emitter.js.map +4 -3
  279. package/dist/tools/index.d.ts +1 -1
  280. package/dist/tools/index.js +2 -2
  281. package/dist/tools/index.js.map +7 -3
  282. package/dist/tools/render-jsx-template.js +2 -2
  283. package/dist/tools/render-jsx-template.js.map +4 -3
  284. package/dist/types.js +2 -2
  285. package/dist/types.js.map +2 -2
  286. package/dist/utils/attribute-utils.js +2 -2
  287. package/dist/utils/attribute-utils.js.map +4 -3
  288. package/dist/utils/index.js +2 -2
  289. package/dist/utils/index.js.map +4 -3
  290. package/package.json +32 -8
  291. package/size-budget.json +12 -3
  292. package/dist/chunk-0bswvy25.js +0 -4
  293. package/dist/chunk-0bswvy25.js.map +0 -10
  294. package/dist/chunk-0btkzzyc.js +0 -4
  295. package/dist/chunk-0btkzzyc.js.map +0 -10
  296. package/dist/chunk-0g0j9re6.js +0 -4
  297. package/dist/chunk-0g0j9re6.js.map +0 -10
  298. package/dist/chunk-1x26p09c.js +0 -4
  299. package/dist/chunk-1x26p09c.js.map +0 -10
  300. package/dist/chunk-21a7jask.js +0 -4
  301. package/dist/chunk-21a7jask.js.map +0 -10
  302. package/dist/chunk-25zjh0kg.js +0 -4
  303. package/dist/chunk-25zjh0kg.js.map +0 -10
  304. package/dist/chunk-30x4hggg.js +0 -4
  305. package/dist/chunk-30x4hggg.js.map +0 -10
  306. package/dist/chunk-3ryr5wx2.js +0 -4
  307. package/dist/chunk-3ryr5wx2.js.map +0 -10
  308. package/dist/chunk-3xxvmd5c.js +0 -4
  309. package/dist/chunk-3xxvmd5c.js.map +0 -10
  310. package/dist/chunk-3ynk7e1e.js +0 -4
  311. package/dist/chunk-3ynk7e1e.js.map +0 -10
  312. package/dist/chunk-4e559cy5.js +0 -4
  313. package/dist/chunk-4e559cy5.js.map +0 -10
  314. package/dist/chunk-5b1en9vz.js +0 -4
  315. package/dist/chunk-5b1en9vz.js.map +0 -10
  316. package/dist/chunk-5bkat72n.js +0 -4
  317. package/dist/chunk-5bkat72n.js.map +0 -10
  318. package/dist/chunk-5qeaq3tj.js +0 -4
  319. package/dist/chunk-5qeaq3tj.js.map +0 -10
  320. package/dist/chunk-66e6s792.js +0 -4
  321. package/dist/chunk-66e6s792.js.map +0 -10
  322. package/dist/chunk-79jg8q67.js +0 -4
  323. package/dist/chunk-79jg8q67.js.map +0 -10
  324. package/dist/chunk-8d5ddvvf.js +0 -4
  325. package/dist/chunk-8d5ddvvf.js.map +0 -10
  326. package/dist/chunk-8e9fgtbn.js +0 -4
  327. package/dist/chunk-8e9fgtbn.js.map +0 -10
  328. package/dist/chunk-9mqtp3js.js +0 -4
  329. package/dist/chunk-9mqtp3js.js.map +0 -10
  330. package/dist/chunk-9rj2rwes.js +0 -4
  331. package/dist/chunk-9rj2rwes.js.map +0 -10
  332. package/dist/chunk-atms6yrh.js +0 -4
  333. package/dist/chunk-atms6yrh.js.map +0 -10
  334. package/dist/chunk-bk2nbmcd.js +0 -4
  335. package/dist/chunk-bk2nbmcd.js.map +0 -10
  336. package/dist/chunk-bk6qkvfp.js +0 -4
  337. package/dist/chunk-bk6qkvfp.js.map +0 -10
  338. package/dist/chunk-c0qyz98c.js +0 -4
  339. package/dist/chunk-c0qyz98c.js.map +0 -10
  340. package/dist/chunk-c52qhh0j.js +0 -4
  341. package/dist/chunk-c52qhh0j.js.map +0 -10
  342. package/dist/chunk-cnyxrh9r.js +0 -4
  343. package/dist/chunk-cnyxrh9r.js.map +0 -10
  344. package/dist/chunk-cvz9mrxa.js +0 -4
  345. package/dist/chunk-cvz9mrxa.js.map +0 -10
  346. package/dist/chunk-dabagjk6.js +0 -4
  347. package/dist/chunk-dabagjk6.js.map +0 -10
  348. package/dist/chunk-e0r6ca2g.js +0 -4
  349. package/dist/chunk-e0r6ca2g.js.map +0 -10
  350. package/dist/chunk-eevw1j2q.js +0 -4
  351. package/dist/chunk-eevw1j2q.js.map +0 -10
  352. package/dist/chunk-ek664x1c.js +0 -4
  353. package/dist/chunk-ek664x1c.js.map +0 -10
  354. package/dist/chunk-eyw14d6y.js +0 -4
  355. package/dist/chunk-eyw14d6y.js.map +0 -10
  356. package/dist/chunk-fs4j94bk.js +0 -4
  357. package/dist/chunk-fs4j94bk.js.map +0 -10
  358. package/dist/chunk-g2z3mm6b.js +0 -4
  359. package/dist/chunk-g2z3mm6b.js.map +0 -10
  360. package/dist/chunk-g5n3m11h.js +0 -4
  361. package/dist/chunk-g5n3m11h.js.map +0 -10
  362. package/dist/chunk-gdkte2vd.js +0 -4
  363. package/dist/chunk-gdkte2vd.js.map +0 -10
  364. package/dist/chunk-gg74gdpv.js +0 -4
  365. package/dist/chunk-gg74gdpv.js.map +0 -10
  366. package/dist/chunk-h9k7crjc.js +0 -4
  367. package/dist/chunk-h9k7crjc.js.map +0 -10
  368. package/dist/chunk-hpzgnxgq.js +0 -4
  369. package/dist/chunk-hpzgnxgq.js.map +0 -10
  370. package/dist/chunk-hrjc8b1y.js +0 -4
  371. package/dist/chunk-hrjc8b1y.js.map +0 -10
  372. package/dist/chunk-hvy4zvcc.js +0 -4
  373. package/dist/chunk-hvy4zvcc.js.map +0 -10
  374. package/dist/chunk-hztr86b4.js +0 -4
  375. package/dist/chunk-hztr86b4.js.map +0 -10
  376. package/dist/chunk-j3v7rca5.js +0 -4
  377. package/dist/chunk-j3v7rca5.js.map +0 -10
  378. package/dist/chunk-j864sv4w.js +0 -4
  379. package/dist/chunk-j864sv4w.js.map +0 -10
  380. package/dist/chunk-jkb2y7c8.js +0 -4
  381. package/dist/chunk-jkb2y7c8.js.map +0 -10
  382. package/dist/chunk-kakpjgzf.js +0 -4
  383. package/dist/chunk-kakpjgzf.js.map +0 -10
  384. package/dist/chunk-kmebacvv.js +0 -4
  385. package/dist/chunk-kmebacvv.js.map +0 -10
  386. package/dist/chunk-knqsm6v3.js +0 -4
  387. package/dist/chunk-knqsm6v3.js.map +0 -10
  388. package/dist/chunk-mp2vtrkg.js +0 -4
  389. package/dist/chunk-mp2vtrkg.js.map +0 -10
  390. package/dist/chunk-mpsj3cjs.js +0 -4
  391. package/dist/chunk-mpsj3cjs.js.map +0 -10
  392. package/dist/chunk-n4p2542b.js +0 -4
  393. package/dist/chunk-n4p2542b.js.map +0 -10
  394. package/dist/chunk-nctznxyz.js +0 -4
  395. package/dist/chunk-nctznxyz.js.map +0 -10
  396. package/dist/chunk-ndw3hc3v.js +0 -4
  397. package/dist/chunk-ndw3hc3v.js.map +0 -10
  398. package/dist/chunk-nnnb6pac.js +0 -4
  399. package/dist/chunk-nnnb6pac.js.map +0 -10
  400. package/dist/chunk-nssj2x13.js +0 -4
  401. package/dist/chunk-nssj2x13.js.map +0 -10
  402. package/dist/chunk-nvr37vma.js +0 -4
  403. package/dist/chunk-nvr37vma.js.map +0 -10
  404. package/dist/chunk-p8k4g99a.js +0 -4
  405. package/dist/chunk-p8k4g99a.js.map +0 -10
  406. package/dist/chunk-pkszgjqf.js +0 -4
  407. package/dist/chunk-pkszgjqf.js.map +0 -10
  408. package/dist/chunk-q9z6tnzw.js +0 -4
  409. package/dist/chunk-q9z6tnzw.js.map +0 -10
  410. package/dist/chunk-qdz5sncz.js +0 -4
  411. package/dist/chunk-qdz5sncz.js.map +0 -10
  412. package/dist/chunk-qe0eww1n.js +0 -4
  413. package/dist/chunk-qe0eww1n.js.map +0 -10
  414. package/dist/chunk-r33zvvda.js +0 -4
  415. package/dist/chunk-r33zvvda.js.map +0 -10
  416. package/dist/chunk-rkh1vkb9.js +0 -4
  417. package/dist/chunk-rkh1vkb9.js.map +0 -10
  418. package/dist/chunk-rrg759ht.js +0 -4
  419. package/dist/chunk-rrg759ht.js.map +0 -10
  420. package/dist/chunk-s09s5ayx.js +0 -4
  421. package/dist/chunk-s09s5ayx.js.map +0 -10
  422. package/dist/chunk-s5p5z3z4.js +0 -4
  423. package/dist/chunk-s5p5z3z4.js.map +0 -10
  424. package/dist/chunk-sf4a2gy5.js +0 -4
  425. package/dist/chunk-sf4a2gy5.js.map +0 -10
  426. package/dist/chunk-ssnnxzrj.js +0 -4
  427. package/dist/chunk-ssnnxzrj.js.map +0 -10
  428. package/dist/chunk-t8xtvgyg.js +0 -4
  429. package/dist/chunk-t8xtvgyg.js.map +0 -10
  430. package/dist/chunk-v3ta7hnv.js +0 -4
  431. package/dist/chunk-v3ta7hnv.js.map +0 -10
  432. package/dist/chunk-v92hp9g0.js +0 -4
  433. package/dist/chunk-v92hp9g0.js.map +0 -10
  434. package/dist/chunk-vgtggzb6.js +0 -4
  435. package/dist/chunk-vgtggzb6.js.map +0 -9
  436. package/dist/chunk-vk48hgm4.js +0 -4
  437. package/dist/chunk-vk48hgm4.js.map +0 -10
  438. package/dist/chunk-w8s5fnsq.js +0 -4
  439. package/dist/chunk-w8s5fnsq.js.map +0 -10
  440. package/dist/chunk-wd23rn4q.js +0 -4
  441. package/dist/chunk-wd23rn4q.js.map +0 -10
  442. package/dist/chunk-wds4href.js +0 -4
  443. package/dist/chunk-wds4href.js.map +0 -10
  444. package/dist/chunk-wvd1ffe4.js +0 -4
  445. package/dist/chunk-wvd1ffe4.js.map +0 -10
  446. package/dist/chunk-wwbjz9k4.js +0 -4
  447. package/dist/chunk-wwbjz9k4.js.map +0 -10
  448. package/dist/chunk-x2k0ngpz.js +0 -4
  449. package/dist/chunk-x2k0ngpz.js.map +0 -10
  450. package/dist/chunk-x457d0ap.js +0 -4
  451. package/dist/chunk-x457d0ap.js.map +0 -10
  452. package/dist/chunk-xbhtzkre.js +0 -4
  453. package/dist/chunk-xbhtzkre.js.map +0 -10
  454. package/dist/chunk-y139ycfm.js +0 -4
  455. package/dist/chunk-y139ycfm.js.map +0 -10
  456. package/dist/chunk-z9kxfckm.js +0 -4
  457. package/dist/chunk-z9kxfckm.js.map +0 -10
  458. package/dist/chunk-zx5txex8.js +0 -4
  459. package/dist/chunk-zx5txex8.js.map +0 -10
  460. package/dist/core/radiant-component.d.ts +0 -113
  461. package/dist/core/radiant-component.js +0 -3
  462. package/dist/core/radiant-component.js.map +0 -9
  463. package/dist/tools/stringify-typed.d.ts +0 -16
  464. package/dist/tools/stringify-typed.js +0 -3
  465. package/dist/tools/stringify-typed.js.map +0 -9
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/utils/attribute-utils.ts", "../src/core/custom-element-metadata.ts", "../src/context/context-ssr-bridge.ts", "../src/server/context-ssr.ts", "../src/core/radiant-component-ssr.ts"],
4
4
  "sourcesContent": [
5
+ "import type { RadiantElement } from '../core/radiant-element';\n\nexport type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn readers[readerType]!(value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
6
+ "export const CUSTOM_ELEMENT_TAG_NAME = Symbol.for('@ecopages/radiant.customElementTagName');\n\ntype CustomElementConstructorWithMetadata = CustomElementConstructor & {\n\t[CUSTOM_ELEMENT_TAG_NAME]?: string;\n};\n\n/**\n * Sets the custom element tag name for a given constructor.\n * This is used internally to associate a class with its custom element tag, which is necessary for features like hydration and SSR support.\n * @param target The constructor of the custom element.\n * @param tagName The tag name to associate with the custom element.\n */\nexport function setCustomElementTagName(target: CustomElementConstructor, tagName: string): void {\n\t(target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME] = tagName;\n}\n\n/**\n * Retrieves the custom element tag name associated with a given constructor.\n * @param target The constructor of the custom element.\n * @returns The tag name associated with the custom element, or `undefined` if not set.\n */\nexport function getCustomElementTagName(target: CustomElementConstructor): string | undefined {\n\treturn (target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME];\n}\n",
7
+ "import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
8
+ "import type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { installSsrContextProviderResolver } from '../context/context-ssr-bridge';\nimport type { ContextType, UnknownContext } from '../context/types';\n\ntype ProviderFrame = Map<UnknownContext, SsrSerializableContextProvider>;\ntype ProviderStack = ProviderFrame[];\n\nlet resolvedAsyncLocalStorage: AsyncLocalStorage<ProviderStack> | null | undefined;\n\n/**\n * Lazily resolves `AsyncLocalStorage` from `node:async_hooks`.\n *\n * The dynamic `require` is necessary because browser-based SSR tests import\n * this server-oriented module directly. A top-level static import would break\n * those browser bundles even though normal application SSR runs on the server.\n *\n * On the server (Node.js, Bun, Cloudflare Workers) the import always succeeds.\n * In browser test environments where SSR rendering is exercised without a real\n * server, the fallback global stack is used instead.\n */\nfunction getAsyncLocalStorage(): AsyncLocalStorage<ProviderStack> | null {\n\tif (resolvedAsyncLocalStorage !== undefined) {\n\t\treturn resolvedAsyncLocalStorage;\n\t}\n\n\ttry {\n\t\tconst { AsyncLocalStorage: ALS } = require('node:async_hooks') as typeof import('node:async_hooks');\n\t\tresolvedAsyncLocalStorage = new ALS<ProviderStack>();\n\t\treturn resolvedAsyncLocalStorage;\n\t} catch {\n\t\tresolvedAsyncLocalStorage = null;\n\t\treturn null;\n\t}\n}\n\nconst SSR_CONTEXT_FALLBACK_STACK_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-fallback-stack');\n\nfunction getFallbackStack(): ProviderStack {\n\tconst g = globalThis as typeof globalThis & { [SSR_CONTEXT_FALLBACK_STACK_SYMBOL]?: ProviderStack };\n\tg[SSR_CONTEXT_FALLBACK_STACK_SYMBOL] ??= [];\n\treturn g[SSR_CONTEXT_FALLBACK_STACK_SYMBOL];\n}\n\n/**\n * Pushes a temporary provider frame onto the SSR context stack.\n *\n * On the server, each call creates an isolated `AsyncLocalStorage` context so\n * concurrent renders cannot corrupt each other.\n *\n * In browser test environments where `AsyncLocalStorage` is unavailable, a\n * synchronous global stack is used as a fallback.\n */\nexport function withSsrContextProviders(providers: readonly SsrSerializableContextProvider[]): () => void {\n\tif (providers.length === 0) {\n\t\treturn () => undefined;\n\t}\n\n\tconst frame = new Map<UnknownContext, SsrSerializableContextProvider>();\n\n\tfor (const provider of providers) {\n\t\tframe.set(provider.getContextKey(), provider);\n\t}\n\n\tconst als = getAsyncLocalStorage();\n\n\tif (als) {\n\t\tconst parentStack = als.getStore() ?? [];\n\t\tconst childStack = [...parentStack, frame];\n\t\tals.enterWith(childStack);\n\n\t\treturn () => {\n\t\t\tals.enterWith(parentStack);\n\t\t};\n\t}\n\n\tconst stack = getFallbackStack();\n\tstack.push(frame);\n\n\treturn () => {\n\t\tconst index = stack.lastIndexOf(frame);\n\t\tif (index >= 0) stack.splice(index, 1);\n\t};\n}\n\n/**\n * Resolves the nearest SSR-visible provider for a given context token.\n *\n * Lookup walks the provider frames from innermost to outermost so nested host\n * serialization behaves the same way as runtime context resolution in the DOM.\n */\nexport function resolveSsrContextProvider<T extends UnknownContext>(\n\tcontext: T,\n): SsrSerializableContextProvider | undefined {\n\tconst store = getAsyncLocalStorage()?.getStore() ?? getFallbackStack();\n\n\tfor (let index = store.length - 1; index >= 0; index -= 1) {\n\t\tconst provider = store[index]?.get(context);\n\n\t\tif (provider) {\n\t\t\treturn provider;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Resolves the current SSR-visible value for a given context token.\n *\n * This is the ergonomic helper consumed by SSR-aware decorators and component\n * render paths when they only need the context payload instead of the full\n * provider instance.\n */\nexport function resolveSsrContextValue<T extends UnknownContext>(context: T): ContextType<T> | undefined {\n\tconst provider = resolveSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn undefined;\n\t}\n\n\treturn provider.getContext() as ContextType<T>;\n}\n\ninstallSsrContextProviderResolver((context) => resolveSsrContextProvider(context));\n",
9
+ "import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { withSsrContextProviders } from '../server/context-ssr';\nimport { getCustomElementTagName } from './custom-element-metadata';\nimport type { ReactiveProperty } from './radiant-element';\nimport type { ReactivePropDefinition } from './reactive-prop-metadata';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\nimport { writeAttributeValue } from '../utils/attribute-utils';\n\ntype RadiantElementSsrHost = {\n\tconstructor: CustomElementConstructor;\n\tgetAuthoredHydrationScriptMarkup?: () => string | undefined;\n\tgetContextProviders: () => SsrSerializableContextProvider[];\n\tgetHydrationBindings: () => SsrSerializableHydrationBinding[];\n\tgetSlotProjectionScriptTag?: () => string | undefined;\n\trenderToString: (options?: RenderToStringOptions) => string;\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tlistAttributeNames: () => string[];\n\tgetAttributeValue: (name: string) => string | null;\n};\n\nexport class RadiantElementSsrService {\n\tconstructor(private readonly host: RadiantElementSsrHost) {}\n\n\tpublic renderHost(): JsxRenderable {\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\touterHTML: this.renderHostToString({ mode: 'hydrate' }),\n\t\t};\n\t}\n\n\tpublic renderHostToString(options: RenderToStringOptions = {}, attributes = this.getHostAttributes()): string {\n\t\tconst tagName = this.getTagName();\n\t\tconst restoreSsrContexts = withSsrContextProviders(this.host.getContextProviders());\n\n\t\ttry {\n\t\t\treturn `<${tagName}${serializeHostAttributes(attributes)}>${this.renderHostContent(options)}</${tagName}>`;\n\t\t} finally {\n\t\t\trestoreSsrContexts();\n\t\t}\n\t}\n\n\tprivate renderHostContent(options: RenderToStringOptions): string {\n\t\tconst hostContent = this.host.renderToString(options);\n\t\tconst authoredHydrationMarkup = this.host.getAuthoredHydrationScriptMarkup?.() ?? '';\n\t\tconst slotProjectionScript = this.host.getSlotProjectionScriptTag?.() ?? '';\n\t\tconst hydrate = options.mode === 'hydrate' || (options.mode === undefined && options.hydrate === true);\n\n\t\tif (!hydrate) {\n\t\t\treturn `${hostContent}${authoredHydrationMarkup}${slotProjectionScript}`;\n\t\t}\n\n\t\tconst hydrationScripts = this.host\n\t\t\t.getHydrationBindings()\n\t\t\t.map((binding) => binding.renderHydrationScriptTag())\n\t\t\t.filter((markup): markup is string => typeof markup === 'string')\n\t\t\t.join('');\n\n\t\treturn `${hostContent}${slotProjectionScript}${hydrationScripts}`;\n\t}\n\n\tpublic getHostAttributes(): Record<string, string> {\n\t\tconst attributes: Record<string, string> = {};\n\t\tconst seenAttributes = new Set<string>();\n\n\t\tfor (const property of this.host.getReactiveProperties()) {\n\t\t\tconst currentValue = this.host.getPropertyValue(property.name);\n\t\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattributes[property.attribute] = String(property.converter.toAttribute(currentValue));\n\t\t\tseenAttributes.add(property.attribute);\n\t\t}\n\n\t\tfor (const definition of this.host.getReactivePropDefinitions()) {\n\t\t\tconst attributeName = definition.options.attribute ?? definition.name;\n\n\t\t\tif (seenAttributes.has(attributeName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst currentValue = this.host.getPropertyValue(definition.name);\n\n\t\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattributes[attributeName] = String(writeAttributeValue(currentValue, definition.options.type));\n\t\t\tseenAttributes.add(attributeName);\n\t\t}\n\n\t\tfor (const attributeName of this.host.listAttributeNames()) {\n\t\t\tconst attributeValue = this.host.getAttributeValue(attributeName);\n\t\t\tif (attributeValue !== null) {\n\t\t\t\tattributes[attributeName] = attributeValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tprivate getTagName(): string {\n\t\tconst tagName = getCustomElementTagName(this.host.constructor);\n\n\t\tif (!tagName) {\n\t\t\tthrow new Error(`${this.host.constructor.name} is missing @customElement metadata.`);\n\t\t}\n\n\t\treturn tagName;\n\t}\n}\n\nfunction serializeHostAttributes(attributes: Record<string, string>): string {\n\treturn Object.entries(attributes)\n\t\t.map(([name, value]) => ` ${name}=\"${escapeAttribute(value)}\"`)\n\t\t.join('');\n}\n\nfunction escapeAttribute(value: string): string {\n\treturn value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n"
5
10
  ],
6
- "mappings": "",
7
- "debugId": "F6B36BC49A26138E64756E2164756E21",
11
+ "mappings": "2PAYO,SAAS,CAA0B,CAAC,EAAkC,CAC5E,OAAQ,QACF,MACJ,MAAO,aACH,QACJ,MAAO,eACH,OACJ,MAAO,cACH,OACJ,MAAO,cACH,OAC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AC7D,GAAI,IAAiB,QAAa,IAAiB,MAAQ,IAAiB,GAC3E,SAGD,EAAW,EAAS,WAAa,OAAO,EAAS,UAAU,YAAY,CAAY,CAAC,EACpF,EAAe,IAAI,EAAS,SAAS,EAGtC,QAAW,KAAc,KAAK,KAAK,2BAA2B,EAAG,CAChE,IAAM,EAAgB,EAAW,QAAQ,WAAa,EAAW,KAEjE,GAAI,EAAe,IAAI,CAAa,EACnC,SAGD,IAAM,EAAe,KAAK,KAAK,iBAAiB,EAAW,IAAI,EAE/D,GAAI,IAAiB,QAAa,IAAiB,MAAQ,IAAiB,GAC3E,SAGD,EAAW,GAAiB,OAAO,EAAoB,EAAc,EAAW,QAAQ,IAAI,CAAC,EAC7F,EAAe,IAAI,CAAa,EAGjC,QAAW,KAAiB,KAAK,KAAK,mBAAmB,EAAG,CAC3D,IAAM,EAAiB,KAAK,KAAK,kBAAkB,CAAa,EAChE,GAAI,IAAmB,KACtB,EAAW,GAAiB,EAI9B,OAAO,EAGA,UAAU,EAAW,CAC5B,IAAM,EAAU,EAAwB,KAAK,KAAK,WAAW,EAE7D,GAAI,CAAC,EACJ,MAAU,MAAM,GAAG,KAAK,KAAK,YAAY,0CAA0C,EAGpF,OAAO,EAET,CAEA,SAAS,CAAuB,CAAC,EAA4C,CAC5E,OAAO,OAAO,QAAQ,CAAU,EAC9B,IAAI,EAAE,EAAM,KAAW,IAAI,MAAS,EAAgB,CAAK,IAAI,EAC7D,KAAK,EAAE,EAGV,SAAS,CAAe,CAAC,EAAuB,CAC/C,OAAO,EAAM,QAAQ,KAAM,OAAO,EAAE,QAAQ,KAAM,QAAQ,EAAE,QAAQ,KAAM,MAAM,EAAE,QAAQ,KAAM,MAAM",
12
+ "debugId": "53C9F45CFD02739C64756E2164756E21",
8
13
  "names": []
9
14
  }
@@ -0,0 +1,128 @@
1
+ import { type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';
2
+ import type { UnknownContext } from '../context/types';
3
+ import { type ReactiveHostLike } from './reactive-host';
4
+ import type { ReactivePropertyOptions, ReactiveBindingValue, ReactiveBindings, ReactiveFieldOptions } from './radiant-element';
5
+ import type { ReactiveBindingOption } from './radiant-element';
6
+ import type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';
7
+ type StringPropertyKey<Value> = Extract<keyof Value, string>;
8
+ /**
9
+ * Attaches Radiant reactivity to an existing DOM element without defining a
10
+ * custom element.
11
+ *
12
+ * `RadiantController` is the controller-host counterpart to `RadiantElement`.
13
+ * It can enhance authored DOM, or it can take over the host's inner DOM by
14
+ * overriding `render()`.
15
+ *
16
+ * When used with the controller registry, the attached host is typically an
17
+ * element carrying `data-controller="..."`.
18
+ *
19
+ * @typeParam Bindings - Explicit internal bindable shape. Include only the
20
+ * reactive keys that JSX bindings should accept.
21
+ */
22
+ export declare class RadiantController<Bindings extends object = {}> implements ReactiveHostLike<Bindings> {
23
+ readonly host: Element;
24
+ readonly element: Element;
25
+ readonly bindings: ReactiveBindings<Bindings>;
26
+ readonly $: ReactiveBindings<Bindings>;
27
+ private readonly reactiveHost;
28
+ private connected;
29
+ private isRendering;
30
+ private isRenderScheduled;
31
+ private isSsrLifecycle;
32
+ private needsRender;
33
+ private renderSignal?;
34
+ private readonly renderWatcher;
35
+ constructor(host: Element);
36
+ /**
37
+ * Connects the controller to its host and starts reactive subscriptions.
38
+ *
39
+ * If the controller owns a render lifecycle by overriding `render()`, the
40
+ * first update runs immediately after connection.
41
+ */
42
+ connect(): void;
43
+ /**
44
+ * Connects the controller for server-side rendering without running the
45
+ * browser render/update lifecycle.
46
+ */
47
+ connectForSsrRender(): void;
48
+ /**
49
+ * Disconnects the controller from its host and tears down reactive work.
50
+ */
51
+ disconnect(): void;
52
+ /**
53
+ * Disconnects a controller that was attached through the SSR-only lifecycle.
54
+ */
55
+ disconnectForSsrRender(): void;
56
+ get isConnected(): boolean;
57
+ /**
58
+ * Returns the JSX tree rendered into the attached host.
59
+ *
60
+ * The base implementation renders nothing. Override this method when the
61
+ * controller should own the host's inner DOM instead of only enhancing
62
+ * authored markup.
63
+ */
64
+ render(): JsxRenderable;
65
+ /**
66
+ * Schedules a render pass for render-owning controllers.
67
+ *
68
+ * Multiple calls in the same microtask are coalesced into a single update.
69
+ */
70
+ requestUpdate(): void;
71
+ /**
72
+ * Flushes the current render output into the attached host element.
73
+ *
74
+ * This is a no-op unless the controller overrides `render()`.
75
+ */
76
+ update(): void;
77
+ /**
78
+ * Returns a subscribable JSX binding for a selected reactive member.
79
+ */
80
+ bind<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
81
+ /**
82
+ * Returns the cached binding object for a selected reactive member.
83
+ */
84
+ getReactiveBinding<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
85
+ /**
86
+ * Defines a reactive field directly on the controller instance.
87
+ */
88
+ createReactiveField<T>(propertyName: string, initialValue: T, options?: ReactiveFieldOptions): void;
89
+ /**
90
+ * Defines a controller prop backed by the attached host element's property
91
+ * channel instead of attribute serialization.
92
+ *
93
+ * This gives controller-based integrations the same reactive field surface as
94
+ * `@prop(...)` on `RadiantElement`, while allowing external code to assign
95
+ * structured values such as arrays or objects directly on `controller.host`.
96
+ */
97
+ createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void;
98
+ /**
99
+ * Defines a JSX binding companion such as `$count` for a reactive member.
100
+ */
101
+ defineReactiveBinding(property: string, bind?: ReactiveBindingOption): void;
102
+ notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void;
103
+ registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void;
104
+ connectedContextCallback(_contextName: UnknownContext): void;
105
+ registerContextProvider(_name: string, _provider: unknown): void;
106
+ registerHydrationBinding(_name: string, _binding: SsrSerializableHydrationBinding): void;
107
+ registerCleanupCallback(callback: () => void): void;
108
+ registerConnectedCallback(callback: () => void): void;
109
+ registerReactiveDependencyReader(property: string, read: () => unknown): void;
110
+ trackReactiveRead(property: string): void;
111
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
112
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
113
+ dispatchEvent(event: Event): boolean;
114
+ /**
115
+ * Finds one or more elements inside the attached host by `data-ref`.
116
+ *
117
+ * Prefer `@query(...)` for stable, decorator-backed refs and use `getRef(...)`
118
+ * for one-off lookups.
119
+ */
120
+ getRef<T extends Element = Element>(ref: string, all: true): T[];
121
+ getRef<T extends Element = Element>(ref: string, all?: false): T | null;
122
+ protected shouldAutoBindReactiveMembers(): boolean;
123
+ protected shouldRunRenderLifecycle(): boolean;
124
+ private getRenderTarget;
125
+ private disconnectRenderWatcher;
126
+ private resolveTrackedRenderOutput;
127
+ }
128
+ export {};
@@ -0,0 +1,3 @@
1
+ var m=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(M,Q)=>(typeof require<"u"?require:M)[Q]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});var Y=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function N(q,M){let U=q[Y];if(Array.isArray(U)){U.push(M);return}Object.defineProperty(q,Y,{value:[M],configurable:!0})}function F(q){let M=[],Q=Object.getPrototypeOf(q);while(Q&&Q!==Object.prototype)M.push(Q),Q=Object.getPrototypeOf(Q);for(let U=M.length-1;U>=0;U-=1){let W=M[U][Y];if(!Array.isArray(W))continue;for(let $ of W)$(q)}}import{createSubscribableJsxValue as D}from"@ecopages/jsx";import{trackDependency as K}from"@ecopages/signals";class O{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(q){this.read=q}get(){return K(this),this.read()}subscribe(q){return this.subscribers.add(q),()=>{this.subscribers.delete(q)}}addWatcher(q){return this.watcherListeners.add(q),()=>{this.watcherListeners.delete(q)}}getVersion(){return this.version}notify(q){this.version+=1;let M;try{this.notifyWatchers()}catch(Q){M=Q}if(this.publish(q),M)throw M}publish(q){for(let M of this.subscribers)M(q)}notifyWatchers(){let q=[];for(let M of this.watcherListeners)try{M()}catch(Q){q.push(Q)}if(q.length===1)throw q[0];if(q.length>1)throw AggregateError(q,"Multiple reactive dependency notifications failed.")}}function P(q){return typeof q==="object"&&q!==null&&typeof q.get==="function"}class Z{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(q,M,Q){this.host=q;this.access=M;this.shouldAutoBind=Q;let U=this.createReactiveBindingNamespace();this.bindings=U,this.$=U}connectHost(){for(let q of this.onConnectedCallbacks)q()}disconnectHost(){for(let q of this.onDisconnectedCallback)q()}notifyUpdate(q,M,Q){if(M===Q)return;this.reactiveDependencies.get(q)?.notify(Q);let U=this.updateCallbacks.get(q);if(U)for(let W of U)W()}registerCleanupCallback(q){this.onDisconnectedCallback.push(q)}registerConnectedCallback(q){this.onConnectedCallbacks.push(q)}registerHydrationBinding(q,M){}registerReactiveDependencyReader(q,M){this.reactiveDependencyReaders.set(q,M)}registerUpdateCallback(q,M){if(!this.updateCallbacks.has(q))this.updateCallbacks.set(q,new Set);let Q=this.updateCallbacks.get(q);return Q.add(M),()=>{if(Q.delete(M),Q.size===0)this.updateCallbacks.delete(q)}}getReactiveBinding(q){let M=this.reactiveBindings.get(q);if(M)return M;let Q=D({getValue:()=>this.readReactiveBindingValue(q),subscribe:(U)=>this.registerUpdateCallback(q,()=>{U(this.readReactiveBindingValue(q))})});return this.reactiveBindings.set(q,Q),Q}bind(q){return this.getReactiveBinding(q)}defineReactiveBinding(q,M=!0){let Q=typeof M==="string"?M:M?`$${q}`:void 0,U=this.access.getBindingTarget?.(this.host)??this.host;if(!Q||this.access.hasProperty(this.host,Q))return;this.access.defineProperty(U,Q,{get:()=>this.getReactiveBinding(q),enumerable:!1,configurable:!0})}trackReactiveRead(q){K(this.getReactiveDependency(q))}defineReactiveAccessor(q,M){let Q=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(q,Q),this.registerReactiveDependencyReader(q,M.getValue),this.access.defineProperty(this.host,q,{get:()=>{return this.trackReactiveRead(q),M.getValue()},set:(U)=>{let W=M.getValue();if(W===U)return;M.setValue(U),this.notifyUpdate(q,W,U)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(q,void 0,M.notifyInitialValue)}createReactiveField(q,M,Q={}){let U={name:q,value:M,initialValue:M};this.reactiveFields.set(q,U),this.defineReactiveAccessor(q,{bind:Q.bind,getValue:()=>this.reactiveFields.get(q)?.value,setValue:(W)=>{this.reactiveFields.set(q,{...U,value:W})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(q,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(q){let M=this.reactiveDependencies.get(q);if(M)return M;let Q=new O(()=>this.readReactiveDependencyValue(q));return this.reactiveDependencies.set(q,Q),Q}readReactiveDependencyValue(q){let M=this.reactiveDependencyReaders.get(q);if(M)return M();return this.readReactiveBindingValue(q)}readReactiveBindingValue(q){let M=this.access.readProperty(this.host,q);if(P(M))return M.get();return M}}function L(q){switch(q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function x(q){switch(typeof q){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(q))return"array";if(Object.prototype.toString.call(q)==="[object Object]")return"object"}function B(q){switch(q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function A(q){try{return JSON.parse(q)}catch{throw TypeError("Invalid JSON string")}}var k={array(q){let M=A(q);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(q){return!(q==="0"||String(q).toLowerCase()==="false")},number(q){return Number(q.replace(/_/g,""))},object(q){let M=JSON.parse(q);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${q}" of type "${x(M)}"`);return M},string(q){return q}},J={default:C,array:_,object:_};function _(q){return JSON.stringify(q)}function C(q){return`${q}`}function j(q,M){let Q=L(M);if(!Q)throw TypeError(`[radiant-element] Unknown type "${M}"`);return k[Q](q)}function y(q,M){let Q=L(M);if(!Q)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(J[Q]??J.default??C)(q)}function R(q){return typeof q==="boolean"}function S(q){return typeof q==="number"}function T(q){return typeof q==="string"}function I(q){return Array.isArray(q)}function h(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}function E(q,M){switch(q){case Boolean:return R(M);case Number:return S(M);case String:return T(M);case Array:return I(M);case Object:return h(M);default:return!1}}var u=(q,M,Q,U)=>{if(M===Boolean){let $=q.getAttribute(Q);if($===null)return U;return $===""?!0:j($,M)}let W=q.getAttribute(Q);return W!==null?j(W,M):U??B(M)};import{render as w}from"@ecopages/jsx";import{Computed as g,subtle as f}from"@ecopages/signals";class z{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;isSsrLifecycle=!1;needsRender=!1;renderSignal;renderWatcher=new f.Watcher(()=>{this.requestUpdate()});constructor(q){this.host=q,this.element=q,this.reactiveHost=new Z(this,{defineProperty:(M,Q,U)=>Object.defineProperty(M,Q,U),hasProperty:(M,Q)=>(Q in M),readProperty:(M,Q)=>M[Q]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,F(this)}connect(){if(this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.isSsrLifecycle=!0;try{this.connect()}finally{this.isSsrLifecycle=!1}}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnect()}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let q=this.getRenderTarget();if(!q)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{w(this.resolveTrackedRenderOutput(),q)}finally{this.isRendering=!1}}}bind(q){return this.reactiveHost.bind(q)}getReactiveBinding(q){return this.reactiveHost.getReactiveBinding(q)}createReactiveField(q,M,Q={}){this.reactiveHost.createReactiveField(q,M,Q)}createReactiveProp(q,M){let{type:Q,defaultValue:U,bind:W}=M;if(U!==void 0&&!E(Q,U))throw Error(`defaultValue does not match the expected type for ${Q.name}`);let $=Object.getOwnPropertyDescriptor(this.host,q),G=this.host,H=G[q]??U??B(Q);this.reactiveHost.defineReactiveAccessor(q,{bind:W,getValue:()=>H,setValue:(X)=>{H=X},notifyInitialValue:H}),Object.defineProperty(this.host,q,{get:()=>this[q],set:(X)=>{this[q]=X},enumerable:$?.enumerable??!0,configurable:!0}),this.registerCleanupCallback(()=>{let X=this[q];if($){if(Object.defineProperty(this.host,q,$),"value"in $&&$.writable)G[q]=X;return}delete G[q];try{G[q]=X}catch{Object.defineProperty(this.host,q,{value:X,writable:!0,enumerable:!0,configurable:!0})}})}defineReactiveBinding(q,M=!0){this.reactiveHost.defineReactiveBinding(q,M)}notifyUpdate(q,M,Q){this.reactiveHost.notifyUpdate(q,M,Q)}registerUpdateCallback(q,M){return this.reactiveHost.registerUpdateCallback(q,M)}connectedContextCallback(q){}registerContextProvider(q,M){}registerHydrationBinding(q,M){}registerCleanupCallback(q){this.reactiveHost.registerCleanupCallback(q)}registerConnectedCallback(q){this.reactiveHost.registerConnectedCallback(q)}registerReactiveDependencyReader(q,M){this.reactiveHost.registerReactiveDependencyReader(q,M)}trackReactiveRead(q){this.reactiveHost.trackReactiveRead(q)}addEventListener(q,M,Q){this.host.addEventListener(q,M,Q)}removeEventListener(q,M,Q){this.host.removeEventListener(q,M,Q)}dispatchEvent(q){return this.host.dispatchEvent(q)}getRef(q,M=!1){let Q=`[data-ref="${q}"]`;if(M)return Array.from(this.host.querySelectorAll(Q));return this.host.querySelector(Q)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return!this.isSsrLifecycle&&this.render!==z.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let q=new g(()=>this.render()),M=q.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=q,this.renderWatcher.watch(q),M}}export{z as RadiantController};
2
+
3
+ //# debugId=3254076C7E6FE49F64756E2164756E21
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/core/reactive-host.ts", "../src/utils/attribute-utils.ts", "../src/core/radiant-controller.ts"],
4
+ "sourcesContent": [
5
+ "type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
6
+ "import { createSubscribableJsxValue, type SubscribableJsxValue } from '@ecopages/jsx';\nimport { trackDependency, type DependencyNode, type SignalSubscriber } from '@ecopages/signals';\nimport type {\n\tReactiveBindingOption,\n\tReactiveBindingValue,\n\tReactiveBindings,\n\tReactiveFieldOptions,\n} from './radiant-element';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\n\ntype StringPropertyKey<Value> = Extract<keyof Value, string>;\ntype ReactiveDependencyReader = () => unknown;\n\ntype ReactiveHostAccess<Host extends object> = {\n\tdefineProperty(target: object, property: string, descriptor: PropertyDescriptor): void;\n\tgetBindingTarget?(host: Host): object;\n\thasProperty(host: Host, property: string): boolean;\n\treadProperty(host: Host, property: string): unknown;\n};\n\ntype ReactiveField<T = unknown> = {\n\tname: string;\n\tvalue: T;\n\tinitialValue: T;\n};\n\ntype ReactiveAccessorOptions<T> = {\n\tbind?: ReactiveBindingOption;\n\tgetValue: () => T | undefined;\n\tsetValue: (value: T) => void;\n\tnotifyInitialValue?: T;\n};\n\n/**\n * Shared reactive-host contract consumed by decorators and host adapters.\n *\n * `RadiantElement` and `RadiantController` both implement this surface so the\n * decorator layer can define fields, bindings, context reactions, and tracked\n * reads without depending on a specific host class.\n */\nexport interface ReactiveHostLike<Bindings extends object = {}> {\n\treadonly bindings: ReactiveBindings<Bindings>;\n\treadonly $: ReactiveBindings<Bindings>;\n\tbind<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\tgetReactiveBinding<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\tcreateReactiveField<T>(propertyName: string, initialValue: T, options?: ReactiveFieldOptions): void;\n\tdefineReactiveBinding(property: string, bind?: ReactiveBindingOption): void;\n\tnotifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterHydrationBinding(name: string, binding: SsrSerializableHydrationBinding): void;\n\tregisterReactiveDependencyReader(property: string, read: () => unknown): void;\n\ttrackReactiveRead(property: string): void;\n}\n\n/**\n * Internal dependency node that bridges Radiant host members into the signals\n * tracking graph.\n */\nclass ReactiveHostDependency implements DependencyNode {\n\tprivate readonly subscribers = new Set<SignalSubscriber<unknown>>();\n\tprivate readonly watcherListeners = new Set<() => void>();\n\tprivate version = 0;\n\n\tconstructor(private readonly read: ReactiveDependencyReader) {}\n\n\tpublic get(): unknown {\n\t\ttrackDependency(this);\n\t\treturn this.read();\n\t}\n\n\tpublic subscribe(notify: SignalSubscriber<unknown>): () => void {\n\t\tthis.subscribers.add(notify);\n\n\t\treturn () => {\n\t\t\tthis.subscribers.delete(notify);\n\t\t};\n\t}\n\n\tpublic addWatcher(notify: () => void): () => void {\n\t\tthis.watcherListeners.add(notify);\n\n\t\treturn () => {\n\t\t\tthis.watcherListeners.delete(notify);\n\t\t};\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\tpublic notify(nextValue: unknown): void {\n\t\tthis.version += 1;\n\t\tlet watcherError: unknown;\n\n\t\ttry {\n\t\t\tthis.notifyWatchers();\n\t\t} catch (error) {\n\t\t\twatcherError = error;\n\t\t}\n\n\t\tthis.publish(nextValue);\n\n\t\tif (watcherError) {\n\t\t\tthrow watcherError;\n\t\t}\n\t}\n\n\tprivate publish(nextValue: unknown): void {\n\t\tfor (const subscriber of this.subscribers) {\n\t\t\tsubscriber(nextValue);\n\t\t}\n\t}\n\n\tprivate notifyWatchers(): void {\n\t\tconst errors: unknown[] = [];\n\n\t\tfor (const listener of this.watcherListeners) {\n\t\t\ttry {\n\t\t\t\tlistener();\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error);\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t}\n\n\t\tif (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, 'Multiple reactive dependency notifications failed.');\n\t\t}\n\t}\n}\n\nfunction isSignalLikeBindingValue(value: unknown): value is { get(): unknown } {\n\treturn typeof value === 'object' && value !== null && typeof (value as { get?: unknown }).get === 'function';\n}\n\n/**\n * Shared reactivity engine used by both `RadiantElement` and\n * `RadiantController`.\n *\n * This class owns three pieces of shared behavior:\n *\n * - defining reactive accessors on the host object\n * - exposing cached JSX bindings such as `bindings.count` and `$count`\n * - publishing tracked updates into the signals graph and update callbacks\n *\n * Host-specific concerns such as attribute reflection, render lifecycles, and\n * custom-element APIs stay in the outer host classes.\n */\nexport class ReactiveHost<Host extends object, Bindings extends object = {}> implements ReactiveHostLike<Bindings> {\n\tpublic readonly bindings: ReactiveBindings<Bindings>;\n\tpublic readonly $: ReactiveBindings<Bindings>;\n\n\tprivate reactiveFields = new Map<string, ReactiveField>();\n\tprivate reactiveDependencies = new Map<string, ReactiveHostDependency>();\n\tprivate reactiveDependencyReaders = new Map<string, ReactiveDependencyReader>();\n\tprivate reactiveBindings = new Map<string, SubscribableJsxValue>();\n\tprivate updateCallbacks = new Map<string, Set<(...rest: any[]) => any>>();\n\tprivate onConnectedCallbacks: (() => void)[] = [];\n\tprivate onDisconnectedCallback: (() => void)[] = [];\n\n\tconstructor(\n\t\tprivate readonly host: Host,\n\t\tprivate readonly access: ReactiveHostAccess<Host>,\n\t\tprivate readonly shouldAutoBind: () => boolean,\n\t) {\n\t\tconst bindingNamespace = this.createReactiveBindingNamespace();\n\t\tthis.bindings = bindingNamespace;\n\t\tthis.$ = bindingNamespace;\n\t}\n\n\t/**\n\t * Runs all connection callbacks registered by decorators or host adapters.\n\t */\n\tpublic connectHost(): void {\n\t\tfor (const callback of this.onConnectedCallbacks) {\n\t\t\tcallback();\n\t\t}\n\t}\n\n\t/**\n\t * Runs all cleanup callbacks registered for host disconnect.\n\t */\n\tpublic disconnectHost(): void {\n\t\tfor (const cleanup of this.onDisconnectedCallback) {\n\t\t\tcleanup();\n\t\t}\n\t}\n\n\t/**\n\t * Publishes a reactive member change to tracked dependencies and explicit\n\t * update callbacks.\n\t */\n\tpublic notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void {\n\t\tif (oldValue === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.reactiveDependencies.get(changedProperty)?.notify(value);\n\t\tconst updates = this.updateCallbacks.get(changedProperty);\n\n\t\tif (updates) {\n\t\t\tfor (const update of updates) {\n\t\t\t\tupdate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Registers a callback that should run when the outer host disconnects.\n\t */\n\tpublic registerCleanupCallback(callback: () => void): void {\n\t\tthis.onDisconnectedCallback.push(callback);\n\t}\n\n\t/**\n\t * Registers a callback that should run whenever the outer host connects.\n\t */\n\tpublic registerConnectedCallback(callback: () => void): void {\n\t\tthis.onConnectedCallbacks.push(callback);\n\t}\n\n\t/**\n\t * Placeholder hydration hook so shared decorators can target both host types.\n\t *\n\t * `ReactiveHost` itself does not persist hydration bindings; concrete hosts\n\t * such as `RadiantElement` can override this behavior at the outer layer.\n\t */\n\tpublic registerHydrationBinding(_name: string, _binding: SsrSerializableHydrationBinding): void {}\n\n\t/**\n\t * Registers a raw reader for a reactive member so tracked dependency reads do\n\t * not need to go back through the public accessor.\n\t */\n\tpublic registerReactiveDependencyReader(property: string, read: ReactiveDependencyReader): void {\n\t\tthis.reactiveDependencyReaders.set(property, read);\n\t}\n\n\t/**\n\t * Registers a callback that runs whenever a named reactive member changes.\n\t *\n\t * Returns a disposer that removes the callback.\n\t */\n\tpublic registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void {\n\t\tif (!this.updateCallbacks.has(property)) {\n\t\t\tthis.updateCallbacks.set(property, new Set());\n\t\t}\n\n\t\tconst callbacks = this.updateCallbacks.get(property)!;\n\t\tcallbacks.add(update);\n\n\t\treturn () => {\n\t\t\tcallbacks.delete(update);\n\n\t\t\tif (callbacks.size === 0) {\n\t\t\t\tthis.updateCallbacks.delete(property);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Returns the cached JSX binding object for a named reactive member.\n\t */\n\tpublic getReactiveBinding<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\tconst cachedBinding = this.reactiveBindings.get(property);\n\n\t\tif (cachedBinding) {\n\t\t\treturn cachedBinding as SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\t\t}\n\n\t\tconst binding = createSubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>({\n\t\t\tgetValue: () => this.readReactiveBindingValue(property) as ReactiveBindingValue<Bindings, Property>,\n\t\t\tsubscribe: (notify) =>\n\t\t\t\tthis.registerUpdateCallback(property, () => {\n\t\t\t\t\tnotify(this.readReactiveBindingValue(property) as ReactiveBindingValue<Bindings, Property>);\n\t\t\t\t}),\n\t\t});\n\n\t\tthis.reactiveBindings.set(property, binding);\n\t\treturn binding;\n\t}\n\n\t/**\n\t * Short alias for `getReactiveBinding(...)`.\n\t */\n\tpublic bind<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\treturn this.getReactiveBinding(property) as SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\t}\n\n\t/**\n\t * Defines a stable binding companion property such as `$count` on the host or\n\t * its chosen binding target.\n\t */\n\tpublic defineReactiveBinding(property: string, bind: ReactiveBindingOption = true): void {\n\t\tconst bindingPropertyName = typeof bind === 'string' ? bind : bind ? `$${property}` : undefined;\n\t\tconst bindingTarget = this.access.getBindingTarget?.(this.host) ?? this.host;\n\n\t\tif (!bindingPropertyName || this.access.hasProperty(this.host, bindingPropertyName)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.access.defineProperty(bindingTarget, bindingPropertyName, {\n\t\t\tget: () => this.getReactiveBinding(property as StringPropertyKey<Bindings>),\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\n\t/**\n\t * Records a dependency read for the named reactive member.\n\t */\n\tpublic trackReactiveRead(property: string): void {\n\t\ttrackDependency(this.getReactiveDependency(property));\n\t}\n\n\t/**\n\t * Defines a reactive getter/setter pair on the host and wires it into\n\t * bindings, dependency tracking, and update notifications.\n\t */\n\tpublic defineReactiveAccessor<T>(propertyName: string, options: ReactiveAccessorOptions<T>): void {\n\t\tconst bind = options.bind ?? this.shouldAutoBind();\n\n\t\tthis.defineReactiveBinding(propertyName, bind);\n\t\tthis.registerReactiveDependencyReader(propertyName, options.getValue);\n\n\t\tthis.access.defineProperty(this.host, propertyName, {\n\t\t\tget: () => {\n\t\t\t\tthis.trackReactiveRead(propertyName);\n\t\t\t\treturn options.getValue();\n\t\t\t},\n\t\t\tset: (newValue: T) => {\n\t\t\t\tconst oldValue = options.getValue();\n\n\t\t\t\tif (oldValue === newValue) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\toptions.setValue(newValue);\n\t\t\t\tthis.notifyUpdate(propertyName, oldValue, newValue);\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\n\t\tif (options.notifyInitialValue !== undefined) {\n\t\t\tthis.notifyUpdate(propertyName, undefined, options.notifyInitialValue);\n\t\t}\n\t}\n\n\t/**\n\t * Defines a controller- or element-local reactive field with optional JSX\n\t * binding exposure.\n\t */\n\tpublic createReactiveField<T>(propertyName: string, initialValue: T, options: ReactiveFieldOptions = {}): void {\n\t\tconst reactiveField: ReactiveField<T> = {\n\t\t\tname: propertyName,\n\t\t\tvalue: initialValue,\n\t\t\tinitialValue,\n\t\t};\n\n\t\tthis.reactiveFields.set(propertyName, reactiveField);\n\n\t\tthis.defineReactiveAccessor(propertyName, {\n\t\t\tbind: options.bind,\n\t\t\tgetValue: () => this.reactiveFields.get(propertyName)?.value as T | undefined,\n\t\t\tsetValue: (newValue: T) => {\n\t\t\t\tthis.reactiveFields.set(propertyName, { ...reactiveField, value: newValue });\n\t\t\t},\n\t\t\tnotifyInitialValue: initialValue,\n\t\t});\n\t}\n\n\tprivate createReactiveBindingNamespace(): ReactiveBindings<Bindings> {\n\t\treturn new Proxy(Object.create(null) as ReactiveBindings<Bindings>, {\n\t\t\tget: (_target, property) => {\n\t\t\t\tif (typeof property !== 'string') {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn this.getReactiveBinding(property as StringPropertyKey<Bindings>);\n\t\t\t},\n\t\t}) as ReactiveBindings<Bindings>;\n\t}\n\n\tprivate getReactiveDependency(property: string): ReactiveHostDependency {\n\t\tconst cachedDependency = this.reactiveDependencies.get(property);\n\n\t\tif (cachedDependency) {\n\t\t\treturn cachedDependency;\n\t\t}\n\n\t\tconst dependency = new ReactiveHostDependency(() => this.readReactiveDependencyValue(property));\n\t\tthis.reactiveDependencies.set(property, dependency);\n\t\treturn dependency;\n\t}\n\n\tprivate readReactiveDependencyValue(property: string): unknown {\n\t\tconst reader = this.reactiveDependencyReaders.get(property);\n\n\t\tif (reader) {\n\t\t\treturn reader();\n\t\t}\n\n\t\treturn this.readReactiveBindingValue(property as StringPropertyKey<Bindings>);\n\t}\n\n\tprivate readReactiveBindingValue<Property extends StringPropertyKey<Bindings>>(property: Property): unknown {\n\t\tconst value = this.access.readProperty(this.host, property);\n\n\t\tif (isSignalLikeBindingValue(value)) {\n\t\t\treturn value.get();\n\t\t}\n\n\t\treturn value;\n\t}\n}\n",
7
+ "import type { RadiantElement } from '../core/radiant-element';\n\nexport type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn readers[readerType]!(value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
8
+ "import { render as renderJsx, type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';\nimport { Computed, subtle } from '@ecopages/signals';\nimport type { UnknownContext } from '../context/types';\nimport { runLegacyInstanceInitializers } from '../decorators/legacy/instance-initializers';\nimport { ReactiveHost, type ReactiveHostLike } from './reactive-host';\nimport type {\n\tReactivePropertyOptions,\n\tReactiveBindingValue,\n\tReactiveBindings,\n\tReactiveFieldOptions,\n} from './radiant-element';\nimport type { ReactiveBindingOption } from './radiant-element';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\nimport { defaultValueForType, isValueOfType } from '../utils/attribute-utils';\n\ntype StringPropertyKey<Value> = Extract<keyof Value, string>;\n\n/**\n * Attaches Radiant reactivity to an existing DOM element without defining a\n * custom element.\n *\n * `RadiantController` is the controller-host counterpart to `RadiantElement`.\n * It can enhance authored DOM, or it can take over the host's inner DOM by\n * overriding `render()`.\n *\n * When used with the controller registry, the attached host is typically an\n * element carrying `data-controller=\"...\"`.\n *\n * @typeParam Bindings - Explicit internal bindable shape. Include only the\n * reactive keys that JSX bindings should accept.\n */\nexport class RadiantController<Bindings extends object = {}> implements ReactiveHostLike<Bindings> {\n\tpublic readonly host: Element;\n\tpublic readonly element: Element;\n\tpublic readonly bindings: ReactiveBindings<Bindings>;\n\tpublic readonly $: ReactiveBindings<Bindings>;\n\n\tprivate readonly reactiveHost: ReactiveHost<this, Bindings>;\n\tprivate connected = false;\n\tprivate isRendering = false;\n\tprivate isRenderScheduled = false;\n\tprivate isSsrLifecycle = false;\n\tprivate needsRender = false;\n\tprivate renderSignal?: Computed<JsxRenderable>;\n\tprivate readonly renderWatcher = new subtle.Watcher(() => {\n\t\tthis.requestUpdate();\n\t});\n\n\tconstructor(host: Element) {\n\t\tthis.host = host;\n\t\tthis.element = host;\n\t\tthis.reactiveHost = new ReactiveHost<this, Bindings>(\n\t\t\tthis,\n\t\t\t{\n\t\t\t\tdefineProperty: (target, property, descriptor) => Object.defineProperty(target, property, descriptor),\n\t\t\t\thasProperty: (target, property) => property in target,\n\t\t\t\treadProperty: (target, property) => (target as Record<string, unknown>)[property],\n\t\t\t},\n\t\t\t() => this.shouldAutoBindReactiveMembers(),\n\t\t);\n\t\tthis.bindings = this.reactiveHost.bindings;\n\t\tthis.$ = this.reactiveHost.$;\n\t\trunLegacyInstanceInitializers(this);\n\t}\n\n\t/**\n\t * Connects the controller to its host and starts reactive subscriptions.\n\t *\n\t * If the controller owns a render lifecycle by overriding `render()`, the\n\t * first update runs immediately after connection.\n\t */\n\tpublic connect(): void {\n\t\tthis.connected = true;\n\t\tthis.reactiveHost.connectHost();\n\n\t\tif (this.shouldRunRenderLifecycle()) {\n\t\t\tthis.update();\n\t\t}\n\t}\n\n\t/**\n\t * Connects the controller for server-side rendering without running the\n\t * browser render/update lifecycle.\n\t */\n\tpublic connectForSsrRender(): void {\n\t\tthis.isSsrLifecycle = true;\n\n\t\ttry {\n\t\t\tthis.connect();\n\t\t} finally {\n\t\t\tthis.isSsrLifecycle = false;\n\t\t}\n\t}\n\n\t/**\n\t * Disconnects the controller from its host and tears down reactive work.\n\t */\n\tpublic disconnect(): void {\n\t\tthis.connected = false;\n\t\tthis.disconnectRenderWatcher();\n\t\tthis.reactiveHost.disconnectHost();\n\t}\n\n\t/**\n\t * Disconnects a controller that was attached through the SSR-only lifecycle.\n\t */\n\tpublic disconnectForSsrRender(): void {\n\t\tthis.disconnect();\n\t}\n\n\tpublic get isConnected(): boolean {\n\t\treturn this.connected;\n\t}\n\n\t/**\n\t * Returns the JSX tree rendered into the attached host.\n\t *\n\t * The base implementation renders nothing. Override this method when the\n\t * controller should own the host's inner DOM instead of only enhancing\n\t * authored markup.\n\t */\n\tpublic render(): JsxRenderable {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Schedules a render pass for render-owning controllers.\n\t *\n\t * Multiple calls in the same microtask are coalesced into a single update.\n\t */\n\tpublic requestUpdate(): void {\n\t\tif (!this.shouldRunRenderLifecycle()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.needsRender = true;\n\n\t\tif (this.isRenderScheduled) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.isRenderScheduled = true;\n\n\t\tqueueMicrotask(() => {\n\t\t\tthis.isRenderScheduled = false;\n\n\t\t\tif (!this.needsRender) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.update();\n\t\t});\n\t}\n\n\t/**\n\t * Flushes the current render output into the attached host element.\n\t *\n\t * This is a no-op unless the controller overrides `render()`.\n\t */\n\tpublic update(): void {\n\t\tif (!this.shouldRunRenderLifecycle()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst renderTarget = this.getRenderTarget();\n\n\t\tif (!renderTarget) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.needsRender = true;\n\n\t\tif (!this.connected || this.isRendering) {\n\t\t\treturn;\n\t\t}\n\n\t\twhile (this.needsRender) {\n\t\t\tthis.needsRender = false;\n\t\t\tthis.isRendering = true;\n\n\t\t\ttry {\n\t\t\t\trenderJsx(this.resolveTrackedRenderOutput(), renderTarget);\n\t\t\t} finally {\n\t\t\t\tthis.isRendering = false;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns a subscribable JSX binding for a selected reactive member.\n\t */\n\tpublic bind<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\treturn this.reactiveHost.bind(property);\n\t}\n\n\t/**\n\t * Returns the cached binding object for a selected reactive member.\n\t */\n\tpublic getReactiveBinding<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\treturn this.reactiveHost.getReactiveBinding(property);\n\t}\n\n\t/**\n\t * Defines a reactive field directly on the controller instance.\n\t */\n\tpublic createReactiveField<T>(propertyName: string, initialValue: T, options: ReactiveFieldOptions = {}): void {\n\t\tthis.reactiveHost.createReactiveField(propertyName, initialValue, options);\n\t}\n\n\t/**\n\t * Defines a controller prop backed by the attached host element's property\n\t * channel instead of attribute serialization.\n\t *\n\t * This gives controller-based integrations the same reactive field surface as\n\t * `@prop(...)` on `RadiantElement`, while allowing external code to assign\n\t * structured values such as arrays or objects directly on `controller.host`.\n\t */\n\tpublic createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void {\n\t\tconst { type, defaultValue, bind } = options;\n\n\t\tif (defaultValue !== undefined && !isValueOfType(type, defaultValue)) {\n\t\t\tthrow new Error(`defaultValue does not match the expected type for ${type.name}`);\n\t\t}\n\n\t\tconst ownDescriptor = Object.getOwnPropertyDescriptor(this.host, propertyName);\n\t\tconst hostRecord = this.host as unknown as Record<PropertyKey, unknown>;\n\t\tconst initialHostValue = hostRecord[propertyName] as T | undefined;\n\t\tlet currentValue = (initialHostValue ?? defaultValue ?? defaultValueForType(type)) as T;\n\n\t\tthis.reactiveHost.defineReactiveAccessor(propertyName, {\n\t\t\tbind,\n\t\t\tgetValue: () => currentValue,\n\t\t\tsetValue: (newValue: T) => {\n\t\t\t\tcurrentValue = newValue;\n\t\t\t},\n\t\t\tnotifyInitialValue: currentValue,\n\t\t});\n\n\t\tObject.defineProperty(this.host, propertyName, {\n\t\t\tget: () => (this as Record<PropertyKey, unknown>)[propertyName],\n\t\t\tset: (newValue: T) => {\n\t\t\t\t(this as Record<PropertyKey, unknown>)[propertyName] = newValue;\n\t\t\t},\n\t\t\tenumerable: ownDescriptor?.enumerable ?? true,\n\t\t\tconfigurable: true,\n\t\t});\n\n\t\tthis.registerCleanupCallback(() => {\n\t\t\tconst finalValue = (this as Record<PropertyKey, unknown>)[propertyName];\n\n\t\t\tif (ownDescriptor) {\n\t\t\t\tObject.defineProperty(this.host, propertyName, ownDescriptor);\n\n\t\t\t\tif ('value' in ownDescriptor && ownDescriptor.writable) {\n\t\t\t\t\thostRecord[propertyName] = finalValue;\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdelete hostRecord[propertyName];\n\n\t\t\ttry {\n\t\t\t\thostRecord[propertyName] = finalValue;\n\t\t\t} catch {\n\t\t\t\tObject.defineProperty(this.host, propertyName, {\n\t\t\t\t\tvalue: finalValue,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Defines a JSX binding companion such as `$count` for a reactive member.\n\t */\n\tpublic defineReactiveBinding(property: string, bind: ReactiveBindingOption = true): void {\n\t\tthis.reactiveHost.defineReactiveBinding(property, bind);\n\t}\n\n\tpublic notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void {\n\t\tthis.reactiveHost.notifyUpdate(changedProperty, oldValue, value);\n\t}\n\n\tpublic registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void {\n\t\treturn this.reactiveHost.registerUpdateCallback(property, update);\n\t}\n\n\tpublic connectedContextCallback(_contextName: UnknownContext): void {}\n\n\tpublic registerContextProvider(_name: string, _provider: unknown): void {\n\t\t// Controller context support is currently client-only.\n\t}\n\n\tpublic registerHydrationBinding(_name: string, _binding: SsrSerializableHydrationBinding): void {}\n\n\tpublic registerCleanupCallback(callback: () => void): void {\n\t\tthis.reactiveHost.registerCleanupCallback(callback);\n\t}\n\n\tpublic registerConnectedCallback(callback: () => void): void {\n\t\tthis.reactiveHost.registerConnectedCallback(callback);\n\t}\n\n\tpublic registerReactiveDependencyReader(property: string, read: () => unknown): void {\n\t\tthis.reactiveHost.registerReactiveDependencyReader(property, read);\n\t}\n\n\tpublic trackReactiveRead(property: string): void {\n\t\tthis.reactiveHost.trackReactiveRead(property);\n\t}\n\n\tpublic addEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void {\n\t\tthis.host.addEventListener(type, listener, options);\n\t}\n\n\tpublic removeEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | EventListenerOptions,\n\t): void {\n\t\tthis.host.removeEventListener(type, listener, options);\n\t}\n\n\tpublic dispatchEvent(event: Event): boolean {\n\t\treturn this.host.dispatchEvent(event);\n\t}\n\n\t/**\n\t * Finds one or more elements inside the attached host by `data-ref`.\n\t *\n\t * Prefer `@query(...)` for stable, decorator-backed refs and use `getRef(...)`\n\t * for one-off lookups.\n\t */\n\tpublic getRef<T extends Element = Element>(ref: string, all: true): T[];\n\tpublic getRef<T extends Element = Element>(ref: string, all?: false): T | null;\n\tpublic getRef<T extends Element = Element>(ref: string, all = false): T | T[] | null {\n\t\tconst selector = `[data-ref=\"${ref}\"]`;\n\n\t\tif (all) {\n\t\t\treturn Array.from(this.host.querySelectorAll(selector)) as T[];\n\t\t}\n\n\t\treturn (this.host.querySelector(selector) as T) ?? null;\n\t}\n\n\tprotected shouldAutoBindReactiveMembers(): boolean {\n\t\treturn true;\n\t}\n\n\tprotected shouldRunRenderLifecycle(): boolean {\n\t\treturn !this.isSsrLifecycle && this.render !== RadiantController.prototype.render;\n\t}\n\n\tprivate getRenderTarget(): HTMLElement | null {\n\t\treturn this.host instanceof HTMLElement ? this.host : null;\n\t}\n\n\tprivate disconnectRenderWatcher(): void {\n\t\tif (!this.renderSignal) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.renderWatcher.unwatch(this.renderSignal);\n\t\tthis.renderSignal = undefined;\n\t}\n\n\tprivate resolveTrackedRenderOutput(): JsxRenderable {\n\t\tconst nextRenderSignal = new Computed(() => this.render());\n\t\tconst output = nextRenderSignal.get();\n\n\t\tif (!this.connected) {\n\t\t\treturn output;\n\t\t}\n\n\t\tif (this.renderSignal) {\n\t\t\tthis.renderWatcher.unwatch(this.renderSignal);\n\t\t}\n\n\t\tthis.renderSignal = nextRenderSignal;\n\t\tthis.renderWatcher.watch(nextRenderSignal);\n\t\treturn output;\n\t}\n}\n"
9
+ ],
10
+ "mappings": "2PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAQzF,SAAS,CAAmD,CAClE,EACA,EACO,CAEP,IAAM,EADS,EACgB,GAE/B,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAO,EAA8B,CAC1D,MAAO,CAAC,CAAW,EACnB,aAAc,EACf,CAAC,EASK,SAAS,CAA+C,CAAC,EAAmB,CAClF,IAAM,EAAuB,CAAC,EAC1B,EAAmB,OAAO,eAAe,CAAQ,EAErD,MAAO,GAAoB,IAAqB,OAAO,UACtD,EAAW,KAAK,CAAgB,EAChC,EAAmB,OAAO,eAAe,CAAgB,EAG1D,QAAS,EAAQ,EAAW,OAAS,EAAG,GAAS,EAAG,GAAS,EAAG,CAC/D,IAAM,EAAgB,EAAW,GAAwC,GAIzE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,SAGD,QAAW,KAAe,EACzB,EAAY,CAAQ,GCrDvB,qCAAS,sBACT,0BAAS,0BA8DT,MAAM,CAAiD,CAKzB,KAJZ,YAAc,IAAI,IAClB,iBAAmB,IAAI,IAChC,QAAU,EAElB,WAAW,CAAkB,EAAgC,CAAhC,YAEtB,GAAG,EAAY,CAErB,OADA,EAAgB,IAAI,EACb,KAAK,KAAK,EAGX,SAAS,CAAC,EAA+C,CAG/D,OAFA,KAAK,YAAY,IAAI,CAAM,EAEpB,IAAM,CACZ,KAAK,YAAY,OAAO,CAAM,GAIzB,UAAU,CAAC,EAAgC,CAGjD,OAFA,KAAK,iBAAiB,IAAI,CAAM,EAEzB,IAAM,CACZ,KAAK,iBAAiB,OAAO,CAAM,GAI9B,UAAU,EAAW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BAAiB,EAAM,EAAU,CAAO,EAG5C,mBAAmB,CACzB,EACA,EACA,EACO,CACP,KAAK,KAAK,oBAAoB,EAAM,EAAU,CAAO,EAG/C,aAAa,CAAC,EAAuB,CAC3C,OAAO,KAAK,KAAK,cAAc,CAAK,EAW9B,MAAmC,CAAC,EAAa,EAAM,GAAuB,CACpF,IAAM,EAAW,cAAc,MAE/B,GAAI,EACH,OAAO,MAAM,KAAK,KAAK,KAAK,iBAAiB,CAAQ,CAAC,EAGvD,OAAQ,KAAK,KAAK,cAAc,CAAQ,GAAW,KAG1C,6BAA6B,EAAY,CAClD,MAAO,GAGE,wBAAwB,EAAY,CAC7C,MAAO,CAAC,KAAK,gBAAkB,KAAK,SAAW,EAAkB,UAAU,OAGpE,eAAe,EAAuB,CAC7C,OAAO,KAAK,gBAAgB,YAAc,KAAK,KAAO,KAG/C,uBAAuB,EAAS,CACvC,GAAI,CAAC,KAAK,aACT,OAGD,KAAK,cAAc,QAAQ,KAAK,YAAY,EAC5C,KAAK,aAAe,OAGb,0BAA0B,EAAkB,CACnD,IAAM,EAAmB,IAAI,EAAS,IAAM,KAAK,OAAO,CAAC,EACnD,EAAS,EAAiB,IAAI,EAEpC,GAAI,CAAC,KAAK,UACT,OAAO,EAGR,GAAI,KAAK,aACR,KAAK,cAAc,QAAQ,KAAK,YAAY,EAK7C,OAFA,KAAK,aAAe,EACpB,KAAK,cAAc,MAAM,CAAgB,EAClC,EAET",
11
+ "debugId": "3254076C7E6FE49F64756E2164756E21",
12
+ "names": []
13
+ }
@@ -1,14 +1,16 @@
1
1
  import type { EventEmitter } from '../tools';
2
2
  import { type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';
3
+ import type { RenderToStringOptions } from '@ecopages/jsx/server';
3
4
  import type { SsrSerializableContextProvider } from '../context/context-provider';
4
5
  import type { UnknownContext } from '../context/types';
5
6
  import type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';
7
+ import { type RadiantElementRenderBridge } from './radiant-component-ssr-registry';
6
8
  import { type AttributeTypeConstant, type ReadAttributeValueReturnType, type WriteAttributeValueReturnType } from '../utils/attribute-utils';
7
9
  declare const RadiantElementBase: {
8
10
  new (): HTMLElement;
9
11
  prototype: HTMLElement;
10
12
  };
11
- type ReactiveDependencyReader = () => unknown;
13
+ type RadiantRenderTarget = HTMLElement | ShadowRoot;
12
14
  /**
13
15
  * Possible positions to insert a rendered template.
14
16
  */
@@ -225,30 +227,21 @@ export interface IRadiantElement<Bindings extends object = {}> {
225
227
  * @implements IRadiantElement<Bindings>
226
228
  */
227
229
  export declare class RadiantElement<Bindings extends object = {}> extends RadiantElementBase implements IRadiantElement<Bindings> {
230
+ /**
231
+ * Controls where the JSX render lifecycle mounts the component view.
232
+ *
233
+ * Subclasses can override this with `'shadow'` to force an internal open
234
+ * shadow root for client-side rendering. Host SSR helpers remain light-DOM
235
+ * only and throw when shadow render mode is enabled.
236
+ */
237
+ protected readonly renderRootMode: 'light' | 'shadow';
228
238
  readonly bindings: ReactiveBindings<Bindings>;
229
239
  readonly $: ReactiveBindings<Bindings>;
240
+ private readonly reactiveHost;
230
241
  /**
231
242
  * A map of property metadata objects, it contains useful information about the properties configured via decorators.
232
243
  */
233
244
  private reactiveProperties;
234
- /**
235
- * A map of reactive fields, it contains the reactive fields configured via decorators.
236
- */
237
- private reactiveFields;
238
- /**
239
- * Stable dependency nodes used when plain reactive member reads participate
240
- * in tracked component renders.
241
- */
242
- private reactiveDependencies;
243
- /**
244
- * Raw value readers for reactive members whose public getter should also
245
- * register tracked render dependencies.
246
- */
247
- private reactiveDependencyReaders;
248
- /**
249
- * Stable subscribable JSX bindings keyed by reactive property name.
250
- */
251
- private reactiveBindings;
252
245
  /**
253
246
  * Registered context providers keyed by decorated property name.
254
247
  */
@@ -257,10 +250,6 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
257
250
  * Registered keyed hydration payload producers appended to SSR host output.
258
251
  */
259
252
  private hydrationBindings;
260
- /**
261
- * A map of property update callbacks. These callbacks are called when a property is updated.
262
- */
263
- private updateCallbacks;
264
253
  /**
265
254
  * A map of event subscriptions used to manage event listeners on the Radiant element.
266
255
  */
@@ -269,20 +258,36 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
269
258
  * A map for event emitters
270
259
  */
271
260
  private eventEmitters;
272
- /**
273
- * Callbacks executed whenever the Radiant element is connected to the DOM.
274
- */
275
- private onConnectedCallbacks;
276
- /**
277
- * An array of cleanup callbacks to be executed when the Radiant element is disconnected from the DOM.
278
- */
279
- private onDisconnectedCallback;
280
261
  /**
281
262
  * A flag indicating whether the element has been connected to the DOM.
282
263
  */
283
264
  private elementReady;
265
+ private isRendering;
266
+ private isFirstConnectPending;
267
+ private isRenderScheduled;
268
+ private needsRender;
269
+ /**
270
+ * Snapshot of own-property values that existed before Radiant installs the
271
+ * reactive accessors for declared props.
272
+ *
273
+ * "Pre-upgrade" refers to the custom-element upgrade window where user code,
274
+ * SSR boot code, or another framework assigns `element.someProp = value`
275
+ * before the browser has finished constructing the final custom-element class
276
+ * instance with its accessors in place.
277
+ *
278
+ * Those early assignments land as plain own properties on the element. If we
279
+ * define a reactive accessor later without first capturing them, the accessor
280
+ * would either miss the assigned value or remain shadowed by the own property.
281
+ * `createReactiveProp()` consumes this snapshot so the early value becomes the
282
+ * prop's initial reactive state.
283
+ */
284
+ private readonly preUpgradePropertyValues;
285
+ private projectedSlotContent;
286
+ private renderSignal?;
287
+ private readonly renderWatcher;
288
+ private slotProjectionObserver?;
289
+ private slotProjectionVersion;
284
290
  constructor();
285
- private createReactiveBindingNamespace;
286
291
  connectedCallback(): void;
287
292
  connectedContextCallback(_contextName: UnknownContext): void;
288
293
  disconnectedCallback(): void;
@@ -303,10 +308,16 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
303
308
  insert?: RenderInsertPosition;
304
309
  sanitize?: (html: string) => string;
305
310
  }): void;
311
+ render(): JsxRenderable;
312
+ renderToString(options?: RenderToStringOptions): string;
313
+ renderHost(): JsxRenderable;
314
+ renderHostToString(options?: RenderToStringOptions): string;
315
+ hydrate(): void;
316
+ requestUpdate(): void;
317
+ update(): void;
306
318
  registerReactiveProperty(config: ReactiveProperty): void;
307
319
  protected getReactiveProperties(): ReactiveProperty[];
308
- registerReactiveField<T>(config: ReactiveField<T>): void;
309
- registerReactiveDependencyReader(property: string, read: ReactiveDependencyReader): void;
320
+ registerReactiveDependencyReader(property: string, read: () => unknown): void;
310
321
  registerContextProvider(name: string, provider: SsrSerializableContextProvider): void;
311
322
  registerHydrationBinding(name: string, binding: SsrSerializableHydrationBinding): void;
312
323
  protected getContextProviders(): SsrSerializableContextProvider[];
@@ -322,20 +333,24 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
322
333
  /**
323
334
  * Returns the default JSX binding policy for reactive members on this host.
324
335
  *
325
- * Plain `RadiantElement` instances keep binding opt-in. JSX-first hosts such
326
- * as `RadiantComponent` override this hook to opt into automatic bindings for
327
- * `@prop`, `@state`, and direct `createReactiveProp`/`createReactiveField`
328
- * calls when no explicit `bind` option is supplied.
336
+ * `RadiantElement` hosts default to automatic bindings for reactive members
337
+ * when no explicit `bind` option is supplied.
338
+ *
339
+ * Lower-level hosts can override this hook to opt out when they want binding
340
+ * creation to stay fully explicit across `@prop`, `@state`, and direct
341
+ * `createReactiveProp`/`createReactiveField` calls.
329
342
  */
330
343
  protected shouldAutoBindReactiveMembers(): boolean;
344
+ protected shouldRunRenderLifecycle(): boolean;
345
+ /** Returns the DOM root used by client-side render and hydrate work. */
346
+ protected getRenderTarget(): RadiantRenderTarget;
347
+ protected getHostSsrAttributes(): Record<string, string>;
348
+ protected resolveSsrRenderBridge(): RadiantElementRenderBridge;
331
349
  registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void;
332
350
  getReactiveBinding<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
333
351
  bind<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
334
352
  defineReactiveBinding(property: string, bind?: ReactiveBindingOption): void;
335
- private getReactiveDependency;
336
353
  trackReactiveRead(property: string): void;
337
- private readReactiveDependencyValue;
338
- private readReactiveBindingValue;
339
354
  subscribeEvents(events: RadiantElementEventListener[]): Array<() => void>;
340
355
  subscribeEvent(eventConfig: RadiantElementEventListener): () => void;
341
356
  private unsubscribeEvent;
@@ -355,7 +370,31 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
355
370
  registerEventEmitter(name: string, emitter: EventEmitter): void;
356
371
  getRef<T extends Element = Element>(ref: string, all: true): T[];
357
372
  getRef<T extends Element = Element>(ref: string, all?: false): T | null;
373
+ getSlotElement<T extends Element = Element>(name?: string): T | null;
374
+ getSlotElements<T extends Element = Element>(name?: string): T[];
358
375
  createReactiveField<T>(propertyName: string, initialValue: T, options?: ReactiveFieldOptions): void;
376
+ /**
377
+ * Defines a reactive custom-element property backed by a Radiant accessor.
378
+ *
379
+ * When the host was assigned a value before upgrade, that pre-upgrade value is
380
+ * preferred over attribute parsing and `defaultValue` so early `.prop = value`
381
+ * writes survive into the reactive lifecycle.
382
+ */
359
383
  createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void;
384
+ private ensureSlotProjectionState;
385
+ private getHostChildNodeCount;
386
+ private getSlotProjectionScriptTag;
387
+ private getAuthoredHydrationScriptMarkup;
388
+ private handleSlotProjectionMutations;
389
+ private addProjectedSlotNode;
390
+ private removeProjectedSlotNode;
391
+ private observeSlotProjection;
392
+ private disconnectSlotProjectionObserver;
393
+ private disconnectRenderWatcher;
394
+ private resolveTrackedRenderOutput;
395
+ private resolveRenderOutput;
396
+ private getEventSubscriptionTarget;
397
+ private getQueryRoot;
398
+ private assertSupportsHostSsrRendering;
360
399
  }
361
400
  export {};
@@ -1,3 +1,3 @@
1
- import{Y as a}from"../chunk-gdkte2vd.js";import"../chunk-eyw14d6y.js";import"../chunk-cnyxrh9r.js";import"../chunk-66e6s792.js";import"../chunk-vgtggzb6.js";export{a as RadiantElement};
1
+ var h0=((Q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(Q,{get:($,W)=>(typeof require<"u"?require:$)[W]}):Q)(function(Q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+Q+'" is not supported')});var D=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function f0(Q,$){let X=Q[D];if(Array.isArray(X)){X.push($);return}Object.defineProperty(Q,D,{value:[$],configurable:!0})}function _(Q){let $=[],W=Object.getPrototypeOf(Q);while(W&&W!==Object.prototype)$.push(W),W=Object.getPrototypeOf(W);for(let X=$.length-1;X>=0;X-=1){let Z=$[X][D];if(!Array.isArray(Z))continue;for(let q of Z)q(Q)}}import{createSubscribableJsxValue as W0}from"@ecopages/jsx";import{trackDependency as C}from"@ecopages/signals";class I{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(Q){this.read=Q}get(){return C(this),this.read()}subscribe(Q){return this.subscribers.add(Q),()=>{this.subscribers.delete(Q)}}addWatcher(Q){return this.watcherListeners.add(Q),()=>{this.watcherListeners.delete(Q)}}getVersion(){return this.version}notify(Q){this.version+=1;let $;try{this.notifyWatchers()}catch(W){$=W}if(this.publish(Q),$)throw $}publish(Q){for(let $ of this.subscribers)$(Q)}notifyWatchers(){let Q=[];for(let $ of this.watcherListeners)try{$()}catch(W){Q.push(W)}if(Q.length===1)throw Q[0];if(Q.length>1)throw AggregateError(Q,"Multiple reactive dependency notifications failed.")}}function X0(Q){return typeof Q==="object"&&Q!==null&&typeof Q.get==="function"}class w{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(Q,$,W){this.host=Q;this.access=$;this.shouldAutoBind=W;let X=this.createReactiveBindingNamespace();this.bindings=X,this.$=X}connectHost(){for(let Q of this.onConnectedCallbacks)Q()}disconnectHost(){for(let Q of this.onDisconnectedCallback)Q()}notifyUpdate(Q,$,W){if($===W)return;this.reactiveDependencies.get(Q)?.notify(W);let X=this.updateCallbacks.get(Q);if(X)for(let Z of X)Z()}registerCleanupCallback(Q){this.onDisconnectedCallback.push(Q)}registerConnectedCallback(Q){this.onConnectedCallbacks.push(Q)}registerHydrationBinding(Q,$){}registerReactiveDependencyReader(Q,$){this.reactiveDependencyReaders.set(Q,$)}registerUpdateCallback(Q,$){if(!this.updateCallbacks.has(Q))this.updateCallbacks.set(Q,new Set);let W=this.updateCallbacks.get(Q);return W.add($),()=>{if(W.delete($),W.size===0)this.updateCallbacks.delete(Q)}}getReactiveBinding(Q){let $=this.reactiveBindings.get(Q);if($)return $;let W=W0({getValue:()=>this.readReactiveBindingValue(Q),subscribe:(X)=>this.registerUpdateCallback(Q,()=>{X(this.readReactiveBindingValue(Q))})});return this.reactiveBindings.set(Q,W),W}bind(Q){return this.getReactiveBinding(Q)}defineReactiveBinding(Q,$=!0){let W=typeof $==="string"?$:$?`$${Q}`:void 0,X=this.access.getBindingTarget?.(this.host)??this.host;if(!W||this.access.hasProperty(this.host,W))return;this.access.defineProperty(X,W,{get:()=>this.getReactiveBinding(Q),enumerable:!1,configurable:!0})}trackReactiveRead(Q){C(this.getReactiveDependency(Q))}defineReactiveAccessor(Q,$){let W=$.bind??this.shouldAutoBind();if(this.defineReactiveBinding(Q,W),this.registerReactiveDependencyReader(Q,$.getValue),this.access.defineProperty(this.host,Q,{get:()=>{return this.trackReactiveRead(Q),$.getValue()},set:(X)=>{let Z=$.getValue();if(Z===X)return;$.setValue(X),this.notifyUpdate(Q,Z,X)},enumerable:!0,configurable:!0}),$.notifyInitialValue!==void 0)this.notifyUpdate(Q,void 0,$.notifyInitialValue)}createReactiveField(Q,$,W={}){let X={name:Q,value:$,initialValue:$};this.reactiveFields.set(Q,X),this.defineReactiveAccessor(Q,{bind:W.bind,getValue:()=>this.reactiveFields.get(Q)?.value,setValue:(Z)=>{this.reactiveFields.set(Q,{...X,value:Z})},notifyInitialValue:$})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(Q,$)=>{if(typeof $!=="string")return;return this.getReactiveBinding($)}})}getReactiveDependency(Q){let $=this.reactiveDependencies.get(Q);if($)return $;let W=new I(()=>this.readReactiveDependencyValue(Q));return this.reactiveDependencies.set(Q,W),W}readReactiveDependencyValue(Q){let $=this.reactiveDependencyReaders.get(Q);if($)return $();return this.readReactiveBindingValue(Q)}readReactiveBindingValue(Q){let $=this.access.readProperty(this.host,Q);if(X0($))return $.get();return $}}var L=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),A=Symbol.for("@ecopages/radiant.ssr-preparation-running");function v0(Q,$){let X=Q[L];if(Array.isArray(X)){X.push($);return}Object.defineProperty(Q,L,{value:[$],configurable:!0})}function S(Q){let $=Q,W=$[L];if(!Array.isArray(W))return;$[A]=!0;try{for(let X of W)X()}finally{delete $[A]}}function R(Q){return Q.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var F="data-hydration",T="data-hydration-type",O="data-hydration-key";function s0(Q){let $=Q.hydrationKey?` ${O}="${Z0(Q.hydrationKey)}"`:"";return`<script type="application/json" ${F} ${T}="${Q.type}"${$}>${Q.serializedValue}</script>`}function u0(Q){return R(Q)}function d0(Q,$){let W=Q.textContent;if(!W)return $;try{return JSON.parse(W)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${F}>:`,W.slice(0,120));return $}}function i0(Q,$,W){let X=Q.children;if(!X||X.length===0){let Z=Q.childNodes;if(!Z||Z.length===0)return null;for(let q=0;q<Z.length;q+=1){let G=Z[q];if(G.nodeType!==1)continue;let M=G;if(h(M,$,W))return M}return null}for(let Z=0;Z<X.length;Z+=1)if(h(X[Z],$,W))return X[Z];return null}function h(Q,$,W){if(Q.tagName!=="SCRIPT"||!Q.hasAttribute(F)||Q.getAttribute(T)!==$)return!1;if(W!==void 0)return Q.getAttribute(O)===W;return!Q.hasAttribute(O)}function Z0(Q){return Q.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}import{createMarkupNodeLike as q0,isKeyedJsxValue as f,isSlotJsxValue as G0}from"@ecopages/jsx";var z="",H="data-radiant-slot-projection";function N(Q){let $=new Map;for(let W of Array.from(Q.childNodes)){if(z0(W))continue;J0($,M0(W),W)}return $}function V(Q){let $;try{$=JSON.parse(Q)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",Q.slice(0,120));return new Map}let W=new Map;for(let[X,Z]of Object.entries($)){if(!Array.isArray(Z)||Z.length===0)continue;W.set(P(X),Z.map((q)=>q0(q)))}return W}function g(Q){let $=Array.from(Q.childNodes).filter((W)=>s(W)).map((W)=>B(W)??"").filter((W)=>W!=="");return $.length>0?$.join(""):void 0}function m(Q){let $={};for(let[W,X]of Q.entries()){let Z=X.map((q)=>B(q)).filter((q)=>q!==void 0&&q!=="");if(Z.length>0)$[W]=Z}return Object.keys($).length>0?JSON.stringify($):void 0}function v(Q,$){let W=!1,X=(q)=>{if(G0(q))return W=!0,B0(q,$,X);if(f(q))return F0(q,X(q.value));if(U0(q))return{_$rType$:1,rootLocalName:q.rootLocalName,strings:q.strings,values:q.values.map((G)=>X(G))};if(c(q))return Array.from(q,(G)=>X(G));return q},Z=X(Q);return{containsSlots:W,value:Z}}function b(Q){for(let $ of Array.from(Q.childNodes)){if(!y($))continue;let W=$.textContent??void 0;return $.parentNode?.removeChild($),W}return}function J0(Q,$,W){let X=Q.get($);if(X){X.push(W);return}Q.set($,[W])}function F0(Q,$){return{...Q,value:$}}function M0(Q){if(Q instanceof Element)return P(Q.getAttribute("slot"));return z}function c(Q){return typeof Q!=="string"&&typeof Q==="object"&&Q!==null&&Symbol.iterator in Q}function y(Q){return Q instanceof HTMLScriptElement&&Q.hasAttribute(H)}function s(Q){return Q instanceof HTMLScriptElement&&Q.hasAttribute(F)}function z0(Q){return y(Q)||s(Q)}function U0(Q){return typeof Q==="object"&&Q!==null&&Q._$rType$===1&&Array.isArray(Q.strings)&&Array.isArray(Q.values)}function P(Q){return Q??z}function B(Q){if(Q===void 0||Q===null||Q===!1||Q===!0)return;if(typeof Node<"u"&&Q instanceof Node){if(Q.nodeType===Node.TEXT_NODE)return Q.textContent??"";return Q.outerHTML??Q.textContent??void 0}if(f(Q))return B(Q.value);if(typeof Q==="string"||typeof Q==="number"||typeof Q==="bigint")return String(Q);if(typeof Q==="object"&&Q!==null&&"outerHTML"in Q)return typeof Q.outerHTML==="string"?Q.outerHTML:Q.textContent??void 0;if(c(Q))return Array.from(Q,($)=>B($)??"").join("");return}function B0(Q,$,W){let X=$.get(P(Q.name));if(X&&X.length>0)return X.length===1?X[0]:X;if(Q.fallback===void 0)return"";return W(Q.fallback)}var E=Symbol.for("@ecopages/radiant.hydrator-installed");function a0(){globalThis[E]=!0}function r0(){delete globalThis[E]}function u(){return globalThis[E]===!0}var d=Symbol.for("@ecopages/radiant.component-ssr-runtime");function i(){return globalThis[d]}function e0(Q){globalThis[d]=Q}function o(Q){switch(Q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function H0(Q){switch(typeof Q){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(Q))return"array";if(Object.prototype.toString.call(Q)==="[object Object]")return"object"}function Y0(Q){switch(Q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function K0(Q){try{return JSON.parse(Q)}catch{throw TypeError("Invalid JSON string")}}var j0={array(Q){let $=K0(Q);if(!Array.isArray($))throw TypeError(`Expected an array but got a value of type "${typeof $}"`);return $},boolean(Q){return!(Q==="0"||String(Q).toLowerCase()==="false")},number(Q){return Number(Q.replace(/_/g,""))},object(Q){let $=JSON.parse(Q);if($===null||typeof $!=="object"||Array.isArray($))throw TypeError(`expected value of type "object" but instead got value "${Q}" of type "${H0($)}"`);return $},string(Q){return Q}},p={default:n,array:l,object:l};function l(Q){return JSON.stringify(Q)}function n(Q){return`${Q}`}function Y(Q,$){let W=o($);if(!W)throw TypeError(`[radiant-element] Unknown type "${$}"`);return j0[W](Q)}function a(Q,$){let W=o($);if(!W)throw TypeError(`[radiant-element] Unknown type "${$}"`);return(p[W]??p.default??n)(Q)}function x0(Q){return typeof Q==="boolean"}function D0(Q){return typeof Q==="number"}function w0(Q){return typeof Q==="string"}function L0(Q){return Array.isArray(Q)}function O0(Q){return typeof Q==="object"&&!Array.isArray(Q)&&Q!==null}function r(Q,$){switch(Q){case Boolean:return x0($);case Number:return D0($);case String:return w0($);case Array:return L0($);case Object:return O0($);default:return!1}}var t=(Q,$,W,X)=>{if($===Boolean){let q=Q.getAttribute(W);if(q===null)return X;return q===""?!0:Y(q,$)}let Z=Q.getAttribute(W);return Z!==null?Y(Z,$):X??Y0($)};import{hasHydrationMarkers as P0,hydrate as E0,jsx as k0,render as _0}from"@ecopages/jsx";import{Computed as C0,subtle as I0}from"@ecopages/signals";var A0=S0();function S0(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class j extends A0{renderRootMode="light";bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;preUpgradePropertyValues=new Map;projectedSlotContent=new Map;renderSignal;renderWatcher=new I0.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();for(let Q of Object.getOwnPropertyNames(this))this.preUpgradePropertyValues.set(Q,this[Q]);this.reactiveHost=new w(this,{defineProperty:(Q,$,W)=>Object.defineProperty(Q,$,W),getBindingTarget:(Q)=>Object.getPrototypeOf(Q)??Q,hasProperty:(Q,$)=>($ in Q),readProperty:(Q,$)=>Q[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,_(this)}connectedCallback(){let Q=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),Q)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),e(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(Q){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(Q,$,W){this.reactiveHost.notifyUpdate(Q,$,W)}transformAttributeValue(Q,$){return Q!==null?$?.converter.fromAttribute(Q):Q}attributeChangedCallback(Q,$,W){if($===W||!this.elementReady)return;if(this.reactiveProperties.has(Q)){let X=this.reactiveProperties.get(Q),Z=this.transformAttributeValue(W,X),q=this.transformAttributeValue($,X),G=X?X.attribute:Q;this[G]=Z,this.notifyUpdate(Q,q,Z)}}renderTemplate({target:Q=this,template:$,insert:W="replace",sanitize:X}){let Z=X?X($):$;switch(W){case"replace":Q.innerHTML=Z;break;case"beforeend":Q.insertAdjacentHTML("beforeend",Z);break;case"afterbegin":Q.insertAdjacentHTML("afterbegin",Z);break;case"beforebegin":Q.insertAdjacentHTML("beforebegin",Z);break;case"afterend":Q.insertAdjacentHTML("afterend",Z);break}}render(){return k0("slot",{})}renderToString(Q={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),K().renderView(this,Q)}renderHost(){return this.assertSupportsHostSsrRendering(),K().renderHost(this)}renderHostToString(Q={}){return this.assertSupportsHostSsrRendering(),K().renderHostToString(this,Q)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;let Q=this.getRenderTarget();this.isRendering=!0,this.disconnectSlotProjectionObserver();try{E0(this.resolveTrackedRenderOutput().value,Q)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let Q=this.getRenderTarget();if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&e(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{_0(this.resolveTrackedRenderOutput().value,Q)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(Q){this.reactiveProperties.set(Q.name,Q)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(Q,$){this.reactiveHost.registerReactiveDependencyReader(Q,$)}registerContextProvider(Q,$){this.contextProviders.set(Q,$),this.registerHydrationBinding(Q,$)}registerHydrationBinding(Q,$){this.hydrationBindings.set(Q,$)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){S(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==j.prototype.render}getRenderTarget(){if(this.renderRootMode!=="shadow")return this;if(this.shadowRoot)return this.shadowRoot;if(typeof this.attachShadow!=="function")throw Error("RadiantElement shadow render mode requires attachShadow().");return this.attachShadow({mode:"open"})}getHostSsrAttributes(){return K().getHostAttributes(this)}resolveSsrRenderBridge(){let Q={};if(this.renderHostToString===j.prototype.renderHostToString)Q.renderHostToString=($)=>this.renderHostToString($);if(this.renderHost===j.prototype.renderHost)Q.renderHost=()=>this.renderHost();return Q}registerUpdateCallback(Q,$){return this.reactiveHost.registerUpdateCallback(Q,$)}getReactiveBinding(Q){return this.reactiveHost.getReactiveBinding(Q)}bind(Q){return this.reactiveHost.bind(Q)}defineReactiveBinding(Q,$=!0){this.reactiveHost.defineReactiveBinding(Q,$)}trackReactiveRead(Q){this.reactiveHost.trackReactiveRead(Q)}subscribeEvents(Q){let $=[];for(let W of Q)$.push(this.subscribeEvent(W));return $}subscribeEvent(Q){let $=this.getEventSubscriptionTarget(),W=(Z)=>{if(Z.target&&Z.target.matches(Q.selector))Q.listener.call(this,Z)},X=`${Q.type}:${Q.selector}`;return $.addEventListener(Q.type,W,Q.options),this.eventSubscriptions.set(X,{...Q,listener:W,target:$}),this.unsubscribeEvent.bind(this,X)}unsubscribeEvent(Q){let $=this.eventSubscriptions.get(Q);if($)$.target.removeEventListener($.type,$.listener,$.options),this.eventSubscriptions.delete(Q)}removeAllSubscribedEvents(){for(let Q of this.eventSubscriptions.values())Q.target.removeEventListener(Q.type,Q.listener,Q.options);this.eventSubscriptions.clear()}registerCleanupCallback(Q){this.reactiveHost.registerCleanupCallback(Q)}registerConnectedCallback(Q){this.reactiveHost.registerConnectedCallback(Q)}registerEventEmitter(Q,$){this.eventEmitters.set(Q,$)}getRef(Q,$=!1){let W=`[data-ref="${Q}"]`,X=this.getQueryRoot();if($)return Array.from(X.querySelectorAll(W));return X.querySelector(W)??null}getSlotElement(Q){return this.getSlotElements(Q)[0]??null}getSlotElements(Q){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(Q??z)??[]).filter(($)=>typeof Node<"u"&&$ instanceof Element)}createReactiveField(Q,$,W={}){this.reactiveHost.createReactiveField(Q,$,W)}createReactiveProp(Q,$){let{type:W,attribute:X,reflect:Z,defaultValue:q}=$,G=X??Q,M=this.preUpgradePropertyValues.has(Q),Q0=M?this.preUpgradePropertyValues.get(Q):void 0;if(q!==void 0&&!r(W,q))throw Error(`defaultValue does not match the expected type for ${W.name}`);let U=M?Q0:t(this,W,G,q);if(this.hasAttribute(G)&&(!Z||U==null||U===""))this.removeAttribute(G);if(M&&Object.prototype.hasOwnProperty.call(this,Q))Reflect.deleteProperty(this,Q);let x={type:W,name:Q,value:U,initialValue:U,attribute:G,converter:{fromAttribute:(J)=>Y(J,W),toAttribute:(J)=>a(J,W)}};this.registerReactiveProperty(x);let k=(J)=>{if(Z)if(J==null||J===""||J===!1)this.removeAttribute(G);else{let $0=x.converter.toAttribute(J);this.setAttribute(G,$0)}};if(this.reactiveHost.defineReactiveAccessor(Q,{bind:$.bind,getValue:()=>this.reactiveProperties.get(Q)?.value,setValue:(J)=>{this.reactiveProperties.set(Q,{...x,value:J}),k(J)}}),U!==void 0)queueMicrotask(()=>{let J=this.reactiveProperties.get(Q)?.value;if(J===void 0)return;k(J),this.notifyUpdate(Q,void 0,J)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let Q=this.isConnected?b(this):void 0;if(typeof Q==="string"&&Q!==""){this.projectedSlotContent=V(Q),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=N(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let Q=m(this.projectedSlotContent);if(!Q)return;return`<script type="application/json" ${H}>${R0(Q)}</script>`}getAuthoredHydrationScriptMarkup(){let Q=g(this);if(Q)return Q;return}handleSlotProjectionMutations(Q){let $=!1;for(let W of Q){for(let X of Array.from(W.removedNodes))if(this.removeProjectedSlotNode(X))$=!0;for(let X of Array.from(W.addedNodes)){if(X.parentNode!==this)continue;if(this.addProjectedSlotNode(X))$=!0}}if($)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(Q){if(Q instanceof HTMLScriptElement&&(Q.hasAttribute(H)||Q.hasAttribute(F)))return!1;let $=Q instanceof Element?Q.getAttribute("slot")??z:z,W=this.projectedSlotContent.get($);if(W){if(W.includes(Q))return!1;return W.push(Q),!0}return this.projectedSlotContent.set($,[Q]),!0}removeProjectedSlotNode(Q){for(let[$,W]of this.projectedSlotContent.entries()){let X=W.indexOf(Q);if(X===-1)continue;if(W.splice(X,1),W.length===0)this.projectedSlotContent.delete($);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((Q)=>this.handleSlotProjectionMutations(Q)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let Q=new C0(()=>this.resolveRenderOutput()),$=Q.get();if(!this.isConnected)return $;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=Q,this.renderWatcher.watch(Q),$}resolveRenderOutput(){return this.ensureSlotProjectionState(),v(this.render(),this.projectedSlotContent)}getEventSubscriptionTarget(){let Q=this.getRenderTarget();return Q instanceof ShadowRoot?Q:this}getQueryRoot(){let Q=this.getRenderTarget();return Q instanceof ShadowRoot?Q:this}assertSupportsHostSsrRendering(){if(this.renderRootMode==="shadow")throw Error("RadiantElement shadow render mode does not support renderHost() or renderHostToString().")}}function K(){let Q=i();if(!Q)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return Q}function e(Q){return u()&&P0(Q)}function R0(Q){return Q.replace(/</g,"\\u003c")}export{j as RadiantElement};
2
2
 
3
- //# debugId=AFB01FEC1FA2614F64756E2164756E21
3
+ //# debugId=00E7CEE7F33A213F64756E2164756E21