create-packer 1.38.2 → 1.39.1
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 +4 -5
- package/template/docusaurus/package.json +1 -1
- package/template/{web-app/react-vite/.eslintignore → lib/workspace/.stylelintignore} +2 -0
- package/template/lib/workspace/.stylelintrc +4 -9
- package/template/lib/workspace/eslint.config.mjs +116 -0
- package/template/lib/workspace/package.json +81 -73
- package/template/lib/workspace/packages/react/package.json +41 -41
- package/template/lib/workspace/packages/react/tsconfig.json +3 -8
- package/template/lib/workspace/packages/react/tsconfig.lint.json +21 -0
- package/template/lib/workspace/packages/ts/package.json +29 -29
- package/template/lib/workspace/packages/ts/tsconfig.json +9 -6
- package/template/lib/workspace/packages/ts/tsconfig.lint.json +21 -0
- package/template/nest/package.json +82 -84
- package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +17 -17
- package/template/web-app/react-rsbuild/domain/router/components/index.ts +2 -0
- package/template/web-app/react-rsbuild/domain/router/components/route-layout.tsx +19 -0
- package/template/web-app/react-rsbuild/domain/router/components/sub-route-outlet.tsx +22 -0
- package/template/web-app/react-rsbuild/domain/router/index.ts +4 -3
- package/template/web-app/react-rsbuild/eslint.config.js +104 -0
- package/template/web-app/react-rsbuild/package.json +78 -79
- package/template/web-app/react-rsbuild/pages/home/index.ts +1 -1
- package/template/web-app/react-rsbuild/pages/home/{home.styled.ts → view.styled.ts} +7 -7
- package/template/web-app/react-rsbuild/pages/home/{home.tsx → view.tsx} +10 -10
- package/template/web-app/{react-vite/shared/tools → react-rsbuild/shared/components}/componentInstance.tsx +80 -80
- package/template/web-app/react-rsbuild/shared/components/index.ts +1 -0
- package/template/web-app/react-rsbuild/shared/service/home.ts +8 -8
- package/template/web-app/react-rsbuild/shared/theme/theme.styled.ts +56 -56
- package/template/web-app/react-rsbuild/shared/tools/index.ts +0 -1
- package/template/web-app/react-vite/domain/router/components/index.ts +2 -0
- package/template/web-app/react-vite/domain/router/components/route-layout.tsx +19 -0
- package/template/web-app/react-vite/domain/router/components/sub-route-outlet.tsx +22 -0
- package/template/web-app/react-vite/domain/router/index.ts +4 -3
- package/template/web-app/react-vite/eslint.config.js +104 -0
- package/template/web-app/react-vite/package.json +79 -79
- package/template/web-app/react-vite/pages/home/index.ts +1 -1
- package/template/web-app/react-vite/pages/home/{home.mock.ts → view.mock.ts} +19 -19
- package/template/web-app/{react-webpack/pages/home/home.styled.ts → react-vite/pages/home/view.styled.ts} +7 -7
- package/template/web-app/react-vite/pages/home/{home.tsx → view.tsx} +10 -10
- package/template/web-app/{react-rsbuild/shared/tools → react-vite/shared/components}/componentInstance.tsx +80 -80
- package/template/web-app/react-vite/shared/components/index.ts +1 -0
- package/template/web-app/react-vite/shared/service/home.ts +10 -10
- package/template/web-app/react-vite/shared/theme/theme.styled.ts +55 -56
- package/template/web-app/react-vite/shared/tools/index.ts +0 -1
- package/template/web-app/react-vite/vite.config.ts +80 -76
- package/template/web-app/react-webpack/domain/router/components/index.ts +2 -0
- package/template/web-app/react-webpack/domain/router/components/route-layout.tsx +19 -0
- package/template/web-app/react-webpack/domain/router/components/sub-route-outlet.tsx +22 -0
- package/template/web-app/react-webpack/domain/router/index.ts +4 -3
- package/template/web-app/react-webpack/eslint.config.js +104 -0
- package/template/web-app/react-webpack/package.json +84 -87
- package/template/web-app/react-webpack/pages/home/index.ts +1 -1
- package/template/web-app/{react-vite/pages/home/home.styled.ts → react-webpack/pages/home/view.styled.ts} +7 -7
- package/template/web-app/react-webpack/pages/home/{home.tsx → view.tsx} +10 -10
- package/template/web-app/react-webpack/shared/{tools → components}/componentInstance.tsx +78 -78
- package/template/web-app/react-webpack/shared/components/index.ts +1 -0
- package/template/web-app/react-webpack/shared/theme/theme.styled.ts +56 -56
- package/template/web-app/react-webpack/shared/tools/index.ts +0 -1
- package/template/web-app/solid/package.json +53 -51
- package/template/web-app/solid/src/pages/home/index.ts +1 -1
- package/template/web-app/solid/src/pages/home/{home.container.tsx → view.tsx} +5 -5
- package/template/web-app/solid/src/pages/notFound/index.ts +1 -1
- package/template/web-app/solid/src/pages/notFound/{notFound.container.tsx → view.tsx} +3 -3
- package/template/web-app/svelte/.prettierrc +21 -14
- package/template/web-app/svelte/.svelte-kit/ambient.d.ts +181 -177
- package/template/web-app/svelte/.svelte-kit/generated/client/app.js +28 -23
- package/template/web-app/svelte/.svelte-kit/generated/client/matchers.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/client/nodes/0.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/client/nodes/1.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/client/nodes/2.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/root.js +3 -0
- package/template/web-app/svelte/.svelte-kit/generated/root.svelte +66 -62
- package/template/web-app/svelte/.svelte-kit/generated/server/internal.js +49 -61
- package/template/web-app/svelte/.svelte-kit/non-ambient.d.ts +25 -23
- package/template/web-app/svelte/.svelte-kit/tsconfig.json +49 -32
- package/template/web-app/svelte/.svelte-kit/types/route_meta_data.json +3 -3
- package/template/web-app/svelte/.svelte-kit/types/src/routes/$types.d.ts +22 -35
- package/template/web-app/svelte/eslint.config.js +95 -0
- package/template/web-app/svelte/package.json +55 -55
- package/template/web-app/svelte/src/app.d.ts +13 -12
- package/template/web-app/svelte/src/app.html +2 -2
- package/template/web-app/svelte/src/lib/index.ts +1 -0
- package/template/web-app/svelte/src/routes/+page.svelte +2 -2
- package/template/web-app/svelte/vite.config.ts +59 -55
- package/template/web-app/vue/eslint.config.js +109 -0
- package/template/web-app/vue/package.json +70 -70
- package/template/web-app/vue/pages/home/index.ts +1 -1
- package/template/web-app/vue/pages/home/{home.mock.ts → view.mock.ts} +19 -19
- package/template/web-app/vue/pages/home/{home.vue → view.vue} +16 -16
- package/template/web-app/vue/vite.config.ts +69 -65
- package/template/web-extension/.wxt/eslint-auto-imports.mjs +28 -0
- package/template/web-extension/.wxt/tsconfig.json +28 -25
- package/template/web-extension/.wxt/types/globals.d.ts +15 -15
- package/template/web-extension/.wxt/types/i18n.d.ts +81 -87
- package/template/web-extension/.wxt/types/imports.d.ts +22 -21
- package/template/web-extension/.wxt/types/paths.d.ts +16 -15
- package/template/web-extension/.wxt/wxt.d.ts +7 -6
- package/template/web-extension/entrypoints/content/domain/app/tools/insertApp.tsx +2 -3
- package/template/web-extension/entrypoints/content/index.tsx +10 -12
- package/template/web-extension/entrypoints/popup/main.tsx +14 -14
- package/template/web-extension/entrypoints/popup/{popup.container.tsx → popup.tsx} +3 -3
- package/template/web-extension/eslint.config.js +106 -0
- package/template/web-extension/package.json +84 -86
- package/template/web-extension/shared/content/constant.ts +1 -0
- package/template/web-extension/shared/content/index.ts +2 -1
- package/template/web-extension/shared/content/message.ts +25 -15
- package/template/web-extension/shared/styles/theme.styled.ts +56 -56
- package/template/web-extension/shared/tools/message.ts +70 -80
- package/template/web-extension/tsconfig.json +32 -32
- package/template/web-extension/vite-env.d.ts +20 -19
- package/template/web-extension/wxt.config.ts +43 -50
- package/template/lib/workspace/.eslintrc +0 -111
- package/template/lib/workspace/packages/react/.eslintrc +0 -111
- package/template/lib/workspace/packages/react/.stylelintrc +0 -29
- package/template/web-app/react-rsbuild/.eslintignore +0 -4
- package/template/web-app/react-rsbuild/.eslintrc +0 -111
- package/template/web-app/react-vite/.eslintrc +0 -110
- package/template/web-app/react-webpack/.eslintignore +0 -4
- package/template/web-app/react-webpack/.eslintrc +0 -110
- package/template/web-app/svelte/.eslintignore +0 -13
- package/template/web-app/svelte/.eslintrc +0 -76
- package/template/web-app/vue/.eslintignore +0 -4
- package/template/web-app/vue/.eslintrc +0 -97
- package/template/web-extension/.eslintignore +0 -4
- package/template/web-extension/.eslintrc +0 -110
- /package/template/web-app/solid/src/pages/home/{home.css → view.css} +0 -0
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
ForwardRefExoticComponent,
|
|
4
|
-
FunctionComponent,
|
|
5
|
-
PropsWithChildren,
|
|
6
|
-
PropsWithoutRef,
|
|
7
|
-
RefAttributes,
|
|
8
|
-
useImperativeHandle,
|
|
9
|
-
useRef,
|
|
10
|
-
useState
|
|
11
|
-
} from 'react'
|
|
12
|
-
import { createRoot } from 'react-dom/client'
|
|
13
|
-
|
|
14
|
-
const instanceMap: Record<string, { pending: Promise<any>; instance: any }> = {}
|
|
15
|
-
|
|
16
|
-
export interface refsType<P> {
|
|
17
|
-
$setProps: (newProps: P) => void
|
|
18
|
-
$updateProps: (newProps: Partial<P>) => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function create(Context?: FunctionComponent<PropsWithChildren<any>>) {
|
|
22
|
-
return async function <P extends Record<string, any>, Refs extends Record<string, any>>(
|
|
23
|
-
key: string,
|
|
24
|
-
Component: ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<Refs>>,
|
|
25
|
-
props?: P
|
|
26
|
-
) {
|
|
27
|
-
let current = instanceMap[key]
|
|
28
|
-
if (!current) {
|
|
29
|
-
const div = document.createElement('div')
|
|
30
|
-
document.body.appendChild(div)
|
|
31
|
-
const ApiComponent = forwardRef<Refs & refsType<P>>((__, refs) => {
|
|
32
|
-
const ref = useRef<Refs>(null)
|
|
33
|
-
const [state, setState] = useState<Partial<P>>(props || {})
|
|
34
|
-
|
|
35
|
-
useImperativeHandle(refs, () => {
|
|
36
|
-
return {
|
|
37
|
-
$setProps: newProps => {
|
|
38
|
-
setState(() => newProps)
|
|
39
|
-
},
|
|
40
|
-
$updateProps: newProps => {
|
|
41
|
-
if (newProps) {
|
|
42
|
-
setState(state => ({ ...state, ...newProps }))
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
...ref.current
|
|
46
|
-
} as Refs & refsType<P>
|
|
47
|
-
})
|
|
48
|
-
if (Context) {
|
|
49
|
-
return (
|
|
50
|
-
<Context>
|
|
51
|
-
<Component ref={ref} {...(state as any)} />
|
|
52
|
-
</Context>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
return <Component ref={ref} {...(state as any)} />
|
|
56
|
-
})
|
|
57
|
-
current = instanceMap[key] = {
|
|
58
|
-
instance: void 0,
|
|
59
|
-
pending: new Promise<void>(resolve => {
|
|
60
|
-
createRoot(div).render(
|
|
61
|
-
(
|
|
62
|
-
<ApiComponent
|
|
63
|
-
ref={instance => {
|
|
64
|
-
current.instance = instanceMap[key].instance = instance!
|
|
65
|
-
resolve()
|
|
66
|
-
}}
|
|
67
|
-
/>
|
|
68
|
-
) as never
|
|
69
|
-
)
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
await current.pending
|
|
74
|
-
|
|
75
|
-
// Delay return to avoid sync issue
|
|
76
|
-
// ------------------------------------------------------------------------
|
|
77
|
-
await new Promise(resolve => setTimeout(resolve))
|
|
78
|
-
return current.instance as Refs & refsType<P>
|
|
79
|
-
}
|
|
80
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
ForwardRefExoticComponent,
|
|
4
|
+
FunctionComponent,
|
|
5
|
+
PropsWithChildren,
|
|
6
|
+
PropsWithoutRef,
|
|
7
|
+
RefAttributes,
|
|
8
|
+
useImperativeHandle,
|
|
9
|
+
useRef,
|
|
10
|
+
useState
|
|
11
|
+
} from 'react'
|
|
12
|
+
import { createRoot } from 'react-dom/client'
|
|
13
|
+
|
|
14
|
+
const instanceMap: Record<string, { pending: Promise<any>; instance: any }> = {}
|
|
15
|
+
|
|
16
|
+
export interface refsType<P> {
|
|
17
|
+
$setProps: (newProps: P) => void
|
|
18
|
+
$updateProps: (newProps: Partial<P>) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function create(Context?: FunctionComponent<PropsWithChildren<any>>) {
|
|
22
|
+
return async function <P extends Record<string, any>, Refs extends Record<string, any>>(
|
|
23
|
+
key: string,
|
|
24
|
+
Component: ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<Refs>>,
|
|
25
|
+
props?: P
|
|
26
|
+
) {
|
|
27
|
+
let current = instanceMap[key]
|
|
28
|
+
if (!current) {
|
|
29
|
+
const div = document.createElement('div')
|
|
30
|
+
document.body.appendChild(div)
|
|
31
|
+
const ApiComponent = forwardRef<Refs & refsType<P>>((__, refs) => {
|
|
32
|
+
const ref = useRef<Refs>(null)
|
|
33
|
+
const [state, setState] = useState<Partial<P>>(props || {})
|
|
34
|
+
|
|
35
|
+
useImperativeHandle(refs, () => {
|
|
36
|
+
return {
|
|
37
|
+
$setProps: newProps => {
|
|
38
|
+
setState(() => newProps)
|
|
39
|
+
},
|
|
40
|
+
$updateProps: newProps => {
|
|
41
|
+
if (newProps) {
|
|
42
|
+
setState(state => ({ ...state, ...newProps }))
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
...ref.current
|
|
46
|
+
} as Refs & refsType<P>
|
|
47
|
+
})
|
|
48
|
+
if (Context) {
|
|
49
|
+
return (
|
|
50
|
+
<Context>
|
|
51
|
+
<Component ref={ref} {...(state as any)} />
|
|
52
|
+
</Context>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
return <Component ref={ref} {...(state as any)} />
|
|
56
|
+
})
|
|
57
|
+
current = instanceMap[key] = {
|
|
58
|
+
instance: void 0,
|
|
59
|
+
pending: new Promise<void>(resolve => {
|
|
60
|
+
createRoot(div).render(
|
|
61
|
+
(
|
|
62
|
+
<ApiComponent
|
|
63
|
+
ref={instance => {
|
|
64
|
+
current.instance = instanceMap[key].instance = instance!
|
|
65
|
+
resolve()
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
) as never
|
|
69
|
+
)
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
await current.pending
|
|
74
|
+
current.instance.$setProps(props)
|
|
75
|
+
// Delay return to avoid sync issue
|
|
76
|
+
// ------------------------------------------------------------------------
|
|
77
|
+
await new Promise(resolve => setTimeout(resolve))
|
|
78
|
+
return current.instance as Refs & refsType<P>
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as componentInstance from './componentInstance'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
2
|
-
|
|
3
|
-
export function useHomeQuery() {
|
|
4
|
-
return useQuery({
|
|
5
|
-
queryKey: ['home_data'],
|
|
6
|
-
queryFn: () => [{ name: '1' }]
|
|
7
|
-
})
|
|
8
|
-
}
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
|
|
3
|
+
export function useHomeQuery() {
|
|
4
|
+
return useQuery({
|
|
5
|
+
queryKey: ['home_data'],
|
|
6
|
+
queryFn: () => [{ name: '1' }]
|
|
7
|
+
})
|
|
8
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { CSSProperties } from 'react'
|
|
2
|
-
|
|
3
|
-
import { isString } from 'lodash-es'
|
|
4
|
-
|
|
5
|
-
export const theme = {
|
|
6
|
-
tools: {
|
|
7
|
-
ellipsis: () => ({
|
|
8
|
-
overflow: 'hidden',
|
|
9
|
-
textOverflow: 'ellipsis',
|
|
10
|
-
whiteSpace: 'nowrap'
|
|
11
|
-
}),
|
|
12
|
-
lineClamp: (n: number) => ({
|
|
13
|
-
'-webkit-line-clamp': `${n}`,
|
|
14
|
-
'-webkit-box-orient': 'vertical',
|
|
15
|
-
overflow: 'hidden',
|
|
16
|
-
display: '-webkit-box'
|
|
17
|
-
}),
|
|
18
|
-
size: (s: string) => ({ width: s, height: s }),
|
|
19
|
-
py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
|
|
20
|
-
px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
|
|
21
|
-
my: (s: string) => ({ marginTop: s, marginBottom: s }),
|
|
22
|
-
mx: (s: string) => ({ marginLeft: s, marginRight: s }),
|
|
23
|
-
flex: (
|
|
24
|
-
align: CSSProperties['alignItems'],
|
|
25
|
-
justify: CSSProperties['justifyContent'],
|
|
26
|
-
vertical?: boolean
|
|
27
|
-
) => {
|
|
28
|
-
return {
|
|
29
|
-
display: 'flex',
|
|
30
|
-
alignItems: align,
|
|
31
|
-
justifyContent: justify,
|
|
32
|
-
flexDirection: vertical ? 'column' : 'row'
|
|
33
|
-
} satisfies CSSProperties
|
|
34
|
-
},
|
|
35
|
-
/** 数字为元素数量,字符串为对应css的值 */
|
|
36
|
-
grid: {
|
|
37
|
-
grid: (rows: number | string, cols: number | string, gap?: number) => ({
|
|
38
|
-
display: 'grid',
|
|
39
|
-
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
40
|
-
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
41
|
-
gap: gap ? `${gap}px` : void 0
|
|
42
|
-
}),
|
|
43
|
-
rows: (rows: number | string, gap?: number) => ({
|
|
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,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export type themeType = typeof theme
|
|
1
|
+
import { CSSProperties } from 'react'
|
|
2
|
+
|
|
3
|
+
import { isString } from 'lodash-es'
|
|
4
|
+
|
|
5
|
+
export const theme = {
|
|
6
|
+
tools: {
|
|
7
|
+
ellipsis: () => ({
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
textOverflow: 'ellipsis',
|
|
10
|
+
whiteSpace: 'nowrap'
|
|
11
|
+
}),
|
|
12
|
+
lineClamp: (n: number) => ({
|
|
13
|
+
'-webkit-line-clamp': `${n}`,
|
|
14
|
+
'-webkit-box-orient': 'vertical',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
display: '-webkit-box'
|
|
17
|
+
}),
|
|
18
|
+
size: (s: string) => ({ width: s, height: s }),
|
|
19
|
+
py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
|
|
20
|
+
px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
|
|
21
|
+
my: (s: string) => ({ marginTop: s, marginBottom: s }),
|
|
22
|
+
mx: (s: string) => ({ marginLeft: s, marginRight: s }),
|
|
23
|
+
flex: (
|
|
24
|
+
align: CSSProperties['alignItems'],
|
|
25
|
+
justify: CSSProperties['justifyContent'],
|
|
26
|
+
vertical?: boolean
|
|
27
|
+
) => {
|
|
28
|
+
return {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: align,
|
|
31
|
+
justifyContent: justify,
|
|
32
|
+
flexDirection: vertical ? 'column' : 'row'
|
|
33
|
+
} satisfies CSSProperties
|
|
34
|
+
},
|
|
35
|
+
/** 数字为元素数量,字符串为对应css的值 */
|
|
36
|
+
grid: {
|
|
37
|
+
grid: (rows: number | string, cols: number | string, gap?: number) => ({
|
|
38
|
+
display: 'grid',
|
|
39
|
+
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
40
|
+
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
41
|
+
gap: gap ? `${gap}px` : void 0
|
|
42
|
+
}),
|
|
43
|
+
rows: (rows: number | string, gap?: number) => ({
|
|
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>
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export type themeType = typeof theme
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as componentInstance from './componentInstance'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react'
|
|
2
|
+
import { Outlet } from 'react-router-dom'
|
|
3
|
+
import { last } from 'lodash-es'
|
|
4
|
+
import { routeType, useMatchRoutes } from '@/domain/router'
|
|
5
|
+
|
|
6
|
+
export interface propsType {
|
|
7
|
+
Index: FunctionComponent
|
|
8
|
+
rootId: routeType['id']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Root: FunctionComponent<propsType> = ({ Index, rootId }) => {
|
|
12
|
+
const matchRoutes = useMatchRoutes()
|
|
13
|
+
|
|
14
|
+
if (last(matchRoutes)?.id === rootId) {
|
|
15
|
+
return <Index />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return <Outlet />
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react'
|
|
2
|
+
import { Outlet } from 'react-router-dom'
|
|
3
|
+
import { useMount } from 'react-use'
|
|
4
|
+
import { last } from 'lodash-es'
|
|
5
|
+
import { useMatchRoutes, useRouter, routeType } from '@/domain/router'
|
|
6
|
+
|
|
7
|
+
export interface propsType {
|
|
8
|
+
rootId: routeType['id']
|
|
9
|
+
homeId: routeType['id']
|
|
10
|
+
}
|
|
11
|
+
export const Root: FunctionComponent<propsType> = props => {
|
|
12
|
+
const matchRoutes = useMatchRoutes()
|
|
13
|
+
const navigate = useRouter(state => state.navigate)
|
|
14
|
+
|
|
15
|
+
useMount(() => {
|
|
16
|
+
if (last(matchRoutes)?.id === props.rootId) {
|
|
17
|
+
navigate({ id: props.homeId })
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return <Outlet />
|
|
22
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { default as routerIds } from './ids'
|
|
2
|
-
export * from './router'
|
|
3
|
-
export * from './router.types'
|
|
1
|
+
export { default as routerIds } from './ids'
|
|
2
|
+
export * from './router'
|
|
3
|
+
export * from './router.types'
|
|
4
|
+
export * from './components'
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import eslint from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import tseslint from 'typescript-eslint'
|
|
4
|
+
import importPlugin from 'eslint-plugin-import'
|
|
5
|
+
import reactPlugin from 'eslint-plugin-react'
|
|
6
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
7
|
+
|
|
8
|
+
const scriptExtensions = ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx']
|
|
9
|
+
const files = scriptExtensions.map(ext => `**/*.${ext}`)
|
|
10
|
+
|
|
11
|
+
export default tseslint.config([
|
|
12
|
+
{
|
|
13
|
+
ignores: ['**/node_modules/', '**/dist/', '**/.history/', '**/.vscode/', 'vite.config.ts.*']
|
|
14
|
+
},
|
|
15
|
+
eslint.configs.recommended,
|
|
16
|
+
importPlugin.flatConfigs.recommended,
|
|
17
|
+
tseslint.configs.recommended,
|
|
18
|
+
{
|
|
19
|
+
plugins: { reactPlugin, reactHooksPlugin },
|
|
20
|
+
files,
|
|
21
|
+
languageOptions: {
|
|
22
|
+
ecmaVersion: 2018,
|
|
23
|
+
sourceType: 'module',
|
|
24
|
+
parserOptions: {
|
|
25
|
+
ecmaFeatures: {
|
|
26
|
+
jsx: true
|
|
27
|
+
},
|
|
28
|
+
useJSXTextNode: true
|
|
29
|
+
},
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.browser,
|
|
32
|
+
...globals.node
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
settings: {
|
|
36
|
+
'import/resolver': {
|
|
37
|
+
typescript: true,
|
|
38
|
+
node: true
|
|
39
|
+
},
|
|
40
|
+
react: {
|
|
41
|
+
version: '18'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
'import/export': 'off',
|
|
46
|
+
'import/namespace': 'off',
|
|
47
|
+
'import/default': 'off',
|
|
48
|
+
'import/no-named-as-default-member': 'off',
|
|
49
|
+
'import/no-named-as-default': 'off',
|
|
50
|
+
'import/order': [
|
|
51
|
+
'error',
|
|
52
|
+
{
|
|
53
|
+
groups: [
|
|
54
|
+
'builtin',
|
|
55
|
+
'external',
|
|
56
|
+
'internal',
|
|
57
|
+
'parent',
|
|
58
|
+
'sibling',
|
|
59
|
+
'index',
|
|
60
|
+
'object',
|
|
61
|
+
'type'
|
|
62
|
+
],
|
|
63
|
+
pathGroups: [
|
|
64
|
+
{ pattern: 'react', group: 'external', position: 'before' },
|
|
65
|
+
{ pattern: 'react-dom/*', group: 'external', position: 'before' },
|
|
66
|
+
{ pattern: 'react-router', group: 'external', position: 'before' },
|
|
67
|
+
{ pattern: 'react-router-dom', group: 'external', position: 'before' }
|
|
68
|
+
],
|
|
69
|
+
pathGroupsExcludedImportTypes: ['react', 'react-router', 'react-router-dom']
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
'no-case-declarations': 'off',
|
|
73
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
74
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
75
|
+
'@typescript-eslint/no-var-requires': 0,
|
|
76
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
77
|
+
'@typescript-eslint/no-explicit-any': 0,
|
|
78
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
79
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
80
|
+
'warn',
|
|
81
|
+
{
|
|
82
|
+
ignoreParameters: true
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
'@typescript-eslint/no-unused-vars': [
|
|
86
|
+
'warn',
|
|
87
|
+
{
|
|
88
|
+
argsIgnorePattern: '^_'
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
'@typescript-eslint/member-delimiter-style': 0,
|
|
92
|
+
'@typescript-eslint/class-name-casing': 0,
|
|
93
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
94
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
95
|
+
'@typescript-eslint/no-empty-interface': 'off',
|
|
96
|
+
'react/prop-types': 'off',
|
|
97
|
+
'react/no-find-dom-node': 'off',
|
|
98
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
99
|
+
'react/display-name': 'off',
|
|
100
|
+
'react/react-in-jsx-scope': 'off',
|
|
101
|
+
'no-constant-condition': 'off'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
])
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-vite",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"prepare": "husky install",
|
|
8
|
-
"dev": "vite",
|
|
9
|
-
"build": "tsc --noEmit && vite build",
|
|
10
|
-
"build:analyse": "tsc --noEmit && vite build --mode analyse",
|
|
11
|
-
"preview": "vite preview",
|
|
12
|
-
"up:vite": "pnpm up vite @vitejs/* vite-plugin-* -L",
|
|
13
|
-
"format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
|
|
14
|
-
"lint": "tsc --noEmit && eslint
|
|
15
|
-
"lint:fix": "eslint
|
|
16
|
-
"cz": "cz",
|
|
17
|
-
"push": "npm run commit && git push",
|
|
18
|
-
"commit": "git add . && npm run cz"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"react": "18.3.1",
|
|
29
|
-
"react-dom": "
|
|
30
|
-
"react-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"@commitlint/
|
|
37
|
-
"@commitlint/
|
|
38
|
-
"@
|
|
39
|
-
"@faker-js/faker": "8.4.1",
|
|
40
|
-
"@
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/react": "18.3.
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"eslint": "
|
|
54
|
-
"eslint-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"postcss": "
|
|
61
|
-
"postcss-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"vite": "
|
|
70
|
-
"vite-plugin-mock-dev-server": "1.
|
|
71
|
-
"vite-plugin-stylelint": "
|
|
72
|
-
"vite-plugin-svgr": "4.
|
|
73
|
-
},
|
|
74
|
-
"config": {
|
|
75
|
-
"commitizen": {
|
|
76
|
-
"path": "@commitlint/cz-commitlint"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-vite",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepare": "husky install",
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"build": "tsc --noEmit && vite build",
|
|
10
|
+
"build:analyse": "tsc --noEmit && vite build --mode analyse",
|
|
11
|
+
"preview": "vite preview",
|
|
12
|
+
"up:vite": "pnpm up vite @vitejs/* vite-plugin-* -L",
|
|
13
|
+
"format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
|
|
14
|
+
"lint": "tsc --noEmit && eslint --no-error-on-unmatched-pattern && stylelint **/*.{css,scss,less,ts,tsx}",
|
|
15
|
+
"lint:fix": "eslint --fix && stylelint **/*.{css,scss,less,ts,tsx} --fix",
|
|
16
|
+
"cz": "cz",
|
|
17
|
+
"push": "npm run commit && git push",
|
|
18
|
+
"commit": "git add . && npm run cz"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@tanstack/react-query": "5.51.15",
|
|
22
|
+
"axios": "1.7.9",
|
|
23
|
+
"define-zustand": "3.1.1",
|
|
24
|
+
"immer": "10.0.1",
|
|
25
|
+
"lodash-es": "4.17.21",
|
|
26
|
+
"qs": "6.11.2",
|
|
27
|
+
"react": "18.3.1",
|
|
28
|
+
"react-dom": "18.3.1",
|
|
29
|
+
"react-router-dom": "6.14.0",
|
|
30
|
+
"react-use": "17.5.0",
|
|
31
|
+
"styled-components": "6.1.11",
|
|
32
|
+
"zustand": "4.4.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@commitlint/cli": "17.6.1",
|
|
36
|
+
"@commitlint/config-conventional": "17.6.1",
|
|
37
|
+
"@commitlint/cz-commitlint": "17.5.0",
|
|
38
|
+
"@eslint/js": "9.15.0",
|
|
39
|
+
"@faker-js/faker": "8.4.1",
|
|
40
|
+
"@types/lodash-es": "4.17.12",
|
|
41
|
+
"@types/node": "18.16.0",
|
|
42
|
+
"@types/qs": "6.9.7",
|
|
43
|
+
"@types/react": "18.3.3",
|
|
44
|
+
"@types/react-dom": "18.3.0",
|
|
45
|
+
"@vitejs/plugin-react": "4.3.4",
|
|
46
|
+
"autoprefixer": "10.4.14",
|
|
47
|
+
"babel-plugin-styled-components": "2.1.4",
|
|
48
|
+
"commitizen": "4.3.0",
|
|
49
|
+
"cssnano": "6.0.0",
|
|
50
|
+
"eslint": "9.17.0",
|
|
51
|
+
"eslint-import-resolver-typescript": "3.7.0",
|
|
52
|
+
"eslint-plugin-import": "2.31.0",
|
|
53
|
+
"eslint-plugin-react": "7.37.2",
|
|
54
|
+
"eslint-plugin-react-hooks": "5.1.0",
|
|
55
|
+
"globals": "15.12.0",
|
|
56
|
+
"husky": "9.1.6",
|
|
57
|
+
"inquirer": "^8.1.2",
|
|
58
|
+
"postcss": "8.4.35",
|
|
59
|
+
"postcss-import": "16.0.1",
|
|
60
|
+
"postcss-nesting": "12.0.3",
|
|
61
|
+
"postcss-styled-syntax": "0.6.4",
|
|
62
|
+
"prettier": "3.2.5",
|
|
63
|
+
"rollup-plugin-visualizer": "5.12.0",
|
|
64
|
+
"stylelint": "16.10.0",
|
|
65
|
+
"stylelint-config-standard": "36.0.1",
|
|
66
|
+
"typescript": "5.7.2",
|
|
67
|
+
"typescript-eslint": "8.15.0",
|
|
68
|
+
"vite": "6.0.7",
|
|
69
|
+
"vite-plugin-checker": "0.8.0",
|
|
70
|
+
"vite-plugin-mock-dev-server": "1.8.3",
|
|
71
|
+
"vite-plugin-stylelint": "6.0.0",
|
|
72
|
+
"vite-plugin-svgr": "4.3.0"
|
|
73
|
+
},
|
|
74
|
+
"config": {
|
|
75
|
+
"commitizen": {
|
|
76
|
+
"path": "@commitlint/cz-commitlint"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './view'
|