winduum 2.1.2 → 2.1.3
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 +1 -1
- package/plugin/index.cjs +79 -79
- package/plugin/index.js +1 -1
- package/src/components/button/props/default.css +1 -1
- package/src/components/control/default.css +4 -0
- package/src/components/control/props/default.css +1 -1
- package/src/components/group/default.css +1 -1
- package/src/components/notice/props/default.css +1 -1
- package/src/components/popover/props/content.css +1 -1
- package/src/components/table/props/default.css +1 -1
- package/src/components/tabs/list.css +1 -1
package/package.json
CHANGED
package/plugin/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const plugin = require('tailwindcss/plugin')
|
|
6
|
+
const flattenColorPalette = require('tailwindcss/src/util/flattenColorPalette')
|
|
7
|
+
const withAlphaVariable = require('tailwindcss/src/util/withAlphaVariable')
|
|
8
|
+
const toColorValue = require('tailwindcss/src/util/toColorValue')
|
|
9
|
+
const node_fs = require('node:fs')
|
|
10
|
+
const node_url = require('node:url')
|
|
11
|
+
const node_path = require('node:path')
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
function divideGap
|
|
13
|
+
const _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null
|
|
14
|
+
function divideGap({ theme, e }) {
|
|
15
15
|
return [
|
|
16
16
|
...Object.entries(theme('spacing')).map(([key, value]) => {
|
|
17
17
|
return {
|
|
@@ -33,20 +33,20 @@ function divideGap ({ theme, e }) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const accentColor = ({ value }, settings) => {
|
|
36
|
-
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
37
|
-
const colorProperties = {}
|
|
36
|
+
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
37
|
+
const colorProperties = {}
|
|
38
38
|
|
|
39
39
|
if (matchValue) {
|
|
40
40
|
if (settings.rgb) {
|
|
41
|
-
colorProperties['--color-accent-rgb']
|
|
42
|
-
`var(${matchValue[1].includes('-rgb') ? matchValue[1] : matchValue[1] + '-rgb'})
|
|
43
|
-
colorProperties['--color-accent-foreground-rgb']
|
|
44
|
-
`var(${matchValue[1].includes('-rgb') ? matchValue[1].replace('-rgb', '-foreground-rgb') : matchValue[1] + '-foreground-rgb, var(--color-light-rgb)'})
|
|
41
|
+
colorProperties['--color-accent-rgb']
|
|
42
|
+
= `var(${matchValue[1].includes('-rgb') ? matchValue[1] : matchValue[1] + '-rgb'})`
|
|
43
|
+
colorProperties['--color-accent-foreground-rgb']
|
|
44
|
+
= `var(${matchValue[1].includes('-rgb') ? matchValue[1].replace('-rgb', '-foreground-rgb') : matchValue[1] + '-foreground-rgb, var(--color-light-rgb)'})`
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (toColorValue(value).includes('calc(1 * 100%)') || toColorValue(value).includes(' / 1')) {
|
|
48
|
-
colorProperties['--color-accent'] = matchValue[0].replace('-rgb', '')
|
|
49
|
-
colorProperties['--color-accent-foreground'] = `var(${matchValue[1].replace('-rgb', '')}-foreground, var(--color-light))
|
|
48
|
+
colorProperties['--color-accent'] = matchValue[0].replace('-rgb', '')
|
|
49
|
+
colorProperties['--color-accent-foreground'] = `var(${matchValue[1].replace('-rgb', '')}-foreground, var(--color-light))`
|
|
50
50
|
|
|
51
51
|
return {
|
|
52
52
|
...colorProperties,
|
|
@@ -54,12 +54,12 @@ const accentColor = ({ value }, settings) => {
|
|
|
54
54
|
}
|
|
55
55
|
} else {
|
|
56
56
|
if (matchValue[1].includes('-rgb')) {
|
|
57
|
-
colorProperties['--color-accent'] = toColorValue(value)
|
|
57
|
+
colorProperties['--color-accent'] = toColorValue(value)
|
|
58
58
|
} else {
|
|
59
|
-
colorProperties['--color-accent'] = settings.rgb ? `rgb(var(--color-accent-rgb) / ${toColorValue(value).match(/calc\((.*?)\)/)[0]})` : toColorValue(value)
|
|
59
|
+
colorProperties['--color-accent'] = settings.rgb ? `rgb(var(--color-accent-rgb) / ${toColorValue(value).match(/calc\((.*?)\)/)[0]})` : toColorValue(value)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
colorProperties['--color-accent-foreground'] = settings.rgb ? 'rgb(var(--color-accent-foreground-rgb))' : `var(${matchValue[1]}-foreground, var(--color-light))
|
|
62
|
+
colorProperties['--color-accent-foreground'] = settings.rgb ? 'rgb(var(--color-accent-foreground-rgb))' : `var(${matchValue[1]}-foreground, var(--color-light))`
|
|
63
63
|
|
|
64
64
|
return {
|
|
65
65
|
...colorProperties,
|
|
@@ -72,14 +72,14 @@ const accentColor = ({ value }, settings) => {
|
|
|
72
72
|
'--color-accent': toColorValue(value),
|
|
73
73
|
'accent-color': 'var(--color-accent)'
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
76
|
|
|
77
77
|
const textColor = ({ value, corePlugins }, settings) => {
|
|
78
|
-
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
79
|
-
const withCurrentRgb = {}
|
|
78
|
+
const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/)
|
|
79
|
+
const withCurrentRgb = {}
|
|
80
80
|
|
|
81
81
|
if (matchValue && settings.rgb) {
|
|
82
|
-
withCurrentRgb['--tw-text-current-rgb'] = matchValue[1].includes('rgb') ? matchValue[0] : `var(${matchValue[1]}-rgb)
|
|
82
|
+
withCurrentRgb['--tw-text-current-rgb'] = matchValue[1].includes('rgb') ? matchValue[0] : `var(${matchValue[1]}-rgb)`
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (!corePlugins('textOpacity')) {
|
|
@@ -97,7 +97,7 @@ const textColor = ({ value, corePlugins }, settings) => {
|
|
|
97
97
|
variable: '--tw-text-opacity'
|
|
98
98
|
})
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* @param {[]} colors
|
|
@@ -108,20 +108,20 @@ const textColor = ({ value, corePlugins }, settings) => {
|
|
|
108
108
|
const tailwindColors = (colors = [], colorMix = true, rgb = false) => {
|
|
109
109
|
const result = {
|
|
110
110
|
current: 'color-mix(in var(--default-color-space), currentcolor calc(<alpha-value> * 100%), var(--default-color-mix, transparent))'
|
|
111
|
-
}
|
|
111
|
+
}
|
|
112
112
|
|
|
113
113
|
colors.forEach((name) => {
|
|
114
114
|
if (rgb) {
|
|
115
|
-
result[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)
|
|
115
|
+
result[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
result[name] = colorMix
|
|
119
119
|
? `color-mix(in var(--default-color-space), var(--color-${name}) calc(<alpha-value> * 100%), var(--default-color-mix, transparent))`
|
|
120
|
-
: `rgb(var(--color-${name}) / <alpha-value>)
|
|
121
|
-
})
|
|
120
|
+
: `rgb(var(--color-${name}) / <alpha-value>)`
|
|
121
|
+
})
|
|
122
122
|
|
|
123
123
|
return result
|
|
124
|
-
}
|
|
124
|
+
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* @param {string} type
|
|
@@ -135,42 +135,42 @@ const tailwindVariables = (type, variables = [], values = {}) => {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
variables.forEach((name) => {
|
|
138
|
-
values[name] = `var(--${type}-${name.replace(/\./g, '_')})
|
|
139
|
-
})
|
|
138
|
+
values[name] = `var(--${type}-${name.replace(/\./g, '_')})`
|
|
139
|
+
})
|
|
140
140
|
|
|
141
141
|
return values
|
|
142
|
-
}
|
|
142
|
+
}
|
|
143
143
|
|
|
144
144
|
const tailwindParseVariables = (type, file, customValues = {}, customPath, initialValues = true) => {
|
|
145
145
|
const parseFile = (fileContent) => {
|
|
146
|
-
const regex = /(--[\w-]+):\s*([^;]+);/g
|
|
147
|
-
const matches = [...fileContent.matchAll(regex)]
|
|
148
|
-
const variables = matches.map(match => [match[1], match[2]])
|
|
149
|
-
const values = {}
|
|
146
|
+
const regex = /(--[\w-]+):\s*([^;]+);/g
|
|
147
|
+
const matches = [...fileContent.matchAll(regex)]
|
|
148
|
+
const variables = matches.map(match => [match[1], match[2]])
|
|
149
|
+
const values = {}
|
|
150
150
|
|
|
151
151
|
variables.forEach((match, index) => {
|
|
152
152
|
if (!match[0].startsWith(`--${type}-`) || match[0].endsWith('--line-height')) {
|
|
153
153
|
return
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
const name = match[0].replace(`--${type}-`, '')
|
|
156
|
+
const name = match[0].replace(`--${type}-`, '')
|
|
157
157
|
|
|
158
|
-
values[name.replace(/_/g, '.')] = type === 'font-size' ? [`var(${match})`, `var(${variables[index + 1]})`] : `var(${initialValues ? match : match[0]})
|
|
159
|
-
})
|
|
158
|
+
values[name.replace(/_/g, '.')] = type === 'font-size' ? [`var(${match})`, `var(${variables[index + 1]})`] : `var(${initialValues ? match : match[0]})`
|
|
159
|
+
})
|
|
160
160
|
|
|
161
161
|
return values
|
|
162
|
-
}
|
|
162
|
+
}
|
|
163
163
|
|
|
164
|
-
const fileContent = node_fs.readFileSync(file).toString()
|
|
165
|
-
const values = parseFile(fileContent)
|
|
164
|
+
const fileContent = node_fs.readFileSync(file).toString()
|
|
165
|
+
const values = parseFile(fileContent)
|
|
166
166
|
|
|
167
167
|
if (customPath && !Array.isArray(customPath)) {
|
|
168
|
-
const customFileContent = node_fs.readFileSync(node_path.resolve(process.cwd(), customPath)).toString()
|
|
169
|
-
customValues = { ...customValues, ...parseFile(customFileContent) }
|
|
168
|
+
const customFileContent = node_fs.readFileSync(node_path.resolve(process.cwd(), customPath)).toString()
|
|
169
|
+
customValues = { ...customValues, ...parseFile(customFileContent) }
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
return { ...values, ...customValues }
|
|
173
|
-
}
|
|
173
|
+
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* @param {string} type
|
|
@@ -180,11 +180,11 @@ const tailwindParseVariables = (type, file, customValues = {}, customPath, initi
|
|
|
180
180
|
*/
|
|
181
181
|
const tailwindVariablesFont = (type, variables = [], values = {}) => {
|
|
182
182
|
variables.forEach(({ value, initial }) => {
|
|
183
|
-
values[value] = [`var(--${type}-${value}, ${initial})`, `calc(var(--${type}-${value}) + 0.5rem)`]
|
|
184
|
-
})
|
|
183
|
+
values[value] = [`var(--${type}-${value}, ${initial})`, `calc(var(--${type}-${value}) + 0.5rem)`]
|
|
184
|
+
})
|
|
185
185
|
|
|
186
186
|
return values
|
|
187
|
-
}
|
|
187
|
+
}
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
190
|
* @param {string} type
|
|
@@ -192,34 +192,34 @@ const tailwindVariablesFont = (type, variables = [], values = {}) => {
|
|
|
192
192
|
* @returns {Object}
|
|
193
193
|
*/
|
|
194
194
|
const tailwindPropertyUtilities = (type, variables = []) => {
|
|
195
|
-
const result = {}
|
|
195
|
+
const result = {}
|
|
196
196
|
|
|
197
197
|
variables.forEach((name) => {
|
|
198
198
|
result[`.${type}-${name}`] = {
|
|
199
199
|
[type]: `var(--${type}-${name})`
|
|
200
|
-
}
|
|
201
|
-
})
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
202
|
|
|
203
203
|
return result
|
|
204
|
-
}
|
|
204
|
+
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* @param {string[]} values
|
|
208
208
|
* @returns {Object}
|
|
209
209
|
*/
|
|
210
210
|
const tailwindAnimations = (values) => {
|
|
211
|
-
const result = {}
|
|
211
|
+
const result = {}
|
|
212
212
|
|
|
213
213
|
values.forEach((value) => {
|
|
214
214
|
result[`.animation-${value}`] = {
|
|
215
215
|
'animation-name': value
|
|
216
|
-
}
|
|
217
|
-
})
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
218
|
|
|
219
219
|
return result
|
|
220
|
-
}
|
|
220
|
+
}
|
|
221
221
|
|
|
222
|
-
const relativePath = file => node_path.resolve(node_path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), file)
|
|
222
|
+
const relativePath = file => node_path.resolve(node_path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), file)
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
225
|
* @type {import('./').PluginOptions} options.
|
|
@@ -242,7 +242,7 @@ const defaultConfig = {
|
|
|
242
242
|
rgb: false,
|
|
243
243
|
colorMix: true
|
|
244
244
|
}
|
|
245
|
-
}
|
|
245
|
+
}
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
248
|
* @param {import('./').PluginOptions} userConfig
|
|
@@ -251,13 +251,13 @@ const createPlugin = (userConfig = {}) => {
|
|
|
251
251
|
const settings = {
|
|
252
252
|
...defaultConfig.settings,
|
|
253
253
|
...userConfig.settings
|
|
254
|
-
}
|
|
254
|
+
}
|
|
255
255
|
|
|
256
256
|
userConfig = {
|
|
257
257
|
...defaultConfig,
|
|
258
258
|
...userConfig,
|
|
259
259
|
settings
|
|
260
|
-
}
|
|
260
|
+
}
|
|
261
261
|
|
|
262
262
|
return plugin(({ addComponents, matchUtilities, theme, e, corePlugins }) => {
|
|
263
263
|
matchUtilities(
|
|
@@ -265,18 +265,18 @@ const createPlugin = (userConfig = {}) => {
|
|
|
265
265
|
accent: value => accentColor({ value }, userConfig.settings)
|
|
266
266
|
},
|
|
267
267
|
{ values: flattenColorPalette(theme('accentColor')), type: ['color', 'any'] }
|
|
268
|
-
)
|
|
268
|
+
)
|
|
269
269
|
matchUtilities(
|
|
270
270
|
{
|
|
271
271
|
text: value => textColor({ value, corePlugins }, userConfig.settings)
|
|
272
272
|
},
|
|
273
273
|
{ values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
|
|
274
|
-
)
|
|
275
|
-
addComponents(tailwindAnimations(userConfig.animations))
|
|
274
|
+
)
|
|
275
|
+
addComponents(tailwindAnimations(userConfig.animations))
|
|
276
276
|
addComponents(tailwindPropertyUtilities('mask', Object.keys(tailwindParseVariables('mask', relativePath('../src/theme/config/mask.css'), {
|
|
277
277
|
...tailwindVariables('mask', userConfig.mask ?? [])
|
|
278
|
-
}, userConfig.mask, false))))
|
|
279
|
-
addComponents(divideGap({ theme, e }))
|
|
278
|
+
}, userConfig.mask, false))))
|
|
279
|
+
addComponents(divideGap({ theme, e }))
|
|
280
280
|
}, {
|
|
281
281
|
corePlugins: {
|
|
282
282
|
preflight: false,
|
|
@@ -316,19 +316,19 @@ const createPlugin = (userConfig = {}) => {
|
|
|
316
316
|
}, userConfig.spacing),
|
|
317
317
|
borderRadius: tailwindParseVariables('radius', relativePath('../src/theme/config/radius.css'), {
|
|
318
318
|
...tailwindVariables('radius', userConfig.borderRadius ?? []),
|
|
319
|
-
DEFAULT: 'var(--radius)'
|
|
319
|
+
DEFAULT: 'var(--radius-xl)'
|
|
320
320
|
}, userConfig.borderRadius),
|
|
321
321
|
screens: userConfig.screens
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
})
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
exports.createPlugin = createPlugin
|
|
328
|
-
exports.default = createPlugin
|
|
329
|
-
exports.defaultConfig = defaultConfig
|
|
330
|
-
exports.tailwindAnimations = tailwindAnimations
|
|
331
|
-
exports.tailwindColors = tailwindColors
|
|
332
|
-
exports.tailwindPropertyUtilities = tailwindPropertyUtilities
|
|
333
|
-
exports.tailwindVariables = tailwindVariables
|
|
334
|
-
exports.tailwindVariablesFont = tailwindVariablesFont
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
exports.createPlugin = createPlugin
|
|
328
|
+
exports.default = createPlugin
|
|
329
|
+
exports.defaultConfig = defaultConfig
|
|
330
|
+
exports.tailwindAnimations = tailwindAnimations
|
|
331
|
+
exports.tailwindColors = tailwindColors
|
|
332
|
+
exports.tailwindPropertyUtilities = tailwindPropertyUtilities
|
|
333
|
+
exports.tailwindVariables = tailwindVariables
|
|
334
|
+
exports.tailwindVariablesFont = tailwindVariablesFont
|
package/plugin/index.js
CHANGED
|
@@ -110,7 +110,7 @@ export const createPlugin = (userConfig = {}) => {
|
|
|
110
110
|
}, userConfig.spacing),
|
|
111
111
|
borderRadius: tailwindParseVariables('radius', relativePath('../src/theme/config/radius.css'), {
|
|
112
112
|
...tailwindVariables('radius', userConfig.borderRadius ?? []),
|
|
113
|
-
DEFAULT: 'var(--radius)'
|
|
113
|
+
DEFAULT: 'var(--radius-xl)'
|
|
114
114
|
}, userConfig.borderRadius),
|
|
115
115
|
screens: userConfig.screens
|
|
116
116
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:root, :host {
|
|
2
2
|
--x-button-outline-width: 2px;
|
|
3
3
|
--x-button-border-width: 0px;
|
|
4
|
-
--x-button-border-radius: var(--radius);
|
|
4
|
+
--x-button-border-radius: var(--radius-xl);
|
|
5
5
|
--x-button-font-size: var(--text-sm);
|
|
6
6
|
--x-button-font-weight: var(--font-weight-medium);
|
|
7
7
|
--x-button-gap: calc(var(--spacing) * 2);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--x-control-padding-inline: 0.75rem;
|
|
5
5
|
--x-control-padding-block: 0.75rem;
|
|
6
6
|
--x-control-border-width: 1px;
|
|
7
|
-
--x-control-border-radius: var(--radius);
|
|
7
|
+
--x-control-border-radius: var(--radius-xl);
|
|
8
8
|
--x-control-border-color: currentColor;
|
|
9
9
|
--x-control-font-weight: var(--font-weight-medium);
|
|
10
10
|
--x-control-font-size: var(--text-base);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
--x-notice-padding-block: 1.25rem;
|
|
3
3
|
--x-notice-padding-inline: 1.5rem;
|
|
4
4
|
--x-notice-font-size: var(--text-sm);
|
|
5
|
-
--x-notice-border-radius: var(--radius);
|
|
5
|
+
--x-notice-border-radius: var(--radius-xl);
|
|
6
6
|
--x-notice-outline-width: 1px;
|
|
7
7
|
--x-notice-outline-offset: calc(var(--x-notice-outline-width, 1px) * -1);
|
|
8
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:root, :host {
|
|
2
2
|
--x-popover-content-background-color: var(--color-body-primary);
|
|
3
|
-
--x-popover-content-border-radius: var(--radius);
|
|
3
|
+
--x-popover-content-border-radius: var(--radius-xl);
|
|
4
4
|
--x-popover-content-padding-block: calc(var(--spacing) * 2);
|
|
5
5
|
--x-popover-content-padding-inline: calc(var(--spacing) * 2);
|
|
6
6
|
--x-popover-content-scale-y: 0.75;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
background-color: var(--x-tabs-list-background-color, var(--color-body-secondary));
|
|
3
3
|
gap: var(--x-tabs-list-gap, calc(var(--spacing) * 1));
|
|
4
4
|
padding: var(--x-tabs-list-padding, calc(var(--spacing) * 1));
|
|
5
|
-
border-radius: var(--x-tabs-list-border-radius, var(--radius));
|
|
5
|
+
border-radius: var(--x-tabs-list-border-radius, var(--radius-xl));
|
|
6
6
|
display: flex;
|
|
7
7
|
inline-size: max-content;
|
|
8
8
|
}
|