@squeed/flow-sdk 2.0.28 → 2.0.30
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 +49 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +4514 -4452
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,10 @@ 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.
|
|
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.
|
|
212
251
|
|
|
213
252
|
For content and custom-shape views, use `<FlowPort id="tools" role="source"
|
|
214
253
|
side="bottom" position={0.5} />` inside the node. `side` accepts `top`, `right`,
|
|
@@ -592,6 +631,10 @@ engine.isolateBranch(nodeId, 60, true);
|
|
|
592
631
|
engine.restoreView(true);
|
|
593
632
|
```
|
|
594
633
|
|
|
634
|
+
Pass `true` as the fourth argument to `focusBranch`, `focusNode`, or
|
|
635
|
+
`focusConnections` after a view toggle to fit the new geometry together with
|
|
636
|
+
the layout animation. Existing three-argument calls keep their behavior.
|
|
637
|
+
|
|
595
638
|
Animation defaults to false. Explicit false overrides the config default.
|
|
596
639
|
Transitions interpolate pan and zoom over 300ms; center preserves zoom.
|
|
597
640
|
Reduced-motion preferences disable animation. New viewport commands cancel
|
|
@@ -1196,6 +1239,11 @@ Helpers reuse untouched branches and do not fire callbacks themselves. The `upda
|
|
|
1196
1239
|
|
|
1197
1240
|
### Node Hover Overlay
|
|
1198
1241
|
|
|
1242
|
+
Reuse `config.nodeOverlayActions` for standard hover buttons. An action's optional
|
|
1243
|
+
`nodeTypes` array limits it to matching node types (for example, `["grid"]`).
|
|
1244
|
+
Omitting `nodeTypes` preserves the existing all-node behavior; actions continue
|
|
1245
|
+
to dispatch through `callbacks.onNodeHoverAction`.
|
|
1246
|
+
|
|
1199
1247
|
```tsx
|
|
1200
1248
|
import { HStack, IconButton } from "@chakra-ui/react";
|
|
1201
1249
|
import { PiPencilSimple, PiTrash } from "react-icons/pi";
|