Comparing version 5.0.0-alpha.17 to 5.0.0-alpha.18
39
index.js
@@ -43,3 +43,3 @@ import { plugin } from './functions/plugin.js'; | ||
const allThemes = {"cupcake":{"colorScheme":"light","--color-base-100":"oklch(97.7882% 0.00418 56.375637)","--color-base-200":"oklch(93.9822% 0.007638 61.449292)","--color-base-300":"oklch(91.5861% 0.006811 53.440502)","--color-base-content":"oklch(23.5742% 0.066235 313.189598)","--color-primary":"oklch(76.172% 0.089459 200.026556)","--color-primary-content":"oklch(15.2344% 0.017892 200.026556)","--color-secondary":"oklch(78.9351% 0.101246 356.29965)","--color-secondary-content":"oklch(15.787% 0.020249 356.29965)","--color-accent":"oklch(79.3811% 0.146032 78.618794)","--color-accent-content":"oklch(15.8762% 0.029206 78.618794)","--color-neutral":"oklch(23.5742% 0.066235 313.189598)","--color-neutral-content":"oklch(84.7148% 0.013247 313.189598)","--color-info":"oklch(72.06% 0.191 231.6)","--color-info-content":"oklch(0% 0 0)","--color-success":"oklch(64.8% 0.15 160)","--color-success-content":"oklch(0% 0 0)","--color-warning":"oklch(84.71% 0.199 83.87)","--color-warning-content":"oklch(0% 0 0)","--color-error":"oklch(71.76% 0.221 22.18)","--color-error-content":"oklch(0% 0 0)","--radius-badge":"1.9rem","--radius-btn":"1.9rem","--radius-box":"1rem","--spacing-button-border":"1px","--spacing-tab-border":"2px"},"light":{"colorScheme":"light","--color-base-100":"oklch(100% 0 0)","--color-base-200":"oklch(96.1151% 0 0)","--color-base-300":"oklch(92.4169% 0.00108 197.137559)","--color-base-content":"oklch(27.8078% 0.029596 256.84795)","--color-primary":"oklch(49.12% 0.3096 275.75)","--color-primary-content":"oklch(89.824% 0.06192 275.75)","--color-secondary":"oklch(69.71% 0.329 342.55)","--color-secondary-content":"oklch(98.71% 0.0106 342.55)","--color-accent":"oklch(76.76% 0.184 183.61)","--color-accent-content":"oklch(15.352% 0.0368 183.61)","--color-neutral":"oklch(20% 0.02476 255.701624)","--color-neutral-content":"oklch(89.4994% 0.011585 252.096176)","--color-info":"oklch(72.06% 0.191 231.6)","--color-info-content":"oklch(0% 0 0)","--color-success":"oklch(64.8% 0.15 160)","--color-success-content":"oklch(0% 0 0)","--color-warning":"oklch(84.71% 0.199 83.87)","--color-warning-content":"oklch(0% 0 0)","--color-error":"oklch(71.76% 0.221 22.18)","--color-error-content":"oklch(0% 0 0)","--radius-badge":"1.9rem","--radius-btn":"0.5rem","--radius-box":"1rem","--spacing-button-border":"1px","--spacing-tab-border":"1px"},"dark":{"colorScheme":"dark","--color-base-100":"oklch(25.33% 0.016 252.42)","--color-base-200":"oklch(23.26% 0.014 253.1)","--color-base-300":"oklch(21.15% 0.012 254.09)","--color-base-content":"oklch(97.8078% 0.029596 256.84795)","--color-primary":"oklch(49.12% 0.3096 275.75)","--color-primary-content":"oklch(89.824% 0.06192 275.75)","--color-secondary":"oklch(69.71% 0.329 342.55)","--color-secondary-content":"oklch(98.71% 0.0106 342.55)","--color-accent":"oklch(76.76% 0.184 183.61)","--color-accent-content":"oklch(15.352% 0.0368 183.61)","--color-neutral":"oklch(20% 0.016 252.42)","--color-neutral-content":"oklch(89.4994% 0.011585 252.096176)","--color-info":"oklch(72.06% 0.191 231.6)","--color-info-content":"oklch(0% 0 0)","--color-success":"oklch(64.8% 0.15 160)","--color-success-content":"oklch(0% 0 0)","--color-warning":"oklch(84.71% 0.199 83.87)","--color-warning-content":"oklch(0% 0 0)","--color-error":"oklch(71.76% 0.221 22.18)","--color-error-content":"oklch(0% 0 0)","--radius-badge":"1.9rem","--radius-btn":"0.5rem","--radius-box":"1rem","--spacing-button-border":"1px","--spacing-tab-border":"1px"}}; | ||
export default plugin.withOptions( | ||
@@ -52,26 +52,37 @@ (options = { | ||
return ({ addBase, addComponents, addUtilities }) => { | ||
const { logs, themes, themeRoot = ":root" } = options; | ||
const { | ||
logs=true, | ||
themes=['light --default', 'dark --prefersDark'], | ||
themeRoot = ":root" | ||
} = options; | ||
if (options.logs !== false) { | ||
console.log('/*! 🌼 daisyUI 5.0.0-alpha.17 */') | ||
console.log('/*! 🌼 daisyUI 5.0.0-alpha.18 */') | ||
} | ||
let themesContent = ''; | ||
options.themes.forEach(themeOption => { | ||
const [themeName, flag] = themeOption.split(' '); | ||
if (themes[themeName]) { | ||
let selector = ':root:has(input.theme-controller[value=' + themeName + ']:checked),[data-theme='+themeName+']'; | ||
let themeCSS = JSON.stringify(themes[themeName]); | ||
const applyTheme = (themeName, flag) => { | ||
if (allThemes[themeName]) { | ||
let selector = themeRoot+':has(input.theme-controller[value=' + themeName + ']:checked),[data-theme='+themeName+']'; | ||
let themeCSS = JSON.stringify(allThemes[themeName]); | ||
if (flag === '--default') { | ||
selector = ':root,' + selector; | ||
selector = themeRoot+',' + selector; | ||
} | ||
addBase({ [selector]: allThemes[themeName] }); | ||
themesContent += ' addBase({' + '"' + selector + '": ' + themeCSS + '});'; | ||
if (flag === '--prefersDark') { | ||
themesContent += ' addBase({"@media (prefers-color-scheme: dark)": {":root": ' + themeCSS + '}});'; | ||
addBase({"@media (prefers-color-scheme: dark)": {themeRoot: allThemes[themeName]}}); | ||
} | ||
} | ||
}); | ||
}; | ||
if (Array.isArray(themes)) { | ||
themes.forEach(themeOption => { | ||
const [themeName, flag] = themeOption.split(' '); | ||
applyTheme(themeName, flag); | ||
}); | ||
} else { | ||
const [themeName, flag] = themes.split(' '); | ||
applyTheme(themeName, flag); | ||
} | ||
rootcolor({ addBase }); | ||
@@ -78,0 +89,0 @@ properties({ addBase }); |
{ | ||
"type": "module", | ||
"name": "daisyui", | ||
"version": "5.0.0-alpha.17", | ||
"version": "5.0.0-alpha.18", | ||
"description": "daisyUI - Tailwind CSS Components", | ||
@@ -6,0 +6,0 @@ "author": "Pouya Saadeghi", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
773749
927