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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (464) 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/server/context-ssr.js +2 -2
  243. package/dist/server/context-ssr.js.map +5 -3
  244. package/dist/server/html-parser.js +2 -2
  245. package/dist/server/html-parser.js.map +4 -3
  246. package/dist/server/install-light-dom-shim.js +2 -2
  247. package/dist/server/install-light-dom-shim.js.map +5 -3
  248. package/dist/server/light-dom-shim.d.ts +9 -0
  249. package/dist/server/light-dom-shim.js +2 -2
  250. package/dist/server/light-dom-shim.js.map +5 -3
  251. package/dist/server/project-root.js +2 -2
  252. package/dist/server/project-root.js.map +2 -2
  253. package/dist/server/radiant-component-ssr-runtime.d.ts +2 -2
  254. package/dist/server/radiant-component-ssr-runtime.js +2 -2
  255. package/dist/server/radiant-component-ssr-runtime.js.map +11 -3
  256. package/dist/server/render-component.d.ts +3 -13
  257. package/dist/server/render-component.js +2 -2
  258. package/dist/server/render-component.js.map +14 -4
  259. package/dist/server/render-controller.d.ts +57 -0
  260. package/dist/server/render-controller.js +3 -0
  261. package/dist/server/render-controller.js.map +23 -0
  262. package/dist/server/slot-projection-html.js +2 -2
  263. package/dist/server/slot-projection-html.js.map +7 -3
  264. package/dist/signals/host-resource.js +2 -2
  265. package/dist/signals/host-resource.js.map +2 -2
  266. package/dist/signals/host-signal.d.ts +4 -2
  267. package/dist/signals/host-signal.js +2 -2
  268. package/dist/signals/host-signal.js.map +7 -3
  269. package/dist/signals/hydration-script.js +2 -2
  270. package/dist/signals/hydration-script.js.map +6 -3
  271. package/dist/tools/escape-css-identifier.d.ts +1 -0
  272. package/dist/tools/escape-css-identifier.js +3 -0
  273. package/dist/tools/escape-css-identifier.js.map +10 -0
  274. package/dist/tools/escape-script-json.js +2 -2
  275. package/dist/tools/escape-script-json.js.map +4 -3
  276. package/dist/tools/event-emitter.js +2 -2
  277. package/dist/tools/event-emitter.js.map +4 -3
  278. package/dist/tools/index.d.ts +1 -1
  279. package/dist/tools/index.js +2 -2
  280. package/dist/tools/index.js.map +7 -3
  281. package/dist/tools/render-jsx-template.js +2 -2
  282. package/dist/tools/render-jsx-template.js.map +4 -3
  283. package/dist/types.js +2 -2
  284. package/dist/types.js.map +2 -2
  285. package/dist/utils/attribute-utils.js +2 -2
  286. package/dist/utils/attribute-utils.js.map +4 -3
  287. package/dist/utils/index.js +2 -2
  288. package/dist/utils/index.js.map +4 -3
  289. package/package.json +32 -8
  290. package/size-budget.json +12 -3
  291. package/dist/chunk-0bswvy25.js +0 -4
  292. package/dist/chunk-0bswvy25.js.map +0 -10
  293. package/dist/chunk-0btkzzyc.js +0 -4
  294. package/dist/chunk-0btkzzyc.js.map +0 -10
  295. package/dist/chunk-0g0j9re6.js +0 -4
  296. package/dist/chunk-0g0j9re6.js.map +0 -10
  297. package/dist/chunk-1x26p09c.js +0 -4
  298. package/dist/chunk-1x26p09c.js.map +0 -10
  299. package/dist/chunk-21a7jask.js +0 -4
  300. package/dist/chunk-21a7jask.js.map +0 -10
  301. package/dist/chunk-25zjh0kg.js +0 -4
  302. package/dist/chunk-25zjh0kg.js.map +0 -10
  303. package/dist/chunk-30x4hggg.js +0 -4
  304. package/dist/chunk-30x4hggg.js.map +0 -10
  305. package/dist/chunk-3ryr5wx2.js +0 -4
  306. package/dist/chunk-3ryr5wx2.js.map +0 -10
  307. package/dist/chunk-3xxvmd5c.js +0 -4
  308. package/dist/chunk-3xxvmd5c.js.map +0 -10
  309. package/dist/chunk-3ynk7e1e.js +0 -4
  310. package/dist/chunk-3ynk7e1e.js.map +0 -10
  311. package/dist/chunk-4e559cy5.js +0 -4
  312. package/dist/chunk-4e559cy5.js.map +0 -10
  313. package/dist/chunk-5b1en9vz.js +0 -4
  314. package/dist/chunk-5b1en9vz.js.map +0 -10
  315. package/dist/chunk-5bkat72n.js +0 -4
  316. package/dist/chunk-5bkat72n.js.map +0 -10
  317. package/dist/chunk-5qeaq3tj.js +0 -4
  318. package/dist/chunk-5qeaq3tj.js.map +0 -10
  319. package/dist/chunk-66e6s792.js +0 -4
  320. package/dist/chunk-66e6s792.js.map +0 -10
  321. package/dist/chunk-79jg8q67.js +0 -4
  322. package/dist/chunk-79jg8q67.js.map +0 -10
  323. package/dist/chunk-8d5ddvvf.js +0 -4
  324. package/dist/chunk-8d5ddvvf.js.map +0 -10
  325. package/dist/chunk-8e9fgtbn.js +0 -4
  326. package/dist/chunk-8e9fgtbn.js.map +0 -10
  327. package/dist/chunk-9mqtp3js.js +0 -4
  328. package/dist/chunk-9mqtp3js.js.map +0 -10
  329. package/dist/chunk-9rj2rwes.js +0 -4
  330. package/dist/chunk-9rj2rwes.js.map +0 -10
  331. package/dist/chunk-atms6yrh.js +0 -4
  332. package/dist/chunk-atms6yrh.js.map +0 -10
  333. package/dist/chunk-bk2nbmcd.js +0 -4
  334. package/dist/chunk-bk2nbmcd.js.map +0 -10
  335. package/dist/chunk-bk6qkvfp.js +0 -4
  336. package/dist/chunk-bk6qkvfp.js.map +0 -10
  337. package/dist/chunk-c0qyz98c.js +0 -4
  338. package/dist/chunk-c0qyz98c.js.map +0 -10
  339. package/dist/chunk-c52qhh0j.js +0 -4
  340. package/dist/chunk-c52qhh0j.js.map +0 -10
  341. package/dist/chunk-cnyxrh9r.js +0 -4
  342. package/dist/chunk-cnyxrh9r.js.map +0 -10
  343. package/dist/chunk-cvz9mrxa.js +0 -4
  344. package/dist/chunk-cvz9mrxa.js.map +0 -10
  345. package/dist/chunk-dabagjk6.js +0 -4
  346. package/dist/chunk-dabagjk6.js.map +0 -10
  347. package/dist/chunk-e0r6ca2g.js +0 -4
  348. package/dist/chunk-e0r6ca2g.js.map +0 -10
  349. package/dist/chunk-eevw1j2q.js +0 -4
  350. package/dist/chunk-eevw1j2q.js.map +0 -10
  351. package/dist/chunk-ek664x1c.js +0 -4
  352. package/dist/chunk-ek664x1c.js.map +0 -10
  353. package/dist/chunk-eyw14d6y.js +0 -4
  354. package/dist/chunk-eyw14d6y.js.map +0 -10
  355. package/dist/chunk-fs4j94bk.js +0 -4
  356. package/dist/chunk-fs4j94bk.js.map +0 -10
  357. package/dist/chunk-g2z3mm6b.js +0 -4
  358. package/dist/chunk-g2z3mm6b.js.map +0 -10
  359. package/dist/chunk-g5n3m11h.js +0 -4
  360. package/dist/chunk-g5n3m11h.js.map +0 -10
  361. package/dist/chunk-gdkte2vd.js +0 -4
  362. package/dist/chunk-gdkte2vd.js.map +0 -10
  363. package/dist/chunk-gg74gdpv.js +0 -4
  364. package/dist/chunk-gg74gdpv.js.map +0 -10
  365. package/dist/chunk-h9k7crjc.js +0 -4
  366. package/dist/chunk-h9k7crjc.js.map +0 -10
  367. package/dist/chunk-hpzgnxgq.js +0 -4
  368. package/dist/chunk-hpzgnxgq.js.map +0 -10
  369. package/dist/chunk-hrjc8b1y.js +0 -4
  370. package/dist/chunk-hrjc8b1y.js.map +0 -10
  371. package/dist/chunk-hvy4zvcc.js +0 -4
  372. package/dist/chunk-hvy4zvcc.js.map +0 -10
  373. package/dist/chunk-hztr86b4.js +0 -4
  374. package/dist/chunk-hztr86b4.js.map +0 -10
  375. package/dist/chunk-j3v7rca5.js +0 -4
  376. package/dist/chunk-j3v7rca5.js.map +0 -10
  377. package/dist/chunk-j864sv4w.js +0 -4
  378. package/dist/chunk-j864sv4w.js.map +0 -10
  379. package/dist/chunk-jkb2y7c8.js +0 -4
  380. package/dist/chunk-jkb2y7c8.js.map +0 -10
  381. package/dist/chunk-kakpjgzf.js +0 -4
  382. package/dist/chunk-kakpjgzf.js.map +0 -10
  383. package/dist/chunk-kmebacvv.js +0 -4
  384. package/dist/chunk-kmebacvv.js.map +0 -10
  385. package/dist/chunk-knqsm6v3.js +0 -4
  386. package/dist/chunk-knqsm6v3.js.map +0 -10
  387. package/dist/chunk-mp2vtrkg.js +0 -4
  388. package/dist/chunk-mp2vtrkg.js.map +0 -10
  389. package/dist/chunk-mpsj3cjs.js +0 -4
  390. package/dist/chunk-mpsj3cjs.js.map +0 -10
  391. package/dist/chunk-n4p2542b.js +0 -4
  392. package/dist/chunk-n4p2542b.js.map +0 -10
  393. package/dist/chunk-nctznxyz.js +0 -4
  394. package/dist/chunk-nctznxyz.js.map +0 -10
  395. package/dist/chunk-ndw3hc3v.js +0 -4
  396. package/dist/chunk-ndw3hc3v.js.map +0 -10
  397. package/dist/chunk-nnnb6pac.js +0 -4
  398. package/dist/chunk-nnnb6pac.js.map +0 -10
  399. package/dist/chunk-nssj2x13.js +0 -4
  400. package/dist/chunk-nssj2x13.js.map +0 -10
  401. package/dist/chunk-nvr37vma.js +0 -4
  402. package/dist/chunk-nvr37vma.js.map +0 -10
  403. package/dist/chunk-p8k4g99a.js +0 -4
  404. package/dist/chunk-p8k4g99a.js.map +0 -10
  405. package/dist/chunk-pkszgjqf.js +0 -4
  406. package/dist/chunk-pkszgjqf.js.map +0 -10
  407. package/dist/chunk-q9z6tnzw.js +0 -4
  408. package/dist/chunk-q9z6tnzw.js.map +0 -10
  409. package/dist/chunk-qdz5sncz.js +0 -4
  410. package/dist/chunk-qdz5sncz.js.map +0 -10
  411. package/dist/chunk-qe0eww1n.js +0 -4
  412. package/dist/chunk-qe0eww1n.js.map +0 -10
  413. package/dist/chunk-r33zvvda.js +0 -4
  414. package/dist/chunk-r33zvvda.js.map +0 -10
  415. package/dist/chunk-rkh1vkb9.js +0 -4
  416. package/dist/chunk-rkh1vkb9.js.map +0 -10
  417. package/dist/chunk-rrg759ht.js +0 -4
  418. package/dist/chunk-rrg759ht.js.map +0 -10
  419. package/dist/chunk-s09s5ayx.js +0 -4
  420. package/dist/chunk-s09s5ayx.js.map +0 -10
  421. package/dist/chunk-s5p5z3z4.js +0 -4
  422. package/dist/chunk-s5p5z3z4.js.map +0 -10
  423. package/dist/chunk-sf4a2gy5.js +0 -4
  424. package/dist/chunk-sf4a2gy5.js.map +0 -10
  425. package/dist/chunk-ssnnxzrj.js +0 -4
  426. package/dist/chunk-ssnnxzrj.js.map +0 -10
  427. package/dist/chunk-t8xtvgyg.js +0 -4
  428. package/dist/chunk-t8xtvgyg.js.map +0 -10
  429. package/dist/chunk-v3ta7hnv.js +0 -4
  430. package/dist/chunk-v3ta7hnv.js.map +0 -10
  431. package/dist/chunk-v92hp9g0.js +0 -4
  432. package/dist/chunk-v92hp9g0.js.map +0 -10
  433. package/dist/chunk-vgtggzb6.js +0 -4
  434. package/dist/chunk-vgtggzb6.js.map +0 -9
  435. package/dist/chunk-vk48hgm4.js +0 -4
  436. package/dist/chunk-vk48hgm4.js.map +0 -10
  437. package/dist/chunk-w8s5fnsq.js +0 -4
  438. package/dist/chunk-w8s5fnsq.js.map +0 -10
  439. package/dist/chunk-wd23rn4q.js +0 -4
  440. package/dist/chunk-wd23rn4q.js.map +0 -10
  441. package/dist/chunk-wds4href.js +0 -4
  442. package/dist/chunk-wds4href.js.map +0 -10
  443. package/dist/chunk-wvd1ffe4.js +0 -4
  444. package/dist/chunk-wvd1ffe4.js.map +0 -10
  445. package/dist/chunk-wwbjz9k4.js +0 -4
  446. package/dist/chunk-wwbjz9k4.js.map +0 -10
  447. package/dist/chunk-x2k0ngpz.js +0 -4
  448. package/dist/chunk-x2k0ngpz.js.map +0 -10
  449. package/dist/chunk-x457d0ap.js +0 -4
  450. package/dist/chunk-x457d0ap.js.map +0 -10
  451. package/dist/chunk-xbhtzkre.js +0 -4
  452. package/dist/chunk-xbhtzkre.js.map +0 -10
  453. package/dist/chunk-y139ycfm.js +0 -4
  454. package/dist/chunk-y139ycfm.js.map +0 -10
  455. package/dist/chunk-z9kxfckm.js +0 -4
  456. package/dist/chunk-z9kxfckm.js.map +0 -10
  457. package/dist/chunk-zx5txex8.js +0 -4
  458. package/dist/chunk-zx5txex8.js.map +0 -10
  459. package/dist/core/radiant-component.d.ts +0 -113
  460. package/dist/core/radiant-component.js +0 -3
  461. package/dist/core/radiant-component.js.map +0 -9
  462. package/dist/tools/stringify-typed.d.ts +0 -16
  463. package/dist/tools/stringify-typed.js +0 -3
  464. package/dist/tools/stringify-typed.js.map +0 -9
@@ -1,3 +1,3 @@
1
- import{Ea as a,Fa as b,Ga as c}from"../chunk-nnnb6pac.js";import"../chunk-dabagjk6.js";import"../chunk-hpzgnxgq.js";import"../chunk-nssj2x13.js";import"../chunk-vgtggzb6.js";export{a as isWritableSignalLike,c as createHostSignal,b as HostSignal};
1
+ var K=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(G,Q)=>(typeof require<"u"?require:G)[Q]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});function J(q){return q.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var W="data-hydration",L="data-hydration-type",F="data-hydration-key";function M(q){let G=q.hydrationKey?` ${F}="${U(q.hydrationKey)}"`:"";return`<script type="application/json" ${W} ${L}="${q.type}"${G}>${q.serializedValue}</script>`}function P(q){return J(q)}function z(q,G){let Q=q.textContent;if(!Q)return G;try{return JSON.parse(Q)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${W}>:`,Q.slice(0,120));return G}}function g(q,G,Q){let Z=q.children;if(!Z||Z.length===0){let X=q.childNodes;if(!X||X.length===0)return null;for(let $=0;$<X.length;$+=1){let j=X[$];if(j.nodeType!==1)continue;let w=j;if(C(w,G,Q))return w}return null}for(let X=0;X<Z.length;X+=1)if(C(Z[X],G,Q))return Z[X];return null}function C(q,G,Q){if(q.tagName!=="SCRIPT"||!q.hasAttribute(W)||q.getAttribute(L)!==G)return!1;if(Q!==void 0)return q.getAttribute(F)===Q;return!q.hasAttribute(F)}function U(q){return q.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f(q){return M({type:"signal",...q})}function B(q){return P(q)}import{createMarkupNodeLike as O}from"@ecopages/jsx";import{state as b}from"@ecopages/signals";function m(q){return typeof q==="object"&&q!==null&&typeof q.get==="function"&&typeof q.set==="function"&&typeof q.subscribe==="function"&&typeof q.update==="function"}class D{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(q){this.host=q.host,this.hydrate=q.hydrate,this.hydrationKey=q.hydrationKey,this.property=q.property,this.source=q.source??b(this.resolveInitialValue(q.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(q){this.source.set(q)}subscribe(q){return this.source.subscribe(q)}update(q){this.set(q(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let q=this.source.get();if(!Object.is(this.currentValue,q)){let G=this.currentValue;this.currentValue=q,this.host.notifyUpdate(this.property,G,q)}this.sourceUnsubscribe=this.source.subscribe((G)=>{this.handleSourceChange(G)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let q=this.source.get(),G=this.resolveInitialValue(q);if(!Object.is(q,G))this.source.set(G),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,q,this.currentValue)}renderHydrationScript(){let q=this.renderHydrationScriptTag();if(!q)return;return O(q)}renderHydrationScriptTag(){let q=this.serializeHydrationValue();if(!q)return;return f({hydrationKey:this.hydrationKey,serializedValue:q})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return g(this.host,"signal",this.hydrationKey)}isObject(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}resolveInitialValue(q){if(!this.hydrate)return q;let G=this.findHydrationScriptElement();if(!G)return q;let Q=z(G,q);if(this.hydrate===Object&&this.isObject(Q)&&this.isObject(q))return{...q,...Q};return Q}serializeHydrationValue(){if(!this.hydrate)return;let q=JSON.stringify(this.get());if(typeof q!=="string")return;return B(q)}handleSourceChange(q){let G=this.currentValue;if(this.currentValue=q,!Object.is(G,q))this.host.notifyUpdate(this.property,G,q)}}function H(q){return new D(q)}export{m as isWritableSignalLike,H as createHostSignal,D as HostSignal};
2
2
 
3
- //# debugId=8C425FB12C13013F64756E2164756E21
3
+ //# debugId=D824BBB0A9C2DA3964756E2164756E21
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/tools/escape-script-json.ts", "../src/core/hydration-codec.ts", "../src/signals/hydration-script.ts", "../src/signals/host-signal.ts"],
4
4
  "sourcesContent": [
5
+ "/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
6
+ "import { escapeScriptJson } from '../tools/escape-script-json';\n\n/** Attribute marker used to identify hydration payloads inside a host. */\nexport const HYDRATION_ATTRIBUTE = 'data-hydration';\n/** Discriminator that scopes a hydration payload to a specific feature. */\nexport const HYDRATION_TYPE_ATTRIBUTE = 'data-hydration-type';\n/** Optional key that scopes a hydration payload to a specific decorated field. */\nexport const HYDRATION_KEY_ATTRIBUTE = 'data-hydration-key';\n\nexport type HydrationPayloadType = 'signal' | 'context';\n\ntype HydrationScriptHost = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\n/** Creates a `<script type=\"application/json\">` tag for a hydration payload. */\nexport function createHydrationScriptTag(options: {\n\ttype: HydrationPayloadType;\n\thydrationKey?: string;\n\tserializedValue: string;\n}): string {\n\tconst keyAttribute = options.hydrationKey\n\t\t? ` ${HYDRATION_KEY_ATTRIBUTE}=\"${escapeHtmlAttribute(options.hydrationKey)}\"`\n\t\t: '';\n\n\treturn `<script type=\"application/json\" ${HYDRATION_ATTRIBUTE} ${HYDRATION_TYPE_ATTRIBUTE}=\"${options.type}\"${keyAttribute}>${options.serializedValue}</script>`;\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeHydrationJson(value: string): string {\n\treturn escapeScriptJson(value);\n}\n\n/** Parses JSON from a hydration script element, returning the fallback on failure. */\nexport function parseHydrationPayload<T>(element: Element, fallback: T): T {\n\tconst textContent = element.textContent;\n\n\tif (!textContent) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(textContent) as T;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn(\n\t\t\t\t`[@ecopages/radiant] Failed to parse hydration payload from <script ${HYDRATION_ATTRIBUTE}>:`,\n\t\t\t\ttextContent.slice(0, 120),\n\t\t\t);\n\t\t}\n\t\treturn fallback;\n\t}\n}\n\n/**\n * Finds a hydration script element inside a host by type and optional key.\n *\n * When a key is provided, looks for an exact `data-hydration-key` match.\n * Otherwise, returns the first unkeyed script matching the type.\n */\nexport function findHydrationScript(\n\thost: HydrationScriptHost,\n\ttype: HydrationPayloadType,\n\thydrationKey?: string,\n): Element | null {\n\tconst children = host.children;\n\n\tif (!children || children.length === 0) {\n\t\tconst childNodes = (host as Partial<{ childNodes: ArrayLike<{ nodeType: number }> }>).childNodes;\n\n\t\tif (!childNodes || childNodes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (let i = 0; i < childNodes.length; i += 1) {\n\t\t\tconst node = childNodes[i]!;\n\n\t\t\tif (node.nodeType !== 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst element = node as unknown as Element;\n\n\t\t\tif (matchesHydrationScript(element, type, hydrationKey)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfor (let i = 0; i < children.length; i += 1) {\n\t\tif (matchesHydrationScript(children[i]!, type, hydrationKey)) {\n\t\t\treturn children[i]!;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction matchesHydrationScript(element: Element, type: HydrationPayloadType, hydrationKey?: string): boolean {\n\tif (\n\t\telement.tagName !== 'SCRIPT' ||\n\t\t!element.hasAttribute(HYDRATION_ATTRIBUTE) ||\n\t\telement.getAttribute(HYDRATION_TYPE_ATTRIBUTE) !== type\n\t) {\n\t\treturn false;\n\t}\n\n\tif (hydrationKey !== undefined) {\n\t\treturn element.getAttribute(HYDRATION_KEY_ATTRIBUTE) === hydrationKey;\n\t}\n\n\treturn !element.hasAttribute(HYDRATION_KEY_ATTRIBUTE);\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n",
7
+ "import { createHydrationScriptTag, escapeHydrationJson } from '../core/hydration-codec';\n\n/** Creates the raw `<script type=\"application/json\">` tag used to hydrate a signal field. */\nexport function createSignalHydrationScriptTag(options: { hydrationKey?: string; serializedValue: string }): string {\n\treturn createHydrationScriptTag({ type: 'signal', ...options });\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeSignalHydrationJson(value: string): string {\n\treturn escapeHydrationJson(value);\n}\n",
8
+ "import { createMarkupNodeLike, type JsxRenderable } from '@ecopages/jsx';\nimport { state, type WritableSignal } from '@ecopages/signals';\nimport type { SsrSerializableHydrationBinding } from '../core/ssr-hydration-binding';\nimport type { AttributeTypeConstant } from '../utils/attribute-utils';\nimport { findHydrationScript, parseHydrationPayload } from '../core/hydration-codec';\nimport { createSignalHydrationScriptTag, escapeSignalHydrationJson } from './hydration-script';\n\ntype HostSignalOwner = {\n\tnotifyUpdate(property: string, oldValue: unknown, value: unknown): void;\n};\n\ntype HostSignalOptions<Value> = {\n\thost: HostSignalOwner;\n\thydrate?: AttributeTypeConstant;\n\thydrationKey?: string;\n\tinitialValue?: Value;\n\tproperty: string;\n\tsource?: WritableSignal<Value>;\n};\n\nexport function isWritableSignalLike<Value>(value: unknown): value is WritableSignal<Value> {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof (value as WritableSignal<Value>).get === 'function' &&\n\t\ttypeof (value as WritableSignal<Value>).set === 'function' &&\n\t\ttypeof (value as WritableSignal<Value>).subscribe === 'function' &&\n\t\ttypeof (value as WritableSignal<Value>).update === 'function'\n\t);\n}\n\n/**\n * Host-owned writable signal that bridges signal updates back into Radiant's\n * update callback channel and optional SSR hydration pipeline.\n */\nexport class HostSignal<Value> implements WritableSignal<Value>, SsrSerializableHydrationBinding {\n\tprivate readonly host: HostSignalOwner;\n\tprivate readonly hydrate?: AttributeTypeConstant;\n\tprivate readonly hydrationKey?: string;\n\tprivate readonly property: string;\n\tprivate readonly source: WritableSignal<Value>;\n\tprivate currentValue: Value;\n\tprivate hasAppliedHostHydration = false;\n\tprivate sourceUnsubscribe?: () => void;\n\n\tconstructor(options: HostSignalOptions<Value>) {\n\t\tthis.host = options.host;\n\t\tthis.hydrate = options.hydrate;\n\t\tthis.hydrationKey = options.hydrationKey;\n\t\tthis.property = options.property;\n\t\tthis.source = options.source ?? state(this.resolveInitialValue(options.initialValue as Value));\n\t\tthis.currentValue = this.source.get();\n\t}\n\n\tpublic get(): Value {\n\t\treturn this.source.get();\n\t}\n\n\tpublic set(nextValue: Value): void {\n\t\tthis.source.set(nextValue);\n\t}\n\n\tpublic subscribe(notify: (value: Value) => void): () => void {\n\t\treturn this.source.subscribe(notify);\n\t}\n\n\tpublic update(updater: (value: Value) => Value): void {\n\t\tthis.set(updater(this.get()));\n\t}\n\n\tpublic connectToSource(): void {\n\t\tif (this.sourceUnsubscribe) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextValue = this.source.get();\n\n\t\tif (!Object.is(this.currentValue, nextValue)) {\n\t\t\tconst previousValue = this.currentValue;\n\t\t\tthis.currentValue = nextValue;\n\t\t\tthis.host.notifyUpdate(this.property, previousValue, nextValue);\n\t\t}\n\n\t\tthis.sourceUnsubscribe = this.source.subscribe((value) => {\n\t\t\tthis.handleSourceChange(value);\n\t\t});\n\t}\n\n\tpublic disconnectFromSource(): void {\n\t\tthis.sourceUnsubscribe?.();\n\t\tthis.sourceUnsubscribe = undefined;\n\t}\n\n\tpublic hydrateFromHost(): void {\n\t\tif (!this.hydrate || this.hasAppliedHostHydration) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hasAppliedHostHydration = true;\n\n\t\tconst previousValue = this.source.get();\n\t\tconst hydratedValue = this.resolveInitialValue(previousValue);\n\n\t\tif (!Object.is(previousValue, hydratedValue)) {\n\t\t\tthis.source.set(hydratedValue);\n\t\t\tthis.currentValue = this.source.get();\n\t\t\tthis.host.notifyUpdate(this.property, previousValue, this.currentValue);\n\t\t}\n\t}\n\n\tpublic renderHydrationScript(): JsxRenderable | undefined {\n\t\tconst outerHTML = this.renderHydrationScriptTag();\n\n\t\tif (!outerHTML) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn createMarkupNodeLike(outerHTML);\n\t}\n\n\tpublic renderHydrationScriptTag(): string | undefined {\n\t\tconst serializedValue = this.serializeHydrationValue();\n\n\t\tif (!serializedValue) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn createSignalHydrationScriptTag({\n\t\t\thydrationKey: this.hydrationKey,\n\t\t\tserializedValue,\n\t\t});\n\t}\n\n\tprivate findHydrationScriptElement(): Element | null {\n\t\tif (!(this.host instanceof Element)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn findHydrationScript(this.host, 'signal', this.hydrationKey);\n\t}\n\n\tprivate isObject(value: unknown): value is Record<string, unknown> {\n\t\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n\t}\n\n\tprivate resolveInitialValue(initialValue: Value): Value {\n\t\tif (!this.hydrate) {\n\t\t\treturn initialValue;\n\t\t}\n\n\t\tconst hydrationScriptElement = this.findHydrationScriptElement();\n\n\t\tif (!hydrationScriptElement) {\n\t\t\treturn initialValue;\n\t\t}\n\n\t\tconst parsedHydrationValue = parseHydrationPayload(hydrationScriptElement, initialValue);\n\n\t\tif (this.hydrate === Object && this.isObject(parsedHydrationValue) && this.isObject(initialValue)) {\n\t\t\treturn {\n\t\t\t\t...initialValue,\n\t\t\t\t...parsedHydrationValue,\n\t\t\t} as Value;\n\t\t}\n\n\t\treturn parsedHydrationValue;\n\t}\n\n\tprivate serializeHydrationValue(): string | undefined {\n\t\tif (!this.hydrate) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst serializedValue = JSON.stringify(this.get());\n\n\t\tif (typeof serializedValue !== 'string') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn escapeSignalHydrationJson(serializedValue);\n\t}\n\n\tprivate handleSourceChange(nextValue: Value): void {\n\t\tconst previousValue = this.currentValue;\n\t\tthis.currentValue = nextValue;\n\n\t\tif (!Object.is(previousValue, nextValue)) {\n\t\t\tthis.host.notifyUpdate(this.property, previousValue, nextValue);\n\t\t}\n\t}\n}\n\nexport function createHostSignal<Value>(options: HostSignalOptions<Value>): HostSignal<Value> {\n\treturn new HostSignal(options);\n}\n"
5
9
  ],
6
- "mappings": "",
7
- "debugId": "8C425FB12C13013F64756E2164756E21",
10
+ "mappings": "2PAIO,SAAS,CAAgB,CAAC,EAAuB,CACvD,OAAO,EACL,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,UAAW,SAAS,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AK,UAAY,QAAU,KAAK,SAAS,CAAoB,GAAK,KAAK,SAAS,CAAY,EAC/F,MAAO,IACH,KACA,CACJ,EAGD,OAAO,EAGA,uBAAuB,EAAuB,CACrD,GAAI,CAAC,KAAK,QACT,OAGD,IAAM,EAAkB,KAAK,UAAU,KAAK,IAAI,CAAC,EAEjD,GAAI,OAAO,IAAoB,SAC9B,OAGD,OAAO,EAA0B,CAAe,EAGzC,kBAAkB,CAAC,EAAwB,CAClD,IAAM,EAAgB,KAAK,aAG3B,GAFA,KAAK,aAAe,EAEhB,CAAC,OAAO,GAAG,EAAe,CAAS,EACtC,KAAK,KAAK,aAAa,KAAK,SAAU,EAAe,CAAS,EAGjE,CAEO,SAAS,CAAuB,CAAC,EAAsD,CAC7F,OAAO,IAAI,EAAW,CAAO",
11
+ "debugId": "D824BBB0A9C2DA3964756E2164756E21",
8
12
  "names": []
9
13
  }
@@ -1,3 +1,3 @@
1
- import{Ha as a,Ia as b}from"../chunk-dabagjk6.js";import"../chunk-hpzgnxgq.js";import"../chunk-nssj2x13.js";import"../chunk-vgtggzb6.js";export{b as escapeSignalHydrationJson,a as createSignalHydrationScriptTag};
1
+ var W=((g)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(g,{get:(q,w)=>(typeof require<"u"?require:q)[w]}):g)(function(g){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+g+'" is not supported')});function Z(g){return g.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var Q="data-hydration",j="data-hydration-type",M="data-hydration-key";function u(g){let q=g.hydrationKey?` ${M}="${J(g.hydrationKey)}"`:"";return`<script type="application/json" ${Q} ${j}="${g.type}"${q}>${g.serializedValue}</script>`}function F(g){return Z(g)}function S(g,q){let w=g.textContent;if(!w)return q;try{return JSON.parse(w)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${Q}>:`,w.slice(0,120));return q}}function f(g,q,w){let G=g.children;if(!G||G.length===0){let z=g.childNodes;if(!z||z.length===0)return null;for(let L=0;L<z.length;L+=1){let V=z[L];if(V.nodeType!==1)continue;let X=V;if($(X,q,w))return X}return null}for(let z=0;z<G.length;z+=1)if($(G[z],q,w))return G[z];return null}function $(g,q,w){if(g.tagName!=="SCRIPT"||!g.hasAttribute(Q)||g.getAttribute(j)!==q)return!1;if(w!==void 0)return g.getAttribute(M)===w;return!g.hasAttribute(M)}function J(g){return g.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B(g){return u({type:"signal",...g})}function D(g){return F(g)}export{D as escapeSignalHydrationJson,B as createSignalHydrationScriptTag};
2
2
 
3
- //# debugId=5F47A97415912E6864756E2164756E21
3
+ //# debugId=2E79D54D041C6E9564756E2164756E21
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/tools/escape-script-json.ts", "../src/core/hydration-codec.ts", "../src/signals/hydration-script.ts"],
4
4
  "sourcesContent": [
5
+ "/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
6
+ "import { escapeScriptJson } from '../tools/escape-script-json';\n\n/** Attribute marker used to identify hydration payloads inside a host. */\nexport const HYDRATION_ATTRIBUTE = 'data-hydration';\n/** Discriminator that scopes a hydration payload to a specific feature. */\nexport const HYDRATION_TYPE_ATTRIBUTE = 'data-hydration-type';\n/** Optional key that scopes a hydration payload to a specific decorated field. */\nexport const HYDRATION_KEY_ATTRIBUTE = 'data-hydration-key';\n\nexport type HydrationPayloadType = 'signal' | 'context';\n\ntype HydrationScriptHost = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\n/** Creates a `<script type=\"application/json\">` tag for a hydration payload. */\nexport function createHydrationScriptTag(options: {\n\ttype: HydrationPayloadType;\n\thydrationKey?: string;\n\tserializedValue: string;\n}): string {\n\tconst keyAttribute = options.hydrationKey\n\t\t? ` ${HYDRATION_KEY_ATTRIBUTE}=\"${escapeHtmlAttribute(options.hydrationKey)}\"`\n\t\t: '';\n\n\treturn `<script type=\"application/json\" ${HYDRATION_ATTRIBUTE} ${HYDRATION_TYPE_ATTRIBUTE}=\"${options.type}\"${keyAttribute}>${options.serializedValue}</script>`;\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeHydrationJson(value: string): string {\n\treturn escapeScriptJson(value);\n}\n\n/** Parses JSON from a hydration script element, returning the fallback on failure. */\nexport function parseHydrationPayload<T>(element: Element, fallback: T): T {\n\tconst textContent = element.textContent;\n\n\tif (!textContent) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(textContent) as T;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn(\n\t\t\t\t`[@ecopages/radiant] Failed to parse hydration payload from <script ${HYDRATION_ATTRIBUTE}>:`,\n\t\t\t\ttextContent.slice(0, 120),\n\t\t\t);\n\t\t}\n\t\treturn fallback;\n\t}\n}\n\n/**\n * Finds a hydration script element inside a host by type and optional key.\n *\n * When a key is provided, looks for an exact `data-hydration-key` match.\n * Otherwise, returns the first unkeyed script matching the type.\n */\nexport function findHydrationScript(\n\thost: HydrationScriptHost,\n\ttype: HydrationPayloadType,\n\thydrationKey?: string,\n): Element | null {\n\tconst children = host.children;\n\n\tif (!children || children.length === 0) {\n\t\tconst childNodes = (host as Partial<{ childNodes: ArrayLike<{ nodeType: number }> }>).childNodes;\n\n\t\tif (!childNodes || childNodes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (let i = 0; i < childNodes.length; i += 1) {\n\t\t\tconst node = childNodes[i]!;\n\n\t\t\tif (node.nodeType !== 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst element = node as unknown as Element;\n\n\t\t\tif (matchesHydrationScript(element, type, hydrationKey)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfor (let i = 0; i < children.length; i += 1) {\n\t\tif (matchesHydrationScript(children[i]!, type, hydrationKey)) {\n\t\t\treturn children[i]!;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction matchesHydrationScript(element: Element, type: HydrationPayloadType, hydrationKey?: string): boolean {\n\tif (\n\t\telement.tagName !== 'SCRIPT' ||\n\t\t!element.hasAttribute(HYDRATION_ATTRIBUTE) ||\n\t\telement.getAttribute(HYDRATION_TYPE_ATTRIBUTE) !== type\n\t) {\n\t\treturn false;\n\t}\n\n\tif (hydrationKey !== undefined) {\n\t\treturn element.getAttribute(HYDRATION_KEY_ATTRIBUTE) === hydrationKey;\n\t}\n\n\treturn !element.hasAttribute(HYDRATION_KEY_ATTRIBUTE);\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n",
7
+ "import { createHydrationScriptTag, escapeHydrationJson } from '../core/hydration-codec';\n\n/** Creates the raw `<script type=\"application/json\">` tag used to hydrate a signal field. */\nexport function createSignalHydrationScriptTag(options: { hydrationKey?: string; serializedValue: string }): string {\n\treturn createHydrationScriptTag({ type: 'signal', ...options });\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeSignalHydrationJson(value: string): string {\n\treturn escapeHydrationJson(value);\n}\n"
5
8
  ],
6
- "mappings": "",
7
- "debugId": "5F47A97415912E6864756E2164756E21",
9
+ "mappings": "2PAIO,SAAS,CAAgB,CAAC,EAAuB,CACvD,OAAO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ACpB,CAAC,EAAQ,aAAa,CAAmB,GACzC,EAAQ,aAAa,CAAwB,IAAM,EAEnD,MAAO,GAGR,GAAI,IAAiB,OACpB,OAAO,EAAQ,aAAa,CAAuB,IAAM,EAG1D,MAAO,CAAC,EAAQ,aAAa,CAAuB,EAGrD,SAAS,CAAmB,CAAC,EAAuB,CACnD,OAAO,EAAM,QAAQ,KAAM,OAAO,EAAE,QAAQ,KAAM,QAAQ,EAAE,QAAQ,KAAM,MAAM,EAAE,QAAQ,KAAM,MAAM,ECnHhG,SAAS,CAA8B,CAAC,EAAqE,CACnH,OAAO,EAAyB,CAAE,KAAM,YAAa,CAAQ,CAAC,EAIxD,SAAS,CAAyB,CAAC,EAAuB,CAChE,OAAO,EAAoB,CAAK",
10
+ "debugId": "2E79D54D041C6E9564756E2164756E21",
8
11
  "names": []
9
12
  }
@@ -0,0 +1 @@
1
+ export declare function escapeCssIdentifier(value: string): string;
@@ -0,0 +1,3 @@
1
+ var f=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(c,e)=>(typeof require<"u"?require:c)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});function p(n){let c=globalThis.CSS;if(typeof c?.escape==="function")return c.escape(n);let e="";for(let s=0;s<n.length;s+=1){let i=n[s]??"",t=i.codePointAt(0)??0;if(t===0){e+="�";continue}let o=t>=1&&t<=31||t===127,r=s===0&&t>=48&&t<=57,x=s===1&&t>=48&&t<=57&&(n[0]??"")==="-",a=s===0&&i==="-"&&n.length===1;if(o||r||x){e+=`\\${t.toString(16)} `;continue}if(t>=128||i==="-"||i==="_"||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){e+=a?`\\${i}`:i;continue}e+=`\\${i}`}return e}export{p as escapeCssIdentifier};
2
+
3
+ //# debugId=BF095F02FC2877E864756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/tools/escape-css-identifier.ts"],
4
+ "sourcesContent": [
5
+ "export function escapeCssIdentifier(value: string): string {\n\tconst cssNamespace = globalThis.CSS as { escape?: (value: string) => string } | undefined;\n\n\tif (typeof cssNamespace?.escape === 'function') {\n\t\treturn cssNamespace.escape(value);\n\t}\n\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 && codePoint >= 0x0030 && codePoint <= 0x0039 && (value[0] ?? '') === '-';\n\t\tconst isSingleHyphen = index === 0 && character === '-' && value.length === 1;\n\n\t\tif (isControlCharacter || startsWithDigit || startsWithHyphenDigit) {\n\t\t\tescaped += `\\\\${codePoint.toString(16)} `;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\tcodePoint >= 0x0080 ||\n\t\t\tcharacter === '-' ||\n\t\t\tcharacter === '_' ||\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) ||\n\t\t\t(codePoint >= 0x0041 && codePoint <= 0x005a) ||\n\t\t\t(codePoint >= 0x0061 && codePoint <= 0x007a)\n\t\t) {\n\t\t\tescaped += isSingleHyphen ? `\\\\${character}` : character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tescaped += `\\\\${character}`;\n\t}\n\n\treturn escaped;\n}\n"
6
+ ],
7
+ "mappings": "2PAAO,SAAS,CAAmB,CAAC,EAAuB,CAC1D,IAAM,EAAe,WAAW,IAEhC,GAAI,OAAO,GAAc,SAAW,WACnC,OAAO,EAAa,OAAO,CAAK,EAGjC,IAAI,EAAU,GAEd,QAAS,EAAQ,EAAG,EAAQ,EAAM,OAAQ,GAAS,EAAG,CACrD,IAAM,EAAY,EAAM,IAAU,GAC5B,EAAY,EAAU,YAAY,CAAC,GAAK,EAE9C,GAAI,IAAc,EAAG,CACpB,GAAW,IACX,SAGD,IAAM,EAAsB,GAAa,GAAU,GAAa,IAAW,IAAc,IACnF,EAAkB,IAAU,GAAK,GAAa,IAAU,GAAa,GACrE,EACL,IAAU,GAAK,GAAa,IAAU,GAAa,KAAW,EAAM,IAAM,MAAQ,IAC7E,EAAiB,IAAU,GAAK,IAAc,KAAO,EAAM,SAAW,EAE5E,GAAI,GAAsB,GAAmB,EAAuB,CACnE,GAAW,KAAK,EAAU,SAAS,EAAE,KACrC,SAGD,GACC,GAAa,KACb,IAAc,KACd,IAAc,KACb,GAAa,IAAU,GAAa,IACpC,GAAa,IAAU,GAAa,IACpC,GAAa,IAAU,GAAa,IACpC,CACD,GAAW,EAAiB,KAAK,IAAc,EAC/C,SAGD,GAAW,KAAK,IAGjB,OAAO",
8
+ "debugId": "BF095F02FC2877E864756E2164756E21",
9
+ "names": []
10
+ }
@@ -1,3 +1,3 @@
1
- import{wb as a}from"../chunk-nssj2x13.js";import"../chunk-vgtggzb6.js";export{a as escapeScriptJson};
1
+ var s=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,a)=>(typeof require<"u"?require:r)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});function i(e){return e.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}export{i as escapeScriptJson};
2
2
 
3
- //# debugId=41664B185705318B64756E2164756E21
3
+ //# debugId=91D7070AAF1AF86764756E2164756E21
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/tools/escape-script-json.ts"],
4
4
  "sourcesContent": [
5
+ "/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n"
5
6
  ],
6
- "mappings": "",
7
- "debugId": "41664B185705318B64756E2164756E21",
7
+ "mappings": "2PAIO,SAAS,CAAgB,CAAC,EAAuB,CACvD,OAAO,EACL,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,UAAW,SAAS,EAC5B,QAAQ,UAAW,SAAS",
8
+ "debugId": "91D7070AAF1AF86764756E2164756E21",
8
9
  "names": []
9
10
  }
@@ -1,3 +1,3 @@
1
- import{yb as a}from"../chunk-wvd1ffe4.js";import"../chunk-vgtggzb6.js";export{a as EventEmitter};
1
+ var z=((k)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(k,{get:(q,x)=>(typeof require<"u"?require:q)[x]}):k)(function(k){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+k+'" is not supported')});class y{host;eventConfig;constructor(k,q){this.host=k,this.eventConfig=q}emit(k){let q=new CustomEvent(this.eventConfig.name,{detail:k,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(q)}}export{y as EventEmitter};
2
2
 
3
- //# debugId=139B84C5FD630AF664756E2164756E21
3
+ //# debugId=1E4E1D10DCC1E44064756E2164756E21
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/tools/event-emitter.ts"],
4
4
  "sourcesContent": [
5
+ "import type { RadiantElement } from '../core/radiant-element';\n\nexport interface EventEmitterConfig {\n\tname: string;\n\tbubbles?: boolean;\n\tcancelable?: boolean;\n\tcomposed?: boolean;\n}\n\n/**\n * A generic event emitter class that allows emitting custom events.\n *\n * @template T - The type of the event detail.\n */\nexport class EventEmitter<T = unknown> {\n\tprivate host: RadiantElement;\n\tprivate eventConfig: EventEmitterConfig;\n\n\t/**\n\t * Constructs a new instance of the EventEmitter class.\n\t *\n\t * @param host - The host element on which the events will be dispatched.\n\t * @param eventConfig - The configuration for the event.\n\t */\n\tconstructor(host: RadiantElement, eventConfig: EventEmitterConfig) {\n\t\tthis.host = host;\n\t\tthis.eventConfig = eventConfig;\n\t}\n\n\t/**\n\t * Emits a custom event with the specified detail.\n\t *\n\t * @param detail - The detail object to be passed along with the event.\n\t */\n\temit(detail?: T) {\n\t\tconst event = new CustomEvent(this.eventConfig.name, {\n\t\t\tdetail: detail,\n\t\t\tbubbles: this.eventConfig.bubbles,\n\t\t\tcancelable: this.eventConfig.cancelable,\n\t\t\tcomposed: this.eventConfig.composed,\n\t\t});\n\t\tthis.host.dispatchEvent(event);\n\t}\n}\n"
5
6
  ],
6
- "mappings": "",
7
- "debugId": "139B84C5FD630AF664756E2164756E21",
7
+ "mappings": "2PAcO,MAAM,CAA0B,CAC9B,KACA,YAQR,WAAW,CAAC,EAAsB,EAAiC,CAClE,KAAK,KAAO,EACZ,KAAK,YAAc,EAQpB,IAAI,CAAC,EAAY,CAChB,IAAM,EAAQ,IAAI,YAAY,KAAK,YAAY,KAAM,CACpD,OAAQ,EACR,QAAS,KAAK,YAAY,QAC1B,WAAY,KAAK,YAAY,WAC7B,SAAU,KAAK,YAAY,QAC5B,CAAC,EACD,KAAK,KAAK,cAAc,CAAK,EAE/B",
8
+ "debugId": "1E4E1D10DCC1E44064756E2164756E21",
8
9
  "names": []
9
10
  }
@@ -1,4 +1,4 @@
1
- export * from './stringify-typed';
2
1
  export * from './event-emitter';
3
2
  export * from './render-jsx-template';
3
+ export * from './escape-css-identifier';
4
4
  export * from './escape-script-json';
@@ -1,3 +1,3 @@
1
- import{a as x}from"../chunk-jkb2y7c8.js";import{b as a}from"../chunk-cvz9mrxa.js";import{wb as p}from"../chunk-nssj2x13.js";import{yb as t}from"../chunk-wvd1ffe4.js";import"../chunk-vgtggzb6.js";export{a as stringifyTyped,x as renderJsxTemplate,p as escapeScriptJson,t as EventEmitter};
1
+ var g=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(c,s)=>(typeof require<"u"?require:c)[s]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});function S(n){return n.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}class f{host;eventConfig;constructor(n,c){this.host=n,this.eventConfig=c}emit(n){let c=new CustomEvent(this.eventConfig.name,{detail:n,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(c)}}function H(n){let c=globalThis.CSS;if(typeof c?.escape==="function")return c.escape(n);let s="";for(let o=0;o<n.length;o+=1){let i=n[o]??"",r=i.codePointAt(0)??0;if(r===0){s+="�";continue}let x=r>=1&&r<=31||r===127,t=o===0&&r>=48&&r<=57,e=o===1&&r>=48&&r<=57&&(n[0]??"")==="-",p=o===0&&i==="-"&&n.length===1;if(x||t||e){s+=`\\${r.toString(16)} `;continue}if(r>=128||i==="-"||i==="_"||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){s+=p?`\\${i}`:i;continue}s+=`\\${i}`}return s}import{render as u}from"@ecopages/jsx";function h(n,c){u(n,c)}export{h as renderJsxTemplate,S as escapeScriptJson,H as escapeCssIdentifier,f as EventEmitter};
2
2
 
3
- //# debugId=328891D7088CB96064756E2164756E21
3
+ //# debugId=19BB6D9EC62E3A1564756E2164756E21
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/tools/escape-script-json.ts", "../src/tools/event-emitter.ts", "../src/tools/escape-css-identifier.ts", "../src/tools/render-jsx-template.ts"],
4
4
  "sourcesContent": [
5
+ "/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
6
+ "import type { RadiantElement } from '../core/radiant-element';\n\nexport interface EventEmitterConfig {\n\tname: string;\n\tbubbles?: boolean;\n\tcancelable?: boolean;\n\tcomposed?: boolean;\n}\n\n/**\n * A generic event emitter class that allows emitting custom events.\n *\n * @template T - The type of the event detail.\n */\nexport class EventEmitter<T = unknown> {\n\tprivate host: RadiantElement;\n\tprivate eventConfig: EventEmitterConfig;\n\n\t/**\n\t * Constructs a new instance of the EventEmitter class.\n\t *\n\t * @param host - The host element on which the events will be dispatched.\n\t * @param eventConfig - The configuration for the event.\n\t */\n\tconstructor(host: RadiantElement, eventConfig: EventEmitterConfig) {\n\t\tthis.host = host;\n\t\tthis.eventConfig = eventConfig;\n\t}\n\n\t/**\n\t * Emits a custom event with the specified detail.\n\t *\n\t * @param detail - The detail object to be passed along with the event.\n\t */\n\temit(detail?: T) {\n\t\tconst event = new CustomEvent(this.eventConfig.name, {\n\t\t\tdetail: detail,\n\t\t\tbubbles: this.eventConfig.bubbles,\n\t\t\tcancelable: this.eventConfig.cancelable,\n\t\t\tcomposed: this.eventConfig.composed,\n\t\t});\n\t\tthis.host.dispatchEvent(event);\n\t}\n}\n",
7
+ "export function escapeCssIdentifier(value: string): string {\n\tconst cssNamespace = globalThis.CSS as { escape?: (value: string) => string } | undefined;\n\n\tif (typeof cssNamespace?.escape === 'function') {\n\t\treturn cssNamespace.escape(value);\n\t}\n\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 && codePoint >= 0x0030 && codePoint <= 0x0039 && (value[0] ?? '') === '-';\n\t\tconst isSingleHyphen = index === 0 && character === '-' && value.length === 1;\n\n\t\tif (isControlCharacter || startsWithDigit || startsWithHyphenDigit) {\n\t\t\tescaped += `\\\\${codePoint.toString(16)} `;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\tcodePoint >= 0x0080 ||\n\t\t\tcharacter === '-' ||\n\t\t\tcharacter === '_' ||\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) ||\n\t\t\t(codePoint >= 0x0041 && codePoint <= 0x005a) ||\n\t\t\t(codePoint >= 0x0061 && codePoint <= 0x007a)\n\t\t) {\n\t\t\tescaped += isSingleHyphen ? `\\\\${character}` : character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tescaped += `\\\\${character}`;\n\t}\n\n\treturn escaped;\n}\n",
8
+ "import { render, type TemplateResultLike } from '@ecopages/jsx';\n\n/**\n * Renders a JSX template result into a target element by replacing its children.\n */\nexport function renderJsxTemplate(template: TemplateResultLike, target: HTMLElement): void {\n\trender(template, target);\n}\n"
5
9
  ],
6
- "mappings": "",
7
- "debugId": "328891D7088CB96064756E2164756E21",
10
+ "mappings": "2PAIO,SAAS,CAAgB,CAAC,EAAuB,CACvD,OAAO,EACL,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,UAAW,SAAS,EAC5B,QAAQ,UAAW,SAAS,ECIxB,MAAM,CAA0B,CAC9B,KACA,YAQR,WAA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c8.js";import"../chunk-vgtggzb6.js";export{a as renderJsxTemplate};
1
+ var w=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(k,q)=>(typeof require<"u"?require:k)[q]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});import{render as v}from"@ecopages/jsx";function B(f,k){v(f,k)}export{B as renderJsxTemplate};
2
2
 
3
- //# debugId=33BF6AD35B27EB1564756E2164756E21
3
+ //# debugId=6730AC26B382885064756E2164756E21
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/tools/render-jsx-template.ts"],
4
4
  "sourcesContent": [
5
+ "import { render, type TemplateResultLike } from '@ecopages/jsx';\n\n/**\n * Renders a JSX template result into a target element by replacing its children.\n */\nexport function renderJsxTemplate(template: TemplateResultLike, target: HTMLElement): void {\n\trender(template, target);\n}\n"
5
6
  ],
6
- "mappings": "",
7
- "debugId": "33BF6AD35B27EB1564756E2164756E21",
7
+ "mappings": "2PAAA,iBAAS,sBAKF,SAAS,CAAiB,CAAC,EAA8B,EAA2B,CAC1F,EAAO,EAAU,CAAM",
8
+ "debugId": "6730AC26B382885064756E2164756E21",
8
9
  "names": []
9
10
  }
package/dist/types.js CHANGED
@@ -1,3 +1,3 @@
1
- import"./chunk-vgtggzb6.js";var r={isStandard:{ClassDecorator:function(t){return typeof t[1]<"u"},MethodDecorator:function(t){return typeof t[1]==="object"},FieldDecorator:function(t){return typeof t[1]==="object"}}};export{r as guards};
1
+ var o=((t)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,e)=>(typeof require<"u"?require:r)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var n={isStandard:{ClassDecorator:function(t){return typeof t[1]<"u"},MethodDecorator:function(t){return typeof t[1]==="object"},FieldDecorator:function(t){return typeof t[1]==="object"}}};export{n as guards};
2
2
 
3
- //# debugId=91D7439E7D31B5DD64756E2164756E21
3
+ //# debugId=13A0204E2BB78E6764756E2164756E21
package/dist/types.js.map CHANGED
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "import type { RadiantElement } from './core/radiant-element';\n\nexport type Constructor<T = unknown> = { new (...args: any[]): NonNullable<T> };\n\nexport type ConstructorParams<T extends Constructor> = ConstructorParameters<T>;\n\nexport type Context = {\n\tkind: string;\n\tname: string | symbol;\n\taccess: {\n\t\tget?(): unknown;\n\t\tset?(value: unknown): void;\n\t\thas?(value: unknown): boolean;\n\t};\n\tprivate?: boolean;\n\tstatic?: boolean;\n\taddInitializer?(initializer: () => void): void;\n};\n\nexport type ClassDecorator = <T extends Constructor>(target: T, context: Context) => T | void;\n\nexport type Method = (...args: any[]) => any;\n\nexport type LegacyClassDecoratorArgs = {\n\tprotoOrTarget: CustomElementConstructor;\n\tnameOrContext: string;\n\tdescriptor: PropertyDescriptor;\n};\n\nexport type StandardClassDecoratorArgs = {\n\tprotoOrTarget: CustomElementConstructor;\n\tnameOrContext: ClassDecoratorContext;\n};\n\nexport type StandardOrLegacyClassDecoratorArgs = LegacyClassDecoratorArgs | StandardClassDecoratorArgs;\n\nexport type LegacyMethodDecoratorArgs = {\n\tprotoOrTarget: RadiantElement;\n\tnameOrContext: string;\n\tdescriptor: PropertyDescriptor;\n};\n\nexport type StandardMethodDecoratorArgs = {\n\tprotoOrTarget: Method;\n\tnameOrContext: ClassMethodDecoratorContext;\n\tdescriptor: undefined;\n};\n\nexport type StandardOrLegacyMethodDecoratorArgs = LegacyMethodDecoratorArgs | StandardMethodDecoratorArgs;\n\nexport type LegacyFieldDecoratorArgs = {\n\tprotoOrTarget: RadiantElement;\n\tnameOrContext: string;\n\tdescriptor: PropertyDescriptor;\n};\n\nexport type StandardFieldDecoratorArgs<T = unknown, V = unknown> = {\n\tprotoOrTarget: undefined;\n\tnameOrContext: ClassFieldDecoratorContext<T, V>;\n};\n\nexport type StandardOrLegacyFieldDecoratorArgs = LegacyFieldDecoratorArgs | StandardFieldDecoratorArgs;\n\nexport type CustomElementClass = Omit<typeof HTMLElement, 'new'>;\n\nexport const guards = {\n\tisStandard: {\n\t\tClassDecorator: function (\n\t\t\targs: any,\n\t\t): args is [CustomElementConstructor, ClassDecoratorContext<CustomElementConstructor>] {\n\t\t\treturn typeof args[1] !== 'undefined';\n\t\t},\n\t\tMethodDecorator: function (args: any): args is [Method, ClassMethodDecoratorContext] {\n\t\t\treturn typeof args[1] === 'object';\n\t\t},\n\t\tFieldDecorator: function (args: any): args is [undefined, ClassFieldDecoratorContext] {\n\t\t\treturn typeof args[1] === 'object';\n\t\t},\n\t},\n};\n"
6
6
  ],
7
- "mappings": "4BAiEO,IAAM,EAAS,CACrB,WAAY,CACX,eAAgB,QAAS,CACxB,EACsF,CACtF,OAAO,OAAO,EAAK,GAAO,KAE3B,gBAAiB,QAAS,CAAC,EAA0D,CACpF,OAAO,OAAO,EAAK,KAAO,UAE3B,eAAgB,QAAS,CAAC,EAA4D,CACrF,OAAO,OAAO,EAAK,KAAO,SAE5B,CACD",
8
- "debugId": "91D7439E7D31B5DD64756E2164756E21",
7
+ "mappings": "2PAiEO,IAAM,EAAS,CACrB,WAAY,CACX,eAAgB,QAAS,CACxB,EACsF,CACtF,OAAO,OAAO,EAAK,GAAO,KAE3B,gBAAiB,QAAS,CAAC,EAA0D,CACpF,OAAO,OAAO,EAAK,KAAO,UAE3B,eAAgB,QAAS,CAAC,EAA4D,CACrF,OAAO,OAAO,EAAK,KAAO,SAE5B,CACD",
8
+ "debugId": "13A0204E2BB78E6764756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,3 +1,3 @@
1
- import{ab as a,bb as b,cb as c,db as d,eb as e,fb as f,gb as g}from"../chunk-66e6s792.js";import"../chunk-vgtggzb6.js";export{e as writeAttributeValue,d as readAttributeValue,b as parseAttributeTypeDefault,a as parseAttributeTypeConstant,f as isValueOfType,g as getInitialValue,c as defaultValueForType};
1
+ var B=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(x,z)=>(typeof require<"u"?require:x)[z]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});function P(q){switch(q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function R(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 U(q){switch(q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function W(q){try{return JSON.parse(q)}catch{throw TypeError("Invalid JSON string")}}var X={array(q){let x=W(q);if(!Array.isArray(x))throw TypeError(`Expected an array but got a value of type "${typeof x}"`);return x},boolean(q){return!(q==="0"||String(q).toLowerCase()==="false")},number(q){return Number(q.replace(/_/g,""))},object(q){let x=JSON.parse(q);if(x===null||typeof x!=="object"||Array.isArray(x))throw TypeError(`expected value of type "object" but instead got value "${q}" of type "${R(x)}"`);return x},string(q){return q}},I={default:Q,array:L,object:L};function L(q){return JSON.stringify(q)}function Q(q){return`${q}`}function M(q,x){let z=P(x);if(!z)throw TypeError(`[radiant-element] Unknown type "${x}"`);return X[z](q)}function F(q,x){let z=P(x);if(!z)throw TypeError(`[radiant-element] Unknown type "${x}"`);return(I[z]??I.default??Q)(q)}function Y(q){return typeof q==="boolean"}function Z(q){return typeof q==="number"}function _(q){return typeof q==="string"}function $(q){return Array.isArray(q)}function k(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}function m(q,x){switch(q){case Boolean:return Y(x);case Number:return Z(x);case String:return _(x);case Array:return $(x);case Object:return k(x);default:return!1}}var h=(q,x,z,E)=>{if(x===Boolean){let G=q.getAttribute(z);if(G===null)return E;return G===""?!0:M(G,x)}let H=q.getAttribute(z);return H!==null?M(H,x):E??U(x)};export{F as writeAttributeValue,M as readAttributeValue,R as parseAttributeTypeDefault,P as parseAttributeTypeConstant,m as isValueOfType,h as getInitialValue,U as defaultValueForType};
2
2
 
3
- //# debugId=C2F55D0EA13687F864756E2164756E21
3
+ //# debugId=A6359EE45E00B20A64756E2164756E21
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/utils/attribute-utils.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"
5
6
  ],
6
- "mappings": "",
7
- "debugId": "C2F55D0EA13687F864756E2164756E21",
7
+ "mappings": "2PAYO,SAAS,CAA0B,CAAC,EAAkC,CAC5E,OAAQ,QACF,MACJ,MAAO,aACH,QACJ,MAAO,eACH,OACJ,MAAO,cACH,OACJ,MAAO,cACH,OACJ,MAAO,UAUH,SAAS,CAAyB,CAAC,EAAqC,CAC9E,OAAQ,OAAO,OACT,UACJ,MAAO,cACH,SACJ,MAAO,aACH,SACJ,MAAO,SAGT,GAAI,MAAM,QAAQ,CAAY,EAAG,MAAO,QACxC,GAAI,OAAO,UAAU,SAAS,KAAK,CAAY,IAAM,kBAAmB,MAAO,SASzE,SAAS,CAAmB,CAAC,EAAsC,CACzE,OAAQ,QACF,OACJ,MAAO,QACH,OACJ,MAAO,QACH,QACJ,MAAO,WAEP,OAAO,MASV,SAAS,CAAY,CAAC,EAAkB,CACvC,GAAI,CACH,OAAO,KAAK,MAAM,CAAK,EACtB,KAAM,CACP,MAAU,UAAU,qBAAqB,GAQ3C,IAAM,EAAsC,CAC3C,KAAK,CAAC,EAA0B,CAC/B,IAAM,EAAQ,EAAqB,CAAK,EACxC,GAAI,CAAC,MAAM,QAAQ,CAAK,EACvB,MAAU,UAAU,8CAA8C,OAAO,IAAQ,EAElF,OAAO,GAGR,OAAO,CAAC,EAAwB,CAC/B,MAAO,EAAE,IAAU,KAAO,OAAO,CAAK,EAAE,YAAY,IAAM,UAG3D,MAAM,CAAC,EAAuB,CAE7B,OADe,OAAO,EAAM,QAAQ,KAAM,EAAE,CAAC,GAI9C,MAAM,CAAC,EAAuB,CAC7B,IA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UAE5B,MAAO,IAIH,IAAM,EAAkB,CAC9B,EACA,EACA,EACA,IACI,CACJ,GAAI,IAAS,QAAS,CACrB,IAAM,EAAiB,EAAO,aAAa,CAAY,EACvD,GAAI,IAAmB,KACtB,OAAO,EAGR,OAAO,IAAmB,GAAK,GAAO,EAAmB,EAAgB,CAAI,EAG9E,IAAM,EAAiB,EAAO,aAAa,CAAY,EACvD,OAAO,IAAmB,KACvB,EAAmB,EAAgB,CAAI,EACtC,GAAiB,EAAoB,CAAI",
8
+ "debugId": "A6359EE45E00B20A64756E2164756E21",
8
9
  "names": []
9
10
  }
@@ -1,3 +1,3 @@
1
- import{ab as e,bb as f,cb as m,db as p,eb as t,fb as x,gb as a}from"../chunk-66e6s792.js";import"../chunk-vgtggzb6.js";export{t as writeAttributeValue,p as readAttributeValue,f as parseAttributeTypeDefault,e as parseAttributeTypeConstant,x as isValueOfType,a as getInitialValue,m as defaultValueForType};
1
+ var m=((x)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(q,z)=>(typeof require<"u"?require:q)[z]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});function P(x){switch(x){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function R(x){switch(typeof x){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(x))return"array";if(Object.prototype.toString.call(x)==="[object Object]")return"object"}function U(x){switch(x){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function W(x){try{return JSON.parse(x)}catch{throw TypeError("Invalid JSON string")}}var X={array(x){let q=W(x);if(!Array.isArray(q))throw TypeError(`Expected an array but got a value of type "${typeof q}"`);return q},boolean(x){return!(x==="0"||String(x).toLowerCase()==="false")},number(x){return Number(x.replace(/_/g,""))},object(x){let q=JSON.parse(x);if(q===null||typeof q!=="object"||Array.isArray(q))throw TypeError(`expected value of type "object" but instead got value "${x}" of type "${R(q)}"`);return q},string(x){return x}},I={default:Q,array:L,object:L};function L(x){return JSON.stringify(x)}function Q(x){return`${x}`}function M(x,q){let z=P(q);if(!z)throw TypeError(`[radiant-element] Unknown type "${q}"`);return X[z](x)}function D(x,q){let z=P(q);if(!z)throw TypeError(`[radiant-element] Unknown type "${q}"`);return(I[z]??I.default??Q)(x)}function Y(x){return typeof x==="boolean"}function Z(x){return typeof x==="number"}function _(x){return typeof x==="string"}function $(x){return Array.isArray(x)}function k(x){return typeof x==="object"&&!Array.isArray(x)&&x!==null}function F(x,q){switch(x){case Boolean:return Y(q);case Number:return Z(q);case String:return _(q);case Array:return $(q);case Object:return k(q);default:return!1}}var h=(x,q,z,E)=>{if(q===Boolean){let G=x.getAttribute(z);if(G===null)return E;return G===""?!0:M(G,q)}let H=x.getAttribute(z);return H!==null?M(H,q):E??U(q)};export{D as writeAttributeValue,M as readAttributeValue,R as parseAttributeTypeDefault,P as parseAttributeTypeConstant,F as isValueOfType,h as getInitialValue,U as defaultValueForType};
2
2
 
3
- //# debugId=93B92726ADA25D5364756E2164756E21
3
+ //# debugId=4AD7E8FD49F8E7F964756E2164756E21
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/utils/attribute-utils.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"
5
6
  ],
6
- "mappings": "",
7
- "debugId": "93B92726ADA25D5364756E2164756E21",
7
+ "mappings": "2PAYO,SAAS,CAA0B,CAAC,EAAkC,CAC5E,OAAQ,QACF,MACJ,MAAO,aACH,QACJ,MAAO,eACH,OACJ,MAAO,cACH,OACJ,MAAO,cACH,OACJ,MAAO,UAUH,SAAS,CAAyB,CAAC,EAAqC,CAC9E,OAAQ,OAAO,OACT,UACJ,MAAO,cACH,SACJ,MAAO,aACH,SACJ,MAAO,SAGT,GAAI,MAAM,QAAQ,CAAY,EAAG,MAAO,QACxC,GAAI,OAAO,UAAU,SAAS,KAAK,CAAY,IAAM,kBAAmB,MAA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E,OADuB,EAAQ,IAAe,EAAQ,SAAW,GACnD,CAAK,EAQpB,SAAS,CAAS,CAAC,EAAkC,CACpD,OAAO,OAAO,IAAU,UAGzB,SAAS,CAAQ,CAAC,EAAiC,CAClD,OAAO,OAAO,IAAU,SAGzB,SAAS,CAAQ,CAAC,EAAiC,CAClD,OAAO,OAAO,IAAU,SAGzB,SAAS,CAAO,CAAC,EAAyC,CACzD,OAAO,MAAM,QAAQ,CAAK,EAG3B,SAAS,CAAQ,CAAC,EAAiC,CAClD,OAAO,OAAO,IAAU,UAAY,CAAC,MAAM,QAAQ,CAAK,GAAK,IAAU,KAMjE,SAAS,CAAa,CAAC,EAA6B,EAAgC,CAC1F,OAAQ,QACF,QACJ,OAAO,EAAU,CAAY,OACzB,OACJ,OAAO,EAAS,CAAY,OACxB,OACJ,OAAO,EAAS,CAAY,OACxB,MACJ,OAAO,EAAQ,CAAY,OACvB,OACJ,OAAO,EAAS,CAAY,UAE5B,MAAO,IAIH,IAAM,EAAkB,CAC9B,EACA,EACA,EACA,IACI,CACJ,GAAI,IAAS,QAAS,CACrB,IAAM,EAAiB,EAAO,aAAa,CAAY,EACvD,GAAI,IAAmB,KACtB,OAAO,EAGR,OAAO,IAAmB,GAAK,GAAO,EAAmB,EAAgB,CAAI,EAG9E,IAAM,EAAiB,EAAO,aAAa,CAAY,EACvD,OAAO,IAAmB,KACvB,EAAmB,EAAgB,CAAI,EACtC,GAAiB,EAAoB,CAAI",
8
+ "debugId": "4AD7E8FD49F8E7F964756E2164756E21",
8
9
  "names": []
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecopages/radiant",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.3.0-alpha.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ecopages/radiant.git"
@@ -87,18 +87,34 @@
87
87
  "types": "./dist/context/decorators/on-context-update.d.ts",
88
88
  "import": "./dist/context/decorators/on-context-update.js"
89
89
  },
90
+ "./context/events": {
91
+ "types": "./dist/context/events.d.ts",
92
+ "import": "./dist/context/events.js"
93
+ },
94
+ "./controller-registry": {
95
+ "types": "./dist/controller-registry.d.ts",
96
+ "import": "./dist/controller-registry.js"
97
+ },
90
98
  "./core/radiant-element": {
91
99
  "types": "./dist/core/radiant-element.d.ts",
92
100
  "import": "./dist/core/radiant-element.js"
93
101
  },
94
- "./core/radiant-component": {
95
- "types": "./dist/core/radiant-component.d.ts",
96
- "import": "./dist/core/radiant-component.js"
102
+ "./core/radiant-controller": {
103
+ "types": "./dist/core/radiant-controller.d.ts",
104
+ "import": "./dist/core/radiant-controller.js"
105
+ },
106
+ "./core/reactive-jsx-value": {
107
+ "types": "./dist/core/reactive-jsx-value.d.ts",
108
+ "import": "./dist/core/reactive-jsx-value.js"
97
109
  },
98
110
  "./client/hydrator": {
99
111
  "types": "./dist/client/hydrator.d.ts",
100
112
  "import": "./dist/client/hydrator.js"
101
113
  },
114
+ "./client/app-bootstrap": {
115
+ "types": "./dist/client/app-bootstrap.d.ts",
116
+ "import": "./dist/client/app-bootstrap.js"
117
+ },
102
118
  "./client/install-hydrator": {
103
119
  "types": "./dist/client/install-hydrator.d.ts",
104
120
  "import": "./dist/client/install-hydrator.js"
@@ -119,6 +135,10 @@
119
135
  "types": "./dist/server/render-component.d.ts",
120
136
  "import": "./dist/server/render-component.js"
121
137
  },
138
+ "./server/render-controller": {
139
+ "types": "./dist/server/render-controller.d.ts",
140
+ "import": "./dist/server/render-controller.js"
141
+ },
122
142
  "./server/project-root": {
123
143
  "types": "./dist/server/project-root.d.ts",
124
144
  "import": "./dist/server/project-root.js"
@@ -127,6 +147,14 @@
127
147
  "types": "./dist/decorators/bound.d.ts",
128
148
  "import": "./dist/decorators/bound.js"
129
149
  },
150
+ "./decorators/attr": {
151
+ "types": "./dist/decorators/attr.d.ts",
152
+ "import": "./dist/decorators/attr.js"
153
+ },
154
+ "./decorators/controller": {
155
+ "types": "./dist/decorators/controller.d.ts",
156
+ "import": "./dist/decorators/controller.js"
157
+ },
130
158
  "./decorators/custom-element": {
131
159
  "types": "./dist/decorators/custom-element.d.ts",
132
160
  "import": "./dist/decorators/custom-element.js"
@@ -191,10 +219,6 @@
191
219
  "types": "./dist/decorators/state.d.ts",
192
220
  "import": "./dist/decorators/state.js"
193
221
  },
194
- "./tools/stringify-typed": {
195
- "types": "./dist/tools/stringify-typed.d.ts",
196
- "import": "./dist/tools/stringify-typed.js"
197
- },
198
222
  "./tools/render-jsx-template": {
199
223
  "types": "./dist/tools/render-jsx-template.d.ts",
200
224
  "import": "./dist/tools/render-jsx-template.js"
package/size-budget.json CHANGED
@@ -1,16 +1,25 @@
1
1
  {
2
2
  "bundles": [
3
3
  {
4
+ "control": "strict",
4
5
  "label": "root-client-surface",
5
6
  "entrypoint": "./src/index.ts",
6
- "maxBytes": 46080,
7
- "maxGzipBytes": 12288
7
+ "maxBytes": 45696,
8
+ "maxGzipBytes": 12416
8
9
  },
9
10
  {
11
+ "control": "advisory",
10
12
  "label": "server-render",
11
13
  "entrypoint": "./src/server/render-component.ts",
12
14
  "maxBytes": 15360,
13
- "maxGzipBytes": 5120
15
+ "maxGzipBytes": 5184
16
+ },
17
+ {
18
+ "control": "advisory",
19
+ "label": "server-render-controller",
20
+ "entrypoint": "./src/server/render-controller.ts",
21
+ "maxBytes": 15360,
22
+ "maxGzipBytes": 5376
14
23
  }
15
24
  ]
16
25
  }
@@ -1,4 +0,0 @@
1
- import{Bb as t}from"./chunk-wwbjz9k4.js";function a(r){return function(o,e){let n=String(e.name);e.addInitializer(function(){let i=t(this,r);Object.defineProperty(this,n,{get(){return i.value},enumerable:!0,configurable:!0})})}}
2
- export{a as $};
3
-
4
- //# debugId=174B02C349DF3B4664756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/decorators/standard/query.ts"],
4
- "sourcesContent": [
5
- "import { createQuery } from '../../helpers/create-query';\nimport type { QueryConfig } from '../query';\n\nexport function query(options: QueryConfig) {\n\treturn function <T extends HTMLElement, V extends Element | Element[]>(\n\t\t_: undefined,\n\t\tcontext: ClassFieldDecoratorContext<T, V>,\n\t) {\n\t\tconst propertyName = String(context.name);\n\n\t\tcontext.addInitializer(function (this: T) {\n\t\t\tconst accessor = createQuery<V>(this, options);\n\n\t\t\tObject.defineProperty(this, propertyName, {\n\t\t\t\tget() {\n\t\t\t\t\treturn accessor.value;\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t});\n\t\t});\n\t};\n}\n"
6
- ],
7
- "mappings": "yCAGO,SAAS,CAAK,CAAC,EAAsB,CAC3C,OAAO,QAA+D,CACrE,EACA,EACC,CACD,IAAM,EAAe,OAAO,EAAQ,IAAI,EAExC,EAAQ,eAAe,QAAS,EAAU,CACzC,IAAM,EAAW,EAAe,KAAM,CAAO,EAE7C,OAAO,eAAe,KAAM,EAAc,CACzC,GAAG,EAAG,CACL,OAAO,EAAS,OAEjB,WAAY,GACZ,aAAc,EACf,CAAC,EACD",
8
- "debugId": "174B02C349DF3B4664756E2164756E21",
9
- "names": []
10
- }
@@ -1,4 +0,0 @@
1
- import{ea as z}from"./chunk-qdz5sncz.js";import{fa as A}from"./chunk-w8s5fnsq.js";import{Oa as q}from"./chunk-q9z6tnzw.js";function K(j){return function(F,G){return q(A(j),z(j),F,G)}}
2
- export{K as da};
3
-
4
- //# debugId=0C61F31D99EFA58E64756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/decorators/event.ts"],
4
- "sourcesContent": [
5
- "import { type EventEmitterConfig } from '../tools/event-emitter';\nimport type { StandardOrLegacyFieldDecoratorArgs } from '../types';\nimport { event as legacyEvent } from './legacy/event';\nimport { event as standardEvent } from './standard/event';\nimport { fieldDecoratorBridge } from './bridge';\n\n/**\n * Decorator that attaches an EventEmitter to the class field property.\n * The EventEmitter can be used to dispatch custom events from the target element.\n * @param eventConfig {@link EventEmitterConfig} Configuration for the event emitter.\n * @see {@link EventEmitter} for more details about how the EventEmitter works.\n */\nexport function event(eventConfig: EventEmitterConfig) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyFieldDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyFieldDecoratorArgs['nameOrContext'],\n\t): any {\n\t\treturn fieldDecoratorBridge(standardEvent(eventConfig), legacyEvent(eventConfig), protoOrTarget, nameOrContext);\n\t};\n}\n"
6
- ],
7
- "mappings": "uIAYO,GAAS,LAAK,CAAC,EAAiC,CACtD,OAAO,QAAS,CACf,EACA,EACM,CACN,OAAO,EAAqB,EAAc,CAAW,EAAG,EAAY,CAAW,EAAG,EAAe,CAAa",
8
- "debugId": "0C61F31D99EFA58E64756E2164756E21",
9
- "names": []
10
- }
@@ -1,4 +0,0 @@
1
- import{na as q}from"./chunk-8e9fgtbn.js";import{oa as v}from"./chunk-bk2nbmcd.js";import{Pa as j}from"./chunk-q9z6tnzw.js";function I(f){return function(w,z,E){return j(v(f),q(f),w,z,E)}}
2
- export{I as ma};
3
-
4
- //# debugId=79FD819A4172B94064756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/decorators/on-updated.ts"],
4
- "sourcesContent": [
5
- "import type { StandardOrLegacyMethodDecoratorArgs } from '../types';\nimport { onUpdated as legacyOnUpdated } from './legacy/on-updated';\nimport { onUpdated as standardOnUpdated } from './standard/on-updated';\nimport { methodDecoratorBridge } from './bridge';\n\n/**\n * A decorator to bind a method to the instance.\n */\nexport function onUpdated(keyOrKeys: string | string[]) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyMethodDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyMethodDecoratorArgs['nameOrContext'],\n\t\tdescriptor?: StandardOrLegacyMethodDecoratorArgs['descriptor'],\n\t): any {\n\t\treturn methodDecoratorBridge(\n\t\t\tstandardOnUpdated(keyOrKeys),\n\t\t\tlegacyOnUpdated(keyOrKeys),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t\tdescriptor,\n\t\t);\n\t};\n}\n"
6
- ],
7
- "mappings": "uIAQO,GAAS,LAAS,CAAC,EAA8B,CACvD,OAAO,QAAS,CACf,EACA,EACA,EACM,CACN,OAAO,EACN,EAAkB,CAAS,EAC3B,EAAgB,CAAS,EACzB,EACA,EACA,CACD",
8
- "debugId": "79FD819A4172B94064756E2164756E21",
9
- "names": []
10
- }
@@ -1,4 +0,0 @@
1
- import{ta as z}from"./chunk-9rj2rwes.js";import{ua as G}from"./chunk-v3ta7hnv.js";import{Pa as q}from"./chunk-q9z6tnzw.js";function Q(j){return function(H,I,J){return q(G(j),z(j),H,I,J)}}
2
- export{Q as sa};
3
-
4
- //# debugId=DFF5F8F9A61E3D2564756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/decorators/on-event.ts"],
4
- "sourcesContent": [
5
- "import type { RadiantElementEventListener } from '../core/radiant-element';\nimport type { StandardOrLegacyMethodDecoratorArgs } from '../types';\nimport type { OnEventConfig, OnEventScope } from '../helpers/create-event-listener';\nimport { onEvent as legacyOnEvent } from './legacy/on-event';\nimport { onEvent as standardOnEvent } from './standard/on-event';\nimport { methodDecoratorBridge } from './bridge';\n\nexport type { OnEventConfig, OnEventScope };\n\n/**\n * A decorator to subscribe to an event on the target element.\n * The event listener will be automatically unsubscribed when the element is disconnected.\n *\n * Note: This decorator uses event delegation, which means it relies on event bubbling.\n * Therefore, it will not work with events that do not bubble, such as `focus`, `blur`, `load`, `unload`, `scroll`, etc.\n * For focus and blur events, consider using `focusin` and `focusout` which are similar but do bubble.\n * Delegated listeners observe the host light DOM by default, and can optionally observe the shadow root or both trees.\n *\n * @param options {@link OnEventConfig} The event configuration.\n */\nexport function onEvent(options: OnEventConfig) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyMethodDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyMethodDecoratorArgs['nameOrContext'],\n\t\tdescriptor?: StandardOrLegacyMethodDecoratorArgs['descriptor'],\n\t): any {\n\t\treturn methodDecoratorBridge(\n\t\t\tstandardOnEvent(options),\n\t\t\tlegacyOnEvent(options),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t\tdescriptor,\n\t\t);\n\t};\n}\n"
6
- ],
7
- "mappings": "uIAoBO,GAAS,LAAO,CAAC,EAAwB,CAC/C,OAAO,QAAS,CACf,EACA,EACA,EACM,CACN,OAAO,EACN,EAAgB,CAAO,EACvB,EAAc,CAAO,EACrB,EACA,EACA,CACD",
8
- "debugId": "DFF5F8F9A61E3D2564756E2164756E21",
9
- "names": []
10
- }
@@ -1,4 +0,0 @@
1
- import{U as I}from"./chunk-kmebacvv.js";import{W as U,X as Y}from"./chunk-c0qyz98c.js";import{ub as K,vb as Q}from"./chunk-hpzgnxgq.js";import{createMarkupNodeLike as _}from"@ecopages/jsx";class ${host;context;hydrationKey;hydrate;serialize;pendingHostHydration;value;subscriptions=[];constructor(q,A){this.host=q,this.context=A.context,this.hydrationKey=A.hydrationKey,this.hydrate=A.hydrate,this.serialize=A.serialize,this.pendingHostHydration=Boolean(A.hydrate),this.value=A.initialValue,this.tryHydrateFromHost(),this.registerEvents(),this.host.dispatchEvent(new I(this.context))}setContext=(q,A)=>{if(this.tryHydrateFromHost(),this.pendingHostHydration=!1,typeof this.value>"u"&&this.isObject(q)){let B=this.value;if(this.value={...q},A)A(this.value);this.notifySubscribers(this.value,B);return}if(this.isObject(this.value)&&this.isObject(q)){let B={...this.value};if(this.value={...this.value,...q},A)A(this.value);this.notifySubscribers(this.value,B)}};getContext=()=>{return this.tryHydrateFromHost(),this.value};getContextKey=()=>{return this.context};serializeHydrationValue=()=>{if(this.tryHydrateFromHost(),!this.hydrate||typeof this.value>"u")return;let q=this.serialize?this.serialize(this.value):this.value;if(typeof q>"u")return;let A=JSON.stringify(q);if(typeof A!=="string")return;return Y(A)};renderHydrationScriptTag=()=>{let q=this.serializeHydrationValue();if(!q)return;return U({hydrationKey:this.hydrationKey,serializedValue:q})};renderHydrationScript=()=>{let q=this.renderHydrationScriptTag();if(!q)return;return _(q)};subscribe=({select:q,callback:A})=>{this.subscriptions.push({select:q,callback:A})};tryHydrateFromHost(){if(!this.pendingHostHydration)return;let q=this.findHydrationScriptElement();if(!q)return;this.value=this.mergeHydrationValue(K(q,this.value)),this.pendingHostHydration=!1}mergeHydrationValue(q){if(this.hydrate===Object&&this.isObject(q)&&(this.isObject(this.value)||typeof this.value>"u"))return{...this.value??{},...q};return q}isObject(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}findHydrationScriptElement(){return Q(this.host,"context",this.hydrationKey)}notifySubscribers=(q,A)=>{for(let B of this.subscriptions){if(!B.select||typeof A>"u"){this.sendSubscriptionUpdate(B,q);continue}let F=B.select(q),G=B.select(A);if(F!==G)this.sendSubscriptionUpdate(B,q)}};sendSubscriptionUpdate=({select:q,callback:A},B)=>{if(!q)A(B);else A(q(B))};handleSubscriptionRequest=({select:q,callback:A,subscribe:B})=>{if(this.tryHydrateFromHost(),B)this.subscribe({select:q,callback:A});if(typeof this.value>"u")return;if(q)A(q(this.value));else A(this.value)};onSubscriptionRequest=(q)=>{let{context:A,callback:B,subscribe:F,select:G,target:Z}=q;if(A!==this.context)return;q.stopPropagation(),Z.dispatchEvent(new I(this.context)),this.handleSubscriptionRequest({select:G,callback:B,subscribe:F})};onContextRequest=(q)=>{let{context:A,callback:B}=q;if(A!==this.context)return;q.stopPropagation(),B(this)};registerEvents=()=>{this.host.addEventListener("context-subscription-request",this.onSubscriptionRequest),this.host.addEventListener("context-request",this.onContextRequest)}}
2
- export{$ as R};
3
-
4
- //# debugId=4E0252ECD83ECA6C64756E2164756E21