Skip to content

Commit 23cd85a

Browse files
committed
feat: add view-ui-plus resolver
1 parent a184a0a commit 23cd85a

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

src/core/resolvers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from './vant'
1010
export * from './varlet-ui'
1111
export * from './veui'
1212
export * from './view-ui'
13+
export * from './view-ui-plus'
1314
export * from './vuetify'
1415
export * from './vueuse'
1516
export * from './quasar'

src/core/resolvers/view-ui-plus.ts

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
import type { ComponentResolveResult, ComponentResolver } from '../../types'
2+
3+
export interface ViewUIPlusResolverOptions {
4+
/**
5+
* import style
6+
* @default 'css'
7+
*/
8+
importStyle?: boolean | 'css' | 'less'
9+
}
10+
11+
function getResolved(name: string, options: ViewUIPlusResolverOptions): ComponentResolveResult {
12+
const { importStyle = 'css' } = options
13+
const path = 'view-ui-plus'
14+
const sideEffects: string[] = [
15+
'js-calendar',
16+
'numeral',
17+
'tinycolor2',
18+
'dayjs',
19+
'popper.js',
20+
'js-calendar',
21+
'countup.js',
22+
'lodash.chunk',
23+
'lodash.throttle',
24+
'element-resize-detector',
25+
'popper.js/dist/umd/popper.js',
26+
]
27+
28+
if (importStyle) {
29+
sideEffects.push(
30+
importStyle === 'less'
31+
? `${path}/src/styles/index.less`
32+
: `${path}/dist/styles/viewuiplus.css`,
33+
)
34+
}
35+
36+
return {
37+
name,
38+
from: `${path}/src`,
39+
sideEffects,
40+
}
41+
}
42+
43+
/**
44+
* Resolver for view-ui-plus
45+
*/
46+
export function ViewUIPlusResolver(options: ViewUIPlusResolverOptions = {}): ComponentResolver[] {
47+
return [
48+
{
49+
type: 'component',
50+
resolve: (name: string) => {
51+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
52+
if (usedComponents.includes(name))
53+
return getResolved(name, options)
54+
},
55+
},
56+
]
57+
}
58+
59+
const usedComponents: string[] = [
60+
'Affix',
61+
'Alert',
62+
'Anchor',
63+
'AnchorLink',
64+
'Auth',
65+
'AutoComplete',
66+
'Avatar',
67+
'AvatarList',
68+
'BackTop',
69+
'Badge',
70+
'Breadcrumb',
71+
'BreadcrumbItem',
72+
'Button',
73+
'ButtonGroup',
74+
'Calendar',
75+
'Captcha',
76+
'Card',
77+
'Carousel',
78+
'CarouselItem',
79+
'Cascader',
80+
'Cell',
81+
'CellGroup',
82+
'Checkbox',
83+
'CheckboxGroup',
84+
'Circle',
85+
'City',
86+
'Col',
87+
'Collapse',
88+
'ColorPicker',
89+
'Content',
90+
'CountDown',
91+
'CountUp',
92+
'DatePicker',
93+
'Description',
94+
'DescriptionList',
95+
'Divider',
96+
'Drawer',
97+
'Dropdown',
98+
'DropdownItem',
99+
'DropdownMenu',
100+
'Ellipsis',
101+
'Email',
102+
'Exception',
103+
'Footer',
104+
'FooterToolbar',
105+
'Form',
106+
'FormItem',
107+
'GlobalFooter',
108+
'Grid',
109+
'GridItem',
110+
'Header',
111+
'Icon',
112+
'Input',
113+
'InputNumber',
114+
'Layout',
115+
'List',
116+
'ListItem',
117+
'ListItemMeta',
118+
'LoadingBar',
119+
'Login',
120+
'Menu',
121+
'MenuGroup',
122+
'MenuItem',
123+
'Message',
124+
'Mobile',
125+
'Modal',
126+
'Notice',
127+
'Notification',
128+
'NotificationItem',
129+
'NotificationTab',
130+
'NumberInfo',
131+
'Numeral',
132+
'Option',
133+
'OptionGroup',
134+
'Page',
135+
'PageHeader',
136+
'Panel',
137+
'Password',
138+
'Poptip',
139+
'Progress',
140+
'Radio',
141+
'RadioGroup',
142+
'Rate',
143+
'Result',
144+
'Row',
145+
'Scroll',
146+
'Select',
147+
'Sider',
148+
'Slider',
149+
'Spin',
150+
'Split',
151+
'Step',
152+
'Steps',
153+
'Submenu',
154+
'Submit',
155+
'Switch',
156+
'Table',
157+
'TablePaste',
158+
'TabPane',
159+
'Tabs',
160+
'Tag',
161+
'TagSelect',
162+
'TagSelectOption',
163+
'Time',
164+
'Timeline',
165+
'TimelineItem',
166+
'TimePicker',
167+
'Tooltip',
168+
'Transfer',
169+
'Tree',
170+
'TreeSelect',
171+
'Trend',
172+
'Upload',
173+
'UserName',
174+
'WordCount',
175+
]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy