@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.
- package/README.md +44 -0
- package/build/cjs/index.js +3402 -0
- package/build/esm/index.js +3357 -0
- package/build/types/planner-2d-core/src/collision/geometry.d.ts +21 -0
- package/build/types/planner-2d-core/src/collision/geometry.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/core/logger.d.ts +12 -0
- package/build/types/planner-2d-core/src/core/logger.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/core/units.d.ts +6 -0
- package/build/types/planner-2d-core/src/core/units.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/core/vectors.d.ts +35 -0
- package/build/types/planner-2d-core/src/core/vectors.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/docking/DockingPoint.d.ts +38 -0
- package/build/types/planner-2d-core/src/docking/DockingPoint.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/docking/DockingPointHandler.d.ts +74 -0
- package/build/types/planner-2d-core/src/docking/DockingPointHandler.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/docking/PlannerElement2D.d.ts +38 -0
- package/build/types/planner-2d-core/src/docking/PlannerElement2D.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/docking/types.d.ts +26 -0
- package/build/types/planner-2d-core/src/docking/types.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/index.d.ts +29 -0
- package/build/types/planner-2d-core/src/index.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/axis.d.ts +38 -0
- package/build/types/planner-2d-core/src/stretch/axis.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/elementTransform.d.ts +8 -0
- package/build/types/planner-2d-core/src/stretch/elementTransform.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/normalize.d.ts +19 -0
- package/build/types/planner-2d-core/src/stretch/normalize.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/pathTransform.d.ts +17 -0
- package/build/types/planner-2d-core/src/stretch/pathTransform.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/points.d.ts +12 -0
- package/build/types/planner-2d-core/src/stretch/points.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/resize.d.ts +7 -0
- package/build/types/planner-2d-core/src/stretch/resize.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/rounding.d.ts +5 -0
- package/build/types/planner-2d-core/src/stretch/rounding.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/state.d.ts +7 -0
- package/build/types/planner-2d-core/src/stretch/state.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/stretchAreas.d.ts +7 -0
- package/build/types/planner-2d-core/src/stretch/stretchAreas.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/stretchArticleSvg.d.ts +10 -0
- package/build/types/planner-2d-core/src/stretch/stretchArticleSvg.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/types.d.ts +54 -0
- package/build/types/planner-2d-core/src/stretch/types.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/stretch/viewBoxFix.d.ts +7 -0
- package/build/types/planner-2d-core/src/stretch/viewBoxFix.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/svg/articleSvgParser.d.ts +54 -0
- package/build/types/planner-2d-core/src/svg/articleSvgParser.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/svg/dom.d.ts +16 -0
- package/build/types/planner-2d-core/src/svg/dom.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/svg/pathBoundingBox.d.ts +19 -0
- package/build/types/planner-2d-core/src/svg/pathBoundingBox.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/svg/types.d.ts +32 -0
- package/build/types/planner-2d-core/src/svg/types.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/testbed/DockingScene.d.ts +47 -0
- package/build/types/planner-2d-core/src/testbed/DockingScene.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/testbed/SimplePlannerElement.d.ts +64 -0
- package/build/types/planner-2d-core/src/testbed/SimplePlannerElement.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/collision.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/collision.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/docking.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/docking.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/dockingScene.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/dockingScene.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/fixtures.d.ts +14 -0
- package/build/types/planner-2d-core/src/tests/fixtures.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/pathBoundingBox.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/pathBoundingBox.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/realArticleSvgs.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/realArticleSvgs.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/stretchDeviations.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/stretchDeviations.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/stretchRegression.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/stretchRegression.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/tests/svgParser.test.d.ts +2 -0
- package/build/types/planner-2d-core/src/tests/svgParser.test.d.ts.map +1 -0
- package/build/types/planner-2d-core/src/transform/computeDockedTransform.d.ts +24 -0
- package/build/types/planner-2d-core/src/transform/computeDockedTransform.d.ts.map +1 -0
- package/package.json +24 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Vector2 } from '../core/vectors';
|
|
2
|
+
import { BoundingBox, DockingPointSvgLine, MinBorder, RectGeometry } from './types';
|
|
3
|
+
/** All elements whose id starts with the given prefix, in document order. */
|
|
4
|
+
export declare function snapshotByIdPrefix(xmlDocument: Document, idPrefix: string): Element[];
|
|
5
|
+
/**
|
|
6
|
+
* Extracts all AV docking lines of an article SVG, AVL sorted first (the planner relies on that order).
|
|
7
|
+
* Throws for AV elements that are not `<line>`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDockingPointLines(content: string): DockingPointSvgLine[];
|
|
10
|
+
/**
|
|
11
|
+
* Returns the points of the single `<polygon>` whose id starts with idPrefix: undefined when zero or more
|
|
12
|
+
* than one id matches, empty array when the match is not a polygon.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPolygonPoints(content: string, idPrefix: string): Vector2[] | undefined;
|
|
15
|
+
export declare function getBoundingBoxOfPoints(points: Vector2[]): BoundingBox;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the OLF geometry from SVG attributes (untransformed) — rect, polygon and path.
|
|
18
|
+
* A `<g id="OLF…">` wrapper yields undefined: only shape elements are measured, never a group's children.
|
|
19
|
+
* Widening that would change which articles get an OLF offset.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getOlfGeometry(content: string): BoundingBox | undefined;
|
|
22
|
+
/** Returns the OLT geometry from SVG attributes (untransformed) — rect, polygon and path. A `<g id="OLT…">` wrapper yields undefined. */
|
|
23
|
+
export declare function getOltGeometry(content: string): RectGeometry | undefined;
|
|
24
|
+
/** Removes all VIF and OLF nodes so only the OLT view remains. */
|
|
25
|
+
export declare function removeOlf(content: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Removes `<mask>` elements and every node carrying a mask attribute. Uses DOM traversal rather than XPath
|
|
28
|
+
* because jsdom's XPath engine does not support local-name() comparisons.
|
|
29
|
+
*/
|
|
30
|
+
export declare function removeMask(content: string): string;
|
|
31
|
+
interface ElementBounds {
|
|
32
|
+
minX: number;
|
|
33
|
+
minY: number;
|
|
34
|
+
maxX: number;
|
|
35
|
+
maxY: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Minimum x/y over all non-AV geometry — the offset that docking-point coordinates are corrected by.
|
|
39
|
+
* `transform` attributes are not applied; an element carrying one is reported through the package logger
|
|
40
|
+
* rather than measured wrongly in silence.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getMinBorder(content: string): MinBorder;
|
|
43
|
+
/**
|
|
44
|
+
* Bounding box over ALL drawing geometry including AV lines — the ink extent of the article.
|
|
45
|
+
* This is not an article's width/depth: use {@link getRootSize} for that.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getContentBounds(content: string): ElementBounds | undefined;
|
|
48
|
+
/** The declared canvas size of the SVG root in user units — the value an article's width/depth is derived from. */
|
|
49
|
+
export declare function getRootSize(content: string): {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
} | undefined;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=articleSvgParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articleSvgParser.d.ts","sourceRoot":"","sources":["../../../../../src/svg/articleSvgParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAe,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKjG,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE,CAKrF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAuB3E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,SAAS,CAgBzF;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAMrE;AAoCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEvE;AAED,yIAAyI;AACzI,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAIxE;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUlD;AAgBD,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AA0HD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAQvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE3E;AAED,mHAAmH;AACnH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAO1F"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type XmlMimeType = 'application/xml' | 'image/svg+xml' | 'text/xml';
|
|
2
|
+
/** Minimal DOM services this package needs — satisfied by browser globals and by a jsdom window. */
|
|
3
|
+
export interface DomServices {
|
|
4
|
+
DOMParser: new () => {
|
|
5
|
+
parseFromString(content: string, mimeType: string): Document;
|
|
6
|
+
};
|
|
7
|
+
XMLSerializer?: new () => {
|
|
8
|
+
serializeToString(node: Node): string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** Provides the DOM implementation used for XML parsing. Optional in Node: without a call, jsdom is loaded lazily as fallback. */
|
|
12
|
+
export declare function configureDom(services: DomServices): void;
|
|
13
|
+
export declare function parseXml(content: string, mimeType?: XmlMimeType): Document;
|
|
14
|
+
export declare function serializeXml(document: Document): string;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../../src/svg/dom.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG,iBAAiB,GAAG,eAAe,GAAG,UAAU,CAAC;AAEpE,oGAAoG;AACpG,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,UAAU;QAAE,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAC;IACtF,aAAa,CAAC,EAAE,UAAU;QAAE,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC;CACrE;AAID,kIAAkI;AAClI,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAExD;AA0BD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,WAA+B,GAAG,QAAQ,CAG7F;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAIvD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface PathBounds {
|
|
2
|
+
minX: number;
|
|
3
|
+
minY: number;
|
|
4
|
+
maxX: number;
|
|
5
|
+
maxY: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PathCommand {
|
|
8
|
+
command: string;
|
|
9
|
+
params: number[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Tokenizes an SVG path `d` attribute into absolute/relative commands with their numeric parameters, covering
|
|
13
|
+
* the full command set, implicit command repetition, scientific notation and unspaced arc flags.
|
|
14
|
+
* Throws on unknown commands and malformed numbers.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parsePathCommands(d: string): PathCommand[];
|
|
17
|
+
/** Exact bounding box of an SVG path `d` attribute, honoring Bezier extrema and elliptical arcs. Undefined for empty path data. */
|
|
18
|
+
export declare function pathBoundingBox(d: string): PathBounds | undefined;
|
|
19
|
+
//# sourceMappingURL=pathBoundingBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathBoundingBox.d.ts","sourceRoot":"","sources":["../../../../../src/svg/pathBoundingBox.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAiBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAuD1D;AA+GD,mIAAmI;AACnI,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAqIjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Every connector type the planner knows. */
|
|
2
|
+
export declare const DOCKING_TYPES: readonly ["AVR", "AVL", "AVC", "AVO", "AVU", "AVS", "AVN"];
|
|
3
|
+
export type DockingType = (typeof DOCKING_TYPES)[number];
|
|
4
|
+
/** Narrows an untrusted string to a DockingType. */
|
|
5
|
+
export declare function isDockingType(value: unknown): value is DockingType;
|
|
6
|
+
/** A raw AV docking line as drawn in an article SVG (SVG user units, not yet minBorder-corrected). */
|
|
7
|
+
export interface DockingPointSvgLine {
|
|
8
|
+
x1: number;
|
|
9
|
+
y1: number;
|
|
10
|
+
x2: number;
|
|
11
|
+
y2: number;
|
|
12
|
+
dockingName: string;
|
|
13
|
+
dockingType: DockingType;
|
|
14
|
+
}
|
|
15
|
+
export interface RectGeometry {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
export interface BoundingBox {
|
|
22
|
+
minX: number;
|
|
23
|
+
minY: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}
|
|
27
|
+
/** Minimum x/y over all non-AV geometry of an SVG — the offset docking-point coordinates are corrected by. */
|
|
28
|
+
export interface MinBorder {
|
|
29
|
+
minX: number;
|
|
30
|
+
minY: number;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/svg/types.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,eAAO,MAAM,aAAa,4DAA6D,CAAC;AAExF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED,sGAAsG;AACtG,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8GAA8G;AAC9G,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Vector3 } from '../core/vectors';
|
|
2
|
+
import { DockingConfig } from '../docking/types';
|
|
3
|
+
import { DockingPoint } from '../docking/DockingPoint';
|
|
4
|
+
import { DockingType } from '../svg/types';
|
|
5
|
+
import { SimpleArticleData, SimplePlannerElement } from './SimplePlannerElement';
|
|
6
|
+
export interface DockingSceneOptions {
|
|
7
|
+
dockingConfig?: Partial<DockingConfig>;
|
|
8
|
+
}
|
|
9
|
+
export interface DockAttempt {
|
|
10
|
+
docked: boolean;
|
|
11
|
+
dockingType?: DockingType;
|
|
12
|
+
sourceDpId?: string;
|
|
13
|
+
targetDpId?: string;
|
|
14
|
+
rotDeg?: number;
|
|
15
|
+
worldPosCorner?: Vector3;
|
|
16
|
+
}
|
|
17
|
+
export interface DockedPair {
|
|
18
|
+
sourceElementId: number;
|
|
19
|
+
sourceDpId: string;
|
|
20
|
+
targetElementId: number;
|
|
21
|
+
targetDpId: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Standalone docking testbed: article SVGs in, docking points, pairings and world positions out. No catalog
|
|
25
|
+
* API, no browser, no engine. In Node a jsdom window is loaded lazily; configureDom is only needed for a custom DOM.
|
|
26
|
+
*/
|
|
27
|
+
export declare class DockingScene {
|
|
28
|
+
private readonly handler;
|
|
29
|
+
private readonly dockingConfig;
|
|
30
|
+
private readonly elements;
|
|
31
|
+
private nextElementId;
|
|
32
|
+
constructor(options?: DockingSceneOptions);
|
|
33
|
+
/** Parses the article SVG (docking lines, minBorder, OLT/OLF geometry) and adds it as a new element at the world origin. */
|
|
34
|
+
addArticle(svg: string, data?: SimpleArticleData): SimplePlannerElement;
|
|
35
|
+
getElement(elementId: number): SimplePlannerElement | undefined;
|
|
36
|
+
getElements(): SimplePlannerElement[];
|
|
37
|
+
/**
|
|
38
|
+
* Tries to dock the source element onto the target and, on success, moves the source to its docked world transform.
|
|
39
|
+
* Without an explicit sourceDpType all types are tried in planner order (AVL first).
|
|
40
|
+
*/
|
|
41
|
+
tryDock(source: SimplePlannerElement, target: SimplePlannerElement, sourceDpType?: DockingType): DockAttempt;
|
|
42
|
+
/** All free (not yet docked) docking points of the element. */
|
|
43
|
+
freeDockingPoints(element: SimplePlannerElement): DockingPoint[];
|
|
44
|
+
/** All docked pairs in the scene, one entry per relation; the source side is the element that docked onto the other. */
|
|
45
|
+
dockedPairs(): DockedPair[];
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=DockingScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DockingScene.d.ts","sourceRoot":"","sources":["../../../../../src/testbed/DockingScene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAWD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;IACpE,OAAO,CAAC,aAAa,CAAK;gBAEd,OAAO,CAAC,EAAE,mBAAmB;IAIzC,4HAA4H;IACrH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,oBAAoB;IAYvE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAI/D,WAAW,IAAI,oBAAoB,EAAE;IAI5C;;;OAGG;IACI,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,oBAAoB,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,WAAW;IAsBnH,+DAA+D;IACxD,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,EAAE;IAIvE,wHAAwH;IACjH,WAAW,IAAI,UAAU,EAAE;CAmBnC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Vector3 } from '../core/vectors';
|
|
2
|
+
import { DockingPoint } from '../docking/DockingPoint';
|
|
3
|
+
import { RedockablePlannerElement2D } from '../docking/PlannerElement2D';
|
|
4
|
+
import { DockTransformElement } from '../transform/computeDockedTransform';
|
|
5
|
+
/** Article-level data of a testbed element. */
|
|
6
|
+
export interface SimpleArticleData {
|
|
7
|
+
layer?: number;
|
|
8
|
+
articleCodex?: string;
|
|
9
|
+
isAccessoire?: boolean;
|
|
10
|
+
/** Accessory codices this article accepts. */
|
|
11
|
+
accessoires?: string[];
|
|
12
|
+
parentElementId?: number;
|
|
13
|
+
filterAVL?: string[];
|
|
14
|
+
filterAVR?: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reference implementation of the element surface the docking logic needs — no DivaSet, no engine.
|
|
18
|
+
* WorldPosCorner is the world position of the SVG's minBorder-corrected local origin, matching how docking
|
|
19
|
+
* point LocalWorldPos values are stored; the ignore-OLF corner tracks the OLT origin.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SimplePlannerElement implements RedockablePlannerElement2D, DockTransformElement {
|
|
22
|
+
readonly ElementId: number;
|
|
23
|
+
Layer: number;
|
|
24
|
+
ArticleCodex: string;
|
|
25
|
+
IsAccessoire: boolean;
|
|
26
|
+
FilterAVL: string[];
|
|
27
|
+
FilterAVR: string[];
|
|
28
|
+
PosNr: number;
|
|
29
|
+
IsDockedAccessoire: boolean;
|
|
30
|
+
RotDeg: number;
|
|
31
|
+
WorldPosCorner: Vector3;
|
|
32
|
+
WorldPosCornerIgnoreOLF: Vector3;
|
|
33
|
+
HasOLFPolygon: boolean;
|
|
34
|
+
private oltLeftCm;
|
|
35
|
+
private oltTopCm;
|
|
36
|
+
private parentElementId;
|
|
37
|
+
private accessoires;
|
|
38
|
+
private dockingPoints;
|
|
39
|
+
private tempDockingPoints;
|
|
40
|
+
constructor(elementId: number, data?: SimpleArticleData);
|
|
41
|
+
/** Registers the OLT origin offset within the OLF (cm) and flags the element as OLF-carrying. */
|
|
42
|
+
setupOlfOffset(oltLeftCm: number, oltTopCm: number): void;
|
|
43
|
+
getElementId(): number;
|
|
44
|
+
getParentElementId(): number;
|
|
45
|
+
getAccessoires(): string[];
|
|
46
|
+
getIsDockedAccessoire(): boolean;
|
|
47
|
+
saveCurrentDPState(): void;
|
|
48
|
+
clearAllDockingPoints(): void;
|
|
49
|
+
addDockingPoint(dockingPoint: DockingPoint): void;
|
|
50
|
+
getDockingPoints(): DockingPoint[];
|
|
51
|
+
getAllDockingPoints(): DockingPoint[];
|
|
52
|
+
getDockingPointsByType(type: string): DockingPoint[];
|
|
53
|
+
getFreeDockingPointsByType(type: string): DockingPoint[];
|
|
54
|
+
getDockingPointById(dpId: string): DockingPoint | undefined;
|
|
55
|
+
getDockingDockingPoints(): DockingPoint[];
|
|
56
|
+
getFilterAVL(): string[] | undefined;
|
|
57
|
+
getFilterAVR(): string[] | undefined;
|
|
58
|
+
getWorldPosOfDP(dpId: string): Vector3;
|
|
59
|
+
getTempDockingPoints(): DockingPoint[];
|
|
60
|
+
clearTempDockingPoints(): void;
|
|
61
|
+
getOltLeft(): number;
|
|
62
|
+
getOltTop(): number;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=SimplePlannerElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimplePlannerElement.d.ts","sourceRoot":"","sources":["../../../../../src/testbed/SimplePlannerElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,+CAA+C;AAC/C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,0BAA0B,EAAE,oBAAoB;IAC3F,SAAgB,SAAS,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,UAAS;IAC3B,MAAM,SAAK;IACX,cAAc,UAAwB;IACtC,uBAAuB,UAAwB;IAC/C,aAAa,UAAS;IAE7B,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,iBAAiB,CAAsB;gBAEnC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,iBAAiB;IAYvD,iGAAiG;IAC1F,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMzD,YAAY,IAAI,MAAM;IAItB,kBAAkB,IAAI,MAAM;IAI5B,cAAc,IAAI,MAAM,EAAE;IAI1B,qBAAqB,IAAI,OAAO;IAIhC,kBAAkB,IAAI,IAAI;IAK1B,qBAAqB,IAAI,IAAI;IAI7B,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAIjD,gBAAgB,IAAI,YAAY,EAAE;IAIlC,mBAAmB,IAAI,YAAY,EAAE;IAIrC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE;IAIpD,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE;IAIxD,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAI3D,uBAAuB,IAAI,YAAY,EAAE;IAIzC,YAAY,IAAI,MAAM,EAAE,GAAG,SAAS;IAIpC,YAAY,IAAI,MAAM,EAAE,GAAG,SAAS;IAIpC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOtC,oBAAoB,IAAI,YAAY,EAAE;IAItC,sBAAsB,IAAI,IAAI;IAI9B,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,MAAM;CAG3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collision.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/collision.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docking.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/docking.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dockingScene.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/dockingScene.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Wires the package's DOM adapter to jsdom, the setup a Node consumer uses. */
|
|
2
|
+
export declare function setupNodeDom(): void;
|
|
3
|
+
/** Builds a vertical AV `<line>` (planner convention: p1 at the back edge, pointing down = rotation 0). */
|
|
4
|
+
export declare function verticalConnector(name: string, xCm: number, y1Cm: number, y2Cm: number): string;
|
|
5
|
+
/** Builds a horizontal AV `<line>` from (x1Cm,yCm) to (x2Cm,yCm). */
|
|
6
|
+
export declare function horizontalConnector(name: string, y1Cm: number, x1Cm: number, x2Cm: number): string;
|
|
7
|
+
/** Minimal planner-conform article SVG: OLT rect spanning widthCm x depthCm plus the given extra markup. */
|
|
8
|
+
export declare function makeBoxSvg(widthCm: number, depthCm: number, extraMarkup?: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Planner article with separate OLT and (deeper) OLF outlines plus VIT/VIF view groups, exercising the
|
|
11
|
+
* OLT-then-OLF double pass. Extra markup lands outside the view groups, so it is processed in both passes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function makeOlfBoxSvg(widthCm: number, oltDepthCm: number, olfDepthCm: number, extraMarkup?: string[]): string;
|
|
14
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/tests/fixtures.ts"],"names":[],"mappings":"AAIA,gFAAgF;AAChF,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAED,2GAA2G;AAC3G,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG/F;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGlG;AAED,4GAA4G;AAC5G,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,MAAM,EAAO,GAAG,MAAM,CAS/F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAE,MAAM,EAAO,GAAG,MAAM,CAazH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathBoundingBox.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/pathBoundingBox.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realArticleSvgs.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/realArticleSvgs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stretchDeviations.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/stretchDeviations.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stretchRegression.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/stretchRegression.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgParser.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/svgParser.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Vector3 } from '../core/vectors';
|
|
2
|
+
import { DockingPoint } from '../docking/DockingPoint';
|
|
3
|
+
/** The transform-relevant surface of a planner element. */
|
|
4
|
+
export interface DockTransformElement {
|
|
5
|
+
readonly RotDeg: number;
|
|
6
|
+
readonly HasOLFPolygon: boolean;
|
|
7
|
+
readonly WorldPosCorner: Vector3;
|
|
8
|
+
readonly WorldPosCornerIgnoreOLF: Vector3;
|
|
9
|
+
getOltLeft(): number;
|
|
10
|
+
getOltTop(): number;
|
|
11
|
+
}
|
|
12
|
+
export interface DockedTransform {
|
|
13
|
+
rotDeg: number;
|
|
14
|
+
worldPosCorner: Vector3;
|
|
15
|
+
worldPosCornerIgnoreOLF: Vector3;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* World transform of an element after docking its point `dp` onto `refDP` of `refElement`: the rotation is
|
|
19
|
+
* refElement.RotDeg + refDP.RotDeg - dp.RotDeg, the position aligns the two docking points via their rotated
|
|
20
|
+
* local vectors. A docking point's LocalWorldPos is OLF-corner-relative when the element has an OLF polygon,
|
|
21
|
+
* hence the OLT-corner conversion for the ignore-OLF variant.
|
|
22
|
+
*/
|
|
23
|
+
export declare function computeDockedTransform(refElement: DockTransformElement, refDP: DockingPoint, element: Pick<DockTransformElement, 'HasOLFPolygon' | 'getOltLeft' | 'getOltTop'>, dp: DockingPoint): DockedTransform;
|
|
24
|
+
//# sourceMappingURL=computeDockedTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeDockedTransform.d.ts","sourceRoot":"","sources":["../../../../../src/transform/computeDockedTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,UAAU,IAAI,MAAM,CAAC;IACrB,SAAS,IAAI,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,oBAAoB,EAChC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,eAAe,GAAG,YAAY,GAAG,WAAW,CAAC,EACjF,EAAE,EAAE,YAAY,GACf,eAAe,CA+BjB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crystaldesign/planner-2d-core",
|
|
3
|
+
"version": "26.11.0-beta.10",
|
|
4
|
+
"description": "Browser-free 2D planner core: article SVG parsing, docking logic, dock transform math and collision geometry.",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"w3c-xmlserializer": "5.0.0"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@types/jsdom": "^21.1.7",
|
|
10
|
+
"@types/w3c-xmlserializer": "2.0.4",
|
|
11
|
+
"jsdom": "25.0.0"
|
|
12
|
+
},
|
|
13
|
+
"jest-junit": {
|
|
14
|
+
"suiteName": "planner-2d-core testroutine",
|
|
15
|
+
"outputDirectory": "./test-reports"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"author": "",
|
|
19
|
+
"license": "COMMERCIAL",
|
|
20
|
+
"types": "./build/types/planner-2d-core/src/index.d.ts",
|
|
21
|
+
"module": "build/esm/index.js",
|
|
22
|
+
"main": "build/cjs/index.js",
|
|
23
|
+
"gitHead": "bf07fea8ef9c1c73dba6edb99c11e92589ffafe0"
|
|
24
|
+
}
|