@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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/core/radiant-component-ssr-registry.ts", "../src/utils/attribute-utils.ts", "../src/core/controller-metadata.ts", "../src/controller-registry.ts", "../src/core/custom-element-metadata.ts", "../src/core/reactive-prop-metadata.ts", "../src/context/context-ssr-bridge.ts", "../src/server/context-ssr.ts", "../src/core/radiant-component-ssr.ts", "../src/server/radiant-component-ssr-runtime.ts", "../src/server/html-parser.ts", "../src/server/light-dom-shim.ts", "../src/server/render-component.ts", "../src/server/render-controller.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\n\n/**\n * Optional SSR hooks exposed by `RadiantElement` instances to the shared\n * server runtime.\n *\n * The bridge lets the runtime detect whether a component is still using the\n * inherited host SSR implementation or has taken ownership of host rendering\n * through explicit overrides.\n */\nexport type RadiantElementRenderBridge = {\n\trenderHost?: () => JsxRenderable;\n\trenderHostToString?: (options?: RenderToStringOptions) => string;\n};\n\n/**\n * Runtime shape required by the shared Radiant SSR helpers.\n *\n * This is intentionally narrower than `RadiantElement` itself so the server\n * runtime can stay decoupled from the full client base-class implementation.\n */\nexport type RadiantElementSsrCapable = HTMLElement & {\n\tresolveSsrRenderBridge?: () => RadiantElementRenderBridge;\n\tgetHostSsrAttributes?: () => Record<string, string>;\n\trenderToString(options?: RenderToStringOptions): string;\n\trenderHost?(): JsxRenderable;\n\trenderHostToString(options?: RenderToStringOptions): string;\n};\n\n/**\n * Shared SSR runtime contract registered on `globalThis`.\n *\n * Server entrypoints install one implementation that both direct component SSR\n * and nested JSX custom-element SSR can reuse without importing client-only\n * internals into every call site.\n */\nexport type RadiantElementSsrRuntime = {\n\tgetHostAttributes(component: RadiantElementSsrCapable): Record<string, string>;\n\trenderHost(component: RadiantElementSsrCapable): JsxRenderable;\n\trenderHostToString(component: RadiantElementSsrCapable, options?: RenderToStringOptions): string;\n\tresolveRenderBridge(component: RadiantElementSsrCapable): RadiantElementRenderBridge | undefined;\n\trenderView(component: RadiantElementSsrCapable, options?: RenderToStringOptions): string;\n};\n\nconst RADIANT_COMPONENT_SSR_RUNTIME_SYMBOL = Symbol.for('@ecopages/radiant.component-ssr-runtime');\n\ntype GlobalSsrRuntimeState = typeof globalThis & {\n\t[RADIANT_COMPONENT_SSR_RUNTIME_SYMBOL]?: RadiantElementSsrRuntime;\n};\n\n/**\n * Reads the currently registered Radiant SSR runtime from `globalThis`.\n *\n * Returns `undefined` when no server entrypoint has installed the runtime yet.\n */\nexport function getRadiantElementSsrRuntime(): RadiantElementSsrRuntime | undefined {\n\treturn (globalThis as GlobalSsrRuntimeState)[RADIANT_COMPONENT_SSR_RUNTIME_SYMBOL];\n}\n\n/**\n * Registers the shared Radiant SSR runtime on `globalThis`.\n *\n * The latest registration wins, which keeps server adapters free to install\n * the runtime eagerly from their own explicit entrypoint.\n */\nexport function registerRadiantElementSsrRuntime(runtime: RadiantElementSsrRuntime): void {\n\t(globalThis as GlobalSsrRuntimeState)[RADIANT_COMPONENT_SSR_RUNTIME_SYMBOL] = runtime;\n}\n",
|
|
6
|
-
"import type { RadiantElement } from '../core/radiant-element';\n\nexport type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn readers[readerType]!(value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
|
|
7
|
-
"export const CONTROLLER_IDENTIFIER = Symbol.for('@ecopages/radiant.controllerIdentifier');\n\ntype ControllerConstructorWithMetadata = CustomElementConstructor & {\n\t[CONTROLLER_IDENTIFIER]?: string;\n};\n\nexport function setControllerIdentifier(target: CustomElementConstructor, identifier: string): void {\n\t(target as ControllerConstructorWithMetadata)[CONTROLLER_IDENTIFIER] = identifier;\n}\n\nexport function getControllerIdentifier(target: CustomElementConstructor): string | undefined {\n\treturn (target as ControllerConstructorWithMetadata)[CONTROLLER_IDENTIFIER];\n}\n",
|
|
8
|
-
"import type { RadiantController } from './core/radiant-controller';\nimport { setControllerIdentifier } from './core/controller-metadata';\n\nexport const CONTROLLER_ATTRIBUTE = 'data-controller';\n\nexport type ControllerConstructor<TController extends RadiantController = RadiantController> = new (\n\thost: Element,\n) => TController;\n\nexport type ControllerRegistrationStrategy = 'keep-current' | 'replace';\n\ntype ControllerRegistryGlobalState = {\n\tactiveRuntimes: Set<ControllerRegistryRuntime>;\n\tcontrollerRegistrationStrategy: ControllerRegistrationStrategy;\n\tcontrollerRegistry: Map<string, ControllerConstructor>;\n};\n\nexport const CONTROLLER_REGISTRY_STATE_KEY = Symbol.for('@ecopages/radiant.controller-registry-state');\n\nfunction getControllerRegistryGlobalState(): ControllerRegistryGlobalState {\n\tconst globalScope = globalThis as typeof globalThis & Record<PropertyKey, unknown>;\n\tconst existingState = globalScope[CONTROLLER_REGISTRY_STATE_KEY];\n\n\tif (existingState) {\n\t\treturn existingState as ControllerRegistryGlobalState;\n\t}\n\n\tconst nextState: ControllerRegistryGlobalState = {\n\t\tactiveRuntimes: new Set<ControllerRegistryRuntime>(),\n\t\tcontrollerRegistrationStrategy: 'keep-current',\n\t\tcontrollerRegistry: new Map<string, ControllerConstructor>(),\n\t};\n\n\tglobalScope[CONTROLLER_REGISTRY_STATE_KEY] = nextState;\n\n\treturn nextState;\n}\n\nconst controllerRegistryState = getControllerRegistryGlobalState();\nconst controllerRegistry = controllerRegistryState.controllerRegistry;\nconst activeRuntimes = controllerRegistryState.activeRuntimes;\n\nexport function parseControllerIdentifiers(element: Element): string[] {\n\tconst value = element.getAttribute(CONTROLLER_ATTRIBUTE);\n\n\tif (!value) {\n\t\treturn [];\n\t}\n\n\treturn value\n\t\t.split(/\\s+/)\n\t\t.map((identifier) => identifier.trim())\n\t\t.filter((identifier) => identifier.length > 0);\n}\n\nexport function visitControllerElements(root: ParentNode, visit: (element: Element) => void): void {\n\tif (root instanceof Element && root.hasAttribute(CONTROLLER_ATTRIBUTE)) {\n\t\tvisit(root);\n\t}\n\n\tfor (const element of Array.from(root.querySelectorAll(`[${CONTROLLER_ATTRIBUTE}]`))) {\n\t\tvisit(element);\n\t}\n}\n\nexport class ControllerRegistryRuntime {\n\tprivate readonly controllersByElement = new Map<Element, Map<string, RadiantController>>();\n\tprivate observer?: MutationObserver;\n\tprivate stopped = false;\n\n\tconstructor(private readonly root: ParentNode = document) {\n\t\tthis.start();\n\t}\n\n\tpublic stop(): void {\n\t\tif (this.stopped) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.stopped = true;\n\t\tthis.observer?.disconnect();\n\t\tthis.observer = undefined;\n\n\t\tfor (const [element, controllers] of this.controllersByElement) {\n\t\t\tfor (const [identifier] of controllers) {\n\t\t\t\tthis.disconnectController(element, identifier);\n\t\t\t}\n\t\t}\n\n\t\tactiveRuntimes.delete(this);\n\t}\n\n\tpublic reconcileRegisteredController(identifier: string): void {\n\t\tvisitControllerElements(this.root, (element) => {\n\t\t\tif (!parseControllerIdentifiers(element).includes(identifier)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.connectController(element, identifier);\n\t\t});\n\t}\n\n\tpublic replaceRegisteredController(identifier: string): void {\n\t\tfor (const [element, controllers] of Array.from(this.controllersByElement.entries())) {\n\t\t\tif (!controllers.has(identifier)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthis.disconnectController(element, identifier);\n\t\t}\n\n\t\tthis.reconcileRegisteredController(identifier);\n\t}\n\n\tprivate start(): void {\n\t\tvisitControllerElements(this.root, (element) => {\n\t\t\tthis.reconcileElement(element);\n\t\t});\n\n\t\tif (typeof MutationObserver === 'undefined') {\n\t\t\tactiveRuntimes.add(this);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.observer = new MutationObserver((records) => {\n\t\t\tfor (const record of records) {\n\t\t\t\tif (record.type === 'attributes' && record.target instanceof Element) {\n\t\t\t\t\tthis.reconcileElement(record.target);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (const removedNode of Array.from(record.removedNodes)) {\n\t\t\t\t\tif (!(removedNode instanceof Element)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitControllerElements(removedNode, (element) => {\n\t\t\t\t\t\tthis.disconnectElementControllers(element);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfor (const addedNode of Array.from(record.addedNodes)) {\n\t\t\t\t\tif (!(addedNode instanceof Element)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitControllerElements(addedNode, (element) => {\n\t\t\t\t\t\tthis.reconcileElement(element);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tconst observerRoot = this.root instanceof Document ? this.root.documentElement : this.root;\n\n\t\tthis.observer.observe(observerRoot, {\n\t\t\tattributeFilter: [CONTROLLER_ATTRIBUTE],\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t});\n\n\t\tactiveRuntimes.add(this);\n\t}\n\n\tprivate reconcileElement(element: Element): void {\n\t\tconst nextIdentifiers = new Set(parseControllerIdentifiers(element));\n\t\tconst currentControllers = this.controllersByElement.get(element);\n\n\t\tif (currentControllers) {\n\t\t\tfor (const identifier of currentControllers.keys()) {\n\t\t\t\tif (!nextIdentifiers.has(identifier)) {\n\t\t\t\t\tthis.disconnectController(element, identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const identifier of nextIdentifiers) {\n\t\t\tthis.connectController(element, identifier);\n\t\t}\n\t}\n\n\tprivate connectController(element: Element, identifier: string): void {\n\t\tconst controllerConstructor = controllerRegistry.get(identifier);\n\n\t\tif (!controllerConstructor) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet controllers = this.controllersByElement.get(element);\n\n\t\tif (!controllers) {\n\t\t\tcontrollers = new Map();\n\t\t\tthis.controllersByElement.set(element, controllers);\n\t\t}\n\n\t\tif (controllers.has(identifier)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst controller = new controllerConstructor(element);\n\t\tcontrollers.set(identifier, controller);\n\t\tcontroller.connect();\n\t}\n\n\tprivate disconnectController(element: Element, identifier: string): void {\n\t\tconst controllers = this.controllersByElement.get(element);\n\n\t\tif (!controllers) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst controller = controllers.get(identifier);\n\n\t\tif (!controller) {\n\t\t\treturn;\n\t\t}\n\n\t\tcontroller.disconnect();\n\t\tcontrollers.delete(identifier);\n\n\t\tif (controllers.size === 0) {\n\t\t\tthis.controllersByElement.delete(element);\n\t\t}\n\t}\n\n\tprivate disconnectElementControllers(element: Element): void {\n\t\tconst controllers = this.controllersByElement.get(element);\n\n\t\tif (!controllers) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const identifier of Array.from(controllers.keys())) {\n\t\t\tthis.disconnectController(element, identifier);\n\t\t}\n\t}\n}\n\nexport function registerController<\n\tTController extends RadiantController,\n\tTConstructor extends ControllerConstructor<TController>,\n>(identifier: string, controller: TConstructor): TConstructor {\n\tconst existingController = controllerRegistry.get(identifier);\n\n\tif (existingController) {\n\t\treturn existingController as TConstructor;\n\t}\n\n\tsetControllerIdentifier(controller as unknown as CustomElementConstructor, identifier);\n\tcontrollerRegistry.set(identifier, controller);\n\n\tfor (const runtime of Array.from(activeRuntimes)) {\n\t\truntime.reconcileRegisteredController(identifier);\n\t}\n\n\treturn controller;\n}\n\nexport function hasRegisteredController(identifier: string): boolean {\n\treturn controllerRegistry.has(identifier);\n}\n\n/**\n * Returns the registered controller constructor for an identifier, if one is available.\n *\n * This is primarily used by SSR adapters that need to render controller-owned\n * authored hosts before the browser registry attaches controllers at runtime.\n */\nexport function resolveRegisteredController(identifier: string): ControllerConstructor | undefined {\n\treturn controllerRegistry.get(identifier);\n}\n\nexport function replaceController<\n\tTController extends RadiantController,\n\tTConstructor extends ControllerConstructor<TController>,\n>(identifier: string, controller: TConstructor): TConstructor {\n\tconst existingController = controllerRegistry.get(identifier);\n\n\tif (existingController === controller) {\n\t\treturn controller;\n\t}\n\n\tsetControllerIdentifier(controller as unknown as CustomElementConstructor, identifier);\n\tcontrollerRegistry.set(identifier, controller);\n\n\tfor (const runtime of Array.from(activeRuntimes)) {\n\t\truntime.replaceRegisteredController(identifier);\n\t}\n\n\treturn controller;\n}\n\nexport function setControllerRegistrationStrategy(strategy: ControllerRegistrationStrategy): void {\n\tcontrollerRegistryState.controllerRegistrationStrategy = strategy;\n}\n\nexport function enableControllerReplacementForHmr(): void {\n\tsetControllerRegistrationStrategy('replace');\n}\n\nexport function disableControllerReplacementForHmr(): void {\n\tsetControllerRegistrationStrategy('keep-current');\n}\n\nexport function registerControllerWithConfiguredStrategy<\n\tTController extends RadiantController,\n\tTConstructor extends ControllerConstructor<TController>,\n>(identifier: string, controller: TConstructor): TConstructor {\n\tif (controllerRegistryState.controllerRegistrationStrategy === 'replace') {\n\t\treturn replaceController(identifier, controller);\n\t}\n\n\treturn registerController(identifier, controller);\n}\n\nexport function startControllers(root: ParentNode = document): ControllerRegistryRuntime {\n\treturn new ControllerRegistryRuntime(root);\n}\n\nexport function stopControllers(): void {\n\tfor (const runtime of Array.from(activeRuntimes)) {\n\t\truntime.stop();\n\t}\n}\n",
|
|
9
|
-
"export const CUSTOM_ELEMENT_TAG_NAME = Symbol.for('@ecopages/radiant.customElementTagName');\n\ntype CustomElementConstructorWithMetadata = CustomElementConstructor & {\n\t[CUSTOM_ELEMENT_TAG_NAME]?: string;\n};\n\n/**\n * Sets the custom element tag name for a given constructor.\n * This is used internally to associate a class with its custom element tag, which is necessary for features like hydration and SSR support.\n * @param target The constructor of the custom element.\n * @param tagName The tag name to associate with the custom element.\n */\nexport function setCustomElementTagName(target: CustomElementConstructor, tagName: string): void {\n\t(target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME] = tagName;\n}\n\n/**\n * Retrieves the custom element tag name associated with a given constructor.\n * @param target The constructor of the custom element.\n * @returns The tag name associated with the custom element, or `undefined` if not set.\n */\nexport function getCustomElementTagName(target: CustomElementConstructor): string | undefined {\n\treturn (target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME];\n}\n",
|
|
10
|
-
"import type { ReactivePropertyOptions } from './radiant-element';\n\nconst REACTIVE_PROP_DEFINITIONS = Symbol.for('@ecopages/radiant.reactivePropDefinitions');\n\nexport type ReactivePropDefinition = {\n\tname: string;\n\toptions: ReactivePropertyOptions<unknown>;\n};\n\ntype RadiantConstructorWithReactiveProps = CustomElementConstructor & {\n\t[REACTIVE_PROP_DEFINITIONS]?: ReactivePropDefinition[];\n};\n\nexport function registerReactivePropDefinition(\n\ttarget: object,\n\tpropertyName: string,\n\toptions: ReactivePropertyOptions<unknown>,\n): void {\n\tconst constructor = target.constructor as RadiantConstructorWithReactiveProps;\n\tconst definitions = constructor[REACTIVE_PROP_DEFINITIONS] ?? [];\n\n\tif (definitions.some((definition) => definition.name === propertyName)) {\n\t\treturn;\n\t}\n\n\tdefinitions.push({ name: propertyName, options });\n\tconstructor[REACTIVE_PROP_DEFINITIONS] = definitions;\n}\n\nexport function getReactivePropDefinitions(target: object): ReactivePropDefinition[] {\n\treturn ((target.constructor as RadiantConstructorWithReactiveProps)[REACTIVE_PROP_DEFINITIONS] ?? []).slice();\n}\n",
|
|
11
|
-
"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",
|
|
12
|
-
"import type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { installSsrContextProviderResolver } from '../context/context-ssr-bridge';\nimport type { ContextType, UnknownContext } from '../context/types';\n\ntype ProviderFrame = Map<UnknownContext, SsrSerializableContextProvider>;\ntype ProviderStack = ProviderFrame[];\n\nlet resolvedAsyncLocalStorage: AsyncLocalStorage<ProviderStack> | null | undefined;\n\n/**\n * Lazily resolves `AsyncLocalStorage` from `node:async_hooks`.\n *\n * The dynamic `require` is necessary because browser-based SSR tests import\n * this server-oriented module directly. A top-level static import would break\n * those browser bundles even though normal application SSR runs on the server.\n *\n * On the server (Node.js, Bun, Cloudflare Workers) the import always succeeds.\n * In browser test environments where SSR rendering is exercised without a real\n * server, the fallback global stack is used instead.\n */\nfunction getAsyncLocalStorage(): AsyncLocalStorage<ProviderStack> | null {\n\tif (resolvedAsyncLocalStorage !== undefined) {\n\t\treturn resolvedAsyncLocalStorage;\n\t}\n\n\ttry {\n\t\tconst { AsyncLocalStorage: ALS } = require('node:async_hooks') as typeof import('node:async_hooks');\n\t\tresolvedAsyncLocalStorage = new ALS<ProviderStack>();\n\t\treturn resolvedAsyncLocalStorage;\n\t} catch {\n\t\tresolvedAsyncLocalStorage = null;\n\t\treturn null;\n\t}\n}\n\nconst SSR_CONTEXT_FALLBACK_STACK_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-fallback-stack');\n\nfunction getFallbackStack(): ProviderStack {\n\tconst g = globalThis as typeof globalThis & { [SSR_CONTEXT_FALLBACK_STACK_SYMBOL]?: ProviderStack };\n\tg[SSR_CONTEXT_FALLBACK_STACK_SYMBOL] ??= [];\n\treturn g[SSR_CONTEXT_FALLBACK_STACK_SYMBOL];\n}\n\n/**\n * Pushes a temporary provider frame onto the SSR context stack.\n *\n * On the server, each call creates an isolated `AsyncLocalStorage` context so\n * concurrent renders cannot corrupt each other.\n *\n * In browser test environments where `AsyncLocalStorage` is unavailable, a\n * synchronous global stack is used as a fallback.\n */\nexport function withSsrContextProviders(providers: readonly SsrSerializableContextProvider[]): () => void {\n\tif (providers.length === 0) {\n\t\treturn () => undefined;\n\t}\n\n\tconst frame = new Map<UnknownContext, SsrSerializableContextProvider>();\n\n\tfor (const provider of providers) {\n\t\tframe.set(provider.getContextKey(), provider);\n\t}\n\n\tconst als = getAsyncLocalStorage();\n\n\tif (als) {\n\t\tconst parentStack = als.getStore() ?? [];\n\t\tconst childStack = [...parentStack, frame];\n\t\tals.enterWith(childStack);\n\n\t\treturn () => {\n\t\t\tals.enterWith(parentStack);\n\t\t};\n\t}\n\n\tconst stack = getFallbackStack();\n\tstack.push(frame);\n\n\treturn () => {\n\t\tconst index = stack.lastIndexOf(frame);\n\t\tif (index >= 0) stack.splice(index, 1);\n\t};\n}\n\n/**\n * Resolves the nearest SSR-visible provider for a given context token.\n *\n * Lookup walks the provider frames from innermost to outermost so nested host\n * serialization behaves the same way as runtime context resolution in the DOM.\n */\nexport function resolveSsrContextProvider<T extends UnknownContext>(\n\tcontext: T,\n): SsrSerializableContextProvider | undefined {\n\tconst store = getAsyncLocalStorage()?.getStore() ?? getFallbackStack();\n\n\tfor (let index = store.length - 1; index >= 0; index -= 1) {\n\t\tconst provider = store[index]?.get(context);\n\n\t\tif (provider) {\n\t\t\treturn provider;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Resolves the current SSR-visible value for a given context token.\n *\n * This is the ergonomic helper consumed by SSR-aware decorators and component\n * render paths when they only need the context payload instead of the full\n * provider instance.\n */\nexport function resolveSsrContextValue<T extends UnknownContext>(context: T): ContextType<T> | undefined {\n\tconst provider = resolveSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn undefined;\n\t}\n\n\treturn provider.getContext() as ContextType<T>;\n}\n\ninstallSsrContextProviderResolver((context) => resolveSsrContextProvider(context));\n",
|
|
13
|
-
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { withSsrContextProviders } from '../server/context-ssr';\nimport { getCustomElementTagName } from './custom-element-metadata';\nimport type { ReactiveProperty } from './radiant-element';\nimport type { ReactivePropDefinition } from './reactive-prop-metadata';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\nimport { writeAttributeValue } from '../utils/attribute-utils';\n\ntype RadiantElementSsrHost = {\n\tconstructor: CustomElementConstructor;\n\tgetAuthoredHydrationScriptMarkup?: () => string | undefined;\n\tgetContextProviders: () => SsrSerializableContextProvider[];\n\tgetHydrationBindings: () => SsrSerializableHydrationBinding[];\n\tgetSlotProjectionScriptTag?: () => string | undefined;\n\trenderToString: (options?: RenderToStringOptions) => string;\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tlistAttributeNames: () => string[];\n\tgetAttributeValue: (name: string) => string | null;\n};\n\nexport class RadiantElementSsrService {\n\tconstructor(private readonly host: RadiantElementSsrHost) {}\n\n\tpublic renderHost(): JsxRenderable {\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\touterHTML: this.renderHostToString({ mode: 'hydrate' }),\n\t\t};\n\t}\n\n\tpublic renderHostToString(options: RenderToStringOptions = {}, attributes = this.getHostAttributes()): string {\n\t\tconst tagName = this.getTagName();\n\t\tconst restoreSsrContexts = withSsrContextProviders(this.host.getContextProviders());\n\n\t\ttry {\n\t\t\treturn `<${tagName}${serializeHostAttributes(attributes)}>${this.renderHostContent(options)}</${tagName}>`;\n\t\t} finally {\n\t\t\trestoreSsrContexts();\n\t\t}\n\t}\n\n\tprivate renderHostContent(options: RenderToStringOptions): string {\n\t\tconst hostContent = this.host.renderToString(options);\n\t\tconst authoredHydrationMarkup = this.host.getAuthoredHydrationScriptMarkup?.() ?? '';\n\t\tconst slotProjectionScript = this.host.getSlotProjectionScriptTag?.() ?? '';\n\t\tconst hydrate = options.mode === 'hydrate' || (options.mode === undefined && options.hydrate === true);\n\n\t\tif (!hydrate) {\n\t\t\treturn `${hostContent}${authoredHydrationMarkup}${slotProjectionScript}`;\n\t\t}\n\n\t\tconst hydrationScripts = this.host\n\t\t\t.getHydrationBindings()\n\t\t\t.map((binding) => binding.renderHydrationScriptTag())\n\t\t\t.filter((markup): markup is string => typeof markup === 'string')\n\t\t\t.join('');\n\n\t\treturn `${hostContent}${slotProjectionScript}${hydrationScripts}`;\n\t}\n\n\tpublic getHostAttributes(): Record<string, string> {\n\t\tconst attributes: Record<string, string> = {};\n\t\tconst seenAttributes = new Set<string>();\n\n\t\tfor (const property of this.host.getReactiveProperties()) {\n\t\t\tconst currentValue = this.host.getPropertyValue(property.name);\n\t\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattributes[property.attribute] = String(property.converter.toAttribute(currentValue));\n\t\t\tseenAttributes.add(property.attribute);\n\t\t}\n\n\t\tfor (const definition of this.host.getReactivePropDefinitions()) {\n\t\t\tconst attributeName = definition.options.attribute ?? definition.name;\n\n\t\t\tif (seenAttributes.has(attributeName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst currentValue = this.host.getPropertyValue(definition.name);\n\n\t\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattributes[attributeName] = String(writeAttributeValue(currentValue, definition.options.type));\n\t\t\tseenAttributes.add(attributeName);\n\t\t}\n\n\t\tfor (const attributeName of this.host.listAttributeNames()) {\n\t\t\tconst attributeValue = this.host.getAttributeValue(attributeName);\n\t\t\tif (attributeValue !== null) {\n\t\t\t\tattributes[attributeName] = attributeValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tprivate getTagName(): string {\n\t\tconst tagName = getCustomElementTagName(this.host.constructor);\n\n\t\tif (!tagName) {\n\t\t\tthrow new Error(`${this.host.constructor.name} is missing @customElement metadata.`);\n\t\t}\n\n\t\treturn tagName;\n\t}\n}\n\nfunction serializeHostAttributes(attributes: Record<string, string>): string {\n\treturn Object.entries(attributes)\n\t\t.map(([name, value]) => ` ${name}=\"${escapeAttribute(value)}\"`)\n\t\t.join('');\n}\n\nfunction escapeAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n",
|
|
14
|
-
"import type { JsxRenderable } from '@ecopages/jsx';\nimport { renderToString as renderJsxToString } from '@ecopages/jsx/server';\nimport { withServerCustomElementRenderHook } from '@ecopages/jsx/server';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport { getReactivePropDefinitions } from '../core/reactive-prop-metadata';\nimport { RadiantElementSsrService } from '../core/radiant-component-ssr';\nimport {\n\tgetRadiantElementSsrRuntime,\n\tregisterRadiantElementSsrRuntime,\n\ttype RadiantElementRenderBridge,\n\ttype RadiantElementSsrCapable,\n\ttype RadiantElementSsrRuntime,\n} from '../core/radiant-component-ssr-registry';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport type { ReactiveProperty } from '../core/radiant-element';\nimport type { SsrSerializableHydrationBinding } from '../core/ssr-hydration-binding';\n\ntype RadiantElementSsrHostBridge = Record<string, unknown> & {\n\tconstructor: CustomElementConstructor;\n\tgetAttribute(name: string): string | null;\n\tgetAttributeNames?(): string[];\n\tgetAuthoredHydrationScriptMarkup(): string | undefined;\n\tgetContextProviders(): SsrSerializableContextProvider[];\n\tgetHostSsrAttributes(): Record<string, string>;\n\tgetHydrationBindings(): SsrSerializableHydrationBinding[];\n\tgetReactiveProperties(): ReactiveProperty[];\n\tgetSlotProjectionScriptTag(): string | undefined;\n\tresolveTrackedRenderOutput(): { containsSlots: boolean; value: JsxRenderable };\n\trenderToString(options?: RenderToStringOptions): string;\n\tresolveSsrRenderBridge(): RadiantElementRenderBridge;\n};\n\nconst ACTIVE_SSR_HYDRATE_SYMBOL = Symbol.for('@ecopages/jsx.active-ssr-hydrate');\nconst hostAttributeResolutionInProgress = new WeakSet<object>();\n\n/**\n * Produces a JSX-compatible host preview for a Radiant element.\n *\n * The preview always serializes with hydration enabled because it is intended\n * for shell composition, where nested client islands must preserve hydration\n * markers when embedded into a larger SSR document.\n */\nfunction renderRadiantElementHost(component: RadiantElementSsrCapable): JsxRenderable {\n\treturn {\n\t\tnodeType: 1,\n\t\touterHTML: renderRadiantElementHostToString(component, { mode: 'hydrate' }),\n\t};\n}\n\n/**\n * Serializes a Radiant element host through the shared SSR service.\n *\n * This path centralizes host serialization so direct component renders and\n * nested JSX custom-element renders follow the same attribute and hydration\n * rules.\n */\nfunction renderRadiantElementHostToString(\n\tcomponent: RadiantElementSsrCapable,\n\toptions: RenderToStringOptions = {},\n): string {\n\treturn createRadiantElementSsrService(component).renderHostToString(\n\t\toptions,\n\t\tgetRadiantElementHostSsrAttributes(component),\n\t);\n}\n\n/**\n * Resolves the final host attribute map for a Radiant element.\n *\n * The recursion guard is required because `getHostSsrAttributes()` can itself\n * delegate back into the shared runtime. When that happens, the runtime falls\n * back to the raw SSR service attribute collector for the current call.\n */\nfunction getRadiantElementHostSsrAttributes(component: RadiantElementSsrCapable): Record<string, string> {\n\tconst bridge = component as unknown as RadiantElementSsrHostBridge;\n\n\tif (hostAttributeResolutionInProgress.has(component)) {\n\t\treturn createRadiantElementSsrService(component).getHostAttributes();\n\t}\n\n\thostAttributeResolutionInProgress.add(component);\n\n\ttry {\n\t\treturn bridge.getHostSsrAttributes();\n\t} finally {\n\t\thostAttributeResolutionInProgress.delete(component);\n\t}\n}\n\n/**\n * Adapts a `RadiantElement` instance to the shared `RadiantElementSsrService`\n * contract.\n *\n * Keeping this adapter local lets the base class shed its eager SSR service\n * instance while preserving the established host serialization behavior.\n */\nfunction createRadiantElementSsrService(component: RadiantElementSsrCapable): RadiantElementSsrService {\n\tconst bridge = component as unknown as RadiantElementSsrHostBridge;\n\n\treturn new RadiantElementSsrService({\n\t\tconstructor: bridge.constructor,\n\t\tgetAuthoredHydrationScriptMarkup: () => bridge.getAuthoredHydrationScriptMarkup(),\n\t\tgetHydrationBindings: () => bridge.getHydrationBindings(),\n\t\tgetSlotProjectionScriptTag: () => bridge.getSlotProjectionScriptTag(),\n\t\trenderToString: (options) => bridge.renderToString(options),\n\t\tgetContextProviders: () => bridge.getContextProviders(),\n\t\tgetReactiveProperties: () => bridge.getReactiveProperties(),\n\t\tgetReactivePropDefinitions: () => getReactivePropDefinitions(component),\n\t\tgetPropertyValue: (name) => bridge[name],\n\t\tlistAttributeNames: () => (typeof bridge.getAttributeNames === 'function' ? bridge.getAttributeNames() : []),\n\t\tgetAttributeValue: (name) => bridge.getAttribute(name),\n\t});\n}\n\n/**\n * Installs a temporary JSX custom-element render hook that understands\n * `RadiantElement` SSR bridges.\n *\n * This makes nested intrinsic custom-element renders honor explicit host SSR\n * overrides instead of always falling back to the inherited JSX runtime path.\n */\nfunction withRadiantServerCustomElementRenderBridge<T>(render: () => T): T {\n\treturn withServerCustomElementRenderHook(({ instance }) => {\n\t\tconst nestedBridge = resolveRadiantElementRenderBridge(instance as unknown as RadiantElementSsrCapable);\n\n\t\tif (!nestedBridge?.renderHostToString) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst renderHostToString = nestedBridge.renderHostToString;\n\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\tget outerHTML() {\n\t\t\t\tconst hydrate = isActiveSsrHydrateMode();\n\t\t\t\treturn renderHostToString({ hydrate, mode: hydrate ? 'hydrate' : 'plain' });\n\t\t\t},\n\t\t};\n\t}, render);\n}\n\n/**\n * Resolves the SSR bridge exposed by a component instance, when present.\n */\nfunction resolveRadiantElementRenderBridge(\n\tcomponent: RadiantElementSsrCapable,\n): RadiantElementRenderBridge | undefined {\n\treturn component.resolveSsrRenderBridge?.();\n}\n\n/**\n * Reads the active JSX SSR hydrate flag from `globalThis`.\n *\n * Nested custom-element serialization mirrors the hydrate mode of the current\n * top-level render so host and child markup stay consistent.\n */\nfunction isActiveSsrHydrateMode(): boolean {\n\treturn (globalThis as typeof globalThis & Record<PropertyKey, unknown>)[ACTIVE_SSR_HYDRATE_SYMBOL] === true;\n}\n\n/**\n * Registers the shared Radiant SSR runtime if it is not already present.\n *\n * Server entrypoints call this eagerly so instance SSR methods, nested JSX\n * custom-element SSR, and portable server helpers all share one implementation\n * and one bridge-resolution strategy.\n */\nexport function ensureRadiantElementSsrRuntimeRegistered() {\n\tconst existingRuntime = getRadiantElementSsrRuntime();\n\n\tif (existingRuntime) {\n\t\treturn existingRuntime;\n\t}\n\n\tconst runtime: RadiantElementSsrRuntime = {\n\t\tgetHostAttributes: getRadiantElementHostSsrAttributes,\n\t\trenderHost: renderRadiantElementHost,\n\t\trenderHostToString: renderRadiantElementHostToString,\n\t\tresolveRenderBridge: resolveRadiantElementRenderBridge,\n\t\trenderView: (component, options = {}) => {\n\t\t\tconst bridge = component as unknown as RadiantElementSsrHostBridge;\n\n\t\t\treturn withRadiantServerCustomElementRenderBridge(() =>\n\t\t\t\trenderJsxToString(bridge.resolveTrackedRenderOutput().value, options),\n\t\t\t);\n\t\t},\n\t};\n\n\tregisterRadiantElementSsrRuntime(runtime);\n\treturn runtime;\n}\n\nensureRadiantElementSsrRuntimeRegistered();\n",
|
|
15
|
-
"export type ParsedHtmlTag = {\n\tattributes: Record<string, string>;\n\tend: number;\n\tinnerHtml: string;\n\tselfClosing: boolean;\n\ttagName: string;\n\ttype: 'open';\n};\n\nexport type ParsedHtmlToken =\n\t| ParsedHtmlTag\n\t| {\n\t\t\tend: number;\n\t\t\ttype: 'close';\n\t }\n\t| {\n\t\t\tend: number;\n\t\t\ttype: 'comment' | 'declaration';\n\t };\n\nexport const voidElementNames = new Set([\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr',\n]);\n\nexport function collectTopLevelHtmlFragments(html: string): string[] {\n\tconst fragments: string[] = [];\n\tlet index = 0;\n\n\twhile (index < html.length) {\n\t\tconst fragmentStart = index;\n\n\t\tif (html.startsWith('<!--', index)) {\n\t\t\tconst commentEnd = html.indexOf('-->', index + 4);\n\t\t\tindex = commentEnd === -1 ? html.length : commentEnd + 3;\n\t\t\tfragments.push(html.slice(fragmentStart, index));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (html[index] !== '<') {\n\t\t\tconst nextTagIndex = html.indexOf('<', index);\n\t\t\tindex = nextTagIndex === -1 ? html.length : nextTagIndex;\n\t\t\tfragments.push(html.slice(fragmentStart, index));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst token = parseHtmlTagToken(html, index);\n\n\t\tif (!token) {\n\t\t\tfragments.push(html.slice(fragmentStart));\n\t\t\tbreak;\n\t\t}\n\n\t\tif (token.type !== 'open' || token.selfClosing || voidElementNames.has(token.tagName)) {\n\t\t\tindex = token.end;\n\t\t\tfragments.push(html.slice(fragmentStart, index));\n\t\t\tcontinue;\n\t\t}\n\n\t\tindex = token.end;\n\t\tlet depth = 1;\n\n\t\twhile (index < html.length && depth > 0) {\n\t\t\tconst nextTagIndex = html.indexOf('<', index);\n\n\t\t\tif (nextTagIndex === -1) {\n\t\t\t\tindex = html.length;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nestedToken = parseHtmlTagToken(html, nextTagIndex);\n\n\t\t\tif (!nestedToken) {\n\t\t\t\tindex = html.length;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tindex = nestedToken.end;\n\n\t\t\tif (nestedToken.type === 'comment' || nestedToken.type === 'declaration') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (nestedToken.type === 'open' && !nestedToken.selfClosing && !voidElementNames.has(nestedToken.tagName)) {\n\t\t\t\tdepth += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (nestedToken.type === 'close') {\n\t\t\t\tdepth -= 1;\n\t\t\t}\n\t\t}\n\n\t\tfragments.push(html.slice(fragmentStart, index));\n\t}\n\n\treturn fragments.filter((fragment) => fragment !== '');\n}\n\nexport function findHtmlTagEnd(html: string, startIndex: number): number {\n\tlet quote: '\"' | \"'\" | undefined;\n\n\tfor (let index = startIndex + 1; index < html.length; index += 1) {\n\t\tconst character = html[index];\n\n\t\tif (quote) {\n\t\t\tif (character === quote) {\n\t\t\t\tquote = undefined;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (character === '\"' || character === \"'\") {\n\t\t\tquote = character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (character === '>') {\n\t\t\treturn index + 1;\n\t\t}\n\t}\n\n\treturn html.length;\n}\n\nexport function parseAttributes(rawAttributes: string): Record<string, string> {\n\tconst attributes: Record<string, string> = {};\n\tconst attributePattern = /([:^@A-Za-z0-9_.-]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'>/]+)))?/g;\n\n\tfor (const match of rawAttributes.matchAll(attributePattern)) {\n\t\tconst [, name, doubleQuoted, singleQuoted, bareValue] = match;\n\n\t\tif (!name) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tattributes[name] = doubleQuoted ?? singleQuoted ?? bareValue ?? '';\n\t}\n\n\treturn attributes;\n}\n\nexport function parseHtmlTagToken(html: string, startIndex: number): ParsedHtmlToken | undefined {\n\tif (html.startsWith('<!--', startIndex)) {\n\t\tconst endIndex = html.indexOf('-->', startIndex + 4);\n\t\treturn {\n\t\t\tend: endIndex === -1 ? html.length : endIndex + 3,\n\t\t\ttype: 'comment',\n\t\t};\n\t}\n\n\tconst endIndex = findHtmlTagEnd(html, startIndex);\n\tconst rawToken = html.slice(startIndex + 1, endIndex - 1).trim();\n\n\tif (rawToken === '') {\n\t\treturn undefined;\n\t}\n\n\tif (rawToken.startsWith('!') || rawToken.startsWith('?')) {\n\t\treturn {\n\t\t\tend: endIndex,\n\t\t\ttype: 'declaration',\n\t\t};\n\t}\n\n\tif (rawToken.startsWith('/')) {\n\t\treturn {\n\t\t\tend: endIndex,\n\t\t\ttype: 'close',\n\t\t};\n\t}\n\n\tconst selfClosing = /\\/\\s*$/.test(rawToken);\n\tconst tagBody = selfClosing ? rawToken.replace(/\\/\\s*$/, '').trim() : rawToken;\n\tconst tagName = tagBody.split(/[\\s/>]/, 1)[0]?.toLowerCase() ?? '';\n\tconst attributesStart = tagName.length;\n\tconst rawAttributes = tagBody.slice(attributesStart).trim();\n\tconst innerHtml =\n\t\tselfClosing || voidElementNames.has(tagName)\n\t\t\t? ''\n\t\t\t: extractInnerHtmlFragment(html, startIndex, endIndex, tagName);\n\n\treturn {\n\t\tattributes: parseAttributes(rawAttributes),\n\t\tend: endIndex,\n\t\tinnerHtml,\n\t\tselfClosing,\n\t\ttagName,\n\t\ttype: 'open',\n\t};\n}\n\nexport function extractInnerHtmlFragment(\n\thtml: string,\n\tstartIndex: number,\n\ttagEndIndex: number,\n\ttagName: string,\n): string {\n\tlet index = tagEndIndex;\n\tlet depth = 1;\n\n\twhile (index < html.length && depth > 0) {\n\t\tconst nextTagIndex = html.indexOf('<', index);\n\n\t\tif (nextTagIndex === -1) {\n\t\t\treturn html.slice(tagEndIndex);\n\t\t}\n\n\t\tconst nextTag = parseHtmlTagToken(html, nextTagIndex);\n\n\t\tif (!nextTag) {\n\t\t\treturn html.slice(tagEndIndex);\n\t\t}\n\n\t\tif (\n\t\t\tnextTag.type === 'open' &&\n\t\t\tnextTag.tagName === tagName &&\n\t\t\t!nextTag.selfClosing &&\n\t\t\t!voidElementNames.has(tagName)\n\t\t) {\n\t\t\tdepth += 1;\n\t\t}\n\n\t\tif (nextTag.type === 'close') {\n\t\t\tconst closingName = html\n\t\t\t\t.slice(nextTagIndex + 2, nextTag.end - 1)\n\t\t\t\t.trim()\n\t\t\t\t.toLowerCase();\n\n\t\t\tif (closingName === tagName) {\n\t\t\t\tdepth -= 1;\n\n\t\t\t\tif (depth === 0) {\n\t\t\t\t\treturn html.slice(tagEndIndex, nextTagIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tindex = nextTag.end;\n\t}\n\n\treturn html.slice(tagEndIndex);\n}\n",
|
|
16
|
-
"import { collectTopLevelHtmlFragments, parseHtmlTagToken, type ParsedHtmlTag } from './html-parser';\n\ntype MinimalCustomElementRegistry = {\n\tdefine(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void;\n\tget(name: string): CustomElementConstructor | undefined;\n};\n\ntype MinimalCssNamespace = {\n\tescape(value: string): string;\n};\n\n/**\n * Minimal window-like runtime surface exposed by the SSR light-DOM shim.\n *\n * This is intentionally much smaller than a browser `window`; it only includes\n * the constructors and registry access that Radiant SSR currently needs.\n */\nexport type LightDomShimWindow = {\n\t/** Event constructor exposed to SSR-created components. */\n\tCustomEvent: typeof CustomEvent;\n\t/** Document constructor exposed to SSR-created components. */\n\tDocument: typeof Document;\n\t/** Element constructor exposed to SSR-created components. */\n\tElement: typeof Element;\n\t/** Event constructor exposed to SSR-created components. */\n\tEvent: typeof Event;\n\t/** EventTarget constructor exposed to SSR-created components. */\n\tEventTarget: typeof EventTarget;\n\t/** HTMLScriptElement constructor used by slot projection payload parsing. */\n\tHTMLScriptElement: typeof HTMLScriptElement;\n\t/** HTMLElement constructor exposed to SSR-created components. */\n\tHTMLElement: typeof HTMLElement;\n\t/** Node constructor exposed to SSR-created components. */\n\tNode: typeof Node;\n\t/** Minimal document instance exposed to SSR-created components. */\n\tdocument: Document;\n\t/** Minimal CSS namespace exposed to SSR-created components. */\n\tCSS: MinimalCssNamespace;\n\t/** Custom element registry used while rendering in SSR. */\n\tcustomElements: MinimalCustomElementRegistry;\n};\n\n/** Host preparation options accepted by the server render environment. */\nexport type PrepareServerRenderHostOptions = {\n\t/** Serialized light-DOM content to attach to the host before SSR. */\n\tauthoredContent?: string;\n};\n\n/** Reusable SSR environment used to prepare component hosts before rendering. */\nexport type ServerRenderEnvironment = {\n\t/** Prepares the host instance for rendering, including authored light-DOM content. */\n\tprepareHost(host: HTMLElement, options?: PrepareServerRenderHostOptions): void;\n};\n\ntype MinimalParentNode = Node & ParentNode;\n\nclass MinimalNode extends EventTarget {\n\tstatic readonly DOCUMENT_NODE = 9;\n\tstatic readonly ELEMENT_NODE = 1;\n\tstatic readonly TEXT_NODE = 3;\n\n\tpublic childNodes: Node[] = [];\n\tpublic ownerDocument: Document | null;\n\tpublic parentNode: MinimalParentNode | null = null;\n\n\tconstructor(public readonly nodeType: number, ownerDocument: Document | null = null) {\n\t\tsuper();\n\t\tthis.ownerDocument = ownerDocument;\n\t}\n\n\tappend(...nodes: Array<Node | string>): void {\n\t\tfor (const node of nodes) {\n\t\t\tthis.appendChild(typeof node === 'string' ? createTextNode(node) : node);\n\t\t}\n\t}\n\n\tappendChild<TNode extends Node>(node: TNode): TNode {\n\t\tif ('parentNode' in node && node.parentNode && 'removeChild' in node.parentNode) {\n\t\t\t(node.parentNode as Node & { removeChild(node: Node): Node }).removeChild(node);\n\t\t}\n\n\t\tthis.childNodes.push(node);\n\t\t(node as Node & { ownerDocument: Document | null }).ownerDocument =\n\t\t\tthis.nodeType === MinimalNode.DOCUMENT_NODE ? (this as unknown as Document) : this.ownerDocument;\n\t\t(node as Node & { parentNode: MinimalParentNode | null }).parentNode = this as unknown as MinimalParentNode;\n\t\treturn node;\n\t}\n\n\tremoveChild<TNode extends Node>(node: TNode): TNode {\n\t\tconst nodeIndex = this.childNodes.indexOf(node);\n\n\t\tif (nodeIndex === -1) {\n\t\t\treturn node;\n\t\t}\n\n\t\tthis.childNodes.splice(nodeIndex, 1);\n\t\t(node as Node & { parentNode: MinimalParentNode | null }).parentNode = null;\n\t\treturn node;\n\t}\n\n\treplaceChildren(...nodes: Array<Node | string>): void {\n\t\tfor (const child of this.childNodes) {\n\t\t\t(child as Node & { parentNode: MinimalParentNode | null }).parentNode = null;\n\t\t}\n\n\t\tthis.childNodes = [];\n\t\tthis.append(...nodes);\n\t}\n\n\tget textContent(): string | null {\n\t\treturn this.childNodes.map((child) => child.textContent ?? '').join('');\n\t}\n\n\tset textContent(value: string | null) {\n\t\tthis.replaceChildren(value ?? '');\n\t}\n\n\tgetRootNode(): Node {\n\t\tlet current: Node = this as unknown as Node;\n\n\t\twhile ('parentNode' in current && current.parentNode) {\n\t\t\tcurrent = current.parentNode;\n\t\t}\n\n\t\treturn current;\n\t}\n}\n\nclass MinimalTextNode extends MinimalNode {\n\tconstructor(private value: string, ownerDocument: Document | null = getInstalledDocumentLike()) {\n\t\tsuper(MinimalNode.TEXT_NODE, ownerDocument);\n\t}\n\n\toverride get textContent(): string {\n\t\treturn this.value;\n\t}\n\n\toverride set textContent(value: string | null) {\n\t\tthis.value = value ?? '';\n\t}\n}\n\nclass MinimalClassList {\n\tconstructor(private readonly element: MinimalElement) {}\n\n\tadd(...tokens: string[]): void {\n\t\tconst nextTokens = new Set(this.readTokens());\n\n\t\tfor (const token of tokens) {\n\t\t\tif (token !== '') {\n\t\t\t\tnextTokens.add(token);\n\t\t\t}\n\t\t}\n\n\t\tthis.writeTokens([...nextTokens]);\n\t}\n\n\tremove(...tokens: string[]): void {\n\t\tconst nextTokens = new Set(this.readTokens());\n\n\t\tfor (const token of tokens) {\n\t\t\tnextTokens.delete(token);\n\t\t}\n\n\t\tthis.writeTokens([...nextTokens]);\n\t}\n\n\ttoggle(token: string, force?: boolean): boolean {\n\t\tconst hasToken = this.contains(token);\n\t\tconst shouldAdd = force ?? !hasToken;\n\n\t\tif (shouldAdd) {\n\t\t\tthis.add(token);\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.remove(token);\n\t\treturn false;\n\t}\n\n\tcontains(token: string): boolean {\n\t\treturn this.readTokens().includes(token);\n\t}\n\n\ttoString(): string {\n\t\treturn this.value;\n\t}\n\n\tget value(): string {\n\t\treturn this.element.getAttribute('class') ?? '';\n\t}\n\n\tprivate readTokens(): string[] {\n\t\treturn this.value\n\t\t\t.split(/\\s+/)\n\t\t\t.map((token) => token.trim())\n\t\t\t.filter((token) => token.length > 0);\n\t}\n\n\tprivate writeTokens(tokens: string[]): void {\n\t\tif (tokens.length === 0) {\n\t\t\tthis.element.removeAttribute('class');\n\t\t\treturn;\n\t\t}\n\n\t\tthis.element.setAttribute('class', tokens.join(' '));\n\t}\n}\n\nclass MinimalElement extends MinimalNode {\n\tprivate attributes = new Map<string, string>();\n\tprivate classListValue?: MinimalClassList;\n\tprivate datasetValue?: DOMStringMap;\n\tprivate fragmentHtml?: string;\n\tprivate fragmentText?: string;\n\n\tpublic readonly localName: string;\n\tpublic readonly tagName: string;\n\n\tconstructor(tagName = 'div', ownerDocument: Document | null = getInstalledDocumentLike()) {\n\t\tsuper(MinimalNode.ELEMENT_NODE, ownerDocument);\n\t\tthis.localName = tagName.toLowerCase();\n\t\tthis.tagName = this.localName.toUpperCase();\n\t}\n\n\tget classList(): DOMTokenList {\n\t\tthis.classListValue ??= new MinimalClassList(this);\n\t\treturn this.classListValue as unknown as DOMTokenList;\n\t}\n\n\tget dataset(): DOMStringMap {\n\t\tthis.datasetValue ??= new Proxy(\n\t\t\t{},\n\t\t\t{\n\t\t\t\tdeleteProperty: (_target, property) => {\n\t\t\t\t\tif (typeof property !== 'string') {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.removeAttribute(toDataAttributeName(property));\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t\tget: (_target, property) => {\n\t\t\t\t\tif (typeof property !== 'string') {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.getAttribute(toDataAttributeName(property)) ?? undefined;\n\t\t\t\t},\n\t\t\t\tgetOwnPropertyDescriptor: (_target, property) => {\n\t\t\t\t\tif (typeof property !== 'string') {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tvalue: this.getAttribute(toDataAttributeName(property)) ?? undefined,\n\t\t\t\t\t\twritable: true,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\thas: (_target, property) => {\n\t\t\t\t\treturn typeof property === 'string' && this.hasAttribute(toDataAttributeName(property));\n\t\t\t\t},\n\t\t\t\townKeys: () => {\n\t\t\t\t\treturn this.getAttributeNames()\n\t\t\t\t\t\t.filter((name) => name.startsWith('data-'))\n\t\t\t\t\t\t.map((name) => toDatasetPropertyName(name.slice(5)));\n\t\t\t\t},\n\t\t\t\tset: (_target, property, value) => {\n\t\t\t\t\tif (typeof property !== 'string') {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.setAttribute(toDataAttributeName(property), String(value));\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t},\n\t\t) as DOMStringMap;\n\n\t\treturn this.datasetValue;\n\t}\n\n\thasAttribute(name: string): boolean {\n\t\treturn this.attributes.has(name);\n\t}\n\n\tgetAttribute(name: string): string | null {\n\t\treturn this.attributes.get(name) ?? null;\n\t}\n\n\tgetAttributeNames(): string[] {\n\t\treturn Array.from(this.attributes.keys());\n\t}\n\n\tsetAttribute(name: string, value: unknown): void {\n\t\tthis.fragmentHtml = undefined;\n\t\tthis.attributes.set(name, String(value));\n\t}\n\n\ttoggleAttribute(name: string, force?: boolean): boolean {\n\t\tconst shouldHaveAttribute = force ?? !this.hasAttribute(name);\n\n\t\tif (shouldHaveAttribute) {\n\t\t\tthis.setAttribute(name, '');\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.removeAttribute(name);\n\t\treturn false;\n\t}\n\n\tremoveAttribute(name: string): void {\n\t\tthis.fragmentHtml = undefined;\n\t\tthis.attributes.delete(name);\n\t}\n\n\tquerySelector(): Element | null {\n\t\treturn null;\n\t}\n\n\tquerySelectorAll(): Element[] {\n\t\treturn [];\n\t}\n\n\tmatches(): boolean {\n\t\treturn false;\n\t}\n\n\tget outerHTML(): string {\n\t\tif (this.fragmentHtml !== undefined) {\n\t\t\treturn this.fragmentHtml;\n\t\t}\n\n\t\tconst attributes = Array.from(this.attributes.entries())\n\t\t\t.map(([name, value]) => ` ${name}=\"${escapeHtmlAttribute(value)}\"`)\n\t\t\t.join('');\n\n\t\treturn `<${this.localName}${attributes}>${this.innerHTML}</${this.localName}>`;\n\t}\n\n\tget innerHTML(): string {\n\t\treturn this.childNodes.map((child) => serializeNodeHtml(child)).join('');\n\t}\n\n\tset innerHTML(html: string) {\n\t\tthis.fragmentHtml = undefined;\n\t\tthis.fragmentText = undefined;\n\t\tthis.replaceChildren(...parseHtmlToNodes(html, this.ownerDocument));\n\t}\n\n\toverride get textContent(): string {\n\t\treturn this.fragmentText ?? super.textContent ?? '';\n\t}\n\n\toverride set textContent(value: string | null) {\n\t\tthis.fragmentHtml = undefined;\n\t\tthis.fragmentText = value ?? '';\n\t\tsuper.textContent = value;\n\t}\n\n\tsetSerializedFragment(fragmentHtml: string, fragmentText: string, attributes: Record<string, string>): void {\n\t\tthis.fragmentHtml = fragmentHtml;\n\t\tthis.fragmentText = fragmentText;\n\t\tthis.attributes = new Map(Object.entries(attributes));\n\t\tthis.replaceChildren();\n\t}\n}\n\nclass MinimalEvent {\n\tpublic readonly bubbles: boolean;\n\tpublic readonly cancelable: boolean;\n\tpublic readonly composed: boolean;\n\tpublic readonly type: string;\n\n\tconstructor(type: string, eventInitDict: EventInit = {}) {\n\t\tthis.type = type;\n\t\tthis.bubbles = eventInitDict.bubbles ?? false;\n\t\tthis.cancelable = eventInitDict.cancelable ?? false;\n\t\tthis.composed = eventInitDict.composed ?? false;\n\t}\n}\n\nclass MinimalCustomEvent<T = unknown> extends MinimalEvent {\n\tpublic readonly detail: T;\n\n\tconstructor(type: string, eventInitDict: CustomEventInit<T> = {}) {\n\t\tsuper(type, eventInitDict);\n\t\tthis.detail = eventInitDict.detail as T;\n\t}\n}\n\nclass MinimalHTMLElement extends MinimalElement {\n\tpublic isConnected = false;\n\n\tconstructor(tagName = 'div', ownerDocument: Document | null = getInstalledDocumentLike()) {\n\t\tsuper(tagName, ownerDocument);\n\t}\n\n\tinsertAdjacentHTML(_position: InsertPosition, html: string): void {\n\t\tthis.append(...parseHtmlToNodes(html, this.ownerDocument));\n\t}\n\n\tconnectedCallback?(): void;\n\tattributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;\n\tdisconnectedCallback?(): void;\n}\n\nclass MinimalHtmlScriptElement extends MinimalHTMLElement {\n\tconstructor(ownerDocument: Document | null = getInstalledDocumentLike()) {\n\t\tsuper('script', ownerDocument);\n\t}\n}\n\nclass MinimalDocument extends MinimalNode {\n\tconstructor() {\n\t\tsuper(MinimalNode.DOCUMENT_NODE);\n\t}\n\n\tcreateElement(tagName: string): HTMLElement {\n\t\treturn (tagName.toLowerCase() === 'script'\n\t\t\t? new MinimalHtmlScriptElement(this as unknown as Document)\n\t\t\t: new MinimalHTMLElement(tagName, this as unknown as Document)) as unknown as HTMLElement;\n\t}\n\n\tcreateTextNode(value: string): Text {\n\t\treturn new MinimalTextNode(value, this as unknown as Document) as unknown as Text;\n\t}\n\n\tquerySelector(): Element | null {\n\t\treturn null;\n\t}\n\n\tquerySelectorAll(): Element[] {\n\t\treturn [];\n\t}\n}\n\nclass MinimalCustomElementsRegistry implements MinimalCustomElementRegistry {\n\tprivate definitions = new Map<string, CustomElementConstructor>();\n\n\tdefine(name: string, constructor: CustomElementConstructor): void {\n\t\tif (this.definitions.has(name)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.definitions.set(name, constructor);\n\t}\n\n\tget(name: string): CustomElementConstructor | undefined {\n\t\treturn this.definitions.get(name);\n\t}\n}\n\nlet installedWindow: LightDomShimWindow | undefined;\n\nconst minimalCssNamespace: MinimalCssNamespace = {\n\tescape(value: string): string {\n\t\treturn escapeCssIdentifier(String(value));\n\t},\n};\n\nfunction createTextNode(value: string): Node {\n\treturn new MinimalTextNode(value, getInstalledDocumentLike()) as unknown as Node;\n}\n\nfunction getInstalledDocumentLike(): Document | null {\n\treturn ((globalThis as typeof globalThis & { document?: Document }).document ?? null) as Document | null;\n}\n\nfunction getExistingWindowLike(): LightDomShimWindow | undefined {\n\tconst globalScope = globalThis as typeof globalThis & {\n\t\tCSS?: MinimalCssNamespace;\n\t\tCustomEvent?: typeof CustomEvent;\n\t\tDocument?: typeof Document;\n\t\tElement?: typeof Element;\n\t\tEvent?: typeof Event;\n\t\tEventTarget?: typeof EventTarget;\n\t\tHTMLScriptElement?: typeof HTMLScriptElement;\n\t\tHTMLElement?: typeof HTMLElement;\n\t\tNode?: typeof Node;\n\t\tdocument?: Document;\n\t\tcustomElements?: MinimalCustomElementRegistry;\n\t\twindow?: LightDomShimWindow;\n\t};\n\tconst existingCustomElements = globalScope.customElements;\n\n\tif (\n\t\ttypeof globalScope.Node === 'undefined' ||\n\t\ttypeof globalScope.Document === 'undefined' ||\n\t\ttypeof globalScope.Element === 'undefined' ||\n\t\ttypeof globalScope.HTMLElement === 'undefined' ||\n\t\ttypeof globalScope.document === 'undefined' ||\n\t\t!existingCustomElements ||\n\t\ttypeof existingCustomElements.define !== 'function' ||\n\t\ttypeof existingCustomElements.get !== 'function'\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn (\n\t\tglobalScope.window ?? {\n\t\t\tCSS: globalScope.CSS ?? minimalCssNamespace,\n\t\t\tCustomEvent: (globalScope.CustomEvent ?? MinimalCustomEvent) as typeof CustomEvent,\n\t\t\tDocument: globalScope.Document,\n\t\t\tElement: globalScope.Element,\n\t\t\tEvent: (globalScope.Event ?? MinimalEvent) as typeof Event,\n\t\t\tEventTarget: (globalScope.EventTarget ?? EventTarget) as typeof EventTarget,\n\t\t\tHTMLScriptElement: (globalScope.HTMLScriptElement ?? globalScope.HTMLElement) as typeof HTMLScriptElement,\n\t\t\tHTMLElement: globalScope.HTMLElement,\n\t\t\tNode: globalScope.Node,\n\t\t\tdocument: globalScope.document,\n\t\t\tcustomElements: existingCustomElements,\n\t\t}\n\t);\n}\n\n/** Ensures that a minimal window-like SSR runtime is available and returns it. */\nexport function ensureLightDomShim(): LightDomShimWindow {\n\tconst existingWindow = getExistingWindowLike();\n\n\tif (existingWindow) {\n\t\treturn existingWindow;\n\t}\n\n\treturn installLightDomShim();\n}\n\n/**\n * Creates a reusable SSR environment that can prepare a component host with\n * authored light-DOM content before rendering.\n *\n * Adapters can reuse a single environment across multiple render calls when\n * they want a single host-preparation entrypoint backed by the installed shim.\n */\n\nexport function createServerRenderEnvironment(): ServerRenderEnvironment {\n\tensureLightDomShim();\n\n\treturn {\n\t\tprepareHost(host: HTMLElement, options: PrepareServerRenderHostOptions = {}): void {\n\t\t\tif (options.authoredContent !== undefined) {\n\t\t\t\thost.innerHTML = options.authoredContent;\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * Installs the smallest global surface needed to instantiate Radiant custom elements during SSR.\n */\nexport function installLightDomShim(): LightDomShimWindow {\n\tconst existingWindow = getExistingWindowLike();\n\n\tif (existingWindow) {\n\t\treturn existingWindow;\n\t}\n\n\tif (installedWindow) {\n\t\treturn installedWindow;\n\t}\n\n\tconst customElements = new MinimalCustomElementsRegistry();\n\tconst document = new MinimalDocument() as unknown as Document;\n\tconst EventConstructor = (globalThis.Event ?? MinimalEvent) as typeof Event;\n\tconst CustomEventConstructor = (globalThis.CustomEvent ?? MinimalCustomEvent) as typeof CustomEvent;\n\tconst DocumentConstructor = MinimalDocument as unknown as typeof Document;\n\tconst EventTargetConstructor = (globalThis.EventTarget ?? EventTarget) as typeof EventTarget;\n\tinstalledWindow = {\n\t\tCSS: (globalThis.CSS as MinimalCssNamespace | undefined) ?? minimalCssNamespace,\n\t\tCustomEvent: CustomEventConstructor,\n\t\tDocument: DocumentConstructor,\n\t\tElement: MinimalElement as unknown as typeof Element,\n\t\tEvent: EventConstructor,\n\t\tEventTarget: EventTargetConstructor,\n\t\tHTMLScriptElement: MinimalHtmlScriptElement as unknown as typeof HTMLScriptElement,\n\t\tHTMLElement: MinimalHTMLElement as unknown as typeof HTMLElement,\n\t\tNode: MinimalNode as unknown as typeof Node,\n\t\tdocument,\n\t\tcustomElements,\n\t};\n\n\tObject.assign(globalThis, {\n\t\tCSS: (globalThis.CSS as MinimalCssNamespace | undefined) ?? minimalCssNamespace,\n\t\tCustomEvent: CustomEventConstructor,\n\t\tDocument: DocumentConstructor,\n\t\tElement: MinimalElement,\n\t\tEvent: EventConstructor,\n\t\tEventTarget: EventTargetConstructor,\n\t\tHTMLScriptElement: MinimalHtmlScriptElement,\n\t\tHTMLElement: MinimalHTMLElement,\n\t\tNode: MinimalNode,\n\t\tdocument,\n\t\tcustomElements,\n\t\twindow: installedWindow,\n\t});\n\n\treturn installedWindow;\n}\n\nfunction createElementFromFragment(fragment: string, tag: ParsedHtmlTag, ownerDocument: Document | null): Node {\n\tconst element =\n\t\ttag.tagName === 'script'\n\t\t\t? (new MinimalHtmlScriptElement(ownerDocument) as MinimalElement)\n\t\t\t: new MinimalHTMLElement(tag.tagName, ownerDocument);\n\n\telement.setSerializedFragment(fragment, extractTextContent(tag.innerHtml), tag.attributes);\n\treturn element as unknown as Node;\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n\nfunction extractTextContent(html: string): string {\n\treturn html.replace(/<!--.*?-->/gs, '').replace(/<[^>]+>/g, '');\n}\n\nfunction parseHtmlToNodes(html: string, ownerDocument: Document | null = getInstalledDocumentLike()): Node[] {\n\treturn collectTopLevelHtmlFragments(html).map((fragment) => {\n\t\tif (!fragment.startsWith('<')) {\n\t\t\treturn new MinimalTextNode(fragment, ownerDocument) as unknown as Node;\n\t\t}\n\n\t\tconst tag = parseHtmlTagToken(fragment, 0);\n\n\t\tif (!tag || tag.type !== 'open') {\n\t\t\treturn new MinimalTextNode(fragment, ownerDocument) as unknown as Node;\n\t\t}\n\n\t\treturn createElementFromFragment(fragment, tag, ownerDocument);\n\t});\n}\n\nfunction toDataAttributeName(property: string): string {\n\treturn `data-${property.replace(/([A-Z])/g, '-$1').toLowerCase()}`;\n}\n\nfunction toDatasetPropertyName(attributeName: string): string {\n\treturn attributeName.replace(/-([a-z])/g, (_match, character: string) => character.toUpperCase());\n}\n\nfunction escapeCssIdentifier(value: string): string {\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 &&\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) &&\n\t\t\t(value[0] ?? '') === '-';\n\t\tconst isSingleHyphen = index === 0 && character === '-' && value.length === 1;\n\n\t\tif (isControlCharacter || startsWithDigit || startsWithHyphenDigit) {\n\t\t\tescaped += `\\\\${codePoint.toString(16)} `;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\tcodePoint >= 0x0080 ||\n\t\t\tcharacter === '-' ||\n\t\t\tcharacter === '_' ||\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) ||\n\t\t\t(codePoint >= 0x0041 && codePoint <= 0x005a) ||\n\t\t\t(codePoint >= 0x0061 && codePoint <= 0x007a)\n\t\t) {\n\t\t\tescaped += isSingleHyphen ? `\\\\${character}` : character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tescaped += `\\\\${character}`;\n\t}\n\n\treturn escaped;\n}\n\nfunction serializeNodeHtml(node: Node): string {\n\tif (node.nodeType === MinimalNode.TEXT_NODE) {\n\t\treturn node.textContent ?? '';\n\t}\n\n\treturn 'outerHTML' in node && typeof node.outerHTML === 'string' ? node.outerHTML : (node.textContent ?? '');\n}\n",
|
|
17
|
-
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport {\n\tgetRadiantElementSsrRuntime,\n\ttype RadiantElementRenderBridge,\n\ttype RadiantElementSsrCapable,\n} from '../core/radiant-component-ssr-registry';\nimport { withSsrContextProviders } from './context-ssr';\nimport type { ContextType, UnknownContext } from '../context/types';\nimport { getCustomElementTagName } from '../core/custom-element-metadata';\nimport { createServerRenderEnvironment, type ServerRenderEnvironment } from './light-dom-shim';\nimport { ensureRadiantElementSsrRuntimeRegistered } from './radiant-component-ssr-runtime';\n\nensureRadiantElementSsrRuntimeRegistered();\n\n/** Asset dependency emitted by a rendered fragment. */\nexport type RenderedComponentAsset =\n\t| {\n\t\t\t/** Browser module specifier that must be loaded to activate the fragment. */\n\t\t\tkind: 'script-module';\n\t\t\t/** Runtime loading policy for the module. */\n\t\t\tstage?: 'hydrate' | 'idle' | 'immediate';\n\t\t\t/** Module specifier or browser-importable URL. */\n\t\t\tsrc: string;\n\t }\n\t| {\n\t\t\t/** Module graph preload hint for adapters that control the document head. */\n\t\t\tkind: 'modulepreload';\n\t\t\t/** Module specifier or browser-importable URL. */\n\t\t\thref: string;\n\t }\n\t| {\n\t\t\t/** Stylesheet dependency required by the rendered fragment. */\n\t\t\tkind: 'style';\n\t\t\t/** Browser-importable stylesheet URL. */\n\t\t\thref: string;\n\t\t\t/** Optional media query applied to the stylesheet link. */\n\t\t\tmedia?: string;\n\t };\n\n/** Creates a module asset entry for a rendered fragment. */\nexport function scriptModuleAsset(\n\tsrc: string,\n\tstage: 'hydrate' | 'idle' | 'immediate' = 'hydrate',\n): RenderedComponentAsset {\n\treturn { kind: 'script-module', src, stage };\n}\n\n/** Creates a modulepreload hint for a rendered fragment. */\nexport function modulePreloadAsset(href: string): RenderedComponentAsset {\n\treturn { kind: 'modulepreload', href };\n}\n\n/** Creates a stylesheet asset entry for a rendered fragment. */\nexport function styleAsset(href: string, media?: string): RenderedComponentAsset {\n\treturn media ? { kind: 'style', href, media } : { kind: 'style', href };\n}\n\n/** Portable metadata for a server-rendered custom-element fragment. */\nexport type RenderedComponentMetadata = {\n\t/** Asset dependencies required by the rendered fragment. */\n\tassets: readonly RenderedComponentAsset[];\n\t/** Browser-importable client module URL used to register the component before hydration. */\n\tclientModuleUrl?: string;\n\t/** ISO timestamp describing when the fragment was rendered. */\n\tgeneratedAt: string;\n\t/** Custom-element tag name emitted at the fragment root. */\n\ttagName: string;\n};\n\n/** Canonical server render result returned by `renderComponent()`. */\nexport type RenderedComponent = {\n\t/** Serialized custom-element host markup. */\n\tmarkup: string;\n\t/** Transport-agnostic metadata that adapters can map onto headers or JSON. */\n\tmetadata: RenderedComponentMetadata;\n\t/** JSX-compatible preview value that can be embedded into a larger SSR shell. */\n\tpreview: JsxRenderable;\n};\n\n/** Serializable metadata for a server-rendered custom-element fragment. */\nexport type RenderedComponentPayload = {\n\t/** Asset dependencies required by the rendered fragment. */\n\tassets?: readonly RenderedComponentAsset[];\n\t/** Browser-importable client module URL used to register the component before hydration. */\n\tclientModuleSrc?: string;\n\t/** ISO timestamp describing when the fragment was rendered. */\n\tgeneratedAt: string;\n\t/** Serialized custom-element host markup. */\n\tmarkup: string;\n\t/** Custom-element tag name emitted at the fragment root. */\n\ttagName: string;\n};\n\n/** Full SSR result including a JSX-compatible preview value for shell composition. */\nexport type RenderedComponentWithPreview = RenderedComponentPayload & {\n\t/** JSX-compatible preview value that can be embedded into a larger SSR shell. */\n\tpreview: JsxRenderable;\n};\n\n/** Minimal component contract needed for framework-agnostic SSR helpers. */\nexport type ServerRenderableComponent = {\n\trenderHost?: () => JsxRenderable;\n\trenderHostToString: (options?: RenderToStringOptions) => string;\n};\n\n/** Constructor shape for a server-renderable component. */\nexport type ServerRenderableComponentConstructor<TComponent extends ServerRenderableComponent> =\n\tCustomElementConstructor & {\n\t\tnew (): TComponent;\n\t};\n\n/**\n * Resolves the browser-importable client module URL for a component constructor.\n *\n * Use this when the server adapter can derive the client entry lazily instead of\n * hardcoding `clientModuleSrc` for every render call.\n */\nexport type ResolveRenderedComponentClientModule<TComponent extends ServerRenderableComponent> = (\n\tcomponent: ServerRenderableComponentConstructor<TComponent>,\n) => string | undefined | Promise<string | undefined>;\n\n/**\n * Resolves fragment assets for a component constructor.\n *\n * Prefer this over `resolveClientModuleSrc(...)` for new adapters so assets can\n * describe scripts, styles, and preload hints through one transport-agnostic shape.\n */\nexport type ResolveRenderedComponentAssets<TComponent extends ServerRenderableComponent> = (\n\tcomponent: ServerRenderableComponentConstructor<TComponent>,\n) => readonly RenderedComponentAsset[] | undefined | Promise<readonly RenderedComponentAsset[] | undefined>;\n\n/**\n * Prepares a component host before SSR so slot-aware logic can observe authored\n * light-DOM content during render.\n */\nexport type PrepareRenderedComponentHost<TComponent extends ServerRenderableComponent> = (\n\thost: TComponent & HTMLElement,\n\tenvironment: ServerRenderEnvironment,\n) => void;\n\n/**\n * Ambient SSR context value visible while a standalone component render runs.\n *\n * This lets adapters provide ancestor-like context to `consumeContext(...)` and\n * `contextSelector(...)` without needing to instantiate a real provider host.\n */\nexport type RenderComponentSsrContextEntry<TContext extends UnknownContext = UnknownContext> = {\n\tcontext: TContext;\n\tvalue: ContextType<TContext>;\n};\n\ntype RenderComponentSharedOptions<TComponent extends ServerRenderableComponent> = {\n\t/** Asset dependencies required by the rendered fragment. */\n\tassets?: readonly RenderedComponentAsset[];\n\t/** Serialized authored light-DOM content to attach to the host before rendering. */\n\tauthoredContent?: string;\n\t/** Browser-importable client module URL used to register the component before hydration. */\n\tclientModuleSrc?: string;\n\t/** Initializes the component instance before the host is rendered. */\n\tinitialize?: (component: TComponent) => void;\n\t/** SSR environment responsible for preparing the host runtime and authored content. */\n\tenvironment?: ServerRenderEnvironment;\n\t/**\n\t * Dedicated host-preparation hook for slot-aware SSR.\n\t *\n\t * Use this when the server needs to append or mutate authored light-DOM\n\t * nodes directly instead of passing `authoredContent` as a string.\n\t */\n\tprepareHost?: PrepareRenderedComponentHost<TComponent>;\n\t/**\n\t * Ambient SSR context entries that should be visible while the component is\n\t * instantiated and rendered.\n\t *\n\t * This solves standalone fragment renders that need to consume context from a\n\t * parent-like server environment.\n\t */\n\tssrContext?: readonly RenderComponentSsrContextEntry[];\n\t/** Clock override used by tests and adapters that need deterministic timestamps. */\n\tnow?: () => Date;\n\t/** JSX server-renderer options forwarded to `renderHostToString()`. */\n\trenderOptions?: RenderToStringOptions;\n\t/** Lazy asset resolver used when `assets` are not provided directly. */\n\tresolveAssets?: ResolveRenderedComponentAssets<TComponent>;\n\t/** Lazy client-module resolver used when `clientModuleSrc` is not provided directly. */\n\tresolveClientModuleSrc?: ResolveRenderedComponentClientModule<TComponent>;\n\t/** Explicit tag-name override when `@customElement(...)` metadata is not desired. */\n\ttagName?: string;\n};\n\n/** Options accepted by the reusable SSR component rendering helpers. */\nexport type RenderComponentOptions<TComponent extends ServerRenderableComponent> =\n\tRenderComponentSharedOptions<TComponent> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\tcomponent: ServerRenderableComponentConstructor<TComponent>;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tload: () => Promise<ServerRenderableComponentConstructor<TComponent>>;\n\t\t\t }\n\t\t);\n\n/** Call-site options used when the component constructor is passed directly. */\nexport type RenderComponentCallOptions<TComponent extends ServerRenderableComponent> =\n\tRenderComponentSharedOptions<TComponent>;\n\n/**\n * Serializes a custom element into HTML, inferring its tag name from\n * `@customElement(...)` metadata when the caller does not provide one.\n */\nexport function renderComponentToString<TComponent extends ServerRenderableComponent>(\n\tcomponent: ServerRenderableComponentConstructor<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<string>;\n\nexport function renderComponentToString<TComponent extends ServerRenderableComponent>(\n\toptions: RenderComponentOptions<TComponent>,\n): Promise<string>;\n\nexport async function renderComponentToString<TComponent extends ServerRenderableComponent>(\n\tcomponentOrOptions: ServerRenderableComponentConstructor<TComponent> | RenderComponentOptions<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<string> {\n\treturn (await renderResolvedComponent(normalizeRenderComponentOptions(componentOrOptions, options))).markup;\n}\n\n/**\n * Renders a custom element into the canonical portable server-rendered shape,\n * separating transport-agnostic metadata from any HTTP-specific adapter.\n */\nexport function renderComponent<TComponent extends ServerRenderableComponent>(\n\tcomponent: ServerRenderableComponentConstructor<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<RenderedComponent>;\n\nexport function renderComponent<TComponent extends ServerRenderableComponent>(\n\toptions: RenderComponentOptions<TComponent>,\n): Promise<RenderedComponent>;\n\nexport async function renderComponent<TComponent extends ServerRenderableComponent>(\n\tcomponentOrOptions: ServerRenderableComponentConstructor<TComponent> | RenderComponentOptions<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<RenderedComponent> {\n\treturn renderResolvedComponent(normalizeRenderComponentOptions(componentOrOptions, options));\n}\n\n/**\n * Serializes a custom element into a fragment payload that frameworks can\n * attach to any response shape they prefer.\n */\nexport function renderComponentToPayload<TComponent extends ServerRenderableComponent>(\n\tcomponent: ServerRenderableComponentConstructor<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<RenderedComponentPayload>;\n\nexport function renderComponentToPayload<TComponent extends ServerRenderableComponent>(\n\toptions: RenderComponentOptions<TComponent>,\n): Promise<RenderedComponentPayload>;\n\nexport async function renderComponentToPayload<TComponent extends ServerRenderableComponent>(\n\tcomponentOrOptions: ServerRenderableComponentConstructor<TComponent> | RenderComponentOptions<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<RenderedComponentPayload> {\n\treturn toRenderedComponentPayload(\n\t\tawait renderResolvedComponent(normalizeRenderComponentOptions(componentOrOptions, options)),\n\t);\n}\n\n/**\n * Renders a component into both fragment metadata and a JSX-compatible preview\n * value that can be embedded into a larger server-rendered shell.\n */\nexport function renderComponentWithPreview<TComponent extends ServerRenderableComponent>(\n\tcomponent: ServerRenderableComponentConstructor<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<RenderedComponentWithPreview>;\n\nexport function renderComponentWithPreview<TComponent extends ServerRenderableComponent>(\n\toptions: RenderComponentOptions<TComponent>,\n): Promise<RenderedComponentWithPreview>;\n\nexport async function renderComponentWithPreview<TComponent extends ServerRenderableComponent>(\n\tcomponentOrOptions: ServerRenderableComponentConstructor<TComponent> | RenderComponentOptions<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): Promise<RenderedComponentWithPreview> {\n\treturn toRenderedComponentWithPreview(\n\t\tawait renderResolvedComponent(normalizeRenderComponentOptions(componentOrOptions, options)),\n\t);\n}\n\nasync function renderResolvedComponent<TComponent extends ServerRenderableComponent>(\n\tnormalizedOptions: RenderComponentOptions<TComponent>,\n): Promise<RenderedComponent> {\n\tensureRadiantElementSsrRuntimeRegistered();\n\n\tconst environment = normalizedOptions.environment ?? createServerRenderEnvironment();\n\tconst restoreAmbientContext = withSsrContextProviders(\n\t\tcreateAmbientSsrContextProviders(normalizedOptions.ssrContext),\n\t);\n\n\ttry {\n\t\tconst Component =\n\t\t\t'component' in normalizedOptions ? normalizedOptions.component : await normalizedOptions.load();\n\t\tconst component = new Component();\n\t\tprepareRenderedComponentHost(\n\t\t\tenvironment,\n\t\t\tcomponent,\n\t\t\tnormalizedOptions.authoredContent,\n\t\t\tnormalizedOptions.prepareHost,\n\t\t);\n\t\tnormalizedOptions.initialize?.(component);\n\n\t\tconst resolvedClientModuleSrc =\n\t\t\tnormalizedOptions.clientModuleSrc ?? (await normalizedOptions.resolveClientModuleSrc?.(Component));\n\t\tconst resolvedAssets = normalizedOptions.assets ?? (await normalizedOptions.resolveAssets?.(Component)) ?? [];\n\t\tconst assets = mergeRenderedComponentAssets(resolvedAssets, resolvedClientModuleSrc);\n\t\tconst clientModuleSrc = resolvePrimaryClientModuleSrc(assets) ?? resolvedClientModuleSrc;\n\t\tconst tagName = normalizedOptions.tagName ?? resolveRenderedComponentTagName(Component);\n\t\tconst generatedAt = (normalizedOptions.now ?? createDefaultRenderTimestamp)().toISOString();\n\t\tconst renderOptions = normalizeRenderOptions(normalizedOptions.renderOptions);\n\t\tconst radiantSsrBridge = getRadiantElementRenderBridge(component as unknown as RadiantElementSsrCapable);\n\t\tconst markup =\n\t\t\tradiantSsrBridge?.renderHostToString?.(renderOptions) ?? component.renderHostToString(renderOptions);\n\t\tconst preview = resolveRenderedComponentPreview(component, radiantSsrBridge, markup);\n\n\t\treturn {\n\t\t\tmarkup,\n\t\t\tmetadata: {\n\t\t\t\tassets,\n\t\t\t\tclientModuleUrl: clientModuleSrc,\n\t\t\t\tgeneratedAt,\n\t\t\t\ttagName,\n\t\t\t},\n\t\t\tpreview,\n\t\t};\n\t} finally {\n\t\trestoreAmbientContext();\n\t}\n}\n\nfunction getRadiantElementRenderBridge(component: RadiantElementSsrCapable): RadiantElementRenderBridge | undefined {\n\treturn getRadiantElementSsrRuntime()?.resolveRenderBridge(component);\n}\n\n/**\n * Chooses the preview renderable returned by `renderComponent()`.\n *\n * When a component overrides only `renderHostToString()`, the inherited\n * `renderHost()` implementation would otherwise generate a different preview\n * tree than the final serialized markup. In that case the preview falls back to\n * the already-computed markup so shell composition stays aligned with the real\n * SSR output.\n */\nfunction resolveRenderedComponentPreview<TComponent extends ServerRenderableComponent>(\n\tcomponent: TComponent,\n\tradiantSsrBridge: RadiantElementRenderBridge | undefined,\n\tmarkup: string,\n): JsxRenderable {\n\tif (!radiantSsrBridge) {\n\t\treturn component.renderHost?.() ?? { nodeType: 1, outerHTML: markup };\n\t}\n\n\tif (!radiantSsrBridge.renderHostToString && radiantSsrBridge.renderHost) {\n\t\treturn { nodeType: 1, outerHTML: markup };\n\t}\n\n\treturn radiantSsrBridge.renderHost?.() ?? component.renderHost?.() ?? { nodeType: 1, outerHTML: markup };\n}\n\nfunction prepareRenderedComponentHost<TComponent extends ServerRenderableComponent>(\n\tenvironment: ServerRenderEnvironment,\n\tcomponent: TComponent,\n\tauthoredContent: string | undefined,\n\tprepareHost: PrepareRenderedComponentHost<TComponent> | undefined,\n): void {\n\tif (!canPrepareSsrHost(component)) {\n\t\tif (authoredContent === undefined && prepareHost === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tthrow new Error(\n\t\t\t`${component.constructor.name} cannot prepare SSR host content because it does not expose an innerHTML host surface.`,\n\t\t);\n\t}\n\n\tenvironment.prepareHost(component, { authoredContent });\n\tprepareHost?.(component, environment);\n}\n\n/**\n * Wraps ad-hoc `ssrContext` values in provider-like objects so the existing SSR\n * context stack can resolve them exactly like real ancestor providers.\n */\nfunction createAmbientSsrContextProviders(\n\tentries: readonly RenderComponentSsrContextEntry[] | undefined,\n): SsrSerializableContextProvider[] {\n\tif (!entries || entries.length === 0) {\n\t\treturn [];\n\t}\n\n\treturn entries.map((entry) => ({\n\t\tgetContext: () => entry.value,\n\t\tgetContextKey: () => entry.context,\n\t\trenderHydrationScript: () => undefined,\n\t\trenderHydrationScriptTag: () => undefined,\n\t}));\n}\n\n/**\n * Drops the preview renderable so the result can be sent through lightweight\n * framework adapters or JSON/HTML fragment endpoints.\n */\nexport function toRenderedComponentPayload(\n\trender: RenderedComponentWithPreview | RenderedComponent,\n): RenderedComponentPayload {\n\tif ('metadata' in render) {\n\t\treturn {\n\t\t\tassets: render.metadata.assets,\n\t\t\tclientModuleSrc: render.metadata.clientModuleUrl,\n\t\t\tgeneratedAt: render.metadata.generatedAt,\n\t\t\tmarkup: render.markup,\n\t\t\ttagName: render.metadata.tagName,\n\t\t};\n\t}\n\n\tconst { preview: _preview, ...payload } = render;\n\treturn payload;\n}\nfunction toRenderedComponentWithPreview(render: RenderedComponent): RenderedComponentWithPreview {\n\treturn {\n\t\tassets: render.metadata.assets,\n\t\tclientModuleSrc: render.metadata.clientModuleUrl,\n\t\tgeneratedAt: render.metadata.generatedAt,\n\t\tmarkup: render.markup,\n\t\tpreview: render.preview,\n\t\ttagName: render.metadata.tagName,\n\t};\n}\n\nfunction createDefaultRenderTimestamp(): Date {\n\treturn new Date();\n}\n\nfunction createRenderedComponentClientModuleAssets(\n\tclientModuleSrc: string | undefined,\n): readonly RenderedComponentAsset[] {\n\tif (!clientModuleSrc) {\n\t\treturn [];\n\t}\n\n\treturn [scriptModuleAsset(clientModuleSrc)];\n}\n\nexport function mergeRenderedComponentAssets(\n\tassets: readonly RenderedComponentAsset[],\n\tclientModuleSrc: string | undefined,\n): readonly RenderedComponentAsset[] {\n\tif (!clientModuleSrc) {\n\t\treturn assets;\n\t}\n\n\tif (assets.some((asset) => asset.kind === 'script-module' && asset.src === clientModuleSrc)) {\n\t\treturn assets;\n\t}\n\n\treturn [...createRenderedComponentClientModuleAssets(clientModuleSrc), ...assets];\n}\n\nexport function resolvePrimaryClientModuleSrc(assets: readonly RenderedComponentAsset[]): string | undefined {\n\treturn assets.find((asset) => asset.kind === 'script-module')?.src;\n}\n\nfunction normalizeRenderComponentOptions<TComponent extends ServerRenderableComponent>(\n\tcomponentOrOptions: ServerRenderableComponentConstructor<TComponent> | RenderComponentOptions<TComponent>,\n\toptions?: RenderComponentCallOptions<TComponent>,\n): RenderComponentOptions<TComponent> {\n\tif (typeof componentOrOptions === 'function') {\n\t\treturn {\n\t\t\t...options,\n\t\t\tcomponent: componentOrOptions,\n\t\t};\n\t}\n\n\treturn componentOrOptions;\n}\n\nexport function normalizeRenderOptions(options: RenderToStringOptions | undefined): RenderToStringOptions {\n\tif (options?.mode !== undefined || options?.hydrate !== undefined) {\n\t\treturn options;\n\t}\n\n\treturn {\n\t\t...options,\n\t\tmode: 'hydrate',\n\t};\n}\n\nfunction canPrepareSsrHost<TComponent extends ServerRenderableComponent>(\n\tcomponent: TComponent,\n): component is TComponent & HTMLElement {\n\treturn 'innerHTML' in component;\n}\n\nfunction resolveRenderedComponentTagName(target: CustomElementConstructor): string {\n\tconst tagName = getCustomElementTagName(target);\n\n\tif (!tagName) {\n\t\tthrow new Error(`${target.name} is missing @customElement metadata.`);\n\t}\n\n\treturn tagName;\n}\n",
|
|
18
|
-
"import { renderToString as renderJsxToString, type RenderToStringOptions } from '@ecopages/jsx/server';\nimport { getControllerIdentifier } from '../core/controller-metadata';\nimport type { RadiantController } from '../core/radiant-controller';\nimport { CONTROLLER_ATTRIBUTE } from '../controller-registry';\nimport { ensureLightDomShim } from './light-dom-shim';\nimport {\n\tmergeRenderedComponentAssets,\n\tnormalizeRenderOptions,\n\tresolvePrimaryClientModuleSrc,\n\ttoRenderedComponentPayload,\n\ttype RenderedComponent,\n\ttype RenderedComponentAsset,\n\ttype RenderedComponentPayload,\n\ttype RenderedComponentWithPreview,\n} from './render-component';\nimport { ensureRadiantElementSsrRuntimeRegistered } from './radiant-component-ssr-runtime';\n\n/** Constructor shape for a server-renderable controller. */\nexport type ServerRenderableControllerConstructor<TController extends RadiantController = RadiantController> = new (\n\thost: Element,\n) => TController;\n\n/** Serializable controller host attribute values accepted by `renderController()`. */\nexport type RenderedControllerHostAttributeValue = boolean | number | string | null | undefined;\n\n/** JSX-like class value accepted by `renderController({ host })`. */\nexport type RenderedControllerHostClassValue =\n\t| bigint\n\t| boolean\n\t| number\n\t| string\n\t| null\n\t| undefined\n\t| readonly RenderedControllerHostClassValue[]\n\t| Record<string, unknown>;\n\n/** Declarative controller host attributes accepted by `renderController()`. */\nexport type RenderedControllerHostAttributes = Record<string, RenderedControllerHostAttributeValue>;\n\n/** JSX-like host options accepted by `renderController()`. */\nexport type RenderedControllerHostOptions = {\n\taria?: Record<string, RenderedControllerHostAttributeValue>;\n\tclass?: RenderedControllerHostClassValue;\n\tclasses?: RenderedControllerHostClassValue;\n\tdata?: Record<string, RenderedControllerHostAttributeValue>;\n};\n\n/**\n * Resolves the browser-importable client module URL for a controller constructor.\n */\nexport type ResolveRenderedControllerClientModule<TController extends RadiantController> = (\n\tcontroller: ServerRenderableControllerConstructor<TController>,\n) => string | undefined | Promise<string | undefined>;\n\n/**\n * Resolves fragment assets for a controller constructor.\n */\nexport type ResolveRenderedControllerAssets<TController extends RadiantController> = (\n\tcontroller: ServerRenderableControllerConstructor<TController>,\n) => readonly RenderedComponentAsset[] | undefined | Promise<readonly RenderedComponentAsset[] | undefined>;\n\n/** Call-site options used by the controller SSR helpers. */\nexport type RenderControllerCallOptions<TController extends RadiantController> = {\n\t/** Asset dependencies required by the rendered fragment. */\n\tassets?: readonly RenderedComponentAsset[];\n\t/** Low-level flat host attributes serialized onto the rendered controller host. */\n\tattributes?: RenderedControllerHostAttributes;\n\t/** JSX-like host config with `data` and `aria` object expansion. */\n\thost?: RenderedControllerHostOptions;\n\t/** Browser-importable client module URL used to register the controller before hydration. */\n\tclientModuleSrc?: string;\n\t/** Initializes the controller instance before render. */\n\tinitialize?: (controller: TController) => void;\n\t/** Clock override used by tests and adapters that need deterministic timestamps. */\n\tnow?: () => Date;\n\t/** JSX server-renderer options forwarded to the controller view render. */\n\trenderOptions?: RenderToStringOptions;\n\t/** Lazy asset resolver used when `assets` are not provided directly. */\n\tresolveAssets?: ResolveRenderedControllerAssets<TController>;\n\t/** Lazy client-module resolver used when `clientModuleSrc` is not provided directly. */\n\tresolveClientModuleSrc?: ResolveRenderedControllerClientModule<TController>;\n\t/** Explicit host tag emitted at the fragment root. */\n\ttagName: string;\n};\n\n/** Serializes a controller host into HTML using an explicit host tag and attributes. */\nexport async function renderControllerToString<TController extends RadiantController>(\n\tcontroller: ServerRenderableControllerConstructor<TController>,\n\toptions: RenderControllerCallOptions<TController>,\n): Promise<string> {\n\treturn (await renderResolvedController(controller, options)).markup;\n}\n\n/** Renders a controller host into the canonical portable server-rendered shape. */\nexport async function renderController<TController extends RadiantController>(\n\tcontroller: ServerRenderableControllerConstructor<TController>,\n\toptions: RenderControllerCallOptions<TController>,\n): Promise<RenderedComponent> {\n\treturn renderResolvedController(controller, options);\n}\n\n/** Serializes a controller host into a fragment payload that frameworks can attach to any response shape. */\nexport async function renderControllerToPayload<TController extends RadiantController>(\n\tcontroller: ServerRenderableControllerConstructor<TController>,\n\toptions: RenderControllerCallOptions<TController>,\n): Promise<RenderedComponentPayload> {\n\treturn toRenderedComponentPayload(await renderResolvedController(controller, options));\n}\n\n/** Renders a controller host into payload fields plus a JSX-compatible preview value. */\nexport async function renderControllerWithPreview<TController extends RadiantController>(\n\tcontroller: ServerRenderableControllerConstructor<TController>,\n\toptions: RenderControllerCallOptions<TController>,\n): Promise<RenderedComponentWithPreview> {\n\treturn toRenderedComponentWithPreview(await renderResolvedController(controller, options));\n}\n\nasync function renderResolvedController<TController extends RadiantController>(\n\tController: ServerRenderableControllerConstructor<TController>,\n\toptions: RenderControllerCallOptions<TController>,\n): Promise<RenderedComponent> {\n\tensureRadiantElementSsrRuntimeRegistered();\n\n\tconst tagName = normalizeRenderedControllerTagName(options.tagName);\n\tconst host = createRenderedControllerHost(tagName, normalizeRenderedControllerHostAttributes(Controller, options));\n\tconst controller = new Controller(host);\n\n\ttry {\n\t\toptions.initialize?.(controller);\n\t\tcontroller.connectForSsrRender();\n\n\t\tconst resolvedClientModuleSrc = options.clientModuleSrc ?? (await options.resolveClientModuleSrc?.(Controller));\n\t\tconst resolvedAssets = options.assets ?? (await options.resolveAssets?.(Controller)) ?? [];\n\t\tconst assets = mergeRenderedComponentAssets(resolvedAssets, resolvedClientModuleSrc);\n\t\tconst clientModuleSrc = resolvePrimaryClientModuleSrc(assets) ?? resolvedClientModuleSrc;\n\t\tconst generatedAt = (options.now ?? createDefaultRenderTimestamp)().toISOString();\n\t\tconst renderOptions = normalizeRenderOptions(options.renderOptions);\n\t\tconst markup = renderRenderedControllerHost(controller, tagName, renderOptions);\n\n\t\treturn {\n\t\t\tmarkup,\n\t\t\tmetadata: {\n\t\t\t\tassets,\n\t\t\t\tclientModuleUrl: clientModuleSrc,\n\t\t\t\tgeneratedAt,\n\t\t\t\ttagName,\n\t\t\t},\n\t\t\tpreview: { nodeType: 1, outerHTML: markup },\n\t\t};\n\t} finally {\n\t\tcontroller.disconnectForSsrRender();\n\t}\n}\n\nfunction toRenderedComponentWithPreview(render: RenderedComponent): RenderedComponentWithPreview {\n\treturn {\n\t\tassets: render.metadata.assets,\n\t\tclientModuleSrc: render.metadata.clientModuleUrl,\n\t\tgeneratedAt: render.metadata.generatedAt,\n\t\tmarkup: render.markup,\n\t\tpreview: render.preview,\n\t\ttagName: render.metadata.tagName,\n\t};\n}\n\nfunction createDefaultRenderTimestamp(): Date {\n\treturn new Date();\n}\n\nfunction normalizeRenderedControllerTagName(tagName: string): string {\n\tconst normalizedTagName = tagName.trim().toLowerCase();\n\n\tif (!normalizedTagName) {\n\t\tthrow new Error('Controller SSR host tagName is required.');\n\t}\n\n\treturn normalizedTagName;\n}\n\nfunction createRenderedControllerHost(tagName: string, attributes: RenderedControllerHostAttributes): Element {\n\tensureLightDomShim();\n\tconst documentLike = (globalThis as typeof globalThis & { document?: Document }).document;\n\tconst host = documentLike\n\t\t? documentLike.createElement(tagName)\n\t\t: new (globalThis as typeof globalThis & { HTMLElement: new (tagName?: string) => HTMLElement }).HTMLElement(\n\t\t\t\ttagName,\n\t\t\t);\n\n\tfor (const [name, value] of Object.entries(attributes)) {\n\t\tif (value === undefined || value === null || value === false) {\n\t\t\tcontinue;\n\t\t}\n\n\t\thost.setAttribute(name, value === true ? '' : String(value));\n\t}\n\n\treturn host;\n}\n\nfunction normalizeRenderedControllerHostAttributes<TController extends RadiantController>(\n\tController: ServerRenderableControllerConstructor<TController>,\n\toptions: RenderControllerCallOptions<TController>,\n): RenderedControllerHostAttributes {\n\tconst normalizedAttributes: RenderedControllerHostAttributes = {};\n\tconst host = options.host;\n\n\tconst mergedClassValue = normalizeRenderedControllerClassValue(\n\t\toptions.attributes?.class,\n\t\thost?.class,\n\t\thost?.classes,\n\t);\n\n\tif (mergedClassValue !== undefined) {\n\t\tnormalizedAttributes.class = mergedClassValue;\n\t}\n\n\tappendRenderedControllerStructuredAttributes(normalizedAttributes, 'data', host?.data);\n\tappendRenderedControllerStructuredAttributes(normalizedAttributes, 'aria', host?.aria);\n\tappendRenderedControllerFlatAttributes(normalizedAttributes, options.attributes);\n\n\tconst controllerIdentifier = getControllerIdentifier(Controller as unknown as CustomElementConstructor);\n\n\tif (controllerIdentifier && normalizedAttributes[CONTROLLER_ATTRIBUTE] == null) {\n\t\tnormalizedAttributes[CONTROLLER_ATTRIBUTE] = controllerIdentifier;\n\t}\n\n\treturn normalizedAttributes;\n}\n\nfunction appendRenderedControllerStructuredAttributes(\n\tattributes: RenderedControllerHostAttributes,\n\tprefix: 'aria' | 'data',\n\tvalue: Record<string, RenderedControllerHostAttributeValue> | undefined,\n): void {\n\tif (!isPlainRenderedControllerAttributeObject(value)) {\n\t\treturn;\n\t}\n\n\tfor (const [name, entryValue] of Object.entries(value)) {\n\t\tattributes[`${prefix}-${toKebabCaseRenderedControllerAttribute(name)}`] = entryValue;\n\t}\n}\n\nfunction appendRenderedControllerFlatAttributes(\n\tattributes: RenderedControllerHostAttributes,\n\tvalue: RenderedControllerHostAttributes | undefined,\n): void {\n\tif (!value) {\n\t\treturn;\n\t}\n\n\tfor (const [name, entryValue] of Object.entries(value)) {\n\t\tattributes[name] = entryValue;\n\t}\n}\n\nfunction normalizeRenderedControllerClassValue(...values: unknown[]): string | undefined {\n\tconst tokens: string[] = [];\n\n\tfor (const value of values) {\n\t\tappendRenderedControllerClassTokens(tokens, value);\n\t}\n\n\treturn tokens.length === 0 ? undefined : tokens.join(' ');\n}\n\nfunction appendRenderedControllerClassTokens(tokens: string[], value: unknown): void {\n\tif (value === undefined || value === null || value === false || value === true) {\n\t\treturn;\n\t}\n\n\tif (typeof value === 'string') {\n\t\tif (value !== '') {\n\t\t\ttokens.push(value);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (typeof value === 'number' || typeof value === 'bigint') {\n\t\ttokens.push(String(value));\n\t\treturn;\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tfor (const entry of value) {\n\t\t\tappendRenderedControllerClassTokens(tokens, entry);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (!isPlainRenderedControllerAttributeObject(value)) {\n\t\treturn;\n\t}\n\n\tfor (const [name, enabled] of Object.entries(value)) {\n\t\tif (enabled) {\n\t\t\ttokens.push(name);\n\t\t}\n\t}\n}\n\nfunction isPlainRenderedControllerAttributeObject(value: unknown): value is Record<string, unknown> {\n\treturn Object.prototype.toString.call(value) === '[object Object]';\n}\n\nfunction toKebabCaseRenderedControllerAttribute(value: string): string {\n\treturn value\n\t\t.replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n\t\t.replace(/[_\\s]+/g, '-')\n\t\t.toLowerCase();\n}\n\nfunction renderRenderedControllerHost(\n\tcontroller: RadiantController,\n\ttagName: string,\n\toptions: RenderToStringOptions,\n): string {\n\treturn `<${tagName}${serializeRenderedControllerHostAttributes(controller.host)}>${renderJsxToString(controller.render(), options)}</${tagName}>`;\n}\n\nfunction serializeRenderedControllerHostAttributes(host: Element): string {\n\treturn host\n\t\t.getAttributeNames()\n\t\t.map((attributeName) => serializeRenderedControllerAttribute(attributeName, host.getAttribute(attributeName)))\n\t\t.join('');\n}\n\nfunction serializeRenderedControllerAttribute(name: string, value: string | null): string {\n\tif (value === '') {\n\t\treturn ` ${name}`;\n\t}\n\n\treturn ` ${name}=\"${escapeRenderedControllerAttributeValue(value ?? '')}\"`;\n}\n\nfunction escapeRenderedControllerAttributeValue(value: string): string {\n\treturn value.replaceAll('&', '&').replaceAll('\"', '"').replaceAll('<', '<').replaceAll('>', '>');\n}\n"
|
|
19
|
-
],
|
|
20
|
-
"mappings": "4PA6CA,IAAM,EAAuC,OAAO,IAAI,yCAAyC,EAW1F,SAAS,CAA2B,EAAyC,CACnF,OAAQ,WAAqC,GASvC,SAAS,CAAgC,CAAC,EAAyC,CACxF,WAAqC,GAAwC,ECvDxE,SAAS,EAA0B,CAAC,EAAkC,CAC5E,OAAQ,QACF,MACJ,MAAO,aACH,QACJ,MAAO,eACH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y(i,{get:(s,f)=>(typeof require<"u"?require:s)[f]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});function P(i){return i.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var q="data-hydration",B="data-hydration-type",z="data-hydration-key";function r(i){let s=i.hydrationKey?` ${z}="${p(i.hydrationKey)}"`:"";return`<script type="application/json" ${q} ${B}="${i.type}"${s}>${i.serializedValue}</script>`}function l(i){return P(i)}function a(i,s){let f=i.textContent;if(!f)return s;try{return JSON.parse(f)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${q}>:`,f.slice(0,120));return s}}function e(i,s,f){let w=i.children;if(!w||w.length===0){let x=i.childNodes;if(!x||x.length===0)return null;for(let W=0;W<x.length;W+=1){let Q=x[W];if(Q.nodeType!==1)continue;let $=Q;if(H($,s,f))return $}return null}for(let x=0;x<w.length;x+=1)if(H(w[x],s,f))return w[x];return null}function H(i,s,f){if(i.tagName!=="SCRIPT"||!i.hasAttribute(q)||i.getAttribute(B)!==s)return!1;if(f!==void 0)return i.getAttribute(z)===f;return!i.hasAttribute(z)}function p(i){return i.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{createMarkupNodeLike as A,isKeyedJsxValue as O,isSlotJsxValue as E}from"@ecopages/jsx";var Z="",k="data-radiant-slot-projection";function wi(i){let s=new Map;for(let f of Array.from(i.childNodes)){if(R(f))continue;_(s,I(f),f)}return s}function xi(i){let s;try{s=JSON.parse(i)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",i.slice(0,120));return new Map}let f=new Map;for(let[w,x]of Object.entries(s)){if(!Array.isArray(x)||x.length===0)continue;f.set(g(w),x.map((W)=>A(W)))}return f}function Wi(i){let s=Array.from(i.childNodes).filter((f)=>U(f)).map((f)=>G(f)??"").filter((f)=>f!=="");return s.length>0?s.join(""):void 0}function Qi(i){let s={};for(let[f,w]of i.entries()){let x=w.map((W)=>G(W)).filter((W)=>W!==void 0&&W!=="");if(x.length>0)s[f]=x}return Object.keys(s).length>0?JSON.stringify(s):void 0}function $i(i,s){let f=!1,w=(W)=>{if(E(W))return f=!0,N(W,s,w);if(O(W))return C(W,w(W.value));if(j(W))return{_$rType$:1,rootLocalName:W.rootLocalName,strings:W.strings,values:W.values.map((Q)=>w(Q))};if(D(W))return Array.from(W,(Q)=>w(Q));return W},x=w(i);return{containsSlots:f,value:x}}function qi(i){for(let s of Array.from(i.childNodes)){if(!M(s))continue;let f=s.textContent??void 0;return s.parentNode?.removeChild(s),f}return}function _(i,s,f){let w=i.get(s);if(w){w.push(f);return}i.set(s,[f])}function C(i,s){return{...i,value:s}}function I(i){if(i instanceof Element)return g(i.getAttribute("slot"));return Z}function D(i){return typeof i!=="string"&&typeof i==="object"&&i!==null&&Symbol.iterator in i}function M(i){return i instanceof HTMLScriptElement&&i.hasAttribute(k)}function U(i){return i instanceof HTMLScriptElement&&i.hasAttribute(q)}function R(i){return M(i)||U(i)}function j(i){return typeof i==="object"&&i!==null&&i._$rType$===1&&Array.isArray(i.strings)&&Array.isArray(i.values)}function g(i){return i??Z}function G(i){if(i===void 0||i===null||i===!1||i===!0)return;if(typeof Node<"u"&&i instanceof Node){if(i.nodeType===Node.TEXT_NODE)return i.textContent??"";return i.outerHTML??i.textContent??void 0}if(O(i))return G(i.value);if(typeof i==="string"||typeof i==="number"||typeof i==="bigint")return String(i);if(typeof i==="object"&&i!==null&&"outerHTML"in i)return typeof i.outerHTML==="string"?i.outerHTML:i.textContent??void 0;if(D(i))return Array.from(i,(s)=>G(s)??"").join("");return}function N(i,s,f){let w=s.get(g(i.name));if(w&&w.length>0)return w.length===1?w[0]:w;if(i.fallback===void 0)return"";return f(i.fallback)}var X=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function J(i){let s=[],f=0;while(f<i.length){let w=f;if(i.startsWith("<!--",f)){let Q=i.indexOf("-->",f+4);f=Q===-1?i.length:Q+3,s.push(i.slice(w,f));continue}if(i[f]!=="<"){let Q=i.indexOf("<",f);f=Q===-1?i.length:Q,s.push(i.slice(w,f));continue}let x=L(i,f);if(!x){s.push(i.slice(w));break}if(x.type!=="open"||x.selfClosing||X.has(x.tagName)){f=x.end,s.push(i.slice(w,f));continue}f=x.end;let W=1;while(f<i.length&&W>0){let Q=i.indexOf("<",f);if(Q===-1){f=i.length;break}let $=L(i,Q);if(!$){f=i.length;break}if(f=$.end,$.type==="comment"||$.type==="declaration")continue;if($.type==="open"&&!$.selfClosing&&!X.has($.tagName)){W+=1;continue}if($.type==="close")W-=1}s.push(i.slice(w,f))}return s.filter((w)=>w!=="")}function y(i,s){let f;for(let w=s+1;w<i.length;w+=1){let x=i[w];if(f){if(x===f)f=void 0;continue}if(x==='"'||x==="'"){f=x;continue}if(x===">")return w+1}return i.length}function V(i){let s={},f=/([:^@A-Za-z0-9_.-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;for(let w of i.matchAll(f)){let[,x,W,Q,$]=w;if(!x)continue;s[x]=W??Q??$??""}return s}function L(i,s){if(i.startsWith("<!--",s)){let F=i.indexOf("-->",s+4);return{end:F===-1?i.length:F+3,type:"comment"}}let f=y(i,s),w=i.slice(s+1,f-1).trim();if(w==="")return;if(w.startsWith("!")||w.startsWith("?"))return{end:f,type:"declaration"};if(w.startsWith("/"))return{end:f,type:"close"};let x=/\/\s*$/.test(w),W=x?w.replace(/\/\s*$/,"").trim():w,Q=W.split(/[\s/>]/,1)[0]?.toLowerCase()??"",$=Q.length,c=W.slice($).trim(),S=x||X.has(Q)?"":u(i,s,f,Q);return{attributes:V(c),end:f,innerHtml:S,selfClosing:x,tagName:Q,type:"open"}}function u(i,s,f,w){let x=f,W=1;while(x<i.length&&W>0){let Q=i.indexOf("<",x);if(Q===-1)return i.slice(f);let $=L(i,Q);if(!$)return i.slice(f);if($.type==="open"&&$.tagName===w&&!$.selfClosing&&!X.has(w))W+=1;if($.type==="close"){if(i.slice(Q+2,$.end-1).trim().toLowerCase()===w){if(W-=1,W===0)return i.slice(f,Q)}}x=$.end}return i.slice(f)}import{createMarkupNodeLike as v}from"@ecopages/jsx";function Li(i){let s=new Map;for(let f of J(i)){if(b(f))continue;T(s,h(f),v(f))}return s}function Ji(i){let s=J(i).filter((f)=>Y(f));return s.length>0?s.join(""):void 0}function T(i,s,f){let w=i.get(s);if(w){w.push(f);return}i.set(s,[f])}function h(i){let s=/^<([A-Za-z][^\s/>]*)([^>]*)>/s.exec(i);if(!s)return Z;let f=s[2]??"",w=/\sslot\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(f);return w?.[1]??w?.[2]??w?.[3]??Z}function b(i){return m(i)||Y(i)}function m(i){let s=/^<script\b([^>]*)>/i.exec(i);if(!s)return!1;return K(s[1]??"",k)}function Y(i){let s=/^<script\b([^>]*)>/i.exec(i);if(!s)return!1;return K(s[1]??"",q)}function K(i,s){return new RegExp(`(?:^|\\s)${s}(?:\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]+))?`,"i").test(i)}export{Li as parseProjectedSlotRenderablesFromHtml,Ji as collectAuthoredHydrationScriptMarkupFromHtml};
|
|
2
|
-
|
|
3
|
-
//# debugId=611384E09FC6415064756E2164756E21
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var G=((m)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(m,{get:(j,q)=>(typeof require<"u"?require:j)[q]}):m)(function(m){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+m+'" is not supported')});import{asyncState as E,state as F}from"@ecopages/signals";class B{data;status;error;connected=F(!1);resource;disposed=!1;constructor(m,j){let q={host:m},D={initialValue:j.initialValue,pendingDelay:j.pendingDelay,staleTime:j.staleTime,onError:(z)=>{j.onError?.(z,q)},onSettled:(z,A)=>{j.onSettled?.(z,A,q)},onSuccess:(z)=>{j.onSuccess?.(z,q)}};if(j.source)this.resource=E({...D,source:()=>{if(this.disposed||!this.connected.get())return!1;return j.source(q)},fetcher:(z,A)=>j.fetcher(z,{...q,...A})});else this.resource=E({...D,source:()=>{if(this.disposed||!this.connected.get())return!1;return!0},fetcher:(z,A)=>j.fetcher({...q,...A})});this.data=this.resource.data,this.status=this.resource.status,this.error=this.resource.error}connect(){if(this.disposed||this.connected.get())return;this.connected.set(!0)}disconnect(){if(this.disposed||!this.connected.get())return;this.connected.set(!1),this.resource.abort()}refetch(){if(this.disposed||!this.connected.get())return;this.resource.refetch()}abort(){if(this.disposed)return;this.resource.abort()}dispose(){if(this.disposed)return;this.disposed=!0,this.connected.set(!1),this.resource.dispose()}}function K(m,j){return new B(m,j)}function L(m,j){let q=new B(m,j);return m.registerConnectedCallback(()=>{q.connect()}),m.registerCleanupCallback(()=>{q.disconnect()}),q}export{L as createResource,K as createHostResource,B as HostResource};
|
|
2
|
-
|
|
3
|
-
//# debugId=B20E9C4650796DAC64756E2164756E21
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var K=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(G,Q)=>(typeof require<"u"?require:G)[Q]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});function J(q){return q.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var W="data-hydration",L="data-hydration-type",F="data-hydration-key";function M(q){let G=q.hydrationKey?` ${F}="${U(q.hydrationKey)}"`:"";return`<script type="application/json" ${W} ${L}="${q.type}"${G}>${q.serializedValue}</script>`}function P(q){return J(q)}function z(q,G){let Q=q.textContent;if(!Q)return G;try{return JSON.parse(Q)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${W}>:`,Q.slice(0,120));return G}}function g(q,G,Q){let Z=q.children;if(!Z||Z.length===0){let X=q.childNodes;if(!X||X.length===0)return null;for(let $=0;$<X.length;$+=1){let j=X[$];if(j.nodeType!==1)continue;let w=j;if(C(w,G,Q))return w}return null}for(let X=0;X<Z.length;X+=1)if(C(Z[X],G,Q))return Z[X];return null}function C(q,G,Q){if(q.tagName!=="SCRIPT"||!q.hasAttribute(W)||q.getAttribute(L)!==G)return!1;if(Q!==void 0)return q.getAttribute(F)===Q;return!q.hasAttribute(F)}function U(q){return q.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function f(q){return M({type:"signal",...q})}function B(q){return P(q)}import{createMarkupNodeLike as O}from"@ecopages/jsx";import{state as b}from"@ecopages/signals";function m(q){return typeof q==="object"&&q!==null&&typeof q.get==="function"&&typeof q.set==="function"&&typeof q.subscribe==="function"&&typeof q.update==="function"}class D{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(q){this.host=q.host,this.hydrate=q.hydrate,this.hydrationKey=q.hydrationKey,this.property=q.property,this.source=q.source??b(this.resolveInitialValue(q.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(q){this.source.set(q)}subscribe(q){return this.source.subscribe(q)}update(q){this.set(q(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let q=this.source.get();if(!Object.is(this.currentValue,q)){let G=this.currentValue;this.currentValue=q,this.host.notifyUpdate(this.property,G,q)}this.sourceUnsubscribe=this.source.subscribe((G)=>{this.handleSourceChange(G)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let q=this.source.get(),G=this.resolveInitialValue(q);if(!Object.is(q,G))this.source.set(G),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,q,this.currentValue)}renderHydrationScript(){let q=this.renderHydrationScriptTag();if(!q)return;return O(q)}renderHydrationScriptTag(){let q=this.serializeHydrationValue();if(!q)return;return f({hydrationKey:this.hydrationKey,serializedValue:q})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return g(this.host,"signal",this.hydrationKey)}isObject(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}resolveInitialValue(q){if(!this.hydrate)return q;let G=this.findHydrationScriptElement();if(!G)return q;let Q=z(G,q);if(this.hydrate===Object&&this.isObject(Q)&&this.isObject(q))return{...q,...Q};return Q}serializeHydrationValue(){if(!this.hydrate)return;let q=JSON.stringify(this.get());if(typeof q!=="string")return;return B(q)}handleSourceChange(q){let G=this.currentValue;if(this.currentValue=q,!Object.is(G,q))this.host.notifyUpdate(this.property,G,q)}}function H(q){return new D(q)}export{m as isWritableSignalLike,H as createHostSignal,D as HostSignal};
|
|
2
|
-
|
|
3
|
-
//# debugId=D824BBB0A9C2DA3964756E2164756E21
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/tools/escape-script-json.ts", "../src/core/hydration-codec.ts", "../src/signals/hydration-script.ts", "../src/signals/host-signal.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
|
|
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
|
-
"import { createHydrationScriptTag, escapeHydrationJson } from '../core/hydration-codec';\n\n/** Creates the raw `<script type=\"application/json\">` tag used to hydrate a signal field. */\nexport function createSignalHydrationScriptTag(options: { hydrationKey?: string; serializedValue: string }): string {\n\treturn createHydrationScriptTag({ type: 'signal', ...options });\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeSignalHydrationJson(value: string): string {\n\treturn escapeHydrationJson(value);\n}\n",
|
|
8
|
-
"import { createMarkupNodeLike, type JsxRenderable } from '@ecopages/jsx';\nimport { state, type WritableSignal } from '@ecopages/signals';\nimport type { SsrSerializableHydrationBinding } from '../core/ssr-hydration-binding';\nimport type { AttributeTypeConstant } from '../utils/attribute-utils';\nimport { findHydrationScript, parseHydrationPayload } from '../core/hydration-codec';\nimport { createSignalHydrationScriptTag, escapeSignalHydrationJson } from './hydration-script';\n\ntype HostSignalOwner = {\n\tnotifyUpdate(property: string, oldValue: unknown, value: unknown): void;\n};\n\ntype HostSignalOptions<Value> = {\n\thost: HostSignalOwner;\n\thydrate?: AttributeTypeConstant;\n\thydrationKey?: string;\n\tinitialValue?: Value;\n\tproperty: string;\n\tsource?: WritableSignal<Value>;\n};\n\nexport function isWritableSignalLike<Value>(value: unknown): value is WritableSignal<Value> {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof (value as WritableSignal<Value>).get === 'function' &&\n\t\ttypeof (value as WritableSignal<Value>).set === 'function' &&\n\t\ttypeof (value as WritableSignal<Value>).subscribe === 'function' &&\n\t\ttypeof (value as WritableSignal<Value>).update === 'function'\n\t);\n}\n\n/**\n * Host-owned writable signal that bridges signal updates back into Radiant's\n * update callback channel and optional SSR hydration pipeline.\n */\nexport class HostSignal<Value> implements WritableSignal<Value>, SsrSerializableHydrationBinding {\n\tprivate readonly host: HostSignalOwner;\n\tprivate readonly hydrate?: AttributeTypeConstant;\n\tprivate readonly hydrationKey?: string;\n\tprivate readonly property: string;\n\tprivate readonly source: WritableSignal<Value>;\n\tprivate currentValue: Value;\n\tprivate hasAppliedHostHydration = false;\n\tprivate sourceUnsubscribe?: () => void;\n\n\tconstructor(options: HostSignalOptions<Value>) {\n\t\tthis.host = options.host;\n\t\tthis.hydrate = options.hydrate;\n\t\tthis.hydrationKey = options.hydrationKey;\n\t\tthis.property = options.property;\n\t\tthis.source = options.source ?? state(this.resolveInitialValue(options.initialValue as Value));\n\t\tthis.currentValue = this.source.get();\n\t}\n\n\tpublic get(): Value {\n\t\treturn this.source.get();\n\t}\n\n\tpublic set(nextValue: Value): void {\n\t\tthis.source.set(nextValue);\n\t}\n\n\tpublic subscribe(notify: (value: Value) => void): () => void {\n\t\treturn this.source.subscribe(notify);\n\t}\n\n\tpublic update(updater: (value: Value) => Value): void {\n\t\tthis.set(updater(this.get()));\n\t}\n\n\tpublic connectToSource(): void {\n\t\tif (this.sourceUnsubscribe) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextValue = this.source.get();\n\n\t\tif (!Object.is(this.currentValue, nextValue)) {\n\t\t\tconst previousValue = this.currentValue;\n\t\t\tthis.currentValue = nextValue;\n\t\t\tthis.host.notifyUpdate(this.property, previousValue, nextValue);\n\t\t}\n\n\t\tthis.sourceUnsubscribe = this.source.subscribe((value) => {\n\t\t\tthis.handleSourceChange(value);\n\t\t});\n\t}\n\n\tpublic disconnectFromSource(): void {\n\t\tthis.sourceUnsubscribe?.();\n\t\tthis.sourceUnsubscribe = undefined;\n\t}\n\n\tpublic hydrateFromHost(): void {\n\t\tif (!this.hydrate || this.hasAppliedHostHydration) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hasAppliedHostHydration = true;\n\n\t\tconst previousValue = this.source.get();\n\t\tconst hydratedValue = this.resolveInitialValue(previousValue);\n\n\t\tif (!Object.is(previousValue, hydratedValue)) {\n\t\t\tthis.source.set(hydratedValue);\n\t\t\tthis.currentValue = this.source.get();\n\t\t\tthis.host.notifyUpdate(this.property, previousValue, this.currentValue);\n\t\t}\n\t}\n\n\tpublic renderHydrationScript(): 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\tpublic renderHydrationScriptTag(): 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 createSignalHydrationScriptTag({\n\t\t\thydrationKey: this.hydrationKey,\n\t\t\tserializedValue,\n\t\t});\n\t}\n\n\tprivate findHydrationScriptElement(): Element | null {\n\t\tif (!(this.host instanceof Element)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn findHydrationScript(this.host, 'signal', this.hydrationKey);\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 resolveInitialValue(initialValue: Value): Value {\n\t\tif (!this.hydrate) {\n\t\t\treturn initialValue;\n\t\t}\n\n\t\tconst hydrationScriptElement = this.findHydrationScriptElement();\n\n\t\tif (!hydrationScriptElement) {\n\t\t\treturn initialValue;\n\t\t}\n\n\t\tconst parsedHydrationValue = parseHydrationPayload(hydrationScriptElement, initialValue);\n\n\t\tif (this.hydrate === Object && this.isObject(parsedHydrationValue) && this.isObject(initialValue)) {\n\t\t\treturn {\n\t\t\t\t...initialValue,\n\t\t\t\t...parsedHydrationValue,\n\t\t\t} as Value;\n\t\t}\n\n\t\treturn parsedHydrationValue;\n\t}\n\n\tprivate serializeHydrationValue(): string | undefined {\n\t\tif (!this.hydrate) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst serializedValue = JSON.stringify(this.get());\n\n\t\tif (typeof serializedValue !== 'string') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn escapeSignalHydrationJson(serializedValue);\n\t}\n\n\tprivate handleSourceChange(nextValue: Value): void {\n\t\tconst previousValue = this.currentValue;\n\t\tthis.currentValue = nextValue;\n\n\t\tif (!Object.is(previousValue, nextValue)) {\n\t\t\tthis.host.notifyUpdate(this.property, previousValue, nextValue);\n\t\t}\n\t}\n}\n\nexport function createHostSignal<Value>(options: HostSignalOptions<Value>): HostSignal<Value> {\n\treturn new HostSignal(options);\n}\n"
|
|
9
|
-
],
|
|
10
|
-
"mappings": "2PAIO,SAAS,CAAgB,CAAC,EAAuB,CACvD,OAAO,EACL,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAA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AAwB,CAAY,EAEvF,GAAI,KAAK,UAAY,QAAU,KAAK,SAAS,CAAoB,GAAK,KAAK,SAAS,CAAY,EAC/F,MAAO,IACH,KACA,CACJ,EAGD,OAAO,EAGA,uBAAuB,EAAuB,CACrD,GAAI,CAAC,KAAK,QACT,OAGD,IAAM,EAAkB,KAAK,UAAU,KAAK,IAAI,CAAC,EAEjD,GAAI,OAAO,IAAoB,SAC9B,OAGD,OAAO,EAA0B,CAAe,EAGzC,kBAAkB,CAAC,EAAwB,CAClD,IAAM,EAAgB,KAAK,aAG3B,GAFA,KAAK,aAAe,EAEhB,CAAC,OAAO,GAAG,EAAe,CAAS,EACtC,KAAK,KAAK,aAAa,KAAK,SAAU,EAAe,CAAS,EAGjE,CAEO,SAAS,CAAuB,CAAC,EAAsD,CAC7F,OAAO,IAAI,EAAW,CAAO",
|
|
11
|
-
"debugId": "D824BBB0A9C2DA3964756E2164756E21",
|
|
12
|
-
"names": []
|
|
13
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var W=((g)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(g,{get:(q,w)=>(typeof require<"u"?require:q)[w]}):g)(function(g){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+g+'" is not supported')});function Z(g){return g.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var Q="data-hydration",j="data-hydration-type",M="data-hydration-key";function u(g){let q=g.hydrationKey?` ${M}="${J(g.hydrationKey)}"`:"";return`<script type="application/json" ${Q} ${j}="${g.type}"${q}>${g.serializedValue}</script>`}function F(g){return Z(g)}function S(g,q){let w=g.textContent;if(!w)return q;try{return JSON.parse(w)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${Q}>:`,w.slice(0,120));return q}}function f(g,q,w){let G=g.children;if(!G||G.length===0){let z=g.childNodes;if(!z||z.length===0)return null;for(let L=0;L<z.length;L+=1){let V=z[L];if(V.nodeType!==1)continue;let X=V;if($(X,q,w))return X}return null}for(let z=0;z<G.length;z+=1)if($(G[z],q,w))return G[z];return null}function $(g,q,w){if(g.tagName!=="SCRIPT"||!g.hasAttribute(Q)||g.getAttribute(j)!==q)return!1;if(w!==void 0)return g.getAttribute(M)===w;return!g.hasAttribute(M)}function J(g){return g.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function B(g){return u({type:"signal",...g})}function D(g){return F(g)}export{D as escapeSignalHydrationJson,B as createSignalHydrationScriptTag};
|
|
2
|
-
|
|
3
|
-
//# debugId=2E79D54D041C6E9564756E2164756E21
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var f=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(c,e)=>(typeof require<"u"?require:c)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});function p(n){let c=globalThis.CSS;if(typeof c?.escape==="function")return c.escape(n);let e="";for(let s=0;s<n.length;s+=1){let i=n[s]??"",t=i.codePointAt(0)??0;if(t===0){e+="�";continue}let o=t>=1&&t<=31||t===127,r=s===0&&t>=48&&t<=57,x=s===1&&t>=48&&t<=57&&(n[0]??"")==="-",a=s===0&&i==="-"&&n.length===1;if(o||r||x){e+=`\\${t.toString(16)} `;continue}if(t>=128||i==="-"||i==="_"||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){e+=a?`\\${i}`:i;continue}e+=`\\${i}`}return e}export{p as escapeCssIdentifier};
|
|
2
|
-
|
|
3
|
-
//# debugId=BF095F02FC2877E864756E2164756E21
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/tools/escape-css-identifier.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"export function escapeCssIdentifier(value: string): string {\n\tconst cssNamespace = globalThis.CSS as { escape?: (value: string) => string } | undefined;\n\n\tif (typeof cssNamespace?.escape === 'function') {\n\t\treturn cssNamespace.escape(value);\n\t}\n\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 &&\n\t\t\tcodePoint >= 0x0030 &&\n\t\t\tcodePoint <= 0x0039 &&\n\t\t\t(value[0] ?? '') === '-';\n\t\tconst isSingleHyphen = index === 0 && character === '-' && value.length === 1;\n\n\t\tif (isControlCharacter || startsWithDigit || startsWithHyphenDigit) {\n\t\t\tescaped += `\\\\${codePoint.toString(16)} `;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\tcodePoint >= 0x0080 ||\n\t\t\tcharacter === '-' ||\n\t\t\tcharacter === '_' ||\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) ||\n\t\t\t(codePoint >= 0x0041 && codePoint <= 0x005a) ||\n\t\t\t(codePoint >= 0x0061 && codePoint <= 0x007a)\n\t\t) {\n\t\t\tescaped += isSingleHyphen ? `\\\\${character}` : character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tescaped += `\\\\${character}`;\n\t}\n\n\treturn escaped;\n}"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "2PAAO,SAAS,CAAmB,CAAC,EAAuB,CAC1D,IAAM,EAAe,WAAW,IAEhC,GAAI,OAAO,GAAc,SAAW,WACnC,OAAO,EAAa,OAAO,CAAK,EAGjC,IAAI,EAAU,GAEd,QAAS,EAAQ,EAAG,EAAQ,EAAM,OAAQ,GAAS,EAAG,CACrD,IAAM,EAAY,EAAM,IAAU,GAC5B,EAAY,EAAU,YAAY,CAAC,GAAK,EAE9C,GAAI,IAAc,EAAG,CACpB,GAAW,IACX,SAGD,IAAM,EAAsB,GAAa,GAAU,GAAa,IAAW,IAAc,IACnF,EAAkB,IAAU,GAAK,GAAa,IAAU,GAAa,GACrE,EACL,IAAU,GACV,GAAa,IACb,GAAa,KACZ,EAAM,IAAM,MAAQ,IAChB,EAAiB,IAAU,GAAK,IAAc,KAAO,EAAM,SAAW,EAE5E,GAAI,GAAsB,GAAmB,EAAuB,CACnE,GAAW,KAAK,EAAU,SAAS,EAAE,KACrC,SAGD,GACC,GAAa,KACb,IAAc,KACd,IAAc,KACb,GAAa,IAAU,GAAa,IACpC,GAAa,IAAU,GAAa,IACpC,GAAa,IAAU,GAAa,IACpC,CACD,GAAW,EAAiB,KAAK,IAAc,EAC/C,SAGD,GAAW,KAAK,IAGjB,OAAO",
|
|
8
|
-
"debugId": "BF095F02FC2877E864756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var s=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,a)=>(typeof require<"u"?require:r)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});function i(e){return e.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}export{i as escapeScriptJson};
|
|
2
|
-
|
|
3
|
-
//# debugId=91D7070AAF1AF86764756E2164756E21
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var z=((k)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(k,{get:(q,x)=>(typeof require<"u"?require:q)[x]}):k)(function(k){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+k+'" is not supported')});class y{host;eventConfig;constructor(k,q){this.host=k,this.eventConfig=q}emit(k){let q=new CustomEvent(this.eventConfig.name,{detail:k,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(q)}}export{y as EventEmitter};
|
|
2
|
-
|
|
3
|
-
//# debugId=1E4E1D10DCC1E44064756E2164756E21
|
package/dist/tools/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var g=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(c,s)=>(typeof require<"u"?require:c)[s]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});function S(n){return n.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}class f{host;eventConfig;constructor(n,c){this.host=n,this.eventConfig=c}emit(n){let c=new CustomEvent(this.eventConfig.name,{detail:n,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(c)}}function H(n){let c=globalThis.CSS;if(typeof c?.escape==="function")return c.escape(n);let s="";for(let o=0;o<n.length;o+=1){let i=n[o]??"",r=i.codePointAt(0)??0;if(r===0){s+="�";continue}let x=r>=1&&r<=31||r===127,t=o===0&&r>=48&&r<=57,e=o===1&&r>=48&&r<=57&&(n[0]??"")==="-",p=o===0&&i==="-"&&n.length===1;if(x||t||e){s+=`\\${r.toString(16)} `;continue}if(r>=128||i==="-"||i==="_"||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){s+=p?`\\${i}`:i;continue}s+=`\\${i}`}return s}import{render as u}from"@ecopages/jsx";function h(n,c){u(n,c)}export{h as renderJsxTemplate,S as escapeScriptJson,H as escapeCssIdentifier,f as EventEmitter};
|
|
2
|
-
|
|
3
|
-
//# debugId=19BB6D9EC62E3A1564756E2164756E21
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var w=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(k,q)=>(typeof require<"u"?require:k)[q]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});import{render as v}from"@ecopages/jsx";function B(f,k){v(f,k)}export{B as renderJsxTemplate};
|
|
2
|
-
|
|
3
|
-
//# debugId=6730AC26B382885064756E2164756E21
|
package/dist/types.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var o=((t)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,e)=>(typeof require<"u"?require:r)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var n={isStandard:{ClassDecorator:function(t){return typeof t[1]<"u"},MethodDecorator:function(t){return typeof t[1]==="object"},FieldDecorator:function(t){return typeof t[1]==="object"}}};export{n as guards};
|
|
2
|
-
|
|
3
|
-
//# debugId=13A0204E2BB78E6764756E2164756E21
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var B=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(x,z)=>(typeof require<"u"?require:x)[z]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});function P(q){switch(q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function R(q){switch(typeof q){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(q))return"array";if(Object.prototype.toString.call(q)==="[object Object]")return"object"}function U(q){switch(q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function W(q){try{return JSON.parse(q)}catch{throw TypeError("Invalid JSON string")}}var X={array(q){let x=W(q);if(!Array.isArray(x))throw TypeError(`Expected an array but got a value of type "${typeof x}"`);return x},boolean(q){return!(q==="0"||String(q).toLowerCase()==="false")},number(q){return Number(q.replace(/_/g,""))},object(q){let x=JSON.parse(q);if(x===null||typeof x!=="object"||Array.isArray(x))throw TypeError(`expected value of type "object" but instead got value "${q}" of type "${R(x)}"`);return x},string(q){return q}},I={default:Q,array:L,object:L};function L(q){return JSON.stringify(q)}function Q(q){return`${q}`}function M(q,x){let z=P(x);if(!z)throw TypeError(`[radiant-element] Unknown type "${x}"`);return X[z](q)}function F(q,x){let z=P(x);if(!z)throw TypeError(`[radiant-element] Unknown type "${x}"`);return(I[z]??I.default??Q)(q)}function Y(q){return typeof q==="boolean"}function Z(q){return typeof q==="number"}function _(q){return typeof q==="string"}function $(q){return Array.isArray(q)}function k(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}function m(q,x){switch(q){case Boolean:return Y(x);case Number:return Z(x);case String:return _(x);case Array:return $(x);case Object:return k(x);default:return!1}}var h=(q,x,z,E)=>{if(x===Boolean){let G=q.getAttribute(z);if(G===null)return E;return G===""?!0:M(G,x)}let H=q.getAttribute(z);return H!==null?M(H,x):E??U(x)};export{F as writeAttributeValue,M as readAttributeValue,R as parseAttributeTypeDefault,P as parseAttributeTypeConstant,m as isValueOfType,h as getInitialValue,U as defaultValueForType};
|
|
2
|
-
|
|
3
|
-
//# debugId=A6359EE45E00B20A64756E2164756E21
|
package/dist/utils/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var m=((x)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(q,z)=>(typeof require<"u"?require:q)[z]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});function P(x){switch(x){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function R(x){switch(typeof x){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(x))return"array";if(Object.prototype.toString.call(x)==="[object Object]")return"object"}function U(x){switch(x){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function W(x){try{return JSON.parse(x)}catch{throw TypeError("Invalid JSON string")}}var X={array(x){let q=W(x);if(!Array.isArray(q))throw TypeError(`Expected an array but got a value of type "${typeof q}"`);return q},boolean(x){return!(x==="0"||String(x).toLowerCase()==="false")},number(x){return Number(x.replace(/_/g,""))},object(x){let q=JSON.parse(x);if(q===null||typeof q!=="object"||Array.isArray(q))throw TypeError(`expected value of type "object" but instead got value "${x}" of type "${R(q)}"`);return q},string(x){return x}},I={default:Q,array:L,object:L};function L(x){return JSON.stringify(x)}function Q(x){return`${x}`}function M(x,q){let z=P(q);if(!z)throw TypeError(`[radiant-element] Unknown type "${q}"`);return X[z](x)}function D(x,q){let z=P(q);if(!z)throw TypeError(`[radiant-element] Unknown type "${q}"`);return(I[z]??I.default??Q)(x)}function Y(x){return typeof x==="boolean"}function Z(x){return typeof x==="number"}function _(x){return typeof x==="string"}function $(x){return Array.isArray(x)}function k(x){return typeof x==="object"&&!Array.isArray(x)&&x!==null}function F(x,q){switch(x){case Boolean:return Y(q);case Number:return Z(q);case String:return _(q);case Array:return $(q);case Object:return k(q);default:return!1}}var h=(x,q,z,E)=>{if(q===Boolean){let G=x.getAttribute(z);if(G===null)return E;return G===""?!0:M(G,q)}let H=x.getAttribute(z);return H!==null?M(H,q):E??U(q)};export{D as writeAttributeValue,M as readAttributeValue,R as parseAttributeTypeDefault,P as parseAttributeTypeConstant,F as isValueOfType,h as getInitialValue,U as defaultValueForType};
|
|
2
|
-
|
|
3
|
-
//# debugId=4AD7E8FD49F8E7F964756E2164756E21
|
package/size-budget.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bundles": [
|
|
3
|
-
{
|
|
4
|
-
"control": "strict",
|
|
5
|
-
"label": "root-client-surface",
|
|
6
|
-
"entrypoint": "./src/index.ts",
|
|
7
|
-
"maxBytes": 44288,
|
|
8
|
-
"maxGzipBytes": 12032
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"control": "advisory",
|
|
12
|
-
"label": "server-render",
|
|
13
|
-
"entrypoint": "./src/server/render-component.ts",
|
|
14
|
-
"maxBytes": 15360,
|
|
15
|
-
"maxGzipBytes": 5184
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"control": "advisory",
|
|
19
|
-
"label": "server-render-controller",
|
|
20
|
-
"entrypoint": "./src/server/render-controller.ts",
|
|
21
|
-
"maxBytes": 15360,
|
|
22
|
-
"maxGzipBytes": 5376
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|