winduum 0.6.0 → 0.7.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.
- package/dist/main.css +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
- package/plugin/tailwind.cjs +198 -163
- package/plugin/tailwind.d.ts +19 -0
- package/plugin/tailwind.js +30 -184
- package/plugin/utilities/color.js +69 -0
- package/plugin/utilities/common.js +80 -0
- package/plugin/utilities/divide-gap.js +20 -0
- package/plugin/utilities/dot.js +11 -0
- package/plugin/utilities/flex.js +12 -0
- package/src/base/config/transition.css +1 -1
- package/src/base/defaults.css +2 -2
- package/src/base/theme/default.css +0 -2
- package/src/common.js +11 -0
- package/src/components/{compare.css → compare/default.css} +10 -11
- package/src/components/compare/index.css +1 -0
- package/src/components/{compare.js → compare/index.js} +10 -4
- package/src/components/compare/readme.md +1 -0
- package/src/components/details/index.js +57 -0
- package/src/components/details/readme.md +1 -0
- package/src/components/dialog/content.css +1 -1
- package/src/components/dialog/default.css +7 -7
- package/src/components/{dialog.js → dialog/index.js} +16 -14
- package/src/components/dialog/readme.md +1 -0
- package/src/components/field/index.css +1 -0
- package/src/components/index.css +8 -4
- package/src/components/popover/content.css +62 -0
- package/src/components/popover/default.css +4 -0
- package/src/components/popover/index.css +2 -0
- package/src/components/toast/content.css +20 -0
- package/src/components/toast/default.css +26 -0
- package/src/components/toast/index.css +2 -0
- package/src/components/toaster/default.css +17 -0
- package/src/components/toaster/index.css +1 -0
- package/src/components/toaster/index.js +122 -0
- package/src/components/toaster/readme.md +1 -0
- package/src/components/toaster/types/index.d.ts +25 -0
- package/src/components/tooltip/default.css +81 -0
- package/src/components/tooltip/index.css +1 -0
- package/src/ui/badge/bordered.css +2 -2
- package/src/ui/badge/default.css +5 -11
- package/src/ui/badge/muted.css +2 -2
- package/src/ui/btn/bordered.css +5 -5
- package/src/ui/btn/default.css +15 -11
- package/src/ui/btn/ghosted.css +4 -4
- package/src/ui/btn/gradient-bordered.css +7 -7
- package/src/ui/btn/gradient.css +1 -1
- package/src/ui/btn/hover-fill.css +4 -4
- package/src/ui/btn/interactive.css +16 -9
- package/src/ui/btn/loading.css +1 -1
- package/src/ui/btn/muted.css +4 -4
- package/src/ui/btn/raised.css +5 -10
- package/src/ui/check/default.css +34 -23
- package/src/ui/control/default.css +35 -14
- package/src/ui/control/file.css +11 -8
- package/src/ui/control/select.css +2 -2
- package/src/ui/group/default.css +9 -4
- package/src/ui/image/index.css +1 -0
- package/src/ui/index.css +17 -17
- package/src/ui/{info.css → info/default.css} +1 -1
- package/src/ui/info/index.css +1 -0
- package/src/ui/label/index.css +1 -0
- package/src/ui/link/interactive.css +5 -8
- package/src/ui/notice/default.css +13 -6
- package/src/ui/progress/default.css +5 -7
- package/src/ui/range/default-props.css +3 -3
- package/src/ui/range/default.css +48 -35
- package/src/ui/{range.js → range/index.js} +11 -4
- package/src/ui/range/multi.css +12 -33
- package/src/ui/range/vertical.css +3 -4
- package/src/ui/switch/default.css +32 -24
- package/src/ui/text/default.css +5 -5
- package/src/ui/title/default.css +1 -1
- package/src/utilities/divider.css +25 -0
- package/src/utilities/index.css +2 -0
- package/src/utilities/ripple/index.css +12 -0
- package/src/utilities/{ripple.js → ripple/index.js} +1 -1
- package/src/utilities/ripple.css +1 -10
- package/src/utilities/swap/default.css +20 -0
- package/src/utilities/swap/index.css +1 -0
- package/src/utilities/swap/index.js +16 -0
- package/tailwind.config.js +5 -1
- package/src/components/card.css +0 -1
- package/src/components/details.js +0 -51
- package/src/components/dialog.css +0 -1
- package/src/ui/badge.css +0 -1
- package/src/ui/btn.css +0 -1
- package/src/ui/check.css +0 -1
- package/src/ui/control.css +0 -1
- package/src/ui/group.css +0 -1
- package/src/ui/heading.css +0 -1
- package/src/ui/link.css +0 -1
- package/src/ui/notice.css +0 -1
- package/src/ui/progress.css +0 -1
- package/src/ui/range.css +0 -1
- package/src/ui/rating.css +0 -1
- package/src/ui/switch.css +0 -1
- package/src/ui/text.css +0 -1
- package/src/ui/title.css +0 -1
- package/src/components/{compare.d.ts → compare/types/index.d.ts} +0 -0
- package/src/components/{dialog.d.ts → dialog/types/index.d.ts} +0 -0
- package/src/components/{field.css → field/default.css} +1 -1
- /package/src/ui/{image.css → image/default.css} +0 -0
- /package/src/ui/{label.css → label/default.css} +0 -0
- /package/src/ui/{range.d.ts → range/types/index.d.ts} +0 -0
package/plugin/tailwind.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import plugin from 'tailwindcss/plugin'
|
|
2
|
-
import withAlphaVariable from 'tailwindcss/src/util/withAlphaVariable'
|
|
3
2
|
import flattenColorPalette from 'tailwindcss/src/util/flattenColorPalette'
|
|
4
|
-
import
|
|
5
|
-
|
|
3
|
+
import FlexUtility from './utilities/flex.js'
|
|
4
|
+
import DotUtility from './utilities/dot.js'
|
|
5
|
+
import divideGap from './utilities/divide-gap.js'
|
|
6
|
+
import { accentColor, textColor } from './utilities/color.js'
|
|
7
|
+
import { tailwindAnimations, tailwindColors, tailwindPropertyUtilities, tailwindVariables, tailwindVariablesFont } from './utilities/common.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @type {import('./tailwind').PluginOptions} options.
|
|
11
|
+
*/
|
|
6
12
|
export const defaultConfig = {
|
|
7
13
|
colors: [
|
|
8
|
-
'primary', 'accent',
|
|
14
|
+
'primary', 'accent',
|
|
9
15
|
'warning', 'error', 'info', 'success', 'light', 'dark',
|
|
10
16
|
'main', 'main-primary', 'main-secondary', 'main-tertiary',
|
|
11
17
|
'body', 'body-primary', 'body-secondary', 'body-tertiary',
|
|
@@ -17,7 +23,7 @@ export const defaultConfig = {
|
|
|
17
23
|
fontFamily: ['primary', 'secondary'],
|
|
18
24
|
fontWeight: ['light', 'normal', 'medium', 'semibold', 'bold', 'extrabold'],
|
|
19
25
|
ease: ['linear', 'in', 'out', 'in-out'],
|
|
20
|
-
zIndex: [10, 20, 30, 40, 50, 60],
|
|
26
|
+
zIndex: ['10', '20', '30', '40', '50', '60'],
|
|
21
27
|
fontSize: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '3xl', '4xl', '5xl', '6xl', '7xl', '7xl', '8xl', '9xl'],
|
|
22
28
|
spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl'],
|
|
23
29
|
borderRadius: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'full'],
|
|
@@ -41,202 +47,40 @@ export const defaultConfig = {
|
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
colors[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
colors[name] = defaultConfig.settings.colorMix
|
|
51
|
-
? `color-mix(in var(--space), var(--color-${name}) calc(<alpha-value> * 100%), transparent)`
|
|
52
|
-
: `rgb(var(--color-${name}) / <alpha-value>)`
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
return colors
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const tailwindVariables = (type, variables = [], values = {}) => {
|
|
59
|
-
variables.forEach(name => {
|
|
60
|
-
values[name] = `var(--${type}-${name})`
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
return values
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const tailwindVariablesFont = (type, variables = [], values = {}) => {
|
|
67
|
-
variables.forEach(name => {
|
|
68
|
-
values[name] = [`var(--${type}-${name})`, `calc(var(--${type}-${name}) + 0.5rem)`]
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
return values
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const tailwindPropertyUtilities = (type, variables = []) => {
|
|
75
|
-
const result = {}
|
|
76
|
-
|
|
77
|
-
variables.forEach(name => {
|
|
78
|
-
result[`.${type}-${name}`] = {
|
|
79
|
-
[type]: `var(--${type}-${name})`
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
return result
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export const tailwindAnimations = (values) => {
|
|
87
|
-
const result = {}
|
|
88
|
-
|
|
89
|
-
values.forEach(value => {
|
|
90
|
-
result[`.animation-${value}`] = {
|
|
91
|
-
'animation-name': value
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
return result
|
|
96
|
-
}
|
|
97
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @param {import('./tailwind').PluginOptions} userConfig
|
|
52
|
+
*/
|
|
98
53
|
export const createPlugin = (userConfig = {}) => {
|
|
54
|
+
const settings = {
|
|
55
|
+
...defaultConfig.settings,
|
|
56
|
+
...userConfig.settings
|
|
57
|
+
}
|
|
58
|
+
|
|
99
59
|
userConfig = {
|
|
100
60
|
...defaultConfig,
|
|
101
|
-
...userConfig
|
|
61
|
+
...userConfig,
|
|
62
|
+
settings
|
|
102
63
|
}
|
|
103
64
|
|
|
104
|
-
return plugin(({
|
|
65
|
+
return plugin(({ addComponents, matchUtilities, theme, e, corePlugins }) => {
|
|
105
66
|
matchUtilities(
|
|
106
67
|
{
|
|
107
|
-
accent:
|
|
108
|
-
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
109
|
-
const fallbackRgb = matchValue && matchValue[0].includes('-rgb')
|
|
110
|
-
|
|
111
|
-
const colorProperties = {}
|
|
112
|
-
|
|
113
|
-
if (fallbackRgb) {
|
|
114
|
-
colorProperties['--color-accent-rgb'] = matchValue[0]
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if ((matchValue && matchValue[0] === 'var(--color-accent)') || (matchValue && matchValue[0] === 'var(--color-accent-rgb)')) {
|
|
118
|
-
return {
|
|
119
|
-
'accent-color': matchValue && toColorValue(value).includes('calc(1 * 100%)') ? matchValue[0] : toColorValue(value)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (matchValue) {
|
|
124
|
-
if (fallbackRgb) {
|
|
125
|
-
colorProperties['--color-accent-foreground-rgb'] = `var(${matchValue[1].replace('-rgb', '-foreground-rgb')})`
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (toColorValue(value).includes('calc(1 * 100%)') || toColorValue(value).includes(' / 1')) {
|
|
129
|
-
return {
|
|
130
|
-
...colorProperties,
|
|
131
|
-
'--color-accent': fallbackRgb ? toColorValue(value) : matchValue[0],
|
|
132
|
-
'--color-accent-foreground': fallbackRgb ? `rgb(var(${matchValue[1].replace('-rgb', '-foreground-rgb')}, var(--color-light-rgb)))` : `var(${matchValue[1]}-foreground, var(--color-light))`,
|
|
133
|
-
'accent-color': defaultConfig.settings.colorMix ? 'var(--color-accent)' : 'rgb(var(--color-accent))'
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
return {
|
|
137
|
-
...colorProperties,
|
|
138
|
-
'--color-accent': toColorValue(value),
|
|
139
|
-
'--color-accent-foreground': fallbackRgb ? `rgb(var(${matchValue[1].replace('-rgb', '-foreground-rgb')}, var(--color-light-rgb)))` : `var(${matchValue[1]}-foreground, var(--color-light))`,
|
|
140
|
-
'accent-color': defaultConfig.settings.colorMix ? 'var(--color-accent)' : 'rgb(var(--color-accent))'
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
'--color-accent': toColorValue(value),
|
|
147
|
-
'accent-color': 'var(--color-accent)'
|
|
148
|
-
}
|
|
149
|
-
}
|
|
68
|
+
accent: value => accentColor({ value }, userConfig.settings)
|
|
150
69
|
},
|
|
151
70
|
{ values: flattenColorPalette(theme('accentColor')), type: ['color', 'any'] }
|
|
152
71
|
)
|
|
153
72
|
matchUtilities(
|
|
154
73
|
{
|
|
155
|
-
text:
|
|
156
|
-
const matchValue = toColorValue(value).match(/var\((.*?)\)/)
|
|
157
|
-
const fallbackRgb = matchValue && matchValue[0].includes('-rgb')
|
|
158
|
-
|
|
159
|
-
const colorProperties = {}
|
|
160
|
-
|
|
161
|
-
if (fallbackRgb) {
|
|
162
|
-
colorProperties['--color-current-rgb'] = matchValue[0]
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if ((matchValue && matchValue[0] === 'var(--color-current)') || (matchValue && matchValue[0] === 'var(--color-current-rgb)')) {
|
|
166
|
-
return {
|
|
167
|
-
color: toColorValue(value)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const color = {
|
|
172
|
-
...withAlphaVariable({
|
|
173
|
-
color: value,
|
|
174
|
-
property: 'color',
|
|
175
|
-
variable: '--tw-text-opacity'
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (!corePlugins('textOpacity')) {
|
|
180
|
-
return {
|
|
181
|
-
...colorProperties,
|
|
182
|
-
'--color-current': toColorValue(value),
|
|
183
|
-
...color
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
...colorProperties,
|
|
189
|
-
...withAlphaVariable({
|
|
190
|
-
color: value,
|
|
191
|
-
property: '--color-current',
|
|
192
|
-
variable: '--tw-text-opacity'
|
|
193
|
-
}),
|
|
194
|
-
...color
|
|
195
|
-
}
|
|
196
|
-
}
|
|
74
|
+
text: value => textColor({ value, corePlugins }, userConfig.settings)
|
|
197
75
|
},
|
|
198
76
|
{ values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
|
|
199
77
|
)
|
|
200
78
|
addComponents(tailwindAnimations(userConfig.animations))
|
|
201
79
|
addComponents(tailwindPropertyUtilities('mask', userConfig.mask))
|
|
202
|
-
addComponents(
|
|
203
|
-
Object.entries(theme('spacing')).map(([key, value]) => {
|
|
204
|
-
return {
|
|
205
|
-
[`.${e(`divide-gap-x-${key}`)}`]: {
|
|
206
|
-
'& > :where(*:not(:first-child))': {
|
|
207
|
-
paddingLeft: value,
|
|
208
|
-
marginLeft: value
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
[`.${e(`divide-gap-y-${key}`)}`]: {
|
|
212
|
-
'& > :where(*:not(:first-child))': {
|
|
213
|
-
paddingTop: value,
|
|
214
|
-
marginTop: value
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
})
|
|
219
|
-
])
|
|
80
|
+
addComponents(divideGap({ theme, e }))
|
|
220
81
|
addComponents({
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
alignItems: 'center',
|
|
224
|
-
gap: 'var(--spacing-sm)'
|
|
225
|
-
},
|
|
226
|
-
'.flex-between': {
|
|
227
|
-
display: 'flex',
|
|
228
|
-
justifyContent: 'space-between',
|
|
229
|
-
gap: 'var(--spacing-sm)'
|
|
230
|
-
},
|
|
231
|
-
'.dot': {
|
|
232
|
-
'--tw-bg-opacity': '1',
|
|
233
|
-
display: 'inline-flex',
|
|
234
|
-
width: '0.625rem',
|
|
235
|
-
height: '0.625rem',
|
|
236
|
-
borderRadius: 'var(--rounded-full)',
|
|
237
|
-
backgroundColor: 'color-mix(in srgb, var(--color-accent) calc(var(--tw-bg-opacity) * 100%), transparent)',
|
|
238
|
-
flexShrink: '0'
|
|
239
|
-
}
|
|
82
|
+
...FlexUtility,
|
|
83
|
+
...DotUtility
|
|
240
84
|
})
|
|
241
85
|
}, {
|
|
242
86
|
corePlugins: {
|
|
@@ -253,7 +97,7 @@ export const createPlugin = (userConfig = {}) => {
|
|
|
253
97
|
DEFAULT: 'var(--duration)'
|
|
254
98
|
},
|
|
255
99
|
transitionTimingFunction: tailwindVariables('ease', userConfig.ease),
|
|
256
|
-
colors: tailwindColors(userConfig.colors),
|
|
100
|
+
colors: tailwindColors(userConfig.colors, settings.colorMix, settings.rgb),
|
|
257
101
|
fontSize: tailwindVariablesFont('text', userConfig.fontSize),
|
|
258
102
|
fontFamily: tailwindVariables('font', userConfig.fontFamily),
|
|
259
103
|
fontWeight: tailwindVariables('font', userConfig.fontWeight),
|
|
@@ -271,4 +115,6 @@ export const createPlugin = (userConfig = {}) => {
|
|
|
271
115
|
})
|
|
272
116
|
}
|
|
273
117
|
|
|
118
|
+
export { tailwindAnimations, tailwindColors, tailwindPropertyUtilities, tailwindVariables, tailwindVariablesFont }
|
|
119
|
+
|
|
274
120
|
export default createPlugin
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import withAlphaVariable from 'tailwindcss/src/util/withAlphaVariable'
|
|
2
|
+
import toColorValue from 'tailwindcss/src/util/toColorValue'
|
|
3
|
+
|
|
4
|
+
export const accentColor = ({ value }, settings) => {
|
|
5
|
+
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
6
|
+
const colorProperties = {}
|
|
7
|
+
|
|
8
|
+
if (matchValue) {
|
|
9
|
+
if (settings.rgb) {
|
|
10
|
+
colorProperties['--color-accent-rgb'] =
|
|
11
|
+
`var(${matchValue[1].includes('-rgb') ? matchValue[1] : matchValue[1] + '-rgb'})`
|
|
12
|
+
colorProperties['--color-accent-foreground-rgb'] =
|
|
13
|
+
`var(${matchValue[1].includes('-rgb') ? matchValue[1].replace('-rgb', '-foreground-rgb') : matchValue[1] + '-foreground-rgb, var(--color-light-rgb)'})`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (toColorValue(value).includes('calc(1 * 100%)') || toColorValue(value).includes(' / 1')) {
|
|
17
|
+
colorProperties['--color-accent'] = matchValue[0].replace('-rgb', '')
|
|
18
|
+
colorProperties['--color-accent-foreground'] = `var(${matchValue[1].replace('-rgb', '')}-foreground, var(--color-light))`
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
...colorProperties,
|
|
22
|
+
'accent-color': settings.colorMix ? 'var(--color-accent)' : 'rgb(var(--color-accent))'
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
if (matchValue[1].includes('-rgb')) {
|
|
26
|
+
colorProperties['--color-accent'] = toColorValue(value)
|
|
27
|
+
} else {
|
|
28
|
+
colorProperties['--color-accent'] = settings.rgb ? `rgb(var(--color-accent-rgb) / ${toColorValue(value).match(/calc\((.*?)\)/)[0]})` : toColorValue(value)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
colorProperties['--color-accent-foreground'] = settings.rgb ? 'rgb(var(--color-accent-foreground-rgb))' : `var(${matchValue[1]}-foreground, var(--color-light))`
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
...colorProperties,
|
|
35
|
+
'accent-color': settings.colorMix ? 'var(--color-accent)' : 'rgb(var(--color-accent))'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
'--color-accent': toColorValue(value),
|
|
42
|
+
'accent-color': 'var(--color-accent)'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const textColor = ({ value, corePlugins }, settings) => {
|
|
47
|
+
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
48
|
+
const withCurrentRgb = {}
|
|
49
|
+
|
|
50
|
+
if (matchValue && settings.rgb) {
|
|
51
|
+
withCurrentRgb['--tw-text-current-rgb'] = matchValue[1].includes('rgb') ? matchValue[0] : `var(${matchValue[1]}-rgb)`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!corePlugins('textOpacity')) {
|
|
55
|
+
return {
|
|
56
|
+
...withCurrentRgb,
|
|
57
|
+
color: toColorValue(value)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
...withCurrentRgb,
|
|
63
|
+
...withAlphaVariable({
|
|
64
|
+
color: value,
|
|
65
|
+
property: 'color',
|
|
66
|
+
variable: '--tw-text-opacity'
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {[]} colors
|
|
3
|
+
* @param {boolean} colorMix
|
|
4
|
+
* @param {boolean} rgb
|
|
5
|
+
* @returns {[]}
|
|
6
|
+
*/
|
|
7
|
+
export const tailwindColors = (colors = [], colorMix = true, rgb = false) => {
|
|
8
|
+
colors.forEach(name => {
|
|
9
|
+
if (rgb) {
|
|
10
|
+
colors[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
colors[name] = colorMix
|
|
14
|
+
? `color-mix(in var(--space), var(--color-${name}) calc(<alpha-value> * 100%), transparent)`
|
|
15
|
+
: `rgb(var(--color-${name}) / <alpha-value>)`
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
return colors
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} type
|
|
23
|
+
* @param {string[]} variables
|
|
24
|
+
* @param {Object} values
|
|
25
|
+
* @returns {Object}
|
|
26
|
+
*/
|
|
27
|
+
export const tailwindVariables = (type, variables = [], values = {}) => {
|
|
28
|
+
variables.forEach(name => {
|
|
29
|
+
values[name] = `var(--${type}-${name})`
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return values
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {string} type
|
|
37
|
+
* @param {string[]} variables
|
|
38
|
+
* @param {Object} values
|
|
39
|
+
* @returns {Object}
|
|
40
|
+
*/
|
|
41
|
+
export const tailwindVariablesFont = (type, variables = [], values = {}) => {
|
|
42
|
+
variables.forEach(name => {
|
|
43
|
+
values[name] = [`var(--${type}-${name})`, `calc(var(--${type}-${name}) + 0.5rem)`]
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
return values
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} type
|
|
51
|
+
* @param {string[]} variables
|
|
52
|
+
* @returns {Object}
|
|
53
|
+
*/
|
|
54
|
+
export const tailwindPropertyUtilities = (type, variables = []) => {
|
|
55
|
+
const result = {}
|
|
56
|
+
|
|
57
|
+
variables.forEach(name => {
|
|
58
|
+
result[`.${type}-${name}`] = {
|
|
59
|
+
[type]: `var(--${type}-${name})`
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
return result
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {string[]} values
|
|
68
|
+
* @returns {Object}
|
|
69
|
+
*/
|
|
70
|
+
export const tailwindAnimations = (values) => {
|
|
71
|
+
const result = {}
|
|
72
|
+
|
|
73
|
+
values.forEach(value => {
|
|
74
|
+
result[`.animation-${value}`] = {
|
|
75
|
+
'animation-name': value
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return result
|
|
80
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default function divideGap ({ theme, e }) {
|
|
2
|
+
return [
|
|
3
|
+
...Object.entries(theme('spacing')).map(([key, value]) => {
|
|
4
|
+
return {
|
|
5
|
+
[`.${e(`divide-gap-x-${key}`)}`]: {
|
|
6
|
+
'& > :where(*:not(:first-child))': {
|
|
7
|
+
paddingLeft: value,
|
|
8
|
+
marginLeft: value
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
[`.${e(`divide-gap-y-${key}`)}`]: {
|
|
12
|
+
'& > :where(*:not(:first-child))': {
|
|
13
|
+
paddingTop: value,
|
|
14
|
+
marginTop: value
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'.dot': {
|
|
3
|
+
'--tw-bg-opacity': '1',
|
|
4
|
+
display: 'inline-flex',
|
|
5
|
+
width: '0.625rem',
|
|
6
|
+
height: '0.625rem',
|
|
7
|
+
borderRadius: 'var(--rounded-full)',
|
|
8
|
+
backgroundColor: 'color-mix(in srgb, var(--color-accent) calc(var(--tw-bg-opacity) * 100%), transparent)',
|
|
9
|
+
flexShrink: '0'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
:root, :host {
|
|
2
|
-
--transition: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, outline-color, outline-offset;
|
|
2
|
+
--transition: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, outline-color, outline-offset, visibility;
|
|
3
3
|
--transition-all: all var(--duration) var(--ease-in-out);
|
|
4
4
|
--transition-color: color var(--duration) var(--ease-in-out);
|
|
5
5
|
--transition-background: background var(--duration) var(--ease-in-out);
|
package/src/base/defaults.css
CHANGED
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
:where(hr) {
|
|
34
|
-
--tw-border-opacity:
|
|
34
|
+
--tw-border-opacity: 0.15;
|
|
35
35
|
|
|
36
|
-
border-
|
|
36
|
+
border-block-start: 1px solid color-mix(in var(--space), currentColor calc(var(--tw-border-opacity) * 100%), transparent);
|
|
37
37
|
border-radius: var(--rounded);
|
|
38
38
|
width: 100%;
|
|
39
39
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
:root, :host {
|
|
2
2
|
--space: sRGB;
|
|
3
3
|
--scheme: light;
|
|
4
|
-
--color-current: var(--color-main);
|
|
5
|
-
--color-current-foreground: var(--color-main-foreground);
|
|
6
4
|
--color-accent: var(--color-primary);
|
|
7
5
|
--color-accent-foreground: var(--color-primary-foreground);
|
|
8
6
|
--color-primary: #3b82f6; /* color.blue.500 */
|
package/src/common.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const nextRepaint = () => {
|
|
2
|
+
return new Promise(resolve => {
|
|
3
|
+
requestAnimationFrame(() => {
|
|
4
|
+
requestAnimationFrame(() => {
|
|
5
|
+
resolve()
|
|
6
|
+
})
|
|
7
|
+
})
|
|
8
|
+
})
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const animationsFinished = element => Promise.all(element.getAnimations().map(animation => animation.finished))
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
border-radius: inherit;
|
|
8
8
|
|
|
9
9
|
> *, &::before {
|
|
10
|
-
grid-area: 1/1;
|
|
11
10
|
position: relative;
|
|
12
|
-
z-index: 1;
|
|
13
11
|
pointer-events: none;
|
|
12
|
+
grid-area: 1/1;
|
|
13
|
+
z-index: 1;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
&::before {
|
|
17
|
-
content: "";
|
|
18
|
-
inline-size: 1px;
|
|
19
17
|
background-color: var(--color-accent);
|
|
20
18
|
inset-inline-start: var(--c-compare-position);
|
|
19
|
+
inline-size: 1px;
|
|
20
|
+
content: "";
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
> :where(input) {
|
|
@@ -27,15 +27,14 @@
|
|
|
27
27
|
|
|
28
28
|
&:is(:focus-visible, :active) {
|
|
29
29
|
~ .ui-btn {
|
|
30
|
-
--ui-btn-
|
|
31
|
-
--
|
|
32
|
-
--ui-btn-bg-opacity: 80%;
|
|
30
|
+
--tw-bg-mix: var(--ui-btn-hover-bg-mix, var(--color-dark));
|
|
31
|
+
--tw-bg-opacity: 0.8;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
&:focus-visible ~ .ui-btn {
|
|
37
|
-
outline-
|
|
38
|
-
outline-
|
|
36
|
+
--ui-btn-outline-offset: 2px;
|
|
37
|
+
--tw-outline-opacity: 0.5;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
&:active {
|
|
@@ -44,9 +43,9 @@
|
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
> :where(.ui-btn) {
|
|
47
|
-
margin-block: auto;
|
|
48
46
|
inset-inline-start: var(--c-compare-position);
|
|
49
47
|
margin-inline-start: calc(var(--ui-btn-width) / 2 * -1);
|
|
48
|
+
margin-block: auto;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
> :where(.ui-image) {
|
|
@@ -59,8 +58,8 @@
|
|
|
59
58
|
grid-area: 1/1;
|
|
60
59
|
|
|
61
60
|
&:first-child {
|
|
62
|
-
position: relative;
|
|
63
61
|
clip-path: var(--c-compare-clip-path);
|
|
62
|
+
position: relative;
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "default.css";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {import("./
|
|
3
|
-
* @param {import("./
|
|
2
|
+
* @param {import("./types/index").Position} event
|
|
3
|
+
* @param {import("./types/index").PositionOptions} options
|
|
4
4
|
* @returns void
|
|
5
5
|
*/
|
|
6
6
|
export const setPosition = ({ currentTarget }, options = {}) => {
|
|
@@ -14,7 +14,7 @@ export const setPosition = ({ currentTarget }, options = {}) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @param {import("./
|
|
17
|
+
* @param {import("./types/index").KeyboardStep} event
|
|
18
18
|
* @param {Number} step
|
|
19
19
|
* @returns void
|
|
20
20
|
*/
|
|
@@ -25,10 +25,16 @@ export const setKeyboardStep = ({ key, currentTarget }, step = 10) => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @param {import("./
|
|
28
|
+
* @param {import("./types/index").MouseStep} event
|
|
29
29
|
* @param {Number} step
|
|
30
30
|
* @returns void
|
|
31
31
|
*/
|
|
32
32
|
export const setMouseStep = ({ currentTarget }, step = 0.1) => {
|
|
33
33
|
currentTarget.step = step
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
setPosition,
|
|
38
|
+
setKeyboardStep,
|
|
39
|
+
setMouseStep
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Compare
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {HTMLInputElement | HTMLElement} element
|
|
3
|
+
* @returns Promise<void>
|
|
4
|
+
*/
|
|
5
|
+
export const showDetails = async (element) => {
|
|
6
|
+
const details = element.closest('details')
|
|
7
|
+
const { down } = await import('slide-element')
|
|
8
|
+
const content = element.closest('summary').nextElementSibling
|
|
9
|
+
|
|
10
|
+
details._isHiding = false
|
|
11
|
+
details.open = true
|
|
12
|
+
|
|
13
|
+
await down(content, {
|
|
14
|
+
display: ''
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {HTMLInputElement | HTMLElement} element
|
|
20
|
+
* @returns Promise<void>
|
|
21
|
+
*/
|
|
22
|
+
export const closeDetails = async (element) => {
|
|
23
|
+
const details = element.closest('details')
|
|
24
|
+
const { up } = await import('slide-element')
|
|
25
|
+
const content = element.closest('summary').nextElementSibling
|
|
26
|
+
|
|
27
|
+
details._isHiding = true
|
|
28
|
+
|
|
29
|
+
await up(content, {
|
|
30
|
+
display: ''
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
details._isHiding && (details.open = false)
|
|
34
|
+
details._isHiding = false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {HTMLInputElement | HTMLElement} element
|
|
39
|
+
* @returns Promise<void>
|
|
40
|
+
*/
|
|
41
|
+
export const toggleDetails = async (element) => {
|
|
42
|
+
const details = element.closest('details')
|
|
43
|
+
|
|
44
|
+
if (details._isHiding && !element.checked) return
|
|
45
|
+
|
|
46
|
+
if (element.checked ?? !details.open) {
|
|
47
|
+
await showDetails(element)
|
|
48
|
+
} else {
|
|
49
|
+
await closeDetails(element)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
showDetails,
|
|
55
|
+
closeDetails,
|
|
56
|
+
toggleDetails
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Details
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
background-color: var(--color-body-primary);
|
|
3
3
|
border-radius: var(--rounded-3xl);
|
|
4
4
|
padding: var(--c-dialog-py) var(--c-dialog-px);
|
|
5
|
-
|
|
5
|
+
inline-size: min(100%, var(--c-dialog-width, 35rem));
|
|
6
6
|
margin: auto;
|
|
7
7
|
animation: var(--duration) ease 0s backwards 1 fade-in-down;
|
|
8
8
|
|