@genai-fi/base 4.0.0 → 4.0.2
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/README.md +6 -9
- package/dist/{DialogQR-CyZcX7ul.js → DialogQR-wJru73YO.js} +3 -2
- package/dist/{SvgLayer-CA0elY7q.js → SvgLayer-DQQ6Pb5G.js} +12 -11
- package/dist/assets/Widget.css +1 -1
- package/dist/components/QRCode/DialogQR.js +3 -2
- package/dist/components/QRCode/QRCode.js +1 -1
- package/dist/components/WorkflowLayout/Layout.js +24 -23
- package/dist/components/WorkflowLayout/SvgLayer.js +1 -1
- package/dist/components/WorkflowLayout/Widget.d.ts +2 -1
- package/dist/components/WorkflowLayout/Widget.js +901 -893
- package/dist/components/WorkflowLayout/index.d.ts +2 -1
- package/dist/components/WorkflowLayout/index.js +9 -4
- package/dist/components/WorkflowLayout/lines.js +15 -13
- package/dist/hooks/peer.js +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +41 -36
- package/dist/services/peer2peer/Peer2Peer.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
# Introduction
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
2
3
|
[Generation AI](https://www.generation-ai-stn.fi) base code library for all common components of our educational apps.
|
|
3
4
|
|
|
4
5
|
# Getting Started
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
|
-
npm install @
|
|
8
|
+
npm install @genai-fi/base
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
import { ConnectionMonitor } from '@knicos/genai-base';
|
|
11
|
-
|
|
12
|
-
function MyComponent() {
|
|
13
|
-
return <ConnectionMonitor />;
|
|
14
|
-
}
|
|
15
|
-
```
|
|
11
|
+
See the Ladle stories in the `src` folder.
|
|
16
12
|
|
|
17
13
|
# Build and Test
|
|
14
|
+
|
|
18
15
|
Use `npm run build` to build the library in the `dist` folder. Testing uses vitest with `npm test`.
|
|
@@ -12,6 +12,7 @@ import "./style/theme.js";
|
|
|
12
12
|
import "./util/canvas.js";
|
|
13
13
|
import "./FileSaver.min-DhePf63e.js";
|
|
14
14
|
import "./components/BusyButton/BusyButton.js";
|
|
15
|
+
import "./components/WorkflowLayout/lines.js";
|
|
15
16
|
import "./components/WorkflowLayout/Widget.js";
|
|
16
17
|
import "./components/IconMenu/context.js";
|
|
17
18
|
import "@emotion/react";
|
|
@@ -1567,7 +1568,7 @@ const ze = /* @__PURE__ */ le(ke), Ve = "_link_1udre_3", He = "_container_1udre_
|
|
|
1567
1568
|
}, Ye = me(/* @__PURE__ */ U("path", {
|
|
1568
1569
|
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
|
|
1569
1570
|
}), "ContentCopy");
|
|
1570
|
-
function
|
|
1571
|
+
function fn({ url: r, open: o, onClose: i }) {
|
|
1571
1572
|
var s;
|
|
1572
1573
|
const { t: n } = he("translation"), t = ue(null), e = ae(() => {
|
|
1573
1574
|
navigator.clipboard.writeText(r);
|
|
@@ -1624,7 +1625,7 @@ function ln({ url: r, open: o, onClose: i }) {
|
|
|
1624
1625
|
);
|
|
1625
1626
|
}
|
|
1626
1627
|
export {
|
|
1627
|
-
|
|
1628
|
+
fn as D,
|
|
1628
1629
|
ze as q,
|
|
1629
1630
|
je as s
|
|
1630
1631
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import './assets/SvgLayer.css';const
|
|
3
|
-
svglayer:
|
|
4
|
-
workspace:
|
|
5
|
-
container:
|
|
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
6
|
}, a = 20;
|
|
7
|
-
function
|
|
7
|
+
function h({ lines: c }) {
|
|
8
8
|
return /* @__PURE__ */ o(
|
|
9
9
|
"svg",
|
|
10
10
|
{
|
|
11
|
-
className:
|
|
11
|
+
className: i.svglayer,
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
13
|
width: "100%",
|
|
14
14
|
height: "100%",
|
|
15
15
|
"aria-hidden": !0,
|
|
16
|
-
children: c.map((
|
|
17
|
-
const
|
|
16
|
+
children: c.map((t, e) => {
|
|
17
|
+
const r = t.direction === "horizontal" ? a : 0, s = t.direction === "vertical" ? a : 0;
|
|
18
18
|
return /* @__PURE__ */ o(
|
|
19
19
|
"path",
|
|
20
20
|
{
|
|
21
|
-
|
|
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}`,
|
|
22
23
|
fill: "none",
|
|
23
24
|
stroke: "rgb(174, 37, 174)",
|
|
24
25
|
strokeWidth: "2",
|
|
@@ -31,6 +32,6 @@ function i({ lines: c }) {
|
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
34
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
h as S,
|
|
36
|
+
i as s
|
|
36
37
|
};
|
package/dist/assets/Widget.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._widget_9aoli_3{background:#fff;border-radius:6px;padding:0;display:flex;flex-direction:column;box-shadow:2px 2px 4px #bbb;flex-shrink:0;animation:_fadein_9aoli_1 .5s 1;box-sizing:border-box;position:relative;overflow:hidden}@media only screen and (max-height: 500px),(max-width: 700px){._widget_9aoli_3{max-width:100%}}@keyframes _fadein_9aoli_1{0%{opacity:.1}to{opacity:1}}._widgetDisabled_9aoli_33{pointer-events:none;opacity:.5}._widgetActive_9aoli_39{border:1px dashed #008297}._widget_title_9aoli_44{font-size:14pt;font-weight:700;margin:0}._widget_header_9aoli_50{display:flex;justify-content:left;padding:.6rem 1rem;align-items:center}._widget_header_9aoli_50 input{padding:.2rem;height:initial;box-sizing:border-box;border:2px solid transparent;cursor:pointer;margin-right:1rem}._widget_header_9aoli_50 input:focus{border:2px solid #008297;border-radius:5px;cursor:initial}._widget_header_9aoli_50 fieldset{border:none}._widget_menu_9aoli_77{flex-grow:1;text-align:right}._widget_content_9aoli_82{padding:1rem;display:flex;flex-direction:column}._widget_content_9aoli_82>p{color:#444;font-size:12pt;margin:1rem 1.4rem}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { D as
|
|
3
|
+
import { D as h } from "../../DialogQR-wJru73YO.js";
|
|
4
4
|
import "@mui/material";
|
|
5
5
|
import "react-i18next";
|
|
6
6
|
import "../../state/webrtcState.js";
|
|
@@ -11,9 +11,10 @@ import "../../style/theme.js";
|
|
|
11
11
|
import "../../util/canvas.js";
|
|
12
12
|
import "../../FileSaver.min-DhePf63e.js";
|
|
13
13
|
import "../BusyButton/BusyButton.js";
|
|
14
|
+
import "../WorkflowLayout/lines.js";
|
|
14
15
|
import "../WorkflowLayout/Widget.js";
|
|
15
16
|
import "../IconMenu/context.js";
|
|
16
17
|
import "@emotion/react";
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
h as default
|
|
19
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as h, useState as m, useEffect as u, Suspense as v } from "react";
|
|
3
|
-
import { q as p, s as o, D as b } from "../../DialogQR-
|
|
3
|
+
import { q as p, s as o, D as b } from "../../DialogQR-wJru73YO.js";
|
|
4
4
|
function q({ url: a, size: r, code: c, label: l, dialog: d }) {
|
|
5
5
|
const t = h(null), [f, n] = m(!1);
|
|
6
6
|
return u(() => {
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { extractNodesFromElements as
|
|
4
|
-
import { s as
|
|
5
|
-
function
|
|
6
|
-
const [
|
|
7
|
-
return
|
|
1
|
+
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as l, useEffect as v } from "react";
|
|
3
|
+
import { extractNodesFromElements as y, generateLines as g } from "./lines.js";
|
|
4
|
+
import { s as u, S as h } from "../../SvgLayer-DQQ6Pb5G.js";
|
|
5
|
+
function k({ children: n, connections: i }) {
|
|
6
|
+
const [f, m] = p([]), r = l(null), t = l();
|
|
7
|
+
return v(() => {
|
|
8
8
|
if (r.current) {
|
|
9
|
-
s
|
|
9
|
+
const s = () => {
|
|
10
10
|
if (r.current) {
|
|
11
|
-
const e =
|
|
12
|
-
|
|
11
|
+
const e = y(r.current), c = g(e, i);
|
|
12
|
+
m(c);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
};
|
|
15
|
+
t.current = new ResizeObserver(s), t.current.observe(r.current);
|
|
16
|
+
const o = r.current.children;
|
|
17
|
+
if (o)
|
|
18
|
+
for (let e = 0; e < o.length; ++e) {
|
|
19
|
+
const c = o[e];
|
|
20
|
+
t.current.observe(c);
|
|
20
21
|
}
|
|
21
|
-
return () => {
|
|
22
|
+
return s(), () => {
|
|
22
23
|
var e;
|
|
23
|
-
(e =
|
|
24
|
+
(e = t.current) == null || e.disconnect();
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
}, [
|
|
27
|
+
}, [i]), /* @__PURE__ */ a("div", { className: u.workspace, children: /* @__PURE__ */ d(
|
|
27
28
|
"div",
|
|
28
29
|
{
|
|
29
|
-
className:
|
|
30
|
+
className: u.container,
|
|
30
31
|
ref: r,
|
|
31
32
|
style: {
|
|
32
|
-
gridTemplateColumns: `repeat(${Array.isArray(n) ? n.filter((
|
|
33
|
+
gridTemplateColumns: `repeat(${Array.isArray(n) ? n.filter((s) => !!s).length : 1}, max-content)`
|
|
33
34
|
},
|
|
34
35
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ a(h, { lines: f }),
|
|
36
37
|
n
|
|
37
38
|
]
|
|
38
39
|
}
|
|
39
40
|
) });
|
|
40
41
|
}
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
k as default
|
|
43
44
|
};
|
|
@@ -13,6 +13,7 @@ interface Props extends React.HTMLProps<HTMLDivElement> {
|
|
|
13
13
|
id?: string;
|
|
14
14
|
noPadding?: boolean;
|
|
15
15
|
contentStyle?: CSSProperties;
|
|
16
|
+
headerColour?: string;
|
|
16
17
|
}
|
|
17
|
-
export declare function Widget({ disabled, focus, title, setTitle, children, menu, className, hidden, dataWidget, id, noPadding, active, contentStyle, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function Widget({ disabled, focus, title, setTitle, children, menu, className, hidden, dataWidget, id, noPadding, active, contentStyle, headerColour, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export {};
|