@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,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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
export { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample };
|
package/dist/es/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/es/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/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PositionSchema } from "./ir/position/position.js";
|
|
2
2
|
import { PolarPositionSchema } from "./ir/position/polar-position.js";
|
|
3
3
|
import { ARROW_SHAPES } from "./ir/path/arrow.js";
|
|
4
|
-
import { TargetSchema } from "./ir/path/target.js";
|
|
5
|
-
import { CycleStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, StepSchema } from "./ir/path/step.js";
|
|
4
|
+
import { RelAccumulateTargetSchema, RelTargetSchema, TargetSchema } from "./ir/path/target.js";
|
|
5
|
+
import { ArcStepSchema, BendStepSchema, CirclePathStepSchema, ControlPointSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, EllipsePathStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, StepLabelSchema, StepSchema } from "./ir/path/step.js";
|
|
6
6
|
import { PathSchema } from "./ir/path/path.js";
|
|
7
7
|
import { FontSchema, LineSpecSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeSchema, NodeTextSchema } from "./ir/node.js";
|
|
8
8
|
import { CURRENT_IR_VERSION, ChildSchema, SceneSchema } from "./ir/scene.js";
|
|
@@ -12,7 +12,8 @@ import { diamond } from "./geometry/diamond.js";
|
|
|
12
12
|
import { ellipse } from "./geometry/ellipse.js";
|
|
13
13
|
import { fallbackMeasurer } from "./compile/text-metrics.js";
|
|
14
14
|
import { compileToScene } from "./compile/compile.js";
|
|
15
|
+
import { parseTargetSugar } from "./parsers/parseTargetSugar.js";
|
|
15
16
|
import { DrawWay, parseWay } from "./parsers/parseWay.js";
|
|
16
17
|
import { polar } from "./geometry/polar.js";
|
|
17
18
|
import { point } from "./geometry/point.js";
|
|
18
|
-
export { ARROW_SHAPES, CURRENT_IR_VERSION, ChildSchema, CycleStepSchema, DrawWay, FoldStepSchema, FontSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeSchema, NodeTextSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, SceneSchema, StepSchema, TargetSchema, circle, compileToScene, diamond, ellipse, fallbackMeasurer, parseWay, point, polar, rect };
|
|
19
|
+
export { ARROW_SHAPES, ArcStepSchema, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeSchema, NodeTextSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RelAccumulateTargetSchema, RelTargetSchema, SceneSchema, StepLabelSchema, StepSchema, TargetSchema, circle, compileToScene, diamond, ellipse, fallbackMeasurer, parseTargetSugar, parseWay, point, polar, rect };
|
package/dist/es/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;
|