@draftably/editor 0.0.0-stage → 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 +25 -2
- package/dist/LICENSE +21 -0
- package/dist/assets/engine.worker-DwN9io_m.js +6856 -0
- package/dist/element.js +36 -0
- package/dist/index.js +19555 -0
- package/dist/types/src/cli/links.d.ts +4 -0
- package/dist/types/src/cli/pdf.d.ts +29 -0
- package/dist/types/src/cli/png.d.ts +23 -0
- package/dist/types/src/cli/svg.d.ts +4 -0
- package/dist/types/src/components/Icon.d.ts +14 -0
- package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
- package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
- package/dist/types/src/components/canvas/Frame.d.ts +22 -0
- package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
- package/dist/types/src/components/canvas/Notes.d.ts +5 -0
- package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
- package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
- package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
- package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
- package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
- package/dist/types/src/components/controls.d.ts +91 -0
- package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
- package/dist/types/src/components/scene/GroupView.d.ts +22 -0
- package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
- package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
- package/dist/types/src/components/scene/NodeView.d.ts +18 -0
- package/dist/types/src/components/scene/parts.d.ts +50 -0
- package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
- package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
- package/dist/types/src/components/session-context.d.ts +486 -0
- 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/layout-edits.d.ts +58 -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/source-edits.d.ts +37 -0
- package/dist/types/src/dsl/syntax.d.ts +317 -0
- package/dist/types/src/dsl/translate.d.ts +69 -0
- package/dist/types/src/editor/Editor.d.ts +6 -0
- package/dist/types/src/editor/element.d.ts +15 -0
- package/dist/types/src/editor/mount.d.ts +23 -0
- package/dist/types/src/lib/engine-tasks.d.ts +88 -0
- package/dist/types/src/lib/font-data.d.ts +9 -0
- package/dist/types/src/lib/saved-diagram.d.ts +4 -0
- package/dist/types/src/lib/scene-cache.d.ts +4 -0
- package/dist/types/src/lib/svg-export.d.ts +15 -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/camera.d.ts +21 -0
- package/dist/types/src/model/colors.d.ts +22 -0
- package/dist/types/src/model/document.d.ts +24 -0
- package/dist/types/src/model/edits.d.ts +133 -0
- package/dist/types/src/model/embed.d.ts +17 -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/frame.d.ts +71 -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/legend.d.ts +25 -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/panels.d.ts +11 -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/samples.d.ts +11 -0
- package/dist/types/src/model/stack.d.ts +8 -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/surface.d.ts +31 -0
- package/dist/types/src/model/types.d.ts +277 -0
- package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
- package/dist/types/src/server/file-session.d.ts +19 -0
- package/dist/types/src/server/workspace.d.ts +21 -0
- package/dist/types/src/state/active-session.d.ts +479 -0
- package/dist/types/src/state/canvas-commands.d.ts +169 -0
- package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
- package/dist/types/src/state/keys.d.ts +5 -0
- package/dist/types/src/state/links.d.ts +14 -0
- package/dist/types/src/state/session/actions.d.ts +77 -0
- package/dist/types/src/state/session/canvas-text.d.ts +24 -0
- package/dist/types/src/state/session/document.d.ts +84 -0
- package/dist/types/src/state/session/editor.d.ts +81 -0
- package/dist/types/src/state/session/emphasis.d.ts +11 -0
- package/dist/types/src/state/session/file-session.d.ts +98 -0
- package/dist/types/src/state/session/index.d.ts +496 -0
- package/dist/types/src/state/session/layout.d.ts +79 -0
- package/dist/types/src/state/session/pointer.d.ts +19 -0
- package/dist/types/src/state/session/routing.d.ts +20 -0
- package/dist/types/src/state/session/scene.d.ts +144 -0
- package/dist/types/src/state/session/sculpt.d.ts +70 -0
- package/dist/types/src/state/toast.d.ts +14 -0
- package/dist/types/src/state/workspace.d.ts +3 -0
- package/package.json +41 -3
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagram appearance: five preset themes, color families with numeric shades, and the overrides a
|
|
3
|
+
* file can set. `resolveAppearance` turns a saved appearance into the concrete colors, spacing and
|
|
4
|
+
* type that sizing, the canvas and both SVG exports read, so all of them agree.
|
|
5
|
+
*
|
|
6
|
+
* Diagram appearance is separate from the editor's light or dark mode.
|
|
7
|
+
*/
|
|
8
|
+
import type { Footnote } from './footnote';
|
|
9
|
+
import type { Note } from './note';
|
|
10
|
+
import { type FontRole, type TypeProfile } from './fonts';
|
|
11
|
+
import type { FileConfig } from './link';
|
|
12
|
+
export type ThemeId = 'drafting' | 'fieldnotes' | 'signal' | 'ink' | 'blueprint';
|
|
13
|
+
export declare const THEME_IDS: ThemeId[];
|
|
14
|
+
export declare const DEFAULT_THEME: ThemeId;
|
|
15
|
+
/** Shade stops. Lower numbers are lighter and higher numbers darker, in every theme. */
|
|
16
|
+
export declare const SHADES: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
17
|
+
export type Shade = (typeof SHADES)[number];
|
|
18
|
+
export declare const isShade: (n: unknown) => n is Shade;
|
|
19
|
+
/** Shade of a node that names a color without a shade. */
|
|
20
|
+
export declare const NODE_SHADE: Shade;
|
|
21
|
+
/**
|
|
22
|
+
* Shade of a group that names a color without a shade. Groups are quiet surfaces behind nodes, so
|
|
23
|
+
* this is a pale shade in light themes and a deep one in dark themes; the scale itself never flips.
|
|
24
|
+
*/
|
|
25
|
+
export declare const groupShadeFor: (theme: ThemeId) => Shade;
|
|
26
|
+
/** Built-in color families, available in every theme. `primary` and `secondary` follow the theme. */
|
|
27
|
+
export declare const BUILT_IN_FAMILIES: readonly ["primary", "secondary", "slate", "stone", "blue", "sky", "teal", "mint", "green", "amber", "orange", "red", "rose", "violet"];
|
|
28
|
+
export declare const isBuiltInFamily: (name: string) => boolean;
|
|
29
|
+
export interface Swatch {
|
|
30
|
+
fill: string;
|
|
31
|
+
stroke: string;
|
|
32
|
+
ink: string;
|
|
33
|
+
}
|
|
34
|
+
/** A file's color declaration: one shade of a family. Built-in shades may set some fields only. */
|
|
35
|
+
export interface ColorDefinition {
|
|
36
|
+
family: string;
|
|
37
|
+
shade: Shade;
|
|
38
|
+
fill?: string;
|
|
39
|
+
stroke?: string;
|
|
40
|
+
ink?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface AppearanceOverrides {
|
|
43
|
+
paddingX?: number;
|
|
44
|
+
paddingY?: number;
|
|
45
|
+
radius?: number;
|
|
46
|
+
titleFont?: FontRole;
|
|
47
|
+
annotationFont?: FontRole;
|
|
48
|
+
canvas?: string;
|
|
49
|
+
text?: string;
|
|
50
|
+
connection?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface DiagramAppearance {
|
|
53
|
+
theme: ThemeId;
|
|
54
|
+
overrides: AppearanceOverrides;
|
|
55
|
+
colors: ColorDefinition[];
|
|
56
|
+
/** What the colors mean, from `legend` statements, drawn as a key beside the diagram. */
|
|
57
|
+
legend?: LegendEntry[];
|
|
58
|
+
/** Title and subtitle drawn above exported images, from `diagram` and `subtitle` statements. */
|
|
59
|
+
heading?: Heading;
|
|
60
|
+
/** Sentences drawn on the diagram without moving it, from `note` statements. */
|
|
61
|
+
notes?: Note[];
|
|
62
|
+
/** Entries of the block between the drawing and the key, from `footnote` statements. */
|
|
63
|
+
footnotes?: Footnote[];
|
|
64
|
+
/** Panel labels from a `compare` statement: draw the old and new versions side by side. */
|
|
65
|
+
compare?: {
|
|
66
|
+
/** Set by `draftably compare`: the changes the older panel draws in their new version. */
|
|
67
|
+
undrawn?: string;
|
|
68
|
+
before: string;
|
|
69
|
+
after: string;
|
|
70
|
+
/** `right` sets the panels side by side, `down` stacks them; chosen by `aspect` when unset. */
|
|
71
|
+
direction?: 'right' | 'down';
|
|
72
|
+
/** Width over height the whole image should come closest to; 1.6 when unset. */
|
|
73
|
+
aspect?: number;
|
|
74
|
+
};
|
|
75
|
+
/** File settings from `config` statements. */
|
|
76
|
+
config?: FileConfig;
|
|
77
|
+
/** Named emphasis states from `state` statements, in file order. */
|
|
78
|
+
states?: EmphasisState[];
|
|
79
|
+
}
|
|
80
|
+
/** One way to draw the diagram: these objects and connections in focus, the rest faded or plain. */
|
|
81
|
+
export interface EmphasisState {
|
|
82
|
+
id: string;
|
|
83
|
+
label: string;
|
|
84
|
+
/** Objects (a group brings its members) and connections in focus. */
|
|
85
|
+
ids: string[];
|
|
86
|
+
/** How everything else draws: faded like a context line, or as usual. */
|
|
87
|
+
rest: 'dim' | 'plain';
|
|
88
|
+
}
|
|
89
|
+
export interface Heading {
|
|
90
|
+
title?: string;
|
|
91
|
+
subtitle?: string;
|
|
92
|
+
/** Width of the frame round the drawing, from `diagram width=`; never narrower than its content. */
|
|
93
|
+
width?: number;
|
|
94
|
+
}
|
|
95
|
+
/** The connection styles a `legend line` row can explain. */
|
|
96
|
+
export declare const LEGEND_LINES: readonly ["dashed", "solid"];
|
|
97
|
+
export type LegendLine = (typeof LEGEND_LINES)[number];
|
|
98
|
+
/** One row of the key: a color swatch (`family`), or a short connection (`line`). */
|
|
99
|
+
export interface LegendEntry {
|
|
100
|
+
family?: string;
|
|
101
|
+
line?: LegendLine;
|
|
102
|
+
/** Shade of the swatch; nodes' default when omitted. */
|
|
103
|
+
shade?: Shade;
|
|
104
|
+
label: string;
|
|
105
|
+
}
|
|
106
|
+
export declare const defaultAppearance: () => DiagramAppearance;
|
|
107
|
+
/** Limits for numeric overrides, shared by the file parser and JSON validation. */
|
|
108
|
+
export declare const OVERRIDE_LIMITS: {
|
|
109
|
+
readonly paddingX: {
|
|
110
|
+
readonly min: 4;
|
|
111
|
+
readonly max: 48;
|
|
112
|
+
};
|
|
113
|
+
readonly paddingY: {
|
|
114
|
+
readonly min: 4;
|
|
115
|
+
readonly max: 48;
|
|
116
|
+
};
|
|
117
|
+
readonly radius: {
|
|
118
|
+
readonly min: 0;
|
|
119
|
+
readonly max: 24;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export declare const HEX_COLOR: RegExp;
|
|
123
|
+
interface Preset {
|
|
124
|
+
label: string;
|
|
125
|
+
description: string;
|
|
126
|
+
dark: boolean;
|
|
127
|
+
canvas: string;
|
|
128
|
+
text: string;
|
|
129
|
+
muted: string;
|
|
130
|
+
connection: string;
|
|
131
|
+
node: Swatch;
|
|
132
|
+
group: Swatch;
|
|
133
|
+
paddingX: number;
|
|
134
|
+
paddingY: number;
|
|
135
|
+
radius: number;
|
|
136
|
+
shadow: boolean;
|
|
137
|
+
titleFont: FontRole;
|
|
138
|
+
annotationFont: FontRole;
|
|
139
|
+
titleSize: number;
|
|
140
|
+
titleLine: number;
|
|
141
|
+
annotationSize: number;
|
|
142
|
+
/** Chroma multiplier for the built-in families: how saturated this theme's colors are. */
|
|
143
|
+
chroma: number;
|
|
144
|
+
/** Anchor colors for `primary` and `secondary`, at the shade they appear as. */
|
|
145
|
+
primary: [string, Shade];
|
|
146
|
+
secondary: [string, Shade];
|
|
147
|
+
/** Hue and chroma for built-in families this theme draws in its own way. */
|
|
148
|
+
hues?: Partial<Record<string, [number, number]>>;
|
|
149
|
+
}
|
|
150
|
+
export declare const PRESETS: Record<ThemeId, Preset>;
|
|
151
|
+
export declare function contrast(a: string, b: string): number;
|
|
152
|
+
/** Contrast targets (WCAG ratios) every generated color meets. */
|
|
153
|
+
export declare const CONTRAST: {
|
|
154
|
+
/** Dark title text on a pale fill. */
|
|
155
|
+
readonly paleInk: 7;
|
|
156
|
+
/** White title text on a dark fill. */
|
|
157
|
+
readonly darkInk: 4.5;
|
|
158
|
+
/** A shape's outline against the canvas when its fill alone does not separate it. */
|
|
159
|
+
readonly outline: 3;
|
|
160
|
+
/** Connection lines and connection label text against the canvas. */
|
|
161
|
+
readonly connection: 4.5;
|
|
162
|
+
/** A group's frame against the canvas. */
|
|
163
|
+
readonly frame: 2;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Move a color's lightness away from `against` until it reaches `min` contrast with it. Colors
|
|
167
|
+
* that already meet the target are returned unchanged.
|
|
168
|
+
*/
|
|
169
|
+
export declare function ensureContrast(color: string, against: string, min: number): string;
|
|
170
|
+
/** The built-in families of a preset on a canvas color, generated once. */
|
|
171
|
+
export declare function builtInFamilies(theme: ThemeId, canvas?: string): Map<string, Map<Shade, Swatch>>;
|
|
172
|
+
export interface ResolvedAppearance {
|
|
173
|
+
theme: ThemeId;
|
|
174
|
+
dark: boolean;
|
|
175
|
+
canvas: string;
|
|
176
|
+
text: string;
|
|
177
|
+
muted: string;
|
|
178
|
+
connection: string;
|
|
179
|
+
/** Default node and group colors when nothing names a family. */
|
|
180
|
+
node: Swatch;
|
|
181
|
+
group: Swatch;
|
|
182
|
+
paddingX: number;
|
|
183
|
+
paddingY: number;
|
|
184
|
+
radius: number;
|
|
185
|
+
shadow: boolean;
|
|
186
|
+
title: TypeProfile;
|
|
187
|
+
groupTitle: TypeProfile;
|
|
188
|
+
annotation: TypeProfile;
|
|
189
|
+
/** Space above a group's content; the group title sits in it. */
|
|
190
|
+
groupHeader: number;
|
|
191
|
+
/** Every family and the shades it defines: built-in ones plus the file's own. */
|
|
192
|
+
families: Map<string, Map<Shade, Swatch>>;
|
|
193
|
+
custom: Set<string>;
|
|
194
|
+
/** Strike a removed object's title through (`config strike-removed=on`). */
|
|
195
|
+
strikeRemoved: boolean;
|
|
196
|
+
}
|
|
197
|
+
/** Height of a group's title band, derived from the title's line height. */
|
|
198
|
+
export declare const groupHeaderFor: (lineHeight: number) => number;
|
|
199
|
+
/** Preset values, then file overrides. Omitted fields inherit from the preset. */
|
|
200
|
+
export declare function resolveAppearance(appearance?: DiagramAppearance): ResolvedAppearance;
|
|
201
|
+
/**
|
|
202
|
+
* Colors for an object. `family` is a family name, or `auto` for the theme's default surface; an
|
|
203
|
+
* omitted shade is 500 for nodes and 100 for groups. Unknown families or shades fall back to the
|
|
204
|
+
* default surface; the file parser reports them before they get here.
|
|
205
|
+
*/
|
|
206
|
+
export declare function swatchFor(r: ResolvedAppearance, family: string | undefined, shade: Shade | undefined, kind?: 'node' | 'group'): Swatch;
|
|
207
|
+
/** Shades a family defines, in numeric order. */
|
|
208
|
+
export declare const shadesOf: (r: ResolvedAppearance, family: string) => Shade[];
|
|
209
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { VisibleGraph } from './graph';
|
|
2
|
+
import type { Diagram, Point, Rect } from './types';
|
|
3
|
+
/** How far a connection's ink reaches past its points: half the stroke plus the arrowhead's wings. */
|
|
4
|
+
export declare const ROUTE_INK = 4;
|
|
5
|
+
export interface BoundedRoute {
|
|
6
|
+
id?: string;
|
|
7
|
+
points: readonly Point[];
|
|
8
|
+
label: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
w: number;
|
|
12
|
+
h: number;
|
|
13
|
+
} | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Bounds of everything drawn: shapes with their labels, containers, every route point with its
|
|
17
|
+
* stroke and arrowhead, and every connection label box. `pad` adds a margin on each side.
|
|
18
|
+
*/
|
|
19
|
+
export declare function drawingBounds(doc: Diagram, vg: VisibleGraph, rects: ReadonlyMap<string, Rect>, routes: readonly BoundedRoute[], pad?: number): Rect;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Rect } from './types';
|
|
2
|
+
/** A camera described by the world point at the viewport center and a zoom factor. */
|
|
3
|
+
export interface ViewCamera {
|
|
4
|
+
cx: number;
|
|
5
|
+
cy: number;
|
|
6
|
+
k: number;
|
|
7
|
+
}
|
|
8
|
+
/** Camera that fits `bounds` inside `viewport` with padding, or null for a hidden viewport. */
|
|
9
|
+
export declare function fitCamera(bounds: Rect, viewport: {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
} | undefined, padding?: number): ViewCamera | null;
|
|
13
|
+
/**
|
|
14
|
+
* The zoom factor for one wheel event. A mouse notch (about 100px) zooms by about 18%; a pinch,
|
|
15
|
+
* which arrives as small Ctrl + wheel deltas, keeps its faster rate. `unit` converts line and
|
|
16
|
+
* page deltas to pixels.
|
|
17
|
+
*/
|
|
18
|
+
export declare function wheelZoomFactor(e: {
|
|
19
|
+
deltaY: number;
|
|
20
|
+
ctrlKey: boolean;
|
|
21
|
+
}, unit?: number): number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colors an object is drawn in. A file names a family and maybe a shade; drawing adds one
|
|
3
|
+
* rule on top, so nesting stays readable without the author doing shade arithmetic:
|
|
4
|
+
*
|
|
5
|
+
* - A container inside a container of the same family steps one shade toward emphasis per level
|
|
6
|
+
* (lighter frames underneath, smaller and stronger ones on top), instead of repeating the fill.
|
|
7
|
+
* - A shape whose shade is within two steps of its container's, in the same family, moves three
|
|
8
|
+
* steps past the container, so a member never melts into its frame.
|
|
9
|
+
*
|
|
10
|
+
* The canvas, the CLI's SVG and exports all draw through `drawnSwatch`.
|
|
11
|
+
*/
|
|
12
|
+
import { type ResolvedAppearance, type Shade, type Swatch } from './appearance';
|
|
13
|
+
import type { Diagram } from './types';
|
|
14
|
+
/** The shade an object is drawn at, or undefined for the theme's neutral surface. */
|
|
15
|
+
export declare function drawnShade(doc: Diagram, look: ResolvedAppearance, id: string): Shade | undefined;
|
|
16
|
+
/** The swatch an object is drawn with. */
|
|
17
|
+
export declare function drawnSwatch(doc: Diagram, look: ResolvedAppearance, id: string, kind: 'node' | 'group'): Swatch;
|
|
18
|
+
/**
|
|
19
|
+
* A sequence participant's accent: the fill its color would have, drawn as a thin stripe along
|
|
20
|
+
* its top. Undefined for anything else, and for a participant with no color of its own.
|
|
21
|
+
*/
|
|
22
|
+
export declare function participantAccent(doc: Diagram, look: ResolvedAppearance, id: string): string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DiagramAppearance } from './appearance';
|
|
2
|
+
import type { Diagram, DiagramSettings } from './types';
|
|
3
|
+
export declare const MAX_NODES = 500;
|
|
4
|
+
export declare const MAX_EDGES = 1200;
|
|
5
|
+
export declare function uid(prefix?: string): string;
|
|
6
|
+
export declare const DEFAULT_SETTINGS: DiagramSettings;
|
|
7
|
+
export declare function emptyDiagram(title?: string): Diagram;
|
|
8
|
+
type Raw = any;
|
|
9
|
+
export declare const isLegacyDiagram: (input: Raw) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Validate a diagram from any source and return a complete, canonical copy.
|
|
12
|
+
* Throws a readable error for anything that cannot be repaired.
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalize(input: unknown): Diagram;
|
|
15
|
+
/** Validate a saved appearance. A missing appearance is the default theme. */
|
|
16
|
+
export declare function normalizeAppearance(input: Raw): DiagramAppearance;
|
|
17
|
+
/** The meaning of a document, ignoring where the camera happens to be. */
|
|
18
|
+
export declare function documentIdentity(doc: Diagram): string;
|
|
19
|
+
/**
|
|
20
|
+
* Inputs that affect connection routing. The editor store keeps the key order of the document it
|
|
21
|
+
* replaced, so the worker's freshly projected copy of the same document lists its keys differently.
|
|
22
|
+
*/
|
|
23
|
+
export declare function routingFingerprint(doc: Diagram): string;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { emptyDiagram } from './document';
|
|
2
|
+
import type { ContainerLayout, Diagram, DiagramEdge, DiagramGroup, DiagramNode, EdgeLayout, IntentPlacement, IntentRole, NodeLayout, NodeStyle, Point, PortSide, Rect, Side } from './types';
|
|
3
|
+
export declare function moveObject(doc: Diagram, id: string, dx: number, dy: number, manual?: boolean): void;
|
|
4
|
+
/** Bounds of a container's direct children, including shape labels. */
|
|
5
|
+
export declare function contentBounds(doc: Diagram, id: string): Rect | null;
|
|
6
|
+
export declare const containerPadding: (doc: Diagram, id: string) => number;
|
|
7
|
+
/** Size a container around its contents. Without `shrink`, the frame only grows. */
|
|
8
|
+
export declare function fitContainer(doc: Diagram, id: string, shrink?: boolean): void;
|
|
9
|
+
/** Grow every enclosing container so the object stays inside. */
|
|
10
|
+
export declare function ensureParentsFit(doc: Diagram, id: string): void;
|
|
11
|
+
/** The deepest, smallest visible container under the center of `rect`. */
|
|
12
|
+
export declare function dropTarget(doc: Diagram, id: string, rect: Rect, frames?: Map<string, Rect>): DiagramGroup | undefined;
|
|
13
|
+
export type ResizeHandle = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
|
|
14
|
+
/**
|
|
15
|
+
* Resize from a handle. Containers cannot shrink across their contents, and their children
|
|
16
|
+
* stay at the same world coordinates.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resizedRect(doc: Diagram, id: string, start: NodeLayout, dx: number, dy: number, handle: ResizeHandle, keepAspect?: boolean): NodeLayout;
|
|
19
|
+
export interface NewNode {
|
|
20
|
+
id?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
parentId?: string | null;
|
|
23
|
+
image?: string;
|
|
24
|
+
style?: Partial<NodeStyle>;
|
|
25
|
+
/** Top-left corner; defaults to centering the shape on `at`. */
|
|
26
|
+
position?: Point;
|
|
27
|
+
w?: number;
|
|
28
|
+
h?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function addNode(doc: Diagram, partial: NewNode, at: Point): string;
|
|
31
|
+
export interface NewEdge {
|
|
32
|
+
id?: string;
|
|
33
|
+
from: string;
|
|
34
|
+
to: string;
|
|
35
|
+
label?: string;
|
|
36
|
+
directed?: boolean;
|
|
37
|
+
emphasis?: boolean;
|
|
38
|
+
dashed?: boolean;
|
|
39
|
+
fromSide?: PortSide;
|
|
40
|
+
toSide?: PortSide;
|
|
41
|
+
}
|
|
42
|
+
export declare function addEdge(doc: Diagram, partial: NewEdge): string;
|
|
43
|
+
export interface ConnectedNode {
|
|
44
|
+
/** Connect from this shape. */
|
|
45
|
+
from?: string | null;
|
|
46
|
+
/** Create a sibling branch: connect from every source of this shape. */
|
|
47
|
+
siblingOf?: string | null;
|
|
48
|
+
side?: Side | null;
|
|
49
|
+
/** Center of the new shape; otherwise it is placed beside the reference shape. */
|
|
50
|
+
at?: Point | null;
|
|
51
|
+
title?: string;
|
|
52
|
+
/** Container for the new shape; `undefined` inherits the reference shape's container. */
|
|
53
|
+
parentId?: string | null;
|
|
54
|
+
style?: Partial<NodeStyle>;
|
|
55
|
+
}
|
|
56
|
+
/** Add a shape next to another one and connect it. `fallback` is used when nothing is referenced. */
|
|
57
|
+
export declare function addConnectedNode(doc: Diagram, options: ConnectedNode, fallback: Point): string;
|
|
58
|
+
/**
|
|
59
|
+
* Split a connection with a new shape. `routePoints` locates the longest segment
|
|
60
|
+
* when `at` is not given.
|
|
61
|
+
*/
|
|
62
|
+
export declare function insertStep(doc: Diagram, edgeId: string, routePoints: Point[] | undefined, at?: Point | null): string | undefined;
|
|
63
|
+
export type BuildMode = 'chain' | 'branches' | 'none';
|
|
64
|
+
export interface BuildOptions {
|
|
65
|
+
mode?: BuildMode;
|
|
66
|
+
/** Wrap the new shapes in a container with this title. */
|
|
67
|
+
title?: string;
|
|
68
|
+
/** Continue from this shape. */
|
|
69
|
+
source?: string | null;
|
|
70
|
+
parentId?: string | null;
|
|
71
|
+
/** Where to start when there is no source or container. */
|
|
72
|
+
origin: Point;
|
|
73
|
+
columns: number;
|
|
74
|
+
}
|
|
75
|
+
/** Create shapes from a list of titles. Returns the ids to select. */
|
|
76
|
+
export declare function buildFromList(doc: Diagram, lines: string[], options: BuildOptions): string[];
|
|
77
|
+
/** Delete objects. Containers release their contents unless `deep` is set. */
|
|
78
|
+
export declare function deleteObjects(doc: Diagram, selected: Iterable<string>, deep?: boolean): void;
|
|
79
|
+
export declare function createContainer(doc: Diagram, rect: Rect, { roots, parentId, title, fit, }?: {
|
|
80
|
+
roots?: string[];
|
|
81
|
+
parentId?: string | null;
|
|
82
|
+
title?: string;
|
|
83
|
+
fit?: boolean;
|
|
84
|
+
}): string;
|
|
85
|
+
/** Wrap the selected objects in a new container, or add an empty one at `fallback`. */
|
|
86
|
+
export declare function wrapInContainer(doc: Diagram, roots: string[], fallback: Point): string;
|
|
87
|
+
/** Draw a container: it adopts the objects it fully encloses inside the deepest enclosing container. */
|
|
88
|
+
export declare function drawContainer(doc: Diagram, r: Rect): string;
|
|
89
|
+
export declare function ungroup(doc: Diagram, selected: Iterable<string>): void;
|
|
90
|
+
export type AlignKind = 'left' | 'top' | 'center' | 'middle' | 'distribute-x' | 'distribute-y';
|
|
91
|
+
export declare function alignObjects(doc: Diagram, ids: string[], kind: AlignKind): void;
|
|
92
|
+
export declare function nudge(doc: Diagram, ids: string[], dx: number, dy: number): void;
|
|
93
|
+
export declare function toggleCollapsed(doc: Diagram, id: string): void;
|
|
94
|
+
export declare function setTitle(doc: Diagram, id: string, title: string): void;
|
|
95
|
+
export declare function setEdgeLabel(doc: Diagram, id: string, label: string): void;
|
|
96
|
+
export declare function setGeometry(doc: Diagram, id: string, key: 'x' | 'y' | 'w' | 'h', value: number): void;
|
|
97
|
+
export declare function setStyle(doc: Diagram, id: string, patch: Partial<NodeStyle>): void;
|
|
98
|
+
export declare function setLabelMode(doc: Diagram, id: string, mode: NonNullable<Diagram['layout']['labels'][string]['mode']>): void;
|
|
99
|
+
export declare function setParent(doc: Diagram, id: string, parentId: string | null): void;
|
|
100
|
+
export declare function setContainer(doc: Diagram, id: string, patch: Partial<ContainerLayout>): void;
|
|
101
|
+
export declare function setEdge(doc: Diagram, id: string, patch: Partial<Pick<DiagramEdge, 'directed' | 'dashed' | 'emphasis' | 'head' | 'tail'>>): void;
|
|
102
|
+
export declare function setEdgeLayout(doc: Diagram, id: string, patch: Partial<EdgeLayout>): void;
|
|
103
|
+
export declare function reverseEdge(doc: Diagram, id: string): void;
|
|
104
|
+
export declare function useAutomaticPorts(doc: Diagram, edgeIds: string[]): void;
|
|
105
|
+
/** True when the point is too close to a shape to hold a connection bend. */
|
|
106
|
+
export declare const bendInsideShape: (doc: Diagram, p: Point) => boolean;
|
|
107
|
+
export declare function addWaypoint(doc: Diagram, id: string, p: Point): void;
|
|
108
|
+
export declare function removeWaypoint(doc: Diagram, id: string, index: number): void;
|
|
109
|
+
export declare const INTENT_LABELS: Record<IntentPlacement, string>;
|
|
110
|
+
/** Placements offered for a role; only a start can sit in the center. */
|
|
111
|
+
export declare const intentPlacements: (role: IntentRole) => IntentPlacement[];
|
|
112
|
+
/** Mark a shape as the preferred start or end, or clear the role when `id` is null. */
|
|
113
|
+
export declare function setIntent(doc: Diagram, role: IntentRole, id: string | null, placement?: IntentPlacement): void;
|
|
114
|
+
export interface ClipboardFragment {
|
|
115
|
+
kind: 'diagram-studio/clipboard';
|
|
116
|
+
nodes: DiagramNode[];
|
|
117
|
+
groups: DiagramGroup[];
|
|
118
|
+
edges: DiagramEdge[];
|
|
119
|
+
layout: Partial<Record<'nodes' | 'edges' | 'labels' | 'containers', Record<string, unknown>>>;
|
|
120
|
+
styles: Record<string, NodeStyle>;
|
|
121
|
+
}
|
|
122
|
+
/** Copy the selection, including container contents and connections between copied shapes. */
|
|
123
|
+
export declare function copyFragment(doc: Diagram, selected: Iterable<string>): ClipboardFragment;
|
|
124
|
+
export declare const isClipboardFragment: (value: unknown) => value is ClipboardFragment;
|
|
125
|
+
/**
|
|
126
|
+
* Return a validated document with the fragment pasted at an offset, plus the new ids to select.
|
|
127
|
+
* The fragment is untrusted, so the whole result goes through `normalize`.
|
|
128
|
+
*/
|
|
129
|
+
export declare function pasteFragment(doc: Diagram, part: ClipboardFragment): {
|
|
130
|
+
doc: Diagram;
|
|
131
|
+
selected: string[];
|
|
132
|
+
};
|
|
133
|
+
export { emptyDiagram };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const SOURCE_KEYWORD = "draftably";
|
|
2
|
+
export declare const VERSION_KEYWORD = "draftably-version";
|
|
3
|
+
export declare const DRAFTABLY_VERSION: string;
|
|
4
|
+
/** The PNG with `source` in a `draftably` chunk before its end, replacing any earlier one. */
|
|
5
|
+
export declare function embedPngSource(png: Uint8Array, source: string): Promise<Uint8Array>;
|
|
6
|
+
/** The source in a PNG's `draftably` chunk, or null when it has none. */
|
|
7
|
+
export declare function readPngSource(png: Uint8Array): Promise<string | null>;
|
|
8
|
+
/** The `<metadata>` element that carries `source` in an SVG. */
|
|
9
|
+
export declare const svgSourceElement: (source: string) => string;
|
|
10
|
+
/** The SVG with `source` in a metadata element just inside its root. */
|
|
11
|
+
export declare const embedSvgSource: (svg: string, source: string) => string;
|
|
12
|
+
/** The source in an SVG's `draftably-source` metadata, or null when it has none. */
|
|
13
|
+
export declare function readSvgSource(svg: string): string | null;
|
|
14
|
+
/** The source embedded in PNG or SVG bytes, or null when there is none. */
|
|
15
|
+
export declare function readImageSource(bytes: Uint8Array): Promise<string | null>;
|
|
16
|
+
/** True for a file name the CLI and viewer read source out of. */
|
|
17
|
+
export declare const isImageName: (name: string) => boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** SHA-256 prefix of the metric table and its four WOFF2 files, in declared face order. */
|
|
2
|
+
export declare const fontMetricsVersion = "269b2d3580f4";
|
|
3
|
+
export declare const FACES: {
|
|
4
|
+
'sans-500': {
|
|
5
|
+
family: string;
|
|
6
|
+
weight: number;
|
|
7
|
+
file: string;
|
|
8
|
+
};
|
|
9
|
+
'sans-600': {
|
|
10
|
+
family: string;
|
|
11
|
+
weight: number;
|
|
12
|
+
file: string;
|
|
13
|
+
};
|
|
14
|
+
'serif-600': {
|
|
15
|
+
family: string;
|
|
16
|
+
weight: number;
|
|
17
|
+
file: string;
|
|
18
|
+
};
|
|
19
|
+
'mono-500': {
|
|
20
|
+
family: string;
|
|
21
|
+
weight: number;
|
|
22
|
+
file: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type FontRole = 'sans' | 'serif' | 'mono';
|
|
2
|
+
export declare const FONT_ROLES: FontRole[];
|
|
3
|
+
export interface FontFace {
|
|
4
|
+
/** Registered family name; unique so an installed copy of the font is never used instead. */
|
|
5
|
+
family: string;
|
|
6
|
+
weight: number;
|
|
7
|
+
file: string;
|
|
8
|
+
}
|
|
9
|
+
export { FACES } from './font-faces';
|
|
10
|
+
import { FACES } from './font-faces';
|
|
11
|
+
export type FaceId = keyof typeof FACES;
|
|
12
|
+
/** Face used for each role: titles are a little heavier than annotations in sans-serif. */
|
|
13
|
+
export declare const faceFor: (role: FontRole, title: boolean) => FaceId;
|
|
14
|
+
export declare const fontStack: (role: FontRole) => string;
|
|
15
|
+
/** A text style: which face, at what size and line height. */
|
|
16
|
+
export interface TypeProfile {
|
|
17
|
+
role: FontRole;
|
|
18
|
+
face: FaceId;
|
|
19
|
+
family: string;
|
|
20
|
+
weight: number;
|
|
21
|
+
size: number;
|
|
22
|
+
lineHeight: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function typeProfile(role: FontRole, title: boolean, size: number, lineHeight: number): TypeProfile;
|
|
25
|
+
/**
|
|
26
|
+
* Width of `text` in `profile`, from the stored advance widths. Kerning is ignored, which only
|
|
27
|
+
* ever overstates a width slightly, so measured text fits where this says it fits.
|
|
28
|
+
*/
|
|
29
|
+
export declare function measureText(text: string, profile: Pick<TypeProfile, 'face' | 'size'>): number;
|
|
30
|
+
/**
|
|
31
|
+
* The pieces an identifier reads in, so a long one can break where a reader would: after a
|
|
32
|
+
* separator (`/`, `.`, `_`, `-`, `:`) or between a lower-case letter or digit and a capital
|
|
33
|
+
* (camelCase). `annotationCommands` → `annotation`, `Commands`; `src/viz/Treemap.tsx` → `src/`,
|
|
34
|
+
* `viz/`, `Treemap.tsx`. A word with none of these is one piece.
|
|
35
|
+
*/
|
|
36
|
+
export declare function wordPieces(word: string): string[];
|
|
37
|
+
/** Width of the widest piece of any word in `text`: the narrowest line it wraps into whole. */
|
|
38
|
+
export declare function widestPiece(text: string, profile: Pick<TypeProfile, 'face' | 'size'>): number;
|
|
39
|
+
/**
|
|
40
|
+
* Break text into lines no wider than `width`, starting a new line at each `\n`. A word longer
|
|
41
|
+
* than a line breaks between its pieces (`wordPieces`), and only a piece that is itself too long
|
|
42
|
+
* breaks by character. With `balance`, a paragraph that wraps keeps its line count but its lines
|
|
43
|
+
* run near equal (`even`), so no word sits alone on the last line when a better break exists.
|
|
44
|
+
*/
|
|
45
|
+
export declare function wrapLines(text: string, width: number, profile: TypeProfile, balance?: boolean): string[];
|
|
46
|
+
/** Shorten text with an ellipsis so it fits in `width`. */
|
|
47
|
+
export declare function truncateText(text: string, width: number, profile: TypeProfile): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footnotes: a block of short entries between the drawing and the key, from `footnote`
|
|
3
|
+
* statements, in file order, at body text size and wrapped to the frame. An entry may carry a
|
|
4
|
+
* marker (`1`, `a`, `*`) that a label can point at, and links in `[label](href)` form. The viewer,
|
|
5
|
+
* `inspect --svg`, PDF and the editor's exports all lay it out here.
|
|
6
|
+
*/
|
|
7
|
+
import { type ResolvedAppearance } from './appearance';
|
|
8
|
+
import { type Run } from './rich-text';
|
|
9
|
+
export interface Footnote {
|
|
10
|
+
text: string;
|
|
11
|
+
/** A short marker drawn before the entry, which labels can point at as `[1]`. */
|
|
12
|
+
mark?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The block's entries, wrapped to `width`, with their offsets from its top-left corner. */
|
|
15
|
+
export declare function footnoteSize(look: ResolvedAppearance, notes: readonly Footnote[], width: number): {
|
|
16
|
+
type: import("./fonts").TypeProfile;
|
|
17
|
+
gutter: number;
|
|
18
|
+
items: {
|
|
19
|
+
note: Footnote;
|
|
20
|
+
lines: Run[][];
|
|
21
|
+
y: number;
|
|
22
|
+
}[];
|
|
23
|
+
h: number;
|
|
24
|
+
};
|
|
25
|
+
export type FootnoteLayout = ReturnType<typeof footnoteSize>;
|
|
26
|
+
/** Where each line of every entry is drawn, from the block's top-left corner at (x, y). */
|
|
27
|
+
export declare function footnoteLines(layout: FootnoteLayout, x: number, y: number): {
|
|
28
|
+
entry: number;
|
|
29
|
+
runs: Run[];
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}[];
|
|
33
|
+
/** SVG markup for the block: a short rule, then each entry's marker and wrapped text. */
|
|
34
|
+
export declare function footnoteMarkup(look: ResolvedAppearance, layout: FootnoteLayout, x: number, y: number, write?: (href: string) => string | null): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frame round a diagram: the heading above the drawing and the key under it. `inspect --svg`,
|
|
3
|
+
* the editor's exports and the viewer canvas all place them from here, so what the viewer shows is
|
|
4
|
+
* what an export draws.
|
|
5
|
+
*/
|
|
6
|
+
import type { Heading, LegendEntry, ResolvedAppearance } from './appearance';
|
|
7
|
+
import { type Footnote } from './footnote';
|
|
8
|
+
import type { PlacedNote } from './note';
|
|
9
|
+
import type { Rect } from './types';
|
|
10
|
+
import type { StatusCount } from './status';
|
|
11
|
+
/** Space between the frame's edge and the drawing; the heading and the key align to it. */
|
|
12
|
+
export declare const FRAME_PAD = 40;
|
|
13
|
+
/** Narrowest frame a `diagram width=` line or a drag can set. */
|
|
14
|
+
export declare const MIN_FRAME_WIDTH = 160;
|
|
15
|
+
/**
|
|
16
|
+
* Lay out the frame round `area`, the drawing with `FRAME_PAD` already round it. The heading sits
|
|
17
|
+
* above the area and the key at its bottom, both left-aligned with the drawing; footnotes sit
|
|
18
|
+
* between the drawing and the key, wrapped to the frame. Frame notes stack
|
|
19
|
+
* under the heading, and the area grows to hold anchored notes (`placeNotes`). The frame is at
|
|
20
|
+
* least as wide as the heading, the notes, the key and the heading's `width`; extra width goes to
|
|
21
|
+
* the right.
|
|
22
|
+
*/
|
|
23
|
+
export declare function diagramFrame(look: ResolvedAppearance, heading: Heading | undefined, legend: LegendEntry[], statuses: StatusCount[], drawing: Rect, notes?: readonly PlacedNote[], footnotes?: readonly Footnote[]): {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
w: number;
|
|
27
|
+
h: number;
|
|
28
|
+
/** Width without the heading's `width`, which a drag never narrows past. */
|
|
29
|
+
natural: number;
|
|
30
|
+
head: {
|
|
31
|
+
w: number;
|
|
32
|
+
h: number;
|
|
33
|
+
};
|
|
34
|
+
key: {
|
|
35
|
+
w: number;
|
|
36
|
+
h: number;
|
|
37
|
+
row: number;
|
|
38
|
+
items: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
legend?: LegendEntry;
|
|
42
|
+
status?: StatusCount;
|
|
43
|
+
label: string;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
heading: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
wrap: number;
|
|
50
|
+
};
|
|
51
|
+
legend: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
};
|
|
55
|
+
/** The footnote block's top-left corner and layout. */
|
|
56
|
+
foot: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
type: import("./fonts").TypeProfile;
|
|
60
|
+
gutter: number;
|
|
61
|
+
items: {
|
|
62
|
+
note: Footnote;
|
|
63
|
+
lines: import("./rich-text").Run[][];
|
|
64
|
+
y: number;
|
|
65
|
+
}[];
|
|
66
|
+
h: number;
|
|
67
|
+
};
|
|
68
|
+
/** Every note, placed. */
|
|
69
|
+
notes: PlacedNote[];
|
|
70
|
+
};
|
|
71
|
+
export type DiagramFrame = ReturnType<typeof diagramFrame>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Point, Rect } from './types';
|
|
2
|
+
export declare const clamp: (n: number, min: number, max: number) => number;
|
|
3
|
+
export declare const finite: (n: unknown) => n is number;
|
|
4
|
+
/** Document coordinates are stored with one decimal place. */
|
|
5
|
+
export declare const rounded: (n: number) => number;
|
|
6
|
+
export declare const center: (r: Rect) => Point;
|
|
7
|
+
export declare const manhattan: (a: Point, b: Point) => number;
|
|
8
|
+
export declare const inside: (p: Point, r: Rect, pad?: number) => boolean;
|
|
9
|
+
export declare const contains: (outer: Rect, inner: Rect) => boolean;
|
|
10
|
+
export declare const overlaps: (a: Rect, b: Rect, pad?: number) => boolean;
|
|
11
|
+
/** Bounding box of the given rectangles, or a placeholder area when there are none. */
|
|
12
|
+
export declare function rectUnion(rects: readonly Rect[], pad?: number): Rect;
|
|
13
|
+
/** Rectangle spanned by two corner points. */
|
|
14
|
+
export declare const rectFromPoints: (a: Point, b: Point) => Rect;
|
|
15
|
+
export type Segment = [Point, Point];
|
|
16
|
+
export declare const segments: (points: readonly Point[]) => Segment[];
|
|
17
|
+
export declare const shrink: (r: Rect, d: number) => Rect;
|
|
18
|
+
/** Overlap of two rectangles larger than half a pixel on both axes. */
|
|
19
|
+
export declare const covers: (a: Rect, b: Rect) => boolean;
|
|
20
|
+
/** Length of a segment inside a rectangle (Liang–Barsky clipping). */
|
|
21
|
+
export declare function segmentInside([a, b]: Segment, r: Rect): number;
|
|
22
|
+
/** SVG path for an orthogonal polyline with rounded corners. */
|
|
23
|
+
export declare function roundedPath(points: readonly Point[], radius: number): string;
|
|
24
|
+
export declare const clone: <T>(value: T) => T;
|
|
25
|
+
/**
|
|
26
|
+
* A rectangle whose left and right sides are zigzags, for a field of variable length: the reader
|
|
27
|
+
* sees it continue past what is drawn.
|
|
28
|
+
*/
|
|
29
|
+
export declare function brokenRectPath(r: Rect, step?: number, depth?: number): string;
|