@draftably/markdown 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 +16 -64
- 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-IVovOQE9.js +3753 -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 +162 -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 +277 -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,277 @@
|
|
|
1
|
+
export type Point = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export type Rect = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
w: number;
|
|
9
|
+
h: number;
|
|
10
|
+
};
|
|
11
|
+
export type Side = 'left' | 'right' | 'top' | 'bottom';
|
|
12
|
+
export type PortSide = Side | 'auto';
|
|
13
|
+
export type Direction = 'RIGHT' | 'DOWN';
|
|
14
|
+
export type Theme = 'light' | 'dark';
|
|
15
|
+
import type { DiagramAppearance, Shade } from './appearance';
|
|
16
|
+
import type { EndMarker } from './markers';
|
|
17
|
+
import type { Spot, Status } from './status';
|
|
18
|
+
export type ShapeKind = 'box' | 'pill' | 'circle' | 'diamond' | 'text' | 'icon' | 'image'
|
|
19
|
+
/** A seam between two cells of a `cells` group. */
|
|
20
|
+
| 'marker';
|
|
21
|
+
/** A color family: a built-in one, one the file defines, or `auto` for the theme's surface. */
|
|
22
|
+
export type ColorKey = string;
|
|
23
|
+
export type LabelMode = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'detached';
|
|
24
|
+
export interface DiagramNode {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
/** Title before a change, from `was=` on a `~` line. */
|
|
28
|
+
was?: string;
|
|
29
|
+
/** Shape before a change, from `was-shape=` on a `~` line. */
|
|
30
|
+
wasShape?: ShapeKind;
|
|
31
|
+
/** Count before a change, from `was-count=` on a `~` line; 1 means a single box. */
|
|
32
|
+
wasCount?: number | string;
|
|
33
|
+
/** A link to open from exported drawings. */
|
|
34
|
+
href?: string;
|
|
35
|
+
/** How many things this box stands for, or a symbol such as `N`; drawn as a stack with a badge. */
|
|
36
|
+
count?: number | string;
|
|
37
|
+
/** A cell's columns (or units), or `var` for a field of variable length. */
|
|
38
|
+
span?: number | 'var';
|
|
39
|
+
parentId?: string;
|
|
40
|
+
image?: string;
|
|
41
|
+
/** A sequence participant: length of the dashed lifeline below the box. */
|
|
42
|
+
lifeline?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface DiagramGroup {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
/** Title before a change, from `was=` on a `~` line. */
|
|
48
|
+
was?: string;
|
|
49
|
+
/** A link to open from exported drawings. */
|
|
50
|
+
href?: string;
|
|
51
|
+
parentId?: string;
|
|
52
|
+
/** `soft` draws a tint behind the members instead of a frame; `none` draws nothing. */
|
|
53
|
+
frame?: 'soft' | 'none';
|
|
54
|
+
/** Lines the title wraps to, when more than one; the header grows by a line for each. */
|
|
55
|
+
titleLines?: number;
|
|
56
|
+
/** A soft group's tint: rectangles relative to the group's top left; the first holds the label. */
|
|
57
|
+
hull?: Rect[];
|
|
58
|
+
}
|
|
59
|
+
export interface DiagramEdge {
|
|
60
|
+
id: string;
|
|
61
|
+
from: string;
|
|
62
|
+
to: string;
|
|
63
|
+
label: string;
|
|
64
|
+
/** Label before a change, from `was=` on a `~` line. */
|
|
65
|
+
was?: string;
|
|
66
|
+
directed: boolean;
|
|
67
|
+
/** The mark at the target end, when it isn't the plain arrow; see `headOf`. */
|
|
68
|
+
head?: EndMarker;
|
|
69
|
+
/** The mark at the source end, when it has one; see `tailOf`. */
|
|
70
|
+
tail?: EndMarker;
|
|
71
|
+
emphasis: boolean;
|
|
72
|
+
dashed: boolean;
|
|
73
|
+
/** How it differs between two versions of the diagram. */
|
|
74
|
+
status?: Status;
|
|
75
|
+
/** How the drawn emphasis state treats it; see `withState`. */
|
|
76
|
+
spot?: Spot;
|
|
77
|
+
}
|
|
78
|
+
export interface NodeLayout extends Rect {
|
|
79
|
+
manual?: boolean;
|
|
80
|
+
pinned?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface EdgeLayout {
|
|
83
|
+
fromSide?: PortSide;
|
|
84
|
+
toSide?: PortSide;
|
|
85
|
+
labelDx?: number;
|
|
86
|
+
labelDy?: number;
|
|
87
|
+
waypoints?: Point[];
|
|
88
|
+
/** The reading direction of the layout that places both ends; the edge runs along it. */
|
|
89
|
+
flow?: 'right' | 'down';
|
|
90
|
+
/** Set by the compiler for a fold's wrap edge: the line it returns along, between two bands. */
|
|
91
|
+
lane?: Lane;
|
|
92
|
+
/** From a lane, at route time: where along its target's side the edge arrives, off centre. */
|
|
93
|
+
toOffset?: number;
|
|
94
|
+
/** A sequence message: drawn straight between the two lifelines at this height, not routed. */
|
|
95
|
+
row?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A channel between two bands of a fold: a level line at `y`, or an upright one at `x`. With
|
|
99
|
+
* `leave`, the edge leaves its source's side and turns onto the lane at that coordinate; with
|
|
100
|
+
* `enter`, it runs on along the lane to that coordinate and turns into its target's side.
|
|
101
|
+
* With `out`, it is a return or skip lane beyond both ends.
|
|
102
|
+
*/
|
|
103
|
+
export type Lane = ({
|
|
104
|
+
y: number;
|
|
105
|
+
} | {
|
|
106
|
+
x: number;
|
|
107
|
+
}) & {
|
|
108
|
+
leave?: number;
|
|
109
|
+
enter?: number;
|
|
110
|
+
/**
|
|
111
|
+
* A lane beyond both ends, outside their band: the edge leaves by the side facing it, runs
|
|
112
|
+
* along it, and at `enter` turns into the target's side that faces back toward the source.
|
|
113
|
+
*/
|
|
114
|
+
out?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* With `out`: the gap beside the target holds another edge's label, so the edge arrives square
|
|
117
|
+
* on the target's face toward the lane, at `enter` (its middle), instead of turning into that gap.
|
|
118
|
+
*/
|
|
119
|
+
face?: boolean;
|
|
120
|
+
};
|
|
121
|
+
export interface LabelLayout {
|
|
122
|
+
mode?: LabelMode;
|
|
123
|
+
dx?: number;
|
|
124
|
+
dy?: number;
|
|
125
|
+
width?: number;
|
|
126
|
+
leader?: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface ContainerLayout {
|
|
129
|
+
direction: 'inherit' | Direction;
|
|
130
|
+
padding: number;
|
|
131
|
+
manualSize: boolean;
|
|
132
|
+
/** Set for a `cells` group: its members touch, under a title band this tall. */
|
|
133
|
+
cellsBand?: number;
|
|
134
|
+
/** A byte or bit layout's extra marks, relative to the group's top-left corner. */
|
|
135
|
+
cellsChrome?: CellsChrome;
|
|
136
|
+
}
|
|
137
|
+
/** What a byte or bit layout draws besides its cells. */
|
|
138
|
+
export interface CellsChrome {
|
|
139
|
+
/** Unit numbers in a strip under the title band. */
|
|
140
|
+
ruler?: {
|
|
141
|
+
y: number;
|
|
142
|
+
h: number;
|
|
143
|
+
ticks: Array<{
|
|
144
|
+
x: number;
|
|
145
|
+
label: string;
|
|
146
|
+
}>;
|
|
147
|
+
};
|
|
148
|
+
/** Further pieces of fields that run on past a row's end, by field. */
|
|
149
|
+
pieces?: Record<string, Rect[]>;
|
|
150
|
+
/** Fields of variable length, drawn with broken ends. */
|
|
151
|
+
open?: string[];
|
|
152
|
+
}
|
|
153
|
+
export type IntentRole = 'start' | 'end';
|
|
154
|
+
export type IntentPlacement = 'top-left' | 'left-center' | 'center' | 'top-center' | 'top-right' | 'right-center' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
155
|
+
export type LayoutIntent = Partial<Record<IntentRole, {
|
|
156
|
+
id: string;
|
|
157
|
+
placement: IntentPlacement;
|
|
158
|
+
}>>;
|
|
159
|
+
export interface NodeStyle {
|
|
160
|
+
shape: ShapeKind;
|
|
161
|
+
color: ColorKey;
|
|
162
|
+
/** Numeric shade; omitted means the default for the object (500 for nodes, 100 for groups). */
|
|
163
|
+
shade?: Shade;
|
|
164
|
+
icon: string;
|
|
165
|
+
/** How it differs between two versions of the diagram. */
|
|
166
|
+
status?: Status;
|
|
167
|
+
/** How the drawn emphasis state treats it; see `withState`. */
|
|
168
|
+
spot?: Spot;
|
|
169
|
+
}
|
|
170
|
+
export type LayoutAlgorithmId = 'compound-flow' | 'boundary-align' | 'compound-spring' | 'tidy' | 'stress' | 'force' | 'flow' | 'layered' | 'tree' | 'grid' | 'separate';
|
|
171
|
+
export type AspectSetting = 'canvas' | '1' | '1.333' | '1.6' | '2' | '0.75';
|
|
172
|
+
export interface LayoutSettings {
|
|
173
|
+
algorithm: LayoutAlgorithmId;
|
|
174
|
+
direction: Direction;
|
|
175
|
+
mode: 'pass' | 'rebuild';
|
|
176
|
+
maxMove: number;
|
|
177
|
+
stability: number;
|
|
178
|
+
iterations: number;
|
|
179
|
+
nodeGap: number;
|
|
180
|
+
rankGap: number;
|
|
181
|
+
edgeLength: number;
|
|
182
|
+
repulsion: number;
|
|
183
|
+
flowStrength: number;
|
|
184
|
+
alignment: number;
|
|
185
|
+
compactness: number;
|
|
186
|
+
gridStrength: number;
|
|
187
|
+
aspect: AspectSetting;
|
|
188
|
+
fold: 'auto' | 'never';
|
|
189
|
+
respectDirection: boolean;
|
|
190
|
+
ordering: 'stable' | 'crossings';
|
|
191
|
+
rootId: string;
|
|
192
|
+
respectManual: boolean;
|
|
193
|
+
growContainers: boolean;
|
|
194
|
+
boundaryPull: number;
|
|
195
|
+
hierarchySweeps: number;
|
|
196
|
+
groupGap: number;
|
|
197
|
+
}
|
|
198
|
+
export interface RoutingSettings {
|
|
199
|
+
clearance: number;
|
|
200
|
+
portGap: number;
|
|
201
|
+
edgeGap: number;
|
|
202
|
+
bendPenalty: number;
|
|
203
|
+
crossingPenalty: number;
|
|
204
|
+
sharedPenalty: number;
|
|
205
|
+
parallelPenalty: number;
|
|
206
|
+
portStability: number;
|
|
207
|
+
fanoutPenalty: number;
|
|
208
|
+
passes: number;
|
|
209
|
+
cornerRadius: number;
|
|
210
|
+
standoff: number;
|
|
211
|
+
}
|
|
212
|
+
export interface DiagramSettings extends LayoutSettings {
|
|
213
|
+
snap: boolean;
|
|
214
|
+
showManual: boolean;
|
|
215
|
+
routing: RoutingSettings;
|
|
216
|
+
}
|
|
217
|
+
export interface Camera {
|
|
218
|
+
x: number;
|
|
219
|
+
y: number;
|
|
220
|
+
k: number;
|
|
221
|
+
}
|
|
222
|
+
export interface Diagram {
|
|
223
|
+
schemaVersion: 2;
|
|
224
|
+
id: string;
|
|
225
|
+
title: string;
|
|
226
|
+
graph: {
|
|
227
|
+
nodes: DiagramNode[];
|
|
228
|
+
edges: DiagramEdge[];
|
|
229
|
+
groups: DiagramGroup[];
|
|
230
|
+
};
|
|
231
|
+
layout: {
|
|
232
|
+
nodes: Record<string, NodeLayout>;
|
|
233
|
+
edges: Record<string, EdgeLayout>;
|
|
234
|
+
labels: Record<string, LabelLayout>;
|
|
235
|
+
containers: Record<string, ContainerLayout>;
|
|
236
|
+
intent: LayoutIntent;
|
|
237
|
+
/** A sequence diagram's frame and the row bands of its `phase` statements. */
|
|
238
|
+
sequence?: SequenceLayout;
|
|
239
|
+
};
|
|
240
|
+
styles: Record<string, NodeStyle>;
|
|
241
|
+
collapsed: string[];
|
|
242
|
+
settings: DiagramSettings;
|
|
243
|
+
camera: Camera;
|
|
244
|
+
/** Editor light or dark mode; independent of the diagram's appearance. */
|
|
245
|
+
theme: Theme;
|
|
246
|
+
/** Diagram theme, overrides and color definitions. Saved with the diagram. */
|
|
247
|
+
appearance: DiagramAppearance;
|
|
248
|
+
}
|
|
249
|
+
export type NodeGeometry = Record<string, NodeLayout>;
|
|
250
|
+
/** The panel a sequence diagram is drawn on, and a row band for each `phase`. */
|
|
251
|
+
export interface SequenceLayout {
|
|
252
|
+
panel: Rect;
|
|
253
|
+
phases: SequencePhase[];
|
|
254
|
+
/** Left edge for phase labels, when a note in the left margin widens the panel past them. */
|
|
255
|
+
phaseX?: number;
|
|
256
|
+
/** Spots of the notes that sit in a side margin, by index in `appearance.notes`. */
|
|
257
|
+
notes?: Array<Rect | null>;
|
|
258
|
+
/** With `notes`: the panel without those margins, for drawings with their notes in the frame. */
|
|
259
|
+
inner?: Rect;
|
|
260
|
+
/**
|
|
261
|
+
* From `was-order`: each message's row and the phase bands in the older message order, and how
|
|
262
|
+
* much further that order runs down the panel.
|
|
263
|
+
*/
|
|
264
|
+
before?: {
|
|
265
|
+
rows: Record<string, number>;
|
|
266
|
+
phases: SequencePhase[];
|
|
267
|
+
grow: number;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
export type SequencePhase = {
|
|
271
|
+
id: string;
|
|
272
|
+
label: string;
|
|
273
|
+
y: number;
|
|
274
|
+
h: number;
|
|
275
|
+
};
|
|
276
|
+
/** Any object that can be selected: a shape, a container, or a connection. */
|
|
277
|
+
export type Entity = DiagramNode | DiagramGroup | DiagramEdge;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftably/markdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Build static SVG diagram assets from Markdown draft fences.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,29 +11,31 @@
|
|
|
11
11
|
],
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"types": "./dist/types/packages/markdown/src/index.d.ts",
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./remark": {
|
|
18
|
-
"types": "./dist/types/remark.d.ts",
|
|
18
|
+
"types": "./dist/types/packages/markdown/src/remark.d.ts",
|
|
19
19
|
"import": "./dist/remark.js"
|
|
20
20
|
},
|
|
21
21
|
"./markdown-it": {
|
|
22
|
-
"types": "./dist/types/markdown-it.d.ts",
|
|
22
|
+
"types": "./dist/types/packages/markdown/src/markdown-it.d.ts",
|
|
23
23
|
"import": "./dist/markdown-it.js"
|
|
24
24
|
},
|
|
25
25
|
"./files": {
|
|
26
|
-
"types": "./dist/types/files.d.ts",
|
|
26
|
+
"types": "./dist/types/packages/markdown/src/files.d.ts",
|
|
27
27
|
"import": "./dist/files.js"
|
|
28
28
|
},
|
|
29
29
|
"./client": {
|
|
30
|
-
"types": "./dist/types/client.d.ts",
|
|
30
|
+
"types": "./dist/types/packages/markdown/src/client.d.ts",
|
|
31
31
|
"import": "./dist/client.js"
|
|
32
32
|
},
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
36
|
+
"jsdom": "26.1.0",
|
|
37
|
+
"mermaid": "12.2.0",
|
|
38
|
+
"@draftably/runtime": "0.2.0"
|
|
37
39
|
},
|
|
38
40
|
"engines": {
|
|
39
41
|
"node": ">=22.21.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/{markdown-it-helpers.d.ts → packages/markdown/src/markdown-it-helpers.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|