igniteui-webcomponents 7.3.0 → 7.3.1
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/CHANGELOG.md +41 -0
- package/README.md +30 -0
- package/components/avatar/avatar.d.ts +1 -2
- package/components/avatar/avatar.js +4 -8
- package/components/avatar/avatar.js.map +1 -1
- package/components/badge/badge.d.ts +6 -1
- package/components/badge/badge.js +8 -5
- package/components/badge/badge.js.map +1 -1
- package/components/badge/themes/badge.base.css.js +1 -1
- package/components/badge/themes/badge.base.css.js.map +1 -1
- package/components/chip/chip.d.ts +30 -14
- package/components/chip/chip.js +54 -48
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/dark/chip.material.css.js +1 -1
- package/components/chip/themes/dark/chip.material.css.js.map +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/light/chip.fluent.css.js +1 -1
- package/components/chip/themes/light/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/light/chip.indigo.css.js +1 -1
- package/components/chip/themes/light/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/light/chip.material.css.js +1 -1
- package/components/chip/themes/light/chip.material.css.js.map +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/shared/chip.common.css.js +1 -1
- package/components/chip/themes/shared/chip.common.css.js.map +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js.map +1 -1
- package/components/color-picker/color-picker.d.ts +2 -2
- package/components/color-picker/color-picker.js.map +1 -1
- package/components/color-picker/picker-canvas.js +2 -1
- package/components/color-picker/picker-canvas.js.map +1 -1
- package/components/textarea/textarea.d.ts +2 -15
- package/components/textarea/textarea.js +48 -93
- package/components/textarea/textarea.js.map +1 -1
- package/components/tile-manager/position.d.ts +2 -9
- package/components/tile-manager/position.js +27 -42
- package/components/tile-manager/position.js.map +1 -1
- package/components/tile-manager/resize-state.d.ts +11 -22
- package/components/tile-manager/resize-state.js +60 -119
- package/components/tile-manager/resize-state.js.map +1 -1
- package/components/tile-manager/resize-util.d.ts +3 -7
- package/components/tile-manager/resize-util.js +65 -72
- package/components/tile-manager/resize-util.js.map +1 -1
- package/components/tile-manager/serializer.d.ts +1 -1
- package/components/tile-manager/serializer.js +9 -10
- package/components/tile-manager/serializer.js.map +1 -1
- package/components/tile-manager/themes/shared/tile/tile.common.css.js +1 -1
- package/components/tile-manager/themes/shared/tile/tile.common.css.js.map +1 -1
- package/components/tile-manager/themes/tile.base.css.js +1 -1
- package/components/tile-manager/themes/tile.base.css.js.map +1 -1
- package/components/tile-manager/tile-ghost-util.js +16 -20
- package/components/tile-manager/tile-ghost-util.js.map +1 -1
- package/components/tile-manager/tile-manager.d.ts +5 -2
- package/components/tile-manager/tile-manager.js +27 -23
- package/components/tile-manager/tile-manager.js.map +1 -1
- package/components/tile-manager/tile.d.ts +32 -18
- package/components/tile-manager/tile.js +181 -161
- package/components/tile-manager/tile.js.map +1 -1
- package/components/tile-manager/types.d.ts +1 -5
- package/components/tile-manager/types.js.map +1 -1
- package/custom-elements.json +498 -853
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +1 -0
- package/index.js.map +1 -1
- package/internals/directives/drag.d.ts +144 -0
- package/internals/directives/drag.js +278 -0
- package/internals/directives/drag.js.map +1 -0
- package/internals/directives/resize.d.ts +109 -0
- package/internals/directives/resize.js +214 -0
- package/internals/directives/resize.js.map +1 -0
- package/internals/templates/input-shell.d.ts +12 -1
- package/internals/templates/input-shell.js +17 -10
- package/internals/templates/input-shell.js.map +1 -1
- package/internals/utils/dom.d.ts +2 -0
- package/internals/utils/dom.js +3 -0
- package/internals/utils/dom.js.map +1 -1
- package/internals/utils/events.d.ts +2 -0
- package/internals/utils/events.js +3 -0
- package/internals/utils/events.js.map +1 -1
- package/package.json +1 -1
- package/skills/README.md +1 -0
- package/web-types.json +2 -2
- package/components/resize-container/default-ghost.d.ts +0 -5
- package/components/resize-container/default-ghost.js +0 -20
- package/components/resize-container/default-ghost.js.map +0 -1
- package/components/resize-container/resize-container.d.ts +0 -60
- package/components/resize-container/resize-container.js +0 -156
- package/components/resize-container/resize-container.js.map +0 -1
- package/components/resize-container/resize-controller.d.ts +0 -46
- package/components/resize-container/resize-controller.js +0 -195
- package/components/resize-container/resize-controller.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.material.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.material.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.material.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.shared.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.shared.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.shared.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.fluent.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.fluent.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.fluent.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.indigo.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.indigo.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.indigo.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.material.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.material.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.material.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.shared.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.shared.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.shared.css.js.map +0 -1
- package/components/resize-container/themes/resize-container.base.css.d.ts +0 -1
- package/components/resize-container/themes/resize-container.base.css.js +0 -3
- package/components/resize-container/themes/resize-container.base.css.js.map +0 -1
- package/components/resize-container/themes/shared/resize-container.common.css.d.ts +0 -1
- package/components/resize-container/themes/shared/resize-container.common.css.js +0 -3
- package/components/resize-container/themes/shared/resize-container.common.css.js.map +0 -1
- package/components/resize-container/themes/themes.d.ts +0 -2
- package/components/resize-container/themes/themes.js +0 -47
- package/components/resize-container/themes/themes.js.map +0 -1
- package/components/resize-container/types.d.ts +0 -40
- package/components/resize-container/types.js +0 -2
- package/components/resize-container/types.js.map +0 -1
- package/internals/controllers/drag.d.ts +0 -166
- package/internals/controllers/drag.js +0 -283
- package/internals/controllers/drag.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resize-indicator.indigo.css.js","sourceRoot":"","sources":["../../../../../src/components/resize-container/themes/light/resize-indicator.indigo.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,qDAAqD,CAAC","sourcesContent":["\n import { css } from 'lit';\n export const styles = css`:host{--ig-theme: indigo;--ig-theme-variant: light}`;\n "]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import("lit").CSSResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resize-indicator.material.css.js","sourceRoot":"","sources":["../../../../../src/components/resize-container/themes/light/resize-indicator.material.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,uDAAuD,CAAC","sourcesContent":["\n import { css } from 'lit';\n export const styles = css`:host{--ig-theme: material;--ig-theme-variant: light}`;\n "]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import("lit").CSSResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resize-indicator.shared.css.js","sourceRoot":"","sources":["../../../../../src/components/resize-container/themes/light/resize-indicator.shared.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,yHAAyH,CAAC","sourcesContent":["\n import { css } from 'lit';\n export const styles = css`:host{--resize-indicator: var(--ig-resize-indicator-resize-indicator, var(--ig-primary-500));--ig-theme-variant: light}`;\n "]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import("lit").CSSResult;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
export const styles = css `:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);position:relative;box-sizing:border-box;scrollbar-width:var(--ig-scrollbar-size, var(--sb-size));scrollbar-color:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color)) var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar{width:var(--ig-scrollbar-size, var(--sb-size));height:var(--ig-scrollbar-size, var(--sb-size));background:var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar-thumb{background:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color))}:host *,:host *::before,:host *::after{box-sizing:border-box}:host([hidden]),[hidden]{display:none !important}[part=trigger-side],[part=trigger],[part=trigger-bottom]{--_size: 0.6875rem;display:inline-flex;visibility:var(--resize-visibility);position:absolute;z-index:1}:host{display:contents}[part~=resize-base]{position:relative;height:100%}[part=trigger-side]{top:calc(50% - var(--_size));right:calc(var(--_size)/2*-1);cursor:e-resize}[part=trigger]{bottom:calc(var(--_size)/2*-1);right:calc(var(--_size)/2*-1);cursor:se-resize}[part=trigger-bottom]{left:calc(50% - var(--_size));bottom:calc(var(--_size)/2*-1);cursor:s-resize}[part=trigger]:focus{outline:none}`;
|
|
3
|
-
//# sourceMappingURL=resize-container.base.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resize-container.base.css.js","sourceRoot":"","sources":["../../../../src/components/resize-container/themes/resize-container.base.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,o/CAAo/C,CAAC","sourcesContent":["\n import { css } from 'lit';\n export const styles = css`:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);position:relative;box-sizing:border-box;scrollbar-width:var(--ig-scrollbar-size, var(--sb-size));scrollbar-color:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color)) var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar{width:var(--ig-scrollbar-size, var(--sb-size));height:var(--ig-scrollbar-size, var(--sb-size));background:var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar-thumb{background:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color))}:host *,:host *::before,:host *::after{box-sizing:border-box}:host([hidden]),[hidden]{display:none !important}[part=trigger-side],[part=trigger],[part=trigger-bottom]{--_size: 0.6875rem;display:inline-flex;visibility:var(--resize-visibility);position:absolute;z-index:1}:host{display:contents}[part~=resize-base]{position:relative;height:100%}[part=trigger-side]{top:calc(50% - var(--_size));right:calc(var(--_size)/2*-1);cursor:e-resize}[part=trigger]{bottom:calc(var(--_size)/2*-1);right:calc(var(--_size)/2*-1);cursor:se-resize}[part=trigger-bottom]{left:calc(50% - var(--_size));bottom:calc(var(--_size)/2*-1);cursor:s-resize}[part=trigger]:focus{outline:none}`;\n "]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import("lit").CSSResult;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
export const styles = css `[part~=active]::after{content:"";position:absolute;pointer-events:none;inset:0;width:100%;height:100%;border-radius:var(--_border-radius);border:.0625rem solid var(--resize-indicator)}[part=trigger-side],[part=trigger],[part=trigger-bottom]{width:var(--_size);aspect-ratio:1;border-radius:50%;z-index:11111;background-color:var(--resize-indicator)}`;
|
|
3
|
-
//# sourceMappingURL=resize-container.common.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resize-container.common.css.js","sourceRoot":"","sources":["../../../../../src/components/resize-container/themes/shared/resize-container.common.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,8VAA8V,CAAC","sourcesContent":["\n import { css } from 'lit';\n export const styles = css`[part~=active]::after{content:\"\";position:absolute;pointer-events:none;inset:0;width:100%;height:100%;border-radius:var(--_border-radius);border:.0625rem solid var(--resize-indicator)}[part=trigger-side],[part=trigger],[part=trigger-bottom]{width:var(--_size);aspect-ratio:1;border-radius:50%;z-index:11111;background-color:var(--resize-indicator)}`;\n "]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
import { styles as bootstrapDark } from './dark/resize-indicator.bootstrap.css.js';
|
|
3
|
-
import { styles as fluentDark } from './dark/resize-indicator.fluent.css.js';
|
|
4
|
-
import { styles as indigoDark } from './dark/resize-indicator.indigo.css.js';
|
|
5
|
-
import { styles as materialDark } from './dark/resize-indicator.material.css.js';
|
|
6
|
-
import { styles as sharedDark } from './dark/resize-indicator.shared.css.js';
|
|
7
|
-
import { styles as bootstrapLight } from './light/resize-indicator.bootstrap.css.js';
|
|
8
|
-
import { styles as fluentLight } from './light/resize-indicator.fluent.css.js';
|
|
9
|
-
import { styles as indigoLight } from './light/resize-indicator.indigo.css.js';
|
|
10
|
-
import { styles as materialLight } from './light/resize-indicator.material.css.js';
|
|
11
|
-
import { styles as sharedLight } from './light/resize-indicator.shared.css.js';
|
|
12
|
-
const light = {
|
|
13
|
-
shared: css `
|
|
14
|
-
${sharedLight}
|
|
15
|
-
`,
|
|
16
|
-
bootstrap: css `
|
|
17
|
-
${bootstrapLight}
|
|
18
|
-
`,
|
|
19
|
-
material: css `
|
|
20
|
-
${materialLight}
|
|
21
|
-
`,
|
|
22
|
-
fluent: css `
|
|
23
|
-
${fluentLight}
|
|
24
|
-
`,
|
|
25
|
-
indigo: css `
|
|
26
|
-
${indigoLight}
|
|
27
|
-
`,
|
|
28
|
-
};
|
|
29
|
-
const dark = {
|
|
30
|
-
shared: css `
|
|
31
|
-
${sharedDark}
|
|
32
|
-
`,
|
|
33
|
-
bootstrap: css `
|
|
34
|
-
${bootstrapDark}
|
|
35
|
-
`,
|
|
36
|
-
material: css `
|
|
37
|
-
${materialDark}
|
|
38
|
-
`,
|
|
39
|
-
fluent: css `
|
|
40
|
-
${fluentDark}
|
|
41
|
-
`,
|
|
42
|
-
indigo: css `
|
|
43
|
-
${indigoDark}
|
|
44
|
-
`,
|
|
45
|
-
};
|
|
46
|
-
export const all = { light, dark };
|
|
47
|
-
//# sourceMappingURL=themes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","sourceRoot":"","sources":["../../../../src/components/resize-container/themes/themes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAI1B,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAE7E,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,KAAK,GAAG;IACZ,MAAM,EAAE,GAAG,CAAA;MACP,WAAW;GACd;IACD,SAAS,EAAE,GAAG,CAAA;MACV,cAAc;GACjB;IACD,QAAQ,EAAE,GAAG,CAAA;MACT,aAAa;GAChB;IACD,MAAM,EAAE,GAAG,CAAA;MACP,WAAW;GACd;IACD,MAAM,EAAE,GAAG,CAAA;MACP,WAAW;GACd;CACF,CAAC;AAEF,MAAM,IAAI,GAAG;IACX,MAAM,EAAE,GAAG,CAAA;MACP,UAAU;GACb;IACD,SAAS,EAAE,GAAG,CAAA;MACV,aAAa;GAChB;IACD,QAAQ,EAAE,GAAG,CAAA;MACT,YAAY;GACf;IACD,MAAM,EAAE,GAAG,CAAA;MACP,UAAU;GACb;IACD,MAAM,EAAE,GAAG,CAAA;MACP,UAAU;GACb;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,GAAG,GAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC","sourcesContent":["import { css } from 'lit';\n\nimport type { Themes } from '#theming/types.js';\n// Dark Overrides\nimport { styles as bootstrapDark } from './dark/resize-indicator.bootstrap.css.js';\nimport { styles as fluentDark } from './dark/resize-indicator.fluent.css.js';\nimport { styles as indigoDark } from './dark/resize-indicator.indigo.css.js';\nimport { styles as materialDark } from './dark/resize-indicator.material.css.js';\nimport { styles as sharedDark } from './dark/resize-indicator.shared.css.js';\n// Light Overrides\nimport { styles as bootstrapLight } from './light/resize-indicator.bootstrap.css.js';\nimport { styles as fluentLight } from './light/resize-indicator.fluent.css.js';\nimport { styles as indigoLight } from './light/resize-indicator.indigo.css.js';\nimport { styles as materialLight } from './light/resize-indicator.material.css.js';\nimport { styles as sharedLight } from './light/resize-indicator.shared.css.js';\n\nconst light = {\n shared: css`\n ${sharedLight}\n `,\n bootstrap: css`\n ${bootstrapLight}\n `,\n material: css`\n ${materialLight}\n `,\n fluent: css`\n ${fluentLight}\n `,\n indigo: css`\n ${indigoLight}\n `,\n};\n\nconst dark = {\n shared: css`\n ${sharedDark}\n `,\n bootstrap: css`\n ${bootstrapDark}\n `,\n material: css`\n ${materialDark}\n `,\n fluent: css`\n ${fluentDark}\n `,\n indigo: css`\n ${indigoDark}\n `,\n};\n\nexport const all: Themes = { light, dark };\n"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Ref } from 'lit/directives/ref.js';
|
|
2
|
-
export type ResizeMode = 'immediate' | 'deferred';
|
|
3
|
-
export type ResizeCallback = (params: ResizeCallbackParams) => unknown;
|
|
4
|
-
export type ResizeCancelCallback = (state: ResizeState) => unknown;
|
|
5
|
-
export type ResizeGhostFactory = () => HTMLElement;
|
|
6
|
-
export type ResizeState = {
|
|
7
|
-
initial: DOMRect;
|
|
8
|
-
current: DOMRect;
|
|
9
|
-
deltaX: number;
|
|
10
|
-
deltaY: number;
|
|
11
|
-
ghost: HTMLElement | null;
|
|
12
|
-
trigger: HTMLElement | null;
|
|
13
|
-
commit?: () => unknown;
|
|
14
|
-
};
|
|
15
|
-
export type ResizeCallbackParams = {
|
|
16
|
-
event: PointerEvent;
|
|
17
|
-
state: ResizeState;
|
|
18
|
-
};
|
|
19
|
-
export type ResizeControllerConfiguration = {
|
|
20
|
-
enabled?: boolean;
|
|
21
|
-
ref?: Ref<HTMLElement>[];
|
|
22
|
-
mode?: ResizeMode;
|
|
23
|
-
deferredFactory?: ResizeGhostFactory;
|
|
24
|
-
layer?: () => HTMLElement;
|
|
25
|
-
/** Callback invoked at the start of a resize operation. */
|
|
26
|
-
start?: ResizeCallback;
|
|
27
|
-
/** Callback invoked on each pointer move during a resize operation. */
|
|
28
|
-
resize?: ResizeCallback;
|
|
29
|
-
/** Callback invoked when a resize operation completes. */
|
|
30
|
-
end?: ResizeCallback;
|
|
31
|
-
/** Callback invoked when a resize operation is cancelled. */
|
|
32
|
-
cancel?: ResizeCancelCallback;
|
|
33
|
-
/**
|
|
34
|
-
* Optional callback that returns the DOM element which will be resized/resizing depending on the
|
|
35
|
-
* configured mode of the controller.
|
|
36
|
-
*
|
|
37
|
-
* Defaults to the controller host.
|
|
38
|
-
*/
|
|
39
|
-
resizeTarget?: () => HTMLElement;
|
|
40
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/resize-container/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'lit/directives/ref.js';\n\nexport type ResizeMode = 'immediate' | 'deferred';\nexport type ResizeCallback = (params: ResizeCallbackParams) => unknown;\nexport type ResizeCancelCallback = (state: ResizeState) => unknown;\nexport type ResizeGhostFactory = () => HTMLElement;\n\nexport type ResizeState = {\n initial: DOMRect;\n current: DOMRect;\n deltaX: number;\n deltaY: number;\n ghost: HTMLElement | null;\n trigger: HTMLElement | null;\n commit?: () => unknown;\n};\n\nexport type ResizeCallbackParams = {\n event: PointerEvent;\n state: ResizeState;\n};\n\nexport type ResizeControllerConfiguration = {\n enabled?: boolean;\n ref?: Ref<HTMLElement>[];\n mode?: ResizeMode;\n deferredFactory?: ResizeGhostFactory;\n layer?: () => HTMLElement;\n /** Callback invoked at the start of a resize operation. */\n start?: ResizeCallback;\n /** Callback invoked on each pointer move during a resize operation. */\n resize?: ResizeCallback;\n /** Callback invoked when a resize operation completes. */\n end?: ResizeCallback;\n /** Callback invoked when a resize operation is cancelled. */\n cancel?: ResizeCancelCallback;\n /**\n * Optional callback that returns the DOM element which will be resized/resizing depending on the\n * configured mode of the controller.\n *\n * Defaults to the controller host.\n */\n resizeTarget?: () => HTMLElement;\n};\n"]}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import type { LitElement, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
import type { Ref } from 'lit/directives/ref.js';
|
|
3
|
-
type DragCallback = (parameters: DragCallbackParameters) => unknown;
|
|
4
|
-
type DragCancelCallback = (state: DragState) => unknown;
|
|
5
|
-
export type DragCallbackParameters = {
|
|
6
|
-
event: PointerEvent;
|
|
7
|
-
state: DragState;
|
|
8
|
-
};
|
|
9
|
-
type State = {
|
|
10
|
-
initial: DOMRect;
|
|
11
|
-
current: DOMRect;
|
|
12
|
-
position: {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
};
|
|
16
|
-
offset: {
|
|
17
|
-
x: number;
|
|
18
|
-
y: number;
|
|
19
|
-
};
|
|
20
|
-
pointerState: {
|
|
21
|
-
previous: {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
};
|
|
25
|
-
current: {
|
|
26
|
-
x: number;
|
|
27
|
-
y: number;
|
|
28
|
-
};
|
|
29
|
-
direction: Direction;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
type DragState = State & {
|
|
33
|
-
ghost: HTMLElement | null;
|
|
34
|
-
element: Element | null;
|
|
35
|
-
};
|
|
36
|
-
type Direction = 'start' | 'end' | 'bottom' | 'top';
|
|
37
|
-
type DragControllerConfiguration = {
|
|
38
|
-
/** Whether the drag feature is enabled for the current host. */
|
|
39
|
-
enabled?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The mode of the drag operation.
|
|
42
|
-
*
|
|
43
|
-
* Deferred will create a ghost element and keep the original element
|
|
44
|
-
* at its place until the operation completes successfully.
|
|
45
|
-
*/
|
|
46
|
-
mode?: 'immediate' | 'deferred';
|
|
47
|
-
/**
|
|
48
|
-
* Whether starting a drag operation should snap the dragged item's top left corner
|
|
49
|
-
* to the cursor position.
|
|
50
|
-
*/
|
|
51
|
-
snapToCursor?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Guard function invoked during the `start` callback.
|
|
54
|
-
* Returning a truthy value will stop the current drag operation.
|
|
55
|
-
*/
|
|
56
|
-
skip?: (event: PointerEvent) => boolean;
|
|
57
|
-
matchTarget?: (target: Element) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
*/
|
|
61
|
-
trigger?: () => HTMLElement;
|
|
62
|
-
/**
|
|
63
|
-
* Contain drag operations to the scope of the passed DOM element.
|
|
64
|
-
*/
|
|
65
|
-
container?: Ref<HTMLElement>;
|
|
66
|
-
/**
|
|
67
|
-
* The DOM element that will "host" the ghost drag element when the controller
|
|
68
|
-
* is set to **deferred**.
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* In **immediate** mode, this property is ignored.
|
|
72
|
-
*/
|
|
73
|
-
layer?: () => HTMLElement;
|
|
74
|
-
ghost?: () => HTMLElement;
|
|
75
|
-
/** Callback invoked at the beginning of a drag operation. */
|
|
76
|
-
start?: DragCallback;
|
|
77
|
-
/** Callback invoked while dragging the target element. */
|
|
78
|
-
move?: DragCallback;
|
|
79
|
-
enter?: DragCallback;
|
|
80
|
-
leave?: DragCallback;
|
|
81
|
-
over?: DragCallback;
|
|
82
|
-
/** Callback invoked during a drop operation. */
|
|
83
|
-
end?: DragCallback;
|
|
84
|
-
/** Callback invoked when a drag is cancelled */
|
|
85
|
-
cancel?: DragCancelCallback;
|
|
86
|
-
};
|
|
87
|
-
declare class DragController implements ReactiveController {
|
|
88
|
-
private readonly _host;
|
|
89
|
-
private readonly _options;
|
|
90
|
-
private readonly _abortHandle;
|
|
91
|
-
private _state;
|
|
92
|
-
private _matchedElement;
|
|
93
|
-
private _id;
|
|
94
|
-
private _hasPointerCapture;
|
|
95
|
-
private _ghost;
|
|
96
|
-
/** Whether `snapToCursor` is enabled for the controller. */
|
|
97
|
-
private get _hasSnapping();
|
|
98
|
-
/** Whether the current drag mode is deferred. */
|
|
99
|
-
private get _isDeferred();
|
|
100
|
-
/**
|
|
101
|
-
* The source element which will capture pointer events and initiate drag mode.
|
|
102
|
-
*
|
|
103
|
-
* @remarks
|
|
104
|
-
* By default that will be the host element itself, unless `trigger` is passed in.
|
|
105
|
-
*/
|
|
106
|
-
private get _element();
|
|
107
|
-
/**
|
|
108
|
-
* The element being dragged.
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* When in **deferred** mode this returns a reference to the drag ghost element,
|
|
112
|
-
* otherwise it is the host element.
|
|
113
|
-
*/
|
|
114
|
-
private get _dragItem();
|
|
115
|
-
/**
|
|
116
|
-
* The DOM element that will "host" the ghost drag element when the controller
|
|
117
|
-
* is set to **deferred**.
|
|
118
|
-
*
|
|
119
|
-
* @remarks
|
|
120
|
-
* In **immediate** mode, this property is ignored.
|
|
121
|
-
*/
|
|
122
|
-
private get _layer();
|
|
123
|
-
private get _stateParameters();
|
|
124
|
-
constructor(host: ReactiveControllerHost & LitElement, options?: DragControllerConfiguration);
|
|
125
|
-
/** Whether the drag controller is enabled. */
|
|
126
|
-
get enabled(): boolean;
|
|
127
|
-
/** Updates the drag controller configuration. */
|
|
128
|
-
set(options?: DragControllerConfiguration): void;
|
|
129
|
-
/** Stops any drag operation and cleans up state, additional event listeners and elements. */
|
|
130
|
-
dispose(): void;
|
|
131
|
-
/** @internal */
|
|
132
|
-
hostConnected(): void;
|
|
133
|
-
/** @internal */
|
|
134
|
-
hostDisconnected(): void;
|
|
135
|
-
/** @internal */
|
|
136
|
-
handleEvent(event: PointerEvent & KeyboardEvent): void;
|
|
137
|
-
private _handlePointerDown;
|
|
138
|
-
private _handlePointerMove;
|
|
139
|
-
private _handlePointerEnd;
|
|
140
|
-
private _handleCancel;
|
|
141
|
-
private _setDragCancelListener;
|
|
142
|
-
private _setInitialState;
|
|
143
|
-
private _setDragState;
|
|
144
|
-
/**
|
|
145
|
-
* Toggles text selection for the duration of a drag operation.
|
|
146
|
-
*
|
|
147
|
-
* @remarks
|
|
148
|
-
* Disabling `user-select` only on the dragged element is not enough, since browsers
|
|
149
|
-
* (notably Safari) will still create a text selection in whatever elements sit under
|
|
150
|
-
* the pointer while dragging. Applying it to the owner document's body prevents that
|
|
151
|
-
* across the page for the active drag and is reverted once the operation completes.
|
|
152
|
-
*/
|
|
153
|
-
private _toggleTextSelection;
|
|
154
|
-
private _updateMatcher;
|
|
155
|
-
private _updatePosition;
|
|
156
|
-
private _updatePointerState;
|
|
157
|
-
private _assignPosition;
|
|
158
|
-
private _createDragGhost;
|
|
159
|
-
private _removeGhost;
|
|
160
|
-
private _shouldSkip;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Adds a drag and drop controller to the given host
|
|
164
|
-
*/
|
|
165
|
-
export declare function addDragController(host: ReactiveControllerHost & LitElement, options?: DragControllerConfiguration): DragController;
|
|
166
|
-
export {};
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { getDefaultLayer } from '../../components/resize-container/default-ghost.js';
|
|
2
|
-
import { createAbortHandle } from '../abort-handler.js';
|
|
3
|
-
import { getRoot, isLTR, roundByDPR, setStyles } from '../utils/dom.js';
|
|
4
|
-
import { getElementFromPath } from '../utils/events.js';
|
|
5
|
-
import { escapeKey, isKey } from './key-bindings.js';
|
|
6
|
-
const additionalEvents = [
|
|
7
|
-
'pointermove',
|
|
8
|
-
'lostpointercapture',
|
|
9
|
-
'contextmenu',
|
|
10
|
-
];
|
|
11
|
-
class DragController {
|
|
12
|
-
get _hasSnapping() {
|
|
13
|
-
return Boolean(this._options.snapToCursor);
|
|
14
|
-
}
|
|
15
|
-
get _isDeferred() {
|
|
16
|
-
return this._options.mode === 'deferred';
|
|
17
|
-
}
|
|
18
|
-
get _element() {
|
|
19
|
-
return this._options.trigger?.() ?? this._host;
|
|
20
|
-
}
|
|
21
|
-
get _dragItem() {
|
|
22
|
-
return this._isDeferred ? this._ghost : this._host;
|
|
23
|
-
}
|
|
24
|
-
get _layer() {
|
|
25
|
-
if (!this._isDeferred) {
|
|
26
|
-
return this._host;
|
|
27
|
-
}
|
|
28
|
-
return this._options.layer?.() ?? this._host;
|
|
29
|
-
}
|
|
30
|
-
get _stateParameters() {
|
|
31
|
-
return {
|
|
32
|
-
...this._state,
|
|
33
|
-
ghost: this._ghost,
|
|
34
|
-
element: this._matchedElement,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
constructor(host, options) {
|
|
38
|
-
this._options = {
|
|
39
|
-
enabled: true,
|
|
40
|
-
mode: 'deferred',
|
|
41
|
-
snapToCursor: false,
|
|
42
|
-
layer: getDefaultLayer,
|
|
43
|
-
};
|
|
44
|
-
this._abortHandle = createAbortHandle();
|
|
45
|
-
this._id = -1;
|
|
46
|
-
this._hasPointerCapture = false;
|
|
47
|
-
this._ghost = null;
|
|
48
|
-
this._host = host;
|
|
49
|
-
this._host.addController(this);
|
|
50
|
-
this.set(options);
|
|
51
|
-
}
|
|
52
|
-
get enabled() {
|
|
53
|
-
return Boolean(this._options.enabled);
|
|
54
|
-
}
|
|
55
|
-
set(options) {
|
|
56
|
-
Object.assign(this._options, options);
|
|
57
|
-
}
|
|
58
|
-
dispose() {
|
|
59
|
-
this._matchedElement = null;
|
|
60
|
-
this._removeGhost();
|
|
61
|
-
this._setDragState(false);
|
|
62
|
-
}
|
|
63
|
-
hostConnected() {
|
|
64
|
-
const { signal } = this._abortHandle;
|
|
65
|
-
this._host.addEventListener('dragstart', this, { signal });
|
|
66
|
-
this._host.addEventListener('touchstart', this, { passive: false, signal });
|
|
67
|
-
this._host.addEventListener('pointerdown', this, { signal });
|
|
68
|
-
}
|
|
69
|
-
hostDisconnected() {
|
|
70
|
-
this._abortHandle.abort();
|
|
71
|
-
this._setDragCancelListener(false);
|
|
72
|
-
this._removeGhost();
|
|
73
|
-
}
|
|
74
|
-
handleEvent(event) {
|
|
75
|
-
if (!this.enabled) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
switch (event.type) {
|
|
79
|
-
case 'touchstart':
|
|
80
|
-
case 'dragstart':
|
|
81
|
-
case 'contextmenu':
|
|
82
|
-
event.preventDefault();
|
|
83
|
-
break;
|
|
84
|
-
case 'keydown':
|
|
85
|
-
this._handleCancel(event);
|
|
86
|
-
break;
|
|
87
|
-
case 'pointerdown':
|
|
88
|
-
this._handlePointerDown(event);
|
|
89
|
-
break;
|
|
90
|
-
case 'pointermove':
|
|
91
|
-
this._handlePointerMove(event);
|
|
92
|
-
break;
|
|
93
|
-
case 'lostpointercapture':
|
|
94
|
-
this._handlePointerEnd(event);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
_handlePointerDown(event) {
|
|
99
|
-
if (this._shouldSkip(event)) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this._setInitialState(event);
|
|
103
|
-
this._createDragGhost();
|
|
104
|
-
this._updatePosition(event);
|
|
105
|
-
const parameters = {
|
|
106
|
-
event,
|
|
107
|
-
state: this._stateParameters,
|
|
108
|
-
};
|
|
109
|
-
if (this._options.start?.call(this._host, parameters) === false) {
|
|
110
|
-
this.dispose();
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this._assignPosition(this._dragItem);
|
|
114
|
-
this._setDragState();
|
|
115
|
-
}
|
|
116
|
-
_handlePointerMove(event) {
|
|
117
|
-
if (!this._hasPointerCapture) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
this._updatePosition(event);
|
|
121
|
-
this._updatePointerState(event);
|
|
122
|
-
this._updateMatcher(event);
|
|
123
|
-
const parameters = {
|
|
124
|
-
event,
|
|
125
|
-
state: this._stateParameters,
|
|
126
|
-
};
|
|
127
|
-
this._options.move?.call(this._host, parameters);
|
|
128
|
-
this._assignPosition(this._dragItem);
|
|
129
|
-
}
|
|
130
|
-
_handlePointerEnd(event) {
|
|
131
|
-
this._options.end?.call(this._host, {
|
|
132
|
-
event,
|
|
133
|
-
state: this._stateParameters,
|
|
134
|
-
});
|
|
135
|
-
this.dispose();
|
|
136
|
-
}
|
|
137
|
-
_handleCancel(event) {
|
|
138
|
-
if (this._hasPointerCapture && isKey(event, escapeKey)) {
|
|
139
|
-
this._options.cancel?.call(this._host, this._stateParameters);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
_setDragCancelListener(enabled = true) {
|
|
143
|
-
enabled
|
|
144
|
-
? globalThis.addEventListener('keydown', this)
|
|
145
|
-
: globalThis.removeEventListener('keydown', this);
|
|
146
|
-
}
|
|
147
|
-
_setInitialState({ pointerId, clientX, clientY, }) {
|
|
148
|
-
const rect = this._host.getBoundingClientRect();
|
|
149
|
-
const position = { x: rect.x, y: rect.y };
|
|
150
|
-
const offset = { x: rect.x - clientX, y: rect.y - clientY };
|
|
151
|
-
this._id = pointerId;
|
|
152
|
-
this._state = {
|
|
153
|
-
initial: rect,
|
|
154
|
-
current: structuredClone(rect),
|
|
155
|
-
position,
|
|
156
|
-
offset,
|
|
157
|
-
pointerState: {
|
|
158
|
-
previous: { x: clientX, y: clientY },
|
|
159
|
-
current: { x: clientX, y: clientY },
|
|
160
|
-
direction: 'end',
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
_setDragState(enabled = true) {
|
|
165
|
-
this._hasPointerCapture = enabled;
|
|
166
|
-
const cssValue = enabled ? 'none' : '';
|
|
167
|
-
setStyles(this._element, {
|
|
168
|
-
touchAction: cssValue,
|
|
169
|
-
userSelect: cssValue,
|
|
170
|
-
webkitUserSelect: cssValue,
|
|
171
|
-
});
|
|
172
|
-
this._toggleTextSelection(enabled);
|
|
173
|
-
enabled
|
|
174
|
-
? this._element.setPointerCapture(this._id)
|
|
175
|
-
: this._element.releasePointerCapture(this._id);
|
|
176
|
-
this._setDragCancelListener(enabled);
|
|
177
|
-
for (const type of additionalEvents) {
|
|
178
|
-
enabled
|
|
179
|
-
? this._host.addEventListener(type, this)
|
|
180
|
-
: this._host.removeEventListener(type, this);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
_toggleTextSelection(disabled) {
|
|
184
|
-
const value = disabled ? 'none' : '';
|
|
185
|
-
const { style } = this._host.ownerDocument.body;
|
|
186
|
-
style.userSelect = value;
|
|
187
|
-
style.webkitUserSelect = value;
|
|
188
|
-
if (disabled) {
|
|
189
|
-
this._host.ownerDocument.getSelection()?.removeAllRanges();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
_updateMatcher(event) {
|
|
193
|
-
if (!this._options.matchTarget) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const match = getRoot(this._host)
|
|
197
|
-
.elementsFromPoint(event.clientX, event.clientY)
|
|
198
|
-
.find((element) => this._options.matchTarget.call(this._host, element));
|
|
199
|
-
if (match && !this._matchedElement) {
|
|
200
|
-
this._matchedElement = match;
|
|
201
|
-
this._options.enter?.call(this._host, {
|
|
202
|
-
event,
|
|
203
|
-
state: this._stateParameters,
|
|
204
|
-
});
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
if (!match && this._matchedElement) {
|
|
208
|
-
this._options.leave?.call(this._host, {
|
|
209
|
-
event,
|
|
210
|
-
state: this._stateParameters,
|
|
211
|
-
});
|
|
212
|
-
this._matchedElement = null;
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (match && match === this._matchedElement) {
|
|
216
|
-
this._options.over?.call(this._host, {
|
|
217
|
-
event,
|
|
218
|
-
state: this._stateParameters,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
_updatePosition({ clientX, clientY }) {
|
|
223
|
-
const { x, y } = this._state.offset;
|
|
224
|
-
const { x: layerX, y: layerY } = this._isDeferred
|
|
225
|
-
? this._layer.getBoundingClientRect()
|
|
226
|
-
: this._state.initial;
|
|
227
|
-
const posX = this._hasSnapping ? clientX - layerX : clientX - layerX + x;
|
|
228
|
-
const posY = this._hasSnapping ? clientY - layerY : clientY - layerY + y;
|
|
229
|
-
this._state.position = { x: posX, y: posY };
|
|
230
|
-
}
|
|
231
|
-
_updatePointerState({ clientX, clientY }) {
|
|
232
|
-
const state = this._state.pointerState;
|
|
233
|
-
state.previous = { ...state.current };
|
|
234
|
-
state.current = { x: clientX, y: clientY };
|
|
235
|
-
const dx = state.current.x - state.previous.x;
|
|
236
|
-
const dy = state.current.y - state.previous.y;
|
|
237
|
-
if (Math.abs(dx) >= Math.abs(dy)) {
|
|
238
|
-
const swapHorizontal = isLTR(this._host) ? dx >= 0 : dx <= 0;
|
|
239
|
-
state.direction = swapHorizontal ? 'end' : 'start';
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
state.direction = dy >= 0 ? 'bottom' : 'top';
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
_assignPosition(element) {
|
|
246
|
-
element.style.transform = `translate3d(${roundByDPR(this._state.position.x)}px,${roundByDPR(this._state.position.y)}px,0)`;
|
|
247
|
-
}
|
|
248
|
-
_createDragGhost() {
|
|
249
|
-
if (!this._isDeferred) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
this._ghost =
|
|
253
|
-
this._options.ghost?.call(this._host) ??
|
|
254
|
-
createDefaultDragGhost(this._host.getBoundingClientRect());
|
|
255
|
-
this._layer.append(this._ghost);
|
|
256
|
-
}
|
|
257
|
-
_removeGhost() {
|
|
258
|
-
this._ghost?.remove();
|
|
259
|
-
this._ghost = null;
|
|
260
|
-
}
|
|
261
|
-
_shouldSkip(event) {
|
|
262
|
-
return (Boolean(event.button) ||
|
|
263
|
-
this._options.skip?.call(this._host, event) ||
|
|
264
|
-
!getElementFromPath((e) => e === this._element, event));
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function createDefaultDragGhost({ x, y, width, height }) {
|
|
268
|
-
const element = document.createElement('div');
|
|
269
|
-
setStyles(element, {
|
|
270
|
-
position: 'absolute',
|
|
271
|
-
left: `${x}px`,
|
|
272
|
-
top: `${y}px`,
|
|
273
|
-
width: `${width}px`,
|
|
274
|
-
height: `${height}px`,
|
|
275
|
-
zIndex: '1000',
|
|
276
|
-
background: 'gold',
|
|
277
|
-
});
|
|
278
|
-
return element;
|
|
279
|
-
}
|
|
280
|
-
export function addDragController(host, options) {
|
|
281
|
-
return new DragController(host, options);
|
|
282
|
-
}
|
|
283
|
-
//# sourceMappingURL=drag.js.map
|