@retikz/core 0.1.0-alpha.4 → 0.1.0-beta.1
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.d.ts +23 -13
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +44 -25
- package/dist/es/compile/index.d.ts +1 -1
- package/dist/es/compile/index.d.ts.map +1 -1
- package/dist/es/compile/node.d.ts +40 -59
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +51 -43
- package/dist/es/compile/parseTarget.d.ts +3 -8
- package/dist/es/compile/parseTarget.d.ts.map +1 -1
- package/dist/es/compile/parseTarget.js +7 -19
- package/dist/es/compile/path/anchor.d.ts +19 -0
- package/dist/es/compile/path/anchor.d.ts.map +1 -0
- package/dist/es/compile/path/anchor.js +54 -0
- package/dist/es/compile/path/index.d.ts +24 -0
- package/dist/es/compile/path/index.d.ts.map +1 -0
- package/dist/es/compile/path/index.js +308 -0
- package/dist/es/compile/path/label.d.ts +18 -0
- package/dist/es/compile/path/label.d.ts.map +1 -0
- package/dist/es/compile/path/label.js +102 -0
- package/dist/es/compile/path/relative.d.ts +8 -0
- package/dist/es/compile/path/relative.d.ts.map +1 -0
- package/dist/es/compile/path/relative.js +48 -0
- package/dist/es/compile/path/shrink.d.ts +24 -0
- package/dist/es/compile/path/shrink.d.ts.map +1 -0
- package/dist/es/compile/path/shrink.js +136 -0
- package/dist/es/compile/path/split.d.ts +15 -0
- package/dist/es/compile/path/split.d.ts.map +1 -0
- package/dist/es/compile/path/split.js +46 -0
- package/dist/es/compile/position.d.ts +4 -8
- package/dist/es/compile/position.d.ts.map +1 -1
- package/dist/es/compile/position.js +10 -10
- package/dist/es/compile/text-metrics.d.ts +6 -5
- package/dist/es/compile/text-metrics.d.ts.map +1 -1
- package/dist/es/compile/text-metrics.js +11 -5
- package/dist/es/compile/view-box.d.ts +1 -4
- package/dist/es/compile/view-box.d.ts.map +1 -1
- package/dist/es/compile/view-box.js +1 -4
- package/dist/es/geometry/_transform.d.ts +21 -0
- package/dist/es/geometry/_transform.d.ts.map +1 -0
- package/dist/es/geometry/_transform.js +27 -0
- package/dist/es/geometry/arc.d.ts +3 -28
- package/dist/es/geometry/arc.d.ts.map +1 -1
- package/dist/es/geometry/arc.js +4 -31
- package/dist/es/geometry/bend.d.ts +2 -13
- package/dist/es/geometry/bend.d.ts.map +1 -1
- package/dist/es/geometry/bend.js +2 -13
- package/dist/es/geometry/circle.d.ts +6 -15
- package/dist/es/geometry/circle.d.ts.map +1 -1
- package/dist/es/geometry/circle.js +2 -20
- package/dist/es/geometry/diamond.d.ts +10 -26
- package/dist/es/geometry/diamond.d.ts.map +1 -1
- package/dist/es/geometry/diamond.js +5 -30
- package/dist/es/geometry/ellipse.d.ts +10 -17
- package/dist/es/geometry/ellipse.d.ts.map +1 -1
- package/dist/es/geometry/ellipse.js +5 -24
- package/dist/es/geometry/point.d.ts +8 -9
- package/dist/es/geometry/point.d.ts.map +1 -1
- package/dist/es/geometry/point.js +8 -9
- package/dist/es/geometry/polar.d.ts +12 -21
- package/dist/es/geometry/polar.d.ts.map +1 -1
- package/dist/es/geometry/polar.js +8 -19
- package/dist/es/geometry/rect.d.ts +8 -32
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +6 -49
- package/dist/es/geometry/segment.d.ts +15 -18
- package/dist/es/geometry/segment.d.ts.map +1 -1
- package/dist/es/geometry/segment.js +9 -16
- package/dist/es/index.d.ts +13 -13
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +7 -4
- package/dist/es/ir/coordinate.d.ts +18 -10
- package/dist/es/ir/coordinate.d.ts.map +1 -1
- package/dist/es/ir/coordinate.js +6 -11
- package/dist/es/ir/font.d.ts +21 -0
- package/dist/es/ir/font.d.ts.map +1 -0
- package/dist/es/ir/font.js +15 -0
- package/dist/es/ir/index.d.ts +2 -0
- package/dist/es/ir/index.d.ts.map +1 -1
- package/dist/es/ir/node.d.ts +51 -181
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +15 -70
- package/dist/es/ir/path/arrow.d.ts +210 -12
- package/dist/es/ir/path/arrow.d.ts.map +1 -1
- package/dist/es/ir/path/arrow.js +39 -12
- package/dist/es/ir/path/path.d.ts +477 -153
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +6 -6
- package/dist/es/ir/path/step.d.ts +395 -223
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +21 -22
- package/dist/es/ir/path/target.d.ts +25 -16
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +8 -6
- package/dist/es/ir/position/at-position.d.ts +4 -11
- package/dist/es/ir/position/at-position.d.ts.map +1 -1
- package/dist/es/ir/position/at-position.js +2 -9
- package/dist/es/ir/position/index.d.ts +1 -0
- package/dist/es/ir/position/index.d.ts.map +1 -1
- package/dist/es/ir/position/offset-position.d.ts +14 -0
- package/dist/es/ir/position/offset-position.d.ts.map +1 -0
- package/dist/es/ir/position/offset-position.js +14 -0
- package/dist/es/ir/position/polar-position.d.ts +1 -4
- package/dist/es/ir/position/polar-position.d.ts.map +1 -1
- package/dist/es/ir/position/polar-position.js +3 -6
- package/dist/es/ir/position/position.d.ts.map +1 -1
- package/dist/es/ir/position/position.js +1 -1
- package/dist/es/ir/scene.d.ts +1236 -422
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/ir/text.d.ts +96 -0
- package/dist/es/ir/text.d.ts.map +1 -0
- package/dist/es/ir/text.js +20 -0
- package/dist/es/parsers/parseTargetSugar.d.ts +4 -0
- package/dist/es/parsers/parseTargetSugar.d.ts.map +1 -1
- package/dist/es/parsers/parseTargetSugar.js +7 -19
- package/dist/es/parsers/parseWay.d.ts +26 -118
- package/dist/es/parsers/parseWay.d.ts.map +1 -1
- package/dist/es/parsers/parseWay.js +19 -61
- package/dist/es/primitive/ellipse.d.ts +4 -14
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/group.d.ts +37 -3
- package/dist/es/primitive/group.d.ts.map +1 -1
- package/dist/es/primitive/path.d.ts +107 -7
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +2 -2
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/scene.d.ts +2 -4
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/es/primitive/text.d.ts +16 -32
- package/dist/es/primitive/text.d.ts.map +1 -1
- package/dist/es/primitive/view-box.d.ts +1 -1
- package/dist/es/primitive/view-box.d.ts.map +1 -1
- package/dist/es/types.d.ts +8 -0
- package/dist/es/types.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +44 -25
- package/dist/lib/compile/compile.d.ts +23 -13
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/index.d.ts +1 -1
- package/dist/lib/compile/index.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +51 -43
- package/dist/lib/compile/node.d.ts +40 -59
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/parseTarget.cjs +7 -19
- package/dist/lib/compile/parseTarget.d.ts +3 -8
- package/dist/lib/compile/parseTarget.d.ts.map +1 -1
- package/dist/lib/compile/path/anchor.cjs +58 -0
- package/dist/lib/compile/path/anchor.d.ts +19 -0
- package/dist/lib/compile/path/anchor.d.ts.map +1 -0
- package/dist/lib/compile/path/index.cjs +308 -0
- package/dist/lib/compile/path/index.d.ts +24 -0
- package/dist/lib/compile/path/index.d.ts.map +1 -0
- package/dist/lib/compile/path/label.cjs +103 -0
- package/dist/lib/compile/path/label.d.ts +18 -0
- package/dist/lib/compile/path/label.d.ts.map +1 -0
- package/dist/lib/compile/path/relative.cjs +48 -0
- package/dist/lib/compile/path/relative.d.ts +8 -0
- package/dist/lib/compile/path/relative.d.ts.map +1 -0
- package/dist/lib/compile/path/shrink.cjs +138 -0
- package/dist/lib/compile/path/shrink.d.ts +24 -0
- package/dist/lib/compile/path/shrink.d.ts.map +1 -0
- package/dist/lib/compile/path/split.cjs +46 -0
- package/dist/lib/compile/path/split.d.ts +15 -0
- package/dist/lib/compile/path/split.d.ts.map +1 -0
- package/dist/lib/compile/position.cjs +10 -10
- package/dist/lib/compile/position.d.ts +4 -8
- package/dist/lib/compile/position.d.ts.map +1 -1
- package/dist/lib/compile/text-metrics.cjs +11 -5
- package/dist/lib/compile/text-metrics.d.ts +6 -5
- package/dist/lib/compile/text-metrics.d.ts.map +1 -1
- package/dist/lib/compile/view-box.cjs +1 -4
- package/dist/lib/compile/view-box.d.ts +1 -4
- package/dist/lib/compile/view-box.d.ts.map +1 -1
- package/dist/lib/geometry/_transform.cjs +28 -0
- package/dist/lib/geometry/_transform.d.ts +21 -0
- package/dist/lib/geometry/_transform.d.ts.map +1 -0
- package/dist/lib/geometry/arc.cjs +3 -31
- package/dist/lib/geometry/arc.d.ts +3 -28
- package/dist/lib/geometry/arc.d.ts.map +1 -1
- package/dist/lib/geometry/bend.cjs +2 -13
- package/dist/lib/geometry/bend.d.ts +2 -13
- package/dist/lib/geometry/bend.d.ts.map +1 -1
- package/dist/lib/geometry/circle.cjs +6 -24
- package/dist/lib/geometry/circle.d.ts +6 -15
- package/dist/lib/geometry/circle.d.ts.map +1 -1
- package/dist/lib/geometry/diamond.cjs +9 -34
- package/dist/lib/geometry/diamond.d.ts +10 -26
- package/dist/lib/geometry/diamond.d.ts.map +1 -1
- package/dist/lib/geometry/ellipse.cjs +9 -28
- package/dist/lib/geometry/ellipse.d.ts +10 -17
- package/dist/lib/geometry/ellipse.d.ts.map +1 -1
- package/dist/lib/geometry/point.cjs +8 -9
- package/dist/lib/geometry/point.d.ts +8 -9
- package/dist/lib/geometry/point.d.ts.map +1 -1
- package/dist/lib/geometry/polar.cjs +8 -19
- package/dist/lib/geometry/polar.d.ts +12 -21
- package/dist/lib/geometry/polar.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +10 -53
- package/dist/lib/geometry/rect.d.ts +8 -32
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/geometry/segment.cjs +9 -16
- package/dist/lib/geometry/segment.d.ts +15 -18
- package/dist/lib/geometry/segment.d.ts.map +1 -1
- package/dist/lib/index.cjs +14 -5
- package/dist/lib/index.d.ts +13 -13
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/coordinate.cjs +6 -11
- package/dist/lib/ir/coordinate.d.ts +18 -10
- package/dist/lib/ir/coordinate.d.ts.map +1 -1
- package/dist/lib/ir/font.cjs +15 -0
- package/dist/lib/ir/font.d.ts +21 -0
- package/dist/lib/ir/font.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +2 -0
- package/dist/lib/ir/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +16 -74
- package/dist/lib/ir/node.d.ts +51 -181
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.cjs +43 -11
- package/dist/lib/ir/path/arrow.d.ts +210 -12
- package/dist/lib/ir/path/arrow.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +5 -5
- package/dist/lib/ir/path/path.d.ts +477 -153
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +21 -22
- package/dist/lib/ir/path/step.d.ts +395 -223
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +9 -7
- package/dist/lib/ir/path/target.d.ts +25 -16
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/position/at-position.cjs +2 -9
- package/dist/lib/ir/position/at-position.d.ts +4 -11
- package/dist/lib/ir/position/at-position.d.ts.map +1 -1
- package/dist/lib/ir/position/index.d.ts +1 -0
- package/dist/lib/ir/position/index.d.ts.map +1 -1
- package/dist/lib/ir/position/offset-position.cjs +14 -0
- package/dist/lib/ir/position/offset-position.d.ts +14 -0
- package/dist/lib/ir/position/offset-position.d.ts.map +1 -0
- package/dist/lib/ir/position/polar-position.cjs +3 -6
- package/dist/lib/ir/position/polar-position.d.ts +1 -4
- package/dist/lib/ir/position/polar-position.d.ts.map +1 -1
- package/dist/lib/ir/position/position.cjs +1 -1
- package/dist/lib/ir/position/position.d.ts.map +1 -1
- package/dist/lib/ir/scene.d.ts +1236 -422
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/ir/text.cjs +21 -0
- package/dist/lib/ir/text.d.ts +96 -0
- package/dist/lib/ir/text.d.ts.map +1 -0
- package/dist/lib/parsers/parseTargetSugar.cjs +7 -19
- package/dist/lib/parsers/parseTargetSugar.d.ts +4 -0
- package/dist/lib/parsers/parseTargetSugar.d.ts.map +1 -1
- package/dist/lib/parsers/parseWay.cjs +19 -61
- package/dist/lib/parsers/parseWay.d.ts +26 -118
- package/dist/lib/parsers/parseWay.d.ts.map +1 -1
- package/dist/lib/primitive/ellipse.d.ts +4 -14
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/group.d.ts +37 -3
- package/dist/lib/primitive/group.d.ts.map +1 -1
- package/dist/lib/primitive/path.d.ts +107 -7
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +2 -2
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/scene.d.ts +2 -4
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/dist/lib/primitive/text.d.ts +16 -32
- package/dist/lib/primitive/text.d.ts.map +1 -1
- package/dist/lib/primitive/view-box.d.ts +1 -1
- package/dist/lib/primitive/view-box.d.ts.map +1 -1
- package/dist/lib/types.d.ts +8 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +13 -4
- package/dist/es/compile/path.d.ts +0 -30
- package/dist/es/compile/path.d.ts.map +0 -1
- package/dist/es/compile/path.js +0 -617
- package/dist/lib/compile/path.cjs +0 -617
- package/dist/lib/compile/path.d.ts +0 -30
- package/dist/lib/compile/path.d.ts.map +0 -1
|
@@ -1,38 +1,35 @@
|
|
|
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
|
-
/** t
|
|
9
|
+
/** t 处的切线(单位向量;零向量时回退 [1, 0]) */
|
|
6
10
|
tangent: Position;
|
|
7
11
|
};
|
|
8
12
|
/** 直线段 from → to */
|
|
9
13
|
export declare const lineSegmentSample: (from: Position, to: Position, t: number) => SegmentSample;
|
|
10
14
|
/**
|
|
11
|
-
* 二次贝塞尔 from → control → to
|
|
12
|
-
* P(t)
|
|
13
|
-
* P'(t) = 2(1-t)(P1-P0) + 2t(P2-P1)
|
|
15
|
+
* 二次贝塞尔 from → control → to
|
|
16
|
+
* @description P(t) = (1-t)²P0 + 2(1-t)t·P1 + t²P2;P'(t) = 2(1-t)(P1-P0) + 2t(P2-P1)
|
|
14
17
|
*/
|
|
15
18
|
export declare const quadSegmentSample: (from: Position, control: Position, to: Position, t: number) => SegmentSample;
|
|
16
19
|
/**
|
|
17
|
-
* 三次贝塞尔 from → c1 → c2 → to
|
|
18
|
-
* P'(t) = 3(1-t)²(P1-P0) + 6(1-t)t(P2-P1) + 3t²(P3-P2)
|
|
20
|
+
* 三次贝塞尔 from → c1 → c2 → to
|
|
21
|
+
* @description P'(t) = 3(1-t)²(P1-P0) + 6(1-t)t(P2-P1) + 3t²(P3-P2)
|
|
19
22
|
*/
|
|
20
23
|
export declare const cubicSegmentSample: (from: Position, c1: Position, c2: Position, to: Position, t: number) => SegmentSample;
|
|
21
24
|
/**
|
|
22
|
-
* 折角段 from → corner → to
|
|
23
|
-
* t∈[0,
|
|
24
|
-
* t=0.5 落在 corner,切线取第一段方向(与"靠近 prev 一侧"一致)。
|
|
25
|
+
* 折角段 from → corner → to
|
|
26
|
+
* @description t∈[0,0.5] 走第一段(参数 2t);t∈(0.5,1] 走第二段(参数 2t-1);t=0.5 落 corner 切线取第一段方向
|
|
25
27
|
*/
|
|
26
28
|
export declare const foldSegmentSample: (from: Position, corner: Position, to: Position, t: number) => SegmentSample;
|
|
27
|
-
/**
|
|
28
|
-
* 弧段(与 ir/path arc 同约定,角度单位为度)。
|
|
29
|
-
* 切线沿"扫描方向"——endAngle ≥ startAngle 时为 (-sin, cos),否则反向。
|
|
30
|
-
*/
|
|
29
|
+
/** 弧段(角度度数,与 ir/path arc 同约定);切线沿扫描方向:endAngle ≥ start 取 (-sin,cos),否则反向 */
|
|
31
30
|
export declare const arcSegmentSample: (center: Position, radius: number, startAngleDeg: number, endAngleDeg: number, t: number) => SegmentSample;
|
|
32
|
-
/**
|
|
33
|
-
* 整圆——从 0°(east)开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致。
|
|
34
|
-
*/
|
|
31
|
+
/** 整圆,从 0°(east) 开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致 */
|
|
35
32
|
export declare const circleSegmentSample: (center: Position, radius: number, t: number) => SegmentSample;
|
|
36
|
-
/**
|
|
33
|
+
/** 整椭圆,参数化 (rx·cos(2πt), ry·sin(2πt)) */
|
|
37
34
|
export declare const ellipseSegmentSample: (center: Position, rx: number, ry: number, t: number) => SegmentSample;
|
|
38
35
|
//# sourceMappingURL=segment.d.ts.map
|
|
@@ -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;
|
|
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;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB;IACxB,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,KACR,aAGF,CAAC;AAEF,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"}
|
|
@@ -11,9 +11,8 @@ var lineSegmentSample = (from, to, t) => ({
|
|
|
11
11
|
tangent: normalize([to[0] - from[0], to[1] - from[1]])
|
|
12
12
|
});
|
|
13
13
|
/**
|
|
14
|
-
* 二次贝塞尔 from → control → to
|
|
15
|
-
* P(t)
|
|
16
|
-
* P'(t) = 2(1-t)(P1-P0) + 2t(P2-P1)
|
|
14
|
+
* 二次贝塞尔 from → control → to
|
|
15
|
+
* @description P(t) = (1-t)²P0 + 2(1-t)t·P1 + t²P2;P'(t) = 2(1-t)(P1-P0) + 2t(P2-P1)
|
|
17
16
|
*/
|
|
18
17
|
var quadSegmentSample = (from, control, to, t) => {
|
|
19
18
|
const u = 1 - t;
|
|
@@ -23,8 +22,8 @@ var quadSegmentSample = (from, control, to, t) => {
|
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
|
-
* 三次贝塞尔 from → c1 → c2 → to
|
|
27
|
-
* P'(t) = 3(1-t)²(P1-P0) + 6(1-t)t(P2-P1) + 3t²(P3-P2)
|
|
25
|
+
* 三次贝塞尔 from → c1 → c2 → to
|
|
26
|
+
* @description P'(t) = 3(1-t)²(P1-P0) + 6(1-t)t(P2-P1) + 3t²(P3-P2)
|
|
28
27
|
*/
|
|
29
28
|
var cubicSegmentSample = (from, c1, c2, to, t) => {
|
|
30
29
|
const u = 1 - t;
|
|
@@ -34,18 +33,14 @@ var cubicSegmentSample = (from, c1, c2, to, t) => {
|
|
|
34
33
|
};
|
|
35
34
|
};
|
|
36
35
|
/**
|
|
37
|
-
* 折角段 from → corner → to
|
|
38
|
-
* t∈[0,
|
|
39
|
-
* t=0.5 落在 corner,切线取第一段方向(与"靠近 prev 一侧"一致)。
|
|
36
|
+
* 折角段 from → corner → to
|
|
37
|
+
* @description t∈[0,0.5] 走第一段(参数 2t);t∈(0.5,1] 走第二段(参数 2t-1);t=0.5 落 corner 切线取第一段方向
|
|
40
38
|
*/
|
|
41
39
|
var foldSegmentSample = (from, corner, to, t) => {
|
|
42
40
|
if (t <= .5) return lineSegmentSample(from, corner, t * 2);
|
|
43
41
|
return lineSegmentSample(corner, to, t * 2 - 1);
|
|
44
42
|
};
|
|
45
|
-
/**
|
|
46
|
-
* 弧段(与 ir/path arc 同约定,角度单位为度)。
|
|
47
|
-
* 切线沿"扫描方向"——endAngle ≥ startAngle 时为 (-sin, cos),否则反向。
|
|
48
|
-
*/
|
|
43
|
+
/** 弧段(角度度数,与 ir/path arc 同约定);切线沿扫描方向:endAngle ≥ start 取 (-sin,cos),否则反向 */
|
|
49
44
|
var arcSegmentSample = (center, radius, startAngleDeg, endAngleDeg, t) => {
|
|
50
45
|
const rad = (startAngleDeg + t * (endAngleDeg - startAngleDeg)) * DEG_TO_RAD;
|
|
51
46
|
const cos = Math.cos(rad);
|
|
@@ -56,9 +51,7 @@ var arcSegmentSample = (center, radius, startAngleDeg, endAngleDeg, t) => {
|
|
|
56
51
|
tangent: normalize([-sin * sweepSign, cos * sweepSign])
|
|
57
52
|
};
|
|
58
53
|
};
|
|
59
|
-
/**
|
|
60
|
-
* 整圆——从 0°(east)开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致。
|
|
61
|
-
*/
|
|
54
|
+
/** 整圆,从 0°(east) 开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致 */
|
|
62
55
|
var circleSegmentSample = (center, radius, t) => {
|
|
63
56
|
const rad = t * 360 * DEG_TO_RAD;
|
|
64
57
|
const cos = Math.cos(rad);
|
|
@@ -68,7 +61,7 @@ var circleSegmentSample = (center, radius, t) => {
|
|
|
68
61
|
tangent: normalize([-sin, cos])
|
|
69
62
|
};
|
|
70
63
|
};
|
|
71
|
-
/**
|
|
64
|
+
/** 整椭圆,参数化 (rx·cos(2πt), ry·sin(2πt)) */
|
|
72
65
|
var ellipseSegmentSample = (center, rx, ry, t) => {
|
|
73
66
|
const rad = t * 360 * DEG_TO_RAD;
|
|
74
67
|
const cos = Math.cos(rad);
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @retikz/core 公开 API
|
|
3
|
-
*
|
|
4
|
-
* 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/canvas、@retikz/ssr)
|
|
5
|
-
* 只能 import 本文件导出的内容,不准走子路径。
|
|
6
|
-
*
|
|
7
|
-
* 本包零 React、零 DOM 依赖。
|
|
3
|
+
* @description 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/canvas、@retikz/ssr)只能 import 本文件导出内容,不准走子路径。本包零 React/零 DOM 依赖
|
|
8
4
|
*/
|
|
9
|
-
export { PositionSchema, PolarPositionSchema, AtPositionSchema, AT_DIRECTIONS, TargetSchema,
|
|
10
|
-
export type { IRPosition, IRAtPosition, AtDirection, IRTarget,
|
|
11
|
-
export { ARROW_SHAPES, NODE_SHAPES, NODE_TEXT_ALIGNS } from './ir';
|
|
12
|
-
export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim,
|
|
13
|
-
|
|
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
|
+
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,
|
|
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, ViewBox, Scene, } from './primitive';
|
|
13
|
+
export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, CompileWarning, } from './compile';
|
|
14
14
|
export { fallbackMeasurer, compileToScene } from './compile';
|
|
15
|
-
export type { WayItem, WayDSL, WayCycle, WayVia,
|
|
15
|
+
export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayLabelOp, } from './parsers';
|
|
16
16
|
export { parseWay, DrawWay, parseTargetSugar } from './parsers';
|
|
17
|
-
export type { Position, Rect, RectAnchor, Circle,
|
|
17
|
+
export type { Position, Rect, RectAnchor, Circle, Ellipse, Diamond, PolarPosition, } from './geometry';
|
|
18
18
|
export { point, rect, circle, ellipse, diamond, RECT_ANCHORS, polar } from './geometry';
|
|
19
|
-
export type { ValueOf } from './types';
|
|
19
|
+
export type { ValueOf, AssertEqual } from './types';
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/es/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
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,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,MAAM,EACN,MAAM,EACN,WAAW,EACX,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,EAAE,EACF,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,aAAa,GACd,MAAM,MAAM,CAAC;AACd,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,sCAAsC,EACtC,WAAW,EACX,gBAAgB,GACjB,MAAM,MAAM,CAAC;AAGd,YAAY,EACV,cAAc,EACd,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW;AACX,oDAAoD;AACpD,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,SAAS;AACT,6BAA6B;AAC7B,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,OAAO,EACP,KAAK,GACN,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,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,OAAO,EACP,OAAO,EACP,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,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/es/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { PositionSchema } from "./ir/position/position.js";
|
|
2
2
|
import { PolarPositionSchema } from "./ir/position/polar-position.js";
|
|
3
3
|
import { AT_DIRECTIONS, AtPositionSchema } from "./ir/position/at-position.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { OffsetPositionSchema } from "./ir/position/offset-position.js";
|
|
5
|
+
import { FontSchema } from "./ir/font.js";
|
|
6
|
+
import { LineSpecSchema, TextBlockSchema } from "./ir/text.js";
|
|
7
|
+
import { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, ArrowDetailSchema, ArrowEndDetailSchema, HOLLOW_ARROW_SHAPES } from "./ir/path/arrow.js";
|
|
8
|
+
import { RelativeAccumulateTargetSchema, RelativeTargetSchema, TargetSchema } from "./ir/path/target.js";
|
|
6
9
|
import { ArcStepSchema, BendStepSchema, CirclePathStepSchema, ControlPointSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, EllipsePathStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, StepLabelSchema, StepSchema } from "./ir/path/step.js";
|
|
7
10
|
import { PathSchema } from "./ir/path/path.js";
|
|
8
|
-
import {
|
|
11
|
+
import { NODE_SHAPES, NODE_TEXT_ALIGNS, NodeLabelSchema, NodeSchema } from "./ir/node.js";
|
|
9
12
|
import { CoordinateSchema } from "./ir/coordinate.js";
|
|
10
13
|
import { CURRENT_IR_VERSION, ChildSchema, SceneSchema } from "./ir/scene.js";
|
|
11
14
|
import { RECT_ANCHORS, rect } from "./geometry/rect.js";
|
|
@@ -18,4 +21,4 @@ import { parseTargetSugar } from "./parsers/parseTargetSugar.js";
|
|
|
18
21
|
import { DrawWay, parseWay } from "./parsers/parseWay.js";
|
|
19
22
|
import { polar } from "./geometry/polar.js";
|
|
20
23
|
import { point } from "./geometry/point.js";
|
|
21
|
-
export { ARROW_SHAPES, AT_DIRECTIONS, ArcStepSchema, AtPositionSchema, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeLabelSchema, NodeSchema,
|
|
24
|
+
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, ArcStepSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, HOLLOW_ARROW_SHAPES, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeLabelSchema, NodeSchema, OffsetPositionSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, circle, compileToScene, diamond, ellipse, fallbackMeasurer, parseTargetSugar, parseWay, point, polar, rect };
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
* Coordinate
|
|
4
|
-
*
|
|
5
|
-
* 命名一个点供后续 path / at 引用,自身不绘制任何图形。
|
|
6
|
-
* 支持笛卡尔 / 极坐标 / 相对定位三种 position 形态,与 `Node.position` 完全一致。
|
|
7
|
-
*
|
|
8
|
-
* 特点:
|
|
9
|
-
* - 必须有 `id`(无 id 的占位节点没有意义)
|
|
10
|
-
* - 不参与 viewBox 扩展(无视觉边界);只在被引用时才间接影响 viewBox(通过引用它的 node / path)
|
|
11
|
-
* - 与 Node 在同一个 nodeIndex 中注册——path target 字符串、`Node.position.of` 都能命中 coordinate id
|
|
3
|
+
* Coordinate 占位节点(TikZ `\coordinate (m) at (3,2);` 同义)
|
|
4
|
+
* @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 viewBox 扩展,与 Node 在同一 nodeIndex 注册
|
|
12
5
|
*/
|
|
13
6
|
export declare const CoordinateSchema: z.ZodObject<{
|
|
14
7
|
type: z.ZodLiteral<"coordinate">;
|
|
@@ -34,6 +27,15 @@ export declare const CoordinateSchema: z.ZodObject<{
|
|
|
34
27
|
direction: "above" | "below" | "left" | "right" | "above-left" | "above-right" | "below-left" | "below-right";
|
|
35
28
|
of: string;
|
|
36
29
|
distance?: number | undefined;
|
|
30
|
+
}>, z.ZodObject<{
|
|
31
|
+
of: z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
32
|
+
offset: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
of: string | [number, number] | import('./position').PolarPosition;
|
|
35
|
+
offset: [number, number];
|
|
36
|
+
}, {
|
|
37
|
+
of: string | [number, number] | import('./position').PolarPosition;
|
|
38
|
+
offset: [number, number];
|
|
37
39
|
}>]>;
|
|
38
40
|
}, "strip", z.ZodTypeAny, {
|
|
39
41
|
type: "coordinate";
|
|
@@ -41,6 +43,9 @@ export declare const CoordinateSchema: z.ZodObject<{
|
|
|
41
43
|
direction: "above" | "below" | "left" | "right" | "above-left" | "above-right" | "below-left" | "below-right";
|
|
42
44
|
of: string;
|
|
43
45
|
distance?: number | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
of: string | [number, number] | import('./position').PolarPosition;
|
|
48
|
+
offset: [number, number];
|
|
44
49
|
};
|
|
45
50
|
id: string;
|
|
46
51
|
}, {
|
|
@@ -49,9 +54,12 @@ export declare const CoordinateSchema: z.ZodObject<{
|
|
|
49
54
|
direction: "above" | "below" | "left" | "right" | "above-left" | "above-right" | "below-left" | "below-right";
|
|
50
55
|
of: string;
|
|
51
56
|
distance?: number | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
of: string | [number, number] | import('./position').PolarPosition;
|
|
59
|
+
offset: [number, number];
|
|
52
60
|
};
|
|
53
61
|
id: string;
|
|
54
62
|
}>;
|
|
55
|
-
/** Coordinate IR
|
|
63
|
+
/** Coordinate IR 类型 `{ type:'coordinate', id, position }` */
|
|
56
64
|
export type IRCoordinate = z.infer<typeof CoordinateSchema>;
|
|
57
65
|
//# sourceMappingURL=coordinate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinate.d.ts","sourceRoot":"","sources":["../../../src/ir/coordinate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"coordinate.d.ts","sourceRoot":"","sources":["../../../src/ir/coordinate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB1B,CAAC;AAEJ,6DAA6D;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/es/ir/coordinate.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { PositionSchema } from "./position/position.js";
|
|
2
2
|
import { PolarPositionSchema } from "./position/polar-position.js";
|
|
3
3
|
import { AtPositionSchema } from "./position/at-position.js";
|
|
4
|
+
import { OffsetPositionSchema } from "./position/offset-position.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region src/ir/coordinate.ts
|
|
6
7
|
/**
|
|
7
|
-
* Coordinate
|
|
8
|
-
*
|
|
9
|
-
* 命名一个点供后续 path / at 引用,自身不绘制任何图形。
|
|
10
|
-
* 支持笛卡尔 / 极坐标 / 相对定位三种 position 形态,与 `Node.position` 完全一致。
|
|
11
|
-
*
|
|
12
|
-
* 特点:
|
|
13
|
-
* - 必须有 `id`(无 id 的占位节点没有意义)
|
|
14
|
-
* - 不参与 viewBox 扩展(无视觉边界);只在被引用时才间接影响 viewBox(通过引用它的 node / path)
|
|
15
|
-
* - 与 Node 在同一个 nodeIndex 中注册——path target 字符串、`Node.position.of` 都能命中 coordinate id
|
|
8
|
+
* Coordinate 占位节点(TikZ `\coordinate (m) at (3,2);` 同义)
|
|
9
|
+
* @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 viewBox 扩展,与 Node 在同一 nodeIndex 注册
|
|
16
10
|
*/
|
|
17
11
|
var CoordinateSchema = z.object({
|
|
18
12
|
type: z.literal("coordinate").describe("Discriminator marking this child as a coordinate placeholder"),
|
|
@@ -20,8 +14,9 @@ var CoordinateSchema = z.object({
|
|
|
20
14
|
position: z.union([
|
|
21
15
|
PositionSchema,
|
|
22
16
|
PolarPositionSchema,
|
|
23
|
-
AtPositionSchema
|
|
24
|
-
|
|
17
|
+
AtPositionSchema,
|
|
18
|
+
OffsetPositionSchema
|
|
19
|
+
]).describe("Coordinate position; Cartesian [x, y], polar, relative-to-another-node (`at`-style), or offset from a base point (`{ of, offset }` form). Resolved at compile time.")
|
|
25
20
|
}).describe("Coordinate placeholder: a named point with no visual; usable as a target for paths and as an anchor for relative positioning. Mirrors TikZ `\\coordinate (id) at (...);`");
|
|
26
21
|
//#endregion
|
|
27
22
|
export { CoordinateSchema };
|
|
@@ -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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/ir/font.ts
|
|
3
|
+
/** 字体规格:family/size/weight/style 全部可选 */
|
|
4
|
+
var FontSchema = z.object({
|
|
5
|
+
family: z.string().optional().describe("CSS font-family string, e.g. \"serif\", \"monospace\", \"Inter, sans-serif\""),
|
|
6
|
+
size: z.number().positive().finite().optional().describe("Font size in user units; falls back to the renderer default when omitted"),
|
|
7
|
+
weight: z.union([z.enum(["normal", "bold"]), z.number().finite()]).optional().describe("CSS font-weight: keyword `normal` / `bold` or numeric 100..900"),
|
|
8
|
+
style: 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
|
+
export { FontSchema };
|
package/dist/es/ir/index.d.ts
CHANGED
|
@@ -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"}
|