@draftably/markdown 0.1.0 → 0.2.1
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 +34 -65
- package/dist/chunks/{core-DPjuIyPG.js → core-D4HpamVq.js} +19 -13
- package/dist/chunks/mermaid-facade-BoLWBerE.js +289 -0
- package/dist/chunks/mermaid-importer-D9i_Vfxl.js +4066 -0
- package/dist/markdown-it.js +86 -85
- package/dist/mermaid.js +93 -0
- package/dist/remark.js +46 -46
- package/dist/types/{core.d.ts → packages/markdown/src/core.d.ts} +11 -0
- package/dist/types/packages/markdown/src/mermaid.d.ts +8 -0
- package/dist/types/{remark.d.ts → packages/markdown/src/remark.d.ts} +1 -1
- package/dist/types/src/dsl/cells.d.ts +91 -0
- package/dist/types/src/dsl/channels.d.ts +53 -0
- package/dist/types/src/dsl/compile.d.ts +175 -0
- package/dist/types/src/dsl/corridors.d.ts +38 -0
- package/dist/types/src/dsl/frame.d.ts +38 -0
- package/dist/types/src/dsl/lanes.d.ts +23 -0
- package/dist/types/src/dsl/legend-notes.d.ts +3 -0
- package/dist/types/src/dsl/project.d.ts +39 -0
- package/dist/types/src/dsl/syntax.d.ts +317 -0
- package/dist/types/src/import/import-core.d.ts +105 -0
- package/dist/types/src/import/mermaid-facade.d.ts +120 -0
- package/dist/types/src/import/mermaid-importer.d.ts +4 -0
- package/dist/types/src/import/mermaid-sequence.d.ts +8 -0
- package/dist/types/src/model/appearance.d.ts +209 -0
- package/dist/types/src/model/bounds.d.ts +19 -0
- package/dist/types/src/model/document.d.ts +24 -0
- package/dist/types/src/model/font-faces.d.ts +24 -0
- package/dist/types/src/model/fonts.d.ts +47 -0
- package/dist/types/src/model/footnote.d.ts +34 -0
- package/dist/types/src/model/geometry.d.ts +29 -0
- package/dist/types/src/model/graph.d.ts +53 -0
- package/dist/types/src/model/heading.d.ts +38 -0
- package/dist/types/src/model/icons.d.ts +2 -0
- package/dist/types/src/model/labels.d.ts +88 -0
- package/dist/types/src/model/link.d.ts +63 -0
- package/dist/types/src/model/markers.d.ts +47 -0
- package/dist/types/src/model/note.d.ts +75 -0
- package/dist/types/src/model/rich-text.d.ts +24 -0
- package/dist/types/src/model/routes.d.ts +170 -0
- package/dist/types/src/model/status.d.ts +84 -0
- package/dist/types/src/model/styles.d.ts +13 -0
- package/dist/types/src/model/types.d.ts +286 -0
- package/package.json +9 -7
- /package/dist/types/{client-validation.d.ts → packages/markdown/src/client-validation.d.ts} +0 -0
- /package/dist/types/{client.d.ts → packages/markdown/src/client.d.ts} +0 -0
- /package/dist/types/{files.d.ts → packages/markdown/src/files.d.ts} +0 -0
- /package/dist/types/{index.d.ts → packages/markdown/src/index.d.ts} +0 -0
- /package/dist/types/{markdown-it-helpers.d.ts → packages/markdown/src/markdown-it-helpers.d.ts} +0 -0
- /package/dist/types/{markdown-it.d.ts → packages/markdown/src/markdown-it.d.ts} +0 -0
- /package/dist/types/{metadata.d.ts → packages/markdown/src/metadata.d.ts} +0 -0
- /package/dist/types/{source.d.ts → packages/markdown/src/source.d.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing channels inside groups.
|
|
3
|
+
*
|
|
4
|
+
* A group leaves `GROUP_INSET` between its members and its border. That is padding, not room for
|
|
5
|
+
* a line: a line routed through it runs beside a member and along the border at once. When a
|
|
6
|
+
* connection has to travel inside a group (a member boxed in by its neighbours, or a link between
|
|
7
|
+
* two of the group's children that can't go straight across), the group grows a channel on one
|
|
8
|
+
* side, wide enough for each such line to run a full standoff from the members,
|
|
9
|
+
* the border and each other. A link between children takes the side of them both ends lean
|
|
10
|
+
* toward, and a return (up or left) takes the left or top when they lean neither way, so a
|
|
11
|
+
* forward line and its return don't cross. The compiler lays the scene out once, plans channels
|
|
12
|
+
* from that geometry, and lays it out again with them.
|
|
13
|
+
*/
|
|
14
|
+
import type { ModelEdge } from './syntax';
|
|
15
|
+
/**
|
|
16
|
+
* Room a group leaves round its content: the inset on the left, right and bottom (at least
|
|
17
|
+
* `GROUP_INSET`), and extra room under the title band on top (0 without a channel there).
|
|
18
|
+
*/
|
|
19
|
+
export interface Channel {
|
|
20
|
+
left: number;
|
|
21
|
+
right: number;
|
|
22
|
+
top: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
/** How many lines each side's channel was planned for. */
|
|
25
|
+
lines: Record<Side, number>;
|
|
26
|
+
}
|
|
27
|
+
/** Channels may grow the drawing's area by this much at most. */
|
|
28
|
+
export declare const CHANNEL_BUDGET = 1.1;
|
|
29
|
+
/**
|
|
30
|
+
* Drop the channels that carry fewest lines until the drawing laid out with the rest (`measure`)
|
|
31
|
+
* is within `CHANNEL_BUDGET` of its area without any (`plain`).
|
|
32
|
+
*/
|
|
33
|
+
export declare function trimChannels(plan: Map<string, Channel>, plain: number, measure: (channels: Map<string, Channel>) => number): Map<string, Channel>;
|
|
34
|
+
interface Box {
|
|
35
|
+
id: string;
|
|
36
|
+
type: string;
|
|
37
|
+
parent: string;
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
w: number;
|
|
41
|
+
h: number;
|
|
42
|
+
}
|
|
43
|
+
export type Side = 'left' | 'right' | 'top' | 'bottom';
|
|
44
|
+
/**
|
|
45
|
+
* Channels for the scene laid out as `objects`. A group is keyed by id; groups with no traffic
|
|
46
|
+
* are left out.
|
|
47
|
+
*/
|
|
48
|
+
export declare function planChannels(objects: Box[], edges: ModelEdge[], routing?: {
|
|
49
|
+
edgeGap?: number;
|
|
50
|
+
portGap?: number;
|
|
51
|
+
standoff?: number;
|
|
52
|
+
}): Map<string, Channel>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { type ResolvedAppearance } from '../model/appearance';
|
|
2
|
+
import type { CellsChrome, Lane, SequenceLayout } from '../model/types';
|
|
3
|
+
import { type Planned } from './corridors';
|
|
4
|
+
import { GROUP_HEADER, GROUP_INSET, contentOrigin } from './frame';
|
|
5
|
+
import { type Model, type ModelEdge, type ModelLayout, type ModelObject } from './syntax';
|
|
6
|
+
/** The single render context. Browser window size changes the camera, never the layout. */
|
|
7
|
+
export declare const RENDER_CONTEXT: {
|
|
8
|
+
readonly width: 1100;
|
|
9
|
+
readonly height: 720;
|
|
10
|
+
};
|
|
11
|
+
export { GROUP_HEADER, GROUP_INSET, contentOrigin };
|
|
12
|
+
export interface SceneObject extends ModelObject {
|
|
13
|
+
/** World (diagram) coordinates. */
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
w: number;
|
|
17
|
+
h: number;
|
|
18
|
+
/** Position relative to the parent's content origin; `pin` and `stay` use these. */
|
|
19
|
+
localX: number;
|
|
20
|
+
localY: number;
|
|
21
|
+
/** Local position from the automatic recipe alone, before refinements; `nudge` offsets this. */
|
|
22
|
+
baseX: number;
|
|
23
|
+
baseY: number;
|
|
24
|
+
depth: number;
|
|
25
|
+
/** Sequence participants: how far the dashed lifeline runs below the box. */
|
|
26
|
+
lifeline?: number;
|
|
27
|
+
/** Soft groups: the tint's rectangles, relative to the group's top left; the first holds the label. */
|
|
28
|
+
hull?: Array<{
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
w: number;
|
|
32
|
+
h: number;
|
|
33
|
+
}>;
|
|
34
|
+
/** Groups: lines the title wraps to, when more than one. */
|
|
35
|
+
titleLines?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface Diagnostic {
|
|
38
|
+
level: 'error' | 'warning' | 'info';
|
|
39
|
+
code: string;
|
|
40
|
+
message: string;
|
|
41
|
+
/** Source line of the rule involved, when there is one. */
|
|
42
|
+
line?: number;
|
|
43
|
+
ids: string[];
|
|
44
|
+
}
|
|
45
|
+
/** A connection as the file declares it, plus the lane a fold's wrap edge returns along. */
|
|
46
|
+
export interface SceneEdge extends ModelEdge {
|
|
47
|
+
lane?: Lane;
|
|
48
|
+
/** A forward line's route, planned from its scope's ranks and corridors (`planRoutes`). */
|
|
49
|
+
plan?: Planned;
|
|
50
|
+
/** A sequence message: the height of its row; it is drawn straight between lifelines there. */
|
|
51
|
+
row?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface Scene {
|
|
54
|
+
model: Model;
|
|
55
|
+
title: string;
|
|
56
|
+
objects: SceneObject[];
|
|
57
|
+
byId: Map<string, SceneObject>;
|
|
58
|
+
edges: SceneEdge[];
|
|
59
|
+
diagnostics: Diagnostic[];
|
|
60
|
+
/** The file's resolved appearance: the spacing and type every size above was computed with. */
|
|
61
|
+
look: ResolvedAppearance;
|
|
62
|
+
/** Rulers and run-on pieces of byte and bit layouts, by group. */
|
|
63
|
+
cells: Map<string, CellsChrome>;
|
|
64
|
+
/** Sequence diagrams: the panel they are drawn on and their phases' row bands. */
|
|
65
|
+
sequence?: SequenceLayout;
|
|
66
|
+
}
|
|
67
|
+
type Size = {
|
|
68
|
+
w: number;
|
|
69
|
+
h: number;
|
|
70
|
+
};
|
|
71
|
+
type Pos = {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
};
|
|
75
|
+
export declare function compile(source: string): Promise<Scene>;
|
|
76
|
+
/**
|
|
77
|
+
* Check source synchronously: every error `compile` can report, without running layout engines
|
|
78
|
+
* (they never add errors). Engine-governed scopes keep their built-in recipe in the result.
|
|
79
|
+
*/
|
|
80
|
+
export declare function checkSource(source: string): Scene;
|
|
81
|
+
/**
|
|
82
|
+
* The scene as layout sees it, for edits that write positions: soft and frameless groups left
|
|
83
|
+
* out, and each object under the container that lays it out, which its local position is
|
|
84
|
+
* relative to.
|
|
85
|
+
*/
|
|
86
|
+
export declare function layoutView(scene: Scene): Scene;
|
|
87
|
+
/** How far a soft refinement may give way before `check` warns that it no longer holds. */
|
|
88
|
+
export declare const RELAXED_WARNING = 16;
|
|
89
|
+
/** Solver budget for engine recipes; the same budget Compare and the timeline use. */
|
|
90
|
+
export declare const ENGINE_ITERATIONS = 640;
|
|
91
|
+
/** A labelled edge between two siblings, with the room its label needs across and down a gap. */
|
|
92
|
+
interface LabelRoom {
|
|
93
|
+
a: string;
|
|
94
|
+
b: string;
|
|
95
|
+
w: number;
|
|
96
|
+
h: number;
|
|
97
|
+
}
|
|
98
|
+
export declare function layoutFor(m: Model, scope: string): ModelLayout;
|
|
99
|
+
/**
|
|
100
|
+
* Size of a node: its requested size, or the default width with a height that fits the title in
|
|
101
|
+
* the theme's type and padding. A requested size is kept exactly; `overflow` reports a title that
|
|
102
|
+
* no longer fits in it.
|
|
103
|
+
*/
|
|
104
|
+
export declare function leafSize(o: ModelObject, size: {
|
|
105
|
+
width: number;
|
|
106
|
+
height?: number;
|
|
107
|
+
} | undefined, look: ResolvedAppearance): {
|
|
108
|
+
w: number;
|
|
109
|
+
h: number;
|
|
110
|
+
overflow: boolean;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Longest-path ranks, in declaration order. Cycles are broken first: a depth-first walk from the
|
|
114
|
+
* sources (then any node not yet reached), in declaration order, sets aside each edge that returns
|
|
115
|
+
* to a node still on the walk. A loop therefore keeps its path along the reading direction and
|
|
116
|
+
* only its return edge runs backwards.
|
|
117
|
+
*/
|
|
118
|
+
export declare function rankLayers(ids: string[], pairs: Array<[string, string]>): string[][];
|
|
119
|
+
/** A folded run: each band's ids in reading order, and the axis the bands read along. */
|
|
120
|
+
export interface Fold {
|
|
121
|
+
bands: string[][];
|
|
122
|
+
axis: 'right' | 'down';
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Fold a long run of ranks into bands, like lines of text: each band starts again at the
|
|
126
|
+
* beginning of the reading direction, and the bands stack across it. A run that is longer than
|
|
127
|
+
* the render context and more than `FOLD_ASPECT` times its depth is cut only between ranks (where
|
|
128
|
+
* no box spans the cut), into the fewest bands that bring it within both. Within a quarter of an
|
|
129
|
+
* even share, a cut is chosen for the fewest edges across it, keeping each decision with its
|
|
130
|
+
* branches and each loop whole, before an exact balance. Other runs are returned unchanged.
|
|
131
|
+
*
|
|
132
|
+
* `plan` is the same run laid out without its edge labels. Whether to fold, how many bands and
|
|
133
|
+
* where to cut are decided on it, so relabelling an edge never adds a band or moves a cut: the
|
|
134
|
+
* labels only widen the gaps they need inside their own band.
|
|
135
|
+
*/
|
|
136
|
+
export declare function foldRanks(items: Array<{
|
|
137
|
+
id: string;
|
|
138
|
+
w: number;
|
|
139
|
+
h: number;
|
|
140
|
+
}>, positions: Map<string, Pos>, axis: 'right' | 'down', gap: number, pairs: Array<[string, string]>, rooms?: LabelRoom[], decisions?: Set<string>, plan?: Map<string, Pos>, { aspect, fewest, room, }?: {
|
|
141
|
+
aspect?: number;
|
|
142
|
+
fewest?: number;
|
|
143
|
+
room?: number;
|
|
144
|
+
}): {
|
|
145
|
+
positions: Map<string, Pos>;
|
|
146
|
+
fold?: Fold;
|
|
147
|
+
};
|
|
148
|
+
/** How many times orthogonal paths, given as points along and across, cross one another. */
|
|
149
|
+
export declare function crossings(paths: Array<Array<{
|
|
150
|
+
u: number;
|
|
151
|
+
v: number;
|
|
152
|
+
}>>): number;
|
|
153
|
+
/** The order of up to six items that scores fewest crossings; the first such, from `items`. */
|
|
154
|
+
export declare function fewestCrossings<T>(items: T[], score: (order: T[]) => number): T[];
|
|
155
|
+
/**
|
|
156
|
+
* The corridors a `flow` scope keeps for lines that skip ranks: the ranks with their stand-ins,
|
|
157
|
+
* each line's stand-ins by its index in the scope's pairs, and each stand-in's place across the
|
|
158
|
+
* run, in the scope's coordinates.
|
|
159
|
+
*/
|
|
160
|
+
export interface Corridors {
|
|
161
|
+
order: string[][];
|
|
162
|
+
chains: Map<number, string[]>;
|
|
163
|
+
across: Map<string, number>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Lay out a model. `arranged` holds world positions from layout engines; scopes that an engine
|
|
167
|
+
* governs take their children's relative placement from it instead of their built-in recipe.
|
|
168
|
+
*
|
|
169
|
+
* Nodes are laid out on slots: their size in the reference appearance (the default theme, with
|
|
170
|
+
* the file's own overrides), so a theme switch keeps rows, order and positions. Each node is drawn
|
|
171
|
+
* at its theme's size in its slot. A slot grows only where the theme's size is larger
|
|
172
|
+
* than the scope's gap can absorb (`SLOT_SPILL`), or where spilling would bring two boxes closer
|
|
173
|
+
* than `MIN_GAP`. With `slots`, objects come out at their slot size (the engines' input).
|
|
174
|
+
*/
|
|
175
|
+
export declare function layoutModel(m: Model, arranged?: Map<string, Pos & Size>, slots?: boolean): Scene;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routes for a `flow` scope's forward lines, planned from its ranks as a layered layout routes its
|
|
3
|
+
* edges: out of the source's trailing side, along a track in each gap the line turns in, down a
|
|
4
|
+
* corridor through each rank it skips, and into the target's leading side. The ranks' order already
|
|
5
|
+
* keeps crossings few, so the plan only has to place ports and order each gap's tracks. The router
|
|
6
|
+
* takes a planned route as it is when it clears every box.
|
|
7
|
+
*/
|
|
8
|
+
import type { Point, Rect } from '../model/types';
|
|
9
|
+
export interface PlanLine {
|
|
10
|
+
id: string;
|
|
11
|
+
/** Source, the stand-ins of the ranks it skips, target. */
|
|
12
|
+
chain: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface Planned {
|
|
15
|
+
points: Point[];
|
|
16
|
+
fromOffset: number;
|
|
17
|
+
toOffset: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Space between ports on one side and between neighbouring tracks in a gap, as the router keeps
|
|
21
|
+
* them: ports `max(portGap, edgeGap)` apart and tracks `edgeGap` apart.
|
|
22
|
+
*/
|
|
23
|
+
export interface Spacing {
|
|
24
|
+
port: number;
|
|
25
|
+
track: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Plans each line of `lines`. `order` is the ranks with stand-ins, `box` each real member's drawn
|
|
29
|
+
* box and `across` each stand-in's place across the run, all in drawing coordinates. Lines that
|
|
30
|
+
* cannot be planned (a member without a box) are left out.
|
|
31
|
+
*/
|
|
32
|
+
export declare function planRoutes(axis: 'down' | 'right', order: string[][], lines: PlanLine[], box: (id: string) => Rect | undefined, across: (id: string) => number | undefined, spacing?: Spacing): Map<string, Planned>;
|
|
33
|
+
/**
|
|
34
|
+
* The room each gap between ranks needs for the tracks `planRoutes` lays in it: a standoff from
|
|
35
|
+
* the boxes either side and a pitch between tracks, by gap index; a gap with no track is absent.
|
|
36
|
+
* `box` may be a member's slot: only its place across the run counts.
|
|
37
|
+
*/
|
|
38
|
+
export declare function trackRoom(axis: 'down' | 'right', order: string[][], lines: PlanLine[], box: (id: string) => Rect | undefined, across: (id: string) => number | undefined, spacing?: Spacing): number[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Group frame metrics shared by the compiler, the projection and the translator. */
|
|
2
|
+
/** Space between a group's frame and its content, on the sides and bottom. */
|
|
3
|
+
export declare const GROUP_INSET = 24;
|
|
4
|
+
/**
|
|
5
|
+
* Space between a group's top edge and its content in the default theme; the title sits in it.
|
|
6
|
+
* Themes with taller titles reserve more (`ResolvedAppearance.groupHeader`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const GROUP_HEADER = 48;
|
|
9
|
+
/**
|
|
10
|
+
* Horizontal room a group title needs besides its text: the icon and gap before it (33) and the
|
|
11
|
+
* frame controls after it (64), as `GroupView` and the SVG export truncate titles.
|
|
12
|
+
*/
|
|
13
|
+
export declare const GROUP_TITLE_CHROME: number;
|
|
14
|
+
/** Room a soft group's tint leaves round its members, and above them for its label. */
|
|
15
|
+
export declare const SOFT_PAD = 10;
|
|
16
|
+
export declare const SOFT_LABEL = 18;
|
|
17
|
+
/** Where a soft group's label sits in its tint: in the annotation face, at the top left. */
|
|
18
|
+
export declare const SOFT_TITLE: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
/** Corner radius of each rectangle of a tint; small, so joined rectangles read as one shape. */
|
|
23
|
+
export declare const SOFT_RADIUS = 6;
|
|
24
|
+
/** Dash of a sequence participant's lifeline; quieter than a message line. */
|
|
25
|
+
export declare const LIFELINE: {
|
|
26
|
+
dash: string;
|
|
27
|
+
width: number;
|
|
28
|
+
};
|
|
29
|
+
/** Top-left of a group's content area, which its children's local positions are relative to. */
|
|
30
|
+
export declare const contentOrigin: (group: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}, header?: number) => {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
/** Horizontal room a `cells` group's title needs besides its text: padding and the collapse control. */
|
|
38
|
+
export declare const CELLS_TITLE_CHROME: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Lane } from '../model/types';
|
|
2
|
+
import type { ModelEdge } from './syntax';
|
|
3
|
+
interface Box {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
shape?: string;
|
|
7
|
+
parent: string;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
w: number;
|
|
11
|
+
h: number;
|
|
12
|
+
}
|
|
13
|
+
/** A scope arranged along a reading axis, with its fold's bands when it folded. */
|
|
14
|
+
export interface FlowScope {
|
|
15
|
+
scope: string;
|
|
16
|
+
axis: 'right' | 'down';
|
|
17
|
+
bands?: string[][];
|
|
18
|
+
}
|
|
19
|
+
export declare function returnLanes(flows: FlowScope[], edges: ModelEdge[], byId: Map<string, Box>, taken: Set<string>, labelSize?: (label: string) => {
|
|
20
|
+
w: number;
|
|
21
|
+
h: number;
|
|
22
|
+
}): Map<string, Lane>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Diagram, Rect } from '../model/types';
|
|
2
|
+
import type { Scene } from './compile';
|
|
3
|
+
/** Editor state that is not part of the source and survives a reprojection. */
|
|
4
|
+
export type ViewState = Partial<Pick<Diagram, 'settings' | 'camera' | 'theme' | 'collapsed'>>;
|
|
5
|
+
export declare function projectScene(scene: Scene, view?: ViewState): Diagram;
|
|
6
|
+
export interface CanonicalGeometry {
|
|
7
|
+
nodes: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
parent: string;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
w: number;
|
|
13
|
+
h: number;
|
|
14
|
+
}>;
|
|
15
|
+
routes: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
points: Array<{
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/** Rectangles for everything visible, as the canvas draws them. */
|
|
24
|
+
export declare function visibleRects(doc: Diagram): {
|
|
25
|
+
vg: import("../model/graph").VisibleGraph;
|
|
26
|
+
rects: Map<string, Rect>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Node rectangles and route points for a projected document. Edge label positions are left out:
|
|
30
|
+
* the browser measures label text with real fonts, which Node cannot reproduce.
|
|
31
|
+
*/
|
|
32
|
+
export declare function canonicalGeometry(doc: Diagram): CanonicalGeometry;
|
|
33
|
+
export declare function measured(doc: Diagram, rects: Map<string, Rect>, routes: Array<{
|
|
34
|
+
id: string;
|
|
35
|
+
points: Array<{
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}>;
|
|
39
|
+
}>): CanonicalGeometry;
|