@ecopages/radiant 0.3.0-beta.0 → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/client/app-bootstrap.js +3 -0
- package/{dist/client → client}/app-bootstrap.js.map +2 -2
- package/client/hydrator.js +3 -0
- package/{dist/client → client}/hydrator.js.map +2 -2
- package/client/install-hydrator.js +3 -0
- package/{dist/client → client}/install-hydrator.js.map +2 -2
- package/context/context-consumer-bootstrap.js +3 -0
- package/{dist/context → context}/context-consumer-bootstrap.js.map +4 -4
- package/context/context-consumer-runtime.js +3 -0
- package/context/context-consumer-runtime.js.map +12 -0
- package/context/context-host.js +3 -0
- package/{dist/context → context}/context-host.js.map +2 -2
- package/context/context-provider.js +3 -0
- package/{dist/context → context}/context-provider.js.map +3 -3
- package/context/context-ssr-bridge.js +3 -0
- package/{dist/context → context}/context-ssr-bridge.js.map +2 -2
- package/context/create-context.js +3 -0
- package/{dist/context → context}/create-context.js.map +2 -2
- package/context/decorators/consume-context.js +3 -0
- package/{dist/context → context}/decorators/consume-context.js.map +5 -5
- package/context/decorators/context-selection-delivery.js +3 -0
- package/{dist/context → context}/decorators/context-selection-delivery.js.map +2 -2
- package/context/decorators/context-selector.js +3 -0
- package/{dist/context → context}/decorators/context-selector.js.map +6 -6
- package/context/decorators/legacy/consume-context.js +3 -0
- package/context/decorators/legacy/consume-context.js.map +16 -0
- package/context/decorators/legacy/context-selector-field.js +3 -0
- package/context/decorators/legacy/context-selector-field.js.map +17 -0
- package/context/decorators/legacy/context-selector.js +3 -0
- package/context/decorators/legacy/context-selector.js.map +17 -0
- package/context/decorators/legacy/provide-context.js +3 -0
- package/{dist/context → context}/decorators/legacy/provide-context.js.map +4 -4
- package/context/decorators/on-context-update.js +3 -0
- package/{dist/context → context}/decorators/on-context-update.js.map +5 -5
- package/context/decorators/provide-context.js +3 -0
- package/{dist/context → context}/decorators/provide-context.js.map +4 -4
- package/context/decorators/standard/consume-context.js +3 -0
- package/{dist/context → context}/decorators/standard/consume-context.js.map +4 -4
- package/context/decorators/standard/context-selector-field.js +3 -0
- package/{dist/context → context}/decorators/standard/context-selector-field.js.map +4 -4
- package/context/decorators/standard/context-selector.js +3 -0
- package/{dist/context → context}/decorators/standard/context-selector.js.map +4 -4
- package/context/decorators/standard/provide-context.js +3 -0
- package/{dist/context → context}/decorators/standard/provide-context.js.map +3 -3
- package/context/decorators/standard-legacy-dispatch.js +3 -0
- package/context/decorators/standard-legacy-dispatch.js.map +10 -0
- package/context/events.js +3 -0
- package/context/events.js.map +10 -0
- package/context/hydration-script.js +3 -0
- package/{dist/context → context}/hydration-script.js.map +2 -2
- package/context/index.js +3 -0
- package/{dist/context → context}/index.js.map +6 -6
- package/controller-registry.js +3 -0
- package/{dist/controller-registry.js.map → controller-registry.js.map} +3 -3
- package/core/controller-metadata.js +3 -0
- package/{dist/core → core}/controller-metadata.js.map +2 -2
- package/core/custom-element-metadata.js +3 -0
- package/{dist/core → core}/custom-element-metadata.js.map +2 -2
- package/core/event-subscription-registry.js +3 -0
- package/{dist/core → core}/event-subscription-registry.js.map +2 -2
- package/core/host-ssr-registry.js +3 -0
- package/{dist/core → core}/host-ssr-registry.js.map +2 -2
- package/core/hydration-capable-host.js +3 -0
- package/{dist/core → core}/hydration-capable-host.js.map +2 -2
- package/core/hydration-codec.js +3 -0
- package/{dist/core → core}/hydration-codec.js.map +2 -2
- package/{dist/core → core}/radiant-controller.d.ts +7 -5
- package/core/radiant-controller.js +3 -0
- package/core/radiant-controller.js.map +21 -0
- package/core/radiant-element-ssr-host.js +3 -0
- package/{dist/core → core}/radiant-element-ssr-host.js.map +2 -2
- package/{dist/core → core}/radiant-element-ssr-registry.d.ts +4 -2
- package/core/radiant-element-ssr-registry.js +3 -0
- package/core/radiant-element-ssr-registry.js.map +10 -0
- package/{dist/core → core}/radiant-element.d.ts +18 -15
- package/core/radiant-element.js +3 -0
- package/core/radiant-element.js.map +31 -0
- package/core/radiant-hydrator-state.js +3 -0
- package/{dist/core → core}/radiant-hydrator-state.js.map +2 -2
- package/core/reactive-binding-adapter.d.ts +10 -0
- package/core/reactive-binding-adapter.js +3 -0
- package/core/reactive-binding-adapter.js.map +10 -0
- package/core/reactive-host.d.ts +138 -0
- package/core/reactive-host.js +3 -0
- package/core/reactive-host.js.map +13 -0
- package/{dist/core → core}/reactive-jsx-value.d.ts +2 -2
- package/core/reactive-jsx-value.js +3 -0
- package/core/reactive-jsx-value.js.map +10 -0
- package/{dist/core → core}/reactive-prop-core.d.ts +6 -11
- package/core/reactive-prop-core.js +3 -0
- package/{dist/core → core}/reactive-prop-core.js.map +3 -3
- package/core/reactive-prop-metadata.js +3 -0
- package/{dist/core → core}/reactive-prop-metadata.js.map +2 -2
- package/{dist/core → core}/reactive-property-state.d.ts +5 -2
- package/core/reactive-property-state.js +3 -0
- package/core/reactive-property-state.js.map +12 -0
- package/core/reactivity-adapter.js +3 -0
- package/core/reactivity-adapter.js.map +12 -0
- package/{dist/core → core}/reactivity-contract.d.ts +14 -0
- package/core/reactivity-runtime.js +3 -0
- package/core/reactivity-runtime.js.map +11 -0
- package/core/reactivity-signals.js +3 -0
- package/core/reactivity-signals.js.map +10 -0
- package/core/render-runtime.js +3 -0
- package/{dist/core → core}/render-runtime.js.map +3 -3
- package/core/render-scheduler.js +3 -0
- package/{dist/core → core}/render-scheduler.js.map +2 -2
- package/core/slot-projection-runtime.js +3 -0
- package/{dist/core → core}/slot-projection-runtime.js.map +2 -2
- package/core/ssr-preparation.js +3 -0
- package/{dist/core → core}/ssr-preparation.js.map +2 -2
- package/decorators/attr.js +3 -0
- package/decorators/attr.js.map +18 -0
- package/decorators/bound.js +3 -0
- package/{dist/decorators → decorators}/bound.js.map +2 -2
- package/decorators/bridge.js +3 -0
- package/{dist/decorators → decorators}/bridge.js.map +2 -2
- package/decorators/controller.js +3 -0
- package/{dist/decorators → decorators}/controller.js.map +3 -3
- package/decorators/custom-element.js +3 -0
- package/{dist/decorators → decorators}/custom-element.js.map +2 -2
- package/decorators/debounce.js +3 -0
- package/{dist/decorators → decorators}/debounce.js.map +2 -2
- package/decorators/event.js +3 -0
- package/{dist/decorators → decorators}/event.js.map +3 -3
- package/decorators/legacy/attr.js +3 -0
- package/decorators/legacy/attr.js.map +15 -0
- package/decorators/legacy/bound.js +3 -0
- package/{dist/decorators → decorators}/legacy/bound.js.map +2 -2
- package/decorators/legacy/custom-element.js +3 -0
- package/{dist/decorators → decorators}/legacy/custom-element.js.map +2 -2
- package/decorators/legacy/debounce.js +3 -0
- package/{dist/decorators → decorators}/legacy/debounce.js.map +2 -2
- package/decorators/legacy/event.js +3 -0
- package/decorators/legacy/event.js.map +13 -0
- package/decorators/legacy/host-readiness.js +3 -0
- package/decorators/legacy/host-readiness.js.map +11 -0
- package/{dist/decorators → decorators}/legacy/instance-initializers.d.ts +4 -2
- package/decorators/legacy/instance-initializers.js +3 -0
- package/decorators/legacy/instance-initializers.js.map +10 -0
- package/decorators/legacy/member-bootstrap.d.ts +10 -0
- package/decorators/legacy/member-bootstrap.js +3 -0
- package/decorators/legacy/member-bootstrap.js.map +10 -0
- package/decorators/legacy/on-event.js +3 -0
- package/{dist/decorators → decorators}/legacy/on-event.js.map +3 -3
- package/decorators/legacy/on-updated.js +3 -0
- package/decorators/legacy/on-updated.js.map +11 -0
- package/decorators/legacy/query-slot.js +3 -0
- package/decorators/legacy/query-slot.js.map +13 -0
- package/decorators/legacy/query.js +3 -0
- package/decorators/legacy/query.js.map +12 -0
- package/decorators/legacy/reactive-field.js +3 -0
- package/decorators/legacy/reactive-field.js.map +13 -0
- package/{dist/decorators → decorators}/legacy/reactive-prop.d.ts +0 -1
- package/decorators/legacy/reactive-prop.js +3 -0
- package/decorators/legacy/reactive-prop.js.map +15 -0
- package/decorators/legacy/signal.js +3 -0
- package/decorators/legacy/signal.js.map +17 -0
- package/decorators/on-event.js +3 -0
- package/{dist/decorators → decorators}/on-event.js.map +3 -3
- package/decorators/on-updated.js +3 -0
- package/{dist/decorators → decorators}/on-updated.js.map +3 -3
- package/{dist/decorators → decorators}/prop.d.ts +4 -5
- package/decorators/prop.js +3 -0
- package/decorators/prop.js.map +18 -0
- package/decorators/query-slot.js +3 -0
- package/{dist/decorators → decorators}/query-slot.js.map +3 -3
- package/decorators/query.js +3 -0
- package/{dist/decorators → decorators}/query.js.map +3 -3
- package/decorators/shared/auto-bind.d.ts +7 -0
- package/decorators/shared/auto-bind.js +3 -0
- package/decorators/shared/auto-bind.js.map +10 -0
- package/decorators/shared/reactive-attr.js +3 -0
- package/decorators/shared/reactive-attr.js.map +13 -0
- package/decorators/signal.js +3 -0
- package/decorators/signal.js.map +19 -0
- package/decorators/standard/attr.js +3 -0
- package/decorators/standard/attr.js.map +14 -0
- package/decorators/standard/bound.js +3 -0
- package/{dist/decorators → decorators}/standard/bound.js.map +2 -2
- package/decorators/standard/custom-element.js +3 -0
- package/{dist/decorators → decorators}/standard/custom-element.js.map +2 -2
- package/decorators/standard/debounce.js +3 -0
- package/{dist/decorators → decorators}/standard/debounce.js.map +2 -2
- package/decorators/standard/event.js +3 -0
- package/{dist/decorators → decorators}/standard/event.js.map +2 -2
- package/decorators/standard/on-event.js +3 -0
- package/{dist/decorators → decorators}/standard/on-event.js.map +2 -2
- package/decorators/standard/on-updated.js +3 -0
- package/{dist/decorators → decorators}/standard/on-updated.js.map +2 -2
- package/decorators/standard/query-slot.js +3 -0
- package/{dist/decorators → decorators}/standard/query-slot.js.map +2 -2
- package/decorators/standard/query.js +3 -0
- package/{dist/decorators → decorators}/standard/query.js.map +2 -2
- package/decorators/standard/reactive-field.js +3 -0
- package/decorators/standard/reactive-field.js.map +11 -0
- package/decorators/standard/reactive-prop.js +3 -0
- package/{dist/decorators → decorators}/standard/reactive-prop.js.map +4 -4
- package/decorators/standard/signal.js +3 -0
- package/decorators/standard/signal.js.map +16 -0
- package/{dist/decorators → decorators}/state.d.ts +3 -2
- package/decorators/state.js +3 -0
- package/decorators/state.js.map +16 -0
- package/helpers/create-event-listener.js +3 -0
- package/{dist/helpers → helpers}/create-event-listener.js.map +2 -2
- package/helpers/create-event.js +3 -0
- package/{dist/helpers → helpers}/create-event.js.map +2 -2
- package/helpers/create-query-slot.js +3 -0
- package/{dist/helpers → helpers}/create-query-slot.js.map +2 -2
- package/helpers/create-query.js +3 -0
- package/{dist/helpers → helpers}/create-query.js.map +2 -2
- package/helpers/debounce.js +3 -0
- package/{dist/helpers → helpers}/debounce.js.map +2 -2
- package/helpers/index.js +3 -0
- package/{dist/helpers → helpers}/index.js.map +2 -2
- package/index.js +3 -0
- package/index.js.map +86 -0
- package/package.json +99 -129
- package/server/context-ssr.js +3 -0
- package/{dist/server → server}/context-ssr.js.map +2 -2
- package/server/host-attribute-serialization.js +3 -0
- package/{dist/server → server}/host-attribute-serialization.js.map +5 -5
- package/server/host-script-composition.js +3 -0
- package/{dist/server → server}/host-script-composition.js.map +2 -2
- package/server/html-parser.js +3 -0
- package/{dist/server → server}/html-parser.js.map +2 -2
- package/server/install-light-dom-shim.js +3 -0
- package/server/install-light-dom-shim.js.map +17 -0
- package/server/internal-radiant-host.js +3 -0
- package/{dist/server → server}/internal-radiant-host.js.map +1 -1
- package/server/light-dom-shim.d.ts +2 -0
- package/server/light-dom-shim.js +3 -0
- package/server/light-dom-shim.js.map +16 -0
- package/server/minimal-dom/document.d.ts +17 -0
- package/server/minimal-dom/document.js +3 -0
- package/server/minimal-dom/document.js.map +14 -0
- package/server/minimal-dom/html.d.ts +7 -0
- package/server/minimal-dom/html.js +3 -0
- package/server/minimal-dom/html.js.map +13 -0
- package/{dist/server/light-dom-shim.d.ts → server/minimal-dom/install.d.ts} +1 -4
- package/server/minimal-dom/install.js +3 -0
- package/server/minimal-dom/install.js.map +16 -0
- package/server/minimal-dom/nodes.d.ts +78 -0
- package/server/project-root.js +3 -0
- package/{dist/server → server}/project-root.js.map +2 -2
- package/server/radiant-element-ssr-bridge.js +3 -0
- package/{dist/server → server}/radiant-element-ssr-bridge.js.map +9 -9
- package/server/radiant-element-ssr-extractor.js +3 -0
- package/{dist/server → server}/radiant-element-ssr-extractor.js.map +3 -3
- package/server/radiant-element-ssr-service.js +3 -0
- package/{dist/server → server}/radiant-element-ssr-service.js.map +8 -8
- package/server/radiant-element-ssr.js +3 -0
- package/{dist/server → server}/radiant-element-ssr.js.map +9 -9
- package/{dist/server → server}/render-component.d.ts +1 -1
- package/server/render-component.js +3 -0
- package/server/render-component.js.map +32 -0
- package/server/render-controller.js +3 -0
- package/server/render-controller.js.map +35 -0
- package/server/render-fragment.js +3 -0
- package/server/render-fragment.js.map +10 -0
- package/server/slot-projection-html.js +3 -0
- package/{dist/server → server}/slot-projection-html.js.map +4 -4
- package/signals/host-resource.js +3 -0
- package/{dist/signals → signals}/host-resource.js.map +2 -2
- package/{dist/signals → signals}/host-signal.d.ts +2 -1
- package/signals/host-signal.js +3 -0
- package/signals/host-signal.js.map +13 -0
- package/signals/hydration-script.js +3 -0
- package/{dist/signals → signals}/hydration-script.js.map +2 -2
- package/tools/escape-css-identifier.js +3 -0
- package/{dist/tools → tools}/escape-css-identifier.js.map +2 -2
- package/tools/escape-script-json.js +3 -0
- package/{dist/tools → tools}/escape-script-json.js.map +2 -2
- package/tools/event-emitter.js +3 -0
- package/{dist/tools → tools}/event-emitter.js.map +2 -2
- package/tools/index.js +3 -0
- package/{dist/tools → tools}/index.js.map +2 -2
- package/tools/render-jsx-template.js +3 -0
- package/{dist/tools → tools}/render-jsx-template.js.map +2 -2
- package/types.js +3 -0
- package/{dist/types.js.map → types.js.map} +2 -2
- package/utils/attribute-utils.js +3 -0
- package/{dist/utils → utils}/attribute-utils.js.map +2 -2
- package/utils/escape-html-attribute.js +3 -0
- package/{dist/utils → utils}/escape-html-attribute.js.map +2 -2
- package/utils/index.js +3 -0
- package/{dist/utils → utils}/index.js.map +2 -2
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -315
- package/dist/client/app-bootstrap.js +0 -3
- package/dist/client/hydrator.js +0 -3
- package/dist/client/install-hydrator.js +0 -3
- package/dist/context/context-consumer-bootstrap.js +0 -3
- package/dist/context/context-consumer-runtime.js +0 -3
- package/dist/context/context-consumer-runtime.js.map +0 -12
- package/dist/context/context-host.js +0 -3
- package/dist/context/context-provider.js +0 -3
- package/dist/context/context-ssr-bridge.js +0 -3
- package/dist/context/create-context.js +0 -3
- package/dist/context/decorators/consume-context.js +0 -3
- package/dist/context/decorators/context-selection-delivery.js +0 -3
- package/dist/context/decorators/context-selector.js +0 -3
- package/dist/context/decorators/legacy/consume-context.js +0 -3
- package/dist/context/decorators/legacy/consume-context.js.map +0 -16
- package/dist/context/decorators/legacy/context-selector-field.js +0 -3
- package/dist/context/decorators/legacy/context-selector-field.js.map +0 -17
- package/dist/context/decorators/legacy/context-selector.js +0 -3
- package/dist/context/decorators/legacy/context-selector.js.map +0 -17
- package/dist/context/decorators/legacy/provide-context.js +0 -3
- package/dist/context/decorators/on-context-update.js +0 -3
- package/dist/context/decorators/provide-context.js +0 -3
- package/dist/context/decorators/standard/consume-context.js +0 -3
- package/dist/context/decorators/standard/context-selector-field.js +0 -3
- package/dist/context/decorators/standard/context-selector.js +0 -3
- package/dist/context/decorators/standard/provide-context.js +0 -3
- package/dist/context/decorators/standard-legacy-dispatch.js +0 -3
- package/dist/context/decorators/standard-legacy-dispatch.js.map +0 -10
- package/dist/context/events.js +0 -3
- package/dist/context/events.js.map +0 -10
- package/dist/context/hydration-script.js +0 -3
- package/dist/context/index.js +0 -3
- package/dist/controller-registry.js +0 -3
- package/dist/core/controller-metadata.js +0 -3
- package/dist/core/custom-element-metadata.js +0 -3
- package/dist/core/event-subscription-registry.js +0 -3
- package/dist/core/host-ssr-registry.js +0 -3
- package/dist/core/hydration-capable-host.js +0 -3
- package/dist/core/hydration-codec.js +0 -3
- package/dist/core/radiant-controller.js +0 -3
- package/dist/core/radiant-controller.js.map +0 -20
- package/dist/core/radiant-element-ssr-host.js +0 -3
- package/dist/core/radiant-element-ssr-registry.js +0 -3
- package/dist/core/radiant-element-ssr-registry.js.map +0 -10
- package/dist/core/radiant-element.js +0 -3
- package/dist/core/radiant-element.js.map +0 -30
- package/dist/core/radiant-hydrator-state.js +0 -3
- package/dist/core/reactive-host.d.ts +0 -124
- package/dist/core/reactive-host.js +0 -3
- package/dist/core/reactive-host.js.map +0 -13
- package/dist/core/reactive-jsx-value.js +0 -3
- package/dist/core/reactive-jsx-value.js.map +0 -10
- package/dist/core/reactive-prop-core.js +0 -3
- package/dist/core/reactive-prop-metadata.js +0 -3
- package/dist/core/reactive-property-state.js +0 -3
- package/dist/core/reactive-property-state.js.map +0 -12
- package/dist/core/reactivity-adapter.js +0 -3
- package/dist/core/reactivity-adapter.js.map +0 -12
- package/dist/core/reactivity-runtime.js +0 -3
- package/dist/core/reactivity-runtime.js.map +0 -11
- package/dist/core/reactivity-signals.js +0 -3
- package/dist/core/reactivity-signals.js.map +0 -10
- package/dist/core/render-runtime.js +0 -3
- package/dist/core/render-scheduler.js +0 -3
- package/dist/core/slot-projection-runtime.js +0 -3
- package/dist/core/ssr-preparation.js +0 -3
- package/dist/decorators/attr.js +0 -3
- package/dist/decorators/attr.js.map +0 -17
- package/dist/decorators/bound.js +0 -3
- package/dist/decorators/bridge.js +0 -3
- package/dist/decorators/controller.js +0 -3
- package/dist/decorators/custom-element.js +0 -3
- package/dist/decorators/debounce.js +0 -3
- package/dist/decorators/event.js +0 -3
- package/dist/decorators/legacy/attr.js +0 -3
- package/dist/decorators/legacy/attr.js.map +0 -14
- package/dist/decorators/legacy/bound.js +0 -3
- package/dist/decorators/legacy/custom-element.js +0 -3
- package/dist/decorators/legacy/debounce.js +0 -3
- package/dist/decorators/legacy/event.js +0 -3
- package/dist/decorators/legacy/event.js.map +0 -13
- package/dist/decorators/legacy/host-readiness.js +0 -3
- package/dist/decorators/legacy/host-readiness.js.map +0 -11
- package/dist/decorators/legacy/instance-initializers.js +0 -3
- package/dist/decorators/legacy/instance-initializers.js.map +0 -10
- package/dist/decorators/legacy/on-event.js +0 -3
- package/dist/decorators/legacy/on-updated.js +0 -3
- package/dist/decorators/legacy/on-updated.js.map +0 -11
- package/dist/decorators/legacy/query-slot.js +0 -3
- package/dist/decorators/legacy/query-slot.js.map +0 -13
- package/dist/decorators/legacy/query.js +0 -3
- package/dist/decorators/legacy/query.js.map +0 -12
- package/dist/decorators/legacy/reactive-field.js +0 -3
- package/dist/decorators/legacy/reactive-field.js.map +0 -11
- package/dist/decorators/legacy/reactive-prop.js +0 -3
- package/dist/decorators/legacy/reactive-prop.js.map +0 -14
- package/dist/decorators/legacy/signal.js +0 -3
- package/dist/decorators/legacy/signal.js.map +0 -16
- package/dist/decorators/on-event.js +0 -3
- package/dist/decorators/on-updated.js +0 -3
- package/dist/decorators/prop.js +0 -3
- package/dist/decorators/prop.js.map +0 -17
- package/dist/decorators/query-slot.js +0 -3
- package/dist/decorators/query.js +0 -3
- package/dist/decorators/shared/reactive-attr.js +0 -3
- package/dist/decorators/shared/reactive-attr.js.map +0 -12
- package/dist/decorators/signal.js +0 -3
- package/dist/decorators/signal.js.map +0 -18
- package/dist/decorators/standard/attr.js +0 -3
- package/dist/decorators/standard/attr.js.map +0 -13
- package/dist/decorators/standard/bound.js +0 -3
- package/dist/decorators/standard/custom-element.js +0 -3
- package/dist/decorators/standard/debounce.js +0 -3
- package/dist/decorators/standard/event.js +0 -3
- package/dist/decorators/standard/on-event.js +0 -3
- package/dist/decorators/standard/on-updated.js +0 -3
- package/dist/decorators/standard/query-slot.js +0 -3
- package/dist/decorators/standard/query.js +0 -3
- package/dist/decorators/standard/reactive-field.js +0 -3
- package/dist/decorators/standard/reactive-field.js.map +0 -10
- package/dist/decorators/standard/reactive-prop.js +0 -3
- package/dist/decorators/standard/signal.js +0 -3
- package/dist/decorators/standard/signal.js.map +0 -15
- package/dist/decorators/state.js +0 -3
- package/dist/decorators/state.js.map +0 -14
- package/dist/helpers/create-event-listener.js +0 -3
- package/dist/helpers/create-event.js +0 -3
- package/dist/helpers/create-query-slot.js +0 -3
- package/dist/helpers/create-query.js +0 -3
- package/dist/helpers/debounce.js +0 -3
- package/dist/helpers/index.js +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -83
- package/dist/package.json +0 -209
- package/dist/server/context-ssr.js +0 -3
- package/dist/server/host-attribute-serialization.js +0 -3
- package/dist/server/host-script-composition.js +0 -3
- package/dist/server/html-parser.js +0 -3
- package/dist/server/install-light-dom-shim.js +0 -3
- package/dist/server/install-light-dom-shim.js.map +0 -12
- package/dist/server/internal-radiant-host.js +0 -3
- package/dist/server/light-dom-shim.js +0 -3
- package/dist/server/light-dom-shim.js.map +0 -11
- package/dist/server/project-root.js +0 -3
- package/dist/server/radiant-element-ssr-bridge.js +0 -3
- package/dist/server/radiant-element-ssr-extractor.js +0 -3
- package/dist/server/radiant-element-ssr-service.js +0 -3
- package/dist/server/radiant-element-ssr.js +0 -3
- package/dist/server/render-component.js +0 -3
- package/dist/server/render-component.js.map +0 -28
- package/dist/server/render-controller.js +0 -3
- package/dist/server/render-controller.js.map +0 -31
- package/dist/server/render-fragment.js +0 -3
- package/dist/server/render-fragment.js.map +0 -10
- package/dist/server/slot-projection-html.js +0 -3
- package/dist/signals/host-resource.js +0 -3
- package/dist/signals/host-signal.js +0 -3
- package/dist/signals/host-signal.js.map +0 -13
- package/dist/signals/hydration-script.js +0 -3
- package/dist/tools/escape-css-identifier.js +0 -3
- package/dist/tools/escape-script-json.js +0 -3
- package/dist/tools/event-emitter.js +0 -3
- package/dist/tools/index.js +0 -3
- package/dist/tools/render-jsx-template.js +0 -3
- package/dist/types.js +0 -3
- package/dist/utils/attribute-utils.js +0 -3
- package/dist/utils/escape-html-attribute.js +0 -3
- package/dist/utils/index.js +0 -3
- /package/{dist/client → client}/app-bootstrap.d.ts +0 -0
- /package/{dist/client → client}/hydrator.d.ts +0 -0
- /package/{dist/client → client}/install-hydrator.d.ts +0 -0
- /package/{dist/context → context}/context-consumer-bootstrap.d.ts +0 -0
- /package/{dist/context → context}/context-consumer-runtime.d.ts +0 -0
- /package/{dist/context → context}/context-host.d.ts +0 -0
- /package/{dist/context → context}/context-provider.d.ts +0 -0
- /package/{dist/context → context}/context-ssr-bridge.d.ts +0 -0
- /package/{dist/context → context}/create-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/consume-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/context-selection-delivery.d.ts +0 -0
- /package/{dist/context → context}/decorators/context-selector.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/consume-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/context-selector-field.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/context-selector.d.ts +0 -0
- /package/{dist/context → context}/decorators/legacy/provide-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/on-context-update.d.ts +0 -0
- /package/{dist/context → context}/decorators/provide-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/consume-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/context-selector-field.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/context-selector.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard/provide-context.d.ts +0 -0
- /package/{dist/context → context}/decorators/standard-legacy-dispatch.d.ts +0 -0
- /package/{dist/context → context}/events.d.ts +0 -0
- /package/{dist/context → context}/hydration-script.d.ts +0 -0
- /package/{dist/context → context}/index.d.ts +0 -0
- /package/{dist/context → context}/types.d.ts +0 -0
- /package/{dist/context → context}/types.js +0 -0
- /package/{dist/context → context}/types.js.map +0 -0
- /package/{dist/controller-registry.d.ts → controller-registry.d.ts} +0 -0
- /package/{dist/core → core}/controller-metadata.d.ts +0 -0
- /package/{dist/core → core}/custom-element-metadata.d.ts +0 -0
- /package/{dist/core → core}/event-subscription-registry.d.ts +0 -0
- /package/{dist/core → core}/host-ssr-registry.d.ts +0 -0
- /package/{dist/core → core}/hydration-capable-host.d.ts +0 -0
- /package/{dist/core → core}/hydration-codec.d.ts +0 -0
- /package/{dist/core → core}/radiant-element-ssr-host.d.ts +0 -0
- /package/{dist/core → core}/radiant-hydrator-state.d.ts +0 -0
- /package/{dist/core → core}/reactive-prop-metadata.d.ts +0 -0
- /package/{dist/core → core}/reactivity-adapter.d.ts +0 -0
- /package/{dist/core → core}/reactivity-contract.js +0 -0
- /package/{dist/core → core}/reactivity-contract.js.map +0 -0
- /package/{dist/core → core}/reactivity-runtime.d.ts +0 -0
- /package/{dist/core → core}/reactivity-signals.d.ts +0 -0
- /package/{dist/core → core}/render-runtime.d.ts +0 -0
- /package/{dist/core → core}/render-scheduler.d.ts +0 -0
- /package/{dist/core → core}/slot-projection-runtime.d.ts +0 -0
- /package/{dist/core → core}/ssr-hydration-binding.d.ts +0 -0
- /package/{dist/core → core}/ssr-hydration-binding.js +0 -0
- /package/{dist/core → core}/ssr-hydration-binding.js.map +0 -0
- /package/{dist/core → core}/ssr-preparation.d.ts +0 -0
- /package/{dist/decorators → decorators}/attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/bound.d.ts +0 -0
- /package/{dist/decorators → decorators}/bridge.d.ts +0 -0
- /package/{dist/decorators → decorators}/controller.d.ts +0 -0
- /package/{dist/decorators → decorators}/custom-element.d.ts +0 -0
- /package/{dist/decorators → decorators}/debounce.d.ts +0 -0
- /package/{dist/decorators → decorators}/event.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/bound.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/custom-element.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/debounce.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/event.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/host-readiness.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/on-event.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/on-updated.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/query-slot.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/query.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/reactive-field.d.ts +0 -0
- /package/{dist/decorators → decorators}/legacy/signal.d.ts +0 -0
- /package/{dist/decorators → decorators}/on-event.d.ts +0 -0
- /package/{dist/decorators → decorators}/on-updated.d.ts +0 -0
- /package/{dist/decorators → decorators}/query-slot.d.ts +0 -0
- /package/{dist/decorators → decorators}/query.d.ts +0 -0
- /package/{dist/decorators → decorators}/shared/reactive-attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/signal.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/attr.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/bound.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/custom-element.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/debounce.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/event.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/on-event.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/on-updated.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/query-slot.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/query.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/reactive-field.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/reactive-prop.d.ts +0 -0
- /package/{dist/decorators → decorators}/standard/signal.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-event-listener.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-event.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-query-slot.d.ts +0 -0
- /package/{dist/helpers → helpers}/create-query.d.ts +0 -0
- /package/{dist/helpers → helpers}/debounce.d.ts +0 -0
- /package/{dist/helpers → helpers}/index.d.ts +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/server → server}/context-ssr.d.ts +0 -0
- /package/{dist/server → server}/host-attribute-serialization.d.ts +0 -0
- /package/{dist/server → server}/host-script-composition.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}/internal-radiant-host.d.ts +0 -0
- /package/{dist/server → server}/project-root.d.ts +0 -0
- /package/{dist/server → server}/radiant-element-ssr-bridge.d.ts +0 -0
- /package/{dist/server → server}/radiant-element-ssr-extractor.d.ts +0 -0
- /package/{dist/server → server}/radiant-element-ssr-service.d.ts +0 -0
- /package/{dist/server → server}/radiant-element-ssr.d.ts +0 -0
- /package/{dist/server → server}/render-controller.d.ts +0 -0
- /package/{dist/server → server}/render-fragment.d.ts +0 -0
- /package/{dist/server → server}/slot-projection-html.d.ts +0 -0
- /package/{dist/signals → signals}/host-resource.d.ts +0 -0
- /package/{dist/signals → signals}/hydration-script.d.ts +0 -0
- /package/{dist/tools → tools}/escape-css-identifier.d.ts +0 -0
- /package/{dist/tools → tools}/escape-script-json.d.ts +0 -0
- /package/{dist/tools → tools}/event-emitter.d.ts +0 -0
- /package/{dist/tools → tools}/index.d.ts +0 -0
- /package/{dist/tools → tools}/render-jsx-template.d.ts +0 -0
- /package/{dist/types.d.ts → types.d.ts} +0 -0
- /package/{dist/utils → utils}/attribute-utils.d.ts +0 -0
- /package/{dist/utils → utils}/escape-html-attribute.d.ts +0 -0
- /package/{dist/utils → utils}/index.d.ts +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/decorators/bridge.ts", "../src/tools/event-emitter.ts", "../src/helpers/create-event.ts", "../src/decorators/legacy/event.ts", "../src/decorators/standard/event.ts", "../src/decorators/event.ts"],
|
|
4
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:
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
6
|
"import type { Method } from '../types';\n\ntype StandardFieldFn<Host extends object, Value, Result> = (\n\ttarget: undefined,\n\tcontext: ClassFieldDecoratorContext<Host, Value>,\n) => Result;\n\ntype LegacyFieldFn<Proto, Result> = (proto: Proto, name: string) => Result;\n\ntype StandardMethodFn<Host extends object, TMethod extends Method, Result> = (\n\ttarget: TMethod,\n\tcontext: ClassMethodDecoratorContext<Host, TMethod>,\n) => Result;\n\ntype LegacyMethodFn<Proto, Result> = (proto: Proto, name: string, descriptor: PropertyDescriptor) => Result;\n\nfunction isMethod(value: unknown): value is Method {\n\treturn typeof value === 'function';\n}\n\nexport function fieldDecoratorBridge<Host extends object, Value, Result, Proto>(\n\tstandard: StandardFieldFn<Host, Value, Result>,\n\tlegacy: LegacyFieldFn<Proto, void>,\n\tprotoOrTarget: undefined,\n\tnameOrContext: ClassFieldDecoratorContext<Host, Value>,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, Proto, Result>(\n\tstandard: StandardFieldFn<Host, Value, void>,\n\tlegacy: LegacyFieldFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardFieldFn<Host, Value, StandardResult>,\n\tlegacy: LegacyFieldFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | undefined,\n\tnameOrContext: string | ClassFieldDecoratorContext<Host, Value>,\n): StandardResult | LegacyResult;\n\nexport function fieldDecoratorBridge(\n\tstandard: StandardFieldFn<object, unknown, unknown>,\n\tlegacy: LegacyFieldFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassFieldDecoratorContext<object, unknown>,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\treturn standard(undefined, nameOrContext);\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext);\n}\n\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Result, Proto>(\n\tstandard: StandardMethodFn<Host, TMethod, Result>,\n\tlegacy: LegacyMethodFn<Proto, void>,\n\tprotoOrTarget: TMethod,\n\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: undefined,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Proto, Result>(\n\tstandard: StandardMethodFn<Host, TMethod, void>,\n\tlegacy: LegacyMethodFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n\tdescriptor: PropertyDescriptor,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardMethodFn<Host, TMethod, StandardResult>,\n\tlegacy: LegacyMethodFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | TMethod,\n\tnameOrContext: string | ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: PropertyDescriptor,\n): StandardResult | LegacyResult;\n\nexport function methodDecoratorBridge(\n\tstandard: StandardMethodFn<object, Method, unknown>,\n\tlegacy: LegacyMethodFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassMethodDecoratorContext<object, Method>,\n\tdescriptor?: PropertyDescriptor,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\tif (!isMethod(protoOrTarget)) {\n\t\t\tthrow new TypeError('Standard method decorators require a method target');\n\t\t}\n\n\t\treturn standard(protoOrTarget, nameOrContext);\n\t}\n\n\tif (!descriptor) {\n\t\tthrow new TypeError('Legacy method decorators require a property descriptor');\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext, descriptor);\n}\n",
|
|
7
7
|
"import type { RadiantElement } from '../core/radiant-element';\n\nexport interface EventEmitterConfig {\n\tname: string;\n\tbubbles?: boolean;\n\tcancelable?: boolean;\n\tcomposed?: boolean;\n}\n\n/**\n * A generic event emitter class that allows emitting custom events.\n *\n * @template T - The type of the event detail.\n */\nexport class EventEmitter<T = unknown> {\n\tprivate host: RadiantElement;\n\tprivate eventConfig: EventEmitterConfig;\n\n\t/**\n\t * Constructs a new instance of the EventEmitter class.\n\t *\n\t * @param host - The host element on which the events will be dispatched.\n\t * @param eventConfig - The configuration for the event.\n\t */\n\tconstructor(host: RadiantElement, eventConfig: EventEmitterConfig) {\n\t\tthis.host = host;\n\t\tthis.eventConfig = eventConfig;\n\t}\n\n\t/**\n\t * Emits a custom event with the specified detail.\n\t *\n\t * @param detail - The detail object to be passed along with the event.\n\t */\n\temit(detail?: T) {\n\t\tconst event = new CustomEvent(this.eventConfig.name, {\n\t\t\tdetail: detail,\n\t\t\tbubbles: this.eventConfig.bubbles,\n\t\t\tcancelable: this.eventConfig.cancelable,\n\t\t\tcomposed: this.eventConfig.composed,\n\t\t});\n\t\tthis.host.dispatchEvent(event);\n\t}\n}\n",
|
|
8
8
|
"import type { RadiantElement } from '../core/radiant-element';\nimport { EventEmitter, type EventEmitterConfig } from '../tools/event-emitter';\n\n/**\n * Creates an EventEmitter bound to a host element and registers it on the host.\n * Functional equivalent of the `@event` decorator for vanilla JS usage.\n * @param host The host element that will dispatch the events.\n * @param config {@link EventEmitterConfig} The event emitter configuration.\n */\nexport function createEvent<T = unknown>(host: RadiantElement, config: EventEmitterConfig): EventEmitter<T> {\n\tconst emitter = new EventEmitter<T>(host, config);\n\thost.registerEventEmitter(config.name, emitter);\n\treturn emitter;\n}\n",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"import type { RadiantElement } from '../../core/radiant-element';\nimport { createEvent } from '../../helpers/create-event';\nimport type { EventEmitterConfig } from '../../tools/event-emitter';\n\n/**\n * Decorator that attaches an EventEmitter to the class field property.\n * The EventEmitter can be used to dispatch custom events from the target element.\n * @param eventConfig Configuration for the event emitter.\n * @see {@link EventEmitter} for more details about how the EventEmitter works.\n */\nexport function event(eventConfig: EventEmitterConfig) {\n\treturn function <T extends RadiantElement, V>(_: undefined, context: ClassFieldDecoratorContext<T, V>) {\n\t\tcontext.addInitializer(function (this: T) {\n\t\t\tconst emitter = createEvent(this, eventConfig);\n\n\t\t\tObject.defineProperty(this, context.name, {\n\t\t\t\tget() {\n\t\t\t\t\treturn emitter;\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t});\n\t\t});\n\t};\n}\n",
|
|
11
11
|
"import { type EventEmitterConfig } from '../tools/event-emitter';\nimport type { RadiantElement } from '../core/radiant-element';\nimport { event as legacyEvent } from './legacy/event';\nimport { event as standardEvent } from './standard/event';\nimport { fieldDecoratorBridge } from './bridge';\n\n/**\n * Decorator that attaches an EventEmitter to the class field property.\n * The EventEmitter can be used to dispatch custom events from the target element.\n * @param eventConfig {@link EventEmitterConfig} Configuration for the event emitter.\n * @see {@link EventEmitter} for more details about how the EventEmitter works.\n */\nexport function event(eventConfig: EventEmitterConfig) {\n\tfunction decorator<THost extends RadiantElement, TValue>(\n\t\tprotoOrTarget: undefined,\n\t\tnameOrContext: ClassFieldDecoratorContext<THost, TValue>,\n\t): void;\n\tfunction decorator(protoOrTarget: RadiantElement, nameOrContext: string): void;\n\tfunction decorator(\n\t\tprotoOrTarget: RadiantElement | undefined,\n\t\tnameOrContext: string | ClassFieldDecoratorContext<RadiantElement, unknown>,\n\t): void {\n\t\treturn fieldDecoratorBridge(standardEvent(eventConfig), legacyEvent(eventConfig), protoOrTarget, nameOrContext);\n\t}\n\n\treturn decorator;\n}\n"
|
|
12
12
|
],
|
|
13
|
-
"mappings": "
|
|
14
|
-
"debugId": "
|
|
13
|
+
"mappings": "i0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,CAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,CAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,CAA+C,CAAC,EAAmB,CAClF,EAAsB,EAAU,CAA4B,EAUtD,SAAS,CAAuD,CACtE,EACA,EACO,CACP,IAAM,EAAS,EAEf,EACC,EACA,EACC,EAAO,KAAoD,IAAI,GAGjE,EAGD,SAAS,CAAqC,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAS,EACT,EAAkB,OAAO,UAAU,eAAe,KAAK,EAAQ,CAAG,EAAI,EAAO,GAAO,OAE1F,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAQ,EAAK,CAClC,MAAO,CAAC,CAAW,CACpB,CAAC,EAGF,SAAS,CAAuC,CAAC,EAA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EACZ,KAAK,YAAc,EAQpB,IAAI,CAAC,EAAY,CAChB,IAAM,EAAQ,IAAI,YAAY,KAAK,YAAY,KAAM,CACpD,OAAQ,EACR,QAAS,KAAK,YAAY,QAC1B,WAAY,KAAK,YAAY,WAC7B,SAAU,KAAK,YAAY,QAC5B,CAAC,EACD,KAAK,KAAK,cAAc,CAAK,EAE/B,CClCO,SAAS,CAAwB,CAAC,EAAsB,EAA6C,CAC3G,IAAM,EAAU,IAAI,EAAgB,EAAM,CAAM,EAEhD,OADA,EAAK,qBAAqB,EAAO,KAAM,CAAO,EACvC,ECDD,SAAS,CAAK,CAAC,EAAiC,CACtD,MAAO,CAAC,EAAuB,IAAwB,CACtD,EAAkC,EAAO,CAAC,IAAY,CACrD,IAAM,EAAU,EAAY,EAAS,CAAW,EAEhD,EAAQ,0BAA0B,IAAM,CACvC,OAAO,eAAe,EAAS,EAAa,CAC3C,GAAG,EAAG,CACL,OAAO,GAER,WAAY,GACZ,aAAc,EACf,CAAC,EACD,EACD,GCfI,SAAS,CAAK,CAAC,EAAiC,CACtD,OAAO,QAAsC,CAAC,EAAc,EAA2C,CACtG,EAAQ,eAAe,QAAS,EAAU,CACzC,IAAM,EAAU,EAAY,KAAM,CAAW,EAE7C,OAAO,eAAe,KAAM,EAAQ,KAAM,CACzC,GAAG,EAAG,CACL,OAAO,GAER,WAAY,GACZ,aAAc,EACf,CAAC,EACD,GCVI,SAAS,CAAK,CAAC,EAAiC,CAMtD,SAAS,CAAS,CACjB,EACA,EACO,CACP,OAAO,EAAqB,EAAc,CAAW,EAAG,EAAY,CAAW,EAAG,EAAe,CAAa,EAG/G,OAAO",
|
|
14
|
+
"debugId": "333385792090ECFD64756E2164756E21",
|
|
15
15
|
"names": []
|
|
16
16
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:t,getOwnPropertyNames:X,getOwnPropertyDescriptor:Y}=Object,U=Object.prototype.hasOwnProperty;function W(n){return this[n]}var nn=(n)=>{var c=(L??=new WeakMap).get(n),r;if(c)return c;if(c=t({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function"){for(var A of X(n))if(!U.call(c,A))t(c,A,{get:W.bind(n,A),enumerable:!(r=Y(n,A))||r.enumerable})}return L.set(n,c),c},L;var j=(n)=>n;function J(n,c){this[n]=j.bind(null,c)}var cn=(n,c)=>{for(var r in c)t(n,r,{get:c[r],enumerable:!0,configurable:!0,set:J.bind(c,r)})};var rn=(n,c)=>()=>(n&&(c=n(n=0)),c);var An=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(c,r)=>(typeof require<"u"?require:c)[r]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var E=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),M=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),S=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function x(n,c){o(n,E,c)}function Rn(n,c){o(n,M,c)}function Tn(n){K(n,E)}function gn(n,c){let r=n;I(n,c,r[S]??=new Set)}function o(n,c,r){let A=n,b=Object.prototype.hasOwnProperty.call(A,c)?A[c]:void 0;if(Array.isArray(b)){b.push(r);return}Object.defineProperty(A,c,{value:[r]})}function K(n,c){w(n,(r)=>{let A=r[c];if(!Array.isArray(A))return;for(let b of A)b(n)})}function I(n,c,r){for(let A of $(n)){let b=A[M];if(!Array.isArray(b))continue;for(let R of b){if(r.has(R))continue;R(n,c),r.add(R)}}}function $(n){let c=[],r=Object.getPrototypeOf(n);while(r&&r!==Object.prototype)c.unshift(r),r=Object.getPrototypeOf(r);return c}function w(n,c){for(let r of $(n))c(r)}function P(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function i(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(n))return"array";if(Object.prototype.toString.call(n)==="[object Object]")return"object"}function f(n){switch(n){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function N(n){try{return JSON.parse(n)}catch{throw TypeError("Invalid JSON string")}}var e={array(n){let c=N(n);if(!Array.isArray(c))throw TypeError(`Expected an array but got a value of type "${typeof c}"`);return c},boolean(n){return!(n==="0"||String(n).toLowerCase()==="false")},number(n){return Number(n.replace(/_/g,""))},object(n){let c=JSON.parse(n);if(c===null||typeof c!=="object"||Array.isArray(c))throw TypeError(`expected value of type "object" but instead got value "${n}" of type "${i(c)}"`);return c},string(n){return n}},s={default:Z,array:F,object:F};function F(n){return JSON.stringify(n)}function Z(n){return`${n}`}function T(n,c){let r=P(c);if(!r)throw TypeError(`[radiant-element] Unknown type "${c}"`);return e[r](n)}function H(n,c){let r=P(c);if(!r)throw TypeError(`[radiant-element] Unknown type "${c}"`);return(s[r]??s.default??Z)(n)}function z(n){return typeof n==="boolean"}function h(n){return typeof n==="number"}function V(n){return typeof n==="string"}function u(n){return Array.isArray(n)}function y(n){return typeof n==="object"&&!Array.isArray(n)&&n!==null}function _(n,c){switch(n){case Boolean:return z(c);case Number:return h(c);case String:return V(c);case Array:return u(c);case Object:return y(c);default:return!1}}var Bn=(n,c,r,A)=>{if(c===Boolean){let R=n.getAttribute(r);if(R===null)return A;return R===""?!0:T(R,c)}let b=n.getAttribute(r);return b!==null?T(b,c):A??f(c)};function q(n,c){if(c!==void 0&&!_(n,c))throw Error(`defaultValue does not match the expected type for ${n.name}`)}function vn(n,c,r,A){return{type:r,name:n,initialValue:A,attribute:c,converter:{fromAttribute:(b)=>T(b,r),toAttribute:(b)=>H(b,r)}}}function D(n){return n.shouldAutoBindReactiveMembers?.()??!1}function O(n){if(n instanceof Element)return n;if("host"in n)return n.host;return n.element}function l(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function p(n,c){if(c.converter?.fromAttribute){let r=c.converter.fromAttribute(n);if(n===null&&r===void 0&&"defaultValue"in c)return c.defaultValue;return r}if(c.type){if(n===null)return c.defaultValue??f(c.type);if(c.type===Boolean&&n==="")return!0;return T(n,c.type)}if(n===null)return c.defaultValue;return n}function m(n,c,r){return p(O(n).getAttribute(c),r)}function a(n,c,r,A){let b=A.converter?.toAttribute?A.converter.toAttribute(r):A.type?H(r,A.type):r==null?null:String(r);if(b===null){n.removeAttribute(c);return}n.setAttribute(c,b)}function G(n,c,r={}){if(r.type)q(r.type,r.defaultValue);let A=n,b=r.source??l(c),R=Symbol(`@ecopages/radiant/attr:${c}:observer`),v=r.bind??D(n);n.defineReactiveBinding(c,v);let Q=m(n,b,r),g=n.createReactiveMember(c,Q);Object.defineProperty(n,c,{get(){return g.get()},set(d){let B=O(this);a(B,b,d,r),g.set(m(this,b,r))},enumerable:!0,configurable:!0});let k=()=>{A[R]?.disconnect()},C=()=>{if(g.set(m(n,b,r)),typeof MutationObserver>"u")return;let d=O(n);k();let B=new MutationObserver(()=>{g.set(m(n,b,r))});B.observe(d,{attributeFilter:[b],attributes:!0}),A[R]=B};C(),n.registerConnectedCallback(C),n.registerCleanupCallback(k)}function xn(n={}){return(c,r)=>{let A=Symbol(`@ecopages/radiant/attr:${r}:installed`);x(c,(b)=>{b.registerConnectedCallback(()=>{if(b[A])return;let R=b[r],v=n.defaultValue===void 0?R:n.defaultValue;G(b,r,{...n,defaultValue:v}),b[A]=!0})})}}export{xn as reactiveAttr};
|
|
2
|
+
|
|
3
|
+
//# debugId=BE166ADA41EF1DF564756E2164756E21
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/utils/attribute-utils.ts", "../src/core/reactive-prop-core.ts", "../src/decorators/shared/auto-bind.ts", "../src/decorators/shared/reactive-attr.ts", "../src/decorators/legacy/attr.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
|
+
"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 { JsxBindingSourceValue, JsxRenderable, SubscribableJsxValueWithAccess } from '@ecopages/jsx';\nimport type { ReactiveState } from './reactivity-contract';\nimport {\n\ttype AttributeTypeConstant,\n\ttype ReadAttributeValueReturnType,\n\ttype WriteAttributeValueReturnType,\n\tisValueOfType,\n\treadAttributeValue,\n\twriteAttributeValue,\n} from '../utils/attribute-utils';\n\ntype StringPropertyKey<Value> = Extract<keyof Value, string>;\n\nexport interface ReactiveProperty<T = unknown> {\n\ttype: AttributeTypeConstant;\n\tinitialValue?: T;\n\tname: string;\n\tattribute: string;\n\tconverter: {\n\t\tfromAttribute: (value: string) => ReadAttributeValueReturnType;\n\t\ttoAttribute: (value: any) => WriteAttributeValueReturnType;\n\t};\n}\n\nexport type ReactivePropertyOptions<T> = {\n\ttype: AttributeTypeConstant;\n\treflect?: boolean;\n\tattribute?: string;\n\tdefaultValue?: T;\n\tbind?: boolean | string;\n};\n\nexport type ReactiveBindingOption = boolean | string;\n\nexport type ReactiveFieldOptions = {\n\tbind?: ReactiveBindingOption;\n\t/** When true, skip the initial notifyUpdate emitted while defining the field. */\n\tsuppressInitialNotify?: boolean;\n};\n\nexport type ReactiveBindingValue<\n\tHost extends object,\n\tProperty extends StringPropertyKey<Host>,\n> = Host[Property] extends JsxBindingSourceValue ? Host[Property] : JsxRenderable;\n\nexport type ReactiveBindings<Bindings extends object> = {\n\treadonly [Property in StringPropertyKey<Bindings>]: SubscribableJsxValueWithAccess<\n\t\tReactiveBindingValue<Bindings, Property>\n\t>;\n};\n\nexport type ReactiveAccessorDefinition<T> = {\n\tbind?: ReactiveBindingOption;\n\tsignal: ReactiveState<T>;\n\tonSet?: (value: T) => void;\n};\n\nexport function validateReactivePropertyDefault(type: AttributeTypeConstant, defaultValue: unknown): void {\n\tif (defaultValue !== undefined && !isValueOfType(type, defaultValue)) {\n\t\tthrow new Error(`defaultValue does not match the expected type for ${type.name}`);\n\t}\n}\n\nexport function createReactivePropertyMapping<T>(\n\tpropertyName: string,\n\tattributeKey: string,\n\ttype: AttributeTypeConstant,\n\tinitialValue: T | undefined,\n): ReactiveProperty<T> {\n\treturn {\n\t\ttype,\n\t\tname: propertyName,\n\t\tinitialValue,\n\t\tattribute: attributeKey,\n\t\tconverter: {\n\t\t\tfromAttribute: (value) => readAttributeValue(value, type),\n\t\t\ttoAttribute: (value) => writeAttributeValue(value, type),\n\t\t},\n\t};\n}\n",
|
|
8
|
+
"import type { ReactiveBindingOption } from '../../core/reactive-prop-core';\nimport type { ReactiveHostLike } from '../../core/reactive-host';\n\ntype AutoBindHost = ReactiveHostLike & {\n\tshouldAutoBindReactiveMembers?: () => boolean;\n};\n\nexport function resolveHostAutoBind(host: AutoBindHost): ReactiveBindingOption {\n\treturn host.shouldAutoBindReactiveMembers?.() ?? false;\n}\n",
|
|
9
|
+
"import type { ReactiveHostLike } from '../../core/reactive-host';\nimport { type ReactiveBindingOption, validateReactivePropertyDefault } from '../../core/reactive-prop-core';\nimport { resolveHostAutoBind } from './auto-bind';\nimport {\n\tdefaultValueForType,\n\treadAttributeValue,\n\ttype AttributeTypeConstant,\n\twriteAttributeValue,\n} from '../../utils/attribute-utils';\n\nexport type AttrConverter<T> = {\n\tfromAttribute?: (value: string | null) => T;\n\ttoAttribute?: (value: T) => string | null;\n};\n\nexport type AttrOptions<T = string | undefined> = {\n\tsource?: string;\n\ttype?: AttributeTypeConstant;\n\tbind?: ReactiveBindingOption;\n\tdefaultValue?: T;\n\tconverter?: AttrConverter<T>;\n};\n\ntype ReactiveAttributeHostApi<Bindings extends object = {}> = ReactiveHostLike<Bindings> & {\n\tregisterCleanupCallback(callback: () => void): void;\n\tregisterConnectedCallback(callback: () => void): void;\n};\n\nexport type ReactiveAttributeHostLike<Bindings extends object = {}> =\n\t| (ReactiveAttributeHostApi<Bindings> & Element)\n\t| (ReactiveAttributeHostApi<Bindings> & { host: Element })\n\t| (ReactiveAttributeHostApi<Bindings> & { element: Element });\n\nfunction resolveAttributeTarget(host: ReactiveAttributeHostLike): Element {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\treturn host.element;\n}\n\nfunction toAttributeName(propertyName: string): string {\n\treturn propertyName\n\t\t.replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n\t\t.replace(/_/g, '-')\n\t\t.toLowerCase();\n}\n\nfunction resolveAttributeValue<T>(rawValue: string | null, options: AttrOptions<T>): T {\n\tif (options.converter?.fromAttribute) {\n\t\tconst convertedValue = options.converter.fromAttribute(rawValue);\n\n\t\tif (rawValue === null && convertedValue === undefined && 'defaultValue' in options) {\n\t\t\treturn options.defaultValue as T;\n\t\t}\n\n\t\treturn convertedValue;\n\t}\n\n\tif (options.type) {\n\t\tif (rawValue === null) {\n\t\t\treturn (options.defaultValue ?? defaultValueForType(options.type)) as T;\n\t\t}\n\n\t\tif (options.type === Boolean && rawValue === '') {\n\t\t\treturn true as T;\n\t\t}\n\n\t\treturn readAttributeValue(rawValue, options.type) as T;\n\t}\n\n\tif (rawValue === null) {\n\t\treturn options.defaultValue as T;\n\t}\n\n\treturn rawValue as T;\n}\n\nfunction readReactiveAttributeValue<T>(\n\thost: ReactiveAttributeHostLike,\n\tattributeName: string,\n\toptions: AttrOptions<T>,\n): T {\n\treturn resolveAttributeValue(resolveAttributeTarget(host).getAttribute(attributeName), options);\n}\n\nfunction writeReactiveAttributeValue<T>(\n\ttarget: Element,\n\tattributeName: string,\n\tvalue: T,\n\toptions: AttrOptions<T>,\n): void {\n\tconst attributeValue = options.converter?.toAttribute\n\t\t? options.converter.toAttribute(value)\n\t\t: options.type\n\t\t\t? writeAttributeValue(value, options.type)\n\t\t\t: value == null\n\t\t\t\t? null\n\t\t\t\t: String(value);\n\n\tif (attributeValue === null) {\n\t\ttarget.removeAttribute(attributeName);\n\t\treturn;\n\t}\n\n\ttarget.setAttribute(attributeName, attributeValue);\n}\n\nexport function installReactiveAttribute<TBindings extends object, TValue>(\n\thost: ReactiveAttributeHostLike<TBindings>,\n\tpropertyName: string,\n\toptions: AttrOptions<TValue> = {},\n): void {\n\tif (options.type) {\n\t\tvalidateReactivePropertyDefault(options.type, options.defaultValue);\n\t}\n\n\tconst hostRecord = host as unknown as Record<PropertyKey, unknown>;\n\tconst attributeName = options.source ?? toAttributeName(propertyName);\n\tconst observerKey = Symbol(`@ecopages/radiant/attr:${propertyName}:observer`);\n\tconst bind = options.bind ?? resolveHostAutoBind(host);\n\n\thost.defineReactiveBinding(propertyName, bind);\n\n\tconst initialValue = readReactiveAttributeValue(host, attributeName, options);\n\tconst signal = host.createReactiveMember(propertyName, initialValue);\n\n\tObject.defineProperty(host, propertyName, {\n\t\tget() {\n\t\t\treturn signal.get();\n\t\t},\n\t\tset(newValue: TValue) {\n\t\t\tconst target = resolveAttributeTarget(this as ReactiveAttributeHostLike);\n\t\t\twriteReactiveAttributeValue(target, attributeName, newValue, options);\n\t\t\tsignal.set(readReactiveAttributeValue(this as ReactiveAttributeHostLike, attributeName, options));\n\t\t},\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n\n\tconst disconnectObserver = () => {\n\t\tconst observer = hostRecord[observerKey] as MutationObserver | undefined;\n\t\tobserver?.disconnect();\n\t};\n\n\tconst syncAndObserve = () => {\n\t\tsignal.set(readReactiveAttributeValue(host, attributeName, options));\n\n\t\tif (typeof MutationObserver === 'undefined') {\n\t\t\treturn;\n\t\t}\n\n\t\tconst target = resolveAttributeTarget(host);\n\n\t\tdisconnectObserver();\n\n\t\tconst observer = new MutationObserver(() => {\n\t\t\tsignal.set(readReactiveAttributeValue(host, attributeName, options));\n\t\t});\n\n\t\tobserver.observe(target, {\n\t\t\tattributeFilter: [attributeName],\n\t\t\tattributes: true,\n\t\t});\n\n\t\thostRecord[observerKey] = observer;\n\t};\n\n\tsyncAndObserve();\n\thost.registerConnectedCallback(syncAndObserve);\n\thost.registerCleanupCallback(disconnectObserver);\n}\n",
|
|
10
|
+
"import { installReactiveAttribute, type AttrOptions, type ReactiveAttributeHostLike } from '../shared/reactive-attr';\nimport { registerLegacyInstanceInitializer } from './instance-initializers';\n\nexport function reactiveAttr<TValue = string | undefined>(options: AttrOptions<TValue> = {}) {\n\treturn (target: ReactiveAttributeHostLike, propertyName: string) => {\n\t\tconst installedKey = Symbol(`@ecopages/radiant/attr:${propertyName}:installed`);\n\n\t\tregisterLegacyInstanceInitializer(target, (host) => {\n\t\t\t(host as ReactiveAttributeHostLike).registerConnectedCallback(() => {\n\t\t\t\tif ((host as unknown as Record<PropertyKey, unknown>)[installedKey]) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst initializerValue = (host as unknown as Record<PropertyKey, TValue | undefined>)[propertyName];\n\t\t\t\tconst defaultValue = (options.defaultValue === undefined ? initializerValue : options.defaultValue) as\n\t\t\t\t\tTValue | undefined;\n\n\t\t\t\tinstallReactiveAttribute(host as ReactiveAttributeHostLike, propertyName, {\n\t\t\t\t\t...options,\n\t\t\t\t\tdefaultValue,\n\t\t\t\t});\n\n\t\t\t\t(host as unknown as Record<PropertyKey, unknown>)[installedKey] = true;\n\t\t\t});\n\t\t});\n\t};\n}\n"
|
|
11
|
+
],
|
|
12
|
+
"mappings": "q0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,CAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO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ACf,EAAK,0BAA0B,CAAc,EAC7C,EAAK,wBAAwB,CAAkB,EC3KzC,SAAS,EAAyC,CAAC,EAA+B,CAAC,EAAG,CAC5F,MAAO,CAAC,EAAmC,IAAyB,CACnE,IAAM,EAAe,OAAO,0BAA0B,aAAwB,EAE9E,EAAkC,EAAQ,CAAC,IAAS,CAClD,EAAmC,0BAA0B,IAAM,CACnE,GAAK,EAAiD,GACrD,OAGD,IAAM,EAAoB,EAA4D,GAChF,EAAgB,EAAQ,eAAiB,OAAY,EAAmB,EAAQ,aAGtF,EAAyB,EAAmC,EAAc,IACtE,EACH,cACD,CAAC,EAEA,EAAiD,GAAgB,GAClE,EACD",
|
|
13
|
+
"debugId": "BE166ADA41EF1DF564756E2164756E21",
|
|
14
|
+
"names": []
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:w,getOwnPropertyNames:B,getOwnPropertyDescriptor:C}=Object,F=Object.prototype.hasOwnProperty;function G(f){return this[f]}var J=(f)=>{var j=(z??=new WeakMap).get(f),q;if(j)return j;if(j=w({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function"){for(var v of B(f))if(!F.call(j,v))w(j,v,{get:G.bind(f,v),enumerable:!(q=C(f,v))||q.enumerable})}return z.set(f,j),j},z;var H=(f)=>f;function I(f,j){this[f]=H.bind(null,j)}var L=(f,j)=>{for(var q in j)w(f,q,{get:j[q],enumerable:!0,configurable:!0,set:I.bind(j,q)})};var N=(f,j)=>()=>(f&&(j=f(f=0)),j);var O=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(j,q)=>(typeof require<"u"?require:j)[q]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});function S(f,j,q){let v=q.value;return{configurable:!0,get(){if(this===f.prototype||Object.prototype.hasOwnProperty.call(this,j))return v;let x=v.bind(this);return Object.defineProperty(this,j,{value:x,configurable:!0,writable:!0}),x}}}export{S as bound};
|
|
2
|
+
|
|
3
|
+
//# debugId=BDB3EE2E93E69C5564756E2164756E21
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { RadiantElement } from '../../core/radiant-element';\n\n/**\n * A decorator to bind a method to the instance.\n * @param target {@link RadiantElement}\n * @param propertyKey string\n * @param descriptor {@link PropertyDescriptor}\n * @returns\n */\nexport function bound(target: RadiantElement, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor {\n\tconst originalMethod = descriptor.value;\n\n\treturn {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\tif (this === (target as any).prototype || Object.prototype.hasOwnProperty.call(this, propertyKey)) {\n\t\t\t\treturn originalMethod;\n\t\t\t}\n\n\t\t\tconst boundMethod = originalMethod.bind(this);\n\t\t\tObject.defineProperty(this, propertyKey, {\n\t\t\t\tvalue: boundMethod,\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t});\n\t\t\treturn boundMethod;\n\t\t},\n\t};\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "i0BASO,SAAS,CAAK,CAAC,EAAwB,EAAqB,EAAoD,CACtH,IAAM,EAAiB,EAAW,MAElC,MAAO,CACN,aAAc,GACd,GAAG,EAAG,CACL,GAAI,OAAU,EAAe,WAAa,OAAO,UAAU,eAAe,KAAK,KAAM,CAAW,EAC/F,OAAO,EAGR,IAAM,EAAc,EAAe,KAAK,IAAI,EAM5C,OALA,OAAO,eAAe,KAAM,EAAa,CACxC,MAAO,EACP,aAAc,GACd,SAAU,EACX,CAAC,EACM,EAET",
|
|
8
|
+
"debugId": "BDB3EE2E93E69C5564756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:x,getOwnPropertyNames:D,getOwnPropertyDescriptor:F}=Object,H=Object.prototype.hasOwnProperty;function I(b){return this[b]}var P=(b)=>{var j=(y??=new WeakMap).get(b),k;if(j)return j;if(j=x({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var q of D(b))if(!H.call(j,q))x(j,q,{get:I.bind(b,q),enumerable:!(k=F(b,q))||k.enumerable})}return y.set(b,j),j},y;var J=(b)=>b;function K(b,j){this[b]=J.bind(null,j)}var Q=(b,j)=>{for(var k in j)x(b,k,{get:j[k],enumerable:!0,configurable:!0,set:K.bind(j,k)})};var V=(b,j)=>()=>(b&&(j=b(b=0)),j);var W=((b)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(j,k)=>(typeof require<"u"?require:j)[k]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var z=Symbol.for("@ecopages/radiant.customElementTagName");function B(b,j){b[z]=j}function Y(b){return b[z]}function R(b,j){return(k)=>{if(B(k,b),typeof customElements<"u"&&!customElements.get(b))customElements.define(b,k,j)}}export{R as customElement};
|
|
2
|
+
|
|
3
|
+
//# debugId=7AFE1E0D5470EC9864756E2164756E21
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"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",
|
|
6
6
|
"import { setCustomElementTagName } from '../../core/custom-element-metadata';\n\n/**\n * Registers a web component with the given name on the global `window.customElements` registry.\n * @param name selector name.\n * @param options {@link ElementDefinitionOptions}\n */\nexport function customElement(name: string, options?: ElementDefinitionOptions) {\n\treturn (target: CustomElementConstructor) => {\n\t\tsetCustomElementTagName(target, name);\n\n\t\tif (typeof customElements !== 'undefined' && !customElements.get(name)) {\n\t\t\tcustomElements.define(name, target, options);\n\t\t}\n\t};\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": "i0BAAO,IAAM,EAA0B,OAAO,IAAI,wCAAwC,EAYnF,SAAS,CAAuB,CAAC,EAAkC,EAAuB,CAC/F,EAAgD,GAA2B,EAQtE,SAAS,CAAuB,CAAC,EAAsD,CAC7F,OAAQ,EAAgD,GCflD,SAAS,CAAa,CAAC,EAAc,EAAoC,CAC/E,MAAO,CAAC,IAAqC,CAG5C,GAFA,EAAwB,EAAQ,CAAI,EAEhC,OAAO,eAAmB,KAAe,CAAC,eAAe,IAAI,CAAI,EACpE,eAAe,OAAO,EAAM,EAAQ,CAAO",
|
|
9
|
+
"debugId": "7AFE1E0D5470EC9864756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:P,getOwnPropertyNames:B,getOwnPropertyDescriptor:W}=Object,q=Object.prototype.hasOwnProperty;function x(r){return this[r]}var H=(r)=>{var y=(_??=new WeakMap).get(r),D;if(y)return y;if(y=P({},"__esModule",{value:!0}),r&&typeof r==="object"||typeof r==="function"){for(var M of B(r))if(!q.call(y,M))P(y,M,{get:x.bind(r,M),enumerable:!(D=W(r,M))||D.enumerable})}return _.set(r,y),y},_;var z=(r)=>r;function G(r,y){this[r]=z.bind(null,y)}var J=(r,y)=>{for(var D in y)P(r,D,{get:y[D],enumerable:!0,configurable:!0,set:G.bind(y,D)})};var L=(r,y)=>()=>(r&&(y=r(r=0)),y);var N=((r)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(y,D)=>(typeof require<"u"?require:y)[D]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});function f(r,y){let D=null,M=null,j,E=()=>{if(D!==null)clearTimeout(D),D=null},K=()=>{if(M===null)return j;let t=M;return M=null,E(),j=t(),j},F=function(...t){M=()=>r.apply(this,t),E(),D=setTimeout(()=>{K()},y)};return F.cancel=()=>{E(),M=null},F.flush=()=>{if(M===null)return j;return K()},F.pending=()=>M!==null,F}function U(r){return(y,D,M)=>{let j=M.value,E=new WeakMap;return M.value=function(...F){let t=E.get(this);if(!t)t=f((...p)=>{return j.apply(this,p)},r),E.set(this,t);t(...F)},M}}export{U as debounce};
|
|
2
|
+
|
|
3
|
+
//# debugId=59415678E1A7C55264756E2164756E21
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"import type { Method } from '../types';\n\n/**\n * A debounced function with imperative helpers for controlling pending work.\n *\n * @typeParam T The wrapped callback type.\n */\nexport interface DebouncedFunction<T extends Method> {\n\t(...args: Parameters<T>): void;\n\n\t/**\n\t * Cancels the pending callback invocation, if one exists.\n\t */\n\tcancel(): void;\n\n\t/**\n\t * Immediately invokes the latest pending callback invocation.\n\t *\n\t * @returns The callback result when a call is pending, or the last completed\n\t * result when no call is pending.\n\t */\n\tflush(): ReturnType<T> | undefined;\n\n\t/**\n\t * Reports whether the callback currently has a scheduled invocation.\n\t *\n\t * @returns True when a call is pending.\n\t */\n\tpending(): boolean;\n}\n\n/**\n * Creates a debounced wrapper around a function.\n *\n * The returned function delays invocation until the configured timeout has\n * elapsed since the latest call. It also exposes helpers to cancel, flush,\n * and inspect pending work.\n *\n * @typeParam T The wrapped callback type.\n * @param callback The callback to debounce.\n * @param timeout The debounce timeout in milliseconds.\n * @returns A debounced wrapper around the callback.\n */\nexport function debounce<T extends Method>(callback: T, timeout: number): DebouncedFunction<T> {\n\tlet timeoutRef: ReturnType<typeof setTimeout> | null = null;\n\tlet pendingInvocation: (() => ReturnType<T>) | null = null;\n\tlet lastResult: ReturnType<T> | undefined;\n\n\tconst clearPendingCall = () => {\n\t\tif (timeoutRef !== null) {\n\t\t\tclearTimeout(timeoutRef);\n\t\t\ttimeoutRef = null;\n\t\t}\n\t};\n\n\tconst invoke = (): ReturnType<T> | undefined => {\n\t\tif (pendingInvocation === null) {\n\t\t\treturn lastResult;\n\t\t}\n\n\t\tconst invocation = pendingInvocation;\n\t\tpendingInvocation = null;\n\t\tclearPendingCall();\n\t\tlastResult = invocation();\n\n\t\treturn lastResult;\n\t};\n\n\tconst debounced = function (this: ThisParameterType<T>, ...args: Parameters<T>) {\n\t\tpendingInvocation = () => callback.apply(this, args) as ReturnType<T>;\n\t\tclearPendingCall();\n\t\ttimeoutRef = setTimeout(() => {\n\t\t\tinvoke();\n\t\t}, timeout);\n\t} as DebouncedFunction<T>;\n\n\tdebounced.cancel = () => {\n\t\tclearPendingCall();\n\t\tpendingInvocation = null;\n\t};\n\n\tdebounced.flush = () => {\n\t\tif (pendingInvocation === null) {\n\t\t\treturn lastResult;\n\t\t}\n\n\t\treturn invoke();\n\t};\n\n\tdebounced.pending = () => pendingInvocation !== null;\n\n\treturn debounced;\n}\n",
|
|
6
6
|
"import type { RadiantElement } from '../../core/radiant-element';\nimport { debounce as debounceFunction } from '../../helpers/debounce';\n\nexport function debounce(\n\ttimeout: number,\n): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor {\n\treturn (_target: RadiantElement, _propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor => {\n\t\tconst originalMethod = descriptor.value;\n\t\tconst debouncedByInstance = new WeakMap<object, ReturnType<typeof debounceFunction<typeof originalMethod>>>();\n\n\t\tdescriptor.value = function debounce(this: object, ...args: Parameters<typeof originalMethod>) {\n\t\t\tlet debounced = debouncedByInstance.get(this);\n\n\t\t\tif (!debounced) {\n\t\t\t\tdebounced = debounceFunction((...innerArgs: Parameters<typeof originalMethod>) => {\n\t\t\t\t\treturn originalMethod.apply(this, innerArgs);\n\t\t\t\t}, timeout);\n\t\t\t\tdebouncedByInstance.set(this, debounced);\n\t\t\t}\n\n\t\t\tdebounced(...args);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": "i0BA2CO,SAAS,CAA0B,CAAC,EAAa,EAAuC,CAC9F,IAAI,EAAmD,KACnD,EAAkD,KAClD,EAEE,EAAmB,IAAM,CAC9B,GAAI,IAAe,KAClB,aAAa,CAAU,EACvB,EAAa,MAIT,EAAS,IAAiC,CAC/C,GAAI,IAAsB,KACzB,OAAO,EAGR,IAAM,EAAa,EAKnB,OAJA,EAAoB,KACpB,EAAiB,EACjB,EAAa,EAAW,EAEjB,GAGF,EAAY,QAAS,IAAgC,EAAqB,CAC/E,EAAoB,IAAM,EAAS,MAAM,KAAM,CAAI,EACnD,EAAiB,EACjB,EAAa,WAAW,IAAM,CAC7B,EAAO,GACL,CAAO,GAkBX,OAfA,EAAU,OAAS,IAAM,CACxB,EAAiB,EACjB,EAAoB,MAGrB,EAAU,MAAQ,IAAM,CACvB,GAAI,IAAsB,KACzB,OAAO,EAGR,OAAO,EAAO,GAGf,EAAU,QAAU,IAAM,IAAsB,KAEzC,ECxFD,SAAS,CAAQ,CACvB,EAC2F,CAC3F,MAAO,CAAC,EAAyB,EAAsB,IAAuD,CAC7G,IAAM,EAAiB,EAAW,MAC5B,EAAsB,IAAI,QAehC,OAbA,EAAW,MAAQ,QAAiB,IAAkB,EAAyC,CAC9F,IAAI,EAAY,EAAoB,IAAI,IAAI,EAE5C,GAAI,CAAC,EACJ,EAAY,EAAiB,IAAI,IAAiD,CACjF,OAAO,EAAe,MAAM,KAAM,CAAS,GACzC,CAAO,EACV,EAAoB,IAAI,KAAM,CAAS,EAGxC,EAAU,GAAG,CAAI,GAGX",
|
|
9
|
+
"debugId": "59415678E1A7C55264756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:N,getOwnPropertyNames:_,getOwnPropertyDescriptor:$}=Object,j=Object.prototype.hasOwnProperty;function q(A){return this[A]}var b=(A)=>{var B=(R??=new WeakMap).get(A),D;if(B)return B;if(B=N({},"__esModule",{value:!0}),A&&typeof A==="object"||typeof A==="function"){for(var G of _(A))if(!j.call(B,G))N(B,G,{get:q.bind(A,G),enumerable:!(D=$(A,G))||D.enumerable})}return R.set(A,B),B},R;var F=(A)=>A;function J(A,B){this[A]=F.bind(null,B)}var L=(A,B)=>{for(var D in B)N(A,D,{get:B[D],enumerable:!0,configurable:!0,set:J.bind(B,D)})};var T=(A,B)=>()=>(A&&(B=A(A=0)),B);var x=((A)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(A,{get:(B,D)=>(typeof require<"u"?require:B)[D]}):A)(function(A){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+A+'" is not supported')});var U=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),V=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),O=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function W(A,B){X(A,U,B)}function E(A,B){X(A,V,B)}function C(A){S(A,U)}function k(A,B){let D=A;K(A,B,D[O]??=new Set)}function X(A,B,D){let G=A,H=Object.prototype.hasOwnProperty.call(G,B)?G[B]:void 0;if(Array.isArray(H)){H.push(D);return}Object.defineProperty(G,B,{value:[D]})}function S(A,B){P(A,(D)=>{let G=D[B];if(!Array.isArray(G))return;for(let H of G)H(A)})}function K(A,B,D){for(let G of Y(A)){let H=G[V];if(!Array.isArray(H))continue;for(let M of H){if(D.has(M))continue;M(A,B),D.add(M)}}}function Y(A){let B=[],D=Object.getPrototypeOf(A);while(D&&D!==Object.prototype)B.unshift(D),D=Object.getPrototypeOf(D);return B}function P(A,B){for(let D of Y(A))B(D)}class Q{host;eventConfig;constructor(A,B){this.host=A,this.eventConfig=B}emit(A){let B=new CustomEvent(this.eventConfig.name,{detail:A,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(B)}}function Z(A,B){let D=new Q(A,B);return A.registerEventEmitter(B.name,D),D}function g(A){return(B,D)=>{W(B,(G)=>{let H=Z(G,A);G.registerConnectedCallback(()=>{Object.defineProperty(G,D,{get(){return H},enumerable:!0,configurable:!0})})})}}export{g as event};
|
|
2
|
+
|
|
3
|
+
//# debugId=B0666D678CB106BF64756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/tools/event-emitter.ts", "../src/helpers/create-event.ts", "../src/decorators/legacy/event.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
|
+
"import type { RadiantElement } from '../core/radiant-element';\n\nexport interface EventEmitterConfig {\n\tname: string;\n\tbubbles?: boolean;\n\tcancelable?: boolean;\n\tcomposed?: boolean;\n}\n\n/**\n * A generic event emitter class that allows emitting custom events.\n *\n * @template T - The type of the event detail.\n */\nexport class EventEmitter<T = unknown> {\n\tprivate host: RadiantElement;\n\tprivate eventConfig: EventEmitterConfig;\n\n\t/**\n\t * Constructs a new instance of the EventEmitter class.\n\t *\n\t * @param host - The host element on which the events will be dispatched.\n\t * @param eventConfig - The configuration for the event.\n\t */\n\tconstructor(host: RadiantElement, eventConfig: EventEmitterConfig) {\n\t\tthis.host = host;\n\t\tthis.eventConfig = eventConfig;\n\t}\n\n\t/**\n\t * Emits a custom event with the specified detail.\n\t *\n\t * @param detail - The detail object to be passed along with the event.\n\t */\n\temit(detail?: T) {\n\t\tconst event = new CustomEvent(this.eventConfig.name, {\n\t\t\tdetail: detail,\n\t\t\tbubbles: this.eventConfig.bubbles,\n\t\t\tcancelable: this.eventConfig.cancelable,\n\t\t\tcomposed: this.eventConfig.composed,\n\t\t});\n\t\tthis.host.dispatchEvent(event);\n\t}\n}\n",
|
|
7
|
+
"import type { RadiantElement } from '../core/radiant-element';\nimport { EventEmitter, type EventEmitterConfig } from '../tools/event-emitter';\n\n/**\n * Creates an EventEmitter bound to a host element and registers it on the host.\n * Functional equivalent of the `@event` decorator for vanilla JS usage.\n * @param host The host element that will dispatch the events.\n * @param config {@link EventEmitterConfig} The event emitter configuration.\n */\nexport function createEvent<T = unknown>(host: RadiantElement, config: EventEmitterConfig): EventEmitter<T> {\n\tconst emitter = new EventEmitter<T>(host, config);\n\thost.registerEventEmitter(config.name, emitter);\n\treturn emitter;\n}\n",
|
|
8
|
+
"import type { RadiantElement } from '../../core/radiant-element';\nimport { createEvent } from '../../helpers/create-event';\nimport type { EventEmitterConfig } from '../../tools/event-emitter';\nimport { registerLegacyInstanceInitializer } from './instance-initializers';\n\n/**\n * Decorator that attaches an EventEmitter to the class field property.\n * The EventEmitter can be used to dispatch custom events from the target element.\n * @param eventConfig Configuration for the event emitter.\n * @see {@link EventEmitter} for more details about how the EventEmitter works.\n */\nexport function event(eventConfig: EventEmitterConfig) {\n\treturn (proto: RadiantElement, propertyKey: string) => {\n\t\tregisterLegacyInstanceInitializer(proto, (element) => {\n\t\t\tconst emitter = createEvent(element, eventConfig);\n\n\t\t\telement.registerConnectedCallback(() => {\n\t\t\t\tObject.defineProperty(element, propertyKey, {\n\t\t\t\t\tget() {\n\t\t\t\t\t\treturn emitter;\n\t\t\t\t\t},\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": "i0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,CAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,CAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,CAA+C,CAAC,EAAmB,CAClF,EAAsB,EAAU,CAA4B,EAUtD,SAAS,CAAuD,CACtE,EACA,EACO,CACP,IAAM,EAAS,EAEf,EACC,EACA,EACC,EAAO,KAAoD,IAAI,GAGjE,EAGD,SAAS,CAAqC,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAS,EACT,EAAkB,OAAO,UAAU,eAAe,KAAK,EAAQ,CAAG,EAAI,EAAO,GAAO,OAE1F,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAQ,EAAK,CAClC,MAAO,CAAC,CAAW,CACpB,CAAC,EAGF,SAAS,CAAuC,CAAC,EAAa,EAAmB,CAChF,EAAmB,EAAU,CAAC,IAAc,CAC3C,IAAM,EAAgB,EAA2C,GAGjE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,OAGD,QAAW,KAAe,EACzB,EAAY,CAAQ,EAErB,EAGF,SAAS,CAAuE,CAC/E,EACA,EACA,EACO,CACP,QAAW,KAAa,EAAsB,CAAQ,EAAG,CACxD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
|
|
13
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:B,getOwnPropertyNames:M,getOwnPropertyDescriptor:N}=Object,Q=Object.prototype.hasOwnProperty;function R(b){return this[b]}var Y=(b)=>{var f=(E??=new WeakMap).get(b),j;if(f)return f;if(f=B({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var m of M(b))if(!Q.call(f,m))B(f,m,{get:R.bind(b,m),enumerable:!(j=N(b,m))||j.enumerable})}return E.set(b,f),f},E;var S=(b)=>b;function T(b,f){this[b]=S.bind(null,f)}var Z=(b,f)=>{for(var j in f)B(b,j,{get:f[j],enumerable:!0,configurable:!0,set:T.bind(f,j)})};var _=(b,f)=>()=>(b&&(f=b(b=0)),f);var $=((b)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(f,j)=>(typeof require<"u"?require:f)[j]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var F=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),G=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),U=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function v(b,f){J(b,F,f)}function w(b,f){J(b,G,f)}function H(b){V(b,F)}function D(b,f){let j=b;W(b,f,j[U]??=new Set)}function J(b,f,j){let m=b,q=Object.prototype.hasOwnProperty.call(m,f)?m[f]:void 0;if(Array.isArray(q)){q.push(j);return}Object.defineProperty(m,f,{value:[j]})}function V(b,f){X(b,(j)=>{let m=j[f];if(!Array.isArray(m))return;for(let q of m)q(b)})}function W(b,f,j){for(let m of K(b)){let q=m[G];if(!Array.isArray(q))continue;for(let A of q){if(j.has(A))continue;A(b,f),j.add(A)}}}function K(b){let f=[],j=Object.getPrototypeOf(b);while(j&&j!==Object.prototype)f.unshift(j),j=Object.getPrototypeOf(j);return f}function X(b,f){for(let j of K(b))f(j)}function C(b,f){switch(f){case"construct":H(b);break;case"connect":D(b,"connect");break;case"ssr":D(b,"ssr");break}}export{C as ensureLegacyHostReady};
|
|
2
|
+
|
|
3
|
+
//# debugId=8A50C1BFD40C1D4064756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/decorators/legacy/host-readiness.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
|
+
"import { runLegacyInstanceInitializers, runLegacyPostConstructionInitializers } from './instance-initializers';\n\nexport type LegacyHostReadinessPhase = 'construct' | 'connect' | 'ssr';\n\n/**\n * Runs legacy decorator initialization for the requested lifecycle phase.\n *\n * Post-construction work is idempotent — multiple calls with `connect` or `ssr`\n * only execute each registered initializer once per instance.\n */\nexport function ensureLegacyHostReady<T extends object>(host: T, phase: LegacyHostReadinessPhase): void {\n\tswitch (phase) {\n\t\tcase 'construct':\n\t\t\trunLegacyInstanceInitializers(host);\n\t\t\tbreak;\n\t\tcase 'connect':\n\t\t\trunLegacyPostConstructionInitializers(host, 'connect');\n\t\t\tbreak;\n\t\tcase 'ssr':\n\t\t\trunLegacyPostConstructionInitializers(host, 'ssr');\n\t\t\tbreak;\n\t}\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": "i0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,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,CAAS,EAG5C,OAAO,EAGR,SAAS,CAAoC,CAAC,EAAa,EAA0C,CACpG,QAAW,KAAa,EAAsB,CAAQ,EACrD,EAAM,CAAS,ECtIV,SAAS,CAAuC,CAAC,EAAS,EAAuC,CACvG,OAAQ,OACF,YACJ,EAA8B,CAAI,EAClC,UACI,UACJ,EAAsC,EAAM,SAAS,EACrD,UACI,MACJ,EAAsC,EAAM,KAAK,EACjD",
|
|
9
|
+
"debugId": "8A50C1BFD40C1D4064756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export type LegacyPostConstructionPhase = 'connect' | 'ssr';
|
|
1
2
|
type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;
|
|
3
|
+
type LegacyPostConstructionInitializer<T extends object = object> = (instance: T, phase: LegacyPostConstructionPhase) => void;
|
|
2
4
|
/**
|
|
3
5
|
* Registers per-instance initialization work for a legacy decorator.
|
|
4
6
|
*
|
|
@@ -13,7 +15,7 @@ export declare function registerLegacyInstanceInitializer<T extends object>(prot
|
|
|
13
15
|
* legacy decorators plus `useDefineForClassFields`, subclass field definition
|
|
14
16
|
* can overwrite values written during the base-class constructor.
|
|
15
17
|
*/
|
|
16
|
-
export declare function registerLegacyPostConstructionInitializer<T extends object>(proto: T, initializer:
|
|
18
|
+
export declare function registerLegacyPostConstructionInitializer<T extends object>(proto: T, initializer: LegacyPostConstructionInitializer<T>): void;
|
|
17
19
|
/**
|
|
18
20
|
* Runs all legacy decorator initializers for a newly constructed element.
|
|
19
21
|
*
|
|
@@ -28,5 +30,5 @@ export declare function runLegacyInstanceInitializers<T extends object>(instance
|
|
|
28
30
|
* Each initializer runs at most once per instance even if multiple lifecycle
|
|
29
31
|
* entrypoints call this helper.
|
|
30
32
|
*/
|
|
31
|
-
export declare function runLegacyPostConstructionInitializers<T extends object>(instance: T): void;
|
|
33
|
+
export declare function runLegacyPostConstructionInitializers<T extends object>(instance: T, phase: LegacyPostConstructionPhase): void;
|
|
32
34
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:B,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,M=Object.prototype.hasOwnProperty;function N(b){return this[b]}var W=(b)=>{var f=(D??=new WeakMap).get(b),j;if(f)return f;if(f=B({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var m of J(b))if(!M.call(f,m))B(f,m,{get:N.bind(b,m),enumerable:!(j=K(b,m))||j.enumerable})}return D.set(b,f),f},D;var Q=(b)=>b;function R(b,f){this[b]=Q.bind(null,f)}var X=(b,f)=>{for(var j in f)B(b,j,{get:f[j],enumerable:!0,configurable:!0,set:R.bind(f,j)})};var Y=(b,f)=>()=>(b&&(f=b(b=0)),f);var Z=((b)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(f,j)=>(typeof require<"u"?require:f)[j]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var E=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),F=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),S=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function $(b,f){G(b,E,f)}function O(b,f){G(b,F,f)}function v(b){T(b,E)}function w(b,f){let j=b;U(b,f,j[S]??=new Set)}function G(b,f,j){let m=b,q=Object.prototype.hasOwnProperty.call(m,f)?m[f]:void 0;if(Array.isArray(q)){q.push(j);return}Object.defineProperty(m,f,{value:[j]})}function T(b,f){V(b,(j)=>{let m=j[f];if(!Array.isArray(m))return;for(let q of m)q(b)})}function U(b,f,j){for(let m of H(b)){let q=m[F];if(!Array.isArray(q))continue;for(let A of q){if(j.has(A))continue;A(b,f),j.add(A)}}}function H(b){let f=[],j=Object.getPrototypeOf(b);while(j&&j!==Object.prototype)f.unshift(j),j=Object.getPrototypeOf(j);return f}function V(b,f){for(let j of H(b))f(j)}export{w as runLegacyPostConstructionInitializers,v as runLegacyInstanceInitializers,O as registerLegacyPostConstructionInitializer,$ as registerLegacyInstanceInitializer};
|
|
2
|
+
|
|
3
|
+
//# debugId=51B935C09DFC51CC64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "i0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,CAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,CAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,CAA+C,CAAC,EAAmB,CAClF,EAAsB,EAAU,CAA4B,EAUtD,SAAS,CAAuD,CACtE,EACA,EACO,CACP,IAAM,EAAS,EAEf,EACC,EACA,EACC,EAAO,KAAoD,IAAI,GAGjE,EAGD,SAAS,CAAqC,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAS,EACT,EAAkB,OAAO,UAAU,eAAe,KAAK,EAAQ,CAAG,EAAI,EAAO,GAAO,OAE1F,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAQ,EAAK,CAClC,MAAO,CAAC,CAAW,CACpB,CAAC,EAGF,SAAS,CAAuC,CAAC,EAAa,EAAmB,CAChF,EAAmB,EAAU,CAAC,IAAc,CAC3C,IAAM,EAAgB,EAA2C,GAGjE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,OAGD,QAAW,KAAe,EACzB,EAAY,CAAQ,EAErB,EAGF,SAAS,CAAuE,CAC/E,EACA,EACA,EACO,CACP,QAAW,KAAa,EAAsB,CAAQ,EAAG,CACxD,IAAM,EAAgB,EAA2C,GAGjE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,SAGD,QAAW,KAAe,EAAc,CACvC,GAAI,EAAqB,IAAI,CAAW,EACvC,SAGD,EAAY,EAAU,CAAK,EAC3B,EAAqB,IAAI,CAAW,IAKvC,SAAS,CAAuC,CAAC,EAAuB,CACvE,IAAM,EAAuB,CAAC,EAC1B,EAA2B,OAAO,eAAe,CAAQ,EAE7D,MAAO,GAAa,IAAc,OAAO,UACxC,EAAW,QAAQ,CAAS,EAC5B,EAAY,OAAO,eAAe,CAAS,EAG5C,OAAO,EAGR,SAAS,CAAoC,CAAC,EAAa,EAA0C,CACpG,QAAW,KAAa,EAAsB,CAAQ,EACrD,EAAM,CAAS",
|
|
8
|
+
"debugId": "51B935C09DFC51CC64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactiveBindingOption } from '../../core/reactive-prop-core';
|
|
2
|
+
import type { ReactiveHostLike } from '../../core/reactive-host';
|
|
3
|
+
/**
|
|
4
|
+
* Registers a member `State` early enough for subclass field initializers that
|
|
5
|
+
* read `this.$.member` (for example `this.$.preference.map(...)`).
|
|
6
|
+
*
|
|
7
|
+
* Post-construction setup still runs afterward to install accessors, SSR prop
|
|
8
|
+
* resolution, and attribute channels once class fields have finished writing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function bootstrapReactiveMemberBinding(host: ReactiveHostLike, propertyName: string, initialValue: unknown, bind?: ReactiveBindingOption): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:B,getOwnPropertyNames:D,getOwnPropertyDescriptor:E}=Object,F=Object.prototype.hasOwnProperty;function G(j){return this[j]}var J=(j)=>{var k=(C??=new WeakMap).get(j),q;if(k)return k;if(k=B({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var A of D(j))if(!F.call(k,A))B(k,A,{get:G.bind(j,A),enumerable:!(q=E(j,A))||q.enumerable})}return C.set(j,k),k},C;var H=(j)=>j;function I(j,k){this[j]=H.bind(null,k)}var K=(j,k)=>{for(var q in k)B(j,q,{get:k[q],enumerable:!0,configurable:!0,set:I.bind(k,q)})};var L=(j,k)=>()=>(j&&(k=j(j=0)),k);var M=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(k,q)=>(typeof require<"u"?require:k)[q]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});function Q(j,k,q,A=!1){if(j.getReactiveMember(k))return;if(j.createReactiveMember(k,q),A!==void 0&&A!==!1)j.defineReactiveBinding(k,A)}export{Q as bootstrapReactiveMemberBinding};
|
|
2
|
+
|
|
3
|
+
//# debugId=6148CFFC4D43F8A564756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/member-bootstrap.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { ReactiveBindingOption } from '../../core/reactive-prop-core';\nimport type { ReactiveHostLike } from '../../core/reactive-host';\n\n/**\n * Registers a member `State` early enough for subclass field initializers that\n * read `this.$.member` (for example `this.$.preference.map(...)`).\n *\n * Post-construction setup still runs afterward to install accessors, SSR prop\n * resolution, and attribute channels once class fields have finished writing.\n */\nexport function bootstrapReactiveMemberBinding(\n\thost: ReactiveHostLike,\n\tpropertyName: string,\n\tinitialValue: unknown,\n\tbind: ReactiveBindingOption = false,\n): void {\n\tif (host.getReactiveMember(propertyName)) {\n\t\treturn;\n\t}\n\n\thost.createReactiveMember(propertyName, initialValue);\n\n\tif (bind !== undefined && bind !== false) {\n\t\thost.defineReactiveBinding(propertyName, bind);\n\t}\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "i0BAUO,SAAS,CAA8B,CAC7C,EACA,EACA,EACA,EAA8B,GACvB,CACP,GAAI,EAAK,kBAAkB,CAAY,EACtC,OAKD,GAFA,EAAK,qBAAqB,EAAc,CAAY,EAEhD,IAAS,QAAa,IAAS,GAClC,EAAK,sBAAsB,EAAc,CAAI",
|
|
8
|
+
"debugId": "6148CFFC4D43F8A564756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:U,getOwnPropertyNames:E,getOwnPropertyDescriptor:I}=Object,H=Object.prototype.hasOwnProperty;function b(x){return this[x]}var w=(x)=>{var $=(Y??=new WeakMap).get(x),F;if($)return $;if($=U({},"__esModule",{value:!0}),x&&typeof x==="object"||typeof x==="function"){for(var N of E(x))if(!H.call($,N))U($,N,{get:b.bind(x,N),enumerable:!(F=I(x,N))||F.enumerable})}return Y.set(x,$),$},Y;var m=(x)=>x;function L(x,$){this[x]=m.bind(null,$)}var p=(x,$)=>{for(var F in $)U(x,F,{get:$[F],enumerable:!0,configurable:!0,set:L.bind($,F)})};var f=(x,$)=>()=>(x&&($=x(x=0)),$);var d=((x)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:($,F)=>(typeof require<"u"?require:$)[F]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var Z=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),q=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),C=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function J(x,$){M(x,Z,$)}function h(x,$){M(x,q,$)}function l(x){k(x,Z)}function r(x,$){let F=x;v(x,$,F[C]??=new Set)}function M(x,$,F){let N=x,_=Object.prototype.hasOwnProperty.call(N,$)?N[$]:void 0;if(Array.isArray(_)){_.push(F);return}Object.defineProperty(N,$,{value:[F]})}function k(x,$){z(x,(F)=>{let N=F[$];if(!Array.isArray(N))return;for(let _ of N)_(x)})}function v(x,$,F){for(let N of O(x)){let _=N[q];if(!Array.isArray(_))continue;for(let W of _){if(F.has(W))continue;W(x,$),F.add(W)}}}function O(x){let $=[],F=Object.getPrototypeOf(x);while(F&&F!==Object.prototype)$.unshift(F),F=Object.getPrototypeOf(F);return $}function z(x,$){for(let F of O(x))$(F)}function S(x){let $=globalThis.CSS;if(typeof $?.escape==="function")return $.escape(x);let F="";for(let N=0;N<x.length;N+=1){let _=x[N]??"",W=_.codePointAt(0)??0;if(W===0){F+="�";continue}let j=W>=1&&W<=31||W===127,B=N===0&&W>=48&&W<=57,D=N===1&&W>=48&&W<=57&&(x[0]??"")==="-",G=N===0&&_==="-"&&x.length===1;if(j||B||D){F+=`\\${W.toString(16)} `;continue}if(W>=128||_==="-"||_==="_"||W>=48&&W<=57||W>=65&&W<=90||W>=97&&W<=122){F+=G?`\\${_}`:_;continue}F+=`\\${_}`}return F}var P=Symbol("radiant.shadowRootListenerHooks"),T=Symbol("radiant.patchedAttachShadow");function R(x){if(x instanceof Element)return x;if("host"in x)return x.host;return x.element}function y(x){return!(x instanceof Element)}function K(x,$,F,N){let _=(W)=>{if(W.target instanceof Element&&W.target.matches(F))N(W)};return x.addEventListener($.type,_,$.options),()=>{x.removeEventListener($.type,_,$.options)}}function u(x,$){let F=R(x);if(!F[P])F[P]=new Set;if(F[P].add($),F[T])return;let N=F.attachShadow;F.attachShadow=function(W){let j=N.call(this,W);for(let B of F[P]??[])B();return j},F[T]=!0}function A(x,$,F){if(y(x)&&"scope"in $&&$.scope&&$.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let N=R(x),_=F.bind(x),W=null,j=null,B=null,D=null,G=!1,V=()=>{W?.(),j?.(),B?.(),D?.(),W=null,j=null,B=null,D=null},Q=()=>{if(G)return;if("window"in $&&!W)window.addEventListener($.type,_,$.options),W=()=>{window.removeEventListener($.type,_,$.options)};if("document"in $&&!j)document.addEventListener($.type,_,$.options),j=()=>{document.removeEventListener($.type,_,$.options)};if("selector"in $||"ref"in $){let X="selector"in $?$.selector:`[data-ref='${S($.ref)}']`;if($.scope!=="shadow"&&!B)B=K(N,$,X,_);if($.scope!=="light"&&N.shadowRoot&&!D)D=K(N.shadowRoot,$,X,_)}};if("selector"in $||"ref"in $){if($.scope!=="light")u(x,()=>{if(x.isConnected)Q()})}if(x.registerConnectedCallback(Q),x.registerCleanupCallback(V),x.isConnected)Q();return()=>{G=!0,V()}}function o(x){return($,F,N)=>{let _=N.value;return J($,(W)=>{A(W,x,_.bind(W))}),N}}export{o as onEvent};
|
|
2
|
+
|
|
3
|
+
//# debugId=A4C6EEE50677B32A64756E2164756E21
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/tools/escape-css-identifier.ts", "../src/helpers/create-event-listener.ts", "../src/decorators/legacy/on-event.ts"],
|
|
4
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:
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
6
|
"export function escapeCssIdentifier(value: string): string {\n\tconst cssNamespace = globalThis.CSS as { escape?: (value: string) => string } | undefined;\n\n\tif (typeof cssNamespace?.escape === 'function') {\n\t\treturn cssNamespace.escape(value);\n\t}\n\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 && 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",
|
|
7
7
|
"import type { RadiantElementEventListener } from '../core/radiant-element';\nimport { escapeCssIdentifier } from '../tools/escape-css-identifier';\n\n/**\n * Selects which DOM tree delegated event listeners should observe.\n */\nexport type OnEventScope = 'light' | 'shadow' | 'both';\n\ntype BaseOnEventConfig = Pick<RadiantElementEventListener, 'type' | 'options'> & {\n\tscope?: OnEventScope;\n};\n\nexport type OnEventConfig = BaseOnEventConfig &\n\t(\n\t\t| {\n\t\t\t\tselector: string;\n\t\t }\n\t\t| {\n\t\t\t\tref: string;\n\t\t }\n\t\t| {\n\t\t\t\twindow: true;\n\t\t }\n\t\t| {\n\t\t\t\tdocument: true;\n\t\t }\n\t);\n\ntype DelegatedEventRoot = Element | ShadowRoot;\n\ntype EventListenerLifecycleHost = {\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tisConnected: boolean;\n};\n\nexport type EventListenerHost =\n\t| (EventListenerLifecycleHost & Element)\n\t| (EventListenerLifecycleHost & { host: Element })\n\t| (EventListenerLifecycleHost & { element: Element });\n\nconst shadowRootListenerHooksKey = Symbol('radiant.shadowRootListenerHooks');\nconst patchedAttachShadowKey = Symbol('radiant.patchedAttachShadow');\n\ntype ShadowRootHookHost = Element & {\n\t[patchedAttachShadowKey]?: true;\n\t[shadowRootListenerHooksKey]?: Set<() => void>;\n};\n\nfunction resolveEventListenerHostElement(host: EventListenerHost): Element {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\treturn host.element;\n}\n\nfunction isControllerEventHost(host: EventListenerHost): host is EventListenerLifecycleHost & { host: Element } {\n\treturn !(host instanceof Element);\n}\n\nfunction addDelegatedListener(\n\troot: DelegatedEventRoot,\n\tconfig: Pick<OnEventConfig, 'type' | 'options'>,\n\tselector: string,\n\tlistener: EventListener,\n): () => void {\n\tconst delegatedListener = (event: Event) => {\n\t\tif (event.target instanceof Element && event.target.matches(selector)) {\n\t\t\tlistener(event);\n\t\t}\n\t};\n\n\troot.addEventListener(config.type, delegatedListener, config.options);\n\n\treturn () => {\n\t\troot.removeEventListener(config.type, delegatedListener, config.options);\n\t};\n}\n\nfunction registerShadowRootHook(host: EventListenerHost, hook: () => void): void {\n\tconst shadowAwareHost = resolveEventListenerHostElement(host) as ShadowRootHookHost;\n\n\tif (!shadowAwareHost[shadowRootListenerHooksKey]) {\n\t\tshadowAwareHost[shadowRootListenerHooksKey] = new Set();\n\t}\n\n\tshadowAwareHost[shadowRootListenerHooksKey].add(hook);\n\n\tif (shadowAwareHost[patchedAttachShadowKey]) {\n\t\treturn;\n\t}\n\n\tconst originalAttachShadow = shadowAwareHost.attachShadow;\n\n\tshadowAwareHost.attachShadow = function patchedAttachShadow(init: ShadowRootInit): ShadowRoot {\n\t\tconst shadowRoot = originalAttachShadow.call(this, init);\n\t\tfor (const shadowRootHook of shadowAwareHost[shadowRootListenerHooksKey] ?? []) {\n\t\t\tshadowRootHook();\n\t\t}\n\t\treturn shadowRoot;\n\t};\n\n\tshadowAwareHost[patchedAttachShadowKey] = true;\n}\n\n/**\n * Subscribes to a DOM event with delegation, window, or document targeting.\n * Functional equivalent of the `@onEvent` decorator for vanilla JS usage.\n * Returns a cleanup function to remove the listener.\n * @param host The host RadiantElement.\n * @param config The event listener configuration.\n * @param callback The event handler function.\n */\nexport function createEventListener(\n\thost: EventListenerHost,\n\tconfig: OnEventConfig,\n\tcallback: (event: Event) => void,\n): () => void {\n\tif (isControllerEventHost(host) && 'scope' in config && config.scope && config.scope !== 'light') {\n\t\tthrow new Error('RadiantController event listeners only support light DOM scope.');\n\t}\n\n\tconst hostElement = resolveEventListenerHostElement(host);\n\tconst boundCallback = callback.bind(host);\n\tlet windowCleanup: (() => void) | null = null;\n\tlet documentCleanup: (() => void) | null = null;\n\tlet lightCleanup: (() => void) | null = null;\n\tlet shadowCleanup: (() => void) | null = null;\n\tlet disposed = false;\n\n\tconst detachListeners = () => {\n\t\twindowCleanup?.();\n\t\tdocumentCleanup?.();\n\t\tlightCleanup?.();\n\t\tshadowCleanup?.();\n\n\t\twindowCleanup = null;\n\t\tdocumentCleanup = null;\n\t\tlightCleanup = null;\n\t\tshadowCleanup = null;\n\t};\n\n\tconst attachListeners = () => {\n\t\tif (disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ('window' in config && !windowCleanup) {\n\t\t\twindow.addEventListener(config.type, boundCallback, config.options);\n\t\t\twindowCleanup = () => {\n\t\t\t\twindow.removeEventListener(config.type, boundCallback, config.options);\n\t\t\t};\n\t\t}\n\n\t\tif ('document' in config && !documentCleanup) {\n\t\t\tdocument.addEventListener(config.type, boundCallback, config.options);\n\t\t\tdocumentCleanup = () => {\n\t\t\t\tdocument.removeEventListener(config.type, boundCallback, config.options);\n\t\t\t};\n\t\t}\n\n\t\tif ('selector' in config || 'ref' in config) {\n\t\t\tconst selector = 'selector' in config ? config.selector : `[data-ref='${escapeCssIdentifier(config.ref)}']`;\n\n\t\t\tif (config.scope !== 'shadow' && !lightCleanup) {\n\t\t\t\tlightCleanup = addDelegatedListener(hostElement, config, selector, boundCallback);\n\t\t\t}\n\n\t\t\tif (config.scope !== 'light' && hostElement.shadowRoot && !shadowCleanup) {\n\t\t\t\tshadowCleanup = addDelegatedListener(hostElement.shadowRoot, config, selector, boundCallback);\n\t\t\t}\n\t\t}\n\t};\n\n\tif ('selector' in config || 'ref' in config) {\n\t\tif (config.scope !== 'light') {\n\t\t\tregisterShadowRootHook(host, () => {\n\t\t\t\tif (host.isConnected) {\n\t\t\t\t\tattachListeners();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\thost.registerConnectedCallback(attachListeners);\n\thost.registerCleanupCallback(detachListeners);\n\n\tif (host.isConnected) {\n\t\tattachListeners();\n\t}\n\n\treturn () => {\n\t\tdisposed = true;\n\t\tdetachListeners();\n\t};\n}\n",
|
|
8
8
|
"import { createEventListener, type EventListenerHost } from '../../helpers/create-event-listener';\nimport type { OnEventConfig } from '../on-event';\nimport { registerLegacyInstanceInitializer } from './instance-initializers';\n\n/**\n * A decorator to subscribe to an event on the target element.\n * The event listener will be automatically unsubscribed when the element is disconnected.\n *\n * Note: This decorator uses event delegation, which means it relies on event bubbling.\n * Therefore, it will not work with events that do not bubble, such as `focus`, `blur`, `load`, `unload`, `scroll`, etc.\n * For focus and blur events, consider using `focusin` and `focusout` which are similar but do bubble.\n *\n * @param eventConfig The event configuration.\n * @param eventConfig.selectors The CSS selector(s) of the target element(s).\n * @param eventConfig.ref The data-ref attribute of the target element.\n * @param eventConfig.type The type of the event to listen for.\n * @param eventConfig.options Optional. An options object that specifies characteristics about the event listener.\n */\nexport function onEvent(eventConfig: OnEventConfig) {\n\treturn (proto: EventListenerHost, _: string, descriptor: PropertyDescriptor) => {\n\t\tconst originalMethod = descriptor.value;\n\n\t\tregisterLegacyInstanceInitializer(proto, (element) => {\n\t\t\tcreateEventListener(element, eventConfig, originalMethod.bind(element));\n\t\t});\n\n\t\treturn descriptor;\n\t};\n}\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": "
|
|
11
|
-
"debugId": "
|
|
10
|
+
"mappings": "i0BAQA,IAA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O,KAAM,EAAe,EAAO,OAAO,EACpE,EAAkB,IAAM,CACvB,SAAS,oBAAoB,EAAO,KAAM,EAAe,EAAO,OAAO,GAIzE,GAAI,aAAc,GAAU,QAAS,EAAQ,CAC5C,IAAM,EAAW,aAAc,EAAS,EAAO,SAAW,cAAc,EAAoB,EAAO,GAAG,MAEtG,GAAI,EAAO,QAAU,UAAY,CAAC,EACjC,EAAe,EAAqB,EAAa,EAAQ,EAAU,CAAa,EAGjF,GAAI,EAAO,QAAU,SAAW,EAAY,YAAc,CAAC,EAC1D,EAAgB,EAAqB,EAAY,WAAY,EAAQ,EAAU,CAAa,IAK/F,GAAI,aAAc,GAAU,QAAS,GACpC,GAAI,EAAO,QAAU,QACpB,EAAuB,EAAM,IAAM,CAClC,GAAI,EAAK,YACR,EAAgB,EAEjB,EAOH,GAHA,EAAK,0BAA0B,CAAe,EAC9C,EAAK,wBAAwB,CAAe,EAExC,EAAK,YACR,EAAgB,EAGjB,MAAO,IAAM,CACZ,EAAW,GACX,EAAgB,GCpLX,SAAS,CAAO,CAAC,EAA4B,CACnD,MAAO,CAAC,EAA0B,EAAW,IAAmC,CAC/E,IAAM,EAAiB,EAAW,MAMlC,OAJA,EAAkC,EAAO,CAAC,IAAY,CACrD,EAAoB,EAAS,EAAa,EAAe,KAAK,CAAO,CAAC,EACtE,EAEM",
|
|
11
|
+
"debugId": "A4C6EEE50677B32A64756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:G,getOwnPropertyNames:U,getOwnPropertyDescriptor:V}=Object,W=Object.prototype.hasOwnProperty;function X(f){return this[f]}var w=(f)=>{var j=(H??=new WeakMap).get(f),q;if(j)return j;if(j=G({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function"){for(var A of U(f))if(!W.call(j,A))G(j,A,{get:X.bind(f,A),enumerable:!(q=V(f,A))||q.enumerable})}return H.set(f,j),j},H;var Y=(f)=>f;function Z(f,j){this[f]=Y.bind(null,j)}var C=(f,j)=>{for(var q in j)G(f,q,{get:j[q],enumerable:!0,configurable:!0,set:Z.bind(j,q)})};var M=(f,j)=>()=>(f&&(j=f(f=0)),j);var P=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(j,q)=>(typeof require<"u"?require:j)[q]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var J=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),Q=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),_=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function R(f,j){S(f,J,j)}function x(f,j){S(f,Q,j)}function N(f){$(f,J)}function O(f,j){let q=f;b(f,j,q[_]??=new Set)}function S(f,j,q){let A=f,B=Object.prototype.hasOwnProperty.call(A,j)?A[j]:void 0;if(Array.isArray(B)){B.push(q);return}Object.defineProperty(A,j,{value:[q]})}function $(f,j){v(f,(q)=>{let A=q[j];if(!Array.isArray(A))return;for(let B of A)B(f)})}function b(f,j,q){for(let A of T(f)){let B=A[Q];if(!Array.isArray(B))continue;for(let D of B){if(q.has(D))continue;D(f,j),q.add(D)}}}function T(f){let j=[],q=Object.getPrototypeOf(f);while(q&&q!==Object.prototype)j.unshift(q),q=Object.getPrototypeOf(q);return j}function v(f,j){for(let q of T(f))j(q)}function h(f){return(j,q)=>{let A=Symbol(`@ecopages/radiant/on-updated:${q}:cleanup`);R(j,(B)=>{B.registerConnectedCallback(()=>{let D=B[q].bind(B),E=[];if(Array.isArray(f))for(let F of f)E.push(B.registerUpdateCallback(F,D));else if(typeof f==="string")E.push(B.registerUpdateCallback(f,D));B[A]=()=>{for(let F of E)F()}}),B.registerCleanupCallback(()=>{let D=B[A];if(typeof D==="function")D(),delete B[A]})})}}export{h as onUpdated};
|
|
2
|
+
|
|
3
|
+
//# debugId=D4987C6FF919A5F564756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/decorators/legacy/on-updated.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type LegacyPostConstructionPhase = 'connect' | 'ssr';\n\ntype LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\ntype LegacyPostConstructionInitializer<T extends object = object> = (\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyPostConstructionInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyPostConstructionInitializersOnPrototypeChain(\n\t\tinstance,\n\t\tphase,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<\n\t\t\tLegacyPostConstructionInitializer<T>\n\t\t>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(\n\tproto: T,\n\tkey: symbol,\n\tinitializer: LegacyInstanceInitializer<T> | LegacyPostConstructionInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(instance: T, key: symbol): void {\n\twalkPrototypeChain(instance, (prototype) => {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as\n\t\t\tLegacyInstanceInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t});\n}\n\nfunction runLegacyPostConstructionInitializersOnPrototypeChain<T extends object>(\n\tinstance: T,\n\tphase: LegacyPostConstructionPhase,\n\texecutedInitializers: Set<LegacyPostConstructionInitializer<T>>,\n): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tconst initializers = (prototype as Record<PropertyKey, unknown>)[LEGACY_POST_CONSTRUCTION_INITIALIZERS] as\n\t\t\tLegacyPostConstructionInitializer<T>[] | undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tif (executedInitializers.has(initializer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tinitializer(instance, phase);\n\t\t\texecutedInitializers.add(initializer);\n\t\t}\n\t}\n}\n\nfunction collectPrototypeChain<T extends object>(instance: T): object[] {\n\tconst prototypes: object[] = [];\n\tlet prototype: object | null = Object.getPrototypeOf(instance);\n\n\twhile (prototype && prototype !== Object.prototype) {\n\t\tprototypes.unshift(prototype);\n\t\tprototype = Object.getPrototypeOf(prototype);\n\t}\n\n\treturn prototypes;\n}\n\nfunction walkPrototypeChain<T extends object>(instance: T, visit: (prototype: object) => void): void {\n\tfor (const prototype of collectPrototypeChain(instance)) {\n\t\tvisit(prototype);\n\t}\n}\n",
|
|
6
|
+
"type LegacyUpdatedHost = {\n\tregisterCleanupCallback(callback: () => void): void;\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterUpdateCallback(key: string, update: () => void): () => void;\n};\n\nimport { registerLegacyInstanceInitializer } from './instance-initializers';\n\n/**\n * A decorator to subscribe to an updated callback when a reactive field or property changes.\n * @param eventConfig The event configuration.\n */\nexport function onUpdated(keyOrKeys: string | string[]) {\n\treturn (target: LegacyUpdatedHost, methodName: string) => {\n\t\tconst cleanupKey = Symbol(`@ecopages/radiant/on-updated:${methodName}:cleanup`);\n\n\t\tregisterLegacyInstanceInitializer(target, (element) => {\n\t\t\telement.registerConnectedCallback(() => {\n\t\t\t\tconst boundedMethod = (element as any)[methodName].bind(element);\n\t\t\t\tconst cleanups: Array<() => void> = [];\n\n\t\t\t\tif (Array.isArray(keyOrKeys)) {\n\t\t\t\t\tfor (const key of keyOrKeys) {\n\t\t\t\t\t\tcleanups.push(element.registerUpdateCallback(key, boundedMethod));\n\t\t\t\t\t}\n\t\t\t\t} else if (typeof keyOrKeys === 'string') {\n\t\t\t\t\tcleanups.push(element.registerUpdateCallback(keyOrKeys, boundedMethod));\n\t\t\t\t}\n\n\t\t\t\t(element as unknown as Record<PropertyKey, unknown>)[cleanupKey] = () => {\n\t\t\t\t\tfor (const cleanup of cleanups) {\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t});\n\n\t\t\telement.registerCleanupCallback(() => {\n\t\t\t\tconst cleanup = (element as unknown as Record<PropertyKey, unknown>)[cleanupKey];\n\n\t\t\t\tif (typeof cleanup === 'function') {\n\t\t\t\t\tcleanup();\n\t\t\t\t\tdelete (element as unknown as Record<PropertyKey, unknown>)[cleanupKey];\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t};\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": "i0BAQA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,CAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,CAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,CAA+C,CAAC,EAAmB,CAClF,EAAsB,EAAU,CAA4B,EAUtD,SAAS,CAAuD,CACtE,EACA,EACO,CACP,IAAM,EAAS,EAEf,EACC,EACA,EACC,EAAO,KAAoD,IAAI,GAGjE,EAGD,SAAS,CAAqC,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAS,EACT,EAAkB,OAAO,UAAU,eAAe,KAAK,EAAQ,CAAG,EAAI,EAAO,GAAO,OAE1F,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAQ,EAAK,CAClC,MAAO,CAAC,CAAW,CACpB,CAAC,EAGF,SAAS,CAAuC,CAAC,EAAa,EAAmB,CAChF,EAAmB,EAAU,CAAC,IAAc,CAC3C,IAAM,EAAgB,EAA2C,GAGjE,GAAI,CAAC,MAAM,QAAQ,CAAY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E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var{defineProperty:$,getOwnPropertyNames:O,getOwnPropertyDescriptor:Q}=Object,x=Object.prototype.hasOwnProperty;function T(j){return this[j]}var m=(j)=>{var H=(G??=new WeakMap).get(j),M;if(H)return H;if(H=$({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var W of O(j))if(!x.call(H,W))$(H,W,{get:T.bind(j,W),enumerable:!(M=Q(j,W))||M.enumerable})}return G.set(j,H),H},G;var f=(j)=>j;function K(j,H){this[j]=f.bind(null,H)}var C=(j,H)=>{for(var M in H)$(j,M,{get:H[M],enumerable:!0,configurable:!0,set:K.bind(H,M)})};var P=(j,H)=>()=>(j&&(H=j(j=0)),H);var g=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(H,M)=>(typeof require<"u"?require:H)[M]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var U=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),w=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),L=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function B(j,H){V(j,U,H)}function I(j,H){V(j,w,H)}function d(j){_(j,U)}function k(j,H){let M=j;N(j,H,M[L]??=new Set)}function V(j,H,M){let W=j,Y=Object.prototype.hasOwnProperty.call(W,H)?W[H]:void 0;if(Array.isArray(Y)){Y.push(M);return}Object.defineProperty(W,H,{value:[M]})}function _(j,H){b(j,(M)=>{let W=M[H];if(!Array.isArray(W))return;for(let Y of W)Y(j)})}function N(j,H,M){for(let W of q(j)){let Y=W[w];if(!Array.isArray(Y))continue;for(let Z of Y){if(M.has(Z))continue;Z(j,H),M.add(Z)}}}function q(j){let H=[],M=Object.getPrototypeOf(j);while(M&&M!==Object.prototype)H.unshift(M),M=Object.getPrototypeOf(M);return H}function b(j,H){for(let M of q(j))H(M)}var D=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),v=Symbol.for("@ecopages/radiant.ssr-preparation-running");function E(j,H){let W=j[D];if(Array.isArray(W)){W.push(H);return}Object.defineProperty(j,D,{value:[H],configurable:!0})}function S(j){let H=j,M=H[D];if(!Array.isArray(M))return;H[v]=!0;try{for(let W of M)W()}finally{delete H[v]}}function F(j,H={}){let M=null,W,Y=()=>{if(H.all)return j.getSlotElements(H.name);return j.getSlotElements(H.name)[0]??null};return{get value(){if(H.cache===!1)return Y();let Z=j.slotProjectionVersion??0;if(W!==Z)M=Y(),W=Z;return M}}}function l(j={}){return(H,M)=>{let W=(X)=>{return typeof Object.getOwnPropertyDescriptor(X,M)?.get==="function"},Y=(X)=>{if(W(X))return;let J=F(X,j);Object.defineProperty(X,M,{get(){return J.value},enumerable:!0,configurable:!0})},Z=new WeakMap;Object.defineProperty(H,M,{get(){let X=Z.get(this);if(!X)X=F(this,j),Z.set(this,X);return X.value},enumerable:!0,configurable:!0}),B(H,(X)=>{E(X,()=>{Y(X)}),X.registerConnectedCallback(()=>{Y(X)})})}}export{l as querySlot};
|
|
2
|
+
|
|
3
|
+
//# debugId=4CDF2F638DA2E87664756E2164756E21
|