Initial TrueGrowth source import
This commit is contained in:
26
openspec/changes/refactor-hover-tip-unification/proposal.md
Normal file
26
openspec/changes/refactor-hover-tip-unification/proposal.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Change: refactor hover tip unification
|
||||
|
||||
## Why
|
||||
|
||||
当前项目里的视觉 hover 提示交互分散在 `tdesign-react Tooltip`、`ToolButton title`、自定义 `HoverPopover`、`data-tooltip`、原生 `title`、CSS tips 和局部自制 hover tips 等多套实现中,导致样式、延迟、z-index、可访问性和维护成本都不一致。
|
||||
|
||||
这类交互是高频基础能力,如果不统一到共享组件,后续功能继续扩展时会不断复制分叉实现,稳定性和普适性都无法保证。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 新增共享 hover 组件层,提供 `HoverTip` 与 `HoverCard`,作为应用 UI 视觉 hover 提示的唯一实现入口
|
||||
- 将 `ToolButton` 与现有媒体预览 hover 基座统一到共享组件
|
||||
- 将直接使用 `tdesign-react Tooltip` 的组件迁移到 `HoverTip`
|
||||
- 收敛应用 UI 中原生 `title` / `data-tooltip` / CSS tips / 局部自制 hover tips 的视觉提示场景到共享组件
|
||||
- 增加静态检查,阻止在组件层继续直接引入 `Tooltip` 或新增非共享 hover 提示实现
|
||||
- 明确例外:Markdown/用户内容中的 `title` 保持内容语义;TDesign 表单 tips 保持表单能力边界
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `hover-feedback`
|
||||
- Affected code:
|
||||
- `packages/drawnix/src/components/shared/`
|
||||
- `packages/drawnix/src/components/tool-button.tsx`
|
||||
- `packages/drawnix/src/components/shared/media-preview/`
|
||||
- `packages/drawnix/src/components/audio-node-element/`
|
||||
- `packages/drawnix/src/components/canvas-search/`
|
||||
@@ -0,0 +1,63 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Application UI Hover Tips SHALL Use Shared Hover Components
|
||||
|
||||
The system SHALL use `HoverTip` or `HoverCard` for all application UI visual hover tips so that hover guidance follows consistent theme, delay, z-index, pointer behavior, and accessibility behavior.
|
||||
|
||||
#### Scenario: Action button shows shared hover tip
|
||||
|
||||
- **WHEN** a component needs to display a short hover tip for a button, icon, or status indicator
|
||||
- **THEN** it SHALL use `HoverTip`
|
||||
- **AND** SHALL NOT use native `title`, `data-tooltip`, CSS-only tips, or local ad-hoc hover tip implementations
|
||||
|
||||
#### Scenario: Rich hover content uses shared hover card
|
||||
|
||||
- **WHEN** a component needs hover content with richer layout or pointer continuity
|
||||
- **THEN** it SHALL use `HoverCard`
|
||||
- **AND** SHALL NOT create a local hover popover implementation
|
||||
|
||||
### Requirement: Interactive Hover Content SHALL Use A Shared Hover Card
|
||||
|
||||
The system SHALL provide a shared hover card component for hover content that needs pointer continuity or richer content than a short tip.
|
||||
|
||||
#### Scenario: Hover content remains visible across trigger and popup
|
||||
|
||||
- **WHEN** the pointer moves from the trigger into the hover popup
|
||||
- **THEN** the popup SHALL remain open long enough to preserve interaction continuity
|
||||
|
||||
#### Scenario: Hover card closes after leaving the interaction region
|
||||
|
||||
- **WHEN** the pointer leaves both trigger and popup
|
||||
- **THEN** the hover card SHALL close after a short unified delay
|
||||
|
||||
### Requirement: Component Layer SHALL Block Direct Tooltip Imports
|
||||
|
||||
The system SHALL prevent new component code from bypassing the shared hover layer with direct tooltip imports or non-shared application UI hover tips.
|
||||
|
||||
#### Scenario: Developer imports Tooltip directly in component code
|
||||
|
||||
- **WHEN** component-layer source code imports `Tooltip` from `tdesign-react`
|
||||
- **THEN** the repository checks SHALL fail
|
||||
- **AND** the change SHALL be redirected to the shared hover components
|
||||
|
||||
#### Scenario: Developer adds a non-shared visual hover tip
|
||||
|
||||
- **WHEN** component-layer source code adds native `title`, `data-tooltip`, CSS-only tips, or a local custom hover tip for application UI visual feedback
|
||||
- **THEN** the repository checks SHALL fail
|
||||
- **AND** the change SHALL be redirected to `HoverTip` or `HoverCard`
|
||||
|
||||
### Requirement: Hover Tip Exceptions SHALL Stay Explicit
|
||||
|
||||
The system SHALL allow only documented exceptions where hover metadata belongs to content semantics or an external form component boundary.
|
||||
|
||||
#### Scenario: Markdown or user content carries title metadata
|
||||
|
||||
- **WHEN** Markdown or user-authored content includes `title` metadata
|
||||
- **THEN** the system MAY preserve it as content data
|
||||
- **AND** SHALL NOT treat it as an application UI visual hover tip requirement
|
||||
|
||||
#### Scenario: TDesign form tips are used inside form controls
|
||||
|
||||
- **WHEN** a TDesign form component exposes built-in form tip behavior within the form API boundary
|
||||
- **THEN** the system MAY use that form tip behavior
|
||||
- **AND** SHALL NOT require wrapping it with `HoverTip` or `HoverCard`
|
||||
32
openspec/changes/refactor-hover-tip-unification/tasks.md
Normal file
32
openspec/changes/refactor-hover-tip-unification/tasks.md
Normal file
@@ -0,0 +1,32 @@
|
||||
## 1. Shared Hover Foundation
|
||||
|
||||
- [x] 1.1 新增 `HoverTip`,统一默认 theme、delay、z-index 与去除原生 `title`
|
||||
- [x] 1.2 新增 `HoverCard`,统一 hover 打开/关闭延迟与可停留浮层行为
|
||||
- [x] 1.3 为共享 hover 组件补充基础测试
|
||||
|
||||
## 2. Compatibility Refactor
|
||||
|
||||
- [x] 2.1 将 `ToolButton` 迁移到共享 `HoverTip`
|
||||
- [x] 2.2 将现有 `HoverPopover` 收敛为 `HoverCard` 兼容层
|
||||
- [x] 2.3 将直接 `Tooltip` 用法批量迁移为 `HoverTip`
|
||||
|
||||
## 3. Application UI Hover Cleanup
|
||||
|
||||
- [x] 3.1 收敛画布搜索按钮的原生 `title`
|
||||
- [x] 3.2 收敛音频播放器控制按钮的 `data-tooltip`
|
||||
- [x] 3.3 收敛提示词列表的原生 `title`
|
||||
- [x] 3.4 明确应用 UI 视觉 hover 提示统一使用 `HoverTip` / `HoverCard`
|
||||
- [x] 3.5 明确例外:Markdown/用户内容 `title` 与 TDesign 表单 tips
|
||||
|
||||
## 4. Guard Rails
|
||||
|
||||
- [x] 4.1 增加组件层 hover 用法检查脚本,禁止继续直接引入 `Tooltip` 或新增非共享视觉 hover 提示
|
||||
- [x] 4.2 将检查脚本接入 `drawnix` lint
|
||||
|
||||
## 5. Validation
|
||||
|
||||
- [x] 5.1 运行共享 hover 单测
|
||||
- [x] 5.2 运行 `drawnix` typecheck
|
||||
- [ ] 5.3 运行 `drawnix` lint
|
||||
|
||||
> 说明:`5.3` 当前被仓库既有 ESLint 基线问题阻塞,失败项与本次 hover 改造无直接关联,需在独立修复中处理。
|
||||
Reference in New Issue
Block a user