@retikz/core 0.1.0-beta.1 → 0.1.0-beta.2
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 +3 -3
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +4 -4
- package/dist/es/compile/index.d.ts +1 -1
- package/dist/es/compile/index.d.ts.map +1 -1
- package/dist/es/compile/layout.d.ts +5 -0
- package/dist/es/compile/layout.d.ts.map +1 -0
- package/dist/es/compile/{view-box.js → layout.js} +4 -4
- package/dist/es/compile/node.d.ts +2 -2
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +6 -6
- package/dist/es/compile/path/arrow-geometry.d.ts +22 -0
- package/dist/es/compile/path/arrow-geometry.d.ts.map +1 -0
- package/dist/es/compile/path/arrow-geometry.js +40 -0
- package/dist/es/compile/path/index.js +6 -6
- package/dist/es/compile/path/label.d.ts +1 -1
- package/dist/es/compile/path/label.js +1 -1
- package/dist/es/compile/path/shrink.d.ts +4 -10
- package/dist/es/compile/path/shrink.d.ts.map +1 -1
- package/dist/es/compile/path/shrink.js +10 -20
- package/dist/es/compile/path/split.d.ts +4 -4
- package/dist/es/compile/path/split.d.ts.map +1 -1
- package/dist/es/compile/path/split.js +8 -8
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +2 -1
- package/dist/es/ir/coordinate.d.ts +1 -1
- package/dist/es/ir/coordinate.js +1 -1
- package/dist/es/ir/font.js +1 -1
- package/dist/es/ir/node.d.ts +4 -4
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +2 -2
- package/dist/es/ir/path/arrow.d.ts +2 -2
- package/dist/es/ir/path/arrow.d.ts.map +1 -1
- package/dist/es/ir/path/arrow.js +5 -5
- package/dist/es/ir/path/path.d.ts +3 -3
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +3 -3
- package/dist/es/ir/position/at-position.js +1 -1
- package/dist/es/ir/scene.d.ts +16 -16
- package/dist/es/primitive/ellipse.d.ts +1 -1
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/index.d.ts +1 -1
- package/dist/es/primitive/index.d.ts.map +1 -1
- package/dist/es/primitive/layout.d.ts +12 -0
- package/dist/es/primitive/layout.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +4 -4
- 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 +4 -4
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +4 -4
- package/dist/lib/compile/compile.d.ts +3 -3
- 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/{view-box.cjs → layout.cjs} +4 -4
- package/dist/lib/compile/layout.d.ts +5 -0
- package/dist/lib/compile/layout.d.ts.map +1 -0
- package/dist/lib/compile/node.cjs +6 -6
- package/dist/lib/compile/node.d.ts +2 -2
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/path/arrow-geometry.cjs +41 -0
- package/dist/lib/compile/path/arrow-geometry.d.ts +22 -0
- package/dist/lib/compile/path/arrow-geometry.d.ts.map +1 -0
- package/dist/lib/compile/path/index.cjs +4 -4
- package/dist/lib/compile/path/label.cjs +1 -1
- package/dist/lib/compile/path/label.d.ts +1 -1
- package/dist/lib/compile/path/shrink.cjs +10 -20
- package/dist/lib/compile/path/shrink.d.ts +4 -10
- package/dist/lib/compile/path/shrink.d.ts.map +1 -1
- package/dist/lib/compile/path/split.cjs +8 -8
- package/dist/lib/compile/path/split.d.ts +4 -4
- package/dist/lib/compile/path/split.d.ts.map +1 -1
- package/dist/lib/index.cjs +2 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/coordinate.cjs +1 -1
- package/dist/lib/ir/coordinate.d.ts +1 -1
- package/dist/lib/ir/font.cjs +1 -1
- package/dist/lib/ir/node.cjs +2 -2
- package/dist/lib/ir/node.d.ts +4 -4
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.cjs +5 -5
- package/dist/lib/ir/path/arrow.d.ts +2 -2
- package/dist/lib/ir/path/arrow.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +3 -3
- package/dist/lib/ir/path/path.d.ts +3 -3
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/position/at-position.cjs +1 -1
- package/dist/lib/ir/scene.d.ts +16 -16
- package/dist/lib/primitive/ellipse.d.ts +1 -1
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/index.d.ts +1 -1
- package/dist/lib/primitive/index.d.ts.map +1 -1
- package/dist/lib/primitive/layout.d.ts +12 -0
- package/dist/lib/primitive/layout.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +4 -4
- 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 +4 -4
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/es/compile/view-box.d.ts +0 -5
- package/dist/es/compile/view-box.d.ts.map +0 -1
- package/dist/es/primitive/view-box.d.ts +0 -12
- package/dist/es/primitive/view-box.d.ts.map +0 -1
- package/dist/lib/compile/view-box.d.ts +0 -5
- package/dist/lib/compile/view-box.d.ts.map +0 -1
- package/dist/lib/primitive/view-box.d.ts +0 -12
- package/dist/lib/primitive/view-box.d.ts.map +0 -1
|
@@ -17,11 +17,11 @@ export type CompileWarning = {
|
|
|
17
17
|
export type CompileOptions = {
|
|
18
18
|
/** 注入文字度量函数;不传则用 fallback(不准但可跑) */
|
|
19
19
|
measureText?: TextMeasurer;
|
|
20
|
-
/**
|
|
20
|
+
/** layout 周围的留白(user units),默认 10 */
|
|
21
21
|
padding?: number;
|
|
22
22
|
/**
|
|
23
23
|
* 输出坐标的小数位精度;默认 2
|
|
24
|
-
* @description 仅作用于 Scene primitive / path d /
|
|
24
|
+
* @description 仅作用于 Scene primitive / path d / layout;内部几何计算保持完整 double 精度
|
|
25
25
|
*/
|
|
26
26
|
precision?: number;
|
|
27
27
|
/**
|
|
@@ -37,7 +37,7 @@ export type CompileOptions = {
|
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* IR → Scene 纯函数转换,所有 adapter 共享
|
|
40
|
-
* @description Pass 1 处理 Node/coordinate 并注册 nodeIndex、发 primitive、累积 bbox;Pass 2 解析 Path 端点写 d 字符串;末端按 precision 折算
|
|
40
|
+
* @description Pass 1 处理 Node/coordinate 并注册 nodeIndex、发 primitive、累积 bbox;Pass 2 解析 Path 端点写 d 字符串;末端按 precision 折算 layout
|
|
41
41
|
*/
|
|
42
42
|
export declare const compileToScene: (ir: IR, options?: CompileOptions) => Scene;
|
|
43
43
|
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,cAAc,CAAC;AAK1D,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAuBrE,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,IAAI,EACA,2BAA2B,GAC3B,gBAAgB,GAChB,0BAA0B,GAC1B,wBAAwB,GACxB,yBAAyB,GACzB,sBAAsB,GACtB,8BAA8B,GAC9B,oBAAoB,GACpB,CAAC,MAAM,GAAG,E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,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { emitNodePrimitives, layoutNode } from "./node.js";
|
|
|
4
4
|
import { fallbackMeasurer } from "./text-metrics.js";
|
|
5
5
|
import { emitPathPrimitive } from "./path/index.js";
|
|
6
6
|
import { makeRound } from "./precision.js";
|
|
7
|
-
import {
|
|
7
|
+
import { computeLayout } from "./layout.js";
|
|
8
8
|
//#region src/compile/compile.ts
|
|
9
9
|
/**
|
|
10
10
|
* 把 coordinate 注册成 0×0 NodeLayout
|
|
@@ -38,11 +38,11 @@ var defaultWarnDispatcher = (warning) => {
|
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* IR → Scene 纯函数转换,所有 adapter 共享
|
|
41
|
-
* @description Pass 1 处理 Node/coordinate 并注册 nodeIndex、发 primitive、累积 bbox;Pass 2 解析 Path 端点写 d 字符串;末端按 precision 折算
|
|
41
|
+
* @description Pass 1 处理 Node/coordinate 并注册 nodeIndex、发 primitive、累积 bbox;Pass 2 解析 Path 端点写 d 字符串;末端按 precision 折算 layout
|
|
42
42
|
*/
|
|
43
43
|
var compileToScene = (ir, options = {}) => {
|
|
44
44
|
const measureText = options.measureText ?? fallbackMeasurer;
|
|
45
|
-
const
|
|
45
|
+
const layoutPadding = options.padding ?? 10;
|
|
46
46
|
const round = makeRound(options.precision ?? 2);
|
|
47
47
|
const nodeDistance = options.nodeDistance;
|
|
48
48
|
const onWarn = options.onWarn ?? defaultWarnDispatcher;
|
|
@@ -84,7 +84,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
84
84
|
}
|
|
85
85
|
return {
|
|
86
86
|
primitives,
|
|
87
|
-
|
|
87
|
+
layout: computeLayout(allPoints, layoutPadding, round)
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compile/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compile/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IRPosition } from '../ir';
|
|
2
|
+
import { Layout } from '../primitive';
|
|
3
|
+
/** 由所有 bbox 候选点算出布局边界(含 padding);points 为空时返回 100×100 兜底 */
|
|
4
|
+
export declare const computeLayout: (points: Array<IRPosition>, padding: number, round: (n: number) => number) => Layout;
|
|
5
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/compile/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,4DAA4D;AAC5D,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,CAAC,UAAU,CAAC,EACzB,SAAS,MAAM,EACf,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B,MAkBF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//#region src/compile/
|
|
2
|
-
/** 由所有 bbox
|
|
3
|
-
var
|
|
1
|
+
//#region src/compile/layout.ts
|
|
2
|
+
/** 由所有 bbox 候选点算出布局边界(含 padding);points 为空时返回 100×100 兜底 */
|
|
3
|
+
var computeLayout = (points, padding, round) => {
|
|
4
4
|
if (points.length === 0) return {
|
|
5
5
|
x: 0,
|
|
6
6
|
y: 0,
|
|
@@ -25,4 +25,4 @@ var computeViewBox = (points, padding, round) => {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
//#endregion
|
|
28
|
-
export {
|
|
28
|
+
export { computeLayout };
|
|
@@ -48,8 +48,8 @@ export type NodeLayout = {
|
|
|
48
48
|
strokeOpacity?: number;
|
|
49
49
|
/** 边框宽度,emit 时 1 兜底 */
|
|
50
50
|
strokeWidth?: number;
|
|
51
|
-
/** 描边 dash
|
|
52
|
-
|
|
51
|
+
/** 描边 dash pattern,已把 dashed/dotted 预设解析为具体 pattern */
|
|
52
|
+
dashPattern?: Array<number>;
|
|
53
53
|
/** rectangle 圆角半径(非 rect shape 无效) */
|
|
54
54
|
roundedCorners?: number;
|
|
55
55
|
/** 文字颜色,emit 时 'currentColor' 兜底 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/compile/node.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgCnD,MAAM,MAAM,UAAU,GAAG;IACvB,qBAAqB;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,4DA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
var DEFAULT_LABEL_DISTANCE = 4;
|
|
13
13
|
var SQRT2 = Math.SQRT2;
|
|
14
14
|
/** dashed 预设:4 px 实线 + 2 px 间隙循环 */
|
|
15
|
-
var DASHED_PATTERN =
|
|
15
|
+
var DASHED_PATTERN = [4, 2];
|
|
16
16
|
/** dotted 预设:1 px 圆点 + 2 px 间隙 */
|
|
17
|
-
var DOTTED_PATTERN =
|
|
17
|
+
var DOTTED_PATTERN = [1, 2];
|
|
18
18
|
/** dashed / dotted / dashArray 优先级:dashArray > dashed > dotted */
|
|
19
19
|
var resolveDashArray = (dashArray, dashed, dotted) => {
|
|
20
20
|
if (dashArray !== void 0) return dashArray;
|
|
@@ -259,7 +259,7 @@ var layoutNode = (node, measureText, nodeIndex, nodeDistance) => {
|
|
|
259
259
|
stroke: node.stroke,
|
|
260
260
|
strokeOpacity: node.drawOpacity,
|
|
261
261
|
strokeWidth: node.strokeWidth,
|
|
262
|
-
|
|
262
|
+
dashPattern: resolveDashArray(node.dashArray, node.dashed, node.dotted),
|
|
263
263
|
roundedCorners: node.roundedCorners,
|
|
264
264
|
textColor: node.textColor,
|
|
265
265
|
opacity: node.opacity,
|
|
@@ -281,7 +281,7 @@ var emitRectShape = (layout, round) => {
|
|
|
281
281
|
stroke: layout.stroke ?? "currentColor",
|
|
282
282
|
strokeOpacity: layout.strokeOpacity,
|
|
283
283
|
strokeWidth: layout.strokeWidth ?? 1,
|
|
284
|
-
|
|
284
|
+
dashPattern: layout.dashPattern,
|
|
285
285
|
cornerRadius: layout.roundedCorners,
|
|
286
286
|
opacity: layout.opacity
|
|
287
287
|
};
|
|
@@ -298,7 +298,7 @@ var emitEllipseShape = (layout, round) => ({
|
|
|
298
298
|
stroke: layout.stroke ?? "currentColor",
|
|
299
299
|
strokeOpacity: layout.strokeOpacity,
|
|
300
300
|
strokeWidth: layout.strokeWidth ?? 1,
|
|
301
|
-
|
|
301
|
+
dashPattern: layout.dashPattern,
|
|
302
302
|
opacity: layout.opacity
|
|
303
303
|
});
|
|
304
304
|
/** diamond → PathPrim(4 顶点 + close 闭合) */
|
|
@@ -334,7 +334,7 @@ var emitDiamondShape = (layout, round) => {
|
|
|
334
334
|
stroke: layout.stroke ?? "currentColor",
|
|
335
335
|
strokeOpacity: layout.strokeOpacity,
|
|
336
336
|
strokeWidth: layout.strokeWidth ?? 1,
|
|
337
|
-
|
|
337
|
+
dashPattern: layout.dashPattern,
|
|
338
338
|
opacity: layout.opacity
|
|
339
339
|
};
|
|
340
340
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ArrowShape } from '../../ir';
|
|
2
|
+
import { ArrowEndSpec } from '../../primitive';
|
|
3
|
+
/** 箭头形状几何:供路径端点收缩计算使用 */
|
|
4
|
+
export type ArrowShapeGeometry = {
|
|
5
|
+
/** 标准局部坐标基准尺寸 */
|
|
6
|
+
baseSize: number;
|
|
7
|
+
/** 箭头尖端在标准局部坐标里的 x 位置 */
|
|
8
|
+
tipX: number;
|
|
9
|
+
/** 路径线段应接触箭头尾部或凹口的位置 */
|
|
10
|
+
lineContactX: number;
|
|
11
|
+
/** 默认箭头长度 */
|
|
12
|
+
defaultLength: number;
|
|
13
|
+
/** 默认箭头宽度 */
|
|
14
|
+
defaultWidth: number;
|
|
15
|
+
/** 空心箭头默认描边宽度 */
|
|
16
|
+
hollowLineWidth?: number;
|
|
17
|
+
};
|
|
18
|
+
/** 箭头形状是否为空心描边形状 */
|
|
19
|
+
export declare const isHollowArrowShape: (shape: ArrowShape) => boolean;
|
|
20
|
+
/** 解析端点箭头在标准局部坐标中的中性几何 */
|
|
21
|
+
export declare const resolveArrowShapeGeometry: (spec: ArrowEndSpec) => ArrowShapeGeometry;
|
|
22
|
+
//# sourceMappingURL=arrow-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-geometry.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/arrow-geometry.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,yBAAyB;AACzB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,oBAAoB;AACpB,eAAO,MAAM,kBAAkB,GAAI,OAAO,UAAU,KAAG,OACvB,CAAC;AAEjC,0BAA0B;AAC1B,eAAO,MAAM,yBAAyB,GAAI,MAAM,YAAY,KAAG,kBAgC9D,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HOLLOW_ARROW_SHAPES } from "../../ir/path/arrow.js";
|
|
2
|
+
//#region src/compile/path/arrow-geometry.ts
|
|
3
|
+
/** 标准箭头局部坐标基准尺寸 */
|
|
4
|
+
var ARROW_GEOMETRY_BASE_SIZE = 10;
|
|
5
|
+
/** 箭头形状是否为空心描边形状 */
|
|
6
|
+
var isHollowArrowShape = (shape) => HOLLOW_ARROW_SHAPES.has(shape);
|
|
7
|
+
/** 解析端点箭头在标准局部坐标中的中性几何 */
|
|
8
|
+
var resolveArrowShapeGeometry = (spec) => {
|
|
9
|
+
const lineWidth = spec.lineWidth ?? 1.5;
|
|
10
|
+
const base = {
|
|
11
|
+
baseSize: ARROW_GEOMETRY_BASE_SIZE,
|
|
12
|
+
tipX: ARROW_GEOMETRY_BASE_SIZE,
|
|
13
|
+
lineContactX: 0,
|
|
14
|
+
defaultLength: 6,
|
|
15
|
+
defaultWidth: 6
|
|
16
|
+
};
|
|
17
|
+
switch (spec.shape) {
|
|
18
|
+
case "normal":
|
|
19
|
+
case "diamond":
|
|
20
|
+
case "circle": return base;
|
|
21
|
+
case "stealth": return {
|
|
22
|
+
...base,
|
|
23
|
+
lineContactX: 3
|
|
24
|
+
};
|
|
25
|
+
case "open":
|
|
26
|
+
case "openDiamond": return {
|
|
27
|
+
...base,
|
|
28
|
+
tipX: 9,
|
|
29
|
+
lineContactX: 1 - lineWidth / 2,
|
|
30
|
+
hollowLineWidth: lineWidth
|
|
31
|
+
};
|
|
32
|
+
case "openCircle": return {
|
|
33
|
+
...base,
|
|
34
|
+
lineContactX: 0,
|
|
35
|
+
hollowLineWidth: lineWidth
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { isHollowArrowShape, resolveArrowShapeGeometry };
|
|
@@ -5,8 +5,8 @@ import { fallbackMeasurer } from "../text-metrics.js";
|
|
|
5
5
|
import { clipForTarget, cornerOf, refPointOfTarget, samePoint } from "./anchor.js";
|
|
6
6
|
import { emitLabelPrimitive, tForLabelPosition } from "./label.js";
|
|
7
7
|
import { normalizeRelativeTargets } from "./relative.js";
|
|
8
|
-
import { applyArrowShrinks,
|
|
9
|
-
import {
|
|
8
|
+
import { applyArrowShrinks, computeShrink, endpointArrows } from "./shrink.js";
|
|
9
|
+
import { splitSubPathsForEndpointArrows } from "./split.js";
|
|
10
10
|
//#region src/compile/path/index.ts
|
|
11
11
|
/**
|
|
12
12
|
* 语义 stroke 档位 → 数值(user units)
|
|
@@ -289,16 +289,16 @@ var emitPathPrimitive = (path, nodeIndex, round, measureText = fallbackMeasurer,
|
|
|
289
289
|
strokeWidth,
|
|
290
290
|
fill: path.fill ?? "none",
|
|
291
291
|
fillRule: path.fillRule,
|
|
292
|
-
|
|
292
|
+
dashPattern: path.dashPattern,
|
|
293
293
|
strokeLinecap: path.lineCap,
|
|
294
294
|
strokeLinejoin: path.lineJoin,
|
|
295
295
|
opacity: path.opacity,
|
|
296
296
|
fillOpacity: path.fillOpacity,
|
|
297
297
|
strokeOpacity: path.drawOpacity
|
|
298
298
|
};
|
|
299
|
-
const
|
|
300
|
-
applyArrowShrinks(commands,
|
|
301
|
-
const { primitive } =
|
|
299
|
+
const arrows = endpointArrows(path.arrow, path.arrowDetail);
|
|
300
|
+
applyArrowShrinks(commands, arrows.arrowStart ? computeShrink(arrows.arrowStart) : 0, arrows.arrowEnd ? computeShrink(arrows.arrowEnd) : 0, strokeWidth, round);
|
|
301
|
+
const { primitive } = splitSubPathsForEndpointArrows(commands, baseProps, arrows);
|
|
302
302
|
return {
|
|
303
303
|
primitives: [primitive, ...labelPrims],
|
|
304
304
|
points
|
|
@@ -9,7 +9,7 @@ import { TextMeasurer } from '../text-metrics';
|
|
|
9
9
|
export declare const tForLabelPosition: (pos: IRStepLabel["position"]) => number;
|
|
10
10
|
/**
|
|
11
11
|
* step.label + 段采样 → TextPrim(sloped 时裹一层 group 旋转)
|
|
12
|
-
* @description 默认 side='above'/position='midway':above/below 锚点 y±offset、align=middle、baseline=bottom/top;left/right x±offset、align=end/start、baseline=middle;sloped 不偏移裹 group rotate(angle, cx, cy) 由切线 atan2 算(SVG y-down CW 正)。返回 primitive +
|
|
12
|
+
* @description 默认 side='above'/position='midway':above/below 锚点 y±offset、align=middle、baseline=bottom/top;left/right x±offset、align=end/start、baseline=middle;sloped 不偏移裹 group rotate(angle, cx, cy) 由切线 atan2 算(SVG y-down CW 正)。返回 primitive + layout 外接点
|
|
13
13
|
*/
|
|
14
14
|
export declare const emitLabelPrimitive: (label: IRStepLabel, sample: SegmentSample, measureText: TextMeasurer, round: (n: number) => number) => {
|
|
15
15
|
primitive: ScenePrimitive;
|
|
@@ -25,7 +25,7 @@ var tForLabelPosition = (pos) => {
|
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* step.label + 段采样 → TextPrim(sloped 时裹一层 group 旋转)
|
|
28
|
-
* @description 默认 side='above'/position='midway':above/below 锚点 y±offset、align=middle、baseline=bottom/top;left/right x±offset、align=end/start、baseline=middle;sloped 不偏移裹 group rotate(angle, cx, cy) 由切线 atan2 算(SVG y-down CW 正)。返回 primitive +
|
|
28
|
+
* @description 默认 side='above'/position='midway':above/below 锚点 y±offset、align=middle、baseline=bottom/top;left/right x±offset、align=end/start、baseline=middle;sloped 不偏移裹 group rotate(angle, cx, cy) 由切线 atan2 算(SVG y-down CW 正)。返回 primitive + layout 外接点
|
|
29
29
|
*/
|
|
30
30
|
var emitLabelPrimitive = (label, sample, measureText, round) => {
|
|
31
31
|
const fontSize = LABEL_FONT_SIZE;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { IRArrowDetail } from '../../ir';
|
|
2
2
|
import { ArrowEndSpec, PathCommand } from '../../primitive';
|
|
3
|
-
/** IR path-level `arrow` + `arrowDetail` → PathPrim
|
|
4
|
-
export declare const
|
|
3
|
+
/** IR path-level `arrow` + `arrowDetail` → PathPrim 起末端点箭头规格 */
|
|
4
|
+
export declare const endpointArrows: (arrow: "none" | "->" | "<-" | "<->" | undefined, detail: IRArrowDetail | undefined) => {
|
|
5
5
|
arrowStart?: ArrowEndSpec;
|
|
6
6
|
arrowEnd?: ArrowEndSpec;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* 端点级 shrink(strokeWidth 倍):line
|
|
10
|
-
* @description
|
|
11
|
-
*
|
|
12
|
-
* 几何对齐(必须与 react/render/arrowMarkers.tsx 中 renderInner 的 refX 一致):
|
|
13
|
-
* - `normal` / `diamond` / `circle`:apex 在 viewBox x=10、back 外缘 x=0 → refX=0,shrink = length × scale
|
|
14
|
-
* - `stealth`:apex x=10、V tip x=3(line 嵌进 V 凹口)→ refX=3,shrink = 0.7 × length × scale
|
|
15
|
-
* - `open` / `openDiamond`:apex x=9、back stroke 外缘 x = 1 - lineWidth/2 → refX = 1 - lineWidth/2,shrink = (8 + lineWidth/2) × length × scale / 10
|
|
16
|
-
* - `openCircle`:apex 外缘右 x ≈ 10、back 外缘左 x = 0.75 - lineWidth/2 → refX = 0.75 - lineWidth/2,shrink ≈ length × scale
|
|
9
|
+
* 端点级 shrink(strokeWidth 倍):line 末端朝起点缩这么多,让箭头尖端落回原 target
|
|
10
|
+
* @description 不分实心 / 空心:路径端点接在箭头尾部或凹口,箭头尖端仍贴原 target。低 opacity 下不会再透出 line。
|
|
17
11
|
*/
|
|
18
12
|
export declare const computeShrink: (spec: ArrowEndSpec) => number;
|
|
19
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shrink.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/shrink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shrink.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/shrink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgC,MAAM,UAAU,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAmCjE,gEAAgE;AAChE,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,EAC/C,QAAQ,aAAa,GAAG,SAAS,KAChC;IAAE,UAAU,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;CAatD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,YAAY,KAAG,MAIlD,CAAC;AAiDF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,KAAK,CAAC,WAAW,CAAC,EAC5B,aAAa,MAAM,EACnB,WAAW,MAAM,EACjB,aAAa,MAAM,EACnB,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B,IA4CF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HOLLOW_ARROW_SHAPES } from "../../ir/path/arrow.js";
|
|
2
1
|
import { shiftToward } from "./anchor.js";
|
|
2
|
+
import { isHollowArrowShape, resolveArrowShapeGeometry } from "./arrow-geometry.js";
|
|
3
3
|
//#region src/compile/path/shrink.ts
|
|
4
4
|
/**
|
|
5
5
|
* 端点级 spec:顶层默认 ⊕ end-side override(逐字段 merge)
|
|
@@ -20,14 +20,14 @@ var resolveArrowEndSpec = (topLevel, endSide) => {
|
|
|
20
20
|
if (opacity !== void 0) out.opacity = opacity;
|
|
21
21
|
const lineWidth = endSide?.lineWidth ?? topLevel.lineWidth;
|
|
22
22
|
if (lineWidth !== void 0) out.lineWidth = lineWidth;
|
|
23
|
-
if (!
|
|
23
|
+
if (!isHollowArrowShape(baseShape)) {
|
|
24
24
|
const fill = endSide?.fill ?? topLevel.fill;
|
|
25
25
|
if (fill !== void 0) out.fill = fill;
|
|
26
26
|
}
|
|
27
27
|
return out;
|
|
28
28
|
};
|
|
29
|
-
/** IR path-level `arrow` + `arrowDetail` → PathPrim
|
|
30
|
-
var
|
|
29
|
+
/** IR path-level `arrow` + `arrowDetail` → PathPrim 起末端点箭头规格 */
|
|
30
|
+
var endpointArrows = (arrow, detail) => {
|
|
31
31
|
if (!arrow || arrow === "none") return {};
|
|
32
32
|
const top = detail ?? {};
|
|
33
33
|
const startSpec = resolveArrowEndSpec(top, top.start);
|
|
@@ -42,23 +42,13 @@ var arrowMarkers = (arrow, detail) => {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* 端点级 shrink(strokeWidth 倍):line
|
|
46
|
-
* @description
|
|
47
|
-
*
|
|
48
|
-
* 几何对齐(必须与 react/render/arrowMarkers.tsx 中 renderInner 的 refX 一致):
|
|
49
|
-
* - `normal` / `diamond` / `circle`:apex 在 viewBox x=10、back 外缘 x=0 → refX=0,shrink = length × scale
|
|
50
|
-
* - `stealth`:apex x=10、V tip x=3(line 嵌进 V 凹口)→ refX=3,shrink = 0.7 × length × scale
|
|
51
|
-
* - `open` / `openDiamond`:apex x=9、back stroke 外缘 x = 1 - lineWidth/2 → refX = 1 - lineWidth/2,shrink = (8 + lineWidth/2) × length × scale / 10
|
|
52
|
-
* - `openCircle`:apex 外缘右 x ≈ 10、back 外缘左 x = 0.75 - lineWidth/2 → refX = 0.75 - lineWidth/2,shrink ≈ length × scale
|
|
45
|
+
* 端点级 shrink(strokeWidth 倍):line 末端朝起点缩这么多,让箭头尖端落回原 target
|
|
46
|
+
* @description 不分实心 / 空心:路径端点接在箭头尾部或凹口,箭头尖端仍贴原 target。低 opacity 下不会再透出 line。
|
|
53
47
|
*/
|
|
54
48
|
var computeShrink = (spec) => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return (8 + (spec.lineWidth ?? 1.5) / 2) * length / 10;
|
|
59
|
-
}
|
|
60
|
-
if (spec.shape === "stealth") return 7 * length / 10;
|
|
61
|
-
return length;
|
|
49
|
+
const geometry = resolveArrowShapeGeometry(spec);
|
|
50
|
+
const length = (spec.length ?? geometry.defaultLength) * (spec.scale ?? 1);
|
|
51
|
+
return (geometry.tipX - geometry.lineContactX) * length / geometry.baseSize;
|
|
62
52
|
};
|
|
63
53
|
/** 取一个 PathCommand 末端 endpoint(move/line/quad/cubic → to;arc/ellipseArc → polar(end);close 无端点) */
|
|
64
54
|
var endpointOf = (cmd) => {
|
|
@@ -133,4 +123,4 @@ var applyArrowShrinks = (commands, shrinkStart, shrinkEnd, strokeWidth, round) =
|
|
|
133
123
|
}
|
|
134
124
|
};
|
|
135
125
|
//#endregion
|
|
136
|
-
export { applyArrowShrinks,
|
|
126
|
+
export { applyArrowShrinks, computeShrink, endpointArrows };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ArrowEndSpec, PathCommand, PathPrim, ScenePrimitive } from '../../primitive';
|
|
2
|
-
/** baseProps:除 commands/
|
|
2
|
+
/** baseProps:除 commands / endpoint arrows 外 PathPrim 公共属性集合(多 sub-path 复用) */
|
|
3
3
|
export type PathBaseProps = Omit<PathPrim, 'type' | 'commands' | 'arrowStart' | 'arrowEnd'>;
|
|
4
4
|
/**
|
|
5
|
-
* 多 sub-path +
|
|
6
|
-
* @description
|
|
5
|
+
* 多 sub-path + 有端点箭头:按 sub-path split 成多个 PathPrim
|
|
6
|
+
* @description 端点箭头只属于整条 path 的首端和末端;单 sub-path 或无箭头时直接产一个 PathPrim。
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const splitSubPathsForEndpointArrows: (commands: Array<PathCommand>, baseProps: PathBaseProps, endpointArrows: {
|
|
9
9
|
arrowStart?: ArrowEndSpec;
|
|
10
10
|
arrowEnd?: ArrowEndSpec;
|
|
11
11
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/split.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3F,
|
|
1
|
+
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/split.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3F,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC,CAAC;AAE5F;;;GAGG;AACH,eAAO,MAAM,8BAA8B,GACzC,UAAU,KAAK,CAAC,WAAW,CAAC,EAC5B,WAAW,aAAa,EACxB,gBAAgB;IAAE,UAAU,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;CAAE,KACrE;IAAE,SAAS,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CA2CjD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/compile/path/split.ts
|
|
2
2
|
/**
|
|
3
|
-
* 多 sub-path +
|
|
4
|
-
* @description
|
|
3
|
+
* 多 sub-path + 有端点箭头:按 sub-path split 成多个 PathPrim
|
|
4
|
+
* @description 端点箭头只属于整条 path 的首端和末端;单 sub-path 或无箭头时直接产一个 PathPrim。
|
|
5
5
|
*/
|
|
6
|
-
var
|
|
7
|
-
const hasArrows = !!
|
|
6
|
+
var splitSubPathsForEndpointArrows = (commands, baseProps, endpointArrows) => {
|
|
7
|
+
const hasArrows = !!endpointArrows.arrowStart || !!endpointArrows.arrowEnd;
|
|
8
8
|
const subPathStarts = [];
|
|
9
9
|
commands.forEach((cmd, idx) => {
|
|
10
10
|
if (cmd.kind === "move") subPathStarts.push(idx);
|
|
@@ -14,7 +14,7 @@ var splitSubPathsForMarkers = (commands, baseProps, markers) => {
|
|
|
14
14
|
type: "path",
|
|
15
15
|
commands,
|
|
16
16
|
...baseProps,
|
|
17
|
-
...
|
|
17
|
+
...endpointArrows
|
|
18
18
|
},
|
|
19
19
|
isGrouped: false
|
|
20
20
|
};
|
|
@@ -34,8 +34,8 @@ var splitSubPathsForMarkers = (commands, baseProps, markers) => {
|
|
|
34
34
|
type: "path",
|
|
35
35
|
commands: sub,
|
|
36
36
|
...baseProps,
|
|
37
|
-
...isFirst &&
|
|
38
|
-
...isLast &&
|
|
37
|
+
...isFirst && endpointArrows.arrowStart ? { arrowStart: endpointArrows.arrowStart } : {},
|
|
38
|
+
...isLast && endpointArrows.arrowEnd ? { arrowEnd: endpointArrows.arrowEnd } : {}
|
|
39
39
|
};
|
|
40
40
|
})
|
|
41
41
|
},
|
|
@@ -43,4 +43,4 @@ var splitSubPathsForMarkers = (commands, baseProps, markers) => {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
|
-
export {
|
|
46
|
+
export { splitSubPathsForEndpointArrows };
|
package/dist/es/index.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPri
|
|
|
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,
|
|
12
|
+
TranslateTransform, RotateTransform, ScaleTransform, Layout, Scene, } from './primitive';
|
|
13
13
|
export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, CompileWarning, } from './compile';
|
|
14
|
-
export { fallbackMeasurer, compileToScene } from './compile';
|
|
14
|
+
export { computeLayout, fallbackMeasurer, compileToScene } from './compile';
|
|
15
15
|
export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayLabelOp, } from './parsers';
|
|
16
16
|
export { parseWay, DrawWay, parseTargetSugar } from './parsers';
|
|
17
17
|
export type { Position, Rect, RectAnchor, Circle, Ellipse, Diamond, PolarPosition, } from './geometry';
|
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;;;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,
|
|
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,E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,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
|
@@ -16,9 +16,10 @@ import { circle } from "./geometry/circle.js";
|
|
|
16
16
|
import { diamond } from "./geometry/diamond.js";
|
|
17
17
|
import { ellipse } from "./geometry/ellipse.js";
|
|
18
18
|
import { fallbackMeasurer } from "./compile/text-metrics.js";
|
|
19
|
+
import { computeLayout } from "./compile/layout.js";
|
|
19
20
|
import { compileToScene } from "./compile/compile.js";
|
|
20
21
|
import { parseTargetSugar } from "./parsers/parseTargetSugar.js";
|
|
21
22
|
import { DrawWay, parseWay } from "./parsers/parseWay.js";
|
|
22
23
|
import { polar } from "./geometry/polar.js";
|
|
23
24
|
import { point } from "./geometry/point.js";
|
|
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 };
|
|
25
|
+
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, computeLayout, diamond, ellipse, fallbackMeasurer, parseTargetSugar, parseWay, point, polar, rect };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Coordinate 占位节点(TikZ `\coordinate (m) at (3,2);` 同义)
|
|
4
|
-
* @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与
|
|
4
|
+
* @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 layout 扩展,与 Node 在同一 nodeIndex 注册
|
|
5
5
|
*/
|
|
6
6
|
export declare const CoordinateSchema: z.ZodObject<{
|
|
7
7
|
type: z.ZodLiteral<"coordinate">;
|
package/dist/es/ir/coordinate.js
CHANGED
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
//#region src/ir/coordinate.ts
|
|
7
7
|
/**
|
|
8
8
|
* Coordinate 占位节点(TikZ `\coordinate (m) at (3,2);` 同义)
|
|
9
|
-
* @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与
|
|
9
|
+
* @description 命名一个点供 path/at 引用,不绘制任何图形;支持笛卡尔/极坐标/相对定位三种 position 形态。必须有 id,不参与 layout 扩展,与 Node 在同一 nodeIndex 注册
|
|
10
10
|
*/
|
|
11
11
|
var CoordinateSchema = z.object({
|
|
12
12
|
type: z.literal("coordinate").describe("Discriminator marking this child as a coordinate placeholder"),
|
package/dist/es/ir/font.js
CHANGED
|
@@ -10,6 +10,6 @@ var FontSchema = z.object({
|
|
|
10
10
|
"italic",
|
|
11
11
|
"oblique"
|
|
12
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
|
|
13
|
+
}).describe("Font properties (family / size / weight / style). All fields optional; consumed by Node text / Node label / LineSpec / future TikZ / Scope font defaults.");
|
|
14
14
|
//#endregion
|
|
15
15
|
export { FontSchema };
|
package/dist/es/ir/node.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const NODE_TEXT_ALIGNS: {
|
|
|
21
21
|
export type NodeTextAlign = ValueOf<typeof NODE_TEXT_ALIGNS>;
|
|
22
22
|
/**
|
|
23
23
|
* 节点附属标签 label(TikZ `[label=above:foo]` 同义)
|
|
24
|
-
* @description 可挂多个;label 不参与
|
|
24
|
+
* @description 可挂多个;label 不参与 layout。position 支持 8 方向枚举或数字角度(polar 约定:0°=+x,90°=+y 屏幕下方);默认 position='above',distance=4
|
|
25
25
|
*/
|
|
26
26
|
export declare const NodeLabelSchema: z.ZodObject<{
|
|
27
27
|
text: z.ZodString;
|
|
@@ -176,7 +176,7 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
176
176
|
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
177
177
|
dashed: z.ZodOptional<z.ZodBoolean>;
|
|
178
178
|
dotted: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
-
dashArray: z.ZodOptional<z.
|
|
179
|
+
dashArray: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
180
180
|
roundedCorners: z.ZodOptional<z.ZodNumber>;
|
|
181
181
|
minimumWidth: z.ZodOptional<z.ZodNumber>;
|
|
182
182
|
minimumHeight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -385,7 +385,7 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
385
385
|
lineHeight?: number | undefined;
|
|
386
386
|
dashed?: boolean | undefined;
|
|
387
387
|
dotted?: boolean | undefined;
|
|
388
|
-
dashArray?:
|
|
388
|
+
dashArray?: number[] | undefined;
|
|
389
389
|
roundedCorners?: number | undefined;
|
|
390
390
|
minimumWidth?: number | undefined;
|
|
391
391
|
minimumHeight?: number | undefined;
|
|
@@ -464,7 +464,7 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
464
464
|
lineHeight?: number | undefined;
|
|
465
465
|
dashed?: boolean | undefined;
|
|
466
466
|
dotted?: boolean | undefined;
|
|
467
|
-
dashArray?:
|
|
467
|
+
dashArray?: number[] | undefined;
|
|
468
468
|
roundedCorners?: number | undefined;
|
|
469
469
|
minimumWidth?: number | undefined;
|
|
470
470
|
minimumHeight?: number | undefined;
|
package/dist/es/ir/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ir/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKxC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AA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C;AAEpD,+BAA+B;AAC/B,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCzB,CAAC;AAEJ,uBAAuB;AACvB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE1D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgLpB,CAAC;AAEJ,sCAAsC;AACtC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/es/ir/node.js
CHANGED
|
@@ -24,7 +24,7 @@ var NODE_TEXT_ALIGNS = {
|
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* 节点附属标签 label(TikZ `[label=above:foo]` 同义)
|
|
27
|
-
* @description 可挂多个;label 不参与
|
|
27
|
+
* @description 可挂多个;label 不参与 layout。position 支持 8 方向枚举或数字角度(polar 约定:0°=+x,90°=+y 屏幕下方);默认 position='above',distance=4
|
|
28
28
|
*/
|
|
29
29
|
var NodeLabelSchema = z.object({
|
|
30
30
|
text: z.string().describe("Label text content; rendered as a single line."),
|
|
@@ -55,7 +55,7 @@ var NodeSchema = z.object({
|
|
|
55
55
|
strokeWidth: z.number().optional().describe("Border width in user units; defaults to 1 when omitted"),
|
|
56
56
|
dashed: z.boolean().optional().describe("Border style preset: dashed line (TikZ `dashed`); compiled to a default dash pattern. `dashArray` takes precedence."),
|
|
57
57
|
dotted: z.boolean().optional().describe("Border style preset: dotted line (TikZ `dotted`); compiled to a default dot pattern. `dashArray` and `dashed` take precedence."),
|
|
58
|
-
dashArray: z.
|
|
58
|
+
dashArray: z.array(z.number().finite().nonnegative()).min(1).optional().describe("Explicit stroke dash pattern lengths in user units (e.g. [4, 2]); overrides `dashed` / `dotted`."),
|
|
59
59
|
roundedCorners: z.number().nonnegative().optional().describe("Corner radius in user units; only effective on `rectangle` shape."),
|
|
60
60
|
minimumWidth: z.number().nonnegative().optional().describe("Minimum visual border width in user units; floors the bounding box width."),
|
|
61
61
|
minimumHeight: z.number().nonnegative().optional().describe("Minimum visual border height in user units; floors the bounding box height."),
|
|
@@ -20,9 +20,9 @@ export type ArrowShape = ValueOf<typeof ARROW_SHAPES>;
|
|
|
20
20
|
* @description compile 与 render 都引用此表判定 fill 是否丢弃;空心 shape 用 color 主导描边、lineWidth 控描边粗
|
|
21
21
|
*/
|
|
22
22
|
export declare const HOLLOW_ARROW_SHAPES: Set<ArrowShape>;
|
|
23
|
-
/**
|
|
23
|
+
/** 箭头默认尺寸(length / width 的 fallback) */
|
|
24
24
|
export declare const ARROW_MARKER_DEFAULT_SIZE = 6;
|
|
25
|
-
/** 空心 shape 描边默认粗细(lineWidth fallback
|
|
25
|
+
/** 空心 shape 描边默认粗细(lineWidth fallback) */
|
|
26
26
|
export declare const ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH = 1.5;
|
|
27
27
|
/**
|
|
28
28
|
* 端点级箭头视觉规格 schema
|