@industry-theme/principal-view-panels 0.1.17 → 0.1.18

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.
@@ -47074,7 +47074,7 @@ function requireCustomNode() {
47074
47074
  const react_1 = /* @__PURE__ */ requireUmd();
47075
47075
  const iconResolver_1 = requireIconResolver();
47076
47076
  const CustomNode$1 = ({ data, selected }) => {
47077
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
47077
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o2, _p;
47078
47078
  const nodeProps = data;
47079
47079
  const { typeDefinition, state, hasViolations, data: nodeData, animationType, animationDuration = 1e3, editable = false } = nodeProps;
47080
47080
  if (!typeDefinition) {
@@ -47107,7 +47107,7 @@ function requireCustomNode() {
47107
47107
  const animationClass = getAnimationClass();
47108
47108
  const isGroup = nodeData.canvasType === "group";
47109
47109
  const getShapeStyles = () => {
47110
- var _a2, _b2, _c2, _d2, _e3;
47110
+ var _a2, _b2;
47111
47111
  const baseStyles = {
47112
47112
  padding: "12px 16px",
47113
47113
  backgroundColor: isGroup ? "rgba(255, 255, 255, 0.7)" : "white",
@@ -47115,6 +47115,9 @@ function requireCustomNode() {
47115
47115
  border: `2px solid ${hasViolations ? "#D0021B" : strokeColor}`,
47116
47116
  fontSize: "12px",
47117
47117
  fontWeight: 500,
47118
+ // Use 100% width/height to fill the node container (for resizing support)
47119
+ width: "100%",
47120
+ height: "100%",
47118
47121
  minWidth: ((_a2 = typeDefinition.size) == null ? void 0 : _a2.width) || 80,
47119
47122
  minHeight: ((_b2 = typeDefinition.size) == null ? void 0 : _b2.height) || 40,
47120
47123
  display: "flex",
@@ -47123,16 +47126,15 @@ function requireCustomNode() {
47123
47126
  justifyContent: isGroup ? "flex-start" : "center",
47124
47127
  gap: "4px",
47125
47128
  boxShadow: selected ? `0 0 0 2px ${strokeColor}` : "0 2px 4px rgba(0,0,0,0.1)",
47126
- transition: "all 0.2s ease",
47127
- animationDuration: animationType ? `${animationDuration}ms` : void 0
47129
+ transition: "box-shadow 0.2s ease",
47130
+ animationDuration: animationType ? `${animationDuration}ms` : void 0,
47131
+ boxSizing: "border-box"
47128
47132
  };
47129
47133
  switch (typeDefinition.shape) {
47130
47134
  case "circle":
47131
47135
  return {
47132
47136
  ...baseStyles,
47133
47137
  borderRadius: "50%",
47134
- width: ((_c2 = typeDefinition.size) == null ? void 0 : _c2.width) || 80,
47135
- height: ((_d2 = typeDefinition.size) == null ? void 0 : _d2.height) || 80,
47136
47138
  padding: "8px"
47137
47139
  };
47138
47140
  case "hexagon":
@@ -47150,12 +47152,11 @@ function requireCustomNode() {
47150
47152
  // Shadow handled by wrapper
47151
47153
  };
47152
47154
  case "diamond":
47153
- const diamondSize = ((_e3 = typeDefinition.size) == null ? void 0 : _e3.width) || 70;
47154
47155
  return {
47155
47156
  ...baseStyles,
47156
47157
  transform: "rotate(45deg)",
47157
- width: diamondSize,
47158
- height: diamondSize,
47158
+ width: "100%",
47159
+ height: "100%",
47159
47160
  padding: "8px"
47160
47161
  };
47161
47162
  case "rectangle":
@@ -47168,16 +47169,24 @@ function requireCustomNode() {
47168
47169
  };
47169
47170
  const isDiamond = typeDefinition.shape === "diamond";
47170
47171
  const isHexagon = typeDefinition.shape === "hexagon";
47172
+ const isCircle = typeDefinition.shape === "circle";
47173
+ const keepAspectRatio = isCircle || isDiamond;
47174
+ const minWidth = ((_g = typeDefinition.size) == null ? void 0 : _g.width) || 80;
47175
+ const minHeight = ((_h = typeDefinition.size) == null ? void 0 : _h.height) || (isCircle ? minWidth : 40);
47171
47176
  const hexagonClipPath = "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)";
47172
47177
  const hexagonBorderWidth = 2;
47173
47178
  const hexagonBorderStyle = isHexagon ? {
47174
47179
  position: "relative",
47175
47180
  clipPath: hexagonClipPath,
47176
47181
  backgroundColor: hasViolations ? "#D0021B" : strokeColor,
47177
- width: ((_g = typeDefinition.size) == null ? void 0 : _g.width) || 120,
47178
- height: ((_h = typeDefinition.size) == null ? void 0 : _h.height) || 120,
47182
+ // Use 100% to fill container for resizing support
47183
+ width: "100%",
47184
+ height: "100%",
47185
+ minWidth: ((_i = typeDefinition.size) == null ? void 0 : _i.width) || 120,
47186
+ minHeight: ((_j = typeDefinition.size) == null ? void 0 : _j.height) || 120,
47179
47187
  boxShadow: selected ? `0 0 0 2px ${strokeColor}` : "0 2px 4px rgba(0,0,0,0.1)",
47180
- transition: "all 0.2s ease"
47188
+ transition: "box-shadow 0.2s ease",
47189
+ boxSizing: "border-box"
47181
47190
  } : {};
47182
47191
  const hexagonInnerStyle = isHexagon ? {
47183
47192
  position: "absolute",
@@ -47233,14 +47242,20 @@ function requireCustomNode() {
47233
47242
  }
47234
47243
  return offsetStyle;
47235
47244
  };
47236
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Top, id: "top", style: getHandleStyle("top") }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Bottom, id: "bottom", style: getHandleStyle("bottom") }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Left, id: "left", style: getHandleStyle("left") }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Right, id: "right", style: getHandleStyle("right") }), isHexagon ? (0, jsx_runtime_1.jsx)("div", { style: hexagonBorderStyle, className: animationClass, children: (0, jsx_runtime_1.jsxs)("div", { style: hexagonInnerStyle, children: [icon && (0, jsx_runtime_1.jsx)("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: (0, iconResolver_1.resolveIcon)(icon, 20) }), (0, jsx_runtime_1.jsx)("div", { style: { textAlign: "center", wordBreak: "break-word" }, children: displayName }), state && (0, jsx_runtime_1.jsx)("div", { style: {
47245
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [editable && (0, jsx_runtime_1.jsx)(react_1.NodeResizer, { color: strokeColor, isVisible: selected, minWidth, minHeight, keepAspectRatio, handleStyle: {
47246
+ width: 8,
47247
+ height: 8,
47248
+ borderRadius: 2
47249
+ }, lineStyle: {
47250
+ borderWidth: 1
47251
+ } }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Top, id: "top", style: getHandleStyle("top") }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Bottom, id: "bottom", style: getHandleStyle("bottom") }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Left, id: "left", style: getHandleStyle("left") }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Right, id: "right", style: getHandleStyle("right") }), isHexagon ? (0, jsx_runtime_1.jsx)("div", { style: hexagonBorderStyle, className: animationClass, children: (0, jsx_runtime_1.jsxs)("div", { style: hexagonInnerStyle, children: [icon && (0, jsx_runtime_1.jsx)("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: (0, iconResolver_1.resolveIcon)(icon, 20) }), (0, jsx_runtime_1.jsx)("div", { style: { textAlign: "center", wordBreak: "break-word" }, children: displayName }), state && (0, jsx_runtime_1.jsx)("div", { style: {
47237
47252
  fontSize: "10px",
47238
47253
  backgroundColor: color,
47239
47254
  color: "white",
47240
47255
  padding: "2px 6px",
47241
47256
  borderRadius: "4px",
47242
47257
  textAlign: "center"
47243
- }, children: ((_i = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _i.label) || ((_k = (_j = typeDefinition.states) == null ? void 0 : _j[state]) == null ? void 0 : _k.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
47258
+ }, children: ((_k = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _k.label) || ((_m = (_l = typeDefinition.states) == null ? void 0 : _l[state]) == null ? void 0 : _m.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
47244
47259
  fontSize: "10px",
47245
47260
  color: "#D0021B",
47246
47261
  fontWeight: "bold"
@@ -47260,7 +47275,7 @@ function requireCustomNode() {
47260
47275
  padding: "2px 6px",
47261
47276
  borderRadius: "4px",
47262
47277
  textAlign: "center"
47263
- }, children: ((_l = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _l.label) || ((_n2 = (_m = typeDefinition.states) == null ? void 0 : _m[state]) == null ? void 0 : _n2.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
47278
+ }, children: ((_n2 = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _n2.label) || ((_p = (_o2 = typeDefinition.states) == null ? void 0 : _o2[state]) == null ? void 0 : _p.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
47264
47279
  fontSize: "10px",
47265
47280
  color: "#D0021B",
47266
47281
  fontWeight: "bold"
@@ -48170,6 +48185,182 @@ function requireNodeInfoPanel() {
48170
48185
  NodeInfoPanel.NodeInfoPanel = NodeInfoPanel$1;
48171
48186
  return NodeInfoPanel;
48172
48187
  }
48188
+ var SelectionSidebar = {};
48189
+ var hasRequiredSelectionSidebar;
48190
+ function requireSelectionSidebar() {
48191
+ if (hasRequiredSelectionSidebar) return SelectionSidebar;
48192
+ hasRequiredSelectionSidebar = 1;
48193
+ Object.defineProperty(SelectionSidebar, "__esModule", { value: true });
48194
+ SelectionSidebar.SelectionSidebar = void 0;
48195
+ const jsx_runtime_1 = require$$0;
48196
+ const react_1 = React2;
48197
+ const industry_theme_1 = requireCjs();
48198
+ const iconResolver_1 = requireIconResolver();
48199
+ const SelectionSidebar$1 = ({ selectedNodeIds, nodes, nodeTypeDefinitions, onClose }) => {
48200
+ const { theme } = (0, industry_theme_1.useTheme)();
48201
+ const [expandedNodes, setExpandedNodes] = (0, react_1.useState)({});
48202
+ const selectedNodes = nodes.filter((n) => selectedNodeIds.has(n.id));
48203
+ const toggleExpanded = (nodeId) => {
48204
+ setExpandedNodes((prev) => ({
48205
+ ...prev,
48206
+ [nodeId]: !prev[nodeId]
48207
+ }));
48208
+ };
48209
+ const internalFields = [
48210
+ "icon",
48211
+ "name",
48212
+ "description",
48213
+ "sources",
48214
+ "color",
48215
+ "stroke",
48216
+ "width",
48217
+ "height",
48218
+ "canvasType",
48219
+ "text",
48220
+ "file",
48221
+ "url",
48222
+ "shape",
48223
+ "states",
48224
+ "actions",
48225
+ "nodeType"
48226
+ ];
48227
+ return (0, jsx_runtime_1.jsxs)("div", { style: {
48228
+ position: "absolute",
48229
+ top: "60px",
48230
+ right: "20px",
48231
+ backgroundColor: theme.colors.background,
48232
+ color: theme.colors.text,
48233
+ borderRadius: "8px",
48234
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
48235
+ padding: "16px",
48236
+ minWidth: "280px",
48237
+ maxWidth: "350px",
48238
+ maxHeight: "calc(100vh - 120px)",
48239
+ overflowY: "auto",
48240
+ zIndex: 1e3,
48241
+ border: `1px solid ${theme.colors.border}`
48242
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
48243
+ display: "flex",
48244
+ justifyContent: "space-between",
48245
+ alignItems: "center",
48246
+ marginBottom: "12px",
48247
+ paddingBottom: "8px",
48248
+ borderBottom: `2px solid ${theme.colors.primary}`
48249
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { fontWeight: "bold", fontSize: "14px", color: theme.colors.primary }, children: [selectedNodes.length, " nodes selected"] }), (0, jsx_runtime_1.jsx)("button", { onClick: onClose, style: {
48250
+ border: "none",
48251
+ background: "none",
48252
+ cursor: "pointer",
48253
+ fontSize: "18px",
48254
+ color: theme.colors.textSecondary,
48255
+ padding: "0",
48256
+ width: "24px",
48257
+ height: "24px",
48258
+ display: "flex",
48259
+ alignItems: "center",
48260
+ justifyContent: "center"
48261
+ }, children: "x" })] }), (0, jsx_runtime_1.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: selectedNodes.map((node) => {
48262
+ var _a, _b, _c, _d, _e2, _f, _g;
48263
+ const typeDefinition = nodeTypeDefinitions[node.type];
48264
+ const nodeColor = ((_a = node.data) == null ? void 0 : _a.color) || (typeDefinition == null ? void 0 : typeDefinition.color) || theme.colors.secondary;
48265
+ const icon = ((_b = node.data) == null ? void 0 : _b.icon) || (typeDefinition == null ? void 0 : typeDefinition.icon);
48266
+ const isExpanded = expandedNodes[node.id] || false;
48267
+ const description = (_c = node.data) == null ? void 0 : _c.description;
48268
+ const dataEntries = node.data ? Object.entries(node.data).filter(([key]) => !internalFields.includes(key)) : [];
48269
+ return (0, jsx_runtime_1.jsxs)("div", { style: {
48270
+ backgroundColor: theme.colors.surface,
48271
+ borderRadius: "6px",
48272
+ border: `1px solid ${theme.colors.border}`,
48273
+ overflow: "hidden"
48274
+ }, children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => toggleExpanded(node.id), style: {
48275
+ width: "100%",
48276
+ padding: "10px 12px",
48277
+ backgroundColor: "transparent",
48278
+ border: "none",
48279
+ cursor: "pointer",
48280
+ display: "flex",
48281
+ alignItems: "flex-start",
48282
+ gap: "10px",
48283
+ textAlign: "left"
48284
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
48285
+ width: "28px",
48286
+ height: "28px",
48287
+ borderRadius: "6px",
48288
+ backgroundColor: nodeColor,
48289
+ display: "flex",
48290
+ alignItems: "center",
48291
+ justifyContent: "center",
48292
+ flexShrink: 0,
48293
+ color: "white"
48294
+ }, children: icon ? (0, iconResolver_1.resolveIcon)(icon, 16) : null }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
48295
+ fontWeight: 600,
48296
+ fontSize: "13px",
48297
+ color: theme.colors.text,
48298
+ marginBottom: description ? "2px" : 0
48299
+ }, children: node.name || node.id }), description && (0, jsx_runtime_1.jsx)("div", { style: {
48300
+ fontSize: "11px",
48301
+ color: theme.colors.textSecondary,
48302
+ overflow: "hidden",
48303
+ textOverflow: "ellipsis",
48304
+ display: "-webkit-box",
48305
+ WebkitLineClamp: isExpanded ? "unset" : 2,
48306
+ WebkitBoxOrient: "vertical"
48307
+ }, children: description })] }), (0, jsx_runtime_1.jsx)("div", { style: {
48308
+ color: theme.colors.textSecondary,
48309
+ fontSize: "10px",
48310
+ transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)",
48311
+ transition: "transform 0.2s",
48312
+ flexShrink: 0
48313
+ }, children: "▼" })] }), isExpanded && (0, jsx_runtime_1.jsxs)("div", { style: {
48314
+ padding: "0 12px 10px 12px",
48315
+ borderTop: `1px solid ${theme.colors.border}`,
48316
+ marginTop: "0"
48317
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "10px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
48318
+ fontSize: "10px",
48319
+ color: theme.colors.textSecondary,
48320
+ marginBottom: "4px"
48321
+ }, children: "Type" }), (0, jsx_runtime_1.jsx)("div", { style: {
48322
+ fontSize: "11px",
48323
+ padding: "3px 8px",
48324
+ backgroundColor: nodeColor,
48325
+ color: "white",
48326
+ borderRadius: "4px",
48327
+ display: "inline-block"
48328
+ }, children: node.type })] }), node.state && (0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "8px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
48329
+ fontSize: "10px",
48330
+ color: theme.colors.textSecondary,
48331
+ marginBottom: "4px"
48332
+ }, children: "State" }), (0, jsx_runtime_1.jsx)("div", { style: {
48333
+ fontSize: "11px",
48334
+ padding: "3px 8px",
48335
+ backgroundColor: ((_e2 = (_d = typeDefinition == null ? void 0 : typeDefinition.states) == null ? void 0 : _d[node.state]) == null ? void 0 : _e2.color) || theme.colors.secondary,
48336
+ color: "white",
48337
+ borderRadius: "4px",
48338
+ display: "inline-block"
48339
+ }, children: ((_g = (_f = typeDefinition == null ? void 0 : typeDefinition.states) == null ? void 0 : _f[node.state]) == null ? void 0 : _g.label) || node.state })] }), dataEntries.length > 0 && (0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "8px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
48340
+ fontSize: "10px",
48341
+ color: theme.colors.textSecondary,
48342
+ marginBottom: "6px",
48343
+ fontWeight: "bold"
48344
+ }, children: "Properties" }), dataEntries.map(([key, value]) => (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "6px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
48345
+ fontSize: "10px",
48346
+ color: theme.colors.textSecondary,
48347
+ marginBottom: "2px"
48348
+ }, children: key }), (0, jsx_runtime_1.jsx)("div", { style: {
48349
+ fontSize: "11px",
48350
+ color: theme.colors.text,
48351
+ wordBreak: "break-word"
48352
+ }, children: value !== void 0 && value !== null ? typeof value === "object" ? JSON.stringify(value, null, 2) : String(value) : "-" })] }, key))] }), (0, jsx_runtime_1.jsxs)("div", { style: {
48353
+ fontSize: "10px",
48354
+ color: theme.colors.textMuted,
48355
+ marginTop: "8px",
48356
+ paddingTop: "6px",
48357
+ borderTop: `1px solid ${theme.colors.border}`
48358
+ }, children: ["ID: ", node.id] })] })] }, node.id);
48359
+ }) })] });
48360
+ };
48361
+ SelectionSidebar.SelectionSidebar = SelectionSidebar$1;
48362
+ return SelectionSidebar;
48363
+ }
48173
48364
  var hasRequiredGraphRenderer;
48174
48365
  function requireGraphRenderer() {
48175
48366
  if (hasRequiredGraphRenderer) return GraphRenderer;
@@ -48187,6 +48378,7 @@ function requireGraphRenderer() {
48187
48378
  const graphConverter_1 = requireGraphConverter();
48188
48379
  const EdgeInfoPanel_1 = requireEdgeInfoPanel();
48189
48380
  const NodeInfoPanel_1 = requireNodeInfoPanel();
48381
+ const SelectionSidebar_1 = requireSelectionSidebar();
48190
48382
  const nodeTypes = {
48191
48383
  custom: CustomNode_1.CustomNode
48192
48384
  };
@@ -48195,6 +48387,7 @@ function requireGraphRenderer() {
48195
48387
  };
48196
48388
  const createEmptyEditState = () => ({
48197
48389
  positionChanges: /* @__PURE__ */ new Map(),
48390
+ dimensionChanges: /* @__PURE__ */ new Map(),
48198
48391
  nodeUpdates: /* @__PURE__ */ new Map(),
48199
48392
  deletedNodeIds: /* @__PURE__ */ new Set(),
48200
48393
  createdEdges: [],
@@ -48207,8 +48400,8 @@ function requireGraphRenderer() {
48207
48400
  nodeAnimations: {},
48208
48401
  edgeAnimations: {}
48209
48402
  });
48210
- const [selectedEdgeId, setSelectedEdgeId] = (0, react_1.useState)(null);
48211
- const [selectedNodeId, setSelectedNodeId] = (0, react_1.useState)(null);
48403
+ const [selectedEdgeIds, setSelectedEdgeIds] = (0, react_1.useState)(/* @__PURE__ */ new Set());
48404
+ const [selectedNodeIds, setSelectedNodeIds] = (0, react_1.useState)(/* @__PURE__ */ new Set());
48212
48405
  const [pendingConnection, setPendingConnection] = (0, react_1.useState)(null);
48213
48406
  const [localNodes, setLocalNodes] = (0, react_1.useState)(propNodes);
48214
48407
  const [localEdges, setLocalEdges] = (0, react_1.useState)(propEdges);
@@ -48230,7 +48423,7 @@ function requireGraphRenderer() {
48230
48423
  const nodes = localNodes;
48231
48424
  const edges = editable ? localEdges : propEdges;
48232
48425
  const checkHasChanges = (0, react_1.useCallback)((state) => {
48233
- return state.positionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0;
48426
+ return state.positionChanges.size > 0 || state.dimensionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0;
48234
48427
  }, []);
48235
48428
  const updateEditState = (0, react_1.useCallback)((updater) => {
48236
48429
  const newState = updater(editStateRef.current);
@@ -48238,16 +48431,50 @@ function requireGraphRenderer() {
48238
48431
  onEditStateChange == null ? void 0 : onEditStateChange(newState);
48239
48432
  onPendingChangesChange == null ? void 0 : onPendingChangesChange(checkHasChanges(newState));
48240
48433
  }, [editStateRef, onEditStateChange, onPendingChangesChange, checkHasChanges]);
48241
- const onEdgeClick = (0, react_1.useCallback)((_event, edge) => {
48242
- setSelectedEdgeId((prev) => prev === edge.id ? null : edge.id);
48243
- setSelectedNodeId(null);
48244
- }, []);
48245
- const onNodeClick = (0, react_1.useCallback)((_event, node) => {
48246
- setSelectedNodeId((prev) => prev === node.id ? null : node.id);
48247
- setSelectedEdgeId(null);
48248
- }, []);
48434
+ const onEdgeClick = (0, react_1.useCallback)((event, edge) => {
48435
+ if (event.shiftKey && editable) {
48436
+ setSelectedEdgeIds((prev) => {
48437
+ const next = new Set(prev);
48438
+ if (next.has(edge.id)) {
48439
+ next.delete(edge.id);
48440
+ } else {
48441
+ next.add(edge.id);
48442
+ }
48443
+ return next;
48444
+ });
48445
+ } else {
48446
+ setSelectedEdgeIds((prev) => {
48447
+ if (prev.size === 1 && prev.has(edge.id)) {
48448
+ return /* @__PURE__ */ new Set();
48449
+ }
48450
+ return /* @__PURE__ */ new Set([edge.id]);
48451
+ });
48452
+ setSelectedNodeIds(/* @__PURE__ */ new Set());
48453
+ }
48454
+ }, [editable]);
48455
+ const onNodeClick = (0, react_1.useCallback)((event, node) => {
48456
+ if (event.shiftKey && editable) {
48457
+ setSelectedNodeIds((prev) => {
48458
+ const next = new Set(prev);
48459
+ if (next.has(node.id)) {
48460
+ next.delete(node.id);
48461
+ } else {
48462
+ next.add(node.id);
48463
+ }
48464
+ return next;
48465
+ });
48466
+ } else {
48467
+ setSelectedNodeIds((prev) => {
48468
+ if (prev.size === 1 && prev.has(node.id)) {
48469
+ return /* @__PURE__ */ new Set();
48470
+ }
48471
+ return /* @__PURE__ */ new Set([node.id]);
48472
+ });
48473
+ setSelectedEdgeIds(/* @__PURE__ */ new Set());
48474
+ }
48475
+ }, [editable]);
48249
48476
  const onCloseEdgeInfoPanel = (0, react_1.useCallback)(() => {
48250
- setSelectedEdgeId(null);
48477
+ setSelectedEdgeIds(/* @__PURE__ */ new Set());
48251
48478
  }, []);
48252
48479
  const handleUpdateEdgeSides = (0, react_1.useCallback)((edgeId, fromSide, toSide) => {
48253
48480
  setLocalEdges((currentEdges) => currentEdges.map((edge) => edge.id === edgeId ? {
@@ -48260,8 +48487,18 @@ function requireGraphRenderer() {
48260
48487
  } : edge));
48261
48488
  }, []);
48262
48489
  const onCloseNodeInfoPanel = (0, react_1.useCallback)(() => {
48263
- setSelectedNodeId(null);
48490
+ setSelectedNodeIds(/* @__PURE__ */ new Set());
48264
48491
  }, []);
48492
+ const onPaneClick = (0, react_1.useCallback)(() => {
48493
+ setSelectedNodeIds(/* @__PURE__ */ new Set());
48494
+ setSelectedEdgeIds(/* @__PURE__ */ new Set());
48495
+ }, []);
48496
+ const handleSelectionChange = (0, react_1.useCallback)(({ nodes: selectedNodes, edges: selectedEdges }) => {
48497
+ if (editable) {
48498
+ setSelectedNodeIds(new Set(selectedNodes.map((n) => n.id)));
48499
+ setSelectedEdgeIds(new Set(selectedEdges.map((e) => e.id)));
48500
+ }
48501
+ }, [editable]);
48265
48502
  const handleNodeUpdate = (0, react_1.useCallback)((nodeId, updates) => {
48266
48503
  if (!editable)
48267
48504
  return;
@@ -48297,16 +48534,19 @@ function requireGraphRenderer() {
48297
48534
  newUpdates.delete(nodeId);
48298
48535
  const newPositions = new Map(prev.positionChanges);
48299
48536
  newPositions.delete(nodeId);
48537
+ const newDimensions = new Map(prev.dimensionChanges);
48538
+ newDimensions.delete(nodeId);
48300
48539
  const newCreatedEdges = prev.createdEdges.filter((e) => e.from !== nodeId && e.to !== nodeId);
48301
48540
  return {
48302
48541
  ...prev,
48303
48542
  deletedNodeIds: newDeletedNodes,
48304
48543
  nodeUpdates: newUpdates,
48305
48544
  positionChanges: newPositions,
48545
+ dimensionChanges: newDimensions,
48306
48546
  createdEdges: newCreatedEdges
48307
48547
  };
48308
48548
  });
48309
- setSelectedNodeId(null);
48549
+ setSelectedNodeIds(/* @__PURE__ */ new Set());
48310
48550
  }, [editable, updateEditState]);
48311
48551
  const handleEdgeDelete = (0, react_1.useCallback)((edgeId) => {
48312
48552
  if (!editable)
@@ -48334,7 +48574,7 @@ function requireGraphRenderer() {
48334
48574
  }
48335
48575
  return prev;
48336
48576
  });
48337
- setSelectedEdgeId(null);
48577
+ setSelectedEdgeIds(/* @__PURE__ */ new Set());
48338
48578
  }, [editable, updateEditState, localEdges]);
48339
48579
  const handleConnect = (0, react_1.useCallback)((connection) => {
48340
48580
  if (!editable || !connection.source || !connection.target)
@@ -48464,6 +48704,11 @@ function requireGraphRenderer() {
48464
48704
  const handleReconnectEnd = (0, react_1.useCallback)(() => {
48465
48705
  edgeReconnectSuccessful.current = true;
48466
48706
  }, []);
48707
+ const selectedEdgeId = (0, react_1.useMemo)(() => {
48708
+ if (selectedEdgeIds.size === 0)
48709
+ return null;
48710
+ return selectedEdgeIds.values().next().value;
48711
+ }, [selectedEdgeIds]);
48467
48712
  const selectedEdge = (0, react_1.useMemo)(() => {
48468
48713
  if (!selectedEdgeId)
48469
48714
  return null;
@@ -48474,6 +48719,11 @@ function requireGraphRenderer() {
48474
48719
  return null;
48475
48720
  return configuration.edgeTypes[selectedEdge.type];
48476
48721
  }, [selectedEdge, configuration.edgeTypes]);
48722
+ const selectedNodeId = (0, react_1.useMemo)(() => {
48723
+ if (selectedNodeIds.size === 0)
48724
+ return null;
48725
+ return selectedNodeIds.values().next().value;
48726
+ }, [selectedNodeIds]);
48477
48727
  const selectedNode = (0, react_1.useMemo)(() => {
48478
48728
  if (!selectedNodeId)
48479
48729
  return null;
@@ -48618,6 +48868,21 @@ function requireGraphRenderer() {
48618
48868
  return;
48619
48869
  setXyflowLocalNodes((nds) => (0, react_2.applyNodeChanges)(changes, nds));
48620
48870
  const positionChanges = changes.filter((change) => change.type === "position" && "position" in change && change.position !== void 0 && "dragging" in change && change.dragging === false);
48871
+ const dimensionChanges = changes.filter((change) => change.type === "dimensions" && "dimensions" in change && change.dimensions !== void 0 && "resizing" in change && change.resizing === false);
48872
+ if (dimensionChanges.length > 0) {
48873
+ updateEditState((prev) => {
48874
+ const newDimensions = new Map(prev.dimensionChanges);
48875
+ for (const change of dimensionChanges) {
48876
+ if (change.dimensions) {
48877
+ newDimensions.set(change.id, {
48878
+ width: Math.round(change.dimensions.width),
48879
+ height: Math.round(change.dimensions.height)
48880
+ });
48881
+ }
48882
+ }
48883
+ return { ...prev, dimensionChanges: newDimensions };
48884
+ });
48885
+ }
48621
48886
  if (positionChanges.length > 0) {
48622
48887
  updateEditState((prev) => {
48623
48888
  const newPositions = new Map(prev.positionChanges);
@@ -48697,11 +48962,11 @@ function requireGraphRenderer() {
48697
48962
  }, 100);
48698
48963
  return () => clearTimeout(timeoutId);
48699
48964
  }, [baseNodesKey, fitView]);
48700
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.ReactFlow, { nodes: xyflowNodes, edges: xyflowEdges, nodeTypes, edgeTypes, minZoom: 0.1, maxZoom: 4, defaultEdgeOptions: { type: "custom" }, onEdgeClick, onNodeClick, proOptions: { hideAttribution: true }, nodesDraggable: editable, elementsSelectable: true, nodesConnectable: editable, edgesReconnectable: editable, reconnectRadius: 25, elevateEdgesOnSelect: true, onNodesChange: handleNodesChange, onConnect: handleConnect, onReconnectStart: handleReconnectStart, onReconnect: handleReconnect, onReconnectEnd: handleReconnectEnd, panOnDrag: true, selectionOnDrag: false, children: [showBackground && (0, jsx_runtime_1.jsx)(react_2.Background, { color: theme.colors.border, gap: 16, size: 1 }), showControls && (0, jsx_runtime_1.jsx)(react_2.Controls, { showZoom: true, showFitView: true, showInteractive: true }), showMinimap && (0, jsx_runtime_1.jsx)(react_2.MiniMap, { nodeColor: (node) => {
48965
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.ReactFlow, { nodes: xyflowNodes, edges: xyflowEdges, nodeTypes, edgeTypes, minZoom: 0.1, maxZoom: 4, defaultEdgeOptions: { type: "custom" }, onEdgeClick, onNodeClick, proOptions: { hideAttribution: true }, nodesDraggable: editable, elementsSelectable: true, nodesConnectable: editable, edgesReconnectable: editable, reconnectRadius: 25, elevateEdgesOnSelect: true, onNodesChange: handleNodesChange, onConnect: handleConnect, onReconnectStart: handleReconnectStart, onReconnect: handleReconnect, onReconnectEnd: handleReconnectEnd, onPaneClick, onSelectionChange: handleSelectionChange, panOnDrag: !editable, selectionOnDrag: editable, selectionKeyCode: null, multiSelectionKeyCode: "Shift", children: [showBackground && (0, jsx_runtime_1.jsx)(react_2.Background, { color: theme.colors.border, gap: 16, size: 1 }), showControls && (0, jsx_runtime_1.jsx)(react_2.Controls, { showZoom: true, showFitView: true, showInteractive: true }), showMinimap && (0, jsx_runtime_1.jsx)(react_2.MiniMap, { nodeColor: (node) => {
48701
48966
  var _a;
48702
48967
  const nodeData = node.data;
48703
48968
  return ((_a = nodeData == null ? void 0 : nodeData.typeDefinition) == null ? void 0 : _a.color) || theme.colors.secondary;
48704
- }, nodeBorderRadius: 2, pannable: true, zoomable: true })] }, baseNodesKey), selectedEdge && selectedEdgeTypeDefinition && (0, jsx_runtime_1.jsx)(EdgeInfoPanel_1.EdgeInfoPanel, { edge: selectedEdge, typeDefinition: selectedEdgeTypeDefinition, sourceNodeId: selectedEdge.from, targetNodeId: selectedEdge.to, onClose: onCloseEdgeInfoPanel, onDelete: editable ? handleEdgeDelete : void 0, onUpdateSides: editable ? handleUpdateEdgeSides : void 0 }), selectedNode && selectedNodeTypeDefinition && (0, jsx_runtime_1.jsx)(NodeInfoPanel_1.NodeInfoPanel, { node: selectedNode, typeDefinition: selectedNodeTypeDefinition, availableNodeTypes: configuration.nodeTypes, onClose: onCloseNodeInfoPanel, onDelete: editable ? handleNodeDelete : void 0, onUpdate: editable ? handleNodeUpdate : void 0 }), pendingConnection && (0, jsx_runtime_1.jsxs)("div", { style: {
48969
+ }, nodeBorderRadius: 2, pannable: true, zoomable: true })] }, baseNodesKey), selectedNodeIds.size >= 2 && (0, jsx_runtime_1.jsx)(SelectionSidebar_1.SelectionSidebar, { selectedNodeIds, nodes, nodeTypeDefinitions: configuration.nodeTypes, onClose: onCloseNodeInfoPanel }), selectedEdgeIds.size === 1 && selectedEdge && selectedEdgeTypeDefinition && (0, jsx_runtime_1.jsx)(EdgeInfoPanel_1.EdgeInfoPanel, { edge: selectedEdge, typeDefinition: selectedEdgeTypeDefinition, sourceNodeId: selectedEdge.from, targetNodeId: selectedEdge.to, onClose: onCloseEdgeInfoPanel, onDelete: editable ? handleEdgeDelete : void 0, onUpdateSides: editable ? handleUpdateEdgeSides : void 0 }), selectedNodeIds.size === 1 && selectedNode && selectedNodeTypeDefinition && (0, jsx_runtime_1.jsx)(NodeInfoPanel_1.NodeInfoPanel, { node: selectedNode, typeDefinition: selectedNodeTypeDefinition, availableNodeTypes: configuration.nodeTypes, onClose: onCloseNodeInfoPanel, onDelete: editable ? handleNodeDelete : void 0, onUpdate: editable ? handleNodeUpdate : void 0 }), pendingConnection && (0, jsx_runtime_1.jsxs)("div", { style: {
48705
48970
  position: "absolute",
48706
48971
  top: "50%",
48707
48972
  left: "50%",
@@ -48874,6 +49139,10 @@ function requireGraphRenderer() {
48874
49139
  nodeId,
48875
49140
  position
48876
49141
  })),
49142
+ dimensionChanges: Array.from(state.dimensionChanges.entries()).map(([nodeId, dimensions]) => ({
49143
+ nodeId,
49144
+ dimensions
49145
+ })),
48877
49146
  nodeUpdates: Array.from(state.nodeUpdates.entries()).map(([nodeId, updates]) => ({
48878
49147
  nodeId,
48879
49148
  updates
@@ -48887,7 +49156,7 @@ function requireGraphRenderer() {
48887
49156
  targetHandle: e.targetHandle
48888
49157
  })),
48889
49158
  deletedEdges: state.deletedEdges.map((e) => ({ from: e.from, to: e.to, type: e.type })),
48890
- hasChanges: state.positionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0
49159
+ hasChanges: state.positionChanges.size > 0 || state.dimensionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0
48891
49160
  };
48892
49161
  },
48893
49162
  resetEditState: () => {
@@ -48895,7 +49164,7 @@ function requireGraphRenderer() {
48895
49164
  },
48896
49165
  hasUnsavedChanges: () => {
48897
49166
  const state = editStateRef.current;
48898
- return state.positionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0;
49167
+ return state.positionChanges.size > 0 || state.dimensionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0;
48899
49168
  }
48900
49169
  }), []);
48901
49170
  if (!canvasData) {