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.
Files changed (141) hide show
  1. package/dist/main.css +1 -1
  2. package/dist/tailwind.css +1 -1
  3. package/package.json +23 -17
  4. package/plugin/index.cjs +80 -110
  5. package/plugin/index.d.ts +9 -9
  6. package/plugin/index.js +46 -94
  7. package/plugin/utilities/common.js +44 -5
  8. package/src/base/defaults.css +6 -12
  9. package/src/base/index.css +1 -4
  10. package/src/base/keyframes.css +0 -17
  11. package/src/base/reset.css +0 -1
  12. package/src/base/transitions.css +15 -0
  13. package/src/common.js +1 -1
  14. package/src/components/badge/circle.css +1 -1
  15. package/src/components/badge/default.css +2 -2
  16. package/src/components/badge/lg.css +1 -1
  17. package/src/components/badge/props/default.css +2 -2
  18. package/src/components/badge/sm.css +1 -1
  19. package/src/components/badge/square.css +1 -1
  20. package/src/components/breadcrumb/props/default.css +1 -1
  21. package/src/components/button/bordered.css +1 -4
  22. package/src/components/button/circle.css +1 -1
  23. package/src/components/button/default.css +2 -2
  24. package/src/components/button/index.css +1 -0
  25. package/src/components/button/interactive.css +15 -13
  26. package/src/components/button/lg.css +1 -1
  27. package/src/components/button/props/default.css +2 -2
  28. package/src/components/button/sm.css +1 -1
  29. package/src/components/button/spinner.css +9 -0
  30. package/src/components/button/square.css +1 -1
  31. package/src/components/card/props/default.css +2 -2
  32. package/src/components/carousel/index.d.ts +3 -3
  33. package/src/components/carousel/index.js +18 -16
  34. package/src/components/check/invalid.css +1 -1
  35. package/src/components/check/props/default.css +1 -1
  36. package/src/components/color/interactive.css +1 -1
  37. package/src/components/color/props/default.css +0 -1
  38. package/src/components/compare/default.css +3 -3
  39. package/src/components/compare/index.d.ts +3 -3
  40. package/src/components/compare/index.js +10 -9
  41. package/src/components/control/color.css +5 -5
  42. package/src/components/control/default.css +3 -3
  43. package/src/components/control/file.css +1 -1
  44. package/src/components/control/invalid.css +1 -1
  45. package/src/components/control/props/color.css +2 -2
  46. package/src/components/control/props/default.css +3 -3
  47. package/src/components/control/select-multiple.css +1 -1
  48. package/src/components/details/index.js +2 -2
  49. package/src/components/dialog/index.d.ts +2 -0
  50. package/src/components/dialog/index.js +8 -6
  51. package/src/components/drawer/default.css +6 -5
  52. package/src/components/drawer/index.d.ts +2 -1
  53. package/src/components/drawer/index.js +15 -1
  54. package/src/components/drawer/props/content.css +1 -1
  55. package/src/components/field/default.css +2 -2
  56. package/src/components/form/index.d.ts +5 -4
  57. package/src/components/form/index.js +15 -13
  58. package/src/components/group/default.css +1 -1
  59. package/src/components/pagination/default.css +1 -1
  60. package/src/components/popover/content.css +7 -11
  61. package/src/components/popover/index.d.ts +6 -1
  62. package/src/components/popover/index.js +12 -10
  63. package/src/components/popover/props/content.css +2 -2
  64. package/src/components/progress/default.css +3 -3
  65. package/src/components/progress/index.css +1 -0
  66. package/src/components/progress/keyframes/default.css +9 -0
  67. package/src/components/progress/props/default.css +0 -2
  68. package/src/components/range/index.d.ts +1 -0
  69. package/src/components/range/index.js +5 -4
  70. package/src/components/rating/default.css +8 -0
  71. package/src/components/rating/invalid.css +1 -1
  72. package/src/components/rating/props/default.css +0 -1
  73. package/src/components/switch/invalid.css +1 -1
  74. package/src/components/tabs/list.css +2 -2
  75. package/src/components/text/props/default.css +1 -1
  76. package/src/components/toast/content.css +0 -5
  77. package/src/components/toast/default.css +3 -3
  78. package/src/components/toast/index.d.ts +14 -0
  79. package/src/components/toast/index.js +51 -0
  80. package/src/components/toast/props/content.css +3 -3
  81. package/src/components/toaster/default.css +4 -0
  82. package/src/components/toaster/index.d.ts +1 -25
  83. package/src/components/toaster/index.js +1 -103
  84. package/src/components/toaster/props/default.css +2 -2
  85. package/src/components/tooltip/props/default.css +4 -4
  86. package/src/main.css +3 -0
  87. package/src/tailwind.css +4 -2
  88. package/src/test.css +9 -0
  89. package/src/{base → theme}/config/font.css +17 -1
  90. package/src/theme/config/index.css +6 -0
  91. package/src/theme/config/spacing.css +37 -0
  92. package/src/{base → theme}/config/transition.css +5 -1
  93. package/src/theme/index.css +4 -0
  94. package/src/utilities/animation.css +4 -0
  95. package/src/utilities/container/default.css +2 -2
  96. package/src/utilities/container/props/default.css +2 -2
  97. package/src/utilities/divider.css +1 -1
  98. package/src/utilities/dot.css +10 -0
  99. package/src/utilities/index.css +2 -1
  100. package/src/utilities/ripple/default.css +16 -0
  101. package/src/utilities/ripple/index.css +2 -15
  102. package/src/utilities/ripple/index.d.ts +7 -1
  103. package/src/utilities/ripple/index.js +13 -13
  104. package/src/utilities/ripple/keyframes/default.css +6 -0
  105. package/src/utilities/spinner/circle.css +5 -0
  106. package/src/utilities/spinner/default.css +16 -0
  107. package/src/utilities/spinner/index.css +4 -0
  108. package/src/utilities/spinner/keyframes/ring.css +13 -0
  109. package/src/utilities/spinner/ring.css +15 -0
  110. package/src/utilities/view-transition.css +3 -0
  111. package/tailwind.config.js +6 -5
  112. package/tailwindcss/base/defaults.css +9 -0
  113. package/tailwindcss/index.css +4 -0
  114. package/tailwindcss/theme/config/breakpoint.css +12 -0
  115. package/tailwindcss/theme/config/font.css +13 -0
  116. package/tailwindcss/theme/config/index.css +6 -0
  117. package/tailwindcss/theme/config/mask.css +8 -0
  118. package/tailwindcss/theme/config/radius.css +9 -0
  119. package/tailwindcss/theme/config/transition.css +20 -0
  120. package/tailwindcss/theme/config/z.css +7 -0
  121. package/tailwindcss/theme/default.css +26 -0
  122. package/tailwindcss/theme/index.css +2 -0
  123. package/tailwindcss/utilities/animation.css +0 -0
  124. package/tailwindcss/utilities/divide-gap.css +0 -0
  125. package/types/index.d.ts +50 -39
  126. package/types/index.d.ts.map +7 -5
  127. package/dist/assets/index-xIgNpv_7.css +0 -1
  128. package/dist/index.html +0 -16
  129. package/dist/main-rgb.css +0 -1
  130. package/src/base/config/spacing.css +0 -15
  131. package/src/base/config.css +0 -6
  132. package/src/base/tailwind.css +0 -3
  133. package/src/utilities/common.css +0 -8
  134. /package/src/{base → theme}/config/mask.css +0 -0
  135. /package/src/{base/config/rounded.css → theme/config/radius.css} +0 -0
  136. /package/src/{base → theme}/config/z.css +0 -0
  137. /package/src/{base/theme → theme}/dark-rgb.css +0 -0
  138. /package/src/{base/theme → theme}/dark.css +0 -0
  139. /package/src/{base/theme → theme}/default-p3.css +0 -0
  140. /package/src/{base/theme → theme}/default-rgb.css +0 -0
  141. /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-width);
7
- block-size: var(--x-badge-height);
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);
@@ -1,3 +1,3 @@
1
1
  .x-badge:is(.lg) {
2
- --x-badge-height: 1.75rem;
2
+ --x-badge-block-size: 1.75rem;
3
3
  }
@@ -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-xs);
6
- --x-badge-height: 1.5rem;
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,4 +1,4 @@
1
1
  .x-badge:is(.sm) {
2
- --x-badge-height: 1.25rem;
2
+ --x-badge-block-size: 1.25rem;
3
3
  --x-badge-font-size: var(--font-size-xs);
4
4
  }
@@ -1,4 +1,4 @@
1
1
  .x-badge:is(.square) {
2
2
  --x-badge-padding-inline: var(--x-badge-padding-block);
3
- --x-badge-width: var(--x-badge-height);
3
+ --x-badge-inline-size: var(--x-badge-block-size);
4
4
  }
@@ -1,5 +1,5 @@
1
1
  :root, :host {
2
2
  --x-breadcrumb-marker-size: 0.875rem;
3
3
  --x-breadcrumb-marker: var(--mask-chevron-right);
4
- --x-breadcrumb-gap: var(--spacing-xs);
4
+ --x-breadcrumb-gap: var(--spacing-1);
5
5
  }
@@ -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: 30%;
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
  }
@@ -1,6 +1,6 @@
1
1
  .x-button:is(.circle) {
2
2
  --x-button-padding-block: 0;
3
3
  --x-button-padding-inline: 0;
4
- --x-button-width: var(--x-button-height);
4
+ --x-button-inline-size: var(--x-button-block-size);
5
5
  --x-button-border-radius: var(--radius-full);
6
6
  }
@@ -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-width);
7
- block-size: var(--x-button-height);
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);
@@ -11,3 +11,4 @@
11
11
  @import "fill.css";
12
12
  @import "square.css";
13
13
  @import "circle.css";
14
+ @import "spinner.css";
@@ -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
- --x-button-background-color: var(--x-button-hover-background-color, var(--color-accent));
16
- --x-button-background-color-mix: var(--x-button-hover-background-color-mix);
17
- --x-button-background-color-opacity: var(--x-button-hover-background-color-opacity);
18
- --x-button-border-color: var(--x-button-hover-border-color, var(--color-accent));
19
- --x-button-border-color-mix: var(--x-button-hover-border-color-mix, transparent);
20
- --x-button-border-color-opacity: var(--x-button-hover-border-color-opacity, 100%);
21
- --x-button-color: var(--x-button-hover-color, var(--color-accent-foreground));
22
- --x-button-color-mix: var(--x-button-hover-color-mix, transparent);
23
- --x-button-color-opacity: var(--x-button-hover-color-opacity, 100%);
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-hover-background-color, var(--color-accent));
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));
@@ -1,4 +1,4 @@
1
1
  .x-button:is(.lg) {
2
- --x-button-height: 3rem;
2
+ --x-button-block-size: 3rem;
3
3
  --x-button-padding-inline: 1.75rem;
4
4
  }
@@ -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-sm);
8
- --x-button-height: 2.25rem;
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,4 +1,4 @@
1
1
  .x-button:is(.sm) {
2
- --x-button-height: 2rem;
2
+ --x-button-block-size: 2rem;
3
3
  --x-button-padding-inline: 1rem;
4
4
  }
@@ -0,0 +1,9 @@
1
+ .x-button:has(.spinner-absolute) {
2
+ pointer-events: none;
3
+ color: transparent;
4
+
5
+ .spinner-absolute {
6
+ color: var(--x-button-color);
7
+ position: absolute;
8
+ }
9
+ }
@@ -1,5 +1,5 @@
1
1
  .x-button:is(.square) {
2
2
  --x-button-padding-block: 0;
3
3
  --x-button-padding-inline: 0;
4
- --x-button-width: var(--x-button-height);
4
+ --x-button-inline-size: var(--x-button-block-size);
5
5
  }
@@ -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-2xl);
5
- --x-card-padding-inline: var(--spacing-3xl);
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
- visibleClass?: string
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
- activeClass?: string
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
- activeClass?: string
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 void
50
+ * @returns IntersectionObserver
51
51
  */
52
52
  export const observeCarousel = (element, options = {}) => {
53
53
  options = {
54
- visibleClass: 'visible',
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.classList.toggle(options.visibleClass, entry.isIntersecting)
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.classList.contains(options.visibleClass))
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
- activeClass: 'active',
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.classList.remove(options.pagination.activeClass))
95
+ ;[...options.pagination.element.children].forEach(children => children.removeAttribute(options.pagination.activeAttribute))
94
96
 
95
- options.pagination.element.children[activeItem - 1]?.classList.add(options.pagination.activeClass)
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
- activeClass: 'active',
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.classList.add(options.activeClass)
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
- activeClass: 'grabbing',
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.classList.remove(options.activeClass)
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.classList.add(options.activeClass)
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
- &.invalid, :user-invalid, .validated & :invalid {
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-md);
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, 50%);
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
 
@@ -3,5 +3,4 @@
3
3
  --x-color-secondary: transparent;
4
4
  --x-color-size: 1.5rem;
5
5
  --x-color-border-radius: var(--radius-full);
6
- --x-color-outline-width: 1px;
7
6
  }
@@ -41,13 +41,13 @@
41
41
  }
42
42
  }
43
43
 
44
- > :where(.x-button) {
44
+ > .x-button {
45
45
  inset-inline-start: var(--x-compare-position);
46
- margin-inline-start: calc(var(--x-button-width) / 2 * -1);
46
+ margin-inline-start: calc(var(--x-button-inline-size) / 2 * -1);
47
47
  margin-block: auto;
48
48
  }
49
49
 
50
- > :where(.x-image) {
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(event: Event, options?: SetPositionOptions): void
7
- export function setKeyboardStep(event: KeyboardEvent, step?: string): void
8
- export function setMouseStep(event: MouseEvent, step?: string): void
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 {Event & { currentTarget: HTMLElement | Element }} event
2
+ * @param {HTMLInputElement} element
3
3
  * @param {import("./").SetPositionOptions} options
4
4
  * @returns void
5
5
  */
6
- export const setPosition = ({ currentTarget }, options = {}) => {
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
- currentTarget?.closest(selector)?.style.setProperty(positionProperty, `${currentTarget.value}%`)
13
+ element?.closest(selector)?.style.setProperty(positionProperty, `${element.value}%`)
14
14
  }
15
15
 
16
16
  /**
17
- * @param {KeyboardEvent & { currentTarget: HTMLInputElement | EventTarget }} event
17
+ * @param {HTMLInputElement} element
18
+ * @param {string} key
18
19
  * @param {string} step
19
20
  * @returns void
20
21
  */
21
- export const setKeyboardStep = ({ key, currentTarget }, step = '10') => {
22
+ export const setKeyboardStep = (element, key, step = '10') => {
22
23
  if (key?.toLowerCase() !== 'arrowright' && key?.toLowerCase() !== 'arrowleft') return
23
24
 
24
- currentTarget.step = step
25
+ element.step = step
25
26
  }
26
27
 
27
28
  /**
28
- * @param {MouseEvent & { currentTarget: HTMLInputElement | EventTarget }} event
29
+ * @param {HTMLInputElement} element
29
30
  * @param {string} step
30
31
  * @returns void
31
32
  */
32
- export const setMouseStep = ({ currentTarget }, step = '0.1') => {
33
- currentTarget.step = step
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-width);
5
- block-size: var(--x-control-color-swatch-height);
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-width);
11
- block-size: var(--x-control-color-swatch-height);
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-width));
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-height);
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-height-textarea);
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-height) - var(--x-control-border-width) * 2);
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
- &.invalid, &:has(:user-invalid), .validated &:has(:invalid) {
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,5 +1,5 @@
1
1
  :root, :host {
2
- --x-control-color-swatch-width: 1.25rem;
3
- --x-control-color-swatch-height: 1.25rem;
2
+ --x-control-color-swatch-inline-size: 1.25rem;
3
+ --x-control-color-swatch-block-size: 1.25rem;
4
4
  --x-control-color-swatch-border-radius: var(--radius-full);
5
5
  }
@@ -1,13 +1,13 @@
1
1
  :root, :host {
2
- --x-control-height: 3rem;
3
- --x-control-height-textarea: 8rem;
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-sm);
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;
@@ -1,5 +1,5 @@
1
1
  .x-control:has(select[multiple]) {
2
- --x-control-height: auto;
2
+ --x-control-block-size: auto;
3
3
 
4
4
  select {
5
5
  overflow-y: auto;
@@ -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 = element.closest(options.summarySelector).nextElementSibling
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 = element.closest(options.summarySelector).nextElementSibling
45
+ const content = details.querySelector(options.summarySelector).nextElementSibling
46
46
 
47
47
  details._isHiding = true
48
48
 
@@ -1,8 +1,10 @@
1
1
  export interface DefaultOptions {
2
2
  remove?: boolean | null
3
3
  closable?: boolean | null
4
+ modal?: boolean
4
5
  openAttribute?: string
5
6
  closedAttribute?: string
7
+ contentSelector?: string
6
8
  scrollbarWidthProperty?: string
7
9
  }
8
10
 
@@ -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
- remove: false
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.lastElementChild)
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.lastElementChild)
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
  }