@crystaldesign/planner-2d-core 26.11.0-beta.10

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.
Files changed (78) hide show
  1. package/README.md +44 -0
  2. package/build/cjs/index.js +3402 -0
  3. package/build/esm/index.js +3357 -0
  4. package/build/types/planner-2d-core/src/collision/geometry.d.ts +21 -0
  5. package/build/types/planner-2d-core/src/collision/geometry.d.ts.map +1 -0
  6. package/build/types/planner-2d-core/src/core/logger.d.ts +12 -0
  7. package/build/types/planner-2d-core/src/core/logger.d.ts.map +1 -0
  8. package/build/types/planner-2d-core/src/core/units.d.ts +6 -0
  9. package/build/types/planner-2d-core/src/core/units.d.ts.map +1 -0
  10. package/build/types/planner-2d-core/src/core/vectors.d.ts +35 -0
  11. package/build/types/planner-2d-core/src/core/vectors.d.ts.map +1 -0
  12. package/build/types/planner-2d-core/src/docking/DockingPoint.d.ts +38 -0
  13. package/build/types/planner-2d-core/src/docking/DockingPoint.d.ts.map +1 -0
  14. package/build/types/planner-2d-core/src/docking/DockingPointHandler.d.ts +74 -0
  15. package/build/types/planner-2d-core/src/docking/DockingPointHandler.d.ts.map +1 -0
  16. package/build/types/planner-2d-core/src/docking/PlannerElement2D.d.ts +38 -0
  17. package/build/types/planner-2d-core/src/docking/PlannerElement2D.d.ts.map +1 -0
  18. package/build/types/planner-2d-core/src/docking/types.d.ts +26 -0
  19. package/build/types/planner-2d-core/src/docking/types.d.ts.map +1 -0
  20. package/build/types/planner-2d-core/src/index.d.ts +29 -0
  21. package/build/types/planner-2d-core/src/index.d.ts.map +1 -0
  22. package/build/types/planner-2d-core/src/stretch/axis.d.ts +38 -0
  23. package/build/types/planner-2d-core/src/stretch/axis.d.ts.map +1 -0
  24. package/build/types/planner-2d-core/src/stretch/elementTransform.d.ts +8 -0
  25. package/build/types/planner-2d-core/src/stretch/elementTransform.d.ts.map +1 -0
  26. package/build/types/planner-2d-core/src/stretch/normalize.d.ts +19 -0
  27. package/build/types/planner-2d-core/src/stretch/normalize.d.ts.map +1 -0
  28. package/build/types/planner-2d-core/src/stretch/pathTransform.d.ts +17 -0
  29. package/build/types/planner-2d-core/src/stretch/pathTransform.d.ts.map +1 -0
  30. package/build/types/planner-2d-core/src/stretch/points.d.ts +12 -0
  31. package/build/types/planner-2d-core/src/stretch/points.d.ts.map +1 -0
  32. package/build/types/planner-2d-core/src/stretch/resize.d.ts +7 -0
  33. package/build/types/planner-2d-core/src/stretch/resize.d.ts.map +1 -0
  34. package/build/types/planner-2d-core/src/stretch/rounding.d.ts +5 -0
  35. package/build/types/planner-2d-core/src/stretch/rounding.d.ts.map +1 -0
  36. package/build/types/planner-2d-core/src/stretch/state.d.ts +7 -0
  37. package/build/types/planner-2d-core/src/stretch/state.d.ts.map +1 -0
  38. package/build/types/planner-2d-core/src/stretch/stretchAreas.d.ts +7 -0
  39. package/build/types/planner-2d-core/src/stretch/stretchAreas.d.ts.map +1 -0
  40. package/build/types/planner-2d-core/src/stretch/stretchArticleSvg.d.ts +10 -0
  41. package/build/types/planner-2d-core/src/stretch/stretchArticleSvg.d.ts.map +1 -0
  42. package/build/types/planner-2d-core/src/stretch/types.d.ts +54 -0
  43. package/build/types/planner-2d-core/src/stretch/types.d.ts.map +1 -0
  44. package/build/types/planner-2d-core/src/stretch/viewBoxFix.d.ts +7 -0
  45. package/build/types/planner-2d-core/src/stretch/viewBoxFix.d.ts.map +1 -0
  46. package/build/types/planner-2d-core/src/svg/articleSvgParser.d.ts +54 -0
  47. package/build/types/planner-2d-core/src/svg/articleSvgParser.d.ts.map +1 -0
  48. package/build/types/planner-2d-core/src/svg/dom.d.ts +16 -0
  49. package/build/types/planner-2d-core/src/svg/dom.d.ts.map +1 -0
  50. package/build/types/planner-2d-core/src/svg/pathBoundingBox.d.ts +19 -0
  51. package/build/types/planner-2d-core/src/svg/pathBoundingBox.d.ts.map +1 -0
  52. package/build/types/planner-2d-core/src/svg/types.d.ts +32 -0
  53. package/build/types/planner-2d-core/src/svg/types.d.ts.map +1 -0
  54. package/build/types/planner-2d-core/src/testbed/DockingScene.d.ts +47 -0
  55. package/build/types/planner-2d-core/src/testbed/DockingScene.d.ts.map +1 -0
  56. package/build/types/planner-2d-core/src/testbed/SimplePlannerElement.d.ts +64 -0
  57. package/build/types/planner-2d-core/src/testbed/SimplePlannerElement.d.ts.map +1 -0
  58. package/build/types/planner-2d-core/src/tests/collision.test.d.ts +2 -0
  59. package/build/types/planner-2d-core/src/tests/collision.test.d.ts.map +1 -0
  60. package/build/types/planner-2d-core/src/tests/docking.test.d.ts +2 -0
  61. package/build/types/planner-2d-core/src/tests/docking.test.d.ts.map +1 -0
  62. package/build/types/planner-2d-core/src/tests/dockingScene.test.d.ts +2 -0
  63. package/build/types/planner-2d-core/src/tests/dockingScene.test.d.ts.map +1 -0
  64. package/build/types/planner-2d-core/src/tests/fixtures.d.ts +14 -0
  65. package/build/types/planner-2d-core/src/tests/fixtures.d.ts.map +1 -0
  66. package/build/types/planner-2d-core/src/tests/pathBoundingBox.test.d.ts +2 -0
  67. package/build/types/planner-2d-core/src/tests/pathBoundingBox.test.d.ts.map +1 -0
  68. package/build/types/planner-2d-core/src/tests/realArticleSvgs.test.d.ts +2 -0
  69. package/build/types/planner-2d-core/src/tests/realArticleSvgs.test.d.ts.map +1 -0
  70. package/build/types/planner-2d-core/src/tests/stretchDeviations.test.d.ts +2 -0
  71. package/build/types/planner-2d-core/src/tests/stretchDeviations.test.d.ts.map +1 -0
  72. package/build/types/planner-2d-core/src/tests/stretchRegression.test.d.ts +2 -0
  73. package/build/types/planner-2d-core/src/tests/stretchRegression.test.d.ts.map +1 -0
  74. package/build/types/planner-2d-core/src/tests/svgParser.test.d.ts +2 -0
  75. package/build/types/planner-2d-core/src/tests/svgParser.test.d.ts.map +1 -0
  76. package/build/types/planner-2d-core/src/transform/computeDockedTransform.d.ts +24 -0
  77. package/build/types/planner-2d-core/src/transform/computeDockedTransform.d.ts.map +1 -0
  78. package/package.json +24 -0
@@ -0,0 +1,21 @@
1
+ import { Vector2 } from '../core/vectors';
2
+ /**
3
+ * True when the two segments properly intersect, endpoint touches included. Parallel and collinear-overlapping
4
+ * segments report false on purpose (fabric reported those as 'Parallel'/'Coincident'), perpendicular corner
5
+ * touches count as an intersection.
6
+ */
7
+ export declare function segmentsIntersect(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2): boolean;
8
+ /** True when any edge of polygon1 intersects any edge of polygon2. */
9
+ export declare function polygonEdgesIntersect(polygonPoints1: Vector2[], polygonPoints2: Vector2[]): boolean;
10
+ /**
11
+ * True when polygon1 lies completely inside polygon2 (ray casting with a horizontal ray per vertex),
12
+ * including the legacy early exit as soon as vertices fall on both sides.
13
+ */
14
+ export declare function polygonInsidePolygon(polygonPoints1: Vector2[], polygonPoints2: Vector2[]): boolean;
15
+ /**
16
+ * Core collision decision of the 2D planner: when the bounding-box outlines intersect, the detail polygons
17
+ * decide; otherwise one outline lying completely inside the other counts as collision. Layer filtering
18
+ * stays with the caller.
19
+ */
20
+ export declare function outlinesCollide(bboxOutline1: Vector2[], bboxOutline2: Vector2[], detailPolygon1: Vector2[], detailPolygon2: Vector2[]): boolean;
21
+ //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../../src/collision/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,OAAO,CAQ7F;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,OAAO,CAanG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,OAAO,CAqBlG;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,OAAO,CAK/I"}
@@ -0,0 +1,12 @@
1
+ /** Logging surface this package emits to; matches the shape of loggers created by DivaUtils.initLog. */
2
+ export interface Planner2DLogger {
3
+ trace(message: string, ...meta: unknown[]): void;
4
+ debug(message: string, ...meta: unknown[]): void;
5
+ info(message: string, ...meta: unknown[]): void;
6
+ warn(message: string, ...meta: unknown[]): void;
7
+ error(message: string | Error, ...meta: unknown[]): void;
8
+ }
9
+ /** Injects the logger used by this package. Defaults to a no-op, so the package has no logging dependency. */
10
+ export declare function setPlanner2DLogger(logger: Planner2DLogger): void;
11
+ export declare function getPlanner2DLogger(): Planner2DLogger;
12
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../../src/core/logger.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAC1D;AAYD,8GAA8G;AAC9G,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAEhE;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * SVG user units per centimeter in DIVA planner SVGs. Hand-synced copy of DivaUtils.UnitRecalc in
3
+ * @crystaldesign/diva-utils, not recomputed from 72/25.4 (which would differ); keep both values equal.
4
+ */
5
+ export declare const UNIT_RECALC = 2.834637306;
6
+ //# sourceMappingURL=units.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../../../src/core/units.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,cAAc,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** 2D vector in planner coordinates. The math must stay identical to web-planner-logic's wcVectors — docking positions depend on it. */
2
+ export declare class Vector2 {
3
+ x: number;
4
+ y: number;
5
+ constructor(x: number, y: number);
6
+ static add(vec1: Vector2, vec2: Vector2): Vector2;
7
+ /** Direction vector pointing from fromVec to toVec — note the reversed argument order. */
8
+ static getDirection(toVec: Vector2, fromVec: Vector2): Vector2;
9
+ static getDistance(vec1: Vector2, vec2: Vector2): number;
10
+ static getLength(vec: Vector2): number;
11
+ static divNum(vec1: Vector2, num: number): Vector2;
12
+ static mulNum(vec1: Vector2, num: number): Vector2;
13
+ /** Normalized dot product (cosine of the enclosed angle). */
14
+ static dotProduct(vec1: Vector2, vec2: Vector2): number;
15
+ /** Rotates a position around the coordinate-system origin, angle in degrees. */
16
+ static rotateOrigin(vec: Vector2, angleDeg: number): Vector2;
17
+ /** Enclosed angle between the two vectors in radians. */
18
+ static angleRad(vec1: Vector2, vec2: Vector2): number;
19
+ /** Enclosed angle between the two vectors in degrees. */
20
+ static angleDeg(vec1: Vector2, vec2: Vector2): number;
21
+ static normalize(vec1: Vector2): Vector2;
22
+ toString(): string;
23
+ }
24
+ /** 3D vector in planner world coordinates (x/z = ground plane, y = height). */
25
+ export declare class Vector3 {
26
+ x: number;
27
+ y: number;
28
+ z: number;
29
+ constructor(x: number, y: number, z: number);
30
+ static add(vec1: Vector3, vec2: Vector3): Vector3;
31
+ static divNum(vec1: Vector3, num: number): Vector3;
32
+ static mulNum(vec1: Vector3, num: number): Vector3;
33
+ toString(): string;
34
+ }
35
+ //# sourceMappingURL=vectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectors.d.ts","sourceRoot":"","sources":["../../../../../src/core/vectors.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,qBAAa,OAAO;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;gBAEL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;WAKlB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO;IAIxD,0FAA0F;WAC5E,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;WAIvD,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM;WAIjD,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;WAI/B,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;WAI3C,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzD,6DAA6D;WAC/C,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM;IAM9D,gFAAgF;WAClE,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQnE,yDAAyD;WAC3C,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM;IAI5D,yDAAyD;WAC3C,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM;WAI9C,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAKxC,QAAQ,IAAI,MAAM;CAG1B;AAED,+EAA+E;AAC/E,qBAAa,OAAO;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;gBAEL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;WAM7B,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO;WAI1C,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;WAI3C,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIlD,QAAQ,IAAI,MAAM;CAG1B"}
@@ -0,0 +1,38 @@
1
+ import { Vector3 } from '../core/vectors';
2
+ import { DockingType } from '../svg/types';
3
+ import { DockingConfig } from './types';
4
+ /**
5
+ * One AV connector of a planner element. Name parsing supports the legacy underscore form (AVC_2) and the
6
+ * IDM form (AVC2); AVR/AVL and names containing _IL always ignore the layer check.
7
+ */
8
+ export declare class DockingPoint {
9
+ private dockingPoint;
10
+ private layer;
11
+ private isDisabled;
12
+ private plannerConfig;
13
+ constructor(elementId: number, type: DockingType, name: string, localPos: Vector3, rotDeg: number, layer: number, plannerConfig: DockingConfig, filter?: string[]);
14
+ /** Clones the docking point including its docking state. */
15
+ clone(): DockingPoint;
16
+ get ElementId(): number;
17
+ get Name(): string;
18
+ get LocalWorldPos(): Vector3;
19
+ get RotDeg(): number;
20
+ get Type(): DockingType;
21
+ get IsDocking(): boolean;
22
+ get Layer(): number;
23
+ get IgnoreLayer(): boolean;
24
+ get HasNumber(): boolean;
25
+ get Number(): number | undefined;
26
+ get PlannerConfig(): DockingConfig;
27
+ get IsDisabled(): boolean;
28
+ get DPFilter(): string[] | undefined;
29
+ /** Marks this docking point as docked onto refDockingPoint of the element refElementId. */
30
+ doDock(refDockingPoint: DockingPoint, refElementId: number): void;
31
+ undock(): void;
32
+ /** Temporarily disables the docking point so the planner ignores it. */
33
+ disableDP(doDisable: boolean): void;
34
+ get OnDP(): DockingPoint | undefined;
35
+ get OnElementId(): number | undefined;
36
+ get DpId(): string;
37
+ }
38
+ //# sourceMappingURL=DockingPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DockingPoint.d.ts","sourceRoot":"","sources":["../../../../../src/docking/DockingPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;AAE1D;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE;IAuCjK,4DAA4D;IACrD,KAAK,IAAI,YAAY;IAoB5B,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,QAAQ,IAAI,MAAM,EAAE,GAAG,SAAS,CAEnC;IAED,2FAA2F;IACpF,MAAM,CAAC,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAMjE,MAAM,IAAI,IAAI;IAMrB,wEAAwE;IACjE,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAI1C,IAAI,IAAI,IAAI,YAAY,GAAG,SAAS,CAEnC;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,74 @@
1
+ import { Vector2 } from '../core/vectors';
2
+ import { DockingPointSvgLine, MinBorder } from '../svg/types';
3
+ import { DockingPoint } from './DockingPoint';
4
+ import { PlannerElement2D, RedockablePlannerElement2D } from './PlannerElement2D';
5
+ import { DockingConfig } from './types';
6
+ /** A dockable pair found by an area search, with its ground-plane distance in cm. */
7
+ export interface DockablePair {
8
+ sourceDP: DockingPoint;
9
+ targetDP: DockingPoint;
10
+ distance: number;
11
+ }
12
+ /** Stateless docking domain logic: AV line parsing, pairing rules and dock/undock bookkeeping. */
13
+ export declare class DockingPointHandler {
14
+ /** Clockwise rotation in degrees of the vector pos1 -> pos2, where 0 points downwards: down 0, left 90, up 180, right 270. */
15
+ getRotOfDP(pos1: Vector2, pos2: Vector2): number;
16
+ /** The counterpart type a docking point type pairs with: AVR<->AVL, AVO<->AVU, AVS<->AVN, AVC<->AVC. */
17
+ getReferenceDPType(dpType: string): string;
18
+ sortDockingPoints(dir: 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT', dockingPoints: DockingPoint[]): DockingPoint[];
19
+ private checkDPAVLFilterDoMatch;
20
+ private checkDPAVRFilterDoMatch;
21
+ /**
22
+ * The central pairing gate: connector filters, counterpart type, both points free, layer inequality
23
+ * (with the catalog overrides ignoreLayerAVC / ignoreLayerAVOAVU / ignoreLayerAVNAVS) and number equality.
24
+ */
25
+ checkDPsDoMatch(dp1: DockingPoint, dp2: DockingPoint, sourcePlannerElement: PlannerElement2D, targetElement: PlannerElement2D): boolean;
26
+ private doDock;
27
+ /**
28
+ * (Re-)initializes all docking points of an element from its SVG AV lines: saves the current docking state for
29
+ * later redocking, converts line coordinates to minBorder-corrected cm and derives each point's rotation.
30
+ */
31
+ initDockingPointsFromSvg(plannerElement: PlannerElement2D, dockingVectors: DockingPointSvgLine[], minBorder: MinBorder, plannerConfig: DockingConfig): void;
32
+ /** Removes all docking relations of the element, also on the docked counterparts (used when deleting an element). */
33
+ removeDockingPointRelations(plannerElement: PlannerElement2D): void;
34
+ /**
35
+ * Removes all docking relations of the given types, also on the docked counterparts.
36
+ * @returns the element ids that lost a relation
37
+ */
38
+ removeDockingPointRelationsByType(plannerElement: PlannerElement2D, dpTypeList: string[]): number[];
39
+ /**
40
+ * Searches all dockable pairs between the source element and the targets within the given ground-plane distance,
41
+ * keeping only the nearest pair per source docking point type.
42
+ * @param autoDockingDistance 0 -> never dock, Infinity -> dock at any distance
43
+ */
44
+ searchDockableElementsInArea(sourceElement: PlannerElement2D, targetElements: PlannerElement2D[], autoDockingDistance: number): Map<string, DockablePair>;
45
+ /**
46
+ * Tries to dock the source element with a docking point of the given type onto any of the target elements.
47
+ * Non-accessories never dock onto foreign accessories; accessories only dock onto articles listing their codex.
48
+ * @returns the docked source docking point, or false
49
+ */
50
+ tryDockElement(sourcePlannerElement: PlannerElement2D, sourceDPType: string, targetElements: PlannerElement2D[]): DockingPoint | false;
51
+ /**
52
+ * Tries to dock the source element onto one specific docking point of the target element.
53
+ * @returns the docked source docking point, or false
54
+ */
55
+ tryDockElementToDP(sourcePlannerElement: PlannerElement2D, targetElement: PlannerElement2D, targetDP: DockingPoint): DockingPoint | false;
56
+ /** Tries to dock one specific pair of docking points. */
57
+ tryDockElementDPToDP(sourcePlannerElement: PlannerElement2D, targetElement: PlannerElement2D, sourceDP: DockingPoint, targetDP: DockingPoint): boolean;
58
+ /**
59
+ * Restores docking relations after one or more SVGs were reloaded, based on the state saved by
60
+ * saveCurrentDPState, including the fallback for changed docking point numbers.
61
+ * @returns the elements that lost their docking relation
62
+ */
63
+ updateDockingRelations(plannerElements: Map<number, RedockablePlannerElement2D>): RedockablePlannerElement2D[];
64
+ /**
65
+ * Docks the source's free docking point of the given type to the nearest matching point of the target element
66
+ * (used when initializing a planning where only the pair of elements and the type are known).
67
+ */
68
+ initDockingPointRelationByArea(sourcePlannerElement: PlannerElement2D, targetPlannerElement: PlannerElement2D, sourceDPType: string): void;
69
+ /** True when the two elements are docked to each other. */
70
+ checkElementsAreDocking(element1: PlannerElement2D, element2: PlannerElement2D): boolean;
71
+ }
72
+ /** Shared instance; the handler carries no state, so one serves all scenes. */
73
+ export declare const dockingPointHandler: DockingPointHandler;
74
+ //# sourceMappingURL=DockingPointHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DockingPointHandler.d.ts","sourceRoot":"","sources":["../../../../../src/docking/DockingPointHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,kGAAkG;AAClG,qBAAa,mBAAmB;IAC9B,8HAA8H;IACvH,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM;IAUvD,wGAAwG;IACjG,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAoB1C,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE;IAK/G,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,uBAAuB;IAgB/B;;;OAGG;IACI,eAAe,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,GAAG,OAAO;IAuC9I,OAAO,CAAC,MAAM;IAKd;;;OAGG;IACI,wBAAwB,CAC7B,cAAc,EAAE,gBAAgB,EAChC,cAAc,EAAE,mBAAmB,EAAE,EACrC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,GAC3B,IAAI;IA0BP,qHAAqH;IAC9G,2BAA2B,CAAC,cAAc,EAAE,gBAAgB,GAAG,IAAI;IAY1E;;;OAGG;IACI,iCAAiC,CAAC,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAe1G;;;;OAIG;IACI,4BAA4B,CACjC,aAAa,EAAE,gBAAgB,EAC/B,cAAc,EAAE,gBAAgB,EAAE,EAClC,mBAAmB,EAAE,MAAM,GAC1B,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC;IA6B5B;;;;OAIG;IACI,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,YAAY,GAAG,KAAK;IAsC7I;;;OAGG;IACI,kBAAkB,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,GAAG,KAAK;IAehJ,yDAAyD;IAClD,oBAAoB,CACzB,oBAAoB,EAAE,gBAAgB,EACtC,aAAa,EAAE,gBAAgB,EAC/B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,GACrB,OAAO;IAQV;;;;OAIG;IACI,sBAAsB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,GAAG,0BAA0B,EAAE;IAoDrH;;;OAGG;IACI,8BAA8B,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAqBjJ,2DAA2D;IACpD,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO;CAOhG;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { Vector3 } from '../core/vectors';
2
+ import { DockingPoint } from './DockingPoint';
3
+ /**
4
+ * The element surface the docking logic operates on. web-planner-logic's PlannerElementData satisfies it
5
+ * structurally; tests and the testbed use SimplePlannerElement.
6
+ */
7
+ export interface PlannerElement2D {
8
+ readonly ElementId: number;
9
+ readonly Layer: number;
10
+ readonly ArticleCodex: string;
11
+ readonly IsAccessoire: boolean | undefined;
12
+ readonly FilterAVL: string[];
13
+ readonly FilterAVR: string[];
14
+ getElementId(): number;
15
+ getParentElementId(): number | undefined;
16
+ getAccessoires(): string[];
17
+ getIsDockedAccessoire(): boolean;
18
+ saveCurrentDPState(): void;
19
+ clearAllDockingPoints(): void;
20
+ addDockingPoint(dockingPoint: DockingPoint): void;
21
+ getDockingPoints(): DockingPoint[];
22
+ getAllDockingPoints(): DockingPoint[];
23
+ getDockingPointsByType(type: string): DockingPoint[];
24
+ getFreeDockingPointsByType(type: string): DockingPoint[];
25
+ getDockingPointById(dpId: string): DockingPoint | undefined;
26
+ getDockingDockingPoints(): DockingPoint[];
27
+ getFilterAVL(): string[] | undefined;
28
+ getFilterAVR(): string[] | undefined;
29
+ getWorldPosOfDP(dpId: string): Vector3;
30
+ }
31
+ /** Additional surface needed to restore docking relations after an SVG reload. */
32
+ export interface RedockablePlannerElement2D extends PlannerElement2D {
33
+ readonly PosNr: number;
34
+ readonly IsDockedAccessoire: boolean;
35
+ getTempDockingPoints(): DockingPoint[];
36
+ clearTempDockingPoints(): void;
37
+ }
38
+ //# sourceMappingURL=PlannerElement2D.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlannerElement2D.d.ts","sourceRoot":"","sources":["../../../../../src/docking/PlannerElement2D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,IAAI,MAAM,CAAC;IACvB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAAC;IACzC,cAAc,IAAI,MAAM,EAAE,CAAC;IAC3B,qBAAqB,IAAI,OAAO,CAAC;IACjC,kBAAkB,IAAI,IAAI,CAAC;IAC3B,qBAAqB,IAAI,IAAI,CAAC;IAC9B,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClD,gBAAgB,IAAI,YAAY,EAAE,CAAC;IACnC,mBAAmB,IAAI,YAAY,EAAE,CAAC;IACtC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;IACrD,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;IACzD,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IAC5D,uBAAuB,IAAI,YAAY,EAAE,CAAC;IAC1C,YAAY,IAAI,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,YAAY,IAAI,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACxC;AAED,kFAAkF;AAClF,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,oBAAoB,IAAI,YAAY,EAAE,CAAC;IACvC,sBAAsB,IAAI,IAAI,CAAC;CAChC"}
@@ -0,0 +1,26 @@
1
+ import { Vector3 } from '../core/vectors';
2
+ import { DockingType } from '../svg/types';
3
+ import { DockingPoint } from './DockingPoint';
4
+ /** The subset of the catalog planner configuration the docking matcher evaluates; web-planner-logic's PlannerConfigParams stays structurally assignable to it. */
5
+ export interface DockingConfig {
6
+ ignoreLayerAVC: boolean;
7
+ ignoreLayerAVOAVU: boolean;
8
+ ignoreLayerAVNAVS: boolean;
9
+ ignoreDockingNumber: boolean;
10
+ }
11
+ /** Raw state of a docking point. */
12
+ export interface DockingPointData {
13
+ dpId: string;
14
+ elementId: number;
15
+ type: DockingType;
16
+ name: string;
17
+ ignoreLayer: boolean;
18
+ number?: number;
19
+ localWorldPos: Vector3;
20
+ rotDeg: number;
21
+ isDocking: boolean;
22
+ onElementId?: number;
23
+ onDP?: DockingPoint;
24
+ dpFilter?: string[];
25
+ }
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/docking/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,kKAAkK;AAClK,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB"}
@@ -0,0 +1,29 @@
1
+
2
+
3
+ export { UNIT_RECALC } from './core/units';
4
+ export { Vector2, Vector3 } from './core/vectors';
5
+ export { setPlanner2DLogger, getPlanner2DLogger } from './core/logger';
6
+ export type { Planner2DLogger } from './core/logger';
7
+ export { configureDom, parseXml, serializeXml } from './svg/dom';
8
+ export type { DomServices } from './svg/dom';
9
+ export { DOCKING_TYPES, isDockingType } from './svg/types';
10
+ export type { DockingType, DockingPointSvgLine, RectGeometry, BoundingBox, MinBorder } from './svg/types';
11
+ export { getDockingPointLines, getPolygonPoints, getBoundingBoxOfPoints, getOlfGeometry, getOltGeometry, removeOlf, removeMask, getMinBorder, getContentBounds, getRootSize, } from './svg/articleSvgParser';
12
+ export { parsePathCommands, pathBoundingBox } from './svg/pathBoundingBox';
13
+ export type { PathBounds, PathCommand } from './svg/pathBoundingBox';
14
+ export { stretchArticleSvg } from './stretch/stretchArticleSvg';
15
+ export type { StretchOptions, StretchResult, StretchSizes } from './stretch/types';
16
+ export { DockingPoint } from './docking/DockingPoint';
17
+ export type { DockingConfig, DockingPointData } from './docking/types';
18
+ export type { PlannerElement2D, RedockablePlannerElement2D } from './docking/PlannerElement2D';
19
+ export { DockingPointHandler, dockingPointHandler } from './docking/DockingPointHandler';
20
+ export type { DockablePair } from './docking/DockingPointHandler';
21
+ export { computeDockedTransform } from './transform/computeDockedTransform';
22
+ export type { DockTransformElement, DockedTransform } from './transform/computeDockedTransform';
23
+ export { segmentsIntersect, polygonEdgesIntersect, polygonInsidePolygon, outlinesCollide } from './collision/geometry';
24
+ export { SimplePlannerElement } from './testbed/SimplePlannerElement';
25
+ export type { SimpleArticleData } from './testbed/SimplePlannerElement';
26
+ export { DockingScene } from './testbed/DockingScene';
27
+ export type { DockingSceneOptions, DockAttempt, DockedPair } from './testbed/DockingScene';
28
+ //# sourceMappingURL=index.d.ts.map
29
+
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3E,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzF,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAEhG,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { StretchAxis } from './types';
2
+ /** Per-axis parameter routing for an absolute path command. */
3
+ export interface AxisPathShift {
4
+ /** Param index that is compared against the stretch-area start and tracked as the running coordinate. */
5
+ track: number;
6
+ /** Param indices shifted when the command lies beyond the stretch-area start. */
7
+ shift: number[];
8
+ }
9
+ /** Per-axis routing for a relative path command, including the legacy branch quirks. */
10
+ export interface AxisRelativePathShift {
11
+ /** Param index whose value advances the running coordinate. */
12
+ help: number;
13
+ shift: number[];
14
+ /** Legacy quirk: the SAH m/l/h branch additionally requires a non-negative delta for the forward shift; SAV does not. */
15
+ requireNonNegativeForward: boolean;
16
+ /** Legacy quirk: the backward condition probes this literal param index (param 0 even for y-axis curves). */
17
+ backwardProbe: number;
18
+ /** Legacy quirk: the SAH c branch shifts forward (+1) even in the backward case; every other branch shifts backward (-1). */
19
+ backwardSign: 1 | -1;
20
+ }
21
+ /** Everything the element and path transformers need to work on one axis ('x' = SAH passes, 'y' = SAV passes). */
22
+ export interface AxisSpec {
23
+ axis: StretchAxis;
24
+ pos: 'x' | 'y';
25
+ size: 'width' | 'height';
26
+ linePoint1: 'x1' | 'y1';
27
+ linePoint2: 'x2' | 'y2';
28
+ pointKey: 'x' | 'y';
29
+ absolute: {
30
+ [commandLetter: string]: AxisPathShift;
31
+ };
32
+ relative: {
33
+ [commandLetter: string]: AxisRelativePathShift;
34
+ };
35
+ }
36
+ export declare const HORIZONTAL_AXIS: AxisSpec;
37
+ export declare const VERTICAL_AXIS: AxisSpec;
38
+ //# sourceMappingURL=axis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/axis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,yGAAyG;IACzG,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wFAAwF;AACxF,MAAM,WAAW,qBAAqB;IACpC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yHAAyH;IACzH,yBAAyB,EAAE,OAAO,CAAC;IACnC,6GAA6G;IAC7G,aAAa,EAAE,MAAM,CAAC;IACtB,6HAA6H;IAC7H,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACtB;AAED,kHAAkH;AAClH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC;IACf,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,GAAG,GAAG,GAAG,CAAC;IACpB,QAAQ,EAAE;QAAE,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAC;IACrD,QAAQ,EAAE;QAAE,CAAC,aAAa,EAAE,MAAM,GAAG,qBAAqB,CAAA;KAAE,CAAC;CAC9D;AAED,eAAO,MAAM,eAAe,EAAE,QA4B7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QA2B3B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { StretchState } from './types';
2
+ export type StretchPassMode = 'SAH' | 'SAV' | 'GLOBAL_SCALE';
3
+ /**
4
+ * One resize pass over the DOM: OLT passes ignore the OLF/VIF subtrees, OLF passes ignore OLT/VIT —
5
+ * geometry outside those subtrees is deliberately processed in BOTH passes.
6
+ */
7
+ export declare function applyStretchPass(state: StretchState, mode: StretchPassMode, outline: 'OLT' | 'OLF'): void;
8
+ //# sourceMappingURL=elementTransform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementTransform.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/elementTransform.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,cAAc,CAAC;AAgJ7D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAczG"}
@@ -0,0 +1,19 @@
1
+ import { StretchState } from './types';
2
+ /** ViewBox-to-attribute scale of the root element (1:1 for planner-conform articles). */
3
+ export interface ViewBoxScale {
4
+ x: number;
5
+ y: number;
6
+ }
7
+ /** Derives missing width/height from the viewBox, normalizes units and defaults the viewBox. */
8
+ export declare function normalizeRootSize(root: Element): void;
9
+ export declare function viewBoxScaleFactor(root: Element): ViewBoxScale;
10
+ /** Rewrites the viewBox with ceiled root size and origin. */
11
+ export declare function rewriteViewBoxToCeiledInts(root: Element): void;
12
+ /**
13
+ * Scales all drawing geometry from viewBox units into root-attribute units. Every element — SAH/SAV rects
14
+ * included — is scaled exactly once, unlike the legacy engine, which double-scaled the stretch-area rects.
15
+ */
16
+ export declare function applyViewBoxScale(state: StretchState, scale: ViewBoxScale): void;
17
+ /** Tags the technical group as TE when missing and hides every TE group. */
18
+ export declare function ensureTeDisplayNone(document: Document): void;
19
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/normalize.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,yFAAyF;AACzF,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AASD,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAerD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAQ9D;AAED,6DAA6D;AAC7D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAS9D;AA4DD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CA+BhF;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAa5D"}
@@ -0,0 +1,17 @@
1
+ import { AxisSpec } from './axis';
2
+ /** One stretch area projected onto the active axis; end is pre-rounded, as the legacy engine rounded it. */
3
+ export interface StretchAreaRange {
4
+ begin: number;
5
+ end: number;
6
+ }
7
+ type WarnFn = (message: string) => void;
8
+ /**
9
+ * Applies the stretch-area shifts of one axis to a path `d` attribute, including the legacy relative-command
10
+ * quirks. Commands that do not move the pen along this axis (H/h vertically, V/v horizontally, Z/z) carry no
11
+ * mapping and are skipped; the parser has already rejected anything that is not a valid SVG command.
12
+ */
13
+ export declare function stretchPathData(d: string, areas: StretchAreaRange[], axis: AxisSpec, warn: WarnFn): string;
14
+ /** Scales all path coordinates by per-axis factors — rounded for the global-scale mode, unrounded for the viewBox normalization. */
15
+ export declare function scalePathData(d: string, widthFactor: number, heightFactor: number, roundResults: boolean, warn: WarnFn): string;
16
+ export {};
17
+ //# sourceMappingURL=pathTransform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathTransform.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/pathTransform.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIlC,4GAA4G;AAC5G,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAoCxC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA+B1G;AAED,oIAAoI;AACpI,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAiB/H"}
@@ -0,0 +1,12 @@
1
+ export interface PolygonPoint {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ /**
6
+ * Polygon `points` tokenizer: the pair separator is ',' when the string contains one, ' ' otherwise, so both
7
+ * "x,y x,y" and "x y x y" parse. An all-comma list keeps the legacy misparse on purpose.
8
+ */
9
+ export declare function parsePolygonPoints(pointsText: string): PolygonPoint[];
10
+ /** Legacy points format: "x,y " pairs with a trailing space. */
11
+ export declare function serializePolygonPoints(points: PolygonPoint[]): string;
12
+ //# sourceMappingURL=points.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"points.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/points.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,EAAE,CA0BrE;AAED,gEAAgE;AAChE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAIrE"}
@@ -0,0 +1,7 @@
1
+ import { StretchState } from './types';
2
+ /**
3
+ * Lays the stretch areas out for the new size (SAV first, then SAH) and runs the element passes; in
4
+ * global-scale mode it scales instead. Called once for the OLT and, when present, once for the OLF.
5
+ */
6
+ export declare function resizeOutline(state: StretchState, newWidth: number, newHeight: number, outline: 'OLT' | 'OLF'): void;
7
+ //# sourceMappingURL=resize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/resize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAYvC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CA6CpH"}
@@ -0,0 +1,5 @@
1
+ /** Coordinate rounding to 3 decimals — every transformed coordinate goes through this. */
2
+ export declare function round3(value: number): number;
3
+ /** Result rounding to 2 decimals — used for the root size and the viewBox. */
4
+ export declare function round2(value: number): number;
5
+ //# sourceMappingURL=rounding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/rounding.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,8EAA8E;AAC9E,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C"}
@@ -0,0 +1,7 @@
1
+ import { StretchSizes, StretchState } from './types';
2
+ /** Creates the initial pipeline state for one stretch run. */
3
+ export declare function createStretchState(document: Document, root: Element, useGlobalScale: boolean, targetWidthOlt: number, targetHeightOlt: number): StretchState;
4
+ /** Records a warning once (deduplicated per run) and mirrors it to the package logger. */
5
+ export declare function addWarning(state: StretchState, message: string): void;
6
+ export declare function currentSizes(state: StretchState): StretchSizes;
7
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErD,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,OAAO,EACb,cAAc,EAAE,OAAO,EACvB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,GACtB,YAAY,CA8Bd;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAKrE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAE9D"}
@@ -0,0 +1,7 @@
1
+ import { StretchState } from './types';
2
+ /**
3
+ * Collects and normalizes the SAH/SAV areas, measures OLT/OLF, sorts the areas by position, derives their
4
+ * stretch ratios and zeroes their sizes — the resize passes re-grow them by the delta.
5
+ */
6
+ export declare function prepareStretchGeometry(state: StretchState): void;
7
+ //# sourceMappingURL=stretchAreas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stretchAreas.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/stretchAreas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA+IvC;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAyChE"}
@@ -0,0 +1,10 @@
1
+ import { StretchOptions, StretchResult } from './types';
2
+ /**
3
+ * Stretches a planner article SVG to the given OLT target size (cm) by widening its SAH/SAV stretch areas,
4
+ * or by scaling uniformly with `useGlobalScale`. Behavior-faithful to the legacy ccCheckStretchAreas engine
5
+ * including its OLT-then-OLF double pass and rounding rules. Deliberate deviations — unknown path commands
6
+ * survive untransformed, unsupported stretch-area elements are ignored, viewBox-scaled documents are
7
+ * normalized exactly once — are reported in `warnings`.
8
+ */
9
+ export declare function stretchArticleSvg(svg: string, targetWidthCm: number, targetDepthCm: number, options?: StretchOptions): StretchResult;
10
+ //# sourceMappingURL=stretchArticleSvg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stretchArticleSvg.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/stretchArticleSvg.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,CA+BxI"}
@@ -0,0 +1,54 @@
1
+ /** Options of the stretch engine. */
2
+ export interface StretchOptions {
3
+ /** Scale the whole drawing uniformly instead of widening only the SAH/SAV stretch areas. */
4
+ useGlobalScale?: boolean;
5
+ /** Minimum x coordinate of the article geometry, used to correct the output viewBox. Default 0. */
6
+ minBorderX?: number;
7
+ /** Minimum y coordinate of the article geometry, used to correct the output viewBox. Default 0. */
8
+ minBorderY?: number;
9
+ }
10
+ /** Final outline sizes in SVG user units; an axis that was not stretched keeps its original size. */
11
+ export interface StretchSizes {
12
+ widthOLT: number;
13
+ heightOLT: number;
14
+ widthOLF: number;
15
+ heightOLF: number;
16
+ }
17
+ /** Result of stretchArticleSvg: the rewritten SVG, the outline sizes and every noteworthy engine observation. */
18
+ export interface StretchResult {
19
+ svg: string;
20
+ sizes: StretchSizes;
21
+ warnings: string[];
22
+ }
23
+ export type StretchAxis = 'x' | 'y';
24
+ /** Mutable pipeline state shared by the stretch stages. */
25
+ export interface StretchState {
26
+ document: Document;
27
+ root: Element;
28
+ useGlobalScale: boolean;
29
+ /** Target OLT size in SVG user units. */
30
+ targetWidthOlt: number;
31
+ targetHeightOlt: number;
32
+ widthOlt: number;
33
+ heightOlt: number;
34
+ widthOlf: number;
35
+ heightOlf: number;
36
+ startWidthOlt: number;
37
+ startHeightOlt: number;
38
+ startWidthOlf: number;
39
+ startHeightOlf: number;
40
+ hasOlf: boolean;
41
+ deltaOlfWidth: number;
42
+ deltaOlfHeight: number;
43
+ origOltWidth: number;
44
+ origOltHeight: number;
45
+ sah: Element[];
46
+ sav: Element[];
47
+ ratioSah: number[];
48
+ ratioSav: number[];
49
+ globalScaleFactorWidth: number;
50
+ globalScaleFactorHeight: number;
51
+ warnings: string[];
52
+ warned: Set<string>;
53
+ }
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qGAAqG;AACrG,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,iHAAiH;AACjH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,CAAC;AAEpC,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,EAAE,CAAC;IACf,GAAG,EAAE,OAAO,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACrB"}
@@ -0,0 +1,7 @@
1
+ import { StretchState } from './types';
2
+ /**
3
+ * Writes the stretched extent (max of OLT and OLF span) into the root size, shifts the viewBox origin by the
4
+ * minBorder and mirrors the viewBox into enable-background/style.
5
+ */
6
+ export declare function fixViewBox(state: StretchState, minBorderX: number, minBorderY: number): void;
7
+ //# sourceMappingURL=viewBoxFix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewBoxFix.d.ts","sourceRoot":"","sources":["../../../../../src/stretch/viewBoxFix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAiC5F"}