@pie-element/drawing-response 12.1.2-next.1 → 12.1.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/CHANGELOG.json +547 -0
- package/CHANGELOG.md +1966 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +367 -0
- package/configure/CHANGELOG.md +1766 -0
- package/configure/lib/button.js +37 -0
- package/configure/lib/button.js.map +1 -0
- package/configure/lib/defaults.js +116 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/image-container.js +307 -0
- package/configure/lib/image-container.js.map +1 -0
- package/configure/lib/index.js +147 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/root.js +219 -0
- package/configure/lib/root.js.map +1 -0
- package/configure/package.json +24 -0
- package/configure/src/__tests__/image-container.test.jsx +231 -0
- package/configure/src/__tests__/index.test.js +72 -0
- package/configure/src/__tests__/root.test.jsx +110 -0
- package/configure/src/button.jsx +33 -0
- package/configure/src/defaults.js +80 -0
- package/configure/src/image-container.jsx +316 -0
- package/configure/src/index.js +167 -0
- package/configure/src/root.jsx +198 -0
- package/controller/CHANGELOG.json +52 -0
- package/controller/CHANGELOG.md +261 -0
- package/controller/lib/defaults.js +22 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +84 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +16 -0
- package/controller/src/__tests__/index.test.js +172 -0
- package/controller/src/defaults.js +12 -0
- package/controller/src/index.js +71 -0
- package/docs/config-schema.json +1766 -0
- package/docs/config-schema.json.md +1313 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +14 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +37 -0
- package/docs/pie-schema.json +823 -0
- package/docs/pie-schema.json.md +606 -0
- package/lib/drawing-response/button.js +49 -0
- package/lib/drawing-response/button.js.map +1 -0
- package/lib/drawing-response/constants.js +43 -0
- package/lib/drawing-response/constants.js.map +1 -0
- package/lib/drawing-response/container.js +327 -0
- package/lib/drawing-response/container.js.map +1 -0
- package/lib/drawing-response/drawable-circle.js +80 -0
- package/lib/drawing-response/drawable-circle.js.map +1 -0
- package/lib/drawing-response/drawable-eraser.js +64 -0
- package/lib/drawing-response/drawable-eraser.js.map +1 -0
- package/lib/drawing-response/drawable-free-path.js +71 -0
- package/lib/drawing-response/drawable-free-path.js.map +1 -0
- package/lib/drawing-response/drawable-helper.js +34 -0
- package/lib/drawing-response/drawable-helper.js.map +1 -0
- package/lib/drawing-response/drawable-image.js +41 -0
- package/lib/drawing-response/drawable-image.js.map +1 -0
- package/lib/drawing-response/drawable-line.js +75 -0
- package/lib/drawing-response/drawable-line.js.map +1 -0
- package/lib/drawing-response/drawable-main.js +345 -0
- package/lib/drawing-response/drawable-main.js.map +1 -0
- package/lib/drawing-response/drawable-palette.js +140 -0
- package/lib/drawing-response/drawable-palette.js.map +1 -0
- package/lib/drawing-response/drawable-rectangle.js +80 -0
- package/lib/drawing-response/drawable-rectangle.js.map +1 -0
- package/lib/drawing-response/drawable-text.js +295 -0
- package/lib/drawing-response/drawable-text.js.map +1 -0
- package/lib/drawing-response/drawable-transformer.js +52 -0
- package/lib/drawing-response/drawable-transformer.js.map +1 -0
- package/lib/drawing-response/factory.js +22 -0
- package/lib/drawing-response/factory.js.map +1 -0
- package/lib/drawing-response/icon.js +55 -0
- package/lib/drawing-response/icon.js.map +1 -0
- package/lib/drawing-response/index.js +91 -0
- package/lib/drawing-response/index.js.map +1 -0
- package/lib/index.js +68 -0
- package/lib/index.js.map +1 -0
- package/package.json +19 -83
- package/src/__tests__/drawing-index-test.jsx +103 -0
- package/src/drawing-response/__tests__/container.test.jsx +82 -0
- package/src/drawing-response/__tests__/drawable-helper.test.jsx +24 -0
- package/src/drawing-response/__tests__/drawing-main.test.jsx +855 -0
- package/src/drawing-response/__tests__/factory.test.js +13 -0
- package/src/drawing-response/button.jsx +45 -0
- package/src/drawing-response/constants.js +44 -0
- package/src/drawing-response/container.jsx +301 -0
- package/src/drawing-response/drawable-circle.jsx +74 -0
- package/src/drawing-response/drawable-eraser.jsx +53 -0
- package/src/drawing-response/drawable-free-path.jsx +59 -0
- package/src/drawing-response/drawable-helper.jsx +21 -0
- package/src/drawing-response/drawable-image.jsx +36 -0
- package/src/drawing-response/drawable-line.jsx +62 -0
- package/src/drawing-response/drawable-main.jsx +333 -0
- package/src/drawing-response/drawable-palette.jsx +99 -0
- package/src/drawing-response/drawable-rectangle.jsx +69 -0
- package/src/drawing-response/drawable-text.jsx +318 -0
- package/src/drawing-response/drawable-transformer.jsx +52 -0
- package/src/drawing-response/factory.js +17 -0
- package/src/drawing-response/icon.jsx +52 -0
- package/src/drawing-response/index.jsx +92 -0
- package/src/index.js +72 -0
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/button.d.ts +0 -29
- package/dist/author/button.js +0 -25
- package/dist/author/defaults.d.ts +0 -118
- package/dist/author/defaults.js +0 -86
- package/dist/author/image-container.d.ts +0 -42
- package/dist/author/image-container.js +0 -183
- package/dist/author/index.d.ts +0 -37
- package/dist/author/index.js +0 -79
- package/dist/author/root.d.ts +0 -17
- package/dist/author/root.js +0 -142
- package/dist/browser/MenuItem-DbAfJgc1.js +0 -10476
- package/dist/browser/MenuItem-DbAfJgc1.js.map +0 -1
- package/dist/browser/author/index.js +0 -37837
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/browser-kkT1XVKw.js +0 -219
- package/dist/browser/browser-kkT1XVKw.js.map +0 -1
- package/dist/browser/controller/index.js +0 -61
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -13560
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/drawing-response.css +0 -2
- package/dist/controller/defaults.d.ts +0 -24
- package/dist/controller/defaults.js +0 -18
- package/dist/controller/index.d.ts +0 -13
- package/dist/controller/index.js +0 -46
- package/dist/delivery/drawing-response/button.d.ts +0 -31
- package/dist/delivery/drawing-response/button.js +0 -36
- package/dist/delivery/drawing-response/constants.d.ts +0 -16
- package/dist/delivery/drawing-response/constants.js +0 -40
- package/dist/delivery/drawing-response/container.d.ts +0 -32
- package/dist/delivery/drawing-response/container.js +0 -212
- package/dist/delivery/drawing-response/drawable-circle.d.ts +0 -18
- package/dist/delivery/drawing-response/drawable-circle.js +0 -51
- package/dist/delivery/drawing-response/drawable-eraser.d.ts +0 -17
- package/dist/delivery/drawing-response/drawable-eraser.js +0 -52
- package/dist/delivery/drawing-response/drawable-free-path.d.ts +0 -18
- package/dist/delivery/drawing-response/drawable-free-path.js +0 -52
- package/dist/delivery/drawing-response/drawable-helper.d.ts +0 -17
- package/dist/delivery/drawing-response/drawable-helper.js +0 -12
- package/dist/delivery/drawing-response/drawable-image.d.ts +0 -24
- package/dist/delivery/drawing-response/drawable-image.js +0 -28
- package/dist/delivery/drawing-response/drawable-line.d.ts +0 -18
- package/dist/delivery/drawing-response/drawable-line.js +0 -53
- package/dist/delivery/drawing-response/drawable-main.d.ts +0 -25
- package/dist/delivery/drawing-response/drawable-main.js +0 -210
- package/dist/delivery/drawing-response/drawable-palette.d.ts +0 -14
- package/dist/delivery/drawing-response/drawable-palette.js +0 -89
- package/dist/delivery/drawing-response/drawable-rectangle.d.ts +0 -18
- package/dist/delivery/drawing-response/drawable-rectangle.js +0 -49
- package/dist/delivery/drawing-response/drawable-text.d.ts +0 -30
- package/dist/delivery/drawing-response/drawable-text.js +0 -189
- package/dist/delivery/drawing-response/drawable-transformer.d.ts +0 -16
- package/dist/delivery/drawing-response/drawable-transformer.js +0 -35
- package/dist/delivery/drawing-response/factory.d.ts +0 -11
- package/dist/delivery/drawing-response/factory.js +0 -19
- package/dist/delivery/drawing-response/icon.d.ts +0 -19
- package/dist/delivery/drawing-response/icon.js +0 -52
- package/dist/delivery/drawing-response/index.d.ts +0 -18
- package/dist/delivery/drawing-response/index.js +0 -70
- package/dist/delivery/index.d.ts +0 -19
- package/dist/delivery/index.js +0 -47
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -165
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/controller/src/defaults.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
backgroundImageEnabled: boolean;
|
|
11
|
-
imageDimensions: {
|
|
12
|
-
height: number;
|
|
13
|
-
width: number;
|
|
14
|
-
};
|
|
15
|
-
imageUrl: string;
|
|
16
|
-
prompt: string;
|
|
17
|
-
promptEnabled: boolean;
|
|
18
|
-
spellCheckEnabled: boolean;
|
|
19
|
-
studentInstructionsEnabled: boolean;
|
|
20
|
-
teacherInstructions: string;
|
|
21
|
-
teacherInstructionsEnabled: boolean;
|
|
22
|
-
toolbarEditorPosition: string;
|
|
23
|
-
};
|
|
24
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/controller/defaults.ts
|
|
2
|
-
var e = {
|
|
3
|
-
backgroundImageEnabled: !0,
|
|
4
|
-
imageDimensions: {
|
|
5
|
-
height: 0,
|
|
6
|
-
width: 0
|
|
7
|
-
},
|
|
8
|
-
imageUrl: "",
|
|
9
|
-
prompt: "",
|
|
10
|
-
promptEnabled: !0,
|
|
11
|
-
spellCheckEnabled: !0,
|
|
12
|
-
studentInstructionsEnabled: !0,
|
|
13
|
-
teacherInstructions: "",
|
|
14
|
-
teacherInstructionsEnabled: !0,
|
|
15
|
-
toolbarEditorPosition: "bottom"
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { e as default };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/controller/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare const normalize: (question: any) => any;
|
|
10
|
-
export declare function model(question: any, session: any, env: any): Promise<unknown>;
|
|
11
|
-
export declare const createDefaultModel: (model?: {}) => Promise<unknown>;
|
|
12
|
-
export declare function outcome(): Promise<unknown>;
|
|
13
|
-
export declare const validate: (model?: {}, config?: {}) => {};
|
package/dist/controller/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import e from "./defaults.js";
|
|
2
|
-
import t from "debug";
|
|
3
|
-
//#region src/controller/index.ts
|
|
4
|
-
var n = t("pie-elements:drawing-response:controller"), r = (t) => ({
|
|
5
|
-
...e,
|
|
6
|
-
...t
|
|
7
|
-
});
|
|
8
|
-
function i(e, t, n) {
|
|
9
|
-
let i = r(e), { extraCSSRules: a, imageUrl: o, imageDimensions: s, prompt: c, promptEnabled: l, backgroundImageEnabled: u, language: d } = i;
|
|
10
|
-
return new Promise((e) => {
|
|
11
|
-
let t = {
|
|
12
|
-
disabled: n.mode !== "gather",
|
|
13
|
-
mode: n.mode,
|
|
14
|
-
imageDimensions: s,
|
|
15
|
-
imageUrl: o,
|
|
16
|
-
prompt: l ? c : null,
|
|
17
|
-
backgroundImageEnabled: u,
|
|
18
|
-
language: d,
|
|
19
|
-
extraCSSRules: a
|
|
20
|
-
};
|
|
21
|
-
n.role === "instructor" && (n.mode === "view" || n.mode === "evaluate") ? t.teacherInstructions = i.teacherInstructionsEnabled ? i.teacherInstructions : null : t.teacherInstructions = null, e(t);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
var a = (t = {}) => new Promise((n) => {
|
|
25
|
-
n({
|
|
26
|
-
...e,
|
|
27
|
-
...t
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
function o() {
|
|
31
|
-
return new Promise((e) => {
|
|
32
|
-
n("outcome..."), e({
|
|
33
|
-
score: 0,
|
|
34
|
-
completed: "n/a",
|
|
35
|
-
note: "Requires manual scoring"
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
var s = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), c = (e = {}, t = {}) => {
|
|
40
|
-
let n = {};
|
|
41
|
-
return ["teacherInstructions", "prompt"].forEach((r) => {
|
|
42
|
-
t[r]?.required && !s(e[r]) && (n[r] = "This field is required.");
|
|
43
|
-
}), n;
|
|
44
|
-
};
|
|
45
|
-
//#endregion
|
|
46
|
-
export { a as createDefaultModel, i as model, r as normalize, o as outcome, c as validate };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/src/drawing-response/button.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
declare const CustomButton: {
|
|
12
|
-
({ label, onClick, disabled, title }: {
|
|
13
|
-
label: any;
|
|
14
|
-
onClick: any;
|
|
15
|
-
disabled: any;
|
|
16
|
-
title: any;
|
|
17
|
-
}): React.JSX.Element;
|
|
18
|
-
propTypes: {
|
|
19
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
20
|
-
label: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
21
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
-
title: PropTypes.Requireable<string>;
|
|
23
|
-
};
|
|
24
|
-
defaultProps: {
|
|
25
|
-
disabled: boolean;
|
|
26
|
-
label: string;
|
|
27
|
-
onClick: () => void;
|
|
28
|
-
title: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export default CustomButton;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import e from "prop-types";
|
|
3
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import { styled as n } from "@mui/material/styles";
|
|
5
|
-
import r from "@mui/material/Button";
|
|
6
|
-
//#region src/delivery/drawing-response/button.tsx
|
|
7
|
-
var i = n(r)({
|
|
8
|
-
fontSize: "0.9em",
|
|
9
|
-
marginLeft: 8,
|
|
10
|
-
minWidth: 32,
|
|
11
|
-
height: 32,
|
|
12
|
-
"& span": { "& svg": {
|
|
13
|
-
width: "1.3em !important",
|
|
14
|
-
height: "1.3em !important"
|
|
15
|
-
} }
|
|
16
|
-
}), a = ({ label: e, onClick: n, disabled: r, title: a }) => /* @__PURE__ */ t(i, {
|
|
17
|
-
title: a,
|
|
18
|
-
onClick: n,
|
|
19
|
-
disabled: r,
|
|
20
|
-
size: "small",
|
|
21
|
-
variant: "contained",
|
|
22
|
-
children: e
|
|
23
|
-
});
|
|
24
|
-
a.propTypes = {
|
|
25
|
-
disabled: e.bool,
|
|
26
|
-
label: e.oneOfType([e.string, e.object]),
|
|
27
|
-
onClick: e.func,
|
|
28
|
-
title: e.string
|
|
29
|
-
}, a.defaultProps = {
|
|
30
|
-
disabled: !1,
|
|
31
|
-
label: "Add",
|
|
32
|
-
onClick: () => {},
|
|
33
|
-
title: ""
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
export { a as default };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/src/drawing-response/constants.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
tools: {
|
|
11
|
-
type: string;
|
|
12
|
-
label: string;
|
|
13
|
-
icon: string;
|
|
14
|
-
}[];
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//#region src/delivery/drawing-response/constants.ts
|
|
2
|
-
var e = { tools: [
|
|
3
|
-
{
|
|
4
|
-
type: "Select",
|
|
5
|
-
label: "Select",
|
|
6
|
-
icon: "mdiCursorDefault"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
type: "FreePathDrawable",
|
|
10
|
-
label: "Free Draw",
|
|
11
|
-
icon: "mdiPencil"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
type: "LineDrawable",
|
|
15
|
-
label: "Line",
|
|
16
|
-
icon: "mdiMinus"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: "RectangleDrawable",
|
|
20
|
-
label: "Rectangle",
|
|
21
|
-
icon: "mdiRectangle"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: "CircleDrawable",
|
|
25
|
-
label: "Circle",
|
|
26
|
-
icon: "mdiCircle"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: "Text",
|
|
30
|
-
label: "Text Entry",
|
|
31
|
-
icon: "mdiFormatColorText"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
type: "EraserDrawable",
|
|
35
|
-
label: "Eraser",
|
|
36
|
-
icon: "mdiEraser"
|
|
37
|
-
}
|
|
38
|
-
] };
|
|
39
|
-
//#endregion
|
|
40
|
-
export { e as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/src/drawing-response/container.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React, { Component } from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Container extends Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
14
|
-
session: PropTypes.Validator<object>;
|
|
15
|
-
onSessionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
-
imageDimensions: PropTypes.Validator<object>;
|
|
17
|
-
imageUrl: PropTypes.Validator<string>;
|
|
18
|
-
backgroundImageEnabled: PropTypes.Validator<boolean>;
|
|
19
|
-
language: PropTypes.Requireable<string>;
|
|
20
|
-
};
|
|
21
|
-
constructor(props: any);
|
|
22
|
-
setTranslatedState(language: any): void;
|
|
23
|
-
UNSAFE_componentWillReceiveProps(props: any): void;
|
|
24
|
-
setDimensions(): void;
|
|
25
|
-
componentDidMount(): void;
|
|
26
|
-
componentWillUnmount(): void;
|
|
27
|
-
handleMakeToolActive(tool: any): void;
|
|
28
|
-
checkIfToolIsDisabled: any;
|
|
29
|
-
handleColorChange(type: any, color: any): void;
|
|
30
|
-
render(): React.JSX.Element;
|
|
31
|
-
}
|
|
32
|
-
export default Container;
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import e from "./constants.js";
|
|
2
|
-
import t from "./button.js";
|
|
3
|
-
import n from "./drawable-palette.js";
|
|
4
|
-
import r from "./drawable-main.js";
|
|
5
|
-
import i from "./drawable-text.js";
|
|
6
|
-
import a from "./icon.js";
|
|
7
|
-
import { Component as o } from "react";
|
|
8
|
-
import s from "prop-types";
|
|
9
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
10
|
-
import { styled as u } from "@mui/material/styles";
|
|
11
|
-
import d from "@pie-lib/translator";
|
|
12
|
-
//#region src/delivery/drawing-response/container.tsx
|
|
13
|
-
var { tools: f } = e, { translator: p } = d, m = u("div")(({ theme: e }) => ({ marginTop: e.spacing(2) })), h = u("div")(({ theme: e }) => ({
|
|
14
|
-
border: "1px solid #E0E1E6",
|
|
15
|
-
borderRadius: "5px",
|
|
16
|
-
marginTop: e.spacing(2),
|
|
17
|
-
backgroundColor: "#ECEDF1"
|
|
18
|
-
})), g = u("div")({
|
|
19
|
-
minHeight: 350,
|
|
20
|
-
backgroundColor: "#fff"
|
|
21
|
-
}), _ = u("div")(({ theme: e }) => ({
|
|
22
|
-
borderBottom: "1px solid #E0E1E6",
|
|
23
|
-
borderTopLeftRadius: "5px",
|
|
24
|
-
borderTopRightRadius: "5px",
|
|
25
|
-
padding: "12px 8px 4px",
|
|
26
|
-
boxSizing: "border-box",
|
|
27
|
-
maxWidth: "calc(100% - 163px)",
|
|
28
|
-
"& button": { marginBottom: e.spacing(1) }
|
|
29
|
-
})), v = [
|
|
30
|
-
"red",
|
|
31
|
-
"orange",
|
|
32
|
-
"yellow",
|
|
33
|
-
"violet",
|
|
34
|
-
"blue",
|
|
35
|
-
"green",
|
|
36
|
-
"white",
|
|
37
|
-
"black"
|
|
38
|
-
].map((e) => ({
|
|
39
|
-
value: e,
|
|
40
|
-
label: e
|
|
41
|
-
})), y = class extends o {
|
|
42
|
-
static propTypes = {
|
|
43
|
-
disabled: s.bool,
|
|
44
|
-
session: s.object.isRequired,
|
|
45
|
-
onSessionChange: s.func.isRequired,
|
|
46
|
-
imageDimensions: s.object.isRequired,
|
|
47
|
-
imageUrl: s.string.isRequired,
|
|
48
|
-
backgroundImageEnabled: s.bool.isRequired,
|
|
49
|
-
language: s.string
|
|
50
|
-
};
|
|
51
|
-
constructor(e) {
|
|
52
|
-
super(e);
|
|
53
|
-
let t = new i();
|
|
54
|
-
this.state = {
|
|
55
|
-
scale: 1,
|
|
56
|
-
drawableDimensions: {
|
|
57
|
-
height: 0,
|
|
58
|
-
width: 0
|
|
59
|
-
},
|
|
60
|
-
toolActive: f[0],
|
|
61
|
-
fillColor: "white",
|
|
62
|
-
fillColorList: [
|
|
63
|
-
{
|
|
64
|
-
value: "transparent",
|
|
65
|
-
label: "no fill"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: "lightblue",
|
|
69
|
-
label: "light blue"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
value: "lightyellow",
|
|
73
|
-
label: "light yellow"
|
|
74
|
-
},
|
|
75
|
-
...v
|
|
76
|
-
],
|
|
77
|
-
outlineColor: "black",
|
|
78
|
-
outlineColorList: v,
|
|
79
|
-
paintColor: "red",
|
|
80
|
-
paintColorList: v,
|
|
81
|
-
TextEntry: t
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
setTranslatedState(e) {
|
|
85
|
-
let t = v.map((t) => ({
|
|
86
|
-
value: t.value,
|
|
87
|
-
label: p.t(`drawingResponse.${t.label}`, { lng: e })
|
|
88
|
-
}));
|
|
89
|
-
this.setState({
|
|
90
|
-
fillColorList: [
|
|
91
|
-
{
|
|
92
|
-
value: "transparent",
|
|
93
|
-
label: p.t("drawingResponse.noFill", { lng: e })
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
value: "lightblue",
|
|
97
|
-
label: p.t("drawingResponse.lightblue", { lng: e })
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
value: "lightyellow",
|
|
101
|
-
label: p.t("drawingResponse.lightyellow", { lng: e })
|
|
102
|
-
},
|
|
103
|
-
...t
|
|
104
|
-
],
|
|
105
|
-
paintColor: p.t("drawingResponse.red", { lng: e }),
|
|
106
|
-
outlineColorList: t,
|
|
107
|
-
paintColorList: t
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
111
|
-
let { language: t } = e;
|
|
112
|
-
this.setTranslatedState(t);
|
|
113
|
-
}
|
|
114
|
-
setDimensions() {
|
|
115
|
-
let e = setInterval(() => {
|
|
116
|
-
try {
|
|
117
|
-
let { height: e, width: t } = this.drawable.getBoundingClientRect(), n = this.props.session.width || t;
|
|
118
|
-
e !== 0 && t !== 0 && this.setState({ drawableDimensions: {
|
|
119
|
-
height: e,
|
|
120
|
-
width: n
|
|
121
|
-
} });
|
|
122
|
-
} catch (e) {
|
|
123
|
-
console.warn("setDimensions Error: ", e);
|
|
124
|
-
} finally {
|
|
125
|
-
clearInterval(e);
|
|
126
|
-
}
|
|
127
|
-
}, 100);
|
|
128
|
-
}
|
|
129
|
-
componentDidMount() {
|
|
130
|
-
let { language: e } = this.props;
|
|
131
|
-
this.setTranslatedState(e), this.setDimensions(), this.observer = new MutationObserver((e) => {
|
|
132
|
-
e.forEach(() => {
|
|
133
|
-
let e = document.getElementById("question-container")?.style?.cssText, t = (e?.substring(e.indexOf("--pie-zoom") + 11, e.lastIndexOf("%")))?.replace(/\s/g, "");
|
|
134
|
-
t ? parseFloat(t) / 100 !== this.state.scale && this.setState({ scale: parseFloat(t) / 100 }) : !t && this.state.scale !== 1 && this.setState({ scale: 1 });
|
|
135
|
-
});
|
|
136
|
-
}), this.resizeObserver = new ResizeObserver(() => {
|
|
137
|
-
this.setDimensions();
|
|
138
|
-
}), this.drawable && this.resizeObserver.observe(this.drawable);
|
|
139
|
-
let t = document.getElementById("question-container");
|
|
140
|
-
t && this.observer.observe(t, {
|
|
141
|
-
attributes: !0,
|
|
142
|
-
attributeFilter: ["style"]
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
componentWillUnmount() {
|
|
146
|
-
let { TextEntry: e } = this.state;
|
|
147
|
-
e.removeEventListeners(), this.observer?.disconnect(), this.resizeObserver?.disconnect();
|
|
148
|
-
}
|
|
149
|
-
handleMakeToolActive(e) {
|
|
150
|
-
let { TextEntry: t } = this.state, { type: n } = e, { language: r } = this.props;
|
|
151
|
-
n === "Text" ? (t.addNewTextEntry(r), this.setState({ updatedAt: /* @__PURE__ */ new Date() })) : this.setState({ toolActive: e });
|
|
152
|
-
}
|
|
153
|
-
checkIfToolIsDisabled = (e) => {
|
|
154
|
-
if (this.props.disabled) return !0;
|
|
155
|
-
let { toolActive: t } = this.state;
|
|
156
|
-
return e === "Text" ? !1 : e === t.type;
|
|
157
|
-
};
|
|
158
|
-
handleColorChange(e, t) {
|
|
159
|
-
let n = `${e}Color`;
|
|
160
|
-
this.setState({ [n]: t });
|
|
161
|
-
}
|
|
162
|
-
render() {
|
|
163
|
-
let { disabled: e, imageUrl: i, imageDimensions: o, onSessionChange: s, session: u, backgroundImageEnabled: d, language: p } = this.props, { drawableDimensions: v, toolActive: y, fillColor: b, fillColorList: x, outlineColor: S, outlineColorList: C, paintColor: w, paintColorList: T, TextEntry: E } = this.state, D = v.height * this.state.scale;
|
|
164
|
-
return /* @__PURE__ */ l(m, { children: [!e && /* @__PURE__ */ c(n, {
|
|
165
|
-
fillColor: b,
|
|
166
|
-
fillList: x,
|
|
167
|
-
outlineColor: S,
|
|
168
|
-
outlineList: C,
|
|
169
|
-
paintColor: w,
|
|
170
|
-
paintList: T,
|
|
171
|
-
onFillColorChange: (e) => this.handleColorChange("fill", e),
|
|
172
|
-
onOutlineColorChange: (e) => this.handleColorChange("outline", e),
|
|
173
|
-
onPaintColorChange: (e) => this.handleColorChange("paint", e),
|
|
174
|
-
language: p
|
|
175
|
-
}), /* @__PURE__ */ l(h, { children: [/* @__PURE__ */ c(_, { children: f.map((e) => {
|
|
176
|
-
let { type: n, label: r, icon: i } = e;
|
|
177
|
-
return /* @__PURE__ */ c(t, {
|
|
178
|
-
title: r,
|
|
179
|
-
disabled: this.checkIfToolIsDisabled(n),
|
|
180
|
-
onClick: () => this.handleMakeToolActive(e),
|
|
181
|
-
label: /* @__PURE__ */ c(a, { path: i })
|
|
182
|
-
}, n);
|
|
183
|
-
}) }), /* @__PURE__ */ c(g, {
|
|
184
|
-
ref: (e) => {
|
|
185
|
-
this.drawable = e;
|
|
186
|
-
},
|
|
187
|
-
style: {
|
|
188
|
-
height: D,
|
|
189
|
-
maxHeight: D,
|
|
190
|
-
overflow: "scroll"
|
|
191
|
-
},
|
|
192
|
-
children: /* @__PURE__ */ c(r, {
|
|
193
|
-
scale: this.state.scale,
|
|
194
|
-
session: u,
|
|
195
|
-
disabled: e,
|
|
196
|
-
onSessionChange: s,
|
|
197
|
-
fillColor: b,
|
|
198
|
-
outlineColor: S,
|
|
199
|
-
paintColor: w,
|
|
200
|
-
imageUrl: i,
|
|
201
|
-
drawableDimensions: v,
|
|
202
|
-
imageDimensions: o,
|
|
203
|
-
toolActive: y,
|
|
204
|
-
TextEntry: E,
|
|
205
|
-
backgroundImageEnabled: d,
|
|
206
|
-
language: p
|
|
207
|
-
})
|
|
208
|
-
})] })] });
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
//#endregion
|
|
212
|
-
export { y as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/src/drawing-response/drawable-circle.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import DrawableHelper from './drawable-helper.js';
|
|
11
|
-
export default class CircleDrawable extends DrawableHelper {
|
|
12
|
-
static TYPE: string;
|
|
13
|
-
constructor(props: any);
|
|
14
|
-
registerMovement(x: any, y: any): void;
|
|
15
|
-
handleOnClick(props: any): void;
|
|
16
|
-
handleDragEnd: any;
|
|
17
|
-
render(props: any): React.JSX.Element;
|
|
18
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import e from "./drawable-helper.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import { Circle as n } from "react-konva";
|
|
5
|
-
//#region src/delivery/drawing-response/drawable-circle.tsx
|
|
6
|
-
function r(e) {
|
|
7
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
8
|
-
}
|
|
9
|
-
function i(e, t) {
|
|
10
|
-
return !e || r(e) ? e : r(e.default) ? e.default : t && r(e[t]) ? e[t] : t && r(e[t]?.default) ? e[t].default : e;
|
|
11
|
-
}
|
|
12
|
-
var a = i(n, "Circle"), o = class n extends e {
|
|
13
|
-
static TYPE = "CircleDrawable";
|
|
14
|
-
constructor(e) {
|
|
15
|
-
super(e, n.TYPE);
|
|
16
|
-
let { startx: t, starty: r, x: i, y: a } = e;
|
|
17
|
-
this.startx = t, this.starty = r, this.x = i || t, this.y = a || r;
|
|
18
|
-
let o = this.startx - this.x, s = this.starty - this.y;
|
|
19
|
-
this.radius = Math.sqrt(o * o + s * s);
|
|
20
|
-
}
|
|
21
|
-
registerMovement(e, t) {
|
|
22
|
-
this.x = e, this.y = t;
|
|
23
|
-
let n = this.startx - this.x, r = this.starty - this.y;
|
|
24
|
-
this.radius = Math.sqrt(n * n + r * r);
|
|
25
|
-
}
|
|
26
|
-
handleOnClick(e) {
|
|
27
|
-
let { paint: t, paintColor: n, forceUpdate: r } = e;
|
|
28
|
-
t && (this.paintColor = n, r());
|
|
29
|
-
}
|
|
30
|
-
handleDragEnd = (e, t) => {
|
|
31
|
-
let n = this.startx - t.target.getX(), r = this.starty - t.target.getY();
|
|
32
|
-
this.startx = t.target.getX(), this.starty = t.target.getY(), this.x -= n, this.y -= r, e.handleSessionChange();
|
|
33
|
-
};
|
|
34
|
-
render(e) {
|
|
35
|
-
let { draggable: n, key: r, onMouseOverElement: i, onMouseOutElement: o } = e;
|
|
36
|
-
return /* @__PURE__ */ t(a, {
|
|
37
|
-
draggable: n,
|
|
38
|
-
radius: this.radius,
|
|
39
|
-
x: this.startx,
|
|
40
|
-
y: this.starty,
|
|
41
|
-
fill: this.paintColor || this.fillColor,
|
|
42
|
-
onClick: () => this.handleOnClick(e),
|
|
43
|
-
onDragEnd: this.handleDragEnd.bind(this, e),
|
|
44
|
-
onMouseEnter: i,
|
|
45
|
-
onMouseLeave: o,
|
|
46
|
-
stroke: this.outlineColor
|
|
47
|
-
}, r);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
//#endregion
|
|
51
|
-
export { o as default };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/src/drawing-response/drawable-eraser.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import DrawableHelper from './drawable-helper.js';
|
|
11
|
-
export default class EraserDrawable extends DrawableHelper {
|
|
12
|
-
static TYPE: string;
|
|
13
|
-
constructor(props: any);
|
|
14
|
-
registerMovement(x: any, y: any): void;
|
|
15
|
-
handleDragEnd: any;
|
|
16
|
-
render(props: any): React.JSX.Element;
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import e from "./drawable-helper.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import { Line as n } from "react-konva";
|
|
5
|
-
//#region src/delivery/drawing-response/drawable-eraser.tsx
|
|
6
|
-
function r(e) {
|
|
7
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
8
|
-
}
|
|
9
|
-
function i(e, t) {
|
|
10
|
-
return !e || r(e) ? e : r(e.default) ? e.default : t && r(e[t]) ? e[t] : t && r(e[t]?.default) ? e[t].default : e;
|
|
11
|
-
}
|
|
12
|
-
var a = i(n, "Line"), o = class n extends e {
|
|
13
|
-
static TYPE = "EraserDrawable";
|
|
14
|
-
constructor(e) {
|
|
15
|
-
super(e, n.TYPE);
|
|
16
|
-
let { startx: t, starty: r, points: i, posX: a, posY: o } = e;
|
|
17
|
-
this.points = i || [t, r], this.posX = a || 0, this.posY = o || 0;
|
|
18
|
-
}
|
|
19
|
-
registerMovement(e, t) {
|
|
20
|
-
this.points = [
|
|
21
|
-
...this.points,
|
|
22
|
-
e,
|
|
23
|
-
t
|
|
24
|
-
];
|
|
25
|
-
}
|
|
26
|
-
handleDragEnd = (e, t) => {
|
|
27
|
-
this.posX = t.target.getX(), this.posY = t.target.getY(), e.handleSessionChange();
|
|
28
|
-
};
|
|
29
|
-
render(e) {
|
|
30
|
-
let { draggable: n, key: r, onMouseOverElement: i, onMouseOutElement: o } = e;
|
|
31
|
-
return /* @__PURE__ */ t(a, {
|
|
32
|
-
draggable: n,
|
|
33
|
-
globalCompositeOperation: "destination-out",
|
|
34
|
-
tension: 0,
|
|
35
|
-
bezier: !0,
|
|
36
|
-
points: this.points,
|
|
37
|
-
onDragEnd: this.handleDragEnd.bind(this, e),
|
|
38
|
-
onMouseEnter: i,
|
|
39
|
-
onMouseLeave: o,
|
|
40
|
-
strokeStyle: "#df4b26",
|
|
41
|
-
lineJoin: "round",
|
|
42
|
-
lineWidth: "5",
|
|
43
|
-
fill: "white",
|
|
44
|
-
stroke: "white",
|
|
45
|
-
strokeWidth: 5,
|
|
46
|
-
x: this.posX,
|
|
47
|
-
y: this.posY
|
|
48
|
-
}, r);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
//#endregion
|
|
52
|
-
export { o as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/drawing-response/src/drawing-response/drawable-free-path.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import DrawableHelper from './drawable-helper.js';
|
|
11
|
-
export default class FreePathDrawable extends DrawableHelper {
|
|
12
|
-
static TYPE: string;
|
|
13
|
-
constructor(props: any);
|
|
14
|
-
registerMovement(x: any, y: any): void;
|
|
15
|
-
handleOnClick(props: any): void;
|
|
16
|
-
handleDragEnd: any;
|
|
17
|
-
render(props: any): React.JSX.Element;
|
|
18
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import e from "./drawable-helper.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import { Line as n } from "react-konva";
|
|
5
|
-
//#region src/delivery/drawing-response/drawable-free-path.tsx
|
|
6
|
-
function r(e) {
|
|
7
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
8
|
-
}
|
|
9
|
-
function i(e, t) {
|
|
10
|
-
return !e || r(e) ? e : r(e.default) ? e.default : t && r(e[t]) ? e[t] : t && r(e[t]?.default) ? e[t].default : e;
|
|
11
|
-
}
|
|
12
|
-
var a = i(n, "Line"), o = class n extends e {
|
|
13
|
-
static TYPE = "FreePathDrawable";
|
|
14
|
-
constructor(e) {
|
|
15
|
-
super(e, n.TYPE);
|
|
16
|
-
let { startx: t, starty: r, points: i, posX: a, posY: o } = e;
|
|
17
|
-
this.points = i || [t, r], this.posX = a || 0, this.posY = o || 0;
|
|
18
|
-
}
|
|
19
|
-
registerMovement(e, t) {
|
|
20
|
-
this.points = [
|
|
21
|
-
...this.points,
|
|
22
|
-
e,
|
|
23
|
-
t
|
|
24
|
-
];
|
|
25
|
-
}
|
|
26
|
-
handleOnClick(e) {
|
|
27
|
-
let { paint: t, paintColor: n, forceUpdate: r } = e;
|
|
28
|
-
t && (this.paintColor = n, r());
|
|
29
|
-
}
|
|
30
|
-
handleDragEnd = (e, t) => {
|
|
31
|
-
this.posX = t.target.getX(), this.posY = t.target.getY(), e.handleSessionChange();
|
|
32
|
-
};
|
|
33
|
-
render(e) {
|
|
34
|
-
let { draggable: n, key: r, onMouseOverElement: i, onMouseOutElement: o } = e;
|
|
35
|
-
return /* @__PURE__ */ t(a, {
|
|
36
|
-
draggable: n,
|
|
37
|
-
tension: 0,
|
|
38
|
-
bezier: !0,
|
|
39
|
-
points: this.points,
|
|
40
|
-
fill: this.paintColor || this.fillColor,
|
|
41
|
-
onClick: () => this.handleOnClick(e),
|
|
42
|
-
onDragEnd: this.handleDragEnd.bind(this, e),
|
|
43
|
-
onMouseEnter: i,
|
|
44
|
-
onMouseLeave: o,
|
|
45
|
-
stroke: this.paintColor || this.outlineColor,
|
|
46
|
-
x: this.posX,
|
|
47
|
-
y: this.posY
|
|
48
|
-
}, r);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
//#endregion
|
|
52
|
-
export { o as default };
|