daisyui 2.6.4 → 2.9.0
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 +2 -1
- package/dist/full.css +1 -1
- package/dist/styled.css +12 -18
- package/dist/styled.js +1 -1
- package/dist/styled.rtl.js +1 -1
- package/package.json +1 -1
- package/src/index.js +18 -21
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const postcssJs = require("postcss-js")
|
|
2
|
+
const postcssPrefix = require('./lib/postcss-prefixer')
|
|
3
|
+
|
|
1
4
|
const daisyuiInfo = require("../package.json");
|
|
2
5
|
const colors = require("./colors/index");
|
|
3
6
|
const utilities = require("../dist/utilities");
|
|
@@ -6,12 +9,12 @@ const unstyled = require("../dist/unstyled");
|
|
|
6
9
|
const unstyledRtl = require("../dist/unstyled.rtl");
|
|
7
10
|
const styled = require("../dist/styled");
|
|
8
11
|
const styledRtl = require("../dist/styled.rtl");
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const utilitiesUnstyled = require("../dist/utilities-unstyled");
|
|
13
|
+
const utilitiesStyled = require("../dist/utilities-styled");
|
|
11
14
|
const themes = require("./colors/themes");
|
|
12
15
|
const colorFunctions = require("./colors/functions");
|
|
13
16
|
|
|
14
|
-
const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
17
|
+
const mainFunction = ({ addBase, addComponents, addUtilities, config, postcss }) => {
|
|
15
18
|
let diasyuiIncludedItems = [];
|
|
16
19
|
let logs = false;
|
|
17
20
|
if (config("daisyui.logs") != false) {
|
|
@@ -64,21 +67,17 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
|
64
67
|
|
|
65
68
|
// add prefix to class names if specified
|
|
66
69
|
const prefix = config("daisyui.prefix")
|
|
67
|
-
let
|
|
70
|
+
let postcssJsProcess
|
|
68
71
|
if (prefix) {
|
|
69
72
|
try {
|
|
70
|
-
|
|
71
|
-
postcssPrefix = require('./lib/postcss-prefixer')
|
|
73
|
+
postcssJsProcess = postcssJs.sync(postcssPrefix({ prefix, ignore: [] }))
|
|
72
74
|
} catch (error) {
|
|
73
75
|
logs && console.error(`Error occurred and prevent applying the "prefix" option:`, error)
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
const shouldApplyPrefix = prefix &&
|
|
78
|
+
const shouldApplyPrefix = prefix && postcssJsProcess;
|
|
77
79
|
if (shouldApplyPrefix) {
|
|
78
|
-
file =
|
|
79
|
-
prefix: prefix,
|
|
80
|
-
ignore: []
|
|
81
|
-
}))(file)
|
|
80
|
+
file = postcssJsProcess(file)
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
addComponents(file);
|
|
@@ -91,20 +90,18 @@ const mainFunction = ({ addBase, addComponents, addUtilities, config }) => {
|
|
|
91
90
|
// inject @utilities style needed by components
|
|
92
91
|
if (config("daisyui.utils") != false) {
|
|
93
92
|
addComponents(utilities, { variants: ["responsive"] });
|
|
93
|
+
|
|
94
|
+
let toAdd = utilitiesUnstyled // shadow clone here to avoid mutate the original
|
|
94
95
|
if (shouldApplyPrefix) {
|
|
95
|
-
|
|
96
|
-
prefix: prefix,
|
|
97
|
-
ignore: []
|
|
98
|
-
}))(utilitiesUnstyled)
|
|
96
|
+
toAdd = postcssJsProcess(toAdd);
|
|
99
97
|
}
|
|
100
|
-
addComponents(
|
|
98
|
+
addComponents(toAdd, { variants: ["responsive"] });
|
|
99
|
+
|
|
100
|
+
toAdd = utilitiesStyled
|
|
101
101
|
if (shouldApplyPrefix) {
|
|
102
|
-
|
|
103
|
-
prefix: prefix,
|
|
104
|
-
ignore: []
|
|
105
|
-
}))(utilitiesStyled)
|
|
102
|
+
toAdd = postcssJsProcess(toAdd);
|
|
106
103
|
}
|
|
107
|
-
addComponents(
|
|
104
|
+
addComponents(toAdd, { variants: ["responsive"] });
|
|
108
105
|
diasyuiIncludedItems.push("utilities");
|
|
109
106
|
}
|
|
110
107
|
if (logs) {
|