@sentropic/diagram-canvas 0.3.2 → 0.4.0

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 (49) hide show
  1. package/README.md +21 -0
  2. package/dist/camera.d.ts +24 -3
  3. package/dist/camera.js +31 -8
  4. package/dist/index.d.ts +4 -0
  5. package/dist/index.js +4 -0
  6. package/dist/layout/cache.js +12 -2
  7. package/dist/layout/channels.d.ts +10 -0
  8. package/dist/layout/channels.js +13 -0
  9. package/dist/layout/conventions.d.ts +117 -0
  10. package/dist/layout/conventions.js +185 -0
  11. package/dist/layout/dock.d.ts +2 -0
  12. package/dist/layout/dock.js +5 -1
  13. package/dist/layout/fingerprint.d.ts +4 -2
  14. package/dist/layout/fingerprint.js +26 -2
  15. package/dist/layout/hints.d.ts +1 -1
  16. package/dist/layout/hints.js +10 -3
  17. package/dist/layout/index.d.ts +5 -3
  18. package/dist/layout/index.js +5 -3
  19. package/dist/layout/measure.d.ts +6 -0
  20. package/dist/layout/measure.js +28 -0
  21. package/dist/layout/measured.js +1047 -95
  22. package/dist/layout/route.d.ts +27 -1
  23. package/dist/layout/route.js +640 -32
  24. package/dist/layout/routeSpacing.d.ts +84 -0
  25. package/dist/layout/routeSpacing.js +472 -0
  26. package/dist/layout/spacing.generated.d.ts +10 -1
  27. package/dist/layout/spacing.generated.js +10 -1
  28. package/dist/layout/types.d.ts +33 -2
  29. package/dist/layout/types.js +2 -0
  30. package/dist/presentation/connectorPath.d.ts +32 -0
  31. package/dist/presentation/connectorPath.js +213 -0
  32. package/dist/presentation/connectorStyle.d.ts +70 -0
  33. package/dist/presentation/connectorStyle.js +99 -0
  34. package/dist/presentation/diagramSceneModel.d.ts +56 -4
  35. package/dist/presentation/diagramSceneModel.js +222 -31
  36. package/dist/presentation/diagramSceneTypes.d.ts +9 -0
  37. package/dist/presentation/index.d.ts +4 -0
  38. package/dist/presentation/index.js +4 -0
  39. package/dist/presentation/linkLegend.d.ts +132 -0
  40. package/dist/presentation/linkLegend.js +231 -0
  41. package/dist/presentation/renderSceneSvg.d.ts +3 -1
  42. package/dist/presentation/renderSceneSvg.js +81 -11
  43. package/dist/presentation/sceneLabelClearance.d.ts +1 -1
  44. package/dist/presentation/sceneLabelClearance.js +19 -3
  45. package/dist/r7Mode.d.ts +13 -0
  46. package/dist/r7Mode.js +67 -0
  47. package/dist/visibility.d.ts +1 -1
  48. package/dist/visibility.js +3 -2
  49. package/package.json +2 -2
@@ -98,10 +98,17 @@ export interface RouteOutcome {
98
98
  }
99
99
  /** L-R9 applies to full dock-to-dock routes, including clearance joins. */
100
100
  export declare function routesConflict(left: readonly Vec2[], right: readonly Vec2[]): boolean;
101
+ /**
102
+ * Subdivide a clear corridor `[low, high]` (between two consecutive grown
103
+ * boundaries) into parallel routing tracks spaced by at least `routeSpacing`.
104
+ * Always deterministic and symmetric around the corridor midpoint.
105
+ */
106
+ export declare function subdivideChannelTracks(low: number, high: number, routeSpacing: number): number[];
101
107
  /**
102
108
  * BF-6: try horizontal label channels without changing any box or gutter.
103
109
  * Dock joins keep their outward normals. Every full candidate is checked
104
- * against raw obstacles, containment and the other routes of its pair.
110
+ * against raw obstacles, containment, same-pair bans and optional minimum
111
+ * route spacing / border clearance.
105
112
  */
106
113
  export declare function labelDetour(input: {
107
114
  readonly request: RouteRequest;
@@ -110,6 +117,14 @@ export declare function labelDetour(input: {
110
117
  readonly xs: readonly number[];
111
118
  readonly ys: readonly number[];
112
119
  readonly accepts: (points: readonly Vec2[]) => boolean;
120
+ /** Dock exit stub length (defaults to 2 for legacy callers; measured layout passes `borderClearance`). */
121
+ readonly step?: number;
122
+ /** All other fixed routes to preserve cross-pair spacing against when `routeSpacing > 0`. */
123
+ readonly allFixed?: readonly (readonly Vec2[])[];
124
+ readonly routeSpacing?: number;
125
+ readonly borderClearance?: number;
126
+ /** Expanded ancestor zone rects whose parallel borders must keep `borderClearance` (crossings allowed). */
127
+ readonly passableZones?: readonly Rect[];
113
128
  }): readonly Vec2[] | undefined;
114
129
  /** Remove repeated and collinear points. */
115
130
  export declare function simplifyRoute(points: readonly Vec2[]): Vec2[];
@@ -119,6 +134,15 @@ export declare function routeEdges(input: {
119
134
  readonly rects: ReadonlyMap<EntityRef, Rect>;
120
135
  readonly requests: readonly RouteRequest[];
121
136
  readonly clearance: number;
137
+ /**
138
+ * Minimum world-unit spacing between parallel segments and neighbouring elbows
139
+ * across all routes (DE-2 ask 2). When positive, channels are subdivided into
140
+ * parallel tracks at this pitch and A* runs a strict-spacing tier before
141
+ * falling back to cross-pair relaxation if capacity is exhausted.
142
+ */
143
+ readonly routeSpacing?: number;
144
+ /** Inflation applied to `barriers` (title bands); defaults to `clearance`. */
145
+ readonly barrierClearance?: number;
122
146
  /**
123
147
  * Rectangles no route may cross, whatever its ends: they belong to no
124
148
  * entity, so no request can list them as passable. The row-pack path passes
@@ -138,5 +162,7 @@ export declare function routeEdges(input: {
138
162
  };
139
163
  /** Measured layouts avoid raw interiors even when routing is obstructed. */
140
164
  readonly avoidFallbackInteriors?: boolean;
165
+ /** Optional priority subset routed before other requests (deterministic conflict repair). */
166
+ readonly priority?: ReadonlySet<RelationRef>;
141
167
  }): RouteOutcome;
142
168
  //# sourceMappingURL=route.d.ts.map