@retikz/core 0.1.0-alpha.4 → 0.1.0-alpha.5

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.
Files changed (193) hide show
  1. package/dist/es/compile/compile.d.ts +6 -13
  2. package/dist/es/compile/compile.d.ts.map +1 -1
  3. package/dist/es/compile/compile.js +4 -10
  4. package/dist/es/compile/node.d.ts +40 -59
  5. package/dist/es/compile/node.d.ts.map +1 -1
  6. package/dist/es/compile/node.js +51 -43
  7. package/dist/es/compile/parseTarget.d.ts +3 -8
  8. package/dist/es/compile/parseTarget.d.ts.map +1 -1
  9. package/dist/es/compile/parseTarget.js +7 -19
  10. package/dist/es/compile/path.d.ts +2 -19
  11. package/dist/es/compile/path.d.ts.map +1 -1
  12. package/dist/es/compile/path.js +232 -213
  13. package/dist/es/compile/position.d.ts +4 -8
  14. package/dist/es/compile/position.d.ts.map +1 -1
  15. package/dist/es/compile/position.js +10 -10
  16. package/dist/es/compile/text-metrics.d.ts +2 -4
  17. package/dist/es/compile/text-metrics.d.ts.map +1 -1
  18. package/dist/es/compile/view-box.d.ts +1 -4
  19. package/dist/es/compile/view-box.d.ts.map +1 -1
  20. package/dist/es/compile/view-box.js +1 -4
  21. package/dist/es/geometry/arc.d.ts +3 -28
  22. package/dist/es/geometry/arc.d.ts.map +1 -1
  23. package/dist/es/geometry/arc.js +4 -31
  24. package/dist/es/geometry/bend.d.ts +2 -13
  25. package/dist/es/geometry/bend.d.ts.map +1 -1
  26. package/dist/es/geometry/bend.js +2 -13
  27. package/dist/es/geometry/circle.d.ts +5 -13
  28. package/dist/es/geometry/circle.d.ts.map +1 -1
  29. package/dist/es/geometry/circle.js +1 -4
  30. package/dist/es/geometry/diamond.d.ts +9 -24
  31. package/dist/es/geometry/diamond.d.ts.map +1 -1
  32. package/dist/es/geometry/diamond.js +4 -14
  33. package/dist/es/geometry/ellipse.d.ts +9 -15
  34. package/dist/es/geometry/ellipse.d.ts.map +1 -1
  35. package/dist/es/geometry/ellipse.js +4 -8
  36. package/dist/es/geometry/point.d.ts +8 -9
  37. package/dist/es/geometry/point.d.ts.map +1 -1
  38. package/dist/es/geometry/point.js +8 -9
  39. package/dist/es/geometry/polar.d.ts +12 -21
  40. package/dist/es/geometry/polar.d.ts.map +1 -1
  41. package/dist/es/geometry/polar.js +7 -14
  42. package/dist/es/geometry/rect.d.ts +8 -32
  43. package/dist/es/geometry/rect.d.ts.map +1 -1
  44. package/dist/es/geometry/rect.js +7 -33
  45. package/dist/es/geometry/segment.d.ts +11 -18
  46. package/dist/es/geometry/segment.d.ts.map +1 -1
  47. package/dist/es/geometry/segment.js +9 -16
  48. package/dist/es/index.d.ts +6 -10
  49. package/dist/es/index.d.ts.map +1 -1
  50. package/dist/es/index.js +4 -3
  51. package/dist/es/ir/coordinate.d.ts +18 -10
  52. package/dist/es/ir/coordinate.d.ts.map +1 -1
  53. package/dist/es/ir/coordinate.js +6 -11
  54. package/dist/es/ir/node.d.ts +46 -65
  55. package/dist/es/ir/node.d.ts.map +1 -1
  56. package/dist/es/ir/node.js +15 -46
  57. package/dist/es/ir/path/arrow.d.ts +210 -12
  58. package/dist/es/ir/path/arrow.d.ts.map +1 -1
  59. package/dist/es/ir/path/arrow.js +39 -12
  60. package/dist/es/ir/path/path.d.ts +477 -153
  61. package/dist/es/ir/path/path.d.ts.map +1 -1
  62. package/dist/es/ir/path/path.js +2 -2
  63. package/dist/es/ir/path/step.d.ts +395 -223
  64. package/dist/es/ir/path/step.d.ts.map +1 -1
  65. package/dist/es/ir/path/step.js +13 -14
  66. package/dist/es/ir/path/target.d.ts +25 -16
  67. package/dist/es/ir/path/target.d.ts.map +1 -1
  68. package/dist/es/ir/path/target.js +8 -6
  69. package/dist/es/ir/position/at-position.d.ts +4 -11
  70. package/dist/es/ir/position/at-position.d.ts.map +1 -1
  71. package/dist/es/ir/position/at-position.js +2 -9
  72. package/dist/es/ir/position/index.d.ts +1 -0
  73. package/dist/es/ir/position/index.d.ts.map +1 -1
  74. package/dist/es/ir/position/offset-position.d.ts +14 -0
  75. package/dist/es/ir/position/offset-position.d.ts.map +1 -0
  76. package/dist/es/ir/position/offset-position.js +14 -0
  77. package/dist/es/ir/position/polar-position.d.ts +1 -4
  78. package/dist/es/ir/position/polar-position.d.ts.map +1 -1
  79. package/dist/es/ir/position/polar-position.js +1 -4
  80. package/dist/es/ir/scene.d.ts +1200 -386
  81. package/dist/es/ir/scene.d.ts.map +1 -1
  82. package/dist/es/parsers/parseTargetSugar.d.ts.map +1 -1
  83. package/dist/es/parsers/parseTargetSugar.js +6 -19
  84. package/dist/es/parsers/parseWay.d.ts +26 -118
  85. package/dist/es/parsers/parseWay.d.ts.map +1 -1
  86. package/dist/es/parsers/parseWay.js +19 -61
  87. package/dist/es/primitive/ellipse.d.ts +4 -14
  88. package/dist/es/primitive/ellipse.d.ts.map +1 -1
  89. package/dist/es/primitive/group.d.ts +21 -3
  90. package/dist/es/primitive/group.d.ts.map +1 -1
  91. package/dist/es/primitive/path.d.ts +67 -7
  92. package/dist/es/primitive/path.d.ts.map +1 -1
  93. package/dist/es/primitive/scene.d.ts +2 -4
  94. package/dist/es/primitive/scene.d.ts.map +1 -1
  95. package/dist/es/primitive/text.d.ts +9 -32
  96. package/dist/es/primitive/text.d.ts.map +1 -1
  97. package/dist/lib/compile/compile.cjs +4 -10
  98. package/dist/lib/compile/compile.d.ts +6 -13
  99. package/dist/lib/compile/compile.d.ts.map +1 -1
  100. package/dist/lib/compile/node.cjs +51 -43
  101. package/dist/lib/compile/node.d.ts +40 -59
  102. package/dist/lib/compile/node.d.ts.map +1 -1
  103. package/dist/lib/compile/parseTarget.cjs +7 -19
  104. package/dist/lib/compile/parseTarget.d.ts +3 -8
  105. package/dist/lib/compile/parseTarget.d.ts.map +1 -1
  106. package/dist/lib/compile/path.cjs +231 -212
  107. package/dist/lib/compile/path.d.ts +2 -19
  108. package/dist/lib/compile/path.d.ts.map +1 -1
  109. package/dist/lib/compile/position.cjs +10 -10
  110. package/dist/lib/compile/position.d.ts +4 -8
  111. package/dist/lib/compile/position.d.ts.map +1 -1
  112. package/dist/lib/compile/text-metrics.d.ts +2 -4
  113. package/dist/lib/compile/text-metrics.d.ts.map +1 -1
  114. package/dist/lib/compile/view-box.cjs +1 -4
  115. package/dist/lib/compile/view-box.d.ts +1 -4
  116. package/dist/lib/compile/view-box.d.ts.map +1 -1
  117. package/dist/lib/geometry/arc.cjs +3 -31
  118. package/dist/lib/geometry/arc.d.ts +3 -28
  119. package/dist/lib/geometry/arc.d.ts.map +1 -1
  120. package/dist/lib/geometry/bend.cjs +2 -13
  121. package/dist/lib/geometry/bend.d.ts +2 -13
  122. package/dist/lib/geometry/bend.d.ts.map +1 -1
  123. package/dist/lib/geometry/circle.cjs +1 -4
  124. package/dist/lib/geometry/circle.d.ts +5 -13
  125. package/dist/lib/geometry/circle.d.ts.map +1 -1
  126. package/dist/lib/geometry/diamond.cjs +4 -14
  127. package/dist/lib/geometry/diamond.d.ts +9 -24
  128. package/dist/lib/geometry/diamond.d.ts.map +1 -1
  129. package/dist/lib/geometry/ellipse.cjs +4 -8
  130. package/dist/lib/geometry/ellipse.d.ts +9 -15
  131. package/dist/lib/geometry/ellipse.d.ts.map +1 -1
  132. package/dist/lib/geometry/point.cjs +8 -9
  133. package/dist/lib/geometry/point.d.ts +8 -9
  134. package/dist/lib/geometry/point.d.ts.map +1 -1
  135. package/dist/lib/geometry/polar.cjs +7 -14
  136. package/dist/lib/geometry/polar.d.ts +12 -21
  137. package/dist/lib/geometry/polar.d.ts.map +1 -1
  138. package/dist/lib/geometry/rect.cjs +7 -33
  139. package/dist/lib/geometry/rect.d.ts +8 -32
  140. package/dist/lib/geometry/rect.d.ts.map +1 -1
  141. package/dist/lib/geometry/segment.cjs +9 -16
  142. package/dist/lib/geometry/segment.d.ts +11 -18
  143. package/dist/lib/geometry/segment.d.ts.map +1 -1
  144. package/dist/lib/index.cjs +9 -2
  145. package/dist/lib/index.d.ts +6 -10
  146. package/dist/lib/index.d.ts.map +1 -1
  147. package/dist/lib/ir/coordinate.cjs +6 -11
  148. package/dist/lib/ir/coordinate.d.ts +18 -10
  149. package/dist/lib/ir/coordinate.d.ts.map +1 -1
  150. package/dist/lib/ir/node.cjs +15 -46
  151. package/dist/lib/ir/node.d.ts +46 -65
  152. package/dist/lib/ir/node.d.ts.map +1 -1
  153. package/dist/lib/ir/path/arrow.cjs +43 -11
  154. package/dist/lib/ir/path/arrow.d.ts +210 -12
  155. package/dist/lib/ir/path/arrow.d.ts.map +1 -1
  156. package/dist/lib/ir/path/path.cjs +1 -1
  157. package/dist/lib/ir/path/path.d.ts +477 -153
  158. package/dist/lib/ir/path/path.d.ts.map +1 -1
  159. package/dist/lib/ir/path/step.cjs +13 -14
  160. package/dist/lib/ir/path/step.d.ts +395 -223
  161. package/dist/lib/ir/path/step.d.ts.map +1 -1
  162. package/dist/lib/ir/path/target.cjs +9 -7
  163. package/dist/lib/ir/path/target.d.ts +25 -16
  164. package/dist/lib/ir/path/target.d.ts.map +1 -1
  165. package/dist/lib/ir/position/at-position.cjs +2 -9
  166. package/dist/lib/ir/position/at-position.d.ts +4 -11
  167. package/dist/lib/ir/position/at-position.d.ts.map +1 -1
  168. package/dist/lib/ir/position/index.d.ts +1 -0
  169. package/dist/lib/ir/position/index.d.ts.map +1 -1
  170. package/dist/lib/ir/position/offset-position.cjs +14 -0
  171. package/dist/lib/ir/position/offset-position.d.ts +14 -0
  172. package/dist/lib/ir/position/offset-position.d.ts.map +1 -0
  173. package/dist/lib/ir/position/polar-position.cjs +1 -4
  174. package/dist/lib/ir/position/polar-position.d.ts +1 -4
  175. package/dist/lib/ir/position/polar-position.d.ts.map +1 -1
  176. package/dist/lib/ir/scene.d.ts +1200 -386
  177. package/dist/lib/ir/scene.d.ts.map +1 -1
  178. package/dist/lib/parsers/parseTargetSugar.cjs +6 -19
  179. package/dist/lib/parsers/parseTargetSugar.d.ts.map +1 -1
  180. package/dist/lib/parsers/parseWay.cjs +19 -61
  181. package/dist/lib/parsers/parseWay.d.ts +26 -118
  182. package/dist/lib/parsers/parseWay.d.ts.map +1 -1
  183. package/dist/lib/primitive/ellipse.d.ts +4 -14
  184. package/dist/lib/primitive/ellipse.d.ts.map +1 -1
  185. package/dist/lib/primitive/group.d.ts +21 -3
  186. package/dist/lib/primitive/group.d.ts.map +1 -1
  187. package/dist/lib/primitive/path.d.ts +67 -7
  188. package/dist/lib/primitive/path.d.ts.map +1 -1
  189. package/dist/lib/primitive/scene.d.ts +2 -4
  190. package/dist/lib/primitive/scene.d.ts.map +1 -1
  191. package/dist/lib/primitive/text.d.ts +9 -32
  192. package/dist/lib/primitive/text.d.ts.map +1 -1
  193. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/ir/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBrB,CAAC;AAEJ,4CAA4C;AAC5C,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7C,qCAAqC;AACrC,eAAO,MAAM,kBAAkB,EAAG,CAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseTargetSugar.d.ts","sourceRoot":"","sources":["../../../src/parsers/parseTargetSugar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqBtC,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,QAWjD,CAAC"}
1
+ {"version":3,"file":"parseTargetSugar.d.ts","sourceRoot":"","sources":["../../../src/parsers/parseTargetSugar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQtC,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,QAWjD,CAAC"}
@@ -1,31 +1,18 @@
1
1
  //#region src/parsers/parseTargetSugar.ts
2
2
  /**
3
- * Sugar 字符串解析:识别 TikZ 风格的相对偏移字面量,把 `'+1,0'` /
4
- * `'++1.5,-2'` 这类字符串转成 IR { rel } / { relAccumulate } 对象;
5
- * 其它形态(节点 id `'A'` / `'A.north'`、笛卡尔元组、极坐标对象、已经
6
- * 是 rel/relAccumulate 对象)原样返回。
7
- *
8
- * 语法:
9
- * - `'+<dx>,<dy>'` → `{ rel: [dx, dy] }` (TikZ `+` 语义,不更新 prevEnd)
10
- * - `'++<dx>,<dy>'` → `{ relAccumulate: [dx, dy] }` (TikZ `++` 语义,累积更新)
11
- * - `<dx>` / `<dy>`:可带正负号小数,如 `'+1,0'` / `'++1.5,-2.5'` / `'+ -3, 4'`
12
- *
13
- * 不匹配的字符串(如 `'A'` / `'A.north'` / `'A.30'`)原样返回——首字母为字母时
14
- * 不会撞 `+` 前缀;含 `.` 但不含 `,` 的也不撞。
15
- *
16
- * 这是纯函数,没有 nodeIndex 依赖,住在 core/parsers,react adapter 与
17
- * Draw way DSL 共用。
3
+ * Sugar 字符串解析:TikZ 风格相对偏移字面量 IR 对象
4
+ * @description `'+dx,dy'` `{relative:[dx,dy]}`(TikZ `+`,不更新 prevEnd);`'++dx,dy'` `{relativeAccumulate:[dx,dy]}`(TikZ `++`,累积);其他形态(节点 id、笛卡尔/极坐标、已是 relative 对象)原样返回。纯函数无 nodeIndex 依赖,react adapter 与 Draw DSL 共用
18
5
  */
19
- var REL_RE = /^(\+{1,2})\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/;
6
+ var RELATIVE_OFFSET_RE = /^(\+{1,2})\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/;
20
7
  var parseTargetSugar = (input) => {
21
8
  if (typeof input !== "string") return input;
22
- const match = input.match(REL_RE);
9
+ const match = input.match(RELATIVE_OFFSET_RE);
23
10
  if (!match) return input;
24
11
  const plus = match[1];
25
12
  const dx = Number(match[2]);
26
13
  const dy = Number(match[3]);
27
- if (plus === "++") return { relAccumulate: [dx, dy] };
28
- return { rel: [dx, dy] };
14
+ if (plus === "++") return { relativeAccumulate: [dx, dy] };
15
+ return { relative: [dx, dy] };
29
16
  };
30
17
  //#endregion
31
18
  export { parseTargetSugar };
@@ -1,98 +1,48 @@
1
1
  import { IRControlPoint, IRStep, IRStepLabel, IRTarget } from '../ir';
2
2
  /**
3
- * Sugar 层 way 数组的"关键字常量"。
4
- *
5
- * - `DrawWay.Cycle`:闭合到 way 起点(way 元素位置)。**底层字符串故意取得很丑**
6
- * (`'retikz-keyword_cycle'`),保证不会与任何合理的节点 id 冲突;用户应当
7
- * 只通过 `DrawWay.Cycle` 引用,不要直接写裸字面量。
8
- * - `DrawWay.Hv`:折角算子,先水平后垂直(裸字面量 `'-|'`)。
9
- * - `DrawWay.Vh`:折角算子,先垂直后水平(裸字面量 `'|-'`)。
10
- * - `DrawWay.Relative` / `DrawWay.Accumulate`:相对偏移 way item 的 `type` 鉴别字段值。
11
- * 配合 `{ position: [dx, dy], type: DrawWay.Relative | DrawWay.Accumulate }` 用——
12
- * `Relative` 等价 TikZ `(+x, +y)`(不更新 prevEnd),`Accumulate` 等价 TikZ `(++x, ++y)`
13
- * (累积更新)。底层字符串同样刻意写丑,保证不撞节点 id;用户只通过常量引用。
14
- *
15
- * 折角值(`-|` / `|-`)含特殊字符,与节点 id 不会冲突,因此**保留字面量与
16
- * 常量两种写法都合法**。way 数组里直接放 `'-|'` 或 `'|-'`(infix 算子)
17
- * 即把"上一项 → 下一项"那一段改成折角。
18
- *
19
- * 这里**故意不用 TS enum**——enum 在数值场景下生成 reverse-mapping 表、
20
- * 在 string 场景下与字面量类型不互通,而 const + `as const` 的字面量联合
21
- * 既可枚举也可与字面量字符串无缝混用。
3
+ * Sugar 层 way 数组的关键字常量
4
+ * @description Cycle 闭合到 way 起点(底层字符串故意写丑避节点 id 冲突,只通过 DrawWay.Cycle 引用);Hv/Vh 折角算子(裸字面量 `-|`/`|-` 与常量等价);Relative/Accumulate 相对偏移 way item 的 type 鉴别值(Relative=TikZ `(+x,+y)` 不推进 prevEnd,Accumulate=TikZ `(++x,++y)` 累积更新)。用 const + as const 而非 TS enum 避免 reverse-mapping 与字面量不互通
22
5
  */
23
6
  export declare const DrawWay: {
24
- /**
25
- * 闭合 way 到起点,等价于 `<Step kind="cycle" />`(TikZ 同名保留字 / SVG `Z`)。
26
- * 底层字符串值刻意写丑以避开节点 id 冲突;不要硬编码这个字符串。
27
- */
7
+ /** 闭合到起点(TikZ `cycle` / SVG `Z`),底层字符串刻意写丑,不要硬编码 */
28
8
  readonly Cycle: "retikz-keyword_cycle";
29
9
  /** 折角:先水平后垂直(TikZ `-|`) */
30
10
  readonly Hv: "-|";
31
11
  /** 折角:先垂直后水平(TikZ `|-`) */
32
12
  readonly Vh: "|-";
33
- /**
34
- * 相对偏移 way item 的 `type` 字段值——非累积分支,等价 TikZ `(+x, +y)`。
35
- * 解析为 IR `{ rel: position }`,**不**推进 prevEnd;多段链式偏移共享同一锚点。
36
- */
13
+ /** 相对偏移 type:非累积(TikZ `(+x,+y)`),不推进 prevEnd */
37
14
  readonly Relative: "retikz-keyword_relative";
38
- /**
39
- * 相对偏移 way item 的 `type` 字段值——累积分支,等价 TikZ `(++x, ++y)`。
40
- * 解析为 IR `{ relAccumulate: position }`,每段累积更新 prevEnd。
41
- */
15
+ /** 相对偏移 type:累积(TikZ `(++x,++y)`),每段更新 prevEnd */
42
16
  readonly Accumulate: "retikz-keyword_accumulate";
43
17
  };
44
- /**
45
- * way 折角算子的字面量类型。`DrawWay.Hv` / `DrawWay.Vh` 与裸字面量等价。
46
- */
18
+ /** way 折角算子字面量类型 */
47
19
  export type WayVia = typeof DrawWay.Hv | typeof DrawWay.Vh;
48
- /**
49
- * way 闭合关键字的字面量类型,由 `DrawWay.Cycle` 派生。
50
- */
20
+ /** way 闭合关键字字面量类型 */
51
21
  export type WayCycle = typeof DrawWay.Cycle;
52
22
  /**
53
- * 相对偏移 way item(sugar,TS-friendly):以**前一 step 终点**(首项无前段时回退到 [0, 0])
54
- * 为基准的位移。`type: DrawWay.Relative` 不更新 prevEnd(TikZ `(+x, +y)`);
55
- * `type: DrawWay.Accumulate` 累积更新(TikZ `(++x, ++y)`)。
56
- *
57
- * 与 sugar 字符串 `'+dx,dy'` / `'++dx,dy'` 等价,但对象形态在编辑器里能直接补全
58
- * `position` / `type` 字段,TS 也能校验元组与鉴别字段值——更适合 IDE 协作。
59
- *
60
- * parseWay 在 sugar 层就地翻译为 IR `{ rel }` / `{ relAccumulate }`;IR 持久化
61
- * 形态保持纯净,仍是带 `rel` / `relAccumulate` discriminator 的对象。
23
+ * 相对偏移 way item(sugar,TS-friendly),与字符串 `'+dx,dy'`/`'++dx,dy'` 等价
24
+ * @description 以前一 step 终点为基准(首项回退 [0,0]);Relative 不更新 prevEnd,Accumulate 累积更新。对象形态便于 IDE 补全字段;parseWay 在 sugar 层就地翻译为 IR `{relative}`/`{relativeAccumulate}`
62
25
  */
63
- export type WayRelItem = {
26
+ export type WayRelativeItem = {
64
27
  position: [number, number];
65
28
  type: typeof DrawWay.Relative | typeof DrawWay.Accumulate;
66
29
  };
67
- /**
68
- * 二次贝塞尔算子(infix):与折角算子一样坐落两个 target 之间,把
69
- * "上一项 → 下一项"那段改成 curve step。`curve` 字段携带控制点 `[x, y]`。
70
- */
30
+ /** 二次贝塞尔算子(infix):把"上一项→下一项"段改成 curve step,curve 字段携控制点 */
71
31
  export type WayCurveOp = {
72
32
  curve: IRControlPoint;
73
33
  };
74
- /**
75
- * 三次贝塞尔算子(infix):把"上一项 → 下一项"那段改成 cubic step。
76
- * `cubic` 字段携带两个控制点 `[c1, c2]`。
77
- */
34
+ /** 三次贝塞尔算子(infix):cubic step;cubic 字段携两个控制点 */
78
35
  export type WayCubicOp = {
79
36
  cubic: [IRControlPoint, IRControlPoint];
80
37
  };
81
- /**
82
- * 弧形简记算子(infix):把"上一项 → 下一项"那段改成 bend step。
83
- * `bend` 字段是方向 `'left'` / `'right'`;`angle` 可选(缺省 30°)。
84
- */
38
+ /** 弧形简记算子(infix):bend step;bend=方向,angle 可选缺省 30° */
85
39
  export type WayBendOp = {
86
40
  bend: 'left' | 'right';
87
41
  angle?: number;
88
42
  };
89
43
  /**
90
- * 弧段算子(infix):以"上一项"为圆心,按起末角度 + 半径画弧;不消耗下一项
91
- * (形状 step 没有 to 字段)。
92
- *
93
- * 注意与曲线 / 折角 infix 算子不同:way 数组里 `[..., target, { arc: {...} }, ...]`
94
- * 时 arc 算子**只**消耗"前一个 target"作为圆心,**不**与"下一项"合并;
95
- * 后续的 way item 仍按各自规则解析。
44
+ * 弧段算子(infix),以上一项为圆心
45
+ * @description 按起末角度 + 半径画弧;与 curve/fold infix 不同——只消耗前一 target 作圆心,不与下一项合并
96
46
  */
97
47
  export type WayArcOp = {
98
48
  arc: {
@@ -101,80 +51,38 @@ export type WayArcOp = {
101
51
  radius: number;
102
52
  };
103
53
  };
104
- /** 整圆算子(infix):以"上一项"为圆心、给定半径,画整圆。pen 留圆心 */
54
+ /** 整圆算子(infix),以上一项为圆心、给定半径画整圆,pen 留圆心 */
105
55
  export type WayCircleOp = {
106
56
  circle: {
107
57
  radius: number;
108
58
  };
109
59
  };
110
- /** 整椭圆算子(infix):以"上一项"为圆心,给定 x/y 半径,画整椭圆。pen 留圆心 */
60
+ /** 整椭圆算子(infix),以上一项为圆心、给定 x/y 半径画整椭圆,pen 留圆心 */
111
61
  export type WayEllipseOp = {
112
62
  ellipse: {
113
63
  radiusX: number;
114
64
  radiusY: number;
115
65
  };
116
66
  };
117
- /**
118
- * 边标注的 sugar 形态(ADR-0004):
119
- * - 字符串:等价 `{ text: <string> }`,其它字段走默认(midway / above)
120
- * - 对象:与 IR `step.label` 字面一致
121
- */
67
+ /** 边标注 sugar 形态:字符串=`{text:s}`,对象=IR `step.label` 字面一致 */
122
68
  export type WayLabel = IRStepLabel | string;
123
69
  /**
124
- * 边标注 prefix 算子(infix):修饰"下一段"——line / fold / curve / cubic / bend /
125
- * arc / circle / ellipse 都可承载。挂在 way 中两个 way item 之间,下一个产生段的
126
- * way item 把它消耗到自己的 IR step.label 上。
127
- *
128
- * `cycle` 不允许挂 label(schema 已禁),way 中"label op + cycle"的组合会抛错。
129
- *
130
- * 多个 label op 不能直接相邻,way 末尾未消费的 label op 同样抛错——保持"标注总有
131
- * 段可挂"。
70
+ * 边标注 prefix 算子(infix),修饰下一段
71
+ * @description line/fold/curve/cubic/bend/arc/circle/ellipse 都可承载;下一个产生段的 way item 消耗到自己的 step.label 上。cycle 不允许挂 label;连续 label/末尾未消费 label 均抛错
132
72
  */
133
73
  export type WayLabelOp = {
134
74
  label: WayLabel;
135
75
  };
136
76
  /**
137
- * Sugar 层的 way 数组 DSL 元素。
138
- *
139
- * 接受十二种形态:
140
- * - 节点 id 字符串:`'A'` → line(首项时为 move)
141
- * - 笛卡尔坐标:`[x, y]` → line
142
- * - 极坐标:`{ origin?, angle, radius }` → line
143
- * - 相对偏移对象(sugar,TS-friendly):`{ position: [dx, dy], type: DrawWay.Relative | DrawWay.Accumulate }`
144
- * 翻译为 IR `{ rel }` / `{ relAccumulate }`;与裸字符串 `'+dx,dy'` / `'++dx,dy'` 等价
145
- * - 折角算子:`'-|'` / `'|-'`(或 `DrawWay.Hv` / `DrawWay.Vh`)→ 当前项 +
146
- * **下一项**合并成一个折角 step(与 TikZ 的 `(A) -| (B)` infix 写法对齐)
147
- * - 闭合关键字:`DrawWay.Cycle` → cycle(闭合到起点)
148
- * - 二次贝塞尔算子(infix):`{ curve: [cx, cy] }`,与下一项合并为 curve step
149
- * - 三次贝塞尔算子(infix):`{ cubic: [[c1x, c1y], [c2x, c2y]] }`,与下一项合并为 cubic step
150
- * - 弧形简记算子(infix):`{ bend: 'left' | 'right', angle?: number }`,与下一项合并为 bend step
151
- * - 弧段算子(infix):`{ arc: { startAngle, endAngle, radius } }`,以"上一项"为圆心,**不**消耗下一项
152
- * - 整圆算子(infix):`{ circle: { radius } }`,以"上一项"为圆心,**不**消耗下一项
153
- * - 整椭圆算子(infix):`{ ellipse: { radiusX, radiusY } }`,以"上一项"为圆心,**不**消耗下一项
154
- *
155
- * 注意:闭合刻意只走 `DrawWay.Cycle`(底层字符串是 `'retikz-keyword_cycle'`),
156
- * 这样裸字符串 `'cycle'` 仍可作为正常节点 id 使用。相对偏移的 `Relative` /
157
- * `Accumulate` 同理刻意写丑——避免与节点 id / Position 形态撞结构。
77
+ * Sugar way 数组 DSL 元素(十二种形态)
78
+ * @description 节点 id 字符串/笛卡尔/极坐标 → line(首项 move);`{position,type}` 相对偏移对象 → IR relative/relativeAccumulate;`-|`/`|-` 与下一项合并 fold;DrawWay.Cycle → cycle;curve/cubic/bend infix 与下一项合并;arc/circle/ellipse infix 以上一项为圆心不消耗下一项。Cycle/Relative/Accumulate 底层字符串刻意写丑避节点 id 撞结构
158
79
  */
159
- export type WayItem = IRTarget | WayRelItem | WayVia | WayCycle | WayCurveOp | WayCubicOp | WayBendOp | WayArcOp | WayCircleOp | WayEllipseOp | WayLabelOp;
160
- /** way DSL 数组:sugar `<Draw way={...}>` 接受的输入形态 */
80
+ export type WayItem = IRTarget | WayRelativeItem | WayVia | WayCycle | WayCurveOp | WayCubicOp | WayBendOp | WayArcOp | WayCircleOp | WayEllipseOp | WayLabelOp;
81
+ /** way DSL 数组:sugar `<Draw way={...}>` 输入形态 */
161
82
  export type WayDSL = Array<WayItem>;
162
83
  /**
163
- * way 数组翻译为 IRStep 序列。
164
- *
165
- * - 第一个元素始终是 move:取 way[0] 的目标点;若 way[0] 是 cycle / via 算子等
166
- * 非 target 项,则降级到原点 `[0, 0]`(容错)。
167
- * - 后续元素:
168
- * - 普通 target / `WayRelItem` → line
169
- * - `DrawWay.Cycle` → cycle 步
170
- * - `'-|'` / `'|-'` → 与**下一项**合并成 fold 步;操作符在 way 末尾或后
171
- * 接非 target 项时抛错
172
- * - curve / cubic / bend infix 算子 → 与**下一项**合并成对应 step
173
- * - arc / circle / ellipse infix 算子 → 单独成 step(不消耗下一项)
174
- * - `{ label }` infix 算子(ADR-0004)→ 修饰**下一段**——挂在该段的
175
- * `step.label` 上;连续 label / 末尾 label / cycle 上的 label 均抛错
176
- *
177
- * 这是纯函数,住在 core,被各框架 adapter 的 Sugar 组件复用。
84
+ * way 数组 IRStep 序列
85
+ * @description 首元素始终 move(way[0] 是算子时降级到原点 [0,0]);后续元素按各自规则:target/RelItem→line;Cycle→cycle;-|/|- 与下一项合并 fold;curve/cubic/bend 与下一项合并;arc/circle/ellipse 单独成 step;label 算子修饰下一段。连续 label/末尾 label/cycle 上的 label 抛错。纯函数,各框架 adapter Sugar 组件复用
178
86
  */
179
87
  export declare const parseWay: (way: WayDSL) => Array<IRStep>;
180
88
  //# sourceMappingURL=parseWay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MAAM,OAAO,GACf,QAAQ,GACR,eAAe,GACf,MAAM,GACN,QAAQ,GACR,UAAU,GACV,UAAU,GACV,SAAS,GACT,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,UAAU,CAAC;AAEf,+CAA+C;AAC/C,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAqEpC;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,KAAK,CAAC,MAAM,CAmKlD,CAAC"}
@@ -1,51 +1,25 @@
1
1
  import { parseTargetSugar } from "./parseTargetSugar.js";
2
2
  //#region src/parsers/parseWay.ts
3
3
  /**
4
- * Sugar 层 way 数组的"关键字常量"。
5
- *
6
- * - `DrawWay.Cycle`:闭合到 way 起点(way 元素位置)。**底层字符串故意取得很丑**
7
- * (`'retikz-keyword_cycle'`),保证不会与任何合理的节点 id 冲突;用户应当
8
- * 只通过 `DrawWay.Cycle` 引用,不要直接写裸字面量。
9
- * - `DrawWay.Hv`:折角算子,先水平后垂直(裸字面量 `'-|'`)。
10
- * - `DrawWay.Vh`:折角算子,先垂直后水平(裸字面量 `'|-'`)。
11
- * - `DrawWay.Relative` / `DrawWay.Accumulate`:相对偏移 way item 的 `type` 鉴别字段值。
12
- * 配合 `{ position: [dx, dy], type: DrawWay.Relative | DrawWay.Accumulate }` 用——
13
- * `Relative` 等价 TikZ `(+x, +y)`(不更新 prevEnd),`Accumulate` 等价 TikZ `(++x, ++y)`
14
- * (累积更新)。底层字符串同样刻意写丑,保证不撞节点 id;用户只通过常量引用。
15
- *
16
- * 折角值(`-|` / `|-`)含特殊字符,与节点 id 不会冲突,因此**保留字面量与
17
- * 常量两种写法都合法**。way 数组里直接放 `'-|'` 或 `'|-'`(infix 算子)
18
- * 即把"上一项 → 下一项"那一段改成折角。
19
- *
20
- * 这里**故意不用 TS enum**——enum 在数值场景下生成 reverse-mapping 表、
21
- * 在 string 场景下与字面量类型不互通,而 const + `as const` 的字面量联合
22
- * 既可枚举也可与字面量字符串无缝混用。
4
+ * Sugar 层 way 数组的关键字常量
5
+ * @description Cycle 闭合到 way 起点(底层字符串故意写丑避节点 id 冲突,只通过 DrawWay.Cycle 引用);Hv/Vh 折角算子(裸字面量 `-|`/`|-` 与常量等价);Relative/Accumulate 相对偏移 way item 的 type 鉴别值(Relative=TikZ `(+x,+y)` 不推进 prevEnd,Accumulate=TikZ `(++x,++y)` 累积更新)。用 const + as const 而非 TS enum 避免 reverse-mapping 与字面量不互通
23
6
  */
24
7
  var DrawWay = {
25
- /**
26
- * 闭合 way 到起点,等价于 `<Step kind="cycle" />`(TikZ 同名保留字 / SVG `Z`)。
27
- * 底层字符串值刻意写丑以避开节点 id 冲突;不要硬编码这个字符串。
28
- */
8
+ /** 闭合到起点(TikZ `cycle` / SVG `Z`),底层字符串刻意写丑,不要硬编码 */
29
9
  Cycle: "retikz-keyword_cycle",
30
10
  /** 折角:先水平后垂直(TikZ `-|`) */
31
11
  Hv: "-|",
32
12
  /** 折角:先垂直后水平(TikZ `|-`) */
33
13
  Vh: "|-",
34
- /**
35
- * 相对偏移 way item 的 `type` 字段值——非累积分支,等价 TikZ `(+x, +y)`。
36
- * 解析为 IR `{ rel: position }`,**不**推进 prevEnd;多段链式偏移共享同一锚点。
37
- */
14
+ /** 相对偏移 type:非累积(TikZ `(+x,+y)`),不推进 prevEnd */
38
15
  Relative: "retikz-keyword_relative",
39
- /**
40
- * 相对偏移 way item 的 `type` 字段值——累积分支,等价 TikZ `(++x, ++y)`。
41
- * 解析为 IR `{ relAccumulate: position }`,每段累积更新 prevEnd。
42
- */
16
+ /** 相对偏移 type:累积(TikZ `(++x,++y)`),每段更新 prevEnd */
43
17
  Accumulate: "retikz-keyword_accumulate"
44
18
  };
45
19
  var isWayCycle = (item) => item === DrawWay.Cycle;
46
20
  var isWayVia = (item) => item === DrawWay.Hv || item === DrawWay.Vh;
47
21
  var isPlainObject = (item) => typeof item === "object" && item !== null && !Array.isArray(item);
48
- var isWayRelItem = (item) => isPlainObject(item) && "position" in item && "type" in item;
22
+ var isWayRelativeItem = (item) => isPlainObject(item) && "position" in item && "type" in item;
49
23
  var isWayCurveOp = (item) => isPlainObject(item) && "curve" in item;
50
24
  var isWayCubicOp = (item) => isPlainObject(item) && "cubic" in item;
51
25
  var isWayBendOp = (item) => isPlainObject(item) && "bend" in item;
@@ -56,42 +30,26 @@ var isWayEllipseOp = (item) => isPlainObject(item) && "ellipse" in item;
56
30
  var isWayShapeOp = (item) => isWayArcOp(item) || isWayCircleOp(item) || isWayEllipseOp(item);
57
31
  var isWayLabelOp = (item) => isPlainObject(item) && "label" in item;
58
32
  var isWayOperator = (item) => isWayCycle(item) || isWayVia(item) || isWayCurveLike(item) || isWayShapeOp(item) || isWayLabelOp(item);
59
- /** sugar 字符串 / 对象都映射到 IR `step.label`:字符串 = `{ text: s }`,对象原样取 */
33
+ /** sugar 字符串/对象 IR step.label(字符串 = `{text:s}`) */
60
34
  var normalizeLabel = (l) => typeof l === "string" ? { text: l } : { ...l };
61
- /**
62
- * sugar 对象形态 `{ position, type }` 翻译为 IR `{ rel } | { relAccumulate }`;
63
- * 其它形态原样返回。在每个 parseTargetSugar 入口前调用,集中处理。
64
- */
65
- var desugarRelItem = (item) => {
66
- if (!isWayRelItem(item)) return item;
67
- return item.type === DrawWay.Accumulate ? { relAccumulate: item.position } : { rel: item.position };
35
+ /** sugar `{position,type}` → IR `{relative}|{relativeAccumulate}`;其它形态原样返回 */
36
+ var desugarRelativeItem = (item) => {
37
+ if (!isWayRelativeItem(item)) return item;
38
+ return item.type === DrawWay.Accumulate ? { relativeAccumulate: item.position } : { relative: item.position };
68
39
  };
69
- /** WayItem 归约为它的"目标点"——target 直接返回;算子/关键字返回 null */
40
+ /** WayItem 归约为"目标点",算子/关键字返回 null */
70
41
  var targetOf = (item) => {
71
42
  if (isWayOperator(item)) return null;
72
- return desugarRelItem(item);
43
+ return desugarRelativeItem(item);
73
44
  };
74
45
  /**
75
- * way 数组翻译为 IRStep 序列。
76
- *
77
- * - 第一个元素始终是 move:取 way[0] 的目标点;若 way[0] 是 cycle / via 算子等
78
- * 非 target 项,则降级到原点 `[0, 0]`(容错)。
79
- * - 后续元素:
80
- * - 普通 target / `WayRelItem` → line
81
- * - `DrawWay.Cycle` → cycle 步
82
- * - `'-|'` / `'|-'` → 与**下一项**合并成 fold 步;操作符在 way 末尾或后
83
- * 接非 target 项时抛错
84
- * - curve / cubic / bend infix 算子 → 与**下一项**合并成对应 step
85
- * - arc / circle / ellipse infix 算子 → 单独成 step(不消耗下一项)
86
- * - `{ label }` infix 算子(ADR-0004)→ 修饰**下一段**——挂在该段的
87
- * `step.label` 上;连续 label / 末尾 label / cycle 上的 label 均抛错
88
- *
89
- * 这是纯函数,住在 core,被各框架 adapter 的 Sugar 组件复用。
46
+ * way 数组 IRStep 序列
47
+ * @description 首元素始终 move(way[0] 是算子时降级到原点 [0,0]);后续元素按各自规则:target/RelItem→line;Cycle→cycle;-|/|- 与下一项合并 fold;curve/cubic/bend 与下一项合并;arc/circle/ellipse 单独成 step;label 算子修饰下一段。连续 label/末尾 label/cycle 上的 label 抛错。纯函数,各框架 adapter Sugar 组件复用
90
48
  */
91
49
  var parseWay = (way) => {
92
50
  if (way.length < 2) throw new Error("parseWay: way must contain at least 2 items");
93
51
  const out = [];
94
- /** ADR-0004:当前未消费的 label 算子结果——下一个产生段的 way item 消耗它。 */
52
+ /** 当前未消费的 label 算子结果,下一个产生段的 way item 消耗 */
95
53
  let pendingLabel;
96
54
  const consumeLabel = () => {
97
55
  const l = pendingLabel;
@@ -129,7 +87,7 @@ var parseWay = (way) => {
129
87
  type: "step",
130
88
  kind: "step",
131
89
  via: item,
132
- to: parseTargetSugar(desugarRelItem(next))
90
+ to: parseTargetSugar(desugarRelativeItem(next))
133
91
  };
134
92
  const label = consumeLabel();
135
93
  if (label) fold.label = label;
@@ -141,7 +99,7 @@ var parseWay = (way) => {
141
99
  if (i + 1 >= way.length) throw new Error(`parseWay: curve operator at end of way must be followed by a target`);
142
100
  const next = way[i + 1];
143
101
  if (isWayOperator(next)) throw new Error(`parseWay: curve operator must be followed by a target, got operator/keyword`);
144
- const target = parseTargetSugar(desugarRelItem(next));
102
+ const target = parseTargetSugar(desugarRelativeItem(next));
145
103
  const label = consumeLabel();
146
104
  if (isWayCurveOp(item)) {
147
105
  const curve = {
@@ -211,7 +169,7 @@ var parseWay = (way) => {
211
169
  const lineStep = {
212
170
  type: "step",
213
171
  kind: "line",
214
- to: parseTargetSugar(desugarRelItem(item))
172
+ to: parseTargetSugar(desugarRelativeItem(item))
215
173
  };
216
174
  const label = consumeLabel();
217
175
  if (label) lineStep.label = label;
@@ -1,32 +1,22 @@
1
1
  /**
2
- * 椭圆原语:SVG `<ellipse>` 直对应。
3
- * 圆形(半长轴 = 半短轴)用同一个 EllipsePrim 表示,让 renderer 单一 case 处理。
4
- * 旋转走 `rotate` 字段(度数,绕中心);非零时 renderer 用 SVG transform 包裹。
2
+ * 椭圆原语,对应 SVG `<ellipse>`
3
+ * @description 圆形(rx=ry)复用同一 prim case 处理;rotate 度数绕中心,非零时 renderer SVG transform 包裹
5
4
  */
6
5
  export type EllipsePrim = {
7
- /** 类型判别符 */
8
6
  type: 'ellipse';
9
- /** 中心横坐标 */
10
7
  cx: number;
11
- /** 中心纵坐标 */
12
8
  cy: number;
13
- /** 水平半轴 */
14
9
  rx: number;
15
- /** 垂直半轴 */
16
10
  ry: number;
17
- /** 绕中心的旋转角(度数,与 RectPrim 风格一致);省略或 0 不旋转 */
11
+ /** 绕中心旋转度数 */
18
12
  rotate?: number;
19
- /** 填充色 */
20
13
  fill?: string;
21
14
  /** 填充透明度 0~1 */
22
15
  fillOpacity?: number;
23
- /** 描边色 */
24
16
  stroke?: string;
25
- /** 描边透明度 0~1(SVG stroke-opacity) */
17
+ /** 描边透明度 0~1 */
26
18
  strokeOpacity?: number;
27
- /** 描边宽度 */
28
19
  strokeWidth?: number;
29
- /** SVG stroke-dasharray 模式 */
30
20
  strokeDasharray?: string;
31
21
  /** 整体透明度 0~1 */
32
22
  opacity?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/primitive/ellipse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY;IACZ,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,WAAW;IACX,EAAE,EAAE,MAAM,CAAC;IACX,WAAW;IACX,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
1
+ {"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/primitive/ellipse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -1,10 +1,28 @@
1
1
  import { ScenePrimitive } from './scene';
2
- /** 编组:把若干 primitive 用 transform 包起来 */
2
+ /**
3
+ * Group transform:结构化变换
4
+ * @description 按数组顺序应用(与 SVG transform 多操作列表语义一致);角度=度,缩放 y 缺省等比 x,rotate cx/cy 缺省绕原点
5
+ */
6
+ export type Transform = {
7
+ kind: 'translate';
8
+ x: number;
9
+ y: number;
10
+ } | {
11
+ kind: 'rotate';
12
+ degrees: number;
13
+ cx?: number;
14
+ cy?: number;
15
+ } | {
16
+ kind: 'scale';
17
+ x: number;
18
+ y?: number;
19
+ };
20
+ /** 编组:把若干 primitive 用结构化 transforms 包起来 */
3
21
  export type GroupPrim = {
4
22
  /** 类型判别符 */
5
23
  type: 'group';
6
- /** SVG transform 字符串(translate / rotate / scale 等) */
7
- transform?: string;
24
+ /** 结构化变换序列,按数组顺序应用;undefined / 空数组表示无变换 */
25
+ transforms?: Array<Transform>;
8
26
  /** 组内子原语 */
9
27
  children: Array<ScenePrimitive>;
10
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/primitive/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,uCAAuC;AACvC,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY;IACZ,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACjC,CAAC"}
1
+ {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/primitive/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,2CAA2C;AAC3C,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,YAAY;IACZ,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACjC,CAAC"}
@@ -1,10 +1,70 @@
1
1
  import { ArrowShape } from '../ir/path/arrow';
2
- /** 路径原语:SVG path d 字符串;Canvas/PDF renderer 自行解析 */
2
+ /**
3
+ * Path 命令:结构化路径绘制操作
4
+ * @description discriminated union 按 kind 分发;坐标 / 角度均使用 user units(角度=度,0=+x、90=+y/视觉下、CW=正)。各 adapter 自行翻译为原生 API:SVG 拼 `d` 字符串、Canvas 调 ctx.moveTo/lineTo/arc 等
5
+ */
6
+ export type PathCommand = {
7
+ kind: 'move';
8
+ to: [number, number];
9
+ } | {
10
+ kind: 'line';
11
+ to: [number, number];
12
+ } | {
13
+ kind: 'quad';
14
+ control: [number, number];
15
+ to: [number, number];
16
+ } | {
17
+ kind: 'cubic';
18
+ control1: [number, number];
19
+ control2: [number, number];
20
+ to: [number, number];
21
+ } | {
22
+ kind: 'arc';
23
+ center: [number, number];
24
+ radius: number;
25
+ startAngle: number;
26
+ endAngle: number;
27
+ counterClockwise?: boolean;
28
+ } | {
29
+ kind: 'ellipseArc';
30
+ center: [number, number];
31
+ radiusX: number;
32
+ radiusY: number;
33
+ rotation?: number;
34
+ startAngle: number;
35
+ endAngle: number;
36
+ counterClockwise?: boolean;
37
+ } | {
38
+ kind: 'close';
39
+ };
40
+ /**
41
+ * 端点级解析后的箭头视觉规格(Scene primitive 层)
42
+ * @description compile/path.ts 把 IR `arrowDetail` 顶层 + start/end merge 后产出此结构。`shape` 必填、其余视觉字段全 optional:缺省字段交给 renderer 走 context-stroke / 硬编码 fallback,保持向后兼容
43
+ */
44
+ export type ArrowEndSpec = {
45
+ /** 形状名 */
46
+ shape: ArrowShape;
47
+ /** 等比缩放因子(乘到 length/width 上);缺省 1 */
48
+ scale?: number;
49
+ /** 尖长(user units);缺省让 renderer 走默认 6 */
50
+ length?: number;
51
+ /** 尖宽(user units);缺省让 renderer 走默认 6 */
52
+ width?: number;
53
+ /** 描边颜色 override;缺省走 context-stroke(继承 path stroke) */
54
+ color?: string;
55
+ /** 填充色 override(仅实心 shape 生效;空心 shape 已在 compile 阶段被丢) */
56
+ fill?: string;
57
+ /** 箭头不透明度 0..1;缺省继承 path opacity */
58
+ opacity?: number;
59
+ /** 空心 shape 描边粗细(user units);缺省 1.5。实心 shape 忽略 */
60
+ lineWidth?: number;
61
+ };
62
+ /** 路径原语:结构化 commands 数组;adapter 在 render 时翻译为各自原生 API */
3
63
  export type PathPrim = {
4
64
  /** 类型判别符 */
5
65
  type: 'path';
6
- /** SVG path d 字符串 */
7
- d: string;
66
+ /** 结构化路径命令序列,按数组顺序绘制 */
67
+ commands: Array<PathCommand>;
8
68
  /** 填充色;不填表示不填充 */
9
69
  fill?: string;
10
70
  /** 填充透明度 0~1 */
@@ -23,10 +83,10 @@ export type PathPrim = {
23
83
  strokeLinecap?: 'butt' | 'round' | 'square';
24
84
  /** 拐点形状 */
25
85
  strokeLinejoin?: 'miter' | 'round' | 'bevel';
26
- /** 起点箭头形状;undefined = */
27
- arrowStart?: ArrowShape;
28
- /** 终点箭头形状;undefined = */
29
- arrowEnd?: ArrowShape;
86
+ /** 起点箭头视觉规格;undefined = 无箭头 */
87
+ arrowStart?: ArrowEndSpec;
88
+ /** 终点箭头视觉规格;undefined = 无箭头 */
89
+ arrowEnd?: ArrowEndSpec;
30
90
  /** 整体透明度 0~1 */
31
91
  opacity?: number;
32
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/primitive/path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,UAAU;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW;IACX,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,WAAW;IACX,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,2BAA2B;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;C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;IAC/B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -5,10 +5,8 @@ import { RectPrim } from './rect';
5
5
  import { TextPrim } from './text';
6
6
  import { ViewBox } from './view-box';
7
7
  /**
8
- * Scene primitive:渲染目标无关的最大公约子集。
9
- * 所有 adapter(SVG / Canvas / PDF / Skia)都应能消费这些原语。
10
- *
11
- * 不允许出现 SVG-only 或 Canvas-only 特性(filter、marker、imageData 等)。
8
+ * Scene primitive:渲染目标无关的最大公约子集
9
+ * @description 所有 adapter(SVG/Canvas/PDF/Skia)都应能消费;不允许出现 SVG-only 或 Canvas-only 特性(filter/marker/imageData)
12
10
  */
13
11
  export type ScenePrimitive = RectPrim | EllipsePrim | TextPrim | PathPrim | GroupPrim;
14
12
  /** 场景:渲染目标无关的"已布局好的图元集合 + viewBox" */
@@ -1 +1 @@
1
- {"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/primitive/scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtF,sCAAsC;AACtC,MAAM,MAAM,KAAK,GAAG;IAClB,wBAAwB;IACxB,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,gBAAgB;IAChB,OA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