winduum 2.2.28 → 3.0.0-next.2

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 (40) hide show
  1. package/package.json +7 -4
  2. package/src/base/reset.css +4 -0
  3. package/src/common.js +9 -1
  4. package/src/components/carousel/content.css +1 -0
  5. package/src/components/carousel/index.js +58 -192
  6. package/src/components/details/default.css +14 -0
  7. package/src/components/details/index.css +1 -0
  8. package/src/components/dialog/content.css +8 -2
  9. package/src/components/dialog/default.css +16 -2
  10. package/src/components/dialog/drawer.css +20 -0
  11. package/src/components/dialog/index.css +1 -0
  12. package/src/components/dialog/index.js +5 -80
  13. package/src/components/dialog/readme.md +1 -5
  14. package/src/components/drawer/content.css +2 -1
  15. package/src/components/drawer/default.css +13 -31
  16. package/src/components/drawer/index.css +3 -0
  17. package/src/components/drawer/index.js +68 -50
  18. package/src/components/drawer/keyframes/default.css +9 -0
  19. package/src/components/drawer/noscript.css +32 -0
  20. package/src/components/drawer/nosnap.css +32 -0
  21. package/src/components/drawer/props/content.css +2 -2
  22. package/src/components/drawer/props/default.css +6 -0
  23. package/src/components/drawer/scroller.css +32 -0
  24. package/src/components/index.css +1 -0
  25. package/src/components/popover/content.css +5 -94
  26. package/src/components/popover/default.css +15 -2
  27. package/src/components/popover/index.css +1 -0
  28. package/src/components/popover/index.d.ts +14 -18
  29. package/src/components/popover/index.js +40 -80
  30. package/src/components/popover/props/content.css +1 -2
  31. package/src/components/popover/props/default.css +4 -0
  32. package/src/components/popover/readme.md +1 -2
  33. package/src/components/tooltip/default.css +8 -8
  34. package/src/supports.js +10 -0
  35. package/tailwindcss/utilities/index.css +1 -0
  36. package/tailwindcss/utilities/position.css +179 -0
  37. package/types/index.d.ts +15 -46
  38. package/src/components/details/index.d.ts +0 -9
  39. package/src/components/details/index.js +0 -78
  40. package/src/components/dialog/index.d.ts +0 -13
@@ -26,8 +26,8 @@
26
26
  pointer-events: none;
27
27
  }
28
28
 
29
- &:where(.top),
30
- &:where(.bottom) {
29
+ &:where(.tooltip-top),
30
+ &:where(.tooltip-bottom) {
31
31
  &::before {
32
32
  --tw-translate-x: -50%;
33
33
 
@@ -36,8 +36,8 @@
36
36
  }
37
37
  }
38
38
 
39
- &:where(.left),
40
- &:where(.right) {
39
+ &:where(.tooltip-left),
40
+ &:where(.tooltip-right) {
41
41
  &::before {
42
42
  --tw-translate-y: -50%;
43
43
 
@@ -46,28 +46,28 @@
46
46
  }
47
47
  }
48
48
 
49
- &:where(.bottom) {
49
+ &:where(.tooltip-bottom) {
50
50
  &::before {
51
51
  inset-block-start: 100%;
52
52
  transform-origin: top;
53
53
  }
54
54
  }
55
55
 
56
- &:where(.top) {
56
+ &:where(.tooltip-top) {
57
57
  &::before {
58
58
  inset-block-end: 100%;
59
59
  transform-origin: bottom;
60
60
  }
61
61
  }
62
62
 
63
- &:where(.left) {
63
+ &:where(.tooltip-left) {
64
64
  &::before {
65
65
  inset-inline-end: 100%;
66
66
  transform-origin: right;
67
67
  }
68
68
  }
69
69
 
70
- &:where(.right) {
70
+ &:where(.tooltip-right) {
71
71
  &::before {
72
72
  inset-inline-start: 100%;
73
73
  transform-origin: left;
package/src/supports.js CHANGED
@@ -7,3 +7,13 @@ export const supportsTimelineTrigger = CSS.supports('timeline-trigger-name: --v'
7
7
  * @type {boolean}
8
8
  */
9
9
  export const supportsInterestFor = Object.prototype.hasOwnProperty.call(HTMLButtonElement.prototype, 'interestForElement')
10
+
11
+ /**
12
+ * @type {boolean}
13
+ */
14
+ export const supportsScrollInitialTarget = CSS.supports('scroll-initial-target', 'nearest')
15
+
16
+ /**
17
+ * @type {boolean}
18
+ */
19
+ export const supportsAnimationTimeline = CSS.supports('animation-timeline: scroll()')
@@ -8,6 +8,7 @@
8
8
  @import "./grid-area.css";
9
9
  @import "./grid-cols-container.css";
10
10
  @import "./link.css";
11
+ @import "./position.css";
11
12
  @import "./ripple.css";
12
13
  @import "./skeleton.css";
13
14
  @import "./spinner.css";
@@ -0,0 +1,179 @@
1
+ @utility bottom {
2
+ position-area: block-end center;
3
+ position-try-fallbacks: flip-block;
4
+
5
+ > * {
6
+ transform-origin: top;
7
+ }
8
+
9
+ @container anchored(fallback: flip-block) {
10
+ > * {
11
+ transform-origin: bottom;
12
+ }
13
+ }
14
+ }
15
+
16
+ @utility bottom-start {
17
+ position-area: block-end span-inline-end;
18
+ position-try-fallbacks: flip-block;
19
+
20
+ > * {
21
+ transform-origin: top left;
22
+ }
23
+
24
+ @container anchored(fallback: flip-block) {
25
+ > * {
26
+ transform-origin: bottom left;
27
+ }
28
+ }
29
+ }
30
+
31
+ @utility bottom-end {
32
+ position-area: block-end span-inline-start;
33
+ position-try-fallbacks: flip-block;
34
+
35
+ > * {
36
+ transform-origin: top right;
37
+ }
38
+
39
+ @container anchored(fallback: flip-block) {
40
+ > * {
41
+ transform-origin: bottom right;
42
+ }
43
+ }
44
+ }
45
+
46
+ @utility top {
47
+ position-area: block-start center;
48
+ position-try-fallbacks: flip-block;
49
+
50
+ > * {
51
+ transform-origin: bottom;
52
+ }
53
+
54
+ @container anchored(fallback: flip-block) {
55
+ > * {
56
+ transform-origin: top;
57
+ }
58
+ }
59
+ }
60
+
61
+ @utility top-start {
62
+ position-area: block-start span-inline-end;
63
+ position-try-fallbacks: flip-block;
64
+
65
+ > * {
66
+ transform-origin: bottom left;
67
+ }
68
+
69
+ @container anchored(fallback: flip-block) {
70
+ > * {
71
+ transform-origin: top left;
72
+ }
73
+ }
74
+ }
75
+
76
+ @utility top-end {
77
+ position-area: block-start span-inline-start;
78
+ position-try-fallbacks: flip-block;
79
+
80
+ > * {
81
+ transform-origin: bottom right;
82
+ }
83
+
84
+ @container anchored(fallback: flip-block) {
85
+ > * {
86
+ transform-origin: top right;
87
+ }
88
+ }
89
+ }
90
+
91
+ @utility left {
92
+ position-area: inline-start center;
93
+ position-try-fallbacks: flip-inline;
94
+
95
+ > * {
96
+ transform-origin: right;
97
+ }
98
+
99
+ @container anchored(fallback: flip-block) {
100
+ > * {
101
+ transform-origin: left;
102
+ }
103
+ }
104
+ }
105
+
106
+ @utility left-start {
107
+ position-area: inline-start span-block-end;
108
+ position-try-fallbacks: flip-inline;
109
+
110
+ > * {
111
+ transform-origin: right top;
112
+ }
113
+
114
+ @container anchored(fallback: flip-block) {
115
+ > * {
116
+ transform-origin: left top;
117
+ }
118
+ }
119
+ }
120
+
121
+ @utility left-end {
122
+ position-area: inline-start span-block-start;
123
+ position-try-fallbacks: flip-inline;
124
+
125
+ > * {
126
+ transform-origin: right bottom;
127
+ }
128
+
129
+ @container anchored(fallback: flip-block) {
130
+ > * {
131
+ transform-origin: left bottom;
132
+ }
133
+ }
134
+ }
135
+
136
+ @utility right {
137
+ position-area: inline-end center;
138
+ position-try-fallbacks: flip-inline;
139
+
140
+ > * {
141
+ transform-origin: left;
142
+ }
143
+
144
+ @container anchored(fallback: flip-block) {
145
+ > * {
146
+ transform-origin: right;
147
+ }
148
+ }
149
+ }
150
+
151
+ @utility right-start {
152
+ position-area: inline-end span-block-end;
153
+ position-try-fallbacks: flip-inline;
154
+
155
+ > * {
156
+ transform-origin: left top;
157
+ }
158
+
159
+ @container anchored(fallback: flip-block) {
160
+ > * {
161
+ transform-origin: right top;
162
+ }
163
+ }
164
+ }
165
+
166
+ @utility right-end {
167
+ position-area: inline-end span-block-start;
168
+ position-try-fallbacks: flip-inline;
169
+
170
+ > * {
171
+ transform-origin: left bottom;
172
+ }
173
+
174
+ @container anchored(fallback: flip-block) {
175
+ > * {
176
+ transform-origin: right bottom;
177
+ }
178
+ }
179
+ }
package/types/index.d.ts CHANGED
@@ -93,34 +93,7 @@ declare module 'winduum/src/components/compare' {
93
93
  export {};
94
94
  }
95
95
 
96
- declare module 'winduum/src/components/details' {
97
- export interface DefaultOptions {
98
- selector?: string
99
- summarySelector?: string
100
- }
101
-
102
- export const defaultOptions: DefaultOptions
103
- export function showDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
104
- export function closeDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
105
- export function toggleDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
106
-
107
- export {};
108
- }
109
-
110
96
  declare module 'winduum/src/components/dialog' {
111
- export interface DefaultOptions {
112
- remove?: boolean | null
113
- closable?: boolean | null
114
- modal?: boolean
115
- openAttribute?: string
116
- closedAttribute?: string
117
- contentSelector?: string
118
- scrollbarWidthProperty?: string | null
119
- }
120
-
121
- export const defaultOptions: DefaultOptions
122
- export function showDialog(element: HTMLDialogElement | HTMLElement, options?: DefaultOptions): Promise<void>
123
- export function closeDialog(element: HTMLDialogElement | HTMLElement, options?: DefaultOptions): Promise<void>
124
97
 
125
98
  export {};
126
99
  }
@@ -223,25 +196,21 @@ declare module 'winduum/src/components/toaster' {
223
196
  }
224
197
 
225
198
  declare module 'winduum/src/components/popover' {
226
- import type { FlipOptions, Middleware, OffsetOptions, Placement, ShiftOptions } from '@floating-ui/dom';
227
- export interface ShowPopoverOptions {
228
- anchorSelector: string,
229
- openAttribute?: string
230
- compute?: boolean
231
- placement?: Placement
232
- middleware?: Array<Middleware | null | undefined | false>
233
- offset?: OffsetOptions
234
- flip?: FlipOptions
235
- shift?: ShiftOptions
236
- }
237
-
238
- export interface HidePopoverOptions {
239
- openAttribute?: string
240
- }
241
-
242
- export function showPopover(element: HTMLElement | Element, options?: ShowPopoverOptions): Promise<void>
243
- export function hidePopover(element: HTMLElement | Element): Promise<void>
244
- export function togglePopover(element: HTMLElement | Element, options?: ShowPopoverOptions): Promise<void>
199
+ import type { ComputePositionConfig } from '@floating-ui/dom';
200
+ import type { Placement } from '@floating-ui/utils';
201
+ export function computePositionPopover(
202
+ referenceElement: HTMLElement,
203
+ floatingElement: HTMLElement & { $currentPlacement?: string },
204
+ placement: Placement,
205
+ options?: ComputePositionConfig | boolean
206
+ ): Promise<void>
207
+
208
+ export function autoUpdatePopover(
209
+ referenceElement: HTMLElement,
210
+ floatingElement: HTMLElement,
211
+ placement: Placement,
212
+ options?: ComputePositionConfig | boolean
213
+ ): Promise<() => void>
245
214
 
246
215
  export {};
247
216
  }
@@ -1,9 +0,0 @@
1
- export interface DefaultOptions {
2
- selector?: string
3
- summarySelector?: string
4
- }
5
-
6
- export const defaultOptions: DefaultOptions
7
- export function showDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
8
- export function closeDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
9
- export function toggleDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
@@ -1,78 +0,0 @@
1
- /**
2
- * @type {import("./").DefaultOptions}
3
- */
4
- export const defaultOptions = {
5
- selector: 'details',
6
- summarySelector: 'summary',
7
- }
8
-
9
- /**
10
- * @param {HTMLInputElement | HTMLElement} element
11
- * @param {import("./").DefaultOptions} options
12
- * @returns Promise<void>
13
- */
14
- export const showDetails = async (element, options = {}) => {
15
- options = {
16
- ...defaultOptions,
17
- ...options,
18
- }
19
-
20
- const details = element.closest(options.selector)
21
- const { down } = await import('slide-element')
22
- const content = details.querySelector(options.summarySelector).nextElementSibling
23
-
24
- details._isHiding = false
25
- details.open = true
26
-
27
- await down(content, {
28
- display: '',
29
- })
30
- }
31
-
32
- /**
33
- * @param {HTMLInputElement | HTMLElement} element
34
- * @param {import("./").DefaultOptions} options
35
- * @returns Promise<void>
36
- */
37
- export const closeDetails = async (element, options = {}) => {
38
- options = {
39
- ...defaultOptions,
40
- ...options,
41
- }
42
-
43
- const details = element.closest(options.selector)
44
- const { up } = await import('slide-element')
45
- const content = details.querySelector(options.summarySelector).nextElementSibling
46
-
47
- details._isHiding = true
48
-
49
- await up(content, {
50
- display: '',
51
- })
52
-
53
- details._isHiding && (details.open = false)
54
- details._isHiding = false
55
- }
56
-
57
- /**
58
- * @param {HTMLInputElement | HTMLElement} element
59
- * @param {import("./").DefaultOptions} options
60
- * @returns Promise<void>
61
- */
62
- export const toggleDetails = async (element, options = {}) => {
63
- options = {
64
- ...defaultOptions,
65
- ...options,
66
- }
67
-
68
- const details = element.closest(options.selector)
69
-
70
- if (details._isHiding && !element.checked) return
71
-
72
- if (element.checked ?? !details.open) {
73
- await showDetails(element, options)
74
- }
75
- else {
76
- await closeDetails(element, options)
77
- }
78
- }
@@ -1,13 +0,0 @@
1
- export interface DefaultOptions {
2
- remove?: boolean | null
3
- closable?: boolean | null
4
- modal?: boolean
5
- openAttribute?: string
6
- closedAttribute?: string
7
- contentSelector?: string
8
- scrollbarWidthProperty?: string | null
9
- }
10
-
11
- export const defaultOptions: DefaultOptions
12
- export function showDialog(element: HTMLDialogElement | HTMLElement, options?: DefaultOptions): Promise<void>
13
- export function closeDialog(element: HTMLDialogElement | HTMLElement, options?: DefaultOptions): Promise<void>