@pixerate/editor-react 0.106.0 → 0.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/animation-editor/index.cjs +2 -1
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/index.cjs +2 -1
- package/dist/canvas/index.js +1 -1
- package/dist/chart/ChartDataGrid.d.cts +5 -0
- package/dist/chart/ChartDataGrid.d.ts +5 -0
- package/dist/chart/ChartInspector.d.cts +1 -1
- package/dist/chart/ChartInspector.d.ts +1 -1
- package/dist/chart/index.cjs +136 -3
- package/dist/chart/index.js +3 -1
- package/dist/{chunk-CEV4OEOY.js → chunk-6XI62THS.js} +1 -1
- package/dist/{chunk-FUR7LCDM.js → chunk-GJ3IMZQW.js} +152 -5
- package/dist/{chunk-Q7LAFHGP.js → chunk-ZQ6H2C7N.js} +2 -1
- package/dist/effects/EffectParameters.d.cts +4 -2
- package/dist/effects/EffectParameters.d.ts +4 -2
- package/dist/effects/index.cjs +2 -1
- package/dist/effects/index.js +1 -1
- package/dist/image-editor/index.cjs +2 -1
- package/dist/image-editor/index.js +2 -2
- package/dist/index.cjs +136 -4
- package/dist/index.js +3 -3
- package/dist/paint-editor/index.cjs +2 -1
- package/dist/paint-editor/index.js +1 -1
- package/dist/typography/FontPicker.d.cts +48 -0
- package/dist/typography/FontPicker.d.ts +48 -0
- package/dist/typography/TypographyControl.d.cts +11 -0
- package/dist/typography/TypographyControl.d.ts +11 -0
- package/dist/typography/index.cjs +328 -0
- package/dist/typography/index.d.cts +7 -0
- package/dist/typography/index.d.ts +7 -0
- package/dist/typography/index.js +299 -0
- package/dist/typography/useFontPicker.d.cts +17 -0
- package/dist/typography/useFontPicker.d.ts +17 -0
- package/dist/vector/index.cjs +2 -1
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +2 -1
- package/dist/video-editor/index.js +1 -1
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ useAgentToolProvider(registry, provider);
|
|
|
106
106
|
| `@pixerate/editor-react/parameters` | `ParametersPanel` (a whole schema with groups, presets, undo / reset / randomize and keyframe diamonds), `useParameters`, `useParametersController`, `useParametersState`, `useParameterCommands`, and the field controls `ParameterFieldControl`, `ParameterSlider`, `ParameterToggle`, `ParameterSelect`, `ParameterColor`, `ParameterVector`, `ParameterImage`, `ParameterText`, `KeyframeDiamond` over `@pixerate/editor/parameters` (see [the parameters guide](../../docs/parameters.md)) |
|
|
107
107
|
| `@pixerate/editor-react/color` | `ColorPicker` (interactive hex/rgb/hsl/oklch picker with alpha, swatches, eyedropper, recent history), `DualColorPicker` (dual light/dark mode color picker with theme preview and switch), `useColorScheme` / `useResolvedColor` (the active scheme from the system, a root attribute or an override) |
|
|
108
108
|
| `@pixerate/editor-react/gradient` | `GradientEditor` (interactive stops bar, midpoints, presets, angle dial, type selector, OKLab/OKLCH/sRGB/linear-sRGB interpolation, CSS output), `FillPicker` (controlled solid-or-gradient fill picker), `useGradientController` |
|
|
109
|
-
| `@pixerate/editor-react/canvas` | `useCanvasGraph`, `useCanvasLayout`, `useCanvasClipboard`, `useCanvasDocking`, `useCanvasShortcuts`, `useCanvasExplosion`, `useStreamingCanvas`, `AgentPresenceLayer`, plus the pure layout helpers from `@pixerate/editor/canvas` |
|
|
109
|
+
| `@pixerate/editor-react/canvas` | `useCanvasGraph`, `useCanvasLayout`, `useCanvasClipboard`, `useCanvasDocking`, `useCanvasShortcuts`, `useCanvasExplosion`, `useCanvasExplosionState`, `useStreamingCanvas`, `AgentPresenceLayer`, plus the pure layout helpers from `@pixerate/editor/canvas` |
|
|
110
110
|
|
|
111
111
|
Spreadsheet persistence: `useSpreadsheetEditor` exposes `document` (and passes it to `onDocumentChange`) with the defined names its formulas use in `document.names`, so saving that document and passing it back as `document` restores workbook, sheet-scoped and LAMBDA names. For several sheets, save `controller.getWorkbook()` instead.
|
|
112
112
|
|
|
@@ -2699,10 +2699,11 @@ function EffectParameters({
|
|
|
2699
2699
|
onPreset,
|
|
2700
2700
|
onPresetName,
|
|
2701
2701
|
renderControlAddon,
|
|
2702
|
+
fonts,
|
|
2702
2703
|
disabled = false,
|
|
2703
2704
|
className = ""
|
|
2704
2705
|
}) {
|
|
2705
|
-
const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
|
|
2706
|
+
const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
2706
2707
|
const idBase = (0, import_react19.useId)();
|
|
2707
2708
|
const gesture = import_react19.default.useRef(null);
|
|
2708
2709
|
const count = import_react19.default.useRef(0);
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -3454,10 +3454,11 @@ function EffectParameters({
|
|
|
3454
3454
|
onPreset,
|
|
3455
3455
|
onPresetName,
|
|
3456
3456
|
renderControlAddon,
|
|
3457
|
+
fonts,
|
|
3457
3458
|
disabled = false,
|
|
3458
3459
|
className = ""
|
|
3459
3460
|
}) {
|
|
3460
|
-
const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
|
|
3461
|
+
const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
3461
3462
|
const idBase = (0, import_react27.useId)();
|
|
3462
3463
|
const gesture = import_react27.default.useRef(null);
|
|
3463
3464
|
const count = import_react27.default.useRef(0);
|
package/dist/canvas/index.js
CHANGED
|
@@ -20,5 +20,10 @@ export interface ChartDataGridProps {
|
|
|
20
20
|
* (name, colour, show / hide, delete). Cells take numbers as people type them (`1,200`,
|
|
21
21
|
* `12%`, blank for a gap); pasting TSV or CSV fills and grows the grid from the cell.
|
|
22
22
|
*/
|
|
23
|
+
/**
|
|
24
|
+
* Grouped data as a table: the names from the group down to each item, then its value. Editing
|
|
25
|
+
* a name moves the item (a new name starts a new group); `+ Level` adds a column for deeper groups.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ChartTreeGrid({ controller, readOnly, className }: Omit<ChartDataGridProps, 'categoryHeader'>): React.JSX.Element;
|
|
23
28
|
export declare function ChartDataGrid({ controller, categoryHeader, readOnly, className }: ChartDataGridProps): React.JSX.Element;
|
|
24
29
|
export {};
|
|
@@ -20,5 +20,10 @@ export interface ChartDataGridProps {
|
|
|
20
20
|
* (name, colour, show / hide, delete). Cells take numbers as people type them (`1,200`,
|
|
21
21
|
* `12%`, blank for a gap); pasting TSV or CSV fills and grows the grid from the cell.
|
|
22
22
|
*/
|
|
23
|
+
/**
|
|
24
|
+
* Grouped data as a table: the names from the group down to each item, then its value. Editing
|
|
25
|
+
* a name moves the item (a new name starts a new group); `+ Level` adds a column for deeper groups.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ChartTreeGrid({ controller, readOnly, className }: Omit<ChartDataGridProps, 'categoryHeader'>): React.JSX.Element;
|
|
23
28
|
export declare function ChartDataGrid({ controller, categoryHeader, readOnly, className }: ChartDataGridProps): React.JSX.Element;
|
|
24
29
|
export {};
|
|
@@ -6,7 +6,7 @@ export interface ChartInspectorProps {
|
|
|
6
6
|
sections?: readonly ChartInspectorSection[];
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export type ChartInspectorSection = 'type' | 'style' | 'titles' | 'options' | 'legend' | 'axes' | 'series';
|
|
9
|
+
export type ChartInspectorSection = 'type' | 'style' | 'titles' | 'options' | 'legend' | 'axes' | 'annotations' | 'series';
|
|
10
10
|
/**
|
|
11
11
|
* Settings for a chart controller: type, titles, stacking and line options, legend, both
|
|
12
12
|
* axes and the selected series. Every change is one undo step.
|
|
@@ -6,7 +6,7 @@ export interface ChartInspectorProps {
|
|
|
6
6
|
sections?: readonly ChartInspectorSection[];
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export type ChartInspectorSection = 'type' | 'style' | 'titles' | 'options' | 'legend' | 'axes' | 'series';
|
|
9
|
+
export type ChartInspectorSection = 'type' | 'style' | 'titles' | 'options' | 'legend' | 'axes' | 'annotations' | 'series';
|
|
10
10
|
/**
|
|
11
11
|
* Settings for a chart controller: type, titles, stacking and line options, legend, both
|
|
12
12
|
* axes and the selected series. Every change is one undo step.
|
package/dist/chart/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ __export(chart_exports, {
|
|
|
39
39
|
ChartSceneSvg: () => ChartSceneSvg,
|
|
40
40
|
ChartSparkline: () => ChartSparkline,
|
|
41
41
|
ChartStreamingView: () => ChartStreamingView,
|
|
42
|
+
ChartTreeGrid: () => ChartTreeGrid,
|
|
42
43
|
chartButtonClass: () => chartButtonClass,
|
|
43
44
|
chartCellClass: () => chartCellClass,
|
|
44
45
|
chartIconButtonClass: () => chartIconButtonClass,
|
|
@@ -352,8 +353,60 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
|
352
353
|
}
|
|
353
354
|
);
|
|
354
355
|
}
|
|
356
|
+
function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
357
|
+
const { spec } = useChartState(controller);
|
|
358
|
+
const [columns, setColumns] = (0, import_react3.useState)(1);
|
|
359
|
+
const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
|
|
360
|
+
const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
|
|
361
|
+
const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
|
|
362
|
+
const commit = (next) => controller.setTreeRows(next).ok;
|
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
|
|
364
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [
|
|
366
|
+
labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
|
|
368
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-8 border-b border-border" })
|
|
369
|
+
] }) }),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { "data-tree-row": r, children: [
|
|
371
|
+
labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
372
|
+
ChartCommitInput,
|
|
373
|
+
{
|
|
374
|
+
value: row.path[k] ?? "",
|
|
375
|
+
"aria-label": `${labels[k]}, row ${r + 1}`,
|
|
376
|
+
"data-tree-cell": `${r}:${k}`,
|
|
377
|
+
readOnly,
|
|
378
|
+
onCommit: (name) => commit((0, import_chart3.setChartTreeRowName)(rows, r, k, name)),
|
|
379
|
+
className: `${chartCellClass} text-left`
|
|
380
|
+
}
|
|
381
|
+
) }, k)),
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
383
|
+
ChartCommitInput,
|
|
384
|
+
{
|
|
385
|
+
value: String(row.value),
|
|
386
|
+
inputMode: "decimal",
|
|
387
|
+
"aria-label": `Value of ${row.path.join(" / ")}`,
|
|
388
|
+
title: (0, import_chart3.formatChartNumber)(row.value, spec.yAxis.format),
|
|
389
|
+
"data-tree-value": r,
|
|
390
|
+
readOnly,
|
|
391
|
+
onCommit: (text) => commit((0, import_chart3.setChartTreeRowValue)(rows, r, text)),
|
|
392
|
+
className: chartCellClass
|
|
393
|
+
}
|
|
394
|
+
) }),
|
|
395
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete item", "aria-label": `Delete ${row.path.join(" / ")}`, "data-action": "tree-remove-row", onClick: () => commit((0, import_chart3.removeChartTreeRow)(rows, r)), children: "\xD7" }) })
|
|
396
|
+
] }, r)) })
|
|
397
|
+
] }),
|
|
398
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-row", onClick: () => commit((0, import_chart3.addChartTreeRow)(rows)), children: "+ Add item" }),
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex-1" }),
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "tree-ungroup", title: "Keep the group totals as plain data", onClick: () => controller.setTree([]), children: "Ungroup" })
|
|
403
|
+
] })
|
|
404
|
+
] });
|
|
405
|
+
}
|
|
355
406
|
function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
|
|
356
407
|
const { spec, selection } = useChartState(controller);
|
|
408
|
+
if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartTreeGrid, { controller, readOnly, className });
|
|
409
|
+
const canGroup = spec.type === "treemap" || spec.type === "sunburst";
|
|
357
410
|
const paste = (row, column) => (e) => {
|
|
358
411
|
const text = e.clipboardData?.getData("text/plain") ?? "";
|
|
359
412
|
if (!/[\t\n]/.test(text.replace(/\n$/, ""))) return;
|
|
@@ -447,7 +500,20 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
447
500
|
] }, i);
|
|
448
501
|
}) })
|
|
449
502
|
] }),
|
|
450
|
-
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
503
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "p-1", children: [
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
|
|
505
|
+
canGroup && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
506
|
+
"button",
|
|
507
|
+
{
|
|
508
|
+
type: "button",
|
|
509
|
+
className: `${chartButtonClass} ml-1 h-6`,
|
|
510
|
+
"data-action": "tree-from-table",
|
|
511
|
+
title: "Edit the categories as groups of items",
|
|
512
|
+
onClick: () => controller.setTree((0, import_chart3.chartTreeFromSeries)(spec.categories, spec.series.find((s) => !s.hidden)?.values ?? [])),
|
|
513
|
+
children: "Group items"
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
] })
|
|
451
517
|
] });
|
|
452
518
|
}
|
|
453
519
|
|
|
@@ -616,7 +682,7 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
616
682
|
] });
|
|
617
683
|
}
|
|
618
684
|
function ChartInspector({ controller, sections, className }) {
|
|
619
|
-
const { spec, selectedSeries } = useChartState(controller);
|
|
685
|
+
const { spec, selectedSeries, selection } = useChartState(controller);
|
|
620
686
|
const idBase = (0, import_react4.useId)();
|
|
621
687
|
const show = (section) => !sections || sections.includes(section);
|
|
622
688
|
const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
|
|
@@ -629,6 +695,9 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
629
695
|
const hasLines = cartesian && types.some((t) => t === "line" || t === "area");
|
|
630
696
|
const seriesIndex = selectedSeries ? spec.series.findIndex((s) => s.id === selectedSeries.id) : -1;
|
|
631
697
|
const scales = family === "cartesian" || family === "xy";
|
|
698
|
+
const annotated = scales;
|
|
699
|
+
const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
|
|
700
|
+
const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
|
|
632
701
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
|
|
633
702
|
show("type") && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "grid grid-cols-3 gap-0.5 rounded-md bg-muted p-0.5", role: "radiogroup", "aria-label": "Chart type", children: import_chart4.CHART_TYPES.map((type) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "radio", "aria-checked": spec.type === type, "data-chart-type": type, className: chartSegmentClass(spec.type === type), onClick: () => controller.setType(type), children: import_chart4.CHART_TYPE_LABELS[type] }, type)) }) }),
|
|
634
703
|
show("style") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
|
|
@@ -645,7 +714,8 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
645
714
|
] }),
|
|
646
715
|
show("titles") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
|
|
647
716
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
|
|
648
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) })
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
|
|
649
719
|
] }),
|
|
650
720
|
show("options") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
|
|
651
721
|
cartesian && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-stacking`, name: "stacking", value: spec.stacking, options: import_chart4.CHART_STACKINGS, labels: { none: "None", stacked: "Stacked", percent: "100%" }, onChange: (stacking) => controller.update({ stacking }) }) }),
|
|
@@ -683,6 +753,27 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
683
753
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
684
754
|
}
|
|
685
755
|
) }),
|
|
756
|
+
spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
|
|
757
|
+
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
|
|
758
|
+
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-likert-sort`, name: "likertSort", value: spec.likertSort, options: import_chart4.CHART_LIKERT_SORTS, labels: { none: "As entered", positive: "Most agreement first", negative: "Most disagreement first" }, onChange: (likertSort) => controller.update({ likertSort }) }) }),
|
|
759
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
760
|
+
"input",
|
|
761
|
+
{
|
|
762
|
+
id: `${idBase}-parliament-arc`,
|
|
763
|
+
type: "range",
|
|
764
|
+
min: 90,
|
|
765
|
+
max: 360,
|
|
766
|
+
step: 10,
|
|
767
|
+
value: spec.parliamentArc,
|
|
768
|
+
"data-option": "parliamentArc",
|
|
769
|
+
className: "w-full accent-primary",
|
|
770
|
+
onPointerDown: () => controller.beginGesture("parliamentArc"),
|
|
771
|
+
onPointerUp: () => controller.endGesture(),
|
|
772
|
+
onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
|
|
773
|
+
}
|
|
774
|
+
) }),
|
|
775
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-parliament-majority`, value: spec.parliamentMajority === null ? "" : String(spec.parliamentMajority), placeholder: "Half plus one", inputMode: "numeric", "data-option": "parliamentMajority", className: chartInputClass, onCommit: (text) => controller.update({ parliamentMajority: text.trim() === "" ? null : Number(text) }).ok }) }),
|
|
776
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
|
|
686
777
|
spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-radar-ticks`, value: spec.radarTicks === null ? "" : String(spec.radarTicks), placeholder: "Auto", inputMode: "numeric", "data-option": "radarTicks", className: chartInputClass, onCommit: (text) => controller.update({ radarTicks: text.trim() === "" ? null : Number(text) }).ok }) }),
|
|
687
778
|
spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-radar-graticule`, name: "radarGraticule", value: spec.radarGraticule, options: import_chart4.CHART_RADAR_GRATICULES, labels: { polygon: "Polygons", circle: "Circles" }, onChange: (radarGraticule) => controller.update({ radarGraticule }) }) }),
|
|
688
779
|
spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
|
|
@@ -690,6 +781,7 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
690
781
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
691
782
|
spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
|
|
692
783
|
hasLines && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
|
|
784
|
+
oneSeries && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
|
|
693
785
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
|
|
694
786
|
] })
|
|
695
787
|
] }),
|
|
@@ -705,6 +797,35 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
705
797
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
|
|
706
798
|
usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
|
|
707
799
|
] }),
|
|
800
|
+
show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
803
|
+
ChartCommitInput,
|
|
804
|
+
{
|
|
805
|
+
id: `${idBase}-highlight`,
|
|
806
|
+
value: spec.highlight.join(", "),
|
|
807
|
+
placeholder: "Categories or series",
|
|
808
|
+
"data-option": "highlight",
|
|
809
|
+
className: chartInputClass,
|
|
810
|
+
onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
|
|
811
|
+
}
|
|
812
|
+
) }),
|
|
813
|
+
spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { value: String(line.value), "aria-label": "Line value", inputMode: "decimal", "data-option": `referenceLine.${i}.value`, className: `${chartInputClass} w-16 shrink-0`, onCommit: (text) => controller.updateReferenceLine(i, { value: Number(text) }).ok }),
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { value: line.label ?? "", "aria-label": "Line label", placeholder: "Label", "data-option": `referenceLine.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceLine(i, { label: text || null }).ok }),
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
|
|
817
|
+
] }, `line-${i}`)),
|
|
818
|
+
spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { value: String(band.from), "aria-label": "Band from", inputMode: "decimal", "data-option": `referenceBand.${i}.from`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { from: Number(text) }).ok }),
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { value: String(band.to), "aria-label": "Band to", inputMode: "decimal", "data-option": `referenceBand.${i}.to`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { to: Number(text) }).ok }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { value: band.label ?? "", "aria-label": "Band label", placeholder: "Label", "data-option": `referenceBand.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceBand(i, { label: text || null }).ok }),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
|
|
823
|
+
] }, `band-${i}`)),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex gap-1", children: [
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
|
|
827
|
+
] })
|
|
828
|
+
] }),
|
|
708
829
|
show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
|
|
709
830
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
|
|
710
831
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
|
|
@@ -752,6 +873,17 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
752
873
|
]
|
|
753
874
|
}
|
|
754
875
|
) }),
|
|
876
|
+
annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
877
|
+
ChartCommitInput,
|
|
878
|
+
{
|
|
879
|
+
id: `${idBase}-series-callout`,
|
|
880
|
+
value: selectedSeries.callouts?.[calloutIndex] ?? "",
|
|
881
|
+
placeholder: `Label for ${spec.categories[calloutIndex] ?? "this point"}`,
|
|
882
|
+
"data-option": "series.callout",
|
|
883
|
+
className: chartInputClass,
|
|
884
|
+
onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
|
|
885
|
+
}
|
|
886
|
+
) }),
|
|
755
887
|
scales && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
|
|
756
888
|
family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
|
|
757
889
|
(0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
|
|
@@ -1033,6 +1165,7 @@ function ChartSparkline({ values, width = 80, height = 20, label, className, ...
|
|
|
1033
1165
|
ChartSceneSvg,
|
|
1034
1166
|
ChartSparkline,
|
|
1035
1167
|
ChartStreamingView,
|
|
1168
|
+
ChartTreeGrid,
|
|
1036
1169
|
chartButtonClass,
|
|
1037
1170
|
chartCellClass,
|
|
1038
1171
|
chartIconButtonClass,
|
package/dist/chart/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ChartInspector,
|
|
6
6
|
ChartPresenceLayer,
|
|
7
7
|
ChartSceneSvg,
|
|
8
|
+
ChartTreeGrid,
|
|
8
9
|
chartButtonClass,
|
|
9
10
|
chartCellClass,
|
|
10
11
|
chartIconButtonClass,
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
useChartState,
|
|
21
22
|
useChartToolProvider,
|
|
22
23
|
useOfficeChartToolProvider
|
|
23
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-GJ3IMZQW.js";
|
|
24
25
|
import {
|
|
25
26
|
PresenceLayer,
|
|
26
27
|
useAgentPlayback,
|
|
@@ -186,6 +187,7 @@ export {
|
|
|
186
187
|
ChartSceneSvg,
|
|
187
188
|
ChartSparkline,
|
|
188
189
|
ChartStreamingView,
|
|
190
|
+
ChartTreeGrid,
|
|
189
191
|
chartButtonClass,
|
|
190
192
|
chartCellClass,
|
|
191
193
|
chartIconButtonClass,
|