@retikz/core 0.1.0-alpha.1 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/compile/compile.js +3 -3
- package/dist/es/compile/node.d.ts +32 -6
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +112 -28
- package/dist/es/compile/path.d.ts +3 -2
- package/dist/es/compile/path.d.ts.map +1 -1
- package/dist/es/compile/path.js +333 -14
- package/dist/es/compile/text-metrics.d.ts +2 -2
- package/dist/es/compile/text-metrics.d.ts.map +1 -1
- package/dist/es/geometry/arc.d.ts +34 -0
- package/dist/es/geometry/arc.d.ts.map +1 -0
- package/dist/es/geometry/arc.js +53 -0
- package/dist/es/geometry/bend.d.ts +18 -0
- package/dist/es/geometry/bend.d.ts.map +1 -0
- package/dist/es/geometry/bend.js +29 -0
- package/dist/es/geometry/index.d.ts +3 -0
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/geometry/segment.d.ts +38 -0
- package/dist/es/geometry/segment.d.ts.map +1 -0
- package/dist/es/geometry/segment.js +82 -0
- package/dist/es/index.d.ts +6 -6
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +5 -4
- package/dist/es/ir/node.d.ts +286 -6
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +71 -5
- package/dist/es/ir/path/path.d.ts +625 -15
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +22 -0
- package/dist/es/ir/path/step.d.ts +872 -20
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +86 -4
- package/dist/es/ir/path/target.d.ts +32 -2
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +7 -3
- package/dist/es/ir/scene.d.ts +1836 -52
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/parsers/index.d.ts +1 -0
- package/dist/es/parsers/index.d.ts.map +1 -1
- package/dist/es/parsers/parseTargetSugar.d.ts +3 -0
- package/dist/es/parsers/parseTargetSugar.d.ts.map +1 -0
- package/dist/es/parsers/parseTargetSugar.js +31 -0
- package/dist/es/parsers/parseWay.d.ts +131 -22
- package/dist/es/parsers/parseWay.d.ts.map +1 -1
- package/dist/es/parsers/parseWay.js +149 -17
- package/dist/es/primitive/ellipse.d.ts +2 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/path.d.ts +4 -0
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +2 -0
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/text.d.ts +43 -13
- package/dist/es/primitive/text.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +3 -3
- package/dist/lib/compile/node.cjs +112 -28
- package/dist/lib/compile/node.d.ts +32 -6
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/path.cjs +333 -14
- package/dist/lib/compile/path.d.ts +3 -2
- package/dist/lib/compile/path.d.ts.map +1 -1
- package/dist/lib/compile/text-metrics.d.ts +2 -2
- package/dist/lib/compile/text-metrics.d.ts.map +1 -1
- package/dist/lib/geometry/arc.cjs +55 -0
- package/dist/lib/geometry/arc.d.ts +34 -0
- package/dist/lib/geometry/arc.d.ts.map +1 -0
- package/dist/lib/geometry/bend.cjs +29 -0
- package/dist/lib/geometry/bend.d.ts +18 -0
- package/dist/lib/geometry/bend.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +3 -0
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/geometry/segment.cjs +88 -0
- package/dist/lib/geometry/segment.d.ts +38 -0
- package/dist/lib/geometry/segment.d.ts.map +1 -0
- package/dist/lib/index.cjs +16 -0
- package/dist/lib/index.d.ts +6 -6
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +74 -4
- package/dist/lib/ir/node.d.ts +286 -6
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +22 -0
- package/dist/lib/ir/path/path.d.ts +625 -15
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +93 -3
- package/dist/lib/ir/path/step.d.ts +872 -20
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +8 -2
- package/dist/lib/ir/path/target.d.ts +32 -2
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/scene.d.ts +1836 -52
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/parsers/index.d.ts +1 -0
- package/dist/lib/parsers/index.d.ts.map +1 -1
- package/dist/lib/parsers/parseTargetSugar.cjs +31 -0
- package/dist/lib/parsers/parseTargetSugar.d.ts +3 -0
- package/dist/lib/parsers/parseTargetSugar.d.ts.map +1 -0
- package/dist/lib/parsers/parseWay.cjs +149 -17
- package/dist/lib/parsers/parseWay.d.ts +131 -22
- package/dist/lib/parsers/parseWay.d.ts.map +1 -1
- package/dist/lib/primitive/ellipse.d.ts +2 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/path.d.ts +4 -0
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +2 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/text.d.ts +43 -13
- package/dist/lib/primitive/text.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AAC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ACtC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,gCAAgC;AAChC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,kCAAkC;AAClC,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/es/ir/path/step.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import { PositionSchema } from "../position/position.js";
|
|
1
2
|
import { TargetSchema } from "./target.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
//#region src/ir/path/step.ts
|
|
5
|
+
/**
|
|
6
|
+
* 边标注(ADR-0004):挂在画线 step 上的 label,渲染时按段几何 + side 偏移
|
|
7
|
+
* 翻译为一个 TextPrim。`move` / `cycle` 不挂 label——前者不画线、后者是闭合
|
|
8
|
+
* 标记,标签语义不清。
|
|
9
|
+
*/
|
|
10
|
+
var StepLabelSchema = z.object({
|
|
11
|
+
text: z.string().describe("Label text content. Single-line; for multi-line use \\n."),
|
|
12
|
+
position: z.enum([
|
|
13
|
+
"midway",
|
|
14
|
+
"near-start",
|
|
15
|
+
"near-end"
|
|
16
|
+
]).optional().describe("Position along the step segment (TikZ `midway` / `near start` / `near end`). Default `midway`."),
|
|
17
|
+
side: z.enum([
|
|
18
|
+
"above",
|
|
19
|
+
"below",
|
|
20
|
+
"left",
|
|
21
|
+
"right",
|
|
22
|
+
"sloped"
|
|
23
|
+
]).optional().describe("Side relative to segment direction. `above` / `below` / `left` / `right` offset along segment normal; `sloped` rotates label along the tangent (no normal offset). Default `above`.")
|
|
24
|
+
}).describe("Edge label spec attached to a drawn step (ADR-0004); compiled to a TextPrim positioned along the segment.");
|
|
4
25
|
var MoveStepSchema = z.object({
|
|
5
26
|
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
6
27
|
kind: z.literal("move").describe("Move the cursor to the target without drawing (like SVG path \"M\")"),
|
|
@@ -9,23 +30,84 @@ var MoveStepSchema = z.object({
|
|
|
9
30
|
var LineStepSchema = z.object({
|
|
10
31
|
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
11
32
|
kind: z.literal("line").describe("Draw a straight line from the current cursor to the target (like SVG path \"L\")"),
|
|
12
|
-
to: TargetSchema.describe("Destination point of the line segment")
|
|
33
|
+
to: TargetSchema.describe("Destination point of the line segment"),
|
|
34
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this line segment")
|
|
13
35
|
}).describe("Line action: straight-line segment from cursor to target");
|
|
14
36
|
var FoldStepSchema = z.object({
|
|
15
37
|
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
16
38
|
kind: z.literal("step").describe("Folded right-angle segment from cursor to target through one intermediate point (TikZ `-|` / `|-`)"),
|
|
17
39
|
via: z.enum(["-|", "|-"]).describe("Folding direction: `-|` first horizontal then vertical; `|-` first vertical then horizontal"),
|
|
18
|
-
to: TargetSchema.describe("Destination point of the folded segment")
|
|
40
|
+
to: TargetSchema.describe("Destination point of the folded segment"),
|
|
41
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this folded segment; positioned along the corresponding leg by `position`.")
|
|
19
42
|
}).describe("Fold action: TikZ-style right-angle fold with a single intermediate point chosen by `via`");
|
|
20
43
|
var CycleStepSchema = z.object({
|
|
21
44
|
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
22
45
|
kind: z.literal("cycle").describe("Close the path back to the most recent move target (TikZ `cycle` / SVG path \"Z\")")
|
|
23
46
|
}).describe("Cycle action: close the current sub-path back to its starting point; carries no `to` field");
|
|
47
|
+
/**
|
|
48
|
+
* 控制点的 schema 别名。
|
|
49
|
+
*
|
|
50
|
+
* alpha.3:仅支持笛卡尔 `[x, y]`(与 ADR-0001 字面一致)。
|
|
51
|
+
* 未来扩展点:要支持节点 ref / 极坐标作为控制点(如 TikZ `controls (B)`)时,
|
|
52
|
+
* 只把这里改成 `z.union([PositionSchema, PolarPositionSchema, z.string().min(1)])`,
|
|
53
|
+
* curve / cubic schema 与下游消费侧不变。
|
|
54
|
+
*/
|
|
55
|
+
var ControlPointSchema = PositionSchema.describe("Bezier control point. Currently Cartesian [x, y]; reserved for node ref / polar in future versions.");
|
|
56
|
+
var CurveStepSchema = z.object({
|
|
57
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
58
|
+
kind: z.literal("curve").describe("Quadratic Bezier curve from cursor to target with one control point (TikZ `.. controls (B) ..`, SVG path \"Q\")"),
|
|
59
|
+
to: TargetSchema.describe("Destination point of the curve"),
|
|
60
|
+
control: ControlPointSchema.describe("Single control point for the quadratic Bezier"),
|
|
61
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this quadratic Bezier")
|
|
62
|
+
}).describe("Curve action: quadratic Bezier; one control point shapes the bend");
|
|
63
|
+
var CubicStepSchema = z.object({
|
|
64
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
65
|
+
kind: z.literal("cubic").describe("Cubic Bezier curve from cursor to target with two control points (TikZ `.. controls (B) and (C) ..`, SVG path \"C\")"),
|
|
66
|
+
to: TargetSchema.describe("Destination point of the cubic curve"),
|
|
67
|
+
control1: ControlPointSchema.describe("First control point (influences the start tangent)"),
|
|
68
|
+
control2: ControlPointSchema.describe("Second control point (influences the end tangent)"),
|
|
69
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this cubic Bezier")
|
|
70
|
+
}).describe("Cubic action: cubic Bezier; two control points give precise tangent control at both ends");
|
|
71
|
+
var BendStepSchema = z.object({
|
|
72
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
73
|
+
kind: z.literal("bend").describe("Arc-like bend from cursor to target by direction + angle (TikZ `to[bend left=N]` / `to[bend right=N]`); compiles to a cubic Bezier approximation"),
|
|
74
|
+
to: TargetSchema.describe("Destination point of the bend"),
|
|
75
|
+
bendDirection: z.enum(["left", "right"]).describe("Bend side relative to from→to direction (visual left vs right of the chord)"),
|
|
76
|
+
bendAngle: z.number().optional().describe("Bend angle in degrees; default 30 (matches TikZ `bend left` without explicit angle)"),
|
|
77
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this bend segment")
|
|
78
|
+
}).describe("Bend action: shorthand for an arc-like cubic; control points computed at compile time");
|
|
79
|
+
var ArcStepSchema = z.object({
|
|
80
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
81
|
+
kind: z.literal("arc").describe("Arc segment from cursor as center, sweeping startAngle → endAngle on a circle of given radius (TikZ `arc[start angle=…, end angle=…, radius=…]`); pen ends at the arc endpoint, not the center"),
|
|
82
|
+
startAngle: z.number().describe("Arc start angle in degrees, CCW from +x axis (math convention; SVG y-down means visual CW)"),
|
|
83
|
+
endAngle: z.number().describe("Arc end angle in degrees; sweep direction inferred from startAngle vs endAngle"),
|
|
84
|
+
radius: z.number().positive().describe("Arc radius in user units"),
|
|
85
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this arc")
|
|
86
|
+
}).describe("Arc action: TikZ-style arc with implicit center at the cursor; startAngle / endAngle / radius give the geometry. Pen is left at the arc endpoint.");
|
|
87
|
+
var CirclePathStepSchema = z.object({
|
|
88
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
89
|
+
kind: z.literal("circlePath").describe("Full circle centered at the cursor with given radius (TikZ `circle[radius=…]`); SVG path emits two semi-arcs to avoid the 360° A-command degeneracy. Pen returns to the center."),
|
|
90
|
+
radius: z.number().positive().describe("Circle radius in user units"),
|
|
91
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this full circle")
|
|
92
|
+
}).describe("CirclePath action: full closed circle around the cursor as center; pen returns to center after.");
|
|
93
|
+
var EllipsePathStepSchema = z.object({
|
|
94
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
95
|
+
kind: z.literal("ellipsePath").describe("Full ellipse centered at the cursor with given x/y radii (TikZ `ellipse[x radius=…, y radius=…]`); SVG path emits two semi-arcs. Pen returns to the center."),
|
|
96
|
+
radiusX: z.number().positive().describe("Ellipse x-axis radius (semi-major or semi-minor on x)"),
|
|
97
|
+
radiusY: z.number().positive().describe("Ellipse y-axis radius (semi-major or semi-minor on y)"),
|
|
98
|
+
label: StepLabelSchema.optional().describe("Edge label attached to this full ellipse")
|
|
99
|
+
}).describe("EllipsePath action: full closed ellipse around the cursor; pen returns to center.");
|
|
24
100
|
var StepSchema = z.discriminatedUnion("kind", [
|
|
25
101
|
MoveStepSchema,
|
|
26
102
|
LineStepSchema,
|
|
27
103
|
FoldStepSchema,
|
|
28
|
-
CycleStepSchema
|
|
104
|
+
CycleStepSchema,
|
|
105
|
+
CurveStepSchema,
|
|
106
|
+
CubicStepSchema,
|
|
107
|
+
BendStepSchema,
|
|
108
|
+
ArcStepSchema,
|
|
109
|
+
CirclePathStepSchema,
|
|
110
|
+
EllipsePathStepSchema
|
|
29
111
|
]).describe("A single path action; the discriminator field is `kind`");
|
|
30
112
|
//#endregion
|
|
31
|
-
export { CycleStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, StepSchema };
|
|
113
|
+
export { ArcStepSchema, BendStepSchema, CirclePathStepSchema, ControlPointSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, EllipsePathStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, StepLabelSchema, StepSchema };
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
2
|
+
export declare const RelTargetSchema: z.ZodObject<{
|
|
3
|
+
rel: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
rel: [number, number];
|
|
6
|
+
}, {
|
|
7
|
+
rel: [number, number];
|
|
8
|
+
}>;
|
|
9
|
+
export declare const RelAccumulateTargetSchema: z.ZodObject<{
|
|
10
|
+
relAccumulate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
relAccumulate: [number, number];
|
|
13
|
+
}, {
|
|
14
|
+
relAccumulate: [number, number];
|
|
15
|
+
}>;
|
|
16
|
+
export declare const TargetSchema: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString, z.ZodObject<{
|
|
17
|
+
rel: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
rel: [number, number];
|
|
20
|
+
}, {
|
|
21
|
+
rel: [number, number];
|
|
22
|
+
}>, z.ZodObject<{
|
|
23
|
+
relAccumulate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
relAccumulate: [number, number];
|
|
26
|
+
}, {
|
|
27
|
+
relAccumulate: [number, number];
|
|
28
|
+
}>]>;
|
|
29
|
+
/** 路径端点:直接坐标 [x, y]、极坐标、节点 id 字符串、相对偏移对象 */
|
|
4
30
|
export type IRTarget = z.infer<typeof TargetSchema>;
|
|
31
|
+
/** 相对前一 step 终点的偏移;不更新 prevEnd(TikZ `(+x, +y)`) */
|
|
32
|
+
export type IRRelTarget = z.infer<typeof RelTargetSchema>;
|
|
33
|
+
/** 累积相对偏移;更新 prevEnd(TikZ `(++x, ++y)`) */
|
|
34
|
+
export type IRRelAccumulateTarget = z.infer<typeof RelAccumulateTargetSchema>;
|
|
5
35
|
//# sourceMappingURL=target.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe;;;;;;EAQzB,CAAC;AAEJ,eAAO,MAAM,yBAAyB;;;;;;EAQnC,CAAC;AAEJ,eAAO,MAAM,YAAY;;;;;;;;;;;;IAUtB,CAAC;AAEJ,4CAA4C;AAC5C,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEpD,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE1D,2CAA2C;AAC3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -2,10 +2,14 @@ import { PositionSchema } from "../position/position.js";
|
|
|
2
2
|
import { PolarPositionSchema } from "../position/polar-position.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/ir/path/target.ts
|
|
5
|
+
var RelTargetSchema = z.object({ rel: z.tuple([z.number(), z.number()]).describe("Relative offset (dx, dy)") }).describe("Relative offset from the previous step end point (does NOT update the cursor position; matches TikZ `(+x, +y)` syntax)");
|
|
6
|
+
var RelAccumulateTargetSchema = z.object({ relAccumulate: z.tuple([z.number(), z.number()]).describe("Accumulated relative offset (dx, dy)") }).describe("Accumulated relative offset from the previous step end point (DOES update the cursor; matches TikZ `(++x, ++y)` syntax)");
|
|
5
7
|
var TargetSchema = z.union([
|
|
6
8
|
PositionSchema,
|
|
7
9
|
PolarPositionSchema,
|
|
8
|
-
z.string().min(1)
|
|
9
|
-
|
|
10
|
+
z.string().min(1),
|
|
11
|
+
RelTargetSchema,
|
|
12
|
+
RelAccumulateTargetSchema
|
|
13
|
+
]).describe("Path endpoint: Cartesian [x, y], polar position, node id reference, or relative offset object ({ rel } / { relAccumulate }) resolved at compile time");
|
|
10
14
|
//#endregion
|
|
11
|
-
export { TargetSchema };
|
|
15
|
+
export { RelAccumulateTargetSchema, RelTargetSchema, TargetSchema };
|