@genai-fi/base 4.1.0 → 4.1.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.
@@ -1,21 +1,21 @@
1
1
  import { jsx as o, jsxs as g } from "react/jsx-runtime";
2
- import './assets/SvgLayer.css';const e = "_svglayer_qfgw7_3", x = "_workspace_qfgw7_10", w = "_container_qfgw7_19", _ = "_annotation_qfgw7_48", h = {
3
- svglayer: e,
4
- workspace: x,
2
+ import './assets/SvgLayer.css';const x = "_svglayer_qfgw7_3", i = "_workspace_qfgw7_10", w = "_container_qfgw7_19", _ = "_annotation_qfgw7_48", d = {
3
+ svglayer: x,
4
+ workspace: i,
5
5
  container: w,
6
6
  annotation: _
7
- }, d = 0.4, s = 40;
8
- function $({ lines: y }) {
7
+ }, y = 0.4, s = 40;
8
+ function $({ lines: e }) {
9
9
  return /* @__PURE__ */ o(
10
10
  "svg",
11
11
  {
12
- className: h.svglayer,
12
+ className: d.svglayer,
13
13
  xmlns: "http://www.w3.org/2000/svg",
14
14
  width: "100%",
15
15
  height: "100%",
16
16
  "aria-hidden": !0,
17
- children: y.map((t, r) => {
18
- const n = t.direction === "horizontal" ? Math.abs(t.x1 - t.x2) * d : 0, c = t.direction === "vertical" ? Math.abs(t.y1 - t.y2) * d : 0, a = Math.max(Math.abs(t.x1 - t.x2), Math.abs(t.y1 - t.y2));
17
+ children: e.map((t, r) => {
18
+ const n = t.direction === "horizontal" ? Math.abs(t.x1 - t.x2) * y : 0, c = t.direction === "vertical" ? Math.abs(t.y1 - t.y2) * y : 0, a = Math.max(Math.abs(t.x1 - t.x2), Math.abs(t.y1 - t.y2)), h = t.active;
19
19
  return /* @__PURE__ */ g("g", { children: [
20
20
  /* @__PURE__ */ o(
21
21
  "path",
@@ -23,9 +23,9 @@ function $({ lines: y }) {
23
23
  "data-testid": `line-${t.id1}-${t.id2}`,
24
24
  d: `M ${t.x1} ${t.y1} C ${t.x1 + n} ${t.y1 + c}, ${t.x2 - n} ${t.y2 - c}, ${t.x2} ${t.y2}`,
25
25
  fill: "none",
26
- stroke: "rgb(174, 37, 174)",
26
+ stroke: h ? "rgb(174, 37, 174)" : "#7C828D",
27
27
  strokeWidth: "2",
28
- strokeDasharray: void 0
28
+ strokeDasharray: h ? void 0 : "4 4"
29
29
  },
30
30
  r
31
31
  ),
@@ -36,7 +36,7 @@ function $({ lines: y }) {
36
36
  y: (t.y1 + t.y2) / 2 - (a - s) / 2,
37
37
  width: a - s,
38
38
  height: a - s,
39
- children: /* @__PURE__ */ o("div", { className: h.annotation, children: t.annotationElement })
39
+ children: /* @__PURE__ */ o("div", { className: d.annotation, children: t.annotationElement })
40
40
  }
41
41
  )
42
42
  ] }, `annotation-${r}`);
@@ -46,5 +46,5 @@ function $({ lines: y }) {
46
46
  }
47
47
  export {
48
48
  $ as S,
49
- h as s
49
+ d as s
50
50
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
2
2
  import { useState as p, useRef as l, useEffect as v } from "react";
3
3
  import { extractNodesFromElements as y, generateLines as g } from "./lines.js";
4
- import { s as u, S as h } from "../../SvgLayer-BWQvvvqo.js";
4
+ import { s as u, S as h } from "../../SvgLayer-DHFiKVQ9.js";
5
5
  function k({ children: n, connections: i }) {
6
6
  const [f, m] = p([]), r = l(null), t = l();
7
7
  return v(() => {
@@ -7,6 +7,7 @@ export interface ILine {
7
7
  id1: string;
8
8
  id2: string;
9
9
  annotationElement?: React.ReactNode;
10
+ active?: boolean;
10
11
  }
11
12
  interface Props {
12
13
  lines: ILine[];
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { S as a } from "../../SvgLayer-BWQvvvqo.js";
2
+ import { S as a } from "../../SvgLayer-DHFiKVQ9.js";
3
3
  export {
4
4
  a as default
5
5
  };
@@ -1,7 +1,7 @@
1
1
  import { default as r } from "./Layout.js";
2
2
  import { extractNodesFromElements as a, generateLines as f } from "./lines.js";
3
3
  import { Widget as s } from "./Widget.js";
4
- import { S as p } from "../../SvgLayer-BWQvvvqo.js";
4
+ import { S as p } from "../../SvgLayer-DHFiKVQ9.js";
5
5
  export {
6
6
  p as SvgLayer,
7
7
  s as Widget,
@@ -5,6 +5,7 @@ export interface INode {
5
5
  width: number;
6
6
  height: number;
7
7
  id: string;
8
+ active?: boolean;
8
9
  }
9
10
  export declare function extractNodesFromElements(div: HTMLElement, initial?: Map<string, INode[]>): Map<string, INode[]>;
10
11
  export type ConnectionPoint = 'left' | 'right' | 'top' | 'bottom';
@@ -1,40 +1,41 @@
1
- var d, c;
2
- const a = ((c = (d = globalThis == null ? void 0 : globalThis.process) == null ? void 0 : d.env) == null ? void 0 : c.NODE_ENV) === "test";
3
- function g(s, f) {
1
+ var a, d;
2
+ const g = ((d = (a = globalThis == null ? void 0 : globalThis.process) == null ? void 0 : a.env) == null ? void 0 : d.NODE_ENV) === "test";
3
+ function l(s, f) {
4
4
  var t;
5
- const i = f || /* @__PURE__ */ new Map();
5
+ const n = f || /* @__PURE__ */ new Map();
6
6
  for (let h = 0; h < s.children.length; ++h) {
7
- const n = s.children[h], e = n.getAttribute("data-widget");
7
+ const o = s.children[h], e = o.getAttribute("data-widget");
8
8
  if (e === "container")
9
- g(n, i);
9
+ l(o, n);
10
10
  else if (e) {
11
- i.has(e) || i.set(e, []);
12
- const o = n.offsetWidth, r = n.offsetHeight;
13
- (a || o > 0 && r > 0) && ((t = i.get(e)) == null || t.push({ x: n.offsetLeft, y: n.offsetTop, width: o, height: r, id: n.id || "noid" }));
11
+ n.has(e) || n.set(e, []);
12
+ const i = o.getAttribute("data-active") !== "false", r = o.offsetWidth, c = o.offsetHeight;
13
+ (g || r > 0 && c > 0) && ((t = n.get(e)) == null || t.push({ x: o.offsetLeft, y: o.offsetTop, width: r, height: c, id: o.id || "noid", active: i }));
14
14
  }
15
15
  }
16
- return i;
16
+ return n;
17
17
  }
18
- function l(s, f) {
19
- const i = [];
18
+ function u(s, f) {
19
+ const n = [];
20
20
  for (const t of f) {
21
- const h = s.get(t.start) || [], n = s.get(t.end) || [];
21
+ const h = s.get(t.start) || [], o = s.get(t.end) || [];
22
22
  for (const e of h)
23
- for (const o of n)
24
- i.push({
23
+ for (const i of o)
24
+ n.push({
25
25
  id1: e.id,
26
- id2: o.id,
26
+ id2: i.id,
27
27
  annotationElement: t.annotationElement,
28
28
  x1: t.startPoint === "left" ? e.x : t.startPoint === "right" ? e.x + e.width : e.x + e.width / 2 + (t.startOffset || 0) * (e.width / 2),
29
- x2: t.endPoint === "left" ? o.x : t.endPoint === "right" ? o.x + o.width : o.x + o.width / 2 + (t.endOffset || 0) * (o.width / 2),
29
+ x2: t.endPoint === "left" ? i.x : t.endPoint === "right" ? i.x + i.width : i.x + i.width / 2 + (t.endOffset || 0) * (i.width / 2),
30
30
  y1: t.startPoint === "top" ? e.y : t.startPoint === "bottom" ? e.y + e.height : e.y + e.height / 2 + (t.startOffset || 0) * (e.height / 2),
31
- y2: t.endPoint === "top" ? o.y : t.endPoint === "bottom" ? o.y + o.height : o.y + o.height / 2 + (t.endOffset || 0) * (o.height / 2),
32
- direction: t.startPoint === "top" || t.startPoint === "bottom" ? "vertical" : "horizontal"
31
+ y2: t.endPoint === "top" ? i.y : t.endPoint === "bottom" ? i.y + i.height : i.y + i.height / 2 + (t.endOffset || 0) * (i.height / 2),
32
+ direction: t.startPoint === "top" || t.startPoint === "bottom" ? "vertical" : "horizontal",
33
+ active: e.active && i.active
33
34
  });
34
35
  }
35
- return i;
36
+ return n;
36
37
  }
37
38
  export {
38
- g as extractNodesFromElements,
39
- l as generateLines
39
+ l as extractNodesFromElements,
40
+ u as generateLines
40
41
  };
package/dist/main.js CHANGED
@@ -20,7 +20,7 @@ import { default as J } from "./components/ContentLoader/ContentLoader.js";
20
20
  import { default as X } from "./components/WorkflowLayout/Layout.js";
21
21
  import { extractNodesFromElements as _, generateLines as $ } from "./components/WorkflowLayout/lines.js";
22
22
  import { Widget as re } from "./components/WorkflowLayout/Widget.js";
23
- import { S as ae } from "./SvgLayer-BWQvvvqo.js";
23
+ import { S as ae } from "./SvgLayer-DHFiKVQ9.js";
24
24
  import { default as fe } from "./components/LangSelect/LangSelect.js";
25
25
  import { default as se } from "./components/IconMenu/Spacer.js";
26
26
  import { default as ue } from "./components/IconMenu/IconMenu.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/base",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",