vueless 0.0.743 → 0.0.744
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/package.json +1 -1
- package/ui.image-icon/UIcon.vue +13 -9
package/package.json
CHANGED
package/ui.image-icon/UIcon.vue
CHANGED
|
@@ -38,6 +38,7 @@ const generatedIcons = computed(() => {
|
|
|
38
38
|
|
|
39
39
|
const dynamicComponent = computed(() => {
|
|
40
40
|
const FILL_SUFFIX = "-fill";
|
|
41
|
+
const ICON_EXTENSION = ".svg";
|
|
41
42
|
|
|
42
43
|
const userLibrary = config.value.defaults.library as IconLibraries;
|
|
43
44
|
|
|
@@ -69,12 +70,15 @@ const dynamicComponent = computed(() => {
|
|
|
69
70
|
/* Dynamic import */
|
|
70
71
|
if (!name) return "";
|
|
71
72
|
|
|
72
|
-
function getIcon(params: (string | number)[]) {
|
|
73
|
+
function getIcon(name: string, params: (string | number)[] = []) {
|
|
74
|
+
// eslint-disable-next-line prettier/prettier
|
|
75
|
+
const iconName = isFill
|
|
76
|
+
? name + FILL_SUFFIX + ICON_EXTENSION
|
|
77
|
+
: name + ICON_EXTENSION;
|
|
78
|
+
|
|
73
79
|
const [, component] =
|
|
74
80
|
generatedIcons.value.find(([path]) =>
|
|
75
|
-
params.every(
|
|
76
|
-
(param) => (isFill || !path.includes(FILL_SUFFIX)) && path.includes(String(param)),
|
|
77
|
-
),
|
|
81
|
+
[iconName, ...params].every((param) => path.includes(String(param))),
|
|
78
82
|
) || [];
|
|
79
83
|
|
|
80
84
|
return component;
|
|
@@ -84,21 +88,21 @@ const dynamicComponent = computed(() => {
|
|
|
84
88
|
const libraries = {
|
|
85
89
|
"vueless": async () => {
|
|
86
90
|
return import.meta.env.PROD
|
|
87
|
-
? await getIcon(
|
|
91
|
+
? await getIcon(name)
|
|
88
92
|
: isSSR
|
|
89
93
|
? import(/* @vite-ignore */ `${VUELESS_ICONS_CACHED_DIR}/${VUELESS_LIBRARY}/${name}.svg?component`)
|
|
90
94
|
: import(/* @vite-ignore */ `/${VUELESS_ICONS_CACHED_DIR}/${VUELESS_LIBRARY}/${name}.svg?component`);
|
|
91
95
|
},
|
|
92
96
|
"@material-symbols": async () => {
|
|
93
97
|
return import.meta.env.PROD
|
|
94
|
-
? await getIcon([library, weight, style
|
|
98
|
+
? await getIcon(name, [library, weight, style])
|
|
95
99
|
: isSSR
|
|
96
100
|
? import(/* @vite-ignore */ `node_modules/${library}/svg-${weight}/${style}/${name}.svg?component`)
|
|
97
101
|
: import(/* @vite-ignore */ `/node_modules/${library}/svg-${weight}/${style}/${name}.svg?component`);
|
|
98
102
|
},
|
|
99
103
|
"bootstrap-icons": async () => {
|
|
100
104
|
return import.meta.env.PROD
|
|
101
|
-
? await getIcon([library
|
|
105
|
+
? await getIcon(name, [library])
|
|
102
106
|
: isSSR
|
|
103
107
|
? import(/* @vite-ignore */ `node_modules/${library}/icons/${name}.svg?component`)
|
|
104
108
|
: import(/* @vite-ignore */ `/node_modules/${library}/icons/${name}.svg?component`);
|
|
@@ -107,14 +111,14 @@ const dynamicComponent = computed(() => {
|
|
|
107
111
|
const fillType = isFill ? "solid" : "outline";
|
|
108
112
|
|
|
109
113
|
return import.meta.env.PROD
|
|
110
|
-
? await getIcon([library, fillType
|
|
114
|
+
? await getIcon(name, [library, fillType])
|
|
111
115
|
: isSSR
|
|
112
116
|
? import(/* @vite-ignore */ `node_modules/${library}/24/${fillType}/${name}.svg?component`)
|
|
113
117
|
: import(/* @vite-ignore */ `/node_modules/${library}/24/${fillType}/${name}.svg?component`);
|
|
114
118
|
},
|
|
115
119
|
"custom-icons": async () => {
|
|
116
120
|
return import.meta.env.PROD
|
|
117
|
-
? await getIcon([library
|
|
121
|
+
? await getIcon(name, [library])
|
|
118
122
|
: isSSR
|
|
119
123
|
? import(/* @vite-ignore */ `${customLibraryPath}/${name}.svg?component`)
|
|
120
124
|
: import(/* @vite-ignore */ `/${customLibraryPath}/${name}.svg?component`);
|