@signalsafe/tree-spec-editor-react 0.3.5 → 0.3.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.6 — 2026-11-29
4
+
5
+ Qualify React 18.3.1 and 19.3.1. Commit canvas snapshots after React commits their nodes/edges, mutate history outside state updater callbacks, and retain the compiled loaded tree as the saved baseline. Renderer teardown in tests uses act; all behavioral assertions remain.
6
+
7
+
3
8
  ## 0.3.5 — 2026-11-23
4
9
 
5
10
  - Publish npm releases through GitHub Actions OIDC trusted publishing.
package/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @signalsafe/tree-spec-editor-react
2
2
 
3
+ [![Build](https://github.com/SignalSafeSoftware/tree-spec-editor-react/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/SignalSafeSoftware/tree-spec-editor-react/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@signalsafe/tree-spec-editor-react?logo=npm)](https://www.npmjs.com/package/@signalsafe/tree-spec-editor-react)
5
+ [![npm downloads per month](https://img.shields.io/npm/dm/@signalsafe/tree-spec-editor-react?label=downloads%2Fmonth)](https://www.npmjs.com/package/@signalsafe/tree-spec-editor-react)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/SignalSafeSoftware/tree-spec-editor-react/blob/main/LICENSE)
7
+
8
+ Release candidate: Qualify React 18.3.1 and 19.3.1. Commit canvas snapshots after React commits their nodes/edges, mutate history outside state updater callbacks, and retain the compiled loaded tree as the saved baseline. Renderer teardown in tests uses act; all behavioral assertions remain. No publication or host adoption is implied; local verification uses explicit sealed upstream archives until release-order lockfiles can be regenerated normally.
9
+
3
10
  Current source and planned customer-subdomain impact: [current-state summary](docs/current-release-candidate.md).
4
11
 
5
12
  Headless **React + React Flow** layer for the SignalSafe TreeSpec graph editor: canvas component, orchestration hook, and wiring to `@signalsafe/tree-spec-editor-core`.
@@ -1 +1 @@
1
- {"version":3,"file":"useCanvasGraphState.d.ts","sourceRoot":"","sources":["../../src/hooks/useCanvasGraphState.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,QAAQ,EAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EASH,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGxB,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7F,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,uBAAuB,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACpC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,oBAAoB,EAAE,aAAa,CAAC;IACpC,oBAAoB,EAAE,aAAa,CAAC;IACpC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,QAA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C;IACd,oBAAoB,EAAE,aAAa,CAAC;IACpC,oBAAoB,EAAE,aAAa,CAAC;IACpC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxE,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CACnE,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,yBAAyB,CA8KlG"}
@@ -6,6 +6,7 @@ import { NODE_DRAG_HANDLE_SELECTOR } from '../canvas/constants.js';
6
6
  export function useCanvasGraphState(options) {
7
7
  const { tree, onChange, issues, issuesByNode, readOnly, resizeHeightByNodeId, isResizingRef, suppressViewportSaveRef, } = options;
8
8
  const isDraggingRef = useRef(false);
9
+ const pendingCommitRef = useRef(false);
9
10
  const nodesRef = useRef([]);
10
11
  const edgesRef = useRef([]);
11
12
  const treeRef = useRef(tree);
@@ -59,12 +60,6 @@ export function useCanvasGraphState(options) {
59
60
  const initialEdges = useMemo(() => buildEdgesFromTransitions(tree), [tree]);
60
61
  const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
61
62
  const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
62
- useEffect(() => {
63
- nodesRef.current = nodes;
64
- }, [nodes]);
65
- useEffect(() => {
66
- edgesRef.current = edges;
67
- }, [edges]);
68
63
  const lastTreeRef = useRef('');
69
64
  useEffect(() => {
70
65
  const nextKey = JSON.stringify({ tree, issues: issues.length });
@@ -107,13 +102,20 @@ export function useCanvasGraphState(options) {
107
102
  }
108
103
  onChange(nextTree);
109
104
  }, [tree, onChange]);
105
+ useEffect(() => {
106
+ nodesRef.current = nodes;
107
+ edgesRef.current = edges;
108
+ if (!pendingCommitRef.current)
109
+ return;
110
+ pendingCommitRef.current = false;
111
+ commit(nodes, edges);
112
+ }, [nodes, edges, commit]);
110
113
  const onMoveEnd = useCallback((_event, viewport) => {
111
114
  if (suppressViewportSaveRef.current)
112
115
  return;
113
116
  onChange(patchGraphEditorMeta(tree, { viewport }));
114
117
  }, [tree, onChange, suppressViewportSaveRef]);
115
118
  const onNodesChangeWrapped = useCallback((changes) => {
116
- onNodesChange(changes);
117
119
  const shouldCommit = changes.some((c) => {
118
120
  if (c?.type === 'select' || c?.type === 'dimensions')
119
121
  return false;
@@ -122,14 +124,15 @@ export function useCanvasGraphState(options) {
122
124
  return true;
123
125
  });
124
126
  if (shouldCommit)
125
- queueMicrotask(() => commit(nodesRef.current, edgesRef.current));
126
- }, [onNodesChange, commit]);
127
+ pendingCommitRef.current = true;
128
+ onNodesChange(changes);
129
+ }, [onNodesChange]);
127
130
  const onEdgesChangeWrapped = useCallback((changes) => {
128
- onEdgesChange(changes);
129
131
  const shouldCommit = changes.some((c) => c?.type !== 'select');
130
132
  if (shouldCommit)
131
- queueMicrotask(() => commit(nodesRef.current, edgesRef.current));
132
- }, [onEdgesChange, commit]);
133
+ pendingCommitRef.current = true;
134
+ onEdgesChange(changes);
135
+ }, [onEdgesChange]);
133
136
  const onNodeDragStart = useCallback(() => {
134
137
  isDraggingRef.current = true;
135
138
  }, []);
@@ -1 +1 @@
1
- {"version":3,"file":"useEditorAdapter.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjH,OAAO,EAKH,KAAK,aAAa,EAClB,KAAK,YAAY,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAQH,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC5B,MAAM,mCAAmC,CAAC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CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACjD,cAAc,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC3D,eAAe,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;IAC7D,YAAY,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;IACvD,WAAW,EAAE,SAAS,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7D,YAAY,EAAE,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,uBAAuB,GAAG,sBAAsB,CA2UhG"}
@@ -59,7 +59,7 @@ export function useEditorAdapter(adapterOptions) {
59
59
  void validateRef.current(spec);
60
60
  });
61
61
  }
62
- lastSavedKeyRef.current = JSON.stringify(spec);
62
+ lastSavedKeyRef.current = JSON.stringify(compileTreeSpec(nextTree));
63
63
  setAutosaveStatus(AUTOSAVE_STATUS.IDLE);
64
64
  }
65
65
  }
@@ -239,8 +239,9 @@ export function useEditorAdapter(adapterOptions) {
239
239
  const spec = coerceRawSpec(rawSpec);
240
240
  if (spec != null) {
241
241
  setRawTreeSpec(spec);
242
- replaceTreeWithoutHistory(decompileTreeSpec(spec));
243
- lastSavedKeyRef.current = JSON.stringify(spec);
242
+ const nextTree = decompileTreeSpec(spec);
243
+ replaceTreeWithoutHistory(nextTree);
244
+ lastSavedKeyRef.current = JSON.stringify(compileTreeSpec(nextTree));
244
245
  setAutosaveStatus(AUTOSAVE_STATUS.IDLE);
245
246
  }
246
247
  setShowDraftHistory(false);
@@ -1 +1 @@
1
- {"version":3,"file":"useEditorHistory.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorHistory.ts"],"names":[],"mappings":"AAEA,OAAO,EAaH,KAAK,UAAU,EACf,KAAK,cAAc,EACtB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,yBAAyB,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7D,IAAI,EAAE,MAAM,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,OAAO,CAAC;IACpB,gBAAgB,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,OAAO,CAAC;IACrD,eAAe,EAAE,CACjB,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,EAC5C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAC1C,OAAO,CAAC;IACb,iBAAiB,EAAE,CACf,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,EAC5C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAC1C,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,sBAAsB,CAuH/F"}
1
+ {"version":3,"file":"useEditorHistory.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorHistory.ts"],"names":[],"mappings":"AAEA,OAAO,EAaH,KAAK,UAAU,EACf,KAAK,cAAc,EACtB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,yBAAyB,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7D,IAAI,EAAE,MAAM,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,OAAO,CAAC;IACpB,gBAAgB,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,OAAO,CAAC;IACrD,eAAe,EAAE,CACjB,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,EAC5C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAC1C,OAAO,CAAC;IACb,iBAAiB,EAAE,CACf,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,EAC5C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAC1C,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,sBAAsB,CA6H/F"}
@@ -2,6 +2,7 @@ import { useCallback, useRef, useState } from 'react';
2
2
  import { canRedoEditorHistory, canUndoEditorHistory, clearEditorHistory, createEditorHistoryStack, duplicateNode, editorTreesEqual, END_NODE_ID, GRAPH_SELECTION_KIND, popEditorRedo, popEditorUndo, pushEditorHistory, } from '@signalsafe/tree-spec-editor-core';
3
3
  export function useEditorHistory(isPublished, readOnly = false) {
4
4
  const [tree, setTree] = useState(null);
5
+ const treeRef = useRef(null);
5
6
  const historyRef = useRef(createEditorHistoryStack());
6
7
  const copiedNodeIdRef = useRef(null);
7
8
  const [canUndo, setCanUndo] = useState(false);
@@ -21,40 +22,45 @@ export function useEditorHistory(isPublished, readOnly = false) {
21
22
  const commitTree = useCallback((next) => {
22
23
  if (readOnly)
23
24
  return;
24
- setTree((prev) => {
25
- if (prev && next && !editorTreesEqual(prev, next)) {
26
- pushEditorHistory(historyRef.current, prev);
27
- }
28
- return next;
29
- });
30
- queueMicrotask(syncHistoryMeta);
25
+ const previous = treeRef.current;
26
+ if (previous && next && !editorTreesEqual(previous, next)) {
27
+ pushEditorHistory(historyRef.current, previous);
28
+ }
29
+ treeRef.current = next;
30
+ setTree(next);
31
+ syncHistoryMeta();
31
32
  }, [syncHistoryMeta, readOnly]);
32
33
  const replaceTreeWithoutHistory = useCallback((next) => {
33
34
  resetEditorHistory();
35
+ treeRef.current = next;
34
36
  setTree(next);
35
37
  }, [resetEditorHistory]);
36
38
  const undo = useCallback(() => {
37
- if (!tree || isPublished || readOnly)
39
+ const current = treeRef.current;
40
+ if (!current || isPublished || readOnly)
38
41
  return false;
39
- const result = popEditorUndo(historyRef.current, tree);
42
+ const result = popEditorUndo(historyRef.current, current);
40
43
  if (!result)
41
44
  return false;
42
45
  historyRef.current.future.unshift(result.currentSnapshot);
46
+ treeRef.current = result.nextTree;
43
47
  setTree(result.nextTree);
44
- queueMicrotask(syncHistoryMeta);
48
+ syncHistoryMeta();
45
49
  return true;
46
- }, [tree, isPublished, readOnly, syncHistoryMeta]);
50
+ }, [isPublished, readOnly, syncHistoryMeta]);
47
51
  const redo = useCallback(() => {
48
- if (!tree || isPublished || readOnly)
52
+ const current = treeRef.current;
53
+ if (!current || isPublished || readOnly)
49
54
  return false;
50
- const result = popEditorRedo(historyRef.current, tree);
55
+ const result = popEditorRedo(historyRef.current, current);
51
56
  if (!result)
52
57
  return false;
53
58
  historyRef.current.past.push(result.currentSnapshot);
59
+ treeRef.current = result.nextTree;
54
60
  setTree(result.nextTree);
55
- queueMicrotask(syncHistoryMeta);
61
+ syncHistoryMeta();
56
62
  return true;
57
- }, [tree, isPublished, readOnly, syncHistoryMeta]);
63
+ }, [isPublished, readOnly, syncHistoryMeta]);
58
64
  const copySelectedNode = useCallback((selection) => {
59
65
  if (selection.kind !== GRAPH_SELECTION_KIND.NODE || !selection.id)
60
66
  return false;
@@ -1,4 +1,18 @@
1
- # Release candidate: @signalsafe/tree-spec-editor-react 0.3.4
1
+ # Release candidate: @signalsafe/tree-spec-editor-react 0.3.6
2
+
3
+ The qualified React 18/19 hooks preserve synchronous history authority, batched undo/redo order and autosave identity boundaries. The coordinated dependency minimums match the reviewed learning-package integration.
4
+
5
+ Normal published registry dependencies and genuine frozen locks are required before this candidate is tagged. Hosted CI, Sonar, packed-consumer checks and the exact archive gate remain enforced. The existing OIDC publisher is preserved; this release does not deploy a website or gallery.
6
+
7
+ See [RELEASING.md](../RELEASING.md) for publisher and protected-branch requirements. Registry availability is established only by successful publication and downloaded-archive verification.
8
+
9
+ ## Historical release and state record
10
+
11
+
12
+ The previous snapshot below is retained for context; its version and publication
13
+ status statements apply to that earlier snapshot.
14
+
15
+ ### Release candidate: @signalsafe/tree-spec-editor-react 0.3.4
2
16
 
3
17
  The published baseline is 0.3.3. Reconcile reviewed Vite and Playwright updates, regenerate the exact graph example SVG, and adopt verified current TreeSpec/editor-core maintenance dependencies. Existing public exports and runtime behavior remain compatible. The source was reconciled with current remote refactors and additional regression tests while preserving original uncommitted work separately.
4
18
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!-- Generated by docs/demo/generate-doc-images.mjs. Do not edit by hand. -->
3
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1400" height="840" viewBox="0 0 1400 840" data-tree-spec-demo-source-hash="0d085cd14190dff70461f45f1cdf06e7bef210b1ffe08ae9d1da5687ec9054fc">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1400" height="840" viewBox="0 0 1400 840" data-tree-spec-demo-source-hash="f202d608ec6ae54fb06e4977accbdbf8cfa77a28dfa1099349d6633e0692ae4d">
4
4
  <title>TreeSpec editor incident response example</title>
5
5
  <foreignObject x="0" y="0" width="1400" height="840">
6
6
  <div xmlns="http://www.w3.org/1999/xhtml">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalsafe/tree-spec-editor-react",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "description": "UI-kit agnostic React Flow canvas for the SignalSafe TreeSpec graph editor (no UI library).",
6
6
  "license": "MIT",
@@ -65,11 +65,11 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@signalsafe/tree-spec": "^0.4.5",
68
- "@signalsafe/tree-spec-editor-core": "^0.2.4"
68
+ "@signalsafe/tree-spec-editor-core": "^0.2.6"
69
69
  },
70
70
  "peerDependencies": {
71
- "react": "^18.0.0",
72
- "react-dom": "^18.0.0",
71
+ "react": "^18.0.0 || ^19.3.1",
72
+ "react-dom": "^18.0.0 || ^19.3.1",
73
73
  "reactflow": "^11.0.0"
74
74
  },
75
75
  "devDependencies": {