@genai-fi/base 4.0.5 → 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.
@@ -0,0 +1,50 @@
1
+ import { jsx as o, jsxs as g } from "react/jsx-runtime";
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
+ container: w,
6
+ annotation: _
7
+ }, y = 0.4, s = 40;
8
+ function $({ lines: e }) {
9
+ return /* @__PURE__ */ o(
10
+ "svg",
11
+ {
12
+ className: d.svglayer,
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "100%",
15
+ height: "100%",
16
+ "aria-hidden": !0,
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
+ return /* @__PURE__ */ g("g", { children: [
20
+ /* @__PURE__ */ o(
21
+ "path",
22
+ {
23
+ "data-testid": `line-${t.id1}-${t.id2}`,
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
+ fill: "none",
26
+ stroke: h ? "rgb(174, 37, 174)" : "#7C828D",
27
+ strokeWidth: "2",
28
+ strokeDasharray: h ? void 0 : "4 4"
29
+ },
30
+ r
31
+ ),
32
+ t.annotationElement && /* @__PURE__ */ o(
33
+ "foreignObject",
34
+ {
35
+ x: (t.x1 + t.x2) / 2 - (a - s) / 2,
36
+ y: (t.y1 + t.y2) / 2 - (a - s) / 2,
37
+ width: a - s,
38
+ height: a - s,
39
+ children: /* @__PURE__ */ o("div", { className: d.annotation, children: t.annotationElement })
40
+ }
41
+ )
42
+ ] }, `annotation-${r}`);
43
+ })
44
+ }
45
+ );
46
+ }
47
+ export {
48
+ $ as S,
49
+ d as s
50
+ };
@@ -1 +1 @@
1
- ._svglayer_yu6sc_3{position:absolute;left:0;top:0;pointer-events:none}._workspace_yu6sc_10{overflow:auto;max-width:100%;max-height:100%;height:100%;width:100%;position:relative}._container_yu6sc_19{overflow:auto;min-height:100%;background:#dfe5e8;display:grid;gap:3rem;padding:2rem;box-sizing:border-box;grid-template-columns:repeat(6,max-content);min-width:100%;width:max-content;justify-content:center;position:relative;align-items:center}@media only screen and (max-height: 500px),(max-width: 700px){._svglayer_yu6sc_3{display:none}._container_yu6sc_19{display:flex;flex-direction:column;padding:1rem 0;width:100%}}
1
+ ._svglayer_qfgw7_3{position:absolute;left:0;top:0;pointer-events:none}._workspace_qfgw7_10{overflow:auto;max-width:100%;max-height:100%;height:100%;width:100%;position:relative}._container_qfgw7_19{overflow:auto;min-height:100%;background:#dfe5e8;display:grid;gap:3rem;padding:2rem;box-sizing:border-box;grid-template-columns:repeat(6,max-content);min-width:100%;width:max-content;justify-content:center;position:relative;align-items:center}@media only screen and (max-height: 500px),(max-width: 700px){._svglayer_qfgw7_3{display:none}._container_qfgw7_19{display:flex;flex-direction:column;padding:1rem 0;width:100%}}._annotation_qfgw7_48{display:flex;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}
@@ -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-DQQ6Pb5G.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(() => {
@@ -6,6 +6,8 @@ export interface ILine {
6
6
  direction: 'horizontal' | 'vertical';
7
7
  id1: string;
8
8
  id2: string;
9
+ annotationElement?: React.ReactNode;
10
+ active?: boolean;
9
11
  }
10
12
  interface Props {
11
13
  lines: ILine[];
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { S as a } from "../../SvgLayer-DQQ6Pb5G.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-DQQ6Pb5G.js";
4
+ import { S as p } from "../../SvgLayer-DHFiKVQ9.js";
5
5
  export {
6
6
  p as SvgLayer,
7
7
  s as Widget,
@@ -5,13 +5,17 @@ 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';
11
12
  export interface IConnection {
12
13
  start: string;
13
14
  startPoint: ConnectionPoint;
15
+ startOffset?: number;
14
16
  end: string;
15
17
  endPoint: ConnectionPoint;
18
+ endOffset?: number;
19
+ annotationElement?: React.ReactNode;
16
20
  }
17
21
  export declare function generateLines(data: Map<string, INode[]>, connections: IConnection[]): ILine[];
@@ -1,39 +1,41 @@
1
- var d, f;
2
- const g = ((f = (d = globalThis == null ? void 0 : globalThis.process) == null ? void 0 : d.env) == null ? void 0 : f.NODE_ENV) === "test";
3
- function a(s, h) {
4
- var o;
5
- const n = h || /* @__PURE__ */ new Map();
6
- for (let r = 0; r < s.children.length; ++r) {
7
- const i = s.children[r], t = i.getAttribute("data-widget");
8
- if (t === "container")
9
- a(i, n);
10
- else if (t) {
11
- n.has(t) || n.set(t, []);
12
- const e = i.offsetWidth, c = i.offsetHeight;
13
- (g || e > 0 && c > 0) && ((o = n.get(t)) == null || o.push({ x: i.offsetLeft, y: i.offsetTop, width: e, height: c, id: i.id || "noid" }));
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
+ var t;
5
+ const n = f || /* @__PURE__ */ new Map();
6
+ for (let h = 0; h < s.children.length; ++h) {
7
+ const o = s.children[h], e = o.getAttribute("data-widget");
8
+ if (e === "container")
9
+ l(o, n);
10
+ else if (e) {
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
16
  return n;
17
17
  }
18
- function l(s, h) {
18
+ function u(s, f) {
19
19
  const n = [];
20
- for (const o of h) {
21
- const r = s.get(o.start) || [], i = s.get(o.end) || [];
22
- for (const t of r)
23
- for (const e of i)
20
+ for (const t of f) {
21
+ const h = s.get(t.start) || [], o = s.get(t.end) || [];
22
+ for (const e of h)
23
+ for (const i of o)
24
24
  n.push({
25
- id1: t.id,
26
- id2: e.id,
27
- x1: o.startPoint === "left" ? t.x : o.startPoint === "right" ? t.x + t.width : t.x + t.width / 2,
28
- x2: o.endPoint === "left" ? e.x : o.endPoint === "right" ? e.x + e.width : e.x + e.width / 2,
29
- y1: o.startPoint === "top" ? t.y : o.startPoint === "bottom" ? t.y + t.height : t.y + t.height / 2,
30
- y2: o.endPoint === "top" ? e.y : o.endPoint === "bottom" ? e.y + e.height : e.y + e.height / 2,
31
- direction: o.startPoint === "top" || o.startPoint === "bottom" ? "vertical" : "horizontal"
25
+ id1: e.id,
26
+ id2: i.id,
27
+ annotationElement: t.annotationElement,
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" ? i.x : t.endPoint === "right" ? i.x + i.width : i.x + i.width / 2 + (t.endOffset || 0) * (i.width / 2),
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" ? 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
32
34
  });
33
35
  }
34
36
  return n;
35
37
  }
36
38
  export {
37
- a as extractNodesFromElements,
38
- l as generateLines
39
+ l as extractNodesFromElements,
40
+ u as generateLines
39
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-DQQ6Pb5G.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.0.5",
3
+ "version": "4.1.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -1,37 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import './assets/SvgLayer.css';const d = "_svglayer_yu6sc_3", n = "_workspace_yu6sc_10", y = "_container_yu6sc_19", i = {
3
- svglayer: d,
4
- workspace: n,
5
- container: y
6
- }, a = 20;
7
- function h({ lines: c }) {
8
- return /* @__PURE__ */ o(
9
- "svg",
10
- {
11
- className: i.svglayer,
12
- xmlns: "http://www.w3.org/2000/svg",
13
- width: "100%",
14
- height: "100%",
15
- "aria-hidden": !0,
16
- children: c.map((t, e) => {
17
- const r = t.direction === "horizontal" ? a : 0, s = t.direction === "vertical" ? a : 0;
18
- return /* @__PURE__ */ o(
19
- "path",
20
- {
21
- "data-testid": `line-${t.id1}-${t.id2}`,
22
- d: `M ${t.x1} ${t.y1} C ${t.x1 + r} ${t.y1 + s}, ${t.x2 - r} ${t.y2 - s}, ${t.x2} ${t.y2}`,
23
- fill: "none",
24
- stroke: "rgb(174, 37, 174)",
25
- strokeWidth: "2",
26
- strokeDasharray: void 0
27
- },
28
- e
29
- );
30
- })
31
- }
32
- );
33
- }
34
- export {
35
- h as S,
36
- i as s
37
- };