@easemate/web-kit 0.2.0 → 0.3.0
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/build/decorators.cjs +921 -0
- package/build/decorators.cjs.map +1 -0
- package/build/decorators.d.cts +123 -0
- package/build/decorators.d.ts +123 -0
- package/build/decorators.js +889 -0
- package/build/decorators.js.map +1 -0
- package/build/elements.cjs +27604 -0
- package/build/elements.cjs.map +1 -0
- package/build/elements.d.cts +373 -0
- package/build/elements.d.ts +373 -0
- package/build/elements.js +27528 -0
- package/build/elements.js.map +1 -0
- package/build/{elements/monitor/index.d.ts → index-31iOHBv0.d.cts} +26 -5
- package/build/{elements/monitor/index.d.cts → index-31iOHBv0.d.ts} +26 -5
- package/build/{elements/panel/index.d.cts → index-NzGpn7ai.d.cts} +6 -3
- package/build/{elements/panel/index.d.ts → index-NzGpn7ai.d.ts} +6 -3
- package/build/{elements/state/index.d.ts → index-qZoNKsHn.d.cts} +46 -5
- package/build/{elements/state/index.d.cts → index-qZoNKsHn.d.ts} +46 -5
- package/build/index.cjs +38651 -38
- package/build/index.cjs.map +1 -0
- package/build/index.d.cts +85 -6
- package/build/index.d.ts +85 -6
- package/build/index.js +38535 -12
- package/build/index.js.map +1 -0
- package/build/init-B7gNNyTd.d.ts +235 -0
- package/build/init-DwVGVxkx.d.cts +235 -0
- package/build/jsx.cjs +31 -0
- package/build/jsx.cjs.map +1 -0
- package/build/jsx.d.cts +317 -0
- package/build/jsx.d.ts +317 -0
- package/build/jsx.js +6 -0
- package/build/jsx.js.map +1 -0
- package/build/outside-click-rZ3Di_WX.d.cts +16 -0
- package/build/outside-click-rZ3Di_WX.d.ts +16 -0
- package/build/react.cjs +37827 -0
- package/build/react.cjs.map +1 -0
- package/build/react.d.cts +356 -0
- package/build/react.d.ts +356 -0
- package/build/react.js +37802 -0
- package/build/react.js.map +1 -0
- package/build/register.cjs +35832 -36
- package/build/register.cjs.map +1 -0
- package/build/register.d.cts +4 -33
- package/build/register.d.ts +4 -33
- package/build/register.js +35831 -35
- package/build/register.js.map +1 -0
- package/build/register.server.cjs +19 -0
- package/build/register.server.cjs.map +1 -0
- package/build/register.server.d.cts +2 -0
- package/build/register.server.d.ts +2 -0
- package/build/register.server.js +1 -0
- package/build/register.server.js.map +1 -0
- package/build/registry-9GX9KTG1.d.cts +264 -0
- package/build/registry-9GX9KTG1.d.ts +264 -0
- package/build/template-helpers-CguLXtLD.d.cts +10 -0
- package/build/template-helpers-CguLXtLD.d.ts +10 -0
- package/build/theme.cjs +746 -0
- package/build/theme.cjs.map +1 -0
- package/build/{theme/index.d.cts → theme.d.cts} +41 -21
- package/build/{theme/index.d.ts → theme.d.ts} +41 -21
- package/build/theme.js +692 -0
- package/build/theme.js.map +1 -0
- package/build/utils.cjs +205 -0
- package/build/utils.cjs.map +1 -0
- package/build/utils.d.cts +26 -0
- package/build/utils.d.ts +26 -0
- package/build/utils.js +167 -0
- package/build/utils.js.map +1 -0
- package/package.json +47 -33
- package/build/components/code/index.cjs +0 -152
- package/build/components/code/index.d.cts +0 -11
- package/build/components/code/index.d.ts +0 -11
- package/build/components/code/index.js +0 -148
- package/build/components/code/utils/highlight-api.cjs +0 -18
- package/build/components/code/utils/highlight-api.d.cts +0 -7
- package/build/components/code/utils/highlight-api.d.ts +0 -7
- package/build/components/code/utils/highlight-api.js +0 -14
- package/build/components/code/utils/syntax-grammars.cjs +0 -62
- package/build/components/code/utils/syntax-grammars.d.cts +0 -7
- package/build/components/code/utils/syntax-grammars.d.ts +0 -7
- package/build/components/code/utils/syntax-grammars.js +0 -59
- package/build/components/code/utils/syntax-highlighter-theme.cjs +0 -27
- package/build/components/code/utils/syntax-highlighter-theme.d.cts +0 -3
- package/build/components/code/utils/syntax-highlighter-theme.d.ts +0 -3
- package/build/components/code/utils/syntax-highlighter-theme.js +0 -23
- package/build/components/code/utils/syntax-highlighter-types.cjs +0 -2
- package/build/components/code/utils/syntax-highlighter-types.d.cts +0 -12
- package/build/components/code/utils/syntax-highlighter-types.d.ts +0 -12
- package/build/components/code/utils/syntax-highlighter-types.js +0 -1
- package/build/components/code/utils/syntax-tokenizer.cjs +0 -63
- package/build/components/code/utils/syntax-tokenizer.d.cts +0 -3
- package/build/components/code/utils/syntax-tokenizer.d.ts +0 -3
- package/build/components/code/utils/syntax-tokenizer.js +0 -58
- package/build/components/curve/bezier-conversion.cjs +0 -23
- package/build/components/curve/bezier-conversion.d.cts +0 -2
- package/build/components/curve/bezier-conversion.d.ts +0 -2
- package/build/components/curve/bezier-conversion.js +0 -19
- package/build/components/curve/canvas-controls.cjs +0 -300
- package/build/components/curve/canvas-controls.d.cts +0 -12
- package/build/components/curve/canvas-controls.d.ts +0 -12
- package/build/components/curve/canvas-controls.js +0 -296
- package/build/components/curve/canvas.cjs +0 -1208
- package/build/components/curve/canvas.d.cts +0 -24
- package/build/components/curve/canvas.d.ts +0 -24
- package/build/components/curve/canvas.js +0 -1204
- package/build/components/curve/constants.cjs +0 -203
- package/build/components/curve/constants.d.cts +0 -23
- package/build/components/curve/constants.d.ts +0 -23
- package/build/components/curve/constants.js +0 -200
- package/build/components/curve/controls.cjs +0 -942
- package/build/components/curve/controls.d.cts +0 -37
- package/build/components/curve/controls.d.ts +0 -37
- package/build/components/curve/controls.js +0 -938
- package/build/components/curve/index.cjs +0 -335
- package/build/components/curve/index.d.cts +0 -31
- package/build/components/curve/index.d.ts +0 -31
- package/build/components/curve/index.js +0 -330
- package/build/components/curve/output.cjs +0 -141
- package/build/components/curve/output.d.cts +0 -19
- package/build/components/curve/output.d.ts +0 -19
- package/build/components/curve/output.js +0 -137
- package/build/components/curve/styles.cjs +0 -493
- package/build/components/curve/styles.d.cts +0 -6
- package/build/components/curve/styles.d.ts +0 -6
- package/build/components/curve/styles.js +0 -490
- package/build/components/curve/svg-renderer.cjs +0 -185
- package/build/components/curve/svg-renderer.d.cts +0 -9
- package/build/components/curve/svg-renderer.d.ts +0 -9
- package/build/components/curve/svg-renderer.js +0 -175
- package/build/components/curve/toolbar.cjs +0 -368
- package/build/components/curve/toolbar.d.cts +0 -26
- package/build/components/curve/toolbar.d.ts +0 -26
- package/build/components/curve/toolbar.js +0 -364
- package/build/components/curve/types.cjs +0 -10
- package/build/components/curve/types.d.cts +0 -33
- package/build/components/curve/types.d.ts +0 -33
- package/build/components/curve/types.js +0 -7
- package/build/components/curve/utils.cjs +0 -541
- package/build/components/curve/utils.d.cts +0 -33
- package/build/components/curve/utils.d.ts +0 -33
- package/build/components/curve/utils.js +0 -521
- package/build/components/index.cjs +0 -18
- package/build/components/index.d.cts +0 -2
- package/build/components/index.d.ts +0 -2
- package/build/components/index.js +0 -2
- package/build/decorators/Component.cjs +0 -127
- package/build/decorators/Component.d.cts +0 -28
- package/build/decorators/Component.d.ts +0 -28
- package/build/decorators/Component.js +0 -123
- package/build/decorators/Listen.cjs +0 -154
- package/build/decorators/Listen.d.cts +0 -18
- package/build/decorators/Listen.d.ts +0 -18
- package/build/decorators/Listen.js +0 -151
- package/build/decorators/OutsideClick.cjs +0 -64
- package/build/decorators/OutsideClick.d.cts +0 -16
- package/build/decorators/OutsideClick.d.ts +0 -16
- package/build/decorators/OutsideClick.js +0 -59
- package/build/decorators/Prop.cjs +0 -273
- package/build/decorators/Prop.d.cts +0 -22
- package/build/decorators/Prop.d.ts +0 -22
- package/build/decorators/Prop.js +0 -270
- package/build/decorators/Query.cjs +0 -79
- package/build/decorators/Query.d.cts +0 -27
- package/build/decorators/Query.d.ts +0 -27
- package/build/decorators/Query.js +0 -76
- package/build/decorators/Watch.cjs +0 -52
- package/build/decorators/Watch.d.cts +0 -11
- package/build/decorators/Watch.d.ts +0 -11
- package/build/decorators/Watch.js +0 -49
- package/build/decorators/index.cjs +0 -15
- package/build/decorators/index.d.cts +0 -6
- package/build/decorators/index.d.ts +0 -6
- package/build/decorators/index.js +0 -6
- package/build/elements/button/index.cjs +0 -214
- package/build/elements/button/index.d.cts +0 -11
- package/build/elements/button/index.d.ts +0 -11
- package/build/elements/button/index.js +0 -210
- package/build/elements/checkbox/index.cjs +0 -316
- package/build/elements/checkbox/index.d.cts +0 -14
- package/build/elements/checkbox/index.d.ts +0 -14
- package/build/elements/checkbox/index.js +0 -312
- package/build/elements/color/index.cjs +0 -154
- package/build/elements/color/index.d.cts +0 -18
- package/build/elements/color/index.d.ts +0 -18
- package/build/elements/color/index.js +0 -150
- package/build/elements/color/picker.cjs +0 -544
- package/build/elements/color/picker.d.cts +0 -37
- package/build/elements/color/picker.d.ts +0 -37
- package/build/elements/color/picker.js +0 -540
- package/build/elements/color/utils.cjs +0 -235
- package/build/elements/color/utils.d.cts +0 -37
- package/build/elements/color/utils.d.ts +0 -37
- package/build/elements/color/utils.js +0 -218
- package/build/elements/dropdown/index.cjs +0 -875
- package/build/elements/dropdown/index.d.cts +0 -30
- package/build/elements/dropdown/index.d.ts +0 -30
- package/build/elements/dropdown/index.js +0 -871
- package/build/elements/field/index.cjs +0 -82
- package/build/elements/field/index.d.cts +0 -4
- package/build/elements/field/index.d.ts +0 -4
- package/build/elements/field/index.js +0 -78
- package/build/elements/icons/animation/chevron.cjs +0 -57
- package/build/elements/icons/animation/chevron.d.cts +0 -10
- package/build/elements/icons/animation/chevron.d.ts +0 -10
- package/build/elements/icons/animation/chevron.js +0 -53
- package/build/elements/icons/animation/clear.cjs +0 -74
- package/build/elements/icons/animation/clear.d.cts +0 -3
- package/build/elements/icons/animation/clear.d.ts +0 -3
- package/build/elements/icons/animation/clear.js +0 -70
- package/build/elements/icons/animation/grid.cjs +0 -77
- package/build/elements/icons/animation/grid.d.cts +0 -8
- package/build/elements/icons/animation/grid.d.ts +0 -8
- package/build/elements/icons/animation/grid.js +0 -73
- package/build/elements/icons/animation/loading.cjs +0 -68
- package/build/elements/icons/animation/loading.d.cts +0 -3
- package/build/elements/icons/animation/loading.d.ts +0 -3
- package/build/elements/icons/animation/loading.js +0 -64
- package/build/elements/icons/animation/snap.cjs +0 -133
- package/build/elements/icons/animation/snap.d.cts +0 -8
- package/build/elements/icons/animation/snap.d.ts +0 -8
- package/build/elements/icons/animation/snap.js +0 -129
- package/build/elements/icons/index.cjs +0 -40
- package/build/elements/icons/index.d.cts +0 -24
- package/build/elements/icons/index.d.ts +0 -24
- package/build/elements/icons/index.js +0 -24
- package/build/elements/icons/interface/anchor-add.cjs +0 -35
- package/build/elements/icons/interface/anchor-add.d.cts +0 -3
- package/build/elements/icons/interface/anchor-add.d.ts +0 -3
- package/build/elements/icons/interface/anchor-add.js +0 -31
- package/build/elements/icons/interface/anchor-remove.cjs +0 -34
- package/build/elements/icons/interface/anchor-remove.d.cts +0 -3
- package/build/elements/icons/interface/anchor-remove.d.ts +0 -3
- package/build/elements/icons/interface/anchor-remove.js +0 -30
- package/build/elements/icons/interface/arrow-up.cjs +0 -30
- package/build/elements/icons/interface/arrow-up.d.cts +0 -3
- package/build/elements/icons/interface/arrow-up.d.ts +0 -3
- package/build/elements/icons/interface/arrow-up.js +0 -26
- package/build/elements/icons/interface/arrows-vertical.cjs +0 -30
- package/build/elements/icons/interface/arrows-vertical.d.cts +0 -3
- package/build/elements/icons/interface/arrows-vertical.d.ts +0 -3
- package/build/elements/icons/interface/arrows-vertical.js +0 -26
- package/build/elements/icons/interface/bezier-angle.cjs +0 -33
- package/build/elements/icons/interface/bezier-angle.d.cts +0 -3
- package/build/elements/icons/interface/bezier-angle.d.ts +0 -3
- package/build/elements/icons/interface/bezier-angle.js +0 -29
- package/build/elements/icons/interface/bezier-distribute.cjs +0 -34
- package/build/elements/icons/interface/bezier-distribute.d.cts +0 -3
- package/build/elements/icons/interface/bezier-distribute.d.ts +0 -3
- package/build/elements/icons/interface/bezier-distribute.js +0 -30
- package/build/elements/icons/interface/bezier-length.cjs +0 -31
- package/build/elements/icons/interface/bezier-length.d.cts +0 -3
- package/build/elements/icons/interface/bezier-length.d.ts +0 -3
- package/build/elements/icons/interface/bezier-length.js +0 -27
- package/build/elements/icons/interface/bezier-mirror.cjs +0 -31
- package/build/elements/icons/interface/bezier-mirror.d.cts +0 -3
- package/build/elements/icons/interface/bezier-mirror.d.ts +0 -3
- package/build/elements/icons/interface/bezier-mirror.js +0 -27
- package/build/elements/icons/interface/bezier.cjs +0 -26
- package/build/elements/icons/interface/bezier.d.cts +0 -3
- package/build/elements/icons/interface/bezier.d.ts +0 -3
- package/build/elements/icons/interface/bezier.js +0 -22
- package/build/elements/icons/interface/check.cjs +0 -30
- package/build/elements/icons/interface/check.d.cts +0 -3
- package/build/elements/icons/interface/check.d.ts +0 -3
- package/build/elements/icons/interface/check.js +0 -26
- package/build/elements/icons/interface/circle-arrow-left.cjs +0 -30
- package/build/elements/icons/interface/circle-arrow-left.d.cts +0 -3
- package/build/elements/icons/interface/circle-arrow-left.d.ts +0 -3
- package/build/elements/icons/interface/circle-arrow-left.js +0 -26
- package/build/elements/icons/interface/circle-arrow-right.cjs +0 -30
- package/build/elements/icons/interface/circle-arrow-right.d.cts +0 -3
- package/build/elements/icons/interface/circle-arrow-right.d.ts +0 -3
- package/build/elements/icons/interface/circle-arrow-right.js +0 -26
- package/build/elements/icons/interface/code.cjs +0 -30
- package/build/elements/icons/interface/code.d.cts +0 -3
- package/build/elements/icons/interface/code.d.ts +0 -3
- package/build/elements/icons/interface/code.js +0 -26
- package/build/elements/icons/interface/dots.cjs +0 -32
- package/build/elements/icons/interface/dots.d.cts +0 -3
- package/build/elements/icons/interface/dots.d.ts +0 -3
- package/build/elements/icons/interface/dots.js +0 -28
- package/build/elements/icons/interface/mention.cjs +0 -30
- package/build/elements/icons/interface/mention.d.cts +0 -3
- package/build/elements/icons/interface/mention.d.ts +0 -3
- package/build/elements/icons/interface/mention.js +0 -26
- package/build/elements/icons/interface/minus.cjs +0 -30
- package/build/elements/icons/interface/minus.d.cts +0 -3
- package/build/elements/icons/interface/minus.d.ts +0 -3
- package/build/elements/icons/interface/minus.js +0 -26
- package/build/elements/icons/interface/picker.cjs +0 -34
- package/build/elements/icons/interface/picker.d.cts +0 -3
- package/build/elements/icons/interface/picker.d.ts +0 -3
- package/build/elements/icons/interface/picker.js +0 -30
- package/build/elements/icons/interface/plus.cjs +0 -30
- package/build/elements/icons/interface/plus.d.cts +0 -3
- package/build/elements/icons/interface/plus.d.ts +0 -3
- package/build/elements/icons/interface/plus.js +0 -26
- package/build/elements/icons/interface/settings.cjs +0 -30
- package/build/elements/icons/interface/settings.d.cts +0 -3
- package/build/elements/icons/interface/settings.d.ts +0 -3
- package/build/elements/icons/interface/settings.js +0 -26
- package/build/elements/index.cjs +0 -65
- package/build/elements/index.d.cts +0 -23
- package/build/elements/index.d.ts +0 -23
- package/build/elements/index.js +0 -23
- package/build/elements/input/index.cjs +0 -273
- package/build/elements/input/index.d.cts +0 -17
- package/build/elements/input/index.d.ts +0 -17
- package/build/elements/input/index.js +0 -269
- package/build/elements/logo/index.cjs +0 -732
- package/build/elements/logo/index.d.cts +0 -17
- package/build/elements/logo/index.d.ts +0 -17
- package/build/elements/logo/index.js +0 -728
- package/build/elements/monitor/fps.cjs +0 -432
- package/build/elements/monitor/fps.d.cts +0 -21
- package/build/elements/monitor/fps.d.ts +0 -21
- package/build/elements/monitor/fps.js +0 -428
- package/build/elements/monitor/index.cjs +0 -670
- package/build/elements/monitor/index.js +0 -666
- package/build/elements/number/index.cjs +0 -173
- package/build/elements/number/index.d.cts +0 -19
- package/build/elements/number/index.d.ts +0 -19
- package/build/elements/number/index.js +0 -169
- package/build/elements/origin/index.cjs +0 -169
- package/build/elements/origin/index.d.cts +0 -12
- package/build/elements/origin/index.d.ts +0 -12
- package/build/elements/origin/index.js +0 -165
- package/build/elements/panel/index.cjs +0 -496
- package/build/elements/panel/index.js +0 -492
- package/build/elements/popover/index.cjs +0 -209
- package/build/elements/popover/index.d.cts +0 -19
- package/build/elements/popover/index.d.ts +0 -19
- package/build/elements/popover/index.js +0 -205
- package/build/elements/radio/index.cjs +0 -301
- package/build/elements/radio/index.d.cts +0 -13
- package/build/elements/radio/index.d.ts +0 -13
- package/build/elements/radio/index.js +0 -283
- package/build/elements/radio/input.cjs +0 -329
- package/build/elements/radio/input.d.cts +0 -15
- package/build/elements/radio/input.d.ts +0 -15
- package/build/elements/radio/input.js +0 -325
- package/build/elements/radio/option.cjs +0 -15
- package/build/elements/radio/option.d.cts +0 -3
- package/build/elements/radio/option.d.ts +0 -3
- package/build/elements/radio/option.js +0 -11
- package/build/elements/shared.cjs +0 -66
- package/build/elements/shared.d.cts +0 -40
- package/build/elements/shared.d.ts +0 -40
- package/build/elements/shared.js +0 -59
- package/build/elements/slider/index.cjs +0 -232
- package/build/elements/slider/index.d.cts +0 -20
- package/build/elements/slider/index.d.ts +0 -20
- package/build/elements/slider/index.js +0 -228
- package/build/elements/state/index.cjs +0 -274
- package/build/elements/state/index.js +0 -270
- package/build/elements/toggle/index.cjs +0 -151
- package/build/elements/toggle/index.d.cts +0 -9
- package/build/elements/toggle/index.d.ts +0 -9
- package/build/elements/toggle/index.js +0 -147
- package/build/elements/tooltip/index.cjs +0 -187
- package/build/elements/tooltip/index.d.cts +0 -17
- package/build/elements/tooltip/index.d.ts +0 -17
- package/build/elements/tooltip/index.js +0 -183
- package/build/init.cjs +0 -325
- package/build/init.d.cts +0 -157
- package/build/init.d.ts +0 -157
- package/build/init.js +0 -289
- package/build/internal/component-loaders.cjs +0 -208
- package/build/internal/component-loaders.d.cts +0 -52
- package/build/internal/component-loaders.d.ts +0 -52
- package/build/internal/component-loaders.js +0 -169
- package/build/internal/fonts.cjs +0 -128
- package/build/internal/fonts.d.cts +0 -32
- package/build/internal/fonts.d.ts +0 -32
- package/build/internal/fonts.js +0 -123
- package/build/internal/lazy-load.cjs +0 -89
- package/build/internal/lazy-load.d.cts +0 -32
- package/build/internal/lazy-load.d.ts +0 -32
- package/build/internal/lazy-load.js +0 -86
- package/build/internal/style-inject.cjs +0 -236
- package/build/internal/style-inject.d.cts +0 -44
- package/build/internal/style-inject.d.ts +0 -44
- package/build/internal/style-inject.js +0 -226
- package/build/react/events.cjs +0 -25
- package/build/react/events.d.cts +0 -39
- package/build/react/events.d.ts +0 -39
- package/build/react/events.js +0 -22
- package/build/react/index.cjs +0 -19
- package/build/react/index.d.cts +0 -13
- package/build/react/index.d.ts +0 -13
- package/build/react/index.js +0 -12
- package/build/react/provider.cjs +0 -134
- package/build/react/provider.d.cts +0 -81
- package/build/react/provider.d.ts +0 -81
- package/build/react/provider.js +0 -98
- package/build/react/types.cjs +0 -8
- package/build/react/types.d.cts +0 -55
- package/build/react/types.d.ts +0 -55
- package/build/react/types.js +0 -7
- package/build/react/use-ease-state.cjs +0 -129
- package/build/react/use-ease-state.d.cts +0 -95
- package/build/react/use-ease-state.d.ts +0 -95
- package/build/react/use-ease-state.js +0 -126
- package/build/react/use-web-kit.cjs +0 -150
- package/build/react/use-web-kit.d.cts +0 -80
- package/build/react/use-web-kit.d.ts +0 -80
- package/build/react/use-web-kit.js +0 -114
- package/build/theme/index.cjs +0 -452
- package/build/theme/index.js +0 -423
- package/build/theme/presets.cjs +0 -54
- package/build/theme/presets.d.cts +0 -19
- package/build/theme/presets.d.ts +0 -19
- package/build/theme/presets.js +0 -51
- package/build/theme/registry.cjs +0 -204
- package/build/theme/registry.d.cts +0 -99
- package/build/theme/registry.d.ts +0 -99
- package/build/theme/registry.js +0 -194
- package/build/theme/tokens.cjs +0 -148
- package/build/theme/tokens.d.cts +0 -163
- package/build/theme/tokens.d.ts +0 -163
- package/build/theme/tokens.js +0 -145
- package/build/utils/dismiss-controller.cjs +0 -77
- package/build/utils/dismiss-controller.d.cts +0 -14
- package/build/utils/dismiss-controller.d.ts +0 -14
- package/build/utils/dismiss-controller.js +0 -73
- package/build/utils/index.cjs +0 -18
- package/build/utils/index.d.cts +0 -3
- package/build/utils/index.d.ts +0 -3
- package/build/utils/index.js +0 -3
- package/build/utils/outside-click.cjs +0 -82
- package/build/utils/outside-click.d.cts +0 -18
- package/build/utils/outside-click.d.ts +0 -18
- package/build/utils/outside-click.js +0 -74
- package/build/utils/template-helpers.cjs +0 -39
- package/build/utils/template-helpers.d.cts +0 -13
- package/build/utils/template-helpers.d.ts +0 -13
- package/build/utils/template-helpers.js +0 -28
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/decorators/index.ts
|
|
21
|
+
var decorators_exports = {};
|
|
22
|
+
__export(decorators_exports, {
|
|
23
|
+
Component: () => Component,
|
|
24
|
+
Listen: () => Listen,
|
|
25
|
+
OutsideClick: () => OutsideClick,
|
|
26
|
+
Prop: () => Prop,
|
|
27
|
+
Query: () => Query,
|
|
28
|
+
Watch: () => Watch
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(decorators_exports);
|
|
31
|
+
|
|
32
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/decorators/Component.ts
|
|
33
|
+
var import_lit_html = require("lit-html");
|
|
34
|
+
var styleCache = /* @__PURE__ */ new Map();
|
|
35
|
+
var normalizeTemplate = (template) => {
|
|
36
|
+
if (typeof template === "function") {
|
|
37
|
+
return template;
|
|
38
|
+
}
|
|
39
|
+
if (template && typeof template === "object" && "_$litTemplate$" in template) {
|
|
40
|
+
return function() {
|
|
41
|
+
return template;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return function() {
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var fetchStyles = async (urls) => Promise.all(urls.map((url) => {
|
|
49
|
+
const cached = styleCache.get(url);
|
|
50
|
+
if (cached) {
|
|
51
|
+
return cached;
|
|
52
|
+
}
|
|
53
|
+
const request = fetch(url).then((response) => response.ok ? response.text() : "").catch(() => "");
|
|
54
|
+
styleCache.set(url, request);
|
|
55
|
+
return request;
|
|
56
|
+
}));
|
|
57
|
+
var Component = (options) => (Base, _context) => {
|
|
58
|
+
const { tag, template, styles = "", styleUrls = [], observedAttributes = [], shadowMode = "open", autoSlot = true } = options;
|
|
59
|
+
if (!tag) {
|
|
60
|
+
throw new Error('@Component requires a "tag" option.');
|
|
61
|
+
}
|
|
62
|
+
const templateFn = normalizeTemplate(template);
|
|
63
|
+
class Decorated extends Base {
|
|
64
|
+
static get observedAttributes() {
|
|
65
|
+
const parent = "observedAttributes" in Base && Array.isArray(Base.observedAttributes) ? Base.observedAttributes : [];
|
|
66
|
+
const own = Array.isArray(observedAttributes) ? observedAttributes : [];
|
|
67
|
+
return Array.from(/* @__PURE__ */ new Set([
|
|
68
|
+
...parent,
|
|
69
|
+
...own
|
|
70
|
+
]));
|
|
71
|
+
}
|
|
72
|
+
#shadow;
|
|
73
|
+
#styles;
|
|
74
|
+
#styleUrls;
|
|
75
|
+
#renderScheduled;
|
|
76
|
+
constructor(...args) {
|
|
77
|
+
super(...args), this.#styles = styles, this.#styleUrls = [
|
|
78
|
+
...styleUrls
|
|
79
|
+
], this.#renderScheduled = false;
|
|
80
|
+
this.#shadow = this.attachShadow({
|
|
81
|
+
mode: shadowMode
|
|
82
|
+
});
|
|
83
|
+
this.renderRoot = this.#shadow;
|
|
84
|
+
}
|
|
85
|
+
get shadow() {
|
|
86
|
+
return this.renderRoot;
|
|
87
|
+
}
|
|
88
|
+
connectedCallback() {
|
|
89
|
+
Base.prototype.connectedCallback?.call(this);
|
|
90
|
+
void this.#loadStyles().finally(() => {
|
|
91
|
+
this.requestRender();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
Base.prototype.disconnectedCallback?.call(this);
|
|
96
|
+
this.#renderScheduled = false;
|
|
97
|
+
}
|
|
98
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
99
|
+
Base.prototype.attributeChangedCallback?.call(this, name, oldValue, newValue);
|
|
100
|
+
if (oldValue !== newValue) {
|
|
101
|
+
this.onAttributeChange?.(name, oldValue, newValue);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
requestRender() {
|
|
105
|
+
if (this.#renderScheduled) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.#renderScheduled = true;
|
|
109
|
+
requestAnimationFrame(() => {
|
|
110
|
+
this.#renderScheduled = false;
|
|
111
|
+
this.#render();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
async #loadStyles() {
|
|
115
|
+
if (!this.#styleUrls.length) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const fetched = await fetchStyles(this.#styleUrls);
|
|
119
|
+
const inlineStyles = this.#styles ? [
|
|
120
|
+
this.#styles
|
|
121
|
+
] : [];
|
|
122
|
+
this.#styles = [
|
|
123
|
+
...inlineStyles,
|
|
124
|
+
...fetched.filter(Boolean)
|
|
125
|
+
].join("\n");
|
|
126
|
+
}
|
|
127
|
+
#render() {
|
|
128
|
+
const root = this.#shadow;
|
|
129
|
+
let templateResult;
|
|
130
|
+
if (typeof this.render === "function") {
|
|
131
|
+
templateResult = this.render();
|
|
132
|
+
} else {
|
|
133
|
+
templateResult = templateFn.call(this, this);
|
|
134
|
+
}
|
|
135
|
+
const styleTemplate = this.#styles ? import_lit_html.html`<style>${this.#styles}</style>` : null;
|
|
136
|
+
const slotTemplate = autoSlot ? import_lit_html.html`<slot></slot>` : null;
|
|
137
|
+
const completeTemplate = import_lit_html.html`
|
|
138
|
+
${styleTemplate}
|
|
139
|
+
${templateResult ?? null}
|
|
140
|
+
${slotTemplate}
|
|
141
|
+
`;
|
|
142
|
+
const commit = () => {
|
|
143
|
+
(0, import_lit_html.render)(completeTemplate, root);
|
|
144
|
+
this.afterRender?.();
|
|
145
|
+
};
|
|
146
|
+
if (typeof this.wrapRender === "function") {
|
|
147
|
+
const fragment = document.createDocumentFragment();
|
|
148
|
+
const tempDiv = document.createElement("div");
|
|
149
|
+
(0, import_lit_html.render)(completeTemplate, tempDiv);
|
|
150
|
+
fragment.append(...tempDiv.childNodes);
|
|
151
|
+
this.wrapRender(commit, {
|
|
152
|
+
fragment,
|
|
153
|
+
root
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
commit();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (typeof customElements !== "undefined" && !customElements.get(tag)) {
|
|
161
|
+
customElements.define(tag, Decorated);
|
|
162
|
+
}
|
|
163
|
+
return Decorated;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/decorators/Listen.ts
|
|
167
|
+
var lifecycleHooks = {
|
|
168
|
+
connectedCallback: /* @__PURE__ */ new WeakMap(),
|
|
169
|
+
disconnectedCallback: /* @__PURE__ */ new WeakMap()
|
|
170
|
+
};
|
|
171
|
+
var cleanupRegistry = /* @__PURE__ */ new WeakMap();
|
|
172
|
+
var addLifecycleHook = (instance, hookName, handler) => {
|
|
173
|
+
const store = lifecycleHooks[hookName];
|
|
174
|
+
let callbacks = store.get(instance);
|
|
175
|
+
if (!callbacks) {
|
|
176
|
+
callbacks = /* @__PURE__ */ new Set();
|
|
177
|
+
store.set(instance, callbacks);
|
|
178
|
+
const original = instance[hookName];
|
|
179
|
+
instance[hookName] = function(...args) {
|
|
180
|
+
callbacks?.forEach((callback) => {
|
|
181
|
+
callback.apply(this);
|
|
182
|
+
});
|
|
183
|
+
if (typeof original === "function") {
|
|
184
|
+
return original.apply(this, args);
|
|
185
|
+
}
|
|
186
|
+
return void 0;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
callbacks.add(handler);
|
|
190
|
+
};
|
|
191
|
+
var registerCleanup = (instance, cleanup) => {
|
|
192
|
+
let callbacks = cleanupRegistry.get(instance);
|
|
193
|
+
if (!callbacks) {
|
|
194
|
+
callbacks = /* @__PURE__ */ new Set();
|
|
195
|
+
cleanupRegistry.set(instance, callbacks);
|
|
196
|
+
addLifecycleHook(instance, "disconnectedCallback", function() {
|
|
197
|
+
const registered = cleanupRegistry.get(this);
|
|
198
|
+
registered?.forEach((fn) => {
|
|
199
|
+
try {
|
|
200
|
+
fn();
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.error("[Listen] cleanup failed", error);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
cleanupRegistry.delete(this);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
callbacks.add(cleanup);
|
|
209
|
+
};
|
|
210
|
+
var resolveTarget = (host, target) => {
|
|
211
|
+
if (typeof target === "function") {
|
|
212
|
+
return target(host) ?? null;
|
|
213
|
+
}
|
|
214
|
+
if (target instanceof EventTarget) {
|
|
215
|
+
return target;
|
|
216
|
+
}
|
|
217
|
+
switch (target) {
|
|
218
|
+
case "document":
|
|
219
|
+
return document;
|
|
220
|
+
case "window":
|
|
221
|
+
return window;
|
|
222
|
+
case "light":
|
|
223
|
+
return host;
|
|
224
|
+
default:
|
|
225
|
+
return host.renderRoot ?? host.shadowRoot ?? host;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var normalizeOptions = (selectorOrOptions) => {
|
|
229
|
+
if (typeof selectorOrOptions === "string") {
|
|
230
|
+
return {
|
|
231
|
+
selector: selectorOrOptions
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return selectorOrOptions ?? {};
|
|
235
|
+
};
|
|
236
|
+
var buildOptions = (options) => {
|
|
237
|
+
return {
|
|
238
|
+
selector: options.selector ?? null,
|
|
239
|
+
target: options.target ?? "shadow",
|
|
240
|
+
prevent: options.prevent ?? false,
|
|
241
|
+
stop: options.stop ?? false,
|
|
242
|
+
stopImmediate: options.stopImmediate ?? false,
|
|
243
|
+
once: options.once ?? false,
|
|
244
|
+
passive: options.passive,
|
|
245
|
+
capture: options.capture ?? false,
|
|
246
|
+
when: options.when ?? null
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
function Listen(eventName, selectorOrOptions) {
|
|
250
|
+
if (!eventName) {
|
|
251
|
+
throw new Error("@Listen requires an event name.");
|
|
252
|
+
}
|
|
253
|
+
const listenConfig = buildOptions(normalizeOptions(selectorOrOptions));
|
|
254
|
+
return (originalMethod, context) => {
|
|
255
|
+
context.addInitializer(function() {
|
|
256
|
+
let attached = false;
|
|
257
|
+
const attach = () => {
|
|
258
|
+
if (attached) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const target = resolveTarget(this, listenConfig.target);
|
|
262
|
+
if (!target || typeof target.addEventListener !== "function") {
|
|
263
|
+
console.warn(`@Listen unable to resolve target for ${String(eventName)}`);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const eventOptions = {
|
|
267
|
+
capture: listenConfig.capture,
|
|
268
|
+
once: listenConfig.once,
|
|
269
|
+
passive: listenConfig.passive !== void 0 ? listenConfig.passive : !listenConfig.prevent
|
|
270
|
+
};
|
|
271
|
+
const handler = (event) => {
|
|
272
|
+
const typedEvent = event;
|
|
273
|
+
if (listenConfig.prevent) {
|
|
274
|
+
typedEvent.preventDefault();
|
|
275
|
+
}
|
|
276
|
+
if (listenConfig.stopImmediate) {
|
|
277
|
+
typedEvent.stopImmediatePropagation();
|
|
278
|
+
} else if (listenConfig.stop) {
|
|
279
|
+
typedEvent.stopPropagation();
|
|
280
|
+
}
|
|
281
|
+
let matched = null;
|
|
282
|
+
if (listenConfig.selector) {
|
|
283
|
+
const path = typedEvent.composedPath();
|
|
284
|
+
matched = path.find((node) => node instanceof Element && node.matches(listenConfig.selector)) ?? null;
|
|
285
|
+
if (!matched) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (listenConfig.when && !listenConfig.when(typedEvent, matched)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (listenConfig.selector) {
|
|
293
|
+
void originalMethod.call(this, typedEvent, matched);
|
|
294
|
+
} else {
|
|
295
|
+
const targetNode = typedEvent.target instanceof Element ? typedEvent.target : null;
|
|
296
|
+
void originalMethod.call(this, typedEvent, targetNode);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
target.addEventListener(eventName, handler, eventOptions);
|
|
300
|
+
attached = true;
|
|
301
|
+
registerCleanup(this, () => {
|
|
302
|
+
target.removeEventListener(eventName, handler, eventOptions);
|
|
303
|
+
attached = false;
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
queueMicrotask(attach);
|
|
307
|
+
addLifecycleHook(this, "connectedCallback", attach);
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/utils/dismiss-controller.ts
|
|
313
|
+
var DismissController = class {
|
|
314
|
+
#onDismiss;
|
|
315
|
+
#context;
|
|
316
|
+
#active;
|
|
317
|
+
constructor(options) {
|
|
318
|
+
this.#context = null;
|
|
319
|
+
this.#active = false;
|
|
320
|
+
this.#handlePointerDown = (event) => {
|
|
321
|
+
if (!this.#context) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const { owner, content, triggers } = this.#context;
|
|
325
|
+
const path = event.composedPath();
|
|
326
|
+
if (path.some((node) => node instanceof Element && node.hasAttribute("data-select-ignore"))) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (path.includes(owner)) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (content && path.includes(content)) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (triggers.some((trigger) => path.includes(trigger))) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
this.#onDismiss(event);
|
|
339
|
+
};
|
|
340
|
+
this.#handleKeyDown = (event) => {
|
|
341
|
+
if (event.key !== "Escape" || !this.#context) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
event.preventDefault();
|
|
345
|
+
const active = document.activeElement;
|
|
346
|
+
if (!active) {
|
|
347
|
+
this.#onDismiss(event);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const { owner, content, triggers } = this.#context;
|
|
351
|
+
const path = event.composedPath();
|
|
352
|
+
if (path.includes(owner) || owner.contains(active)) {
|
|
353
|
+
this.#onDismiss(event);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (content && (path.includes(content) || content.contains(active))) {
|
|
357
|
+
this.#onDismiss(event);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (triggers.some((trigger) => path.includes(trigger) || trigger.contains(active))) {
|
|
361
|
+
this.#onDismiss(event);
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
this.#onDismiss = options.onDismiss;
|
|
365
|
+
}
|
|
366
|
+
connect(context) {
|
|
367
|
+
this.#context = {
|
|
368
|
+
owner: context.owner,
|
|
369
|
+
content: context.content ?? null,
|
|
370
|
+
triggers: (context.triggers ?? []).filter((el) => el instanceof HTMLElement)
|
|
371
|
+
};
|
|
372
|
+
if (!this.#active) {
|
|
373
|
+
document.addEventListener("pointerdown", this.#handlePointerDown, true);
|
|
374
|
+
document.addEventListener("keydown", this.#handleKeyDown, true);
|
|
375
|
+
this.#active = true;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
disconnect() {
|
|
379
|
+
if (!this.#active) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
document.removeEventListener("pointerdown", this.#handlePointerDown, true);
|
|
383
|
+
document.removeEventListener("keydown", this.#handleKeyDown, true);
|
|
384
|
+
this.#active = false;
|
|
385
|
+
this.#context = null;
|
|
386
|
+
}
|
|
387
|
+
#handlePointerDown;
|
|
388
|
+
#handleKeyDown;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// src/utils/outside-click.ts
|
|
392
|
+
var registry = /* @__PURE__ */ new WeakMap();
|
|
393
|
+
var toDismissContext = (host, options) => {
|
|
394
|
+
if (options.disabled?.(host)) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
const resolved = options.resolve(host);
|
|
398
|
+
if (!resolved) {
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
const owner = resolved.owner ?? host ?? null;
|
|
402
|
+
if (!(owner instanceof HTMLElement)) {
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
const content = resolved.content && resolved.content instanceof HTMLElement ? resolved.content : null;
|
|
406
|
+
const triggers = resolved.triggers?.filter((element) => element instanceof HTMLElement) ?? [];
|
|
407
|
+
return {
|
|
408
|
+
owner,
|
|
409
|
+
content,
|
|
410
|
+
triggers
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
var createOutsideClickHandle = (host, onDismiss, options) => {
|
|
414
|
+
const controller = new DismissController({
|
|
415
|
+
onDismiss(event) {
|
|
416
|
+
if (options.disabled?.(host)) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
onDismiss.call(host, event);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
return {
|
|
423
|
+
update() {
|
|
424
|
+
const context = toDismissContext(host, options);
|
|
425
|
+
if (!context) {
|
|
426
|
+
controller.disconnect();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
controller.connect(context);
|
|
430
|
+
},
|
|
431
|
+
disconnect() {
|
|
432
|
+
controller.disconnect();
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
var registerOutsideClickHandle = (host, handle) => {
|
|
437
|
+
let handles = registry.get(host);
|
|
438
|
+
if (!handles) {
|
|
439
|
+
handles = /* @__PURE__ */ new Set();
|
|
440
|
+
registry.set(host, handles);
|
|
441
|
+
}
|
|
442
|
+
handles.add(handle);
|
|
443
|
+
};
|
|
444
|
+
var updateOutsideClickHandles = (host) => {
|
|
445
|
+
const handles = registry.get(host);
|
|
446
|
+
if (!handles) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
handles.forEach((handle) => {
|
|
450
|
+
handle.update();
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
var disconnectOutsideClickHandles = (host) => {
|
|
454
|
+
const handles = registry.get(host);
|
|
455
|
+
if (!handles) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
handles.forEach((handle) => {
|
|
459
|
+
handle.disconnect();
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/decorators/OutsideClick.ts
|
|
464
|
+
var lifecycleApplied = /* @__PURE__ */ new WeakSet();
|
|
465
|
+
var wrapMethod = (host, name, hook, callHookFirst = false) => {
|
|
466
|
+
const original = host[name];
|
|
467
|
+
host[name] = function(...args) {
|
|
468
|
+
if (callHookFirst) {
|
|
469
|
+
hook.call(this);
|
|
470
|
+
}
|
|
471
|
+
let result;
|
|
472
|
+
if (typeof original === "function") {
|
|
473
|
+
result = original.apply(this, args);
|
|
474
|
+
}
|
|
475
|
+
if (!callHookFirst) {
|
|
476
|
+
hook.call(this);
|
|
477
|
+
}
|
|
478
|
+
return result;
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
var ensureLifecycle = (host) => {
|
|
482
|
+
if (lifecycleApplied.has(host)) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
lifecycleApplied.add(host);
|
|
486
|
+
wrapMethod(host, "connectedCallback", function() {
|
|
487
|
+
updateOutsideClickHandles(this);
|
|
488
|
+
});
|
|
489
|
+
wrapMethod(host, "afterRender", function() {
|
|
490
|
+
updateOutsideClickHandles(this);
|
|
491
|
+
});
|
|
492
|
+
wrapMethod(host, "disconnectedCallback", function() {
|
|
493
|
+
disconnectOutsideClickHandles(this);
|
|
494
|
+
}, true);
|
|
495
|
+
};
|
|
496
|
+
function OutsideClick(options = {}) {
|
|
497
|
+
return (originalMethod, context) => {
|
|
498
|
+
context.addInitializer(function() {
|
|
499
|
+
ensureLifecycle(this);
|
|
500
|
+
const resolve = options.resolve ?? ((host) => {
|
|
501
|
+
return {
|
|
502
|
+
owner: options.owner?.(host),
|
|
503
|
+
content: options.content?.(host),
|
|
504
|
+
triggers: options.triggers?.(host)
|
|
505
|
+
};
|
|
506
|
+
});
|
|
507
|
+
const handle = createOutsideClickHandle(this, (event) => {
|
|
508
|
+
originalMethod.call(this, event);
|
|
509
|
+
}, {
|
|
510
|
+
resolve,
|
|
511
|
+
disabled: options.disabled
|
|
512
|
+
});
|
|
513
|
+
registerOutsideClickHandle(this, handle);
|
|
514
|
+
if (this.isConnected) {
|
|
515
|
+
updateOutsideClickHandles(this);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/decorators/Prop.ts
|
|
522
|
+
var renderQueue = /* @__PURE__ */ new WeakMap();
|
|
523
|
+
var cleanupRegistry2 = /* @__PURE__ */ new WeakMap();
|
|
524
|
+
var observerRegistry = /* @__PURE__ */ new WeakMap();
|
|
525
|
+
var internalMutations = /* @__PURE__ */ new WeakMap();
|
|
526
|
+
var scheduleRender = (instance) => {
|
|
527
|
+
if (typeof instance.requestRender === "function") {
|
|
528
|
+
instance.requestRender();
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (typeof instance.render !== "function") {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (renderQueue.get(instance)) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
renderQueue.set(instance, true);
|
|
538
|
+
requestAnimationFrame(() => {
|
|
539
|
+
renderQueue.delete(instance);
|
|
540
|
+
instance.render?.();
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
var toKebabCase = (value) => String(value).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
|
|
544
|
+
var registerCleanup2 = (instance, cleanup) => {
|
|
545
|
+
let callbacks = cleanupRegistry2.get(instance);
|
|
546
|
+
if (!callbacks) {
|
|
547
|
+
callbacks = /* @__PURE__ */ new Set();
|
|
548
|
+
cleanupRegistry2.set(instance, callbacks);
|
|
549
|
+
const original = instance.disconnectedCallback;
|
|
550
|
+
instance.disconnectedCallback = function(...args) {
|
|
551
|
+
const registered = cleanupRegistry2.get(this);
|
|
552
|
+
registered?.forEach((callback) => {
|
|
553
|
+
try {
|
|
554
|
+
callback();
|
|
555
|
+
} catch (error) {
|
|
556
|
+
console.error("[Prop] cleanup failed", error);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
cleanupRegistry2.delete(this);
|
|
560
|
+
if (typeof original === "function") {
|
|
561
|
+
return original.apply(this, args);
|
|
562
|
+
}
|
|
563
|
+
return void 0;
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
callbacks.add(cleanup);
|
|
567
|
+
};
|
|
568
|
+
var markInternalMutation = (host, attribute) => {
|
|
569
|
+
let attributes = internalMutations.get(host);
|
|
570
|
+
if (!attributes) {
|
|
571
|
+
attributes = /* @__PURE__ */ new Set();
|
|
572
|
+
internalMutations.set(host, attributes);
|
|
573
|
+
}
|
|
574
|
+
attributes.add(attribute);
|
|
575
|
+
};
|
|
576
|
+
var isInternalMutation = (host, attribute) => {
|
|
577
|
+
const attributes = internalMutations.get(host);
|
|
578
|
+
if (!attributes) {
|
|
579
|
+
return false;
|
|
580
|
+
}
|
|
581
|
+
const hasAttribute = attributes.has(attribute);
|
|
582
|
+
if (hasAttribute) {
|
|
583
|
+
attributes.delete(attribute);
|
|
584
|
+
if (attributes.size === 0) {
|
|
585
|
+
internalMutations.delete(host);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return hasAttribute;
|
|
589
|
+
};
|
|
590
|
+
var observeAttribute = (host, attribute, handler) => {
|
|
591
|
+
let entry = observerRegistry.get(host);
|
|
592
|
+
if (!entry) {
|
|
593
|
+
const callbacks = /* @__PURE__ */ new Map();
|
|
594
|
+
const observer = new MutationObserver((records) => {
|
|
595
|
+
records.forEach((record) => {
|
|
596
|
+
const attributeName = record.attributeName;
|
|
597
|
+
if (!attributeName) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (isInternalMutation(host, attributeName)) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const listeners2 = callbacks.get(attributeName);
|
|
604
|
+
if (!listeners2) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
const currentValue = record.target.getAttribute(attributeName);
|
|
608
|
+
for (const listener of listeners2) {
|
|
609
|
+
listener(currentValue);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
});
|
|
613
|
+
observer.observe(host, {
|
|
614
|
+
attributes: true
|
|
615
|
+
});
|
|
616
|
+
entry = {
|
|
617
|
+
observer,
|
|
618
|
+
callbacks
|
|
619
|
+
};
|
|
620
|
+
observerRegistry.set(host, entry);
|
|
621
|
+
registerCleanup2(host, () => {
|
|
622
|
+
observer.disconnect();
|
|
623
|
+
observerRegistry.delete(host);
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
let listeners = entry.callbacks.get(attribute);
|
|
627
|
+
if (!listeners) {
|
|
628
|
+
listeners = /* @__PURE__ */ new Set();
|
|
629
|
+
entry.callbacks.set(attribute, listeners);
|
|
630
|
+
}
|
|
631
|
+
listeners.add(handler);
|
|
632
|
+
};
|
|
633
|
+
var updateAttribute = (host, attribute, value) => {
|
|
634
|
+
markInternalMutation(host, attribute);
|
|
635
|
+
if (value === void 0 || value === null || value === false) {
|
|
636
|
+
host.removeAttribute(attribute);
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
if (value === true) {
|
|
640
|
+
host.setAttribute(attribute, "");
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
host.setAttribute(attribute, String(value));
|
|
644
|
+
};
|
|
645
|
+
var resolveType = (type) => {
|
|
646
|
+
if (!type) {
|
|
647
|
+
return null;
|
|
648
|
+
}
|
|
649
|
+
if (type === Boolean || type === "boolean") {
|
|
650
|
+
return "boolean";
|
|
651
|
+
}
|
|
652
|
+
if (type === Number || type === "number") {
|
|
653
|
+
return "number";
|
|
654
|
+
}
|
|
655
|
+
if (type === Object || type === Array || type === "json") {
|
|
656
|
+
return "json";
|
|
657
|
+
}
|
|
658
|
+
return "string";
|
|
659
|
+
};
|
|
660
|
+
var typeParsers = {
|
|
661
|
+
boolean(value) {
|
|
662
|
+
return value !== null;
|
|
663
|
+
},
|
|
664
|
+
number(value) {
|
|
665
|
+
if (value === null || value === "") {
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
const parsed = Number(value);
|
|
669
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
670
|
+
},
|
|
671
|
+
json(value) {
|
|
672
|
+
if (!value) {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
try {
|
|
676
|
+
return JSON.parse(value);
|
|
677
|
+
} catch (error) {
|
|
678
|
+
console.warn("[Prop] failed to parse JSON attribute", error);
|
|
679
|
+
return null;
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
string(value) {
|
|
683
|
+
return value;
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
var typeFormatters = {
|
|
687
|
+
boolean(value) {
|
|
688
|
+
return value ? "" : null;
|
|
689
|
+
},
|
|
690
|
+
number(value) {
|
|
691
|
+
if (value === null || value === void 0 || value === "") {
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
return String(value);
|
|
695
|
+
},
|
|
696
|
+
json(value) {
|
|
697
|
+
if (value === null || value === void 0) {
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
try {
|
|
701
|
+
return JSON.stringify(value);
|
|
702
|
+
} catch {
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
string(value) {
|
|
707
|
+
if (value === null || value === void 0) {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
return String(value);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
var defaultCompare = (previous, next) => previous === next;
|
|
714
|
+
function Prop(options = {}) {
|
|
715
|
+
const { attribute, reflect = true, type, parse, format, defaultValue, compare = defaultCompare, onChange, onAttributeChange } = options;
|
|
716
|
+
const resolvedType = resolveType(type);
|
|
717
|
+
const parseValue = parse ? parse : function(value) {
|
|
718
|
+
if (!resolvedType) {
|
|
719
|
+
return value;
|
|
720
|
+
}
|
|
721
|
+
return typeParsers[resolvedType].call(this, value);
|
|
722
|
+
};
|
|
723
|
+
const formatValue = format ? format : function(value) {
|
|
724
|
+
if (!resolvedType) {
|
|
725
|
+
return value ?? null;
|
|
726
|
+
}
|
|
727
|
+
return typeFormatters[resolvedType].call(this, value);
|
|
728
|
+
};
|
|
729
|
+
return (accessor, context) => {
|
|
730
|
+
if (context.kind !== "accessor") {
|
|
731
|
+
throw new Error('@Prop requires the "accessor" keyword on the property.');
|
|
732
|
+
}
|
|
733
|
+
const attributeName = attribute ?? toKebabCase(context.name);
|
|
734
|
+
context.addInitializer(function() {
|
|
735
|
+
if (!reflect) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
observeAttribute(this, attributeName, (rawValue) => {
|
|
739
|
+
if (isInternalMutation(this, attributeName)) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
const parsed = parseValue.call(this, rawValue);
|
|
743
|
+
const previous = accessor.get.call(this);
|
|
744
|
+
if (compare(previous, parsed)) {
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
accessor.set.call(this, parsed);
|
|
748
|
+
onAttributeChange?.call(this, parsed, previous);
|
|
749
|
+
scheduleRender(this);
|
|
750
|
+
});
|
|
751
|
+
});
|
|
752
|
+
return {
|
|
753
|
+
get() {
|
|
754
|
+
return accessor.get.call(this);
|
|
755
|
+
},
|
|
756
|
+
set(value) {
|
|
757
|
+
const previous = accessor.get.call(this);
|
|
758
|
+
if (compare(previous, value)) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
accessor.set.call(this, value);
|
|
762
|
+
if (reflect) {
|
|
763
|
+
const formatted = formatValue.call(this, value);
|
|
764
|
+
updateAttribute(this, attributeName, formatted);
|
|
765
|
+
}
|
|
766
|
+
onChange?.call(this, value, previous);
|
|
767
|
+
scheduleRender(this);
|
|
768
|
+
},
|
|
769
|
+
init(initialValue) {
|
|
770
|
+
let value = initialValue;
|
|
771
|
+
if (this.hasAttribute(attributeName)) {
|
|
772
|
+
value = parseValue.call(this, this.getAttribute(attributeName));
|
|
773
|
+
} else if (value === void 0 && defaultValue !== void 0) {
|
|
774
|
+
value = typeof defaultValue === "function" ? defaultValue.call(this) : defaultValue;
|
|
775
|
+
}
|
|
776
|
+
if (reflect) {
|
|
777
|
+
const formatted = formatValue.call(this, value);
|
|
778
|
+
updateAttribute(this, attributeName, formatted);
|
|
779
|
+
}
|
|
780
|
+
return value;
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/decorators/Query.ts
|
|
787
|
+
var defaultOptions = {
|
|
788
|
+
all: false,
|
|
789
|
+
closest: false,
|
|
790
|
+
from: "shadow",
|
|
791
|
+
fallback: null
|
|
792
|
+
};
|
|
793
|
+
var resolveFallback = (fallback, host) => {
|
|
794
|
+
if (typeof fallback === "function") {
|
|
795
|
+
return fallback(host);
|
|
796
|
+
}
|
|
797
|
+
return fallback;
|
|
798
|
+
};
|
|
799
|
+
var resolveRoot = (host, option) => {
|
|
800
|
+
switch (option) {
|
|
801
|
+
case "document":
|
|
802
|
+
return document;
|
|
803
|
+
case "light":
|
|
804
|
+
return host;
|
|
805
|
+
default:
|
|
806
|
+
return host.renderRoot ?? host.shadowRoot ?? host;
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
var resolveQuery = (host, selector, options) => {
|
|
810
|
+
if (options.closest) {
|
|
811
|
+
const result = host.closest(selector);
|
|
812
|
+
return result ?? resolveFallback(options.fallback, host) ?? null;
|
|
813
|
+
}
|
|
814
|
+
const root = resolveRoot(host, options.from);
|
|
815
|
+
if (!root) {
|
|
816
|
+
return options.all ? resolveFallback(options.fallback, host) ?? [] : resolveFallback(options.fallback, host) ?? null;
|
|
817
|
+
}
|
|
818
|
+
if (options.all) {
|
|
819
|
+
const elements = Array.from(root.querySelectorAll(selector));
|
|
820
|
+
return elements.length > 0 ? elements : resolveFallback(options.fallback, host) ?? [];
|
|
821
|
+
}
|
|
822
|
+
const match = root.querySelector(selector);
|
|
823
|
+
return match ?? resolveFallback(options.fallback, host) ?? null;
|
|
824
|
+
};
|
|
825
|
+
var createQueryDecorator = (selector, options) => {
|
|
826
|
+
return (_target, context) => {
|
|
827
|
+
if (context.kind === "accessor") {
|
|
828
|
+
const descriptor = {
|
|
829
|
+
get() {
|
|
830
|
+
return resolveQuery(this, selector, options);
|
|
831
|
+
},
|
|
832
|
+
set(_value) {
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
return descriptor;
|
|
836
|
+
}
|
|
837
|
+
context.addInitializer(function() {
|
|
838
|
+
Object.defineProperty(this, context.name, {
|
|
839
|
+
configurable: true,
|
|
840
|
+
enumerable: true,
|
|
841
|
+
get: () => resolveQuery(this, selector, options)
|
|
842
|
+
});
|
|
843
|
+
});
|
|
844
|
+
return;
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
function Query(selector, userOptions) {
|
|
848
|
+
if (!selector) {
|
|
849
|
+
throw new Error("@Query requires a selector.");
|
|
850
|
+
}
|
|
851
|
+
if (userOptions) {
|
|
852
|
+
const merged2 = {
|
|
853
|
+
...defaultOptions,
|
|
854
|
+
...userOptions
|
|
855
|
+
};
|
|
856
|
+
return createQueryDecorator(selector, merged2);
|
|
857
|
+
}
|
|
858
|
+
const merged = defaultOptions;
|
|
859
|
+
return createQueryDecorator(selector, merged);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// swc:/home/runner/work/web-kit/web-kit/packages/core/src/decorators/Watch.ts
|
|
863
|
+
var renderQueue2 = /* @__PURE__ */ new WeakMap();
|
|
864
|
+
var scheduleRender2 = (instance) => {
|
|
865
|
+
if (typeof instance.requestRender === "function") {
|
|
866
|
+
instance.requestRender();
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
if (typeof instance.render !== "function") {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
if (renderQueue2.get(instance)) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
renderQueue2.set(instance, true);
|
|
876
|
+
requestAnimationFrame(() => {
|
|
877
|
+
renderQueue2.set(instance, false);
|
|
878
|
+
instance.render?.();
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
var defaultCompare2 = (previous, next) => previous === next;
|
|
882
|
+
function Watch(options = {}) {
|
|
883
|
+
const { compare = defaultCompare2, onChange, transform } = options;
|
|
884
|
+
return (accessor, context) => {
|
|
885
|
+
if (context.kind !== "accessor") {
|
|
886
|
+
throw new Error('@Watch requires the "accessor" keyword on the property.');
|
|
887
|
+
}
|
|
888
|
+
return {
|
|
889
|
+
get() {
|
|
890
|
+
return accessor.get.call(this);
|
|
891
|
+
},
|
|
892
|
+
set(value) {
|
|
893
|
+
const previous = accessor.get.call(this);
|
|
894
|
+
if (compare(previous, value)) {
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
accessor.set.call(this, value);
|
|
898
|
+
if (onChange) {
|
|
899
|
+
onChange.call(this, value, previous);
|
|
900
|
+
}
|
|
901
|
+
scheduleRender2(this);
|
|
902
|
+
},
|
|
903
|
+
init(initialValue) {
|
|
904
|
+
if (transform) {
|
|
905
|
+
return transform.call(this, initialValue);
|
|
906
|
+
}
|
|
907
|
+
return initialValue;
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
913
|
+
0 && (module.exports = {
|
|
914
|
+
Component,
|
|
915
|
+
Listen,
|
|
916
|
+
OutsideClick,
|
|
917
|
+
Prop,
|
|
918
|
+
Query,
|
|
919
|
+
Watch
|
|
920
|
+
});
|
|
921
|
+
//# sourceMappingURL=decorators.cjs.map
|