winduum 0.5.0-next.8 → 0.5.0

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 (61) hide show
  1. package/dist/main-rgb.css +1 -1
  2. package/dist/main.css +1 -1
  3. package/dist/tailwind.css +1 -1
  4. package/package.json +17 -17
  5. package/src/base/config/font.css +11 -0
  6. package/src/base/{icons.css → config/mask.css} +4 -4
  7. package/src/base/config/rounded.css +14 -0
  8. package/src/base/config/spacing.css +15 -0
  9. package/src/base/config/text.css +15 -0
  10. package/src/base/config/transition.css +19 -0
  11. package/src/base/config/z.css +7 -0
  12. package/src/base/config.css +7 -86
  13. package/src/base/default.css +5 -1
  14. package/src/base/index.css +0 -3
  15. package/src/base/reset.css +10 -7
  16. package/src/base/tailwind/container.css +9 -4
  17. package/src/base/tailwind/utilities.css +8 -24
  18. package/src/base/theme/dark-rgb.css +3 -0
  19. package/src/base/theme/dark.css +3 -4
  20. package/src/base/theme/default-rgb.css +25 -0
  21. package/src/base/theme/default.css +21 -22
  22. package/src/components/dialog.css +4 -9
  23. package/src/components/field.css +1 -3
  24. package/src/libraries/dialog.css +14 -15
  25. package/src/libraries/dialog.js +1 -0
  26. package/src/libraries/ripple.css +2 -5
  27. package/src/main-rgb.css +2 -0
  28. package/src/ui/badge/bordered-rgb.css +1 -1
  29. package/src/ui/badge/bordered.css +9 -8
  30. package/src/ui/badge/default.css +10 -14
  31. package/src/ui/badge/lg.css +1 -1
  32. package/src/ui/badge/muted.css +1 -1
  33. package/src/ui/badge/sm.css +1 -1
  34. package/src/ui/btn/bordered.css +14 -13
  35. package/src/ui/btn/default.css +3 -5
  36. package/src/ui/btn/gradient-bordered.css +27 -21
  37. package/src/ui/btn/interactive.css +4 -0
  38. package/src/ui/btn/raised.css +1 -2
  39. package/src/ui/btn/wide.css +1 -2
  40. package/src/ui/check.css +27 -53
  41. package/src/ui/control/color.css +5 -8
  42. package/src/ui/control/default.css +35 -45
  43. package/src/ui/control/file.css +9 -12
  44. package/src/ui/control/floating-interactive.css +12 -0
  45. package/src/ui/control/floating.css +22 -26
  46. package/src/ui/control/icon.css +15 -16
  47. package/src/ui/control/index.css +1 -1
  48. package/src/ui/control/select.css +6 -6
  49. package/src/ui/image.css +8 -19
  50. package/src/ui/info.css +6 -5
  51. package/src/ui/label.css +6 -5
  52. package/src/ui/notice.css +7 -15
  53. package/src/ui/progress/default.css +4 -8
  54. package/src/ui/progress/lg.css +1 -1
  55. package/src/ui/progress/sm.css +1 -1
  56. package/src/ui/switch.css +28 -41
  57. package/src/ui/title/default.css +1 -1
  58. package/tailwind.config.js +5 -1
  59. package/utils/tailwind.cjs +71 -19
  60. package/utils/tailwind.js +63 -18
  61. package/src/ui/control/floating-focus.css +0 -12
package/src/ui/switch.css CHANGED
@@ -1,24 +1,18 @@
1
1
  .ui-switch {
2
2
  --ui-switch-width: 3rem;
3
3
  --ui-switch-height: 1.5rem;
4
- --ui-switch-font-size: 0.875rem;
5
- --ui-switch-gap: 0.625rem;
6
- --ui-switch-padding: 0.375rem;
7
- --ui-switch-bg: var(--color-dark);
8
- --ui-switch-radius: var(--rounded-full);
9
- --ui-switch-outline-width: 3px;
10
- --ui-switch-outline-offset: 0;
11
- --ui-switch-outline-opacity: 20%;
4
+ --ui-check-icon-size: 1.125rem;
12
5
 
13
6
  :where(.dark) & {
14
7
  --ui-switch-bg: var(--color-body-tertiary);
15
8
  }
16
9
 
17
- display: flex;
18
- align-items: center;
19
- gap: 0 var(--ui-switch-gap);
20
- width: fit-content;
21
- font-size: var(--ui-switch-font-size);
10
+ display: inline-flex;
11
+ gap: var(--ui-switch-gap, 0.75rem);
12
+ font-weight: var(--ui-switch-font-weight, var(--font-normal));
13
+ font-size: var(--ui-switch-font-size, var(--text-sm));
14
+ line-height: var(--ui-switch-line-height, calc(1em + var(--ui-switch-line-height-ratio, 0.25lh)));
15
+ letter-spacing: var(--ui-switch-letter-spacing, inherit);
22
16
  text-wrap: balance;
23
17
 
24
18
  & :where(label[for], input) {
@@ -31,34 +25,28 @@
31
25
  }
32
26
 
33
27
  & :where(input) {
28
+ display: flex;
34
29
  width: var(--ui-switch-width);
35
30
  height: var(--ui-switch-height);
36
- display: block;
37
- position: relative;
38
- border-radius: var(--ui-switch-radius);
39
- background-color: var(--ui-switch-bg);
40
- transition:
41
- var(--transition-background),
42
- outline-color var(--duration),
43
- outline-offset var(--duration);
44
- appearance: none;
45
- outline: var(--ui-switch-outline-width) solid transparent;
31
+ background-color: var(--ui-switch-bg, var(--color-dark));
32
+ border-radius: var(--ui-switch-radius, var(--rounded-full));
33
+ outline: var(--ui-switch-outline-width, 3px) solid transparent;
46
34
  outline-offset: 0;
47
- color: inherit;
35
+ transition-property: var(--transition);
36
+ transition-timing-function: var(--ease-in-out);
37
+ transition-duration: var(--duration);
38
+ flex-shrink: 0;
39
+ position: relative;
40
+ padding: calc((var(--ui-switch-height) - var(--ui-check-icon-size)) / 2);
48
41
 
49
42
  &::before {
50
- width: calc(var(--ui-switch-height) - var(--ui-switch-padding));
51
- height: calc(var(--ui-switch-height) - var(--ui-switch-padding));
52
- background-color: var(--color-light);
53
- border-radius: var(--ui-switch-radius);
54
- position: absolute;
55
- left: var(--ui-switch-height);
56
- top: 50%;
57
43
  content: "";
58
- display: block;
59
- margin-left: calc((var(--ui-switch-height) - var(--ui-switch-padding) + var(--ui-switch-padding) / 2) * -1);
60
- transition: left var(--duration), var(--transition-background);
61
- transform: translateY(-50%);
44
+ width: var(--ui-check-icon-size);
45
+ height: var(--ui-check-icon-size);
46
+ background-color: var(--color-light);
47
+ border-radius: inherit;
48
+ margin-block: auto;
49
+ transition: var(--transition-all);
62
50
  }
63
51
 
64
52
  &:where(:required) {
@@ -69,13 +57,13 @@
69
57
  }
70
58
 
71
59
  &:disabled {
72
- opacity: 0.8;
73
- pointer-events: none;
60
+ cursor: not-allowed;
61
+ opacity: var(--ui-switch-disabled-opacity, 0.5);
74
62
  }
75
63
 
76
64
  &:focus {
77
- outline-color: color-mix(in sRGB, var(--color-current) var(--ui-switch-outline-opacity), transparent);
78
- outline-offset: var(--ui-switch-outline-offset);
65
+ outline-color: color-mix(in sRGB, var(--color-current) var(--ui-switch-outline-opacity, 20%), transparent);
66
+ outline-offset: var(--ui-switch-outline-offset, 0);
79
67
  }
80
68
 
81
69
  &:checked {
@@ -83,8 +71,7 @@
83
71
  --ui-switch-bg: var(--color-accent);
84
72
 
85
73
  &::before {
86
- background-color: var(--color-light);
87
- left: 100%;
74
+ margin-left: calc(100% - var(--ui-check-icon-size));
88
75
  }
89
76
  }
90
77
  }
@@ -2,7 +2,7 @@
2
2
  font-family: var(--ui-title-font-family, var(--font-secondary));
3
3
  font-weight: var(--ui-title-font-weight, var(--font-semibold));
4
4
  font-size: var(--ui-title-font-size, var(--text-sm));
5
- line-height: var(--ui-title-line-height, calc(1em + var(--ui-title-line-height-ratio, 0.25lh)));
5
+ line-height: var(--ui-title-line-height, calc(1em + var(--ui-title-line-height-ratio, 0.15lh)));
6
6
  letter-spacing: var(--ui-title-letter-spacing, 0);
7
7
  text-wrap: balance;
8
8
  }
@@ -1,4 +1,6 @@
1
1
  import winduum from './utils/tailwind.js'
2
+ import containerQueries from '@tailwindcss/container-queries'
3
+ import animate from 'tailwindcss-animate'
2
4
 
3
5
  export default {
4
6
  darkMode: 'class',
@@ -7,6 +9,8 @@ export default {
7
9
  './playground/**/*.{js,html,vue}'
8
10
  ],
9
11
  plugins: [
10
- winduum()
12
+ winduum(),
13
+ containerQueries,
14
+ animate
11
15
  ]
12
16
  }
@@ -6,7 +6,6 @@ var plugin = require('tailwindcss/plugin');
6
6
  var flattenColorPalette = require('tailwindcss/src/util/flattenColorPalette');
7
7
  var toColorValue = require('tailwindcss/src/util/toColorValue');
8
8
  var color = require('tailwindcss/src/util/color');
9
- var lodash = require('lodash');
10
9
 
11
10
  function withAlphaVariable ({ color: color$1, property, variable }) {
12
11
  const properties = [].concat(property);
@@ -49,11 +48,13 @@ const defaultConfig = {
49
48
  ],
50
49
  fontFamily: ['primary', 'secondary'],
51
50
  fontWeight: ['light', 'normal', 'medium', 'semibold', 'bold', 'extrabold'],
51
+ ease: ['linear', 'in', 'out', 'in-out'],
52
52
  zIndex: [10, 20, 30, 40, 50, 60],
53
53
  fontSize: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '3xl', '4xl', '5xl', '6xl', '7xl', '7xl', '8xl', '9xl'],
54
- spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'section'],
54
+ spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl'],
55
55
  borderRadius: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'full'],
56
56
  animations: ['fade-in', 'fade-out', 'fade-in-down', 'fade-out-up', 'ripple', 'spin', 'move-indeterminate'],
57
+ mask: ['check', 'radio', 'angle-up', 'angle-down'],
57
58
  screens: {
58
59
  xs: '22.5em',
59
60
  sm: '26em',
@@ -67,7 +68,7 @@ const defaultConfig = {
67
68
  '2xxl': '158em'
68
69
  },
69
70
  settings: {
70
- rgb: true,
71
+ rgb: false,
71
72
  colorMix: true
72
73
  }
73
74
  };
@@ -102,6 +103,18 @@ const tailwindVariablesFont = (type, variables = [], values = {}) => {
102
103
  return values
103
104
  };
104
105
 
106
+ const tailwindPropertyUtilities = (type, variables = []) => {
107
+ const result = {};
108
+
109
+ variables.forEach(name => {
110
+ result[`.${type}-${name}`] = {
111
+ [type]: `var(--${type}-${name})`
112
+ };
113
+ });
114
+
115
+ return result
116
+ };
117
+
105
118
  const tailwindAnimations = (values) => {
106
119
  const result = {};
107
120
 
@@ -114,8 +127,23 @@ const tailwindAnimations = (values) => {
114
127
  return result
115
128
  };
116
129
 
130
+ const tailwindMask = (values) => {
131
+ const result = {};
132
+
133
+ values.forEach(value => {
134
+ result[`.mask-${value}`] = {
135
+ mask: value
136
+ };
137
+ });
138
+
139
+ return result
140
+ };
141
+
117
142
  const createPlugin = (userConfig = {}) => {
118
- userConfig = lodash.merge(defaultConfig, userConfig);
143
+ userConfig = {
144
+ ...defaultConfig,
145
+ userConfig
146
+ };
119
147
 
120
148
  return plugin(({ addUtilities, matchUtilities, theme, variants, e, corePlugins }) => {
121
149
  matchUtilities(
@@ -184,15 +212,13 @@ const createPlugin = (userConfig = {}) => {
184
212
  }
185
213
  }
186
214
 
187
- const color = matchValue
188
- ? { color: 'var(--color-current)' }
189
- : {
190
- ...withAlphaVariable({
191
- color: value,
192
- property: 'color',
193
- variable: '--tw-text-opacity'
194
- })
195
- };
215
+ const color = {
216
+ ...withAlphaVariable({
217
+ color: value,
218
+ property: 'color',
219
+ variable: '--tw-text-opacity'
220
+ })
221
+ };
196
222
 
197
223
  if (!corePlugins('textOpacity')) {
198
224
  return {
@@ -216,28 +242,52 @@ const createPlugin = (userConfig = {}) => {
216
242
  { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
217
243
  );
218
244
  addUtilities(tailwindAnimations(userConfig.animations));
245
+ addUtilities(tailwindPropertyUtilities('mask', userConfig.mask));
219
246
  addUtilities([
220
247
  Object.entries(theme('spacing')).map(([key, value]) => {
221
248
  return {
222
- [`.${e(`sq-${key}`)}`]: {
223
- width: value,
224
- height: value
249
+ [`.${e(`divide-gap-x-${key}`)}`]: {
250
+ '& > :where(*:not(:first-child))': {
251
+ paddingLeft: value,
252
+ marginLeft: value
253
+ }
254
+ },
255
+ [`.${e(`divide-gap-y-${key}`)}`]: {
256
+ '& > :where(*:not(:first-child))': {
257
+ paddingTop: value,
258
+ marginTop: value
259
+ }
225
260
  }
226
261
  }
227
262
  })
228
- ], variants('sq'));
263
+ ]);
264
+ addUtilities({
265
+ '.flex-center': {
266
+ display: 'flex',
267
+ alignItems: 'center',
268
+ gap: 'var(--spacing-sm)'
269
+ },
270
+ '.flex-between': {
271
+ display: 'flex',
272
+ justifyContent: 'between',
273
+ gap: 'var(--spacing-sm)'
274
+ }
275
+ });
229
276
  }, {
230
277
  corePlugins: {
231
278
  preflight: false,
232
- container: false,
233
279
  textColor: false,
234
280
  accentColor: false
235
281
  },
236
282
  theme: {
237
283
  extend: {
284
+ transitionProperty: {
285
+ DEFAULT: 'var(--transition)'
286
+ },
238
287
  transitionDuration: {
239
- DEFAULT: 'var(--transition-duration)'
288
+ DEFAULT: 'var(--duration)'
240
289
  },
290
+ transitionTimingFunction: tailwindVariables('ease', userConfig.ease),
241
291
  colors: tailwindColors(userConfig.colors),
242
292
  fontSize: tailwindVariablesFont('text', userConfig.fontSize),
243
293
  fontFamily: tailwindVariables('font', userConfig.fontFamily),
@@ -261,5 +311,7 @@ exports.default = createPlugin;
261
311
  exports.defaultConfig = defaultConfig;
262
312
  exports.tailwindAnimations = tailwindAnimations;
263
313
  exports.tailwindColors = tailwindColors;
314
+ exports.tailwindMask = tailwindMask;
315
+ exports.tailwindPropertyUtilities = tailwindPropertyUtilities;
264
316
  exports.tailwindVariables = tailwindVariables;
265
317
  exports.tailwindVariablesFont = tailwindVariablesFont;
package/utils/tailwind.js CHANGED
@@ -2,7 +2,6 @@ import plugin from 'tailwindcss/plugin'
2
2
  import flattenColorPalette from 'tailwindcss/src/util/flattenColorPalette'
3
3
  import toColorValue from 'tailwindcss/src/util/toColorValue'
4
4
  import { parseColor, formatColor } from 'tailwindcss/src/util/color'
5
- import lodash from 'lodash'
6
5
 
7
6
  function withAlphaVariable ({ color, property, variable }) {
8
7
  const properties = [].concat(property)
@@ -48,9 +47,10 @@ export const defaultConfig = {
48
47
  ease: ['linear', 'in', 'out', 'in-out'],
49
48
  zIndex: [10, 20, 30, 40, 50, 60],
50
49
  fontSize: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '3xl', '4xl', '5xl', '6xl', '7xl', '7xl', '8xl', '9xl'],
51
- spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'section'],
50
+ spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl'],
52
51
  borderRadius: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'full'],
53
52
  animations: ['fade-in', 'fade-out', 'fade-in-down', 'fade-out-up', 'ripple', 'spin', 'move-indeterminate'],
53
+ mask: ['check', 'radio', 'angle-up', 'angle-down'],
54
54
  screens: {
55
55
  xs: '22.5em',
56
56
  sm: '26em',
@@ -64,7 +64,7 @@ export const defaultConfig = {
64
64
  '2xxl': '158em'
65
65
  },
66
66
  settings: {
67
- rgb: true,
67
+ rgb: false,
68
68
  colorMix: true
69
69
  }
70
70
  }
@@ -99,6 +99,18 @@ export const tailwindVariablesFont = (type, variables = [], values = {}) => {
99
99
  return values
100
100
  }
101
101
 
102
+ export const tailwindPropertyUtilities = (type, variables = []) => {
103
+ const result = {}
104
+
105
+ variables.forEach(name => {
106
+ result[`.${type}-${name}`] = {
107
+ [type]: `var(--${type}-${name})`
108
+ }
109
+ })
110
+
111
+ return result
112
+ }
113
+
102
114
  export const tailwindAnimations = (values) => {
103
115
  const result = {}
104
116
 
@@ -111,8 +123,23 @@ export const tailwindAnimations = (values) => {
111
123
  return result
112
124
  }
113
125
 
126
+ export const tailwindMask = (values) => {
127
+ const result = {}
128
+
129
+ values.forEach(value => {
130
+ result[`.mask-${value}`] = {
131
+ mask: value
132
+ }
133
+ })
134
+
135
+ return result
136
+ }
137
+
114
138
  export const createPlugin = (userConfig = {}) => {
115
- userConfig = lodash.merge(defaultConfig, userConfig)
139
+ userConfig = {
140
+ ...defaultConfig,
141
+ userConfig
142
+ }
116
143
 
117
144
  return plugin(({ addUtilities, matchUtilities, theme, variants, e, corePlugins }) => {
118
145
  matchUtilities(
@@ -181,15 +208,13 @@ export const createPlugin = (userConfig = {}) => {
181
208
  }
182
209
  }
183
210
 
184
- const color = matchValue
185
- ? { color: 'var(--color-current)' }
186
- : {
187
- ...withAlphaVariable({
188
- color: value,
189
- property: 'color',
190
- variable: '--tw-text-opacity'
191
- })
192
- }
211
+ const color = {
212
+ ...withAlphaVariable({
213
+ color: value,
214
+ property: 'color',
215
+ variable: '--tw-text-opacity'
216
+ })
217
+ }
193
218
 
194
219
  if (!corePlugins('textOpacity')) {
195
220
  return {
@@ -213,20 +238,40 @@ export const createPlugin = (userConfig = {}) => {
213
238
  { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
214
239
  )
215
240
  addUtilities(tailwindAnimations(userConfig.animations))
241
+ addUtilities(tailwindPropertyUtilities('mask', userConfig.mask))
216
242
  addUtilities([
217
243
  Object.entries(theme('spacing')).map(([key, value]) => {
218
244
  return {
219
- [`.${e(`sq-${key}`)}`]: {
220
- width: value,
221
- height: value
245
+ [`.${e(`divide-gap-x-${key}`)}`]: {
246
+ '& > :where(*:not(:first-child))': {
247
+ paddingLeft: value,
248
+ marginLeft: value
249
+ }
250
+ },
251
+ [`.${e(`divide-gap-y-${key}`)}`]: {
252
+ '& > :where(*:not(:first-child))': {
253
+ paddingTop: value,
254
+ marginTop: value
255
+ }
222
256
  }
223
257
  }
224
258
  })
225
- ], variants('sq'))
259
+ ])
260
+ addUtilities({
261
+ '.flex-center': {
262
+ display: 'flex',
263
+ alignItems: 'center',
264
+ gap: 'var(--spacing-sm)'
265
+ },
266
+ '.flex-between': {
267
+ display: 'flex',
268
+ justifyContent: 'between',
269
+ gap: 'var(--spacing-sm)'
270
+ }
271
+ })
226
272
  }, {
227
273
  corePlugins: {
228
274
  preflight: false,
229
- container: false,
230
275
  textColor: false,
231
276
  accentColor: false
232
277
  },
@@ -1,12 +0,0 @@
1
- .ui-control:has(:not([type="color"]) ~ label) {
2
- --ui-control-label-focus-transform: translateY(-0.6875rem) scale(0.8);
3
- --ui-control-label-focus-opacity: 50%;
4
- --ui-control-placeholder-color: transparent;
5
-
6
- & :where(input, textarea, select) {
7
- &:is(:focus, :not(:placeholder-shown)) ~ label {
8
- transform: var(--ui-control-label-focus-transform);
9
- opacity: var(--ui-control-label-focus-opacity);
10
- }
11
- }
12
- }