@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,156 @@
|
|
|
1
|
+
import { rectsIntersect } from '../geometry.js';
|
|
2
|
+
import { edgeLabelPlacement, placeEdgeLabels } from '../layout/labels.js';
|
|
3
|
+
import {} from '@sentropic/diagram-core';
|
|
4
|
+
/** Numeric mirrors of component.diagramErd; verified against the token source. */
|
|
5
|
+
export const ERD_GEOMETRY = {
|
|
6
|
+
"width": 460,
|
|
7
|
+
"headerHeight": 64,
|
|
8
|
+
"rowHeight": 32,
|
|
9
|
+
"lineHeight": 24,
|
|
10
|
+
"padding": 12,
|
|
11
|
+
"keyWidth": 56,
|
|
12
|
+
"nameWidth": 170,
|
|
13
|
+
"typeWidth": 170,
|
|
14
|
+
"fontSize": 18,
|
|
15
|
+
"titleFontSize": 24,
|
|
16
|
+
"markerLength": 24,
|
|
17
|
+
"markerHalfWidth": 8,
|
|
18
|
+
"markerRadius": 4,
|
|
19
|
+
"markerGap": 4,
|
|
20
|
+
"strokeWidth": 1.5,
|
|
21
|
+
"gapInline": 160,
|
|
22
|
+
"gapBlock": 120,
|
|
23
|
+
"labelWidth": 240
|
|
24
|
+
};
|
|
25
|
+
export const escapeErdXml = (value) => value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');
|
|
26
|
+
export function erdText(attributes, key) {
|
|
27
|
+
const value = attributes[key];
|
|
28
|
+
return value && 'value' in value ? String(value.value) : '';
|
|
29
|
+
}
|
|
30
|
+
export const erdFlag = (p, key) => p.attributes[key]?.kind === 'boolean' && p.attributes[key].value === true;
|
|
31
|
+
export function erdFields(document, entity) {
|
|
32
|
+
return Object.values(document.ports).filter(p => p.owner === entity).sort((a, b) => Number(erdText(a.attributes, 'ordinal')) - Number(erdText(b.attributes, 'ordinal')) || (a.id < b.id ? -1 : 1));
|
|
33
|
+
}
|
|
34
|
+
/** Wraps without truncation, breaking at identifier/punctuation boundaries where possible. */
|
|
35
|
+
export function wrapErdText(text, width, measure, fontSize = ERD_GEOMETRY.fontSize) {
|
|
36
|
+
// The shared edge-label measurer uses the body size and may use a proportional font.
|
|
37
|
+
const size = (value) => Math.max(Array.from(value).length * fontSize * 0.6, measure ? measure({ text: value, role: 'edge-label', availableWidth: Number.MAX_SAFE_INTEGER, allocatedLines: 1, folded: false }).width * fontSize / ERD_GEOMETRY.fontSize : 0);
|
|
38
|
+
const lines = [];
|
|
39
|
+
let line = '';
|
|
40
|
+
for (const word of text.replace(/([a-z0-9])([A-Z])/g, '$1$2').split(/(?<=[_|(),.s])/u)) {
|
|
41
|
+
const clean = word.replaceAll('', '');
|
|
42
|
+
if (line && size(line + clean) > width) {
|
|
43
|
+
lines.push(line);
|
|
44
|
+
line = '';
|
|
45
|
+
}
|
|
46
|
+
for (const ch of clean) {
|
|
47
|
+
if (line && size(line + ch) > width) {
|
|
48
|
+
lines.push(line);
|
|
49
|
+
line = '';
|
|
50
|
+
}
|
|
51
|
+
line += ch;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (line || !lines.length)
|
|
55
|
+
lines.push(line);
|
|
56
|
+
return lines;
|
|
57
|
+
}
|
|
58
|
+
export function measureErdCard(document, entity, collapsed = false, measure) {
|
|
59
|
+
const t = ERD_GEOMETRY, title = erdText(document.entities[entity].attributes, 'name');
|
|
60
|
+
const titleLines = wrapErdText(title, t.width - 2 * t.padding - t.titleFontSize, measure, t.titleFontSize);
|
|
61
|
+
const headerHeight = Math.max(t.headerHeight, titleLines.length * t.lineHeight + 2 * t.padding);
|
|
62
|
+
let y = headerHeight;
|
|
63
|
+
const rows = collapsed ? [] : erdFields(document, entity).map(field => {
|
|
64
|
+
const name = wrapErdText(field.name, t.nameWidth, measure), type = wrapErdText(erdText(field.attributes, 'dataType'), t.typeWidth, measure);
|
|
65
|
+
const target = document.ports[erdText(field.attributes, 'fk')];
|
|
66
|
+
const fk = target ? wrapErdText('→ ' + erdText(document.entities[target.owner].attributes, 'name') + '.' + target.name, t.width - 2 * t.padding, measure) : [];
|
|
67
|
+
const height = Math.max(t.rowHeight, (Math.max(name.length, type.length) + fk.length) * t.lineHeight + t.padding);
|
|
68
|
+
const row = { field, y, height, name, type, fk };
|
|
69
|
+
y += height;
|
|
70
|
+
return row;
|
|
71
|
+
});
|
|
72
|
+
return { title, titleLines, width: t.width, height: y, headerHeight, rows, collapsed };
|
|
73
|
+
}
|
|
74
|
+
const ink = 'var(--st-semantic-text-primary)';
|
|
75
|
+
const paper = 'var(--st-semantic-surface-default)';
|
|
76
|
+
const border = 'var(--st-semantic-border-strong)';
|
|
77
|
+
const strokeWidth = 'var(--st-component-diagramErd-strokeWidth)';
|
|
78
|
+
export function renderErdCardSvg(card) {
|
|
79
|
+
const t = ERD_GEOMETRY;
|
|
80
|
+
const text = (lines, x, y, size = 'fontSize', attributes = '') => lines.map((line, i) => '<text x="' + x + '" y="' + (y + i * t.lineHeight) + '" font-size="var(--st-component-diagramErd-' + size + ')"' + attributes + '>' + escapeErdXml(line) + '</text>').join('');
|
|
81
|
+
let body = '<rect width="' + card.width + '" height="' + card.height + '" fill="' + paper + '" stroke="' + border + '" stroke-width="' + strokeWidth + '"/>' + text(card.titleLines, t.padding, t.padding + t.lineHeight, 'titleFontSize');
|
|
82
|
+
body += text([card.collapsed ? '+' : '−'], card.width - t.padding, t.padding + t.lineHeight, 'titleFontSize', ' data-erd-fold-indicator="" text-anchor="end"');
|
|
83
|
+
for (const row of card.rows) {
|
|
84
|
+
body += '<g data-erd-field="' + escapeErdXml(row.field.id) + '"><path d="M0 ' + row.y + 'H' + card.width + '" stroke="' + border + '" stroke-width="' + strokeWidth + '"/>';
|
|
85
|
+
body += text([[erdFlag(row.field, 'pk') ? 'PK' : '', row.field.attributes.fk ? 'FK' : ''].filter(Boolean).join('/')], t.padding, row.y + t.lineHeight);
|
|
86
|
+
body += text(row.name, t.padding + t.keyWidth, row.y + t.lineHeight) + text(row.type, t.padding + t.keyWidth + t.nameWidth, row.y + t.lineHeight);
|
|
87
|
+
body += text([erdFlag(row.field, 'nullable') ? '?' : 'NN'], card.width - t.padding, row.y + t.lineHeight, 'fontSize', ' text-anchor="end"');
|
|
88
|
+
body += text(row.fk, t.padding, row.y + (Math.max(row.name.length, row.type.length) + 1) * t.lineHeight) + '</g>';
|
|
89
|
+
}
|
|
90
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" class="st-diagramErdCard" aria-hidden="true" width="100%" height="100%" viewBox="0 0 ' + card.width + ' ' + card.height + '" style="color:' + ink + ';font-family:var(--st-component-diagramErd-fontFamily);fill:currentColor">' + body + '</svg>';
|
|
91
|
+
}
|
|
92
|
+
/** The outward direction follows the edge away from the card; geometry is token driven. */
|
|
93
|
+
export function erdMarkerGeometry(cardinality, anchor, direction, tokens = ERD_GEOMETRY) {
|
|
94
|
+
const n = Math.hypot(direction.x, direction.y) || 1, dx = direction.x / n, dy = direction.y / n;
|
|
95
|
+
const p = (along, across) => ({ x: anchor.x + dx * along - dy * across, y: anchor.y + dy * along + dx * across });
|
|
96
|
+
const l = tokens.markerLength, h = tokens.markerHalfWidth, g = tokens.markerGap;
|
|
97
|
+
const many = cardinality.endsWith('n'), optional = cardinality.startsWith('0');
|
|
98
|
+
const lines = many ? [[p(l / 2, 0), p(g, -h)], [p(l / 2, 0), p(g, 0)], [p(l / 2, 0), p(g, h)]] : [[p(g, -h), p(g, h)]];
|
|
99
|
+
if (!optional)
|
|
100
|
+
lines.push([p(l - g, -h), p(l - g, h)]);
|
|
101
|
+
return { lines, ...(optional ? { circle: { center: p(l - tokens.markerRadius, 0), radius: tokens.markerRadius } } : {}) };
|
|
102
|
+
}
|
|
103
|
+
export function renderErdMarkerSvg(cardinality, anchor, direction) {
|
|
104
|
+
const marker = erdMarkerGeometry(cardinality, anchor, direction);
|
|
105
|
+
return '<g data-erd-marker="' + cardinality + '" stroke="' + border + '" stroke-width="' + strokeWidth + '" fill="none">' + marker.lines.map(([a, b]) => '<path d="M' + a.x + ' ' + a.y + 'L' + b.x + ' ' + b.y + '"/>').join('') + (marker.circle ? '<circle cx="' + marker.circle.center.x + '" cy="' + marker.circle.center.y + '" r="' + marker.circle.radius + '" fill="' + paper + '"/>' : '') + '</g>';
|
|
106
|
+
}
|
|
107
|
+
/** Escaped native HTML shared verbatim by both framework hosts; always includes folded fields. */
|
|
108
|
+
export function renderErdTable(document) {
|
|
109
|
+
const e = escapeErdXml;
|
|
110
|
+
const entities = Object.values(document.entities).sort((a, b) => a.id < b.id ? -1 : 1);
|
|
111
|
+
const endpoint = (target) => { const p = document.ports[target]; return p ? erdText(document.entities[p.owner].attributes, 'name') + '.' + p.name : erdText(document.entities[target]?.attributes ?? {}, 'name'); };
|
|
112
|
+
let html = '<details class="st-diagramErdTable"><summary>Entities, fields and relations</summary><table><caption>Entities and fields</caption><thead><tr><th scope="col">Entity</th><th scope="col">Field</th><th scope="col">Type</th><th scope="col">Key</th><th scope="col">Foreign key</th><th scope="col">Nullable</th></tr></thead><tbody>';
|
|
113
|
+
for (const entity of entities)
|
|
114
|
+
for (const field of erdFields(document, entity.id))
|
|
115
|
+
html += '<tr data-erd-table-field="' + e(field.id) + '"><th scope="row">' + e(erdText(entity.attributes, 'name')) + '</th><td>' + e(field.name) + '</td><td>' + e(erdText(field.attributes, 'dataType')) + '</td><td>' + [erdFlag(field, 'pk') ? 'PK' : '', field.attributes.fk ? 'FK' : ''].filter(Boolean).join(' ') + '</td><td>' + e(endpoint(erdText(field.attributes, 'fk'))) + '</td><td>' + (erdFlag(field, 'nullable') ? 'Yes' : 'No') + '</td></tr>';
|
|
116
|
+
html += '</tbody></table><table><caption>Relations</caption><thead><tr><th scope="col">From</th><th scope="col">Cardinality</th><th scope="col">Role</th><th scope="col">To</th><th scope="col">Cardinality</th><th scope="col">Role</th></tr></thead><tbody>';
|
|
117
|
+
for (const relation of Object.values(document.relations).sort((a, b) => a.id < b.id ? -1 : 1))
|
|
118
|
+
html += '<tr data-erd-table-relation="' + e(relation.id) + '">' + ['from', 'to'].map(role => '<td>' + e(endpoint(relation.endpoints.find(end => end.role === role)?.target ?? '')) + '</td><td>' + e(erdText(relation.attributes, role + 'Cardinality')) + '</td><td>' + e(erdText(relation.attributes, role + 'Role') || (role === 'to' ? erdText(relation.attributes, 'label') || erdText(relation.attributes, 'name') : '')) + '</td>').join('') + '</tr>';
|
|
119
|
+
return html + '</tbody></table></details>';
|
|
120
|
+
}
|
|
121
|
+
/** Keep every role readable: crowded labels move to a free box with a leader instead of disappearing. */
|
|
122
|
+
export function placeErdRoleLabels(entries, blockers, margin) {
|
|
123
|
+
const out = new Map(), occupied = [...blockers];
|
|
124
|
+
const normal = placeEdgeLabels(entries, blockers, margin);
|
|
125
|
+
for (const entry of entries) {
|
|
126
|
+
const placement = normal.get(entry.id);
|
|
127
|
+
if (placement) {
|
|
128
|
+
out.set(entry.id, { box: placement.box });
|
|
129
|
+
occupied.push(placement.box);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const free = (box) => occupied.every(b => !rectsIntersect({ x: box.x - margin, y: box.y - margin, width: box.width + 2 * margin, height: box.height + 2 * margin }, b));
|
|
133
|
+
for (const entry of entries) {
|
|
134
|
+
if (out.has(entry.id))
|
|
135
|
+
continue;
|
|
136
|
+
const initial = edgeLabelPlacement(entry.route, entry.size);
|
|
137
|
+
if (!initial)
|
|
138
|
+
continue;
|
|
139
|
+
let box;
|
|
140
|
+
for (let ring = 1; ring <= 64 && !box; ring++)
|
|
141
|
+
for (const [dx, dy] of [[0, -1], [0, 1], [-1, 0], [1, 0], [-1, -1], [1, -1], [-1, 1], [1, 1]]) {
|
|
142
|
+
const candidate = { ...initial.box, x: initial.box.x + dx * ring * ERD_GEOMETRY.rowHeight, y: initial.box.y + dy * ring * ERD_GEOMETRY.rowHeight };
|
|
143
|
+
if (free(candidate)) {
|
|
144
|
+
box = candidate;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!box)
|
|
149
|
+
box = { ...initial.box, x: Math.max(0, ...occupied.map(b => b.x + b.width)) + ERD_GEOMETRY.padding };
|
|
150
|
+
const end = { x: Math.max(box.x, Math.min(initial.centre.x, box.x + box.width)), y: Math.max(box.y, Math.min(initial.centre.y, box.y + box.height)) };
|
|
151
|
+
out.set(entry.id, { box, leader: [initial.centre, end] });
|
|
152
|
+
occupied.push(box);
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=erd.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Shared logical flow interaction; framework hosts bind events and attributes only. */
|
|
2
|
+
import type { FlowStep } from "@sentropic/diagram-core";
|
|
3
|
+
import { type FlowTokens } from "../layout/flows.js";
|
|
4
|
+
import type { SceneModel } from "./diagramSceneModel.js";
|
|
5
|
+
export type Selection = {
|
|
6
|
+
readonly kind: "step";
|
|
7
|
+
readonly relation: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "node";
|
|
10
|
+
readonly entity: string;
|
|
11
|
+
} | null;
|
|
12
|
+
export type Visible = {
|
|
13
|
+
readonly kind: "edge";
|
|
14
|
+
readonly occurrence: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: "bundle";
|
|
17
|
+
readonly id: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "box";
|
|
20
|
+
readonly occurrence: string;
|
|
21
|
+
};
|
|
22
|
+
export interface FlowState {
|
|
23
|
+
readonly selection: Selection;
|
|
24
|
+
readonly hover: Visible | null;
|
|
25
|
+
readonly focus: Visible | null;
|
|
26
|
+
readonly scenario?: string;
|
|
27
|
+
readonly muted: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface EffectiveTarget {
|
|
30
|
+
readonly visible: Visible;
|
|
31
|
+
readonly step?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const INITIAL_FLOW_STATE: FlowState;
|
|
34
|
+
export type FlowAction = {
|
|
35
|
+
readonly type: "activate";
|
|
36
|
+
readonly target: Visible;
|
|
37
|
+
} | {
|
|
38
|
+
readonly type: "hover" | "focus";
|
|
39
|
+
readonly target: Visible | null;
|
|
40
|
+
} | {
|
|
41
|
+
readonly type: "next" | "previous" | "first" | "last" | "escape" | "repair";
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: "scenario";
|
|
44
|
+
readonly id?: string;
|
|
45
|
+
};
|
|
46
|
+
export interface StepChange {
|
|
47
|
+
readonly relation: string;
|
|
48
|
+
readonly scenario: string;
|
|
49
|
+
readonly ordinal: number;
|
|
50
|
+
readonly realises?: string;
|
|
51
|
+
readonly visible: Visible;
|
|
52
|
+
}
|
|
53
|
+
export interface FlowStrings {
|
|
54
|
+
readonly step: string;
|
|
55
|
+
readonly scenario: string;
|
|
56
|
+
readonly count: string;
|
|
57
|
+
readonly node: string;
|
|
58
|
+
readonly "navigator": string;
|
|
59
|
+
readonly previous: string;
|
|
60
|
+
readonly next: string;
|
|
61
|
+
readonly allScenarios: string;
|
|
62
|
+
}
|
|
63
|
+
export declare const DEFAULT_FLOW_STRINGS: FlowStrings;
|
|
64
|
+
export declare const stepsOf: (scene: SceneModel) => readonly FlowStep[];
|
|
65
|
+
export declare function visibleOf(scene: SceneModel, selection: Selection): Visible | null;
|
|
66
|
+
export declare function effectiveTarget(scene: SceneModel, state: FlowState): EffectiveTarget | null;
|
|
67
|
+
export declare function stepChange(scene: SceneModel, selection: Selection): StepChange | null;
|
|
68
|
+
export declare function reduce(scene: SceneModel, state: FlowState, action: FlowAction): {
|
|
69
|
+
state: FlowState;
|
|
70
|
+
emit: ("step" | "scenario" | "highlight")[];
|
|
71
|
+
};
|
|
72
|
+
export declare function highlightOf(scene: SceneModel, state: FlowState): {
|
|
73
|
+
primary: ReadonlySet<string>;
|
|
74
|
+
related: ReadonlySet<string>;
|
|
75
|
+
dimmed: ReadonlySet<string>;
|
|
76
|
+
};
|
|
77
|
+
export declare function flowStateOf(highlight: ReturnType<typeof highlightOf>, id: string): "primary" | "related" | "dim" | undefined;
|
|
78
|
+
export declare function describeTarget(scene: SceneModel, visible: Visible, strings?: FlowStrings): string;
|
|
79
|
+
export declare function announce(scene: SceneModel, state: FlowState, strings?: FlowStrings): string;
|
|
80
|
+
export declare function flowHitSize(zoom: number, tokens?: Pick<FlowTokens, "flowBadgeSize" | "flowTargetMinSize">): number;
|
|
81
|
+
export declare function flowMarksSvg(scene: SceneModel, tokens?: FlowTokens): string;
|
|
82
|
+
//# sourceMappingURL=flowModel.d.ts.map
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { DEFAULT_FLOW_TOKENS } from "../layout/flows.js";
|
|
2
|
+
export const INITIAL_FLOW_STATE = Object.freeze({ selection: null, hover: null, focus: null, muted: false });
|
|
3
|
+
export const DEFAULT_FLOW_STRINGS = Object.freeze({ step: "Step", scenario: "Scenario", count: "{n}", node: "Component", "navigator": "Flow navigation", previous: "Previous step", next: "Next step", allScenarios: "All scenarios" });
|
|
4
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
5
|
+
export const stepsOf = (scene) => scene.flows.scenarios.flatMap((s) => s.steps);
|
|
6
|
+
export function visibleOf(scene, selection) {
|
|
7
|
+
if (selection === null)
|
|
8
|
+
return null;
|
|
9
|
+
if (selection.kind === "node") {
|
|
10
|
+
const box = scene.flowRepresentatives[selection.entity];
|
|
11
|
+
return box === undefined ? null : { kind: "box", occurrence: box };
|
|
12
|
+
}
|
|
13
|
+
const target = scene.flowTargets[selection.relation];
|
|
14
|
+
return target === undefined ? null : target.kind === "internal" ? { kind: "box", occurrence: target.box } : target.kind === "bundle" ? { kind: "bundle", id: target.id } : { kind: "edge", occurrence: target.occurrence };
|
|
15
|
+
}
|
|
16
|
+
export function effectiveTarget(scene, state) {
|
|
17
|
+
const selected = visibleOf(scene, state.selection);
|
|
18
|
+
const visible = (!state.muted && (state.hover ?? state.focus)) || selected;
|
|
19
|
+
if (visible === null)
|
|
20
|
+
return null;
|
|
21
|
+
const own = visible.kind === "edge" ? scene.edges.find((e) => e.occurrence === visible.occurrence)?.flow?.relation : undefined;
|
|
22
|
+
const step = own ?? (state.selection?.kind === "step" && same(selected, visible) ? state.selection.relation : undefined);
|
|
23
|
+
return { visible, ...(step === undefined ? {} : { step }) };
|
|
24
|
+
}
|
|
25
|
+
export function stepChange(scene, selection) {
|
|
26
|
+
if (selection?.kind !== "step")
|
|
27
|
+
return null;
|
|
28
|
+
const step = scene.flows.byRelation[selection.relation], visible = visibleOf(scene, selection);
|
|
29
|
+
return step === undefined || visible === null ? null : { relation: step.relation, scenario: step.scenario, ordinal: step.ordinal, ...(step.realises === undefined ? {} : { realises: step.realises }), visible };
|
|
30
|
+
}
|
|
31
|
+
export function reduce(scene, state, action) {
|
|
32
|
+
let next = state;
|
|
33
|
+
const filtered = stepsOf(scene).filter((s) => state.scenario === undefined || s.scenario === state.scenario);
|
|
34
|
+
if (action.type === "hover" || action.type === "focus") {
|
|
35
|
+
if (!same(state[action.type], action.target))
|
|
36
|
+
next = { ...state, [action.type]: action.target, muted: false };
|
|
37
|
+
}
|
|
38
|
+
else if (action.type === "escape")
|
|
39
|
+
next = { ...state, selection: null, muted: true };
|
|
40
|
+
else if (action.type === "scenario") {
|
|
41
|
+
const { scenario: _previous, ...rest } = state;
|
|
42
|
+
const selection = state.selection?.kind === "step" && action.id !== undefined && scene.flows.byRelation[state.selection.relation]?.scenario !== action.id ? null : state.selection;
|
|
43
|
+
next = { ...rest, ...(action.id === undefined ? {} : { scenario: action.id }), selection };
|
|
44
|
+
}
|
|
45
|
+
else if (action.type === "repair") {
|
|
46
|
+
const valid = (v) => v !== null && (v.kind === "box" ? scene.nodes.some((n) => n.occurrence === v.occurrence) : v.kind === "bundle" ? scene.edges.some((e) => e.bundle?.id === v.id) : scene.edges.some((e) => e.occurrence === v.occurrence)) ? v : null;
|
|
47
|
+
next = { ...state, selection: visibleOf(scene, state.selection) === null ? null : state.selection, hover: valid(state.hover), focus: valid(state.focus) };
|
|
48
|
+
}
|
|
49
|
+
else if (action.type === "activate") {
|
|
50
|
+
const target = action.target;
|
|
51
|
+
let selection = null;
|
|
52
|
+
if (target.kind === "box") {
|
|
53
|
+
const node = scene.nodes.find((n) => n.occurrence === target.occurrence);
|
|
54
|
+
if (node !== undefined)
|
|
55
|
+
selection = { kind: "node", entity: node.entity };
|
|
56
|
+
}
|
|
57
|
+
else if (target.kind === "edge") {
|
|
58
|
+
const step = scene.edges.find((e) => e.occurrence === target.occurrence)?.flow;
|
|
59
|
+
if (step !== undefined)
|
|
60
|
+
selection = { kind: "step", relation: step.relation };
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const bundle = scene.edges.find((e) => e.bundle?.id === target.id)?.bundle;
|
|
64
|
+
if (bundle !== undefined) {
|
|
65
|
+
const selected = state.selection?.kind === "step" ? bundle.members.findIndex((m) => m.relation === state.selection.relation) : -1;
|
|
66
|
+
const member = selected >= 0 ? bundle.members[(selected + 1) % bundle.members.length] : bundle.members.find((m) => state.scenario !== undefined && scene.flows.byRelation[m.relation]?.scenario === state.scenario) ?? bundle.members[0];
|
|
67
|
+
if (member !== undefined)
|
|
68
|
+
selection = { kind: "step", relation: member.relation };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
next = { ...state, selection: target.kind !== "bundle" && same(selection, state.selection) ? null : selection, muted: false };
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const position = state.selection?.kind === "step" ? filtered.findIndex((s) => s.relation === state.selection.relation) : -1;
|
|
75
|
+
const index = action.type === "first" ? 0 : action.type === "last" ? filtered.length - 1 : action.type === "next" ? Math.min(filtered.length - 1, position + 1) : position < 0 ? filtered.length - 1 : Math.max(0, position - 1);
|
|
76
|
+
const step = filtered[index];
|
|
77
|
+
if (step !== undefined)
|
|
78
|
+
next = { ...state, selection: { kind: "step", relation: step.relation }, muted: false };
|
|
79
|
+
}
|
|
80
|
+
const emit = [];
|
|
81
|
+
if (!same(state.selection, next.selection))
|
|
82
|
+
emit.push("step");
|
|
83
|
+
if (state.scenario !== next.scenario)
|
|
84
|
+
emit.push("scenario");
|
|
85
|
+
if (!same(effectiveTarget(scene, state), effectiveTarget(scene, next)))
|
|
86
|
+
emit.push("highlight");
|
|
87
|
+
return { state: next, emit };
|
|
88
|
+
}
|
|
89
|
+
export function highlightOf(scene, state) {
|
|
90
|
+
const primary = new Set(), related = new Set(), dimmed = new Set();
|
|
91
|
+
const universe = new Set([...scene.nodes.map((n) => n.occurrence), ...scene.edges.map((e) => e.occurrence), ...scene.edges.flatMap((e) => e.bundle === undefined ? [] : [e.bundle.id])]);
|
|
92
|
+
const ancestors = (id, set) => { for (const parent of scene.flowAncestors[id] ?? [])
|
|
93
|
+
set.add(parent); };
|
|
94
|
+
const addStep = (step, set, ends) => {
|
|
95
|
+
const target = scene.flowTargets[step.relation];
|
|
96
|
+
if (target === undefined)
|
|
97
|
+
return;
|
|
98
|
+
if (target.kind === "internal") {
|
|
99
|
+
set.add(target.box);
|
|
100
|
+
if (ends)
|
|
101
|
+
ancestors(target.box, set);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
set.add(target.occurrence);
|
|
105
|
+
if (target.kind === "bundle")
|
|
106
|
+
set.add(target.id);
|
|
107
|
+
if (ends)
|
|
108
|
+
for (const id of scene.flowEnds[step.relation] ?? []) {
|
|
109
|
+
set.add(id);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const effective = effectiveTarget(scene, state);
|
|
113
|
+
if (effective === null && state.scenario === undefined)
|
|
114
|
+
return { primary, related, dimmed };
|
|
115
|
+
if (effective === null) {
|
|
116
|
+
const kept = new Set();
|
|
117
|
+
for (const step of stepsOf(scene).filter((s) => s.scenario === state.scenario)) {
|
|
118
|
+
addStep(step, kept, true);
|
|
119
|
+
for (const id of scene.flowEnds[step.relation] ?? [])
|
|
120
|
+
ancestors(id, kept);
|
|
121
|
+
}
|
|
122
|
+
const filterable = [...scene.nodes.map((n) => n.occurrence), ...scene.edges.flatMap((e) => e.bundle !== undefined ? [e.occurrence, e.bundle.id] : e.flow !== undefined ? [e.occurrence] : [])];
|
|
123
|
+
for (const id of filterable)
|
|
124
|
+
if (!kept.has(id))
|
|
125
|
+
dimmed.add(id);
|
|
126
|
+
return { primary, related, dimmed };
|
|
127
|
+
}
|
|
128
|
+
const step = effective.step === undefined ? undefined : scene.flows.byRelation[effective.step];
|
|
129
|
+
const scenarios = new Set();
|
|
130
|
+
if (step !== undefined) {
|
|
131
|
+
addStep(step, primary, true);
|
|
132
|
+
scenarios.add(step.scenario);
|
|
133
|
+
for (const id of scene.flowEnds[step.relation] ?? [])
|
|
134
|
+
ancestors(id, related);
|
|
135
|
+
}
|
|
136
|
+
else if (effective.visible.kind === "bundle") {
|
|
137
|
+
const bundle = scene.edges.find((e) => e.bundle?.id === effective.visible.id)?.bundle;
|
|
138
|
+
for (const m of bundle?.members ?? []) {
|
|
139
|
+
const member = scene.flows.byRelation[m.relation];
|
|
140
|
+
if (member !== undefined) {
|
|
141
|
+
addStep(member, primary, true);
|
|
142
|
+
scenarios.add(member.scenario);
|
|
143
|
+
for (const id of scene.flowEnds[m.relation] ?? [])
|
|
144
|
+
ancestors(id, related);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (effective.visible.kind === "box") {
|
|
149
|
+
const box = effective.visible.occurrence;
|
|
150
|
+
primary.add(box);
|
|
151
|
+
ancestors(box, related);
|
|
152
|
+
for (const s of stepsOf(scene))
|
|
153
|
+
if ((scene.flowEnds[s.relation] ?? []).some((id) => id === box || (scene.flowAncestors[id] ?? []).includes(box))) {
|
|
154
|
+
addStep(s, primary, false);
|
|
155
|
+
for (const id of scene.flowEnds[s.relation] ?? [])
|
|
156
|
+
if (id !== box) {
|
|
157
|
+
related.add(id);
|
|
158
|
+
ancestors(id, related);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
for (const s of stepsOf(scene))
|
|
163
|
+
if (scenarios.has(s.scenario))
|
|
164
|
+
addStep(s, related, false);
|
|
165
|
+
for (const id of primary)
|
|
166
|
+
related.delete(id);
|
|
167
|
+
for (const id of universe)
|
|
168
|
+
if (!primary.has(id) && !related.has(id))
|
|
169
|
+
dimmed.add(id);
|
|
170
|
+
return { primary, related, dimmed };
|
|
171
|
+
}
|
|
172
|
+
export function flowStateOf(highlight, id) {
|
|
173
|
+
return highlight.primary.has(id) ? "primary" : highlight.related.has(id) ? "related" : highlight.dimmed.has(id) ? "dim" : undefined;
|
|
174
|
+
}
|
|
175
|
+
const nameOf = (scene, entity) => scene.nodes.find((n) => n.entity === entity)?.text || entity;
|
|
176
|
+
export function describeTarget(scene, visible, strings = DEFAULT_FLOW_STRINGS) {
|
|
177
|
+
const describe = (step) => [strings.step + " " + step.badge, scene.flows.scenarios.find((s) => s.id === step.scenario)?.label, nameOf(scene, step.source) + " → " + nameOf(scene, step.target), step.label, step.realises].filter(Boolean).join(". ");
|
|
178
|
+
if (visible.kind === "edge") {
|
|
179
|
+
const step = scene.edges.find((e) => e.occurrence === visible.occurrence)?.flow;
|
|
180
|
+
return step === undefined ? "" : describe(step);
|
|
181
|
+
}
|
|
182
|
+
if (visible.kind === "bundle") {
|
|
183
|
+
const bundle = scene.edges.find((e) => e.bundle?.id === visible.id)?.bundle;
|
|
184
|
+
if (bundle === undefined)
|
|
185
|
+
return "";
|
|
186
|
+
return [strings.count.replaceAll("{n}", String(bundle.members.length)), ...bundle.members.map((m) => scene.flows.byRelation[m.relation]).filter((s) => s !== undefined).map(describe), ...bundle.summaries.map((id) => scene.flowSummaryLabels[id] ?? id)].join(". ");
|
|
187
|
+
}
|
|
188
|
+
const node = scene.nodes.find((n) => n.occurrence === visible.occurrence);
|
|
189
|
+
if (node === undefined)
|
|
190
|
+
return "";
|
|
191
|
+
const steps = stepsOf(scene).filter((s) => (scene.flowEnds[s.relation] ?? []).some((id) => id === node.occurrence || (scene.flowAncestors[id] ?? []).includes(node.occurrence)));
|
|
192
|
+
return [strings.node + " " + node.text, ...steps.map(describe)].join(". ");
|
|
193
|
+
}
|
|
194
|
+
export function announce(scene, state, strings = DEFAULT_FLOW_STRINGS) {
|
|
195
|
+
if (state.selection?.kind === "step") {
|
|
196
|
+
const step = scene.flows.byRelation[state.selection.relation];
|
|
197
|
+
return step === undefined ? "" : strings.step + " " + step.badge + (step.label ? ". " + step.label : "");
|
|
198
|
+
}
|
|
199
|
+
return "";
|
|
200
|
+
}
|
|
201
|
+
export function flowHitSize(zoom, tokens = DEFAULT_FLOW_TOKENS) { return Math.max(tokens.flowBadgeSize, tokens.flowTargetMinSize / zoom); }
|
|
202
|
+
const escape = (s) => s.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
203
|
+
export function flowMarksSvg(scene, tokens = DEFAULT_FLOW_TOKENS) {
|
|
204
|
+
return scene.edges.flatMap((edge) => edge.arrows.map((arrow) => '<path data-flow-arrow="' + escape(edge.occurrence) + '" d="' + escape(tokens.flowArrowPath) + '" transform="translate(' + arrow.tip.x + ' ' + arrow.tip.y + ') rotate(' + arrow.angle + ') translate(' + (-tokens.flowArrowLength) + ' ' + (-tokens.flowArrowWidth / 2) + ')" fill="var(--st-component-diagramScene-flowStroke)"/>')).join("") + scene.badges.map((badge) => '<g data-flow-badge="' + escape(badge.id) + '"><rect x="' + badge.box.x + '" y="' + badge.box.y + '" width="' + badge.box.width + '" height="' + badge.box.height + '" rx="var(--st-component-diagramScene-flowBadgeRadius)" fill="var(--st-component-diagramScene-flowBadgeBackground)"/><text x="' + (badge.box.x + badge.box.width / 2) + '" y="' + (badge.box.y + badge.box.height / 2) + '" text-anchor="middle" dominant-baseline="central" fill="var(--st-component-diagramScene-flowBadgeText)" font-size="var(--st-component-diagramScene-flowBadgeFontSize)">' + escape(badge.text) + '</text></g>').join("");
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=flowModel.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { renderSceneSvg } from "./renderSceneSvg.js";
|
|
2
|
+
import { renderCardSvg, renderCardSvgFromPresentation, projectCardProps, type CardSvgResult } from "./renderCardSvg.js";
|
|
3
|
+
import { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent, type ZoneSvgResult } from "./renderZoneSvg.js";
|
|
4
|
+
import { cardLineMeasurer, type CardLineLayout, type CardMeasureRequest } from "./diagramCardModel.js";
|
|
5
|
+
import type { CardDiagnostic, CardLayout, CardLineMeasure, CardPresentationInput, DiagramCardProps, DiagramGlyphPaths } from "./renderCardSvg.js";
|
|
6
|
+
import type { DiagramZoneProps, ZoneChildSpec, ZoneDiagnostic, ZoneLayout, ZonePresentationInput } from "./diagramCardModel.js";
|
|
7
|
+
export { renderCardSvg, renderCardSvgFromPresentation, projectCardProps };
|
|
8
|
+
export { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent };
|
|
9
|
+
/**
|
|
10
|
+
* The canvas `LineMeasurer` bridge (diagram-canvas `MeasureRequest` shape):
|
|
11
|
+
* pass `cardLineMeasurer()` straight as the injected measurer. Exported
|
|
12
|
+
* through this subpath so hosts never reach into the barrel.
|
|
13
|
+
*/
|
|
14
|
+
export { cardLineMeasurer };
|
|
15
|
+
export type { CardSvgResult, ZoneSvgResult };
|
|
16
|
+
export type { CardDiagnostic, CardLayout, CardLineLayout, CardLineMeasure, CardMeasureRequest, CardPresentationInput, DiagramCardProps, DiagramGlyphPaths, };
|
|
17
|
+
export type { DiagramZoneProps, ZoneChildSpec, ZoneDiagnostic, ZoneLayout, ZonePresentationInput, };
|
|
18
|
+
export { ERD_GEOMETRY, measureErdCard, renderErdCardSvg, erdMarkerGeometry, renderErdMarkerSvg, renderErdTable } from "./erd.js";
|
|
19
|
+
export type { ErdCard, ErdRow, ErdMarker } from "./erd.js";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { renderSceneSvg } from "./renderSceneSvg.js";
|
|
2
|
+
import { renderCardSvg, renderCardSvgFromPresentation, projectCardProps, } from "./renderCardSvg.js";
|
|
3
|
+
import { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent, } from "./renderZoneSvg.js";
|
|
4
|
+
import { cardLineMeasurer, } from "./diagramCardModel.js";
|
|
5
|
+
export { renderCardSvg, renderCardSvgFromPresentation, projectCardProps };
|
|
6
|
+
export { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent };
|
|
7
|
+
/**
|
|
8
|
+
* The canvas `LineMeasurer` bridge (diagram-canvas `MeasureRequest` shape):
|
|
9
|
+
* pass `cardLineMeasurer()` straight as the injected measurer. Exported
|
|
10
|
+
* through this subpath so hosts never reach into the barrel.
|
|
11
|
+
*/
|
|
12
|
+
export { cardLineMeasurer };
|
|
13
|
+
export { ERD_GEOMETRY, measureErdCard, renderErdCardSvg, erdMarkerGeometry, renderErdMarkerSvg, renderErdTable } from "./erd.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagram pictogram registry — the blue duotone family (DC-1).
|
|
3
|
+
*
|
|
4
|
+
* Spec: spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md §9. One family, drawn identically
|
|
5
|
+
* in cards and zones at the 70 px icon box: `viewBox="0 0 64 64"`, canonical
|
|
6
|
+
* base diamond `M8 53L32 44L56 53L32 62Z`, three layers (base / face / line),
|
|
7
|
+
* face stroke 1.5, line stroke 2.5. Layer colours resolve through the
|
|
8
|
+
* `diagramIcon` component tokens; no per-glyph colour, no raw hex here.
|
|
9
|
+
*
|
|
10
|
+
* Framework-neutral data: no Svelte import, so staged framework adapters
|
|
11
|
+
* (§12.6) reuse these path records without re-drawing a glyph. Provenance
|
|
12
|
+
* per glyph lives in PROVENANCE.md next to this file.
|
|
13
|
+
*/
|
|
14
|
+
export interface DiagramGlyph {
|
|
15
|
+
/** Canonical base diamond path (identical for every glyph). */
|
|
16
|
+
readonly base: string;
|
|
17
|
+
/** Glyph face path (fill + stroke layer). */
|
|
18
|
+
readonly face: string;
|
|
19
|
+
/** Glyph detail path (stroke-only layer). Absent when the glyph has none. */
|
|
20
|
+
readonly line?: string;
|
|
21
|
+
/**
|
|
22
|
+
* When true, the detail line strokes in the info accent instead of the
|
|
23
|
+
* surface colour (the radar `join`/`graph`/`network` case, the kit `link`
|
|
24
|
+
* flag).
|
|
25
|
+
*/
|
|
26
|
+
readonly darkLine?: true;
|
|
27
|
+
/**
|
|
28
|
+
* Text painted inside the glyph (part of the asset, never host content,
|
|
29
|
+
* never localised). Only `s3` carries one.
|
|
30
|
+
*/
|
|
31
|
+
readonly text?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Canonical base diamond — the validated #711 render (§9.1). */
|
|
34
|
+
export declare const DIAGRAM_GLYPH_BASE = "M8 53L32 44L56 53L32 62Z";
|
|
35
|
+
/** Glyph viewBox in force for the whole family. */
|
|
36
|
+
export declare const DIAGRAM_GLYPH_VIEWBOX = "0 0 64 64";
|
|
37
|
+
/**
|
|
38
|
+
* The shipped set (§9.2): the radar-immobilier 19 redrawn on the canonical
|
|
39
|
+
* base plus the sentropic #711 9 (verbatim geometry). 28 names, no
|
|
40
|
+
* collisions across the two sources — no aliasing was needed.
|
|
41
|
+
*/
|
|
42
|
+
export declare const DIAGRAM_GLYPHS: Readonly<Record<string, DiagramGlyph>>;
|
|
43
|
+
/** Shipped glyph names (§9.2: 19 + 9 = 28). */
|
|
44
|
+
export declare const DIAGRAM_GLYPH_NAMES: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a glyph name to its path record. Returns `undefined` for an
|
|
47
|
+
* unmapped name — the callers raise `card-icon-unknown` /
|
|
48
|
+
* `zone-icon-unknown` and draw nothing (DIF-14: no `server` fallback, no
|
|
49
|
+
* silent substitution).
|
|
50
|
+
*/
|
|
51
|
+
export declare function getDiagramGlyph(name: string): DiagramGlyph | undefined;
|
|
52
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagram pictogram registry — the blue duotone family (DC-1).
|
|
3
|
+
*
|
|
4
|
+
* Spec: spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md §9. One family, drawn identically
|
|
5
|
+
* in cards and zones at the 70 px icon box: `viewBox="0 0 64 64"`, canonical
|
|
6
|
+
* base diamond `M8 53L32 44L56 53L32 62Z`, three layers (base / face / line),
|
|
7
|
+
* face stroke 1.5, line stroke 2.5. Layer colours resolve through the
|
|
8
|
+
* `diagramIcon` component tokens; no per-glyph colour, no raw hex here.
|
|
9
|
+
*
|
|
10
|
+
* Framework-neutral data: no Svelte import, so staged framework adapters
|
|
11
|
+
* (§12.6) reuse these path records without re-drawing a glyph. Provenance
|
|
12
|
+
* per glyph lives in PROVENANCE.md next to this file.
|
|
13
|
+
*/
|
|
14
|
+
/** Canonical base diamond — the validated #711 render (§9.1). */
|
|
15
|
+
export const DIAGRAM_GLYPH_BASE = "M8 53L32 44L56 53L32 62Z";
|
|
16
|
+
/** Glyph viewBox in force for the whole family. */
|
|
17
|
+
export const DIAGRAM_GLYPH_VIEWBOX = "0 0 64 64";
|
|
18
|
+
function glyph(face, line, extra) {
|
|
19
|
+
return {
|
|
20
|
+
base: DIAGRAM_GLYPH_BASE,
|
|
21
|
+
face,
|
|
22
|
+
...(line === undefined || line === "" ? {} : { line }),
|
|
23
|
+
...extra,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The shipped set (§9.2): the radar-immobilier 19 redrawn on the canonical
|
|
28
|
+
* base plus the sentropic #711 9 (verbatim geometry). 28 names, no
|
|
29
|
+
* collisions across the two sources — no aliasing was needed.
|
|
30
|
+
*/
|
|
31
|
+
export const DIAGRAM_GLYPHS = {
|
|
32
|
+
base: glyph("M10 12H54V48H10Z", "M18 22H46M18 32H40"),
|
|
33
|
+
// --- radar-immobilier fa8133c2 (19): interiors preserved verbatim, base
|
|
34
|
+
// replaced by the canonical diamond (§9.1, DIF-12) ---
|
|
35
|
+
s3: glyph("M12 18Q32 6 52 18L47 47Q32 58 17 47Z", "M12 18Q32 30 52 18M18 29Q32 38 46 29", {
|
|
36
|
+
text: "S3",
|
|
37
|
+
}),
|
|
38
|
+
postgres: glyph("M12 16Q32 4 52 16V47Q32 59 12 47Z", "M12 16Q32 28 52 16M12 28Q32 40 52 28M12 40Q32 52 52 40"),
|
|
39
|
+
cluster: glyph("M32 7L54 20V44L32 57L10 44V20Z", "M32 19V32M21 26L32 32L43 26M32 32V46M32 32L20 40M32 32L44 40"),
|
|
40
|
+
web: glyph("M8 12H56V49H8Z", "M8 23H56M15 18H17M22 18H24M16 31H30V42H16ZM37 32H48M37 40H48"),
|
|
41
|
+
api: glyph("M8 12H56V50H8Z", "M22 24L15 31L22 38M42 24L49 31L42 38M35 22L29 40"),
|
|
42
|
+
cronjob: glyph("M32 8A24 24 0 1 1 31.9 8Z", "M32 16V32L43 39M17 16L12 21M47 16L52 21"),
|
|
43
|
+
identity: glyph("M32 6L52 14V31Q50 48 32 58Q14 48 12 31V14Z", "M26 29V24A6 6 0 0 1 38 24V29M23 29H41V42H23ZM32 34V37"),
|
|
44
|
+
workstation: glyph("M8 10H56V42H8Z", "M13 15H51V37H13ZM24 43V51M40 43V51M17 53H47M18 23L24 27L18 31M30 31H39"),
|
|
45
|
+
document: glyph("M15 6H37L50 19V57H15Z", "M37 6V19H50M23 28H42M23 36H42M23 44H35"),
|
|
46
|
+
map: glyph("M7 16L24 9L41 16L57 9V49L41 56L24 49L7 56Z", "M24 9V49M41 16V56M13 29L24 25L41 35L51 31"),
|
|
47
|
+
join: glyph("M8 12H24V27H8ZM40 12H56V27H40ZM24 42H40V57H24Z", "M16 27V34H48V27M32 34V42", {
|
|
48
|
+
darkLine: true,
|
|
49
|
+
}),
|
|
50
|
+
graph: glyph("M7 10H23V26H7ZM41 10H57V26H41ZM24 42H40V58H24Z", "M23 18H41M15 26L27 42M49 26L37 42", { darkLine: true }),
|
|
51
|
+
check: glyph("M14 8H50V57H14Z", "M23 8V15H41V8M23 35L30 42L43 27"),
|
|
52
|
+
release: glyph("M12 31L32 20L52 31V50L32 61L12 50Z", "M12 31L32 42L52 31M32 42V61M32 5V25M24 13L32 5L40 13"),
|
|
53
|
+
user: glyph("M22 17A10 10 0 1 1 42 17A10 10 0 1 1 22 17ZM12 54V44Q12 31 25 31H39Q52 31 52 44V54Z", "M20 44V54M44 44V54"),
|
|
54
|
+
url: glyph("M32 7A25 25 0 1 1 31.9 7Z", "M7 32H57M12 19H52M12 45H52M32 7C16 19 16 45 32 57C48 45 48 19 32 7Z"),
|
|
55
|
+
llm: glyph("M17 17H47V47H17Z", "M25 25H39V39H25ZM25 8V17M39 8V17M25 47V56M39 47V56M8 25H17M8 39H17M47 25H56M47 39H56"),
|
|
56
|
+
network: glyph("M24 7H40V23H24ZM5 42H21V58H5ZM43 42H59V58H43Z", "M32 23V33M13 42V33H51V42", { darkLine: true }),
|
|
57
|
+
unknown: glyph("M32 6L59 55H5Z", "M32 24V38M32 45V46"),
|
|
58
|
+
// --- sentropic #711 via the hrpolnav kit (9): verbatim geometry on the
|
|
59
|
+
// canonical base, 64-unit viewBox ---
|
|
60
|
+
people: glyph("M22 10a8 8 0 1 1 0 16a8 8 0 1 1 0-16Z M42 14a7 7 0 1 1 0 14a7 7 0 1 1 0-14Z M8 46c0-9 6-15 14-15s14 6 14 15Z M34 46c0-8 4-13 9-13s12 5 12 13Z"),
|
|
61
|
+
"window": glyph("M9 11h46v36H9Z", "M9 19h46 M16 28h32 M16 35h22"),
|
|
62
|
+
server: glyph("M14 8h36v14H14Z M14 25h36v14H14Z", "M20 15h10 M20 32h10 M42 15h.1 M42 32h.1"),
|
|
63
|
+
brain: glyph("M32 12c-4-7-15-5-16 3c-8 1-11 11-6 17c-5 8 0 17 8 17c5 5 12 3 14-2c2 5 9 7 14 2c8 0 13-9 8-17c5-6 2-16-6-17c-1-8-12-10-16-3Z", "M32 12v35 M16 15c0 6 4 9 9 9 M10 32c4-4 9-3 12 1 M18 49c-2-5 0-10 5-12 M48 15c0-6-4-9-9-9 M54 32c-4-4-9-3-12 1 M46 49c2-5 0-10-5-12"),
|
|
64
|
+
robot: glyph("M14 16h36v31H14Z M8 25h6v13H8Z M50 25h6v13h-6Z M29 6h6v5h-6Z", "M32 11v5 M23 27h.1 M41 27h.1 M23 38h18"),
|
|
65
|
+
link: glyph("M10 12h16v14H10Z M38 30h16v14H38Z", "M26 19h12v11", { darkLine: true }),
|
|
66
|
+
db: glyph("M14 13c0-4 8-7 18-7s18 3 18 7v29c0 4-8 7-18 7s-18-3-18-7Z", "M14 13c0 4 8 7 18 7s18-3 18-7 M14 27c0 4 8 7 18 7s18-3 18-7"),
|
|
67
|
+
shield: glyph("M32 7l20 7v13c0 12-8 20-20 25C20 47 12 39 12 27V14Z", "M23 29l6 6 12-13"),
|
|
68
|
+
cloud: glyph("M18 44a10 10 0 0 1 0-20a14 14 0 0 1 27-4a11 11 0 0 1 3 24Z"),
|
|
69
|
+
};
|
|
70
|
+
/** Shipped glyph names (§9.2: 19 + 9 = 28). */
|
|
71
|
+
export const DIAGRAM_GLYPH_NAMES = Object.keys(DIAGRAM_GLYPHS);
|
|
72
|
+
/**
|
|
73
|
+
* Resolve a glyph name to its path record. Returns `undefined` for an
|
|
74
|
+
* unmapped name — the callers raise `card-icon-unknown` /
|
|
75
|
+
* `zone-icon-unknown` and draw nothing (DIF-14: no `server` fallback, no
|
|
76
|
+
* silent substitution).
|
|
77
|
+
*/
|
|
78
|
+
export function getDiagramGlyph(name) {
|
|
79
|
+
return Object.hasOwn(DIAGRAM_GLYPHS, name) ? DIAGRAM_GLYPHS[name] : undefined;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=registry.js.map
|