@nexub/diagram 11.6.0 → 11.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.
Files changed (2) hide show
  1. package/dist/index.js +12 -1
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -131,6 +131,13 @@ var defaultDiagramLabels = {
131
131
  fitView: "Fit view",
132
132
  minimap: "Minimap"
133
133
  };
134
+ function diagramLabelsFrom(m) {
135
+ const from = (key) => m[`diagram${key[0].toUpperCase()}${key.slice(1)}`];
136
+ const out = { ...defaultDiagramLabels, tones: { ...defaultDiagramLabels.tones } };
137
+ for (const key of Object.keys(out)) if (key !== "tones") out[key] = from(key) ?? out[key];
138
+ for (const tone of ["good", "warning", "danger"]) out.tones[tone] = from(`tone${tone[0].toUpperCase()}${tone.slice(1)}`) ?? out.tones[tone];
139
+ return out;
140
+ }
134
141
 
135
142
  // src/context.ts
136
143
  var DiagramContext = React2.createContext({
@@ -290,6 +297,9 @@ var DiagramNode = React4.memo(function DiagramNode2({ id, data, sourcePosition,
290
297
  );
291
298
  });
292
299
 
300
+ // src/DiagramCanvas.tsx
301
+ import { useNexubMessages } from "@nexub/react/NexubProvider";
302
+
293
303
  // src/layout.ts
294
304
  import { Position as Position2 } from "@xyflow/react";
295
305
  var DEFAULT_NODE_WIDTH = 240;
@@ -720,7 +730,8 @@ function DiagramCanvasInner(props) {
720
730
  nodesDraggable,
721
731
  ...flowProps
722
732
  } = props;
723
- const labels = React5.useMemo(() => ({ ...defaultDiagramLabels, ...labelOverrides }), [labelOverrides]);
733
+ const messages = useNexubMessages();
734
+ const labels = React5.useMemo(() => ({ ...diagramLabelsFrom(messages), ...labelOverrides }), [messages, labelOverrides]);
724
735
  const store = useStoreApi();
725
736
  const { deleteElements } = useReactFlow();
726
737
  const storeNodes = useStore((s) => s.nodes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexub/diagram",
3
- "version": "11.6.0",
3
+ "version": "11.7.0",
4
4
  "description": "Themed, keyboard-accessible diagram canvas for Nexub Design System, on React Flow (@xyflow/react, a peer dependency).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,14 +38,14 @@
38
38
  "main": "./dist/index.js",
39
39
  "types": "./dist/index.d.ts",
40
40
  "peerDependencies": {
41
- "@nexub/react": "^11.6.0",
41
+ "@nexub/react": "^11.7.0",
42
42
  "@xyflow/react": "^12.10.0",
43
43
  "react": ">=19 <20",
44
44
  "react-dom": ">=19 <20"
45
45
  },
46
46
  "devDependencies": {
47
- "@nexub/react": "11.6.0",
48
- "@nexub/tokens": "11.6.0",
47
+ "@nexub/react": "11.7.0",
48
+ "@nexub/tokens": "11.7.0",
49
49
  "@tailwindcss/cli": "^4.3.5",
50
50
  "@testing-library/jest-dom": "^7.0.1",
51
51
  "@testing-library/react": "^16.3.3",