@retikz/core 0.1.0-alpha.5 → 0.1.0-beta.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.
Files changed (231) hide show
  1. package/dist/es/compile/compile.d.ts +20 -3
  2. package/dist/es/compile/compile.d.ts.map +1 -1
  3. package/dist/es/compile/compile.js +44 -19
  4. package/dist/es/compile/index.d.ts +2 -2
  5. package/dist/es/compile/index.d.ts.map +1 -1
  6. package/dist/es/compile/layout.d.ts +5 -0
  7. package/dist/es/compile/layout.d.ts.map +1 -0
  8. package/dist/es/compile/{view-box.js → layout.js} +4 -4
  9. package/dist/es/compile/node.d.ts +4 -4
  10. package/dist/es/compile/node.d.ts.map +1 -1
  11. package/dist/es/compile/node.js +7 -7
  12. package/dist/es/compile/path/anchor.d.ts +19 -0
  13. package/dist/es/compile/path/anchor.d.ts.map +1 -0
  14. package/dist/es/compile/path/anchor.js +54 -0
  15. package/dist/es/compile/path/arrow-geometry.d.ts +22 -0
  16. package/dist/es/compile/path/arrow-geometry.d.ts.map +1 -0
  17. package/dist/es/compile/path/arrow-geometry.js +40 -0
  18. package/dist/es/compile/{path.d.ts → path/index.d.ts} +18 -7
  19. package/dist/es/compile/path/index.d.ts.map +1 -0
  20. package/dist/es/compile/path/index.js +308 -0
  21. package/dist/es/compile/path/label.d.ts +18 -0
  22. package/dist/es/compile/path/label.d.ts.map +1 -0
  23. package/dist/es/compile/path/label.js +102 -0
  24. package/dist/es/compile/path/relative.d.ts +8 -0
  25. package/dist/es/compile/path/relative.d.ts.map +1 -0
  26. package/dist/es/compile/path/relative.js +48 -0
  27. package/dist/es/compile/path/shrink.d.ts +18 -0
  28. package/dist/es/compile/path/shrink.d.ts.map +1 -0
  29. package/dist/es/compile/path/shrink.js +126 -0
  30. package/dist/es/compile/path/split.d.ts +15 -0
  31. package/dist/es/compile/path/split.d.ts.map +1 -0
  32. package/dist/es/compile/path/split.js +46 -0
  33. package/dist/es/compile/text-metrics.d.ts +4 -1
  34. package/dist/es/compile/text-metrics.d.ts.map +1 -1
  35. package/dist/es/compile/text-metrics.js +11 -5
  36. package/dist/es/geometry/_transform.d.ts +21 -0
  37. package/dist/es/geometry/_transform.d.ts.map +1 -0
  38. package/dist/es/geometry/_transform.js +27 -0
  39. package/dist/es/geometry/bend.d.ts +1 -1
  40. package/dist/es/geometry/bend.js +1 -1
  41. package/dist/es/geometry/circle.d.ts +2 -3
  42. package/dist/es/geometry/circle.d.ts.map +1 -1
  43. package/dist/es/geometry/circle.js +1 -16
  44. package/dist/es/geometry/diamond.d.ts +2 -3
  45. package/dist/es/geometry/diamond.d.ts.map +1 -1
  46. package/dist/es/geometry/diamond.js +1 -16
  47. package/dist/es/geometry/ellipse.d.ts +2 -3
  48. package/dist/es/geometry/ellipse.d.ts.map +1 -1
  49. package/dist/es/geometry/ellipse.js +1 -16
  50. package/dist/es/geometry/polar.d.ts +2 -2
  51. package/dist/es/geometry/polar.d.ts.map +1 -1
  52. package/dist/es/geometry/polar.js +2 -6
  53. package/dist/es/geometry/rect.d.ts.map +1 -1
  54. package/dist/es/geometry/rect.js +1 -18
  55. package/dist/es/geometry/segment.d.ts +5 -1
  56. package/dist/es/geometry/segment.d.ts.map +1 -1
  57. package/dist/es/index.d.ts +11 -7
  58. package/dist/es/index.d.ts.map +1 -1
  59. package/dist/es/index.js +5 -2
  60. package/dist/es/ir/coordinate.d.ts +1 -1
  61. package/dist/es/ir/coordinate.js +1 -1
  62. package/dist/es/ir/font.d.ts +21 -0
  63. package/dist/es/ir/font.d.ts.map +1 -0
  64. package/dist/es/ir/font.js +15 -0
  65. package/dist/es/ir/index.d.ts +2 -0
  66. package/dist/es/ir/index.d.ts.map +1 -1
  67. package/dist/es/ir/node.d.ts +32 -143
  68. package/dist/es/ir/node.d.ts.map +1 -1
  69. package/dist/es/ir/node.js +7 -31
  70. package/dist/es/ir/path/arrow.d.ts +14 -14
  71. package/dist/es/ir/path/arrow.d.ts.map +1 -1
  72. package/dist/es/ir/path/arrow.js +5 -5
  73. package/dist/es/ir/path/path.d.ts +19 -19
  74. package/dist/es/ir/path/path.d.ts.map +1 -1
  75. package/dist/es/ir/path/path.js +4 -4
  76. package/dist/es/ir/path/step.d.ts +1 -1
  77. package/dist/es/ir/path/step.d.ts.map +1 -1
  78. package/dist/es/ir/path/step.js +8 -8
  79. package/dist/es/ir/position/at-position.js +1 -1
  80. package/dist/es/ir/position/offset-position.js +1 -1
  81. package/dist/es/ir/position/polar-position.d.ts.map +1 -1
  82. package/dist/es/ir/position/polar-position.js +2 -2
  83. package/dist/es/ir/position/position.d.ts.map +1 -1
  84. package/dist/es/ir/position/position.js +1 -1
  85. package/dist/es/ir/scene.d.ts +128 -128
  86. package/dist/es/ir/text.d.ts +96 -0
  87. package/dist/es/ir/text.d.ts.map +1 -0
  88. package/dist/es/ir/text.js +20 -0
  89. package/dist/es/parsers/parseTargetSugar.d.ts +4 -0
  90. package/dist/es/parsers/parseTargetSugar.d.ts.map +1 -1
  91. package/dist/es/parsers/parseTargetSugar.js +3 -2
  92. package/dist/es/primitive/ellipse.d.ts +3 -3
  93. package/dist/es/primitive/ellipse.d.ts.map +1 -1
  94. package/dist/es/primitive/group.d.ts +23 -7
  95. package/dist/es/primitive/group.d.ts.map +1 -1
  96. package/dist/es/primitive/index.d.ts +1 -1
  97. package/dist/es/primitive/index.d.ts.map +1 -1
  98. package/dist/es/primitive/layout.d.ts +12 -0
  99. package/dist/es/primitive/layout.d.ts.map +1 -0
  100. package/dist/es/primitive/path.d.ts +55 -15
  101. package/dist/es/primitive/path.d.ts.map +1 -1
  102. package/dist/es/primitive/rect.d.ts +3 -3
  103. package/dist/es/primitive/rect.d.ts.map +1 -1
  104. package/dist/es/primitive/scene.d.ts +4 -4
  105. package/dist/es/primitive/scene.d.ts.map +1 -1
  106. package/dist/es/primitive/text.d.ts +10 -3
  107. package/dist/es/primitive/text.d.ts.map +1 -1
  108. package/dist/es/types.d.ts +8 -0
  109. package/dist/es/types.d.ts.map +1 -1
  110. package/dist/lib/compile/compile.cjs +44 -19
  111. package/dist/lib/compile/compile.d.ts +20 -3
  112. package/dist/lib/compile/compile.d.ts.map +1 -1
  113. package/dist/lib/compile/index.d.ts +2 -2
  114. package/dist/lib/compile/index.d.ts.map +1 -1
  115. package/dist/lib/compile/{view-box.cjs → layout.cjs} +4 -4
  116. package/dist/lib/compile/layout.d.ts +5 -0
  117. package/dist/lib/compile/layout.d.ts.map +1 -0
  118. package/dist/lib/compile/node.cjs +7 -7
  119. package/dist/lib/compile/node.d.ts +4 -4
  120. package/dist/lib/compile/node.d.ts.map +1 -1
  121. package/dist/lib/compile/path/anchor.cjs +58 -0
  122. package/dist/lib/compile/path/anchor.d.ts +19 -0
  123. package/dist/lib/compile/path/anchor.d.ts.map +1 -0
  124. package/dist/lib/compile/path/arrow-geometry.cjs +41 -0
  125. package/dist/lib/compile/path/arrow-geometry.d.ts +22 -0
  126. package/dist/lib/compile/path/arrow-geometry.d.ts.map +1 -0
  127. package/dist/lib/compile/path/index.cjs +308 -0
  128. package/dist/lib/compile/{path.d.ts → path/index.d.ts} +18 -7
  129. package/dist/lib/compile/path/index.d.ts.map +1 -0
  130. package/dist/lib/compile/path/label.cjs +103 -0
  131. package/dist/lib/compile/path/label.d.ts +18 -0
  132. package/dist/lib/compile/path/label.d.ts.map +1 -0
  133. package/dist/lib/compile/path/relative.cjs +48 -0
  134. package/dist/lib/compile/path/relative.d.ts +8 -0
  135. package/dist/lib/compile/path/relative.d.ts.map +1 -0
  136. package/dist/lib/compile/path/shrink.cjs +128 -0
  137. package/dist/lib/compile/path/shrink.d.ts +18 -0
  138. package/dist/lib/compile/path/shrink.d.ts.map +1 -0
  139. package/dist/lib/compile/path/split.cjs +46 -0
  140. package/dist/lib/compile/path/split.d.ts +15 -0
  141. package/dist/lib/compile/path/split.d.ts.map +1 -0
  142. package/dist/lib/compile/text-metrics.cjs +11 -5
  143. package/dist/lib/compile/text-metrics.d.ts +4 -1
  144. package/dist/lib/compile/text-metrics.d.ts.map +1 -1
  145. package/dist/lib/geometry/_transform.cjs +28 -0
  146. package/dist/lib/geometry/_transform.d.ts +21 -0
  147. package/dist/lib/geometry/_transform.d.ts.map +1 -0
  148. package/dist/lib/geometry/bend.cjs +1 -1
  149. package/dist/lib/geometry/bend.d.ts +1 -1
  150. package/dist/lib/geometry/circle.cjs +5 -20
  151. package/dist/lib/geometry/circle.d.ts +2 -3
  152. package/dist/lib/geometry/circle.d.ts.map +1 -1
  153. package/dist/lib/geometry/diamond.cjs +5 -20
  154. package/dist/lib/geometry/diamond.d.ts +2 -3
  155. package/dist/lib/geometry/diamond.d.ts.map +1 -1
  156. package/dist/lib/geometry/ellipse.cjs +5 -20
  157. package/dist/lib/geometry/ellipse.d.ts +2 -3
  158. package/dist/lib/geometry/ellipse.d.ts.map +1 -1
  159. package/dist/lib/geometry/polar.cjs +2 -6
  160. package/dist/lib/geometry/polar.d.ts +2 -2
  161. package/dist/lib/geometry/polar.d.ts.map +1 -1
  162. package/dist/lib/geometry/rect.cjs +5 -22
  163. package/dist/lib/geometry/rect.d.ts.map +1 -1
  164. package/dist/lib/geometry/segment.d.ts +5 -1
  165. package/dist/lib/geometry/segment.d.ts.map +1 -1
  166. package/dist/lib/index.cjs +7 -3
  167. package/dist/lib/index.d.ts +11 -7
  168. package/dist/lib/index.d.ts.map +1 -1
  169. package/dist/lib/ir/coordinate.cjs +1 -1
  170. package/dist/lib/ir/coordinate.d.ts +1 -1
  171. package/dist/lib/ir/font.cjs +15 -0
  172. package/dist/lib/ir/font.d.ts +21 -0
  173. package/dist/lib/ir/font.d.ts.map +1 -0
  174. package/dist/lib/ir/index.d.ts +2 -0
  175. package/dist/lib/ir/index.d.ts.map +1 -1
  176. package/dist/lib/ir/node.cjs +8 -35
  177. package/dist/lib/ir/node.d.ts +32 -143
  178. package/dist/lib/ir/node.d.ts.map +1 -1
  179. package/dist/lib/ir/path/arrow.cjs +5 -5
  180. package/dist/lib/ir/path/arrow.d.ts +14 -14
  181. package/dist/lib/ir/path/arrow.d.ts.map +1 -1
  182. package/dist/lib/ir/path/path.cjs +4 -4
  183. package/dist/lib/ir/path/path.d.ts +19 -19
  184. package/dist/lib/ir/path/path.d.ts.map +1 -1
  185. package/dist/lib/ir/path/step.cjs +8 -8
  186. package/dist/lib/ir/path/step.d.ts +1 -1
  187. package/dist/lib/ir/path/step.d.ts.map +1 -1
  188. package/dist/lib/ir/position/at-position.cjs +1 -1
  189. package/dist/lib/ir/position/offset-position.cjs +1 -1
  190. package/dist/lib/ir/position/polar-position.cjs +2 -2
  191. package/dist/lib/ir/position/polar-position.d.ts.map +1 -1
  192. package/dist/lib/ir/position/position.cjs +1 -1
  193. package/dist/lib/ir/position/position.d.ts.map +1 -1
  194. package/dist/lib/ir/scene.d.ts +128 -128
  195. package/dist/lib/ir/text.cjs +21 -0
  196. package/dist/lib/ir/text.d.ts +96 -0
  197. package/dist/lib/ir/text.d.ts.map +1 -0
  198. package/dist/lib/parsers/parseTargetSugar.cjs +3 -2
  199. package/dist/lib/parsers/parseTargetSugar.d.ts +4 -0
  200. package/dist/lib/parsers/parseTargetSugar.d.ts.map +1 -1
  201. package/dist/lib/primitive/ellipse.d.ts +3 -3
  202. package/dist/lib/primitive/ellipse.d.ts.map +1 -1
  203. package/dist/lib/primitive/group.d.ts +23 -7
  204. package/dist/lib/primitive/group.d.ts.map +1 -1
  205. package/dist/lib/primitive/index.d.ts +1 -1
  206. package/dist/lib/primitive/index.d.ts.map +1 -1
  207. package/dist/lib/primitive/layout.d.ts +12 -0
  208. package/dist/lib/primitive/layout.d.ts.map +1 -0
  209. package/dist/lib/primitive/path.d.ts +55 -15
  210. package/dist/lib/primitive/path.d.ts.map +1 -1
  211. package/dist/lib/primitive/rect.d.ts +3 -3
  212. package/dist/lib/primitive/rect.d.ts.map +1 -1
  213. package/dist/lib/primitive/scene.d.ts +4 -4
  214. package/dist/lib/primitive/scene.d.ts.map +1 -1
  215. package/dist/lib/primitive/text.d.ts +10 -3
  216. package/dist/lib/primitive/text.d.ts.map +1 -1
  217. package/dist/lib/types.d.ts +8 -0
  218. package/dist/lib/types.d.ts.map +1 -1
  219. package/package.json +12 -4
  220. package/dist/es/compile/path.d.ts.map +0 -1
  221. package/dist/es/compile/path.js +0 -636
  222. package/dist/es/compile/view-box.d.ts +0 -5
  223. package/dist/es/compile/view-box.d.ts.map +0 -1
  224. package/dist/es/primitive/view-box.d.ts +0 -12
  225. package/dist/es/primitive/view-box.d.ts.map +0 -1
  226. package/dist/lib/compile/path.cjs +0 -636
  227. package/dist/lib/compile/path.d.ts.map +0 -1
  228. package/dist/lib/compile/view-box.d.ts +0 -5
  229. package/dist/lib/compile/view-box.d.ts.map +0 -1
  230. package/dist/lib/primitive/view-box.d.ts +0 -12
  231. package/dist/lib/primitive/view-box.d.ts.map +0 -1
@@ -1,27 +1,12 @@
1
+ const require__transform = require("./_transform.cjs");
1
2
  //#region src/geometry/diamond.ts
2
- var localToWorld = (d, local) => {
3
- const angle = d.rotate ?? 0;
4
- if (angle === 0) return [d.x + local[0], d.y + local[1]];
5
- const cos = Math.cos(angle);
6
- const sin = Math.sin(angle);
7
- return [d.x + local[0] * cos - local[1] * sin, d.y + local[0] * sin + local[1] * cos];
8
- };
9
- var worldToLocal = (d, world) => {
10
- const tx = world[0] - d.x;
11
- const ty = world[1] - d.y;
12
- const angle = d.rotate ?? 0;
13
- if (angle === 0) return [tx, ty];
14
- const cos = Math.cos(angle);
15
- const sin = Math.sin(angle);
16
- return [tx * cos + ty * sin, -tx * sin + ty * cos];
17
- };
18
3
  /** 菱形相关基础工具 */
19
4
  var diamond = {
20
5
  /** 中心 */
21
6
  center: (d) => [d.x, d.y],
22
7
  /** 点是否在菱形内(含边界,含旋转);方程 |x|/halfA + |y|/halfB ≤ 1 */
23
8
  contains: (d, p) => {
24
- const [lx, ly] = worldToLocal(d, p);
9
+ const [lx, ly] = require__transform.worldToLocal(d, p);
25
10
  return Math.abs(lx) / d.halfA + Math.abs(ly) / d.halfB <= 1.000000001;
26
11
  },
27
12
  /** 9 个 anchor:N/S/E/W=顶点,NE/NW/SE/SW=边中点,center=中心 */
@@ -59,18 +44,18 @@ var diamond = {
59
44
  ly = d.halfB / 2;
60
45
  break;
61
46
  }
62
- return localToWorld(d, [lx, ly]);
47
+ return require__transform.localToWorld(d, [lx, ly]);
63
48
  },
64
49
  /**
65
50
  * 从中心向 toward 方向射线与菱形 4 边的交点
66
51
  * @description 菱形方程 |x|/halfA + |y|/halfB = 1;沿方向 (lx,ly) 缩放 t 倍命中:t = 1 / (|lx|/halfA + |ly|/halfB)
67
52
  */
68
53
  boundaryPoint: (d, toward) => {
69
- const [lx, ly] = worldToLocal(d, toward);
54
+ const [lx, ly] = require__transform.worldToLocal(d, toward);
70
55
  const denom = Math.abs(lx) / d.halfA + Math.abs(ly) / d.halfB;
71
56
  if (denom === 0) return [d.x, d.y];
72
57
  const t = 1 / denom;
73
- return localToWorld(d, [lx * t, ly * t]);
58
+ return require__transform.localToWorld(d, [lx * t, ly * t]);
74
59
  }
75
60
  };
76
61
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { Position } from './point';
2
+ import { RectAnchor } from './rect';
2
3
  /** 菱形:中心 + halfA/halfB 半轴长 + 可选旋转;顶点在 (±halfA,0) 与 (0,±halfB) */
3
4
  export type Diamond = {
4
5
  x: number;
@@ -10,8 +11,6 @@ export type Diamond = {
10
11
  /** 绕中心旋转弧度 */
11
12
  rotate?: number;
12
13
  };
13
- /** 菱形 9 个标准 anchor(4 顶点 + 4 边中点 + 中心) */
14
- export type DiamondAnchor = 'center' | 'north' | 'south' | 'east' | 'west' | 'north-east' | 'north-west' | 'south-east' | 'south-west';
15
14
  /** 菱形相关基础工具 */
16
15
  export declare const diamond: {
17
16
  /** 中心 */
@@ -19,7 +18,7 @@ export declare const diamond: {
19
18
  /** 点是否在菱形内(含边界,含旋转);方程 |x|/halfA + |y|/halfB ≤ 1 */
20
19
  contains: (d: Diamond, p: Position) => boolean;
21
20
  /** 9 个 anchor:N/S/E/W=顶点,NE/NW/SE/SW=边中点,center=中心 */
22
- anchor: (d: Diamond, name: DiamondAnchor) => Position;
21
+ anchor: (d: Diamond, name: RectAnchor) => Position;
23
22
  /**
24
23
  * 从中心向 toward 方向射线与菱形 4 边的交点
25
24
  * @description 菱形方程 |x|/halfA + |y|/halfB = 1;沿方向 (lx,ly) 缩放 t 倍命中:t = 1 / (|lx|/halfA + |ly|/halfB)
@@ -1 +1 @@
1
- {"version":3,"file":"diamond.d.ts","sourceRoot":"","sources":["../../../src/geometry/diamond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,iEAAiE;AACjE,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,CAAC;AAoBjB,eAAe;AACf,eAAO,MAAM,OAAO;IAClB,SAAS;gBACG,OAAO,KAAG,QAAQ;IAC9B,oDAAoD;kBACtC,OAAO,KAAK,QAAQ,KAAG,OAAO;IAI5C,sDAAsD;gBAC1C,OAAO,QAAQ,aAAa,KAAG,QAAQ;IAqCrD;;;OAGG;uBACkB,OAAO,UAAU,QAAQ,KAAG,QAAQ;CAOxD,CAAC"}
1
+ {"version":3,"file":"diamond.d.ts","sourceRoot":"","sources":["../../../src/geometry/diamond.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,iEAAiE;AACjE,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAe;AACf,eAAO,MAAM,OAAO;IAClB,SAAS;gBACG,OAAO,KAAG,QAAQ;IAC9B,oDAAoD;kBACtC,OAAO,KAAK,QAAQ,KAAG,OAAO;IAI5C,sDAAsD;gBAC1C,OAAO,QAAQ,UAAU,KAAG,QAAQ;IAqClD;;;OAGG;uBACkB,OAAO,UAAU,QAAQ,KAAG,QAAQ;CAOxD,CAAC"}
@@ -1,28 +1,13 @@
1
+ const require__transform = require("./_transform.cjs");
1
2
  //#region src/geometry/ellipse.ts
2
3
  var SQRT_HALF = Math.SQRT1_2;
3
- var localToWorld = (e, local) => {
4
- const angle = e.rotate ?? 0;
5
- if (angle === 0) return [e.x + local[0], e.y + local[1]];
6
- const cos = Math.cos(angle);
7
- const sin = Math.sin(angle);
8
- return [e.x + local[0] * cos - local[1] * sin, e.y + local[0] * sin + local[1] * cos];
9
- };
10
- var worldToLocal = (e, world) => {
11
- const tx = world[0] - e.x;
12
- const ty = world[1] - e.y;
13
- const angle = e.rotate ?? 0;
14
- if (angle === 0) return [tx, ty];
15
- const cos = Math.cos(angle);
16
- const sin = Math.sin(angle);
17
- return [tx * cos + ty * sin, -tx * sin + ty * cos];
18
- };
19
4
  /** 椭圆相关基础工具 */
20
5
  var ellipse = {
21
6
  /** 中心 */
22
7
  center: (e) => [e.x, e.y],
23
8
  /** 判断点是否在椭圆内(含边界,考虑旋转) */
24
9
  contains: (e, p) => {
25
- const [lx, ly] = worldToLocal(e, p);
10
+ const [lx, ly] = require__transform.worldToLocal(e, p);
26
11
  return lx * lx / (e.rx * e.rx) + ly * ly / (e.ry * e.ry) <= 1;
27
12
  },
28
13
  /**
@@ -63,19 +48,19 @@ var ellipse = {
63
48
  ly = e.ry * SQRT_HALF;
64
49
  break;
65
50
  }
66
- return localToWorld(e, [lx, ly]);
51
+ return require__transform.localToWorld(e, [lx, ly]);
67
52
  },
68
53
  /**
69
54
  * 从中心向 toward 方向射线与椭圆交点
70
55
  * @description 椭圆方程 (x/rx)² + (y/ry)² = 1;沿 (lx,ly) 缩放 t 倍命中 t = 1 / √((lx/rx)² + (ly/ry)²)
71
56
  */
72
57
  boundaryPoint: (e, toward) => {
73
- const [lx, ly] = worldToLocal(e, toward);
58
+ const [lx, ly] = require__transform.worldToLocal(e, toward);
74
59
  if (lx === 0 && ly === 0) return [e.x, e.y];
75
60
  const a = lx / e.rx;
76
61
  const b = ly / e.ry;
77
62
  const t = 1 / Math.sqrt(a * a + b * b);
78
- return localToWorld(e, [lx * t, ly * t]);
63
+ return require__transform.localToWorld(e, [lx * t, ly * t]);
79
64
  }
80
65
  };
81
66
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { Position } from './point';
2
+ import { RectAnchor } from './rect';
2
3
  /** 椭圆:中心 + 半长轴 rx / 半短轴 ry + 可选旋转 */
3
4
  export type Ellipse = {
4
5
  x: number;
@@ -10,8 +11,6 @@ export type Ellipse = {
10
11
  /** 绕中心旋转弧度 */
11
12
  rotate?: number;
12
13
  };
13
- /** 椭圆 9 个标准 anchor(与 RECT_ANCHORS 同名同义) */
14
- export type EllipseAnchor = 'center' | 'north' | 'south' | 'east' | 'west' | 'north-east' | 'north-west' | 'south-east' | 'south-west';
15
14
  /** 椭圆相关基础工具 */
16
15
  export declare const ellipse: {
17
16
  /** 中心 */
@@ -22,7 +21,7 @@ export declare const ellipse: {
22
21
  * 9 个 anchor 的世界坐标
23
22
  * @description 对角(NE/NW/SE/SW)取参数曲线 t=π/4 处 (rx/√2, ry/√2),与 TikZ 椭圆 anchor 参数等分约定一致
24
23
  */
25
- anchor: (e: Ellipse, name: EllipseAnchor) => Position;
24
+ anchor: (e: Ellipse, name: RectAnchor) => Position;
26
25
  /**
27
26
  * 从中心向 toward 方向射线与椭圆交点
28
27
  * @description 椭圆方程 (x/rx)² + (y/ry)² = 1;沿 (lx,ly) 缩放 t 倍命中 t = 1 / √((lx/rx)² + (ly/ry)²)
@@ -1 +1 @@
1
- {"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/geometry/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,qCAAqC;AACrC,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,aAAa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,aAAa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,CAAC;AAoBjB,eAAe;AACf,eAAO,MAAM,OAAO;IAClB,SAAS;gBACG,OAAO,KAAG,QAAQ;IAC9B,0BAA0B;kBACZ,OAAO,KAAK,QAAQ,KAAG,OAAO;IAI9C;;;OAGG;gBACW,OAAO,QAAQ,aAAa,KAAG,QAAQ;IAqCrD;;;OAGG;uBACkB,OAAO,UAAU,QAAQ,KAAG,QAAQ;CAQxD,CAAC"}
1
+ {"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/geometry/ellipse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,qCAAqC;AACrC,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,aAAa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,aAAa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,eAAe;AACf,eAAO,MAAM,OAAO;IAClB,SAAS;gBACG,OAAO,KAAG,QAAQ;IAC9B,0BAA0B;kBACZ,OAAO,KAAK,QAAQ,KAAG,OAAO;IAI9C;;;OAGG;gBACW,OAAO,QAAQ,UAAU,KAAG,QAAQ;IAqClD;;;OAGG;uBACkB,OAAO,UAAU,QAAQ,KAAG,QAAQ;CAQxD,CAAC"}
@@ -1,7 +1,6 @@
1
1
  const require_point = require("./point.cjs");
2
2
  //#region src/geometry/polar.ts
3
3
  var DEG_TO_RAD = Math.PI / 180;
4
- var RAD_TO_DEG = 180 / Math.PI;
5
4
  /** 极坐标 ↔ 笛卡尔转换工具集(polar 不参与几何计算,参与时先 toPosition) */
6
5
  var polar = {
7
6
  /**
@@ -17,11 +16,8 @@ var polar = {
17
16
  const rad = p.angle * DEG_TO_RAD;
18
17
  return [origin[0] + Math.cos(rad) * p.radius, origin[1] + Math.sin(rad) * p.radius];
19
18
  },
20
- /** 笛卡尔 → 极坐标(angle ∈ (-180,180],origin 默认 [0,0]) */
21
- fromPosition: (p) => ({
22
- angle: Math.atan2(p[1], p[0]) * RAD_TO_DEG,
23
- radius: Math.hypot(p[0], p[1])
24
- }),
19
+ /** 笛卡尔 → 极坐标(point.toPolar 别名,angle ∈ (-180,180],origin 默认 [0,0]) */
20
+ fromPosition: (p) => require_point.point.toPolar(p),
25
21
  /** 在原点附近按极坐标偏移,返回结果点的世界笛卡尔坐标 */
26
22
  offsetFrom: (origin, offset) => {
27
23
  const rad = offset.angle * DEG_TO_RAD;
@@ -6,7 +6,7 @@ import { Position } from './point';
6
6
  export type PolarPosition = {
7
7
  /** 极坐标原点:节点 id / 笛卡尔 / 嵌套极坐标;省略表示 [0,0] */
8
8
  origin?: string | Position | PolarPosition;
9
- /** 角度(度数,逆时针为正) */
9
+ /** 角度(度数):从 +x 轴量起,90° 朝 +y(屏幕下方),与 ArcStep / Node label 角度约定一致 */
10
10
  angle: number;
11
11
  /** 半径(非负) */
12
12
  radius: number;
@@ -18,7 +18,7 @@ export declare const polar: {
18
18
  * @description origin 为字符串(节点 id)时抛错——字符串解析依赖 Scene 编译器 nodeIndex
19
19
  */
20
20
  toPosition: (p: PolarPosition) => Position;
21
- /** 笛卡尔 → 极坐标(angle ∈ (-180,180],origin 默认 [0,0]) */
21
+ /** 笛卡尔 → 极坐标(point.toPolar 别名,angle ∈ (-180,180],origin 默认 [0,0]) */
22
22
  fromPosition: (p: Position) => PolarPosition;
23
23
  /** 在原点附近按极坐标偏移,返回结果点的世界笛卡尔坐标 */
24
24
  offsetFrom: (origin: Position, offset: {
@@ -1 +1 @@
1
- {"version":3,"file":"polar.d.ts","sourceRoot":"","sources":["../../../src/geometry/polar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,SAAS,CAAC;AAS/C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC3C,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF,oDAAoD;AACpD,eAAO,MAAM,KAAK;IAChB;;;OAGG;oBACa,aAAa,KAAG,QAAQ;IAmBxC,oDAAoD;sBAClC,QAAQ,KAAG,aAAa;IAI1C,gCAAgC;yBAEtB,QAAQ,UACR;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KACxC,QAAQ;IAOb;;;;OAIG;eAEI,QAAQ,GAAG,aAAa,KACxB,QAAQ,GAAG,aAAa,yBAE1B,OAAO;CACX,CAAC"}
1
+ {"version":3,"file":"polar.d.ts","sourceRoot":"","sources":["../../../src/geometry/polar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,SAAS,CAAC;AAS/C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC3C,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,aAAa;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAIF,oDAAoD;AACpD,eAAO,MAAM,KAAK;IAChB;;;OAGG;oBACa,aAAa,KAAG,QAAQ;IAmBxC,qEAAqE;sBACnD,QAAQ,KAAG,aAAa;IAC1C,gCAAgC;yBAEtB,QAAQ,UACR;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KACxC,QAAQ;IAOb;;;;OAIG;eAEI,QAAQ,GAAG,aAAa,KACxB,QAAQ,GAAG,aAAa,yBAE1B,OAAO;CACX,CAAC"}
@@ -1,3 +1,4 @@
1
+ const require__transform = require("./_transform.cjs");
1
2
  //#region src/geometry/rect.ts
2
3
  /** 矩形 9 个标准 anchor 名常量(与 RectAnchor 配对,用 RECT_ANCHORS.NORTH 避免拼错) */
3
4
  var RECT_ANCHORS = {
@@ -11,30 +12,12 @@ var RECT_ANCHORS = {
11
12
  SOUTH_EAST: "south-east",
12
13
  SOUTH_WEST: "south-west"
13
14
  };
14
- /** 本地坐标(以中心为原点)→ 世界坐标,考虑 rect.rotate */
15
- var localToWorld = (r, local) => {
16
- const angle = r.rotate ?? 0;
17
- if (angle === 0) return [r.x + local[0], r.y + local[1]];
18
- const cos = Math.cos(angle);
19
- const sin = Math.sin(angle);
20
- return [r.x + local[0] * cos - local[1] * sin, r.y + local[0] * sin + local[1] * cos];
21
- };
22
- /** 世界坐标 → 本地坐标(localToWorld 逆变换) */
23
- var worldToLocal = (r, world) => {
24
- const tx = world[0] - r.x;
25
- const ty = world[1] - r.y;
26
- const angle = r.rotate ?? 0;
27
- if (angle === 0) return [tx, ty];
28
- const cos = Math.cos(angle);
29
- const sin = Math.sin(angle);
30
- return [tx * cos + ty * sin, -tx * sin + ty * cos];
31
- };
32
15
  var rect = {
33
16
  /** 几何中心 */
34
17
  center: (r) => [r.x, r.y],
35
18
  /** 点是否在矩形内(含边界,含旋转) */
36
19
  contains: (r, p) => {
37
- const [lx, ly] = worldToLocal(r, p);
20
+ const [lx, ly] = require__transform.worldToLocal(r, p);
38
21
  const halfW = r.width / 2;
39
22
  const halfH = r.height / 2;
40
23
  return lx >= -halfW && lx <= halfW && ly >= -halfH && ly <= halfH;
@@ -76,18 +59,18 @@ var rect = {
76
59
  ly = halfH;
77
60
  break;
78
61
  }
79
- return localToWorld(r, [lx, ly]);
62
+ return require__transform.localToWorld(r, [lx, ly]);
80
63
  },
81
64
  /** 从中心向 toward 方向射线与矩形边界交点(含旋转),Path 端点贴 Node 边界用 */
82
65
  boundaryPoint: (r, toward) => {
83
- const [localX, localY] = worldToLocal(r, toward);
66
+ const [localX, localY] = require__transform.worldToLocal(r, toward);
84
67
  if (localX === 0 && localY === 0) return [r.x, r.y];
85
68
  const halfW = r.width / 2;
86
69
  const halfH = r.height / 2;
87
70
  const tx = localX === 0 ? Infinity : halfW / Math.abs(localX);
88
71
  const ty = localY === 0 ? Infinity : halfH / Math.abs(localY);
89
72
  const t = Math.min(tx, ty);
90
- return localToWorld(r, [localX * t, localY * t]);
73
+ return require__transform.localToWorld(r, [localX * t, localY * t]);
91
74
  }
92
75
  };
93
76
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/geometry/rect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,gCAAgC;AAChC,MAAM,MAAM,IA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sCAAsC;gBAC1B,IAAI,QAAQ,UAAU,KAAG,QAAQ;IAuC7C,qDAAqD;uBAClC,IAAI,UAAU,QAAQ,KAAG,QAAQ;CAUrD,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import { Position } from './point';
2
+ /**
3
+ * 段几何采样结果:t 处坐标点 + 归一化切线向量
4
+ * @description 各 `*SegmentSample` 函数(line / quad / cubic / fold / arc / circle / ellipse)的统一返回形态;供 step.label emit 算位置 / 切线 / sloped 旋转角
5
+ */
2
6
  export type SegmentSample = {
3
- /** t 处的点 */
7
+ /** t 处的点(user units) */
4
8
  point: Position;
5
9
  /** t 处的切线(单位向量;零向量时回退 [1, 0]) */
6
10
  tangent: Position;
@@ -1 +1 @@
1
- {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiBxC,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY;IACZ,KAAK,EAAE,QAAQ,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;AAQF,oBAAoB;AACpB,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aAGD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,SAAS,QAAQ,EACjB,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aASF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,IAAI,QAAQ,EACZ,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aAqBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,QAAQ,QAAQ,EAChB,IAAI,QAAQ,EACZ,GAAG,MAAM,KAC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4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,aAAa,MAAM,EACnB,GAAG,MAAM,KACR,aAUF,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,GAAG,MAAM,KACR,aASF,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,QAAQ,EAChB,IAAI,MAAM,EACV,IAAI,MAAM,EACV,GAAG,MAAM,KACR,aASF,CAAC"}
@@ -3,6 +3,8 @@ const require_position = require("./ir/position/position.cjs");
3
3
  const require_polar_position = require("./ir/position/polar-position.cjs");
4
4
  const require_at_position = require("./ir/position/at-position.cjs");
5
5
  const require_offset_position = require("./ir/position/offset-position.cjs");
6
+ const require_font = require("./ir/font.cjs");
7
+ const require_text = require("./ir/text.cjs");
6
8
  const require_arrow = require("./ir/path/arrow.cjs");
7
9
  const require_target = require("./ir/path/target.cjs");
8
10
  const require_step = require("./ir/path/step.cjs");
@@ -15,6 +17,7 @@ const require_circle = require("./geometry/circle.cjs");
15
17
  const require_diamond = require("./geometry/diamond.cjs");
16
18
  const require_ellipse = require("./geometry/ellipse.cjs");
17
19
  const require_text_metrics = require("./compile/text-metrics.cjs");
20
+ const require_layout = require("./compile/layout.cjs");
18
21
  const require_compile = require("./compile/compile.cjs");
19
22
  const require_parseTargetSugar = require("./parsers/parseTargetSugar.cjs");
20
23
  const require_parseWay = require("./parsers/parseWay.cjs");
@@ -40,16 +43,15 @@ exports.CycleStepSchema = require_step.CycleStepSchema;
40
43
  exports.DrawWay = require_parseWay.DrawWay;
41
44
  exports.EllipsePathStepSchema = require_step.EllipsePathStepSchema;
42
45
  exports.FoldStepSchema = require_step.FoldStepSchema;
43
- exports.FontSchema = require_node.FontSchema;
46
+ exports.FontSchema = require_font.FontSchema;
44
47
  exports.HOLLOW_ARROW_SHAPES = require_arrow.HOLLOW_ARROW_SHAPES;
45
- exports.LineSpecSchema = require_node.LineSpecSchema;
48
+ exports.LineSpecSchema = require_text.LineSpecSchema;
46
49
  exports.LineStepSchema = require_step.LineStepSchema;
47
50
  exports.MoveStepSchema = require_step.MoveStepSchema;
48
51
  exports.NODE_SHAPES = require_node.NODE_SHAPES;
49
52
  exports.NODE_TEXT_ALIGNS = require_node.NODE_TEXT_ALIGNS;
50
53
  exports.NodeLabelSchema = require_node.NodeLabelSchema;
51
54
  exports.NodeSchema = require_node.NodeSchema;
52
- exports.NodeTextSchema = require_node.NodeTextSchema;
53
55
  exports.OffsetPositionSchema = require_offset_position.OffsetPositionSchema;
54
56
  exports.PathSchema = require_path.PathSchema;
55
57
  exports.PolarPositionSchema = require_polar_position.PolarPositionSchema;
@@ -61,8 +63,10 @@ exports.SceneSchema = require_scene.SceneSchema;
61
63
  exports.StepLabelSchema = require_step.StepLabelSchema;
62
64
  exports.StepSchema = require_step.StepSchema;
63
65
  exports.TargetSchema = require_target.TargetSchema;
66
+ exports.TextBlockSchema = require_text.TextBlockSchema;
64
67
  exports.circle = require_circle.circle;
65
68
  exports.compileToScene = require_compile.compileToScene;
69
+ exports.computeLayout = require_layout.computeLayout;
66
70
  exports.diamond = require_diamond.diamond;
67
71
  exports.ellipse = require_ellipse.ellipse;
68
72
  exports.fallbackMeasurer = require_text_metrics.fallbackMeasurer;
@@ -2,15 +2,19 @@
2
2
  * @retikz/core 公开 API
3
3
  * @description 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/canvas、@retikz/ssr)只能 import 本文件导出内容,不准走子路径。本包零 React/零 DOM 依赖
4
4
  */
5
- export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, NodeTextSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
6
- export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRPath, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, NodeTextAlign, } from './ir';
5
+ export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
6
+ export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, NodeTextAlign, } from './ir';
7
7
  export { ARROW_SHAPES, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, } from './ir';
8
- export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, PathCommand, ArrowEndSpec, GroupPrim, Transform, ViewBox, Scene, } from './primitive';
9
- export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, } from './compile';
10
- export { fallbackMeasurer, compileToScene } from './compile';
8
+ export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, PathCommand,
9
+ /** 7 named PathCommand 分支(便于 wrapper / Pick<>) */
10
+ MovePathCommand, LinePathCommand, QuadPathCommand, CubicPathCommand, ArcPathCommand, EllipseArcPathCommand, ClosePathCommand, ArrowEndSpec, GroupPrim, Transform,
11
+ /** 3 个 named Transform 分支 */
12
+ TranslateTransform, RotateTransform, ScaleTransform, Layout, Scene, } from './primitive';
13
+ export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, CompileWarning, } from './compile';
14
+ export { computeLayout, fallbackMeasurer, compileToScene } from './compile';
11
15
  export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayLabelOp, } from './parsers';
12
16
  export { parseWay, DrawWay, parseTargetSugar } from './parsers';
13
- export type { Position, Rect, RectAnchor, Circle, CircleAnchor, Ellipse, EllipseAnchor, Diamond, DiamondAnchor, PolarPosition, } from './geometry';
17
+ export type { Position, Rect, RectAnchor, Circle, Ellipse, Diamond, PolarPosition, } from './geometry';
14
18
  export { point, rect, circle, ellipse, diamond, RECT_ANCHORS, polar } from './geometry';
15
- export type { ValueOf } from './types';
19
+ export type { ValueOf, AssertEqual } from './types';
16
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cA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AE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG7D,YAAY,EACV,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,eAAe,EACf,QAAQ,EACR,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAIhE,YAAY,EACV,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,MAAM,EACN,YAAY,EACZ,OAAO,EACP,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxF,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX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E,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxF,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
@@ -6,7 +6,7 @@ let zod = require("zod");
6
6
  //#region src/ir/coordinate.ts
7
7
  /**
8
8
  * Coordinate 占位节点(TikZ `\coordinate (m) at (3,2);` 同义)
9
- * @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 viewBox 扩展,与 Node 在同一 nodeIndex 注册
9
+ * @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 layout 扩展,与 Node 在同一 nodeIndex 注册
10
10
  */
11
11
  var CoordinateSchema = zod.z.object({
12
12
  type: zod.z.literal("coordinate").describe("Discriminator marking this child as a coordinate placeholder"),
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Coordinate 占位节点(TikZ `\coordinate (m) at (3,2);` 同义)
4
- * @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 viewBox 扩展,与 Node 在同一 nodeIndex 注册
4
+ * @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 layout 扩展,与 Node 在同一 nodeIndex 注册
5
5
  */
6
6
  export declare const CoordinateSchema: z.ZodObject<{
7
7
  type: z.ZodLiteral<"coordinate">;
@@ -0,0 +1,15 @@
1
+ let zod = require("zod");
2
+ //#region src/ir/font.ts
3
+ /** 字体规格:family/size/weight/style 全部可选 */
4
+ var FontSchema = zod.z.object({
5
+ family: zod.z.string().optional().describe("CSS font-family string, e.g. \"serif\", \"monospace\", \"Inter, sans-serif\""),
6
+ size: zod.z.number().positive().finite().optional().describe("Font size in user units; falls back to the renderer default when omitted"),
7
+ weight: zod.z.union([zod.z.enum(["normal", "bold"]), zod.z.number().finite()]).optional().describe("CSS font-weight: keyword `normal` / `bold` or numeric 100..900"),
8
+ style: zod.z.enum([
9
+ "normal",
10
+ "italic",
11
+ "oblique"
12
+ ]).optional().describe("CSS font-style")
13
+ }).describe("Font properties (family / size / weight / style). All fields optional; consumed by Node text / Node label / LineSpec / future TikZ / Scope font defaults.");
14
+ //#endregion
15
+ exports.FontSchema = FontSchema;
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ /** 字体规格:family/size/weight/style 全部可选 */
3
+ export declare const FontSchema: z.ZodObject<{
4
+ family: z.ZodOptional<z.ZodString>;
5
+ size: z.ZodOptional<z.ZodNumber>;
6
+ weight: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["normal", "bold"]>, z.ZodNumber]>>;
7
+ style: z.ZodOptional<z.ZodEnum<["normal", "italic", "oblique"]>>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ family?: string | undefined;
10
+ size?: number | undefined;
11
+ weight?: number | "normal" | "bold" | undefined;
12
+ style?: "normal" | "italic" | "oblique" | undefined;
13
+ }, {
14
+ family?: string | undefined;
15
+ size?: number | undefined;
16
+ weight?: number | "normal" | "bold" | undefined;
17
+ style?: "normal" | "italic" | "oblique" | undefined;
18
+ }>;
19
+ /** 字体规格 IR 类型(所有字段可选,编译期解析默认值) */
20
+ export type IRFont = z.infer<typeof FontSchema>;
21
+ //# sourceMappingURL=font.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../../../src/ir/font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAyBpB,CAAC;AAEJ,kCAAkC;AAClC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from './position';
2
+ export * from './font';
3
+ export * from './text';
2
4
  export * from './path';
3
5
  export * from './node';
4
6
  export * from './coordinate';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
@@ -2,6 +2,8 @@ const require_position = require("./position/position.cjs");
2
2
  const require_polar_position = require("./position/polar-position.cjs");
3
3
  const require_at_position = require("./position/at-position.cjs");
4
4
  const require_offset_position = require("./position/offset-position.cjs");
5
+ const require_font = require("./font.cjs");
6
+ const require_text = require("./text.cjs");
5
7
  let zod = require("zod");
6
8
  //#region src/ir/node.ts
7
9
  /**
@@ -14,32 +16,6 @@ var NODE_SHAPES = {
14
16
  ellipse: "ellipse",
15
17
  diamond: "diamond"
16
18
  };
17
- /** 节点字体规格:family/size/weight/style 全部可选,透传 SVG `<text>` font-* 属性 */
18
- var FontSchema = zod.z.object({
19
- family: zod.z.string().optional().describe("CSS font-family string, e.g. \"serif\", \"monospace\", \"Inter, sans-serif\""),
20
- size: zod.z.number().positive().optional().describe("Font size in user units; falls back to the renderer default when omitted"),
21
- weight: zod.z.union([zod.z.enum(["normal", "bold"]), zod.z.number()]).optional().describe("CSS font-weight: keyword `normal` / `bold` or numeric 100..900"),
22
- style: zod.z.enum([
23
- "normal",
24
- "italic",
25
- "oblique"
26
- ]).optional().describe("CSS font-style")
27
- }).describe("Font properties for the node text label; all fields optional, nested object form.");
28
- /**
29
- * 单行文本规格:纯字符串走块级默认,对象形式可覆盖 fill/opacity/font
30
- * @description 行级覆盖只生效于本行 `<tspan>`;font 子字段未填则继承块级;align/lineHeight 不可被行覆盖
31
- */
32
- var LineSpecSchema = zod.z.union([zod.z.string(), zod.z.object({
33
- text: zod.z.string().describe("Line content"),
34
- fill: zod.z.string().optional().describe("Per-line text color; overrides block default"),
35
- opacity: zod.z.number().min(0).max(1).optional().describe("Per-line opacity 0..1"),
36
- font: FontSchema.optional().describe("Per-line font overrides; missing fields inherit from block-level `font`")
37
- })]).describe("Single line of text: bare string for default styling, or an object with per-line `fill` / `opacity` / `font` overrides.");
38
- /**
39
- * 节点文本:单字符串或非空多行 LineSpec 数组
40
- * @description 选数组而非 `\n` 字符串:JSON 友好无 escape,行级覆盖天然落字段
41
- */
42
- var NodeTextSchema = zod.z.union([zod.z.string(), zod.z.array(LineSpecSchema).min(1)]).describe("Text label rendered inside the node: a single string for one line, or a non-empty array of line specs (string for default, object for per-line overrides).");
43
19
  /** 节点文本对齐(TikZ `align=` 同义) */
44
20
  var NODE_TEXT_ALIGNS = {
45
21
  left: "left",
@@ -48,7 +24,7 @@ var NODE_TEXT_ALIGNS = {
48
24
  };
49
25
  /**
50
26
  * 节点附属标签 label(TikZ `[label=above:foo]` 同义)
51
- * @description 可挂多个;label 不参与 viewBox。position 支持 8 方向枚举或数字角度(polar 约定:0°=+x,90°=+y 屏幕下方);默认 position='above',distance=4
27
+ * @description 可挂多个;label 不参与 layout。position 支持 8 方向枚举或数字角度(polar 约定:0°=+x,90°=+y 屏幕下方);默认 position='above',distance=4
52
28
  */
53
29
  var NodeLabelSchema = zod.z.object({
54
30
  text: zod.z.string().describe("Label text content; rendered as a single line."),
@@ -56,7 +32,7 @@ var NodeLabelSchema = zod.z.object({
56
32
  distance: zod.z.number().nonnegative().optional().describe("Gap between the node border and the label center, in user units. Default 4."),
57
33
  textColor: zod.z.string().optional().describe("Label text color; falls back to currentColor."),
58
34
  opacity: zod.z.number().min(0).max(1).optional().describe("Label-only opacity 0..1; multiplied with the node opacity if both are set."),
59
- font: FontSchema.optional().describe("Label font overrides; missing fields inherit from the parent node font, then renderer defaults.")
35
+ font: require_font.FontSchema.optional().describe("Label font overrides; missing fields inherit from the parent node font, then renderer defaults.")
60
36
  }).describe("Extra text attached around a node border. Multiple labels supported via array form on `Node.label`.");
61
37
  var NodeSchema = zod.z.object({
62
38
  type: zod.z.literal("node").describe("Discriminator marking this child as a node"),
@@ -69,7 +45,7 @@ var NodeSchema = zod.z.object({
69
45
  require_offset_position.OffsetPositionSchema
70
46
  ]).describe("Center point of the node content box; Cartesian [x, y], polar, relative-to-another-node (`at`-style with `direction` / `of` / `distance?`), or offset from a base point (`{ of, offset }` form mirroring TikZ `calc`). All non-Cartesian forms resolve at compile time."),
71
47
  rotate: zod.z.number().optional().describe("Rotation in degrees around the node center; positive = clockwise (matches TikZ rotate=...)"),
72
- text: NodeTextSchema.optional(),
48
+ text: require_text.TextBlockSchema.optional(),
73
49
  align: zod.z.nativeEnum(NODE_TEXT_ALIGNS).optional().describe("Multi-line text alignment within the text block; `left` / `center` / `right`. Defaults to `center` (matches TikZ)."),
74
50
  lineHeight: zod.z.number().positive().optional().describe("Line height in user units; falls back to `font.size × 1.2` when omitted."),
75
51
  fill: zod.z.string().optional().describe("Background color of the node shape; any CSS color (e.g. \"lightblue\", \"#fafafa\", \"rgba(...)\")"),
@@ -79,8 +55,8 @@ var NodeSchema = zod.z.object({
79
55
  strokeWidth: zod.z.number().optional().describe("Border width in user units; defaults to 1 when omitted"),
80
56
  dashed: zod.z.boolean().optional().describe("Border style preset: dashed line (TikZ `dashed`); compiled to a default dash pattern. `dashArray` takes precedence."),
81
57
  dotted: zod.z.boolean().optional().describe("Border style preset: dotted line (TikZ `dotted`); compiled to a default dot pattern. `dashArray` and `dashed` take precedence."),
82
- dashArray: zod.z.string().optional().describe("Explicit SVG stroke-dasharray value (e.g. \"4 2\"); overrides `dashed` / `dotted`."),
83
- roundedCorners: zod.z.number().nonnegative().optional().describe("Corner radius in user units; only effective on `rectangle` shape (rx / ry on `<rect>`)."),
58
+ dashArray: zod.z.array(zod.z.number().finite().nonnegative()).min(1).optional().describe("Explicit stroke dash pattern lengths in user units (e.g. [4, 2]); overrides `dashed` / `dotted`."),
59
+ roundedCorners: zod.z.number().nonnegative().optional().describe("Corner radius in user units; only effective on `rectangle` shape."),
84
60
  minimumWidth: zod.z.number().nonnegative().optional().describe("Minimum visual border width in user units; floors the bounding box width."),
85
61
  minimumHeight: zod.z.number().nonnegative().optional().describe("Minimum visual border height in user units; floors the bounding box height."),
86
62
  minimumSize: zod.z.number().nonnegative().optional().describe("Symmetric alias for `minimumWidth` + `minimumHeight`; axis-specific fields take precedence."),
@@ -94,14 +70,11 @@ var NodeSchema = zod.z.object({
94
70
  outerSep: zod.z.number().nonnegative().optional().describe("Outer margin from border to path attachment point in user units; does NOT change the visible border. Falls back to `margin`."),
95
71
  padding: zod.z.number().nonnegative().optional().describe("Symmetric inner padding (alias for `innerXSep` + `innerYSep`); axis-specific fields take precedence."),
96
72
  margin: zod.z.number().nonnegative().optional().describe("Symmetric outer margin (alias for `outerSep`); axis-specific field takes precedence."),
97
- font: FontSchema.optional().describe("Font spec for the inner text label (family / size / weight / style); all fields optional, all fall back to renderer defaults."),
73
+ font: require_font.FontSchema.optional().describe("Font spec for the inner text label (family / size / weight / style); all fields optional, all fall back to renderer defaults."),
98
74
  label: zod.z.union([NodeLabelSchema, zod.z.array(NodeLabelSchema)]).optional().describe("Extra label(s) attached around the node border (TikZ `[label=above:foo]`); single object or array form. Compiled into one TextPrim per label, positioned by `position` direction / angle and `distance`.")
99
75
  }).describe("Node primitive: a positioned, optionally textual shape (rectangle / circle / ellipse / diamond)");
100
76
  //#endregion
101
- exports.FontSchema = FontSchema;
102
- exports.LineSpecSchema = LineSpecSchema;
103
77
  exports.NODE_SHAPES = NODE_SHAPES;
104
78
  exports.NODE_TEXT_ALIGNS = NODE_TEXT_ALIGNS;
105
79
  exports.NodeLabelSchema = NodeLabelSchema;
106
80
  exports.NodeSchema = NodeSchema;
107
- exports.NodeTextSchema = NodeTextSchema;