daisyui 2.8.0 → 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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/package.json +1 -1
  3. package/src/index.js +18 -21
package/README.md CHANGED
@@ -74,7 +74,7 @@ module.exports = {
74
74
  Loading CSS files from CDN is not recommended for production. It's better to install Tailwind and daisyUI as Nodejs dependencies so you can config/customize everything, and purge unused styles.
75
75
 
76
76
  ```html
77
- <link href="https://cdn.jsdelivr.net/npm/daisyui@2.7.0/dist/full.css" rel="stylesheet" type="text/css" />
77
+ <link href="https://cdn.jsdelivr.net/npm/daisyui@2.8.0/dist/full.css" rel="stylesheet" type="text/css" />
78
78
  <script src="https://cdn.tailwindcss.com"></script>
79
79
  ```
80
80
 
@@ -222,6 +222,7 @@ Read the documents for more info:
222
222
  - [speckyboy](https://speckyboy.com/weekly-news-for-designers-594/)
223
223
  - [dailydev](https://app.daily.dev/posts/-4OPGw0te)
224
224
  - [Future Tech Blog (Japanese)](https://future-architect.github.io/articles/20211124a/)
225
+ - [Adding Tailwind and Daisy UI to SvelteKit](https://dev.to/brewhousedigital/adding-tailwind-and-daisy-ui-to-sveltekit-2hk5)
225
226
  - Youtube videos
226
227
  - [Supabase & Sveltekit - Build Twitter in 75 minutes](https://www.youtube.com/watch?v=mPQyckogDYc)
227
228
  - [Setup the Best Frontend JavaScript Stack - Svelte, Vite, TailwindCSS and DaisyUI](https://www.youtube.com/watch?v=mEBPN_9jTAE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daisyui",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "daisyUI - Tailwind CSS Components",
5
5
  "author": "Pouya Saadeghi",
6
6
  "license": "MIT",
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
- let utilitiesUnstyled = require("../dist/utilities-unstyled");
10
- let utilitiesStyled = require("../dist/utilities-styled");
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 postcssJs, postcssPrefix
70
+ let postcssJsProcess
68
71
  if (prefix) {
69
72
  try {
70
- postcssJs = require("postcss-js")
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 && postcssPrefix && postcssJs
78
+ const shouldApplyPrefix = prefix && postcssJsProcess;
77
79
  if (shouldApplyPrefix) {
78
- file = postcssJs.sync(postcssPrefix({
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
- utilitiesUnstyled = postcssJs.sync(postcssPrefix({
96
- prefix: prefix,
97
- ignore: []
98
- }))(utilitiesUnstyled)
96
+ toAdd = postcssJsProcess(toAdd);
99
97
  }
100
- addComponents(utilitiesUnstyled, { variants: ["responsive"] });
98
+ addComponents(toAdd, { variants: ["responsive"] });
99
+
100
+ toAdd = utilitiesStyled
101
101
  if (shouldApplyPrefix) {
102
- utilitiesStyled = postcssJs.sync(postcssPrefix({
103
- prefix: prefix,
104
- ignore: []
105
- }))(utilitiesStyled)
102
+ toAdd = postcssJsProcess(toAdd);
106
103
  }
107
- addComponents(utilitiesStyled, { variants: ["responsive"] });
104
+ addComponents(toAdd, { variants: ["responsive"] });
108
105
  diasyuiIncludedItems.push("utilities");
109
106
  }
110
107
  if (logs) {