@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,490 @@
|
|
|
1
|
+
export const canvasStyles = `
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
max-width: 500px;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
svg {
|
|
10
|
+
width: 300px;
|
|
11
|
+
height: auto;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
touch-action: none;
|
|
14
|
+
user-select: none;
|
|
15
|
+
overflow: visible;
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.grid-line {
|
|
20
|
+
stroke: var(--color-white-4);
|
|
21
|
+
stroke-width: .75;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.curve-path {
|
|
25
|
+
stroke: var(--color-blue-100);
|
|
26
|
+
stroke-width: 2.5;
|
|
27
|
+
fill: none;
|
|
28
|
+
stroke-linecap: round;
|
|
29
|
+
stroke-linejoin: round;
|
|
30
|
+
transition: stroke-width 150ms ease;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.curve-path--preview {
|
|
34
|
+
stroke: var(--color-blue-800);
|
|
35
|
+
stroke-width: 2.5;
|
|
36
|
+
stroke-dasharray: 5, 5;
|
|
37
|
+
opacity: 0;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
animation: previewPathFade 180ms ease forwards;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.control-point {
|
|
43
|
+
fill: var(--color-blue-700);
|
|
44
|
+
stroke: var(--color-blue-900);
|
|
45
|
+
stroke-width: 1.5;
|
|
46
|
+
cursor: grab;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.control-point:active {
|
|
50
|
+
cursor: grabbing;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.control-point.selected {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.anchor-point-start {
|
|
57
|
+
fill: var(--color-blue-100);
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
r: 5px;
|
|
60
|
+
transition: r .2s;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.anchor-point {
|
|
64
|
+
fill: var(--color-blue-900);
|
|
65
|
+
stroke: var(--color-blue-900);
|
|
66
|
+
stroke-width: 1;
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
r: 5px;
|
|
69
|
+
transition: r .2s;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.anchor-point:hover {
|
|
73
|
+
r: 5.5px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.control-line {
|
|
77
|
+
stroke: var(--color-blue-800);
|
|
78
|
+
stroke-width: 3;
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.linear-point {
|
|
84
|
+
fill: var(--color-blue-100);
|
|
85
|
+
cursor: grab;
|
|
86
|
+
r: 3px;
|
|
87
|
+
transition: r .2s;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.hit-area-point:hover + .linear-point,
|
|
91
|
+
.linear-point:hover,
|
|
92
|
+
.linear-point:active,
|
|
93
|
+
.linear-point.selected {
|
|
94
|
+
r: 5px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.linear-point.selected {
|
|
98
|
+
fill: var(--color-blue-300);
|
|
99
|
+
stroke-width: 1.5;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.linear-handle-line {
|
|
103
|
+
stroke: var(--color-blue-800);
|
|
104
|
+
stroke-width: 3;
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
transition: opacity 150ms ease;
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.linear-handle {
|
|
111
|
+
fill: var(--color-blue-700);
|
|
112
|
+
stroke: var(--color-blue-900);
|
|
113
|
+
stroke-width: 1;
|
|
114
|
+
cursor: grab;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.linear-handle.selected {
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.linear-handle:active {
|
|
121
|
+
cursor: grabbing;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.hit-area-point,
|
|
125
|
+
.hit-area-handle {
|
|
126
|
+
fill: transparent;
|
|
127
|
+
stroke: transparent;
|
|
128
|
+
pointer-events: all;
|
|
129
|
+
cursor: inherit;
|
|
130
|
+
r: 10px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@keyframes pulse {
|
|
134
|
+
0% {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
}
|
|
137
|
+
50% {
|
|
138
|
+
opacity: 0.6;
|
|
139
|
+
}
|
|
140
|
+
100% {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.curve-path.animating {
|
|
146
|
+
animation: pulse 1s ease-in-out infinite;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@keyframes previewPathFade {
|
|
150
|
+
from {
|
|
151
|
+
opacity: 0;
|
|
152
|
+
}
|
|
153
|
+
to {
|
|
154
|
+
opacity: 0.6;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@keyframes previewElementFade {
|
|
159
|
+
from {
|
|
160
|
+
opacity: 0;
|
|
161
|
+
}
|
|
162
|
+
to {
|
|
163
|
+
opacity: 0.85;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.linear-preview-group {
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.linear-point--preview,
|
|
172
|
+
.linear-handle--preview,
|
|
173
|
+
.linear-handle-line--preview {
|
|
174
|
+
animation: previewElementFade 180ms ease forwards;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.linear-point--preview {
|
|
178
|
+
fill: var(--color-blue-100);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.linear-handle--preview {
|
|
182
|
+
fill: var(--color-blue-700);
|
|
183
|
+
stroke: var(--color-blue-900);
|
|
184
|
+
stroke-width: 1.5;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.linear-handle-line--preview {
|
|
188
|
+
stroke: var(--color-blue-800);
|
|
189
|
+
stroke-width: 2.5;
|
|
190
|
+
stroke-dasharray: 4 4;
|
|
191
|
+
display: none;
|
|
192
|
+
}
|
|
193
|
+
`;
|
|
194
|
+
export const controlsStyles = `
|
|
195
|
+
:host {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-wrap: wrap;
|
|
198
|
+
align-items: center;
|
|
199
|
+
gap: 0.75rem;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
[part="radio-group"] {
|
|
203
|
+
width: 100%;
|
|
204
|
+
box-sizing: border-box;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
[part="easing-type-dropdown"] {
|
|
208
|
+
--ease-dropdown-max-height: 212px;
|
|
209
|
+
}
|
|
210
|
+
`;
|
|
211
|
+
export const outputStyles = `
|
|
212
|
+
:host {
|
|
213
|
+
display: block;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.output-container {
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
gap: 1rem;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.output-group {
|
|
223
|
+
position: relative;
|
|
224
|
+
display: block;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.output-label {
|
|
228
|
+
font-size: 0.875rem;
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
color: var(--color-gray-1000);
|
|
231
|
+
margin: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.output-code {
|
|
235
|
+
font-family: var(--ease-font-mono, 'Geist Mono', monospace);
|
|
236
|
+
font-size: 0.8125rem;
|
|
237
|
+
line-height: 1.6;
|
|
238
|
+
padding: 1rem;
|
|
239
|
+
background: var(--color-gray-1000);
|
|
240
|
+
color: var(--color-gray-700);
|
|
241
|
+
border-radius: 0.375rem;
|
|
242
|
+
border: 1px solid #334155;
|
|
243
|
+
white-space: pre-wrap;
|
|
244
|
+
word-break: break-word;
|
|
245
|
+
overflow-x: auto;
|
|
246
|
+
max-width: 100%;
|
|
247
|
+
tab-size: 2;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.copy-button {
|
|
251
|
+
align-self: flex-start;
|
|
252
|
+
padding: 0.425rem 0.875rem;
|
|
253
|
+
border: 1px solid var(--color-white-6);
|
|
254
|
+
border-radius: 0.375rem;
|
|
255
|
+
background: white;
|
|
256
|
+
color: var(--color-gray-1000);
|
|
257
|
+
font-size: 0.875rem;
|
|
258
|
+
font-weight: 500;
|
|
259
|
+
cursor: pointer;
|
|
260
|
+
transition: all 150ms ease;
|
|
261
|
+
user-select: none;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.copy-button:hover {
|
|
265
|
+
background: var(--color-gray-1000);
|
|
266
|
+
border-color: #9ca3af;
|
|
267
|
+
transform: translateY(-1px);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.copy-button:active {
|
|
271
|
+
transform: translateY(0);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.copy-button:focus-visible {
|
|
275
|
+
outline: 2px solid var(--color-blue-700);
|
|
276
|
+
outline-offset: 2px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.copy-button.copied {
|
|
280
|
+
background: var(--color-blue-100);
|
|
281
|
+
border-color: var(--color-blue-100);
|
|
282
|
+
color: white;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.preview-container {
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: column;
|
|
288
|
+
gap: 0.75rem;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.preview-box {
|
|
292
|
+
width: 100%;
|
|
293
|
+
max-width: 300px;
|
|
294
|
+
height: 80px;
|
|
295
|
+
background: linear-gradient(135deg, var(--color-blue-700) 0%, var(--color-blue-100) 100%);
|
|
296
|
+
border-radius: 0.5rem;
|
|
297
|
+
position: relative;
|
|
298
|
+
overflow: hidden;
|
|
299
|
+
cursor: pointer;
|
|
300
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
301
|
+
transition: box-shadow 150ms ease;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.preview-box:hover {
|
|
305
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.preview-animation {
|
|
309
|
+
width: 24px;
|
|
310
|
+
height: 24px;
|
|
311
|
+
background: white;
|
|
312
|
+
border-radius: 50%;
|
|
313
|
+
position: absolute;
|
|
314
|
+
top: 50%;
|
|
315
|
+
left: 12px;
|
|
316
|
+
transform: translateY(-50%);
|
|
317
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
318
|
+
transition-property: transform;
|
|
319
|
+
transition-duration: 2s;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.preview-animation.animate {
|
|
323
|
+
transform: translateY(-50%) translateX(calc(100% - 48px));
|
|
324
|
+
}
|
|
325
|
+
`;
|
|
326
|
+
export const containerStyles = `
|
|
327
|
+
:host {
|
|
328
|
+
display: block;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.curve-container {
|
|
332
|
+
display: flex;
|
|
333
|
+
flex-direction: column;
|
|
334
|
+
position: relative;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.curve-header {
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.curve-canvas-wrapper {
|
|
341
|
+
position: relative;
|
|
342
|
+
margin-top: 16px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.curve-canvas {
|
|
346
|
+
background-color: var(--color-white-2);
|
|
347
|
+
box-shadow: 0 0 32px 0 var(--color-white-2) inset;
|
|
348
|
+
border-radius: 7px;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.curve-toolbar {
|
|
352
|
+
margin-top: 8px;
|
|
353
|
+
}
|
|
354
|
+
`;
|
|
355
|
+
export const canvasControlsStyles = `
|
|
356
|
+
:host {
|
|
357
|
+
position: absolute;
|
|
358
|
+
top: 8px;
|
|
359
|
+
left: 8px;
|
|
360
|
+
z-index: 10;
|
|
361
|
+
display: flex;
|
|
362
|
+
flex-direction: column;
|
|
363
|
+
gap: 4px;
|
|
364
|
+
pointer-events: none;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
:host([hidden]) {
|
|
368
|
+
display: none;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.overlay-controls {
|
|
372
|
+
display: flex;
|
|
373
|
+
flex-wrap: wrap;
|
|
374
|
+
gap: 4px;
|
|
375
|
+
pointer-events: auto;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.overlay-button {
|
|
379
|
+
--ease-icon-size: 16px;
|
|
380
|
+
display: flex;
|
|
381
|
+
align-items: center;
|
|
382
|
+
justify-content: center;
|
|
383
|
+
padding: 4px;
|
|
384
|
+
color: var(--color-gray-600);
|
|
385
|
+
border-radius: var(--radii-md);
|
|
386
|
+
background-color: var(--color-gray-875);
|
|
387
|
+
box-shadow: inset 0 1px .25px 0 var(--color-white-4), 0 1px 2.5px 0 var(--color-black-8);
|
|
388
|
+
cursor: pointer;
|
|
389
|
+
transition: color 0.2s;
|
|
390
|
+
appearance: none;
|
|
391
|
+
border: none;
|
|
392
|
+
outline: none;
|
|
393
|
+
margin: 0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.overlay-button:hover {
|
|
397
|
+
color: var(--color-gray-300);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.overlay-button:disabled {
|
|
401
|
+
color: var(--color-gray-700);
|
|
402
|
+
cursor: not-allowed;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.overlay-button.inactive {
|
|
406
|
+
color: var(--color-blue-100);
|
|
407
|
+
}
|
|
408
|
+
`;
|
|
409
|
+
export const toolbarStyles = `
|
|
410
|
+
:host {
|
|
411
|
+
display: block;
|
|
412
|
+
width: 100%;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.toolbar-container {
|
|
416
|
+
width: 100%;
|
|
417
|
+
display: grid;
|
|
418
|
+
gap: 8px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.toolbar-group {
|
|
422
|
+
width: 100%;
|
|
423
|
+
display: flex;
|
|
424
|
+
gap: 8px;
|
|
425
|
+
box-sizing: border-box;
|
|
426
|
+
align-items: center;
|
|
427
|
+
padding: 6px;
|
|
428
|
+
border-radius: var(--radii-md);
|
|
429
|
+
background-color: var(--color-gray-875);
|
|
430
|
+
box-shadow: inset 0 1px .25px 0 var(--color-white-4), 0 1px 2.5px 0 var(--color-black-8);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.toolbar-button {
|
|
434
|
+
--ease-icon-size: 16px;
|
|
435
|
+
|
|
436
|
+
display: flex;
|
|
437
|
+
align-items: center;
|
|
438
|
+
justify-content: space-between;
|
|
439
|
+
padding: 4px;
|
|
440
|
+
color: var(--color-gray-600);
|
|
441
|
+
background-color: transparent;
|
|
442
|
+
border: none;
|
|
443
|
+
outline: none;
|
|
444
|
+
margin: 0;
|
|
445
|
+
appearance: none;
|
|
446
|
+
cursor: pointer;
|
|
447
|
+
transition: color 0.2s;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.toolbar-button:hover {
|
|
451
|
+
color: var(--color-blue-100);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.toolbar-button:disabled {
|
|
455
|
+
color: var(--color-gray-700);
|
|
456
|
+
cursor: not-allowed;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.grid-size-controls {
|
|
460
|
+
display: grid;
|
|
461
|
+
grid-template-columns: 24px auto 24px;
|
|
462
|
+
align-items: center;
|
|
463
|
+
justify-content: center;
|
|
464
|
+
margin-left: auto;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.grid-size-controls ease-button {
|
|
468
|
+
--ease-icon-size: 14px;
|
|
469
|
+
width: 24px;
|
|
470
|
+
height: 24px;
|
|
471
|
+
box-sizing: border-box;
|
|
472
|
+
display: flex;
|
|
473
|
+
padding: 0;
|
|
474
|
+
align-items: center;
|
|
475
|
+
justify-content: center;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.grid-size-value {
|
|
479
|
+
display: flex;
|
|
480
|
+
width: 20px;
|
|
481
|
+
justify-content: center;
|
|
482
|
+
align-items: center;
|
|
483
|
+
font-feature-settings: 'tnum' on;
|
|
484
|
+
font-variant-numeric: tabular-nums;
|
|
485
|
+
font-size: 11px;
|
|
486
|
+
font-weight: 500;
|
|
487
|
+
line-height: 14px;
|
|
488
|
+
text-align: center;
|
|
489
|
+
}
|
|
490
|
+
`;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clientToSvgCoords = exports.getSvgBounds = exports.fromSvgCoords = exports.toSvgCoords = exports.renderLinearPoint = exports.renderBezierControlPoint = exports.generateGridLines = void 0;
|
|
4
|
+
const lit_html_1 = require("lit-html");
|
|
5
|
+
const constants_1 = require("./constants.cjs");
|
|
6
|
+
const generateGridLines = (gridStep) => {
|
|
7
|
+
const lines = [];
|
|
8
|
+
const xSteps = Math.ceil(constants_1.SVG_WIDTH / gridStep);
|
|
9
|
+
const ySteps = Math.ceil(constants_1.SVG_HEIGHT / gridStep);
|
|
10
|
+
for (let i = 0; i <= xSteps; i++) {
|
|
11
|
+
const x = i * gridStep;
|
|
12
|
+
if (x > constants_1.SVG_WIDTH) {
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
lines.push((0, lit_html_1.svg) `
|
|
16
|
+
<line
|
|
17
|
+
class="grid-line"
|
|
18
|
+
x1=${x}
|
|
19
|
+
y1="0"
|
|
20
|
+
x2=${x}
|
|
21
|
+
y2=${constants_1.SVG_HEIGHT}
|
|
22
|
+
/>
|
|
23
|
+
`);
|
|
24
|
+
}
|
|
25
|
+
for (let i = 0; i <= ySteps; i++) {
|
|
26
|
+
const y = i * gridStep;
|
|
27
|
+
if (y > constants_1.SVG_HEIGHT) {
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
lines.push((0, lit_html_1.svg) `
|
|
31
|
+
<line
|
|
32
|
+
class="grid-line"
|
|
33
|
+
x1="0"
|
|
34
|
+
y1=${y}
|
|
35
|
+
x2=${constants_1.SVG_WIDTH}
|
|
36
|
+
y2=${y}
|
|
37
|
+
/>
|
|
38
|
+
`);
|
|
39
|
+
}
|
|
40
|
+
return lines;
|
|
41
|
+
};
|
|
42
|
+
exports.generateGridLines = generateGridLines;
|
|
43
|
+
const renderBezierControlPoint = (point, anchor, isSelected, onPointerDown) => {
|
|
44
|
+
const x = point.x * constants_1.SVG_WIDTH;
|
|
45
|
+
const y = (1 - point.y) * constants_1.SVG_HEIGHT;
|
|
46
|
+
const anchorX = anchor.x * constants_1.SVG_WIDTH;
|
|
47
|
+
const anchorY = (1 - anchor.y) * constants_1.SVG_HEIGHT;
|
|
48
|
+
return (0, lit_html_1.svg) `
|
|
49
|
+
<g>
|
|
50
|
+
<line
|
|
51
|
+
class="control-line"
|
|
52
|
+
x1=${anchorX}
|
|
53
|
+
y1=${anchorY}
|
|
54
|
+
x2=${x}
|
|
55
|
+
y2=${y}
|
|
56
|
+
/>
|
|
57
|
+
<circle
|
|
58
|
+
class="control-point ${isSelected ? 'selected' : ''}"
|
|
59
|
+
cx=${x}
|
|
60
|
+
cy=${y}
|
|
61
|
+
r=${constants_1.POINT_RADIUS}
|
|
62
|
+
@pointerdown=${onPointerDown}
|
|
63
|
+
/>
|
|
64
|
+
<circle
|
|
65
|
+
class="hit-area-point"
|
|
66
|
+
cx=${x}
|
|
67
|
+
cy=${y}
|
|
68
|
+
r=${constants_1.HIT_AREA_RADIUS}
|
|
69
|
+
@pointerdown=${onPointerDown}
|
|
70
|
+
/>
|
|
71
|
+
</g>
|
|
72
|
+
`;
|
|
73
|
+
};
|
|
74
|
+
exports.renderBezierControlPoint = renderBezierControlPoint;
|
|
75
|
+
const renderLinearPoint = (point, index, isSelected, isFocused, onPointerDown, onHandlePointerDown) => {
|
|
76
|
+
const x = point.x * constants_1.SVG_WIDTH;
|
|
77
|
+
const y = (1 - point.y) * constants_1.SVG_HEIGHT;
|
|
78
|
+
const handles = [];
|
|
79
|
+
if (point.cpInX !== undefined && point.cpInY !== undefined) {
|
|
80
|
+
const handleX = x + point.cpInX * constants_1.SVG_WIDTH;
|
|
81
|
+
const handleY = y - point.cpInY * constants_1.SVG_HEIGHT;
|
|
82
|
+
handles.push((0, lit_html_1.svg) `
|
|
83
|
+
<g>
|
|
84
|
+
<line
|
|
85
|
+
class="linear-handle-line"
|
|
86
|
+
x1=${x}
|
|
87
|
+
y1=${y}
|
|
88
|
+
x2=${handleX}
|
|
89
|
+
y2=${handleY}
|
|
90
|
+
/>
|
|
91
|
+
<circle
|
|
92
|
+
class="linear-handle ${isSelected ? 'selected' : ''}"
|
|
93
|
+
cx=${handleX}
|
|
94
|
+
cy=${handleY}
|
|
95
|
+
r=${constants_1.HANDLE_RADIUS}
|
|
96
|
+
@pointerdown=${(e) => onHandlePointerDown?.(e, 'in')}
|
|
97
|
+
/>
|
|
98
|
+
<circle
|
|
99
|
+
class="hit-area-handle"
|
|
100
|
+
cx=${handleX}
|
|
101
|
+
cy=${handleY}
|
|
102
|
+
r=${constants_1.HIT_AREA_RADIUS}
|
|
103
|
+
@pointerdown=${(e) => onHandlePointerDown?.(e, 'in')}
|
|
104
|
+
/>
|
|
105
|
+
</g>
|
|
106
|
+
`);
|
|
107
|
+
}
|
|
108
|
+
if (point.cpOutX !== undefined && point.cpOutY !== undefined) {
|
|
109
|
+
const handleX = x + point.cpOutX * constants_1.SVG_WIDTH;
|
|
110
|
+
const handleY = y - point.cpOutY * constants_1.SVG_HEIGHT;
|
|
111
|
+
handles.push((0, lit_html_1.svg) `
|
|
112
|
+
<g>
|
|
113
|
+
<line
|
|
114
|
+
class="linear-handle-line"
|
|
115
|
+
x1=${x}
|
|
116
|
+
y1=${y}
|
|
117
|
+
x2=${handleX}
|
|
118
|
+
y2=${handleY}
|
|
119
|
+
/>
|
|
120
|
+
<circle
|
|
121
|
+
class="linear-handle ${isSelected ? 'selected' : ''}"
|
|
122
|
+
cx=${handleX}
|
|
123
|
+
cy=${handleY}
|
|
124
|
+
r=${constants_1.HANDLE_RADIUS}
|
|
125
|
+
@pointerdown=${(e) => onHandlePointerDown?.(e, 'out')}
|
|
126
|
+
/>
|
|
127
|
+
<circle
|
|
128
|
+
class="hit-area-handle"
|
|
129
|
+
cx=${handleX}
|
|
130
|
+
cy=${handleY}
|
|
131
|
+
r=${constants_1.HIT_AREA_RADIUS}
|
|
132
|
+
@pointerdown=${(e) => onHandlePointerDown?.(e, 'out')}
|
|
133
|
+
/>
|
|
134
|
+
</g>
|
|
135
|
+
`);
|
|
136
|
+
}
|
|
137
|
+
return (0, lit_html_1.svg) `
|
|
138
|
+
<g>
|
|
139
|
+
${handles}
|
|
140
|
+
<circle
|
|
141
|
+
class="linear-point ${isSelected ? 'selected' : ''} ${isFocused ? 'focused' : ''}"
|
|
142
|
+
cx=${x}
|
|
143
|
+
cy=${y}
|
|
144
|
+
r=${constants_1.POINT_RADIUS}
|
|
145
|
+
tabindex=${isFocused ? '0' : '-1'}
|
|
146
|
+
role="slider"
|
|
147
|
+
aria-label="Linear point ${index + 1}"
|
|
148
|
+
aria-valuenow=${point.x}
|
|
149
|
+
aria-valuemin="0"
|
|
150
|
+
aria-valuemax="1"
|
|
151
|
+
@pointerdown=${onPointerDown}
|
|
152
|
+
/>
|
|
153
|
+
<circle
|
|
154
|
+
class="hit-area-point"
|
|
155
|
+
cx=${x}
|
|
156
|
+
cy=${y}
|
|
157
|
+
r=${constants_1.HIT_AREA_RADIUS}
|
|
158
|
+
@pointerdown=${onPointerDown}
|
|
159
|
+
/>
|
|
160
|
+
</g>
|
|
161
|
+
`;
|
|
162
|
+
};
|
|
163
|
+
exports.renderLinearPoint = renderLinearPoint;
|
|
164
|
+
const toSvgCoords = (point) => {
|
|
165
|
+
return {
|
|
166
|
+
x: point.x * constants_1.SVG_WIDTH,
|
|
167
|
+
y: (1 - point.y) * constants_1.SVG_HEIGHT
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
exports.toSvgCoords = toSvgCoords;
|
|
171
|
+
const fromSvgCoords = (x, y) => {
|
|
172
|
+
return {
|
|
173
|
+
x: x / constants_1.SVG_WIDTH,
|
|
174
|
+
y: 1 - y / constants_1.SVG_HEIGHT
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
exports.fromSvgCoords = fromSvgCoords;
|
|
178
|
+
const getSvgBounds = (svg) => svg.getBoundingClientRect();
|
|
179
|
+
exports.getSvgBounds = getSvgBounds;
|
|
180
|
+
const clientToSvgCoords = (clientX, clientY, svgBounds) => {
|
|
181
|
+
const x = ((clientX - svgBounds.left) / svgBounds.width) * constants_1.SVG_WIDTH;
|
|
182
|
+
const y = ((clientY - svgBounds.top) / svgBounds.height) * constants_1.SVG_HEIGHT;
|
|
183
|
+
return { x, y };
|
|
184
|
+
};
|
|
185
|
+
exports.clientToSvgCoords = clientToSvgCoords;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinearPoint, Point } from "./types.cjs";
|
|
2
|
+
import { type SVGTemplateResult } from 'lit-html';
|
|
3
|
+
export declare const generateGridLines: (gridStep: number) => SVGTemplateResult[];
|
|
4
|
+
export declare const renderBezierControlPoint: (point: Point, anchor: Point, isSelected: boolean, onPointerDown: (event: PointerEvent) => void) => SVGTemplateResult;
|
|
5
|
+
export declare const renderLinearPoint: (point: LinearPoint, index: number, isSelected: boolean, isFocused: boolean, onPointerDown: (event: PointerEvent) => void, onHandlePointerDown?: (event: PointerEvent, handleType: "in" | "out") => void) => SVGTemplateResult;
|
|
6
|
+
export declare const toSvgCoords: (point: Point) => Point;
|
|
7
|
+
export declare const fromSvgCoords: (x: number, y: number) => Point;
|
|
8
|
+
export declare const getSvgBounds: (svg: SVGSVGElement) => DOMRect;
|
|
9
|
+
export declare const clientToSvgCoords: (clientX: number, clientY: number, svgBounds: DOMRect) => Point;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinearPoint, Point } from "./types.js";
|
|
2
|
+
import { type SVGTemplateResult } from 'lit-html';
|
|
3
|
+
export declare const generateGridLines: (gridStep: number) => SVGTemplateResult[];
|
|
4
|
+
export declare const renderBezierControlPoint: (point: Point, anchor: Point, isSelected: boolean, onPointerDown: (event: PointerEvent) => void) => SVGTemplateResult;
|
|
5
|
+
export declare const renderLinearPoint: (point: LinearPoint, index: number, isSelected: boolean, isFocused: boolean, onPointerDown: (event: PointerEvent) => void, onHandlePointerDown?: (event: PointerEvent, handleType: "in" | "out") => void) => SVGTemplateResult;
|
|
6
|
+
export declare const toSvgCoords: (point: Point) => Point;
|
|
7
|
+
export declare const fromSvgCoords: (x: number, y: number) => Point;
|
|
8
|
+
export declare const getSvgBounds: (svg: SVGSVGElement) => DOMRect;
|
|
9
|
+
export declare const clientToSvgCoords: (clientX: number, clientY: number, svgBounds: DOMRect) => Point;
|