@ecopages/radiant 0.3.0-alpha.4 → 0.3.0-alpha.5

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 (450) hide show
  1. package/README.md +66 -56
  2. package/dist/LICENSE +21 -0
  3. package/dist/client/hydrator.d.ts +1 -1
  4. package/dist/client/hydrator.js +2 -2
  5. package/dist/client/hydrator.js.map +5 -3
  6. package/dist/client/install-hydrator.js +2 -2
  7. package/dist/client/install-hydrator.js.map +5 -3
  8. package/dist/context/context-consumer-bootstrap.d.ts +7 -6
  9. package/dist/context/context-consumer-bootstrap.js +2 -2
  10. package/dist/context/context-consumer-bootstrap.js.map +8 -3
  11. package/dist/context/context-consumer-runtime.d.ts +21 -8
  12. package/dist/context/context-consumer-runtime.js +2 -2
  13. package/dist/context/context-consumer-runtime.js.map +6 -3
  14. package/dist/context/context-host.d.ts +25 -0
  15. package/dist/context/context-host.js +3 -0
  16. package/dist/context/context-host.js.map +10 -0
  17. package/dist/context/context-provider.d.ts +10 -6
  18. package/dist/context/context-provider.js +2 -2
  19. package/dist/context/context-provider.js.map +9 -3
  20. package/dist/context/context-ssr-bridge.js +2 -2
  21. package/dist/context/context-ssr-bridge.js.map +4 -3
  22. package/dist/context/create-context.js +2 -2
  23. package/dist/context/create-context.js.map +4 -3
  24. package/dist/context/decorators/consume-context.d.ts +5 -2
  25. package/dist/context/decorators/consume-context.js +2 -2
  26. package/dist/context/decorators/consume-context.js.map +13 -3
  27. package/dist/context/decorators/context-selection-delivery.d.ts +1 -1
  28. package/dist/context/decorators/context-selection-delivery.js +2 -2
  29. package/dist/context/decorators/context-selection-delivery.js.map +5 -3
  30. package/dist/context/decorators/context-selector.d.ts +6 -6
  31. package/dist/context/decorators/context-selector.js +2 -2
  32. package/dist/context/decorators/context-selector.js.map +15 -3
  33. package/dist/context/decorators/legacy/consume-context.d.ts +2 -2
  34. package/dist/context/decorators/legacy/consume-context.js +2 -2
  35. package/dist/context/decorators/legacy/consume-context.js.map +10 -3
  36. package/dist/context/decorators/legacy/context-selector-field.d.ts +2 -2
  37. package/dist/context/decorators/legacy/context-selector-field.js +2 -2
  38. package/dist/context/decorators/legacy/context-selector-field.js.map +11 -3
  39. package/dist/context/decorators/legacy/context-selector.d.ts +2 -2
  40. package/dist/context/decorators/legacy/context-selector.js +2 -2
  41. package/dist/context/decorators/legacy/context-selector.js.map +11 -3
  42. package/dist/context/decorators/legacy/provide-context.d.ts +2 -2
  43. package/dist/context/decorators/legacy/provide-context.js +2 -2
  44. package/dist/context/decorators/legacy/provide-context.js.map +11 -3
  45. package/dist/context/decorators/on-context-update.d.ts +5 -5
  46. package/dist/context/decorators/on-context-update.js +2 -2
  47. package/dist/context/decorators/on-context-update.js.map +14 -3
  48. package/dist/context/decorators/provide-context.d.ts +5 -2
  49. package/dist/context/decorators/provide-context.js +2 -2
  50. package/dist/context/decorators/provide-context.js.map +14 -3
  51. package/dist/context/decorators/standard/consume-context.d.ts +2 -2
  52. package/dist/context/decorators/standard/consume-context.js +2 -2
  53. package/dist/context/decorators/standard/consume-context.js.map +9 -3
  54. package/dist/context/decorators/standard/context-selector-field.d.ts +2 -2
  55. package/dist/context/decorators/standard/context-selector-field.js +2 -2
  56. package/dist/context/decorators/standard/context-selector-field.js.map +10 -3
  57. package/dist/context/decorators/standard/context-selector.d.ts +2 -3
  58. package/dist/context/decorators/standard/context-selector.js +2 -2
  59. package/dist/context/decorators/standard/context-selector.js.map +10 -3
  60. package/dist/context/decorators/standard/provide-context.d.ts +2 -2
  61. package/dist/context/decorators/standard/provide-context.js +2 -2
  62. package/dist/context/decorators/standard/provide-context.js.map +10 -3
  63. package/dist/context/events.d.ts +18 -11
  64. package/dist/context/events.js +2 -2
  65. package/dist/context/events.js.map +4 -3
  66. package/dist/context/hydration-script.js +2 -2
  67. package/dist/context/hydration-script.js.map +6 -3
  68. package/dist/controller-registry.d.ts +28 -0
  69. package/dist/controller-registry.js +3 -0
  70. package/dist/controller-registry.js.map +11 -0
  71. package/dist/core/controller-metadata.d.ts +3 -0
  72. package/dist/core/controller-metadata.js +3 -0
  73. package/dist/core/controller-metadata.js.map +10 -0
  74. package/dist/core/custom-element-metadata.d.ts +11 -0
  75. package/dist/core/custom-element-metadata.js +2 -2
  76. package/dist/core/custom-element-metadata.js.map +4 -3
  77. package/dist/core/hydration-codec.d.ts +8 -1
  78. package/dist/core/hydration-codec.js +2 -2
  79. package/dist/core/hydration-codec.js.map +5 -3
  80. package/dist/core/radiant-component-ssr-registry.d.ts +13 -13
  81. package/dist/core/radiant-component-ssr-registry.js +2 -2
  82. package/dist/core/radiant-component-ssr-registry.js.map +4 -3
  83. package/dist/core/radiant-component-ssr.d.ts +3 -3
  84. package/dist/core/radiant-component-ssr.js +2 -2
  85. package/dist/core/radiant-component-ssr.js.map +8 -3
  86. package/dist/core/radiant-controller.d.ts +127 -0
  87. package/dist/core/radiant-controller.js +3 -0
  88. package/dist/core/radiant-controller.js.map +13 -0
  89. package/dist/core/radiant-element.d.ts +43 -41
  90. package/dist/core/radiant-element.js +2 -2
  91. package/dist/core/radiant-element.js.map +13 -3
  92. package/dist/core/radiant-hydrator-state.d.ts +1 -1
  93. package/dist/core/radiant-hydrator-state.js +2 -2
  94. package/dist/core/radiant-hydrator-state.js.map +4 -3
  95. package/dist/core/reactive-host.d.ts +137 -0
  96. package/dist/core/reactive-host.js +3 -0
  97. package/dist/core/reactive-host.js.map +10 -0
  98. package/dist/core/reactive-jsx-value.js +2 -2
  99. package/dist/core/reactive-jsx-value.js.map +4 -3
  100. package/dist/core/reactive-prop-metadata.js +2 -2
  101. package/dist/core/reactive-prop-metadata.js.map +4 -3
  102. package/dist/core/slot-projection-runtime.js +2 -2
  103. package/dist/core/slot-projection-runtime.js.map +6 -3
  104. package/dist/core/ssr-preparation.js +2 -2
  105. package/dist/core/ssr-preparation.js.map +4 -3
  106. package/dist/decorators/attr.d.ts +6 -0
  107. package/dist/decorators/attr.js +3 -0
  108. package/dist/decorators/attr.js.map +16 -0
  109. package/dist/decorators/bound.d.ts +4 -2
  110. package/dist/decorators/bound.js +2 -2
  111. package/dist/decorators/bound.js.map +7 -3
  112. package/dist/decorators/bridge.d.ts +11 -7
  113. package/dist/decorators/bridge.js +2 -2
  114. package/dist/decorators/bridge.js.map +4 -3
  115. package/dist/decorators/controller.d.ts +2 -0
  116. package/dist/decorators/controller.js +3 -0
  117. package/dist/decorators/controller.js.map +12 -0
  118. package/dist/decorators/custom-element.d.ts +4 -2
  119. package/dist/decorators/custom-element.js +2 -2
  120. package/dist/decorators/custom-element.js.map +7 -3
  121. package/dist/decorators/debounce.d.ts +5 -2
  122. package/dist/decorators/debounce.js +2 -2
  123. package/dist/decorators/debounce.js.map +8 -3
  124. package/dist/decorators/event.d.ts +5 -2
  125. package/dist/decorators/event.js +2 -2
  126. package/dist/decorators/event.js.map +10 -3
  127. package/dist/decorators/legacy/attr.d.ts +2 -0
  128. package/dist/decorators/legacy/attr.js +3 -0
  129. package/dist/decorators/legacy/attr.js.map +13 -0
  130. package/dist/decorators/legacy/bound.js +2 -2
  131. package/dist/decorators/legacy/bound.js.map +4 -3
  132. package/dist/decorators/legacy/custom-element.js +2 -2
  133. package/dist/decorators/legacy/custom-element.js.map +5 -3
  134. package/dist/decorators/legacy/debounce.js +2 -2
  135. package/dist/decorators/legacy/debounce.js.map +5 -3
  136. package/dist/decorators/legacy/event.js +2 -2
  137. package/dist/decorators/legacy/event.js.map +7 -3
  138. package/dist/decorators/legacy/instance-initializers.d.ts +3 -4
  139. package/dist/decorators/legacy/instance-initializers.js +2 -2
  140. package/dist/decorators/legacy/instance-initializers.js.map +4 -3
  141. package/dist/decorators/legacy/on-event.d.ts +2 -2
  142. package/dist/decorators/legacy/on-event.js +2 -2
  143. package/dist/decorators/legacy/on-event.js.map +6 -3
  144. package/dist/decorators/legacy/on-updated.d.ts +7 -2
  145. package/dist/decorators/legacy/on-updated.js +2 -2
  146. package/dist/decorators/legacy/on-updated.js.map +5 -3
  147. package/dist/decorators/legacy/query-slot.js +2 -2
  148. package/dist/decorators/legacy/query-slot.js.map +7 -3
  149. package/dist/decorators/legacy/query.d.ts +7 -2
  150. package/dist/decorators/legacy/query.js +2 -2
  151. package/dist/decorators/legacy/query.js.map +6 -3
  152. package/dist/decorators/legacy/reactive-field.d.ts +2 -2
  153. package/dist/decorators/legacy/reactive-field.js +2 -2
  154. package/dist/decorators/legacy/reactive-field.js.map +5 -3
  155. package/dist/decorators/legacy/reactive-prop.d.ts +10 -16
  156. package/dist/decorators/legacy/reactive-prop.js +2 -2
  157. package/dist/decorators/legacy/reactive-prop.js.map +7 -3
  158. package/dist/decorators/legacy/signal.d.ts +4 -3
  159. package/dist/decorators/legacy/signal.js +2 -2
  160. package/dist/decorators/legacy/signal.js.map +9 -3
  161. package/dist/decorators/on-event.d.ts +6 -3
  162. package/dist/decorators/on-event.js +2 -2
  163. package/dist/decorators/on-event.js.map +9 -3
  164. package/dist/decorators/on-updated.d.ts +12 -2
  165. package/dist/decorators/on-updated.js +2 -2
  166. package/dist/decorators/on-updated.js.map +8 -3
  167. package/dist/decorators/prop.d.ts +19 -7
  168. package/dist/decorators/prop.js +2 -2
  169. package/dist/decorators/prop.js.map +10 -3
  170. package/dist/decorators/query-slot.d.ts +11 -3
  171. package/dist/decorators/query-slot.js +2 -2
  172. package/dist/decorators/query-slot.js.map +10 -3
  173. package/dist/decorators/query.d.ts +9 -2
  174. package/dist/decorators/query.js +2 -2
  175. package/dist/decorators/query.js.map +9 -3
  176. package/dist/decorators/shared/reactive-attr.d.ts +25 -0
  177. package/dist/decorators/shared/reactive-attr.js +3 -0
  178. package/dist/decorators/shared/reactive-attr.js.map +11 -0
  179. package/dist/decorators/signal.d.ts +10 -4
  180. package/dist/decorators/signal.js +2 -2
  181. package/dist/decorators/signal.js.map +11 -3
  182. package/dist/decorators/standard/attr.d.ts +2 -0
  183. package/dist/decorators/standard/attr.js +3 -0
  184. package/dist/decorators/standard/attr.js.map +12 -0
  185. package/dist/decorators/standard/bound.js +2 -2
  186. package/dist/decorators/standard/bound.js.map +4 -3
  187. package/dist/decorators/standard/custom-element.js +2 -2
  188. package/dist/decorators/standard/custom-element.js.map +5 -3
  189. package/dist/decorators/standard/debounce.js +2 -2
  190. package/dist/decorators/standard/debounce.js.map +5 -3
  191. package/dist/decorators/standard/event.js +2 -2
  192. package/dist/decorators/standard/event.js.map +6 -3
  193. package/dist/decorators/standard/on-event.d.ts +2 -1
  194. package/dist/decorators/standard/on-event.js +2 -2
  195. package/dist/decorators/standard/on-event.js.map +5 -3
  196. package/dist/decorators/standard/on-updated.d.ts +5 -1
  197. package/dist/decorators/standard/on-updated.js +2 -2
  198. package/dist/decorators/standard/on-updated.js.map +4 -3
  199. package/dist/decorators/standard/query-slot.d.ts +1 -1
  200. package/dist/decorators/standard/query-slot.js +2 -2
  201. package/dist/decorators/standard/query-slot.js.map +5 -3
  202. package/dist/decorators/standard/query.d.ts +2 -1
  203. package/dist/decorators/standard/query.js +2 -2
  204. package/dist/decorators/standard/query.js.map +5 -3
  205. package/dist/decorators/standard/reactive-field.d.ts +2 -2
  206. package/dist/decorators/standard/reactive-field.js +2 -2
  207. package/dist/decorators/standard/reactive-field.js.map +4 -3
  208. package/dist/decorators/standard/reactive-prop.d.ts +13 -2
  209. package/dist/decorators/standard/reactive-prop.js +2 -2
  210. package/dist/decorators/standard/reactive-prop.js.map +6 -3
  211. package/dist/decorators/standard/signal.d.ts +4 -3
  212. package/dist/decorators/standard/signal.js +2 -2
  213. package/dist/decorators/standard/signal.js.map +8 -3
  214. package/dist/decorators/state.d.ts +6 -5
  215. package/dist/decorators/state.js +2 -2
  216. package/dist/decorators/state.js.map +8 -3
  217. package/dist/helpers/create-event-listener.d.ts +11 -2
  218. package/dist/helpers/create-event-listener.js +2 -2
  219. package/dist/helpers/create-event-listener.js.map +4 -3
  220. package/dist/helpers/create-event.js +2 -2
  221. package/dist/helpers/create-event.js.map +5 -3
  222. package/dist/helpers/create-query-slot.js +2 -2
  223. package/dist/helpers/create-query-slot.js.map +4 -3
  224. package/dist/helpers/create-query.d.ts +14 -3
  225. package/dist/helpers/create-query.js +2 -2
  226. package/dist/helpers/create-query.js.map +4 -3
  227. package/dist/helpers/debounce.js +2 -2
  228. package/dist/helpers/debounce.js.map +4 -3
  229. package/dist/helpers/index.js +2 -2
  230. package/dist/helpers/index.js.map +9 -3
  231. package/dist/index.d.ts +11 -12
  232. package/dist/index.js +2 -2
  233. package/dist/index.js.map +87 -3
  234. package/dist/server/context-ssr.js +2 -2
  235. package/dist/server/context-ssr.js.map +5 -3
  236. package/dist/server/html-parser.js +2 -2
  237. package/dist/server/html-parser.js.map +4 -3
  238. package/dist/server/install-light-dom-shim.js +2 -2
  239. package/dist/server/install-light-dom-shim.js.map +5 -3
  240. package/dist/server/light-dom-shim.js +2 -2
  241. package/dist/server/light-dom-shim.js.map +5 -3
  242. package/dist/server/project-root.js +2 -2
  243. package/dist/server/project-root.js.map +2 -2
  244. package/dist/server/radiant-component-ssr-runtime.d.ts +2 -2
  245. package/dist/server/radiant-component-ssr-runtime.js +2 -2
  246. package/dist/server/radiant-component-ssr-runtime.js.map +11 -3
  247. package/dist/server/render-component.d.ts +3 -13
  248. package/dist/server/render-component.js +2 -2
  249. package/dist/server/render-component.js.map +14 -4
  250. package/dist/server/render-controller.d.ts +57 -0
  251. package/dist/server/render-controller.js +3 -0
  252. package/dist/server/render-controller.js.map +23 -0
  253. package/dist/server/slot-projection-html.js +2 -2
  254. package/dist/server/slot-projection-html.js.map +7 -3
  255. package/dist/signals/host-resource.js +2 -2
  256. package/dist/signals/host-resource.js.map +2 -2
  257. package/dist/signals/host-signal.d.ts +4 -2
  258. package/dist/signals/host-signal.js +2 -2
  259. package/dist/signals/host-signal.js.map +7 -3
  260. package/dist/signals/hydration-script.js +2 -2
  261. package/dist/signals/hydration-script.js.map +6 -3
  262. package/dist/tools/escape-script-json.js +2 -2
  263. package/dist/tools/escape-script-json.js.map +4 -3
  264. package/dist/tools/event-emitter.js +2 -2
  265. package/dist/tools/event-emitter.js.map +4 -3
  266. package/dist/tools/index.js +2 -2
  267. package/dist/tools/index.js.map +7 -3
  268. package/dist/tools/render-jsx-template.js +2 -2
  269. package/dist/tools/render-jsx-template.js.map +4 -3
  270. package/dist/tools/stringify-typed.js +2 -2
  271. package/dist/tools/stringify-typed.js.map +4 -3
  272. package/dist/types.js +2 -2
  273. package/dist/types.js.map +2 -2
  274. package/dist/utils/attribute-utils.js +2 -2
  275. package/dist/utils/attribute-utils.js.map +4 -3
  276. package/dist/utils/index.js +2 -2
  277. package/dist/utils/index.js.map +4 -3
  278. package/package.json +22 -5
  279. package/size-budget.json +11 -2
  280. package/dist/chunk-0bswvy25.js +0 -4
  281. package/dist/chunk-0bswvy25.js.map +0 -10
  282. package/dist/chunk-0btkzzyc.js +0 -4
  283. package/dist/chunk-0btkzzyc.js.map +0 -10
  284. package/dist/chunk-0g0j9re6.js +0 -4
  285. package/dist/chunk-0g0j9re6.js.map +0 -10
  286. package/dist/chunk-1x26p09c.js +0 -4
  287. package/dist/chunk-1x26p09c.js.map +0 -10
  288. package/dist/chunk-21a7jask.js +0 -4
  289. package/dist/chunk-21a7jask.js.map +0 -10
  290. package/dist/chunk-21acj2eq.js +0 -4
  291. package/dist/chunk-21acj2eq.js.map +0 -10
  292. package/dist/chunk-25zjh0kg.js +0 -4
  293. package/dist/chunk-25zjh0kg.js.map +0 -10
  294. package/dist/chunk-30x4hggg.js +0 -4
  295. package/dist/chunk-30x4hggg.js.map +0 -10
  296. package/dist/chunk-3ynk7e1e.js +0 -4
  297. package/dist/chunk-3ynk7e1e.js.map +0 -10
  298. package/dist/chunk-5b1en9vz.js +0 -4
  299. package/dist/chunk-5b1en9vz.js.map +0 -10
  300. package/dist/chunk-5bkat72n.js +0 -4
  301. package/dist/chunk-5bkat72n.js.map +0 -10
  302. package/dist/chunk-5qeaq3tj.js +0 -4
  303. package/dist/chunk-5qeaq3tj.js.map +0 -10
  304. package/dist/chunk-66e6s792.js +0 -4
  305. package/dist/chunk-66e6s792.js.map +0 -10
  306. package/dist/chunk-79jg8q67.js +0 -4
  307. package/dist/chunk-79jg8q67.js.map +0 -10
  308. package/dist/chunk-8d5ddvvf.js +0 -4
  309. package/dist/chunk-8d5ddvvf.js.map +0 -10
  310. package/dist/chunk-8e9fgtbn.js +0 -4
  311. package/dist/chunk-8e9fgtbn.js.map +0 -10
  312. package/dist/chunk-9mqtp3js.js +0 -4
  313. package/dist/chunk-9mqtp3js.js.map +0 -10
  314. package/dist/chunk-9rj2rwes.js +0 -4
  315. package/dist/chunk-9rj2rwes.js.map +0 -10
  316. package/dist/chunk-atms6yrh.js +0 -4
  317. package/dist/chunk-atms6yrh.js.map +0 -10
  318. package/dist/chunk-bk2nbmcd.js +0 -4
  319. package/dist/chunk-bk2nbmcd.js.map +0 -10
  320. package/dist/chunk-bk6qkvfp.js +0 -4
  321. package/dist/chunk-bk6qkvfp.js.map +0 -10
  322. package/dist/chunk-c0qyz98c.js +0 -4
  323. package/dist/chunk-c0qyz98c.js.map +0 -10
  324. package/dist/chunk-c52qhh0j.js +0 -4
  325. package/dist/chunk-c52qhh0j.js.map +0 -10
  326. package/dist/chunk-cnyxrh9r.js +0 -4
  327. package/dist/chunk-cnyxrh9r.js.map +0 -10
  328. package/dist/chunk-cvz9mrxa.js +0 -4
  329. package/dist/chunk-cvz9mrxa.js.map +0 -10
  330. package/dist/chunk-dabagjk6.js +0 -4
  331. package/dist/chunk-dabagjk6.js.map +0 -10
  332. package/dist/chunk-e0r6ca2g.js +0 -4
  333. package/dist/chunk-e0r6ca2g.js.map +0 -10
  334. package/dist/chunk-e5jd9h6t.js +0 -4
  335. package/dist/chunk-e5jd9h6t.js.map +0 -10
  336. package/dist/chunk-eevw1j2q.js +0 -4
  337. package/dist/chunk-eevw1j2q.js.map +0 -10
  338. package/dist/chunk-ek664x1c.js +0 -4
  339. package/dist/chunk-ek664x1c.js.map +0 -10
  340. package/dist/chunk-eyw14d6y.js +0 -4
  341. package/dist/chunk-eyw14d6y.js.map +0 -10
  342. package/dist/chunk-fs4j94bk.js +0 -4
  343. package/dist/chunk-fs4j94bk.js.map +0 -10
  344. package/dist/chunk-g2z3mm6b.js +0 -4
  345. package/dist/chunk-g2z3mm6b.js.map +0 -10
  346. package/dist/chunk-g5n3m11h.js +0 -4
  347. package/dist/chunk-g5n3m11h.js.map +0 -10
  348. package/dist/chunk-gdkte2vd.js +0 -4
  349. package/dist/chunk-gdkte2vd.js.map +0 -10
  350. package/dist/chunk-gg74gdpv.js +0 -4
  351. package/dist/chunk-gg74gdpv.js.map +0 -10
  352. package/dist/chunk-gpv1n74a.js +0 -4
  353. package/dist/chunk-gpv1n74a.js.map +0 -10
  354. package/dist/chunk-h9k7crjc.js +0 -4
  355. package/dist/chunk-h9k7crjc.js.map +0 -10
  356. package/dist/chunk-hpzgnxgq.js +0 -4
  357. package/dist/chunk-hpzgnxgq.js.map +0 -10
  358. package/dist/chunk-hrjc8b1y.js +0 -4
  359. package/dist/chunk-hrjc8b1y.js.map +0 -10
  360. package/dist/chunk-hvy4zvcc.js +0 -4
  361. package/dist/chunk-hvy4zvcc.js.map +0 -10
  362. package/dist/chunk-hztr86b4.js +0 -4
  363. package/dist/chunk-hztr86b4.js.map +0 -10
  364. package/dist/chunk-j3v7rca5.js +0 -4
  365. package/dist/chunk-j3v7rca5.js.map +0 -10
  366. package/dist/chunk-j864sv4w.js +0 -4
  367. package/dist/chunk-j864sv4w.js.map +0 -10
  368. package/dist/chunk-jkb2y7c8.js +0 -4
  369. package/dist/chunk-jkb2y7c8.js.map +0 -10
  370. package/dist/chunk-kakpjgzf.js +0 -4
  371. package/dist/chunk-kakpjgzf.js.map +0 -10
  372. package/dist/chunk-kmebacvv.js +0 -4
  373. package/dist/chunk-kmebacvv.js.map +0 -10
  374. package/dist/chunk-knqsm6v3.js +0 -4
  375. package/dist/chunk-knqsm6v3.js.map +0 -10
  376. package/dist/chunk-mp2vtrkg.js +0 -4
  377. package/dist/chunk-mp2vtrkg.js.map +0 -10
  378. package/dist/chunk-mpsj3cjs.js +0 -4
  379. package/dist/chunk-mpsj3cjs.js.map +0 -10
  380. package/dist/chunk-n4p2542b.js +0 -4
  381. package/dist/chunk-n4p2542b.js.map +0 -10
  382. package/dist/chunk-nctznxyz.js +0 -4
  383. package/dist/chunk-nctznxyz.js.map +0 -10
  384. package/dist/chunk-ndw3hc3v.js +0 -4
  385. package/dist/chunk-ndw3hc3v.js.map +0 -10
  386. package/dist/chunk-nnnb6pac.js +0 -4
  387. package/dist/chunk-nnnb6pac.js.map +0 -10
  388. package/dist/chunk-nssj2x13.js +0 -4
  389. package/dist/chunk-nssj2x13.js.map +0 -10
  390. package/dist/chunk-nvr37vma.js +0 -4
  391. package/dist/chunk-nvr37vma.js.map +0 -10
  392. package/dist/chunk-p8k4g99a.js +0 -4
  393. package/dist/chunk-p8k4g99a.js.map +0 -10
  394. package/dist/chunk-pkszgjqf.js +0 -4
  395. package/dist/chunk-pkszgjqf.js.map +0 -10
  396. package/dist/chunk-q9z6tnzw.js +0 -4
  397. package/dist/chunk-q9z6tnzw.js.map +0 -10
  398. package/dist/chunk-qdz5sncz.js +0 -4
  399. package/dist/chunk-qdz5sncz.js.map +0 -10
  400. package/dist/chunk-qe0eww1n.js +0 -4
  401. package/dist/chunk-qe0eww1n.js.map +0 -10
  402. package/dist/chunk-r33zvvda.js +0 -4
  403. package/dist/chunk-r33zvvda.js.map +0 -10
  404. package/dist/chunk-rkh1vkb9.js +0 -4
  405. package/dist/chunk-rkh1vkb9.js.map +0 -10
  406. package/dist/chunk-rrg759ht.js +0 -4
  407. package/dist/chunk-rrg759ht.js.map +0 -10
  408. package/dist/chunk-s09s5ayx.js +0 -4
  409. package/dist/chunk-s09s5ayx.js.map +0 -10
  410. package/dist/chunk-sf4a2gy5.js +0 -4
  411. package/dist/chunk-sf4a2gy5.js.map +0 -10
  412. package/dist/chunk-ssnnxzrj.js +0 -4
  413. package/dist/chunk-ssnnxzrj.js.map +0 -10
  414. package/dist/chunk-t8xtvgyg.js +0 -4
  415. package/dist/chunk-t8xtvgyg.js.map +0 -10
  416. package/dist/chunk-v3ta7hnv.js +0 -4
  417. package/dist/chunk-v3ta7hnv.js.map +0 -10
  418. package/dist/chunk-v92hp9g0.js +0 -4
  419. package/dist/chunk-v92hp9g0.js.map +0 -10
  420. package/dist/chunk-vgtggzb6.js +0 -4
  421. package/dist/chunk-vgtggzb6.js.map +0 -9
  422. package/dist/chunk-vk48hgm4.js +0 -4
  423. package/dist/chunk-vk48hgm4.js.map +0 -10
  424. package/dist/chunk-w8s5fnsq.js +0 -4
  425. package/dist/chunk-w8s5fnsq.js.map +0 -10
  426. package/dist/chunk-wd23rn4q.js +0 -4
  427. package/dist/chunk-wd23rn4q.js.map +0 -10
  428. package/dist/chunk-wds4href.js +0 -4
  429. package/dist/chunk-wds4href.js.map +0 -10
  430. package/dist/chunk-wvd1ffe4.js +0 -4
  431. package/dist/chunk-wvd1ffe4.js.map +0 -10
  432. package/dist/chunk-wwbjz9k4.js +0 -4
  433. package/dist/chunk-wwbjz9k4.js.map +0 -10
  434. package/dist/chunk-x2k0ngpz.js +0 -4
  435. package/dist/chunk-x2k0ngpz.js.map +0 -10
  436. package/dist/chunk-x457d0ap.js +0 -4
  437. package/dist/chunk-x457d0ap.js.map +0 -10
  438. package/dist/chunk-xbhtzkre.js +0 -4
  439. package/dist/chunk-xbhtzkre.js.map +0 -10
  440. package/dist/chunk-y139ycfm.js +0 -4
  441. package/dist/chunk-y139ycfm.js.map +0 -10
  442. package/dist/chunk-z9kxfckm.js +0 -4
  443. package/dist/chunk-z9kxfckm.js.map +0 -10
  444. package/dist/chunk-zx5txex8.js +0 -4
  445. package/dist/chunk-zx5txex8.js.map +0 -10
  446. package/dist/chunk-zygdebw8.js +0 -4
  447. package/dist/chunk-zygdebw8.js.map +0 -10
  448. package/dist/core/radiant-component.d.ts +0 -113
  449. package/dist/core/radiant-component.js +0 -3
  450. package/dist/core/radiant-component.js.map +0 -9
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/core/ssr-preparation.ts", "../src/context/events.ts", "../src/context/context-ssr-bridge.ts", "../src/context/context-consumer-runtime.ts", "../src/context/context-consumer-bootstrap.ts", "../src/decorators/bridge.ts", "../src/context/decorators/context-selection-delivery.ts", "../src/context/decorators/legacy/context-selector.ts", "../src/context/decorators/standard/context-selector.ts", "../src/context/decorators/on-context-update.ts"],
4
4
  "sourcesContent": [
5
+ "type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
6
+ "type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol();\nexport const SSR_PREPARATION_RUNNING = Symbol();\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\n}\n",
7
+ "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\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\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\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\t| DirectContextSubscription<T>\n\t| SelectedContextSubscription<T, Selected>;\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\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\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, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
8
+ "import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
9
+ "import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\t| DirectContextSelectionRequest<TContext>\n\t| SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n",
10
+ "import type { ContextHostLike } from './context-host';\nimport { registerSsrPreparationCallback } from '../core/ssr-preparation';\nimport {\n\tinitializeConsumedContext,\n\tinitializeContextSelection,\n\trequestConsumedContext,\n\trequestContextSelection,\n} from './context-consumer-runtime';\nimport type { ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\n/**\n * Resolves a consumed context immediately and registers the same resolution to\n * run again during the later SSR preparation phase.\n *\n * This keeps constructor-time state and pre-serialization state aligned after\n * instance fields, props, or authored host content change during SSR setup.\n */\nexport function bootstrapSsrConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => initializeConsumedContext(host, context, assign, options));\n}\n\n/**\n * Resolves a selected context value immediately and registers the same\n * selection for the later SSR preparation phase.\n *\n * This lets nested SSR renders recompute selector-backed state after the host\n * has finished construction and any server-side configuration hooks have run.\n */\nexport function bootstrapSsrContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: object,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\tselect?: (context: ContextType<TContext>) => Selected,\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => {\n\t\tif (select) {\n\t\t\treturn initializeContextSelection(context, { callback, select });\n\t\t}\n\n\t\treturn initializeContextSelection(context, {\n\t\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t\t});\n\t});\n}\n\n/**\n * Resolves a consumed context from SSR when available, otherwise requests it\n * through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tif (initializeConsumedContext(host, context, assign, options)) {\n\t\treturn true;\n\t}\n\n\treturn requestConsumedContext(host, context, assign, options);\n}\n\n/**\n * Resolves a selected context value from SSR when available, otherwise requests\n * it through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\toptions: {\n\t\tselect?: (context: ContextType<TContext>) => Selected;\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t} = {},\n): boolean {\n\tif (options.select) {\n\t\tconst request = { callback, select: options.select };\n\n\t\tif (initializeContextSelection(context, request)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn requestContextSelection(host, context, request, {\n\t\t\tsubscribe: options.subscribe,\n\t\t\tonSubscribe: options.onSubscribe,\n\t\t});\n\t}\n\n\tconst request = {\n\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t};\n\n\tif (initializeContextSelection(context, request)) {\n\t\treturn true;\n\t}\n\n\treturn requestContextSelection(host, context, request, {\n\t\tsubscribe: options.subscribe,\n\t\tonSubscribe: options.onSubscribe,\n\t});\n}\n\nfunction registerAndResolveConsumerBootstrap<TResult>(host: object, resolve: () => TResult): TResult {\n\tregisterSsrPreparationCallback(host, resolve);\n\treturn resolve();\n}\n",
11
+ "import type { Method } from '../types';\n\ntype StandardFieldFn<Host extends object, Value, Result> = (\n\ttarget: undefined,\n\tcontext: ClassFieldDecoratorContext<Host, Value>,\n) => Result;\n\ntype LegacyFieldFn<Proto, Result> = (proto: Proto, name: string) => Result;\n\ntype StandardMethodFn<Host extends object, TMethod extends Method, Result> = (\n\ttarget: TMethod,\n\tcontext: ClassMethodDecoratorContext<Host, TMethod>,\n) => Result;\n\ntype LegacyMethodFn<Proto, Result> = (proto: Proto, name: string, descriptor: PropertyDescriptor) => Result;\n\nfunction isMethod(value: unknown): value is Method {\n\treturn typeof value === 'function';\n}\n\nexport function fieldDecoratorBridge<Host extends object, Value, Result, Proto>(\n\tstandard: StandardFieldFn<Host, Value, Result>,\n\tlegacy: LegacyFieldFn<Proto, void>,\n\tprotoOrTarget: undefined,\n\tnameOrContext: ClassFieldDecoratorContext<Host, Value>,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, Proto, Result>(\n\tstandard: StandardFieldFn<Host, Value, void>,\n\tlegacy: LegacyFieldFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardFieldFn<Host, Value, StandardResult>,\n\tlegacy: LegacyFieldFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | undefined,\n\tnameOrContext: string | ClassFieldDecoratorContext<Host, Value>,\n): StandardResult | LegacyResult;\n\nexport function fieldDecoratorBridge(\n\tstandard: StandardFieldFn<object, unknown, unknown>,\n\tlegacy: LegacyFieldFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassFieldDecoratorContext<object, unknown>,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\treturn standard(undefined, nameOrContext);\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext);\n}\n\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Result, Proto>(\n\tstandard: StandardMethodFn<Host, TMethod, Result>,\n\tlegacy: LegacyMethodFn<Proto, void>,\n\tprotoOrTarget: TMethod,\n\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: undefined,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Proto, Result>(\n\tstandard: StandardMethodFn<Host, TMethod, void>,\n\tlegacy: LegacyMethodFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n\tdescriptor: PropertyDescriptor,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardMethodFn<Host, TMethod, StandardResult>,\n\tlegacy: LegacyMethodFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | TMethod,\n\tnameOrContext: string | ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: PropertyDescriptor,\n): StandardResult | LegacyResult;\n\nexport function methodDecoratorBridge(\n\tstandard: StandardMethodFn<object, Method, unknown>,\n\tlegacy: LegacyMethodFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassMethodDecoratorContext<object, Method>,\n\tdescriptor?: PropertyDescriptor,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\tif (!isMethod(protoOrTarget)) {\n\t\t\tthrow new TypeError('Standard method decorators require a method target');\n\t\t}\n\n\t\treturn standard(protoOrTarget, nameOrContext);\n\t}\n\n\tif (!descriptor) {\n\t\tthrow new TypeError('Legacy method decorators require a property descriptor');\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext, descriptor);\n}\n",
12
+ "import { SSR_PREPARATION_RUNNING } from '../../core/ssr-preparation';\n\ntype RequestUpdateCapable = {\n\trequestUpdate(): void;\n};\n\nexport function createContextSelectionDelivery<Value>(\n\thost: object,\n\tapply: (value: Value) => void,\n\trequestUpdate: boolean,\n) {\n\tlet hasDeliveredValue = false;\n\tlet previousValue: Value;\n\tconst target = host as Record<PropertyKey, unknown>;\n\n\treturn (value: Value) => {\n\t\tif (target[SSR_PREPARATION_RUNNING] !== true && hasDeliveredValue && Object.is(previousValue, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\thasDeliveredValue = true;\n\t\tpreviousValue = value;\n\t\tapply(value);\n\n\t\tif (requestUpdate && typeof target.requestUpdate === 'function') {\n\t\t\t(target as RequestUpdateCapable).requestUpdate();\n\t\t}\n\t};\n}\n",
13
+ "import type { ContextHostLike } from '../../context-host';\nimport { registerLegacyInstanceInitializer } from '../../../decorators/legacy/instance-initializers';\nimport { bootstrapSsrContextSelection, connectContextSelection } from '../../context-consumer-bootstrap';\nimport type { Context, ContextType } from '../../types';\nimport type { OnContextUpdateOptions } from '../on-context-update';\nimport { createContextSelectionDelivery } from '../context-selection-delivery';\n\nexport function contextSelector<T extends Context<unknown, unknown>, Selected = ContextType<T>>({\n\tcontext,\n\tselect,\n\tsubscribe = true,\n\trequestUpdate = true,\n}: OnContextUpdateOptions<T, Selected>) {\n\treturn (proto: ContextHostLike, _: string, descriptor: PropertyDescriptor) => {\n\t\tconst originalMethod = descriptor.value;\n\n\t\tregisterLegacyInstanceInitializer(proto, (element) => {\n\t\t\tlet activeUnsubscribe: (() => void) | undefined;\n\t\t\tconst applySelectedContext = createContextSelectionDelivery(\n\t\t\t\telement,\n\t\t\t\t(value) => {\n\t\t\t\t\toriginalMethod.call(element, value);\n\t\t\t\t},\n\t\t\t\trequestUpdate,\n\t\t\t);\n\n\t\t\tbootstrapSsrContextSelection<T, Selected>(element, context, applySelectedContext, select);\n\n\t\t\telement.registerConnectedCallback(() => {\n\t\t\t\tif (\n\t\t\t\t\tconnectContextSelection<T, Selected>(element, context, applySelectedContext, {\n\t\t\t\t\t\tonSubscribe: (unsubscribe) => {\n\t\t\t\t\t\t\tactiveUnsubscribe = unsubscribe;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tsubscribe,\n\t\t\t\t\t})\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconnectContextSelection<T, Selected>(element, context, applySelectedContext, {\n\t\t\t\t\t\tonSubscribe: (unsubscribe) => {\n\t\t\t\t\t\t\tactiveUnsubscribe = unsubscribe;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tsubscribe,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\n\t\t\telement.registerCleanupCallback(() => {\n\t\t\t\tactiveUnsubscribe?.();\n\t\t\t\tactiveUnsubscribe = undefined;\n\t\t\t});\n\t\t});\n\n\t\treturn descriptor;\n\t};\n}\n",
14
+ "import type { ContextHostLike } from '../../context-host';\nimport { bootstrapSsrContextSelection, connectContextSelection } from '../../context-consumer-bootstrap';\nimport type { Context, ContextType } from '../../types';\nimport type { OnContextUpdateOptions } from '../on-context-update';\nimport { createContextSelectionDelivery } from '../context-selection-delivery';\n\nexport function contextSelector<T extends Context<unknown, unknown>, Selected = ContextType<T>>({\n\tcontext,\n\tselect,\n\tsubscribe = true,\n\trequestUpdate = true,\n}: OnContextUpdateOptions<T, Selected>) {\n\treturn function <Host extends ContextHostLike, TMethod extends (value: Selected) => unknown>(\n\t\toriginalMethod: TMethod,\n\t\ttargetContext: ClassMethodDecoratorContext<Host, TMethod>,\n\t): void {\n\t\ttargetContext.addInitializer(function (this: Host) {\n\t\t\tlet activeUnsubscribe: (() => void) | undefined;\n\t\t\tconst applySelectedContext = createContextSelectionDelivery<Selected>(\n\t\t\t\tthis,\n\t\t\t\t(value) => {\n\t\t\t\t\toriginalMethod.call(this, value);\n\t\t\t\t},\n\t\t\t\trequestUpdate,\n\t\t\t);\n\n\t\t\tif (bootstrapSsrContextSelection<T, Selected>(this, context, applySelectedContext, select)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst connectSelection = () => {\n\t\t\t\treturn connectContextSelection<T, Selected>(this, context, applySelectedContext, {\n\t\t\t\t\tonSubscribe: (unsubscribe) => {\n\t\t\t\t\t\tactiveUnsubscribe = unsubscribe;\n\t\t\t\t\t},\n\t\t\t\t\tselect,\n\t\t\t\t\tsubscribe,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tthis.registerCleanupCallback(() => {\n\t\t\t\tactiveUnsubscribe?.();\n\t\t\t\tactiveUnsubscribe = undefined;\n\t\t\t});\n\n\t\t\tthis.registerConnectedCallback(() => {\n\t\t\t\tif (connectSelection()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconnectSelection();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n}\n",
15
+ "import type { Method } from '../../types';\nimport type { ContextHostLike } from '../context-host';\nimport type { Context, ContextType, UnknownContext } from '../types';\nimport { contextSelector as legacyContextSelectorMethod } from './legacy/context-selector';\nimport { contextSelector as standardContextSelectorMethod } from './standard/context-selector';\nimport { methodDecoratorBridge } from '../../decorators/bridge';\n\ntype ContextUpdateMethod<Selected> = (value: Selected) => unknown;\n\ntype OnContextUpdateDecorator<Selected> = {\n\t<Host extends ContextHostLike, TMethod extends ContextUpdateMethod<Selected>>(\n\t\tprotoOrTarget: TMethod,\n\t\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\t): void;\n\t(\n\t\tprotoOrTarget: ContextHostLike,\n\t\tnameOrContext: string,\n\t\tdescriptor: TypedPropertyDescriptor<ContextUpdateMethod<Selected>>,\n\t): TypedPropertyDescriptor<ContextUpdateMethod<Selected>> | void;\n};\n\nexport type OnContextUpdateOptions<T extends UnknownContext, Selected = ContextType<T>> = {\n\t/** Context token to resolve from ancestor providers. */\n\tcontext: T;\n\t/** Optional projection that narrows the resolved context before delivery. */\n\tselect?: (context: ContextType<T>) => Selected;\n\t/** Whether client-side event-channel subscriptions should stay active after the first value. */\n\tsubscribe?: boolean;\n\t/** Whether RadiantElement hosts should schedule `requestUpdate()` after delivery. */\n\trequestUpdate?: boolean;\n};\n\n/**\n * Subscribes a method to the current value, or a selected slice, of a context.\n *\n * The decorated method is invoked during SSR when an ambient provider is\n * available, and on the client it keeps receiving updates according to the\n * `subscribe` option.\n *\n * On `RadiantElement` hosts, each delivery also schedules `requestUpdate()`\n * unless `requestUpdate: false` is set explicitly.\n *\n * @param options Context subscription configuration.\n */\nexport function onContextUpdate<T extends Context<unknown, unknown>, Selected = ContextType<T>>(\n\toptions: OnContextUpdateOptions<T, Selected>,\n): OnContextUpdateDecorator<Selected> {\n\tfunction decorator<Host extends ContextHostLike, TMethod extends ContextUpdateMethod<Selected>>(\n\t\tprotoOrTarget: TMethod,\n\t\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\t): void;\n\tfunction decorator(\n\t\tprotoOrTarget: ContextHostLike,\n\t\tnameOrContext: string,\n\t\tdescriptor: TypedPropertyDescriptor<ContextUpdateMethod<Selected>>,\n\t): TypedPropertyDescriptor<ContextUpdateMethod<Selected>> | void;\n\tfunction decorator(\n\t\tprotoOrTarget: ContextHostLike | Method,\n\t\tnameOrContext: string | ClassMethodDecoratorContext<ContextHostLike, ContextUpdateMethod<Selected>>,\n\t\tdescriptor?: TypedPropertyDescriptor<ContextUpdateMethod<Selected>>,\n\t): TypedPropertyDescriptor<ContextUpdateMethod<Selected>> | void {\n\t\treturn methodDecoratorBridge(\n\t\t\tstandardContextSelectorMethod(options),\n\t\t\tlegacyContextSelectorMethod(options),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t\tdescriptor,\n\t\t);\n\t}\n\n\treturn decorator;\n}\n"
5
16
  ],
6
- "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CAAK,GAEnC,CACD,EAEA,EAA0C,EAAS,EAAS,EAAsB,CAAM,EAExF,EAAQ,0BAA0B,IAAM,CACvC,GACC,EAAqC,EAAS,EAAS,EAAsB,CAC5E,YAAa,CAAC,IAAgB,CAC7B,EAAoB,GAErB,SACA,WACD,CAAC,EAED,OAGD,eAAe,IAAM,CACpB,EAAqC,EAAS,EAAS,EAAsB,CAC5E,YAAa,CAAC,IAAgB,CAC7B,EAAoB,GAErB,SACA,WACD,CAAC,EACD,EACD,EAED,EAAQ,wBAAwB,IAAM,CACrC,IAAoB,EACpB,EAAoB,OACpB,EACD,EAEM,GCpDF,SAAS,CAA+E,EAC9F,UACA,SACA,YAAY,GACZ,gBAAgB,IACuB,CACvC,OAAO,QAAqF,CAC3F,EACA,EACO,CACP,EAAc,eAAe,QAAS,EAAa,CAClD,IAAI,EACE,EAAuB,EAC5B,KACA,CAAC,IAAU,CACV,EAAe,KAAK,KAAM,CAAK,GAEhC,CACD,EAEA,GAAI,EAA0C,KAAM,EAAS,EAAsB,CAAM,EACxF,OAGD,IAAM,EAAmB,IAAM,CAC9B,OAAO,EAAqC,KAAM,EAAS,EAAsB,CAChF,YAAa,CAAC,IAAgB,CAC7B,EAAoB,GAErB,SACA,WACD,CAAC,GAGF,KAAK,wBAAwB,IAAM,CAClC,IAAoB,EACpB,EAAoB,OACpB,EAED,KAAK,0BAA0B,IAAM,CACpC,GAAI,EAAiB,EACpB,OAGD,eAAe,IAAM,CACpB,EAAiB,EACjB,EACD,EACD,GCVI,SAAS,EAA+E,CAC9F,EACqC,CAUrC,SAAS,CAAS,CACjB,EACA,EACA,EACgE,CAChE,OAAO,EACN,EAA8B,CAAO,EACrC,EAA4B,CAAO,EACnC,EACA,EACA,CACD,EAGD,OAAO",
18
+ "debugId": "2A89AC48AFC6690464756E2164756E21",
8
19
  "names": []
9
20
  }
@@ -1,5 +1,5 @@
1
- import type { StandardOrLegacyFieldDecoratorArgs } from '../../types';
2
1
  import type { AttributeTypeConstant } from '../../utils';
2
+ import type { ContextHostLike } from '../context-host';
3
3
  import type { UnknownContext } from '../types';
4
4
  export type ProvideContextOptions<T extends UnknownContext> = {
5
5
  /** Context token made available to descendant consumers. */
@@ -23,4 +23,7 @@ export type ProvideContextOptions<T extends UnknownContext> = {
23
23
  * @param options {@link ProvideContextOptions}
24
24
  * @returns
25
25
  */
26
- export declare function provideContext<T extends UnknownContext>(options: ProvideContextOptions<T>): (protoOrTarget: StandardOrLegacyFieldDecoratorArgs["protoOrTarget"], nameOrContext: StandardOrLegacyFieldDecoratorArgs["nameOrContext"]) => any;
26
+ export declare function provideContext<T extends UnknownContext>(options: ProvideContextOptions<T>): {
27
+ <Host extends ContextHostLike, V>(protoOrTarget: undefined, nameOrContext: ClassFieldDecoratorContext<Host, V>): void;
28
+ (protoOrTarget: ContextHostLike, nameOrContext: string): void;
29
+ };
@@ -1,3 +1,3 @@
1
- import{v as a}from"../../chunk-wds4href.js";import"../../chunk-r33zvvda.js";import"../../chunk-5qeaq3tj.js";import"../../chunk-21a7jask.js";import"../../chunk-kmebacvv.js";import"../../chunk-c0qyz98c.js";import"../../chunk-cnyxrh9r.js";import"../../chunk-q9z6tnzw.js";import"../../chunk-hpzgnxgq.js";import"../../chunk-nssj2x13.js";import"../../chunk-vgtggzb6.js";export{a as provideContext};
1
+ var E=((d)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(d,{get:(o,g)=>(typeof require<"u"?require:o)[g]}):d)(function(d){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+d+'" is not supported')});var j=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function R(d,o){let f=d[j];if(Array.isArray(f)){f.push(o);return}Object.defineProperty(d,j,{value:[o],configurable:!0})}function Y(d){let o=[],g=Object.getPrototypeOf(d);while(g&&g!==Object.prototype)o.push(g),g=Object.getPrototypeOf(g);for(let f=o.length-1;f>=0;f-=1){let r=o[f][j];if(!Array.isArray(r))continue;for(let F of r)F(d)}}function D(d){return d.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var H="data-hydration",x="data-hydration-type",w="data-hydration-key";function k(d){let o=d.hydrationKey?` ${w}="${Z(d.hydrationKey)}"`:"";return`<script type="application/json" ${H} ${x}="${d.type}"${o}>${d.serializedValue}</script>`}function q(d){return D(d)}function u(d,o){let g=d.textContent;if(!g)return o;try{return JSON.parse(g)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${H}>:`,g.slice(0,120));return o}}function Q(d,o,g){let f=d.children;if(!f||f.length===0){let r=d.childNodes;if(!r||r.length===0)return null;for(let F=0;F<r.length;F+=1){let M=r[F];if(M.nodeType!==1)continue;let t=M;if(n(t,o,g))return t}return null}for(let r=0;r<f.length;r+=1)if(n(f[r],o,g))return f[r];return null}function n(d,o,g){if(d.tagName!=="SCRIPT"||!d.hasAttribute(H)||d.getAttribute(x)!==o)return!1;if(g!==void 0)return d.getAttribute(w)===g;return!d.hasAttribute(w)}function Z(d){return d.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var $;((r)=>{r.SUBSCRIPTION_REQUEST="context-subscription-request";r.CONTEXT_REQUEST="context-request";r.ON_MOUNT="context-on-mount";r.MOUNTED="context-mounted"})($||={});class J extends Event{context;callback;subscribe;handled=!1;constructor(d,o,g){super("context-request",{bubbles:!0,composed:!0});this.context=d;this.callback=o;this.subscribe=g}markHandled(){this.handled=!0}}class P extends CustomEvent{constructor(d){super("context-on-mount",{detail:{context:d},bubbles:!0,composed:!0})}}class U extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(d,o,g,f,r){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=d;this.callback=o;this.select=g;this.subscribe=f;this.onSubscribe=r}markHandled(){this.handled=!0}}function B(d){return k({type:"context",...d})}function V(d){return q(d)}function T(d){if(d instanceof Element)return d;if("host"in d)return d.host;if("element"in d)return d.element;return null}function W(d){if(d instanceof Element)return d;if("host"in d)return d.host;if("element"in d)return d.element;return d}import{createMarkupNodeLike as h}from"@ecopages/jsx";class C{host;context;hydrationKey;hydrate;serialize;pendingHostHydration;value;subscriptions=[];constructor(d,o){this.host=d,this.context=o.context,this.hydrationKey=o.hydrationKey,this.hydrate=o.hydrate,this.serialize=o.serialize,this.pendingHostHydration=Boolean(o.hydrate),this.value=o.initialValue,this.tryHydrateFromHost(),this.registerEvents(),this.host.dispatchEvent(new P(this.context))}setContext=(d,o)=>{if(this.tryHydrateFromHost(),this.pendingHostHydration=!1,typeof this.value>"u"&&this.isObject(d)){let g=this.value;if(this.value={...d},o)o(this.value);this.notifySubscribers(this.value,g);return}if(this.isObject(this.value)&&this.isObject(d)){let g={...this.value};if(this.value={...this.value,...d},o)o(this.value);this.notifySubscribers(this.value,g)}};getContext=()=>{return this.tryHydrateFromHost(),this.value};getContextKey=()=>{return this.context};serializeHydrationValue=()=>{if(this.tryHydrateFromHost(),!this.hydrate||typeof this.value>"u")return;let d=this.serialize?this.serialize(this.value):this.value;if(typeof d>"u")return;let o=JSON.stringify(d);if(typeof o!=="string")return;return V(o)};renderHydrationScriptTag=()=>{let d=this.serializeHydrationValue();if(!d)return;return B({hydrationKey:this.hydrationKey,serializedValue:d})};renderHydrationScript=()=>{let d=this.renderHydrationScriptTag();if(!d)return;return h(d)};subscribe=(d)=>{let o={hasChanged:(g,f)=>{if(typeof f>"u"||!d.select)return!0;return d.select(g)!==d.select(f)},notify:(g)=>{if(d.select){d.callback(d.select(g),o.unsubscribe);return}d.callback(g,o.unsubscribe)},unsubscribe:()=>{let g=this.subscriptions.indexOf(o);if(g!==-1)this.subscriptions.splice(g,1)}};return this.subscriptions.push(o),o.unsubscribe};tryHydrateFromHost(){if(!this.pendingHostHydration)return;let d=this.findHydrationScriptElement();if(!d)return;this.value=this.mergeHydrationValue(u(d,this.value)),this.pendingHostHydration=!1}mergeHydrationValue(d){if(this.hydrate===Object&&this.isObject(d)&&(this.isObject(this.value)||typeof this.value>"u"))return{...this.value??{},...d};return d}isObject(d){return typeof d==="object"&&!Array.isArray(d)&&d!==null}findHydrationScriptElement(){return Q(W(this.host),"context",this.hydrationKey)}notifySubscribers=(d,o)=>{for(let g of this.subscriptions)if(g.hasChanged(d,o))g.notify(d)};handleSubscriptionRequest=(d,{subscribe:o,onSubscribe:g})=>{this.tryHydrateFromHost();let f=o?this.subscribe(d):void 0;if(f)g?.(f);if(typeof this.value>"u")return;if(d.select)d.callback(d.select(this.value),f);else d.callback(this.value,f)};onSubscriptionRequest=(d)=>{let{context:o,callback:g,subscribe:f,select:r,target:F,onSubscribe:M}=d;if(o!==this.context)return;if(d.markHandled(),d.stopPropagation(),F instanceof EventTarget)F.dispatchEvent(new P(this.context));if(r){this.handleSubscriptionRequest({select:r,callback:g},{subscribe:f,onSubscribe:M});return}this.handleSubscriptionRequest({callback:g},{subscribe:f,onSubscribe:M})};onContextRequest=(d)=>{let{context:o,callback:g}=d;if(o!==this.context)return;d.markHandled(),d.stopPropagation(),g(this)};registerEvents=()=>{this.host.addEventListener("context-subscription-request",this.onSubscriptionRequest),this.host.addEventListener("context-request",this.onContextRequest)}}function m(d){return typeof d==="function"}function X(d,o,g,f){if(typeof f==="object")return d(void 0,f);return o(g,f)}function p(d,o,g,f,r){if(typeof f==="object"){if(!m(g))throw TypeError("Standard method decorators require a method target");return d(g,f)}if(!r)throw TypeError("Legacy method decorators require a property descriptor");return o(g,f,r)}function G({context:d,initialValue:o,hydrate:g,serialize:f}){return(r,F)=>{let M=(t)=>{if(t[F])return;let L=new C(t,{context:d,hydrationKey:F,initialValue:o,hydrate:g,serialize:f});t[F]=L,t.registerContextProvider(F,L),t.connectedContextCallback(d)};R(r,(t)=>{M(t),t.registerConnectedCallback(()=>{M(t)})})}}function O({context:d,initialValue:o,hydrate:g,serialize:f}){return(r,F)=>{let M=String(F.name);F.addInitializer(function(){let t=this,L=new C(this,{context:d,hydrationKey:M,initialValue:o,hydrate:g,serialize:f});t[M]=L,this.registerContextProvider(M,L),this.connectedContextCallback(d)})}}function Ld(d){function o(g,f){return X(O(d),G(d),g,f)}return o}export{Ld as provideContext};
2
2
 
3
- //# debugId=A93A96A0D175B10664756E2164756E21
3
+ //# debugId=D55B62B41908539464756E2164756E21
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/tools/escape-script-json.ts", "../src/core/hydration-codec.ts", "../src/context/events.ts", "../src/context/hydration-script.ts", "../src/context/context-host.ts", "../src/context/context-provider.ts", "../src/decorators/bridge.ts", "../src/context/decorators/legacy/provide-context.ts", "../src/context/decorators/standard/provide-context.ts", "../src/context/decorators/provide-context.ts"],
4
4
  "sourcesContent": [
5
+ "type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
6
+ "/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
7
+ "import { escapeScriptJson } from '../tools/escape-script-json';\n\n/** Attribute marker used to identify hydration payloads inside a host. */\nexport const HYDRATION_ATTRIBUTE = 'data-hydration';\n/** Discriminator that scopes a hydration payload to a specific feature. */\nexport const HYDRATION_TYPE_ATTRIBUTE = 'data-hydration-type';\n/** Optional key that scopes a hydration payload to a specific decorated field. */\nexport const HYDRATION_KEY_ATTRIBUTE = 'data-hydration-key';\n\nexport type HydrationPayloadType = 'signal' | 'context';\n\ntype HydrationScriptHost = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\n/** Creates a `<script type=\"application/json\">` tag for a hydration payload. */\nexport function createHydrationScriptTag(options: {\n\ttype: HydrationPayloadType;\n\thydrationKey?: string;\n\tserializedValue: string;\n}): string {\n\tconst keyAttribute = options.hydrationKey\n\t\t? ` ${HYDRATION_KEY_ATTRIBUTE}=\"${escapeHtmlAttribute(options.hydrationKey)}\"`\n\t\t: '';\n\n\treturn `<script type=\"application/json\" ${HYDRATION_ATTRIBUTE} ${HYDRATION_TYPE_ATTRIBUTE}=\"${options.type}\"${keyAttribute}>${options.serializedValue}</script>`;\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeHydrationJson(value: string): string {\n\treturn escapeScriptJson(value);\n}\n\n/** Parses JSON from a hydration script element, returning the fallback on failure. */\nexport function parseHydrationPayload<T>(element: Element, fallback: T): T {\n\tconst textContent = element.textContent;\n\n\tif (!textContent) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(textContent) as T;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn(\n\t\t\t\t`[@ecopages/radiant] Failed to parse hydration payload from <script ${HYDRATION_ATTRIBUTE}>:`,\n\t\t\t\ttextContent.slice(0, 120),\n\t\t\t);\n\t\t}\n\t\treturn fallback;\n\t}\n}\n\n/**\n * Finds a hydration script element inside a host by type and optional key.\n *\n * When a key is provided, looks for an exact `data-hydration-key` match.\n * Otherwise, returns the first unkeyed script matching the type.\n */\nexport function findHydrationScript(\n\thost: HydrationScriptHost,\n\ttype: HydrationPayloadType,\n\thydrationKey?: string,\n): Element | null {\n\tconst children = host.children;\n\n\tif (!children || children.length === 0) {\n\t\tconst childNodes = (host as Partial<{ childNodes: ArrayLike<{ nodeType: number }> }>).childNodes;\n\n\t\tif (!childNodes || childNodes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (let i = 0; i < childNodes.length; i += 1) {\n\t\t\tconst node = childNodes[i]!;\n\n\t\t\tif (node.nodeType !== 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst element = node as unknown as Element;\n\n\t\t\tif (matchesHydrationScript(element, type, hydrationKey)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfor (let i = 0; i < children.length; i += 1) {\n\t\tif (matchesHydrationScript(children[i]!, type, hydrationKey)) {\n\t\t\treturn children[i]!;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction matchesHydrationScript(element: Element, type: HydrationPayloadType, hydrationKey?: string): boolean {\n\tif (\n\t\telement.tagName !== 'SCRIPT' ||\n\t\t!element.hasAttribute(HYDRATION_ATTRIBUTE) ||\n\t\telement.getAttribute(HYDRATION_TYPE_ATTRIBUTE) !== type\n\t) {\n\t\treturn false;\n\t}\n\n\tif (hydrationKey !== undefined) {\n\t\treturn element.getAttribute(HYDRATION_KEY_ATTRIBUTE) === hydrationKey;\n\t}\n\n\treturn !element.hasAttribute(HYDRATION_KEY_ATTRIBUTE);\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n",
8
+ "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\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\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\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\t| DirectContextSubscription<T>\n\t| SelectedContextSubscription<T, Selected>;\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\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\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, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
9
+ "import { createHydrationScriptTag, escapeHydrationJson } from '../core/hydration-codec';\n\n/**\n * Creates the raw `<script type=\"application/json\">` tag used to hydrate a\n * serialized context provider.\n */\nexport function createContextHydrationScriptTag(options: { hydrationKey?: string; serializedValue: string }): string {\n\treturn createHydrationScriptTag({ type: 'context', ...options });\n}\n\n/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * script tag.\n */\nexport function escapeContextHydrationJson(value: string): string {\n\treturn escapeHydrationJson(value);\n}\n",
10
+ "import type { UnknownContext } from './types';\n\ntype ContextHostApi = {\n\taddEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void;\n\tremoveEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | EventListenerOptions,\n\t): void;\n\tdispatchEvent(event: Event): boolean;\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tconnectedContextCallback(context: UnknownContext): void;\n\tregisterContextProvider(name: string, provider: unknown): void;\n};\n\ntype SsrHydrationContainer = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\nexport type ContextHydrationHost = Element | SsrHydrationContainer;\n\nexport type ContextHostLike =\n\t| (ContextHostApi & Element)\n\t| (ContextHostApi & { host: Element })\n\t| (ContextHostApi & { element: Element })\n\t| (ContextHostApi & SsrHydrationContainer);\n\nexport function resolveContextHostElement(host: ContextHostLike): Element | null {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\tif ('element' in host) {\n\t\treturn host.element;\n\t}\n\n\treturn null;\n}\n\nexport function resolveContextHydrationHost(host: ContextHostLike): ContextHydrationHost {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\tif ('element' in host) {\n\t\treturn host.element;\n\t}\n\n\treturn host;\n}\n",
11
+ "import { createMarkupNodeLike, type JsxRenderable } from '@ecopages/jsx';\nimport type { SsrSerializableHydrationBinding } from '../core/ssr-hydration-binding';\nimport type { AttributeTypeConstant } from '../utils/attribute-utils';\nimport {\n\tContextEventsTypes,\n\tContextOnMountEvent,\n\ttype ContextRequestEvent,\n\ttype ContextSubscription,\n\ttype ContextSubscriptionRequestEvent,\n} from './events';\nimport { findHydrationScript, parseHydrationPayload } from '../core/hydration-codec';\nimport { createContextHydrationScriptTag, escapeContextHydrationJson } from './hydration-script';\nimport type { Context, ContextType, UnknownContext } from './types';\nimport { resolveContextHydrationHost, type ContextHostLike } from './context-host';\n\ntype ContextProviderOptions<T extends UnknownContext> = {\n\tcontext: UnknownContext;\n\thydrationKey?: string;\n\tinitialValue?: T['__context__'];\n\thydrate?: AttributeTypeConstant;\n\tserialize?: (value: ContextType<T>) => unknown;\n};\n\ntype ActiveContextSubscription<T extends UnknownContext> = {\n\thasChanged(newContext: ContextType<T>, prevContext: ContextType<T> | undefined): boolean;\n\tnotify(context: ContextType<T>): void;\n\tunsubscribe: () => void;\n};\n\nexport interface SsrSerializableContextProvider extends SsrSerializableHydrationBinding {\n\t/** Returns the current context payload that should be visible to descendants. */\n\tgetContext(): unknown;\n\t/** Returns the context token used to match nested SSR consumers and providers. */\n\tgetContextKey(): UnknownContext;\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\t/**\n\t * Sets the context with the provided update and invokes the optional callback function.\n\t *\n\t * @param update - The partial update to be applied to the context.\n\t * @param callback - An optional callback function that receives the updated context.\n\t */\n\tsetContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;\n\n\t/**\n\t * Gets the current context.\n\t *\n\t * @returns The current context.\n\t */\n\tgetContext: () => ContextType<T>;\n\n\t/**\n\t * Subscribes to context updates.\n\t *\n\t * @param subscription - The subscription object that defines the callback function to be invoked on context updates.\n\t */\n\tsubscribe: <Selected = ContextType<T>>(subscription: ContextSubscription<T, Selected>) => () => 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>>\n\timplements IContextProvider<T>, SsrSerializableContextProvider\n{\n\tprivate host: ContextHostLike;\n\tprivate context: UnknownContext;\n\tprivate hydrationKey?: string;\n\tprivate hydrate?: AttributeTypeConstant;\n\tprivate serialize?: (value: ContextType<T>) => unknown;\n\tprivate pendingHostHydration: boolean;\n\tprivate value: ContextType<T> | undefined;\n\n\tsubscriptions: ActiveContextSubscription<T>[] = [];\n\n\t/**\n\t * Creates a new instance of the ContextProvider.\n\t *\n\t * @param host - The host element that will contain the context provider.\n\t * @param options - The options to configure the context provider.\n\t */\n\tconstructor(host: ContextHostLike, options: ContextProviderOptions<T>) {\n\t\tthis.host = host;\n\t\tthis.context = options.context;\n\t\tthis.hydrationKey = options.hydrationKey;\n\t\tthis.hydrate = options.hydrate;\n\t\tthis.serialize = options.serialize;\n\t\tthis.pendingHostHydration = Boolean(options.hydrate);\n\t\tthis.value = options.initialValue as ContextType<T>;\n\t\tthis.tryHydrateFromHost();\n\n\t\tthis.registerEvents();\n\t\tthis.host.dispatchEvent(new ContextOnMountEvent(this.context));\n\t}\n\n\tsetContext = (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => {\n\t\tthis.tryHydrateFromHost();\n\t\tthis.pendingHostHydration = false;\n\n\t\tif (typeof this.value === 'undefined' && this.isObject(update)) {\n\t\t\tconst oldContext = this.value;\n\t\t\tthis.value = { ...update } as ContextType<T>;\n\t\t\tif (callback) callback(this.value);\n\t\t\tthis.notifySubscribers(this.value, oldContext);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.isObject(this.value) && this.isObject(update)) {\n\t\t\tconst oldContext = { ...this.value };\n\t\t\tthis.value = { ...this.value, ...update };\n\t\t\tif (callback) callback(this.value);\n\t\t\tthis.notifySubscribers(this.value, oldContext);\n\t\t}\n\t};\n\n\tgetContext = () => {\n\t\tthis.tryHydrateFromHost();\n\t\treturn this.value as ContextType<T>;\n\t};\n\n\t/**\n\t * Returns the provider's logical context token.\n\t *\n\t * SSR helpers use this token to resolve the closest matching provider while a\n\t * host subtree is being serialized.\n\t */\n\tgetContextKey = () => {\n\t\treturn this.context;\n\t};\n\n\t/**\n\t * Serializes the current provider value for inclusion in a hydration script.\n\t *\n\t * The serialized payload is JSON-escaped so it can be embedded safely inside a\n\t * `<script type=\"application/json\">` tag.\n\t */\n\tserializeHydrationValue = (): string | undefined => {\n\t\tthis.tryHydrateFromHost();\n\n\t\tif (!this.hydrate || typeof this.value === 'undefined') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst hydrationValue = this.serialize ? this.serialize(this.value) : this.value;\n\n\t\tif (typeof hydrationValue === 'undefined') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst serializedValue = JSON.stringify(hydrationValue);\n\n\t\tif (typeof serializedValue !== 'string') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn escapeContextHydrationJson(serializedValue);\n\t};\n\n\t/**\n\t * Builds the raw HTML hydration script for this provider.\n\t *\n\t * When `hydrationKey` is present, the marker is scoped so sibling or nested\n\t * providers can recover their own payloads without accidentally reading a\n\t * descendant script.\n\t */\n\trenderHydrationScriptTag = (): string | undefined => {\n\t\tconst serializedValue = this.serializeHydrationValue();\n\n\t\tif (!serializedValue) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn createContextHydrationScriptTag({\n\t\t\thydrationKey: this.hydrationKey,\n\t\t\tserializedValue,\n\t\t});\n\t};\n\n\t/**\n\t * Wraps the provider hydration script in a minimal JSX node-like value.\n\t *\n\t * This lets JSX-based host renderers append the script without needing a real\n\t * DOM element instance during SSR.\n\t */\n\trenderHydrationScript = (): JsxRenderable | undefined => {\n\t\tconst outerHTML = this.renderHydrationScriptTag();\n\n\t\tif (!outerHTML) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn createMarkupNodeLike(outerHTML);\n\t};\n\n\tsubscribe = <Selected = ContextType<T>>(subscriptionSpec: ContextSubscription<T, Selected>) => {\n\t\tconst subscription: ActiveContextSubscription<T> = {\n\t\t\thasChanged: (newContext, prevContext) => {\n\t\t\t\tif (typeof prevContext === 'undefined' || !subscriptionSpec.select) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn subscriptionSpec.select(newContext) !== subscriptionSpec.select(prevContext);\n\t\t\t},\n\t\t\tnotify: (context) => {\n\t\t\t\tif (subscriptionSpec.select) {\n\t\t\t\t\tsubscriptionSpec.callback(subscriptionSpec.select(context), subscription.unsubscribe);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsubscriptionSpec.callback(context, subscription.unsubscribe);\n\t\t\t},\n\t\t\tunsubscribe: () => {\n\t\t\t\tconst index = this.subscriptions.indexOf(subscription);\n\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tthis.subscriptions.splice(index, 1);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tthis.subscriptions.push(subscription);\n\n\t\treturn subscription.unsubscribe;\n\t};\n\n\tprivate tryHydrateFromHost(): void {\n\t\tif (!this.pendingHostHydration) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst hydrationScriptElement = this.findHydrationScriptElement();\n\n\t\tif (!hydrationScriptElement) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.value = this.mergeHydrationValue(\n\t\t\tparseHydrationPayload(hydrationScriptElement, this.value) as ContextType<T>,\n\t\t);\n\t\tthis.pendingHostHydration = false;\n\t}\n\n\tprivate mergeHydrationValue(parsedHydrationValue: ContextType<T>): ContextType<T> {\n\t\tif (\n\t\t\tthis.hydrate === Object &&\n\t\t\tthis.isObject(parsedHydrationValue) &&\n\t\t\t(this.isObject(this.value) || typeof this.value === 'undefined')\n\t\t) {\n\t\t\treturn {\n\t\t\t\t...(this.value ?? {}),\n\t\t\t\t...parsedHydrationValue,\n\t\t\t} as ContextType<T>;\n\t\t}\n\n\t\treturn parsedHydrationValue;\n\t}\n\n\tprivate isObject(value: unknown): value is Record<string, unknown> {\n\t\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n\t}\n\n\tprivate findHydrationScriptElement(): Element | null {\n\t\treturn findHydrationScript(resolveContextHydrationHost(this.host), 'context', this.hydrationKey);\n\t}\n\n\tprivate notifySubscribers = (newContext: ContextType<T>, prevContext: ContextType<T> | undefined) => {\n\t\tfor (const sub of this.subscriptions) {\n\t\t\tif (sub.hasChanged(newContext, prevContext)) {\n\t\t\t\tsub.notify(newContext);\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate handleSubscriptionRequest = (\n\t\tsubscription: ContextSubscription<T, unknown>,\n\t\t{\n\t\t\tsubscribe,\n\t\t\tonSubscribe,\n\t\t}: {\n\t\t\tsubscribe?: boolean;\n\t\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t\t},\n\t) => {\n\t\tthis.tryHydrateFromHost();\n\t\tconst unsubscribe = subscribe ? this.subscribe(subscription) : undefined;\n\n\t\tif (unsubscribe) {\n\t\t\tonSubscribe?.(unsubscribe);\n\t\t}\n\n\t\tif (typeof this.value === 'undefined') return;\n\n\t\tif (subscription.select) {\n\t\t\tsubscription.callback(subscription.select(this.value), unsubscribe);\n\t\t} else {\n\t\t\tsubscription.callback(this.value, unsubscribe);\n\t\t}\n\t};\n\n\tprivate onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n\t\tconst { context, callback, subscribe, select, target, onSubscribe } = event;\n\t\tif (context !== this.context) return;\n\n\t\tevent.markHandled();\n\t\tevent.stopPropagation();\n\n\t\tif (target instanceof EventTarget) {\n\t\t\ttarget.dispatchEvent(new ContextOnMountEvent(this.context));\n\t\t}\n\n\t\tif (select) {\n\t\t\tthis.handleSubscriptionRequest({ select, callback }, { subscribe, onSubscribe });\n\t\t\treturn;\n\t\t}\n\n\t\tthis.handleSubscriptionRequest({ callback }, { subscribe, onSubscribe });\n\t};\n\n\tprivate onContextRequest = (event: ContextRequestEvent<UnknownContext>) => {\n\t\tconst { context, callback } = event;\n\t\tif (context !== this.context) return;\n\t\tevent.markHandled();\n\t\tevent.stopPropagation();\n\t\tcallback(this);\n\t};\n\n\tprivate registerEvents = () => {\n\t\tthis.host.addEventListener(\n\t\t\tContextEventsTypes.SUBSCRIPTION_REQUEST,\n\t\t\tthis.onSubscriptionRequest as EventListener,\n\t\t);\n\t\tthis.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.onContextRequest as EventListener);\n\t};\n}\n",
12
+ "import type { Method } from '../types';\n\ntype StandardFieldFn<Host extends object, Value, Result> = (\n\ttarget: undefined,\n\tcontext: ClassFieldDecoratorContext<Host, Value>,\n) => Result;\n\ntype LegacyFieldFn<Proto, Result> = (proto: Proto, name: string) => Result;\n\ntype StandardMethodFn<Host extends object, TMethod extends Method, Result> = (\n\ttarget: TMethod,\n\tcontext: ClassMethodDecoratorContext<Host, TMethod>,\n) => Result;\n\ntype LegacyMethodFn<Proto, Result> = (proto: Proto, name: string, descriptor: PropertyDescriptor) => Result;\n\nfunction isMethod(value: unknown): value is Method {\n\treturn typeof value === 'function';\n}\n\nexport function fieldDecoratorBridge<Host extends object, Value, Result, Proto>(\n\tstandard: StandardFieldFn<Host, Value, Result>,\n\tlegacy: LegacyFieldFn<Proto, void>,\n\tprotoOrTarget: undefined,\n\tnameOrContext: ClassFieldDecoratorContext<Host, Value>,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, Proto, Result>(\n\tstandard: StandardFieldFn<Host, Value, void>,\n\tlegacy: LegacyFieldFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardFieldFn<Host, Value, StandardResult>,\n\tlegacy: LegacyFieldFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | undefined,\n\tnameOrContext: string | ClassFieldDecoratorContext<Host, Value>,\n): StandardResult | LegacyResult;\n\nexport function fieldDecoratorBridge(\n\tstandard: StandardFieldFn<object, unknown, unknown>,\n\tlegacy: LegacyFieldFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassFieldDecoratorContext<object, unknown>,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\treturn standard(undefined, nameOrContext);\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext);\n}\n\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Result, Proto>(\n\tstandard: StandardMethodFn<Host, TMethod, Result>,\n\tlegacy: LegacyMethodFn<Proto, void>,\n\tprotoOrTarget: TMethod,\n\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: undefined,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Proto, Result>(\n\tstandard: StandardMethodFn<Host, TMethod, void>,\n\tlegacy: LegacyMethodFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n\tdescriptor: PropertyDescriptor,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardMethodFn<Host, TMethod, StandardResult>,\n\tlegacy: LegacyMethodFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | TMethod,\n\tnameOrContext: string | ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: PropertyDescriptor,\n): StandardResult | LegacyResult;\n\nexport function methodDecoratorBridge(\n\tstandard: StandardMethodFn<object, Method, unknown>,\n\tlegacy: LegacyMethodFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassMethodDecoratorContext<object, Method>,\n\tdescriptor?: PropertyDescriptor,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\tif (!isMethod(protoOrTarget)) {\n\t\t\tthrow new TypeError('Standard method decorators require a method target');\n\t\t}\n\n\t\treturn standard(protoOrTarget, nameOrContext);\n\t}\n\n\tif (!descriptor) {\n\t\tthrow new TypeError('Legacy method decorators require a property descriptor');\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext, descriptor);\n}\n",
13
+ "import { ContextProvider } from '../../../context/context-provider';\nimport type { UnknownContext } from '../../../context/types';\nimport type { ContextHostLike } from '../../context-host';\nimport { registerLegacyInstanceInitializer } from '../../../decorators/legacy/instance-initializers';\nimport type { ProvideContextOptions } from '../provide-context';\n\nexport function provideContext<T extends UnknownContext>({\n\tcontext,\n\tinitialValue,\n\thydrate,\n\tserialize,\n}: ProvideContextOptions<T>) {\n\treturn (proto: ContextHostLike, propertyKey: string) => {\n\t\tconst initializeProvider = (element: ContextHostLike) => {\n\t\t\tif ((element as any)[propertyKey]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst provider = new ContextProvider<T>(element, {\n\t\t\t\tcontext,\n\t\t\t\thydrationKey: propertyKey,\n\t\t\t\tinitialValue,\n\t\t\t\thydrate,\n\t\t\t\tserialize,\n\t\t\t});\n\t\t\t(element as any)[propertyKey] = provider;\n\t\t\telement.registerContextProvider(propertyKey, provider);\n\t\t\telement.connectedContextCallback(context);\n\t\t};\n\n\t\tregisterLegacyInstanceInitializer(proto, (element) => {\n\t\t\tinitializeProvider(element);\n\t\t\telement.registerConnectedCallback(() => {\n\t\t\t\tinitializeProvider(element);\n\t\t\t});\n\t\t});\n\t};\n}\n",
14
+ "import type { ContextHostLike } from '../../context-host';\nimport { ContextProvider } from '../../context-provider';\nimport type { UnknownContext } from '../../types';\nimport type { ProvideContextOptions } from '../provide-context';\n\nexport function provideContext<T extends UnknownContext>({\n\tcontext,\n\tinitialValue,\n\thydrate,\n\tserialize,\n}: ProvideContextOptions<T>) {\n\treturn <C extends ContextHostLike, V>(target: undefined, targetContext: ClassFieldDecoratorContext<C, V>) => {\n\t\tvoid target;\n\t\tconst contextName = String(targetContext.name);\n\t\ttargetContext.addInitializer(function (this: C) {\n\t\t\tconst hostRecord = this as C & Record<string, unknown>;\n\t\t\tconst provider = new ContextProvider<T>(this, {\n\t\t\t\tcontext,\n\t\t\t\thydrationKey: contextName,\n\t\t\t\tinitialValue,\n\t\t\t\thydrate,\n\t\t\t\tserialize,\n\t\t\t});\n\t\t\thostRecord[contextName] = provider;\n\t\t\tthis.registerContextProvider(contextName, provider);\n\t\t\tthis.connectedContextCallback(context);\n\t\t});\n\t};\n}\n",
15
+ "import type { AttributeTypeConstant } from '../../utils';\nimport type { ContextHostLike } from '../context-host';\nimport type { UnknownContext } from '../types';\nimport { provideContext as legacyProvideContext } from './legacy/provide-context';\nimport { provideContext as standardProvideContext } from './standard/provide-context';\nimport { fieldDecoratorBridge } from '../../decorators/bridge';\n\nexport type ProvideContextOptions<T extends UnknownContext> = {\n\t/** Context token made available to descendant consumers. */\n\tcontext: T;\n\t/** Client-side default value installed before any SSR hydration is merged. */\n\tinitialValue?: T['__context__'];\n\t/** Attribute type used to opt the provider into SSR hydration. */\n\thydrate?: AttributeTypeConstant;\n\t/**\n\t * Projects the current provider value into an SSR-safe hydration payload.\n\t *\n\t * Use this when the live client context includes instances or other values\n\t * that should stay client-only. When `hydrate: Object` is active, the parsed\n\t * payload merges back into `initialValue`, so omitted members keep their\n\t * client-side defaults.\n\t */\n\tserialize?: (value: T['__context__']) => unknown;\n};\n\n/**\n * A decorator to provide a context to the target element.\n * @param options {@link ProvideContextOptions}\n * @returns\n */\nexport function provideContext<T extends UnknownContext>(options: ProvideContextOptions<T>) {\n\tfunction decorator<Host extends ContextHostLike, V>(\n\t\tprotoOrTarget: undefined,\n\t\tnameOrContext: ClassFieldDecoratorContext<Host, V>,\n\t): void;\n\tfunction decorator(protoOrTarget: ContextHostLike, nameOrContext: string): void;\n\tfunction decorator(\n\t\tprotoOrTarget: ContextHostLike | undefined,\n\t\tnameOrContext: string | ClassFieldDecoratorContext<ContextHostLike, unknown>,\n\t): void {\n\t\treturn fieldDecoratorBridge(\n\t\t\tstandardProvideContext(options),\n\t\t\tlegacyProvideContext(options),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t);\n\t}\n\n\treturn decorator;\n}\n"
5
16
  ],
6
- "mappings": "",
7
- "debugId": "A93A96A0D175B10664756E2164756E21",
17
+ "mappings": "2PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAQzF,SAAS,CAAmD,CAClE,EACA,EACO,CAEP,IAAM,EADS,EACgB,GAE/B,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAO,EAA8B,CAC1D,MAAO,CAAC,CAAW,EACnB,aAAc,EACf,CAAC,EASK,SAAS,CAA+C,CAAC,EAAmB,CAClF,IAAM,EAAuB,CAAC,EAC1B,EAAmB,OAAO,eAAe,CAAQ,EAErD,MAAO,GAAoB,IAAqB,OAAO,UACtD,EAAW,KAAK,CAAgB,EAChC,EAAmB,OAAO,eAAe,CAAgB,EAG1D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AAS,CAAwC,EACvD,UACA,eACA,UACA,aAC4B,CAC5B,MAAO,CAA+B,EAAmB,IAAoD,CAE5G,IAAM,EAAc,OAAO,EAAc,IAAI,EAC7C,EAAc,eAAe,QAAS,EAAU,CAC/C,IAAM,EAAa,KACb,EAAW,IAAI,EAAmB,KAAM,CAC7C,UACA,aAAc,EACd,eACA,UACA,WACD,CAAC,EACD,EAAW,GAAe,EAC1B,KAAK,wBAAwB,EAAa,CAAQ,EAClD,KAAK,yBAAyB,CAAO,EACrC,GCII,SAAS,EAAwC,CAAC,EAAmC,CAM3F,SAAS,CAAS,CACjB,EACA,EACO,CACP,OAAO,EACN,EAAuB,CAAO,EAC9B,EAAqB,CAAO,EAC5B,EACA,CACD,EAGD,OAAO",
18
+ "debugId": "D55B62B41908539464756E2164756E21",
8
19
  "names": []
9
20
  }
@@ -1,3 +1,3 @@
1
- import type { RadiantElement } from '../../../core/radiant-element';
1
+ import type { ContextHostLike } from '../../context-host';
2
2
  import type { UnknownContext } from '../../types';
3
- export declare function consumeContext(consumedContext: UnknownContext): <T extends RadiantElement, V>(_: undefined, context: ClassFieldDecoratorContext<T, V>) => void;
3
+ export declare function consumeContext(consumedContext: UnknownContext): <T extends ContextHostLike, V>(target: undefined, context: ClassFieldDecoratorContext<T, V>) => void;
@@ -1,3 +1,3 @@
1
- import{x as a}from"../../../chunk-fs4j94bk.js";import"../../../chunk-p8k4g99a.js";import"../../../chunk-ek664x1c.js";import"../../../chunk-kmebacvv.js";import"../../../chunk-eyw14d6y.js";import"../../../chunk-t8xtvgyg.js";import"../../../chunk-vgtggzb6.js";export{a as consumeContext};
1
+ var T=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(w,Q)=>(typeof require<"u"?require:w)[Q]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var H=Symbol(),G=Symbol();function V(j,w){let J=j[H];if(Array.isArray(J)){J.push(w);return}Object.defineProperty(j,H,{value:[w],configurable:!0})}function k(j){let w=j,Q=w[H];if(!Array.isArray(Q))return;w[G]=!0;try{for(let J of Q)J()}finally{delete w[G]}}var z;((W)=>{W.SUBSCRIPTION_REQUEST="context-subscription-request";W.CONTEXT_REQUEST="context-request";W.ON_MOUNT="context-on-mount";W.MOUNTED="context-mounted"})(z||={});class M extends Event{context;callback;subscribe;handled=!1;constructor(j,w,Q){super("context-request",{bubbles:!0,composed:!0});this.context=j;this.callback=w;this.subscribe=Q}markHandled(){this.handled=!0}}class P extends CustomEvent{constructor(j){super("context-on-mount",{detail:{context:j},bubbles:!0,composed:!0})}}class U extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(j,w,Q,J,W){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=j;this.callback=w;this.select=Q;this.subscribe=J;this.onSubscribe=W}markHandled(){this.handled=!0}}var B=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function I(){return globalThis}function E(j){I()[B]=j}function X(j){return I()[B]?.(j)}function Y(j,w,Q,J={}){let W=X(w);if(!W)return!1;if(Q(W),j.connectedContextCallback(w),J.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:W}));return!0}function y(j,w,Q,J={}){let W=new M(w,(Z)=>{if(Q(Z),j.connectedContextCallback(w),J.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:Z}))});return j.dispatchEvent(W),W.handled}function D(j,w){let Q=X(j);if(!Q)return!1;let J=Q.getContext();if(w.select)return w.callback(w.select(J)),!0;return w.callback(J),!0}function f(j,w,Q,J){let W=new U(w,Q.callback,Q.select,J.subscribe,J.onSubscribe);return j.dispatchEvent(W),W.handled}function L(j,w,Q,J={}){return O(j,()=>Y(j,w,Q,J))}function C(j,w,Q,J){return O(j,()=>{if(J)return D(w,{callback:Q,select:J});return D(w,{callback:Q})})}function N(j,w,Q,J={}){if(Y(j,w,Q,J))return!0;return y(j,w,Q,J)}function h(j,w,Q,J={}){if(J.select){let Z={callback:Q,select:J.select};if(D(w,Z))return!0;return f(j,w,Z,{subscribe:J.subscribe,onSubscribe:J.onSubscribe})}let W={callback:Q};if(D(w,W))return!0;return f(j,w,W,{subscribe:J.subscribe,onSubscribe:J.onSubscribe})}function O(j,w){return V(j,w),w()}function p(j){return(w,Q)=>{let J=String(Q.name),W=($,F)=>{let K=$;K[J]=F},Z=($,F={})=>{if($[J])return!0;return N($,j,(m)=>{W($,m)},F)};Q.addInitializer(function(){if(L(this,j,($)=>{W(this,$)},{emitMounted:!0}))return;this.registerConnectedCallback(()=>{if(Z(this,{emitMounted:!0}))return;queueMicrotask(()=>{Z(this,{emitMounted:!0})})})})}}export{p as consumeContext};
2
2
 
3
- //# debugId=398BFFE041CCB3A464756E2164756E21
3
+ //# debugId=65D62E268412FA0764756E2164756E21
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/core/ssr-preparation.ts", "../src/context/events.ts", "../src/context/context-ssr-bridge.ts", "../src/context/context-consumer-runtime.ts", "../src/context/context-consumer-bootstrap.ts", "../src/context/decorators/standard/consume-context.ts"],
4
4
  "sourcesContent": [
5
+ "type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol();\nexport const SSR_PREPARATION_RUNNING = Symbol();\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\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\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\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\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\t| DirectContextSubscription<T>\n\t| SelectedContextSubscription<T, Selected>;\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\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\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, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
7
+ "import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
8
+ "import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\t| DirectContextSelectionRequest<TContext>\n\t| SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n",
9
+ "import type { ContextHostLike } from './context-host';\nimport { registerSsrPreparationCallback } from '../core/ssr-preparation';\nimport {\n\tinitializeConsumedContext,\n\tinitializeContextSelection,\n\trequestConsumedContext,\n\trequestContextSelection,\n} from './context-consumer-runtime';\nimport type { ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\n/**\n * Resolves a consumed context immediately and registers the same resolution to\n * run again during the later SSR preparation phase.\n *\n * This keeps constructor-time state and pre-serialization state aligned after\n * instance fields, props, or authored host content change during SSR setup.\n */\nexport function bootstrapSsrConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => initializeConsumedContext(host, context, assign, options));\n}\n\n/**\n * Resolves a selected context value immediately and registers the same\n * selection for the later SSR preparation phase.\n *\n * This lets nested SSR renders recompute selector-backed state after the host\n * has finished construction and any server-side configuration hooks have run.\n */\nexport function bootstrapSsrContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: object,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\tselect?: (context: ContextType<TContext>) => Selected,\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => {\n\t\tif (select) {\n\t\t\treturn initializeContextSelection(context, { callback, select });\n\t\t}\n\n\t\treturn initializeContextSelection(context, {\n\t\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t\t});\n\t});\n}\n\n/**\n * Resolves a consumed context from SSR when available, otherwise requests it\n * through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tif (initializeConsumedContext(host, context, assign, options)) {\n\t\treturn true;\n\t}\n\n\treturn requestConsumedContext(host, context, assign, options);\n}\n\n/**\n * Resolves a selected context value from SSR when available, otherwise requests\n * it through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\toptions: {\n\t\tselect?: (context: ContextType<TContext>) => Selected;\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t} = {},\n): boolean {\n\tif (options.select) {\n\t\tconst request = { callback, select: options.select };\n\n\t\tif (initializeContextSelection(context, request)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn requestContextSelection(host, context, request, {\n\t\t\tsubscribe: options.subscribe,\n\t\t\tonSubscribe: options.onSubscribe,\n\t\t});\n\t}\n\n\tconst request = {\n\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t};\n\n\tif (initializeContextSelection(context, request)) {\n\t\treturn true;\n\t}\n\n\treturn requestContextSelection(host, context, request, {\n\t\tsubscribe: options.subscribe,\n\t\tonSubscribe: options.onSubscribe,\n\t});\n}\n\nfunction registerAndResolveConsumerBootstrap<TResult>(host: object, resolve: () => TResult): TResult {\n\tregisterSsrPreparationCallback(host, resolve);\n\treturn resolve();\n}\n",
10
+ "import type { ContextHostLike } from '../../context-host';\nimport { bootstrapSsrConsumedContext, connectConsumedContext } from '../../context-consumer-bootstrap';\nimport type { UnknownContext } from '../../types';\n\nexport function consumeContext(consumedContext: UnknownContext) {\n\treturn <T extends ContextHostLike, V>(target: undefined, context: ClassFieldDecoratorContext<T, V>) => {\n\t\tvoid target;\n\t\tconst contextName = String(context.name);\n\t\tconst assignContextProvider = (host: T, provider: unknown) => {\n\t\t\tconst hostRecord = host as T & Record<string, unknown>;\n\t\t\thostRecord[contextName] = provider;\n\t\t};\n\t\tconst initializeConsumedContextForHost = (host: T, options: { emitMounted?: boolean } = {}) => {\n\t\t\tconst hostRecord = host as T & Record<string, unknown>;\n\n\t\t\tif (hostRecord[contextName]) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn connectConsumedContext(\n\t\t\t\thost,\n\t\t\t\tconsumedContext,\n\t\t\t\t(provider) => {\n\t\t\t\t\tassignContextProvider(host, provider);\n\t\t\t\t},\n\t\t\t\toptions,\n\t\t\t);\n\t\t};\n\n\t\tcontext.addInitializer(function (this: T) {\n\t\t\tif (\n\t\t\t\tbootstrapSsrConsumedContext(\n\t\t\t\t\tthis,\n\t\t\t\t\tconsumedContext,\n\t\t\t\t\t(provider) => {\n\t\t\t\t\t\tassignContextProvider(this, provider);\n\t\t\t\t\t},\n\t\t\t\t\t{ emitMounted: true },\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.registerConnectedCallback(() => {\n\t\t\t\tif (initializeConsumedContextForHost(this, { emitMounted: true })) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tinitializeConsumedContextForHost(this, { emitMounted: true });\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n}\n"
5
11
  ],
6
- "mappings": "",
7
- "debugId": "398BFFE041CCB3A464756E2164756E21",
12
+ "mappings": "2PAEA,IAAM,EAA4B,OAAO,EAC5B,EAA0B,OAAO,EASvC,SAAS,CAA8B,CAAC,EAAc,EAAwC,CAEpG,IAAM,EADS,EACkB,GAEjC,GAAI,MAAM,QAAQ,CAAiB,EAAG,CACrC,EAAkB,KAAK,CAAQ,EAC/B,OAGD,OAAO,eAAe,EAAM,EAA2B,CACtD,MAAO,CAAC,CAAQ,EAChB,aAAc,EACf,CAAC,EASK,SAAS,CAA0B,CAAC,EAAoB,CAC9D,IAAM,EAAS,EACT,EAAY,EAAO,GAEzB,GAAI,CAAC,MAAM,QAAQ,CAAS,EAC3B,OAGD,EAAO,GAA2B,GAElC,GAAI,CACH,QAAW,KAAY,EACtB,EAAS,SAET,CACD,OAAO,EAAO,IC3CT,IAAK,GAAL,CAAK,IAAL,CACN,uB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AO,GAGR,OAAO,EAAwB,EAAM,EAAS,EAAS,CACtD,UAAW,EAAQ,UACnB,YAAa,EAAQ,WACtB,CAAC,EAGF,IAAM,EAAU,CACf,SAAU,CACX,EAEA,GAAI,EAA2B,EAAS,CAAO,EAC9C,MAAO,GAGR,OAAO,EAAwB,EAAM,EAAS,EAAS,CACtD,UAAW,EAAQ,UACnB,YAAa,EAAQ,WACtB,CAAC,EAGF,SAAS,CAA4C,CAAC,EAAc,EAAiC,CAEpG,OADA,EAA+B,EAAM,CAAO,EACrC,EAAQ,EChHT,SAAS,CAAc,CAAC,EAAiC,CAC/D,MAAO,CAA+B,EAAmB,IAA8C,CAEtG,IAAM,EAAc,OAAO,EAAQ,IAAI,EACjC,EAAwB,CAAC,EAAS,IAAsB,CAC7D,IAAM,EAAa,EACnB,EAAW,GAAe,GAErB,EAAmC,CAAC,EAAS,EAAqC,CAAC,IAAM,CAG9F,GAFmB,EAEJ,GACd,MAAO,GAGR,OAAO,EACN,EACA,EACA,CAAC,IAAa,CACb,EAAsB,EAAM,CAAQ,GAErC,CACD,GAGD,EAAQ,eAAe,QAAS,EAAU,CACzC,GACC,EACC,KACA,EACA,CAAC,IAAa,CACb,EAAsB,KAAM,CAAQ,GAErC,CAAE,YAAa,EAAK,CACrB,EAEA,OAGD,KAAK,0BAA0B,IAAM,CACpC,GAAI,EAAiC,KAAM,CAAE,YAAa,EAAK,CAAC,EAC/D,OAGD,eAAe,IAAM,CACpB,EAAiC,KAAM,CAAE,YAAa,EAAK,CAAC,EAC5D,EACD,EACD",
13
+ "debugId": "65D62E268412FA0764756E2164756E21",
8
14
  "names": []
9
15
  }
@@ -1,8 +1,8 @@
1
- import type { RadiantElement } from '../../../core/radiant-element';
1
+ import type { ContextHostLike } from '../../context-host';
2
2
  import type { Context, ContextType } from '../../types';
3
3
  export type ContextSelectorFieldOptions<T extends Context<unknown, unknown>, Selected = ContextType<T>> = {
4
4
  context: T;
5
5
  select?: (context: ContextType<T>) => Selected;
6
6
  subscribe?: boolean;
7
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;
8
+ export declare function contextSelectorField<T extends Context<unknown, unknown>, Selected = ContextType<T>>(options: ContextSelectorFieldOptions<T, Selected>): <Host extends ContextHostLike>(_: undefined, fieldContext: ClassFieldDecoratorContext<Host, Selected>) => (this: Host, initialValue: Selected) => Selected;
@@ -1,3 +1,3 @@
1
- import{D as a}from"../../../chunk-g2z3mm6b.js";import"../../../chunk-5bkat72n.js";import"../../../chunk-p8k4g99a.js";import"../../../chunk-ek664x1c.js";import"../../../chunk-kmebacvv.js";import"../../../chunk-eyw14d6y.js";import"../../../chunk-t8xtvgyg.js";import"../../../chunk-vgtggzb6.js";export{a as contextSelectorField};
1
+ var k=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(w,f)=>(typeof require<"u"?require:w)[f]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var D=Symbol(),Z=Symbol();function B(j,w){let U=j[D];if(Array.isArray(U)){U.push(w);return}Object.defineProperty(j,D,{value:[w],configurable:!0})}function E(j){let w=j,f=w[D];if(!Array.isArray(f))return;w[Z]=!0;try{for(let U of f)U()}finally{delete w[Z]}}var I;((F)=>{F.SUBSCRIPTION_REQUEST="context-subscription-request";F.CONTEXT_REQUEST="context-request";F.ON_MOUNT="context-on-mount";F.MOUNTED="context-mounted"})(I||={});class K extends Event{context;callback;subscribe;handled=!1;constructor(j,w,f){super("context-request",{bubbles:!0,composed:!0});this.context=j;this.callback=w;this.subscribe=f}markHandled(){this.handled=!0}}class _ extends CustomEvent{constructor(j){super("context-on-mount",{detail:{context:j},bubbles:!0,composed:!0})}}class M extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(j,w,f,U,F){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=j;this.callback=w;this.select=f;this.subscribe=U;this.onSubscribe=F}markHandled(){this.handled=!0}}var y=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function L(){return globalThis}function u(j){L()[y]=j}function V(j){return L()[y]?.(j)}function X(j,w,f,U={}){let F=V(w);if(!F)return!1;if(f(F),j.connectedContextCallback(w),U.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:F}));return!0}function N(j,w,f,U={}){let F=new K(w,(H)=>{if(f(H),j.connectedContextCallback(w),U.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:H}))});return j.dispatchEvent(F),F.handled}function W(j,w){let f=V(j);if(!f)return!1;let U=f.getContext();if(w.select)return w.callback(w.select(U)),!0;return w.callback(U),!0}function Y(j,w,f,U){let F=new M(w,f.callback,f.select,U.subscribe,U.onSubscribe);return j.dispatchEvent(F),F.handled}function p(j,w,f,U={}){return m(j,()=>X(j,w,f,U))}function O(j,w,f,U){return m(j,()=>{if(U)return W(w,{callback:f,select:U});return W(w,{callback:f})})}function x(j,w,f,U={}){if(X(j,w,f,U))return!0;return N(j,w,f,U)}function P(j,w,f,U={}){if(U.select){let H={callback:f,select:U.select};if(W(w,H))return!0;return Y(j,w,H,{subscribe:U.subscribe,onSubscribe:U.onSubscribe})}let F={callback:f};if(W(w,F))return!0;return Y(j,w,F,{subscribe:U.subscribe,onSubscribe:U.onSubscribe})}function m(j,w){return B(j,w),w()}function q(j,w,f){let U=!1,F,H=j;return(J)=>{if(H[Z]!==!0&&U&&Object.is(F,J))return;if(U=!0,F=J,w(J),f&&typeof H.requestUpdate==="function")H.requestUpdate()}}function n(j){let{context:w,select:f,subscribe:U=!0}=j;return function(F,H){let J=String(H.name);return H.addInitializer(function(){let Q,z=q(this,($)=>{let T=this;T[J]=$},!0);if(O(this,w,z,f))return;let G=()=>{return P(this,w,z,{onSubscribe:($)=>{Q=$},select:f,subscribe:U})};this.registerCleanupCallback(()=>{Q?.(),Q=void 0}),this.registerConnectedCallback(()=>{if(G())return;queueMicrotask(()=>{G()})})}),function(Q){return Q}}}export{n as contextSelectorField};
2
2
 
3
- //# debugId=28981E6A4741D49664756E2164756E21
3
+ //# debugId=72BFDED708B1295664756E2164756E21
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/core/ssr-preparation.ts", "../src/context/events.ts", "../src/context/context-ssr-bridge.ts", "../src/context/context-consumer-runtime.ts", "../src/context/context-consumer-bootstrap.ts", "../src/context/decorators/context-selection-delivery.ts", "../src/context/decorators/standard/context-selector-field.ts"],
4
4
  "sourcesContent": [
5
+ "type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol();\nexport const SSR_PREPARATION_RUNNING = Symbol();\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\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\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\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\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\t| DirectContextSubscription<T>\n\t| SelectedContextSubscription<T, Selected>;\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\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\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, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
7
+ "import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
8
+ "import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\t| DirectContextSelectionRequest<TContext>\n\t| SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n",
9
+ "import type { ContextHostLike } from './context-host';\nimport { registerSsrPreparationCallback } from '../core/ssr-preparation';\nimport {\n\tinitializeConsumedContext,\n\tinitializeContextSelection,\n\trequestConsumedContext,\n\trequestContextSelection,\n} from './context-consumer-runtime';\nimport type { ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\n/**\n * Resolves a consumed context immediately and registers the same resolution to\n * run again during the later SSR preparation phase.\n *\n * This keeps constructor-time state and pre-serialization state aligned after\n * instance fields, props, or authored host content change during SSR setup.\n */\nexport function bootstrapSsrConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => initializeConsumedContext(host, context, assign, options));\n}\n\n/**\n * Resolves a selected context value immediately and registers the same\n * selection for the later SSR preparation phase.\n *\n * This lets nested SSR renders recompute selector-backed state after the host\n * has finished construction and any server-side configuration hooks have run.\n */\nexport function bootstrapSsrContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: object,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\tselect?: (context: ContextType<TContext>) => Selected,\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => {\n\t\tif (select) {\n\t\t\treturn initializeContextSelection(context, { callback, select });\n\t\t}\n\n\t\treturn initializeContextSelection(context, {\n\t\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t\t});\n\t});\n}\n\n/**\n * Resolves a consumed context from SSR when available, otherwise requests it\n * through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tif (initializeConsumedContext(host, context, assign, options)) {\n\t\treturn true;\n\t}\n\n\treturn requestConsumedContext(host, context, assign, options);\n}\n\n/**\n * Resolves a selected context value from SSR when available, otherwise requests\n * it through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\toptions: {\n\t\tselect?: (context: ContextType<TContext>) => Selected;\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t} = {},\n): boolean {\n\tif (options.select) {\n\t\tconst request = { callback, select: options.select };\n\n\t\tif (initializeContextSelection(context, request)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn requestContextSelection(host, context, request, {\n\t\t\tsubscribe: options.subscribe,\n\t\t\tonSubscribe: options.onSubscribe,\n\t\t});\n\t}\n\n\tconst request = {\n\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t};\n\n\tif (initializeContextSelection(context, request)) {\n\t\treturn true;\n\t}\n\n\treturn requestContextSelection(host, context, request, {\n\t\tsubscribe: options.subscribe,\n\t\tonSubscribe: options.onSubscribe,\n\t});\n}\n\nfunction registerAndResolveConsumerBootstrap<TResult>(host: object, resolve: () => TResult): TResult {\n\tregisterSsrPreparationCallback(host, resolve);\n\treturn resolve();\n}\n",
10
+ "import { SSR_PREPARATION_RUNNING } from '../../core/ssr-preparation';\n\ntype RequestUpdateCapable = {\n\trequestUpdate(): void;\n};\n\nexport function createContextSelectionDelivery<Value>(\n\thost: object,\n\tapply: (value: Value) => void,\n\trequestUpdate: boolean,\n) {\n\tlet hasDeliveredValue = false;\n\tlet previousValue: Value;\n\tconst target = host as Record<PropertyKey, unknown>;\n\n\treturn (value: Value) => {\n\t\tif (target[SSR_PREPARATION_RUNNING] !== true && hasDeliveredValue && Object.is(previousValue, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\thasDeliveredValue = true;\n\t\tpreviousValue = value;\n\t\tapply(value);\n\n\t\tif (requestUpdate && typeof target.requestUpdate === 'function') {\n\t\t\t(target as RequestUpdateCapable).requestUpdate();\n\t\t}\n\t};\n}\n",
11
+ "import type { ContextHostLike } from '../../context-host';\nimport { bootstrapSsrContextSelection, connectContextSelection } from '../../context-consumer-bootstrap';\nimport type { Context, ContextType } from '../../types';\nimport { createContextSelectionDelivery } from '../context-selection-delivery';\n\nexport type ContextSelectorFieldOptions<T extends Context<unknown, unknown>, Selected = ContextType<T>> = {\n\tcontext: T;\n\tselect?: (context: ContextType<T>) => Selected;\n\tsubscribe?: boolean;\n};\n\nexport function contextSelectorField<T extends Context<unknown, unknown>, Selected = ContextType<T>>(\n\toptions: ContextSelectorFieldOptions<T, Selected>,\n) {\n\tconst { context, select, subscribe = true } = options;\n\n\treturn function <Host extends ContextHostLike>(\n\t\t_: undefined,\n\t\tfieldContext: ClassFieldDecoratorContext<Host, Selected>,\n\t) {\n\t\tconst propertyName = String(fieldContext.name);\n\n\t\tfieldContext.addInitializer(function (this: Host) {\n\t\t\tlet activeUnsubscribe: (() => void) | undefined;\n\t\t\tconst applyValue = createContextSelectionDelivery<Selected>(\n\t\t\t\tthis,\n\t\t\t\t(value) => {\n\t\t\t\t\tconst record = this as unknown as Record<string, unknown>;\n\t\t\t\t\trecord[propertyName] = value;\n\t\t\t\t},\n\t\t\t\ttrue,\n\t\t\t);\n\n\t\t\tif (bootstrapSsrContextSelection<T, Selected>(this, context, applyValue, select)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst connectSelection = () => {\n\t\t\t\treturn connectContextSelection<T, Selected>(this, context, applyValue, {\n\t\t\t\t\tonSubscribe: (unsubscribe) => {\n\t\t\t\t\t\tactiveUnsubscribe = unsubscribe;\n\t\t\t\t\t},\n\t\t\t\t\tselect,\n\t\t\t\t\tsubscribe,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tthis.registerCleanupCallback(() => {\n\t\t\t\tactiveUnsubscribe?.();\n\t\t\t\tactiveUnsubscribe = undefined;\n\t\t\t});\n\n\t\t\tthis.registerConnectedCallback(() => {\n\t\t\t\tif (connectSelection()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconnectSelection();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn function (this: Host, initialValue: Selected) {\n\t\t\treturn initialValue;\n\t\t};\n\t};\n}\n"
5
12
  ],
6
- "mappings": "",
7
- "debugId": "28981E6A4741D49664756E2164756E21",
13
+ "mappings": "2PAEA,IAAM,EAA4B,OAAO,E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OAzCA,EAAa,eAAe,QAAS,EAAa,CACjD,IAAI,EACE,EAAa,EAClB,KACA,CAAC,IAAU,CACV,IAAM,EAAS,KACf,EAAO,GAAgB,GAExB,EACD,EAEA,GAAI,EAA0C,KAAM,EAAS,EAAY,CAAM,EAC9E,OAGD,IAAM,EAAmB,IAAM,CAC9B,OAAO,EAAqC,KAAM,EAAS,EAAY,CACtE,YAAa,CAAC,IAAgB,CAC7B,EAAoB,GAErB,SACA,WACD,CAAC,GAGF,KAAK,wBAAwB,IAAM,CAClC,IAAoB,EACpB,EAAoB,OACpB,EAED,KAAK,0BAA0B,IAAM,CACpC,GAAI,EAAiB,EACpB,OAGD,eAAe,IAAM,CACpB,EAAiB,EACjB,EACD,EACD,EAEM,QAAS,CAAa,EAAwB,CACpD,OAAO",
14
+ "debugId": "72BFDED708B1295664756E2164756E21",
8
15
  "names": []
9
16
  }
@@ -1,5 +1,4 @@
1
- import type { Method } from '../../../types';
2
- import type { RadiantElement } from '../../../core/radiant-element';
1
+ import type { ContextHostLike } from '../../context-host';
3
2
  import type { Context, ContextType } from '../../types';
4
3
  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;
4
+ export declare function contextSelector<T extends Context<unknown, unknown>, Selected = ContextType<T>>({ context, select, subscribe, requestUpdate, }: OnContextUpdateOptions<T, Selected>): <Host extends ContextHostLike, TMethod extends (value: Selected) => unknown>(originalMethod: TMethod, targetContext: ClassMethodDecoratorContext<Host, TMethod>) => void;
@@ -1,3 +1,3 @@
1
- import{E as a}from"../../../chunk-x2k0ngpz.js";import"../../../chunk-5bkat72n.js";import"../../../chunk-p8k4g99a.js";import"../../../chunk-ek664x1c.js";import"../../../chunk-kmebacvv.js";import"../../../chunk-eyw14d6y.js";import"../../../chunk-t8xtvgyg.js";import"../../../chunk-vgtggzb6.js";export{a as contextSelector};
1
+ var _=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(j,w)=>(typeof require<"u"?require:j)[w]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var $=Symbol(),W=Symbol();function M(f,j){let V=f[$];if(Array.isArray(V)){V.push(j);return}Object.defineProperty(f,$,{value:[j],configurable:!0})}function k(f){let j=f,w=j[$];if(!Array.isArray(w))return;j[W]=!0;try{for(let V of w)V()}finally{delete j[W]}}var B;((F)=>{F.SUBSCRIPTION_REQUEST="context-subscription-request";F.CONTEXT_REQUEST="context-request";F.ON_MOUNT="context-on-mount";F.MOUNTED="context-mounted"})(B||={});class D extends Event{context;callback;subscribe;handled=!1;constructor(f,j,w){super("context-request",{bubbles:!0,composed:!0});this.context=f;this.callback=j;this.subscribe=w}markHandled(){this.handled=!0}}class T extends CustomEvent{constructor(f){super("context-on-mount",{detail:{context:f},bubbles:!0,composed:!0})}}class U extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(f,j,w,V,F){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=f;this.callback=j;this.select=w;this.subscribe=V;this.onSubscribe=F}markHandled(){this.handled=!0}}var I=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function y(){return globalThis}function g(f){y()[I]=f}function K(f){return y()[I]?.(f)}function X(f,j,w,V={}){let F=K(j);if(!F)return!1;if(w(F),f.connectedContextCallback(j),V.emitMounted)f.dispatchEvent(new CustomEvent("context-mounted",{detail:F}));return!0}function N(f,j,w,V={}){let F=new D(j,(H)=>{if(w(H),f.connectedContextCallback(j),V.emitMounted)f.dispatchEvent(new CustomEvent("context-mounted",{detail:H}))});return f.dispatchEvent(F),F.handled}function Q(f,j){let w=K(f);if(!w)return!1;let V=w.getContext();if(j.select)return j.callback(j.select(V)),!0;return j.callback(V),!0}function Y(f,j,w,V){let F=new U(j,w.callback,w.select,V.subscribe,V.onSubscribe);return f.dispatchEvent(F),F.handled}function h(f,j,w,V={}){return m(f,()=>X(f,j,w,V))}function L(f,j,w,V){return m(f,()=>{if(V)return Q(j,{callback:w,select:V});return Q(j,{callback:w})})}function v(f,j,w,V={}){if(X(f,j,w,V))return!0;return N(f,j,w,V)}function O(f,j,w,V={}){if(V.select){let H={callback:w,select:V.select};if(Q(j,H))return!0;return Y(f,j,H,{subscribe:V.subscribe,onSubscribe:V.onSubscribe})}let F={callback:w};if(Q(j,F))return!0;return Y(f,j,F,{subscribe:V.subscribe,onSubscribe:V.onSubscribe})}function m(f,j){return M(f,j),j()}function P(f,j,w){let V=!1,F,H=f;return(J)=>{if(H[W]!==!0&&V&&Object.is(F,J))return;if(V=!0,F=J,j(J),w&&typeof H.requestUpdate==="function")H.requestUpdate()}}function i({context:f,select:j,subscribe:w=!0,requestUpdate:V=!0}){return function(F,H){H.addInitializer(function(){let J,z=P(this,(Z)=>{F.call(this,Z)},V);if(L(this,f,z,j))return;let G=()=>{return O(this,f,z,{onSubscribe:(Z)=>{J=Z},select:j,subscribe:w})};this.registerCleanupCallback(()=>{J?.(),J=void 0}),this.registerConnectedCallback(()=>{if(G())return;queueMicrotask(()=>{G()})})})}}export{i as contextSelector};
2
2
 
3
- //# debugId=D78E4F19FE74240B64756E2164756E21
3
+ //# debugId=264DCF2CCB0FB5CC64756E2164756E21
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
3
+ "sources": ["../src/core/ssr-preparation.ts", "../src/context/events.ts", "../src/context/context-ssr-bridge.ts", "../src/context/context-consumer-runtime.ts", "../src/context/context-consumer-bootstrap.ts", "../src/context/decorators/context-selection-delivery.ts", "../src/context/decorators/standard/context-selector.ts"],
4
4
  "sourcesContent": [
5
+ "type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol();\nexport const SSR_PREPARATION_RUNNING = Symbol();\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\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\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\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\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\t| DirectContextSubscription<T>\n\t| SelectedContextSubscription<T, Selected>;\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\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\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, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
7
+ "import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
8
+ "import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\t| DirectContextSelectionRequest<TContext>\n\t| SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n",
9
+ "import type { ContextHostLike } from './context-host';\nimport { registerSsrPreparationCallback } from '../core/ssr-preparation';\nimport {\n\tinitializeConsumedContext,\n\tinitializeContextSelection,\n\trequestConsumedContext,\n\trequestContextSelection,\n} from './context-consumer-runtime';\nimport type { ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\n/**\n * Resolves a consumed context immediately and registers the same resolution to\n * run again during the later SSR preparation phase.\n *\n * This keeps constructor-time state and pre-serialization state aligned after\n * instance fields, props, or authored host content change during SSR setup.\n */\nexport function bootstrapSsrConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => initializeConsumedContext(host, context, assign, options));\n}\n\n/**\n * Resolves a selected context value immediately and registers the same\n * selection for the later SSR preparation phase.\n *\n * This lets nested SSR renders recompute selector-backed state after the host\n * has finished construction and any server-side configuration hooks have run.\n */\nexport function bootstrapSsrContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: object,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\tselect?: (context: ContextType<TContext>) => Selected,\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => {\n\t\tif (select) {\n\t\t\treturn initializeContextSelection(context, { callback, select });\n\t\t}\n\n\t\treturn initializeContextSelection(context, {\n\t\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t\t});\n\t});\n}\n\n/**\n * Resolves a consumed context from SSR when available, otherwise requests it\n * through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tif (initializeConsumedContext(host, context, assign, options)) {\n\t\treturn true;\n\t}\n\n\treturn requestConsumedContext(host, context, assign, options);\n}\n\n/**\n * Resolves a selected context value from SSR when available, otherwise requests\n * it through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\toptions: {\n\t\tselect?: (context: ContextType<TContext>) => Selected;\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t} = {},\n): boolean {\n\tif (options.select) {\n\t\tconst request = { callback, select: options.select };\n\n\t\tif (initializeContextSelection(context, request)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn requestContextSelection(host, context, request, {\n\t\t\tsubscribe: options.subscribe,\n\t\t\tonSubscribe: options.onSubscribe,\n\t\t});\n\t}\n\n\tconst request = {\n\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t};\n\n\tif (initializeContextSelection(context, request)) {\n\t\treturn true;\n\t}\n\n\treturn requestContextSelection(host, context, request, {\n\t\tsubscribe: options.subscribe,\n\t\tonSubscribe: options.onSubscribe,\n\t});\n}\n\nfunction registerAndResolveConsumerBootstrap<TResult>(host: object, resolve: () => TResult): TResult {\n\tregisterSsrPreparationCallback(host, resolve);\n\treturn resolve();\n}\n",
10
+ "import { SSR_PREPARATION_RUNNING } from '../../core/ssr-preparation';\n\ntype RequestUpdateCapable = {\n\trequestUpdate(): void;\n};\n\nexport function createContextSelectionDelivery<Value>(\n\thost: object,\n\tapply: (value: Value) => void,\n\trequestUpdate: boolean,\n) {\n\tlet hasDeliveredValue = false;\n\tlet previousValue: Value;\n\tconst target = host as Record<PropertyKey, unknown>;\n\n\treturn (value: Value) => {\n\t\tif (target[SSR_PREPARATION_RUNNING] !== true && hasDeliveredValue && Object.is(previousValue, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\thasDeliveredValue = true;\n\t\tpreviousValue = value;\n\t\tapply(value);\n\n\t\tif (requestUpdate && typeof target.requestUpdate === 'function') {\n\t\t\t(target as RequestUpdateCapable).requestUpdate();\n\t\t}\n\t};\n}\n",
11
+ "import type { ContextHostLike } from '../../context-host';\nimport { bootstrapSsrContextSelection, connectContextSelection } from '../../context-consumer-bootstrap';\nimport type { Context, ContextType } from '../../types';\nimport type { OnContextUpdateOptions } from '../on-context-update';\nimport { createContextSelectionDelivery } from '../context-selection-delivery';\n\nexport function contextSelector<T extends Context<unknown, unknown>, Selected = ContextType<T>>({\n\tcontext,\n\tselect,\n\tsubscribe = true,\n\trequestUpdate = true,\n}: OnContextUpdateOptions<T, Selected>) {\n\treturn function <Host extends ContextHostLike, TMethod extends (value: Selected) => unknown>(\n\t\toriginalMethod: TMethod,\n\t\ttargetContext: ClassMethodDecoratorContext<Host, TMethod>,\n\t): void {\n\t\ttargetContext.addInitializer(function (this: Host) {\n\t\t\tlet activeUnsubscribe: (() => void) | undefined;\n\t\t\tconst applySelectedContext = createContextSelectionDelivery<Selected>(\n\t\t\t\tthis,\n\t\t\t\t(value) => {\n\t\t\t\t\toriginalMethod.call(this, value);\n\t\t\t\t},\n\t\t\t\trequestUpdate,\n\t\t\t);\n\n\t\t\tif (bootstrapSsrContextSelection<T, Selected>(this, context, applySelectedContext, select)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst connectSelection = () => {\n\t\t\t\treturn connectContextSelection<T, Selected>(this, context, applySelectedContext, {\n\t\t\t\t\tonSubscribe: (unsubscribe) => {\n\t\t\t\t\t\tactiveUnsubscribe = unsubscribe;\n\t\t\t\t\t},\n\t\t\t\t\tselect,\n\t\t\t\t\tsubscribe,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tthis.registerCleanupCallback(() => {\n\t\t\t\tactiveUnsubscribe?.();\n\t\t\t\tactiveUnsubscribe = undefined;\n\t\t\t});\n\n\t\t\tthis.registerConnectedCallback(() => {\n\t\t\t\tif (connectSelection()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconnectSelection();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n}\n"
5
12
  ],
6
- "mappings": "",
7
- "debugId": "D78E4F19FE74240B64756E2164756E21",
13
+ "mappings": "2PAEA,IAAM,EAA4B,OAAO,EAC5B,EAA0B,OAAO,EASvC,SAAS,CAA8B,CAAC,EAAc,EAAwC,CAEpG,IAAM,EADS,EACkB,GAEjC,GAAI,MAAM,QAAQ,CAAiB,EAAG,CACrC,EAAkB,KAAK,CAAQ,EAC/B,OAGD,OAAO,eAAe,EAAM,EAA2B,CACtD,MAAO,CAAC,CAAQ,EAChB,aAAc,EACf,CAAC,EASK,SAAS,CAA0B,CAAC,EAAoB,CAC9D,IAAM,EAAS,EACT,EAAY,EAAO,GAEzB,GAAI,CAAC,MAAM,QAAQ,CAAS,EAC3B,OAGD,EAAO,GAA2B,GAElC,GAAI,CACH,QAAW,KAAY,EACtB,EAAS,SAET,CACD,OAAO,EAAO,IC3CT,IAAK,GAAL,CAAK,IAAL,CACN,uBAAuB,+BACvB,kBAAkB,kBAClB,WAAW,mBACX,UAAU,oBAJC,QAiBL,MAAM,UAAsD,KAAM,CAIvD,QACA,SACA,UALV,QAAU,GAEV,WAAW,CACD,EACA,EACA,EACf,CACD,MAAM,kBAAoC,CAAE,QAAS,GAAM,SAAU,EAAK,CAAC,EAJ3D,eACA,gBACA,iB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W,EAAQ,UACnB,YAAa,EAAQ,WACtB,CAAC,EAGF,SAAS,CAA4C,CAAC,EAAc,EAAiC,CAEpG,OADA,EAA+B,EAAM,CAAO,EACrC,EAAQ,EC9GT,SAAS,CAAqC,CACpD,EACA,EACA,EACC,CACD,IAAI,EAAoB,GACpB,EACE,EAAS,EAEf,MAAO,CAAC,IAAiB,CACxB,GAAI,EAAO,KAA6B,IAAQ,GAAqB,OAAO,GAAG,EAAe,CAAK,EAClG,OAOD,GAJA,EAAoB,GACpB,EAAgB,EAChB,EAAM,CAAK,EAEP,GAAiB,OAAO,EAAO,gBAAkB,WACnD,EAAgC,cAAc,GCnB3C,SAAS,CAA+E,EAC9F,UACA,SACA,YAAY,GACZ,gBAAgB,IACuB,CACvC,OAAO,QAAqF,CAC3F,EACA,EACO,CACP,EAAc,eAAe,QAAS,EAAa,CAClD,IAAI,EACE,EAAuB,EAC5B,KACA,CAAC,IAAU,CACV,EAAe,KAAK,KAAM,CAAK,GAEhC,CACD,EAEA,GAAI,EAA0C,KAAM,EAAS,EAAsB,CAAM,EACxF,OAGD,IAAM,EAAmB,IAAM,CAC9B,OAAO,EAAqC,KAAM,EAAS,EAAsB,CAChF,YAAa,CAAC,IAAgB,CAC7B,EAAoB,GAErB,SACA,WACD,CAAC,GAGF,KAAK,wBAAwB,IAAM,CAClC,IAAoB,EACpB,EAAoB,OACpB,EAED,KAAK,0BAA0B,IAAM,CACpC,GAAI,EAAiB,EACpB,OAGD,eAAe,IAAM,CACpB,EAAiB,EACjB,EACD,EACD",
14
+ "debugId": "264DCF2CCB0FB5CC64756E2164756E21",
8
15
  "names": []
9
16
  }
@@ -1,4 +1,4 @@
1
- import type { RadiantElement } from '../../../core/radiant-element';
1
+ import type { ContextHostLike } from '../../context-host';
2
2
  import type { UnknownContext } from '../../types';
3
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;
4
+ export declare function provideContext<T extends UnknownContext>({ context, initialValue, hydrate, serialize, }: ProvideContextOptions<T>): <C extends ContextHostLike, V>(target: undefined, targetContext: ClassFieldDecoratorContext<C, V>) => void;