@macroui/macroui 1.0.30 → 4.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Pouya Saadeghi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,203 +1,37 @@
1
- # Element Plus DaisyUI 组件库
1
+ <div align="center">
2
2
 
3
- 基于 Vue 3 + Element Plus API + daisyUI 视觉风格的组件库。
3
+ [![][logo-url]][docs-url]
4
4
 
5
- ## 特性
5
+ **The most popular, free and open-source component library for Tailwind CSS**
6
6
 
7
- - ✅ 100% Element Plus API 兼容
8
- - ✅ 100% daisyUI 视觉风格
9
- - ✅ 支持 25 个主题
10
- - ✅ TypeScript 支持
11
- - ✅ 按需引入
12
- - ✅ 多语言支持(i18n)
7
+ [![][version]](https://www.npmjs.com/package/daisyui)
8
+ [![][commit]](https://github.com/saadeghi/daisyui)
9
+ [![][license]](https://github.com/saadeghi/daisyui/blob/master/LICENSE)
10
+ [![][stars]](https://github.com/saadeghi/daisyui)
11
+ [![][installs]](https://www.npmjs.com/package/daisyui)
12
+ [![][jsdelivr]](https://cdn.jsdelivr.net/npm/daisyui@5)
13
+ [![][discord]](https://daisyui.com/discord/)
14
+ [![][opencollectivebadge]](https://opencollective.com/daisyui)
13
15
 
14
- ## 安装
16
+ </div>
15
17
 
16
- ```bash
17
- npm install @macroui/macroui
18
- ```
18
+ # daisyUI 5
19
19
 
20
- ## 使用
20
+ ### 🌼 [Official website →](https://daisyui.com/)
21
21
 
22
- ### 全局注册(推荐)
22
+ ### 🌼 [See all components →](https://daisyui.com/components/)
23
23
 
24
- ```javascript
25
- import { createApp } from 'vue'
26
- import App from './App.vue'
27
- import 'daisyui/dist/full.css'
28
- import Macroui from '@macroui/macroui'
24
+ ### 🌼 [How to use →](https://daisyui.com/docs/install/)
29
25
 
30
- const app = createApp(App)
31
- app.use(Macroui)
32
- app.mount('#app')
33
- ```
26
+ ---
34
27
 
35
- ### 按需引入
36
-
37
- ```javascript
38
- import { ElButton, ElInput, ElSelect } from '@macroui/macroui'
39
- import 'daisyui/dist/full.css'
40
-
41
- app.component('el-button', ElButton)
42
- app.component('el-input', ElInput)
43
- app.component('el-select', ElSelect)
44
- ```
45
-
46
- ## 🌍 多语言
47
-
48
- ### 全局配置
49
-
50
- ```javascript
51
- import { ElConfigProvider } from '@macroui/macroui'
52
- import { zhCn, en } from '@macroui/macroui/locale'
53
-
54
- app.use(ElConfigProvider, { locale: zhCn })
55
- ```
56
-
57
- ### 组件内使用
58
-
59
- ```javascript
60
- import { useLocale } from '@macroui/macroui'
61
-
62
- const { t } = useLocale()
63
-
64
- // 使用翻译键
65
- t('pagination.total', { total: 100 }) // 输出:共 100 条
66
- t('select.placeholder') // 输出:请选择
67
- ```
68
-
69
- ### 支持的语言
70
-
71
- | 语言 | 代码 | 状态 |
72
- |------|------|------|
73
- | 简体中文 | zh-cn | ✅ 已完成 |
74
- | English | en | ✅ 已完成 |
75
-
76
- ## 主题
77
-
78
- 支持 daisyUI 全部 25 个主题:
79
-
80
- ```javascript
81
- // 切换主题
82
- document.documentElement.setAttribute('data-theme', 'dark')
83
- ```
84
-
85
- 主题列表:
86
-
87
- - light, dark, corporate, business, cmyk, acid, aqua, autumn
88
- - black, coffee, cupcake, cyberpunk, dracula, emeral, fantasy
89
- - forest, garden, halloween, jungle, lofi, luxury, night
90
- - pastel, retro, synthwave, valentine, wireframe, zenith
91
-
92
- ## 组件列表
93
-
94
- ### 表单组件
95
-
96
- | 组件 | 说明 | DaisyUI |
97
- |------|------|--------|
98
- | ElButton | 按钮 | button |
99
- | ElInput | 输入框 | input |
100
- | ElSelect | 选择器 | select |
101
- | ElCheckbox | 多选框 | checkbox |
102
- | ElRadio | 单选框 | radio |
103
- | ElSwitch | 开关 | toggle |
104
- | ElTag | 标签 | badge |
105
- | ElForm | 表单 | form |
106
- | ElInputNumber | 数字输入 | - |
107
- | ElSlider | 滑块 | - |
108
- | ElRate | 评分 | - |
109
-
110
- ### 数据展示
111
-
112
- | 组件 | 说明 | DaisyUI |
113
- |------|------|--------|
114
- | ElBadge | 徽章 | badge |
115
- | ElProgress | 进度条 | progress |
116
- | ElAvatar | 头像 | avatar |
117
- | ElSkeleton | 骨架屏 | skeleton |
118
- | ElTable | 表格 | table |
119
- | ElEmpty | 空状态 | - |
120
- | ElResult | 结果页 | - |
121
-
122
- ### 反馈组件
123
-
124
- | 组件 | 说明 | DaisyUI |
125
- |------|------|--------|
126
- | ElAlert | 警告提示 | alert |
127
- | ElLoading | 加载状态 | loading |
128
- | ElMessage | 消息提示 | toast |
129
- | ElNotification | 通知 | toast |
130
-
131
- ### 容器组件
132
-
133
- | 组件 | 说明 | DaisyUI |
134
- |------|------|--------|
135
- | ElCard | 卡片 | card |
136
- | ElCollapse | 折叠面板 | collapse |
137
- | ElDialog | 对话框 | modal |
138
- | ElDrawer | 抽屉 | - |
139
-
140
- ### 导航组件
141
-
142
- | 组件 | 说明 | DaisyUI |
143
- |------|------|--------|
144
- | ElBreadcrumb | 面包屑 | breadcrumb |
145
- | ElPagination | 分页 | pagination |
146
- | ElSteps | 步骤条 | steps |
147
- | ElDropdown | 下拉菜单 | dropdown |
148
- | ElMenu | 菜单 | menu |
149
- | ElTabs | 标签页 | tabs |
150
- | ElPageHeader | 页头 | - |
151
-
152
- ### 布局组件
153
-
154
- | 组件 | 说明 | DaisyUI |
155
- |------|------|--------|
156
- | ElDivider | 分割线 | divider |
157
- | ElTooltip | 文字提示 | tooltip |
158
- | ElContainer | 容器 | - |
159
- | ElSpace | 间距 | - |
160
-
161
- ## 开发
162
-
163
- ```bash
164
- # 安装依赖
165
- npm install
166
-
167
- # 启动示例页面(推荐)
168
- npm run dev:examples
169
-
170
- # 构建库
171
- npm run build:lib
172
-
173
- # 运行测试
174
- npm run test
175
-
176
- # 代码检查
177
- npm run lint
178
-
179
- # TypeScript 检查
180
- npm run typecheck
181
- ```
182
-
183
- ### 示例页面
184
-
185
- 启动示例页面后,访问 http://localhost:3000/ 可以查看所有组件的示例演示。
186
-
187
- 启动命令:`npm run dev:examples`
188
-
189
- > 注意:示例页面使用 3000 端口,如果端口被占用,Vite 会自动选择其他端口。
190
-
191
- ## NPM 发布
192
-
193
- ```bash
194
- # 设置认证 Token(2FA 账户必须)
195
- npm config set //registry.npmjs.org/:_authToken=YOUR_GRANULAR_TOKEN
196
-
197
- # 发布包
198
- npm publish --access public
199
- ```
200
-
201
- ## 许可证
202
-
203
- MIT License
28
+ [version]: https://badgen.net/github/tag/saadeghi/daisyui?label=Version&color=1AD1A5
29
+ [commit]: https://badgen.net/github/last-commit/saadeghi/daisyui?label=Last%20commit&color=1AD1A5
30
+ [license]: https://badgen.net/github/license/saadeghi/daisyui?label=License&color=1AD1A5
31
+ [stars]: https://badgen.net/github/stars/saadeghi/daisyui?label=GitHub%20stars&color=1AD1A5
32
+ [installs]: https://badgen.net/npm/dt/daisyui?label=NPM%20installs&color=1AD1A5
33
+ [jsdelivr]: https://badgen.net/jsdelivr/hits/npm/daisyui?color=1AD1A5
34
+ [discord]: https://badgen.net/discord/members/S6TZxycVHs?label=Discord&color=1AD1A5
35
+ [opencollectivebadge]: https://badgen.net/opencollective/backers/daisyui?label=Open%20Collective&color=1AD1A5
36
+ [docs-url]: https://daisyui.com/
37
+ [logo-url]: https://img.daisyui.com/images/daisyui/daisyui-logo-192.png
@@ -0,0 +1,185 @@
1
+ const defaultExcludedPrefixes = ["color-", "size-", "radius-", "border", "depth", "noise"]
2
+ const excludedSelectors = ["prose"]
3
+
4
+ const shouldExcludeVariable = (variableName, excludedPrefixes) => {
5
+ if (variableName.startsWith("tw")) {
6
+ return true
7
+ }
8
+ return excludedPrefixes.some((excludedPrefix) => variableName.startsWith(excludedPrefix))
9
+ }
10
+
11
+ const prefixVariable = (variableName, prefix, excludedPrefixes) => {
12
+ if (shouldExcludeVariable(variableName, excludedPrefixes)) {
13
+ return variableName
14
+ }
15
+ return `${prefix}${variableName}`
16
+ }
17
+
18
+ const getPrefixedSelector = (selector, prefix) => {
19
+ if (!selector.startsWith(".")) return selector
20
+ if (excludedSelectors.includes(selector.slice(1))) return selector
21
+ return `.${prefix}${selector.slice(1)}`
22
+ }
23
+
24
+ const getPrefixedKey = (key, prefix, excludedPrefixes) => {
25
+ const prefixAmpDot = prefix ? `&.${prefix}` : ""
26
+
27
+ if (!prefix) return key
28
+
29
+ if (key.startsWith(".") && excludedSelectors.includes(key.slice(1))) return key
30
+
31
+ if (key.startsWith("--")) {
32
+ const variableName = key.slice(2)
33
+ return `--${prefixVariable(variableName, prefix, excludedPrefixes)}`
34
+ }
35
+
36
+ if (key.startsWith("@") || key.startsWith("[")) {
37
+ return key
38
+ }
39
+
40
+ 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
+ return key.replace(/\.([\w-]+)/g, (m, cls) =>
54
+ excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
55
+ )
56
+ }
57
+
58
+ if (key.startsWith(":")) {
59
+ return key.replace(/\.([\w-]+)/g, (m, cls) =>
60
+ excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
61
+ )
62
+ }
63
+
64
+ if (
65
+ key.includes(".") &&
66
+ !key.includes(" ") &&
67
+ !key.includes(">") &&
68
+ !key.includes("+") &&
69
+ !key.includes("~")
70
+ ) {
71
+ return key
72
+ .split(".")
73
+ .filter(Boolean)
74
+ .map((part) => (excludedSelectors.includes(part) ? part : prefix + part))
75
+ .join(".")
76
+ .replace(/^/, ".")
77
+ }
78
+
79
+ if (key.includes(">") || key.includes("+") || key.includes("~")) {
80
+ // For comma-separated selectors
81
+ if (key.includes(",")) {
82
+ return key
83
+ .split(/\s*,\s*/)
84
+ .map((part) => {
85
+ // Replace class names with prefixed versions for each part
86
+ return part.replace(/\.([\w-]+)/g, (m, cls) =>
87
+ excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
88
+ )
89
+ })
90
+ .join(", ")
91
+ }
92
+
93
+ // For simple combinators (not comma-separated)
94
+ let processedKey = key.replace(/\.([\w-]+)/g, (m, cls) =>
95
+ excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
96
+ )
97
+
98
+ // Add a space before combinators at the beginning
99
+ if (
100
+ processedKey.startsWith(">") ||
101
+ processedKey.startsWith("+") ||
102
+ processedKey.startsWith("~")
103
+ ) {
104
+ processedKey = ` ${processedKey}`
105
+ }
106
+
107
+ return processedKey
108
+ }
109
+
110
+ if (key.includes(" ")) {
111
+ return key
112
+ .split(/\s+/)
113
+ .map((part) => {
114
+ if (part.startsWith(".")) {
115
+ return excludedSelectors.includes(part.slice(1))
116
+ ? part
117
+ : getPrefixedSelector(part, prefix)
118
+ }
119
+ return part
120
+ })
121
+ .join(" ")
122
+ }
123
+
124
+ if (key.includes(":")) {
125
+ const [selector, ...pseudo] = key.split(":")
126
+ if (selector.startsWith(".")) {
127
+ return `${excludedSelectors.includes(selector.slice(1)) ? selector : getPrefixedSelector(selector, prefix)}:${pseudo.join(":")}`
128
+ }
129
+ return key.replace(/\.([\w-]+)/g, (m, cls) =>
130
+ excludedSelectors.includes(cls) ? `.${cls}` : `.${prefix}${cls}`,
131
+ )
132
+ }
133
+
134
+ if (key.startsWith(".")) {
135
+ return excludedSelectors.includes(key.slice(1)) ? key : getPrefixedSelector(key, prefix)
136
+ }
137
+
138
+ return key
139
+ }
140
+
141
+ const processArrayValue = (value, prefix, excludedPrefixes) => {
142
+ return value.map((item) => {
143
+ if (typeof item === "string") {
144
+ if (item.startsWith(".")) {
145
+ return excludedSelectors.includes(item.slice(1))
146
+ ? item
147
+ : prefix
148
+ ? `.${prefix}${item.slice(1)}`
149
+ : item
150
+ }
151
+ return processStringValue(item, prefix, excludedPrefixes)
152
+ }
153
+ return item
154
+ })
155
+ }
156
+
157
+ const processStringValue = (value, prefix, excludedPrefixes) => {
158
+ if (prefix === 0) return value
159
+ return value.replace(/var\(--([^)]+)\)/g, (match, variableName) => {
160
+ if (shouldExcludeVariable(variableName, excludedPrefixes)) {
161
+ return match
162
+ }
163
+ return `var(--${prefix}${variableName})`
164
+ })
165
+ }
166
+
167
+ const processValue = (value, prefix, excludedPrefixes) => {
168
+ if (Array.isArray(value)) {
169
+ return processArrayValue(value, prefix, excludedPrefixes)
170
+ } else if (typeof value === "object" && value !== null) {
171
+ return addPrefix(value, prefix, excludedPrefixes)
172
+ } else if (typeof value === "string") {
173
+ return processStringValue(value, prefix, excludedPrefixes)
174
+ } else {
175
+ return value
176
+ }
177
+ }
178
+
179
+ export const addPrefix = (obj, prefix, excludedPrefixes = defaultExcludedPrefixes) => {
180
+ return Object.entries(obj).reduce((result, [key, value]) => {
181
+ const newKey = getPrefixedKey(key, prefix, excludedPrefixes)
182
+ result[newKey] = processValue(value, prefix, excludedPrefixes)
183
+ return result
184
+ }, {})
185
+ }
@@ -0,0 +1,11 @@
1
+ export const plugin = {
2
+ withOptions: (pluginFunction, configFunction = () => ({})) => {
3
+ const optionsFunction = (options) => {
4
+ const handler = pluginFunction(options)
5
+ const config = configFunction(options)
6
+ return { handler, config }
7
+ }
8
+ optionsFunction.__isOptionsFunction = true
9
+ return optionsFunction
10
+ },
11
+ }
@@ -0,0 +1,97 @@
1
+ import themeOrder from "./themeOrder.js"
2
+
3
+ export const pluginOptionsHandler = (() => {
4
+ let firstRun = true
5
+ return (options, addBase, themesObject, packageVersion) => {
6
+ const {
7
+ logs = true,
8
+ root = ":root",
9
+ themes = ["light --default", "dark --prefersdark"],
10
+ include,
11
+ exclude,
12
+ prefix = "",
13
+ } = options || {}
14
+
15
+ if (logs !== false && firstRun) {
16
+ console.log(
17
+ `${atob("Lyoh")} ${decodeURIComponent("%F0%9F%8C%BC")} ${atob("ZGFpc3lVSQ==")} ${packageVersion} ${atob("Ki8=")}`,
18
+ )
19
+ firstRun = false
20
+ }
21
+
22
+ const applyTheme = (themeName, flags) => {
23
+ const theme = themesObject[themeName]
24
+ if (theme) {
25
+ // Use prefix for theme-controller class name
26
+ const themeControllerClass = `${prefix}theme-controller`
27
+ let selector = `${root}:has(input.${themeControllerClass}[value=${themeName}]:checked),[data-theme=${themeName}]`
28
+ if (flags.includes("--default")) {
29
+ selector = `:where(${root}),${selector}`
30
+ }
31
+ addBase({ [selector]: theme })
32
+
33
+ if (flags.includes("--prefersdark")) {
34
+ // Use :root:not([data-theme]) for dark mode specificity
35
+ const darkSelector =
36
+ root === ":root" ? ":root:not([data-theme])" : `${root}:not([data-theme])`
37
+ addBase({ "@media (prefers-color-scheme: dark)": { [darkSelector]: theme } })
38
+ }
39
+ }
40
+ }
41
+
42
+ if (themes === "all") {
43
+ if (themesObject["light"]) {
44
+ applyTheme("light", ["--default"])
45
+ }
46
+
47
+ if (themesObject["dark"]) {
48
+ const darkSelector =
49
+ root === ":root" ? ":root:not([data-theme])" : `${root}:not([data-theme])`
50
+ addBase({ "@media (prefers-color-scheme: dark)": { [darkSelector]: themesObject["dark"] } })
51
+ }
52
+
53
+ themeOrder.forEach((themeName) => {
54
+ if (themesObject[themeName]) {
55
+ applyTheme(themeName, [])
56
+ }
57
+ })
58
+ } else if (themes) {
59
+ const themeArray = Array.isArray(themes) ? themes : [themes]
60
+
61
+ // For single theme with --default flag, skip the other applications
62
+ if (themeArray.length === 1 && themeArray[0].includes("--default")) {
63
+ const [themeName, ...flags] = themeArray[0].split(" ")
64
+ applyTheme(themeName, flags)
65
+ return { include, exclude, prefix }
66
+ }
67
+
68
+ // default theme
69
+ themeArray.forEach((themeOption) => {
70
+ const [themeName, ...flags] = themeOption.split(" ")
71
+ if (flags.includes("--default")) {
72
+ applyTheme(themeName, ["--default"])
73
+ }
74
+ })
75
+
76
+ // prefers dark theme
77
+ themeArray.forEach((themeOption) => {
78
+ const [themeName, ...flags] = themeOption.split(" ")
79
+ if (flags.includes("--prefersdark")) {
80
+ const darkSelector =
81
+ root === ":root" ? ":root:not([data-theme])" : `${root}:not([data-theme])`
82
+ addBase({
83
+ "@media (prefers-color-scheme: dark)": { [darkSelector]: themesObject[themeName] },
84
+ })
85
+ }
86
+ })
87
+
88
+ // other themes
89
+ themeArray.forEach((themeOption) => {
90
+ const [themeName] = themeOption.split(" ")
91
+ applyTheme(themeName, [])
92
+ })
93
+ }
94
+
95
+ return { include, exclude, prefix }
96
+ }
97
+ })()
@@ -0,0 +1,37 @@
1
+ export default [
2
+ "light",
3
+ "dark",
4
+ "cupcake",
5
+ "bumblebee",
6
+ "emerald",
7
+ "corporate",
8
+ "synthwave",
9
+ "retro",
10
+ "cyberpunk",
11
+ "valentine",
12
+ "halloween",
13
+ "garden",
14
+ "forest",
15
+ "aqua",
16
+ "lofi",
17
+ "pastel",
18
+ "fantasy",
19
+ "wireframe",
20
+ "black",
21
+ "luxury",
22
+ "dracula",
23
+ "cmyk",
24
+ "autumn",
25
+ "business",
26
+ "acid",
27
+ "lemonade",
28
+ "night",
29
+ "coffee",
30
+ "winter",
31
+ "dim",
32
+ "nord",
33
+ "sunset",
34
+ "caramellatte",
35
+ "abyss",
36
+ "silk",
37
+ ]
@@ -0,0 +1,29 @@
1
+ export default {
2
+ colors: {
3
+ "base-100": "var(--color-base-100)",
4
+ "base-200": "var(--color-base-200)",
5
+ "base-300": "var(--color-base-300)",
6
+ "base-content": "var(--color-base-content)",
7
+ primary: "var(--color-primary)",
8
+ "primary-content": "var(--color-primary-content)",
9
+ secondary: "var(--color-secondary)",
10
+ "secondary-content": "var(--color-secondary-content)",
11
+ accent: "var(--color-accent)",
12
+ "accent-content": "var(--color-accent-content)",
13
+ neutral: "var(--color-neutral)",
14
+ "neutral-content": "var(--color-neutral-content)",
15
+ info: "var(--color-info)",
16
+ "info-content": "var(--color-info-content)",
17
+ success: "var(--color-success)",
18
+ "success-content": "var(--color-success-content)",
19
+ warning: "var(--color-warning)",
20
+ "warning-content": "var(--color-warning-content)",
21
+ error: "var(--color-error)",
22
+ "error-content": "var(--color-error-content)",
23
+ },
24
+ borderRadius: {
25
+ selector: "var(--radius-selector)",
26
+ field: "var(--radius-field)",
27
+ box: "var(--radius-box)",
28
+ },
29
+ }
package/index.js ADDED
@@ -0,0 +1,61 @@
1
+ const version = ""
2
+ import { pluginOptionsHandler } from "./functions/pluginOptionsHandler.js"
3
+ import { plugin } from "./functions/plugin.js"
4
+ import variables from "./functions/variables.js"
5
+ import themesObject from "./theme/object.js"
6
+ import { base, components, utilities } from "./imports.js"
7
+
8
+ export default plugin.withOptions(
9
+ (options) => {
10
+ return ({ addBase, addComponents, addUtilities, addVariant }) => {
11
+ const {
12
+ include,
13
+ exclude,
14
+ prefix = "",
15
+ } = pluginOptionsHandler(options, addBase, themesObject, version)
16
+
17
+ const shouldIncludeItem = (name) => {
18
+ if (include && exclude) {
19
+ return include.includes(name) && !exclude.includes(name)
20
+ }
21
+ if (include) {
22
+ return include.includes(name)
23
+ }
24
+ if (exclude) {
25
+ return !exclude.includes(name)
26
+ }
27
+ return true
28
+ }
29
+
30
+ Object.entries(base).forEach(([name, item]) => {
31
+ if (!shouldIncludeItem(name)) return
32
+ item({ addBase, prefix })
33
+ })
34
+
35
+ Object.entries(components).forEach(([name, item]) => {
36
+ if (!shouldIncludeItem(name)) return
37
+ item({ addComponents, prefix })
38
+ })
39
+
40
+ Object.entries(utilities).forEach(([name, item]) => {
41
+ if (!shouldIncludeItem(name)) return
42
+ item({ addUtilities, prefix })
43
+ })
44
+
45
+ // drawer variants. Can not be nested in layers so defined here
46
+ addVariant(
47
+ `${prefix}is-drawer-close`,
48
+ `&:where(.${prefix}drawer-toggle:not(:checked) ~ .${prefix}drawer-side, .${prefix}drawer-toggle:not(:checked) ~ .${prefix}drawer-side *)`,
49
+ )
50
+ addVariant(
51
+ `${prefix}is-drawer-open`,
52
+ `&:where(.${prefix}drawer-toggle:checked ~ .${prefix}drawer-side, .${prefix}drawer-toggle:checked ~ .${prefix}drawer-side *)`,
53
+ )
54
+ }
55
+ },
56
+ () => ({
57
+ theme: {
58
+ extend: variables,
59
+ },
60
+ }),
61
+ )