@ecopages/radiant 0.1.8 → 0.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +289 -34
- package/dist/chunk-0y78f8hj.js +4 -0
- package/dist/chunk-0y78f8hj.js.map +10 -0
- package/dist/chunk-0zq7e1ne.js +4 -0
- package/dist/chunk-0zq7e1ne.js.map +10 -0
- package/dist/chunk-13ydx769.js +4 -0
- package/dist/chunk-13ydx769.js.map +10 -0
- package/dist/chunk-147yvtsn.js +4 -0
- package/dist/chunk-147yvtsn.js.map +10 -0
- package/dist/chunk-17earqbr.js +4 -0
- package/dist/chunk-17earqbr.js.map +10 -0
- package/dist/chunk-1w1dm68j.js +4 -0
- package/dist/chunk-1w1dm68j.js.map +10 -0
- package/dist/chunk-2tgrfv09.js +4 -0
- package/dist/chunk-2tgrfv09.js.map +10 -0
- package/dist/chunk-3b033cgq.js +4 -0
- package/dist/chunk-3b033cgq.js.map +10 -0
- package/dist/chunk-42tyhfvh.js +4 -0
- package/dist/chunk-42tyhfvh.js.map +10 -0
- package/dist/chunk-4cc2syf5.js +4 -0
- package/dist/chunk-4cc2syf5.js.map +10 -0
- package/dist/chunk-4fqkmpra.js +4 -0
- package/dist/chunk-4fqkmpra.js.map +10 -0
- package/dist/chunk-4srpf0y5.js +4 -0
- package/dist/chunk-4srpf0y5.js.map +10 -0
- package/dist/chunk-57w3vmme.js +4 -0
- package/dist/chunk-57w3vmme.js.map +10 -0
- package/dist/chunk-5a2xez36.js +4 -0
- package/dist/chunk-5a2xez36.js.map +10 -0
- package/dist/chunk-5bym7y1d.js +4 -0
- package/dist/chunk-5bym7y1d.js.map +10 -0
- package/dist/chunk-5td6v9k3.js +4 -0
- package/dist/chunk-5td6v9k3.js.map +10 -0
- package/dist/chunk-60015zxq.js +4 -0
- package/dist/chunk-60015zxq.js.map +10 -0
- package/dist/chunk-60q4y3k5.js +4 -0
- package/dist/chunk-60q4y3k5.js.map +10 -0
- package/dist/chunk-6kdxrppw.js +4 -0
- package/dist/chunk-6kdxrppw.js.map +10 -0
- package/dist/chunk-6z34stya.js +4 -0
- package/dist/chunk-6z34stya.js.map +10 -0
- package/dist/chunk-73x7jpdd.js +4 -0
- package/dist/chunk-73x7jpdd.js.map +10 -0
- package/dist/chunk-84fc8cz9.js +4 -0
- package/dist/chunk-84fc8cz9.js.map +10 -0
- package/dist/chunk-8dexhy6c.js +4 -0
- package/dist/chunk-8dexhy6c.js.map +10 -0
- package/dist/chunk-8n2dhx28.js +4 -0
- package/dist/chunk-8n2dhx28.js.map +10 -0
- package/dist/chunk-8tvt04cm.js +4 -0
- package/dist/chunk-8tvt04cm.js.map +10 -0
- package/dist/chunk-8vak8w5w.js +4 -0
- package/dist/chunk-8vak8w5w.js.map +10 -0
- package/dist/chunk-8xy18qmz.js +4 -0
- package/dist/chunk-8xy18qmz.js.map +9 -0
- package/dist/chunk-9554n9t4.js +4 -0
- package/dist/chunk-9554n9t4.js.map +10 -0
- package/dist/chunk-9ascmjk3.js +4 -0
- package/dist/chunk-9ascmjk3.js.map +10 -0
- package/dist/chunk-9gjmqxp2.js +4 -0
- package/dist/chunk-9gjmqxp2.js.map +10 -0
- package/dist/chunk-a7hzs37s.js +4 -0
- package/dist/chunk-a7hzs37s.js.map +10 -0
- package/dist/chunk-aajhkdmn.js +4 -0
- package/dist/chunk-aajhkdmn.js.map +10 -0
- package/dist/chunk-agjb2a3r.js +4 -0
- package/dist/chunk-agjb2a3r.js.map +10 -0
- package/dist/chunk-ak97hp4w.js +4 -0
- package/dist/chunk-ak97hp4w.js.map +10 -0
- package/dist/chunk-bmhn4nbp.js +4 -0
- package/dist/chunk-bmhn4nbp.js.map +10 -0
- package/dist/chunk-c8vqg7r1.js +4 -0
- package/dist/chunk-c8vqg7r1.js.map +10 -0
- package/dist/chunk-cbvd18v1.js +4 -0
- package/dist/chunk-cbvd18v1.js.map +10 -0
- package/dist/chunk-chyn72n9.js +4 -0
- package/dist/chunk-chyn72n9.js.map +10 -0
- package/dist/chunk-cvz9mrxa.js +4 -0
- package/dist/chunk-cvz9mrxa.js.map +10 -0
- package/dist/chunk-d0n7njdy.js +4 -0
- package/dist/chunk-d0n7njdy.js.map +10 -0
- package/dist/chunk-d4v5qpxa.js +4 -0
- package/dist/chunk-d4v5qpxa.js.map +10 -0
- package/dist/chunk-d7hh3ze6.js +4 -0
- package/dist/chunk-d7hh3ze6.js.map +10 -0
- package/dist/chunk-d98q3myg.js +4 -0
- package/dist/chunk-d98q3myg.js.map +10 -0
- package/dist/chunk-dscj0sk9.js +4 -0
- package/dist/chunk-dscj0sk9.js.map +10 -0
- package/dist/chunk-dx1wqc00.js +4 -0
- package/dist/chunk-dx1wqc00.js.map +10 -0
- package/dist/chunk-g0gz7ypq.js +4 -0
- package/dist/chunk-g0gz7ypq.js.map +10 -0
- package/dist/chunk-hkmm3dj9.js +4 -0
- package/dist/chunk-hkmm3dj9.js.map +10 -0
- package/dist/chunk-hn4j8rt5.js +4 -0
- package/dist/chunk-hn4j8rt5.js.map +10 -0
- package/dist/chunk-jce9gqqw.js +4 -0
- package/dist/chunk-jce9gqqw.js.map +10 -0
- package/dist/chunk-jg20mzg8.js +4 -0
- package/dist/chunk-jg20mzg8.js.map +10 -0
- package/dist/chunk-jkb2y7c8.js +4 -0
- package/dist/chunk-jkb2y7c8.js.map +10 -0
- package/dist/chunk-k5hr781q.js +4 -0
- package/dist/chunk-k5hr781q.js.map +10 -0
- package/dist/chunk-ksv01cey.js +4 -0
- package/dist/chunk-ksv01cey.js.map +10 -0
- package/dist/chunk-mpjnqmbq.js +4 -0
- package/dist/chunk-mpjnqmbq.js.map +10 -0
- package/dist/chunk-mqxmfvyp.js +4 -0
- package/dist/chunk-mqxmfvyp.js.map +10 -0
- package/dist/chunk-ms6a9zdt.js +4 -0
- package/dist/chunk-ms6a9zdt.js.map +10 -0
- package/dist/chunk-nerd6fmg.js +4 -0
- package/dist/chunk-nerd6fmg.js.map +10 -0
- package/dist/chunk-nw171z6m.js +4 -0
- package/dist/chunk-nw171z6m.js.map +10 -0
- package/dist/chunk-p6pxdvkk.js +4 -0
- package/dist/chunk-p6pxdvkk.js.map +10 -0
- package/dist/chunk-paehjz94.js +4 -0
- package/dist/chunk-paehjz94.js.map +10 -0
- package/dist/chunk-par0t822.js +4 -0
- package/dist/chunk-par0t822.js.map +10 -0
- package/dist/chunk-qaagk55a.js +4 -0
- package/dist/chunk-qaagk55a.js.map +10 -0
- package/dist/chunk-qbnedp0y.js +4 -0
- package/dist/chunk-qbnedp0y.js.map +10 -0
- package/dist/chunk-qd28hvdx.js +4 -0
- package/dist/chunk-qd28hvdx.js.map +10 -0
- package/dist/chunk-qdj6r8jn.js +4 -0
- package/dist/chunk-qdj6r8jn.js.map +10 -0
- package/dist/chunk-qe6sjr27.js +4 -0
- package/dist/chunk-qe6sjr27.js.map +10 -0
- package/dist/chunk-r1cvaz1t.js +4 -0
- package/dist/chunk-r1cvaz1t.js.map +10 -0
- package/dist/chunk-r75y7ydb.js +4 -0
- package/dist/chunk-r75y7ydb.js.map +10 -0
- package/dist/chunk-s4qgct1z.js +4 -0
- package/dist/chunk-s4qgct1z.js.map +10 -0
- package/dist/chunk-scfk041e.js +4 -0
- package/dist/chunk-scfk041e.js.map +10 -0
- package/dist/chunk-t6x9e177.js +4 -0
- package/dist/chunk-t6x9e177.js.map +10 -0
- package/dist/chunk-t7a1bbxq.js +4 -0
- package/dist/chunk-t7a1bbxq.js.map +10 -0
- package/dist/chunk-tyysm4gk.js +4 -0
- package/dist/chunk-tyysm4gk.js.map +10 -0
- package/dist/chunk-vpfm9yw8.js +4 -0
- package/dist/chunk-vpfm9yw8.js.map +10 -0
- package/dist/chunk-w50v38rv.js +4 -0
- package/dist/chunk-w50v38rv.js.map +10 -0
- package/dist/chunk-x0522ksh.js +4 -0
- package/dist/chunk-x0522ksh.js.map +10 -0
- package/dist/chunk-xd1xn3vy.js +4 -0
- package/dist/chunk-xd1xn3vy.js.map +10 -0
- package/dist/chunk-zb7wh7w4.js +4 -0
- package/dist/chunk-zb7wh7w4.js.map +10 -0
- package/dist/chunk-zj9ez73m.js +4 -0
- package/dist/chunk-zj9ez73m.js.map +10 -0
- package/dist/context/context-consumer-bootstrap.d.ts +41 -0
- package/dist/context/context-consumer-bootstrap.js +3 -0
- package/dist/context/context-consumer-bootstrap.js.map +9 -0
- package/dist/context/context-consumer-runtime.d.ts +34 -0
- package/dist/context/context-consumer-runtime.js +3 -0
- package/dist/context/context-consumer-runtime.js.map +9 -0
- package/dist/context/context-provider.d.ts +50 -2
- package/dist/context/context-provider.js +2 -279
- package/dist/context/context-provider.js.map +3 -6
- package/dist/context/context-ssr-bridge.d.ts +16 -0
- package/dist/context/context-ssr-bridge.js +3 -0
- package/dist/context/context-ssr-bridge.js.map +9 -0
- package/dist/context/create-context.js +2 -6
- package/dist/context/create-context.js.map +3 -4
- package/dist/context/decorators/consume-context.d.ts +10 -6
- package/dist/context/decorators/consume-context.js +2 -64
- package/dist/context/decorators/consume-context.js.map +3 -5
- package/dist/context/decorators/context-selection-delivery.d.ts +1 -0
- package/dist/context/decorators/context-selection-delivery.js +3 -0
- package/dist/context/decorators/context-selection-delivery.js.map +9 -0
- package/dist/context/decorators/context-selector.d.ts +29 -9
- package/dist/context/decorators/context-selector.js +2 -71
- package/dist/context/decorators/context-selector.js.map +3 -5
- package/dist/context/decorators/legacy/consume-context.d.ts +3 -0
- package/dist/context/decorators/legacy/consume-context.js +3 -0
- package/dist/context/decorators/legacy/consume-context.js.map +9 -0
- package/dist/context/decorators/legacy/context-selector-field.d.ts +8 -0
- package/dist/context/decorators/legacy/context-selector-field.js +3 -0
- package/dist/context/decorators/legacy/context-selector-field.js.map +9 -0
- package/dist/context/decorators/legacy/context-selector.d.ts +4 -0
- package/dist/context/decorators/legacy/context-selector.js +3 -0
- package/dist/context/decorators/legacy/context-selector.js.map +9 -0
- package/dist/context/decorators/legacy/provide-context.d.ts +4 -0
- package/dist/context/decorators/legacy/provide-context.js +3 -0
- package/dist/context/decorators/legacy/provide-context.js.map +9 -0
- package/dist/context/decorators/on-context-update.d.ts +31 -0
- package/dist/context/decorators/on-context-update.js +3 -0
- package/dist/context/decorators/on-context-update.js.map +9 -0
- package/dist/context/decorators/provide-context.d.ts +18 -7
- package/dist/context/decorators/provide-context.js +2 -291
- package/dist/context/decorators/provide-context.js.map +3 -7
- package/dist/context/decorators/standard/consume-context.d.ts +3 -0
- package/dist/context/decorators/standard/consume-context.js +3 -0
- package/dist/context/decorators/standard/consume-context.js.map +9 -0
- package/dist/context/decorators/standard/context-selector-field.d.ts +8 -0
- package/dist/context/decorators/standard/context-selector-field.js +3 -0
- package/dist/context/decorators/standard/context-selector-field.js.map +9 -0
- package/dist/context/decorators/standard/context-selector.d.ts +5 -0
- package/dist/context/decorators/standard/context-selector.js +3 -0
- package/dist/context/decorators/standard/context-selector.js.map +9 -0
- package/dist/context/decorators/standard/provide-context.d.ts +4 -0
- package/dist/context/decorators/standard/provide-context.js +3 -0
- package/dist/context/decorators/standard/provide-context.js.map +9 -0
- package/dist/context/events.d.ts +3 -2
- package/dist/context/events.js +2 -53
- package/dist/context/events.js.map +3 -4
- package/dist/context/hydration-script.d.ts +17 -0
- package/dist/context/hydration-script.js +3 -0
- package/dist/context/hydration-script.js.map +9 -0
- package/dist/core/custom-element-metadata.d.ts +3 -0
- package/dist/core/custom-element-metadata.js +3 -0
- package/dist/core/custom-element-metadata.js.map +9 -0
- package/dist/core/hydration-codec.d.ts +24 -0
- package/dist/core/hydration-codec.js +3 -0
- package/dist/core/hydration-codec.js.map +9 -0
- package/dist/core/radiant-component-ssr.d.ts +29 -0
- package/dist/core/radiant-component-ssr.js +3 -0
- package/dist/core/radiant-component-ssr.js.map +9 -0
- package/dist/core/radiant-component.d.ts +106 -0
- package/dist/core/radiant-component.js +3 -0
- package/dist/core/radiant-component.js.map +9 -0
- package/dist/core/radiant-element.d.ts +283 -23
- package/dist/core/radiant-element.js +2 -82
- package/dist/core/radiant-element.js.map +3 -4
- package/dist/core/reactive-jsx-value.d.ts +10 -0
- package/dist/core/reactive-jsx-value.js +3 -0
- package/dist/core/reactive-jsx-value.js.map +9 -0
- package/dist/core/reactive-prop-metadata.d.ts +7 -0
- package/dist/core/reactive-prop-metadata.js +3 -0
- package/dist/core/reactive-prop-metadata.js.map +9 -0
- package/dist/core/slot-projection.d.ts +34 -0
- package/dist/core/slot-projection.js +3 -0
- package/dist/core/slot-projection.js.map +9 -0
- package/dist/core/ssr-hydration-binding.d.ts +14 -0
- package/dist/core/ssr-hydration-binding.js +2 -0
- package/dist/core/ssr-hydration-binding.js.map +9 -0
- package/dist/core/ssr-preparation.d.ts +18 -0
- package/dist/core/ssr-preparation.js +3 -0
- package/dist/core/ssr-preparation.js.map +9 -0
- package/dist/decorators/bound.d.ts +2 -6
- package/dist/decorators/bound.js +2 -23
- package/dist/decorators/bound.js.map +3 -4
- package/dist/decorators/bridge.d.ts +8 -0
- package/dist/decorators/bridge.js +3 -0
- package/dist/decorators/bridge.js.map +9 -0
- package/dist/decorators/custom-element.d.ts +3 -1
- package/dist/decorators/custom-element.js +2 -14
- package/dist/decorators/custom-element.js.map +3 -4
- package/dist/decorators/debounce.d.ts +6 -1
- package/dist/decorators/debounce.js +2 -20
- package/dist/decorators/debounce.js.map +3 -4
- package/dist/decorators/event.d.ts +3 -2
- package/dist/decorators/event.js +2 -46
- package/dist/decorators/event.js.map +3 -5
- package/dist/decorators/legacy/bound.d.ts +9 -0
- package/dist/decorators/legacy/bound.js +3 -0
- package/dist/decorators/legacy/bound.js.map +9 -0
- package/dist/decorators/legacy/custom-element.d.ts +6 -0
- package/dist/decorators/legacy/custom-element.js +3 -0
- package/dist/decorators/legacy/custom-element.js.map +9 -0
- package/dist/decorators/legacy/debounce.d.ts +1 -0
- package/dist/decorators/legacy/debounce.js +3 -0
- package/dist/decorators/legacy/debounce.js.map +9 -0
- package/dist/decorators/legacy/event.d.ts +9 -0
- package/dist/decorators/legacy/event.js +3 -0
- package/dist/decorators/legacy/event.js.map +9 -0
- package/dist/decorators/legacy/instance-initializers.d.ts +17 -0
- package/dist/decorators/legacy/instance-initializers.js +3 -0
- package/dist/decorators/legacy/instance-initializers.js.map +9 -0
- package/dist/decorators/legacy/on-event.d.ts +17 -0
- package/dist/decorators/legacy/on-event.js +3 -0
- package/dist/decorators/legacy/on-event.js.map +9 -0
- package/dist/decorators/legacy/on-updated.d.ts +6 -0
- package/dist/decorators/legacy/on-updated.js +3 -0
- package/dist/decorators/legacy/on-updated.js.map +9 -0
- package/dist/decorators/legacy/query-slot.d.ts +3 -0
- package/dist/decorators/legacy/query-slot.js +3 -0
- package/dist/decorators/legacy/query-slot.js.map +9 -0
- package/dist/decorators/legacy/query.d.ts +23 -0
- package/dist/decorators/legacy/query.js +3 -0
- package/dist/decorators/legacy/query.js.map +9 -0
- package/dist/decorators/{reactive-field.d.ts → legacy/reactive-field.d.ts} +2 -2
- package/dist/decorators/legacy/reactive-field.js +3 -0
- package/dist/decorators/legacy/reactive-field.js.map +9 -0
- package/dist/decorators/{reactive-prop.d.ts → legacy/reactive-prop.d.ts} +4 -3
- package/dist/decorators/legacy/reactive-prop.js +3 -0
- package/dist/decorators/legacy/reactive-prop.js.map +9 -0
- package/dist/decorators/legacy/signal.d.ts +10 -0
- package/dist/decorators/legacy/signal.js +3 -0
- package/dist/decorators/legacy/signal.js.map +9 -0
- package/dist/decorators/on-event.d.ts +6 -17
- package/dist/decorators/on-event.js +2 -47
- package/dist/decorators/on-event.js.map +3 -4
- package/dist/decorators/on-updated.d.ts +3 -4
- package/dist/decorators/on-updated.js +2 -29
- package/dist/decorators/on-updated.js.map +3 -4
- package/dist/decorators/prop.d.ts +14 -0
- package/dist/decorators/prop.js +3 -0
- package/dist/decorators/prop.js.map +9 -0
- package/dist/decorators/query-slot.d.ts +13 -0
- package/dist/decorators/query-slot.js +3 -0
- package/dist/decorators/query-slot.js.map +9 -0
- package/dist/decorators/query.d.ts +7 -35
- package/dist/decorators/query.js +2 -36
- package/dist/decorators/query.js.map +3 -4
- package/dist/decorators/signal.d.ts +23 -0
- package/dist/decorators/signal.js +3 -0
- package/dist/decorators/signal.js.map +9 -0
- package/dist/decorators/standard/bound.d.ts +2 -0
- package/dist/decorators/standard/bound.js +3 -0
- package/dist/decorators/standard/bound.js.map +9 -0
- package/dist/decorators/standard/custom-element.d.ts +1 -0
- package/dist/decorators/standard/custom-element.js +3 -0
- package/dist/decorators/standard/custom-element.js.map +9 -0
- package/dist/decorators/standard/debounce.d.ts +2 -0
- package/dist/decorators/standard/debounce.js +3 -0
- package/dist/decorators/standard/debounce.js.map +9 -0
- package/dist/decorators/standard/event.d.ts +9 -0
- package/dist/decorators/standard/event.js +3 -0
- package/dist/decorators/standard/event.js.map +9 -0
- package/dist/decorators/standard/on-event.d.ts +17 -0
- package/dist/decorators/standard/on-event.js +3 -0
- package/dist/decorators/standard/on-event.js.map +9 -0
- package/dist/decorators/standard/on-updated.d.ts +2 -0
- package/dist/decorators/standard/on-updated.js +3 -0
- package/dist/decorators/standard/on-updated.js.map +9 -0
- package/dist/decorators/standard/query-slot.d.ts +8 -0
- package/dist/decorators/standard/query-slot.js +3 -0
- package/dist/decorators/standard/query-slot.js.map +9 -0
- package/dist/decorators/standard/query.d.ts +2 -0
- package/dist/decorators/standard/query.js +3 -0
- package/dist/decorators/standard/query.js.map +9 -0
- package/dist/decorators/standard/reactive-field.d.ts +2 -0
- package/dist/decorators/standard/reactive-field.js +3 -0
- package/dist/decorators/standard/reactive-field.js.map +9 -0
- package/dist/decorators/standard/reactive-prop.d.ts +2 -0
- package/dist/decorators/standard/reactive-prop.js +3 -0
- package/dist/decorators/standard/reactive-prop.js.map +9 -0
- package/dist/decorators/standard/signal.d.ts +33 -0
- package/dist/decorators/standard/signal.js +3 -0
- package/dist/decorators/standard/signal.js.map +9 -0
- package/dist/decorators/state.d.ts +11 -0
- package/dist/decorators/state.js +3 -0
- package/dist/decorators/state.js.map +9 -0
- package/dist/helpers/create-event-listener.d.ts +28 -0
- package/dist/helpers/create-event-listener.js +3 -0
- package/dist/helpers/create-event-listener.js.map +9 -0
- package/dist/helpers/create-event.d.ts +9 -0
- package/dist/helpers/create-event.js +3 -0
- package/dist/helpers/create-event.js.map +9 -0
- package/dist/helpers/create-query-slot.d.ts +20 -0
- package/dist/helpers/create-query-slot.js +3 -0
- package/dist/helpers/create-query-slot.js.map +9 -0
- package/dist/helpers/create-query.d.ts +27 -0
- package/dist/helpers/create-query.js +3 -0
- package/dist/helpers/create-query.js.map +9 -0
- package/dist/helpers/debounce.d.ts +39 -0
- package/dist/helpers/debounce.js +3 -0
- package/dist/helpers/debounce.js.map +9 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +3 -0
- package/dist/helpers/index.js.map +9 -0
- package/dist/index.d.ts +24 -6
- package/dist/index.js +2 -716
- package/dist/index.js.map +3 -21
- package/dist/server/context-ssr.d.ts +27 -0
- package/dist/server/context-ssr.js +3 -0
- package/dist/server/context-ssr.js.map +9 -0
- package/dist/server/install-light-dom-shim.d.ts +1 -0
- package/dist/server/install-light-dom-shim.js +3 -0
- package/dist/server/install-light-dom-shim.js.map +10 -0
- package/dist/server/light-dom-shim.d.ts +53 -0
- package/dist/server/light-dom-shim.js +3 -0
- package/dist/server/light-dom-shim.js.map +9 -0
- package/dist/server/project-root.d.ts +20 -0
- package/dist/server/project-root.js +3 -0
- package/dist/server/project-root.js.map +11 -0
- package/dist/server/render-component.d.ts +195 -0
- package/dist/server/render-component.js +3 -0
- package/dist/server/render-component.js.map +10 -0
- package/dist/signals/host-resource.d.ts +59 -0
- package/dist/signals/host-resource.js +3 -0
- package/dist/signals/host-resource.js.map +10 -0
- package/dist/signals/host-signal.d.ts +45 -0
- package/dist/signals/host-signal.js +3 -0
- package/dist/signals/host-signal.js.map +9 -0
- package/dist/signals/hydration-script.d.ts +11 -0
- package/dist/signals/hydration-script.js +3 -0
- package/dist/signals/hydration-script.js.map +9 -0
- package/dist/tools/escape-script-json.d.ts +5 -0
- package/dist/tools/escape-script-json.js +3 -0
- package/dist/tools/escape-script-json.js.map +9 -0
- package/dist/tools/event-emitter.d.ts +1 -1
- package/dist/tools/event-emitter.js +2 -22
- package/dist/tools/event-emitter.js.map +3 -4
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +2 -28
- package/dist/tools/index.js.map +3 -5
- package/dist/tools/render-jsx-template.d.ts +5 -0
- package/dist/tools/render-jsx-template.js +3 -0
- package/dist/tools/render-jsx-template.js.map +9 -0
- package/dist/tools/stringify-typed.d.ts +4 -6
- package/dist/tools/stringify-typed.js +2 -8
- package/dist/tools/stringify-typed.js.map +3 -4
- package/dist/types.d.ts +79 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +10 -0
- package/dist/utils/attribute-utils.d.ts +2 -0
- package/dist/utils/attribute-utils.js +2 -137
- package/dist/utils/attribute-utils.js.map +3 -4
- package/dist/utils/index.js +2 -137
- package/dist/utils/index.js.map +3 -4
- package/package.json +108 -44
- package/size-budget.json +22 -0
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -338
- package/dist/context/index.js.map +0 -16
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -83
- package/dist/core/index.js.map +0 -10
- package/dist/decorators/reactive-field.js +0 -27
- package/dist/decorators/reactive-field.js.map +0 -10
- package/dist/decorators/reactive-prop.js +0 -215
- package/dist/decorators/reactive-prop.js.map +0 -11
- package/dist/decorators.d.ts +0 -7
- package/dist/decorators.js +0 -401
- package/dist/decorators.js.map +0 -18
- package/dist/mixins/index.d.ts +0 -1
- package/dist/mixins/index.js +0 -24
- package/dist/mixins/index.js.map +0 -10
- package/dist/mixins/with-kita.d.ts +0 -15
- package/dist/mixins/with-kita.js +0 -24
- package/dist/mixins/with-kita.js.map +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/context/create-context.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Context } from './types';\n\n/**\n * A function which creates a Context value object\n */\nexport const createContext = <ValueType>(key: unknown) => key as Context<typeof key, ValueType>;\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "AAKO,IAAM,EAAgB,CAAY,IAAiB",
|
|
8
|
+
"debugId": "F70C083484ED9C0564756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/standard/custom-element.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { setCustomElementTagName } from '../../core/custom-element-metadata';\n\nexport function customElement(name: string, options?: ElementDefinitionOptions) {\n\treturn function <T extends CustomElementConstructor>(_: T, context: ClassDecoratorContext<T>) {\n\t\tcontext.addInitializer(function () {\n\t\t\tsetCustomElementTagName(this, name);\n\n\t\t\tif (!window.customElements.get(name)) {\n\t\t\t\tcustomElements.define(name, this, options);\n\t\t\t}\n\t\t});\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "yCAEO,SAAS,CAAa,CAAC,EAAc,EAAoC,CAC/E,OAAO,QAA6C,CAAC,EAAM,EAAmC,CAC7F,EAAQ,eAAe,QAAS,EAAG,CAGlC,GAFA,EAAwB,KAAM,CAAI,EAE9B,CAAC,OAAO,eAAe,IAAI,CAAI,EAClC,eAAe,OAAO,EAAM,KAAM,CAAO,EAE1C",
|
|
8
|
+
"debugId": "9FCE29F579B9006464756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RadiantElement } from '../core/radiant-element';
|
|
2
|
+
import type { ContextType, UnknownContext } from './types';
|
|
3
|
+
type ConsumedContextAssignment = (provider: unknown) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a consumed context immediately and registers the same resolution to
|
|
6
|
+
* run again during the later SSR preparation phase.
|
|
7
|
+
*
|
|
8
|
+
* This keeps constructor-time state and pre-serialization state aligned after
|
|
9
|
+
* instance fields, props, or authored host content change during SSR setup.
|
|
10
|
+
*/
|
|
11
|
+
export declare function bootstrapSsrConsumedContext(host: RadiantElement, context: UnknownContext, assign: ConsumedContextAssignment, options?: {
|
|
12
|
+
emitMounted?: boolean;
|
|
13
|
+
}): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a selected context value immediately and registers the same
|
|
16
|
+
* selection for the later SSR preparation phase.
|
|
17
|
+
*
|
|
18
|
+
* This lets nested SSR renders recompute selector-backed state after the host
|
|
19
|
+
* has finished construction and any server-side configuration hooks have run.
|
|
20
|
+
*/
|
|
21
|
+
export declare function bootstrapSsrContextSelection<TContext extends UnknownContext>(host: object, context: TContext, callback: (value: unknown) => void, select?: (context: ContextType<TContext>) => unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves a consumed context from SSR when available, otherwise requests it
|
|
24
|
+
* through the DOM event channel for the current client-side lifecycle pass.
|
|
25
|
+
*
|
|
26
|
+
* @returns `true` when the value was satisfied synchronously from SSR state.
|
|
27
|
+
*/
|
|
28
|
+
export declare function connectConsumedContext(host: RadiantElement, context: UnknownContext, assign: ConsumedContextAssignment, options?: {
|
|
29
|
+
emitMounted?: boolean;
|
|
30
|
+
}): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Resolves a selected context value from SSR when available, otherwise requests
|
|
33
|
+
* it through the DOM event channel for the current client-side lifecycle pass.
|
|
34
|
+
*
|
|
35
|
+
* @returns `true` when the value was satisfied synchronously from SSR state.
|
|
36
|
+
*/
|
|
37
|
+
export declare function connectContextSelection<TContext extends UnknownContext>(host: RadiantElement, context: TContext, callback: (value: unknown) => void, options?: {
|
|
38
|
+
select?: (context: ContextType<TContext>) => unknown;
|
|
39
|
+
subscribe?: boolean;
|
|
40
|
+
}): boolean;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{u as a,v as b,w as c,x as d}from"../chunk-vpfm9yw8.js";import"../chunk-s4qgct1z.js";import"../chunk-1w1dm68j.js";import"../chunk-9gjmqxp2.js";import"../chunk-4cc2syf5.js";import"../chunk-8xy18qmz.js";export{d as connectContextSelection,c as connectConsumedContext,b as bootstrapSsrContextSelection,a as bootstrapSsrConsumedContext};
|
|
2
|
+
|
|
3
|
+
//# debugId=D5DED9AA9551982564756E2164756E21
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RadiantElement } from '../core/radiant-element';
|
|
2
|
+
import type { ContextType, UnknownContext } from './types';
|
|
3
|
+
type ConsumedContextAssignment = (provider: unknown) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a consumed context from the active SSR provider stack when one is available.
|
|
6
|
+
*
|
|
7
|
+
* This keeps SSR-specific lookup outside decorator implementations while preserving
|
|
8
|
+
* the same consumer initialization contract for both standard and legacy decorators.
|
|
9
|
+
*
|
|
10
|
+
* @returns `true` when the context was resolved synchronously from SSR state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function initializeConsumedContext(host: RadiantElement, context: UnknownContext, assign: ConsumedContextAssignment, options?: {
|
|
13
|
+
emitMounted?: boolean;
|
|
14
|
+
}): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Requests a context provider through the DOM event channel when SSR state is not active.
|
|
17
|
+
*/
|
|
18
|
+
export declare function requestConsumedContext(host: RadiantElement, context: UnknownContext, assign: ConsumedContextAssignment, options?: {
|
|
19
|
+
emitMounted?: boolean;
|
|
20
|
+
}): void;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves a selected context value from the active SSR provider stack when available.
|
|
23
|
+
*
|
|
24
|
+
* @returns `true` when the selection callback was satisfied synchronously from SSR state.
|
|
25
|
+
*/
|
|
26
|
+
export declare function initializeContextSelection<TContext extends UnknownContext>(context: TContext, callback: (value: unknown) => void, select?: (context: ContextType<TContext>) => unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Requests a selected context value through the DOM event channel.
|
|
29
|
+
*/
|
|
30
|
+
export declare function requestContextSelection<TContext extends UnknownContext>(host: RadiantElement, context: TContext, callback: (value: unknown) => void, options: {
|
|
31
|
+
select?: (context: ContextType<TContext>) => unknown;
|
|
32
|
+
subscribe?: boolean;
|
|
33
|
+
}): void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{A as c,B as d,y as a,z as b}from"../chunk-s4qgct1z.js";import"../chunk-1w1dm68j.js";import"../chunk-4cc2syf5.js";import"../chunk-8xy18qmz.js";export{d as requestContextSelection,b as requestConsumedContext,c as initializeContextSelection,a as initializeConsumedContext};
|
|
2
|
+
|
|
3
|
+
//# debugId=73A59D70CC65EE3964756E2164756E21
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
import { type JsxRenderable } from '@ecopages/jsx';
|
|
1
2
|
import type { RadiantElement } from '../core/radiant-element';
|
|
2
|
-
import {
|
|
3
|
+
import type { SsrSerializableHydrationBinding } from '../core/ssr-hydration-binding';
|
|
4
|
+
import type { AttributeTypeConstant } from '../utils/attribute-utils';
|
|
3
5
|
import { type ContextSubscription } from './events';
|
|
4
6
|
import type { Context, ContextType, UnknownContext } from './types';
|
|
5
7
|
type ContextProviderOptions<T extends UnknownContext> = {
|
|
6
8
|
context: UnknownContext;
|
|
9
|
+
hydrationKey?: string;
|
|
7
10
|
initialValue?: T['__context__'];
|
|
8
11
|
hydrate?: AttributeTypeConstant;
|
|
12
|
+
serialize?: (value: ContextType<T>) => unknown;
|
|
9
13
|
};
|
|
14
|
+
export interface SsrSerializableContextProvider extends SsrSerializableHydrationBinding {
|
|
15
|
+
/** Returns the current context payload that should be visible to descendants. */
|
|
16
|
+
getContext(): unknown;
|
|
17
|
+
/** Returns the context token used to match nested SSR consumers and providers. */
|
|
18
|
+
getContextKey(): UnknownContext;
|
|
19
|
+
}
|
|
10
20
|
/**
|
|
11
21
|
* Represents a context provider that allows setting and getting the context,
|
|
12
22
|
* as well as subscribing to context updates.
|
|
@@ -52,9 +62,13 @@ export interface IContextProvider<T extends Context<unknown, unknown>> {
|
|
|
52
62
|
* });
|
|
53
63
|
* ```
|
|
54
64
|
*/
|
|
55
|
-
export declare class ContextProvider<T extends Context<unknown, unknown>> implements IContextProvider<T
|
|
65
|
+
export declare class ContextProvider<T extends Context<unknown, unknown>> implements IContextProvider<T>, SsrSerializableContextProvider {
|
|
56
66
|
private host;
|
|
57
67
|
private context;
|
|
68
|
+
private hydrationKey?;
|
|
69
|
+
private hydrate?;
|
|
70
|
+
private serialize?;
|
|
71
|
+
private pendingHostHydration;
|
|
58
72
|
private value;
|
|
59
73
|
subscriptions: ContextSubscription<T>[];
|
|
60
74
|
/**
|
|
@@ -66,8 +80,42 @@ export declare class ContextProvider<T extends Context<unknown, unknown>> implem
|
|
|
66
80
|
constructor(host: RadiantElement, options: ContextProviderOptions<T>);
|
|
67
81
|
setContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;
|
|
68
82
|
getContext: () => ContextType<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the provider's logical context token.
|
|
85
|
+
*
|
|
86
|
+
* SSR helpers use this token to resolve the closest matching provider while a
|
|
87
|
+
* host subtree is being serialized.
|
|
88
|
+
*/
|
|
89
|
+
getContextKey: () => {
|
|
90
|
+
__context__: unknown;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Serializes the current provider value for inclusion in a hydration script.
|
|
94
|
+
*
|
|
95
|
+
* The serialized payload is JSON-escaped so it can be embedded safely inside a
|
|
96
|
+
* `<script type="application/json">` tag.
|
|
97
|
+
*/
|
|
98
|
+
serializeHydrationValue: () => string | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Builds the raw HTML hydration script for this provider.
|
|
101
|
+
*
|
|
102
|
+
* When `hydrationKey` is present, the marker is scoped so sibling or nested
|
|
103
|
+
* providers can recover their own payloads without accidentally reading a
|
|
104
|
+
* descendant script.
|
|
105
|
+
*/
|
|
106
|
+
renderHydrationScriptTag: () => string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Wraps the provider hydration script in a minimal JSX node-like value.
|
|
109
|
+
*
|
|
110
|
+
* This lets JSX-based host renderers append the script without needing a real
|
|
111
|
+
* DOM element instance during SSR.
|
|
112
|
+
*/
|
|
113
|
+
renderHydrationScript: () => JsxRenderable | undefined;
|
|
69
114
|
subscribe: ({ select, callback }: ContextSubscription<T>) => void;
|
|
115
|
+
private tryHydrateFromHost;
|
|
116
|
+
private mergeHydrationValue;
|
|
70
117
|
private isObject;
|
|
118
|
+
private findHydrationScriptElement;
|
|
71
119
|
private notifySubscribers;
|
|
72
120
|
private sendSubscriptionUpdate;
|
|
73
121
|
private handleSubscriptionRequest;
|
|
@@ -1,280 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
function parseAttributeTypeConstant(constant) {
|
|
3
|
-
switch (constant) {
|
|
4
|
-
case Array:
|
|
5
|
-
return "array";
|
|
6
|
-
case Boolean:
|
|
7
|
-
return "boolean";
|
|
8
|
-
case Number:
|
|
9
|
-
return "number";
|
|
10
|
-
case Object:
|
|
11
|
-
return "object";
|
|
12
|
-
case String:
|
|
13
|
-
return "string";
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function parseAttributeTypeDefault(defaultValue) {
|
|
17
|
-
switch (typeof defaultValue) {
|
|
18
|
-
case "boolean":
|
|
19
|
-
return "boolean";
|
|
20
|
-
case "number":
|
|
21
|
-
return "number";
|
|
22
|
-
case "string":
|
|
23
|
-
return "string";
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(defaultValue))
|
|
26
|
-
return "array";
|
|
27
|
-
if (Object.prototype.toString.call(defaultValue) === "[object Object]")
|
|
28
|
-
return "object";
|
|
29
|
-
}
|
|
30
|
-
function defaultValueForType(type) {
|
|
31
|
-
switch (type) {
|
|
32
|
-
case Number:
|
|
33
|
-
return 0;
|
|
34
|
-
case String:
|
|
35
|
-
return "";
|
|
36
|
-
case Boolean:
|
|
37
|
-
return false;
|
|
38
|
-
default:
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function parseJSON(value) {
|
|
43
|
-
try {
|
|
44
|
-
return JSON.parse(value);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
throw new TypeError("Invalid JSON string");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function writeJSON(value) {
|
|
50
|
-
return JSON.stringify(value);
|
|
51
|
-
}
|
|
52
|
-
function writeString(value) {
|
|
53
|
-
return `${value}`;
|
|
54
|
-
}
|
|
55
|
-
function readAttributeValue(value, type) {
|
|
56
|
-
const readerType = parseAttributeTypeConstant(type);
|
|
57
|
-
if (!readerType)
|
|
58
|
-
throw new TypeError(`[radiant-element] Unknown type "${type}"`);
|
|
59
|
-
return readers[readerType](value);
|
|
60
|
-
}
|
|
61
|
-
function writeAttributeValue(value, type) {
|
|
62
|
-
const writerType = parseAttributeTypeConstant(type);
|
|
63
|
-
if (!writerType)
|
|
64
|
-
throw new TypeError(`[radiant-element] Unknown type "${type}"`);
|
|
65
|
-
return (writers[writerType] || writers.default)(value);
|
|
66
|
-
}
|
|
67
|
-
function isBoolean(value) {
|
|
68
|
-
return typeof value === "boolean";
|
|
69
|
-
}
|
|
70
|
-
function isNumber(value) {
|
|
71
|
-
return typeof value === "number";
|
|
72
|
-
}
|
|
73
|
-
function isString(value) {
|
|
74
|
-
return typeof value === "string";
|
|
75
|
-
}
|
|
76
|
-
function isArray(value) {
|
|
77
|
-
return Array.isArray(value);
|
|
78
|
-
}
|
|
79
|
-
function isObject(value) {
|
|
80
|
-
return typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
81
|
-
}
|
|
82
|
-
function isValueOfType(type, defaultValue) {
|
|
83
|
-
switch (type) {
|
|
84
|
-
case Boolean:
|
|
85
|
-
return isBoolean(defaultValue);
|
|
86
|
-
case Number:
|
|
87
|
-
return isNumber(defaultValue);
|
|
88
|
-
case String:
|
|
89
|
-
return isString(defaultValue);
|
|
90
|
-
case Array:
|
|
91
|
-
return isArray(defaultValue);
|
|
92
|
-
case Object:
|
|
93
|
-
return isObject(defaultValue);
|
|
94
|
-
default:
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
var readers = {
|
|
99
|
-
array(value) {
|
|
100
|
-
const array = parseJSON(value);
|
|
101
|
-
if (!Array.isArray(array)) {
|
|
102
|
-
throw new TypeError(`Expected an array but got a value of type "${typeof array}"`);
|
|
103
|
-
}
|
|
104
|
-
return array;
|
|
105
|
-
},
|
|
106
|
-
boolean(value) {
|
|
107
|
-
return !(value === "0" || String(value).toLowerCase() === "false");
|
|
108
|
-
},
|
|
109
|
-
number(value) {
|
|
110
|
-
const number = Number(value.replace(/_/g, ""));
|
|
111
|
-
return number;
|
|
112
|
-
},
|
|
113
|
-
object(value) {
|
|
114
|
-
const object = JSON.parse(value);
|
|
115
|
-
if (object === null || typeof object !== "object" || Array.isArray(object)) {
|
|
116
|
-
throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseAttributeTypeDefault(object)}"`);
|
|
117
|
-
}
|
|
118
|
-
return object;
|
|
119
|
-
},
|
|
120
|
-
string(value) {
|
|
121
|
-
return value;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
var writers = {
|
|
125
|
-
default: writeString,
|
|
126
|
-
array: writeJSON,
|
|
127
|
-
object: writeJSON
|
|
128
|
-
};
|
|
1
|
+
import{o as a}from"../chunk-jg20mzg8.js";import"../chunk-1w1dm68j.js";import"../chunk-6kdxrppw.js";import"../chunk-ksv01cey.js";import"../chunk-8n2dhx28.js";import"../chunk-8xy18qmz.js";export{a as ContextProvider};
|
|
129
2
|
|
|
130
|
-
|
|
131
|
-
var ContextEventsTypes;
|
|
132
|
-
((ContextEventsTypes2) => {
|
|
133
|
-
ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
|
|
134
|
-
ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
|
|
135
|
-
ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
|
|
136
|
-
})(ContextEventsTypes ||= {});
|
|
137
|
-
|
|
138
|
-
class ContextRequestEvent extends Event {
|
|
139
|
-
context;
|
|
140
|
-
callback;
|
|
141
|
-
subscribe;
|
|
142
|
-
constructor(context, callback, subscribe) {
|
|
143
|
-
super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
|
|
144
|
-
this.context = context;
|
|
145
|
-
this.callback = callback;
|
|
146
|
-
this.subscribe = subscribe;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
class ContextOnMountEvent extends CustomEvent {
|
|
151
|
-
constructor(context) {
|
|
152
|
-
super("context--on-mount" /* ON_MOUNT */, {
|
|
153
|
-
detail: { context },
|
|
154
|
-
bubbles: true,
|
|
155
|
-
composed: true
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
class ContextSubscriptionRequestEvent extends Event {
|
|
161
|
-
context;
|
|
162
|
-
callback;
|
|
163
|
-
select;
|
|
164
|
-
subscribe;
|
|
165
|
-
constructor(context, callback, select, subscribe) {
|
|
166
|
-
super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
|
|
167
|
-
bubbles: true,
|
|
168
|
-
composed: true
|
|
169
|
-
});
|
|
170
|
-
this.context = context;
|
|
171
|
-
this.callback = callback;
|
|
172
|
-
this.select = select;
|
|
173
|
-
this.subscribe = subscribe;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/context/context-provider.ts
|
|
178
|
-
class ContextProvider {
|
|
179
|
-
host;
|
|
180
|
-
context;
|
|
181
|
-
value;
|
|
182
|
-
subscriptions = [];
|
|
183
|
-
constructor(host, options) {
|
|
184
|
-
this.host = host;
|
|
185
|
-
this.context = options.context;
|
|
186
|
-
let contextValue = options.initialValue;
|
|
187
|
-
if (options.hydrate) {
|
|
188
|
-
const hydrationScriptElement = this.host.querySelector("script[data-hydration]");
|
|
189
|
-
if (hydrationScriptElement?.textContent) {
|
|
190
|
-
const hydrationValue = hydrationScriptElement.textContent;
|
|
191
|
-
const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate);
|
|
192
|
-
if (options.hydrate === Object && this.isObject(parsedHydrationValue) && (this.isObject(contextValue) || typeof contextValue === "undefined")) {
|
|
193
|
-
contextValue = {
|
|
194
|
-
...contextValue ?? {},
|
|
195
|
-
...parsedHydrationValue
|
|
196
|
-
};
|
|
197
|
-
} else {
|
|
198
|
-
contextValue = parsedHydrationValue;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
this.value = contextValue;
|
|
203
|
-
this.registerEvents();
|
|
204
|
-
this.host.dispatchEvent(new ContextOnMountEvent(this.context));
|
|
205
|
-
}
|
|
206
|
-
setContext = (update, callback) => {
|
|
207
|
-
if (typeof this.value === "object") {
|
|
208
|
-
const oldContext = { ...this.value };
|
|
209
|
-
this.value = { ...this.value, ...update };
|
|
210
|
-
if (callback)
|
|
211
|
-
callback(this.value);
|
|
212
|
-
this.notifySubscribers(this.value, oldContext);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
getContext = () => {
|
|
216
|
-
return this.value;
|
|
217
|
-
};
|
|
218
|
-
subscribe = ({ select, callback }) => {
|
|
219
|
-
this.subscriptions.push({ select, callback });
|
|
220
|
-
};
|
|
221
|
-
isObject(value) {
|
|
222
|
-
return typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
223
|
-
}
|
|
224
|
-
notifySubscribers = (newContext, prevContext) => {
|
|
225
|
-
for (const sub of this.subscriptions) {
|
|
226
|
-
if (!sub.select)
|
|
227
|
-
return this.sendSubscriptionUpdate(sub, newContext);
|
|
228
|
-
const newSelected = sub.select(newContext);
|
|
229
|
-
const prevSelected = sub.select(prevContext);
|
|
230
|
-
if (newSelected !== prevSelected) {
|
|
231
|
-
this.sendSubscriptionUpdate(sub, newContext);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
sendSubscriptionUpdate = ({ select, callback }, context) => {
|
|
236
|
-
if (!select)
|
|
237
|
-
callback(context);
|
|
238
|
-
else
|
|
239
|
-
callback(select(context));
|
|
240
|
-
};
|
|
241
|
-
handleSubscriptionRequest = ({
|
|
242
|
-
select,
|
|
243
|
-
callback,
|
|
244
|
-
subscribe
|
|
245
|
-
}) => {
|
|
246
|
-
if (subscribe)
|
|
247
|
-
this.subscribe({ select, callback });
|
|
248
|
-
if (!this.value)
|
|
249
|
-
return;
|
|
250
|
-
if (select) {
|
|
251
|
-
callback(select(this.value));
|
|
252
|
-
} else {
|
|
253
|
-
callback(this.value);
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
onSubscriptionRequest = (event) => {
|
|
257
|
-
const { context, callback, subscribe, select, target } = event;
|
|
258
|
-
if (context !== this.context)
|
|
259
|
-
return;
|
|
260
|
-
event.stopPropagation();
|
|
261
|
-
target.dispatchEvent(new ContextOnMountEvent(this.context));
|
|
262
|
-
this.handleSubscriptionRequest({ select, callback, subscribe });
|
|
263
|
-
};
|
|
264
|
-
onContextRequest = (event) => {
|
|
265
|
-
const { context, callback } = event;
|
|
266
|
-
if (context !== this.context)
|
|
267
|
-
return;
|
|
268
|
-
event.stopPropagation();
|
|
269
|
-
callback(this);
|
|
270
|
-
};
|
|
271
|
-
registerEvents = () => {
|
|
272
|
-
this.host.addEventListener("context--subscription-request" /* SUBSCRIPTION_REQUEST */, this.onSubscriptionRequest);
|
|
273
|
-
this.host.addEventListener("context-request" /* CONTEXT_REQUEST */, this.onContextRequest);
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
export {
|
|
277
|
-
ContextProvider
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
//# debugId=19BF7CBFBD9F2B6364756E2164756E21
|
|
3
|
+
//# debugId=4B4F943E8C68AC9964756E2164756E21
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
3
|
+
"sources": [],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"export type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n switch (constant) {\n case Array:\n return 'array';\n case Boolean:\n return 'boolean';\n case Number:\n return 'number';\n case Object:\n return 'object';\n case String:\n return 'string';\n }\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n switch (typeof defaultValue) {\n case 'boolean':\n return 'boolean';\n case 'number':\n return 'number';\n case 'string':\n return 'string';\n }\n\n if (Array.isArray(defaultValue)) return 'array';\n if (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n switch (type) {\n case Number:\n return 0;\n case String:\n return '';\n case Boolean:\n return false;\n default:\n return null;\n }\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n try {\n return JSON.parse(value);\n } catch (error) {\n throw new TypeError('Invalid JSON string');\n }\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n array(value: string): unknown[] {\n const array = parseJSON<unknown[]>(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n }\n return array;\n },\n\n boolean(value: string): boolean {\n return !(value === '0' || String(value).toLowerCase() === 'false');\n },\n\n number(value: string): number {\n const number = Number(value.replace(/_/g, ''));\n return number;\n },\n\n object(value: string): object {\n const object = JSON.parse(value);\n if (object === null || typeof object !== 'object' || Array.isArray(object)) {\n throw new TypeError(\n `expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n object,\n )}\"`,\n );\n }\n return object;\n },\n\n string(value: string): string {\n return value;\n },\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n default: writeString,\n array: writeJSON,\n object: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n return JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n return `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n const readerType = parseAttributeTypeConstant(type);\n if (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n return readers[readerType](value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n const writerType = parseAttributeTypeConstant(type);\n if (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n return (writers[writerType] || writers.default)(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n return typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n return typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n return Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n switch (type) {\n case Boolean:\n return isBoolean(defaultValue);\n case Number:\n return isNumber(defaultValue);\n case String:\n return isString(defaultValue);\n case Array:\n return isArray(defaultValue);\n case Object:\n return isObject(defaultValue);\n default:\n return false;\n }\n}\n",
|
|
6
|
-
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n SUBSCRIPTION_REQUEST = 'context--subscription-request',\n CONTEXT_REQUEST = 'context-request',\n ON_MOUNT = 'context--on-mount',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: ContextCallback<ContextType<T>>,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n }\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\nexport type ContextSubscription<T extends UnknownContext> = {\n select?: (context: ContextType<T>) => unknown;\n callback: (value: unknown) => void;\n};\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n public constructor(context: UnknownContext) {\n super(ContextEventsTypes.ON_MOUNT, {\n detail: { context },\n bubbles: true,\n composed: true,\n });\n }\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: (value: ContextType<T> | { [K in keyof ContextType<T>]: ContextType<T>[K] }) => void,\n public readonly select?: (context: ContextType<T>) => unknown,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n bubbles: true,\n composed: true,\n });\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n /**\n * A 'context-request-subscription' event can be emitted by any element which desires\n * a context value to be injected by an external provider.\n */\n [ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n /**\n * A context-request-provider event can be emitted by a context requester to signal\n * that it desires a context value to be provided by a context provider.\n */\n [ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n /**\n * A 'context-mount' event can be emitted by a context provider to signal\n * that a context value has been mounted and is available for consumption.\n */\n [ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n }\n}\n",
|
|
7
|
-
"import type { RadiantElement } from '@/core/radiant-element';\nimport { type AttributeTypeConstant, readAttributeValue } from '@/utils/attribute-utils';\nimport { query } from '..';\nimport {\n ContextEventsTypes,\n ContextOnMountEvent,\n type ContextRequestEvent,\n type ContextSubscription,\n type ContextSubscriptionRequestEvent,\n} from './events';\nimport type { Context, ContextType, UnknownContext } from './types';\n\ntype ContextProviderOptions<T extends UnknownContext> = {\n context: UnknownContext;\n initialValue?: T['__context__'];\n hydrate?: AttributeTypeConstant;\n};\n\n/**\n * Represents a context provider that allows setting and getting the context,\n * as well as subscribing to context updates.\n *\n * @template T - The type of the context.\n */\nexport interface IContextProvider<T extends Context<unknown, unknown>> {\n /**\n * Sets the context with the provided update and invokes the optional callback function.\n *\n * @param update - The partial update to be applied to the context.\n * @param callback - An optional callback function that receives the updated context.\n */\n setContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;\n\n /**\n * Gets the current context.\n *\n * @returns The current context.\n */\n getContext: () => ContextType<T>;\n\n /**\n * Subscribes to context updates.\n *\n * @param subscription - The subscription object that defines the callback function to be invoked on context updates.\n */\n subscribe: (subscription: ContextSubscription<T>) => void;\n}\n\n/**\n * It creates a context provider that allows setting and getting the context,\n * It will also be in charge of notifying the subscribers when the context changes.\n *\n * @template T - The type of the context.\n * @implements IContextProvider\n *\n * @example\n * ```ts\n * export class MyElement extends RadiantElement {\n * provider = new ContextProvider<typeof myContext>(this, {\n * context: myContext,\n * initialValue: {\n * value: 'Hello World',\n * },\n * });\n * ```\n */\nexport class ContextProvider<T extends Context<unknown, unknown>> implements IContextProvider<T> {\n private host: RadiantElement;\n private context: UnknownContext;\n private value: ContextType<T> | undefined;\n\n subscriptions: ContextSubscription<T>[] = [];\n\n /**\n * Creates a new instance of the ContextProvider.\n *\n * @param host - The host element that will contain the context provider.\n * @param options - The options to configure the context provider.\n */\n constructor(host: RadiantElement, options: ContextProviderOptions<T>) {\n this.host = host;\n this.context = options.context;\n let contextValue: T['__context__'] | undefined = options.initialValue;\n\n if (options.hydrate) {\n const hydrationScriptElement = this.host.querySelector('script[data-hydration]');\n if (hydrationScriptElement?.textContent) {\n const hydrationValue = hydrationScriptElement.textContent;\n const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate) as ContextType<T>;\n\n if (\n options.hydrate === Object &&\n this.isObject(parsedHydrationValue) &&\n (this.isObject(contextValue) || typeof contextValue === 'undefined')\n ) {\n contextValue = {\n ...(contextValue ?? {}),\n ...parsedHydrationValue,\n };\n } else {\n contextValue = parsedHydrationValue;\n }\n }\n }\n\n this.value = contextValue as ContextType<T>;\n\n this.registerEvents();\n this.host.dispatchEvent(new ContextOnMountEvent(this.context));\n }\n\n setContext = (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => {\n if (typeof this.value === 'object') {\n const oldContext = { ...this.value };\n this.value = { ...this.value, ...update };\n if (callback) callback(this.value);\n this.notifySubscribers(this.value, oldContext);\n }\n };\n\n getContext = () => {\n return this.value as ContextType<T>;\n };\n\n subscribe = ({ select, callback }: ContextSubscription<T>) => {\n this.subscriptions.push({ select, callback });\n };\n\n private isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n }\n\n private notifySubscribers = (newContext: ContextType<T>, prevContext: ContextType<T>) => {\n for (const sub of this.subscriptions) {\n if (!sub.select) return this.sendSubscriptionUpdate(sub, newContext);\n const newSelected = sub.select(newContext);\n const prevSelected = sub.select(prevContext);\n if (newSelected !== prevSelected) {\n this.sendSubscriptionUpdate(sub, newContext);\n }\n }\n };\n\n private sendSubscriptionUpdate = ({ select, callback }: ContextSubscription<T>, context: ContextType<T>) => {\n if (!select) callback(context);\n else callback(select(context));\n };\n\n private handleSubscriptionRequest = ({\n select,\n callback,\n subscribe,\n }: {\n select?: ContextSubscription<T>['select'];\n callback: ContextSubscription<T>['callback'];\n subscribe?: boolean;\n }) => {\n if (subscribe) this.subscribe({ select, callback });\n\n if (!this.value) return;\n\n if (select) {\n callback(select(this.value));\n } else {\n callback(this.value as ContextType<T>);\n }\n };\n\n private onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n const { context, callback, subscribe, select, target } = event;\n if (context !== this.context) return;\n\n event.stopPropagation();\n\n (target as HTMLElement).dispatchEvent(new ContextOnMountEvent(this.context));\n\n this.handleSubscriptionRequest({ select, callback, subscribe });\n };\n\n private onContextRequest = (event: ContextRequestEvent<UnknownContext>) => {\n const { context, callback } = event;\n if (context !== this.context) return;\n event.stopPropagation();\n callback(this);\n };\n\n private registerEvents = () => {\n this.host.addEventListener(ContextEventsTypes.SUBSCRIPTION_REQUEST, this.onSubscriptionRequest);\n this.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.onContextRequest);\n };\n}\n"
|
|
8
5
|
],
|
|
9
|
-
"mappings": "
|
|
10
|
-
"debugId": "
|
|
6
|
+
"mappings": "",
|
|
7
|
+
"debugId": "4B4F943E8C68AC9964756E2164756E21",
|
|
11
8
|
"names": []
|
|
12
9
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SsrSerializableContextProvider } from './context-provider';
|
|
2
|
+
import type { UnknownContext } from './types';
|
|
3
|
+
type SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Installs the ambient SSR provider resolver used by shared context runtime helpers.
|
|
6
|
+
*
|
|
7
|
+
* Server-side rendering infrastructure owns the actual provider stack storage and
|
|
8
|
+
* publishes a lookup function here so client/runtime code does not need to import
|
|
9
|
+
* server-oriented modules.
|
|
10
|
+
*/
|
|
11
|
+
export declare function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves an ambient SSR provider when a server render has published one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined;
|
|
16
|
+
export {};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
var createContext = (key) => key;
|
|
3
|
-
export {
|
|
4
|
-
createContext
|
|
5
|
-
};
|
|
1
|
+
import{p as a}from"../chunk-zb7wh7w4.js";import"../chunk-8xy18qmz.js";export{a as createContext};
|
|
6
2
|
|
|
7
|
-
//# debugId=
|
|
3
|
+
//# debugId=87DC73B8114B789864756E2164756E21
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
3
|
+
"sources": [],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import type { Context } from './types';\n\n/**\n * A function which creates a Context value object\n */\nexport const createContext = <ValueType>(key: unknown) => key as Context<typeof key, ValueType>;\n"
|
|
6
5
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
6
|
+
"mappings": "",
|
|
7
|
+
"debugId": "87DC73B8114B789864756E2164756E21",
|
|
9
8
|
"names": []
|
|
10
9
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { StandardOrLegacyFieldDecoratorArgs } from '../../types';
|
|
2
|
+
import type { UnknownContext } from '../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Injects the nearest matching context provider onto a decorated field.
|
|
5
|
+
*
|
|
6
|
+
* During SSR the field can be resolved from the active SSR context stack; on
|
|
7
|
+
* the client it falls back to the DOM event-based context channel.
|
|
8
|
+
*
|
|
9
|
+
* @param context Context token to consume from ancestor providers.
|
|
10
|
+
* @returns A standard-or-legacy decorator implementation for the target field.
|
|
7
11
|
*/
|
|
8
|
-
export declare function consumeContext(
|
|
12
|
+
export declare function consumeContext(context: UnknownContext): (protoOrTarget: StandardOrLegacyFieldDecoratorArgs["protoOrTarget"], nameOrContext: StandardOrLegacyFieldDecoratorArgs["nameOrContext"]) => any;
|