@diagc/cli 1.5.0 → 1.6.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/assets/guide/index.md +1 -1
- package/assets/skill/SKILL.md +1 -1
- package/dist/cli/io.d.ts +5 -0
- package/dist/cli/io.js +4 -0
- package/dist/cli/parse.d.ts +7 -0
- package/dist/cli/parse.js +25 -0
- package/dist/cli/run.js +4 -0
- package/dist/cli.js +23 -1
- package/dist/commands/shared.d.ts +4 -0
- package/dist/commands/shared.js +13 -0
- package/dist/commands/show.d.ts +5 -0
- package/dist/commands/show.js +115 -0
- package/dist/commands/tui.d.ts +3 -0
- package/dist/commands/tui.js +36 -0
- package/dist/init.d.ts +1 -1
- package/dist/init.js +1 -1
- package/dist/text/accents.d.ts +9 -0
- package/dist/text/accents.js +83 -0
- package/dist/text/ansi.d.ts +28 -0
- package/dist/text/ansi.js +111 -0
- package/dist/text/braille.d.ts +28 -0
- package/dist/text/braille.js +58 -0
- package/dist/text/canvas.d.ts +65 -0
- package/dist/text/canvas.js +155 -0
- package/dist/text/content.d.ts +32 -0
- package/dist/text/content.js +90 -0
- package/dist/text/fish.d.ts +27 -0
- package/dist/text/fish.js +209 -0
- package/dist/text/folds.d.ts +14 -0
- package/dist/text/folds.js +45 -0
- package/dist/text/glyphs.d.ts +31 -0
- package/dist/text/glyphs.js +84 -0
- package/dist/text/layout.d.ts +61 -0
- package/dist/text/layout.js +334 -0
- package/dist/text/legend.d.ts +44 -0
- package/dist/text/legend.js +252 -0
- package/dist/text/paint.d.ts +25 -0
- package/dist/text/paint.js +208 -0
- package/dist/text/render.d.ts +11 -0
- package/dist/text/render.js +28 -0
- package/dist/text/scene.d.ts +40 -0
- package/dist/text/scene.js +50 -0
- package/dist/text/vocabulary.d.ts +37 -0
- package/dist/text/vocabulary.js +211 -0
- package/dist/text/width.d.ts +15 -0
- package/dist/text/width.js +181 -0
- package/dist/tui/actions.d.ts +10 -0
- package/dist/tui/actions.js +297 -0
- package/dist/tui/app.d.ts +31 -0
- package/dist/tui/app.js +389 -0
- package/dist/tui/details.d.ts +3 -0
- package/dist/tui/details.js +54 -0
- package/dist/tui/keys.d.ts +33 -0
- package/dist/tui/keys.js +113 -0
- package/dist/tui/kitty.d.ts +36 -0
- package/dist/tui/kitty.js +65 -0
- package/dist/tui/legend.d.ts +14 -0
- package/dist/tui/legend.js +18 -0
- package/dist/tui/nav.d.ts +25 -0
- package/dist/tui/nav.js +79 -0
- package/dist/tui/overview.d.ts +46 -0
- package/dist/tui/overview.js +115 -0
- package/dist/tui/pixels.d.ts +28 -0
- package/dist/tui/pixels.js +80 -0
- package/dist/tui/screen.d.ts +44 -0
- package/dist/tui/screen.js +335 -0
- package/dist/tui/state.d.ts +100 -0
- package/dist/tui/state.js +72 -0
- package/dist/tui/terminal.d.ts +21 -0
- package/dist/tui/terminal.js +53 -0
- package/dist/watch.d.ts +2 -0
- package/dist/watch.js +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { buildHierarchy, presetLayers, relationLayer, relationOnPlane, scopeToRoot, } from '@diagc/core/internal';
|
|
2
|
+
import { Canvas } from './canvas.js';
|
|
3
|
+
import { typeMark } from './content.js';
|
|
4
|
+
import { DOWN, LEFT, RIGHT } from './glyphs.js';
|
|
5
|
+
import { accentCss, CORNER, rgb, WEIGHT } from './paint.js';
|
|
6
|
+
import { KIND_LOOKS, kindLook, TYPE_LOOKS, typeLook } from './vocabulary.js';
|
|
7
|
+
import { cellWidth, fitCells, printable } from './width.js';
|
|
8
|
+
/** A swatch's cells: three, the width of a line with a mark at each end. */
|
|
9
|
+
const SWATCH = 3;
|
|
10
|
+
const TITLES = {
|
|
11
|
+
layers: 'Layers',
|
|
12
|
+
kinds: 'Connections',
|
|
13
|
+
types: 'Elements',
|
|
14
|
+
marks: 'Marks',
|
|
15
|
+
items: 'Notes',
|
|
16
|
+
};
|
|
17
|
+
/** What a legend with no `show` derives; the types are keyed only where they need it. */
|
|
18
|
+
const DEFAULT_SECTIONS = ['layers', 'kinds', 'marks'];
|
|
19
|
+
const MARKS = { pk: ['PK', 'Primary key'], fk: ['FK', 'Foreign key column'] };
|
|
20
|
+
const DIM = { dim: true };
|
|
21
|
+
/** `text` in the middle of the swatch's cells. */
|
|
22
|
+
function centre(text) {
|
|
23
|
+
const left = Math.max(0, (SWATCH - cellWidth(text)) >> 1);
|
|
24
|
+
return `${' '.repeat(left)}${text}${' '.repeat(Math.max(0, SWATCH - left - cellWidth(text)))}`;
|
|
25
|
+
}
|
|
26
|
+
const colour = (css) => {
|
|
27
|
+
const fg = rgb(css);
|
|
28
|
+
return fg === undefined ? {} : { fg };
|
|
29
|
+
};
|
|
30
|
+
/** Each key with its value where every entry for it agrees, else undefined: a swatch
|
|
31
|
+
* takes a colour only when all it stands for are drawn in that colour. */
|
|
32
|
+
function agreed(entries) {
|
|
33
|
+
const out = new Map();
|
|
34
|
+
for (const [key, value] of entries) {
|
|
35
|
+
if (!out.has(key))
|
|
36
|
+
out.set(key, value);
|
|
37
|
+
else if (out.get(key) !== value)
|
|
38
|
+
out.set(key, undefined);
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
/** The vocabulary's own order first (an authored one), then unknown ids alphabetically:
|
|
43
|
+
* never the order things are met in, which would reshuffle the key at every fold. */
|
|
44
|
+
function ordered(ids, known) {
|
|
45
|
+
const rank = new Map(known.map((k, i) => [k, i]));
|
|
46
|
+
const at = (id) => rank.get(id) ?? known.length;
|
|
47
|
+
return [...ids].sort((a, b) => at(a) - at(b) || a.localeCompare(b));
|
|
48
|
+
}
|
|
49
|
+
/** A line as the picture draws one of the kind: its weight, then its ends' marks. */
|
|
50
|
+
function lineSwatch(look, glyphs) {
|
|
51
|
+
const line = glyphs.line(LEFT | RIGHT, WEIGHT[look.line]);
|
|
52
|
+
const end = (mark, toward) => mark === undefined || mark === 'none' ? line : mark === 'arrow' ? glyphs.arrow(toward) : glyphs.mark(mark);
|
|
53
|
+
return `${end(look.start, 'left')}${line}${end(look.end, 'right')}`;
|
|
54
|
+
}
|
|
55
|
+
/** A box of the type as the picture draws it: the mark its name follows where it has
|
|
56
|
+
* one, else the top of its border, which carries its corners and its dashes. */
|
|
57
|
+
function shapeSwatch(type, look, glyphs) {
|
|
58
|
+
const mark = typeMark(type, look.shape, glyphs);
|
|
59
|
+
if (mark !== undefined)
|
|
60
|
+
return centre(mark);
|
|
61
|
+
const weight = look.shape === 'bar' ? 'heavy' : look.dashed === true ? 'dashed' : 'light';
|
|
62
|
+
const corner = CORNER[look.shape];
|
|
63
|
+
return `${glyphs.line(DOWN | RIGHT, weight, corner)}${glyphs.line(LEFT | RIGHT, weight)}${glyphs.line(DOWN | LEFT, weight, corner)}`;
|
|
64
|
+
}
|
|
65
|
+
const vocabulary = (caption) => caption !== undefined ? { vocabulary: true } : {};
|
|
66
|
+
/** The layers something in this view carries, folded away or not: what the plane holds,
|
|
67
|
+
* or a drill's inside. The browser's rule (legendRows' `drawableSlice`), so a layer's row
|
|
68
|
+
* does not come and go as its boxes fold. */
|
|
69
|
+
function carriedLayers({ model, plane, root }) {
|
|
70
|
+
const hierarchy = buildHierarchy(model, plane);
|
|
71
|
+
const viewed = plane ?? model.planes[0]?.id;
|
|
72
|
+
const visible = new Set(hierarchy.childrenOf.keys());
|
|
73
|
+
const { nodes, relations } = root !== undefined && hierarchy.childrenOf.has(root)
|
|
74
|
+
? scopeToRoot(model, hierarchy, root).model
|
|
75
|
+
: {
|
|
76
|
+
nodes: model.nodes.filter((n) => visible.has(n.id)),
|
|
77
|
+
relations: model.relations.filter((r) => visible.has(r.from) && visible.has(r.to)),
|
|
78
|
+
};
|
|
79
|
+
const carried = new Set();
|
|
80
|
+
for (const n of nodes) {
|
|
81
|
+
if (n.layer !== undefined)
|
|
82
|
+
carried.add(n.layer);
|
|
83
|
+
for (const c of n.columns ?? [])
|
|
84
|
+
if (c.layer !== undefined)
|
|
85
|
+
carried.add(c.layer);
|
|
86
|
+
}
|
|
87
|
+
// the effective layer: one a `layerRules` entry puts a relation on counts as a tag does
|
|
88
|
+
for (const r of relations) {
|
|
89
|
+
const layer = relationOnPlane(r, viewed) ? relationLayer(model, r) : undefined;
|
|
90
|
+
if (layer !== undefined)
|
|
91
|
+
carried.add(layer);
|
|
92
|
+
}
|
|
93
|
+
return carried;
|
|
94
|
+
}
|
|
95
|
+
function layerRows(scene, glyphs) {
|
|
96
|
+
const { model, plane, layers } = scene.input;
|
|
97
|
+
const carried = carriedLayers(scene.input);
|
|
98
|
+
const on = new Set(layers ?? presetLayers(model.planes, plane));
|
|
99
|
+
return model.layers
|
|
100
|
+
.filter((l) => carried.has(l.id) && on.has(l.id))
|
|
101
|
+
.map((l) => ({
|
|
102
|
+
id: `layers:${l.id}`,
|
|
103
|
+
swatch: centre(glyphs.mark('square')),
|
|
104
|
+
style: colour(l.tint),
|
|
105
|
+
label: printable(l.name),
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
function kindRows(scene, glyphs) {
|
|
109
|
+
// the layer's tint, not a relation's own colour: that is one arrow's, not the kind's
|
|
110
|
+
const inks = agreed(scene.view.edges.map((e) => [e.kind, e.tint]));
|
|
111
|
+
return ordered(inks.keys(), Object.keys(KIND_LOOKS)).map((kind) => {
|
|
112
|
+
const look = kindLook({ kind }, scene.notation);
|
|
113
|
+
return {
|
|
114
|
+
id: `kinds:${kind}`,
|
|
115
|
+
swatch: lineSwatch(look, glyphs),
|
|
116
|
+
style: colour(inks.get(kind)),
|
|
117
|
+
label: look.legend ?? printable(kind),
|
|
118
|
+
...vocabulary(look.legend),
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function typeRows(scene, glyphs) {
|
|
123
|
+
const { model } = scene.input;
|
|
124
|
+
const accents = agreed([...scene.nodes.values()].flatMap((vn) => vn.node.type === undefined
|
|
125
|
+
? []
|
|
126
|
+
: [[vn.node.type, accentCss(model, vn.node, scene.notation, scene.accents)]]));
|
|
127
|
+
return ordered(accents.keys(), Object.keys(TYPE_LOOKS)).map((type) => {
|
|
128
|
+
const look = typeLook(type, scene.notation);
|
|
129
|
+
// `label: ''` keeps a glyph type's box free of a subtitle; it is not a caption
|
|
130
|
+
const label = look.legend ?? (look.label === undefined || look.label === '' ? printable(type) : look.label);
|
|
131
|
+
return {
|
|
132
|
+
id: `types:${type}`,
|
|
133
|
+
swatch: shapeSwatch(type, look, glyphs),
|
|
134
|
+
style: colour(accents.get(type)),
|
|
135
|
+
label,
|
|
136
|
+
...vocabulary(look.legend),
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** A table's key columns, which the picture tags `PK` and `FK`. */
|
|
141
|
+
function markRows(scene) {
|
|
142
|
+
const seen = new Set();
|
|
143
|
+
for (const vn of scene.nodes.values()) {
|
|
144
|
+
if (typeLook(vn.node.type, scene.notation).shape !== 'table')
|
|
145
|
+
continue;
|
|
146
|
+
for (const c of vn.columns ?? vn.node.columns ?? []) {
|
|
147
|
+
if (c.pk === true)
|
|
148
|
+
seen.add('pk');
|
|
149
|
+
else if (c.fk === true)
|
|
150
|
+
seen.add('fk');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return Object.keys(MARKS)
|
|
154
|
+
.filter((m) => seen.has(m))
|
|
155
|
+
.map((m) => ({ id: `marks:${m}`, swatch: centre(MARKS[m][0]), style: {}, label: MARKS[m][1], vocabulary: true }));
|
|
156
|
+
}
|
|
157
|
+
/** The hand-written rows. One naming a kind or a type already keyed recaptions that row
|
|
158
|
+
* in place, keeping its swatch; the rest are rows of their own. */
|
|
159
|
+
function itemRows(items, derived, notation, glyphs) {
|
|
160
|
+
return items.flatMap((item, i) => {
|
|
161
|
+
const label = printable(item.label);
|
|
162
|
+
const target = item.kind !== undefined ? `kinds:${item.kind}` : item.type !== undefined ? `types:${item.type}` : '';
|
|
163
|
+
const hit = derived.find((r) => r.id === target);
|
|
164
|
+
if (hit !== undefined) {
|
|
165
|
+
hit.label = label;
|
|
166
|
+
if (item.color !== undefined)
|
|
167
|
+
hit.style = colour(item.color);
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
const swatch = item.kind !== undefined
|
|
171
|
+
? lineSwatch(kindLook({ kind: item.kind }, notation), glyphs)
|
|
172
|
+
: item.type !== undefined
|
|
173
|
+
? shapeSwatch(item.type, typeLook(item.type, notation), glyphs)
|
|
174
|
+
: item.color !== undefined
|
|
175
|
+
? centre(glyphs.mark('square'))
|
|
176
|
+
: centre('');
|
|
177
|
+
return [{ id: `items:${i}`, swatch, style: colour(item.color), label }];
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/** The legend of a scene: the one its diagram declares, or the one it is offered for
|
|
181
|
+
* what its picture cannot say; none when there is nothing to key. */
|
|
182
|
+
export function legendOf(scene, glyphs) {
|
|
183
|
+
const config = scene.input.model.legend ?? {};
|
|
184
|
+
const shown = config.show ?? DEFAULT_SECTIONS;
|
|
185
|
+
// As the browser: an explicit `show` to the letter; without one, types only where the
|
|
186
|
+
// box says nothing of its own — elsewhere a box prints its type and the key repeats it.
|
|
187
|
+
const types = shown.includes('types')
|
|
188
|
+
? typeRows(scene, glyphs)
|
|
189
|
+
: config.show === undefined
|
|
190
|
+
? typeRows(scene, glyphs).filter((r) => r.vocabulary === true)
|
|
191
|
+
: [];
|
|
192
|
+
const derived = {
|
|
193
|
+
layers: shown.includes('layers') ? layerRows(scene, glyphs) : [],
|
|
194
|
+
kinds: shown.includes('kinds') ? kindRows(scene, glyphs) : [],
|
|
195
|
+
types,
|
|
196
|
+
marks: shown.includes('marks') ? markRows(scene) : [],
|
|
197
|
+
};
|
|
198
|
+
const items = itemRows(config.items ?? [], [...derived.kinds, ...derived.types], scene.notation, glyphs);
|
|
199
|
+
const sections = ['layers', 'kinds', 'types', 'marks', 'items']
|
|
200
|
+
.map((s) => ({ title: TITLES[s], rows: s === 'items' ? items : derived[s] }))
|
|
201
|
+
.filter((s) => s.rows.length > 0);
|
|
202
|
+
const declared = scene.input.model.legend !== undefined;
|
|
203
|
+
if (sections.length === 0)
|
|
204
|
+
return undefined;
|
|
205
|
+
if (!declared && !sections.some((s) => s.rows.some((r) => r.vocabulary === true)))
|
|
206
|
+
return undefined;
|
|
207
|
+
return {
|
|
208
|
+
title: printable(config.title ?? 'Legend'),
|
|
209
|
+
position: config.position ?? 'bottom-right',
|
|
210
|
+
declared,
|
|
211
|
+
sections,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const linesOf = (legend) => legend.sections.flatMap((s) => [
|
|
215
|
+
{ text: s.title, style: DIM },
|
|
216
|
+
...s.rows.map((r) => ({ swatch: { text: r.swatch, style: r.style }, text: r.label, style: {} })),
|
|
217
|
+
]);
|
|
218
|
+
const lineWidth = (line) => (line.swatch === undefined ? 0 : SWATCH + 1) + cellWidth(line.text);
|
|
219
|
+
/** The cells the framed legend needs: its lines with a border and a cell of padding
|
|
220
|
+
* each side, and its title in the top border. */
|
|
221
|
+
export function legendSize(legend) {
|
|
222
|
+
const lines = linesOf(legend);
|
|
223
|
+
return {
|
|
224
|
+
width: Math.max(Math.max(...lines.map(lineWidth)) + 4, cellWidth(legend.title) + 6),
|
|
225
|
+
height: lines.length + 2,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** The legend framed, its title in the top border as an open container's is. In less
|
|
229
|
+
* room than it needs its labels are cut and its last line says how many are left out. */
|
|
230
|
+
export function legendCells(legend, glyphs, room = legendSize(legend)) {
|
|
231
|
+
const natural = legendSize(legend);
|
|
232
|
+
const width = Math.min(natural.width, room.width);
|
|
233
|
+
const height = Math.min(natural.height, room.height);
|
|
234
|
+
const canvas = new Canvas(width, height);
|
|
235
|
+
canvas.rect({ x: 0, y: 0, width, height }, 'light', DIM);
|
|
236
|
+
canvas.text({ x: 2, y: 0 }, ` ${legend.title} `, { bold: true }, width - 2);
|
|
237
|
+
const lines = linesOf(legend);
|
|
238
|
+
const inside = Math.max(0, height - 2);
|
|
239
|
+
const shown = lines.length <= inside
|
|
240
|
+
? lines
|
|
241
|
+
: [...lines.slice(0, inside - 1), { text: `${glyphs.ellipsis} ${lines.length - inside + 1} more`, style: DIM }];
|
|
242
|
+
const maxX = width - 2;
|
|
243
|
+
shown.forEach((line, i) => {
|
|
244
|
+
let x = 2;
|
|
245
|
+
if (line.swatch !== undefined) {
|
|
246
|
+
canvas.text({ x, y: i + 1 }, line.swatch.text, line.swatch.style, maxX);
|
|
247
|
+
x += SWATCH + 1;
|
|
248
|
+
}
|
|
249
|
+
canvas.text({ x, y: i + 1 }, fitCells(line.text, maxX - x, glyphs.ellipsis), line.style, maxX);
|
|
250
|
+
});
|
|
251
|
+
return canvas.cells(glyphs);
|
|
252
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DiagramModel, DiagramNode, NotationId } from '@diagc/core/internal';
|
|
2
|
+
import type { Accents } from './accents.js';
|
|
3
|
+
import { Canvas, type Color } from './canvas.js';
|
|
4
|
+
import { type Corner, type Glyphs, type Weight } from './glyphs.js';
|
|
5
|
+
import type { Scene } from './scene.js';
|
|
6
|
+
import { type LineStyle, type TextShape } from './vocabulary.js';
|
|
7
|
+
export interface PaintOptions {
|
|
8
|
+
glyphs: Glyphs;
|
|
9
|
+
/** the box the TUI has selected: drawn heavy, its edges bold, every other edge dim */
|
|
10
|
+
selected?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const WEIGHT: Record<LineStyle, Weight>;
|
|
13
|
+
export declare const CORNER: Partial<Record<TextShape, Corner>>;
|
|
14
|
+
export declare const rgb: (css: string | undefined) => Color | undefined;
|
|
15
|
+
/** A node's accent, as the renderer resolves it: its own colour, the one its notation
|
|
16
|
+
* gives it (a lane's, a bone's), the model's colour for its type (or for every type),
|
|
17
|
+
* then the notation's for the type. */
|
|
18
|
+
export declare function accentCss(model: DiagramModel, node: DiagramNode, notation: NotationId | undefined, accents: Accents): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The scene as a canvas, in layers: open containers' frames from the outside in,
|
|
21
|
+
* then the edges' lines, then the boxes over them (a box clears what is under it)
|
|
22
|
+
* and the frames' titles, then edge labels and the ends of the edges, last so
|
|
23
|
+
* nothing covers an arrowhead.
|
|
24
|
+
*/
|
|
25
|
+
export declare function paint(scene: Scene, options: PaintOptions): Canvas;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { parseColor } from './ansi.js';
|
|
2
|
+
import { Canvas } from './canvas.js';
|
|
3
|
+
import { DOWN, LEFT, RIGHT, UP } from './glyphs.js';
|
|
4
|
+
import { STEP, towardBox } from './layout.js';
|
|
5
|
+
import { kindLook, typeLook } from './vocabulary.js';
|
|
6
|
+
import { cellWidth } from './width.js';
|
|
7
|
+
export const WEIGHT = { solid: 'light', dashed: 'dashed', heavy: 'heavy' };
|
|
8
|
+
export const CORNER = {
|
|
9
|
+
rounded: 'round',
|
|
10
|
+
cylinder: 'round',
|
|
11
|
+
dot: 'round',
|
|
12
|
+
hexagon: 'chamfer',
|
|
13
|
+
diamond: 'chamfer',
|
|
14
|
+
};
|
|
15
|
+
const LINE_STYLE = {
|
|
16
|
+
title: { bold: true },
|
|
17
|
+
subtitle: { dim: true },
|
|
18
|
+
note: { dim: true },
|
|
19
|
+
row: {},
|
|
20
|
+
};
|
|
21
|
+
export const rgb = (css) => {
|
|
22
|
+
const parsed = css === undefined ? undefined : parseColor(css);
|
|
23
|
+
return parsed === undefined ? undefined : { rgb: parsed };
|
|
24
|
+
};
|
|
25
|
+
/** A node's accent, as the renderer resolves it: its own colour, the one its notation
|
|
26
|
+
* gives it (a lane's, a bone's), the model's colour for its type (or for every type),
|
|
27
|
+
* then the notation's for the type. */
|
|
28
|
+
export function accentCss(model, node, notation, accents) {
|
|
29
|
+
const typeColor = node.type !== undefined ? model.typeColors?.[node.type] : undefined;
|
|
30
|
+
const byNotation = accents.nodes.get(node.id);
|
|
31
|
+
return node.color ?? byNotation ?? typeColor ?? model.typeColors?.['*'] ?? typeLook(node.type, notation).accent;
|
|
32
|
+
}
|
|
33
|
+
/** How a box's border is drawn: heavy when selected (and for a fork bar), dashed
|
|
34
|
+
* for a boundary, in the node's accent. */
|
|
35
|
+
function borderInk(p, id) {
|
|
36
|
+
const box = p.scene.boxes.get(id);
|
|
37
|
+
const fg = rgb(accentCss(p.scene.input.model, p.scene.nodes.get(id).node, p.scene.notation, p.scene.accents));
|
|
38
|
+
const weight = id === p.selected || box.shape === 'bar' ? 'heavy' : box.dashed ? 'dashed' : 'light';
|
|
39
|
+
return { weight, style: fg !== undefined ? { fg } : {} };
|
|
40
|
+
}
|
|
41
|
+
/** An open container's frame. Its title is written later (`drawTitle`). */
|
|
42
|
+
function drawFrame(p, id, g) {
|
|
43
|
+
const ink = borderInk(p, id);
|
|
44
|
+
p.canvas.rect(g, ink.weight, ink.style, CORNER[p.scene.boxes.get(id).shape]);
|
|
45
|
+
}
|
|
46
|
+
/** An open container's title, in its top border. Written after the edges: a line that
|
|
47
|
+
* crosses the border there loses a cell, where the other way round the title would
|
|
48
|
+
* lose a letter. */
|
|
49
|
+
function drawTitle(p, id, g) {
|
|
50
|
+
const title = p.scene.boxes.get(id).lines[0]?.text ?? '';
|
|
51
|
+
const style = { bold: true, inverse: id === p.selected };
|
|
52
|
+
if (title !== '')
|
|
53
|
+
p.canvas.text({ x: g.x + 2, y: g.y }, ` ${title} `, style, g.x + g.width - 2);
|
|
54
|
+
}
|
|
55
|
+
/** A leaf or folded box: border, shape details, and its lines (centred, but a table's
|
|
56
|
+
* rows left-aligned so their columns line up). `weight` overrides the border's. */
|
|
57
|
+
function drawBox(p, id, g, weight) {
|
|
58
|
+
const box = p.scene.boxes.get(id);
|
|
59
|
+
const ink = { ...borderInk(p, id), ...(weight !== undefined ? { weight } : {}) };
|
|
60
|
+
const rule = (y) => p.canvas.segment({ x: g.x, y }, { x: g.x + g.width - 1, y }, ink.weight, ink.style);
|
|
61
|
+
p.canvas.clear({ x: g.x + 1, y: g.y + 1, width: g.width - 2, height: g.height - 2 });
|
|
62
|
+
p.canvas.rect(g, ink.weight, ink.style, CORNER[box.shape]);
|
|
63
|
+
let y = g.y + 1;
|
|
64
|
+
if (box.shape === 'cylinder')
|
|
65
|
+
rule(y++);
|
|
66
|
+
let ruled = false;
|
|
67
|
+
for (const line of box.lines) {
|
|
68
|
+
if (line.role === 'row' && !ruled) {
|
|
69
|
+
rule(y++);
|
|
70
|
+
ruled = true;
|
|
71
|
+
}
|
|
72
|
+
const x = line.role === 'row' ? g.x + 2 : g.x + Math.floor((g.width - cellWidth(line.text)) / 2);
|
|
73
|
+
const style = line.role === 'title' && id === p.selected ? { bold: true, inverse: true } : LINE_STYLE[line.role];
|
|
74
|
+
p.canvas.text({ x, y: y++ }, line.text, style, g.x + g.width - 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function edgeInk(p, edge) {
|
|
78
|
+
const weight = WEIGHT[kindLook(edge, p.scene.notation).line];
|
|
79
|
+
const fg = rgb(edge.style?.color ?? edge.tint ?? p.scene.accents.edges.get(edge.id));
|
|
80
|
+
const base = fg !== undefined ? { fg } : {};
|
|
81
|
+
if (p.selected === undefined)
|
|
82
|
+
return { weight, style: base };
|
|
83
|
+
const mine = edge.from === p.selected || edge.to === p.selected;
|
|
84
|
+
return { weight, style: { ...base, ...(mine ? { bold: true } : { dim: true }) } };
|
|
85
|
+
}
|
|
86
|
+
const OPPOSITE = { [UP]: DOWN, [DOWN]: UP, [LEFT]: RIGHT, [RIGHT]: LEFT };
|
|
87
|
+
const ARROW = { [UP]: 'up', [DOWN]: 'down', [LEFT]: 'left', [RIGHT]: 'right' };
|
|
88
|
+
/** Runs the line from an end into the border beside it, so the border shows a
|
|
89
|
+
* junction (`┬`, `├`, …) where the line leaves or meets the box. */
|
|
90
|
+
function join(p, end, g, ink) {
|
|
91
|
+
const dir = g === undefined ? undefined : towardBox(end, g);
|
|
92
|
+
if (dir === undefined)
|
|
93
|
+
return;
|
|
94
|
+
p.canvas.stroke(end, dir, ink.weight, ink.style);
|
|
95
|
+
const step = STEP[dir];
|
|
96
|
+
p.canvas.stroke({ x: end.x + step.x, y: end.y + step.y }, OPPOSITE[dir], 'light');
|
|
97
|
+
}
|
|
98
|
+
/** Which way a mark at an end points: at the box beside it. Not along the last
|
|
99
|
+
* segment, which can run alongside the box — elk's last stub into a box is often under
|
|
100
|
+
* a cell, and gone once the end is moved off the border. */
|
|
101
|
+
function arrowOf(end, prev, box) {
|
|
102
|
+
const toward = box === undefined ? undefined : towardBox(end, box);
|
|
103
|
+
if (toward !== undefined)
|
|
104
|
+
return ARROW[toward];
|
|
105
|
+
if (end.y !== prev.y)
|
|
106
|
+
return end.y > prev.y ? 'down' : 'up';
|
|
107
|
+
return end.x > prev.x ? 'right' : 'left';
|
|
108
|
+
}
|
|
109
|
+
/** One end of an edge: its mark, or with none the line run into the border. */
|
|
110
|
+
function drawEnd(p, edge, end) {
|
|
111
|
+
const points = p.scene.layout.routes.get(edge.id).points;
|
|
112
|
+
if (points.length < 2)
|
|
113
|
+
return;
|
|
114
|
+
const look = kindLook(edge, p.scene.notation);
|
|
115
|
+
const [at, prev] = end === 'start' ? [points[0], points[1]] : [points.at(-1), points.at(-2)];
|
|
116
|
+
const box = p.scene.layout.boxes.get(end === 'start' ? edge.from : edge.to);
|
|
117
|
+
const mark = end === 'start' ? (look.start ?? 'none') : look.end;
|
|
118
|
+
const ink = edgeInk(p, edge);
|
|
119
|
+
if (mark === 'none')
|
|
120
|
+
join(p, at, box, ink);
|
|
121
|
+
else if (mark === 'arrow')
|
|
122
|
+
p.canvas.put(at, p.glyphs.arrow(arrowOf(at, prev, box)), ink.style);
|
|
123
|
+
else
|
|
124
|
+
p.canvas.put(at, p.glyphs.mark(mark), ink.style);
|
|
125
|
+
}
|
|
126
|
+
const isFrame = (scene, id) => {
|
|
127
|
+
const vn = scene.nodes.get(id);
|
|
128
|
+
return vn.state === 'expanded' && vn.children.length > 0;
|
|
129
|
+
};
|
|
130
|
+
/** A route of a fish: its straight runs as lines, its slants one character a cell, up
|
|
131
|
+
* to the cell it ends on, which is the line it meets. */
|
|
132
|
+
function drawFishRoute(p, points, ink) {
|
|
133
|
+
for (let i = 1; i < points.length; i++) {
|
|
134
|
+
const [a, b] = [points[i - 1], points[i]];
|
|
135
|
+
if (a.x === b.x || a.y === b.y) {
|
|
136
|
+
p.canvas.segment(a, b, ink.weight, ink.style);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const [dx, dy] = [Math.sign(b.x - a.x), Math.sign(b.y - a.y)];
|
|
140
|
+
const slant = p.glyphs.slant(dx === dy);
|
|
141
|
+
for (let x = a.x, y = a.y; x !== b.x; x += dx, y += dy)
|
|
142
|
+
p.canvas.put({ x, y }, slant, ink.style);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A fishbone as the fish (fish.ts): the lines first, then the head's box, heavy, and
|
|
147
|
+
* the spine run into its border, then the words, a bone's label bold in the bone's
|
|
148
|
+
* colour, and last the boxes of what is not on the fish. A word is selected as a title
|
|
149
|
+
* is, in reverse.
|
|
150
|
+
*/
|
|
151
|
+
function paintFish(p, fish, edges) {
|
|
152
|
+
const { layout } = p.scene;
|
|
153
|
+
for (const edge of edges)
|
|
154
|
+
drawFishRoute(p, layout.routes.get(edge.id).points, edgeInk(p, edge));
|
|
155
|
+
drawBox(p, fish.head, layout.boxes.get(fish.head), 'heavy');
|
|
156
|
+
const { y, from, to } = fish.spine;
|
|
157
|
+
p.canvas.segment({ x: from, y }, { x: to, y }, 'heavy', borderInk(p, fish.head).style);
|
|
158
|
+
for (const [id, lines] of fish.words) {
|
|
159
|
+
const label = fish.labels.has(id);
|
|
160
|
+
const style = {
|
|
161
|
+
...(label ? { ...borderInk(p, id).style, bold: true } : {}),
|
|
162
|
+
...(id === p.selected ? { bold: true, inverse: true } : {}),
|
|
163
|
+
};
|
|
164
|
+
for (const line of lines)
|
|
165
|
+
p.canvas.text(line, line.text, style);
|
|
166
|
+
}
|
|
167
|
+
for (const [id, g] of layout.boxes)
|
|
168
|
+
if (id !== fish.head && !fish.words.has(id))
|
|
169
|
+
drawBox(p, id, g);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The scene as a canvas, in layers: open containers' frames from the outside in,
|
|
173
|
+
* then the edges' lines, then the boxes over them (a box clears what is under it)
|
|
174
|
+
* and the frames' titles, then edge labels and the ends of the edges, last so
|
|
175
|
+
* nothing covers an arrowhead.
|
|
176
|
+
*/
|
|
177
|
+
export function paint(scene, options) {
|
|
178
|
+
const { layout } = scene;
|
|
179
|
+
const p = { canvas: new Canvas(layout.width, layout.height), scene, ...options };
|
|
180
|
+
const drawn = [...scene.nodes.keys()].flatMap((id) => {
|
|
181
|
+
const g = layout.boxes.get(id);
|
|
182
|
+
return g === undefined ? [] : [{ id, g, frame: isFrame(scene, id) }];
|
|
183
|
+
});
|
|
184
|
+
const edges = scene.view.edges.filter((e) => layout.routes.has(e.id));
|
|
185
|
+
if (layout.fish !== undefined) {
|
|
186
|
+
paintFish(p, layout.fish, edges);
|
|
187
|
+
return p.canvas;
|
|
188
|
+
}
|
|
189
|
+
for (const { id, g, frame } of drawn)
|
|
190
|
+
if (frame)
|
|
191
|
+
drawFrame(p, id, g);
|
|
192
|
+
for (const edge of edges) {
|
|
193
|
+
const { points } = layout.routes.get(edge.id);
|
|
194
|
+
const ink = edgeInk(p, edge);
|
|
195
|
+
for (let i = 1; i < points.length; i++)
|
|
196
|
+
p.canvas.segment(points[i - 1], points[i], ink.weight, ink.style);
|
|
197
|
+
}
|
|
198
|
+
for (const { id, g, frame } of drawn)
|
|
199
|
+
(frame ? drawTitle : drawBox)(p, id, g);
|
|
200
|
+
for (const edge of edges) {
|
|
201
|
+
const label = layout.routes.get(edge.id).label;
|
|
202
|
+
if (label !== undefined)
|
|
203
|
+
p.canvas.text(label, label.text, edgeInk(p, edge).style);
|
|
204
|
+
drawEnd(p, edge, 'start');
|
|
205
|
+
drawEnd(p, edge, 'end');
|
|
206
|
+
}
|
|
207
|
+
return p.canvas;
|
|
208
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ColorMode } from './ansi.js';
|
|
2
|
+
import { type SceneInput } from './scene.js';
|
|
3
|
+
export interface TextOptions {
|
|
4
|
+
/** plain ASCII in place of box-drawing characters */
|
|
5
|
+
ascii: boolean;
|
|
6
|
+
color: ColorMode;
|
|
7
|
+
}
|
|
8
|
+
/** A diagram's view as lines of text, with the legend it declares; none when the view
|
|
9
|
+
* has nothing in it. A legend only offered (for shapes that say nothing of themselves)
|
|
10
|
+
* is left out, as the published picture leaves it out. */
|
|
11
|
+
export declare function renderToLines(input: SceneInput, options: TextOptions): Promise<string[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { serialize } from './ansi.js';
|
|
2
|
+
import { ASCII, UNICODE } from './glyphs.js';
|
|
3
|
+
import { legendCells } from './legend.js';
|
|
4
|
+
import { paint } from './paint.js';
|
|
5
|
+
import { buildScene } from './scene.js';
|
|
6
|
+
/** The picture with its legend beside it, as the corner it names would have it: over
|
|
7
|
+
* or under the picture with a blank row between, against its left or right edge. Not
|
|
8
|
+
* over the picture, as on a canvas, where a printed picture would lose what it covers.
|
|
9
|
+
* A legend wider than the picture starts at the left edge either way: set against the
|
|
10
|
+
* right one, it would push the picture along for the sake of its key. */
|
|
11
|
+
function withLegend(picture, legend, position) {
|
|
12
|
+
const indent = position.endsWith('right') ? Math.max(0, (picture[0]?.length ?? 0) - (legend[0]?.length ?? 0)) : 0;
|
|
13
|
+
const placed = legend.map((row) => [...Array.from({ length: indent }, () => ({ ch: ' ', style: {} })), ...row]);
|
|
14
|
+
return position.startsWith('top') ? [...placed, [], ...picture] : [...picture, [], ...placed];
|
|
15
|
+
}
|
|
16
|
+
/** A diagram's view as lines of text, with the legend it declares; none when the view
|
|
17
|
+
* has nothing in it. A legend only offered (for shapes that say nothing of themselves)
|
|
18
|
+
* is left out, as the published picture leaves it out. */
|
|
19
|
+
export async function renderToLines(input, options) {
|
|
20
|
+
const glyphs = options.ascii ? ASCII : UNICODE;
|
|
21
|
+
const scene = await buildScene(input, glyphs);
|
|
22
|
+
if (scene.layout.boxes.size === 0)
|
|
23
|
+
return [];
|
|
24
|
+
const picture = paint(scene, { glyphs }).cells(glyphs);
|
|
25
|
+
const legend = scene.legend?.declared === true ? scene.legend : undefined;
|
|
26
|
+
const cells = legend === undefined ? picture : withLegend(picture, legendCells(legend, glyphs), legend.position);
|
|
27
|
+
return serialize(cells, options.color);
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type CompiledView, type DiagramModel, type HierarchyIndex, type LayoutOverlay, type NotationId, type ViewNode } from '@diagc/core/internal';
|
|
2
|
+
import { type Accents } from './accents.js';
|
|
3
|
+
import { type BoxText } from './content.js';
|
|
4
|
+
import { type Pins } from './folds.js';
|
|
5
|
+
import type { Glyphs } from './glyphs.js';
|
|
6
|
+
import { type TextLayout } from './layout.js';
|
|
7
|
+
import { type TextLegend } from './legend.js';
|
|
8
|
+
/** What a text picture is a picture of. */
|
|
9
|
+
export interface SceneInput {
|
|
10
|
+
model: DiagramModel;
|
|
11
|
+
overlay?: LayoutOverlay;
|
|
12
|
+
/** absent = the model's first plane */
|
|
13
|
+
plane?: string;
|
|
14
|
+
/** the layers drawn; absent = the plane's presets (compileView's own rule) */
|
|
15
|
+
layers?: string[];
|
|
16
|
+
pins: Pins;
|
|
17
|
+
/** draw this container's interior only (the drill view) */
|
|
18
|
+
root?: string;
|
|
19
|
+
}
|
|
20
|
+
/** A laid-out view: everything painting and the TUI's navigation read. */
|
|
21
|
+
export interface Scene {
|
|
22
|
+
input: SceneInput;
|
|
23
|
+
/** the compiled view, its `edges` cut to the ones the notation draws */
|
|
24
|
+
view: CompiledView;
|
|
25
|
+
layout: TextLayout;
|
|
26
|
+
boxes: Map<string, BoxText>;
|
|
27
|
+
/** every drawn node by id, in drawing order (parents before children) */
|
|
28
|
+
nodes: Map<string, ViewNode>;
|
|
29
|
+
/** the box each drawn node is drawn inside; undefined at the top level */
|
|
30
|
+
parentOf: Map<string, string | undefined>;
|
|
31
|
+
/** the plane's containment, over the nodes the active layers show */
|
|
32
|
+
hierarchy: HierarchyIndex;
|
|
33
|
+
notation?: NotationId;
|
|
34
|
+
/** the colours the notation gives boxes and lines that set none */
|
|
35
|
+
accents: Accents;
|
|
36
|
+
/** the key to what is drawn: declared by the diagram, or offered for what its
|
|
37
|
+
* shapes cannot say; absent when there is nothing to key */
|
|
38
|
+
legend?: TextLegend;
|
|
39
|
+
}
|
|
40
|
+
export declare function buildScene(input: SceneInput, glyphs: Glyphs): Promise<Scene>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { activeNotation, buildHierarchy, compileView, defined, defaultLayoutDirection, FISHBONE_NOTATION, layoutPlaneKey, presetLayers, } from '@diagc/core/internal';
|
|
2
|
+
import { notationAccents } from './accents.js';
|
|
3
|
+
import { boxText, edgeText } from './content.js';
|
|
4
|
+
import { fishCells } from './fish.js';
|
|
5
|
+
import { withNeverFolds } from './folds.js';
|
|
6
|
+
import { layoutCells } from './layout.js';
|
|
7
|
+
import { legendOf } from './legend.js';
|
|
8
|
+
import { hidesKind } from './vocabulary.js';
|
|
9
|
+
const DIRECTIONS = new Set(['DOWN', 'UP', 'LEFT', 'RIGHT']);
|
|
10
|
+
/** The way the plane flows: its saved layout setting, else the model's default. */
|
|
11
|
+
function directionOf(input) {
|
|
12
|
+
const saved = input.overlay?.settings?.[layoutPlaneKey(input.model, input.plane)]?.direction;
|
|
13
|
+
return saved !== undefined && DIRECTIONS.has(saved) ? saved : defaultLayoutDirection(input.model);
|
|
14
|
+
}
|
|
15
|
+
export async function buildScene(input, glyphs) {
|
|
16
|
+
const { model, plane } = input;
|
|
17
|
+
const notation = activeNotation(model.planes, plane, model.notation);
|
|
18
|
+
const compiled = compileView(model, {
|
|
19
|
+
pins: withNeverFolds(model, input.pins, notation),
|
|
20
|
+
...(plane !== undefined ? { plane } : {}),
|
|
21
|
+
...(input.layers !== undefined ? { activeLayers: input.layers } : {}),
|
|
22
|
+
...(input.root !== undefined ? { root: input.root } : {}),
|
|
23
|
+
});
|
|
24
|
+
// Only the drawn set loses a notation's hidden kinds: layoutEdges keep them, the
|
|
25
|
+
// rule that keeps a layer toggle from moving a box (the renderer does the same).
|
|
26
|
+
const view = { ...compiled, edges: compiled.edges.filter((e) => !hidesKind(e.kind, notation)) };
|
|
27
|
+
const hierarchy = buildHierarchy(model, plane, new Set(input.layers ?? presetLayers(model.planes, plane)));
|
|
28
|
+
const nodes = new Map();
|
|
29
|
+
const parentOf = new Map();
|
|
30
|
+
const boxes = new Map();
|
|
31
|
+
const walk = (vn, parent) => {
|
|
32
|
+
nodes.set(vn.id, vn);
|
|
33
|
+
parentOf.set(vn.id, parent);
|
|
34
|
+
const inside = hierarchy.childrenOf.get(vn.id)?.length ?? 0;
|
|
35
|
+
boxes.set(vn.id, boxText(vn, { inside, glyphs, ...(notation !== undefined ? { notation } : {}) }));
|
|
36
|
+
for (const child of vn.children)
|
|
37
|
+
walk(child, vn.id);
|
|
38
|
+
};
|
|
39
|
+
for (const root of view.roots)
|
|
40
|
+
walk(root, undefined);
|
|
41
|
+
const labels = new Map(view.layoutEdges.map((e) => [e.id, edgeText(e, glyphs)]));
|
|
42
|
+
// A fishbone is the fish, as on the page, whatever way the plane's settings say to flow.
|
|
43
|
+
const layout = notation === FISHBONE_NOTATION
|
|
44
|
+
? fishCells(model, view, boxes)
|
|
45
|
+
: await layoutCells(view, boxes, directionOf(input), labels);
|
|
46
|
+
const accents = notationAccents(model, plane, notation, view.edges);
|
|
47
|
+
const scene = { input, view, layout, boxes, nodes, parentOf, hierarchy, accents, ...defined({ notation }) };
|
|
48
|
+
const legend = legendOf(scene, glyphs);
|
|
49
|
+
return legend === undefined ? scene : { ...scene, legend };
|
|
50
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type DiagramNode, type NotationId, type ViewEdge } from '@diagc/core/internal';
|
|
2
|
+
/** The shapes a terminal can tell apart. */
|
|
3
|
+
export type TextShape = 'box' | 'rounded' | 'cylinder' | 'hexagon' | 'diamond' | 'dot' | 'bar' | 'note' | 'table';
|
|
4
|
+
export interface TypeLook {
|
|
5
|
+
shape: TextShape;
|
|
6
|
+
/** the subtitle in place of the raw type id; `''` prints none (the renderer's `label`) */
|
|
7
|
+
label?: string;
|
|
8
|
+
dashed?: boolean;
|
|
9
|
+
/** a container of this type is always drawn open (the renderer's `alwaysExpanded`) */
|
|
10
|
+
neverFolds?: boolean;
|
|
11
|
+
/** the border colour a notation gives the type (C4's blues) */
|
|
12
|
+
accent?: string;
|
|
13
|
+
/** what a legend calls the type (the renderer's `legendLabel`): set only on a shape
|
|
14
|
+
* that says nothing about itself, which a legend keys without being asked */
|
|
15
|
+
legend?: string;
|
|
16
|
+
}
|
|
17
|
+
export type LineStyle = 'solid' | 'dashed' | 'heavy';
|
|
18
|
+
export type EndMark = 'arrow' | 'none' | 'dot' | 'square' | 'diamond' | 'many' | 'one';
|
|
19
|
+
export interface KindLook {
|
|
20
|
+
line: LineStyle;
|
|
21
|
+
end: EndMark;
|
|
22
|
+
start?: EndMark;
|
|
23
|
+
/** what a legend calls the kind, as `TypeLook.legend` */
|
|
24
|
+
legend?: string;
|
|
25
|
+
}
|
|
26
|
+
/** One entry per type the renderer styles, in its order. */
|
|
27
|
+
export declare const TYPE_LOOKS: Readonly<Record<string, TypeLook>>;
|
|
28
|
+
/** One entry per kind the renderer styles, in its order. */
|
|
29
|
+
export declare const KIND_LOOKS: Readonly<Record<string, KindLook>>;
|
|
30
|
+
export declare function typeLook(type: string | undefined, notation: NotationId | undefined): TypeLook;
|
|
31
|
+
export declare function kindLook(edge: Pick<ViewEdge, 'kind' | 'style'>, notation: NotationId | undefined): KindLook;
|
|
32
|
+
/** Kinds a notation never draws as lines: a plan's roles become chips on the zone. */
|
|
33
|
+
export declare function hidesKind(kind: string, notation: NotationId | undefined): boolean;
|
|
34
|
+
/** The subtitle a box prints under its name, as the renderer prints it: the type's
|
|
35
|
+
* label, or the raw type id for a type without one; `''` for none. */
|
|
36
|
+
export declare function subtitleOf(node: DiagramNode, notation: NotationId | undefined): string;
|
|
37
|
+
export declare function neverFolds(node: DiagramNode, notation: NotationId | undefined): boolean;
|