@metadev/daga-react 4.2.12 → 4.2.13

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/index.mjs CHANGED
@@ -4727,7 +4727,7 @@ class ci extends ft {
4727
4727
  const hi = (s) => s * Math.PI / 180, ze = (s, t, e) => {
4728
4728
  const a = hi(e), l = Math.sin(a), r = Math.cos(a), i = (Math.abs(s * r) - Math.abs(t * l)) / (r * r - l * l), n = (Math.abs(s * l) - Math.abs(t * r)) / (l * l - r * r);
4729
4729
  return [i, n];
4730
- }, Ve = navigator?.userAgent?.indexOf("AppleWebKit") >= 0, gi = 12, H = 6, fi = 25, ge = "diagram-connection-unfinished", Qt = class Qt {
4730
+ }, gi = (s) => /^((?!chrome|android).)*safari/i.test(s), Ve = gi(navigator.userAgent), fi = 12, H = 6, ui = 25, ge = "diagram-connection-unfinished", Qt = class Qt {
4731
4731
  /**
4732
4732
  * Constructs a canvas object.
4733
4733
  * @public
@@ -4750,7 +4750,7 @@ const hi = (s) => s * Math.PI / 180, ze = (s, t, e) => {
4750
4750
  e.canvas?.highlightSections !== !1
4751
4751
  ), this.contextMenu = new ri(this, e.canvas?.contextMenu), this.backgroundColor = e.canvas?.backgroundColor || "#FFFFFF", this.gridStyle = e.canvas?.grid?.style ?? Vt.style, this.gridSize = e.canvas?.grid?.enabled === !1 || e.canvas?.grid === void 0 ? 0 : Math.abs(e.canvas?.grid?.spacing || Vt.spacing), this.gridThickness = Math.abs(
4752
4752
  e.canvas?.grid?.thickness || Vt.thickness
4753
- ), this.gridColor = e.canvas?.grid?.color || Vt.color, this.snapToGrid = e.canvas?.grid?.enabled === !1 || e.canvas?.grid === void 0 ? !1 : e.canvas?.grid?.snap || Vt.snap, this.zoomFactor = e.canvas?.zoomFactor || 2, this.panRate = e.canvas?.panRate || 100, this.inferConnectionType = e.connectionSettings?.inferConnectionType || !1, this.autoTightenConnections = e.connectionSettings?.autoTighten !== !1, this.allowConnectionLoops = e.connectionSettings?.allowLoops || !1, this.allowSharingPorts = e.connectionSettings?.sharePorts !== !1, this.allowSharingBothPorts = e.connectionSettings?.shareBothPorts || !1, this.portHighlightRadius = e.connectionSettings?.portHighlightRadius || 100, this.multipleSelectionOn = !1, this.priorityThresholds = e.canvas?.priorityThresholds || [], this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : void 0, this.layoutFormat = e.layoutFormat, this.userActions = e.userActions || {}, this.validators = [], this.actionStack = new jo(this, fi), this.collabEngine = new Xo(this), e.nodeTypes)
4753
+ ), this.gridColor = e.canvas?.grid?.color || Vt.color, this.snapToGrid = e.canvas?.grid?.enabled === !1 || e.canvas?.grid === void 0 ? !1 : e.canvas?.grid?.snap || Vt.snap, this.zoomFactor = e.canvas?.zoomFactor || 2, this.panRate = e.canvas?.panRate || 100, this.inferConnectionType = e.connectionSettings?.inferConnectionType || !1, this.autoTightenConnections = e.connectionSettings?.autoTighten !== !1, this.allowConnectionLoops = e.connectionSettings?.allowLoops || !1, this.allowSharingPorts = e.connectionSettings?.sharePorts !== !1, this.allowSharingBothPorts = e.connectionSettings?.shareBothPorts || !1, this.portHighlightRadius = e.connectionSettings?.portHighlightRadius || 100, this.multipleSelectionOn = !1, this.priorityThresholds = e.canvas?.priorityThresholds || [], this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : void 0, this.layoutFormat = e.layoutFormat, this.userActions = e.userActions || {}, this.validators = [], this.actionStack = new jo(this, ui), this.collabEngine = new Xo(this), e.nodeTypes)
4754
4754
  for (const a of e.nodeTypes) {
4755
4755
  const l = new Ye({
4756
4756
  ...e.nodeTypeDefaults,
@@ -5589,7 +5589,7 @@ const hi = (s) => s * Math.PI / 180, ze = (s, t, e) => {
5589
5589
  )
5590
5590
  ).attr("stroke", "transparent").attr("pointer-events", "stroke").attr(
5591
5591
  "stroke-width",
5592
- (n) => `${(n.look.thickness || et.look.thickness) + gi}px`
5592
+ (n) => `${(n.look.thickness || et.look.thickness) + fi}px`
5593
5593
  ).attr(
5594
5594
  "stroke-dasharray",
5595
5595
  (n) => pe(
@@ -6454,7 +6454,7 @@ class to {
6454
6454
  }
6455
6455
  }
6456
6456
  }
6457
- class ui {
6457
+ class pi {
6458
6458
  constructor(t) {
6459
6459
  this.gapSize = t;
6460
6460
  }
@@ -6492,7 +6492,7 @@ const eo = (s, t, e, a) => {
6492
6492
  a
6493
6493
  );
6494
6494
  };
6495
- class pi {
6495
+ class mi {
6496
6496
  constructor(t) {
6497
6497
  this.gapSize = t;
6498
6498
  }
@@ -6567,7 +6567,7 @@ class ne {
6567
6567
  return t;
6568
6568
  }
6569
6569
  }
6570
- class mi {
6570
+ class vi {
6571
6571
  constructor(t) {
6572
6572
  this.gapSize = t;
6573
6573
  }
@@ -6620,7 +6620,7 @@ class mi {
6620
6620
  return t;
6621
6621
  }
6622
6622
  }
6623
- class vi {
6623
+ class yi {
6624
6624
  constructor(t) {
6625
6625
  this.gapSize = t;
6626
6626
  }
@@ -6635,7 +6635,7 @@ class vi {
6635
6635
  return t;
6636
6636
  }
6637
6637
  }
6638
- class yi {
6638
+ class bi {
6639
6639
  constructor(t) {
6640
6640
  this.gapSize = t;
6641
6641
  }
@@ -6702,7 +6702,7 @@ class yi {
6702
6702
  return t;
6703
6703
  }
6704
6704
  }
6705
- class bi {
6705
+ class ki {
6706
6706
  constructor(t) {
6707
6707
  this.gapSize = t;
6708
6708
  }
@@ -6780,7 +6780,7 @@ class Se {
6780
6780
  }
6781
6781
  }
6782
6782
  }
6783
- class ki {
6783
+ class wi {
6784
6784
  constructor(t) {
6785
6785
  this.gapSize = t;
6786
6786
  }
@@ -6796,16 +6796,16 @@ class ki {
6796
6796
  }
6797
6797
  }
6798
6798
  const Re = {
6799
- adjacency: new ui(),
6799
+ adjacency: new pi(),
6800
6800
  breadth: new ne(),
6801
- "breadth-adjacency": new pi(),
6802
- force: new mi(),
6803
- horizontal: new vi(),
6804
- priority: new yi(),
6805
- tree: new bi(),
6806
- vertical: new ki()
6807
- }, wi = He({}), $t = He({});
6808
- class Si {
6801
+ "breadth-adjacency": new mi(),
6802
+ force: new vi(),
6803
+ horizontal: new yi(),
6804
+ priority: new bi(),
6805
+ tree: new ki(),
6806
+ vertical: new wi()
6807
+ }, Si = He({}), $t = He({});
6808
+ class Ci {
6809
6809
  constructor(t, e) {
6810
6810
  this.onTitleChange = t, this.onValueSetChange = e;
6811
6811
  }
@@ -6869,7 +6869,7 @@ const Ce = ({
6869
6869
  children: /* @__PURE__ */ v("div", { className: f() })
6870
6870
  }
6871
6871
  ) });
6872
- }, Ci = () => {
6872
+ }, $i = () => {
6873
6873
  const s = Ut($t), t = rt(null), [e, a] = U([]);
6874
6874
  co(s.validatorChange$, s.diagramChange$).pipe(
6875
6875
  ho(() => l())
@@ -6926,7 +6926,7 @@ const Ce = ({
6926
6926
  n
6927
6927
  )) }) })
6928
6928
  ] }) });
6929
- }, $i = 200, Oe = (s) => (s || "").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""), so = ({
6929
+ }, Ii = 200, Oe = (s) => (s || "").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""), so = ({
6930
6930
  disabled: s,
6931
6931
  options: t,
6932
6932
  value: e,
@@ -7000,7 +7000,7 @@ const Ce = ({
7000
7000
  }, tt = () => {
7001
7001
  setTimeout(() => {
7002
7002
  V();
7003
- }, $i);
7003
+ }, Ii);
7004
7004
  }, E = (A) => {
7005
7005
  const _ = l.current?.querySelectorAll("li")[A];
7006
7006
  _ && _.scrollIntoView({ block: "center" });
@@ -7049,7 +7049,7 @@ const Ce = ({
7049
7049
  ]
7050
7050
  }
7051
7051
  );
7052
- }, Ii = (s, t) => s.find((e) => e.key === t)?.label || `${t}`, Ai = ({
7052
+ }, Ai = (s, t) => s.find((e) => e.key === t)?.label || `${t}`, xi = ({
7053
7053
  disabled: s,
7054
7054
  allowRepeats: t,
7055
7055
  options: e,
@@ -7058,7 +7058,7 @@ const Ce = ({
7058
7058
  }) => {
7059
7059
  const [r, i] = U(), [n, o] = U([]), [d, c] = U([]);
7060
7060
  Ct(() => {
7061
- const u = a.length === 0, k = a.map((b) => Ii(e, b));
7061
+ const u = a.length === 0, k = a.map((b) => Ai(e, b));
7062
7062
  o(k), u && l(a), p();
7063
7063
  }, [a, e]);
7064
7064
  const h = (u) => {
@@ -7105,7 +7105,7 @@ const Ce = ({
7105
7105
  /* @__PURE__ */ v("button", { className: "daga-property-button", onClick: y, children: /* @__PURE__ */ v("div", { className: "daga-icon daga-add-icon" }) })
7106
7106
  ] })
7107
7107
  ] });
7108
- }, xi = ({
7108
+ }, Li = ({
7109
7109
  disabled: s,
7110
7110
  allowRepeats: t,
7111
7111
  value: e,
@@ -7168,7 +7168,7 @@ const Ce = ({
7168
7168
  /* @__PURE__ */ v("button", { className: "daga-property-button", onClick: d, children: /* @__PURE__ */ v("div", { className: "daga-icon daga-add-icon" }) })
7169
7169
  ] })
7170
7170
  ] });
7171
- }, Li = ({
7171
+ }, Ei = ({
7172
7172
  disabled: s,
7173
7173
  value: t,
7174
7174
  onChange: e
@@ -7432,7 +7432,7 @@ const Ce = ({
7432
7432
  }
7433
7433
  ) }),
7434
7434
  (o.type === T.OptionList || o.type === T.OptionSet) && /* @__PURE__ */ v(
7435
- Ai,
7435
+ xi,
7436
7436
  {
7437
7437
  disabled: o.editable === !1 || !l,
7438
7438
  allowRepeats: o.type === T.OptionList,
@@ -7442,7 +7442,7 @@ const Ce = ({
7442
7442
  }
7443
7443
  ),
7444
7444
  (o.type === T.TextList || o.type === T.TextSet) && /* @__PURE__ */ v(
7445
- xi,
7445
+ Li,
7446
7446
  {
7447
7447
  disabled: o.editable === !1 || !l,
7448
7448
  allowRepeats: o.type === T.TextList,
@@ -7451,7 +7451,7 @@ const Ce = ({
7451
7451
  }
7452
7452
  ),
7453
7453
  o.type === T.TextMap && /* @__PURE__ */ v(
7454
- Li,
7454
+ Ei,
7455
7455
  {
7456
7456
  disabled: o.editable === !1 || !l,
7457
7457
  value: s?.getValue(o.name),
@@ -7563,7 +7563,7 @@ const Ce = ({
7563
7563
  )
7564
7564
  ] })
7565
7565
  ] }),
7566
- o.type !== T.Object && /* @__PURE__ */ v("div", { className: "daga-property-value", children: Ei(s?.getValue(o.name)) }),
7566
+ o.type !== T.Object && /* @__PURE__ */ v("div", { className: "daga-property-value", children: Mi(s?.getValue(o.name)) }),
7567
7567
  o.type === T.Object && /* @__PURE__ */ v(
7568
7568
  ro,
7569
7569
  {
@@ -7585,7 +7585,7 @@ const Ce = ({
7585
7585
  o.name
7586
7586
  ))
7587
7587
  ] });
7588
- }, Ei = (s) => Array.isArray(s) ? s.join(", ") : To(s) ? Object.entries(s).map((t) => t.map((e) => JSON.stringify(e)).join(": ")).join(", ") : s instanceof Date ? s.toLocaleString() : s == null ? "" : "" + s, Mi = ({ location: s, direction: t, width: e, height: a, title: l, valueSet: r, onValueChange: i }) => {
7588
+ }, Mi = (s) => Array.isArray(s) ? s.join(", ") : To(s) ? Object.entries(s).map((t) => t.map((e) => JSON.stringify(e)).join(": ")).join(", ") : s instanceof Date ? s.toLocaleString() : s == null ? "" : "" + s, Ti = ({ location: s, direction: t, width: e, height: a, title: l, valueSet: r, onValueChange: i }) => {
7589
7589
  const n = rt(null), [o, d] = U(!1), [c, h] = U(!1), f = () => x.select(n.current);
7590
7590
  return Ct(() => {
7591
7591
  if (n.current)
@@ -7649,7 +7649,7 @@ const Ce = ({
7649
7649
  ]
7650
7650
  }
7651
7651
  ) });
7652
- }, Ti = 6, Ni = (s) => {
7652
+ }, Ni = 6, Pi = (s) => {
7653
7653
  const t = Ut($t), [e, a] = U(
7654
7654
  s.currentPalette || s.palettes[0]
7655
7655
  ), [l, r] = U(0), [i, n] = U(
@@ -7830,7 +7830,7 @@ const Ce = ({
7830
7830
  )
7831
7831
  ).attr("fill", u.backgroundColor).attr("stroke", "black").attr("stroke-width", "1px"), u.icon !== "" && b.append("image").attr("x", 0).attr("y", 0).attr("width", u.width).attr("height", u.height).attr("href", u.icon), u.label !== "" && b.append("text").attr(
7832
7832
  "transform",
7833
- `translate(${u.width / 2},${u.height / 2 + Ti})`
7833
+ `translate(${u.width / 2},${u.height / 2 + Ni})`
7834
7834
  ).attr("x", 0).attr("y", 0).attr("font-size", "20px").attr("text-anchor", "middle").attr("font-family", "'Wonder Unit Sans', sans-serif").attr("font-weight", 400).attr("fill", "#000000").attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(u.label);
7835
7835
  };
7836
7836
  return Ct(() => {
@@ -7878,7 +7878,7 @@ const Ce = ({
7878
7878
  ]
7879
7879
  }
7880
7880
  ) });
7881
- }, Pi = ({
7881
+ }, zi = ({
7882
7882
  location: s,
7883
7883
  direction: t,
7884
7884
  enableAction: e,
@@ -7984,7 +7984,7 @@ const Ce = ({
7984
7984
  ]
7985
7985
  }
7986
7986
  ) });
7987
- }, Oi = ({
7987
+ }, Hi = ({
7988
7988
  config: s,
7989
7989
  model: t,
7990
7990
  onCanvasCreated: e,
@@ -8009,7 +8009,7 @@ const Ce = ({
8009
8009
  }, u = {
8010
8010
  refreshPalette: () => {
8011
8011
  }
8012
- }, k = new Si(
8012
+ }, k = new Ci(
8013
8013
  (E) => f(E),
8014
8014
  (E) => m(E)
8015
8015
  ), b = {
@@ -8045,11 +8045,11 @@ const Ce = ({
8045
8045
  A.setValues(y.getValues()), A.rootElement = y.rootElement, k.valueSet = A, y.rootElement.valueSet = A, V.propertyEditorChanges$?.next();
8046
8046
  }
8047
8047
  };
8048
- return /* @__PURE__ */ v("daga-diagram", { children: /* @__PURE__ */ v(wi.Provider, { value: s, children: /* @__PURE__ */ v($t.Provider, { value: V, children: /* @__PURE__ */ M("daga-diagram-editor", { children: [
8048
+ return /* @__PURE__ */ v("daga-diagram", { children: /* @__PURE__ */ v(Si.Provider, { value: s, children: /* @__PURE__ */ v($t.Provider, { value: V, children: /* @__PURE__ */ M("daga-diagram-editor", { children: [
8049
8049
  /* @__PURE__ */ v("div", { className: "daga-append-to", ref: n }),
8050
8050
  /* @__PURE__ */ M($t.Provider, { value: V, children: [
8051
8051
  s.components?.buttons !== void 0 && s.components?.buttons?.enabled !== !1 && /* @__PURE__ */ v(
8052
- Pi,
8052
+ zi,
8053
8053
  {
8054
8054
  location: s.components?.buttons?.location || Zt.BottomRight,
8055
8055
  direction: s.components?.buttons?.direction || g.Top,
@@ -8061,7 +8061,7 @@ const Ce = ({
8061
8061
  }
8062
8062
  ),
8063
8063
  s.components?.palette !== void 0 && s.components?.palette?.enabled !== !1 && s.components?.palette?.sections && (s.components?.palette?.sections?.length || 0) > 0 && /* @__PURE__ */ v(
8064
- Ni,
8064
+ Pi,
8065
8065
  {
8066
8066
  location: s.components?.palette?.location || Zt.TopLeft,
8067
8067
  direction: s.components?.palette?.direction || g.Bottom,
@@ -8071,7 +8071,7 @@ const Ce = ({
8071
8071
  }
8072
8072
  ),
8073
8073
  s.components?.propertyEditor !== void 0 && s.components?.propertyEditor?.enabled !== !1 && /* @__PURE__ */ v(
8074
- Mi,
8074
+ Ti,
8075
8075
  {
8076
8076
  location: s.components?.propertyEditor?.location || Zt.TopRight,
8077
8077
  direction: s.components?.propertyEditor?.direction || g.Bottom,
@@ -8082,10 +8082,10 @@ const Ce = ({
8082
8082
  onValueChange: tt
8083
8083
  }
8084
8084
  ),
8085
- s.components?.errors !== void 0 && s.components?.errors?.enabled !== !1 && /* @__PURE__ */ v(Ci, {})
8085
+ s.components?.errors !== void 0 && s.components?.errors?.enabled !== !1 && /* @__PURE__ */ v($i, {})
8086
8086
  ] })
8087
8087
  ] }) }) }) });
8088
8088
  };
8089
8089
  export {
8090
- Oi as DagaDiagram
8090
+ Hi as DagaDiagram
8091
8091
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga-react",
3
- "version": "4.2.12",
3
+ "version": "4.2.13",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "style": "./style.css",
@@ -20,7 +20,7 @@
20
20
  "peerDependencies": {
21
21
  "react": "*",
22
22
  "react-dom": "*",
23
- "@metadev/daga": "^4.2.12",
23
+ "@metadev/daga": "^4.2.13",
24
24
  "d3": "^7.9.0",
25
25
  "rxjs": "~7.8.1"
26
26
  },