@ecopages/radiant 0.3.0-alpha.9 → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/client/app-bootstrap.d.ts +19 -0
- package/client/app-bootstrap.js +3 -0
- package/client/app-bootstrap.js.map +10 -0
- package/client/hydrator.js +3 -0
- package/{dist/client → client}/hydrator.js.map +2 -2
- package/client/install-hydrator.js +3 -0
- package/{dist/client → client}/install-hydrator.js.map +2 -2
- package/context/context-consumer-bootstrap.js +3 -0
- package/{dist/context → context}/context-consumer-bootstrap.js.map +4 -4
- package/context/context-consumer-runtime.js +3 -0
- package/context/context-consumer-runtime.js.map +12 -0
- package/context/context-host.js +3 -0
- package/{dist/context → context}/context-host.js.map +2 -2
- package/context/context-provider.js +3 -0
- package/{dist/context → context}/context-provider.js.map +3 -3
- package/context/context-ssr-bridge.js +3 -0
- package/{dist/context → context}/context-ssr-bridge.js.map +2 -2
- package/context/create-context.js +3 -0
- package/{dist/context → context}/create-context.js.map +2 -2
- package/context/decorators/consume-context.js +3 -0
- package/context/decorators/consume-context.js.map +19 -0
- package/context/decorators/context-selection-delivery.js +3 -0
- package/{dist/context → context}/decorators/context-selection-delivery.js.map +2 -2
- package/context/decorators/context-selector.js +3 -0
- package/context/decorators/context-selector.js.map +22 -0
- package/context/decorators/legacy/consume-context.js +3 -0
- package/context/decorators/legacy/consume-context.js.map +16 -0
- package/context/decorators/legacy/context-selector-field.js +3 -0
- package/context/decorators/legacy/context-selector-field.js.map +17 -0
- package/context/decorators/legacy/context-selector.js +3 -0
- package/context/decorators/legacy/context-selector.js.map +17 -0
- package/context/decorators/legacy/provide-context.js +3 -0
- package/{dist/context → context}/decorators/legacy/provide-context.js.map +5 -5
- package/context/decorators/on-context-update.js +3 -0
- package/{dist/context → context}/decorators/on-context-update.js.map +6 -6
- package/context/decorators/provide-context.js +3 -0
- package/{dist/context → context}/decorators/provide-context.js.map +5 -5
- package/context/decorators/standard/consume-context.js +3 -0
- package/{dist/context → context}/decorators/standard/consume-context.js.map +4 -4
- package/context/decorators/standard/context-selector-field.js +3 -0
- package/{dist/context → context}/decorators/standard/context-selector-field.js.map +4 -4
- package/context/decorators/standard/context-selector.js +3 -0
- package/{dist/context → context}/decorators/standard/context-selector.js.map +4 -4
- package/context/decorators/standard/provide-context.js +3 -0
- package/{dist/context → context}/decorators/standard/provide-context.js.map +3 -3
- package/context/decorators/standard-legacy-dispatch.d.ts +6 -0
- package/context/decorators/standard-legacy-dispatch.js +3 -0
- package/context/decorators/standard-legacy-dispatch.js.map +10 -0
- package/context/events.js +3 -0
- package/context/events.js.map +10 -0
- package/context/hydration-script.js +3 -0
- package/{dist/context → context}/hydration-script.js.map +2 -2
- package/context/index.js +3 -0
- package/{dist/context → context}/index.js.map +13 -12
- package/controller-registry.js +3 -0
- package/{dist/controller-registry.js.map → controller-registry.js.map} +2 -2
- package/core/controller-metadata.js +3 -0
- package/{dist/core → core}/controller-metadata.js.map +2 -2
- package/core/custom-element-metadata.js +3 -0
- package/{dist/core → core}/custom-element-metadata.js.map +2 -2
- package/core/event-subscription-registry.d.ts +16 -0
- package/core/event-subscription-registry.js +3 -0
- package/core/event-subscription-registry.js.map +10 -0
- package/core/host-ssr-registry.d.ts +13 -0
- package/core/host-ssr-registry.js +3 -0
- package/core/host-ssr-registry.js.map +10 -0
- package/core/hydration-capable-host.d.ts +8 -0
- package/core/hydration-capable-host.js +3 -0
- package/core/hydration-capable-host.js.map +10 -0
- package/core/hydration-codec.js +3 -0
- package/{dist/core → core}/hydration-codec.js.map +2 -2
- package/{dist/core → core}/radiant-controller.d.ts +42 -20
- package/core/radiant-controller.js +3 -0
- package/core/radiant-controller.js.map +21 -0
- package/{dist/core/radiant-component-ssr.d.ts → core/radiant-element-ssr-host.d.ts} +16 -16
- package/core/radiant-element-ssr-host.js +3 -0
- package/core/radiant-element-ssr-host.js.map +10 -0
- package/core/radiant-element-ssr-registry.d.ts +20 -0
- package/core/radiant-element-ssr-registry.js +3 -0
- package/core/radiant-element-ssr-registry.js.map +10 -0
- package/{dist/core → core}/radiant-element.d.ts +44 -155
- package/core/radiant-element.js +3 -0
- package/core/radiant-element.js.map +31 -0
- package/core/radiant-hydrator-state.js +3 -0
- package/{dist/core → core}/radiant-hydrator-state.js.map +2 -2
- package/core/reactive-binding-adapter.d.ts +10 -0
- package/core/reactive-binding-adapter.js +3 -0
- package/core/reactive-binding-adapter.js.map +10 -0
- package/core/reactive-host.d.ts +138 -0
- package/core/reactive-host.js +3 -0
- package/core/reactive-host.js.map +13 -0
- package/{dist/core → core}/reactive-jsx-value.d.ts +4 -3
- package/core/reactive-jsx-value.js +3 -0
- package/core/reactive-jsx-value.js.map +10 -0
- package/core/reactive-prop-core.d.ts +39 -0
- package/core/reactive-prop-core.js +3 -0
- package/{dist/decorators/standard/reactive-prop.js.map → core/reactive-prop-core.js.map} +4 -5
- package/{dist/core → core}/reactive-prop-metadata.d.ts +1 -1
- package/core/reactive-prop-metadata.js +3 -0
- package/core/reactive-prop-metadata.js.map +10 -0
- package/core/reactive-property-state.d.ts +20 -0
- package/core/reactive-property-state.js +3 -0
- package/core/reactive-property-state.js.map +12 -0
- package/core/reactivity-adapter.d.ts +8 -0
- package/core/reactivity-adapter.js +3 -0
- package/core/reactivity-adapter.js.map +12 -0
- package/core/reactivity-contract.d.ts +53 -0
- package/core/reactivity-contract.js +2 -0
- package/core/reactivity-contract.js.map +9 -0
- package/core/reactivity-runtime.d.ts +18 -0
- package/core/reactivity-runtime.js +3 -0
- package/core/reactivity-runtime.js.map +11 -0
- package/core/reactivity-signals.d.ts +10 -0
- package/core/reactivity-signals.js +3 -0
- package/core/reactivity-signals.js.map +10 -0
- package/core/render-runtime.d.ts +28 -0
- package/core/render-runtime.js +3 -0
- package/core/render-runtime.js.map +16 -0
- package/core/render-scheduler.d.ts +22 -0
- package/core/render-scheduler.js +3 -0
- package/core/render-scheduler.js.map +10 -0
- package/core/slot-projection-runtime.js +3 -0
- package/core/slot-projection-runtime.js.map +12 -0
- package/core/ssr-preparation.js +3 -0
- package/{dist/core → core}/ssr-preparation.js.map +2 -2
- package/decorators/attr.js +3 -0
- package/decorators/attr.js.map +18 -0
- package/decorators/bound.js +3 -0
- package/{dist/decorators → decorators}/bound.js.map +2 -2
- package/decorators/bridge.js +3 -0
- package/{dist/decorators → decorators}/bridge.js.map +2 -2
- package/decorators/controller.js +3 -0
- package/{dist/decorators → decorators}/controller.js.map +2 -2
- package/decorators/custom-element.js +3 -0
- package/{dist/decorators → decorators}/custom-element.js.map +2 -2
- package/decorators/debounce.js +3 -0
- package/{dist/decorators → decorators}/debounce.js.map +2 -2
- package/decorators/event.js +3 -0
- package/{dist/decorators → decorators}/event.js.map +3 -3
- package/decorators/legacy/attr.js +3 -0
- package/decorators/legacy/attr.js.map +15 -0
- package/decorators/legacy/bound.js +3 -0
- package/{dist/decorators → decorators}/legacy/bound.js.map +2 -2
- package/decorators/legacy/custom-element.js +3 -0
- package/{dist/decorators → decorators}/legacy/custom-element.js.map +2 -2
- package/decorators/legacy/debounce.js +3 -0
- package/{dist/decorators → decorators}/legacy/debounce.js.map +2 -2
- package/decorators/legacy/event.js +3 -0
- package/decorators/legacy/event.js.map +13 -0
- package/decorators/legacy/host-readiness.d.ts +8 -0
- package/decorators/legacy/host-readiness.js +3 -0
- package/decorators/legacy/host-readiness.js.map +11 -0
- package/decorators/legacy/instance-initializers.d.ts +34 -0
- package/decorators/legacy/instance-initializers.js +3 -0
- package/decorators/legacy/instance-initializers.js.map +10 -0
- package/decorators/legacy/member-bootstrap.d.ts +10 -0
- package/decorators/legacy/member-bootstrap.js +3 -0
- package/decorators/legacy/member-bootstrap.js.map +10 -0
- package/decorators/legacy/on-event.js +3 -0
- package/decorators/legacy/on-event.js.map +13 -0
- package/{dist/decorators → decorators}/legacy/on-updated.d.ts +1 -1
- package/decorators/legacy/on-updated.js +3 -0
- package/decorators/legacy/on-updated.js.map +11 -0
- package/decorators/legacy/query-slot.js +3 -0
- package/decorators/legacy/query-slot.js.map +13 -0
- package/decorators/legacy/query.js +3 -0
- package/decorators/legacy/query.js.map +12 -0
- package/decorators/legacy/reactive-field.js +3 -0
- package/decorators/legacy/reactive-field.js.map +13 -0
- package/{dist/decorators → decorators}/legacy/reactive-prop.d.ts +1 -2
- package/decorators/legacy/reactive-prop.js +3 -0
- package/decorators/legacy/reactive-prop.js.map +15 -0
- package/{dist/decorators → decorators}/legacy/signal.d.ts +1 -1
- package/decorators/legacy/signal.js +3 -0
- package/decorators/legacy/signal.js.map +17 -0
- package/decorators/on-event.js +3 -0
- package/{dist/decorators → decorators}/on-event.js.map +4 -4
- package/decorators/on-updated.js +3 -0
- package/decorators/on-updated.js.map +14 -0
- package/{dist/decorators → decorators}/prop.d.ts +5 -6
- package/decorators/prop.js +3 -0
- package/decorators/prop.js.map +18 -0
- package/decorators/query-slot.js +3 -0
- package/decorators/query-slot.js.map +16 -0
- package/decorators/query.js +3 -0
- package/{dist/decorators → decorators}/query.js.map +3 -3
- package/decorators/shared/auto-bind.d.ts +7 -0
- package/decorators/shared/auto-bind.js +3 -0
- package/decorators/shared/auto-bind.js.map +10 -0
- package/{dist/decorators → decorators}/shared/reactive-attr.d.ts +1 -1
- package/decorators/shared/reactive-attr.js +3 -0
- package/decorators/shared/reactive-attr.js.map +13 -0
- package/decorators/signal.js +3 -0
- package/decorators/signal.js.map +19 -0
- package/decorators/standard/attr.js +3 -0
- package/decorators/standard/attr.js.map +14 -0
- package/decorators/standard/bound.js +3 -0
- package/{dist/decorators → decorators}/standard/bound.js.map +2 -2
- package/decorators/standard/custom-element.js +3 -0
- package/{dist/decorators → decorators}/standard/custom-element.js.map +2 -2
- package/decorators/standard/debounce.js +3 -0
- package/{dist/decorators → decorators}/standard/debounce.js.map +2 -2
- package/decorators/standard/event.js +3 -0
- package/{dist/decorators → decorators}/standard/event.js.map +2 -2
- package/decorators/standard/on-event.js +3 -0
- package/{dist/decorators → decorators}/standard/on-event.js.map +3 -3
- package/decorators/standard/on-updated.js +3 -0
- package/{dist/decorators → decorators}/standard/on-updated.js.map +2 -2
- package/{dist/decorators → decorators}/standard/query-slot.d.ts +0 -1
- package/decorators/standard/query-slot.js +3 -0
- package/decorators/standard/query-slot.js.map +11 -0
- package/decorators/standard/query.js +3 -0
- package/{dist/decorators → decorators}/standard/query.js.map +2 -2
- package/decorators/standard/reactive-field.js +3 -0
- package/decorators/standard/reactive-field.js.map +11 -0
- package/{dist/decorators → decorators}/standard/reactive-prop.d.ts +1 -1
- package/decorators/standard/reactive-prop.js +3 -0
- package/decorators/standard/reactive-prop.js.map +13 -0
- package/{dist/decorators → decorators}/standard/signal.d.ts +1 -1
- package/decorators/standard/signal.js +3 -0
- package/decorators/standard/signal.js.map +16 -0
- package/{dist/decorators → decorators}/state.d.ts +3 -2
- package/decorators/state.js +3 -0
- package/decorators/state.js.map +16 -0
- package/helpers/create-event-listener.js +3 -0
- package/{dist/helpers → helpers}/create-event-listener.js.map +3 -3
- package/helpers/create-event.js +3 -0
- package/{dist/helpers → helpers}/create-event.js.map +2 -2
- package/{dist/helpers → helpers}/create-query-slot.d.ts +0 -1
- package/helpers/create-query-slot.js +3 -0
- package/helpers/create-query-slot.js.map +10 -0
- package/helpers/create-query.js +3 -0
- package/{dist/helpers → helpers}/create-query.js.map +2 -2
- package/helpers/debounce.js +3 -0
- package/{dist/helpers → helpers}/debounce.js.map +2 -2
- package/helpers/index.js +3 -0
- package/{dist/helpers → helpers}/index.js.map +4 -4
- package/index.js +3 -0
- package/index.js.map +86 -0
- package/package.json +102 -125
- package/server/context-ssr.js +3 -0
- package/{dist/server → server}/context-ssr.js.map +2 -2
- package/server/host-attribute-serialization.d.ts +46 -0
- package/server/host-attribute-serialization.js +3 -0
- package/server/host-attribute-serialization.js.map +12 -0
- package/server/host-script-composition.d.ts +42 -0
- package/server/host-script-composition.js +3 -0
- package/server/host-script-composition.js.map +10 -0
- package/server/html-parser.js +3 -0
- package/{dist/server → server}/html-parser.js.map +2 -2
- package/server/install-light-dom-shim.js +3 -0
- package/server/install-light-dom-shim.js.map +17 -0
- package/server/internal-radiant-host.d.ts +2 -0
- package/server/internal-radiant-host.js +3 -0
- package/server/internal-radiant-host.js.map +9 -0
- package/server/light-dom-shim.d.ts +2 -0
- package/server/light-dom-shim.js +3 -0
- package/server/light-dom-shim.js.map +16 -0
- package/server/minimal-dom/document.d.ts +17 -0
- package/server/minimal-dom/document.js +3 -0
- package/server/minimal-dom/document.js.map +14 -0
- package/server/minimal-dom/html.d.ts +7 -0
- package/server/minimal-dom/html.js +3 -0
- package/server/minimal-dom/html.js.map +13 -0
- package/{dist/server/light-dom-shim.d.ts → server/minimal-dom/install.d.ts} +1 -4
- package/server/minimal-dom/install.js +3 -0
- package/server/minimal-dom/install.js.map +16 -0
- package/server/minimal-dom/nodes.d.ts +78 -0
- package/server/project-root.js +3 -0
- package/{dist/server → server}/project-root.js.map +2 -2
- package/server/radiant-element-ssr-bridge.d.ts +21 -0
- package/server/radiant-element-ssr-bridge.js +3 -0
- package/server/radiant-element-ssr-bridge.js.map +24 -0
- package/server/radiant-element-ssr-extractor.d.ts +2 -0
- package/server/radiant-element-ssr-extractor.js +3 -0
- package/server/radiant-element-ssr-extractor.js.map +12 -0
- package/server/radiant-element-ssr-service.d.ts +13 -0
- package/server/radiant-element-ssr-service.js +3 -0
- package/server/radiant-element-ssr-service.js.map +22 -0
- package/server/radiant-element-ssr.d.ts +1 -0
- package/server/radiant-element-ssr.js +3 -0
- package/server/radiant-element-ssr.js.map +24 -0
- package/{dist/server → server}/render-component.d.ts +3 -9
- package/server/render-component.js +3 -0
- package/server/render-component.js.map +32 -0
- package/server/render-controller.js +3 -0
- package/server/render-controller.js.map +35 -0
- package/server/render-fragment.d.ts +7 -0
- package/server/render-fragment.js +3 -0
- package/server/render-fragment.js.map +10 -0
- package/server/slot-projection-html.js +3 -0
- package/{dist/server → server}/slot-projection-html.js.map +5 -5
- package/signals/host-resource.js +3 -0
- package/{dist/signals → signals}/host-resource.js.map +2 -2
- package/{dist/signals → signals}/host-signal.d.ts +2 -1
- package/signals/host-signal.js +3 -0
- package/signals/host-signal.js.map +13 -0
- package/signals/hydration-script.js +3 -0
- package/{dist/signals → signals}/hydration-script.js.map +2 -2
- package/tools/escape-css-identifier.js +3 -0
- package/tools/escape-css-identifier.js.map +10 -0
- package/tools/escape-script-json.js +3 -0
- package/{dist/tools → tools}/escape-script-json.js.map +2 -2
- package/tools/event-emitter.js +3 -0
- package/{dist/tools → tools}/event-emitter.js.map +2 -2
- package/tools/index.js +3 -0
- package/{dist/tools → tools}/index.js.map +3 -3
- package/tools/render-jsx-template.js +3 -0
- package/{dist/tools → tools}/render-jsx-template.js.map +2 -2
- package/types.js +3 -0
- package/{dist/types.js.map → types.js.map} +2 -2
- package/utils/attribute-utils.js +3 -0
- package/{dist/utils → utils}/attribute-utils.js.map +2 -2
- package/utils/escape-html-attribute.d.ts +2 -0
- package/utils/escape-html-attribute.js +3 -0
- package/utils/escape-html-attribute.js.map +10 -0
- package/utils/index.js +3 -0
- package/{dist/utils → utils}/index.js.map +2 -2
- package/dist/LICENSE +0 -21
- package/dist/client/hydrator.js +0 -3
- package/dist/client/install-hydrator.js +0 -3
- package/dist/context/context-consumer-bootstrap.js +0 -3
- package/dist/context/context-consumer-runtime.js +0 -3
- package/dist/context/context-consumer-runtime.js.map +0 -12
- package/dist/context/context-host.js +0 -3
- package/dist/context/context-provider.js +0 -3
- package/dist/context/context-ssr-bridge.js +0 -3
- package/dist/context/create-context.js +0 -3
- package/dist/context/decorators/consume-context.js +0 -3
- package/dist/context/decorators/consume-context.js.map +0 -19
- package/dist/context/decorators/context-selection-delivery.js +0 -3
- package/dist/context/decorators/context-selector.js +0 -3
- package/dist/context/decorators/context-selector.js.map +0 -21
- package/dist/context/decorators/legacy/consume-context.js +0 -3
- package/dist/context/decorators/legacy/consume-context.js.map +0 -16
- package/dist/context/decorators/legacy/context-selector-field.js +0 -3
- package/dist/context/decorators/legacy/context-selector-field.js.map +0 -17
- package/dist/context/decorators/legacy/context-selector.js +0 -3
- package/dist/context/decorators/legacy/context-selector.js.map +0 -17
- package/dist/context/decorators/legacy/provide-context.js +0 -3
- package/dist/context/decorators/on-context-update.js +0 -3
- package/dist/context/decorators/provide-context.js +0 -3
- package/dist/context/decorators/standard/consume-context.js +0 -3
- package/dist/context/decorators/standard/context-selector-field.js +0 -3
- package/dist/context/decorators/standard/context-selector.js +0 -3
- package/dist/context/decorators/standard/provide-context.js +0 -3
- package/dist/context/events.js +0 -3
- package/dist/context/events.js.map +0 -10
- package/dist/context/hydration-script.js +0 -3
- package/dist/context/index.js +0 -3
- package/dist/controller-registry.js +0 -3
- package/dist/core/controller-metadata.js +0 -3
- package/dist/core/custom-element-metadata.js +0 -3
- package/dist/core/hydration-codec.js +0 -3
- package/dist/core/radiant-component-ssr-registry.d.ts +0 -54
- package/dist/core/radiant-component-ssr-registry.js +0 -3
- package/dist/core/radiant-component-ssr-registry.js.map +0 -10
- package/dist/core/radiant-component-ssr.js +0 -3
- package/dist/core/radiant-component-ssr.js.map +0 -14
- package/dist/core/radiant-controller.js +0 -3
- package/dist/core/radiant-controller.js.map +0 -13
- package/dist/core/radiant-element.js +0 -3
- package/dist/core/radiant-element.js.map +0 -19
- package/dist/core/radiant-hydrator-state.js +0 -3
- package/dist/core/reactive-host.d.ts +0 -137
- package/dist/core/reactive-host.js +0 -3
- package/dist/core/reactive-host.js.map +0 -10
- package/dist/core/reactive-jsx-value.js +0 -3
- package/dist/core/reactive-jsx-value.js.map +0 -10
- package/dist/core/reactive-prop-metadata.js +0 -3
- package/dist/core/reactive-prop-metadata.js.map +0 -10
- package/dist/core/slot-projection-runtime.js +0 -3
- package/dist/core/slot-projection-runtime.js.map +0 -12
- package/dist/core/ssr-preparation.js +0 -3
- package/dist/decorators/attr.js +0 -3
- package/dist/decorators/attr.js.map +0 -16
- package/dist/decorators/bound.js +0 -3
- package/dist/decorators/bridge.js +0 -3
- package/dist/decorators/controller.js +0 -3
- package/dist/decorators/custom-element.js +0 -3
- package/dist/decorators/debounce.js +0 -3
- package/dist/decorators/event.js +0 -3
- package/dist/decorators/legacy/attr.js +0 -3
- package/dist/decorators/legacy/attr.js.map +0 -13
- package/dist/decorators/legacy/bound.js +0 -3
- package/dist/decorators/legacy/custom-element.js +0 -3
- package/dist/decorators/legacy/debounce.js +0 -3
- package/dist/decorators/legacy/event.js +0 -3
- package/dist/decorators/legacy/event.js.map +0 -13
- package/dist/decorators/legacy/instance-initializers.d.ts +0 -16
- package/dist/decorators/legacy/instance-initializers.js +0 -3
- package/dist/decorators/legacy/instance-initializers.js.map +0 -10
- package/dist/decorators/legacy/on-event.js +0 -3
- package/dist/decorators/legacy/on-event.js.map +0 -13
- package/dist/decorators/legacy/on-updated.js +0 -3
- package/dist/decorators/legacy/on-updated.js.map +0 -11
- package/dist/decorators/legacy/query-slot.js +0 -3
- package/dist/decorators/legacy/query-slot.js.map +0 -13
- package/dist/decorators/legacy/query.js +0 -3
- package/dist/decorators/legacy/query.js.map +0 -12
- package/dist/decorators/legacy/reactive-field.js +0 -3
- package/dist/decorators/legacy/reactive-field.js.map +0 -11
- package/dist/decorators/legacy/reactive-prop.js +0 -3
- package/dist/decorators/legacy/reactive-prop.js.map +0 -13
- package/dist/decorators/legacy/signal.js +0 -3
- package/dist/decorators/legacy/signal.js.map +0 -15
- package/dist/decorators/on-event.js +0 -3
- package/dist/decorators/on-updated.js +0 -3
- package/dist/decorators/on-updated.js.map +0 -14
- package/dist/decorators/prop.js +0 -3
- package/dist/decorators/prop.js.map +0 -16
- package/dist/decorators/query-slot.js +0 -3
- package/dist/decorators/query-slot.js.map +0 -16
- package/dist/decorators/query.js +0 -3
- package/dist/decorators/shared/reactive-attr.js +0 -3
- package/dist/decorators/shared/reactive-attr.js.map +0 -11
- package/dist/decorators/signal.js +0 -3
- package/dist/decorators/signal.js.map +0 -17
- package/dist/decorators/standard/attr.js +0 -3
- package/dist/decorators/standard/attr.js.map +0 -12
- package/dist/decorators/standard/bound.js +0 -3
- package/dist/decorators/standard/custom-element.js +0 -3
- package/dist/decorators/standard/debounce.js +0 -3
- package/dist/decorators/standard/event.js +0 -3
- package/dist/decorators/standard/on-event.js +0 -3
- package/dist/decorators/standard/on-updated.js +0 -3
- package/dist/decorators/standard/query-slot.js +0 -3
- package/dist/decorators/standard/query-slot.js.map +0 -11
- package/dist/decorators/standard/query.js +0 -3
- package/dist/decorators/standard/reactive-field.js +0 -3
- package/dist/decorators/standard/reactive-field.js.map +0 -10
- package/dist/decorators/standard/reactive-prop.js +0 -3
- package/dist/decorators/standard/signal.js +0 -3
- package/dist/decorators/standard/signal.js.map +0 -14
- package/dist/decorators/state.js +0 -3
- package/dist/decorators/state.js.map +0 -14
- package/dist/helpers/create-event-listener.js +0 -3
- package/dist/helpers/create-event.js +0 -3
- package/dist/helpers/create-query-slot.js +0 -3
- package/dist/helpers/create-query-slot.js.map +0 -10
- package/dist/helpers/create-query.js +0 -3
- package/dist/helpers/debounce.js +0 -3
- package/dist/helpers/index.js +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -72
- package/dist/server/context-ssr.js +0 -3
- package/dist/server/html-parser.js +0 -3
- package/dist/server/install-light-dom-shim.js +0 -3
- package/dist/server/install-light-dom-shim.js.map +0 -12
- package/dist/server/light-dom-shim.js +0 -3
- package/dist/server/light-dom-shim.js.map +0 -11
- package/dist/server/project-root.js +0 -3
- package/dist/server/radiant-component-ssr-runtime.d.ts +0 -9
- package/dist/server/radiant-component-ssr-runtime.js +0 -3
- package/dist/server/radiant-component-ssr-runtime.js.map +0 -17
- package/dist/server/render-component.js +0 -3
- package/dist/server/render-component.js.map +0 -20
- package/dist/server/render-controller.js +0 -3
- package/dist/server/render-controller.js.map +0 -23
- package/dist/server/slot-projection-html.js +0 -3
- package/dist/signals/host-resource.js +0 -3
- package/dist/signals/host-signal.js +0 -3
- package/dist/signals/host-signal.js.map +0 -13
- package/dist/signals/hydration-script.js +0 -3
- package/dist/tools/escape-css-identifier.js +0 -3
- package/dist/tools/escape-css-identifier.js.map +0 -10
- package/dist/tools/escape-script-json.js +0 -3
- package/dist/tools/event-emitter.js +0 -3
- package/dist/tools/index.js +0 -3
- package/dist/tools/render-jsx-template.js +0 -3
- package/dist/types.js +0 -3
- package/dist/utils/attribute-utils.js +0 -3
- package/dist/utils/index.js +0 -3
- package/size-budget.json +0 -25
- /package/{dist/client → client}/hydrator.d.ts +0 -0
- /package/{dist/client → client}/install-hydrator.d.ts +0 -0
- /package/{dist/context → context}/context-consumer-bootstrap.d.ts +0 -0
- /package/{dist/context → context}/context-consumer-runtime.d.ts +0 -0
- /package/{dist/context → context}/context-host.d.ts +0 -0
- /package/{dist/context → context}/context-provider.d.ts +0 -0
- /package/{dist/context → context}/context-ssr-bridge.d.ts +0 -0
- /package/{dist/context → context}/create-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/consume-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/context-selection-delivery.d.ts +0 -0
- /package/{dist/context → context}/decorators/context-selector.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/consume-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/context-selector-field.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/context-selector.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/provide-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/on-context-update.d.ts +0 -0
- /package/{dist/context → context}/decorators/provide-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/consume-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/context-selector-field.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/context-selector.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/provide-context.d.ts +0 -0
- /package/{dist/context → context}/events.d.ts +0 -0
- /package/{dist/context → context}/hydration-script.d.ts +0 -0
- /package/{dist/context → context}/index.d.ts +0 -0
- /package/{dist/context → context}/types.d.ts +0 -0
- /package/{dist/context → context}/types.js +0 -0
- /package/{dist/context → context}/types.js.map +0 -0
- /package/{dist/controller-registry.d.ts → controller-registry.d.ts} +0 -0
- /package/{dist/core → core}/controller-metadata.d.ts +0 -0
- /package/{dist/core → core}/custom-element-metadata.d.ts +0 -0
- /package/{dist/core → core}/hydration-codec.d.ts +0 -0
- /package/{dist/core → core}/radiant-hydrator-state.d.ts +0 -0
- /package/{dist/core → core}/slot-projection-runtime.d.ts +0 -0
- /package/{dist/core → core}/ssr-hydration-binding.d.ts +0 -0
- /package/{dist/core → core}/ssr-hydration-binding.js +0 -0
- /package/{dist/core → core}/ssr-hydration-binding.js.map +0 -0
- /package/{dist/core → core}/ssr-preparation.d.ts +0 -0
- /package/{dist/decorators → decorators}/attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/bound.d.ts +0 -0
- /package/{dist/decorators → decorators}/bridge.d.ts +0 -0
- /package/{dist/decorators → decorators}/controller.d.ts +0 -0
- /package/{dist/decorators → decorators}/custom-element.d.ts +0 -0
- /package/{dist/decorators → decorators}/debounce.d.ts +0 -0
- /package/{dist/decorators → decorators}/event.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/bound.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/custom-element.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/debounce.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/event.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/on-event.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/query-slot.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/query.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/reactive-field.d.ts +0 -0
- /package/{dist/decorators → decorators}/on-event.d.ts +0 -0
- /package/{dist/decorators → decorators}/on-updated.d.ts +0 -0
- /package/{dist/decorators → decorators}/query-slot.d.ts +0 -0
- /package/{dist/decorators → decorators}/query.d.ts +0 -0
- /package/{dist/decorators → decorators}/signal.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/bound.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/custom-element.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/debounce.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/event.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/on-event.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/on-updated.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/query.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/reactive-field.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-event-listener.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-event.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-query.d.ts +0 -0
- /package/{dist/helpers → helpers}/debounce.d.ts +0 -0
- /package/{dist/helpers → helpers}/index.d.ts +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/server → server}/context-ssr.d.ts +0 -0
- /package/{dist/server → server}/html-parser.d.ts +0 -0
- /package/{dist/server → server}/install-light-dom-shim.d.ts +0 -0
- /package/{dist/server → server}/project-root.d.ts +0 -0
- /package/{dist/server → server}/render-controller.d.ts +0 -0
- /package/{dist/server → server}/slot-projection-html.d.ts +0 -0
- /package/{dist/signals → signals}/host-resource.d.ts +0 -0
- /package/{dist/signals → signals}/hydration-script.d.ts +0 -0
- /package/{dist/tools → tools}/escape-css-identifier.d.ts +0 -0
- /package/{dist/tools → tools}/escape-script-json.d.ts +0 -0
- /package/{dist/tools → tools}/event-emitter.d.ts +0 -0
- /package/{dist/tools → tools}/index.d.ts +0 -0
- /package/{dist/tools → tools}/render-jsx-template.d.ts +0 -0
- /package/{dist/types.d.ts → types.d.ts} +0 -0
- /package/{dist/utils → utils}/attribute-utils.d.ts +0 -0
- /package/{dist/utils → utils}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -10,17 +10,17 @@ For the full docs site, see [radiant.ecopages.app](https://radiant.ecopages.app/
|
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
|
-
`@ecopages/radiant` is the core package. `@ecopages/jsx` and `@ecopages/signals`
|
|
13
|
+
`@ecopages/radiant` is the core package. `@ecopages/jsx` provides TSX rendering, and `@ecopages/signals` provides the renderer-agnostic reactive layer underneath Radiant.
|
|
14
14
|
|
|
15
|
-
`@ecopages/radiant`
|
|
15
|
+
`@ecopages/radiant` depends on `@ecopages/signals` directly and declares `@ecopages/jsx` as a peer dependency. Installing radiant brings signals transitively, which also satisfies jsx's peer dependency on signals.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
For the standard Radiant setup, install radiant and jsx:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
bun add @ecopages/radiant @ecopages/
|
|
20
|
+
bun add @ecopages/radiant @ecopages/jsx
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Application code does not need to import JSX helpers or Signals primitives directly for every feature, but the current published Radiant surface expects
|
|
23
|
+
Application code does not need to import JSX helpers or Signals primitives directly for every feature, but the current published Radiant surface expects `@ecopages/jsx` to be installed alongside it. Install `@ecopages/signals` explicitly only when you want the standalone reactive layer outside Radiant, or when using `@ecopages/jsx` without radiant.
|
|
24
24
|
|
|
25
25
|
## RadiantElement Mental Model
|
|
26
26
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JsxRenderable } from '@ecopages/jsx';
|
|
2
|
+
export type RadiantAppBootstrapContext = {
|
|
3
|
+
documentRoot: Document;
|
|
4
|
+
rootElement: HTMLElement;
|
|
5
|
+
shouldHydrate: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type RadiantAppBootstrapResult<AppProps> = {
|
|
8
|
+
appProps: AppProps;
|
|
9
|
+
onStarted?: () => void | Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export type RadiantAppBootstrap<AppProps> = (context: RadiantAppBootstrapContext) => void | RadiantAppBootstrapResult<AppProps> | Promise<void | RadiantAppBootstrapResult<AppProps>>;
|
|
12
|
+
export declare function prepareRadiantApp<AppProps = void>({ app, bootstrap, context, }: {
|
|
13
|
+
app: (props: AppProps) => JsxRenderable;
|
|
14
|
+
bootstrap?: RadiantAppBootstrap<AppProps>;
|
|
15
|
+
context: RadiantAppBootstrapContext;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
app: JsxRenderable;
|
|
18
|
+
onStarted?: () => void | Promise<void>;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:a,getOwnPropertyNames:s,getOwnPropertyDescriptor:n}=Object,d=Object.prototype.hasOwnProperty;function i(p){return this[p]}var P=(p)=>{var t=(r??=new WeakMap).get(p),o;if(t)return t;if(t=a({},"__esModule",{value:!0}),p&&typeof p==="object"||typeof p==="function"){for(var e of s(p))if(!d.call(t,e))a(t,e,{get:i.bind(p,e),enumerable:!(o=n(p,e))||o.enumerable})}return r.set(p,t),t},r;var A=(p)=>p;function R(p,t){this[p]=A.bind(null,t)}var x=(p,t)=>{for(var o in t)a(p,o,{get:t[o],enumerable:!0,configurable:!0,set:R.bind(t,o)})};var l=(p,t)=>()=>(p&&(t=p(p=0)),t);var m=((p)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(p,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):p)(function(p){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+p+'" is not supported')});async function c({app:p,bootstrap:t,context:o}){let e=await t?.(o);return{app:p(e?.appProps??void 0),onStarted:e?.onStarted}}export{c as prepareRadiantApp};
|
|
2
|
+
|
|
3
|
+
//# debugId=A21220CF49A849D164756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/client/app-bootstrap.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\n\nexport type RadiantAppBootstrapContext = {\n\tdocumentRoot: Document;\n\trootElement: HTMLElement;\n\tshouldHydrate: boolean;\n};\n\nexport type RadiantAppBootstrapResult<AppProps> = {\n\tappProps: AppProps;\n\tonStarted?: () => void | Promise<void>;\n};\n\nexport type RadiantAppBootstrap<AppProps> = (\n\tcontext: RadiantAppBootstrapContext,\n) => void | RadiantAppBootstrapResult<AppProps> | Promise<void | RadiantAppBootstrapResult<AppProps>>;\n\nexport async function prepareRadiantApp<AppProps = void>({\n\tapp,\n\tbootstrap,\n\tcontext,\n}: {\n\tapp: (props: AppProps) => JsxRenderable;\n\tbootstrap?: RadiantAppBootstrap<AppProps>;\n\tcontext: RadiantAppBootstrapContext;\n}): Promise<{ app: JsxRenderable; onStarted?: () => void | Promise<void> }> {\n\tconst bootstrapResult = await bootstrap?.(context);\n\n\treturn {\n\t\tapp: app((bootstrapResult?.appProps ?? undefined) as AppProps),\n\t\tonStarted: bootstrapResult?.onStarted,\n\t};\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "i0BAiBA,eAAsB,CAAkC,EACvD,MACA,YACA,WAK2E,CAC3E,IAAM,EAAkB,MAAM,IAAY,CAAO,EAEjD,MAAO,CACN,IAAK,EAAK,GAAiB,UAAY,MAAsB,EAC7D,UAAW,GAAiB,SAC7B",
|
|
8
|
+
"debugId": "A21220CF49A849D164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:q,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,P=Object.prototype.hasOwnProperty;function Q(f){return this[f]}var W=(f)=>{var j=(z??=new WeakMap).get(f),k;if(j)return j;if(j=q({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function"){for(var m of J(f))if(!P.call(j,m))q(j,m,{get:Q.bind(f,m),enumerable:!(k=K(f,m))||k.enumerable})}return z.set(f,j),j},z;var U=(f)=>f;function V(f,j){this[f]=U.bind(null,j)}var X=(f,j)=>{for(var k in j)q(f,k,{get:j[k],enumerable:!0,configurable:!0,set:V.bind(j,k)})};var Z=(f,j)=>()=>(f&&(j=f(f=0)),j);var $=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(j,k)=>(typeof require<"u"?require:j)[k]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var v=Symbol.for("@ecopages/radiant.hydrator-installed");function C(){globalThis[v]=!0}function F(){delete globalThis[v]}function G(){return globalThis[v]===!0}function w(){C()}function x(){F()}function c(){return G()}export{x as uninstallRadiantHydrator,w as installRadiantHydrator,c as hasRadiantHydrator};
|
|
2
|
+
|
|
3
|
+
//# debugId=5F3B105C78A9904064756E2164756E21
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"const RADIANT_HYDRATOR_INSTALLED_SYMBOL = Symbol.for('@ecopages/radiant.hydrator-installed');\n\ntype GlobalHydratorState = typeof globalThis & Record<PropertyKey, unknown>;\n\n/**\n * Marks the current JavaScript environment as hydration-enabled for first\n * custom-element connect.\n *\n * `RadiantElement` reads this flag before deciding whether SSR markup should\n * hydrate in place or be replaced by a fresh client render.\n */\nexport function installRadiantHydratorState(): void {\n\t(globalThis as GlobalHydratorState)[RADIANT_HYDRATOR_INSTALLED_SYMBOL] = true;\n}\n\n/**\n * Clears the explicit hydration-enabled flag from `globalThis`.\n *\n * This is mainly used by tests so they can assert both hydrated and non-\n * hydrated first-connect behavior deterministically.\n */\nexport function uninstallRadiantHydratorState(): void {\n\tdelete (globalThis as GlobalHydratorState)[RADIANT_HYDRATOR_INSTALLED_SYMBOL];\n}\n\n/**\n * Returns whether first-connect hydration is currently enabled for this\n * JavaScript environment.\n */\nexport function isRadiantHydratorInstalled(): boolean {\n\treturn (globalThis as GlobalHydratorState)[RADIANT_HYDRATOR_INSTALLED_SYMBOL] === true;\n}\n",
|
|
6
6
|
"import {\n\tisRadiantHydratorInstalled,\n\tinstallRadiantHydratorState,\n\tuninstallRadiantHydratorState,\n} from '../core/radiant-hydrator-state';\n\n/**\n * Enables first-connect hydration for SSR-rendered RadiantElement hosts.\n *\n * Import this from SSR pages before loading component modules so upgraded\n * custom elements hydrate their existing DOM instead of performing a fresh\n * client render on first connect.\n */\nexport function installRadiantHydrator(): void {\n\tinstallRadiantHydratorState();\n}\n\n/**\n * Disables the explicit Radiant hydrator gate.\n *\n * This is primarily useful for tests and controlled bootstrap scenarios where\n * SSR hosts should intentionally fall back to a fresh client render.\n */\nexport function uninstallRadiantHydrator(): void {\n\tuninstallRadiantHydratorState();\n}\n\n/**\n * Returns whether the explicit Radiant hydrator gate is currently enabled.\n */\nexport function hasRadiantHydrator(): boolean {\n\treturn isRadiantHydratorInstalled();\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": "i0BAAA,IAAM,EAAoC,OAAO,IAAI,sCAAsC,EAWpF,SAAS,CAA2B,EAAS,CAClD,WAAmC,GAAqC,GASnE,SAAS,CAA6B,EAAS,CACrD,OAAQ,WAAmC,GAOrC,SAAS,CAA0B,EAAY,CACrD,OAAQ,WAAmC,KAAuC,GCjB5E,SAAS,CAAsB,EAAS,CAC9C,EAA4B,EAStB,SAAS,CAAwB,EAAS,CAChD,EAA8B,EAMxB,SAAS,CAAkB,EAAY,CAC7C,OAAO,EAA2B",
|
|
9
|
+
"debugId": "5F3B105C78A9904064756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:p,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,P=Object.prototype.hasOwnProperty;function Q(m){return this[m]}var W=(m)=>{var f=(v??=new WeakMap).get(m),j;if(f)return f;if(f=p({},"__esModule",{value:!0}),m&&typeof m==="object"||typeof m==="function"){for(var k of J(m))if(!P.call(f,k))p(f,k,{get:Q.bind(m,k),enumerable:!(j=K(m,k))||j.enumerable})}return v.set(m,f),f},v;var U=(m)=>m;function V(m,f){this[m]=U.bind(null,f)}var X=(m,f)=>{for(var j in f)p(m,j,{get:f[j],enumerable:!0,configurable:!0,set:V.bind(f,j)})};var Z=(m,f)=>()=>(m&&(f=m(m=0)),f);var $=((m)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(m,{get:(f,j)=>(typeof require<"u"?require:f)[j]}):m)(function(m){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+m+'" is not supported')});var q=Symbol.for("@ecopages/radiant.hydrator-installed");function z(){globalThis[q]=!0}function C(){delete globalThis[q]}function F(){return globalThis[q]===!0}function G(){z()}function x(){C()}function c(){return F()}G();
|
|
2
|
+
|
|
3
|
+
//# debugId=79FEA83411E53E6164756E2164756E21
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"import {\n\tisRadiantHydratorInstalled,\n\tinstallRadiantHydratorState,\n\tuninstallRadiantHydratorState,\n} from '../core/radiant-hydrator-state';\n\n/**\n * Enables first-connect hydration for SSR-rendered RadiantElement hosts.\n *\n * Import this from SSR pages before loading component modules so upgraded\n * custom elements hydrate their existing DOM instead of performing a fresh\n * client render on first connect.\n */\nexport function installRadiantHydrator(): void {\n\tinstallRadiantHydratorState();\n}\n\n/**\n * Disables the explicit Radiant hydrator gate.\n *\n * This is primarily useful for tests and controlled bootstrap scenarios where\n * SSR hosts should intentionally fall back to a fresh client render.\n */\nexport function uninstallRadiantHydrator(): void {\n\tuninstallRadiantHydratorState();\n}\n\n/**\n * Returns whether the explicit Radiant hydrator gate is currently enabled.\n */\nexport function hasRadiantHydrator(): boolean {\n\treturn isRadiantHydratorInstalled();\n}\n",
|
|
7
7
|
"import { installRadiantHydrator } from './hydrator';\n\ninstallRadiantHydrator();\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": "
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": "i0BAAA,IAAM,EAAoC,OAAO,IAAI,sCAAsC,EAWpF,SAAS,CAA2B,EAAS,CAClD,WAAmC,GAAqC,GASnE,SAAS,CAA6B,EAAS,CACrD,OAAQ,WAAmC,GAOrC,SAAS,CAA0B,EAAY,CACrD,OAAQ,WAAmC,KAAuC,GCjB5E,SAAS,CAAsB,EAAS,CAC9C,EAA4B,EAStB,SAAS,CAAwB,EAAS,CAChD,EAA8B,EAMxB,SAAS,CAAkB,EAAY,CAC7C,OAAO,EAA2B,EC7BnC,EAAuB",
|
|
10
|
+
"debugId": "79FEA83411E53E6164756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:Z,getOwnPropertyNames:L,getOwnPropertyDescriptor:m}=Object,N=Object.prototype.hasOwnProperty;function O(j){return this[j]}var k=(j)=>{var w=(f??=new WeakMap).get(j),F;if(w)return w;if(w=Z({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var H of L(j))if(!N.call(w,H))Z(w,H,{get:O.bind(j,H),enumerable:!(F=m(j,H))||F.enumerable})}return f.set(j,w),w},f;var P=(j)=>j;function T(j,w){this[j]=P.bind(null,w)}var q=(j,w)=>{for(var F in w)Z(j,F,{get:w[F],enumerable:!0,configurable:!0,set:T.bind(w,F)})};var A=(j,w)=>()=>(j&&(w=j(j=0)),w);var E=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(w,F)=>(typeof require<"u"?require:w)[F]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var $=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),z=Symbol.for("@ecopages/radiant.ssr-preparation-running");function K(j,w){let H=j[$];if(Array.isArray(H)){H.push(w);return}Object.defineProperty(j,$,{value:[w],configurable:!0})}function b(j){let w=j,F=w[$];if(!Array.isArray(F))return;w[z]=!0;try{for(let H of F)H()}finally{delete w[z]}}var G=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function V(){return globalThis}function u(j){V()[G]=j}function D(j){return V()[G]?.(j)}var B;((J)=>{J.SUBSCRIPTION_REQUEST="context-subscription-request";J.CONTEXT_REQUEST="context-request";J.ON_MOUNT="context-on-mount";J.MOUNTED="context-mounted"})(B||={});class M extends Event{context;callback;subscribe;handled=!1;constructor(j,w,F){super("context-request",{bubbles:!0,composed:!0});this.context=j;this.callback=w;this.subscribe=F}markHandled(){this.handled=!0}}class _ extends CustomEvent{constructor(j){super("context-on-mount",{detail:{context:j},bubbles:!0,composed:!0})}}class U extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(j,w,F,H,J){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=j;this.callback=w;this.select=F;this.subscribe=H;this.onSubscribe=J}markHandled(){this.handled=!0}}function X(j,w,F,H={}){let J=D(w);if(!J)return!1;if(F(J),j.connectedContextCallback(w),H.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:J}));return!0}function I(j,w,F,H={}){let J=new M(w,(Q)=>{if(F(Q),j.connectedContextCallback(w),H.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:Q}))});return j.dispatchEvent(J),J.handled}function W(j,w){let F=D(j);if(!F)return!1;let H=F.getContext();if(w.select)return w.callback(w.select(H)),!0;return w.callback(H),!0}function Y(j,w,F,H){let J=new U(w,F.callback,F.select,H.subscribe,H.onSubscribe);return j.dispatchEvent(J),J.handled}function l(j,w,F,H={}){return y(j,()=>X(j,w,F,H))}function a(j,w,F,H){return y(j,()=>{if(H)return W(w,{callback:F,select:H});return W(w,{callback:F})})}function c(j,w,F,H={}){if(X(j,w,F,H))return!0;return I(j,w,F,H)}function i(j,w,F,H={}){if(H.select){let Q={callback:F,select:H.select};if(W(w,Q))return!0;return Y(j,w,Q,{subscribe:H.subscribe,onSubscribe:H.onSubscribe})}let J={callback:F};if(W(w,J))return!0;return Y(j,w,J,{subscribe:H.subscribe,onSubscribe:H.onSubscribe})}function y(j,w){return K(j,w),w()}export{i as connectContextSelection,c as connectConsumedContext,a as bootstrapSsrContextSelection,l as bootstrapSsrConsumedContext};
|
|
2
|
+
|
|
3
|
+
//# debugId=A0602145323847E564756E2164756E21
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol.for('@ecopages/radiant.ssr-preparation-callbacks');\nexport const SSR_PREPARATION_RUNNING = Symbol.for('@ecopages/radiant.ssr-preparation-running');\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\n}\n",
|
|
6
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
|
-
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\
|
|
8
|
-
"import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\
|
|
7
|
+
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\tDirectContextSubscription<T> | SelectedContextSubscription<T, Selected>;\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
|
|
8
|
+
"import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\tDirectContextSelectionRequest<TContext> | SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n",
|
|
9
9
|
"import type { ContextHostLike } from './context-host';\nimport { registerSsrPreparationCallback } from '../core/ssr-preparation';\nimport {\n\tinitializeConsumedContext,\n\tinitializeContextSelection,\n\trequestConsumedContext,\n\trequestContextSelection,\n} from './context-consumer-runtime';\nimport type { ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\n/**\n * Resolves a consumed context immediately and registers the same resolution to\n * run again during the later SSR preparation phase.\n *\n * This keeps constructor-time state and pre-serialization state aligned after\n * instance fields, props, or authored host content change during SSR setup.\n */\nexport function bootstrapSsrConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => initializeConsumedContext(host, context, assign, options));\n}\n\n/**\n * Resolves a selected context value immediately and registers the same\n * selection for the later SSR preparation phase.\n *\n * This lets nested SSR renders recompute selector-backed state after the host\n * has finished construction and any server-side configuration hooks have run.\n */\nexport function bootstrapSsrContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: object,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\tselect?: (context: ContextType<TContext>) => Selected,\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => {\n\t\tif (select) {\n\t\t\treturn initializeContextSelection(context, { callback, select });\n\t\t}\n\n\t\treturn initializeContextSelection(context, {\n\t\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t\t});\n\t});\n}\n\n/**\n * Resolves a consumed context from SSR when available, otherwise requests it\n * through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tif (initializeConsumedContext(host, context, assign, options)) {\n\t\treturn true;\n\t}\n\n\treturn requestConsumedContext(host, context, assign, options);\n}\n\n/**\n * Resolves a selected context value from SSR when available, otherwise requests\n * it through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\toptions: {\n\t\tselect?: (context: ContextType<TContext>) => Selected;\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t} = {},\n): boolean {\n\tif (options.select) {\n\t\tconst request = { callback, select: options.select };\n\n\t\tif (initializeContextSelection(context, request)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn requestContextSelection(host, context, request, {\n\t\t\tsubscribe: options.subscribe,\n\t\t\tonSubscribe: options.onSubscribe,\n\t\t});\n\t}\n\n\tconst request = {\n\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t};\n\n\tif (initializeContextSelection(context, request)) {\n\t\treturn true;\n\t}\n\n\treturn requestContextSelection(host, context, request, {\n\t\tsubscribe: options.subscribe,\n\t\tonSubscribe: options.onSubscribe,\n\t});\n}\n\nfunction registerAndResolveConsumerBootstrap<TResult>(host: object, resolve: () => TResult): TResult {\n\tregisterSsrPreparationCallback(host, resolve);\n\treturn resolve();\n}\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": "
|
|
12
|
-
"debugId": "
|
|
11
|
+
"mappings": "i0BAEA,IAAM,EAA4B,OAAO,IAAI,6CAA6C,EAC7E,EAA0B,OAAO,IAAI,2CAA2C,EAStF,SAAS,CAA8B,CAAC,EAAc,EAAwC,CAEpG,IAAM,EADS,EACkB,GAEjC,GAAI,MAAM,QAAQ,CAAiB,EAAG,CACrC,EAAkB,KAAK,CAAQ,EAC/B,OAGD,OAAO,eAAe,EAAM,EAA2B,CACtD,MAAO,CAAC,CAAQ,EAChB,aAAc,EACf,CAAC,EASK,SAAS,CAA0B,CAAC,EAAoB,CAC9D,IAAM,EAAS,EACT,EAAY,EAAO,GAEzB,GAAI,CAAC,MAAM,QAAQ,CAAS,EAC3B,OAGD,EAAO,GAA2B,GAElC,GAAI,CACH,QAAW,KAAY,EACtB,EAAS,SAET,CACD,OAAO,EAAO,IC3ChB,IAAM,EAAuC,OAAO,IAAI,iDAAiD,EAMzG,SAAS,CAAsB,EAAwB,CACtD,OAAO,WAUD,SAAS,CAAiC,CAAC,EAA4C,CAC7F,EAAuB,EAAE,GAAwC,EAM3D,SAAS,CAAgC,CAAC,EAAqE,CACrH,OAAO,EAAuB,EAAE,KAAwC,CAAO,ECzBzE,IAAK,GAAL,CAAK,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,EAAS,CACtD,UAAW,EAAQ,UACnB,YAAa,EAAQ,WACtB,CAAC,EAGF,SAAS,CAA4C,CAAC,EAAc,EAAiC,CAEpG,OADA,EAA+B,EAAM,CAAO,EACrC,EAAQ",
|
|
12
|
+
"debugId": "A0602145323847E564756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:H,getOwnPropertyNames:B,getOwnPropertyDescriptor:D}=Object,G=Object.prototype.hasOwnProperty;function I(j){return this[j]}var Y=(j)=>{var k=(W??=new WeakMap).get(j),w;if(k)return k;if(k=H({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var z of B(j))if(!G.call(k,z))H(k,z,{get:I.bind(j,z),enumerable:!(w=D(j,z))||w.enumerable})}return W.set(j,k),k},W;var M=(j)=>j;function N(j,k){this[j]=M.bind(null,k)}var A=(j,k)=>{for(var w in k)H(j,w,{get:k[w],enumerable:!0,configurable:!0,set:N.bind(k,w)})};var L=(j,k)=>()=>(j&&(k=j(j=0)),k);var P=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(k,w)=>(typeof require<"u"?require:k)[w]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var Z=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function $(){return globalThis}function m(j){$()[Z]=j}function J(j){return $()[Z]?.(j)}var f;((F)=>{F.SUBSCRIPTION_REQUEST="context-subscription-request";F.CONTEXT_REQUEST="context-request";F.ON_MOUNT="context-on-mount";F.MOUNTED="context-mounted"})(f||={});class K extends Event{context;callback;subscribe;handled=!1;constructor(j,k,w){super("context-request",{bubbles:!0,composed:!0});this.context=j;this.callback=k;this.subscribe=w}markHandled(){this.handled=!0}}class X extends CustomEvent{constructor(j){super("context-on-mount",{detail:{context:j},bubbles:!0,composed:!0})}}class Q extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(j,k,w,z,F){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=j;this.callback=k;this.select=w;this.subscribe=z;this.onSubscribe=F}markHandled(){this.handled=!0}}function _(j,k,w,z={}){let F=J(k);if(!F)return!1;if(w(F),j.connectedContextCallback(k),z.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:F}));return!0}function T(j,k,w,z={}){let F=new K(k,(U)=>{if(w(U),j.connectedContextCallback(k),z.emitMounted)j.dispatchEvent(new CustomEvent("context-mounted",{detail:U}))});return j.dispatchEvent(F),F.handled}function S(j,k){let w=J(j);if(!w)return!1;let z=w.getContext();if(k.select)return k.callback(k.select(z)),!0;return k.callback(z),!0}function q(j,k,w,z){let F=new Q(k,w.callback,w.select,z.subscribe,z.onSubscribe);return j.dispatchEvent(F),F.handled}export{q as requestContextSelection,T as requestConsumedContext,S as initializeContextSelection,_ as initializeConsumedContext};
|
|
2
|
+
|
|
3
|
+
//# debugId=A272F41656D084B664756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/context/context-ssr-bridge.ts", "../src/context/events.ts", "../src/context/context-consumer-runtime.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"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",
|
|
6
|
+
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\tDirectContextSubscription<T> | SelectedContextSubscription<T, Selected>;\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
|
|
7
|
+
"import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\tDirectContextSelectionRequest<TContext> | SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": "i0BAKA,IAAM,EAAuC,OAAO,IAAI,iDAAiD,EAMzG,SAAS,CAAsB,EAAwB,CACtD,OAAO,WAUD,SAAS,CAAiC,CAAC,EAA4C,CAC7F,EAAuB,EAAE,GAAwC,EAM3D,SAAS,CAAgC,CAAC,EAAqE,CACrH,OAAO,EAAuB,EAAE,KAAwC,CAAO,ECzBzE,IAAK,GAAL,CAAK,IAAL,CACN,uBAAuB,+BACvB,kBAAkB,kBAClB,WAAW,mBACX,UAAU,oBAJC,QAiBL,MAAM,UAAsD,KAAM,CAIvD,QACA,SACA,UALV,QAAU,GAEV,WAAW,CACD,EACA,EACA,EACf,CACD,MAAM,kBAAoC,CAAE,QAAS,GAAM,SAAU,EAAK,CAAC,EAJ3D,eACA,gBACA,iBAKV,WAAW,EAAS,CAC1B,KAAK,QAAU,GAEjB,CAqBO,MAAM,UAA4B,WAAyC,CAC1E,WAAW,CAAC,EAAyB,CAC3C,MAAM,mBAA6B,CAClC,OAAQ,CAAE,SAAQ,EAClB,QAAS,GACT,SAAU,EACX,CAAC,EAEH,CAcO,MAAM,UAA6F,KAAM,CAI9F,QACA,SACA,OACA,UACA,YAPV,QAAU,GAEV,WAAW,CACD,EACA,EACA,EACA,EACA,EACf,CACD,MAAM,+BAAyC,CAC9C,QAAS,GACT,SAAU,EACX,CAAC,EATe,eACA,gBACA,cACA,iBACA,mBAQV,WAAW,EAAS,CAC1B,KAAK,QAAU,GAEjB,CCtEO,SAAS,CAAyB,CACxC,EACA,EACA,EACA,EAAqC,CAAC,EAC5B,CACV,IAAM,EAAW,EAAiC,CAAO,EAEzD,GAAI,CAAC,EACJ,MAAO,GAMR,GAHA,EAAO,CAAQ,EACf,EAAK,yBAAyB,CAAO,EAEjC,EAAQ,YACX,EAAK,cAAc,IAAI,8BAAwC,CAAE,OAAQ,CAAS,CAAC,CAAC,EAGrF,MAAO,GAMD,SAAS,CAAsB,CACrC,EACA,EACA,EACA,EAAqC,CAAC,EAC5B,CACV,IAAM,EAAQ,IAAI,EAAoB,EAAS,CAAC,IAAa,CAI5D,GAHA,EAAO,CAAQ,EACf,EAAK,yBAAyB,CAAO,EAEjC,EAAQ,YACX,EAAK,cAAc,IAAI,8BAAwC,CAAE,OAAQ,CAAS,CAAC,CAAC,EAErF,EAGD,OADA,EAAK,cAAc,CAAK,EACjB,EAAM,QAgBP,SAAS,CAA6F,CAC5G,EACA,EACU,CACV,IAAM,EAAW,EAAiC,CAAO,EAEzD,GAAI,CAAC,EACJ,MAAO,GAGR,IAAM,EAAkB,EAAS,WAAW,EAE5C,GAAI,EAAQ,OAEX,OADA,EAAQ,SAAS,EAAQ,OAAO,CAAe,CAAC,EACzC,GAIR,OADA,EAAQ,SAAS,CAAe,EACzB,GAwBD,SAAS,CAA0F,CACzG,EACA,EACA,EACA,EAIU,CACV,IAAM,EAAQ,IAAI,EACjB,EACA,EAAQ,SACR,EAAQ,OACR,EAAQ,UACR,EAAQ,WACT,EAGA,OADA,EAAK,cAAc,CAAK,EACjB,EAAM",
|
|
10
|
+
"debugId": "A272F41656D084B664756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:i,getOwnPropertyNames:l,getOwnPropertyDescriptor:s}=Object,d=Object.prototype.hasOwnProperty;function a(e){return this[e]}var C=(e)=>{var t=(r??=new WeakMap).get(e),n;if(t)return t;if(t=i({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var o of l(e))if(!d.call(t,o))i(t,o,{get:a.bind(e,o),enumerable:!(n=s(e,o))||n.enumerable})}return r.set(e,t),t},r;var p=(e)=>e;function v(e,t){this[e]=p.bind(null,t)}var x=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0,configurable:!0,set:v.bind(t,n)})};var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var m=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});function H(e){if(e instanceof Element)return e;if("host"in e)return e.host;if("element"in e)return e.element;return null}function u(e){if(e instanceof Element)return e;if("host"in e)return e.host;if("element"in e)return e.element;return e}export{u as resolveContextHydrationHost,H as resolveContextHostElement};
|
|
2
|
+
|
|
3
|
+
//# debugId=9273DEA510C1866C64756E2164756E21
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { UnknownContext } from './types';\n\ntype ContextHostApi = {\n\taddEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void;\n\tremoveEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | EventListenerOptions,\n\t): void;\n\tdispatchEvent(event: Event): boolean;\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tconnectedContextCallback(context: UnknownContext): void;\n\tregisterContextProvider(name: string, provider: unknown): void;\n};\n\ntype SsrHydrationContainer = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\nexport type ContextHydrationHost = Element | SsrHydrationContainer;\n\nexport type ContextHostLike =\n\t| (ContextHostApi & Element)\n\t| (ContextHostApi & { host: Element })\n\t| (ContextHostApi & { element: Element })\n\t| (ContextHostApi & SsrHydrationContainer);\n\nexport function resolveContextHostElement(host: ContextHostLike): Element | null {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\tif ('element' in host) {\n\t\treturn host.element;\n\t}\n\n\treturn null;\n}\n\nexport function resolveContextHydrationHost(host: ContextHostLike): ContextHydrationHost {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\tif ('element' in host) {\n\t\treturn host.element;\n\t}\n\n\treturn host;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "i0BAiCO,SAAS,CAAyB,CAAC,EAAuC,CAChF,GAAI,aAAgB,QACnB,OAAO,EAGR,GAAI,SAAU,EACb,OAAO,EAAK,KAGb,GAAI,YAAa,EAChB,OAAO,EAAK,QAGb,OAAO,KAGD,SAAS,CAA2B,CAAC,EAA6C,CACxF,GAAI,aAAgB,QACnB,OAAO,EAGR,GAAI,SAAU,EACb,OAAO,EAAK,KAGb,GAAI,YAAa,EAChB,OAAO,EAAK,QAGb,OAAO",
|
|
8
|
+
"debugId": "9273DEA510C1866C64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:$,getOwnPropertyNames:m,getOwnPropertyDescriptor:k}=Object,A=Object.prototype.hasOwnProperty;function K(L){return this[L]}var v=(L)=>{var f=(X??=new WeakMap).get(L),g;if(f)return f;if(f=$({},"__esModule",{value:!0}),L&&typeof L==="object"||typeof L==="function"){for(var j of m(L))if(!A.call(f,j))$(f,j,{get:K.bind(L,j),enumerable:!(g=k(L,j))||g.enumerable})}return X.set(L,f),f},X;var N=(L)=>L;function V(L,f){this[L]=N.bind(null,f)}var S=(L,f)=>{for(var g in f)$(L,g,{get:f[g],enumerable:!0,configurable:!0,set:V.bind(f,g)})};var T=(L,f)=>()=>(L&&(f=L(L=0)),f);var y=((L)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(L,{get:(f,g)=>(typeof require<"u"?require:f)[g]}):L)(function(L){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+L+'" is not supported')});function z(L){return L.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var P="data-hydration",w="data-hydration-type",F="data-hydration-key";function C(L){let f=L.hydrationKey?` ${F}="${Y(L.hydrationKey)}"`:"";return`<script type="application/json" ${P} ${w}="${L.type}"${f}>${L.serializedValue}</script>`}function E(L){return z(L)}function M(L,f){let g=L.textContent;if(!g)return f;try{return JSON.parse(g)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${P}>:`,g.slice(0,120));return f}}function O(L,f,g){let j=L.children;if(!j||j.length===0){let q=L.childNodes;if(!q||q.length===0)return null;for(let G=0;G<q.length;G+=1){let Q=q[G];if(Q.nodeType!==1)continue;let W=Q;if(J(W,f,g))return W}return null}for(let q=0;q<j.length;q+=1)if(J(j[q],f,g))return j[q];return null}function J(L,f,g){if(L.tagName!=="SCRIPT"||!L.hasAttribute(P)||L.getAttribute(w)!==f)return!1;if(g!==void 0)return L.getAttribute(F)===g;return!L.hasAttribute(F)}function Y(L){return L.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function b(L){if(L instanceof Element)return L;if("host"in L)return L.host;if("element"in L)return L.element;return null}function U(L){if(L instanceof Element)return L;if("host"in L)return L.host;if("element"in L)return L.element;return L}function B(L){return C({type:"context",...L})}function D(L){return E(L)}var H;((q)=>{q.SUBSCRIPTION_REQUEST="context-subscription-request";q.CONTEXT_REQUEST="context-request";q.ON_MOUNT="context-on-mount";q.MOUNTED="context-mounted"})(H||={});class _ extends Event{context;callback;subscribe;handled=!1;constructor(L,f,g){super("context-request",{bubbles:!0,composed:!0});this.context=L;this.callback=f;this.subscribe=g}markHandled(){this.handled=!0}}class Z extends CustomEvent{constructor(L){super("context-on-mount",{detail:{context:L},bubbles:!0,composed:!0})}}class I extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(L,f,g,j,q){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=L;this.callback=f;this.select=g;this.subscribe=j;this.onSubscribe=q}markHandled(){this.handled=!0}}import{createMarkupNodeLike as R}from"@ecopages/jsx";class x{host;context;hydrationKey;hydrate;serialize;pendingHostHydration;value;subscriptions=[];constructor(L,f){this.host=L,this.context=f.context,this.hydrationKey=f.hydrationKey,this.hydrate=f.hydrate,this.serialize=f.serialize,this.pendingHostHydration=Boolean(f.hydrate),this.value=f.initialValue,this.tryHydrateFromHost(),this.registerEvents(),this.host.dispatchEvent(new Z(this.context))}setContext=(L,f)=>{if(this.tryHydrateFromHost(),this.pendingHostHydration=!1,typeof this.value>"u"&&this.isObject(L)){let g=this.value;if(this.value={...L},f)f(this.value);this.notifySubscribers(this.value,g);return}if(this.isObject(this.value)&&this.isObject(L)){let g={...this.value};if(this.value={...this.value,...L},f)f(this.value);this.notifySubscribers(this.value,g)}};getContext=()=>{return this.tryHydrateFromHost(),this.value};getContextKey=()=>{return this.context};serializeHydrationValue=()=>{if(this.tryHydrateFromHost(),!this.hydrate||typeof this.value>"u")return;let L=this.serialize?this.serialize(this.value):this.value;if(typeof L>"u")return;let f=JSON.stringify(L);if(typeof f!=="string")return;return D(f)};renderHydrationScriptTag=()=>{let L=this.serializeHydrationValue();if(!L)return;return B({hydrationKey:this.hydrationKey,serializedValue:L})};renderHydrationScript=()=>{let L=this.renderHydrationScriptTag();if(!L)return;return R(L)};subscribe=(L)=>{let f={hasChanged:(g,j)=>{if(typeof j>"u"||!L.select)return!0;return L.select(g)!==L.select(j)},notify:(g)=>{if(L.select){L.callback(L.select(g),f.unsubscribe);return}L.callback(g,f.unsubscribe)},unsubscribe:()=>{let g=this.subscriptions.indexOf(f);if(g!==-1)this.subscriptions.splice(g,1)}};return this.subscriptions.push(f),f.unsubscribe};tryHydrateFromHost(){if(!this.pendingHostHydration)return;let L=this.findHydrationScriptElement();if(!L)return;this.value=this.mergeHydrationValue(M(L,this.value)),this.pendingHostHydration=!1}mergeHydrationValue(L){if(this.hydrate===Object&&this.isObject(L)&&(this.isObject(this.value)||typeof this.value>"u"))return{...this.value??{},...L};return L}isObject(L){return typeof L==="object"&&!Array.isArray(L)&&L!==null}findHydrationScriptElement(){return O(U(this.host),"context",this.hydrationKey)}notifySubscribers=(L,f)=>{for(let g of this.subscriptions)if(g.hasChanged(L,f))g.notify(L)};handleSubscriptionRequest=(L,{subscribe:f,onSubscribe:g})=>{this.tryHydrateFromHost();let j=f?this.subscribe(L):void 0;if(j)g?.(j);if(typeof this.value>"u")return;if(L.select)L.callback(L.select(this.value),j);else L.callback(this.value,j)};onSubscriptionRequest=(L)=>{let{context:f,callback:g,subscribe:j,select:q,target:G,onSubscribe:Q}=L;if(f!==this.context)return;if(L.markHandled(),L.stopPropagation(),G instanceof EventTarget)G.dispatchEvent(new Z(this.context));if(q){this.handleSubscriptionRequest({select:q,callback:g},{subscribe:j,onSubscribe:Q});return}this.handleSubscriptionRequest({callback:g},{subscribe:j,onSubscribe:Q})};onContextRequest=(L)=>{let{context:f,callback:g}=L;if(f!==this.context)return;L.markHandled(),L.stopPropagation(),g(this)};registerEvents=()=>{this.host.addEventListener("context-subscription-request",this.onSubscriptionRequest),this.host.addEventListener("context-request",this.onContextRequest)}}export{x as ContextProvider};
|
|
2
|
+
|
|
3
|
+
//# debugId=BE335AF97827A95C64756E2164756E21
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"import { escapeScriptJson } from '../tools/escape-script-json';\n\n/** Attribute marker used to identify hydration payloads inside a host. */\nexport const HYDRATION_ATTRIBUTE = 'data-hydration';\n/** Discriminator that scopes a hydration payload to a specific feature. */\nexport const HYDRATION_TYPE_ATTRIBUTE = 'data-hydration-type';\n/** Optional key that scopes a hydration payload to a specific decorated field. */\nexport const HYDRATION_KEY_ATTRIBUTE = 'data-hydration-key';\n\nexport type HydrationPayloadType = 'signal' | 'context';\n\ntype HydrationScriptHost = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\n/** Creates a `<script type=\"application/json\">` tag for a hydration payload. */\nexport function createHydrationScriptTag(options: {\n\ttype: HydrationPayloadType;\n\thydrationKey?: string;\n\tserializedValue: string;\n}): string {\n\tconst keyAttribute = options.hydrationKey\n\t\t? ` ${HYDRATION_KEY_ATTRIBUTE}=\"${escapeHtmlAttribute(options.hydrationKey)}\"`\n\t\t: '';\n\n\treturn `<script type=\"application/json\" ${HYDRATION_ATTRIBUTE} ${HYDRATION_TYPE_ATTRIBUTE}=\"${options.type}\"${keyAttribute}>${options.serializedValue}</script>`;\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeHydrationJson(value: string): string {\n\treturn escapeScriptJson(value);\n}\n\n/** Parses JSON from a hydration script element, returning the fallback on failure. */\nexport function parseHydrationPayload<T>(element: Element, fallback: T): T {\n\tconst textContent = element.textContent;\n\n\tif (!textContent) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(textContent) as T;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn(\n\t\t\t\t`[@ecopages/radiant] Failed to parse hydration payload from <script ${HYDRATION_ATTRIBUTE}>:`,\n\t\t\t\ttextContent.slice(0, 120),\n\t\t\t);\n\t\t}\n\t\treturn fallback;\n\t}\n}\n\n/**\n * Finds a hydration script element inside a host by type and optional key.\n *\n * When a key is provided, looks for an exact `data-hydration-key` match.\n * Otherwise, returns the first unkeyed script matching the type.\n */\nexport function findHydrationScript(\n\thost: HydrationScriptHost,\n\ttype: HydrationPayloadType,\n\thydrationKey?: string,\n): Element | null {\n\tconst children = host.children;\n\n\tif (!children || children.length === 0) {\n\t\tconst childNodes = (host as Partial<{ childNodes: ArrayLike<{ nodeType: number }> }>).childNodes;\n\n\t\tif (!childNodes || childNodes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (let i = 0; i < childNodes.length; i += 1) {\n\t\t\tconst node = childNodes[i]!;\n\n\t\t\tif (node.nodeType !== 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst element = node as unknown as Element;\n\n\t\t\tif (matchesHydrationScript(element, type, hydrationKey)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfor (let i = 0; i < children.length; i += 1) {\n\t\tif (matchesHydrationScript(children[i]!, type, hydrationKey)) {\n\t\t\treturn children[i]!;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction matchesHydrationScript(element: Element, type: HydrationPayloadType, hydrationKey?: string): boolean {\n\tif (\n\t\telement.tagName !== 'SCRIPT' ||\n\t\t!element.hasAttribute(HYDRATION_ATTRIBUTE) ||\n\t\telement.getAttribute(HYDRATION_TYPE_ATTRIBUTE) !== type\n\t) {\n\t\treturn false;\n\t}\n\n\tif (hydrationKey !== undefined) {\n\t\treturn element.getAttribute(HYDRATION_KEY_ATTRIBUTE) === hydrationKey;\n\t}\n\n\treturn !element.hasAttribute(HYDRATION_KEY_ATTRIBUTE);\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n",
|
|
7
7
|
"import type { UnknownContext } from './types';\n\ntype ContextHostApi = {\n\taddEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void;\n\tremoveEventListener(\n\t\ttype: string,\n\t\tlistener: EventListenerOrEventListenerObject,\n\t\toptions?: boolean | EventListenerOptions,\n\t): void;\n\tdispatchEvent(event: Event): boolean;\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tconnectedContextCallback(context: UnknownContext): void;\n\tregisterContextProvider(name: string, provider: unknown): void;\n};\n\ntype SsrHydrationContainer = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\nexport type ContextHydrationHost = Element | SsrHydrationContainer;\n\nexport type ContextHostLike =\n\t| (ContextHostApi & Element)\n\t| (ContextHostApi & { host: Element })\n\t| (ContextHostApi & { element: Element })\n\t| (ContextHostApi & SsrHydrationContainer);\n\nexport function resolveContextHostElement(host: ContextHostLike): Element | null {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\tif ('element' in host) {\n\t\treturn host.element;\n\t}\n\n\treturn null;\n}\n\nexport function resolveContextHydrationHost(host: ContextHostLike): ContextHydrationHost {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\tif ('element' in host) {\n\t\treturn host.element;\n\t}\n\n\treturn host;\n}\n",
|
|
8
8
|
"import { createHydrationScriptTag, escapeHydrationJson } from '../core/hydration-codec';\n\n/**\n * Creates the raw `<script type=\"application/json\">` tag used to hydrate a\n * serialized context provider.\n */\nexport function createContextHydrationScriptTag(options: { hydrationKey?: string; serializedValue: string }): string {\n\treturn createHydrationScriptTag({ type: 'context', ...options });\n}\n\n/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * script tag.\n */\nexport function escapeContextHydrationJson(value: string): string {\n\treturn escapeHydrationJson(value);\n}\n",
|
|
9
|
-
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\
|
|
9
|
+
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\tDirectContextSubscription<T> | SelectedContextSubscription<T, Selected>;\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
|
|
10
10
|
"import { createMarkupNodeLike, type JsxRenderable } from '@ecopages/jsx';\nimport type { SsrSerializableHydrationBinding } from '../core/ssr-hydration-binding';\nimport type { AttributeTypeConstant } from '../utils/attribute-utils';\nimport {\n\tContextEventsTypes,\n\tContextOnMountEvent,\n\ttype ContextRequestEvent,\n\ttype ContextSubscription,\n\ttype ContextSubscriptionRequestEvent,\n} from './events';\nimport { findHydrationScript, parseHydrationPayload } from '../core/hydration-codec';\nimport { createContextHydrationScriptTag, escapeContextHydrationJson } from './hydration-script';\nimport type { Context, ContextType, UnknownContext } from './types';\nimport { resolveContextHydrationHost, type ContextHostLike } from './context-host';\n\ntype ContextProviderOptions<T extends UnknownContext> = {\n\tcontext: UnknownContext;\n\thydrationKey?: string;\n\tinitialValue?: T['__context__'];\n\thydrate?: AttributeTypeConstant;\n\tserialize?: (value: ContextType<T>) => unknown;\n};\n\ntype ActiveContextSubscription<T extends UnknownContext> = {\n\thasChanged(newContext: ContextType<T>, prevContext: ContextType<T> | undefined): boolean;\n\tnotify(context: ContextType<T>): void;\n\tunsubscribe: () => void;\n};\n\nexport interface SsrSerializableContextProvider extends SsrSerializableHydrationBinding {\n\t/** Returns the current context payload that should be visible to descendants. */\n\tgetContext(): unknown;\n\t/** Returns the context token used to match nested SSR consumers and providers. */\n\tgetContextKey(): UnknownContext;\n}\n\n/**\n * Represents a context provider that allows setting and getting the context,\n * as well as subscribing to context updates.\n *\n * @template T - The type of the context.\n */\nexport interface IContextProvider<T extends Context<unknown, unknown>> {\n\t/**\n\t * Sets the context with the provided update and invokes the optional callback function.\n\t *\n\t * @param update - The partial update to be applied to the context.\n\t * @param callback - An optional callback function that receives the updated context.\n\t */\n\tsetContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;\n\n\t/**\n\t * Gets the current context.\n\t *\n\t * @returns The current context.\n\t */\n\tgetContext: () => ContextType<T>;\n\n\t/**\n\t * Subscribes to context updates.\n\t *\n\t * @param subscription - The subscription object that defines the callback function to be invoked on context updates.\n\t */\n\tsubscribe: <Selected = ContextType<T>>(subscription: ContextSubscription<T, Selected>) => () => void;\n}\n\n/**\n * It creates a context provider that allows setting and getting the context,\n * It will also be in charge of notifying the subscribers when the context changes.\n *\n * @template T - The type of the context.\n * @implements IContextProvider\n *\n * @example\n * ```ts\n * export class MyElement extends RadiantElement {\n * provider = new ContextProvider<typeof myContext>(this, {\n * context: myContext,\n * initialValue: {\n * value: 'Hello World',\n * },\n * });\n * ```\n */\nexport class ContextProvider<T extends Context<unknown, unknown>>\n\timplements IContextProvider<T>, SsrSerializableContextProvider\n{\n\tprivate host: ContextHostLike;\n\tprivate context: UnknownContext;\n\tprivate hydrationKey?: string;\n\tprivate hydrate?: AttributeTypeConstant;\n\tprivate serialize?: (value: ContextType<T>) => unknown;\n\tprivate pendingHostHydration: boolean;\n\tprivate value: ContextType<T> | undefined;\n\n\tsubscriptions: ActiveContextSubscription<T>[] = [];\n\n\t/**\n\t * Creates a new instance of the ContextProvider.\n\t *\n\t * @param host - The host element that will contain the context provider.\n\t * @param options - The options to configure the context provider.\n\t */\n\tconstructor(host: ContextHostLike, options: ContextProviderOptions<T>) {\n\t\tthis.host = host;\n\t\tthis.context = options.context;\n\t\tthis.hydrationKey = options.hydrationKey;\n\t\tthis.hydrate = options.hydrate;\n\t\tthis.serialize = options.serialize;\n\t\tthis.pendingHostHydration = Boolean(options.hydrate);\n\t\tthis.value = options.initialValue as ContextType<T>;\n\t\tthis.tryHydrateFromHost();\n\n\t\tthis.registerEvents();\n\t\tthis.host.dispatchEvent(new ContextOnMountEvent(this.context));\n\t}\n\n\tsetContext = (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => {\n\t\tthis.tryHydrateFromHost();\n\t\tthis.pendingHostHydration = false;\n\n\t\tif (typeof this.value === 'undefined' && this.isObject(update)) {\n\t\t\tconst oldContext = this.value;\n\t\t\tthis.value = { ...update } as ContextType<T>;\n\t\t\tif (callback) callback(this.value);\n\t\t\tthis.notifySubscribers(this.value, oldContext);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.isObject(this.value) && this.isObject(update)) {\n\t\t\tconst oldContext = { ...this.value };\n\t\t\tthis.value = { ...this.value, ...update };\n\t\t\tif (callback) callback(this.value);\n\t\t\tthis.notifySubscribers(this.value, oldContext);\n\t\t}\n\t};\n\n\tgetContext = () => {\n\t\tthis.tryHydrateFromHost();\n\t\treturn this.value as ContextType<T>;\n\t};\n\n\t/**\n\t * Returns the provider's logical context token.\n\t *\n\t * SSR helpers use this token to resolve the closest matching provider while a\n\t * host subtree is being serialized.\n\t */\n\tgetContextKey = () => {\n\t\treturn this.context;\n\t};\n\n\t/**\n\t * Serializes the current provider value for inclusion in a hydration script.\n\t *\n\t * The serialized payload is JSON-escaped so it can be embedded safely inside a\n\t * `<script type=\"application/json\">` tag.\n\t */\n\tserializeHydrationValue = (): string | undefined => {\n\t\tthis.tryHydrateFromHost();\n\n\t\tif (!this.hydrate || typeof this.value === 'undefined') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst hydrationValue = this.serialize ? this.serialize(this.value) : this.value;\n\n\t\tif (typeof hydrationValue === 'undefined') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst serializedValue = JSON.stringify(hydrationValue);\n\n\t\tif (typeof serializedValue !== 'string') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn escapeContextHydrationJson(serializedValue);\n\t};\n\n\t/**\n\t * Builds the raw HTML hydration script for this provider.\n\t *\n\t * When `hydrationKey` is present, the marker is scoped so sibling or nested\n\t * providers can recover their own payloads without accidentally reading a\n\t * descendant script.\n\t */\n\trenderHydrationScriptTag = (): string | undefined => {\n\t\tconst serializedValue = this.serializeHydrationValue();\n\n\t\tif (!serializedValue) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn createContextHydrationScriptTag({\n\t\t\thydrationKey: this.hydrationKey,\n\t\t\tserializedValue,\n\t\t});\n\t};\n\n\t/**\n\t * Wraps the provider hydration script in a minimal JSX node-like value.\n\t *\n\t * This lets JSX-based host renderers append the script without needing a real\n\t * DOM element instance during SSR.\n\t */\n\trenderHydrationScript = (): JsxRenderable | undefined => {\n\t\tconst outerHTML = this.renderHydrationScriptTag();\n\n\t\tif (!outerHTML) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn createMarkupNodeLike(outerHTML);\n\t};\n\n\tsubscribe = <Selected = ContextType<T>>(subscriptionSpec: ContextSubscription<T, Selected>) => {\n\t\tconst subscription: ActiveContextSubscription<T> = {\n\t\t\thasChanged: (newContext, prevContext) => {\n\t\t\t\tif (typeof prevContext === 'undefined' || !subscriptionSpec.select) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn subscriptionSpec.select(newContext) !== subscriptionSpec.select(prevContext);\n\t\t\t},\n\t\t\tnotify: (context) => {\n\t\t\t\tif (subscriptionSpec.select) {\n\t\t\t\t\tsubscriptionSpec.callback(subscriptionSpec.select(context), subscription.unsubscribe);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsubscriptionSpec.callback(context, subscription.unsubscribe);\n\t\t\t},\n\t\t\tunsubscribe: () => {\n\t\t\t\tconst index = this.subscriptions.indexOf(subscription);\n\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tthis.subscriptions.splice(index, 1);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tthis.subscriptions.push(subscription);\n\n\t\treturn subscription.unsubscribe;\n\t};\n\n\tprivate tryHydrateFromHost(): void {\n\t\tif (!this.pendingHostHydration) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst hydrationScriptElement = this.findHydrationScriptElement();\n\n\t\tif (!hydrationScriptElement) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.value = this.mergeHydrationValue(\n\t\t\tparseHydrationPayload(hydrationScriptElement, this.value) as ContextType<T>,\n\t\t);\n\t\tthis.pendingHostHydration = false;\n\t}\n\n\tprivate mergeHydrationValue(parsedHydrationValue: ContextType<T>): ContextType<T> {\n\t\tif (\n\t\t\tthis.hydrate === Object &&\n\t\t\tthis.isObject(parsedHydrationValue) &&\n\t\t\t(this.isObject(this.value) || typeof this.value === 'undefined')\n\t\t) {\n\t\t\treturn {\n\t\t\t\t...(this.value ?? {}),\n\t\t\t\t...parsedHydrationValue,\n\t\t\t} as ContextType<T>;\n\t\t}\n\n\t\treturn parsedHydrationValue;\n\t}\n\n\tprivate isObject(value: unknown): value is Record<string, unknown> {\n\t\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n\t}\n\n\tprivate findHydrationScriptElement(): Element | null {\n\t\treturn findHydrationScript(resolveContextHydrationHost(this.host), 'context', this.hydrationKey);\n\t}\n\n\tprivate notifySubscribers = (newContext: ContextType<T>, prevContext: ContextType<T> | undefined) => {\n\t\tfor (const sub of this.subscriptions) {\n\t\t\tif (sub.hasChanged(newContext, prevContext)) {\n\t\t\t\tsub.notify(newContext);\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate handleSubscriptionRequest = (\n\t\tsubscription: ContextSubscription<T, unknown>,\n\t\t{\n\t\t\tsubscribe,\n\t\t\tonSubscribe,\n\t\t}: {\n\t\t\tsubscribe?: boolean;\n\t\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t\t},\n\t) => {\n\t\tthis.tryHydrateFromHost();\n\t\tconst unsubscribe = subscribe ? this.subscribe(subscription) : undefined;\n\n\t\tif (unsubscribe) {\n\t\t\tonSubscribe?.(unsubscribe);\n\t\t}\n\n\t\tif (typeof this.value === 'undefined') return;\n\n\t\tif (subscription.select) {\n\t\t\tsubscription.callback(subscription.select(this.value), unsubscribe);\n\t\t} else {\n\t\t\tsubscription.callback(this.value, unsubscribe);\n\t\t}\n\t};\n\n\tprivate onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n\t\tconst { context, callback, subscribe, select, target, onSubscribe } = event;\n\t\tif (context !== this.context) return;\n\n\t\tevent.markHandled();\n\t\tevent.stopPropagation();\n\n\t\tif (target instanceof EventTarget) {\n\t\t\ttarget.dispatchEvent(new ContextOnMountEvent(this.context));\n\t\t}\n\n\t\tif (select) {\n\t\t\tthis.handleSubscriptionRequest({ select, callback }, { subscribe, onSubscribe });\n\t\t\treturn;\n\t\t}\n\n\t\tthis.handleSubscriptionRequest({ callback }, { subscribe, onSubscribe });\n\t};\n\n\tprivate onContextRequest = (event: ContextRequestEvent<UnknownContext>) => {\n\t\tconst { context, callback } = event;\n\t\tif (context !== this.context) return;\n\t\tevent.markHandled();\n\t\tevent.stopPropagation();\n\t\tcallback(this);\n\t};\n\n\tprivate registerEvents = () => {\n\t\tthis.host.addEventListener(\n\t\t\tContextEventsTypes.SUBSCRIPTION_REQUEST,\n\t\t\tthis.onSubscriptionRequest as EventListener,\n\t\t);\n\t\tthis.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.on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0B,CAAE,UAAS,EAAG,CAAE,YAAW,aAAY,CAAC,GAGhE,iBAAmB,CAAC,IAA+C,CAC1E,IAAQ,UAAS,YAAa,EAC9B,GAAI,IAAY,KAAK,QAAS,OAC9B,EAAM,YAAY,EAClB,EAAM,gBAAgB,EACtB,EAAS,IAAI,GAGN,eAAiB,IAAM,CAC9B,KAAK,KAAK,gDAET,KAAK,qBACN,EACA,KAAK,KAAK,mCAAqD,KAAK,gBAAiC,EAEvG",
|
|
13
|
+
"debugId": "BE335AF97827A95C64756E2164756E21",
|
|
14
14
|
"names": []
|
|
15
15
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:j,getOwnPropertyNames:u,getOwnPropertyDescriptor:w}=Object,y=Object.prototype.hasOwnProperty;function z(d){return this[d]}var H=(d)=>{var f=(k??=new WeakMap).get(d),h;if(f)return f;if(f=j({},"__esModule",{value:!0}),d&&typeof d==="object"||typeof d==="function"){for(var i of u(d))if(!y.call(f,i))j(f,i,{get:z.bind(d,i),enumerable:!(h=w(d,i))||h.enumerable})}return k.set(d,f),f},k;var A=(d)=>d;function F(d,f){this[d]=A.bind(null,f)}var J=(d,f)=>{for(var h in f)j(d,h,{get:f[h],enumerable:!0,configurable:!0,set:F.bind(f,h)})};var K=(d,f)=>()=>(d&&(f=d(d=0)),f);var Q=((d)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(d,{get:(f,h)=>(typeof require<"u"?require:f)[h]}):d)(function(d){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+d+'" is not supported')});var m=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function q(){return globalThis}function W(d){q()[m]=d}function Z(d){return q()[m]?.(d)}export{Z as resolveAmbientSsrContextProvider,W as installSsrContextProviderResolver};
|
|
2
|
+
|
|
3
|
+
//# debugId=44948C69A439D1B664756E2164756E21
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"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"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "i0BAKA,IAAM,EAAuC,OAAO,IAAI,iDAAiD,EAMzG,SAAS,CAAsB,EAAwB,CACtD,OAAO,WAUD,SAAS,CAAiC,CAAC,EAA4C,CAC7F,EAAuB,EAAE,GAAwC,EAM3D,SAAS,CAAgC,CAAC,EAAqE,CACrH,OAAO,EAAuB,EAAE,KAAwC,CAAO",
|
|
8
|
+
"debugId": "44948C69A439D1B664756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:q,getOwnPropertyNames:B,getOwnPropertyDescriptor:D}=Object,E=Object.prototype.hasOwnProperty;function F(d){return this[d]}var I=(d)=>{var g=(z??=new WeakMap).get(d),m;if(g)return g;if(g=q({},"__esModule",{value:!0}),d&&typeof d==="object"||typeof d==="function"){for(var p of B(d))if(!E.call(g,p))q(g,p,{get:F.bind(d,p),enumerable:!(m=D(d,p))||m.enumerable})}return z.set(d,g),g},z;var G=(d)=>d;function H(d,g){this[d]=G.bind(null,g)}var J=(d,g)=>{for(var m in g)q(d,m,{get:g[m],enumerable:!0,configurable:!0,set:H.bind(g,m)})};var K=(d,g)=>()=>(d&&(g=d(d=0)),g);var L=((d)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(d,{get:(g,m)=>(typeof require<"u"?require:g)[m]}):d)(function(d){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+d+'" is not supported')});var N=(d)=>d;export{N as createContext};
|
|
2
|
+
|
|
3
|
+
//# debugId=A3863BC82F4C5B8964756E2164756E21
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { Context } from './types';\n\n/**\n * A function which creates a Context value object\n */\nexport const createContext = <ValueType>(key: unknown) => key as Context<typeof key, ValueType>;\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "i0BAKO,IAAM,EAAgB,CAAY,IAAiB",
|
|
8
|
+
"debugId": "A3863BC82F4C5B8964756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:y,getOwnPropertyNames:S,getOwnPropertyDescriptor:A}=Object,z=Object.prototype.hasOwnProperty;function m(d){return this[d]}var o=(d)=>{var M=(Z??=new WeakMap).get(d),F;if(M)return M;if(M=y({},"__esModule",{value:!0}),d&&typeof d==="object"||typeof d==="function"){for(var u of S(d))if(!z.call(M,u))y(M,u,{get:m.bind(d,u),enumerable:!(F=A(d,u))||F.enumerable})}return Z.set(d,M),M},Z;var C=(d)=>d;function r(d,M){this[d]=C.bind(null,M)}var n=(d,M)=>{for(var F in M)y(d,F,{get:M[F],enumerable:!0,configurable:!0,set:r.bind(M,F)})};var s=(d,M)=>()=>(d&&(M=d(d=0)),M);var i=((d)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(d,{get:(M,F)=>(typeof require<"u"?require:M)[F]}):d)(function(d){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+d+'" is not supported')});var $=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),U=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),x=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function e(d,M){Y(d,$,M)}function X(d,M){Y(d,U,M)}function dd(d){l(d,$)}function Md(d,M){let F=d;v(d,M,F[x]??=new Set)}function Y(d,M,F){let u=d,f=Object.prototype.hasOwnProperty.call(u,M)?u[M]:void 0;if(Array.isArray(f)){f.push(F);return}Object.defineProperty(u,M,{value:[F]})}function l(d,M){a(d,(F)=>{let u=F[M];if(!Array.isArray(u))return;for(let f of u)f(d)})}function v(d,M,F){for(let u of K(d)){let f=u[U];if(!Array.isArray(f))continue;for(let H of f){if(F.has(H))continue;H(d,M),F.add(H)}}}function K(d){let M=[],F=Object.getPrototypeOf(d);while(F&&F!==Object.prototype)M.unshift(F),F=Object.getPrototypeOf(F);return M}function a(d,M){for(let F of K(d))M(F)}var g=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),G=Symbol.for("@ecopages/radiant.ssr-preparation-running");function R(d,M){let u=d[g];if(Array.isArray(u)){u.push(M);return}Object.defineProperty(d,g,{value:[M],configurable:!0})}function ud(d){let M=d,F=M[g];if(!Array.isArray(F))return;M[G]=!0;try{for(let u of F)u()}finally{delete M[G]}}function c(d){return typeof d==="function"}function N(d,M,F,u){if(typeof u==="object")return d(void 0,u);return M(F,u)}function Hd(d,M,F,u,f){if(typeof u==="object"){if(!c(F))throw TypeError("Standard method decorators require a method target");return d(F,u)}if(!f)throw TypeError("Legacy method decorators require a property descriptor");return M(F,u,f)}var O=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function h(){return globalThis}function Dd(d){h()[O]=d}function P(d){return h()[O]?.(d)}var b;((f)=>{f.SUBSCRIPTION_REQUEST="context-subscription-request";f.CONTEXT_REQUEST="context-request";f.ON_MOUNT="context-on-mount";f.MOUNTED="context-mounted"})(b||={});class B extends Event{context;callback;subscribe;handled=!1;constructor(d,M,F){super("context-request",{bubbles:!0,composed:!0});this.context=d;this.callback=M;this.subscribe=F}markHandled(){this.handled=!0}}class p extends CustomEvent{constructor(d){super("context-on-mount",{detail:{context:d},bubbles:!0,composed:!0})}}class J extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(d,M,F,u,f){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=d;this.callback=M;this.select=F;this.subscribe=u;this.onSubscribe=f}markHandled(){this.handled=!0}}function Q(d,M,F,u={}){let f=P(M);if(!f)return!1;if(F(f),d.connectedContextCallback(M),u.emitMounted)d.dispatchEvent(new CustomEvent("context-mounted",{detail:f}));return!0}function k(d,M,F,u={}){let f=new B(M,(H)=>{if(F(H),d.connectedContextCallback(M),u.emitMounted)d.dispatchEvent(new CustomEvent("context-mounted",{detail:H}))});return d.dispatchEvent(f),f.handled}function j(d,M){let F=P(d);if(!F)return!1;let u=F.getContext();if(M.select)return M.callback(M.select(u)),!0;return M.callback(u),!0}function T(d,M,F,u){let f=new J(M,F.callback,F.select,u.subscribe,u.onSubscribe);return d.dispatchEvent(f),f.handled}function V(d,M,F,u={}){return q(d,()=>Q(d,M,F,u))}function Jd(d,M,F,u){return q(d,()=>{if(u)return j(M,{callback:F,select:u});return j(M,{callback:F})})}function L(d,M,F,u={}){if(Q(d,M,F,u))return!0;return k(d,M,F,u)}function Qd(d,M,F,u={}){if(u.select){let H={callback:F,select:u.select};if(j(M,H))return!0;return T(d,M,H,{subscribe:u.subscribe,onSubscribe:u.onSubscribe})}let f={callback:F};if(j(M,f))return!0;return T(d,M,f,{subscribe:u.subscribe,onSubscribe:u.onSubscribe})}function q(d,M){return R(d,M),M()}function I(d){return(M,F)=>{let u=(H,w)=>{H[F]=w},f=(H,w={})=>{if(H[F])return!0;return L(H,d,(D)=>{u(H,D)},w)};X(M,(H)=>{if(V(H,d,(w)=>{u(H,w)}))return;H.registerConnectedCallback(()=>{if(f(H,{emitMounted:!0}))return;queueMicrotask(()=>{f(H,{emitMounted:!0})})})})}}function _(d){return(M,F)=>{let u=String(F.name),f=(w,D)=>{let W=w;W[u]=D},H=(w,D={})=>{if(w[u])return!0;return L(w,d,(E)=>{f(w,E)},D)};F.addInitializer(function(){if(V(this,d,(w)=>{f(this,w)},{emitMounted:!0}))return;this.registerConnectedCallback(()=>{if(H(this,{emitMounted:!0}))return;queueMicrotask(()=>{H(this,{emitMounted:!0})})})})}}function Rd(d){function M(F,u){return N(_(d),I(d),F,u)}return M}export{Rd as consumeContext};
|
|
2
|
+
|
|
3
|
+
//# debugId=D63958FC51274CE064756E2164756E21
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/core/ssr-preparation.ts", "../src/decorators/bridge.ts", "../src/context/context-ssr-bridge.ts", "../src/context/events.ts", "../src/context/context-consumer-runtime.ts", "../src/context/context-consumer-bootstrap.ts", "../src/context/decorators/legacy/consume-context.ts", "../src/context/decorators/standard/consume-context.ts", "../src/context/decorators/consume-context.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\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\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\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\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<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\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
|
+
"type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol.for('@ecopages/radiant.ssr-preparation-callbacks');\nexport const SSR_PREPARATION_RUNNING = Symbol.for('@ecopages/radiant.ssr-preparation-running');\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\n}\n",
|
|
7
|
+
"import type { Method } from '../types';\n\ntype StandardFieldFn<Host extends object, Value, Result> = (\n\ttarget: undefined,\n\tcontext: ClassFieldDecoratorContext<Host, Value>,\n) => Result;\n\ntype LegacyFieldFn<Proto, Result> = (proto: Proto, name: string) => Result;\n\ntype StandardMethodFn<Host extends object, TMethod extends Method, Result> = (\n\ttarget: TMethod,\n\tcontext: ClassMethodDecoratorContext<Host, TMethod>,\n) => Result;\n\ntype LegacyMethodFn<Proto, Result> = (proto: Proto, name: string, descriptor: PropertyDescriptor) => Result;\n\nfunction isMethod(value: unknown): value is Method {\n\treturn typeof value === 'function';\n}\n\nexport function fieldDecoratorBridge<Host extends object, Value, Result, Proto>(\n\tstandard: StandardFieldFn<Host, Value, Result>,\n\tlegacy: LegacyFieldFn<Proto, void>,\n\tprotoOrTarget: undefined,\n\tnameOrContext: ClassFieldDecoratorContext<Host, Value>,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, Proto, Result>(\n\tstandard: StandardFieldFn<Host, Value, void>,\n\tlegacy: LegacyFieldFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardFieldFn<Host, Value, StandardResult>,\n\tlegacy: LegacyFieldFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | undefined,\n\tnameOrContext: string | ClassFieldDecoratorContext<Host, Value>,\n): StandardResult | LegacyResult;\n\nexport function fieldDecoratorBridge(\n\tstandard: StandardFieldFn<object, unknown, unknown>,\n\tlegacy: LegacyFieldFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassFieldDecoratorContext<object, unknown>,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\treturn standard(undefined, nameOrContext);\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext);\n}\n\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Result, Proto>(\n\tstandard: StandardMethodFn<Host, TMethod, Result>,\n\tlegacy: LegacyMethodFn<Proto, void>,\n\tprotoOrTarget: TMethod,\n\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: undefined,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Proto, Result>(\n\tstandard: StandardMethodFn<Host, TMethod, void>,\n\tlegacy: LegacyMethodFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n\tdescriptor: PropertyDescriptor,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardMethodFn<Host, TMethod, StandardResult>,\n\tlegacy: LegacyMethodFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | TMethod,\n\tnameOrContext: string | ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: PropertyDescriptor,\n): StandardResult | LegacyResult;\n\nexport function methodDecoratorBridge(\n\tstandard: StandardMethodFn<object, Method, unknown>,\n\tlegacy: LegacyMethodFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassMethodDecoratorContext<object, Method>,\n\tdescriptor?: PropertyDescriptor,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\tif (!isMethod(protoOrTarget)) {\n\t\t\tthrow new TypeError('Standard method decorators require a method target');\n\t\t}\n\n\t\treturn standard(protoOrTarget, nameOrContext);\n\t}\n\n\tif (!descriptor) {\n\t\tthrow new TypeError('Legacy method decorators require a property descriptor');\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext, descriptor);\n}\n",
|
|
8
|
+
"import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
|
|
9
|
+
"import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n\tSUBSCRIPTION_REQUEST = 'context-subscription-request',\n\tCONTEXT_REQUEST = 'context-request',\n\tON_MOUNT = 'context-on-mount',\n\tMOUNTED = 'context-mounted',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<ContextType<T>>,\n\t\tpublic readonly subscribe?: boolean,\n\t) {\n\t\tsuper(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\ntype DirectContextSubscription<T extends UnknownContext> = {\n\tselect?: undefined;\n\tcallback: ContextCallback<ContextType<T>>;\n};\n\ntype SelectedContextSubscription<T extends UnknownContext, Selected> = {\n\tselect: (context: ContextType<T>) => Selected;\n\tcallback: ContextCallback<Selected>;\n};\n\nexport type ContextSubscription<T extends UnknownContext, Selected = ContextType<T>> =\n\tDirectContextSubscription<T> | SelectedContextSubscription<T, Selected>;\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n\tpublic constructor(context: UnknownContext) {\n\t\tsuper(ContextEventsTypes.ON_MOUNT, {\n\t\t\tdetail: { context },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext, Selected = ContextType<T>> extends Event {\n\tpublic handled = false;\n\n\tpublic constructor(\n\t\tpublic readonly context: T,\n\t\tpublic readonly callback: ContextCallback<Selected>,\n\t\tpublic readonly select?: (context: ContextType<T>) => Selected,\n\t\tpublic readonly subscribe?: boolean,\n\t\tpublic readonly onSubscribe?: (unsubscribe: () => void) => void,\n\t) {\n\t\tsuper(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t});\n\t}\n\n\tpublic markHandled(): void {\n\t\tthis.handled = true;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementEventMap {\n\t\t/**\n\t\t * A 'context-request-subscription' event can be emitted by any element which desires\n\t\t * a context value to be injected by an external provider.\n\t\t */\n\t\t[ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n\t\t/**\n\t\t * A context-request-provider event can be emitted by a context requester to signal\n\t\t * that it desires a context value to be provided by a context provider.\n\t\t */\n\t\t[ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n\t\t/**\n\t\t * A 'context-mount' event can be emitted by a context provider to signal\n\t\t * that a context value has been mounted and is available for consumption.\n\t\t */\n\t\t[ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n\t}\n}\n",
|
|
10
|
+
"import type { ContextHostLike } from './context-host';\nimport { resolveAmbientSsrContextProvider } from './context-ssr-bridge';\nimport { ContextEventsTypes, ContextRequestEvent, ContextSubscriptionRequestEvent } from './events';\nimport type { ContextCallback, ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\ntype DirectContextSelectionRequest<TContext extends UnknownContext> = {\n\tcallback: (value: ContextType<TContext>) => void;\n\tselect?: undefined;\n};\n\ntype SelectedContextSelectionRequest<TContext extends UnknownContext, Selected> = {\n\tcallback: (value: Selected) => void;\n\tselect: (context: ContextType<TContext>) => Selected;\n};\n\ntype ContextSelectionRequest<TContext extends UnknownContext, Selected = ContextType<TContext>> =\n\tDirectContextSelectionRequest<TContext> | SelectedContextSelectionRequest<TContext, Selected>;\n\n/**\n * Resolves a consumed context from the active SSR provider stack when one is available.\n *\n * This keeps SSR-specific lookup outside decorator implementations while preserving\n * the same consumer initialization contract for both standard and legacy decorators.\n *\n * @returns `true` when the context was resolved synchronously from SSR state.\n */\nexport function initializeConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tassign(provider);\n\thost.connectedContextCallback(context);\n\n\tif (options.emitMounted) {\n\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t}\n\n\treturn true;\n}\n\n/**\n * Requests a context provider through the DOM event channel when SSR state is not active.\n */\nexport function requestConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tconst event = new ContextRequestEvent(context, (provider) => {\n\t\tassign(provider);\n\t\thost.connectedContextCallback(context);\n\n\t\tif (options.emitMounted) {\n\t\t\thost.dispatchEvent(new CustomEvent(ContextEventsTypes.MOUNTED, { detail: provider }));\n\t\t}\n\t});\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n\n/**\n * Resolves a selected context value from the active SSR provider stack when available.\n *\n * @returns `true` when the selection callback was satisfied synchronously from SSR state.\n */\nexport function initializeContextSelection<TContext extends UnknownContext>(\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected>(\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n): boolean;\nexport function initializeContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n): boolean {\n\tconst provider = resolveAmbientSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn false;\n\t}\n\n\tconst resolvedContext = provider.getContext() as ContextType<TContext>;\n\n\tif (request.select) {\n\t\trequest.callback(request.select(resolvedContext));\n\t\treturn true;\n\t}\n\n\trequest.callback(resolvedContext);\n\treturn true;\n}\n\n/**\n * Requests a selected context value through the DOM event channel.\n */\nexport function requestContextSelection<TContext extends UnknownContext>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: DirectContextSelectionRequest<TContext>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: SelectedContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean;\nexport function requestContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\trequest: ContextSelectionRequest<TContext, Selected>,\n\toptions: {\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t},\n): boolean {\n\tconst event = new ContextSubscriptionRequestEvent(\n\t\tcontext,\n\t\trequest.callback as ContextCallback<Selected>,\n\t\trequest.select,\n\t\toptions.subscribe,\n\t\toptions.onSubscribe,\n\t);\n\n\thost.dispatchEvent(event);\n\treturn event.handled;\n}\n",
|
|
11
|
+
"import type { ContextHostLike } from './context-host';\nimport { registerSsrPreparationCallback } from '../core/ssr-preparation';\nimport {\n\tinitializeConsumedContext,\n\tinitializeContextSelection,\n\trequestConsumedContext,\n\trequestContextSelection,\n} from './context-consumer-runtime';\nimport type { ContextType, UnknownContext } from './types';\n\ntype ConsumedContextAssignment = (provider: unknown) => void;\n\n/**\n * Resolves a consumed context immediately and registers the same resolution to\n * run again during the later SSR preparation phase.\n *\n * This keeps constructor-time state and pre-serialization state aligned after\n * instance fields, props, or authored host content change during SSR setup.\n */\nexport function bootstrapSsrConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => initializeConsumedContext(host, context, assign, options));\n}\n\n/**\n * Resolves a selected context value immediately and registers the same\n * selection for the later SSR preparation phase.\n *\n * This lets nested SSR renders recompute selector-backed state after the host\n * has finished construction and any server-side configuration hooks have run.\n */\nexport function bootstrapSsrContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: object,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\tselect?: (context: ContextType<TContext>) => Selected,\n): boolean {\n\treturn registerAndResolveConsumerBootstrap(host, () => {\n\t\tif (select) {\n\t\t\treturn initializeContextSelection(context, { callback, select });\n\t\t}\n\n\t\treturn initializeContextSelection(context, {\n\t\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t\t});\n\t});\n}\n\n/**\n * Resolves a consumed context from SSR when available, otherwise requests it\n * through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectConsumedContext(\n\thost: ContextHostLike,\n\tcontext: UnknownContext,\n\tassign: ConsumedContextAssignment,\n\toptions: { emitMounted?: boolean } = {},\n): boolean {\n\tif (initializeConsumedContext(host, context, assign, options)) {\n\t\treturn true;\n\t}\n\n\treturn requestConsumedContext(host, context, assign, options);\n}\n\n/**\n * Resolves a selected context value from SSR when available, otherwise requests\n * it through the DOM event channel for the current client-side lifecycle pass.\n *\n * @returns `true` when the value was satisfied synchronously from SSR state.\n */\nexport function connectContextSelection<TContext extends UnknownContext, Selected = ContextType<TContext>>(\n\thost: ContextHostLike,\n\tcontext: TContext,\n\tcallback: (value: Selected) => void,\n\toptions: {\n\t\tselect?: (context: ContextType<TContext>) => Selected;\n\t\tsubscribe?: boolean;\n\t\tonSubscribe?: (unsubscribe: () => void) => void;\n\t} = {},\n): boolean {\n\tif (options.select) {\n\t\tconst request = { callback, select: options.select };\n\n\t\tif (initializeContextSelection(context, request)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn requestContextSelection(host, context, request, {\n\t\t\tsubscribe: options.subscribe,\n\t\t\tonSubscribe: options.onSubscribe,\n\t\t});\n\t}\n\n\tconst request = {\n\t\tcallback: callback as (value: ContextType<TContext>) => void,\n\t};\n\n\tif (initializeContextSelection(context, request)) {\n\t\treturn true;\n\t}\n\n\treturn requestContextSelection(host, context, request, {\n\t\tsubscribe: options.subscribe,\n\t\tonSubscribe: options.onSubscribe,\n\t});\n}\n\nfunction registerAndResolveConsumerBootstrap<TResult>(host: object, resolve: () => TResult): TResult {\n\tregisterSsrPreparationCallback(host, resolve);\n\treturn resolve();\n}\n",
|
|
12
|
+
"import type { ContextHostLike } from '../../context-host';\nimport { registerLegacyPostConstructionInitializer } from '../../../decorators/legacy/instance-initializers';\nimport { bootstrapSsrConsumedContext, connectConsumedContext } from '../../context-consumer-bootstrap';\nimport type { UnknownContext } from '../../types';\n\nexport function consumeContext(context: UnknownContext) {\n\treturn (proto: ContextHostLike, propertyKey: string) => {\n\t\tconst assignContextProvider = (element: ContextHostLike, provider: unknown) => {\n\t\t\t(element as any)[propertyKey] = provider;\n\t\t};\n\t\tconst initializeConsumedContextForHost = (\n\t\t\telement: ContextHostLike,\n\t\t\toptions: { emitMounted?: boolean } = {},\n\t\t) => {\n\t\t\tif ((element as any)[propertyKey]) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn connectConsumedContext(\n\t\t\t\telement,\n\t\t\t\tcontext,\n\t\t\t\t(provider) => {\n\t\t\t\t\tassignContextProvider(element, provider);\n\t\t\t\t},\n\t\t\t\toptions,\n\t\t\t);\n\t\t};\n\n\t\tregisterLegacyPostConstructionInitializer(proto, (element) => {\n\t\t\tif (\n\t\t\t\tbootstrapSsrConsumedContext(element, context, (provider) => {\n\t\t\t\t\tassignContextProvider(element, provider);\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\telement.registerConnectedCallback(() => {\n\t\t\t\tif (initializeConsumedContextForHost(element, { emitMounted: true })) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tinitializeConsumedContextForHost(element, { emitMounted: true });\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n}\n",
|
|
13
|
+
"import type { ContextHostLike } from '../../context-host';\nimport { bootstrapSsrConsumedContext, connectConsumedContext } from '../../context-consumer-bootstrap';\nimport type { UnknownContext } from '../../types';\n\nexport function consumeContext(consumedContext: UnknownContext) {\n\treturn <T extends ContextHostLike, V>(target: undefined, context: ClassFieldDecoratorContext<T, V>) => {\n\t\tvoid target;\n\t\tconst contextName = String(context.name);\n\t\tconst assignContextProvider = (host: T, provider: unknown) => {\n\t\t\tconst hostRecord = host as T & Record<string, unknown>;\n\t\t\thostRecord[contextName] = provider;\n\t\t};\n\t\tconst initializeConsumedContextForHost = (host: T, options: { emitMounted?: boolean } = {}) => {\n\t\t\tconst hostRecord = host as T & Record<string, unknown>;\n\n\t\t\tif (hostRecord[contextName]) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn connectConsumedContext(\n\t\t\t\thost,\n\t\t\t\tconsumedContext,\n\t\t\t\t(provider) => {\n\t\t\t\t\tassignContextProvider(host, provider);\n\t\t\t\t},\n\t\t\t\toptions,\n\t\t\t);\n\t\t};\n\n\t\tcontext.addInitializer(function (this: T) {\n\t\t\tif (\n\t\t\t\tbootstrapSsrConsumedContext(\n\t\t\t\t\tthis,\n\t\t\t\t\tconsumedContext,\n\t\t\t\t\t(provider) => {\n\t\t\t\t\t\tassignContextProvider(this, provider);\n\t\t\t\t\t},\n\t\t\t\t\t{ emitMounted: true },\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.registerConnectedCallback(() => {\n\t\t\t\tif (initializeConsumedContextForHost(this, { emitMounted: true })) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tinitializeConsumedContextForHost(this, { emitMounted: true });\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n}\n",
|
|
14
|
+
"import type { ContextHostLike } from '../context-host';\nimport type { UnknownContext } from '../types';\nimport { consumeContext as legacyConsumeContext } from './legacy/consume-context';\nimport { consumeContext as standardConsumeContext } from './standard/consume-context';\nimport { fieldDecoratorBridge } from '../../decorators/bridge';\n\n/**\n * Injects the nearest matching context provider onto a decorated field.\n *\n * During SSR the field can be resolved from the active SSR context stack; on\n * the client it falls back to the DOM event-based context channel.\n *\n * @param context Context token to consume from ancestor providers.\n * @returns A standard-or-legacy decorator implementation for the target field.\n */\nexport function consumeContext(context: UnknownContext) {\n\tfunction decorator<Host extends ContextHostLike, V>(\n\t\tprotoOrTarget: undefined,\n\t\tnameOrContext: ClassFieldDecoratorContext<Host, V>,\n\t): void;\n\tfunction decorator(protoOrTarget: ContextHostLike, nameOrContext: string): void;\n\tfunction decorator(\n\t\tprotoOrTarget: ContextHostLike | undefined,\n\t\tnameOrContext: string | ClassFieldDecoratorContext<ContextHostLike, unknown>,\n\t): void {\n\t\treturn fieldDecoratorBridge(\n\t\t\tstandardConsumeContext(context),\n\t\t\tlegacyConsumeContext(context),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t);\n\t}\n\n\treturn decorator;\n}\n"
|
|
15
|
+
],
|
|
16
|
+
"mappings": "i0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,CAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,CAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,EAA+C,CAAC,EAAmB,CAClF,EAAsB,EAAU,CAA4B,EAUtD,SAAS,EAAuD,CACtE,EACA,EACO,CACP,IAAM,EAAS,EAEf,EACC,EACA,EACC,EAAO,KAAoD,IAAI,GAGjE,EAGD,SAAS,CAAqC,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAS,EACT,EAAkB,OAAO,UAAU,eAAe,KAAK,EAAQ,CAAG,EAAI,EAAO,GAAO,OAE1F,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAQ,EAAK,CAClC,MAAO,CAAC,CAAW,CACpB,CAAC,EAGF,SAAS,CAAuC,CAAC,EAAa,EAAmB,CAChF,EAAmB,EAAU,CAAC,IAAc,CAC3C,IAAM,EAAgB,E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AE,YAAa,EAAK,CAAC,EAC/D,EACD,EACD,GC1CI,SAAS,CAAc,CAAC,EAAiC,CAC/D,MAAO,CAA+B,EAAmB,IAA8C,CAEtG,IAAM,EAAc,OAAO,EAAQ,IAAI,EACjC,EAAwB,CAAC,EAAS,IAAsB,CAC7D,IAAM,EAAa,EACnB,EAAW,GAAe,GAErB,EAAmC,CAAC,EAAS,EAAqC,CAAC,IAAM,CAG9F,GAFmB,EAEJ,GACd,MAAO,GAGR,OAAO,EACN,EACA,EACA,CAAC,IAAa,CACb,EAAsB,EAAM,CAAQ,GAErC,CACD,GAGD,EAAQ,eAAe,QAAS,EAAU,CACzC,GACC,EACC,KACA,EACA,CAAC,IAAa,CACb,EAAsB,KAAM,CAAQ,GAErC,CAAE,YAAa,EAAK,CACrB,EAEA,OAGD,KAAK,0BAA0B,IAAM,CACpC,GAAI,EAAiC,KAAM,CAAE,YAAa,EAAK,CAAC,EAC/D,OAGD,eAAe,IAAM,CACpB,EAAiC,KAAM,CAAE,YAAa,EAAK,CAAC,EAC5D,EACD,EACD,GCrCI,SAAS,EAAc,CAAC,EAAyB,CAMvD,SAAS,CAAS,CACjB,EACA,EACO,CACP,OAAO,EACN,EAAuB,CAAO,EAC9B,EAAqB,CAAO,EAC5B,EACA,CACD,EAGD,OAAO",
|
|
17
|
+
"debugId": "D63958FC51274CE064756E2164756E21",
|
|
18
|
+
"names": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:U,getOwnPropertyNames:y,getOwnPropertyDescriptor:j}=Object,n=Object.prototype.hasOwnProperty;function D(e){return this[e]}var m=(e)=>{var u=(v??=new WeakMap).get(e),p;if(u)return u;if(u=U({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var V of y(e))if(!n.call(u,V))U(u,V,{get:D.bind(e,V),enumerable:!(p=j(e,V))||p.enumerable})}return v.set(e,u),u},v;var t=(e)=>e;function w(e,u){this[e]=t.bind(null,u)}var x=(e,u)=>{for(var p in u)U(e,p,{get:u[p],enumerable:!0,configurable:!0,set:w.bind(u,p)})};var F=(e,u)=>()=>(e&&(u=e(e=0)),u);var H=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(u,p)=>(typeof require<"u"?require:u)[p]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var d=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),f=Symbol.for("@ecopages/radiant.ssr-preparation-running");function M(e,u){let V=e[d];if(Array.isArray(V)){V.push(u);return}Object.defineProperty(e,d,{value:[u],configurable:!0})}function Q(e){let u=e,p=u[d];if(!Array.isArray(p))return;u[f]=!0;try{for(let V of p)V()}finally{delete u[f]}}function Y(e,u,p){let V=!1,o,q=e;return(r)=>{if(q[f]!==!0&&V&&Object.is(o,r))return;if(V=!0,o=r,u(r),p&&typeof q.requestUpdate==="function")q.requestUpdate()}}export{Y as createContextSelectionDelivery};
|
|
2
|
+
|
|
3
|
+
//# debugId=9DFA6F1849A20C7E64756E2164756E21
|