create-bubbles 0.1.25 → 0.1.26
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/dist/index.js +3 -9
- package/package.json +1 -1
- package/template-nextjs-vinext-eslint/Dockerfile +4 -4
- package/template-nextjs-vinext-eslint/README.md +6 -2
- package/template-nextjs-vinext-eslint/docker-compose.yaml +4 -4
- package/template-nextjs-vinext-eslint/eslint.config.js +2 -0
- package/template-nextjs-vinext-eslint/package.json +28 -26
- package/template-nextjs-vinext-eslint/pnpm-workspace.yaml +13 -1
- package/template-nextjs-vinext-eslint/src/utils/request/core/index.ts +63 -45
- package/template-nextjs-vinext-eslint/src/utils/request/core/utils.ts +12 -6
- package/template-nextjs-vinext-eslint/vite.config.ts +1 -1
- package/template-react-rsbuild-biome/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-react-rsbuild-biome/AGENTS.md +11 -0
- package/template-react-rsbuild-biome/index.html +2 -2
- package/template-react-rsbuild-biome/package.json +25 -24
- package/template-react-rsbuild-biome/pnpm-workspace.yaml +5 -0
- package/template-react-rsbuild-biome/rsbuild.config.ts +1 -1
- package/template-react-rsbuild-biome/src/assets/icon/logo.svg +1 -1
- package/template-react-rsbuild-biome/src/assets/svg/draft.svg +4 -0
- package/template-react-rsbuild-biome/src/components/Icon/svg-icon/README.md +37 -0
- package/template-react-rsbuild-biome/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-react-rsbuild-biome/src/env.d.ts +7 -0
- package/template-react-rsbuild-biome/src/utils/request/index.ts +3 -4
- package/template-react-rsbuild-biome/tsconfig.json +1 -2
- package/template-taro-react-oxc/.oxlintrc.json +0 -1
- package/template-taro-react-oxc/package.json +53 -52
- package/template-taro-react-oxc/pnpm-workspace.yaml +46 -0
- package/template-taro-vue-eslint/package.json +56 -56
- package/template-vp-monorepo-react-hono/apps/web/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-monorepo-react-hono/apps/web/AGENTS.md +11 -0
- package/template-vp-monorepo-react-hono/apps/web/package.json +1 -0
- package/template-vp-monorepo-react-hono/apps/web/src/assets/svg/draft.svg +4 -0
- package/template-vp-monorepo-react-hono/apps/web/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-monorepo-react-hono/apps/web/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-monorepo-react-hono/apps/web/tsconfig.json +1 -1
- package/template-vp-monorepo-react-hono/apps/web/vite.config.ts +2 -0
- package/template-vp-monorepo-react-hono/pnpm-workspace.yaml +1 -0
- package/template-vp-monorepo-react-nestjs/.agents/rules//344/273/243/347/240/201/350/256/276/350/256/241.md +4 -0
- package/template-vp-monorepo-react-nestjs/.agents/rules//345/205/261/344/272/253/344/273/243/347/240/201.md +4 -0
- package/template-vp-monorepo-react-nestjs/.spaces/01./344/274/201/344/270/232/347/272/247/351/241/271/347/233/256/347/272/247//351/234/200/346/261/202/346/226/207/346/241/243.md +177 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/04.upload.md +4504 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/05./344/270/212/344/274/240/346/224/271/351/200/240/346/226/271/346/241/210/README.md +858 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/06./345/205/254/345/205/261/351/230/237/345/210/227/346/216/245/345/205/245/346/226/271/346/241/210/README.md +1890 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/06./345/205/254/345/205/261/351/230/237/345/210/227/346/216/245/345/205/245/346/226/271/346/241/210//344/270/212/344/274/240/346/270/205/347/220/206.md +1465 -0
- package/template-vp-monorepo-react-nestjs/AGENTS.md +8 -12
- package/template-vp-monorepo-react-nestjs/apps/server/.agents/rules/error-handling.md +84 -0
- package/template-vp-monorepo-react-nestjs/apps/server/.env.development +60 -0
- package/template-vp-monorepo-react-nestjs/apps/server/.env.production +16 -0
- package/template-vp-monorepo-react-nestjs/apps/server/AGENTS.md +9 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/0000_military_colonel_america.sql +11 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/0001_loud_siren.sql +27 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/meta/0000_snapshot.json +97 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/meta/0001_snapshot.json +354 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/meta/_journal.json +20 -0
- package/template-vp-monorepo-react-nestjs/apps/server/package.json +4 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/app.module.ts +14 -2
- package/template-vp-monorepo-react-nestjs/apps/server/src/common/adapters/fastify.adapter.ts +6 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/config/index.ts +2 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/config/queue.config.ts +105 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/config/storage.config.ts +33 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/database/schema.ts +57 -1
- package/template-vp-monorepo-react-nestjs/apps/server/src/main.ts +1 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/auth/auth.service.ts +1 -3
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/auth/dto/auth-repsponse.dto.ts +2 -2
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/queue-worker.bootstrap.ts +24 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.constants.ts +24 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.contracts.ts +35 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.module.ts +56 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.processor.ts +62 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.service.ts +58 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/error-catelog.spec.ts +34 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/dto/initiate-mutipart-upload.dto.ts +26 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/dto/upload-params.dto.ts +15 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/storage/exact-size.transform.ts +66 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/storage/minio-storage.adapter.ts +239 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/storage/storage.port.ts +61 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.constants.ts +23 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.controller.ts +109 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.errors.ts +80 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.module.ts +20 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.reponsitory.ts +166 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.service.ts +696 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/utils/object-key.ts +10 -0
- package/template-vp-monorepo-react-nestjs/apps/server/test/task-queue.integration.spec.ts +120 -0
- package/template-vp-monorepo-react-nestjs/apps/server/test/task-queue.processor.spec.ts +63 -0
- package/template-vp-monorepo-react-nestjs/apps/server/test/task-queue.service.spec.ts +106 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//345/274/271/347/252/227/347/273/204/344/273/266.md +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//346/226/207/344/273/266/346/213/206/345/210/206.md +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//347/273/204/344/273/266/345/221/275/345/220/215.md +3 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//350/241/250/346/240/274/351/241/265/351/235/242.md +11 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//351/241/265/351/235/242/346/216/245/345/217/243.md +3 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.env.dev +1 -1
- package/template-vp-monorepo-react-nestjs/apps/web/AGENTS.md +16 -0
- package/template-vp-monorepo-react-nestjs/apps/web/README.MD +153 -0
- package/template-vp-monorepo-react-nestjs/apps/web/index.html +3 -2
- package/template-vp-monorepo-react-nestjs/apps/web/package.json +6 -1
- package/template-vp-monorepo-react-nestjs/apps/web/public/favicon.svg +9 -1
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.module.css +5 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.tsx +16 -9
- package/template-vp-monorepo-react-nestjs/apps/web/src/api/auth.ts +9 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/svg/draft.svg +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/DraftProTable/DraftProTable.module.css +78 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/DraftProTable/DraftProTable.tsx +99 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/DraftProTable/README.md +34 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/FullHeightProTable/FullHeightProTable.module.css +54 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/FullHeightProTable/FullHeightProTable.tsx +41 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.module.css +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.tsx +2 -1
- package/template-vp-monorepo-react-nestjs/apps/web/src/config/theme.ts +20 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/layouts/BasicLayout.module.css +17 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/layouts/BasicLayout.tsx +106 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/i18n/index.module.css +23 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/i18n/index.tsx +53 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/components/ProjectFormDialog.tsx +132 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/config/columns.tsx +121 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/config/index.ts +77 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/components/DraftProjectFormDialog.tsx +140 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/config/columns.tsx +127 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/config/index.ts +39 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/config/projects.ts +48 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/index.module.css +49 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/index.tsx +163 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/index.module.css +53 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/index.tsx +135 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.module.css +23 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.tsx +26 -43
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/login/api.ts +11 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/login/index.tsx +183 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/login/login.css +164 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/index.tsx +36 -12
- package/template-vp-monorepo-react-nestjs/apps/web/src/styles/index.css +11 -4
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/core/index.ts +55 -47
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/index.ts +10 -5
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/storage/cookie.ts +50 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/storage/session.ts +33 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/draft-projects.spec.ts +89 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/request.spec.ts +145 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/storage.spec.ts +108 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/tsconfig.json +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web/tsconfig.json +1 -1
- package/template-vp-monorepo-react-nestjs/apps/web/vite.config.ts +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web-vue/tsconfig.tsbuildinfo +1 -0
- package/template-vp-monorepo-react-nestjs/docker-compose.yml +19 -0
- package/template-vp-monorepo-react-nestjs/mise.toml +1 -1
- package/template-vp-monorepo-react-nestjs/package.json +1 -6
- package/template-vp-monorepo-react-nestjs/pnpm-workspace.yaml +9 -1
- package/template-vp-react/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-react/AGENTS.md +11 -0
- package/template-vp-react/commitlint.config.js +0 -0
- package/template-vp-react/package.json +21 -26
- package/template-vp-react/pnpm-workspace.yaml +6 -0
- package/template-vp-react/src/assets/svg/draft.svg +4 -0
- package/template-vp-react/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-react/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-react/src/utils/request/index.ts +18 -5
- package/template-vp-react/tsconfig.json +2 -3
- package/template-vp-react/vite.config.ts +2 -0
- package/template-vp-react-shadcn/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-react-shadcn/.vscode/settings.json +2 -2
- package/template-vp-react-shadcn/{agents.md → AGENTS.md} +12 -2
- package/template-vp-react-shadcn/README.md +41 -0
- package/template-vp-react-shadcn/commitlint.config.js +1 -1
- package/template-vp-react-shadcn/components.json +1 -1
- package/template-vp-react-shadcn/package.json +25 -32
- package/template-vp-react-shadcn/pnpm-workspace.yaml +10 -0
- package/template-vp-react-shadcn/src/App.tsx +10 -10
- package/template-vp-react-shadcn/src/assets/svg/draft.svg +4 -0
- package/template-vp-react-shadcn/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-react-shadcn/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-react-shadcn/src/components/Loading/PageLoading.tsx +4 -4
- package/template-vp-react-shadcn/src/components/Player/VideoJS/index.tsx +94 -78
- package/template-vp-react-shadcn/src/components/Player/index.ts +1 -1
- package/template-vp-react-shadcn/src/components/ui/button.tsx +25 -32
- package/template-vp-react-shadcn/src/components/ui/spinner.tsx +8 -7
- package/template-vp-react-shadcn/src/components/ui/toast.tsx +229 -0
- package/template-vp-react-shadcn/src/lib/utils.ts +3 -3
- package/template-vp-react-shadcn/src/main.tsx +5 -4
- package/template-vp-react-shadcn/src/pages/home/index.tsx +43 -35
- package/template-vp-react-shadcn/src/router/index.tsx +15 -15
- package/template-vp-react-shadcn/src/styles/index.css +4 -4
- package/template-vp-react-shadcn/src/styles/shadcn.css +2 -2
- package/template-vp-react-shadcn/src/utils/env/index.tsx +2 -2
- package/template-vp-react-shadcn/src/utils/request/alova-core/index.ts +102 -30
- package/template-vp-react-shadcn/src/utils/request/alova-core/utils.ts +5 -2
- package/template-vp-react-shadcn/src/utils/request/index.ts +32 -19
- package/template-vp-react-shadcn/src/utils/request/readme.md +41 -38
- package/template-vp-react-shadcn/tsconfig.json +2 -3
- package/template-vp-react-shadcn/vite.config.ts +29 -15
- package/template-vp-vue-eslint-vapor/package.json +26 -33
- package/template-vp-vue-eslint-vapor/pnpm-workspace.yaml +29 -1
- package/template-vue-vp-eslint/README.md +3 -10
- package/template-vue-vp-eslint/package.json +27 -34
- package/template-vue-vp-eslint/pnpm-workspace.yaml +27 -2
- package/template-vue-vp-eslint/src/layout/default/index.vue +4 -3
- package/template-vp-monorepo-react-nestjs/.agents/auth.config.ts +0 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/todo.md +0 -991
- package/template-vp-monorepo-react-nestjs/apps/server/README.md +0 -3
- package/template-vp-react-shadcn/.oxfmtrc.jsonc +0 -8
- package/template-vp-react-shadcn/.oxlintrc.jsonc +0 -3
- package/template-vp-react-shadcn/src/components/ui/sonner.tsx +0 -43
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<path d="M6.5 3.5h11L21 12v7a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 19v-7Z" />
|
|
3
|
+
<path d="M3 12h5.25a3.75 3.75 0 0 0 7.5 0H21" />
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SvgIcon
|
|
2
|
+
|
|
3
|
+
使用 `@rsbuild/plugin-svgr` 将本地 SVG 导入为 React 组件,再由 `SvgIcon` 统一控制大小与颜色。
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import DraftIcon from '@/assets/svg/draft.svg?react'
|
|
7
|
+
import SvgIcon from '@/components/Icon/svg-icon/SvgIcon'
|
|
8
|
+
;<SvgIcon icon={DraftIcon} size={24} color="#1677ff" />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| 参数 | 说明 |
|
|
12
|
+
| -------------------- | ----------------------------------------------------------------- |
|
|
13
|
+
| `icon` | 通过 `?react` 导入的 SVG 组件,必填 |
|
|
14
|
+
| `size` | 字号,数字按 px 处理,也支持 `1.5rem` 等 CSS 长度;不传时继承父级 |
|
|
15
|
+
| `color` | 图标颜色;不传时继承父级 |
|
|
16
|
+
| `className`、`style` | 原生 SVG 样式;`style` 中的同名设置优先 |
|
|
17
|
+
|
|
18
|
+
SVG 的宽高统一为 `1em`,因此 `font-size` 决定图标大小。`ref`、事件和其他 SVG 属性继续透传。默认作为装饰图标隐藏于辅助技术;需要独立表达含义时传 `role="img"` 和 `aria-label`。
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<span style={{ fontSize: 20, color: '#1677ff' }}>
|
|
22
|
+
<SvgIcon icon={DraftIcon} />
|
|
23
|
+
草稿
|
|
24
|
+
</span>
|
|
25
|
+
|
|
26
|
+
<SvgIcon icon={DraftIcon} size={24} role="img" aria-label="草稿" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
源文件规范:
|
|
30
|
+
|
|
31
|
+
- 保留 `viewBox`,保证缩放正确。
|
|
32
|
+
- 单色填充图标使用 `fill="currentColor"`;线条图标使用 `stroke="currentColor"`。
|
|
33
|
+
- 保留 `fill="none"`、`stroke="none"`,避免填实空心图形。
|
|
34
|
+
- 内部元素若写死颜色,也需要在源文件中改成 `currentColor` 才能跟随文字颜色。
|
|
35
|
+
- SVGR 与组件保留多色和渐变,不会强制覆盖所有颜色。
|
|
36
|
+
|
|
37
|
+
现有 `draft.svg` 已遵循上述规范。直接导入 `draft.svg` 仍然得到资源 URL,只有 `draft.svg?react` 会转换为 React 组件。
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentType, SVGProps } from 'react'
|
|
2
|
+
|
|
3
|
+
export type SvgIconProps = Omit<SVGProps<SVGSVGElement>, 'width' | 'height'> & {
|
|
4
|
+
icon: ComponentType<SVGProps<SVGSVGElement>>
|
|
5
|
+
size?: number | string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** SVG 源文件使用 currentColor;不传 size、color 时继承父级文字样式。 */
|
|
9
|
+
export default function SvgIcon({ icon: Icon, size, color, style, ...props }: SvgIconProps) {
|
|
10
|
+
return (
|
|
11
|
+
<Icon
|
|
12
|
+
aria-hidden={props['aria-label'] || props['aria-labelledby'] ? undefined : true}
|
|
13
|
+
focusable="false"
|
|
14
|
+
{...props}
|
|
15
|
+
width="1em"
|
|
16
|
+
height="1em"
|
|
17
|
+
style={{
|
|
18
|
+
display: 'inline-block',
|
|
19
|
+
verticalAlign: '-0.125em',
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
fontSize: size,
|
|
22
|
+
color,
|
|
23
|
+
...style,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -2,13 +2,12 @@ import { message } from 'antd'
|
|
|
2
2
|
import { router } from '@/router'
|
|
3
3
|
import { envVariables } from '../env'
|
|
4
4
|
import { createDualCallInstance } from './core'
|
|
5
|
-
import 'element-plus/es/components/message/style/css'
|
|
6
5
|
|
|
7
6
|
import { axiosRequestAdapter } from '@alova/adapter-axios'
|
|
8
|
-
import
|
|
7
|
+
import reactHook from 'alova/react'
|
|
9
8
|
|
|
10
9
|
// 🎯 获取基础配置
|
|
11
|
-
const getBaseConfig = ()
|
|
10
|
+
const getBaseConfig = () => {
|
|
12
11
|
return {
|
|
13
12
|
baseUrl: `/${envVariables.PUBLIC_API_AFFIX}`,
|
|
14
13
|
statusMap: {
|
|
@@ -31,7 +30,7 @@ const getBaseConfig = (): Parameters<typeof createDualCallInstance>[0] => {
|
|
|
31
30
|
router.navigate('/login')
|
|
32
31
|
message.error('登录过期或未登录')
|
|
33
32
|
},
|
|
34
|
-
statesHook:
|
|
33
|
+
statesHook: reactHook,
|
|
35
34
|
requestAdapter: axiosRequestAdapter(),
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["eslint", "typescript", "unicorn", "oxc", "react", "import"],
|
|
4
4
|
"rules": {
|
|
5
|
-
"react/jsx-uses-react": "off",
|
|
6
5
|
"react/react-in-jsx-scope": "off"
|
|
7
6
|
},
|
|
8
7
|
"ignorePatterns": ["dist/**", ".swc/**", "node_modules/**"]
|
|
@@ -34,68 +34,69 @@
|
|
|
34
34
|
"prepare": "lefthook install"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@alova/adapter-taro": "^2.0.
|
|
38
|
-
"@babel/runtime": "^7.
|
|
37
|
+
"@alova/adapter-taro": "^2.0.17",
|
|
38
|
+
"@babel/runtime": "^7.29.7",
|
|
39
39
|
"@nutui/icons-react-taro": "3.0.2-cpp.3.beta.9",
|
|
40
40
|
"@nutui/nutui-react-taro": "3.1.0-beta.1",
|
|
41
|
-
"@tarojs/components": "4.2.
|
|
42
|
-
"@tarojs/plugin-html": "4.2.
|
|
43
|
-
"@tarojs/react": "4.2.
|
|
44
|
-
"@tarojs/runtime": "4.2.
|
|
45
|
-
"@tarojs/shared": "4.2.
|
|
46
|
-
"@tarojs/taro": "4.2.
|
|
47
|
-
"alova": "^3.5.
|
|
41
|
+
"@tarojs/components": "4.2.1",
|
|
42
|
+
"@tarojs/plugin-html": "4.2.1",
|
|
43
|
+
"@tarojs/react": "4.2.1",
|
|
44
|
+
"@tarojs/runtime": "4.2.1",
|
|
45
|
+
"@tarojs/shared": "4.2.1",
|
|
46
|
+
"@tarojs/taro": "4.2.1",
|
|
47
|
+
"alova": "^3.5.5",
|
|
48
48
|
"classnames": "^2.5.1",
|
|
49
|
-
"dayjs": "^1.11.
|
|
50
|
-
"react": "^18.
|
|
51
|
-
"react-dom": "^18.
|
|
52
|
-
"zustand": "^5.0.
|
|
49
|
+
"dayjs": "^1.11.23",
|
|
50
|
+
"react": "^18.3.1",
|
|
51
|
+
"react-dom": "^18.3.1",
|
|
52
|
+
"zustand": "^5.0.15"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.
|
|
56
|
-
"@babel/plugin-transform-class-properties": "7.
|
|
57
|
-
"@babel/preset-react": "^7.
|
|
58
|
-
"@commitlint/cli": "^
|
|
59
|
-
"@commitlint/config-conventional": "^
|
|
55
|
+
"@babel/core": "^7.29.7",
|
|
56
|
+
"@babel/plugin-transform-class-properties": "7.29.7",
|
|
57
|
+
"@babel/preset-react": "^7.29.7",
|
|
58
|
+
"@commitlint/cli": "^21.2.2",
|
|
59
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
60
60
|
"@nutui/auto-import-resolver": "^1.0.0",
|
|
61
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.
|
|
62
|
-
"@tailwindcss/postcss": "^4.3.
|
|
63
|
-
"@tarojs/cli": "4.2.
|
|
64
|
-
"@tarojs/helper": "4.2.
|
|
65
|
-
"@tarojs/plugin-framework-react": "4.2.
|
|
66
|
-
"@tarojs/plugin-generator": "4.2.
|
|
67
|
-
"@tarojs/plugin-mini-ci": "
|
|
68
|
-
"@tarojs/plugin-platform-alipay": "4.2.
|
|
69
|
-
"@tarojs/plugin-platform-h5": "4.2.
|
|
70
|
-
"@tarojs/plugin-platform-harmony-hybrid": "4.2.
|
|
71
|
-
"@tarojs/plugin-platform-jd": "4.2.
|
|
72
|
-
"@tarojs/plugin-platform-qq": "4.2.
|
|
73
|
-
"@tarojs/plugin-platform-swan": "4.2.
|
|
74
|
-
"@tarojs/plugin-platform-tt": "4.2.
|
|
75
|
-
"@tarojs/plugin-platform-weapp": "4.2.
|
|
76
|
-
"@tarojs/taro-loader": "4.2.
|
|
77
|
-
"@tarojs/webpack5-runner": "4.2.
|
|
78
|
-
"@types/minimatch": "^5",
|
|
79
|
-
"@types/node": "^
|
|
80
|
-
"@types/react": "^18.
|
|
81
|
-
"@types/webpack-env": "^1.
|
|
82
|
-
"autoprefixer": "^10.5.
|
|
61
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.3",
|
|
62
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
63
|
+
"@tarojs/cli": "4.2.1",
|
|
64
|
+
"@tarojs/helper": "4.2.1",
|
|
65
|
+
"@tarojs/plugin-framework-react": "4.2.1",
|
|
66
|
+
"@tarojs/plugin-generator": "4.2.1",
|
|
67
|
+
"@tarojs/plugin-mini-ci": "4.2.1",
|
|
68
|
+
"@tarojs/plugin-platform-alipay": "4.2.1",
|
|
69
|
+
"@tarojs/plugin-platform-h5": "4.2.1",
|
|
70
|
+
"@tarojs/plugin-platform-harmony-hybrid": "4.2.1",
|
|
71
|
+
"@tarojs/plugin-platform-jd": "4.2.1",
|
|
72
|
+
"@tarojs/plugin-platform-qq": "4.2.1",
|
|
73
|
+
"@tarojs/plugin-platform-swan": "4.2.1",
|
|
74
|
+
"@tarojs/plugin-platform-tt": "4.2.1",
|
|
75
|
+
"@tarojs/plugin-platform-weapp": "4.2.1",
|
|
76
|
+
"@tarojs/taro-loader": "4.2.1",
|
|
77
|
+
"@tarojs/webpack5-runner": "4.2.1",
|
|
78
|
+
"@types/minimatch": "^5.1.2",
|
|
79
|
+
"@types/node": "^24.13.3",
|
|
80
|
+
"@types/react": "^18.3.31",
|
|
81
|
+
"@types/webpack-env": "^1.18.8",
|
|
82
|
+
"autoprefixer": "^10.5.5",
|
|
83
83
|
"babel-plugin-import": "^1.13.8",
|
|
84
|
-
"babel-preset-taro": "4.2.
|
|
85
|
-
"
|
|
84
|
+
"babel-preset-taro": "4.2.1",
|
|
85
|
+
"lefthook": "^2.1.12",
|
|
86
|
+
"lint-staged": "^17.5.0",
|
|
86
87
|
"miniprogram-ci": "^2.1.31",
|
|
87
|
-
"oxfmt": "^0.
|
|
88
|
-
"oxlint": "^1.
|
|
89
|
-
"postcss": "^8.5.
|
|
90
|
-
"react-refresh": "^0.14.
|
|
91
|
-
"sass": "^1.
|
|
92
|
-
"stylelint": "^
|
|
88
|
+
"oxfmt": "^0.67.0",
|
|
89
|
+
"oxlint": "^1.82.0",
|
|
90
|
+
"postcss": "^8.5.28",
|
|
91
|
+
"react-refresh": "^0.14.2",
|
|
92
|
+
"sass": "^1.104.0",
|
|
93
|
+
"stylelint": "^17.15.0",
|
|
93
94
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
94
|
-
"tailwindcss": "^4.3.
|
|
95
|
-
"tsconfig-paths-webpack-plugin": "^4.
|
|
96
|
-
"typescript": "^5.
|
|
95
|
+
"tailwindcss": "^4.3.3",
|
|
96
|
+
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
97
|
+
"typescript": "^5.9.3",
|
|
97
98
|
"unplugin-vue-components": "^32.1.0",
|
|
98
|
-
"weapp-tailwindcss": "^5.
|
|
99
|
+
"weapp-tailwindcss": "^5.5.2",
|
|
99
100
|
"webpack": "5.91.0"
|
|
100
101
|
},
|
|
101
102
|
"browserslist": {
|
|
@@ -7,7 +7,53 @@ allowBuilds:
|
|
|
7
7
|
core-js: true
|
|
8
8
|
core-js-pure: true
|
|
9
9
|
esbuild: true
|
|
10
|
+
lefthook: true
|
|
10
11
|
less: true
|
|
11
12
|
protobufjs: true
|
|
13
|
+
minimumReleaseAgeExclude:
|
|
14
|
+
- '@oxfmt/binding-android-arm-eabi@0.67.0'
|
|
15
|
+
- '@oxfmt/binding-android-arm64@0.67.0'
|
|
16
|
+
- '@oxfmt/binding-darwin-arm64@0.67.0'
|
|
17
|
+
- '@oxfmt/binding-darwin-x64@0.67.0'
|
|
18
|
+
- '@oxfmt/binding-freebsd-x64@0.67.0'
|
|
19
|
+
- '@oxfmt/binding-linux-arm-gnueabihf@0.67.0'
|
|
20
|
+
- '@oxfmt/binding-linux-arm-musleabihf@0.67.0'
|
|
21
|
+
- '@oxfmt/binding-linux-arm64-gnu@0.67.0'
|
|
22
|
+
- '@oxfmt/binding-linux-arm64-musl@0.67.0'
|
|
23
|
+
- '@oxfmt/binding-linux-ppc64-gnu@0.67.0'
|
|
24
|
+
- '@oxfmt/binding-linux-riscv64-gnu@0.67.0'
|
|
25
|
+
- '@oxfmt/binding-linux-riscv64-musl@0.67.0'
|
|
26
|
+
- '@oxfmt/binding-linux-s390x-gnu@0.67.0'
|
|
27
|
+
- '@oxfmt/binding-linux-x64-gnu@0.67.0'
|
|
28
|
+
- '@oxfmt/binding-linux-x64-musl@0.67.0'
|
|
29
|
+
- '@oxfmt/binding-openharmony-arm64@0.67.0'
|
|
30
|
+
- '@oxfmt/binding-win32-arm64-msvc@0.67.0'
|
|
31
|
+
- '@oxfmt/binding-win32-ia32-msvc@0.67.0'
|
|
32
|
+
- '@oxfmt/binding-win32-x64-msvc@0.67.0'
|
|
33
|
+
- '@oxlint/binding-android-arm-eabi@1.82.0'
|
|
34
|
+
- '@oxlint/binding-android-arm64@1.82.0'
|
|
35
|
+
- '@oxlint/binding-darwin-arm64@1.82.0'
|
|
36
|
+
- '@oxlint/binding-darwin-x64@1.82.0'
|
|
37
|
+
- '@oxlint/binding-freebsd-x64@1.82.0'
|
|
38
|
+
- '@oxlint/binding-linux-arm-gnueabihf@1.82.0'
|
|
39
|
+
- '@oxlint/binding-linux-arm-musleabihf@1.82.0'
|
|
40
|
+
- '@oxlint/binding-linux-arm64-gnu@1.82.0'
|
|
41
|
+
- '@oxlint/binding-linux-arm64-musl@1.82.0'
|
|
42
|
+
- '@oxlint/binding-linux-ppc64-gnu@1.82.0'
|
|
43
|
+
- '@oxlint/binding-linux-riscv64-gnu@1.82.0'
|
|
44
|
+
- '@oxlint/binding-linux-riscv64-musl@1.82.0'
|
|
45
|
+
- '@oxlint/binding-linux-s390x-gnu@1.82.0'
|
|
46
|
+
- '@oxlint/binding-linux-x64-gnu@1.82.0'
|
|
47
|
+
- '@oxlint/binding-linux-x64-musl@1.82.0'
|
|
48
|
+
- '@oxlint/binding-openharmony-arm64@1.82.0'
|
|
49
|
+
- '@oxlint/binding-win32-arm64-msvc@1.82.0'
|
|
50
|
+
- '@oxlint/binding-win32-ia32-msvc@1.82.0'
|
|
51
|
+
- '@oxlint/binding-win32-x64-msvc@1.82.0'
|
|
52
|
+
- '@weapp-tailwindcss/postcss-calc@1.0.6'
|
|
53
|
+
- '@weapp-tailwindcss/postcss@3.3.3'
|
|
54
|
+
- oxfmt@0.67.0
|
|
55
|
+
- oxlint@1.82.0
|
|
56
|
+
- weapp-style-injector@1.0.5
|
|
57
|
+
- weapp-tailwindcss@5.5.2
|
|
12
58
|
patchedDependencies:
|
|
13
59
|
'@tarojs/plugin-mini-ci': patches/@tarojs__plugin-mini-ci.patch
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "vue-taro-eslint",
|
|
6
6
|
"author": "",
|
|
7
|
-
"templateInfo": {
|
|
8
|
-
"name": "default",
|
|
9
|
-
"typescript": true,
|
|
10
|
-
"css": "Sass",
|
|
11
|
-
"framework": "Vue3"
|
|
12
|
-
},
|
|
13
7
|
"scripts": {
|
|
14
8
|
"new": "taro new",
|
|
15
9
|
"build:weapp": "taro build --type weapp --open",
|
|
@@ -35,81 +29,87 @@
|
|
|
35
29
|
"lint": "eslint",
|
|
36
30
|
"lint:fix": "eslint --fix"
|
|
37
31
|
},
|
|
38
|
-
"browserslist": {
|
|
39
|
-
"development": [
|
|
40
|
-
"defaults and fully supports es6-module",
|
|
41
|
-
"maintained node versions"
|
|
42
|
-
],
|
|
43
|
-
"production": [
|
|
44
|
-
"last 3 versions",
|
|
45
|
-
"Android >= 4.1",
|
|
46
|
-
"ios >= 8"
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
32
|
"dependencies": {
|
|
50
|
-
"@alova/adapter-taro": "^2.0.
|
|
33
|
+
"@alova/adapter-taro": "^2.0.17",
|
|
51
34
|
"@babel/runtime": "^7.29.7",
|
|
52
35
|
"@nutui/nutui-taro": "^4.3.14",
|
|
53
36
|
"@nutui/touch-emulator": "^1.0.0",
|
|
54
|
-
"@tarojs/components": "4.2.
|
|
55
|
-
"@tarojs/helper": "4.2.
|
|
56
|
-
"@tarojs/plugin-framework-vue3": "4.2.
|
|
57
|
-
"@tarojs/plugin-html": "4.2.
|
|
58
|
-
"@tarojs/plugin-platform-alipay": "4.2.
|
|
59
|
-
"@tarojs/plugin-platform-h5": "4.2.
|
|
60
|
-
"@tarojs/plugin-platform-harmony-hybrid": "4.2.
|
|
61
|
-
"@tarojs/plugin-platform-jd": "4.2.
|
|
62
|
-
"@tarojs/plugin-platform-qq": "4.2.
|
|
63
|
-
"@tarojs/plugin-platform-swan": "4.2.
|
|
64
|
-
"@tarojs/plugin-platform-tt": "4.2.
|
|
65
|
-
"@tarojs/plugin-platform-weapp": "4.2.
|
|
66
|
-
"@tarojs/runtime": "4.2.
|
|
67
|
-
"@tarojs/shared": "4.2.
|
|
68
|
-
"@tarojs/taro": "4.2.
|
|
69
|
-
"alova": "^3.5.
|
|
37
|
+
"@tarojs/components": "4.2.1",
|
|
38
|
+
"@tarojs/helper": "4.2.1",
|
|
39
|
+
"@tarojs/plugin-framework-vue3": "4.2.1",
|
|
40
|
+
"@tarojs/plugin-html": "4.2.1",
|
|
41
|
+
"@tarojs/plugin-platform-alipay": "4.2.1",
|
|
42
|
+
"@tarojs/plugin-platform-h5": "4.2.1",
|
|
43
|
+
"@tarojs/plugin-platform-harmony-hybrid": "4.2.1",
|
|
44
|
+
"@tarojs/plugin-platform-jd": "4.2.1",
|
|
45
|
+
"@tarojs/plugin-platform-qq": "4.2.1",
|
|
46
|
+
"@tarojs/plugin-platform-swan": "4.2.1",
|
|
47
|
+
"@tarojs/plugin-platform-tt": "4.2.1",
|
|
48
|
+
"@tarojs/plugin-platform-weapp": "4.2.1",
|
|
49
|
+
"@tarojs/runtime": "4.2.1",
|
|
50
|
+
"@tarojs/shared": "4.2.1",
|
|
51
|
+
"@tarojs/taro": "4.2.1",
|
|
52
|
+
"alova": "^3.5.5",
|
|
70
53
|
"pinia": "^3.0.4",
|
|
71
54
|
"pinia-plugin-persistedstate": "^4.7.1",
|
|
72
55
|
"spark-md5": "^3.0.2",
|
|
73
|
-
"vue": "^3.5.
|
|
56
|
+
"vue": "^3.5.42"
|
|
74
57
|
},
|
|
75
58
|
"devDependencies": {
|
|
76
|
-
"@antfu/eslint-config": "^9.
|
|
59
|
+
"@antfu/eslint-config": "^9.5.1",
|
|
77
60
|
"@babel/core": "^7.29.7",
|
|
78
61
|
"@babel/plugin-transform-class-properties": "7.29.7",
|
|
79
|
-
"@commitlint/cli": "^21.
|
|
80
|
-
"@commitlint/config-conventional": "^21.
|
|
62
|
+
"@commitlint/cli": "^21.2.2",
|
|
63
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
81
64
|
"@nutui/auto-import-resolver": "^1.0.0",
|
|
82
|
-
"@tarojs/cli": "4.2.
|
|
83
|
-
"@tarojs/plugin-generator": "4.2.
|
|
84
|
-
"@tarojs/plugin-mini-ci": "
|
|
85
|
-
"@tarojs/taro-loader": "4.2.
|
|
65
|
+
"@tarojs/cli": "4.2.1",
|
|
66
|
+
"@tarojs/plugin-generator": "4.2.1",
|
|
67
|
+
"@tarojs/plugin-mini-ci": "4.2.1",
|
|
68
|
+
"@tarojs/taro-loader": "4.2.1",
|
|
86
69
|
"@tarojs/test-utils-vue3": "^0.1.1",
|
|
87
|
-
"@tarojs/webpack5-runner": "4.2.
|
|
70
|
+
"@tarojs/webpack5-runner": "4.2.1",
|
|
88
71
|
"@types/minimatch": "^6.0.0",
|
|
89
|
-
"@types/node": "^24.13.
|
|
72
|
+
"@types/node": "^24.13.3",
|
|
90
73
|
"@types/webpack-env": "^1.18.8",
|
|
91
|
-
"@unocss/eslint-plugin": "^66.
|
|
74
|
+
"@unocss/eslint-plugin": "^66.10.0",
|
|
92
75
|
"@unocss/webpack": "0.58.9",
|
|
93
76
|
"@vue/babel-plugin-jsx": "^2.0.1",
|
|
94
|
-
"@vue/compiler-sfc": "^3.5.
|
|
95
|
-
"autoprefixer": "^10.5.
|
|
96
|
-
"babel-preset-taro": "4.2.
|
|
97
|
-
"css-loader": "^7.1.
|
|
98
|
-
"eslint": "^10.
|
|
99
|
-
"eslint-config-taro": "4.2.
|
|
77
|
+
"@vue/compiler-sfc": "^3.5.42",
|
|
78
|
+
"autoprefixer": "^10.5.5",
|
|
79
|
+
"babel-preset-taro": "4.2.1",
|
|
80
|
+
"css-loader": "^7.1.5",
|
|
81
|
+
"eslint": "^10.10.0",
|
|
82
|
+
"eslint-config-taro": "4.2.1",
|
|
100
83
|
"eslint-plugin-format": "^2.0.1",
|
|
101
|
-
"eslint-plugin-vue": "^10.
|
|
102
|
-
"lefthook": "^2.1.
|
|
84
|
+
"eslint-plugin-vue": "^10.11.0",
|
|
85
|
+
"lefthook": "^2.1.12",
|
|
103
86
|
"miniprogram-ci": "^2.1.31",
|
|
104
|
-
"postcss": "^8.5.
|
|
105
|
-
"sass": "^1.
|
|
87
|
+
"postcss": "^8.5.28",
|
|
88
|
+
"sass": "^1.104.0",
|
|
106
89
|
"style-loader": "^4.0.0",
|
|
107
90
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
108
91
|
"typescript": "^6.0.3",
|
|
109
92
|
"unocss": "0.58.9",
|
|
110
|
-
"unocss-preset-weapp": "0.58.
|
|
93
|
+
"unocss-preset-weapp": "0.58.9",
|
|
111
94
|
"unplugin-vue-components": "^32.1.0",
|
|
112
95
|
"vue-loader": "^17.4.2",
|
|
113
96
|
"webpack": "5.91.0"
|
|
97
|
+
},
|
|
98
|
+
"browserslist": {
|
|
99
|
+
"development": [
|
|
100
|
+
"defaults and fully supports es6-module",
|
|
101
|
+
"maintained node versions"
|
|
102
|
+
],
|
|
103
|
+
"production": [
|
|
104
|
+
"last 3 versions",
|
|
105
|
+
"Android >= 4.1",
|
|
106
|
+
"ios >= 8"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"templateInfo": {
|
|
110
|
+
"name": "default",
|
|
111
|
+
"typescript": true,
|
|
112
|
+
"css": "Sass",
|
|
113
|
+
"framework": "Vue3"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# SVG 使用
|
|
2
|
+
|
|
3
|
+
- 图标通过 `*.svg?react` 导入,使用 `@/components/Icon/svg-icon/SvgIcon` 渲染;用 `size`、`color` 控制大小和颜色,默认继承父级。
|
|
4
|
+
- 公共图标放 `src/assets/svg/`,页面专用图标放所属页面的 `assets/svg/`。
|
|
5
|
+
- 保留 `viewBox`;单色图标用 `currentColor`,保留 `none`、多色和渐变。
|
|
6
|
+
- 图片或背景直接导入 `*.svg` 获取 URL。
|
|
7
|
+
|
|
8
|
+
参数、无障碍设置及示例见 [SvgIcon 使用说明](../../src/components/Icon/svg-icon/README.md)。
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## 适用范围
|
|
2
|
+
|
|
3
|
+
本文件适用于 `apps/web` 及其子目录,同时遵循[根目录 AGENTS.md](../../AGENTS.md)中的通用规则。
|
|
4
|
+
|
|
5
|
+
## 按需规则
|
|
6
|
+
|
|
7
|
+
根据当前任务匹配下表,在执行相关操作前读取对应规则。不要预先加载整个 `.agents/rules/` 目录;任务范围变化时补读新命中的规则。
|
|
8
|
+
|
|
9
|
+
| 适用条件 | 规则文件 |
|
|
10
|
+
| -------------------- | ------------------------------------ |
|
|
11
|
+
| 新增、修改或使用 SVG | [SVG 使用](.agents/rules/SVG使用.md) |
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<path d="M6.5 3.5h11L21 12v7a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 19v-7Z" />
|
|
3
|
+
<path d="M3 12h5.25a3.75 3.75 0 0 0 7.5 0H21" />
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SvgIcon
|
|
2
|
+
|
|
3
|
+
使用 `vite-plugin-svgr` 将本地 SVG 导入为 React 组件,再由 `SvgIcon` 统一控制大小与颜色。
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import DraftIcon from '@/assets/svg/draft.svg?react'
|
|
7
|
+
import SvgIcon from '@/components/Icon/svg-icon/SvgIcon'
|
|
8
|
+
;<SvgIcon icon={DraftIcon} size={24} color="#1677ff" />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| 参数 | 说明 |
|
|
12
|
+
| -------------------- | ----------------------------------------------------------------- |
|
|
13
|
+
| `icon` | 通过 `?react` 导入的 SVG 组件,必填 |
|
|
14
|
+
| `size` | 字号,数字按 px 处理,也支持 `1.5rem` 等 CSS 长度;不传时继承父级 |
|
|
15
|
+
| `color` | 图标颜色;不传时继承父级 |
|
|
16
|
+
| `className`、`style` | 原生 SVG 样式;`style` 中的同名设置优先 |
|
|
17
|
+
|
|
18
|
+
SVG 的宽高统一为 `1em`,因此 `font-size` 决定图标大小。`ref`、事件和其他 SVG 属性继续透传。默认作为装饰图标隐藏于辅助技术;需要独立表达含义时传 `role="img"` 和 `aria-label`。
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<span style={{ fontSize: 20, color: '#1677ff' }}>
|
|
22
|
+
<SvgIcon icon={DraftIcon} />
|
|
23
|
+
草稿
|
|
24
|
+
</span>
|
|
25
|
+
|
|
26
|
+
<SvgIcon icon={DraftIcon} size={24} role="img" aria-label="草稿" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
源文件规范:
|
|
30
|
+
|
|
31
|
+
- 保留 `viewBox`,保证缩放正确。
|
|
32
|
+
- 单色填充图标使用 `fill="currentColor"`;线条图标使用 `stroke="currentColor"`。
|
|
33
|
+
- 保留 `fill="none"`、`stroke="none"`,避免填实空心图形。
|
|
34
|
+
- 内部元素若写死颜色,也需要在源文件中改成 `currentColor` 才能跟随文字颜色。
|
|
35
|
+
- SVGR 与组件保留多色和渐变,不会强制覆盖所有颜色。
|
|
36
|
+
|
|
37
|
+
现有 `draft.svg` 已遵循上述规范。直接导入 `draft.svg` 仍然得到资源 URL,只有 `draft.svg?react` 会转换为 React 组件。
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentType, SVGProps } from 'react'
|
|
2
|
+
|
|
3
|
+
export type SvgIconProps = Omit<SVGProps<SVGSVGElement>, 'width' | 'height'> & {
|
|
4
|
+
icon: ComponentType<SVGProps<SVGSVGElement>>
|
|
5
|
+
size?: number | string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** SVG 源文件使用 currentColor;不传 size、color 时继承父级文字样式。 */
|
|
9
|
+
export default function SvgIcon({ icon: Icon, size, color, style, ...props }: SvgIconProps) {
|
|
10
|
+
return (
|
|
11
|
+
<Icon
|
|
12
|
+
aria-hidden={props['aria-label'] || props['aria-labelledby'] ? undefined : true}
|
|
13
|
+
focusable="false"
|
|
14
|
+
{...props}
|
|
15
|
+
width="1em"
|
|
16
|
+
height="1em"
|
|
17
|
+
style={{
|
|
18
|
+
display: 'inline-block',
|
|
19
|
+
verticalAlign: '-0.125em',
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
fontSize: size,
|
|
22
|
+
color,
|
|
23
|
+
...style,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -2,6 +2,7 @@ import path from 'path'
|
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite'
|
|
3
3
|
import react from '@vitejs/plugin-react'
|
|
4
4
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
5
|
+
import svgr from 'vite-plugin-svgr'
|
|
5
6
|
import { defineConfig, loadEnv } from 'vite-plus'
|
|
6
7
|
|
|
7
8
|
export default defineConfig(({ mode }) => {
|
|
@@ -35,6 +36,7 @@ export default defineConfig(({ mode }) => {
|
|
|
35
36
|
},
|
|
36
37
|
plugins: [
|
|
37
38
|
react(),
|
|
39
|
+
svgr({ svgrOptions: { icon: true, ref: true } }),
|
|
38
40
|
AutoImport({
|
|
39
41
|
imports: ['react', 'react-router', 'react-dom'],
|
|
40
42
|
dts: './src/types/auto-imports.d.ts',
|