File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
2
.DS_Store
3
3
dist
4
+ .idea
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ export * from './vant'
5
5
export * from './vuetify'
6
6
export * from './vueuse'
7
7
export * from './naive-ui'
8
+ export * from './varlet-ui'
Original file line number Diff line number Diff line change
1
+ import { ComponentResolver } from '../types'
2
+ import { kebabCase } from '../utils'
3
+
4
+ export interface VarletUIResolverOptions {
5
+ /**
6
+ * import css along with components
7
+ *
8
+ * @default true
9
+ */
10
+ importCss ?: boolean
11
+ /**
12
+ * import less along with components
13
+ *
14
+ * @default false
15
+ */
16
+ importLess ?: boolean
17
+ }
18
+
19
+ /**
20
+ * Resolver for VarletUI
21
+ *
22
+ * @link https://github.com/haoziqaq/varlet
23
+ */
24
+ export const VarletUIResolver = ( options : VarletUIResolverOptions = { } ) : ComponentResolver => ( name : string ) => {
25
+ const {
26
+ importCss = true ,
27
+ importLess
28
+ } = options
29
+ if ( name . startsWith ( 'Var' ) ) {
30
+ const partialName = name . slice ( 3 )
31
+ return {
32
+ importName : partialName ,
33
+ path : '@varlet/ui/es' ,
34
+ sideEffects : importLess
35
+ ? `@varlet/ui/es/${ kebabCase ( partialName ) } /style/less.js`
36
+ : importCss
37
+ ? `@varlet/ui/es/${ kebabCase ( partialName ) } /style`
38
+ : undefined
39
+ }
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments