@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
package/dist/index.js CHANGED
@@ -1,717 +1,3 @@
1
- // src/decorators/custom-element.ts
2
- function customElement(name) {
3
- return (target) => {
4
- if (!globalThis.window)
5
- return;
6
- if (!window.customElements.get(name)) {
7
- window.customElements.define(name, target);
8
- }
9
- };
10
- }
1
+ import{f as p}from"./chunk-r1cvaz1t.js";import"./chunk-par0t822.js";import{h as n}from"./chunk-d7hh3ze6.js";import"./chunk-agjb2a3r.js";import{j as o}from"./chunk-147yvtsn.js";import"./chunk-d0n7njdy.js";import"./chunk-hkmm3dj9.js";import"./chunk-chyn72n9.js";import"./chunk-4srpf0y5.js";import{o as h}from"./chunk-jg20mzg8.js";import{p as a}from"./chunk-zb7wh7w4.js";import{q as l}from"./chunk-ak97hp4w.js";import"./chunk-d98q3myg.js";import"./chunk-qaagk55a.js";import"./chunk-5td6v9k3.js";import"./chunk-vpfm9yw8.js";import"./chunk-s4qgct1z.js";import"./chunk-1w1dm68j.js";import{G as S}from"./chunk-17earqbr.js";import{H as R}from"./chunk-84fc8cz9.js";import"./chunk-9ascmjk3.js";import{S as T}from"./chunk-mpjnqmbq.js";import"./chunk-6kdxrppw.js";import"./chunk-9554n9t4.js";import{Y as x}from"./chunk-0y78f8hj.js";import"./chunk-5bym7y1d.js";import"./chunk-9gjmqxp2.js";import"./chunk-bmhn4nbp.js";import{ca as d}from"./chunk-p6pxdvkk.js";import"./chunk-x0522ksh.js";import"./chunk-dscj0sk9.js";import"./chunk-8dexhy6c.js";import{ha as q}from"./chunk-2tgrfv09.js";import"./chunk-qe6sjr27.js";import"./chunk-scfk041e.js";import{ka as y}from"./chunk-c8vqg7r1.js";import"./chunk-t6x9e177.js";import"./chunk-5a2xez36.js";import{na as Y}from"./chunk-r75y7ydb.js";import"./chunk-a7hzs37s.js";import"./chunk-k5hr781q.js";import"./chunk-57w3vmme.js";import{ta as v}from"./chunk-4fqkmpra.js";import"./chunk-t7a1bbxq.js";import"./chunk-paehjz94.js";import{wa as U}from"./chunk-w50v38rv.js";import"./chunk-cbvd18v1.js";import"./chunk-xd1xn3vy.js";import{za as W}from"./chunk-mqxmfvyp.js";import"./chunk-hn4j8rt5.js";import"./chunk-8vak8w5w.js";import{Ca as $}from"./chunk-0zq7e1ne.js";import"./chunk-tyysm4gk.js";import"./chunk-qdj6r8jn.js";import{Fa as V}from"./chunk-60015zxq.js";import"./chunk-60q4y3k5.js";import"./chunk-zj9ez73m.js";import{Ia as _}from"./chunk-d4v5qpxa.js";import"./chunk-3b033cgq.js";import"./chunk-aajhkdmn.js";import"./chunk-8tvt04cm.js";import"./chunk-nerd6fmg.js";import"./chunk-73x7jpdd.js";import"./chunk-ms6a9zdt.js";import"./chunk-dx1wqc00.js";import"./chunk-4cc2syf5.js";import"./chunk-6z34stya.js";import"./chunk-ksv01cey.js";import"./chunk-8n2dhx28.js";import{ob as X}from"./chunk-42tyhfvh.js";import"./chunk-qbnedp0y.js";import"./chunk-13ydx769.js";import{rb as u}from"./chunk-qd28hvdx.js";import{sb as i}from"./chunk-g0gz7ypq.js";import{tb as Z}from"./chunk-nw171z6m.js";import"./chunk-8xy18qmz.js";export{v as state,y as signal,x as querySlot,q as query,o as provideContext,d as prop,$ as onUpdated,_ as onEvent,l as onContextUpdate,Y as event,W as debounce,V as customElement,u as createQuerySlot,i as createQuery,Z as createEventListener,X as createEvent,a as createContext,p as contextSelector,n as consumeContext,U as bound,T as bindReactiveValue,R as RadiantElement,S as RadiantComponent,h as ContextProvider};
11
2
 
12
- // src/tools/event-emitter.ts
13
- class EventEmitter {
14
- host;
15
- eventConfig;
16
- constructor(host, eventConfig) {
17
- this.host = host;
18
- this.eventConfig = eventConfig;
19
- }
20
- emit(detail) {
21
- const event = new CustomEvent(this.eventConfig.name, {
22
- detail,
23
- bubbles: this.eventConfig.bubbles,
24
- cancelable: this.eventConfig.cancelable,
25
- composed: this.eventConfig.composed
26
- });
27
- this.host.dispatchEvent(event);
28
- }
29
- }
30
-
31
- // src/decorators/event.ts
32
- function event(eventConfig) {
33
- return (target, propertyKey) => {
34
- if (!propertyKey) {
35
- throw new Error("The propertyKey is missing for the event decorator.");
36
- }
37
- if (!eventConfig || !eventConfig.name) {
38
- throw new Error("Invalid eventConfig provided.");
39
- }
40
- const uniqueKey = Symbol(eventConfig.name);
41
- Object.defineProperty(target, propertyKey, {
42
- get() {
43
- const emittersMap = eventEmitters.get(this) || new Map;
44
- if (!emittersMap.has(uniqueKey)) {
45
- emittersMap.set(uniqueKey, new EventEmitter(this, eventConfig));
46
- eventEmitters.set(this, emittersMap);
47
- }
48
- return emittersMap.get(uniqueKey);
49
- }
50
- });
51
- };
52
- }
53
- var eventEmitters = new WeakMap;
54
-
55
- // src/decorators/on-event.ts
56
- function onEvent(eventConfig) {
57
- return (proto, _, descriptor) => {
58
- const originalConnectedCallback = proto.connectedCallback;
59
- const originalDisconnectedCallback = proto.disconnectedCallback;
60
- if ("window" in eventConfig) {
61
- proto.connectedCallback = function() {
62
- window.addEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
63
- originalConnectedCallback.call(this);
64
- };
65
- proto.disconnectedCallback = function() {
66
- window.removeEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
67
- originalDisconnectedCallback.call(this);
68
- };
69
- return descriptor;
70
- }
71
- if ("document" in eventConfig) {
72
- proto.connectedCallback = function() {
73
- document.addEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
74
- originalConnectedCallback.call(this);
75
- };
76
- proto.disconnectedCallback = function() {
77
- document.removeEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
78
- originalDisconnectedCallback.call(this);
79
- };
80
- return descriptor;
81
- }
82
- const selector = "selector" in eventConfig ? eventConfig.selector : `[data-ref="${eventConfig.ref}"]`;
83
- const originalMethod = descriptor.value;
84
- const subscriptionId = `${eventConfig.type}-${selector}`;
85
- proto.connectedCallback = function() {
86
- this.subscribeEvent({
87
- id: subscriptionId,
88
- selector,
89
- type: eventConfig.type,
90
- listener: originalMethod.bind(this),
91
- options: eventConfig?.options ?? undefined
92
- });
93
- originalConnectedCallback.call(this);
94
- };
95
- return descriptor;
96
- };
97
- }
98
-
99
- // src/decorators/on-updated.ts
100
- function onUpdated(keyOrKeys) {
101
- return (proto, methodName) => {
102
- if (!("updatesRegistry" in proto)) {
103
- Object.defineProperty(proto, "updatesRegistry", {
104
- value: new Map,
105
- configurable: true
106
- });
107
- }
108
- const updatesRegistry = proto.updatesRegistry;
109
- if (Array.isArray(keyOrKeys)) {
110
- for (const key of keyOrKeys) {
111
- if (!updatesRegistry.has(key)) {
112
- updatesRegistry.set(key, new Set);
113
- }
114
- updatesRegistry.get(key)?.add(methodName);
115
- }
116
- } else if (typeof keyOrKeys === "string") {
117
- if (!updatesRegistry.has(keyOrKeys)) {
118
- updatesRegistry.set(keyOrKeys, new Set);
119
- }
120
- updatesRegistry.get(keyOrKeys)?.add(methodName);
121
- }
122
- };
123
- }
124
-
125
- // src/decorators/query.ts
126
- function query({
127
- cache: shouldBeCached = true,
128
- ...options
129
- }) {
130
- const cache = new WeakMap;
131
- return (proto, propertyKey) => {
132
- const doQuery = function() {
133
- if (shouldBeCached) {
134
- const cachedResult = cache.get(this);
135
- if (cachedResult !== undefined) {
136
- return cachedResult;
137
- }
138
- }
139
- const selector = "selector" in options ? options.selector : `[data-ref="${options.ref}"]`;
140
- const queryResult = options.all ? this.querySelectorAll(selector) : this.querySelector(selector);
141
- if (shouldBeCached) {
142
- cache.set(this, queryResult);
143
- }
144
- return queryResult;
145
- };
146
- const originalConnectedCallback = proto.connectedCallback;
147
- proto.connectedCallback = function() {
148
- Object.defineProperty(this, propertyKey, {
149
- get: doQuery,
150
- enumerable: true,
151
- configurable: true
152
- });
153
- originalConnectedCallback.call(this);
154
- };
155
- };
156
- }
157
-
158
- // src/utils/attribute-utils.ts
159
- function parseAttributeTypeConstant(constant) {
160
- switch (constant) {
161
- case Array:
162
- return "array";
163
- case Boolean:
164
- return "boolean";
165
- case Number:
166
- return "number";
167
- case Object:
168
- return "object";
169
- case String:
170
- return "string";
171
- }
172
- }
173
- function parseAttributeTypeDefault(defaultValue) {
174
- switch (typeof defaultValue) {
175
- case "boolean":
176
- return "boolean";
177
- case "number":
178
- return "number";
179
- case "string":
180
- return "string";
181
- }
182
- if (Array.isArray(defaultValue))
183
- return "array";
184
- if (Object.prototype.toString.call(defaultValue) === "[object Object]")
185
- return "object";
186
- }
187
- function defaultValueForType(type) {
188
- switch (type) {
189
- case Number:
190
- return 0;
191
- case String:
192
- return "";
193
- case Boolean:
194
- return false;
195
- default:
196
- return null;
197
- }
198
- }
199
- function parseJSON(value) {
200
- try {
201
- return JSON.parse(value);
202
- } catch (error) {
203
- throw new TypeError("Invalid JSON string");
204
- }
205
- }
206
- function writeJSON(value) {
207
- return JSON.stringify(value);
208
- }
209
- function writeString(value) {
210
- return `${value}`;
211
- }
212
- function readAttributeValue(value, type) {
213
- const readerType = parseAttributeTypeConstant(type);
214
- if (!readerType)
215
- throw new TypeError(`[radiant-element] Unknown type "${type}"`);
216
- return readers[readerType](value);
217
- }
218
- function writeAttributeValue(value, type) {
219
- const writerType = parseAttributeTypeConstant(type);
220
- if (!writerType)
221
- throw new TypeError(`[radiant-element] Unknown type "${type}"`);
222
- return (writers[writerType] || writers.default)(value);
223
- }
224
- function isBoolean(value) {
225
- return typeof value === "boolean";
226
- }
227
- function isNumber(value) {
228
- return typeof value === "number";
229
- }
230
- function isString(value) {
231
- return typeof value === "string";
232
- }
233
- function isArray(value) {
234
- return Array.isArray(value);
235
- }
236
- function isObject(value) {
237
- return typeof value === "object" && !Array.isArray(value) && value !== null;
238
- }
239
- function isValueOfType(type, defaultValue) {
240
- switch (type) {
241
- case Boolean:
242
- return isBoolean(defaultValue);
243
- case Number:
244
- return isNumber(defaultValue);
245
- case String:
246
- return isString(defaultValue);
247
- case Array:
248
- return isArray(defaultValue);
249
- case Object:
250
- return isObject(defaultValue);
251
- default:
252
- return false;
253
- }
254
- }
255
- var readers = {
256
- array(value) {
257
- const array = parseJSON(value);
258
- if (!Array.isArray(array)) {
259
- throw new TypeError(`Expected an array but got a value of type "${typeof array}"`);
260
- }
261
- return array;
262
- },
263
- boolean(value) {
264
- return !(value === "0" || String(value).toLowerCase() === "false");
265
- },
266
- number(value) {
267
- const number = Number(value.replace(/_/g, ""));
268
- return number;
269
- },
270
- object(value) {
271
- const object = JSON.parse(value);
272
- if (object === null || typeof object !== "object" || Array.isArray(object)) {
273
- throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseAttributeTypeDefault(object)}"`);
274
- }
275
- return object;
276
- },
277
- string(value) {
278
- return value;
279
- }
280
- };
281
- var writers = {
282
- default: writeString,
283
- array: writeJSON,
284
- object: writeJSON
285
- };
286
-
287
- // src/decorators/reactive-prop.ts
288
- function reactiveProp({ type, attribute, reflect, defaultValue }) {
289
- if (defaultValue !== undefined && !isValueOfType(type, defaultValue)) {
290
- throw new Error(`defaultValue does not match the expected type for ${type.name}`);
291
- }
292
- return (target, propertyName) => {
293
- const originalValues = new WeakMap;
294
- const attributeKey = attribute ?? propertyName;
295
- if (propertyName in target) {
296
- throw new Error(`Property "${propertyName}" already exists on ${target.constructor.name}`);
297
- }
298
- const propertyMapping = {
299
- type,
300
- propertyName,
301
- attributeKey,
302
- converter: {
303
- fromAttribute: (value) => readAttributeValue(value, type),
304
- toAttribute: (value) => writeAttributeValue(value, type)
305
- }
306
- };
307
- addPropertyToMappings(target, propertyMapping);
308
- Object.defineProperty(target, propertyName, {
309
- get: function() {
310
- if (!originalValues.has(this)) {
311
- const initialValue = getInitialValue(this, type, attributeKey, defaultValue);
312
- originalValues.set(this, initialValue);
313
- }
314
- return originalValues.get(this);
315
- },
316
- set: function(newValue) {
317
- const oldValue = originalValues.get(this);
318
- if (oldValue === newValue)
319
- return;
320
- originalValues.set(this, newValue);
321
- if (reflect) {
322
- const attributeValue = propertyMapping.converter.toAttribute(newValue);
323
- this.setAttribute(attributeKey, attributeValue);
324
- }
325
- this.updated(propertyName, oldValue, newValue);
326
- },
327
- enumerable: true,
328
- configurable: true
329
- });
330
- const originalConnectedCallback = target.connectedCallback;
331
- target.connectedCallback = function() {
332
- originalConnectedCallback.call(this);
333
- this.updated(propertyName, null, defaultValue);
334
- };
335
- addObservedAttribute(target, attributeKey);
336
- };
337
- }
338
- function addObservedAttribute(target, attribute) {
339
- const ctor = target.constructor;
340
- const existingObservedAttributes = ctor.observedAttributes || [];
341
- if (!existingObservedAttributes.includes(attribute)) {
342
- const newObservedAttributes = [...existingObservedAttributes, attribute];
343
- Object.defineProperty(ctor, "observedAttributes", {
344
- get() {
345
- return newObservedAttributes;
346
- },
347
- configurable: true
348
- });
349
- }
350
- }
351
- var getInitialValue = (target, type, attributeKey, defaultValue) => {
352
- if (type === Boolean) {
353
- const hasAttribute = target.hasAttribute(attributeKey);
354
- return hasAttribute || defaultValue;
355
- }
356
- const attributeValue = target.getAttribute(attributeKey);
357
- return attributeValue !== null ? readAttributeValue(attributeValue, type) : defaultValue || defaultValueForType(type);
358
- };
359
- var addPropertyToMappings = (target, propertyMapping) => {
360
- if (!("propertyConfigMap" in target)) {
361
- Object.defineProperty(target, "propertyConfigMap", {
362
- value: new Map,
363
- configurable: true
364
- });
365
- }
366
- target.propertyConfigMap.set(propertyMapping.propertyName, propertyMapping);
367
- };
368
-
369
- // src/decorators/reactive-field.ts
370
- function reactiveField(proto, propertyKey) {
371
- const originalValues = new WeakMap;
372
- const isDefined = new WeakSet;
373
- Object.defineProperty(proto, propertyKey, {
374
- get: function() {
375
- return originalValues.get(this);
376
- },
377
- set: function(newValue) {
378
- if (isDefined.has(this)) {
379
- const oldValue = originalValues.get(this);
380
- if (oldValue !== newValue) {
381
- originalValues.set(this, newValue);
382
- this.updated(propertyKey, oldValue, newValue);
383
- }
384
- } else {
385
- originalValues.set(this, newValue);
386
- isDefined.add(this);
387
- }
388
- }
389
- });
390
- }
391
- // src/core/radiant-element.ts
392
- class RadiantElement extends HTMLElement {
393
- eventSubscriptions = new Map;
394
- elementReady = false;
395
- connectedCallback() {
396
- this.elementReady = true;
397
- }
398
- connectedContextCallback(_contextName) {
399
- }
400
- disconnectedCallback() {
401
- this.removeAllSubscribedEvents();
402
- }
403
- updated(changedProperty, oldValue, value) {
404
- if (!this.elementReady || !this.updatesRegistry || oldValue === value)
405
- return;
406
- const updates = this.updatesRegistry.get(changedProperty);
407
- if (updates) {
408
- for (const update of updates) {
409
- this[update]();
410
- }
411
- }
412
- }
413
- attributeChangedCallback(name, oldValue, newValue) {
414
- if (oldValue === newValue || !this.elementReady)
415
- return;
416
- if (name in this) {
417
- const config = this.propertyConfigMap.get(name);
418
- const transformedValue = newValue ? config?.converter.fromAttribute(newValue) : newValue;
419
- const transformedOldValue = oldValue ? config?.converter.fromAttribute(oldValue) : oldValue;
420
- this[name] = transformedValue;
421
- this.updated(name, transformedOldValue, transformedValue);
422
- }
423
- }
424
- renderTemplate({
425
- target = this,
426
- template,
427
- insert = "replace"
428
- }) {
429
- switch (insert) {
430
- case "replace":
431
- target.innerHTML = template;
432
- break;
433
- case "beforeend":
434
- target.insertAdjacentHTML("beforeend", template);
435
- break;
436
- case "afterbegin":
437
- target.insertAdjacentHTML("afterbegin", template);
438
- break;
439
- }
440
- }
441
- subscribeEvents(events) {
442
- for (const event3 of events) {
443
- this.subscribeEvent(event3);
444
- }
445
- }
446
- subscribeEvent(eventConfig) {
447
- const delegatedListener = (delegatedEvent) => {
448
- if (delegatedEvent.target && delegatedEvent.target.matches(eventConfig.selector)) {
449
- eventConfig.listener.call(this, delegatedEvent);
450
- }
451
- };
452
- this.addEventListener(eventConfig.type, delegatedListener, eventConfig.options);
453
- this.eventSubscriptions.set(eventConfig.id, { ...eventConfig, listener: delegatedListener });
454
- }
455
- unsubscribeEvent(id) {
456
- const eventSubscription = this.eventSubscriptions.get(id);
457
- if (eventSubscription) {
458
- this.removeEventListener(eventSubscription.type, eventSubscription.listener, eventSubscription.options);
459
- this.eventSubscriptions.delete(id);
460
- }
461
- }
462
- removeAllSubscribedEvents() {
463
- for (const eventSubscription of this.eventSubscriptions.values()) {
464
- this.removeEventListener(eventSubscription.type, eventSubscription.listener, eventSubscription.options);
465
- }
466
- this.eventSubscriptions.clear();
467
- }
468
- }
469
- // src/context/create-context.ts
470
- var createContext = (key) => key;
471
-
472
- // src/context/events.ts
473
- var ContextEventsTypes;
474
- ((ContextEventsTypes2) => {
475
- ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
476
- ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
477
- ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
478
- })(ContextEventsTypes ||= {});
479
-
480
- class ContextRequestEvent extends Event {
481
- context;
482
- callback;
483
- subscribe;
484
- constructor(context, callback, subscribe) {
485
- super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
486
- this.context = context;
487
- this.callback = callback;
488
- this.subscribe = subscribe;
489
- }
490
- }
491
-
492
- class ContextOnMountEvent extends CustomEvent {
493
- constructor(context) {
494
- super("context--on-mount" /* ON_MOUNT */, {
495
- detail: { context },
496
- bubbles: true,
497
- composed: true
498
- });
499
- }
500
- }
501
-
502
- class ContextSubscriptionRequestEvent extends Event {
503
- context;
504
- callback;
505
- select;
506
- subscribe;
507
- constructor(context, callback, select, subscribe) {
508
- super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
509
- bubbles: true,
510
- composed: true
511
- });
512
- this.context = context;
513
- this.callback = callback;
514
- this.select = select;
515
- this.subscribe = subscribe;
516
- }
517
- }
518
-
519
- // src/context/context-provider.ts
520
- class ContextProvider {
521
- host;
522
- context;
523
- value;
524
- subscriptions = [];
525
- constructor(host, options) {
526
- this.host = host;
527
- this.context = options.context;
528
- let contextValue = options.initialValue;
529
- if (options.hydrate) {
530
- const hydrationScriptElement = this.host.querySelector("script[data-hydration]");
531
- if (hydrationScriptElement?.textContent) {
532
- const hydrationValue = hydrationScriptElement.textContent;
533
- const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate);
534
- if (options.hydrate === Object && this.isObject(parsedHydrationValue) && (this.isObject(contextValue) || typeof contextValue === "undefined")) {
535
- contextValue = {
536
- ...contextValue ?? {},
537
- ...parsedHydrationValue
538
- };
539
- } else {
540
- contextValue = parsedHydrationValue;
541
- }
542
- }
543
- }
544
- this.value = contextValue;
545
- this.registerEvents();
546
- this.host.dispatchEvent(new ContextOnMountEvent(this.context));
547
- }
548
- setContext = (update, callback) => {
549
- if (typeof this.value === "object") {
550
- const oldContext = { ...this.value };
551
- this.value = { ...this.value, ...update };
552
- if (callback)
553
- callback(this.value);
554
- this.notifySubscribers(this.value, oldContext);
555
- }
556
- };
557
- getContext = () => {
558
- return this.value;
559
- };
560
- subscribe = ({ select, callback }) => {
561
- this.subscriptions.push({ select, callback });
562
- };
563
- isObject(value) {
564
- return typeof value === "object" && !Array.isArray(value) && value !== null;
565
- }
566
- notifySubscribers = (newContext, prevContext) => {
567
- for (const sub of this.subscriptions) {
568
- if (!sub.select)
569
- return this.sendSubscriptionUpdate(sub, newContext);
570
- const newSelected = sub.select(newContext);
571
- const prevSelected = sub.select(prevContext);
572
- if (newSelected !== prevSelected) {
573
- this.sendSubscriptionUpdate(sub, newContext);
574
- }
575
- }
576
- };
577
- sendSubscriptionUpdate = ({ select, callback }, context) => {
578
- if (!select)
579
- callback(context);
580
- else
581
- callback(select(context));
582
- };
583
- handleSubscriptionRequest = ({
584
- select,
585
- callback,
586
- subscribe
587
- }) => {
588
- if (subscribe)
589
- this.subscribe({ select, callback });
590
- if (!this.value)
591
- return;
592
- if (select) {
593
- callback(select(this.value));
594
- } else {
595
- callback(this.value);
596
- }
597
- };
598
- onSubscriptionRequest = (event3) => {
599
- const { context, callback, subscribe, select, target } = event3;
600
- if (context !== this.context)
601
- return;
602
- event3.stopPropagation();
603
- target.dispatchEvent(new ContextOnMountEvent(this.context));
604
- this.handleSubscriptionRequest({ select, callback, subscribe });
605
- };
606
- onContextRequest = (event3) => {
607
- const { context, callback } = event3;
608
- if (context !== this.context)
609
- return;
610
- event3.stopPropagation();
611
- callback(this);
612
- };
613
- registerEvents = () => {
614
- this.host.addEventListener("context--subscription-request" /* SUBSCRIPTION_REQUEST */, this.onSubscriptionRequest);
615
- this.host.addEventListener("context-request" /* CONTEXT_REQUEST */, this.onContextRequest);
616
- };
617
- }
618
-
619
- // src/context/decorators/provide-context.ts
620
- function provideContext({ context, initialValue, hydrate }) {
621
- return (proto, propertyKey) => {
622
- const originalConnectedCallback = proto.connectedCallback;
623
- proto.connectedCallback = function() {
624
- originalConnectedCallback.call(this);
625
- this[propertyKey] = new ContextProvider(this, { context, initialValue, hydrate });
626
- this.connectedContextCallback(context);
627
- };
628
- };
629
- }
630
-
631
- // src/context/decorators/consume-context.ts
632
- function consumeContext(contextToProvide) {
633
- return (proto, propertyKey) => {
634
- const originalConnectedCallback = proto.connectedCallback;
635
- proto.connectedCallback = function() {
636
- originalConnectedCallback.call(this);
637
- this.dispatchEvent(new ContextRequestEvent(contextToProvide, (context) => {
638
- this[propertyKey] = context;
639
- this.connectedContextCallback(contextToProvide);
640
- }));
641
- };
642
- };
643
- }
644
-
645
- // src/context/decorators/context-selector.ts
646
- function contextSelector({
647
- context,
648
- select,
649
- subscribe = true
650
- }) {
651
- return (proto, _, descriptor) => {
652
- const originalMethod = descriptor.value;
653
- const originalConnectedCallback = proto.connectedCallback;
654
- proto.connectedCallback = function() {
655
- originalConnectedCallback.call(this);
656
- this.dispatchEvent(new ContextSubscriptionRequestEvent(context, originalMethod.bind(this), select, subscribe));
657
- };
658
- descriptor.value = function(...args) {
659
- const result = originalMethod.apply(this, args);
660
- return result;
661
- };
662
- return descriptor;
663
- };
664
- }
665
- // src/mixins/with-kita.ts
666
- function WithKita(Base) {
667
- return class extends Base {
668
- async renderTemplate({ target = this, template, insert = "replace" }) {
669
- const safeTemplate = typeof template !== "string" ? template.toString() : template;
670
- switch (insert) {
671
- case "replace":
672
- target.innerHTML = safeTemplate;
673
- break;
674
- case "beforeend":
675
- target.insertAdjacentHTML("beforeend", safeTemplate);
676
- break;
677
- case "afterbegin":
678
- target.insertAdjacentHTML("afterbegin", safeTemplate);
679
- break;
680
- }
681
- }
682
- };
683
- }
684
- // src/tools/stringify-typed.ts
685
- function stringifyTyped(value) {
686
- return JSON.stringify(value);
687
- }
688
- export {
689
- writeAttributeValue,
690
- stringifyTyped,
691
- readAttributeValue,
692
- reactiveProp,
693
- reactiveField,
694
- query,
695
- provideContext,
696
- parseAttributeTypeDefault,
697
- parseAttributeTypeConstant,
698
- onUpdated,
699
- onEvent,
700
- isValueOfType,
701
- event,
702
- defaultValueForType,
703
- customElement,
704
- createContext,
705
- contextSelector,
706
- consumeContext,
707
- WithKita,
708
- RadiantElement,
709
- EventEmitter,
710
- ContextSubscriptionRequestEvent,
711
- ContextRequestEvent,
712
- ContextProvider,
713
- ContextOnMountEvent,
714
- ContextEventsTypes
715
- };
716
-
717
- //# debugId=939C4DFAA83EB14964756E2164756E21
3
+ //# debugId=B6A1B7EED2B4CACB64756E2164756E21