@retikz/core 0.2.0-alpha.4 → 0.2.0-alpha.5
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/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +91 -12
- package/dist/es/compile/path/relative.d.ts.map +1 -1
- package/dist/es/compile/path/relative.js +5 -1
- package/dist/es/geometry/arc.d.ts +11 -0
- package/dist/es/geometry/arc.d.ts.map +1 -1
- package/dist/es/geometry/arc.js +27 -1
- package/dist/es/geometry/rect.d.ts +23 -0
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +84 -1
- package/dist/es/geometry/segment.d.ts +2 -0
- package/dist/es/geometry/segment.d.ts.map +1 -1
- package/dist/es/geometry/segment.js +12 -1
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +2 -2
- package/dist/es/ir/node.d.ts +2 -2
- package/dist/es/ir/path/path.d.ts +227 -5
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/step.d.ts +311 -8
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +36 -11
- package/dist/es/ir/scope.d.ts +312 -12
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +89 -10
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/compile/path/relative.cjs +5 -1
- package/dist/lib/compile/path/relative.d.ts.map +1 -1
- package/dist/lib/geometry/arc.cjs +28 -0
- package/dist/lib/geometry/arc.d.ts +11 -0
- package/dist/lib/geometry/arc.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +84 -0
- package/dist/lib/geometry/rect.d.ts +23 -0
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/geometry/segment.cjs +12 -0
- package/dist/lib/geometry/segment.d.ts +2 -0
- package/dist/lib/geometry/segment.d.ts.map +1 -1
- package/dist/lib/index.cjs +1 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/node.d.ts +2 -2
- package/dist/lib/ir/path/path.d.ts +227 -5
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +36 -10
- package/dist/lib/ir/path/step.d.ts +311 -8
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/scope.d.ts +312 -12
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EAGX,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAEV,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AA8BtE,mCAAmC;AACnC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iCAAiC;IACjC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,IAAI,CAAC;IACX,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,EACZ,WAAW,SAAS,EACpB,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAC5B,cAAa,YAA+B,EAC5C,WAAU,gBAAqB,KAC9B;IAAE,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;CAAE,GAAG,IA8gBrE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rectOutline } from "../../geometry/rect.js";
|
|
2
|
+
import { arcBoundingPoints, arcEndPoint, ellipseArcBoundingPoints, ellipseArcPoint } from "../../geometry/arc.js";
|
|
2
3
|
import { bendControlPoints } from "../../geometry/bend.js";
|
|
3
|
-
import { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample } from "../../geometry/segment.js";
|
|
4
|
+
import { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseArcSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample } from "../../geometry/segment.js";
|
|
4
5
|
import { fallbackMeasurer } from "../text-metrics.js";
|
|
5
6
|
import { clipForTarget, cornerOf, refPointOfTarget, samePoint } from "./anchor.js";
|
|
6
7
|
import { emitLabelPrimitive, tForLabelPosition } from "./label.js";
|
|
@@ -51,7 +52,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
51
52
|
labelPrims.push(r.primitive);
|
|
52
53
|
for (const p of r.points) points.push(p);
|
|
53
54
|
};
|
|
54
|
-
const hasTo = (s) => s.kind !== "cycle" && s.kind !== "arc" && s.kind !== "circlePath" && s.kind !== "ellipsePath";
|
|
55
|
+
const hasTo = (s) => s.kind !== "cycle" && s.kind !== "arc" && s.kind !== "circlePath" && s.kind !== "ellipsePath" && s.kind !== "rectangle";
|
|
55
56
|
const anchors = steps.map((s, idx) => {
|
|
56
57
|
if (!hasTo(s)) return null;
|
|
57
58
|
const ref = refPointOfTarget(s.to, nameStack, scopeChain);
|
|
@@ -168,6 +169,12 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
168
169
|
if (samePoint(p, lastEnd)) return;
|
|
169
170
|
emitMove(p);
|
|
170
171
|
};
|
|
172
|
+
/** 部分圆/椭圆的闭合模式:'open' 直接返回;缺省 / 误给 'closed' 回退 'chord' */
|
|
173
|
+
const resolvePartialClosed = (closed, idx) => {
|
|
174
|
+
if (closed === "open") return "open";
|
|
175
|
+
if (closed === "closed") warn("PARTIAL_ARC_CLOSED_INVALID", "Partial circle/ellipse (with angles) cannot use closed:'closed'; falling back to 'chord'", `children[${idx}]`);
|
|
176
|
+
return "chord";
|
|
177
|
+
};
|
|
171
178
|
for (let i = 0; i < steps.length; i++) {
|
|
172
179
|
if (i > 0) {
|
|
173
180
|
const prevStep = steps[i - 1];
|
|
@@ -193,22 +200,80 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
193
200
|
emitLine(toClip);
|
|
194
201
|
continue;
|
|
195
202
|
}
|
|
203
|
+
if (step.kind === "rectangle") {
|
|
204
|
+
const fromPt = refPointOfTarget(step.from, nameStack, scopeChain);
|
|
205
|
+
const toPt = refPointOfTarget(step.to, nameStack, scopeChain);
|
|
206
|
+
if (!fromPt || !toPt) {
|
|
207
|
+
if (!fromPt && typeof step.from === "string") warn("UNRESOLVED_NODE_REFERENCE", `Rectangle from references undefined node id '${step.from}'; the entire path is skipped`, `children[${i}].from`);
|
|
208
|
+
if (!toPt && typeof step.to === "string") warn("UNRESOLVED_NODE_REFERENCE", `Rectangle to references undefined node id '${step.to}'; the entire path is skipped`, `children[${i}].to`);
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
let rectStart = null;
|
|
212
|
+
for (const op of rectOutline(fromPt, toPt, step.roundedCorners)) if (op.kind === "move") {
|
|
213
|
+
emitMove(op.to);
|
|
214
|
+
rectStart = op.to;
|
|
215
|
+
} else if (op.kind === "line") emitLine(op.to);
|
|
216
|
+
else if (op.kind === "arc") emitArc(op.center, op.radius, op.startAngle, op.endAngle);
|
|
217
|
+
else emitClose();
|
|
218
|
+
const rx0 = Math.min(fromPt[0], toPt[0]);
|
|
219
|
+
const rx1 = Math.max(fromPt[0], toPt[0]);
|
|
220
|
+
const ry0 = Math.min(fromPt[1], toPt[1]);
|
|
221
|
+
const ry1 = Math.max(fromPt[1], toPt[1]);
|
|
222
|
+
points.push([rx0, ry0], [rx1, ry0], [rx1, ry1], [rx0, ry1]);
|
|
223
|
+
if (rectStart) penOverride = rectStart;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
196
226
|
const prev = findPrev();
|
|
197
227
|
if (!prev) return null;
|
|
198
228
|
if (step.kind === "arc") {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
229
|
+
let center;
|
|
230
|
+
if (step.center !== void 0) {
|
|
231
|
+
const c = refPointOfTarget(step.center, nameStack, scopeChain);
|
|
232
|
+
if (!c) {
|
|
233
|
+
if (typeof step.center === "string") warn("UNRESOLVED_NODE_REFERENCE", `Arc step center references undefined node id '${step.center}'; the entire path is skipped`, `children[${i}].center`);
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
center = c;
|
|
237
|
+
} else center = prev.anchor;
|
|
238
|
+
if (step.radiusX !== void 0 && step.radiusY !== void 0) {
|
|
239
|
+
const rx = step.radiusX;
|
|
240
|
+
const ry = step.radiusY;
|
|
241
|
+
startSegment(ellipseArcPoint(center, rx, ry, step.startAngle));
|
|
242
|
+
emitEllipseArc(center, rx, ry, step.startAngle, step.endAngle);
|
|
243
|
+
for (const p of ellipseArcBoundingPoints(center, rx, ry, step.startAngle, step.endAngle)) points.push(p);
|
|
244
|
+
collectLabel(step, (t) => ellipseArcSegmentSample(center, rx, ry, step.startAngle, step.endAngle, t));
|
|
245
|
+
penOverride = ellipseArcPoint(center, rx, ry, step.endAngle);
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (step.radius !== void 0) {
|
|
249
|
+
const r = step.radius;
|
|
250
|
+
startSegment(arcEndPoint(center, r, step.startAngle));
|
|
251
|
+
emitArc(center, r, step.startAngle, step.endAngle);
|
|
252
|
+
for (const p of arcBoundingPoints(center, r, step.startAngle, step.endAngle)) points.push(p);
|
|
253
|
+
collectLabel(step, (t) => arcSegmentSample(center, r, step.startAngle, step.endAngle, t));
|
|
254
|
+
penOverride = arcEndPoint(center, r, step.endAngle);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
warn("ARC_MISSING_RADIUS", "Arc step requires radius (circular) or both radiusX and radiusY (elliptical); the entire path is skipped", `children[${i}]`);
|
|
258
|
+
return null;
|
|
208
259
|
}
|
|
209
260
|
if (step.kind === "circlePath") {
|
|
210
261
|
const center = prev.anchor;
|
|
211
262
|
const r = step.radius;
|
|
263
|
+
if (step.startAngle !== void 0 && step.endAngle !== void 0) {
|
|
264
|
+
const startA = step.startAngle;
|
|
265
|
+
const endA = step.endAngle;
|
|
266
|
+
startSegment(ellipseArcPoint(center, r, r, startA));
|
|
267
|
+
emitEllipseArc(center, r, r, startA, endA);
|
|
268
|
+
for (const p of ellipseArcBoundingPoints(center, r, r, startA, endA)) points.push(p);
|
|
269
|
+
collectLabel(step, (t) => ellipseArcSegmentSample(center, r, r, startA, endA, t));
|
|
270
|
+
if (resolvePartialClosed(step.closed, i) === "chord") {
|
|
271
|
+
emitClose();
|
|
272
|
+
penOverride = ellipseArcPoint(center, r, r, startA);
|
|
273
|
+
} else penOverride = ellipseArcPoint(center, r, r, endA);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
if (step.startAngle !== void 0 || step.endAngle !== void 0) warn("PARTIAL_ARC_NEEDS_BOTH_ANGLES", "circlePath needs both startAngle and endAngle for a partial circle; treated as a full circle", `children[${i}]`);
|
|
212
277
|
startSegment([center[0] + r, center[1]]);
|
|
213
278
|
emitEllipseArc(center, r, r, 0, 360);
|
|
214
279
|
points.push([center[0] + r, center[1]]);
|
|
@@ -223,6 +288,20 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
223
288
|
const center = prev.anchor;
|
|
224
289
|
const rx = step.radiusX;
|
|
225
290
|
const ry = step.radiusY;
|
|
291
|
+
if (step.startAngle !== void 0 && step.endAngle !== void 0) {
|
|
292
|
+
const startA = step.startAngle;
|
|
293
|
+
const endA = step.endAngle;
|
|
294
|
+
startSegment(ellipseArcPoint(center, rx, ry, startA));
|
|
295
|
+
emitEllipseArc(center, rx, ry, startA, endA);
|
|
296
|
+
for (const p of ellipseArcBoundingPoints(center, rx, ry, startA, endA)) points.push(p);
|
|
297
|
+
collectLabel(step, (t) => ellipseArcSegmentSample(center, rx, ry, startA, endA, t));
|
|
298
|
+
if (resolvePartialClosed(step.closed, i) === "chord") {
|
|
299
|
+
emitClose();
|
|
300
|
+
penOverride = ellipseArcPoint(center, rx, ry, startA);
|
|
301
|
+
} else penOverride = ellipseArcPoint(center, rx, ry, endA);
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if (step.startAngle !== void 0 || step.endAngle !== void 0) warn("PARTIAL_ARC_NEEDS_BOTH_ANGLES", "ellipsePath needs both startAngle and endAngle for a partial ellipse; treated as a full ellipse", `children[${i}]`);
|
|
226
305
|
startSegment([center[0] + rx, center[1]]);
|
|
227
306
|
emitEllipseArc(center, rx, ry, 0, 360);
|
|
228
307
|
points.push([center[0] + rx, center[1]]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relative.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/relative.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,MAAM,EAAY,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,aAAa,CAAC,MAAM,CAAC,EAC5B,WAAW,SAAS,EACpB,aAAY,aAAa,CAAC,SAAS,CAAM,KACxC,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"relative.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/relative.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,MAAM,EAAY,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,aAAa,CAAC,MAAM,CAAC,EAC5B,WAAW,SAAS,EACpB,aAAY,aAAa,CAAC,SAAS,CAAM,KACxC,KAAK,CAAC,MAAM,CA6Ed,CAAC"}
|
|
@@ -25,7 +25,11 @@ var normalizeRelativeTargets = (steps, nameStack, scopeChain = []) => {
|
|
|
25
25
|
}
|
|
26
26
|
if (step.kind === "arc") {
|
|
27
27
|
out.push(step);
|
|
28
|
-
if (prevEnd) prevEnd = arcEndPoint(prevEnd, step.radius, step.endAngle);
|
|
28
|
+
if (prevEnd && step.radius !== void 0 && step.center === void 0) prevEnd = arcEndPoint(prevEnd, step.radius, step.endAngle);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (step.kind === "rectangle") {
|
|
32
|
+
out.push(step);
|
|
29
33
|
continue;
|
|
30
34
|
}
|
|
31
35
|
const original = step.to;
|
|
@@ -6,4 +6,15 @@ export declare const arcEndPoint: (center: Position, radius: number, angleDeg: n
|
|
|
6
6
|
* @description 弧投影到 x/y 轴的极值只可能在弧端点或圆周轴向四点出现。endAngle < startAngle 时按 min..max 扫描;跨 360°(270→450)按数值区间正确处理;不去重——端角恰在 90°·k 上时调用方处理
|
|
7
7
|
*/
|
|
8
8
|
export declare const arcBoundingPoints: (center: Position, radius: number, startAngleDeg: number, endAngleDeg: number) => Array<Position>;
|
|
9
|
+
/**
|
|
10
|
+
* 椭圆弧参数点:中心 + 半轴 rx/ry + 参数角(度)→ 椭圆周上点
|
|
11
|
+
* @description 与 arcEndPoint 同角度约定(SVG y-down);endpoint = [cx + rx·cosθ, cy + ry·sinθ]。
|
|
12
|
+
* θ 是参数角(非真实极角,rx≠ry 时两者不等)
|
|
13
|
+
*/
|
|
14
|
+
export declare const ellipseArcPoint: (center: Position, radiusX: number, radiusY: number, angleDeg: number) => Position;
|
|
15
|
+
/**
|
|
16
|
+
* 椭圆弧 bbox 极值候选:起点、终点,加 [start,end] 区间内所有 90°·k 参数角处的椭圆周点
|
|
17
|
+
* @description 轴对齐椭圆的 x 极值在 θ=0/180、y 极值在 θ=90/270,与正圆同结构(仅半轴用 rx/ry)
|
|
18
|
+
*/
|
|
19
|
+
export declare const ellipseArcBoundingPoints: (center: Position, radiusX: number, radiusY: number, startAngleDeg: number, endAngleDeg: number) => Array<Position>;
|
|
9
20
|
//# sourceMappingURL=arc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../src/geometry/arc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAWxC,iDAAiD;AACjD,eAAO,MAAM,WAAW,GACtB,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,UAAU,MAAM,KACf,QAMF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,aAAa,MAAM,KAClB,KAAK,CAAC,QAAQ,CAiBhB,CAAC"}
|
|
1
|
+
{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../src/geometry/arc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAWxC,iDAAiD;AACjD,eAAO,MAAM,WAAW,GACtB,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,UAAU,MAAM,KACf,QAMF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,aAAa,MAAM,KAClB,KAAK,CAAC,QAAQ,CAiBhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,QAAQ,EAChB,SAAS,MAAM,EACf,SAAS,MAAM,EACf,UAAU,MAAM,KACf,QAMF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,QAAQ,EAChB,SAAS,MAAM,EACf,SAAS,MAAM,EACf,eAAe,MAAM,EACrB,aAAa,MAAM,KAClB,KAAK,CAAC,QAAQ,CAehB,CAAC"}
|
package/dist/es/geometry/arc.js
CHANGED
|
@@ -22,5 +22,31 @@ var arcBoundingPoints = (center, radius, startAngleDeg, endAngleDeg) => {
|
|
|
22
22
|
}
|
|
23
23
|
return points;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* 椭圆弧参数点:中心 + 半轴 rx/ry + 参数角(度)→ 椭圆周上点
|
|
27
|
+
* @description 与 arcEndPoint 同角度约定(SVG y-down);endpoint = [cx + rx·cosθ, cy + ry·sinθ]。
|
|
28
|
+
* θ 是参数角(非真实极角,rx≠ry 时两者不等)
|
|
29
|
+
*/
|
|
30
|
+
var ellipseArcPoint = (center, radiusX, radiusY, angleDeg) => {
|
|
31
|
+
const rad = angleDeg * DEG_TO_RAD;
|
|
32
|
+
return [center[0] + Math.cos(rad) * radiusX, center[1] + Math.sin(rad) * radiusY];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 椭圆弧 bbox 极值候选:起点、终点,加 [start,end] 区间内所有 90°·k 参数角处的椭圆周点
|
|
36
|
+
* @description 轴对齐椭圆的 x 极值在 θ=0/180、y 极值在 θ=90/270,与正圆同结构(仅半轴用 rx/ry)
|
|
37
|
+
*/
|
|
38
|
+
var ellipseArcBoundingPoints = (center, radiusX, radiusY, startAngleDeg, endAngleDeg) => {
|
|
39
|
+
const points = [ellipseArcPoint(center, radiusX, radiusY, startAngleDeg), ellipseArcPoint(center, radiusX, radiusY, endAngleDeg)];
|
|
40
|
+
const lo = Math.min(startAngleDeg, endAngleDeg);
|
|
41
|
+
const hi = Math.max(startAngleDeg, endAngleDeg);
|
|
42
|
+
const kStart = Math.ceil(lo / 90);
|
|
43
|
+
const kEnd = Math.floor(hi / 90);
|
|
44
|
+
for (let k = kStart; k <= kEnd; k++) {
|
|
45
|
+
const angle = k * 90;
|
|
46
|
+
if (angle === startAngleDeg || angle === endAngleDeg) continue;
|
|
47
|
+
points.push(ellipseArcPoint(center, radiusX, radiusY, angle));
|
|
48
|
+
}
|
|
49
|
+
return points;
|
|
50
|
+
};
|
|
25
51
|
//#endregion
|
|
26
|
-
export { arcBoundingPoints, arcEndPoint };
|
|
52
|
+
export { arcBoundingPoints, arcEndPoint, ellipseArcBoundingPoints, ellipseArcPoint };
|
|
@@ -32,4 +32,27 @@ export declare const rect: {
|
|
|
32
32
|
/** 从中心向 toward 方向射线与矩形边界交点(含旋转),Path 端点贴 Node 边界用 */
|
|
33
33
|
boundaryPoint: (r: Rect, toward: Position) => Position;
|
|
34
34
|
};
|
|
35
|
+
/** rectOutline 的命令算子(供 compile 翻译为 PathCommand;几何在 core 下沉,便于未来 rectangle node shape 复用) */
|
|
36
|
+
export type RectOutlineOp = {
|
|
37
|
+
kind: 'move';
|
|
38
|
+
to: Position;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'line';
|
|
41
|
+
to: Position;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'arc';
|
|
44
|
+
center: Position;
|
|
45
|
+
radius: number;
|
|
46
|
+
startAngle: number;
|
|
47
|
+
endAngle: number;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'close';
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 矩形 outline:两对角 → 顺时针 path 算子序列
|
|
53
|
+
* @description from/to 任意顺序,归一化 (x0,y0)=min、(x1,y1)=max。直角 = 4 line + close(起点左上 (x0,y0));
|
|
54
|
+
* 圆角 = 4 line + 4 quarter-arc + close(起点 (x0+r, y0))。roundedCorners clamp 到 min(w,h)/2。
|
|
55
|
+
* 角度约定同 geometry/arc(y-down:0=+x, 90=+y/下, 180=-x, 270=-y/上)。
|
|
56
|
+
*/
|
|
57
|
+
export declare const rectOutline: (from: Position, to: Position, roundedCorners?: number) => Array<RectOutlineOp>;
|
|
35
58
|
//# sourceMappingURL=rect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/geometry/rect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,gCAAgC;AAChC,MAAM,MAAM,IAAI,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AAEX,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,IAAI;IACf,WAAW;gBACC,IAAI,KAAG,QAAQ;IAC3B,uBAAuB;kBACT,IAAI,KAAK,QAAQ,KAAG,OAAO;IAMzC,sCAAsC;gBAC1B,IAAI,QAAQ,UAAU,KAAG,QAAQ;IAuC7C,qDAAqD;uBAClC,IAAI,UAAU,QAAQ,KAAG,QAAQ;CAUrD,CAAC"}
|
|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QAAQ,EACZ,iBAAiB,MAAM,KACtB,KAAK,CAAC,aAAa,CAgCrB,CAAC"}
|
package/dist/es/geometry/rect.js
CHANGED
|
@@ -73,5 +73,88 @@ var rect = {
|
|
|
73
73
|
return localToWorld(r, [localX * t, localY * t]);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* 矩形 outline:两对角 → 顺时针 path 算子序列
|
|
78
|
+
* @description from/to 任意顺序,归一化 (x0,y0)=min、(x1,y1)=max。直角 = 4 line + close(起点左上 (x0,y0));
|
|
79
|
+
* 圆角 = 4 line + 4 quarter-arc + close(起点 (x0+r, y0))。roundedCorners clamp 到 min(w,h)/2。
|
|
80
|
+
* 角度约定同 geometry/arc(y-down:0=+x, 90=+y/下, 180=-x, 270=-y/上)。
|
|
81
|
+
*/
|
|
82
|
+
var rectOutline = (from, to, roundedCorners) => {
|
|
83
|
+
const x0 = Math.min(from[0], to[0]);
|
|
84
|
+
const x1 = Math.max(from[0], to[0]);
|
|
85
|
+
const y0 = Math.min(from[1], to[1]);
|
|
86
|
+
const y1 = Math.max(from[1], to[1]);
|
|
87
|
+
const r = roundedCorners === void 0 ? 0 : Math.min(roundedCorners, (x1 - x0) / 2, (y1 - y0) / 2);
|
|
88
|
+
if (r <= 0) return [
|
|
89
|
+
{
|
|
90
|
+
kind: "move",
|
|
91
|
+
to: [x0, y0]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
kind: "line",
|
|
95
|
+
to: [x1, y0]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
kind: "line",
|
|
99
|
+
to: [x1, y1]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
kind: "line",
|
|
103
|
+
to: [x0, y1]
|
|
104
|
+
},
|
|
105
|
+
{ kind: "close" }
|
|
106
|
+
];
|
|
107
|
+
return [
|
|
108
|
+
{
|
|
109
|
+
kind: "move",
|
|
110
|
+
to: [x0 + r, y0]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
kind: "line",
|
|
114
|
+
to: [x1 - r, y0]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
kind: "arc",
|
|
118
|
+
center: [x1 - r, y0 + r],
|
|
119
|
+
radius: r,
|
|
120
|
+
startAngle: 270,
|
|
121
|
+
endAngle: 360
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
kind: "line",
|
|
125
|
+
to: [x1, y1 - r]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
kind: "arc",
|
|
129
|
+
center: [x1 - r, y1 - r],
|
|
130
|
+
radius: r,
|
|
131
|
+
startAngle: 0,
|
|
132
|
+
endAngle: 90
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
kind: "line",
|
|
136
|
+
to: [x0 + r, y1]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
kind: "arc",
|
|
140
|
+
center: [x0 + r, y1 - r],
|
|
141
|
+
radius: r,
|
|
142
|
+
startAngle: 90,
|
|
143
|
+
endAngle: 180
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
kind: "line",
|
|
147
|
+
to: [x0, y0 + r]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
kind: "arc",
|
|
151
|
+
center: [x0 + r, y0 + r],
|
|
152
|
+
radius: r,
|
|
153
|
+
startAngle: 180,
|
|
154
|
+
endAngle: 270
|
|
155
|
+
},
|
|
156
|
+
{ kind: "close" }
|
|
157
|
+
];
|
|
158
|
+
};
|
|
76
159
|
//#endregion
|
|
77
|
-
export { RECT_ANCHORS, rect };
|
|
160
|
+
export { RECT_ANCHORS, rect, rectOutline };
|
|
@@ -28,6 +28,8 @@ export declare const cubicSegmentSample: (from: Position, c1: Position, c2: Posi
|
|
|
28
28
|
export declare const foldSegmentSample: (from: Position, corner: Position, to: Position, t: number) => SegmentSample;
|
|
29
29
|
/** 弧段(角度度数,与 ir/path arc 同约定);切线沿扫描方向:endAngle ≥ start 取 (-sin,cos),否则反向 */
|
|
30
30
|
export declare const arcSegmentSample: (center: Position, radius: number, startAngleDeg: number, endAngleDeg: number, t: number) => SegmentSample;
|
|
31
|
+
/** 椭圆弧段(参数角度数,与 ir/path arc 同约定);点用 (rx·cos, ry·sin),切线沿扫描方向 */
|
|
32
|
+
export declare const ellipseArcSegmentSample: (center: Position, rx: number, ry: number, startAngleDeg: number, endAngleDeg: number, t: number) => SegmentSample;
|
|
31
33
|
/** 整圆,从 0°(east) 开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致 */
|
|
32
34
|
export declare const circleSegmentSample: (center: Position, radius: number, t: number) => SegmentSample;
|
|
33
35
|
/** 整椭圆,参数化 (rx·cos(2πt), ry·sin(2πt)) */
|
|
@@ -1 +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;AAiBxC;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB;IACxB,KAAK,EAAE,QAAQ,CAAC;IAChB,iCAAiC;IACjC,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;;;GAGG;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;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,QAAQ,EACd,QAAQ,Q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AAI,QAAQ,EACZ,GAAG,MAAM,KACR,aAGF,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,aAAa,MAAM,EACnB,GAAG,MAAM,KACR,aAUF,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,GAClC,QAAQ,QAAQ,EAChB,IAAI,MAAM,EACV,IAAI,MAAM,EACV,eAAe,MAAM,EACrB,aAAa,MAAM,EACnB,GAAG,MAAM,KACR,aAUF,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,QAAQ,EAChB,QAAQ,MAAM,EACd,GAAG,MAAM,KACR,aASF,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,QAAQ,EAChB,IAAI,MAAM,EACV,IAAI,MAAM,EACV,GAAG,MAAM,KACR,aASF,CAAC"}
|
|
@@ -51,6 +51,17 @@ var arcSegmentSample = (center, radius, startAngleDeg, endAngleDeg, t) => {
|
|
|
51
51
|
tangent: normalize([-sin * sweepSign, cos * sweepSign])
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
+
/** 椭圆弧段(参数角度数,与 ir/path arc 同约定);点用 (rx·cos, ry·sin),切线沿扫描方向 */
|
|
55
|
+
var ellipseArcSegmentSample = (center, rx, ry, startAngleDeg, endAngleDeg, t) => {
|
|
56
|
+
const rad = (startAngleDeg + t * (endAngleDeg - startAngleDeg)) * DEG_TO_RAD;
|
|
57
|
+
const cos = Math.cos(rad);
|
|
58
|
+
const sin = Math.sin(rad);
|
|
59
|
+
const sweepSign = endAngleDeg >= startAngleDeg ? 1 : -1;
|
|
60
|
+
return {
|
|
61
|
+
point: [center[0] + rx * cos, center[1] + ry * sin],
|
|
62
|
+
tangent: normalize([-rx * sin * sweepSign, ry * cos * sweepSign])
|
|
63
|
+
};
|
|
64
|
+
};
|
|
54
65
|
/** 整圆,从 0°(east) 开始,与 compile/path circlePath 输出方向(右→左→右,sweep=1)一致 */
|
|
55
66
|
var circleSegmentSample = (center, radius, t) => {
|
|
56
67
|
const rad = t * 360 * DEG_TO_RAD;
|
|
@@ -72,4 +83,4 @@ var ellipseSegmentSample = (center, rx, ry, t) => {
|
|
|
72
83
|
};
|
|
73
84
|
};
|
|
74
85
|
//#endregion
|
|
75
|
-
export { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample };
|
|
86
|
+
export { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseArcSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample };
|
package/dist/es/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @retikz/core 公开 API
|
|
3
3
|
* @description 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/canvas、@retikz/ssr)只能 import 本文件导出内容,不准走子路径。本包零 React/零 DOM 依赖
|
|
4
4
|
*/
|
|
5
|
-
export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
6
|
-
export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, } from './ir';
|
|
5
|
+
export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, RectangleStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
6
|
+
export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRRectangleStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, } from './ir';
|
|
7
7
|
export { ARROW_SHAPES, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, } from './ir';
|
|
8
8
|
export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, PathCommand,
|
|
9
9
|
/** 7 个 named PathCommand 分支(便于 wrapper / Pick<>) */
|
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,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,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AE,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,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW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,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,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/es/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { FontSchema } from "./ir/font.js";
|
|
|
6
6
|
import { LineSpecSchema, TextBlockSchema } from "./ir/text.js";
|
|
7
7
|
import { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, ArrowDetailSchema, ArrowEndDetailSchema, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES } from "./ir/path/arrow.js";
|
|
8
8
|
import { RelativeAccumulateTargetSchema, RelativeTargetSchema, TargetSchema } from "./ir/path/target.js";
|
|
9
|
-
import { ArcStepSchema, BendStepSchema, CirclePathStepSchema, ControlPointSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, EllipsePathStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, StepLabelSchema, StepSchema } from "./ir/path/step.js";
|
|
9
|
+
import { ArcStepSchema, BendStepSchema, CirclePathStepSchema, ControlPointSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, EllipsePathStepSchema, FoldStepSchema, LineStepSchema, MoveStepSchema, RectangleStepSchema, StepLabelSchema, StepSchema } from "./ir/path/step.js";
|
|
10
10
|
import { PathSchema } from "./ir/path/path.js";
|
|
11
11
|
import { NODE_SHAPES, NODE_TEXT_ALIGNS, NodeLabelSchema, NodeSchema } from "./ir/node.js";
|
|
12
12
|
import { CoordinateSchema } from "./ir/coordinate.js";
|
|
@@ -26,4 +26,4 @@ import { parseTargetSugar } from "./parsers/parseTargetSugar.js";
|
|
|
26
26
|
import { DrawWay, parseWay } from "./parsers/parseWay.js";
|
|
27
27
|
import { polar } from "./geometry/polar.js";
|
|
28
28
|
import { point } from "./geometry/point.js";
|
|
29
|
-
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, ArcStepSchema, ArrowDefaultSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BUILTIN_SHAPES, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DEFAULT_ARROW_SHAPE, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, HOLLOW_ARROW_SHAPES, LabelDefaultSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeDefaultSchema, NodeLabelSchema, NodeSchema, OffsetPositionSchema, PathDefaultSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, ScopeSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, TransformSchema, circle, compileToScene, computeLayout, diamond, ellipse, fallbackMeasurer, localToWorld, parseTargetSugar, parseWay, point, polar, rect, worldToLocal };
|
|
29
|
+
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, ArcStepSchema, ArrowDefaultSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BUILTIN_SHAPES, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DEFAULT_ARROW_SHAPE, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, HOLLOW_ARROW_SHAPES, LabelDefaultSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeDefaultSchema, NodeLabelSchema, NodeSchema, OffsetPositionSchema, PathDefaultSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RectangleStepSchema, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, ScopeSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, TransformSchema, circle, compileToScene, computeLayout, diamond, ellipse, fallbackMeasurer, localToWorld, parseTargetSugar, parseWay, point, polar, rect, worldToLocal };
|
package/dist/es/ir/node.d.ts
CHANGED
|
@@ -404,6 +404,7 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
404
404
|
rotate?: number | "none" | "radial" | "tangent" | undefined;
|
|
405
405
|
keepUpright?: boolean | undefined;
|
|
406
406
|
}[] | undefined;
|
|
407
|
+
roundedCorners?: number | undefined;
|
|
407
408
|
stroke?: string | undefined;
|
|
408
409
|
strokeWidth?: number | undefined;
|
|
409
410
|
fillOpacity?: number | undefined;
|
|
@@ -416,7 +417,6 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
416
417
|
dashed?: boolean | undefined;
|
|
417
418
|
dotted?: boolean | undefined;
|
|
418
419
|
dashArray?: number[] | undefined;
|
|
419
|
-
roundedCorners?: number | undefined;
|
|
420
420
|
minimumWidth?: number | undefined;
|
|
421
421
|
minimumHeight?: number | undefined;
|
|
422
422
|
minimumSize?: number | undefined;
|
|
@@ -489,6 +489,7 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
489
489
|
rotate?: number | "none" | "radial" | "tangent" | undefined;
|
|
490
490
|
keepUpright?: boolean | undefined;
|
|
491
491
|
}[] | undefined;
|
|
492
|
+
roundedCorners?: number | undefined;
|
|
492
493
|
stroke?: string | undefined;
|
|
493
494
|
strokeWidth?: number | undefined;
|
|
494
495
|
fillOpacity?: number | undefined;
|
|
@@ -501,7 +502,6 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
501
502
|
dashed?: boolean | undefined;
|
|
502
503
|
dotted?: boolean | undefined;
|
|
503
504
|
dashArray?: number[] | undefined;
|
|
504
|
-
roundedCorners?: number | undefined;
|
|
505
505
|
minimumWidth?: number | undefined;
|
|
506
506
|
minimumHeight?: number | undefined;
|
|
507
507
|
minimumSize?: number | undefined;
|