chatbot-editor 1.0.0
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/.github/workflows/npm-publish.yml +21 -0
- package/dist/App.d.ts +10 -0
- package/dist/App.js +22 -0
- package/dist/App.js.map +1 -0
- package/dist/Canva.d.ts +11 -0
- package/dist/Canva.js +10 -0
- package/dist/Canva.js.map +1 -0
- package/dist/Components/Answers.d.ts +8 -0
- package/dist/Components/Answers.js +18 -0
- package/dist/Components/Answers.js.map +1 -0
- package/dist/Components/Arrow.d.ts +13 -0
- package/dist/Components/Arrow.js +54 -0
- package/dist/Components/Arrow.js.map +1 -0
- package/dist/Components/Bubble.d.ts +6 -0
- package/dist/Components/Bubble.js +5 -0
- package/dist/Components/Bubble.js.map +1 -0
- package/dist/Components/Button.d.ts +9 -0
- package/dist/Components/Button.js +5 -0
- package/dist/Components/Button.js.map +1 -0
- package/dist/Components/Input.d.ts +12 -0
- package/dist/Components/Input.js +12 -0
- package/dist/Components/Input.js.map +1 -0
- package/dist/Components/Question.d.ts +18 -0
- package/dist/Components/Question.js +93 -0
- package/dist/Components/Question.js.map +1 -0
- package/dist/Components/Select.d.ts +13 -0
- package/dist/Components/Select.js +24 -0
- package/dist/Components/Select.js.map +1 -0
- package/dist/Components/SideBar.d.ts +12 -0
- package/dist/Components/SideBar.js +18 -0
- package/dist/Components/SideBar.js.map +1 -0
- package/dist/CurrentQuestionHook.d.ts +10 -0
- package/dist/CurrentQuestionHook.js +12 -0
- package/dist/CurrentQuestionHook.js.map +1 -0
- package/dist/TQuestion.d.ts +23 -0
- package/dist/TQuestion.js +2 -0
- package/dist/TQuestion.js.map +1 -0
- package/dist/UI.d.ts +20 -0
- package/dist/UI.js +116 -0
- package/dist/UI.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +108 -0
- package/dist/main.js.map +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/eslint.config.js +26 -0
- package/index.html +12 -0
- package/package.json +38 -0
- package/src/App.tsx +43 -0
- package/src/Canva.tsx +23 -0
- package/src/Components/Answers.tsx +27 -0
- package/src/Components/Arrow.tsx +60 -0
- package/src/Components/Bubble.tsx +13 -0
- package/src/Components/Button.tsx +14 -0
- package/src/Components/Input.tsx +25 -0
- package/src/Components/Question.tsx +104 -0
- package/src/Components/Select.tsx +45 -0
- package/src/Components/SideBar.tsx +31 -0
- package/src/CurrentQuestionHook.tsx +22 -0
- package/src/TQuestion.ts +23 -0
- package/src/UI.tsx +138 -0
- package/src/index.ts +7 -0
- package/src/main.tsx +114 -0
- package/src/utils.ts +3 -0
- package/tsconfig.app.json +28 -0
- package/tsconfig.json +16 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +8 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: publish on npm
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types:
|
|
5
|
+
- published
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish-npm:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-node@v4
|
|
13
|
+
with:
|
|
14
|
+
node version: 20
|
|
15
|
+
registry-url: https://registry.npmjs.org/
|
|
16
|
+
- run: npm install
|
|
17
|
+
- run: npm version ${{ github.event.release.name }} --git-tag-version=false
|
|
18
|
+
- run: npm run build
|
|
19
|
+
- run: npm publish
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type TQuestion from "./TQuestion.ts";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface AppProps {
|
|
4
|
+
save?: (questions: TQuestion[]) => void;
|
|
5
|
+
load?: () => Promise<TQuestion[]>;
|
|
6
|
+
export?: (questions: TQuestion[]) => void;
|
|
7
|
+
import?: () => Promise<TQuestion[]>;
|
|
8
|
+
}
|
|
9
|
+
export default function App(props: AppProps): React.JSX.Element;
|
|
10
|
+
export {};
|
package/dist/App.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import UI from "./UI";
|
|
2
|
+
import Canva from "./Canva";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { CurrentQuestionProvider } from "./CurrentQuestionHook";
|
|
5
|
+
import React from "react";
|
|
6
|
+
export default function App(props) {
|
|
7
|
+
const [questions, setQuestions] = useState([]);
|
|
8
|
+
const [reloadArrow, setReloadArrow] = useState(false);
|
|
9
|
+
return (React.createElement(CurrentQuestionProvider, null,
|
|
10
|
+
React.createElement("div", { className: "relative h-screen w-screen overflow-hidden" },
|
|
11
|
+
React.createElement(Canva, { questions: questions, setQuestions: setQuestions, reloadArrow: reloadArrow, setReloadArrow: setReloadArrow }),
|
|
12
|
+
React.createElement(UI, { setReloadArrow: setReloadArrow, questions: questions, addQuestion: (initPos) => {
|
|
13
|
+
let idQuestion = "question";
|
|
14
|
+
let i = 0;
|
|
15
|
+
while (questions.find(v => v.id === idQuestion)) {
|
|
16
|
+
i++;
|
|
17
|
+
idQuestion = `question${i}`;
|
|
18
|
+
}
|
|
19
|
+
setQuestions(prev => [...prev, { id: idQuestion, text: "Text", position: initPos }]);
|
|
20
|
+
}, editQuestion: (id, data) => setQuestions(prev => prev.map(v => v.id === id ? data : v)), deleteQuestion: id => setQuestions(prev => prev.filter(v => v.id !== id)), setQuestions: setQuestions, save: props.save, load: props.load, export: props.export, import: props.import }))));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=App.js.map
|
package/dist/App.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA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,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAE3D,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EACzE,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,GACnB,CACG,CACmB,CAC1B,CAAA;AACF,CAAC"}
|
package/dist/Canva.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type TQuestion from "./TQuestion.ts";
|
|
3
|
+
import type { SetState } from "./utils.ts";
|
|
4
|
+
interface CanvaProps {
|
|
5
|
+
questions: TQuestion[];
|
|
6
|
+
setQuestions: SetState<TQuestion[]>;
|
|
7
|
+
reloadArrow: boolean;
|
|
8
|
+
setReloadArrow: SetState<boolean>;
|
|
9
|
+
}
|
|
10
|
+
export default function Canva(props: CanvaProps): React.JSX.Element;
|
|
11
|
+
export {};
|
package/dist/Canva.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Question from "./Components/Question";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
export default function Canva(props) {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
props.setReloadArrow(prev => !prev);
|
|
7
|
+
}, [props.questions, props.setReloadArrow]);
|
|
8
|
+
return (React.createElement("div", { className: "min-w-full min-h-full bg-neutral-950 workspace overflow-auto" }, props.questions.map((v, i) => React.createElement(Question, { ...v, key: i, reloadArrow: props.reloadArrow, setReloadArrow: props.setReloadArrow }))));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Canva.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canva.js","sourceRoot":"","sources":["../src/Canva.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAG7C,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAShC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAiB;IAC9C,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAC5C,OAAO,CACN,6BAAK,SAAS,EAAE,8DAA8D,IAC5E,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAC,QAAQ,OAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,GAAG,CAAC,CAC3H,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Arrow from "./Arrow";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { CiWarning } from "react-icons/ci";
|
|
5
|
+
export default function Answers(props) {
|
|
6
|
+
const container = useRef(null);
|
|
7
|
+
const [pos, setPos] = useState({ x: 0, y: 0 });
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setPos(container.current.getBoundingClientRect());
|
|
10
|
+
}, [props.reloadArrows]);
|
|
11
|
+
const destPos = useMemo(() => {
|
|
12
|
+
return document.getElementById(props.next)?.getBoundingClientRect();
|
|
13
|
+
}, [props.next, props.reloadArrows]);
|
|
14
|
+
return (React.createElement("div", { className: "rounded bg-stone-700 w-16 px-2 py-1 text-nowrap text-ellipsis relative", ref: container },
|
|
15
|
+
React.createElement("p", { className: "text-ellipsis text-nowrap overflow-hidden max-w-full", title: props.text }, props.text),
|
|
16
|
+
destPos && React.createElement(Arrow, { from: { x: 64, y: 16 }, to: { x: destPos.x - pos.x - 1, y: destPos.y - pos.y + 20 } }) || React.createElement(CiWarning, { className: "text-orange-500 absolute -right-5 top-2" })));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=Answers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Answers.js","sourceRoot":"","sources":["../../src/Components/Answers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAQzC,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IAClD,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,SAAS,CAAC,OAAQ,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACpD,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,OAAO,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACrE,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IACrC,OAAO,CACN,6BAAK,SAAS,EAAE,wEAAwE,EAAE,GAAG,EAAE,SAAS;QACvG,2BAAG,SAAS,EAAE,sDAAsD,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAG,KAAK,CAAC,IAAI,CAAK;QACxG,OAAO,IAAI,oBAAC,KAAK,IAAC,IAAI,EAAE,EAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAC,EAAE,EAAE,EAAE,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,EAAC,GAAG,IAAI,oBAAC,SAAS,IAAC,SAAS,EAAE,yCAAyC,GAAG,CACtK,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useMemo, useRef } from "react";
|
|
3
|
+
export default function Arrow(props) {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
const [width, height] = useMemo(() => [
|
|
6
|
+
Math.abs(props.from.x - props.to.x) + (props.from.x + 20 <= props.to.x - 20 ? 0 : 40),
|
|
7
|
+
Math.abs(props.from.y - props.to.y)
|
|
8
|
+
], [props.from, props.to]);
|
|
9
|
+
const [start] = useMemo(() => [
|
|
10
|
+
{ x: props.from.x + 20 < props.to.x - 20 ? 0 : -20, y: 0 }
|
|
11
|
+
], [props.from, props.to]);
|
|
12
|
+
const [left, top] = useMemo(() => [
|
|
13
|
+
props.from.x + 20 <= props.to.x - 20 ? props.from.x : props.to.x - 20,
|
|
14
|
+
props.from.y < props.to.y ? props.from.y : props.to.y
|
|
15
|
+
], [props.from, props.to]);
|
|
16
|
+
const [from, to] = useMemo(() => [
|
|
17
|
+
{ x: props.from.x + 20 < props.to.x - 20 ? 0 : (props.from.x < props.to.x ? (props.from.x === props.to.x ? 0 : -20) : width - 40), y: props.from.y < props.to.y ? 0 : height },
|
|
18
|
+
{ x: props.from.x + 20 < props.to.x - 20 ? width : (props.from.x + 20 === props.to.x - 20 ? 20 : 0), y: props.from.y < props.to.y ? height : 0 },
|
|
19
|
+
], [props.from, props.to, width, height]);
|
|
20
|
+
const path = useMemo(() => {
|
|
21
|
+
let p = `M${from.x} ${from.y} L${from.x + 16} ${from.y}`;
|
|
22
|
+
if (from.x + 20 < to.x - 20) {
|
|
23
|
+
if (from.y < to.y) {
|
|
24
|
+
p += ` L${(to.x - from.x) / 2 - 4} ${from.y} Q${(to.x - from.x) / 2 - 4} ${from.y} ${(to.x - from.x) / 2} ${from.y + 4} L${(to.x - from.x) / 2} ${to.y - 4} Q${(to.x - from.x) / 2} ${to.y - 4} ${(to.x - from.x) / 2 + 4} ${to.y}`;
|
|
25
|
+
}
|
|
26
|
+
else if (from.y > to.y) {
|
|
27
|
+
p += ` L${(to.x - from.x) / 2 - 4} ${from.y} Q${(to.x - from.x) / 2 - 4} ${from.y} ${(to.x - from.x) / 2} ${from.y - 4} L${(to.x - from.x) / 2} ${to.y + 4} Q${(to.x - from.x) / 2} ${to.y + 4} ${(to.x - from.x) / 2 + 4} ${to.y}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (from.x + 20 > to.x - 20) {
|
|
31
|
+
if (from.y < to.y) {
|
|
32
|
+
p += ` Q${from.x + 16} ${from.y} ${from.x + 20} ${from.y + 4} L${from.x + 20} ${to.y - 44} Q${from.x + 20} ${to.y - 44} ${from.x + 16} ${to.y - 40} L${to.x - 16} ${to.y - 40} Q${to.x - 16} ${to.y - 40} ${to.x - 20} ${to.y - 36}`;
|
|
33
|
+
p += ` L${to.x - 20} ${to.y - 4} Q${to.x - 20} ${to.y - 4} ${to.x - 16} ${to.y}`;
|
|
34
|
+
}
|
|
35
|
+
else if (from.y > to.y) {
|
|
36
|
+
p += ` Q${from.x + 16} ${from.y} ${from.x + 20} ${from.y - 4} L${from.x + 20} ${from.y - 36} Q${from.x + 20} ${from.y - 36} ${from.x + 16} ${from.y - 40} L${to.x - 16} ${from.y - 40} Q${to.x - 16} ${from.y - 40} ${to.x - 20} ${from.y - 44}`;
|
|
37
|
+
p += ` L${to.x - 20} ${to.y + 4} Q${to.x - 20} ${to.y + 4} ${to.x - 16} ${to.y}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (from.y < to.y) {
|
|
42
|
+
p += ` Q${from.x + 16} ${from.y} ${from.x + 20} ${from.y + 4} L${from.x + 20} ${to.y - 4} Q${from.x + 20} ${to.y - 4} ${from.x + 24} ${to.y}`;
|
|
43
|
+
}
|
|
44
|
+
else if (from.y > to.y) {
|
|
45
|
+
p += ` Q${from.x + 16} ${from.y} ${from.x + 20} ${from.y - 4} L${from.x + 20} ${to.y + 4} Q${from.x + 20} ${to.y + 4} ${from.x + 24} ${to.y}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
p += ` L${to.x} ${to.y}`;
|
|
49
|
+
return p;
|
|
50
|
+
}, [from, to]);
|
|
51
|
+
return (React.createElement("svg", { ref: ref, viewBox: `${start.x} ${start.y} ${width} ${height}`, width: width, height: height, className: "absolute -z-20 stroke-stone-600 pointer-events-none", style: { left: left, top: top } },
|
|
52
|
+
React.createElement("path", { d: path, fill: "none", strokeWidth: "2" })));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=Arrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Arrow.js","sourceRoot":"","sources":["../../src/Components/Arrow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAOtC,MAAM,CAAC,OAAO,UAAU,K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xB,OAAO,CAAC,CAAC;IACV,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACf,OAAO,CACN,6BAAK,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,qDAAqD,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAC;QAChM,8BAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAC3C,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bubble.js","sourceRoot":"","sources":["../../src/Components/Bubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAkB;IAChD,OAAO,CACN,6BAAK,SAAS,EAAE,gDAAgD,IAC9D,KAAK,CAAC,IAAI,CACN,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
7
|
+
}
|
|
8
|
+
export default function Button(props: ButtonProps): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function Button(props) {
|
|
3
|
+
return (React.createElement("button", { className: "bg-stone-800 rounded-lg py-1 px-2 text-lg cursor-pointer transition hover:scale-105 disabled:hover:scale-100 disabled:cursor-default disabled:text-stone-400 disabled:bg-neutral-800", onClick: props.onClick, disabled: props.disabled }, props.children));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/Components/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAkB;IAChD,OAAO,CACN,gCAAQ,SAAS,EAAE,sLAAsL,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAG,KAAK,CAAC,QAAQ,CAAU,CACtR,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface InputProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
|
+
type?: React.HTMLInputTypeAttribute;
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function Input(props: InputProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
export default function Input(props) {
|
|
5
|
+
const id = useMemo(() => {
|
|
6
|
+
return props.id ?? (Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15));
|
|
7
|
+
}, [props.id]);
|
|
8
|
+
return (React.createElement("div", { className: clsx("flex flex-col", props.className) },
|
|
9
|
+
props.label && React.createElement("label", { className: clsx("px-2 pt-1 rounded-t-lg pb-2 -mb-2", props.disabled === true && "text-stone-500 bg-neutral-950" || "bg-stone-950"), htmlFor: id }, props.label),
|
|
10
|
+
React.createElement("input", { type: props.type, value: props.value, onChange: props.onChange, id: id, className: "bg-stone-800 rounded-lg py-1 px-2 text-lg disabled:bg-neutral-900", disabled: props.disabled })));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/Components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAY1B,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAiB;IAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;QACvB,OAAO,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAChH,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACf,OAAO,CACN,6BAAK,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;QACpD,KAAK,CAAC,KAAK,IAAI,+BAAO,SAAS,EAAE,IAAI,CAAC,mCAAmC,EAAE,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,+BAA+B,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,IAAG,KAAK,CAAC,KAAK,CAAS;QAC7L,+BAAO,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,mEAAmE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,CACrL,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SetState } from "../utils.ts";
|
|
3
|
+
import type { TAction, TAnswers } from "../TQuestion.ts";
|
|
4
|
+
interface QuestionProps {
|
|
5
|
+
id: string;
|
|
6
|
+
text: string | string[];
|
|
7
|
+
goto?: string;
|
|
8
|
+
answers?: TAnswers[];
|
|
9
|
+
action?: TAction;
|
|
10
|
+
reloadArrow: boolean;
|
|
11
|
+
setReloadArrow: SetState<boolean>;
|
|
12
|
+
position: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default function Question(props: QuestionProps): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import Bubble from "./Bubble";
|
|
3
|
+
import Answers from "./Answers";
|
|
4
|
+
import { useCurrentQuestion } from "../CurrentQuestionHook";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import Arrow from "./Arrow";
|
|
7
|
+
import { CiWarning } from "react-icons/ci";
|
|
8
|
+
export default function Question(props) {
|
|
9
|
+
const container = useRef(null);
|
|
10
|
+
const [position, setPosition] = useState(props.position);
|
|
11
|
+
const [clicked, setClicked] = useState(false);
|
|
12
|
+
const [, setOpen] = useState(false);
|
|
13
|
+
const [, setQuestion] = useCurrentQuestion();
|
|
14
|
+
const onMouseDown = useCallback((e) => {
|
|
15
|
+
if (e.button !== 0)
|
|
16
|
+
return;
|
|
17
|
+
setClicked(true);
|
|
18
|
+
setOpen(true);
|
|
19
|
+
}, []);
|
|
20
|
+
const onMouseUp = useCallback((e) => {
|
|
21
|
+
if (e.button !== 0)
|
|
22
|
+
return;
|
|
23
|
+
if (e.target !== container.current && (container.current && !container.current.contains(e.target)))
|
|
24
|
+
return;
|
|
25
|
+
setClicked(false);
|
|
26
|
+
setOpen(prev => {
|
|
27
|
+
if (prev) {
|
|
28
|
+
setQuestion(props);
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
});
|
|
32
|
+
}, [props, setQuestion]);
|
|
33
|
+
const onMouseMove = useCallback((e) => {
|
|
34
|
+
setOpen(false);
|
|
35
|
+
setPosition(prev => {
|
|
36
|
+
return {
|
|
37
|
+
x: prev.x + e.movementX,
|
|
38
|
+
y: prev.y + e.movementY
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
props.setReloadArrow(prev => !prev);
|
|
42
|
+
}, [setPosition, props]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (clicked) {
|
|
45
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
46
|
+
}
|
|
47
|
+
return () => {
|
|
48
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
49
|
+
};
|
|
50
|
+
}, [clicked, onMouseMove]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
53
|
+
return () => document.removeEventListener("mouseup", onMouseUp);
|
|
54
|
+
}, [onMouseUp]);
|
|
55
|
+
const gotoPosition = useMemo(() => {
|
|
56
|
+
let pos = undefined;
|
|
57
|
+
if (props.goto || props.action?.goto) {
|
|
58
|
+
const toElement = document.getElementById(props.goto ?? props.action?.goto ?? "");
|
|
59
|
+
if (toElement) {
|
|
60
|
+
pos = { x: toElement.offsetLeft, y: toElement.offsetTop };
|
|
61
|
+
pos.x -= (position.x - position.x % 20);
|
|
62
|
+
pos.y -= (position.y - position.y % 20);
|
|
63
|
+
pos.y += 18;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
pos = undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return pos;
|
|
70
|
+
}, [props.goto, props.action?.goto, position, props.reloadArrow]);
|
|
71
|
+
return (React.createElement("div", { id: props.id, className: "w-50 h-64 bg-stone-900 border border-neutral-400/20 rounded z-10 absolute flex flex-col gap-1 pb-1", style: { top: position.y - (position.y % 20), left: position.x - (position.x % 20) }, onMouseDown: onMouseDown, ref: container },
|
|
72
|
+
React.createElement("h2", { title: props.id, className: "text-stone-100 m-1 min-h-8 bg-neutral-900 px-2 py-1 font-mono overflow-hidden text-ellipsis" }, props.id),
|
|
73
|
+
React.createElement("div", { className: "p-1 flex flex-col gap-1 max-h-32 overflow-x-hidden overflow-y-auto" }, typeof props.text === "string" ? React.createElement(Bubble, { text: props.text }) : props.text.map((v, i) => React.createElement(Bubble, { text: v, key: i }))),
|
|
74
|
+
React.createElement("div", { className: "absolute -right-15 top-1 flex flex-col gap-1.5" }, props.answers?.map((v, i) => React.createElement(Answers, { text: v.text, key: i, next: v.next, reloadArrows: props.reloadArrow }))),
|
|
75
|
+
props.id === "start" && React.createElement("div", { className: "absolute top-2 -left-4 w-6 h-6 rounded-full border-2 border-green-800 text-center flex items-center justify-center" },
|
|
76
|
+
React.createElement("div", { className: "bg-green-800 w-4 h-4 rounded-full" })),
|
|
77
|
+
(props.goto || props.action?.goto) && React.createElement("div", null,
|
|
78
|
+
React.createElement("div", { className: "absolute top-2 -right-3 w-6 h-6 rounded-full border-2 border-violet-900 text-center flex justify-center items-center" },
|
|
79
|
+
React.createElement("div", { className: "bg-violet-900 w-4 h-4 rounded-full" })),
|
|
80
|
+
gotoPosition && React.createElement(Arrow, { from: { x: 200, y: 20 }, to: gotoPosition }) || React.createElement(CiWarning, { className: "text-orange-500 absolute top-3 -right-7" })),
|
|
81
|
+
React.createElement("div", { className: "grow" }),
|
|
82
|
+
props.action && React.createElement("div", { className: "font-mono text-stone-200 px-4 mx-1 rounded bg-neutral-800 overflow-hidden" },
|
|
83
|
+
React.createElement("p", { className: "font-sans" }, "Action"),
|
|
84
|
+
props.action.action === "set" && React.createElement("p", null,
|
|
85
|
+
React.createElement("span", null, props.action.property),
|
|
86
|
+
" == ",
|
|
87
|
+
props.action.value),
|
|
88
|
+
props.action.action === "ask" && React.createElement("p", null,
|
|
89
|
+
React.createElement("span", null, props.action.property),
|
|
90
|
+
" == user input"),
|
|
91
|
+
props.action.action === "end" && React.createElement("p", null, "Chatbot end"))));
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=Question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Question.js","sourceRoot":"","sources":["../../src/Components/Question.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAazC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACpD,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,kBAAkB,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAmB,EAAE,EAAE;QACvD,IAAG,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC1B,UAAU,CAAC,IAAI,CAAC,CAAC;Q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,EAAE,IAAI,CAAC,IAAI;YAC1B,6BAAK,SAAS,EAAE,sHAAsH;gBAAE,6BAAK,SAAS,EAAE,oCAAoC,GAAG,CAAM;YAChN,YAAY,IAAI,oBAAC,KAAK,IAAC,IAAI,EAAE,EAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAC,EAAE,EAAE,EAAE,YAAY,GAAG,IAAI,oBAAC,SAAS,IAAC,SAAS,EAAE,yCAAyC,GAAG,CAC1H;QACf,6BAAK,SAAS,EAAE,MAAM,GAAG;QACvB,KAAK,CAAC,MAAM,IAAI,6BAAK,SAAS,EAAE,2EAA2E;YAC5G,2BAAG,SAAS,EAAE,WAAW,aAAY;YACpC,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,IAAI;gBAAG,kCAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAQ;;gBAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAK;YACpG,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,IAAI;gBAAG,kCAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAQ;iCAAkB;YAC1F,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,IAAI,6CAAkB,CAC/C,CACD,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface Option {
|
|
3
|
+
value: string;
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface SelectProps {
|
|
7
|
+
options: Option[];
|
|
8
|
+
id?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (v: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export default function Select(props: SelectProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo, useRef, useState } from "react";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { BsChevronDown } from "react-icons/bs";
|
|
5
|
+
export default function Select(props) {
|
|
6
|
+
const select = useRef(null);
|
|
7
|
+
const id = useMemo(() => {
|
|
8
|
+
return props.id ?? (Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15));
|
|
9
|
+
}, [props.id]);
|
|
10
|
+
const [visible, setVisible] = useState(false);
|
|
11
|
+
return (React.createElement("label", { htmlFor: id },
|
|
12
|
+
React.createElement("div", { className: "relative bg-stone-800 rounded-lg h-8 flex justify-between items-center px-2", onClick: () => setVisible(prev => !prev) },
|
|
13
|
+
React.createElement("p", null, props.options.find(o => o.value == props.value)?.label ?? props.value),
|
|
14
|
+
React.createElement("button", null,
|
|
15
|
+
React.createElement(BsChevronDown, null)),
|
|
16
|
+
React.createElement("div", { className: clsx("absolute bg-stone-800 pt-2 -mt-2 z-0 w-full rounded-b-lg top-full left-0", visible || "hidden") }, props.options.map((v, i) => React.createElement("p", { key: i, className: "p-1 hover:bg-stone-900", onClick: () => {
|
|
17
|
+
if (select.current) {
|
|
18
|
+
select.current.value = v.value;
|
|
19
|
+
props.onChange(v.value);
|
|
20
|
+
}
|
|
21
|
+
} }, v.label)))),
|
|
22
|
+
React.createElement("select", { className: "hidden", id: id, onChange: e => props.onChange(e.target.value), value: props.value, ref: select }, props.options.map((v, i) => React.createElement("option", { value: v.value, key: i }, v.label)))));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/Components/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAc7C,MAAM,CAAC,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CAAC,CAAC,KAAK,CAAC;wBAC/B,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;oBACzB,CAAC;gBACF,CAAC,IAAG,CAAC,CAAC,KAAK,CAAK,CAChB,CACI,CACD;QACN,gCAAQ,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,IACjH,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,gCAAQ,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAG,CAAC,CAAC,KAAK,CAAU,CAAC,CACxE,CACF,CACR,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { SetState } from "../utils.ts";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface SideBarProps {
|
|
5
|
+
display: boolean;
|
|
6
|
+
setDisplay: SetState<boolean>;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
onValidate?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export default function SideBar(props: SideBarProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { BsCheck, BsX } from "react-icons/bs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export default function SideBar(props) {
|
|
5
|
+
return (React.createElement("div", { className: clsx("fixed transition w-1/3 h-screen top-0 left-0 bg-stone-900 z-50 flex flex-col", props.display && "translate-x-0" || "-translate-x-full") },
|
|
6
|
+
React.createElement("div", { className: "flex justify-end" },
|
|
7
|
+
React.createElement("button", { className: "mx-2 my-1 p-1 rounded cursor-pointer border border-stone-200/30 aspect-square w-8", onClick: () => {
|
|
8
|
+
props.setDisplay(false);
|
|
9
|
+
if (props.onClose) {
|
|
10
|
+
props.onClose();
|
|
11
|
+
}
|
|
12
|
+
} },
|
|
13
|
+
React.createElement(BsX, { className: "w-6 h-6" })),
|
|
14
|
+
props.onValidate && React.createElement("button", { className: "mx-2 my-1 p-1 rounded cursor-pointer border border-stone-200/30 aspect-square w-8", onClick: () => props.onValidate && props.onValidate() },
|
|
15
|
+
React.createElement(BsCheck, { className: "w-6 h-6" }))),
|
|
16
|
+
React.createElement("div", { className: "p-2 grow overflow-hidden" }, props.children)));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=SideBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideBar.js","sourceRoot":"","sources":["../../src/Components/SideBar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IAClD,OAAO,CACN,6BAAK,SAAS,EAAE,IAAI,CAAC,8EAA8E,EAAE,KAAK,CAAC,OAAO,IAAI,eAAe,IAAI,mBAAmB,CAAC;QAC5J,6BAAK,SAAS,EAAE,kBAAkB;YACjC,gCAAQ,SAAS,EAAE,mFAAmF,EAAE,OAAO,EAAE,GAAG,EAAE;oBACrH,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;oBACxB,IAAG,KAAK,CAAC,OAAO,EAAE,CAAC;wBAClB,KAAK,CAAC,OAAO,EAAE,CAAC;oBAClB,CAAC;gBAAA,CAAC;gBACD,oBAAC,GAAG,IAAC,SAAS,EAAE,SAAS,GAAG,CACpB;YACR,KAAK,CAAC,UAAU,IAAI,gCAAQ,SAAS,EAAE,mFAAmF,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE;gBAAE,oBAAC,OAAO,IAAC,SAAS,EAAE,SAAS,GAAG,CAAS,CACxN;QACN,6BAAK,SAAS,EAAE,0BAA0B,IAAG,KAAK,CAAC,QAAQ,CAAO,CAC7D,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type TQuestion from "./TQuestion.ts";
|
|
4
|
+
import type { SetState } from "./utils.ts";
|
|
5
|
+
interface CurrentQuestionProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function CurrentQuestionProvider(props: CurrentQuestionProviderProps): React.JSX.Element;
|
|
9
|
+
export declare function useCurrentQuestion(): [TQuestion | null, SetState<TQuestion | null>];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { createContext, useContext, useState } from "react";
|
|
3
|
+
const CurrentQuestionContext = createContext([null, () => { }]);
|
|
4
|
+
export function CurrentQuestionProvider(props) {
|
|
5
|
+
const [question, setQuestion] = useState(null);
|
|
6
|
+
return React.createElement(CurrentQuestionContext.Provider, { value: [question, setQuestion] }, props.children);
|
|
7
|
+
}
|
|
8
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
9
|
+
export function useCurrentQuestion() {
|
|
10
|
+
return useContext(CurrentQuestionContext);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=CurrentQuestionHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrentQuestionHook.js","sourceRoot":"","sources":["../src/CurrentQuestionHook.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAkB,UAAU,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAI1E,MAAM,sBAAsB,GAAG,aAAa,CAAiD,CAAC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC;AAM/G,MAAM,UAAU,uBAAuB,CAAC,KAAmC;IAC1E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;IACjE,OAAO,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,IACpE,KAAK,CAAC,QAAQ,CACkB,CAAA;AACnC,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,kBAAkB;IACjC,OAAQ,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default interface TQuestion {
|
|
2
|
+
id: string;
|
|
3
|
+
text: string | string[];
|
|
4
|
+
answers?: TAnswers[];
|
|
5
|
+
goto?: string;
|
|
6
|
+
action?: TAction;
|
|
7
|
+
position: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface TAnswers {
|
|
13
|
+
text: string;
|
|
14
|
+
next: string;
|
|
15
|
+
action?: TAction;
|
|
16
|
+
}
|
|
17
|
+
export interface TAction {
|
|
18
|
+
action: TActionValue;
|
|
19
|
+
property?: string;
|
|
20
|
+
value?: any;
|
|
21
|
+
goto?: string;
|
|
22
|
+
}
|
|
23
|
+
export type TActionValue = "set" | "ask" | "end";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TQuestion.js","sourceRoot":"","sources":["../src/TQuestion.ts"],"names":[],"mappings":""}
|
package/dist/UI.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type TQuestion from "./TQuestion.ts";
|
|
2
|
+
import type { SetState } from "./utils.ts";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface UIProps {
|
|
5
|
+
questions: TQuestion[];
|
|
6
|
+
setQuestions: SetState<TQuestion[]>;
|
|
7
|
+
addQuestion: (initPos: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
editQuestion: (id: string, data: TQuestion) => void;
|
|
12
|
+
deleteQuestion: (id: string) => void;
|
|
13
|
+
setReloadArrow: SetState<boolean>;
|
|
14
|
+
save?: (questions: TQuestion[]) => void;
|
|
15
|
+
load?: () => Promise<TQuestion[]>;
|
|
16
|
+
export?: (questions: TQuestion[]) => void;
|
|
17
|
+
import?: () => Promise<TQuestion[]>;
|
|
18
|
+
}
|
|
19
|
+
export default function UI(props: UIProps): React.JSX.Element;
|
|
20
|
+
export {};
|