@retikz/core 0.2.0-alpha.7 → 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 (147) 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 +29 -2
  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/paint.d.ts +6 -1
  13. package/dist/es/compile/paint.d.ts.map +1 -1
  14. package/dist/es/compile/paint.js +60 -3
  15. package/dist/es/compile/path/index.d.ts +15 -0
  16. package/dist/es/compile/path/index.d.ts.map +1 -1
  17. package/dist/es/compile/path/index.js +258 -10
  18. package/dist/es/compile/path/relative.d.ts.map +1 -1
  19. package/dist/es/compile/path/relative.js +8 -0
  20. package/dist/es/compile/path/shrink.d.ts +19 -6
  21. package/dist/es/compile/path/shrink.d.ts.map +1 -1
  22. package/dist/es/compile/path/shrink.js +147 -25
  23. package/dist/es/geometry/bend.d.ts +7 -0
  24. package/dist/es/geometry/bend.d.ts.map +1 -1
  25. package/dist/es/geometry/bend.js +26 -1
  26. package/dist/es/index.d.ts +14 -4
  27. package/dist/es/index.d.ts.map +1 -1
  28. package/dist/es/index.js +7 -3
  29. package/dist/es/ir/index.d.ts +1 -0
  30. package/dist/es/ir/index.d.ts.map +1 -1
  31. package/dist/es/ir/json.d.ts +22 -0
  32. package/dist/es/ir/json.d.ts.map +1 -0
  33. package/dist/es/ir/json.js +25 -0
  34. package/dist/es/ir/node.d.ts +5 -5
  35. package/dist/es/ir/paint.d.ts +25 -3
  36. package/dist/es/ir/paint.d.ts.map +1 -1
  37. package/dist/es/ir/paint.js +12 -6
  38. package/dist/es/ir/path/arrow.d.ts +28 -48
  39. package/dist/es/ir/path/arrow.d.ts.map +1 -1
  40. package/dist/es/ir/path/arrow.js +5 -5
  41. package/dist/es/ir/path/path.d.ts +444 -55
  42. package/dist/es/ir/path/path.d.ts.map +1 -1
  43. package/dist/es/ir/path/path.js +21 -1
  44. package/dist/es/ir/path/step.d.ts +363 -8
  45. package/dist/es/ir/path/step.d.ts.map +1 -1
  46. package/dist/es/ir/path/step.js +17 -4
  47. package/dist/es/ir/scope.d.ts +703 -189
  48. package/dist/es/ir/scope.d.ts.map +1 -1
  49. package/dist/es/pathGenerators/define.d.ts +16 -0
  50. package/dist/es/pathGenerators/define.d.ts.map +1 -0
  51. package/dist/es/pathGenerators/define.js +23 -0
  52. package/dist/es/pathGenerators/index.d.ts +9 -0
  53. package/dist/es/pathGenerators/index.d.ts.map +1 -0
  54. package/dist/es/pathGenerators/types.d.ts +45 -0
  55. package/dist/es/pathGenerators/types.d.ts.map +1 -0
  56. package/dist/es/patterns/index.d.ts +10 -0
  57. package/dist/es/patterns/index.d.ts.map +1 -0
  58. package/dist/es/patterns/index.js +83 -0
  59. package/dist/es/patterns/types.d.ts +38 -0
  60. package/dist/es/patterns/types.d.ts.map +1 -0
  61. package/dist/es/primitive/index.d.ts +1 -0
  62. package/dist/es/primitive/index.d.ts.map +1 -1
  63. package/dist/es/primitive/marker.d.ts +160 -0
  64. package/dist/es/primitive/marker.d.ts.map +1 -0
  65. package/dist/es/primitive/paint.d.ts +24 -2
  66. package/dist/es/primitive/paint.d.ts.map +1 -1
  67. package/dist/es/primitive/path.d.ts +22 -18
  68. package/dist/es/primitive/path.d.ts.map +1 -1
  69. package/dist/es/primitive/scene.d.ts +1 -1
  70. package/dist/es/primitive/scene.d.ts.map +1 -1
  71. package/dist/lib/arrows/index.cjs +118 -0
  72. package/dist/lib/arrows/index.d.ts +13 -0
  73. package/dist/lib/arrows/index.d.ts.map +1 -0
  74. package/dist/lib/arrows/types.d.ts +43 -0
  75. package/dist/lib/arrows/types.d.ts.map +1 -0
  76. package/dist/lib/compile/compile.cjs +31 -4
  77. package/dist/lib/compile/compile.d.ts +26 -1
  78. package/dist/lib/compile/compile.d.ts.map +1 -1
  79. package/dist/lib/compile/marker-prim.cjs +63 -0
  80. package/dist/lib/compile/marker-prim.d.ts +22 -0
  81. package/dist/lib/compile/marker-prim.d.ts.map +1 -0
  82. package/dist/lib/compile/paint.cjs +60 -3
  83. package/dist/lib/compile/paint.d.ts +6 -1
  84. package/dist/lib/compile/paint.d.ts.map +1 -1
  85. package/dist/lib/compile/path/index.cjs +256 -8
  86. package/dist/lib/compile/path/index.d.ts +15 -0
  87. package/dist/lib/compile/path/index.d.ts.map +1 -1
  88. package/dist/lib/compile/path/relative.cjs +8 -0
  89. package/dist/lib/compile/path/relative.d.ts.map +1 -1
  90. package/dist/lib/compile/path/shrink.cjs +147 -25
  91. package/dist/lib/compile/path/shrink.d.ts +19 -6
  92. package/dist/lib/compile/path/shrink.d.ts.map +1 -1
  93. package/dist/lib/geometry/bend.cjs +26 -0
  94. package/dist/lib/geometry/bend.d.ts +7 -0
  95. package/dist/lib/geometry/bend.d.ts.map +1 -1
  96. package/dist/lib/index.cjs +11 -0
  97. package/dist/lib/index.d.ts +14 -4
  98. package/dist/lib/index.d.ts.map +1 -1
  99. package/dist/lib/ir/index.d.ts +1 -0
  100. package/dist/lib/ir/index.d.ts.map +1 -1
  101. package/dist/lib/ir/json.cjs +26 -0
  102. package/dist/lib/ir/json.d.ts +22 -0
  103. package/dist/lib/ir/json.d.ts.map +1 -0
  104. package/dist/lib/ir/node.d.ts +5 -5
  105. package/dist/lib/ir/paint.cjs +12 -5
  106. package/dist/lib/ir/paint.d.ts +25 -3
  107. package/dist/lib/ir/paint.d.ts.map +1 -1
  108. package/dist/lib/ir/path/arrow.cjs +5 -5
  109. package/dist/lib/ir/path/arrow.d.ts +28 -48
  110. package/dist/lib/ir/path/arrow.d.ts.map +1 -1
  111. package/dist/lib/ir/path/path.cjs +20 -0
  112. package/dist/lib/ir/path/path.d.ts +444 -55
  113. package/dist/lib/ir/path/path.d.ts.map +1 -1
  114. package/dist/lib/ir/path/step.cjs +17 -3
  115. package/dist/lib/ir/path/step.d.ts +363 -8
  116. package/dist/lib/ir/path/step.d.ts.map +1 -1
  117. package/dist/lib/ir/scope.d.ts +703 -189
  118. package/dist/lib/ir/scope.d.ts.map +1 -1
  119. package/dist/lib/pathGenerators/define.cjs +23 -0
  120. package/dist/lib/pathGenerators/define.d.ts +16 -0
  121. package/dist/lib/pathGenerators/define.d.ts.map +1 -0
  122. package/dist/lib/pathGenerators/index.d.ts +9 -0
  123. package/dist/lib/pathGenerators/index.d.ts.map +1 -0
  124. package/dist/lib/pathGenerators/types.d.ts +45 -0
  125. package/dist/lib/pathGenerators/types.d.ts.map +1 -0
  126. package/dist/lib/patterns/index.cjs +83 -0
  127. package/dist/lib/patterns/index.d.ts +10 -0
  128. package/dist/lib/patterns/index.d.ts.map +1 -0
  129. package/dist/lib/patterns/types.d.ts +38 -0
  130. package/dist/lib/patterns/types.d.ts.map +1 -0
  131. package/dist/lib/primitive/index.d.ts +1 -0
  132. package/dist/lib/primitive/index.d.ts.map +1 -1
  133. package/dist/lib/primitive/marker.d.ts +160 -0
  134. package/dist/lib/primitive/marker.d.ts.map +1 -0
  135. package/dist/lib/primitive/paint.d.ts +24 -2
  136. package/dist/lib/primitive/paint.d.ts.map +1 -1
  137. package/dist/lib/primitive/path.d.ts +22 -18
  138. package/dist/lib/primitive/path.d.ts.map +1 -1
  139. package/dist/lib/primitive/scene.d.ts +1 -1
  140. package/dist/lib/primitive/scene.d.ts.map +1 -1
  141. package/package.json +1 -1
  142. package/dist/es/compile/path/arrow-geometry.d.ts +0 -22
  143. package/dist/es/compile/path/arrow-geometry.d.ts.map +0 -1
  144. package/dist/es/compile/path/arrow-geometry.js +0 -40
  145. package/dist/lib/compile/path/arrow-geometry.cjs +0 -41
  146. package/dist/lib/compile/path/arrow-geometry.d.ts +0 -22
  147. package/dist/lib/compile/path/arrow-geometry.d.ts.map +0 -1
@@ -3,6 +3,20 @@ const require_arrow = require("./arrow.cjs");
3
3
  const require_step = require("./step.cjs");
4
4
  let zod = require("zod");
5
5
  //#region src/ir/path/path.ts
6
+ /**
7
+ * 路径整条缩放 schema:等比 number 或非等比 {x,y}
8
+ * @description 与 Node scale 字段对齐;number = 等比,{x,y} = 各轴独立。全部要求有限正数。
9
+ */
10
+ var PathScaleSchema = zod.z.union([zod.z.number().finite().positive(), zod.z.object({
11
+ x: zod.z.number().finite().positive().describe("Scale factor on the x axis (finite, positive)."),
12
+ y: zod.z.number().finite().positive().describe("Scale factor on the y axis (finite, positive).")
13
+ }).describe("Anisotropic scale with independent x / y factors.")]).describe("Whole-path scale: a single finite positive number for uniform scaling, or an { x, y } object for anisotropic scaling. Applied around the path bounding-box center together with rotate.");
14
+ /**
15
+ * 路径中段标记 schema(首批仅箭头)
16
+ * @description `kind:'arrow'` 判别符 + 复用 ArrowEndDetail 视觉子集(shape / scale / length / width / color / fill / opacity / lineWidth);
17
+ * 方向由该处路径切线决定,shape 是已注册箭头名(不是 `->` 方向记号)。后续可扩展更多 mark kind。
18
+ */
19
+ var ArrowMarkSchema = require_arrow.ArrowEndDetailSchema.extend({ kind: zod.z.literal("arrow").describe("Discriminator marking this mark as an arrow tip. Only `arrow` is supported in the first batch; other kinds are rejected by schema.") }).describe("Arrow mark placed along the path: an arrow tip whose direction follows the path tangent at the mark position. Reuses the per-end arrow visual subset (shape / scale / length / width / color / fill / opacity / lineWidth); `shape` is a registered arrow name, NOT a `->` direction token.");
6
20
  var PathSchema = zod.z.object({
7
21
  type: zod.z.literal("path").describe("Discriminator marking this child as a path"),
8
22
  color: zod.z.string().optional().describe("Master color (TikZ `color=`). When set, the stroke, arrow tips, and step labels default to it unless individually overridden. Following the master color (not the stroke) is how a colored line shares its color with its labels and arrows — `stroke=` alone only paints the line."),
@@ -41,6 +55,12 @@ var PathSchema = zod.z.object({
41
55
  fillOpacity: zod.z.number().min(0).max(1).optional().describe("Fill opacity 0..1; affects only the closed-region fill."),
42
56
  drawOpacity: zod.z.number().min(0).max(1).optional().describe("Stroke opacity 0..1 (TikZ `draw opacity`); affects only the path stroke."),
43
57
  zIndex: zod.z.number().int().finite().optional().describe("Explicit stacking order among sibling IR children. Higher draws on top. Omitted = 0 = source order. Sorting is stable: same zIndex keeps source order. Scoped per group (a path inside a scope only restacks within that scope)."),
58
+ rotate: zod.z.number().finite().optional().describe("Rotate the whole path by this many degrees about its bounding-box center (positive = visually clockwise under screen y-down). Equivalent to wrapping the path in a Scope with a rotate transform centered on the path. Endpoints are resolved in the current scope first; the rotation wraps the resulting geometry."),
59
+ scale: PathScaleSchema.optional().describe("Scale the whole path about its bounding-box center: a finite positive number (uniform) or { x, y } (anisotropic). Applied together with rotate around the same center."),
60
+ marks: zod.z.array(zod.z.object({
61
+ pos: zod.z.number().min(0).max(1).describe("Normalized position along the path in [0, 1] (0 = start, 1 = end). Values outside [0, 1] are rejected by schema. The geometric meaning of the parameter matches step labels: arc length for line/step, Bezier parameter for curve/cubic/bend."),
62
+ mark: ArrowMarkSchema.describe("The mark to place at this position; currently an arrow tip oriented by the path tangent.")
63
+ })).optional().describe("Marks placed along the path at normalized positions; each is rendered at its position with its direction taken from the path tangent there. First batch supports arrow marks only."),
44
64
  children: zod.z.array(require_step.StepSchema).min(2).describe("Sequence of step actions defining the path; the first should usually be a `move`")
45
65
  }).describe("A drawn path composed of a sequence of step actions (move / line / ...)");
46
66
  //#endregion