create-bubbles 0.1.22 → 0.1.23

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 (54) hide show
  1. package/dist/index.mjs +5 -0
  2. package/package.json +1 -1
  3. package/template-vp-monorepo-react-nestjs/.vscode/settings.json +3 -2
  4. package/template-vp-monorepo-react-nestjs/apps/server/src/database/schema.ts +63 -4
  5. package/template-vp-monorepo-react-nestjs/vite.config.ts +2 -1
  6. package/template-vp-vue-eslint-vapor/.env +6 -0
  7. package/template-vp-vue-eslint-vapor/.env.development +2 -0
  8. package/template-vp-vue-eslint-vapor/.env.production +2 -0
  9. package/template-vp-vue-eslint-vapor/.vite-hooks/commit-msg +1 -0
  10. package/template-vp-vue-eslint-vapor/.vite-hooks/pre-commit +1 -0
  11. package/template-vp-vue-eslint-vapor/.vscode/extensions.json +3 -0
  12. package/template-vp-vue-eslint-vapor/AGENTS.md +16 -0
  13. package/template-vp-vue-eslint-vapor/README.md +93 -0
  14. package/template-vp-vue-eslint-vapor/commitlint.config.js +1 -0
  15. package/template-vp-vue-eslint-vapor/eslint.config.js +13 -0
  16. package/template-vp-vue-eslint-vapor/index.html +13 -0
  17. package/template-vp-vue-eslint-vapor/package.json +64 -0
  18. package/template-vp-vue-eslint-vapor/pnpm-workspace.yaml +2 -0
  19. package/template-vp-vue-eslint-vapor/public/vite.svg +1 -0
  20. package/template-vp-vue-eslint-vapor/src/App.vue +7 -0
  21. package/template-vp-vue-eslint-vapor/src/api/index.ts +12 -0
  22. package/template-vp-vue-eslint-vapor/src/assets/icon/home.svg +3 -0
  23. package/template-vp-vue-eslint-vapor/src/assets/icon/logo.svg +1 -0
  24. package/template-vp-vue-eslint-vapor/src/assets/image/.gitkeep +0 -0
  25. package/template-vp-vue-eslint-vapor/src/components/Icon/svg-icon.vue +29 -0
  26. package/template-vp-vue-eslint-vapor/src/hooks/chart/lib.ts +57 -0
  27. package/template-vp-vue-eslint-vapor/src/hooks/chart/useEcharts.ts +65 -0
  28. package/template-vp-vue-eslint-vapor/src/layout/default/header/index.vue +57 -0
  29. package/template-vp-vue-eslint-vapor/src/layout/default/index.vue +138 -0
  30. package/template-vp-vue-eslint-vapor/src/main.ts +19 -0
  31. package/template-vp-vue-eslint-vapor/src/router/guard/index.ts +7 -0
  32. package/template-vp-vue-eslint-vapor/src/router/guard/permissionGuard.ts +13 -0
  33. package/template-vp-vue-eslint-vapor/src/router/index.ts +18 -0
  34. package/template-vp-vue-eslint-vapor/src/router/interface.ts +9 -0
  35. package/template-vp-vue-eslint-vapor/src/router/modules/index.ts +33 -0
  36. package/template-vp-vue-eslint-vapor/src/store/index.ts +11 -0
  37. package/template-vp-vue-eslint-vapor/src/store/modules/user.ts +17 -0
  38. package/template-vp-vue-eslint-vapor/src/styles/font.scss +0 -0
  39. package/template-vp-vue-eslint-vapor/src/styles/index.scss +29 -0
  40. package/template-vp-vue-eslint-vapor/src/styles/variables.scss +3 -0
  41. package/template-vp-vue-eslint-vapor/src/types/vite-env.d.ts +15 -0
  42. package/template-vp-vue-eslint-vapor/src/utils/env.ts +11 -0
  43. package/template-vp-vue-eslint-vapor/src/utils/request/core/index.ts +425 -0
  44. package/template-vp-vue-eslint-vapor/src/utils/request/core/utils.ts +39 -0
  45. package/template-vp-vue-eslint-vapor/src/utils/request/index.ts +44 -0
  46. package/template-vp-vue-eslint-vapor/src/views/example/echart/config.ts +1794 -0
  47. package/template-vp-vue-eslint-vapor/src/views/example/echart/index.vue +20 -0
  48. package/template-vp-vue-eslint-vapor/src/views/example/tree-chart.vue +16 -0
  49. package/template-vp-vue-eslint-vapor/src/views/home/index.vue +16 -0
  50. package/template-vp-vue-eslint-vapor/src/views/login/index.vue +9 -0
  51. package/template-vp-vue-eslint-vapor/tsconfig.json +32 -0
  52. package/template-vp-vue-eslint-vapor/tsconfig.tsbuildinfo +1 -0
  53. package/template-vp-vue-eslint-vapor/uno.config.ts +17 -0
  54. package/template-vp-vue-eslint-vapor/vite.config.ts +66 -0
@@ -0,0 +1,138 @@
1
+ <script lang="ts" setup>
2
+ import { Menu as AntMenu } from "antdv-next";
3
+ import type { MenuProps } from "antdv-next";
4
+
5
+ import type { MenuRouteRecordRawType } from "@/router/interface";
6
+
7
+ import SvgIcon from "@/components/Icon/svg-icon.vue";
8
+
9
+ import { menuRoutes } from "@/router/modules";
10
+
11
+ import Header from "./header/index.vue";
12
+
13
+ const route = useRoute();
14
+ const router = useRouter();
15
+
16
+ const collapsed = ref(false);
17
+
18
+ const VaporCompatibleMenu = defineComponent({
19
+ inheritAttrs: false,
20
+ setup(_, { attrs }) {
21
+ return () => h(AntMenu, attrs);
22
+ },
23
+ });
24
+
25
+ const selectedKeys = computed(() => {
26
+ const matched = route.matched.map((item) => item.name);
27
+ return matched.filter(Boolean) as string[];
28
+ });
29
+
30
+ const openKeys = ref<string[]>([]);
31
+
32
+ watchEffect(() => {
33
+ const matched = route.matched.map((item) => item.name).filter(Boolean) as string[];
34
+ if (matched.length > 1) {
35
+ openKeys.value = [matched[0]];
36
+ }
37
+ });
38
+
39
+ function handleMenuClick({ key }: { key: string }) {
40
+ router.push({ name: key });
41
+ }
42
+
43
+ function renderIcon(icon?: string) {
44
+ if (!icon) return null;
45
+ const isSvgIcon = icon.startsWith("svg-");
46
+ if (isSvgIcon) {
47
+ return h(SvgIcon, {
48
+ icon: icon.replace("svg-", ""),
49
+ style: { fontSize: "18px" },
50
+ });
51
+ }
52
+ return null;
53
+ }
54
+
55
+ function getMenuItems(routes: MenuRouteRecordRawType[]): NonNullable<MenuProps["items"]> {
56
+ return routes
57
+ .filter((item) => !item.meta?.hideInMenu)
58
+ .map((item) => {
59
+ const hasChildren = item.children && item.children.length > 0;
60
+ if (hasChildren) {
61
+ return {
62
+ key: item.name as string,
63
+ label: item.meta?.title ?? String(item.name ?? ""),
64
+ icon: renderIcon(item.meta?.icon),
65
+ children: getMenuItems(item.children as MenuRouteRecordRawType[]),
66
+ };
67
+ }
68
+ return {
69
+ key: item.name as string,
70
+ label: item.meta?.title ?? String(item.name ?? ""),
71
+ icon: renderIcon(item.meta?.icon),
72
+ };
73
+ });
74
+ }
75
+
76
+ const menuItems = computed(() => getMenuItems(menuRoutes));
77
+ </script>
78
+
79
+ <template>
80
+ <ALayout class="h-screen">
81
+ <ALayoutSider
82
+ v-model:collapsed="collapsed"
83
+ :trigger="null"
84
+ collapsible
85
+ :width="220"
86
+ class="layout-sider"
87
+ >
88
+ <div class="logo flex-center gap-2 h-[var(--header-height)]">
89
+ <SvgIcon icon="logo" class="text-2xl" />
90
+ <span v-show="!collapsed" class="text-lg text-white font-bold"> Vue Template </span>
91
+ </div>
92
+ <VaporCompatibleMenu
93
+ v-model:open-keys="openKeys"
94
+ :selected-keys="selectedKeys"
95
+ :items="menuItems"
96
+ theme="dark"
97
+ mode="inline"
98
+ @click="handleMenuClick"
99
+ />
100
+ </ALayoutSider>
101
+
102
+ <ALayout>
103
+ <ALayoutHeader class="layout-header px-4 flex items-center justify-between">
104
+ <div class="flex gap-3 items-center">
105
+ <AButton type="text" class="flex-center" @click="collapsed = !collapsed">
106
+ <SvgIcon :icon="collapsed ? 'menu-unfold' : 'menu-fold'" style="font-size: 18px" />
107
+ </AButton>
108
+ </div>
109
+ <Header />
110
+ </ALayoutHeader>
111
+
112
+ <ALayoutContent class="layout-content p-4 overflow-auto">
113
+ <RouterView />
114
+ </ALayoutContent>
115
+ </ALayout>
116
+ </ALayout>
117
+ </template>
118
+
119
+ <style lang="scss" scoped>
120
+ .layout-sider {
121
+ position: sticky;
122
+ top: 0;
123
+ height: 100vh;
124
+ overflow: auto;
125
+ }
126
+
127
+ .layout-header {
128
+ height: var(--header-height);
129
+ background: #fff;
130
+ border-bottom: 1px solid #f0f0f0;
131
+ padding: 0;
132
+ }
133
+
134
+ .layout-content {
135
+ min-height: calc(100vh - var(--header-height));
136
+ background: #f5f5f5;
137
+ }
138
+ </style>
@@ -0,0 +1,19 @@
1
+ import type { VaporComponent } from 'vue'
2
+ import { createVaporApp, vaporInteropPlugin } from 'vue'
3
+
4
+ import App from './App.vue'
5
+ import { setupRouter } from './router'
6
+ import { setupStore } from './store'
7
+
8
+ import 'virtual:svg-icons-register'
9
+
10
+ import '@/styles/index.scss'
11
+ import 'virtual:uno.css'
12
+
13
+ // vue-tsc 3.3.8 still types SFC imports as VDOM components in global Vapor mode.
14
+ const app = createVaporApp(App as unknown as VaporComponent)
15
+ app.use(vaporInteropPlugin)
16
+ setupRouter(app)
17
+ setupStore(app)
18
+
19
+ app.mount('#app')
@@ -0,0 +1,7 @@
1
+ import type { Router } from "vue-router";
2
+
3
+ import { createPermissionGuard } from "./permissionGuard";
4
+
5
+ export function setupGuard(router: Router) {
6
+ createPermissionGuard(router);
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { Router } from 'vue-router'
2
+
3
+ import NProgress from 'nprogress'
4
+
5
+ export function createPermissionGuard(router: Router) {
6
+ router.beforeEach(() => {
7
+ NProgress.start()
8
+ })
9
+
10
+ router.afterEach(() => {
11
+ NProgress.done()
12
+ })
13
+ }
@@ -0,0 +1,18 @@
1
+ import type { App } from "vue";
2
+
3
+ import { createRouter, createWebHistory } from "vue-router";
4
+
5
+ import { setupGuard } from "./guard";
6
+ import { routes } from "./modules";
7
+
8
+ export const router = createRouter({
9
+ history: createWebHistory(import.meta.env.PUBLIC_PATH),
10
+ routes,
11
+ strict: true,
12
+ scrollBehavior: () => ({ left: 0, top: 0 }),
13
+ });
14
+
15
+ export function setupRouter(app: App) {
16
+ setupGuard(router);
17
+ app.use(router);
18
+ }
@@ -0,0 +1,9 @@
1
+ import type { RouteRecordRaw } from "vue-router";
2
+
3
+ export type MenuRouteRecordRawType = RouteRecordRaw & {
4
+ meta?: {
5
+ title?: string;
6
+ icon?: string;
7
+ hideInMenu?: boolean;
8
+ };
9
+ };
@@ -0,0 +1,33 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+
3
+ import type { MenuRouteRecordRawType } from '../interface'
4
+
5
+ export const menuRoutes: MenuRouteRecordRawType[] = [
6
+ {
7
+ path: '/home',
8
+ name: 'Home',
9
+ meta: { title: '首页概览', icon: 'svg-home' },
10
+ component: () => import('@/views/home/index.vue'),
11
+ },
12
+ ]
13
+
14
+ export const routes: RouteRecordRaw[] = [
15
+ {
16
+ path: '/',
17
+ name: 'layout',
18
+ component: () => import('@/layout/default/index.vue'),
19
+ children: [
20
+ {
21
+ path: '/',
22
+ redirect: '/home',
23
+ },
24
+ ...menuRoutes,
25
+ ],
26
+ },
27
+ {
28
+ path: '/login',
29
+ name: 'login',
30
+ meta: { title: '登录' },
31
+ component: () => import('@/views/login/index.vue'),
32
+ },
33
+ ]
@@ -0,0 +1,11 @@
1
+ import type { App } from "vue";
2
+
3
+ import { createPinia } from "pinia";
4
+ import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
5
+
6
+ export const store = createPinia();
7
+ store.use(piniaPluginPersistedstate);
8
+
9
+ export function setupStore(app: App) {
10
+ app.use(store);
11
+ }
@@ -0,0 +1,17 @@
1
+ import { defineStore } from "pinia";
2
+
3
+ import { store } from "..";
4
+
5
+ export const useUserStore = defineStore("user", {
6
+ state: () => {
7
+ return {
8
+ name: "admin",
9
+ token: "admin",
10
+ avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
11
+ };
12
+ },
13
+ });
14
+
15
+ export function useUserStoreWithOut() {
16
+ return useUserStore(store);
17
+ }
@@ -0,0 +1,29 @@
1
+ @use "./font.scss";
2
+ @use "./variables.scss";
3
+
4
+ html,
5
+ body,
6
+ #root {
7
+ width: 100%;
8
+ height: 100%;
9
+ font-family: "SourceHanSansCN";
10
+ }
11
+
12
+ *,
13
+ *::before,
14
+ *::after {
15
+ margin: 0;
16
+ padding: 0;
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ //弹窗的标题样式
21
+ .dialog-title {
22
+ border-left: 3px solid #22b5ffff;
23
+ padding-left: 10px;
24
+ height: 16px;
25
+ color: #ffffffb8;
26
+ font: 700;
27
+ font-size: 16px;
28
+ line-height: 16px;
29
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --header-height: 80px;
3
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ /* eslint-disable */
4
+ declare module "*.vue" {
5
+ import type { DefineComponent } from "vue";
6
+
7
+ const component: DefineComponent<{}, {}, any>;
8
+ export default component;
9
+ }
10
+
11
+ // vite-plugin-svg-icons 类型声明
12
+ declare module "virtual:svg-icons-register" {
13
+ const register: () => void;
14
+ export default register;
15
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 通过一个文件导出所有的环境变量这样方便统一修改
3
+ * @returns
4
+ */
5
+ export const envVariables = {
6
+ PORT: import.meta.env.VITE_PORT,
7
+ PATH: import.meta.env.VITE_PATH,
8
+ APP_NAME: import.meta.env.VITE_APP_NAME,
9
+ /** 后端接口前缀 */
10
+ API_AFFIX: import.meta.env.VITE_API_AFFIX,
11
+ };