@retikz/core 0.2.0-alpha.5 → 0.2.0-alpha.7
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/anchor-cache.d.ts +10 -0
- package/dist/es/compile/anchor-cache.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.js +25 -1
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +10 -4
- package/dist/es/compile/index.d.ts +0 -1
- package/dist/es/compile/index.d.ts.map +1 -1
- package/dist/es/compile/node.d.ts +19 -4
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +159 -29
- package/dist/es/compile/paint.d.ts +16 -0
- package/dist/es/compile/paint.d.ts.map +1 -0
- package/dist/es/compile/paint.js +37 -0
- package/dist/es/compile/path/anchor.d.ts.map +1 -1
- package/dist/es/compile/path/anchor.js +17 -18
- package/dist/es/compile/path/index.d.ts +3 -0
- package/dist/es/compile/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +12 -5
- package/dist/es/geometry/_edge.d.ts +29 -0
- package/dist/es/geometry/_edge.d.ts.map +1 -0
- package/dist/es/geometry/_edge.js +35 -0
- package/dist/es/geometry/circle.d.ts +3 -0
- package/dist/es/geometry/circle.d.ts.map +1 -1
- package/dist/es/geometry/circle.js +7 -0
- package/dist/es/geometry/diamond.d.ts +3 -0
- package/dist/es/geometry/diamond.d.ts.map +1 -1
- package/dist/es/geometry/diamond.js +29 -0
- package/dist/es/geometry/ellipse.d.ts +3 -0
- package/dist/es/geometry/ellipse.d.ts.map +1 -1
- package/dist/es/geometry/ellipse.js +7 -0
- package/dist/es/geometry/rect.d.ts +3 -0
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +6 -0
- package/dist/es/index.d.ts +4 -4
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +6 -4
- package/dist/es/ir/coordinate.d.ts +2 -2
- package/dist/es/ir/index.d.ts +1 -0
- package/dist/es/ir/index.d.ts.map +1 -1
- package/dist/es/ir/node.d.ts +264 -11
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +9 -2
- package/dist/es/ir/paint.d.ts +132 -0
- package/dist/es/ir/paint.d.ts.map +1 -0
- package/dist/es/ir/paint.js +53 -0
- package/dist/es/ir/path/arrow.d.ts +24 -24
- package/dist/es/ir/path/path.d.ts +860 -204
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +2 -1
- package/dist/es/ir/path/step.d.ts +930 -192
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/target.d.ts +71 -1
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +24 -3
- package/dist/es/ir/scope.d.ts +2095 -335
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +2 -1
- package/dist/es/parsers/index.d.ts +1 -0
- package/dist/es/parsers/index.d.ts.map +1 -1
- package/dist/es/parsers/parseNodeTarget.d.ts +4 -0
- package/dist/es/parsers/parseNodeTarget.d.ts.map +1 -0
- package/dist/es/parsers/parseNodeTarget.js +33 -0
- package/dist/es/parsers/parseTargetSugar.d.ts +4 -2
- package/dist/es/parsers/parseTargetSugar.d.ts.map +1 -1
- package/dist/es/parsers/parseTargetSugar.js +6 -3
- package/dist/es/parsers/parseWay.d.ts +1 -1
- package/dist/es/parsers/parseWay.d.ts.map +1 -1
- package/dist/es/primitive/ellipse.d.ts +3 -5
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/paint.d.ts +24 -0
- package/dist/es/primitive/paint.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +3 -2
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +3 -2
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/scene.d.ts +4 -0
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/es/shapes/circle.d.ts.map +1 -1
- package/dist/es/shapes/circle.js +1 -0
- package/dist/es/shapes/diamond.d.ts.map +1 -1
- package/dist/es/shapes/diamond.js +1 -0
- package/dist/es/shapes/ellipse.d.ts.map +1 -1
- package/dist/es/shapes/ellipse.js +1 -0
- package/dist/es/shapes/rectangle.d.ts.map +1 -1
- package/dist/es/shapes/rectangle.js +1 -0
- package/dist/es/shapes/types.d.ts +8 -2
- package/dist/es/shapes/types.d.ts.map +1 -1
- package/dist/lib/compile/anchor-cache.cjs +25 -0
- package/dist/lib/compile/anchor-cache.d.ts +10 -0
- package/dist/lib/compile/anchor-cache.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +9 -3
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/index.d.ts +0 -1
- package/dist/lib/compile/index.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +159 -28
- package/dist/lib/compile/node.d.ts +19 -4
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/paint.cjs +37 -0
- package/dist/lib/compile/paint.d.ts +16 -0
- package/dist/lib/compile/paint.d.ts.map +1 -0
- package/dist/lib/compile/path/anchor.cjs +16 -17
- package/dist/lib/compile/path/anchor.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +12 -5
- package/dist/lib/compile/path/index.d.ts +3 -0
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/geometry/_edge.cjs +38 -0
- package/dist/lib/geometry/_edge.d.ts +29 -0
- package/dist/lib/geometry/_edge.d.ts.map +1 -0
- package/dist/lib/geometry/circle.cjs +7 -0
- package/dist/lib/geometry/circle.d.ts +3 -0
- package/dist/lib/geometry/circle.d.ts.map +1 -1
- package/dist/lib/geometry/diamond.cjs +29 -0
- package/dist/lib/geometry/diamond.d.ts +3 -0
- package/dist/lib/geometry/diamond.d.ts.map +1 -1
- package/dist/lib/geometry/ellipse.cjs +7 -0
- package/dist/lib/geometry/ellipse.d.ts +3 -0
- package/dist/lib/geometry/ellipse.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +6 -0
- package/dist/lib/geometry/rect.d.ts +3 -0
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/index.cjs +9 -2
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/coordinate.d.ts +2 -2
- package/dist/lib/ir/index.d.ts +1 -0
- package/dist/lib/ir/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +9 -2
- package/dist/lib/ir/node.d.ts +264 -11
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/paint.cjs +54 -0
- package/dist/lib/ir/paint.d.ts +132 -0
- package/dist/lib/ir/paint.d.ts.map +1 -0
- package/dist/lib/ir/path/arrow.d.ts +24 -24
- package/dist/lib/ir/path/path.cjs +2 -1
- package/dist/lib/ir/path/path.d.ts +860 -204
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.d.ts +930 -192
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +25 -2
- package/dist/lib/ir/path/target.d.ts +71 -1
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +2 -1
- package/dist/lib/ir/scope.d.ts +2095 -335
- package/dist/lib/ir/scope.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/parseNodeTarget.cjs +33 -0
- package/dist/lib/parsers/parseNodeTarget.d.ts +4 -0
- package/dist/lib/parsers/parseNodeTarget.d.ts.map +1 -0
- package/dist/lib/parsers/parseTargetSugar.cjs +6 -3
- package/dist/lib/parsers/parseTargetSugar.d.ts +4 -2
- package/dist/lib/parsers/parseTargetSugar.d.ts.map +1 -1
- package/dist/lib/parsers/parseWay.d.ts +1 -1
- package/dist/lib/parsers/parseWay.d.ts.map +1 -1
- package/dist/lib/primitive/ellipse.d.ts +3 -5
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/paint.d.ts +24 -0
- package/dist/lib/primitive/paint.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +3 -2
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +3 -2
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/scene.d.ts +4 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/dist/lib/shapes/circle.cjs +1 -0
- package/dist/lib/shapes/circle.d.ts.map +1 -1
- package/dist/lib/shapes/diamond.cjs +1 -0
- package/dist/lib/shapes/diamond.d.ts.map +1 -1
- package/dist/lib/shapes/ellipse.cjs +1 -0
- package/dist/lib/shapes/ellipse.d.ts.map +1 -1
- package/dist/lib/shapes/rectangle.cjs +1 -0
- package/dist/lib/shapes/rectangle.d.ts.map +1 -1
- package/dist/lib/shapes/types.d.ts +8 -2
- package/dist/lib/shapes/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/es/compile/parseTarget.d.ts +0 -20
- package/dist/es/compile/parseTarget.d.ts.map +0 -1
- package/dist/es/compile/parseTarget.js +0 -36
- package/dist/lib/compile/parseTarget.cjs +0 -36
- package/dist/lib/compile/parseTarget.d.ts +0 -20
- package/dist/lib/compile/parseTarget.d.ts.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Side } from './_edge';
|
|
1
2
|
import { Position } from './point';
|
|
2
3
|
import { RectAnchor } from './rect';
|
|
3
4
|
/** 圆形:几何中心 + 半径,预留旋转字段保持与 Rect 同形 API */
|
|
@@ -19,5 +20,7 @@ export declare const circle: {
|
|
|
19
20
|
anchor: (c: Circle, name: RectAnchor) => Position;
|
|
20
21
|
/** 从圆心向 toward 方向射线与圆周交点(Path 端点贴 Node 边界用) */
|
|
21
22
|
boundaryPoint: (c: Circle, toward: Position) => Position;
|
|
23
|
+
/** 边上比例点:side 的 90° 周长弧段 t∈[0,1] 处(等角,落真实圆周;含旋转) */
|
|
24
|
+
edgePoint: (c: Circle, side: Side, t: number) => Position;
|
|
22
25
|
};
|
|
23
26
|
//# sourceMappingURL=circle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/geometry/circle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/geometry/circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAgB,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAIzC,yCAAyC;AACzC,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS;IACT,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,eAAe;AACf,eAAO,MAAM,MAAM;IACjB,SAAS;gBACG,MAAM,KAAG,QAAQ;IAC7B,oBAAoB;kBACN,MAAM,KAAK,QAAQ,KAAG,OAAO;IAI3C,2BAA2B;gBACf,MAAM,QAAQ,UAAU,KAAG,QAAQ;IAsC/C,+CAA+C;uBAC5B,MAAM,UAAU,QAAQ,KAAG,QAAQ;IAOtD,oDAAoD;mBACrC,MAAM,QAAQ,IAAI,KAAK,MAAM,KAAG,QAAQ;CAIxD,CAAC"}
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
const require__transform = require("./_transform.cjs");
|
|
2
|
+
const require__edge = require("./_edge.cjs");
|
|
2
3
|
//#region src/geometry/diamond.ts
|
|
4
|
+
/** 每条 side 的过顶点折线三 anchor:[邻边中点, cardinal 顶点, 邻边中点](方向 north/south=西→东、east/west=北→南) */
|
|
5
|
+
var DIAMOND_EDGE = {
|
|
6
|
+
north: [
|
|
7
|
+
"north-west",
|
|
8
|
+
"north",
|
|
9
|
+
"north-east"
|
|
10
|
+
],
|
|
11
|
+
south: [
|
|
12
|
+
"south-west",
|
|
13
|
+
"south",
|
|
14
|
+
"south-east"
|
|
15
|
+
],
|
|
16
|
+
east: [
|
|
17
|
+
"north-east",
|
|
18
|
+
"east",
|
|
19
|
+
"south-east"
|
|
20
|
+
],
|
|
21
|
+
west: [
|
|
22
|
+
"north-west",
|
|
23
|
+
"west",
|
|
24
|
+
"south-west"
|
|
25
|
+
]
|
|
26
|
+
};
|
|
3
27
|
/** 菱形相关基础工具 */
|
|
4
28
|
var diamond = {
|
|
5
29
|
/** 中心 */
|
|
@@ -56,6 +80,11 @@ var diamond = {
|
|
|
56
80
|
if (denom === 0) return [d.x, d.y];
|
|
57
81
|
const t = 1 / denom;
|
|
58
82
|
return require__transform.localToWorld(d, [lx * t, ly * t]);
|
|
83
|
+
},
|
|
84
|
+
/** 边上比例点:side 过 cardinal 顶点的两段折线 t∈[0,1] 处(落真实斜边;含旋转) */
|
|
85
|
+
edgePoint: (d, side, t) => {
|
|
86
|
+
const [mid0, vertex, mid1] = DIAMOND_EDGE[side];
|
|
87
|
+
return require__edge.polylineViaVertex(diamond.anchor(d, mid0), diamond.anchor(d, vertex), diamond.anchor(d, mid1), t);
|
|
59
88
|
}
|
|
60
89
|
};
|
|
61
90
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Side } from './_edge';
|
|
1
2
|
import { Position } from './point';
|
|
2
3
|
import { RectAnchor } from './rect';
|
|
3
4
|
/** 菱形:中心 + halfA/halfB 半轴长 + 可选旋转;顶点在 (±halfA,0) 与 (0,±halfB) */
|
|
@@ -24,5 +25,7 @@ export declare const diamond: {
|
|
|
24
25
|
* @description 菱形方程 |x|/halfA + |y|/halfB = 1;沿方向 (lx,ly) 缩放 t 倍命中:t = 1 / (|lx|/halfA + |ly|/halfB)
|
|
25
26
|
*/
|
|
26
27
|
boundaryPoint: (d: Diamond, toward: Position) => Position;
|
|
28
|
+
/** 边上比例点:side 过 cardinal 顶点的两段折线 t∈[0,1] 处(落真实斜边;含旋转) */
|
|
29
|
+
edgePoint: (d: Diamond, side: Side, t: number) => Position;
|
|
27
30
|
};
|
|
28
31
|
//# sourceMappingURL=diamond.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diamond.d.ts","sourceRoot":"","sources":["../../../src/geometry/diamond.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"diamond.d.ts","sourceRoot":"","sources":["../../../src/geometry/diamond.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAqB,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAUzC,iEAAiE;AACjE,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAe;AACf,eAAO,MAAM,OAAO;IAClB,SAAS;gBACG,OAAO,KAAG,QAAQ;IAC9B,oDAAoD;kBACtC,OAAO,KAAK,QAAQ,KAAG,OAAO;IAI5C,sDAAsD;gBAC1C,OAAO,QAAQ,UAAU,KAAG,QAAQ;IAqClD;;;OAGG;uBACkB,OAAO,UAAU,QAAQ,KAAG,QAAQ;IAOvD,yDAAyD;mBAC1C,OAAO,QAAQ,IAAI,KAAK,MAAM,KAAG,QAAQ;CASzD,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const require__transform = require("./_transform.cjs");
|
|
2
|
+
const require__edge = require("./_edge.cjs");
|
|
2
3
|
//#region src/geometry/ellipse.ts
|
|
4
|
+
var DEG_TO_RAD = Math.PI / 180;
|
|
3
5
|
var SQRT_HALF = Math.SQRT1_2;
|
|
4
6
|
/** 椭圆相关基础工具 */
|
|
5
7
|
var ellipse = {
|
|
@@ -61,6 +63,11 @@ var ellipse = {
|
|
|
61
63
|
const b = ly / e.ry;
|
|
62
64
|
const t = 1 / Math.sqrt(a * a + b * b);
|
|
63
65
|
return require__transform.localToWorld(e, [lx * t, ly * t]);
|
|
66
|
+
},
|
|
67
|
+
/** 边上比例点:side 的 90° 周长弧段 t∈[0,1] 处(等角,落真实椭圆周;含旋转) */
|
|
68
|
+
edgePoint: (e, side, t) => {
|
|
69
|
+
const rad = require__edge.edgeAngleDeg(side, t) * DEG_TO_RAD;
|
|
70
|
+
return require__transform.localToWorld(e, [e.rx * Math.cos(rad), e.ry * Math.sin(rad)]);
|
|
64
71
|
}
|
|
65
72
|
};
|
|
66
73
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Side } from './_edge';
|
|
1
2
|
import { Position } from './point';
|
|
2
3
|
import { RectAnchor } from './rect';
|
|
3
4
|
/** 椭圆:中心 + 半长轴 rx / 半短轴 ry + 可选旋转 */
|
|
@@ -27,5 +28,7 @@ export declare const ellipse: {
|
|
|
27
28
|
* @description 椭圆方程 (x/rx)² + (y/ry)² = 1;沿 (lx,ly) 缩放 t 倍命中 t = 1 / √((lx/rx)² + (ly/ry)²)
|
|
28
29
|
*/
|
|
29
30
|
boundaryPoint: (e: Ellipse, toward: Position) => Position;
|
|
31
|
+
/** 边上比例点:side 的 90° 周长弧段 t∈[0,1] 处(等角,落真实椭圆周;含旋转) */
|
|
32
|
+
edgePoint: (e: Ellipse, side: Side, t: number) => Position;
|
|
30
33
|
};
|
|
31
34
|
//# sourceMappingURL=ellipse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/geometry/ellipse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/geometry/ellipse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAgB,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAIzC,qCAAqC;AACrC,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,aAAa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,aAAa;IACb,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,eAAe;AACf,eAAO,MAAM,OAAO;IAClB,SAAS;gBACG,OAAO,KAAG,QAAQ;IAC9B,0BAA0B;kBACZ,OAAO,KAAK,QAAQ,KAAG,OAAO;IAI9C;;;OAGG;gBACW,OAAO,QAAQ,UAAU,KAAG,QAAQ;IAqClD;;;OAGG;uBACkB,OAAO,UAAU,QAAQ,KAAG,QAAQ;IAQvD,qDAAqD;mBACtC,OAAO,QAAQ,IAAI,KAAK,MAAM,KAAG,QAAQ;CAIzD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require__transform = require("./_transform.cjs");
|
|
2
|
+
const require__edge = require("./_edge.cjs");
|
|
2
3
|
//#region src/geometry/rect.ts
|
|
3
4
|
/** 矩形 9 个标准 anchor 名常量(与 RectAnchor 配对,用 RECT_ANCHORS.NORTH 避免拼错) */
|
|
4
5
|
var RECT_ANCHORS = {
|
|
@@ -71,6 +72,11 @@ var rect = {
|
|
|
71
72
|
const ty = localY === 0 ? Infinity : halfH / Math.abs(localY);
|
|
72
73
|
const t = Math.min(tx, ty);
|
|
73
74
|
return require__transform.localToWorld(r, [localX * t, localY * t]);
|
|
75
|
+
},
|
|
76
|
+
/** 边上比例点:side 直边 t∈[0,1] 处(两角 anchor 线性插值,含旋转);方向见 EDGE_ENDS */
|
|
77
|
+
edgePoint: (r, side, t) => {
|
|
78
|
+
const [a, b] = require__edge.EDGE_ENDS[side];
|
|
79
|
+
return require__edge.lerpPoint(rect.anchor(r, a), rect.anchor(r, b), t);
|
|
74
80
|
}
|
|
75
81
|
};
|
|
76
82
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Side } from './_edge';
|
|
1
2
|
import { Position } from './point';
|
|
2
3
|
/** 轴对齐矩形:几何中心 + 宽高 + 可选绕中心旋转 */
|
|
3
4
|
export type Rect = {
|
|
@@ -31,6 +32,8 @@ export declare const rect: {
|
|
|
31
32
|
anchor: (r: Rect, name: RectAnchor) => Position;
|
|
32
33
|
/** 从中心向 toward 方向射线与矩形边界交点(含旋转),Path 端点贴 Node 边界用 */
|
|
33
34
|
boundaryPoint: (r: Rect, toward: Position) => Position;
|
|
35
|
+
/** 边上比例点:side 直边 t∈[0,1] 处(两角 anchor 线性插值,含旋转);方向见 EDGE_ENDS */
|
|
36
|
+
edgePoint: (r: Rect, side: Side, t: number) => Position;
|
|
34
37
|
};
|
|
35
38
|
/** rectOutline 的命令算子(供 compile 翻译为 PathCommand;几何在 core 下沉,便于未来 rectangle node shape 复用) */
|
|
36
39
|
export type RectOutlineOp = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/geometry/rect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,gCAAgC;AAChC,MAAM,MAAM,IAAI,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AAEX,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,IAAI;IACf,WAAW;gBACC,IAAI,KAAG,QAAQ;IAC3B,uBAAuB;kBACT,IAAI,KAAK,QAAQ,KAAG,OAAO;IAMzC,sCAAsC;gBAC1B,IAAI,QAAQ,UAAU,KAAG,QAAQ;IAuC7C,qDAAqD;uBAClC,IAAI,UAAU,QAAQ,KAAG,QAAQ;
|
|
1
|
+
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/geometry/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,IAAI,EAAa,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,gCAAgC;AAChC,MAAM,MAAM,IAAI,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AAEX,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,IAAI;IACf,WAAW;gBACC,IAAI,KAAG,QAAQ;IAC3B,uBAAuB;kBACT,IAAI,KAAK,QAAQ,KAAG,OAAO;IAMzC,sCAAsC;gBAC1B,IAAI,QAAQ,UAAU,KAAG,QAAQ;IAuC7C,qDAAqD;uBAClC,IAAI,UAAU,QAAQ,KAAG,QAAQ;IAUpD,gEAAgE;mBACjD,IAAI,QAAQ,IAAI,KAAK,MAAM,KAAG,QAAQ;CAItD,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,QAAQ,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,QAAQ,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvF;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,iBAAiB,MAAM,KACtB,KAAK,CAAC,aAAa,CAgCrB,CAAC"}
|
package/dist/lib/index.cjs
CHANGED
|
@@ -4,8 +4,11 @@ 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_paint = require("./ir/paint.cjs");
|
|
7
8
|
const require_text = require("./ir/text.cjs");
|
|
8
9
|
const require_arrow = require("./ir/path/arrow.cjs");
|
|
10
|
+
const require__transform = require("./geometry/_transform.cjs");
|
|
11
|
+
const require_rect = require("./geometry/rect.cjs");
|
|
9
12
|
const require_target = require("./ir/path/target.cjs");
|
|
10
13
|
const require_step = require("./ir/path/step.cjs");
|
|
11
14
|
const require_path = require("./ir/path/path.cjs");
|
|
@@ -14,8 +17,6 @@ const require_coordinate = require("./ir/coordinate.cjs");
|
|
|
14
17
|
const require_transform = require("./ir/transform.cjs");
|
|
15
18
|
const require_scope = require("./ir/scope.cjs");
|
|
16
19
|
const require_scene = require("./ir/scene.cjs");
|
|
17
|
-
const require__transform = require("./geometry/_transform.cjs");
|
|
18
|
-
const require_rect = require("./geometry/rect.cjs");
|
|
19
20
|
const require_circle = require("./geometry/circle.cjs");
|
|
20
21
|
const require_ellipse = require("./geometry/ellipse.cjs");
|
|
21
22
|
const require_diamond = require("./geometry/diamond.cjs");
|
|
@@ -23,6 +24,7 @@ const require_index = require("./shapes/index.cjs");
|
|
|
23
24
|
const require_text_metrics = require("./compile/text-metrics.cjs");
|
|
24
25
|
const require_layout = require("./compile/layout.cjs");
|
|
25
26
|
const require_compile = require("./compile/compile.cjs");
|
|
27
|
+
const require_parseNodeTarget = require("./parsers/parseNodeTarget.cjs");
|
|
26
28
|
const require_parseTargetSugar = require("./parsers/parseTargetSugar.cjs");
|
|
27
29
|
const require_parseWay = require("./parsers/parseWay.cjs");
|
|
28
30
|
const require_polar = require("./geometry/polar.cjs");
|
|
@@ -31,6 +33,7 @@ exports.ARROW_MARKER_DEFAULT_SIZE = require_arrow.ARROW_MARKER_DEFAULT_SIZE;
|
|
|
31
33
|
exports.ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH = require_arrow.ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH;
|
|
32
34
|
exports.ARROW_SHAPES = require_arrow.ARROW_SHAPES;
|
|
33
35
|
exports.AT_DIRECTIONS = require_at_position.AT_DIRECTIONS;
|
|
36
|
+
exports.AnchorRefSchema = require_target.AnchorRefSchema;
|
|
34
37
|
exports.ArcStepSchema = require_step.ArcStepSchema;
|
|
35
38
|
exports.ArrowDefaultSchema = require_scope.ArrowDefaultSchema;
|
|
36
39
|
exports.ArrowDetailSchema = require_arrow.ArrowDetailSchema;
|
|
@@ -51,6 +54,7 @@ exports.DrawWay = require_parseWay.DrawWay;
|
|
|
51
54
|
exports.EllipsePathStepSchema = require_step.EllipsePathStepSchema;
|
|
52
55
|
exports.FoldStepSchema = require_step.FoldStepSchema;
|
|
53
56
|
exports.FontSchema = require_font.FontSchema;
|
|
57
|
+
exports.GradientStopSchema = require_paint.GradientStopSchema;
|
|
54
58
|
exports.HOLLOW_ARROW_SHAPES = require_arrow.HOLLOW_ARROW_SHAPES;
|
|
55
59
|
exports.LabelDefaultSchema = require_scope.LabelDefaultSchema;
|
|
56
60
|
exports.LineSpecSchema = require_text.LineSpecSchema;
|
|
@@ -61,7 +65,9 @@ exports.NODE_TEXT_ALIGNS = require_node.NODE_TEXT_ALIGNS;
|
|
|
61
65
|
exports.NodeDefaultSchema = require_scope.NodeDefaultSchema;
|
|
62
66
|
exports.NodeLabelSchema = require_node.NodeLabelSchema;
|
|
63
67
|
exports.NodeSchema = require_node.NodeSchema;
|
|
68
|
+
exports.NodeTargetSchema = require_target.NodeTargetSchema;
|
|
64
69
|
exports.OffsetPositionSchema = require_offset_position.OffsetPositionSchema;
|
|
70
|
+
exports.PaintSpecSchema = require_paint.PaintSpecSchema;
|
|
65
71
|
exports.PathDefaultSchema = require_scope.PathDefaultSchema;
|
|
66
72
|
exports.PathSchema = require_path.PathSchema;
|
|
67
73
|
exports.PolarPositionSchema = require_polar_position.PolarPositionSchema;
|
|
@@ -84,6 +90,7 @@ exports.diamond = require_diamond.diamond;
|
|
|
84
90
|
exports.ellipse = require_ellipse.ellipse;
|
|
85
91
|
exports.fallbackMeasurer = require_text_metrics.fallbackMeasurer;
|
|
86
92
|
exports.localToWorld = require__transform.localToWorld;
|
|
93
|
+
exports.parseNodeTarget = require_parseNodeTarget.parseNodeTarget;
|
|
87
94
|
exports.parseTargetSugar = require_parseTargetSugar.parseTargetSugar;
|
|
88
95
|
exports.parseWay = require_parseWay.parseWay;
|
|
89
96
|
exports.point = require_point.point;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -2,18 +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, 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, 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';
|
|
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, PaintSpecSchema, GradientStopSchema, } 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, IRPaintSpec, IRGradientStop, } from './ir';
|
|
7
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';
|
|
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, } from './primitive';
|
|
13
13
|
export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, CompileWarning, } from './compile';
|
|
14
14
|
export { computeLayout, fallbackMeasurer, compileToScene } from './compile';
|
|
15
15
|
export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayLabelOp, } from './parsers';
|
|
16
|
-
export { parseWay, DrawWay, parseTargetSugar } from './parsers';
|
|
16
|
+
export { parseWay, DrawWay, parseTargetSugar, parseNodeTarget } from './parsers';
|
|
17
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
19
|
export type { ShapeDefinition, ShapeStyle } from './shapes';
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -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,oBAAoB,EACpB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,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,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,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,eAAe,EACf,cAAc,EACd,WAAW,EACX,MAAM,EACN,MAAM,EACN,WAAW,EACX,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,EAAE,EACF,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -39,6 +39,7 @@ export declare const CoordinateSchema: z.ZodObject<{
|
|
|
39
39
|
}>]>;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
41
|
type: "coordinate";
|
|
42
|
+
id: string;
|
|
42
43
|
position: [number, number] | import('./position').PolarPosition | {
|
|
43
44
|
direction: "above" | "below" | "left" | "right" | "above-left" | "above-right" | "below-left" | "below-right";
|
|
44
45
|
of: string;
|
|
@@ -47,9 +48,9 @@ export declare const CoordinateSchema: z.ZodObject<{
|
|
|
47
48
|
of: string | [number, number] | import('./position').PolarPosition;
|
|
48
49
|
offset: [number, number];
|
|
49
50
|
};
|
|
50
|
-
id: string;
|
|
51
51
|
}, {
|
|
52
52
|
type: "coordinate";
|
|
53
|
+
id: string;
|
|
53
54
|
position: [number, number] | import('./position').PolarPosition | {
|
|
54
55
|
direction: "above" | "below" | "left" | "right" | "above-left" | "above-right" | "below-left" | "below-right";
|
|
55
56
|
of: string;
|
|
@@ -58,7 +59,6 @@ export declare const CoordinateSchema: z.ZodObject<{
|
|
|
58
59
|
of: string | [number, number] | import('./position').PolarPosition;
|
|
59
60
|
offset: [number, number];
|
|
60
61
|
};
|
|
61
|
-
id: string;
|
|
62
62
|
}>;
|
|
63
63
|
/** Coordinate IR 类型 `{ type:'coordinate', id, position }` */
|
|
64
64
|
export type IRCoordinate = z.infer<typeof CoordinateSchema>;
|
package/dist/lib/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,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,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"}
|
package/dist/lib/ir/node.cjs
CHANGED
|
@@ -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("
|
|
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."),
|