@darajs/components 1.1.9 → 1.1.10

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.
@@ -1,4 +1,7 @@
1
+ import type { GraphLayoutDefinition } from './graph-layout';
1
2
  export { default as CausalGraphViewer } from './causal-graph-viewer';
2
3
  export { default as NodeHierarchyBuilder } from './node-hierarchy-builder';
3
4
  export { default as VisualEdgeEncoder } from './visual-edge-encoder';
5
+ export { parseLayoutDefinition } from './graph-layout';
6
+ export type { GraphLayoutDefinition };
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/graphs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/graphs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { default as CausalGraphViewer } from './causal-graph-viewer';
2
2
  export { default as NodeHierarchyBuilder } from './node-hierarchy-builder';
3
3
  export { default as VisualEdgeEncoder } from './visual-edge-encoder';
4
+ export { parseLayoutDefinition } from './graph-layout';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/graphs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/graphs/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -31920,7 +31920,6 @@
31920
31920
  overflow: hidden;
31921
31921
  flex: 1 1 auto;
31922
31922
 
31923
- height: 100%;
31924
31923
  margin-right: 0.5rem;
31925
31924
  padding: 0rem;
31926
31925
 
@@ -31947,6 +31946,7 @@
31947
31946
  align-items: center;
31948
31947
 
31949
31948
  width: 100%;
31949
+ height: 100%;
31950
31950
  max-height: ${(props) => props.maxRows * (tagHeight + tagTopMargin) - 0.25}rem;
31951
31951
  `;
31952
31952
  const Tag$1 = styled__default.default.span`
@@ -140202,7 +140202,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
140202
140202
  else
140203
140203
  return [m2 > 0 ? xEdge1 : xEdge0, yEdge0];
140204
140204
  }
140205
- function updateEdge(pt2) {
140205
+ function updateEdge2(pt2) {
140206
140206
  var x2 = pt2[0];
140207
140207
  var y2 = pt2[1];
140208
140208
  var xSame = x2 === pts2[pti - 1][0];
@@ -140229,9 +140229,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
140229
140229
  }
140230
140230
  function updateEdgesForReentry(pt2) {
140231
140231
  if (pts2[pti - 1][0] !== pt2[0] && pts2[pti - 1][1] !== pt2[1]) {
140232
- updateEdge([lastXEdge, lastYEdge]);
140232
+ updateEdge2([lastXEdge, lastYEdge]);
140233
140233
  }
140234
- updateEdge(pt2);
140234
+ updateEdge2(pt2);
140235
140235
  lastFarPt = null;
140236
140236
  lastXEdge = lastYEdge = 0;
140237
140237
  }
@@ -140266,17 +140266,17 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
140266
140266
  if (lastFarPt) {
140267
140267
  if (lastXEdge !== xEdge && lastYEdge !== yEdge) {
140268
140268
  if (lastXEdge && lastYEdge) {
140269
- updateEdge(getClosestCorner(lastFarPt, pt2));
140269
+ updateEdge2(getClosestCorner(lastFarPt, pt2));
140270
140270
  } else {
140271
- updateEdge([lastXEdge || xEdge, lastYEdge || yEdge]);
140271
+ updateEdge2([lastXEdge || xEdge, lastYEdge || yEdge]);
140272
140272
  }
140273
140273
  } else if (lastXEdge && lastYEdge) {
140274
- updateEdge([lastXEdge, lastYEdge]);
140274
+ updateEdge2([lastXEdge, lastYEdge]);
140275
140275
  }
140276
140276
  }
140277
- updateEdge([xEdge, yEdge]);
140277
+ updateEdge2([xEdge, yEdge]);
140278
140278
  } else if (lastXEdge - xEdge && lastYEdge - yEdge) {
140279
- updateEdge([xEdge || lastXEdge, yEdge || lastYEdge]);
140279
+ updateEdge2([xEdge || lastXEdge, yEdge || lastYEdge]);
140280
140280
  }
140281
140281
  lastFarPt = pt2;
140282
140282
  lastXEdge = xEdge;
@@ -140361,7 +140361,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
140361
140361
  clusterStartPt = thisPt;
140362
140362
  }
140363
140363
  if (lastFarPt)
140364
- updateEdge([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]);
140364
+ updateEdge2([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]);
140365
140365
  segments.push(pts2.slice(0, pti));
140366
140366
  }
140367
140367
  var lastShapeChar = shape.slice(shape.length - 1);
@@ -304735,7 +304735,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
304735
304735
  const edgeAttributes = props.state.graph.getEdgeAttributes(source, target);
304736
304736
  const sourceAttributes = props.state.graph.getNodeAttributes(source);
304737
304737
  const targetAttributes = props.state.graph.getNodeAttributes(target);
304738
- return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [jsxRuntime.exports.jsx(DirectionEditor, { edgeType: edgeAttributes.edge_type, onConfirmDirection: props.onConfirmDirection, source: (_a3 = sourceAttributes["meta.rendering_properties.label"]) !== null && _a3 !== void 0 ? _a3 : source, target: (_b = targetAttributes["meta.rendering_properties.label"]) !== null && _b !== void 0 ? _b : target }), jsxRuntime.exports.jsxs(ColumnWrapper, { "$gap": 1, "$scrollable": true, children: [(editable2 || edgeAttributes["meta.rendering_properties.description"]) && jsxRuntime.exports.jsx(DescriptionEditor, { api: props.api, edge: edgeAttributes, selectedEdge: props.selectedEdge }), editable2 && jsxRuntime.exports.jsx(EdgeEditor, { api: props.api, edge: edgeAttributes, edgeConstraint: props.selectedConstraint, onUpdateConstraint: props.onUpdateConstraint, source, state: props.state, target })] })] });
304738
+ return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [jsxRuntime.exports.jsx(DirectionEditor, { edgeType: edgeAttributes.edge_type, onConfirmDirection: props.onConfirmDirection, source: (_a3 = sourceAttributes["meta.rendering_properties.label"]) !== null && _a3 !== void 0 ? _a3 : source, target: (_b = targetAttributes["meta.rendering_properties.label"]) !== null && _b !== void 0 ? _b : target }), jsxRuntime.exports.jsxs(ColumnWrapper, { "$gap": 1, "$scrollable": true, children: [(editable2 || edgeAttributes["meta.rendering_properties.description"]) && jsxRuntime.exports.jsx(DescriptionEditor, { api: props.api, edge: edgeAttributes, selectedEdge: props.selectedEdge }), editable2 && jsxRuntime.exports.jsx(EdgeEditor, { api: props.api, edge: edgeAttributes, edgeConstraint: props.selectedConstraint, onUpdateConstraint: props.onUpdateConstraint, source, state: props.state, target }), props.extraSections] })] });
304739
304739
  }
304740
304740
  const StyledInput$1 = styled__default.default(Input$3)`
304741
304741
  width: 100%;
@@ -304803,7 +304803,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
304803
304803
  }
304804
304804
  function NodeInfoContent(props) {
304805
304805
  const nodeAttributes = props.state.graph.getNodeAttributes(props.selectedNode);
304806
- return jsxRuntime.exports.jsx(ColumnWrapper, { children: jsxRuntime.exports.jsx(LabelEditor, { node: nodeAttributes, onLabelChange: props.api.renameNode }) });
304806
+ return jsxRuntime.exports.jsxs(ColumnWrapper, { children: [jsxRuntime.exports.jsx(LabelEditor, { node: nodeAttributes, onLabelChange: props.api.renameNode }), props.extraSections] });
304807
304807
  }
304808
304808
  function EditorOverlay(props) {
304809
304809
  var _a3;
@@ -305208,6 +305208,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
305208
305208
  const modeData = (_a3 = DEFAULT_LEGENDS.get(editorMode)) !== null && _a3 !== void 0 ? _a3 : [];
305209
305209
  return [...modeData, ...(additionalLegend !== null && additionalLegend !== void 0 ? additionalLegend : []).filter(Boolean)];
305210
305210
  }
305211
+ const graphCtx = React.createContext(null);
305211
305212
  const PI_2 = Math.PI * 2;
305212
305213
  const RAD_TO_DEG = 180 / Math.PI;
305213
305214
  const DEG_TO_RAD = Math.PI / 180;
@@ -341260,6 +341261,10 @@ ${e3}`);
341260
341261
  return acc;
341261
341262
  }, {});
341262
341263
  }
341264
+ function getExtraNodeFields(nodeData) {
341265
+ const extras = __rest$2(nodeData, ["meta", "variable_type"]);
341266
+ return extras;
341267
+ }
341263
341268
  function parseGraphNode(nodeKey, nodeData, data2, availableInputs) {
341264
341269
  var _a3, _b, _c;
341265
341270
  const isLatent = availableInputs && Array.isArray(availableInputs) ? !availableInputs.includes(nodeKey) && Object.keys(data2.edges).includes(nodeKey) : false;
@@ -341269,7 +341274,9 @@ ${e3}`);
341269
341274
  return [computedKey, entry[1]];
341270
341275
  }));
341271
341276
  (_c = meta2["meta.rendering_properties.latent"]) !== null && _c !== void 0 ? _c : meta2["meta.rendering_properties.latent"] = isLatent;
341277
+ const extras = getExtraNodeFields(nodeData);
341272
341278
  const attributes2 = Object.assign({
341279
+ extras,
341273
341280
  id: nodeKey,
341274
341281
  originalMeta: nodeData.meta,
341275
341282
  variable_type: nodeData.variable_type,
@@ -341278,6 +341285,10 @@ ${e3}`);
341278
341285
  }, meta2);
341279
341286
  return attributes2;
341280
341287
  }
341288
+ function getExtraEdgeFields(edgeData) {
341289
+ const extras = __rest$2(edgeData, ["meta", "edge_type"]);
341290
+ return extras;
341291
+ }
341281
341292
  function parseGraphEdge(edgeData) {
341282
341293
  var _a3, _b;
341283
341294
  const originalEntries = Object.entries((_b = (_a3 = edgeData.meta) === null || _a3 === void 0 ? void 0 : _a3.rendering_properties) !== null && _b !== void 0 ? _b : {});
@@ -341285,9 +341296,13 @@ ${e3}`);
341285
341296
  const computedKey = `meta.rendering_properties.${entry[0]}`;
341286
341297
  return [computedKey, entry[1]];
341287
341298
  }));
341288
- const attributes2 = Object.assign({ edge_type: edgeData.edge_type, originalMeta: edgeData.meta }, meta2);
341299
+ const attributes2 = Object.assign({ edge_type: edgeData.edge_type, extras: getExtraEdgeFields(edgeData), originalMeta: edgeData.meta }, meta2);
341289
341300
  return attributes2;
341290
341301
  }
341302
+ function getExtraGraphFields(graphData) {
341303
+ const extras = __rest$2(graphData, ["edges", "nodes", "version"]);
341304
+ return extras;
341305
+ }
341291
341306
  function causalGraphParser(data2, availableInputs, initialGraph) {
341292
341307
  let resultGraph = initialGraph;
341293
341308
  resultGraph !== null && resultGraph !== void 0 ? resultGraph : resultGraph = new DirectedGraph();
@@ -341302,9 +341317,9 @@ ${e3}`);
341302
341317
  const attributes2 = parseGraphNode(nodeKey, nodeData, data2, availableInputs);
341303
341318
  try {
341304
341319
  const existingAttributes = resultGraph.getNodeAttributes(nodeKey);
341305
- const { x: x2, y: y2 } = existingAttributes, existingAttributesWithoutPosition = __rest$2(existingAttributes, ["x", "y"]);
341320
+ const { x: x2, y: y2, extras } = existingAttributes, existingAttributesWithoutPosition = __rest$2(existingAttributes, ["x", "y", "extras"]);
341306
341321
  if (!isEqual_1(existingAttributesWithoutPosition, attributes2)) {
341307
- resultGraph.updateNode(nodeKey, () => Object.assign(Object.assign({}, attributes2), { x: x2, y: y2 }));
341322
+ resultGraph.updateNode(nodeKey, () => Object.assign(Object.assign({}, attributes2), { extras, x: x2, y: y2 }));
341308
341323
  }
341309
341324
  } catch (_a3) {
341310
341325
  resultGraph.addNode(nodeKey, attributes2);
@@ -341332,6 +341347,15 @@ ${e3}`);
341332
341347
  });
341333
341348
  resultGraph.updateAttribute("version", () => data2.version);
341334
341349
  resultGraph.updateAttribute("uid", () => shortid$1.exports.generate());
341350
+ try {
341351
+ const existingGraphAttributes = resultGraph.getAttributes();
341352
+ const { extras } = existingGraphAttributes;
341353
+ if (Object.keys(extras).length === 0) {
341354
+ resultGraph.updateAttribute("extras", () => getExtraGraphFields(data2));
341355
+ }
341356
+ } catch (_a3) {
341357
+ resultGraph.updateAttribute("extras", () => getExtraGraphFields(data2));
341358
+ }
341335
341359
  return resultGraph;
341336
341360
  }
341337
341361
  class MarketingLayoutBuilder extends GraphLayoutBuilder {
@@ -382108,7 +382132,7 @@ ${letters.join("\n")}`;
382108
382132
  "edgeMouseover"
382109
382133
  ];
382110
382134
  class Engine extends EventEmitter$1 {
382111
- constructor(graph, layout2, editable2, editorMode, theme2, constraints, zoomThresholds) {
382135
+ constructor(graph, layout2, editable2, editorMode, theme2, constraints, zoomThresholds, processEdgeStyle) {
382112
382136
  super();
382113
382137
  this.debouncedUpdateLayout = debounce_1(this.updateLayout, 150, { trailing: true });
382114
382138
  this.dragMode = null;
@@ -382148,6 +382172,7 @@ ${letters.join("\n")}`;
382148
382172
  this.theme = theme2;
382149
382173
  this.constraints = constraints;
382150
382174
  this.zoomThresholds = zoomThresholds;
382175
+ this.processEdgeStyle = processEdgeStyle;
382151
382176
  Filter.defaultResolution = 3;
382152
382177
  }
382153
382178
  getCenterPosition() {
@@ -382500,7 +382525,7 @@ ${letters.join("\n")}`;
382500
382525
  return (_a3 = this.constraints) === null || _a3 === void 0 ? void 0 : _a3.find((c2) => c2.source === source && c2.target === target || c2.source === target && c2.target === source);
382501
382526
  }
382502
382527
  getEdgeStyle(edge, attributes2, constraint) {
382503
- return {
382528
+ const edgeStyle = {
382504
382529
  accepted: attributes2["meta.rendering_properties.accepted"],
382505
382530
  color: attributes2["meta.rendering_properties.color"],
382506
382531
  constraint,
@@ -382514,6 +382539,10 @@ ${letters.join("\n")}`;
382514
382539
  thickness: attributes2["meta.rendering_properties.thickness"],
382515
382540
  type: attributes2.edge_type
382516
382541
  };
382542
+ if (this.processEdgeStyle) {
382543
+ return this.processEdgeStyle(edgeStyle, attributes2);
382544
+ }
382545
+ return edgeStyle;
382517
382546
  }
382518
382547
  getNodeStyle(node2, attributes2) {
382519
382548
  var _a3, _b, _c, _d;
@@ -382763,12 +382792,12 @@ ${letters.join("\n")}`;
382763
382792
  this.graph.forEachEdge(this.updateEdgeStyle.bind(this));
382764
382793
  }
382765
382794
  }
382766
- function useRenderEngine(parentRef, graph, layout2, editable2, editorMode, constraints, zoomThresholds) {
382795
+ function useRenderEngine(parentRef, graph, layout2, editable2, editorMode, constraints, processEdgeStyle, zoomThresholds) {
382767
382796
  const theme2 = useClTheme();
382768
382797
  const engine = React__namespace.useRef(null);
382769
382798
  const listeners = React__namespace.useRef({});
382770
382799
  if (!engine.current) {
382771
- engine.current = new Engine(graph, layout2, editable2, editorMode, theme2, constraints, zoomThresholds);
382800
+ engine.current = new Engine(graph, layout2, editable2, editorMode, theme2, constraints, zoomThresholds, processEdgeStyle);
382772
382801
  }
382773
382802
  React__namespace.useEffect(() => {
382774
382803
  engine.current.start(parentRef.current).then(() => {
@@ -382847,10 +382876,7 @@ ${letters.join("\n")}`;
382847
382876
  const newKey = removeEdgePrefix(key);
382848
382877
  return [newKey, val];
382849
382878
  }));
382850
- const output2 = {
382851
- edge_type: attributes2.edge_type,
382852
- meta: Object.assign(Object.assign({}, attributes2.originalMeta), { rendering_properties: unflattenedMeta })
382853
- };
382879
+ const output2 = Object.assign({ edge_type: attributes2.edge_type, meta: Object.assign(Object.assign({}, attributes2.originalMeta), { rendering_properties: unflattenedMeta }) }, attributes2.extras);
382854
382880
  if (source) {
382855
382881
  output2.source = source;
382856
382882
  }
@@ -382874,10 +382900,7 @@ ${letters.join("\n")}`;
382874
382900
  const newKey = removeNodePrefix(key);
382875
382901
  return [newKey, val];
382876
382902
  }));
382877
- const output2 = {
382878
- meta: Object.assign(Object.assign({}, attributes2.originalMeta), { rendering_properties: unflattenedMeta }),
382879
- variable_type: attributes2.variable_type
382880
- };
382903
+ const output2 = Object.assign({ meta: Object.assign(Object.assign({}, attributes2.originalMeta), { rendering_properties: unflattenedMeta }), variable_type: attributes2.variable_type }, attributes2.extras);
382881
382904
  if (includeIdentifier) {
382882
382905
  output2.identifier = attributes2.id;
382883
382906
  }
@@ -382905,17 +382928,14 @@ ${letters.join("\n")}`;
382905
382928
  const newKey = removeNodePrefix(key);
382906
382929
  return [newKey, val];
382907
382930
  }));
382908
- acc[id2] = {
382909
- meta: Object.assign(Object.assign({}, attributes2.originalMeta), { rendering_properties: unflattenedMeta }),
382910
- variable_type: attributes2.variable_type
382911
- };
382931
+ acc[id2] = Object.assign({ meta: Object.assign(Object.assign({}, attributes2.originalMeta), { rendering_properties: unflattenedMeta }), variable_type: attributes2.variable_type }, attributes2.extras);
382912
382932
  return acc;
382913
382933
  }, {});
382914
- return {
382934
+ return Object.assign({
382915
382935
  edges,
382916
382936
  nodes,
382917
382937
  version: state.graph.getAttribute("version")
382918
- };
382938
+ }, state.graph.getAttribute("extras"));
382919
382939
  }
382920
382940
  const Wrapper = styled__default.default.div`
382921
382941
  overflow: hidden;
@@ -383016,6 +383036,12 @@ ${letters.join("\n")}`;
383016
383036
  draft.graph.dropNode(action.node);
383017
383037
  break;
383018
383038
  }
383039
+ case GraphActionType.UPDATE_EDGE: {
383040
+ draft.graph.updateEdgeAttribute(action.source, action.target, "extras", () => {
383041
+ return action.extras;
383042
+ });
383043
+ break;
383044
+ }
383019
383045
  case GraphActionType.UPDATE_EDGE_TYPE: {
383020
383046
  draft.graph.setEdgeAttribute(action.source, action.target, "edge_type", action.edge_type);
383021
383047
  break;
@@ -383024,6 +383050,10 @@ ${letters.join("\n")}`;
383024
383050
  draft.graph.setEdgeAttribute(action.source, action.target, "meta.rendering_properties.description", action.note);
383025
383051
  break;
383026
383052
  }
383053
+ case GraphActionType.UPDATE_NODE: {
383054
+ draft.graph.setNodeAttribute(action.node, "extras", action.extras);
383055
+ break;
383056
+ }
383027
383057
  }
383028
383058
  return draft;
383029
383059
  };
@@ -383038,6 +383068,12 @@ ${letters.join("\n")}`;
383038
383068
  target: edge[1],
383039
383069
  type: GraphActionType.ADD_EDGE
383040
383070
  });
383071
+ const updateEdge = (edge, extras) => ({
383072
+ extras,
383073
+ source: edge[0],
383074
+ target: edge[1],
383075
+ type: GraphActionType.UPDATE_EDGE
383076
+ });
383041
383077
  const updateEdgeType = (edge, symbol) => ({
383042
383078
  edge_type: symbol,
383043
383079
  source: edge[0],
@@ -383064,6 +383100,11 @@ ${letters.join("\n")}`;
383064
383100
  target,
383065
383101
  type: GraphActionType.ACCEPT_EDGE
383066
383102
  });
383103
+ const updateNode = (node2, extras) => ({
383104
+ extras,
383105
+ node: node2,
383106
+ type: GraphActionType.UPDATE_NODE
383107
+ });
383067
383108
  const GraphActionCreators = {
383068
383109
  acceptEdge,
383069
383110
  addEdge,
@@ -383072,8 +383113,10 @@ ${letters.join("\n")}`;
383072
383113
  removeNode,
383073
383114
  renameNode,
383074
383115
  reverseEdge,
383116
+ updateEdge,
383075
383117
  updateEdgeNote,
383076
- updateEdgeType
383118
+ updateEdgeType,
383119
+ updateNode
383077
383120
  };
383078
383121
  const actionNames = Object.keys(GraphActionCreators);
383079
383122
  function useCausalGraphEditor(graphData, editorMode, availableInputs, newNodesRequirePosition) {
@@ -383288,7 +383331,7 @@ ${letters.join("\n")}`;
383288
383331
  const theme2 = useClTheme();
383289
383332
  const canvasParentRef = React__namespace.useRef(null);
383290
383333
  const { state, api: api2 } = useCausalGraphEditor(props.graphData, props.editorMode, props.availableInputs, props.graphLayout.requiresPosition);
383291
- const { getCenterPosition, useEngineEvent, resetViewport, resetLayout, onSetDragMode, onNodeSelected, onEdgeSelected, onSearchResults, onUpdateConstraints } = useRenderEngine(canvasParentRef, state.graph, props.graphLayout, props.editable, props.editorMode, props.initialConstraints, props.zoomThresholds);
383334
+ const { getCenterPosition, useEngineEvent, resetViewport, resetLayout, onSetDragMode, onNodeSelected, onEdgeSelected, onSearchResults, onUpdateConstraints } = useRenderEngine(canvasParentRef, state.graph, props.graphLayout, props.editable, props.editorMode, props.initialConstraints, props.processEdgeStyle, props.zoomThresholds);
383292
383335
  const [selectedEdge, setSelectedEdge] = React.useState(null);
383293
383336
  const [selectedNode, setSelectedNode] = React.useState(null);
383294
383337
  const [highlightedNode, setHighlightedNode] = React.useState();
@@ -383568,7 +383611,16 @@ ${letters.join("\n")}`;
383568
383611
  editorMode: props.editorMode,
383569
383612
  onNotify: props.onNotify,
383570
383613
  verboseDescriptions: props.verboseDescriptions
383571
- }, children: jsxRuntime.exports.jsx(pointerCtx.Provider, { value: { disablePointerEvents: isDragging, onPanelEnter, onPanelExit }, children: jsxRuntime.exports.jsx("div", { style: Object.assign({ display: "flex", flex: "1 1 auto", flexDirection: "column", minHeight: "100px", position: "relative" }, props.style), children: jsxRuntime.exports.jsxs(Graph, { onMouseEnter: () => setShowFrameButtons(true), onMouseLeave: () => setShowFrameButtons(false), children: [jsxRuntime.exports.jsxs(EditorOverlay, { bottomLeft: jsxRuntime.exports.jsx(Legend, { listItems: getLegendData(state.editorMode, props.additionalLegends) }), onDelete, onNext, onPrev, showFrameButtons: !isDragging && showFrameButtons, title: panelTitle, topLeft: jsxRuntime.exports.jsx(RecalculateLayoutButton, { onResetLayout: resetLayout }), topRight: jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [jsxRuntime.exports.jsx(FloatingSearchBar, { onChange: onSearchBarChange, onClose: () => setSelectedNode(null), onNext: onNextSearchResult, onPrev: onPrevSearchResult, selectedResult: currentSearchNode + 1, totalNumberOfResults: searchResults.length }), jsxRuntime.exports.jsx(CenterGraphButton, { onResetZoom: resetViewport }), jsxRuntime.exports.jsx(EditControls, { onAddNode }), jsxRuntime.exports.jsx(DragModeButton, { dragMode, setDragMode })] }), validContentSelected: contentSelected, children: [selectedEdge && jsxRuntime.exports.jsx(EdgeInfoContent, { api: api2, onConfirmDirection: confirmDirection, onUpdateConstraint: updateConstraint, selectedConstraint, selectedEdge, state }, selectedEdge.join("-")), selectedNode && jsxRuntime.exports.jsx(NodeInfoContent, { api: api2, selectedNode, state }, selectedNode)] }), jsxRuntime.exports.jsx("div", { ref: canvasParentRef, style: { height: "100%", width: "100%" } }), jsxRuntime.exports.jsx(Tooltip$1, { content: tooltipContent, followCursor: true, getReferenceClientRect: tooltipRef.current, visible: !isInPanel && !!tooltipContent }), jsxRuntime.exports.jsx(ConfirmationModal, Object.assign({ title: "Confirm Removal" }, removeEdgeProps))] }) }) }) });
383614
+ }, children: jsxRuntime.exports.jsx(pointerCtx.Provider, { value: { disablePointerEvents: isDragging, onPanelEnter, onPanelExit }, children: jsxRuntime.exports.jsx("div", { style: Object.assign({ display: "flex", flex: "1 1 auto", flexDirection: "column", minHeight: "100px", position: "relative" }, props.style), children: jsxRuntime.exports.jsxs(Graph, { onMouseEnter: () => setShowFrameButtons(true), onMouseLeave: () => setShowFrameButtons(false), children: [jsxRuntime.exports.jsx(EditorOverlay, { bottomLeft: jsxRuntime.exports.jsx(Legend, { listItems: getLegendData(state.editorMode, props.additionalLegends) }), onDelete, onNext, onPrev, showFrameButtons: !isDragging && showFrameButtons, title: panelTitle, topLeft: jsxRuntime.exports.jsx(RecalculateLayoutButton, { onResetLayout: resetLayout }), topRight: jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [jsxRuntime.exports.jsx(FloatingSearchBar, { onChange: onSearchBarChange, onClose: () => setSelectedNode(null), onNext: onNextSearchResult, onPrev: onPrevSearchResult, selectedResult: currentSearchNode + 1, totalNumberOfResults: searchResults.length }), jsxRuntime.exports.jsx(CenterGraphButton, { onResetZoom: resetViewport }), jsxRuntime.exports.jsx(EditControls, { onAddNode }), jsxRuntime.exports.jsx(DragModeButton, { dragMode, setDragMode })] }), validContentSelected: contentSelected, children: jsxRuntime.exports.jsxs(graphCtx.Provider, { value: {
383615
+ api: api2,
383616
+ constraints,
383617
+ editable: props.editable,
383618
+ graphState: state,
383619
+ onUpdateConstraint: updateConstraint,
383620
+ selectedEdge,
383621
+ selectedNode,
383622
+ verboseDescriptions: props.verboseDescriptions
383623
+ }, children: [selectedEdge && jsxRuntime.exports.jsx(EdgeInfoContent, { api: api2, extraSections: props.edgeExtrasContent, onConfirmDirection: confirmDirection, onUpdateConstraint: updateConstraint, selectedConstraint, selectedEdge, state }, selectedEdge.join("-")), selectedNode && jsxRuntime.exports.jsx(NodeInfoContent, { api: api2, extraSections: props.nodeExtrasContent, selectedNode, state }, selectedNode)] }) }), jsxRuntime.exports.jsx("div", { ref: canvasParentRef, style: { height: "100%", width: "100%" } }), jsxRuntime.exports.jsx(Tooltip$1, { content: tooltipContent, followCursor: true, getReferenceClientRect: tooltipRef.current, visible: !isInPanel && !!tooltipContent }), jsxRuntime.exports.jsx(ConfirmationModal, Object.assign({ title: "Confirm Removal" }, removeEdgeProps))] }) }) }) });
383572
383624
  }
383573
383625
  var DndContext = React.createContext({
383574
383626
  dragDropManager: void 0
@@ -388680,5 +388732,6 @@ ${letters.join("\n")}`;
388680
388732
  exports2.Tooltip = Tooltip;
388681
388733
  exports2.UploadDropzone = UploadDropzone;
388682
388734
  exports2.VisualEdgeEncoder = VisualEdgeEncoder;
388735
+ exports2.parseLayoutDefinition = parseLayoutDefinition;
388683
388736
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
388684
388737
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darajs/components",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "Components for the Dara framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -26,9 +26,9 @@
26
26
  "license": "Apache-2.0",
27
27
  "prettier": "@darajs/prettier-config",
28
28
  "devDependencies": {
29
- "@darajs/eslint-config": "~1.1.0",
30
- "@darajs/prettier-config": "~1.1.0",
31
- "@darajs/stylelint-config": "~1.1.0",
29
+ "@darajs/eslint-config": "~1.2.0",
30
+ "@darajs/prettier-config": "~1.2.0",
31
+ "@darajs/stylelint-config": "~1.2.0",
32
32
  "@testing-library/react-hooks": "^3.4.2",
33
33
  "@types/lodash": "^4.14.155",
34
34
  "@types/react": "^18.2.6",
@@ -51,14 +51,14 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@bokeh/bokehjs": "~3.1.1",
54
- "@darajs/core": "1.1.9",
55
- "@darajs/styled-components": "~1.1.0",
56
- "@darajs/ui-causal-graph-editor": "~1.1.0",
57
- "@darajs/ui-code-editor": "~1.1.0",
58
- "@darajs/ui-components": "~1.1.0",
59
- "@darajs/ui-hierarchy-viewer": "~1.1.0",
60
- "@darajs/ui-icons": "~1.1.0",
61
- "@darajs/ui-utils": "~1.1.0",
54
+ "@darajs/core": "1.1.10",
55
+ "@darajs/styled-components": "~1.2.0",
56
+ "@darajs/ui-causal-graph-editor": "~1.2.0",
57
+ "@darajs/ui-code-editor": "~1.2.0",
58
+ "@darajs/ui-components": "~1.2.0",
59
+ "@darajs/ui-hierarchy-viewer": "~1.2.0",
60
+ "@darajs/ui-icons": "~1.2.0",
61
+ "@darajs/ui-utils": "~1.2.0",
62
62
  "@popperjs/core": "2.4.0",
63
63
  "date-fns": "2.9.0",
64
64
  "immer": "^9.0.6",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "acabc17ea2586f8a1b97280a57a5e75c5211460c"
85
+ "gitHead": "02758efb829553d67dc8f6114369c327d6e9a03e"
86
86
  }