@pie-element/explicit-constructed-response 11.1.1 → 11.1.2-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/_virtual/_rolldown/runtime.js +4 -0
  4. package/dist/author/alternateResponses.d.ts +34 -0
  5. package/dist/author/alternateResponses.js +113 -0
  6. package/dist/author/alternateSection.d.ts +58 -0
  7. package/dist/author/alternateSection.js +213 -0
  8. package/dist/author/defaults.d.ts +186 -0
  9. package/dist/author/defaults.js +128 -0
  10. package/dist/author/ecr-toolbar.d.ts +41 -0
  11. package/dist/author/ecr-toolbar.js +100 -0
  12. package/dist/author/index.d.ts +42 -0
  13. package/dist/author/index.js +96 -0
  14. package/dist/author/main.d.ts +38 -0
  15. package/dist/author/main.js +291 -0
  16. package/dist/author/markupUtils.d.ts +14 -0
  17. package/dist/author/markupUtils.js +13 -0
  18. package/dist/author/utils.d.ts +9 -0
  19. package/dist/author/utils.js +7 -0
  20. package/dist/browser/author/index.js +3378 -0
  21. package/dist/browser/author/index.js.map +1 -0
  22. package/dist/browser/browser-BC3WygxE.js +360 -0
  23. package/dist/browser/browser-BC3WygxE.js.map +1 -0
  24. package/dist/browser/controller/index.js +4152 -0
  25. package/dist/browser/controller/index.js.map +1 -0
  26. package/dist/browser/delivery/index.js +96 -0
  27. package/dist/browser/delivery/index.js.map +1 -0
  28. package/dist/browser/dist-D5D48-XD.js +45656 -0
  29. package/dist/browser/dist-D5D48-XD.js.map +1 -0
  30. package/dist/browser/dist-D9ARZhQk.js +1426 -0
  31. package/dist/browser/dist-D9ARZhQk.js.map +1 -0
  32. package/dist/browser/explicit-constructed-response.css +2 -0
  33. package/dist/browser/main-B4lD1zyg.js +959 -0
  34. package/dist/browser/main-B4lD1zyg.js.map +1 -0
  35. package/dist/browser/print/index.js +40 -0
  36. package/dist/browser/print/index.js.map +1 -0
  37. package/dist/controller/defaults.d.ts +25 -0
  38. package/dist/controller/defaults.js +19 -0
  39. package/dist/controller/index.d.ts +64 -0
  40. package/dist/controller/index.js +139 -0
  41. package/dist/delivery/index.d.ts +20 -0
  42. package/dist/delivery/index.js +66 -0
  43. package/dist/delivery/main.d.ts +48 -0
  44. package/dist/delivery/main.js +115 -0
  45. package/dist/explicit-constructed-response.css +2 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.iife.d.ts +8 -0
  48. package/dist/index.iife.js +393 -0
  49. package/dist/index.js +2 -0
  50. package/dist/node_modules/.bun/he@1.2.0/node_modules/he/he.js +3993 -0
  51. package/dist/print/index.d.ts +15 -0
  52. package/dist/print/index.js +40 -0
  53. package/dist/runtime-support.d.ts +12 -0
  54. package/dist/runtime-support.js +12 -0
  55. package/package.json +94 -26
  56. package/CHANGELOG.json +0 -1102
  57. package/CHANGELOG.md +0 -2187
  58. package/LICENSE.md +0 -5
  59. package/README.md +0 -1
  60. package/configure/CHANGELOG.json +0 -652
  61. package/configure/CHANGELOG.md +0 -1928
  62. package/configure/lib/alternateResponses.js +0 -199
  63. package/configure/lib/alternateResponses.js.map +0 -1
  64. package/configure/lib/alternateSection.js +0 -329
  65. package/configure/lib/alternateSection.js.map +0 -1
  66. package/configure/lib/defaults.js +0 -184
  67. package/configure/lib/defaults.js.map +0 -1
  68. package/configure/lib/ecr-toolbar.js +0 -181
  69. package/configure/lib/ecr-toolbar.js.map +0 -1
  70. package/configure/lib/index.js +0 -161
  71. package/configure/lib/index.js.map +0 -1
  72. package/configure/lib/main.js +0 -514
  73. package/configure/lib/main.js.map +0 -1
  74. package/configure/lib/markupUtils.js +0 -70
  75. package/configure/lib/markupUtils.js.map +0 -1
  76. package/configure/lib/utils.js +0 -15
  77. package/configure/lib/utils.js.map +0 -1
  78. package/configure/package.json +0 -22
  79. package/controller/CHANGELOG.json +0 -517
  80. package/controller/CHANGELOG.md +0 -1344
  81. package/controller/lib/defaults.js +0 -23
  82. package/controller/lib/defaults.js.map +0 -1
  83. package/controller/lib/index.js +0 -368
  84. package/controller/lib/index.js.map +0 -1
  85. package/controller/package.json +0 -18
  86. package/docs/config-schema.json +0 -2629
  87. package/docs/config-schema.json.md +0 -1941
  88. package/docs/demo/config.js +0 -8
  89. package/docs/demo/generate.js +0 -20
  90. package/docs/demo/index.html +0 -1
  91. package/docs/demo/session.js +0 -10
  92. package/docs/pie-schema.json +0 -1130
  93. package/docs/pie-schema.json.md +0 -814
  94. package/lib/index.js +0 -91
  95. package/lib/index.js.map +0 -1
  96. package/lib/main.js +0 -205
  97. package/lib/main.js.map +0 -1
  98. package/lib/print.js +0 -71
  99. package/lib/print.js.map +0 -1
  100. package/module/configure.js +0 -1
  101. package/module/controller.js +0 -6534
  102. package/module/demo.js +0 -45
  103. package/module/element.js +0 -1
  104. package/module/index.html +0 -21
  105. package/module/manifest.json +0 -18
  106. package/module/print-demo.js +0 -83
  107. package/module/print.html +0 -18
  108. package/module/print.js +0 -1
@@ -0,0 +1,128 @@
1
+ //#region src/author/defaults.ts
2
+ var e = {
3
+ model: {
4
+ choices: {},
5
+ displayType: "block",
6
+ markup: "",
7
+ maxLengthPerChoiceEnabled: !0,
8
+ playerSpellCheckEnabled: !0,
9
+ prompt: "",
10
+ promptEnabled: !0,
11
+ rationale: "",
12
+ rationaleEnabled: !0,
13
+ spellCheckEnabled: !0,
14
+ studentInstructionsEnabled: !0,
15
+ teacherInstructions: "",
16
+ teacherInstructionsEnabled: !0,
17
+ toolbarEditorPosition: "bottom",
18
+ responseAreaInputConfiguration: {}
19
+ },
20
+ configuration: {
21
+ baseInputConfiguration: {
22
+ h3: { disabled: !0 },
23
+ html: { disabled: !0 },
24
+ audio: { disabled: !1 },
25
+ video: { disabled: !1 },
26
+ image: { disabled: !1 },
27
+ textAlign: { disabled: !0 },
28
+ showParagraphs: { disabled: !1 },
29
+ separateParagraphs: { disabled: !0 }
30
+ },
31
+ prompt: {
32
+ settings: !0,
33
+ label: "Prompt",
34
+ inputConfiguration: {
35
+ audio: { disabled: !1 },
36
+ video: { disabled: !1 },
37
+ image: { disabled: !1 }
38
+ },
39
+ required: !1
40
+ },
41
+ partialScoring: {
42
+ settings: !1,
43
+ label: "Allow Partial Scoring"
44
+ },
45
+ rationale: {
46
+ settings: !0,
47
+ label: "Rationale",
48
+ inputConfiguration: {
49
+ audio: { disabled: !1 },
50
+ video: { disabled: !1 },
51
+ image: { disabled: !1 }
52
+ },
53
+ required: !1
54
+ },
55
+ settingsPanelDisabled: !1,
56
+ spellCheck: {
57
+ label: "Spellcheck",
58
+ settings: !1,
59
+ enabled: !0
60
+ },
61
+ editSource: {
62
+ label: "Edit Source",
63
+ settings: !1,
64
+ enabled: !1
65
+ },
66
+ playerSpellCheck: {
67
+ label: "Student Spellcheck",
68
+ settings: !0,
69
+ enabled: !0
70
+ },
71
+ teacherInstructions: {
72
+ settings: !0,
73
+ label: "Teacher Instructions",
74
+ inputConfiguration: {
75
+ audio: { disabled: !1 },
76
+ video: { disabled: !1 },
77
+ image: { disabled: !1 }
78
+ },
79
+ required: !1
80
+ },
81
+ template: { inputConfiguration: {
82
+ audio: { disabled: !1 },
83
+ video: { disabled: !1 },
84
+ image: { disabled: !1 },
85
+ h3: { disabled: !0 },
86
+ blockquote: { disabled: !0 }
87
+ } },
88
+ maxLengthPerChoice: {
89
+ settings: !0,
90
+ label: "Maximum Length Per Choice"
91
+ },
92
+ maxResponseAreas: 10,
93
+ maxImageWidth: {
94
+ teacherInstructions: 300,
95
+ prompt: 300,
96
+ rationale: 300
97
+ },
98
+ maxImageHeight: {
99
+ teacherInstructions: 300,
100
+ prompt: 300,
101
+ rationale: 300
102
+ },
103
+ withRubric: {
104
+ settings: !1,
105
+ label: "Add Rubric"
106
+ },
107
+ mathMlOptions: {
108
+ mmlOutput: !1,
109
+ mmlEditing: !1
110
+ },
111
+ language: {
112
+ settings: !1,
113
+ label: "Specify Language",
114
+ enabled: !1
115
+ },
116
+ languageChoices: {
117
+ label: "Language Choices",
118
+ options: []
119
+ },
120
+ responseAreaInputConfiguration: { inputConfiguration: { characters: { disabled: !0 } } },
121
+ spanishButton: {
122
+ settings: !0,
123
+ label: "Disable Spanish Characters"
124
+ }
125
+ }
126
+ };
127
+ //#endregion
128
+ export { e as default };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/explicit-constructed-response/configure/src/ecr-toolbar.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 ECRToolbar extends React.Component {
12
+ static propTypes: {
13
+ correctChoice: PropTypes.Requireable<object>;
14
+ node: PropTypes.Requireable<object>;
15
+ pos: PropTypes.Requireable<number>;
16
+ onDone: PropTypes.Requireable<(...args: any[]) => any>;
17
+ onChangeResponse: PropTypes.Validator<(...args: any[]) => any>;
18
+ onToolbarDone: PropTypes.Validator<(...args: any[]) => any>;
19
+ value: PropTypes.Requireable<PropTypes.InferProps<{
20
+ change: PropTypes.Validator<(...args: any[]) => any>;
21
+ document: PropTypes.Requireable<PropTypes.InferProps<{
22
+ getNextText: PropTypes.Validator<(...args: any[]) => any>;
23
+ }>>;
24
+ }>>;
25
+ editor: PropTypes.Requireable<object>;
26
+ maxLengthPerChoiceEnabled: PropTypes.Requireable<boolean>;
27
+ pluginProps: PropTypes.Requireable<object>;
28
+ spellCheck: PropTypes.Requireable<boolean>;
29
+ };
30
+ state: {
31
+ markup: string;
32
+ toolbarStyle: {};
33
+ };
34
+ componentDidMount(): void;
35
+ onDone: any;
36
+ onRespAreaChange: any;
37
+ onKeyDown: any;
38
+ onBlur: any;
39
+ render(): React.JSX.Element;
40
+ }
41
+ export default ECRToolbar;
@@ -0,0 +1,100 @@
1
+ import { stripHtmlTags as e } from "./markupUtils.js";
2
+ import t from "react";
3
+ import n from "prop-types";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import { styled as i } from "@mui/material/styles";
6
+ import a from "@pie-lib/editable-html-tip-tap";
7
+ //#region src/author/ecr-toolbar.tsx
8
+ var o = i(a)(({ theme: e }) => ({
9
+ backgroundColor: e.palette.common.white,
10
+ outline: "none",
11
+ lineHeight: "15px"
12
+ })), s = class extends t.Component {
13
+ static propTypes = {
14
+ correctChoice: n.object,
15
+ node: n.object,
16
+ pos: n.number,
17
+ onDone: n.func,
18
+ onChangeResponse: n.func.isRequired,
19
+ onToolbarDone: n.func.isRequired,
20
+ value: n.shape({
21
+ change: n.func.isRequired,
22
+ document: n.shape({ getNextText: n.func.isRequired })
23
+ }),
24
+ editor: n.object,
25
+ maxLengthPerChoiceEnabled: n.bool,
26
+ pluginProps: n.object,
27
+ spellCheck: n.bool
28
+ };
29
+ state = {
30
+ markup: "",
31
+ toolbarStyle: {}
32
+ };
33
+ componentDidMount() {
34
+ let { correctChoice: e, node: t, editor: n } = this.props, r = e || {}, i = n.view.nodeDOM(n.state.selection.from);
35
+ if (i?.nodeType === 1) {
36
+ let e = i.getBoundingClientRect(), t = i.closest(".tiptap").getBoundingClientRect();
37
+ e.top - t.top, e.left - t.left, this.setState({
38
+ markup: r.label,
39
+ toolbarStyle: {
40
+ position: "absolute",
41
+ top: 0,
42
+ left: 0,
43
+ width: `${e.width - 4}px`
44
+ }
45
+ });
46
+ }
47
+ }
48
+ onDone = (t) => {
49
+ let { editor: n, node: r, onToolbarDone: i, onChangeResponse: a, pos: o } = this.props, s = e(t);
50
+ this.setState({ markup: s });
51
+ let { tr: c } = n.state, l = c.doc.nodeAt(o);
52
+ if (!l || l.isText || !l.isAtom || !l.isInline) return !1;
53
+ c.setNodeMarkup(o, void 0, {
54
+ ...r.attrs,
55
+ value: s
56
+ }), n.view.dispatch(c), i(!0), a(s);
57
+ };
58
+ onRespAreaChange = (e) => {
59
+ this.setState({ respAreaMarkup: e });
60
+ };
61
+ onKeyDown = (e) => e.key === "Enter";
62
+ onBlur = () => {
63
+ this.clickedInside &&= !1;
64
+ };
65
+ render() {
66
+ let { maxLengthPerChoiceEnabled: e, pluginProps: t, spellCheck: n } = this.props, { markup: i, toolbarStyle: a } = this.state, s = e ? {} : { maxLength: 25 };
67
+ return /* @__PURE__ */ r("div", {
68
+ style: a,
69
+ children: /* @__PURE__ */ r(o, {
70
+ autoFocus: !0,
71
+ disableUnderline: !0,
72
+ onChange: (e) => {
73
+ this.preventDone || this.onRespAreaChange(e);
74
+ },
75
+ onDone: (e) => {
76
+ this.preventDone || this.onDone(e);
77
+ },
78
+ onBlur: (e) => {
79
+ this.preventDone = e.relatedTarget && e.relatedTarget.closest(".insert-character-dialog"), this.onBlur(e);
80
+ },
81
+ onKeyDown: this.onKeyDown,
82
+ markup: i || "",
83
+ activePlugins: ["languageCharacters"],
84
+ pluginProps: t,
85
+ languageCharactersProps: [{ language: "spanish" }],
86
+ minHeight: "15px",
87
+ maxHeight: "15px",
88
+ spellCheck: n,
89
+ autoWidthToolbar: !0,
90
+ toolbarOpts: {
91
+ minWidth: "auto",
92
+ isHidden: !!t?.characters?.disabled
93
+ },
94
+ ...s
95
+ })
96
+ });
97
+ }
98
+ };
99
+ //#endregion
100
+ export { s as default };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/explicit-constructed-response/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 ExplicitConstructedResponse extends HTMLElement {
10
+ static prepareModel: (model?: {}) => {
11
+ slateMarkup: any;
12
+ markup: string;
13
+ choices: {};
14
+ displayType: string;
15
+ maxLengthPerChoiceEnabled: boolean;
16
+ playerSpellCheckEnabled: boolean;
17
+ prompt: string;
18
+ promptEnabled: boolean;
19
+ rationale: string;
20
+ rationaleEnabled: boolean;
21
+ spellCheckEnabled: boolean;
22
+ studentInstructionsEnabled: boolean;
23
+ teacherInstructions: string;
24
+ teacherInstructionsEnabled: boolean;
25
+ toolbarEditorPosition: string;
26
+ responseAreaInputConfiguration: {};
27
+ };
28
+ constructor();
29
+ set model(s: any);
30
+ set configuration(c: any);
31
+ set disableSidePanel(s: any);
32
+ dispatchModelUpdated(reset: any): void;
33
+ onModelChanged: any;
34
+ onConfigurationChanged: any;
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
+ }
@@ -0,0 +1,96 @@
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 { defaults as o, isArray as s } from "@pie-element/shared-lodash";
7
+ import c from "debug";
8
+ import { DeleteImageEvent as l, DeleteSoundEvent as u, InsertImageEvent as d, InsertSoundEvent as f, ModelUpdatedEvent as p } from "@pie-element/shared-configure-events";
9
+ //#region src/author/index.ts
10
+ var m = c("explicit-constructed-response:configure"), h = class c extends HTMLElement {
11
+ static prepareModel = (n = {}) => {
12
+ let i = {
13
+ ...r.model,
14
+ ...n
15
+ }, a = i.slateMarkup || e(i.markup, i.choices), o = t(a);
16
+ return i.choices && Object.keys(i.choices).forEach((e) => {
17
+ s(i.choices[e]) && (i.choices[e] = (i.choices[e] || []).map((e, t) => e.value ? e : (m("Choice does not contain \"value\" property, which is required.", e), {
18
+ value: `${t}`,
19
+ ...e
20
+ })));
21
+ }), {
22
+ ...i,
23
+ slateMarkup: a,
24
+ markup: o
25
+ };
26
+ };
27
+ constructor() {
28
+ super(), this._root = null, this._model = c.prepareModel(), this._configuration = r.configuration;
29
+ }
30
+ set model(e) {
31
+ this._model = c.prepareModel(e), this._model.responseAreaInputConfiguration && (this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration), this._render();
32
+ }
33
+ set configuration(e) {
34
+ this._configuration = o(e, r.configuration), e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.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({
35
+ value: this._model.language,
36
+ label: this._model.language
37
+ })) : delete this._model.language, this._render();
38
+ }
39
+ set disableSidePanel(e) {
40
+ this._disableSidePanel = e, this._render();
41
+ }
42
+ dispatchModelUpdated(e) {
43
+ let t = !!e;
44
+ this.dispatchEvent(new p(this._model, t));
45
+ }
46
+ onModelChanged = (e, t) => {
47
+ this._model = c.prepareModel({
48
+ ...this._model,
49
+ ...e
50
+ }), this._render(), this.dispatchModelUpdated(t);
51
+ };
52
+ onConfigurationChanged = (e) => {
53
+ this._configuration = e;
54
+ let t = this._configuration?.responseAreaInputConfiguration?.inputConfiguration;
55
+ this._model = {
56
+ ...this._model,
57
+ responseAreaInputConfiguration: t
58
+ }, this.onModelChanged(this._model);
59
+ };
60
+ insertImage(e) {
61
+ this.dispatchEvent(new d(e));
62
+ }
63
+ onDeleteImage(e, t) {
64
+ this.dispatchEvent(new l(e, t));
65
+ }
66
+ insertSound(e) {
67
+ this.dispatchEvent(new f(e));
68
+ }
69
+ onDeleteSound(e, t) {
70
+ this.dispatchEvent(new u(e, t));
71
+ }
72
+ _render() {
73
+ m("_render");
74
+ let e = i.createElement(n, {
75
+ model: this._model,
76
+ configuration: this._configuration,
77
+ onModelChanged: this.onModelChanged,
78
+ onConfigurationChanged: this.onConfigurationChanged,
79
+ disableSidePanel: this._disableSidePanel,
80
+ imageSupport: {
81
+ add: this.insertImage.bind(this),
82
+ delete: this.onDeleteImage.bind(this)
83
+ },
84
+ uploadSoundSupport: {
85
+ add: this.insertSound.bind(this),
86
+ delete: this.onDeleteSound.bind(this)
87
+ }
88
+ });
89
+ this._root ||= a(this), this._root.render(e);
90
+ }
91
+ disconnectedCallback() {
92
+ this._root && this._root.unmount();
93
+ }
94
+ };
95
+ //#endregion
96
+ export { h as default };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/explicit-constructed-response/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
+ componentDidMount(): void;
26
+ onModelChange: any;
27
+ onPromptChanged: any;
28
+ onRationaleChanged: any;
29
+ onTeacherInstructionsChanged: any;
30
+ onMarkupChanged: any;
31
+ onResponsesChanged: any;
32
+ onLengthChanged: any;
33
+ onChangeResponse: any;
34
+ onChange: any;
35
+ onHandleAreaChange: import("@pie-element/shared-lodash").CancelableFunction<(nodes: any) => void>;
36
+ render(): React.JSX.Element;
37
+ }
38
+ export default Main;