winduum 2.0.0-next.9 → 2.0.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/dist/main.css +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +23 -17
- package/plugin/index.cjs +80 -110
- package/plugin/index.d.ts +9 -9
- package/plugin/index.js +46 -94
- package/plugin/utilities/common.js +44 -5
- package/src/base/defaults.css +6 -12
- package/src/base/index.css +1 -4
- package/src/base/keyframes.css +0 -17
- package/src/base/reset.css +0 -1
- package/src/base/transitions.css +15 -0
- package/src/common.js +1 -1
- package/src/components/badge/circle.css +1 -1
- package/src/components/badge/default.css +2 -2
- package/src/components/badge/lg.css +1 -1
- package/src/components/badge/props/default.css +2 -2
- package/src/components/badge/sm.css +1 -1
- package/src/components/badge/square.css +1 -1
- package/src/components/breadcrumb/props/default.css +1 -1
- package/src/components/button/bordered.css +1 -4
- package/src/components/button/circle.css +1 -1
- package/src/components/button/default.css +2 -2
- package/src/components/button/index.css +1 -0
- package/src/components/button/interactive.css +15 -13
- package/src/components/button/lg.css +1 -1
- package/src/components/button/props/default.css +2 -2
- package/src/components/button/sm.css +1 -1
- package/src/components/button/spinner.css +9 -0
- package/src/components/button/square.css +1 -1
- package/src/components/card/props/default.css +2 -2
- package/src/components/carousel/index.d.ts +3 -3
- package/src/components/carousel/index.js +18 -16
- package/src/components/check/invalid.css +1 -1
- package/src/components/check/props/default.css +1 -1
- package/src/components/color/interactive.css +1 -1
- package/src/components/color/props/default.css +0 -1
- package/src/components/compare/default.css +3 -3
- package/src/components/compare/index.d.ts +3 -3
- package/src/components/compare/index.js +10 -9
- package/src/components/control/color.css +5 -5
- package/src/components/control/default.css +3 -3
- package/src/components/control/file.css +1 -1
- package/src/components/control/invalid.css +1 -1
- package/src/components/control/props/color.css +2 -2
- package/src/components/control/props/default.css +3 -3
- package/src/components/control/select-multiple.css +1 -1
- package/src/components/details/index.js +2 -2
- package/src/components/dialog/index.d.ts +2 -0
- package/src/components/dialog/index.js +8 -6
- package/src/components/drawer/default.css +6 -5
- package/src/components/drawer/index.d.ts +2 -1
- package/src/components/drawer/index.js +15 -1
- package/src/components/drawer/props/content.css +1 -1
- package/src/components/field/default.css +2 -2
- package/src/components/form/index.d.ts +5 -4
- package/src/components/form/index.js +15 -13
- package/src/components/group/default.css +1 -1
- package/src/components/pagination/default.css +1 -1
- package/src/components/popover/content.css +7 -11
- package/src/components/popover/index.d.ts +6 -1
- package/src/components/popover/index.js +12 -10
- package/src/components/popover/props/content.css +2 -2
- package/src/components/progress/default.css +3 -3
- package/src/components/progress/index.css +1 -0
- package/src/components/progress/keyframes/default.css +9 -0
- package/src/components/progress/props/default.css +0 -2
- package/src/components/range/index.d.ts +1 -0
- package/src/components/range/index.js +5 -4
- package/src/components/rating/default.css +8 -0
- package/src/components/rating/invalid.css +1 -1
- package/src/components/rating/props/default.css +0 -1
- package/src/components/switch/invalid.css +1 -1
- package/src/components/tabs/list.css +2 -2
- package/src/components/text/props/default.css +1 -1
- package/src/components/toast/content.css +0 -5
- package/src/components/toast/default.css +3 -3
- package/src/components/toast/index.d.ts +14 -0
- package/src/components/toast/index.js +51 -0
- package/src/components/toast/props/content.css +3 -3
- package/src/components/toaster/default.css +4 -0
- package/src/components/toaster/index.d.ts +1 -25
- package/src/components/toaster/index.js +1 -103
- package/src/components/toaster/props/default.css +2 -2
- package/src/components/tooltip/props/default.css +4 -4
- package/src/main.css +3 -0
- package/src/tailwind.css +4 -2
- package/src/test.css +9 -0
- package/src/{base → theme}/config/font.css +17 -1
- package/src/theme/config/index.css +6 -0
- package/src/theme/config/spacing.css +37 -0
- package/src/{base → theme}/config/transition.css +5 -1
- package/src/theme/index.css +4 -0
- package/src/utilities/animation.css +4 -0
- package/src/utilities/container/default.css +2 -2
- package/src/utilities/container/props/default.css +2 -2
- package/src/utilities/divider.css +1 -1
- package/src/utilities/dot.css +10 -0
- package/src/utilities/index.css +2 -1
- package/src/utilities/ripple/default.css +16 -0
- package/src/utilities/ripple/index.css +2 -15
- package/src/utilities/ripple/index.d.ts +7 -1
- package/src/utilities/ripple/index.js +13 -13
- package/src/utilities/ripple/keyframes/default.css +6 -0
- package/src/utilities/spinner/circle.css +5 -0
- package/src/utilities/spinner/default.css +16 -0
- package/src/utilities/spinner/index.css +4 -0
- package/src/utilities/spinner/keyframes/ring.css +13 -0
- package/src/utilities/spinner/ring.css +15 -0
- package/src/utilities/view-transition.css +3 -0
- package/tailwind.config.js +6 -5
- package/tailwindcss/base/defaults.css +9 -0
- package/tailwindcss/index.css +4 -0
- package/tailwindcss/theme/config/breakpoint.css +12 -0
- package/tailwindcss/theme/config/font.css +13 -0
- package/tailwindcss/theme/config/index.css +6 -0
- package/tailwindcss/theme/config/mask.css +8 -0
- package/tailwindcss/theme/config/radius.css +9 -0
- package/tailwindcss/theme/config/transition.css +20 -0
- package/tailwindcss/theme/config/z.css +7 -0
- package/tailwindcss/theme/default.css +26 -0
- package/tailwindcss/theme/index.css +2 -0
- package/tailwindcss/utilities/animation.css +0 -0
- package/tailwindcss/utilities/divide-gap.css +0 -0
- package/types/index.d.ts +50 -39
- package/types/index.d.ts.map +7 -5
- package/dist/assets/index-xIgNpv_7.css +0 -1
- package/dist/index.html +0 -16
- package/dist/main-rgb.css +0 -1
- package/src/base/config/spacing.css +0 -15
- package/src/base/config.css +0 -6
- package/src/base/tailwind.css +0 -3
- package/src/utilities/common.css +0 -8
- /package/src/{base → theme}/config/mask.css +0 -0
- /package/src/{base/config/rounded.css → theme/config/radius.css} +0 -0
- /package/src/{base → theme}/config/z.css +0 -0
- /package/src/{base/theme → theme}/dark-rgb.css +0 -0
- /package/src/{base/theme → theme}/dark.css +0 -0
- /package/src/{base/theme → theme}/default-p3.css +0 -0
- /package/src/{base/theme → theme}/default-rgb.css +0 -0
- /package/src/{base/theme → theme}/default.css +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
--x-badge-border-color: var(--color-accent);
|
|
4
4
|
--x-badge-color: var(--color-accent-foreground);
|
|
5
5
|
|
|
6
|
-
inline-size: var(--x-badge-
|
|
7
|
-
block-size: var(--x-badge-
|
|
6
|
+
inline-size: var(--x-badge-inline-size);
|
|
7
|
+
block-size: var(--x-badge-block-size);
|
|
8
8
|
padding: var(--x-badge-padding-block) var(--x-badge-padding-inline);
|
|
9
9
|
padding-inline: calc(var(--x-badge-padding-inline) - var(--x-badge-border-width));
|
|
10
10
|
border-radius: var(--x-badge-border-radius);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
--x-badge-border-width: 0px;
|
|
3
3
|
--x-badge-border-radius: var(--radius-lg);
|
|
4
4
|
--x-badge-font-size: var(--font-size-xs);
|
|
5
|
-
--x-badge-gap: var(--spacing-
|
|
6
|
-
--x-badge-
|
|
5
|
+
--x-badge-gap: var(--spacing-1);
|
|
6
|
+
--x-badge-block-size: 1.5rem;
|
|
7
7
|
--x-badge-padding-block: 0;
|
|
8
8
|
--x-badge-padding-inline: 0.5rem;
|
|
9
9
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
.x-button:is(.bordered) {
|
|
2
2
|
--x-button-disabled-background-color-opacity: 0%;
|
|
3
3
|
--x-button-disabled-background-color-mix: transparent;
|
|
4
|
-
--x-button-disabled-border-color-opacity: 30%;
|
|
5
4
|
--x-button-disabled-color: var(--color-accent);
|
|
6
5
|
--x-button-active-background-color-opacity: 20%;
|
|
7
6
|
--x-button-active-background-color-mix: transparent;
|
|
8
|
-
--x-button-active-border-color-opacity: 30%;
|
|
9
7
|
--x-button-active-color: var(--color-accent);
|
|
10
8
|
--x-button-hover-background-color-opacity: 10%;
|
|
11
9
|
--x-button-hover-background-color-mix: transparent;
|
|
12
|
-
--x-button-hover-border-color-opacity: 30%;
|
|
13
10
|
--x-button-hover-color: var(--color-accent);
|
|
14
11
|
--x-button-focus-outline-offset: 0px;
|
|
15
12
|
--x-button-border-width: 1px;
|
|
16
|
-
--x-button-border-color-opacity:
|
|
13
|
+
--x-button-border-color-opacity: 100%;
|
|
17
14
|
--x-button-background-color-opacity: 0%;
|
|
18
15
|
--x-button-color: var(--color-accent);
|
|
19
16
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
--x-button-border-color: var(--color-accent);
|
|
4
4
|
--x-button-color: var(--color-accent-foreground);
|
|
5
5
|
|
|
6
|
-
inline-size: var(--x-button-
|
|
7
|
-
block-size: var(--x-button-
|
|
6
|
+
inline-size: var(--x-button-inline-size);
|
|
7
|
+
block-size: var(--x-button-block-size);
|
|
8
8
|
padding: var(--x-button-padding-block) var(--x-button-padding-inline);
|
|
9
9
|
padding-inline: calc(var(--x-button-padding-inline) - var(--x-button-border-width));
|
|
10
10
|
border-radius: var(--x-button-border-radius);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.x-button {
|
|
2
|
-
transition-property: var(--default-transition-property);
|
|
3
|
-
transition-timing-function: var(--transition-timing-function-in-out);
|
|
4
|
-
transition-duration: var(--default-transition-duration);
|
|
2
|
+
transition-property: var(--x-button-transition-property, var(--default-transition-property));
|
|
3
|
+
transition-timing-function: var(--x-button-timing-function, var(--transition-timing-function-in-out));
|
|
4
|
+
transition-duration: var(--x-button-transition-duration, var(--default-transition-duration));
|
|
5
5
|
|
|
6
6
|
&:where(.accent-primary),
|
|
7
7
|
&:where(.accent-body),
|
|
@@ -12,15 +12,17 @@
|
|
|
12
12
|
|
|
13
13
|
&:is(button, input, label, :any-link, [role="button"]) {
|
|
14
14
|
&:hover {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
@media (hover: hover) and (pointer: fine) {
|
|
16
|
+
--x-button-background-color: var(--x-button-hover-background-color, var(--color-accent));
|
|
17
|
+
--x-button-background-color-mix: var(--x-button-hover-background-color-mix);
|
|
18
|
+
--x-button-background-color-opacity: var(--x-button-hover-background-color-opacity);
|
|
19
|
+
--x-button-border-color: var(--x-button-hover-border-color, var(--color-accent));
|
|
20
|
+
--x-button-border-color-mix: var(--x-button-hover-border-color-mix, transparent);
|
|
21
|
+
--x-button-border-color-opacity: var(--x-button-hover-border-color-opacity, 100%);
|
|
22
|
+
--x-button-color: var(--x-button-hover-color, var(--color-accent-foreground));
|
|
23
|
+
--x-button-color-mix: var(--x-button-hover-color-mix, transparent);
|
|
24
|
+
--x-button-color-opacity: var(--x-button-hover-color-opacity, 100%);
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
&:focus {
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
&:active, &:checked, &.active {
|
|
33
|
-
--x-button-background-color: var(--x-button-
|
|
35
|
+
--x-button-background-color: var(--x-button-active-background-color, var(--color-accent));
|
|
34
36
|
--x-button-background-color-mix: var(--x-button-active-background-color-mix);
|
|
35
37
|
--x-button-background-color-opacity: var(--x-button-active-background-color-opacity);
|
|
36
38
|
--x-button-border-color: var(--x-button-active-border-color, var(--color-accent));
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
--x-button-border-radius: var(--radius);
|
|
5
5
|
--x-button-font-size: var(--font-size-sm);
|
|
6
6
|
--x-button-font-weight: var(--font-weight-medium);
|
|
7
|
-
--x-button-gap: var(--spacing-
|
|
8
|
-
--x-button-
|
|
7
|
+
--x-button-gap: var(--spacing-2);
|
|
8
|
+
--x-button-block-size: 2.25rem;
|
|
9
9
|
--x-button-padding-block: 0.375rem;
|
|
10
10
|
--x-button-padding-inline: 0.75rem;
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:root, :host {
|
|
2
2
|
--x-card-background-color: var(--color-body-primary);
|
|
3
3
|
--x-card-border-radius: var(--radius-2xl);
|
|
4
|
-
--x-card-padding-block: var(--spacing-
|
|
5
|
-
--x-card-padding-inline: var(--spacing-
|
|
4
|
+
--x-card-padding-block: var(--spacing-6);
|
|
5
|
+
--x-card-padding-inline: var(--spacing-7);
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface ObserveCarouselOptions {
|
|
2
|
-
|
|
2
|
+
visibleAttribute?: string
|
|
3
3
|
observerOptions?: {
|
|
4
4
|
rootMargin?: string
|
|
5
5
|
threshold?: number | number[]
|
|
@@ -9,7 +9,7 @@ export interface ObserveCarouselOptions {
|
|
|
9
9
|
export interface PaginationCarouselOptions {
|
|
10
10
|
element?: HTMLElement | Element
|
|
11
11
|
itemContent?: string
|
|
12
|
-
|
|
12
|
+
activeAttribute?: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface ScrollCarouselOptions {
|
|
@@ -26,7 +26,7 @@ export interface AutoplayCarouselOptions {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface DragCarouselOptions {
|
|
29
|
-
|
|
29
|
+
activeAttribute?: string
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function scrollPrev(element: HTMLElement | Element): void
|
|
@@ -47,21 +47,21 @@ export const getItemCount = (element, scrollWidth = element.scrollWidth - elemen
|
|
|
47
47
|
/**
|
|
48
48
|
* @param {HTMLElement | Element} element
|
|
49
49
|
* @param {import("./").ObserveCarouselOptions} options
|
|
50
|
-
* @returns
|
|
50
|
+
* @returns IntersectionObserver
|
|
51
51
|
*/
|
|
52
52
|
export const observeCarousel = (element, options = {}) => {
|
|
53
53
|
options = {
|
|
54
|
-
|
|
54
|
+
visibleAttribute: 'data-visible',
|
|
55
55
|
observerOptions: {},
|
|
56
56
|
...options
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
element._observer = new IntersectionObserver(entries => {
|
|
60
|
-
entries.forEach(entry => {
|
|
61
|
-
entry.target.
|
|
59
|
+
element._observer = new IntersectionObserver((entries) => {
|
|
60
|
+
entries.forEach((entry) => {
|
|
61
|
+
entry.target.toggleAttribute(options.visibleAttribute, entry.isIntersecting)
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
const activeElement = [...element.children].find(children => children.
|
|
64
|
+
const activeElement = [...element.children].find(children => children.hasAttribute(options.visibleAttribute))
|
|
65
65
|
|
|
66
66
|
if (activeElement) {
|
|
67
67
|
element._activeIndex = [...element.children].indexOf(activeElement)
|
|
@@ -73,6 +73,8 @@ export const observeCarousel = (element, options = {}) => {
|
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
;[...element.children].forEach(children => element._observer.observe(children))
|
|
76
|
+
|
|
77
|
+
return element._observer
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
/**
|
|
@@ -82,7 +84,7 @@ export const observeCarousel = (element, options = {}) => {
|
|
|
82
84
|
*/
|
|
83
85
|
export const scrollCarousel = (element, options = {}) => {
|
|
84
86
|
options.pagination = {
|
|
85
|
-
|
|
87
|
+
activeAttribute: 'data-active',
|
|
86
88
|
...options.pagination
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -90,9 +92,9 @@ export const scrollCarousel = (element, options = {}) => {
|
|
|
90
92
|
const activeItemMax = getItemCount(element)
|
|
91
93
|
|
|
92
94
|
if (options?.pagination?.element) {
|
|
93
|
-
;[...options.pagination.element.children].forEach(children => children.
|
|
95
|
+
;[...options.pagination.element.children].forEach(children => children.removeAttribute(options.pagination.activeAttribute))
|
|
94
96
|
|
|
95
|
-
options.pagination.element.children[activeItem - 1]?.
|
|
97
|
+
options.pagination.element.children[activeItem - 1]?.setAttribute(options.pagination.activeAttribute, '')
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
if (options.progressElement) {
|
|
@@ -118,7 +120,7 @@ export const scrollCarousel = (element, options = {}) => {
|
|
|
118
120
|
export const paginationCarousel = (element, options = {}) => {
|
|
119
121
|
options = {
|
|
120
122
|
itemContent: '<div aria-hidden="true"></div>',
|
|
121
|
-
|
|
123
|
+
activeAttribute: 'data-active',
|
|
122
124
|
...options
|
|
123
125
|
}
|
|
124
126
|
|
|
@@ -129,7 +131,7 @@ export const paginationCarousel = (element, options = {}) => {
|
|
|
129
131
|
).join(''))
|
|
130
132
|
|
|
131
133
|
;[...options.element.children].forEach((children, i) => {
|
|
132
|
-
(i === 0) && children.
|
|
134
|
+
(i === 0) && children.setAttribute(options.activeAttribute, '')
|
|
133
135
|
children.addEventListener('click', ({ currentTarget }) => {
|
|
134
136
|
scrollTo(element, [...options.element.children].indexOf(currentTarget))
|
|
135
137
|
})
|
|
@@ -150,7 +152,7 @@ export const autoplayCarousel = (element, options = {}) => {
|
|
|
150
152
|
|
|
151
153
|
let paused
|
|
152
154
|
|
|
153
|
-
options.pauseElements.forEach(element => {
|
|
155
|
+
options.pauseElements.forEach((element) => {
|
|
154
156
|
element?.addEventListener('mouseenter', () => (paused = true))
|
|
155
157
|
element?.addEventListener('mouseleave', () => (paused = false))
|
|
156
158
|
})
|
|
@@ -173,7 +175,7 @@ export const autoplayCarousel = (element, options = {}) => {
|
|
|
173
175
|
*/
|
|
174
176
|
export const dragCarousel = (element, options = {}) => {
|
|
175
177
|
options = {
|
|
176
|
-
|
|
178
|
+
activeAttribute: 'data-grabbing',
|
|
177
179
|
...options
|
|
178
180
|
}
|
|
179
181
|
|
|
@@ -188,7 +190,7 @@ export const dragCarousel = (element, options = {}) => {
|
|
|
188
190
|
|
|
189
191
|
const endGrabbing = () => {
|
|
190
192
|
isDown = false
|
|
191
|
-
element.
|
|
193
|
+
element.removeAttribute(options.activeAttribute)
|
|
192
194
|
|
|
193
195
|
scrollTo(element, element._activeIndex)
|
|
194
196
|
|
|
@@ -209,13 +211,13 @@ export const dragCarousel = (element, options = {}) => {
|
|
|
209
211
|
scrollLeft = element.scrollLeft
|
|
210
212
|
})
|
|
211
213
|
|
|
212
|
-
element.addEventListener('mousemove', e => {
|
|
214
|
+
element.addEventListener('mousemove', (e) => {
|
|
213
215
|
if (!isDown) return
|
|
214
216
|
e.preventDefault()
|
|
215
217
|
|
|
216
218
|
const x = e.pageX - element.offsetLeft
|
|
217
219
|
|
|
218
|
-
element.
|
|
220
|
+
element.setAttribute(options.activeAttribute, '')
|
|
219
221
|
element.style.scrollSnapType = 'unset'
|
|
220
222
|
element.scroll({ left: scrollLeft - ((x - startX) * 1.25), behavior: 'instant' })
|
|
221
223
|
element.ondragstart = e => e.preventDefault()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.x-check {
|
|
2
|
-
|
|
2
|
+
:user-invalid {
|
|
3
3
|
--x-check-border-color: var(--x-check-invalid-border-color, var(--color-error));
|
|
4
4
|
--x-check-outline-color: var(--x-check-invalid-outline-color, var(--color-error));
|
|
5
5
|
--x-check-background-color: var(--x-check-invalid-background-color, var(--color-error));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
--x-check-size: 1.25rem;
|
|
3
3
|
--x-check-icon-size: 1.125rem;
|
|
4
4
|
--x-check-icon: var(--mask-check);
|
|
5
|
-
--x-check-gap: var(--spacing-
|
|
5
|
+
--x-check-gap: var(--spacing-3);
|
|
6
6
|
--x-check-font-size: var(--font-size-sm);
|
|
7
7
|
--x-check-line-height: calc(1em + 0.25rem);
|
|
8
8
|
--x-check-border-radius: var(--radius-md);
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&:focus-visible {
|
|
22
|
-
--x-color-outline-color-opacity: var(--x-color-focus-outline-color-opacity,
|
|
22
|
+
--x-color-outline-color-opacity: var(--x-color-focus-outline-color-opacity, 100%);
|
|
23
23
|
--x-color-outline-offset: var(--x-color-focus-outline-offset, 3px);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
>
|
|
44
|
+
> .x-button {
|
|
45
45
|
inset-inline-start: var(--x-compare-position);
|
|
46
|
-
margin-inline-start: calc(var(--x-button-
|
|
46
|
+
margin-inline-start: calc(var(--x-button-inline-size) / 2 * -1);
|
|
47
47
|
margin-block: auto;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
>
|
|
50
|
+
> .x-image {
|
|
51
51
|
display: grid;
|
|
52
52
|
z-index: 0;
|
|
53
53
|
|
|
@@ -3,6 +3,6 @@ export interface SetPositionOptions {
|
|
|
3
3
|
positionProperty?: string
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export function setPosition(
|
|
7
|
-
export function setKeyboardStep(
|
|
8
|
-
export function setMouseStep(
|
|
6
|
+
export function setPosition(element: HTMLInputElement, options?: SetPositionOptions): void
|
|
7
|
+
export function setKeyboardStep(element: HTMLInputElement, key: string, step?: string): void
|
|
8
|
+
export function setMouseStep(element: HTMLInputElement, step?: string): void
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {
|
|
2
|
+
* @param {HTMLInputElement} element
|
|
3
3
|
* @param {import("./").SetPositionOptions} options
|
|
4
4
|
* @returns void
|
|
5
5
|
*/
|
|
6
|
-
export const setPosition = (
|
|
6
|
+
export const setPosition = (element, options = {}) => {
|
|
7
7
|
const { selector, positionProperty } = {
|
|
8
8
|
selector: '.x-compare',
|
|
9
9
|
positionProperty: '--x-compare-position',
|
|
10
10
|
...options
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
element?.closest(selector)?.style.setProperty(positionProperty, `${element.value}%`)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {HTMLInputElement} element
|
|
18
|
+
* @param {string} key
|
|
18
19
|
* @param {string} step
|
|
19
20
|
* @returns void
|
|
20
21
|
*/
|
|
21
|
-
export const setKeyboardStep = (
|
|
22
|
+
export const setKeyboardStep = (element, key, step = '10') => {
|
|
22
23
|
if (key?.toLowerCase() !== 'arrowright' && key?.toLowerCase() !== 'arrowleft') return
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
element.step = step
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* @param {
|
|
29
|
+
* @param {HTMLInputElement} element
|
|
29
30
|
* @param {string} step
|
|
30
31
|
* @returns void
|
|
31
32
|
*/
|
|
32
|
-
export const setMouseStep = (
|
|
33
|
-
|
|
33
|
+
export const setMouseStep = (element, step = '0.1') => {
|
|
34
|
+
element.step = step
|
|
34
35
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
.x-control {
|
|
2
2
|
> :where(input) {
|
|
3
3
|
&::-webkit-color-swatch-wrapper {
|
|
4
|
-
inline-size: var(--x-control-color-swatch-
|
|
5
|
-
block-size: var(--x-control-color-swatch-
|
|
4
|
+
inline-size: var(--x-control-color-swatch-inline-size);
|
|
5
|
+
block-size: var(--x-control-color-swatch-block-size);
|
|
6
6
|
padding: 0;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
&::-moz-color-swatch {
|
|
10
|
-
inline-size: var(--x-control-color-swatch-
|
|
11
|
-
block-size: var(--x-control-color-swatch-
|
|
10
|
+
inline-size: var(--x-control-color-swatch-inline-size);
|
|
11
|
+
block-size: var(--x-control-color-swatch-block-size);
|
|
12
12
|
border-radius: var(--x-control-color-swatch-border-radius);
|
|
13
13
|
margin: 0;
|
|
14
14
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
&[type="color"] ~ label {
|
|
21
|
-
margin-inline-start: calc(var(--x-control-padding-inline) + var(--x-control-color-swatch-
|
|
21
|
+
margin-inline-start: calc(var(--x-control-padding-inline) + var(--x-control-color-swatch-inline-size));
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.x-control {
|
|
2
2
|
display: grid;
|
|
3
|
-
block-size: var(--x-control-
|
|
3
|
+
block-size: var(--x-control-block-size);
|
|
4
4
|
font-family: var(--x-control-font-family);
|
|
5
5
|
font-weight: var(--x-control-font-weight);
|
|
6
6
|
font-size: var(--x-control-font-size);
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
> :where(input, textarea, select) {
|
|
49
|
-
padding-block: var(--x-control-padding-block);
|
|
49
|
+
padding-block: var(--x-control-padding-block-start, var(--x-control-padding-block)) var(--x-control-padding-block-end, var(--x-control-padding-block));
|
|
50
50
|
padding-inline: calc(var(--x-control-padding-inline) + var(--x-control-padding-inline-start, 0px)) calc(var(--x-control-padding-inline) + var(--x-control-padding-inline-end, 0px));
|
|
51
51
|
grid-area: x-control;
|
|
52
52
|
text-overflow: ellipsis;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
> :where(textarea) {
|
|
71
|
-
min-block-size: var(--x-control-
|
|
71
|
+
min-block-size: var(--x-control-block-size-textarea);
|
|
72
72
|
resize: vertical;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
var(--x-control-file-background-color, currentColor) var(--x-control-file-background-color-opacity, 15%),
|
|
11
11
|
var(--x-control-file-background-color-mix, transparent)
|
|
12
12
|
);
|
|
13
|
-
block-size: calc(var(--x-control-
|
|
13
|
+
block-size: calc(var(--x-control-block-size) - var(--x-control-border-width) * 2);
|
|
14
14
|
padding-inline: var(--x-control-padding-inline);
|
|
15
15
|
margin-inline: calc(var(--x-control-padding-inline) * -1) var(--x-control-padding-inline);
|
|
16
16
|
margin-block-start: calc(var(--x-control-padding-block) * -1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.x-control {
|
|
2
|
-
|
|
2
|
+
&:has(:user-invalid) {
|
|
3
3
|
--x-control-background-color: var(--x-control-invalid-background-color, var(--color-error));
|
|
4
4
|
--x-control-background-color-opacity: var(--x-control-invalid-background-color-opacity, 10%);
|
|
5
5
|
--x-control-border-color: var(--x-control-invalid-border-color, var(--color-error));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
:root, :host {
|
|
2
|
-
--x-control-
|
|
3
|
-
--x-control-
|
|
2
|
+
--x-control-block-size: 3rem;
|
|
3
|
+
--x-control-block-size-textarea: 8rem;
|
|
4
4
|
--x-control-padding-inline: 0.75rem;
|
|
5
5
|
--x-control-padding-block: 0.75rem;
|
|
6
6
|
--x-control-border-width: 1px;
|
|
7
7
|
--x-control-border-radius: var(--radius);
|
|
8
8
|
--x-control-border-color: currentColor;
|
|
9
9
|
--x-control-font-weight: var(--font-weight-medium);
|
|
10
|
-
--x-control-font-size: var(--font-size-
|
|
10
|
+
--x-control-font-size: var(--font-size-base);
|
|
11
11
|
--x-control-background-color: transparent;
|
|
12
12
|
--x-control-color: currentColor;
|
|
13
13
|
--x-control-outline-width: 3px;
|
|
@@ -19,7 +19,7 @@ export const showDetails = async (element, options = {}) => {
|
|
|
19
19
|
|
|
20
20
|
const details = element.closest(options.selector)
|
|
21
21
|
const { down } = await import('slide-element')
|
|
22
|
-
const content =
|
|
22
|
+
const content = details.querySelector(options.summarySelector).nextElementSibling
|
|
23
23
|
|
|
24
24
|
details._isHiding = false
|
|
25
25
|
details.open = true
|
|
@@ -42,7 +42,7 @@ export const closeDetails = async (element, options = {}) => {
|
|
|
42
42
|
|
|
43
43
|
const details = element.closest(options.selector)
|
|
44
44
|
const { up } = await import('slide-element')
|
|
45
|
-
const content =
|
|
45
|
+
const content = details.querySelector(options.summarySelector).nextElementSibling
|
|
46
46
|
|
|
47
47
|
details._isHiding = true
|
|
48
48
|
|
|
@@ -7,8 +7,9 @@ export const defaultOptions = {
|
|
|
7
7
|
closedAttribute: 'data-closed',
|
|
8
8
|
openAttribute: 'data-open',
|
|
9
9
|
scrollbarWidthProperty: '--default-scrollbar-width',
|
|
10
|
+
contentSelector: '.x-dialog-content',
|
|
10
11
|
closable: true,
|
|
11
|
-
|
|
12
|
+
modal: true
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -26,7 +27,7 @@ export const showDialog = async (element, options = {}) => {
|
|
|
26
27
|
document.documentElement.style.setProperty(options.scrollbarWidthProperty, `${window.innerWidth - document.body.clientWidth}px`)
|
|
27
28
|
|
|
28
29
|
if (!element?._dialogHasEvents) {
|
|
29
|
-
element.addEventListener('cancel', e => {
|
|
30
|
+
element.addEventListener('cancel', (e) => {
|
|
30
31
|
e.preventDefault()
|
|
31
32
|
options.closable && closeDialog(element, options)
|
|
32
33
|
})
|
|
@@ -42,11 +43,11 @@ export const showDialog = async (element, options = {}) => {
|
|
|
42
43
|
|
|
43
44
|
element.setAttribute(options.closedAttribute, '')
|
|
44
45
|
|
|
45
|
-
element.showModal()
|
|
46
|
+
options.modal ? element.showModal() : element.show()
|
|
46
47
|
element.scroll(0, 0)
|
|
47
48
|
|
|
48
49
|
element.removeAttribute(options.closedAttribute)
|
|
49
|
-
await animationsFinished(element.
|
|
50
|
+
await animationsFinished(element.querySelector(options.contentSelector))
|
|
50
51
|
element.setAttribute(options.openAttribute, '')
|
|
51
52
|
|
|
52
53
|
element.dispatchEvent(new CustomEvent('x-dialog:show'))
|
|
@@ -64,13 +65,14 @@ export const closeDialog = async (element, options = {}) => {
|
|
|
64
65
|
...options
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
element.dispatchEvent(new CustomEvent('x-dialog:close'))
|
|
69
|
+
|
|
67
70
|
element.removeAttribute(options.openAttribute)
|
|
68
71
|
element.setAttribute(options.closedAttribute, '')
|
|
69
72
|
|
|
70
|
-
await animationsFinished(element.
|
|
73
|
+
await animationsFinished(element.querySelector(options.contentSelector))
|
|
71
74
|
|
|
72
75
|
element.close()
|
|
73
76
|
|
|
74
|
-
element.dispatchEvent(new CustomEvent('x-dialog:close'))
|
|
75
77
|
options.remove && element.remove()
|
|
76
78
|
}
|