daisyui 5.7.4 → 5.7.5

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 (149) hide show
  1. package/base/properties.css +1 -1
  2. package/base/reset.css +1 -1
  3. package/base/rootcolor.css +1 -1
  4. package/base/rootscrollgutter.css +1 -1
  5. package/base/rootscrolllock.css +1 -1
  6. package/base/scrollbar.css +1 -1
  7. package/base/svg.css +1 -1
  8. package/colors/properties-extended.css +1 -1
  9. package/colors/properties.css +1 -1
  10. package/colors/responsive-extended.css +1 -1
  11. package/colors/responsive.css +1 -1
  12. package/colors/states-extended.css +1 -1
  13. package/colors/states.css +1 -1
  14. package/components/alert/object.js +1 -1
  15. package/components/alert.css +1 -1
  16. package/components/aura/object.js +1 -1
  17. package/components/aura.css +1 -1
  18. package/components/avatar/object.js +1 -1
  19. package/components/avatar.css +1 -1
  20. package/components/badge/object.js +1 -1
  21. package/components/badge.css +1 -1
  22. package/components/breadcrumbs/object.js +1 -1
  23. package/components/breadcrumbs.css +1 -1
  24. package/components/button/object.js +1 -1
  25. package/components/button.css +1 -1
  26. package/components/calendar/object.js +1 -1
  27. package/components/calendar.css +1 -1
  28. package/components/card/object.js +1 -1
  29. package/components/card.css +1 -1
  30. package/components/carousel/object.js +1 -1
  31. package/components/carousel.css +1 -1
  32. package/components/chat/object.js +1 -1
  33. package/components/chat.css +1 -1
  34. package/components/checkbox/object.js +1 -1
  35. package/components/checkbox.css +1 -1
  36. package/components/collapse/object.js +1 -1
  37. package/components/collapse.css +1 -1
  38. package/components/countdown/object.js +1 -1
  39. package/components/countdown.css +1 -1
  40. package/components/diff/object.js +1 -1
  41. package/components/diff.css +1 -1
  42. package/components/divider/object.js +1 -1
  43. package/components/divider.css +1 -1
  44. package/components/dock/object.js +1 -1
  45. package/components/dock.css +1 -1
  46. package/components/drawer/object.js +1 -1
  47. package/components/drawer.css +1 -1
  48. package/components/dropdown/object.js +1 -1
  49. package/components/dropdown.css +1 -1
  50. package/components/fab/object.js +1 -1
  51. package/components/fab.css +1 -1
  52. package/components/fieldset/object.js +1 -1
  53. package/components/fieldset.css +1 -1
  54. package/components/fileinput/object.js +1 -1
  55. package/components/fileinput.css +1 -1
  56. package/components/filter/object.js +1 -1
  57. package/components/filter.css +1 -1
  58. package/components/footer/object.js +1 -1
  59. package/components/footer.css +1 -1
  60. package/components/hero/object.js +1 -1
  61. package/components/hero.css +1 -1
  62. package/components/hover3d/object.js +1 -1
  63. package/components/hover3d.css +1 -1
  64. package/components/hovergallery/object.js +1 -1
  65. package/components/hovergallery.css +1 -1
  66. package/components/indicator/object.js +1 -1
  67. package/components/indicator.css +1 -1
  68. package/components/input/object.js +1 -1
  69. package/components/input.css +1 -1
  70. package/components/kbd/object.js +1 -1
  71. package/components/kbd.css +1 -1
  72. package/components/label/object.js +1 -1
  73. package/components/label.css +1 -1
  74. package/components/link/object.js +1 -1
  75. package/components/link.css +1 -1
  76. package/components/list/object.js +1 -1
  77. package/components/list.css +1 -1
  78. package/components/loading/object.js +1 -1
  79. package/components/loading.css +1 -1
  80. package/components/mask/object.js +1 -1
  81. package/components/mask.css +1 -1
  82. package/components/megamenu/object.js +1 -1
  83. package/components/megamenu.css +1 -1
  84. package/components/menu/object.js +1 -1
  85. package/components/menu.css +1 -1
  86. package/components/mockup/object.js +1 -1
  87. package/components/mockup.css +1 -1
  88. package/components/modal/object.js +1 -1
  89. package/components/modal.css +1 -1
  90. package/components/navbar/object.js +1 -1
  91. package/components/navbar.css +1 -1
  92. package/components/otp/object.js +1 -1
  93. package/components/otp.css +1 -1
  94. package/components/progress/object.js +1 -1
  95. package/components/progress.css +1 -1
  96. package/components/radialprogress/object.js +1 -1
  97. package/components/radialprogress.css +1 -1
  98. package/components/radio/object.js +1 -1
  99. package/components/radio.css +1 -1
  100. package/components/range/object.js +1 -1
  101. package/components/range.css +1 -1
  102. package/components/rating/object.js +1 -1
  103. package/components/rating.css +1 -1
  104. package/components/select/object.js +1 -1
  105. package/components/select.css +1 -1
  106. package/components/skeleton/object.js +1 -1
  107. package/components/skeleton.css +1 -1
  108. package/components/stack/object.js +1 -1
  109. package/components/stack.css +1 -1
  110. package/components/stat/object.js +1 -1
  111. package/components/stat.css +1 -1
  112. package/components/status/object.js +1 -1
  113. package/components/status.css +1 -1
  114. package/components/steps/object.js +1 -1
  115. package/components/steps.css +1 -1
  116. package/components/swap/object.js +1 -1
  117. package/components/swap.css +1 -1
  118. package/components/tab/object.js +1 -1
  119. package/components/tab.css +1 -1
  120. package/components/table/object.js +1 -1
  121. package/components/table.css +1 -1
  122. package/components/textarea/object.js +1 -1
  123. package/components/textarea.css +1 -1
  124. package/components/textrotate/object.js +1 -1
  125. package/components/textrotate.css +1 -1
  126. package/components/timeline/object.js +1 -1
  127. package/components/timeline.css +1 -1
  128. package/components/toast/object.js +1 -1
  129. package/components/toast.css +1 -1
  130. package/components/toggle/object.js +1 -1
  131. package/components/toggle.css +1 -1
  132. package/components/tooltip/object.js +1 -1
  133. package/components/tooltip.css +1 -1
  134. package/components/validator/object.js +1 -1
  135. package/components/validator.css +1 -1
  136. package/daisyui.css +1 -1
  137. package/functions/addPrefix.js +39 -36
  138. package/functions/themeOrder.d.ts +2 -0
  139. package/functions/variables.d.ts +32 -0
  140. package/index.js +10 -3
  141. package/package.json +18 -1
  142. package/theme/index.js +11 -4
  143. package/theme/object.d.ts +24 -24
  144. package/theme/object.js +1 -1
  145. package/themes.css +1 -1
  146. package/utilities/glass.css +1 -1
  147. package/utilities/join.css +1 -1
  148. package/utilities/radius.css +1 -1
  149. package/utilities/typography.css +1 -1
@@ -1,5 +1,23 @@
1
1
  const defaultExcludedPrefixes = ["color-", "size-", "radius-", "border", "depth", "noise"]
2
- const excludedSelectors = ["prose"]
2
+ const excludedSelectors = [
3
+ "prose",
4
+ "is-hidden",
5
+ "is-bound",
6
+ "is-disabled",
7
+ "is-today",
8
+ "is-selected",
9
+ "has-event",
10
+ "is-inrange",
11
+ "is-startrange",
12
+ "is-endrange",
13
+ "is-outside-current-month",
14
+ "is-selection-disabled",
15
+ "pick-whole-week",
16
+ ]
17
+ const shouldExcludeSelector = (selector) => {
18
+ const selectorName = selector.match(/^[\w-]+/)?.[0] || selector
19
+ return excludedSelectors.includes(selectorName) || /^(rdp|pika|vc)-/.test(selectorName)
20
+ }
3
21
 
4
22
  const shouldExcludeVariable = (variableName, excludedPrefixes) => {
5
23
  if (variableName.startsWith("tw")) {
@@ -17,47 +35,37 @@ const prefixVariable = (variableName, prefix, excludedPrefixes) => {
17
35
 
18
36
  const getPrefixedSelector = (selector, prefix) => {
19
37
  if (!selector.startsWith(".")) return selector
20
- if (excludedSelectors.includes(selector.slice(1))) return selector
38
+ if (shouldExcludeSelector(selector.slice(1))) return selector
21
39
  return `.${prefix}${selector.slice(1)}`
22
40
  }
23
41
 
24
42
  const getPrefixedKey = (key, prefix, excludedPrefixes) => {
25
- const prefixAmpDot = prefix ? `&.${prefix}` : ""
26
-
27
43
  if (!prefix) return key
28
44
 
29
- if (key.startsWith(".") && excludedSelectors.includes(key.slice(1))) return key
45
+ if (key.startsWith(".") && shouldExcludeSelector(key.slice(1))) return key
30
46
 
31
47
  if (key.startsWith("--")) {
32
48
  const variableName = key.slice(2)
33
49
  return `--${prefixVariable(variableName, prefix, excludedPrefixes)}`
34
50
  }
35
51
 
52
+ if (key.startsWith("@property --")) {
53
+ return processStringValue(key, prefix, excludedPrefixes)
54
+ }
55
+
36
56
  if (key.startsWith("@") || key.startsWith("[")) {
37
57
  return key
38
58
  }
39
59
 
40
60
  if (key.startsWith("&")) {
41
- // If it's a complex selector with :not(), :has(), etc.
42
- if (key.match(/:[a-z-]+\(/)) {
43
- return key.replace(/\.([\w-]+)/g, (m, cls) =>
44
- excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
45
- )
46
- }
47
- // For simple &. cases
48
- if (key.startsWith("&.")) {
49
- if (excludedSelectors.includes(key.slice(2))) return key
50
- return `${prefixAmpDot}${key.slice(2)}`
51
- }
52
- // For other & cases (like &:hover or &:not(...))
53
61
  return key.replace(/\.([\w-]+)/g, (m, cls) =>
54
- excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
62
+ shouldExcludeSelector(cls) ? `.${cls}` : `.${prefix}${cls}`,
55
63
  )
56
64
  }
57
65
 
58
66
  if (key.startsWith(":")) {
59
67
  return key.replace(/\.([\w-]+)/g, (m, cls) =>
60
- excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
68
+ shouldExcludeSelector(cls) ? `.${cls}` : `.${prefix}${cls}`,
61
69
  )
62
70
  }
63
71
 
@@ -68,12 +76,9 @@ const getPrefixedKey = (key, prefix, excludedPrefixes) => {
68
76
  !key.includes("+") &&
69
77
  !key.includes("~")
70
78
  ) {
71
- return key
72
- .split(".")
73
- .filter(Boolean)
74
- .map((part) => (excludedSelectors.includes(part) ? part : prefix + part))
75
- .join(".")
76
- .replace(/^/, ".")
79
+ return key.replace(/\.([\w-]+)/g, (m, cls) =>
80
+ shouldExcludeSelector(cls) ? `.${cls}` : `.${prefix}${cls}`,
81
+ )
77
82
  }
78
83
 
79
84
  if (key.includes(">") || key.includes("+") || key.includes("~")) {
@@ -84,7 +89,7 @@ const getPrefixedKey = (key, prefix, excludedPrefixes) => {
84
89
  .map((part) => {
85
90
  // Replace class names with prefixed versions for each part
86
91
  return part.replace(/\.([\w-]+)/g, (m, cls) =>
87
- excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
92
+ shouldExcludeSelector(cls) ? `.${cls}` : `.${prefix}${cls}`,
88
93
  )
89
94
  })
90
95
  .join(", ")
@@ -92,7 +97,7 @@ const getPrefixedKey = (key, prefix, excludedPrefixes) => {
92
97
 
93
98
  // For simple combinators (not comma-separated)
94
99
  let processedKey = key.replace(/\.([\w-]+)/g, (m, cls) =>
95
- excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
100
+ shouldExcludeSelector(cls) ? `.${cls}` : `.${prefix}${cls}`,
96
101
  )
97
102
 
98
103
  // Add a space before combinators at the beginning
@@ -112,9 +117,7 @@ const getPrefixedKey = (key, prefix, excludedPrefixes) => {
112
117
  .split(/\s+/)
113
118
  .map((part) => {
114
119
  if (part.startsWith(".")) {
115
- return excludedSelectors.includes(part.slice(1))
116
- ? part
117
- : getPrefixedSelector(part, prefix)
120
+ return shouldExcludeSelector(part.slice(1)) ? part : getPrefixedSelector(part, prefix)
118
121
  }
119
122
  return part
120
123
  })
@@ -124,15 +127,15 @@ const getPrefixedKey = (key, prefix, excludedPrefixes) => {
124
127
  if (key.includes(":")) {
125
128
  const [selector, ...pseudo] = key.split(":")
126
129
  if (selector.startsWith(".")) {
127
- return `${excludedSelectors.includes(selector.slice(1)) ? selector : getPrefixedSelector(selector, prefix)}:${pseudo.join(":")}`
130
+ return `${shouldExcludeSelector(selector.slice(1)) ? selector : getPrefixedSelector(selector, prefix)}:${pseudo.join(":")}`
128
131
  }
129
132
  return key.replace(/\.([\w-]+)/g, (m, cls) =>
130
- excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
133
+ shouldExcludeSelector(cls) ? `.${cls}` : `.${prefix}${cls}`,
131
134
  )
132
135
  }
133
136
 
134
137
  if (key.startsWith(".")) {
135
- return excludedSelectors.includes(key.slice(1)) ? key : getPrefixedSelector(key, prefix)
138
+ return shouldExcludeSelector(key.slice(1)) ? key : getPrefixedSelector(key, prefix)
136
139
  }
137
140
 
138
141
  return key
@@ -142,7 +145,7 @@ const processArrayValue = (value, prefix, excludedPrefixes) => {
142
145
  return value.map((item) => {
143
146
  if (typeof item === "string") {
144
147
  if (item.startsWith(".")) {
145
- return excludedSelectors.includes(item.slice(1))
148
+ return shouldExcludeSelector(item.slice(1))
146
149
  ? item
147
150
  : prefix
148
151
  ? `.${prefix}${item.slice(1)}`
@@ -154,14 +157,14 @@ const processArrayValue = (value, prefix, excludedPrefixes) => {
154
157
  })
155
158
  }
156
159
 
157
- const reVariableName = /var\s*\(\s*--([a-zA-Z0-9_-]+)/g
160
+ const reVariableName = /--([a-zA-Z0-9_-]+)/g
158
161
  const processStringValue = (value, prefix, excludedPrefixes) => {
159
162
  if (prefix === 0) return value
160
163
  return value.replace(reVariableName, (match, variableName) => {
161
164
  if (shouldExcludeVariable(variableName, excludedPrefixes)) {
162
165
  return match
163
166
  }
164
- return `var(--${prefix}${variableName}`
167
+ return `--${prefix}${variableName}`
165
168
  })
166
169
  }
167
170
 
@@ -0,0 +1,2 @@
1
+ declare const themeOrder: readonly string[]
2
+ export default themeOrder
@@ -0,0 +1,32 @@
1
+ declare module 'daisyui/functions/variables' {
2
+ const variables: {
3
+ colors: {
4
+ "base-100": string;
5
+ "base-200": string;
6
+ "base-300": string;
7
+ "base-content": string;
8
+ primary: string;
9
+ "primary-content": string;
10
+ secondary: string;
11
+ "secondary-content": string;
12
+ accent: string;
13
+ "accent-content": string;
14
+ neutral: string;
15
+ "neutral-content": string;
16
+ info: string;
17
+ "info-content": string;
18
+ success: string;
19
+ "success-content": string;
20
+ warning: string;
21
+ "warning-content": string;
22
+ error: string;
23
+ "error-content": string;
24
+ };
25
+ borderRadius: {
26
+ selector: string;
27
+ field: string;
28
+ box: string;
29
+ };
30
+ };
31
+ export default variables;
32
+ }
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
- const version = "5.7.4"
1
+ const version = "5.7.5"
2
2
  import { pluginOptionsHandler } from "./functions/pluginOptionsHandler.js"
3
3
  import { plugin } from "./functions/plugin.js"
4
+ import { nestCssLayers } from "./functions/nestCssLayers.js"
4
5
  import variables from "./functions/variables.js"
5
6
  import themesObject from "./theme/object.js"
6
7
  import { base, components, utilities } from "./imports.js"
@@ -34,12 +35,18 @@ export default plugin.withOptions(
34
35
 
35
36
  Object.entries(components).forEach(([name, item]) => {
36
37
  if (!shouldIncludeItem(name)) return
37
- item({ addComponents, prefix })
38
+ item({
39
+ addComponents: (styles) => addComponents(nestCssLayers(styles)),
40
+ prefix,
41
+ })
38
42
  })
39
43
 
40
44
  Object.entries(utilities).forEach(([name, item]) => {
41
45
  if (!shouldIncludeItem(name)) return
42
- item({ addUtilities, prefix })
46
+ item({
47
+ addUtilities: (styles) => addUtilities(nestCssLayers(styles)),
48
+ prefix,
49
+ })
43
50
  })
44
51
 
45
52
  // drawer variants. Can not be nested in layers so defined here
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "daisyui",
4
- "version": "5.7.4",
4
+ "version": "5.7.5",
5
5
  "description": "daisyUI 5 - The Tailwind CSS Component Library",
6
6
  "author": "Pouya Saadeghi",
7
7
  "license": "MIT",
@@ -50,6 +50,21 @@
50
50
  "browser": "./daisyui.css",
51
51
  "exports": {
52
52
  ".": "./index.js",
53
+ "./theme": {
54
+ "default": "./theme/index.js"
55
+ },
56
+ "./theme/object": {
57
+ "types": "./theme/object.d.ts",
58
+ "default": "./theme/object.js"
59
+ },
60
+ "./functions/themeOrder": {
61
+ "types": "./functions/themeOrder.d.ts",
62
+ "default": "./functions/themeOrder.js"
63
+ },
64
+ "./functions/variables": {
65
+ "types": "./functions/variables.d.ts",
66
+ "default": "./functions/variables.js"
67
+ },
53
68
  "./*": "./*"
54
69
  },
55
70
  "files": [
@@ -61,7 +76,9 @@
61
76
  "functions/plugin.js",
62
77
  "functions/pluginOptionsHandler.js",
63
78
  "functions/themeOrder.js",
79
+ "functions/themeOrder.d.ts",
64
80
  "functions/variables.js",
81
+ "functions/variables.d.ts",
65
82
  "theme",
66
83
  "utilities",
67
84
  "imports.js",
package/theme/index.js CHANGED
@@ -1,18 +1,25 @@
1
1
  import { plugin } from "../functions/plugin.js"
2
2
  import allThemes from "./object.js"
3
3
 
4
+ const escapeCssString = (value) =>
5
+ String(value).replace(
6
+ /[^a-zA-Z0-9_-]/gu,
7
+ (character) => `\\${character.codePointAt(0).toString(16)} `,
8
+ )
9
+
4
10
  export default plugin.withOptions((options = {}) => {
5
11
  return ({ addBase }) => {
6
12
  const {
7
13
  name = "custom-theme",
8
14
  default: isDefault = false,
9
15
  prefersdark = false,
10
- "color-scheme": colorScheme = "normal",
16
+ "color-scheme": colorScheme,
11
17
  root = ":root",
12
18
  ...customThemeTokens
13
19
  } = options
14
20
 
15
- let selector = `${root}:has(input.theme-controller[value=${name}]:checked),[data-theme="${name}"]`
21
+ const escapedName = escapeCssString(name)
22
+ let selector = `${root}:has(input.theme-controller[value="${escapedName}"]:checked),[data-theme="${escapedName}"]`
16
23
  if (isDefault) {
17
24
  selector = `:where(${root}),${selector}`
18
25
  }
@@ -24,13 +31,13 @@ export default plugin.withOptions((options = {}) => {
24
31
  themeTokens = {
25
32
  ...builtinTheme,
26
33
  ...customThemeTokens,
27
- "color-scheme": colorScheme || builtinTheme.colorScheme,
34
+ "color-scheme": colorScheme ?? builtinTheme["color-scheme"],
28
35
  }
29
36
  }
30
37
 
31
38
  const baseStyles = {
32
39
  [selector]: {
33
- "color-scheme": themeTokens["color-scheme"] || colorScheme,
40
+ "color-scheme": themeTokens["color-scheme"] ?? colorScheme ?? "normal",
34
41
  ...themeTokens,
35
42
  },
36
43
  }
package/theme/object.d.ts CHANGED
@@ -33,40 +33,40 @@ interface Theme {
33
33
 
34
34
  interface Themes {
35
35
  black: Theme
36
- silk: Theme
37
- halloween: Theme
38
- forest: Theme
39
- retro: Theme
40
36
  light: Theme
41
37
  lemonade: Theme
38
+ retro: Theme
39
+ halloween: Theme
40
+ forest: Theme
41
+ silk: Theme
42
42
  caramellatte: Theme
43
- nord: Theme
44
- fantasy: Theme
45
- autumn: Theme
46
- corporate: Theme
47
- cupcake: Theme
48
- night: Theme
49
- abyss: Theme
50
- synthwave: Theme
51
- dim: Theme
52
43
  bumblebee: Theme
53
- luxury: Theme
44
+ dim: Theme
45
+ synthwave: Theme
46
+ abyss: Theme
47
+ night: Theme
48
+ cupcake: Theme
49
+ corporate: Theme
50
+ autumn: Theme
51
+ fantasy: Theme
52
+ nord: Theme
54
53
  cyberpunk: Theme
55
- dark: Theme
56
- aqua: Theme
57
54
  wireframe: Theme
58
55
  acid: Theme
56
+ aqua: Theme
57
+ dark: Theme
58
+ luxury: Theme
59
59
  winter: Theme
60
+ valentine: Theme
61
+ coffee: Theme
62
+ pastel: Theme
63
+ business: Theme
64
+ garden: Theme
65
+ lofi: Theme
66
+ dracula: Theme
67
+ emerald: Theme
60
68
  cmyk: Theme
61
69
  sunset: Theme
62
- emerald: Theme
63
- dracula: Theme
64
- lofi: Theme
65
- garden: Theme
66
- business: Theme
67
- pastel: Theme
68
- coffee: Theme
69
- valentine: Theme
70
70
  [key: string]: Theme
71
71
  }
72
72