daisyui 3.9.3 → 4.0.0-alpha.2

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": "3.9.3",
3
+ "version": "4.0.0-alpha.2",
4
4
  "description": "daisyUI - Tailwind CSS Components",
5
5
  "author": "Pouya Saadeghi",
6
6
  "license": "MIT",
@@ -38,7 +38,6 @@
38
38
  "src/lib/**/*.js",
39
39
  "dist/*.js",
40
40
  "dist/{themes,styled,unstyled,full}.css",
41
- "!dist/*.rtl.css",
42
41
  "src/index.js",
43
42
  "src/theming/*.js",
44
43
  "src/theming/*.d.ts",
@@ -77,15 +76,14 @@
77
76
  "prejss-cli": "0.3.3",
78
77
  "prettier": "^3.0.3",
79
78
  "prettier-plugin-svelte": "^3.0.3",
80
- "prettier-plugin-tailwindcss": "^0.5.5",
81
- "rtlcss": "4.1.1",
82
- "standard-version": "^9.5.0"
79
+ "prettier-plugin-tailwindcss": "^0.5.6",
80
+ "standard-version": "^9.5.0",
81
+ "tailwindcss": "^3.3.3"
83
82
  },
84
83
  "dependencies": {
85
84
  "colord": "^2.9",
86
85
  "css-selector-tokenizer": "^0.8",
87
- "postcss": "^8",
88
- "postcss-js": "^4",
89
- "tailwindcss": "^3.1"
86
+ "picocolors": "^1",
87
+ "postcss-js": "^4"
90
88
  }
91
89
  }
package/src/index.js CHANGED
@@ -1,6 +1,9 @@
1
- const tailwindColors = require("tailwindcss/colors")
1
+ // const tailwindColors = require("tailwindcss/colors")
2
+ // const tailwindPlugin = require("tailwindcss/plugin")
3
+ const tailwindPlugin = require("./lib/createPlugin")
2
4
 
3
5
  const postcssJs = require("postcss-js")
6
+ const pc = require("picocolors")
4
7
  const postcssPrefix = require("./lib/addPrefix")
5
8
 
6
9
  const daisyuiInfo = require("../package.json")
@@ -8,9 +11,7 @@ const colors = require("./theming/index")
8
11
  const utilities = require("../dist/utilities")
9
12
  const base = require("../dist/base")
10
13
  const unstyled = require("../dist/unstyled")
11
- const unstyledRtl = require("../dist/unstyled.rtl")
12
14
  const styled = require("../dist/styled")
13
- const styledRtl = require("../dist/styled.rtl")
14
15
  const utilitiesUnstyled = require("../dist/utilities-unstyled")
15
16
  const utilitiesStyled = require("../dist/utilities-styled")
16
17
  const themes = require("./theming/themes")
@@ -23,7 +24,11 @@ const mainFunction = ({ addBase, addComponents, config }) => {
23
24
  }
24
25
  if (logs) {
25
26
  console.log()
26
- console.log("╭── 🌼\x1b[35m daisyUI " + daisyuiInfo.version, "\x1b[0m" + daisyuiInfo.homepage)
27
+ console.log(
28
+ `╭─ 🌼 ${pc.magenta("daisyUI")} ${pc.dim(daisyuiInfo.version)} ${pc.dim(
29
+ daisyuiInfo.homepage
30
+ )}\n│`
31
+ )
27
32
  }
28
33
 
29
34
  // inject @base style
@@ -32,16 +37,9 @@ const mainFunction = ({ addBase, addComponents, config }) => {
32
37
  }
33
38
 
34
39
  // inject components
35
- // because rollupjs doesn't supprt dynamic require
36
40
  let file = styled
37
- if (config("daisyui.styled") == false && config("daisyui.rtl") != true) {
41
+ if (config("daisyui.styled") == false) {
38
42
  file = unstyled
39
- } else if (config("daisyui.styled") == false && config("daisyui.rtl") == true) {
40
- file = unstyledRtl
41
- } else if (config("daisyui.styled") != false && config("daisyui.rtl") != true) {
42
- file = styled
43
- } else if (config("daisyui.styled") !== false && config("daisyui.rtl") == true) {
44
- file = styledRtl
45
43
  }
46
44
 
47
45
  // add prefix to class names if specified
@@ -82,94 +80,75 @@ const mainFunction = ({ addBase, addComponents, config }) => {
82
80
  }
83
81
 
84
82
  if (logs) {
85
- console.log("│")
86
83
  if (config("daisyui.styled") == false) {
87
84
  console.log(
88
- "├──",
89
- "daisyui.styled",
90
- "\x1b[0m" + "config is",
91
- "\x1b[2m" + "false" + "\x1b[0m",
92
- "– your components will have no design decisions" + "\n│"
85
+ `├─ ${pc.yellow("ℹ︎")} ${pc.blue("daisyui.styled")} ${pc.reset("config is")} ${pc.blue(
86
+ "false"
87
+ )} ${pc.dim(" components will have no design decisions")}\n│`
93
88
  )
94
89
  }
95
90
  if (config("daisyui.utils") == false) {
96
91
  console.log(
97
- "├──",
98
- "daisyui.utils",
99
- "\x1b[0m" + "config is",
100
- "\x1b[2m" + "false" + "\x1b[0m",
101
- "– daisyUI modifier utility classes are disabled" + "\n│"
92
+ `├─ ${pc.yellow("ℹ︎")} ${pc.blue("daisyui.utils")} ${pc.reset("config is")} ${pc.blue(
93
+ "false"
94
+ )} ${pc.dim(" daisyUI utility classes are disabled")}\n│`
102
95
  )
103
96
  }
104
97
  if (config("daisyui.prefix") && config("daisyui.prefix") !== "") {
105
98
  console.log(
106
- "├──",
107
- "\x1b[2m" + "prefix" + "\x1b[0m",
108
- "is enabled, daisyUI classnames must use",
109
- "\x1b[2m" + `${config("daisyui.prefix")}`,
110
- "\x1b[0m" + "prefix. like:",
111
- "\x1b[2m" + `${config("daisyui.prefix")}btn`,
112
- "\x1b[0m" + "\n│ https://daisyui.com/docs/config" + "\n│"
113
- )
114
- }
115
- if (config("daisyui.rtl") == true) {
116
- console.log(
117
- "├──",
118
- "Using RTL, make sure you're using",
119
- "\x1b[2m" + "<html dir=rtl>" + "\x1b[0m",
120
- "and you have",
121
- "\x1b[2mtailwindcss-flip\x1b[0m",
122
- "plugin",
123
- "\n│ https://daisyui.com/docs/config" + "\n│"
99
+ `├─ ${pc.green("✔︎")} ${pc.blue("prefix")} is enabled – ${pc.dim(
100
+ "daisyUI classnames must use"
101
+ )} ${pc.blue(config("daisyui.prefix"))} ${pc.dim("prefix. like:")} ${pc.blue(
102
+ `${config("daisyui.prefix")}btn`
103
+ )}\n│ ${pc.dim("https://daisyui.com/docs/config")}\n│`
124
104
  )
125
105
  }
126
106
  if (themeInjectorHsl.themeOrder.length > 0) {
127
107
  console.log(
128
- "├──",
129
- "\x1b[2m" +
130
- `${themeInjectorHsl.themeOrder.length}` +
131
- "\x1b[0m" +
132
- ` ${themeInjectorHsl.themeOrder.length > 1 ? "themes are" : "theme is"}` +
133
- ` enabled. How to add more themes:` +
134
- "\n│ https://daisyui.com/docs/themes" +
135
- "\n│"
108
+ `├─ ${pc.green("✔︎")} ${themeInjectorHsl.themeOrder.length} ${
109
+ themeInjectorHsl.themeOrder.length > 1 ? "themes" : "theme"
110
+ } added\n│ ${pc.dim("How to add more: https://daisyui.com/docs/themes")}\n│`
136
111
  )
137
112
  }
138
113
  if (themeInjectorHsl.themeOrder.length === 0) {
139
114
  console.log(
140
- "├──",
141
- `All themes are disabled in config. How to add themes:` +
142
- "\n│ https://daisyui.com/docs/themes" +
143
- "\n│"
115
+ `├─ ${pc.yellow("ℹ︎")} All themes are disabled in config\n│ ${pc.dim(
116
+ "How to add themes: https://daisyui.com/docs/themes"
117
+ )}\n│`
144
118
  )
145
119
  }
146
120
  let messages = [
147
- `\x1b[32m💚 Support daisyUI project\x1b[0m: ${daisyuiInfo.funding.url}`,
148
- `\x1b[32m⭐️ Star daisyUI project on GitHub\x1b[0m: https://github.com/saadeghi/daisyui`,
121
+ `${pc.green("❤︎")} ${pc.reset("Support daisyUI project:")} ${pc.dim(
122
+ daisyuiInfo.funding.url
123
+ )}`,
124
+ `${pc.green("★")} ${pc.reset("Star daisyUI project on GitHub:")} ${pc.dim(
125
+ "https://github.com/saadeghi/daisyui"
126
+ )}`,
149
127
  ]
150
- console.log("╰── " + messages[Math.floor(Math.random() * messages.length)])
128
+ console.log(`╰─ ${messages[Math.floor(Math.random() * messages.length)]}`)
151
129
  console.log()
152
130
  }
153
131
  }
154
132
 
155
- module.exports = require("tailwindcss/plugin")(mainFunction, {
133
+ module.exports = tailwindPlugin(mainFunction, {
156
134
  theme: {
157
135
  extend: {
158
136
  colors: {
159
137
  ...colors,
160
138
  // adding all Tailwind `neutral` shades here so they don't get overridden by daisyUI `neutral` color
161
- "neutral-50": tailwindColors.neutral[50],
162
- "neutral-100": tailwindColors.neutral[100],
163
- "neutral-200": tailwindColors.neutral[200],
164
- "neutral-300": tailwindColors.neutral[300],
165
- "neutral-400": tailwindColors.neutral[400],
166
- "neutral-500": tailwindColors.neutral[500],
167
- "neutral-600": tailwindColors.neutral[600],
168
- "neutral-700": tailwindColors.neutral[700],
169
- "neutral-800": tailwindColors.neutral[800],
170
- "neutral-900": tailwindColors.neutral[900],
171
- "neutral-950": tailwindColors.neutral[950],
139
+ "neutral-50": "#fafafa",
140
+ "neutral-100": "#f5f5f5",
141
+ "neutral-200": "#e5e5e5",
142
+ "neutral-300": "#d4d4d4",
143
+ "neutral-400": "#a3a3a3",
144
+ "neutral-500": "#737373",
145
+ "neutral-600": "#525252",
146
+ "neutral-700": "#404040",
147
+ "neutral-800": "#262626",
148
+ "neutral-900": "#171717",
149
+ "neutral-950": "#0a0a0a",
172
150
  },
151
+ ...require("./lib/utility-classes"),
173
152
  },
174
153
  },
175
154
  })
@@ -0,0 +1,21 @@
1
+ function createPlugin(plugin, config) {
2
+ return {
3
+ handler: plugin,
4
+ config,
5
+ }
6
+ }
7
+ createPlugin.withOptions = function (pluginFunction, configFunction = () => ({})) {
8
+ const optionsFunction = function (options) {
9
+ return {
10
+ __options: options,
11
+ handler: pluginFunction(options),
12
+ config: configFunction(options),
13
+ }
14
+ }
15
+ optionsFunction.__isOptionsFunction = true
16
+ optionsFunction.__pluginFunction = pluginFunction
17
+ optionsFunction.__configFunction = configFunction
18
+ return optionsFunction
19
+ }
20
+
21
+ module.exports = createPlugin
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ borderRadius: {
3
+ badge: "var(--rounded-badge, 1.9rem)",
4
+ btn: "var(--rounded-btn, 0.5rem)",
5
+ box: "var(--rounded-box, 1rem)",
6
+ },
7
+ }