@pixerate/editor-react 0.36.0 → 0.38.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.
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
3
  import { ToolRegistry } from '@pixerate/editor/tools';
4
- import { ChartController, ChartState, ChartSelection, ChartSpecPatch, ChartActionResult, ChartType, ChartCommandOptions, ChartControllerOptions, ChartScene, ChartPresence, ChartDirector, ChartToolProviderOptions, ChartTheme, ChartTextMeasure, ChartMark, ChartSparklineOptions, ChartValue, ChartStreamFormat } from '@pixerate/editor/chart';
4
+ import { ChartToolProviderOptions, ChartController, ChartState, ChartSelection, ChartSpecPatch, ChartActionResult, ChartType, ChartCommandOptions, ChartControllerOptions, ChartScene, ChartPresence, ChartDirector, ChartTheme, ChartTextMeasure, ChartMark, DownloadChartPngOptions, ChartSparklineOptions, ChartValue, ChartStreamFormat } from '@pixerate/editor/chart';
5
5
 
6
6
  /** A `ChartController` created once for the component's lifetime. */
7
7
  declare function useChartController(options?: ChartControllerOptions): ChartController;
@@ -33,11 +33,16 @@ interface ChartCommandTarget {
33
33
  * `chart.setValues`, …) in `registry` while mounted.
34
34
  */
35
35
  declare function useChartCommands(registry: ChartCommandTarget | null | undefined, controller: ChartController, options?: ChartCommandOptions): void;
36
+ /** `useChartToolProvider` options: `rasterize` defaults to a canvas rasterizer in the browser (`false` turns PNG off). */
37
+ type ChartToolProviderHookOptions = Omit<ChartToolProviderOptions, 'rasterize'> & {
38
+ rasterize?: ChartToolProviderOptions['rasterize'] | false;
39
+ };
36
40
  /**
37
41
  * Registers the chart's agent tools (`createChartToolProvider`) with a `ToolRegistry` while
38
- * mounted. Options are read when the controller or registry changes.
42
+ * mounted. Options are read when the controller or registry changes. In the browser,
43
+ * `render_chart { format: "png" }` works out of the box (`createChartRasterizer`).
39
44
  */
40
- declare function useChartToolProvider(registry: ToolRegistry | null | undefined, controller: ChartController, options?: ChartToolProviderOptions): void;
45
+ declare function useChartToolProvider(registry: ToolRegistry | null | undefined, controller: ChartController, options?: ChartToolProviderHookOptions): void;
41
46
  /**
42
47
  * A `ChartPresence` and `ChartDirector` for a chart: pass `presence` and `sceneRef` to
43
48
  * `ChartCanvas`, and `director` to `useChartToolProvider` so agent edits are acted out with a
@@ -147,15 +152,17 @@ interface ChartEditorProps {
147
152
  showInspector?: boolean;
148
153
  /** The data grid under the chart (default `true`). */
149
154
  showDataGrid?: boolean;
150
- /** Undo / redo and the selection readout (default `true`). */
155
+ /** Undo / redo, Download PNG and the selection readout (default `true`). */
151
156
  showToolbar?: boolean;
157
+ /** Size, theme, scale and file name for the toolbar's Download PNG (default 800 × 450, light theme). */
158
+ pngOptions?: DownloadChartPngOptions;
152
159
  /** Chart height in pixels (default 380). */
153
160
  height?: number;
154
161
  canvasProps?: Omit<ChartCanvasProps, 'controller' | 'height'>;
155
162
  className?: string;
156
163
  }
157
164
  /** Toolbar, chart, settings sidebar and data grid for a `ChartController`. */
158
- declare function ChartEditor({ controller, showInspector, showDataGrid, showToolbar, height, canvasProps, className }: ChartEditorProps): React__default.JSX.Element;
165
+ declare function ChartEditor({ controller, showInspector, showDataGrid, showToolbar, pngOptions, height, canvasProps, className }: ChartEditorProps): React__default.JSX.Element;
159
166
 
160
167
  interface ChartStreamingViewProps {
161
168
  /** Mermaid (xychart-beta, pie, radar-beta) or a JSON chart spec, as far as it has arrived. */
@@ -196,4 +203,4 @@ interface ChartSparklineProps extends Omit<ChartSparklineOptions, 'width' | 'hei
196
203
  /** A word-sized chart: line, column or win/loss. */
197
204
  declare function ChartSparkline({ values, width, height, label, className, ...options }: ChartSparklineProps): React__default.JSX.Element;
198
205
 
199
- export { ChartCanvas, type ChartCanvasProps, type ChartCommandTarget, ChartCommitInput, ChartDataGrid, type ChartDataGridProps, ChartEditor, type ChartEditorProps, ChartInspector, type ChartInspectorProps, type ChartInspectorSection, ChartPresenceLayer, ChartSceneSvg, ChartSparkline, type ChartSparklineProps, ChartStreamingView, type ChartStreamingViewProps, type UseChartEditorResult, chartButtonClass, chartCellClass, chartIconButtonClass, chartInputClass, chartLabelClass, chartSectionClass, chartSegmentClass, renderChartMark, useChartCommands, useChartController, useChartDirector, useChartEditor, useChartState, useChartToolProvider };
206
+ export { ChartCanvas, type ChartCanvasProps, type ChartCommandTarget, ChartCommitInput, ChartDataGrid, type ChartDataGridProps, ChartEditor, type ChartEditorProps, ChartInspector, type ChartInspectorProps, type ChartInspectorSection, ChartPresenceLayer, ChartSceneSvg, ChartSparkline, type ChartSparklineProps, ChartStreamingView, type ChartStreamingViewProps, type ChartToolProviderHookOptions, type UseChartEditorResult, chartButtonClass, chartCellClass, chartIconButtonClass, chartInputClass, chartLabelClass, chartSectionClass, chartSegmentClass, renderChartMark, useChartCommands, useChartController, useChartDirector, useChartEditor, useChartState, useChartToolProvider };