@spark-ui/tailwind-plugins 3.4.2 → 3.6.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.
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [3.6.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@3.5.0...@spark-ui/tailwind-plugins@3.6.0) (2024-01-04)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **tailwind-plugins:** export TCV utils ([6fba6dc](https://github.com/adevinta/spark/commit/6fba6dc08a18f0f1c0773464494a5aba331dd572))
|
11
|
+
|
12
|
+
# [3.5.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@3.4.2...@spark-ui/tailwind-plugins@3.5.0) (2024-01-03)
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
- **tailwind-plugins:** add size field to sizing plugin ([8642feb](https://github.com/adevinta/spark/commit/8642febdda1a229f480f8828105729b43ad07b98))
|
17
|
+
|
6
18
|
## [3.4.2](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@3.4.1...@spark-ui/tailwind-plugins@3.4.2) (2023-11-03)
|
7
19
|
|
8
20
|
### Bug Fixes
|
package/index.js
CHANGED
@@ -4,7 +4,8 @@ const sizings = require('./sizings')
|
|
4
4
|
const utilities = require('./utilities')
|
5
5
|
const variants = require('./variants')
|
6
6
|
const sparkTheme = require('./spark-theme')
|
7
|
-
const
|
7
|
+
const tailwindConfigViewerUtils = require('./tailwind-config-viewer')
|
8
|
+
const tailwindConfigViewerMisc = require('./tailwind-config-viewer/misc')
|
8
9
|
const tailwindcssRadix = require('tailwindcss-radix')
|
9
10
|
|
10
11
|
/**
|
@@ -37,5 +38,6 @@ module.exports = {
|
|
37
38
|
variants,
|
38
39
|
sparkTheme,
|
39
40
|
sparkConfig,
|
41
|
+
tailwindConfigViewerUtils,
|
40
42
|
tailwindConfigViewerMisc,
|
41
43
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spark-ui/tailwind-plugins",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.6.0",
|
4
4
|
"description": "Spark Tailwind plugins",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -35,5 +35,5 @@
|
|
35
35
|
},
|
36
36
|
"homepage": "https://sparkui.vercel.app",
|
37
37
|
"license": "MIT",
|
38
|
-
"gitHead": "
|
38
|
+
"gitHead": "25220468e758c9c4bad519c93d6bbbf45ae109ab"
|
39
39
|
}
|
package/sizings/index.js
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
const utils = {
|
2
|
+
isObject(value) {
|
3
|
+
return !!value && value.constructor === Object
|
4
|
+
},
|
5
|
+
isStringOrNumber(value) {
|
6
|
+
return typeof value === 'string' || typeof value === 'number'
|
7
|
+
},
|
8
|
+
toKebabCase(value) {
|
9
|
+
if (value.toUpperCase() === value) return value.toLowerCase()
|
10
|
+
|
11
|
+
return value.replace(/[A-Z0-9]/g, e => `-${e.toLocaleLowerCase()}`)
|
12
|
+
},
|
13
|
+
doubleHyphensRegex: /(?<!var\()--+/g,
|
14
|
+
}
|
15
|
+
|
16
|
+
function toTailwindConfigViewer(defaultTheme) {
|
17
|
+
const result = {}
|
18
|
+
|
19
|
+
function flatten(theme, paths = []) {
|
20
|
+
Object.entries(theme).forEach(([key, value]) => {
|
21
|
+
if (utils.isObject(value)) return flatten(value, paths.concat(key))
|
22
|
+
|
23
|
+
if (utils.isStringOrNumber(value)) {
|
24
|
+
if (paths.includes('colors')) {
|
25
|
+
result[
|
26
|
+
`rgb(var(--${[...paths, key]
|
27
|
+
.map(utils.toKebabCase)
|
28
|
+
.join('-')
|
29
|
+
.replace(utils.doubleHyphensRegex, '-')}) / <alpha-value>)`
|
30
|
+
] = value
|
31
|
+
}
|
32
|
+
|
33
|
+
result[
|
34
|
+
`var(--${[...paths, key]
|
35
|
+
.map(utils.toKebabCase)
|
36
|
+
.join('-')
|
37
|
+
.replace(utils.doubleHyphensRegex, '-')})`
|
38
|
+
] = value
|
39
|
+
}
|
40
|
+
})
|
41
|
+
}
|
42
|
+
|
43
|
+
flatten(defaultTheme)
|
44
|
+
|
45
|
+
return result
|
46
|
+
}
|
47
|
+
|
48
|
+
module.exports = { toTailwindConfigViewer }
|
File without changes
|