@ecopages/radiant 0.3.0-alpha.4 → 0.3.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -59
- package/dist/LICENSE +21 -0
- package/dist/client/hydrator.d.ts +1 -1
- package/dist/client/hydrator.js +2 -2
- package/dist/client/hydrator.js.map +5 -3
- package/dist/client/install-hydrator.js +2 -2
- package/dist/client/install-hydrator.js.map +5 -3
- package/dist/context/context-consumer-bootstrap.d.ts +7 -6
- package/dist/context/context-consumer-bootstrap.js +2 -2
- package/dist/context/context-consumer-bootstrap.js.map +8 -3
- package/dist/context/context-consumer-runtime.d.ts +21 -8
- package/dist/context/context-consumer-runtime.js +2 -2
- package/dist/context/context-consumer-runtime.js.map +6 -3
- package/dist/context/context-host.d.ts +25 -0
- package/dist/context/context-host.js +3 -0
- package/dist/context/context-host.js.map +10 -0
- package/dist/context/context-provider.d.ts +10 -6
- package/dist/context/context-provider.js +2 -2
- package/dist/context/context-provider.js.map +9 -3
- package/dist/context/context-ssr-bridge.js +2 -2
- package/dist/context/context-ssr-bridge.js.map +4 -3
- package/dist/context/create-context.js +2 -2
- package/dist/context/create-context.js.map +4 -3
- package/dist/context/decorators/consume-context.d.ts +5 -2
- package/dist/context/decorators/consume-context.js +2 -2
- package/dist/context/decorators/consume-context.js.map +13 -3
- package/dist/context/decorators/context-selection-delivery.d.ts +1 -1
- package/dist/context/decorators/context-selection-delivery.js +2 -2
- package/dist/context/decorators/context-selection-delivery.js.map +5 -3
- package/dist/context/decorators/context-selector.d.ts +6 -6
- package/dist/context/decorators/context-selector.js +2 -2
- package/dist/context/decorators/context-selector.js.map +15 -3
- package/dist/context/decorators/legacy/consume-context.d.ts +2 -2
- package/dist/context/decorators/legacy/consume-context.js +2 -2
- package/dist/context/decorators/legacy/consume-context.js.map +10 -3
- package/dist/context/decorators/legacy/context-selector-field.d.ts +2 -2
- package/dist/context/decorators/legacy/context-selector-field.js +2 -2
- package/dist/context/decorators/legacy/context-selector-field.js.map +11 -3
- package/dist/context/decorators/legacy/context-selector.d.ts +2 -2
- package/dist/context/decorators/legacy/context-selector.js +2 -2
- package/dist/context/decorators/legacy/context-selector.js.map +11 -3
- package/dist/context/decorators/legacy/provide-context.d.ts +2 -2
- package/dist/context/decorators/legacy/provide-context.js +2 -2
- package/dist/context/decorators/legacy/provide-context.js.map +11 -3
- package/dist/context/decorators/on-context-update.d.ts +5 -5
- package/dist/context/decorators/on-context-update.js +2 -2
- package/dist/context/decorators/on-context-update.js.map +14 -3
- package/dist/context/decorators/provide-context.d.ts +5 -2
- package/dist/context/decorators/provide-context.js +2 -2
- package/dist/context/decorators/provide-context.js.map +14 -3
- package/dist/context/decorators/standard/consume-context.d.ts +2 -2
- package/dist/context/decorators/standard/consume-context.js +2 -2
- package/dist/context/decorators/standard/consume-context.js.map +9 -3
- package/dist/context/decorators/standard/context-selector-field.d.ts +2 -2
- package/dist/context/decorators/standard/context-selector-field.js +2 -2
- package/dist/context/decorators/standard/context-selector-field.js.map +10 -3
- package/dist/context/decorators/standard/context-selector.d.ts +2 -3
- package/dist/context/decorators/standard/context-selector.js +2 -2
- package/dist/context/decorators/standard/context-selector.js.map +10 -3
- package/dist/context/decorators/standard/provide-context.d.ts +2 -2
- package/dist/context/decorators/standard/provide-context.js +2 -2
- package/dist/context/decorators/standard/provide-context.js.map +10 -3
- package/dist/context/events.d.ts +18 -11
- package/dist/context/events.js +2 -2
- package/dist/context/events.js.map +4 -3
- package/dist/context/hydration-script.js +2 -2
- package/dist/context/hydration-script.js.map +6 -3
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.js +3 -0
- package/dist/context/index.js.map +35 -0
- package/dist/controller-registry.d.ts +28 -0
- package/dist/controller-registry.js +3 -0
- package/dist/controller-registry.js.map +11 -0
- package/dist/core/controller-metadata.d.ts +3 -0
- package/dist/core/controller-metadata.js +3 -0
- package/dist/core/controller-metadata.js.map +10 -0
- package/dist/core/custom-element-metadata.d.ts +11 -0
- package/dist/core/custom-element-metadata.js +2 -2
- package/dist/core/custom-element-metadata.js.map +4 -3
- package/dist/core/hydration-codec.d.ts +8 -1
- package/dist/core/hydration-codec.js +2 -2
- package/dist/core/hydration-codec.js.map +5 -3
- package/dist/core/radiant-component-ssr-registry.d.ts +13 -13
- package/dist/core/radiant-component-ssr-registry.js +2 -2
- package/dist/core/radiant-component-ssr-registry.js.map +4 -3
- package/dist/core/radiant-component-ssr.d.ts +3 -3
- package/dist/core/radiant-component-ssr.js +2 -2
- package/dist/core/radiant-component-ssr.js.map +8 -3
- package/dist/core/radiant-controller.d.ts +127 -0
- package/dist/core/radiant-controller.js +3 -0
- package/dist/core/radiant-controller.js.map +13 -0
- package/dist/core/radiant-element.d.ts +43 -41
- package/dist/core/radiant-element.js +2 -2
- package/dist/core/radiant-element.js.map +13 -3
- package/dist/core/radiant-hydrator-state.d.ts +1 -1
- package/dist/core/radiant-hydrator-state.js +2 -2
- package/dist/core/radiant-hydrator-state.js.map +4 -3
- package/dist/core/reactive-host.d.ts +137 -0
- package/dist/core/reactive-host.js +3 -0
- package/dist/core/reactive-host.js.map +10 -0
- package/dist/core/reactive-jsx-value.js +2 -2
- package/dist/core/reactive-jsx-value.js.map +4 -3
- package/dist/core/reactive-prop-metadata.js +2 -2
- package/dist/core/reactive-prop-metadata.js.map +4 -3
- package/dist/core/slot-projection-runtime.js +2 -2
- package/dist/core/slot-projection-runtime.js.map +6 -3
- package/dist/core/ssr-preparation.js +2 -2
- package/dist/core/ssr-preparation.js.map +4 -3
- package/dist/decorators/attr.d.ts +6 -0
- package/dist/decorators/attr.js +3 -0
- package/dist/decorators/attr.js.map +16 -0
- package/dist/decorators/bound.d.ts +4 -2
- package/dist/decorators/bound.js +2 -2
- package/dist/decorators/bound.js.map +7 -3
- package/dist/decorators/bridge.d.ts +11 -7
- package/dist/decorators/bridge.js +2 -2
- package/dist/decorators/bridge.js.map +4 -3
- package/dist/decorators/controller.d.ts +2 -0
- package/dist/decorators/controller.js +3 -0
- package/dist/decorators/controller.js.map +12 -0
- package/dist/decorators/custom-element.d.ts +4 -2
- package/dist/decorators/custom-element.js +2 -2
- package/dist/decorators/custom-element.js.map +7 -3
- package/dist/decorators/debounce.d.ts +5 -2
- package/dist/decorators/debounce.js +2 -2
- package/dist/decorators/debounce.js.map +8 -3
- package/dist/decorators/event.d.ts +5 -2
- package/dist/decorators/event.js +2 -2
- package/dist/decorators/event.js.map +10 -3
- package/dist/decorators/legacy/attr.d.ts +2 -0
- package/dist/decorators/legacy/attr.js +3 -0
- package/dist/decorators/legacy/attr.js.map +13 -0
- package/dist/decorators/legacy/bound.js +2 -2
- package/dist/decorators/legacy/bound.js.map +4 -3
- package/dist/decorators/legacy/custom-element.js +2 -2
- package/dist/decorators/legacy/custom-element.js.map +5 -3
- package/dist/decorators/legacy/debounce.js +2 -2
- package/dist/decorators/legacy/debounce.js.map +5 -3
- package/dist/decorators/legacy/event.js +2 -2
- package/dist/decorators/legacy/event.js.map +7 -3
- package/dist/decorators/legacy/instance-initializers.d.ts +3 -4
- package/dist/decorators/legacy/instance-initializers.js +2 -2
- package/dist/decorators/legacy/instance-initializers.js.map +4 -3
- package/dist/decorators/legacy/on-event.d.ts +2 -2
- package/dist/decorators/legacy/on-event.js +2 -2
- package/dist/decorators/legacy/on-event.js.map +6 -3
- package/dist/decorators/legacy/on-updated.d.ts +7 -2
- package/dist/decorators/legacy/on-updated.js +2 -2
- package/dist/decorators/legacy/on-updated.js.map +5 -3
- package/dist/decorators/legacy/query-slot.js +2 -2
- package/dist/decorators/legacy/query-slot.js.map +7 -3
- package/dist/decorators/legacy/query.d.ts +7 -2
- package/dist/decorators/legacy/query.js +2 -2
- package/dist/decorators/legacy/query.js.map +6 -3
- package/dist/decorators/legacy/reactive-field.d.ts +2 -2
- package/dist/decorators/legacy/reactive-field.js +2 -2
- package/dist/decorators/legacy/reactive-field.js.map +5 -3
- package/dist/decorators/legacy/reactive-prop.d.ts +10 -16
- package/dist/decorators/legacy/reactive-prop.js +2 -2
- package/dist/decorators/legacy/reactive-prop.js.map +7 -3
- package/dist/decorators/legacy/signal.d.ts +4 -3
- package/dist/decorators/legacy/signal.js +2 -2
- package/dist/decorators/legacy/signal.js.map +9 -3
- package/dist/decorators/on-event.d.ts +6 -3
- package/dist/decorators/on-event.js +2 -2
- package/dist/decorators/on-event.js.map +9 -3
- package/dist/decorators/on-updated.d.ts +12 -2
- package/dist/decorators/on-updated.js +2 -2
- package/dist/decorators/on-updated.js.map +8 -3
- package/dist/decorators/prop.d.ts +19 -7
- package/dist/decorators/prop.js +2 -2
- package/dist/decorators/prop.js.map +10 -3
- package/dist/decorators/query-slot.d.ts +11 -3
- package/dist/decorators/query-slot.js +2 -2
- package/dist/decorators/query-slot.js.map +10 -3
- package/dist/decorators/query.d.ts +9 -2
- package/dist/decorators/query.js +2 -2
- package/dist/decorators/query.js.map +9 -3
- package/dist/decorators/shared/reactive-attr.d.ts +25 -0
- package/dist/decorators/shared/reactive-attr.js +3 -0
- package/dist/decorators/shared/reactive-attr.js.map +11 -0
- package/dist/decorators/signal.d.ts +10 -4
- package/dist/decorators/signal.js +2 -2
- package/dist/decorators/signal.js.map +11 -3
- package/dist/decorators/standard/attr.d.ts +2 -0
- package/dist/decorators/standard/attr.js +3 -0
- package/dist/decorators/standard/attr.js.map +12 -0
- package/dist/decorators/standard/bound.js +2 -2
- package/dist/decorators/standard/bound.js.map +4 -3
- package/dist/decorators/standard/custom-element.js +2 -2
- package/dist/decorators/standard/custom-element.js.map +5 -3
- package/dist/decorators/standard/debounce.js +2 -2
- package/dist/decorators/standard/debounce.js.map +5 -3
- package/dist/decorators/standard/event.js +2 -2
- package/dist/decorators/standard/event.js.map +6 -3
- package/dist/decorators/standard/on-event.d.ts +2 -1
- package/dist/decorators/standard/on-event.js +2 -2
- package/dist/decorators/standard/on-event.js.map +5 -3
- package/dist/decorators/standard/on-updated.d.ts +5 -1
- package/dist/decorators/standard/on-updated.js +2 -2
- package/dist/decorators/standard/on-updated.js.map +4 -3
- package/dist/decorators/standard/query-slot.d.ts +1 -1
- package/dist/decorators/standard/query-slot.js +2 -2
- package/dist/decorators/standard/query-slot.js.map +5 -3
- package/dist/decorators/standard/query.d.ts +2 -1
- package/dist/decorators/standard/query.js +2 -2
- package/dist/decorators/standard/query.js.map +5 -3
- package/dist/decorators/standard/reactive-field.d.ts +2 -2
- package/dist/decorators/standard/reactive-field.js +2 -2
- package/dist/decorators/standard/reactive-field.js.map +4 -3
- package/dist/decorators/standard/reactive-prop.d.ts +13 -2
- package/dist/decorators/standard/reactive-prop.js +2 -2
- package/dist/decorators/standard/reactive-prop.js.map +6 -3
- package/dist/decorators/standard/signal.d.ts +4 -3
- package/dist/decorators/standard/signal.js +2 -2
- package/dist/decorators/standard/signal.js.map +8 -3
- package/dist/decorators/state.d.ts +6 -5
- package/dist/decorators/state.js +2 -2
- package/dist/decorators/state.js.map +8 -3
- package/dist/helpers/create-event-listener.d.ts +11 -2
- package/dist/helpers/create-event-listener.js +2 -2
- package/dist/helpers/create-event-listener.js.map +4 -3
- package/dist/helpers/create-event.js +2 -2
- package/dist/helpers/create-event.js.map +5 -3
- package/dist/helpers/create-query-slot.js +2 -2
- package/dist/helpers/create-query-slot.js.map +4 -3
- package/dist/helpers/create-query.d.ts +14 -3
- package/dist/helpers/create-query.js +2 -2
- package/dist/helpers/create-query.js.map +4 -3
- package/dist/helpers/debounce.js +2 -2
- package/dist/helpers/debounce.js.map +4 -3
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +9 -3
- package/dist/index.d.ts +4 -14
- package/dist/index.js +2 -2
- package/dist/index.js.map +60 -3
- package/dist/server/context-ssr.js +2 -2
- package/dist/server/context-ssr.js.map +5 -3
- package/dist/server/html-parser.js +2 -2
- package/dist/server/html-parser.js.map +4 -3
- package/dist/server/install-light-dom-shim.js +2 -2
- package/dist/server/install-light-dom-shim.js.map +5 -3
- package/dist/server/light-dom-shim.js +2 -2
- package/dist/server/light-dom-shim.js.map +5 -3
- package/dist/server/project-root.js +2 -2
- package/dist/server/project-root.js.map +2 -2
- package/dist/server/radiant-component-ssr-runtime.d.ts +2 -2
- package/dist/server/radiant-component-ssr-runtime.js +2 -2
- package/dist/server/radiant-component-ssr-runtime.js.map +11 -3
- package/dist/server/render-component.d.ts +3 -13
- package/dist/server/render-component.js +2 -2
- package/dist/server/render-component.js.map +14 -4
- package/dist/server/render-controller.d.ts +57 -0
- package/dist/server/render-controller.js +3 -0
- package/dist/server/render-controller.js.map +23 -0
- package/dist/server/slot-projection-html.js +2 -2
- package/dist/server/slot-projection-html.js.map +7 -3
- package/dist/signals/host-resource.js +2 -2
- package/dist/signals/host-resource.js.map +2 -2
- package/dist/signals/host-signal.d.ts +4 -2
- package/dist/signals/host-signal.js +2 -2
- package/dist/signals/host-signal.js.map +7 -3
- package/dist/signals/hydration-script.js +2 -2
- package/dist/signals/hydration-script.js.map +6 -3
- package/dist/tools/escape-script-json.js +2 -2
- package/dist/tools/escape-script-json.js.map +4 -3
- package/dist/tools/event-emitter.js +2 -2
- package/dist/tools/event-emitter.js.map +4 -3
- package/dist/tools/index.js +2 -2
- package/dist/tools/index.js.map +7 -3
- package/dist/tools/render-jsx-template.js +2 -2
- package/dist/tools/render-jsx-template.js.map +4 -3
- package/dist/tools/stringify-typed.js +2 -2
- package/dist/tools/stringify-typed.js.map +4 -3
- package/dist/types.js +2 -2
- package/dist/types.js.map +2 -2
- package/dist/utils/attribute-utils.js +2 -2
- package/dist/utils/attribute-utils.js.map +4 -3
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +4 -3
- package/package.json +26 -5
- package/size-budget.json +11 -2
- package/dist/chunk-0bswvy25.js +0 -4
- package/dist/chunk-0bswvy25.js.map +0 -10
- package/dist/chunk-0btkzzyc.js +0 -4
- package/dist/chunk-0btkzzyc.js.map +0 -10
- package/dist/chunk-0g0j9re6.js +0 -4
- package/dist/chunk-0g0j9re6.js.map +0 -10
- package/dist/chunk-1x26p09c.js +0 -4
- package/dist/chunk-1x26p09c.js.map +0 -10
- package/dist/chunk-21a7jask.js +0 -4
- package/dist/chunk-21a7jask.js.map +0 -10
- package/dist/chunk-21acj2eq.js +0 -4
- package/dist/chunk-21acj2eq.js.map +0 -10
- package/dist/chunk-25zjh0kg.js +0 -4
- package/dist/chunk-25zjh0kg.js.map +0 -10
- package/dist/chunk-30x4hggg.js +0 -4
- package/dist/chunk-30x4hggg.js.map +0 -10
- package/dist/chunk-3ynk7e1e.js +0 -4
- package/dist/chunk-3ynk7e1e.js.map +0 -10
- package/dist/chunk-5b1en9vz.js +0 -4
- package/dist/chunk-5b1en9vz.js.map +0 -10
- package/dist/chunk-5bkat72n.js +0 -4
- package/dist/chunk-5bkat72n.js.map +0 -10
- package/dist/chunk-5qeaq3tj.js +0 -4
- package/dist/chunk-5qeaq3tj.js.map +0 -10
- package/dist/chunk-66e6s792.js +0 -4
- package/dist/chunk-66e6s792.js.map +0 -10
- package/dist/chunk-79jg8q67.js +0 -4
- package/dist/chunk-79jg8q67.js.map +0 -10
- package/dist/chunk-8d5ddvvf.js +0 -4
- package/dist/chunk-8d5ddvvf.js.map +0 -10
- package/dist/chunk-8e9fgtbn.js +0 -4
- package/dist/chunk-8e9fgtbn.js.map +0 -10
- package/dist/chunk-9mqtp3js.js +0 -4
- package/dist/chunk-9mqtp3js.js.map +0 -10
- package/dist/chunk-9rj2rwes.js +0 -4
- package/dist/chunk-9rj2rwes.js.map +0 -10
- package/dist/chunk-atms6yrh.js +0 -4
- package/dist/chunk-atms6yrh.js.map +0 -10
- package/dist/chunk-bk2nbmcd.js +0 -4
- package/dist/chunk-bk2nbmcd.js.map +0 -10
- package/dist/chunk-bk6qkvfp.js +0 -4
- package/dist/chunk-bk6qkvfp.js.map +0 -10
- package/dist/chunk-c0qyz98c.js +0 -4
- package/dist/chunk-c0qyz98c.js.map +0 -10
- package/dist/chunk-c52qhh0j.js +0 -4
- package/dist/chunk-c52qhh0j.js.map +0 -10
- package/dist/chunk-cnyxrh9r.js +0 -4
- package/dist/chunk-cnyxrh9r.js.map +0 -10
- package/dist/chunk-cvz9mrxa.js +0 -4
- package/dist/chunk-cvz9mrxa.js.map +0 -10
- package/dist/chunk-dabagjk6.js +0 -4
- package/dist/chunk-dabagjk6.js.map +0 -10
- package/dist/chunk-e0r6ca2g.js +0 -4
- package/dist/chunk-e0r6ca2g.js.map +0 -10
- package/dist/chunk-e5jd9h6t.js +0 -4
- package/dist/chunk-e5jd9h6t.js.map +0 -10
- package/dist/chunk-eevw1j2q.js +0 -4
- package/dist/chunk-eevw1j2q.js.map +0 -10
- package/dist/chunk-ek664x1c.js +0 -4
- package/dist/chunk-ek664x1c.js.map +0 -10
- package/dist/chunk-eyw14d6y.js +0 -4
- package/dist/chunk-eyw14d6y.js.map +0 -10
- package/dist/chunk-fs4j94bk.js +0 -4
- package/dist/chunk-fs4j94bk.js.map +0 -10
- package/dist/chunk-g2z3mm6b.js +0 -4
- package/dist/chunk-g2z3mm6b.js.map +0 -10
- package/dist/chunk-g5n3m11h.js +0 -4
- package/dist/chunk-g5n3m11h.js.map +0 -10
- package/dist/chunk-gdkte2vd.js +0 -4
- package/dist/chunk-gdkte2vd.js.map +0 -10
- package/dist/chunk-gg74gdpv.js +0 -4
- package/dist/chunk-gg74gdpv.js.map +0 -10
- package/dist/chunk-gpv1n74a.js +0 -4
- package/dist/chunk-gpv1n74a.js.map +0 -10
- package/dist/chunk-h9k7crjc.js +0 -4
- package/dist/chunk-h9k7crjc.js.map +0 -10
- package/dist/chunk-hpzgnxgq.js +0 -4
- package/dist/chunk-hpzgnxgq.js.map +0 -10
- package/dist/chunk-hrjc8b1y.js +0 -4
- package/dist/chunk-hrjc8b1y.js.map +0 -10
- package/dist/chunk-hvy4zvcc.js +0 -4
- package/dist/chunk-hvy4zvcc.js.map +0 -10
- package/dist/chunk-hztr86b4.js +0 -4
- package/dist/chunk-hztr86b4.js.map +0 -10
- package/dist/chunk-j3v7rca5.js +0 -4
- package/dist/chunk-j3v7rca5.js.map +0 -10
- package/dist/chunk-j864sv4w.js +0 -4
- package/dist/chunk-j864sv4w.js.map +0 -10
- package/dist/chunk-jkb2y7c8.js +0 -4
- package/dist/chunk-jkb2y7c8.js.map +0 -10
- package/dist/chunk-kakpjgzf.js +0 -4
- package/dist/chunk-kakpjgzf.js.map +0 -10
- package/dist/chunk-kmebacvv.js +0 -4
- package/dist/chunk-kmebacvv.js.map +0 -10
- package/dist/chunk-knqsm6v3.js +0 -4
- package/dist/chunk-knqsm6v3.js.map +0 -10
- package/dist/chunk-mp2vtrkg.js +0 -4
- package/dist/chunk-mp2vtrkg.js.map +0 -10
- package/dist/chunk-mpsj3cjs.js +0 -4
- package/dist/chunk-mpsj3cjs.js.map +0 -10
- package/dist/chunk-n4p2542b.js +0 -4
- package/dist/chunk-n4p2542b.js.map +0 -10
- package/dist/chunk-nctznxyz.js +0 -4
- package/dist/chunk-nctznxyz.js.map +0 -10
- package/dist/chunk-ndw3hc3v.js +0 -4
- package/dist/chunk-ndw3hc3v.js.map +0 -10
- package/dist/chunk-nnnb6pac.js +0 -4
- package/dist/chunk-nnnb6pac.js.map +0 -10
- package/dist/chunk-nssj2x13.js +0 -4
- package/dist/chunk-nssj2x13.js.map +0 -10
- package/dist/chunk-nvr37vma.js +0 -4
- package/dist/chunk-nvr37vma.js.map +0 -10
- package/dist/chunk-p8k4g99a.js +0 -4
- package/dist/chunk-p8k4g99a.js.map +0 -10
- package/dist/chunk-pkszgjqf.js +0 -4
- package/dist/chunk-pkszgjqf.js.map +0 -10
- package/dist/chunk-q9z6tnzw.js +0 -4
- package/dist/chunk-q9z6tnzw.js.map +0 -10
- package/dist/chunk-qdz5sncz.js +0 -4
- package/dist/chunk-qdz5sncz.js.map +0 -10
- package/dist/chunk-qe0eww1n.js +0 -4
- package/dist/chunk-qe0eww1n.js.map +0 -10
- package/dist/chunk-r33zvvda.js +0 -4
- package/dist/chunk-r33zvvda.js.map +0 -10
- package/dist/chunk-rkh1vkb9.js +0 -4
- package/dist/chunk-rkh1vkb9.js.map +0 -10
- package/dist/chunk-rrg759ht.js +0 -4
- package/dist/chunk-rrg759ht.js.map +0 -10
- package/dist/chunk-s09s5ayx.js +0 -4
- package/dist/chunk-s09s5ayx.js.map +0 -10
- package/dist/chunk-sf4a2gy5.js +0 -4
- package/dist/chunk-sf4a2gy5.js.map +0 -10
- package/dist/chunk-ssnnxzrj.js +0 -4
- package/dist/chunk-ssnnxzrj.js.map +0 -10
- package/dist/chunk-t8xtvgyg.js +0 -4
- package/dist/chunk-t8xtvgyg.js.map +0 -10
- package/dist/chunk-v3ta7hnv.js +0 -4
- package/dist/chunk-v3ta7hnv.js.map +0 -10
- package/dist/chunk-v92hp9g0.js +0 -4
- package/dist/chunk-v92hp9g0.js.map +0 -10
- package/dist/chunk-vgtggzb6.js +0 -4
- package/dist/chunk-vgtggzb6.js.map +0 -9
- package/dist/chunk-vk48hgm4.js +0 -4
- package/dist/chunk-vk48hgm4.js.map +0 -10
- package/dist/chunk-w8s5fnsq.js +0 -4
- package/dist/chunk-w8s5fnsq.js.map +0 -10
- package/dist/chunk-wd23rn4q.js +0 -4
- package/dist/chunk-wd23rn4q.js.map +0 -10
- package/dist/chunk-wds4href.js +0 -4
- package/dist/chunk-wds4href.js.map +0 -10
- package/dist/chunk-wvd1ffe4.js +0 -4
- package/dist/chunk-wvd1ffe4.js.map +0 -10
- package/dist/chunk-wwbjz9k4.js +0 -4
- package/dist/chunk-wwbjz9k4.js.map +0 -10
- package/dist/chunk-x2k0ngpz.js +0 -4
- package/dist/chunk-x2k0ngpz.js.map +0 -10
- package/dist/chunk-x457d0ap.js +0 -4
- package/dist/chunk-x457d0ap.js.map +0 -10
- package/dist/chunk-xbhtzkre.js +0 -4
- package/dist/chunk-xbhtzkre.js.map +0 -10
- package/dist/chunk-y139ycfm.js +0 -4
- package/dist/chunk-y139ycfm.js.map +0 -10
- package/dist/chunk-z9kxfckm.js +0 -4
- package/dist/chunk-z9kxfckm.js.map +0 -10
- package/dist/chunk-zx5txex8.js +0 -4
- package/dist/chunk-zx5txex8.js.map +0 -10
- package/dist/chunk-zygdebw8.js +0 -4
- package/dist/chunk-zygdebw8.js.map +0 -10
- package/dist/core/radiant-component.d.ts +0 -113
- package/dist/core/radiant-component.js +0 -3
- package/dist/core/radiant-component.js.map +0 -9
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var A=((E)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(E,{get:(I,L)=>(typeof require<"u"?require:I)[L]}):E)(function(E){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+E+'" is not supported')});var W=Symbol.for("@ecopages/radiant.controllerIdentifier");function F(E,I){E[W]=I}function G(E){return E[W]}var u="data-controller",_=Symbol.for("@ecopages/radiant.controller-registry-state");function q(){let E=globalThis,I=E[_];if(I)return I;let L={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return E[_]=L,L}var D=q(),M=D.controllerRegistry,C=D.activeRuntimes;function p(E){let I=E.getAttribute(u);if(!I)return[];return I.split(/\s+/).map((L)=>L.trim()).filter((L)=>L.length>0)}function h(E,I){if(E instanceof Element&&E.hasAttribute(u))I(E);for(let L of Array.from(E.querySelectorAll(`[${u}]`)))I(L)}class R{root;controllersByElement=new Map;observer;stopped=!1;constructor(E=document){this.root=E;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[E,I]of this.controllersByElement)for(let[L]of I)this.disconnectController(E,L);C.delete(this)}reconcileRegisteredController(E){h(this.root,(I)=>{if(!p(I).includes(E))return;this.connectController(I,E)})}replaceRegisteredController(E){for(let[I,L]of Array.from(this.controllersByElement.entries())){if(!L.has(E))continue;this.disconnectController(I,E)}this.reconcileRegisteredController(E)}start(){if(h(this.root,(I)=>{this.reconcileElement(I)}),typeof MutationObserver>"u"){C.add(this);return}this.observer=new MutationObserver((I)=>{for(let L of I){if(L.type==="attributes"&&L.target instanceof Element){this.reconcileElement(L.target);continue}for(let O of Array.from(L.removedNodes)){if(!(O instanceof Element))continue;h(O,(T)=>{this.disconnectElementControllers(T)})}for(let O of Array.from(L.addedNodes)){if(!(O instanceof Element))continue;h(O,(T)=>{this.reconcileElement(T)})}}});let E=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(E,{attributeFilter:[u],attributes:!0,childList:!0,subtree:!0}),C.add(this)}reconcileElement(E){let I=new Set(p(E)),L=this.controllersByElement.get(E);if(L){for(let O of L.keys())if(!I.has(O))this.disconnectController(E,O)}for(let O of I)this.connectController(E,O)}connectController(E,I){let L=M.get(I);if(!L)return;let O=this.controllersByElement.get(E);if(!O)O=new Map,this.controllersByElement.set(E,O);if(O.has(I))return;let T=new L(E);O.set(I,T),T.connect()}disconnectController(E,I){let L=this.controllersByElement.get(E);if(!L)return;let O=L.get(I);if(!O)return;if(O.disconnect(),L.delete(I),L.size===0)this.controllersByElement.delete(E)}disconnectElementControllers(E){let I=this.controllersByElement.get(E);if(!I)return;for(let L of Array.from(I.keys()))this.disconnectController(E,L)}}function w(E,I){let L=M.get(E);if(L)return L;F(I,E),M.set(E,I);for(let O of Array.from(C))O.reconcileRegisteredController(E);return I}function K(E){return M.has(E)}function z(E,I){if(M.get(E)===I)return I;F(I,E),M.set(E,I);for(let O of Array.from(C))O.replaceRegisteredController(E);return I}function j(E){D.controllerRegistrationStrategy=E}function N(){j("replace")}function P(){j("keep-current")}function k(E,I){if(D.controllerRegistrationStrategy==="replace")return z(E,I);return w(E,I)}function Q(E=document){return new R(E)}function U(){for(let E of Array.from(C))E.stop()}function Y(E){return function(I){return k(E,I)}}export{Y as controller};
|
|
2
|
+
|
|
3
|
+
//# debugId=3F9FF87627E4C5BA64756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/controller-metadata.ts", "../src/controller-registry.ts", "../src/decorators/controller.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export const CONTROLLER_IDENTIFIER = Symbol.for('@ecopages/radiant.controllerIdentifier');\n\ntype ControllerConstructorWithMetadata = CustomElementConstructor & {\n\t[CONTROLLER_IDENTIFIER]?: string;\n};\n\nexport function setControllerIdentifier(target: CustomElementConstructor, identifier: string): void {\n\t(target as ControllerConstructorWithMetadata)[CONTROLLER_IDENTIFIER] = identifier;\n}\n\nexport function getControllerIdentifier(target: CustomElementConstructor): string | undefined {\n\treturn (target as ControllerConstructorWithMetadata)[CONTROLLER_IDENTIFIER];\n}\n",
|
|
6
|
+
"import type { RadiantController } from './core/radiant-controller';\nimport { setControllerIdentifier } from './core/controller-metadata';\n\nexport const CONTROLLER_ATTRIBUTE = 'data-controller';\n\nexport type ControllerConstructor<TController extends RadiantController = RadiantController> = new (\n\thost: Element,\n) => TController;\n\nexport type ControllerRegistrationStrategy = 'keep-current' | 'replace';\n\ntype ControllerRegistryGlobalState = {\n\tactiveRuntimes: Set<ControllerRegistryRuntime>;\n\tcontrollerRegistrationStrategy: ControllerRegistrationStrategy;\n\tcontrollerRegistry: Map<string, ControllerConstructor>;\n};\n\nconst CONTROLLER_REGISTRY_STATE_KEY = Symbol.for('@ecopages/radiant.controller-registry-state');\n\nfunction getControllerRegistryGlobalState(): ControllerRegistryGlobalState {\n\tconst globalScope = globalThis as typeof globalThis & Record<PropertyKey, unknown>;\n\tconst existingState = globalScope[CONTROLLER_REGISTRY_STATE_KEY];\n\n\tif (existingState) {\n\t\treturn existingState as ControllerRegistryGlobalState;\n\t}\n\n\tconst nextState: ControllerRegistryGlobalState = {\n\t\tactiveRuntimes: new Set<ControllerRegistryRuntime>(),\n\t\tcontrollerRegistrationStrategy: 'keep-current',\n\t\tcontrollerRegistry: new Map<string, ControllerConstructor>(),\n\t};\n\n\tglobalScope[CONTROLLER_REGISTRY_STATE_KEY] = nextState;\n\n\treturn nextState;\n}\n\nconst controllerRegistryState = getControllerRegistryGlobalState();\nconst controllerRegistry = controllerRegistryState.controllerRegistry;\nconst activeRuntimes = controllerRegistryState.activeRuntimes;\n\nfunction parseControllerIdentifiers(element: Element): string[] {\n\tconst value = element.getAttribute(CONTROLLER_ATTRIBUTE);\n\n\tif (!value) {\n\t\treturn [];\n\t}\n\n\treturn value\n\t\t.split(/\\s+/)\n\t\t.map((identifier) => identifier.trim())\n\t\t.filter((identifier) => identifier.length > 0);\n}\n\nfunction visitControllerElements(root: ParentNode, visit: (element: Element) => void): void {\n\tif (root instanceof Element && root.hasAttribute(CONTROLLER_ATTRIBUTE)) {\n\t\tvisit(root);\n\t}\n\n\tfor (const element of Array.from(root.querySelectorAll(`[${CONTROLLER_ATTRIBUTE}]`))) {\n\t\tvisit(element);\n\t}\n}\n\nexport class ControllerRegistryRuntime {\n\tprivate readonly controllersByElement = new Map<Element, Map<string, RadiantController>>();\n\tprivate observer?: MutationObserver;\n\tprivate stopped = false;\n\n\tconstructor(private readonly root: ParentNode = document) {\n\t\tthis.start();\n\t}\n\n\tpublic stop(): void {\n\t\tif (this.stopped) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.stopped = true;\n\t\tthis.observer?.disconnect();\n\t\tthis.observer = undefined;\n\n\t\tfor (const [element, controllers] of this.controllersByElement) {\n\t\t\tfor (const [identifier] of controllers) {\n\t\t\t\tthis.disconnectController(element, identifier);\n\t\t\t}\n\t\t}\n\n\t\tactiveRuntimes.delete(this);\n\t}\n\n\tpublic reconcileRegisteredController(identifier: string): void {\n\t\tvisitControllerElements(this.root, (element) => {\n\t\t\tif (!parseControllerIdentifiers(element).includes(identifier)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.connectController(element, identifier);\n\t\t});\n\t}\n\n\tpublic replaceRegisteredController(identifier: string): void {\n\t\tfor (const [element, controllers] of Array.from(this.controllersByElement.entries())) {\n\t\t\tif (!controllers.has(identifier)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthis.disconnectController(element, identifier);\n\t\t}\n\n\t\tthis.reconcileRegisteredController(identifier);\n\t}\n\n\tprivate start(): void {\n\t\tvisitControllerElements(this.root, (element) => {\n\t\t\tthis.reconcileElement(element);\n\t\t});\n\n\t\tif (typeof MutationObserver === 'undefined') {\n\t\t\tactiveRuntimes.add(this);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.observer = new MutationObserver((records) => {\n\t\t\tfor (const record of records) {\n\t\t\t\tif (record.type === 'attributes' && record.target instanceof Element) {\n\t\t\t\t\tthis.reconcileElement(record.target);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (const removedNode of Array.from(record.removedNodes)) {\n\t\t\t\t\tif (!(removedNode instanceof Element)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitControllerElements(removedNode, (element) => {\n\t\t\t\t\t\tthis.disconnectElementControllers(element);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfor (const addedNode of Array.from(record.addedNodes)) {\n\t\t\t\t\tif (!(addedNode instanceof Element)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitControllerElements(addedNode, (element) => {\n\t\t\t\t\t\tthis.reconcileElement(element);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tconst observerRoot = this.root instanceof Document ? this.root.documentElement : this.root;\n\n\t\tthis.observer.observe(observerRoot, {\n\t\t\tattributeFilter: [CONTROLLER_ATTRIBUTE],\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t});\n\n\t\tactiveRuntimes.add(this);\n\t}\n\n\tprivate reconcileElement(element: Element): void {\n\t\tconst nextIdentifiers = new Set(parseControllerIdentifiers(element));\n\t\tconst currentControllers = this.controllersByElement.get(element);\n\n\t\tif (currentControllers) {\n\t\t\tfor (const identifier of currentControllers.keys()) {\n\t\t\t\tif (!nextIdentifiers.has(identifier)) {\n\t\t\t\t\tthis.disconnectController(element, identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const identifier of nextIdentifiers) {\n\t\t\tthis.connectController(element, identifier);\n\t\t}\n\t}\n\n\tprivate connectController(element: Element, identifier: string): void {\n\t\tconst controllerConstructor = controllerRegistry.get(identifier);\n\n\t\tif (!controllerConstructor) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet controllers = this.controllersByElement.get(element);\n\n\t\tif (!controllers) {\n\t\t\tcontrollers = new Map();\n\t\t\tthis.controllersByElement.set(element, controllers);\n\t\t}\n\n\t\tif (controllers.has(identifier)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst controller = new controllerConstructor(element);\n\t\tcontrollers.set(identifier, controller);\n\t\tcontroller.connect();\n\t}\n\n\tprivate disconnectController(element: Element, identifier: string): void {\n\t\tconst controllers = this.controllersByElement.get(element);\n\n\t\tif (!controllers) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst controller = controllers.get(identifier);\n\n\t\tif (!controller) {\n\t\t\treturn;\n\t\t}\n\n\t\tcontroller.disconnect();\n\t\tcontrollers.delete(identifier);\n\n\t\tif (controllers.size === 0) {\n\t\t\tthis.controllersByElement.delete(element);\n\t\t}\n\t}\n\n\tprivate disconnectElementControllers(element: Element): void {\n\t\tconst controllers = this.controllersByElement.get(element);\n\n\t\tif (!controllers) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const identifier of Array.from(controllers.keys())) {\n\t\t\tthis.disconnectController(element, identifier);\n\t\t}\n\t}\n}\n\nexport function registerController<\n\tTController extends RadiantController,\n\tTConstructor extends ControllerConstructor<TController>,\n>(identifier: string, controller: TConstructor): TConstructor {\n\tconst existingController = controllerRegistry.get(identifier);\n\n\tif (existingController) {\n\t\treturn existingController as TConstructor;\n\t}\n\n\tsetControllerIdentifier(controller as unknown as CustomElementConstructor, identifier);\n\tcontrollerRegistry.set(identifier, controller);\n\n\tfor (const runtime of Array.from(activeRuntimes)) {\n\t\truntime.reconcileRegisteredController(identifier);\n\t}\n\n\treturn controller;\n}\n\nexport function hasRegisteredController(identifier: string): boolean {\n\treturn controllerRegistry.has(identifier);\n}\n\nexport function replaceController<\n\tTController extends RadiantController,\n\tTConstructor extends ControllerConstructor<TController>,\n>(identifier: string, controller: TConstructor): TConstructor {\n\tconst existingController = controllerRegistry.get(identifier);\n\n\tif (existingController === controller) {\n\t\treturn controller;\n\t}\n\n\tsetControllerIdentifier(controller as unknown as CustomElementConstructor, identifier);\n\tcontrollerRegistry.set(identifier, controller);\n\n\tfor (const runtime of Array.from(activeRuntimes)) {\n\t\truntime.replaceRegisteredController(identifier);\n\t}\n\n\treturn controller;\n}\n\nexport function setControllerRegistrationStrategy(strategy: ControllerRegistrationStrategy): void {\n\tcontrollerRegistryState.controllerRegistrationStrategy = strategy;\n}\n\nexport function enableControllerReplacementForHmr(): void {\n\tsetControllerRegistrationStrategy('replace');\n}\n\nexport function disableControllerReplacementForHmr(): void {\n\tsetControllerRegistrationStrategy('keep-current');\n}\n\nexport function registerControllerWithConfiguredStrategy<\n\tTController extends RadiantController,\n\tTConstructor extends ControllerConstructor<TController>,\n>(identifier: string, controller: TConstructor): TConstructor {\n\tif (controllerRegistryState.controllerRegistrationStrategy === 'replace') {\n\t\treturn replaceController(identifier, controller);\n\t}\n\n\treturn registerController(identifier, controller);\n}\n\nexport function startControllers(root: ParentNode = document): ControllerRegistryRuntime {\n\treturn new ControllerRegistryRuntime(root);\n}\n\nexport function stopControllers(): void {\n\tfor (const runtime of Array.from(activeRuntimes)) {\n\t\truntime.stop();\n\t}\n}\n",
|
|
7
|
+
"import { registerControllerWithConfiguredStrategy, type ControllerConstructor } from '../controller-registry';\n\nexport function controller(identifier: string) {\n\treturn function <T extends ControllerConstructor>(target: T): T {\n\t\treturn registerControllerWithConfiguredStrategy(identifier, target);\n\t};\n}\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": "2PAAO,IAAM,EAAwB,OAAO,IAAI,wCAAwC,EAMjF,SAAS,CAAuB,CAAC,EAAkC,EAA0B,CAClG,EAA6C,GAAyB,EAGjE,SAAS,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,CAAC,EAAoB,EAAwC,CAG7D,GAF2B,EAAmB,IAAI,CAAU,IAEjC,EAC1B,OAAO,EAGR,EAAwB,EAAmD,CAAU,EACrF,EAAmB,IAAI,EAAY,CAAU,EAE7C,QAAW,KAAW,MAAM,KAAK,CAAc,EAC9C,EAAQ,4BAA4B,CAAU,EAG/C,OAAO,EAGD,SAAS,CAAiC,CAAC,EAAgD,CACjG,EAAwB,+BAAiC,EAGnD,SAAS,CAAiC,EAAS,CACzD,EAAkC,SAAS,EAGrC,SAAS,CAAkC,EAAS,CAC1D,EAAkC,cAAc,EAG1C,SAAS,CAGf,CAAC,EAAoB,EAAwC,CAC7D,GAAI,EAAwB,iCAAmC,UAC9D,OAAO,EAAkB,EAAY,CAAU,EAGhD,OAAO,EAAmB,EAAY,CAAU,EAG1C,SAAS,CAAgB,CAAC,EAAmB,SAAqC,CACxF,OAAO,IAAI,EAA0B,CAAI,EAGnC,SAAS,CAAe,EAAS,CACvC,QAAW,KAAW,MAAM,KAAK,CAAc,EAC9C,EAAQ,KAAK,ECtTR,SAAS,CAAU,CAAC,EAAoB,CAC9C,OAAO,QAA0C,CAAC,EAAc,CAC/D,OAAO,EAAyC,EAAY,CAAM",
|
|
10
|
+
"debugId": "3F9FF87627E4C5BA64756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { StandardOrLegacyClassDecoratorArgs } from '../types';
|
|
2
1
|
/**
|
|
3
2
|
* Registers a web component with the given name on the global `window.customElements` registry.
|
|
4
3
|
* @param name selector name.
|
|
5
4
|
* @param options {@link ElementDefinitionOptions}
|
|
6
5
|
*/
|
|
7
|
-
export declare function customElement(name: string, options?: ElementDefinitionOptions):
|
|
6
|
+
export declare function customElement(name: string, options?: ElementDefinitionOptions): {
|
|
7
|
+
<T extends CustomElementConstructor>(protoOrTarget: T, nameOrContext: ClassDecoratorContext<T>): void;
|
|
8
|
+
(protoOrTarget: CustomElementConstructor): void;
|
|
9
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var P=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(q,z)=>(typeof require<"u"?require:q)[z]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var I=Symbol.for("@ecopages/radiant.customElementTagName");function F(j,q){j[I]=q}function V(j){return j[I]}function J(j,q){return(z)=>{if(F(z,j),typeof customElements<"u"&&!customElements.get(j))customElements.define(j,z,q)}}function K(j,q){return function(z,B){B.addInitializer(function(){if(F(this,j),typeof customElements<"u"&&!customElements.get(j))customElements.define(j,this,q)})}}function b(j,q){function z(B,H){if(typeof H<"u")return K(j,q)(B,H);return J(j,q)(B)}return z}export{b as customElement};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=583FF706F48591E064756E2164756E21
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/core/custom-element-metadata.ts", "../src/decorators/legacy/custom-element.ts", "../src/decorators/standard/custom-element.ts", "../src/decorators/custom-element.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
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
|
+
"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
|
+
"import { setCustomElementTagName } from '../../core/custom-element-metadata';\n\nexport function customElement(name: string, options?: ElementDefinitionOptions) {\n\treturn function <T extends CustomElementConstructor>(_: T, context: ClassDecoratorContext<T>) {\n\t\tcontext.addInitializer(function () {\n\t\t\tsetCustomElementTagName(this, name);\n\n\t\t\tif (typeof customElements !== 'undefined' && !customElements.get(name)) {\n\t\t\t\tcustomElements.define(name, this, options);\n\t\t\t}\n\t\t});\n\t};\n}\n",
|
|
8
|
+
"import { customElement as legacyCustomElement } from './legacy/custom-element';\nimport { customElement as standardCustomElement } from './standard/custom-element';\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\tfunction decorator<T extends CustomElementConstructor>(\n\t\tprotoOrTarget: T,\n\t\tnameOrContext: ClassDecoratorContext<T>,\n\t): void;\n\tfunction decorator(protoOrTarget: CustomElementConstructor): void;\n\tfunction decorator(\n\t\tprotoOrTarget: CustomElementConstructor,\n\t\tnameOrContext?: ClassDecoratorContext<CustomElementConstructor>,\n\t): void {\n\t\tif (typeof nameOrContext !== 'undefined') {\n\t\t\treturn standardCustomElement(name, options)(protoOrTarget, nameOrContext);\n\t\t}\n\n\t\treturn legacyCustomElement(name, options)(protoOrTarget);\n\t}\n\n\treturn decorator;\n}\n"
|
|
5
9
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
10
|
+
"mappings": "2PAAO,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,GCVvC,SAAS,CAAa,CAAC,EAAc,EAAoC,CAC/E,OAAO,QAA6C,CAAC,EAAM,EAAmC,CAC7F,EAAQ,eAAe,QAAS,EAAG,CAGlC,GAFA,EAAwB,KAAM,CAAI,EAE9B,OAAO,eAAmB,KAAe,CAAC,eAAe,IAAI,CAAI,EACpE,eAAe,OAAO,EAAM,KAAM,CAAO,EAE1C,GCFI,SAAS,CAAa,CAAC,EAAc,EAAoC,CAM/E,SAAS,CAAS,CACjB,EACA,EACO,CACP,GAAI,OAAO,EAAkB,IAC5B,OAAO,EAAsB,EAAM,CAAO,EAAE,EAAe,CAAa,EAGzE,OAAO,EAAoB,EAAM,CAAO,EAAE,CAAa,EAGxD,OAAO",
|
|
11
|
+
"debugId": "583FF706F48591E064756E2164756E21",
|
|
8
12
|
"names": []
|
|
9
13
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Method } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* A decorator to debounce a method.
|
|
4
4
|
* @param timeout The debounce timeout in milliseconds.
|
|
5
5
|
*/
|
|
6
|
-
export declare function debounce(timeout: number):
|
|
6
|
+
export declare function debounce(timeout: number): {
|
|
7
|
+
<Host extends object, TMethod extends Method>(protoOrTarget: TMethod, nameOrContext: ClassMethodDecoratorContext<Host, TMethod>): Method;
|
|
8
|
+
(protoOrTarget: object, nameOrContext: string, descriptor: TypedPropertyDescriptor<Method>): TypedPropertyDescriptor<Method> | void;
|
|
9
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var l=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,o)=>(typeof require<"u"?require:n)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});function M(e){return typeof e==="function"}function g(e,n,o,t){if(typeof t==="object")return e(void 0,t);return n(o,t)}function c(e,n,o,t,r){if(typeof t==="object"){if(!M(o))throw TypeError("Standard method decorators require a method target");return e(o,t)}if(!r)throw TypeError("Legacy method decorators require a property descriptor");return n(o,t,r)}function u(e,n){let o=null,t=null,r,d=()=>{if(o!==null)clearTimeout(o),o=null},y=()=>{if(t===null)return r;let s=t;return t=null,d(),r=s(),r},a=function(...s){t=()=>e.apply(this,s),d(),o=setTimeout(()=>{y()},n)};return a.cancel=()=>{d(),t=null},a.flush=()=>{if(t===null)return r;return y()},a.pending=()=>t!==null,a}function i(e){return(n,o,t)=>{let r=t.value,d=new WeakMap;return t.value=function(...a){let s=d.get(this);if(!s)s=u((...p)=>{return r.apply(this,p)},e),d.set(this,s);s(...a)},t}}function h(e){return(n)=>{let o=new WeakMap;return function(...t){let r=o.get(this);if(!r)r=u((...d)=>{return n.apply(this,d)},e),o.set(this,r);r(...t)}}}function S(e){function n(o,t,r){return c(h(e),i(e),o,t,r)}return n}export{S as debounce};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=7F87A38B675BC95764756E2164756E21
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/decorators/bridge.ts", "../src/helpers/debounce.ts", "../src/decorators/legacy/debounce.ts", "../src/decorators/standard/debounce.ts", "../src/decorators/debounce.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"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",
|
|
6
|
+
"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",
|
|
7
|
+
"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",
|
|
8
|
+
"import { debounce as debounceFunction } from '../../helpers/debounce';\nimport type { Method } from '../../types';\n\nexport function debounce(timeout: number): Method {\n\treturn <T extends Method>(originalMethod: T): Method => {\n\t\tconst debouncedByInstance = new WeakMap<object, ReturnType<typeof debounceFunction<T>>>();\n\n\t\treturn function (this: object, ...args: Parameters<T>): void {\n\t\t\tlet debounced = debouncedByInstance.get(this);\n\n\t\t\tif (!debounced) {\n\t\t\t\tdebounced = debounceFunction((...innerArgs: Parameters<T>) => {\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\t};\n}\n",
|
|
9
|
+
"import type { Method } from '../types';\nimport { debounce as legacyDebounce } from './legacy/debounce';\nimport { debounce as standardDebounce } from './standard/debounce';\nimport { methodDecoratorBridge } from './bridge';\n\n/**\n * A decorator to debounce a method.\n * @param timeout The debounce timeout in milliseconds.\n */\nexport function debounce(timeout: number) {\n\tfunction decorator<Host extends object, TMethod extends Method>(\n\t\tprotoOrTarget: TMethod,\n\t\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\t): Method;\n\tfunction decorator(\n\t\tprotoOrTarget: object,\n\t\tnameOrContext: string,\n\t\tdescriptor: TypedPropertyDescriptor<Method>,\n\t): TypedPropertyDescriptor<Method> | void;\n\tfunction decorator(\n\t\tprotoOrTarget: object | Method,\n\t\tnameOrContext: string | ClassMethodDecoratorContext<object, Method>,\n\t\tdescriptor?: TypedPropertyDescriptor<Method>,\n\t): Method | TypedPropertyDescriptor<Method> | void {\n\t\treturn methodDecoratorBridge(\n\t\t\tstandardDebounce(timeout),\n\t\t\tlegacyDebounce(timeout),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t\tdescriptor,\n\t\t);\n\t}\n\n\treturn decorator;\n}\n"
|
|
5
10
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
11
|
+
"mappings": "2PAgBA,SAAS,CAAQ,CAAC,EAAiC,CAClD,OAAO,OAAO,IAAU,WAsBlB,SAAS,CAAoB,CACnC,EACA,EACA,EACA,EACU,CACV,GAAI,OAAO,IAAkB,SAC5B,OAAO,EAAS,OAAW,CAAa,EAGzC,OAAO,EAAO,EAAe,CAAa,EAyBpC,SAAS,CAAqB,CACpC,EACA,EACA,EACA,EACA,EACU,CACV,GAAI,OAAO,IAAkB,SAAU,CACtC,GAAI,CAAC,EAAS,CAAa,EAC1B,MAAU,UAAU,oDAAoD,EAGzE,OAAO,EAAS,EAAe,CAAa,EAG7C,GAAI,CAAC,EACJ,MAAU,UAAU,wDAAwD,EAG7E,OAAO,EAAO,EAAe,EAAe,CAAU,EClDhD,SAAS,CAA0B,CAAC,EA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G,CAAI,ICRb,SAAS,CAAQ,CAAC,EAAiB,CAUzC,SAAS,CAAS,CACjB,EACA,EACA,EACkD,CAClD,OAAO,EACN,EAAiB,CAAO,EACxB,EAAe,CAAO,EACtB,EACA,EACA,CACD,EAGD,OAAO",
|
|
12
|
+
"debugId": "7F87A38B675BC95764756E2164756E21",
|
|
8
13
|
"names": []
|
|
9
14
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type EventEmitterConfig } from '../tools/event-emitter';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RadiantElement } from '../core/radiant-element';
|
|
3
3
|
/**
|
|
4
4
|
* Decorator that attaches an EventEmitter to the class field property.
|
|
5
5
|
* The EventEmitter can be used to dispatch custom events from the target element.
|
|
6
6
|
* @param eventConfig {@link EventEmitterConfig} Configuration for the event emitter.
|
|
7
7
|
* @see {@link EventEmitter} for more details about how the EventEmitter works.
|
|
8
8
|
*/
|
|
9
|
-
export declare function event(eventConfig: EventEmitterConfig):
|
|
9
|
+
export declare function event(eventConfig: EventEmitterConfig): {
|
|
10
|
+
<THost extends RadiantElement, TValue>(protoOrTarget: undefined, nameOrContext: ClassFieldDecoratorContext<THost, TValue>): void;
|
|
11
|
+
(protoOrTarget: RadiantElement, nameOrContext: string): void;
|
|
12
|
+
};
|
package/dist/decorators/event.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var P=((d)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(d,{get:(o,u)=>(typeof require<"u"?require:o)[u]}):d)(function(d){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+d+'" is not supported')});var F=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function R(d,o){let r=d[F];if(Array.isArray(r)){r.push(o);return}Object.defineProperty(d,F,{value:[o],configurable:!0})}function D(d){let o=[],u=Object.getPrototypeOf(d);while(u&&u!==Object.prototype)o.push(u),u=Object.getPrototypeOf(u);for(let r=o.length-1;r>=0;r-=1){let s=o[r][F];if(!Array.isArray(s))continue;for(let H of s)H(d)}}function y(d){return typeof d==="function"}function x(d,o,u,r){if(typeof r==="object")return d(void 0,r);return o(u,r)}function n(d,o,u,r,s){if(typeof r==="object"){if(!y(u))throw TypeError("Standard method decorators require a method target");return d(u,r)}if(!s)throw TypeError("Legacy method decorators require a property descriptor");return o(u,r,s)}class t{host;eventConfig;constructor(d,o){this.host=d,this.eventConfig=o}emit(d){let o=new CustomEvent(this.eventConfig.name,{detail:d,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(o)}}function M(d,o){let u=new t(d,o);return d.registerEventEmitter(o.name,u),u}function a(d){return(o,u)=>{R(o,(r)=>{let s=M(r,d);r.registerConnectedCallback(()=>{Object.defineProperty(r,u,{get(){return s},enumerable:!0,configurable:!0})})})}}function c(d){return function(o,u){u.addInitializer(function(){let r=M(this,d);Object.defineProperty(this,u.name,{get(){return r},enumerable:!0,configurable:!0})})}}function Q(d){function o(u,r){return x(c(d),a(d),u,r)}return o}export{Q as event};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=16D85C878AD39F9F64756E2164756E21
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
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');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
|
|
6
|
+
"import 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
|
+
"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
|
+
"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",
|
|
9
|
+
"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",
|
|
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
|
+
"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"
|
|
5
12
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
13
|
+
"mappings": "2PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAQzF,SAAS,CAAmD,CACl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7B,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": "16D85C878AD39F9F64756E2164756E21",
|
|
8
15
|
"names": []
|
|
9
16
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var Y=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var T=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function x(n,t){let c=n[T];if(Array.isArray(c)){c.push(t);return}Object.defineProperty(n,T,{value:[t],configurable:!0})}function w(n){let t=[],e=Object.getPrototypeOf(n);while(e&&e!==Object.prototype)t.push(e),e=Object.getPrototypeOf(e);for(let c=t.length-1;c>=0;c-=1){let i=t[c][T];if(!Array.isArray(i))continue;for(let r of i)r(n)}}function $(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function q(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 v(n){switch(n){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function D(n){try{return JSON.parse(n)}catch{throw TypeError("Invalid JSON string")}}var Q={array(n){let t=D(n);if(!Array.isArray(t))throw TypeError(`Expected an array but got a value of type "${typeof t}"`);return t},boolean(n){return!(n==="0"||String(n).toLowerCase()==="false")},number(n){return Number(n.replace(/_/g,""))},object(n){let t=JSON.parse(n);if(t===null||typeof t!=="object"||Array.isArray(t))throw TypeError(`expected value of type "object" but instead got value "${n}" of type "${q(t)}"`);return t},string(n){return n}},u={default:C,array:M,object:M};function M(n){return JSON.stringify(n)}function C(n){return`${n}`}function f(n,t){let e=$(t);if(!e)throw TypeError(`[radiant-element] Unknown type "${t}"`);return Q[e](n)}function L(n,t){let e=$(t);if(!e)throw TypeError(`[radiant-element] Unknown type "${t}"`);return(u[e]??u.default??C)(n)}function W(n){return typeof n==="boolean"}function X(n){return typeof n==="number"}function E(n){return typeof n==="string"}function K(n){return Array.isArray(n)}function P(n){return typeof n==="object"&&!Array.isArray(n)&&n!==null}function U(n,t){switch(n){case Boolean:return W(t);case Number:return X(t);case String:return E(t);case Array:return K(t);case Object:return P(t);default:return!1}}var V=(n,t,e,c)=>{if(t===Boolean){let r=n.getAttribute(e);if(r===null)return c;return r===""?!0:f(r,t)}let i=n.getAttribute(e);return i!==null?f(i,t):c??v(t)};function H(n){if(n instanceof Element)return n;if("host"in n)return n.host;return n.element}function Z(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function G(n,t){if(t.converter?.fromAttribute){let e=t.converter.fromAttribute(n);if(n===null&&e===void 0&&"defaultValue"in t)return t.defaultValue;return e}if(t.type){if(n===null)return t.defaultValue??v(t.type);if(t.type===Boolean&&n==="")return!0;return f(n,t.type)}if(n===null)return t.defaultValue;return n}function A(n,t,e){return G(H(n).getAttribute(t),e)}function J(n,t,e,c){let i=c.converter?.toAttribute?c.converter.toAttribute(e):c.type?L(e,c.type):e==null?null:String(e);if(i===null){n.removeAttribute(t);return}n.setAttribute(t,i)}function j(n,t,e={}){if(e.type&&e.defaultValue!==void 0&&!U(e.type,e.defaultValue))throw Error(`defaultValue does not match the expected type for ${e.type.name}`);let c=n,i=e.source??Z(t),r=Symbol(`@ecopages/radiant/attr:${t}:observer`),b=Symbol(`@ecopages/radiant/attr:${t}:last-value`),F=e.bind??n.shouldAutoBindReactiveMembers?.()??!1;n.defineReactiveBinding(t,F),n.registerReactiveDependencyReader(t,()=>A(n,i,e)),c[b]=A(n,i,e),Object.defineProperty(n,t,{get(){return n.trackReactiveRead(t),A(this,i,e)},set(d){let R=H(this),g=A(this,i,e);J(R,i,d,e);let s=A(this,i,e);if(Object.is(g,s))return;this[b]=s,n.notifyUpdate(t,g,s)},enumerable:!0,configurable:!0});let B=()=>{c[r]?.disconnect()},O=()=>{let d=A(n,i,e),R=c[b];if(!Object.is(R,d))c[b]=d,n.notifyUpdate(t,R,d);if(typeof MutationObserver>"u")return;let g=H(n);B();let s=new MutationObserver(()=>{let k=A(n,i,e),m=c[b];if(Object.is(m,k))return;c[b]=k,n.notifyUpdate(t,m,k)});s.observe(g,{attributeFilter:[i],attributes:!0}),c[r]=s};O(),n.registerConnectedCallback(O),n.registerCleanupCallback(B)}function l(n={}){return(t,e)=>{let c=Symbol(`@ecopages/radiant/attr:${e}:installed`);x(t,(i)=>{i.registerConnectedCallback(()=>{if(i[c])return;let r=i[e],b=n.defaultValue===void 0?r:n.defaultValue;j(i,e,{...n,defaultValue:b}),i[c]=!0})})}}export{l as reactiveAttr};
|
|
2
|
+
|
|
3
|
+
//# debugId=AE64EA9575061F1D64756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/utils/attribute-utils.ts", "../src/decorators/shared/reactive-attr.ts", "../src/decorators/legacy/attr.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
|
|
6
|
+
"import 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 { ReactiveHostLike } from '../../core/reactive-host';\nimport type { ReactiveBindingOption } from '../../core/radiant-element';\nimport {\n\tdefaultValueForType,\n\tisValueOfType,\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 && options.defaultValue !== undefined && !isValueOfType(options.type, options.defaultValue)) {\n\t\tthrow new Error(`defaultValue does not match the expected type for ${options.type.name}`);\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 lastValueKey = Symbol(`@ecopages/radiant/attr:${propertyName}:last-value`);\n\tconst bind =\n\t\toptions.bind ??\n\t\t(host as unknown as { shouldAutoBindReactiveMembers?: () => boolean }).shouldAutoBindReactiveMembers?.() ??\n\t\tfalse;\n\n\thost.defineReactiveBinding(propertyName, bind);\n\thost.registerReactiveDependencyReader(propertyName, () => readReactiveAttributeValue(host, attributeName, options));\n\thostRecord[lastValueKey] = readReactiveAttributeValue(host, attributeName, options);\n\n\tObject.defineProperty(host, propertyName, {\n\t\tget() {\n\t\t\thost.trackReactiveRead(propertyName);\n\t\t\treturn readReactiveAttributeValue(this as ReactiveAttributeHostLike, attributeName, options);\n\t\t},\n\t\tset(newValue: TValue) {\n\t\t\tconst target = resolveAttributeTarget(this as ReactiveAttributeHostLike);\n\t\t\tconst oldValue = readReactiveAttributeValue(this as ReactiveAttributeHostLike, attributeName, options);\n\t\t\twriteReactiveAttributeValue(target, attributeName, newValue, options);\n\t\t\tconst nextValue = readReactiveAttributeValue(this as ReactiveAttributeHostLike, attributeName, options);\n\n\t\t\tif (Object.is(oldValue, nextValue)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t(this as Record<PropertyKey, unknown>)[lastValueKey] = nextValue;\n\t\t\thost.notifyUpdate(propertyName, oldValue, nextValue);\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\tconst nextValue = readReactiveAttributeValue(host, attributeName, options);\n\t\tconst previousValue = hostRecord[lastValueKey];\n\n\t\tif (!Object.is(previousValue, nextValue)) {\n\t\t\thostRecord[lastValueKey] = nextValue;\n\t\t\thost.notifyUpdate(propertyName, previousValue, nextValue);\n\t\t}\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\tconst currentValue = readReactiveAttributeValue(host, attributeName, options);\n\t\t\tconst lastValue = hostRecord[lastValueKey];\n\n\t\t\tif (Object.is(lastValue, currentValue)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\thostRecord[lastValueKey] = currentValue;\n\t\t\thost.notifyUpdate(propertyName, lastValue, currentValue);\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",
|
|
8
|
+
"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\t| TValue\n\t\t\t\t\t| 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"
|
|
9
|
+
],
|
|
10
|
+
"mappings": "2PAEA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|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var x=((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 B(f,j,q){let v=q.value;return{configurable:!0,get(){if(this===f.prototype||Object.prototype.hasOwnProperty.call(this,j))return v;let w=v.bind(this);return Object.defineProperty(this,j,{value:w,configurable:!0,writable:!0}),w}}}export{B as bound};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=002989A9EF405CB664756E2164756E21
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/decorators/legacy/bound.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
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"
|
|
5
6
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
7
|
+
"mappings": "2PASO,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": "002989A9EF405CB664756E2164756E21",
|
|
8
9
|
"names": []
|
|
9
10
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var y=((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 q=Symbol.for("@ecopages/radiant.customElementTagName");function x(b,j){b[q]=j}function B(b){return b[q]}function H(b,j){return(k)=>{if(x(k,b),typeof customElements<"u"&&!customElements.get(b))customElements.define(b,k,j)}}export{H as customElement};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=A99CB015E651C8C064756E2164756E21
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/core/custom-element-metadata.ts", "../src/decorators/legacy/custom-element.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
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
|
+
"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"
|
|
5
7
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
8
|
+
"mappings": "2PAAO,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": "A99CB015E651C8C064756E2164756E21",
|
|
8
10
|
"names": []
|
|
9
11
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var f=((y)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(y,{get:(F,D)=>(typeof require<"u"?require:F)[D]}):y)(function(y){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+y+'" is not supported')});function P(y,F){let D=null,r=null,t,j=()=>{if(D!==null)clearTimeout(D),D=null},K=()=>{if(r===null)return t;let M=r;return r=null,j(),t=M(),t},E=function(...M){r=()=>y.apply(this,M),j(),D=setTimeout(()=>{K()},F)};return E.cancel=()=>{j(),r=null},E.flush=()=>{if(r===null)return t;return K()},E.pending=()=>r!==null,E}function q(y){return(F,D,r)=>{let t=r.value,j=new WeakMap;return r.value=function(...E){let M=j.get(this);if(!M)M=P((..._)=>{return t.apply(this,_)},y),j.set(this,M);M(...E)},r}}export{q as debounce};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=BB1D62C7B0AC636264756E2164756E21
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/helpers/debounce.ts", "../src/decorators/legacy/debounce.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
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
|
+
"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"
|
|
5
7
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
8
|
+
"mappings": "2PA2CO,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": "BB1D62C7B0AC636264756E2164756E21",
|
|
8
10
|
"names": []
|
|
9
11
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var $=((B)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(B,{get:(D,H)=>(typeof require<"u"?require:D)[H]}):B)(function(B){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+B+'" is not supported')});var Q=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function V(B,D){let M=B[Q];if(Array.isArray(M)){M.push(D);return}Object.defineProperty(B,Q,{value:[D],configurable:!0})}function k(B){let D=[],H=Object.getPrototypeOf(B);while(H&&H!==Object.prototype)D.push(H),H=Object.getPrototypeOf(H);for(let M=D.length-1;M>=0;M-=1){let O=D[M][Q];if(!Array.isArray(O))continue;for(let X of O)X(B)}}class U{host;eventConfig;constructor(B,D){this.host=B,this.eventConfig=D}emit(B){let D=new CustomEvent(this.eventConfig.name,{detail:B,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(D)}}function W(B,D){let H=new U(B,D);return B.registerEventEmitter(D.name,H),H}function Z(B){return(D,H)=>{V(D,(M)=>{let O=W(M,B);M.registerConnectedCallback(()=>{Object.defineProperty(M,H,{get(){return O},enumerable:!0,configurable:!0})})})}}export{Z as event};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=A4AD67BA372E657C64756E2164756E21
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/tools/event-emitter.ts", "../src/helpers/create-event.ts", "../src/decorators/legacy/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');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n",
|
|
6
|
+
"import 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"
|
|
5
9
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
10
|
+
"mappings": "2PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAQzF,SAAS,CAAmD,CAClE,EACA,EACO,CAEP,IAAM,EADS,EACgB,GAE/B,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAO,EAA8B,CAC1D,MAAO,CAAC,CAAW,EACnB,aAAc,EACf,CAAC,EASK,SAAS,CAA+C,CAAC,EAAmB,CAClF,IAAM,EAAuB,CAAC,EAC1B,EAAmB,OAAO,eAAe,CAAQ,EAErD,MAAO,GAAoB,IAAqB,OAAO,UACtD,EAAW,KAAK,CAAgB,EAChC,EAAmB,OAAO,eAAe,CAAgB,EAG1D,QAAS,EAAQ,EAAW,OAAS,EAAG,GAAS,EAAG,GAAS,EAAG,CAC/D,IAAM,EAAgB,EAAW,GAAwC,GAIzE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,SAGD,QAAW,KAAe,EACzB,EAAY,CAAQ,GCvChB,MAAM,CAA0B,CAC9B,KACA,YAQR,WAAW,CAAC,EAAsB,EAAiC,CAClE,KAAK,KAAO,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",
|
|
11
|
+
"debugId": "A4AD67BA372E657C64756E2164756E21",
|
|
8
12
|
"names": []
|
|
9
13
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
type LegacyInstanceInitializer = (instance: RadiantElement) => void;
|
|
1
|
+
type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;
|
|
3
2
|
/**
|
|
4
3
|
* Registers per-instance initialization work for a legacy decorator.
|
|
5
4
|
*
|
|
6
5
|
* Legacy decorators execute against the prototype, so any initialization that
|
|
7
6
|
* needs the concrete element instance must be deferred until construction time.
|
|
8
7
|
*/
|
|
9
|
-
export declare function registerLegacyInstanceInitializer(proto:
|
|
8
|
+
export declare function registerLegacyInstanceInitializer<T extends object>(proto: T, initializer: LegacyInstanceInitializer<T>): void;
|
|
10
9
|
/**
|
|
11
10
|
* Runs all legacy decorator initializers for a newly constructed element.
|
|
12
11
|
*
|
|
13
12
|
* Initializers are collected from the prototype chain and executed from base to
|
|
14
13
|
* derived class so inherited setup remains stable.
|
|
15
14
|
*/
|
|
16
|
-
export declare function runLegacyInstanceInitializers(instance:
|
|
15
|
+
export declare function runLegacyInstanceInitializers<T extends object>(instance: T): void;
|
|
17
16
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var J=((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')});var D=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function M(j,k){let B=j[D];if(Array.isArray(B)){B.push(k);return}Object.defineProperty(j,D,{value:[k],configurable:!0})}function O(j){let k=[],q=Object.getPrototypeOf(j);while(q&&q!==Object.prototype)k.push(q),q=Object.getPrototypeOf(q);for(let B=k.length-1;B>=0;B-=1){let F=k[B][D];if(!Array.isArray(F))continue;for(let H of F)H(j)}}export{O as runLegacyInstanceInitializers,M as registerLegacyInstanceInitializer};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=1BB39F3AF54A4F4C64756E2164756E21
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.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');\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = target[LEGACY_INSTANCE_INITIALIZERS];\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(proto, LEGACY_INSTANCE_INITIALIZERS, {\n\t\tvalue: [initializer],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\tconst prototypes: object[] = [];\n\tlet currentPrototype = Object.getPrototypeOf(instance);\n\n\twhile (currentPrototype && currentPrototype !== Object.prototype) {\n\t\tprototypes.push(currentPrototype);\n\t\tcurrentPrototype = Object.getPrototypeOf(currentPrototype);\n\t}\n\n\tfor (let index = prototypes.length - 1; index >= 0; index -= 1) {\n\t\tconst initializers = (prototypes[index] as Record<PropertyKey, unknown>)[LEGACY_INSTANCE_INITIALIZERS] as\n\t\t\t| LegacyInstanceInitializer<T>[]\n\t\t\t| undefined;\n\n\t\tif (!Array.isArray(initializers)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const initializer of initializers) {\n\t\t\tinitializer(instance);\n\t\t}\n\t}\n}\n"
|
|
5
6
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
7
|
+
"mappings": "2PAEA,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAQzF,SAAS,CAAmD,CAClE,EACA,EACO,CAEP,IAAM,EADS,EACgB,GAE/B,GAAI,MAAM,QAAQ,CAAe,EAAG,CACnC,EAAgB,KAAK,CAAW,EAChC,OAGD,OAAO,eAAe,EAAO,EAA8B,CAC1D,MAAO,CAAC,CAAW,EACnB,aAAc,EACf,CAAC,EASK,SAAS,CAA+C,CAAC,EAAmB,CAClF,IAAM,EAAuB,CAAC,EAC1B,EAAmB,OAAO,eAAe,CAAQ,EAErD,MAAO,GAAoB,IAAqB,OAAO,UACtD,EAAW,KAAK,CAAgB,EAChC,EAAmB,OAAO,eAAe,CAAgB,EAG1D,QAAS,EAAQ,EAAW,OAAS,EAAG,GAAS,EAAG,GAAS,EAAG,CAC/D,IAAM,EAAgB,EAAW,GAAwC,GAIzE,GAAI,CAAC,MAAM,QAAQ,CAAY,EAC9B,SAGD,QAAW,KAAe,EACzB,EAAY,CAAQ",
|
|
8
|
+
"debugId": "1BB39F3AF54A4F4C64756E2164756E21",
|
|
8
9
|
"names": []
|
|
9
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EventListenerHost } from '../../helpers/create-event-listener';
|
|
2
2
|
import type { OnEventConfig } from '../on-event';
|
|
3
3
|
/**
|
|
4
4
|
* A decorator to subscribe to an event on the target element.
|
|
@@ -14,4 +14,4 @@ import type { OnEventConfig } from '../on-event';
|
|
|
14
14
|
* @param eventConfig.type The type of the event to listen for.
|
|
15
15
|
* @param eventConfig.options Optional. An options object that specifies characteristics about the event listener.
|
|
16
16
|
*/
|
|
17
|
-
export declare function onEvent(eventConfig: OnEventConfig): (proto:
|
|
17
|
+
export declare function onEvent(eventConfig: OnEventConfig): (proto: EventListenerHost, _: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var T=((B)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(B,{get:(j,Q)=>(typeof require<"u"?require:j)[Q]}):B)(function(B){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+B+'" is not supported')});var O=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function Y(B,j){let U=B[O];if(Array.isArray(U)){U.push(j);return}Object.defineProperty(B,O,{value:[j],configurable:!0})}function S(B){let j=[],Q=Object.getPrototypeOf(B);while(Q&&Q!==Object.prototype)j.push(Q),Q=Object.getPrototypeOf(Q);for(let U=j.length-1;U>=0;U-=1){let V=j[U][O];if(!Array.isArray(V))continue;for(let W of V)W(B)}}var F=Symbol("radiant.shadowRootListenerHooks"),Z=Symbol("radiant.patchedAttachShadow");function P(B){if(B instanceof Element)return B;if("host"in B)return B.host;return B.element}function _(B){return!(B instanceof Element)}function x(B,j,Q,U){let V=(W)=>{if(W.target instanceof Element&&W.target.matches(Q))U(W)};return B.addEventListener(j.type,V,j.options),()=>{B.removeEventListener(j.type,V,j.options)}}function N(B,j){let Q=P(B);if(!Q[F])Q[F]=new Set;if(Q[F].add(j),Q[Z])return;let U=Q.attachShadow;Q.attachShadow=function(W){let X=U.call(this,W);for(let $ of Q[F]??[])$();return X},Q[Z]=!0}function K(B,j,Q){if(_(B)&&"scope"in j&&j.scope&&j.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let U=P(B),V=Q.bind(B),W=null,X=null,$=null,q=null,M=!1,D=()=>{W?.(),X?.(),$?.(),q?.(),W=null,X=null,$=null,q=null},J=()=>{if(M)return;if("window"in j&&!W)window.addEventListener(j.type,V,j.options),W=()=>{window.removeEventListener(j.type,V,j.options)};if("document"in j&&!X)document.addEventListener(j.type,V,j.options),X=()=>{document.removeEventListener(j.type,V,j.options)};if("selector"in j||"ref"in j){let G="selector"in j?j.selector:`[data-ref='${CSS.escape(j.ref)}']`;if(j.scope!=="shadow"&&!$)$=x(U,j,G,V);if(j.scope!=="light"&&U.shadowRoot&&!q)q=x(U.shadowRoot,j,G,V)}};if("selector"in j||"ref"in j){if(j.scope!=="light")N(B,()=>{if(B.isConnected)J()})}if(B.registerConnectedCallback(J),B.registerCleanupCallback(D),B.isConnected)J();return()=>{M=!0,D()}}function b(B){return(j,Q,U)=>{let V=U.value;return Y(j,(W)=>{K(W,B,V.bind(W))}),U}}export{b as onEvent};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=9FC7ADB59FE8498264756E2164756E21
|