daisyui 2.0.0-next.1 → 2.0.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/README.md +107 -89
- package/colors/colorNames.js +25 -26
- package/colors/index.js +18 -19
- package/colors/themes.js +274 -273
- package/colors/windi.js +6 -6
- package/dist/base.js +1 -1
- package/dist/full.css +18 -21
- package/dist/styled.css +345 -382
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/dist/themes.css +1 -2
- package/dist/unstyled.css +113 -132
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.rtl.js +1 -1
- package/dist/utilities-styled.js +1 -1
- package/dist/utilities-unstyled.js +1 -1
- package/dist/utilities.js +1 -1
- package/index.js +168 -100
- package/package.json +4 -1
- package/colors/colors/colorNames.js +0 -35
- package/colors/colors/index.js +0 -53
- package/colors/colors/themes.js +0 -881
- package/colors/colors/windi.js +0 -12
package/index.js
CHANGED
|
@@ -1,159 +1,227 @@
|
|
|
1
|
-
const daisyuiInfo = require(
|
|
2
|
-
const colors = require(
|
|
3
|
-
const utilities = require(
|
|
4
|
-
const base = require(
|
|
5
|
-
const unstyled = require(
|
|
6
|
-
const unstyledRtl = require(
|
|
7
|
-
const styled = require(
|
|
8
|
-
const styledRtl = require(
|
|
9
|
-
const utilitiesUnstyled = require(
|
|
10
|
-
const utilitiesStyled = require(
|
|
11
|
-
const themes = require(
|
|
12
|
-
const colorNames = require(
|
|
13
|
-
const Color = require(
|
|
1
|
+
const daisyuiInfo = require("./package.json");
|
|
2
|
+
const colors = require("./colors/index");
|
|
3
|
+
const utilities = require("./dist/utilities");
|
|
4
|
+
const base = require("./dist/base");
|
|
5
|
+
const unstyled = require("./dist/unstyled");
|
|
6
|
+
const unstyledRtl = require("./dist/unstyled.rtl");
|
|
7
|
+
const styled = require("./dist/styled");
|
|
8
|
+
const styledRtl = require("./dist/styled.rtl");
|
|
9
|
+
const utilitiesUnstyled = require("./dist/utilities-unstyled");
|
|
10
|
+
const utilitiesStyled = require("./dist/utilities-styled");
|
|
11
|
+
const themes = require("./colors/themes");
|
|
12
|
+
const colorNames = require("./colors/colorNames");
|
|
13
|
+
const Color = require("color");
|
|
14
14
|
|
|
15
15
|
const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
16
|
-
let diasyuiIncludedItems = []
|
|
17
|
-
let logs = false
|
|
18
|
-
if (config(
|
|
19
|
-
logs = true
|
|
16
|
+
let diasyuiIncludedItems = [];
|
|
17
|
+
let logs = false;
|
|
18
|
+
if (config("daisyui.logs") != false) {
|
|
19
|
+
logs = true;
|
|
20
20
|
}
|
|
21
21
|
if (logs) {
|
|
22
|
-
console.log()
|
|
23
|
-
console.log(
|
|
24
|
-
|
|
22
|
+
console.log();
|
|
23
|
+
console.log(
|
|
24
|
+
"\x1b[35m%s\x1b[0m",
|
|
25
|
+
"🌼 daisyUI components " + daisyuiInfo.version,
|
|
26
|
+
"\x1b[0m",
|
|
27
|
+
daisyuiInfo.homepage
|
|
28
|
+
);
|
|
29
|
+
console.group();
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
// inject @base style
|
|
28
|
-
if (config(
|
|
29
|
-
addBase(base)
|
|
30
|
-
diasyuiIncludedItems.push(
|
|
32
|
+
// inject @base style
|
|
33
|
+
if (config("daisyui.base") != false) {
|
|
34
|
+
addBase(base);
|
|
35
|
+
diasyuiIncludedItems.push("base");
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
// inject components
|
|
34
39
|
// because rollupjs doesn't supprt dynamic require
|
|
35
|
-
let file = styled
|
|
36
|
-
if (config(
|
|
37
|
-
diasyuiIncludedItems.push(
|
|
38
|
-
file = unstyled
|
|
39
|
-
} else if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
file =
|
|
46
|
-
} else if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
let file = styled;
|
|
41
|
+
if (config("daisyui.styled") == false && config("daisyui.rtl") != true) {
|
|
42
|
+
diasyuiIncludedItems.push("unstyled components");
|
|
43
|
+
file = unstyled;
|
|
44
|
+
} else if (
|
|
45
|
+
config("daisyui.styled") == false &&
|
|
46
|
+
config("daisyui.rtl") == true
|
|
47
|
+
) {
|
|
48
|
+
diasyuiIncludedItems.push("unstyled components");
|
|
49
|
+
console.log("\x1b[36m%s\x1b[0m", " Direction:", "\x1b[0m", "RTL");
|
|
50
|
+
file = unstyledRtl;
|
|
51
|
+
} else if (
|
|
52
|
+
config("daisyui.styled") != false &&
|
|
53
|
+
config("daisyui.rtl") != true
|
|
54
|
+
) {
|
|
55
|
+
diasyuiIncludedItems.push("components");
|
|
56
|
+
file = styled;
|
|
57
|
+
} else if (
|
|
58
|
+
config("daisyui.styled") !== false &&
|
|
59
|
+
config("daisyui.rtl") == true
|
|
60
|
+
) {
|
|
61
|
+
diasyuiIncludedItems.push("components");
|
|
62
|
+
console.log("\x1b[36m%s\x1b[0m", " Direction:", "\x1b[0m", "RTL");
|
|
63
|
+
file = styledRtl;
|
|
50
64
|
}
|
|
51
|
-
addComponents(file)
|
|
65
|
+
addComponents(file);
|
|
52
66
|
|
|
53
|
-
let includedThemesObj = new Object()
|
|
67
|
+
let includedThemesObj = new Object();
|
|
54
68
|
|
|
55
69
|
function convertThemeColorsToHsl(input) {
|
|
56
|
-
let resultObj = {}
|
|
57
|
-
if (typeof input ===
|
|
70
|
+
let resultObj = {};
|
|
71
|
+
if (typeof input === "object" && input !== null) {
|
|
58
72
|
Object.entries(input).forEach(([rule, value]) => {
|
|
59
73
|
if (colorNames.hasOwnProperty(rule)) {
|
|
60
|
-
const hslArray = Color(value).hsl().round().array()
|
|
61
|
-
resultObj[colorNames[rule]] =
|
|
74
|
+
const hslArray = Color(value).hsl().round().array();
|
|
75
|
+
resultObj[colorNames[rule]] =
|
|
76
|
+
hslArray[0] + " " + hslArray[1] + "%" + " " + hslArray[2] + "%";
|
|
62
77
|
} else {
|
|
63
|
-
resultObj[rule] = value
|
|
78
|
+
resultObj[rule] = value;
|
|
64
79
|
// console.log(input)
|
|
65
80
|
}
|
|
66
|
-
})
|
|
67
|
-
return resultObj
|
|
81
|
+
});
|
|
82
|
+
return resultObj;
|
|
68
83
|
}
|
|
69
|
-
return input
|
|
84
|
+
return input;
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
// add light themes
|
|
73
|
-
if (config(
|
|
88
|
+
if (config("daisyui.themes") == false) {
|
|
74
89
|
Object.entries(themes).forEach(([theme, index]) => {
|
|
75
|
-
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme])
|
|
90
|
+
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme]);
|
|
76
91
|
});
|
|
77
92
|
}
|
|
78
93
|
|
|
79
94
|
// add default themes
|
|
80
|
-
if (config(
|
|
95
|
+
if (config("daisyui.themes") != false) {
|
|
81
96
|
Object.entries(themes).forEach(([theme, index]) => {
|
|
82
|
-
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme])
|
|
97
|
+
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme]);
|
|
83
98
|
});
|
|
84
99
|
}
|
|
85
100
|
|
|
86
101
|
// add custom themes
|
|
87
|
-
if (Array.isArray(config(
|
|
88
|
-
config(
|
|
89
|
-
if (typeof item ===
|
|
102
|
+
if (Array.isArray(config("daisyui.themes"))) {
|
|
103
|
+
config("daisyui.themes").forEach((item, index) => {
|
|
104
|
+
if (typeof item === "object" && item !== null) {
|
|
90
105
|
Object.entries(item).forEach(([customThemeName, customThemevalue]) => {
|
|
91
|
-
includedThemesObj[
|
|
92
|
-
|
|
106
|
+
includedThemesObj["[data-theme=" + customThemeName + "]"] =
|
|
107
|
+
convertThemeColorsToHsl(customThemevalue);
|
|
108
|
+
});
|
|
93
109
|
}
|
|
94
|
-
})
|
|
110
|
+
});
|
|
95
111
|
}
|
|
96
112
|
|
|
97
|
-
let themeOrder = []
|
|
98
|
-
if (Array.isArray(config(
|
|
99
|
-
config(
|
|
100
|
-
if (typeof theme ===
|
|
113
|
+
let themeOrder = [];
|
|
114
|
+
if (Array.isArray(config("daisyui.themes"))) {
|
|
115
|
+
config("daisyui.themes").forEach((theme, index) => {
|
|
116
|
+
if (typeof theme === "object" && theme !== null) {
|
|
101
117
|
Object.entries(theme).forEach(([customThemeName, customThemevalue]) => {
|
|
102
|
-
themeOrder.push(customThemeName)
|
|
103
|
-
})
|
|
104
|
-
} else if (
|
|
105
|
-
|
|
118
|
+
themeOrder.push(customThemeName);
|
|
119
|
+
});
|
|
120
|
+
} else if (
|
|
121
|
+
includedThemesObj.hasOwnProperty("[data-theme=" + theme + "]")
|
|
122
|
+
) {
|
|
123
|
+
themeOrder.push(theme);
|
|
106
124
|
}
|
|
107
|
-
})
|
|
108
|
-
} else if (config(
|
|
109
|
-
themeOrder = [
|
|
110
|
-
|
|
111
|
-
|
|
125
|
+
});
|
|
126
|
+
} else if (config("daisyui.themes") != false) {
|
|
127
|
+
themeOrder = [
|
|
128
|
+
"light",
|
|
129
|
+
"dark",
|
|
130
|
+
"cupcake",
|
|
131
|
+
"bumblebee",
|
|
132
|
+
"emerald",
|
|
133
|
+
"corporate",
|
|
134
|
+
"synthwave",
|
|
135
|
+
"retro",
|
|
136
|
+
"cyberpunk",
|
|
137
|
+
"valentine",
|
|
138
|
+
"halloween",
|
|
139
|
+
"garden",
|
|
140
|
+
"forest",
|
|
141
|
+
"aqua",
|
|
142
|
+
"lofi",
|
|
143
|
+
"pastel",
|
|
144
|
+
"fantasy",
|
|
145
|
+
"wireframe",
|
|
146
|
+
"black",
|
|
147
|
+
"luxury",
|
|
148
|
+
"dracula",
|
|
149
|
+
"cmyk",
|
|
150
|
+
];
|
|
151
|
+
} else if (config("daisyui.themes") == false) {
|
|
152
|
+
themeOrder.push("light");
|
|
112
153
|
}
|
|
113
154
|
|
|
114
155
|
// inject themes in order
|
|
115
156
|
themeOrder.forEach((themeName, index) => {
|
|
116
|
-
if (index === 0) {
|
|
117
|
-
|
|
157
|
+
if (index === 0) {
|
|
158
|
+
// first theme as root
|
|
159
|
+
addBase({
|
|
160
|
+
[":root"]: includedThemesObj["[data-theme=" + themeName + "]"],
|
|
161
|
+
});
|
|
118
162
|
} else if (index === 1) {
|
|
119
163
|
// auto dark
|
|
120
|
-
if (config(
|
|
121
|
-
if (
|
|
122
|
-
|
|
164
|
+
if (config("daisyui.darkTheme")) {
|
|
165
|
+
if (
|
|
166
|
+
themeOrder[0] != config("daisyui.darkTheme") &&
|
|
167
|
+
themeOrder.includes(config("daisyui.darkTheme"))
|
|
168
|
+
) {
|
|
169
|
+
addBase({
|
|
170
|
+
["@media (prefers-color-scheme: dark)"]: {
|
|
171
|
+
[":root"]:
|
|
172
|
+
includedThemesObj[
|
|
173
|
+
`[data-theme=${config("daisyui.darkTheme")}]`
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
});
|
|
123
177
|
}
|
|
124
178
|
} else {
|
|
125
|
-
if (themeOrder[0] !=
|
|
126
|
-
addBase({
|
|
179
|
+
if (themeOrder[0] != "dark" && themeOrder.includes("dark")) {
|
|
180
|
+
addBase({
|
|
181
|
+
["@media (prefers-color-scheme: dark)"]: {
|
|
182
|
+
[":root"]: includedThemesObj["[data-theme=dark]"],
|
|
183
|
+
},
|
|
184
|
+
});
|
|
127
185
|
}
|
|
128
186
|
}
|
|
129
187
|
// theme 0 with name
|
|
130
|
-
addBase({
|
|
188
|
+
addBase({
|
|
189
|
+
["[data-theme=" + themeOrder[0] + "]"]:
|
|
190
|
+
includedThemesObj["[data-theme=" + themeOrder[0] + "]"],
|
|
191
|
+
});
|
|
131
192
|
// theme 1 with name
|
|
132
|
-
addBase({
|
|
193
|
+
addBase({
|
|
194
|
+
["[data-theme=" + themeOrder[1] + "]"]:
|
|
195
|
+
includedThemesObj["[data-theme=" + themeOrder[1] + "]"],
|
|
196
|
+
});
|
|
133
197
|
} else {
|
|
134
|
-
addBase({
|
|
198
|
+
addBase({
|
|
199
|
+
["[data-theme=" + themeName + "]"]:
|
|
200
|
+
includedThemesObj["[data-theme=" + themeName + "]"],
|
|
201
|
+
});
|
|
135
202
|
}
|
|
136
|
-
})
|
|
137
|
-
diasyuiIncludedItems.push(
|
|
138
|
-
|
|
203
|
+
});
|
|
204
|
+
diasyuiIncludedItems.push("themes[" + themeOrder.length + "]");
|
|
139
205
|
|
|
140
206
|
// inject @utilities style needed by components
|
|
141
|
-
if (config(
|
|
142
|
-
addComponents(utilities, { variants: [
|
|
143
|
-
addComponents(utilitiesUnstyled, { variants: [
|
|
144
|
-
addComponents(utilitiesStyled, { variants: [
|
|
145
|
-
diasyuiIncludedItems.push(
|
|
207
|
+
if (config("daisyui.utils") != false) {
|
|
208
|
+
addComponents(utilities, { variants: ["responsive"] });
|
|
209
|
+
addComponents(utilitiesUnstyled, { variants: ["responsive"] });
|
|
210
|
+
addComponents(utilitiesStyled, { variants: ["responsive"] });
|
|
211
|
+
diasyuiIncludedItems.push("utilities");
|
|
146
212
|
}
|
|
147
213
|
if (logs) {
|
|
148
|
-
console.log(
|
|
149
|
-
|
|
150
|
-
|
|
214
|
+
console.log(
|
|
215
|
+
"\x1b[32m%s\x1b[0m",
|
|
216
|
+
"✔︎ Including:",
|
|
217
|
+
"\x1b[0m",
|
|
218
|
+
"" + diasyuiIncludedItems.join(", ")
|
|
219
|
+
);
|
|
220
|
+
console.log();
|
|
221
|
+
console.groupEnd();
|
|
151
222
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
module.exports = require("tailwindcss/plugin")(
|
|
156
|
-
mainFunction, { theme: { extend: { colors } } }
|
|
157
|
-
);
|
|
158
|
-
|
|
223
|
+
};
|
|
159
224
|
|
|
225
|
+
module.exports = require("tailwindcss/plugin")(mainFunction, {
|
|
226
|
+
theme: { extend: { colors } },
|
|
227
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daisyui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "daisyUI - Tailwind CSS Components",
|
|
5
5
|
"author": "Pouya Saadeghi",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"index.js",
|
|
36
36
|
"colors"
|
|
37
37
|
],
|
|
38
|
+
"browserslist": [
|
|
39
|
+
"> 7%"
|
|
40
|
+
],
|
|
38
41
|
"publishConfig": {
|
|
39
42
|
"access": "public",
|
|
40
43
|
"branches": [
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"primary" : "--p",
|
|
3
|
-
"primary-focus" : "--pf",
|
|
4
|
-
"primary-content" : "--pc",
|
|
5
|
-
|
|
6
|
-
"secondary" : "--s",
|
|
7
|
-
"secondary-focus" : "--sf",
|
|
8
|
-
"secondary-content" : "--sc",
|
|
9
|
-
|
|
10
|
-
"accent" : "--a",
|
|
11
|
-
"accent-focus" : "--af",
|
|
12
|
-
"accent-content" : "--ac",
|
|
13
|
-
|
|
14
|
-
"neutral" : "--n",
|
|
15
|
-
"neutral-focus" : "--nf",
|
|
16
|
-
"neutral-content" : "--nc",
|
|
17
|
-
|
|
18
|
-
"base-100" : "--b1",
|
|
19
|
-
"base-200" : "--b2",
|
|
20
|
-
"base-300" : "--b3",
|
|
21
|
-
"base-content" : "--bc",
|
|
22
|
-
|
|
23
|
-
"info" : "--in",
|
|
24
|
-
"info-content" : "--inc",
|
|
25
|
-
|
|
26
|
-
"success" : "--su",
|
|
27
|
-
"success-content" : "--suc",
|
|
28
|
-
|
|
29
|
-
"warning" : "--wa",
|
|
30
|
-
"warning-content" : "--wac",
|
|
31
|
-
|
|
32
|
-
"error" : "--er",
|
|
33
|
-
"error-content" : "--erc",
|
|
34
|
-
|
|
35
|
-
}
|
package/colors/colors/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function withOpacityValue(variable, fallbackColor) {
|
|
3
|
-
return ({ opacityValue }) => {
|
|
4
|
-
let fallbackColorValue = ''
|
|
5
|
-
if (fallbackColor) {
|
|
6
|
-
fallbackColorValue = `, var(${fallbackColor})`
|
|
7
|
-
}
|
|
8
|
-
if (opacityValue === undefined) {
|
|
9
|
-
return `hsl(var(${variable}${fallbackColorValue}))`
|
|
10
|
-
}
|
|
11
|
-
return `hsl(var(${variable}${fallbackColorValue}) / ${opacityValue})`
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let colorObject = {
|
|
16
|
-
"transparent": "transparent",
|
|
17
|
-
"current": "currentColor",
|
|
18
|
-
|
|
19
|
-
"primary": withOpacityValue("--p"),
|
|
20
|
-
"primary-focus": withOpacityValue("--pf", "--p"),
|
|
21
|
-
"primary-content": withOpacityValue("--pc"),
|
|
22
|
-
|
|
23
|
-
"secondary": withOpacityValue("--s"),
|
|
24
|
-
"secondary-focus": withOpacityValue("--sf", "--s"),
|
|
25
|
-
"secondary-content": withOpacityValue("--sc"),
|
|
26
|
-
|
|
27
|
-
"accent": withOpacityValue("--a"),
|
|
28
|
-
"accent-focus": withOpacityValue("--af", "--a"),
|
|
29
|
-
"accent-content": withOpacityValue("--ac"),
|
|
30
|
-
|
|
31
|
-
"neutral": withOpacityValue("--n"),
|
|
32
|
-
"neutral-focus": withOpacityValue("--nf", "--n"),
|
|
33
|
-
"neutral-content": withOpacityValue("--nc"),
|
|
34
|
-
|
|
35
|
-
"base-100": withOpacityValue("--b1"),
|
|
36
|
-
"base-200": withOpacityValue("--b2", "--b1"),
|
|
37
|
-
"base-300": withOpacityValue("--b3", "--b2"),
|
|
38
|
-
"base-content": withOpacityValue("--bc"),
|
|
39
|
-
|
|
40
|
-
"info": withOpacityValue("--in"),
|
|
41
|
-
"info-content": withOpacityValue("--inc", "--nc"),
|
|
42
|
-
|
|
43
|
-
"success": withOpacityValue("--su"),
|
|
44
|
-
"success-content": withOpacityValue("--suc", "--nc"),
|
|
45
|
-
|
|
46
|
-
"warning": withOpacityValue("--wa"),
|
|
47
|
-
"warning-content": withOpacityValue("--wac", "--nc"),
|
|
48
|
-
|
|
49
|
-
"error": withOpacityValue("--er"),
|
|
50
|
-
"error-content": withOpacityValue("--erc", "--nc"),
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
module.exports = colorObject
|