create-packer 1.44.0 → 1.44.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/package.json +1 -1
- package/template/web-app/react-rsbuild/domain/app/app.model.ts +1 -1
- package/template/web-app/react-rsbuild/domain/router/components/route-layout.tsx +1 -1
- package/template/web-app/react-rsbuild/domain/router/components/sub-route-outlet.tsx +1 -1
- package/template/web-app/react-rsbuild/package.json +2 -3
- package/template/web-app/react-rsbuild/shared/hooks/defineRouter/deineRouter.tsx +3 -3
- package/template/web-app/react-rsbuild/shared/hooks/useSyncState.ts +2 -2
- package/template/web-app/react-rsbuild/shared/hooks/useVisible.ts +1 -1
- package/template/web-app/react-rsbuild/shared/service/home.ts +2 -2
- package/template/web-app/react-vite/domain/app/app.model.ts +1 -1
- package/template/web-app/react-vite/domain/app/components/app-context.tsx +22 -22
- package/template/web-app/react-vite/domain/app/components/app.tsx +24 -24
- package/template/web-app/react-vite/package.json +2 -3
- package/template/web-app/react-vite/shared/hooks/defineRouter/deineRouter.tsx +3 -3
- package/template/web-app/react-vite/shared/service/home.ts +2 -2
- package/template/web-app/react-vite/vite-env.d.ts +12 -12
- package/template/web-app/react-vite/vite.config.ts +80 -80
- package/template/web-app/svelte/package.json +1 -2
- package/template/web-app/vue/package.json +1 -2
- package/template/web-app/vue-rsbuild/package.json +1 -2
- package/template/web-extension/package.json +3 -4
- package/template/web-extension/shared/components/app-context/view.tsx +1 -1
- package/template/web-extension/shared/styles/global-style.ts +9 -0
- package/template/web-extension/shared/styles/theme.styled.ts +12 -21
- package/template/web-extension/vite-env.d.ts +3 -3
- package/template/web-extension/wxt.config.ts +11 -1
- package/template/web-extension/shared/styles/global-style.tsx +0 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react'
|
|
2
2
|
import { Outlet } from 'react-router'
|
|
3
3
|
import { useMount } from 'react-use'
|
|
4
|
-
import { last } from '
|
|
4
|
+
import { last } from 'es-toolkit'
|
|
5
5
|
import { useMatchRoutes, useRouter, routeType } from '@/domain/router'
|
|
6
6
|
|
|
7
7
|
export interface propsType {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@tanstack/react-query": "5.51.15",
|
|
23
23
|
"axios": "1.7.9",
|
|
24
|
-
"define-zustand": "3.
|
|
24
|
+
"define-zustand": "3.4.0",
|
|
25
|
+
"es-toolkit": "1.37.2",
|
|
25
26
|
"immer": "10.0.1",
|
|
26
|
-
"lodash-es": "4.17.21",
|
|
27
27
|
"qs": "6.11.2",
|
|
28
28
|
"react": "18.3.1",
|
|
29
29
|
"react-dom": "18.3.1",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"@rsbuild/plugin-type-check": "1.2.1",
|
|
46
46
|
"@rsdoctor/rspack-plugin": "0.4.13",
|
|
47
47
|
"@tailwindcss/postcss": "4.1.4",
|
|
48
|
-
"@types/lodash-es": "4.17.12",
|
|
49
48
|
"@types/node": "18.16.0",
|
|
50
49
|
"@types/qs": "6.9.7",
|
|
51
50
|
"@types/react": "18.3.3",
|
|
@@ -10,7 +10,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
|
|
|
10
10
|
state: () => ({
|
|
11
11
|
routes: cloneDeep(router.routes) as routeType[]
|
|
12
12
|
}),
|
|
13
|
-
|
|
13
|
+
getters: {
|
|
14
14
|
routesById: state => {
|
|
15
15
|
return (function flat(routes: routeType[], parentRoute?: routeByIdType) {
|
|
16
16
|
return reduce(
|
|
@@ -36,7 +36,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
|
|
|
36
36
|
})(state.routes)
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
actions: (
|
|
39
|
+
actions: (setState, getState) => {
|
|
40
40
|
function posToLodashPath(pos: string) {
|
|
41
41
|
if (pos) {
|
|
42
42
|
return `[${split(pos, '-').join('].children[')}]`
|
|
@@ -52,7 +52,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
|
|
|
52
52
|
const newRoute = cloneDeep(omit(route, ['element', 'errorElement', 'children']))
|
|
53
53
|
updator(newRoute)
|
|
54
54
|
assign(route, newRoute)
|
|
55
|
-
|
|
55
|
+
setState({ routes: newRoutes })
|
|
56
56
|
}
|
|
57
57
|
function getRoute(id: routeType['id'], path?: string | string[]) {
|
|
58
58
|
const { routesById } = getState()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useRef, useState, Dispatch, SetStateAction } from 'react'
|
|
2
|
-
import { isFunction } from '
|
|
2
|
+
import { isFunction } from 'es-toolkit'
|
|
3
3
|
|
|
4
4
|
export function useSyncState<S>(initialState: S | (() => S)) {
|
|
5
5
|
const [state, setState] = useState(initialState)
|
|
6
6
|
const syncState = useRef<S>(state)
|
|
7
7
|
|
|
8
8
|
const $setState: Dispatch<SetStateAction<S>> = newState => {
|
|
9
|
-
const $newState = isFunction(newState) ? newState(state) : newState
|
|
9
|
+
const $newState = (isFunction(newState) ? newState(state) : newState) as S
|
|
10
10
|
setState($newState)
|
|
11
11
|
syncState.current = $newState
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useQuery,
|
|
1
|
+
import { useQuery, QueryOptions } from '@tanstack/react-query'
|
|
2
2
|
import { HOME_DATA } from './api'
|
|
3
3
|
|
|
4
|
-
export const useHomeData = (options?:
|
|
4
|
+
export const useHomeData = (options?: QueryOptions) => {
|
|
5
5
|
return useQuery({
|
|
6
6
|
...options,
|
|
7
7
|
queryKey: [HOME_DATA, ...(options?.queryKey || [])]
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
-
import { request } from '@/shared/service'
|
|
4
|
-
|
|
5
|
-
const queryClient = new QueryClient({
|
|
6
|
-
defaultOptions: {
|
|
7
|
-
queries: {
|
|
8
|
-
queryFn: async ({ queryKey }) => {
|
|
9
|
-
const { data } = await request.get(queryKey[0] as string, {
|
|
10
|
-
params: queryKey[1]
|
|
11
|
-
})
|
|
12
|
-
return data
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
export interface propsType {
|
|
18
|
-
children: ReactNode
|
|
19
|
-
}
|
|
20
|
-
export const Root: FunctionComponent<propsType> = props => {
|
|
21
|
-
return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
22
|
-
}
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
+
import { request } from '@/shared/service'
|
|
4
|
+
|
|
5
|
+
const queryClient = new QueryClient({
|
|
6
|
+
defaultOptions: {
|
|
7
|
+
queries: {
|
|
8
|
+
queryFn: async ({ queryKey }) => {
|
|
9
|
+
const { data } = await request.get(queryKey[0] as string, {
|
|
10
|
+
params: queryKey[1]
|
|
11
|
+
})
|
|
12
|
+
return data
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
export interface propsType {
|
|
18
|
+
children: ReactNode
|
|
19
|
+
}
|
|
20
|
+
export const Root: FunctionComponent<propsType> = props => {
|
|
21
|
+
return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
22
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { useLayoutEffect, Suspense } from 'react'
|
|
2
|
-
import { RouterProvider } from 'react-router/dom'
|
|
3
|
-
import { request } from '@/shared/service'
|
|
4
|
-
import { routerInstance } from '@/domain/router'
|
|
5
|
-
import * as AppContext from './app-context'
|
|
6
|
-
|
|
7
|
-
export const Root = () => {
|
|
8
|
-
useLayoutEffect(() => {
|
|
9
|
-
request.interceptors.response.use(
|
|
10
|
-
res => res,
|
|
11
|
-
error => {
|
|
12
|
-
console.log(error)
|
|
13
|
-
}
|
|
14
|
-
)
|
|
15
|
-
}, [])
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<AppContext.Root>
|
|
19
|
-
<Suspense fallback={<>loading...</>}>
|
|
20
|
-
<RouterProvider router={routerInstance} />
|
|
21
|
-
</Suspense>
|
|
22
|
-
</AppContext.Root>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
1
|
+
import { useLayoutEffect, Suspense } from 'react'
|
|
2
|
+
import { RouterProvider } from 'react-router/dom'
|
|
3
|
+
import { request } from '@/shared/service'
|
|
4
|
+
import { routerInstance } from '@/domain/router'
|
|
5
|
+
import * as AppContext from './app-context'
|
|
6
|
+
|
|
7
|
+
export const Root = () => {
|
|
8
|
+
useLayoutEffect(() => {
|
|
9
|
+
request.interceptors.response.use(
|
|
10
|
+
res => res,
|
|
11
|
+
error => {
|
|
12
|
+
console.log(error)
|
|
13
|
+
}
|
|
14
|
+
)
|
|
15
|
+
}, [])
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<AppContext.Root>
|
|
19
|
+
<Suspense fallback={<>loading...</>}>
|
|
20
|
+
<RouterProvider router={routerInstance} />
|
|
21
|
+
</Suspense>
|
|
22
|
+
</AppContext.Root>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@tanstack/react-query": "5.51.15",
|
|
22
22
|
"axios": "1.7.9",
|
|
23
|
-
"define-zustand": "3.
|
|
23
|
+
"define-zustand": "3.4.0",
|
|
24
|
+
"es-toolkit": "1.37.2",
|
|
24
25
|
"immer": "10.0.1",
|
|
25
|
-
"lodash-es": "4.17.21",
|
|
26
26
|
"qs": "6.11.2",
|
|
27
27
|
"react": "18.3.1",
|
|
28
28
|
"react-dom": "18.3.1",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@eslint/js": "9.15.0",
|
|
41
41
|
"@faker-js/faker": "8.4.1",
|
|
42
42
|
"@tailwindcss/vite": "4.1.4",
|
|
43
|
-
"@types/lodash-es": "4.17.12",
|
|
44
43
|
"@types/node": "18.16.0",
|
|
45
44
|
"@types/qs": "6.9.7",
|
|
46
45
|
"@types/react": "18.3.3",
|
|
@@ -10,7 +10,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
|
|
|
10
10
|
state: () => ({
|
|
11
11
|
routes: cloneDeep(router.routes) as routeType[]
|
|
12
12
|
}),
|
|
13
|
-
|
|
13
|
+
getters: {
|
|
14
14
|
routesById: state => {
|
|
15
15
|
return (function flat(routes: routeType[], parentRoute?: routeByIdType) {
|
|
16
16
|
return reduce(
|
|
@@ -36,7 +36,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
|
|
|
36
36
|
})(state.routes)
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
actions: (
|
|
39
|
+
actions: (setState, getState) => {
|
|
40
40
|
function posToLodashPath(pos: string) {
|
|
41
41
|
if (pos) {
|
|
42
42
|
return `[${split(pos, '-').join('].children[')}]`
|
|
@@ -52,7 +52,7 @@ export default function defineRouter(router: ReturnType<typeof createBrowserRout
|
|
|
52
52
|
const newRoute = cloneDeep(omit(route, ['element', 'errorElement', 'children']))
|
|
53
53
|
updator(newRoute)
|
|
54
54
|
assign(route, newRoute)
|
|
55
|
-
|
|
55
|
+
setState({ routes: newRoutes })
|
|
56
56
|
}
|
|
57
57
|
function getRoute(id: routeType['id'], path?: string | string[]) {
|
|
58
58
|
const { routesById } = getState()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useQuery,
|
|
1
|
+
import { useQuery, QueryOptions } from '@tanstack/react-query'
|
|
2
2
|
import { HOME_DATA } from './api'
|
|
3
3
|
|
|
4
|
-
export const useHomeData = (options?:
|
|
4
|
+
export const useHomeData = (options?: QueryOptions) => {
|
|
5
5
|
return useQuery({
|
|
6
6
|
...options,
|
|
7
7
|
queryKey: [HOME_DATA, ...(options?.queryKey || [])]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
/// <reference types="vite-plugin-svgr/client" />
|
|
3
|
-
|
|
4
|
-
interface ImportMetaEnv {
|
|
5
|
-
readonly VITE_BASE_URL: string
|
|
6
|
-
readonly VITE_API_HOST: string
|
|
7
|
-
// 更多环境变量...
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface ImportMeta {
|
|
11
|
-
readonly env: ImportMetaEnv
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
/// <reference types="vite-plugin-svgr/client" />
|
|
3
|
+
|
|
4
|
+
interface ImportMetaEnv {
|
|
5
|
+
readonly VITE_BASE_URL: string
|
|
6
|
+
readonly VITE_API_HOST: string
|
|
7
|
+
// 更多环境变量...
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ImportMeta {
|
|
11
|
+
readonly env: ImportMetaEnv
|
|
12
|
+
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
-
import react from '@vitejs/plugin-react'
|
|
3
|
-
import svgr from 'vite-plugin-svgr'
|
|
4
|
-
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
5
|
-
import checker from 'vite-plugin-checker'
|
|
6
|
-
import { visualizer } from 'rollup-plugin-visualizer'
|
|
7
|
-
import { includes } from 'lodash-es'
|
|
8
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
9
|
-
import { createChunks } from './scripts'
|
|
10
|
-
|
|
11
|
-
// https://vitejs.dev/config/
|
|
12
|
-
export default defineConfig(({ mode }) => {
|
|
13
|
-
const env = loadEnv(mode, process.cwd(), '')
|
|
14
|
-
const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
|
|
15
|
-
const plugins: any[] = [
|
|
16
|
-
tailwindcss(),
|
|
17
|
-
svgr(),
|
|
18
|
-
mockDevServer({
|
|
19
|
-
include: ['**/*.mock.{ts,js}']
|
|
20
|
-
}),
|
|
21
|
-
checker({
|
|
22
|
-
enableBuild: false,
|
|
23
|
-
typescript: true,
|
|
24
|
-
eslint: { useFlatConfig: true, lintCommand: 'eslint', dev: { logLevel: ['error'] } }
|
|
25
|
-
}),
|
|
26
|
-
react({
|
|
27
|
-
babel: {
|
|
28
|
-
plugins: [
|
|
29
|
-
[
|
|
30
|
-
'babel-plugin-styled-components',
|
|
31
|
-
{
|
|
32
|
-
ssr: false,
|
|
33
|
-
displayName: false,
|
|
34
|
-
fileName: false,
|
|
35
|
-
transpileTemplateLiterals: false
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
if (mode === 'analyse') {
|
|
44
|
-
plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
base: env.VITE_BASE_URL,
|
|
49
|
-
plugins,
|
|
50
|
-
resolve: {
|
|
51
|
-
alias: {
|
|
52
|
-
'@': __dirname
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
esbuild: {
|
|
56
|
-
drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
|
|
57
|
-
},
|
|
58
|
-
build: {
|
|
59
|
-
sourcemap: mode === 'analyse',
|
|
60
|
-
reportCompressedSize: mode === 'analyse',
|
|
61
|
-
rollupOptions: {
|
|
62
|
-
output: {
|
|
63
|
-
manualChunks: createChunks({
|
|
64
|
-
react: ['react', 'react-dom']
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
server: {
|
|
70
|
-
host: '0.0.0.0',
|
|
71
|
-
proxy: {
|
|
72
|
-
[proxyBaseUrl]: {
|
|
73
|
-
target: 'http://127.0.0.1',
|
|
74
|
-
changeOrigin: true,
|
|
75
|
-
rewrite: path => path.replace(proxyBaseUrl, '')
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import svgr from 'vite-plugin-svgr'
|
|
4
|
+
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
5
|
+
import checker from 'vite-plugin-checker'
|
|
6
|
+
import { visualizer } from 'rollup-plugin-visualizer'
|
|
7
|
+
import { includes } from 'lodash-es'
|
|
8
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
9
|
+
import { createChunks } from './scripts'
|
|
10
|
+
|
|
11
|
+
// https://vitejs.dev/config/
|
|
12
|
+
export default defineConfig(({ mode }) => {
|
|
13
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
14
|
+
const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
|
|
15
|
+
const plugins: any[] = [
|
|
16
|
+
tailwindcss(),
|
|
17
|
+
svgr(),
|
|
18
|
+
mockDevServer({
|
|
19
|
+
include: ['**/*.mock.{ts,js}']
|
|
20
|
+
}),
|
|
21
|
+
checker({
|
|
22
|
+
enableBuild: false,
|
|
23
|
+
typescript: true,
|
|
24
|
+
eslint: { useFlatConfig: true, lintCommand: 'eslint', dev: { logLevel: ['error'] } }
|
|
25
|
+
}),
|
|
26
|
+
react({
|
|
27
|
+
babel: {
|
|
28
|
+
plugins: [
|
|
29
|
+
[
|
|
30
|
+
'babel-plugin-styled-components',
|
|
31
|
+
{
|
|
32
|
+
ssr: false,
|
|
33
|
+
displayName: false,
|
|
34
|
+
fileName: false,
|
|
35
|
+
transpileTemplateLiterals: false
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
if (mode === 'analyse') {
|
|
44
|
+
plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
base: env.VITE_BASE_URL,
|
|
49
|
+
plugins,
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: {
|
|
52
|
+
'@': __dirname
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
esbuild: {
|
|
56
|
+
drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
|
|
57
|
+
},
|
|
58
|
+
build: {
|
|
59
|
+
sourcemap: mode === 'analyse',
|
|
60
|
+
reportCompressedSize: mode === 'analyse',
|
|
61
|
+
rollupOptions: {
|
|
62
|
+
output: {
|
|
63
|
+
manualChunks: createChunks({
|
|
64
|
+
react: ['react', 'react-dom']
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
server: {
|
|
70
|
+
host: '0.0.0.0',
|
|
71
|
+
proxy: {
|
|
72
|
+
[proxyBaseUrl]: {
|
|
73
|
+
target: 'http://127.0.0.1',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
rewrite: path => path.replace(proxyBaseUrl, '')
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
})
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@sveltejs/adapter-auto": "3.3.1",
|
|
27
27
|
"@sveltejs/kit": "2.15.0",
|
|
28
28
|
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
29
|
-
"@types/lodash-es": "4.17.12",
|
|
30
29
|
"commitizen": "4.3.0",
|
|
31
30
|
"cross-env": "7.0.3",
|
|
32
31
|
"cssnano": "6.0.1",
|
|
@@ -51,7 +50,7 @@
|
|
|
51
50
|
"vite-plugin-checker": "0.9.0"
|
|
52
51
|
},
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"
|
|
53
|
+
"es-toolkit": "1.37.2",
|
|
55
54
|
"svelte": "5.16.0"
|
|
56
55
|
}
|
|
57
56
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"axios": "1.7.9",
|
|
23
|
-
"
|
|
23
|
+
"es-toolkit": "1.37.2",
|
|
24
24
|
"pinia": "2.3.1",
|
|
25
25
|
"tailwindcss": "4.1.4",
|
|
26
26
|
"type-fest": "4.33.0",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"@eslint/js": "9.15.0",
|
|
35
35
|
"@faker-js/faker": "8.4.1",
|
|
36
36
|
"@tailwindcss/vite": "4.1.4",
|
|
37
|
-
"@types/lodash-es": "4.17.12",
|
|
38
37
|
"@types/mockjs": "1.0.10",
|
|
39
38
|
"@vitejs/plugin-vue": "5.2.1",
|
|
40
39
|
"@vitejs/plugin-vue-jsx": "4.1.1",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"axios": "1.7.9",
|
|
24
|
-
"
|
|
24
|
+
"es-toolkit": "1.37.2",
|
|
25
25
|
"pinia": "2.3.1",
|
|
26
26
|
"tailwindcss": "4.1.4",
|
|
27
27
|
"type-fest": "4.33.0",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@rsbuild/plugin-vue": "1.0.7",
|
|
41
41
|
"@rsdoctor/rspack-plugin": "0.4.13",
|
|
42
42
|
"@tailwindcss/postcss": "4.1.4",
|
|
43
|
-
"@types/lodash-es": "4.17.12",
|
|
44
43
|
"@types/mockjs": "1.0.10",
|
|
45
44
|
"autoprefixer": "10.4.14",
|
|
46
45
|
"commitizen": "4.3.0",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"@tanstack/react-query": "5.51.15",
|
|
29
29
|
"@webext-core/messaging": "2.2.0",
|
|
30
30
|
"axios": "1.7.9",
|
|
31
|
-
"define-zustand": "3.
|
|
31
|
+
"define-zustand": "3.4.0",
|
|
32
|
+
"es-toolkit": "1.37.2",
|
|
32
33
|
"immer": "10.0.1",
|
|
33
|
-
"lodash-es": "4.17.21",
|
|
34
34
|
"qs": "6.11.2",
|
|
35
35
|
"react": "18.3.1",
|
|
36
36
|
"react-dom": "18.3.1",
|
|
37
|
+
"styled-components": "^6.1.17",
|
|
37
38
|
"type-fest": "4.33.0",
|
|
38
39
|
"zustand": "5.0.3"
|
|
39
40
|
},
|
|
@@ -41,10 +42,8 @@
|
|
|
41
42
|
"@commitlint/cli": "17.6.1",
|
|
42
43
|
"@commitlint/config-conventional": "17.6.1",
|
|
43
44
|
"@commitlint/cz-commitlint": "17.5.0",
|
|
44
|
-
"@emotion/babel-plugin": "11.13.5",
|
|
45
45
|
"@eslint/js": "9.15.0",
|
|
46
46
|
"@types/chrome": "0.0.254",
|
|
47
|
-
"@types/lodash-es": "4.17.12",
|
|
48
47
|
"@types/node": "18.16.0",
|
|
49
48
|
"@types/qs": "6.9.7",
|
|
50
49
|
"@types/react": "18.3.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
-
import { ThemeProvider } from '
|
|
2
|
+
import { ThemeProvider } from 'styled-components'
|
|
3
3
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
4
4
|
import { theme } from '@/shared/styles'
|
|
5
5
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CSSProperties } from 'react'
|
|
2
|
-
|
|
3
2
|
import { isString } from 'lodash-es'
|
|
4
3
|
|
|
5
4
|
export const theme = {
|
|
@@ -9,12 +8,14 @@ export const theme = {
|
|
|
9
8
|
textOverflow: 'ellipsis',
|
|
10
9
|
whiteSpace: 'nowrap'
|
|
11
10
|
}),
|
|
12
|
-
lineClamp: (n: number) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
lineClamp: (n: number) => {
|
|
12
|
+
return {
|
|
13
|
+
WebkitLineClamp: `${n}`,
|
|
14
|
+
WebkitBoxOrient: 'vertical',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
display: '-webkit-box'
|
|
17
|
+
} satisfies CSSProperties
|
|
18
|
+
},
|
|
18
19
|
size: (s: string) => ({ width: s, height: s }),
|
|
19
20
|
py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
|
|
20
21
|
px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
|
|
@@ -33,24 +34,14 @@ export const theme = {
|
|
|
33
34
|
} satisfies CSSProperties
|
|
34
35
|
},
|
|
35
36
|
/** 数字为元素数量,字符串为对应css的值 */
|
|
36
|
-
grid: {
|
|
37
|
-
|
|
37
|
+
grid: (rows: number | string, cols: number | string, gap?: number) => {
|
|
38
|
+
return {
|
|
38
39
|
display: 'grid',
|
|
39
40
|
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
40
41
|
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
41
42
|
gap: gap ? `${gap}px` : void 0
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
display: 'grid',
|
|
45
|
-
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
46
|
-
rowGap: gap ? `${gap}px` : void 0
|
|
47
|
-
}),
|
|
48
|
-
cols: (cols: number | string, gap?: number) => ({
|
|
49
|
-
display: 'grid',
|
|
50
|
-
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
51
|
-
columnGap: gap ? `${gap}px` : void 0
|
|
52
|
-
})
|
|
53
|
-
} satisfies Record<string, (...args: any) => CSSProperties>
|
|
43
|
+
} satisfies CSSProperties
|
|
44
|
+
}
|
|
54
45
|
}
|
|
55
46
|
}
|
|
56
47
|
export type themeType = typeof theme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
/// <reference types="./.wxt/wxt.d.ts" />
|
|
3
3
|
|
|
4
|
-
import '
|
|
4
|
+
import 'styled-components'
|
|
5
5
|
import { themeType } from './shared/styles'
|
|
6
6
|
|
|
7
7
|
declare global {
|
|
@@ -16,6 +16,6 @@ declare global {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
declare module '
|
|
20
|
-
export interface
|
|
19
|
+
declare module 'styled-components' {
|
|
20
|
+
export interface DefaultTheme extends themeType {}
|
|
21
21
|
}
|
|
@@ -33,7 +33,17 @@ export default defineConfig({
|
|
|
33
33
|
svgr(),
|
|
34
34
|
react({
|
|
35
35
|
babel: {
|
|
36
|
-
plugins: [
|
|
36
|
+
plugins: [
|
|
37
|
+
[
|
|
38
|
+
'babel-plugin-styled-components',
|
|
39
|
+
{
|
|
40
|
+
ssr: false,
|
|
41
|
+
displayName: false,
|
|
42
|
+
fileName: false,
|
|
43
|
+
transpileTemplateLiterals: false
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
]
|
|
37
47
|
}
|
|
38
48
|
})
|
|
39
49
|
] as any,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react'
|
|
2
|
-
import { css, Global } from '@emotion/react'
|
|
3
|
-
|
|
4
|
-
export const GlobalStyle: FunctionComponent<{ nameSpace?: string }> = props => {
|
|
5
|
-
return (
|
|
6
|
-
<Global
|
|
7
|
-
styles={css`
|
|
8
|
-
${props.nameSpace ? '.' + props.nameSpace : 'body'} {
|
|
9
|
-
margin: 0;
|
|
10
|
-
}
|
|
11
|
-
`}
|
|
12
|
-
/>
|
|
13
|
-
)
|
|
14
|
-
}
|