create-packer 1.43.14 → 1.44.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 +1 -1
- package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +1 -7
- package/template/web-app/react-rsbuild/domain/app/components/app.tsx +0 -2
- package/template/web-app/react-rsbuild/env.d.ts +13 -24
- package/template/web-app/react-rsbuild/main.css +7 -0
- package/template/web-app/react-rsbuild/main.tsx +1 -0
- package/template/web-app/react-rsbuild/package.json +2 -4
- package/template/web-app/react-rsbuild/pages/home/view.tsx +1 -2
- package/template/web-app/react-rsbuild/postcss.config.cjs +1 -0
- package/template/web-app/react-rsbuild/rsbuild.config.ts +1 -12
- package/template/web-app/react-vite/domain/app/components/app-context.tsx +1 -7
- package/template/web-app/react-vite/domain/app/components/app.tsx +0 -2
- package/template/web-app/react-vite/main.css +7 -0
- package/template/web-app/react-vite/main.tsx +1 -0
- package/template/web-app/react-vite/package.json +2 -4
- package/template/web-app/react-vite/pages/home/view.tsx +9 -10
- package/template/web-app/react-vite/vite-env.d.ts +6 -15
- package/template/web-app/react-vite/vite.config.ts +2 -0
- package/template/web-app/vue/{style.css → main.css} +2 -2
- package/template/web-app/vue/main.ts +1 -1
- package/template/web-app/vue/pages/home/view.vue +1 -1
- package/template/web-app/vue/vite.config.ts +0 -1
- package/template/web-app/vue-rsbuild/{style.css → main.css} +2 -2
- package/template/web-app/vue-rsbuild/main.ts +1 -1
- package/template/web-app/vue-rsbuild/pages/home/view.vue +1 -1
- package/template/web-extension/package.json +1 -3
- 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-app/react-rsbuild/pages/home/view.styled.ts +0 -5
- package/template/web-app/react-rsbuild/shared/styles/global-style.tsx +0 -14
- package/template/web-app/react-rsbuild/shared/styles/index.ts +0 -2
- package/template/web-app/react-rsbuild/shared/styles/theme.styled.ts +0 -55
- package/template/web-app/react-vite/pages/home/view.styled.ts +0 -5
- package/template/web-app/react-vite/shared/styles/global-style.tsx +0 -14
- package/template/web-app/react-vite/shared/styles/index.ts +0 -2
- package/template/web-app/react-vite/shared/styles/theme.styled.ts +0 -55
- package/template/web-extension/shared/styles/global-style.tsx +0 -14
package/package.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
-
import { ThemeProvider } from '@emotion/react'
|
|
3
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
4
3
|
import { request } from '@/shared/service'
|
|
5
|
-
import { theme } from '@/shared/styles'
|
|
6
4
|
|
|
7
5
|
const queryClient = new QueryClient({
|
|
8
6
|
defaultOptions: {
|
|
@@ -20,9 +18,5 @@ export interface propsType {
|
|
|
20
18
|
children: ReactNode
|
|
21
19
|
}
|
|
22
20
|
export const Root: FunctionComponent<propsType> = props => {
|
|
23
|
-
return
|
|
24
|
-
<QueryClientProvider client={queryClient}>
|
|
25
|
-
<ThemeProvider theme={theme}>{props.children}</ThemeProvider>
|
|
26
|
-
</QueryClientProvider>
|
|
27
|
-
)
|
|
21
|
+
return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
28
22
|
}
|
|
@@ -2,7 +2,6 @@ import { useLayoutEffect, Suspense } from 'react'
|
|
|
2
2
|
import { RouterProvider } from 'react-router/dom'
|
|
3
3
|
import { request } from '@/shared/service'
|
|
4
4
|
import { routerInstance } from '@/domain/router'
|
|
5
|
-
import { GlobalStyle } from '@/shared/styles'
|
|
6
5
|
import * as AppContext from './app-context'
|
|
7
6
|
|
|
8
7
|
export const Root = () => {
|
|
@@ -17,7 +16,6 @@ export const Root = () => {
|
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<AppContext.Root>
|
|
20
|
-
<GlobalStyle />
|
|
21
19
|
<Suspense fallback={<>loading...</>}>
|
|
22
20
|
<RouterProvider router={routerInstance} />
|
|
23
21
|
</Suspense>
|
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
/// <reference types="@rsbuild/core/types" />
|
|
2
|
-
import '@emotion/react'
|
|
3
|
-
import { themeType } from './shared/styles'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly PUBLIC_BASE_URL: string
|
|
5
|
+
readonly PUBLIC_API_HOST: string
|
|
6
|
+
readonly PUBLIC_ENV_MODE: 'production' | 'development'
|
|
7
7
|
}
|
|
8
|
-
declare global {
|
|
9
|
-
interface ImportMetaEnv {
|
|
10
|
-
readonly PUBLIC_BASE_URL: string
|
|
11
|
-
readonly PUBLIC_API_HOST: string
|
|
12
|
-
readonly PUBLIC_ENV_MODE: 'production' | 'development'
|
|
13
|
-
}
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
declare module '*.svg' {
|
|
20
|
-
const content: string
|
|
21
|
-
export default content
|
|
22
|
-
}
|
|
9
|
+
interface ImportMeta {
|
|
10
|
+
readonly env: ImportMetaEnv
|
|
11
|
+
}
|
|
23
12
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
13
|
+
declare module '*.svg' {
|
|
14
|
+
const content: string
|
|
15
|
+
export default content
|
|
28
16
|
}
|
|
29
17
|
|
|
30
|
-
declare module '
|
|
31
|
-
|
|
18
|
+
declare module '*.svg?react' {
|
|
19
|
+
const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement>>
|
|
20
|
+
export default ReactComponent
|
|
32
21
|
}
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
"commit": "git add . && npm run cz"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@emotion/react": "11.14.0",
|
|
23
|
-
"@emotion/styled": "11.14.0",
|
|
24
22
|
"@tanstack/react-query": "5.51.15",
|
|
25
23
|
"axios": "1.7.9",
|
|
26
24
|
"define-zustand": "3.2.1",
|
|
@@ -31,6 +29,7 @@
|
|
|
31
29
|
"react-dom": "18.3.1",
|
|
32
30
|
"react-router": "7.5.0",
|
|
33
31
|
"react-use": "17.5.0",
|
|
32
|
+
"tailwindcss": "4.1.4",
|
|
34
33
|
"type-fest": "4.33.0",
|
|
35
34
|
"zustand": "5.0.3"
|
|
36
35
|
},
|
|
@@ -45,7 +44,7 @@
|
|
|
45
44
|
"@rsbuild/plugin-svgr": "1.0.7",
|
|
46
45
|
"@rsbuild/plugin-type-check": "1.2.1",
|
|
47
46
|
"@rsdoctor/rspack-plugin": "0.4.13",
|
|
48
|
-
"@
|
|
47
|
+
"@tailwindcss/postcss": "4.1.4",
|
|
49
48
|
"@types/lodash-es": "4.17.12",
|
|
50
49
|
"@types/node": "18.16.0",
|
|
51
50
|
"@types/qs": "6.9.7",
|
|
@@ -65,7 +64,6 @@
|
|
|
65
64
|
"postcss": "8.4.35",
|
|
66
65
|
"postcss-import": "16.0.1",
|
|
67
66
|
"postcss-nesting": "12.0.3",
|
|
68
|
-
"postcss-styled-syntax": "0.6.4",
|
|
69
67
|
"prettier": "3.2.5",
|
|
70
68
|
"stylelint": "16.10.0",
|
|
71
69
|
"stylelint-config-standard": "36.0.1",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useHomeData } from '@/shared/service'
|
|
2
|
-
import { StyledRoot } from './view.styled'
|
|
3
2
|
|
|
4
3
|
export default function Home() {
|
|
5
4
|
const { data } = useHomeData()
|
|
6
5
|
|
|
7
6
|
console.log('data', data)
|
|
8
7
|
|
|
9
|
-
return <
|
|
8
|
+
return <div className="tw:flex tw:items-center tw:justify-center">sdfs</div>
|
|
10
9
|
}
|
|
@@ -41,13 +41,6 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
41
41
|
new StylelintWebpackPlugin(),
|
|
42
42
|
process.env.RSDOCTOR && new RsdoctorRspackPlugin()
|
|
43
43
|
]
|
|
44
|
-
},
|
|
45
|
-
swc: {
|
|
46
|
-
jsc: {
|
|
47
|
-
experimental: {
|
|
48
|
-
plugins: [['@swc/plugin-emotion', {}]]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
44
|
}
|
|
52
45
|
},
|
|
53
46
|
plugins: [
|
|
@@ -59,11 +52,7 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
59
52
|
}
|
|
60
53
|
}),
|
|
61
54
|
pluginSvgr(),
|
|
62
|
-
pluginReact(
|
|
63
|
-
swcReactOptions: {
|
|
64
|
-
importSource: '@emotion/react'
|
|
65
|
-
}
|
|
66
|
-
})
|
|
55
|
+
pluginReact()
|
|
67
56
|
],
|
|
68
57
|
performance: {
|
|
69
58
|
removeConsole: command === 'build' ? ['log'] : false,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
-
import { ThemeProvider } from '@emotion/react'
|
|
3
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
4
3
|
import { request } from '@/shared/service'
|
|
5
|
-
import { theme } from '@/shared/styles'
|
|
6
4
|
|
|
7
5
|
const queryClient = new QueryClient({
|
|
8
6
|
defaultOptions: {
|
|
@@ -20,9 +18,5 @@ export interface propsType {
|
|
|
20
18
|
children: ReactNode
|
|
21
19
|
}
|
|
22
20
|
export const Root: FunctionComponent<propsType> = props => {
|
|
23
|
-
return
|
|
24
|
-
<QueryClientProvider client={queryClient}>
|
|
25
|
-
<ThemeProvider theme={theme}>{props.children}</ThemeProvider>
|
|
26
|
-
</QueryClientProvider>
|
|
27
|
-
)
|
|
21
|
+
return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
28
22
|
}
|
|
@@ -2,7 +2,6 @@ import { useLayoutEffect, Suspense } from 'react'
|
|
|
2
2
|
import { RouterProvider } from 'react-router/dom'
|
|
3
3
|
import { request } from '@/shared/service'
|
|
4
4
|
import { routerInstance } from '@/domain/router'
|
|
5
|
-
import { GlobalStyle } from '@/shared/styles'
|
|
6
5
|
import * as AppContext from './app-context'
|
|
7
6
|
|
|
8
7
|
export const Root = () => {
|
|
@@ -17,7 +16,6 @@ export const Root = () => {
|
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<AppContext.Root>
|
|
20
|
-
<GlobalStyle />
|
|
21
19
|
<Suspense fallback={<>loading...</>}>
|
|
22
20
|
<RouterProvider router={routerInstance} />
|
|
23
21
|
</Suspense>
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
"commit": "git add . && npm run cz"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@emotion/react": "11.14.0",
|
|
22
|
-
"@emotion/styled": "11.14.0",
|
|
23
21
|
"@tanstack/react-query": "5.51.15",
|
|
24
22
|
"axios": "1.7.9",
|
|
25
23
|
"define-zustand": "3.2.1",
|
|
@@ -30,6 +28,7 @@
|
|
|
30
28
|
"react-dom": "18.3.1",
|
|
31
29
|
"react-router": "7.5.0",
|
|
32
30
|
"react-use": "17.5.0",
|
|
31
|
+
"tailwindcss": "4.1.4",
|
|
33
32
|
"type-fest": "4.33.0",
|
|
34
33
|
"zustand": "5.0.3"
|
|
35
34
|
},
|
|
@@ -40,6 +39,7 @@
|
|
|
40
39
|
"@emotion/babel-plugin": "11.13.5",
|
|
41
40
|
"@eslint/js": "9.15.0",
|
|
42
41
|
"@faker-js/faker": "8.4.1",
|
|
42
|
+
"@tailwindcss/vite": "4.1.4",
|
|
43
43
|
"@types/lodash-es": "4.17.12",
|
|
44
44
|
"@types/node": "18.16.0",
|
|
45
45
|
"@types/qs": "6.9.7",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"@types/react-dom": "18.3.0",
|
|
48
48
|
"@vitejs/plugin-react": "4.3.4",
|
|
49
49
|
"autoprefixer": "10.4.14",
|
|
50
|
-
"babel-plugin-styled-components": "2.1.4",
|
|
51
50
|
"commitizen": "4.3.0",
|
|
52
51
|
"cssnano": "6.0.0",
|
|
53
52
|
"eslint": "9.17.0",
|
|
@@ -61,7 +60,6 @@
|
|
|
61
60
|
"postcss": "8.4.35",
|
|
62
61
|
"postcss-import": "16.0.1",
|
|
63
62
|
"postcss-nesting": "12.0.3",
|
|
64
|
-
"postcss-styled-syntax": "0.6.4",
|
|
65
63
|
"prettier": "3.2.5",
|
|
66
64
|
"rollup-plugin-visualizer": "5.12.0",
|
|
67
65
|
"stylelint": "16.10.0",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useHomeData } from '@/shared/service'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import { useHomeData } from '@/shared/service'
|
|
2
|
+
|
|
3
|
+
export default function Home() {
|
|
4
|
+
const { data } = useHomeData()
|
|
5
|
+
|
|
6
|
+
console.log('data', data)
|
|
7
|
+
|
|
8
|
+
return <div className="tw:flex tw:items-center tw:justify-center">sdfs</div>
|
|
9
|
+
}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
/// <reference types="vite-plugin-svgr/client" />
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
interface ImportMetaEnv {
|
|
9
|
-
readonly VITE_BASE_URL: string
|
|
10
|
-
readonly VITE_API_HOST: string
|
|
11
|
-
// 更多环境变量...
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface ImportMeta {
|
|
15
|
-
readonly env: ImportMetaEnv
|
|
16
|
-
}
|
|
4
|
+
interface ImportMetaEnv {
|
|
5
|
+
readonly VITE_BASE_URL: string
|
|
6
|
+
readonly VITE_API_HOST: string
|
|
7
|
+
// 更多环境变量...
|
|
17
8
|
}
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
interface ImportMeta {
|
|
11
|
+
readonly env: ImportMetaEnv
|
|
21
12
|
}
|
|
@@ -5,6 +5,7 @@ import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
|
5
5
|
import checker from 'vite-plugin-checker'
|
|
6
6
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
7
7
|
import { includes } from 'lodash-es'
|
|
8
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
8
9
|
import { createChunks } from './scripts'
|
|
9
10
|
|
|
10
11
|
// https://vitejs.dev/config/
|
|
@@ -12,6 +13,7 @@ export default defineConfig(({ mode }) => {
|
|
|
12
13
|
const env = loadEnv(mode, process.cwd(), '')
|
|
13
14
|
const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
|
|
14
15
|
const plugins: any[] = [
|
|
16
|
+
tailwindcss(),
|
|
15
17
|
svgr(),
|
|
16
18
|
mockDevServer({
|
|
17
19
|
include: ['**/*.mock.{ts,js}']
|
|
@@ -4,7 +4,6 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
|
4
4
|
import svgLoader from 'vite-svg-loader'
|
|
5
5
|
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
6
6
|
import checker from 'vite-plugin-checker'
|
|
7
|
-
// @ts-ignore
|
|
8
7
|
import tailwindcss from '@tailwindcss/vite'
|
|
9
8
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
10
9
|
import { includes } from 'lodash-es'
|
|
@@ -25,8 +25,6 @@
|
|
|
25
25
|
"commit": "git add . && npm run cz"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@emotion/react": "11.14.0",
|
|
29
|
-
"@emotion/styled": "11.14.0",
|
|
30
28
|
"@tanstack/react-query": "5.51.15",
|
|
31
29
|
"@webext-core/messaging": "2.2.0",
|
|
32
30
|
"axios": "1.7.9",
|
|
@@ -36,6 +34,7 @@
|
|
|
36
34
|
"qs": "6.11.2",
|
|
37
35
|
"react": "18.3.1",
|
|
38
36
|
"react-dom": "18.3.1",
|
|
37
|
+
"styled-components": "^6.1.17",
|
|
39
38
|
"type-fest": "4.33.0",
|
|
40
39
|
"zustand": "5.0.3"
|
|
41
40
|
},
|
|
@@ -43,7 +42,6 @@
|
|
|
43
42
|
"@commitlint/cli": "17.6.1",
|
|
44
43
|
"@commitlint/config-conventional": "17.6.1",
|
|
45
44
|
"@commitlint/cz-commitlint": "17.5.0",
|
|
46
|
-
"@emotion/babel-plugin": "11.13.5",
|
|
47
45
|
"@eslint/js": "9.15.0",
|
|
48
46
|
"@types/chrome": "0.0.254",
|
|
49
47
|
"@types/lodash-es": "4.17.12",
|
|
@@ -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
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'react'
|
|
2
|
-
import { isString } from 'lodash-es'
|
|
3
|
-
|
|
4
|
-
export const theme = {
|
|
5
|
-
tools: {
|
|
6
|
-
ellipsis: () => ({
|
|
7
|
-
overflow: 'hidden',
|
|
8
|
-
textOverflow: 'ellipsis',
|
|
9
|
-
whiteSpace: 'nowrap'
|
|
10
|
-
}),
|
|
11
|
-
lineClamp: (n: number) => ({
|
|
12
|
-
'-webkit-line-clamp': `${n}`,
|
|
13
|
-
'-webkit-box-orient': 'vertical',
|
|
14
|
-
overflow: 'hidden',
|
|
15
|
-
display: '-webkit-box'
|
|
16
|
-
}),
|
|
17
|
-
size: (s: string) => ({ width: s, height: s }),
|
|
18
|
-
py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
|
|
19
|
-
px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
|
|
20
|
-
my: (s: string) => ({ marginTop: s, marginBottom: s }),
|
|
21
|
-
mx: (s: string) => ({ marginLeft: s, marginRight: s }),
|
|
22
|
-
flex: (
|
|
23
|
-
align: CSSProperties['alignItems'],
|
|
24
|
-
justify: CSSProperties['justifyContent'],
|
|
25
|
-
vertical?: boolean
|
|
26
|
-
) => {
|
|
27
|
-
return {
|
|
28
|
-
display: 'flex',
|
|
29
|
-
alignItems: align,
|
|
30
|
-
justifyContent: justify,
|
|
31
|
-
flexDirection: vertical ? 'column' : 'row'
|
|
32
|
-
} satisfies CSSProperties
|
|
33
|
-
},
|
|
34
|
-
/** 数字为元素数量,字符串为对应css的值 */
|
|
35
|
-
grid: {
|
|
36
|
-
grid: (rows: number | string, cols: number | string, gap?: number) => ({
|
|
37
|
-
display: 'grid',
|
|
38
|
-
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
39
|
-
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
40
|
-
gap: gap ? `${gap}px` : void 0
|
|
41
|
-
}),
|
|
42
|
-
rows: (rows: number | string, gap?: number) => ({
|
|
43
|
-
display: 'grid',
|
|
44
|
-
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
45
|
-
rowGap: gap ? `${gap}px` : void 0
|
|
46
|
-
}),
|
|
47
|
-
cols: (cols: number | string, gap?: number) => ({
|
|
48
|
-
display: 'grid',
|
|
49
|
-
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
50
|
-
columnGap: gap ? `${gap}px` : void 0
|
|
51
|
-
})
|
|
52
|
-
} satisfies Record<string, (...args: any) => CSSProperties>
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export type themeType = typeof theme
|
|
@@ -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
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'react'
|
|
2
|
-
import { isString } from 'lodash-es'
|
|
3
|
-
|
|
4
|
-
export const theme = {
|
|
5
|
-
tools: {
|
|
6
|
-
ellipsis: () => ({
|
|
7
|
-
overflow: 'hidden',
|
|
8
|
-
textOverflow: 'ellipsis',
|
|
9
|
-
whiteSpace: 'nowrap'
|
|
10
|
-
}),
|
|
11
|
-
lineClamp: (n: number) => ({
|
|
12
|
-
'-webkit-line-clamp': `${n}`,
|
|
13
|
-
'-webkit-box-orient': 'vertical',
|
|
14
|
-
overflow: 'hidden',
|
|
15
|
-
display: '-webkit-box'
|
|
16
|
-
}),
|
|
17
|
-
size: (s: string) => ({ width: s, height: s }),
|
|
18
|
-
py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
|
|
19
|
-
px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
|
|
20
|
-
my: (s: string) => ({ marginTop: s, marginBottom: s }),
|
|
21
|
-
mx: (s: string) => ({ marginLeft: s, marginRight: s }),
|
|
22
|
-
flex: (
|
|
23
|
-
align: CSSProperties['alignItems'],
|
|
24
|
-
justify: CSSProperties['justifyContent'],
|
|
25
|
-
vertical?: boolean
|
|
26
|
-
) => {
|
|
27
|
-
return {
|
|
28
|
-
display: 'flex',
|
|
29
|
-
alignItems: align,
|
|
30
|
-
justifyContent: justify,
|
|
31
|
-
flexDirection: vertical ? 'column' : 'row'
|
|
32
|
-
} satisfies CSSProperties
|
|
33
|
-
},
|
|
34
|
-
/** 数字为元素数量,字符串为对应css的值 */
|
|
35
|
-
grid: {
|
|
36
|
-
grid: (rows: number | string, cols: number | string, gap?: number) => ({
|
|
37
|
-
display: 'grid',
|
|
38
|
-
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
39
|
-
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
40
|
-
gap: gap ? `${gap}px` : void 0
|
|
41
|
-
}),
|
|
42
|
-
rows: (rows: number | string, gap?: number) => ({
|
|
43
|
-
display: 'grid',
|
|
44
|
-
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
45
|
-
rowGap: gap ? `${gap}px` : void 0
|
|
46
|
-
}),
|
|
47
|
-
cols: (cols: number | string, gap?: number) => ({
|
|
48
|
-
display: 'grid',
|
|
49
|
-
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
50
|
-
columnGap: gap ? `${gap}px` : void 0
|
|
51
|
-
})
|
|
52
|
-
} satisfies Record<string, (...args: any) => CSSProperties>
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export type themeType = typeof theme
|
|
@@ -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
|
-
}
|