@ecopages/radiant 0.3.0-alpha.2 → 0.3.0-alpha.20
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 +71 -60
- package/client/app-bootstrap.d.ts +19 -0
- package/client/app-bootstrap.js +3 -0
- package/client/app-bootstrap.js.map +10 -0
- package/{dist/client → client}/hydrator.d.ts +1 -1
- package/client/hydrator.js +3 -0
- package/client/hydrator.js.map +11 -0
- package/client/install-hydrator.js +3 -0
- package/client/install-hydrator.js.map +12 -0
- package/{dist/context → context}/context-consumer-bootstrap.d.ts +7 -6
- package/context/context-consumer-bootstrap.js +3 -0
- package/context/context-consumer-bootstrap.js.map +14 -0
- package/context/context-consumer-runtime.d.ts +47 -0
- package/context/context-consumer-runtime.js +3 -0
- package/context/context-consumer-runtime.js.map +12 -0
- package/context/context-host.d.ts +25 -0
- package/context/context-host.js +3 -0
- package/context/context-host.js.map +10 -0
- package/{dist/context → context}/context-provider.d.ts +10 -6
- package/context/context-provider.js +3 -0
- package/context/context-provider.js.map +15 -0
- package/context/context-ssr-bridge.js +3 -0
- package/{dist/chunk-t8xtvgyg.js.map → context/context-ssr-bridge.js.map} +2 -2
- package/context/create-context.js +3 -0
- package/{dist/chunk-30x4hggg.js.map → context/create-context.js.map} +2 -2
- package/{dist/context → context}/decorators/consume-context.d.ts +5 -2
- package/context/decorators/consume-context.js +3 -0
- package/context/decorators/consume-context.js.map +19 -0
- package/context/decorators/context-selection-delivery.d.ts +1 -0
- package/context/decorators/context-selection-delivery.js +3 -0
- package/context/decorators/context-selection-delivery.js.map +11 -0
- package/{dist/context → context}/decorators/context-selector.d.ts +6 -6
- package/context/decorators/context-selector.js +3 -0
- package/context/decorators/context-selector.js.map +21 -0
- package/context/decorators/legacy/consume-context.d.ts +3 -0
- package/context/decorators/legacy/consume-context.js +3 -0
- package/context/decorators/legacy/consume-context.js.map +16 -0
- package/{dist/context → context}/decorators/legacy/context-selector-field.d.ts +2 -2
- package/context/decorators/legacy/context-selector-field.js +3 -0
- package/context/decorators/legacy/context-selector-field.js.map +17 -0
- package/{dist/context → context}/decorators/legacy/context-selector.d.ts +2 -2
- package/context/decorators/legacy/context-selector.js +3 -0
- package/context/decorators/legacy/context-selector.js.map +17 -0
- package/{dist/context → context}/decorators/legacy/provide-context.d.ts +2 -2
- package/context/decorators/legacy/provide-context.js +3 -0
- package/context/decorators/legacy/provide-context.js.map +17 -0
- package/{dist/context → context}/decorators/on-context-update.d.ts +5 -5
- package/context/decorators/on-context-update.js +3 -0
- package/context/decorators/on-context-update.js.map +20 -0
- package/{dist/context → context}/decorators/provide-context.d.ts +5 -2
- package/context/decorators/provide-context.js +3 -0
- package/context/decorators/provide-context.js.map +20 -0
- package/context/decorators/standard/consume-context.d.ts +3 -0
- package/context/decorators/standard/consume-context.js +3 -0
- package/context/decorators/standard/consume-context.js.map +15 -0
- package/{dist/context → context}/decorators/standard/context-selector-field.d.ts +2 -2
- package/context/decorators/standard/context-selector-field.js +3 -0
- package/context/decorators/standard/context-selector-field.js.map +16 -0
- package/{dist/context → context}/decorators/standard/context-selector.d.ts +2 -3
- package/context/decorators/standard/context-selector.js +3 -0
- package/context/decorators/standard/context-selector.js.map +16 -0
- package/{dist/context → context}/decorators/standard/provide-context.d.ts +2 -2
- package/context/decorators/standard/provide-context.js +3 -0
- package/context/decorators/standard/provide-context.js.map +16 -0
- package/{dist/context → context}/events.d.ts +18 -11
- package/context/events.js +3 -0
- package/context/events.js.map +10 -0
- package/context/hydration-script.js +3 -0
- package/context/hydration-script.js.map +12 -0
- package/context/index.d.ts +8 -0
- package/context/index.js +3 -0
- package/context/index.js.map +35 -0
- package/controller-registry.d.ts +38 -0
- package/controller-registry.js +3 -0
- package/controller-registry.js.map +11 -0
- package/core/controller-metadata.d.ts +3 -0
- package/core/controller-metadata.js +3 -0
- package/core/controller-metadata.js.map +10 -0
- package/core/custom-element-metadata.d.ts +14 -0
- package/core/custom-element-metadata.js +3 -0
- package/core/custom-element-metadata.js.map +10 -0
- package/{dist/core → core}/hydration-codec.d.ts +8 -1
- package/core/hydration-codec.js +3 -0
- package/core/hydration-codec.js.map +11 -0
- package/core/radiant-controller.d.ts +151 -0
- package/core/radiant-controller.js +3 -0
- package/core/radiant-controller.js.map +17 -0
- package/core/radiant-element-ssr-host.d.ts +23 -0
- 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 +45 -0
- package/core/radiant-element-ssr-registry.js +3 -0
- package/core/radiant-element-ssr-registry.js.map +10 -0
- package/{dist/core/radiant-component-ssr.d.ts → core/radiant-element-ssr-service.d.ts} +5 -6
- package/core/radiant-element-ssr-service.js +3 -0
- package/core/radiant-element-ssr-service.js.map +14 -0
- package/{dist/core → core}/radiant-element.d.ts +55 -123
- package/core/radiant-element.js +3 -0
- package/core/radiant-element.js.map +24 -0
- package/{dist/core → core}/radiant-hydrator-state.d.ts +1 -1
- package/core/radiant-hydrator-state.js +3 -0
- package/core/radiant-hydrator-state.js.map +10 -0
- package/core/reactive-host.d.ts +133 -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 +2 -1
- package/core/reactive-jsx-value.js +3 -0
- package/core/reactive-jsx-value.js.map +10 -0
- package/core/reactive-prop-core.d.ts +42 -0
- package/core/reactive-prop-core.js +3 -0
- package/core/reactive-prop-core.js.map +11 -0
- 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/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 +39 -0
- package/core/reactivity-contract.js +2 -0
- package/{dist/chunk-vgtggzb6.js.map → core/reactivity-contract.js.map} +1 -1
- 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/slot-projection-runtime.js +3 -0
- package/core/slot-projection-runtime.js.map +12 -0
- package/core/ssr-preparation.js +3 -0
- package/core/ssr-preparation.js.map +10 -0
- package/decorators/attr.d.ts +6 -0
- package/decorators/attr.js +3 -0
- package/decorators/attr.js.map +17 -0
- package/decorators/bound.d.ts +7 -0
- package/decorators/bound.js +3 -0
- package/decorators/bound.js.map +13 -0
- package/decorators/bridge.d.ts +12 -0
- package/decorators/bridge.js +3 -0
- package/decorators/bridge.js.map +10 -0
- package/decorators/controller.d.ts +2 -0
- package/decorators/controller.js +3 -0
- package/decorators/controller.js.map +12 -0
- package/{dist/decorators → decorators}/custom-element.d.ts +4 -2
- package/decorators/custom-element.js +3 -0
- package/decorators/custom-element.js.map +13 -0
- package/decorators/debounce.d.ts +9 -0
- package/decorators/debounce.js +3 -0
- package/decorators/debounce.js.map +14 -0
- package/{dist/decorators → decorators}/event.d.ts +5 -2
- package/decorators/event.js +3 -0
- package/decorators/event.js.map +16 -0
- package/decorators/legacy/attr.d.ts +2 -0
- package/decorators/legacy/attr.js +3 -0
- package/decorators/legacy/attr.js.map +14 -0
- package/decorators/legacy/bound.js +3 -0
- package/decorators/legacy/bound.js.map +10 -0
- package/decorators/legacy/custom-element.js +3 -0
- package/decorators/legacy/custom-element.js.map +11 -0
- package/decorators/legacy/debounce.js +3 -0
- package/decorators/legacy/debounce.js.map +11 -0
- package/decorators/legacy/event.js +3 -0
- package/decorators/legacy/event.js.map +13 -0
- package/decorators/legacy/instance-initializers.d.ts +32 -0
- package/decorators/legacy/instance-initializers.js +3 -0
- package/decorators/legacy/instance-initializers.js.map +10 -0
- package/{dist/decorators → decorators}/legacy/on-event.d.ts +2 -2
- package/decorators/legacy/on-event.js +3 -0
- package/decorators/legacy/on-event.js.map +13 -0
- package/decorators/legacy/on-updated.d.ts +11 -0
- package/decorators/legacy/on-updated.js +3 -0
- package/decorators/legacy/on-updated.js.map +11 -0
- package/decorators/legacy/query-slot.d.ts +3 -0
- package/decorators/legacy/query-slot.js +3 -0
- package/decorators/legacy/query-slot.js.map +13 -0
- package/{dist/decorators → decorators}/legacy/query.d.ts +7 -2
- package/decorators/legacy/query.js +3 -0
- package/decorators/legacy/query.js.map +12 -0
- package/{dist/decorators → decorators}/legacy/reactive-field.d.ts +2 -2
- package/decorators/legacy/reactive-field.js +3 -0
- package/decorators/legacy/reactive-field.js.map +11 -0
- package/decorators/legacy/reactive-prop.d.ts +14 -0
- package/decorators/legacy/reactive-prop.js +3 -0
- package/decorators/legacy/reactive-prop.js.map +14 -0
- package/{dist/decorators → decorators}/legacy/signal.d.ts +4 -3
- package/decorators/legacy/signal.js +3 -0
- package/decorators/legacy/signal.js.map +15 -0
- package/{dist/decorators → decorators}/on-event.d.ts +6 -3
- package/decorators/on-event.js +3 -0
- package/decorators/on-event.js.map +16 -0
- package/decorators/on-updated.d.ts +15 -0
- package/decorators/on-updated.js +3 -0
- package/decorators/on-updated.js.map +14 -0
- package/decorators/prop.d.ts +26 -0
- package/decorators/prop.js +3 -0
- package/decorators/prop.js.map +17 -0
- package/decorators/query-slot.d.ts +17 -0
- package/decorators/query-slot.js +3 -0
- package/decorators/query-slot.js.map +16 -0
- package/{dist/decorators → decorators}/query.d.ts +9 -2
- package/decorators/query.js +3 -0
- package/decorators/query.js.map +15 -0
- package/decorators/shared/reactive-attr.d.ts +25 -0
- package/decorators/shared/reactive-attr.js +3 -0
- package/decorators/shared/reactive-attr.js.map +12 -0
- package/decorators/signal.d.ts +29 -0
- package/decorators/signal.js +3 -0
- package/decorators/signal.js.map +17 -0
- package/decorators/standard/attr.d.ts +2 -0
- package/decorators/standard/attr.js +3 -0
- package/decorators/standard/attr.js.map +13 -0
- package/decorators/standard/bound.js +3 -0
- package/{dist/chunk-rkh1vkb9.js.map → decorators/standard/bound.js.map} +2 -2
- package/decorators/standard/custom-element.js +3 -0
- package/decorators/standard/custom-element.js.map +11 -0
- package/decorators/standard/debounce.js +3 -0
- package/decorators/standard/debounce.js.map +11 -0
- package/decorators/standard/event.js +3 -0
- package/decorators/standard/event.js.map +12 -0
- package/{dist/decorators → decorators}/standard/on-event.d.ts +2 -1
- package/decorators/standard/on-event.js +3 -0
- package/decorators/standard/on-event.js.map +12 -0
- package/decorators/standard/on-updated.d.ts +6 -0
- package/decorators/standard/on-updated.js +3 -0
- package/decorators/standard/on-updated.js.map +10 -0
- package/{dist/decorators → decorators}/standard/query-slot.d.ts +1 -2
- package/decorators/standard/query-slot.js +3 -0
- package/decorators/standard/query-slot.js.map +11 -0
- package/decorators/standard/query.d.ts +3 -0
- package/decorators/standard/query.js +3 -0
- package/decorators/standard/query.js.map +11 -0
- package/decorators/standard/reactive-field.d.ts +2 -0
- package/decorators/standard/reactive-field.js +3 -0
- package/decorators/standard/reactive-field.js.map +10 -0
- package/decorators/standard/reactive-prop.d.ts +13 -0
- 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 +4 -3
- package/decorators/standard/signal.js +3 -0
- package/decorators/standard/signal.js.map +14 -0
- package/decorators/state.d.ts +12 -0
- package/decorators/state.js +3 -0
- package/decorators/state.js.map +14 -0
- package/{dist/helpers → helpers}/create-event-listener.d.ts +11 -2
- package/helpers/create-event-listener.js +3 -0
- package/helpers/create-event-listener.js.map +11 -0
- package/helpers/create-event.js +3 -0
- package/helpers/create-event.js.map +11 -0
- package/{dist/helpers → helpers}/create-query-slot.d.ts +2 -3
- package/helpers/create-query-slot.js +3 -0
- package/helpers/create-query-slot.js.map +10 -0
- package/{dist/helpers → helpers}/create-query.d.ts +14 -3
- package/helpers/create-query.js +3 -0
- package/helpers/create-query.js.map +10 -0
- package/helpers/debounce.js +3 -0
- package/{dist/chunk-wd23rn4q.js.map → helpers/debounce.js.map} +2 -2
- package/helpers/index.js +3 -0
- package/helpers/index.js.map +16 -0
- package/index.d.ts +16 -0
- package/index.js +3 -0
- package/index.js.map +77 -0
- package/package.json +114 -120
- package/server/context-ssr.js +3 -0
- package/{dist/chunk-ssnnxzrj.js.map → server/context-ssr.js.map} +4 -3
- package/server/html-parser.js +3 -0
- package/{dist/chunk-5b1en9vz.js.map → server/html-parser.js.map} +2 -2
- package/server/install-light-dom-shim.js +3 -0
- package/server/install-light-dom-shim.js.map +12 -0
- package/{dist/server → server}/light-dom-shim.d.ts +9 -0
- package/server/light-dom-shim.js +3 -0
- package/server/light-dom-shim.js.map +11 -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 +19 -0
- package/server/radiant-element-ssr-extractor.d.ts +3 -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-runtime.d.ts +1 -0
- package/server/radiant-element-ssr-runtime.js +3 -0
- package/server/radiant-element-ssr-runtime.js.map +19 -0
- package/{dist/server → server}/render-component.d.ts +5 -15
- package/server/render-component.js +3 -0
- package/server/render-component.js.map +23 -0
- package/server/render-controller.d.ts +57 -0
- package/server/render-controller.js +3 -0
- package/server/render-controller.js.map +26 -0
- package/server/slot-projection-html.js +3 -0
- package/server/slot-projection-html.js.map +14 -0
- 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 +4 -2
- package/signals/host-signal.js +3 -0
- package/signals/host-signal.js.map +13 -0
- package/signals/hydration-script.js +3 -0
- package/signals/hydration-script.js.map +12 -0
- package/tools/escape-css-identifier.d.ts +1 -0
- 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/chunk-nssj2x13.js.map → tools/escape-script-json.js.map} +2 -2
- package/tools/event-emitter.js +3 -0
- package/{dist/chunk-wvd1ffe4.js.map → tools/event-emitter.js.map} +2 -2
- package/{dist/tools → tools}/index.d.ts +1 -1
- package/tools/index.js +3 -0
- package/tools/index.js.map +13 -0
- package/tools/render-jsx-template.js +3 -0
- package/{dist/chunk-jkb2y7c8.js.map → 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/chunk-66e6s792.js.map → utils/attribute-utils.js.map} +2 -2
- package/utils/index.js +3 -0
- package/utils/index.js.map +10 -0
- package/dist/chunk-0bswvy25.js +0 -4
- package/dist/chunk-0bswvy25.js.map +0 -10
- package/dist/chunk-0btkzzyc.js +0 -4
- package/dist/chunk-0btkzzyc.js.map +0 -10
- package/dist/chunk-0g0j9re6.js +0 -4
- package/dist/chunk-0g0j9re6.js.map +0 -10
- package/dist/chunk-1x26p09c.js +0 -4
- package/dist/chunk-1x26p09c.js.map +0 -10
- package/dist/chunk-21a7jask.js +0 -4
- package/dist/chunk-21a7jask.js.map +0 -10
- package/dist/chunk-25zjh0kg.js +0 -4
- package/dist/chunk-25zjh0kg.js.map +0 -10
- package/dist/chunk-30x4hggg.js +0 -4
- package/dist/chunk-3ryr5wx2.js +0 -4
- package/dist/chunk-3ryr5wx2.js.map +0 -10
- package/dist/chunk-3xxvmd5c.js +0 -4
- package/dist/chunk-3xxvmd5c.js.map +0 -10
- package/dist/chunk-3ynk7e1e.js +0 -4
- package/dist/chunk-3ynk7e1e.js.map +0 -10
- package/dist/chunk-4e559cy5.js +0 -4
- package/dist/chunk-4e559cy5.js.map +0 -10
- package/dist/chunk-5b1en9vz.js +0 -4
- package/dist/chunk-5bkat72n.js +0 -4
- package/dist/chunk-5bkat72n.js.map +0 -10
- package/dist/chunk-5qeaq3tj.js +0 -4
- package/dist/chunk-5qeaq3tj.js.map +0 -10
- package/dist/chunk-66e6s792.js +0 -4
- package/dist/chunk-79jg8q67.js +0 -4
- package/dist/chunk-79jg8q67.js.map +0 -10
- package/dist/chunk-8d5ddvvf.js +0 -4
- package/dist/chunk-8d5ddvvf.js.map +0 -10
- package/dist/chunk-8e9fgtbn.js +0 -4
- package/dist/chunk-8e9fgtbn.js.map +0 -10
- package/dist/chunk-9mqtp3js.js +0 -4
- package/dist/chunk-9mqtp3js.js.map +0 -10
- package/dist/chunk-9rj2rwes.js +0 -4
- package/dist/chunk-9rj2rwes.js.map +0 -10
- package/dist/chunk-atms6yrh.js +0 -4
- package/dist/chunk-atms6yrh.js.map +0 -10
- package/dist/chunk-bk2nbmcd.js +0 -4
- package/dist/chunk-bk2nbmcd.js.map +0 -10
- package/dist/chunk-bk6qkvfp.js +0 -4
- package/dist/chunk-bk6qkvfp.js.map +0 -10
- package/dist/chunk-c0qyz98c.js +0 -4
- package/dist/chunk-c0qyz98c.js.map +0 -10
- package/dist/chunk-c52qhh0j.js +0 -4
- package/dist/chunk-c52qhh0j.js.map +0 -10
- package/dist/chunk-cnyxrh9r.js +0 -4
- package/dist/chunk-cnyxrh9r.js.map +0 -10
- package/dist/chunk-cvz9mrxa.js +0 -4
- package/dist/chunk-cvz9mrxa.js.map +0 -10
- package/dist/chunk-dabagjk6.js +0 -4
- package/dist/chunk-dabagjk6.js.map +0 -10
- package/dist/chunk-e0r6ca2g.js +0 -4
- package/dist/chunk-e0r6ca2g.js.map +0 -10
- package/dist/chunk-eevw1j2q.js +0 -4
- package/dist/chunk-eevw1j2q.js.map +0 -10
- package/dist/chunk-ek664x1c.js +0 -4
- package/dist/chunk-ek664x1c.js.map +0 -10
- package/dist/chunk-eyw14d6y.js +0 -4
- package/dist/chunk-eyw14d6y.js.map +0 -10
- package/dist/chunk-fs4j94bk.js +0 -4
- package/dist/chunk-fs4j94bk.js.map +0 -10
- package/dist/chunk-g2z3mm6b.js +0 -4
- package/dist/chunk-g2z3mm6b.js.map +0 -10
- package/dist/chunk-g5n3m11h.js +0 -4
- package/dist/chunk-g5n3m11h.js.map +0 -10
- package/dist/chunk-gdkte2vd.js +0 -4
- package/dist/chunk-gdkte2vd.js.map +0 -10
- package/dist/chunk-gg74gdpv.js +0 -4
- package/dist/chunk-gg74gdpv.js.map +0 -10
- package/dist/chunk-h9k7crjc.js +0 -4
- package/dist/chunk-h9k7crjc.js.map +0 -10
- package/dist/chunk-hpzgnxgq.js +0 -4
- package/dist/chunk-hpzgnxgq.js.map +0 -10
- package/dist/chunk-hrjc8b1y.js +0 -4
- package/dist/chunk-hrjc8b1y.js.map +0 -10
- package/dist/chunk-hvy4zvcc.js +0 -4
- package/dist/chunk-hvy4zvcc.js.map +0 -10
- package/dist/chunk-hztr86b4.js +0 -4
- package/dist/chunk-hztr86b4.js.map +0 -10
- package/dist/chunk-j3v7rca5.js +0 -4
- package/dist/chunk-j3v7rca5.js.map +0 -10
- package/dist/chunk-j864sv4w.js +0 -4
- package/dist/chunk-j864sv4w.js.map +0 -10
- package/dist/chunk-jkb2y7c8.js +0 -4
- package/dist/chunk-kakpjgzf.js +0 -4
- package/dist/chunk-kakpjgzf.js.map +0 -10
- package/dist/chunk-kmebacvv.js +0 -4
- package/dist/chunk-kmebacvv.js.map +0 -10
- package/dist/chunk-knqsm6v3.js +0 -4
- package/dist/chunk-knqsm6v3.js.map +0 -10
- package/dist/chunk-mp2vtrkg.js +0 -4
- package/dist/chunk-mp2vtrkg.js.map +0 -10
- package/dist/chunk-mpsj3cjs.js +0 -4
- package/dist/chunk-mpsj3cjs.js.map +0 -10
- package/dist/chunk-n4p2542b.js +0 -4
- package/dist/chunk-n4p2542b.js.map +0 -10
- package/dist/chunk-nctznxyz.js +0 -4
- package/dist/chunk-nctznxyz.js.map +0 -10
- package/dist/chunk-ndw3hc3v.js +0 -4
- package/dist/chunk-ndw3hc3v.js.map +0 -10
- package/dist/chunk-nnnb6pac.js +0 -4
- package/dist/chunk-nnnb6pac.js.map +0 -10
- package/dist/chunk-nssj2x13.js +0 -4
- package/dist/chunk-nvr37vma.js +0 -4
- package/dist/chunk-nvr37vma.js.map +0 -10
- package/dist/chunk-p8k4g99a.js +0 -4
- package/dist/chunk-p8k4g99a.js.map +0 -10
- package/dist/chunk-pkszgjqf.js +0 -4
- package/dist/chunk-pkszgjqf.js.map +0 -10
- package/dist/chunk-q9z6tnzw.js +0 -4
- package/dist/chunk-q9z6tnzw.js.map +0 -10
- package/dist/chunk-qdz5sncz.js +0 -4
- package/dist/chunk-qdz5sncz.js.map +0 -10
- package/dist/chunk-qe0eww1n.js +0 -4
- package/dist/chunk-qe0eww1n.js.map +0 -10
- package/dist/chunk-r33zvvda.js +0 -4
- package/dist/chunk-r33zvvda.js.map +0 -10
- package/dist/chunk-rkh1vkb9.js +0 -4
- package/dist/chunk-rrg759ht.js +0 -4
- package/dist/chunk-rrg759ht.js.map +0 -10
- package/dist/chunk-s09s5ayx.js +0 -4
- package/dist/chunk-s09s5ayx.js.map +0 -10
- package/dist/chunk-s5p5z3z4.js +0 -4
- package/dist/chunk-s5p5z3z4.js.map +0 -10
- package/dist/chunk-sf4a2gy5.js +0 -4
- package/dist/chunk-sf4a2gy5.js.map +0 -10
- package/dist/chunk-ssnnxzrj.js +0 -4
- package/dist/chunk-t8xtvgyg.js +0 -4
- package/dist/chunk-v3ta7hnv.js +0 -4
- package/dist/chunk-v3ta7hnv.js.map +0 -10
- package/dist/chunk-v92hp9g0.js +0 -4
- package/dist/chunk-v92hp9g0.js.map +0 -10
- package/dist/chunk-vgtggzb6.js +0 -4
- package/dist/chunk-vk48hgm4.js +0 -4
- package/dist/chunk-vk48hgm4.js.map +0 -10
- package/dist/chunk-w8s5fnsq.js +0 -4
- package/dist/chunk-w8s5fnsq.js.map +0 -10
- package/dist/chunk-wd23rn4q.js +0 -4
- package/dist/chunk-wds4href.js +0 -4
- package/dist/chunk-wds4href.js.map +0 -10
- package/dist/chunk-wvd1ffe4.js +0 -4
- package/dist/chunk-wwbjz9k4.js +0 -4
- package/dist/chunk-wwbjz9k4.js.map +0 -10
- package/dist/chunk-x2k0ngpz.js +0 -4
- package/dist/chunk-x2k0ngpz.js.map +0 -10
- package/dist/chunk-x457d0ap.js +0 -4
- package/dist/chunk-x457d0ap.js.map +0 -10
- package/dist/chunk-xbhtzkre.js +0 -4
- package/dist/chunk-xbhtzkre.js.map +0 -10
- package/dist/chunk-y139ycfm.js +0 -4
- package/dist/chunk-y139ycfm.js.map +0 -10
- package/dist/chunk-z9kxfckm.js +0 -4
- package/dist/chunk-z9kxfckm.js.map +0 -10
- package/dist/chunk-zx5txex8.js +0 -4
- package/dist/chunk-zx5txex8.js.map +0 -10
- package/dist/client/hydrator.js +0 -3
- package/dist/client/hydrator.js.map +0 -9
- package/dist/client/install-hydrator.js +0 -3
- package/dist/client/install-hydrator.js.map +0 -10
- package/dist/context/context-consumer-bootstrap.js +0 -3
- package/dist/context/context-consumer-bootstrap.js.map +0 -9
- package/dist/context/context-consumer-runtime.d.ts +0 -34
- package/dist/context/context-consumer-runtime.js +0 -3
- package/dist/context/context-consumer-runtime.js.map +0 -9
- package/dist/context/context-provider.js +0 -3
- package/dist/context/context-provider.js.map +0 -9
- package/dist/context/context-ssr-bridge.js +0 -3
- package/dist/context/context-ssr-bridge.js.map +0 -9
- package/dist/context/create-context.js +0 -3
- package/dist/context/create-context.js.map +0 -9
- package/dist/context/decorators/consume-context.js +0 -3
- package/dist/context/decorators/consume-context.js.map +0 -9
- package/dist/context/decorators/context-selection-delivery.d.ts +0 -1
- package/dist/context/decorators/context-selection-delivery.js +0 -3
- package/dist/context/decorators/context-selection-delivery.js.map +0 -9
- package/dist/context/decorators/context-selector.js +0 -3
- package/dist/context/decorators/context-selector.js.map +0 -9
- package/dist/context/decorators/legacy/consume-context.d.ts +0 -3
- package/dist/context/decorators/legacy/consume-context.js +0 -3
- package/dist/context/decorators/legacy/consume-context.js.map +0 -9
- package/dist/context/decorators/legacy/context-selector-field.js +0 -3
- package/dist/context/decorators/legacy/context-selector-field.js.map +0 -9
- package/dist/context/decorators/legacy/context-selector.js +0 -3
- package/dist/context/decorators/legacy/context-selector.js.map +0 -9
- package/dist/context/decorators/legacy/provide-context.js +0 -3
- package/dist/context/decorators/legacy/provide-context.js.map +0 -9
- package/dist/context/decorators/on-context-update.js +0 -3
- package/dist/context/decorators/on-context-update.js.map +0 -9
- package/dist/context/decorators/provide-context.js +0 -3
- package/dist/context/decorators/provide-context.js.map +0 -9
- package/dist/context/decorators/standard/consume-context.d.ts +0 -3
- package/dist/context/decorators/standard/consume-context.js +0 -3
- package/dist/context/decorators/standard/consume-context.js.map +0 -9
- package/dist/context/decorators/standard/context-selector-field.js +0 -3
- package/dist/context/decorators/standard/context-selector-field.js.map +0 -9
- package/dist/context/decorators/standard/context-selector.js +0 -3
- package/dist/context/decorators/standard/context-selector.js.map +0 -9
- package/dist/context/decorators/standard/provide-context.js +0 -3
- package/dist/context/decorators/standard/provide-context.js.map +0 -9
- package/dist/context/events.js +0 -3
- package/dist/context/events.js.map +0 -9
- package/dist/context/hydration-script.js +0 -3
- package/dist/context/hydration-script.js.map +0 -9
- package/dist/core/custom-element-metadata.d.ts +0 -3
- package/dist/core/custom-element-metadata.js +0 -3
- package/dist/core/custom-element-metadata.js.map +0 -9
- package/dist/core/hydration-codec.js +0 -3
- package/dist/core/hydration-codec.js.map +0 -9
- 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 -9
- package/dist/core/radiant-component-ssr.js +0 -3
- package/dist/core/radiant-component-ssr.js.map +0 -9
- package/dist/core/radiant-component.d.ts +0 -113
- package/dist/core/radiant-component.js +0 -3
- package/dist/core/radiant-component.js.map +0 -9
- package/dist/core/radiant-element.js +0 -3
- package/dist/core/radiant-element.js.map +0 -9
- package/dist/core/radiant-hydrator-state.js +0 -3
- package/dist/core/radiant-hydrator-state.js.map +0 -9
- package/dist/core/reactive-jsx-value.js +0 -3
- package/dist/core/reactive-jsx-value.js.map +0 -9
- package/dist/core/reactive-prop-metadata.js +0 -3
- package/dist/core/reactive-prop-metadata.js.map +0 -9
- package/dist/core/slot-projection-runtime.js +0 -3
- package/dist/core/slot-projection-runtime.js.map +0 -9
- package/dist/core/ssr-preparation.js +0 -3
- package/dist/core/ssr-preparation.js.map +0 -9
- package/dist/decorators/bound.d.ts +0 -5
- package/dist/decorators/bound.js +0 -3
- package/dist/decorators/bound.js.map +0 -9
- package/dist/decorators/bridge.d.ts +0 -8
- package/dist/decorators/bridge.js +0 -3
- package/dist/decorators/bridge.js.map +0 -9
- package/dist/decorators/custom-element.js +0 -3
- package/dist/decorators/custom-element.js.map +0 -9
- package/dist/decorators/debounce.d.ts +0 -6
- package/dist/decorators/debounce.js +0 -3
- package/dist/decorators/debounce.js.map +0 -9
- package/dist/decorators/event.js +0 -3
- package/dist/decorators/event.js.map +0 -9
- package/dist/decorators/legacy/bound.js +0 -3
- package/dist/decorators/legacy/bound.js.map +0 -9
- package/dist/decorators/legacy/custom-element.js +0 -3
- package/dist/decorators/legacy/custom-element.js.map +0 -9
- package/dist/decorators/legacy/debounce.js +0 -3
- package/dist/decorators/legacy/debounce.js.map +0 -9
- package/dist/decorators/legacy/event.js +0 -3
- package/dist/decorators/legacy/event.js.map +0 -9
- package/dist/decorators/legacy/instance-initializers.d.ts +0 -17
- package/dist/decorators/legacy/instance-initializers.js +0 -3
- package/dist/decorators/legacy/instance-initializers.js.map +0 -9
- package/dist/decorators/legacy/on-event.js +0 -3
- package/dist/decorators/legacy/on-event.js.map +0 -9
- package/dist/decorators/legacy/on-updated.d.ts +0 -6
- package/dist/decorators/legacy/on-updated.js +0 -3
- package/dist/decorators/legacy/on-updated.js.map +0 -9
- package/dist/decorators/legacy/query-slot.d.ts +0 -3
- package/dist/decorators/legacy/query-slot.js +0 -3
- package/dist/decorators/legacy/query-slot.js.map +0 -9
- package/dist/decorators/legacy/query.js +0 -3
- package/dist/decorators/legacy/query.js.map +0 -9
- package/dist/decorators/legacy/reactive-field.js +0 -3
- package/dist/decorators/legacy/reactive-field.js.map +0 -9
- package/dist/decorators/legacy/reactive-prop.d.ts +0 -20
- package/dist/decorators/legacy/reactive-prop.js +0 -3
- package/dist/decorators/legacy/reactive-prop.js.map +0 -9
- package/dist/decorators/legacy/signal.js +0 -3
- package/dist/decorators/legacy/signal.js.map +0 -9
- package/dist/decorators/on-event.js +0 -3
- package/dist/decorators/on-event.js.map +0 -9
- package/dist/decorators/on-updated.d.ts +0 -5
- package/dist/decorators/on-updated.js +0 -3
- package/dist/decorators/on-updated.js.map +0 -9
- package/dist/decorators/prop.d.ts +0 -14
- package/dist/decorators/prop.js +0 -3
- package/dist/decorators/prop.js.map +0 -9
- package/dist/decorators/query-slot.d.ts +0 -13
- package/dist/decorators/query-slot.js +0 -3
- package/dist/decorators/query-slot.js.map +0 -9
- package/dist/decorators/query.js +0 -3
- package/dist/decorators/query.js.map +0 -9
- package/dist/decorators/signal.d.ts +0 -23
- package/dist/decorators/signal.js +0 -3
- package/dist/decorators/signal.js.map +0 -9
- package/dist/decorators/standard/bound.js +0 -3
- package/dist/decorators/standard/bound.js.map +0 -9
- package/dist/decorators/standard/custom-element.js +0 -3
- package/dist/decorators/standard/custom-element.js.map +0 -9
- package/dist/decorators/standard/debounce.js +0 -3
- package/dist/decorators/standard/debounce.js.map +0 -9
- package/dist/decorators/standard/event.js +0 -3
- package/dist/decorators/standard/event.js.map +0 -9
- package/dist/decorators/standard/on-event.js +0 -3
- package/dist/decorators/standard/on-event.js.map +0 -9
- package/dist/decorators/standard/on-updated.d.ts +0 -2
- package/dist/decorators/standard/on-updated.js +0 -3
- package/dist/decorators/standard/on-updated.js.map +0 -9
- package/dist/decorators/standard/query-slot.js +0 -3
- package/dist/decorators/standard/query-slot.js.map +0 -9
- package/dist/decorators/standard/query.d.ts +0 -2
- package/dist/decorators/standard/query.js +0 -3
- package/dist/decorators/standard/query.js.map +0 -9
- package/dist/decorators/standard/reactive-field.d.ts +0 -2
- package/dist/decorators/standard/reactive-field.js +0 -3
- package/dist/decorators/standard/reactive-field.js.map +0 -9
- package/dist/decorators/standard/reactive-prop.d.ts +0 -2
- package/dist/decorators/standard/reactive-prop.js +0 -3
- package/dist/decorators/standard/reactive-prop.js.map +0 -9
- package/dist/decorators/standard/signal.js +0 -3
- package/dist/decorators/standard/signal.js.map +0 -9
- package/dist/decorators/state.d.ts +0 -11
- package/dist/decorators/state.js +0 -3
- package/dist/decorators/state.js.map +0 -9
- package/dist/helpers/create-event-listener.js +0 -3
- package/dist/helpers/create-event-listener.js.map +0 -9
- package/dist/helpers/create-event.js +0 -3
- package/dist/helpers/create-event.js.map +0 -9
- package/dist/helpers/create-query-slot.js +0 -3
- package/dist/helpers/create-query-slot.js.map +0 -9
- package/dist/helpers/create-query.js +0 -3
- package/dist/helpers/create-query.js.map +0 -9
- package/dist/helpers/debounce.js +0 -3
- package/dist/helpers/debounce.js.map +0 -9
- package/dist/helpers/index.js +0 -3
- package/dist/helpers/index.js.map +0 -9
- package/dist/index.d.ts +0 -25
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -9
- package/dist/server/context-ssr.js +0 -3
- package/dist/server/context-ssr.js.map +0 -9
- package/dist/server/html-parser.js +0 -3
- package/dist/server/html-parser.js.map +0 -9
- package/dist/server/install-light-dom-shim.js +0 -3
- package/dist/server/install-light-dom-shim.js.map +0 -10
- package/dist/server/light-dom-shim.js +0 -3
- package/dist/server/light-dom-shim.js.map +0 -9
- 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 -9
- package/dist/server/render-component.js +0 -3
- package/dist/server/render-component.js.map +0 -10
- package/dist/server/slot-projection-html.js +0 -3
- package/dist/server/slot-projection-html.js.map +0 -10
- package/dist/signals/host-resource.js +0 -3
- package/dist/signals/host-signal.js +0 -3
- package/dist/signals/host-signal.js.map +0 -9
- package/dist/signals/hydration-script.js +0 -3
- package/dist/signals/hydration-script.js.map +0 -9
- package/dist/tools/escape-script-json.js +0 -3
- package/dist/tools/escape-script-json.js.map +0 -9
- package/dist/tools/event-emitter.js +0 -3
- package/dist/tools/event-emitter.js.map +0 -9
- package/dist/tools/index.js +0 -3
- package/dist/tools/index.js.map +0 -9
- package/dist/tools/render-jsx-template.js +0 -3
- package/dist/tools/render-jsx-template.js.map +0 -9
- package/dist/tools/stringify-typed.d.ts +0 -16
- package/dist/tools/stringify-typed.js +0 -3
- package/dist/tools/stringify-typed.js.map +0 -9
- package/dist/types.js +0 -3
- package/dist/utils/attribute-utils.js +0 -3
- package/dist/utils/attribute-utils.js.map +0 -9
- package/dist/utils/index.js +0 -3
- package/dist/utils/index.js.map +0 -9
- package/size-budget.json +0 -16
- /package/{dist/client → client}/install-hydrator.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}/hydration-script.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/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}/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}/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/helpers → helpers}/create-event.d.ts +0 -0
- /package/{dist/helpers → helpers}/debounce.d.ts +0 -0
- /package/{dist/helpers → helpers}/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}/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-script-json.d.ts +0 -0
- /package/{dist/tools → tools}/event-emitter.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
|
@@ -2,14 +2,6 @@ import type { JsxRenderable } from '@ecopages/jsx';
|
|
|
2
2
|
import type { RenderToStringOptions } from '@ecopages/jsx/server';
|
|
3
3
|
import type { ContextType, UnknownContext } from '../context/types';
|
|
4
4
|
import { type ServerRenderEnvironment } from './light-dom-shim';
|
|
5
|
-
/** Default response header carrying the fragment render timestamp. */
|
|
6
|
-
export declare const RENDERED_COMPONENT_GENERATED_AT_HEADER = "x-generated-at";
|
|
7
|
-
/** Default response header carrying the custom-element tag name for the fragment. */
|
|
8
|
-
export declare const RENDERED_COMPONENT_TAG_NAME_HEADER = "x-radiant-tag-name";
|
|
9
|
-
/** Default response header carrying the client module URL for the fragment. */
|
|
10
|
-
export declare const RENDERED_COMPONENT_CLIENT_MODULE_HEADER = "x-radiant-client-module";
|
|
11
|
-
/** Default response header carrying serialized fragment asset metadata. */
|
|
12
|
-
export declare const RENDERED_COMPONENT_ASSETS_HEADER = "x-radiant-assets";
|
|
13
5
|
/** Asset dependency emitted by a rendered fragment. */
|
|
14
6
|
export type RenderedComponentAsset = {
|
|
15
7
|
/** Browser module specifier that must be loaded to activate the fragment. */
|
|
@@ -76,9 +68,9 @@ export type RenderedComponentWithPreview = RenderedComponentPayload & {
|
|
|
76
68
|
preview: JsxRenderable;
|
|
77
69
|
};
|
|
78
70
|
/** Minimal component contract needed for framework-agnostic SSR helpers. */
|
|
79
|
-
export type ServerRenderableComponent = {
|
|
71
|
+
export type ServerRenderableComponent = object & {
|
|
80
72
|
renderHost?: () => JsxRenderable;
|
|
81
|
-
renderHostToString
|
|
73
|
+
renderHostToString?: (options?: RenderToStringOptions) => string;
|
|
82
74
|
};
|
|
83
75
|
/** Constructor shape for a server-renderable component. */
|
|
84
76
|
export type ServerRenderableComponentConstructor<TComponent extends ServerRenderableComponent> = CustomElementConstructor & {
|
|
@@ -187,9 +179,7 @@ export declare function renderComponentWithPreview<TComponent extends ServerRend
|
|
|
187
179
|
* framework adapters or JSON/HTML fragment endpoints.
|
|
188
180
|
*/
|
|
189
181
|
export declare function toRenderedComponentPayload(render: RenderedComponentWithPreview | RenderedComponent): RenderedComponentPayload;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*/
|
|
194
|
-
export declare function createRenderedComponentHeaders(render: RenderedComponent | RenderedComponentMetadata | RenderedComponentPayload | RenderedComponentWithPreview): Record<string, string>;
|
|
182
|
+
export declare function mergeRenderedComponentAssets(assets: readonly RenderedComponentAsset[], clientModuleSrc: string | undefined): readonly RenderedComponentAsset[];
|
|
183
|
+
export declare function resolvePrimaryClientModuleSrc(assets: readonly RenderedComponentAsset[]): string | undefined;
|
|
184
|
+
export declare function normalizeRenderOptions(options: RenderToStringOptions | undefined): RenderToStringOptions;
|
|
195
185
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var Sf=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(g,R)=>(typeof require<"u"?require:g)[R]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var i=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),c=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),yf=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function Yg(f,g){t(f,i,g)}function Ag(f,g){t(f,c,g)}function Sg(f){D(f,i)}function p(f){let g=f;D(f,c,g[yf]??=new Set)}function t(f,g,R){let P=f,b=Object.prototype.hasOwnProperty.call(P,g)?P[g]:void 0;if(Array.isArray(b)){b.push(R);return}Object.defineProperty(P,g,{value:[R]})}function D(f,g,R,P=Object.getPrototypeOf(f)){if(!P||P===Object.prototype)return;D(f,g,R,Object.getPrototypeOf(P));let b=P[g];if(!Array.isArray(b))return;for(let $ of b){if(R?.has($))continue;$(f),R?.add($)}}function o(f){switch(f){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function wf(f){switch(typeof f){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(f))return"array";if(Object.prototype.toString.call(f)==="[object Object]")return"object"}function Vf(f){switch(f){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function sf(f){try{return JSON.parse(f)}catch{throw TypeError("Invalid JSON string")}}var Cf={array(f){let g=sf(f);if(!Array.isArray(g))throw TypeError(`Expected an array but got a value of type "${typeof g}"`);return g},boolean(f){return!(f==="0"||String(f).toLowerCase()==="false")},number(f){return Number(f.replace(/_/g,""))},object(f){let g=JSON.parse(f);if(g===null||typeof g!=="object"||Array.isArray(g))throw TypeError(`expected value of type "object" but instead got value "${f}" of type "${wf(g)}"`);return g},string(f){return f}},l={default:n,array:a,object:a};function a(f){return JSON.stringify(f)}function n(f){return`${f}`}function m(f,g){let R=o(g);if(!R)throw TypeError(`[radiant-element] Unknown type "${g}"`);return Cf[R](f)}function e(f,g){let R=o(g);if(!R)throw TypeError(`[radiant-element] Unknown type "${g}"`);return(l[R]??l.default??n)(f)}function kf(f){return typeof f==="boolean"}function Tf(f){return typeof f==="number"}function _f(f){return typeof f==="string"}function If(f){return Array.isArray(f)}function Lf(f){return typeof f==="object"&&!Array.isArray(f)&&f!==null}function wg(f,g){switch(f){case Boolean:return kf(g);case Number:return Tf(g);case String:return _f(g);case Array:return If(g);case Object:return Lf(g);default:return!1}}var Vg=(f,g,R,P)=>{if(g===Boolean){let $=f.getAttribute(R);if($===null)return P;return $===""?!0:m($,g)}let b=f.getAttribute(R);return b!==null?m(b,g):P??Vf(g)};import{getActiveSsrScopeValue as Df,withActiveSsrScopeValue as zf}from"@ecopages/jsx/server";var ff=Symbol.for("@ecopages/radiant.element-ssr-runtime");function kg(){return Df(ff)}function Y(f,g){return zf(ff,f,g)}var gf=Symbol.for("@ecopages/radiant.customElementTagName");function _g(f,g){f[gf]=g}function A(f){return f[gf]}var z=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function Lg(f,g,R){let P=f.constructor,b=P[z]??[];if(b.some(($)=>$.name===g))return;b.push({name:g,options:R}),P[z]=b}function Rf(f){return(f.constructor[z]??[]).slice()}var Pf=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function bf(){return globalThis}function $f(f){bf()[Pf]=f}function zg(f){return bf()[Pf]?.(f)}var Z;function Hf(){if(Z!==void 0)return Z;try{let{AsyncLocalStorage:f}=(()=>{throw new Error("Cannot require module "+"node:async_hooks");})();return Z=new f,Z}catch{return Z=null,null}}var jf=Symbol.for("@ecopages/radiant.ssr-context-fallback-stack");function rf(){let f=globalThis;return f[jf]??=[],f[jf]}function S(f){if(f.length===0)return()=>{return};let g=new Map;for(let b of f)g.set(b.getContextKey(),b);let R=Hf();if(R){let b=R.getStore()??[],$=[...b,g];return R.enterWith($),()=>{R.enterWith(b)}}let P=rf();return P.push(g),()=>{let b=P.lastIndexOf(g);if(b>=0)P.splice(b,1)}}function qf(f){let g=Hf()?.getStore()??rf();for(let R=g.length-1;R>=0;R-=1){let P=g[R]?.get(f);if(P)return P}return}function Og(f){let g=qf(f);if(!g)return;return g.getContext()}$f((f)=>qf(f));class E{host;constructor(f){this.host=f}renderHost(){return{nodeType:1,outerHTML:this.renderHostToString({mode:"hydrate"})}}renderHostToString(f={},g=this.getHostAttributes()){let R=this.getTagName(),P=S(this.host.getContextProviders());try{return`<${R}${Ef(g)}>${this.renderHostContent(f)}</${R}>`}finally{P()}}renderHostContent(f){let g=this.host.renderViewToString(f),R=this.host.getAuthoredHydrationScriptMarkup?.()??"",P=this.host.getSlotProjectionScriptTag?.()??"";if(!(f.mode==="hydrate"||f.mode===void 0&&f.hydrate===!0))return`${g}${R}${P}`;let $=this.host.getHydrationBindings().map((j)=>j.renderHydrationScriptTag()).filter((j)=>typeof j==="string").join("");return`${g}${P}${$}`}getHostAttributes(){let f={},g=new Set;for(let R of this.host.getReactiveProperties()){let P=this.host.getPropertyValue(R.name);if(P===void 0||P===null||P===!1)continue;f[R.attribute]=String(R.converter.toAttribute(P)),g.add(R.attribute)}for(let R of this.host.getReactivePropDefinitions()){let P=R.options.attribute??R.name;if(g.has(P))continue;let b=this.host.getPropertyValue(R.name);if(b===void 0||b===null||b===!1)continue;f[P]=String(e(b,R.options.type)),g.add(P)}for(let R of this.host.listAttributeNames()){let P=this.host.getAttributeValue(R);if(P!==null)f[R]=P}return f}getTagName(){let f=A(this.host.constructor);if(!f)throw Error(`${this.host.constructor.name} is missing @customElement metadata.`);return f}}function Ef(f){return Object.entries(f).map(([g,R])=>` ${g}="${Nf(R)}"`).join("")}function Nf(f){return f.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Q(f){if(Of(f))return f;return}function Of(f){return typeof f.constructor==="function"&&typeof f.getAttribute==="function"&&typeof f.getAuthoredHydrationScriptMarkup==="function"&&typeof f.getContextProviders==="function"&&typeof f.getHydrationBindings==="function"&&typeof f.getReactiveProperties==="function"&&typeof f.getSlotProjectionScriptTag==="function"&&typeof f.resolveTrackedRenderOutput==="function"&&typeof f.renderViewToString==="function"}function Qf(f){let g=Q(f);if(!g)throw Error("Radiant SSR runtime requires a server extraction host shape on the component.");return{constructor:g.constructor,getAuthoredHydrationScriptMarkup:()=>g.getAuthoredHydrationScriptMarkup(),getContextProviders:()=>g.getContextProviders(),getHydrationBindings:()=>g.getHydrationBindings(),getSlotProjectionScriptTag:()=>g.getSlotProjectionScriptTag(),renderViewToString:(R)=>g.renderViewToString(R),getReactiveProperties:()=>g.getReactiveProperties(),getReactivePropDefinitions:()=>Rf(f),getPropertyValue:(R)=>Reflect.get(f,R),listAttributeNames:()=>g.getAttributeNames(),getAttributeValue:(R)=>g.getAttribute(R)}}import{renderToString as vf}from"@ecopages/jsx/server";import{isServerRenderHydrationActive as Jf,withForcedServerCustomElementRendering as uf,withServerCustomElementRenderHook as Mf}from"@ecopages/jsx/server";var y;function Bf(f){return new E(Qf(f))}function w(f){return{nodeType:1,outerHTML:F(f,{mode:"hydrate"})}}function Zf(f){if(X(f))return w(f);if(!V(f))return;return f.renderHost?.()??{nodeType:1,outerHTML:f.renderHostToString({mode:"hydrate"})}}function F(f,g={}){return N(()=>Bf(f).renderHostToString(g,xf(f)))}function Ff(f,g={}){if(X(f))return F(f,g);if(!V(f))return;return f.renderHostToString(g)}function Xf(f,g){if(X(f))return w(f);if(!V(f))return;return f.renderHost?.()??{nodeType:1,outerHTML:g}}function df(f,g={}){return N(()=>pf(()=>vf(tf(f).value,g)))}function xf(f){return Bf(f).getHostAttributes()}function cf(f){if(!X(f))return;return{renderHost:()=>w(f),renderHostToString:(g)=>F(f,g)}}function gR(f){return Q(f)}function pf(f){return uf(()=>Mf(({instance:g})=>{if(X(g))return{nodeType:1,get outerHTML(){let P=Jf();return F(g,{hydrate:P,mode:P?"hydrate":"plain"})}};if(!V(g))return;let R=g;return{nodeType:1,get outerHTML(){let P=Jf();return R.renderHostToString({hydrate:P,mode:P?"hydrate":"plain"})}}},f))}function tf(f){if(lf(f))return f.resolveTrackedRenderOutput();let g=Q(f);if(!g)throw Error("Radiant SSR runtime requires tracked render output support on the component.");return g.resolveTrackedRenderOutput()}function X(f){if(typeof f!=="object"||f===null)return!1;return Q(f)!==void 0}function V(f){if(typeof f!=="object"||f===null)return!1;return typeof f.renderHostToString==="function"}function lf(f){if(typeof f!=="object"||f===null)return!1;return typeof f.resolveTrackedRenderOutput==="function"}function s(){if(y)return y;return y={getHostAttributes:xf,renderHost:w,renderHostToString:F,resolveRenderBridge:cf,renderView:df},y}function N(f){return Y(s(),f)}var C=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gf(f){let g=[],R=0;while(R<f.length){let P=R;if(f.startsWith("<!--",R)){let j=f.indexOf("-->",R+4);R=j===-1?f.length:j+3,g.push(f.slice(P,R));continue}if(f[R]!=="<"){let j=f.indexOf("<",R);R=j===-1?f.length:j,g.push(f.slice(P,R));continue}let b=x(f,R);if(!b){g.push(f.slice(P));break}if(b.type!=="open"||b.selfClosing||C.has(b.tagName)){R=b.end,g.push(f.slice(P,R));continue}R=b.end;let $=1;while(R<f.length&&$>0){let j=f.indexOf("<",R);if(j===-1){R=f.length;break}let H=x(f,j);if(!H){R=f.length;break}if(R=H.end,H.type==="comment"||H.type==="declaration")continue;if(H.type==="open"&&!H.selfClosing&&!C.has(H.tagName)){$+=1;continue}if(H.type==="close")$-=1}g.push(f.slice(P,R))}return g.filter((P)=>P!=="")}function af(f,g){let R;for(let P=g+1;P<f.length;P+=1){let b=f[P];if(R){if(b===R)R=void 0;continue}if(b==='"'||b==="'"){R=b;continue}if(b===">")return P+1}return f.length}function mf(f){let g={},R=/([:^@A-Za-z0-9_.-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;for(let P of f.matchAll(R)){let[,b,$,j,H]=P;if(!b)continue;g[b]=$??j??H??""}return g}function x(f,g){if(f.startsWith("<!--",g)){let K=f.indexOf("-->",g+4);return{end:K===-1?f.length:K+3,type:"comment"}}let R=af(f,g),P=f.slice(g+1,R-1).trim();if(P==="")return;if(P.startsWith("!")||P.startsWith("?"))return{end:R,type:"declaration"};if(P.startsWith("/"))return{end:R,type:"close"};let b=/\/\s*$/.test(P),$=b?P.replace(/\/\s*$/,"").trim():P,j=$.split(/[\s/>]/,1)[0]?.toLowerCase()??"",H=j.length,q=$.slice(H).trim(),L=b||C.has(j)?"":of(f,g,R,j);return{attributes:mf(q),end:R,innerHtml:L,selfClosing:b,tagName:j,type:"open"}}function of(f,g,R,P){let b=R,$=1;while(b<f.length&&$>0){let j=f.indexOf("<",b);if(j===-1)return f.slice(R);let H=x(f,j);if(!H)return f.slice(R);if(H.type==="open"&&H.tagName===P&&!H.selfClosing&&!C.has(P))$+=1;if(H.type==="close"){if(f.slice(j+2,H.end-1).trim().toLowerCase()===P){if($-=1,$===0)return f.slice(R,j)}}b=H.end}return f.slice(R)}class r extends EventTarget{nodeType;static DOCUMENT_NODE=9;static ELEMENT_NODE=1;static TEXT_NODE=3;childNodes=[];ownerDocument;parentNode=null;constructor(f,g=null){super();this.nodeType=f;this.ownerDocument=g}append(...f){for(let g of f)this.appendChild(typeof g==="string"?nf(g):g)}appendChild(f){if("parentNode"in f&&f.parentNode&&"removeChild"in f.parentNode)f.parentNode.removeChild(f);return this.childNodes.push(f),f.ownerDocument=this.nodeType===r.DOCUMENT_NODE?this:this.ownerDocument,f.parentNode=this,f}removeChild(f){let g=this.childNodes.indexOf(f);if(g===-1)return f;return this.childNodes.splice(g,1),f.parentNode=null,f}replaceChildren(...f){for(let g of this.childNodes)g.parentNode=null;this.childNodes=[],this.append(...f)}get textContent(){return this.childNodes.map((f)=>f.textContent??"").join("")}set textContent(f){this.replaceChildren(f??"")}getRootNode(){let f=this;while("parentNode"in f&&f.parentNode)f=f.parentNode;return f}}class W extends r{value;constructor(f,g=B()){super(r.TEXT_NODE,g);this.value=f}get textContent(){return this.value}set textContent(f){this.value=f??""}}class Uf{element;constructor(f){this.element=f}add(...f){let g=new Set(this.readTokens());for(let R of f)if(R!=="")g.add(R);this.writeTokens([...g])}remove(...f){let g=new Set(this.readTokens());for(let R of f)g.delete(R);this.writeTokens([...g])}toggle(f,g){let R=this.contains(f);if(g??!R)return this.add(f),!0;return this.remove(f),!1}contains(f){return this.readTokens().includes(f)}toString(){return this.value}get value(){return this.element.getAttribute("class")??""}readTokens(){return this.value.split(/\s+/).map((f)=>f.trim()).filter((f)=>f.length>0)}writeTokens(f){if(f.length===0){this.element.removeAttribute("class");return}this.element.setAttribute("class",f.join(" "))}}class k extends r{attributes=new Map;classListValue;datasetValue;fragmentHtml;fragmentText;localName;tagName;constructor(f="div",g=B()){super(r.ELEMENT_NODE,g);this.localName=f.toLowerCase(),this.tagName=this.localName.toUpperCase()}get classList(){return this.classListValue??=new Uf(this),this.classListValue}get dataset(){return this.datasetValue??=new Proxy({},{deleteProperty:(f,g)=>{if(typeof g!=="string")return!1;return this.removeAttribute(U(g)),!0},get:(f,g)=>{if(typeof g!=="string")return;return this.getAttribute(U(g))??void 0},getOwnPropertyDescriptor:(f,g)=>{if(typeof g!=="string")return;return{configurable:!0,enumerable:!0,value:this.getAttribute(U(g))??void 0,writable:!0}},has:(f,g)=>{return typeof g==="string"&&this.hasAttribute(U(g))},ownKeys:()=>{return this.getAttributeNames().filter((f)=>f.startsWith("data-")).map((f)=>bg(f.slice(5)))},set:(f,g,R)=>{if(typeof g!=="string")return!1;return this.setAttribute(U(g),String(R)),!0}}),this.datasetValue}hasAttribute(f){return this.attributes.has(f)}getAttribute(f){return this.attributes.get(f)??null}getAttributeNames(){return Array.from(this.attributes.keys())}setAttribute(f,g){this.fragmentHtml=void 0,this.attributes.set(f,String(g))}toggleAttribute(f,g){if(g??!this.hasAttribute(f))return this.setAttribute(f,""),!0;return this.removeAttribute(f),!1}removeAttribute(f){this.fragmentHtml=void 0,this.attributes.delete(f)}querySelector(){return null}querySelectorAll(){return[]}matches(){return!1}get outerHTML(){if(this.fragmentHtml!==void 0)return this.fragmentHtml;let f=Array.from(this.attributes.entries()).map(([g,R])=>` ${g}="${Rg(R)}"`).join("");return`<${this.localName}${f}>${this.innerHTML}</${this.localName}>`}get innerHTML(){return this.childNodes.map((f)=>jg(f)).join("")}set innerHTML(f){this.fragmentHtml=void 0,this.fragmentText=void 0,this.replaceChildren(...Yf(f,this.ownerDocument))}get textContent(){return this.fragmentText??super.textContent??""}set textContent(f){this.fragmentHtml=void 0,this.fragmentText=f??"",super.textContent=f}setSerializedFragment(f,g,R){this.fragmentHtml=f,this.fragmentText=g,this.attributes=new Map(Object.entries(R)),this.replaceChildren()}}class T{bubbles;cancelable;composed;type;constructor(f,g={}){this.type=f,this.bubbles=g.bubbles??!1,this.cancelable=g.cancelable??!1,this.composed=g.composed??!1}}class u extends T{detail;constructor(f,g={}){super(f,g);this.detail=g.detail}}class J extends k{isConnected=!1;constructor(f="div",g=B()){super(f,g)}insertAdjacentHTML(f,g){this.append(...Yf(g,this.ownerDocument))}}class h extends J{constructor(f=B()){super("script",f)}}class O extends r{constructor(){super(r.DOCUMENT_NODE)}createElement(f){return f.toLowerCase()==="script"?new h(this):new J(f,this)}createTextNode(f){return new W(f,this)}querySelector(){return null}querySelectorAll(){return[]}}class Wf{definitions=new Map;define(f,g){if(this.definitions.has(f))return;this.definitions.set(f,g)}get(f){return this.definitions.get(f)}}var G,v={escape(f){return $g(String(f))}};function nf(f){return new W(f,B())}function B(){return globalThis.document??null}function hf(){let f=globalThis,g=f.customElements;if(typeof f.Node>"u"||typeof f.Document>"u"||typeof f.Element>"u"||typeof f.HTMLElement>"u"||typeof f.document>"u"||!g||typeof g.define!=="function"||typeof g.get!=="function")return;return f.window??{CSS:f.CSS??v,CustomEvent:f.CustomEvent??u,Document:f.Document,Element:f.Element,Event:f.Event??T,EventTarget:f.EventTarget??EventTarget,HTMLScriptElement:f.HTMLScriptElement??f.HTMLElement,HTMLElement:f.HTMLElement,Node:f.Node,document:f.document,customElements:g}}function ef(){let f=hf();if(f)return f;return fg()}function Kf(){return ef(),{prepareHost(f,g={}){if(g.authoredContent!==void 0)f.innerHTML=g.authoredContent}}}function fg(){let f=hf();if(f)return f;if(G)return G;let g=new Wf,R=new O,P=globalThis.Event??T,b=globalThis.CustomEvent??u,$=O,j=globalThis.EventTarget??EventTarget;return G={CSS:globalThis.CSS??v,CustomEvent:b,Document:$,Element:k,Event:P,EventTarget:j,HTMLScriptElement:h,HTMLElement:J,Node:r,document:R,customElements:g},Object.assign(globalThis,{CSS:globalThis.CSS??v,CustomEvent:b,Document:$,Element:k,Event:P,EventTarget:j,HTMLScriptElement:h,HTMLElement:J,Node:r,document:R,customElements:g,window:G}),G}function gg(f,g,R){let P=g.tagName==="script"?new h(R):new J(g.tagName,R);return P.setSerializedFragment(f,Pg(g.innerHtml),g.attributes),P}function Rg(f){return f.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Pg(f){return f.replace(/<!--.*?-->/gs,"").replace(/<[^>]+>/g,"")}function Yf(f,g=B()){return Gf(f).map((R)=>{if(!R.startsWith("<"))return new W(R,g);let P=x(R,0);if(!P||P.type!=="open")return new W(R,g);return gg(R,P,g)})}function U(f){return`data-${f.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function bg(f){return f.replace(/-([a-z])/g,(g,R)=>R.toUpperCase())}function $g(f){let g="";for(let R=0;R<f.length;R+=1){let P=f[R]??"",b=P.codePointAt(0)??0;if(b===0){g+="�";continue}let $=b>=1&&b<=31||b===127,j=R===0&&b>=48&&b<=57,H=R===1&&b>=48&&b<=57&&(f[0]??"")==="-",q=R===0&&P==="-"&&f.length===1;if($||j||H){g+=`\\${b.toString(16)} `;continue}if(b>=128||P==="-"||P==="_"||b>=48&&b<=57||b>=65&&b<=90||b>=97&&b<=122){g+=q?`\\${P}`:P;continue}g+=`\\${P}`}return g}function jg(f){if(f.nodeType===r.TEXT_NODE)return f.textContent??"";return"outerHTML"in f&&typeof f.outerHTML==="string"?f.outerHTML:f.textContent??""}function Hg(f,g="hydrate"){return{kind:"script-module",src:f,stage:g}}function XR(f){return{kind:"modulepreload",href:f}}function xR(f,g){return g?{kind:"style",href:f,media:g}:{kind:"style",href:f}}async function GR(f,g){return(await _(I(f,g))).markup}async function UR(f,g){return _(I(f,g))}async function WR(f,g){return Jg(await _(I(f,g)))}async function hR(f,g){return Bg(await _(I(f,g)))}async function _(f){return Y(s(),async()=>{let g=f.environment??Kf(),R=S(Qg(f.ssrContext));try{let P="component"in f?f.component:await f.load(),b=new P;p(b),qg(g,b,f.authoredContent,f.prepareHost),f.initialize?.(b);let $=f.clientModuleSrc??await f.resolveClientModuleSrc?.(P),j=f.assets??await f.resolveAssets?.(P)??[],H=Xg(j,$),q=xg(H)??$,L=f.tagName??hg(P),K=(f.now??Zg)().toISOString(),M=Gg(f.renderOptions),d=Ff(b,M)??Wg(b,M),Af=rg(b,d);return{markup:d,metadata:{assets:H,clientModuleUrl:q,generatedAt:K,tagName:L},preview:Af}}finally{R()}})}function rg(f,g){return Xf(f,g)??Zf(f)??f.renderHost?.()??{nodeType:1,outerHTML:g}}function qg(f,g,R,P){if(!Ug(g)){if(R===void 0&&P===void 0)return;throw Error(`${g.constructor.name} cannot prepare SSR host content because it does not expose an innerHTML host surface.`)}f.prepareHost(g,{authoredContent:R}),P?.(g,f)}function Qg(f){if(!f||f.length===0)return[];return f.map((g)=>({getContext:()=>g.value,getContextKey:()=>g.context,renderHydrationScript:()=>{return},renderHydrationScriptTag:()=>{return}}))}function Jg(f){if("metadata"in f)return{assets:f.metadata.assets,clientModuleSrc:f.metadata.clientModuleUrl,generatedAt:f.metadata.generatedAt,markup:f.markup,tagName:f.metadata.tagName};let{preview:g,...R}=f;return R}function Bg(f){return{assets:f.metadata.assets,clientModuleSrc:f.metadata.clientModuleUrl,generatedAt:f.metadata.generatedAt,markup:f.markup,preview:f.preview,tagName:f.metadata.tagName}}function Zg(){return new Date}function Fg(f){if(!f)return[];return[Hg(f)]}function Xg(f,g){if(!g)return f;if(f.some((R)=>R.kind==="script-module"&&R.src===g))return f;return[...Fg(g),...f]}function xg(f){return f.find((g)=>g.kind==="script-module")?.src}function I(f,g){if(typeof f==="function")return{...g,component:f};return f}function Gg(f){if(f?.mode!==void 0||f?.hydrate!==void 0)return f;return{...f,mode:"hydrate"}}function Ug(f){return"innerHTML"in f}function Wg(f,g){if(typeof f.renderHostToString==="function")return f.renderHostToString(g);throw Error(`${f.constructor.name} cannot be server-rendered without a registered Radiant SSR host or renderHostToString().`)}function hg(f){let g=A(f);if(!g)throw Error(`${f.name} is missing @customElement metadata.`);return g}export{Jg as toRenderedComponentPayload,xR as styleAsset,Hg as scriptModuleAsset,xg as resolvePrimaryClientModuleSrc,hR as renderComponentWithPreview,GR as renderComponentToString,WR as renderComponentToPayload,UR as renderComponent,Gg as normalizeRenderOptions,XR as modulePreloadAsset,Xg as mergeRenderedComponentAssets};
|
|
2
|
+
|
|
3
|
+
//# debugId=61E6115A35663D9B64756E2164756E21
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/utils/attribute-utils.ts", "../src/core/radiant-element-ssr-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-element-ssr-service.ts", "../src/core/radiant-element-ssr-host.ts", "../src/server/radiant-element-ssr-extractor.ts", "../src/server/radiant-element-ssr-bridge.ts", "../src/server/html-parser.ts", "../src/server/light-dom-shim.ts", "../src/server/render-component.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(instance: T): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyInitializers(\n\t\tinstance,\n\t\tLEGACY_POST_CONSTRUCTION_INITIALIZERS,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<LegacyInstanceInitializer<T>>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(proto: T, key: symbol, initializer: LegacyInstanceInitializer<T>): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(\n\tinstance: T,\n\tkey: symbol,\n\texecutedInitializers?: Set<LegacyInstanceInitializer<T>>,\n\tprototype: object | null = Object.getPrototypeOf(instance),\n): void {\n\tif (!prototype || prototype === Object.prototype) {\n\t\treturn;\n\t}\n\n\trunLegacyInitializers(instance, key, executedInitializers, Object.getPrototypeOf(prototype));\n\n\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as LegacyInstanceInitializer<T>[] | undefined;\n\n\tif (!Array.isArray(initializers)) {\n\t\treturn;\n\t}\n\n\tfor (const initializer of initializers) {\n\t\tif (executedInitializers?.has(initializer)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tinitializer(instance);\n\t\texecutedInitializers?.add(initializer);\n\t}\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
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport { getActiveSsrScopeValue, type RenderToStringOptions, withActiveSsrScopeValue } from '@ecopages/jsx/server';\n\nexport type RadiantElementRenderBridge = {\n\trenderHost?: () => JsxRenderable;\n\trenderHostToString?: (options?: RenderToStringOptions) => string;\n};\n\n/**\n * SSR host shape used by explicit server rendering entrypoints.\n *\n * Server-side attribute serialization is derived from ordinary host state in\n * the server pipeline rather than through a dedicated host SSR hook.\n */\nexport type RadiantElementServerRenderSsrCapable = object;\n\n/**\n * SSR host shape required when the server runtime renders the tracked component\n * view directly.\n */\nexport type RadiantElementTrackedRenderSsrCapable = object;\n\n/**\n * Shared SSR runtime contract carried on the active JSX SSR render scope.\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: RadiantElementServerRenderSsrCapable): Record<string, string>;\n\trenderHost(component: RadiantElementServerRenderSsrCapable): JsxRenderable;\n\trenderHostToString(component: RadiantElementServerRenderSsrCapable, options?: RenderToStringOptions): string;\n\tresolveRenderBridge(component: object): RadiantElementRenderBridge | undefined;\n\trenderView(component: RadiantElementTrackedRenderSsrCapable, options?: RenderToStringOptions): string;\n};\n\nconst RADIANT_ELEMENT_SSR_RUNTIME_SYMBOL = Symbol.for('@ecopages/radiant.element-ssr-runtime');\n\n/**\n * Reads the active Radiant SSR runtime from the current render scope.\n *\n * Returns `undefined` when no server render is currently in progress.\n */\nexport function getRadiantElementSsrRuntime(): RadiantElementSsrRuntime | undefined {\n\treturn getActiveSsrScopeValue<RadiantElementSsrRuntime>(RADIANT_ELEMENT_SSR_RUNTIME_SYMBOL);\n}\n\n/**\n * Runs work within an active Radiant SSR runtime scope.\n *\n * The runtime remains visible across built entrypoint boundaries through the\n * active JSX SSR render scope, but only for the duration of the active render call.\n */\nexport function withRadiantElementSsrRuntime<T>(runtime: RadiantElementSsrRuntime, render: () => T): T {\n\treturn withActiveSsrScopeValue(RADIANT_ELEMENT_SSR_RUNTIME_SYMBOL, runtime, render);\n}\n",
|
|
8
|
+
"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",
|
|
9
|
+
"import type { ReactivePropertyOptions } from './reactive-prop-core';\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",
|
|
10
|
+
"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",
|
|
11
|
+
"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",
|
|
12
|
+
"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 './reactive-prop-core';\nimport type { ReactivePropDefinition } from './reactive-prop-metadata';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\nimport { writeAttributeValue } from '../utils/attribute-utils';\n\nexport type RadiantElementSsrHost = {\n\tconstructor: CustomElementConstructor;\n\tgetAuthoredHydrationScriptMarkup?: () => string | undefined;\n\tgetContextProviders: () => SsrSerializableContextProvider[];\n\tgetHydrationBindings: () => SsrSerializableHydrationBinding[];\n\tgetSlotProjectionScriptTag?: () => string | undefined;\n\trenderViewToString: (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.renderViewToString(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",
|
|
13
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport type {\n\tRadiantElementServerRenderSsrCapable,\n\tRadiantElementTrackedRenderSsrCapable,\n} from './radiant-element-ssr-registry';\nimport type { ReactiveProperty } from './reactive-prop-core';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\n\nexport type RadiantElementSsrHostSource = RadiantElementServerRenderSsrCapable &\n\tRadiantElementTrackedRenderSsrCapable & {\n\t\tconstructor: CustomElementConstructor;\n\t\tgetAttribute(name: string): string | null;\n\t\tgetAttributeNames(): string[];\n\t\tgetAuthoredHydrationScriptMarkup(): string | undefined;\n\t\tgetContextProviders(): SsrSerializableContextProvider[];\n\t\tgetHydrationBindings(): SsrSerializableHydrationBinding[];\n\t\tgetPropertyValue(name: string): unknown;\n\t\tgetReactiveProperties(): ReactiveProperty[];\n\t\tgetSlotProjectionScriptTag(): string | undefined;\n\t\tresolveTrackedRenderOutput(): { containsSlots: boolean; value: JsxRenderable };\n\t\trenderViewToString(options?: RenderToStringOptions): string;\n\t};\n\nexport function resolveRadiantElementSsrHostSource(component: object): RadiantElementSsrHostSource | undefined {\n\tif (isRadiantElementSsrHostSource(component)) {\n\t\treturn component;\n\t}\n\n\treturn undefined;\n}\n\nfunction isRadiantElementSsrHostSource(component: object): component is RadiantElementSsrHostSource {\n\treturn (\n\t\ttypeof component.constructor === 'function' &&\n\t\ttypeof (component as { getAttribute?: unknown }).getAttribute === 'function' &&\n\t\ttypeof (component as { getAuthoredHydrationScriptMarkup?: unknown }).getAuthoredHydrationScriptMarkup ===\n\t\t\t'function' &&\n\t\ttypeof (component as { getContextProviders?: unknown }).getContextProviders === 'function' &&\n\t\ttypeof (component as { getHydrationBindings?: unknown }).getHydrationBindings === 'function' &&\n\t\ttypeof (component as { getReactiveProperties?: unknown }).getReactiveProperties === 'function' &&\n\t\ttypeof (component as { getSlotProjectionScriptTag?: unknown }).getSlotProjectionScriptTag === 'function' &&\n\t\ttypeof (component as { resolveTrackedRenderOutput?: unknown }).resolveTrackedRenderOutput === 'function' &&\n\t\ttypeof (component as { renderViewToString?: unknown }).renderViewToString === 'function'\n\t);\n}\n",
|
|
14
|
+
"import { getReactivePropDefinitions } from '../core/reactive-prop-metadata';\nimport { resolveRadiantElementSsrHostSource } from '../core/radiant-element-ssr-host';\nimport type { RadiantElementServerRenderSsrCapable } from '../core/radiant-element-ssr-registry';\nimport type { RadiantElementSsrHost } from '../core/radiant-element-ssr-service';\n\nexport function extractRadiantElementServerRenderHost(\n\tcomponent: RadiantElementServerRenderSsrCapable,\n): RadiantElementSsrHost {\n\tconst source = resolveRadiantElementSsrHostSource(component);\n\n\tif (!source) {\n\t\tthrow new Error('Radiant SSR runtime requires a server extraction host shape on the component.');\n\t}\n\n\treturn {\n\t\tconstructor: source.constructor,\n\t\tgetAuthoredHydrationScriptMarkup: () => source.getAuthoredHydrationScriptMarkup(),\n\t\tgetContextProviders: () => source.getContextProviders(),\n\t\tgetHydrationBindings: () => source.getHydrationBindings(),\n\t\tgetSlotProjectionScriptTag: () => source.getSlotProjectionScriptTag(),\n\t\trenderViewToString: (options) => source.renderViewToString(options),\n\t\tgetReactiveProperties: () => source.getReactiveProperties(),\n\t\tgetReactivePropDefinitions: () => getReactivePropDefinitions(component),\n\t\tgetPropertyValue: (name) => Reflect.get(component, name),\n\t\tlistAttributeNames: () => source.getAttributeNames(),\n\t\tgetAttributeValue: (name) => source.getAttribute(name),\n\t};\n}\n",
|
|
15
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport { renderToString as renderJsxToString } from '@ecopages/jsx/server';\nimport {\n\tisServerRenderHydrationActive,\n\twithForcedServerCustomElementRendering,\n\twithServerCustomElementRenderHook,\n} from '@ecopages/jsx/server';\nimport { RadiantElementSsrService } from '../core/radiant-element-ssr-service';\nimport { resolveRadiantElementSsrHostSource as resolveInternalRadiantElementSsrHostSource } from '../core/radiant-element-ssr-host';\nimport type {\n\tRadiantElementRenderBridge,\n\tRadiantElementServerRenderSsrCapable,\n\tRadiantElementSsrRuntime,\n\tRadiantElementTrackedRenderSsrCapable,\n} from '../core/radiant-element-ssr-registry';\nimport { withRadiantElementSsrRuntime } from '../core/radiant-element-ssr-registry';\nimport { extractRadiantElementServerRenderHost } from './radiant-element-ssr-extractor';\n\nlet radiantElementSsrRuntime: RadiantElementSsrRuntime | undefined;\n\nexport function createRadiantElementSsrService(\n\tcomponent: RadiantElementServerRenderSsrCapable,\n): RadiantElementSsrService {\n\treturn new RadiantElementSsrService(extractRadiantElementServerRenderHost(component));\n}\n\nexport function renderRadiantElementHost(component: RadiantElementServerRenderSsrCapable): JsxRenderable {\n\treturn {\n\t\tnodeType: 1,\n\t\touterHTML: renderRadiantElementHostToString(component, { mode: 'hydrate' }),\n\t};\n}\n\nexport function renderRegisteredRadiantElementHost(component: unknown): JsxRenderable | undefined {\n\tif (isRadiantElementServerRenderable(component)) {\n\t\treturn renderRadiantElementHost(component);\n\t}\n\n\tif (!isLegacyServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn component.renderHost?.() ?? { nodeType: 1, outerHTML: component.renderHostToString({ mode: 'hydrate' }) };\n}\n\nexport function renderRadiantElementHostToString(\n\tcomponent: RadiantElementServerRenderSsrCapable,\n\toptions: RenderToStringOptions = {},\n): string {\n\treturn withServerRadiantElementSsrRuntime(() =>\n\t\tcreateRadiantElementSsrService(component).renderHostToString(\n\t\t\toptions,\n\t\t\tgetRadiantElementHostSsrAttributes(component),\n\t\t),\n\t);\n}\n\nexport function renderRegisteredRadiantElementHostToString(\n\tcomponent: unknown,\n\toptions: RenderToStringOptions = {},\n): string | undefined {\n\tif (isRadiantElementServerRenderable(component)) {\n\t\treturn renderRadiantElementHostToString(component, options);\n\t}\n\n\tif (!isLegacyServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn component.renderHostToString(options);\n}\n\nexport function resolveRegisteredRadiantElementPreview(component: unknown, markup: string): JsxRenderable | undefined {\n\tif (isRadiantElementServerRenderable(component)) {\n\t\treturn renderRadiantElementHost(component);\n\t}\n\n\tif (!isLegacyServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn component.renderHost?.() ?? { nodeType: 1, outerHTML: markup };\n}\n\nexport function renderRadiantElementViewToString(\n\tcomponent: RadiantElementTrackedRenderSsrCapable,\n\toptions: RenderToStringOptions = {},\n): string {\n\treturn withServerRadiantElementSsrRuntime(() =>\n\t\twithRadiantServerCustomElementRenderBridge(() =>\n\t\t\trenderJsxToString(getRadiantElementTrackedRenderOutput(component).value, options),\n\t\t),\n\t);\n}\n\nexport function getRadiantElementHostSsrAttributes(\n\tcomponent: RadiantElementServerRenderSsrCapable,\n): Record<string, string> {\n\treturn createRadiantElementSsrService(component).getHostAttributes();\n}\n\nexport function resolveRadiantElementRenderBridge(component: object): RadiantElementRenderBridge | undefined {\n\tif (!isRadiantElementServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\trenderHost: () => renderRadiantElementHost(component),\n\t\trenderHostToString: (options) => renderRadiantElementHostToString(component, options),\n\t};\n}\n\nexport function resolveRadiantElementSsrHostBridge(component: object): object | undefined {\n\treturn resolveInternalRadiantElementSsrHostSource(component);\n}\n\nexport function withRadiantServerCustomElementRenderBridge<T>(render: () => T): T {\n\treturn withForcedServerCustomElementRendering(() =>\n\t\twithServerCustomElementRenderHook(({ instance }) => {\n\t\t\tif (isRadiantElementServerRenderable(instance)) {\n\t\t\t\treturn {\n\t\t\t\t\tnodeType: 1,\n\t\t\t\t\tget outerHTML() {\n\t\t\t\t\t\tconst hydrate = isServerRenderHydrationActive();\n\t\t\t\t\t\tconst options: RenderToStringOptions = { hydrate, mode: hydrate ? 'hydrate' : 'plain' };\n\n\t\t\t\t\t\treturn renderRadiantElementHostToString(instance, options);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (!isLegacyServerRenderable(instance)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst legacyInstance: { renderHostToString(options?: RenderToStringOptions): string } = instance;\n\n\t\t\treturn {\n\t\t\t\tnodeType: 1,\n\t\t\t\tget outerHTML() {\n\t\t\t\t\tconst hydrate = isServerRenderHydrationActive();\n\t\t\t\t\treturn legacyInstance.renderHostToString({ hydrate, mode: hydrate ? 'hydrate' : 'plain' });\n\t\t\t\t},\n\t\t\t};\n\t\t}, render),\n\t);\n}\n\nexport function getRadiantElementTrackedRenderOutput(component: RadiantElementTrackedRenderSsrCapable): {\n\tcontainsSlots: boolean;\n\tvalue: JsxRenderable;\n} {\n\tif (hasTrackedRenderOutput(component)) {\n\t\treturn component.resolveTrackedRenderOutput();\n\t}\n\n\tconst source = resolveInternalRadiantElementSsrHostSource(component);\n\n\tif (!source) {\n\t\tthrow new Error('Radiant SSR runtime requires tracked render output support on the component.');\n\t}\n\n\treturn source.resolveTrackedRenderOutput();\n}\n\nfunction isRadiantElementServerRenderable(component: unknown): component is RadiantElementServerRenderSsrCapable {\n\tif (typeof component !== 'object' || component === null) {\n\t\treturn false;\n\t}\n\n\treturn resolveInternalRadiantElementSsrHostSource(component) !== undefined;\n}\n\nfunction isLegacyServerRenderable(component: unknown): component is {\n\trenderHost?: () => JsxRenderable;\n\trenderHostToString(options?: RenderToStringOptions): string;\n} {\n\tif (typeof component !== 'object' || component === null) {\n\t\treturn false;\n\t}\n\n\treturn typeof (component as { renderHostToString?: unknown }).renderHostToString === 'function';\n}\n\nfunction hasTrackedRenderOutput(component: unknown): component is {\n\tresolveTrackedRenderOutput(): { containsSlots: boolean; value: JsxRenderable };\n} {\n\tif (typeof component !== 'object' || component === null) {\n\t\treturn false;\n\t}\n\n\treturn typeof (component as { resolveTrackedRenderOutput?: unknown }).resolveTrackedRenderOutput === 'function';\n}\n\nexport function getOrCreateRadiantElementSsrRuntime(): RadiantElementSsrRuntime {\n\tif (radiantElementSsrRuntime) {\n\t\treturn radiantElementSsrRuntime;\n\t}\n\n\tradiantElementSsrRuntime = {\n\t\tgetHostAttributes: getRadiantElementHostSsrAttributes,\n\t\trenderHost: renderRadiantElementHost,\n\t\trenderHostToString: renderRadiantElementHostToString,\n\t\tresolveRenderBridge: resolveRadiantElementRenderBridge,\n\t\trenderView: renderRadiantElementViewToString,\n\t};\n\n\treturn radiantElementSsrRuntime;\n}\n\nexport function withServerRadiantElementSsrRuntime<T>(render: () => T): T {\n\treturn withRadiantElementSsrRuntime(getOrCreateRadiantElementSsrRuntime(), render);\n}\n",
|
|
16
|
+
"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",
|
|
17
|
+
"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(\n\t\tpublic readonly nodeType: number,\n\t\townerDocument: Document | null = null,\n\t) {\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(\n\t\tprivate value: string,\n\t\townerDocument: Document | null = getInstalledDocumentLike(),\n\t) {\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 && codePoint >= 0x0030 && codePoint <= 0x0039 && (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",
|
|
18
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { withSsrContextProviders } from './context-ssr';\nimport type { ContextType, UnknownContext } from '../context/types';\nimport { getCustomElementTagName } from '../core/custom-element-metadata';\nimport { runLegacyPostConstructionInitializers } from '../decorators/legacy/instance-initializers';\nimport { createServerRenderEnvironment, type ServerRenderEnvironment } from './light-dom-shim';\nimport {\n\tresolveRegisteredRadiantElementPreview,\n\trenderRegisteredRadiantElementHost,\n\trenderRegisteredRadiantElementHostToString,\n} from './radiant-element-ssr-bridge';\nimport { withRadiantElementSsrRuntime } from '../core/radiant-element-ssr-registry';\nimport { getOrCreateRadiantElementSsrRuntime } from './radiant-element-ssr-runtime';\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 = object & {\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\treturn withRadiantElementSsrRuntime(getOrCreateRadiantElementSsrRuntime(), async () => {\n\t\tconst environment = normalizedOptions.environment ?? createServerRenderEnvironment();\n\t\tconst restoreAmbientContext = withSsrContextProviders(\n\t\t\tcreateAmbientSsrContextProviders(normalizedOptions.ssrContext),\n\t\t);\n\n\t\ttry {\n\t\t\tconst Component =\n\t\t\t\t'component' in normalizedOptions ? normalizedOptions.component : await normalizedOptions.load();\n\t\t\tconst component = new Component();\n\t\t\trunLegacyPostConstructionInitializers(component);\n\t\t\tprepareRenderedComponentHost(\n\t\t\t\tenvironment,\n\t\t\t\tcomponent,\n\t\t\t\tnormalizedOptions.authoredContent,\n\t\t\t\tnormalizedOptions.prepareHost,\n\t\t\t);\n\t\t\tnormalizedOptions.initialize?.(component);\n\n\t\t\tconst resolvedClientModuleSrc =\n\t\t\t\tnormalizedOptions.clientModuleSrc ?? (await normalizedOptions.resolveClientModuleSrc?.(Component));\n\t\t\tconst resolvedAssets =\n\t\t\t\tnormalizedOptions.assets ?? (await normalizedOptions.resolveAssets?.(Component)) ?? [];\n\t\t\tconst assets = mergeRenderedComponentAssets(resolvedAssets, resolvedClientModuleSrc);\n\t\t\tconst clientModuleSrc = resolvePrimaryClientModuleSrc(assets) ?? resolvedClientModuleSrc;\n\t\t\tconst tagName = normalizedOptions.tagName ?? resolveRenderedComponentTagName(Component);\n\t\t\tconst generatedAt = (normalizedOptions.now ?? createDefaultRenderTimestamp)().toISOString();\n\t\t\tconst renderOptions = normalizeRenderOptions(normalizedOptions.renderOptions);\n\t\t\tconst markup =\n\t\t\t\trenderRegisteredRadiantElementHostToString(component, renderOptions) ??\n\t\t\t\trequireServerRenderableMarkup(component, renderOptions);\n\t\t\tconst preview = resolveRenderedComponentPreview(component, markup);\n\n\t\t\treturn {\n\t\t\t\tmarkup,\n\t\t\t\tmetadata: {\n\t\t\t\t\tassets,\n\t\t\t\t\tclientModuleUrl: clientModuleSrc,\n\t\t\t\t\tgeneratedAt,\n\t\t\t\t\ttagName,\n\t\t\t\t},\n\t\t\t\tpreview,\n\t\t\t};\n\t\t} finally {\n\t\t\trestoreAmbientContext();\n\t\t}\n\t});\n}\n\n/**\n * Chooses the preview renderable returned by `renderComponent()`.\n *\n * Falls back to the serialized host markup when a generic server-renderable\n * component does not expose a JSX preview surface.\n */\nfunction resolveRenderedComponentPreview<TComponent extends ServerRenderableComponent>(\n\tcomponent: TComponent,\n\tmarkup: string,\n): JsxRenderable {\n\treturn (\n\t\tresolveRegisteredRadiantElementPreview(component, markup) ??\n\t\trenderRegisteredRadiantElementHost(component) ??\n\t\tcomponent.renderHost?.() ?? { nodeType: 1, outerHTML: markup }\n\t);\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 requireServerRenderableMarkup<TComponent extends ServerRenderableComponent>(\n\tcomponent: TComponent,\n\toptions: RenderToStringOptions,\n): string {\n\tif (typeof component.renderHostToString === 'function') {\n\t\treturn component.renderHostToString(options);\n\t}\n\n\tthrow new Error(\n\t\t`${component.constructor.name} cannot be server-rendered without a registered Radiant SSR host or renderHostToString().`,\n\t);\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"
|
|
19
|
+
],
|
|
20
|
+
"mappings": "4PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,GAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,EAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,EAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,EAA+C,CAAC,EAAmB,CAClF,EAAsB,EAAU,CAA4B,EAUtD,SAAS,CAAuD,CAAC,EAAmB,CAC1F,IAAM,EAAS,EAEf,EACC,EACA,EACC,EAAO,MAAoD,IAAI,GACjE,EAGD,SAAS,CAAqC,CAAC,EAAU,EAAa,EAAiD,CACtH,IAAM,EAAS,EACT,EAAkB,OAAO,UAAU,eAAe,KAAK,EAAQ,CAAG,EAAI,EAAO,GAAO,OAE1F,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAQ,EAAK,CAClC,MAAO,CAAC,CAAW,CACpB,CAAC,EAGF,SAAS,CAAuC,CAC/C,EACA,EACA,EACA,EAA2B,OAAO,eAAe,CAAQ,EAClD,CACP,GAAI,CAAC,GAAa,IAAc,OAAO,UACtC,OAGD,EAAsB,EAAU,EAAK,EAAsB,OAAO,eAAe,CAAS,CAAC,EAE3F,IAAM,EAAgB,EAA2C,GAEjE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,OAGD,QAAW,KAAe,EAAc,CACvC,GAAI,GAAsB,IAAI,CAAW,EACxC,SAGD,EAAY,CAAQ,EACpB,GAAsB,IAAI,CA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AAkB,CAAe,CAAC,EAGpC,SAAS,EAA4B,CAC3C,EACA,EACoC,CACpC,GAAI,CAAC,EACJ,OAAO,EAGR,GAAI,EAAO,KAAK,CAAC,IAAU,EAAM,OAAS,iBAAmB,EAAM,MAAQ,CAAe,EACzF,OAAO,EAGR,MAAO,CAAC,GAAG,GAA0C,CAAe,EAAG,GAAG,CAAM,EAG1E,SAAS,EAA6B,CAAC,EAA+D,CAC5G,OAAO,EAAO,KAAK,CAAC,IAAU,EAAM,OAAS,eAAe,GAAG,IAGhE,SAAS,CAA6E,CACrF,EACA,EACqC,CACrC,GAAI,OAAO,IAAuB,WACjC,MAAO,IACH,EACH,UAAW,CACZ,EAGD,OAAO,EAGD,SAAS,EAAsB,CAAC,EAAmE,CACzG,GAAI,GAAS,OAAS,QAAa,GAAS,UAAY,OACvD,OAAO,EAGR,MAAO,IACH,EACH,KAAM,SACP,EAGD,SAAS,EAA+D,CACvE,EACwC,CACxC,MAAO,cAAe,EAGvB,SAAS,EAA2E,CACnF,EACA,EACS,CACT,GAAI,OAAO,EAAU,qBAAuB,WAC3C,OAAO,EAAU,mBAAmB,CAAO,EAG5C,MAAU,MACT,GAAG,EAAU,YAAY,+FAC1B,EAGD,SAAS,EAA+B,CAAC,EAA0C,CAClF,IAAM,EAAU,EAAwB,CAAM,EAE9C,GAAI,CAAC,EACJ,MAAU,MAAM,GAAG,EAAO,0CAA0C,EAGrE,OAAO",
|
|
21
|
+
"debugId": "61E6115A35663D9B64756E2164756E21",
|
|
22
|
+
"names": []
|
|
23
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type RenderToStringOptions } from '@ecopages/jsx/server';
|
|
2
|
+
import type { RadiantController } from '../core/radiant-controller';
|
|
3
|
+
import { type RenderedComponent, type RenderedComponentAsset, type RenderedComponentPayload, type RenderedComponentWithPreview } from './render-component';
|
|
4
|
+
/** Constructor shape for a server-renderable controller. */
|
|
5
|
+
export type ServerRenderableControllerConstructor<TController extends RadiantController = RadiantController> = new (host: Element) => TController;
|
|
6
|
+
/** Serializable controller host attribute values accepted by `renderController()`. */
|
|
7
|
+
export type RenderedControllerHostAttributeValue = boolean | number | string | null | undefined;
|
|
8
|
+
/** JSX-like class value accepted by `renderController({ host })`. */
|
|
9
|
+
export type RenderedControllerHostClassValue = bigint | boolean | number | string | null | undefined | readonly RenderedControllerHostClassValue[] | Record<string, unknown>;
|
|
10
|
+
/** Declarative controller host attributes accepted by `renderController()`. */
|
|
11
|
+
export type RenderedControllerHostAttributes = Record<string, RenderedControllerHostAttributeValue>;
|
|
12
|
+
/** JSX-like host options accepted by `renderController()`. */
|
|
13
|
+
export type RenderedControllerHostOptions = {
|
|
14
|
+
aria?: Record<string, RenderedControllerHostAttributeValue>;
|
|
15
|
+
class?: RenderedControllerHostClassValue;
|
|
16
|
+
classes?: RenderedControllerHostClassValue;
|
|
17
|
+
data?: Record<string, RenderedControllerHostAttributeValue>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the browser-importable client module URL for a controller constructor.
|
|
21
|
+
*/
|
|
22
|
+
export type ResolveRenderedControllerClientModule<TController extends RadiantController> = (controller: ServerRenderableControllerConstructor<TController>) => string | undefined | Promise<string | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves fragment assets for a controller constructor.
|
|
25
|
+
*/
|
|
26
|
+
export type ResolveRenderedControllerAssets<TController extends RadiantController> = (controller: ServerRenderableControllerConstructor<TController>) => readonly RenderedComponentAsset[] | undefined | Promise<readonly RenderedComponentAsset[] | undefined>;
|
|
27
|
+
/** Call-site options used by the controller SSR helpers. */
|
|
28
|
+
export type RenderControllerCallOptions<TController extends RadiantController> = {
|
|
29
|
+
/** Asset dependencies required by the rendered fragment. */
|
|
30
|
+
assets?: readonly RenderedComponentAsset[];
|
|
31
|
+
/** Low-level flat host attributes serialized onto the rendered controller host. */
|
|
32
|
+
attributes?: RenderedControllerHostAttributes;
|
|
33
|
+
/** JSX-like host config with `data` and `aria` object expansion. */
|
|
34
|
+
host?: RenderedControllerHostOptions;
|
|
35
|
+
/** Browser-importable client module URL used to register the controller before hydration. */
|
|
36
|
+
clientModuleSrc?: string;
|
|
37
|
+
/** Initializes the controller instance before render. */
|
|
38
|
+
initialize?: (controller: TController) => void;
|
|
39
|
+
/** Clock override used by tests and adapters that need deterministic timestamps. */
|
|
40
|
+
now?: () => Date;
|
|
41
|
+
/** JSX server-renderer options forwarded to the controller view render. */
|
|
42
|
+
renderOptions?: RenderToStringOptions;
|
|
43
|
+
/** Lazy asset resolver used when `assets` are not provided directly. */
|
|
44
|
+
resolveAssets?: ResolveRenderedControllerAssets<TController>;
|
|
45
|
+
/** Lazy client-module resolver used when `clientModuleSrc` is not provided directly. */
|
|
46
|
+
resolveClientModuleSrc?: ResolveRenderedControllerClientModule<TController>;
|
|
47
|
+
/** Explicit host tag emitted at the fragment root. */
|
|
48
|
+
tagName: string;
|
|
49
|
+
};
|
|
50
|
+
/** Serializes a controller host into HTML using an explicit host tag and attributes. */
|
|
51
|
+
export declare function renderControllerToString<TController extends RadiantController>(controller: ServerRenderableControllerConstructor<TController>, options: RenderControllerCallOptions<TController>): Promise<string>;
|
|
52
|
+
/** Renders a controller host into the canonical portable server-rendered shape. */
|
|
53
|
+
export declare function renderController<TController extends RadiantController>(controller: ServerRenderableControllerConstructor<TController>, options: RenderControllerCallOptions<TController>): Promise<RenderedComponent>;
|
|
54
|
+
/** Serializes a controller host into a fragment payload that frameworks can attach to any response shape. */
|
|
55
|
+
export declare function renderControllerToPayload<TController extends RadiantController>(controller: ServerRenderableControllerConstructor<TController>, options: RenderControllerCallOptions<TController>): Promise<RenderedComponentPayload>;
|
|
56
|
+
/** Renders a controller host into payload fields plus a JSX-compatible preview value. */
|
|
57
|
+
export declare function renderControllerWithPreview<TController extends RadiantController>(controller: ServerRenderableControllerConstructor<TController>, options: RenderControllerCallOptions<TController>): Promise<RenderedComponentWithPreview>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var iR=((R)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(R,{get:(P,g)=>(typeof require<"u"?require:P)[g]}):R)(function(R){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+R+'" is not supported')});var $R=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),jR=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),mR=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function eP(R,P){HR(R,$R,P)}function Rg(R,P){HR(R,jR,P)}function Pg(R){c(R,$R)}function C(R){let P=R;c(R,jR,P[mR]??=new Set)}function HR(R,P,g){let f=R,$=Object.prototype.hasOwnProperty.call(f,P)?f[P]:void 0;if(Array.isArray($)){$.push(g);return}Object.defineProperty(f,P,{value:[g]})}function c(R,P,g,f=Object.getPrototypeOf(R)){if(!f||f===Object.prototype)return;c(R,P,g,Object.getPrototypeOf(f));let $=f[P];if(!Array.isArray($))return;for(let j of $){if(g?.has(j))continue;j(R),g?.add(j)}}function BR(R){switch(R){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function aR(R){switch(typeof R){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(R))return"array";if(Object.prototype.toString.call(R)==="[object Object]")return"object"}function lR(R){switch(R){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function tR(R){try{return JSON.parse(R)}catch{throw TypeError("Invalid JSON string")}}var nR={array(R){let P=tR(R);if(!Array.isArray(P))throw TypeError(`Expected an array but got a value of type "${typeof P}"`);return P},boolean(R){return!(R==="0"||String(R).toLowerCase()==="false")},number(R){return Number(R.replace(/_/g,""))},object(R){let P=JSON.parse(R);if(P===null||typeof P!=="object"||Array.isArray(P))throw TypeError(`expected value of type "object" but instead got value "${R}" of type "${aR(P)}"`);return P},string(R){return R}},qR={default:FR,array:QR,object:QR};function QR(R){return JSON.stringify(R)}function FR(R){return`${R}`}function JR(R,P){let g=BR(P);if(!g)throw TypeError(`[radiant-element] Unknown type "${P}"`);return nR[g](R)}function bR(R,P){let g=BR(P);if(!g)throw TypeError(`[radiant-element] Unknown type "${P}"`);return(qR[g]??qR.default??FR)(R)}function oR(R){return typeof R==="boolean"}function eR(R){return typeof R==="number"}function RP(R){return typeof R==="string"}function PP(R){return Array.isArray(R)}function gP(R){return typeof R==="object"&&!Array.isArray(R)&&R!==null}function fg(R,P){switch(R){case Boolean:return oR(P);case Number:return eR(P);case String:return RP(P);case Array:return PP(P);case Object:return gP(P);default:return!1}}var $g=(R,P,g,f)=>{if(P===Boolean){let j=R.getAttribute(g);if(j===null)return f;return j===""?!0:JR(j,P)}let $=R.getAttribute(g);return $!==null?JR($,P):f??lR(P)};import{getActiveSsrScopeValue as fP,withActiveSsrScopeValue as $P}from"@ecopages/jsx/server";var ZR=Symbol.for("@ecopages/radiant.element-ssr-runtime");function qg(){return fP(ZR)}function Z(R,P){return $P(ZR,R,P)}var WR=Symbol.for("@ecopages/radiant.controllerIdentifier");function p(R,P){R[WR]=P}function XR(R){return R[WR]}var B="data-controller",GR=Symbol.for("@ecopages/radiant.controller-registry-state");function jP(){let R=globalThis,P=R[GR];if(P)return P;let g={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return R[GR]=g,g}var k=jP(),F=k.controllerRegistry,W=k.activeRuntimes;function UR(R){let P=R.getAttribute(B);if(!P)return[];return P.split(/\s+/).map((g)=>g.trim()).filter((g)=>g.length>0)}function I(R,P){if(R instanceof Element&&R.hasAttribute(B))P(R);for(let g of Array.from(R.querySelectorAll(`[${B}]`)))P(g)}class KR{root;controllersByElement=new Map;observer;stopped=!1;constructor(R=document){this.root=R;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[R,P]of this.controllersByElement)for(let[g]of P)this.disconnectController(R,g);W.delete(this)}reconcileRegisteredController(R){I(this.root,(P)=>{if(!UR(P).includes(R))return;this.connectController(P,R)})}replaceRegisteredController(R){for(let[P,g]of Array.from(this.controllersByElement.entries())){if(!g.has(R))continue;this.disconnectController(P,R)}this.reconcileRegisteredController(R)}start(){if(I(this.root,(P)=>{this.reconcileElement(P)}),typeof MutationObserver>"u"){W.add(this);return}this.observer=new MutationObserver((P)=>{for(let g of P){if(g.type==="attributes"&&g.target instanceof Element){this.reconcileElement(g.target);continue}for(let f of Array.from(g.removedNodes)){if(!(f instanceof Element))continue;I(f,($)=>{this.disconnectElementControllers($)})}for(let f of Array.from(g.addedNodes)){if(!(f instanceof Element))continue;I(f,($)=>{this.reconcileElement($)})}}});let R=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(R,{attributeFilter:[B],attributes:!0,childList:!0,subtree:!0}),W.add(this)}reconcileElement(R){let P=new Set(UR(R)),g=this.controllersByElement.get(R);if(g){for(let f of g.keys())if(!P.has(f))this.disconnectController(R,f)}for(let f of P)this.connectController(R,f)}connectController(R,P){let g=F.get(P);if(!g)return;let f=this.controllersByElement.get(R);if(!f)f=new Map,this.controllersByElement.set(R,f);if(f.has(P))return;let $=new g(R);f.set(P,$),$.connect()}disconnectController(R,P){let g=this.controllersByElement.get(R);if(!g)return;let f=g.get(P);if(!f)return;if(f.disconnect(),g.delete(P),g.size===0)this.controllersByElement.delete(R)}disconnectElementControllers(R){let P=this.controllersByElement.get(R);if(!P)return;for(let g of Array.from(P.keys()))this.disconnectController(R,g)}}function HP(R,P){let g=F.get(R);if(g)return g;p(P,R),F.set(R,P);for(let f of Array.from(W))f.reconcileRegisteredController(R);return P}function Fg(R){return F.has(R)}function bg(R){return F.get(R)}function qP(R,P){if(F.get(R)===P)return P;p(P,R),F.set(R,P);for(let f of Array.from(W))f.replaceRegisteredController(R);return P}function YR(R){k.controllerRegistrationStrategy=R}function Zg(){YR("replace")}function Wg(){YR("keep-current")}function Xg(R,P){if(k.controllerRegistrationStrategy==="replace")return qP(R,P);return HP(R,P)}function Gg(R=document){return new KR(R)}function Ug(){for(let R of Array.from(W))R.stop()}var xR=Symbol.for("@ecopages/radiant.customElementTagName");function Yg(R,P){R[xR]=P}function D(R){return R[xR]}var r=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function wg(R,P,g){let f=R.constructor,$=f[r]??[];if($.some((j)=>j.name===P))return;$.push({name:P,options:g}),f[r]=$}function wR(R){return(R.constructor[r]??[]).slice()}var hR=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function AR(){return globalThis}function yR(R){AR()[hR]=R}function Ag(R){return AR()[hR]?.(R)}var h;function SR(){if(h!==void 0)return h;try{let{AsyncLocalStorage:R}=(()=>{throw new Error("Cannot require module "+"node:async_hooks");})();return h=new R,h}catch{return h=null,null}}var VR=Symbol.for("@ecopages/radiant.ssr-context-fallback-stack");function TR(){let R=globalThis;return R[VR]??=[],R[VR]}function X(R){if(R.length===0)return()=>{return};let P=new Map;for(let $ of R)P.set($.getContextKey(),$);let g=SR();if(g){let $=g.getStore()??[],j=[...$,P];return g.enterWith(j),()=>{g.enterWith($)}}let f=TR();return f.push(P),()=>{let $=f.lastIndexOf(P);if($>=0)f.splice($,1)}}function _R(R){let P=SR()?.getStore()??TR();for(let g=P.length-1;g>=0;g-=1){let f=P[g]?.get(R);if(f)return f}return}function Sg(R){let P=_R(R);if(!P)return;return P.getContext()}yR((R)=>_R(R));class i{host;constructor(R){this.host=R}renderHost(){return{nodeType:1,outerHTML:this.renderHostToString({mode:"hydrate"})}}renderHostToString(R={},P=this.getHostAttributes()){let g=this.getTagName(),f=X(this.host.getContextProviders());try{return`<${g}${QP(P)}>${this.renderHostContent(R)}</${g}>`}finally{f()}}renderHostContent(R){let P=this.host.renderViewToString(R),g=this.host.getAuthoredHydrationScriptMarkup?.()??"",f=this.host.getSlotProjectionScriptTag?.()??"";if(!(R.mode==="hydrate"||R.mode===void 0&&R.hydrate===!0))return`${P}${g}${f}`;let j=this.host.getHydrationBindings().map((H)=>H.renderHydrationScriptTag()).filter((H)=>typeof H==="string").join("");return`${P}${f}${j}`}getHostAttributes(){let R={},P=new Set;for(let g of this.host.getReactiveProperties()){let f=this.host.getPropertyValue(g.name);if(f===void 0||f===null||f===!1)continue;R[g.attribute]=String(g.converter.toAttribute(f)),P.add(g.attribute)}for(let g of this.host.getReactivePropDefinitions()){let f=g.options.attribute??g.name;if(P.has(f))continue;let $=this.host.getPropertyValue(g.name);if($===void 0||$===null||$===!1)continue;R[f]=String(bR($,g.options.type)),P.add(f)}for(let g of this.host.listAttributeNames()){let f=this.host.getAttributeValue(g);if(f!==null)R[g]=f}return R}getTagName(){let R=D(this.host.constructor);if(!R)throw Error(`${this.host.constructor.name} is missing @customElement metadata.`);return R}}function QP(R){return Object.entries(R).map(([P,g])=>` ${P}="${JP(g)}"`).join("")}function JP(R){return R.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function G(R){if(BP(R))return R;return}function BP(R){return typeof R.constructor==="function"&&typeof R.getAttribute==="function"&&typeof R.getAuthoredHydrationScriptMarkup==="function"&&typeof R.getContextProviders==="function"&&typeof R.getHydrationBindings==="function"&&typeof R.getReactiveProperties==="function"&&typeof R.getSlotProjectionScriptTag==="function"&&typeof R.resolveTrackedRenderOutput==="function"&&typeof R.renderViewToString==="function"}function LR(R){let P=G(R);if(!P)throw Error("Radiant SSR runtime requires a server extraction host shape on the component.");return{constructor:P.constructor,getAuthoredHydrationScriptMarkup:()=>P.getAuthoredHydrationScriptMarkup(),getContextProviders:()=>P.getContextProviders(),getHydrationBindings:()=>P.getHydrationBindings(),getSlotProjectionScriptTag:()=>P.getSlotProjectionScriptTag(),renderViewToString:(g)=>P.renderViewToString(g),getReactiveProperties:()=>P.getReactiveProperties(),getReactivePropDefinitions:()=>wR(R),getPropertyValue:(g)=>Reflect.get(R,g),listAttributeNames:()=>P.getAttributeNames(),getAttributeValue:(g)=>P.getAttribute(g)}}import{renderToString as FP}from"@ecopages/jsx/server";import{isServerRenderHydrationActive as CR,withForcedServerCustomElementRendering as bP,withServerCustomElementRenderHook as ZP}from"@ecopages/jsx/server";var E;function IR(R){return new i(LR(R))}function z(R){return{nodeType:1,outerHTML:A(R,{mode:"hydrate"})}}function kR(R){if(y(R))return z(R);if(!O(R))return;return R.renderHost?.()??{nodeType:1,outerHTML:R.renderHostToString({mode:"hydrate"})}}function A(R,P={}){return a(()=>IR(R).renderHostToString(P,zR(R)))}function DR(R,P={}){if(y(R))return A(R,P);if(!O(R))return;return R.renderHostToString(P)}function ER(R,P){if(y(R))return z(R);if(!O(R))return;return R.renderHost?.()??{nodeType:1,outerHTML:P}}function WP(R,P={}){return a(()=>m(()=>FP(GP(R).value,P)))}function zR(R){return IR(R).getHostAttributes()}function XP(R){if(!y(R))return;return{renderHost:()=>z(R),renderHostToString:(P)=>A(R,P)}}function dg(R){return G(R)}function m(R){return bP(()=>ZP(({instance:P})=>{if(y(P))return{nodeType:1,get outerHTML(){let f=CR();return A(P,{hydrate:f,mode:f?"hydrate":"plain"})}};if(!O(P))return;let g=P;return{nodeType:1,get outerHTML(){let f=CR();return g.renderHostToString({hydrate:f,mode:f?"hydrate":"plain"})}}},R))}function GP(R){if(UP(R))return R.resolveTrackedRenderOutput();let P=G(R);if(!P)throw Error("Radiant SSR runtime requires tracked render output support on the component.");return P.resolveTrackedRenderOutput()}function y(R){if(typeof R!=="object"||R===null)return!1;return G(R)!==void 0}function O(R){if(typeof R!=="object"||R===null)return!1;return typeof R.renderHostToString==="function"}function UP(R){if(typeof R!=="object"||R===null)return!1;return typeof R.resolveTrackedRenderOutput==="function"}function U(){if(E)return E;return E={getHostAttributes:zR,renderHost:z,renderHostToString:A,resolveRenderBridge:XP,renderView:WP},E}function a(R){return Z(U(),R)}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function OR(R){let P=[],g=0;while(g<R.length){let f=g;if(R.startsWith("<!--",g)){let H=R.indexOf("-->",g+4);g=H===-1?R.length:H+3,P.push(R.slice(f,g));continue}if(R[g]!=="<"){let H=R.indexOf("<",g);g=H===-1?R.length:H,P.push(R.slice(f,g));continue}let $=V(R,g);if(!$){P.push(R.slice(f));break}if($.type!=="open"||$.selfClosing||N.has($.tagName)){g=$.end,P.push(R.slice(f,g));continue}g=$.end;let j=1;while(g<R.length&&j>0){let H=R.indexOf("<",g);if(H===-1){g=R.length;break}let q=V(R,H);if(!q){g=R.length;break}if(g=q.end,q.type==="comment"||q.type==="declaration")continue;if(q.type==="open"&&!q.selfClosing&&!N.has(q.tagName)){j+=1;continue}if(q.type==="close")j-=1}P.push(R.slice(f,g))}return P.filter((f)=>f!=="")}function KP(R,P){let g;for(let f=P+1;f<R.length;f+=1){let $=R[f];if(g){if($===g)g=void 0;continue}if($==='"'||$==="'"){g=$;continue}if($===">")return f+1}return R.length}function YP(R){let P={},g=/([:^@A-Za-z0-9_.-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;for(let f of R.matchAll(g)){let[,$,j,H,q]=f;if(!$)continue;P[$]=j??H??q??""}return P}function V(R,P){if(R.startsWith("<!--",P)){let b=R.indexOf("-->",P+4);return{end:b===-1?R.length:b+3,type:"comment"}}let g=KP(R,P),f=R.slice(P+1,g-1).trim();if(f==="")return;if(f.startsWith("!")||f.startsWith("?"))return{end:g,type:"declaration"};if(f.startsWith("/"))return{end:g,type:"close"};let $=/\/\s*$/.test(f),j=$?f.replace(/\/\s*$/,"").trim():f,H=j.split(/[\s/>]/,1)[0]?.toLowerCase()??"",q=H.length,J=j.slice(q).trim(),x=$||N.has(H)?"":xP(R,P,g,H);return{attributes:YP(J),end:g,innerHtml:x,selfClosing:$,tagName:H,type:"open"}}function xP(R,P,g,f){let $=g,j=1;while($<R.length&&j>0){let H=R.indexOf("<",$);if(H===-1)return R.slice(g);let q=V(R,H);if(!q)return R.slice(g);if(q.type==="open"&&q.tagName===f&&!q.selfClosing&&!N.has(f))j+=1;if(q.type==="close"){if(R.slice(H+2,q.end-1).trim().toLowerCase()===f){if(j-=1,j===0)return R.slice(g,H)}}$=q.end}return R.slice(g)}class Q extends EventTarget{nodeType;static DOCUMENT_NODE=9;static ELEMENT_NODE=1;static TEXT_NODE=3;childNodes=[];ownerDocument;parentNode=null;constructor(R,P=null){super();this.nodeType=R;this.ownerDocument=P}append(...R){for(let P of R)this.appendChild(typeof P==="string"?wP(P):P)}appendChild(R){if("parentNode"in R&&R.parentNode&&"removeChild"in R.parentNode)R.parentNode.removeChild(R);return this.childNodes.push(R),R.ownerDocument=this.nodeType===Q.DOCUMENT_NODE?this:this.ownerDocument,R.parentNode=this,R}removeChild(R){let P=this.childNodes.indexOf(R);if(P===-1)return R;return this.childNodes.splice(P,1),R.parentNode=null,R}replaceChildren(...R){for(let P of this.childNodes)P.parentNode=null;this.childNodes=[],this.append(...R)}get textContent(){return this.childNodes.map((R)=>R.textContent??"").join("")}set textContent(R){this.replaceChildren(R??"")}getRootNode(){let R=this;while("parentNode"in R&&R.parentNode)R=R.parentNode;return R}}class _ extends Q{value;constructor(R,P=Y()){super(Q.TEXT_NODE,P);this.value=R}get textContent(){return this.value}set textContent(R){this.value=R??""}}class NR{element;constructor(R){this.element=R}add(...R){let P=new Set(this.readTokens());for(let g of R)if(g!=="")P.add(g);this.writeTokens([...P])}remove(...R){let P=new Set(this.readTokens());for(let g of R)P.delete(g);this.writeTokens([...P])}toggle(R,P){let g=this.contains(R);if(P??!g)return this.add(R),!0;return this.remove(R),!1}contains(R){return this.readTokens().includes(R)}toString(){return this.value}get value(){return this.element.getAttribute("class")??""}readTokens(){return this.value.split(/\s+/).map((R)=>R.trim()).filter((R)=>R.length>0)}writeTokens(R){if(R.length===0){this.element.removeAttribute("class");return}this.element.setAttribute("class",R.join(" "))}}class M extends Q{attributes=new Map;classListValue;datasetValue;fragmentHtml;fragmentText;localName;tagName;constructor(R="div",P=Y()){super(Q.ELEMENT_NODE,P);this.localName=R.toLowerCase(),this.tagName=this.localName.toUpperCase()}get classList(){return this.classListValue??=new NR(this),this.classListValue}get dataset(){return this.datasetValue??=new Proxy({},{deleteProperty:(R,P)=>{if(typeof P!=="string")return!1;return this.removeAttribute(T(P)),!0},get:(R,P)=>{if(typeof P!=="string")return;return this.getAttribute(T(P))??void 0},getOwnPropertyDescriptor:(R,P)=>{if(typeof P!=="string")return;return{configurable:!0,enumerable:!0,value:this.getAttribute(T(P))??void 0,writable:!0}},has:(R,P)=>{return typeof P==="string"&&this.hasAttribute(T(P))},ownKeys:()=>{return this.getAttributeNames().filter((R)=>R.startsWith("data-")).map((R)=>SP(R.slice(5)))},set:(R,P,g)=>{if(typeof P!=="string")return!1;return this.setAttribute(T(P),String(g)),!0}}),this.datasetValue}hasAttribute(R){return this.attributes.has(R)}getAttribute(R){return this.attributes.get(R)??null}getAttributeNames(){return Array.from(this.attributes.keys())}setAttribute(R,P){this.fragmentHtml=void 0,this.attributes.set(R,String(P))}toggleAttribute(R,P){if(P??!this.hasAttribute(R))return this.setAttribute(R,""),!0;return this.removeAttribute(R),!1}removeAttribute(R){this.fragmentHtml=void 0,this.attributes.delete(R)}querySelector(){return null}querySelectorAll(){return[]}matches(){return!1}get outerHTML(){if(this.fragmentHtml!==void 0)return this.fragmentHtml;let R=Array.from(this.attributes.entries()).map(([P,g])=>` ${P}="${yP(g)}"`).join("");return`<${this.localName}${R}>${this.innerHTML}</${this.localName}>`}get innerHTML(){return this.childNodes.map((R)=>_P(R)).join("")}set innerHTML(R){this.fragmentHtml=void 0,this.fragmentText=void 0,this.replaceChildren(...uR(R,this.ownerDocument))}get textContent(){return this.fragmentText??super.textContent??""}set textContent(R){this.fragmentHtml=void 0,this.fragmentText=R??"",super.textContent=R}setSerializedFragment(R,P,g){this.fragmentHtml=R,this.fragmentText=P,this.attributes=new Map(Object.entries(g)),this.replaceChildren()}}class v{bubbles;cancelable;composed;type;constructor(R,P={}){this.type=R,this.bubbles=P.bubbles??!1,this.cancelable=P.cancelable??!1,this.composed=P.composed??!1}}class n extends v{detail;constructor(R,P={}){super(R,P);this.detail=P.detail}}class K extends M{isConnected=!1;constructor(R="div",P=Y()){super(R,P)}insertAdjacentHTML(R,P){this.append(...uR(P,this.ownerDocument))}}class L extends K{constructor(R=Y()){super("script",R)}}class l extends Q{constructor(){super(Q.DOCUMENT_NODE)}createElement(R){return R.toLowerCase()==="script"?new L(this):new K(R,this)}createTextNode(R){return new _(R,this)}querySelector(){return null}querySelectorAll(){return[]}}class MR{definitions=new Map;define(R,P){if(this.definitions.has(R))return;this.definitions.set(R,P)}get(R){return this.definitions.get(R)}}var S,t={escape(R){return TP(String(R))}};function wP(R){return new _(R,Y())}function Y(){return globalThis.document??null}function vR(){let R=globalThis,P=R.customElements;if(typeof R.Node>"u"||typeof R.Document>"u"||typeof R.Element>"u"||typeof R.HTMLElement>"u"||typeof R.document>"u"||!P||typeof P.define!=="function"||typeof P.get!=="function")return;return R.window??{CSS:R.CSS??t,CustomEvent:R.CustomEvent??n,Document:R.Document,Element:R.Element,Event:R.Event??v,EventTarget:R.EventTarget??EventTarget,HTMLScriptElement:R.HTMLScriptElement??R.HTMLElement,HTMLElement:R.HTMLElement,Node:R.Node,document:R.document,customElements:P}}function o(){let R=vR();if(R)return R;return hP()}function sR(){return o(),{prepareHost(R,P={}){if(P.authoredContent!==void 0)R.innerHTML=P.authoredContent}}}function hP(){let R=vR();if(R)return R;if(S)return S;let P=new MR,g=new l,f=globalThis.Event??v,$=globalThis.CustomEvent??n,j=l,H=globalThis.EventTarget??EventTarget;return S={CSS:globalThis.CSS??t,CustomEvent:$,Document:j,Element:M,Event:f,EventTarget:H,HTMLScriptElement:L,HTMLElement:K,Node:Q,document:g,customElements:P},Object.assign(globalThis,{CSS:globalThis.CSS??t,CustomEvent:$,Document:j,Element:M,Event:f,EventTarget:H,HTMLScriptElement:L,HTMLElement:K,Node:Q,document:g,customElements:P,window:S}),S}function AP(R,P,g){let f=P.tagName==="script"?new L(g):new K(P.tagName,g);return f.setSerializedFragment(R,VP(P.innerHtml),P.attributes),f}function yP(R){return R.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function VP(R){return R.replace(/<!--.*?-->/gs,"").replace(/<[^>]+>/g,"")}function uR(R,P=Y()){return OR(R).map((g)=>{if(!g.startsWith("<"))return new _(g,P);let f=V(g,0);if(!f||f.type!=="open")return new _(g,P);return AP(g,f,P)})}function T(R){return`data-${R.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function SP(R){return R.replace(/-([a-z])/g,(P,g)=>g.toUpperCase())}function TP(R){let P="";for(let g=0;g<R.length;g+=1){let f=R[g]??"",$=f.codePointAt(0)??0;if($===0){P+="�";continue}let j=$>=1&&$<=31||$===127,H=g===0&&$>=48&&$<=57,q=g===1&&$>=48&&$<=57&&(R[0]??"")==="-",J=g===0&&f==="-"&&R.length===1;if(j||H||q){P+=`\\${$.toString(16)} `;continue}if($>=128||f==="-"||f==="_"||$>=48&&$<=57||$>=65&&$<=90||$>=97&&$<=122){P+=J?`\\${f}`:f;continue}P+=`\\${f}`}return P}function _P(R){if(R.nodeType===Q.TEXT_NODE)return R.textContent??"";return"outerHTML"in R&&typeof R.outerHTML==="string"?R.outerHTML:R.textContent??""}function LP(R,P="hydrate"){return{kind:"script-module",src:R,stage:P}}function g1(R){return{kind:"modulepreload",href:R}}function f1(R,P){return P?{kind:"style",href:R,media:P}:{kind:"style",href:R}}async function $1(R,P){return(await s(u(R,P))).markup}async function j1(R,P){return s(u(R,P))}async function H1(R,P){return e(await s(u(R,P)))}async function q1(R,P){return DP(await s(u(R,P)))}async function s(R){return Z(U(),async()=>{let P=R.environment??sR(),g=X(kP(R.ssrContext));try{let f="component"in R?R.component:await R.load(),$=new f;C($),IP(P,$,R.authoredContent,R.prepareHost),R.initialize?.($);let j=R.clientModuleSrc??await R.resolveClientModuleSrc?.(f),H=R.assets??await R.resolveAssets?.(f)??[],q=RR(H,j),J=PR(q)??j,x=R.tagName??MP(f),b=(R.now??EP)().toISOString(),w=gR(R.renderOptions),fR=DR($,w)??NP($,w),rR=CP($,fR);return{markup:fR,metadata:{assets:q,clientModuleUrl:J,generatedAt:b,tagName:x},preview:rR}}finally{g()}})}function CP(R,P){return ER(R,P)??kR(R)??R.renderHost?.()??{nodeType:1,outerHTML:P}}function IP(R,P,g,f){if(!OP(P)){if(g===void 0&&f===void 0)return;throw Error(`${P.constructor.name} cannot prepare SSR host content because it does not expose an innerHTML host surface.`)}R.prepareHost(P,{authoredContent:g}),f?.(P,R)}function kP(R){if(!R||R.length===0)return[];return R.map((P)=>({getContext:()=>P.value,getContextKey:()=>P.context,renderHydrationScript:()=>{return},renderHydrationScriptTag:()=>{return}}))}function e(R){if("metadata"in R)return{assets:R.metadata.assets,clientModuleSrc:R.metadata.clientModuleUrl,generatedAt:R.metadata.generatedAt,markup:R.markup,tagName:R.metadata.tagName};let{preview:P,...g}=R;return g}function DP(R){return{assets:R.metadata.assets,clientModuleSrc:R.metadata.clientModuleUrl,generatedAt:R.metadata.generatedAt,markup:R.markup,preview:R.preview,tagName:R.metadata.tagName}}function EP(){return new Date}function zP(R){if(!R)return[];return[LP(R)]}function RR(R,P){if(!P)return R;if(R.some((g)=>g.kind==="script-module"&&g.src===P))return R;return[...zP(P),...R]}function PR(R){return R.find((P)=>P.kind==="script-module")?.src}function u(R,P){if(typeof R==="function")return{...P,component:R};return R}function gR(R){if(R?.mode!==void 0||R?.hydrate!==void 0)return R;return{...R,mode:"hydrate"}}function OP(R){return"innerHTML"in R}function NP(R,P){if(typeof R.renderHostToString==="function")return R.renderHostToString(P);throw Error(`${R.constructor.name} cannot be server-rendered without a registered Radiant SSR host or renderHostToString().`)}function MP(R){let P=D(R);if(!P)throw Error(`${R.name} is missing @customElement metadata.`);return P}import{renderToString as vP}from"@ecopages/jsx/server";async function Y1(R,P){return(await d(R,P)).markup}async function x1(R,P){return d(R,P)}async function w1(R,P){return e(await d(R,P))}async function h1(R,P){return sP(await d(R,P))}async function d(R,P){return Z(U(),async()=>{let g=dP(P.tagName),f=cP(g,pP(R,P)),$=new R(f);C($);try{P.initialize?.($),$.runWithSsrLifecycle(()=>$.connect());let j=P.clientModuleSrc??await P.resolveClientModuleSrc?.(R),H=P.assets??await P.resolveAssets?.(R)??[],q=RR(H,j),J=PR(q)??j,x=(P.now??uP)().toISOString(),b=gR(P.renderOptions),w=aP($,g,b);return{markup:w,metadata:{assets:q,clientModuleUrl:J,generatedAt:x,tagName:g},preview:{nodeType:1,outerHTML:w}}}finally{$.disconnect()}})}function sP(R){return{assets:R.metadata.assets,clientModuleSrc:R.metadata.clientModuleUrl,generatedAt:R.metadata.generatedAt,markup:R.markup,preview:R.preview,tagName:R.metadata.tagName}}function uP(){return new Date}function dP(R){let P=R.trim().toLowerCase();if(!P)throw Error("Controller SSR host tagName is required.");return P}function cP(R,P){let f=o().document.createElement(R);for(let[$,j]of Object.entries(P)){if(j===void 0||j===null||j===!1)continue;f.setAttribute($,j===!0?"":String(j))}return f}function pP(R,P){let g={},f=P.host,$=iP(P.attributes?.class,f?.class,f?.classes);if($!==void 0)g.class=$;dR(g,"data",f?.data),dR(g,"aria",f?.aria),rP(g,P.attributes);let j=XR(R);if(j&&g[B]==null)g[B]=j;return g}function dR(R,P,g){if(!pR(g))return;for(let[f,$]of Object.entries(g))R[`${P}-${mP(f)}`]=$}function rP(R,P){if(!P)return;for(let[g,f]of Object.entries(P))R[g]=f}function iP(...R){let P=[];for(let g of R)cR(P,g);return P.length===0?void 0:P.join(" ")}function cR(R,P){if(P===void 0||P===null||P===!1||P===!0)return;if(typeof P==="string"){if(P!=="")R.push(P);return}if(typeof P==="number"||typeof P==="bigint"){R.push(String(P));return}if(Array.isArray(P)){for(let g of P)cR(R,g);return}if(!pR(P))return;for(let[g,f]of Object.entries(P))if(f)R.push(g)}function pR(R){return Object.prototype.toString.call(R)==="[object Object]"}function mP(R){return R.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function aP(R,P,g){let f=X(R.getSsrContextProviders());try{let $=m(()=>vP(R.render(),g)),H=g.mode==="hydrate"||g.mode===void 0&&g.hydrate===!0?R.getSsrHydrationBindings().map((q)=>q.renderHydrationScriptTag()).filter((q)=>typeof q==="string").join(""):"";return`<${P}${lP(R.host)}>${$}${H}</${P}>`}finally{f()}}function lP(R){return R.getAttributeNames().map((P)=>tP(P,R.getAttribute(P))).join("")}function tP(R,P){if(P==="")return` ${R}`;return` ${R}="${nP(P??"")}"`}function nP(R){return R.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">")}export{h1 as renderControllerWithPreview,Y1 as renderControllerToString,w1 as renderControllerToPayload,x1 as renderController};
|
|
2
|
+
|
|
3
|
+
//# debugId=1F238D7B0E2C36AD64756E2164756E21
|