@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.
Files changed (174) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +86 -2
  3. package/package.json +98 -3
  4. package/src/access/access-control.vue +47 -0
  5. package/src/access/accessible.ts +236 -0
  6. package/src/access/directive.ts +42 -0
  7. package/src/access/index.ts +4 -0
  8. package/src/access/use-access.ts +53 -0
  9. package/src/composables/index.ts +14 -0
  10. package/src/composables/use-is-mobile.ts +7 -0
  11. package/src/composables/use-layout-style.ts +51 -0
  12. package/src/composables/use-layout-viewport-height.ts +71 -0
  13. package/src/composables/use-namespace.ts +106 -0
  14. package/src/composables/use-priority-value.ts +96 -0
  15. package/src/composables/use-scroll-lock.ts +151 -0
  16. package/src/composables/use-simple-locale/README.md +3 -0
  17. package/src/composables/use-simple-locale/index.ts +27 -0
  18. package/src/composables/use-simple-locale/messages.ts +31 -0
  19. package/src/composables/use-sortable.ts +32 -0
  20. package/src/constants/core.ts +76 -0
  21. package/src/constants/index.ts +2 -0
  22. package/src/core-icons/create-icon.ts +14 -0
  23. package/src/core-icons/index.ts +11 -0
  24. package/src/core-icons/lucide.ts +95 -0
  25. package/src/core-preferences/config.ts +172 -0
  26. package/src/core-preferences/constants.ts +116 -0
  27. package/src/core-preferences/index.ts +24 -0
  28. package/src/core-preferences/preferences.ts +503 -0
  29. package/src/core-preferences/types.ts +471 -0
  30. package/src/core-preferences/update-css-variables.ts +129 -0
  31. package/src/core-preferences/use-preferences.ts +282 -0
  32. package/src/design/css/global.css +1 -0
  33. package/src/design/css/nprogress.css +61 -0
  34. package/src/design/css/transition.css +238 -0
  35. package/src/design/css/ui.css +101 -0
  36. package/src/design/design-tokens/dark.css +446 -0
  37. package/src/design/design-tokens/default.css +491 -0
  38. package/src/design/design-tokens/index.ts +2 -0
  39. package/src/design/index.ts +6 -0
  40. package/src/design/scss-bem/bem.scss +34 -0
  41. package/src/design/scss-bem/constants.scss +5 -0
  42. package/src/hooks/index.ts +9 -0
  43. package/src/hooks/use-app-config.ts +39 -0
  44. package/src/hooks/use-content-maximize.ts +24 -0
  45. package/src/hooks/use-design-tokens.ts +421 -0
  46. package/src/hooks/use-hover-toggle.ts +163 -0
  47. package/src/hooks/use-pagination.ts +72 -0
  48. package/src/hooks/use-refresh.ts +16 -0
  49. package/src/hooks/use-tabs.ts +143 -0
  50. package/src/hooks/use-watermark.ts +84 -0
  51. package/src/icons/iconify/index.ts +5 -0
  52. package/src/icons/icons/empty-icon.vue +27 -0
  53. package/src/icons/index.ts +3 -0
  54. package/src/icons/svg/icons/antdv-logo.svg +29 -0
  55. package/src/icons/svg/icons/antdv-next-logo.svg +1 -0
  56. package/src/icons/svg/icons/avatar-1.svg +1 -0
  57. package/src/icons/svg/icons/avatar-2.svg +1 -0
  58. package/src/icons/svg/icons/avatar-3.svg +1 -0
  59. package/src/icons/svg/icons/avatar-4.svg +1 -0
  60. package/src/icons/svg/icons/bell.svg +1 -0
  61. package/src/icons/svg/icons/cake.svg +1 -0
  62. package/src/icons/svg/icons/card.svg +1 -0
  63. package/src/icons/svg/icons/dingding.svg +1 -0
  64. package/src/icons/svg/icons/download.svg +1 -0
  65. package/src/icons/svg/icons/github.svg +1 -0
  66. package/src/icons/svg/icons/google.svg +1 -0
  67. package/src/icons/svg/icons/qqchat.svg +1 -0
  68. package/src/icons/svg/icons/tdesign-logo.svg +39 -0
  69. package/src/icons/svg/icons/wechat.svg +1 -0
  70. package/src/icons/svg/index.ts +39 -0
  71. package/src/icons/svg/load.ts +81 -0
  72. package/src/locales/i18n.ts +147 -0
  73. package/src/locales/index.ts +30 -0
  74. package/src/locales/langs/en-US/authentication.json +65 -0
  75. package/src/locales/langs/en-US/common.json +27 -0
  76. package/src/locales/langs/en-US/preferences.json +245 -0
  77. package/src/locales/langs/en-US/profile.json +4 -0
  78. package/src/locales/langs/en-US/ui.json +165 -0
  79. package/src/locales/langs/zh-CN/authentication.json +65 -0
  80. package/src/locales/langs/zh-CN/common.json +27 -0
  81. package/src/locales/langs/zh-CN/preferences.json +245 -0
  82. package/src/locales/langs/zh-CN/profile.json +4 -0
  83. package/src/locales/langs/zh-CN/ui.json +165 -0
  84. package/src/locales/langs/zh-TW/authentication.json +65 -0
  85. package/src/locales/langs/zh-TW/common.json +27 -0
  86. package/src/locales/langs/zh-TW/preferences.json +245 -0
  87. package/src/locales/langs/zh-TW/profile.json +4 -0
  88. package/src/locales/langs/zh-TW/ui.json +165 -0
  89. package/src/locales/typing.ts +27 -0
  90. package/src/preferences/index.ts +42 -0
  91. package/src/request/index.ts +2 -0
  92. package/src/request/request-client/index.ts +3 -0
  93. package/src/request/request-client/modules/downloader.ts +60 -0
  94. package/src/request/request-client/modules/interceptor.ts +40 -0
  95. package/src/request/request-client/modules/sse.ts +134 -0
  96. package/src/request/request-client/modules/uploader.ts +79 -0
  97. package/src/request/request-client/preset-interceptors.ts +178 -0
  98. package/src/request/request-client/request-client.ts +163 -0
  99. package/src/request/request-client/types.ts +90 -0
  100. package/src/shared/cache/README.md +418 -0
  101. package/src/shared/cache/index.ts +5 -0
  102. package/src/shared/cache/indexeddb-driver.ts +137 -0
  103. package/src/shared/cache/local-storage-driver.ts +70 -0
  104. package/src/shared/cache/memory-storage-driver.ts +32 -0
  105. package/src/shared/cache/storage-manager.ts +146 -0
  106. package/src/shared/cache/types.ts +39 -0
  107. package/src/shared/color/color.ts +9 -0
  108. package/src/shared/color/convert.ts +62 -0
  109. package/src/shared/color/generator.ts +45 -0
  110. package/src/shared/color/index.ts +3 -0
  111. package/src/shared/constants/globals.ts +20 -0
  112. package/src/shared/constants/index.ts +2 -0
  113. package/src/shared/constants/vben.ts +30 -0
  114. package/src/shared/global-state.ts +45 -0
  115. package/src/shared/store.ts +1 -0
  116. package/src/shared/utils/cn.ts +10 -0
  117. package/src/shared/utils/date.ts +80 -0
  118. package/src/shared/utils/diff.ts +114 -0
  119. package/src/shared/utils/dom.ts +126 -0
  120. package/src/shared/utils/download.ts +186 -0
  121. package/src/shared/utils/error.ts +19 -0
  122. package/src/shared/utils/index.ts +22 -0
  123. package/src/shared/utils/inference.ts +164 -0
  124. package/src/shared/utils/letter.ts +47 -0
  125. package/src/shared/utils/merge.ts +11 -0
  126. package/src/shared/utils/nprogress.ts +52 -0
  127. package/src/shared/utils/resources.ts +21 -0
  128. package/src/shared/utils/stack.ts +103 -0
  129. package/src/shared/utils/state-handler.ts +61 -0
  130. package/src/shared/utils/to.ts +21 -0
  131. package/src/shared/utils/tree.ts +159 -0
  132. package/src/shared/utils/unique.ts +15 -0
  133. package/src/shared/utils/update-css-variables.ts +47 -0
  134. package/src/shared/utils/util.ts +50 -0
  135. package/src/shared/utils/window.ts +37 -0
  136. package/src/stores/index.ts +3 -0
  137. package/src/stores/modules/access.ts +130 -0
  138. package/src/stores/modules/dict.ts +244 -0
  139. package/src/stores/modules/index.ts +5 -0
  140. package/src/stores/modules/tabbar.ts +797 -0
  141. package/src/stores/modules/timezone.ts +132 -0
  142. package/src/stores/modules/user.ts +42 -0
  143. package/src/stores/setup.ts +79 -0
  144. package/src/stores/shim-pinia.d.ts +11 -0
  145. package/src/styles/antd/index.css +78 -0
  146. package/src/styles/antdv-next/index.css +90 -0
  147. package/src/styles/ele/index.css +44 -0
  148. package/src/styles/global/index.scss +1 -0
  149. package/src/styles/index.ts +1 -0
  150. package/src/styles/naive/index.css +26 -0
  151. package/src/styles/style-exports.d.ts +3 -0
  152. package/src/theme.css +592 -0
  153. package/src/types/global.d.ts +28 -0
  154. package/src/types/index.ts +2 -0
  155. package/src/types/shims.d.ts +1 -0
  156. package/src/types/user.ts +20 -0
  157. package/src/typings/app.d.ts +128 -0
  158. package/src/typings/basic.d.ts +42 -0
  159. package/src/typings/helper.d.ts +147 -0
  160. package/src/typings/index.ts +16 -0
  161. package/src/typings/languages.ts +28 -0
  162. package/src/typings/menu-record.ts +82 -0
  163. package/src/typings/tabs.ts +8 -0
  164. package/src/typings/vue-router.d.ts +169 -0
  165. package/src/utils/helpers/find-menu-by-path.ts +37 -0
  166. package/src/utils/helpers/generate-menus.ts +89 -0
  167. package/src/utils/helpers/generate-routes-backend.ts +108 -0
  168. package/src/utils/helpers/generate-routes-frontend.ts +58 -0
  169. package/src/utils/helpers/get-popup-container.ts +10 -0
  170. package/src/utils/helpers/index.ts +8 -0
  171. package/src/utils/helpers/merge-route-modules.ts +28 -0
  172. package/src/utils/helpers/reset-routes.ts +30 -0
  173. package/src/utils/helpers/unmount-global-loading.ts +31 -0
  174. package/src/utils/index.ts +4 -0
@@ -0,0 +1,95 @@
1
+ export {
2
+ TextAlignCenter as AlignCenter,
3
+ TextAlignStart as AlignLeft,
4
+ TextAlignEnd as AlignRight,
5
+ ArrowDown,
6
+ ArrowLeft,
7
+ ArrowLeftToLine,
8
+ ArrowRightLeft,
9
+ ArrowRightToLine,
10
+ ArrowUp,
11
+ ArrowUpToLine,
12
+ Bell,
13
+ Bold,
14
+ BookOpenText,
15
+ Check,
16
+ ChevronDown,
17
+ ChevronLeft,
18
+ ChevronRight,
19
+ ChevronsDown,
20
+ ChevronsLeft,
21
+ ChevronsRight,
22
+ Circle,
23
+ CircleAlert,
24
+ CircleCheckBig,
25
+ CircleHelp,
26
+ CircleX,
27
+ Copy,
28
+ CornerDownLeft,
29
+ Download,
30
+ Ellipsis,
31
+ Eraser,
32
+ Expand,
33
+ ExternalLink,
34
+ Eye,
35
+ EyeOff,
36
+ FoldHorizontal,
37
+ Fullscreen,
38
+ Grid,
39
+ Grip,
40
+ GripVertical,
41
+ Heading1,
42
+ Heading2,
43
+ Highlighter,
44
+ Menu as IconDefault,
45
+ ImagePlus,
46
+ Inbox,
47
+ Info,
48
+ InspectionPanel,
49
+ Italic,
50
+ Languages,
51
+ LayoutGrid,
52
+ Link2,
53
+ List,
54
+ ListOrdered,
55
+ LoaderCircle,
56
+ LockKeyhole,
57
+ LogOut,
58
+ MailCheck,
59
+ Maximize,
60
+ ArrowRightFromLine as MdiMenuClose,
61
+ ArrowLeftFromLine as MdiMenuOpen,
62
+ Menu,
63
+ MessageSquareCode,
64
+ Minimize,
65
+ Minimize2,
66
+ MoonStar,
67
+ Paintbrush,
68
+ Palette,
69
+ PanelLeft,
70
+ PanelRight,
71
+ Pin,
72
+ PinOff,
73
+ Plus,
74
+ Redo2,
75
+ RemoveFormatting,
76
+ RotateCw,
77
+ Search,
78
+ SearchX,
79
+ Settings,
80
+ Shrink,
81
+ Square,
82
+ SquareCheckBig,
83
+ SquareCode,
84
+ SquareMinus,
85
+ Strikethrough,
86
+ Sun,
87
+ SunMoon,
88
+ SwatchBook,
89
+ TextQuote,
90
+ Underline,
91
+ Undo2,
92
+ Unlink2,
93
+ UserRoundPen,
94
+ X,
95
+ } from '@lucide/vue';
@@ -0,0 +1,172 @@
1
+ import type { Preferences } from './types';
2
+
3
+ const defaultPreferences: Preferences = {
4
+ app: {
5
+ accessMode: 'frontend',
6
+ authPageLayout: 'panel-right',
7
+ checkUpdatesInterval: 1,
8
+ colorGrayMode: false,
9
+ colorWeakMode: false,
10
+ compact: false,
11
+ contentCompact: 'wide',
12
+ contentCompactWidth: 1200,
13
+ contentPadding: 0,
14
+ contentPaddingBottom: 0,
15
+ contentPaddingLeft: 0,
16
+ contentPaddingRight: 0,
17
+ contentPaddingTop: 0,
18
+ defaultAvatar:
19
+ 'https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp',
20
+ defaultHomePath: '/dashboard',
21
+ dynamicTitle: true,
22
+ enableCheckUpdates: true,
23
+ enableCopyPreferences: true,
24
+ enablePreferences: true,
25
+ enableRefreshToken: false,
26
+ enableStickyPreferencesNavigationBar: true,
27
+ isMobile: false,
28
+ layout: 'sidebar-nav',
29
+ locale: 'zh-CN',
30
+ loginExpiredMode: 'page',
31
+ name: 'Vben Admin',
32
+ preferencesButtonPosition: 'auto',
33
+ timezone: 'Asia/Shanghai',
34
+ watermark: false,
35
+ watermarkContent: '',
36
+ zIndex: 200,
37
+ },
38
+ breadcrumb: {
39
+ enable: true,
40
+ hideOnlyOne: false,
41
+ showHome: false,
42
+ showIcon: true,
43
+ styleType: 'normal',
44
+ },
45
+ copyright: {
46
+ companyName: 'Vben',
47
+ companySiteLink: 'https://www.vben.pro',
48
+ date: '2024',
49
+ enable: true,
50
+ icp: '闽ICP备19024351号',
51
+ icpLink: 'https://beian.miit.gov.cn/',
52
+ settingShow: true,
53
+ },
54
+ footer: {
55
+ enable: false,
56
+ fixed: false,
57
+ height: 32,
58
+ },
59
+ header: {
60
+ enable: true,
61
+ height: 50,
62
+ hidden: false,
63
+ menuAlign: 'start',
64
+ mode: 'fixed',
65
+ },
66
+
67
+ logo: {
68
+ enable: true,
69
+ fit: 'contain',
70
+ source: 'https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp',
71
+ showText: true,
72
+ logoMode: 'icon',
73
+ },
74
+ navigation: {
75
+ accordion: true,
76
+ split: true,
77
+ styleType: 'rounded',
78
+ },
79
+ shortcutKeys: {
80
+ enable: true,
81
+ globalEscape: false,
82
+ globalLockScreen: true,
83
+ globalLogout: true,
84
+ globalPreferences: true,
85
+ globalSearch: true,
86
+ },
87
+ sidebar: {
88
+ autoActivateChild: false,
89
+ collapsed: false,
90
+ collapsedButton: true,
91
+ collapsedShowTitle: false,
92
+ collapseWidth: 60,
93
+ draggable: true,
94
+ enable: true,
95
+ expandOnHover: true,
96
+ extraCollapse: false,
97
+ extraCollapsedWidth: 60,
98
+ fixedButton: true,
99
+ hidden: false,
100
+ mixedWidth: 80,
101
+ width: 224,
102
+ },
103
+ tabbar: {
104
+ draggable: true,
105
+ enable: true,
106
+ height: 38,
107
+ keepAlive: true,
108
+ maxCount: 0,
109
+ middleClickToClose: false,
110
+ persist: true,
111
+ showIcon: true,
112
+ showMaximize: true,
113
+ showMore: true,
114
+ showRefresh: true,
115
+ styleType: 'chrome',
116
+ visitHistory: true,
117
+ wheelable: true,
118
+ },
119
+ theme: {
120
+ builtinType: 'default',
121
+ colorDestructive: 'hsl(348 100% 61%)',
122
+ colorPrimary: 'hsl(212 100% 45%)',
123
+ colorSuccess: 'hsl(144 57% 58%)',
124
+ colorWarning: 'hsl(42 84% 61%)',
125
+ mode: 'dark',
126
+ radius: '0.5',
127
+ fontSize: 16,
128
+ semiDarkHeader: false,
129
+ semiDarkSidebar: false,
130
+ semiDarkSidebarSub: false,
131
+ },
132
+ transition: {
133
+ enable: true,
134
+ loading: true,
135
+ name: 'fade-slide',
136
+ progress: true,
137
+ },
138
+ widget: {
139
+ fullscreen: true,
140
+ fullscreenButtonPosition: 'header',
141
+ globalSearch: true,
142
+ globalSearchButtonPosition: 'header',
143
+ languageToggle: true,
144
+ languageToggleButtonPosition: 'header',
145
+ lockScreen: true,
146
+ lockScreenButtonPosition: 'header',
147
+ logoutButtonPosition: 'header',
148
+ notification: true,
149
+ notificationButtonPosition: 'header',
150
+ refresh: true,
151
+ refreshButtonPosition: 'header',
152
+ sidebarToggle: true,
153
+ themeToggle: true,
154
+ themeToggleButtonPosition: 'header',
155
+ timezone: true,
156
+ timezoneButtonPosition: 'header',
157
+ order: [
158
+ 'globalSearch',
159
+ 'preferences',
160
+ 'themeToggle',
161
+ 'languageToggle',
162
+ 'timezone',
163
+ 'fullscreen',
164
+ 'refresh',
165
+ 'notification',
166
+ 'lockScreenBtn',
167
+ 'logoutBtn',
168
+ ],
169
+ },
170
+ };
171
+
172
+ export { defaultPreferences };
@@ -0,0 +1,116 @@
1
+ import type { BuiltinThemeType, TimezoneOption } from '@melt-js/libs-vben/typings';
2
+
3
+ interface BuiltinThemePreset {
4
+ color: string;
5
+ darkPrimaryColor?: string;
6
+ primaryColor?: string;
7
+ type: BuiltinThemeType;
8
+ }
9
+
10
+ const BUILT_IN_THEME_PRESETS: BuiltinThemePreset[] = [
11
+ {
12
+ color: 'hsl(212 100% 45%)',
13
+ type: 'default',
14
+ },
15
+ {
16
+ color: 'hsl(245 82% 67%)',
17
+ type: 'violet',
18
+ },
19
+ {
20
+ color: 'hsl(347 77% 60%)',
21
+ type: 'pink',
22
+ },
23
+ {
24
+ color: 'hsl(42 84% 61%)',
25
+ type: 'yellow',
26
+ },
27
+ {
28
+ color: 'hsl(231 98% 65%)',
29
+ type: 'sky-blue',
30
+ },
31
+ {
32
+ color: 'hsl(161 90% 43%)',
33
+ type: 'green',
34
+ },
35
+ {
36
+ color: 'hsl(240 5% 26%)',
37
+ darkPrimaryColor: 'hsl(0 0% 98%)',
38
+ primaryColor: 'hsl(240 5.9% 10%)',
39
+ type: 'zinc',
40
+ },
41
+ {
42
+ color: 'hsl(181 84% 32%)',
43
+ type: 'deep-green',
44
+ },
45
+ {
46
+ color: 'hsl(211 91% 39%)',
47
+ type: 'deep-blue',
48
+ },
49
+ {
50
+ color: 'hsl(18 89% 40%)',
51
+ type: 'orange',
52
+ },
53
+ {
54
+ color: 'hsl(0 75% 42%)',
55
+ type: 'rose',
56
+ },
57
+ {
58
+ color: 'hsl(0 0% 25%)',
59
+ darkPrimaryColor: 'hsl(0 0% 98%)',
60
+ primaryColor: 'hsl(240 5.9% 10%)',
61
+ type: 'neutral',
62
+ },
63
+ {
64
+ color: 'hsl(215 25% 27%)',
65
+ darkPrimaryColor: 'hsl(0 0% 98%)',
66
+ primaryColor: 'hsl(240 5.9% 10%)',
67
+ type: 'slate',
68
+ },
69
+ {
70
+ color: 'hsl(217 19% 27%)',
71
+ darkPrimaryColor: 'hsl(0 0% 98%)',
72
+ primaryColor: 'hsl(240 5.9% 10%)',
73
+ type: 'gray',
74
+ },
75
+ {
76
+ color: '',
77
+ type: 'custom',
78
+ },
79
+ ];
80
+
81
+ /**
82
+ * 时区选项
83
+ */
84
+ const DEFAULT_TIME_ZONE_OPTIONS: TimezoneOption[] = [
85
+ {
86
+ offset: -5,
87
+ timezone: 'America/New_York',
88
+ label: 'America/New_York(GMT-5)',
89
+ },
90
+ {
91
+ offset: 0,
92
+ timezone: 'Europe/London',
93
+ label: 'Europe/London(GMT0)',
94
+ },
95
+ {
96
+ offset: 8,
97
+ timezone: 'Asia/Shanghai',
98
+ label: 'Asia/Shanghai(GMT+8)',
99
+ },
100
+ {
101
+ offset: 9,
102
+ timezone: 'Asia/Tokyo',
103
+ label: 'Asia/Tokyo(GMT+9)',
104
+ },
105
+ {
106
+ offset: 9,
107
+ timezone: 'Asia/Seoul',
108
+ label: 'Asia/Seoul(GMT+9)',
109
+ },
110
+ ];
111
+
112
+ export const COLOR_PRESETS = [...BUILT_IN_THEME_PRESETS].slice(0, 7);
113
+
114
+ export { BUILT_IN_THEME_PRESETS, DEFAULT_TIME_ZONE_OPTIONS };
115
+
116
+ export type { BuiltinThemePreset };
@@ -0,0 +1,24 @@
1
+ /* oxlint-disable unicorn/prefer-export-from */
2
+ import type { Preferences } from './types';
3
+
4
+ import { preferencesManager } from './preferences';
5
+
6
+ export const {
7
+ getPreferences,
8
+ getCustomPreferences,
9
+ getInitialCustomPreferences,
10
+ getPreferencesExtension,
11
+ updatePreferences,
12
+ updateCustomPreferences,
13
+ resetPreferences,
14
+ clearCache,
15
+ initPreferences,
16
+ } = preferencesManager;
17
+
18
+ export const preferences: Preferences = getPreferences();
19
+
20
+ export { preferencesManager };
21
+
22
+ export * from './constants';
23
+ export type * from './types';
24
+ export * from './use-preferences';