@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
|
@@ -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"}
|
|
@@ -289,16 +289,16 @@ var emitPathPrimitive = (path, nodeIndex, round, measureText = require_text_metr
|
|
|
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
|
-
require_shrink.applyArrowShrinks(commands,
|
|
301
|
-
const { primitive } = require_split.
|
|
299
|
+
const arrows = require_shrink.endpointArrows(path.arrow, path.arrowDetail);
|
|
300
|
+
require_shrink.applyArrowShrinks(commands, arrows.arrowStart ? require_shrink.computeShrink(arrows.arrowStart) : 0, arrows.arrowEnd ? require_shrink.computeShrink(arrows.arrowEnd) : 0, strokeWidth, round);
|
|
301
|
+
const { primitive } = require_split.splitSubPathsForEndpointArrows(commands, baseProps, arrows);
|
|
302
302
|
return {
|
|
303
303
|
primitives: [primitive, ...labelPrims],
|
|
304
304
|
points
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_arrow = require("../../ir/path/arrow.cjs");
|
|
2
1
|
const require_anchor = require("./anchor.cjs");
|
|
2
|
+
const require_arrow_geometry = require("./arrow-geometry.cjs");
|
|
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 (!require_arrow_geometry.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 = require_arrow_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) => {
|
|
@@ -134,5 +124,5 @@ var applyArrowShrinks = (commands, shrinkStart, shrinkEnd, strokeWidth, round) =
|
|
|
134
124
|
};
|
|
135
125
|
//#endregion
|
|
136
126
|
exports.applyArrowShrinks = applyArrowShrinks;
|
|
137
|
-
exports.arrowMarkers = arrowMarkers;
|
|
138
127
|
exports.computeShrink = computeShrink;
|
|
128
|
+
exports.endpointArrows = endpointArrows;
|
|
@@ -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,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
|
-
exports.
|
|
46
|
+
exports.splitSubPathsForEndpointArrows = splitSubPathsForEndpointArrows;
|
|
@@ -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"}
|
package/dist/lib/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ const require_circle = require("./geometry/circle.cjs");
|
|
|
17
17
|
const require_diamond = require("./geometry/diamond.cjs");
|
|
18
18
|
const require_ellipse = require("./geometry/ellipse.cjs");
|
|
19
19
|
const require_text_metrics = require("./compile/text-metrics.cjs");
|
|
20
|
+
const require_layout = require("./compile/layout.cjs");
|
|
20
21
|
const require_compile = require("./compile/compile.cjs");
|
|
21
22
|
const require_parseTargetSugar = require("./parsers/parseTargetSugar.cjs");
|
|
22
23
|
const require_parseWay = require("./parsers/parseWay.cjs");
|
|
@@ -65,6 +66,7 @@ exports.TargetSchema = require_target.TargetSchema;
|
|
|
65
66
|
exports.TextBlockSchema = require_text.TextBlockSchema;
|
|
66
67
|
exports.circle = require_circle.circle;
|
|
67
68
|
exports.compileToScene = require_compile.compileToScene;
|
|
69
|
+
exports.computeLayout = require_layout.computeLayout;
|
|
68
70
|
exports.diamond = require_diamond.diamond;
|
|
69
71
|
exports.ellipse = require_ellipse.ellipse;
|
|
70
72
|
exports.fallbackMeasurer = require_text_metrics.fallbackMeasurer;
|
package/dist/lib/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/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,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,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AO,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"}
|
|
@@ -6,7 +6,7 @@ let zod = require("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 = zod.z.object({
|
|
12
12
|
type: zod.z.literal("coordinate").describe("Discriminator marking this child as a coordinate placeholder"),
|
|
@@ -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/lib/ir/font.cjs
CHANGED
|
@@ -10,6 +10,6 @@ var FontSchema = zod.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
|
exports.FontSchema = FontSchema;
|
package/dist/lib/ir/node.cjs
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 = zod.z.object({
|
|
30
30
|
text: zod.z.string().describe("Label text content; rendered as a single line."),
|
|
@@ -55,7 +55,7 @@ var NodeSchema = zod.z.object({
|
|
|
55
55
|
strokeWidth: zod.z.number().optional().describe("Border width in user units; defaults to 1 when omitted"),
|
|
56
56
|
dashed: zod.z.boolean().optional().describe("Border style preset: dashed line (TikZ `dashed`); compiled to a default dash pattern. `dashArray` takes precedence."),
|
|
57
57
|
dotted: zod.z.boolean().optional().describe("Border style preset: dotted line (TikZ `dotted`); compiled to a default dot pattern. `dashArray` and `dashed` take precedence."),
|
|
58
|
-
dashArray: zod.z.
|
|
58
|
+
dashArray: zod.z.array(zod.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: zod.z.number().nonnegative().optional().describe("Corner radius in user units; only effective on `rectangle` shape."),
|
|
60
60
|
minimumWidth: zod.z.number().nonnegative().optional().describe("Minimum visual border width in user units; floors the bounding box width."),
|
|
61
61
|
minimumHeight: zod.z.number().nonnegative().optional().describe("Minimum visual border height in user units; floors the bounding box height."),
|
package/dist/lib/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;
|
|
@@ -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;AAEX,gBAAgB;AAChB,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgLpB,CAAC;AAEJ,sCAAsC;AACtC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -22,9 +22,9 @@ var HOLLOW_ARROW_SHAPES = new Set([
|
|
|
22
22
|
"openDiamond",
|
|
23
23
|
"openCircle"
|
|
24
24
|
]);
|
|
25
|
-
/**
|
|
25
|
+
/** 箭头默认尺寸(length / width 的 fallback) */
|
|
26
26
|
var ARROW_MARKER_DEFAULT_SIZE = 6;
|
|
27
|
-
/** 空心 shape 描边默认粗细(lineWidth fallback
|
|
27
|
+
/** 空心 shape 描边默认粗细(lineWidth fallback) */
|
|
28
28
|
var ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH = 1.5;
|
|
29
29
|
/**
|
|
30
30
|
* 端点级箭头视觉规格 schema
|
|
@@ -33,9 +33,9 @@ var ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH = 1.5;
|
|
|
33
33
|
var ArrowEndDetailSchema = zod.z.object({
|
|
34
34
|
shape: zod.z.nativeEnum(ARROW_SHAPES).optional().describe("Arrow tip shape. Defaults to `normal` (filled triangle). Other values: `open` (hollow triangle), `stealth` (sharp barb), `diamond`, `openDiamond`, `circle`, `openCircle`."),
|
|
35
35
|
scale: zod.z.number().positive().optional().describe("Uniform tip scale factor; multiplies `length` and `width` (e.g. `length=10, scale=1.5` → effective 15). Defaults to 1."),
|
|
36
|
-
length: zod.z.number().nonnegative().optional().describe("Tip length in user units (the dimension along the path direction). Defaults to ~6
|
|
37
|
-
width: zod.z.number().nonnegative().optional().describe("Tip width in user units (perpendicular to the path). Defaults to ~6
|
|
38
|
-
color: zod.z.string().optional().describe("Stroke color override. When omitted, the
|
|
36
|
+
length: zod.z.number().nonnegative().optional().describe("Tip length in user units (the dimension along the path direction). Defaults to ~6."),
|
|
37
|
+
width: zod.z.number().nonnegative().optional().describe("Tip width in user units (perpendicular to the path). Defaults to ~6."),
|
|
38
|
+
color: zod.z.string().optional().describe("Stroke color override. When omitted, the renderer should inherit the path stroke."),
|
|
39
39
|
fill: zod.z.string().optional().describe("Fill color override (effective only on solid shapes). Hollow shapes (`open` / `openDiamond` / `openCircle`) silently ignore this field — `color` drives the stroke."),
|
|
40
40
|
opacity: zod.z.number().min(0).max(1).optional().describe("Arrow opacity 0..1, independent from the path opacity. When omitted, inherits the path opacity."),
|
|
41
41
|
lineWidth: zod.z.number().nonnegative().optional().describe("Stroke width for hollow shapes (user units). Defaults to 1.5. Solid shapes ignore this field.")
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/arrow.ts"],"names":[],"mappings":"A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AmB;AACnB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ var PathSchema = zod.z.object({
|
|
|
6
6
|
type: zod.z.literal("path").describe("Discriminator marking this child as a path"),
|
|
7
7
|
stroke: zod.z.string().optional().describe("Stroke color of the path; any CSS color. Defaults to currentColor when omitted"),
|
|
8
8
|
strokeWidth: zod.z.number().optional().describe("Stroke width in user units; defaults to 1 when omitted"),
|
|
9
|
-
|
|
9
|
+
dashPattern: zod.z.array(zod.z.number().finite().nonnegative()).min(1).optional().describe("Stroke dash pattern lengths in user units (e.g. [4, 2]); omitted means solid line"),
|
|
10
10
|
arrow: zod.z.enum([
|
|
11
11
|
"none",
|
|
12
12
|
"->",
|
|
@@ -20,12 +20,12 @@ var PathSchema = zod.z.object({
|
|
|
20
20
|
"butt",
|
|
21
21
|
"round",
|
|
22
22
|
"square"
|
|
23
|
-
]).optional().describe("Stroke endpoint shape (`butt` / `round` / `square`;
|
|
23
|
+
]).optional().describe("Stroke endpoint shape (`butt` / `round` / `square`; matches TikZ `line cap`). Default `butt` (sharp end); `round` adds a half-disc cap; `square` extends a half-stroke past the endpoint."),
|
|
24
24
|
lineJoin: zod.z.enum([
|
|
25
25
|
"miter",
|
|
26
26
|
"round",
|
|
27
27
|
"bevel"
|
|
28
|
-
]).optional().describe("Stroke corner shape (`miter` / `round` / `bevel`;
|
|
28
|
+
]).optional().describe("Stroke corner shape (`miter` / `round` / `bevel`; matches TikZ `line join`). Default `miter` (sharp corner); `round` rounds the join; `bevel` cuts the corner flat."),
|
|
29
29
|
thickness: zod.z.enum([
|
|
30
30
|
"ultraThin",
|
|
31
31
|
"veryThin",
|
|
@@ -3,7 +3,7 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
3
3
|
type: z.ZodLiteral<"path">;
|
|
4
4
|
stroke: z.ZodOptional<z.ZodString>;
|
|
5
5
|
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
6
|
-
|
|
6
|
+
dashPattern: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
7
7
|
arrow: z.ZodOptional<z.ZodEnum<["none", "->", "<-", "<->"]>>;
|
|
8
8
|
arrowDetail: z.ZodOptional<z.ZodObject<{
|
|
9
9
|
shape: z.ZodOptional<z.ZodNativeEnum<{
|
|
@@ -838,7 +838,7 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
838
838
|
opacity?: number | undefined;
|
|
839
839
|
stroke?: string | undefined;
|
|
840
840
|
strokeWidth?: number | undefined;
|
|
841
|
-
|
|
841
|
+
dashPattern?: number[] | undefined;
|
|
842
842
|
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
843
843
|
arrowDetail?: {
|
|
844
844
|
length?: number | undefined;
|
|
@@ -1013,7 +1013,7 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
1013
1013
|
opacity?: number | undefined;
|
|
1014
1014
|
stroke?: string | undefined;
|
|
1015
1015
|
strokeWidth?: number | undefined;
|
|
1016
|
-
|
|
1016
|
+
dashPattern?: number[] | undefined;
|
|
1017
1017
|
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
1018
1018
|
arrowDetail?: {
|
|
1019
1019
|
length?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -17,7 +17,7 @@ var AT_DIRECTIONS = {
|
|
|
17
17
|
var AtPositionSchema = zod.z.object({
|
|
18
18
|
direction: zod.z.nativeEnum(AT_DIRECTIONS).describe("Direction from the referenced node toward this node, in visual convention (above = visually upward, screen y-)."),
|
|
19
19
|
of: zod.z.string().min(1).describe("Id of the referenced node or coordinate; must be defined earlier in the IR (forward references rejected, mirroring polar `origin` and string targets)."),
|
|
20
|
-
distance: zod.z.number().positive().optional().describe("Distance from the referenced node center to this node center in user units. Falls back to the
|
|
20
|
+
distance: zod.z.number().positive().optional().describe("Distance from the referenced node center to this node center in user units. Falls back to the TikZ `nodeDistance` compile-time context, then to 1.")
|
|
21
21
|
}).describe("Relative position: place this node at `direction` direction from `of`, `distance` away. Mirrors TikZ `[<direction>=<distance> of <id>]` from the positioning library.");
|
|
22
22
|
//#endregion
|
|
23
23
|
exports.AT_DIRECTIONS = AT_DIRECTIONS;
|