@witchcraft/ui 0.2.4 → 0.2.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.
package/dist/module.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import Icons from 'unplugin-icons/vite';
|
|
2
3
|
|
|
3
4
|
declare const knownDirectives: readonly ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"];
|
|
4
5
|
declare module "@nuxt/schema" {
|
|
@@ -8,15 +9,21 @@ declare module "@nuxt/schema" {
|
|
|
8
9
|
}
|
|
9
10
|
interface ModuleOptions {
|
|
10
11
|
/**
|
|
11
|
-
* Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults.
|
|
12
|
+
* Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults, i.e. prefix "i").
|
|
12
13
|
*
|
|
13
14
|
* @default true
|
|
14
15
|
*/
|
|
15
16
|
includeUnpluginIconsPlugins?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Pass options to unplugin-icons/nuxt
|
|
19
|
+
*
|
|
20
|
+
* The module doesn't define a key for it's options so this is the only way to allow proper merging.
|
|
21
|
+
*/
|
|
22
|
+
unpluginOptions?: Parameters<typeof Icons>[0];
|
|
16
23
|
directives: (typeof knownDirectives[number])[];
|
|
17
24
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
* Which components (without a prefix) to register for auto-importing globally.
|
|
26
|
+
*/
|
|
20
27
|
globalComponents: string[];
|
|
21
28
|
/**
|
|
22
29
|
* @default "W"
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { indent, crop } from '@alanscodelog/utils';
|
|
2
|
-
import { createResolver, defineNuxtModule, useLogger, addTemplate, addComponent, addImports, addTypeTemplate } from '@nuxt/kit';
|
|
2
|
+
import { createResolver, defineNuxtModule, installModule, useLogger, addTemplate, addComponent, addImports, addTypeTemplate } from '@nuxt/kit';
|
|
3
3
|
import tailwindcss from '@tailwindcss/vite';
|
|
4
4
|
import { addImportsCustom } from '@witchcraft/nuxt-utils/utils/addImportsCustom';
|
|
5
5
|
import { globFiles } from '@witchcraft/nuxt-utils/utils/globFiles';
|
|
@@ -13,8 +13,7 @@ import { themeConvertionOpts } from '../dist/runtime/tailwind/themeConvertionOpt
|
|
|
13
13
|
import { theme } from '../dist/runtime/theme.js';
|
|
14
14
|
|
|
15
15
|
const dependencies = {
|
|
16
|
-
"reka-ui": "^2.5.0"
|
|
17
|
-
"unplugin-icons": "^22.2.0"};
|
|
16
|
+
"reka-ui": "^2.5.0"};
|
|
18
17
|
const pkg = {
|
|
19
18
|
dependencies: dependencies};
|
|
20
19
|
|
|
@@ -35,6 +34,7 @@ const module = defineNuxtModule({
|
|
|
35
34
|
},
|
|
36
35
|
defaults: {
|
|
37
36
|
includeUnpluginIconsPlugins: true,
|
|
37
|
+
unpluginOptions: unpluginIconViteOptions,
|
|
38
38
|
directives: [...knownDirectives],
|
|
39
39
|
globalComponents: [
|
|
40
40
|
...componentsInfo.map((_) => _.name.slice("PREFIX".length))
|
|
@@ -45,16 +45,20 @@ const module = defineNuxtModule({
|
|
|
45
45
|
_playgroundWorkaround: false
|
|
46
46
|
},
|
|
47
47
|
moduleDependencies: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
// not working, see note for unpluginOptions
|
|
49
|
+
// "unplugin-icons/nuxt": {
|
|
50
|
+
// version: pkg.dependencies["unplugin-icons"],
|
|
51
|
+
// defaults: unpluginIconViteOptions as any
|
|
52
|
+
// },
|
|
52
53
|
"reka-ui/nuxt": {
|
|
53
54
|
version: pkg.dependencies["reka-ui"]
|
|
54
55
|
}
|
|
55
56
|
},
|
|
56
57
|
async setup(options, nuxt) {
|
|
57
58
|
const moduleName = "@witchcraft/ui";
|
|
59
|
+
installModule("unplugin-icons/nuxt", defu(
|
|
60
|
+
options.unpluginOptions
|
|
61
|
+
));
|
|
58
62
|
const logger = useLogger(moduleName, { level: options.debug ? 10 : 0 });
|
|
59
63
|
const filteredComponentsInfo = [];
|
|
60
64
|
for (const component of componentsInfo) {
|
|
@@ -121,6 +125,7 @@ const module = defineNuxtModule({
|
|
|
121
125
|
IconsResolver({ prefix: "i" })
|
|
122
126
|
]
|
|
123
127
|
})
|
|
128
|
+
// this is taken care of by unplugin-icons
|
|
124
129
|
// Icons({
|
|
125
130
|
// compiler: "vue3",
|
|
126
131
|
// ...unpluginIconViteOptions,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
text-fg
|
|
20
20
|
hover:text-accent-700
|
|
21
21
|
dark:text-bg
|
|
22
|
-
dark:hover:text-accent-
|
|
22
|
+
dark:hover:text-accent-400
|
|
23
23
|
dark:disabled:text-neutral-500
|
|
24
24
|
dark:disabled:hover:text-neutral-500
|
|
25
25
|
`,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
border && `
|
|
28
28
|
transition-all
|
|
29
29
|
bg-neutral-100
|
|
30
|
-
dark:bg-neutral-
|
|
30
|
+
dark:bg-neutral-800
|
|
31
31
|
shadow-[0_1px_1px_0]
|
|
32
32
|
shadow-neutral-950/20
|
|
33
33
|
hover:shadow-[0_1px_3px_0]
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
dark:hover:border-neutral-800
|
|
37
37
|
relative
|
|
38
38
|
after:absolute
|
|
39
|
-
after:rounded-
|
|
39
|
+
after:rounded-sm
|
|
40
40
|
after:inset-0
|
|
41
41
|
after:content
|
|
42
42
|
after:shadow-[0_1px_0_0_inset]
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
border-neutral-300
|
|
54
54
|
disabled:border-neutral-200
|
|
55
55
|
disabled:bg-neutral-50
|
|
56
|
-
dark:hover:shadow-
|
|
56
|
+
dark:hover:shadow-neutral-950/70
|
|
57
57
|
dark:active:shadow-fg/40
|
|
58
58
|
dark:active:border-neutral-900
|
|
59
59
|
dark:border-neutral-900
|
package/package.json
CHANGED
package/src/module.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
addImports, addTemplate, addTypeTemplate,
|
|
5
5
|
createResolver,
|
|
6
6
|
defineNuxtModule,
|
|
7
|
+
installModule,
|
|
7
8
|
useLogger
|
|
8
9
|
} from "@nuxt/kit"
|
|
9
10
|
import tailwindcss from "@tailwindcss/vite"
|
|
@@ -13,6 +14,7 @@ import { defu } from "defu"
|
|
|
13
14
|
import { themeAsTailwindCss } from "metamorphosis/tailwind"
|
|
14
15
|
import fs from "node:fs"
|
|
15
16
|
import IconsResolver from "unplugin-icons/resolver"
|
|
17
|
+
import type Icons from "unplugin-icons/vite"
|
|
16
18
|
import ViteComponents from "unplugin-vue-components/vite"
|
|
17
19
|
|
|
18
20
|
import { unpluginIconViteOptions } from "./runtime/build/unpluginIconViteOptions.js"
|
|
@@ -45,16 +47,24 @@ declare module "@nuxt/schema" {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
export interface ModuleOptions {
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults, i.e. prefix "i").
|
|
52
|
+
*
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
53
55
|
includeUnpluginIconsPlugins?: boolean
|
|
56
|
+
/**
|
|
57
|
+
* Pass options to unplugin-icons/nuxt
|
|
58
|
+
*
|
|
59
|
+
* The module doesn't define a key for it's options so this is the only way to allow proper merging.
|
|
60
|
+
*/
|
|
61
|
+
// also moduleDependencies + defaults (or even overrides) isn't working, hence the use of the deprecated installModule
|
|
62
|
+
// I think this is due to how the module is defined (without a key)
|
|
63
|
+
unpluginOptions?: Parameters<typeof Icons>[0]
|
|
54
64
|
directives: (typeof knownDirectives[number])[]
|
|
55
65
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
* Which components (without a prefix) to register for auto-importing globally.
|
|
67
|
+
*/
|
|
58
68
|
globalComponents: string[]
|
|
59
69
|
/**
|
|
60
70
|
* @default "W"
|
|
@@ -76,6 +86,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
76
86
|
},
|
|
77
87
|
defaults: {
|
|
78
88
|
includeUnpluginIconsPlugins: true,
|
|
89
|
+
unpluginOptions: unpluginIconViteOptions,
|
|
79
90
|
directives: [...knownDirectives],
|
|
80
91
|
globalComponents: [
|
|
81
92
|
...componentsInfo.map(_ => _.name.slice("PREFIX".length))
|
|
@@ -86,16 +97,21 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
86
97
|
_playgroundWorkaround: false
|
|
87
98
|
},
|
|
88
99
|
moduleDependencies: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
// not working, see note for unpluginOptions
|
|
101
|
+
// "unplugin-icons/nuxt": {
|
|
102
|
+
// version: pkg.dependencies["unplugin-icons"],
|
|
103
|
+
// defaults: unpluginIconViteOptions as any
|
|
104
|
+
// },
|
|
93
105
|
"reka-ui/nuxt": {
|
|
94
106
|
version: pkg.dependencies["reka-ui"]
|
|
95
107
|
}
|
|
96
108
|
},
|
|
97
109
|
async setup(options, nuxt) {
|
|
98
110
|
const moduleName = "@witchcraft/ui"
|
|
111
|
+
// see note for unpluginOptions
|
|
112
|
+
installModule("unplugin-icons/nuxt", defu(
|
|
113
|
+
options.unpluginOptions
|
|
114
|
+
))
|
|
99
115
|
const logger = useLogger(moduleName, { level: options.debug ? 10 : 0 })
|
|
100
116
|
|
|
101
117
|
const filteredComponentsInfo: typeof componentsInfo = []
|
|
@@ -173,6 +189,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
173
189
|
IconsResolver({ prefix: "i" })
|
|
174
190
|
]
|
|
175
191
|
})
|
|
192
|
+
// this is taken care of by unplugin-icons
|
|
176
193
|
// Icons({
|
|
177
194
|
// compiler: "vue3",
|
|
178
195
|
// ...unpluginIconViteOptions,
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
text-fg
|
|
19
19
|
hover:text-accent-700
|
|
20
20
|
dark:text-bg
|
|
21
|
-
dark:hover:text-accent-
|
|
21
|
+
dark:hover:text-accent-400
|
|
22
22
|
dark:disabled:text-neutral-500
|
|
23
23
|
dark:disabled:hover:text-neutral-500
|
|
24
24
|
`,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
border && `
|
|
27
27
|
transition-all
|
|
28
28
|
bg-neutral-100
|
|
29
|
-
dark:bg-neutral-
|
|
29
|
+
dark:bg-neutral-800
|
|
30
30
|
shadow-[0_1px_1px_0]
|
|
31
31
|
shadow-neutral-950/20
|
|
32
32
|
hover:shadow-[0_1px_3px_0]
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
dark:hover:border-neutral-800
|
|
36
36
|
relative
|
|
37
37
|
after:absolute
|
|
38
|
-
after:rounded-
|
|
38
|
+
after:rounded-sm
|
|
39
39
|
after:inset-0
|
|
40
40
|
after:content
|
|
41
41
|
after:shadow-[0_1px_0_0_inset]
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
border-neutral-300
|
|
53
53
|
disabled:border-neutral-200
|
|
54
54
|
disabled:bg-neutral-50
|
|
55
|
-
dark:hover:shadow-
|
|
55
|
+
dark:hover:shadow-neutral-950/70
|
|
56
56
|
dark:active:shadow-fg/40
|
|
57
57
|
dark:active:border-neutral-900
|
|
58
58
|
dark:border-neutral-900
|