@melt-js/libs-vben 0.0.0-stage → 2026.11.8-2
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/LICENSE +10 -0
- package/README.md +86 -2
- package/package.json +98 -3
- package/src/access/access-control.vue +47 -0
- package/src/access/accessible.ts +236 -0
- package/src/access/directive.ts +42 -0
- package/src/access/index.ts +4 -0
- package/src/access/use-access.ts +53 -0
- package/src/composables/index.ts +14 -0
- package/src/composables/use-is-mobile.ts +7 -0
- package/src/composables/use-layout-style.ts +51 -0
- package/src/composables/use-layout-viewport-height.ts +71 -0
- package/src/composables/use-namespace.ts +106 -0
- package/src/composables/use-priority-value.ts +96 -0
- package/src/composables/use-scroll-lock.ts +151 -0
- package/src/composables/use-simple-locale/README.md +3 -0
- package/src/composables/use-simple-locale/index.ts +27 -0
- package/src/composables/use-simple-locale/messages.ts +31 -0
- package/src/composables/use-sortable.ts +32 -0
- package/src/constants/core.ts +76 -0
- package/src/constants/index.ts +2 -0
- package/src/core-icons/create-icon.ts +14 -0
- package/src/core-icons/index.ts +11 -0
- package/src/core-icons/lucide.ts +95 -0
- package/src/core-preferences/config.ts +172 -0
- package/src/core-preferences/constants.ts +116 -0
- package/src/core-preferences/index.ts +24 -0
- package/src/core-preferences/preferences.ts +503 -0
- package/src/core-preferences/types.ts +471 -0
- package/src/core-preferences/update-css-variables.ts +129 -0
- package/src/core-preferences/use-preferences.ts +282 -0
- package/src/design/css/global.css +1 -0
- package/src/design/css/nprogress.css +61 -0
- package/src/design/css/transition.css +238 -0
- package/src/design/css/ui.css +101 -0
- package/src/design/design-tokens/dark.css +446 -0
- package/src/design/design-tokens/default.css +491 -0
- package/src/design/design-tokens/index.ts +2 -0
- package/src/design/index.ts +6 -0
- package/src/design/scss-bem/bem.scss +34 -0
- package/src/design/scss-bem/constants.scss +5 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/use-app-config.ts +39 -0
- package/src/hooks/use-content-maximize.ts +24 -0
- package/src/hooks/use-design-tokens.ts +421 -0
- package/src/hooks/use-hover-toggle.ts +163 -0
- package/src/hooks/use-pagination.ts +72 -0
- package/src/hooks/use-refresh.ts +16 -0
- package/src/hooks/use-tabs.ts +143 -0
- package/src/hooks/use-watermark.ts +84 -0
- package/src/icons/iconify/index.ts +5 -0
- package/src/icons/icons/empty-icon.vue +27 -0
- package/src/icons/index.ts +3 -0
- package/src/icons/svg/icons/antdv-logo.svg +29 -0
- package/src/icons/svg/icons/antdv-next-logo.svg +1 -0
- package/src/icons/svg/icons/avatar-1.svg +1 -0
- package/src/icons/svg/icons/avatar-2.svg +1 -0
- package/src/icons/svg/icons/avatar-3.svg +1 -0
- package/src/icons/svg/icons/avatar-4.svg +1 -0
- package/src/icons/svg/icons/bell.svg +1 -0
- package/src/icons/svg/icons/cake.svg +1 -0
- package/src/icons/svg/icons/card.svg +1 -0
- package/src/icons/svg/icons/dingding.svg +1 -0
- package/src/icons/svg/icons/download.svg +1 -0
- package/src/icons/svg/icons/github.svg +1 -0
- package/src/icons/svg/icons/google.svg +1 -0
- package/src/icons/svg/icons/qqchat.svg +1 -0
- package/src/icons/svg/icons/tdesign-logo.svg +39 -0
- package/src/icons/svg/icons/wechat.svg +1 -0
- package/src/icons/svg/index.ts +39 -0
- package/src/icons/svg/load.ts +81 -0
- package/src/locales/i18n.ts +147 -0
- package/src/locales/index.ts +30 -0
- package/src/locales/langs/en-US/authentication.json +65 -0
- package/src/locales/langs/en-US/common.json +27 -0
- package/src/locales/langs/en-US/preferences.json +245 -0
- package/src/locales/langs/en-US/profile.json +4 -0
- package/src/locales/langs/en-US/ui.json +165 -0
- package/src/locales/langs/zh-CN/authentication.json +65 -0
- package/src/locales/langs/zh-CN/common.json +27 -0
- package/src/locales/langs/zh-CN/preferences.json +245 -0
- package/src/locales/langs/zh-CN/profile.json +4 -0
- package/src/locales/langs/zh-CN/ui.json +165 -0
- package/src/locales/langs/zh-TW/authentication.json +65 -0
- package/src/locales/langs/zh-TW/common.json +27 -0
- package/src/locales/langs/zh-TW/preferences.json +245 -0
- package/src/locales/langs/zh-TW/profile.json +4 -0
- package/src/locales/langs/zh-TW/ui.json +165 -0
- package/src/locales/typing.ts +27 -0
- package/src/preferences/index.ts +42 -0
- package/src/request/index.ts +2 -0
- package/src/request/request-client/index.ts +3 -0
- package/src/request/request-client/modules/downloader.ts +60 -0
- package/src/request/request-client/modules/interceptor.ts +40 -0
- package/src/request/request-client/modules/sse.ts +134 -0
- package/src/request/request-client/modules/uploader.ts +79 -0
- package/src/request/request-client/preset-interceptors.ts +178 -0
- package/src/request/request-client/request-client.ts +163 -0
- package/src/request/request-client/types.ts +90 -0
- package/src/shared/cache/README.md +418 -0
- package/src/shared/cache/index.ts +5 -0
- package/src/shared/cache/indexeddb-driver.ts +137 -0
- package/src/shared/cache/local-storage-driver.ts +70 -0
- package/src/shared/cache/memory-storage-driver.ts +32 -0
- package/src/shared/cache/storage-manager.ts +146 -0
- package/src/shared/cache/types.ts +39 -0
- package/src/shared/color/color.ts +9 -0
- package/src/shared/color/convert.ts +62 -0
- package/src/shared/color/generator.ts +45 -0
- package/src/shared/color/index.ts +3 -0
- package/src/shared/constants/globals.ts +20 -0
- package/src/shared/constants/index.ts +2 -0
- package/src/shared/constants/vben.ts +30 -0
- package/src/shared/global-state.ts +45 -0
- package/src/shared/store.ts +1 -0
- package/src/shared/utils/cn.ts +10 -0
- package/src/shared/utils/date.ts +80 -0
- package/src/shared/utils/diff.ts +114 -0
- package/src/shared/utils/dom.ts +126 -0
- package/src/shared/utils/download.ts +186 -0
- package/src/shared/utils/error.ts +19 -0
- package/src/shared/utils/index.ts +22 -0
- package/src/shared/utils/inference.ts +164 -0
- package/src/shared/utils/letter.ts +47 -0
- package/src/shared/utils/merge.ts +11 -0
- package/src/shared/utils/nprogress.ts +52 -0
- package/src/shared/utils/resources.ts +21 -0
- package/src/shared/utils/stack.ts +103 -0
- package/src/shared/utils/state-handler.ts +61 -0
- package/src/shared/utils/to.ts +21 -0
- package/src/shared/utils/tree.ts +159 -0
- package/src/shared/utils/unique.ts +15 -0
- package/src/shared/utils/update-css-variables.ts +47 -0
- package/src/shared/utils/util.ts +50 -0
- package/src/shared/utils/window.ts +37 -0
- package/src/stores/index.ts +3 -0
- package/src/stores/modules/access.ts +130 -0
- package/src/stores/modules/dict.ts +244 -0
- package/src/stores/modules/index.ts +5 -0
- package/src/stores/modules/tabbar.ts +797 -0
- package/src/stores/modules/timezone.ts +132 -0
- package/src/stores/modules/user.ts +42 -0
- package/src/stores/setup.ts +79 -0
- package/src/stores/shim-pinia.d.ts +11 -0
- package/src/styles/antd/index.css +78 -0
- package/src/styles/antdv-next/index.css +90 -0
- package/src/styles/ele/index.css +44 -0
- package/src/styles/global/index.scss +1 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/naive/index.css +26 -0
- package/src/styles/style-exports.d.ts +3 -0
- package/src/theme.css +592 -0
- package/src/types/global.d.ts +28 -0
- package/src/types/index.ts +2 -0
- package/src/types/shims.d.ts +1 -0
- package/src/types/user.ts +20 -0
- package/src/typings/app.d.ts +128 -0
- package/src/typings/basic.d.ts +42 -0
- package/src/typings/helper.d.ts +147 -0
- package/src/typings/index.ts +16 -0
- package/src/typings/languages.ts +28 -0
- package/src/typings/menu-record.ts +82 -0
- package/src/typings/tabs.ts +8 -0
- package/src/typings/vue-router.d.ts +169 -0
- package/src/utils/helpers/find-menu-by-path.ts +37 -0
- package/src/utils/helpers/generate-menus.ts +89 -0
- package/src/utils/helpers/generate-routes-backend.ts +108 -0
- package/src/utils/helpers/generate-routes-frontend.ts +58 -0
- package/src/utils/helpers/get-popup-container.ts +10 -0
- package/src/utils/helpers/index.ts +8 -0
- package/src/utils/helpers/merge-route-modules.ts +28 -0
- package/src/utils/helpers/reset-routes.ts +30 -0
- package/src/utils/helpers/unmount-global-loading.ts +31 -0
- package/src/utils/index.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="200" height="200"><path d="M511.09761 957.257c-80.159 0-153.737-25.019-201.11-62.386-24.057 6.702-54.831 17.489-74.252 30.864-16.617 11.439-14.546 23.106-11.55 27.816 13.15 20.689 225.583 13.211 286.912 6.767v-3.061z" fill="#FAAD08"/><path d="M496.65061 957.257c80.157 0 153.737-25.019 201.11-62.386 24.057 6.702 54.83 17.489 74.253 30.864 16.616 11.439 14.543 23.106 11.55 27.816-13.15 20.689-225.584 13.211-286.914 6.767v-3.061z" fill="#FAAD08"/><path d="M497.12861 474.524c131.934-0.876 237.669-25.783 273.497-35.34 8.541-2.28 13.11-6.364 13.11-6.364 0.03-1.172 0.542-20.952 0.542-31.155C784.27761 229.833 701.12561 57.173 496.64061 57.162 292.15661 57.173 209.00061 229.832 209.00061 401.665c0 10.203 0.516 29.983 0.547 31.155 0 0 3.717 3.821 10.529 5.67 33.078 8.98 140.803 35.139 276.08 36.034h0.972z" fill="#000000"/><path d="M860.28261 619.782c-8.12-26.086-19.204-56.506-30.427-85.72 0 0-6.456-0.795-9.718 0.148-100.71 29.205-222.773 47.818-315.792 46.695h-0.962C410.88561 582.017 289.65061 563.617 189.27961 534.698 185.44461 533.595 177.87261 534.063 177.87261 534.063 166.64961 563.276 155.56661 593.696 147.44761 619.782 108.72961 744.168 121.27261 795.644 130.82461 796.798c20.496 2.474 79.78-93.637 79.78-93.637 0 97.66 88.324 247.617 290.576 248.996a718.01 718.01 0 0 1 5.367 0C708.80161 950.778 797.12261 800.822 797.12261 703.162c0 0 59.284 96.111 79.783 93.637 9.55-1.154 22.093-52.63-16.623-177.017" fill="#000000"/><path d="M434.38261 316.917c-27.9 1.24-51.745-30.106-53.24-69.956-1.518-39.877 19.858-73.207 47.764-74.454 27.875-1.224 51.703 30.109 53.218 69.974 1.527 39.877-19.853 73.2-47.742 74.436m206.67-69.956c-1.494 39.85-25.34 71.194-53.24 69.956-27.888-1.238-49.269-34.559-47.742-74.435 1.513-39.868 25.341-71.201 53.216-69.974 27.909 1.247 49.285 34.576 47.767 74.453" fill="#FFFFFF"/><path d="M683.94261 368.627c-7.323-17.609-81.062-37.227-172.353-37.227h-0.98c-91.29 0-165.031 19.618-172.352 37.227a6.244 6.244 0 0 0-0.535 2.505c0 1.269 0.393 2.414 1.006 3.386 6.168 9.765 88.054 58.018 171.882 58.018h0.98c83.827 0 165.71-48.25 171.881-58.016a6.352 6.352 0 0 0 1.002-3.395c0-0.897-0.2-1.736-0.531-2.498" fill="#FAAD08"/><path d="M467.63161 256.377c1.26 15.886-7.377 30-19.266 31.542-11.907 1.544-22.569-10.083-23.836-25.978-1.243-15.895 7.381-30.008 19.25-31.538 11.927-1.549 22.607 10.088 23.852 25.974m73.097 7.935c2.533-4.118 19.827-25.77 55.62-17.886 9.401 2.07 13.75 5.116 14.668 6.316 1.355 1.77 1.726 4.29 0.352 7.684-2.722 6.725-8.338 6.542-11.454 5.226-2.01-0.85-26.94-15.889-49.905 6.553-1.579 1.545-4.405 2.074-7.085 0.242-2.678-1.834-3.786-5.553-2.196-8.135" fill="#000000"/><path d="M504.33261 584.495h-0.967c-63.568 0.752-140.646-7.504-215.286-21.92-6.391 36.262-10.25 81.838-6.936 136.196 8.37 137.384 91.62 223.736 220.118 224.996H506.48461c128.498-1.26 211.748-87.612 220.12-224.996 3.314-54.362-0.547-99.938-6.94-136.203-74.654 14.423-151.745 22.684-215.332 21.927" fill="#FFFFFF"/><path d="M323.27461 577.016v137.468s64.957 12.705 130.031 3.91V591.59c-41.225-2.262-85.688-7.304-130.031-14.574" fill="#EB1C26"/><path d="M788.09761 432.536s-121.98 40.387-283.743 41.539h-0.962c-161.497-1.147-283.328-41.401-283.744-41.539l-40.854 106.952c102.186 32.31 228.837 53.135 324.598 51.926l0.96-0.002c95.768 1.216 222.4-19.61 324.6-51.924l-40.855-106.952z" fill="#EB1C26"/></svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<rect id="b1" x="0" y="0" width="32" height="32" style="fill:none;"/>
|
|
5
|
+
<g id="b11" serif:id="b1">
|
|
6
|
+
<g>
|
|
7
|
+
<g transform="matrix(1.155236,0,0,1.133743,3.49525,-0.501586)">
|
|
8
|
+
<path d="M7.972,26.181L3.28,26.181C3.203,26.181 3.126,26.165 3.055,26.132C2.984,26.1 2.921,26.053 2.87,25.994C2.819,25.936 2.782,25.867 2.76,25.792C2.737,25.718 2.732,25.639 2.742,25.562L3.656,20.403L9.441,20.403L8.498,25.748C8.473,25.869 8.407,25.978 8.311,26.057C8.216,26.136 8.096,26.18 7.972,26.181Z" style="fill:rgb(0,155,255);fill-rule:nonzero;"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="matrix(1.155236,0,0,1.133743,3.49525,-0.501586)">
|
|
11
|
+
<clipPath id="_clip1">
|
|
12
|
+
<path d="M21.178,8.787L5.698,8.787L6.716,3.002L21.988,3.002C22.071,2.994 22.156,3.006 22.234,3.037C22.312,3.067 22.382,3.115 22.439,3.178C22.495,3.24 22.536,3.315 22.558,3.396C22.58,3.477 22.583,3.562 22.566,3.645L21.71,8.353C21.687,8.477 21.621,8.588 21.523,8.667C21.426,8.747 21.303,8.789 21.178,8.787Z" clip-rule="nonzero"/>
|
|
13
|
+
</clipPath>
|
|
14
|
+
<g clip-path="url(#_clip1)">
|
|
15
|
+
<g transform="matrix(0.865624,-0,-0,0.882034,-3.025571,0.442416)">
|
|
16
|
+
<use xlink:href="#_Image2" x="10.078" y="2.9" width="20px" height="7px"/>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<g transform="matrix(1.155236,0,0,1.133743,3.49525,-0.501586)">
|
|
21
|
+
<path d="M5.698,8.787L0.55,8.787C0.471,8.788 0.393,8.772 0.321,8.739C0.249,8.707 0.185,8.66 0.134,8.6C0.082,8.541 0.044,8.471 0.022,8.395C-0,8.32 -0.006,8.24 0.006,8.162L0.845,3.448C0.868,3.323 0.933,3.211 1.031,3.129C1.128,3.048 1.25,3.003 1.377,3.002L6.716,3.002L5.698,8.787Z" style="fill:rgb(0,100,255);fill-rule:nonzero;"/>
|
|
22
|
+
</g>
|
|
23
|
+
<g transform="matrix(1.155236,0,0,1.133743,3.49525,-0.501586)">
|
|
24
|
+
<clipPath id="_clip3">
|
|
25
|
+
<path d="M9.447,20.385L3.65,20.385L5.698,8.799L11.494,8.799L9.447,20.385Z" clip-rule="nonzero"/>
|
|
26
|
+
</clipPath>
|
|
27
|
+
<g clip-path="url(#_clip3)">
|
|
28
|
+
<g transform="matrix(0.865624,-0,-0,0.882034,-3.025571,0.442416)">
|
|
29
|
+
<use xlink:href="#_Image4" x="7.712" y="9.474" width="10px" height="14px"/>
|
|
30
|
+
</g>
|
|
31
|
+
</g>
|
|
32
|
+
</g>
|
|
33
|
+
</g>
|
|
34
|
+
</g>
|
|
35
|
+
<defs>
|
|
36
|
+
<image id="_Image2" width="20px" height="7px" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAsUlEQVQokW2R267CMAwEB/7/RxGoXFrKoSS7PMQJrnQSrZKn8dg+nGwDLJq468zsC7MmFk8svrLqxtN3Vj14eeHPM2+vvL2y8eLjjeINUTHiCGBMpSAK1RURcX6FaW/7i+bS084RaKCIelwCrKhef6AB7Zc9sLpZZLvK3i7DesBhybBswJ1dAqcCRsjdK9s5hpZbdkkzLAMyYO6w+O9w+t9Qzgspv1bTQka7jnYDlqf4BQuSDbEWXdA2AAAAAElFTkSuQmCC"/>
|
|
37
|
+
<image id="_Image4" width="10px" height="14px" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOCAYAAAAWo42rAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAR0lEQVQokZ2PQQrAIAwEx5L/3/ys2qbXglRGc1sYZjeFmom4oBkMgqaEO8ZuwfFJixVBtxuPqhf1M/hrfASVENzW6J7mchi89l8Tj8VznSAAAAAASUVORK5CYII="/>
|
|
38
|
+
</defs>
|
|
39
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="200" height="200"><path d="M712.149333 352.234667c5.184 0 10.282667 0.064 15.381334 0.341333-26.944-146.837333-178.602667-259.2-361.642667-259.2-202.090667 0-365.888 137.002667-365.888 306.005333 0 99.093333 56.298667 187.178667 143.637333 243.093334l3.349334 2.133333-35.349334 110.72 132.266667-67.370667 6.229333 1.792a431.296 431.296 0 0 0 140.330667 14.848 237.141333 237.141333 0 0 1-11.626667-73.002666c0.021333-154.282667 149.290667-279.36 333.312-279.36z m-218.901333-107.968c28.373333 0 51.349333 22.250667 51.349333 49.728 0 27.456-22.976 49.770667-51.349333 49.770666-28.416 0-51.370667-22.293333-51.370667-49.770666-0.021333-27.498667 22.954667-49.728 51.370667-49.728z m-254.677333 99.477333c-28.394667 0-51.370667-22.293333-51.370667-49.770667 0-27.477333 22.997333-49.728 51.370667-49.728 28.394667 0 51.434667 22.250667 51.434666 49.728s-23.04 49.770667-51.434666 49.770667z" fill="#46AF35"/><path d="M405.76 633.408c0 142.805333 138.453333 258.56 309.162667 258.56a363.392 363.392 0 0 0 103.04-14.762667l111.701333 56.96-29.866667-93.589333 2.816-1.792c73.770667-47.232 121.344-121.621333 121.344-205.397333 0-142.741333-138.389333-258.496-309.056-258.496-170.688 0.042667-309.141333 115.776-309.141333 258.517333z m373.312-89.045333c0-23.168 19.413333-41.962667 43.370667-41.962667 24.021333 0 43.413333 18.816 43.413333 41.962667 0 23.253333-19.413333 42.090667-43.413333 42.090666-23.957333 0-43.370667-18.858667-43.370667-42.090666z m-215.146667 0c0-23.168 19.456-41.962667 43.413334-41.962667 23.978667 0 43.413333 18.816 43.413333 41.962667 0 23.253333-19.434667 42.090667-43.413333 42.090666-23.957333 0-43.413333-18.858667-43.413334-42.090666z" fill="#46AF35"/></svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createIconifyIcon } from '@melt-js/libs-vben/core-icons';
|
|
2
|
+
|
|
3
|
+
import './load.js';
|
|
4
|
+
|
|
5
|
+
const SvgAvatar1Icon = createIconifyIcon('svg:avatar-1');
|
|
6
|
+
const SvgAvatar2Icon = createIconifyIcon('svg:avatar-2');
|
|
7
|
+
const SvgAvatar3Icon = createIconifyIcon('svg:avatar-3');
|
|
8
|
+
const SvgAvatar4Icon = createIconifyIcon('svg:avatar-4');
|
|
9
|
+
const SvgDownloadIcon = createIconifyIcon('svg:download');
|
|
10
|
+
const SvgCardIcon = createIconifyIcon('svg:card');
|
|
11
|
+
const SvgBellIcon = createIconifyIcon('svg:bell');
|
|
12
|
+
const SvgCakeIcon = createIconifyIcon('svg:cake');
|
|
13
|
+
const SvgAntdvLogoIcon = createIconifyIcon('svg:antdv-logo');
|
|
14
|
+
const SvgGithubIcon = createIconifyIcon('svg:github');
|
|
15
|
+
const SvgGoogleIcon = createIconifyIcon('svg:google');
|
|
16
|
+
const SvgQQChatIcon = createIconifyIcon('svg:qqchat');
|
|
17
|
+
const SvgWeChatIcon = createIconifyIcon('svg:wechat');
|
|
18
|
+
const SvgDingDingIcon = createIconifyIcon('svg:dingding');
|
|
19
|
+
const SvgTDesignIcon = createIconifyIcon('svg:tdesign-logo');
|
|
20
|
+
const SvgAntdvNextLogoIcon = createIconifyIcon('svg:antdv-next-logo');
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
SvgAntdvLogoIcon,
|
|
24
|
+
SvgAntdvNextLogoIcon,
|
|
25
|
+
SvgAvatar1Icon,
|
|
26
|
+
SvgAvatar2Icon,
|
|
27
|
+
SvgAvatar3Icon,
|
|
28
|
+
SvgAvatar4Icon,
|
|
29
|
+
SvgBellIcon,
|
|
30
|
+
SvgCakeIcon,
|
|
31
|
+
SvgCardIcon,
|
|
32
|
+
SvgDingDingIcon,
|
|
33
|
+
SvgDownloadIcon,
|
|
34
|
+
SvgGithubIcon,
|
|
35
|
+
SvgGoogleIcon,
|
|
36
|
+
SvgQQChatIcon,
|
|
37
|
+
SvgTDesignIcon,
|
|
38
|
+
SvgWeChatIcon,
|
|
39
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { IconifyIconStructure } from '@melt-js/libs-vben/core-icons';
|
|
2
|
+
|
|
3
|
+
import { addIcon } from '@melt-js/libs-vben/core-icons';
|
|
4
|
+
|
|
5
|
+
void loadSvgIcons();
|
|
6
|
+
|
|
7
|
+
function parseSvg(svgData: string): IconifyIconStructure {
|
|
8
|
+
const parser = new DOMParser();
|
|
9
|
+
const xmlDoc = parser.parseFromString(svgData, 'image/svg+xml');
|
|
10
|
+
const svgElement = xmlDoc.documentElement;
|
|
11
|
+
|
|
12
|
+
// 提取 SVG 根元素的关键样式属性
|
|
13
|
+
const getAttrs = (el: Element, attrs: string[]) =>
|
|
14
|
+
attrs
|
|
15
|
+
.map((attr) =>
|
|
16
|
+
el.hasAttribute(attr) ? `${attr}="${el.getAttribute(attr)}"` : '',
|
|
17
|
+
)
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' ');
|
|
20
|
+
|
|
21
|
+
const rootAttrs = getAttrs(svgElement, [
|
|
22
|
+
'fill',
|
|
23
|
+
'stroke',
|
|
24
|
+
'fill-rule',
|
|
25
|
+
'stroke-width',
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const svgContent = [...svgElement.childNodes]
|
|
29
|
+
.filter((node) => node.nodeType === Node.ELEMENT_NODE)
|
|
30
|
+
.map((node) => new XMLSerializer().serializeToString(node))
|
|
31
|
+
.join('');
|
|
32
|
+
// 若根有属性,用一个 g 标签包裹内容并继承属性
|
|
33
|
+
const body = rootAttrs ? `<g ${rootAttrs}>${svgContent}</g>` : svgContent;
|
|
34
|
+
|
|
35
|
+
const viewBoxValue = svgElement.getAttribute('viewBox') || '';
|
|
36
|
+
const [left, top, width, height] = viewBoxValue.split(' ').map((val) => {
|
|
37
|
+
const num = Number(val);
|
|
38
|
+
return Number.isNaN(num) ? undefined : num;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
body,
|
|
43
|
+
height,
|
|
44
|
+
left,
|
|
45
|
+
top,
|
|
46
|
+
width,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 自定义的svg图片转化为组件
|
|
52
|
+
* @example ./svg/avatar.svg
|
|
53
|
+
* <Icon icon="svg:avatar"></Icon>
|
|
54
|
+
*/
|
|
55
|
+
async function loadSvgIcons() {
|
|
56
|
+
if (
|
|
57
|
+
typeof DOMParser === 'undefined' ||
|
|
58
|
+
typeof Node === 'undefined' ||
|
|
59
|
+
typeof XMLSerializer === 'undefined'
|
|
60
|
+
) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const svgEagers = import.meta.glob('./icons/**', {
|
|
65
|
+
eager: true,
|
|
66
|
+
query: '?raw',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
Object.entries(svgEagers).forEach((svg) => {
|
|
70
|
+
const [key, body] = svg as [string, string | { default: string }];
|
|
71
|
+
|
|
72
|
+
// ./icons/xxxx.svg => xxxxxx
|
|
73
|
+
const start = key.lastIndexOf('/') + 1;
|
|
74
|
+
const end = key.lastIndexOf('.');
|
|
75
|
+
const iconName = key.slice(start, end);
|
|
76
|
+
|
|
77
|
+
addIcon(`svg:${iconName}`, {
|
|
78
|
+
...parseSvg(typeof body === 'object' ? body.default : body),
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import type { Locale } from 'vue-i18n';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
ImportLocaleFn,
|
|
6
|
+
LoadMessageFn,
|
|
7
|
+
LocaleSetupOptions,
|
|
8
|
+
SupportedLanguagesType,
|
|
9
|
+
} from './typing';
|
|
10
|
+
|
|
11
|
+
import { unref } from 'vue';
|
|
12
|
+
import { createI18n } from 'vue-i18n';
|
|
13
|
+
|
|
14
|
+
import { useSimpleLocale } from '@melt-js/libs-vben/composables';
|
|
15
|
+
|
|
16
|
+
const i18n = createI18n({
|
|
17
|
+
globalInjection: true,
|
|
18
|
+
legacy: false,
|
|
19
|
+
locale: '',
|
|
20
|
+
messages: {},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const modules = import.meta.glob('./langs/**/*.json');
|
|
24
|
+
|
|
25
|
+
const { setSimpleLocale } = useSimpleLocale();
|
|
26
|
+
|
|
27
|
+
const localesMap = loadLocalesMapFromDir(
|
|
28
|
+
/\.\/langs\/([^/]+)\/(.*)\.json$/,
|
|
29
|
+
modules,
|
|
30
|
+
);
|
|
31
|
+
let loadMessages: LoadMessageFn;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Load locale modules
|
|
35
|
+
* @param modules
|
|
36
|
+
*/
|
|
37
|
+
function loadLocalesMap(modules: Record<string, () => Promise<unknown>>) {
|
|
38
|
+
const localesMap: Record<Locale, ImportLocaleFn> = {};
|
|
39
|
+
|
|
40
|
+
for (const [path, loadLocale] of Object.entries(modules)) {
|
|
41
|
+
const key = path.match(/([\w-]*)\.(json)/)?.[1];
|
|
42
|
+
if (key) {
|
|
43
|
+
localesMap[key] = loadLocale as ImportLocaleFn;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return localesMap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Load locale modules with directory structure
|
|
51
|
+
* @param regexp - Regular expression to match language and file names
|
|
52
|
+
* @param modules - The modules object containing paths and import functions
|
|
53
|
+
* @returns A map of locales to their corresponding import functions
|
|
54
|
+
*/
|
|
55
|
+
function loadLocalesMapFromDir(
|
|
56
|
+
regexp: RegExp,
|
|
57
|
+
modules: Record<string, () => Promise<unknown>>,
|
|
58
|
+
): Record<Locale, ImportLocaleFn> {
|
|
59
|
+
const localesRaw: Record<Locale, Record<string, () => Promise<unknown>>> = {};
|
|
60
|
+
const localesMap: Record<Locale, ImportLocaleFn> = {};
|
|
61
|
+
|
|
62
|
+
// Iterate over the modules to extract language and file names
|
|
63
|
+
for (const path in modules) {
|
|
64
|
+
const match = path.match(regexp);
|
|
65
|
+
if (match) {
|
|
66
|
+
const [_, locale, fileName] = match;
|
|
67
|
+
if (locale && fileName) {
|
|
68
|
+
if (!localesRaw[locale]) {
|
|
69
|
+
localesRaw[locale] = {};
|
|
70
|
+
}
|
|
71
|
+
if (modules[path]) {
|
|
72
|
+
localesRaw[locale][fileName] = modules[path];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Convert raw locale data into async import functions
|
|
79
|
+
for (const [locale, files] of Object.entries(localesRaw)) {
|
|
80
|
+
localesMap[locale] = async () => {
|
|
81
|
+
const messages: Record<string, any> = {};
|
|
82
|
+
for (const [fileName, importFn] of Object.entries(files)) {
|
|
83
|
+
messages[fileName] = ((await importFn()) as any)?.default;
|
|
84
|
+
}
|
|
85
|
+
return { default: messages };
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return localesMap;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Set i18n language
|
|
94
|
+
* @param locale
|
|
95
|
+
*/
|
|
96
|
+
function setI18nLanguage(locale: Locale) {
|
|
97
|
+
i18n.global.locale.value = locale;
|
|
98
|
+
|
|
99
|
+
document?.querySelector('html')?.setAttribute('lang', locale);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
|
|
103
|
+
const { defaultLocale = 'zh-CN' } = options;
|
|
104
|
+
// app可以自行扩展一些第三方库和组件库的国际化
|
|
105
|
+
loadMessages = options.loadMessages || (async () => ({}));
|
|
106
|
+
app.use(i18n);
|
|
107
|
+
await loadLocaleMessages(defaultLocale);
|
|
108
|
+
|
|
109
|
+
// 在控制台打印警告
|
|
110
|
+
i18n.global.setMissingHandler((locale, key) => {
|
|
111
|
+
if (options.missingWarn && key.includes('.')) {
|
|
112
|
+
console.warn(
|
|
113
|
+
`[intlify] Not found '${key}' key in '${locale}' locale messages.`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Load locale messages
|
|
121
|
+
* @param lang
|
|
122
|
+
*/
|
|
123
|
+
async function loadLocaleMessages(lang: SupportedLanguagesType) {
|
|
124
|
+
if (unref(i18n.global.locale) === lang) {
|
|
125
|
+
return setI18nLanguage(lang);
|
|
126
|
+
}
|
|
127
|
+
setSimpleLocale(lang);
|
|
128
|
+
|
|
129
|
+
const message = await localesMap[lang]?.();
|
|
130
|
+
|
|
131
|
+
if (message?.default) {
|
|
132
|
+
i18n.global.setLocaleMessage(lang, message.default);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const mergeMessage = await loadMessages(lang);
|
|
136
|
+
i18n.global.mergeLocaleMessage(lang, mergeMessage);
|
|
137
|
+
|
|
138
|
+
return setI18nLanguage(lang);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
i18n,
|
|
143
|
+
loadLocaleMessages,
|
|
144
|
+
loadLocalesMap,
|
|
145
|
+
loadLocalesMapFromDir,
|
|
146
|
+
setupI18n,
|
|
147
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
i18n,
|
|
3
|
+
loadLocaleMessages,
|
|
4
|
+
loadLocalesMap,
|
|
5
|
+
loadLocalesMapFromDir,
|
|
6
|
+
setupI18n,
|
|
7
|
+
} from './i18n';
|
|
8
|
+
|
|
9
|
+
const $t = i18n.global.t.bind(i18n.global);
|
|
10
|
+
const $te = i18n.global.te.bind(i18n.global);
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
$t,
|
|
14
|
+
$te,
|
|
15
|
+
i18n,
|
|
16
|
+
loadLocaleMessages,
|
|
17
|
+
loadLocalesMap,
|
|
18
|
+
loadLocalesMapFromDir,
|
|
19
|
+
setupI18n,
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
type ImportLocaleFn,
|
|
23
|
+
type LocaleSetupOptions,
|
|
24
|
+
type SupportedLanguagesType,
|
|
25
|
+
} from './typing';
|
|
26
|
+
export type { CompileError } from '@intlify/core-base';
|
|
27
|
+
|
|
28
|
+
export { useI18n } from 'vue-i18n';
|
|
29
|
+
|
|
30
|
+
export type { Locale } from 'vue-i18n';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"welcomeBack": "Welcome Back",
|
|
3
|
+
"pageTitle": "Plug-and-play Admin system",
|
|
4
|
+
"pageDesc": "Efficient, versatile frontend template",
|
|
5
|
+
"loginSuccess": "Login Successful",
|
|
6
|
+
"loginSuccessDesc": "Welcome Back",
|
|
7
|
+
"loginSubtitle": "Enter your account details to manage your projects",
|
|
8
|
+
"selectAccount": "Quick Select Account",
|
|
9
|
+
"username": "Username",
|
|
10
|
+
"password": "Password",
|
|
11
|
+
"usernameTip": "Please enter username",
|
|
12
|
+
"passwordErrorTip": "Password is incorrect",
|
|
13
|
+
"passwordTip": "Please enter password",
|
|
14
|
+
"verifyRequiredTip": "Please complete the verification first",
|
|
15
|
+
"rememberMe": "Remember Me",
|
|
16
|
+
"createAnAccount": "Create an Account",
|
|
17
|
+
"createAccount": "Create Account",
|
|
18
|
+
"alreadyHaveAccount": "Already have an account?",
|
|
19
|
+
"accountTip": "Don't have an account?",
|
|
20
|
+
"signUp": "Sign Up",
|
|
21
|
+
"signUpSubtitle": "Make managing your applications simple and fun",
|
|
22
|
+
"confirmPassword": "Confirm Password",
|
|
23
|
+
"confirmPasswordTip": "The passwords do not match",
|
|
24
|
+
"agree": "I agree to",
|
|
25
|
+
"privacyPolicy": "Privacy-policy",
|
|
26
|
+
"terms": "Terms",
|
|
27
|
+
"agreeTip": "Please agree to the Privacy Policy and Terms",
|
|
28
|
+
"goToLogin": "Login instead",
|
|
29
|
+
"passwordStrength": "Use 8 or more characters with a mix of letters, numbers & symbols",
|
|
30
|
+
"forgetPassword": "Forget Password?",
|
|
31
|
+
"forgetPasswordSubtitle": "Enter your email and we'll send you instructions to reset your password",
|
|
32
|
+
"emailTip": "Please enter email",
|
|
33
|
+
"emailValidErrorTip": "The email format you entered is incorrect",
|
|
34
|
+
"sendResetLink": "Send Reset Link",
|
|
35
|
+
"email": "Email",
|
|
36
|
+
"qrcodeSubtitle": "Scan the QR code with your phone to login",
|
|
37
|
+
"qrcodePrompt": "Click 'Confirm' after scanning to complete login",
|
|
38
|
+
"qrcodeLogin": "QR Code Login",
|
|
39
|
+
"wechatLogin": "Wechat Login",
|
|
40
|
+
"qqLogin": "QQ Login",
|
|
41
|
+
"githubLogin": "Github Login",
|
|
42
|
+
"googleLogin": "Google Login",
|
|
43
|
+
"dingdingLogin": "Dingding Login",
|
|
44
|
+
"codeSubtitle": "Enter your phone number to start managing your project",
|
|
45
|
+
"code": "Security code",
|
|
46
|
+
"codeTip": "Security code required {0} characters",
|
|
47
|
+
"mobile": "Mobile",
|
|
48
|
+
"mobileLogin": "Mobile Login",
|
|
49
|
+
"mobileTip": "Please enter mobile number",
|
|
50
|
+
"mobileErrortip": "The phone number format is incorrect",
|
|
51
|
+
"sendCode": "Get Security code",
|
|
52
|
+
"sendText": "Resend in {0}s",
|
|
53
|
+
"thirdPartyLogin": "Or continue with",
|
|
54
|
+
"weChat": "WeChat",
|
|
55
|
+
"qq": "QQ",
|
|
56
|
+
"gitHub": "GitHub",
|
|
57
|
+
"google": "Google",
|
|
58
|
+
"loginAgainTitle": "Please Log In Again",
|
|
59
|
+
"loginAgainSubTitle": "Your login session has expired. Please log in again to continue.",
|
|
60
|
+
"layout": {
|
|
61
|
+
"center": "Align Center",
|
|
62
|
+
"alignLeft": "Align Left",
|
|
63
|
+
"alignRight": "Align Right"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"back": "Back",
|
|
3
|
+
"backToHome": "Back To Home",
|
|
4
|
+
"login": "Login",
|
|
5
|
+
"logout": "Logout",
|
|
6
|
+
"prompt": "Prompt",
|
|
7
|
+
"cancel": "Cancel",
|
|
8
|
+
"confirm": "Confirm",
|
|
9
|
+
"reset": "Reset",
|
|
10
|
+
"noData": "No Data",
|
|
11
|
+
"refresh": "Refresh",
|
|
12
|
+
"loadingMenu": "Loading Menu",
|
|
13
|
+
"query": "Search",
|
|
14
|
+
"search": "Search",
|
|
15
|
+
"enabled": "Enabled",
|
|
16
|
+
"disabled": "Disabled",
|
|
17
|
+
"edit": "Edit",
|
|
18
|
+
"delete": "Delete",
|
|
19
|
+
"detail": "Detail",
|
|
20
|
+
"create": "Create",
|
|
21
|
+
"yes": "Yes",
|
|
22
|
+
"no": "No",
|
|
23
|
+
"showSearchPanel": "Show search panel",
|
|
24
|
+
"hideSearchPanel": "Hide search panel",
|
|
25
|
+
"notShow": "Don't Show",
|
|
26
|
+
"more": "More"
|
|
27
|
+
}
|