winduum 1.1.1 → 1.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "winduum",
3
- "version": "1.1.1",
3
+ "version": "1.2.0-next.1",
4
4
  "type": "module",
5
5
  "types": "types/index.d.ts",
6
6
  "main": "plugin/index.cjs",
@@ -19,27 +19,28 @@
19
19
  "publish-next": "npm publish --tag next"
20
20
  },
21
21
  "devDependencies": {
22
+ "@floating-ui/dom": "^1.6.5",
22
23
  "@stylistic/stylelint-config": "^1.0.1",
23
24
  "@tailwindcss/container-queries": "^0.1.1",
24
25
  "@vitejs/plugin-vue": "^5.0.4",
25
26
  "autoprefixer": "^10.4.19",
26
- "css-has-pseudo": "^6.0.3",
27
+ "css-has-pseudo": "^6.0.5",
28
+ "dts-buddy": "^0.4.7",
27
29
  "eslint": "^8.57.0",
28
30
  "eslint-config-standard": "^17.1.0",
29
31
  "fast-glob": "^3.3.2",
30
32
  "postcss": "^8.4.38",
31
- "postcss-custom-media": "^10.0.4",
33
+ "postcss-custom-media": "^10.0.6",
32
34
  "postcss-import": "^16.1.0",
33
- "postcss-nesting": "^12.1.2",
34
- "stylelint": "^16.5.0",
35
+ "postcss-nesting": "^12.1.5",
36
+ "slide-element": "^2.3.1",
37
+ "stylelint": "^16.6.1",
35
38
  "stylelint-config-standard": "^36.0.0",
36
39
  "tailwindcss": "^3.4.3",
37
40
  "tailwindcss-animate": "^1.0.7",
38
- "vite": "^5.2.10",
39
- "vue": "^3.4.26",
40
- "slide-element": "^2.3.1",
41
- "dts-buddy": "^0.4.7",
42
- "typescript": "^5.4.5"
41
+ "typescript": "^5.4.5",
42
+ "vite": "^5.2.12",
43
+ "vue": "^3.4.27"
43
44
  },
44
45
  "files": [
45
46
  "index.js",
package/plugin/index.js CHANGED
@@ -15,7 +15,7 @@ export const defaultConfig = {
15
15
  'warning', 'error', 'info', 'success', 'light', 'dark',
16
16
  'main', 'main-primary', 'main-secondary', 'main-tertiary',
17
17
  'body', 'body-primary', 'body-secondary', 'body-tertiary',
18
- 'primary-foreground', 'accent-foreground', 'current-foreground',
18
+ 'primary-foreground', 'accent-foreground',
19
19
  'warning-foreground', 'error-foreground', 'info-foreground', 'success-foreground', 'light-foreground', 'dark-foreground',
20
20
  'main-foreground', 'main-primary-foreground', 'main-secondary-foreground', 'main-tertiary-foreground',
21
21
  'body-foreground', 'body-primary-foreground', 'body-secondary-foreground', 'body-tertiary-foreground'
@@ -2,20 +2,24 @@
2
2
  * @param {[]} colors
3
3
  * @param {boolean} colorMix
4
4
  * @param {boolean} rgb
5
- * @returns {[]}
5
+ * @returns {Object}
6
6
  */
7
7
  export const tailwindColors = (colors = [], colorMix = true, rgb = false) => {
8
+ const result = {
9
+ current: 'color-mix(in var(--space), currentcolor calc(<alpha-value> * 100%), transparent)'
10
+ }
11
+
8
12
  colors.forEach(name => {
9
13
  if (rgb) {
10
- colors[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`
14
+ result[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`
11
15
  }
12
16
 
13
- colors[name] = colorMix
17
+ result[name] = colorMix
14
18
  ? `color-mix(in var(--space), var(--color-${name}) calc(<alpha-value> * 100%), transparent)`
15
19
  : `rgb(var(--color-${name}) / <alpha-value>)`
16
20
  })
17
21
 
18
- return colors
22
+ return result
19
23
  }
20
24
 
21
25
  /**
@@ -6,6 +6,8 @@ export default {
6
6
  height: '0.625rem',
7
7
  borderRadius: 'var(--rounded-full)',
8
8
  backgroundColor: 'color-mix(in srgb, var(--color-accent) calc(var(--tw-bg-opacity) * 100%), transparent)',
9
- flexShrink: '0'
9
+ flexShrink: '0',
10
+ justifyContent: 'center',
11
+ alignItems: 'center'
10
12
  }
11
13
  }
@@ -13,6 +13,10 @@
13
13
  background-color: var(--color-primary);
14
14
  }
15
15
 
16
+ :where([tabindex]) {
17
+ outline: 0;
18
+ }
19
+
16
20
  :where(button:enabled),
17
21
  :where([type="checkbox"]:enabled),
18
22
  :where([type="radio"]:enabled),
@@ -1,9 +1,7 @@
1
1
  .c-popover-content {
2
- opacity: var(--tw-opacity);
3
- visibility: var(--tw-visibility);
4
2
  transform:
5
- translate(var(--tw-translate-x), var(--tw-translate-y))
6
- scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3
+ translate(var(--tw-translate-x), var(--tw-translate-y))
4
+ scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
7
5
  transition-property: var(--transition);
8
6
  transition-timing-function: var(--ease-in-out);
9
7
  transition-duration: var(--duration);
@@ -14,7 +12,18 @@
14
12
  z-index: var(--z-10);
15
13
  width: max-content;
16
14
  position: absolute;
17
- transform-origin: top;
15
+
16
+ &:where(.bottom), & {
17
+ transform-origin: top;
18
+ }
19
+
20
+ &:where(.bottom-start) {
21
+ transform-origin: top left;
22
+ }
23
+
24
+ &:where(.bottom-end) {
25
+ transform-origin: top right;
26
+ }
18
27
 
19
28
  &:where(.right) {
20
29
  inset-block-start: 0;
@@ -22,29 +31,47 @@
22
31
  transform-origin: left;
23
32
  }
24
33
 
34
+ &:where(.right-start) {
35
+ transform-origin: left top;
36
+ }
37
+
38
+ &:where(.right-end) {
39
+ transform-origin: left bottom;
40
+ }
41
+
25
42
  &:where(.left) {
26
43
  inset-block-start: 0;
27
44
  inset-inline-end: 100%;
28
45
  transform-origin: right;
29
46
  }
30
47
 
48
+ &:where(.left-start) {
49
+ transform-origin: right top;
50
+ }
51
+
52
+ &:where(.left-end) {
53
+ transform-origin: right bottom;
54
+ }
55
+
31
56
  &:where(.top) {
32
57
  inset-block-end: 100%;
33
58
  transform-origin: bottom;
34
59
  }
35
60
 
36
- &:where(.block-end) {
37
- inset-block: auto 0;
61
+ &:where(.top-start) {
62
+ transform-origin: bottom left;
63
+ }
64
+
65
+ &:where(.top-end) {
66
+ transform-origin: bottom right;
38
67
  }
39
68
 
40
69
  &:where(.end) {
41
70
  inset-inline-end: 0;
42
71
  }
43
72
 
44
- &:where(.block-center) {
45
- --tw-translate-y: -50%;
46
-
47
- inset-block-start: 50%;
73
+ &:where(.block-end) {
74
+ inset-block: auto 0;
48
75
  }
49
76
 
50
77
  &:where(.center) {
@@ -53,10 +80,28 @@
53
80
  inset-inline-start: 50%;
54
81
  }
55
82
 
56
- :not(:focus, :focus-within, .hover:hover) > & {
83
+ &:where(.block-center) {
84
+ --tw-translate-y: -50%;
85
+
86
+ inset-block-start: 50%;
87
+ }
88
+
89
+ &[popover]:not(.in) {
57
90
  --tw-scale-x: var(--c-popover-content-scale-x);
58
91
  --tw-scale-y: var(--c-popover-content-scale-y);
59
- --tw-opacity: 0;
60
- --tw-visibility: hidden;
92
+
93
+ opacity: 0;
94
+ pointer-events: none;
95
+ }
96
+
97
+ &:not([popover]) {
98
+ .focus:not(:focus, :focus-within) > &, .hover:not(:hover) > & {
99
+ --tw-scale-x: var(--c-popover-content-scale-x);
100
+ --tw-scale-y: var(--c-popover-content-scale-y);
101
+
102
+ opacity: 0;
103
+ visibility: hidden;
104
+ }
61
105
  }
62
106
  }
107
+
@@ -0,0 +1,60 @@
1
+ import { animationsFinished } from '../../common.js'
2
+
3
+ export const computePopover = async (element, popover, options) => {
4
+ const { computePosition, flip, shift, offset } = await import('@floating-ui/dom')
5
+
6
+ popover.classList.remove(popover._placement)
7
+
8
+ popover.style.minWidth = `${element.offsetWidth / 16}rem`
9
+
10
+ await computePosition(element, popover, {
11
+ placement: options?.placement,
12
+ middleware: options?.middleware ?? [offset(12 ?? options?.offset), flip(), shift({ padding: 8, ...options?.shift })]
13
+ }).then(({ x, y, placement }) => {
14
+ Object.assign(popover.style, {
15
+ inset: `${y}px auto auto ${x}px`
16
+ })
17
+
18
+ popover._placement = placement
19
+ popover.classList.add(popover._placement, options?.visibleClass ?? 'in')
20
+ })
21
+ }
22
+
23
+ export const closePopover = async (element) => {
24
+ const popoverElement = window[element.getAttribute('popovertarget')]
25
+
26
+ popoverElement.classList.remove('in')
27
+ await animationsFinished(popoverElement)
28
+ popoverElement._cleanup()
29
+ popoverElement.hidePopover && popoverElement.hidePopover()
30
+
31
+ element.ariaExpanded = false
32
+ }
33
+
34
+ export const showPopover = async (element, options) => {
35
+ const { autoUpdate } = await import('@floating-ui/dom')
36
+
37
+ const popoverElement = window[element.getAttribute('popovertarget')]
38
+
39
+ element.ariaExpanded = true
40
+
41
+ if (!element.ariaHasPopup) (element.ariaHasPopup = 'dialog')
42
+ if (!popoverElement.role) (popoverElement.role = element.ariaHasPopup)
43
+ if (!popoverElement.popover) (popoverElement.popover = 'manual')
44
+
45
+ popoverElement.showPopover && popoverElement.showPopover()
46
+
47
+ popoverElement._cleanup = autoUpdate(
48
+ element,
49
+ popoverElement,
50
+ async () => await computePopover(element, popoverElement, options?.computePosition)
51
+ )
52
+ }
53
+
54
+ export const togglePopover = async (element, options) => {
55
+ if (element.ariaExpanded !== 'true') {
56
+ await showPopover(element, options)
57
+ } else {
58
+ await closePopover(element)
59
+ }
60
+ }
@@ -19,7 +19,7 @@
19
19
  --ui-btn-hover-bg-mix: var(--color-dark-foreground);
20
20
  }
21
21
 
22
- &:is([href], button, [role="button"], input) {
22
+ &:is(:any-link, button, [role="button"], input) {
23
23
  cursor: var(--cursor, pointer);
24
24
 
25
25
  &:disabled {
@@ -42,7 +42,7 @@
42
42
  --tw-outline-opacity: var(--ui-btn-focus-outline-opacity);
43
43
  }
44
44
 
45
- &:is(:active, :checked, .active) {
45
+ &:active, &:checked, &.active {
46
46
  --ui-btn-bg: var(--ui-btn-active-bg, var(--color-accent));
47
47
  --ui-btn-border-color: var(--ui-btn-active-border-color, var(--color-accent));
48
48
  --tw-bg-mix: var(--ui-btn-active-bg-mix);
@@ -8,7 +8,7 @@
8
8
  letter-spacing: var(--ui-check-letter-spacing);
9
9
  gap: var(--ui-check-gap);
10
10
  display: inline-flex;
11
- text-wrap: balance;
11
+ text-wrap: pretty;
12
12
 
13
13
  &:has([type="radio"]) {
14
14
  --ui-check-icon: var(--mask-radio);
@@ -1,9 +1,9 @@
1
1
  .ui-control {
2
2
  &.invalid, &:has(:user-invalid), .validated &:has(:invalid) {
3
- --ui-control-border-color: var(--color-error);
4
- --ui-control-outline-color: var(--color-error);
5
- --ui-control-color: var(--color-error);
6
- --ui-control-bg: var(--color-error);
3
+ --ui-control-border-color: var(--ui-control-invalid-border-color, var(--color-error));
4
+ --ui-control-outline-color: var(--ui-control-invalid-outline-color, var(--color-error));
5
+ --ui-control-color: var(--ui-control-invalid-color, var(--color-error));
6
+ --ui-control-bg: var(--ui-control-invalid-bg, var(--color-error));
7
7
  --tw-bg-opacity: var(--ui-control-invalid-bg-opacity, 0.1);
8
8
  --tw-border-opacity: var(--ui-control-invalid-border-opacity, 1);
9
9
  }
@@ -4,5 +4,5 @@
4
4
  font-size: var(--ui-info-font-size);
5
5
  line-height: var(--ui-info-line-height);
6
6
  letter-spacing: var(--ui-info-letter-spacing);
7
- text-wrap: balance;
7
+ text-wrap: pretty;
8
8
  }
@@ -4,5 +4,5 @@
4
4
  font-size: var(--ui-label-font-size);
5
5
  line-height: var(--ui-label-line-height);
6
6
  letter-spacing: var(--ui-label-letter-spacing);
7
- text-wrap: balance;
7
+ text-wrap: pretty;
8
8
  }
@@ -4,5 +4,5 @@
4
4
  font-size: var(--ui-link-font-size);
5
5
  line-height: var(--ui-link-line-height);
6
6
  letter-spacing: var(--ui-link-letter-spacing);
7
- text-wrap: balance;
7
+ text-wrap: pretty;
8
8
  }
@@ -1,7 +1,7 @@
1
1
  .ui-link {
2
2
  --tw-text-opacity: var(--ui-link-hover-color-opacity);
3
3
 
4
- &:where([href], button:enabled, [role="button"]) {
4
+ &:where(:any-link, button:enabled, [role="button"]) {
5
5
  transition: all var(--duration) var(--ease-in-out);
6
6
 
7
7
  &:hover {
@@ -17,7 +17,7 @@
17
17
  var(--tw-outline-mix)
18
18
  );
19
19
  outline-offset: var(--ui-notice-outline-offset);
20
- text-wrap: balance;
20
+ text-wrap: pretty;
21
21
 
22
22
  :where(hr) {
23
23
  --tw-border-opacity: 0.2;
@@ -5,7 +5,7 @@
5
5
  letter-spacing: var(--ui-switch-letter-spacing);
6
6
  gap: var(--ui-switch-gap);
7
7
  display: inline-flex;
8
- text-wrap: balance;
8
+ text-wrap: pretty;
9
9
 
10
10
  :where(a) {
11
11
  color: var(--color-accent);
@@ -4,5 +4,5 @@
4
4
  font-size: var(--ui-title-font-size);
5
5
  line-height: var(--ui-title-line-height);
6
6
  letter-spacing: var(--ui-title-letter-spacing);
7
- text-wrap: balance;
7
+ text-wrap: pretty;
8
8
  }
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .underline-transparent {
6
- &:where([href], button:enabled, [role="button"]) {
6
+ &:where(:any-link, button:enabled, [role="button"]) {
7
7
  transition: all var(--duration) var(--ease-in-out);
8
8
 
9
9
  &:not(:hover, :focus-visible) {