@pixerate/editor 0.180.0 → 0.181.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 +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/canvas/index.cjs +6 -6
- package/dist/canvas/index.js +2 -2
- package/dist/chart/index.cjs +162 -157
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +12 -7
- package/dist/chart/layout-streamgraph.d.cts +15 -0
- package/dist/chart/layout-streamgraph.d.ts +15 -0
- package/dist/chart/spec.d.cts +1 -1
- package/dist/chart/spec.d.ts +1 -1
- package/dist/chart/types.d.cts +2 -1
- package/dist/chart/types.d.ts +2 -1
- package/dist/{chunk-KPWG3PSW.js → chunk-23E5GI2U.js} +8 -2
- package/dist/{chunk-IMHRN4ZZ.js → chunk-3MO3ZS7E.js} +3 -3
- package/dist/{chunk-GXEC4FS6.cjs → chunk-5DQPDXOM.cjs} +82 -76
- package/dist/{chunk-ORZF4JOO.js → chunk-6ZZKRH7R.js} +3 -1
- package/dist/{chunk-FHNGNL3V.cjs → chunk-CZBRY4SW.cjs} +51 -51
- package/dist/{chunk-34UCPHYO.js → chunk-GOBOCZZI.js} +2 -2
- package/dist/{chunk-VKHJJUBK.cjs → chunk-HUAISCUX.cjs} +22 -18
- package/dist/{chunk-OLCHKGGO.js → chunk-L6Y7TSQ4.js} +5 -1
- package/dist/{chunk-TUXKLM5W.cjs → chunk-N76AMOKE.cjs} +224 -42
- package/dist/{chunk-RLOIEDA3.cjs → chunk-O7QXVGMP.cjs} +16 -16
- package/dist/{chunk-R2VHVQVY.js → chunk-PI2UYMZY.js} +3 -3
- package/dist/{chunk-E45AIIWY.cjs → chunk-RUONPPMC.cjs} +8 -8
- package/dist/{chunk-GTF4RYXJ.cjs → chunk-SOSBOS5T.cjs} +22 -22
- package/dist/{chunk-FKYGM35R.js → chunk-UFEDHACQ.js} +2 -2
- package/dist/{chunk-OJQVKJYD.js → chunk-WKMUBATU.js} +183 -1
- package/dist/{chunk-OUO3DSRT.cjs → chunk-WRZ6C4TU.cjs} +3 -1
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/chart/index.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './stats.cjs';
|
|
|
12
12
|
export * from './trend.cjs';
|
|
13
13
|
export * from './errorbars.cjs';
|
|
14
14
|
export * from './layout.cjs';
|
|
15
|
+
export * from './layout-streamgraph.cjs';
|
|
15
16
|
export { MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS } from './layout-cartesian.cjs';
|
|
16
17
|
export * from './svg.cjs';
|
|
17
18
|
export * from './raster.cjs';
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './stats.js';
|
|
|
12
12
|
export * from './trend.js';
|
|
13
13
|
export * from './errorbars.js';
|
|
14
14
|
export * from './layout.js';
|
|
15
|
+
export * from './layout-streamgraph.js';
|
|
15
16
|
export { MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS } from './layout-cartesian.js';
|
|
16
17
|
export * from './svg.js';
|
|
17
18
|
export * from './raster.js';
|
package/dist/chart/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
TRENDLINE_PROPS,
|
|
18
18
|
VALUE,
|
|
19
19
|
WIDTH
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-GOBOCZZI.js";
|
|
21
21
|
import {
|
|
22
22
|
CHART_OOXML_CONTENT_TYPE,
|
|
23
23
|
CHART_OOXML_NS,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
chartFormatToCode,
|
|
26
26
|
chartFromOoxml,
|
|
27
27
|
chartToOoxml
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-L6Y7TSQ4.js";
|
|
29
29
|
import {
|
|
30
30
|
CHART_COLOR_SCHEMES,
|
|
31
31
|
CHART_LAYOUT_PRESETS,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
monochromeChartPalette,
|
|
48
48
|
sparklineToSvg,
|
|
49
49
|
summarizeChart
|
|
50
|
-
} from "../chunk-
|
|
50
|
+
} from "../chunk-23E5GI2U.js";
|
|
51
51
|
import "../chunk-KGRZMHZB.js";
|
|
52
52
|
import {
|
|
53
53
|
CHART_DATE_STEPS,
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
formatChartValueWithCode,
|
|
86
86
|
getChartMap,
|
|
87
87
|
layoutChart,
|
|
88
|
+
layoutStreamgraph,
|
|
88
89
|
linearMap,
|
|
89
90
|
listChartMaps,
|
|
90
91
|
matchChartMapRegions,
|
|
@@ -99,7 +100,7 @@ import {
|
|
|
99
100
|
suggestChartReferences,
|
|
100
101
|
summarizeChartSeries,
|
|
101
102
|
trendNumberText
|
|
102
|
-
} from "../chunk-
|
|
103
|
+
} from "../chunk-WKMUBATU.js";
|
|
103
104
|
import {
|
|
104
105
|
CHART_AXIS_KINDS,
|
|
105
106
|
CHART_AXIS_SCALES,
|
|
@@ -193,7 +194,7 @@ import {
|
|
|
193
194
|
shadeChartColor,
|
|
194
195
|
simulateChartVision,
|
|
195
196
|
uniqueChartSeriesId
|
|
196
|
-
} from "../chunk-
|
|
197
|
+
} from "../chunk-6ZZKRH7R.js";
|
|
197
198
|
import "../chunk-O6OGNDND.js";
|
|
198
199
|
import "../chunk-II2WIF5Z.js";
|
|
199
200
|
import {
|
|
@@ -407,7 +408,10 @@ function recommendForShape(shape) {
|
|
|
407
408
|
add("line", "Line", "The categories are dates: a line shows change over time.");
|
|
408
409
|
add("area", "Area", "Shows change over time with volume.");
|
|
409
410
|
add("bar", "Column", "Compares each period.");
|
|
410
|
-
if (shape.series > 1)
|
|
411
|
+
if (shape.series > 1) {
|
|
412
|
+
add("area", "Stacked area", "Shows how the parts add up over time.", "stacked");
|
|
413
|
+
add("streamgraph", "Streamgraph", "Shows changing proportions and overall volume as an organic stream.");
|
|
414
|
+
}
|
|
411
415
|
if (shape.series >= 5 && shape.points >= 3) add("barrace", "Bar race", "Many series over time: an animated ranking shows who leads when.");
|
|
412
416
|
return out;
|
|
413
417
|
}
|
|
@@ -1338,7 +1342,7 @@ function chartHitTest(scene, point, measure = (t, s, w = 400) => t.length * s *
|
|
|
1338
1342
|
}
|
|
1339
1343
|
|
|
1340
1344
|
// src/chart/tooltip.ts
|
|
1341
|
-
var VALUE_FAMILIES = /* @__PURE__ */ new Set(["cartesian", "xy", "pie", "radar", "waterfall", "funnel", "parliament", "slope"]);
|
|
1345
|
+
var VALUE_FAMILIES = /* @__PURE__ */ new Set(["cartesian", "xy", "pie", "radar", "waterfall", "funnel", "parliament", "slope", "streamgraph"]);
|
|
1342
1346
|
var SLICE_FAMILIES = /* @__PURE__ */ new Set(["pie", "funnel", "parliament"]);
|
|
1343
1347
|
function valueFormat(spec, series) {
|
|
1344
1348
|
return series.format ?? (series.axis === "secondary" ? spec.yAxis2.format : spec.yAxis.format);
|
|
@@ -3446,6 +3450,7 @@ export {
|
|
|
3446
3450
|
isXyChart,
|
|
3447
3451
|
layoutChart,
|
|
3448
3452
|
layoutSparkline,
|
|
3453
|
+
layoutStreamgraph,
|
|
3449
3454
|
linearMap,
|
|
3450
3455
|
listChartMaps,
|
|
3451
3456
|
locateChartPoint,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FamilyResult, type LayoutCtx } from './layout-shared.cjs';
|
|
2
|
+
import type { ChartRect, ChartSeries } from './types.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* Lays out a streamgraph: series stacked symmetrically around a center baseline (silhouette offset).
|
|
5
|
+
*
|
|
6
|
+
* For each category index i:
|
|
7
|
+
* total(i) = sum_{s} v_s(i) (where v_s(i) >= 0)
|
|
8
|
+
* y0(i) = -0.5 * total(i)
|
|
9
|
+
*
|
|
10
|
+
* Layers stack upwards from y0:
|
|
11
|
+
* layer_s: from y_bottom = y0 + prefix_sum to y_top = y_bottom + v_s(i)
|
|
12
|
+
*
|
|
13
|
+
* The value domain is symmetric: [-maxHalf, maxHalf].
|
|
14
|
+
*/
|
|
15
|
+
export declare function layoutStreamgraph(ctx: LayoutCtx, area: ChartRect, visible: ChartSeries[]): FamilyResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FamilyResult, type LayoutCtx } from './layout-shared.js';
|
|
2
|
+
import type { ChartRect, ChartSeries } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Lays out a streamgraph: series stacked symmetrically around a center baseline (silhouette offset).
|
|
5
|
+
*
|
|
6
|
+
* For each category index i:
|
|
7
|
+
* total(i) = sum_{s} v_s(i) (where v_s(i) >= 0)
|
|
8
|
+
* y0(i) = -0.5 * total(i)
|
|
9
|
+
*
|
|
10
|
+
* Layers stack upwards from y0:
|
|
11
|
+
* layer_s: from y_bottom = y0 + prefix_sum to y_top = y_bottom + v_s(i)
|
|
12
|
+
*
|
|
13
|
+
* The value domain is symmetric: [-maxHalf, maxHalf].
|
|
14
|
+
*/
|
|
15
|
+
export declare function layoutStreamgraph(ctx: LayoutCtx, area: ChartRect, visible: ChartSeries[]): FamilyResult;
|
package/dist/chart/spec.d.cts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const CHART_NUMBER_STYLES: readonly NonNullable<ChartNumberFormat
|
|
|
19
19
|
/** Labels for pickers, shared by the React and Svelte components. */
|
|
20
20
|
export declare const CHART_TYPE_LABELS: Readonly<Record<ChartType, string>>;
|
|
21
21
|
/** How a chart type is laid out. */
|
|
22
|
-
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace' | 'choropleth';
|
|
22
|
+
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'streamgraph' | 'barrace' | 'choropleth';
|
|
23
23
|
/** A colour-blind-friendly categorical palette (Okabe–Ito order, tuned for light and dark backgrounds). */
|
|
24
24
|
export declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
25
25
|
export declare const DEFAULT_CHART_THEME: ChartTheme;
|
package/dist/chart/spec.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const CHART_NUMBER_STYLES: readonly NonNullable<ChartNumberFormat
|
|
|
19
19
|
/** Labels for pickers, shared by the React and Svelte components. */
|
|
20
20
|
export declare const CHART_TYPE_LABELS: Readonly<Record<ChartType, string>>;
|
|
21
21
|
/** How a chart type is laid out. */
|
|
22
|
-
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace' | 'choropleth';
|
|
22
|
+
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'streamgraph' | 'barrace' | 'choropleth';
|
|
23
23
|
/** A colour-blind-friendly categorical palette (Okabe–Ito order, tuned for light and dark backgrounds). */
|
|
24
24
|
export declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
25
25
|
export declare const DEFAULT_CHART_THEME: ChartTheme;
|
package/dist/chart/types.d.cts
CHANGED
|
@@ -17,12 +17,13 @@
|
|
|
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
19
|
* - `sankey` draws `links` as flows between columns of nodes.
|
|
20
|
+
* - `streamgraph` stacks areas symmetrically around a center baseline (silhouette offset).
|
|
20
21
|
* - `barrace` reads each category as a time point and each series as a name, and draws the
|
|
21
22
|
* top `raceTopN` names at one moment as ranked horizontal bars (an animated ranking).
|
|
22
23
|
* - `choropleth` shades the regions of a registered map (`map`) by the first series, each
|
|
23
24
|
* category naming a region by id (ISO alpha-3 for countries) or name.
|
|
24
25
|
*/
|
|
25
|
-
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace' | 'choropleth';
|
|
26
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'streamgraph' | 'barrace' | 'choropleth';
|
|
26
27
|
/** How a series is drawn in a cartesian chart. */
|
|
27
28
|
export type ChartSeriesType = 'bar' | 'line' | 'area' | 'scatter';
|
|
28
29
|
/** One data value; `null` is a gap (missing value). */
|
package/dist/chart/types.d.ts
CHANGED
|
@@ -17,12 +17,13 @@
|
|
|
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
19
|
* - `sankey` draws `links` as flows between columns of nodes.
|
|
20
|
+
* - `streamgraph` stacks areas symmetrically around a center baseline (silhouette offset).
|
|
20
21
|
* - `barrace` reads each category as a time point and each series as a name, and draws the
|
|
21
22
|
* top `raceTopN` names at one moment as ranked horizontal bars (an animated ranking).
|
|
22
23
|
* - `choropleth` shades the regions of a registered map (`map`) by the first series, each
|
|
23
24
|
* category naming a region by id (ISO alpha-3 for countries) or name.
|
|
24
25
|
*/
|
|
25
|
-
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'barrace' | 'choropleth';
|
|
26
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'scatter' | 'bubble' | 'pie' | 'donut' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst' | 'sankey' | 'streamgraph' | 'barrace' | 'choropleth';
|
|
26
27
|
/** How a series is drawn in a cartesian chart. */
|
|
27
28
|
export type ChartSeriesType = 'bar' | 'line' | 'area' | 'scatter';
|
|
28
29
|
/** One data value; `null` is a gap (missing value). */
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
r2,
|
|
15
15
|
sameChartSelection,
|
|
16
16
|
summarizeChartSeries
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WKMUBATU.js";
|
|
18
18
|
import {
|
|
19
19
|
CHART_TYPE_LABELS,
|
|
20
20
|
DEFAULT_CHART_PALETTE,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
parseChartValue,
|
|
48
48
|
shadeChartColor,
|
|
49
49
|
uniqueChartSeriesId
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-6ZZKRH7R.js";
|
|
51
51
|
import {
|
|
52
52
|
parseCsv,
|
|
53
53
|
parseTsv
|
|
@@ -607,6 +607,12 @@ function describeChart(spec, series = spec.series.filter((s) => !s.hidden).map((
|
|
|
607
607
|
const pct = (v) => `${Math.round(v * 100)}%`;
|
|
608
608
|
return `${head} of ${spec.categories.length} questions with ${answers.length} answers from ${answers[0]?.name} to ${answers[answers.length - 1]?.name}. Most positive: ${best[0]?.c} (${pct(best[0]?.share ?? 0)}); least: ${best[best.length - 1]?.c} (${pct(best[best.length - 1]?.share ?? 0)}).`;
|
|
609
609
|
}
|
|
610
|
+
if (family === "streamgraph") {
|
|
611
|
+
const n = spec.categories.length;
|
|
612
|
+
const totals = spec.categories.map((_, i) => spec.series.filter((x) => !x.hidden).reduce((sum, s) => sum + Math.max(0, s.values[i] ?? 0), 0));
|
|
613
|
+
const maxTotal = Math.max(0, ...totals);
|
|
614
|
+
return `${head} of ${series.length} series over ${n} categories${n ? ` (${spec.categories[0]} to ${spec.categories[n - 1]})` : ""}, stacked symmetrically around a center baseline with a peak volume of ${fmt(maxTotal)}.`;
|
|
615
|
+
}
|
|
610
616
|
if (family === "waterfall") {
|
|
611
617
|
const s = spec.series.find((x) => !x.hidden);
|
|
612
618
|
const steps = s.values.filter((v, i) => v !== null && Number.isFinite(v) && !/\b(sub)?total\b/i.test(spec.categories[i] ?? ""));
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
CHART_OOXML_NS,
|
|
9
9
|
chartFromOoxml
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-L6Y7TSQ4.js";
|
|
11
11
|
import {
|
|
12
12
|
compareDocuments
|
|
13
13
|
} from "./chunk-V5OOP74P.js";
|
|
@@ -34,10 +34,10 @@ import {
|
|
|
34
34
|
searchDocument,
|
|
35
35
|
sliceContainsTable,
|
|
36
36
|
syncInitialContent
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-PI2UYMZY.js";
|
|
38
38
|
import {
|
|
39
39
|
chartDataToTable
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-6ZZKRH7R.js";
|
|
41
41
|
import {
|
|
42
42
|
PIXERATE_DOCUMENT_MIME,
|
|
43
43
|
getClipboardData,
|