@retikz/core 0.1.0-alpha.2 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/compile/compile.js +3 -3
- package/dist/es/compile/path.d.ts +3 -2
- package/dist/es/compile/path.d.ts.map +1 -1
- package/dist/es/compile/path.js +333 -14
- package/dist/es/geometry/arc.d.ts +34 -0
- package/dist/es/geometry/arc.d.ts.map +1 -0
- package/dist/es/geometry/arc.js +53 -0
- package/dist/es/geometry/bend.d.ts +18 -0
- package/dist/es/geometry/bend.d.ts.map +1 -0
- package/dist/es/geometry/bend.js +29 -0
- package/dist/es/geometry/index.d.ts +3 -0
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/geometry/segment.d.ts +38 -0
- package/dist/es/geometry/segment.d.ts.map +1 -0
- package/dist/es/geometry/segment.js +82 -0
- package/dist/es/index.d.ts +4 -4
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +4 -3
- package/dist/es/ir/node.d.ts +12 -12
- package/dist/es/ir/path/path.d.ts +625 -15
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +22 -0
- package/dist/es/ir/path/step.d.ts +872 -20
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +86 -4
- package/dist/es/ir/path/target.d.ts +32 -2
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +7 -3
- package/dist/es/ir/scene.d.ts +1496 -72
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/parsers/index.d.ts +1 -0
- package/dist/es/parsers/index.d.ts.map +1 -1
- package/dist/es/parsers/parseTargetSugar.d.ts +3 -0
- package/dist/es/parsers/parseTargetSugar.d.ts.map +1 -0
- package/dist/es/parsers/parseTargetSugar.js +31 -0
- package/dist/es/parsers/parseWay.d.ts +131 -22
- package/dist/es/parsers/parseWay.d.ts.map +1 -1
- package/dist/es/parsers/parseWay.js +149 -17
- package/dist/lib/compile/compile.cjs +3 -3
- package/dist/lib/compile/path.cjs +333 -14
- package/dist/lib/compile/path.d.ts +3 -2
- package/dist/lib/compile/path.d.ts.map +1 -1
- package/dist/lib/geometry/arc.cjs +55 -0
- package/dist/lib/geometry/arc.d.ts +34 -0
- package/dist/lib/geometry/arc.d.ts.map +1 -0
- package/dist/lib/geometry/bend.cjs +29 -0
- package/dist/lib/geometry/bend.d.ts +18 -0
- package/dist/lib/geometry/bend.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +3 -0
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/geometry/segment.cjs +88 -0
- package/dist/lib/geometry/segment.d.ts +38 -0
- package/dist/lib/geometry/segment.d.ts.map +1 -0
- package/dist/lib/index.cjs +12 -0
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/node.d.ts +12 -12
- package/dist/lib/ir/path/path.cjs +22 -0
- package/dist/lib/ir/path/path.d.ts +625 -15
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +93 -3
- package/dist/lib/ir/path/step.d.ts +872 -20
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +8 -2
- package/dist/lib/ir/path/target.d.ts +32 -2
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/scene.d.ts +1496 -72
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/parsers/index.d.ts +1 -0
- package/dist/lib/parsers/index.d.ts.map +1 -1
- package/dist/lib/parsers/parseTargetSugar.cjs +31 -0
- package/dist/lib/parsers/parseTargetSugar.d.ts +3 -0
- package/dist/lib/parsers/parseTargetSugar.d.ts.map +1 -0
- package/dist/lib/parsers/parseWay.cjs +149 -17
- package/dist/lib/parsers/parseWay.d.ts +131 -22
- package/dist/lib/parsers/parseWay.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region src/geometry/segment.ts
|
|
2
|
+
var DEG_TO_RAD = Math.PI / 180;
|
|
3
|
+
var normalize = (v) => {
|
|
4
|
+
const len = Math.hypot(v[0], v[1]);
|
|
5
|
+
if (len === 0) return [1, 0];
|
|
6
|
+
return [v[0] / len, v[1] / len];
|
|
7
|
+
};
|
|
8
|
+
/** 直线段 from → to */
|
|
9
|
+
var lineSegmentSample = (from, to, t) => ({
|
|
10
|
+
point: [from[0] + (to[0] - from[0]) * t, from[1] + (to[1] - from[1]) * t],
|
|
11
|
+
tangent: normalize([to[0] - from[0], to[1] - from[1]])
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* 二次贝塞尔 from → control → to。
|
|
15
|
+
* P(t) = (1-t)²·P0 + 2(1-t)t·P1 + t²·P2
|
|
16
|
+
* P'(t) = 2(1-t)(P1-P0) + 2t(P2-P1)
|
|
17
|
+
*/
|
|
18
|
+
var quadSegmentSample = (from, control, to, t) => {
|
|
19
|
+
const u = 1 - t;
|
|
20
|
+
return {
|
|
21
|
+
point: [u * u * from[0] + 2 * u * t * control[0] + t * t * to[0], u * u * from[1] + 2 * u * t * control[1] + t * t * to[1]],
|
|
22
|
+
tangent: normalize([2 * u * (control[0] - from[0]) + 2 * t * (to[0] - control[0]), 2 * u * (control[1] - from[1]) + 2 * t * (to[1] - control[1])])
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 三次贝塞尔 from → c1 → c2 → to。
|
|
27
|
+
* P'(t) = 3(1-t)²(P1-P0) + 6(1-t)t(P2-P1) + 3t²(P3-P2)
|
|
28
|
+
*/
|
|
29
|
+
var cubicSegmentSample = (from, c1, c2, to, t) => {
|
|
30
|
+
const u = 1 - t;
|
|
31
|
+
return {
|
|
32
|
+
point: [u * u * u * from[0] + 3 * u * u * t * c1[0] + 3 * u * t * t * c2[0] + t * t * t * to[0], u * u * u * from[1] + 3 * u * u * t * c1[1] + 3 * u * t * t * c2[1] + t * t * t * to[1]],
|
|
33
|
+
tangent: normalize([3 * u * u * (c1[0] - from[0]) + 6 * u * t * (c2[0] - c1[0]) + 3 * t * t * (to[0] - c2[0]), 3 * u * u * (c1[1] - from[1]) + 6 * u * t * (c2[1] - c1[1]) + 3 * t * t * (to[1] - c2[1])])
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 折角段 from → corner → to。
|
|
38
|
+
* t∈[0, 0.5] 走第一段(参数 2t);t∈(0.5, 1] 走第二段(参数 2t-1)。
|
|
39
|
+
* t=0.5 落在 corner,切线取第一段方向(与"靠近 prev 一侧"一致)。
|
|
40
|
+
*/
|
|
41
|
+
var foldSegmentSample = (from, corner, to, t) => {
|
|
42
|
+
if (t <= .5) return lineSegmentSample(from, corner, t * 2);
|
|
43
|
+
return lineSegmentSample(corner, to, t * 2 - 1);
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* 弧段(与 ir/path arc 同约定,角度单位为度)。
|
|
47
|
+
* 切线沿"扫描方向"——endAngle ≥ startAngle 时为 (-sin, cos),否则反向。
|
|
48
|
+
*/
|
|
49
|
+
var arcSegmentSample = (center, radius, startAngleDeg, endAngleDeg, t) => {
|
|
50
|
+
const rad = (startAngleDeg + t * (endAngleDeg - startAngleDeg)) * DEG_TO_RAD;
|
|
51
|
+
const cos = Math.cos(rad);
|
|
52
|
+
const sin = Math.sin(rad);
|
|
53
|
+
const sweepSign = endAngleDeg >= startAngleDeg ? 1 : -1;
|
|
54
|
+
return {
|
|
55
|
+
point: [center[0] + radius * cos, center[1] + radius * sin],
|
|
56
|
+
tangent: normalize([-sin * sweepSign, cos * sweepSign])
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* 整圆——从 0°(east)开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致。
|
|
61
|
+
*/
|
|
62
|
+
var circleSegmentSample = (center, radius, t) => {
|
|
63
|
+
const rad = t * 360 * DEG_TO_RAD;
|
|
64
|
+
const cos = Math.cos(rad);
|
|
65
|
+
const sin = Math.sin(rad);
|
|
66
|
+
return {
|
|
67
|
+
point: [center[0] + radius * cos, center[1] + radius * sin],
|
|
68
|
+
tangent: normalize([-sin, cos])
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** 整椭圆——参数化 (rx·cos(2πt), ry·sin(2πt)) */
|
|
72
|
+
var ellipseSegmentSample = (center, rx, ry, t) => {
|
|
73
|
+
const rad = t * 360 * DEG_TO_RAD;
|
|
74
|
+
const cos = Math.cos(rad);
|
|
75
|
+
const sin = Math.sin(rad);
|
|
76
|
+
return {
|
|
77
|
+
point: [center[0] + rx * cos, center[1] + ry * sin],
|
|
78
|
+
tangent: normalize([-rx * sin, ry * cos])
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.arcSegmentSample = arcSegmentSample;
|
|
83
|
+
exports.circleSegmentSample = circleSegmentSample;
|
|
84
|
+
exports.cubicSegmentSample = cubicSegmentSample;
|
|
85
|
+
exports.ellipseSegmentSample = ellipseSegmentSample;
|
|
86
|
+
exports.foldSegmentSample = foldSegmentSample;
|
|
87
|
+
exports.lineSegmentSample = lineSegmentSample;
|
|
88
|
+
exports.quadSegmentSample = quadSegmentSample;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Position } from './point';
|
|
2
|
+
export type SegmentSample = {
|
|
3
|
+
/** t 处的点坐标 */
|
|
4
|
+
point: Position;
|
|
5
|
+
/** t 处的切线方向(单位向量;零向量时回退到 [1, 0]) */
|
|
6
|
+
tangent: Position;
|
|
7
|
+
};
|
|
8
|
+
/** 直线段 from → to */
|
|
9
|
+
export declare const lineSegmentSample: (from: Position, to: Position, t: number) => SegmentSample;
|
|
10
|
+
/**
|
|
11
|
+
* 二次贝塞尔 from → control → to。
|
|
12
|
+
* P(t) = (1-t)²·P0 + 2(1-t)t·P1 + t²·P2
|
|
13
|
+
* P'(t) = 2(1-t)(P1-P0) + 2t(P2-P1)
|
|
14
|
+
*/
|
|
15
|
+
export declare const quadSegmentSample: (from: Position, control: Position, to: Position, t: number) => SegmentSample;
|
|
16
|
+
/**
|
|
17
|
+
* 三次贝塞尔 from → c1 → c2 → to。
|
|
18
|
+
* P'(t) = 3(1-t)²(P1-P0) + 6(1-t)t(P2-P1) + 3t²(P3-P2)
|
|
19
|
+
*/
|
|
20
|
+
export declare const cubicSegmentSample: (from: Position, c1: Position, c2: Position, to: Position, t: number) => SegmentSample;
|
|
21
|
+
/**
|
|
22
|
+
* 折角段 from → corner → to。
|
|
23
|
+
* t∈[0, 0.5] 走第一段(参数 2t);t∈(0.5, 1] 走第二段(参数 2t-1)。
|
|
24
|
+
* t=0.5 落在 corner,切线取第一段方向(与"靠近 prev 一侧"一致)。
|
|
25
|
+
*/
|
|
26
|
+
export declare const foldSegmentSample: (from: Position, corner: Position, to: Position, t: number) => SegmentSample;
|
|
27
|
+
/**
|
|
28
|
+
* 弧段(与 ir/path arc 同约定,角度单位为度)。
|
|
29
|
+
* 切线沿"扫描方向"——endAngle ≥ startAngle 时为 (-sin, cos),否则反向。
|
|
30
|
+
*/
|
|
31
|
+
export declare const arcSegmentSample: (center: Position, radius: number, startAngleDeg: number, endAngleDeg: number, t: number) => SegmentSample;
|
|
32
|
+
/**
|
|
33
|
+
* 整圆——从 0°(east)开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致。
|
|
34
|
+
*/
|
|
35
|
+
export declare const circleSegmentSample: (center: Position, radius: number, t: number) => SegmentSample;
|
|
36
|
+
/** 整椭圆——参数化 (rx·cos(2πt), ry·sin(2πt)) */
|
|
37
|
+
export declare const ellipseSegmentSample: (center: Position, rx: number, ry: number, t: number) => SegmentSample;
|
|
38
|
+
//# sourceMappingURL=segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAuBxC,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc;IACd,KAAK,EAAE,QAAQ,CAAC;IAChB,oCAAoC;IACpC,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;AAQF,oBAAoB;AACpB,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aAGD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,SAAS,QAAQ,EACjB,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aASF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,QAAQ,EACd,IAAI,QAAQ,EACZ,IAAI,QAAQ,EACZ,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aAqBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,QAAQ,QAAQ,EAChB,IAAI,QAAQ,EACZ,GAAG,MAAM,KACR,aAGF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,aAAa,MAAM,EACnB,GAAG,MAAM,KACR,aAUF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,GAAG,MAAM,KACR,aASF,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,QAAQ,EAChB,IAAI,MAAM,EACV,IAAI,MAAM,EACV,GAAG,MAAM,KACR,aASF,CAAC"}
|
package/dist/lib/index.cjs
CHANGED
|
@@ -13,14 +13,22 @@ const require_diamond = require("./geometry/diamond.cjs");
|
|
|
13
13
|
const require_ellipse = require("./geometry/ellipse.cjs");
|
|
14
14
|
const require_text_metrics = require("./compile/text-metrics.cjs");
|
|
15
15
|
const require_compile = require("./compile/compile.cjs");
|
|
16
|
+
const require_parseTargetSugar = require("./parsers/parseTargetSugar.cjs");
|
|
16
17
|
const require_parseWay = require("./parsers/parseWay.cjs");
|
|
17
18
|
const require_polar = require("./geometry/polar.cjs");
|
|
18
19
|
const require_point = require("./geometry/point.cjs");
|
|
19
20
|
exports.ARROW_SHAPES = require_arrow.ARROW_SHAPES;
|
|
21
|
+
exports.ArcStepSchema = require_step.ArcStepSchema;
|
|
22
|
+
exports.BendStepSchema = require_step.BendStepSchema;
|
|
20
23
|
exports.CURRENT_IR_VERSION = require_scene.CURRENT_IR_VERSION;
|
|
21
24
|
exports.ChildSchema = require_scene.ChildSchema;
|
|
25
|
+
exports.CirclePathStepSchema = require_step.CirclePathStepSchema;
|
|
26
|
+
exports.ControlPointSchema = require_step.ControlPointSchema;
|
|
27
|
+
exports.CubicStepSchema = require_step.CubicStepSchema;
|
|
28
|
+
exports.CurveStepSchema = require_step.CurveStepSchema;
|
|
22
29
|
exports.CycleStepSchema = require_step.CycleStepSchema;
|
|
23
30
|
exports.DrawWay = require_parseWay.DrawWay;
|
|
31
|
+
exports.EllipsePathStepSchema = require_step.EllipsePathStepSchema;
|
|
24
32
|
exports.FoldStepSchema = require_step.FoldStepSchema;
|
|
25
33
|
exports.FontSchema = require_node.FontSchema;
|
|
26
34
|
exports.LineSpecSchema = require_node.LineSpecSchema;
|
|
@@ -34,7 +42,10 @@ exports.PathSchema = require_path.PathSchema;
|
|
|
34
42
|
exports.PolarPositionSchema = require_polar_position.PolarPositionSchema;
|
|
35
43
|
exports.PositionSchema = require_position.PositionSchema;
|
|
36
44
|
exports.RECT_ANCHORS = require_rect.RECT_ANCHORS;
|
|
45
|
+
exports.RelAccumulateTargetSchema = require_target.RelAccumulateTargetSchema;
|
|
46
|
+
exports.RelTargetSchema = require_target.RelTargetSchema;
|
|
37
47
|
exports.SceneSchema = require_scene.SceneSchema;
|
|
48
|
+
exports.StepLabelSchema = require_step.StepLabelSchema;
|
|
38
49
|
exports.StepSchema = require_step.StepSchema;
|
|
39
50
|
exports.TargetSchema = require_target.TargetSchema;
|
|
40
51
|
exports.circle = require_circle.circle;
|
|
@@ -42,6 +53,7 @@ exports.compileToScene = require_compile.compileToScene;
|
|
|
42
53
|
exports.diamond = require_diamond.diamond;
|
|
43
54
|
exports.ellipse = require_ellipse.ellipse;
|
|
44
55
|
exports.fallbackMeasurer = require_text_metrics.fallbackMeasurer;
|
|
56
|
+
exports.parseTargetSugar = require_parseTargetSugar.parseTargetSugar;
|
|
45
57
|
exports.parseWay = require_parseWay.parseWay;
|
|
46
58
|
exports.point = require_point.point;
|
|
47
59
|
exports.polar = require_polar.polar;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 本包零 React、零 DOM 依赖。
|
|
8
8
|
*/
|
|
9
|
-
export { PositionSchema, PolarPositionSchema, TargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, StepSchema, NodeSchema, FontSchema, NodeTextSchema, LineSpecSchema, PathSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
10
|
-
export type { IRPosition, IRTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRStep, IRNode, IRFont, IRLineSpec, IRPath, IRChild, IR, ArrowShape, NodeShape, NodeTextAlign, } from './ir';
|
|
9
|
+
export { PositionSchema, PolarPositionSchema, TargetSchema, RelTargetSchema, RelAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, FontSchema, NodeTextSchema, LineSpecSchema, PathSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
10
|
+
export type { IRPosition, IRTarget, IRRelTarget, IRRelAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRFont, IRLineSpec, IRPath, IRChild, IR, ArrowShape, NodeShape, NodeTextAlign, } from './ir';
|
|
11
11
|
export { ARROW_SHAPES, NODE_SHAPES, NODE_TEXT_ALIGNS } from './ir';
|
|
12
12
|
export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, GroupPrim, ViewBox, Scene, } from './primitive';
|
|
13
13
|
export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, } from './compile';
|
|
14
14
|
export { fallbackMeasurer, compileToScene } from './compile';
|
|
15
|
-
export type { WayItem, WayDSL, WayCycle, WayVia } from './parsers';
|
|
16
|
-
export { parseWay, DrawWay } from './parsers';
|
|
15
|
+
export type { WayItem, WayDSL, WayCycle, WayVia, WayRelItem, WayLabel, WayLabelOp, } from './parsers';
|
|
16
|
+
export { parseWay, DrawWay, parseTargetSugar } from './parsers';
|
|
17
17
|
export type { Position, Rect, RectAnchor, Circle, CircleAnchor, Ellipse, EllipseAnchor, Diamond, DiamondAnchor, PolarPosition, } from './geometry';
|
|
18
18
|
export { point, rect, circle, ellipse, diamond, RECT_ANCHORS, polar } from './geometry';
|
|
19
19
|
export type { ValueOf } from './types';
|
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;;;;;;;GAOG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,MAAM,EACN,OAAO,EACP,EAAE,EACF,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAGnE,YAAY,EACV,cAAc,EACd,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,KAAK,GACN,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG7D,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,yBAAyB,EACzB,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,UAAU,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,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,MAAM,EACN,UAAU,EACV,MAAM,EACN,OAAO,EACP,EAAE,EACF,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAGnE,YAAY,EACV,cAAc,EACd,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,KAAK,GACN,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG7D,YAAY,EACV,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,UAAU,EACV,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,YAAY,EACZ,OAAO,EACP,aAAa,EACb,OAAO,EACP,aAAa,EACb,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,MAAM,SAAS,CAAC"}
|
package/dist/lib/ir/node.d.ts
CHANGED
|
@@ -257,9 +257,6 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
257
257
|
type: "node";
|
|
258
258
|
position: [number, number] | import('./position').PolarPosition;
|
|
259
259
|
fill?: string | undefined;
|
|
260
|
-
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
261
|
-
stroke?: string | undefined;
|
|
262
|
-
strokeWidth?: number | undefined;
|
|
263
260
|
text?: string | (string | {
|
|
264
261
|
text: string;
|
|
265
262
|
fill?: string | undefined;
|
|
@@ -271,7 +268,12 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
271
268
|
style?: "normal" | "italic" | "oblique" | undefined;
|
|
272
269
|
} | undefined;
|
|
273
270
|
})[] | undefined;
|
|
271
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
272
|
+
stroke?: string | undefined;
|
|
273
|
+
strokeWidth?: number | undefined;
|
|
274
274
|
opacity?: number | undefined;
|
|
275
|
+
fillOpacity?: number | undefined;
|
|
276
|
+
drawOpacity?: number | undefined;
|
|
275
277
|
font?: {
|
|
276
278
|
family?: string | undefined;
|
|
277
279
|
size?: number | undefined;
|
|
@@ -280,10 +282,8 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
280
282
|
} | undefined;
|
|
281
283
|
id?: string | undefined;
|
|
282
284
|
rotate?: number | undefined;
|
|
283
|
-
align?: "left" | "
|
|
285
|
+
align?: "left" | "right" | "center" | undefined;
|
|
284
286
|
lineHeight?: number | undefined;
|
|
285
|
-
fillOpacity?: number | undefined;
|
|
286
|
-
drawOpacity?: number | undefined;
|
|
287
287
|
dashed?: boolean | undefined;
|
|
288
288
|
dotted?: boolean | undefined;
|
|
289
289
|
dashArray?: string | undefined;
|
|
@@ -304,9 +304,6 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
304
304
|
type: "node";
|
|
305
305
|
position: [number, number] | import('./position').PolarPosition;
|
|
306
306
|
fill?: string | undefined;
|
|
307
|
-
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
308
|
-
stroke?: string | undefined;
|
|
309
|
-
strokeWidth?: number | undefined;
|
|
310
307
|
text?: string | (string | {
|
|
311
308
|
text: string;
|
|
312
309
|
fill?: string | undefined;
|
|
@@ -318,7 +315,12 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
318
315
|
style?: "normal" | "italic" | "oblique" | undefined;
|
|
319
316
|
} | undefined;
|
|
320
317
|
})[] | undefined;
|
|
318
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
319
|
+
stroke?: string | undefined;
|
|
320
|
+
strokeWidth?: number | undefined;
|
|
321
321
|
opacity?: number | undefined;
|
|
322
|
+
fillOpacity?: number | undefined;
|
|
323
|
+
drawOpacity?: number | undefined;
|
|
322
324
|
font?: {
|
|
323
325
|
family?: string | undefined;
|
|
324
326
|
size?: number | undefined;
|
|
@@ -327,10 +329,8 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
327
329
|
} | undefined;
|
|
328
330
|
id?: string | undefined;
|
|
329
331
|
rotate?: number | undefined;
|
|
330
|
-
align?: "left" | "
|
|
332
|
+
align?: "left" | "right" | "center" | undefined;
|
|
331
333
|
lineHeight?: number | undefined;
|
|
332
|
-
fillOpacity?: number | undefined;
|
|
333
|
-
drawOpacity?: number | undefined;
|
|
334
334
|
dashed?: boolean | undefined;
|
|
335
335
|
dotted?: boolean | undefined;
|
|
336
336
|
dashArray?: string | undefined;
|
|
@@ -16,6 +16,28 @@ var PathSchema = zod.z.object({
|
|
|
16
16
|
arrowShape: zod.z.nativeEnum(require_arrow.ARROW_SHAPES).optional().describe("Arrow tip shape; default `normal` (filled triangle). Other values: `open` (hollow triangle), `stealth` (sharp barb), `diamond`, `circle`."),
|
|
17
17
|
fill: zod.z.string().optional().describe("Fill color of the closed region; any CSS color. Omitted = no fill (stroke only). Pairs with `cycle` step for filled shapes."),
|
|
18
18
|
fillRule: zod.z.enum(["nonzero", "evenodd"]).optional().describe("How self-intersecting / nested sub-paths are filled. `nonzero` (default, SVG default) winds-by-direction; `evenodd` toggles fill on each crossing — useful for ring / donut shapes."),
|
|
19
|
+
lineCap: zod.z.enum([
|
|
20
|
+
"butt",
|
|
21
|
+
"round",
|
|
22
|
+
"square"
|
|
23
|
+
]).optional().describe("Stroke endpoint shape (SVG `stroke-linecap`). Default `butt` (sharp end); `round` adds a half-disc cap; `square` extends a half-stroke past the endpoint."),
|
|
24
|
+
lineJoin: zod.z.enum([
|
|
25
|
+
"miter",
|
|
26
|
+
"round",
|
|
27
|
+
"bevel"
|
|
28
|
+
]).optional().describe("Stroke corner shape (SVG `stroke-linejoin`). Default `miter` (sharp corner); `round` rounds the join; `bevel` cuts the corner flat."),
|
|
29
|
+
thickness: zod.z.enum([
|
|
30
|
+
"ultraThin",
|
|
31
|
+
"veryThin",
|
|
32
|
+
"thin",
|
|
33
|
+
"semithick",
|
|
34
|
+
"thick",
|
|
35
|
+
"veryThick",
|
|
36
|
+
"ultraThick"
|
|
37
|
+
]).optional().describe("Semantic stroke thickness preset (TikZ `ultra thin` … `ultra thick`). Compiled to a numeric stroke-width if `strokeWidth` is omitted. Explicit `strokeWidth` always wins."),
|
|
38
|
+
opacity: zod.z.number().min(0).max(1).optional().describe("Whole-path opacity 0..1; multiplies onto stroke and fill."),
|
|
39
|
+
fillOpacity: zod.z.number().min(0).max(1).optional().describe("Fill opacity 0..1; affects only the closed-region fill."),
|
|
40
|
+
drawOpacity: zod.z.number().min(0).max(1).optional().describe("Stroke opacity 0..1 (TikZ `draw opacity`); affects only the path stroke."),
|
|
19
41
|
children: zod.z.array(require_step.StepSchema).min(2).describe("Sequence of step actions defining the path; the first should usually be a `move`")
|
|
20
42
|
}).describe("A drawn path composed of a sequence of step actions (move / line / ...)");
|
|
21
43
|
//#endregion
|