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.
Files changed (86) hide show
  1. package/dist/main.css +1 -1
  2. package/dist/tailwind.css +1 -1
  3. package/dist/test.css +1 -0
  4. package/package.json +15 -15
  5. package/plugin/index.cjs +81 -43
  6. package/plugin/utilities/common.js +2 -2
  7. package/plugin/utilities/dot.js +3 -3
  8. package/src/base/breakpoints-tw.css +12 -0
  9. package/src/base/config/transition.css +5 -1
  10. package/src/base/config/tw.css +30 -0
  11. package/src/base/defaults-tw.css +9 -0
  12. package/src/base/defaults.css +1 -11
  13. package/src/base/index.css +2 -0
  14. package/src/base/reset.css +0 -1
  15. package/src/base/theme/default-tw.css +26 -0
  16. package/src/base/transitions.css +11 -0
  17. package/src/components/badge/circle.css +1 -1
  18. package/src/components/badge/default.css +2 -2
  19. package/src/components/badge/lg.css +1 -1
  20. package/src/components/badge/props/default.css +1 -1
  21. package/src/components/badge/sm.css +1 -1
  22. package/src/components/badge/square.css +1 -1
  23. package/src/components/breadcrumb/default.css +1 -1
  24. package/src/components/button/bordered.css +1 -1
  25. package/src/components/button/circle.css +1 -1
  26. package/src/components/button/default.css +2 -2
  27. package/src/components/button/interactive.css +13 -11
  28. package/src/components/button/lg.css +1 -1
  29. package/src/components/button/props/default.css +1 -1
  30. package/src/components/button/sm.css +1 -1
  31. package/src/components/button/square.css +1 -1
  32. package/src/components/carousel/index.d.ts +3 -3
  33. package/src/components/carousel/index.js +13 -11
  34. package/src/components/check/default.css +2 -2
  35. package/src/components/check/invalid.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 +1 -1
  39. package/src/components/control/color.css +5 -5
  40. package/src/components/control/default.css +3 -3
  41. package/src/components/control/file.css +1 -1
  42. package/src/components/control/invalid.css +1 -1
  43. package/src/components/control/props/color.css +2 -2
  44. package/src/components/control/props/default.css +3 -3
  45. package/src/components/control/select-multiple.css +1 -1
  46. package/src/components/details/index.js +2 -2
  47. package/src/components/dialog/content.css +1 -1
  48. package/src/components/dialog/default.css +2 -2
  49. package/src/components/dialog/index.d.ts +3 -2
  50. package/src/components/dialog/index.js +15 -14
  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 +1 -1
  56. package/src/components/form/index.d.ts +4 -4
  57. package/src/components/form/index.js +11 -10
  58. package/src/components/group/default.css +1 -1
  59. package/src/components/image/default.css +1 -1
  60. package/src/components/popover/content.css +2 -2
  61. package/src/components/popover/index.d.ts +5 -1
  62. package/src/components/popover/index.js +11 -9
  63. package/src/components/range/default.css +4 -4
  64. package/src/components/rating/default.css +8 -0
  65. package/src/components/rating/invalid.css +1 -1
  66. package/src/components/rating/props/default.css +0 -1
  67. package/src/components/switch/invalid.css +1 -1
  68. package/src/components/tabs/index.css +1 -1
  69. package/src/components/tabs/list.css +8 -0
  70. package/src/components/tabs/readme.md +1 -1
  71. package/src/components/text/default.css +2 -2
  72. package/src/components/toast/content.css +0 -5
  73. package/src/components/toast/default.css +3 -3
  74. package/src/components/toaster/default.css +4 -0
  75. package/src/components/toaster/index.d.ts +2 -17
  76. package/src/components/toaster/index.js +4 -56
  77. package/src/tailwind.css +4 -1
  78. package/src/test.css +7 -0
  79. package/src/utilities/animation.css +4 -0
  80. package/src/utilities/dot.css +10 -0
  81. package/src/utilities/view-transition.css +3 -0
  82. package/tailwind.config.js +4 -1
  83. package/types/index.d.ts +45 -28
  84. package/types/index.d.ts.map +3 -5
  85. package/src/base/tailwind.css +0 -3
  86. package/src/components/tabs/default.css +0 -8
@@ -1,10 +1,12 @@
1
+ import { nextRepaint } from '../../common.js'
2
+
1
3
  /**
2
4
  * @param {HTMLElement | Element} element
3
5
  * @param {number} distance
4
6
  * @param {'top' | 'left'} direction
5
7
  * @returns void
6
8
  */
7
- export const showDrawer = (element, distance = 0, direction = 'left') => {
9
+ export const showDrawer = async (element, distance = 0, direction = 'left') => {
8
10
  element.scroll({ [direction]: distance })
9
11
  }
10
12
 
@@ -20,6 +22,17 @@ export const closeDrawer = (element, distance = element.scrollWidth, direction =
20
22
 
21
23
  /**
22
24
  * @param {HTMLElement | Element} element
25
+ * @param {number} distance
26
+ * @param {'top' | 'left'} direction
27
+ * @returns void
28
+ */
29
+ export const scrollInitDrawer = async (element, distance = element.scrollWidth, direction = 'left') => {
30
+ element.scroll({ [direction]: distance, behavior: 'instant' })
31
+ await nextRepaint()
32
+ }
33
+
34
+ /**
35
+ * @param {HTMLDialogElement | Element} element
23
36
  * @param {import("./").ScrollDrawerOptions} options
24
37
  * @returns void
25
38
  */
@@ -49,6 +62,7 @@ export const scrollDrawer = (element, options = {}) => {
49
62
  if ((options.scrollDirection === options.scrollClose) && !element.inert) {
50
63
  element.classList.remove(...options.snapClass.split(/\s/))
51
64
  element.inert = true
65
+ element.close && element.close()
52
66
  element.dispatchEvent(new CustomEvent('x-drawer:close'))
53
67
  }
54
68
  }
@@ -2,6 +2,6 @@
2
2
  --x-drawer-content-background-color: var(--color-body-primary);
3
3
  --x-drawer-content-padding-block: 2rem;
4
4
  --x-drawer-content-padding-inline: 1.5rem;
5
- --x-drawer-content-inline-size: calc(100vw - 4rem);
5
+ --x-drawer-content-inline-size: 100%;
6
6
  --x-drawer-content-block-size: 100%;
7
7
  }
@@ -3,7 +3,7 @@
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
 
6
- .validated &:has(:invalid) {
6
+ &:has(:user-invalid) {
7
7
  :where(.x-info[hidden]) {
8
8
  display: revert;
9
9
  }
@@ -1,7 +1,7 @@
1
1
  export interface ValidateFormOptions {
2
2
  validateSelectors?: string
3
3
  validateOptions?: ValidateFieldOptions
4
- submitterLoadingClass?: string
4
+ submitterLoadingAttribute?: string
5
5
  }
6
6
 
7
7
  export interface ValidateFieldOptions {
@@ -15,11 +15,11 @@ export interface ValidateFieldOptions {
15
15
  endParentSelector?: string
16
16
  endSelector?: string
17
17
  endContent?: string
18
- validClass?: string
18
+ validAttribute?: string
19
19
  validIcon?: string | null
20
- invalidClass?: string
20
+ invalidAttribute?: string
21
21
  invalidIcon?: string
22
- activeClass?: string
22
+ activeAttribute?: string
23
23
  }
24
24
 
25
25
  export function validateForm(event: Event | SubmitEvent, options?: ValidateFormOptions): void
@@ -7,7 +7,7 @@ export const validateForm = (event, options = {}) => {
7
7
  options = {
8
8
  validateSelectors: '.x-control, .x-check, .x-switch, .x-rating, .x-color',
9
9
  validateOptions: {},
10
- submitterLoadingClass: 'loading',
10
+ submitterLoadingAttribute: 'data-loading',
11
11
  ...options
12
12
  }
13
13
 
@@ -18,7 +18,7 @@ export const validateForm = (event, options = {}) => {
18
18
  event.target.querySelector(':invalid').scrollIntoView({ behavior: 'smooth', block: 'center' })
19
19
  event.target.querySelector(':invalid').focus()
20
20
  } else {
21
- event?.submitter?.classList.add(options.submitterLoadingClass)
21
+ event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
22
22
  }
23
23
 
24
24
  event.target.querySelectorAll(options.validateSelectors).forEach(element => {
@@ -43,11 +43,11 @@ export const validateField = (element, options = {}) => {
43
43
  endParentSelector: '.x-control',
44
44
  endSelector: '.ms-auto',
45
45
  endContent: '<div class="ms-auto"></div>',
46
- validClass: 'valid',
46
+ validAttribute: 'data-valid',
47
47
  validIcon: null,
48
- invalidClass: 'invalid',
48
+ invalidAttribute: 'data-invalid',
49
49
  invalidIcon: '<svg class="text-error validity" aria-hidden="true"><use href="#icon-exclamation-circle"></use></svg>',
50
- activeClass: 'active',
50
+ activeAttribute: 'data-active',
51
51
  ...options
52
52
  }
53
53
 
@@ -71,23 +71,24 @@ export const validateField = (element, options = {}) => {
71
71
  }
72
72
 
73
73
  if (validationElement.value !== '') {
74
- element.classList.add(options.activeClass)
74
+ element.setAttribute(options.activeAttribute, '')
75
75
  } else {
76
- element.classList.remove(options.activeClass)
76
+ element.removeAttribute(options.activeAttribute)
77
77
  }
78
78
 
79
79
  if (!validationElement.outerHTML.match(options.ignoreMatch) && options.validate) {
80
- element?.classList?.remove(options.validClass, options.invalidClass)
80
+ element?.removeAttribute(options.validAttribute)
81
+ element?.removeAttribute(options.invalidAttribute)
81
82
 
82
83
  infoParentElement?.querySelector(infoSelector)?.remove()
83
84
  endParentElement?.querySelector(endSelector)?.remove()
84
85
 
85
86
  if (validationElement.checkValidity()) {
86
- element.classList.add(options.validClass)
87
+ element.setAttribute(options.validAttribute, '')
87
88
 
88
89
  insertIcon(options.validIcon)
89
90
  } else {
90
- element.classList.add(options.invalidClass)
91
+ element.setAttribute(options.invalidAttribute, '')
91
92
 
92
93
  insertIcon(options.invalidIcon)
93
94
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  &:has(.x-control) {
6
6
  > :where(.x-button) {
7
- min-width: var(--x-control-height);
7
+ min-inline-size: var(--x-control-block-size);
8
8
  height: auto;
9
9
  }
10
10
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  > :where(img, video, iframe, object, svg) {
15
15
  border-radius: inherit;
16
- min-width: 100%;
16
+ min-inline-size: 100%;
17
17
  height: auto;
18
18
  object-fit: contain;
19
19
  }
@@ -10,7 +10,7 @@
10
10
  translate(var(--tw-translate-x), var(--tw-translate-y))
11
11
  scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
12
12
  will-change: transform;
13
- width: max-content;
13
+ inline-size: max-content;
14
14
  position: absolute;
15
15
 
16
16
  &:where(.bottom), & {
@@ -86,7 +86,7 @@
86
86
  inset-block-start: 50%;
87
87
  }
88
88
 
89
- &[popover]:not(.in) {
89
+ &[popover]:not([data-open]) {
90
90
  --tw-scale-x: var(--x-popover-content-scale-x);
91
91
  --tw-scale-y: var(--x-popover-content-scale-y);
92
92
 
@@ -1,7 +1,7 @@
1
1
  import { FlipOptions, Middleware, OffsetOptions, Placement, ShiftOptions } from "@floating-ui/dom";
2
2
 
3
3
  export interface ShowPopoverOptions {
4
- visibleClass?: string
4
+ openAttribute?: string
5
5
  compute?: boolean
6
6
  placement?: Placement
7
7
  middleware?: Array<Middleware | null | undefined | false>
@@ -10,6 +10,10 @@ export interface ShowPopoverOptions {
10
10
  shift?: ShiftOptions
11
11
  }
12
12
 
13
+ export interface HidePopoverOptions {
14
+ openAttribute?: string
15
+ }
16
+
13
17
  export function showPopover(element: HTMLElement | Element, options?: ShowPopoverOptions): Promise<void>
14
18
  export function hidePopover(element: HTMLElement | Element): Promise<void>
15
19
  export function togglePopover(element: HTMLElement | Element, options?: ShowPopoverOptions): Promise<void>
@@ -1,4 +1,4 @@
1
- import { animationsFinished } from '../../common.js'
1
+ import { animationsFinished, nextRepaint } from '../../common.js'
2
2
 
3
3
  /**
4
4
  * @param {HTMLElement | Element} element
@@ -6,13 +6,11 @@ import { animationsFinished } from '../../common.js'
6
6
  * @param {import("./").ShowPopoverOptions} options
7
7
  * @returns Promise<void>
8
8
  */
9
- export const computePopover = async (element, popoverElement, options) => {
9
+ export const computePopover = async (element, popoverElement, options = {}) => {
10
10
  const { computePosition, flip, shift, offset } = await import('@floating-ui/dom')
11
11
 
12
12
  popoverElement.classList.remove(popoverElement._placement)
13
13
 
14
- popoverElement.style.minWidth = `${element.offsetWidth / 16}rem`
15
-
16
14
  await computePosition(element, popoverElement, {
17
15
  placement: options?.placement,
18
16
  middleware: options?.middleware ?? [offset(12 ?? options?.offset), flip(options?.flip), shift({ padding: 8, ...options?.shift })]
@@ -22,18 +20,19 @@ export const computePopover = async (element, popoverElement, options) => {
22
20
  })
23
21
 
24
22
  popoverElement._placement = placement
25
- popoverElement.classList.add(popoverElement._placement, options?.visibleClass ?? 'in')
23
+ popoverElement.classList.add(popoverElement._placement)
26
24
  })
27
25
  }
28
26
 
29
27
  /**
30
28
  * @param {HTMLElement | Element} element - The HTML content to insert into the dialog.
29
+ * @param {import("./").HidePopoverOptions} options
31
30
  * @returns Promise<void>
32
31
  */
33
- export const hidePopover = async (element) => {
32
+ export const hidePopover = async (element, options = { openAttribute: 'data-open' }) => {
34
33
  const popoverElement = document.getElementById(element.getAttribute('popovertarget'))
35
34
 
36
- popoverElement.classList.remove('in')
35
+ popoverElement.removeAttribute(options?.openAttribute)
37
36
  await animationsFinished(popoverElement)
38
37
  popoverElement._cleanup && popoverElement._cleanup()
39
38
  popoverElement.hidePopover && popoverElement.hidePopover()
@@ -48,7 +47,7 @@ export const hidePopover = async (element) => {
48
47
  */
49
48
  export const showPopover = async (element, options) => {
50
49
  options = {
51
- visibleClass: 'in',
50
+ openAttribute: 'data-open',
52
51
  compute: true,
53
52
  ...options
54
53
  }
@@ -64,8 +63,11 @@ export const showPopover = async (element, options) => {
64
63
 
65
64
  popoverElement.showPopover && popoverElement.showPopover()
66
65
 
66
+ await nextRepaint()
67
+
68
+ popoverElement.setAttribute(options?.openAttribute, '')
69
+
67
70
  if (!options.compute) {
68
- popoverElement.classList.add(options.visibleClass)
69
71
  return
70
72
  }
71
73
 
@@ -38,8 +38,8 @@
38
38
  }
39
39
 
40
40
  &::-webkit-slider-thumb {
41
- width: var(--x-range-thumb-size);
42
- height: var(--x-range-thumb-size);
41
+ inline-size: var(--x-range-thumb-size);
42
+ block-size: var(--x-range-thumb-size);
43
43
  background-color: var(--x-range-thumb-background-color);
44
44
  border-radius: var(--radius-full);
45
45
  border: var(--x-range-thumb-border-width) solid var(--x-range-thumb-border-color);
@@ -63,8 +63,8 @@
63
63
  }
64
64
 
65
65
  &::-moz-range-thumb {
66
- width: var(--x-range-thumb-size);
67
- height: var(--x-range-thumb-size);
66
+ inline-size: var(--x-range-thumb-size);
67
+ block-size: var(--x-range-thumb-size);
68
68
  background-color: var(--x-range-thumb-background-color);
69
69
  border-radius: var(--radius-full);
70
70
  border: var(--x-range-thumb-border-width) solid var(--x-range-thumb-border-color);
@@ -1,6 +1,14 @@
1
1
  .x-rating {
2
+ --x-rating-color: var(--color-accent);
3
+
2
4
  display: flex;
3
5
  align-items: center;
6
+ border-radius: var(--radius-full);
7
+
8
+ &:focus-within {
9
+ outline: 2px dotted var(--color-accent);
10
+ outline-offset: 3px;
11
+ }
4
12
 
5
13
  :where(input) {
6
14
  inline-size: var(--x-rating-inline-size);
@@ -1,5 +1,5 @@
1
1
  .x-rating {
2
- &.invalid, :user-invalid, .validated & :invalid {
2
+ :user-invalid {
3
3
  --x-rating-color: var(--x-rating-invalid-color, var(--color-error));
4
4
  }
5
5
  }
@@ -1,7 +1,6 @@
1
1
  :root, :host {
2
2
  --x-rating-inline-size: 1.25rem;
3
3
  --x-rating-block-size: 1.25rem;
4
- --x-rating-color: var(--color-accent);
5
4
  --x-rating-gap: 0.25rem;
6
5
  --x-rating-opacity: 0.2;
7
6
  --x-rating-icon: var(--mask-star);
@@ -1,5 +1,5 @@
1
1
  .x-switch {
2
- &.invalid, :user-invalid, .validated & :invalid {
2
+ :user-invalid {
3
3
  --x-switch-outline-color: var(--x-switch-invalid-outline-color, var(--color-error));
4
4
  --x-switch-background-color: var(--x-switch-invalid-background-color, var(--color-error));
5
5
  }
@@ -1 +1 @@
1
- @import "default.css";
1
+ @import "list.css";
@@ -0,0 +1,8 @@
1
+ .x-tabs-list {
2
+ background-color: var(--x-tabs-list-background-color, var(--color-body-secondary));
3
+ gap: var(--x-tabs-list-gap, var(--spacing-xs));
4
+ padding: var(--x-tabs-list-padding, var(--spacing-xs));
5
+ border-radius: var(--x-tabs-list-border-radius, var(--radius));
6
+ display: flex;
7
+ inline-size: max-content;
8
+ }
@@ -14,7 +14,7 @@ Include CSS either globally or to your component _([you can't use TailwindCSS la
14
14
  or modular (you can use your own props or CSS)
15
15
 
16
16
  ```css
17
- @import "winduum/src/components/tabs/default.css" layer(components);
17
+ @import "winduum/src/components/tabs/list.css" layer(components);
18
18
  ```
19
19
 
20
20
 
@@ -170,8 +170,8 @@
170
170
  list-style-type: "";
171
171
 
172
172
  &::before {
173
- width: var(--x-text-list-marker-size);
174
- height: var(--x-text-list-marker-size);
173
+ inline-size: var(--x-text-list-marker-size);
174
+ block-size: var(--x-text-list-marker-size);
175
175
  inset-inline-start: var(--x-text-list-marker-inset-inline-start, -0.75em);
176
176
  inset-block-start: var(--x-text-list-marker-inset-block-start, 0.5lh);
177
177
  border:
@@ -15,9 +15,4 @@
15
15
  align-items: center;
16
16
  display: flex;
17
17
  height: fit-content;
18
-
19
- .x-text {
20
- --x-text-font-size: var(--font-size-sm);
21
- --x-text-line-height: calc(1em + 0.375rem);
22
- }
23
18
  }
@@ -13,16 +13,16 @@
13
13
  justify-content: flex-end;
14
14
  }
15
15
 
16
- &.in {
16
+ &[data-open] {
17
17
  margin-block: var(--x-toaster-margin-block);
18
18
  }
19
19
 
20
- &.in:where(:nth-last-child(-n+3)) {
20
+ &[data-open]:where(:nth-last-child(-n+3)) {
21
21
  visibility: visible;
22
22
  opacity: 100%;
23
23
  }
24
24
 
25
- &.out {
25
+ &[data-closed] {
26
26
  visibility: hidden;
27
27
  opacity: 0%;
28
28
  height: 0;
@@ -9,4 +9,8 @@
9
9
  flex-direction: column;
10
10
  align-items: center;
11
11
  justify-content: flex-end;
12
+
13
+ &:not(:has(> *)) {
14
+ display: none;
15
+ }
12
16
  }
@@ -1,30 +1,15 @@
1
1
  export interface ShowToastOptions {
2
- visibleClass?: string
2
+ openAttribute?: string
3
3
  autoHide?: number | null
4
4
  heightProperty?: string
5
5
  close?: CloseToastOptions
6
6
  }
7
7
 
8
8
  export interface CloseToastOptions {
9
- hiddenClass?: string
9
+ closedAttribute?: string
10
10
  heightProperty?: string
11
11
  }
12
12
 
13
- export interface InsertToasterOptions {
14
- classes?: string
15
- }
16
-
17
- export interface InsertToastOptions {
18
- classes?: string
19
- title?: string
20
- text?: string
21
- start?: string
22
- end?: string
23
- show?: ShowToastOptions
24
- }
25
-
26
13
  export function closeToast(element: HTMLElement, options?: CloseToastOptions): Promise<void>
27
14
  export function showToast(element: HTMLElement, options?: ShowToastOptions): Promise<void>
28
- export function insertToaster(element: HTMLElement, options?: InsertToasterOptions): Promise<void>
29
- export function insertToast(element: HTMLElement, options?: InsertToastOptions): Promise<void>
30
15
  export function closeToaster(element: HTMLElement, options?: CloseToastOptions): Promise<void>
@@ -7,24 +7,20 @@ import { animationsFinished, nextRepaint } from '../../common.js'
7
7
  */
8
8
  export const closeToast = async (element, options = {}) => {
9
9
  options = {
10
- hiddenClass: 'out',
10
+ closedAttribute: 'data-closed',
11
11
  heightProperty: '--x-toast-block-size',
12
12
  ...options
13
13
  }
14
14
 
15
- const toaster = element.parentElement
16
-
17
15
  element.style.setProperty(options.heightProperty, `${element.offsetHeight}px`)
18
16
 
19
17
  await nextRepaint()
20
18
 
21
- element.classList.add(options.hiddenClass)
19
+ element.setAttribute(options.closedAttribute, '')
22
20
 
23
21
  await animationsFinished(element)
24
22
 
25
23
  element.remove()
26
-
27
- if (toaster.children.length < 1) toaster.remove()
28
24
  }
29
25
 
30
26
  /**
@@ -34,7 +30,7 @@ export const closeToast = async (element, options = {}) => {
34
30
  */
35
31
  export const showToast = async (element, options = {}) => {
36
32
  options = {
37
- visibleClass: 'in',
33
+ openAttribute: 'data-open',
38
34
  autoHide: null,
39
35
  heightProperty: '--x-toast-block-size',
40
36
  close: {},
@@ -47,61 +43,13 @@ export const showToast = async (element, options = {}) => {
47
43
  await animationsFinished(element)
48
44
 
49
45
  element.style.height = ''
50
- element.classList.add(options.visibleClass)
46
+ element.setAttribute(options.openAttribute, '')
51
47
 
52
48
  if (options.autoHide) {
53
49
  setTimeout(() => closeToast(element, options.close), options.autoHide * ((element.parentElement.children.length + 1) / 2))
54
50
  }
55
51
  }
56
52
 
57
- /**
58
- * @param {HTMLElement} element
59
- * @param {import('./').InsertToasterOptions} options
60
- * @returns Promise<void>
61
- */
62
- export const insertToaster = async (element, options = {}) => {
63
- options = {
64
- classes: '',
65
- ...options
66
- }
67
-
68
- if (!document.querySelector('.x-toaster')) {
69
- element.insertAdjacentHTML('beforeend', `<ol class="x-toaster ${options.classes}"></ol>`)
70
- }
71
- }
72
-
73
- /**
74
- * @param {HTMLElement} element
75
- * @param {import('./').InsertToastOptions} options
76
- * @returns Promise<void>
77
- */
78
- export const insertToast = async (element, options = {}) => {
79
- options = {
80
- classes: '',
81
- title: '',
82
- text: '',
83
- start: '',
84
- end: '',
85
- show: {},
86
- ...options
87
- }
88
-
89
- element.insertAdjacentHTML('beforeend', `
90
- <li class="x-toast ${options.classes}" role="status" aria-live="assertive" aria-atomic="true">
91
- <div class="x-toast-content">
92
- ${options.start}
93
- <div class="flex-col">
94
- <div class="x-title">${options.title}</div>
95
- <div class="x-text">${options.text}</div>
96
- </div>
97
- ${options.end}
98
- </div>
99
- </li>
100
- `)
101
-
102
- await showToast(element.children[element.children.length - 1], options.show)
103
- }
104
-
105
53
  /**
106
54
  * @param {HTMLElement} element
107
55
  * @param {import('./').CloseToastOptions} options
package/src/tailwind.css CHANGED
@@ -1,2 +1,5 @@
1
- @import "base/tailwind.css";
1
+ @import "tailwindcss/base.css";
2
+ @import "tailwindcss/components.css";
3
+ @import "tailwindcss/utilities.css";
4
+ @import "tailwindcss/variants.css";
2
5
  @import "utilities/index.css" layer(components);
package/src/test.css ADDED
@@ -0,0 +1,7 @@
1
+ @import "base/index.css";
2
+ @import "components/index.css" layer(components);
3
+ @import "utilities/index.css" layer(components);
4
+ @import "tailwindcss/base.css";
5
+ @import "tailwindcss/components.css";
6
+ @import "tailwindcss/utilities.css";
7
+ @import "tailwindcss/variants.css";
@@ -0,0 +1,4 @@
1
+ @utility animation {
2
+ animation-duration: var(--default-animation-duration, var(--default-transition-duration, 150ms));
3
+ animation-fill-mode: both;
4
+ }
@@ -0,0 +1,10 @@
1
+ @utility dot {
2
+ display: inline-flex;
3
+ inline-size: 0.5rem;
4
+ block-size: 0.5rem;
5
+ border-radius: var(--radius-full);
6
+ background-color: currentColor;
7
+ flex-shrink: 0;
8
+ justify-content: center;
9
+ align-items: center;
10
+ }
@@ -0,0 +1,3 @@
1
+ .view-transition-main {
2
+ view-transition-name: main;
3
+ }
@@ -16,5 +16,8 @@ export default {
16
16
  }),
17
17
  containerQueries,
18
18
  animate
19
- ]
19
+ ],
20
+ future: {
21
+ hoverOnlyWhenSupported: true
22
+ }
20
23
  }