sfn-diagram-react 0.6.0 → 0.7.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 CHANGED
@@ -62,12 +62,12 @@ JSON string of either. In the browser, pass the JSON string.
62
62
  overlaying an execution onto a diff. Combining them calls `onError` and renders `null`,
63
63
  the same way any other invalid input is handled.
64
64
 
65
- **`format="mermaid"` combined with `history` ignores every other diagram option** —
66
- `catchHandling`, `collapse`, `edgeStyle`, `showVariables`, and the rest. Core's
67
- Mermaid execution-overlay function (`generateMermaidExecution`) accepts only the ASL
68
- definition, `history`, `layout`, and `theme`; unlike the plain Mermaid path
69
- (`generateMermaid`), which honours the full option set. The SVG execution overlay is
70
- unaffected — it honours every option.
65
+ **`format="mermaid"` combined with `history` honours the same options as plain
66
+ `format="mermaid"`** — `catchHandling`, `collapse`, `showVariables`, `layout` and
67
+ `theme` — with sfn-diagram 1.10 or later. Earlier versions of core's Mermaid
68
+ execution-overlay function (`generateMermaidExecution`) accept only the ASL definition,
69
+ `history`, `layout`, and `theme`, and ignore the rest. The SVG execution overlay
70
+ honours every option.
71
71
 
72
72
  ### Interactive viewer (`format="html"`)
73
73
 
@@ -109,9 +109,9 @@ coloured (green / yellow / red) instead of the machine's normal styling.
109
109
  for either combination. Combining them calls `onError` and renders `null`.
110
110
  - The **SVG diff** (`generateDiff`) honours every diagram option this package forwards
111
111
  (`collapse`, `catchHandling`, `showIcons`, and the rest).
112
- - The **Mermaid diff** (`generateMermaidDiff`) accepts only the two definitions — every
113
- other prop (`layout`, `theme`, `collapse`, …) is silently ignored in `format="mermaid"`
114
- diff mode.
112
+ - The **Mermaid diff** ignores every prop except the two definitions (`layout`, `theme`,
113
+ `collapse`, …) in `format="mermaid"` diff mode: this package doesn't forward them to
114
+ `generateMermaidDiff` yet (#393), although core accepts them since sfn-diagram 1.10.
115
115
 
116
116
  ### `onStateClick`
117
117
 
@@ -199,8 +199,8 @@ ones (`className`, `onError`, `onStateClick`, `style`, `title`). Errors are retu
199
199
  | `theme` | `'light' \| 'dark' \| CustomTheme` | `'light'` | svg, mermaid | Diagram theme. |
200
200
  | `title` | `string` | `'Step Functions diagram'` | html only | Accessible title for the rendered iframe. |
201
201
 
202
- ¹ Ignored when `format="mermaid"` is combined with `history` — see
203
- [Execution overlay](#execution-overlay). Applies normally to plain `format="mermaid"`
202
+ ¹ Ignored when `format="mermaid"` is combined with `history` on sfn-diagram before 1.10 —
203
+ see [Execution overlay](#execution-overlay). Applies normally to plain `format="mermaid"`
204
204
  (no `history`). `format="mermaid"` diff mode (the `before` prop) is a separate
205
205
  carve-out with its own rule — see [Diff mode](#diff-mode).
206
206
 
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  let react = require("react");
4
4
  let sfn_diagram = require("sfn-diagram");
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
- //#region src/useSfnDiagram.ts
6
+ // src/useSfnDiagram.ts
7
7
  function toAslString(params) {
8
8
  const { definition } = params;
9
9
  return typeof definition === "string" ? definition : JSON.stringify(definition);
@@ -153,8 +153,7 @@ function useSfnDiagram(params) {
153
153
  theme
154
154
  ]);
155
155
  }
156
- //#endregion
157
- //#region src/SfnDiagram.tsx
156
+ // src/SfnDiagram.tsx
158
157
  const SfnDiagram = (0, react.forwardRef)(function SfnDiagram({ className, onError, onStateClick, style, title = "Step Functions diagram", ...diagramParams }, ref) {
159
158
  const result = useSfnDiagram(diagramParams);
160
159
  (0, react.useImperativeHandle)(ref, () => ({ getSvg: () => result.type === "svg" ? result.svg : null }), [result]);
@@ -195,6 +194,5 @@ const SfnDiagram = (0, react.forwardRef)(function SfnDiagram({ className, onErro
195
194
  style
196
195
  });
197
196
  });
198
- //#endregion
199
197
  exports.SfnDiagram = SfnDiagram;
200
198
  exports.useSfnDiagram = useSfnDiagram;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  import { DiagramOptions, DiffOutput, ExecutionHistoryInput, ExecutionOutput, HtmlOutput, MermaidDiffOutput, MermaidExecutionOutput, MermaidOutput, SvgOutput } from "sfn-diagram";
3
- //#region src/useSfnDiagram.d.ts
4
3
  interface UseSfnDiagramParams extends Pick<DiagramOptions, 'catchHandling' | 'collapse' | 'edgeOverrides' | 'edgeStyle' | 'iconPosition' | 'iconSize' | 'layout' | 'nodeOverrides' | 'showIcons' | 'showVariables' | 'theme'> {
5
4
  /**
6
5
  * When set, `definition` is treated as the *after* side of a diff and `before`
@@ -10,10 +9,10 @@ interface UseSfnDiagramParams extends Pick<DiagramOptions, 'catchHandling' | 'co
10
9
  * functions take no history) or with `format="html"` (core's `generateHtml`
11
10
  * accepts a diff since sfn-diagram 1.8, but this hook does not wire it up yet).
12
11
  *
13
- * The Mermaid diff (`generateMermaidDiff`) ignores every option in this
14
- * type's `Pick<DiagramOptions, ...>` list - `layout`, `theme`, and the rest -
15
- * since core's diff-specific function accepts only the two definitions. The
16
- * SVG diff honours them.
12
+ * The Mermaid diff ignores every option in this type's `Pick<DiagramOptions, ...>`
13
+ * list - `layout`, `theme`, and the rest: this hook doesn't forward them to
14
+ * `generateMermaidDiff` yet (#393), although core accepts them since sfn-diagram
15
+ * 1.10. The SVG diff honours them.
17
16
  */
18
17
  before?: object | string;
19
18
  definition: object | string;
@@ -81,8 +80,6 @@ type SfnDiagramResult = {
81
80
  * ```
82
81
  */
83
82
  export declare function useSfnDiagram(params: UseSfnDiagramParams): SfnDiagramResult;
84
- //#endregion
85
- //#region src/SfnDiagram.d.ts
86
83
  interface SfnDiagramProps extends UseSfnDiagramParams {
87
84
  className?: string;
88
85
  onError?: (error: Error) => void;
@@ -121,5 +118,4 @@ interface SfnDiagramHandle {
121
118
  getSvg(): string | null;
122
119
  }
123
120
  export declare const SfnDiagram: import("react").ForwardRefExoticComponent<SfnDiagramProps & import("react").RefAttributes<SfnDiagramHandle>>;
124
- //#endregion
125
121
  export type { OnStateClickParams, SfnDiagramHandle, SfnDiagramProps, SfnDiagramResult, UseSfnDiagramParams };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  import { DiagramOptions, DiffOutput, ExecutionHistoryInput, ExecutionOutput, HtmlOutput, MermaidDiffOutput, MermaidExecutionOutput, MermaidOutput, SvgOutput } from "sfn-diagram";
3
- //#region src/useSfnDiagram.d.ts
4
3
  interface UseSfnDiagramParams extends Pick<DiagramOptions, 'catchHandling' | 'collapse' | 'edgeOverrides' | 'edgeStyle' | 'iconPosition' | 'iconSize' | 'layout' | 'nodeOverrides' | 'showIcons' | 'showVariables' | 'theme'> {
5
4
  /**
6
5
  * When set, `definition` is treated as the *after* side of a diff and `before`
@@ -10,10 +9,10 @@ interface UseSfnDiagramParams extends Pick<DiagramOptions, 'catchHandling' | 'co
10
9
  * functions take no history) or with `format="html"` (core's `generateHtml`
11
10
  * accepts a diff since sfn-diagram 1.8, but this hook does not wire it up yet).
12
11
  *
13
- * The Mermaid diff (`generateMermaidDiff`) ignores every option in this
14
- * type's `Pick<DiagramOptions, ...>` list - `layout`, `theme`, and the rest -
15
- * since core's diff-specific function accepts only the two definitions. The
16
- * SVG diff honours them.
12
+ * The Mermaid diff ignores every option in this type's `Pick<DiagramOptions, ...>`
13
+ * list - `layout`, `theme`, and the rest: this hook doesn't forward them to
14
+ * `generateMermaidDiff` yet (#393), although core accepts them since sfn-diagram
15
+ * 1.10. The SVG diff honours them.
17
16
  */
18
17
  before?: object | string;
19
18
  definition: object | string;
@@ -81,8 +80,6 @@ type SfnDiagramResult = {
81
80
  * ```
82
81
  */
83
82
  export declare function useSfnDiagram(params: UseSfnDiagramParams): SfnDiagramResult;
84
- //#endregion
85
- //#region src/SfnDiagram.d.ts
86
83
  interface SfnDiagramProps extends UseSfnDiagramParams {
87
84
  className?: string;
88
85
  onError?: (error: Error) => void;
@@ -121,5 +118,4 @@ interface SfnDiagramHandle {
121
118
  getSvg(): string | null;
122
119
  }
123
120
  export declare const SfnDiagram: import("react").ForwardRefExoticComponent<SfnDiagramProps & import("react").RefAttributes<SfnDiagramHandle>>;
124
- //#endregion
125
121
  export type { OnStateClickParams, SfnDiagramHandle, SfnDiagramProps, SfnDiagramResult, UseSfnDiagramParams };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
3
3
  import { generateDiff, generateExecution, generateHtml, generateMermaid, generateMermaidDiff, generateMermaidExecution, generateSvg } from "sfn-diagram";
4
4
  import { jsx } from "react/jsx-runtime";
5
- //#region src/useSfnDiagram.ts
5
+ // src/useSfnDiagram.ts
6
6
  function toAslString(params) {
7
7
  const { definition } = params;
8
8
  return typeof definition === "string" ? definition : JSON.stringify(definition);
@@ -152,8 +152,7 @@ function useSfnDiagram(params) {
152
152
  theme
153
153
  ]);
154
154
  }
155
- //#endregion
156
- //#region src/SfnDiagram.tsx
155
+ // src/SfnDiagram.tsx
157
156
  const SfnDiagram = forwardRef(function SfnDiagram({ className, onError, onStateClick, style, title = "Step Functions diagram", ...diagramParams }, ref) {
158
157
  const result = useSfnDiagram(diagramParams);
159
158
  useImperativeHandle(ref, () => ({ getSvg: () => result.type === "svg" ? result.svg : null }), [result]);
@@ -194,5 +193,4 @@ const SfnDiagram = forwardRef(function SfnDiagram({ className, onError, onStateC
194
193
  style
195
194
  });
196
195
  });
197
- //#endregion
198
196
  export { SfnDiagram, useSfnDiagram };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfn-diagram-react",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "React component for AWS Step Functions ASL diagrams",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -70,16 +70,16 @@
70
70
  "@arethetypeswrong/cli": "^0.18.5",
71
71
  "@testing-library/jest-dom": "^7.0.1",
72
72
  "@testing-library/react": "^16.0.0",
73
- "@types/react": "^18.3.0",
74
- "@types/react-dom": "^18.3.0",
73
+ "@types/react": "^19.3.0",
74
+ "@types/react-dom": "^19.3.0",
75
75
  "jsdom": "^26.0.0",
76
- "publint": "^0.3.16",
77
- "react": "^18.3.0",
78
- "react-dom": "^18.3.0",
76
+ "publint": "^0.3.25",
77
+ "react": "^19.3.1",
78
+ "react-dom": "^19.3.1",
79
79
  "sfn-diagram": "workspace:*",
80
- "tsdown": "^0.23.0",
81
- "typescript": "^5.9.2",
82
- "vite": "^8.3.0",
83
- "vitest": "^4.1.11"
80
+ "tsdown": "^0.23.1",
81
+ "typescript": "^6.0.3",
82
+ "vite": "^8.3.5",
83
+ "vitest": "^4.1.12"
84
84
  }
85
85
  }