@pixerate/editor 0.164.0 → 0.166.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/dist/agent/index.cjs +54 -39
- package/dist/agent/index.js +24 -9
- package/dist/animation/index.cjs +6 -5
- package/dist/animation/index.js +5 -4
- package/dist/animation-editor/index.cjs +65 -64
- package/dist/animation-editor/index.js +8 -7
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/canvas/index.cjs +89 -87
- package/dist/canvas/index.js +11 -9
- package/dist/chart/controller.d.cts +60 -2
- package/dist/chart/controller.d.ts +60 -2
- package/dist/chart/index.cjs +657 -163
- package/dist/chart/index.d.cts +3 -0
- package/dist/chart/index.d.ts +3 -0
- package/dist/chart/index.js +512 -18
- package/dist/chart/layout-families.d.cts +14 -0
- package/dist/chart/layout-families.d.ts +14 -0
- package/dist/chart/layout-shared.d.cts +5 -0
- package/dist/chart/layout-shared.d.ts +5 -0
- package/dist/chart/links.d.cts +34 -0
- package/dist/chart/links.d.ts +34 -0
- package/dist/chart/mermaid.d.cts +9 -6
- package/dist/chart/mermaid.d.ts +9 -6
- package/dist/chart/race.d.cts +26 -0
- package/dist/chart/race.d.ts +26 -0
- package/dist/chart/schemas.d.cts +5 -0
- package/dist/chart/schemas.d.ts +5 -0
- package/dist/chart/spec.d.cts +3 -2
- package/dist/chart/spec.d.ts +3 -2
- package/dist/chart/style.d.cts +33 -0
- package/dist/chart/style.d.ts +33 -0
- package/dist/chart/types.d.cts +28 -2
- package/dist/chart/types.d.ts +28 -2
- package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
- package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
- package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
- package/dist/{chunk-5FNGLV2D.js → chunk-5UNQDC3Q.js} +18 -3
- package/dist/{chunk-YSAGBIRW.cjs → chunk-6FYIFGBW.cjs} +16 -16
- package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
- package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
- package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
- package/dist/{chunk-R3P2M7HU.cjs → chunk-BPX4Z3N3.cjs} +355 -207
- package/dist/{chunk-D54JHQK2.cjs → chunk-CHLV7UFP.cjs} +51 -51
- package/dist/{chunk-OXERWBKE.js → chunk-DFCAR7AW.js} +3 -3
- package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
- package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
- package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
- package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-3NEZJCBY.js → chunk-FR432ROA.js} +349 -201
- package/dist/chunk-HIDFL5LQ.js +484 -0
- package/dist/{chunk-22KLZZGH.cjs → chunk-HXOBOHH2.cjs} +8 -8
- package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
- package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
- package/dist/{chunk-Z4P2RBMJ.js → chunk-ITANXMZD.js} +177 -3
- package/dist/chunk-KGRZMHZB.js +204 -0
- package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
- package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
- package/dist/{chunk-NZD2MZJC.cjs → chunk-MZFZSVUJ.cjs} +38 -23
- package/dist/{chunk-DAPQGA55.js → chunk-NQQDGGXY.js} +2 -2
- package/dist/chunk-O6OGNDND.js +164 -0
- package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
- package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
- package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
- package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
- package/dist/{chunk-YGG7WDWT.cjs → chunk-SZWVMB3B.cjs} +24 -18
- package/dist/chunk-TFF2GTGN.cjs +153 -0
- package/dist/chunk-TTCJPX4U.cjs +204 -0
- package/dist/{chunk-SBQVEBSU.cjs → chunk-UUUTEVX6.cjs} +242 -68
- package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
- package/dist/{chunk-GKNEJ6EN.cjs → chunk-V5L2G22R.cjs} +321 -107
- package/dist/{chunk-TALQONZ5.js → chunk-VB2CY6EG.js} +3 -3
- package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
- package/dist/chunk-VU6WQSMB.cjs +164 -0
- package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
- package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
- package/dist/{chunk-POR54B55.js → chunk-XNU45TYA.js} +7 -1
- package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
- package/dist/chunk-YBAPT7NL.js +153 -0
- package/dist/{chunk-SZA42R4N.js → chunk-YUFTVNLX.js} +230 -16
- package/dist/chunk-Z2UQYMPS.cjs +484 -0
- package/dist/color/index.cjs +5 -3
- package/dist/color/index.js +12 -10
- package/dist/diagram/index.cjs +55 -243
- package/dist/diagram/index.js +12 -200
- package/dist/export/index.cjs +7 -6
- package/dist/export/index.js +6 -5
- package/dist/extensions/index.cjs +12 -9
- package/dist/extensions/index.js +11 -8
- package/dist/gradient/index.cjs +29 -27
- package/dist/gradient/index.js +6 -4
- package/dist/image-editor/index.cjs +644 -643
- package/dist/image-editor/index.js +7 -6
- package/dist/index.cjs +21 -18
- package/dist/index.js +14 -11
- package/dist/paint-editor/index.cjs +19 -18
- package/dist/paint-editor/index.js +7 -6
- package/dist/parameters/index.cjs +2 -2
- package/dist/parameters/index.js +1 -1
- package/dist/persistence/assetWrites.d.cts +22 -0
- package/dist/persistence/assetWrites.d.ts +22 -0
- package/dist/persistence/assets.d.cts +71 -0
- package/dist/persistence/assets.d.ts +71 -0
- package/dist/persistence/documentStore.d.cts +17 -1
- package/dist/persistence/documentStore.d.ts +17 -1
- package/dist/persistence/documentTools.d.cts +5 -1
- package/dist/persistence/documentTools.d.ts +5 -1
- package/dist/persistence/editorAutosave.d.cts +7 -0
- package/dist/persistence/editorAutosave.d.ts +7 -0
- package/dist/persistence/index.cjs +141 -21
- package/dist/persistence/index.js +130 -10
- package/dist/persistence/storage.d.cts +13 -1
- package/dist/persistence/storage.d.ts +13 -1
- package/dist/spreadsheet/index.cjs +3 -3
- package/dist/spreadsheet/index.js +2 -2
- package/dist/tokens/index.cjs +11 -3
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +10 -2
- package/dist/tokens/style.d.cts +36 -0
- package/dist/tokens/style.d.ts +36 -0
- package/dist/tools/index.cjs +15 -3
- package/dist/tools/index.d.cts +2 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +14 -2
- package/dist/tools/style-tools.d.cts +19 -0
- package/dist/tools/style-tools.d.ts +19 -0
- package/dist/tools/style.d.cts +212 -0
- package/dist/tools/style.d.ts +212 -0
- package/dist/tools/view.d.cts +6 -0
- package/dist/tools/view.d.ts +6 -0
- package/dist/typography/index.cjs +8 -6
- package/dist/typography/index.js +5 -3
- package/dist/vector/index.cjs +953 -952
- package/dist/vector/index.js +7 -6
- package/dist/video-editor/index.cjs +8 -7
- package/dist/video-editor/index.js +6 -5
- package/package.json +1 -1
- package/skills/pixerate-chart/SKILL.md +20 -2
- package/dist/chunk-ERAGQL2N.cjs +0 -68
- package/dist/chunk-KMU6QJB7.js +0 -68
|
@@ -38,3 +38,17 @@ export declare function layoutTreemapTree(ctx: LayoutCtx, area: ChartRect, serie
|
|
|
38
38
|
* wide enough for them; the total and `sunburstLabel` sit in the centre.
|
|
39
39
|
*/
|
|
40
40
|
export declare function layoutSunburst(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
41
|
+
/**
|
|
42
|
+
* Sankey: `spec.links` as flows between columns of nodes. A node's column is the longest chain
|
|
43
|
+
* of flows into it, and nodes nothing flows out of line up in the last column. Node heights and
|
|
44
|
+
* flow widths share one scale (the tightest column fills the height); flows leave and arrive
|
|
45
|
+
* in the order of the nodes at their other end, so they cross as little as the order allows.
|
|
46
|
+
*/
|
|
47
|
+
export declare function layoutSankey(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
48
|
+
/**
|
|
49
|
+
* Bar race: the top `raceTopN` names at one moment (`frame`, a fractional category index;
|
|
50
|
+
* default the last time point) as ranked horizontal bars. Values ease between time points and
|
|
51
|
+
* places slide from one ranking to the next, so drawing frame after frame (or blending scenes,
|
|
52
|
+
* which match bars by series) animates the race. The time point is written large in a corner.
|
|
53
|
+
*/
|
|
54
|
+
export declare function layoutBarRace(ctx: LayoutCtx, area: ChartRect, frame: number | null | undefined): FamilyResult;
|
|
@@ -38,3 +38,17 @@ export declare function layoutTreemapTree(ctx: LayoutCtx, area: ChartRect, serie
|
|
|
38
38
|
* wide enough for them; the total and `sunburstLabel` sit in the centre.
|
|
39
39
|
*/
|
|
40
40
|
export declare function layoutSunburst(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
41
|
+
/**
|
|
42
|
+
* Sankey: `spec.links` as flows between columns of nodes. A node's column is the longest chain
|
|
43
|
+
* of flows into it, and nodes nothing flows out of line up in the last column. Node heights and
|
|
44
|
+
* flow widths share one scale (the tightest column fills the height); flows leave and arrive
|
|
45
|
+
* in the order of the nodes at their other end, so they cross as little as the order allows.
|
|
46
|
+
*/
|
|
47
|
+
export declare function layoutSankey(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
48
|
+
/**
|
|
49
|
+
* Bar race: the top `raceTopN` names at one moment (`frame`, a fractional category index;
|
|
50
|
+
* default the last time point) as ranked horizontal bars. Values ease between time points and
|
|
51
|
+
* places slide from one ranking to the next, so drawing frame after frame (or blending scenes,
|
|
52
|
+
* which match bars by series) animates the race. The time point is written large in a corner.
|
|
53
|
+
*/
|
|
54
|
+
export declare function layoutBarRace(ctx: LayoutCtx, area: ChartRect, frame: number | null | undefined): FamilyResult;
|
|
@@ -34,6 +34,11 @@ export interface ChartLayoutOptions {
|
|
|
34
34
|
seriesId: string;
|
|
35
35
|
index: number;
|
|
36
36
|
} | null;
|
|
37
|
+
/**
|
|
38
|
+
* Bar race: the moment to draw, as a category index that may be fractional (2.5 is halfway
|
|
39
|
+
* between the third and fourth time points). Default: the last time point.
|
|
40
|
+
*/
|
|
41
|
+
raceFrame?: number | null;
|
|
37
42
|
}
|
|
38
43
|
/** A DOM-free text width estimate (average glyph ≈ 0.56 em, bold ≈ 0.6 em). */
|
|
39
44
|
export declare const estimateChartTextWidth: ChartTextMeasure;
|
|
@@ -34,6 +34,11 @@ export interface ChartLayoutOptions {
|
|
|
34
34
|
seriesId: string;
|
|
35
35
|
index: number;
|
|
36
36
|
} | null;
|
|
37
|
+
/**
|
|
38
|
+
* Bar race: the moment to draw, as a category index that may be fractional (2.5 is halfway
|
|
39
|
+
* between the third and fourth time points). Default: the last time point.
|
|
40
|
+
*/
|
|
41
|
+
raceFrame?: number | null;
|
|
37
42
|
}
|
|
38
43
|
/** A DOM-free text width estimate (average glyph ≈ 0.56 em, bold ≈ 0.6 em). */
|
|
39
44
|
export declare const estimateChartTextWidth: ChartTextMeasure;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ChartIssue, ChartLink } from './types.cjs';
|
|
2
|
+
/** Most flows a chart may have. */
|
|
3
|
+
export declare const MAX_CHART_LINKS = 2000;
|
|
4
|
+
/**
|
|
5
|
+
* Checks flows: each has a source and a target (different names) and a value above 0, a pair
|
|
6
|
+
* appears once, and flows only go forwards (a flow that would close a loop is dropped, since a
|
|
7
|
+
* Sankey diagram cannot draw one). Problems are reported with the flow's index.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeChartLinks(value: unknown, issues?: ChartIssue[], path?: string): ChartLink[];
|
|
10
|
+
/**
|
|
11
|
+
* The nodes of a set of flows, in `order` first (names no flow uses are reported and dropped),
|
|
12
|
+
* then any others as the flows first name them.
|
|
13
|
+
*/
|
|
14
|
+
export declare function chartSankeyNodes(links: readonly ChartLink[], order?: readonly string[], issues?: ChartIssue[]): string[];
|
|
15
|
+
/** How much flows through each node: the larger of what comes in and what goes out. */
|
|
16
|
+
export declare function chartSankeyNodeValues(links: readonly ChartLink[], nodes: readonly string[]): number[];
|
|
17
|
+
/**
|
|
18
|
+
* Reads flows from a table of source, target and value columns. With `header` (default
|
|
19
|
+
* `auto`: when the first row's third cell is not a number) the first row is skipped.
|
|
20
|
+
*/
|
|
21
|
+
export declare function chartLinksFromTable(rows: ReadonlyArray<ReadonlyArray<unknown>>, options?: {
|
|
22
|
+
header?: boolean | 'auto';
|
|
23
|
+
}): {
|
|
24
|
+
source: unknown;
|
|
25
|
+
target: unknown;
|
|
26
|
+
value: unknown;
|
|
27
|
+
}[];
|
|
28
|
+
/** Flows with one field of flow `index` set to `text` (for the data grids; `setLinks` checks the result). */
|
|
29
|
+
export declare function setChartLinkField(links: readonly ChartLink[], index: number, field: 'source' | 'target' | 'value', text: string): Record<string, unknown>[];
|
|
30
|
+
/**
|
|
31
|
+
* Flows with a new one at the end: from the last flow's target (or "Start") to a new node
|
|
32
|
+
* named "Step n", carrying the last flow's value (or 1).
|
|
33
|
+
*/
|
|
34
|
+
export declare function addChartLink(links: readonly ChartLink[]): ChartLink[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ChartIssue, ChartLink } from './types.js';
|
|
2
|
+
/** Most flows a chart may have. */
|
|
3
|
+
export declare const MAX_CHART_LINKS = 2000;
|
|
4
|
+
/**
|
|
5
|
+
* Checks flows: each has a source and a target (different names) and a value above 0, a pair
|
|
6
|
+
* appears once, and flows only go forwards (a flow that would close a loop is dropped, since a
|
|
7
|
+
* Sankey diagram cannot draw one). Problems are reported with the flow's index.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeChartLinks(value: unknown, issues?: ChartIssue[], path?: string): ChartLink[];
|
|
10
|
+
/**
|
|
11
|
+
* The nodes of a set of flows, in `order` first (names no flow uses are reported and dropped),
|
|
12
|
+
* then any others as the flows first name them.
|
|
13
|
+
*/
|
|
14
|
+
export declare function chartSankeyNodes(links: readonly ChartLink[], order?: readonly string[], issues?: ChartIssue[]): string[];
|
|
15
|
+
/** How much flows through each node: the larger of what comes in and what goes out. */
|
|
16
|
+
export declare function chartSankeyNodeValues(links: readonly ChartLink[], nodes: readonly string[]): number[];
|
|
17
|
+
/**
|
|
18
|
+
* Reads flows from a table of source, target and value columns. With `header` (default
|
|
19
|
+
* `auto`: when the first row's third cell is not a number) the first row is skipped.
|
|
20
|
+
*/
|
|
21
|
+
export declare function chartLinksFromTable(rows: ReadonlyArray<ReadonlyArray<unknown>>, options?: {
|
|
22
|
+
header?: boolean | 'auto';
|
|
23
|
+
}): {
|
|
24
|
+
source: unknown;
|
|
25
|
+
target: unknown;
|
|
26
|
+
value: unknown;
|
|
27
|
+
}[];
|
|
28
|
+
/** Flows with one field of flow `index` set to `text` (for the data grids; `setLinks` checks the result). */
|
|
29
|
+
export declare function setChartLinkField(links: readonly ChartLink[], index: number, field: 'source' | 'target' | 'value', text: string): Record<string, unknown>[];
|
|
30
|
+
/**
|
|
31
|
+
* Flows with a new one at the end: from the last flow's target (or "Start") to a new node
|
|
32
|
+
* named "Step n", carrying the last flow's value (or 1).
|
|
33
|
+
*/
|
|
34
|
+
export declare function addChartLink(links: readonly ChartLink[]): ChartLink[];
|
package/dist/chart/mermaid.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChartIssue, ChartSpec } from './types.cjs';
|
|
2
2
|
/** The comment line that carries what Mermaid cannot express. Every Mermaid tool ignores `%%` comments. */
|
|
3
3
|
export declare const CHART_MERMAID_META_PREFIX = "%% @pixerate ";
|
|
4
|
-
export type ChartMermaidFamily = 'xychart' | 'pie' | 'radar';
|
|
4
|
+
export type ChartMermaidFamily = 'xychart' | 'pie' | 'radar' | 'sankey' | 'treemap';
|
|
5
5
|
export interface ChartMermaidOptions {
|
|
6
6
|
/** Write the `%% @pixerate {…}` line so the chart round-trips exactly (default `true`). */
|
|
7
7
|
meta?: boolean;
|
|
@@ -9,12 +9,15 @@ export interface ChartMermaidOptions {
|
|
|
9
9
|
indent?: string;
|
|
10
10
|
}
|
|
11
11
|
/** The Mermaid family a chart is written as. */
|
|
12
|
-
export declare function chartMermaidFamily(spec: Pick<ChartSpec, 'type' | 'series'>
|
|
12
|
+
export declare function chartMermaidFamily(spec: Pick<ChartSpec, 'type' | 'series'> & {
|
|
13
|
+
links?: ChartSpec['links'];
|
|
14
|
+
}): ChartMermaidFamily;
|
|
13
15
|
/**
|
|
14
16
|
* Writes a chart as Mermaid: `xychart-beta` for bar, line, area and scatter charts (areas and
|
|
15
17
|
* scatters drawn as lines; slopes and Likert charts as lines and bars), `pie` for pies, donuts,
|
|
16
|
-
* funnels
|
|
17
|
-
*
|
|
18
|
+
* funnels and parliaments, `radar-beta` for radars, `sankey-beta` for Sankey diagrams with
|
|
19
|
+
* flows, and `treemap-beta` for treemaps and sunbursts (their groups, or one item per category).
|
|
20
|
+
* Sankey titles go in frontmatter, which `sankey-beta` needs. Anything Mermaid cannot hold (stacking, colours, formats, gaps, trendlines, other
|
|
18
21
|
* chart types) goes into one `%% @pixerate {…}` comment so `chartFromMermaid` gets the chart
|
|
19
22
|
* back exactly, while any Mermaid renderer still draws the basic chart.
|
|
20
23
|
*/
|
|
@@ -34,7 +37,7 @@ export interface ChartMermaidResult {
|
|
|
34
37
|
hasMeta: boolean;
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
|
-
* Reads Mermaid `xychart-beta`, `pie` or `
|
|
40
|
+
* Reads Mermaid `xychart-beta`, `pie`, `radar-beta`, `sankey-beta` or `treemap-beta` text as a chart. Never throws: lines it
|
|
38
41
|
* cannot read are reported with their line numbers and skipped, and the result always draws.
|
|
39
42
|
* A `%% @pixerate {…}` line written by `chartToMermaid` restores everything Mermaid cannot hold.
|
|
40
43
|
*/
|
|
@@ -47,6 +50,6 @@ export interface FoundChartMermaid {
|
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
52
|
* Finds Mermaid charts in Markdown or chat text: fenced ```mermaid blocks (and unlabelled
|
|
50
|
-
* fences) whose header is xychart-beta, pie or
|
|
53
|
+
* fences) whose header is xychart-beta, pie, radar-beta, sankey-beta or treemap-beta, else the whole text when it is one.
|
|
51
54
|
*/
|
|
52
55
|
export declare function findMermaidCharts(text: string): FoundChartMermaid[];
|
package/dist/chart/mermaid.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChartIssue, ChartSpec } from './types.js';
|
|
2
2
|
/** The comment line that carries what Mermaid cannot express. Every Mermaid tool ignores `%%` comments. */
|
|
3
3
|
export declare const CHART_MERMAID_META_PREFIX = "%% @pixerate ";
|
|
4
|
-
export type ChartMermaidFamily = 'xychart' | 'pie' | 'radar';
|
|
4
|
+
export type ChartMermaidFamily = 'xychart' | 'pie' | 'radar' | 'sankey' | 'treemap';
|
|
5
5
|
export interface ChartMermaidOptions {
|
|
6
6
|
/** Write the `%% @pixerate {…}` line so the chart round-trips exactly (default `true`). */
|
|
7
7
|
meta?: boolean;
|
|
@@ -9,12 +9,15 @@ export interface ChartMermaidOptions {
|
|
|
9
9
|
indent?: string;
|
|
10
10
|
}
|
|
11
11
|
/** The Mermaid family a chart is written as. */
|
|
12
|
-
export declare function chartMermaidFamily(spec: Pick<ChartSpec, 'type' | 'series'>
|
|
12
|
+
export declare function chartMermaidFamily(spec: Pick<ChartSpec, 'type' | 'series'> & {
|
|
13
|
+
links?: ChartSpec['links'];
|
|
14
|
+
}): ChartMermaidFamily;
|
|
13
15
|
/**
|
|
14
16
|
* Writes a chart as Mermaid: `xychart-beta` for bar, line, area and scatter charts (areas and
|
|
15
17
|
* scatters drawn as lines; slopes and Likert charts as lines and bars), `pie` for pies, donuts,
|
|
16
|
-
* funnels
|
|
17
|
-
*
|
|
18
|
+
* funnels and parliaments, `radar-beta` for radars, `sankey-beta` for Sankey diagrams with
|
|
19
|
+
* flows, and `treemap-beta` for treemaps and sunbursts (their groups, or one item per category).
|
|
20
|
+
* Sankey titles go in frontmatter, which `sankey-beta` needs. Anything Mermaid cannot hold (stacking, colours, formats, gaps, trendlines, other
|
|
18
21
|
* chart types) goes into one `%% @pixerate {…}` comment so `chartFromMermaid` gets the chart
|
|
19
22
|
* back exactly, while any Mermaid renderer still draws the basic chart.
|
|
20
23
|
*/
|
|
@@ -34,7 +37,7 @@ export interface ChartMermaidResult {
|
|
|
34
37
|
hasMeta: boolean;
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
|
-
* Reads Mermaid `xychart-beta`, `pie` or `
|
|
40
|
+
* Reads Mermaid `xychart-beta`, `pie`, `radar-beta`, `sankey-beta` or `treemap-beta` text as a chart. Never throws: lines it
|
|
38
41
|
* cannot read are reported with their line numbers and skipped, and the result always draws.
|
|
39
42
|
* A `%% @pixerate {…}` line written by `chartToMermaid` restores everything Mermaid cannot hold.
|
|
40
43
|
*/
|
|
@@ -47,6 +50,6 @@ export interface FoundChartMermaid {
|
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
52
|
* Finds Mermaid charts in Markdown or chat text: fenced ```mermaid blocks (and unlabelled
|
|
50
|
-
* fences) whose header is xychart-beta, pie or
|
|
53
|
+
* fences) whose header is xychart-beta, pie, radar-beta, sankey-beta or treemap-beta, else the whole text when it is one.
|
|
51
54
|
*/
|
|
52
55
|
export declare function findMermaidCharts(text: string): FoundChartMermaid[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChartSeries, ChartSpec } from './types.cjs';
|
|
2
|
+
/** A series' value at time point `index`: its own, else the last value before it (0 before the first). */
|
|
3
|
+
export declare function chartRaceValueAt(series: Pick<ChartSeries, 'values'>, index: number): number;
|
|
4
|
+
/** The moment `frame` stands for: the time points either side and how far between them (0–1). */
|
|
5
|
+
export declare function chartRaceMoment(count: number, frame: number | null | undefined): {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
t: number;
|
|
9
|
+
at: number;
|
|
10
|
+
};
|
|
11
|
+
export interface ChartRaceEntry {
|
|
12
|
+
seriesId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
/** The value at the moment (between time points, eased from one to the next). */
|
|
15
|
+
value: number;
|
|
16
|
+
/** 0-based place at the moment, fractional while two names swap. */
|
|
17
|
+
position: number;
|
|
18
|
+
/** 0-based place at the nearest time point. */
|
|
19
|
+
rank: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Every visible series at a moment, best first: its value between the two time points and its
|
|
23
|
+
* position, which slides from its rank at one time point to its rank at the next so bars swap
|
|
24
|
+
* smoothly. Ties keep the series order.
|
|
25
|
+
*/
|
|
26
|
+
export declare function chartRaceRanking(spec: Pick<ChartSpec, 'series' | 'categories'>, frame: number | null | undefined): ChartRaceEntry[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChartSeries, ChartSpec } from './types.js';
|
|
2
|
+
/** A series' value at time point `index`: its own, else the last value before it (0 before the first). */
|
|
3
|
+
export declare function chartRaceValueAt(series: Pick<ChartSeries, 'values'>, index: number): number;
|
|
4
|
+
/** The moment `frame` stands for: the time points either side and how far between them (0–1). */
|
|
5
|
+
export declare function chartRaceMoment(count: number, frame: number | null | undefined): {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
t: number;
|
|
9
|
+
at: number;
|
|
10
|
+
};
|
|
11
|
+
export interface ChartRaceEntry {
|
|
12
|
+
seriesId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
/** The value at the moment (between time points, eased from one to the next). */
|
|
15
|
+
value: number;
|
|
16
|
+
/** 0-based place at the moment, fractional while two names swap. */
|
|
17
|
+
position: number;
|
|
18
|
+
/** 0-based place at the nearest time point. */
|
|
19
|
+
rank: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Every visible series at a moment, best first: its value between the two time points and its
|
|
23
|
+
* position, which slides from its rank at one time point to its rank at the next so bars swap
|
|
24
|
+
* smoothly. Ties keep the series order.
|
|
25
|
+
*/
|
|
26
|
+
export declare function chartRaceRanking(spec: Pick<ChartSpec, 'series' | 'categories'>, frame: number | null | undefined): ChartRaceEntry[];
|
package/dist/chart/schemas.d.cts
CHANGED
|
@@ -20,6 +20,11 @@ export declare const TREE_DEFS: {
|
|
|
20
20
|
chartTreeNode: JsonSchema;
|
|
21
21
|
};
|
|
22
22
|
export declare const TREE_PATH: JsonSchema;
|
|
23
|
+
/** One Sankey flow's fields; source, target and value are required when adding. */
|
|
24
|
+
export declare const LINK_PROPS: Record<string, JsonSchema>;
|
|
25
|
+
/** A moment of a bar race: a time point by label, or a category index (fractional between time points). */
|
|
26
|
+
export declare const RACE_TIME: JsonSchema;
|
|
27
|
+
export declare const LINK_INDEX: JsonSchema;
|
|
23
28
|
export declare const ERROR_BARS: (what: string) => JsonSchema;
|
|
24
29
|
export declare const SERIES_PROPS: Record<string, JsonSchema>;
|
|
25
30
|
export declare const CHART_UPDATE_PROPERTIES: Record<string, JsonSchema>;
|
package/dist/chart/schemas.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export declare const TREE_DEFS: {
|
|
|
20
20
|
chartTreeNode: JsonSchema;
|
|
21
21
|
};
|
|
22
22
|
export declare const TREE_PATH: JsonSchema;
|
|
23
|
+
/** One Sankey flow's fields; source, target and value are required when adding. */
|
|
24
|
+
export declare const LINK_PROPS: Record<string, JsonSchema>;
|
|
25
|
+
/** A moment of a bar race: a time point by label, or a category index (fractional between time points). */
|
|
26
|
+
export declare const RACE_TIME: JsonSchema;
|
|
27
|
+
export declare const LINK_INDEX: JsonSchema;
|
|
23
28
|
export declare const ERROR_BARS: (what: string) => JsonSchema;
|
|
24
29
|
export declare const SERIES_PROPS: Record<string, JsonSchema>;
|
|
25
30
|
export declare const CHART_UPDATE_PROPERTIES: Record<string, JsonSchema>;
|
package/dist/chart/spec.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartLikertNeutral, ChartLikertSort, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartReferenceAxis, ChartReferenceBand, ChartReferenceLine, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.cjs';
|
|
1
|
+
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartLikertNeutral, ChartLikertSort, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartReferenceAxis, ChartReferenceBand, ChartReferenceLine, ChartSankeyLinkColor, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.cjs';
|
|
2
2
|
export declare const CHART_TYPES: readonly ChartType[];
|
|
3
3
|
export declare const CHART_MARKERS: readonly ChartMarker[];
|
|
4
4
|
export declare const CHART_TRENDLINE_TYPES: readonly ChartTrendlineType[];
|
|
@@ -11,6 +11,7 @@ export declare const CHART_CURVES: readonly ChartCurve[];
|
|
|
11
11
|
export declare const CHART_RADAR_GRATICULES: readonly ChartRadarGraticule[];
|
|
12
12
|
export declare const CHART_LIKERT_NEUTRALS: readonly ChartLikertNeutral[];
|
|
13
13
|
export declare const CHART_LIKERT_SORTS: readonly ChartLikertSort[];
|
|
14
|
+
export declare const CHART_SANKEY_LINK_COLORS: readonly ChartSankeyLinkColor[];
|
|
14
15
|
export declare const CHART_REFERENCE_AXES: readonly ChartReferenceAxis[];
|
|
15
16
|
export declare const CHART_ORIENTATIONS: readonly ChartOrientation[];
|
|
16
17
|
export declare const CHART_LEGEND_POSITIONS: readonly ChartLegendPosition[];
|
|
@@ -18,7 +19,7 @@ export declare const CHART_NUMBER_STYLES: readonly NonNullable<ChartNumberFormat
|
|
|
18
19
|
/** Labels for pickers, shared by the React and Svelte components. */
|
|
19
20
|
export declare const CHART_TYPE_LABELS: Readonly<Record<ChartType, string>>;
|
|
20
21
|
/** How a chart type is laid out. */
|
|
21
|
-
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst';
|
|
22
|
+
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace';
|
|
22
23
|
/** A colour-blind-friendly categorical palette (Okabe–Ito order, tuned for light and dark backgrounds). */
|
|
23
24
|
export declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
24
25
|
export declare const DEFAULT_CHART_THEME: ChartTheme;
|
package/dist/chart/spec.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartLikertNeutral, ChartLikertSort, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartReferenceAxis, ChartReferenceBand, ChartReferenceLine, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.js';
|
|
1
|
+
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartLikertNeutral, ChartLikertSort, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartReferenceAxis, ChartReferenceBand, ChartReferenceLine, ChartSankeyLinkColor, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.js';
|
|
2
2
|
export declare const CHART_TYPES: readonly ChartType[];
|
|
3
3
|
export declare const CHART_MARKERS: readonly ChartMarker[];
|
|
4
4
|
export declare const CHART_TRENDLINE_TYPES: readonly ChartTrendlineType[];
|
|
@@ -11,6 +11,7 @@ export declare const CHART_CURVES: readonly ChartCurve[];
|
|
|
11
11
|
export declare const CHART_RADAR_GRATICULES: readonly ChartRadarGraticule[];
|
|
12
12
|
export declare const CHART_LIKERT_NEUTRALS: readonly ChartLikertNeutral[];
|
|
13
13
|
export declare const CHART_LIKERT_SORTS: readonly ChartLikertSort[];
|
|
14
|
+
export declare const CHART_SANKEY_LINK_COLORS: readonly ChartSankeyLinkColor[];
|
|
14
15
|
export declare const CHART_REFERENCE_AXES: readonly ChartReferenceAxis[];
|
|
15
16
|
export declare const CHART_ORIENTATIONS: readonly ChartOrientation[];
|
|
16
17
|
export declare const CHART_LEGEND_POSITIONS: readonly ChartLegendPosition[];
|
|
@@ -18,7 +19,7 @@ export declare const CHART_NUMBER_STYLES: readonly NonNullable<ChartNumberFormat
|
|
|
18
19
|
/** Labels for pickers, shared by the React and Svelte components. */
|
|
19
20
|
export declare const CHART_TYPE_LABELS: Readonly<Record<ChartType, string>>;
|
|
20
21
|
/** How a chart type is laid out. */
|
|
21
|
-
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst';
|
|
22
|
+
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace';
|
|
22
23
|
/** A colour-blind-friendly categorical palette (Okabe–Ito order, tuned for light and dark backgrounds). */
|
|
23
24
|
export declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
24
25
|
export declare const DEFAULT_CHART_THEME: ChartTheme;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* House style for charts: the `chart.json` profile (palette, allowed colour schemes and
|
|
3
|
+
* layouts, theme, defaults for new charts), its checks, and `check_chart_style`.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentToolProvider } from '../tools/registry.cjs';
|
|
6
|
+
import type { StyleDomain, StyleResolver } from '../tools/style.cjs';
|
|
7
|
+
import type { ChartSpec } from './types.cjs';
|
|
8
|
+
import type { ChartController } from './controller.cjs';
|
|
9
|
+
/** A chart's `chart.json` house-style profile, after `$token` references are resolved. */
|
|
10
|
+
export interface ChartStyleProfile {
|
|
11
|
+
/** Series colours in order: the house palette. */
|
|
12
|
+
palette?: string[];
|
|
13
|
+
/** `CHART_COLOR_SCHEMES` ids allowed besides the palette. */
|
|
14
|
+
colorSchemes?: string[];
|
|
15
|
+
/** `CHART_LAYOUT_PRESETS` ids allowed. */
|
|
16
|
+
layouts?: string[];
|
|
17
|
+
/** Colours and type to draw charts with (the `theme` option of the chart renderers). */
|
|
18
|
+
theme?: Partial<Record<'background' | 'surface' | 'text' | 'mutedText' | 'grid' | 'axis' | 'positive' | 'negative' | 'fontFamily', string> & Record<'fontSize' | 'titleSize', number>>;
|
|
19
|
+
/** Spec values new charts start from. */
|
|
20
|
+
defaults?: Partial<Pick<ChartSpec, 'dataLabels' | 'points' | 'curve' | 'stacking' | 'orientation' | 'labelPosition'>>;
|
|
21
|
+
}
|
|
22
|
+
/** The chart house-style domain: register it with `createStyleResolver({ domains })`. */
|
|
23
|
+
export declare const chartStyleDomain: StyleDomain<ChartSpec>;
|
|
24
|
+
/** The spec patch that starts a chart in the house style: the palette and the defaults. */
|
|
25
|
+
export declare function chartStylePatch(profile: Readonly<Record<string, unknown>>): Partial<ChartSpec>;
|
|
26
|
+
export interface ChartStyleToolProviderOptions {
|
|
27
|
+
/** Provider id (unique per registry). Default `chart-style`. */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Tool-name prefix; defaults to `chart`, so `check_chart_style` joins the chart toolset. */
|
|
30
|
+
namespace?: string;
|
|
31
|
+
}
|
|
32
|
+
/** `check_chart_style`: runs the chart house-style checks against a chart. */
|
|
33
|
+
export declare function createChartStyleToolProvider(controller: ChartController, styles: StyleResolver, options?: ChartStyleToolProviderOptions): AgentToolProvider;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* House style for charts: the `chart.json` profile (palette, allowed colour schemes and
|
|
3
|
+
* layouts, theme, defaults for new charts), its checks, and `check_chart_style`.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentToolProvider } from '../tools/registry.js';
|
|
6
|
+
import type { StyleDomain, StyleResolver } from '../tools/style.js';
|
|
7
|
+
import type { ChartSpec } from './types.js';
|
|
8
|
+
import type { ChartController } from './controller.js';
|
|
9
|
+
/** A chart's `chart.json` house-style profile, after `$token` references are resolved. */
|
|
10
|
+
export interface ChartStyleProfile {
|
|
11
|
+
/** Series colours in order: the house palette. */
|
|
12
|
+
palette?: string[];
|
|
13
|
+
/** `CHART_COLOR_SCHEMES` ids allowed besides the palette. */
|
|
14
|
+
colorSchemes?: string[];
|
|
15
|
+
/** `CHART_LAYOUT_PRESETS` ids allowed. */
|
|
16
|
+
layouts?: string[];
|
|
17
|
+
/** Colours and type to draw charts with (the `theme` option of the chart renderers). */
|
|
18
|
+
theme?: Partial<Record<'background' | 'surface' | 'text' | 'mutedText' | 'grid' | 'axis' | 'positive' | 'negative' | 'fontFamily', string> & Record<'fontSize' | 'titleSize', number>>;
|
|
19
|
+
/** Spec values new charts start from. */
|
|
20
|
+
defaults?: Partial<Pick<ChartSpec, 'dataLabels' | 'points' | 'curve' | 'stacking' | 'orientation' | 'labelPosition'>>;
|
|
21
|
+
}
|
|
22
|
+
/** The chart house-style domain: register it with `createStyleResolver({ domains })`. */
|
|
23
|
+
export declare const chartStyleDomain: StyleDomain<ChartSpec>;
|
|
24
|
+
/** The spec patch that starts a chart in the house style: the palette and the defaults. */
|
|
25
|
+
export declare function chartStylePatch(profile: Readonly<Record<string, unknown>>): Partial<ChartSpec>;
|
|
26
|
+
export interface ChartStyleToolProviderOptions {
|
|
27
|
+
/** Provider id (unique per registry). Default `chart-style`. */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Tool-name prefix; defaults to `chart`, so `check_chart_style` joins the chart toolset. */
|
|
30
|
+
namespace?: string;
|
|
31
|
+
}
|
|
32
|
+
/** `check_chart_style`: runs the chart house-style checks against a chart. */
|
|
33
|
+
export declare function createChartStyleToolProvider(controller: ChartController, styles: StyleResolver, options?: ChartStyleToolProviderOptions): AgentToolProvider;
|
package/dist/chart/types.d.cts
CHANGED
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
* - `parliament` draws the first series as seats in a hemicycle, one colour per category.
|
|
17
17
|
* - `sunburst` draws `tree` as rings from the centre out (or, without a tree, the first series
|
|
18
18
|
* as one ring); a `treemap` with a `tree` nests each group's rectangles inside it.
|
|
19
|
+
* - `sankey` draws `links` as flows between columns of nodes.
|
|
20
|
+
* - `barrace` reads each category as a time point and each series as a name, and draws the
|
|
21
|
+
* top `raceTopN` names at one moment as ranked horizontal bars (an animated ranking).
|
|
19
22
|
*/
|
|
20
|
-
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst';
|
|
23
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace';
|
|
21
24
|
/** How a series is drawn in a cartesian chart. */
|
|
22
25
|
export type ChartSeriesType = 'bar' | 'line' | 'area' | 'scatter';
|
|
23
26
|
/** One data value; `null` is a gap (missing value). */
|
|
@@ -122,6 +125,17 @@ export interface ChartTreeNode {
|
|
|
122
125
|
/** CSS colour (default: the palette colour of its top-level group, lighter further in). */
|
|
123
126
|
color?: string;
|
|
124
127
|
}
|
|
128
|
+
/** One flow of a Sankey diagram, from one named node to another. */
|
|
129
|
+
export interface ChartLink {
|
|
130
|
+
source: string;
|
|
131
|
+
target: string;
|
|
132
|
+
/** Above 0. */
|
|
133
|
+
value: number;
|
|
134
|
+
/** CSS colour (default: by `sankeyLinkColor`). */
|
|
135
|
+
color?: string;
|
|
136
|
+
}
|
|
137
|
+
/** What colours each flow of a Sankey diagram: its source node, its target node, or grey. */
|
|
138
|
+
export type ChartSankeyLinkColor = 'source' | 'target' | 'gray';
|
|
125
139
|
/** Which axis a reference line or band is measured on: the value axis, the secondary value axis, or the numeric x axis of a scatter or bubble chart. */
|
|
126
140
|
export type ChartReferenceAxis = 'y' | 'y2' | 'x';
|
|
127
141
|
/** A line across the plot at one value: a target, a floor, an average. */
|
|
@@ -277,6 +291,18 @@ export interface ChartSpec {
|
|
|
277
291
|
tree: ChartTreeNode[];
|
|
278
292
|
/** Sunburst: the caption under the total in the centre ("" for none). */
|
|
279
293
|
sunburstLabel: string;
|
|
294
|
+
/**
|
|
295
|
+
* Flows between named nodes (Sankey diagrams). When set they are the chart's data: the
|
|
296
|
+
* categories are the nodes (in `sankeyNodes` order) and the first series holds how much flows
|
|
297
|
+
* through each (the larger of in and out), so other types draw those amounts.
|
|
298
|
+
*/
|
|
299
|
+
links: ChartLink[];
|
|
300
|
+
/** Sankey: the order nodes are listed and stacked in (default: as the links first name them). */
|
|
301
|
+
sankeyNodes: string[];
|
|
302
|
+
/** Sankey: what colours each flow. */
|
|
303
|
+
sankeyLinkColor: ChartSankeyLinkColor;
|
|
304
|
+
/** Bar race: how many bars each moment shows, 1–30. */
|
|
305
|
+
raceTopN: number;
|
|
280
306
|
}
|
|
281
307
|
/** What a click selects. */
|
|
282
308
|
export type ChartSelection = {
|
|
@@ -332,7 +358,7 @@ export interface ChartRect {
|
|
|
332
358
|
height: number;
|
|
333
359
|
}
|
|
334
360
|
/** What a mark is, for styling and tests. */
|
|
335
|
-
export type ChartMarkRole = 'background' | 'title' | 'subtitle' | 'grid' | 'axis' | 'tick' | 'tick-label' | 'axis-title' | 'bar' | 'line' | 'area' | 'point' | 'slice' | 'cell' | 'box' | 'whisker' | 'outlier' | 'connector' | 'trendline' | 'trendline-label' | 'error-bar' | 'data-label' | 'legend-swatch' | 'legend-label' | 'drag-readout' | 'reference-line' | 'reference-band' | 'reference-label' | 'callout' | 'note' | 'selection' | 'empty';
|
|
361
|
+
export type ChartMarkRole = 'background' | 'title' | 'subtitle' | 'grid' | 'axis' | 'tick' | 'tick-label' | 'axis-title' | 'bar' | 'line' | 'area' | 'point' | 'slice' | 'cell' | 'box' | 'whisker' | 'outlier' | 'connector' | 'trendline' | 'trendline-label' | 'error-bar' | 'data-label' | 'legend-swatch' | 'legend-label' | 'drag-readout' | 'reference-line' | 'reference-band' | 'reference-label' | 'callout' | 'node' | 'race-time' | 'link' | 'note' | 'selection' | 'empty';
|
|
336
362
|
interface ChartMarkBase {
|
|
337
363
|
/** Unique within the scene (a stable key for frameworks). */
|
|
338
364
|
key: string;
|
package/dist/chart/types.d.ts
CHANGED
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
* - `parliament` draws the first series as seats in a hemicycle, one colour per category.
|
|
17
17
|
* - `sunburst` draws `tree` as rings from the centre out (or, without a tree, the first series
|
|
18
18
|
* as one ring); a `treemap` with a `tree` nests each group's rectangles inside it.
|
|
19
|
+
* - `sankey` draws `links` as flows between columns of nodes.
|
|
20
|
+
* - `barrace` reads each category as a time point and each series as a name, and draws the
|
|
21
|
+
* top `raceTopN` names at one moment as ranked horizontal bars (an animated ranking).
|
|
19
22
|
*/
|
|
20
|
-
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst';
|
|
23
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace';
|
|
21
24
|
/** How a series is drawn in a cartesian chart. */
|
|
22
25
|
export type ChartSeriesType = 'bar' | 'line' | 'area' | 'scatter';
|
|
23
26
|
/** One data value; `null` is a gap (missing value). */
|
|
@@ -122,6 +125,17 @@ export interface ChartTreeNode {
|
|
|
122
125
|
/** CSS colour (default: the palette colour of its top-level group, lighter further in). */
|
|
123
126
|
color?: string;
|
|
124
127
|
}
|
|
128
|
+
/** One flow of a Sankey diagram, from one named node to another. */
|
|
129
|
+
export interface ChartLink {
|
|
130
|
+
source: string;
|
|
131
|
+
target: string;
|
|
132
|
+
/** Above 0. */
|
|
133
|
+
value: number;
|
|
134
|
+
/** CSS colour (default: by `sankeyLinkColor`). */
|
|
135
|
+
color?: string;
|
|
136
|
+
}
|
|
137
|
+
/** What colours each flow of a Sankey diagram: its source node, its target node, or grey. */
|
|
138
|
+
export type ChartSankeyLinkColor = 'source' | 'target' | 'gray';
|
|
125
139
|
/** Which axis a reference line or band is measured on: the value axis, the secondary value axis, or the numeric x axis of a scatter or bubble chart. */
|
|
126
140
|
export type ChartReferenceAxis = 'y' | 'y2' | 'x';
|
|
127
141
|
/** A line across the plot at one value: a target, a floor, an average. */
|
|
@@ -277,6 +291,18 @@ export interface ChartSpec {
|
|
|
277
291
|
tree: ChartTreeNode[];
|
|
278
292
|
/** Sunburst: the caption under the total in the centre ("" for none). */
|
|
279
293
|
sunburstLabel: string;
|
|
294
|
+
/**
|
|
295
|
+
* Flows between named nodes (Sankey diagrams). When set they are the chart's data: the
|
|
296
|
+
* categories are the nodes (in `sankeyNodes` order) and the first series holds how much flows
|
|
297
|
+
* through each (the larger of in and out), so other types draw those amounts.
|
|
298
|
+
*/
|
|
299
|
+
links: ChartLink[];
|
|
300
|
+
/** Sankey: the order nodes are listed and stacked in (default: as the links first name them). */
|
|
301
|
+
sankeyNodes: string[];
|
|
302
|
+
/** Sankey: what colours each flow. */
|
|
303
|
+
sankeyLinkColor: ChartSankeyLinkColor;
|
|
304
|
+
/** Bar race: how many bars each moment shows, 1–30. */
|
|
305
|
+
raceTopN: number;
|
|
280
306
|
}
|
|
281
307
|
/** What a click selects. */
|
|
282
308
|
export type ChartSelection = {
|
|
@@ -332,7 +358,7 @@ export interface ChartRect {
|
|
|
332
358
|
height: number;
|
|
333
359
|
}
|
|
334
360
|
/** What a mark is, for styling and tests. */
|
|
335
|
-
export type ChartMarkRole = 'background' | 'title' | 'subtitle' | 'grid' | 'axis' | 'tick' | 'tick-label' | 'axis-title' | 'bar' | 'line' | 'area' | 'point' | 'slice' | 'cell' | 'box' | 'whisker' | 'outlier' | 'connector' | 'trendline' | 'trendline-label' | 'error-bar' | 'data-label' | 'legend-swatch' | 'legend-label' | 'drag-readout' | 'reference-line' | 'reference-band' | 'reference-label' | 'callout' | 'note' | 'selection' | 'empty';
|
|
361
|
+
export type ChartMarkRole = 'background' | 'title' | 'subtitle' | 'grid' | 'axis' | 'tick' | 'tick-label' | 'axis-title' | 'bar' | 'line' | 'area' | 'point' | 'slice' | 'cell' | 'box' | 'whisker' | 'outlier' | 'connector' | 'trendline' | 'trendline-label' | 'error-bar' | 'data-label' | 'legend-swatch' | 'legend-label' | 'drag-readout' | 'reference-line' | 'reference-band' | 'reference-label' | 'callout' | 'node' | 'race-time' | 'link' | 'note' | 'selection' | 'empty';
|
|
336
362
|
interface ChartMarkBase {
|
|
337
363
|
/** Unique within the scene (a stable key for frameworks). */
|
|
338
364
|
key: string;
|