From c3f96f1638dea98bc8b7a21c766e31110cabc646 Mon Sep 17 00:00:00 2001 From: XiaoDaiGua-Ray <51957438+XiaoDaiGua-Ray@users.noreply.github.com> Date: Thu, 5 Nov 2026 11:30:47 +0800 Subject: [PATCH] feat(icons): refresh SVG assets and normalize icon sizing --- __test__/icons/registry.spec.ts | 3 + __test__/router/config.spec.ts | 18 + .../src/layout/components/MenuTag/index.tsx | 55 +- .../Search/GlobalSearchButton/index.tsx | 2 +- .../SettingDrawer/components/ThemeSwitch.tsx | 6 +- .../SiderBar/components/TooltipIcon/index.tsx | 2 - .../src/layout/components/SiderBar/index.tsx | 10 +- apps/admin/src/views/demo/svg-icons/index.tsx | 2 +- apps/admin/src/views/login/index.tsx | 2 +- .../reference/components/more-dropdown.md | 4 +- apps/docs/reference/icons.md | 32 +- packages/admin-shell/src/AdminShell.tsx | 2 +- packages/icons/ICON-SOURCES.md | 67 ++ packages/icons/LICENSE-ICONPARK | 201 ++++++ packages/icons/src/A_README.md | 11 +- packages/icons/src/action/add.svg | 8 + packages/icons/src/action/adjustment.svg | 13 +- packages/icons/src/action/close.svg | 13 +- packages/icons/src/action/close_left.svg | 14 +- packages/icons/src/action/close_other.svg | 20 +- packages/icons/src/action/close_right.svg | 14 +- packages/icons/src/action/copy.svg | 6 + packages/icons/src/action/delete.svg | 8 + packages/icons/src/action/download.svg | 8 + packages/icons/src/action/draggable.svg | 9 +- packages/icons/src/action/edit.svg | 6 + packages/icons/src/action/export_excel.svg | 15 - packages/icons/src/action/filter.svg | 6 + packages/icons/src/action/fullscreen.svg | 9 +- packages/icons/src/action/fullscreen_fold.svg | 15 +- packages/icons/src/action/link.svg | 7 + packages/icons/src/action/lock.svg | 12 +- packages/icons/src/action/more.svg | 20 +- packages/icons/src/action/mouse.svg | 11 +- packages/icons/src/action/out.svg | 13 +- packages/icons/src/action/print.svg | 23 +- packages/icons/src/action/reload.svg | 13 +- packages/icons/src/action/search.svg | 13 +- packages/icons/src/action/setting.svg | 14 +- packages/icons/src/action/shared.svg | 15 +- packages/icons/src/action/upload.svg | 6 + packages/icons/src/directional/enter.svg | 13 +- packages/icons/src/directional/expanded.svg | 11 +- packages/icons/src/directional/left_arrow.svg | 10 +- packages/icons/src/directional/resize_h.svg | 9 +- .../icons/src/directional/right_arrow.svg | 10 +- packages/icons/src/directional/row_end.svg | 17 +- packages/icons/src/directional/row_head.svg | 17 +- packages/icons/src/illustration/login_bg.svg | 602 ------------------ packages/icons/src/index.ts | 25 +- packages/icons/src/logo/office.svg | 6 - packages/icons/src/manifest.ts | 28 +- packages/icons/src/navigation/appearance.svg | 10 + packages/icons/src/navigation/barcode.svg | 6 + packages/icons/src/navigation/components.svg | 6 + packages/icons/src/navigation/dashboard.svg | 10 +- packages/icons/src/navigation/database.svg | 8 + packages/icons/src/navigation/document.svg | 8 + packages/icons/src/navigation/echart.svg | 10 +- packages/icons/src/navigation/flow.svg | 8 + packages/icons/src/navigation/form.svg | 8 + packages/icons/src/navigation/icons.svg | 7 + packages/icons/src/navigation/layout.svg | 9 + packages/icons/src/navigation/menu.svg | 12 +- packages/icons/src/navigation/other.svg | 17 +- packages/icons/src/navigation/qr_code.svg | 6 + packages/icons/src/navigation/rely.svg | 13 +- packages/icons/src/navigation/routing.svg | 7 + packages/icons/src/navigation/table.svg | 15 +- packages/icons/src/navigation/window.svg | 6 + packages/icons/src/status/error.svg | 10 +- packages/icons/src/status/question.svg | 20 +- packages/icons/src/status/success.svg | 7 + packages/icons/src/status/warning.svg | 8 + packages/icons/src/system/dark.svg | 12 +- packages/icons/src/system/language.svg | 17 +- packages/icons/src/system/light.svg | 12 +- packages/icons/src/system/system_os.svg | 18 +- packages/icons/src/system/watermark.svg | 9 + packages/routing/src/contract.ts | 7 +- packages/ui/src/RIcon/src/props.ts | 4 +- packages/ui/src/RMoreDropdown/src/props.ts | 3 +- .../RTablePro/src/components/ToolButton.tsx | 3 +- packages/ui/src/RTablePro/src/shared.ts | 1 - vite-helper/icons.ts | 11 + 85 files changed, 822 insertions(+), 962 deletions(-) create mode 100644 packages/icons/ICON-SOURCES.md create mode 100644 packages/icons/LICENSE-ICONPARK create mode 100644 packages/icons/src/action/add.svg create mode 100644 packages/icons/src/action/copy.svg create mode 100644 packages/icons/src/action/delete.svg create mode 100644 packages/icons/src/action/download.svg create mode 100644 packages/icons/src/action/edit.svg delete mode 100644 packages/icons/src/action/export_excel.svg create mode 100644 packages/icons/src/action/filter.svg create mode 100644 packages/icons/src/action/link.svg create mode 100644 packages/icons/src/action/upload.svg delete mode 100644 packages/icons/src/illustration/login_bg.svg delete mode 100644 packages/icons/src/logo/office.svg create mode 100644 packages/icons/src/navigation/appearance.svg create mode 100644 packages/icons/src/navigation/barcode.svg create mode 100644 packages/icons/src/navigation/components.svg create mode 100644 packages/icons/src/navigation/database.svg create mode 100644 packages/icons/src/navigation/document.svg create mode 100644 packages/icons/src/navigation/flow.svg create mode 100644 packages/icons/src/navigation/form.svg create mode 100644 packages/icons/src/navigation/icons.svg create mode 100644 packages/icons/src/navigation/layout.svg create mode 100644 packages/icons/src/navigation/qr_code.svg create mode 100644 packages/icons/src/navigation/routing.svg create mode 100644 packages/icons/src/navigation/window.svg create mode 100644 packages/icons/src/status/success.svg create mode 100644 packages/icons/src/status/warning.svg create mode 100644 packages/icons/src/system/watermark.svg diff --git a/__test__/icons/registry.spec.ts b/__test__/icons/registry.spec.ts index c1fc6816..98b066b6 100644 --- a/__test__/icons/registry.spec.ts +++ b/__test__/icons/registry.spec.ts @@ -47,6 +47,9 @@ describe('namespaced icons', () => { it('resolves existing persisted bare names without accepting unknown paths', () => { expect(resolveIconName('ray')).toBe('logo/ray') expect(resolveIconName('directional/resize_h')).toBe('directional/resize_h') + expect(isIconName('logo/office')).toBe(false) + expect(resolveIconName('office')).toBe('navigation/table') + expect(resolveIconName('illustration/login_bg')).toBe('navigation/other') expect(resolveIconName('unknown')).toBeUndefined() expect(resolveIconName('../ray')).toBeUndefined() }) diff --git a/__test__/router/config.spec.ts b/__test__/router/config.spec.ts index 0f6fdbbd..2aef1bd8 100644 --- a/__test__/router/config.spec.ts +++ b/__test__/router/config.spec.ts @@ -48,6 +48,24 @@ describe('route configuration', () => { expect(expandRoutes(restored)).toEqual(expandRoutes(bundled)) }) + it('migrates retired icon paths in both menu and external link metadata', () => { + const config = parse([ + { + ...page, + path: '/reports', + meta: { + icon: 'action/export_excel', + extra: { icon: 'logo/office' }, + }, + }, + ]) + + expect(config.routes[0].meta).toMatchObject({ + icon: 'action/download', + extra: { icon: 'navigation/table' }, + }) + }) + it('exports a strict versioned schema with recursive menu definitions', () => { const schema = getRouteJsonSchema() diff --git a/apps/admin/src/layout/components/MenuTag/index.tsx b/apps/admin/src/layout/components/MenuTag/index.tsx index ad78ea1a..38e0754e 100644 --- a/apps/admin/src/layout/components/MenuTag/index.tsx +++ b/apps/admin/src/layout/components/MenuTag/index.tsx @@ -35,9 +35,6 @@ export default defineComponent({ } = useSiderBar() // 当前右键标签页索引位置 const currentContextmenuIndex = ref(-1) - const iconConfig = { - size: 16, - } // 下拉菜单 const moreOptions = computed(() => [ { @@ -46,24 +43,22 @@ export default defineComponent({ disabled: !canClose( getMenuTagOptions.value[currentContextmenuIndex.value], ), - icon: () => , + icon: () => , }, { label: t('maximize'), key: 'maximizeLayoutContent', - icon: () => ( - - ), + icon: () => , }, { label: t('reload'), key: 'reloadCurrentPage', - icon: () => , + icon: () => , }, { label: t('newWindow'), key: 'windowOpenTab', - icon: () => , + icon: () => , }, { type: 'divider', @@ -75,7 +70,7 @@ export default defineComponent({ disabled: !getMenuTagOptions.value[currentContextmenuIndex.value] || !checkCloseLeft(currentContextmenuIndex.value), - icon: () => , + icon: () => , }, { label: t('closeRight'), @@ -83,7 +78,7 @@ export default defineComponent({ disabled: !getMenuTagOptions.value[currentContextmenuIndex.value] || !checkCloseRight(currentContextmenuIndex.value), - icon: () => , + icon: () => , }, { type: 'divider', @@ -93,14 +88,12 @@ export default defineComponent({ label: t('closeOther'), key: 'closeOther', disabled: getMenuTagOptions.value.length < 2, - icon: () => , + icon: () => , }, { label: t('closeAll'), key: 'closeAll', - icon: () => ( - - ), + icon: () => , disabled: getMenuTagOptions.value.length < 2, }, ]) @@ -274,14 +267,13 @@ export default defineComponent({ actionState, menuTagContextMenu, setCurrentContextmenuIndex, - iconConfig, maximize, reload, globalMainLayoutLoad, } }, render() { - const { iconConfig, getMenuTagOptions, globalMainLayoutLoad } = this + const { getMenuTagOptions, globalMainLayoutLoad } = this const { canClose, closeCurrentMenuTag, @@ -327,9 +319,6 @@ export default defineComponent({ icon: () => ( ), @@ -383,12 +372,9 @@ export default defineComponent({ icon: () => ( ), }} @@ -401,14 +387,7 @@ export default defineComponent({ onClick={() => this.maximize(true)} > {{ - icon: () => ( - - ), + icon: () => , }} ( ), }} @@ -440,8 +416,6 @@ export default defineComponent({ options={this.moreOptions} trigger="click" onSelect={this.actionDropdownSelect.bind(this)} - iconSize={18} - cursor="pointer" > {{ - icon: () => ( - - ), + icon: () => , }} diff --git a/apps/admin/src/layout/components/Search/GlobalSearchButton/index.tsx b/apps/admin/src/layout/components/Search/GlobalSearchButton/index.tsx index 7eeeae5d..b435ac9b 100644 --- a/apps/admin/src/layout/components/Search/GlobalSearchButton/index.tsx +++ b/apps/admin/src/layout/components/Search/GlobalSearchButton/index.tsx @@ -53,7 +53,7 @@ export default defineComponent({ style="margin-right: 16px" > {{ - icon: () => , + icon: () => , default: () => ( {$t('headerTooltip.Search')} diff --git a/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/components/ThemeSwitch.tsx b/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/components/ThemeSwitch.tsx index afc29306..6af742d8 100644 --- a/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/components/ThemeSwitch.tsx +++ b/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/components/ThemeSwitch.tsx @@ -44,8 +44,10 @@ export default defineComponent({ } > {{ - 'checked-icon': () => , - 'unchecked-icon': () => , + 'checked-icon': () => , + 'unchecked-icon': () => ( + + ), checked: () => '亮', unchecked: () => '暗', }} diff --git a/apps/admin/src/layout/components/SiderBar/components/TooltipIcon/index.tsx b/apps/admin/src/layout/components/SiderBar/components/TooltipIcon/index.tsx index 3bcd604d..89bc5116 100644 --- a/apps/admin/src/layout/components/SiderBar/components/TooltipIcon/index.tsx +++ b/apps/admin/src/layout/components/SiderBar/components/TooltipIcon/index.tsx @@ -31,9 +31,7 @@ export default defineComponent({ const Icon = () => ( ) diff --git a/apps/admin/src/layout/components/SiderBar/index.tsx b/apps/admin/src/layout/components/SiderBar/index.tsx index 2ed90894..47fd5b23 100644 --- a/apps/admin/src/layout/components/SiderBar/index.tsx +++ b/apps/admin/src/layout/components/SiderBar/index.tsx @@ -185,7 +185,7 @@ export default defineComponent({ )} onClick={toolIconClick.bind(this, curr.eventKey ?? curr.name)} > - + ))} ('layout.language')} class="override-button__layout" - focusable={false} > - + `} + v-copy={``} > {name.split('/').slice(1).join('/')} diff --git a/apps/admin/src/views/login/index.tsx b/apps/admin/src/views/login/index.tsx index ddc05336..f9142374 100644 --- a/apps/admin/src/views/login/index.tsx +++ b/apps/admin/src/views/login/index.tsx @@ -37,7 +37,7 @@ export default defineComponent({ trigger="click" > - + diff --git a/apps/docs/reference/components/more-dropdown.md b/apps/docs/reference/components/more-dropdown.md index 2d60e0da..ea10d273 100644 --- a/apps/docs/reference/components/more-dropdown.md +++ b/apps/docs/reference/components/more-dropdown.md @@ -19,8 +19,8 @@ import MoreDropdownDemo from '../../examples/MoreDropdownDemo.vue' | 属性 | 默认 | 说明 | | ---------- | --------------- | ------------------------------------- | | `icon` | `'action/more'` | 类型为 `IconName`,使用完整分包路径。 | -| `iconSize` | `14` | 默认触发图标大小。 | -| `cursor` | `'default'` | 默认图标指针样式。 | +| `iconSize` | 跟随 RIcon | 触发图标大小,省略时为 20 px。 | +| `cursor` | `'inherit'` | 默认继承所在控件的指针样式。 | `default` 插槽替换图标触发器。只有图标时建议用具有可访问名称的原生按钮或 `NButton`,方便键盘进入。列表行中根据业务需要阻止触发器的点击冒泡,避免同时触发行导航。 diff --git a/apps/docs/reference/icons.md b/apps/docs/reference/icons.md index 2daedbfa..b6202f42 100644 --- a/apps/docs/reference/icons.md +++ b/apps/docs/reference/icons.md @@ -10,7 +10,7 @@ import { RIcon } from '@ray-template/ui/icon' const name: IconName = 'directional/resize_h' -const renderIcon = () => +const renderIcon = () => ``` `RIcon.name` 和路由 `meta.icon` 使用同一套完整分包名。将 SVG 加入 `packages/icons/src/<分包>`,例如 `packages/icons/src/business/orders/approved.svg` 对应 `business/orders/approved`。可在演示的 SVG 图标页面查找并复制用法。 @@ -26,7 +26,7 @@ const renderIcon = () => ## 添加和生成 1. 选择现有分包(如 `action`、`navigation`、`system`),或按业务新建分包。路径段使用小写字母、数字、下划线或连字符,且以字母开头。 -2. 单色图标用 `currentColor`,留白用 `none`。品牌和插画保留原色。 +2. 单色图标用 `currentColor`,留白用 `none`。品牌保留原色。 3. 开发服务或 `pnpm icons:generate` 更新 `packages/icons/src/manifest.ts`;检查 `pnpm icons:check`,与 SVG 一起提交。不要手改联合类型。 生产时每个顶层分包生成独立、带 hash 的雪碧图,资源随部署 base 加载。迁移时直接改旧代码的裸名称;旧缓存仅当文件名唯一时自动转换。 @@ -37,18 +37,24 @@ const renderIcon = () => `RIcon`、`IconProps`、`iconProps`、`IconName` 和 `IconPackage` 从 `@/components` 导出。也可从 `@/icons` 导入图标类型。 -| 属性 | 默认 | 说明 | -| ------------------ | ---------------- | ---------------------------------------------- | -| `name` | 必填 | 完整的分包路径,首段用于选择雪碧图。 | -| `size` | `14` | 基础宽高,数字按像素,也可传 CSS 尺寸。 | -| `width` / `height` | `0` / `0` | 分别覆盖基础尺寸,`0` 回退到 `size`。 | -| `color` | `'currentColor'` | SVG 填充色;带原色的品牌和插画不会全部被覆盖。 | -| `prefix` | `'icon'` | symbol 前缀,须与生成配置一致。 | -| `customClassName` | 无 | 根元素的额外类名。 | -| `depth` | `1` | 图标透明层级。 | -| `cursor` | `'default'` | 指针样式。 | -| `onClick(event)` | 无 | 支持函数或回调数组。 | +| 属性 | 默认 | 说明 | +| ------------------ | ---------------- | ---------------------------------------- | +| `name` | 必填 | 完整的分包路径,首段用于选择雪碧图。 | +| `size` | `20` | 基础宽高,数字按像素,也可传 CSS 尺寸。 | +| `width` / `height` | `0` / `0` | 分别覆盖基础尺寸,`0` 回退到 `size`。 | +| `color` | `'currentColor'` | SVG 填充色;带原色的品牌不会全部被覆盖。 | +| `prefix` | `'icon'` | symbol 前缀,须与生成配置一致。 | +| `customClassName` | 无 | 根元素的额外类名。 | +| `depth` | `1` | 图标透明层级。 | +| `cursor` | `'inherit'` | 默认继承所在控件的指针样式。 | +| `onClick(event)` | 无 | 支持函数或回调数组。 | 图标内部 SVG 对读屏隐藏。如果用图标触发操作,把它放进具有可访问名称的按钮内,保留键盘操作和焦点。 [RIcon Props](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/packages/ui/src/RIcon/src/props.ts) · [雪碧图引用实现](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/packages/ui/src/RIcon/src/Icon.tsx) + +## 图标来源 + +通用图标选自 [Iconfont 的 IconPark 线性合辑](https://www.iconfont.cn/collections/detail?cid=51731)。[来源清单](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/packages/icons/ICON-SOURCES.md)按用途列出包内名称和对应的 Iconfont ID。单色图标跟随文本颜色;Ray 和其他品牌标识保留各自原色。 + +已有图标名优先保留。三个退役资源的旧路由配置会在读取时迁移:`action/export_excel` → `action/download`、`logo/office` → `navigation/table`、`illustration/login_bg` → `navigation/other`。新代码直接使用新的完整名称。 diff --git a/packages/admin-shell/src/AdminShell.tsx b/packages/admin-shell/src/AdminShell.tsx index 71db0def..f1f55121 100644 --- a/packages/admin-shell/src/AdminShell.tsx +++ b/packages/admin-shell/src/AdminShell.tsx @@ -185,7 +185,7 @@ export const AdminShell = defineComponent({ }} onClick={() => props.restore?.()} > - + ) : null} diff --git a/packages/icons/ICON-SOURCES.md b/packages/icons/ICON-SOURCES.md new file mode 100644 index 00000000..c04e6494 --- /dev/null +++ b/packages/icons/ICON-SOURCES.md @@ -0,0 +1,67 @@ +# 图标来源 + +操作、方向、导航、状态和系统图标来自 [Iconfont · 迈鼎icon](https://www.iconfont.cn/collections/detail?cid=51731) 的 IconPark 线性图形。原作者为 [ByteDance IconPark](https://github.com/bytedance/IconPark),Copyright 2019-present Bytedance Inc.;开源许可见 [Apache 2.0](LICENSE-ICONPARK)。表内 ID 对应该合辑的具体条目。入包时保留原始绘制路径,去掉透明画布路径和导出属性。按实际图形边界重设正方形视图框,让常规图标的主体约占八成半;省略号和展开箭头保留更多留白。轮廓补少量描边,使小尺寸下的线条更清楚,填充和描边均使用 `currentColor`。 + +品牌标识沿用仓库已有的 SVG。不要将品牌标识与这批通用线性图标的来源或许可混用。 + +| 图标路径 | 含义 | Iconfont ID | +| ------------------------- | ---------------- | ----------- | +| `action/adjustment` | 调节与密度 | 43971755 | +| `action/close` | 关闭 | 43971715 | +| `action/close_left` | 关闭左侧标签 | 43963762 | +| `action/close_other` | 关闭其他标签 | 43971709 | +| `action/close_right` | 关闭右侧标签 | 43963796 | +| `action/draggable` | 拖动 | 43970567 | +| `action/fullscreen` | 进入全屏 | 43970519 | +| `action/fullscreen_fold` | 退出全屏 | 43970505 | +| `action/lock` | 锁定 | 43970578 | +| `action/more` | 更多操作 | 43971752 | +| `action/mouse` | 鼠标与浏览器交互 | 43963496 | +| `action/out` | 退出 | 43963748 | +| `action/print` | 打印 | 43963390 | +| `action/reload` | 刷新与重试 | 43971771 | +| `action/search` | 搜索 | 43971773 | +| `action/setting` | 设置 | 43971792 | +| `action/shared` | 分享 | 43963969 | +| `action/add` | 新增 | 43971721 | +| `action/copy` | 复制 | 44587183 | +| `action/delete` | 删除 | 43970563 | +| `action/download` | 下载与导出 | 43963755 | +| `action/edit` | 编辑 | 43970366 | +| `action/filter` | 筛选 | 43970546 | +| `action/link` | 链接 | 43970476 | +| `action/upload` | 上传与导入 | 43963752 | +| `directional/enter` | 回车键 | 43963418 | +| `directional/expanded` | 下箭头与展开 | 43963753 | +| `directional/left_arrow` | 左箭头 | 43963808 | +| `directional/resize_h` | 水平调宽 | 43970706 | +| `directional/right_arrow` | 右箭头 | 43963720 | +| `directional/row_end` | 固定到末列 | 43970709 | +| `directional/row_head` | 固定到首列 | 43970682 | +| `navigation/dashboard` | 工作台 | 43970703 | +| `navigation/echart` | 图表与统计 | 43964136 | +| `navigation/menu` | 菜单 | 43971756 | +| `navigation/other` | 通用页面 | 43971760 | +| `navigation/rely` | 依赖关系 | 43963954 | +| `navigation/table` | 表格 | 43964166 | +| `navigation/appearance` | 外观与风格 | 43967447 | +| `navigation/barcode` | 条码 | 43967617 | +| `navigation/components` | 组件 | 43970685 | +| `navigation/database` | 缓存与数据 | 43964067 | +| `navigation/document` | 文档 | 43968045 | +| `navigation/flow` | 流程与层级 | 43963967 | +| `navigation/form` | 表单 | 43970427 | +| `navigation/icons` | 图标与资源 | 43970516 | +| `navigation/layout` | 页面布局 | 43970373 | +| `navigation/qr_code` | 二维码 | 43967582 | +| `navigation/routing` | 路由 | 43963960 | +| `navigation/window` | 窗口与嵌入页面 | 44567174 | +| `status/error` | 错误 | 43971705 | +| `status/question` | 帮助 | 43971699 | +| `status/success` | 成功 | 43971707 | +| `status/warning` | 注意 | 43971723 | +| `system/dark` | 深色模式 | 43964184 | +| `system/language` | 语言与翻译 | 43963919 | +| `system/light` | 浅色模式 | 43964181 | +| `system/system_os` | 跟随系统 | 43963546 | +| `system/watermark` | 水印与背景 | 43970747 | diff --git a/packages/icons/LICENSE-ICONPARK b/packages/icons/LICENSE-ICONPARK new file mode 100644 index 00000000..a77b915b --- /dev/null +++ b/packages/icons/LICENSE-ICONPARK @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019-present Bytedance Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/icons/src/A_README.md b/packages/icons/src/A_README.md index 4635a6e9..57368c9a 100644 --- a/packages/icons/src/A_README.md +++ b/packages/icons/src/A_README.md @@ -7,7 +7,7 @@ import { RIcon } from '@/components' import type { IconName } from '@/icons' const name: IconName = 'directional/resize_h' - + ``` `RIcon.name`、路由 `meta.icon`、侧栏 Logo 和图标包装组件共享严格的 `IconName` 联合类型。输入 `name` 时可获得完整分包路径提示,裸名称与不存在的路径会被 TypeScript 拒绝。类型来自文件生成,并非 TypeScript 自行读取文件系统。 @@ -22,15 +22,18 @@ const name: IconName = 'directional/resize_h' | `logo` | 品牌及产品标识 | | `status` | 错误、帮助等状态提示 | | `system` | 语言、明暗主题与系统偏好 | -| `illustration` | 保留原色的插画 | 文件/目录使用小写字母、数字、下划线或连字符,首字符为字母;SVG 必须位于分包内。允许嵌套,例如 `business/orders/approved.svg` 对应 `business/orders/approved`。不同分包允许同名文件。 -单色图标使用 `currentColor`,有意留白用 `none`。品牌和插画保留原色,不保证 `color` 覆盖其所有颜色。避免包含内置脚本、事件处理器和外部资源。 +单色图标使用 `currentColor`,有意留白用 `none`。品牌保留原色,不保证 `color` 覆盖其所有颜色。避免包含内置脚本、事件处理器和外部资源。 + +常规按钮使用 `` 即可,默认盒子为 20 px。菜单等组件已经定义图标尺寸时使用 `size="1em"`;紧凑的关闭按钮、行内提示或品牌标识可显式设定尺寸。新通用 SVG 要在同尺寸下比对现有线性图标:正方形视图框、主体约占 85%,箭头或省略号可多留一点空间。使用 `currentColor` 着色,并在浅色与深色背景检查小尺寸下的线条和留白。 + +详见[来源与授权清单](../ICON-SOURCES.md)。旧版的导出 Excel、Office 和登录插画已退役;读取历史路由和菜单时会分别迁移到下载、表格和通用页面图标。 ## 自动生成与注入 -- 新增、修改、删除或移动 SVG 时,开发服务自动检查并同步 `src/icons/manifest.ts`;增加或删除整个分包时自动重启开发服务。 +- 新增、修改、删除或移动 SVG 时,开发服务自动检查并同步 `packages/icons/src/manifest.ts`;增加或删除整个分包时自动重启开发服务。 - `pnpm dev`、`build`、`dev-build`、`report` 和 `check` 都先自动生成清单;直接调用 Vite 时也由插件在启动/构建阶段同步。`typecheck` 与 `icons:check` 继续保持只读。也可单独运行 `pnpm icons:generate`。将更新后的清单与 SVG 一起维护。生成文件由项目 Prettier 配置格式化,模板同时遵守 ESLint 的声明空行规则。 - `pnpm icons:check` 检查清单是否与目录一致,`pnpm typecheck` 和 `pnpm check` 会执行它。请修改生成脚本,不手工维护联合类型。 - 每个顶层分包输出独立带 hash 的 SVG 雪碧图。生成的分包地址由 Spritemap 插件转换为随 Vite base 的开发/生产路径,`RIcon` 根据 name 的包名选择地址,再引用包含完整路径的 symbol ID。 diff --git a/packages/icons/src/action/add.svg b/packages/icons/src/action/add.svg new file mode 100644 index 00000000..57746930 --- /dev/null +++ b/packages/icons/src/action/add.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/action/adjustment.svg b/packages/icons/src/action/adjustment.svg index bdca828e..e5ed679e 100644 --- a/packages/icons/src/action/adjustment.svg +++ b/packages/icons/src/action/adjustment.svg @@ -1,6 +1,7 @@ - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/close.svg b/packages/icons/src/action/close.svg index b4c2f6e7..abfe0645 100644 --- a/packages/icons/src/action/close.svg +++ b/packages/icons/src/action/close.svg @@ -1,6 +1,7 @@ - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/close_left.svg b/packages/icons/src/action/close_left.svg index e2bbd991..8c6598f9 100644 --- a/packages/icons/src/action/close_left.svg +++ b/packages/icons/src/action/close_left.svg @@ -1,7 +1,7 @@ - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/close_other.svg b/packages/icons/src/action/close_other.svg index bb1ca5c1..74d6d1c8 100644 --- a/packages/icons/src/action/close_other.svg +++ b/packages/icons/src/action/close_other.svg @@ -1,12 +1,8 @@ - - - - - - - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/action/close_right.svg b/packages/icons/src/action/close_right.svg index 7320190a..455ac792 100644 --- a/packages/icons/src/action/close_right.svg +++ b/packages/icons/src/action/close_right.svg @@ -1,7 +1,7 @@ - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/copy.svg b/packages/icons/src/action/copy.svg new file mode 100644 index 00000000..ef731f99 --- /dev/null +++ b/packages/icons/src/action/copy.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/action/delete.svg b/packages/icons/src/action/delete.svg new file mode 100644 index 00000000..d06734ca --- /dev/null +++ b/packages/icons/src/action/delete.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/action/download.svg b/packages/icons/src/action/download.svg new file mode 100644 index 00000000..4fafcc45 --- /dev/null +++ b/packages/icons/src/action/download.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/action/draggable.svg b/packages/icons/src/action/draggable.svg index d5ff298a..276883c4 100644 --- a/packages/icons/src/action/draggable.svg +++ b/packages/icons/src/action/draggable.svg @@ -1,3 +1,6 @@ - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/action/edit.svg b/packages/icons/src/action/edit.svg new file mode 100644 index 00000000..58cea269 --- /dev/null +++ b/packages/icons/src/action/edit.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/action/export_excel.svg b/packages/icons/src/action/export_excel.svg deleted file mode 100644 index 44937b41..00000000 --- a/packages/icons/src/action/export_excel.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/icons/src/action/filter.svg b/packages/icons/src/action/filter.svg new file mode 100644 index 00000000..ecf6aa41 --- /dev/null +++ b/packages/icons/src/action/filter.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/action/fullscreen.svg b/packages/icons/src/action/fullscreen.svg index 92f163c3..03fd2f34 100644 --- a/packages/icons/src/action/fullscreen.svg +++ b/packages/icons/src/action/fullscreen.svg @@ -1,3 +1,6 @@ - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/action/fullscreen_fold.svg b/packages/icons/src/action/fullscreen_fold.svg index e3e7c8a5..4f3b7a72 100644 --- a/packages/icons/src/action/fullscreen_fold.svg +++ b/packages/icons/src/action/fullscreen_fold.svg @@ -1,9 +1,6 @@ - - - - - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/action/link.svg b/packages/icons/src/action/link.svg new file mode 100644 index 00000000..aa41162a --- /dev/null +++ b/packages/icons/src/action/link.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/icons/src/action/lock.svg b/packages/icons/src/action/lock.svg index 12e8dcf5..c95b20f7 100644 --- a/packages/icons/src/action/lock.svg +++ b/packages/icons/src/action/lock.svg @@ -1,5 +1,7 @@ - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/more.svg b/packages/icons/src/action/more.svg index c18fd376..84895a13 100644 --- a/packages/icons/src/action/more.svg +++ b/packages/icons/src/action/more.svg @@ -1,12 +1,8 @@ - - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/action/mouse.svg b/packages/icons/src/action/mouse.svg index 4bf132eb..45a45b4f 100644 --- a/packages/icons/src/action/mouse.svg +++ b/packages/icons/src/action/mouse.svg @@ -1,3 +1,8 @@ - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/action/out.svg b/packages/icons/src/action/out.svg index 7e9e7f63..3adf159c 100644 --- a/packages/icons/src/action/out.svg +++ b/packages/icons/src/action/out.svg @@ -1,6 +1,7 @@ - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/print.svg b/packages/icons/src/action/print.svg index 0501d0c5..9e3ad7ee 100644 --- a/packages/icons/src/action/print.svg +++ b/packages/icons/src/action/print.svg @@ -1,15 +1,8 @@ - - - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/action/reload.svg b/packages/icons/src/action/reload.svg index bd608b77..7fb1cdcc 100644 --- a/packages/icons/src/action/reload.svg +++ b/packages/icons/src/action/reload.svg @@ -1,6 +1,7 @@ - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/search.svg b/packages/icons/src/action/search.svg index f8ad6e10..390a7fec 100644 --- a/packages/icons/src/action/search.svg +++ b/packages/icons/src/action/search.svg @@ -1,6 +1,7 @@ - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/setting.svg b/packages/icons/src/action/setting.svg index 10134eba..d432d0ac 100644 --- a/packages/icons/src/action/setting.svg +++ b/packages/icons/src/action/setting.svg @@ -1,7 +1,7 @@ - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/action/shared.svg b/packages/icons/src/action/shared.svg index 2dc0e023..f7931ad2 100644 --- a/packages/icons/src/action/shared.svg +++ b/packages/icons/src/action/shared.svg @@ -1,7 +1,8 @@ - - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/action/upload.svg b/packages/icons/src/action/upload.svg new file mode 100644 index 00000000..a3e1ebbb --- /dev/null +++ b/packages/icons/src/action/upload.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/directional/enter.svg b/packages/icons/src/directional/enter.svg index 921ee629..6c71323d 100644 --- a/packages/icons/src/directional/enter.svg +++ b/packages/icons/src/directional/enter.svg @@ -1,7 +1,8 @@ - - - - + + + + + + - \ No newline at end of file + diff --git a/packages/icons/src/directional/expanded.svg b/packages/icons/src/directional/expanded.svg index b77c37e4..2e4d0f4f 100644 --- a/packages/icons/src/directional/expanded.svg +++ b/packages/icons/src/directional/expanded.svg @@ -1,5 +1,6 @@ - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/directional/left_arrow.svg b/packages/icons/src/directional/left_arrow.svg index 356171b0..70815934 100644 --- a/packages/icons/src/directional/left_arrow.svg +++ b/packages/icons/src/directional/left_arrow.svg @@ -1,3 +1,7 @@ - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/directional/resize_h.svg b/packages/icons/src/directional/resize_h.svg index f78d5e09..7eaf9d3d 100644 --- a/packages/icons/src/directional/resize_h.svg +++ b/packages/icons/src/directional/resize_h.svg @@ -1,3 +1,6 @@ - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/directional/right_arrow.svg b/packages/icons/src/directional/right_arrow.svg index a1659e24..fdc9ba34 100644 --- a/packages/icons/src/directional/right_arrow.svg +++ b/packages/icons/src/directional/right_arrow.svg @@ -1,3 +1,7 @@ - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/directional/row_end.svg b/packages/icons/src/directional/row_end.svg index 14b913c4..20342338 100644 --- a/packages/icons/src/directional/row_end.svg +++ b/packages/icons/src/directional/row_end.svg @@ -1,9 +1,8 @@ - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/directional/row_head.svg b/packages/icons/src/directional/row_head.svg index 962e93dc..8fdec605 100644 --- a/packages/icons/src/directional/row_head.svg +++ b/packages/icons/src/directional/row_head.svg @@ -1,9 +1,8 @@ - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/illustration/login_bg.svg b/packages/icons/src/illustration/login_bg.svg deleted file mode 100644 index 12ed3eb1..00000000 --- a/packages/icons/src/illustration/login_bg.svg +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/icons/src/index.ts b/packages/icons/src/index.ts index 45c6f7fc..1d1c9f0f 100644 --- a/packages/icons/src/index.ts +++ b/packages/icons/src/index.ts @@ -4,13 +4,30 @@ import type { IconName } from './manifest' export { iconNames, iconPackages, isIconName } from './manifest' export type { IconName, IconPackage } from './manifest' +const retiredIcons = new Map([ + ['action/export_excel', 'action/download'], + ['logo/office', 'navigation/table'], + ['illustration/login_bg', 'navigation/other'], +]) + +export const replaceRetiredIconName = (value: string): string => + retiredIcons.get(value) ?? value + // 仅用于读取旧版缓存。存在多个同名图标时不猜测所属分包。 export function resolveIconName(value: unknown): IconName | undefined { - if (isIconName(value)) return value + if (typeof value !== 'string') return - if (typeof value !== 'string' || value.includes('/')) return + const name = replaceRetiredIconName(value) - const matches = iconNames.filter((name) => name.endsWith(`/${value}`)) + if (isIconName(name)) return name - return matches.length === 1 ? matches[0] : void 0 + if (name.includes('/')) return + + const matches = iconNames.filter((icon) => icon.endsWith(`/${name}`)) + + if (matches.length === 1) return matches[0] + + if (matches.length > 1) return + + return [...retiredIcons].find(([icon]) => icon.endsWith(`/${name}`))?.[1] } diff --git a/packages/icons/src/logo/office.svg b/packages/icons/src/logo/office.svg deleted file mode 100644 index 1bb9e2c5..00000000 --- a/packages/icons/src/logo/office.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/icons/src/manifest.ts b/packages/icons/src/manifest.ts index 08a7cca1..dd78fd64 100644 --- a/packages/icons/src/manifest.ts +++ b/packages/icons/src/manifest.ts @@ -1,14 +1,20 @@ // Generated by scripts/icons.mjs. Do not edit. export const iconNames = [ + 'action/add', 'action/adjustment', 'action/close', 'action/close_left', 'action/close_other', 'action/close_right', + 'action/copy', + 'action/delete', + 'action/download', 'action/draggable', - 'action/export_excel', + 'action/edit', + 'action/filter', 'action/fullscreen', 'action/fullscreen_fold', + 'action/link', 'action/lock', 'action/more', 'action/mouse', @@ -18,6 +24,7 @@ export const iconNames = [ 'action/search', 'action/setting', 'action/shared', + 'action/upload', 'directional/enter', 'directional/expanded', 'directional/left_arrow', @@ -25,25 +32,38 @@ export const iconNames = [ 'directional/right_arrow', 'directional/row_end', 'directional/row_head', - 'illustration/login_bg', 'logo/axios', 'logo/github', 'logo/google', - 'logo/office', 'logo/ray', 'logo/twitter', + 'navigation/appearance', + 'navigation/barcode', + 'navigation/components', 'navigation/dashboard', + 'navigation/database', + 'navigation/document', 'navigation/echart', + 'navigation/flow', + 'navigation/form', + 'navigation/icons', + 'navigation/layout', 'navigation/menu', 'navigation/other', + 'navigation/qr_code', 'navigation/rely', + 'navigation/routing', 'navigation/table', + 'navigation/window', 'status/error', 'status/question', + 'status/success', + 'status/warning', 'system/dark', 'system/language', 'system/light', 'system/system_os', + 'system/watermark', ] as const export type IconName = (typeof iconNames)[number] @@ -51,7 +71,6 @@ export type IconName = (typeof iconNames)[number] export const iconPackages = [ 'action', 'directional', - 'illustration', 'logo', 'navigation', 'status', @@ -63,7 +82,6 @@ export type IconPackage = (typeof iconPackages)[number] export const iconSprites = { action: '/__spritemap-action', directional: '/__spritemap-directional', - illustration: '/__spritemap-illustration', logo: '/__spritemap-logo', navigation: '/__spritemap-navigation', status: '/__spritemap-status', diff --git a/packages/icons/src/navigation/appearance.svg b/packages/icons/src/navigation/appearance.svg new file mode 100644 index 00000000..3fe4fe7d --- /dev/null +++ b/packages/icons/src/navigation/appearance.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/icons/src/navigation/barcode.svg b/packages/icons/src/navigation/barcode.svg new file mode 100644 index 00000000..ee4cc57c --- /dev/null +++ b/packages/icons/src/navigation/barcode.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/navigation/components.svg b/packages/icons/src/navigation/components.svg new file mode 100644 index 00000000..b7042d4a --- /dev/null +++ b/packages/icons/src/navigation/components.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/navigation/dashboard.svg b/packages/icons/src/navigation/dashboard.svg index f680d2a8..b0785516 100644 --- a/packages/icons/src/navigation/dashboard.svg +++ b/packages/icons/src/navigation/dashboard.svg @@ -1,4 +1,6 @@ - - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/navigation/database.svg b/packages/icons/src/navigation/database.svg new file mode 100644 index 00000000..2b88f3d8 --- /dev/null +++ b/packages/icons/src/navigation/database.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/navigation/document.svg b/packages/icons/src/navigation/document.svg new file mode 100644 index 00000000..5526b437 --- /dev/null +++ b/packages/icons/src/navigation/document.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/navigation/echart.svg b/packages/icons/src/navigation/echart.svg index 253fc303..4a8ff0c1 100644 --- a/packages/icons/src/navigation/echart.svg +++ b/packages/icons/src/navigation/echart.svg @@ -1,3 +1,7 @@ - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/navigation/flow.svg b/packages/icons/src/navigation/flow.svg new file mode 100644 index 00000000..a77fecb9 --- /dev/null +++ b/packages/icons/src/navigation/flow.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/navigation/form.svg b/packages/icons/src/navigation/form.svg new file mode 100644 index 00000000..d467479f --- /dev/null +++ b/packages/icons/src/navigation/form.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/navigation/icons.svg b/packages/icons/src/navigation/icons.svg new file mode 100644 index 00000000..4b8e9d46 --- /dev/null +++ b/packages/icons/src/navigation/icons.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/icons/src/navigation/layout.svg b/packages/icons/src/navigation/layout.svg new file mode 100644 index 00000000..3c907457 --- /dev/null +++ b/packages/icons/src/navigation/layout.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/icons/src/navigation/menu.svg b/packages/icons/src/navigation/menu.svg index cd8ec04d..ecd7529a 100644 --- a/packages/icons/src/navigation/menu.svg +++ b/packages/icons/src/navigation/menu.svg @@ -1,6 +1,6 @@ - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/navigation/other.svg b/packages/icons/src/navigation/other.svg index dc5d686a..c2d5207e 100644 --- a/packages/icons/src/navigation/other.svg +++ b/packages/icons/src/navigation/other.svg @@ -1,11 +1,6 @@ - - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/navigation/qr_code.svg b/packages/icons/src/navigation/qr_code.svg new file mode 100644 index 00000000..2d85f4d8 --- /dev/null +++ b/packages/icons/src/navigation/qr_code.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/navigation/rely.svg b/packages/icons/src/navigation/rely.svg index 3bb8d53d..bdf83ca5 100644 --- a/packages/icons/src/navigation/rely.svg +++ b/packages/icons/src/navigation/rely.svg @@ -1,6 +1,7 @@ - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/navigation/routing.svg b/packages/icons/src/navigation/routing.svg new file mode 100644 index 00000000..dad0ded7 --- /dev/null +++ b/packages/icons/src/navigation/routing.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/icons/src/navigation/table.svg b/packages/icons/src/navigation/table.svg index 81b761a0..ef2b906c 100644 --- a/packages/icons/src/navigation/table.svg +++ b/packages/icons/src/navigation/table.svg @@ -1,8 +1,7 @@ - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/navigation/window.svg b/packages/icons/src/navigation/window.svg new file mode 100644 index 00000000..1ee75cd5 --- /dev/null +++ b/packages/icons/src/navigation/window.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/icons/src/status/error.svg b/packages/icons/src/status/error.svg index ad9fb923..9133d9e3 100644 --- a/packages/icons/src/status/error.svg +++ b/packages/icons/src/status/error.svg @@ -1,4 +1,6 @@ - - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/status/question.svg b/packages/icons/src/status/question.svg index 39d3da0d..6eabe3fb 100644 --- a/packages/icons/src/status/question.svg +++ b/packages/icons/src/status/question.svg @@ -1,12 +1,8 @@ - - - - - \ No newline at end of file + + + + + + + + diff --git a/packages/icons/src/status/success.svg b/packages/icons/src/status/success.svg new file mode 100644 index 00000000..b5c20370 --- /dev/null +++ b/packages/icons/src/status/success.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/icons/src/status/warning.svg b/packages/icons/src/status/warning.svg new file mode 100644 index 00000000..1f52223c --- /dev/null +++ b/packages/icons/src/status/warning.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/icons/src/system/dark.svg b/packages/icons/src/system/dark.svg index e487c057..9278c437 100644 --- a/packages/icons/src/system/dark.svg +++ b/packages/icons/src/system/dark.svg @@ -1,6 +1,6 @@ - - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/system/language.svg b/packages/icons/src/system/language.svg index 3ed09636..fbabf7b8 100644 --- a/packages/icons/src/system/language.svg +++ b/packages/icons/src/system/language.svg @@ -1,10 +1,7 @@ - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/packages/icons/src/system/light.svg b/packages/icons/src/system/light.svg index e5e5c20d..55bfb87d 100644 --- a/packages/icons/src/system/light.svg +++ b/packages/icons/src/system/light.svg @@ -1,6 +1,6 @@ - - - - \ No newline at end of file + + + + + + diff --git a/packages/icons/src/system/system_os.svg b/packages/icons/src/system/system_os.svg index bd295ccf..5cad4a88 100644 --- a/packages/icons/src/system/system_os.svg +++ b/packages/icons/src/system/system_os.svg @@ -1,9 +1,9 @@ - - - - \ No newline at end of file + + + + + + + + + diff --git a/packages/icons/src/system/watermark.svg b/packages/icons/src/system/watermark.svg new file mode 100644 index 00000000..43602dfb --- /dev/null +++ b/packages/icons/src/system/watermark.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/routing/src/contract.ts b/packages/routing/src/contract.ts index 41d0c284..edf9a8c9 100644 --- a/packages/routing/src/contract.ts +++ b/packages/routing/src/contract.ts @@ -1,4 +1,4 @@ -import { isIconName } from '@ray-template/icons' +import { isIconName, replaceRetiredIconName } from '@ray-template/icons' import { getDotPath, safeParse } from 'valibot' import { joinRoutePath } from './join-route-path' import { routeConfigSchema } from './schema' @@ -105,6 +105,11 @@ export function createRouteContract(catalog: RouteCatalog) { names.add(key) } + if (meta.icon) meta.icon = replaceRetiredIconName(meta.icon) + + if (meta.extra?.icon) + meta.extra.icon = replaceRetiredIconName(meta.extra.icon) + for (const icon of [meta.icon, meta.extra?.icon]) { if (icon && !isIconName(icon)) fail(`Unknown icon "${icon}".`) } diff --git a/packages/ui/src/RIcon/src/props.ts b/packages/ui/src/RIcon/src/props.ts index 48eb16f2..e5cdfeed 100644 --- a/packages/ui/src/RIcon/src/props.ts +++ b/packages/ui/src/RIcon/src/props.ts @@ -17,7 +17,7 @@ const props = { }, size: { type: [Number, String], - default: 14, + default: 20, }, width: { type: [Number, String], @@ -40,7 +40,7 @@ const props = { cursor: { /** 鼠标指针样式 */ type: String, - default: 'default', + default: 'inherit', }, onClick: { type: [Function, Array] as PropType void>>, diff --git a/packages/ui/src/RMoreDropdown/src/props.ts b/packages/ui/src/RMoreDropdown/src/props.ts index 8d087ad4..a072391e 100644 --- a/packages/ui/src/RMoreDropdown/src/props.ts +++ b/packages/ui/src/RMoreDropdown/src/props.ts @@ -10,11 +10,10 @@ const props = { }, iconSize: { type: Number, - default: 14, }, cursor: { type: String, - default: 'default', + default: 'inherit', }, } as const diff --git a/packages/ui/src/RTablePro/src/components/ToolButton.tsx b/packages/ui/src/RTablePro/src/components/ToolButton.tsx index 71b29739..2f8a331d 100644 --- a/packages/ui/src/RTablePro/src/components/ToolButton.tsx +++ b/packages/ui/src/RTablePro/src/components/ToolButton.tsx @@ -3,7 +3,6 @@ import { NButton } from 'naive-ui' import { defineComponent } from 'vue' import type { PropType } from 'vue' import { RIcon } from '../../../RIcon' -import { config } from '../shared' export default defineComponent({ props: { @@ -27,7 +26,7 @@ export default defineComponent({ onClick={props.onClick} > {{ - icon: () => , + icon: () => , }} ) diff --git a/packages/ui/src/RTablePro/src/shared.ts b/packages/ui/src/RTablePro/src/shared.ts index 2951ece5..25aa9761 100644 --- a/packages/ui/src/RTablePro/src/shared.ts +++ b/packages/ui/src/RTablePro/src/shared.ts @@ -1,7 +1,6 @@ import type { InjectionKey, ShallowRef } from 'vue' export const config = { - tableIconSize: '18', wrapperKey: Symbol('table-pro-wrapper') as InjectionKey< Readonly> >, diff --git a/vite-helper/icons.ts b/vite-helper/icons.ts index 5c9c7b98..ea64a5c4 100644 --- a/vite-helper/icons.ts +++ b/vite-helper/icons.ts @@ -1,3 +1,4 @@ +import { readFile } from 'node:fs/promises' import { normalizePath } from 'vite' import type { Plugin } from 'vite' import { generateIcons, iconsRoot, scanIcons } from '../scripts/icons.mjs' @@ -14,6 +15,16 @@ export function iconManifestPlugin( buildStart() { return generateIcons() }, + async generateBundle() { + this.emitFile({ + type: 'asset', + fileName: 'licenses/iconpark.txt', + source: await readFile( + new URL('../packages/icons/LICENSE-ICONPARK', import.meta.url), + 'utf8', + ), + }) + }, configureServer(server) { const packages = new Set(registeredPackages) let pending = Promise.resolve()