@wisdomgarden/torque-knowledge 1.0.6 → 1.0.8
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/README.md +4 -4
- package/dist/.meta.json +3 -3
- package/dist/components.db +0 -0
- package/dist/torque-components.md +14 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
| 文件 | 给谁 | 是什么 |
|
|
14
14
|
| --- | --- | --- |
|
|
15
15
|
| `dist/torque-components.md` | **diting**(`lms-web` 的 CI code review) | 选型决策树 + 可用组件清单 + 硬约束 + 禁止事项。**只有清单和策略,没有组件细节** —— 细节查 `components.db`。带 diting 认的 frontmatter(单行 `keywords` / `globs`),解包进它的 `rule_dirs` 就能被召回 |
|
|
16
|
-
| `dist/components.db` | **`lms-web` 的本地 MCP** + **diting** | SQLite 组件目录,MCP `search_component()` 和 diting `query_ui_components` 共同的数据源。
|
|
16
|
+
| `dist/components.db` | **`lms-web` 的本地 MCP** + **diting** | SQLite 组件目录,MCP `search_component()` 和 diting `query_ui_components` 共同的数据源。46 个组件的导出名(含 `Combobox.InfiniteDropdown` 这类点号子组件名)、英文描述、keywords 和完整 props |
|
|
17
17
|
| `dist/.meta.json` | CI / 下游漂移检测 | `{ knowledge, torque, generatedAt }` —— 这份知识是哪个版本、描述的又是哪个 torque 版本 |
|
|
18
18
|
|
|
19
19
|
## 版本与 `@wisdomgarden/torque` 相互独立
|
|
@@ -42,9 +42,9 @@ pnpm --filter @wisdomgarden/torque-knowledge build
|
|
|
42
42
|
|
|
43
43
|
```
|
|
44
44
|
packages/torque/src/index.ts ← 组件清单的唯一来源(不是 readdir)
|
|
45
|
-
packages/torque/src/components/*/readme.md ←
|
|
46
|
-
packages/torque/src/provider/readme.md ← 第
|
|
47
|
-
src/fallback.json ← 全部
|
|
45
|
+
packages/torque/src/components/*/readme.md ← 42 篇,props 和中文描述
|
|
46
|
+
packages/torque/src/provider/readme.md ← 第 43 篇
|
|
47
|
+
src/fallback.json ← 全部 46 个组件的英文描述(手工维护)
|
|
48
48
|
src/handwritten/*.md ← 人工提炼的正文片段
|
|
49
49
|
│
|
|
50
50
|
└──> scripts/gen.mjs ──> dist/
|
package/dist/.meta.json
CHANGED
package/dist/components.db
CHANGED
|
Binary file
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Torque UI component library — selection priority, available components, and hard constraints.
|
|
3
3
|
globs: src/**/*.{tsx,ts}
|
|
4
|
-
keywords: torque, component, ui, mantine, layout, button, icon-button, link-button, link-icon-button, tooltip, popover, drawer, bottom-drawer, modal, menu, message, notifications, alert, sticky-box, tag, tab, table, table-pagination, tree, tree-select, virtualized-tree-select, date-picker, filter, data-filter, base-input, form-wrapper, text-input, text-area, number-input, password-input, checkbox, radio, switch, select, multi-select, combobox, box, text, flex, group, stack, paper, unstyled-button, provider, iconbutton, linkbutton, linkiconbutton, bottomdrawer, messages, stickybox, tabs, tablepagination, treeselect, virtualizedtreeselect, datepicker, datafilter, baseinput, formitemwrapper, textinput, textarea, numberinput, passwordinput, multiselect, unstyledbutton, uiprovider
|
|
4
|
+
keywords: torque, component, ui, mantine, layout, button, icon-button, link-button, link-icon-button, tooltip, popover, drawer, bottom-drawer, modal, modal-deprecated, overlay-layer, menu, message, notifications, alert, sticky-box, tag, tab, table, table-pagination, tree, tree-select, virtualized-tree-select, date-picker, filter, data-filter, base-input, form-wrapper, text-input, text-area, number-input, password-input, checkbox, radio, switch, select, multi-select, combobox, box, text, flex, group, stack, paper, unstyled-button, provider, iconbutton, linkbutton, linkiconbutton, bottomdrawer, modaldeprecated, useoverlaylayer, messages, stickybox, tabs, tablepagination, treeselect, virtualizedtreeselect, datepicker, datafilter, baseinput, formitemwrapper, textinput, textarea, numberinput, passwordinput, multiselect, unstyledbutton, uiprovider
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Torque UI 组件库
|
|
8
8
|
|
|
9
|
-
> 由 `@wisdomgarden/torque-knowledge@1.0.
|
|
9
|
+
> 由 `@wisdomgarden/torque-knowledge@1.0.8` 生成,对应 `@wisdomgarden/torque@0.2.3`。
|
|
10
10
|
> 不要手改 —— 它是 npm 包解包出来的,下次装依赖就被覆盖。
|
|
11
11
|
|
|
12
12
|
## 导入方式
|
|
@@ -81,9 +81,11 @@ Component 里用(函数跨 Server/Client 边界无法序列化)。
|
|
|
81
81
|
| drawer | `Drawer`, `DrawerManager`, `drawers` |
|
|
82
82
|
| bottom-drawer | `BottomDrawer` |
|
|
83
83
|
| modal | `Modal` |
|
|
84
|
+
| modal-deprecated | `ModalDeprecated` |
|
|
85
|
+
| overlay-layer | `useOverlayLayer`, `OVERLAY_BASE`, `OVERLAY_TOP_MIN`, `OverlayTierScope` |
|
|
84
86
|
| menu | `Menu` |
|
|
85
87
|
| message | `messages` |
|
|
86
|
-
| notifications | `notifications`, `Notification` |
|
|
88
|
+
| notifications | `notifications`, `Notification`, `NotificationsContainer` |
|
|
87
89
|
| alert | `Alert`, `AlertSkeleton` |
|
|
88
90
|
| sticky-box | `StickyBox` |
|
|
89
91
|
| tag | `Tag` |
|
|
@@ -119,8 +121,7 @@ Component 里用(函数跨 Server/Client 边界无法序列化)。
|
|
|
119
121
|
|
|
120
122
|
## 硬约束
|
|
121
123
|
|
|
122
|
-
每一条都会**直接导致 bug
|
|
123
|
-
「AI 编码最佳实践 & 注意事项」。
|
|
124
|
+
每一条都会**直接导致 bug 或规范违规**,不是风格偏好。
|
|
124
125
|
|
|
125
126
|
### 表单
|
|
126
127
|
|
|
@@ -129,8 +130,8 @@ Component 里用(函数跨 Server/Client 边界无法序列化)。
|
|
|
129
130
|
`NumberInput` / `DatePicker` 系列 / `TreeSelect`)
|
|
130
131
|
- **表单控件已内置 `FormItemWrapper`**,外面不要再包 `Field` / `Form.Item`,
|
|
131
132
|
`DataFilter` 里的 `Select` 也一样 —— 会出现重复 label。
|
|
132
|
-
- **`TextInput` / `TextArea`
|
|
133
|
-
|
|
133
|
+
- **`TextInput` / `TextArea` 的字数统计要求受控或绑表单**(非受控且没传 `form` 时
|
|
134
|
+
计数不更新)。
|
|
134
135
|
- **`CheckboxGroup` 内的 `Checkbox` 不要手动绑 `checked` / `onChange`**,会被 Context
|
|
135
136
|
覆盖,只传 `value`。
|
|
136
137
|
- **`Switch` 的 `onChange` 参数是原生 `ChangeEvent`**,取值要 `e.currentTarget.checked`。
|
|
@@ -149,7 +150,7 @@ Component 里用(函数跨 Server/Client 边界无法序列化)。
|
|
|
149
150
|
|
|
150
151
|
- **`DataFilter` 里的下拉控件(`Select` / `MultiSelect` / `TreeSelect` / `DatePicker`)
|
|
151
152
|
保持 `withinPortal` 默认的 `true`,不要设 `false`** —— 设了下拉层会被 DataFilter 的
|
|
152
|
-
|
|
153
|
+
滚动容器裁剪。嵌套浮层的层级与关闭规则由 `overlay-layer` 统一处理。
|
|
153
154
|
- **移动端标题靠 `placeholder` / `title`**(`Select` / `MultiSelect` 用前者,
|
|
154
155
|
`Menu` / `Combobox.Dropdown` / `Filter` 用后者)。桌面端可能不显示,但在移动端
|
|
155
156
|
它是底部弹层的标题,不传就是没标题。
|
|
@@ -162,9 +163,10 @@ Component 里用(函数跨 Server/Client 边界无法序列化)。
|
|
|
162
163
|
再放交互元素会触发 a11y 的 `nested-interactive` 违规。
|
|
163
164
|
- **不要给 `Filter` / `IconFilter` 的 `buttonProps` / `iconButtonProps` 传 `onClick`**,
|
|
164
165
|
会覆盖内置的弹层开关,导致弹不出来。
|
|
165
|
-
- **`Popover`
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
- **`Popover` 的三个静默陷阱**:受控(传了 `opened`)漏传 `onOpenChange`,所有内部触发连同两个
|
|
167
|
+
hover 延迟一起失效(`trigger="none"` 除外,开发环境有 warn);开关按钮在浮层外时要
|
|
168
|
+
`closeOnClickOutside={false}`,否则 `mousedown` 捕获阶段的关闭早于按钮自己的 `click`;子元素上
|
|
169
|
+
与 `trigger` 同名的 handler 会被 `Popover.Target` 覆盖丢弃,要保留就传给 `<Popover.Target>` 自身。
|
|
168
170
|
|
|
169
171
|
### 文本与截断
|
|
170
172
|
|
|
@@ -199,7 +201,7 @@ Component 里用(函数跨 Server/Client 边界无法序列化)。
|
|
|
199
201
|
|
|
200
202
|
- ❌ **从 `@mantine/core` 导入 `Box` / `Text` / `Flex` / `Group` / `Stack` / `Paper` /
|
|
201
203
|
`UnstyledButton`。** 这些在 `@wisdomgarden/torque` 里都有同名替代品,行为和默认值
|
|
202
|
-
|
|
204
|
+
是本设计系统的。其他 Mantine 交互组件同理 —— 库里有的一律用库里的。
|
|
203
205
|
- ❌ **Mantine style props**:`p` / `m` / `bg` / `c` / `fz` / `fw` / `sx` / `styles`。
|
|
204
206
|
一律用 `className` + Tailwind。(`Flex` / `Group` / `Stack` 的 `gap` / `align` /
|
|
205
207
|
`justify` 是本库自己的 props,接受设计 token,不在此列。)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wisdomgarden/torque-knowledge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Machine-readable knowledge artifact for @wisdomgarden/torque — component catalog (SQLite) and AI coding rules (Markdown). Consumed by CI code review and local AI tooling, not by application runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|