@taocompany/magic-grid 0.14.2 → 0.14.3

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/AGENTS.md CHANGED
@@ -1,47 +1,47 @@
1
- # Magic Grid — Agent 约束
2
-
3
- 面向消费 `@taocompany/magic-grid` 的代码生成(读 `node_modules` 即可,勿依赖本仓库 playground)。
4
-
5
- ## 事实源优先级
6
-
7
- 1. `dist/api-manifest.json`(与安装版本绑定)
8
- 2. `dist/types/core.d.ts` + 组件 `MagicGrid.vue.d.ts`
9
- 3. 本文件与 `llms.txt`
10
-
11
- ## 命名(勿用其他表格库字段名)
12
-
13
- 生成代码须使用本库 API,勿沿用常见误写字段:
14
-
15
- | 误写 | 本库 |
16
- |------|------|
17
- | columnDefs | columns |
18
- | rowData | data |
19
- | field (列) | prop |
20
- | headerName | label |
21
- | colId (列) | key |
22
-
23
- ## 组件用法
24
-
25
- - 单文件组件:`<MagicGrid :columns="columns" :data="data" row-key="id" />`
26
- - 需要命令式 API:`import { MagicGrid, type MagicGridComponent } from '@taocompany/magic-grid'` + `import type { MagicGridExpose } from '@taocompany/magic-grid/types/core'` → `ref<InstanceType<MagicGridComponent> & MagicGridExpose>()` → **`gridRef.value?.api`**(`addRows` / `setData` / `stopEditing` 等在 **GridApi** 上;MCP 用 `get_component_api` **`section=api`**,`section=types` 查 `RowTransaction`)
27
- - `indexMode`(`'source' \| 'display'`)是 **GridApi.moveRow/moveRows 选项**,不是组件 prop。
28
-
29
- ## 样式
30
-
31
- ```ts
32
- import '@taocompany/magic-grid/tokens.css'
33
- import '@taocompany/magic-grid/style.css'
34
- ```
35
-
36
- ## 树形
37
-
38
- - `tree: true` 时必须提供 `getDataPath`(否则运行时报错)。
39
- - `tree` 与 `rowGrouping` 不能同时为 true。
40
-
41
- ## 校验
42
-
43
- 若项目配置了 `@taocompany/magic-grid-mcp`,优先调用 `validate_magic_grid_usage`;注意返回里的 `unchecked`,非字面量绑定不会全量验证。模板 `@event` 拼写错误由规则 **`unknown-emit`** 拦截(勿假设 `vue-tsc` 对全部 emit 名都能报错)。配置样例见仓库 `docs/mcp/client-setup.md`(npm 包用户可读对应版本的 GitHub / 内网文档)。
44
-
45
- ## 版本
46
-
47
- 以 `package.json` 的 `@taocompany/magic-grid` 版本为准;manifest 内 `libraryVersion` 应一致。消费端调用 MCP 时不写版本号,工具读取项目内已安装的库。`@taocompany/magic-grid-mcp` **与库同 semver 发布**(升库版本后运行 `pnpm mcp:version:sync`)。
1
+ # Magic Grid — Agent 约束
2
+
3
+ 面向消费 `@taocompany/magic-grid` 的代码生成(读 `node_modules` 即可,勿依赖本仓库 playground)。
4
+
5
+ ## 事实源优先级
6
+
7
+ 1. `dist/api-manifest.json`(与安装版本绑定)
8
+ 2. `dist/types/core.d.ts` + 组件 `MagicGrid.vue.d.ts`
9
+ 3. 本文件与 `llms.txt`
10
+
11
+ ## 命名(勿用其他表格库字段名)
12
+
13
+ 生成代码须使用本库 API,勿沿用常见误写字段:
14
+
15
+ | 误写 | 本库 |
16
+ |------|------|
17
+ | columnDefs | columns |
18
+ | rowData | data |
19
+ | field (列) | prop |
20
+ | headerName | label |
21
+ | colId (列) | key |
22
+
23
+ ## 组件用法
24
+
25
+ - 单文件组件:`<MagicGrid :columns="columns" :data="data" row-key="id" />`
26
+ - 需要命令式 API:`import { MagicGrid, type MagicGridComponent } from '@taocompany/magic-grid'` + `import type { MagicGridExpose } from '@taocompany/magic-grid/types/core'` → `ref<InstanceType<MagicGridComponent> & MagicGridExpose>()` → **`gridRef.value?.api`**(`addRows` / `setData` / `stopEditing` 等在 **GridApi** 上;MCP 用 `get_component_api` **`section=api`**,`section=types` 查 `RowTransaction`)
27
+ - `indexMode`(`'source' \| 'display'`)是 **GridApi.moveRow/moveRows 选项**,不是组件 prop。
28
+
29
+ ## 样式
30
+
31
+ ```ts
32
+ import '@taocompany/magic-grid/tokens.css'
33
+ import '@taocompany/magic-grid/style.css'
34
+ ```
35
+
36
+ ## 树形
37
+
38
+ - `tree: true` 时必须提供 `getDataPath`(否则运行时报错)。
39
+ - `tree` 与 `rowGrouping` 不能同时为 true。
40
+
41
+ ## 校验
42
+
43
+ 若项目配置了 `@taocompany/magic-grid-mcp`,优先调用 `validate_magic_grid_usage`;注意返回里的 `unchecked`,非字面量绑定不会全量验证。模板 `@event` 拼写错误由规则 **`unknown-emit`** 拦截(勿假设 `vue-tsc` 对全部 emit 名都能报错)。配置样例见仓库 `docs/mcp/client-setup.md`(npm 包用户可读对应版本的 GitHub / 内网文档)。
44
+
45
+ ## 版本
46
+
47
+ 以 `package.json` 的 `@taocompany/magic-grid` 版本为准;manifest 内 `libraryVersion` 应一致。消费端调用 MCP 时不写版本号,工具读取项目内已安装的库。`@taocompany/magic-grid-mcp` **与库同 semver 发布**(升库版本后运行 `pnpm mcp:version:sync`)。