@sentropic/diagram-canvas 0.1.0 → 0.2.2
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 +9 -0
- package/contracts/diagram-anatomy.v1.json +2073 -0
- package/dist/camera.d.ts +12 -7
- package/dist/camera.js +18 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/layout/bundleLabel.d.ts +12 -0
- package/dist/layout/bundleLabel.js +16 -0
- package/dist/layout/cache.js +7 -7
- package/dist/layout/channels.d.ts +28 -0
- package/dist/layout/channels.js +14 -0
- package/dist/layout/dock.d.ts +1 -0
- package/dist/layout/dock.js +18 -37
- package/dist/layout/engine.js +4 -4
- package/dist/layout/erd.d.ts +5 -0
- package/dist/layout/erd.js +85 -0
- package/dist/layout/fingerprint.d.ts +2 -2
- package/dist/layout/fingerprint.js +6 -2
- package/dist/layout/flow-order.d.ts +3 -0
- package/dist/layout/flow-order.js +14 -0
- package/dist/layout/flows.d.ts +89 -0
- package/dist/layout/flows.js +120 -0
- package/dist/layout/graph.d.ts +2 -0
- package/dist/layout/graph.js +5 -2
- package/dist/layout/hints.js +7 -6
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/layout/labels.d.ts +1 -0
- package/dist/layout/labels.js +1 -1
- package/dist/layout/measure.d.ts +3 -3
- package/dist/layout/measure.js +5 -3
- package/dist/layout/measured.js +406 -75
- package/dist/layout/route.d.ts +2 -0
- package/dist/layout/route.js +2 -70
- package/dist/layout/sceneMeasure.d.ts +13 -0
- package/dist/layout/sceneMeasure.js +57 -0
- package/dist/layout/spacing.generated.d.ts +13 -0
- package/dist/layout/spacing.generated.js +8 -0
- package/dist/layout/types.d.ts +33 -4
- package/dist/layout/types.js +4 -10
- package/dist/presentation/diagramCardModel.d.ts +660 -0
- package/dist/presentation/diagramCardModel.js +1150 -0
- package/dist/presentation/diagramSceneModel.d.ts +70 -2
- package/dist/presentation/diagramSceneModel.js +165 -30
- package/dist/presentation/diagramSceneTypes.d.ts +91 -0
- package/dist/presentation/diagramSceneTypes.js +2 -0
- package/dist/presentation/erd.d.ts +81 -0
- package/dist/presentation/erd.js +156 -0
- package/dist/presentation/flowModel.d.ts +82 -0
- package/dist/presentation/flowModel.js +206 -0
- package/dist/presentation/index.d.ts +20 -0
- package/dist/presentation/index.js +14 -0
- package/dist/presentation/registry.d.ts +52 -0
- package/dist/presentation/registry.js +81 -0
- package/dist/presentation/renderCardSvg.d.ts +73 -0
- package/dist/presentation/renderCardSvg.js +144 -0
- package/dist/presentation/renderSceneSvg.d.ts +38 -0
- package/dist/presentation/renderSceneSvg.js +56 -0
- package/dist/presentation/renderZoneSvg.d.ts +79 -0
- package/dist/presentation/renderZoneSvg.js +180 -0
- package/dist/presentation/sceneLabelClearance.d.ts +8 -0
- package/dist/presentation/sceneLabelClearance.js +85 -0
- package/dist/visibility.d.ts +1 -1
- package/dist/visibility.js +5 -4
- package/package.json +31 -5
package/dist/layout/route.d.ts
CHANGED
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
import type { EntityRef, RelationRef } from "@sentropic/diagram-core";
|
|
71
71
|
import type { Rect, Vec2 } from "../transform.js";
|
|
72
72
|
export interface RouteRequest {
|
|
73
|
+
readonly flowRank?: number;
|
|
74
|
+
readonly flowRun?: string;
|
|
73
75
|
readonly id: RelationRef;
|
|
74
76
|
/** The two entities, sorted and joined: equal for parallel edges (L-R9). */
|
|
75
77
|
readonly pairKey: string;
|
package/dist/layout/route.js
CHANGED
|
@@ -1,72 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Orthogonal routing between docked ends, around obstacles.
|
|
3
|
-
*
|
|
4
|
-
* L-R3 (429c92a2) — bends minimised after docking; the route is the one this
|
|
5
|
-
* exact search returns. Docks are fixed first (`dock.ts`); the router searches
|
|
6
|
-
* orthogonal routes on the grid formed by obstacle boundaries grown by
|
|
7
|
-
* `clearance`, the midline of every channel between two consecutive
|
|
8
|
-
* boundaries, and the clearance point of every dock. Cost is the ordered pair
|
|
9
|
-
* `(bends, weighted length)`, compared lexicographically: no length saving,
|
|
10
|
-
* however large, compensates for one extra bend, and no finite bend
|
|
11
|
-
* coefficient is used. A grid unit already used by an edge of another
|
|
12
|
-
* unordered pair costs three times its length; a unit used by an edge of the
|
|
13
|
-
* same pair is forbidden outright (L-R9). A move that would make the route
|
|
14
|
-
* transversally cross an already routed edge of the same pair is likewise
|
|
15
|
-
* forbidden: the candidate's full route, as assembled and simplified (its two
|
|
16
|
-
* dock-to-clearance joins included, see L-R9), may contain no point interior
|
|
17
|
-
* to both one of its segments and one segment of that earlier route, and the
|
|
18
|
-
* search must not return a route — grid part or dock-to-clearance join — that
|
|
19
|
-
* contains such a point. The search is A* with the pair heuristic
|
|
20
|
-
* `(t, |dx| + |dy|)` to the target clearance point — an admissible lower bound
|
|
21
|
-
* on each component, since `m >= 1` — where `t` is the remaining-turns lower
|
|
22
|
-
* bound below. Estimated totals are the componentwise sum `g + h`, themselves
|
|
23
|
-
* compared lexicographically. The frontier is a heap ordered by (estimated
|
|
24
|
-
* bends, estimated weighted length, state index); a state is closed when
|
|
25
|
-
* popped and never reopened; a neighbour replaces the recorded cost and
|
|
26
|
-
* parent only on a strictly smaller `(bends, weighted length)` pair, so on an
|
|
27
|
-
* exact pair tie the parent recorded first — by the earliest popped
|
|
28
|
-
* predecessor, neighbours tried east, south, west, north — is kept; the
|
|
29
|
-
* virtual goal likewise keeps the first parent achieving the smallest closing
|
|
30
|
-
* pair and is popped after every state of equal estimated pair. Requests are
|
|
31
|
-
* routed in ascending relation id, so an earlier relation occupies the grid
|
|
32
|
-
* first; the route is the parent chain of that goal, dock to dock with
|
|
33
|
-
* collinear points removed. Nothing is reserved before the final choice
|
|
34
|
-
* between the searched route and the fallback: the fixed route — searched
|
|
35
|
-
* or fallback elbow — then reserves every grid unit it traverses, so a
|
|
36
|
-
* fallback still penalises the routes that follow. The returned route is lexicographically minimal:
|
|
37
|
-
* first the bend count, then the weighted length; among routes equal on both,
|
|
38
|
-
* the heap discipline above selects the route. If the grid holds no route
|
|
39
|
-
* admissible under L-R8 and L-R9 (the transversal ban included), the fallback
|
|
40
|
-
* elbow is fixed (see below) and reported `route-obstructed` for that
|
|
41
|
-
* relation: for that relation only the elbow is an accepted exception to
|
|
42
|
-
* L-R8 *and* L-R9 (it may cross an obstacle interior, share a segment with a
|
|
43
|
-
* same-pair edge, or transversally cross one); no claim is made that either
|
|
44
|
-
* held for it, and every other relation keeps both.
|
|
45
|
-
*
|
|
46
|
-
* L-R8 — edges across containers. Every entity is an obstacle except the strict
|
|
47
|
-
* ancestors of either end: an edge may cross only the boundaries of its own
|
|
48
|
-
* ancestors. Every other node and container is an obstacle grown by
|
|
49
|
-
* `clearance`, and a route segment runs ON a grown boundary at most, never
|
|
50
|
-
* through an obstacle interior. The only accepted exception is the
|
|
51
|
-
* `route-obstructed` fallback above, reported per relation.
|
|
52
|
-
*
|
|
53
|
-
* L-R9 (429c92a2) — parallel edges take distinct docking slots under L-R2 and
|
|
54
|
-
* their slot order is the same at both ends. That order alone does not settle
|
|
55
|
-
* crossings, and two further bans hold on the full simplified routes, dock to
|
|
56
|
-
* dock, the dock-to-clearance joins (dock to its clearance point, dock + exit
|
|
57
|
-
* · `clearance`, at both ends) included: they never share a segment — the
|
|
58
|
-
* router forbids a grid unit already used by an edge of the same unordered
|
|
59
|
-
* entity pair to the next such edge — and they never cross transversally: no
|
|
60
|
-
* segment of one route meets a segment of another route of the pair at a
|
|
61
|
-
* point interior to both segments. L-R3's search enforces both bans against
|
|
62
|
-
* the routes already fixed (ascending relation id); when no route satisfying
|
|
63
|
-
* them (and L-R8) remains, the relation takes the `route-obstructed`
|
|
64
|
-
* fallback instead of a crossing route. The sole exception is that
|
|
65
|
-
* `route-obstructed` elbow (L-R3), for that relation only.
|
|
66
|
-
*
|
|
67
|
-
* A route is [dock, dock + exit * clearance, ...grid corners..., clearance point,
|
|
68
|
-
* dock], with collinear points removed.
|
|
69
|
-
*/
|
|
1
|
+
import { permuteFlowRuns } from "./flow-order.js";
|
|
70
2
|
/** L-R9 applies to full dock-to-dock routes, including clearance joins. */
|
|
71
3
|
export function routesConflict(left, right) {
|
|
72
4
|
return fullSharesSegment(left, right) || left.slice(1).some((point, i) => right.slice(1).some((other, j) => segmentsCrossTransversal(left[i], point, right[j], other)));
|
|
@@ -591,7 +523,7 @@ export function routeEdges(input) {
|
|
|
591
523
|
}
|
|
592
524
|
return best;
|
|
593
525
|
};
|
|
594
|
-
for (const request of [...requests].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))) {
|
|
526
|
+
for (const request of permuteFlowRuns([...requests].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)), (request) => request.flowRun, (request) => request.flowRank)) {
|
|
595
527
|
let goalParent = -1;
|
|
596
528
|
let pairId = pairIds.get(request.pairKey);
|
|
597
529
|
if (pairId === undefined) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The scene engine and both renderers share the same card/zone chrome. */
|
|
2
|
+
import type { EntityPresentation, OccurrenceRef } from "@sentropic/diagram-core";
|
|
3
|
+
import { type HeaderMeasurement, type LineMeasurer } from "./measure.js";
|
|
4
|
+
export declare function measureSceneBox(presentation: EntityPresentation | undefined, occurrence: OccurrenceRef, width: number, collapsed: boolean, measure: LineMeasurer, containerPadding?: number): {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
header: HeaderMeasurement;
|
|
8
|
+
bodyWidth: number;
|
|
9
|
+
footerWidth: number;
|
|
10
|
+
footerReserve: number;
|
|
11
|
+
diagnostics: readonly import("../presentation/diagramCardModel.js").CardDiagnostic[] | readonly import("../presentation/diagramCardModel.js").ZoneDiagnostic[];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=sceneMeasure.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { layoutCard, layoutZone, projectCardProps, projectZoneProps, lineBoxHeight, CARD_GEOMETRY, ZONE_GEOMETRY, } from "../presentation/diagramCardModel.js";
|
|
2
|
+
import { DEFAULT_ALLOCATED_LINES } from "./measure.js";
|
|
3
|
+
export function measureSceneBox(presentation, occurrence, width, collapsed, measure, containerPadding) {
|
|
4
|
+
const zone = presentation?.form === "container" || presentation?.form === "legend";
|
|
5
|
+
const measured = new Map();
|
|
6
|
+
const at = (text, role, availableWidth) => {
|
|
7
|
+
const key = JSON.stringify([text, role, availableWidth]);
|
|
8
|
+
let layout = measured.get(key);
|
|
9
|
+
if (layout === undefined) {
|
|
10
|
+
layout = measure({ text, role, availableWidth, allocatedLines: DEFAULT_ALLOCATED_LINES[role], folded: collapsed });
|
|
11
|
+
measured.set(key, layout);
|
|
12
|
+
}
|
|
13
|
+
return layout;
|
|
14
|
+
};
|
|
15
|
+
const adapter = (text, role, availableWidth, allocatedLines) => {
|
|
16
|
+
const layout = at(text, zone && !collapsed && role === "body" ? "subtitle" : role, availableWidth);
|
|
17
|
+
return { lines: layout.lines, tooWide: layout.width > availableWidth,
|
|
18
|
+
lineWidths: layout.lines.map(() => layout.width) };
|
|
19
|
+
};
|
|
20
|
+
// Reserving an icon even when a host cannot resolve it is conservative.
|
|
21
|
+
const resolveGlyph = () => ({ face: "" });
|
|
22
|
+
const projected = zone
|
|
23
|
+
? projectZoneProps(presentation, { entityId: occurrence, collapsed, width, ...(containerPadding === undefined ? {} : { containerPadding }), toggleLabel: "toggle", resolveGlyph })
|
|
24
|
+
: projectCardProps(presentation, { entityId: occurrence, resolveGlyph });
|
|
25
|
+
const props = projected.kind === "label" ? { entityId: occurrence, title: presentation?.text.title ?? "", body: [] } : projected.props;
|
|
26
|
+
const layout = projected.kind === "zone"
|
|
27
|
+
? layoutZone({ ...projected.props, autoSize: true }, adapter)
|
|
28
|
+
: layoutCard({ ...props, autoSize: true }, adapter);
|
|
29
|
+
const card = "collapsed" in layout ? layout.card : layout;
|
|
30
|
+
const header = "collapsed" in layout ? layout.header : undefined;
|
|
31
|
+
const textWidth = card?.headerTextWidth ?? header.headerTextWidth;
|
|
32
|
+
const rawKicker = presentation?.text.kicker === undefined ? undefined : at(presentation.text.kicker, "kicker", textWidth);
|
|
33
|
+
const rawTitle = at(presentation?.text.title ?? "", "title", textWidth);
|
|
34
|
+
const rawSubtitle = header === undefined || presentation?.text.subtitle === undefined ? undefined
|
|
35
|
+
: at(presentation.text.subtitle, "subtitle", header.subtitleWidth);
|
|
36
|
+
const bounded = (raw, lines, size) => raw === undefined ? undefined : { ...raw, lines: lines?.map(line => line.text) ?? [], height: (lines?.length ?? 0) * lineBoxHeight(size), overflow: false };
|
|
37
|
+
const kicker = bounded(rawKicker, card?.kicker ?? header?.kicker, CARD_GEOMETRY.kicker.size);
|
|
38
|
+
const title = bounded(rawTitle, card?.title ?? header?.title, CARD_GEOMETRY.title.size);
|
|
39
|
+
const subtitle = bounded(rawSubtitle, header?.subtitle, CARD_GEOMETRY.body.size);
|
|
40
|
+
const blockHeight = Math.max(projected.kind === "label" || presentation?.icon === "none" ? 0 : CARD_GEOMETRY.iconSize, (kicker?.height ?? 0) + title.height);
|
|
41
|
+
const height = header === undefined ? blockHeight : blockHeight + ZONE_GEOMETRY.headerRuleGap
|
|
42
|
+
+ (subtitle === undefined || subtitle.lines.length === 0 ? 0 : ZONE_GEOMETRY.subtitleGap + subtitle.height);
|
|
43
|
+
const measuredHeader = {
|
|
44
|
+
occurrence,
|
|
45
|
+
...(kicker === undefined ? {} : { kicker }), title,
|
|
46
|
+
...(subtitle === undefined ? {} : { subtitle }), height,
|
|
47
|
+
overflow: (kicker?.overflow ?? false) || title.overflow || (subtitle?.overflow ?? false),
|
|
48
|
+
};
|
|
49
|
+
const footerReserve = header === undefined || header.footer.length === 0 ? 0
|
|
50
|
+
: header.footer.length * lineBoxHeight(CARD_GEOMETRY.footer.size)
|
|
51
|
+
+ ZONE_GEOMETRY.ruleHeight + 2 * ZONE_GEOMETRY.ruleMargin + ZONE_GEOMETRY.footerBottomInset;
|
|
52
|
+
return { width: layout.box.width, height: layout.box.height, header: measuredHeader,
|
|
53
|
+
bodyWidth: card?.bodyWidth ?? width - 2 * (containerPadding ?? ZONE_GEOMETRY.contentInsetInline),
|
|
54
|
+
footerWidth: card === undefined ? width - 2 * (containerPadding ?? ZONE_GEOMETRY.contentInsetInline) : CARD_GEOMETRY.width - CARD_GEOMETRY.borderWidth - CARD_GEOMETRY.padding - CARD_GEOMETRY.headerInset,
|
|
55
|
+
footerReserve, diagnostics: layout.diagnostics };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=sceneMeasure.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** World units. Owner A9 is resolved: V1 (72 vertical / 96 horizontal); canvas defaults are generated. */
|
|
2
|
+
export declare const DIAGRAM_SCENE_SPACING: {
|
|
3
|
+
readonly gapMin: 96;
|
|
4
|
+
readonly gapMinBlock: 72;
|
|
5
|
+
readonly gapBase: 64;
|
|
6
|
+
readonly gapBaseBlock: 8;
|
|
7
|
+
readonly trackSpacing: 14;
|
|
8
|
+
readonly trackSpacingBlock: 7;
|
|
9
|
+
readonly labelBand: 30;
|
|
10
|
+
readonly gapMax: 240;
|
|
11
|
+
readonly containerPadding: 16;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=spacing.generated.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Generated by scripts/sync-diagram-spacing.mjs. Edit tokens/src/diagramSpacing.ts.
|
|
2
|
+
/** World units. Owner A9 is resolved: V1 (72 vertical / 96 horizontal); canvas defaults are generated. */
|
|
3
|
+
export const DIAGRAM_SCENE_SPACING = {
|
|
4
|
+
gapMin: 96, gapMinBlock: 72, gapBase: 64, gapBaseBlock: 8,
|
|
5
|
+
trackSpacing: 14, trackSpacingBlock: 7, labelBand: 30, gapMax: 240,
|
|
6
|
+
containerPadding: 16,
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=spacing.generated.js.map
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type FlowDirection = "left-to-right" | "top-to-bottom";
|
|
|
16
16
|
* {@link LegacyTextRole}; `TextMeasurer` accepts both so views without
|
|
17
17
|
* `presentation.diagram` keep their pinned byte-identical behaviour (§4.8).
|
|
18
18
|
*/
|
|
19
|
-
export type TextRole = "kicker" | "title" | "body" | "detail" | "footer" | "subtitle" | "legend-label" | "edge-label";
|
|
19
|
+
export type TextRole = "kicker" | "title" | "body" | "detail" | "footer" | "subtitle" | "legend-label" | "edge-label" | "flow-badge";
|
|
20
20
|
/** Role names of the pre-M1-d compatibility measurer, kept verbatim. */
|
|
21
21
|
export type LegacyTextRole = "node" | "container-title" | "edge-label";
|
|
22
22
|
export interface TextSize {
|
|
@@ -37,6 +37,15 @@ export type TextMeasurer = ((text: string, role: TextRole | LegacyTextRole) => T
|
|
|
37
37
|
};
|
|
38
38
|
/** World units (CSS px at zoom 1). Every field has a default; see {@link DEFAULT_LAYOUT_METRICS}. */
|
|
39
39
|
export interface LayoutMetrics {
|
|
40
|
+
readonly gapMin?: number;
|
|
41
|
+
readonly gapMinBlock?: number;
|
|
42
|
+
readonly gapBase?: number;
|
|
43
|
+
readonly gapBaseBlock?: number;
|
|
44
|
+
readonly trackSpacing?: number;
|
|
45
|
+
readonly trackSpacingBlock?: number;
|
|
46
|
+
readonly labelBand?: number;
|
|
47
|
+
readonly gapMax?: number;
|
|
48
|
+
readonly bundleLabelMaxWidth?: number;
|
|
40
49
|
readonly nodePaddingX: number;
|
|
41
50
|
readonly nodePaddingY: number;
|
|
42
51
|
readonly nodeMinWidth: number;
|
|
@@ -81,8 +90,8 @@ export interface RowPackOptions {
|
|
|
81
90
|
export type ResolvedRowPack = Required<RowPackOptions>;
|
|
82
91
|
export declare const DEFAULT_ROW_PACK: ResolvedRowPack;
|
|
83
92
|
/** Row-pack spacing defaults, mirroring the DS tokens (asserted by tests/layout/dc2a/tokens.test.ts). */
|
|
84
|
-
export declare const DEFAULT_ROW_GAP
|
|
85
|
-
export declare const DEFAULT_ROW_GAP_MAX
|
|
93
|
+
export declare const DEFAULT_ROW_GAP: 96;
|
|
94
|
+
export declare const DEFAULT_ROW_GAP_MAX: 240;
|
|
86
95
|
/** Orientation of one packed level (§4.1): shelves run as rows or as columns. */
|
|
87
96
|
export type LevelOrientation = "rows" | "columns";
|
|
88
97
|
/** Level key of the root level in orientation records (§4.1). */
|
|
@@ -135,6 +144,11 @@ export interface LayoutOptions {
|
|
|
135
144
|
* axes. Absent or empty selects the DS defaults (16:9). Ignored by the
|
|
136
145
|
* compatibility path.
|
|
137
146
|
*/
|
|
147
|
+
readonly flows?: {
|
|
148
|
+
readonly fanOutMax?: number;
|
|
149
|
+
readonly countTemplate?: string;
|
|
150
|
+
};
|
|
151
|
+
readonly flowTokens?: Partial<import("./flows.js").FlowTokens>;
|
|
138
152
|
readonly rowPack?: RowPackOptions;
|
|
139
153
|
/**
|
|
140
154
|
* Orientation last emitted per level key (`"root"` or the placement-parent
|
|
@@ -157,8 +171,9 @@ export interface LayoutFit {
|
|
|
157
171
|
readonly phone: boolean;
|
|
158
172
|
}
|
|
159
173
|
/** A rule the engine could not fully satisfy on this input, reported instead of dropped. */
|
|
160
|
-
export type LayoutWarningCode = "label-unplaced" | "label-budget-exhausted" | "route-obstructed" | "row-fill-partial" | "card-overflow" | "zone-overflow" | "docking-overflow";
|
|
174
|
+
export type LayoutWarningCode = "channel-unresolved" | "card-icon-missing" | "flow-bundled" | "badge-unplaced" | "flow-layout-unsupported" | "label-unplaced" | "label-budget-exhausted" | "route-obstructed" | "row-fill-partial" | "card-overflow" | "card-grown" | "zone-overflow" | "docking-overflow";
|
|
161
175
|
export interface LayoutWarning {
|
|
176
|
+
readonly severity?: "info";
|
|
162
177
|
readonly code: LayoutWarningCode;
|
|
163
178
|
readonly refs: readonly string[];
|
|
164
179
|
readonly message: string;
|
|
@@ -182,6 +197,11 @@ export type LayoutResult = {
|
|
|
182
197
|
* Shared line-layout output (M3 §4.6.3/§5.6). Present on measured
|
|
183
198
|
* views only; the compatibility path carries no `measurements` key.
|
|
184
199
|
*/
|
|
200
|
+
readonly badgeBoxes?: Readonly<Record<string, import("../transform.js").Rect>>;
|
|
201
|
+
readonly arrowBoxes?: Readonly<Record<string, readonly import("./flows.js").FlowArrow[]>>;
|
|
202
|
+
readonly flowBundles?: readonly import("./flows.js").FlowBundle[];
|
|
203
|
+
readonly flowTargets?: Readonly<Record<string, import("./flows.js").FlowVisibleTarget>>;
|
|
204
|
+
readonly flowRepairPasses?: 0 | 1;
|
|
185
205
|
readonly measurements?: import("./measure.js").LayoutMeasurements;
|
|
186
206
|
/**
|
|
187
207
|
* Orientation chosen per packed level (§4.1, §6.1). Present on measured
|
|
@@ -195,12 +215,21 @@ export type LayoutResult = {
|
|
|
195
215
|
* host draws labels from these boxes and unions them into its fit
|
|
196
216
|
* bounds (DEC-5, BF-7).
|
|
197
217
|
*/
|
|
218
|
+
readonly channels?: readonly import("./channels.js").LayoutChannel[];
|
|
198
219
|
readonly labelBoxes?: Readonly<Record<string, {
|
|
199
220
|
readonly x: number;
|
|
200
221
|
readonly y: number;
|
|
201
222
|
readonly width: number;
|
|
202
223
|
readonly height: number;
|
|
203
224
|
}>>;
|
|
225
|
+
/** Lifted parallel relations share a route; semantic occurrences remain intact. */
|
|
226
|
+
readonly edgeBundles?: Readonly<Record<string, {
|
|
227
|
+
readonly members: readonly string[];
|
|
228
|
+
readonly label: string;
|
|
229
|
+
readonly title: string;
|
|
230
|
+
readonly relations?: readonly string[];
|
|
231
|
+
chip?: ReturnType<typeof import("./bundleLabel.js").measureBundleLabel>;
|
|
232
|
+
}>>;
|
|
204
233
|
} | {
|
|
205
234
|
readonly status: "refused";
|
|
206
235
|
readonly refusals: readonly LayoutRefusal[];
|
package/dist/layout/types.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* The layout engine's contract: what it takes, what it returns, and the few
|
|
3
|
-
* numbers it is tuned by. No diagram model is declared here. The input is a
|
|
4
|
-
* `diagram-core` `SemanticDocument` and the output is a `diagram-core`
|
|
5
|
-
* `ViewDocument`; everything below is either a call option or the outcome of
|
|
6
|
-
* one call (direction chosen, zoom, warnings), never persisted content.
|
|
7
|
-
*/
|
|
1
|
+
import { DIAGRAM_SCENE_SPACING as spacing } from './spacing.generated.js';
|
|
8
2
|
export const DEFAULT_ROW_PACK = {
|
|
9
3
|
targetAspect: 1.78,
|
|
10
4
|
tallBias: 1.6,
|
|
@@ -12,8 +6,8 @@ export const DEFAULT_ROW_PACK = {
|
|
|
12
6
|
orientationHysteresis: 0.08,
|
|
13
7
|
};
|
|
14
8
|
/** Row-pack spacing defaults, mirroring the DS tokens (asserted by tests/layout/dc2a/tokens.test.ts). */
|
|
15
|
-
export const DEFAULT_ROW_GAP =
|
|
16
|
-
export const DEFAULT_ROW_GAP_MAX =
|
|
9
|
+
export const DEFAULT_ROW_GAP = spacing.gapMin;
|
|
10
|
+
export const DEFAULT_ROW_GAP_MAX = spacing.gapMax;
|
|
17
11
|
/** Level key of the root level in orientation records (§4.1). */
|
|
18
12
|
export const ROOT_LEVEL_KEY = "root";
|
|
19
13
|
/** One place where row-pack defaults resolve (§6.1), so cache keys see numbers only. */
|
|
@@ -48,7 +42,7 @@ export const DEFAULT_LAYOUT_METRICS = {
|
|
|
48
42
|
nodePaddingY: 8,
|
|
49
43
|
nodeMinWidth: 64,
|
|
50
44
|
nodeMinHeight: 32,
|
|
51
|
-
containerPadding:
|
|
45
|
+
containerPadding: spacing.containerPadding,
|
|
52
46
|
titlePaddingY: 6,
|
|
53
47
|
rankGap: 56,
|
|
54
48
|
nodeGap: 24,
|