create-bubbles 0.1.3 → 0.1.6

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 (53) hide show
  1. package/package.json +2 -2
  2. package/template-react-rsbuild-biome/biome.json +26 -4
  3. package/template-react-rsbuild-biome/package.json +24 -24
  4. package/template-react-rsbuild-biome/src/App.tsx +1 -0
  5. package/template-react-rsbuild-biome/src/pages/home/index.tsx +1 -1
  6. package/template-react-rsbuild-biome/src/types/auto-import.d.ts +40 -30
  7. package/template-react-rsbuild-biome/src/utils/request/core/index.ts +1 -1
  8. package/template-react-rsbuild-biome/uno.config.ts +2 -2
  9. package/template-vue-rsbuild-biome/biome.json +33 -5
  10. package/template-vue-vite-biome/biome.json +7 -2
  11. package/template-vue-vite-eslint/.env +4 -2
  12. package/template-vue-vite-eslint/.env.development +2 -1
  13. package/template-vue-vite-eslint/.vscode/settings.json +8 -0
  14. package/template-vue-vite-eslint/eslint.config.js +7 -2
  15. package/template-vue-vite-eslint/package.json +32 -26
  16. package/template-vue-vite-eslint/src/api/index.ts +12 -0
  17. package/template-vue-vite-eslint/src/assets/icon/computer-data.svg +3 -0
  18. package/template-vue-vite-eslint/src/assets/icon/cpu.svg +3 -0
  19. package/template-vue-vite-eslint/src/assets/icon/data-search.svg +3 -0
  20. package/template-vue-vite-eslint/src/assets/icon/home.svg +3 -0
  21. package/template-vue-vite-eslint/src/assets/icon/knowledge-graph.svg +3 -0
  22. package/template-vue-vite-eslint/src/assets/icon/robot.svg +3 -0
  23. package/template-vue-vite-eslint/src/assets/image/.gitkeep +0 -0
  24. package/template-vue-vite-eslint/src/components/Icon/svg-icon.vue +2 -2
  25. package/template-vue-vite-eslint/src/hooks/chart/lib.ts +57 -0
  26. package/template-vue-vite-eslint/src/hooks/chart/useEcharts.ts +65 -0
  27. package/template-vue-vite-eslint/src/layout/default/header/index.vue +12 -0
  28. package/template-vue-vite-eslint/src/layout/default/index.vue +53 -1
  29. package/template-vue-vite-eslint/src/main.ts +1 -0
  30. package/template-vue-vite-eslint/src/router/interface.ts +9 -0
  31. package/template-vue-vite-eslint/src/router/modules/example.ts +21 -0
  32. package/template-vue-vite-eslint/src/router/modules/index.ts +14 -9
  33. package/template-vue-vite-eslint/src/styles/element-plus-variables.css +1 -2
  34. package/template-vue-vite-eslint/src/styles/index.scss +2 -0
  35. package/template-vue-vite-eslint/src/styles/plus-pro-components-variables.css +3 -0
  36. package/template-vue-vite-eslint/src/types/auto-import.d.ts +78 -0
  37. package/template-vue-vite-eslint/src/types/components.d.ts +22 -0
  38. package/template-vue-vite-eslint/src/types/index.d.ts +1 -0
  39. package/template-vue-vite-eslint/src/utils/env.ts +5 -4
  40. package/template-vue-vite-eslint/src/utils/request/core/index.ts +19 -5
  41. package/template-vue-vite-eslint/src/utils/request/index.ts +4 -1
  42. package/template-vue-vite-eslint/src/views/example/echart/config.ts +1794 -0
  43. package/template-vue-vite-eslint/src/views/example/echart/index.vue +22 -0
  44. package/template-vue-vite-eslint/src/views/example/h-full.vue +24 -0
  45. package/template-vue-vite-eslint/src/views/example/tree-chart.vue +94 -0
  46. package/template-vue-vite-eslint/src/views/home/index.vue +3 -2
  47. package/template-vue-vite-eslint/tsconfig.json +1 -1
  48. package/template-vue-vite-eslint/uno.config.ts +6 -2
  49. package/template-vue-vite-eslint/vite.config.ts +13 -4
  50. package/template-vue-vite-eslint/.gitlab-ci.yml +0 -84
  51. package/template-vue-vite-eslint/src/views/model/index.vue +0 -7
  52. /package/dist/{index.js → index.mjs} +0 -0
  53. /package/template-vue-vite-eslint/src/assets/icon/{vue.svg → logo.svg} +0 -0
@@ -0,0 +1,65 @@
1
+ import type { EChartsOption } from 'echarts'
2
+
3
+ import type { ShallowRef } from 'vue'
4
+
5
+ import { debounce } from 'radashi'
6
+
7
+ import echarts from './lib'
8
+
9
+ type setOptionsType = (options: EChartsOption, clear?: boolean) => void
10
+
11
+ export function useECharts(elRef: Ref<HTMLDivElement> | Readonly<ShallowRef<HTMLDivElement | null>>) {
12
+ let chartInstance: echarts.ECharts | null = null
13
+ let resizeObserver: ResizeObserver | undefined
14
+
15
+ const resize = () => {
16
+ chartInstance?.resize()
17
+ }
18
+
19
+ const initCharts = () => {
20
+ if (!elRef)
21
+ return
22
+ const el = unref(elRef)
23
+ if (!el)
24
+ return
25
+
26
+ resizeObserver = new ResizeObserver(debounce(
27
+ {
28
+ delay: 100,
29
+ },
30
+ resize,
31
+ ))
32
+ resizeObserver.observe(el)
33
+
34
+ chartInstance = echarts.init(el)
35
+ }
36
+
37
+ const setOptions: setOptionsType = (options, clear = true) => {
38
+ if (!chartInstance) {
39
+ initCharts()
40
+ if (!chartInstance)
41
+ return
42
+ }
43
+ clear && chartInstance?.clear()
44
+ chartInstance?.setOption(options)
45
+ }
46
+
47
+ const getInstance: () => echarts.ECharts | null = () => {
48
+ if (!chartInstance)
49
+ initCharts()
50
+ return chartInstance
51
+ }
52
+
53
+ onUnmounted(() => {
54
+ chartInstance?.dispose()
55
+ resizeObserver?.disconnect()
56
+ resizeObserver = undefined
57
+ })
58
+
59
+ return {
60
+ setOptions,
61
+ resize,
62
+ echarts,
63
+ getInstance,
64
+ }
65
+ }
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts">
2
+ </script>
3
+
4
+ <template>
5
+ <div class="index-container">
6
+ 111
7
+ </div>
8
+ </template>
9
+
10
+ <style lang="scss" scoped>
11
+
12
+ </style>
@@ -1,3 +1,55 @@
1
+ <script lang="ts" setup>
2
+ import type { MenuRouteRecordRawType } from '@/router/interface'
3
+
4
+ import LogoIcon from '@/assets/icon/logo.svg'
5
+ import { menuRoutes } from '@/router/modules'
6
+
7
+ import SvgIcon from '@/components/Icon/svg-icon.vue'
8
+
9
+ import Header from './header/index.vue'
10
+
11
+ function getRoutes(routes: MenuRouteRecordRawType[]) {
12
+ const result = routes.map((item) => {
13
+ const isSvgIcon = (item.meta?.icon as string | undefined)?.startsWith('svg-')
14
+ return ({
15
+ path: item.path,
16
+ name: item.name,
17
+ component: item.component,
18
+ meta: {
19
+ title: item.meta?.title,
20
+ icon: isSvgIcon ? h(SvgIcon, { icon: (item.meta?.icon as string).replace('svg-', ''), style: { fontSize: '20px' } }) : undefined,
21
+ hideInMenu: item.meta?.hideInMenu,
22
+ },
23
+ children: item.children,
24
+ })
25
+ })
26
+ result.forEach((item) => {
27
+ if (item.children) {
28
+ item.children = getRoutes(item.children) as MenuRouteRecordRawType[]
29
+ }
30
+ })
31
+ return result
32
+ }
33
+
34
+ const routes = getRoutes(menuRoutes)
35
+ </script>
36
+
1
37
  <template>
2
- <router-view />
38
+ <PlusLayout
39
+ :sidebar-props="{ routes }"
40
+ :has-breadcrumb="false"
41
+ :header-props="{
42
+ hasUserInfo: false,
43
+ }"
44
+ >
45
+ <template #header-left>
46
+ <h1>111</h1>
47
+ </template>
48
+
49
+ <template #header-right>
50
+ <Header />
51
+ </template>
52
+
53
+ <router-view />
54
+ </PlusLayout>
3
55
  </template>
@@ -13,4 +13,5 @@ import 'virtual:uno.css'
13
13
  const app = createApp(App)
14
14
  setupRouter(app)
15
15
  setupStore(app)
16
+
16
17
  app.mount('#app')
@@ -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,21 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+
3
+ export const ExampleRoutes: RouteRecordRaw[] = [
4
+ {
5
+ path: '/example',
6
+ name: 'Example',
7
+ children: [
8
+ {
9
+ path: 'echart',
10
+ name: 'Echart',
11
+ component: () => import('@/views/example/echart/index.vue'),
12
+ },
13
+
14
+ {
15
+ path: 'tree-chart',
16
+ name: 'TreeChart',
17
+ component: () => import('@/views/example/tree-chart.vue'),
18
+ },
19
+ ],
20
+ },
21
+ ]
@@ -1,8 +1,17 @@
1
1
  import type { RouteRecordRaw } from 'vue-router'
2
2
 
3
- /**
4
- * IsMaskAll 代表 是不是要和模型交互 为true 全部遮罩
5
- */
3
+ import type { MenuRouteRecordRawType } from '../interface'
4
+
5
+ import { ExampleRoutes } from './example'
6
+
7
+ export const menuRoutes: MenuRouteRecordRawType [] = [
8
+ {
9
+ path: '/home',
10
+ name: 'Home',
11
+ meta: { title: '首页概览', icon: 'svg-home' },
12
+ component: () => import('@/views/home/index.vue'),
13
+ },
14
+ ]
6
15
 
7
16
  export const routes: RouteRecordRaw[] = [
8
17
  {
@@ -14,14 +23,10 @@ export const routes: RouteRecordRaw[] = [
14
23
  path: '/',
15
24
  redirect: '/home',
16
25
  },
17
- {
18
- path: '/home',
19
- name: 'Home',
20
- meta: { title: '研发A区数字孪生可视化大屏' },
21
- component: () => import('@/views/home/index.vue'),
22
- },
26
+ ...menuRoutes,
23
27
  ],
24
28
  },
29
+ ...ExampleRoutes,
25
30
  {
26
31
  path: '/login',
27
32
  name: 'login',
@@ -1,4 +1,3 @@
1
1
  :root:has(#app) {
2
- --el-color-primary: #284471;
3
- --el-color-primary-light-3: rgb(40, 68, 113, 0.8);
2
+ --el-color-primary: #409effff;
4
3
  }
@@ -1,6 +1,8 @@
1
1
  @use './font.scss';
2
2
  @use './variables.scss';
3
3
  @use './element-plus-variables.css';
4
+ @use './plus-pro-components-variables.css';
5
+ @use 'element-plus/theme-chalk/dark/css-vars.css';
4
6
 
5
7
  html,
6
8
  body,
@@ -0,0 +1,3 @@
1
+ :root .el-header {
2
+ --el-header-height: 56px;
3
+ }
@@ -0,0 +1,78 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // noinspection JSUnusedGlobalSymbols
5
+ // Generated by unplugin-auto-import
6
+ // biome-ignore lint: disable
7
+ export {}
8
+ declare global {
9
+ const EffectScope: typeof import('vue').EffectScope
10
+ const computed: typeof import('vue').computed
11
+ const createApp: typeof import('vue').createApp
12
+ const customRef: typeof import('vue').customRef
13
+ const defineAsyncComponent: typeof import('vue').defineAsyncComponent
14
+ const defineComponent: typeof import('vue').defineComponent
15
+ const effectScope: typeof import('vue').effectScope
16
+ const getCurrentInstance: typeof import('vue').getCurrentInstance
17
+ const getCurrentScope: typeof import('vue').getCurrentScope
18
+ const getCurrentWatcher: typeof import('vue').getCurrentWatcher
19
+ const h: typeof import('vue').h
20
+ const inject: typeof import('vue').inject
21
+ const isProxy: typeof import('vue').isProxy
22
+ const isReactive: typeof import('vue').isReactive
23
+ const isReadonly: typeof import('vue').isReadonly
24
+ const isRef: typeof import('vue').isRef
25
+ const isShallow: typeof import('vue').isShallow
26
+ const markRaw: typeof import('vue').markRaw
27
+ const nextTick: typeof import('vue').nextTick
28
+ const onActivated: typeof import('vue').onActivated
29
+ const onBeforeMount: typeof import('vue').onBeforeMount
30
+ const onBeforeRouteLeave: typeof import('vue-router').onBeforeRouteLeave
31
+ const onBeforeRouteUpdate: typeof import('vue-router').onBeforeRouteUpdate
32
+ const onBeforeUnmount: typeof import('vue').onBeforeUnmount
33
+ const onBeforeUpdate: typeof import('vue').onBeforeUpdate
34
+ const onDeactivated: typeof import('vue').onDeactivated
35
+ const onErrorCaptured: typeof import('vue').onErrorCaptured
36
+ const onMounted: typeof import('vue').onMounted
37
+ const onRenderTracked: typeof import('vue').onRenderTracked
38
+ const onRenderTriggered: typeof import('vue').onRenderTriggered
39
+ const onScopeDispose: typeof import('vue').onScopeDispose
40
+ const onServerPrefetch: typeof import('vue').onServerPrefetch
41
+ const onUnmounted: typeof import('vue').onUnmounted
42
+ const onUpdated: typeof import('vue').onUpdated
43
+ const onWatcherCleanup: typeof import('vue').onWatcherCleanup
44
+ const provide: typeof import('vue').provide
45
+ const reactive: typeof import('vue').reactive
46
+ const readonly: typeof import('vue').readonly
47
+ const ref: typeof import('vue').ref
48
+ const resolveComponent: typeof import('vue').resolveComponent
49
+ const shallowReactive: typeof import('vue').shallowReactive
50
+ const shallowReadonly: typeof import('vue').shallowReadonly
51
+ const shallowRef: typeof import('vue').shallowRef
52
+ const toRaw: typeof import('vue').toRaw
53
+ const toRef: typeof import('vue').toRef
54
+ const toRefs: typeof import('vue').toRefs
55
+ const toValue: typeof import('vue').toValue
56
+ const triggerRef: typeof import('vue').triggerRef
57
+ const unref: typeof import('vue').unref
58
+ const useAttrs: typeof import('vue').useAttrs
59
+ const useCssModule: typeof import('vue').useCssModule
60
+ const useCssVars: typeof import('vue').useCssVars
61
+ const useId: typeof import('vue').useId
62
+ const useLink: typeof import('vue-router').useLink
63
+ const useModel: typeof import('vue').useModel
64
+ const useRoute: typeof import('vue-router').useRoute
65
+ const useRouter: typeof import('vue-router').useRouter
66
+ const useSlots: typeof import('vue').useSlots
67
+ const useTemplateRef: typeof import('vue').useTemplateRef
68
+ const watch: typeof import('vue').watch
69
+ const watchEffect: typeof import('vue').watchEffect
70
+ const watchPostEffect: typeof import('vue').watchPostEffect
71
+ const watchSyncEffect: typeof import('vue').watchSyncEffect
72
+ }
73
+ // for type re-export
74
+ declare global {
75
+ // @ts-ignore
76
+ export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
77
+ import('vue')
78
+ }
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // biome-ignore lint: disable
4
+ // oxlint-disable
5
+ // ------
6
+ // Generated by unplugin-vue-components
7
+ // Read more: https://github.com/vuejs/core/pull/3399
8
+
9
+ export {}
10
+
11
+ /* prettier-ignore */
12
+ declare module 'vue' {
13
+ export interface GlobalComponents {
14
+ ElButton: typeof import('element-plus/es')['ElButton']
15
+ ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
16
+ ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
17
+ PlusLayout: typeof import('plus-pro-components/es')['PlusLayout']
18
+ RouterLink: typeof import('vue-router')['RouterLink']
19
+ RouterView: typeof import('vue-router')['RouterView']
20
+ SvgIcon: typeof import('./../components/Icon/svg-icon.vue')['default']
21
+ }
22
+ }
@@ -0,0 +1 @@
1
+ // 扩展 vue-router 的类型
@@ -3,8 +3,9 @@
3
3
  * @returns
4
4
  */
5
5
  export const envVariables = {
6
- PUBLIC_PORT: import.meta.env.PUBLIC_PORT,
7
- PUBLIC_PATH: import.meta.env.PUBLIC_PATH,
8
- PUBLIC_APP_NAME: import.meta.env.PUBLIC_APP_NAME,
9
- PUBLIC_API_AFFIX: import.meta.env.PUBLIC_API_AFFIX,
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,
10
11
  }
@@ -20,6 +20,9 @@ export interface baseRequestOption<AG extends AlovaGenerics> {
20
20
  timeout?: number
21
21
  commonHeaders?: Record<string, string | (() => string)>
22
22
  statusMap?: statusMap
23
+ isWrapped?: boolean
24
+ cacheFor?: AlovaOptions<AG>['cacheFor']
25
+ cacheLogger?: boolean
23
26
  codeMap?: codeMap
24
27
  responseDataKey?: string
25
28
  responseMessageKey?: string
@@ -51,6 +54,9 @@ export function createInstance(option: requestOption) {
51
54
  success: 200,
52
55
  unAuthorized: 401,
53
56
  },
57
+ isWrapped: true,
58
+ cacheFor: null,
59
+ cacheLogger: true,
54
60
  codeMap: {
55
61
  success: [200],
56
62
  unAuthorized: [401],
@@ -73,6 +79,8 @@ export function createInstance(option: requestOption) {
73
79
  const instance = createAlova({
74
80
  baseURL: mergeOption.baseUrl,
75
81
  timeout: mergeOption.timeout,
82
+ cacheFor: mergeOption.cacheFor,
83
+ cacheLogger: mergeOption.cacheLogger,
76
84
  statesHook: mergeOption?.statesHook,
77
85
  requestAdapter: mergeOption.requestAdapter as AlovaOptions<AlovaGenerics>['requestAdapter'],
78
86
  beforeRequest: async (method) => {
@@ -99,12 +107,19 @@ export function createInstance(option: requestOption) {
99
107
  }
100
108
  return Promise.reject(response)
101
109
  }
110
+ const { isWrapped, isShowSuccessMessage, successDefaultMessage } = mergeOption
111
+ if (!isWrapped) {
112
+ if (isShowSuccessMessage) {
113
+ mergeOption?.successMessageFunc?.(successDefaultMessage!)
114
+ }
115
+ return data
116
+ }
102
117
 
103
118
  const {
104
119
  responseDataKey,
105
120
  codeMap,
106
- isShowSuccessMessage,
107
121
  responseMessageKey,
122
+ errorDefaultMessage,
108
123
  isShowErrorMessage,
109
124
  } = mergeOption
110
125
  const {
@@ -120,19 +135,19 @@ export function createInstance(option: requestOption) {
120
135
  }
121
136
  // 其他错误直接打印msg
122
137
 
123
- const errorMessage = data[responseMessageKey as string] ?? mergeOption.errorDefaultMessage
138
+ const errorMessage = data[responseMessageKey as string] ?? errorDefaultMessage
124
139
  if (isShowErrorMessage)
125
140
  mergeOption?.errorMessageFunc?.(errorMessage)
126
141
  return Promise.reject(response)
127
142
  }
128
143
  if (isShowSuccessMessage)
129
- mergeOption?.successMessageFunc?.(responseMessage ?? mergeOption.successDefaultMessage)
144
+ mergeOption?.successMessageFunc?.(responseMessage ?? successDefaultMessage)
130
145
  return responseData
131
146
  },
132
147
  onError: (error) => {
133
148
  if (mergeOption?.isShowErrorMessage) {
134
149
  mergeOption.errorMessageFunc?.(
135
- error.response?.data?.message ?? mergeOption?.errorDefaultMessage,
150
+ mergeOption?.errorDefaultMessage ?? error.message,
136
151
  )
137
152
  }
138
153
  },
@@ -158,7 +173,6 @@ export function createDualCallInstance(baseConfig: baseRequestOption<AlovaGeneri
158
173
  return defaultInstance
159
174
  }
160
175
 
161
- // 🎯 直接绑定 HTTP 方法,无需复杂类型注释
162
176
  dualInstance.Get = defaultInstance.Get.bind(defaultInstance)
163
177
  dualInstance.Post = defaultInstance.Post.bind(defaultInstance)
164
178
  dualInstance.Put = defaultInstance.Put.bind(defaultInstance)
@@ -1,14 +1,17 @@
1
1
  import { axiosRequestAdapter } from '@alova/adapter-axios'
2
2
  import vueHook from 'alova/vue'
3
3
  import { ElMessage } from 'element-plus'
4
+
4
5
  import { router } from '@/router'
6
+
5
7
  import { envVariables } from '../env'
6
8
  import { createDualCallInstance } from './core'
9
+
7
10
  import 'element-plus/es/components/message/style/css'
8
11
 
9
12
  function getBaseConfig(): Parameters<typeof createDualCallInstance>[0] {
10
13
  return {
11
- baseUrl: `/${envVariables.PUBLIC_PORT}`,
14
+ baseUrl: `/${envVariables.API_AFFIX}`,
12
15
  statusMap: {
13
16
  success: 200,
14
17
  unAuthorized: 401,