@groupviz/react 2.1.0 → 2.1.2

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/API.md CHANGED
@@ -35,15 +35,19 @@ export function Figure() {
35
35
 
36
36
  ## 1. 元素引用(element reference)—— 所有元素类 props 的通用约定
37
37
 
38
- 群元素同时有两种记号:
38
+ 群元素同时有多种记号:
39
39
 
40
40
  | 记号 | 来源 | 例子(S₄) |
41
41
  |---|---|---|
42
42
  | `id` | 机器键,`GroupElement.id` | `"1,3,4,2"` |
43
- | `label` | 人类记号,`GroupElement.label` | `"34"` / `"e"` |
43
+ | `label` | 人类记号,`GroupElement.label` | `"34"` / `"234"` / `"(12)(34)"` / `"e"` |
44
44
  | `value` | 数组,`GroupElement.value` | `[1,3,4,2]` |
45
+ | 循环记号 | 手写置换 | `"(234)"` / `"(12)(34)"` / `"(1 2 3)"` |
45
46
 
46
- **下列 props 接受任一记号**,内部统一经 `core.resolveElement` 解析(匹配序 `id` `label` → `value`,忽略空白):
47
+ > `label` 约定**因群而异**:Aₙ 带括号(`(234)`),Sₙ 单环不带括号(`234`)、多环带括号(`(12)(34)`),循环群为指数(`3`),同构群为 `\alpha_3`。
48
+ > **不必记住用哪套**——手写标准循环记号即可,`resolveElement` 会按语义解析成同一个置换。
49
+
50
+ **下列 props 接受任一记号**,内部统一经 `core.resolveElement` 解析(匹配序 `id` → `label` → `value` → **循环记号语义档**,忽略空白):
47
51
 
48
52
  | 归属 | prop |
49
53
  |---|---|
@@ -326,11 +330,12 @@ import { I18nProvider, useTranslation } from '@groupviz/react'
326
330
 
327
331
  | 导出 | 签名 | 说明 |
328
332
  |---|---|---|
329
- | `resolveElement` | `(group, ref) => GroupElement \| null` | 元素引用解析(`id` → `label` → `value`,忽略空白) |
333
+ | `resolveElement` | `(group, ref) => GroupElement \| null` | 元素引用解析(`id` → `label` → `value` → **循环记号**,忽略空白) |
330
334
  | `findElement` | 同上 | `resolveElement` 的别名 |
331
335
  | `resolveElementRefs` | `(group, refs) => { elements, ids, unresolved }` | 批量解析 + 未命中回收 |
332
336
  | `resolveElementIds` | `(group, refs) => string[]` | 批量解析为规范 id(去重、丢未命中) |
333
337
  | `normalizeElementRef` | `(ref) => string` | 去空白归一化 |
338
+ | `parseCycleNotation` | `(ref, degree) => number[] \| null` | 循环记号 → 置换数组;`(234)`/`234`/`(12)(34)`/`(1 2 3)` 均可,非循环记号返回 `null` |
334
339
  | `elementOrder` | `(group, el) => number` | 元素阶(group-first 公共入口) |
335
340
  | `elementOrderDistribution` | `(group) => Map<number, number>` | 阶分布 |
336
341
  | `elementOrderDistributionOf` | `(elements, group) => Map<number, number>` | 子集阶分布 |
package/README.md CHANGED
@@ -68,12 +68,12 @@ import '@groupviz/react/theme.css' // 主题样式(模块化工程可 import
68
68
  **交互约定**:Scene 是纯受控内核——标签显隐 / hover 气泡 / 选中高亮等由宿主通过 props
69
69
  (`showLabels` / `onHover` / `onSelect`)注入。
70
70
 
71
- **完整 props 全表**:见包内 [API.md](./API.md)(10 个 Scene 逐项 + 便利层 + core 新增导出);
72
- 更多组合示例见仓库 `examples/host-minimal/`。
71
+ **完整 props 全表**:见 [docs/API.md](https://github.com/rrCathy/GroupViz/blob/main/docs/API.md)(10 个 Scene 逐项 + 便利层 + core 新增导出;该文件亦随包分发);
72
+ 更多组合示例见 [examples/host-minimal/](https://github.com/rrCathy/GroupViz/tree/main/examples/host-minimal)。
73
73
 
74
74
  **稳定性**:当前公开 API 为 2.x——破坏性变更才会升 major(core 与 react 成对同版发布,react peer 锁 core `^2.x`),
75
75
  非破坏性演进在 minor/patch 内进行;变更记录见 [GroupViz CHANGELOG](https://github.com/rrCathy/GroupViz/blob/main/docs/CHANGELOG.md)。
76
76
 
77
77
  **来源**:本包由 GroupViz 主仓库 `src/package/` 门面构建发布(单仓库内子目录产出,非 monorepo),
78
- 完整组件 / 交互文档:[GroupViz 主仓库](https://github.com/rrCathy/GroupViz)(docs/VIEWS.md · docs/PRESENTATION.md)。
78
+ 完整组件 / 交互文档:[GroupViz 主仓库](https://github.com/rrCathy/GroupViz)([docs/VIEWS.md](https://github.com/rrCathy/GroupViz/blob/main/docs/VIEWS.md) · [docs/PRESENTATION.md](https://github.com/rrCathy/GroupViz/blob/main/docs/PRESENTATION.md))。
79
79
  MIT License。
package/index.js CHANGED
@@ -726,7 +726,7 @@ function Ce(e, t, n) {
726
726
  if (r) return r;
727
727
  if (!e || t == null || t === "") return null;
728
728
  let i = `${n}|${e.symbol}|${t}`;
729
- return Se.has(i) || (Se.add(i), console.warn(`[groupviz] ${n}: 元素引用 ${JSON.stringify(t)} 在群 ${e?.symbol ?? "?"} 中解析不到(已试 id / label / value 三种记号),该项已忽略。`)), null;
729
+ return Se.has(i) || (Se.add(i), console.warn(`[groupviz] ${n}: 元素引用 ${JSON.stringify(t)} 在群 ${e?.symbol ?? "?"} 中解析不到(已试 id / label / value / 循环记号四种写法),该项已忽略。`)), null;
730
730
  }
731
731
  function we(e, t, n) {
732
732
  if (!t) return [];
@@ -1090,7 +1090,7 @@ var je = {
1090
1090
  "theme.viewWindowDark": "视图窗口切换为浅色",
1091
1091
  "theme.viewWindowLight": "视图窗口切换为深色",
1092
1092
  "welcome.subtitle": "群论可视化平台",
1093
- "welcome.version": "v2.1.0",
1093
+ "welcome.version": "v2.1.2",
1094
1094
  "welcome.tagline": "探索抽象代数的对称之美 — 交互式群论可视化与学习工具",
1095
1095
  "welcome.enter": "进入应用",
1096
1096
  "welcome.section.done": "已实现",
@@ -1719,7 +1719,7 @@ var je = {
1719
1719
  "theme.viewWindowDark": "View windows: switch to light",
1720
1720
  "theme.viewWindowLight": "View windows: switch to dark",
1721
1721
  "welcome.subtitle": "Group Theory Visualization Platform",
1722
- "welcome.version": "v2.1.0",
1722
+ "welcome.version": "v2.1.2",
1723
1723
  "welcome.tagline": "Explore the beauty of symmetry in abstract algebra — Interactive group theory visualization & learning tool",
1724
1724
  "welcome.enter": "Enter",
1725
1725
  "welcome.section.done": "Implemented",