exploria-ui 2026.3.2 → 2026.3.4
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/dist/components/navigation/ETabs/ETabPane.vue.d.ts +3 -3
- package/dist/components/navigation/ETabs/ETabs.vue.d.ts +2 -2
- package/dist/index.css +1 -1
- package/dist/packages/exploria-ui/src/components/navigation/ETabs/ETabPane.vue.js +1 -1
- package/dist/packages/exploria-ui/src/components/navigation/ETabs/ETabPane.vue_vue_type_script_setup_true_lang.js +11 -11
- package/dist/packages/exploria-ui/src/components/navigation/ETabs/ETabs.vue.js +1 -1
- package/dist/packages/exploria-ui/src/components/navigation/ETabs/ETabs.vue_vue_type_script_setup_true_lang.js +28 -23
- package/dist/packages/exploria-ui/src/utils/EDomUtil.js +23 -2
- package/dist/plugins/EPreloadImageBuilder.d.ts +5 -0
- package/dist/plugins/ESvgPolyfill.d.ts +3 -0
- package/dist/plugins/ESvgSpriteBuilder.d.ts +6 -0
- package/{src/plugins/index.ts → dist/plugins/index.d.ts} +0 -1
- package/dist/plugins/index.js +7487 -0
- package/package.json +2 -3
- package/src/plugins/EPreloadImageBuilder.ts +0 -66
- package/src/plugins/ESvgPolyfill.ts +0 -29
- package/src/plugins/ESvgSpriteBuilder.ts +0 -48
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exploria-ui",
|
|
3
3
|
"description": "《探索UI》组件库",
|
|
4
|
-
"version": "2026.3.
|
|
4
|
+
"version": "2026.3.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/components/index.js",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
],
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
-
"src/plugins",
|
|
19
18
|
"package.json",
|
|
20
19
|
"README.md"
|
|
21
20
|
],
|
|
@@ -70,7 +69,7 @@
|
|
|
70
69
|
},
|
|
71
70
|
"scripts": {
|
|
72
71
|
"build:watch": "vite build --watch",
|
|
73
|
-
"build:plugins:watch": "node ./scripts/build-plugins.ts
|
|
72
|
+
"build:plugins:watch": "node ./scripts/build-plugins.ts",
|
|
74
73
|
"pub": "pnpm publish --no-git-checks",
|
|
75
74
|
"type-check": "vue-tsc --noEmit"
|
|
76
75
|
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as fastGlob from 'fast-glob';
|
|
2
|
-
import type { Plugin } from 'vite';
|
|
3
|
-
|
|
4
|
-
const EPreloadImageBuilder = (options: {
|
|
5
|
-
pattern: string | string[];
|
|
6
|
-
}): Plugin => {
|
|
7
|
-
const { pattern } = options;
|
|
8
|
-
const _images: string[] = [];
|
|
9
|
-
return {
|
|
10
|
-
name: 'vite-plugin-preload-images',
|
|
11
|
-
apply: (_, { command }) => ['serve', 'build'].includes(command),
|
|
12
|
-
|
|
13
|
-
generateBundle(_, bundle) {
|
|
14
|
-
const assetsImages: string[] = [];
|
|
15
|
-
const publicImages: string[] = [];
|
|
16
|
-
fastGlob.sync(pattern).forEach((file) => {
|
|
17
|
-
if (file.includes('src/')) {
|
|
18
|
-
assetsImages.push(file.replace('./', ''));
|
|
19
|
-
} else if (file.includes('public/')) {
|
|
20
|
-
publicImages.push(file.replace('./', ''));
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const values = Object.values(bundle);
|
|
24
|
-
values.forEach((item) => {
|
|
25
|
-
if (
|
|
26
|
-
item.type === 'asset' &&
|
|
27
|
-
assetsImages.includes(item.originalFileNames[0])
|
|
28
|
-
) {
|
|
29
|
-
_images.push(item.fileName);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
for (const item of publicImages) {
|
|
34
|
-
_images.push(item.replace('public/', ''));
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
transformIndexHtml(_, ctx) {
|
|
39
|
-
let images: string[];
|
|
40
|
-
if (ctx.server) {
|
|
41
|
-
// 开发环境
|
|
42
|
-
const files = fastGlob.sync(pattern);
|
|
43
|
-
images = files.map(
|
|
44
|
-
(file) => (ctx.server!.config.base || '') + file
|
|
45
|
-
);
|
|
46
|
-
} else {
|
|
47
|
-
// 生产环境
|
|
48
|
-
images = _images;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return images.map((file) => {
|
|
52
|
-
return {
|
|
53
|
-
tag: 'link',
|
|
54
|
-
attrs: {
|
|
55
|
-
rel: 'preload',
|
|
56
|
-
href: file,
|
|
57
|
-
as: 'image',
|
|
58
|
-
fetchpriority: 'low',
|
|
59
|
-
},
|
|
60
|
-
injectTo: 'head',
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
export default EPreloadImageBuilder;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
|
|
3
|
-
// 修复 老旧浏览器 中 <use> 引用 <symbol> 时,因封闭影子 DOM 导致的 fill=“url(#*)” 失效问题
|
|
4
|
-
const ESvgPolyfill = (): Plugin => {
|
|
5
|
-
return {
|
|
6
|
-
name: 'vite-plugin-svg-polyfill',
|
|
7
|
-
// 仅在 serve 和 build 命令时生效
|
|
8
|
-
apply: (_, { command }) => ['serve', 'build'].includes(command),
|
|
9
|
-
transformIndexHtml(html) {
|
|
10
|
-
const code = `<script>
|
|
11
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
12
|
-
const defs = document.querySelectorAll('svg defs');
|
|
13
|
-
let globalDefsContent = '';
|
|
14
|
-
defs.forEach(def => {
|
|
15
|
-
globalDefsContent += def.innerHTML;
|
|
16
|
-
});
|
|
17
|
-
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
18
|
-
svg.class = 'global-svg-defs';
|
|
19
|
-
svg.style.cssText = 'position: fixed; width: 0; height: 0; visibility: hidden;';
|
|
20
|
-
svg.innerHTML = '<defs>'+globalDefsContent+'</defs>';
|
|
21
|
-
document.body.insertBefore(svg, document.body.firstChild);
|
|
22
|
-
});
|
|
23
|
-
</script>`;
|
|
24
|
-
return html.replace('</body>', `${code}</body>`);
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default ESvgPolyfill;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// ESvgSpriteBuilder.ts
|
|
2
|
-
import { readFileSync } from 'node:fs';
|
|
3
|
-
import { basename } from 'node:path';
|
|
4
|
-
|
|
5
|
-
import fastGlob from 'fast-glob';
|
|
6
|
-
import type { Plugin } from 'vite';
|
|
7
|
-
|
|
8
|
-
// 获取svgInnerContent
|
|
9
|
-
const getSvgInnerContent = (str: string): string | null => {
|
|
10
|
-
const regex = /<svg[^>]*>(.*?)<\/svg>/s; // 匹配带有任意属性的<svg>标签
|
|
11
|
-
const match = str.match(regex); // 执行匹配
|
|
12
|
-
return match ? match[1] : null; // 如果匹配成功,返回匹配的内容,否则返回 null
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const getSvgSymbols = (
|
|
16
|
-
pattern: string,
|
|
17
|
-
symbolId: (filename: string) => string
|
|
18
|
-
): string[] => {
|
|
19
|
-
const files = fastGlob.sync(pattern, {
|
|
20
|
-
cwd: process.cwd(),
|
|
21
|
-
});
|
|
22
|
-
return files.map((filePath) => {
|
|
23
|
-
const filename = basename(filePath, '.svg');
|
|
24
|
-
const svgContent = readFileSync(filePath, 'utf-8');
|
|
25
|
-
const innerContent = getSvgInnerContent(svgContent);
|
|
26
|
-
const viewBoxMatch = svgContent.match(/viewBox="([^"]*)"/);
|
|
27
|
-
const viewBox = viewBoxMatch ? viewBoxMatch[1] : '0 0 16 16';
|
|
28
|
-
return `<symbol id="${symbolId(filename)}" viewBox="${viewBox}">${innerContent}</symbol>`;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
const ESvgSpriteBuilder = (options: {
|
|
32
|
-
pattern: string;
|
|
33
|
-
symbolId: (filename: string) => string;
|
|
34
|
-
}): Plugin => {
|
|
35
|
-
const { pattern, symbolId } = options;
|
|
36
|
-
return {
|
|
37
|
-
name: 'vite-plugin-e-svg-sprite-builder',
|
|
38
|
-
apply: (_, { command }) => ['serve', 'build'].includes(command),
|
|
39
|
-
|
|
40
|
-
transformIndexHtml(html) {
|
|
41
|
-
// 只在首次调用时生成 SVG 内容
|
|
42
|
-
const symbols = getSvgSymbols(pattern, symbolId);
|
|
43
|
-
const svgHtml = `<svg xmlns="http://www.w3.org/2000/svg" style="position: fixed;">${symbols.join('')}</svg>`;
|
|
44
|
-
return html.replace('</body>', `${svgHtml}</body>`);
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export default ESvgSpriteBuilder;
|