@ecopages/radiant 0.2.0 → 0.3.0-alpha.1
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 +293 -34
- package/dist/chunk-0bswvy25.js +4 -0
- package/dist/chunk-0bswvy25.js.map +10 -0
- package/dist/chunk-0btkzzyc.js +4 -0
- package/dist/chunk-0btkzzyc.js.map +10 -0
- package/dist/chunk-0g0j9re6.js +4 -0
- package/dist/chunk-0g0j9re6.js.map +10 -0
- package/dist/chunk-1x26p09c.js +4 -0
- package/dist/chunk-1x26p09c.js.map +10 -0
- package/dist/chunk-21a7jask.js +4 -0
- package/dist/chunk-21a7jask.js.map +10 -0
- package/dist/chunk-25zjh0kg.js +4 -0
- package/dist/chunk-25zjh0kg.js.map +10 -0
- package/dist/chunk-30x4hggg.js +4 -0
- package/dist/chunk-30x4hggg.js.map +10 -0
- package/dist/chunk-3ryr5wx2.js +4 -0
- package/dist/chunk-3ryr5wx2.js.map +10 -0
- package/dist/chunk-3xxvmd5c.js +4 -0
- package/dist/chunk-3xxvmd5c.js.map +10 -0
- package/dist/chunk-3ynk7e1e.js +4 -0
- package/dist/chunk-3ynk7e1e.js.map +10 -0
- package/dist/chunk-4e559cy5.js +4 -0
- package/dist/chunk-4e559cy5.js.map +10 -0
- package/dist/chunk-5b1en9vz.js +4 -0
- package/dist/chunk-5b1en9vz.js.map +10 -0
- package/dist/chunk-5bkat72n.js +4 -0
- package/dist/chunk-5bkat72n.js.map +10 -0
- package/dist/chunk-5qeaq3tj.js +4 -0
- package/dist/chunk-5qeaq3tj.js.map +10 -0
- package/dist/chunk-66e6s792.js +4 -0
- package/dist/chunk-66e6s792.js.map +10 -0
- package/dist/chunk-79jg8q67.js +4 -0
- package/dist/chunk-79jg8q67.js.map +10 -0
- package/dist/chunk-8d5ddvvf.js +4 -0
- package/dist/chunk-8d5ddvvf.js.map +10 -0
- package/dist/chunk-8e9fgtbn.js +4 -0
- package/dist/chunk-8e9fgtbn.js.map +10 -0
- package/dist/chunk-9mqtp3js.js +4 -0
- package/dist/chunk-9mqtp3js.js.map +10 -0
- package/dist/chunk-9rj2rwes.js +4 -0
- package/dist/chunk-9rj2rwes.js.map +10 -0
- package/dist/chunk-atms6yrh.js +4 -0
- package/dist/chunk-atms6yrh.js.map +10 -0
- package/dist/chunk-bk2nbmcd.js +4 -0
- package/dist/chunk-bk2nbmcd.js.map +10 -0
- package/dist/chunk-bk6qkvfp.js +4 -0
- package/dist/chunk-bk6qkvfp.js.map +10 -0
- package/dist/chunk-c0qyz98c.js +4 -0
- package/dist/chunk-c0qyz98c.js.map +10 -0
- package/dist/chunk-c52qhh0j.js +4 -0
- package/dist/chunk-c52qhh0j.js.map +10 -0
- package/dist/chunk-cnyxrh9r.js +4 -0
- package/dist/chunk-cnyxrh9r.js.map +10 -0
- package/dist/chunk-cvz9mrxa.js +4 -0
- package/dist/chunk-cvz9mrxa.js.map +10 -0
- package/dist/chunk-dabagjk6.js +4 -0
- package/dist/chunk-dabagjk6.js.map +10 -0
- package/dist/chunk-e0r6ca2g.js +4 -0
- package/dist/chunk-e0r6ca2g.js.map +10 -0
- package/dist/chunk-eevw1j2q.js +4 -0
- package/dist/chunk-eevw1j2q.js.map +10 -0
- package/dist/chunk-ek664x1c.js +4 -0
- package/dist/chunk-ek664x1c.js.map +10 -0
- package/dist/chunk-eyw14d6y.js +4 -0
- package/dist/chunk-eyw14d6y.js.map +10 -0
- package/dist/chunk-fs4j94bk.js +4 -0
- package/dist/chunk-fs4j94bk.js.map +10 -0
- package/dist/chunk-g2z3mm6b.js +4 -0
- package/dist/chunk-g2z3mm6b.js.map +10 -0
- package/dist/chunk-g5n3m11h.js +4 -0
- package/dist/chunk-g5n3m11h.js.map +10 -0
- package/dist/chunk-gdkte2vd.js +4 -0
- package/dist/chunk-gdkte2vd.js.map +10 -0
- package/dist/chunk-gg74gdpv.js +4 -0
- package/dist/chunk-gg74gdpv.js.map +10 -0
- package/dist/chunk-h9k7crjc.js +4 -0
- package/dist/chunk-h9k7crjc.js.map +10 -0
- package/dist/chunk-hpzgnxgq.js +4 -0
- package/dist/chunk-hpzgnxgq.js.map +10 -0
- package/dist/chunk-hrjc8b1y.js +4 -0
- package/dist/chunk-hrjc8b1y.js.map +10 -0
- package/dist/chunk-hvy4zvcc.js +4 -0
- package/dist/chunk-hvy4zvcc.js.map +10 -0
- package/dist/chunk-hztr86b4.js +4 -0
- package/dist/chunk-hztr86b4.js.map +10 -0
- package/dist/chunk-j3v7rca5.js +4 -0
- package/dist/chunk-j3v7rca5.js.map +10 -0
- package/dist/chunk-j864sv4w.js +4 -0
- package/dist/chunk-j864sv4w.js.map +10 -0
- package/dist/chunk-jkb2y7c8.js +4 -0
- package/dist/chunk-jkb2y7c8.js.map +10 -0
- package/dist/chunk-kakpjgzf.js +4 -0
- package/dist/chunk-kakpjgzf.js.map +10 -0
- package/dist/chunk-kmebacvv.js +4 -0
- package/dist/chunk-kmebacvv.js.map +10 -0
- package/dist/chunk-knqsm6v3.js +4 -0
- package/dist/chunk-knqsm6v3.js.map +10 -0
- package/dist/chunk-mp2vtrkg.js +4 -0
- package/dist/chunk-mp2vtrkg.js.map +10 -0
- package/dist/chunk-mpsj3cjs.js +4 -0
- package/dist/chunk-mpsj3cjs.js.map +10 -0
- package/dist/chunk-n4p2542b.js +4 -0
- package/dist/chunk-n4p2542b.js.map +10 -0
- package/dist/chunk-nctznxyz.js +4 -0
- package/dist/chunk-nctznxyz.js.map +10 -0
- package/dist/chunk-ndw3hc3v.js +4 -0
- package/dist/chunk-ndw3hc3v.js.map +10 -0
- package/dist/chunk-nnnb6pac.js +4 -0
- package/dist/chunk-nnnb6pac.js.map +10 -0
- package/dist/chunk-nssj2x13.js +4 -0
- package/dist/chunk-nssj2x13.js.map +10 -0
- package/dist/chunk-nvr37vma.js +4 -0
- package/dist/chunk-nvr37vma.js.map +10 -0
- package/dist/chunk-p8k4g99a.js +4 -0
- package/dist/chunk-p8k4g99a.js.map +10 -0
- package/dist/chunk-pkszgjqf.js +4 -0
- package/dist/chunk-pkszgjqf.js.map +10 -0
- package/dist/chunk-q9z6tnzw.js +4 -0
- package/dist/chunk-q9z6tnzw.js.map +10 -0
- package/dist/chunk-qdz5sncz.js +4 -0
- package/dist/chunk-qdz5sncz.js.map +10 -0
- package/dist/chunk-qe0eww1n.js +4 -0
- package/dist/chunk-qe0eww1n.js.map +10 -0
- package/dist/chunk-r33zvvda.js +4 -0
- package/dist/chunk-r33zvvda.js.map +10 -0
- package/dist/chunk-rkh1vkb9.js +4 -0
- package/dist/chunk-rkh1vkb9.js.map +10 -0
- package/dist/chunk-rrg759ht.js +4 -0
- package/dist/chunk-rrg759ht.js.map +10 -0
- package/dist/chunk-s09s5ayx.js +4 -0
- package/dist/chunk-s09s5ayx.js.map +10 -0
- package/dist/chunk-s5p5z3z4.js +4 -0
- package/dist/chunk-s5p5z3z4.js.map +10 -0
- package/dist/chunk-sf4a2gy5.js +4 -0
- package/dist/chunk-sf4a2gy5.js.map +10 -0
- package/dist/chunk-ssnnxzrj.js +4 -0
- package/dist/chunk-ssnnxzrj.js.map +10 -0
- package/dist/chunk-t8xtvgyg.js +4 -0
- package/dist/chunk-t8xtvgyg.js.map +10 -0
- package/dist/chunk-v3ta7hnv.js +4 -0
- package/dist/chunk-v3ta7hnv.js.map +10 -0
- package/dist/chunk-v92hp9g0.js +4 -0
- package/dist/chunk-v92hp9g0.js.map +10 -0
- package/dist/chunk-vgtggzb6.js +4 -0
- package/dist/chunk-vgtggzb6.js.map +9 -0
- package/dist/chunk-vk48hgm4.js +4 -0
- package/dist/chunk-vk48hgm4.js.map +10 -0
- package/dist/chunk-w8s5fnsq.js +4 -0
- package/dist/chunk-w8s5fnsq.js.map +10 -0
- package/dist/chunk-wd23rn4q.js +4 -0
- package/dist/chunk-wd23rn4q.js.map +10 -0
- package/dist/chunk-wds4href.js +4 -0
- package/dist/chunk-wds4href.js.map +10 -0
- package/dist/chunk-wvd1ffe4.js +4 -0
- package/dist/chunk-wvd1ffe4.js.map +10 -0
- package/dist/chunk-wwbjz9k4.js +4 -0
- package/dist/chunk-wwbjz9k4.js.map +10 -0
- package/dist/chunk-x2k0ngpz.js +4 -0
- package/dist/chunk-x2k0ngpz.js.map +10 -0
- package/dist/chunk-x457d0ap.js +4 -0
- package/dist/chunk-x457d0ap.js.map +10 -0
- package/dist/chunk-xbhtzkre.js +4 -0
- package/dist/chunk-xbhtzkre.js.map +10 -0
- package/dist/chunk-y139ycfm.js +4 -0
- package/dist/chunk-y139ycfm.js.map +10 -0
- package/dist/chunk-z9kxfckm.js +4 -0
- package/dist/chunk-z9kxfckm.js.map +10 -0
- package/dist/chunk-zx5txex8.js +4 -0
- package/dist/chunk-zx5txex8.js.map +10 -0
- package/dist/client/hydrator.d.ts +19 -0
- package/dist/client/hydrator.js +3 -0
- package/dist/client/hydrator.js.map +9 -0
- package/dist/client/install-hydrator.d.ts +1 -0
- package/dist/client/install-hydrator.js +3 -0
- package/dist/client/install-hydrator.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 -3
- package/dist/context/context-provider.js.map +3 -4
- 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 -3
- package/dist/context/create-context.js.map +3 -4
- package/dist/context/decorators/consume-context.d.ts +8 -4
- package/dist/context/decorators/consume-context.js +2 -3
- package/dist/context/decorators/consume-context.js.map +3 -4
- 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 +26 -8
- package/dist/context/decorators/context-selector.js +2 -3
- package/dist/context/decorators/context-selector.js.map +3 -4
- package/dist/context/decorators/legacy/consume-context.d.ts +1 -1
- package/dist/context/decorators/legacy/consume-context.js +2 -3
- package/dist/context/decorators/legacy/consume-context.js.map +3 -4
- 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 +3 -3
- package/dist/context/decorators/legacy/context-selector.js +2 -3
- package/dist/context/decorators/legacy/context-selector.js.map +3 -4
- package/dist/context/decorators/legacy/provide-context.d.ts +1 -1
- package/dist/context/decorators/legacy/provide-context.js +2 -3
- package/dist/context/decorators/legacy/provide-context.js.map +3 -4
- 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 +12 -0
- package/dist/context/decorators/provide-context.js +2 -3
- package/dist/context/decorators/provide-context.js.map +3 -4
- package/dist/context/decorators/standard/consume-context.d.ts +1 -1
- package/dist/context/decorators/standard/consume-context.js +2 -3
- package/dist/context/decorators/standard/consume-context.js.map +3 -4
- 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 +4 -3
- package/dist/context/decorators/standard/context-selector.js +2 -3
- package/dist/context/decorators/standard/context-selector.js.map +3 -4
- package/dist/context/decorators/standard/provide-context.d.ts +1 -1
- package/dist/context/decorators/standard/provide-context.js +2 -3
- package/dist/context/decorators/standard/provide-context.js.map +3 -4
- package/dist/context/events.js +2 -3
- package/dist/context/events.js.map +3 -4
- package/dist/context/hydration-script.d.ts +13 -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-registry.d.ts +54 -0
- package/dist/core/radiant-component-ssr-registry.js +3 -0
- package/dist/core/radiant-component-ssr-registry.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 +113 -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 +217 -9
- package/dist/core/radiant-element.js +2 -3
- package/dist/core/radiant-element.js.map +3 -4
- package/dist/core/radiant-hydrator-state.d.ts +20 -0
- package/dist/core/radiant-hydrator-state.js +3 -0
- package/dist/core/radiant-hydrator-state.js.map +9 -0
- 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-runtime.d.ts +14 -0
- package/dist/core/slot-projection-runtime.js +3 -0
- package/dist/core/slot-projection-runtime.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.js +2 -2
- 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.js +2 -3
- package/dist/decorators/custom-element.js.map +3 -4
- package/dist/decorators/debounce.js +2 -2
- package/dist/decorators/debounce.js.map +3 -4
- package/dist/decorators/event.js +2 -3
- package/dist/decorators/event.js.map +3 -4
- package/dist/decorators/legacy/bound.js +2 -3
- package/dist/decorators/legacy/bound.js.map +3 -4
- package/dist/decorators/legacy/custom-element.js +2 -3
- package/dist/decorators/legacy/custom-element.js.map +3 -4
- package/dist/decorators/legacy/debounce.js +2 -3
- package/dist/decorators/legacy/debounce.js.map +3 -4
- package/dist/decorators/legacy/event.d.ts +1 -1
- package/dist/decorators/legacy/event.js +2 -2
- package/dist/decorators/legacy/event.js.map +3 -4
- 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 +2 -11
- package/dist/decorators/legacy/on-event.js +2 -3
- package/dist/decorators/legacy/on-event.js.map +3 -4
- package/dist/decorators/legacy/on-updated.js +2 -3
- package/dist/decorators/legacy/on-updated.js.map +3 -4
- 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.js +2 -3
- package/dist/decorators/legacy/query.js.map +3 -4
- package/dist/decorators/legacy/reactive-field.js +2 -3
- package/dist/decorators/legacy/reactive-field.js.map +3 -4
- package/dist/decorators/legacy/reactive-prop.d.ts +2 -1
- package/dist/decorators/legacy/reactive-prop.js +2 -3
- package/dist/decorators/legacy/reactive-prop.js.map +3 -4
- 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 +3 -11
- package/dist/decorators/on-event.js +2 -3
- package/dist/decorators/on-event.js.map +3 -4
- package/dist/decorators/on-updated.js +2 -3
- 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 +4 -13
- package/dist/decorators/query.js +2 -3
- 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.js +2 -3
- package/dist/decorators/standard/bound.js.map +3 -4
- package/dist/decorators/standard/custom-element.js +2 -3
- package/dist/decorators/standard/custom-element.js.map +3 -4
- package/dist/decorators/standard/debounce.js +2 -3
- package/dist/decorators/standard/debounce.js.map +3 -4
- package/dist/decorators/standard/event.d.ts +1 -1
- package/dist/decorators/standard/event.js +2 -3
- package/dist/decorators/standard/event.js.map +3 -4
- package/dist/decorators/standard/on-event.d.ts +1 -11
- package/dist/decorators/standard/on-event.js +2 -3
- package/dist/decorators/standard/on-event.js.map +3 -4
- package/dist/decorators/standard/on-updated.js +2 -3
- package/dist/decorators/standard/on-updated.js.map +3 -4
- 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.js +2 -3
- package/dist/decorators/standard/query.js.map +3 -4
- package/dist/decorators/standard/reactive-field.js +2 -3
- package/dist/decorators/standard/reactive-field.js.map +3 -4
- package/dist/decorators/standard/reactive-prop.d.ts +1 -1
- package/dist/decorators/standard/reactive-prop.js +2 -3
- package/dist/decorators/standard/reactive-prop.js.map +3 -4
- 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/{mixins → helpers}/index.js.map +1 -1
- package/dist/index.d.ts +13 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- 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/html-parser.d.ts +21 -0
- package/dist/server/html-parser.js +3 -0
- package/dist/server/html-parser.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/radiant-component-ssr-runtime.d.ts +9 -0
- package/dist/server/radiant-component-ssr-runtime.js +3 -0
- package/dist/server/radiant-component-ssr-runtime.js.map +9 -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/server/slot-projection-html.d.ts +3 -0
- package/dist/server/slot-projection-html.js +3 -0
- package/dist/server/slot-projection-html.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 +7 -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.js +2 -3
- package/dist/tools/event-emitter.js.map +3 -4
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +2 -2
- package/dist/tools/index.js.map +1 -1
- 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 -3
- package/dist/tools/stringify-typed.js.map +3 -4
- package/dist/types.d.ts +0 -21
- package/dist/types.js +2 -2
- package/dist/types.js.map +3 -3
- package/dist/utils/attribute-utils.js +2 -3
- package/dist/utils/attribute-utils.js.map +3 -4
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +106 -21
- package/size-budget.json +16 -0
- package/dist/decorators/reactive-field.d.ts +0 -6
- package/dist/decorators/reactive-field.js +0 -4
- package/dist/decorators/reactive-field.js.map +0 -10
- package/dist/decorators/reactive-prop.d.ts +0 -8
- package/dist/decorators/reactive-prop.js +0 -4
- package/dist/decorators/reactive-prop.js.map +0 -10
- package/dist/mixins/index.d.ts +0 -1
- package/dist/mixins/index.js +0 -3
- package/dist/mixins/with-kita.d.ts +0 -15
- package/dist/mixins/with-kita.js +0 -4
- package/dist/mixins/with-kita.js.map +0 -10
package/README.md
CHANGED
|
@@ -1,45 +1,304 @@
|
|
|
1
1
|
# Radiant
|
|
2
2
|
|
|
3
|
-
Radiant is a
|
|
3
|
+
Radiant is a light-DOM custom element library.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
It keeps browser primitives visible instead of wrapping them in a synthetic component model. You work with real custom elements, real DOM events, real attributes, and real light-DOM children. When you want JSX-backed rendering, SSR host serialization, and hydration, use `RadiantComponent`. When you want a more imperative base without JSX, use `RadiantElement`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Radiant deliberately does not use shadow DOM by default. That makes styling, DOM inspection, and authored child content simpler, while giving up some of the encapsulation that conventional custom-element guidance usually prefers.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
For the full docs site, see [radiant.ecopages.app](https://radiant.ecopages.app/).
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Installation
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`@ecopages/radiant` currently expects both `@ecopages/signals` and `@ecopages/jsx` as peer dependencies.
|
|
14
|
+
|
|
15
|
+
Install all three packages:
|
|
14
16
|
|
|
15
17
|
```sh
|
|
16
|
-
bun install @ecopages/radiant
|
|
18
|
+
bun install @ecopages/radiant @ecopages/signals @ecopages/jsx
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Important: even if you are starting from `RadiantElement`, the current package surface still depends on `@ecopages/jsx`.
|
|
22
|
+
|
|
23
|
+
## RadiantComponent Mental Model
|
|
24
|
+
|
|
25
|
+
`RadiantComponent` is the structured JSX-first base class.
|
|
26
|
+
|
|
27
|
+
- `render()` returns the current JSX view.
|
|
28
|
+
- First connect automatically chooses between hydration and a fresh client render.
|
|
29
|
+
- `update()` reruns `render()` and commits the current view into the host immediately.
|
|
30
|
+
- `requestUpdate()` schedules one rerender in a microtask and coalesces repeated requests.
|
|
31
|
+
- `@prop(...)`, `@state`, and `@signal(...)` define reactive members.
|
|
32
|
+
- `@onUpdated(...)` is the bridge from reactive member changes to `update()` or `requestUpdate()` when the rendered structure needs to be recomputed.
|
|
33
|
+
- `this.bindings.key`, `this.$.key`, and `this.bind('key')` expose stable JSX bindings for reactive members.
|
|
34
|
+
- If `render()` is omitted, the base implementation behaves like `<slot />`, so authored light-DOM children pass through unchanged.
|
|
35
|
+
- Literal `<slot>` tags project authored light-DOM content, and `getSlotElement(...)`, `getSlotElements(...)`, or `@querySlot(...)` let component logic read the assigned elements.
|
|
36
|
+
|
|
37
|
+
The key distinction is this:
|
|
38
|
+
|
|
39
|
+
- Use bindings such as `this.$.count` when the shape of the view stays the same and only child values need to change.
|
|
40
|
+
- Use `update()` or `requestUpdate()` when a reactive change affects the structure of the JSX tree.
|
|
41
|
+
|
|
42
|
+
Signal and store reads performed directly inside `render()` also participate in rerender invalidation, so shared reactive data can drive `RadiantComponent` views without an extra wrapper layer.
|
|
43
|
+
|
|
44
|
+
## Counter Example
|
|
45
|
+
|
|
46
|
+
This counter shows the intended `RadiantComponent` style for stable templates: public props stay explicit, internal state stays local, and bound child values update without forcing a full rerender of the whole template.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
/** @jsxImportSource @ecopages/jsx */
|
|
50
|
+
|
|
51
|
+
import type { JsxCustomElementAttributes } from '@ecopages/jsx';
|
|
52
|
+
import { RadiantComponent, customElement, prop, state } from '@ecopages/radiant';
|
|
53
|
+
|
|
54
|
+
type CounterCardBindings = {
|
|
55
|
+
count: number;
|
|
56
|
+
label: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type CounterCardAttributes = {
|
|
60
|
+
label?: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
@customElement('counter-card')
|
|
64
|
+
export class CounterCard extends RadiantComponent<CounterCardBindings> {
|
|
65
|
+
@prop({ type: String, defaultValue: 'Clicks' }) label!: string;
|
|
66
|
+
@state count = 0;
|
|
67
|
+
|
|
68
|
+
private readonly increment = () => {
|
|
69
|
+
this.count += 1;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
override render() {
|
|
73
|
+
return (
|
|
74
|
+
<section>
|
|
75
|
+
<h2>{this.$.label}</h2>
|
|
76
|
+
<p>Count: {this.$.count}</p>
|
|
77
|
+
<button type="button" on:click={this.increment}>
|
|
78
|
+
Increment
|
|
79
|
+
</button>
|
|
80
|
+
</section>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare module '@ecopages/jsx/jsx-runtime' {
|
|
86
|
+
interface JsxCustomIntrinsicElements {
|
|
87
|
+
'counter-card': JsxCustomElementAttributes<HTMLElement, CounterCardAttributes>;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
How this works:
|
|
93
|
+
|
|
94
|
+
- `@prop(...)` makes `label` part of the component's public reactive property and attribute surface.
|
|
95
|
+
- `@state` is internal mutable state.
|
|
96
|
+
- `this.$.label` and `this.$.count` are cached JSX bindings, so those text positions can update directly when the underlying reactive members change.
|
|
97
|
+
- This example does not call `update()` because the view structure is stable. Only the bound child values change.
|
|
98
|
+
- The JSX intrinsic-element declaration uses a public attribute type that is narrower than the internal binding shape. That is usually the right split.
|
|
99
|
+
|
|
100
|
+
If the same type truly represents both internal bindings and public JSX attributes, you can reuse it for both. Otherwise, keep those contracts separate.
|
|
101
|
+
|
|
102
|
+
### When To Call `update()`
|
|
103
|
+
|
|
104
|
+
Call `update()` or `requestUpdate()` when a reactive change affects which elements should exist, not just their child values.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { RadiantComponent, onUpdated, state } from '@ecopages/radiant';
|
|
108
|
+
|
|
109
|
+
export class ResultsPanel extends RadiantComponent<{ expanded: boolean }> {
|
|
110
|
+
@state expanded = false;
|
|
111
|
+
|
|
112
|
+
@onUpdated('expanded')
|
|
113
|
+
protected rerenderView(): void {
|
|
114
|
+
this.requestUpdate();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
17
117
|
```
|
|
18
118
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
119
|
+
Use `update()` when you want the rerender immediately. Use `requestUpdate()` when several changes may happen in the same turn and one final rerender is enough.
|
|
120
|
+
|
|
121
|
+
## Reactive JSX Bindings
|
|
122
|
+
|
|
123
|
+
Bindings are the non-obvious part of the API, and they are worth being explicit about.
|
|
124
|
+
|
|
125
|
+
`RadiantComponent<Bindings>` and `RadiantElement<Bindings>` take a dedicated binding shape, not the full class type. That keeps the binding namespace limited to the reactive props or fields you want JSX to consume.
|
|
126
|
+
|
|
127
|
+
These three forms are equivalent:
|
|
128
|
+
|
|
129
|
+
- `this.bindings.count`
|
|
130
|
+
- `this.$.count`
|
|
131
|
+
- `this.bind('count')`
|
|
132
|
+
|
|
133
|
+
They all resolve through the same cached binding object.
|
|
134
|
+
|
|
135
|
+
Use bindings when:
|
|
136
|
+
|
|
137
|
+
- the rendered element structure stays the same
|
|
138
|
+
- only text, attribute, or child-value positions need to change
|
|
139
|
+
- you want the renderer to patch the owned child range instead of rerunning the whole component view
|
|
140
|
+
|
|
141
|
+
Use `@onUpdated(...)` with `update()` or `requestUpdate()` when the reactive change should rebuild the JSX tree.
|
|
142
|
+
|
|
143
|
+
## SSR And Hydration
|
|
144
|
+
|
|
145
|
+
`RadiantComponent` has two SSR surfaces:
|
|
146
|
+
|
|
147
|
+
- `renderToString()` serializes the component view only.
|
|
148
|
+
- `renderHostToString()` serializes the custom-element host together with the current view.
|
|
149
|
+
|
|
150
|
+
In practice, `renderHostToString()` is the right default for full component SSR because it emits `<my-element>...</my-element>` instead of only the view fragment.
|
|
151
|
+
|
|
152
|
+
`hydrate: true` adds hydration markers for the component view. First-connect hydration is now explicit: SSR pages should import `@ecopages/radiant/client/install-hydrator` before loading component modules, or call `installRadiantHydrator()` from `@ecopages/radiant/client/hydrator` before custom elements upgrade. Without that client hydrator gate, SSR hosts fall back to a fresh client render on first connect.
|
|
153
|
+
|
|
154
|
+
For component-owned SSR, the instance methods still work. For adapters, fragment responses, and shared server utilities, prefer the explicit helpers under `@ecopages/radiant/server/render-component`.
|
|
155
|
+
|
|
156
|
+
Server runtime setup, fragment rendering helpers, and SSR-specific import guidance now live in [src/server/README.md](src/server/README.md).
|
|
157
|
+
|
|
158
|
+
For the client lifecycle and hydration flow diagram, see [src/core/README.md](src/core/README.md).
|
|
159
|
+
|
|
160
|
+
## Event Handling
|
|
161
|
+
|
|
162
|
+
Radiant does not invent a synthetic event layer. JSX handlers and decorators work with the native browser event object directly.
|
|
163
|
+
|
|
164
|
+
| Use this | When you want | Runtime shape |
|
|
165
|
+
| -------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
166
|
+
| `on:*` in JSX | The normal event API | Auto-delegates a fixed allowlist of bubbling events and falls back to direct listeners otherwise |
|
|
167
|
+
| `on-native:*` in JSX | Exact element-level browser listener semantics | Always calls `addEventListener(...)` on that element |
|
|
168
|
+
| `@onEvent(...)` | Class-level listening from `RadiantElement` or `RadiantComponent` | Supports `selector`, `ref`, `window`, and `document` targets |
|
|
169
|
+
| `@event(...)` | A typed custom event emitter owned by the component | Dispatches a real `CustomEvent` from the host element |
|
|
170
|
+
|
|
171
|
+
### How JSX Event Binding Works
|
|
172
|
+
|
|
173
|
+
`on:*` is the default JSX event API. For a fixed allowlist of bubbling events, Radiant attaches one listener per event type on the render root and dispatches to matched elements. For all other events, `on:*` attaches directly on the element.
|
|
174
|
+
|
|
175
|
+
Today the delegated allowlist is:
|
|
176
|
+
|
|
177
|
+
- `beforeinput`
|
|
178
|
+
- `click`
|
|
179
|
+
- `contextmenu`
|
|
180
|
+
- `dblclick`
|
|
181
|
+
- `focusin`
|
|
182
|
+
- `focusout`
|
|
183
|
+
- `input`
|
|
184
|
+
- `keydown`
|
|
185
|
+
- `keyup`
|
|
186
|
+
- `mousedown`
|
|
187
|
+
- `mouseout`
|
|
188
|
+
- `mouseover`
|
|
189
|
+
- `mouseup`
|
|
190
|
+
- `pointerdown`
|
|
191
|
+
- `pointerout`
|
|
192
|
+
- `pointerover`
|
|
193
|
+
- `pointerup`
|
|
194
|
+
- `touchend`
|
|
195
|
+
- `touchmove`
|
|
196
|
+
- `touchstart`
|
|
197
|
+
|
|
198
|
+
Use `on-native:*` when exact attachment semantics matter, such as when an ancestor may stop propagation before the delegated root listener runs or when you want to opt out of delegation for a supported bubbling event.
|
|
199
|
+
|
|
200
|
+
Events outside the allowlist, such as `focus`, `blur`, `scroll`, `load`, `invalid`, or `dragstart`, already attach directly when authored with `on:*`.
|
|
201
|
+
|
|
202
|
+
### `@onEvent(...)`
|
|
203
|
+
|
|
204
|
+
At the class level, `@onEvent(...)` is the main decorator for incoming DOM events. It can listen to:
|
|
205
|
+
|
|
206
|
+
- descendants that match a CSS selector
|
|
207
|
+
- descendants marked with `data-ref`
|
|
208
|
+
- global `window` events
|
|
209
|
+
- global `document` events
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
/** @jsxImportSource @ecopages/jsx */
|
|
213
|
+
|
|
214
|
+
import { RadiantComponent, customElement, onEvent, state } from '@ecopages/radiant';
|
|
215
|
+
|
|
216
|
+
@customElement('keyboard-panel')
|
|
217
|
+
export class KeyboardPanel extends RadiantComponent<{ lastKey: string }> {
|
|
218
|
+
@state lastKey = 'none';
|
|
219
|
+
|
|
220
|
+
@onEvent({ document: true, type: 'keydown' })
|
|
221
|
+
protected onKeydown(event: KeyboardEvent): void {
|
|
222
|
+
this.lastKey = event.key;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
override render() {
|
|
226
|
+
return <p>Last key: {this.$.lastKey}</p>;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Important: `@onEvent({ selector: ... })` and `@onEvent({ ref: ... })` currently check `event.target.matches(...)` directly. That means matching is strict against the original target, not ancestor-aware. If a nested element inside a button receives the click, the nested element must match for the handler to run.
|
|
232
|
+
|
|
233
|
+
Also note that selector- and ref-based `@onEvent(...)` handlers rely on bubbling. Use `focusin` and `focusout` instead of `focus` and `blur` for that pattern.
|
|
234
|
+
|
|
235
|
+
### `@event(...)`
|
|
236
|
+
|
|
237
|
+
Outgoing component events use `@event(...)`, which gives the class a typed `EventEmitter`. Calling `.emit(detail)` dispatches a real `CustomEvent` from the host element.
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
import type { EventEmitter } from '@ecopages/radiant/tools/event-emitter';
|
|
241
|
+
import { RadiantElement, customElement, event } from '@ecopages/radiant';
|
|
242
|
+
|
|
243
|
+
type SaveDetail = {
|
|
244
|
+
id: string;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
@customElement('save-button')
|
|
248
|
+
export class SaveButton extends RadiantElement {
|
|
249
|
+
@event({ name: 'save-requested', bubbles: true, composed: true })
|
|
250
|
+
saveRequested!: EventEmitter<SaveDetail>;
|
|
251
|
+
|
|
252
|
+
requestSave(): void {
|
|
253
|
+
this.saveRequested.emit({ id: 'draft-1' });
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
The mental model stays simple:
|
|
259
|
+
|
|
260
|
+
- DOM events come in through JSX handlers or `@onEvent(...)`
|
|
261
|
+
- component events go out through `@event(...)`
|
|
262
|
+
- both are ordinary browser events at runtime
|
|
263
|
+
|
|
264
|
+
## Public Entry Points
|
|
265
|
+
|
|
266
|
+
These are the documented public import paths exposed by the package.
|
|
267
|
+
|
|
268
|
+
| Path | Use for |
|
|
269
|
+
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
270
|
+
| `@ecopages/radiant` | Main client entrypoint. Re-exports `RadiantElement`, `RadiantComponent`, common decorators, and context helpers |
|
|
271
|
+
| `@ecopages/radiant/context` | Context-related exports as a grouped entrypoint |
|
|
272
|
+
| `@ecopages/radiant/context/create-context` | Creating context keys |
|
|
273
|
+
| `@ecopages/radiant/context/context-provider` | Low-level context provider class |
|
|
274
|
+
| `@ecopages/radiant/context/consume-context` | `@consumeContext(...)` decorator |
|
|
275
|
+
| `@ecopages/radiant/context/provide-context` | `@provideContext(...)` decorator |
|
|
276
|
+
| `@ecopages/radiant/context/context-selector` | `@contextSelector(...)` decorator — bind a field to context |
|
|
277
|
+
| `@ecopages/radiant/context/on-context-update` | `@onContextUpdate(...)` decorator — run a method on context change |
|
|
278
|
+
| `@ecopages/radiant/core/radiant-element` | Non-JSX reactive custom-element base |
|
|
279
|
+
| `@ecopages/radiant/core/radiant-component` | JSX-first component base |
|
|
280
|
+
| `@ecopages/radiant/client/hydrator` | Explicit client hydrator installer and status helpers for SSR pages |
|
|
281
|
+
| `@ecopages/radiant/client/install-hydrator` | Side-effect entrypoint that enables first-connect hydration before component modules load |
|
|
282
|
+
| `@ecopages/radiant/signals/host-resource` | Low-level `HostResource`, `createHostResource(...)`, and `createResource(...)` helpers |
|
|
283
|
+
| `@ecopages/radiant/server/light-dom-shim` | Minimal SSR window and host-preparation helpers |
|
|
284
|
+
| `@ecopages/radiant/server/render-component` | Canonical component SSR helpers and metadata utilities |
|
|
285
|
+
| `@ecopages/radiant/server/project-root` | Project-root resolution helper for server adapters |
|
|
286
|
+
| `@ecopages/radiant/decorators/bound` | `@bound` |
|
|
287
|
+
| `@ecopages/radiant/decorators/custom-element` | `@customElement(...)` |
|
|
288
|
+
| `@ecopages/radiant/decorators/debounce` | `@debounce(...)` |
|
|
289
|
+
| `@ecopages/radiant/decorators/event` | `@event(...)` |
|
|
290
|
+
| `@ecopages/radiant/decorators/on-event` | `@onEvent(...)` |
|
|
291
|
+
| `@ecopages/radiant/decorators/on-updated` | `@onUpdated(...)` |
|
|
292
|
+
| `@ecopages/radiant/decorators/prop` | `@prop(...)` |
|
|
293
|
+
| `@ecopages/radiant/decorators/query` | `@query(...)` |
|
|
294
|
+
| `@ecopages/radiant/decorators/query-slot` | `@querySlot(...)` |
|
|
295
|
+
| `@ecopages/radiant/decorators/signal` | `@signal(...)` |
|
|
296
|
+
| `@ecopages/radiant/decorators/state` | `@state` |
|
|
297
|
+
| `@ecopages/radiant/tools/stringify-typed` | Typed attribute serialization helper |
|
|
298
|
+
| `@ecopages/radiant/tools/render-jsx-template` | Render a JSX template result into an existing host |
|
|
299
|
+
| `@ecopages/radiant/tools/escape-script-json` | Safe JSON-for-script serialization helper |
|
|
300
|
+
| `@ecopages/radiant/tools/event-emitter` | Low-level `EventEmitter` helper |
|
|
301
|
+
|
|
302
|
+
Import component bases, decorators, and context helpers from the root entrypoint. Import server and low-level tool helpers from their explicit public subpaths.
|
|
303
|
+
|
|
304
|
+
For SSR-specific guidance and examples, see [src/server/README.md](src/server/README.md).
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{Bb as t}from"./chunk-wwbjz9k4.js";function a(r){return function(o,e){let n=String(e.name);e.addInitializer(function(){let i=t(this,r);Object.defineProperty(this,n,{get(){return i.value},enumerable:!0,configurable:!0})})}}
|
|
2
|
+
export{a as $};
|
|
3
|
+
|
|
4
|
+
//# debugId=174B02C349DF3B4664756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/standard/query.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { createQuery } from '../../helpers/create-query';\nimport type { QueryConfig } from '../query';\n\nexport function query(options: QueryConfig) {\n\treturn function <T extends HTMLElement, V extends Element | Element[]>(\n\t\t_: undefined,\n\t\tcontext: ClassFieldDecoratorContext<T, V>,\n\t) {\n\t\tconst propertyName = String(context.name);\n\n\t\tcontext.addInitializer(function (this: T) {\n\t\t\tconst accessor = createQuery<V>(this, options);\n\n\t\t\tObject.defineProperty(this, propertyName, {\n\t\t\t\tget() {\n\t\t\t\t\treturn accessor.value;\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t});\n\t\t});\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "yCAGO,SAAS,CAAK,CAAC,EAAsB,CAC3C,OAAO,QAA+D,CACrE,EACA,EACC,CACD,IAAM,EAAe,OAAO,EAAQ,IAAI,EAExC,EAAQ,eAAe,QAAS,EAAU,CACzC,IAAM,EAAW,EAAe,KAAM,CAAO,EAE7C,OAAO,eAAe,KAAM,EAAc,CACzC,GAAG,EAAG,CACL,OAAO,EAAS,OAEjB,WAAY,GACZ,aAAc,EACf,CAAC,EACD",
|
|
8
|
+
"debugId": "174B02C349DF3B4664756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/event.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { type EventEmitterConfig } from '../tools/event-emitter';\nimport type { StandardOrLegacyFieldDecoratorArgs } from '../types';\nimport { event as legacyEvent } from './legacy/event';\nimport { event as standardEvent } from './standard/event';\nimport { fieldDecoratorBridge } from './bridge';\n\n/**\n * Decorator that attaches an EventEmitter to the class field property.\n * The EventEmitter can be used to dispatch custom events from the target element.\n * @param eventConfig {@link EventEmitterConfig} Configuration for the event emitter.\n * @see {@link EventEmitter} for more details about how the EventEmitter works.\n */\nexport function event(eventConfig: EventEmitterConfig) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyFieldDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyFieldDecoratorArgs['nameOrContext'],\n\t): any {\n\t\treturn fieldDecoratorBridge(standardEvent(eventConfig), legacyEvent(eventConfig), protoOrTarget, nameOrContext);\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "uIAYO,GAAS,LAAK,CAAC,EAAiC,CACtD,OAAO,QAAS,CACf,EACA,EACM,CACN,OAAO,EAAqB,EAAc,CAAW,EAAG,EAAY,CAAW,EAAG,EAAe,CAAa",
|
|
8
|
+
"debugId": "0C61F31D99EFA58E64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/on-updated.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { StandardOrLegacyMethodDecoratorArgs } from '../types';\nimport { onUpdated as legacyOnUpdated } from './legacy/on-updated';\nimport { onUpdated as standardOnUpdated } from './standard/on-updated';\nimport { methodDecoratorBridge } from './bridge';\n\n/**\n * A decorator to bind a method to the instance.\n */\nexport function onUpdated(keyOrKeys: string | string[]) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyMethodDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyMethodDecoratorArgs['nameOrContext'],\n\t\tdescriptor?: StandardOrLegacyMethodDecoratorArgs['descriptor'],\n\t): any {\n\t\treturn methodDecoratorBridge(\n\t\t\tstandardOnUpdated(keyOrKeys),\n\t\t\tlegacyOnUpdated(keyOrKeys),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t\tdescriptor,\n\t\t);\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "uIAQO,GAAS,LAAS,CAAC,EAA8B,CACvD,OAAO,QAAS,CACf,EACA,EACA,EACM,CACN,OAAO,EACN,EAAkB,CAAS,EAC3B,EAAgB,CAAS,EACzB,EACA,EACA,CACD",
|
|
8
|
+
"debugId": "79FD819A4172B94064756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/on-event.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { RadiantElementEventListener } from '../core/radiant-element';\nimport type { StandardOrLegacyMethodDecoratorArgs } from '../types';\nimport type { OnEventConfig, OnEventScope } from '../helpers/create-event-listener';\nimport { onEvent as legacyOnEvent } from './legacy/on-event';\nimport { onEvent as standardOnEvent } from './standard/on-event';\nimport { methodDecoratorBridge } from './bridge';\n\nexport type { OnEventConfig, OnEventScope };\n\n/**\n * A decorator to subscribe to an event on the target element.\n * The event listener will be automatically unsubscribed when the element is disconnected.\n *\n * Note: This decorator uses event delegation, which means it relies on event bubbling.\n * Therefore, it will not work with events that do not bubble, such as `focus`, `blur`, `load`, `unload`, `scroll`, etc.\n * For focus and blur events, consider using `focusin` and `focusout` which are similar but do bubble.\n * Delegated listeners observe the host light DOM by default, and can optionally observe the shadow root or both trees.\n *\n * @param options {@link OnEventConfig} The event configuration.\n */\nexport function onEvent(options: OnEventConfig) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyMethodDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyMethodDecoratorArgs['nameOrContext'],\n\t\tdescriptor?: StandardOrLegacyMethodDecoratorArgs['descriptor'],\n\t): any {\n\t\treturn methodDecoratorBridge(\n\t\t\tstandardOnEvent(options),\n\t\t\tlegacyOnEvent(options),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t\tdescriptor,\n\t\t);\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "uIAoBO,GAAS,LAAO,CAAC,EAAwB,CAC/C,OAAO,QAAS,CACf,EACA,EACA,EACM,CACN,OAAO,EACN,EAAgB,CAAO,EACvB,EAAc,CAAO,EACrB,EACA,EACA,CACD",
|
|
8
|
+
"debugId": "DFF5F8F9A61E3D2564756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{U as I}from"./chunk-kmebacvv.js";import{W as U,X as Y}from"./chunk-c0qyz98c.js";import{ub as K,vb as Q}from"./chunk-hpzgnxgq.js";import{createMarkupNodeLike as _}from"@ecopages/jsx";class ${host;context;hydrationKey;hydrate;serialize;pendingHostHydration;value;subscriptions=[];constructor(q,A){this.host=q,this.context=A.context,this.hydrationKey=A.hydrationKey,this.hydrate=A.hydrate,this.serialize=A.serialize,this.pendingHostHydration=Boolean(A.hydrate),this.value=A.initialValue,this.tryHydrateFromHost(),this.registerEvents(),this.host.dispatchEvent(new I(this.context))}setContext=(q,A)=>{if(this.tryHydrateFromHost(),this.pendingHostHydration=!1,typeof this.value>"u"&&this.isObject(q)){let B=this.value;if(this.value={...q},A)A(this.value);this.notifySubscribers(this.value,B);return}if(this.isObject(this.value)&&this.isObject(q)){let B={...this.value};if(this.value={...this.value,...q},A)A(this.value);this.notifySubscribers(this.value,B)}};getContext=()=>{return this.tryHydrateFromHost(),this.value};getContextKey=()=>{return this.context};serializeHydrationValue=()=>{if(this.tryHydrateFromHost(),!this.hydrate||typeof this.value>"u")return;let q=this.serialize?this.serialize(this.value):this.value;if(typeof q>"u")return;let A=JSON.stringify(q);if(typeof A!=="string")return;return Y(A)};renderHydrationScriptTag=()=>{let q=this.serializeHydrationValue();if(!q)return;return U({hydrationKey:this.hydrationKey,serializedValue:q})};renderHydrationScript=()=>{let q=this.renderHydrationScriptTag();if(!q)return;return _(q)};subscribe=({select:q,callback:A})=>{this.subscriptions.push({select:q,callback:A})};tryHydrateFromHost(){if(!this.pendingHostHydration)return;let q=this.findHydrationScriptElement();if(!q)return;this.value=this.mergeHydrationValue(K(q,this.value)),this.pendingHostHydration=!1}mergeHydrationValue(q){if(this.hydrate===Object&&this.isObject(q)&&(this.isObject(this.value)||typeof this.value>"u"))return{...this.value??{},...q};return q}isObject(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}findHydrationScriptElement(){return Q(this.host,"context",this.hydrationKey)}notifySubscribers=(q,A)=>{for(let B of this.subscriptions){if(!B.select||typeof A>"u"){this.sendSubscriptionUpdate(B,q);continue}let F=B.select(q),G=B.select(A);if(F!==G)this.sendSubscriptionUpdate(B,q)}};sendSubscriptionUpdate=({select:q,callback:A},B)=>{if(!q)A(B);else A(q(B))};handleSubscriptionRequest=({select:q,callback:A,subscribe:B})=>{if(this.tryHydrateFromHost(),B)this.subscribe({select:q,callback:A});if(typeof this.value>"u")return;if(q)A(q(this.value));else A(this.value)};onSubscriptionRequest=(q)=>{let{context:A,callback:B,subscribe:F,select:G,target:Z}=q;if(A!==this.context)return;q.stopPropagation(),Z.dispatchEvent(new I(this.context)),this.handleSubscriptionRequest({select:G,callback:B,subscribe:F})};onContextRequest=(q)=>{let{context:A,callback:B}=q;if(A!==this.context)return;q.stopPropagation(),B(this)};registerEvents=()=>{this.host.addEventListener("context-subscription-request",this.onSubscriptionRequest),this.host.addEventListener("context-request",this.onContextRequest)}}
|
|
2
|
+
export{$ as R};
|
|
3
|
+
|
|
4
|
+
//# debugId=4E0252ECD83ECA6C64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/context/context-provider.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { createMarkupNodeLike, type JsxRenderable } from '@ecopages/jsx';\nimport type { RadiantElement } from '../core/radiant-element';\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';\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\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: (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>>\n\timplements IContextProvider<T>, SsrSerializableContextProvider\n{\n\tprivate host: RadiantElement;\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: ContextSubscription<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: RadiantElement, 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 = ({ select, callback }: ContextSubscription<T>) => {\n\t\tthis.subscriptions.push({ select, callback });\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(this.host as Element, '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.select || typeof prevContext === 'undefined') {\n\t\t\t\tthis.sendSubscriptionUpdate(sub, newContext);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst newSelected = sub.select(newContext);\n\t\t\tconst prevSelected = sub.select(prevContext);\n\t\t\tif (newSelected !== prevSelected) {\n\t\t\t\tthis.sendSubscriptionUpdate(sub, newContext);\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate sendSubscriptionUpdate = ({ select, callback }: ContextSubscription<T>, context: ContextType<T>) => {\n\t\tif (!select) callback(context);\n\t\telse callback(select(context));\n\t};\n\n\tprivate handleSubscriptionRequest = ({\n\t\tselect,\n\t\tcallback,\n\t\tsubscribe,\n\t}: {\n\t\tselect?: ContextSubscription<T>['select'];\n\t\tcallback: ContextSubscription<T>['callback'];\n\t\tsubscribe?: boolean;\n\t}) => {\n\t\tthis.tryHydrateFromHost();\n\n\t\tif (subscribe) this.subscribe({ select, callback });\n\n\t\tif (typeof this.value === 'undefined') return;\n\n\t\tif (select) {\n\t\t\tcallback(select(this.value));\n\t\t} else {\n\t\t\tcallback(this.value as ContextType<T>);\n\t\t}\n\t};\n\n\tprivate onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n\t\tconst { context, callback, subscribe, select, target } = event;\n\t\tif (context !== this.context) return;\n\n\t\tevent.stopPropagation();\n\n\t\t(target as HTMLElement).dispatchEvent(new ContextOnMountEvent(this.context));\n\n\t\tthis.handleSubscriptionRequest({ select, callback, subscribe });\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.stopPropagation();\n\t\tcallback(this);\n\t};\n\n\tprivate registerEvents = () => {\n\t\tthis.host.addEventListener(ContextEventsTypes.SUBSCRIPTION_REQUEST, this.onSubscriptionRequest);\n\t\tthis.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.onContextRequest);\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "oJAAA,yBAAS,gBA8EF,MAAM,CAEb,CACS,KACA,QACA,aACA,QACA,UACA,qBACA,MAER,cAA0C,CAAC,EAQ3C,WAAW,CAAC,EAAsB,EAAoC,CACrE,KAAK,KAAO,EACZ,KAAK,QAAU,EAAQ,QACvB,KAAK,aAAe,EAAQ,aAC5B,KAAK,QAAU,EAAQ,QACvB,KAAK,UAAY,EAAQ,UACzB,KAAK,qBAAuB,QAAQ,EAAQ,OAAO,EACnD,KAAK,MAAQ,EAAQ,aACrB,KAAK,mBAAmB,EAExB,KAAK,eAAe,EACpB,KAAK,KAAK,cAAc,IAAI,EAAoB,KAAK,OAAO,CAAC,EAG9D,WAAa,CAAC,EAAiC,IAAiD,CAI/F,GAHA,KAAK,mBAAmB,EACxB,KAAK,qBAAuB,GAExB,OAAO,KAAK,MAAU,KAAe,KAAK,SAAS,CAAM,EAAG,CAC/D,IAAM,EAAa,KAAK,MAExB,GADA,KAAK,MAAQ,IAAK,CAAO,EACrB,EAAU,EAAS,KAAK,KAA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B,EAAM,gBAAgB,EACtB,EAAS,IAAI,GAGN,eAAiB,IAAM,CAC9B,KAAK,KAAK,gDAA0D,KAAK,qBAAqB,EAC9F,KAAK,KAAK,mCAAqD,KAAK,gBAAgB,EAEtF",
|
|
8
|
+
"debugId": "4E0252ECD83ECA6C64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/custom-element.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { setCustomElementTagName } from '../../core/custom-element-metadata';\n\n/**\n * Registers a web component with the given name on the global `window.customElements` registry.\n * @param name selector name.\n * @param options {@link ElementDefinitionOptions}\n */\nexport function customElement(name: string, options?: ElementDefinitionOptions) {\n\treturn (target: CustomElementConstructor) => {\n\t\tsetCustomElementTagName(target, name);\n\n\t\tif (!window.customElements.get(name)) {\n\t\t\twindow.customElements.define(name, target, options);\n\t\t}\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "yCAOO,SAAS,CAAa,CAAC,EAAc,EAAoC,CAC/E,MAAO,CAAC,IAAqC,CAG5C,GAFA,EAAwB,EAAQ,CAAI,EAEhC,CAAC,OAAO,eAAe,IAAI,CAAI,EAClC,OAAO,eAAe,OAAO,EAAM,EAAQ,CAAO",
|
|
8
|
+
"debugId": "6EDD7A6042A1E5F864756E2164756E21",
|
|
9
|
+
"names": []
|
|
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": "0C72A74D4D52914964756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{h as g}from"./chunk-ssnnxzrj.js";import{Xa as a}from"./chunk-hztr86b4.js";import{eb as s}from"./chunk-66e6s792.js";class p{host;constructor(e){this.host=e}renderHost(){return{nodeType:1,outerHTML:this.renderHostToString({hydrate:!0})}}renderHostToString(e={},i=this.getHostAttributes()){let t=this.getTagName(),r=g(this.host.getContextProviders());try{return`<${t}${u(i)}>${this.renderHostContent(e)}</${t}>`}finally{r()}}renderHostContent(e){let i=this.host.renderToString(e),t=this.host.getAuthoredHydrationScriptMarkup?.()??"",r=this.host.getSlotProjectionScriptTag?.()??"";if(!e.hydrate)return`${i}${t}${r}`;let n=this.host.getHydrationBindings().map((o)=>o.renderHydrationScriptTag()).filter((o)=>typeof o==="string").join("");return`${i}${r}${n}`}getHostAttributes(){let e={},i=new Set;for(let t of this.host.getReactiveProperties()){let r=this.host.getPropertyValue(t.name);if(r===void 0||r===null||r===!1)continue;e[t.attribute]=String(t.converter.toAttribute(r)),i.add(t.attribute)}for(let t of this.host.getReactivePropDefinitions()){let r=t.options.attribute??t.name;if(i.has(r))continue;let n=this.host.getPropertyValue(t.name);if(n===void 0||n===null||n===!1)continue;e[r]=String(s(n,t.options.type)),i.add(r)}for(let t of this.host.listAttributeNames()){let r=this.host.getAttributeValue(t);if(r!==null)e[t]=r}return e}getTagName(){let e=a(this.host.constructor);if(!e)throw Error(`${this.host.constructor.name} is missing @customElement metadata.`);return e}}function u(e){return Object.entries(e).map(([i,t])=>` ${i}="${c(t)}"`).join("")}function c(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}
|
|
2
|
+
export{p as g};
|
|
3
|
+
|
|
4
|
+
//# debugId=6FBBF457664117B864756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/radiant-component-ssr.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { withSsrContextProviders } from '../server/context-ssr';\nimport { getCustomElementTagName } from './custom-element-metadata';\nimport type { ReactiveProperty } from './radiant-element';\nimport type { ReactivePropDefinition } from './reactive-prop-metadata';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\nimport { writeAttributeValue } from '../utils/attribute-utils';\n\ntype RadiantComponentSsrHost = {\n\tconstructor: CustomElementConstructor;\n\tgetAuthoredHydrationScriptMarkup?: () => string | undefined;\n\tgetContextProviders: () => SsrSerializableContextProvider[];\n\tgetHydrationBindings: () => SsrSerializableHydrationBinding[];\n\tgetSlotProjectionScriptTag?: () => string | undefined;\n\trenderToString: (options?: RenderToStringOptions) => string;\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tlistAttributeNames: () => string[];\n\tgetAttributeValue: (name: string) => string | null;\n};\n\nexport class RadiantComponentSsrService {\n\tconstructor(private readonly host: RadiantComponentSsrHost) {}\n\n\tpublic renderHost(): JsxRenderable {\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\touterHTML: this.renderHostToString({ hydrate: true }),\n\t\t};\n\t}\n\n\tpublic renderHostToString(options: RenderToStringOptions = {}, attributes = this.getHostAttributes()): string {\n\t\tconst tagName = this.getTagName();\n\t\tconst restoreSsrContexts = withSsrContextProviders(this.host.getContextProviders());\n\n\t\ttry {\n\t\t\treturn `<${tagName}${serializeHostAttributes(attributes)}>${this.renderHostContent(options)}</${tagName}>`;\n\t\t} finally {\n\t\t\trestoreSsrContexts();\n\t\t}\n\t}\n\n\tprivate renderHostContent(options: RenderToStringOptions): string {\n\t\tconst hostContent = this.host.renderToString(options);\n\t\tconst authoredHydrationMarkup = this.host.getAuthoredHydrationScriptMarkup?.() ?? '';\n\t\tconst slotProjectionScript = this.host.getSlotProjectionScriptTag?.() ?? '';\n\n\t\tif (!options.hydrate) {\n\t\t\treturn `${hostContent}${authoredHydrationMarkup}${slotProjectionScript}`;\n\t\t}\n\n\t\tconst hydrationScripts = this.host\n\t\t\t.getHydrationBindings()\n\t\t\t.map((binding) => binding.renderHydrationScriptTag())\n\t\t\t.filter((markup): markup is string => typeof markup === 'string')\n\t\t\t.join('');\n\n\t\treturn `${hostContent}${slotProjectionScript}${hydrationScripts}`;\n\t}\n\n\tpublic getHostAttributes(): Record<string, string> {\n\t\tconst attributes: Record<string, string> = {};\n\t\tconst seenAttributes = new Set<string>();\n\n\t\tfor (const property of this.host.getReactiveProperties()) {\n\t\t\tconst currentValue = this.host.getPropertyValue(property.name);\n\t\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattributes[property.attribute] = String(property.converter.toAttribute(currentValue));\n\t\t\tseenAttributes.add(property.attribute);\n\t\t}\n\n\t\tfor (const definition of this.host.getReactivePropDefinitions()) {\n\t\t\tconst attributeName = definition.options.attribute ?? definition.name;\n\n\t\t\tif (seenAttributes.has(attributeName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst currentValue = this.host.getPropertyValue(definition.name);\n\n\t\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattributes[attributeName] = String(writeAttributeValue(currentValue, definition.options.type));\n\t\t\tseenAttributes.add(attributeName);\n\t\t}\n\n\t\tfor (const attributeName of this.host.listAttributeNames()) {\n\t\t\tconst attributeValue = this.host.getAttributeValue(attributeName);\n\t\t\tif (attributeValue !== null) {\n\t\t\t\tattributes[attributeName] = attributeValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tprivate getTagName(): string {\n\t\tconst tagName = getCustomElementTagName(this.host.constructor);\n\n\t\tif (!tagName) {\n\t\t\tthrow new Error(`${this.host.constructor.name} is missing @customElement metadata.`);\n\t\t}\n\n\t\treturn tagName;\n\t}\n}\n\nfunction serializeHostAttributes(attributes: Record<string, string>): string {\n\treturn Object.entries(attributes)\n\t\t.map(([name, value]) => ` ${name}=\"${escapeAttribute(value)}\"`)\n\t\t.join('');\n}\n\nfunction escapeAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "sIAwBO,AAAM,LAA2B,CACV,KAA7B,WAAW,CAAkB,EAA+B,CAA/B,YAEtB,UAAU,EAAkB,CAClC,MAAO,CACN,SAAU,EACV,UAAW,KAAK,mBAAmB,CAAE,QAAS,EAAK,CAAC,CACrD,EAGM,kBAAkB,CAAC,EAAiC,CAAC,EAAG,EAAa,KAAK,kBAAkB,EAAW,CAC7G,IAAM,EAAU,KAAK,WAAW,EAC1B,EAAqB,EAAwB,KAAK,KAAK,oBAAoB,CAAC,EAElF,GAAI,CACH,MAAO,IAAI,IAAU,EAAwB,CAAU,KAAK,KAAK,kBAAkB,CAAO,MAAM,YAC/F,CACD,EAAmB,GAIb,iBAAiB,CAAC,EAAwC,CACjE,IAAM,EAAc,KAAK,KAAK,eAAe,CAAO,EAC9C,EAA0B,KAAK,KAAK,mCAAmC,GAAK,GAC5E,EAAuB,KAAK,KAAK,6BAA6B,GAAK,GAEzE,GAAI,CAAC,EAAQ,QACZ,MAAO,GAAG,IAAc,IAA0B,IAGnD,IAAM,EAAmB,KAAK,KAC5B,qBAAqB,EACrB,IAAI,CAAC,IAAY,EAAQ,yBAAyB,CAAC,EACnD,OAAO,CAAC,IAA6B,OAAO,IAAW,QAAQ,EAC/D,KAAK,EAAE,EAET,MAAO,GAAG,IAAc,IAAuB,IAGzC,iBAAiB,EAA2B,CAClD,IAAM,EAAqC,CAAC,EACtC,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
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{pb as B}from"./chunk-hpzgnxgq.js";import{createMarkupNodeLike as U,isKeyedJsxValue as D,isSlotJsxValue as A}from"@ecopages/jsx";var k="",J="data-radiant-slot-projection";function x(q){let w=new Map;for(let G of Array.from(q.childNodes)){if(F(G))continue;O(w,E(G),G)}return w}function P(q){let w;try{w=JSON.parse(q)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",q.slice(0,120));return new Map}let G=new Map;for(let[Q,X]of Object.entries(w)){if(!Array.isArray(X)||X.length===0)continue;G.set($(Q),X.map((W)=>U(W)))}return G}function R(q){let w=Array.from(q.childNodes).filter((G)=>M(G)).map((G)=>Y(G)??"").filter((G)=>G!=="");return w.length>0?w.join(""):void 0}function f(q){let w={};for(let[G,Q]of q.entries()){let X=Q.map((W)=>Y(W)).filter((W)=>W!==void 0&&W!=="");if(X.length>0)w[G]=X}return Object.keys(w).length>0?JSON.stringify(w):void 0}function T(q,w){let G=!1,Q=(W)=>{if(A(W))return G=!0,I(W,w,Q);if(D(W))return h(W,Q(W.value));if(H(W))return{_$rType$:1,strings:W.strings,values:W.values.map((Z)=>Q(Z))};if(z(W))return Array.from(W,(Z)=>Q(Z));return W},X=Q(q);return{containsSlots:G,value:X}}function j(q){for(let w of Array.from(q.childNodes)){if(!K(w))continue;let G=w.textContent??void 0;return w.parentNode?.removeChild(w),G}return}function O(q,w,G){let Q=q.get(w);if(Q){Q.push(G);return}q.set(w,[G])}function h(q,w){return{...q,value:w}}function E(q){if(q instanceof Element)return $(q.getAttribute("slot"));return k}function z(q){return typeof q!=="string"&&typeof q==="object"&&q!==null&&Symbol.iterator in q}function K(q){return q instanceof HTMLScriptElement&&q.hasAttribute(J)}function M(q){return q instanceof HTMLScriptElement&&q.hasAttribute(B)}function F(q){return K(q)||M(q)}function H(q){return typeof q==="object"&&q!==null&&q._$rType$===1&&Array.isArray(q.strings)&&Array.isArray(q.values)}function $(q){return q??k}function Y(q){if(q===void 0||q===null||q===!1||q===!0)return;if(typeof Node<"u"&&q instanceof Node){if(q.nodeType===Node.TEXT_NODE)return q.textContent??"";return q.outerHTML??q.textContent??void 0}if(D(q))return Y(q.value);if(typeof q==="string"||typeof q==="number"||typeof q==="bigint")return String(q);if(typeof q==="object"&&q!==null&&"outerHTML"in q)return typeof q.outerHTML==="string"?q.outerHTML:q.textContent??void 0;if(z(q))return Array.from(q,(w)=>Y(w)??"").join("");return}function I(q,w,G){let Q=w.get($(q.name));if(Q&&Q.length>0)return Q.length===1?Q[0]:Q;if(q.fallback===void 0)return"";return G(q.fallback)}
|
|
2
|
+
export{k as hb,J as ib,x as jb,P as kb,R as lb,f as mb,T as nb,j as ob};
|
|
3
|
+
|
|
4
|
+
//# debugId=072C43197CC7C57F64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/slot-projection-runtime.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n\tcreateMarkupNodeLike,\n\tisKeyedJsxValue,\n\tisSlotJsxValue,\n\ttype JsxRenderable,\n\ttype KeyedJsxValue,\n\ttype SlotJsxValue,\n\ttype TemplateResultLike,\n} from '@ecopages/jsx';\n\nimport { HYDRATION_ATTRIBUTE } from './hydration-codec';\n\nexport const DEFAULT_SLOT_NAME = '';\nexport const SLOT_PROJECTION_SCRIPT_ATTRIBUTE = 'data-radiant-slot-projection';\n\ntype ResolvedSlotProjection = {\n\tcontainsSlots: boolean;\n\tvalue: JsxRenderable;\n};\n\nexport function captureProjectedSlotRenderables(host: HTMLElement): Map<string, JsxRenderable[]> {\n\tconst projectedContent = new Map<string, JsxRenderable[]>();\n\n\tfor (const node of Array.from(host.childNodes)) {\n\t\tif (isIgnoredProjectedNode(node)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tappendProjectedRenderable(projectedContent, getNodeSlotName(node), node);\n\t}\n\n\treturn projectedContent;\n}\n\nexport function deserializeProjectedSlotRenderables(payload: string): Map<string, JsxRenderable[]> {\n\tlet parsedPayload: Record<string, string[]>;\n\n\ttry {\n\t\tparsedPayload = JSON.parse(payload) as Record<string, string[]>;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn('[@ecopages/radiant] Failed to parse slot projection payload:', payload.slice(0, 120));\n\t\t}\n\t\treturn new Map();\n\t}\n\n\tconst projectedContent = new Map<string, JsxRenderable[]>();\n\n\tfor (const [slotName, fragments] of Object.entries(parsedPayload)) {\n\t\tif (!Array.isArray(fragments) || fragments.length === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tprojectedContent.set(\n\t\t\tnormalizeSlotName(slotName),\n\t\t\tfragments.map((fragment) => createMarkupNodeLike(fragment)),\n\t\t);\n\t}\n\n\treturn projectedContent;\n}\n\nexport function collectAuthoredHydrationScriptMarkup(host: HTMLElement): string | undefined {\n\tconst fragments = Array.from(host.childNodes)\n\t\t.filter((node): node is HTMLScriptElement => isHydrationScriptNode(node))\n\t\t.map((node) => renderableToHtmlFragment(node) ?? '')\n\t\t.filter((fragment) => fragment !== '');\n\n\treturn fragments.length > 0 ? fragments.join('') : undefined;\n}\n\nexport function serializeProjectedSlotRenderables(\n\tprojectedContent: ReadonlyMap<string, readonly JsxRenderable[]>,\n): string | undefined {\n\tconst payload: Record<string, string[]> = {};\n\n\tfor (const [slotName, renderables] of projectedContent.entries()) {\n\t\tconst fragments = renderables\n\t\t\t.map((renderable) => renderableToHtmlFragment(renderable))\n\t\t\t.filter((fragment): fragment is string => fragment !== undefined && fragment !== '');\n\n\t\tif (fragments.length > 0) {\n\t\t\tpayload[slotName] = fragments;\n\t\t}\n\t}\n\n\treturn Object.keys(payload).length > 0 ? JSON.stringify(payload) : undefined;\n}\n\nexport function resolveSlotProjection(\n\tvalue: JsxRenderable,\n\tprojectedContent: ReadonlyMap<string, readonly JsxRenderable[]>,\n): ResolvedSlotProjection {\n\tlet containsSlots = false;\n\n\tconst resolveValue = (currentValue: JsxRenderable): JsxRenderable => {\n\t\tif (isSlotJsxValue(currentValue)) {\n\t\t\tcontainsSlots = true;\n\t\t\treturn resolveSlotValue(currentValue, projectedContent, resolveValue);\n\t\t}\n\n\t\tif (isKeyedJsxValue(currentValue)) {\n\t\t\treturn cloneKeyedJsxValue(currentValue, resolveValue(currentValue.value));\n\t\t}\n\n\t\tif (isTemplateResultLike(currentValue)) {\n\t\t\treturn {\n\t\t\t\t_$rType$: 1,\n\t\t\t\tstrings: currentValue.strings,\n\t\t\t\tvalues: currentValue.values.map((entry) => resolveValue(entry as JsxRenderable)),\n\t\t\t} satisfies TemplateResultLike;\n\t\t}\n\n\t\tif (isIterableRenderable(currentValue)) {\n\t\t\treturn Array.from(currentValue, (entry) => resolveValue(entry as JsxRenderable));\n\t\t}\n\n\t\treturn currentValue;\n\t};\n\n\tconst resolvedValue = resolveValue(value);\n\n\treturn {\n\t\tcontainsSlots,\n\t\tvalue: resolvedValue,\n\t};\n}\n\nexport function takeSlotProjectionScriptPayload(host: HTMLElement): string | undefined {\n\tfor (const node of Array.from(host.childNodes)) {\n\t\tif (!isSlotProjectionScriptNode(node)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst payload = node.textContent ?? undefined;\n\t\tnode.parentNode?.removeChild(node);\n\t\treturn payload;\n\t}\n\n\treturn undefined;\n}\n\nfunction appendProjectedRenderable(\n\tprojectedContent: Map<string, JsxRenderable[]>,\n\tslotName: string,\n\trenderable: JsxRenderable,\n): void {\n\tconst existingRenderables = projectedContent.get(slotName);\n\n\tif (existingRenderables) {\n\t\texistingRenderables.push(renderable);\n\t\treturn;\n\t}\n\n\tprojectedContent.set(slotName, [renderable]);\n}\n\nfunction cloneKeyedJsxValue(value: KeyedJsxValue, nextValue: JsxRenderable): KeyedJsxValue {\n\treturn {\n\t\t...value,\n\t\tvalue: nextValue,\n\t};\n}\n\nfunction getNodeSlotName(node: Node): string {\n\tif (node instanceof Element) {\n\t\treturn normalizeSlotName(node.getAttribute('slot'));\n\t}\n\n\treturn DEFAULT_SLOT_NAME;\n}\n\nfunction isIterableRenderable(value: JsxRenderable): value is Iterable<JsxRenderable> {\n\treturn typeof value !== 'string' && typeof value === 'object' && value !== null && Symbol.iterator in value;\n}\n\nfunction isSlotProjectionScriptNode(node: Node): node is HTMLScriptElement {\n\treturn node instanceof HTMLScriptElement && node.hasAttribute(SLOT_PROJECTION_SCRIPT_ATTRIBUTE);\n}\n\nfunction isHydrationScriptNode(node: Node): node is HTMLScriptElement {\n\treturn node instanceof HTMLScriptElement && node.hasAttribute(HYDRATION_ATTRIBUTE);\n}\n\nfunction isIgnoredProjectedNode(node: Node): boolean {\n\treturn isSlotProjectionScriptNode(node) || isHydrationScriptNode(node);\n}\n\nfunction isTemplateResultLike(value: JsxRenderable): value is TemplateResultLike {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t(value as Partial<TemplateResultLike>)['_$rType$'] === 1 &&\n\t\tArray.isArray((value as Partial<TemplateResultLike>).strings) &&\n\t\tArray.isArray((value as Partial<TemplateResultLike>).values)\n\t);\n}\n\nfunction normalizeSlotName(name: string | undefined | null): string {\n\treturn name ?? DEFAULT_SLOT_NAME;\n}\n\nfunction renderableToHtmlFragment(renderable: JsxRenderable): string | undefined {\n\tif (renderable === undefined || renderable === null || renderable === false || renderable === true) {\n\t\treturn undefined;\n\t}\n\n\tif (typeof Node !== 'undefined' && renderable instanceof Node) {\n\t\tif (renderable.nodeType === Node.TEXT_NODE) {\n\t\t\treturn renderable.textContent ?? '';\n\t\t}\n\n\t\treturn (renderable as Element).outerHTML ?? renderable.textContent ?? undefined;\n\t}\n\n\tif (isKeyedJsxValue(renderable)) {\n\t\treturn renderableToHtmlFragment(renderable.value);\n\t}\n\n\tif (typeof renderable === 'string' || typeof renderable === 'number' || typeof renderable === 'bigint') {\n\t\treturn String(renderable);\n\t}\n\n\tif (typeof renderable === 'object' && renderable !== null && 'outerHTML' in renderable) {\n\t\treturn typeof renderable.outerHTML === 'string' ? renderable.outerHTML : (renderable.textContent ?? undefined);\n\t}\n\n\tif (isIterableRenderable(renderable)) {\n\t\treturn Array.from(renderable, (entry) => renderableToHtmlFragment(entry as JsxRenderable) ?? '').join('');\n\t}\n\n\treturn undefined;\n}\n\nfunction resolveSlotValue(\n\tvalue: SlotJsxValue,\n\tprojectedContent: ReadonlyMap<string, readonly JsxRenderable[]>,\n\tresolveValue: (value: JsxRenderable) => JsxRenderable,\n): JsxRenderable {\n\tconst assignedContent = projectedContent.get(normalizeSlotName(value.name));\n\n\tif (assignedContent && assignedContent.length > 0) {\n\t\treturn assignedContent.length === 1 ? assignedContent[0] : (assignedContent as JsxRenderable);\n\t}\n\n\tif (value.fallback === undefined) {\n\t\treturn '';\n\t}\n\n\treturn resolveValue(value.fallback);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "yCAAA,+BACC,qBACA,oBACA,sBASM,IAAM,EAAoB,GACpB,EAAmC,+BAOzC,SAAS,CAA+B,CAAC,EAAiD,CAChG,IAAM,EAAmB,IAAI,IAE7B,QAAW,KAAQ,MAAM,KAAK,EAAK,UAAU,EAAG,CAC/C,GAAI,EAAuB,CAAI,EAC9B,SAGD,EAA0B,EAAkB,EAAgB,CAAI,EAAG,CAAI,EAGxE,OAAO,EAGD,SAAS,CAAmC,CAAC,EAA+C,CAClG,IAAI,EAEJ,GAAI,CACH,EAAgB,KAAK,MAAM,CAAO,EACjC,KAAM,CACP,GAAI,OAAO,QAAY,IACtB,QAAQ,KAAK,+DAAgE,EAAQ,MAAM,EAAG,GAAG,CAAC,EAEnG,OAAO,IAAI,IAGZ,IAAM,EAAmB,IAAI,IAE7B,QAAY,EAAU,KAAc,OAAO,QAAQ,CAAa,EAAG,CAClE,GAAI,CAAC,MAAM,QAAQ,CAAS,GAAK,EAAU,SAAW,EACrD,SAGD,EAAiB,IAChB,EAAkB,CAAQ,EAC1B,EAAU,IAAI,CAAC,IAAa,EAAqB,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AAQ,EAAuB,WAAa,EAAW,aAAe,OAGvE,GAAI,EAAgB,CAAU,EAC7B,OAAO,EAAyB,EAAW,KAAK,EAGjD,GAAI,OAAO,IAAe,UAAY,OAAO,IAAe,UAAY,OAAO,IAAe,SAC7F,OAAO,OAAO,CAAU,EAGzB,GAAI,OAAO,IAAe,UAAY,IAAe,MAAQ,cAAe,EAC3E,OAAO,OAAO,EAAW,YAAc,SAAW,EAAW,UAAa,EAAW,aAAe,OAGrG,GAAI,EAAqB,CAAU,EAClC,OAAO,MAAM,KAAK,EAAY,CAAC,IAAU,EAAyB,CAAsB,GAAK,EAAE,EAAE,KAAK,EAAE,EAGzG,OAGD,SAAS,CAAgB,CACxB,EACA,EACA,EACgB,CAChB,IAAM,EAAkB,EAAiB,IAAI,EAAkB,EAAM,IAAI,CAAC,EAE1E,GAAI,GAAmB,EAAgB,OAAS,EAC/C,OAAO,EAAgB,SAAW,EAAI,EAAgB,GAAM,EAG7D,GAAI,EAAM,WAAa,OACtB,MAAO,GAGR,OAAO,EAAa,EAAM,QAAQ",
|
|
8
|
+
"debugId": "072C43197CC7C57F64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/context/decorators/consume-context.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { StandardOrLegacyFieldDecoratorArgs } from '../../types';\nimport type { UnknownContext } from '../types';\nimport { consumeContext as legacyConsumeContext } from './legacy/consume-context';\nimport { consumeContext as standardConsumeContext } from './standard/consume-context';\nimport { fieldDecoratorBridge } from '../../decorators/bridge';\n\n/**\n * Injects the nearest matching context provider onto a decorated field.\n *\n * During SSR the field can be resolved from the active SSR context stack; on\n * the client it falls back to the DOM event-based context channel.\n *\n * @param context Context token to consume from ancestor providers.\n * @returns A standard-or-legacy decorator implementation for the target field.\n */\nexport function consumeContext(context: UnknownContext) {\n\treturn function (\n\t\tprotoOrTarget: StandardOrLegacyFieldDecoratorArgs['protoOrTarget'],\n\t\tnameOrContext: StandardOrLegacyFieldDecoratorArgs['nameOrContext'],\n\t): any {\n\t\treturn fieldDecoratorBridge(\n\t\t\tstandardConsumeContext(context),\n\t\t\tlegacyConsumeContext(context),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t);\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "qIAeO,GAAS,LAAc,CAAC,EAAyB,CACvD,OAAO,QAAS,CACf,EACA,EACM,CACN,OAAO,EACN,EAAuB,CAAO,EAC9B,EAAqB,CAAO,EAC5B,EACA,CACD",
|
|
8
|
+
"debugId": "7CA7CEA5D2B9258D64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|