-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolver.ts
More file actions
57 lines (52 loc) · 1.07 KB
/
resolver.ts
File metadata and controls
57 lines (52 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const componentNames = [
'ZPagination',
'ZAdaptiveIcon',
'ZButton',
'ZCheckbox',
'ZColorPicker',
'ZCommandCard',
'ZCommandTag',
'ZConfirmDialog',
'ZDetailPanel',
'ZDrawer',
'ZDrawerContent',
'ZModal',
'ZModalProvider',
'ZPopover',
'ZSelect',
'ZFeatureCard',
'ZHotkeyInput',
'ZInput',
'ZPluginDetail',
'ZRadio',
'ZShortcutEditor',
'ZSlider',
'ZSwitch',
'ZTab',
'ZTabPane',
'ZTabs',
'ZTag',
'ZTagDropdown',
'ZToast'
] as const
export type ZToolsUIComponentName = (typeof componentNames)[number]
export interface ZToolsUIResolverOptions {
importStyle?: boolean
}
export function ZToolsUIResolver(options: ZToolsUIResolverOptions = {}) {
const { importStyle = true } = options
const componentNameSet = new Set<string>(componentNames)
return {
type: 'component' as const,
resolve: (name: string) => {
if (!componentNameSet.has(name)) {
return undefined
}
return {
name,
from: 'ztools-ui',
sideEffects: importStyle ? 'ztools-ui/style.css' : undefined
}
}
}
}