daisyui 2.0.0-next.2 → 2.0.3
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/dist/full.css +1 -111
- package/dist/styled.css +1 -2059
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/dist/themes.css +1 -2
- package/dist/unstyled.css +1 -511
- 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/package.json +7 -9
- package/src/colors/colorNames.js +34 -0
- package/{colors → src}/colors/index.js +17 -18
- package/{colors → src/colors}/themes.js +274 -273
- package/{colors → src}/colors/windi.js +6 -6
- package/src/index.js +227 -0
- package/colors/colorNames.js +0 -35
- package/colors/colors/colorNames.js +0 -35
- package/colors/colors/themes.js +0 -881
- package/colors/index.js +0 -53
- package/colors/windi.js +0 -12
- package/index.js +0 -159
package/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
|
package/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
|
package/index.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
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
|
-
|
|
15
|
-
const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
16
|
-
let diasyuiIncludedItems = []
|
|
17
|
-
let logs = false
|
|
18
|
-
if (config('daisyui.logs') != false) {
|
|
19
|
-
logs = true
|
|
20
|
-
}
|
|
21
|
-
if (logs) {
|
|
22
|
-
console.log()
|
|
23
|
-
console.log('\x1b[35m%s\x1b[0m', '🌼 daisyUI components ' + daisyuiInfo.version, '\x1b[0m', daisyuiInfo.homepage)
|
|
24
|
-
console.group()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// inject @base style
|
|
28
|
-
if (config('daisyui.base') != false) {
|
|
29
|
-
addBase(base)
|
|
30
|
-
diasyuiIncludedItems.push('base')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// inject components
|
|
34
|
-
// because rollupjs doesn't supprt dynamic require
|
|
35
|
-
let file = styled
|
|
36
|
-
if (config('daisyui.styled') == false && config('daisyui.rtl') != true) {
|
|
37
|
-
diasyuiIncludedItems.push('unstyled components')
|
|
38
|
-
file = unstyled
|
|
39
|
-
} else if (config('daisyui.styled') == false && config('daisyui.rtl') == true) {
|
|
40
|
-
diasyuiIncludedItems.push('unstyled components')
|
|
41
|
-
console.log('\x1b[36m%s\x1b[0m', ' Direction:', '\x1b[0m', 'RTL');
|
|
42
|
-
file = unstyledRtl
|
|
43
|
-
} else if (config('daisyui.styled') != false && config('daisyui.rtl') != true) {
|
|
44
|
-
diasyuiIncludedItems.push('components')
|
|
45
|
-
file = styled
|
|
46
|
-
} else if (config('daisyui.styled') !== false && config('daisyui.rtl') == true) {
|
|
47
|
-
diasyuiIncludedItems.push('components')
|
|
48
|
-
console.log('\x1b[36m%s\x1b[0m', ' Direction:', '\x1b[0m', 'RTL');
|
|
49
|
-
file = styledRtl
|
|
50
|
-
}
|
|
51
|
-
addComponents(file)
|
|
52
|
-
|
|
53
|
-
let includedThemesObj = new Object()
|
|
54
|
-
|
|
55
|
-
function convertThemeColorsToHsl(input) {
|
|
56
|
-
let resultObj = {}
|
|
57
|
-
if (typeof input === 'object' && input !== null) {
|
|
58
|
-
Object.entries(input).forEach(([rule, value]) => {
|
|
59
|
-
if (colorNames.hasOwnProperty(rule)) {
|
|
60
|
-
const hslArray = Color(value).hsl().round().array()
|
|
61
|
-
resultObj[colorNames[rule]] = hslArray[0] + " " + hslArray[1] + "%" + " " + hslArray[2] + "%"
|
|
62
|
-
} else {
|
|
63
|
-
resultObj[rule] = value
|
|
64
|
-
// console.log(input)
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
return resultObj
|
|
68
|
-
}
|
|
69
|
-
return input
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// add light themes
|
|
73
|
-
if (config('daisyui.themes') == false) {
|
|
74
|
-
Object.entries(themes).forEach(([theme, index]) => {
|
|
75
|
-
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme])
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// add default themes
|
|
80
|
-
if (config('daisyui.themes') != false) {
|
|
81
|
-
Object.entries(themes).forEach(([theme, index]) => {
|
|
82
|
-
includedThemesObj[theme] = convertThemeColorsToHsl(themes[theme])
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// add custom themes
|
|
87
|
-
if (Array.isArray(config('daisyui.themes'))) {
|
|
88
|
-
config('daisyui.themes').forEach((item, index) => {
|
|
89
|
-
if (typeof item === 'object' && item !== null) {
|
|
90
|
-
Object.entries(item).forEach(([customThemeName, customThemevalue]) => {
|
|
91
|
-
includedThemesObj['[data-theme=' + customThemeName + ']'] = convertThemeColorsToHsl(customThemevalue)
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
let themeOrder = []
|
|
98
|
-
if (Array.isArray(config('daisyui.themes'))) {
|
|
99
|
-
config('daisyui.themes').forEach((theme, index) => {
|
|
100
|
-
if (typeof theme === 'object' && theme !== null) {
|
|
101
|
-
Object.entries(theme).forEach(([customThemeName, customThemevalue]) => {
|
|
102
|
-
themeOrder.push(customThemeName)
|
|
103
|
-
})
|
|
104
|
-
} else if (includedThemesObj.hasOwnProperty('[data-theme=' + theme + ']')) {
|
|
105
|
-
themeOrder.push(theme)
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
} else if (config('daisyui.themes') != false) {
|
|
109
|
-
themeOrder = ['light', 'dark', 'cupcake', 'bumblebee', 'emerald', 'corporate', 'synthwave', 'retro', 'cyberpunk', 'valentine', 'halloween', 'garden', 'forest', 'aqua', 'lofi', 'pastel', 'fantasy', 'wireframe', 'black', 'luxury', 'dracula', 'cmyk',]
|
|
110
|
-
} else if (config('daisyui.themes') == false) {
|
|
111
|
-
themeOrder.push('light')
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// inject themes in order
|
|
115
|
-
themeOrder.forEach((themeName, index) => {
|
|
116
|
-
if (index === 0) { // first theme as root
|
|
117
|
-
addBase({ [':root']: includedThemesObj['[data-theme=' + themeName + ']'] })
|
|
118
|
-
} else if (index === 1) {
|
|
119
|
-
// auto dark
|
|
120
|
-
if (config('daisyui.darkTheme')) {
|
|
121
|
-
if (themeOrder[0] != config('daisyui.darkTheme') && themeOrder.includes(config('daisyui.darkTheme'))) {
|
|
122
|
-
addBase({ ['@media (prefers-color-scheme: dark)']: { [':root']: includedThemesObj[`[data-theme=${config('daisyui.darkTheme')}]`] } })
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
if (themeOrder[0] != 'dark' && themeOrder.includes('dark')) {
|
|
126
|
-
addBase({ ['@media (prefers-color-scheme: dark)']: { [':root']: includedThemesObj['[data-theme=dark]'] } })
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// theme 0 with name
|
|
130
|
-
addBase({ ['[data-theme=' + themeOrder[0] + ']']: includedThemesObj['[data-theme=' + themeOrder[0] + ']'] })
|
|
131
|
-
// theme 1 with name
|
|
132
|
-
addBase({ ['[data-theme=' + themeOrder[1] + ']']: includedThemesObj['[data-theme=' + themeOrder[1] + ']'] })
|
|
133
|
-
} else {
|
|
134
|
-
addBase({ ['[data-theme=' + themeName + ']']: includedThemesObj['[data-theme=' + themeName + ']'] })
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
diasyuiIncludedItems.push('themes[' + themeOrder.length + ']')
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// inject @utilities style needed by components
|
|
141
|
-
if (config('daisyui.utils') != false) {
|
|
142
|
-
addComponents(utilities, { variants: ['responsive'] })
|
|
143
|
-
addComponents(utilitiesUnstyled, { variants: ['responsive'] })
|
|
144
|
-
addComponents(utilitiesStyled, { variants: ['responsive'] })
|
|
145
|
-
diasyuiIncludedItems.push('utilities')
|
|
146
|
-
}
|
|
147
|
-
if (logs) {
|
|
148
|
-
console.log('\x1b[32m%s\x1b[0m', '✔︎ Including:', '\x1b[0m', '' + diasyuiIncludedItems.join(', '));
|
|
149
|
-
console.log()
|
|
150
|
-
console.groupEnd()
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
module.exports = require("tailwindcss/plugin")(
|
|
156
|
-
mainFunction, { theme: { extend: { colors } } }
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
|