@tangle-network/sandbox-ui 0.110.0 → 0.111.1

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
@@ -16,7 +16,7 @@ React component library for [Tangle Sandbox](https://sandbox.tangle.tools) — a
16
16
  npm install @tangle-network/sandbox-ui
17
17
  ```
18
18
 
19
- **Required peers:** `react` and `react-dom` 18 or 19, `@tangle-network/agent-interface ^1.0.0`, `@tangle-network/brand ^1.5.0`, and `@tangle-network/ui ^11.6.0`.
19
+ **Required peers:** `react` and `react-dom` 18 or 19, `@tangle-network/agent-interface ^1.0.0 || ^2.0.0`, `@tangle-network/brand ^1.5.0`, and `@tangle-network/ui ^11.6.0`.
20
20
  Optional peers are required only by the subpaths that use them; see [package.json](./package.json). `/editor` needs its tiptap, `yjs` and `@hocuspocus/provider` peers only when it renders an editor, and the `@tangle-network/ui` README holds the table of which surface needs which.
21
21
 
22
22
  ## Usage
@@ -642,7 +642,7 @@ function NodeMark({
642
642
 
643
643
  // src/workflows/WorkflowGraph.tsx
644
644
  import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
645
- var FIT_VIEW = { padding: 0.16 };
645
+ var FIT_VIEW = { padding: "12px" };
646
646
  function fitZoomCeiling(compact) {
647
647
  return compact ? 1.5 : 1;
648
648
  }
@@ -1335,6 +1335,7 @@ function WorkflowGraph({
1335
1335
  variant = "full",
1336
1336
  direction = "LR",
1337
1337
  defaultCompact,
1338
+ onCompactChange,
1338
1339
  className,
1339
1340
  wrap = false,
1340
1341
  nodeState,
@@ -1362,6 +1363,7 @@ function WorkflowGraph({
1362
1363
  const [userCompact, setUserCompact] = useState(
1363
1364
  defaultCompact ?? nodeState === void 0
1364
1365
  );
1366
+ const nextDensityFrom = useRef(userCompact);
1365
1367
  const compact = isPreview || userCompact;
1366
1368
  const [displayCompact, setDisplayCompact] = useState(compact);
1367
1369
  const rfRef = useRef(
@@ -1646,7 +1648,14 @@ function WorkflowGraph({
1646
1648
  children: [
1647
1649
  /* @__PURE__ */ jsx3(Background, { gap: 18 }),
1648
1650
  !isPreview && /* @__PURE__ */ jsxs3(Fragment, { children: [
1649
- /* @__PURE__ */ jsx3(Controls, { showInteractive: false, position: "bottom-right" }),
1651
+ /* @__PURE__ */ jsx3(
1652
+ Controls,
1653
+ {
1654
+ showInteractive: false,
1655
+ position: "bottom-right",
1656
+ fitViewOptions: { padding: FIT_VIEW.padding }
1657
+ }
1658
+ ),
1650
1659
  /* @__PURE__ */ jsxs3(Panel, { position: "top-left", className: "flex items-center gap-1", children: [
1651
1660
  addTrigger && /* @__PURE__ */ jsxs3(
1652
1661
  "button",
@@ -1667,7 +1676,12 @@ function WorkflowGraph({
1667
1676
  "button",
1668
1677
  {
1669
1678
  type: "button",
1670
- onClick: () => setUserCompact((c) => !c),
1679
+ onClick: () => {
1680
+ const next = !nextDensityFrom.current;
1681
+ nextDensityFrom.current = next;
1682
+ setUserCompact(next);
1683
+ onCompactChange?.(next);
1684
+ },
1671
1685
  "aria-pressed": userCompact,
1672
1686
  title: userCompact ? "Expand nodes" : "Collapse nodes",
1673
1687
  className: "flex items-center gap-1 rounded-md border border-border bg-card/80 px-2 py-1 text-[11px] text-muted-foreground shadow-sm backdrop-blur transition hover:text-foreground",
@@ -331,6 +331,17 @@ interface WorkflowGraphProps {
331
331
  * toggle, and the preview variant is always compact.
332
332
  */
333
333
  defaultCompact?: boolean;
334
+ /**
335
+ * Called when the reader moves the density toggle, with the density they
336
+ * chose.
337
+ *
338
+ * `defaultCompact` seeds the graph; this reports back out of it, which is
339
+ * what a host needs to REMEMBER the choice. Without it a host can set an
340
+ * opening density but never learn that the reader wanted the other one, so
341
+ * every navigation puts them back where they started and the toggle has to
342
+ * be found again.
343
+ */
344
+ onCompactChange?: (compact: boolean) => void;
334
345
  /** Sizing for the wrapper; the caller controls height. */
335
346
  className?: string;
336
347
  /**
package/dist/workflows.js CHANGED
@@ -36,7 +36,7 @@ function retryImport(factory, retries = 2, delayMs = 350) {
36
36
  function lazyWorkflowGraph() {
37
37
  return lazy(
38
38
  () => retryImport(
39
- () => import("./WorkflowGraph-7AFEKG7E.js").then((m) => ({ default: m.WorkflowGraph }))
39
+ () => import("./WorkflowGraph-2QOORYIR.js").then((m) => ({ default: m.WorkflowGraph }))
40
40
  )
41
41
  );
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-ui",
3
- "version": "0.110.0",
3
+ "version": "0.111.1",
4
4
  "description": "Unified UI component library for Tangle Sandbox — primitives, chat, dashboard, terminal, editor, and workspace components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -118,7 +118,7 @@
118
118
  "peerDependencies": {
119
119
  "@hocuspocus/provider": ">=2.15.0 <5.0.0",
120
120
  "@nanostores/react": ">=0.8.4 <2.0.0",
121
- "@tangle-network/agent-interface": "^1.0.0",
121
+ "@tangle-network/agent-interface": "^1.0.0 || ^2.0.0",
122
122
  "@tangle-network/brand": "^1.5.0",
123
123
  "@tangle-network/ui": "^11.6.0",
124
124
  "@tanstack/react-query": "^5.0.0",
@@ -197,7 +197,7 @@
197
197
  "@storybook/react": "^10.5.4",
198
198
  "@storybook/react-vite": "^10.5.4",
199
199
  "@tailwindcss/postcss": "^4.3.3",
200
- "@tangle-network/agent-interface": "1.0.0",
200
+ "@tangle-network/agent-interface": "2.1.1",
201
201
  "@tangle-network/brand": "^1.5.0",
202
202
  "@tangle-network/ui": "^11.6.0",
203
203
  "@tanstack/react-query": "^5.101.4",