@ecopages/radiant 0.1.8 → 0.3.0-alpha.0

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 (442) hide show
  1. package/README.md +289 -34
  2. package/dist/chunk-0y78f8hj.js +4 -0
  3. package/dist/chunk-0y78f8hj.js.map +10 -0
  4. package/dist/chunk-0zq7e1ne.js +4 -0
  5. package/dist/chunk-0zq7e1ne.js.map +10 -0
  6. package/dist/chunk-13ydx769.js +4 -0
  7. package/dist/chunk-13ydx769.js.map +10 -0
  8. package/dist/chunk-147yvtsn.js +4 -0
  9. package/dist/chunk-147yvtsn.js.map +10 -0
  10. package/dist/chunk-17earqbr.js +4 -0
  11. package/dist/chunk-17earqbr.js.map +10 -0
  12. package/dist/chunk-1w1dm68j.js +4 -0
  13. package/dist/chunk-1w1dm68j.js.map +10 -0
  14. package/dist/chunk-2tgrfv09.js +4 -0
  15. package/dist/chunk-2tgrfv09.js.map +10 -0
  16. package/dist/chunk-3b033cgq.js +4 -0
  17. package/dist/chunk-3b033cgq.js.map +10 -0
  18. package/dist/chunk-42tyhfvh.js +4 -0
  19. package/dist/chunk-42tyhfvh.js.map +10 -0
  20. package/dist/chunk-4cc2syf5.js +4 -0
  21. package/dist/chunk-4cc2syf5.js.map +10 -0
  22. package/dist/chunk-4fqkmpra.js +4 -0
  23. package/dist/chunk-4fqkmpra.js.map +10 -0
  24. package/dist/chunk-4srpf0y5.js +4 -0
  25. package/dist/chunk-4srpf0y5.js.map +10 -0
  26. package/dist/chunk-57w3vmme.js +4 -0
  27. package/dist/chunk-57w3vmme.js.map +10 -0
  28. package/dist/chunk-5a2xez36.js +4 -0
  29. package/dist/chunk-5a2xez36.js.map +10 -0
  30. package/dist/chunk-5bym7y1d.js +4 -0
  31. package/dist/chunk-5bym7y1d.js.map +10 -0
  32. package/dist/chunk-5td6v9k3.js +4 -0
  33. package/dist/chunk-5td6v9k3.js.map +10 -0
  34. package/dist/chunk-60015zxq.js +4 -0
  35. package/dist/chunk-60015zxq.js.map +10 -0
  36. package/dist/chunk-60q4y3k5.js +4 -0
  37. package/dist/chunk-60q4y3k5.js.map +10 -0
  38. package/dist/chunk-6kdxrppw.js +4 -0
  39. package/dist/chunk-6kdxrppw.js.map +10 -0
  40. package/dist/chunk-6z34stya.js +4 -0
  41. package/dist/chunk-6z34stya.js.map +10 -0
  42. package/dist/chunk-73x7jpdd.js +4 -0
  43. package/dist/chunk-73x7jpdd.js.map +10 -0
  44. package/dist/chunk-84fc8cz9.js +4 -0
  45. package/dist/chunk-84fc8cz9.js.map +10 -0
  46. package/dist/chunk-8dexhy6c.js +4 -0
  47. package/dist/chunk-8dexhy6c.js.map +10 -0
  48. package/dist/chunk-8n2dhx28.js +4 -0
  49. package/dist/chunk-8n2dhx28.js.map +10 -0
  50. package/dist/chunk-8tvt04cm.js +4 -0
  51. package/dist/chunk-8tvt04cm.js.map +10 -0
  52. package/dist/chunk-8vak8w5w.js +4 -0
  53. package/dist/chunk-8vak8w5w.js.map +10 -0
  54. package/dist/chunk-8xy18qmz.js +4 -0
  55. package/dist/chunk-8xy18qmz.js.map +9 -0
  56. package/dist/chunk-9554n9t4.js +4 -0
  57. package/dist/chunk-9554n9t4.js.map +10 -0
  58. package/dist/chunk-9ascmjk3.js +4 -0
  59. package/dist/chunk-9ascmjk3.js.map +10 -0
  60. package/dist/chunk-9gjmqxp2.js +4 -0
  61. package/dist/chunk-9gjmqxp2.js.map +10 -0
  62. package/dist/chunk-a7hzs37s.js +4 -0
  63. package/dist/chunk-a7hzs37s.js.map +10 -0
  64. package/dist/chunk-aajhkdmn.js +4 -0
  65. package/dist/chunk-aajhkdmn.js.map +10 -0
  66. package/dist/chunk-agjb2a3r.js +4 -0
  67. package/dist/chunk-agjb2a3r.js.map +10 -0
  68. package/dist/chunk-ak97hp4w.js +4 -0
  69. package/dist/chunk-ak97hp4w.js.map +10 -0
  70. package/dist/chunk-bmhn4nbp.js +4 -0
  71. package/dist/chunk-bmhn4nbp.js.map +10 -0
  72. package/dist/chunk-c8vqg7r1.js +4 -0
  73. package/dist/chunk-c8vqg7r1.js.map +10 -0
  74. package/dist/chunk-cbvd18v1.js +4 -0
  75. package/dist/chunk-cbvd18v1.js.map +10 -0
  76. package/dist/chunk-chyn72n9.js +4 -0
  77. package/dist/chunk-chyn72n9.js.map +10 -0
  78. package/dist/chunk-cvz9mrxa.js +4 -0
  79. package/dist/chunk-cvz9mrxa.js.map +10 -0
  80. package/dist/chunk-d0n7njdy.js +4 -0
  81. package/dist/chunk-d0n7njdy.js.map +10 -0
  82. package/dist/chunk-d4v5qpxa.js +4 -0
  83. package/dist/chunk-d4v5qpxa.js.map +10 -0
  84. package/dist/chunk-d7hh3ze6.js +4 -0
  85. package/dist/chunk-d7hh3ze6.js.map +10 -0
  86. package/dist/chunk-d98q3myg.js +4 -0
  87. package/dist/chunk-d98q3myg.js.map +10 -0
  88. package/dist/chunk-dscj0sk9.js +4 -0
  89. package/dist/chunk-dscj0sk9.js.map +10 -0
  90. package/dist/chunk-dx1wqc00.js +4 -0
  91. package/dist/chunk-dx1wqc00.js.map +10 -0
  92. package/dist/chunk-g0gz7ypq.js +4 -0
  93. package/dist/chunk-g0gz7ypq.js.map +10 -0
  94. package/dist/chunk-hkmm3dj9.js +4 -0
  95. package/dist/chunk-hkmm3dj9.js.map +10 -0
  96. package/dist/chunk-hn4j8rt5.js +4 -0
  97. package/dist/chunk-hn4j8rt5.js.map +10 -0
  98. package/dist/chunk-jce9gqqw.js +4 -0
  99. package/dist/chunk-jce9gqqw.js.map +10 -0
  100. package/dist/chunk-jg20mzg8.js +4 -0
  101. package/dist/chunk-jg20mzg8.js.map +10 -0
  102. package/dist/chunk-jkb2y7c8.js +4 -0
  103. package/dist/chunk-jkb2y7c8.js.map +10 -0
  104. package/dist/chunk-k5hr781q.js +4 -0
  105. package/dist/chunk-k5hr781q.js.map +10 -0
  106. package/dist/chunk-ksv01cey.js +4 -0
  107. package/dist/chunk-ksv01cey.js.map +10 -0
  108. package/dist/chunk-mpjnqmbq.js +4 -0
  109. package/dist/chunk-mpjnqmbq.js.map +10 -0
  110. package/dist/chunk-mqxmfvyp.js +4 -0
  111. package/dist/chunk-mqxmfvyp.js.map +10 -0
  112. package/dist/chunk-ms6a9zdt.js +4 -0
  113. package/dist/chunk-ms6a9zdt.js.map +10 -0
  114. package/dist/chunk-nerd6fmg.js +4 -0
  115. package/dist/chunk-nerd6fmg.js.map +10 -0
  116. package/dist/chunk-nw171z6m.js +4 -0
  117. package/dist/chunk-nw171z6m.js.map +10 -0
  118. package/dist/chunk-p6pxdvkk.js +4 -0
  119. package/dist/chunk-p6pxdvkk.js.map +10 -0
  120. package/dist/chunk-paehjz94.js +4 -0
  121. package/dist/chunk-paehjz94.js.map +10 -0
  122. package/dist/chunk-par0t822.js +4 -0
  123. package/dist/chunk-par0t822.js.map +10 -0
  124. package/dist/chunk-qaagk55a.js +4 -0
  125. package/dist/chunk-qaagk55a.js.map +10 -0
  126. package/dist/chunk-qbnedp0y.js +4 -0
  127. package/dist/chunk-qbnedp0y.js.map +10 -0
  128. package/dist/chunk-qd28hvdx.js +4 -0
  129. package/dist/chunk-qd28hvdx.js.map +10 -0
  130. package/dist/chunk-qdj6r8jn.js +4 -0
  131. package/dist/chunk-qdj6r8jn.js.map +10 -0
  132. package/dist/chunk-qe6sjr27.js +4 -0
  133. package/dist/chunk-qe6sjr27.js.map +10 -0
  134. package/dist/chunk-r1cvaz1t.js +4 -0
  135. package/dist/chunk-r1cvaz1t.js.map +10 -0
  136. package/dist/chunk-r75y7ydb.js +4 -0
  137. package/dist/chunk-r75y7ydb.js.map +10 -0
  138. package/dist/chunk-s4qgct1z.js +4 -0
  139. package/dist/chunk-s4qgct1z.js.map +10 -0
  140. package/dist/chunk-scfk041e.js +4 -0
  141. package/dist/chunk-scfk041e.js.map +10 -0
  142. package/dist/chunk-t6x9e177.js +4 -0
  143. package/dist/chunk-t6x9e177.js.map +10 -0
  144. package/dist/chunk-t7a1bbxq.js +4 -0
  145. package/dist/chunk-t7a1bbxq.js.map +10 -0
  146. package/dist/chunk-tyysm4gk.js +4 -0
  147. package/dist/chunk-tyysm4gk.js.map +10 -0
  148. package/dist/chunk-vpfm9yw8.js +4 -0
  149. package/dist/chunk-vpfm9yw8.js.map +10 -0
  150. package/dist/chunk-w50v38rv.js +4 -0
  151. package/dist/chunk-w50v38rv.js.map +10 -0
  152. package/dist/chunk-x0522ksh.js +4 -0
  153. package/dist/chunk-x0522ksh.js.map +10 -0
  154. package/dist/chunk-xd1xn3vy.js +4 -0
  155. package/dist/chunk-xd1xn3vy.js.map +10 -0
  156. package/dist/chunk-zb7wh7w4.js +4 -0
  157. package/dist/chunk-zb7wh7w4.js.map +10 -0
  158. package/dist/chunk-zj9ez73m.js +4 -0
  159. package/dist/chunk-zj9ez73m.js.map +10 -0
  160. package/dist/context/context-consumer-bootstrap.d.ts +41 -0
  161. package/dist/context/context-consumer-bootstrap.js +3 -0
  162. package/dist/context/context-consumer-bootstrap.js.map +9 -0
  163. package/dist/context/context-consumer-runtime.d.ts +34 -0
  164. package/dist/context/context-consumer-runtime.js +3 -0
  165. package/dist/context/context-consumer-runtime.js.map +9 -0
  166. package/dist/context/context-provider.d.ts +50 -2
  167. package/dist/context/context-provider.js +2 -279
  168. package/dist/context/context-provider.js.map +3 -6
  169. package/dist/context/context-ssr-bridge.d.ts +16 -0
  170. package/dist/context/context-ssr-bridge.js +3 -0
  171. package/dist/context/context-ssr-bridge.js.map +9 -0
  172. package/dist/context/create-context.js +2 -6
  173. package/dist/context/create-context.js.map +3 -4
  174. package/dist/context/decorators/consume-context.d.ts +10 -6
  175. package/dist/context/decorators/consume-context.js +2 -64
  176. package/dist/context/decorators/consume-context.js.map +3 -5
  177. package/dist/context/decorators/context-selection-delivery.d.ts +1 -0
  178. package/dist/context/decorators/context-selection-delivery.js +3 -0
  179. package/dist/context/decorators/context-selection-delivery.js.map +9 -0
  180. package/dist/context/decorators/context-selector.d.ts +29 -9
  181. package/dist/context/decorators/context-selector.js +2 -71
  182. package/dist/context/decorators/context-selector.js.map +3 -5
  183. package/dist/context/decorators/legacy/consume-context.d.ts +3 -0
  184. package/dist/context/decorators/legacy/consume-context.js +3 -0
  185. package/dist/context/decorators/legacy/consume-context.js.map +9 -0
  186. package/dist/context/decorators/legacy/context-selector-field.d.ts +8 -0
  187. package/dist/context/decorators/legacy/context-selector-field.js +3 -0
  188. package/dist/context/decorators/legacy/context-selector-field.js.map +9 -0
  189. package/dist/context/decorators/legacy/context-selector.d.ts +4 -0
  190. package/dist/context/decorators/legacy/context-selector.js +3 -0
  191. package/dist/context/decorators/legacy/context-selector.js.map +9 -0
  192. package/dist/context/decorators/legacy/provide-context.d.ts +4 -0
  193. package/dist/context/decorators/legacy/provide-context.js +3 -0
  194. package/dist/context/decorators/legacy/provide-context.js.map +9 -0
  195. package/dist/context/decorators/on-context-update.d.ts +31 -0
  196. package/dist/context/decorators/on-context-update.js +3 -0
  197. package/dist/context/decorators/on-context-update.js.map +9 -0
  198. package/dist/context/decorators/provide-context.d.ts +18 -7
  199. package/dist/context/decorators/provide-context.js +2 -291
  200. package/dist/context/decorators/provide-context.js.map +3 -7
  201. package/dist/context/decorators/standard/consume-context.d.ts +3 -0
  202. package/dist/context/decorators/standard/consume-context.js +3 -0
  203. package/dist/context/decorators/standard/consume-context.js.map +9 -0
  204. package/dist/context/decorators/standard/context-selector-field.d.ts +8 -0
  205. package/dist/context/decorators/standard/context-selector-field.js +3 -0
  206. package/dist/context/decorators/standard/context-selector-field.js.map +9 -0
  207. package/dist/context/decorators/standard/context-selector.d.ts +5 -0
  208. package/dist/context/decorators/standard/context-selector.js +3 -0
  209. package/dist/context/decorators/standard/context-selector.js.map +9 -0
  210. package/dist/context/decorators/standard/provide-context.d.ts +4 -0
  211. package/dist/context/decorators/standard/provide-context.js +3 -0
  212. package/dist/context/decorators/standard/provide-context.js.map +9 -0
  213. package/dist/context/events.d.ts +3 -2
  214. package/dist/context/events.js +2 -53
  215. package/dist/context/events.js.map +3 -4
  216. package/dist/context/hydration-script.d.ts +17 -0
  217. package/dist/context/hydration-script.js +3 -0
  218. package/dist/context/hydration-script.js.map +9 -0
  219. package/dist/core/custom-element-metadata.d.ts +3 -0
  220. package/dist/core/custom-element-metadata.js +3 -0
  221. package/dist/core/custom-element-metadata.js.map +9 -0
  222. package/dist/core/hydration-codec.d.ts +24 -0
  223. package/dist/core/hydration-codec.js +3 -0
  224. package/dist/core/hydration-codec.js.map +9 -0
  225. package/dist/core/radiant-component-ssr.d.ts +29 -0
  226. package/dist/core/radiant-component-ssr.js +3 -0
  227. package/dist/core/radiant-component-ssr.js.map +9 -0
  228. package/dist/core/radiant-component.d.ts +106 -0
  229. package/dist/core/radiant-component.js +3 -0
  230. package/dist/core/radiant-component.js.map +9 -0
  231. package/dist/core/radiant-element.d.ts +283 -23
  232. package/dist/core/radiant-element.js +2 -82
  233. package/dist/core/radiant-element.js.map +3 -4
  234. package/dist/core/reactive-jsx-value.d.ts +10 -0
  235. package/dist/core/reactive-jsx-value.js +3 -0
  236. package/dist/core/reactive-jsx-value.js.map +9 -0
  237. package/dist/core/reactive-prop-metadata.d.ts +7 -0
  238. package/dist/core/reactive-prop-metadata.js +3 -0
  239. package/dist/core/reactive-prop-metadata.js.map +9 -0
  240. package/dist/core/slot-projection.d.ts +34 -0
  241. package/dist/core/slot-projection.js +3 -0
  242. package/dist/core/slot-projection.js.map +9 -0
  243. package/dist/core/ssr-hydration-binding.d.ts +14 -0
  244. package/dist/core/ssr-hydration-binding.js +2 -0
  245. package/dist/core/ssr-hydration-binding.js.map +9 -0
  246. package/dist/core/ssr-preparation.d.ts +18 -0
  247. package/dist/core/ssr-preparation.js +3 -0
  248. package/dist/core/ssr-preparation.js.map +9 -0
  249. package/dist/decorators/bound.d.ts +2 -6
  250. package/dist/decorators/bound.js +2 -23
  251. package/dist/decorators/bound.js.map +3 -4
  252. package/dist/decorators/bridge.d.ts +8 -0
  253. package/dist/decorators/bridge.js +3 -0
  254. package/dist/decorators/bridge.js.map +9 -0
  255. package/dist/decorators/custom-element.d.ts +3 -1
  256. package/dist/decorators/custom-element.js +2 -14
  257. package/dist/decorators/custom-element.js.map +3 -4
  258. package/dist/decorators/debounce.d.ts +6 -1
  259. package/dist/decorators/debounce.js +2 -20
  260. package/dist/decorators/debounce.js.map +3 -4
  261. package/dist/decorators/event.d.ts +3 -2
  262. package/dist/decorators/event.js +2 -46
  263. package/dist/decorators/event.js.map +3 -5
  264. package/dist/decorators/legacy/bound.d.ts +9 -0
  265. package/dist/decorators/legacy/bound.js +3 -0
  266. package/dist/decorators/legacy/bound.js.map +9 -0
  267. package/dist/decorators/legacy/custom-element.d.ts +6 -0
  268. package/dist/decorators/legacy/custom-element.js +3 -0
  269. package/dist/decorators/legacy/custom-element.js.map +9 -0
  270. package/dist/decorators/legacy/debounce.d.ts +1 -0
  271. package/dist/decorators/legacy/debounce.js +3 -0
  272. package/dist/decorators/legacy/debounce.js.map +9 -0
  273. package/dist/decorators/legacy/event.d.ts +9 -0
  274. package/dist/decorators/legacy/event.js +3 -0
  275. package/dist/decorators/legacy/event.js.map +9 -0
  276. package/dist/decorators/legacy/instance-initializers.d.ts +17 -0
  277. package/dist/decorators/legacy/instance-initializers.js +3 -0
  278. package/dist/decorators/legacy/instance-initializers.js.map +9 -0
  279. package/dist/decorators/legacy/on-event.d.ts +17 -0
  280. package/dist/decorators/legacy/on-event.js +3 -0
  281. package/dist/decorators/legacy/on-event.js.map +9 -0
  282. package/dist/decorators/legacy/on-updated.d.ts +6 -0
  283. package/dist/decorators/legacy/on-updated.js +3 -0
  284. package/dist/decorators/legacy/on-updated.js.map +9 -0
  285. package/dist/decorators/legacy/query-slot.d.ts +3 -0
  286. package/dist/decorators/legacy/query-slot.js +3 -0
  287. package/dist/decorators/legacy/query-slot.js.map +9 -0
  288. package/dist/decorators/legacy/query.d.ts +23 -0
  289. package/dist/decorators/legacy/query.js +3 -0
  290. package/dist/decorators/legacy/query.js.map +9 -0
  291. package/dist/decorators/{reactive-field.d.ts → legacy/reactive-field.d.ts} +2 -2
  292. package/dist/decorators/legacy/reactive-field.js +3 -0
  293. package/dist/decorators/legacy/reactive-field.js.map +9 -0
  294. package/dist/decorators/{reactive-prop.d.ts → legacy/reactive-prop.d.ts} +4 -3
  295. package/dist/decorators/legacy/reactive-prop.js +3 -0
  296. package/dist/decorators/legacy/reactive-prop.js.map +9 -0
  297. package/dist/decorators/legacy/signal.d.ts +10 -0
  298. package/dist/decorators/legacy/signal.js +3 -0
  299. package/dist/decorators/legacy/signal.js.map +9 -0
  300. package/dist/decorators/on-event.d.ts +6 -17
  301. package/dist/decorators/on-event.js +2 -47
  302. package/dist/decorators/on-event.js.map +3 -4
  303. package/dist/decorators/on-updated.d.ts +3 -4
  304. package/dist/decorators/on-updated.js +2 -29
  305. package/dist/decorators/on-updated.js.map +3 -4
  306. package/dist/decorators/prop.d.ts +14 -0
  307. package/dist/decorators/prop.js +3 -0
  308. package/dist/decorators/prop.js.map +9 -0
  309. package/dist/decorators/query-slot.d.ts +13 -0
  310. package/dist/decorators/query-slot.js +3 -0
  311. package/dist/decorators/query-slot.js.map +9 -0
  312. package/dist/decorators/query.d.ts +7 -35
  313. package/dist/decorators/query.js +2 -36
  314. package/dist/decorators/query.js.map +3 -4
  315. package/dist/decorators/signal.d.ts +23 -0
  316. package/dist/decorators/signal.js +3 -0
  317. package/dist/decorators/signal.js.map +9 -0
  318. package/dist/decorators/standard/bound.d.ts +2 -0
  319. package/dist/decorators/standard/bound.js +3 -0
  320. package/dist/decorators/standard/bound.js.map +9 -0
  321. package/dist/decorators/standard/custom-element.d.ts +1 -0
  322. package/dist/decorators/standard/custom-element.js +3 -0
  323. package/dist/decorators/standard/custom-element.js.map +9 -0
  324. package/dist/decorators/standard/debounce.d.ts +2 -0
  325. package/dist/decorators/standard/debounce.js +3 -0
  326. package/dist/decorators/standard/debounce.js.map +9 -0
  327. package/dist/decorators/standard/event.d.ts +9 -0
  328. package/dist/decorators/standard/event.js +3 -0
  329. package/dist/decorators/standard/event.js.map +9 -0
  330. package/dist/decorators/standard/on-event.d.ts +17 -0
  331. package/dist/decorators/standard/on-event.js +3 -0
  332. package/dist/decorators/standard/on-event.js.map +9 -0
  333. package/dist/decorators/standard/on-updated.d.ts +2 -0
  334. package/dist/decorators/standard/on-updated.js +3 -0
  335. package/dist/decorators/standard/on-updated.js.map +9 -0
  336. package/dist/decorators/standard/query-slot.d.ts +8 -0
  337. package/dist/decorators/standard/query-slot.js +3 -0
  338. package/dist/decorators/standard/query-slot.js.map +9 -0
  339. package/dist/decorators/standard/query.d.ts +2 -0
  340. package/dist/decorators/standard/query.js +3 -0
  341. package/dist/decorators/standard/query.js.map +9 -0
  342. package/dist/decorators/standard/reactive-field.d.ts +2 -0
  343. package/dist/decorators/standard/reactive-field.js +3 -0
  344. package/dist/decorators/standard/reactive-field.js.map +9 -0
  345. package/dist/decorators/standard/reactive-prop.d.ts +2 -0
  346. package/dist/decorators/standard/reactive-prop.js +3 -0
  347. package/dist/decorators/standard/reactive-prop.js.map +9 -0
  348. package/dist/decorators/standard/signal.d.ts +33 -0
  349. package/dist/decorators/standard/signal.js +3 -0
  350. package/dist/decorators/standard/signal.js.map +9 -0
  351. package/dist/decorators/state.d.ts +11 -0
  352. package/dist/decorators/state.js +3 -0
  353. package/dist/decorators/state.js.map +9 -0
  354. package/dist/helpers/create-event-listener.d.ts +28 -0
  355. package/dist/helpers/create-event-listener.js +3 -0
  356. package/dist/helpers/create-event-listener.js.map +9 -0
  357. package/dist/helpers/create-event.d.ts +9 -0
  358. package/dist/helpers/create-event.js +3 -0
  359. package/dist/helpers/create-event.js.map +9 -0
  360. package/dist/helpers/create-query-slot.d.ts +20 -0
  361. package/dist/helpers/create-query-slot.js +3 -0
  362. package/dist/helpers/create-query-slot.js.map +9 -0
  363. package/dist/helpers/create-query.d.ts +27 -0
  364. package/dist/helpers/create-query.js +3 -0
  365. package/dist/helpers/create-query.js.map +9 -0
  366. package/dist/helpers/debounce.d.ts +39 -0
  367. package/dist/helpers/debounce.js +3 -0
  368. package/dist/helpers/debounce.js.map +9 -0
  369. package/dist/helpers/index.d.ts +5 -0
  370. package/dist/helpers/index.js +3 -0
  371. package/dist/helpers/index.js.map +9 -0
  372. package/dist/index.d.ts +24 -6
  373. package/dist/index.js +2 -716
  374. package/dist/index.js.map +3 -21
  375. package/dist/server/context-ssr.d.ts +27 -0
  376. package/dist/server/context-ssr.js +3 -0
  377. package/dist/server/context-ssr.js.map +9 -0
  378. package/dist/server/install-light-dom-shim.d.ts +1 -0
  379. package/dist/server/install-light-dom-shim.js +3 -0
  380. package/dist/server/install-light-dom-shim.js.map +10 -0
  381. package/dist/server/light-dom-shim.d.ts +53 -0
  382. package/dist/server/light-dom-shim.js +3 -0
  383. package/dist/server/light-dom-shim.js.map +9 -0
  384. package/dist/server/project-root.d.ts +20 -0
  385. package/dist/server/project-root.js +3 -0
  386. package/dist/server/project-root.js.map +11 -0
  387. package/dist/server/render-component.d.ts +195 -0
  388. package/dist/server/render-component.js +3 -0
  389. package/dist/server/render-component.js.map +10 -0
  390. package/dist/signals/host-resource.d.ts +59 -0
  391. package/dist/signals/host-resource.js +3 -0
  392. package/dist/signals/host-resource.js.map +10 -0
  393. package/dist/signals/host-signal.d.ts +45 -0
  394. package/dist/signals/host-signal.js +3 -0
  395. package/dist/signals/host-signal.js.map +9 -0
  396. package/dist/signals/hydration-script.d.ts +11 -0
  397. package/dist/signals/hydration-script.js +3 -0
  398. package/dist/signals/hydration-script.js.map +9 -0
  399. package/dist/tools/escape-script-json.d.ts +5 -0
  400. package/dist/tools/escape-script-json.js +3 -0
  401. package/dist/tools/escape-script-json.js.map +9 -0
  402. package/dist/tools/event-emitter.d.ts +1 -1
  403. package/dist/tools/event-emitter.js +2 -22
  404. package/dist/tools/event-emitter.js.map +3 -4
  405. package/dist/tools/index.d.ts +2 -0
  406. package/dist/tools/index.js +2 -28
  407. package/dist/tools/index.js.map +3 -5
  408. package/dist/tools/render-jsx-template.d.ts +5 -0
  409. package/dist/tools/render-jsx-template.js +3 -0
  410. package/dist/tools/render-jsx-template.js.map +9 -0
  411. package/dist/tools/stringify-typed.d.ts +4 -6
  412. package/dist/tools/stringify-typed.js +2 -8
  413. package/dist/tools/stringify-typed.js.map +3 -4
  414. package/dist/types.d.ts +79 -0
  415. package/dist/types.js +3 -0
  416. package/dist/types.js.map +10 -0
  417. package/dist/utils/attribute-utils.d.ts +2 -0
  418. package/dist/utils/attribute-utils.js +2 -137
  419. package/dist/utils/attribute-utils.js.map +3 -4
  420. package/dist/utils/index.js +2 -137
  421. package/dist/utils/index.js.map +3 -4
  422. package/package.json +108 -44
  423. package/size-budget.json +22 -0
  424. package/dist/context/index.d.ts +0 -7
  425. package/dist/context/index.js +0 -338
  426. package/dist/context/index.js.map +0 -16
  427. package/dist/core/index.d.ts +0 -1
  428. package/dist/core/index.js +0 -83
  429. package/dist/core/index.js.map +0 -10
  430. package/dist/decorators/reactive-field.js +0 -27
  431. package/dist/decorators/reactive-field.js.map +0 -10
  432. package/dist/decorators/reactive-prop.js +0 -215
  433. package/dist/decorators/reactive-prop.js.map +0 -11
  434. package/dist/decorators.d.ts +0 -7
  435. package/dist/decorators.js +0 -401
  436. package/dist/decorators.js.map +0 -18
  437. package/dist/mixins/index.d.ts +0 -1
  438. package/dist/mixins/index.js +0 -24
  439. package/dist/mixins/index.js.map +0 -10
  440. package/dist/mixins/with-kita.d.ts +0 -15
  441. package/dist/mixins/with-kita.js +0 -24
  442. package/dist/mixins/with-kita.js.map +0 -10
@@ -1,292 +1,3 @@
1
- // src/utils/attribute-utils.ts
2
- function parseAttributeTypeConstant(constant) {
3
- switch (constant) {
4
- case Array:
5
- return "array";
6
- case Boolean:
7
- return "boolean";
8
- case Number:
9
- return "number";
10
- case Object:
11
- return "object";
12
- case String:
13
- return "string";
14
- }
15
- }
16
- function parseAttributeTypeDefault(defaultValue) {
17
- switch (typeof defaultValue) {
18
- case "boolean":
19
- return "boolean";
20
- case "number":
21
- return "number";
22
- case "string":
23
- return "string";
24
- }
25
- if (Array.isArray(defaultValue))
26
- return "array";
27
- if (Object.prototype.toString.call(defaultValue) === "[object Object]")
28
- return "object";
29
- }
30
- function defaultValueForType(type) {
31
- switch (type) {
32
- case Number:
33
- return 0;
34
- case String:
35
- return "";
36
- case Boolean:
37
- return false;
38
- default:
39
- return null;
40
- }
41
- }
42
- function parseJSON(value) {
43
- try {
44
- return JSON.parse(value);
45
- } catch (error) {
46
- throw new TypeError("Invalid JSON string");
47
- }
48
- }
49
- function writeJSON(value) {
50
- return JSON.stringify(value);
51
- }
52
- function writeString(value) {
53
- return `${value}`;
54
- }
55
- function readAttributeValue(value, type) {
56
- const readerType = parseAttributeTypeConstant(type);
57
- if (!readerType)
58
- throw new TypeError(`[radiant-element] Unknown type "${type}"`);
59
- return readers[readerType](value);
60
- }
61
- function writeAttributeValue(value, type) {
62
- const writerType = parseAttributeTypeConstant(type);
63
- if (!writerType)
64
- throw new TypeError(`[radiant-element] Unknown type "${type}"`);
65
- return (writers[writerType] || writers.default)(value);
66
- }
67
- function isBoolean(value) {
68
- return typeof value === "boolean";
69
- }
70
- function isNumber(value) {
71
- return typeof value === "number";
72
- }
73
- function isString(value) {
74
- return typeof value === "string";
75
- }
76
- function isArray(value) {
77
- return Array.isArray(value);
78
- }
79
- function isObject(value) {
80
- return typeof value === "object" && !Array.isArray(value) && value !== null;
81
- }
82
- function isValueOfType(type, defaultValue) {
83
- switch (type) {
84
- case Boolean:
85
- return isBoolean(defaultValue);
86
- case Number:
87
- return isNumber(defaultValue);
88
- case String:
89
- return isString(defaultValue);
90
- case Array:
91
- return isArray(defaultValue);
92
- case Object:
93
- return isObject(defaultValue);
94
- default:
95
- return false;
96
- }
97
- }
98
- var readers = {
99
- array(value) {
100
- const array = parseJSON(value);
101
- if (!Array.isArray(array)) {
102
- throw new TypeError(`Expected an array but got a value of type "${typeof array}"`);
103
- }
104
- return array;
105
- },
106
- boolean(value) {
107
- return !(value === "0" || String(value).toLowerCase() === "false");
108
- },
109
- number(value) {
110
- const number = Number(value.replace(/_/g, ""));
111
- return number;
112
- },
113
- object(value) {
114
- const object = JSON.parse(value);
115
- if (object === null || typeof object !== "object" || Array.isArray(object)) {
116
- throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseAttributeTypeDefault(object)}"`);
117
- }
118
- return object;
119
- },
120
- string(value) {
121
- return value;
122
- }
123
- };
124
- var writers = {
125
- default: writeString,
126
- array: writeJSON,
127
- object: writeJSON
128
- };
1
+ import{j as a}from"../../chunk-147yvtsn.js";import"../../chunk-d0n7njdy.js";import"../../chunk-4srpf0y5.js";import"../../chunk-jg20mzg8.js";import"../../chunk-1w1dm68j.js";import"../../chunk-6kdxrppw.js";import"../../chunk-8tvt04cm.js";import"../../chunk-nerd6fmg.js";import"../../chunk-ksv01cey.js";import"../../chunk-8n2dhx28.js";import"../../chunk-8xy18qmz.js";export{a as provideContext};
129
2
 
130
- // src/context/events.ts
131
- var ContextEventsTypes;
132
- ((ContextEventsTypes2) => {
133
- ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
134
- ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
135
- ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
136
- })(ContextEventsTypes ||= {});
137
-
138
- class ContextRequestEvent extends Event {
139
- context;
140
- callback;
141
- subscribe;
142
- constructor(context, callback, subscribe) {
143
- super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
144
- this.context = context;
145
- this.callback = callback;
146
- this.subscribe = subscribe;
147
- }
148
- }
149
-
150
- class ContextOnMountEvent extends CustomEvent {
151
- constructor(context) {
152
- super("context--on-mount" /* ON_MOUNT */, {
153
- detail: { context },
154
- bubbles: true,
155
- composed: true
156
- });
157
- }
158
- }
159
-
160
- class ContextSubscriptionRequestEvent extends Event {
161
- context;
162
- callback;
163
- select;
164
- subscribe;
165
- constructor(context, callback, select, subscribe) {
166
- super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
167
- bubbles: true,
168
- composed: true
169
- });
170
- this.context = context;
171
- this.callback = callback;
172
- this.select = select;
173
- this.subscribe = subscribe;
174
- }
175
- }
176
-
177
- // src/context/context-provider.ts
178
- class ContextProvider {
179
- host;
180
- context;
181
- value;
182
- subscriptions = [];
183
- constructor(host, options) {
184
- this.host = host;
185
- this.context = options.context;
186
- let contextValue = options.initialValue;
187
- if (options.hydrate) {
188
- const hydrationScriptElement = this.host.querySelector("script[data-hydration]");
189
- if (hydrationScriptElement?.textContent) {
190
- const hydrationValue = hydrationScriptElement.textContent;
191
- const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate);
192
- if (options.hydrate === Object && this.isObject(parsedHydrationValue) && (this.isObject(contextValue) || typeof contextValue === "undefined")) {
193
- contextValue = {
194
- ...contextValue ?? {},
195
- ...parsedHydrationValue
196
- };
197
- } else {
198
- contextValue = parsedHydrationValue;
199
- }
200
- }
201
- }
202
- this.value = contextValue;
203
- this.registerEvents();
204
- this.host.dispatchEvent(new ContextOnMountEvent(this.context));
205
- }
206
- setContext = (update, callback) => {
207
- if (typeof this.value === "object") {
208
- const oldContext = { ...this.value };
209
- this.value = { ...this.value, ...update };
210
- if (callback)
211
- callback(this.value);
212
- this.notifySubscribers(this.value, oldContext);
213
- }
214
- };
215
- getContext = () => {
216
- return this.value;
217
- };
218
- subscribe = ({ select, callback }) => {
219
- this.subscriptions.push({ select, callback });
220
- };
221
- isObject(value) {
222
- return typeof value === "object" && !Array.isArray(value) && value !== null;
223
- }
224
- notifySubscribers = (newContext, prevContext) => {
225
- for (const sub of this.subscriptions) {
226
- if (!sub.select)
227
- return this.sendSubscriptionUpdate(sub, newContext);
228
- const newSelected = sub.select(newContext);
229
- const prevSelected = sub.select(prevContext);
230
- if (newSelected !== prevSelected) {
231
- this.sendSubscriptionUpdate(sub, newContext);
232
- }
233
- }
234
- };
235
- sendSubscriptionUpdate = ({ select, callback }, context) => {
236
- if (!select)
237
- callback(context);
238
- else
239
- callback(select(context));
240
- };
241
- handleSubscriptionRequest = ({
242
- select,
243
- callback,
244
- subscribe
245
- }) => {
246
- if (subscribe)
247
- this.subscribe({ select, callback });
248
- if (!this.value)
249
- return;
250
- if (select) {
251
- callback(select(this.value));
252
- } else {
253
- callback(this.value);
254
- }
255
- };
256
- onSubscriptionRequest = (event) => {
257
- const { context, callback, subscribe, select, target } = event;
258
- if (context !== this.context)
259
- return;
260
- event.stopPropagation();
261
- target.dispatchEvent(new ContextOnMountEvent(this.context));
262
- this.handleSubscriptionRequest({ select, callback, subscribe });
263
- };
264
- onContextRequest = (event) => {
265
- const { context, callback } = event;
266
- if (context !== this.context)
267
- return;
268
- event.stopPropagation();
269
- callback(this);
270
- };
271
- registerEvents = () => {
272
- this.host.addEventListener("context--subscription-request" /* SUBSCRIPTION_REQUEST */, this.onSubscriptionRequest);
273
- this.host.addEventListener("context-request" /* CONTEXT_REQUEST */, this.onContextRequest);
274
- };
275
- }
276
-
277
- // src/context/decorators/provide-context.ts
278
- function provideContext({ context, initialValue, hydrate }) {
279
- return (proto, propertyKey) => {
280
- const originalConnectedCallback = proto.connectedCallback;
281
- proto.connectedCallback = function() {
282
- originalConnectedCallback.call(this);
283
- this[propertyKey] = new ContextProvider(this, { context, initialValue, hydrate });
284
- this.connectedContextCallback(context);
285
- };
286
- };
287
- }
288
- export {
289
- provideContext
290
- };
291
-
292
- //# debugId=BE8FEAD4164CEEEB64756E2164756E21
3
+ //# debugId=8ED9BF853618769A64756E2164756E21
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/utils/attribute-utils.ts", "../src/context/events.ts", "../src/context/context-provider.ts", "../src/context/decorators/provide-context.ts"],
3
+ "sources": [],
4
4
  "sourcesContent": [
5
- "export 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 switch (constant) {\n case Array:\n return 'array';\n case Boolean:\n return 'boolean';\n case Number:\n return 'number';\n case Object:\n return 'object';\n case String:\n return 'string';\n }\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 switch (typeof defaultValue) {\n case 'boolean':\n return 'boolean';\n case 'number':\n return 'number';\n case 'string':\n return 'string';\n }\n\n if (Array.isArray(defaultValue)) return 'array';\n if (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 switch (type) {\n case Number:\n return 0;\n case String:\n return '';\n case Boolean:\n return false;\n default:\n return null;\n }\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 try {\n return JSON.parse(value);\n } catch (error) {\n throw new TypeError('Invalid JSON string');\n }\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n array(value: string): unknown[] {\n const array = parseJSON<unknown[]>(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n }\n return array;\n },\n\n boolean(value: string): boolean {\n return !(value === '0' || String(value).toLowerCase() === 'false');\n },\n\n number(value: string): number {\n const number = Number(value.replace(/_/g, ''));\n return number;\n },\n\n object(value: string): object {\n const object = JSON.parse(value);\n if (object === null || typeof object !== 'object' || Array.isArray(object)) {\n throw new TypeError(\n `expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n object,\n )}\"`,\n );\n }\n return object;\n },\n\n string(value: string): string {\n return value;\n },\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 default: writeString,\n array: writeJSON,\n object: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n return JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n return `${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 const readerType = parseAttributeTypeConstant(type);\n if (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n return 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 const writerType = parseAttributeTypeConstant(type);\n if (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n return (writers[writerType] || writers.default)(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 return typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n return typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n return Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n return 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 switch (type) {\n case Boolean:\n return isBoolean(defaultValue);\n case Number:\n return isNumber(defaultValue);\n case String:\n return isString(defaultValue);\n case Array:\n return isArray(defaultValue);\n case Object:\n return isObject(defaultValue);\n default:\n return false;\n }\n}\n",
6
- "import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n SUBSCRIPTION_REQUEST = 'context--subscription-request',\n CONTEXT_REQUEST = 'context-request',\n ON_MOUNT = 'context--on-mount',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: ContextCallback<ContextType<T>>,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n }\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\nexport type ContextSubscription<T extends UnknownContext> = {\n select?: (context: ContextType<T>) => unknown;\n callback: (value: unknown) => void;\n};\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n public constructor(context: UnknownContext) {\n super(ContextEventsTypes.ON_MOUNT, {\n detail: { context },\n bubbles: true,\n composed: true,\n });\n }\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: (value: ContextType<T> | { [K in keyof ContextType<T>]: ContextType<T>[K] }) => void,\n public readonly select?: (context: ContextType<T>) => unknown,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n bubbles: true,\n composed: true,\n });\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n /**\n * A 'context-request-subscription' event can be emitted by any element which desires\n * a context value to be injected by an external provider.\n */\n [ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n /**\n * A context-request-provider event can be emitted by a context requester to signal\n * that it desires a context value to be provided by a context provider.\n */\n [ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n /**\n * A 'context-mount' event can be emitted by a context provider to signal\n * that a context value has been mounted and is available for consumption.\n */\n [ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n }\n}\n",
7
- "import type { RadiantElement } from '@/core/radiant-element';\nimport { type AttributeTypeConstant, readAttributeValue } from '@/utils/attribute-utils';\nimport { query } from '..';\nimport {\n ContextEventsTypes,\n ContextOnMountEvent,\n type ContextRequestEvent,\n type ContextSubscription,\n type ContextSubscriptionRequestEvent,\n} from './events';\nimport type { Context, ContextType, UnknownContext } from './types';\n\ntype ContextProviderOptions<T extends UnknownContext> = {\n context: UnknownContext;\n initialValue?: T['__context__'];\n hydrate?: AttributeTypeConstant;\n};\n\n/**\n * Represents a context provider that allows setting and getting the context,\n * as well as subscribing to context updates.\n *\n * @template T - The type of the context.\n */\nexport interface IContextProvider<T extends Context<unknown, unknown>> {\n /**\n * Sets the context with the provided update and invokes the optional callback function.\n *\n * @param update - The partial update to be applied to the context.\n * @param callback - An optional callback function that receives the updated context.\n */\n setContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;\n\n /**\n * Gets the current context.\n *\n * @returns The current context.\n */\n getContext: () => ContextType<T>;\n\n /**\n * Subscribes to context updates.\n *\n * @param subscription - The subscription object that defines the callback function to be invoked on context updates.\n */\n subscribe: (subscription: ContextSubscription<T>) => void;\n}\n\n/**\n * It creates a context provider that allows setting and getting the context,\n * It will also be in charge of notifying the subscribers when the context changes.\n *\n * @template T - The type of the context.\n * @implements IContextProvider\n *\n * @example\n * ```ts\n * export class MyElement extends RadiantElement {\n * provider = new ContextProvider<typeof myContext>(this, {\n * context: myContext,\n * initialValue: {\n * value: 'Hello World',\n * },\n * });\n * ```\n */\nexport class ContextProvider<T extends Context<unknown, unknown>> implements IContextProvider<T> {\n private host: RadiantElement;\n private context: UnknownContext;\n private value: ContextType<T> | undefined;\n\n subscriptions: ContextSubscription<T>[] = [];\n\n /**\n * Creates a new instance of the ContextProvider.\n *\n * @param host - The host element that will contain the context provider.\n * @param options - The options to configure the context provider.\n */\n constructor(host: RadiantElement, options: ContextProviderOptions<T>) {\n this.host = host;\n this.context = options.context;\n let contextValue: T['__context__'] | undefined = options.initialValue;\n\n if (options.hydrate) {\n const hydrationScriptElement = this.host.querySelector('script[data-hydration]');\n if (hydrationScriptElement?.textContent) {\n const hydrationValue = hydrationScriptElement.textContent;\n const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate) as ContextType<T>;\n\n if (\n options.hydrate === Object &&\n this.isObject(parsedHydrationValue) &&\n (this.isObject(contextValue) || typeof contextValue === 'undefined')\n ) {\n contextValue = {\n ...(contextValue ?? {}),\n ...parsedHydrationValue,\n };\n } else {\n contextValue = parsedHydrationValue;\n }\n }\n }\n\n this.value = contextValue as ContextType<T>;\n\n this.registerEvents();\n this.host.dispatchEvent(new ContextOnMountEvent(this.context));\n }\n\n setContext = (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => {\n if (typeof this.value === 'object') {\n const oldContext = { ...this.value };\n this.value = { ...this.value, ...update };\n if (callback) callback(this.value);\n this.notifySubscribers(this.value, oldContext);\n }\n };\n\n getContext = () => {\n return this.value as ContextType<T>;\n };\n\n subscribe = ({ select, callback }: ContextSubscription<T>) => {\n this.subscriptions.push({ select, callback });\n };\n\n private isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n }\n\n private notifySubscribers = (newContext: ContextType<T>, prevContext: ContextType<T>) => {\n for (const sub of this.subscriptions) {\n if (!sub.select) return this.sendSubscriptionUpdate(sub, newContext);\n const newSelected = sub.select(newContext);\n const prevSelected = sub.select(prevContext);\n if (newSelected !== prevSelected) {\n this.sendSubscriptionUpdate(sub, newContext);\n }\n }\n };\n\n private sendSubscriptionUpdate = ({ select, callback }: ContextSubscription<T>, context: ContextType<T>) => {\n if (!select) callback(context);\n else callback(select(context));\n };\n\n private handleSubscriptionRequest = ({\n select,\n callback,\n subscribe,\n }: {\n select?: ContextSubscription<T>['select'];\n callback: ContextSubscription<T>['callback'];\n subscribe?: boolean;\n }) => {\n if (subscribe) this.subscribe({ select, callback });\n\n if (!this.value) return;\n\n if (select) {\n callback(select(this.value));\n } else {\n callback(this.value as ContextType<T>);\n }\n };\n\n private onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n const { context, callback, subscribe, select, target } = event;\n if (context !== this.context) return;\n\n event.stopPropagation();\n\n (target as HTMLElement).dispatchEvent(new ContextOnMountEvent(this.context));\n\n this.handleSubscriptionRequest({ select, callback, subscribe });\n };\n\n private onContextRequest = (event: ContextRequestEvent<UnknownContext>) => {\n const { context, callback } = event;\n if (context !== this.context) return;\n event.stopPropagation();\n callback(this);\n };\n\n private registerEvents = () => {\n this.host.addEventListener(ContextEventsTypes.SUBSCRIPTION_REQUEST, this.onSubscriptionRequest);\n this.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.onContextRequest);\n };\n}\n",
8
- "import { ContextProvider } from '@/context/context-provider';\nimport type { UnknownContext } from '@/context/types';\nimport type { RadiantElement } from '@/core/radiant-element';\nimport type { AttributeTypeConstant } from '@/utils/attribute-utils';\n\ntype CreateContextOptions<T extends UnknownContext> = {\n context: T;\n initialValue?: T['__context__'];\n hydrate?: AttributeTypeConstant;\n};\n\n/**\n * A decorator to provide a context to the target element.\n * @param contextToProvide\n * @returns\n */\nexport function provideContext<T extends UnknownContext>({ context, initialValue, hydrate }: CreateContextOptions<T>) {\n return (proto: RadiantElement, propertyKey: string) => {\n const originalConnectedCallback = proto.connectedCallback;\n\n proto.connectedCallback = function (this: RadiantElement) {\n originalConnectedCallback.call(this);\n (this as any)[propertyKey] = new ContextProvider<T>(this, { context, initialValue, hydrate });\n this.connectedContextCallback(context);\n };\n };\n}\n"
9
5
  ],
10
- "mappings": ";AAUO,SAAS,0BAA0B,CAAC,UAAkC;AAC3E,UAAQ;AAAA,SACD;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA;AAAA;AAUN,SAAS,yBAAyB,CAAC,cAAqC;AAC7E,iBAAe;AAAA,SACR;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA;AAGX,MAAI,MAAM,QAAQ,YAAY;AAAG,WAAO;AACxC,MAAI,OAAO,UAAU,SAAS,KAAK,YAAY,MAAM;AAAmB,WAAO;AAAA;AAS1E,SAAS,mBAAmB,CAAC,MAAsC;AACxE,UAAQ;AAAA,SACD;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA;AAEP,aAAO;AAAA;AAAA;AASb,SAAS,SAAY,CAAC,OAAkB;AACtC,MAAI;AACF,WAAO,KAAK,MAAM,KAAK;AAAA,WAChB,OAAP;AACA,UAAM,IAAI,UAAU,qBAAqB;AAAA;AAAA;AAuD7C,SAAS,SAAS,CAAC,OAAgB;AACjC,SAAO,KAAK,UAAU,KAAK;AAAA;AAG7B,S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D,gCAA0B,KAAK,IAAI;AACnC,MAAC,KAAa,eAAe,IAAI,gBAAmB,MAAM,EAAE,SAAS,cAAc,QAAQ,CAAC;AAC5F,WAAK,yBAAyB,OAAO;AAAA;AAAA;AAAA;",
11
- "debugId": "BE8FEAD4164CEEEB64756E2164756E21",
6
+ "mappings": "",
7
+ "debugId": "8ED9BF853618769A64756E2164756E21",
12
8
  "names": []
13
9
  }
@@ -0,0 +1,3 @@
1
+ import type { RadiantElement } from '../../../core/radiant-element';
2
+ import type { UnknownContext } from '../../types';
3
+ export declare function consumeContext(consumedContext: UnknownContext): <T extends RadiantElement, V>(_: undefined, context: ClassFieldDecoratorContext<T, V>) => void;
@@ -0,0 +1,3 @@
1
+ import{l as a}from"../../../chunk-hkmm3dj9.js";import"../../../chunk-vpfm9yw8.js";import"../../../chunk-s4qgct1z.js";import"../../../chunk-1w1dm68j.js";import"../../../chunk-9gjmqxp2.js";import"../../../chunk-4cc2syf5.js";import"../../../chunk-8xy18qmz.js";export{a as consumeContext};
2
+
3
+ //# debugId=08F0647FF1FC718B64756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "08F0647FF1FC718B64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,8 @@
1
+ import type { RadiantElement } from '../../../core/radiant-element';
2
+ import type { Context, ContextType } from '../../types';
3
+ export type ContextSelectorFieldOptions<T extends Context<unknown, unknown>, Selected = ContextType<T>> = {
4
+ context: T;
5
+ select?: (context: ContextType<T>) => Selected;
6
+ subscribe?: boolean;
7
+ };
8
+ export declare function contextSelectorField<T extends Context<unknown, unknown>, Selected = ContextType<T>>(options: ContextSelectorFieldOptions<T, Selected>): <Host extends RadiantElement>(_: undefined, fieldContext: ClassFieldDecoratorContext<Host, Selected>) => (this: Host, initialValue: Selected) => Selected;
@@ -0,0 +1,3 @@
1
+ import{m as a}from"../../../chunk-chyn72n9.js";import"../../../chunk-5td6v9k3.js";import"../../../chunk-vpfm9yw8.js";import"../../../chunk-s4qgct1z.js";import"../../../chunk-1w1dm68j.js";import"../../../chunk-9gjmqxp2.js";import"../../../chunk-4cc2syf5.js";import"../../../chunk-8xy18qmz.js";export{a as contextSelectorField};
2
+
3
+ //# debugId=E814C6039CFD693C64756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "E814C6039CFD693C64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,5 @@
1
+ import type { Method } from '../../../types';
2
+ import type { RadiantElement } from '../../../core/radiant-element';
3
+ import type { Context, ContextType } from '../../types';
4
+ import type { OnContextUpdateOptions } from '../on-context-update';
5
+ export declare function contextSelector<T extends Context<unknown, unknown>, Selected = ContextType<T>>({ context, select, subscribe, requestUpdate, }: OnContextUpdateOptions<T, Selected>): <Host extends RadiantElement, TMethod extends Method>(originalMethod: TMethod, targetContext: ClassMethodDecoratorContext<Host, TMethod>) => void;
@@ -0,0 +1,3 @@
1
+ import{s as a}from"../../../chunk-qaagk55a.js";import"../../../chunk-5td6v9k3.js";import"../../../chunk-vpfm9yw8.js";import"../../../chunk-s4qgct1z.js";import"../../../chunk-1w1dm68j.js";import"../../../chunk-9gjmqxp2.js";import"../../../chunk-4cc2syf5.js";import"../../../chunk-8xy18qmz.js";export{a as contextSelector};
2
+
3
+ //# debugId=BA0B5A74478EA67E64756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "BA0B5A74478EA67E64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,4 @@
1
+ import type { RadiantElement } from '../../../core/radiant-element';
2
+ import type { UnknownContext } from '../../types';
3
+ import type { ProvideContextOptions } from '../provide-context';
4
+ export declare function provideContext<T extends UnknownContext>({ context, initialValue, hydrate, serialize, }: ProvideContextOptions<T>): <C extends RadiantElement, V>(_: undefined, targetContext: ClassFieldDecoratorContext<C, V>) => void;
@@ -0,0 +1,3 @@
1
+ import{n as a}from"../../../chunk-4srpf0y5.js";import"../../../chunk-jg20mzg8.js";import"../../../chunk-1w1dm68j.js";import"../../../chunk-6kdxrppw.js";import"../../../chunk-ksv01cey.js";import"../../../chunk-8n2dhx28.js";import"../../../chunk-8xy18qmz.js";export{a as provideContext};
2
+
3
+ //# debugId=C51D0E8422BFEA3264756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "C51D0E8422BFEA3264756E2164756E21",
8
+ "names": []
9
+ }
@@ -3,9 +3,10 @@ import type { Context, ContextCallback, ContextType, UnknownContext } from './ty
3
3
  * List of events which can be emitted by a context provider or requester.
4
4
  */
5
5
  export declare enum ContextEventsTypes {
6
- SUBSCRIPTION_REQUEST = "context--subscription-request",
6
+ SUBSCRIPTION_REQUEST = "context-subscription-request",
7
7
  CONTEXT_REQUEST = "context-request",
8
- ON_MOUNT = "context--on-mount"
8
+ ON_MOUNT = "context-on-mount",
9
+ MOUNTED = "context-mounted"
9
10
  }
10
11
  /**
11
12
  * An event fired by a context requester to signal it desires a named context.
@@ -1,54 +1,3 @@
1
- // src/context/events.ts
2
- var ContextEventsTypes;
3
- ((ContextEventsTypes2) => {
4
- ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
5
- ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
6
- ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
7
- })(ContextEventsTypes ||= {});
1
+ import{C as a,D as b,E as c,F as d}from"../chunk-1w1dm68j.js";import"../chunk-8xy18qmz.js";export{d as ContextSubscriptionRequestEvent,b as ContextRequestEvent,c as ContextOnMountEvent,a as ContextEventsTypes};
8
2
 
9
- class ContextRequestEvent extends Event {
10
- context;
11
- callback;
12
- subscribe;
13
- constructor(context, callback, subscribe) {
14
- super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
15
- this.context = context;
16
- this.callback = callback;
17
- this.subscribe = subscribe;
18
- }
19
- }
20
-
21
- class ContextOnMountEvent extends CustomEvent {
22
- constructor(context) {
23
- super("context--on-mount" /* ON_MOUNT */, {
24
- detail: { context },
25
- bubbles: true,
26
- composed: true
27
- });
28
- }
29
- }
30
-
31
- class ContextSubscriptionRequestEvent extends Event {
32
- context;
33
- callback;
34
- select;
35
- subscribe;
36
- constructor(context, callback, select, subscribe) {
37
- super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
38
- bubbles: true,
39
- composed: true
40
- });
41
- this.context = context;
42
- this.callback = callback;
43
- this.select = select;
44
- this.subscribe = subscribe;
45
- }
46
- }
47
- export {
48
- ContextSubscriptionRequestEvent,
49
- ContextRequestEvent,
50
- ContextOnMountEvent,
51
- ContextEventsTypes
52
- };
53
-
54
- //# debugId=85CDB913AD2268D764756E2164756E21
3
+ //# debugId=56C1E59567ECA83164756E2164756E21
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/context/events.ts"],
3
+ "sources": [],
4
4
  "sourcesContent": [
5
- "import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n SUBSCRIPTION_REQUEST = 'context--subscription-request',\n CONTEXT_REQUEST = 'context-request',\n ON_MOUNT = 'context--on-mount',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: ContextCallback<ContextType<T>>,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n }\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\nexport type ContextSubscription<T extends UnknownContext> = {\n select?: (context: ContextType<T>) => unknown;\n callback: (value: unknown) => void;\n};\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n public constructor(context: UnknownContext) {\n super(ContextEventsTypes.ON_MOUNT, {\n detail: { context },\n bubbles: true,\n composed: true,\n });\n }\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: (value: ContextType<T> | { [K in keyof ContextType<T>]: ContextType<T>[K] }) => void,\n public readonly select?: (context: ContextType<T>) => unknown,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n bubbles: true,\n composed: true,\n });\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n /**\n * A 'context-request-subscription' event can be emitted by any element which desires\n * a context value to be injected by an external provider.\n */\n [ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n /**\n * A context-request-provider event can be emitted by a context requester to signal\n * that it desires a context value to be provided by a context provider.\n */\n [ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n /**\n * A 'context-mount' event can be emitted by a context provider to signal\n * that a context value has been mounted and is available for consumption.\n */\n [ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n }\n}\n"
6
5
  ],
7
- "mappings": ";AAKO,IAAK;AAAL,EAAK,wBAAL;AACL,gDAAuB;AACvB,2CAAkB;AAClB,oCAAW;AAAA,GAHD;AAgBL;AAAA,MAAM,4BAAsD,MAAM;AAAA,EAErD;AAAA,EACA;AAAA,EACA;AAAA,EAHX,WAAW,CACA,SACA,UACA,WAChB;AACA,UAAM,yCAAoC,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAJ3D;AACA;AACA;AAAA;AAIpB;AAaO;AAAA,MAAM,4BAA4B,YAAyC;AAAA,EACzE,WAAW,CAAC,SAAyB;AAC1C,UAAM,oCAA6B;AAAA,MACjC,QAAQ,EAAE,QAAQ;AAAA,MAClB,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,CAAC;AAAA;AAEL;AAcO;AAAA,MAAM,wCAAkE,MAAM;AAAA,EAEjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAJX,WAAW,CACA,SACA,UACA,QACA,WAChB;AACA,UAAM,4DAAyC;AAAA,MAC7C,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,CAAC;AARe;AACA;AACA;AACA;AAAA;AAOpB;",
8
- "debugId": "85CDB913AD2268D764756E2164756E21",
6
+ "mappings": "",
7
+ "debugId": "56C1E59567ECA83164756E2164756E21",
9
8
  "names": []
10
9
  }
@@ -0,0 +1,17 @@
1
+ /** @deprecated Use `HYDRATION_ATTRIBUTE` from `hydration-codec` instead. */
2
+ export declare const CONTEXT_HYDRATION_ATTRIBUTE = "data-hydration";
3
+ /** @deprecated Use `HYDRATION_KEY_ATTRIBUTE` from `hydration-codec` instead. */
4
+ export declare const CONTEXT_HYDRATION_KEY_ATTRIBUTE = "data-hydration-key";
5
+ /**
6
+ * Creates the raw `<script type="application/json">` tag used to hydrate a
7
+ * serialized context provider.
8
+ */
9
+ export declare function createContextHydrationScriptTag(options: {
10
+ hydrationKey?: string;
11
+ serializedValue: string;
12
+ }): string;
13
+ /**
14
+ * Escapes serialized JSON so it remains safe when embedded inside an HTML
15
+ * script tag.
16
+ */
17
+ export declare function escapeContextHydrationJson(value: string): string;
@@ -0,0 +1,3 @@
1
+ import{T as a,U as b,V as c,W as d}from"../chunk-6kdxrppw.js";import"../chunk-ksv01cey.js";import"../chunk-8n2dhx28.js";import"../chunk-8xy18qmz.js";export{d as escapeContextHydrationJson,c as createContextHydrationScriptTag,b as CONTEXT_HYDRATION_KEY_ATTRIBUTE,a as CONTEXT_HYDRATION_ATTRIBUTE};
2
+
3
+ //# debugId=5CA2574D57006D2964756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "5CA2574D57006D2964756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,3 @@
1
+ export declare const CUSTOM_ELEMENT_TAG_NAME: unique symbol;
2
+ export declare function setCustomElementTagName(target: CustomElementConstructor, tagName: string): void;
3
+ export declare function getCustomElementTagName(target: CustomElementConstructor): string | undefined;
@@ -0,0 +1,3 @@
1
+ import{Wa as a,Xa as b,Ya as c}from"../chunk-ms6a9zdt.js";import"../chunk-8xy18qmz.js";export{b as setCustomElementTagName,c as getCustomElementTagName,a as CUSTOM_ELEMENT_TAG_NAME};
2
+
3
+ //# debugId=1802C65B35438D8C64756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "1802C65B35438D8C64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,24 @@
1
+ /** Attribute marker used to identify hydration payloads inside a host. */
2
+ export declare const HYDRATION_ATTRIBUTE = "data-hydration";
3
+ /** Discriminator that scopes a hydration payload to a specific feature. */
4
+ export declare const HYDRATION_TYPE_ATTRIBUTE = "data-hydration-type";
5
+ /** Optional key that scopes a hydration payload to a specific decorated field. */
6
+ export declare const HYDRATION_KEY_ATTRIBUTE = "data-hydration-key";
7
+ export type HydrationPayloadType = 'signal' | 'context';
8
+ /** Creates a `<script type="application/json">` tag for a hydration payload. */
9
+ export declare function createHydrationScriptTag(options: {
10
+ type: HydrationPayloadType;
11
+ hydrationKey?: string;
12
+ serializedValue: string;
13
+ }): string;
14
+ /** Escapes serialized JSON so it remains safe inside an HTML script tag. */
15
+ export declare function escapeHydrationJson(value: string): string;
16
+ /** Parses JSON from a hydration script element, returning the fallback on failure. */
17
+ export declare function parseHydrationPayload<T>(element: Element, fallback: T): T;
18
+ /**
19
+ * Finds a hydration script element inside a host by type and optional key.
20
+ *
21
+ * When a key is provided, looks for an exact `data-hydration-key` match.
22
+ * Otherwise, returns the first unkeyed script matching the type.
23
+ */
24
+ export declare function findHydrationScript(host: Element, type: HydrationPayloadType, hydrationKey?: string): Element | null;
@@ -0,0 +1,3 @@
1
+ import{gb as a,hb as b,ib as c,jb as d,kb as e,lb as f,mb as g}from"../chunk-ksv01cey.js";import"../chunk-8n2dhx28.js";import"../chunk-8xy18qmz.js";export{f as parseHydrationPayload,g as findHydrationScript,e as escapeHydrationJson,d as createHydrationScriptTag,b as HYDRATION_TYPE_ATTRIBUTE,c as HYDRATION_KEY_ATTRIBUTE,a as HYDRATION_ATTRIBUTE};
2
+
3
+ //# debugId=75E5841D1A59F47064756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "75E5841D1A59F47064756E2164756E21",
8
+ "names": []
9
+ }