@x12i/diagrams 1.0.0 → 1.1.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 +20 -14
- package/dist/chunk-3DJFQRU3.js +2708 -0
- package/dist/chunk-3DJFQRU3.js.map +1 -0
- package/dist/index.d.ts +67 -54
- package/dist/index.js +204 -45
- package/dist/index.js.map +1 -1
- package/dist/messages-ZCyCfyO0.d.ts +857 -0
- package/dist/react.d.ts +348 -0
- package/dist/react.js +2525 -0
- package/dist/react.js.map +1 -0
- package/dist/styles.css +1389 -0
- package/package.json +51 -4
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ComponentPropsWithoutRef, Ref, ComponentPropsWithRef, RefObject, CSSProperties } from 'react';
|
|
3
|
+
import { p as DiagramMessages, q as DiagramMessagesOverride } from './messages-ZCyCfyO0.js';
|
|
4
|
+
import { NodeKind, DiagramNode, LayoutDirection, DiagramDocument, HistoryOptions, DiagramConnection, ConnectionRules, LayoutOptions, EdgeKind, NewNode, Alignment, SvgOptions, DiagramPalette } from './index.js';
|
|
5
|
+
export { Z as Message, _ as MessageValues, az as defaultMessages, aK as exportDiagramJson, aL as exportDiagramSvg } from './messages-ZCyCfyO0.js';
|
|
6
|
+
|
|
7
|
+
/** The drag-and-drop type used when a palette entry is dragged onto the canvas. */
|
|
8
|
+
declare const PALETTE_DRAG_TYPE = "application/x-kit-diagram-node";
|
|
9
|
+
interface ToolbarSections {
|
|
10
|
+
/** The "add node" button and the palette it opens. Editable canvases only. */
|
|
11
|
+
palette?: boolean;
|
|
12
|
+
/** Undo and redo. */
|
|
13
|
+
history?: boolean;
|
|
14
|
+
/** Delete, duplicate, group and ungroup. Editable canvases only. */
|
|
15
|
+
edit?: boolean;
|
|
16
|
+
/** Arrange automatically. Editable canvases only. */
|
|
17
|
+
layout?: boolean;
|
|
18
|
+
/** Zoom, fit, minimap and grid. */
|
|
19
|
+
view?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Why the document changed. Useful for analytics, autosave rules and undo labels. */
|
|
23
|
+
type DiagramChangeReason = "move" | "resize" | "rename" | "rename-edge" | "add-node" | "delete" | "connect" | "disconnect" | "paste" | "duplicate" | "group" | "ungroup" | "collapse" | "layout" | "align" | "distribute" | "update" | "history";
|
|
24
|
+
interface DiagramChange {
|
|
25
|
+
reason: DiagramChangeReason;
|
|
26
|
+
/** Nodes the change touched, when that is known. */
|
|
27
|
+
nodeIds?: string[];
|
|
28
|
+
/** Edges the change touched, when that is known. */
|
|
29
|
+
edgeIds?: string[];
|
|
30
|
+
/** Changes with the same key in a row share one undo step. `useDiagramHistory` honors it. */
|
|
31
|
+
coalesceKey?: string;
|
|
32
|
+
}
|
|
33
|
+
interface DiagramSelection {
|
|
34
|
+
nodeIds: string[];
|
|
35
|
+
edgeIds: string[];
|
|
36
|
+
}
|
|
37
|
+
/** What a custom node body receives. Handles, focus, labels for assistive technology and resizing stay with the canvas. */
|
|
38
|
+
interface DiagramNodeRenderProps {
|
|
39
|
+
node: DiagramNode;
|
|
40
|
+
selected: boolean;
|
|
41
|
+
editing: boolean;
|
|
42
|
+
rtl: boolean;
|
|
43
|
+
direction: LayoutDirection;
|
|
44
|
+
messages: DiagramMessages;
|
|
45
|
+
/** The label: plain text, or the inline editor while the node is being renamed. Put it somewhere in your body. */
|
|
46
|
+
label: ReactNode;
|
|
47
|
+
/** The built-in body for this kind, so a renderer can wrap or extend it. */
|
|
48
|
+
defaultBody: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/** Replace the body of a node kind. Return `undefined` to keep the built-in body. */
|
|
51
|
+
type NodeRenderers = Partial<Record<NodeKind, (props: DiagramNodeRenderProps) => ReactNode | undefined>>;
|
|
52
|
+
|
|
53
|
+
type UseDiagramHistoryOptions = HistoryOptions;
|
|
54
|
+
/** How a change should be recorded. Changes that share a `coalesceKey` in a row become one undo step. */
|
|
55
|
+
interface HistoryChangeMeta {
|
|
56
|
+
coalesceKey?: string;
|
|
57
|
+
}
|
|
58
|
+
interface DiagramHistory {
|
|
59
|
+
/** The current document. Pass it to `DiagramCanvas` as `value`. */
|
|
60
|
+
document: DiagramDocument;
|
|
61
|
+
/** Records a new document. Pass it to `DiagramCanvas` as `onChange`. */
|
|
62
|
+
set: (next: DiagramDocument | ((current: DiagramDocument) => DiagramDocument), meta?: HistoryChangeMeta) => void;
|
|
63
|
+
undo: () => void;
|
|
64
|
+
redo: () => void;
|
|
65
|
+
canUndo: boolean;
|
|
66
|
+
canRedo: boolean;
|
|
67
|
+
/** Replaces the document and forgets the history, for example after loading a file. */
|
|
68
|
+
reset: (next: DiagramDocument) => void;
|
|
69
|
+
/** Forgets the history and keeps the current document. */
|
|
70
|
+
clear: () => void;
|
|
71
|
+
/** The number of steps that can be undone. */
|
|
72
|
+
undoDepth: number;
|
|
73
|
+
/** The number of steps that can be redone. */
|
|
74
|
+
redoDepth: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Undo and redo for a diagram. Wire it to the canvas:
|
|
78
|
+
*
|
|
79
|
+
* ```tsx
|
|
80
|
+
* const history = useDiagramHistory(initialDocument);
|
|
81
|
+
* <DiagramCanvas value={history.document} onChange={history.set} history={history} />
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* Without it, an uncontrolled `DiagramCanvas` keeps its own history.
|
|
85
|
+
*/
|
|
86
|
+
declare function useDiagramHistory(initial: DiagramDocument | (() => DiagramDocument), options?: UseDiagramHistoryOptions): DiagramHistory;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* An extra rule for new connections, checked after the built-in ones. Return
|
|
90
|
+
* `true` to allow, `false` to refuse with a generic message, or a string to
|
|
91
|
+
* refuse and show that (translated) text.
|
|
92
|
+
*/
|
|
93
|
+
type ConnectionValidator = (connection: DiagramConnection, document: DiagramDocument) => boolean | string;
|
|
94
|
+
/** Methods you can call on a canvas through its `ref`. */
|
|
95
|
+
interface DiagramCanvasHandle {
|
|
96
|
+
fitView: () => void;
|
|
97
|
+
zoomIn: () => void;
|
|
98
|
+
zoomOut: () => void;
|
|
99
|
+
/** Moves keyboard focus to a node, expanding collapsed groups around it first. Returns false for an unknown id. */
|
|
100
|
+
focusNode: (id: string) => boolean;
|
|
101
|
+
/** Replaces the selection. */
|
|
102
|
+
select: (nodeIds: readonly string[], edgeIds?: readonly string[]) => void;
|
|
103
|
+
clearSelection: () => void;
|
|
104
|
+
undo: () => void;
|
|
105
|
+
redo: () => void;
|
|
106
|
+
/** Arranges the diagram. Options are merged over the canvas `direction` and `layoutOptions`. */
|
|
107
|
+
applyLayout: (options?: LayoutOptions) => void;
|
|
108
|
+
/** Adds a node in the middle of the view and returns its id. Does nothing on a read-only canvas. */
|
|
109
|
+
addNode: (kind: NodeKind, init?: Partial<NewNode>) => string | undefined;
|
|
110
|
+
align: (alignment: Alignment) => void;
|
|
111
|
+
distribute: (axis: "horizontal" | "vertical") => void;
|
|
112
|
+
group: () => void;
|
|
113
|
+
ungroup: () => void;
|
|
114
|
+
duplicate: () => void;
|
|
115
|
+
deleteSelection: () => void;
|
|
116
|
+
copy: () => void;
|
|
117
|
+
paste: () => void;
|
|
118
|
+
getDocument: () => DiagramDocument;
|
|
119
|
+
getSelection: () => DiagramSelection;
|
|
120
|
+
}
|
|
121
|
+
interface DiagramCanvasProps extends Omit<ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue" | "children" | "dir" | "title"> {
|
|
122
|
+
/** The diagram, when you own the state. Pair it with `onChange`. */
|
|
123
|
+
value?: DiagramDocument;
|
|
124
|
+
/** The starting diagram, when the canvas owns the state. */
|
|
125
|
+
defaultValue?: DiagramDocument;
|
|
126
|
+
/** Called with the whole next document and why it changed. */
|
|
127
|
+
onChange?: (next: DiagramDocument, change: DiagramChange) => void;
|
|
128
|
+
/** Shows the diagram without editing tools. Selection, navigation, zoom and collapsing still work. */
|
|
129
|
+
readOnly?: boolean;
|
|
130
|
+
/** The accessible name of the canvas. Defaults to the translated "Diagram: {title}". */
|
|
131
|
+
label?: string;
|
|
132
|
+
/** Direction of the flow. Decides where connection points sit and the Tab order. Defaults to `TB`. */
|
|
133
|
+
direction?: LayoutDirection;
|
|
134
|
+
/** Text direction. Defaults to the direction of the surrounding page. */
|
|
135
|
+
dir?: "ltr" | "rtl";
|
|
136
|
+
messages?: DiagramMessagesOverride;
|
|
137
|
+
/** Height of the canvas. Defaults to a comfortable height from the size tokens. */
|
|
138
|
+
height?: number | string;
|
|
139
|
+
/** `true` (default) shows every section, `false` none, or choose sections. Editing sections only show when editable. */
|
|
140
|
+
toolbar?: boolean | ToolbarSections;
|
|
141
|
+
/** The node types the palette offers. Defaults to all of them. */
|
|
142
|
+
palette?: readonly NodeKind[];
|
|
143
|
+
/** Start with the minimap shown. The toolbar toggles it. */
|
|
144
|
+
minimap?: boolean;
|
|
145
|
+
/** Start with the dotted grid shown (default true). The toolbar toggles it. */
|
|
146
|
+
grid?: boolean;
|
|
147
|
+
/** Snap dragged nodes to the grid. `true` uses the kit grid (8), or give a size. Defaults to true. */
|
|
148
|
+
snapToGrid?: boolean | number;
|
|
149
|
+
/** Rules for new connections. Defaults follow `document.kind` (a `dag` refuses cycles, a `tree` also refuses second parents). */
|
|
150
|
+
connectionRules?: ConnectionRules;
|
|
151
|
+
/** An extra check for new connections. */
|
|
152
|
+
validateConnection?: ConnectionValidator;
|
|
153
|
+
/** Replace the body of a node kind. */
|
|
154
|
+
nodeRenderers?: NodeRenderers;
|
|
155
|
+
/** A `useDiagramHistory` result (or anything shaped like it) to drive undo and redo when you own the state. */
|
|
156
|
+
history?: Pick<DiagramHistory, "undo" | "redo" | "canUndo" | "canRedo">;
|
|
157
|
+
/** Options for the auto-layout button and `applyLayout`. */
|
|
158
|
+
layoutOptions?: LayoutOptions;
|
|
159
|
+
onSelectionChange?: (selection: DiagramSelection) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Called when a node is activated: double-click or Enter on a read-only
|
|
162
|
+
* canvas, and Ctrl or Cmd with Enter on an editable one (plain Enter renames).
|
|
163
|
+
*/
|
|
164
|
+
onNodeActivate?: (node: DiagramNode) => void;
|
|
165
|
+
/**
|
|
166
|
+
* The text outline. `hidden` (default) is reachable by keyboard and screen
|
|
167
|
+
* reader and appears when it has focus, `visible` always shows it, `false`
|
|
168
|
+
* leaves it out (render `DiagramOutline` yourself).
|
|
169
|
+
*/
|
|
170
|
+
outline?: "hidden" | "visible" | false;
|
|
171
|
+
/** Make connections focusable and deletable from the keyboard. Defaults to false: the outline lists them. */
|
|
172
|
+
edgesFocusable?: boolean;
|
|
173
|
+
/** Render only the nodes in view. Faster for very large diagrams, but off-screen nodes are not in the page for assistive technology. */
|
|
174
|
+
virtualize?: boolean;
|
|
175
|
+
/** Show the React Flow credit link. Defaults to false; see the README. */
|
|
176
|
+
showAttribution?: boolean;
|
|
177
|
+
/** Line style for edges that do not set one. */
|
|
178
|
+
edgeKind?: EdgeKind;
|
|
179
|
+
minZoom?: number;
|
|
180
|
+
maxZoom?: number;
|
|
181
|
+
/** Zoom with the mouse wheel (default true). Turn it off so the page can scroll over the canvas; Ctrl or Cmd with the wheel still zooms. */
|
|
182
|
+
wheelZoom?: boolean;
|
|
183
|
+
/** Fit the diagram to the view when it first appears. Defaults to true. */
|
|
184
|
+
fitOnMount?: boolean;
|
|
185
|
+
/** A handle for the methods in `DiagramCanvasHandle`. */
|
|
186
|
+
ref?: Ref<DiagramCanvasHandle>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* An accessible, editable node-and-edge diagram. It is controlled
|
|
190
|
+
* (`value` + `onChange`) or uncontrolled (`defaultValue`), and it is a
|
|
191
|
+
* read-only viewer with `readOnly`.
|
|
192
|
+
*
|
|
193
|
+
* Keyboard: Tab visits nodes in reading order; arrow keys jump to the nearest
|
|
194
|
+
* node in that direction; Space selects; Enter renames; Delete removes; C
|
|
195
|
+
* connects; Shift with an arrow nudges. A text outline of the whole diagram
|
|
196
|
+
* is part of the canvas.
|
|
197
|
+
*/
|
|
198
|
+
declare function DiagramCanvas(props: DiagramCanvasProps): react.JSX.Element;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Moves keyboard focus to a node of a rendered `DiagramCanvas`, found by the
|
|
202
|
+
* `id` you gave the canvas. Returns false when the node is not on the page
|
|
203
|
+
* (for example it is inside a collapsed group).
|
|
204
|
+
*/
|
|
205
|
+
declare function focusDiagramNode(canvasId: string, nodeId: string): boolean;
|
|
206
|
+
interface DiagramOutlineProps extends Omit<ComponentPropsWithRef<"section">, "children" | "title"> {
|
|
207
|
+
document: DiagramDocument;
|
|
208
|
+
messages?: DiagramMessagesOverride;
|
|
209
|
+
/** Orders items the way the canvas orders Tab stops. Defaults to `TB`. */
|
|
210
|
+
direction?: LayoutDirection;
|
|
211
|
+
/** Right-to-left reading order and text direction. */
|
|
212
|
+
rtl?: boolean;
|
|
213
|
+
/** The `id` of a `DiagramCanvas`: choosing a node moves focus to it there. */
|
|
214
|
+
canvasId?: string;
|
|
215
|
+
/** A canvas handle (`ref`) to focus nodes through. It can also expand a collapsed group first. */
|
|
216
|
+
canvas?: RefObject<DiagramCanvasHandle | null>;
|
|
217
|
+
/** Called when a node is chosen, in addition to the two options above. */
|
|
218
|
+
onNavigate?: (nodeId: string) => void;
|
|
219
|
+
/** Adds a button after each connection that removes it. Pass it only for editable diagrams. */
|
|
220
|
+
onDisconnect?: (edgeId: string) => void;
|
|
221
|
+
/** The heading level of the title. Defaults to 3. */
|
|
222
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
223
|
+
/**
|
|
224
|
+
* `always` (default) shows the outline. `focus` hides it visually until
|
|
225
|
+
* keyboard focus is inside it, so it adds no clutter but stays reachable.
|
|
226
|
+
*/
|
|
227
|
+
reveal?: "always" | "focus";
|
|
228
|
+
/** Also list the paths through the diagram ("Start to Review to Done"). Defaults to true. */
|
|
229
|
+
showPaths?: boolean;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The text twin of a diagram: every node once, grouped like the canvas, with
|
|
233
|
+
* what each connects to and from, and a link that moves focus to the node.
|
|
234
|
+
* It is what a screen reader user, a search engine and a printout see.
|
|
235
|
+
*/
|
|
236
|
+
declare function DiagramOutline({ document: doc, messages: messagesOverride, direction, rtl, canvasId, canvas, onNavigate, onDisconnect, headingLevel, reveal, showPaths, className, ...props }: DiagramOutlineProps): react.JSX.Element;
|
|
237
|
+
|
|
238
|
+
/** The part of Mermaid this component uses. The `mermaid` package satisfies it. */
|
|
239
|
+
interface MermaidApi {
|
|
240
|
+
initialize: (config: Record<string, unknown>) => void;
|
|
241
|
+
render: (id: string, text: string) => Promise<{
|
|
242
|
+
svg: string;
|
|
243
|
+
}>;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Loads Mermaid. The package is not a dependency of `@x12i/diagrams`; install
|
|
247
|
+
* it yourself and pass `() => import("mermaid")`. A module with a `default`
|
|
248
|
+
* export is accepted too.
|
|
249
|
+
*/
|
|
250
|
+
type MermaidLoader = () => Promise<MermaidApi | {
|
|
251
|
+
default: MermaidApi;
|
|
252
|
+
}>;
|
|
253
|
+
/**
|
|
254
|
+
* Mermaid cannot use `var(--token)` (it computes with the colors), so this
|
|
255
|
+
* reads the current values from the page and returns Mermaid `themeVariables`
|
|
256
|
+
* that follow the kit theme. Call it again after the theme changes.
|
|
257
|
+
*/
|
|
258
|
+
declare function readKitThemeVariables(element?: Element): Record<string, string>;
|
|
259
|
+
interface MermaidDiagramProps extends Omit<ComponentPropsWithRef<"figure">, "children" | "title" | "onError"> {
|
|
260
|
+
/** The Mermaid text, for example `graph TD; A-->B;`. */
|
|
261
|
+
source: string;
|
|
262
|
+
/** How to get Mermaid. Required, so the app decides when and whether to download it. */
|
|
263
|
+
loadMermaid: MermaidLoader;
|
|
264
|
+
/** Accessible name. Defaults to nothing: pass one so the picture has a name. */
|
|
265
|
+
title: string;
|
|
266
|
+
/** What the diagram says in words. Strongly recommended: Mermaid output has no text alternative of its own. */
|
|
267
|
+
description?: string;
|
|
268
|
+
messages?: DiagramMessagesOverride;
|
|
269
|
+
/**
|
|
270
|
+
* Extra Mermaid configuration. `securityLevel` is always `strict` and
|
|
271
|
+
* `startOnLoad` is always off; they cannot be overridden. `theme` defaults to
|
|
272
|
+
* `base` with variables from the kit tokens.
|
|
273
|
+
*/
|
|
274
|
+
config?: Record<string, unknown>;
|
|
275
|
+
/** Called with the finished, sanitized SVG element. */
|
|
276
|
+
onRender?: (svg: SVGSVGElement) => void;
|
|
277
|
+
/** Called when Mermaid cannot be loaded or the source cannot be rendered. */
|
|
278
|
+
onError?: (error: unknown, kind: "load" | "render") => void;
|
|
279
|
+
/** Show the source toggle. Defaults to true: the source is the text alternative. */
|
|
280
|
+
showSourceToggle?: boolean;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Renders Mermaid text as a themed, sanitized SVG, with a loading state, an
|
|
284
|
+
* error state that shows the source, and a text alternative. Mermaid is loaded
|
|
285
|
+
* on demand through `loadMermaid`, so it stays out of your bundle until used.
|
|
286
|
+
*/
|
|
287
|
+
declare function MermaidDiagram({ source, loadMermaid, title, description, messages: messagesOverride, config, onRender, onError, showSourceToggle, className, ...props }: MermaidDiagramProps): react.JSX.Element;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Parses SVG markup (Mermaid's output) into a clean element that is safe to
|
|
291
|
+
* insert, or returns `null` when there is no SVG in it. It is a second line of
|
|
292
|
+
* defense: Mermaid is also run with `securityLevel: "strict"`.
|
|
293
|
+
*
|
|
294
|
+
* Removed: scripts, frames, objects, embeds, animation elements, every `on*`
|
|
295
|
+
* attribute, every `href` that is not a `#fragment` (or a safe raster image),
|
|
296
|
+
* CSS `@import` and any `url()` that leaves the document. The markup is parsed
|
|
297
|
+
* with `DOMParser` and inserted by the caller with `importNode`, never with
|
|
298
|
+
* `innerHTML`.
|
|
299
|
+
*/
|
|
300
|
+
declare function sanitizeSvgMarkup(markup: string): SVGSVGElement | null;
|
|
301
|
+
|
|
302
|
+
interface StaticDiagramProps extends Omit<SvgOptions, "standalone" | "idPrefix"> {
|
|
303
|
+
/** The diagram to draw. */
|
|
304
|
+
document: DiagramDocument;
|
|
305
|
+
/** Translations. Only the word that joins labels in the description ("A to B") is used here. */
|
|
306
|
+
messages?: DiagramMessagesOverride;
|
|
307
|
+
/** Unique id prefix for the SVG's internal ids. Defaults to a generated one. */
|
|
308
|
+
idPrefix?: string;
|
|
309
|
+
className?: string;
|
|
310
|
+
style?: CSSProperties;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* A diagram as plain, non-interactive SVG. It renders the same picture as
|
|
314
|
+
* `diagramToSvg`, but as React elements: no markup is injected, no editor code
|
|
315
|
+
* runs, and it works in server components. Colors follow the page theme
|
|
316
|
+
* through the kit tokens. The SVG has a title, a description (the text outline
|
|
317
|
+
* by default) and `role="img"`.
|
|
318
|
+
*
|
|
319
|
+
* Use it for reports, documentation and anywhere the reader should not edit.
|
|
320
|
+
*/
|
|
321
|
+
declare function StaticDiagram({ document: doc, messages, idPrefix, className, style, ...options }: StaticDiagramProps): ReactNode;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Saves a file from the browser. Pass a string (with a `type`) or a `Blob`.
|
|
325
|
+
* Browser only: call it from an event handler.
|
|
326
|
+
*/
|
|
327
|
+
declare function downloadBlob(content: Blob | string, filename: string, type?: string): void;
|
|
328
|
+
/**
|
|
329
|
+
* Replaces every `var(--kit-...)` in a string with the value it has on
|
|
330
|
+
* `element` (the page root by default). Unknown variables use their fallback
|
|
331
|
+
* or are left as written. Use it before saving an SVG that will be opened
|
|
332
|
+
* outside a themed page.
|
|
333
|
+
*/
|
|
334
|
+
declare function resolveCssVariables(text: string, element?: Element): string;
|
|
335
|
+
/** The palette the static SVG uses, with every token resolved to its current value. */
|
|
336
|
+
declare function readDiagramPalette(element?: Element): DiagramPalette;
|
|
337
|
+
interface DownloadSvgOptions extends SvgOptions {
|
|
338
|
+
filename?: string;
|
|
339
|
+
/** Where to read token values from. Defaults to the page root. */
|
|
340
|
+
element?: Element;
|
|
341
|
+
}
|
|
342
|
+
/** Saves the diagram as a stand-alone `.svg` file, with the current theme's colors baked in. */
|
|
343
|
+
declare function downloadDiagramSvg(doc: DiagramDocument, options?: DownloadSvgOptions): void;
|
|
344
|
+
/** Saves the diagram document as a `.json` file. Import it again with `importDiagram`. */
|
|
345
|
+
declare function downloadDiagramJson(doc: DiagramDocument, filename?: string): void;
|
|
346
|
+
|
|
347
|
+
export { DiagramCanvas, DiagramMessages, DiagramMessagesOverride, DiagramOutline, MermaidDiagram, PALETTE_DRAG_TYPE, StaticDiagram, downloadBlob, downloadDiagramJson, downloadDiagramSvg, focusDiagramNode, readDiagramPalette, readKitThemeVariables, resolveCssVariables, sanitizeSvgMarkup, useDiagramHistory };
|
|
348
|
+
export type { ConnectionValidator, DiagramCanvasHandle, DiagramCanvasProps, DiagramChange, DiagramChangeReason, DiagramHistory, DiagramNodeRenderProps, DiagramOutlineProps, DiagramSelection, DownloadSvgOptions, HistoryChangeMeta, MermaidApi, MermaidDiagramProps, MermaidLoader, NodeRenderers, StaticDiagramProps, ToolbarSections, UseDiagramHistoryOptions };
|