@ecopages/radiant 0.3.0-alpha.3 → 0.3.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -56
- package/dist/LICENSE +21 -0
- package/dist/client/hydrator.d.ts +1 -1
- package/dist/client/hydrator.js +2 -2
- package/dist/client/hydrator.js.map +5 -3
- package/dist/client/install-hydrator.js +2 -2
- package/dist/client/install-hydrator.js.map +5 -3
- package/dist/context/context-consumer-bootstrap.d.ts +7 -6
- package/dist/context/context-consumer-bootstrap.js +2 -2
- package/dist/context/context-consumer-bootstrap.js.map +8 -3
- package/dist/context/context-consumer-runtime.d.ts +21 -8
- package/dist/context/context-consumer-runtime.js +2 -2
- package/dist/context/context-consumer-runtime.js.map +6 -3
- package/dist/context/context-host.d.ts +25 -0
- package/dist/context/context-host.js +3 -0
- package/dist/context/context-host.js.map +10 -0
- package/dist/context/context-provider.d.ts +10 -6
- package/dist/context/context-provider.js +2 -2
- package/dist/context/context-provider.js.map +9 -3
- package/dist/context/context-ssr-bridge.js +2 -2
- package/dist/context/context-ssr-bridge.js.map +4 -3
- package/dist/context/create-context.js +2 -2
- package/dist/context/create-context.js.map +4 -3
- package/dist/context/decorators/consume-context.d.ts +5 -2
- package/dist/context/decorators/consume-context.js +2 -2
- package/dist/context/decorators/consume-context.js.map +13 -3
- package/dist/context/decorators/context-selection-delivery.d.ts +1 -1
- package/dist/context/decorators/context-selection-delivery.js +2 -2
- package/dist/context/decorators/context-selection-delivery.js.map +5 -3
- package/dist/context/decorators/context-selector.d.ts +6 -6
- package/dist/context/decorators/context-selector.js +2 -2
- package/dist/context/decorators/context-selector.js.map +15 -3
- package/dist/context/decorators/legacy/consume-context.d.ts +2 -2
- package/dist/context/decorators/legacy/consume-context.js +2 -2
- package/dist/context/decorators/legacy/consume-context.js.map +10 -3
- package/dist/context/decorators/legacy/context-selector-field.d.ts +2 -2
- package/dist/context/decorators/legacy/context-selector-field.js +2 -2
- package/dist/context/decorators/legacy/context-selector-field.js.map +11 -3
- package/dist/context/decorators/legacy/context-selector.d.ts +2 -2
- package/dist/context/decorators/legacy/context-selector.js +2 -2
- package/dist/context/decorators/legacy/context-selector.js.map +11 -3
- package/dist/context/decorators/legacy/provide-context.d.ts +2 -2
- package/dist/context/decorators/legacy/provide-context.js +2 -2
- package/dist/context/decorators/legacy/provide-context.js.map +11 -3
- package/dist/context/decorators/on-context-update.d.ts +5 -5
- package/dist/context/decorators/on-context-update.js +2 -2
- package/dist/context/decorators/on-context-update.js.map +14 -3
- package/dist/context/decorators/provide-context.d.ts +5 -2
- package/dist/context/decorators/provide-context.js +2 -2
- package/dist/context/decorators/provide-context.js.map +14 -3
- package/dist/context/decorators/standard/consume-context.d.ts +2 -2
- package/dist/context/decorators/standard/consume-context.js +2 -2
- package/dist/context/decorators/standard/consume-context.js.map +9 -3
- package/dist/context/decorators/standard/context-selector-field.d.ts +2 -2
- package/dist/context/decorators/standard/context-selector-field.js +2 -2
- package/dist/context/decorators/standard/context-selector-field.js.map +10 -3
- package/dist/context/decorators/standard/context-selector.d.ts +2 -3
- package/dist/context/decorators/standard/context-selector.js +2 -2
- package/dist/context/decorators/standard/context-selector.js.map +10 -3
- package/dist/context/decorators/standard/provide-context.d.ts +2 -2
- package/dist/context/decorators/standard/provide-context.js +2 -2
- package/dist/context/decorators/standard/provide-context.js.map +10 -3
- package/dist/context/events.d.ts +18 -11
- package/dist/context/events.js +2 -2
- package/dist/context/events.js.map +4 -3
- package/dist/context/hydration-script.js +2 -2
- package/dist/context/hydration-script.js.map +6 -3
- package/dist/controller-registry.d.ts +28 -0
- package/dist/controller-registry.js +3 -0
- package/dist/controller-registry.js.map +11 -0
- package/dist/core/controller-metadata.d.ts +3 -0
- package/dist/core/controller-metadata.js +3 -0
- package/dist/core/controller-metadata.js.map +10 -0
- package/dist/core/custom-element-metadata.d.ts +11 -0
- package/dist/core/custom-element-metadata.js +2 -2
- package/dist/core/custom-element-metadata.js.map +4 -3
- package/dist/core/hydration-codec.d.ts +8 -1
- package/dist/core/hydration-codec.js +2 -2
- package/dist/core/hydration-codec.js.map +5 -3
- package/dist/core/radiant-component-ssr-registry.d.ts +13 -13
- package/dist/core/radiant-component-ssr-registry.js +2 -2
- package/dist/core/radiant-component-ssr-registry.js.map +4 -3
- package/dist/core/radiant-component-ssr.d.ts +3 -3
- package/dist/core/radiant-component-ssr.js +2 -2
- package/dist/core/radiant-component-ssr.js.map +8 -3
- package/dist/core/radiant-controller.d.ts +127 -0
- package/dist/core/radiant-controller.js +3 -0
- package/dist/core/radiant-controller.js.map +13 -0
- package/dist/core/radiant-element.d.ts +43 -41
- package/dist/core/radiant-element.js +2 -2
- package/dist/core/radiant-element.js.map +13 -3
- package/dist/core/radiant-hydrator-state.d.ts +1 -1
- package/dist/core/radiant-hydrator-state.js +2 -2
- package/dist/core/radiant-hydrator-state.js.map +4 -3
- package/dist/core/reactive-host.d.ts +137 -0
- package/dist/core/reactive-host.js +3 -0
- package/dist/core/reactive-host.js.map +10 -0
- package/dist/core/reactive-jsx-value.js +2 -2
- package/dist/core/reactive-jsx-value.js.map +4 -3
- package/dist/core/reactive-prop-metadata.js +2 -2
- package/dist/core/reactive-prop-metadata.js.map +4 -3
- package/dist/core/slot-projection-runtime.js +2 -2
- package/dist/core/slot-projection-runtime.js.map +6 -3
- package/dist/core/ssr-preparation.js +2 -2
- package/dist/core/ssr-preparation.js.map +4 -3
- package/dist/decorators/attr.d.ts +6 -0
- package/dist/decorators/attr.js +3 -0
- package/dist/decorators/attr.js.map +16 -0
- package/dist/decorators/bound.d.ts +4 -2
- package/dist/decorators/bound.js +2 -2
- package/dist/decorators/bound.js.map +7 -3
- package/dist/decorators/bridge.d.ts +11 -7
- package/dist/decorators/bridge.js +2 -2
- package/dist/decorators/bridge.js.map +4 -3
- package/dist/decorators/controller.d.ts +2 -0
- package/dist/decorators/controller.js +3 -0
- package/dist/decorators/controller.js.map +12 -0
- package/dist/decorators/custom-element.d.ts +4 -2
- package/dist/decorators/custom-element.js +2 -2
- package/dist/decorators/custom-element.js.map +7 -3
- package/dist/decorators/debounce.d.ts +5 -2
- package/dist/decorators/debounce.js +2 -2
- package/dist/decorators/debounce.js.map +8 -3
- package/dist/decorators/event.d.ts +5 -2
- package/dist/decorators/event.js +2 -2
- package/dist/decorators/event.js.map +10 -3
- package/dist/decorators/legacy/attr.d.ts +2 -0
- package/dist/decorators/legacy/attr.js +3 -0
- package/dist/decorators/legacy/attr.js.map +13 -0
- package/dist/decorators/legacy/bound.js +2 -2
- package/dist/decorators/legacy/bound.js.map +4 -3
- package/dist/decorators/legacy/custom-element.js +2 -2
- package/dist/decorators/legacy/custom-element.js.map +5 -3
- package/dist/decorators/legacy/debounce.js +2 -2
- package/dist/decorators/legacy/debounce.js.map +5 -3
- package/dist/decorators/legacy/event.js +2 -2
- package/dist/decorators/legacy/event.js.map +7 -3
- package/dist/decorators/legacy/instance-initializers.d.ts +3 -4
- package/dist/decorators/legacy/instance-initializers.js +2 -2
- package/dist/decorators/legacy/instance-initializers.js.map +4 -3
- package/dist/decorators/legacy/on-event.d.ts +2 -2
- package/dist/decorators/legacy/on-event.js +2 -2
- package/dist/decorators/legacy/on-event.js.map +6 -3
- package/dist/decorators/legacy/on-updated.d.ts +7 -2
- package/dist/decorators/legacy/on-updated.js +2 -2
- package/dist/decorators/legacy/on-updated.js.map +5 -3
- package/dist/decorators/legacy/query-slot.js +2 -2
- package/dist/decorators/legacy/query-slot.js.map +7 -3
- package/dist/decorators/legacy/query.d.ts +7 -2
- package/dist/decorators/legacy/query.js +2 -2
- package/dist/decorators/legacy/query.js.map +6 -3
- package/dist/decorators/legacy/reactive-field.d.ts +2 -2
- package/dist/decorators/legacy/reactive-field.js +2 -2
- package/dist/decorators/legacy/reactive-field.js.map +5 -3
- package/dist/decorators/legacy/reactive-prop.d.ts +10 -16
- package/dist/decorators/legacy/reactive-prop.js +2 -2
- package/dist/decorators/legacy/reactive-prop.js.map +7 -3
- package/dist/decorators/legacy/signal.d.ts +4 -3
- package/dist/decorators/legacy/signal.js +2 -2
- package/dist/decorators/legacy/signal.js.map +9 -3
- package/dist/decorators/on-event.d.ts +6 -3
- package/dist/decorators/on-event.js +2 -2
- package/dist/decorators/on-event.js.map +9 -3
- package/dist/decorators/on-updated.d.ts +12 -2
- package/dist/decorators/on-updated.js +2 -2
- package/dist/decorators/on-updated.js.map +8 -3
- package/dist/decorators/prop.d.ts +19 -7
- package/dist/decorators/prop.js +2 -2
- package/dist/decorators/prop.js.map +10 -3
- package/dist/decorators/query-slot.d.ts +11 -3
- package/dist/decorators/query-slot.js +2 -2
- package/dist/decorators/query-slot.js.map +10 -3
- package/dist/decorators/query.d.ts +9 -2
- package/dist/decorators/query.js +2 -2
- package/dist/decorators/query.js.map +9 -3
- package/dist/decorators/shared/reactive-attr.d.ts +25 -0
- package/dist/decorators/shared/reactive-attr.js +3 -0
- package/dist/decorators/shared/reactive-attr.js.map +11 -0
- package/dist/decorators/signal.d.ts +10 -4
- package/dist/decorators/signal.js +2 -2
- package/dist/decorators/signal.js.map +11 -3
- package/dist/decorators/standard/attr.d.ts +2 -0
- package/dist/decorators/standard/attr.js +3 -0
- package/dist/decorators/standard/attr.js.map +12 -0
- package/dist/decorators/standard/bound.js +2 -2
- package/dist/decorators/standard/bound.js.map +4 -3
- package/dist/decorators/standard/custom-element.js +2 -2
- package/dist/decorators/standard/custom-element.js.map +5 -3
- package/dist/decorators/standard/debounce.js +2 -2
- package/dist/decorators/standard/debounce.js.map +5 -3
- package/dist/decorators/standard/event.js +2 -2
- package/dist/decorators/standard/event.js.map +6 -3
- package/dist/decorators/standard/on-event.d.ts +2 -1
- package/dist/decorators/standard/on-event.js +2 -2
- package/dist/decorators/standard/on-event.js.map +5 -3
- package/dist/decorators/standard/on-updated.d.ts +5 -1
- package/dist/decorators/standard/on-updated.js +2 -2
- package/dist/decorators/standard/on-updated.js.map +4 -3
- package/dist/decorators/standard/query-slot.d.ts +1 -1
- package/dist/decorators/standard/query-slot.js +2 -2
- package/dist/decorators/standard/query-slot.js.map +5 -3
- package/dist/decorators/standard/query.d.ts +2 -1
- package/dist/decorators/standard/query.js +2 -2
- package/dist/decorators/standard/query.js.map +5 -3
- package/dist/decorators/standard/reactive-field.d.ts +2 -2
- package/dist/decorators/standard/reactive-field.js +2 -2
- package/dist/decorators/standard/reactive-field.js.map +4 -3
- package/dist/decorators/standard/reactive-prop.d.ts +13 -2
- package/dist/decorators/standard/reactive-prop.js +2 -2
- package/dist/decorators/standard/reactive-prop.js.map +6 -3
- package/dist/decorators/standard/signal.d.ts +4 -3
- package/dist/decorators/standard/signal.js +2 -2
- package/dist/decorators/standard/signal.js.map +8 -3
- package/dist/decorators/state.d.ts +6 -5
- package/dist/decorators/state.js +2 -2
- package/dist/decorators/state.js.map +8 -3
- package/dist/helpers/create-event-listener.d.ts +11 -2
- package/dist/helpers/create-event-listener.js +2 -2
- package/dist/helpers/create-event-listener.js.map +4 -3
- package/dist/helpers/create-event.js +2 -2
- package/dist/helpers/create-event.js.map +5 -3
- package/dist/helpers/create-query-slot.js +2 -2
- package/dist/helpers/create-query-slot.js.map +4 -3
- package/dist/helpers/create-query.d.ts +14 -3
- package/dist/helpers/create-query.js +2 -2
- package/dist/helpers/create-query.js.map +4 -3
- package/dist/helpers/debounce.js +2 -2
- package/dist/helpers/debounce.js.map +4 -3
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +9 -3
- package/dist/index.d.ts +11 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +87 -3
- package/dist/server/context-ssr.js +2 -2
- package/dist/server/context-ssr.js.map +5 -3
- package/dist/server/html-parser.js +2 -2
- package/dist/server/html-parser.js.map +4 -3
- package/dist/server/install-light-dom-shim.js +2 -2
- package/dist/server/install-light-dom-shim.js.map +5 -3
- package/dist/server/light-dom-shim.js +2 -2
- package/dist/server/light-dom-shim.js.map +5 -3
- package/dist/server/project-root.js +2 -2
- package/dist/server/project-root.js.map +2 -2
- package/dist/server/radiant-component-ssr-runtime.d.ts +2 -2
- package/dist/server/radiant-component-ssr-runtime.js +2 -2
- package/dist/server/radiant-component-ssr-runtime.js.map +11 -3
- package/dist/server/render-component.d.ts +3 -13
- package/dist/server/render-component.js +2 -2
- package/dist/server/render-component.js.map +14 -4
- package/dist/server/render-controller.d.ts +57 -0
- package/dist/server/render-controller.js +3 -0
- package/dist/server/render-controller.js.map +23 -0
- package/dist/server/slot-projection-html.js +2 -2
- package/dist/server/slot-projection-html.js.map +7 -3
- package/dist/signals/host-resource.js +2 -2
- package/dist/signals/host-resource.js.map +2 -2
- package/dist/signals/host-signal.d.ts +4 -2
- package/dist/signals/host-signal.js +2 -2
- package/dist/signals/host-signal.js.map +7 -3
- package/dist/signals/hydration-script.js +2 -2
- package/dist/signals/hydration-script.js.map +6 -3
- package/dist/tools/escape-script-json.js +2 -2
- package/dist/tools/escape-script-json.js.map +4 -3
- package/dist/tools/event-emitter.js +2 -2
- package/dist/tools/event-emitter.js.map +4 -3
- package/dist/tools/index.js +2 -2
- package/dist/tools/index.js.map +7 -3
- package/dist/tools/render-jsx-template.js +2 -2
- package/dist/tools/render-jsx-template.js.map +4 -3
- package/dist/tools/stringify-typed.js +2 -2
- package/dist/tools/stringify-typed.js.map +4 -3
- package/dist/types.js +2 -2
- package/dist/types.js.map +2 -2
- package/dist/utils/attribute-utils.js +2 -2
- package/dist/utils/attribute-utils.js.map +4 -3
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +4 -3
- package/package.json +22 -5
- package/size-budget.json +11 -2
- package/dist/chunk-0bswvy25.js +0 -4
- package/dist/chunk-0bswvy25.js.map +0 -10
- package/dist/chunk-0btkzzyc.js +0 -4
- package/dist/chunk-0btkzzyc.js.map +0 -10
- package/dist/chunk-0g0j9re6.js +0 -4
- package/dist/chunk-0g0j9re6.js.map +0 -10
- package/dist/chunk-1x26p09c.js +0 -4
- package/dist/chunk-1x26p09c.js.map +0 -10
- package/dist/chunk-21a7jask.js +0 -4
- package/dist/chunk-21a7jask.js.map +0 -10
- package/dist/chunk-25zjh0kg.js +0 -4
- package/dist/chunk-25zjh0kg.js.map +0 -10
- package/dist/chunk-30x4hggg.js +0 -4
- package/dist/chunk-30x4hggg.js.map +0 -10
- package/dist/chunk-3xxvmd5c.js +0 -4
- package/dist/chunk-3xxvmd5c.js.map +0 -10
- package/dist/chunk-3ynk7e1e.js +0 -4
- package/dist/chunk-3ynk7e1e.js.map +0 -10
- package/dist/chunk-5b1en9vz.js +0 -4
- package/dist/chunk-5b1en9vz.js.map +0 -10
- package/dist/chunk-5bkat72n.js +0 -4
- package/dist/chunk-5bkat72n.js.map +0 -10
- package/dist/chunk-5qeaq3tj.js +0 -4
- package/dist/chunk-5qeaq3tj.js.map +0 -10
- package/dist/chunk-66e6s792.js +0 -4
- package/dist/chunk-66e6s792.js.map +0 -10
- package/dist/chunk-79jg8q67.js +0 -4
- package/dist/chunk-79jg8q67.js.map +0 -10
- package/dist/chunk-8d5ddvvf.js +0 -4
- package/dist/chunk-8d5ddvvf.js.map +0 -10
- package/dist/chunk-8e9fgtbn.js +0 -4
- package/dist/chunk-8e9fgtbn.js.map +0 -10
- package/dist/chunk-9mqtp3js.js +0 -4
- package/dist/chunk-9mqtp3js.js.map +0 -10
- package/dist/chunk-9rj2rwes.js +0 -4
- package/dist/chunk-9rj2rwes.js.map +0 -10
- package/dist/chunk-atms6yrh.js +0 -4
- package/dist/chunk-atms6yrh.js.map +0 -10
- package/dist/chunk-bk2nbmcd.js +0 -4
- package/dist/chunk-bk2nbmcd.js.map +0 -10
- package/dist/chunk-bk6qkvfp.js +0 -4
- package/dist/chunk-bk6qkvfp.js.map +0 -10
- package/dist/chunk-c0qyz98c.js +0 -4
- package/dist/chunk-c0qyz98c.js.map +0 -10
- package/dist/chunk-c52qhh0j.js +0 -4
- package/dist/chunk-c52qhh0j.js.map +0 -10
- package/dist/chunk-cnyxrh9r.js +0 -4
- package/dist/chunk-cnyxrh9r.js.map +0 -10
- package/dist/chunk-cvz9mrxa.js +0 -4
- package/dist/chunk-cvz9mrxa.js.map +0 -10
- package/dist/chunk-dabagjk6.js +0 -4
- package/dist/chunk-dabagjk6.js.map +0 -10
- package/dist/chunk-e0r6ca2g.js +0 -4
- package/dist/chunk-e0r6ca2g.js.map +0 -10
- package/dist/chunk-eevw1j2q.js +0 -4
- package/dist/chunk-eevw1j2q.js.map +0 -10
- package/dist/chunk-ek664x1c.js +0 -4
- package/dist/chunk-ek664x1c.js.map +0 -10
- package/dist/chunk-eyw14d6y.js +0 -4
- package/dist/chunk-eyw14d6y.js.map +0 -10
- package/dist/chunk-fs4j94bk.js +0 -4
- package/dist/chunk-fs4j94bk.js.map +0 -10
- package/dist/chunk-g2z3mm6b.js +0 -4
- package/dist/chunk-g2z3mm6b.js.map +0 -10
- package/dist/chunk-g5n3m11h.js +0 -4
- package/dist/chunk-g5n3m11h.js.map +0 -10
- package/dist/chunk-gdkte2vd.js +0 -4
- package/dist/chunk-gdkte2vd.js.map +0 -10
- package/dist/chunk-gg74gdpv.js +0 -4
- package/dist/chunk-gg74gdpv.js.map +0 -10
- package/dist/chunk-gpv1n74a.js +0 -4
- package/dist/chunk-gpv1n74a.js.map +0 -10
- package/dist/chunk-h9k7crjc.js +0 -4
- package/dist/chunk-h9k7crjc.js.map +0 -10
- package/dist/chunk-hpzgnxgq.js +0 -4
- package/dist/chunk-hpzgnxgq.js.map +0 -10
- package/dist/chunk-hrjc8b1y.js +0 -4
- package/dist/chunk-hrjc8b1y.js.map +0 -10
- package/dist/chunk-hvy4zvcc.js +0 -4
- package/dist/chunk-hvy4zvcc.js.map +0 -10
- package/dist/chunk-hztr86b4.js +0 -4
- package/dist/chunk-hztr86b4.js.map +0 -10
- package/dist/chunk-j3v7rca5.js +0 -4
- package/dist/chunk-j3v7rca5.js.map +0 -10
- package/dist/chunk-j864sv4w.js +0 -4
- package/dist/chunk-j864sv4w.js.map +0 -10
- package/dist/chunk-jkb2y7c8.js +0 -4
- package/dist/chunk-jkb2y7c8.js.map +0 -10
- package/dist/chunk-kakpjgzf.js +0 -4
- package/dist/chunk-kakpjgzf.js.map +0 -10
- package/dist/chunk-kmebacvv.js +0 -4
- package/dist/chunk-kmebacvv.js.map +0 -10
- package/dist/chunk-knqsm6v3.js +0 -4
- package/dist/chunk-knqsm6v3.js.map +0 -10
- package/dist/chunk-mp2vtrkg.js +0 -4
- package/dist/chunk-mp2vtrkg.js.map +0 -10
- package/dist/chunk-mpsj3cjs.js +0 -4
- package/dist/chunk-mpsj3cjs.js.map +0 -10
- package/dist/chunk-n4p2542b.js +0 -4
- package/dist/chunk-n4p2542b.js.map +0 -10
- package/dist/chunk-nctznxyz.js +0 -4
- package/dist/chunk-nctznxyz.js.map +0 -10
- package/dist/chunk-ndw3hc3v.js +0 -4
- package/dist/chunk-ndw3hc3v.js.map +0 -10
- package/dist/chunk-nnnb6pac.js +0 -4
- package/dist/chunk-nnnb6pac.js.map +0 -10
- package/dist/chunk-nssj2x13.js +0 -4
- package/dist/chunk-nssj2x13.js.map +0 -10
- package/dist/chunk-nvr37vma.js +0 -4
- package/dist/chunk-nvr37vma.js.map +0 -10
- package/dist/chunk-p8k4g99a.js +0 -4
- package/dist/chunk-p8k4g99a.js.map +0 -10
- package/dist/chunk-pkszgjqf.js +0 -4
- package/dist/chunk-pkszgjqf.js.map +0 -10
- package/dist/chunk-q9z6tnzw.js +0 -4
- package/dist/chunk-q9z6tnzw.js.map +0 -10
- package/dist/chunk-qdz5sncz.js +0 -4
- package/dist/chunk-qdz5sncz.js.map +0 -10
- package/dist/chunk-qe0eww1n.js +0 -4
- package/dist/chunk-qe0eww1n.js.map +0 -10
- package/dist/chunk-r33zvvda.js +0 -4
- package/dist/chunk-r33zvvda.js.map +0 -10
- package/dist/chunk-rkh1vkb9.js +0 -4
- package/dist/chunk-rkh1vkb9.js.map +0 -10
- package/dist/chunk-rrg759ht.js +0 -4
- package/dist/chunk-rrg759ht.js.map +0 -10
- package/dist/chunk-s09s5ayx.js +0 -4
- package/dist/chunk-s09s5ayx.js.map +0 -10
- package/dist/chunk-s5p5z3z4.js +0 -4
- package/dist/chunk-s5p5z3z4.js.map +0 -10
- package/dist/chunk-sf4a2gy5.js +0 -4
- package/dist/chunk-sf4a2gy5.js.map +0 -10
- package/dist/chunk-ssnnxzrj.js +0 -4
- package/dist/chunk-ssnnxzrj.js.map +0 -10
- package/dist/chunk-t8xtvgyg.js +0 -4
- package/dist/chunk-t8xtvgyg.js.map +0 -10
- package/dist/chunk-v3ta7hnv.js +0 -4
- package/dist/chunk-v3ta7hnv.js.map +0 -10
- package/dist/chunk-v92hp9g0.js +0 -4
- package/dist/chunk-v92hp9g0.js.map +0 -10
- package/dist/chunk-vgtggzb6.js +0 -4
- package/dist/chunk-vgtggzb6.js.map +0 -9
- package/dist/chunk-vk48hgm4.js +0 -4
- package/dist/chunk-vk48hgm4.js.map +0 -10
- package/dist/chunk-w8s5fnsq.js +0 -4
- package/dist/chunk-w8s5fnsq.js.map +0 -10
- package/dist/chunk-wd23rn4q.js +0 -4
- package/dist/chunk-wd23rn4q.js.map +0 -10
- package/dist/chunk-wds4href.js +0 -4
- package/dist/chunk-wds4href.js.map +0 -10
- package/dist/chunk-wvd1ffe4.js +0 -4
- package/dist/chunk-wvd1ffe4.js.map +0 -10
- package/dist/chunk-wwbjz9k4.js +0 -4
- package/dist/chunk-wwbjz9k4.js.map +0 -10
- package/dist/chunk-x2k0ngpz.js +0 -4
- package/dist/chunk-x2k0ngpz.js.map +0 -10
- package/dist/chunk-x457d0ap.js +0 -4
- package/dist/chunk-x457d0ap.js.map +0 -10
- package/dist/chunk-xbhtzkre.js +0 -4
- package/dist/chunk-xbhtzkre.js.map +0 -10
- package/dist/chunk-y139ycfm.js +0 -4
- package/dist/chunk-y139ycfm.js.map +0 -10
- package/dist/chunk-z9kxfckm.js +0 -4
- package/dist/chunk-z9kxfckm.js.map +0 -10
- package/dist/chunk-zx5txex8.js +0 -4
- package/dist/chunk-zx5txex8.js.map +0 -10
- package/dist/chunk-zygdebw8.js +0 -4
- package/dist/chunk-zygdebw8.js.map +0 -10
- package/dist/core/radiant-component.d.ts +0 -113
- package/dist/core/radiant-component.js +0 -3
- package/dist/core/radiant-component.js.map +0 -9
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/utils/attribute-utils.ts", "../src/context/context-ssr-bridge.ts", "../src/core/custom-element-metadata.ts", "../src/server/context-ssr.ts", "../src/core/radiant-component-ssr.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"import type { RadiantElement } from '../core/radiant-element';\n\nexport 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\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\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\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (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\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\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\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\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\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${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\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn 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\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(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\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn 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\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
|
|
6
|
+
"import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
|
|
7
|
+
"export const CUSTOM_ELEMENT_TAG_NAME = Symbol.for('@ecopages/radiant.customElementTagName');\n\ntype CustomElementConstructorWithMetadata = CustomElementConstructor & {\n\t[CUSTOM_ELEMENT_TAG_NAME]?: string;\n};\n\n/**\n * Sets the custom element tag name for a given constructor.\n * This is used internally to associate a class with its custom element tag, which is necessary for features like hydration and SSR support.\n * @param target The constructor of the custom element.\n * @param tagName The tag name to associate with the custom element.\n */\nexport function setCustomElementTagName(target: CustomElementConstructor, tagName: string): void {\n\t(target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME] = tagName;\n}\n\n/**\n * Retrieves the custom element tag name associated with a given constructor.\n * @param target The constructor of the custom element.\n * @returns The tag name associated with the custom element, or `undefined` if not set.\n */\nexport function getCustomElementTagName(target: CustomElementConstructor): string | undefined {\n\treturn (target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME];\n}\n",
|
|
8
|
+
"import type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { installSsrContextProviderResolver } from '../context/context-ssr-bridge';\nimport type { ContextType, UnknownContext } from '../context/types';\n\ntype ProviderFrame = Map<UnknownContext, SsrSerializableContextProvider>;\ntype ProviderStack = ProviderFrame[];\n\nlet resolvedAsyncLocalStorage: AsyncLocalStorage<ProviderStack> | null | undefined;\n\n/**\n * Lazily resolves `AsyncLocalStorage` from `node:async_hooks`.\n *\n * The dynamic `require` is necessary because browser-based SSR tests import\n * this server-oriented module directly. A top-level static import would break\n * those browser bundles even though normal application SSR runs on the server.\n *\n * On the server (Node.js, Bun, Cloudflare Workers) the import always succeeds.\n * In browser test environments where SSR rendering is exercised without a real\n * server, the fallback global stack is used instead.\n */\nfunction getAsyncLocalStorage(): AsyncLocalStorage<ProviderStack> | null {\n\tif (resolvedAsyncLocalStorage !== undefined) {\n\t\treturn resolvedAsyncLocalStorage;\n\t}\n\n\ttry {\n\t\tconst { AsyncLocalStorage: ALS } = require('node:async_hooks') as typeof import('node:async_hooks');\n\t\tresolvedAsyncLocalStorage = new ALS<ProviderStack>();\n\t\treturn resolvedAsyncLocalStorage;\n\t} catch {\n\t\tresolvedAsyncLocalStorage = null;\n\t\treturn null;\n\t}\n}\n\nconst SSR_CONTEXT_FALLBACK_STACK_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-fallback-stack');\n\nfunction getFallbackStack(): ProviderStack {\n\tconst g = globalThis as typeof globalThis & { [SSR_CONTEXT_FALLBACK_STACK_SYMBOL]?: ProviderStack };\n\tg[SSR_CONTEXT_FALLBACK_STACK_SYMBOL] ??= [];\n\treturn g[SSR_CONTEXT_FALLBACK_STACK_SYMBOL];\n}\n\n/**\n * Pushes a temporary provider frame onto the SSR context stack.\n *\n * On the server, each call creates an isolated `AsyncLocalStorage` context so\n * concurrent renders cannot corrupt each other.\n *\n * In browser test environments where `AsyncLocalStorage` is unavailable, a\n * synchronous global stack is used as a fallback.\n */\nexport function withSsrContextProviders(providers: readonly SsrSerializableContextProvider[]): () => void {\n\tif (providers.length === 0) {\n\t\treturn () => undefined;\n\t}\n\n\tconst frame = new Map<UnknownContext, SsrSerializableContextProvider>();\n\n\tfor (const provider of providers) {\n\t\tframe.set(provider.getContextKey(), provider);\n\t}\n\n\tconst als = getAsyncLocalStorage();\n\n\tif (als) {\n\t\tconst parentStack = als.getStore() ?? [];\n\t\tconst childStack = [...parentStack, frame];\n\t\tals.enterWith(childStack);\n\n\t\treturn () => {\n\t\t\tals.enterWith(parentStack);\n\t\t};\n\t}\n\n\tconst stack = getFallbackStack();\n\tstack.push(frame);\n\n\treturn () => {\n\t\tconst index = stack.lastIndexOf(frame);\n\t\tif (index >= 0) stack.splice(index, 1);\n\t};\n}\n\n/**\n * Resolves the nearest SSR-visible provider for a given context token.\n *\n * Lookup walks the provider frames from innermost to outermost so nested host\n * serialization behaves the same way as runtime context resolution in the DOM.\n */\nexport function resolveSsrContextProvider<T extends UnknownContext>(\n\tcontext: T,\n): SsrSerializableContextProvider | undefined {\n\tconst store = getAsyncLocalStorage()?.getStore() ?? getFallbackStack();\n\n\tfor (let index = store.length - 1; index >= 0; index -= 1) {\n\t\tconst provider = store[index]?.get(context);\n\n\t\tif (provider) {\n\t\t\treturn provider;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Resolves the current SSR-visible value for a given context token.\n *\n * This is the ergonomic helper consumed by SSR-aware decorators and component\n * render paths when they only need the context payload instead of the full\n * provider instance.\n */\nexport function resolveSsrContextValue<T extends UnknownContext>(context: T): ContextType<T> | undefined {\n\tconst provider = resolveSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn undefined;\n\t}\n\n\treturn provider.getContext() as ContextType<T>;\n}\n\ninstallSsrContextProviderResolver((context) => resolveSsrContextProvider(context));\n",
|
|
9
|
+
"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 RadiantElementSsrHost = {\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 RadiantElementSsrService {\n\tconstructor(private readonly host: RadiantElementSsrHost) {}\n\n\tpublic renderHost(): JsxRenderable {\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\touterHTML: this.renderHostToString({ mode: 'hydrate' }),\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\t\tconst hydrate = options.mode === 'hydrate' || (options.mode === undefined && options.hydrate === true);\n\n\t\tif (!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"
|
|
5
10
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
11
|
+
"mappings": "2PAYO,SAAS,CAA0B,CAAC,EAAkC,CAC5E,OAAQ,QACF,MACJ,MAAO,aACH,QACJ,MAAO,eACH,OACJ,MAAO,cACH,OACJ,MAAO,cACH,OACJ,MAAO,UAUH,SAAS,CAAyB,CAAC,EAAqC,CAC9E,OAAQ,OAAO,OACT,UACJ,MAAO,cACH,SACJ,MAAO,aACH,SACJ,MAAO,SAGT,GAAI,MAAM,QAAQ,CAAY,EAAG,MAAO,QACxC,GAAI,OAAO,UAAU,SAAS,KAAK,CAAY,IAAM,kBAAmB,MAAO,SASzE,SAAS,CAAmB,CAAC,EAAsC,CACzE,OAAQ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EACnC,SAGD,IAAM,EAAe,KAAK,KAAK,iBAAiB,EAAW,IAAI,EAE/D,GAAI,IAAiB,QAAa,IAAiB,MAAQ,IAAiB,GAC3E,SAGD,EAAW,GAAiB,OAAO,EAAoB,EAAc,EAAW,QAAQ,IAAI,CAAC,EAC7F,EAAe,IAAI,CAAa,EAGjC,QAAW,KAAiB,KAAK,KAAK,mBAAmB,EAAG,CAC3D,IAAM,EAAiB,KAAK,KAAK,kBAAkB,CAAa,EAChE,GAAI,IAAmB,KACtB,EAAW,GAAiB,EAI9B,OAAO,EAGA,UAAU,EAAW,CAC5B,IAAM,EAAU,EAAwB,KAAK,KAAK,WAAW,EAE7D,GAAI,CAAC,EACJ,MAAU,MAAM,GAAG,KAAK,KAAK,YAAY,0CAA0C,EAGpF,OAAO,EAET,CAEA,SAAS,CAAuB,CAAC,EAA4C,CAC5E,OAAO,OAAO,QAAQ,CAAU,EAC9B,IAAI,EAAE,EAAM,KAAW,IAAI,MAAS,EAAgB,CAAK,IAAI,EAC7D,KAAK,EAAE,EAGV,SAAS,CAAe,CAAC,EAAuB,CAC/C,OAAO,EAAM,QAAQ,KAAM,OAAO,EAAE,QAAQ,KAAM,QAAQ,EAAE,QAAQ,KAAM,MAAM,EAAE,QAAQ,KAAM,MAAM",
|
|
12
|
+
"debugId": "16B2C294F53D386064756E2164756E21",
|
|
8
13
|
"names": []
|
|
9
14
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';
|
|
2
|
+
import type { UnknownContext } from '../context/types';
|
|
3
|
+
import { type ReactiveHostLike } from './reactive-host';
|
|
4
|
+
import type { ReactivePropertyOptions, ReactiveBindingValue, ReactiveBindings, ReactiveFieldOptions } from './radiant-element';
|
|
5
|
+
import type { ReactiveBindingOption } from './radiant-element';
|
|
6
|
+
import type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';
|
|
7
|
+
type StringPropertyKey<Value> = Extract<keyof Value, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Attaches Radiant reactivity to an existing DOM element without defining a
|
|
10
|
+
* custom element.
|
|
11
|
+
*
|
|
12
|
+
* `RadiantController` is the controller-host counterpart to `RadiantElement`.
|
|
13
|
+
* It can enhance authored DOM, or it can take over the host's inner DOM by
|
|
14
|
+
* overriding `render()`.
|
|
15
|
+
*
|
|
16
|
+
* When used with the controller registry, the attached host is typically an
|
|
17
|
+
* element carrying `data-controller="..."`.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam Bindings - Explicit internal bindable shape. Include only the
|
|
20
|
+
* reactive keys that JSX bindings should accept.
|
|
21
|
+
*/
|
|
22
|
+
export declare class RadiantController<Bindings extends object = {}> implements ReactiveHostLike<Bindings> {
|
|
23
|
+
readonly host: Element;
|
|
24
|
+
readonly element: Element;
|
|
25
|
+
readonly bindings: ReactiveBindings<Bindings>;
|
|
26
|
+
readonly $: ReactiveBindings<Bindings>;
|
|
27
|
+
private readonly reactiveHost;
|
|
28
|
+
private connected;
|
|
29
|
+
private isRendering;
|
|
30
|
+
private isRenderScheduled;
|
|
31
|
+
private needsRender;
|
|
32
|
+
private renderSignal?;
|
|
33
|
+
private readonly renderWatcher;
|
|
34
|
+
constructor(host: Element);
|
|
35
|
+
/**
|
|
36
|
+
* Connects the controller to its host and starts reactive subscriptions.
|
|
37
|
+
*
|
|
38
|
+
* If the controller owns a render lifecycle by overriding `render()`, the
|
|
39
|
+
* first update runs immediately after connection.
|
|
40
|
+
*/
|
|
41
|
+
connect(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Connects the controller for server-side rendering without running the
|
|
44
|
+
* browser render/update lifecycle.
|
|
45
|
+
*/
|
|
46
|
+
connectForSsrRender(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Disconnects the controller from its host and tears down reactive work.
|
|
49
|
+
*/
|
|
50
|
+
disconnect(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Disconnects a controller that was attached through the SSR-only lifecycle.
|
|
53
|
+
*/
|
|
54
|
+
disconnectForSsrRender(): void;
|
|
55
|
+
get isConnected(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the JSX tree rendered into the attached host.
|
|
58
|
+
*
|
|
59
|
+
* The base implementation renders nothing. Override this method when the
|
|
60
|
+
* controller should own the host's inner DOM instead of only enhancing
|
|
61
|
+
* authored markup.
|
|
62
|
+
*/
|
|
63
|
+
render(): JsxRenderable;
|
|
64
|
+
/**
|
|
65
|
+
* Schedules a render pass for render-owning controllers.
|
|
66
|
+
*
|
|
67
|
+
* Multiple calls in the same microtask are coalesced into a single update.
|
|
68
|
+
*/
|
|
69
|
+
requestUpdate(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Flushes the current render output into the attached host element.
|
|
72
|
+
*
|
|
73
|
+
* This is a no-op unless the controller overrides `render()`.
|
|
74
|
+
*/
|
|
75
|
+
update(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Returns a subscribable JSX binding for a selected reactive member.
|
|
78
|
+
*/
|
|
79
|
+
bind<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the cached binding object for a selected reactive member.
|
|
82
|
+
*/
|
|
83
|
+
getReactiveBinding<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
|
|
84
|
+
/**
|
|
85
|
+
* Defines a reactive field directly on the controller instance.
|
|
86
|
+
*/
|
|
87
|
+
createReactiveField<T>(propertyName: string, initialValue: T, options?: ReactiveFieldOptions): void;
|
|
88
|
+
/**
|
|
89
|
+
* Defines a controller prop backed by the attached host element's property
|
|
90
|
+
* channel instead of attribute serialization.
|
|
91
|
+
*
|
|
92
|
+
* This gives controller-based integrations the same reactive field surface as
|
|
93
|
+
* `@prop(...)` on `RadiantElement`, while allowing external code to assign
|
|
94
|
+
* structured values such as arrays or objects directly on `controller.host`.
|
|
95
|
+
*/
|
|
96
|
+
createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void;
|
|
97
|
+
/**
|
|
98
|
+
* Defines a JSX binding companion such as `$count` for a reactive member.
|
|
99
|
+
*/
|
|
100
|
+
defineReactiveBinding(property: string, bind?: ReactiveBindingOption): void;
|
|
101
|
+
notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void;
|
|
102
|
+
registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void;
|
|
103
|
+
connectedContextCallback(_contextName: UnknownContext): void;
|
|
104
|
+
registerContextProvider(_name: string, _provider: unknown): void;
|
|
105
|
+
registerHydrationBinding(_name: string, _binding: SsrSerializableHydrationBinding): void;
|
|
106
|
+
registerCleanupCallback(callback: () => void): void;
|
|
107
|
+
registerConnectedCallback(callback: () => void): void;
|
|
108
|
+
registerReactiveDependencyReader(property: string, read: () => unknown): void;
|
|
109
|
+
trackReactiveRead(property: string): void;
|
|
110
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
111
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
112
|
+
dispatchEvent(event: Event): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Finds one or more elements inside the attached host by `data-ref`.
|
|
115
|
+
*
|
|
116
|
+
* Prefer `@query(...)` for stable, decorator-backed refs and use `getRef(...)`
|
|
117
|
+
* for one-off lookups.
|
|
118
|
+
*/
|
|
119
|
+
getRef<T extends Element = Element>(ref: string, all: true): T[];
|
|
120
|
+
getRef<T extends Element = Element>(ref: string, all?: false): T | null;
|
|
121
|
+
protected shouldAutoBindReactiveMembers(): boolean;
|
|
122
|
+
protected shouldRunRenderLifecycle(): boolean;
|
|
123
|
+
private getRenderTarget;
|
|
124
|
+
private disconnectRenderWatcher;
|
|
125
|
+
private resolveTrackedRenderOutput;
|
|
126
|
+
}
|
|
127
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var m=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(M,Q)=>(typeof require<"u"?require:M)[Q]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});var Y=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function N(q,M){let U=q[Y];if(Array.isArray(U)){U.push(M);return}Object.defineProperty(q,Y,{value:[M],configurable:!0})}function F(q){let M=[],Q=Object.getPrototypeOf(q);while(Q&&Q!==Object.prototype)M.push(Q),Q=Object.getPrototypeOf(Q);for(let U=M.length-1;U>=0;U-=1){let W=M[U][Y];if(!Array.isArray(W))continue;for(let $ of W)$(q)}}import{createSubscribableJsxValue as D}from"@ecopages/jsx";import{trackDependency as K}from"@ecopages/signals";class O{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(q){this.read=q}get(){return K(this),this.read()}subscribe(q){return this.subscribers.add(q),()=>{this.subscribers.delete(q)}}addWatcher(q){return this.watcherListeners.add(q),()=>{this.watcherListeners.delete(q)}}getVersion(){return this.version}notify(q){this.version+=1;let M;try{this.notifyWatchers()}catch(Q){M=Q}if(this.publish(q),M)throw M}publish(q){for(let M of this.subscribers)M(q)}notifyWatchers(){let q=[];for(let M of this.watcherListeners)try{M()}catch(Q){q.push(Q)}if(q.length===1)throw q[0];if(q.length>1)throw AggregateError(q,"Multiple reactive dependency notifications failed.")}}function P(q){return typeof q==="object"&&q!==null&&typeof q.get==="function"}class Z{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(q,M,Q){this.host=q;this.access=M;this.shouldAutoBind=Q;let U=this.createReactiveBindingNamespace();this.bindings=U,this.$=U}connectHost(){for(let q of this.onConnectedCallbacks)q()}disconnectHost(){for(let q of this.onDisconnectedCallback)q()}notifyUpdate(q,M,Q){if(M===Q)return;this.reactiveDependencies.get(q)?.notify(Q);let U=this.updateCallbacks.get(q);if(U)for(let W of U)W()}registerCleanupCallback(q){this.onDisconnectedCallback.push(q)}registerConnectedCallback(q){this.onConnectedCallbacks.push(q)}registerHydrationBinding(q,M){}registerReactiveDependencyReader(q,M){this.reactiveDependencyReaders.set(q,M)}registerUpdateCallback(q,M){if(!this.updateCallbacks.has(q))this.updateCallbacks.set(q,new Set);let Q=this.updateCallbacks.get(q);return Q.add(M),()=>{if(Q.delete(M),Q.size===0)this.updateCallbacks.delete(q)}}getReactiveBinding(q){let M=this.reactiveBindings.get(q);if(M)return M;let Q=D({getValue:()=>this.readReactiveBindingValue(q),subscribe:(U)=>this.registerUpdateCallback(q,()=>{U(this.readReactiveBindingValue(q))})});return this.reactiveBindings.set(q,Q),Q}bind(q){return this.getReactiveBinding(q)}defineReactiveBinding(q,M=!0){let Q=typeof M==="string"?M:M?`$${q}`:void 0,U=this.access.getBindingTarget?.(this.host)??this.host;if(!Q||this.access.hasProperty(this.host,Q))return;this.access.defineProperty(U,Q,{get:()=>this.getReactiveBinding(q),enumerable:!1,configurable:!0})}trackReactiveRead(q){K(this.getReactiveDependency(q))}defineReactiveAccessor(q,M){let Q=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(q,Q),this.registerReactiveDependencyReader(q,M.getValue),this.access.defineProperty(this.host,q,{get:()=>{return this.trackReactiveRead(q),M.getValue()},set:(U)=>{let W=M.getValue();if(W===U)return;M.setValue(U),this.notifyUpdate(q,W,U)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(q,void 0,M.notifyInitialValue)}createReactiveField(q,M,Q={}){let U={name:q,value:M,initialValue:M};this.reactiveFields.set(q,U),this.defineReactiveAccessor(q,{bind:Q.bind,getValue:()=>this.reactiveFields.get(q)?.value,setValue:(W)=>{this.reactiveFields.set(q,{...U,value:W})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(q,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(q){let M=this.reactiveDependencies.get(q);if(M)return M;let Q=new O(()=>this.readReactiveDependencyValue(q));return this.reactiveDependencies.set(q,Q),Q}readReactiveDependencyValue(q){let M=this.reactiveDependencyReaders.get(q);if(M)return M();return this.readReactiveBindingValue(q)}readReactiveBindingValue(q){let M=this.access.readProperty(this.host,q);if(P(M))return M.get();return M}}function L(q){switch(q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function x(q){switch(typeof q){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(q))return"array";if(Object.prototype.toString.call(q)==="[object Object]")return"object"}function B(q){switch(q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function A(q){try{return JSON.parse(q)}catch{throw TypeError("Invalid JSON string")}}var k={array(q){let M=A(q);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(q){return!(q==="0"||String(q).toLowerCase()==="false")},number(q){return Number(q.replace(/_/g,""))},object(q){let M=JSON.parse(q);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${q}" of type "${x(M)}"`);return M},string(q){return q}},J={default:C,array:_,object:_};function _(q){return JSON.stringify(q)}function C(q){return`${q}`}function j(q,M){let Q=L(M);if(!Q)throw TypeError(`[radiant-element] Unknown type "${M}"`);return k[Q](q)}function y(q,M){let Q=L(M);if(!Q)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(J[Q]??J.default??C)(q)}function R(q){return typeof q==="boolean"}function S(q){return typeof q==="number"}function T(q){return typeof q==="string"}function I(q){return Array.isArray(q)}function h(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}function E(q,M){switch(q){case Boolean:return R(M);case Number:return S(M);case String:return T(M);case Array:return I(M);case Object:return h(M);default:return!1}}var u=(q,M,Q,U)=>{if(M===Boolean){let $=q.getAttribute(Q);if($===null)return U;return $===""?!0:j($,M)}let W=q.getAttribute(Q);return W!==null?j(W,M):U??B(M)};import{render as w}from"@ecopages/jsx";import{Computed as g,subtle as f}from"@ecopages/signals";class z{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;needsRender=!1;renderSignal;renderWatcher=new f.Watcher(()=>{this.requestUpdate()});constructor(q){this.host=q,this.element=q,this.reactiveHost=new Z(this,{defineProperty:(M,Q,U)=>Object.defineProperty(M,Q,U),hasProperty:(M,Q)=>(Q in M),readProperty:(M,Q)=>M[Q]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,F(this)}connect(){if(this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.connected=!0,this.reactiveHost.connectHost()}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost(),this.connected=!1}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let q=this.getRenderTarget();if(!q)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{w(this.resolveTrackedRenderOutput(),q)}finally{this.isRendering=!1}}}bind(q){return this.reactiveHost.bind(q)}getReactiveBinding(q){return this.reactiveHost.getReactiveBinding(q)}createReactiveField(q,M,Q={}){this.reactiveHost.createReactiveField(q,M,Q)}createReactiveProp(q,M){let{type:Q,defaultValue:U,bind:W}=M;if(U!==void 0&&!E(Q,U))throw Error(`defaultValue does not match the expected type for ${Q.name}`);let $=Object.getOwnPropertyDescriptor(this.host,q),G=this.host,H=G[q]??U??B(Q);this.reactiveHost.defineReactiveAccessor(q,{bind:W,getValue:()=>H,setValue:(X)=>{H=X},notifyInitialValue:H}),Object.defineProperty(this.host,q,{get:()=>this[q],set:(X)=>{this[q]=X},enumerable:$?.enumerable??!0,configurable:!0}),this.registerCleanupCallback(()=>{let X=this[q];if($){if(Object.defineProperty(this.host,q,$),"value"in $&&$.writable)G[q]=X;return}delete G[q];try{G[q]=X}catch{Object.defineProperty(this.host,q,{value:X,writable:!0,enumerable:!0,configurable:!0})}})}defineReactiveBinding(q,M=!0){this.reactiveHost.defineReactiveBinding(q,M)}notifyUpdate(q,M,Q){this.reactiveHost.notifyUpdate(q,M,Q)}registerUpdateCallback(q,M){return this.reactiveHost.registerUpdateCallback(q,M)}connectedContextCallback(q){}registerContextProvider(q,M){}registerHydrationBinding(q,M){}registerCleanupCallback(q){this.reactiveHost.registerCleanupCallback(q)}registerConnectedCallback(q){this.reactiveHost.registerConnectedCallback(q)}registerReactiveDependencyReader(q,M){this.reactiveHost.registerReactiveDependencyReader(q,M)}trackReactiveRead(q){this.reactiveHost.trackReactiveRead(q)}addEventListener(q,M,Q){this.host.addEventListener(q,M,Q)}removeEventListener(q,M,Q){this.host.removeEventListener(q,M,Q)}dispatchEvent(q){return this.host.dispatchEvent(q)}getRef(q,M=!1){let Q=`[data-ref="${q}"]`;if(M)return Array.from(this.host.querySelectorAll(Q));return this.host.querySelector(Q)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==z.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let q=new g(()=>this.render()),M=q.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=q,this.renderWatcher.watch(q),M}}export{z as RadiantController};
|
|
2
|
+
|
|
3
|
+
//# debugId=479ACC6352CE9BFB64756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/core/reactive-host.ts", "../src/utils/attribute-utils.ts", "../src/core/radiant-controller.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
|
|
6
|
+
"import { createSubscribableJsxValue, type SubscribableJsxValue } from '@ecopages/jsx';\nimport { trackDependency, type DependencyNode, type SignalSubscriber } from '@ecopages/signals';\nimport type {\n\tReactiveBindingOption,\n\tReactiveBindingValue,\n\tReactiveBindings,\n\tReactiveFieldOptions,\n} from './radiant-element';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\n\ntype StringPropertyKey<Value> = Extract<keyof Value, string>;\ntype ReactiveDependencyReader = () => unknown;\n\ntype ReactiveHostAccess<Host extends object> = {\n\tdefineProperty(target: object, property: string, descriptor: PropertyDescriptor): void;\n\tgetBindingTarget?(host: Host): object;\n\thasProperty(host: Host, property: string): boolean;\n\treadProperty(host: Host, property: string): unknown;\n};\n\ntype ReactiveField<T = unknown> = {\n\tname: string;\n\tvalue: T;\n\tinitialValue: T;\n};\n\ntype ReactiveAccessorOptions<T> = {\n\tbind?: ReactiveBindingOption;\n\tgetValue: () => T | undefined;\n\tsetValue: (value: T) => void;\n\tnotifyInitialValue?: T;\n};\n\n/**\n * Shared reactive-host contract consumed by decorators and host adapters.\n *\n * `RadiantElement` and `RadiantController` both implement this surface so the\n * decorator layer can define fields, bindings, context reactions, and tracked\n * reads without depending on a specific host class.\n */\nexport interface ReactiveHostLike<Bindings extends object = {}> {\n\treadonly bindings: ReactiveBindings<Bindings>;\n\treadonly $: ReactiveBindings<Bindings>;\n\tbind<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\tgetReactiveBinding<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\tcreateReactiveField<T>(propertyName: string, initialValue: T, options?: ReactiveFieldOptions): void;\n\tdefineReactiveBinding(property: string, bind?: ReactiveBindingOption): void;\n\tnotifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterHydrationBinding(name: string, binding: SsrSerializableHydrationBinding): void;\n\tregisterReactiveDependencyReader(property: string, read: () => unknown): void;\n\ttrackReactiveRead(property: string): void;\n}\n\n/**\n * Internal dependency node that bridges Radiant host members into the signals\n * tracking graph.\n */\nclass ReactiveHostDependency implements DependencyNode {\n\tprivate readonly subscribers = new Set<SignalSubscriber<unknown>>();\n\tprivate readonly watcherListeners = new Set<() => void>();\n\tprivate version = 0;\n\n\tconstructor(private readonly read: ReactiveDependencyReader) {}\n\n\tpublic get(): unknown {\n\t\ttrackDependency(this);\n\t\treturn this.read();\n\t}\n\n\tpublic subscribe(notify: SignalSubscriber<unknown>): () => void {\n\t\tthis.subscribers.add(notify);\n\n\t\treturn () => {\n\t\t\tthis.subscribers.delete(notify);\n\t\t};\n\t}\n\n\tpublic addWatcher(notify: () => void): () => void {\n\t\tthis.watcherListeners.add(notify);\n\n\t\treturn () => {\n\t\t\tthis.watcherListeners.delete(notify);\n\t\t};\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\tpublic notify(nextValue: unknown): void {\n\t\tthis.version += 1;\n\t\tlet watcherError: unknown;\n\n\t\ttry {\n\t\t\tthis.notifyWatchers();\n\t\t} catch (error) {\n\t\t\twatcherError = error;\n\t\t}\n\n\t\tthis.publish(nextValue);\n\n\t\tif (watcherError) {\n\t\t\tthrow watcherError;\n\t\t}\n\t}\n\n\tprivate publish(nextValue: unknown): void {\n\t\tfor (const subscriber of this.subscribers) {\n\t\t\tsubscriber(nextValue);\n\t\t}\n\t}\n\n\tprivate notifyWatchers(): void {\n\t\tconst errors: unknown[] = [];\n\n\t\tfor (const listener of this.watcherListeners) {\n\t\t\ttry {\n\t\t\t\tlistener();\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error);\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t}\n\n\t\tif (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, 'Multiple reactive dependency notifications failed.');\n\t\t}\n\t}\n}\n\nfunction isSignalLikeBindingValue(value: unknown): value is { get(): unknown } {\n\treturn typeof value === 'object' && value !== null && typeof (value as { get?: unknown }).get === 'function';\n}\n\n/**\n * Shared reactivity engine used by both `RadiantElement` and\n * `RadiantController`.\n *\n * This class owns three pieces of shared behavior:\n *\n * - defining reactive accessors on the host object\n * - exposing cached JSX bindings such as `bindings.count` and `$count`\n * - publishing tracked updates into the signals graph and update callbacks\n *\n * Host-specific concerns such as attribute reflection, render lifecycles, and\n * custom-element APIs stay in the outer host classes.\n */\nexport class ReactiveHost<Host extends object, Bindings extends object = {}> implements ReactiveHostLike<Bindings> {\n\tpublic readonly bindings: ReactiveBindings<Bindings>;\n\tpublic readonly $: ReactiveBindings<Bindings>;\n\n\tprivate reactiveFields = new Map<string, ReactiveField>();\n\tprivate reactiveDependencies = new Map<string, ReactiveHostDependency>();\n\tprivate reactiveDependencyReaders = new Map<string, ReactiveDependencyReader>();\n\tprivate reactiveBindings = new Map<string, SubscribableJsxValue>();\n\tprivate updateCallbacks = new Map<string, Set<(...rest: any[]) => any>>();\n\tprivate onConnectedCallbacks: (() => void)[] = [];\n\tprivate onDisconnectedCallback: (() => void)[] = [];\n\n\tconstructor(\n\t\tprivate readonly host: Host,\n\t\tprivate readonly access: ReactiveHostAccess<Host>,\n\t\tprivate readonly shouldAutoBind: () => boolean,\n\t) {\n\t\tconst bindingNamespace = this.createReactiveBindingNamespace();\n\t\tthis.bindings = bindingNamespace;\n\t\tthis.$ = bindingNamespace;\n\t}\n\n\t/**\n\t * Runs all connection callbacks registered by decorators or host adapters.\n\t */\n\tpublic connectHost(): void {\n\t\tfor (const callback of this.onConnectedCallbacks) {\n\t\t\tcallback();\n\t\t}\n\t}\n\n\t/**\n\t * Runs all cleanup callbacks registered for host disconnect.\n\t */\n\tpublic disconnectHost(): void {\n\t\tfor (const cleanup of this.onDisconnectedCallback) {\n\t\t\tcleanup();\n\t\t}\n\t}\n\n\t/**\n\t * Publishes a reactive member change to tracked dependencies and explicit\n\t * update callbacks.\n\t */\n\tpublic notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void {\n\t\tif (oldValue === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.reactiveDependencies.get(changedProperty)?.notify(value);\n\t\tconst updates = this.updateCallbacks.get(changedProperty);\n\n\t\tif (updates) {\n\t\t\tfor (const update of updates) {\n\t\t\t\tupdate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Registers a callback that should run when the outer host disconnects.\n\t */\n\tpublic registerCleanupCallback(callback: () => void): void {\n\t\tthis.onDisconnectedCallback.push(callback);\n\t}\n\n\t/**\n\t * Registers a callback that should run whenever the outer host connects.\n\t */\n\tpublic registerConnectedCallback(callback: () => void): void {\n\t\tthis.onConnectedCallbacks.push(callback);\n\t}\n\n\t/**\n\t * Placeholder hydration hook so shared decorators can target both host types.\n\t *\n\t * `ReactiveHost` itself does not persist hydration bindings; concrete hosts\n\t * such as `RadiantElement` can override this behavior at the outer layer.\n\t */\n\tpublic registerHydrationBinding(_name: string, _binding: SsrSerializableHydrationBinding): void {}\n\n\t/**\n\t * Registers a raw reader for a reactive member so tracked dependency reads do\n\t * not need to go back through the public accessor.\n\t */\n\tpublic registerReactiveDependencyReader(property: string, read: ReactiveDependencyReader): void {\n\t\tthis.reactiveDependencyReaders.set(property, read);\n\t}\n\n\t/**\n\t * Registers a callback that runs whenever a named reactive member changes.\n\t *\n\t * Returns a disposer that removes the callback.\n\t */\n\tpublic registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void {\n\t\tif (!this.updateCallbacks.has(property)) {\n\t\t\tthis.updateCallbacks.set(property, new Set());\n\t\t}\n\n\t\tconst callbacks = this.updateCallbacks.get(property)!;\n\t\tcallbacks.add(update);\n\n\t\treturn () => {\n\t\t\tcallbacks.delete(update);\n\n\t\t\tif (callbacks.size === 0) {\n\t\t\t\tthis.updateCallbacks.delete(property);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Returns the cached JSX binding object for a named reactive member.\n\t */\n\tpublic getReactiveBinding<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\tconst cachedBinding = this.reactiveBindings.get(property);\n\n\t\tif (cachedBinding) {\n\t\t\treturn cachedBinding as SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\t\t}\n\n\t\tconst binding = createSubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>({\n\t\t\tgetValue: () => this.readReactiveBindingValue(property) as ReactiveBindingValue<Bindings, Property>,\n\t\t\tsubscribe: (notify) =>\n\t\t\t\tthis.registerUpdateCallback(property, () => {\n\t\t\t\t\tnotify(this.readReactiveBindingValue(property) as ReactiveBindingValue<Bindings, Property>);\n\t\t\t\t}),\n\t\t});\n\n\t\tthis.reactiveBindings.set(property, binding);\n\t\treturn binding;\n\t}\n\n\t/**\n\t * Short alias for `getReactiveBinding(...)`.\n\t */\n\tpublic bind<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\treturn this.getReactiveBinding(property) as SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;\n\t}\n\n\t/**\n\t * Defines a stable binding companion property such as `$count` on the host or\n\t * its chosen binding target.\n\t */\n\tpublic defineReactiveBinding(property: string, bind: ReactiveBindingOption = true): void {\n\t\tconst bindingPropertyName = typeof bind === 'string' ? bind : bind ? `$${property}` : undefined;\n\t\tconst bindingTarget = this.access.getBindingTarget?.(this.host) ?? this.host;\n\n\t\tif (!bindingPropertyName || this.access.hasProperty(this.host, bindingPropertyName)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.access.defineProperty(bindingTarget, bindingPropertyName, {\n\t\t\tget: () => this.getReactiveBinding(property as StringPropertyKey<Bindings>),\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\n\t/**\n\t * Records a dependency read for the named reactive member.\n\t */\n\tpublic trackReactiveRead(property: string): void {\n\t\ttrackDependency(this.getReactiveDependency(property));\n\t}\n\n\t/**\n\t * Defines a reactive getter/setter pair on the host and wires it into\n\t * bindings, dependency tracking, and update notifications.\n\t */\n\tpublic defineReactiveAccessor<T>(propertyName: string, options: ReactiveAccessorOptions<T>): void {\n\t\tconst bind = options.bind ?? this.shouldAutoBind();\n\n\t\tthis.defineReactiveBinding(propertyName, bind);\n\t\tthis.registerReactiveDependencyReader(propertyName, options.getValue);\n\n\t\tthis.access.defineProperty(this.host, propertyName, {\n\t\t\tget: () => {\n\t\t\t\tthis.trackReactiveRead(propertyName);\n\t\t\t\treturn options.getValue();\n\t\t\t},\n\t\t\tset: (newValue: T) => {\n\t\t\t\tconst oldValue = options.getValue();\n\n\t\t\t\tif (oldValue === newValue) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\toptions.setValue(newValue);\n\t\t\t\tthis.notifyUpdate(propertyName, oldValue, newValue);\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\n\t\tif (options.notifyInitialValue !== undefined) {\n\t\t\tthis.notifyUpdate(propertyName, undefined, options.notifyInitialValue);\n\t\t}\n\t}\n\n\t/**\n\t * Defines a controller- or element-local reactive field with optional JSX\n\t * binding exposure.\n\t */\n\tpublic createReactiveField<T>(propertyName: string, initialValue: T, options: ReactiveFieldOptions = {}): void {\n\t\tconst reactiveField: ReactiveField<T> = {\n\t\t\tname: propertyName,\n\t\t\tvalue: initialValue,\n\t\t\tinitialValue,\n\t\t};\n\n\t\tthis.reactiveFields.set(propertyName, reactiveField);\n\n\t\tthis.defineReactiveAccessor(propertyName, {\n\t\t\tbind: options.bind,\n\t\t\tgetValue: () => this.reactiveFields.get(propertyName)?.value as T | undefined,\n\t\t\tsetValue: (newValue: T) => {\n\t\t\t\tthis.reactiveFields.set(propertyName, { ...reactiveField, value: newValue });\n\t\t\t},\n\t\t\tnotifyInitialValue: initialValue,\n\t\t});\n\t}\n\n\tprivate createReactiveBindingNamespace(): ReactiveBindings<Bindings> {\n\t\treturn new Proxy(Object.create(null) as ReactiveBindings<Bindings>, {\n\t\t\tget: (_target, property) => {\n\t\t\t\tif (typeof property !== 'string') {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn this.getReactiveBinding(property as StringPropertyKey<Bindings>);\n\t\t\t},\n\t\t}) as ReactiveBindings<Bindings>;\n\t}\n\n\tprivate getReactiveDependency(property: string): ReactiveHostDependency {\n\t\tconst cachedDependency = this.reactiveDependencies.get(property);\n\n\t\tif (cachedDependency) {\n\t\t\treturn cachedDependency;\n\t\t}\n\n\t\tconst dependency = new ReactiveHostDependency(() => this.readReactiveDependencyValue(property));\n\t\tthis.reactiveDependencies.set(property, dependency);\n\t\treturn dependency;\n\t}\n\n\tprivate readReactiveDependencyValue(property: string): unknown {\n\t\tconst reader = this.reactiveDependencyReaders.get(property);\n\n\t\tif (reader) {\n\t\t\treturn reader();\n\t\t}\n\n\t\treturn this.readReactiveBindingValue(property as StringPropertyKey<Bindings>);\n\t}\n\n\tprivate readReactiveBindingValue<Property extends StringPropertyKey<Bindings>>(property: Property): unknown {\n\t\tconst value = this.access.readProperty(this.host, property);\n\n\t\tif (isSignalLikeBindingValue(value)) {\n\t\t\treturn value.get();\n\t\t}\n\n\t\treturn value;\n\t}\n}\n",
|
|
7
|
+
"import type { RadiantElement } from '../core/radiant-element';\n\nexport 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\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\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\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (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\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\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\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\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\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${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\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn 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\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(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\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn 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\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
|
|
8
|
+
"import { render as renderJsx, type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';\nimport { Computed, subtle } from '@ecopages/signals';\nimport type { UnknownContext } from '../context/types';\nimport { runLegacyInstanceInitializers } from '../decorators/legacy/instance-initializers';\nimport { ReactiveHost, type ReactiveHostLike } from './reactive-host';\nimport type {\n\tReactivePropertyOptions,\n\tReactiveBindingValue,\n\tReactiveBindings,\n\tReactiveFieldOptions,\n} from './radiant-element';\nimport type { ReactiveBindingOption } from './radiant-element';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\nimport { defaultValueForType, isValueOfType } from '../utils/attribute-utils';\n\ntype StringPropertyKey<Value> = Extract<keyof Value, string>;\n\n/**\n * Attaches Radiant reactivity to an existing DOM element without defining a\n * custom element.\n *\n * `RadiantController` is the controller-host counterpart to `RadiantElement`.\n * It can enhance authored DOM, or it can take over the host's inner DOM by\n * overriding `render()`.\n *\n * When used with the controller registry, the attached host is typically an\n * element carrying `data-controller=\"...\"`.\n *\n * @typeParam Bindings - Explicit internal bindable shape. Include only the\n * reactive keys that JSX bindings should accept.\n */\nexport class RadiantController<Bindings extends object = {}> implements ReactiveHostLike<Bindings> {\n\tpublic readonly host: Element;\n\tpublic readonly element: Element;\n\tpublic readonly bindings: ReactiveBindings<Bindings>;\n\tpublic readonly $: ReactiveBindings<Bindings>;\n\n\tprivate readonly reactiveHost: ReactiveHost<this, Bindings>;\n\tprivate connected = false;\n\tprivate isRendering = false;\n\tprivate isRenderScheduled = false;\n\tprivate needsRender = false;\n\tprivate renderSignal?: Computed<JsxRenderable>;\n\tprivate readonly renderWatcher = new subtle.Watcher(() => {\n\t\tthis.requestUpdate();\n\t});\n\n\tconstructor(host: Element) {\n\t\tthis.host = host;\n\t\tthis.element = host;\n\t\tthis.reactiveHost = new ReactiveHost<this, Bindings>(\n\t\t\tthis,\n\t\t\t{\n\t\t\t\tdefineProperty: (target, property, descriptor) => Object.defineProperty(target, property, descriptor),\n\t\t\t\thasProperty: (target, property) => property in target,\n\t\t\t\treadProperty: (target, property) => (target as Record<string, unknown>)[property],\n\t\t\t},\n\t\t\t() => this.shouldAutoBindReactiveMembers(),\n\t\t);\n\t\tthis.bindings = this.reactiveHost.bindings;\n\t\tthis.$ = this.reactiveHost.$;\n\t\trunLegacyInstanceInitializers(this);\n\t}\n\n\t/**\n\t * Connects the controller to its host and starts reactive subscriptions.\n\t *\n\t * If the controller owns a render lifecycle by overriding `render()`, the\n\t * first update runs immediately after connection.\n\t */\n\tpublic connect(): void {\n\t\tthis.connected = true;\n\t\tthis.reactiveHost.connectHost();\n\n\t\tif (this.shouldRunRenderLifecycle()) {\n\t\t\tthis.update();\n\t\t}\n\t}\n\n\t/**\n\t * Connects the controller for server-side rendering without running the\n\t * browser render/update lifecycle.\n\t */\n\tpublic connectForSsrRender(): void {\n\t\tthis.connected = true;\n\t\tthis.reactiveHost.connectHost();\n\t}\n\n\t/**\n\t * Disconnects the controller from its host and tears down reactive work.\n\t */\n\tpublic disconnect(): void {\n\t\tthis.connected = false;\n\t\tthis.disconnectRenderWatcher();\n\t\tthis.reactiveHost.disconnectHost();\n\t}\n\n\t/**\n\t * Disconnects a controller that was attached through the SSR-only lifecycle.\n\t */\n\tpublic disconnectForSsrRender(): void {\n\t\tthis.disconnectRenderWatcher();\n\t\tthis.reactiveHost.disconnectHost();\n\t\tthis.connected = false;\n\t}\n\n\tpublic get isConnected(): boolean {\n\t\treturn this.connected;\n\t}\n\n\t/**\n\t * Returns the JSX tree rendered into the attached host.\n\t *\n\t * The base implementation renders nothing. Override this method when the\n\t * controller should own the host's inner DOM instead of only enhancing\n\t * authored markup.\n\t */\n\tpublic render(): JsxRenderable {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Schedules a render pass for render-owning controllers.\n\t *\n\t * Multiple calls in the same microtask are coalesced into a single update.\n\t */\n\tpublic requestUpdate(): void {\n\t\tif (!this.shouldRunRenderLifecycle()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.needsRender = true;\n\n\t\tif (this.isRenderScheduled) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.isRenderScheduled = true;\n\n\t\tqueueMicrotask(() => {\n\t\t\tthis.isRenderScheduled = false;\n\n\t\t\tif (!this.needsRender) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.update();\n\t\t});\n\t}\n\n\t/**\n\t * Flushes the current render output into the attached host element.\n\t *\n\t * This is a no-op unless the controller overrides `render()`.\n\t */\n\tpublic update(): void {\n\t\tif (!this.shouldRunRenderLifecycle()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst renderTarget = this.getRenderTarget();\n\n\t\tif (!renderTarget) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.needsRender = true;\n\n\t\tif (!this.connected || this.isRendering) {\n\t\t\treturn;\n\t\t}\n\n\t\twhile (this.needsRender) {\n\t\t\tthis.needsRender = false;\n\t\t\tthis.isRendering = true;\n\n\t\t\ttry {\n\t\t\t\trenderJsx(this.resolveTrackedRenderOutput(), renderTarget);\n\t\t\t} finally {\n\t\t\t\tthis.isRendering = false;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns a subscribable JSX binding for a selected reactive member.\n\t */\n\tpublic bind<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\treturn this.reactiveHost.bind(property);\n\t}\n\n\t/**\n\t * Returns the cached binding object for a selected reactive member.\n\t */\n\tpublic getReactiveBinding<Property extends StringPropertyKey<Bindings>>(\n\t\tproperty: Property,\n\t): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>> {\n\t\treturn this.reactiveHost.getReactiveBinding(property);\n\t}\n\n\t/**\n\t * Defines a reactive field directly on the controller instance.\n\t */\n\tpublic createReactiveField<T>(propertyName: string, initialValue: T, options: ReactiveFieldOptions = {}): void {\n\t\tthis.reactiveHost.createReactiveField(propertyName, initialValue, options);\n\t}\n\n\t/**\n\t * Defines a controller prop backed by the attached host element's property\n\t * channel instead of attribute serialization.\n\t *\n\t * This gives controller-based integrations the same reactive field surface as\n\t * `@prop(...)` on `RadiantElement`, while allowing external code to assign\n\t * structured values such as arrays or objects directly on `controller.host`.\n\t */\n\tpublic createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void {\n\t\tconst { type, defaultValue, bind } = options;\n\n\t\tif (defaultValue !== undefined && !isValueOfType(type, defaultValue)) {\n\t\t\tthrow new Error(`defaultValue does not match the expected type for ${type.name}`);\n\t\t}\n\n\t\tconst ownDescriptor = Object.getOwnPropertyDescriptor(this.host, propertyName);\n\t\tconst hostRecord = this.host as unknown as Record<PropertyKey, unknown>;\n\t\tconst initialHostValue = hostRecord[propertyName] as T | undefined;\n\t\tlet currentValue = (initialHostValue ?? defaultValue ?? defaultValueForType(type)) as T;\n\n\t\tthis.reactiveHost.defineReactiveAccessor(propertyName, {\n\t\t\tbind,\n\t\t\tgetValue: () => currentValue,\n\t\t\tsetValue: (newValue: T) => {\n\t\t\t\tcurrentValue = newValue;\n\t\t\t},\n\t\t\tnotifyInitialValue: currentValue,\n\t\t});\n\n\t\tObject.defineProperty(this.host, propertyName, {\n\t\t\tget: () => (this as Record<PropertyKey, unknown>)[propertyName],\n\t\t\tset: (newValue: T) => {\n\t\t\t\t(this as Record<PropertyKey, unknown>)[propertyName] = newValue;\n\t\t\t},\n\t\t\tenumerable: ownDescriptor?.enumerable ?? true,\n\t\t\tconfigurable: true,\n\t\t});\n\n\t\tthis.registerCleanupCallback(() => {\n\t\t\tconst finalValue = (this as Record<PropertyKey, unknown>)[propertyName];\n\n\t\t\tif (ownDescriptor) {\n\t\t\t\tObject.defineProperty(this.host, propertyName, ownDescriptor);\n\n\t\t\t\tif ('value' in ownDescriptor && ownDescriptor.writable) {\n\t\t\t\t\thostRecord[propertyName] = finalValue;\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdelete hostRecord[propertyName];\n\n\t\t\ttry {\n\t\t\t\thostRecord[propertyName] = finalValue;\n\t\t\t} catch {\n\t\t\t\tObject.defineProperty(this.host, propertyName, {\n\t\t\t\t\tvalue: finalValue,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Defines a JSX binding companion such as `$count` for a reactive member.\n\t */\n\tpublic defineReactiveBinding(property: string, bind: ReactiveBindingOption = true): void {\n\t\tthis.reactiveHost.defineReactiveBinding(property, bind);\n\t}\n\n\tpublic notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void {\n\t\tthis.reactiveHost.notifyUpdate(changedProperty, oldValue, value);\n\t}\n\n\tpublic registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void {\n\t\treturn this.reactiveHost.registerUpdateCallback(property, update);\n\t}\n\n\tpublic connectedContextCallback(_contextName: UnknownContext): void {}\n\n\tpublic registerContextProvider(_name: string, _provider: unknown): void {\n\t\t// Controller context support is currently client-only.\n\t}\n\n\tpublic registerHydrationBinding(_name: string, _binding: SsrSerializableHydrationBinding): void {}\n\n\tpublic registerCleanupCallback(callback: () => void): void {\n\t\tthis.reactiveHost.registerCleanupCallback(callback);\n\t}\n\n\tpublic registerConnectedCallback(callback: () => void): void {\n\t\tthis.reactiveHost.registerConnectedCallback(callback);\n\t}\n\n\tpublic registerReactiveDependencyReader(property: string, read: () => unknown): void {\n\t\tthis.reactiveHost.registerReactiveDependencyReader(property, read);\n\t}\n\n\tpublic trackReactiveRead(property: string): void {\n\t\tthis.reactiveHost.trackReactiveRead(property);\n\t}\n\n\tpublic addEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void {\n\t\tthis.host.addEventListener(type, listener, options);\n\t}\n\n\tpublic removeEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | EventListenerOptions,\n\t): void {\n\t\tthis.host.removeEventListener(type, listener, options);\n\t}\n\n\tpublic dispatchEvent(event: Event): boolean {\n\t\treturn this.host.dispatchEvent(event);\n\t}\n\n\t/**\n\t * Finds one or more elements inside the attached host by `data-ref`.\n\t *\n\t * Prefer `@query(...)` for stable, decorator-backed refs and use `getRef(...)`\n\t * for one-off lookups.\n\t */\n\tpublic getRef<T extends Element = Element>(ref: string, all: true): T[];\n\tpublic getRef<T extends Element = Element>(ref: string, all?: false): T | null;\n\tpublic getRef<T extends Element = Element>(ref: string, all = false): T | T[] | null {\n\t\tconst selector = `[data-ref=\"${ref}\"]`;\n\n\t\tif (all) {\n\t\t\treturn Array.from(this.host.querySelectorAll(selector)) as T[];\n\t\t}\n\n\t\treturn (this.host.querySelector(selector) as T) ?? null;\n\t}\n\n\tprotected shouldAutoBindReactiveMembers(): boolean {\n\t\treturn true;\n\t}\n\n\tprotected shouldRunRenderLifecycle(): boolean {\n\t\treturn this.render !== RadiantController.prototype.render;\n\t}\n\n\tprivate getRenderTarget(): HTMLElement | null {\n\t\treturn this.host instanceof HTMLElement ? this.host : null;\n\t}\n\n\tprivate disconnectRenderWatcher(): void {\n\t\tif (!this.renderSignal) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.renderWatcher.unwatch(this.renderSignal);\n\t\tthis.renderSignal = undefined;\n\t}\n\n\tprivate resolveTrackedRenderOutput(): JsxRenderable {\n\t\tconst nextRenderSignal = new Computed(() => this.render());\n\t\tconst output = nextRenderSignal.get();\n\n\t\tif (!this.connected) {\n\t\t\treturn output;\n\t\t}\n\n\t\tif (this.renderSignal) {\n\t\t\tthis.renderWatcher.unwatch(this.renderSignal);\n\t\t}\n\n\t\tthis.renderSignal = nextRenderSignal;\n\t\tthis.renderWatcher.watch(nextRenderSignal);\n\t\treturn output;\n\t}\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": "2PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAQzF,SAAS,CAAmD,CAClE,EACA,EACO,CAEP,IAAM,EADS,EACgB,GAE/B,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAO,EAA8B,CAC1D,MAAO,CAAC,CAAW,EACnB,aAAc,EACf,CAAC,EASK,SAAS,CAA+C,CAAC,EAAmB,CAClF,IAAM,EAAuB,CAAC,EAC1B,EAAmB,OAAO,eAAe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BAAuB,EAAS,CACvC,GAAI,CAAC,KAAK,aACT,OAGD,KAAK,cAAc,QAAQ,KAAK,YAAY,EAC5C,KAAK,aAAe,OAGb,0BAA0B,EAAkB,CACnD,IAAM,EAAmB,IAAI,EAAS,IAAM,KAAK,OAAO,CAAC,EACnD,EAAS,EAAiB,IAAI,EAEpC,GAAI,CAAC,KAAK,UACT,OAAO,EAGR,GAAI,KAAK,aACR,KAAK,cAAc,QAAQ,KAAK,YAAY,EAK7C,OAFA,KAAK,aAAe,EACpB,KAAK,cAAc,MAAM,CAAgB,EAClC,EAET",
|
|
11
|
+
"debugId": "479ACC6352CE9BFB64756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { EventEmitter } from '../tools';
|
|
2
2
|
import { type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';
|
|
3
|
+
import type { RenderToStringOptions } from '@ecopages/jsx/server';
|
|
3
4
|
import type { SsrSerializableContextProvider } from '../context/context-provider';
|
|
4
5
|
import type { UnknownContext } from '../context/types';
|
|
5
6
|
import type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';
|
|
7
|
+
import { type RadiantElementRenderBridge } from './radiant-component-ssr-registry';
|
|
6
8
|
import { type AttributeTypeConstant, type ReadAttributeValueReturnType, type WriteAttributeValueReturnType } from '../utils/attribute-utils';
|
|
7
9
|
declare const RadiantElementBase: {
|
|
8
10
|
new (): HTMLElement;
|
|
9
11
|
prototype: HTMLElement;
|
|
10
12
|
};
|
|
11
|
-
type ReactiveDependencyReader = () => unknown;
|
|
12
13
|
/**
|
|
13
14
|
* Possible positions to insert a rendered template.
|
|
14
15
|
*/
|
|
@@ -227,28 +228,11 @@ export interface IRadiantElement<Bindings extends object = {}> {
|
|
|
227
228
|
export declare class RadiantElement<Bindings extends object = {}> extends RadiantElementBase implements IRadiantElement<Bindings> {
|
|
228
229
|
readonly bindings: ReactiveBindings<Bindings>;
|
|
229
230
|
readonly $: ReactiveBindings<Bindings>;
|
|
231
|
+
private readonly reactiveHost;
|
|
230
232
|
/**
|
|
231
233
|
* A map of property metadata objects, it contains useful information about the properties configured via decorators.
|
|
232
234
|
*/
|
|
233
235
|
private reactiveProperties;
|
|
234
|
-
/**
|
|
235
|
-
* A map of reactive fields, it contains the reactive fields configured via decorators.
|
|
236
|
-
*/
|
|
237
|
-
private reactiveFields;
|
|
238
|
-
/**
|
|
239
|
-
* Stable dependency nodes used when plain reactive member reads participate
|
|
240
|
-
* in tracked component renders.
|
|
241
|
-
*/
|
|
242
|
-
private reactiveDependencies;
|
|
243
|
-
/**
|
|
244
|
-
* Raw value readers for reactive members whose public getter should also
|
|
245
|
-
* register tracked render dependencies.
|
|
246
|
-
*/
|
|
247
|
-
private reactiveDependencyReaders;
|
|
248
|
-
/**
|
|
249
|
-
* Stable subscribable JSX bindings keyed by reactive property name.
|
|
250
|
-
*/
|
|
251
|
-
private reactiveBindings;
|
|
252
236
|
/**
|
|
253
237
|
* Registered context providers keyed by decorated property name.
|
|
254
238
|
*/
|
|
@@ -257,10 +241,6 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
|
|
|
257
241
|
* Registered keyed hydration payload producers appended to SSR host output.
|
|
258
242
|
*/
|
|
259
243
|
private hydrationBindings;
|
|
260
|
-
/**
|
|
261
|
-
* A map of property update callbacks. These callbacks are called when a property is updated.
|
|
262
|
-
*/
|
|
263
|
-
private updateCallbacks;
|
|
264
244
|
/**
|
|
265
245
|
* A map of event subscriptions used to manage event listeners on the Radiant element.
|
|
266
246
|
*/
|
|
@@ -269,20 +249,20 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
|
|
|
269
249
|
* A map for event emitters
|
|
270
250
|
*/
|
|
271
251
|
private eventEmitters;
|
|
272
|
-
/**
|
|
273
|
-
* Callbacks executed whenever the Radiant element is connected to the DOM.
|
|
274
|
-
*/
|
|
275
|
-
private onConnectedCallbacks;
|
|
276
|
-
/**
|
|
277
|
-
* An array of cleanup callbacks to be executed when the Radiant element is disconnected from the DOM.
|
|
278
|
-
*/
|
|
279
|
-
private onDisconnectedCallback;
|
|
280
252
|
/**
|
|
281
253
|
* A flag indicating whether the element has been connected to the DOM.
|
|
282
254
|
*/
|
|
283
255
|
private elementReady;
|
|
256
|
+
private isRendering;
|
|
257
|
+
private isFirstConnectPending;
|
|
258
|
+
private isRenderScheduled;
|
|
259
|
+
private needsRender;
|
|
260
|
+
private projectedSlotContent;
|
|
261
|
+
private renderSignal?;
|
|
262
|
+
private readonly renderWatcher;
|
|
263
|
+
private slotProjectionObserver?;
|
|
264
|
+
private slotProjectionVersion;
|
|
284
265
|
constructor();
|
|
285
|
-
private createReactiveBindingNamespace;
|
|
286
266
|
connectedCallback(): void;
|
|
287
267
|
connectedContextCallback(_contextName: UnknownContext): void;
|
|
288
268
|
disconnectedCallback(): void;
|
|
@@ -303,10 +283,16 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
|
|
|
303
283
|
insert?: RenderInsertPosition;
|
|
304
284
|
sanitize?: (html: string) => string;
|
|
305
285
|
}): void;
|
|
286
|
+
render(): JsxRenderable;
|
|
287
|
+
renderToString(options?: RenderToStringOptions): string;
|
|
288
|
+
renderHost(): JsxRenderable;
|
|
289
|
+
renderHostToString(options?: RenderToStringOptions): string;
|
|
290
|
+
hydrate(): void;
|
|
291
|
+
requestUpdate(): void;
|
|
292
|
+
update(): void;
|
|
306
293
|
registerReactiveProperty(config: ReactiveProperty): void;
|
|
307
294
|
protected getReactiveProperties(): ReactiveProperty[];
|
|
308
|
-
|
|
309
|
-
registerReactiveDependencyReader(property: string, read: ReactiveDependencyReader): void;
|
|
295
|
+
registerReactiveDependencyReader(property: string, read: () => unknown): void;
|
|
310
296
|
registerContextProvider(name: string, provider: SsrSerializableContextProvider): void;
|
|
311
297
|
registerHydrationBinding(name: string, binding: SsrSerializableHydrationBinding): void;
|
|
312
298
|
protected getContextProviders(): SsrSerializableContextProvider[];
|
|
@@ -322,20 +308,22 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
|
|
|
322
308
|
/**
|
|
323
309
|
* Returns the default JSX binding policy for reactive members on this host.
|
|
324
310
|
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
311
|
+
* `RadiantElement` hosts default to automatic bindings for reactive members
|
|
312
|
+
* when no explicit `bind` option is supplied.
|
|
313
|
+
*
|
|
314
|
+
* Lower-level hosts can override this hook to opt out when they want binding
|
|
315
|
+
* creation to stay fully explicit across `@prop`, `@state`, and direct
|
|
316
|
+
* `createReactiveProp`/`createReactiveField` calls.
|
|
329
317
|
*/
|
|
330
318
|
protected shouldAutoBindReactiveMembers(): boolean;
|
|
319
|
+
protected shouldRunRenderLifecycle(): boolean;
|
|
320
|
+
protected getHostSsrAttributes(): Record<string, string>;
|
|
321
|
+
protected resolveSsrRenderBridge(): RadiantElementRenderBridge;
|
|
331
322
|
registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void;
|
|
332
323
|
getReactiveBinding<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
|
|
333
324
|
bind<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
|
|
334
325
|
defineReactiveBinding(property: string, bind?: ReactiveBindingOption): void;
|
|
335
|
-
private getReactiveDependency;
|
|
336
326
|
trackReactiveRead(property: string): void;
|
|
337
|
-
private readReactiveDependencyValue;
|
|
338
|
-
private readReactiveBindingValue;
|
|
339
327
|
subscribeEvents(events: RadiantElementEventListener[]): Array<() => void>;
|
|
340
328
|
subscribeEvent(eventConfig: RadiantElementEventListener): () => void;
|
|
341
329
|
private unsubscribeEvent;
|
|
@@ -355,7 +343,21 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
|
|
|
355
343
|
registerEventEmitter(name: string, emitter: EventEmitter): void;
|
|
356
344
|
getRef<T extends Element = Element>(ref: string, all: true): T[];
|
|
357
345
|
getRef<T extends Element = Element>(ref: string, all?: false): T | null;
|
|
346
|
+
getSlotElement<T extends Element = Element>(name?: string): T | null;
|
|
347
|
+
getSlotElements<T extends Element = Element>(name?: string): T[];
|
|
358
348
|
createReactiveField<T>(propertyName: string, initialValue: T, options?: ReactiveFieldOptions): void;
|
|
359
349
|
createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void;
|
|
350
|
+
private ensureSlotProjectionState;
|
|
351
|
+
private getHostChildNodeCount;
|
|
352
|
+
private getSlotProjectionScriptTag;
|
|
353
|
+
private getAuthoredHydrationScriptMarkup;
|
|
354
|
+
private handleSlotProjectionMutations;
|
|
355
|
+
private addProjectedSlotNode;
|
|
356
|
+
private removeProjectedSlotNode;
|
|
357
|
+
private observeSlotProjection;
|
|
358
|
+
private disconnectSlotProjectionObserver;
|
|
359
|
+
private disconnectRenderWatcher;
|
|
360
|
+
private resolveTrackedRenderOutput;
|
|
361
|
+
private resolveRenderOutput;
|
|
360
362
|
}
|
|
361
363
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Y as a}from"../chunk-gdkte2vd.js";import"../chunk-eyw14d6y.js";import"../chunk-cnyxrh9r.js";import"../chunk-66e6s792.js";import"../chunk-vgtggzb6.js";export{a as RadiantElement};
|
|
1
|
+
var S0=((Q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(Q,{get:($,W)=>(typeof require<"u"?require:$)[W]}):Q)(function(Q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+Q+'" is not supported')});var x=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function h0(Q,$){let X=Q[x];if(Array.isArray(X)){X.push($);return}Object.defineProperty(Q,x,{value:[$],configurable:!0})}function k(Q){let $=[],W=Object.getPrototypeOf(Q);while(W&&W!==Object.prototype)$.push(W),W=Object.getPrototypeOf(W);for(let X=$.length-1;X>=0;X-=1){let q=$[X][x];if(!Array.isArray(q))continue;for(let Z of q)Z(Q)}}import{createSubscribableJsxValue as Q0}from"@ecopages/jsx";import{trackDependency as _}from"@ecopages/signals";class C{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(Q){this.read=Q}get(){return _(this),this.read()}subscribe(Q){return this.subscribers.add(Q),()=>{this.subscribers.delete(Q)}}addWatcher(Q){return this.watcherListeners.add(Q),()=>{this.watcherListeners.delete(Q)}}getVersion(){return this.version}notify(Q){this.version+=1;let $;try{this.notifyWatchers()}catch(W){$=W}if(this.publish(Q),$)throw $}publish(Q){for(let $ of this.subscribers)$(Q)}notifyWatchers(){let Q=[];for(let $ of this.watcherListeners)try{$()}catch(W){Q.push(W)}if(Q.length===1)throw Q[0];if(Q.length>1)throw AggregateError(Q,"Multiple reactive dependency notifications failed.")}}function $0(Q){return typeof Q==="object"&&Q!==null&&typeof Q.get==="function"}class D{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(Q,$,W){this.host=Q;this.access=$;this.shouldAutoBind=W;let X=this.createReactiveBindingNamespace();this.bindings=X,this.$=X}connectHost(){for(let Q of this.onConnectedCallbacks)Q()}disconnectHost(){for(let Q of this.onDisconnectedCallback)Q()}notifyUpdate(Q,$,W){if($===W)return;this.reactiveDependencies.get(Q)?.notify(W);let X=this.updateCallbacks.get(Q);if(X)for(let q of X)q()}registerCleanupCallback(Q){this.onDisconnectedCallback.push(Q)}registerConnectedCallback(Q){this.onConnectedCallbacks.push(Q)}registerHydrationBinding(Q,$){}registerReactiveDependencyReader(Q,$){this.reactiveDependencyReaders.set(Q,$)}registerUpdateCallback(Q,$){if(!this.updateCallbacks.has(Q))this.updateCallbacks.set(Q,new Set);let W=this.updateCallbacks.get(Q);return W.add($),()=>{if(W.delete($),W.size===0)this.updateCallbacks.delete(Q)}}getReactiveBinding(Q){let $=this.reactiveBindings.get(Q);if($)return $;let W=Q0({getValue:()=>this.readReactiveBindingValue(Q),subscribe:(X)=>this.registerUpdateCallback(Q,()=>{X(this.readReactiveBindingValue(Q))})});return this.reactiveBindings.set(Q,W),W}bind(Q){return this.getReactiveBinding(Q)}defineReactiveBinding(Q,$=!0){let W=typeof $==="string"?$:$?`$${Q}`:void 0,X=this.access.getBindingTarget?.(this.host)??this.host;if(!W||this.access.hasProperty(this.host,W))return;this.access.defineProperty(X,W,{get:()=>this.getReactiveBinding(Q),enumerable:!1,configurable:!0})}trackReactiveRead(Q){_(this.getReactiveDependency(Q))}defineReactiveAccessor(Q,$){let W=$.bind??this.shouldAutoBind();if(this.defineReactiveBinding(Q,W),this.registerReactiveDependencyReader(Q,$.getValue),this.access.defineProperty(this.host,Q,{get:()=>{return this.trackReactiveRead(Q),$.getValue()},set:(X)=>{let q=$.getValue();if(q===X)return;$.setValue(X),this.notifyUpdate(Q,q,X)},enumerable:!0,configurable:!0}),$.notifyInitialValue!==void 0)this.notifyUpdate(Q,void 0,$.notifyInitialValue)}createReactiveField(Q,$,W={}){let X={name:Q,value:$,initialValue:$};this.reactiveFields.set(Q,X),this.defineReactiveAccessor(Q,{bind:W.bind,getValue:()=>this.reactiveFields.get(Q)?.value,setValue:(q)=>{this.reactiveFields.set(Q,{...X,value:q})},notifyInitialValue:$})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(Q,$)=>{if(typeof $!=="string")return;return this.getReactiveBinding($)}})}getReactiveDependency(Q){let $=this.reactiveDependencies.get(Q);if($)return $;let W=new C(()=>this.readReactiveDependencyValue(Q));return this.reactiveDependencies.set(Q,W),W}readReactiveDependencyValue(Q){let $=this.reactiveDependencyReaders.get(Q);if($)return $();return this.readReactiveBindingValue(Q)}readReactiveBindingValue(Q){let $=this.access.readProperty(this.host,Q);if($0($))return $.get();return $}}var w=Symbol(),I=Symbol();function V0(Q,$){let X=Q[w];if(Array.isArray(X)){X.push($);return}Object.defineProperty(Q,w,{value:[$],configurable:!0})}function A(Q){let $=Q,W=$[w];if(!Array.isArray(W))return;$[I]=!0;try{for(let X of W)X()}finally{delete $[I]}}function S(Q){return Q.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var U="data-hydration",h="data-hydration-type",L="data-hydration-key";function c0(Q){let $=Q.hydrationKey?` ${L}="${W0(Q.hydrationKey)}"`:"";return`<script type="application/json" ${U} ${h}="${Q.type}"${$}>${Q.serializedValue}</script>`}function y0(Q){return S(Q)}function s0(Q,$){let W=Q.textContent;if(!W)return $;try{return JSON.parse(W)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${U}>:`,W.slice(0,120));return $}}function u0(Q,$,W){let X=Q.children;if(!X||X.length===0){let q=Q.childNodes;if(!q||q.length===0)return null;for(let Z=0;Z<q.length;Z+=1){let G=q[Z];if(G.nodeType!==1)continue;let F=G;if(R(F,$,W))return F}return null}for(let q=0;q<X.length;q+=1)if(R(X[q],$,W))return X[q];return null}function R(Q,$,W){if(Q.tagName!=="SCRIPT"||!Q.hasAttribute(U)||Q.getAttribute(h)!==$)return!1;if(W!==void 0)return Q.getAttribute(L)===W;return!Q.hasAttribute(L)}function W0(Q){return Q.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{createMarkupNodeLike as X0,isKeyedJsxValue as T,isSlotJsxValue as q0}from"@ecopages/jsx";var M="",B="data-radiant-slot-projection";function f(Q){let $=new Map;for(let W of Array.from(Q.childNodes)){if(F0(W))continue;Z0($,J0(W),W)}return $}function g(Q){let $;try{$=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 W=new Map;for(let[X,q]of Object.entries($)){if(!Array.isArray(q)||q.length===0)continue;W.set(O(X),q.map((Z)=>X0(Z)))}return W}function N(Q){let $=Array.from(Q.childNodes).filter((W)=>y(W)).map((W)=>z(W)??"").filter((W)=>W!=="");return $.length>0?$.join(""):void 0}function V(Q){let $={};for(let[W,X]of Q.entries()){let q=X.map((Z)=>z(Z)).filter((Z)=>Z!==void 0&&Z!=="");if(q.length>0)$[W]=q}return Object.keys($).length>0?JSON.stringify($):void 0}function m(Q,$){let W=!1,X=(Z)=>{if(q0(Z))return W=!0,M0(Z,$,X);if(T(Z))return G0(Z,X(Z.value));if(U0(Z))return{_$rType$:1,rootLocalName:Z.rootLocalName,strings:Z.strings,values:Z.values.map((G)=>X(G))};if(b(Z))return Array.from(Z,(G)=>X(G));return Z},q=X(Q);return{containsSlots:W,value:q}}function v(Q){for(let $ of Array.from(Q.childNodes)){if(!c($))continue;let W=$.textContent??void 0;return $.parentNode?.removeChild($),W}return}function Z0(Q,$,W){let X=Q.get($);if(X){X.push(W);return}Q.set($,[W])}function G0(Q,$){return{...Q,value:$}}function J0(Q){if(Q instanceof Element)return O(Q.getAttribute("slot"));return M}function b(Q){return typeof Q!=="string"&&typeof Q==="object"&&Q!==null&&Symbol.iterator in Q}function c(Q){return Q instanceof HTMLScriptElement&&Q.hasAttribute(B)}function y(Q){return Q instanceof HTMLScriptElement&&Q.hasAttribute(U)}function F0(Q){return c(Q)||y(Q)}function U0(Q){return typeof Q==="object"&&Q!==null&&Q._$rType$===1&&Array.isArray(Q.strings)&&Array.isArray(Q.values)}function O(Q){return Q??M}function z(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(T(Q))return z(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(b(Q))return Array.from(Q,($)=>z($)??"").join("");return}function M0(Q,$,W){let X=$.get(O(Q.name));if(X&&X.length>0)return X.length===1?X[0]:X;if(Q.fallback===void 0)return"";return W(Q.fallback)}var P=Symbol.for("@ecopages/radiant.hydrator-installed");function l0(){globalThis[P]=!0}function n0(){delete globalThis[P]}function s(){return globalThis[P]===!0}var u=Symbol.for("@ecopages/radiant.component-ssr-runtime");function d(){return globalThis[u]}function r0(Q){globalThis[u]=Q}function o(Q){switch(Q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function z0(Q){switch(typeof Q){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(Q))return"array";if(Object.prototype.toString.call(Q)==="[object Object]")return"object"}function B0(Q){switch(Q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function H0(Q){try{return JSON.parse(Q)}catch{throw TypeError("Invalid JSON string")}}var Y0={array(Q){let $=H0(Q);if(!Array.isArray($))throw TypeError(`Expected an array but got a value of type "${typeof $}"`);return $},boolean(Q){return!(Q==="0"||String(Q).toLowerCase()==="false")},number(Q){return Number(Q.replace(/_/g,""))},object(Q){let $=JSON.parse(Q);if($===null||typeof $!=="object"||Array.isArray($))throw TypeError(`expected value of type "object" but instead got value "${Q}" of type "${z0($)}"`);return $},string(Q){return Q}},p={default:l,array:i,object:i};function i(Q){return JSON.stringify(Q)}function l(Q){return`${Q}`}function H(Q,$){let W=o($);if(!W)throw TypeError(`[radiant-element] Unknown type "${$}"`);return Y0[W](Q)}function n(Q,$){let W=o($);if(!W)throw TypeError(`[radiant-element] Unknown type "${$}"`);return(p[W]??p.default??l)(Q)}function K0(Q){return typeof Q==="boolean"}function j0(Q){return typeof Q==="number"}function x0(Q){return typeof Q==="string"}function D0(Q){return Array.isArray(Q)}function w0(Q){return typeof Q==="object"&&!Array.isArray(Q)&&Q!==null}function a(Q,$){switch(Q){case Boolean:return K0($);case Number:return j0($);case String:return x0($);case Array:return D0($);case Object:return w0($);default:return!1}}var r=(Q,$,W,X)=>{if($===Boolean){let Z=Q.getAttribute(W);if(Z===null)return X;return Z===""?!0:H(Z,$)}let q=Q.getAttribute(W);return q!==null?H(q,$):X??B0($)};import{hasHydrationMarkers as L0,hydrate as O0,jsx as P0,render as E0}from"@ecopages/jsx";import{Computed as k0,subtle as _0}from"@ecopages/signals";var C0=I0();function I0(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class K extends C0{bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;projectedSlotContent=new Map;renderSignal;renderWatcher=new _0.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();this.reactiveHost=new D(this,{defineProperty:(Q,$,W)=>Object.defineProperty(Q,$,W),getBindingTarget:(Q)=>Object.getPrototypeOf(Q)??Q,hasProperty:(Q,$)=>($ in Q),readProperty:(Q,$)=>Q[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,k(this)}connectedCallback(){let Q=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),Q)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),t(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(Q){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(Q,$,W){this.reactiveHost.notifyUpdate(Q,$,W)}transformAttributeValue(Q,$){return Q!==null?$?.converter.fromAttribute(Q):Q}attributeChangedCallback(Q,$,W){if($===W||!this.elementReady)return;if(this.reactiveProperties.has(Q)){let X=this.reactiveProperties.get(Q),q=this.transformAttributeValue(W,X),Z=this.transformAttributeValue($,X),G=X?X.attribute:Q;this[G]=q,this.notifyUpdate(Q,Z,q)}}renderTemplate({target:Q=this,template:$,insert:W="replace",sanitize:X}){let q=X?X($):$;switch(W){case"replace":Q.innerHTML=q;break;case"beforeend":Q.insertAdjacentHTML("beforeend",q);break;case"afterbegin":Q.insertAdjacentHTML("afterbegin",q);break;case"beforebegin":Q.insertAdjacentHTML("beforebegin",q);break;case"afterend":Q.insertAdjacentHTML("afterend",q);break}}render(){return P0("slot",{})}renderToString(Q={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),Y().renderView(this,Q)}renderHost(){return Y().renderHost(this)}renderHostToString(Q={}){return Y().renderHostToString(this,Q)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;this.isRendering=!0,this.disconnectSlotProjectionObserver();try{O0(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&t(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{E0(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(Q){this.reactiveProperties.set(Q.name,Q)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(Q,$){this.reactiveHost.registerReactiveDependencyReader(Q,$)}registerContextProvider(Q,$){this.contextProviders.set(Q,$),this.registerHydrationBinding(Q,$)}registerHydrationBinding(Q,$){this.hydrationBindings.set(Q,$)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){A(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==K.prototype.render}getHostSsrAttributes(){return Y().getHostAttributes(this)}resolveSsrRenderBridge(){let Q={};if(this.renderHostToString===K.prototype.renderHostToString)Q.renderHostToString=($)=>this.renderHostToString($);if(this.renderHost===K.prototype.renderHost)Q.renderHost=()=>this.renderHost();return Q}registerUpdateCallback(Q,$){return this.reactiveHost.registerUpdateCallback(Q,$)}getReactiveBinding(Q){return this.reactiveHost.getReactiveBinding(Q)}bind(Q){return this.reactiveHost.bind(Q)}defineReactiveBinding(Q,$=!0){this.reactiveHost.defineReactiveBinding(Q,$)}trackReactiveRead(Q){this.reactiveHost.trackReactiveRead(Q)}subscribeEvents(Q){let $=[];for(let W of Q)$.push(this.subscribeEvent(W));return $}subscribeEvent(Q){let $=(X)=>{if(X.target&&X.target.matches(Q.selector))Q.listener.call(this,X)},W=`${Q.type}:${Q.selector}`;return this.addEventListener(Q.type,$,Q.options),this.eventSubscriptions.set(W,{...Q,listener:$}),this.unsubscribeEvent.bind(this,W)}unsubscribeEvent(Q){let $=this.eventSubscriptions.get(Q);if($)this.removeEventListener($.type,$.listener,$.options),this.eventSubscriptions.delete(Q)}removeAllSubscribedEvents(){for(let Q of this.eventSubscriptions.values())this.removeEventListener(Q.type,Q.listener,Q.options);this.eventSubscriptions.clear()}registerCleanupCallback(Q){this.reactiveHost.registerCleanupCallback(Q)}registerConnectedCallback(Q){this.reactiveHost.registerConnectedCallback(Q)}registerEventEmitter(Q,$){this.eventEmitters.set(Q,$)}getRef(Q,$=!1){let W=`[data-ref="${Q}"]`;if($)return Array.from(this.querySelectorAll(W));return this.querySelector(W)??null}getSlotElement(Q){return this.getSlotElements(Q)[0]??null}getSlotElements(Q){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(Q??M)??[]).filter(($)=>typeof Node<"u"&&$ instanceof Element)}createReactiveField(Q,$,W={}){this.reactiveHost.createReactiveField(Q,$,W)}createReactiveProp(Q,$){let{type:W,attribute:X,reflect:q,defaultValue:Z}=$,G=X??Q;if(Z!==void 0&&!a(W,Z))throw Error(`defaultValue does not match the expected type for ${W.name}`);let F=r(this,W,G,Z);if(this.hasAttribute(G)&&(!q||F==null||F===""))this.removeAttribute(G);let j={type:W,name:Q,value:F,initialValue:F,attribute:G,converter:{fromAttribute:(J)=>H(J,W),toAttribute:(J)=>n(J,W)}};this.registerReactiveProperty(j);let E=(J)=>{if(q)if(J==null||J===""||J===!1)this.removeAttribute(G);else{let e=j.converter.toAttribute(J);this.setAttribute(G,e)}};if(this.reactiveHost.defineReactiveAccessor(Q,{bind:$.bind,getValue:()=>this.reactiveProperties.get(Q)?.value,setValue:(J)=>{this.reactiveProperties.set(Q,{...j,value:J}),E(J)}}),F!==void 0)queueMicrotask(()=>{let J=this.reactiveProperties.get(Q)?.value;if(J===void 0)return;E(J),this.notifyUpdate(Q,void 0,J)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let Q=this.isConnected?v(this):void 0;if(typeof Q==="string"&&Q!==""){this.projectedSlotContent=g(Q),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=f(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let Q=V(this.projectedSlotContent);if(!Q)return;return`<script type="application/json" ${B}>${A0(Q)}</script>`}getAuthoredHydrationScriptMarkup(){let Q=N(this);if(Q)return Q;return}handleSlotProjectionMutations(Q){let $=!1;for(let W of Q){for(let X of Array.from(W.removedNodes))if(this.removeProjectedSlotNode(X))$=!0;for(let X of Array.from(W.addedNodes)){if(X.parentNode!==this)continue;if(this.addProjectedSlotNode(X))$=!0}}if($)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(Q){if(Q instanceof HTMLScriptElement&&(Q.hasAttribute(B)||Q.hasAttribute(U)))return!1;let $=Q instanceof Element?Q.getAttribute("slot")??M:M,W=this.projectedSlotContent.get($);if(W){if(W.includes(Q))return!1;return W.push(Q),!0}return this.projectedSlotContent.set($,[Q]),!0}removeProjectedSlotNode(Q){for(let[$,W]of this.projectedSlotContent.entries()){let X=W.indexOf(Q);if(X===-1)continue;if(W.splice(X,1),W.length===0)this.projectedSlotContent.delete($);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((Q)=>this.handleSlotProjectionMutations(Q)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let Q=new k0(()=>this.resolveRenderOutput()),$=Q.get();if(!this.isConnected)return $;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=Q,this.renderWatcher.watch(Q),$}resolveRenderOutput(){return this.ensureSlotProjectionState(),m(this.render(),this.projectedSlotContent)}}function Y(){let Q=d();if(!Q)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return Q}function t(Q){return s()&&L0(Q)}function A0(Q){return Q.replace(/</g,"\\u003c")}export{K as RadiantElement};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=5108B4E581E5B13A64756E2164756E21
|