@ecopages/radiant 0.3.0-alpha.4 → 0.3.0-alpha.5
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 +66 -56
- 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/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 +11 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +87 -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 +22 -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
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/tools/escape-script-json.ts", "../src/core/hydration-codec.ts", "../src/core/slot-projection-runtime.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"/**\n * Escapes serialized JSON so it remains safe when embedded inside an HTML\n * `<script>` tag.\n */\nexport function escapeScriptJson(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n",
|
|
6
|
+
"import { escapeScriptJson } from '../tools/escape-script-json';\n\n/** Attribute marker used to identify hydration payloads inside a host. */\nexport const HYDRATION_ATTRIBUTE = 'data-hydration';\n/** Discriminator that scopes a hydration payload to a specific feature. */\nexport const HYDRATION_TYPE_ATTRIBUTE = 'data-hydration-type';\n/** Optional key that scopes a hydration payload to a specific decorated field. */\nexport const HYDRATION_KEY_ATTRIBUTE = 'data-hydration-key';\n\nexport type HydrationPayloadType = 'signal' | 'context';\n\ntype HydrationScriptHost = {\n\tchildren?: ArrayLike<Element> | undefined;\n\tchildNodes?: ArrayLike<{ nodeType: number }> | undefined;\n};\n\n/** Creates a `<script type=\"application/json\">` tag for a hydration payload. */\nexport function createHydrationScriptTag(options: {\n\ttype: HydrationPayloadType;\n\thydrationKey?: string;\n\tserializedValue: string;\n}): string {\n\tconst keyAttribute = options.hydrationKey\n\t\t? ` ${HYDRATION_KEY_ATTRIBUTE}=\"${escapeHtmlAttribute(options.hydrationKey)}\"`\n\t\t: '';\n\n\treturn `<script type=\"application/json\" ${HYDRATION_ATTRIBUTE} ${HYDRATION_TYPE_ATTRIBUTE}=\"${options.type}\"${keyAttribute}>${options.serializedValue}</script>`;\n}\n\n/** Escapes serialized JSON so it remains safe inside an HTML script tag. */\nexport function escapeHydrationJson(value: string): string {\n\treturn escapeScriptJson(value);\n}\n\n/** Parses JSON from a hydration script element, returning the fallback on failure. */\nexport function parseHydrationPayload<T>(element: Element, fallback: T): T {\n\tconst textContent = element.textContent;\n\n\tif (!textContent) {\n\t\treturn fallback;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(textContent) as T;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn(\n\t\t\t\t`[@ecopages/radiant] Failed to parse hydration payload from <script ${HYDRATION_ATTRIBUTE}>:`,\n\t\t\t\ttextContent.slice(0, 120),\n\t\t\t);\n\t\t}\n\t\treturn fallback;\n\t}\n}\n\n/**\n * Finds a hydration script element inside a host by type and optional key.\n *\n * When a key is provided, looks for an exact `data-hydration-key` match.\n * Otherwise, returns the first unkeyed script matching the type.\n */\nexport function findHydrationScript(\n\thost: HydrationScriptHost,\n\ttype: HydrationPayloadType,\n\thydrationKey?: string,\n): Element | null {\n\tconst children = host.children;\n\n\tif (!children || children.length === 0) {\n\t\tconst childNodes = (host as Partial<{ childNodes: ArrayLike<{ nodeType: number }> }>).childNodes;\n\n\t\tif (!childNodes || childNodes.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (let i = 0; i < childNodes.length; i += 1) {\n\t\t\tconst node = childNodes[i]!;\n\n\t\t\tif (node.nodeType !== 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst element = node as unknown as Element;\n\n\t\t\tif (matchesHydrationScript(element, type, hydrationKey)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfor (let i = 0; i < children.length; i += 1) {\n\t\tif (matchesHydrationScript(children[i]!, type, hydrationKey)) {\n\t\t\treturn children[i]!;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction matchesHydrationScript(element: Element, type: HydrationPayloadType, hydrationKey?: string): boolean {\n\tif (\n\t\telement.tagName !== 'SCRIPT' ||\n\t\t!element.hasAttribute(HYDRATION_ATTRIBUTE) ||\n\t\telement.getAttribute(HYDRATION_TYPE_ATTRIBUTE) !== type\n\t) {\n\t\treturn false;\n\t}\n\n\tif (hydrationKey !== undefined) {\n\t\treturn element.getAttribute(HYDRATION_KEY_ATTRIBUTE) === hydrationKey;\n\t}\n\n\treturn !element.hasAttribute(HYDRATION_KEY_ATTRIBUTE);\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n",
|
|
7
|
+
"import {\n\tcreateMarkupNodeLike,\n\tisKeyedJsxValue,\n\tisSlotJsxValue,\n\ttype JsxRenderable,\n\ttype KeyedJsxValue,\n\ttype SlotJsxValue,\n\ttype TemplateResultLike,\n} from '@ecopages/jsx';\n\nimport { HYDRATION_ATTRIBUTE } from './hydration-codec';\n\nexport const DEFAULT_SLOT_NAME = '';\nexport const SLOT_PROJECTION_SCRIPT_ATTRIBUTE = 'data-radiant-slot-projection';\n\ntype ResolvedSlotProjection = {\n\tcontainsSlots: boolean;\n\tvalue: JsxRenderable;\n};\n\nexport function captureProjectedSlotRenderables(host: HTMLElement): Map<string, JsxRenderable[]> {\n\tconst projectedContent = new Map<string, JsxRenderable[]>();\n\n\tfor (const node of Array.from(host.childNodes)) {\n\t\tif (isIgnoredProjectedNode(node)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tappendProjectedRenderable(projectedContent, getNodeSlotName(node), node);\n\t}\n\n\treturn projectedContent;\n}\n\nexport function deserializeProjectedSlotRenderables(payload: string): Map<string, JsxRenderable[]> {\n\tlet parsedPayload: Record<string, string[]>;\n\n\ttry {\n\t\tparsedPayload = JSON.parse(payload) as Record<string, string[]>;\n\t} catch {\n\t\tif (typeof console !== 'undefined') {\n\t\t\tconsole.warn('[@ecopages/radiant] Failed to parse slot projection payload:', payload.slice(0, 120));\n\t\t}\n\t\treturn new Map();\n\t}\n\n\tconst projectedContent = new Map<string, JsxRenderable[]>();\n\n\tfor (const [slotName, fragments] of Object.entries(parsedPayload)) {\n\t\tif (!Array.isArray(fragments) || fragments.length === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tprojectedContent.set(\n\t\t\tnormalizeSlotName(slotName),\n\t\t\tfragments.map((fragment) => createMarkupNodeLike(fragment)),\n\t\t);\n\t}\n\n\treturn projectedContent;\n}\n\nexport function collectAuthoredHydrationScriptMarkup(host: HTMLElement): string | undefined {\n\tconst fragments = Array.from(host.childNodes)\n\t\t.filter((node): node is HTMLScriptElement => isHydrationScriptNode(node))\n\t\t.map((node) => renderableToHtmlFragment(node) ?? '')\n\t\t.filter((fragment) => fragment !== '');\n\n\treturn fragments.length > 0 ? fragments.join('') : undefined;\n}\n\nexport function serializeProjectedSlotRenderables(\n\tprojectedContent: ReadonlyMap<string, readonly JsxRenderable[]>,\n): string | undefined {\n\tconst payload: Record<string, string[]> = {};\n\n\tfor (const [slotName, renderables] of projectedContent.entries()) {\n\t\tconst fragments = renderables\n\t\t\t.map((renderable) => renderableToHtmlFragment(renderable))\n\t\t\t.filter((fragment): fragment is string => fragment !== undefined && fragment !== '');\n\n\t\tif (fragments.length > 0) {\n\t\t\tpayload[slotName] = fragments;\n\t\t}\n\t}\n\n\treturn Object.keys(payload).length > 0 ? JSON.stringify(payload) : undefined;\n}\n\nexport function resolveSlotProjection(\n\tvalue: JsxRenderable,\n\tprojectedContent: ReadonlyMap<string, readonly JsxRenderable[]>,\n): ResolvedSlotProjection {\n\tlet containsSlots = false;\n\n\tconst resolveValue = (currentValue: JsxRenderable): JsxRenderable => {\n\t\tif (isSlotJsxValue(currentValue)) {\n\t\t\tcontainsSlots = true;\n\t\t\treturn resolveSlotValue(currentValue, projectedContent, resolveValue);\n\t\t}\n\n\t\tif (isKeyedJsxValue(currentValue)) {\n\t\t\treturn cloneKeyedJsxValue(currentValue, resolveValue(currentValue.value));\n\t\t}\n\n\t\tif (isTemplateResultLike(currentValue)) {\n\t\t\treturn {\n\t\t\t\t_$rType$: 1,\n\t\t\t\trootLocalName: currentValue.rootLocalName,\n\t\t\t\tstrings: currentValue.strings,\n\t\t\t\tvalues: currentValue.values.map((entry) => resolveValue(entry as JsxRenderable)),\n\t\t\t} satisfies TemplateResultLike;\n\t\t}\n\n\t\tif (isIterableRenderable(currentValue)) {\n\t\t\treturn Array.from(currentValue, (entry) => resolveValue(entry as JsxRenderable));\n\t\t}\n\n\t\treturn currentValue;\n\t};\n\n\tconst resolvedValue = resolveValue(value);\n\n\treturn {\n\t\tcontainsSlots,\n\t\tvalue: resolvedValue,\n\t};\n}\n\nexport function takeSlotProjectionScriptPayload(host: HTMLElement): string | undefined {\n\tfor (const node of Array.from(host.childNodes)) {\n\t\tif (!isSlotProjectionScriptNode(node)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst payload = node.textContent ?? undefined;\n\t\tnode.parentNode?.removeChild(node);\n\t\treturn payload;\n\t}\n\n\treturn undefined;\n}\n\nfunction appendProjectedRenderable(\n\tprojectedContent: Map<string, JsxRenderable[]>,\n\tslotName: string,\n\trenderable: JsxRenderable,\n): void {\n\tconst existingRenderables = projectedContent.get(slotName);\n\n\tif (existingRenderables) {\n\t\texistingRenderables.push(renderable);\n\t\treturn;\n\t}\n\n\tprojectedContent.set(slotName, [renderable]);\n}\n\nfunction cloneKeyedJsxValue(value: KeyedJsxValue, nextValue: JsxRenderable): KeyedJsxValue {\n\treturn {\n\t\t...value,\n\t\tvalue: nextValue,\n\t};\n}\n\nfunction getNodeSlotName(node: Node): string {\n\tif (node instanceof Element) {\n\t\treturn normalizeSlotName(node.getAttribute('slot'));\n\t}\n\n\treturn DEFAULT_SLOT_NAME;\n}\n\nfunction isIterableRenderable(value: JsxRenderable): value is Iterable<JsxRenderable> {\n\treturn typeof value !== 'string' && typeof value === 'object' && value !== null && Symbol.iterator in value;\n}\n\nfunction isSlotProjectionScriptNode(node: Node): node is HTMLScriptElement {\n\treturn node instanceof HTMLScriptElement && node.hasAttribute(SLOT_PROJECTION_SCRIPT_ATTRIBUTE);\n}\n\nfunction isHydrationScriptNode(node: Node): node is HTMLScriptElement {\n\treturn node instanceof HTMLScriptElement && node.hasAttribute(HYDRATION_ATTRIBUTE);\n}\n\nfunction isIgnoredProjectedNode(node: Node): boolean {\n\treturn isSlotProjectionScriptNode(node) || isHydrationScriptNode(node);\n}\n\nfunction isTemplateResultLike(value: JsxRenderable): value is TemplateResultLike {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t(value as Partial<TemplateResultLike>)['_$rType$'] === 1 &&\n\t\tArray.isArray((value as Partial<TemplateResultLike>).strings) &&\n\t\tArray.isArray((value as Partial<TemplateResultLike>).values)\n\t);\n}\n\nfunction normalizeSlotName(name: string | undefined | null): string {\n\treturn name ?? DEFAULT_SLOT_NAME;\n}\n\nfunction renderableToHtmlFragment(renderable: JsxRenderable): string | undefined {\n\tif (renderable === undefined || renderable === null || renderable === false || renderable === true) {\n\t\treturn undefined;\n\t}\n\n\tif (typeof Node !== 'undefined' && renderable instanceof Node) {\n\t\tif (renderable.nodeType === Node.TEXT_NODE) {\n\t\t\treturn renderable.textContent ?? '';\n\t\t}\n\n\t\treturn (renderable as Element).outerHTML ?? renderable.textContent ?? undefined;\n\t}\n\n\tif (isKeyedJsxValue(renderable)) {\n\t\treturn renderableToHtmlFragment(renderable.value);\n\t}\n\n\tif (typeof renderable === 'string' || typeof renderable === 'number' || typeof renderable === 'bigint') {\n\t\treturn String(renderable);\n\t}\n\n\tif (typeof renderable === 'object' && renderable !== null && 'outerHTML' in renderable) {\n\t\treturn typeof renderable.outerHTML === 'string' ? renderable.outerHTML : (renderable.textContent ?? undefined);\n\t}\n\n\tif (isIterableRenderable(renderable)) {\n\t\treturn Array.from(renderable, (entry) => renderableToHtmlFragment(entry as JsxRenderable) ?? '').join('');\n\t}\n\n\treturn undefined;\n}\n\nfunction resolveSlotValue(\n\tvalue: SlotJsxValue,\n\tprojectedContent: ReadonlyMap<string, readonly JsxRenderable[]>,\n\tresolveValue: (value: JsxRenderable) => JsxRenderable,\n): JsxRenderable {\n\tconst assignedContent = projectedContent.get(normalizeSlotName(value.name));\n\n\tif (assignedContent && assignedContent.length > 0) {\n\t\treturn assignedContent.length === 1 ? assignedContent[0] : (assignedContent as JsxRenderable);\n\t}\n\n\tif (value.fallback === undefined) {\n\t\treturn '';\n\t}\n\n\treturn resolveValue(value.fallback);\n}\n"
|
|
5
8
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
9
|
+
"mappings": "2PAIO,SAAS,CAAgB,CAAC,EAAuB,CACvD,OAAO,EACL,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,UAAW,SAAS,EAC5B,QAAQ,UAAW,SAAS,ECPxB,IAAM,EAAsB,iBAEtB,EAA2B,sBAE3B,EAA0B,qBAUhC,SAAS,CAAwB,CAAC,EAI9B,CACV,IAAM,EAAe,EAAQ,aAC1B,IAAI,MAA4B,EAAoB,EAAQ,YAAY,KACxE,GAEH,MAAO,mCAAmC,KAAuB,MAA6B,EAAQ,QAAQ,KAAgB,EAAQ,2BAIhI,SAAS,CAAmB,CAAC,EAAuB,CAC1D,OAAO,EAAiB,CAAK,EAIvB,SAAS,CAAwB,CAAC,EAAkB,EAAgB,CAC1E,IAAM,EAAc,EAAQ,YAE5B,GAAI,CAAC,EACJ,OAAO,EAGR,GAAI,CACH,OAAO,KAAK,MAAM,CAAW,EAC5B,KAAM,CACP,GAAI,OAAO,QAAY,IACtB,QAAQ,KACP,sEAAsE,MACtE,EAAY,MAAM,EAAG,GAAG,CACzB,EAED,OAAO,GAUF,SAAS,CAAmB,CAClC,EACA,EACA,EACiB,CACjB,IAAM,EAAW,EAAK,SAEtB,GAA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AAM,QAAS,EAAsC,MAAM,EAI7D,SAAS,CAAiB,CAAC,EAAyC,CACnE,OAAO,GAAQ,EAGhB,SAAS,CAAwB,CAAC,EAA+C,CAChF,GAAI,IAAe,QAAa,IAAe,MAAQ,IAAe,IAAS,IAAe,GAC7F,OAGD,GAAI,OAAO,KAAS,KAAe,aAAsB,KAAM,CAC9D,GAAI,EAAW,WAAa,KAAK,UAChC,OAAO,EAAW,aAAe,GAGlC,OAAQ,EAAuB,WAAa,EAAW,aAAe,OAGvE,GAAI,EAAgB,CAAU,EAC7B,OAAO,EAAyB,EAAW,KAAK,EAGjD,GAAI,OAAO,IAAe,UAAY,OAAO,IAAe,UAAY,OAAO,IAAe,SAC7F,OAAO,OAAO,CAAU,EAGzB,GAAI,OAAO,IAAe,UAAY,IAAe,MAAQ,cAAe,EAC3E,OAAO,OAAO,EAAW,YAAc,SAAW,EAAW,UAAa,EAAW,aAAe,OAGrG,GAAI,EAAqB,CAAU,EAClC,OAAO,MAAM,KAAK,EAAY,CAAC,IAAU,EAAyB,CAAsB,GAAK,EAAE,EAAE,KAAK,EAAE,EAGzG,OAGD,SAAS,CAAgB,CACxB,EACA,EACA,EACgB,CAChB,IAAM,EAAkB,EAAiB,IAAI,EAAkB,EAAM,IAAI,CAAC,EAE1E,GAAI,GAAmB,EAAgB,OAAS,EAC/C,OAAO,EAAgB,SAAW,EAAI,EAAgB,GAAM,EAG7D,GAAI,EAAM,WAAa,OACtB,MAAO,GAGR,OAAO,EAAa,EAAM,QAAQ",
|
|
10
|
+
"debugId": "210A9ECD4BDC80BB64756E2164756E21",
|
|
8
11
|
"names": []
|
|
9
12
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var J=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(q,w)=>(typeof require<"u"?require:q)[w]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});var F=Symbol(),H=Symbol();function Q(j,q){let D=j[F];if(Array.isArray(D)){D.push(q);return}Object.defineProperty(j,F,{value:[q],configurable:!0})}function V(j){let q=j,w=q[F];if(!Array.isArray(w))return;q[H]=!0;try{for(let D of w)D()}finally{delete q[H]}}export{V as runSsrPreparationCallbacks,Q as registerSsrPreparationCallback,H as SSR_PREPARATION_RUNNING};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=0A5372564ED5E22C64756E2164756E21
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/core/ssr-preparation.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"type SsrPreparationCallback = () => void;\n\nconst SSR_PREPARATION_CALLBACKS = Symbol();\nexport const SSR_PREPARATION_RUNNING = Symbol();\n\n/**\n * Registers instance-local SSR preparation work that should run immediately\n * before a Radiant host serializes its first server render.\n *\n * Decorators use this to defer SSR-only setup until after class fields,\n * reactive props, and authored host content have all been applied.\n */\nexport function registerSsrPreparationCallback(host: object, callback: SsrPreparationCallback): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst existingCallbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (Array.isArray(existingCallbacks)) {\n\t\texistingCallbacks.push(callback);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(host, SSR_PREPARATION_CALLBACKS, {\n\t\tvalue: [callback],\n\t\tconfigurable: true,\n\t});\n}\n\n/**\n * Runs all registered SSR preparation callbacks for the provided host.\n *\n * The callbacks are intentionally retained so repeated SSR serializations stay\n * deterministic after later host mutations.\n */\nexport function runSsrPreparationCallbacks(host: object): void {\n\tconst target = host as Record<PropertyKey, unknown>;\n\tconst callbacks = target[SSR_PREPARATION_CALLBACKS];\n\n\tif (!Array.isArray(callbacks)) {\n\t\treturn;\n\t}\n\n\ttarget[SSR_PREPARATION_RUNNING] = true;\n\n\ttry {\n\t\tfor (const callback of callbacks as SsrPreparationCallback[]) {\n\t\t\tcallback();\n\t\t}\n\t} finally {\n\t\tdelete target[SSR_PREPARATION_RUNNING];\n\t}\n}\n"
|
|
5
6
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
7
|
+
"mappings": "2PAEA,IAAM,EAA4B,OAAO,EAC5B,EAA0B,OAAO,EASvC,SAAS,CAA8B,CAAC,EAAc,EAAwC,CAEpG,IAAM,EADS,EACkB,GAEjC,GAAI,MAAM,QAAQ,CAAiB,EAAG,CACrC,EAAkB,KAAK,CAAQ,EAC/B,OAGD,OAAO,eAAe,EAAM,EAA2B,CACtD,MAAO,CAAC,CAAQ,EAChB,aAAc,EACf,CAAC,EASK,SAAS,CAA0B,CAAC,EAAoB,CAC9D,IAAM,EAAS,EACT,EAAY,EAAO,GAEzB,GAAI,CAAC,MAAM,QAAQ,CAAS,EAC3B,OAGD,EAAO,GAA2B,GAElC,GAAI,CACH,QAAW,KAAY,EACtB,EAAS,SAET,CACD,OAAO,EAAO",
|
|
8
|
+
"debugId": "0A5372564ED5E22C64756E2164756E21",
|
|
8
9
|
"names": []
|
|
9
10
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactiveAttributeHostLike } from './shared/reactive-attr';
|
|
2
|
+
export type { AttrConverter, AttrOptions } from './shared/reactive-attr';
|
|
3
|
+
export declare function attr<TValue = string | undefined>(options?: import('./shared/reactive-attr').AttrOptions<TValue>): {
|
|
4
|
+
<THost extends ReactiveAttributeHostLike>(protoOrTarget: undefined, nameOrContext: ClassFieldDecoratorContext<THost, TValue>): (this: THost, value: TValue) => TValue;
|
|
5
|
+
(protoOrTarget: ReactiveAttributeHostLike, nameOrContext: string): void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var W=((t)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var b=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function k(t,e){let n=t[b];if(Array.isArray(n)){n.push(e);return}Object.defineProperty(t,b,{value:[e],configurable:!0})}function Z(t){let e=[],r=Object.getPrototypeOf(t);while(r&&r!==Object.prototype)e.push(r),r=Object.getPrototypeOf(r);for(let n=e.length-1;n>=0;n-=1){let o=e[n][b];if(!Array.isArray(o))continue;for(let i of o)i(t)}}function m(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function B(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(t))return"array";if(Object.prototype.toString.call(t)==="[object Object]")return"object"}function T(t){switch(t){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function V(t){try{return JSON.parse(t)}catch{throw TypeError("Invalid JSON string")}}var j={array(t){let e=V(t);if(!Array.isArray(e))throw TypeError(`Expected an array but got a value of type "${typeof e}"`);return e},boolean(t){return!(t==="0"||String(t).toLowerCase()==="false")},number(t){return Number(t.replace(/_/g,""))},object(t){let e=JSON.parse(t);if(e===null||typeof e!=="object"||Array.isArray(e))throw TypeError(`expected value of type "object" but instead got value "${t}" of type "${B(e)}"`);return e},string(t){return t}},M={default:h,array:F,object:F};function F(t){return JSON.stringify(t)}function h(t){return`${t}`}function g(t,e){let r=m(e);if(!r)throw TypeError(`[radiant-element] Unknown type "${e}"`);return j[r](t)}function C(t,e){let r=m(e);if(!r)throw TypeError(`[radiant-element] Unknown type "${e}"`);return(M[r]??M.default??h)(t)}function w(t){return typeof t==="boolean"}function S(t){return typeof t==="number"}function $(t){return typeof t==="string"}function p(t){return Array.isArray(t)}function U(t){return typeof t==="object"&&!Array.isArray(t)&&t!==null}function L(t,e){switch(t){case Boolean:return w(e);case Number:return S(e);case String:return $(e);case Array:return p(e);case Object:return U(e);default:return!1}}var J=(t,e,r,n)=>{if(e===Boolean){let i=t.getAttribute(r);if(i===null)return n;return i===""?!0:g(i,e)}let o=t.getAttribute(r);return o!==null?g(o,e):n??T(e)};function q(t){return typeof t==="function"}function O(t,e,r,n){if(typeof n==="object")return t(void 0,n);return e(r,n)}function _(t,e,r,n,o){if(typeof n==="object"){if(!q(r))throw TypeError("Standard method decorators require a method target");return t(r,n)}if(!o)throw TypeError("Legacy method decorators require a property descriptor");return e(r,n,o)}function A(t){if(t instanceof Element)return t;if("host"in t)return t.host;return t.element}function K(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function E(t,e){if(e.converter?.fromAttribute){let r=e.converter.fromAttribute(t);if(t===null&&r===void 0&&"defaultValue"in e)return e.defaultValue;return r}if(e.type){if(t===null)return e.defaultValue??T(e.type);if(e.type===Boolean&&t==="")return!0;return g(t,e.type)}if(t===null)return e.defaultValue;return t}function s(t,e,r){return E(A(t).getAttribute(e),r)}function Q(t,e,r,n){let o=n.converter?.toAttribute?n.converter.toAttribute(r):n.type?C(r,n.type):r==null?null:String(r);if(o===null){t.removeAttribute(e);return}t.setAttribute(e,o)}function f(t,e,r={}){if(r.type&&r.defaultValue!==void 0&&!L(r.type,r.defaultValue))throw Error(`defaultValue does not match the expected type for ${r.type.name}`);let n=t,o=r.source??K(e),i=Symbol(`@ecopages/radiant/attr:${e}:observer`),d=Symbol(`@ecopages/radiant/attr:${e}:last-value`),y=r.bind??t.shouldAutoBindReactiveMembers?.()??!1;t.defineReactiveBinding(e,y),t.registerReactiveDependencyReader(e,()=>s(t,o,r)),n[d]=s(t,o,r),Object.defineProperty(t,e,{get(){return t.trackReactiveRead(e),s(this,o,r)},set(c){let u=A(this),l=s(this,o,r);Q(u,o,c,r);let a=s(this,o,r);if(Object.is(l,a))return;this[d]=a,t.notifyUpdate(e,l,a)},enumerable:!0,configurable:!0});let H=()=>{n[i]?.disconnect()},x=()=>{let c=s(t,o,r),u=n[d];if(!Object.is(u,c))n[d]=c,t.notifyUpdate(e,u,c);if(typeof MutationObserver>"u")return;let l=A(t);H();let a=new MutationObserver(()=>{let R=s(t,o,r),v=n[d];if(Object.is(v,R))return;n[d]=R,t.notifyUpdate(e,v,R)});a.observe(l,{attributeFilter:[o],attributes:!0}),n[i]=a};x(),t.registerConnectedCallback(x),t.registerCleanupCallback(H)}function D(t={}){return(e,r)=>{let n=Symbol(`@ecopages/radiant/attr:${r}:installed`);k(e,(o)=>{o.registerConnectedCallback(()=>{if(o[n])return;let i=o[r],d=t.defaultValue===void 0?i:t.defaultValue;f(o,r,{...t,defaultValue:d}),o[n]=!0})})}}function P(t={}){return function(e,r){let n=String(r.name),o=Symbol(`@ecopages/radiant/attr:${n}:initializer`);return r.addInitializer(function(){let i=this[o],d=t.defaultValue===void 0?i:t.defaultValue;f(this,n,{...t,defaultValue:d})}),function(i){return this[o]=i,i}}}function ct(t={}){function e(r,n){return O(P(t),D(t),r,n)}return e}export{ct as attr};
|
|
2
|
+
|
|
3
|
+
//# debugId=71F684D27DD20F0064756E2164756E21
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/decorators/legacy/instance-initializers.ts", "../src/utils/attribute-utils.ts", "../src/decorators/bridge.ts", "../src/decorators/shared/reactive-attr.ts", "../src/decorators/legacy/attr.ts", "../src/decorators/standard/attr.ts", "../src/decorators/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 { Method } from '../types';\n\ntype StandardFieldFn<Host extends object, Value, Result> = (\n\ttarget: undefined,\n\tcontext: ClassFieldDecoratorContext<Host, Value>,\n) => Result;\n\ntype LegacyFieldFn<Proto, Result> = (proto: Proto, name: string) => Result;\n\ntype StandardMethodFn<Host extends object, TMethod extends Method, Result> = (\n\ttarget: TMethod,\n\tcontext: ClassMethodDecoratorContext<Host, TMethod>,\n) => Result;\n\ntype LegacyMethodFn<Proto, Result> = (proto: Proto, name: string, descriptor: PropertyDescriptor) => Result;\n\nfunction isMethod(value: unknown): value is Method {\n\treturn typeof value === 'function';\n}\n\nexport function fieldDecoratorBridge<Host extends object, Value, Result, Proto>(\n\tstandard: StandardFieldFn<Host, Value, Result>,\n\tlegacy: LegacyFieldFn<Proto, void>,\n\tprotoOrTarget: undefined,\n\tnameOrContext: ClassFieldDecoratorContext<Host, Value>,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, Proto, Result>(\n\tstandard: StandardFieldFn<Host, Value, void>,\n\tlegacy: LegacyFieldFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n): Result;\nexport function fieldDecoratorBridge<Host extends object, Value, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardFieldFn<Host, Value, StandardResult>,\n\tlegacy: LegacyFieldFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | undefined,\n\tnameOrContext: string | ClassFieldDecoratorContext<Host, Value>,\n): StandardResult | LegacyResult;\n\nexport function fieldDecoratorBridge(\n\tstandard: StandardFieldFn<object, unknown, unknown>,\n\tlegacy: LegacyFieldFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassFieldDecoratorContext<object, unknown>,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\treturn standard(undefined, nameOrContext);\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext);\n}\n\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Result, Proto>(\n\tstandard: StandardMethodFn<Host, TMethod, Result>,\n\tlegacy: LegacyMethodFn<Proto, void>,\n\tprotoOrTarget: TMethod,\n\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: undefined,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, Proto, Result>(\n\tstandard: StandardMethodFn<Host, TMethod, void>,\n\tlegacy: LegacyMethodFn<Proto, Result>,\n\tprotoOrTarget: Proto,\n\tnameOrContext: string,\n\tdescriptor: PropertyDescriptor,\n): Result;\nexport function methodDecoratorBridge<Host extends object, TMethod extends Method, StandardResult, Proto, LegacyResult>(\n\tstandard: StandardMethodFn<Host, TMethod, StandardResult>,\n\tlegacy: LegacyMethodFn<Proto, LegacyResult>,\n\tprotoOrTarget: Proto | TMethod,\n\tnameOrContext: string | ClassMethodDecoratorContext<Host, TMethod>,\n\tdescriptor?: PropertyDescriptor,\n): StandardResult | LegacyResult;\n\nexport function methodDecoratorBridge(\n\tstandard: StandardMethodFn<object, Method, unknown>,\n\tlegacy: LegacyMethodFn<unknown, unknown>,\n\tprotoOrTarget: unknown,\n\tnameOrContext: string | ClassMethodDecoratorContext<object, Method>,\n\tdescriptor?: PropertyDescriptor,\n): unknown {\n\tif (typeof nameOrContext === 'object') {\n\t\tif (!isMethod(protoOrTarget)) {\n\t\t\tthrow new TypeError('Standard method decorators require a method target');\n\t\t}\n\n\t\treturn standard(protoOrTarget, nameOrContext);\n\t}\n\n\tif (!descriptor) {\n\t\tthrow new TypeError('Legacy method decorators require a property descriptor');\n\t}\n\n\treturn legacy(protoOrTarget, nameOrContext, descriptor);\n}\n",
|
|
8
|
+
"import type { 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",
|
|
9
|
+
"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",
|
|
10
|
+
"import { installReactiveAttribute, type AttrOptions, type ReactiveAttributeHostLike } from '../shared/reactive-attr';\n\nexport function reactiveAttr<TValue = string | undefined>(options: AttrOptions<TValue> = {}) {\n\treturn function <THost extends ReactiveAttributeHostLike>(\n\t\ttarget: undefined,\n\t\tcontext: ClassFieldDecoratorContext<THost, TValue>,\n\t) {\n\t\tvoid target;\n\t\tconst propertyName = String(context.name);\n\t\tconst initializerValueKey = Symbol(`@ecopages/radiant/attr:${propertyName}:initializer`);\n\n\t\tcontext.addInitializer(function (this: THost) {\n\t\t\tconst initializerValue = (this as Record<PropertyKey, TValue | undefined>)[initializerValueKey];\n\t\t\tconst defaultValue = (options.defaultValue === undefined ? initializerValue : options.defaultValue) as\n\t\t\t\t| TValue\n\t\t\t\t| undefined;\n\n\t\t\tinstallReactiveAttribute(this, propertyName, {\n\t\t\t\t...options,\n\t\t\t\tdefaultValue,\n\t\t\t});\n\t\t});\n\n\t\treturn function (this: THost, value: TValue) {\n\t\t\t(this as Record<PropertyKey, TValue | undefined>)[initializerValueKey] = value;\n\t\t\treturn value;\n\t\t};\n\t};\n}\n",
|
|
11
|
+
"import { fieldDecoratorBridge } from './bridge';\nimport { reactiveAttr as legacyReactiveAttr } from './legacy/attr';\nimport { reactiveAttr as standardReactiveAttr } from './standard/attr';\nimport type { ReactiveAttributeHostLike } from './shared/reactive-attr';\nexport type { AttrConverter, AttrOptions } from './shared/reactive-attr';\n\nexport function attr<TValue = string | undefined>(options: import('./shared/reactive-attr').AttrOptions<TValue> = {}) {\n\tfunction decorator<THost extends ReactiveAttributeHostLike>(\n\t\tprotoOrTarget: undefined,\n\t\tnameOrContext: ClassFieldDecoratorContext<THost, TValue>,\n\t): (this: THost, value: TValue) => TValue;\n\tfunction decorator(protoOrTarget: ReactiveAttributeHostLike, nameOrContext: string): void;\n\tfunction decorator(\n\t\tprotoOrTarget: ReactiveAttributeHostLike | undefined,\n\t\tnameOrContext: string | ClassFieldDecoratorContext<ReactiveAttributeHostLike, TValue>,\n\t): ((this: ReactiveAttributeHostLike, value: TValue) => TValue) | void {\n\t\treturn fieldDecoratorBridge(\n\t\t\tstandardReactiveAttr(options),\n\t\t\tlegacyReactiveAttr(options),\n\t\t\tprotoOrTarget,\n\t\t\tnameOrContext,\n\t\t);\n\t}\n\n\treturn decorator;\n}\n"
|
|
12
|
+
],
|
|
13
|
+
"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,GCzChB,SAAS,CAA0B,CAAC,EAAkC,CAC5E,OAAQ,QACF,MACJ,MAAO,aACH,QACJ,MAAO,eAC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EAEM,QAAS,CAAc,EAAe,CAE5C,OADC,KAAiD,GAAuB,EAClE,ICnBH,SAAS,EAAiC,CAAC,EAAgE,CAAC,EAAG,CAMrH,SAAS,CAAS,CACjB,EACA,EACsE,CACtE,OAAO,EACN,EAAqB,CAAO,EAC5B,EAAmB,CAAO,EAC1B,EACA,CACD,EAGD,OAAO",
|
|
14
|
+
"debugId": "71F684D27DD20F0064756E2164756E21",
|
|
15
|
+
"names": []
|
|
16
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Method } from '../types';
|
|
2
|
+
import type { RadiantElement } from '../core/radiant-element';
|
|
2
3
|
/**
|
|
3
4
|
* A decorator to bind a method to the instance.
|
|
4
5
|
*/
|
|
5
|
-
export declare function bound(protoOrTarget:
|
|
6
|
+
export declare function bound<Host extends object, TMethod extends Method>(protoOrTarget: TMethod, nameOrContext: ClassMethodDecoratorContext<Host, TMethod>): void;
|
|
7
|
+
export declare function bound(protoOrTarget: RadiantElement, nameOrContext: string, descriptor: TypedPropertyDescriptor<Method>): TypedPropertyDescriptor<Method> | void;
|
package/dist/decorators/bound.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var l=((t)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});function u(t){return typeof t==="function"}function c(t,o,e,n){if(typeof n==="object")return t(void 0,n);return o(e,n)}function d(t,o,e,n,r){if(typeof n==="object"){if(!u(e))throw TypeError("Standard method decorators require a method target");return t(e,n)}if(!r)throw TypeError("Legacy method decorators require a property descriptor");return o(e,n,r)}function s(t,o,e){let n=e.value;return{configurable:!0,get(){if(this===t.prototype||Object.prototype.hasOwnProperty.call(this,o))return n;let r=n.bind(this);return Object.defineProperty(this,o,{value:r,configurable:!0,writable:!0}),r}}}function a(t,o){let e=String(o.name);if(o.private)throw Error(`'bound' cannot decorate private properties like ${e}.`);o.addInitializer(function(){this[e]=this[e].bind(this)})}function R(t,o,e){return d(a,s,t,o,e)}export{R as bound};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=233CFF85BFD8009D64756E2164756E21
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/decorators/bridge.ts", "../src/decorators/legacy/bound.ts", "../src/decorators/standard/bound.ts", "../src/decorators/bound.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 { 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",
|
|
7
|
+
"import type { Method } from '../../types';\n\nexport function bound<T extends Method>(_: T, context: ClassMethodDecoratorContext) {\n\tconst methodName = String(context.name);\n\tif (context.private) {\n\t\tthrow new Error(`'bound' cannot decorate private properties like ${methodName as string}.`);\n\t}\n\tcontext.addInitializer(function (this: any) {\n\t\tthis[methodName] = this[methodName].bind(this);\n\t});\n}\n",
|
|
8
|
+
"import type { Method } from '../types';\nimport type { RadiantElement } from '../core/radiant-element';\nimport { bound as legacyBound } from './legacy/bound';\nimport { bound as standardBound } from './standard/bound';\nimport { methodDecoratorBridge } from './bridge';\n\n/**\n * A decorator to bind a method to the instance.\n */\nexport function bound<Host extends object, TMethod extends Method>(\n\tprotoOrTarget: TMethod,\n\tnameOrContext: ClassMethodDecoratorContext<Host, TMethod>,\n): void;\nexport function bound(\n\tprotoOrTarget: RadiantElement,\n\tnameOrContext: string,\n\tdescriptor: TypedPropertyDescriptor<Method>,\n): TypedPropertyDescriptor<Method> | void;\nexport function bound(\n\tprotoOrTarget: RadiantElement | Method,\n\tnameOrContext: string | ClassMethodDecoratorContext<RadiantElement, Method>,\n\tdescriptor?: TypedPropertyDescriptor<Method>,\n): TypedPropertyDescriptor<Method> | void {\n\treturn methodDecoratorBridge(standardBound, legacyBound, protoOrTarget, nameOrContext, descriptor);\n}\n"
|
|
5
9
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
10
|
+
"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,ECpFhD,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,ECzBM,SAAS,CAAuB,CAAC,EAAM,EAAsC,CACnF,IAAM,EAAa,OAAO,EAAQ,IAAI,EACtC,GAAI,EAAQ,QACX,MAAU,MAAM,mDAAmD,IAAuB,EAE3F,EAAQ,eAAe,QAAS,EAAY,CAC3C,KAAK,GAAc,KAAK,GAAY,KAAK,IAAI,EAC7C,ECSK,SAAS,CAAK,CACpB,EACA,EACA,EACyC,CACzC,OAAO,EAAsB,EAAe,EAAa,EAAe,EAAe,CAAU",
|
|
11
|
+
"debugId": "233CFF85BFD8009D64756E2164756E21",
|
|
8
12
|
"names": []
|
|
9
13
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type StandardFieldFn = (target: undefined, context: ClassFieldDecoratorContext<
|
|
3
|
-
type LegacyFieldFn = (proto:
|
|
4
|
-
type StandardMethodFn = (target:
|
|
5
|
-
type LegacyMethodFn = (proto:
|
|
6
|
-
export declare function fieldDecoratorBridge(standard: StandardFieldFn, legacy: LegacyFieldFn, protoOrTarget:
|
|
7
|
-
export declare function
|
|
1
|
+
import type { Method } from '../types';
|
|
2
|
+
type StandardFieldFn<Host extends object, Value, Result> = (target: undefined, context: ClassFieldDecoratorContext<Host, Value>) => Result;
|
|
3
|
+
type LegacyFieldFn<Proto, Result> = (proto: Proto, name: string) => Result;
|
|
4
|
+
type StandardMethodFn<Host extends object, TMethod extends Method, Result> = (target: TMethod, context: ClassMethodDecoratorContext<Host, TMethod>) => Result;
|
|
5
|
+
type LegacyMethodFn<Proto, Result> = (proto: Proto, name: string, descriptor: PropertyDescriptor) => Result;
|
|
6
|
+
export declare function fieldDecoratorBridge<Host extends object, Value, Result, Proto>(standard: StandardFieldFn<Host, Value, Result>, legacy: LegacyFieldFn<Proto, void>, protoOrTarget: undefined, nameOrContext: ClassFieldDecoratorContext<Host, Value>): Result;
|
|
7
|
+
export declare function fieldDecoratorBridge<Host extends object, Value, Proto, Result>(standard: StandardFieldFn<Host, Value, void>, legacy: LegacyFieldFn<Proto, Result>, protoOrTarget: Proto, nameOrContext: string): Result;
|
|
8
|
+
export declare function fieldDecoratorBridge<Host extends object, Value, StandardResult, Proto, LegacyResult>(standard: StandardFieldFn<Host, Value, StandardResult>, legacy: LegacyFieldFn<Proto, LegacyResult>, protoOrTarget: Proto | undefined, nameOrContext: string | ClassFieldDecoratorContext<Host, Value>): StandardResult | LegacyResult;
|
|
9
|
+
export declare function methodDecoratorBridge<Host extends object, TMethod extends Method, Result, Proto>(standard: StandardMethodFn<Host, TMethod, Result>, legacy: LegacyMethodFn<Proto, void>, protoOrTarget: TMethod, nameOrContext: ClassMethodDecoratorContext<Host, TMethod>, descriptor?: undefined): Result;
|
|
10
|
+
export declare function methodDecoratorBridge<Host extends object, TMethod extends Method, Proto, Result>(standard: StandardMethodFn<Host, TMethod, void>, legacy: LegacyMethodFn<Proto, Result>, protoOrTarget: Proto, nameOrContext: string, descriptor: PropertyDescriptor): Result;
|
|
11
|
+
export declare function methodDecoratorBridge<Host extends object, TMethod extends Method, StandardResult, Proto, LegacyResult>(standard: StandardMethodFn<Host, TMethod, StandardResult>, legacy: LegacyMethodFn<Proto, LegacyResult>, protoOrTarget: Proto | TMethod, nameOrContext: string | ClassMethodDecoratorContext<Host, TMethod>, descriptor?: PropertyDescriptor): StandardResult | LegacyResult;
|
|
8
12
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var a=((t)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,e)=>(typeof require<"u"?require:r)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});function d(t){return typeof t==="function"}function u(t,r,e,o){if(typeof o==="object")return t(void 0,o);return r(e,o)}function c(t,r,e,o,n){if(typeof o==="object"){if(!d(e))throw TypeError("Standard method decorators require a method target");return t(e,o)}if(!n)throw TypeError("Legacy method decorators require a property descriptor");return r(e,o,n)}export{c as methodDecoratorBridge,u as fieldDecoratorBridge};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=29F9F6D71FA37B4064756E2164756E21
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
3
|
+
"sources": ["../src/decorators/bridge.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"
|
|
5
6
|
],
|
|
6
|
-
"mappings": "",
|
|
7
|
-
"debugId": "
|
|
7
|
+
"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",
|
|
8
|
+
"debugId": "29F9F6D71FA37B4064756E2164756E21",
|
|
8
9
|
"names": []
|
|
9
10
|
}
|
|
@@ -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,CAAuB,CAAC,EAAsD,CAC7F,OAAQ,EAA6C,GCR/C,IAAM,EAAuB,kBAc9B,EAAgC,OAAO,IAAI,6CAA6C,EAE9F,SAAS,CAAgC,EAAkC,CAC1E,IAAM,EAAc,WACd,EAAgB,EAAY,GAElC,GAAI,EACH,OAAO,EAGR,IAAM,EAA2C,CAChD,eAAgB,IAAI,IACpB,+BAAgC,eAChC,mBAAoB,IAAI,GACzB,EAIA,OAFA,EAAY,GAAiC,EAEtC,EAGR,IAAM,EAA0B,EAAiC,EAC3D,EAAqB,EAAwB,mBAC7C,EAAiB,EAAwB,eAE/C,SAAS,CAA0B,CAAC,EAA4B,CAC/D,IAAM,EAAQ,EAAQ,aAAa,CAAoB,EAEvD,GAAI,CAAC,EACJ,MAAO,CAAC,EAGT,OAAO,EACL,MAAM,KAAK,EACX,IAAI,CAAC,IAAe,EAAW,KAAK,CAAC,EACrC,OAAO,CAAC,IAAe,EAAW,OAAS,CAAC,EAG/C,SAAS,CAAuB,CAAC,EAAkB,EAAyC,CAC3F,GAAI,aAAgB,SAAW,EAAK,aAAa,CAAoB,EACpE,EAAM,CAAI,EAGX,QAAW,KAAW,MAAM,KAAK,EAAK,iBAAiB,IAAI,IAAuB,CAAC,EAClF,EAAM,CAAO,EAIR,MAAM,CAA0B,CAKT,KAJZ,qBAAuB,IAAI,IACpC,SACA,QAAU,GAElB,WAAW,CAAkB,EAAmB,SAAU,CAA7B,YAC5B,KAAK,MAAM,EAGL,IAAI,EAAS,CACnB,GAAI,K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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,EA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SAAS,CAAQ,CAAC,EAAyB,CACjD,MAAO,CAAmB,IAA8B,CACvD,IAAM,EAAsB,IAAI,QAEhC,OAAO,QAAS,IAAkB,EAA2B,CAC5D,IAAI,EAAY,EAAoB,IAAI,IAAI,EAE5C,GAAI,CAAC,EACJ,EAAY,EAAiB,IAAI,IAA6B,CAC7D,OAAO,EAAe,MAAM,KAAM,CAAS,GACzC,CAAO,EACV,EAAoB,IAAI,KAAM,CAAS,EAGxC,EAAU,GAAG,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,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,GCrCvB,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,M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