daisyui 2.0.9 → 2.2.1
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 +4 -12
- package/dist/full.css +1 -1
- package/dist/styled.css +1 -1
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/dist/themes.css +1 -1
- package/dist/unstyled.css +1 -1
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.rtl.js +1 -1
- package/dist/utilities-unstyled.js +1 -1
- package/dist/utilities.js +1 -1
- package/package.json +1 -2
- package/src/colors/functions.js +307 -0
- package/src/colors/themes.js +89 -615
- package/src/index.js +4 -139
- package/src/colors/windi.js +0 -12
package/src/index.js
CHANGED
|
@@ -9,8 +9,7 @@ const styledRtl = require("../dist/styled.rtl");
|
|
|
9
9
|
const utilitiesUnstyled = require("../dist/utilities-unstyled");
|
|
10
10
|
const utilitiesStyled = require("../dist/utilities-styled");
|
|
11
11
|
const themes = require("./colors/themes");
|
|
12
|
-
const
|
|
13
|
-
const Color = require("color");
|
|
12
|
+
const colorFunctions = require("./colors/functions");
|
|
14
13
|
|
|
15
14
|
const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
16
15
|
let diasyuiIncludedItems = [];
|
|
@@ -64,144 +63,10 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
|
64
63
|
}
|
|
65
64
|
addComponents(file);
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
const themeInjector = colorFunctions.injectThemes(addBase, config, themes)
|
|
67
|
+
themeInjector;
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
let resultObj = {};
|
|
71
|
-
if (typeof input === "object" && input !== null) {
|
|
72
|
-
Object.entries(input).forEach(([rule, value]) => {
|
|
73
|
-
if (colorNames.hasOwnProperty(rule)) {
|
|
74
|
-
const hslArray = Color(value).hsl().round().array();
|
|
75
|
-
resultObj[colorNames[rule]] =
|
|
76
|
-
hslArray[0] + " " + hslArray[1] + "%" + " " + hslArray[2] + "%";
|
|
77
|
-
} else {
|
|
78
|
-
resultObj[rule] = value;
|
|
79
|
-
// console.log(input)
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return resultObj;
|
|
83
|
-
}
|
|
84
|
-
return input;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// add light themes
|
|
88
|
-
if (config("daisyui.themes") == false) {
|
|
89
|
-
Object.entries(themes).forEach(([theme, index]) => {
|
|
90
|
-
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme]);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// add default themes
|
|
95
|
-
if (config("daisyui.themes") != false) {
|
|
96
|
-
Object.entries(themes).forEach(([theme, index]) => {
|
|
97
|
-
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme]);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// add custom themes
|
|
102
|
-
if (Array.isArray(config("daisyui.themes"))) {
|
|
103
|
-
config("daisyui.themes").forEach((item, index) => {
|
|
104
|
-
if (typeof item === "object" && item !== null) {
|
|
105
|
-
Object.entries(item).forEach(([customThemeName, customThemevalue]) => {
|
|
106
|
-
includedThemesObj["[data-theme=" + customThemeName + "]"] =
|
|
107
|
-
convertThemeColorsToHsl(customThemevalue);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let themeOrder = [];
|
|
114
|
-
if (Array.isArray(config("daisyui.themes"))) {
|
|
115
|
-
config("daisyui.themes").forEach((theme, index) => {
|
|
116
|
-
if (typeof theme === "object" && theme !== null) {
|
|
117
|
-
Object.entries(theme).forEach(([customThemeName, customThemevalue]) => {
|
|
118
|
-
themeOrder.push(customThemeName);
|
|
119
|
-
});
|
|
120
|
-
} else if (
|
|
121
|
-
includedThemesObj.hasOwnProperty("[data-theme=" + theme + "]")
|
|
122
|
-
) {
|
|
123
|
-
themeOrder.push(theme);
|
|
124
|
-
}
|
|
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");
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// inject themes in order
|
|
156
|
-
themeOrder.forEach((themeName, index) => {
|
|
157
|
-
if (index === 0) {
|
|
158
|
-
// first theme as root
|
|
159
|
-
addBase({
|
|
160
|
-
[":root"]: includedThemesObj["[data-theme=" + themeName + "]"],
|
|
161
|
-
});
|
|
162
|
-
} else if (index === 1) {
|
|
163
|
-
// auto dark
|
|
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
|
-
});
|
|
177
|
-
}
|
|
178
|
-
} else {
|
|
179
|
-
if (themeOrder[0] != "dark" && themeOrder.includes("dark")) {
|
|
180
|
-
addBase({
|
|
181
|
-
["@media (prefers-color-scheme: dark)"]: {
|
|
182
|
-
[":root"]: includedThemesObj["[data-theme=dark]"],
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// theme 0 with name
|
|
188
|
-
addBase({
|
|
189
|
-
["[data-theme=" + themeOrder[0] + "]"]:
|
|
190
|
-
includedThemesObj["[data-theme=" + themeOrder[0] + "]"],
|
|
191
|
-
});
|
|
192
|
-
// theme 1 with name
|
|
193
|
-
addBase({
|
|
194
|
-
["[data-theme=" + themeOrder[1] + "]"]:
|
|
195
|
-
includedThemesObj["[data-theme=" + themeOrder[1] + "]"],
|
|
196
|
-
});
|
|
197
|
-
} else {
|
|
198
|
-
addBase({
|
|
199
|
-
["[data-theme=" + themeName + "]"]:
|
|
200
|
-
includedThemesObj["[data-theme=" + themeName + "]"],
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
diasyuiIncludedItems.push("themes[" + themeOrder.length + "]");
|
|
69
|
+
diasyuiIncludedItems.push("themes[" + themeInjector.themeOrder.length + "]");
|
|
205
70
|
|
|
206
71
|
// inject @utilities style needed by components
|
|
207
72
|
if (config("daisyui.utils") != false) {
|
package/src/colors/windi.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const colorValues = require("./colorNames");
|
|
2
|
-
|
|
3
|
-
let colorObject = {
|
|
4
|
-
transparent: "transparent",
|
|
5
|
-
current: "currentColor",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
for (const [key, item] of Object.entries(colorValues)) {
|
|
9
|
-
colorObject[key] = `hsla(var(${item}) / var(--tw-bg-opacity, 1))`;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = colorObject;
|