@pixerate/editor-react 0.108.0 → 0.110.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,16 +1,34 @@
1
- import { type CanvasEdge, type CanvasNode, type CollapseNodeOptions, type ExplodeNodeOptions, type ExplosionSnapshot } from '@pixerate/editor/canvas';
1
+ import { type CanvasEdge, type CanvasNode, type CollapseNodeOptions, type ExplodeNodeOptions, type ExplosionSnapshot, type Rect } from '@pixerate/editor/canvas';
2
2
  export interface CanvasGraphTarget<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
3
3
  nodes: TNode[];
4
4
  edges: TEdge[];
5
5
  setNodes: (updater: TNode[] | ((prev: TNode[]) => TNode[])) => void;
6
6
  setEdges: (updater: TEdge[] | ((prev: TEdge[]) => TEdge[])) => void;
7
+ /** Builds a parent-to-child edge. Default `{ id: 'explode:<parent>:<child>', source, target }`. */
8
+ createEdge?: (sourceId: string, targetId: string) => TEdge;
9
+ }
10
+ export interface UseCanvasExplosionOptions<TNode extends CanvasNode = CanvasNode> {
11
+ /** Bounds of a set of nodes (e.g. React Flow's `getNodesBounds`). Default: measured sizes. */
12
+ getNodesBounds?: (nodes: TNode[]) => Rect;
13
+ /** Called after an explosion or collapse finishes (e.g. to persist). */
14
+ onSave?: () => void;
7
15
  }
8
16
  /**
9
- * React hook managing node explosion and collapse transitions with exact reversibility.
17
+ * Imperative explosion coordinator for a React Flow graph held in state (whiteboards, diagrams):
18
+ * adds child nodes and edges, animates them out along a trajectory while surrounding nodes slide
19
+ * aside, and collapses back exactly. The layout math is `computeCanvasExplosionLayout`; several
20
+ * nodes can be exploded at once. The same API as the Svelte `createCanvasExplosion`. For a canvas
21
+ * derived from state (`useMemo`), use `useCanvasExplosionState` and the layout functions instead.
22
+ *
23
+ * `explodeNode` throws when a child id is already on the canvas or repeated.
10
24
  */
11
- export declare function useCanvasExplosion<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(target: CanvasGraphTarget<TNode, TEdge>): {
12
- explodeNode: (parentNodeId: string, options: ExplodeNodeOptions<TNode, TEdge>) => void;
13
- collapseNode: (parentNodeId: string, options?: CollapseNodeOptions) => void;
25
+ export declare function useCanvasExplosion<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(target: CanvasGraphTarget<TNode, TEdge>, hookOptions?: UseCanvasExplosionOptions<TNode>): {
26
+ /** Ids of nodes whose explosion animation has finished (and not yet collapsed). */
27
+ explodedNodeIds: string[];
28
+ explodeNode: (parentNodeId: string, options: ExplodeNodeOptions<TNode, TEdge>) => boolean;
29
+ collapseNode: (parentNodeId: string, options?: CollapseNodeOptions) => boolean;
30
+ toggleExplode: (parentNodeId: string, explodeOptions: ExplodeNodeOptions<TNode, TEdge>, collapseOptions?: CollapseNodeOptions) => boolean;
31
+ /** True once the node's explosion has finished, until a collapse finishes. */
14
32
  isExploded: (parentNodeId: string) => boolean;
15
33
  getSnapshot: (parentNodeId: string) => ExplosionSnapshot<TNode, TEdge> | undefined;
16
34
  };
@@ -1,16 +1,34 @@
1
- import { type CanvasEdge, type CanvasNode, type CollapseNodeOptions, type ExplodeNodeOptions, type ExplosionSnapshot } from '@pixerate/editor/canvas';
1
+ import { type CanvasEdge, type CanvasNode, type CollapseNodeOptions, type ExplodeNodeOptions, type ExplosionSnapshot, type Rect } from '@pixerate/editor/canvas';
2
2
  export interface CanvasGraphTarget<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
3
3
  nodes: TNode[];
4
4
  edges: TEdge[];
5
5
  setNodes: (updater: TNode[] | ((prev: TNode[]) => TNode[])) => void;
6
6
  setEdges: (updater: TEdge[] | ((prev: TEdge[]) => TEdge[])) => void;
7
+ /** Builds a parent-to-child edge. Default `{ id: 'explode:<parent>:<child>', source, target }`. */
8
+ createEdge?: (sourceId: string, targetId: string) => TEdge;
9
+ }
10
+ export interface UseCanvasExplosionOptions<TNode extends CanvasNode = CanvasNode> {
11
+ /** Bounds of a set of nodes (e.g. React Flow's `getNodesBounds`). Default: measured sizes. */
12
+ getNodesBounds?: (nodes: TNode[]) => Rect;
13
+ /** Called after an explosion or collapse finishes (e.g. to persist). */
14
+ onSave?: () => void;
7
15
  }
8
16
  /**
9
- * React hook managing node explosion and collapse transitions with exact reversibility.
17
+ * Imperative explosion coordinator for a React Flow graph held in state (whiteboards, diagrams):
18
+ * adds child nodes and edges, animates them out along a trajectory while surrounding nodes slide
19
+ * aside, and collapses back exactly. The layout math is `computeCanvasExplosionLayout`; several
20
+ * nodes can be exploded at once. The same API as the Svelte `createCanvasExplosion`. For a canvas
21
+ * derived from state (`useMemo`), use `useCanvasExplosionState` and the layout functions instead.
22
+ *
23
+ * `explodeNode` throws when a child id is already on the canvas or repeated.
10
24
  */
11
- export declare function useCanvasExplosion<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(target: CanvasGraphTarget<TNode, TEdge>): {
12
- explodeNode: (parentNodeId: string, options: ExplodeNodeOptions<TNode, TEdge>) => void;
13
- collapseNode: (parentNodeId: string, options?: CollapseNodeOptions) => void;
25
+ export declare function useCanvasExplosion<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(target: CanvasGraphTarget<TNode, TEdge>, hookOptions?: UseCanvasExplosionOptions<TNode>): {
26
+ /** Ids of nodes whose explosion animation has finished (and not yet collapsed). */
27
+ explodedNodeIds: string[];
28
+ explodeNode: (parentNodeId: string, options: ExplodeNodeOptions<TNode, TEdge>) => boolean;
29
+ collapseNode: (parentNodeId: string, options?: CollapseNodeOptions) => boolean;
30
+ toggleExplode: (parentNodeId: string, explodeOptions: ExplodeNodeOptions<TNode, TEdge>, collapseOptions?: CollapseNodeOptions) => boolean;
31
+ /** True once the node's explosion has finished, until a collapse finishes. */
14
32
  isExploded: (parentNodeId: string) => boolean;
15
33
  getSnapshot: (parentNodeId: string) => ExplosionSnapshot<TNode, TEdge> | undefined;
16
34
  };
@@ -0,0 +1,17 @@
1
+ import { type CanvasExplosionState, type CanvasExplosionStateController, type CanvasExplosionStateOptions } from '@pixerate/editor/canvas';
2
+ export type { CanvasExplosionState, CanvasExplosionStateOptions };
3
+ export interface CanvasExplosionStateHandle extends CanvasExplosionState {
4
+ /** The framework-free controller underneath (for `canvasExplosionToolTarget` and agent tools). */
5
+ readonly controller: CanvasExplosionStateController;
6
+ }
7
+ /**
8
+ * Headless, declarative explosion state as a React hook: which node is exploded (`activeId`),
9
+ * which is still collapsing (`collapsingId`, so its children can play a collapse animation
10
+ * before unmounting), and the collapse timer. It never touches a graph: derive the canvas from
11
+ * it with `useMemo` and `computeCanvasExplosionLayout` / `calculateDirectionalDisplacement`.
12
+ * The same API and lifecycle as the Svelte `createCanvasExplosionState`.
13
+ *
14
+ * `collapseDurationMs` and `initialActiveId` are read once; the callbacks always call the latest
15
+ * props. A running collapse ends (and its timer is cleared) on unmount.
16
+ */
17
+ export declare function useCanvasExplosionState(options?: CanvasExplosionStateOptions): CanvasExplosionStateHandle;
@@ -0,0 +1,17 @@
1
+ import { type CanvasExplosionState, type CanvasExplosionStateController, type CanvasExplosionStateOptions } from '@pixerate/editor/canvas';
2
+ export type { CanvasExplosionState, CanvasExplosionStateOptions };
3
+ export interface CanvasExplosionStateHandle extends CanvasExplosionState {
4
+ /** The framework-free controller underneath (for `canvasExplosionToolTarget` and agent tools). */
5
+ readonly controller: CanvasExplosionStateController;
6
+ }
7
+ /**
8
+ * Headless, declarative explosion state as a React hook: which node is exploded (`activeId`),
9
+ * which is still collapsing (`collapsingId`, so its children can play a collapse animation
10
+ * before unmounting), and the collapse timer. It never touches a graph: derive the canvas from
11
+ * it with `useMemo` and `computeCanvasExplosionLayout` / `calculateDirectionalDisplacement`.
12
+ * The same API and lifecycle as the Svelte `createCanvasExplosionState`.
13
+ *
14
+ * `collapseDurationMs` and `initialActiveId` are read once; the callbacks always call the latest
15
+ * props. A running collapse ends (and its timer is cleared) on unmount.
16
+ */
17
+ export declare function useCanvasExplosionState(options?: CanvasExplosionStateOptions): CanvasExplosionStateHandle;
@@ -25,5 +25,7 @@ export interface ChartDataGridProps {
25
25
  * a name moves the item (a new name starts a new group); `+ Level` adds a column for deeper groups.
26
26
  */
27
27
  export declare function ChartTreeGrid({ controller, readOnly, className }: Omit<ChartDataGridProps, 'categoryHeader'>): React.JSX.Element;
28
+ /** Flows as a table: source, target and value per row. Edits are checked as a whole (no loops, no repeated pairs). */
29
+ export declare function ChartLinksGrid({ controller, readOnly, className }: Omit<ChartDataGridProps, 'categoryHeader'>): React.JSX.Element;
28
30
  export declare function ChartDataGrid({ controller, categoryHeader, readOnly, className }: ChartDataGridProps): React.JSX.Element;
29
31
  export {};
@@ -25,5 +25,7 @@ export interface ChartDataGridProps {
25
25
  * a name moves the item (a new name starts a new group); `+ Level` adds a column for deeper groups.
26
26
  */
27
27
  export declare function ChartTreeGrid({ controller, readOnly, className }: Omit<ChartDataGridProps, 'categoryHeader'>): React.JSX.Element;
28
+ /** Flows as a table: source, target and value per row. Edits are checked as a whole (no loops, no repeated pairs). */
29
+ export declare function ChartLinksGrid({ controller, readOnly, className }: Omit<ChartDataGridProps, 'categoryHeader'>): React.JSX.Element;
28
30
  export declare function ChartDataGrid({ controller, categoryHeader, readOnly, className }: ChartDataGridProps): React.JSX.Element;
29
31
  export {};
@@ -35,6 +35,7 @@ __export(chart_exports, {
35
35
  ChartDataGrid: () => ChartDataGrid,
36
36
  ChartEditor: () => ChartEditor,
37
37
  ChartInspector: () => ChartInspector,
38
+ ChartLinksGrid: () => ChartLinksGrid,
38
39
  ChartPresenceLayer: () => ChartPresenceLayer,
39
40
  ChartSceneSvg: () => ChartSceneSvg,
40
41
  ChartSparkline: () => ChartSparkline,
@@ -403,8 +404,33 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
403
404
  ] })
404
405
  ] });
405
406
  }
407
+ function ChartLinksGrid({ controller, readOnly = false, className }) {
408
+ const { spec } = useChartState(controller);
409
+ const links = spec.links;
410
+ const commit = (next) => controller.setLinks(next).ok;
411
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
412
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
413
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [
414
+ ["Source", "Target"].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)),
415
+ /* @__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" }),
416
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-8 border-b border-border" })
417
+ ] }) }),
418
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { "data-link-row": i, children: [
419
+ ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
420
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, "value", text)), className: chartCellClass }) }),
421
+ !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 flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
422
+ ] }, i)) })
423
+ ] }),
424
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
425
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
426
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex-1" }),
427
+ links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
428
+ ] })
429
+ ] });
430
+ }
406
431
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
407
432
  const { spec, selection } = useChartState(controller);
433
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartLinksGrid, { controller, readOnly, className });
408
434
  if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartTreeGrid, { controller, readOnly, className });
409
435
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
410
436
  const paste = (row, column) => (e) => {
@@ -753,6 +779,7 @@ function ChartInspector({ controller, sections, className }) {
753
779
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
754
780
  }
755
781
  ) }),
782
+ spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
756
783
  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
784
  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
785
  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 }) }) }),
@@ -1161,6 +1188,7 @@ function ChartSparkline({ values, width = 80, height = 20, label, className, ...
1161
1188
  ChartDataGrid,
1162
1189
  ChartEditor,
1163
1190
  ChartInspector,
1191
+ ChartLinksGrid,
1164
1192
  ChartPresenceLayer,
1165
1193
  ChartSceneSvg,
1166
1194
  ChartSparkline,
@@ -3,6 +3,7 @@ import {
3
3
  ChartCommitInput,
4
4
  ChartDataGrid,
5
5
  ChartInspector,
6
+ ChartLinksGrid,
6
7
  ChartPresenceLayer,
7
8
  ChartSceneSvg,
8
9
  ChartTreeGrid,
@@ -21,7 +22,7 @@ import {
21
22
  useChartState,
22
23
  useChartToolProvider,
23
24
  useOfficeChartToolProvider
24
- } from "../chunk-GJ3IMZQW.js";
25
+ } from "../chunk-MST2H6JB.js";
25
26
  import {
26
27
  PresenceLayer,
27
28
  useAgentPlayback,
@@ -183,6 +184,7 @@ export {
183
184
  ChartDataGrid,
184
185
  ChartEditor,
185
186
  ChartInspector,
187
+ ChartLinksGrid,
186
188
  ChartPresenceLayer,
187
189
  ChartSceneSvg,
188
190
  ChartSparkline,
@@ -106,13 +106,14 @@ function useAutosave(options) {
106
106
  }
107
107
 
108
108
  // src/persistence/useEditorAutosave.ts
109
- import { useCallback as useCallback2, useMemo } from "react";
109
+ import { useCallback as useCallback2, useMemo, useRef as useRef2 } from "react";
110
110
  import {
111
+ collectRetiredEditorAssets,
111
112
  parseEditorDocument,
112
113
  toEditorDocumentFile,
113
114
  withEditorAssets
114
115
  } from "@pixerate/editor/persistence";
115
- function useEditorAutosave(doc, options) {
116
+ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
116
117
  const storage = useMemo(
117
118
  () => doc.assets ? withEditorAssets(options.storage, doc.assets) : options.storage,
118
119
  [options.storage, doc.assets]
@@ -130,7 +131,19 @@ function useEditorAutosave(doc, options) {
130
131
  const snapshot = take();
131
132
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
132
133
  }, [take, doc]);
133
- return { ...autosave, restore };
134
+ const { markClean: clean, discard: drop } = autosave;
135
+ const rawStorage = options.storage;
136
+ const gcRef = useRef2(collectAssetGarbage);
137
+ gcRef.current = collectAssetGarbage;
138
+ const markClean = useCallback2(async () => {
139
+ await clean();
140
+ await collectRetiredEditorAssets(rawStorage, doc, gcRef.current);
141
+ }, [clean, rawStorage, doc]);
142
+ const discard = useCallback2(async () => {
143
+ await drop();
144
+ await collectRetiredEditorAssets(rawStorage, doc, gcRef.current);
145
+ }, [drop, rawStorage, doc]);
146
+ return { ...autosave, restore, markClean, discard };
134
147
  }
135
148
 
136
149
  // src/persistence/RecoveryPrompt.tsx
@@ -272,6 +272,7 @@ var chartCellClass = "h-7 w-full min-w-[4.5rem] bg-transparent px-2 text-right t
272
272
  // src/chart/ChartDataGrid.tsx
273
273
  import { useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
274
274
  import {
275
+ addChartLink,
275
276
  addChartTreeRow,
276
277
  chartColorInputValue,
277
278
  chartSeriesColor,
@@ -281,6 +282,7 @@ import {
281
282
  chartTreeToRows,
282
283
  formatChartNumber,
283
284
  removeChartTreeRow,
285
+ setChartLinkField,
284
286
  setChartTreeRowName,
285
287
  setChartTreeRowValue
286
288
  } from "@pixerate/editor/chart";
@@ -374,8 +376,33 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
374
376
  ] })
375
377
  ] });
376
378
  }
379
+ function ChartLinksGrid({ controller, readOnly = false, className }) {
380
+ const { spec } = useChartState(controller);
381
+ const links = spec.links;
382
+ const commit = (next) => controller.setLinks(next).ok;
383
+ return /* @__PURE__ */ jsxs2("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
384
+ /* @__PURE__ */ jsxs2("table", { className: "w-full border-collapse text-xs", children: [
385
+ /* @__PURE__ */ jsx2("thead", { className: "bg-muted/50", children: /* @__PURE__ */ jsxs2("tr", { children: [
386
+ ["Source", "Target"].map((label) => /* @__PURE__ */ jsx2("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
387
+ /* @__PURE__ */ jsx2("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
388
+ !readOnly && /* @__PURE__ */ jsx2("th", { className: "w-8 border-b border-border" })
389
+ ] }) }),
390
+ /* @__PURE__ */ jsx2("tbody", { children: links.map((link, i) => /* @__PURE__ */ jsxs2("tr", { "data-link-row": i, children: [
391
+ ["source", "target"].map((field) => /* @__PURE__ */ jsx2("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ jsx2(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit(setChartLinkField(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
392
+ /* @__PURE__ */ jsx2("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ jsx2(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit(setChartLinkField(links, i, "value", text)), className: chartCellClass }) }),
393
+ !readOnly && /* @__PURE__ */ jsx2("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ jsx2("button", { type: "button", className: chartIconButtonClass, title: "Delete flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
394
+ ] }, i)) })
395
+ ] }),
396
+ !readOnly && /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap gap-1 p-1", children: [
397
+ /* @__PURE__ */ jsx2("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit(addChartLink(links)), children: "+ Add flow" }),
398
+ /* @__PURE__ */ jsx2("span", { className: "flex-1" }),
399
+ links.length > 0 && /* @__PURE__ */ jsx2("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
400
+ ] })
401
+ ] });
402
+ }
377
403
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
378
404
  const { spec, selection } = useChartState(controller);
405
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ jsx2(ChartLinksGrid, { controller, readOnly, className });
379
406
  if (spec.tree.length) return /* @__PURE__ */ jsx2(ChartTreeGrid, { controller, readOnly, className });
380
407
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
381
408
  const paste = (row, column) => (e) => {
@@ -505,6 +532,7 @@ import {
505
532
  chartTrendlineName,
506
533
  CHART_CURVES,
507
534
  CHART_RADAR_GRATICULES,
535
+ CHART_SANKEY_LINK_COLORS,
508
536
  CHART_LEGEND_POSITIONS,
509
537
  CHART_LIKERT_NEUTRALS,
510
538
  CHART_LIKERT_SORTS,
@@ -756,6 +784,7 @@ function ChartInspector({ controller, sections, className }) {
756
784
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
757
785
  }
758
786
  ) }),
787
+ spec.type === "sankey" && /* @__PURE__ */ jsx3(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ jsx3(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
759
788
  spec.type === "sunburst" && /* @__PURE__ */ jsx3(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ jsx3(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
760
789
  spec.type === "likert" && /* @__PURE__ */ jsx3(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ jsx3(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
761
790
  spec.type === "likert" && /* @__PURE__ */ jsx3(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ jsx3(Select, { id: `${idBase}-likert-sort`, name: "likertSort", value: spec.likertSort, options: CHART_LIKERT_SORTS, labels: { none: "As entered", positive: "Most agreement first", negative: "Most disagreement first" }, onChange: (likertSort) => controller.update({ likertSort }) }) }),
@@ -943,6 +972,7 @@ export {
943
972
  chartCellClass,
944
973
  ChartCommitInput,
945
974
  ChartTreeGrid,
975
+ ChartLinksGrid,
946
976
  ChartDataGrid,
947
977
  ChartInspector
948
978
  };
package/dist/index.cjs CHANGED
@@ -79,6 +79,7 @@ __export(src_exports, {
79
79
  SpreadsheetEditor: () => SpreadsheetEditor,
80
80
  SpreadsheetGroupRow: () => SpreadsheetGroupRow,
81
81
  SpreadsheetValidationDialog: () => SpreadsheetValidationDialog,
82
+ StyleFindings: () => StyleFindings,
82
83
  StylesGallery: () => StylesGallery,
83
84
  TableBubbleMenu: () => TableBubbleMenu,
84
85
  TableToolbar: () => TableToolbar,
@@ -127,6 +128,8 @@ __export(src_exports, {
127
128
  useSpreadsheetClipboard: () => useSpreadsheetClipboard,
128
129
  useSpreadsheetEditor: () => useSpreadsheetEditor,
129
130
  useSpreadsheetViewport: () => useSpreadsheetViewport,
131
+ useStyle: () => useStyle,
132
+ useStyleFindings: () => useStyleFindings,
130
133
  useTableMenu: () => useTableMenu,
131
134
  useToolBridge: () => useToolBridge,
132
135
  useToolRegistryView: () => useToolRegistryView,
@@ -4067,7 +4070,7 @@ var ImageEditorCanvas = ({
4067
4070
  modeRef.current = mode;
4068
4071
  const latest = (0, import_react41.useRef)({ onError, onTypeSessionChange, locate, locateElement, open, chromeRoot, onPlaybackReveal });
4069
4072
  latest.current = { onError, onTypeSessionChange, locate, locateElement, open, chromeRoot, onPlaybackReveal };
4070
- const report = (source, message) => latest.current.onError?.(source, message);
4073
+ const report = (source, message2) => latest.current.onError?.(source, message2);
4071
4074
  const ambientPlayback = useAgentPlayback();
4072
4075
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4073
4076
  const locateLayer = (0, import_react41.useMemo)(() => (0, import_image_editor2.createImagePlaybackLocator)(controller), [controller]);
@@ -7469,7 +7472,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
7469
7472
  const [, setTick] = (0, import_react55.useState)(0);
7470
7473
  (0, import_react55.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
7471
7474
  const [browse, setBrowse] = (0, import_react55.useState)(null);
7472
- const [message, setMessage] = (0, import_react55.useState)(null);
7475
+ const [message2, setMessage] = (0, import_react55.useState)(null);
7473
7476
  const [open, setOpen] = (0, import_react55.useState)(null);
7474
7477
  const provider = controller.effectsProvider;
7475
7478
  const state = controller.getState();
@@ -7569,7 +7572,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
7569
7572
  ] }, f.id);
7570
7573
  }) }),
7571
7574
  !layer && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
7572
- message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
7575
+ message2 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message2 })
7573
7576
  ] });
7574
7577
  }
7575
7578
 
@@ -8651,10 +8654,10 @@ var ImageEditor = ({
8651
8654
  const [selectionError, setSelectionError] = (0, import_react64.useState)(null);
8652
8655
  const [paintError, setPaintError] = (0, import_react64.useState)(null);
8653
8656
  const [shapeTypeError, setShapeTypeError] = (0, import_react64.useState)(null);
8654
- const handleCanvasError = (source, message) => {
8655
- if (source === "paint") setPaintError(message);
8656
- else if (source === "select") setSelectionError(message);
8657
- else setShapeTypeError(message);
8657
+ const handleCanvasError = (source, message2) => {
8658
+ if (source === "paint") setPaintError(message2);
8659
+ else if (source === "select") setSelectionError(message2);
8660
+ else setShapeTypeError(message2);
8658
8661
  };
8659
8662
  const finishTyping = () => setTypeSession(null);
8660
8663
  const transformToolRef = (0, import_react64.useRef)(null);
@@ -10336,7 +10339,7 @@ function useAutosave(options) {
10336
10339
  // src/persistence/useEditorAutosave.ts
10337
10340
  var import_react72 = require("react");
10338
10341
  var import_persistence2 = require("@pixerate/editor/persistence");
10339
- function useEditorAutosave(doc, options) {
10342
+ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
10340
10343
  const storage = (0, import_react72.useMemo)(
10341
10344
  () => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
10342
10345
  [options.storage, doc.assets]
@@ -10354,7 +10357,19 @@ function useEditorAutosave(doc, options) {
10354
10357
  const snapshot = take();
10355
10358
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
10356
10359
  }, [take, doc]);
10357
- return { ...autosave, restore };
10360
+ const { markClean: clean, discard: drop } = autosave;
10361
+ const rawStorage = options.storage;
10362
+ const gcRef = (0, import_react72.useRef)(collectAssetGarbage);
10363
+ gcRef.current = collectAssetGarbage;
10364
+ const markClean = (0, import_react72.useCallback)(async () => {
10365
+ await clean();
10366
+ await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
10367
+ }, [clean, rawStorage, doc]);
10368
+ const discard = (0, import_react72.useCallback)(async () => {
10369
+ await drop();
10370
+ await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
10371
+ }, [drop, rawStorage, doc]);
10372
+ return { ...autosave, restore, markClean, discard };
10358
10373
  }
10359
10374
 
10360
10375
  // src/persistence/RecoveryPrompt.tsx
@@ -11501,8 +11516,33 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
11501
11516
  ] })
11502
11517
  ] });
11503
11518
  }
11519
+ function ChartLinksGrid({ controller, readOnly = false, className }) {
11520
+ const { spec } = useChartState(controller);
11521
+ const links = spec.links;
11522
+ const commit = (next) => controller.setLinks(next).ok;
11523
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
11524
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
11525
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("tr", { children: [
11526
+ ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
11527
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
11528
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("th", { className: "w-8 border-b border-border" })
11529
+ ] }) }),
11530
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("tr", { "data-link-row": i, children: [
11531
+ ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
11532
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, "value", text)), className: chartCellClass }) }),
11533
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
11534
+ ] }, i)) })
11535
+ ] }),
11536
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
11537
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
11538
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "flex-1" }),
11539
+ links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
11540
+ ] })
11541
+ ] });
11542
+ }
11504
11543
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
11505
11544
  const { spec, selection } = useChartState(controller);
11545
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ChartLinksGrid, { controller, readOnly, className });
11506
11546
  if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ChartTreeGrid, { controller, readOnly, className });
11507
11547
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
11508
11548
  const paste = (row, column) => (e) => {
@@ -11851,6 +11891,7 @@ function ChartInspector({ controller, sections, className }) {
11851
11891
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
11852
11892
  }
11853
11893
  ) }),
11894
+ spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
11854
11895
  spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
11855
11896
  spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime60.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 }) }) }),
11856
11897
  spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime60.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 }) }) }),
@@ -12088,6 +12129,117 @@ function createReactChartNodeView(options = {}) {
12088
12129
  };
12089
12130
  };
12090
12131
  }
12132
+
12133
+ // src/style/useStyle.ts
12134
+ var import_react86 = require("react");
12135
+ var message = (error) => error instanceof Error ? error.message : String(error);
12136
+ function useResolverTask(styles, run, deliver, deps) {
12137
+ (0, import_react86.useEffect)(() => {
12138
+ if (!styles || !run) {
12139
+ deliver({ value: null, error: null });
12140
+ return;
12141
+ }
12142
+ let latest = 0;
12143
+ let active = true;
12144
+ const go = () => {
12145
+ const call = ++latest;
12146
+ run(styles).then(
12147
+ (value) => {
12148
+ if (active && call === latest) deliver({ value, error: null });
12149
+ },
12150
+ (error) => {
12151
+ if (active && call === latest) deliver({ value: null, error: message(error) });
12152
+ }
12153
+ );
12154
+ };
12155
+ go();
12156
+ const unsubscribe = styles.subscribe(go);
12157
+ return () => {
12158
+ active = false;
12159
+ unsubscribe();
12160
+ };
12161
+ }, [styles, ...deps]);
12162
+ }
12163
+ function useStyle(styles, domain) {
12164
+ const [result, setResult] = (0, import_react86.useState)({ style: null, error: null });
12165
+ useResolverTask(
12166
+ styles,
12167
+ (s) => s.resolve(domain),
12168
+ ({ value, error }) => setResult({ style: value, error }),
12169
+ [domain]
12170
+ );
12171
+ return result;
12172
+ }
12173
+ function useStyleFindings(styles, domain, state) {
12174
+ const [result, setResult] = (0, import_react86.useState)({ report: null, style: null, error: null });
12175
+ useResolverTask(
12176
+ styles,
12177
+ (s) => s.check(domain, state),
12178
+ ({ value, error }) => {
12179
+ if (!value) setResult({ report: null, style: null, error });
12180
+ else {
12181
+ const { style, ...report } = value;
12182
+ setResult({ report, style, error: null });
12183
+ }
12184
+ },
12185
+ [domain, state]
12186
+ );
12187
+ return result;
12188
+ }
12189
+
12190
+ // src/style/StyleFindings.tsx
12191
+ var import_jsx_runtime62 = require("react/jsx-runtime");
12192
+ var SEVERITY_CLASS = {
12193
+ error: "text-destructive",
12194
+ warning: "text-amber-600",
12195
+ info: "text-muted-foreground"
12196
+ };
12197
+ function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
12198
+ if (!report) return null;
12199
+ const { findings, ran, skipped } = report;
12200
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
12201
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
12202
+ findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
12203
+ const selectable = finding.target !== void 0 && !!onSelect;
12204
+ const body = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
12205
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
12206
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
12207
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { "data-style-message": "", children: finding.message }),
12208
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
12209
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("code", { children: finding.check }),
12210
+ finding.layer && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
12211
+ " \xB7 ",
12212
+ finding.layer
12213
+ ] })
12214
+ ] })
12215
+ ] })
12216
+ ] });
12217
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12218
+ "button",
12219
+ {
12220
+ type: "button",
12221
+ className: "flex w-full items-start gap-2 rounded border border-border px-2 py-1 text-left hover:bg-muted",
12222
+ onClick: () => onSelect(finding),
12223
+ children: body
12224
+ }
12225
+ ) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
12226
+ }) }),
12227
+ findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
12228
+ "All clear: ",
12229
+ ran.length,
12230
+ " ",
12231
+ ran.length === 1 ? "check" : "checks",
12232
+ " passed."
12233
+ ] }),
12234
+ findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
12235
+ skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { "data-style-skipped-check": s.check, children: [
12236
+ "Skipped ",
12237
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("code", { children: s.check }),
12238
+ ": ",
12239
+ s.reason
12240
+ ] }, s.check)) })
12241
+ ] });
12242
+ }
12091
12243
  // Annotate the CommonJS export names for ESM import in node:
12092
12244
  0 && (module.exports = {
12093
12245
  AdjustmentLayersPanel,
@@ -12138,6 +12290,7 @@ function createReactChartNodeView(options = {}) {
12138
12290
  SpreadsheetEditor,
12139
12291
  SpreadsheetGroupRow,
12140
12292
  SpreadsheetValidationDialog,
12293
+ StyleFindings,
12141
12294
  StylesGallery,
12142
12295
  TableBubbleMenu,
12143
12296
  TableToolbar,
@@ -12186,6 +12339,8 @@ function createReactChartNodeView(options = {}) {
12186
12339
  useSpreadsheetClipboard,
12187
12340
  useSpreadsheetEditor,
12188
12341
  useSpreadsheetViewport,
12342
+ useStyle,
12343
+ useStyleFindings,
12189
12344
  useTableMenu,
12190
12345
  useToolBridge,
12191
12346
  useToolRegistryView,
package/dist/index.d.cts CHANGED
@@ -36,3 +36,4 @@ export * from "./generation/index.cjs";
36
36
  export * from "./find-replace/index.cjs";
37
37
  export * from "./tables/index.cjs";
38
38
  export * from "./chart-node/index.cjs";
39
+ export * from "./style/index.cjs";
package/dist/index.d.ts CHANGED
@@ -36,3 +36,4 @@ export * from "./generation/index.js";
36
36
  export * from "./find-replace/index.js";
37
37
  export * from "./tables/index.js";
38
38
  export * from "./chart-node/index.js";
39
+ export * from "./style/index.js";