@weasel-js/plot 0.0.0-stage → 1.15.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.
@@ -0,0 +1,1457 @@
1
+ import { P as PlotDatum, a as PlotMark, b as PlotPoint, S as Scale, L as LinearScale, T as TimeScale, B as BandScale, c as PolarScale, d as PlotMarkData, e as PlotMarkTrait, f as PlotBox } from './scales.entry-BoLQpsxi.js';
2
+ export { g as BandScaleOptions, C as ContinuousScale, h as ContinuousScaleFactory, i as LinearScaleOptions, j as LogScale, k as LogScaleOptions, M as MarkKind, O as OrdinalScale, l as OrdinalScaleOptions, m as PolarScaleOptions, n as SolidFill, o as SolidStroke, p as SpacedTickOptions, q as TickFormatCtx, r as TickFormatter, s as TickSet, t as TimeScaleOptions, u as bandScale, v as decimalsOf, w as formatInstant, x as formatNumber, y as formatTick, z as linearScale, A as logScale, D as niceDomain, E as niceStep, F as ordinalScale, G as polarScale, H as stepTicks, I as tickDecimals, J as tickStep, K as timeScale } from './scales.entry-BoLQpsxi.js';
3
+ import { ResolvedTheme } from '@weasel-js/theme';
4
+ import { AddNodeSpec, RectPose, Scene, NodeId, InvocationCtx, Action, SceneCanvasTextEditor, RenderLayer, Contribution, Paint } from '@weasel-js/core';
5
+ import { ReactElement } from 'react';
6
+ import '@weasel-js/geom';
7
+
8
+ /** Options for {@link barMark}. */
9
+ interface BarMarkOptions {
10
+ key: string;
11
+ /** Where the bar stands along the category axis: its left edge, or its top for a horizontal bar. */
12
+ x: number;
13
+ /** The bar's breadth across the category axis. */
14
+ width: number;
15
+ /** The baseline the bar rises from, and the end it reaches, along the value axis. */
16
+ from: number;
17
+ to: number;
18
+ color: string;
19
+ datum?: PlotDatum;
20
+ /** Default `'vertical'`: `x` and `width` run along x. */
21
+ orient?: 'vertical' | 'horizontal';
22
+ }
23
+ /** A bar from `from` to `to`, either way round. */
24
+ declare function barMark(opts: BarMarkOptions): PlotMark;
25
+ /** Options for {@link spanMark}. */
26
+ interface SpanMarkOptions {
27
+ key: string;
28
+ /** Start and end along x. */
29
+ x0: number;
30
+ x1: number;
31
+ /** Its row: top and height. */
32
+ y: number;
33
+ height: number;
34
+ color: string;
35
+ opacity?: number;
36
+ datum?: PlotDatum;
37
+ }
38
+ /** A span across x, as a task's bar on a timeline is. */
39
+ declare function spanMark(opts: SpanMarkOptions): PlotMark;
40
+ /** Options for {@link pointMark}. */
41
+ interface PointMarkOptions {
42
+ key: string;
43
+ x: number;
44
+ y: number;
45
+ /** Default 3. */
46
+ radius?: number;
47
+ color: string;
48
+ datum?: PlotDatum;
49
+ }
50
+ /** A dot centered on `x`, `y`. */
51
+ declare function pointMark(opts: PointMarkOptions): PlotMark;
52
+
53
+ /** Options for {@link lineMark}. */
54
+ interface LineMarkOptions {
55
+ key: string;
56
+ /** At least one. */
57
+ points: readonly PlotPoint[];
58
+ color: string;
59
+ /** Default 2. */
60
+ width?: number;
61
+ dash?: number[];
62
+ datum?: PlotDatum;
63
+ }
64
+ /** A line through `points`, in order. */
65
+ declare function lineMark(opts: LineMarkOptions): PlotMark;
66
+ /** Options for {@link ruleMark}. */
67
+ interface RuleMarkOptions {
68
+ key: string;
69
+ from: PlotPoint;
70
+ to: PlotPoint;
71
+ color: string;
72
+ /** Default 1. */
73
+ width?: number;
74
+ dash?: number[];
75
+ datum?: PlotDatum;
76
+ }
77
+ /** A straight rule from `from` to `to`: an axis line, a tick, a grid line, a marker. */
78
+ declare function ruleMark(opts: RuleMarkOptions): PlotMark;
79
+ /** Options for {@link areaMark}. */
80
+ interface AreaMarkOptions {
81
+ key: string;
82
+ /** The upper edge, in order. */
83
+ top: readonly PlotPoint[];
84
+ /** The lower edge, in the same order as `top`. Default a baseline at `baseline` under each top point. */
85
+ bottom?: readonly PlotPoint[];
86
+ baseline?: number;
87
+ color: string;
88
+ /** Default 0.35. */
89
+ opacity?: number;
90
+ datum?: PlotDatum;
91
+ }
92
+ /** The region between two edges, as an area chart or a radar's polygon fills it. */
93
+ declare function areaMark(opts: AreaMarkOptions): PlotMark;
94
+ /** Options for {@link arcMark}. */
95
+ interface ArcMarkOptions {
96
+ key: string;
97
+ center: PlotPoint;
98
+ /** 0 for a pie slice. */
99
+ innerRadius: number;
100
+ outerRadius: number;
101
+ /** Radians clockwise from twelve o'clock. */
102
+ startAngle: number;
103
+ endAngle: number;
104
+ color: string;
105
+ datum?: PlotDatum;
106
+ }
107
+ /** A slice of a ring, as a pie or a donut is cut. */
108
+ declare function arcMark(opts: ArcMarkOptions): PlotMark;
109
+ /** Options for {@link ribbonMark}. */
110
+ interface RibbonMarkOptions {
111
+ key: string;
112
+ /** The end it leaves: an x, and the span along y it leaves across. */
113
+ from: {
114
+ x: number;
115
+ y0: number;
116
+ y1: number;
117
+ };
118
+ to: {
119
+ x: number;
120
+ y0: number;
121
+ y1: number;
122
+ };
123
+ color: string;
124
+ /** Default 0.45. */
125
+ opacity?: number;
126
+ datum?: PlotDatum;
127
+ }
128
+ /** A band curving from one span to another, as a flow between two nodes is drawn. */
129
+ declare function ribbonMark(opts: RibbonMarkOptions): PlotMark;
130
+
131
+ /** The face a chart's text is set in. */
132
+ interface PlotFont {
133
+ fontFamily: string;
134
+ fontSize: number;
135
+ }
136
+ /** The colors a chart is drawn in, by role, and its face. Plain strings, so a scene can keep it. */
137
+ interface PlotTheme {
138
+ /** Titles, labels and values. */
139
+ text: string;
140
+ /** Axis rules and ticks. */
141
+ axis: string;
142
+ /** Grid lines behind the marks. */
143
+ grid: string;
144
+ /** The colors series take in turn. Never empty. */
145
+ series: readonly string[];
146
+ font: PlotFont;
147
+ }
148
+ /** A plot theme from a resolved weasel theme: text in `fg`, axes in `border-strong`, grid in `border`, series in
149
+ * its swatches. */
150
+ declare function plotThemeFrom(resolved: Readonly<Record<string, string>> | ResolvedTheme, font?: PlotFont): PlotTheme;
151
+ /** 12px sans-serif. */
152
+ declare const PLOT_FONT: PlotFont;
153
+ /** The weasel theme in its dark mode. */
154
+ declare const PLOT_THEME: PlotTheme;
155
+ /** The `i`th series' color, wrapping. */
156
+ declare const seriesColor: (theme: PlotTheme, i: number) => string;
157
+
158
+ /** How wide and tall one line of text is set in `font`. */
159
+ type PlotMeasure = (text: string, font: PlotFont) => {
160
+ width: number;
161
+ height: number;
162
+ };
163
+ /** Measures as the kit's text renderer lays text out, from the registered face's metrics; a line is 1.2 sizes tall. */
164
+ declare const textMeasure: PlotMeasure;
165
+
166
+ /** Marks drawn as text: titles, tick labels, values. */
167
+
168
+ /** Options for {@link textMark}. */
169
+ interface TextMarkOptions {
170
+ key: string;
171
+ text: string;
172
+ /** The anchor point. */
173
+ x: number;
174
+ y: number;
175
+ /** Which part of the text stands on `x`. Default `'middle'`. */
176
+ anchor?: 'start' | 'middle' | 'end';
177
+ /** Which part of the text stands on `y`. Default `'middle'`. */
178
+ baseline?: 'top' | 'middle' | 'bottom';
179
+ font: PlotFont;
180
+ color: string;
181
+ measure: PlotMeasure;
182
+ /** Turns the text a quarter turn counterclockwise about the anchor, as a vertical axis's title reads. */
183
+ vertical?: boolean;
184
+ bold?: boolean;
185
+ datum?: PlotDatum;
186
+ }
187
+ /** One line of text, its box measured with `measure` and placed by its anchor. */
188
+ declare function textMark(opts: TextMarkOptions): PlotMark;
189
+
190
+ /** Which side of the plot an axis runs along. Its scale's range runs along x for top and bottom, along y otherwise. */
191
+ type AxisSide = 'top' | 'bottom' | 'left' | 'right';
192
+ /** Options for {@link axisMarks} and {@link axisRoom}. */
193
+ interface AxisOptions<T> {
194
+ scale: Scale<T>;
195
+ side: AxisSide;
196
+ /** Where the axis line stands across its scale: a y for top and bottom, an x for left and right. */
197
+ at: number;
198
+ /** Draw a grid line at each tick, from the axis across to here. */
199
+ gridTo?: number;
200
+ title?: string;
201
+ /** How many ticks to ask the scale for. */
202
+ ticks?: number;
203
+ /** Prefixes every mark's key. Default `axis:<side>`. */
204
+ key?: string;
205
+ theme: PlotTheme;
206
+ measure: PlotMeasure;
207
+ }
208
+ /** How far an axis reaches out from its line: ticks, labels and title. */
209
+ declare function axisRoom<T>(opts: AxisOptions<T>): number;
210
+ /** Every mark one axis is drawn with. Keys: `<key>:rule`, `<key>:tick:<i>`, `<key>:label:<i>`, `<key>:grid:<i>`, `<key>:title`. */
211
+ declare function axisMarks<T>(opts: AxisOptions<T>): PlotMark[];
212
+
213
+ /** A tag on a task: finished, under way, on the critical path, or a milestone drawn as a diamond at its start. */
214
+ type GanttTag = 'done' | 'active' | 'crit' | 'milestone';
215
+ /** Where a task starts: a date written in the chart's `dateFormat`, when the last of some tasks ends, or (absent
216
+ * both) when the task before it ends. */
217
+ type GanttStart = {
218
+ kind: 'date';
219
+ date: string;
220
+ } | {
221
+ kind: 'after';
222
+ ids: readonly string[];
223
+ } | {
224
+ kind: 'previous';
225
+ };
226
+ /** A unit a duration counts in: milliseconds to weeks, or calendar months and years. */
227
+ type GanttUnit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y';
228
+ /** Where a task ends: a date in the chart's `dateFormat`, a length from its start (days skip excluded days), or
229
+ * when the first of some tasks starts. */
230
+ type GanttEnd = {
231
+ kind: 'date';
232
+ date: string;
233
+ } | {
234
+ kind: 'duration';
235
+ amount: number;
236
+ unit: GanttUnit;
237
+ } | {
238
+ kind: 'until';
239
+ ids: readonly string[];
240
+ };
241
+ /** One task. Its start and end are stored as written, so a task after another moves with it. */
242
+ interface GanttTask {
243
+ name: string;
244
+ /** What `after` and `until` name it by. */
245
+ id?: string;
246
+ tags?: readonly GanttTag[];
247
+ start: GanttStart;
248
+ end: GanttEnd;
249
+ }
250
+ /** A run of tasks under one heading; the first may have none, holding the tasks before any `section`. */
251
+ interface GanttSection {
252
+ name?: string;
253
+ tasks: readonly GanttTask[];
254
+ }
255
+ /** A Gantt chart: tasks in sections, laid on a time axis. */
256
+ interface GanttData {
257
+ kind: 'gantt';
258
+ title?: string;
259
+ /** How dates are written, in Day.js tokens. Default `'YYYY-MM-DD'`. */
260
+ dateFormat?: string;
261
+ /** How the axis writes dates, in strftime tokens (`%Y-%m-%d`). Default the time scale's own. */
262
+ axisFormat?: string;
263
+ /** Days a duration in days skips: `'weekends'`, a weekday name (`'sunday'`), or a date in `dateFormat`. */
264
+ excludes?: readonly string[];
265
+ /** `'off'` hides the line at today; anything else is its style, as written. Default a line at today. */
266
+ todayMarker?: string;
267
+ sections: readonly GanttSection[];
268
+ }
269
+
270
+ /** How a commit is drawn: a plain dot, a crossed one for a revert, a square to stand out. */
271
+ type GitCommitType = 'NORMAL' | 'REVERSE' | 'HIGHLIGHT';
272
+ /** One line of a git graph, in the order it runs. */
273
+ type GitCommand = {
274
+ kind: 'commit';
275
+ id?: string;
276
+ type?: GitCommitType;
277
+ tag?: string;
278
+ message?: string;
279
+ } | {
280
+ kind: 'branch';
281
+ name: string;
282
+ order?: number;
283
+ } | {
284
+ kind: 'checkout';
285
+ name: string;
286
+ } | {
287
+ kind: 'merge';
288
+ branch: string;
289
+ id?: string;
290
+ type?: GitCommitType;
291
+ tag?: string;
292
+ } | {
293
+ kind: 'cherry-pick';
294
+ id: string;
295
+ tag?: string;
296
+ parent?: string;
297
+ };
298
+ /** A git graph: the commands that build its history, replayed to lay out a lane per branch. */
299
+ interface GitGraphData {
300
+ kind: 'gitgraph';
301
+ title?: string;
302
+ /** Default `'LR'`: commits run left to right, branches stack downward. */
303
+ orientation?: 'LR' | 'TB' | 'BT';
304
+ /** Default `'main'`. */
305
+ mainBranch?: string;
306
+ commands: readonly GitCommand[];
307
+ }
308
+
309
+ /** One step of a journey: how it went, 1 to 5, and who took part. */
310
+ interface JourneyTask {
311
+ name: string;
312
+ /** A whole number, 1 to 5. */
313
+ score: number;
314
+ actors: readonly string[];
315
+ }
316
+ /** A run of steps under one heading; the first may have none, holding the steps before any `section`. */
317
+ interface JourneySection {
318
+ name?: string;
319
+ tasks: readonly JourneyTask[];
320
+ }
321
+ /** A user journey: steps left to right in sections, each scored 1 to 5. */
322
+ interface JourneyData {
323
+ kind: 'journey';
324
+ title?: string;
325
+ sections: readonly JourneySection[];
326
+ }
327
+
328
+ /** One field: bits `start` to `end`, inclusive. */
329
+ interface PacketField {
330
+ start: number;
331
+ end: number;
332
+ label: string;
333
+ /** Written as a bit count (`+8`) after the field before it, rather than as a range. */
334
+ relative?: boolean;
335
+ }
336
+ /** A packet diagram: fields laid along rows of bits. */
337
+ interface PacketData {
338
+ kind: 'packet';
339
+ title?: string;
340
+ /** Default 32. */
341
+ bitsPerRow?: number;
342
+ fields: readonly PacketField[];
343
+ }
344
+
345
+ /** One slice: its label and value. */
346
+ interface PieSlice {
347
+ label: string;
348
+ value: number;
349
+ }
350
+ /** A pie chart: a slice per value, in order clockwise from twelve o'clock, with a legend. */
351
+ interface PieData {
352
+ kind: 'pie';
353
+ title?: string;
354
+ /** Write each slice's value in the legend, where a text edit can change it. */
355
+ showData?: boolean;
356
+ slices: readonly PieSlice[];
357
+ }
358
+
359
+ /** How a point is drawn. Any field absent takes the class's, then the theme's. */
360
+ interface QuadrantPointStyle {
361
+ radius?: number;
362
+ color?: string;
363
+ strokeColor?: string;
364
+ /** In pixels. */
365
+ strokeWidth?: number;
366
+ }
367
+ /** One point, at `x` and `y` from 0 to 1. */
368
+ interface QuadrantPoint {
369
+ name: string;
370
+ x: number;
371
+ y: number;
372
+ /** A key into the chart's `classes`. */
373
+ className?: string;
374
+ style?: QuadrantPointStyle;
375
+ }
376
+ /** An axis's two ends' labels. */
377
+ interface QuadrantAxis {
378
+ low?: string;
379
+ high?: string;
380
+ }
381
+ /** A quadrant chart: points in the unit square, cut into four labeled quadrants. */
382
+ interface QuadrantData {
383
+ kind: 'quadrant';
384
+ title?: string;
385
+ x?: QuadrantAxis;
386
+ y?: QuadrantAxis;
387
+ /** Quadrant labels, in Mermaid's order: top right, top left, bottom left, bottom right. */
388
+ quadrants?: readonly [string?, string?, string?, string?];
389
+ points: readonly QuadrantPoint[];
390
+ /** Named point styles. */
391
+ classes?: Readonly<Record<string, QuadrantPointStyle>>;
392
+ }
393
+
394
+ /** One spoke of a radar chart. */
395
+ interface RadarAxis {
396
+ id: string;
397
+ /** Default its id. */
398
+ label?: string;
399
+ }
400
+ /** One curve: a value on each axis, in axis order. */
401
+ interface RadarCurve {
402
+ id: string;
403
+ /** Default its id. */
404
+ label?: string;
405
+ values: readonly number[];
406
+ }
407
+ /** A radar chart: curves drawn as areas over spokes from a center. */
408
+ interface RadarData {
409
+ kind: 'radar';
410
+ title?: string;
411
+ axes: readonly RadarAxis[];
412
+ curves: readonly RadarCurve[];
413
+ /** The value at the center. Default 0. */
414
+ min?: number;
415
+ /** The value at the rim. Default the largest value. */
416
+ max?: number;
417
+ /** Default `'circle'`. */
418
+ graticule?: 'circle' | 'polygon';
419
+ /** How many rings the graticule has. Default 5. */
420
+ ticks?: number;
421
+ /** Default true. */
422
+ showLegend?: boolean;
423
+ }
424
+
425
+ /** A flow of `value` from one node to another, named by their labels. */
426
+ interface SankeyLink {
427
+ source: string;
428
+ target: string;
429
+ value: number;
430
+ }
431
+ /** A sankey diagram: nodes in columns by depth, joined by ribbons as thick as their flow. */
432
+ interface SankeyData {
433
+ kind: 'sankey';
434
+ title?: string;
435
+ links: readonly SankeyLink[];
436
+ }
437
+
438
+ /** One period on a timeline, and what happened in it. */
439
+ interface TimelinePeriod {
440
+ label: string;
441
+ events: readonly string[];
442
+ }
443
+ /** A run of periods under one heading; the first may have none, holding the periods before any `section`. */
444
+ interface TimelineSection {
445
+ name?: string;
446
+ periods: readonly TimelinePeriod[];
447
+ }
448
+ /** A timeline: periods left to right, each with its events stacked under it. */
449
+ interface TimelineData {
450
+ kind: 'timeline';
451
+ title?: string;
452
+ sections: readonly TimelineSection[];
453
+ }
454
+
455
+ /** A category axis: one band per label, in order; with none, bands numbered from 1. */
456
+ interface XyBandAxis {
457
+ kind: 'band';
458
+ title?: string;
459
+ categories: readonly string[];
460
+ }
461
+ /** A numeric axis from `min` to `max`, the series' values spread evenly across it. */
462
+ interface XyRangeAxis {
463
+ kind: 'range';
464
+ title?: string;
465
+ min: number;
466
+ max: number;
467
+ }
468
+ /** The value axis. A missing end fits the series' values, zero included. */
469
+ interface XyValueAxis {
470
+ title?: string;
471
+ min?: number;
472
+ max?: number;
473
+ }
474
+ /** One series: a value per category, drawn as bars or as a line. */
475
+ interface XySeries {
476
+ kind: 'bar' | 'line';
477
+ name?: string;
478
+ values: readonly number[];
479
+ }
480
+ /** A bar and line chart over categories or a numeric range. */
481
+ interface XyChartData {
482
+ kind: 'xychart';
483
+ title?: string;
484
+ /** Default `'vertical'`: categories along x, values up y. */
485
+ orientation?: 'vertical' | 'horizontal';
486
+ /** Absent, bands numbered from 1, one per value of the longest series. */
487
+ x?: XyBandAxis | XyRangeAxis;
488
+ y?: XyValueAxis;
489
+ series: readonly XySeries[];
490
+ }
491
+
492
+ /** A chart, as data: one spec per kind, told apart by `kind`. */
493
+ type PlotData = XyChartData | GanttData | TimelineData | PieData | QuadrantData | JourneyData | GitGraphData | SankeyData | PacketData | RadarData;
494
+ /** The kinds of chart {@link PlotData} holds. */
495
+ type PlotKind = PlotData['kind'];
496
+ /** What a kind's compiler is given and gives back: its spec laid out in a box of `size`, as marks. */
497
+ type PlotCompiler<D extends PlotData> = (data: D, size: {
498
+ width: number;
499
+ height: number;
500
+ }, theme: PlotTheme, measure: PlotMeasure) => {
501
+ marks: PlotMark[];
502
+ };
503
+ /** `data` laid out in a box of `size`, as the marks it is drawn with, in drawing order. */
504
+ declare function compilePlot(data: PlotData, size: {
505
+ width: number;
506
+ height: number;
507
+ }, theme: PlotTheme, measure: PlotMeasure): PlotMark[];
508
+
509
+ /** Where an xychart's parts landed: the plot area, the value scale, and each value index's place across it. */
510
+ interface XyLayout {
511
+ orientation: 'vertical' | 'horizontal';
512
+ /** The area the marks are drawn in, inside the axes. */
513
+ plot: {
514
+ x: number;
515
+ y: number;
516
+ width: number;
517
+ height: number;
518
+ };
519
+ /** Values along y for a vertical chart, along x for a horizontal one. */
520
+ value: LinearScale;
521
+ /** Each value index's center along the category axis. */
522
+ slots: readonly number[];
523
+ /** How much of the category axis each index's bars share. */
524
+ slotWidth: number;
525
+ }
526
+ /** How many values the longest series holds. */
527
+ declare const xyLength: (data: XyChartData) => number;
528
+ /** The value axis's domain: its own ends, and where one is missing, the values' reach with zero in it, made round. */
529
+ declare function xyValueDomain(data: XyChartData): [number, number];
530
+ /** Lays out an xychart in a box of `size`: its title, axes, bars, lines and points. */
531
+ declare function compileXyChart(data: XyChartData, size: {
532
+ width: number;
533
+ height: number;
534
+ }, theme: PlotTheme, measure: PlotMeasure): {
535
+ marks: PlotMark[];
536
+ layout: XyLayout;
537
+ };
538
+
539
+ /** How many rows the chart has: its categories, or its longest series where that is longer. */
540
+ declare const xyRows: (data: XyChartData) => number;
541
+ /** `data` with series `series`'s value at `index` set to `value`, a shorter series padded with zeros. Throws on a series
542
+ * the chart does not hold or an index past its last row. */
543
+ declare function setXyValue(data: XyChartData, series: number, index: number, value: number): XyChartData;
544
+ /** The value a point stands at along `layout`'s value axis, rounded to a tenth of its tick step. */
545
+ declare function xyValueAt(layout: XyLayout, at: {
546
+ x: number;
547
+ y: number;
548
+ }): number;
549
+
550
+ /** Where one task runs, in milliseconds since the epoch. */
551
+ interface GanttSpan {
552
+ start: number;
553
+ end: number;
554
+ }
555
+ /** Every task's span, by section and place in it, and the instants they cover between them. */
556
+ interface GanttSchedule {
557
+ spans: readonly (readonly GanttSpan[])[];
558
+ domain: readonly [number, number];
559
+ }
560
+ /**
561
+ * Every task's span. A date that does not read in the `dateFormat`, an id no task holds, and the far end of a
562
+ * dependency cycle all resolve to the chart's first date: its earliest written start, else the start of `today`'s
563
+ * day. An end before its start is moved up to the start.
564
+ */
565
+ declare function scheduleGantt(data: GanttData, today?: number): GanttSchedule;
566
+
567
+ /** Where a gantt's parts landed: the plot area, its time scale, and every task's resolved span. */
568
+ interface GanttLayout {
569
+ /** The area the rows are drawn in, right of the section names and above the axis. */
570
+ plot: {
571
+ x: number;
572
+ y: number;
573
+ width: number;
574
+ height: number;
575
+ };
576
+ time: TimeScale;
577
+ schedule: GanttSchedule;
578
+ /** What a drag snaps to, in milliseconds: an hour when the `dateFormat` carries hours, else a day. */
579
+ snap: number;
580
+ }
581
+ /** Lays out a gantt in a box of `size`: its title, section bands and names, task spans and names, axis, and today. */
582
+ declare function compileGantt(data: GanttData, size: {
583
+ width: number;
584
+ height: number;
585
+ }, theme: PlotTheme, measure: PlotMeasure): {
586
+ marks: PlotMark[];
587
+ layout: GanttLayout;
588
+ };
589
+
590
+ /** Dates as a gantt writes them: Day.js formats read and written, strftime for the axis. Every instant is UTC. */
591
+ /** The default `dateFormat`. */
592
+ declare const GANTT_DATE_FORMAT = "YYYY-MM-DD";
593
+ /** `text` read strictly in Day.js `format`, as milliseconds since the epoch; `null` when it does not read. Fields the
594
+ * format lacks default to 1970-01-01 00:00. */
595
+ declare function parseGanttDate(text: string, format: string): number | null;
596
+ /** `t` written in Day.js `format`. */
597
+ declare function formatGanttDate(t: number, format: string): string;
598
+
599
+ /**
600
+ * `data` with a task starting at `start`, written in the chart's `dateFormat`. A task that started after others, or
601
+ * after the task before it, leaves that dependency: it starts on the date from then on. Its end is kept as written,
602
+ * so a duration moves with it and a date stays put.
603
+ */
604
+ declare function moveGanttTask(data: GanttData, section: number, task: number, start: number): GanttData;
605
+ /**
606
+ * `data` with a task ending at `end`. A duration keeps its unit and takes the whole number of units nearest the span,
607
+ * at least 1 (0 for a milestone), days and weeks counted past excluded days; a date takes the new date, not before the
608
+ * start; an `until` end becomes a duration in days.
609
+ */
610
+ declare function setGanttEnd(data: GanttData, section: number, task: number, end: number): GanttData;
611
+ /** `data` with section `section` named `name`, trimmed. An empty name changes nothing. */
612
+ declare function setGanttSectionName(data: GanttData, section: number, name: string): GanttData;
613
+ /** `data` with a task named `name`, trimmed. An empty name changes nothing. */
614
+ declare function setGanttTaskName(data: GanttData, section: number, task: number, name: string): GanttData;
615
+
616
+ /** Where a timeline's columns landed: one per period, counted flat across sections. */
617
+ interface TimelineLayout {
618
+ /** Each period's column center along x. */
619
+ slots: readonly number[];
620
+ columnWidth: number;
621
+ }
622
+ /** Lays out a timeline in a box of `size`: its title, section headers, period boxes, the line across, and events. */
623
+ declare function compileTimeline(data: TimelineData, size: {
624
+ width: number;
625
+ height: number;
626
+ }, theme: PlotTheme, measure: PlotMeasure): {
627
+ marks: PlotMark[];
628
+ layout: TimelineLayout;
629
+ };
630
+
631
+ /** Edits to a timeline, as plain data in and out. Periods are counted flat, left to right across every section. */
632
+
633
+ /** `data` with section `section` named `name`, trimmed. An empty name changes nothing. Throws on a section it does not hold. */
634
+ declare function setTimelineSectionName(data: TimelineData, section: number, name: string): TimelineData;
635
+ /** `data` with period `period`'s label set to `label`, trimmed. An empty label changes nothing. */
636
+ declare function setTimelinePeriodLabel(data: TimelineData, period: number, label: string): TimelineData;
637
+ /** `data` with event `event` of period `period` set to `text`, trimmed; an empty one removes the event. */
638
+ declare function setTimelineEvent(data: TimelineData, period: number, event: number, text: string): TimelineData;
639
+ /**
640
+ * `data` with the period at flat index `from` moved to flat index `to`, counted after it is taken out. Moved right,
641
+ * it joins the section of the period before it; moved left, the section of the period after it. A section the move
642
+ * leaves empty is dropped. Throws on an index the timeline does not hold.
643
+ */
644
+ declare function moveTimelinePeriod(data: TimelineData, from: number, to: number): TimelineData;
645
+
646
+ /** Where a pie's parts landed: its center and radius, and each slice's angles, clockwise from twelve o'clock. */
647
+ interface PieLayout {
648
+ center: PlotPoint;
649
+ radius: number;
650
+ /** One per slice; a zero-valued slice's two angles are equal. */
651
+ angles: readonly {
652
+ start: number;
653
+ end: number;
654
+ }[];
655
+ }
656
+ /** Lays out a pie in a box of `size`: its title, a slice per value with its share written on it where it fits, and
657
+ * a legend at the right. */
658
+ declare function compilePie(data: PieData, size: {
659
+ width: number;
660
+ height: number;
661
+ }, theme: PlotTheme, measure: PlotMeasure): {
662
+ marks: PlotMark[];
663
+ layout: PieLayout;
664
+ };
665
+
666
+ /** Edits to a pie, as plain data in and out. */
667
+
668
+ /** `data` with slice `slice`'s value set to `value`. Throws on a slice the pie does not hold. */
669
+ declare const setPieValue: (data: PieData, slice: number, value: number) => PieData;
670
+ /** `data` with slice `slice`'s label set to `label`. Throws on a slice the pie does not hold. */
671
+ declare const setPieLabel: (data: PieData, slice: number, label: string) => PieData;
672
+
673
+ /** Where a quadrant chart's unit square landed. */
674
+ interface QuadrantLayout {
675
+ plot: {
676
+ x: number;
677
+ y: number;
678
+ width: number;
679
+ height: number;
680
+ };
681
+ }
682
+ /** Lays out a quadrant chart in a box of `size`: its title, the four quadrants and their labels, the axis labels,
683
+ * and each point with its name beside it. */
684
+ declare function compileQuadrant(data: QuadrantData, size: {
685
+ width: number;
686
+ height: number;
687
+ }, theme: PlotTheme, measure: PlotMeasure): {
688
+ marks: PlotMark[];
689
+ layout: QuadrantLayout;
690
+ };
691
+
692
+ /** Edits to a quadrant chart, as plain data in and out. */
693
+
694
+ /** `data` with point `point` moved to `x`, `y`. Throws on a point the chart does not hold. */
695
+ declare const setQuadrantPoint: (data: QuadrantData, point: number, at: {
696
+ x: number;
697
+ y: number;
698
+ }) => QuadrantData;
699
+ /** `data` with point `point` named `name`. Throws on a point the chart does not hold. */
700
+ declare const setQuadrantPointName: (data: QuadrantData, point: number, name: string) => QuadrantData;
701
+ /** `data` with an axis's end labeled `text`; an empty one drops it. */
702
+ declare function setQuadrantAxisLabel(data: QuadrantData, axis: 'x' | 'y', end: 'low' | 'high', text: string): QuadrantData;
703
+ /** `data` with quadrant `quadrant` (1 to 4, Mermaid's numbering) labeled `text`; an empty one drops it. Throws on any other number. */
704
+ declare function setQuadrantLabel(data: QuadrantData, quadrant: number, text: string): QuadrantData;
705
+
706
+ /** Where a journey's parts landed: the plot area, the score scale up it, and each step's band across it. */
707
+ interface JourneyLayout {
708
+ plot: {
709
+ x: number;
710
+ y: number;
711
+ width: number;
712
+ height: number;
713
+ };
714
+ score: LinearScale;
715
+ /** Over every step in order, keyed by its place among them all from `'0'`. */
716
+ steps: BandScale;
717
+ }
718
+ /** Lays out a journey in a box of `size`: its title, its steps left to right under their sections' headers, each at
719
+ * its score up a 1-to-5 axis with its name and its actors' dots under it, and a legend of actors at the right. */
720
+ declare function compileJourney(data: JourneyData, size: {
721
+ width: number;
722
+ height: number;
723
+ }, theme: PlotTheme, measure: PlotMeasure): {
724
+ marks: PlotMark[];
725
+ layout: JourneyLayout;
726
+ };
727
+
728
+ /** Edits to a user journey, as plain data in and out. */
729
+
730
+ /** `data` with a step's score set to `score`. Throws on a step the journey does not hold. */
731
+ declare const setJourneyScore: (data: JourneyData, section: number, task: number, score: number) => JourneyData;
732
+ /** `data` with a step named `name`. Throws on a step the journey does not hold. */
733
+ declare const setJourneyTaskName: (data: JourneyData, section: number, task: number, name: string) => JourneyData;
734
+ /** `data` with section `section` named `name`. Throws on a section the journey does not hold. */
735
+ declare function setJourneySectionName(data: JourneyData, section: number, name: string): JourneyData;
736
+
737
+ /** A git graph's commands replayed into its history: the commits each made, and the branches they sit on. */
738
+
739
+ /** One commit, as the replay made it. */
740
+ interface GitCommit {
741
+ /** The index in `commands` of the command that made it. */
742
+ command: number;
743
+ /** The command's own id, else one the replay gave it. */
744
+ id: string;
745
+ branch: string;
746
+ /** Its place in the whole history, from 0. */
747
+ seq: number;
748
+ /** The commit it follows, then for a merge the one it merges. */
749
+ parents: readonly string[];
750
+ type: GitCommitType;
751
+ /** For a cherry-pick, the commit it copies. */
752
+ source?: string;
753
+ }
754
+ /** One branch: its name, where it forked, and its commits in order. */
755
+ interface GitBranch {
756
+ name: string;
757
+ order?: number;
758
+ /** The commit it was branched from; none for the main branch, or one branched before any commit. */
759
+ fork?: string;
760
+ commits: string[];
761
+ }
762
+ /** A replayed history. `branches` in lane order: the main branch first, then by `order`, then as created. */
763
+ interface GitHistory {
764
+ commits: GitCommit[];
765
+ branches: GitBranch[];
766
+ /** The first command that could not run, and why; the history holds what ran before it. */
767
+ error?: {
768
+ command: number;
769
+ message: string;
770
+ };
771
+ }
772
+ /** Replays `data`'s commands from an empty main branch, stopping at the first one that cannot run, as Mermaid does. */
773
+ declare function replayGitGraph(data: GitGraphData): GitHistory;
774
+
775
+ /** Where a gitgraph's parts landed: each lane's place across the run, and each commit's point. */
776
+ interface GitGraphLayout {
777
+ history: GitHistory;
778
+ /** Each branch's place across the run, in `history.branches` order: a y for `'LR'`, an x otherwise. */
779
+ lanes: readonly number[];
780
+ /** Each commit's point, in `history.commits` order. */
781
+ points: readonly PlotPoint[];
782
+ }
783
+ /** Lays out a gitgraph in a box of `size`: its title, a lane per branch with its name, commits along it, merge links. */
784
+ declare function compileGitGraph(data: GitGraphData, size: {
785
+ width: number;
786
+ height: number;
787
+ }, theme: PlotTheme, measure: PlotMeasure): {
788
+ marks: PlotMark[];
789
+ layout: GitGraphLayout;
790
+ };
791
+
792
+ /** Edits to a gitgraph, as plain data in and out. */
793
+
794
+ /** `data` with command `command`'s tag set to `text`, trimmed; an empty one removes it. Throws on a command that
795
+ * does not exist or makes no commit. */
796
+ declare function setGitTag(data: GitGraphData, command: number, text: string): GitGraphData;
797
+
798
+ /** Where a sankey's nodes and ribbons stand: columns by depth, heights by flow, ordered to cross less. */
799
+
800
+ /** One node, placed. */
801
+ interface SankeyNodeBox {
802
+ label: string;
803
+ column: number;
804
+ /** The larger of what flows in and what flows out. */
805
+ value: number;
806
+ x: number;
807
+ y: number;
808
+ width: number;
809
+ height: number;
810
+ }
811
+ /** One link's ribbon: the span it leaves its source across, and the span it reaches its target across. */
812
+ interface SankeyRibbon {
813
+ source: number;
814
+ target: number;
815
+ from: {
816
+ x: number;
817
+ y0: number;
818
+ y1: number;
819
+ };
820
+ to: {
821
+ x: number;
822
+ y0: number;
823
+ y1: number;
824
+ };
825
+ }
826
+ /** Where a sankey's parts landed. `nodes` in order of first mention; `links` in the spec's order. */
827
+ interface SankeyLayout {
828
+ nodes: SankeyNodeBox[];
829
+ links: SankeyRibbon[];
830
+ columns: number;
831
+ }
832
+ /** Lays `data` out in `box`: a column per depth, each node as tall as its flow, ribbons stacked within each node. */
833
+ declare function sankeyLayout(data: SankeyData, box: {
834
+ x: number;
835
+ y: number;
836
+ width: number;
837
+ height: number;
838
+ }): SankeyLayout;
839
+
840
+ /** Lays out a sankey in a box of `size`: its title, a bar per node with its label and value, a ribbon per link with its value. */
841
+ declare function compileSankey(data: SankeyData, size: {
842
+ width: number;
843
+ height: number;
844
+ }, theme: PlotTheme, measure: PlotMeasure): {
845
+ marks: PlotMark[];
846
+ layout: SankeyLayout;
847
+ };
848
+
849
+ /** `data` with link `link`'s value set to `value`. Throws on a link it does not hold. */
850
+ declare function setSankeyValue(data: SankeyData, link: number, value: number): SankeyData;
851
+ /** `data` with node `from` called `to` in every link. Throws on a node it does not hold, or a name another node has. */
852
+ declare function renameSankeyNode(data: SankeyData, from: string, to: string): SankeyData;
853
+
854
+ /** Where a packet's rows landed: a band per bit of a row across, and each row's box from `boxTop(row)` down. */
855
+ interface PacketLayout {
856
+ /** Over a row's bits, keyed `'0'` to one less than the bits per row. */
857
+ bits: BandScale;
858
+ bitsPerRow: number;
859
+ rows: number;
860
+ /** The top of row `row`'s field boxes, under its bit numbers. */
861
+ boxTop(row: number): number;
862
+ boxHeight: number;
863
+ }
864
+ /** One row's share of a field: its first and last bit there. */
865
+ interface PacketPiece {
866
+ row: number;
867
+ lo: number;
868
+ hi: number;
869
+ }
870
+ /** Lays out a packet in a box of `size`: its title, then its fields along rows of bits, each a box per row it covers
871
+ * with its label in the widest, and the bit numbers at each piece's ends above it. */
872
+ declare function compilePacket(data: PacketData, size: {
873
+ width: number;
874
+ height: number;
875
+ }, theme: PlotTheme, measure: PlotMeasure): {
876
+ marks: PlotMark[];
877
+ layout: PacketLayout;
878
+ };
879
+
880
+ /** Edits to a packet diagram, as plain data in and out. */
881
+
882
+ /** `data` with field `field` labeled `label`. Throws on a field the packet does not hold. */
883
+ declare function setPacketLabel(data: PacketData, field: number, label: string): PacketData;
884
+
885
+ /** Where a radar's parts landed: the scale its spokes are drawn on. */
886
+ interface RadarLayout {
887
+ scale: PolarScale;
888
+ }
889
+ /** Lays out a radar in a box of `size`: its title, graticule, axis labels, curves and legend. */
890
+ declare function compileRadar(data: RadarData, size: {
891
+ width: number;
892
+ height: number;
893
+ }, theme: PlotTheme, measure: PlotMeasure): {
894
+ marks: PlotMark[];
895
+ layout: RadarLayout;
896
+ };
897
+
898
+ /** `data` with curve `curve`'s value on axis `axis` set to `value`. Throws on a curve or axis it does not hold. */
899
+ declare function setRadarValue(data: RadarData, curve: number, axis: number, value: number): RadarData;
900
+ /** `data` with axis `axis`'s label set to `text`; an empty label falls back to the axis's id. Throws on an axis it does not hold. */
901
+ declare function setRadarAxisLabel(data: RadarData, axis: number, text: string): RadarData;
902
+ /** `data` with curve `curve`'s label set to `text`; an empty label falls back to the curve's id. Throws on a curve it does not hold. */
903
+ declare function setRadarCurveLabel(data: RadarData, curve: number, text: string): RadarData;
904
+
905
+ /** The room every chart leaves around its edge. */
906
+ declare const CHART_PAD = 12;
907
+ /** `title` centered across the top of a box `width` wide, keyed `title`, and where the rest of the chart starts below
908
+ * it: {@link CHART_PAD} down when there is no title. */
909
+ declare function chartTitle(title: string | undefined, width: number, theme: PlotTheme, measure: PlotMeasure): {
910
+ marks: PlotMark[];
911
+ top: number;
912
+ };
913
+ /** `data` with its title set to `text`, trimmed; an empty one drops it. `data` itself when that changes nothing. */
914
+ declare function withTitle<D extends {
915
+ title?: string;
916
+ }>(data: D, text: string): D;
917
+
918
+ /**
919
+ * A plot in a scene: one root node holding the spec, its marks derived
920
+ * children rebuilt from it. An edit replaces the spec and rebuilds the marks
921
+ * as one undo entry.
922
+ */
923
+
924
+ /** What a plot's root node keeps: the spec, and the theme its marks were drawn in. */
925
+ interface PlotRootTrait {
926
+ data: PlotData;
927
+ theme: PlotTheme;
928
+ }
929
+ /** A plot root's scene data. */
930
+ interface PlotRootData {
931
+ plot: PlotRootTrait;
932
+ }
933
+ /** The data of any node a plot puts in a scene. */
934
+ type PlotSceneData = PlotRootData | PlotMarkData;
935
+ /** A scene node spec, as {@link plotSpecs} returns them. */
936
+ type PlotSpec<TLayer extends string = 'main'> = AddNodeSpec<PlotSceneData, TLayer, RectPose>;
937
+ /** Options for {@link plotSpecs}. */
938
+ interface PlotSpecsOptions<TLayer extends string = 'main'> {
939
+ /** The root's id. Default `'plot'`. */
940
+ id?: string;
941
+ /** The box the plot fills. */
942
+ box: {
943
+ x: number;
944
+ y: number;
945
+ width: number;
946
+ height: number;
947
+ };
948
+ /** Default `'main'`. */
949
+ layer?: TLayer;
950
+ /** Default {@link PLOT_THEME}. */
951
+ theme?: PlotTheme;
952
+ /** Default {@link textMeasure}. */
953
+ measure?: PlotMeasure;
954
+ }
955
+ /** The trait a plot root's data carries, or `null` for any other node. */
956
+ declare function plotRootOf(node: {
957
+ data: unknown;
958
+ } | undefined): PlotRootTrait | null;
959
+ /** The trait a plot mark's data carries, or `null` for any other node. */
960
+ declare function plotMarkOf(node: {
961
+ data: unknown;
962
+ } | undefined): PlotMarkTrait | null;
963
+ /** The id of the mark keyed `key` under the root `rootId`. */
964
+ declare const plotMarkId: (rootId: string, key: string) => string;
965
+ /** `marks` as children of the root `rootId`, in its frame. */
966
+ declare function markSpecs<TLayer extends string>(rootId: string, layer: TLayer, marks: readonly PlotMark[]): PlotSpec<TLayer>[];
967
+ /** The nodes a plot of `data` is: its root, a group filling `box`, then each mark under it, in drawing order. */
968
+ declare function plotSpecs<TLayer extends string = 'main'>(data: PlotData, opts: PlotSpecsOptions<TLayer>): PlotSpec<TLayer>[];
969
+ /** Options for {@link replacePlotData}. */
970
+ interface ReplacePlotOptions {
971
+ /** The undo entry's label. Default `'Edit chart'`. */
972
+ label?: string;
973
+ /** Draw in this theme from now on. Default the one the root keeps. */
974
+ theme?: PlotTheme;
975
+ /** Default {@link textMeasure}. */
976
+ measure?: PlotMeasure;
977
+ }
978
+ /** Replaces the spec of the plot rooted at `rootId` with `data` and rebuilds its marks, as one undo entry. */
979
+ declare function replacePlotData<TData, TLayer extends string, TPose>(scene: Scene<TData, TLayer, TPose>, rootId: string, data: PlotData, opts?: ReplacePlotOptions): void;
980
+ /** The id of the plot root `id` is, or is a mark of; `null` for a node outside every plot. */
981
+ declare function plotRootContaining(scene: Scene<unknown, string, unknown>, id: string): NodeId | null;
982
+ /** Every plot root in `scene`, in render order. */
983
+ declare function plotRootsIn(scene: Scene<unknown, string, unknown>): NodeId[];
984
+
985
+ /** A handle a press can take: where it stands in the plot's coordinates, and the cursor over it. */
986
+ interface PlotHandle {
987
+ at: PlotPoint;
988
+ cursor: 'ns-resize' | 'ew-resize' | 'move';
989
+ /** Which of a mark's handles this is, handed back to {@link PlotEditor.drag}; for a mark with more than one. */
990
+ part?: string;
991
+ /** Takes a press anywhere in this box, in the plot's coordinates, rather than near `at`. */
992
+ box?: PlotBox;
993
+ }
994
+ /** One chart kind's edits. */
995
+ interface PlotEditor<D extends PlotData> {
996
+ /** The handles on a mark, or `null` for a mark a drag does not edit. */
997
+ handle(data: D, mark: {
998
+ trait: PlotMarkTrait;
999
+ pose: PlotBox;
1000
+ }): PlotHandle | readonly PlotHandle[] | null;
1001
+ /** A drag that took the handle `part` on `mark`: the spec it proposes with the pointer at a point in the plot's
1002
+ * coordinates. `null` when the mark has nothing to edit. */
1003
+ drag(data: D, mark: PlotMarkTrait, size: {
1004
+ width: number;
1005
+ height: number;
1006
+ }, theme: PlotTheme, measure: PlotMeasure, part?: string): ((at: PlotPoint) => D) | null;
1007
+ /** The spec with the text a text mark of `datum` stands for set to `text`; `data` itself when that changes
1008
+ * nothing or `text` does not read (a value that is not a number). Absent for a kind with no text edits. */
1009
+ text?(data: D, datum: PlotDatum, text: string): D;
1010
+ }
1011
+ /** The edits `data`'s kind allows, or `null` for a kind with none. */
1012
+ declare const plotEditorOf: (data: PlotData) => PlotEditor<PlotData> | null;
1013
+ /** A handle list as an array, whatever {@link PlotEditor.handle} returned. */
1014
+ declare const handlesOf: (h: PlotHandle | readonly PlotHandle[] | null) => readonly PlotHandle[];
1015
+
1016
+ /**
1017
+ * Dragging a plot's handle to edit the value behind it. The handle layer
1018
+ * claims the press; this action previews every mark the proposed spec
1019
+ * redraws, and commits the spec as one edit of the plot's root.
1020
+ */
1021
+
1022
+ /** The action that drags a plot's handle. */
1023
+ declare const PLOT_DRAG_ACTION_ID = "plot.dragValue";
1024
+ /** A plot edited: the root, and the spec it now holds. */
1025
+ interface PlotEdit {
1026
+ rootId: string;
1027
+ data: PlotData;
1028
+ }
1029
+ /** Options for {@link createPlotDragAction}. */
1030
+ interface PlotDragOptions {
1031
+ id?: string;
1032
+ /** Default {@link textMeasure}. */
1033
+ measure?: PlotMeasure;
1034
+ /** Defaults to {@link replacePlotData} against `deps.scene`, labeled "Edit value". */
1035
+ commit?: (edit: PlotEdit, ctx: InvocationCtx) => void;
1036
+ }
1037
+ /** The default commit: the spec into the root, its marks rebuilt, as one history entry, "Edit value". */
1038
+ declare function commitPlotToScene(edit: PlotEdit, ctx: InvocationCtx, measure?: PlotMeasure): void;
1039
+ /** The `plot.dragValue` action: an ongoing drag that moves one value of a plot, previewing the marks it redraws. */
1040
+ declare function createPlotDragAction(opts?: PlotDragOptions): Action;
1041
+
1042
+ /**
1043
+ * Editing a chart's text in place, through a canvas's own text editor: a text
1044
+ * mark whose datum names an `edit` is the spec's text, and closing the editor
1045
+ * folds what was typed into one edit of the spec.
1046
+ */
1047
+
1048
+ type AnyScene$1 = Scene<unknown, string, unknown>;
1049
+ /** The datum of a text mark an edit can set: one naming what it edits under `edit`, or `null` for any other node. */
1050
+ declare function plotTextOf(node: {
1051
+ data: unknown;
1052
+ } | undefined): PlotDatum | null;
1053
+ /** Whether `data` is a chart's text an edit can set. */
1054
+ declare const isPlotText: (data: unknown) => boolean;
1055
+ /**
1056
+ * Folds a text edit just written to one of a chart's text marks into its
1057
+ * root's spec: the edit is undone and `commit` gets the spec with the new
1058
+ * text, so the change is one entry on the spec, not a mark the next compile
1059
+ * would overwrite. Does nothing for any other node, or text that changes
1060
+ * nothing. Text that does not read (a value that is not a number) is undone,
1061
+ * so the mark shows the spec again.
1062
+ */
1063
+ declare function foldPlotText(scene: AnyScene$1, textId: string, commit: (edit: PlotEdit & {
1064
+ label: string;
1065
+ }) => void): void;
1066
+ /**
1067
+ * The `<SceneCanvas textEditor>` options that open on a chart's text and, as
1068
+ * the edit closes, fold it into one edit of the spec for `commit`.
1069
+ */
1070
+ declare function usePlotTextEdit(scene: AnyScene$1, commit: (edit: PlotEdit & {
1071
+ label: string;
1072
+ }) => void): Exclude<SceneCanvasTextEditor<unknown>, false>;
1073
+
1074
+ /**
1075
+ * What makes a plot's editable marks grabbable: a hit-only point region at
1076
+ * each handle its kind's editor names, composed into a layer whose id is the
1077
+ * kind a press reports.
1078
+ */
1079
+
1080
+ /** The layer id the handles are composed into. */
1081
+ declare const PLOT_HANDLE_LAYER_ID = "plot-handles";
1082
+ /** The affordance kind a press on a handle reports. */
1083
+ declare const PLOT_HANDLE_AFFORDANCE_KIND: "layer:plot-handles";
1084
+ /** What a press on a handle hands the drag, as the hit's `payload`. */
1085
+ interface PlotHandleScratch {
1086
+ rootId: string;
1087
+ markId: string;
1088
+ /** The handle, in world coordinates. */
1089
+ at: PlotPoint;
1090
+ /** Which of the mark's handles, for a mark with more than one. */
1091
+ part?: string;
1092
+ }
1093
+ /** A press's scratch, read back off the hit an action was handed. */
1094
+ declare function plotHandleScratchOf(hit: {
1095
+ payload?: unknown;
1096
+ } | null | undefined): PlotHandleScratch | null;
1097
+ type AnyScene = Scene<unknown, string, unknown>;
1098
+ /** Where the plot root `rootId`'s corner stands in world coordinates. */
1099
+ declare function plotOrigin(scene: AnyScene, rootId: string): PlotPoint;
1100
+ /** Every handle in `scene` an edit may take, in world coordinates, in render order. */
1101
+ declare function plotHandles(scene: AnyScene): Iterable<PlotHandleScratch & PlotHandle>;
1102
+ /** The handle layer, for `CanvasExtensionApi.registerLayer`. */
1103
+ declare function plotHandleLayer(scene: Scene<unknown, string, unknown>): RenderLayer<unknown>;
1104
+
1105
+ /** The action id that absorbs a press on a handle, so it reaches neither marquee nor pan. */
1106
+ declare const GRAB_PLOT_HANDLE_ACTION_ID = "plot.grabHandle";
1107
+ /**
1108
+ * Both halves of editing a scene's plots by dragging: the handle layer to
1109
+ * `registerLayer`, and the contribution to pass as `ambient`, which binds a
1110
+ * drag on a handle to `plot.dragValue`. One without the other fails quietly:
1111
+ * the layer alone claims presses that start nothing, the contribution alone
1112
+ * binds a kind nothing reports.
1113
+ */
1114
+ declare function plotEditing(opts: PlotDragOptions & {
1115
+ scene: Scene<unknown, string, unknown>;
1116
+ }): {
1117
+ layer: RenderLayer<unknown>;
1118
+ contribution: Contribution;
1119
+ };
1120
+
1121
+ /** Props for {@link PlotView}. */
1122
+ interface PlotViewProps {
1123
+ /** The chart. A new value redraws it, with no undo entry. */
1124
+ data: PlotData;
1125
+ /** Hears each edit a drag or a text edit commits, with the spec it leaves. Undo and redo in the view report too. */
1126
+ onChange?: (data: PlotData) => void;
1127
+ width: number;
1128
+ height: number;
1129
+ /** Default the weasel theme's dark mode. */
1130
+ theme?: PlotTheme;
1131
+ measure?: PlotMeasure;
1132
+ background?: Paint;
1133
+ className?: string;
1134
+ 'aria-label'?: string;
1135
+ }
1136
+ /**
1137
+ * A chart on its own canvas, edited by dragging its marks (a bar's end, a
1138
+ * line's point, a task's span) and by double-clicking its text to edit it in
1139
+ * place. Each edit is one undo entry. Text paints only
1140
+ * in a registered font family, so register the theme's (`registerCanvasFont`).
1141
+ */
1142
+ declare function PlotView(props: PlotViewProps): ReactElement;
1143
+
1144
+ /**
1145
+ * A chart's data as a host sees it to build a form or a grid: fields set once
1146
+ * per chart, and tables of rows, some holding further tables under each row.
1147
+ * Every read and write goes through the kind's own edits, so a host needs to
1148
+ * know no kind to author one.
1149
+ */
1150
+
1151
+ /** What a field or cell holds; `undefined` for one left unset. */
1152
+ type PlotValue = string | number | boolean | undefined;
1153
+ /** What a field or cell takes, and so the control a host gives it. */
1154
+ type PlotValueType = {
1155
+ kind: 'string';
1156
+ placeholder?: string;
1157
+ } | {
1158
+ kind: 'number';
1159
+ min?: number;
1160
+ max?: number;
1161
+ step?: number;
1162
+ } | {
1163
+ kind: 'boolean';
1164
+ } | {
1165
+ kind: 'enum';
1166
+ options: readonly string[];
1167
+ } | {
1168
+ kind: 'color';
1169
+ };
1170
+ /** Where a nested table sits: the row it hangs under in each table above it, outermost first. `[]` for a top-level table. */
1171
+ type PlotScope = readonly number[];
1172
+ /** One value per chart: a title, an axis's end, an option. */
1173
+ interface PlotField<D extends PlotData = PlotData> {
1174
+ key: string;
1175
+ label: string;
1176
+ type: PlotValueType;
1177
+ /** May be left unset: setting `undefined` clears it, and the chart falls back to a default. */
1178
+ optional?: boolean;
1179
+ /** Whether the field means anything for `data` as it stands (a range axis's ends, only on a range axis). Absent, always. */
1180
+ applies?(data: D): boolean;
1181
+ get(data: D): PlotValue;
1182
+ /** `data` with the field set to `value`; `data` itself when that changes nothing or does not read. */
1183
+ set(data: D, value: PlotValue): D;
1184
+ }
1185
+ /** One column of a table. */
1186
+ interface PlotColumn<D extends PlotData = PlotData> {
1187
+ key: string;
1188
+ label: string;
1189
+ type: PlotValueType;
1190
+ /** May be left unset; see {@link PlotField.optional}. */
1191
+ optional?: boolean;
1192
+ /** Shown and never set: a value derived from others. */
1193
+ readOnly?: boolean;
1194
+ /** Whether the column means anything on this row (a commit's message, not a checkout's). Absent, every row. */
1195
+ applies?(data: D, scope: PlotScope, row: number): boolean;
1196
+ get(data: D, scope: PlotScope, row: number): PlotValue;
1197
+ /** `data` with the cell set to `value`; `data` itself when that changes nothing or does not read. */
1198
+ set(data: D, scope: PlotScope, row: number, value: PlotValue): D;
1199
+ }
1200
+ /** A collection a chart holds: slices, series, tasks, links. Each missing edit is one the collection does not allow. */
1201
+ interface PlotTable<D extends PlotData = PlotData> {
1202
+ key: string;
1203
+ label: string;
1204
+ /** What one row is called, for a button or a handle's name: `'slice'`. */
1205
+ item: string;
1206
+ count(data: D, scope: PlotScope): number;
1207
+ columns(data: D, scope: PlotScope): readonly PlotColumn<D>[];
1208
+ /** `data` with a new row before row `at`; `at` equal to the count appends. */
1209
+ insert?(data: D, scope: PlotScope, at: number): D;
1210
+ remove?(data: D, scope: PlotScope, row: number): D;
1211
+ /** `data` with row `from` moved to index `to`, counted once it is taken out. */
1212
+ move?(data: D, scope: PlotScope, from: number, to: number): D;
1213
+ /** What row `row` is called, for a heading over its nested tables. */
1214
+ rowLabel?(data: D, scope: PlotScope, row: number): string;
1215
+ /** Tables held under each row of this one; their scope is this one's with the row appended. */
1216
+ children?: readonly PlotTable<D>[];
1217
+ }
1218
+ /** A chart kind's data, as fields and tables. */
1219
+ interface PlotSchema<D extends PlotData = PlotData> {
1220
+ fields: readonly PlotField<D>[];
1221
+ tables: readonly PlotTable<D>[];
1222
+ }
1223
+
1224
+ /** `data`'s kind as fields and tables. Throws on a kind with none. */
1225
+ declare function plotSchemaOf(data: PlotData): PlotSchema;
1226
+ /** Every table in `schema` with the scope of each place it appears in `data`, outermost first: a nested table once
1227
+ * under each row of its parent. */
1228
+ declare function plotTablesIn(schema: PlotSchema, data: PlotData): {
1229
+ table: PlotTable;
1230
+ scope: PlotScope;
1231
+ }[];
1232
+
1233
+ /** `data` with a row before row `at`: a zero in every series and, where rows are labeled, `label` (absent, a fresh one). */
1234
+ declare function insertXyRow(data: XyChartData, at: number, label?: string): XyChartData;
1235
+ /** `data` without row `at`, in every series and the labels. Throws on a row it does not hold. */
1236
+ declare function removeXyRow(data: XyChartData, at: number): XyChartData;
1237
+ /** `data` with row `from` moved to index `to`, counted once it is taken out, in every series and the labels. */
1238
+ declare const moveXyRow: (data: XyChartData, from: number, to: number) => XyChartData;
1239
+ /** `data` with row `index` labeled `label`, the axis turned to categories when it was numbered. */
1240
+ declare function setXyCategory(data: XyChartData, index: number, label: string): XyChartData;
1241
+ /** `data` with `series` inserted before series `at`; absent, a bar series of zeros under a fresh name. */
1242
+ declare function insertXySeries(data: XyChartData, at: number, series?: XySeries): XyChartData;
1243
+ /** `data` without series `series`. Throws on a series it does not hold. */
1244
+ declare const removeXySeries: (data: XyChartData, series: number) => XyChartData;
1245
+ /** `data` with series `from` moved to index `to`, counted once it is taken out. */
1246
+ declare const moveXySeries: (data: XyChartData, from: number, to: number) => XyChartData;
1247
+ /** `data` with series `series` named `name`, trimmed; an empty name drops it. */
1248
+ declare const setXySeriesName: (data: XyChartData, series: number, name: string | undefined) => XyChartData;
1249
+ /** `data` with series `series` drawn as bars or as a line. */
1250
+ declare const setXySeriesKind: (data: XyChartData, series: number, kind: XySeries["kind"]) => XyChartData;
1251
+ /** `data` with categories along x and values along y, or (`'horizontal'`) the other way round. */
1252
+ declare const setXyOrientation: (data: XyChartData, orientation: "vertical" | "horizontal") => XyChartData;
1253
+ /** `data` running along categories (each row labeled, numbered ones kept as written) or a numeric range from 0 to the
1254
+ * row count. The axis keeps its title. */
1255
+ declare function setXyXKind(data: XyChartData, kind: 'band' | 'range'): XyChartData;
1256
+ /** `data` with an axis titled `title`, trimmed; an empty one drops it. */
1257
+ declare function setXyAxisTitle(data: XyChartData, axis: 'x' | 'y', title: string | undefined): XyChartData;
1258
+ /** `data` with the value axis's end `end` at `value`; `undefined` lets it fit the values. */
1259
+ declare function setXyValueBound(data: XyChartData, end: 'min' | 'max', value: number | undefined): XyChartData;
1260
+ /** `data` with the range axis's end `end` at `value`. Throws on a chart not running along a range. */
1261
+ declare function setXyRangeBound(data: XyChartData, end: 'min' | 'max', value: number): XyChartData;
1262
+
1263
+ /** `data` with `section` inserted before section `at`; absent, a section of one fresh task under a fresh name. */
1264
+ declare function insertGanttSection(data: GanttData, at: number, section?: GanttSection): GanttData;
1265
+ /** `data` without section `section` and its tasks. Throws on a section it does not hold. */
1266
+ declare function removeGanttSection(data: GanttData, section: number): GanttData;
1267
+ /** `data` with section `from` moved to index `to`, counted once it is taken out. */
1268
+ declare const moveGanttSection: (data: GanttData, from: number, to: number) => GanttData;
1269
+ /** `data` with `task` inserted before task `at` of section `section`; absent, a day-long task after the one before. */
1270
+ declare const insertGanttTask: (data: GanttData, section: number, at: number, task?: GanttTask) => GanttData;
1271
+ /** `data` without task `task` of section `section`. Throws on a task it does not hold. */
1272
+ declare function removeGanttTask(data: GanttData, section: number, task: number): GanttData;
1273
+ /** `data` with task `from` of section `section` moved to index `to` in it, counted once it is taken out. */
1274
+ declare const reorderGanttTask: (data: GanttData, section: number, from: number, to: number) => GanttData;
1275
+ /** `data` with task `task` of section `from` moved into section `to` before its task `at` (absent, last). Its id and
1276
+ * every dependency on it are kept. Throws on a task or section it does not hold. */
1277
+ declare function moveGanttTaskToSection(data: GanttData, from: number, task: number, to: number, at?: number): GanttData;
1278
+ /**
1279
+ * `data` with a task's id set to `id`, trimmed, every dependency naming the old id following it; an empty id drops
1280
+ * it and the dependencies on it. Throws on an id another task holds.
1281
+ */
1282
+ declare function setGanttTaskId(data: GanttData, section: number, task: number, id: string | undefined): GanttData;
1283
+ /** `data` with a task carrying `tags`, kept in one order and each once; none drops them. */
1284
+ declare const setGanttTaskTags: (data: GanttData, section: number, task: number, tags: readonly GanttTag[]) => GanttData;
1285
+ /** `data` with a task starting at `start`, as written. */
1286
+ declare const setGanttTaskStart: (data: GanttData, section: number, task: number, start: GanttStart) => GanttData;
1287
+ /** `data` with a task ending at `end`, as written. */
1288
+ declare const setGanttTaskEnd: (data: GanttData, section: number, task: number, end: GanttEnd) => GanttData;
1289
+ /** `data` with one of its text settings set to `value`, trimmed; an empty one drops it, for the default. */
1290
+ declare function setGanttSetting(data: GanttData, key: 'dateFormat' | 'axisFormat' | 'todayMarker', value: string | undefined): GanttData;
1291
+ /** `data` skipping `excludes` in durations counted in days, each trimmed; none drops them. */
1292
+ declare function setGanttExcludes(data: GanttData, excludes: readonly string[]): GanttData;
1293
+
1294
+ /** A task's start and end as written in Mermaid: `after a b`, `until a b`, a duration (`3d`, `1.5h`), or a date. */
1295
+
1296
+ /** `start` as written: `after a b`, a date, or `''` for one that follows the task before it. */
1297
+ declare const formatGanttStart: (start: GanttStart) => string;
1298
+ /** Text read as a start: `after a b` as its ids, `''` as following the task before, anything else as a date. */
1299
+ declare function parseGanttStart(text: string): GanttStart;
1300
+ /** `end` as written: `until a b`, a duration, or a date. */
1301
+ declare function formatGanttEnd(end: GanttEnd): string;
1302
+ /** Text read as an end: `until a b` as its ids, a duration as its amount and unit, anything else as a date. */
1303
+ declare function parseGanttEnd(text: string): GanttEnd;
1304
+
1305
+ /** The flat index, counted across every section, of period `index` of section `section`. */
1306
+ declare function timelineFlatIndex(data: TimelineData, section: number, index: number): number;
1307
+ /** `data` with `section` inserted before section `at`; absent, one fresh period under a fresh name. */
1308
+ declare function insertTimelineSection(data: TimelineData, at: number, section?: TimelineSection): TimelineData;
1309
+ /** `data` without section `section` and its periods. Throws on a section it does not hold. */
1310
+ declare const removeTimelineSection: (data: TimelineData, section: number) => TimelineData;
1311
+ /** `data` with section `from` moved to index `to`, counted once it is taken out. */
1312
+ declare const moveTimelineSection: (data: TimelineData, from: number, to: number) => TimelineData;
1313
+ /** `data` with `period` inserted before period `at` of section `section`; absent, a fresh period with no events. */
1314
+ declare const insertTimelinePeriod: (data: TimelineData, section: number, at: number, period?: TimelinePeriod) => TimelineData;
1315
+ /** `data` without period `period` of section `section`. Throws on a period it does not hold. */
1316
+ declare const removeTimelinePeriod: (data: TimelineData, section: number, period: number) => TimelineData;
1317
+ /** `data` with period `from` of section `section` moved to index `to` in it, counted once it is taken out. */
1318
+ declare const reorderTimelinePeriod: (data: TimelineData, section: number, from: number, to: number) => TimelineData;
1319
+ /** `data` with event `text` inserted before event `at` of one period; absent, a fresh one. */
1320
+ declare const insertTimelineEvent: (data: TimelineData, section: number, period: number, at: number, text?: string) => TimelineData;
1321
+ /** `data` without event `event` of one period. Throws on an event it does not hold. */
1322
+ declare const removeTimelineEvent: (data: TimelineData, section: number, period: number, event: number) => TimelineData;
1323
+ /** `data` with event `from` of one period moved to index `to` in it, counted once it is taken out. */
1324
+ declare const moveTimelineEvent: (data: TimelineData, section: number, period: number, from: number, to: number) => TimelineData;
1325
+
1326
+ /** `data` with `slice` inserted before slice `at`; absent, a slice of 1 under a label no slice holds. */
1327
+ declare function insertPieSlice(data: PieData, at: number, slice?: PieSlice): PieData;
1328
+ /** `data` without slice `slice`. Throws on a slice it does not hold. */
1329
+ declare const removePieSlice: (data: PieData, slice: number) => PieData;
1330
+ /** `data` with slice `from` moved to index `to`, counted once it is taken out. */
1331
+ declare const movePieSlice: (data: PieData, from: number, to: number) => PieData;
1332
+ /** `data` writing, or not, each slice's value in the legend. */
1333
+ declare const setPieShowData: (data: PieData, show: boolean) => PieData;
1334
+
1335
+ /** `data` with `point` inserted before point `at`; absent, a point at the center under a fresh name. */
1336
+ declare function insertQuadrantPoint(data: QuadrantData, at: number, point?: QuadrantPoint): QuadrantData;
1337
+ /** `data` without point `point`. Throws on a point it does not hold. */
1338
+ declare const removeQuadrantPoint: (data: QuadrantData, point: number) => QuadrantData;
1339
+ /** `data` with point `from` moved to index `to`, counted once it is taken out. */
1340
+ declare const moveQuadrantPoint: (data: QuadrantData, from: number, to: number) => QuadrantData;
1341
+ /** `data` with a point's style `key` set to `value`; `undefined` drops it, for its class's or the theme's. */
1342
+ declare const setQuadrantPointStyle: <K extends keyof QuadrantPointStyle>(data: QuadrantData, point: number, key: K, value: QuadrantPointStyle[K] | undefined) => QuadrantData;
1343
+ /** `data` with a point drawn in class `className`; `undefined` drops it. Throws on a class the chart does not hold. */
1344
+ declare function setQuadrantPointClass(data: QuadrantData, point: number, className: string | undefined): QuadrantData;
1345
+ /** The names of the chart's classes, in order. */
1346
+ declare const quadrantClassNames: (data: QuadrantData) => string[];
1347
+ /** `data` with a class `name` (absent, a fresh one) of `style` inserted before class `at`. Throws on a name it holds. */
1348
+ declare function insertQuadrantClass(data: QuadrantData, at: number, name?: string, style?: QuadrantPointStyle): QuadrantData;
1349
+ /** `data` without class `index`, every point that used it drawn in its own style. Throws on a class it does not hold. */
1350
+ declare function removeQuadrantClass(data: QuadrantData, index: number): QuadrantData;
1351
+ /** `data` with class `from` moved to index `to`, counted once it is taken out. */
1352
+ declare const moveQuadrantClass: (data: QuadrantData, from: number, to: number) => QuadrantData;
1353
+ /** `data` with class `index` called `name`, on every point that used it too. Throws on a name another class holds. */
1354
+ declare function renameQuadrantClass(data: QuadrantData, index: number, name: string): QuadrantData;
1355
+ /** `data` with class `index`'s style `key` set to `value`; `undefined` drops it, for the theme's. */
1356
+ declare function setQuadrantClassStyle<K extends keyof QuadrantPointStyle>(data: QuadrantData, index: number, key: K, value: QuadrantPointStyle[K] | undefined): QuadrantData;
1357
+
1358
+ /** `data` with `section` inserted before section `at`; absent, one fresh step under a fresh name. */
1359
+ declare function insertJourneySection(data: JourneyData, at: number, section?: JourneySection): JourneyData;
1360
+ /** `data` without section `section` and its steps. Throws on a section it does not hold. */
1361
+ declare const removeJourneySection: (data: JourneyData, section: number) => JourneyData;
1362
+ /** `data` with section `from` moved to index `to`, counted once it is taken out. */
1363
+ declare const moveJourneySection: (data: JourneyData, from: number, to: number) => JourneyData;
1364
+ /** `data` with `task` inserted before step `at` of section `section`; absent, a fresh step scored 3 with no actors. */
1365
+ declare const insertJourneyTask: (data: JourneyData, section: number, at: number, task?: JourneyTask) => JourneyData;
1366
+ /** `data` without step `task` of section `section`. Throws on a step it does not hold. */
1367
+ declare const removeJourneyTask: (data: JourneyData, section: number, task: number) => JourneyData;
1368
+ /** `data` with step `from` of section `section` moved to index `to` in it, counted once it is taken out. */
1369
+ declare const moveJourneyTask: (data: JourneyData, section: number, from: number, to: number) => JourneyData;
1370
+ /** `data` with a step taken part in by `actors`, each trimmed and once. */
1371
+ declare function setJourneyActors(data: JourneyData, section: number, task: number, actors: readonly string[]): JourneyData;
1372
+
1373
+ /** The kinds of command a graph runs. */
1374
+ declare const GIT_COMMAND_KINDS: readonly ["commit", "branch", "checkout", "merge", "cherry-pick"];
1375
+ /** A command's fields besides its kind. */
1376
+ type GitCommandField = 'id' | 'type' | 'tag' | 'message' | 'name' | 'branch' | 'order' | 'parent';
1377
+ /** The fields each kind of command holds; `id` on a cherry-pick names the commit it picks. */
1378
+ declare const GIT_COMMAND_FIELDS: {
1379
+ readonly [K in GitCommand['kind']]: readonly GitCommandField[];
1380
+ };
1381
+ /** The branches the graph names, its main branch first. */
1382
+ declare const gitBranchNames: (data: GitGraphData) => string[];
1383
+ /** `data` with `command` inserted before command `at`; absent, a plain commit. */
1384
+ declare const insertGitCommand: (data: GitGraphData, at: number, command?: GitCommand) => GitGraphData;
1385
+ /** `data` without command `command`. Throws on a command it does not hold. */
1386
+ declare const removeGitCommand: (data: GitGraphData, command: number) => GitGraphData;
1387
+ /** `data` with command `from` moved to index `to`, counted once it is taken out. */
1388
+ declare const moveGitCommand: (data: GitGraphData, from: number, to: number) => GitGraphData;
1389
+ /** `data` with command `at` replaced by `command`. Throws on a command it does not hold. */
1390
+ declare const setGitCommand: (data: GitGraphData, at: number, command: GitCommand) => GitGraphData;
1391
+ /**
1392
+ * `data` with command `at` turned into a command of `kind`, keeping the fields both kinds hold. What the new kind needs
1393
+ * and the old did not hold is filled in: a fresh name for a branch, the main branch to check out, the last branch
1394
+ * created to merge, the last commit id to pick.
1395
+ */
1396
+ declare function setGitCommandKind(data: GitGraphData, at: number, kind: GitCommand['kind']): GitGraphData;
1397
+ /**
1398
+ * `data` with field `field` of command `at` set to `value`; `undefined` drops an optional field. Throws on a field its
1399
+ * kind does not hold, a value of the wrong type, or dropping a field the kind needs.
1400
+ */
1401
+ declare function setGitCommandField(data: GitGraphData, at: number, field: GitCommandField, value: string | number | undefined): GitGraphData;
1402
+ /** `data` drawn left to right (the default), top to bottom, or bottom to top. */
1403
+ declare const setGitOrientation: (data: GitGraphData, orientation: "LR" | "TB" | "BT") => GitGraphData;
1404
+ /** `data` with its main branch called `name`, trimmed, every checkout and merge of it renamed too. Throws on an empty
1405
+ * name or one another branch holds. */
1406
+ declare function setGitMainBranch(data: GitGraphData, name: string): GitGraphData;
1407
+
1408
+ /** `data` with `link` inserted before link `at`; absent, a flow of 1 from the last link's target to a fresh node. */
1409
+ declare function insertSankeyLink(data: SankeyData, at: number, link?: SankeyLink): SankeyData;
1410
+ /** `data` without link `link`. Throws on a link it does not hold. */
1411
+ declare const removeSankeyLink: (data: SankeyData, link: number) => SankeyData;
1412
+ /** `data` with link `from` moved to index `to`, counted once it is taken out. */
1413
+ declare const moveSankeyLink: (data: SankeyData, from: number, to: number) => SankeyData;
1414
+ /** `data` with link `link` running from (`'source'`) or to (`'target'`) node `name`, trimmed; a node it names that no
1415
+ * link did is added. Throws on an empty name. */
1416
+ declare function setSankeyEnd(data: SankeyData, link: number, end: 'source' | 'target', name: string): SankeyData;
1417
+ /** `data` without node `name`: every link to or from it is taken out. Throws on a node it does not hold. */
1418
+ declare function removeSankeyNode(data: SankeyData, name: string): SankeyData;
1419
+
1420
+ /** `data` with `field` inserted before field `at`, the fields after it moved along by its width; absent, an 8-bit
1421
+ * field just after the one before, under a fresh label. */
1422
+ declare function insertPacketField(data: PacketData, at: number, field?: PacketField): PacketData;
1423
+ /** `data` without field `field`, the fields after it moved back by its width. Throws on a field it does not hold. */
1424
+ declare function removePacketField(data: PacketData, field: number): PacketData;
1425
+ /** `data` with field `from` moved to index `to`, counted once it is taken out. Each field keeps its width and the
1426
+ * gap before each place is kept, so the fields are laid again from the first one's start. */
1427
+ declare function movePacketField(data: PacketData, from: number, to: number): PacketData;
1428
+ /** `data` with field `field` `bits` wide, a whole number at least 1, the fields after it moved by the change. */
1429
+ declare function setPacketBits(data: PacketData, field: number, bits: number): PacketData;
1430
+ /** `data` with field `field` starting at bit `start`, the fields after it moved along with it. Throws on a start
1431
+ * inside the field before it. */
1432
+ declare function setPacketStart(data: PacketData, field: number, start: number): PacketData;
1433
+ /** `data` with field `field` written as a count of bits after the field before (`+8`), or as a range. */
1434
+ declare const setPacketRelative: (data: PacketData, field: number, relative: boolean) => PacketData;
1435
+ /** `data` with `bits` to a row; `undefined` for the default 32. */
1436
+ declare function setPacketBitsPerRow(data: PacketData, bits: number | undefined): PacketData;
1437
+
1438
+ /** `data` with `axis` inserted before axis `at`, every curve 0 on it; absent, an axis under a fresh id. */
1439
+ declare function insertRadarAxis(data: RadarData, at: number, axis?: RadarAxis): RadarData;
1440
+ /** `data` without axis `axis` and each curve's value on it. Throws on an axis it does not hold. */
1441
+ declare function removeRadarAxis(data: RadarData, axis: number): RadarData;
1442
+ /** `data` with axis `from` moved to index `to`, counted once it is taken out, each curve's value on it moving too. */
1443
+ declare function moveRadarAxis(data: RadarData, from: number, to: number): RadarData;
1444
+ /** `data` with `curve` inserted before curve `at`; absent, a curve of zeros under a fresh id. */
1445
+ declare function insertRadarCurve(data: RadarData, at: number, curve?: RadarCurve): RadarData;
1446
+ /** `data` without curve `curve`. Throws on a curve it does not hold. */
1447
+ declare const removeRadarCurve: (data: RadarData, curve: number) => RadarData;
1448
+ /** `data` with curve `from` moved to index `to`, counted once it is taken out. */
1449
+ declare const moveRadarCurve: (data: RadarData, from: number, to: number) => RadarData;
1450
+ /** `data` with axis `axis`'s id set to `id`. Throws on an id that is not a word or another axis holds. */
1451
+ declare function setRadarAxisId(data: RadarData, axis: number, id: string): RadarData;
1452
+ /** `data` with curve `curve`'s id set to `id`. Throws on an id that is not a word or another curve holds. */
1453
+ declare function setRadarCurveId(data: RadarData, curve: number, id: string): RadarData;
1454
+ /** `data` with option `key` set to `value`; `undefined` drops it, for its default. */
1455
+ declare function setRadarOption<K extends 'min' | 'max' | 'ticks' | 'graticule' | 'showLegend'>(data: RadarData, key: K, value: RadarData[K] | undefined): RadarData;
1456
+
1457
+ export { type ArcMarkOptions, type AreaMarkOptions, type AxisOptions, type AxisSide, BandScale, type BarMarkOptions, CHART_PAD, GANTT_DATE_FORMAT, GIT_COMMAND_FIELDS, GIT_COMMAND_KINDS, GRAB_PLOT_HANDLE_ACTION_ID, type GanttData, type GanttEnd, type GanttLayout, type GanttSchedule, type GanttSection, type GanttSpan, type GanttStart, type GanttTag, type GanttTask, type GanttUnit, type GitBranch, type GitCommand, type GitCommandField, type GitCommit, type GitCommitType, type GitGraphData, type GitGraphLayout, type GitHistory, type JourneyData, type JourneyLayout, type JourneySection, type JourneyTask, type LineMarkOptions, LinearScale, PLOT_DRAG_ACTION_ID, PLOT_FONT, PLOT_HANDLE_AFFORDANCE_KIND, PLOT_HANDLE_LAYER_ID, PLOT_THEME, type PacketData, type PacketField, type PacketLayout, type PacketPiece, type PieData, type PieLayout, type PieSlice, PlotBox, type PlotColumn, type PlotCompiler, type PlotData, PlotDatum, type PlotDragOptions, type PlotEdit, type PlotEditor, type PlotField, type PlotFont, type PlotHandle, type PlotHandleScratch, type PlotKind, PlotMark, PlotMarkData, PlotMarkTrait, type PlotMeasure, PlotPoint, type PlotRootData, type PlotRootTrait, type PlotSceneData, type PlotSchema, type PlotScope, type PlotSpec, type PlotSpecsOptions, type PlotTable, type PlotTheme, type PlotValue, type PlotValueType, PlotView, type PlotViewProps, type PointMarkOptions, PolarScale, type QuadrantAxis, type QuadrantData, type QuadrantLayout, type QuadrantPoint, type QuadrantPointStyle, type RadarAxis, type RadarCurve, type RadarData, type RadarLayout, type ReplacePlotOptions, type RibbonMarkOptions, type RuleMarkOptions, type SankeyData, type SankeyLayout, type SankeyLink, type SankeyNodeBox, type SankeyRibbon, Scale, type SpanMarkOptions, type TextMarkOptions, TimeScale, type TimelineData, type TimelineLayout, type TimelinePeriod, type TimelineSection, type XyBandAxis, type XyChartData, type XyLayout, type XyRangeAxis, type XySeries, type XyValueAxis, arcMark, areaMark, axisMarks, axisRoom, barMark, chartTitle, commitPlotToScene, compileGantt, compileGitGraph, compileJourney, compilePacket, compilePie, compilePlot, compileQuadrant, compileRadar, compileSankey, compileTimeline, compileXyChart, createPlotDragAction, foldPlotText, formatGanttDate, formatGanttEnd, formatGanttStart, gitBranchNames, handlesOf, insertGanttSection, insertGanttTask, insertGitCommand, insertJourneySection, insertJourneyTask, insertPacketField, insertPieSlice, insertQuadrantClass, insertQuadrantPoint, insertRadarAxis, insertRadarCurve, insertSankeyLink, insertTimelineEvent, insertTimelinePeriod, insertTimelineSection, insertXyRow, insertXySeries, isPlotText, lineMark, markSpecs, moveGanttSection, moveGanttTask, moveGanttTaskToSection, moveGitCommand, moveJourneySection, moveJourneyTask, movePacketField, movePieSlice, moveQuadrantClass, moveQuadrantPoint, moveRadarAxis, moveRadarCurve, moveSankeyLink, moveTimelineEvent, moveTimelinePeriod, moveTimelineSection, moveXyRow, moveXySeries, parseGanttDate, parseGanttEnd, parseGanttStart, plotEditing, plotEditorOf, plotHandleLayer, plotHandleScratchOf, plotHandles, plotMarkId, plotMarkOf, plotOrigin, plotRootContaining, plotRootOf, plotRootsIn, plotSchemaOf, plotSpecs, plotTablesIn, plotTextOf, plotThemeFrom, pointMark, quadrantClassNames, removeGanttSection, removeGanttTask, removeGitCommand, removeJourneySection, removeJourneyTask, removePacketField, removePieSlice, removeQuadrantClass, removeQuadrantPoint, removeRadarAxis, removeRadarCurve, removeSankeyLink, removeSankeyNode, removeTimelineEvent, removeTimelinePeriod, removeTimelineSection, removeXyRow, removeXySeries, renameQuadrantClass, renameSankeyNode, reorderGanttTask, reorderTimelinePeriod, replacePlotData, replayGitGraph, ribbonMark, ruleMark, sankeyLayout, scheduleGantt, seriesColor, setGanttEnd, setGanttExcludes, setGanttSectionName, setGanttSetting, setGanttTaskEnd, setGanttTaskId, setGanttTaskName, setGanttTaskStart, setGanttTaskTags, setGitCommand, setGitCommandField, setGitCommandKind, setGitMainBranch, setGitOrientation, setGitTag, setJourneyActors, setJourneyScore, setJourneySectionName, setJourneyTaskName, setPacketBits, setPacketBitsPerRow, setPacketLabel, setPacketRelative, setPacketStart, setPieLabel, setPieShowData, setPieValue, setQuadrantAxisLabel, setQuadrantClassStyle, setQuadrantLabel, setQuadrantPoint, setQuadrantPointClass, setQuadrantPointName, setQuadrantPointStyle, setRadarAxisId, setRadarAxisLabel, setRadarCurveId, setRadarCurveLabel, setRadarOption, setRadarValue, setSankeyEnd, setSankeyValue, setTimelineEvent, setTimelinePeriodLabel, setTimelineSectionName, setXyAxisTitle, setXyCategory, setXyOrientation, setXyRangeBound, setXySeriesKind, setXySeriesName, setXyValue, setXyValueBound, setXyXKind, spanMark, textMark, textMeasure, timelineFlatIndex, usePlotTextEdit, withTitle, xyLength, xyRows, xyValueAt, xyValueDomain };