@sentropic/diagram-canvas 0.1.0 → 0.2.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.
- package/README.md +9 -0
- package/contracts/diagram-anatomy.v1.json +2073 -0
- package/dist/camera.d.ts +9 -6
- package/dist/camera.js +14 -9
- 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 +69 -2
- package/dist/presentation/diagramSceneModel.js +146 -25
- 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/visibility.d.ts +1 -1
- package/dist/visibility.js +5 -4
- package/package.json +30 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { evaluateVisibility, relationVerdict } from "../visibility.js";
|
|
2
|
+
/** Flow-only layout metadata and mark placement. No host or DOM state. */
|
|
3
|
+
import { flowIndex, representativeOf, resolveSummaries } from "@sentropic/diagram-core";
|
|
4
|
+
import { placePackedLabel } from "./labels.js";
|
|
5
|
+
export const FLOW_BADGE_FONT_SIZE = 16;
|
|
6
|
+
export const FLOW_BADGE_LINE_HEIGHT = 20;
|
|
7
|
+
export const DEFAULT_FLOW_TOKENS = Object.freeze({ flowBadgeSize: 28, flowBadgePaddingX: 6, flowArrowLength: 10, flowArrowWidth: 10, flowTargetMinSize: 24, flowFanOutMax: 4, flowArrowPath: "M0 0L10 5L0 10Z" });
|
|
8
|
+
const cmp = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
9
|
+
export function planFlows(document, view, registry, options, forced) {
|
|
10
|
+
const index = flowIndex(document), targets = {}, suppressed = new Set();
|
|
11
|
+
const ranks = new Map(), members = [], groups = new Map();
|
|
12
|
+
const ordered = index.scenarios.flatMap((s) => s.steps);
|
|
13
|
+
const rank = new Map(ordered.map((s, i) => [s.relation, i]));
|
|
14
|
+
const visible = evaluateVisibility({ document, view }).visible;
|
|
15
|
+
const collapsed = new Set(options.collapsed ?? Object.values(view.groups).filter((g) => g.collapsed).map((g) => g.occurrence));
|
|
16
|
+
const boxOf = (id) => representativeOf(view, collapsed, view.portOccurrences[id]?.ownerOccurrence ?? id);
|
|
17
|
+
for (const occurrence of Object.values(view.relationOccurrences).sort((a, b) => (rank.get(a.relation) ?? Infinity) - (rank.get(b.relation) ?? Infinity) || cmp(a.id, b.id))) {
|
|
18
|
+
const step = index.byRelation[occurrence.relation];
|
|
19
|
+
if (step === undefined)
|
|
20
|
+
continue;
|
|
21
|
+
suppressed.add(occurrence.id);
|
|
22
|
+
if (!relationVerdict(view, document.relations[occurrence.relation], document).visible)
|
|
23
|
+
continue;
|
|
24
|
+
const sourceEnd = occurrence.endpoints.find((e) => e.role === "source"), targetEnd = occurrence.endpoints.find((e) => e.role === "target");
|
|
25
|
+
if (sourceEnd === undefined || targetEnd === undefined)
|
|
26
|
+
continue;
|
|
27
|
+
const source = boxOf(sourceEnd.occurrence), target = boxOf(targetEnd.occurrence);
|
|
28
|
+
if (!visible.has(source) || !visible.has(target))
|
|
29
|
+
continue;
|
|
30
|
+
if (source === target || step.self) {
|
|
31
|
+
suppressed.add(occurrence.id);
|
|
32
|
+
targets[step.relation] = { kind: "internal", box: source };
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const key = "flow:" + [source, target].sort().join("|") + "|" + (occurrence.strokeStyle ?? "solid");
|
|
36
|
+
const member = { occurrence: occurrence.id, step, source, target, retargeted: occurrence.endpoints.some((e) => e.semanticTarget !== undefined), key, rank: rank.get(step.relation) };
|
|
37
|
+
suppressed.delete(occurrence.id);
|
|
38
|
+
members.push(member);
|
|
39
|
+
ranks.set(occurrence.id, member.rank);
|
|
40
|
+
(groups.get(key) ?? groups.set(key, []).get(key)).push(member);
|
|
41
|
+
targets[step.relation] = { kind: "edge", occurrence: occurrence.id, badge: false };
|
|
42
|
+
}
|
|
43
|
+
const bundles = [];
|
|
44
|
+
const summaries = members.length === 0 ? new Map() : resolveSummaries(view, document, { registry });
|
|
45
|
+
const cap = options.flows?.fanOutMax ?? options.flowTokens?.flowFanOutMax ?? DEFAULT_FLOW_TOKENS.flowFanOutMax;
|
|
46
|
+
for (const [key, group] of groups) {
|
|
47
|
+
const reason = group.length >= 2 && group.some((m) => m.retargeted) ? "fold" : group.length > cap ? "fan-out" : group.length >= 2 && forced.has(key) ? "obstructed" : undefined;
|
|
48
|
+
if (reason === undefined)
|
|
49
|
+
continue;
|
|
50
|
+
const carrier = group[0];
|
|
51
|
+
const entries = group.map((m) => ({ occurrence: m.occurrence, relation: m.step.relation, direction: m.source === carrier.source ? "forward" : "backward", source: m.step.source, target: m.step.target }));
|
|
52
|
+
const bundle = { id: key, reason, carrier: carrier.occurrence, members: entries, forward: entries.filter((m) => m.direction === "forward").length, backward: entries.filter((m) => m.direction === "backward").length,
|
|
53
|
+
summaries: [...summaries].filter(([, s]) => s.members.some((m) => group.some((g) => g.occurrence === m))).map(([, summary]) => summary.definitionId).sort(cmp) };
|
|
54
|
+
bundles.push(bundle);
|
|
55
|
+
for (const m of group) {
|
|
56
|
+
if (m !== carrier)
|
|
57
|
+
suppressed.add(m.occurrence);
|
|
58
|
+
targets[m.step.relation] = { kind: "bundle", id: key, occurrence: carrier.occurrence, badge: false };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { index, members, groups, bundles, suppressed, targets, ranks };
|
|
62
|
+
}
|
|
63
|
+
export function arrowAt(route, start, tokens) {
|
|
64
|
+
const points = start ? [...route].reverse() : route;
|
|
65
|
+
const tip = points.at(-1);
|
|
66
|
+
if (tip === undefined)
|
|
67
|
+
return undefined;
|
|
68
|
+
const previous = [...points].reverse().find((p) => p.x !== tip.x || p.y !== tip.y);
|
|
69
|
+
if (previous === undefined)
|
|
70
|
+
return undefined;
|
|
71
|
+
const angle = previous.y === tip.y ? (previous.x < tip.x ? 0 : 180) : (previous.y < tip.y ? 90 : 270);
|
|
72
|
+
const length = tokens.flowArrowLength, width = tokens.flowArrowWidth;
|
|
73
|
+
const box = angle === 0 ? { x: tip.x - length, y: tip.y - width / 2, width: length, height: width } : angle === 180 ? { x: tip.x, y: tip.y - width / 2, width: length, height: width } : angle === 90 ? { x: tip.x - width / 2, y: tip.y - length, width, height: length } : { x: tip.x - width / 2, y: tip.y, width, height: length };
|
|
74
|
+
return { tip, angle, box };
|
|
75
|
+
}
|
|
76
|
+
export function placeFlowMarks(input) {
|
|
77
|
+
const { plan } = input, tokens = { ...DEFAULT_FLOW_TOKENS, ...input.options.flowTokens };
|
|
78
|
+
const arrows = {}, badges = {}, targets = { ...plan.targets };
|
|
79
|
+
const warnings = [], taken = [];
|
|
80
|
+
for (const m of plan.members) {
|
|
81
|
+
if (plan.suppressed.has(m.occurrence))
|
|
82
|
+
continue;
|
|
83
|
+
const route = input.routes.get(m.occurrence);
|
|
84
|
+
if (route === undefined)
|
|
85
|
+
continue;
|
|
86
|
+
const bundle = plan.bundles.find((b) => b.carrier === m.occurrence);
|
|
87
|
+
const atEnd = arrowAt(route, false, tokens), atStart = bundle !== undefined && bundle.backward > 0 ? arrowAt(route, true, tokens) : undefined;
|
|
88
|
+
arrows[m.occurrence] = [atEnd, atStart].filter((a) => a !== undefined);
|
|
89
|
+
taken.push(...arrows[m.occurrence].map((a) => a.box));
|
|
90
|
+
}
|
|
91
|
+
for (const m of plan.members) {
|
|
92
|
+
if (plan.suppressed.has(m.occurrence))
|
|
93
|
+
continue;
|
|
94
|
+
const route = input.routes.get(m.occurrence);
|
|
95
|
+
if (route === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
const bundle = plan.bundles.find((b) => b.carrier === m.occurrence);
|
|
98
|
+
const text = bundle === undefined ? m.step.badge : (input.options.flows?.countTemplate ?? "{n}").replaceAll("{n}", String(bundle.members.length));
|
|
99
|
+
const measured = input.measure({ text, role: "flow-badge", availableWidth: Number.MAX_SAFE_INTEGER, allocatedLines: 1, folded: false });
|
|
100
|
+
const size = { width: Math.max(tokens.flowBadgeSize, measured.width + 2 * tokens.flowBadgePaddingX), height: tokens.flowBadgeSize };
|
|
101
|
+
const within = input.within.get(m.occurrence);
|
|
102
|
+
const entry = { id: m.occurrence, route, size, segmentOrder: "route-order", ...(within === undefined ? {} : { within }), ...(input.limit === undefined ? {} : { limit: input.limit }) };
|
|
103
|
+
const placement = placePackedLabel(entry, input.shapes, taken, input.margin);
|
|
104
|
+
if (placement !== undefined) {
|
|
105
|
+
badges[m.occurrence] = placement.box;
|
|
106
|
+
taken.push(placement.box);
|
|
107
|
+
}
|
|
108
|
+
else
|
|
109
|
+
warnings.push({ code: "badge-unplaced", refs: [m.occurrence], message: "no segment holds the flow badge" });
|
|
110
|
+
for (const member of bundle?.members ?? [{ relation: m.step.relation }]) {
|
|
111
|
+
const target = targets[member.relation];
|
|
112
|
+
if (target !== undefined && target.kind !== "internal")
|
|
113
|
+
targets[member.relation] = { ...target, badge: placement !== undefined };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const b of plan.bundles)
|
|
117
|
+
warnings.push({ code: "flow-bundled", refs: b.members.map((m) => m.occurrence), message: b.reason });
|
|
118
|
+
return { arrows, badges, targets, warnings, taken };
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=flows.js.map
|
package/dist/layout/graph.d.ts
CHANGED
|
@@ -31,11 +31,13 @@ export interface LayoutNode {
|
|
|
31
31
|
readonly depth: number;
|
|
32
32
|
}
|
|
33
33
|
export interface LayoutEnd {
|
|
34
|
+
readonly slot?: string;
|
|
34
35
|
readonly entity: EntityRef;
|
|
35
36
|
/** Set when the link endpoint targets a semantic port: the view then gets a port occurrence for it. */
|
|
36
37
|
readonly port?: PortRef;
|
|
37
38
|
}
|
|
38
39
|
export interface LayoutEdge {
|
|
40
|
+
readonly flowRank?: number;
|
|
39
41
|
readonly id: RelationRef;
|
|
40
42
|
readonly source: LayoutEnd;
|
|
41
43
|
readonly target: LayoutEnd;
|
package/dist/layout/graph.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { relationBaseType, genericProfile } from "@sentropic/diagram-core";
|
|
1
2
|
/**
|
|
2
3
|
* Reading a `generic@1` `SemanticDocument` into the engine's working graph.
|
|
3
4
|
*
|
|
@@ -34,6 +35,8 @@ export function readGraph(document) {
|
|
|
34
35
|
const labels = new Map();
|
|
35
36
|
for (const key of Object.keys(document.entities).sort(byString)) {
|
|
36
37
|
const entity = document.entities[key];
|
|
38
|
+
if (entity.type === "flow-scenario")
|
|
39
|
+
continue;
|
|
37
40
|
if (entity.profile !== GENERIC_PROFILE_ID) {
|
|
38
41
|
refusals.push({
|
|
39
42
|
code: "entity-profile-unsupported",
|
|
@@ -61,14 +64,14 @@ export function readGraph(document) {
|
|
|
61
64
|
for (const key of Object.keys(document.relations).sort(byString)) {
|
|
62
65
|
const relation = document.relations[key];
|
|
63
66
|
const role = (name) => relation.endpoints.find((endpoint) => endpoint.role === name)?.target;
|
|
64
|
-
if (relation.profile === GENERIC_PROFILE_ID && relation
|
|
67
|
+
if (relation.profile === GENERIC_PROFILE_ID && relationBaseType(document, genericProfile, relation) === "contains") {
|
|
65
68
|
const parent = role("parent");
|
|
66
69
|
const child = role("child");
|
|
67
70
|
if (parent !== undefined && child !== undefined)
|
|
68
71
|
parentOf.set(child, parent);
|
|
69
72
|
continue;
|
|
70
73
|
}
|
|
71
|
-
if (relation.profile !== GENERIC_PROFILE_ID || relation
|
|
74
|
+
if (relation.profile !== GENERIC_PROFILE_ID || relationBaseType(document, genericProfile, relation) !== "link") {
|
|
72
75
|
refusals.push({
|
|
73
76
|
code: "relation-type-unsupported",
|
|
74
77
|
path: `relations.${key}.type`,
|
package/dist/layout/hints.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DIAGRAM_SCENE_SPACING as spacing } from './spacing.generated.js';
|
|
1
2
|
import { DEFAULT_ROW_GAP, DEFAULT_ROW_GAP_MAX } from "./types.js";
|
|
2
3
|
export function isLayoutGroup(item) {
|
|
3
4
|
return typeof item !== "string";
|
|
@@ -140,12 +141,12 @@ export function resolveGaps(hints, metrics) {
|
|
|
140
141
|
*/
|
|
141
142
|
export function resolveRowGaps(hints, metrics) {
|
|
142
143
|
return {
|
|
143
|
-
cardX: hints?.cardGapX ?? metrics.rowGapInline ?? DEFAULT_ROW_GAP,
|
|
144
|
-
cardY: hints?.cardGapY ?? metrics.rowGapBlock ??
|
|
145
|
-
zoneX: hints?.zoneGapX ?? metrics.rowGapInline ?? DEFAULT_ROW_GAP,
|
|
146
|
-
zoneY: hints?.zoneGapY ?? metrics.rowGapBlock ??
|
|
147
|
-
maxX: metrics.gapInlineMax ?? DEFAULT_ROW_GAP_MAX,
|
|
148
|
-
maxY: metrics.gapBlockMax ?? DEFAULT_ROW_GAP_MAX,
|
|
144
|
+
cardX: hints?.cardGapX ?? metrics.rowGapInline ?? metrics.gapMin ?? DEFAULT_ROW_GAP,
|
|
145
|
+
cardY: hints?.cardGapY ?? metrics.rowGapBlock ?? metrics.gapMinBlock ?? spacing.gapMinBlock,
|
|
146
|
+
zoneX: hints?.zoneGapX ?? metrics.rowGapInline ?? metrics.gapMin ?? DEFAULT_ROW_GAP,
|
|
147
|
+
zoneY: hints?.zoneGapY ?? metrics.rowGapBlock ?? metrics.gapMinBlock ?? spacing.gapMinBlock,
|
|
148
|
+
maxX: metrics.gapInlineMax ?? metrics.gapMax ?? DEFAULT_ROW_GAP_MAX,
|
|
149
|
+
maxY: metrics.gapBlockMax ?? metrics.gapMax ?? DEFAULT_ROW_GAP_MAX,
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
152
|
/** Local stretch overrides global stretch (M3 §4.7). */
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { measureBundleLabel, type BundleLabelGroup } from "./bundleLabel.js";
|
|
2
|
+
export { channelMetrics, channelGap, type LayoutChannel, type ChannelMetrics } from "./channels.js";
|
|
1
3
|
/**
|
|
2
4
|
* The layout engine (SPEC §10.5, rules L-R1–L-R11): a `generic@1`
|
|
3
5
|
* `SemanticDocument` in, a `diagram-core` `ViewDocument` out. Pure computation,
|
|
@@ -17,4 +19,5 @@ export { ROW_FILL_ROUNDS } from "./place.js";
|
|
|
17
19
|
export { edgeLabelCandidates, edgeLabelPlacement, labelBoxOnSegment, placeEdgeLabels, placeEdgeLabelsPacked, placePackedLabel, relationRoute, type LabelEntry, type LabelPlacement, type PackedLabelEntry, } from "./labels.js";
|
|
18
20
|
export { bendCount, routeEdges, simplifyRoute, type RouteOutcome, type RouteRequest } from "./route.js";
|
|
19
21
|
export * from "./types.js";
|
|
22
|
+
export { FLOW_BADGE_FONT_SIZE, FLOW_BADGE_LINE_HEIGHT, DEFAULT_FLOW_TOKENS, type FlowTokens, type FlowArrow, type FlowBundle, type FlowVisibleTarget } from "./flows.js";
|
|
20
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/layout/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { measureBundleLabel } from "./bundleLabel.js";
|
|
2
|
+
export { channelMetrics, channelGap } from "./channels.js";
|
|
1
3
|
/**
|
|
2
4
|
* The layout engine (SPEC §10.5, rules L-R1–L-R11): a `generic@1`
|
|
3
5
|
* `SemanticDocument` in, a `diagram-core` `ViewDocument` out. Pure computation,
|
|
@@ -17,4 +19,5 @@ export { ROW_FILL_ROUNDS } from "./place.js";
|
|
|
17
19
|
export { edgeLabelCandidates, edgeLabelPlacement, labelBoxOnSegment, placeEdgeLabels, placeEdgeLabelsPacked, placePackedLabel, relationRoute, } from "./labels.js";
|
|
18
20
|
export { bendCount, routeEdges, simplifyRoute } from "./route.js";
|
|
19
21
|
export * from "./types.js";
|
|
22
|
+
export { FLOW_BADGE_FONT_SIZE, FLOW_BADGE_LINE_HEIGHT, DEFAULT_FLOW_TOKENS } from "./flows.js";
|
|
20
23
|
//# sourceMappingURL=index.js.map
|
package/dist/layout/labels.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export declare function pad(box: Rect, margin: number): Rect;
|
|
|
68
68
|
export declare function relationRoute(view: ViewDocument, occurrence: OccurrenceRef): readonly Vec2[] | undefined;
|
|
69
69
|
/** One label of the row-pack path: its route, its measured size, and the box it must stay inside. */
|
|
70
70
|
export interface PackedLabelEntry extends LabelEntry {
|
|
71
|
+
readonly segmentOrder?: "longest-first" | "route-order";
|
|
71
72
|
/**
|
|
72
73
|
* DC-2a BF-3: the content box of the expanded container both ends share.
|
|
73
74
|
* The label box stays inside it; absent for an edge between two containers.
|
package/dist/layout/labels.js
CHANGED
|
@@ -145,7 +145,7 @@ export function relationRoute(view, occurrence) {
|
|
|
145
145
|
*/
|
|
146
146
|
export function placePackedLabel(entry, shapes, taken, inset, marginY = inset) {
|
|
147
147
|
const { width, height } = entry.size;
|
|
148
|
-
for (const segment of edgeLabelCandidates(entry.route)) {
|
|
148
|
+
for (const segment of entry.segmentOrder === "route-order" ? entry.route.slice(1).map((_, i) => i) : edgeLabelCandidates(entry.route)) {
|
|
149
149
|
const a = entry.route[segment];
|
|
150
150
|
const b = entry.route[segment + 1];
|
|
151
151
|
const horizontal = a.y === b.y;
|
package/dist/layout/measure.d.ts
CHANGED
|
@@ -15,15 +15,15 @@ export declare const FIXED_CARD_HEIGHT = 200;
|
|
|
15
15
|
/** Legend-key fixed height; its width follows the legend inner width. */
|
|
16
16
|
export declare const LEGEND_KEY_HEIGHT = 64;
|
|
17
17
|
/** Content insets on all four sides of an expanded box. */
|
|
18
|
-
export declare const CONTENT_INSET
|
|
18
|
+
export declare const CONTENT_INSET: 16;
|
|
19
19
|
/** Rule gaps of the frozen spacing values. */
|
|
20
20
|
export declare const RULE_GAP = 4;
|
|
21
21
|
/** Subtitle to rule gap inside an expanded header band. */
|
|
22
22
|
export declare const SUBTITLE_TO_RULE_GAP = 4;
|
|
23
23
|
/** Rule to first-child gap inside an expanded box. */
|
|
24
|
-
export declare const RULE_TO_FIRST_CHILD_GAP
|
|
24
|
+
export declare const RULE_TO_FIRST_CHILD_GAP: 16;
|
|
25
25
|
/** Last-child to bottom gap inside an expanded box. */
|
|
26
|
-
export declare const LAST_CHILD_TO_BOTTOM_GAP
|
|
26
|
+
export declare const LAST_CHILD_TO_BOTTOM_GAP: 16;
|
|
27
27
|
/** Fold-control reservation reducing title/kicker width when `toggle`.
|
|
28
28
|
* 66 px: the hrpn header's inline-end room for the +/− control
|
|
29
29
|
* (tints.css `header { padding-right: 66px }`), shared with
|
package/dist/layout/measure.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import { DIAGRAM_SCENE_SPACING as spacing } from './spacing.generated.js';
|
|
1
2
|
/** Fixed card footprint, card pixels at zoom 1 (M3 §4.6.1). */
|
|
2
3
|
export const FIXED_CARD_WIDTH = 460;
|
|
3
4
|
export const FIXED_CARD_HEIGHT = 200;
|
|
4
5
|
/** Legend-key fixed height; its width follows the legend inner width. */
|
|
5
6
|
export const LEGEND_KEY_HEIGHT = 64;
|
|
6
7
|
/** Content insets on all four sides of an expanded box. */
|
|
7
|
-
export const CONTENT_INSET =
|
|
8
|
+
export const CONTENT_INSET = spacing.containerPadding;
|
|
8
9
|
/** Rule gaps of the frozen spacing values. */
|
|
9
10
|
export const RULE_GAP = 4;
|
|
10
11
|
/** Subtitle to rule gap inside an expanded header band. */
|
|
11
12
|
export const SUBTITLE_TO_RULE_GAP = 4;
|
|
12
13
|
/** Rule to first-child gap inside an expanded box. */
|
|
13
|
-
export const RULE_TO_FIRST_CHILD_GAP =
|
|
14
|
+
export const RULE_TO_FIRST_CHILD_GAP = spacing.containerPadding;
|
|
14
15
|
/** Last-child to bottom gap inside an expanded box. */
|
|
15
|
-
export const LAST_CHILD_TO_BOTTOM_GAP =
|
|
16
|
+
export const LAST_CHILD_TO_BOTTOM_GAP = spacing.containerPadding;
|
|
16
17
|
/** Fold-control reservation reducing title/kicker width when `toggle`.
|
|
17
18
|
* 66 px: the hrpn header's inline-end room for the +/− control
|
|
18
19
|
* (tints.css `header { padding-right: 66px }`), shared with
|
|
@@ -32,6 +33,7 @@ export const DEFAULT_ALLOCATED_LINES = {
|
|
|
32
33
|
subtitle: 2,
|
|
33
34
|
"legend-label": 2,
|
|
34
35
|
"edge-label": 1,
|
|
36
|
+
"flow-badge": 1,
|
|
35
37
|
};
|
|
36
38
|
/** Card inner width for a state: outer width minus content insets. */
|
|
37
39
|
export function innerWidthOf(outerWidth) {
|