@squeed/flow-sdk 2.0.29 → 2.0.31

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
@@ -12,6 +12,42 @@ Requires React 18 and Chakra UI 3.36 or later. Peer dependencies: `react`, `reac
12
12
 
13
13
  The Markdown renderer is a required peer supplied by the consuming application, not embedded in the SDK bundle. It remains part of the application's dependency footprint.
14
14
 
15
+ ## Ownership And Code Patterns
16
+
17
+ The dependency direction is **Squeed app -> public SDK API**. This package owns
18
+ reusable diagram behavior, not application document storage, project ownership,
19
+ authentication, navigation, or backend transport. Consumers retain changed
20
+ documents and application state. See the
21
+ [app pattern](../squeed/README.md#ownership-and-code-patterns) and
22
+ [contribution rules](CONTRIBUTING.md).
23
+
24
+ | Location | Responsibility |
25
+ | -------------------------------------------------- | ----------------------------------------------------------- |
26
+ | `src/core` | Compilation, immutable document edits, and callback binding |
27
+ | `src/engine` | Geometry, layout, viewport, gestures, and canvas rendering |
28
+ | `src/components`, `src/nodes` | Public composition, shared controls, and node views |
29
+ | `src/types`, `src/hooks`, `src/theme`, `src/utils` | Contracts and existing shared support |
30
+ | `src/index.ts` | Consumer-facing exports; internal modules use local imports |
31
+ | `examples`, `tests` | Consumer demonstrations, fixtures, and verification |
32
+
33
+ Reuse the existing owner of a behavior instead of adding a parallel helper or
34
+ host-specific branch. Keep pure document operations independent of UI and
35
+ storage. Prefer design/configuration defaults over imperative presentation fixes.
36
+ JSON edits use the shared callback binding and emit one immutable document;
37
+ raw graph consumers own their mutations. Preserve read-only restrictions.
38
+
39
+ Use PascalCase for components/types, `use...` for hooks, and lower-camel-case
40
+ module names for non-component operations. Use exported types at public
41
+ boundaries, distinguish type-only dependencies from runtime dependencies, and
42
+ avoid runtime import cycles. Document public contract changes and test the
43
+ owning module plus affected consumer behavior.
44
+
45
+ The current tree still has runtime cycles between `squeedEdits`/`parentGroups`
46
+ and `NodeForm`/`StructuredFieldControls`. SDK examples and the app's local
47
+ examples are not automatically synchronized or interchangeable contracts.
48
+ These remain structural review items; passing behavior or release tests alone
49
+ does not establish that the code follows this pattern.
50
+
15
51
  ## Quick Start
16
52
 
17
53
  ```tsx
@@ -208,7 +244,16 @@ Mark the visible shape with `data-flow-node-surface`, excluding captions and
208
244
  form summaries. For SVG views, put it on the closed geometry element (such as
209
245
  `circle`, `polygon`, or `path`), not the surrounding `svg`. Connectors, draw
210
246
  handles, and animated borders use that surface; layout still reserves the full
211
- node bounds. Unmarked custom views retain rectangular host bounds.
247
+ node bounds. In `TB` and `BT`, ordinary icon-label connectors also reserve the
248
+ caption below the icon, so paths and arrowheads do not cross wrapped labels or
249
+ subtitles. Horizontal connectors still attach to the icon surface. Unmarked
250
+ custom views retain rectangular host bounds.
251
+
252
+ Edge-label placement is scoped to each canvas and skips empty label layers.
253
+ The existing placement is reused while node bounds, edge paths, and label
254
+ dimensions are unchanged. Geometry changes and font loading recheck placement;
255
+ unrelated updates do not resample SVG paths. This does not change JSON loading,
256
+ repair streaming, or playback.
212
257
 
213
258
  For content and custom-shape views, use `<FlowPort id="tools" role="source"
214
259
  side="bottom" position={0.5} />` inside the node. `side` accepts `top`, `right`,
@@ -592,6 +637,10 @@ engine.isolateBranch(nodeId, 60, true);
592
637
  engine.restoreView(true);
593
638
  ```
594
639
 
640
+ Pass `true` as the fourth argument to `focusBranch`, `focusNode`, or
641
+ `focusConnections` after a view toggle to fit the new geometry together with
642
+ the layout animation. Existing three-argument calls keep their behavior.
643
+
595
644
  Animation defaults to false. Explicit false overrides the config default.
596
645
  Transitions interpolate pan and zoom over 300ms; center preserves zoom.
597
646
  Reduced-motion preferences disable animation. New viewport commands cancel
@@ -1196,6 +1245,11 @@ Helpers reuse untouched branches and do not fire callbacks themselves. The `upda
1196
1245
 
1197
1246
  ### Node Hover Overlay
1198
1247
 
1248
+ Reuse `config.nodeOverlayActions` for standard hover buttons. An action's optional
1249
+ `nodeTypes` array limits it to matching node types (for example, `["grid"]`).
1250
+ Omitting `nodeTypes` preserves the existing all-node behavior; actions continue
1251
+ to dispatch through `callbacks.onNodeHoverAction`.
1252
+
1199
1253
  ```tsx
1200
1254
  import { HStack, IconButton } from "@chakra-ui/react";
1201
1255
  import { PiPencilSimple, PiTrash } from "react-icons/pi";