@pie-element/drag-in-the-blank 10.1.2-next.2 → 10.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.
Files changed (85) hide show
  1. package/CHANGELOG.json +1042 -0
  2. package/CHANGELOG.md +2183 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +652 -0
  6. package/configure/CHANGELOG.md +1883 -0
  7. package/configure/lib/choice.js +137 -0
  8. package/configure/lib/choice.js.map +1 -0
  9. package/configure/lib/choices.js +319 -0
  10. package/configure/lib/choices.js.map +1 -0
  11. package/configure/lib/defaults.js +169 -0
  12. package/configure/lib/defaults.js.map +1 -0
  13. package/configure/lib/index.js +144 -0
  14. package/configure/lib/index.js.map +1 -0
  15. package/configure/lib/main.js +440 -0
  16. package/configure/lib/main.js.map +1 -0
  17. package/configure/lib/markupUtils.js +83 -0
  18. package/configure/lib/markupUtils.js.map +1 -0
  19. package/configure/package.json +25 -0
  20. package/configure/utils.js +17 -0
  21. package/controller/CHANGELOG.json +457 -0
  22. package/controller/CHANGELOG.md +1284 -0
  23. package/controller/lib/defaults.js +24 -0
  24. package/controller/lib/defaults.js.map +1 -0
  25. package/controller/lib/index.js +251 -0
  26. package/controller/lib/index.js.map +1 -0
  27. package/controller/lib/utils.js +39 -0
  28. package/controller/lib/utils.js.map +1 -0
  29. package/controller/package.json +16 -0
  30. package/docs/config-schema.json +2580 -0
  31. package/docs/config-schema.json.md +1905 -0
  32. package/docs/demo/config.js +8 -0
  33. package/docs/demo/generate.js +41 -0
  34. package/docs/demo/index.html +1 -0
  35. package/docs/demo/session.js +10 -0
  36. package/docs/pie-schema.json +1181 -0
  37. package/docs/pie-schema.json.md +853 -0
  38. package/lib/index.js +206 -0
  39. package/lib/index.js.map +1 -0
  40. package/lib/main.js +126 -0
  41. package/lib/main.js.map +1 -0
  42. package/package.json +22 -87
  43. package/configure.js +0 -2
  44. package/controller.js +0 -1
  45. package/dist/author/choice.d.ts +0 -22
  46. package/dist/author/choice.js +0 -88
  47. package/dist/author/choices.d.ts +0 -41
  48. package/dist/author/choices.js +0 -172
  49. package/dist/author/defaults.d.ts +0 -171
  50. package/dist/author/defaults.js +0 -123
  51. package/dist/author/index.d.ts +0 -42
  52. package/dist/author/index.js +0 -92
  53. package/dist/author/main.d.ts +0 -36
  54. package/dist/author/main.js +0 -301
  55. package/dist/author/markupUtils.d.ts +0 -17
  56. package/dist/author/markupUtils.js +0 -38
  57. package/dist/author/utils.d.ts +0 -9
  58. package/dist/author/utils.js +0 -7
  59. package/dist/browser/author/index.js +0 -39603
  60. package/dist/browser/author/index.js.map +0 -1
  61. package/dist/browser/controller/index.js +0 -176
  62. package/dist/browser/controller/index.js.map +0 -1
  63. package/dist/browser/delivery/index.js +0 -3414
  64. package/dist/browser/delivery/index.js.map +0 -1
  65. package/dist/browser/dist-BkH5WSi5.js +0 -121
  66. package/dist/browser/dist-BkH5WSi5.js.map +0 -1
  67. package/dist/browser/drag-in-the-blank.css +0 -2
  68. package/dist/browser/drag-provider-D0fyq5lq.js +0 -10946
  69. package/dist/browser/drag-provider-D0fyq5lq.js.map +0 -1
  70. package/dist/controller/defaults.d.ts +0 -26
  71. package/dist/controller/defaults.js +0 -20
  72. package/dist/controller/index.d.ts +0 -41
  73. package/dist/controller/index.js +0 -104
  74. package/dist/controller/utils.d.ts +0 -16
  75. package/dist/controller/utils.js +0 -14
  76. package/dist/delivery/index.d.ts +0 -21
  77. package/dist/delivery/index.js +0 -105
  78. package/dist/delivery/main.d.ts +0 -28
  79. package/dist/delivery/main.js +0 -83
  80. package/dist/index.d.ts +0 -1
  81. package/dist/index.iife.d.ts +0 -8
  82. package/dist/index.iife.js +0 -152
  83. package/dist/index.js +0 -2
  84. package/dist/runtime-support.d.ts +0 -12
  85. package/dist/runtime-support.js +0 -12
@@ -1,41 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/drag-in-the-blank/configure/src/choices.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
- export declare class Choices extends React.Component {
12
- static propTypes: {
13
- duplicates: PropTypes.Requireable<boolean>;
14
- error: PropTypes.Requireable<string>;
15
- model: PropTypes.Validator<object>;
16
- onChange: PropTypes.Validator<(...args: any[]) => any>;
17
- toolbarOpts: PropTypes.Requireable<object>;
18
- pluginProps: PropTypes.Requireable<object>;
19
- maxChoices: PropTypes.Requireable<number>;
20
- uploadSoundSupport: PropTypes.Requireable<object>;
21
- maxImageWidth: PropTypes.Requireable<number>;
22
- maxImageHeight: PropTypes.Requireable<number>;
23
- maxLength: PropTypes.Requireable<number>;
24
- };
25
- state: {
26
- warning: {
27
- open: boolean;
28
- };
29
- };
30
- preventDone: boolean;
31
- wrapperRef: React.RefObject<unknown>;
32
- componentDidUpdate(): void;
33
- onChoiceChanged: any;
34
- onChoiceDone: any;
35
- onChoiceFocus: (id: any) => void;
36
- onAddChoice: any;
37
- onChoiceRemove: any;
38
- getVisibleChoices: any;
39
- render(): React.JSX.Element;
40
- }
41
- export default Choices;
@@ -1,172 +0,0 @@
1
- import { choiceIsEmpty as e } from "./markupUtils.js";
2
- import t from "./choice.js";
3
- import n from "react";
4
- import { renderMath as r } from "@pie-element/shared-math-rendering-mathjax";
5
- import i from "prop-types";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- import { styled as s } from "@mui/material/styles";
8
- import c from "@pie-lib/editable-html-tip-tap";
9
- import { AlertDialog as l } from "@pie-lib/config-ui";
10
- import u from "@mui/material/Button";
11
- //#region src/author/choices.tsx
12
- var d = s("div")(({ theme: e }) => ({
13
- display: "flex",
14
- flexDirection: "column",
15
- marginBottom: e.spacing(1.5)
16
- })), f = s(u)({ marginLeft: "auto" }), p = s("div")(({ theme: e }) => ({
17
- alignItems: "flex-start",
18
- display: "flex",
19
- flexWrap: "wrap",
20
- justifyContent: "space-evenly",
21
- marginTop: e.spacing(1),
22
- "& > *": { margin: e.spacing(1) }
23
- })), m = s("div")(({ theme: e }) => ({
24
- fontSize: e.typography.fontSize - 2,
25
- color: e.palette.error.main,
26
- paddingBottom: e.spacing(2)
27
- })), h = class extends n.Component {
28
- static propTypes = {
29
- duplicates: i.bool,
30
- error: i.string,
31
- model: i.object.isRequired,
32
- onChange: i.func.isRequired,
33
- toolbarOpts: i.object,
34
- pluginProps: i.object,
35
- maxChoices: i.number,
36
- uploadSoundSupport: i.object,
37
- maxImageWidth: i.number,
38
- maxImageHeight: i.number,
39
- maxLength: i.number
40
- };
41
- state = { warning: { open: !1 } };
42
- preventDone = !1;
43
- wrapperRef = n.createRef(null);
44
- componentDidUpdate() {
45
- this.focusedNodeRef && this.focusedNodeRef.focus("end"), r(this.wrapperRef.current);
46
- }
47
- onChoiceChanged = (t, n, r) => {
48
- let { onChange: i, model: a } = this.props, { choices: o, correctResponse: s, alternateResponses: c } = a;
49
- if (e({ value: t }) && e({ value: n })) return;
50
- if ((o || []).find((e) => e.value === n && e.id !== r)) {
51
- t === "" && i((o || []).filter((e) => e.id !== r)), this.setState({ warning: {
52
- open: !0,
53
- text: "Identical answer choices are not allowed and the changes will be discarded."
54
- } });
55
- return;
56
- }
57
- let l = o?.map((e) => e.id === r ? {
58
- ...e,
59
- value: n
60
- } : e) || [];
61
- if (!e({ value: n })) {
62
- i(l);
63
- return;
64
- }
65
- let u = !1;
66
- if (s && Object.keys(s).forEach((e) => {
67
- s[e] === r && (u = !0);
68
- }), c && !u && Object.values(c).forEach((e) => {
69
- e.indexOf(r) >= 0 && (u = !0);
70
- }), u) {
71
- this.setState({ warning: {
72
- open: !0,
73
- text: "Answer choices cannot be blank and the changes will be discarded."
74
- } });
75
- return;
76
- }
77
- i(l);
78
- };
79
- onChoiceDone = (t) => {
80
- let { onChange: n, model: r } = this.props, { choices: i } = r, a = (i || []).find((e) => e.id === t);
81
- if (!a || !e(a)) {
82
- this.setState({ focusedEl: void 0 });
83
- return;
84
- }
85
- n((i || []).filter((e) => e.id !== t)), this.setState({
86
- focusedEl: void 0,
87
- warning: {
88
- open: !0,
89
- text: "Answer choices cannot be blank."
90
- }
91
- });
92
- };
93
- onChoiceFocus = (e) => this.setState({ focusedEl: e });
94
- onAddChoice = () => {
95
- let { model: { choices: e }, onChange: t } = this.props, n = `${(e.length > 0 ? Math.max(...e.map((e) => parseInt(e.id, 10) || 0)) : -1) + 1}`;
96
- this.setState({ focusedEl: n }, () => {
97
- t([...e, {
98
- id: n,
99
- value: ""
100
- }]);
101
- });
102
- };
103
- onChoiceRemove = (e) => {
104
- let { onChange: t, model: { choices: n } } = this.props;
105
- t((n || []).filter((t) => t.id !== e));
106
- };
107
- getVisibleChoices = () => {
108
- let { duplicates: e, model: { choices: t, correctResponse: n } } = this.props;
109
- return t ? e ? t : t.filter((e) => !(n && Object.values(n).includes(e.id))) : [];
110
- };
111
- render() {
112
- let { focusedEl: e, warning: n } = this.state, { duplicates: r, error: i, mathMlOptions: s = {}, maxChoices: u, model: { choices: h }, toolbarOpts: g, uploadSoundSupport: _, imageSupport: v = {}, pluginProps: y = {}, maxImageWidth: b, maxImageHeight: x, maxLength: S } = this.props, C = this.getVisibleChoices() || [];
113
- return /* @__PURE__ */ o(d, {
114
- ref: this.wrapperRef,
115
- children: [
116
- /* @__PURE__ */ a(f, {
117
- variant: "contained",
118
- color: "primary",
119
- onClick: this.onAddChoice,
120
- disabled: u && h && u === h.length,
121
- children: "Add Choice"
122
- }),
123
- /* @__PURE__ */ a(p, { children: C.map((n, o) => !n || !n.id ? null : e === n.id ? /* @__PURE__ */ a("div", {
124
- style: {
125
- minWidth: "100%",
126
- zIndex: "100"
127
- },
128
- children: /* @__PURE__ */ a(c, {
129
- ref: (e) => this.focusedNodeRef = e,
130
- autoFocus: !0,
131
- imageSupport: v,
132
- markup: n.value,
133
- pluginProps: y,
134
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
135
- onChange: (e) => {
136
- this.preventDone || this.onChoiceChanged(n.value, e, n.id);
137
- },
138
- onDone: () => {
139
- this.preventDone || this.onChoiceDone(n.id);
140
- },
141
- onBlur: (e) => {
142
- let t = e.relatedTarget && e.relatedTarget.closest(".insert-character-dialog");
143
- this.preventDone = t;
144
- },
145
- disableUnderline: !0,
146
- toolbarOpts: g,
147
- uploadSoundSupport: _,
148
- mathMlOptions: s,
149
- maxImageHeight: x,
150
- maxImageWidth: b,
151
- charactersLimit: S
152
- })
153
- }, o) : /* @__PURE__ */ a(t, {
154
- duplicates: r,
155
- choice: n,
156
- error: i,
157
- onClick: () => this.onChoiceFocus(n.id),
158
- onRemoveChoice: () => this.onChoiceRemove(n.id)
159
- }, o)) }),
160
- i && /* @__PURE__ */ a(m, { children: i }),
161
- /* @__PURE__ */ a(l, {
162
- open: n.open,
163
- title: "Warning",
164
- text: n.text,
165
- onConfirm: () => this.setState({ warning: { open: !1 } })
166
- })
167
- ]
168
- });
169
- }
170
- };
171
- //#endregion
172
- export { h as default };
@@ -1,171 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/drag-in-the-blank/configure/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
- model: {
11
- choices: never[];
12
- choicesPosition: string;
13
- correctResponse: {};
14
- disabled: boolean;
15
- duplicates: boolean;
16
- markup: string;
17
- mode: string;
18
- prompt: string;
19
- promptEnabled: boolean;
20
- rationale: string;
21
- rationaleEnabled: boolean;
22
- studentInstructionsEnabled: boolean;
23
- teacherInstructions: string;
24
- teacherInstructionsEnabled: boolean;
25
- toolbarEditorPosition: string;
26
- };
27
- configuration: {
28
- baseInputConfiguration: {
29
- audio: {
30
- disabled: boolean;
31
- };
32
- video: {
33
- disabled: boolean;
34
- };
35
- image: {
36
- disabled: boolean;
37
- };
38
- h3: {
39
- disabled: boolean;
40
- };
41
- blockquote: {
42
- disabled: boolean;
43
- };
44
- textAlign: {
45
- disabled: boolean;
46
- };
47
- showParagraphs: {
48
- disabled: boolean;
49
- };
50
- separateParagraphs: {
51
- disabled: boolean;
52
- };
53
- };
54
- spellCheck: {
55
- label: string;
56
- settings: boolean;
57
- enabled: boolean;
58
- };
59
- choicesPosition: {
60
- settings: boolean;
61
- label: string;
62
- };
63
- prompt: {
64
- settings: boolean;
65
- label: string;
66
- inputConfiguration: {
67
- audio: {
68
- disabled: boolean;
69
- };
70
- video: {
71
- disabled: boolean;
72
- };
73
- image: {
74
- disabled: boolean;
75
- };
76
- };
77
- required: boolean;
78
- };
79
- addChoice: {
80
- inputConfiguration: {
81
- audio: {
82
- disabled: boolean;
83
- };
84
- video: {
85
- disabled: boolean;
86
- };
87
- image: {
88
- disabled: boolean;
89
- };
90
- };
91
- };
92
- duplicates: {
93
- settings: boolean;
94
- label: string;
95
- };
96
- lockChoiceOrder: {
97
- settings: boolean;
98
- label: string;
99
- };
100
- partialScoring: {
101
- settings: boolean;
102
- label: string;
103
- };
104
- rationale: {
105
- settings: boolean;
106
- label: string;
107
- inputConfiguration: {
108
- audio: {
109
- disabled: boolean;
110
- };
111
- video: {
112
- disabled: boolean;
113
- };
114
- image: {
115
- disabled: boolean;
116
- };
117
- };
118
- required: boolean;
119
- };
120
- settingsPanelDisabled: boolean;
121
- teacherInstructions: {
122
- settings: boolean;
123
- label: string;
124
- inputConfiguration: {
125
- audio: {
126
- disabled: boolean;
127
- };
128
- video: {
129
- disabled: boolean;
130
- };
131
- image: {
132
- disabled: boolean;
133
- };
134
- };
135
- required: boolean;
136
- };
137
- minChoices: number;
138
- maxResponseAreas: number;
139
- maxImageWidth: {
140
- teacherInstructions: number;
141
- prompt: number;
142
- rationale: number;
143
- choice: number;
144
- };
145
- maxImageHeight: {
146
- teacherInstructions: number;
147
- prompt: number;
148
- rationale: number;
149
- choice: number;
150
- };
151
- withRubric: {
152
- settings: boolean;
153
- label: string;
154
- };
155
- mathMlOptions: {
156
- mmlOutput: boolean;
157
- mmlEditing: boolean;
158
- };
159
- language: {
160
- settings: boolean;
161
- label: string;
162
- enabled: boolean;
163
- };
164
- languageChoices: {
165
- label: string;
166
- options: never[];
167
- };
168
- maxLength: number;
169
- };
170
- };
171
- export default _default;
@@ -1,123 +0,0 @@
1
- //#region src/author/defaults.ts
2
- var e = {
3
- model: {
4
- choices: [],
5
- choicesPosition: "below",
6
- correctResponse: {},
7
- disabled: !1,
8
- duplicates: !0,
9
- markup: "",
10
- mode: "gather",
11
- prompt: "",
12
- promptEnabled: !0,
13
- rationale: "",
14
- rationaleEnabled: !0,
15
- studentInstructionsEnabled: !0,
16
- teacherInstructions: "",
17
- teacherInstructionsEnabled: !0,
18
- toolbarEditorPosition: "bottom"
19
- },
20
- configuration: {
21
- baseInputConfiguration: {
22
- audio: { disabled: !1 },
23
- video: { disabled: !1 },
24
- image: { disabled: !1 },
25
- h3: { disabled: !0 },
26
- blockquote: { disabled: !0 },
27
- textAlign: { disabled: !0 },
28
- showParagraphs: { disabled: !1 },
29
- separateParagraphs: { disabled: !0 }
30
- },
31
- spellCheck: {
32
- label: "Spellcheck",
33
- settings: !1,
34
- enabled: !0
35
- },
36
- choicesPosition: {
37
- settings: !0,
38
- label: "Choices Position"
39
- },
40
- prompt: {
41
- settings: !0,
42
- label: "Prompt",
43
- inputConfiguration: {
44
- audio: { disabled: !1 },
45
- video: { disabled: !1 },
46
- image: { disabled: !1 }
47
- },
48
- required: !1
49
- },
50
- addChoice: { inputConfiguration: {
51
- audio: { disabled: !0 },
52
- video: { disabled: !0 },
53
- image: { disabled: !1 }
54
- } },
55
- duplicates: {
56
- settings: !0,
57
- label: "Duplicates"
58
- },
59
- lockChoiceOrder: {
60
- settings: !0,
61
- label: "Lock Choice Order"
62
- },
63
- partialScoring: {
64
- settings: !1,
65
- label: "Allow Partial Scoring"
66
- },
67
- rationale: {
68
- settings: !0,
69
- label: "Rationale",
70
- inputConfiguration: {
71
- audio: { disabled: !1 },
72
- video: { disabled: !1 },
73
- image: { disabled: !1 }
74
- },
75
- required: !1
76
- },
77
- settingsPanelDisabled: !1,
78
- teacherInstructions: {
79
- settings: !0,
80
- label: "Teacher Instructions",
81
- inputConfiguration: {
82
- audio: { disabled: !1 },
83
- video: { disabled: !1 },
84
- image: { disabled: !1 }
85
- },
86
- required: !1
87
- },
88
- minChoices: 2,
89
- maxResponseAreas: 10,
90
- maxImageWidth: {
91
- teacherInstructions: 300,
92
- prompt: 300,
93
- rationale: 300,
94
- choice: 300
95
- },
96
- maxImageHeight: {
97
- teacherInstructions: 300,
98
- prompt: 300,
99
- rationale: 300,
100
- choice: 300
101
- },
102
- withRubric: {
103
- settings: !1,
104
- label: "Add Rubric"
105
- },
106
- mathMlOptions: {
107
- mmlOutput: !1,
108
- mmlEditing: !1
109
- },
110
- language: {
111
- settings: !1,
112
- label: "Specify Language",
113
- enabled: !1
114
- },
115
- languageChoices: {
116
- label: "Language Choices",
117
- options: []
118
- },
119
- maxLength: 200
120
- }
121
- };
122
- //#endregion
123
- export { e as default };
@@ -1,42 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/drag-in-the-blank/configure/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 default class DragInTheBlank extends HTMLElement {
10
- static prepareModel: (model?: {}) => {
11
- slateMarkup: any;
12
- markup: string;
13
- correctResponse: any;
14
- choices: never[];
15
- choicesPosition: string;
16
- disabled: boolean;
17
- duplicates: boolean;
18
- mode: string;
19
- prompt: string;
20
- promptEnabled: boolean;
21
- rationale: string;
22
- rationaleEnabled: boolean;
23
- studentInstructionsEnabled: boolean;
24
- teacherInstructions: string;
25
- teacherInstructionsEnabled: boolean;
26
- toolbarEditorPosition: string;
27
- };
28
- constructor();
29
- set model(m: any);
30
- set configuration(c: any);
31
- set disableSidePanel(s: any);
32
- dispatchModelUpdated(reset: any): void;
33
- onModelChanged(m: any, reset: any): void;
34
- onConfigurationChanged(c: any): void;
35
- /** @param {done, progress, file} handler */
36
- insertImage(handler: any): void;
37
- onDeleteImage(src: any, done: any): void;
38
- insertSound(handler: any): void;
39
- onDeleteSound(src: any, done: any): void;
40
- _render(): void;
41
- disconnectedCallback(): void;
42
- }
@@ -1,92 +0,0 @@
1
- import { createSlateMarkup as e, processMarkup as t } from "./markupUtils.js";
2
- import n from "./main.js";
3
- import r from "./defaults.js";
4
- import i from "react";
5
- import { createRoot as a } from "react-dom/client";
6
- import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
7
- import { defaults as s } from "@pie-element/shared-lodash";
8
- import { DeleteImageEvent as c, DeleteSoundEvent as l, InsertImageEvent as u, InsertSoundEvent as d, ModelUpdatedEvent as f } from "@pie-element/shared-configure-events";
9
- import p from "debug";
10
- //#region src/author/index.tsx
11
- var m = p("multiple-choice:configure"), h = class p extends HTMLElement {
12
- static prepareModel = (n = {}) => {
13
- let i = {
14
- ...r.model,
15
- ...n
16
- }, a = n.slateMarkup || e(i.markup, i.choices, i.correctResponse), o = t(a);
17
- return {
18
- ...i,
19
- slateMarkup: a,
20
- markup: o.markup,
21
- correctResponse: o.correctResponse
22
- };
23
- };
24
- constructor() {
25
- super(), this._root = null, this._model = p.prepareModel(), this._configuration = r.configuration, this.onModelChanged = this.onModelChanged.bind(this), this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
26
- }
27
- set model(e) {
28
- let t = {
29
- ...e,
30
- markup: `<div>${e.markup || r.model.markup}</div>`
31
- };
32
- this._model = p.prepareModel(t), this._render();
33
- }
34
- set configuration(e) {
35
- let t = s(e, r.configuration);
36
- this._configuration = t, t?.language?.enabled ? t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value) : t.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
37
- value: this._model.language,
38
- label: this._model.language
39
- })) : delete this._model.language, this._render();
40
- }
41
- set disableSidePanel(e) {
42
- this._disableSidePanel = e, this._render();
43
- }
44
- dispatchModelUpdated(e) {
45
- let t = !!e;
46
- this.dispatchEvent(new f(this._model, t));
47
- }
48
- onModelChanged(e, t) {
49
- this._model = p.prepareModel(e), this._render(), this.dispatchModelUpdated(t);
50
- }
51
- onConfigurationChanged(e) {
52
- this._configuration = e, this._render();
53
- }
54
- insertImage(e) {
55
- this.dispatchEvent(new u(e));
56
- }
57
- onDeleteImage(e, t) {
58
- this.dispatchEvent(new c(e, t));
59
- }
60
- insertSound(e) {
61
- this.dispatchEvent(new d(e));
62
- }
63
- onDeleteSound(e, t) {
64
- this.dispatchEvent(new l(e, t));
65
- }
66
- _render() {
67
- m("_render");
68
- let e = i.createElement(n, {
69
- model: this._model,
70
- configuration: this._configuration,
71
- onModelChanged: this.onModelChanged,
72
- onConfigurationChanged: this.onConfigurationChanged,
73
- disableSidePanel: this._disableSidePanel,
74
- imageSupport: {
75
- add: this.insertImage.bind(this),
76
- delete: this.onDeleteImage.bind(this)
77
- },
78
- uploadSoundSupport: {
79
- add: this.insertSound.bind(this),
80
- delete: this.onDeleteSound.bind(this)
81
- }
82
- });
83
- this._root ||= a(this), this._root.render(e), setTimeout(() => {
84
- o(this);
85
- }, 0);
86
- }
87
- disconnectedCallback() {
88
- this._root && this._root.unmount();
89
- }
90
- };
91
- //#endregion
92
- export { h as default };
@@ -1,36 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/drag-in-the-blank/configure/src/main.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
- export declare class Main extends React.Component {
12
- static propTypes: {
13
- configuration: PropTypes.Validator<object>;
14
- model: PropTypes.Validator<object>;
15
- disableSidePanel: PropTypes.Requireable<boolean>;
16
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
17
- onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
18
- imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
19
- add: PropTypes.Validator<(...args: any[]) => any>;
20
- delete: PropTypes.Validator<(...args: any[]) => any>;
21
- }>>;
22
- uploadSoundSupport: PropTypes.Requireable<object>;
23
- };
24
- state: {
25
- activeDragItem: null;
26
- };
27
- constructor(props: any);
28
- onModelChange: any;
29
- onPromptChanged: any;
30
- onRationaleChanged: any;
31
- onTeacherInstructionsChanged: any;
32
- onMarkupChanged: any;
33
- onResponsesChanged: any;
34
- render(): React.JSX.Element;
35
- }
36
- export default Main;