@retikz/core 0.2.0-alpha.6 → 0.2.0-alpha.8

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 (171) hide show
  1. package/dist/es/arrows/index.d.ts +13 -0
  2. package/dist/es/arrows/index.d.ts.map +1 -0
  3. package/dist/es/arrows/index.js +118 -0
  4. package/dist/es/arrows/types.d.ts +43 -0
  5. package/dist/es/arrows/types.d.ts.map +1 -0
  6. package/dist/es/compile/compile.d.ts +26 -1
  7. package/dist/es/compile/compile.d.ts.map +1 -1
  8. package/dist/es/compile/compile.js +37 -4
  9. package/dist/es/compile/marker-prim.d.ts +22 -0
  10. package/dist/es/compile/marker-prim.d.ts.map +1 -0
  11. package/dist/es/compile/marker-prim.js +63 -0
  12. package/dist/es/compile/node.d.ts +19 -4
  13. package/dist/es/compile/node.d.ts.map +1 -1
  14. package/dist/es/compile/node.js +159 -29
  15. package/dist/es/compile/paint.d.ts +21 -0
  16. package/dist/es/compile/paint.d.ts.map +1 -0
  17. package/dist/es/compile/paint.js +94 -0
  18. package/dist/es/compile/path/index.d.ts +18 -0
  19. package/dist/es/compile/path/index.d.ts.map +1 -1
  20. package/dist/es/compile/path/index.js +260 -11
  21. package/dist/es/compile/path/relative.d.ts.map +1 -1
  22. package/dist/es/compile/path/relative.js +8 -0
  23. package/dist/es/compile/path/shrink.d.ts +19 -6
  24. package/dist/es/compile/path/shrink.d.ts.map +1 -1
  25. package/dist/es/compile/path/shrink.js +147 -25
  26. package/dist/es/geometry/bend.d.ts +7 -0
  27. package/dist/es/geometry/bend.d.ts.map +1 -1
  28. package/dist/es/geometry/bend.js +26 -1
  29. package/dist/es/index.d.ts +14 -4
  30. package/dist/es/index.d.ts.map +1 -1
  31. package/dist/es/index.js +7 -2
  32. package/dist/es/ir/index.d.ts +2 -0
  33. package/dist/es/ir/index.d.ts.map +1 -1
  34. package/dist/es/ir/json.d.ts +22 -0
  35. package/dist/es/ir/json.d.ts.map +1 -0
  36. package/dist/es/ir/json.js +25 -0
  37. package/dist/es/ir/node.d.ts +262 -9
  38. package/dist/es/ir/node.d.ts.map +1 -1
  39. package/dist/es/ir/node.js +9 -2
  40. package/dist/es/ir/paint.d.ts +154 -0
  41. package/dist/es/ir/paint.d.ts.map +1 -0
  42. package/dist/es/ir/paint.js +59 -0
  43. package/dist/es/ir/path/arrow.d.ts +52 -72
  44. package/dist/es/ir/path/arrow.d.ts.map +1 -1
  45. package/dist/es/ir/path/arrow.js +5 -5
  46. package/dist/es/ir/path/path.d.ts +637 -87
  47. package/dist/es/ir/path/path.d.ts.map +1 -1
  48. package/dist/es/ir/path/path.js +23 -2
  49. package/dist/es/ir/path/step.d.ts +363 -8
  50. package/dist/es/ir/path/step.d.ts.map +1 -1
  51. package/dist/es/ir/path/step.js +17 -4
  52. package/dist/es/ir/scope.d.ts +1874 -338
  53. package/dist/es/ir/scope.d.ts.map +1 -1
  54. package/dist/es/ir/scope.js +2 -1
  55. package/dist/es/pathGenerators/define.d.ts +16 -0
  56. package/dist/es/pathGenerators/define.d.ts.map +1 -0
  57. package/dist/es/pathGenerators/define.js +23 -0
  58. package/dist/es/pathGenerators/index.d.ts +9 -0
  59. package/dist/es/pathGenerators/index.d.ts.map +1 -0
  60. package/dist/es/pathGenerators/types.d.ts +45 -0
  61. package/dist/es/pathGenerators/types.d.ts.map +1 -0
  62. package/dist/es/patterns/index.d.ts +10 -0
  63. package/dist/es/patterns/index.d.ts.map +1 -0
  64. package/dist/es/patterns/index.js +83 -0
  65. package/dist/es/patterns/types.d.ts +38 -0
  66. package/dist/es/patterns/types.d.ts.map +1 -0
  67. package/dist/es/primitive/ellipse.d.ts +3 -5
  68. package/dist/es/primitive/ellipse.d.ts.map +1 -1
  69. package/dist/es/primitive/index.d.ts +1 -0
  70. package/dist/es/primitive/index.d.ts.map +1 -1
  71. package/dist/es/primitive/marker.d.ts +160 -0
  72. package/dist/es/primitive/marker.d.ts.map +1 -0
  73. package/dist/es/primitive/paint.d.ts +46 -0
  74. package/dist/es/primitive/paint.d.ts.map +1 -0
  75. package/dist/es/primitive/path.d.ts +25 -20
  76. package/dist/es/primitive/path.d.ts.map +1 -1
  77. package/dist/es/primitive/rect.d.ts +3 -2
  78. package/dist/es/primitive/rect.d.ts.map +1 -1
  79. package/dist/es/primitive/scene.d.ts +4 -0
  80. package/dist/es/primitive/scene.d.ts.map +1 -1
  81. package/dist/es/shapes/types.d.ts +2 -2
  82. package/dist/es/shapes/types.d.ts.map +1 -1
  83. package/dist/lib/arrows/index.cjs +118 -0
  84. package/dist/lib/arrows/index.d.ts +13 -0
  85. package/dist/lib/arrows/index.d.ts.map +1 -0
  86. package/dist/lib/arrows/types.d.ts +43 -0
  87. package/dist/lib/arrows/types.d.ts.map +1 -0
  88. package/dist/lib/compile/compile.cjs +38 -5
  89. package/dist/lib/compile/compile.d.ts +26 -1
  90. package/dist/lib/compile/compile.d.ts.map +1 -1
  91. package/dist/lib/compile/marker-prim.cjs +63 -0
  92. package/dist/lib/compile/marker-prim.d.ts +22 -0
  93. package/dist/lib/compile/marker-prim.d.ts.map +1 -0
  94. package/dist/lib/compile/node.cjs +159 -28
  95. package/dist/lib/compile/node.d.ts +19 -4
  96. package/dist/lib/compile/node.d.ts.map +1 -1
  97. package/dist/lib/compile/paint.cjs +94 -0
  98. package/dist/lib/compile/paint.d.ts +21 -0
  99. package/dist/lib/compile/paint.d.ts.map +1 -0
  100. package/dist/lib/compile/path/index.cjs +258 -9
  101. package/dist/lib/compile/path/index.d.ts +18 -0
  102. package/dist/lib/compile/path/index.d.ts.map +1 -1
  103. package/dist/lib/compile/path/relative.cjs +8 -0
  104. package/dist/lib/compile/path/relative.d.ts.map +1 -1
  105. package/dist/lib/compile/path/shrink.cjs +147 -25
  106. package/dist/lib/compile/path/shrink.d.ts +19 -6
  107. package/dist/lib/compile/path/shrink.d.ts.map +1 -1
  108. package/dist/lib/geometry/bend.cjs +26 -0
  109. package/dist/lib/geometry/bend.d.ts +7 -0
  110. package/dist/lib/geometry/bend.d.ts.map +1 -1
  111. package/dist/lib/index.cjs +14 -0
  112. package/dist/lib/index.d.ts +14 -4
  113. package/dist/lib/index.d.ts.map +1 -1
  114. package/dist/lib/ir/index.d.ts +2 -0
  115. package/dist/lib/ir/index.d.ts.map +1 -1
  116. package/dist/lib/ir/json.cjs +26 -0
  117. package/dist/lib/ir/json.d.ts +22 -0
  118. package/dist/lib/ir/json.d.ts.map +1 -0
  119. package/dist/lib/ir/node.cjs +9 -2
  120. package/dist/lib/ir/node.d.ts +262 -9
  121. package/dist/lib/ir/node.d.ts.map +1 -1
  122. package/dist/lib/ir/paint.cjs +61 -0
  123. package/dist/lib/ir/paint.d.ts +154 -0
  124. package/dist/lib/ir/paint.d.ts.map +1 -0
  125. package/dist/lib/ir/path/arrow.cjs +5 -5
  126. package/dist/lib/ir/path/arrow.d.ts +52 -72
  127. package/dist/lib/ir/path/arrow.d.ts.map +1 -1
  128. package/dist/lib/ir/path/path.cjs +22 -1
  129. package/dist/lib/ir/path/path.d.ts +637 -87
  130. package/dist/lib/ir/path/path.d.ts.map +1 -1
  131. package/dist/lib/ir/path/step.cjs +17 -3
  132. package/dist/lib/ir/path/step.d.ts +363 -8
  133. package/dist/lib/ir/path/step.d.ts.map +1 -1
  134. package/dist/lib/ir/scope.cjs +2 -1
  135. package/dist/lib/ir/scope.d.ts +1874 -338
  136. package/dist/lib/ir/scope.d.ts.map +1 -1
  137. package/dist/lib/pathGenerators/define.cjs +23 -0
  138. package/dist/lib/pathGenerators/define.d.ts +16 -0
  139. package/dist/lib/pathGenerators/define.d.ts.map +1 -0
  140. package/dist/lib/pathGenerators/index.d.ts +9 -0
  141. package/dist/lib/pathGenerators/index.d.ts.map +1 -0
  142. package/dist/lib/pathGenerators/types.d.ts +45 -0
  143. package/dist/lib/pathGenerators/types.d.ts.map +1 -0
  144. package/dist/lib/patterns/index.cjs +83 -0
  145. package/dist/lib/patterns/index.d.ts +10 -0
  146. package/dist/lib/patterns/index.d.ts.map +1 -0
  147. package/dist/lib/patterns/types.d.ts +38 -0
  148. package/dist/lib/patterns/types.d.ts.map +1 -0
  149. package/dist/lib/primitive/ellipse.d.ts +3 -5
  150. package/dist/lib/primitive/ellipse.d.ts.map +1 -1
  151. package/dist/lib/primitive/index.d.ts +1 -0
  152. package/dist/lib/primitive/index.d.ts.map +1 -1
  153. package/dist/lib/primitive/marker.d.ts +160 -0
  154. package/dist/lib/primitive/marker.d.ts.map +1 -0
  155. package/dist/lib/primitive/paint.d.ts +46 -0
  156. package/dist/lib/primitive/paint.d.ts.map +1 -0
  157. package/dist/lib/primitive/path.d.ts +25 -20
  158. package/dist/lib/primitive/path.d.ts.map +1 -1
  159. package/dist/lib/primitive/rect.d.ts +3 -2
  160. package/dist/lib/primitive/rect.d.ts.map +1 -1
  161. package/dist/lib/primitive/scene.d.ts +4 -0
  162. package/dist/lib/primitive/scene.d.ts.map +1 -1
  163. package/dist/lib/shapes/types.d.ts +2 -2
  164. package/dist/lib/shapes/types.d.ts.map +1 -1
  165. package/package.json +1 -1
  166. package/dist/es/compile/path/arrow-geometry.d.ts +0 -22
  167. package/dist/es/compile/path/arrow-geometry.d.ts.map +0 -1
  168. package/dist/es/compile/path/arrow-geometry.js +0 -40
  169. package/dist/lib/compile/path/arrow-geometry.cjs +0 -41
  170. package/dist/lib/compile/path/arrow-geometry.d.ts +0 -22
  171. package/dist/lib/compile/path/arrow-geometry.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shrink.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/shrink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAA0C,MAAM,UAAU,CAAC;AAC3G,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAmCjE,gEAAgE;AAChE,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,EAC/C,QAAQ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AAM,KAAK,MAAM,KAC3B,YAaF,CAAC;AAiDF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,KAAK,CAAC,WAAW,CAAC,EAC5B,aAAa,MAAM,EACnB,WAAW,MAAM,EACjB,aAAa,MAAM,EACnB,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B,IA4CF,CAAC"}
@@ -14,5 +14,31 @@ var bendControlPoints = (from, to, direction, bendAngle) => {
14
14
  const ctlOffset = 4 / 3 * (chord * Math.tan(bendAngle * Math.PI / 180 / 2));
15
15
  return [[from[0] + dx / 3 + ctlOffset * nx, from[1] + dy / 3 + ctlOffset * ny], [from[0] + 2 * dx / 3 + ctlOffset * nx, from[1] + 2 * dy / 3 + ctlOffset * ny]];
16
16
  };
17
+ /** 默认 looseness(looseness 缺省时) */
18
+ var DEFAULT_LOOSENESS = 1;
19
+ /** self-loop(from==to)默认环大小(user units,受 looseness 缩放) */
20
+ var DEFAULT_LOOP_SIZE = 1;
21
+ /** 直边 cubic 控制点距离系数(chord 的几分之一) */
22
+ var OUTIN_DISTANCE_FACTOR = 1 / 3;
23
+ /** 角度(度)转单位方向向量(0°=+x,90°=+y screen-down,与 IR 角度约定一致) */
24
+ var dirOf = (angleDeg) => {
25
+ const rad = angleDeg * Math.PI / 180;
26
+ return [Math.cos(rad), Math.sin(rad)];
27
+ };
28
+ /**
29
+ * out/in 角 + looseness 拟合 from→to 的非对称 cubic(含 self-loop 退化)
30
+ * @description 标准 TikZ:control1 = from + d·dir(outAngle),control2 = to + d·dir(inAngle);
31
+ * d = looseness × distance,distance = chord × 系数(chord>0)或默认环大小(self-loop,from==to chord=0)。
32
+ * self-loop 时两控制点沿 out/in 两个不同方向各自从端点撑开,画出环(bend 对称弯在 chord=0 时退化为点,故 out/in 是自环唯一手段)。
33
+ */
34
+ var outInControlPoints = (from, to, outAngle, inAngle, looseness) => {
35
+ const k = looseness ?? DEFAULT_LOOSENESS;
36
+ const chord = Math.hypot(to[0] - from[0], to[1] - from[1]);
37
+ const d = k * (chord === 0 ? DEFAULT_LOOP_SIZE : chord * OUTIN_DISTANCE_FACTOR);
38
+ const outDir = dirOf(outAngle);
39
+ const inDir = dirOf(inAngle);
40
+ return [[from[0] + d * outDir[0], from[1] + d * outDir[1]], [to[0] + d * inDir[0], to[1] + d * inDir[1]]];
41
+ };
17
42
  //#endregion
18
43
  exports.bendControlPoints = bendControlPoints;
44
+ exports.outInControlPoints = outInControlPoints;
@@ -4,4 +4,11 @@ import { Position } from './point';
4
4
  * @description apex offset = chord × tan(bendAngle/2);控制点取 chord 1/3 与 2/3 处沿法向偏移,让 cubic 在 t=0.5 穿过 apex 故 ctlOffset = 4/3 × apexOffset。法向(screen y-down):visual-left=(dy,-dx)/|chord|,visual-right=(-dy,dx)/|chord|。chord=0 时两控制点都返回 from
5
5
  */
6
6
  export declare const bendControlPoints: (from: Position, to: Position, direction: "left" | "right", bendAngle: number) => [Position, Position];
7
+ /**
8
+ * out/in 角 + looseness 拟合 from→to 的非对称 cubic(含 self-loop 退化)
9
+ * @description 标准 TikZ:control1 = from + d·dir(outAngle),control2 = to + d·dir(inAngle);
10
+ * d = looseness × distance,distance = chord × 系数(chord>0)或默认环大小(self-loop,from==to chord=0)。
11
+ * self-loop 时两控制点沿 out/in 两个不同方向各自从端点撑开,画出环(bend 对称弯在 chord=0 时退化为点,故 out/in 是自环唯一手段)。
12
+ */
13
+ export declare const outInControlPoints: (from: Position, to: Position, outAngle: number, inAngle: number, looseness?: number) => [Position, Position];
7
14
  //# sourceMappingURL=bend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bend.d.ts","sourceRoot":"","sources":["../../../src/geometry/bend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,WAAW,MAAM,GAAG,OAAO,EAC3B,WAAW,MAAM,KAChB,CAAC,QAAQ,EAAE,QAAQ,CAgBrB,CAAC"}
1
+ {"version":3,"file":"bend.d.ts","sourceRoot":"","sources":["../../../src/geometry/bend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,WAAW,MAAM,GAAG,OAAO,EAC3B,WAAW,MAAM,KAChB,CAAC,QAAQ,EAAE,QAAQ,CAgBrB,CAAC;AAiBF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,UAAU,MAAM,EAChB,SAAS,MAAM,EACf,YAAY,MAAM,KACjB,CAAC,QAAQ,EAAE,QAAQ,CAUrB,CAAC"}
@@ -4,6 +4,8 @@ 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
6
  const require_font = require("./ir/font.cjs");
7
+ const require_json = require("./ir/json.cjs");
8
+ const require_paint = require("./ir/paint.cjs");
7
9
  const require_text = require("./ir/text.cjs");
8
10
  const require_arrow = require("./ir/path/arrow.cjs");
9
11
  const require__transform = require("./geometry/_transform.cjs");
@@ -20,6 +22,8 @@ const require_circle = require("./geometry/circle.cjs");
20
22
  const require_ellipse = require("./geometry/ellipse.cjs");
21
23
  const require_diamond = require("./geometry/diamond.cjs");
22
24
  const require_index = require("./shapes/index.cjs");
25
+ const require_index$1 = require("./arrows/index.cjs");
26
+ const require_index$2 = require("./patterns/index.cjs");
23
27
  const require_text_metrics = require("./compile/text-metrics.cjs");
24
28
  const require_layout = require("./compile/layout.cjs");
25
29
  const require_compile = require("./compile/compile.cjs");
@@ -28,6 +32,7 @@ const require_parseTargetSugar = require("./parsers/parseTargetSugar.cjs");
28
32
  const require_parseWay = require("./parsers/parseWay.cjs");
29
33
  const require_polar = require("./geometry/polar.cjs");
30
34
  const require_point = require("./geometry/point.cjs");
35
+ const require_define = require("./pathGenerators/define.cjs");
31
36
  exports.ARROW_MARKER_DEFAULT_SIZE = require_arrow.ARROW_MARKER_DEFAULT_SIZE;
32
37
  exports.ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH = require_arrow.ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH;
33
38
  exports.ARROW_SHAPES = require_arrow.ARROW_SHAPES;
@@ -38,6 +43,8 @@ exports.ArrowDefaultSchema = require_scope.ArrowDefaultSchema;
38
43
  exports.ArrowDetailSchema = require_arrow.ArrowDetailSchema;
39
44
  exports.ArrowEndDetailSchema = require_arrow.ArrowEndDetailSchema;
40
45
  exports.AtPositionSchema = require_at_position.AtPositionSchema;
46
+ exports.BUILTIN_ARROWS = require_index$1.BUILTIN_ARROWS;
47
+ exports.BUILTIN_PATTERNS = require_index$2.BUILTIN_PATTERNS;
41
48
  exports.BUILTIN_SHAPES = require_index.BUILTIN_SHAPES;
42
49
  exports.BendStepSchema = require_step.BendStepSchema;
43
50
  exports.CURRENT_IR_VERSION = require_scene.CURRENT_IR_VERSION;
@@ -53,7 +60,11 @@ exports.DrawWay = require_parseWay.DrawWay;
53
60
  exports.EllipsePathStepSchema = require_step.EllipsePathStepSchema;
54
61
  exports.FoldStepSchema = require_step.FoldStepSchema;
55
62
  exports.FontSchema = require_font.FontSchema;
63
+ exports.GeneratorStepSchema = require_step.GeneratorStepSchema;
64
+ exports.GradientStopSchema = require_paint.GradientStopSchema;
56
65
  exports.HOLLOW_ARROW_SHAPES = require_arrow.HOLLOW_ARROW_SHAPES;
66
+ exports.JsonObjectSchema = require_json.JsonObjectSchema;
67
+ exports.JsonValueSchema = require_json.JsonValueSchema;
57
68
  exports.LabelDefaultSchema = require_scope.LabelDefaultSchema;
58
69
  exports.LineSpecSchema = require_text.LineSpecSchema;
59
70
  exports.LineStepSchema = require_step.LineStepSchema;
@@ -65,6 +76,8 @@ exports.NodeLabelSchema = require_node.NodeLabelSchema;
65
76
  exports.NodeSchema = require_node.NodeSchema;
66
77
  exports.NodeTargetSchema = require_target.NodeTargetSchema;
67
78
  exports.OffsetPositionSchema = require_offset_position.OffsetPositionSchema;
79
+ exports.PATTERN_SHAPES = require_paint.PATTERN_SHAPES;
80
+ exports.PaintSpecSchema = require_paint.PaintSpecSchema;
68
81
  exports.PathDefaultSchema = require_scope.PathDefaultSchema;
69
82
  exports.PathSchema = require_path.PathSchema;
70
83
  exports.PolarPositionSchema = require_polar_position.PolarPositionSchema;
@@ -83,6 +96,7 @@ exports.TransformSchema = require_transform.TransformSchema;
83
96
  exports.circle = require_circle.circle;
84
97
  exports.compileToScene = require_compile.compileToScene;
85
98
  exports.computeLayout = require_layout.computeLayout;
99
+ exports.definePathGenerator = require_define.definePathGenerator;
86
100
  exports.diamond = require_diamond.diamond;
87
101
  exports.ellipse = require_ellipse.ellipse;
88
102
  exports.fallbackMeasurer = require_text_metrics.fallbackMeasurer;
@@ -2,14 +2,18 @@
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, AnchorRefSchema, NodeTargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, RectangleStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
6
- export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRAnchorRef, IRNodeTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRRectangleStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, } from './ir';
7
- export { ARROW_SHAPES, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, } from './ir';
5
+ export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, AnchorRefSchema, NodeTargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, RectangleStepSchema, GeneratorStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, PaintSpecSchema, GradientStopSchema, JsonValueSchema, JsonObjectSchema, } from './ir';
6
+ export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRAnchorRef, IRNodeTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRRectangleStep, IRGeneratorStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, BuiltinArrowName, ArrowShapeName, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, PatternShapeName, BuiltinPatternName, IRPaintSpec, IRGradientStop, JsonValue, IRJsonObject, } from './ir';
7
+ export { ARROW_SHAPES, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, PATTERN_SHAPES, } from './ir';
8
8
  export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, PathCommand,
9
9
  /** 7 个 named PathCommand 分支(便于 wrapper / Pick<>) */
10
10
  MovePathCommand, LinePathCommand, QuadPathCommand, CubicPathCommand, ArcPathCommand, EllipseArcPathCommand, ClosePathCommand, ArrowEndSpec, GroupPrim, Transform,
11
11
  /** 3 个 named Transform 分支 */
12
- TranslateTransform, RotateTransform, ScaleTransform, Layout, Scene, } from './primitive';
12
+ TranslateTransform, RotateTransform, ScaleTransform, Layout, Scene, PaintValue, SceneResource,
13
+ /** 已解析 pattern tile(emit-in-compile 产物,进 Scene 资源,纯数据无函数) */
14
+ ResolvedPatternTile,
15
+ /** marker 窄子集(ArrowDefinition.emit 产物,renderer-agnostic) */
16
+ MarkerPrimitive, MarkerPathPrim, MarkerEllipsePrim, MarkerRectPrim, MarkerGroupPrim, MarkerPathCommand, MarkerFill, } from './primitive';
13
17
  export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, CompileWarning, } from './compile';
14
18
  export { computeLayout, fallbackMeasurer, compileToScene } from './compile';
15
19
  export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayLabelOp, } from './parsers';
@@ -18,5 +22,11 @@ export type { Position, Rect, RectAnchor, Circle, Ellipse, Diamond, PolarPositio
18
22
  export { point, rect, circle, ellipse, diamond, RECT_ANCHORS, polar } from './geometry';
19
23
  export type { ShapeDefinition, ShapeStyle } from './shapes';
20
24
  export { BUILTIN_SHAPES, worldToLocal, localToWorld } from './shapes';
25
+ export type { ArrowDefinition, ArrowEmitContext } from './arrows';
26
+ export { BUILTIN_ARROWS } from './arrows';
27
+ export type { PatternDefinition, PatternEmitContext } from './patterns';
28
+ export { BUILTIN_PATTERNS } from './patterns';
29
+ export type { PathGeneratorDefinition, PathGeneratorContext } from './pathGenerators';
30
+ export { definePathGenerator } from './pathGenerators';
21
31
  export type { ValueOf, AssertEqual } from './types';
22
32
  //# 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,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,mBA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,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
@@ -1,5 +1,7 @@
1
1
  export * from './position';
2
2
  export * from './font';
3
+ export * from './json';
4
+ export * from './paint';
3
5
  export * from './text';
4
6
  export * from './path';
5
7
  export * from './node';
@@ -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,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,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,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,26 @@
1
+ let zod = require("zod");
2
+ //#region src/ir/json.ts
3
+ /**
4
+ * 递归 JSON 值 schema
5
+ * @description 守 IR 100% JSON 可序列化:path generator step 的 params 只能由 JSON 值构成;
6
+ * 函数 / undefined / class 实例 / Symbol / Map / Set 等非 JSON 值在 parse 阶段被拒。
7
+ * `z.lazy` 让 array / object 分支可递归引用本 schema,深度不限。
8
+ */
9
+ var JsonValueSchema = zod.z.lazy(() => zod.z.union([
10
+ zod.z.string(),
11
+ zod.z.number().finite(),
12
+ zod.z.boolean(),
13
+ zod.z.null(),
14
+ zod.z.array(JsonValueSchema),
15
+ JsonObjectSchema
16
+ ]).describe("A JSON value: string, finite number, boolean, null, an array of JSON values, or an object of JSON values. Recursive with no depth limit. Functions, undefined, Symbol, class instances, Map, and Set are rejected to keep the IR fully JSON-serializable."));
17
+ /**
18
+ * JSON 对象 schema
19
+ * @description path generator step 的 `params` 类型;键为字符串、值为递归 JSON 值。
20
+ * 作为 compile 运行时的第二道护栏:即便外部 `paramsSchema` 是宽松类型,对其 parse 结果再跑本 schema
21
+ * 可拦下非 JSON 输出(function / undefined 等)。core 公开供外部 refine。
22
+ */
23
+ var JsonObjectSchema = zod.z.record(JsonValueSchema).describe("A JSON object: string keys mapping to recursive JSON values. Used as the params payload of a path generator step and as the runtime guard that the value is fully JSON-serializable. No maximum depth or size is enforced.");
24
+ //#endregion
25
+ exports.JsonObjectSchema = JsonObjectSchema;
26
+ exports.JsonValueSchema = JsonValueSchema;
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * 递归 JSON 值 schema
4
+ * @description 守 IR 100% JSON 可序列化:path generator step 的 params 只能由 JSON 值构成;
5
+ * 函数 / undefined / class 实例 / Symbol / Map / Set 等非 JSON 值在 parse 阶段被拒。
6
+ * `z.lazy` 让 array / object 分支可递归引用本 schema,深度不限。
7
+ */
8
+ export declare const JsonValueSchema: z.ZodType<JsonValue>;
9
+ /**
10
+ * JSON 对象 schema
11
+ * @description path generator step 的 `params` 类型;键为字符串、值为递归 JSON 值。
12
+ * 作为 compile 运行时的第二道护栏:即便外部 `paramsSchema` 是宽松类型,对其 parse 结果再跑本 schema
13
+ * 可拦下非 JSON 输出(function / undefined 等)。core 公开供外部 refine。
14
+ */
15
+ export declare const JsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
16
+ /** 单个 JSON 值(字符串 / 数字 / 布尔 / null / 数组 / 对象,递归) */
17
+ export type JsonValue = string | number | boolean | null | Array<JsonValue> | {
18
+ [key: string]: JsonValue;
19
+ };
20
+ /** JSON 对象类型(path generator step 的 params 形态) */
21
+ export type IRJsonObject = z.infer<typeof JsonObjectSchema>;
22
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/ir/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAahD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yEAI1B,CAAC;AAEJ,mDAAmD;AACnD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,KAAK,CAAC,SAAS,CAAC,GAChB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjC,iDAAiD;AACjD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -3,6 +3,7 @@ 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
5
  const require_font = require("./font.cjs");
6
+ const require_paint = require("./paint.cjs");
6
7
  const require_text = require("./text.cjs");
7
8
  let zod = require("zod");
8
9
  //#region src/ir/node.ts
@@ -38,7 +39,12 @@ var NodeLabelSchema = zod.z.object({
38
39
  "radial",
39
40
  "tangent"
40
41
  ]), zod.z.number()]).optional().describe("Rotate the label text around its own center. `none` (default) = horizontal; `radial` = along the node-center -> label-center direction; `tangent` = radial + 90 deg; a number = explicit degrees (screen y-down: 0 = +x, 90 = +y). Only changes text orientation, not placement."),
41
- keepUpright: zod.z.boolean().optional().describe("When true, flips the rotated label 180 deg if it would otherwise read upside-down (more than 90 deg from upright). Default false (strict geometric angle).")
42
+ keepUpright: zod.z.boolean().optional().describe("When true, flips the rotated label 180 deg if it would otherwise read upside-down (more than 90 deg from upright). Default false (strict geometric angle)."),
43
+ pin: zod.z.union([zod.z.boolean(), zod.z.object({
44
+ stroke: zod.z.string().optional().describe("Leader line color; defaults to the label color / currentColor"),
45
+ strokeWidth: zod.z.number().finite().positive().optional().describe("Leader line width (user units); default 1"),
46
+ dashPattern: zod.z.array(zod.z.number().finite()).optional().describe("Leader dash pattern (e.g. [2, 2])")
47
+ })]).optional().describe("Draw a leader line from the node border to the label (TikZ `pin`). `true` = default thin solid line; an object = leader with style overrides (`stroke` / `strokeWidth` / `dashPattern`); omitted / `false` = no leader. Label placement is unchanged either way.")
42
48
  }).describe("Extra text attached around a node border. Multiple labels supported via array form on `Node.label`.");
43
49
  var NodeSchema = zod.z.object({
44
50
  type: zod.z.literal("node").describe("Discriminator marking this child as a node"),
@@ -54,8 +60,9 @@ var NodeSchema = zod.z.object({
54
60
  text: require_text.TextBlockSchema.optional(),
55
61
  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)."),
56
62
  lineHeight: zod.z.number().positive().optional().describe("Line height in user units; falls back to `font.size × 1.2` when omitted."),
63
+ maxTextWidth: zod.z.number().finite().positive().optional().describe("Max line width before wrapping (user units). The text box shrinks to the actual longest line for short text — this is a wrap threshold, NOT a fixed paragraph width. Western text wraps on word boundaries, CJK per character. Omitted = no auto-wrap (only manual line breaks)."),
57
64
  color: zod.z.string().optional().describe("Master color (TikZ `color=`). When set, stroke / fill / text default to it unless individually overridden, and it cascades to the inner text and edge labels. Individual fields (stroke / fill / textColor) always win over this within the same node."),
58
- fill: zod.z.string().optional().describe("Background color of the node shape; any CSS color (e.g. \"lightblue\", \"#fafafa\", \"rgba(...)\")"),
65
+ fill: zod.z.union([zod.z.string(), require_paint.PaintSpecSchema]).optional().describe("Node background paint: any CSS color string (e.g. \"lightblue\", \"#fafafa\", \"rgba(...)\") or a PaintSpec (linear / radial gradient, pattern, or image)."),
59
66
  fillOpacity: zod.z.number().min(0).max(1).optional().describe("Fill opacity 0..1; affects only the shape fill, leaves stroke / text alone."),
60
67
  stroke: zod.z.string().optional().describe("Border color of the node shape; any CSS color. Defaults to currentColor when omitted"),
61
68
  drawOpacity: zod.z.number().min(0).max(1).optional().describe("Stroke opacity 0..1 (TikZ `draw opacity`); affects only the border."),