daisyui 4.1.0-alpha.0 → 4.1.0-alpha.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/package.json +6 -13
- package/src/theming/functions.js +6 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daisyui",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.2",
|
|
4
4
|
"description": "daisyUI - Tailwind CSS Components",
|
|
5
5
|
"author": "Pouya Saadeghi",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"ui"
|
|
34
34
|
],
|
|
35
35
|
"main": "src/index.js",
|
|
36
|
-
"
|
|
36
|
+
"module": "src/index.js",
|
|
37
37
|
"types": "src/index.d.ts",
|
|
38
38
|
"files": [
|
|
39
39
|
"src/lib/**/*.js",
|
|
@@ -63,14 +63,7 @@
|
|
|
63
63
|
"build:skipfullcss": "node src/build --skipfullcss",
|
|
64
64
|
"dev": "cd src/docs && npm run dev",
|
|
65
65
|
"playground": "cd src/experiments/playground && npm run dev",
|
|
66
|
-
"release": "
|
|
67
|
-
"release:patch": "commit-and-tag-version --release-as patch",
|
|
68
|
-
"release:minor": "commit-and-tag-version --release-as minor",
|
|
69
|
-
"release:major": "commit-and-tag-version --release-as major",
|
|
70
|
-
"release:alpha": "commit-and-tag-version --prerelease alpha",
|
|
71
|
-
"release:alpha:patch": "commit-and-tag-version --prerelease alpha --release-as patch",
|
|
72
|
-
"release:alpha:minor": "commit-and-tag-version --prerelease alpha --release-as minor",
|
|
73
|
-
"release:alpha:major": "commit-and-tag-version --prerelease alpha --release-as major",
|
|
66
|
+
"release": "node src/release",
|
|
74
67
|
"publish:alpha": "npm publish --tag=alpha"
|
|
75
68
|
},
|
|
76
69
|
"devDependencies": {
|
|
@@ -79,9 +72,9 @@
|
|
|
79
72
|
"postcss-cli": "10.1.0",
|
|
80
73
|
"postcss-import": "15.1.0",
|
|
81
74
|
"prejss-cli": "0.3.3",
|
|
82
|
-
"prettier": "^3.0
|
|
83
|
-
"prettier-plugin-svelte": "^3.0
|
|
84
|
-
"prettier-plugin-tailwindcss": "^0.5.
|
|
75
|
+
"prettier": "^3.1.0",
|
|
76
|
+
"prettier-plugin-svelte": "^3.1.0",
|
|
77
|
+
"prettier-plugin-tailwindcss": "^0.5.7",
|
|
85
78
|
"tailwindcss": "^3.3.5"
|
|
86
79
|
},
|
|
87
80
|
"dependencies": {
|
package/src/theming/functions.js
CHANGED
|
@@ -3,6 +3,9 @@ import { variables, themesOrder } from "./themeDefaults"
|
|
|
3
3
|
|
|
4
4
|
import { toGamut, interpolate, wcagContrast } from "culori"
|
|
5
5
|
|
|
6
|
+
const cutNumber = (number) => (number ? +number.toFixed(6) : 0)
|
|
7
|
+
const toGamutOKLCH = toGamut("oklch")
|
|
8
|
+
|
|
6
9
|
export function isDark(color) {
|
|
7
10
|
if (wcagContrast(color, "black") < wcagContrast(color, "white")) {
|
|
8
11
|
return true
|
|
@@ -10,14 +13,8 @@ export function isDark(color) {
|
|
|
10
13
|
return false
|
|
11
14
|
}
|
|
12
15
|
export function colorObjToString(input) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
return 0
|
|
16
|
-
}
|
|
17
|
-
return +number.toFixed(6)
|
|
18
|
-
}
|
|
19
|
-
const { l, c, h } = input
|
|
20
|
-
return `${cut(l)} ${cut(c)} ${cut(h)}`
|
|
16
|
+
const { colorLightness, colorChroma, colorHue } = input
|
|
17
|
+
return `${cutNumber(colorLightness)} ${cutNumber(colorChroma)} ${cutNumber(colorHue)}`
|
|
21
18
|
}
|
|
22
19
|
export function generateForegroundColorFrom(input, percentage = 0.8) {
|
|
23
20
|
const result = interpolate([input, isDark(input) ? "white" : "black"], "oklch")(percentage)
|
|
@@ -36,7 +33,7 @@ export function convertColorFormat(input) {
|
|
|
36
33
|
|
|
37
34
|
Object.entries(input).forEach(([rule, value]) => {
|
|
38
35
|
if (colorNames.hasOwnProperty(rule)) {
|
|
39
|
-
const colorObj =
|
|
36
|
+
const colorObj = toGamutOKLCH("oklch")(value)
|
|
40
37
|
resultObj[colorNames[rule]] = colorObjToString(colorObj)
|
|
41
38
|
} else {
|
|
42
39
|
resultObj[rule] = value
|