@groupviz/react 2.1.0 → 2.1.1
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 +9 -4
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/package.json +2 -2
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
|
-
|
|
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/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
|
|
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.
|
|
1093
|
+
"welcome.version": "v2.1.1",
|
|
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.
|
|
1722
|
+
"welcome.version": "v2.1.1",
|
|
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",
|