daisyui 4.0.0-alpha.20 → 4.0.0-alpha.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daisyui",
3
- "version": "4.0.0-alpha.20",
3
+ "version": "4.0.0-alpha.21",
4
4
  "description": "daisyUI - Tailwind CSS Components",
5
5
  "author": "Pouya Saadeghi",
6
6
  "license": "MIT",
@@ -142,6 +142,7 @@ module.exports = {
142
142
  injectThemes: function (addBase, config, themes) {
143
143
  const includedThemesObj = {}
144
144
  // add default themes
145
+ const themeRoot = config("daisyui.themeRoot") ?? ":root"
145
146
  Object.entries(themes).forEach(([theme, value]) => {
146
147
  includedThemesObj[theme] = this.convertColorFormat(value)
147
148
  })
@@ -179,7 +180,7 @@ module.exports = {
179
180
  themeOrder.forEach((themeName, index) => {
180
181
  if (index === 0) {
181
182
  // first theme as root
182
- themesToInject[":root"] = includedThemesObj[themeName]
183
+ themesToInject[themeRoot] = includedThemesObj[themeName]
183
184
  } else if (index === 1) {
184
185
  // auto dark
185
186
  if (config("daisyui.darkTheme")) {
@@ -188,7 +189,7 @@ module.exports = {
188
189
  themeOrder.includes(config("daisyui.darkTheme"))
189
190
  ) {
190
191
  themesToInject["@media (prefers-color-scheme: dark)"] = {
191
- [":root"]: includedThemesObj[`${config("daisyui.darkTheme")}`],
192
+ [themeRoot]: includedThemesObj[`${config("daisyui.darkTheme")}`],
192
193
  }
193
194
  }
194
195
  } else if (config("daisyui.darkTheme") === false) {
@@ -196,7 +197,7 @@ module.exports = {
196
197
  } else {
197
198
  if (themeOrder[0] !== "dark" && themeOrder.includes("dark")) {
198
199
  themesToInject["@media (prefers-color-scheme: dark)"] = {
199
- [":root"]: includedThemesObj["dark"],
200
+ [themeRoot]: includedThemesObj["dark"],
200
201
  }
201
202
  }
202
203
  }
@@ -204,7 +205,9 @@ module.exports = {
204
205
  themesToInject[
205
206
  "[data-theme=" +
206
207
  themeOrder[0] +
207
- "], :root:has(input.theme-controller[value=" +
208
+ "], " +
209
+ themeRoot +
210
+ ":has(input.theme-controller[value=" +
208
211
  themeOrder[0] +
209
212
  "]:checked)"
210
213
  ] = includedThemesObj[themeOrder[0]]
@@ -212,7 +215,9 @@ module.exports = {
212
215
  themesToInject[
213
216
  "[data-theme=" +
214
217
  themeOrder[1] +
215
- "], :root:has(input.theme-controller[value=" +
218
+ "], " +
219
+ themeRoot +
220
+ ":has(input.theme-controller[value=" +
216
221
  themeOrder[1] +
217
222
  "]:checked)"
218
223
  ] = includedThemesObj[themeOrder[1]]
@@ -220,7 +225,9 @@ module.exports = {
220
225
  themesToInject[
221
226
  "[data-theme=" +
222
227
  themeName +
223
- "], :root:has(input.theme-controller[value=" +
228
+ "], " +
229
+ themeRoot +
230
+ ":has(input.theme-controller[value=" +
224
231
  themeName +
225
232
  "]:checked)"
226
233
  ] = includedThemesObj[themeName]