vueless 0.0.489 → 0.0.490
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/plugin-vite.js +5 -5
- package/ui.image-icon/UIcon.vue +6 -15
- package/ui.loader/ULoader.vue +26 -28
- package/utils/node/loaderIcon.js +23 -16
- package/web-types.json +1 -1
package/package.json
CHANGED
package/plugin-vite.js
CHANGED
|
@@ -36,7 +36,7 @@ export const Vueless = function (options = {}) {
|
|
|
36
36
|
/* if server stopped by developer (Ctrl+C) */
|
|
37
37
|
process.on("SIGINT", async () => {
|
|
38
38
|
/* remove dynamically copied icons */
|
|
39
|
-
await removeIcons({ debug
|
|
39
|
+
await removeIcons({ debug });
|
|
40
40
|
|
|
41
41
|
/* clear tailwind safelist */
|
|
42
42
|
clearTailwindSafelist(debug);
|
|
@@ -63,22 +63,22 @@ export const Vueless = function (options = {}) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
if (config.command === "build") {
|
|
66
|
-
await removeIcons({ debug
|
|
66
|
+
await removeIcons({ debug });
|
|
67
67
|
|
|
68
68
|
/* dynamically copy used icons before build */
|
|
69
69
|
await copyIcons({ mode: "vuelessIcons", env, debug, targetFiles });
|
|
70
|
-
await copyIcons({ mode, env, debug, targetFiles
|
|
70
|
+
await copyIcons({ mode, env, debug, targetFiles });
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (config.command === "dev" || config.command === "serve") {
|
|
74
74
|
/* remove dynamically copied icons on dev server start */
|
|
75
|
-
await removeIcons({ debug
|
|
75
|
+
await removeIcons({ debug });
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
|
|
79
79
|
/* remove dynamically copied icons after build */
|
|
80
80
|
buildEnd: async () => {
|
|
81
|
-
await removeIcons({ debug
|
|
81
|
+
await removeIcons({ debug });
|
|
82
82
|
},
|
|
83
83
|
|
|
84
84
|
/* load SVG images as a Vue components */
|
package/ui.image-icon/UIcon.vue
CHANGED
|
@@ -127,21 +127,12 @@ const emit = defineEmits([
|
|
|
127
127
|
const { config, iconAttrs } = useAttrs(props);
|
|
128
128
|
|
|
129
129
|
const generatedIcons = computed(() => {
|
|
130
|
-
/**
|
|
131
|
-
* Use nuxt assets folders to include icons in final build.
|
|
132
|
-
* TODO: Find another way to include icons in build
|
|
133
|
-
*/
|
|
134
|
-
if (isSSR) {
|
|
135
|
-
return (
|
|
136
|
-
Object.entries(
|
|
137
|
-
import.meta.glob(`/assets/.vueless/icons/**/*.svg`, { eager: true, query: "?component" }),
|
|
138
|
-
) || []
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
130
|
return (
|
|
143
131
|
Object.entries(
|
|
144
|
-
import.meta.glob(
|
|
132
|
+
import.meta.glob(`/node_modules/.cache/vueless/assets/icons/**/*.svg`, {
|
|
133
|
+
eager: true,
|
|
134
|
+
query: "?component",
|
|
135
|
+
}),
|
|
145
136
|
) || []
|
|
146
137
|
);
|
|
147
138
|
});
|
|
@@ -185,8 +176,8 @@ const dynamicComponent = computed(() => {
|
|
|
185
176
|
return import.meta.env.PROD
|
|
186
177
|
? await getIcon([name])
|
|
187
178
|
: isSSR
|
|
188
|
-
? import(/* @vite-ignore */ `node_modules/vueless/assets/icons/${name}.svg?component`)
|
|
189
|
-
: import(/* @vite-ignore */
|
|
179
|
+
? import(/* @vite-ignore */ `node_modules/.cache/vueless/assets/icons/${name}.svg?component`)
|
|
180
|
+
: import(/* @vite-ignore */ `/node_modules/.cache/vueless/assets/icons/${name}.svg?component`);
|
|
190
181
|
},
|
|
191
182
|
"@material-symbols": async () => {
|
|
192
183
|
return import.meta.env.PROD
|
package/ui.loader/ULoader.vue
CHANGED
|
@@ -50,43 +50,41 @@ const { loaderAttrs, ellipseAttrs, config } = useAttrs(props);
|
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
52
|
<style scoped lang="postcss">
|
|
53
|
-
.vueless-loader-ellipse {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
53
|
+
.vueless-loader-ellipse:nth-child(1) {
|
|
54
|
+
animation: ellipse-1 0.6s infinite;
|
|
55
|
+
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
.vueless-loader-ellipse:nth-child(4) {
|
|
58
|
+
animation: ellipse-3 0.6s infinite;
|
|
59
|
+
}
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
.vueless-loader-ellipse-sm {
|
|
62
|
+
&:nth-child(2) {
|
|
63
|
+
animation: ellipse-2-sm 0.6s infinite;
|
|
64
|
+
}
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
66
|
+
&:nth-child(3) {
|
|
67
|
+
animation: ellipse-2-sm 0.6s infinite;
|
|
70
68
|
}
|
|
69
|
+
}
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
.vueless-loader-ellipse-md {
|
|
72
|
+
&:nth-child(2) {
|
|
73
|
+
animation: ellipse-2-md 0.6s infinite;
|
|
74
|
+
}
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
76
|
+
&:nth-child(3) {
|
|
77
|
+
animation: ellipse-2-md 0.6s infinite;
|
|
80
78
|
}
|
|
79
|
+
}
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
.vueless-loader-ellipse-lg {
|
|
82
|
+
&:nth-child(2) {
|
|
83
|
+
animation: ellipse-2-lg 0.6s infinite;
|
|
84
|
+
}
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
86
|
+
&:nth-child(3) {
|
|
87
|
+
animation: ellipse-2-lg 0.6s infinite;
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
|
package/utils/node/loaderIcon.js
CHANGED
|
@@ -18,8 +18,8 @@ import { getDirFiles, getDefaultConfigJson, merge } from "./helper.js";
|
|
|
18
18
|
import { CACHE_PATH, VUELESS_CONFIG_FILE_NAME } from "../../constants.js";
|
|
19
19
|
|
|
20
20
|
const ICONS_DIR = "assets/icons";
|
|
21
|
-
const
|
|
22
|
-
const
|
|
21
|
+
const DEFAULT_ICONS_DIR = path.join(process.cwd(), `node_modules/vueless/${ICONS_DIR}`);
|
|
22
|
+
const DEFAULT_ICONS_LOCAL_DIR = path.join(process.cwd(), `src/${ICONS_DIR}`);
|
|
23
23
|
const CACHED_ICONS_DIR = path.join(process.cwd(), `${CACHE_PATH}/${ICONS_DIR}`);
|
|
24
24
|
const ICON_CONFIG_PATH = "ui.image-icon/config.ts";
|
|
25
25
|
const ICON_COMPONENT_NAME = "UIcon";
|
|
@@ -33,21 +33,31 @@ let isVuelessIconsMode = false;
|
|
|
33
33
|
let cachedIconsDir = CACHED_ICONS_DIR;
|
|
34
34
|
|
|
35
35
|
// perform icons copy magick... ✨
|
|
36
|
-
export async function copyIcons({ mode = "", env, debug, targetFiles = []
|
|
36
|
+
export async function copyIcons({ mode = "", env, debug, targetFiles = [] } = {}) {
|
|
37
37
|
isDebug = debug || false;
|
|
38
38
|
isVuelessEnv = env === "vueless";
|
|
39
39
|
isDefaultMode = mode === "";
|
|
40
40
|
isStorybookMode = mode === "storybook";
|
|
41
41
|
isVuelessIconsMode = mode === "vuelessIcons";
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
/* Copy icons which using in vueless components to the cache (vueless env only). */
|
|
44
|
+
if (isVuelessEnv && fs.existsSync(DEFAULT_ICONS_LOCAL_DIR)) {
|
|
45
|
+
await cp(DEFAULT_ICONS_LOCAL_DIR, CACHED_ICONS_DIR, { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Copy icons which using in vueless components to the cache. */
|
|
49
|
+
if (!isVuelessEnv && fs.existsSync(DEFAULT_ICONS_DIR)) {
|
|
50
|
+
await cp(DEFAULT_ICONS_DIR, CACHED_ICONS_DIR, { recursive: true });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (isVuelessIconsMode && isVuelessEnv) cachedIconsDir = DEFAULT_ICONS_LOCAL_DIR;
|
|
44
54
|
if (isStorybookMode && isVuelessEnv) cachedIconsDir = CACHED_ICONS_DIR;
|
|
45
55
|
|
|
46
56
|
if (isStorybookMode) {
|
|
47
57
|
const storybookStoriesJs = await getDirFiles("src", STORYBOOK_STORY_EXTENSIONS[0]);
|
|
48
58
|
const storybookStoriesTs = await getDirFiles("src", STORYBOOK_STORY_EXTENSIONS[1]);
|
|
49
59
|
|
|
50
|
-
findAndCopyIcons([...storybookStoriesJs
|
|
60
|
+
findAndCopyIcons([...storybookStoriesJs, ...storybookStoriesTs]);
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
if (isVuelessIconsMode || isDefaultMode || isStorybookMode) {
|
|
@@ -69,23 +79,13 @@ export async function copyIcons({ mode = "", env, debug, targetFiles = [], isNux
|
|
|
69
79
|
`${VUELESS_CONFIG_FILE_NAME}.ts`,
|
|
70
80
|
]);
|
|
71
81
|
}
|
|
72
|
-
|
|
73
|
-
if (isNuxt) {
|
|
74
|
-
await cp(CACHED_ICONS_DIR, NUXT_ASSETS_DIR, {
|
|
75
|
-
recursive: true,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
export async function removeIcons({ debug
|
|
84
|
+
export async function removeIcons({ debug }) {
|
|
81
85
|
if (!fs.existsSync(cachedIconsDir)) return;
|
|
82
86
|
|
|
83
87
|
await rm(cachedIconsDir, { recursive: true, force: true });
|
|
84
88
|
|
|
85
|
-
if (isNuxt) {
|
|
86
|
-
await rm(NUXT_ASSETS_DIR, { recursive: true, force: true });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
89
|
if (debug) {
|
|
90
90
|
console.log("Dynamically copied icons was successfully removed.");
|
|
91
91
|
}
|
|
@@ -166,6 +166,13 @@ function findAndCopyIcons(files) {
|
|
|
166
166
|
function copyFile(name) {
|
|
167
167
|
name = name.toLowerCase();
|
|
168
168
|
|
|
169
|
+
const iconNameRegex = /^[a-z0-9_-]+$/;
|
|
170
|
+
|
|
171
|
+
/* Filter irrelevant icon name cases. */
|
|
172
|
+
if (!iconNameRegex.test(name)) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
169
176
|
const library = defaults.library;
|
|
170
177
|
const weight = defaults.weight;
|
|
171
178
|
const style = defaults.style;
|