@pie-element/explicit-constructed-response 12.0.4-next.20261011174919 → 12.0.4

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.
@@ -1,137 +1,139 @@
1
+ import type { ConfigureLanguageOptionsProp } from '@pie-element/shared-types';
2
+ import type { Choices } from '../types.js';
1
3
  declare const _default: {
2
4
  model: {
3
- choices: {};
5
+ choices: Choices;
4
6
  displayType: string;
5
7
  markup: string;
6
- maxLengthPerChoiceEnabled: boolean;
7
- playerSpellCheckEnabled: boolean;
8
+ maxLengthPerChoiceEnabled: true;
9
+ playerSpellCheckEnabled: false;
8
10
  prompt: string;
9
- promptEnabled: boolean;
11
+ promptEnabled: true;
10
12
  rationale: string;
11
- rationaleEnabled: boolean;
12
- spellCheckEnabled: boolean;
13
- studentInstructionsEnabled: boolean;
13
+ rationaleEnabled: true;
14
+ spellCheckEnabled: true;
15
+ studentInstructionsEnabled: true;
14
16
  teacherInstructions: string;
15
- teacherInstructionsEnabled: boolean;
16
- toolbarEditorPosition: string;
17
+ teacherInstructionsEnabled: true;
18
+ toolbarEditorPosition: "bottom";
17
19
  responseAreaInputConfiguration: {};
18
20
  };
19
21
  configuration: {
20
22
  baseInputConfiguration: {
21
23
  h3: {
22
- disabled: boolean;
24
+ disabled: true;
23
25
  };
24
26
  html: {
25
- disabled: boolean;
27
+ disabled: true;
26
28
  };
27
29
  audio: {
28
- disabled: boolean;
30
+ disabled: false;
29
31
  };
30
32
  video: {
31
- disabled: boolean;
33
+ disabled: false;
32
34
  };
33
35
  image: {
34
- disabled: boolean;
36
+ disabled: false;
35
37
  };
36
38
  textAlign: {
37
- disabled: boolean;
39
+ disabled: true;
38
40
  };
39
41
  showParagraphs: {
40
- disabled: boolean;
42
+ disabled: false;
41
43
  };
42
44
  separateParagraphs: {
43
- disabled: boolean;
45
+ disabled: true;
44
46
  };
45
47
  };
46
48
  prompt: {
47
- settings: boolean;
49
+ settings: true;
48
50
  label: string;
49
51
  inputConfiguration: {
50
52
  audio: {
51
- disabled: boolean;
53
+ disabled: false;
52
54
  };
53
55
  video: {
54
- disabled: boolean;
56
+ disabled: false;
55
57
  };
56
58
  image: {
57
- disabled: boolean;
59
+ disabled: false;
58
60
  };
59
61
  };
60
- required: boolean;
62
+ required: false;
61
63
  };
62
64
  partialScoring: {
63
- settings: boolean;
65
+ settings: false;
64
66
  label: string;
65
67
  };
66
68
  rationale: {
67
- settings: boolean;
69
+ settings: true;
68
70
  label: string;
69
71
  inputConfiguration: {
70
72
  audio: {
71
- disabled: boolean;
73
+ disabled: false;
72
74
  };
73
75
  video: {
74
- disabled: boolean;
76
+ disabled: false;
75
77
  };
76
78
  image: {
77
- disabled: boolean;
79
+ disabled: false;
78
80
  };
79
81
  };
80
- required: boolean;
82
+ required: false;
81
83
  };
82
- settingsPanelDisabled: boolean;
84
+ settingsPanelDisabled: false;
83
85
  spellCheck: {
84
86
  label: string;
85
- settings: boolean;
86
- enabled: boolean;
87
+ settings: false;
88
+ enabled: true;
87
89
  };
88
90
  editSource: {
89
91
  label: string;
90
- settings: boolean;
91
- enabled: boolean;
92
+ settings: false;
93
+ enabled: false;
92
94
  };
93
95
  playerSpellCheck: {
94
96
  label: string;
95
- settings: boolean;
96
- enabled: boolean;
97
+ settings: true;
98
+ enabled: true;
97
99
  };
98
100
  teacherInstructions: {
99
- settings: boolean;
101
+ settings: true;
100
102
  label: string;
101
103
  inputConfiguration: {
102
104
  audio: {
103
- disabled: boolean;
105
+ disabled: false;
104
106
  };
105
107
  video: {
106
- disabled: boolean;
108
+ disabled: false;
107
109
  };
108
110
  image: {
109
- disabled: boolean;
111
+ disabled: false;
110
112
  };
111
113
  };
112
- required: boolean;
114
+ required: false;
113
115
  };
114
116
  template: {
115
117
  inputConfiguration: {
116
118
  audio: {
117
- disabled: boolean;
119
+ disabled: false;
118
120
  };
119
121
  video: {
120
- disabled: boolean;
122
+ disabled: false;
121
123
  };
122
124
  image: {
123
- disabled: boolean;
125
+ disabled: false;
124
126
  };
125
127
  h3: {
126
- disabled: boolean;
128
+ disabled: true;
127
129
  };
128
130
  blockquote: {
129
- disabled: boolean;
131
+ disabled: true;
130
132
  };
131
133
  };
132
134
  };
133
135
  maxLengthPerChoice: {
134
- settings: boolean;
136
+ settings: true;
135
137
  label: string;
136
138
  };
137
139
  maxResponseAreas: number;
@@ -146,31 +148,31 @@ declare const _default: {
146
148
  rationale: number;
147
149
  };
148
150
  withRubric: {
149
- settings: boolean;
151
+ settings: false;
150
152
  label: string;
151
153
  };
152
154
  mathMlOptions: {
153
- mmlOutput: boolean;
154
- mmlEditing: boolean;
155
+ mmlOutput: false;
156
+ mmlEditing: false;
155
157
  };
156
158
  language: {
157
- settings: boolean;
159
+ settings: false;
158
160
  label: string;
159
- enabled: boolean;
161
+ enabled: false;
160
162
  };
161
163
  languageChoices: {
162
164
  label: string;
163
- options: never[];
165
+ options: ConfigureLanguageOptionsProp[];
164
166
  };
165
167
  responseAreaInputConfiguration: {
166
168
  inputConfiguration: {
167
169
  characters: {
168
- disabled: boolean;
170
+ disabled: true;
169
171
  };
170
172
  };
171
173
  };
172
174
  spanishButton: {
173
- settings: boolean;
175
+ settings: true;
174
176
  label: string;
175
177
  };
176
178
  };
@@ -1,34 +1,24 @@
1
+ import { type DeleteDone, type ImageHandler, type SoundHandler } from '@pie-element/shared-configure-events';
2
+ import { type AuthorModel } from './main.js';
3
+ import type { ExplicitConstructedResponseConfiguration, ExplicitConstructedResponseModel } from '../types.js';
1
4
  export default class ExplicitConstructedResponse extends HTMLElement {
2
- static prepareModel: (model?: {}) => {
3
- slateMarkup: any;
4
- markup: string;
5
- choices: {};
6
- displayType: string;
7
- maxLengthPerChoiceEnabled: boolean;
8
- playerSpellCheckEnabled: boolean;
9
- prompt: string;
10
- promptEnabled: boolean;
11
- rationale: string;
12
- rationaleEnabled: boolean;
13
- spellCheckEnabled: boolean;
14
- studentInstructionsEnabled: boolean;
15
- teacherInstructions: string;
16
- teacherInstructionsEnabled: boolean;
17
- toolbarEditorPosition: string;
18
- responseAreaInputConfiguration: {};
19
- };
5
+ private _root;
6
+ private _model;
7
+ private _configuration;
8
+ private _disableSidePanel?;
9
+ static prepareModel: (model?: Partial<ExplicitConstructedResponseModel>) => AuthorModel;
20
10
  constructor();
21
- set model(s: any);
22
- set configuration(c: any);
23
- set disableSidePanel(s: any);
24
- dispatchModelUpdated(reset: any): void;
25
- onModelChanged: any;
26
- onConfigurationChanged: any;
11
+ set model(s: Partial<ExplicitConstructedResponseModel>);
12
+ set configuration(c: ExplicitConstructedResponseConfiguration);
13
+ set disableSidePanel(s: boolean);
14
+ dispatchModelUpdated(reset?: boolean): void;
15
+ onModelChanged: (m: Partial<AuthorModel>, reset?: boolean) => void;
16
+ onConfigurationChanged: (c: ExplicitConstructedResponseConfiguration) => void;
27
17
  /** @param {done, progress, file} handler */
28
- insertImage(handler: any): void;
29
- onDeleteImage(src: any, done: any): void;
30
- insertSound(handler: any): void;
31
- onDeleteSound(src: any, done: any): void;
18
+ insertImage(handler: ImageHandler): void;
19
+ onDeleteImage(src: string, done: DeleteDone): void;
20
+ insertSound(handler: SoundHandler): void;
21
+ onDeleteSound(src: string, done: DeleteDone): void;
32
22
  _render(): void;
33
23
  connectedCallback(): void;
34
24
  disconnectedCallback(): void;
@@ -8,6 +8,10 @@ import c from "debug";
8
8
  import { DeleteImageEvent as l, DeleteSoundEvent as u, InsertImageEvent as d, InsertSoundEvent as f, ModelUpdatedEvent as p } from "@pie-element/shared-configure-events";
9
9
  //#region src/author/index.ts
10
10
  var m = c("explicit-constructed-response:configure"), h = class c extends HTMLElement {
11
+ _root;
12
+ _model;
13
+ _configuration;
14
+ _disableSidePanel;
11
15
  static prepareModel = (n = {}) => {
12
16
  let i = {
13
17
  ...r.model,
@@ -31,7 +35,8 @@ var m = c("explicit-constructed-response:configure"), h = class c extends HTMLEl
31
35
  this._model = c.prepareModel(e), this._model.responseAreaInputConfiguration && (this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration), this._render();
32
36
  }
33
37
  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({
38
+ let t = o(e, r.configuration);
39
+ this._configuration = t, e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (t.language.enabled = !0, (!t.languageChoices.options || !t.languageChoices.options.length) && (t.languageChoices.options = []), t.languageChoices.options.find((e) => e.value === this._model.language) || t.languageChoices.options.push({
35
40
  value: this._model.language,
36
41
  label: this._model.language
37
42
  })) : delete this._model.language, this._render();
@@ -1,30 +1,48 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Main extends React.Component {
4
- static propTypes: {
5
- configuration: PropTypes.Validator<object>;
6
- model: PropTypes.Validator<object>;
7
- disableSidePanel: PropTypes.Requireable<boolean>;
8
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
9
- onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
10
- imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
11
- add: PropTypes.Validator<(...args: any[]) => any>;
12
- delete: PropTypes.Validator<(...args: any[]) => any>;
13
- }>>;
14
- uploadSoundSupport: PropTypes.Requireable<object>;
15
- };
16
- state: {};
2
+ import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { ExplicitConstructedResponseValidationErrors } from '../controller/index.js';
4
+ import type { Choices, ExplicitConstructedResponseConfiguration, ExplicitConstructedResponseModel } from '../types.js';
5
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
6
+ export type AuthorModel = Partial<ExplicitConstructedResponseModel> & {
7
+ choices: Choices;
8
+ markup: string;
9
+ slateMarkup: string;
10
+ errors?: ExplicitConstructedResponseValidationErrors;
11
+ };
12
+ type MediaSupport<Handler> = {
13
+ add: (handler: Handler) => void;
14
+ delete: (src: string, done: DeleteDone) => void;
15
+ };
16
+ export type MainProps = {
17
+ model: AuthorModel;
18
+ configuration: ExplicitConstructedResponseConfiguration;
19
+ disableSidePanel?: boolean;
20
+ onModelChanged: (model: Partial<AuthorModel>, reset?: boolean) => void;
21
+ onConfigurationChanged: (configuration: ExplicitConstructedResponseConfiguration, reset?: boolean) => void;
22
+ imageSupport?: MediaSupport<ImageHandler>;
23
+ uploadSoundSupport?: MediaSupport<SoundHandler>;
24
+ };
25
+ type State = {
26
+ /** The editor markup when the author mounted */
27
+ markup?: string;
28
+ /** Choices of response areas removed from the markup, kept so an undo restores them */
29
+ cachedChoices?: Choices;
30
+ };
31
+ export declare class Main extends React.Component<MainProps, State> {
32
+ state: State;
17
33
  componentDidMount(): void;
18
- onModelChange: any;
19
- onPromptChanged: any;
20
- onRationaleChanged: any;
21
- onTeacherInstructionsChanged: any;
22
- onMarkupChanged: any;
23
- onResponsesChanged: any;
24
- onLengthChanged: any;
25
- onChangeResponse: any;
26
- onChange: any;
27
- onHandleAreaChange: import("@pie-element/shared-lodash").CancelableFunction<(nodes: any) => void>;
34
+ onModelChange: (newVal: Partial<AuthorModel>) => void;
35
+ onPromptChanged: (prompt: string) => void;
36
+ onRationaleChanged: (rationale: string) => void;
37
+ onTeacherInstructionsChanged: (teacherInstructions: string) => void;
38
+ onMarkupChanged: (slateMarkup: string) => void;
39
+ onResponsesChanged: (choices: Choices) => void;
40
+ onLengthChanged: (maxLengthPerChoice: number[]) => void;
41
+ onChangeResponse: (index: string, newVal: string) => void;
42
+ onChange: (markup: string) => void;
43
+ onHandleAreaChange: import("@pie-element/shared-lodash").CancelableFunction<(nodes: {
44
+ index: string;
45
+ }[] | undefined) => void>;
28
46
  render(): React.JSX.Element;
29
47
  }
30
48
  export default Main;