winduum 2.0.0-next.2 → 2.0.0-next.20
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/dist/test.css +1 -0
- package/package.json +15 -15
- package/plugin/index.cjs +81 -43
- package/plugin/utilities/common.js +2 -2
- package/plugin/utilities/dot.js +3 -3
- package/src/base/breakpoints-tw.css +12 -0
- package/src/base/config/transition.css +5 -1
- package/src/base/config/tw.css +30 -0
- package/src/base/defaults-tw.css +9 -0
- package/src/base/defaults.css +1 -11
- package/src/base/index.css +2 -0
- package/src/base/reset.css +0 -1
- package/src/base/theme/default-tw.css +26 -0
- package/src/base/transitions.css +11 -0
- 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 +1 -1
- package/src/components/badge/sm.css +1 -1
- package/src/components/badge/square.css +1 -1
- package/src/components/breadcrumb/default.css +1 -1
- package/src/components/button/bordered.css +1 -1
- package/src/components/button/circle.css +1 -1
- package/src/components/button/default.css +2 -2
- package/src/components/button/interactive.css +13 -11
- package/src/components/button/lg.css +1 -1
- package/src/components/button/props/default.css +1 -1
- package/src/components/button/sm.css +1 -1
- package/src/components/button/square.css +1 -1
- package/src/components/carousel/index.d.ts +3 -3
- package/src/components/carousel/index.js +13 -11
- package/src/components/check/default.css +2 -2
- package/src/components/check/invalid.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 +1 -1
- 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/content.css +1 -1
- package/src/components/dialog/default.css +2 -2
- package/src/components/dialog/index.d.ts +3 -2
- package/src/components/dialog/index.js +15 -14
- 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 +1 -1
- package/src/components/form/index.d.ts +4 -4
- package/src/components/form/index.js +11 -10
- package/src/components/group/default.css +1 -1
- package/src/components/image/default.css +1 -1
- package/src/components/popover/content.css +2 -2
- package/src/components/popover/index.d.ts +5 -1
- package/src/components/popover/index.js +11 -9
- package/src/components/range/default.css +4 -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/index.css +1 -1
- package/src/components/tabs/list.css +8 -0
- package/src/components/tabs/readme.md +1 -1
- package/src/components/text/default.css +2 -2
- package/src/components/toast/content.css +0 -5
- package/src/components/toast/default.css +3 -3
- package/src/components/toaster/default.css +4 -0
- package/src/components/toaster/index.d.ts +2 -17
- package/src/components/toaster/index.js +4 -56
- package/src/tailwind.css +4 -1
- package/src/test.css +7 -0
- package/src/utilities/animation.css +4 -0
- package/src/utilities/dot.css +10 -0
- package/src/utilities/view-transition.css +3 -0
- package/tailwind.config.js +4 -1
- package/types/index.d.ts +45 -28
- package/types/index.d.ts.map +3 -5
- package/src/base/tailwind.css +0 -3
- package/src/components/tabs/default.css +0 -8
package/src/base/reset.css
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@theme {
|
|
2
|
+
--default-color-space: sRGB;
|
|
3
|
+
--default-color-scheme: light;
|
|
4
|
+
--color-accent: var(--color-primary);
|
|
5
|
+
--color-accent-foreground: var(--color-primary-foreground);
|
|
6
|
+
--color-primary: #3b82f6; /* color.blue.500 */
|
|
7
|
+
--color-primary-foreground: var(--color-light);
|
|
8
|
+
--color-main: #171717; /* color.neutral.900 */
|
|
9
|
+
--color-main-foreground: var(--color-body);
|
|
10
|
+
--color-main-primary: var(--color-main);
|
|
11
|
+
--color-main-secondary: color-mix(in var(--default-color-space), var(--color-main) 75%, var(--color-main-foreground));
|
|
12
|
+
--color-main-tertiary: color-mix(in var(--default-color-space), var(--color-main) 50%, var(--color-main-foreground));
|
|
13
|
+
--color-body: #fff; /* color.white */
|
|
14
|
+
--color-body-foreground: var(--color-main);
|
|
15
|
+
--color-body-primary: var(--color-body);
|
|
16
|
+
--color-body-secondary: color-mix(in var(--default-color-space), var(--color-body) 95%, var(--color-body-foreground));
|
|
17
|
+
--color-body-tertiary: color-mix(in var(--default-color-space), var(--color-body) 90%, var(--color-body-foreground));
|
|
18
|
+
--color-light: #fff; /* color.white */
|
|
19
|
+
--color-light-foreground: var(--color-dark);
|
|
20
|
+
--color-dark: #171717; /* color.neutral.900 */
|
|
21
|
+
--color-dark-foreground: var(--color-light);
|
|
22
|
+
--color-success: #16a34a; /* color.green.600 */
|
|
23
|
+
--color-error: #dc2626; /* color.red.600 */
|
|
24
|
+
--color-warning: #eab308; /* color.yellow.500 */
|
|
25
|
+
--color-info: #0ea5e9; /* color.sky.500 */
|
|
26
|
+
}
|
|
@@ -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);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
> li {
|
|
9
9
|
&:not(:last-child)::after {
|
|
10
10
|
mask: var(--x-breadcrumb-marker);
|
|
11
|
-
background-color: var(--x-breadcrumb-background-color, currentColor);
|
|
11
|
+
background-color: var(--x-breadcrumb-marker-background-color, currentColor);
|
|
12
12
|
margin-inline: var(--x-breadcrumb-gap);
|
|
13
13
|
inline-size: var(--x-breadcrumb-marker-size);
|
|
14
14
|
block-size: var(--x-breadcrumb-marker-size);
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
--x-button-hover-color: var(--color-accent);
|
|
14
14
|
--x-button-focus-outline-offset: 0px;
|
|
15
15
|
--x-button-border-width: 1px;
|
|
16
|
-
--x-button-border-color-opacity:
|
|
16
|
+
--x-button-border-color-opacity: 100%;
|
|
17
17
|
--x-button-background-color-opacity: 0%;
|
|
18
18
|
--x-button-color: var(--color-accent);
|
|
19
19
|
}
|
|
@@ -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);
|
|
@@ -10,17 +10,19 @@
|
|
|
10
10
|
--x-button-hover-background-color-mix: var(--color-accent-foreground);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
&:is(button, input, :any-link, [role="button"]) {
|
|
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 {
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
--x-button-outline-color-opacity: var(--x-button-focus-outline-color-opacity);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
&:active, &:checked,
|
|
34
|
+
&:active, &:checked, &.active {
|
|
33
35
|
--x-button-background-color: var(--x-button-hover-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);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
--x-button-font-size: var(--font-size-sm);
|
|
6
6
|
--x-button-font-weight: var(--font-weight-medium);
|
|
7
7
|
--x-button-gap: var(--spacing-sm);
|
|
8
|
-
--x-button-
|
|
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,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: 'visible',
|
|
55
55
|
observerOptions: {},
|
|
56
56
|
...options
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
element._observer = new IntersectionObserver(entries => {
|
|
60
60
|
entries.forEach(entry => {
|
|
61
|
-
entry.target.
|
|
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) {
|
|
@@ -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
|
})
|
|
@@ -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
|
|
|
@@ -215,7 +217,7 @@ export const dragCarousel = (element, options = {}) => {
|
|
|
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()
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
flex-shrink: 0;
|
|
45
45
|
|
|
46
46
|
&::before {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
inline-size: var(--x-check-icon-size);
|
|
48
|
+
block-size: var(--x-check-icon-size);
|
|
49
49
|
color: var(--x-check-icon-color);
|
|
50
50
|
mask: var(--x-check-icon);
|
|
51
51
|
transition: inherit;
|
|
@@ -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));
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
display: flex;
|
|
12
12
|
position: fixed;
|
|
13
13
|
inset: 0;
|
|
14
|
-
overflow:
|
|
14
|
+
overflow: auto;
|
|
15
15
|
overscroll-behavior: contain;
|
|
16
16
|
-webkit-overflow-scrolling: touch;
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
display: none;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
&[data-closed] {
|
|
23
23
|
background-color: transparent;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -4,9 +4,11 @@ import { animationsFinished } from '../../common.js'
|
|
|
4
4
|
* @type {import("./").DefaultOptions}
|
|
5
5
|
*/
|
|
6
6
|
export const defaultOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
closedAttribute: 'data-closed',
|
|
8
|
+
openAttribute: 'data-open',
|
|
9
9
|
scrollbarWidthProperty: '--default-scrollbar-width',
|
|
10
|
+
contentSelector: '.x-dialog-content',
|
|
11
|
+
closable: true,
|
|
10
12
|
remove: false
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -18,7 +20,6 @@ export const defaultOptions = {
|
|
|
18
20
|
*/
|
|
19
21
|
export const showDialog = async (element, options = {}) => {
|
|
20
22
|
options = {
|
|
21
|
-
closable: true,
|
|
22
23
|
...defaultOptions,
|
|
23
24
|
...options
|
|
24
25
|
}
|
|
@@ -40,14 +41,15 @@ export const showDialog = async (element, options = {}) => {
|
|
|
40
41
|
element._dialogHasEvents = true
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
? element.showModal()
|
|
45
|
-
: element.setAttribute('open', '')
|
|
44
|
+
element.setAttribute(options.closedAttribute, '')
|
|
46
45
|
|
|
46
|
+
element.showModal()
|
|
47
47
|
element.scroll(0, 0)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
element.
|
|
48
|
+
|
|
49
|
+
element.removeAttribute(options.closedAttribute)
|
|
50
|
+
await animationsFinished(element.querySelector(options.contentSelector))
|
|
51
|
+
element.setAttribute(options.openAttribute, '')
|
|
52
|
+
|
|
51
53
|
element.dispatchEvent(new CustomEvent('x-dialog:show'))
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -63,13 +65,12 @@ export const closeDialog = async (element, options = {}) => {
|
|
|
63
65
|
...options
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
element.
|
|
68
|
+
element.removeAttribute(options.openAttribute)
|
|
69
|
+
element.setAttribute(options.closedAttribute, '')
|
|
67
70
|
|
|
68
|
-
await animationsFinished(element.
|
|
71
|
+
await animationsFinished(element.querySelector(options.contentSelector))
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
? element.close()
|
|
72
|
-
: element.removeAttribute('open')
|
|
73
|
+
element.close()
|
|
73
74
|
|
|
74
75
|
element.dispatchEvent(new CustomEvent('x-dialog:close'))
|
|
75
76
|
options.remove && element.remove()
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
scrollbar-width: none;
|
|
14
14
|
scroll-behavior: smooth;
|
|
15
15
|
-webkit-overflow-scrolling: touch;
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
|
|
18
|
+
&:not([open]), &::backdrop {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
16
21
|
|
|
17
22
|
&::-webkit-scrollbar {
|
|
18
23
|
display: none;
|
|
@@ -20,14 +25,10 @@
|
|
|
20
25
|
|
|
21
26
|
&::after {
|
|
22
27
|
content: "";
|
|
23
|
-
min-
|
|
28
|
+
min-inline-size: 100vw;
|
|
24
29
|
scroll-snap-align: end;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
&[inert] {
|
|
28
|
-
pointer-events: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
32
|
&.flex-col {
|
|
32
33
|
overflow: hidden auto;
|
|
33
34
|
|
|
@@ -10,4 +10,5 @@ export interface ScrollDrawerOptions {
|
|
|
10
10
|
|
|
11
11
|
export function showDrawer(element: HTMLElement | Element, distance?: number, direction?: 'left' | 'top'): void
|
|
12
12
|
export function closeDrawer(element: HTMLElement | Element, distance?: number, direction?: 'left' | 'top'): void
|
|
13
|
-
export function
|
|
13
|
+
export function scrollInitDrawer(element: HTMLElement | Element, distance?: number, direction?: 'left' | 'top'): void
|
|
14
|
+
export function scrollDrawer(element: HTMLDialogElement | Element, options?: ScrollDrawerOptions): void
|