@easemate/web-kit 0.1.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/README.md +824 -0
- package/build/components/code/index.cjs +152 -0
- package/build/components/code/index.d.cts +11 -0
- package/build/components/code/index.d.ts +11 -0
- package/build/components/code/index.js +148 -0
- package/build/components/code/utils/highlight-api.cjs +18 -0
- package/build/components/code/utils/highlight-api.d.cts +7 -0
- package/build/components/code/utils/highlight-api.d.ts +7 -0
- package/build/components/code/utils/highlight-api.js +14 -0
- package/build/components/code/utils/syntax-grammars.cjs +62 -0
- package/build/components/code/utils/syntax-grammars.d.cts +7 -0
- package/build/components/code/utils/syntax-grammars.d.ts +7 -0
- package/build/components/code/utils/syntax-grammars.js +59 -0
- package/build/components/code/utils/syntax-highlighter-theme.cjs +27 -0
- package/build/components/code/utils/syntax-highlighter-theme.d.cts +3 -0
- package/build/components/code/utils/syntax-highlighter-theme.d.ts +3 -0
- package/build/components/code/utils/syntax-highlighter-theme.js +23 -0
- package/build/components/code/utils/syntax-highlighter-types.cjs +2 -0
- package/build/components/code/utils/syntax-highlighter-types.d.cts +12 -0
- package/build/components/code/utils/syntax-highlighter-types.d.ts +12 -0
- package/build/components/code/utils/syntax-highlighter-types.js +1 -0
- package/build/components/code/utils/syntax-tokenizer.cjs +63 -0
- package/build/components/code/utils/syntax-tokenizer.d.cts +3 -0
- package/build/components/code/utils/syntax-tokenizer.d.ts +3 -0
- package/build/components/code/utils/syntax-tokenizer.js +58 -0
- package/build/components/curve/bezier-conversion.cjs +23 -0
- package/build/components/curve/bezier-conversion.d.cts +2 -0
- package/build/components/curve/bezier-conversion.d.ts +2 -0
- package/build/components/curve/bezier-conversion.js +19 -0
- package/build/components/curve/canvas-controls.cjs +300 -0
- package/build/components/curve/canvas-controls.d.cts +12 -0
- package/build/components/curve/canvas-controls.d.ts +12 -0
- package/build/components/curve/canvas-controls.js +296 -0
- package/build/components/curve/canvas.cjs +1208 -0
- package/build/components/curve/canvas.d.cts +24 -0
- package/build/components/curve/canvas.d.ts +24 -0
- package/build/components/curve/canvas.js +1204 -0
- package/build/components/curve/constants.cjs +203 -0
- package/build/components/curve/constants.d.cts +23 -0
- package/build/components/curve/constants.d.ts +23 -0
- package/build/components/curve/constants.js +200 -0
- package/build/components/curve/controls.cjs +942 -0
- package/build/components/curve/controls.d.cts +37 -0
- package/build/components/curve/controls.d.ts +37 -0
- package/build/components/curve/controls.js +938 -0
- package/build/components/curve/index.cjs +335 -0
- package/build/components/curve/index.d.cts +31 -0
- package/build/components/curve/index.d.ts +31 -0
- package/build/components/curve/index.js +330 -0
- package/build/components/curve/output.cjs +141 -0
- package/build/components/curve/output.d.cts +19 -0
- package/build/components/curve/output.d.ts +19 -0
- package/build/components/curve/output.js +137 -0
- package/build/components/curve/styles.cjs +493 -0
- package/build/components/curve/styles.d.cts +6 -0
- package/build/components/curve/styles.d.ts +6 -0
- package/build/components/curve/styles.js +490 -0
- package/build/components/curve/svg-renderer.cjs +185 -0
- package/build/components/curve/svg-renderer.d.cts +9 -0
- package/build/components/curve/svg-renderer.d.ts +9 -0
- package/build/components/curve/svg-renderer.js +175 -0
- package/build/components/curve/toolbar.cjs +368 -0
- package/build/components/curve/toolbar.d.cts +26 -0
- package/build/components/curve/toolbar.d.ts +26 -0
- package/build/components/curve/toolbar.js +364 -0
- package/build/components/curve/types.cjs +10 -0
- package/build/components/curve/types.d.cts +33 -0
- package/build/components/curve/types.d.ts +33 -0
- package/build/components/curve/types.js +7 -0
- package/build/components/curve/utils.cjs +541 -0
- package/build/components/curve/utils.d.cts +33 -0
- package/build/components/curve/utils.d.ts +33 -0
- package/build/components/curve/utils.js +521 -0
- package/build/components/index.cjs +18 -0
- package/build/components/index.d.cts +2 -0
- package/build/components/index.d.ts +2 -0
- package/build/components/index.js +2 -0
- package/build/decorators/Component.cjs +127 -0
- package/build/decorators/Component.d.cts +28 -0
- package/build/decorators/Component.d.ts +28 -0
- package/build/decorators/Component.js +123 -0
- package/build/decorators/Listen.cjs +154 -0
- package/build/decorators/Listen.d.cts +18 -0
- package/build/decorators/Listen.d.ts +18 -0
- package/build/decorators/Listen.js +151 -0
- package/build/decorators/OutsideClick.cjs +64 -0
- package/build/decorators/OutsideClick.d.cts +16 -0
- package/build/decorators/OutsideClick.d.ts +16 -0
- package/build/decorators/OutsideClick.js +59 -0
- package/build/decorators/Prop.cjs +273 -0
- package/build/decorators/Prop.d.cts +22 -0
- package/build/decorators/Prop.d.ts +22 -0
- package/build/decorators/Prop.js +270 -0
- package/build/decorators/Query.cjs +79 -0
- package/build/decorators/Query.d.cts +27 -0
- package/build/decorators/Query.d.ts +27 -0
- package/build/decorators/Query.js +76 -0
- package/build/decorators/Watch.cjs +52 -0
- package/build/decorators/Watch.d.cts +11 -0
- package/build/decorators/Watch.d.ts +11 -0
- package/build/decorators/Watch.js +49 -0
- package/build/decorators/index.cjs +15 -0
- package/build/decorators/index.d.cts +6 -0
- package/build/decorators/index.d.ts +6 -0
- package/build/decorators/index.js +6 -0
- package/build/elements/button/index.cjs +214 -0
- package/build/elements/button/index.d.cts +11 -0
- package/build/elements/button/index.d.ts +11 -0
- package/build/elements/button/index.js +210 -0
- package/build/elements/checkbox/index.cjs +316 -0
- package/build/elements/checkbox/index.d.cts +14 -0
- package/build/elements/checkbox/index.d.ts +14 -0
- package/build/elements/checkbox/index.js +312 -0
- package/build/elements/color/index.cjs +154 -0
- package/build/elements/color/index.d.cts +18 -0
- package/build/elements/color/index.d.ts +18 -0
- package/build/elements/color/index.js +150 -0
- package/build/elements/color/picker.cjs +544 -0
- package/build/elements/color/picker.d.cts +37 -0
- package/build/elements/color/picker.d.ts +37 -0
- package/build/elements/color/picker.js +540 -0
- package/build/elements/color/utils.cjs +235 -0
- package/build/elements/color/utils.d.cts +37 -0
- package/build/elements/color/utils.d.ts +37 -0
- package/build/elements/color/utils.js +218 -0
- package/build/elements/dropdown/index.cjs +875 -0
- package/build/elements/dropdown/index.d.cts +30 -0
- package/build/elements/dropdown/index.d.ts +30 -0
- package/build/elements/dropdown/index.js +871 -0
- package/build/elements/field/index.cjs +82 -0
- package/build/elements/field/index.d.cts +4 -0
- package/build/elements/field/index.d.ts +4 -0
- package/build/elements/field/index.js +78 -0
- package/build/elements/icons/animation/chevron.cjs +57 -0
- package/build/elements/icons/animation/chevron.d.cts +10 -0
- package/build/elements/icons/animation/chevron.d.ts +10 -0
- package/build/elements/icons/animation/chevron.js +53 -0
- package/build/elements/icons/animation/clear.cjs +74 -0
- package/build/elements/icons/animation/clear.d.cts +3 -0
- package/build/elements/icons/animation/clear.d.ts +3 -0
- package/build/elements/icons/animation/clear.js +70 -0
- package/build/elements/icons/animation/grid.cjs +77 -0
- package/build/elements/icons/animation/grid.d.cts +8 -0
- package/build/elements/icons/animation/grid.d.ts +8 -0
- package/build/elements/icons/animation/grid.js +73 -0
- package/build/elements/icons/animation/loading.cjs +68 -0
- package/build/elements/icons/animation/loading.d.cts +3 -0
- package/build/elements/icons/animation/loading.d.ts +3 -0
- package/build/elements/icons/animation/loading.js +64 -0
- package/build/elements/icons/animation/snap.cjs +133 -0
- package/build/elements/icons/animation/snap.d.cts +8 -0
- package/build/elements/icons/animation/snap.d.ts +8 -0
- package/build/elements/icons/animation/snap.js +129 -0
- package/build/elements/icons/index.cjs +40 -0
- package/build/elements/icons/index.d.cts +24 -0
- package/build/elements/icons/index.d.ts +24 -0
- package/build/elements/icons/index.js +24 -0
- package/build/elements/icons/interface/anchor-add.cjs +35 -0
- package/build/elements/icons/interface/anchor-add.d.cts +3 -0
- package/build/elements/icons/interface/anchor-add.d.ts +3 -0
- package/build/elements/icons/interface/anchor-add.js +31 -0
- package/build/elements/icons/interface/anchor-remove.cjs +34 -0
- package/build/elements/icons/interface/anchor-remove.d.cts +3 -0
- package/build/elements/icons/interface/anchor-remove.d.ts +3 -0
- package/build/elements/icons/interface/anchor-remove.js +30 -0
- package/build/elements/icons/interface/arrow-up.cjs +30 -0
- package/build/elements/icons/interface/arrow-up.d.cts +3 -0
- package/build/elements/icons/interface/arrow-up.d.ts +3 -0
- package/build/elements/icons/interface/arrow-up.js +26 -0
- package/build/elements/icons/interface/arrows-vertical.cjs +30 -0
- package/build/elements/icons/interface/arrows-vertical.d.cts +3 -0
- package/build/elements/icons/interface/arrows-vertical.d.ts +3 -0
- package/build/elements/icons/interface/arrows-vertical.js +26 -0
- package/build/elements/icons/interface/bezier-angle.cjs +33 -0
- package/build/elements/icons/interface/bezier-angle.d.cts +3 -0
- package/build/elements/icons/interface/bezier-angle.d.ts +3 -0
- package/build/elements/icons/interface/bezier-angle.js +29 -0
- package/build/elements/icons/interface/bezier-distribute.cjs +34 -0
- package/build/elements/icons/interface/bezier-distribute.d.cts +3 -0
- package/build/elements/icons/interface/bezier-distribute.d.ts +3 -0
- package/build/elements/icons/interface/bezier-distribute.js +30 -0
- package/build/elements/icons/interface/bezier-length.cjs +31 -0
- package/build/elements/icons/interface/bezier-length.d.cts +3 -0
- package/build/elements/icons/interface/bezier-length.d.ts +3 -0
- package/build/elements/icons/interface/bezier-length.js +27 -0
- package/build/elements/icons/interface/bezier-mirror.cjs +31 -0
- package/build/elements/icons/interface/bezier-mirror.d.cts +3 -0
- package/build/elements/icons/interface/bezier-mirror.d.ts +3 -0
- package/build/elements/icons/interface/bezier-mirror.js +27 -0
- package/build/elements/icons/interface/bezier.cjs +26 -0
- package/build/elements/icons/interface/bezier.d.cts +3 -0
- package/build/elements/icons/interface/bezier.d.ts +3 -0
- package/build/elements/icons/interface/bezier.js +22 -0
- package/build/elements/icons/interface/check.cjs +30 -0
- package/build/elements/icons/interface/check.d.cts +3 -0
- package/build/elements/icons/interface/check.d.ts +3 -0
- package/build/elements/icons/interface/check.js +26 -0
- package/build/elements/icons/interface/circle-arrow-left.cjs +30 -0
- package/build/elements/icons/interface/circle-arrow-left.d.cts +3 -0
- package/build/elements/icons/interface/circle-arrow-left.d.ts +3 -0
- package/build/elements/icons/interface/circle-arrow-left.js +26 -0
- package/build/elements/icons/interface/circle-arrow-right.cjs +30 -0
- package/build/elements/icons/interface/circle-arrow-right.d.cts +3 -0
- package/build/elements/icons/interface/circle-arrow-right.d.ts +3 -0
- package/build/elements/icons/interface/circle-arrow-right.js +26 -0
- package/build/elements/icons/interface/code.cjs +30 -0
- package/build/elements/icons/interface/code.d.cts +3 -0
- package/build/elements/icons/interface/code.d.ts +3 -0
- package/build/elements/icons/interface/code.js +26 -0
- package/build/elements/icons/interface/dots.cjs +32 -0
- package/build/elements/icons/interface/dots.d.cts +3 -0
- package/build/elements/icons/interface/dots.d.ts +3 -0
- package/build/elements/icons/interface/dots.js +28 -0
- package/build/elements/icons/interface/mention.cjs +30 -0
- package/build/elements/icons/interface/mention.d.cts +3 -0
- package/build/elements/icons/interface/mention.d.ts +3 -0
- package/build/elements/icons/interface/mention.js +26 -0
- package/build/elements/icons/interface/minus.cjs +30 -0
- package/build/elements/icons/interface/minus.d.cts +3 -0
- package/build/elements/icons/interface/minus.d.ts +3 -0
- package/build/elements/icons/interface/minus.js +26 -0
- package/build/elements/icons/interface/picker.cjs +34 -0
- package/build/elements/icons/interface/picker.d.cts +3 -0
- package/build/elements/icons/interface/picker.d.ts +3 -0
- package/build/elements/icons/interface/picker.js +30 -0
- package/build/elements/icons/interface/plus.cjs +30 -0
- package/build/elements/icons/interface/plus.d.cts +3 -0
- package/build/elements/icons/interface/plus.d.ts +3 -0
- package/build/elements/icons/interface/plus.js +26 -0
- package/build/elements/icons/interface/settings.cjs +30 -0
- package/build/elements/icons/interface/settings.d.cts +3 -0
- package/build/elements/icons/interface/settings.d.ts +3 -0
- package/build/elements/icons/interface/settings.js +26 -0
- package/build/elements/index.cjs +62 -0
- package/build/elements/index.d.cts +22 -0
- package/build/elements/index.d.ts +22 -0
- package/build/elements/index.js +22 -0
- package/build/elements/input/index.cjs +273 -0
- package/build/elements/input/index.d.cts +17 -0
- package/build/elements/input/index.d.ts +17 -0
- package/build/elements/input/index.js +269 -0
- package/build/elements/logo/index.cjs +732 -0
- package/build/elements/logo/index.d.cts +17 -0
- package/build/elements/logo/index.d.ts +17 -0
- package/build/elements/logo/index.js +728 -0
- package/build/elements/monitor/fps.cjs +432 -0
- package/build/elements/monitor/fps.d.cts +21 -0
- package/build/elements/monitor/fps.d.ts +21 -0
- package/build/elements/monitor/fps.js +428 -0
- package/build/elements/monitor/index.cjs +670 -0
- package/build/elements/monitor/index.d.cts +112 -0
- package/build/elements/monitor/index.d.ts +112 -0
- package/build/elements/monitor/index.js +666 -0
- package/build/elements/number/index.cjs +173 -0
- package/build/elements/number/index.d.cts +19 -0
- package/build/elements/number/index.d.ts +19 -0
- package/build/elements/number/index.js +169 -0
- package/build/elements/origin/index.cjs +169 -0
- package/build/elements/origin/index.d.cts +12 -0
- package/build/elements/origin/index.d.ts +12 -0
- package/build/elements/origin/index.js +165 -0
- package/build/elements/popover/index.cjs +209 -0
- package/build/elements/popover/index.d.cts +19 -0
- package/build/elements/popover/index.d.ts +19 -0
- package/build/elements/popover/index.js +205 -0
- package/build/elements/radio/index.cjs +301 -0
- package/build/elements/radio/index.d.cts +13 -0
- package/build/elements/radio/index.d.ts +13 -0
- package/build/elements/radio/index.js +283 -0
- package/build/elements/radio/input.cjs +329 -0
- package/build/elements/radio/input.d.cts +15 -0
- package/build/elements/radio/input.d.ts +15 -0
- package/build/elements/radio/input.js +325 -0
- package/build/elements/radio/option.cjs +15 -0
- package/build/elements/radio/option.d.cts +3 -0
- package/build/elements/radio/option.d.ts +3 -0
- package/build/elements/radio/option.js +11 -0
- package/build/elements/shared.cjs +66 -0
- package/build/elements/shared.d.cts +40 -0
- package/build/elements/shared.d.ts +40 -0
- package/build/elements/shared.js +59 -0
- package/build/elements/slider/index.cjs +232 -0
- package/build/elements/slider/index.d.cts +20 -0
- package/build/elements/slider/index.d.ts +20 -0
- package/build/elements/slider/index.js +228 -0
- package/build/elements/state/index.cjs +681 -0
- package/build/elements/state/index.d.cts +86 -0
- package/build/elements/state/index.d.ts +86 -0
- package/build/elements/state/index.js +677 -0
- package/build/elements/toggle/index.cjs +151 -0
- package/build/elements/toggle/index.d.cts +9 -0
- package/build/elements/toggle/index.d.ts +9 -0
- package/build/elements/toggle/index.js +147 -0
- package/build/elements/tooltip/index.cjs +187 -0
- package/build/elements/tooltip/index.d.cts +17 -0
- package/build/elements/tooltip/index.d.ts +17 -0
- package/build/elements/tooltip/index.js +183 -0
- package/build/index.cjs +40 -0
- package/build/index.d.cts +6 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +12 -0
- package/build/init.cjs +325 -0
- package/build/init.d.cts +157 -0
- package/build/init.d.ts +157 -0
- package/build/init.js +289 -0
- package/build/internal/component-loaders.cjs +206 -0
- package/build/internal/component-loaders.d.cts +52 -0
- package/build/internal/component-loaders.d.ts +52 -0
- package/build/internal/component-loaders.js +167 -0
- package/build/internal/fonts.cjs +128 -0
- package/build/internal/fonts.d.cts +32 -0
- package/build/internal/fonts.d.ts +32 -0
- package/build/internal/fonts.js +123 -0
- package/build/internal/lazy-load.cjs +89 -0
- package/build/internal/lazy-load.d.cts +32 -0
- package/build/internal/lazy-load.d.ts +32 -0
- package/build/internal/lazy-load.js +86 -0
- package/build/internal/style-inject.cjs +236 -0
- package/build/internal/style-inject.d.cts +44 -0
- package/build/internal/style-inject.d.ts +44 -0
- package/build/internal/style-inject.js +226 -0
- package/build/register.cjs +36 -0
- package/build/register.d.cts +32 -0
- package/build/register.d.ts +32 -0
- package/build/register.js +34 -0
- package/build/theme/index.cjs +452 -0
- package/build/theme/index.d.cts +146 -0
- package/build/theme/index.d.ts +146 -0
- package/build/theme/index.js +423 -0
- package/build/theme/presets.cjs +54 -0
- package/build/theme/presets.d.cts +19 -0
- package/build/theme/presets.d.ts +19 -0
- package/build/theme/presets.js +51 -0
- package/build/theme/registry.cjs +204 -0
- package/build/theme/registry.d.cts +99 -0
- package/build/theme/registry.d.ts +99 -0
- package/build/theme/registry.js +194 -0
- package/build/theme/tokens.cjs +148 -0
- package/build/theme/tokens.d.cts +163 -0
- package/build/theme/tokens.d.ts +163 -0
- package/build/theme/tokens.js +145 -0
- package/build/utils/dismiss-controller.cjs +77 -0
- package/build/utils/dismiss-controller.d.cts +14 -0
- package/build/utils/dismiss-controller.d.ts +14 -0
- package/build/utils/dismiss-controller.js +73 -0
- package/build/utils/index.cjs +18 -0
- package/build/utils/index.d.cts +3 -0
- package/build/utils/index.d.ts +3 -0
- package/build/utils/index.js +3 -0
- package/build/utils/outside-click.cjs +82 -0
- package/build/utils/outside-click.d.cts +18 -0
- package/build/utils/outside-click.d.ts +18 -0
- package/build/utils/outside-click.js +74 -0
- package/build/utils/template-helpers.cjs +39 -0
- package/build/utils/template-helpers.d.cts +13 -0
- package/build/utils/template-helpers.d.ts +13 -0
- package/build/utils/template-helpers.js +28 -0
- package/package.json +96 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import "../dropdown/index.js";
|
|
2
|
+
import { html } from 'lit-html';
|
|
3
|
+
import { dispatchControlEvent, setBooleanAttribute } from "../shared.js";
|
|
4
|
+
import { Component } from '~/decorators/Component';
|
|
5
|
+
import { Listen } from '~/decorators/Listen';
|
|
6
|
+
import { Prop } from '~/decorators/Prop';
|
|
7
|
+
import { Query } from '~/decorators/Query';
|
|
8
|
+
@Component({
|
|
9
|
+
tag: 'ease-origin',
|
|
10
|
+
styles: `
|
|
11
|
+
:host {
|
|
12
|
+
display: contents;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[part="container"] {
|
|
16
|
+
flex: 1;
|
|
17
|
+
width: 100%;
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-columns: 30px auto;
|
|
20
|
+
grid-gap: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[part="preview"] {
|
|
24
|
+
width: 30px;
|
|
25
|
+
height: 30px;
|
|
26
|
+
border-radius: var(--radii-md);
|
|
27
|
+
background-color: var(--color-gray-875);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
box-shadow: inset 0 1px .25px 0 var(--color-white-4), 0 1px 2.5px 0 var(--color-black-8);
|
|
30
|
+
border-radius: var(--radii-md);
|
|
31
|
+
position: relative;
|
|
32
|
+
|
|
33
|
+
&::before,
|
|
34
|
+
&::after {
|
|
35
|
+
content: '';
|
|
36
|
+
display: block;
|
|
37
|
+
width: 3px;
|
|
38
|
+
height: 3px;
|
|
39
|
+
background-color: var(--color-blue-100);
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 50%;
|
|
43
|
+
left: 50%;
|
|
44
|
+
margin-top: -1.5px;
|
|
45
|
+
margin-left: -1.5px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&::before {
|
|
49
|
+
background-color: var(--color-gray-700);
|
|
50
|
+
box-shadow: -6.5px -6.5px 0 0 var(--color-gray-700), 0 -6.5px 0 0 var(--color-gray-700), 6.5px -6.5px 0 0 var(--color-gray-700), -6.5px 0 0 0 var(--color-gray-700), 6.5px 0 0 0 var(--color-gray-700), -6.5px 6.5px 0 0 var(--color-gray-700), 0 6.5px 0 0 var(--color-gray-700), 6.5px 6.5px 0 0 var(--color-gray-700);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&::after {
|
|
54
|
+
translate: var(--ease-origin-translate-x, 0) var(--ease-origin-translate-y, 0);
|
|
55
|
+
scale: 1.25;
|
|
56
|
+
transition: translate 0.3s cubic-bezier(0.25, 0, 0.5, 1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
background-color: var(--color-gray-850);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:focus-within {
|
|
64
|
+
background-color: var(--color-gray-825);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&[data-value="top-left"] {
|
|
68
|
+
--ease-origin-translate-x: -6.5px;
|
|
69
|
+
--ease-origin-translate-y: -6.5px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&[data-value="top-center"] {
|
|
73
|
+
--ease-origin-translate-x: 0;
|
|
74
|
+
--ease-origin-translate-y: -6.5px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[data-value="top-right"] {
|
|
78
|
+
--ease-origin-translate-x: 6.5px;
|
|
79
|
+
--ease-origin-translate-y: -6.5px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&[data-value="center-left"] {
|
|
83
|
+
--ease-origin-translate-x: -6.5px;
|
|
84
|
+
--ease-origin-translate-y: 0
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&[data-value="center-center"] {
|
|
88
|
+
--ease-origin-translate-x: 0;
|
|
89
|
+
--ease-origin-translate-y: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&[data-value="center-right"] {
|
|
93
|
+
--ease-origin-translate-x: 6.5px;
|
|
94
|
+
--ease-origin-translate-y: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[data-value="bottom-left"] {
|
|
98
|
+
--ease-origin-translate-x: -6.5px;
|
|
99
|
+
--ease-origin-translate-y: 6.5px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&[data-value="bottom-center"] {
|
|
103
|
+
--ease-origin-translate-x: 0;
|
|
104
|
+
--ease-origin-translate-y: 6.5px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&[data-value="bottom-right"] {
|
|
108
|
+
--ease-origin-translate-x: 6.5px;
|
|
109
|
+
--ease-origin-translate-y: 6.5px;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
ease-dropdown[part="dropdown"] {
|
|
114
|
+
--ease-dropdown-max-height: 180px;
|
|
115
|
+
|
|
116
|
+
width: 100%;
|
|
117
|
+
}
|
|
118
|
+
`,
|
|
119
|
+
template() {
|
|
120
|
+
return html `
|
|
121
|
+
<div part="container">
|
|
122
|
+
<div part="preview" data-value=${this.value ?? 'center-center'}></div>
|
|
123
|
+
|
|
124
|
+
<ease-dropdown part="dropdown" placeholder="Select" id="origin-dropdown" .value=${this.value ?? 'center-center'} fullWidth name=${this.name} @value-change=${this.handleValueChange}>
|
|
125
|
+
<button slot="content" value="top-left">Top Left</button>
|
|
126
|
+
<button slot="content" value="top-center">Top Center</button>
|
|
127
|
+
<button slot="content" value="top-right">Top Right</button>
|
|
128
|
+
<hr slot="content" />
|
|
129
|
+
<button slot="content" value="center-left">Center Left</button>
|
|
130
|
+
<button slot="content" value="center-center">Center Center</button>
|
|
131
|
+
<button slot="content" value="center-right">Center Right</button>
|
|
132
|
+
<hr slot="content" />
|
|
133
|
+
<button slot="content" value="bottom-left">Bottom Left</button>
|
|
134
|
+
<button slot="content" value="bottom-center">Bottom Center</button>
|
|
135
|
+
<button slot="content" value="bottom-right">Bottom Right</button>
|
|
136
|
+
</ease-dropdown>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
export class Origin extends HTMLElement {
|
|
142
|
+
@Prop({ reflect: true, defaultValue: 'center-center' })
|
|
143
|
+
accessor value = 'center-center';
|
|
144
|
+
@Prop({ type: Boolean, reflect: true })
|
|
145
|
+
accessor disabled;
|
|
146
|
+
@Query('ease-dropdown')
|
|
147
|
+
accessor control;
|
|
148
|
+
@Prop({ reflect: true, defaultValue: '' })
|
|
149
|
+
accessor name = '';
|
|
150
|
+
afterRender() {
|
|
151
|
+
setBooleanAttribute(this, 'disabled', Boolean(this.disabled));
|
|
152
|
+
}
|
|
153
|
+
@Listen('change', { selector: 'ease-dropdown' })
|
|
154
|
+
handleChange(event, target) {
|
|
155
|
+
if (!target) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this.value = String(target.value ?? 'center-center');
|
|
159
|
+
dispatchControlEvent(this, 'change', { value: this.value, event });
|
|
160
|
+
}
|
|
161
|
+
handleValueChange = (event) => {
|
|
162
|
+
this.value = String(this.control?.value ?? 'center-center');
|
|
163
|
+
dispatchControlEvent(this, 'change', { value: this.value, event });
|
|
164
|
+
};
|
|
165
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Popover = void 0;
|
|
4
|
+
const lit_html_1 = require("lit-html");
|
|
5
|
+
const Component_1 = require("~/decorators/Component");
|
|
6
|
+
const Prop_1 = require("~/decorators/Prop");
|
|
7
|
+
const nextAnchorName = () => `--ease-popover-anchor-${crypto.randomUUID()}`;
|
|
8
|
+
@(0, Component_1.Component)({
|
|
9
|
+
tag: 'ease-popover',
|
|
10
|
+
autoSlot: false,
|
|
11
|
+
shadowMode: 'open',
|
|
12
|
+
styles: `
|
|
13
|
+
:host {
|
|
14
|
+
display: contents;
|
|
15
|
+
--ease-popover-offset: 8px;
|
|
16
|
+
--ease-popover-anchor-name: --ease-popover-anchor;
|
|
17
|
+
--ease-popover-transform-origin: center center;
|
|
18
|
+
--ease-popover-duration: 200ms;
|
|
19
|
+
--ease-popover-content-min-width: auto;
|
|
20
|
+
--ease-popover-content-max-width: none;
|
|
21
|
+
--ease-popover-content-width: max-content;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
::slotted([slot="trigger"]) {
|
|
25
|
+
anchor-name: var(--ease-popover-anchor-name);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[part="content"] {
|
|
29
|
+
position-anchor: var(--ease-popover-anchor-name);
|
|
30
|
+
position: fixed;
|
|
31
|
+
margin: 0;
|
|
32
|
+
transform-origin: var(--ease-popover-transform-origin);
|
|
33
|
+
width: var(--ease-popover-content-width);
|
|
34
|
+
min-width: var(--ease-popover-content-min-width);
|
|
35
|
+
max-width: var(--ease-popover-content-max-width);
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
overscroll-behavior: contain;
|
|
38
|
+
z-index: 100;
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([open]) [part="content"] {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([placement="top-start"]) [part="content"] {
|
|
47
|
+
position-area: top right;
|
|
48
|
+
top: anchor(bottom);
|
|
49
|
+
left: anchor(left);
|
|
50
|
+
translate: 0 calc(var(--ease-popover-offset) * -1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([placement="top-center"]) [part="content"] {
|
|
54
|
+
position-area: top center;
|
|
55
|
+
top: anchor(top);
|
|
56
|
+
left: anchor(center);
|
|
57
|
+
translate: 0 calc(var(--ease-popover-offset) * -1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([placement="top-end"]) [part="content"] {
|
|
61
|
+
position-area: top right;
|
|
62
|
+
top: anchor(bottom);
|
|
63
|
+
right: anchor(right);
|
|
64
|
+
translate: 0 calc(var(--ease-popover-offset) * -1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([placement="bottom-start"]) [part="content"] {
|
|
68
|
+
position-area: bottom right;
|
|
69
|
+
top: anchor(bottom);
|
|
70
|
+
left: anchor(left);
|
|
71
|
+
translate: 0 var(--ease-popover-offset);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:host([placement="bottom-center"]) [part="content"] {
|
|
75
|
+
position-area: bottom center;
|
|
76
|
+
top: anchor(bottom);
|
|
77
|
+
left: anchor(left);
|
|
78
|
+
translate: 0 var(--ease-popover-offset);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([placement="bottom-end"]) [part="content"] {
|
|
82
|
+
position-area: bottom left;
|
|
83
|
+
top: anchor(bottom);
|
|
84
|
+
right: anchor(right);
|
|
85
|
+
translate: 0 var(--ease-popover-offset);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([placement="left-start"]) [part="content"] {
|
|
89
|
+
position-area: left bottom;
|
|
90
|
+
top: anchor(top);
|
|
91
|
+
left: anchor(left);
|
|
92
|
+
translate: calc(var(--ease-popover-offset) * -1) 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:host([placement="left-center"]) [part="content"] {
|
|
96
|
+
position-area: left center;
|
|
97
|
+
top: anchor(top);
|
|
98
|
+
left: anchor(left);
|
|
99
|
+
translate: calc(var(--ease-popover-offset) * -1) 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host([placement="left-end"]) [part="content"] {
|
|
103
|
+
position-area: left top;
|
|
104
|
+
top: anchor(top);
|
|
105
|
+
left: anchor(left);
|
|
106
|
+
translate: calc(var(--ease-popover-offset) * -1) 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host([placement="right-start"]) [part="content"] {
|
|
110
|
+
position-area: right end;
|
|
111
|
+
top: anchor(top);
|
|
112
|
+
left: anchor(right);
|
|
113
|
+
translate: var(--ease-popover-offset) 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([placement="right-center"]) [part="content"] {
|
|
117
|
+
position-area: right center;
|
|
118
|
+
top: anchor(top);
|
|
119
|
+
left: anchor(right);
|
|
120
|
+
translate: var(--ease-popover-offset) 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([placement="right-end"]) [part="content"] {
|
|
124
|
+
position-area: right start;
|
|
125
|
+
top: anchor(top);
|
|
126
|
+
left: anchor(right);
|
|
127
|
+
translate: var(--ease-popover-offset) 0;
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
})
|
|
131
|
+
class Popover extends HTMLElement {
|
|
132
|
+
#anchorName = nextAnchorName();
|
|
133
|
+
#contentElement = null;
|
|
134
|
+
#initialized = false;
|
|
135
|
+
get contentElement() {
|
|
136
|
+
return this.#contentElement;
|
|
137
|
+
}
|
|
138
|
+
@(0, Prop_1.Prop)({
|
|
139
|
+
reflect: true,
|
|
140
|
+
defaultValue: 'bottom-start',
|
|
141
|
+
onChange() {
|
|
142
|
+
this.handlePlacementChange();
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
accessor placement;
|
|
146
|
+
@(0, Prop_1.Prop)({
|
|
147
|
+
type: Number,
|
|
148
|
+
reflect: true,
|
|
149
|
+
defaultValue: 8,
|
|
150
|
+
onChange() {
|
|
151
|
+
this.handleOffsetChange();
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
accessor offset = 8;
|
|
155
|
+
@(0, Prop_1.Prop)({ type: Boolean, reflect: true })
|
|
156
|
+
accessor open = false;
|
|
157
|
+
connectedCallback() {
|
|
158
|
+
this.#syncAnchorName();
|
|
159
|
+
this.#syncOffset();
|
|
160
|
+
}
|
|
161
|
+
disconnectedCallback() {
|
|
162
|
+
this.#contentElement = null;
|
|
163
|
+
this.#initialized = false;
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
return (0, lit_html_1.html) `
|
|
167
|
+
<slot slot="trigger" name="trigger"></slot>
|
|
168
|
+
<div
|
|
169
|
+
part="content"
|
|
170
|
+
data-popover-content
|
|
171
|
+
role="region"
|
|
172
|
+
data-placement=${this.placement}
|
|
173
|
+
>
|
|
174
|
+
<slot></slot>
|
|
175
|
+
</div>
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
178
|
+
handlePlacementChange() {
|
|
179
|
+
if (!this.#initialized) {
|
|
180
|
+
this.requestRender();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this.#syncPlacement();
|
|
184
|
+
}
|
|
185
|
+
handleOffsetChange() {
|
|
186
|
+
if (!this.#initialized) {
|
|
187
|
+
this.requestRender();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.#syncOffset();
|
|
191
|
+
}
|
|
192
|
+
#syncPlacement() {
|
|
193
|
+
this.dataset.placement = this.placement;
|
|
194
|
+
if (this.#contentElement) {
|
|
195
|
+
this.#contentElement.dataset.placement = this.placement;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
#syncOffset() {
|
|
199
|
+
const offset = Number.isFinite(this.offset) ? this.offset : 0;
|
|
200
|
+
this.style.setProperty('--ease-popover-offset', `${offset}px`);
|
|
201
|
+
}
|
|
202
|
+
#syncAnchorName() {
|
|
203
|
+
this.style.setProperty('--ease-popover-anchor-name', this.#anchorName);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
exports.Popover = Popover;
|
|
207
|
+
exports.default = {
|
|
208
|
+
Popover
|
|
209
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit-html';
|
|
2
|
+
export type Placement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' | 'left-start' | 'left-center' | 'left-end' | 'right-start' | 'right-center' | 'right-end';
|
|
3
|
+
export declare class Popover extends HTMLElement {
|
|
4
|
+
#private;
|
|
5
|
+
requestRender: () => void;
|
|
6
|
+
get contentElement(): HTMLElement | null;
|
|
7
|
+
accessor placement: Placement;
|
|
8
|
+
accessor offset: number;
|
|
9
|
+
accessor open: boolean;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
render(): TemplateResult;
|
|
13
|
+
handlePlacementChange(): void;
|
|
14
|
+
handleOffsetChange(): void;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: {
|
|
17
|
+
Popover: typeof Popover;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit-html';
|
|
2
|
+
export type Placement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' | 'left-start' | 'left-center' | 'left-end' | 'right-start' | 'right-center' | 'right-end';
|
|
3
|
+
export declare class Popover extends HTMLElement {
|
|
4
|
+
#private;
|
|
5
|
+
requestRender: () => void;
|
|
6
|
+
get contentElement(): HTMLElement | null;
|
|
7
|
+
accessor placement: Placement;
|
|
8
|
+
accessor offset: number;
|
|
9
|
+
accessor open: boolean;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
render(): TemplateResult;
|
|
13
|
+
handlePlacementChange(): void;
|
|
14
|
+
handleOffsetChange(): void;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: {
|
|
17
|
+
Popover: typeof Popover;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
import { Component } from '~/decorators/Component';
|
|
3
|
+
import { Prop } from '~/decorators/Prop';
|
|
4
|
+
const nextAnchorName = () => `--ease-popover-anchor-${crypto.randomUUID()}`;
|
|
5
|
+
@Component({
|
|
6
|
+
tag: 'ease-popover',
|
|
7
|
+
autoSlot: false,
|
|
8
|
+
shadowMode: 'open',
|
|
9
|
+
styles: `
|
|
10
|
+
:host {
|
|
11
|
+
display: contents;
|
|
12
|
+
--ease-popover-offset: 8px;
|
|
13
|
+
--ease-popover-anchor-name: --ease-popover-anchor;
|
|
14
|
+
--ease-popover-transform-origin: center center;
|
|
15
|
+
--ease-popover-duration: 200ms;
|
|
16
|
+
--ease-popover-content-min-width: auto;
|
|
17
|
+
--ease-popover-content-max-width: none;
|
|
18
|
+
--ease-popover-content-width: max-content;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
::slotted([slot="trigger"]) {
|
|
22
|
+
anchor-name: var(--ease-popover-anchor-name);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[part="content"] {
|
|
26
|
+
position-anchor: var(--ease-popover-anchor-name);
|
|
27
|
+
position: fixed;
|
|
28
|
+
margin: 0;
|
|
29
|
+
transform-origin: var(--ease-popover-transform-origin);
|
|
30
|
+
width: var(--ease-popover-content-width);
|
|
31
|
+
min-width: var(--ease-popover-content-min-width);
|
|
32
|
+
max-width: var(--ease-popover-content-max-width);
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
overscroll-behavior: contain;
|
|
35
|
+
z-index: 100;
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([open]) [part="content"] {
|
|
40
|
+
display: block;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([placement="top-start"]) [part="content"] {
|
|
44
|
+
position-area: top right;
|
|
45
|
+
top: anchor(bottom);
|
|
46
|
+
left: anchor(left);
|
|
47
|
+
translate: 0 calc(var(--ease-popover-offset) * -1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([placement="top-center"]) [part="content"] {
|
|
51
|
+
position-area: top center;
|
|
52
|
+
top: anchor(top);
|
|
53
|
+
left: anchor(center);
|
|
54
|
+
translate: 0 calc(var(--ease-popover-offset) * -1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([placement="top-end"]) [part="content"] {
|
|
58
|
+
position-area: top right;
|
|
59
|
+
top: anchor(bottom);
|
|
60
|
+
right: anchor(right);
|
|
61
|
+
translate: 0 calc(var(--ease-popover-offset) * -1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([placement="bottom-start"]) [part="content"] {
|
|
65
|
+
position-area: bottom right;
|
|
66
|
+
top: anchor(bottom);
|
|
67
|
+
left: anchor(left);
|
|
68
|
+
translate: 0 var(--ease-popover-offset);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([placement="bottom-center"]) [part="content"] {
|
|
72
|
+
position-area: bottom center;
|
|
73
|
+
top: anchor(bottom);
|
|
74
|
+
left: anchor(left);
|
|
75
|
+
translate: 0 var(--ease-popover-offset);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([placement="bottom-end"]) [part="content"] {
|
|
79
|
+
position-area: bottom left;
|
|
80
|
+
top: anchor(bottom);
|
|
81
|
+
right: anchor(right);
|
|
82
|
+
translate: 0 var(--ease-popover-offset);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host([placement="left-start"]) [part="content"] {
|
|
86
|
+
position-area: left bottom;
|
|
87
|
+
top: anchor(top);
|
|
88
|
+
left: anchor(left);
|
|
89
|
+
translate: calc(var(--ease-popover-offset) * -1) 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host([placement="left-center"]) [part="content"] {
|
|
93
|
+
position-area: left center;
|
|
94
|
+
top: anchor(top);
|
|
95
|
+
left: anchor(left);
|
|
96
|
+
translate: calc(var(--ease-popover-offset) * -1) 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([placement="left-end"]) [part="content"] {
|
|
100
|
+
position-area: left top;
|
|
101
|
+
top: anchor(top);
|
|
102
|
+
left: anchor(left);
|
|
103
|
+
translate: calc(var(--ease-popover-offset) * -1) 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([placement="right-start"]) [part="content"] {
|
|
107
|
+
position-area: right end;
|
|
108
|
+
top: anchor(top);
|
|
109
|
+
left: anchor(right);
|
|
110
|
+
translate: var(--ease-popover-offset) 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host([placement="right-center"]) [part="content"] {
|
|
114
|
+
position-area: right center;
|
|
115
|
+
top: anchor(top);
|
|
116
|
+
left: anchor(right);
|
|
117
|
+
translate: var(--ease-popover-offset) 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:host([placement="right-end"]) [part="content"] {
|
|
121
|
+
position-area: right start;
|
|
122
|
+
top: anchor(top);
|
|
123
|
+
left: anchor(right);
|
|
124
|
+
translate: var(--ease-popover-offset) 0;
|
|
125
|
+
}
|
|
126
|
+
`
|
|
127
|
+
})
|
|
128
|
+
export class Popover extends HTMLElement {
|
|
129
|
+
#anchorName = nextAnchorName();
|
|
130
|
+
#contentElement = null;
|
|
131
|
+
#initialized = false;
|
|
132
|
+
get contentElement() {
|
|
133
|
+
return this.#contentElement;
|
|
134
|
+
}
|
|
135
|
+
@Prop({
|
|
136
|
+
reflect: true,
|
|
137
|
+
defaultValue: 'bottom-start',
|
|
138
|
+
onChange() {
|
|
139
|
+
this.handlePlacementChange();
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
accessor placement;
|
|
143
|
+
@Prop({
|
|
144
|
+
type: Number,
|
|
145
|
+
reflect: true,
|
|
146
|
+
defaultValue: 8,
|
|
147
|
+
onChange() {
|
|
148
|
+
this.handleOffsetChange();
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
accessor offset = 8;
|
|
152
|
+
@Prop({ type: Boolean, reflect: true })
|
|
153
|
+
accessor open = false;
|
|
154
|
+
connectedCallback() {
|
|
155
|
+
this.#syncAnchorName();
|
|
156
|
+
this.#syncOffset();
|
|
157
|
+
}
|
|
158
|
+
disconnectedCallback() {
|
|
159
|
+
this.#contentElement = null;
|
|
160
|
+
this.#initialized = false;
|
|
161
|
+
}
|
|
162
|
+
render() {
|
|
163
|
+
return html `
|
|
164
|
+
<slot slot="trigger" name="trigger"></slot>
|
|
165
|
+
<div
|
|
166
|
+
part="content"
|
|
167
|
+
data-popover-content
|
|
168
|
+
role="region"
|
|
169
|
+
data-placement=${this.placement}
|
|
170
|
+
>
|
|
171
|
+
<slot></slot>
|
|
172
|
+
</div>
|
|
173
|
+
`;
|
|
174
|
+
}
|
|
175
|
+
handlePlacementChange() {
|
|
176
|
+
if (!this.#initialized) {
|
|
177
|
+
this.requestRender();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.#syncPlacement();
|
|
181
|
+
}
|
|
182
|
+
handleOffsetChange() {
|
|
183
|
+
if (!this.#initialized) {
|
|
184
|
+
this.requestRender();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.#syncOffset();
|
|
188
|
+
}
|
|
189
|
+
#syncPlacement() {
|
|
190
|
+
this.dataset.placement = this.placement;
|
|
191
|
+
if (this.#contentElement) {
|
|
192
|
+
this.#contentElement.dataset.placement = this.placement;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
#syncOffset() {
|
|
196
|
+
const offset = Number.isFinite(this.offset) ? this.offset : 0;
|
|
197
|
+
this.style.setProperty('--ease-popover-offset', `${offset}px`);
|
|
198
|
+
}
|
|
199
|
+
#syncAnchorName() {
|
|
200
|
+
this.style.setProperty('--ease-popover-anchor-name', this.#anchorName);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export default {
|
|
204
|
+
Popover
|
|
205
|
+
};
|