@pie-element/ebsr 15.0.4-next.20261011174919 → 15.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.
Files changed (43) hide show
  1. package/dist/author/defaults.d.ts +96 -94
  2. package/dist/author/index.d.ts +18 -20
  3. package/dist/author/index.js +9 -5
  4. package/dist/author/main.d.ts +28 -10
  5. package/dist/author/main.js +58 -64
  6. package/dist/browser/author/index.js +28 -37
  7. package/dist/browser/author/index.js.map +1 -1
  8. package/dist/browser/controller/index.js +3 -3
  9. package/dist/browser/controller/index.js.map +1 -1
  10. package/dist/browser/delivery/index.js +2 -2
  11. package/dist/browser/{delivery-BYryTeI4.js → delivery-BwLF8ZCQ.js} +2 -2
  12. package/dist/browser/{delivery-BYryTeI4.js.map → delivery-BwLF8ZCQ.js.map} +1 -1
  13. package/dist/browser/editor-runtime/author/index.js +28 -37
  14. package/dist/browser/editor-runtime/author/index.js.map +1 -1
  15. package/dist/browser/editor-runtime/controller/index.js +3 -3
  16. package/dist/browser/editor-runtime/controller/index.js.map +1 -1
  17. package/dist/browser/editor-runtime/delivery/index.js +2 -2
  18. package/dist/browser/editor-runtime/{delivery-Dscd9Ayu.js → delivery-CGHdy5E6.js} +2 -2
  19. package/dist/browser/editor-runtime/{delivery-Dscd9Ayu.js.map → delivery-CGHdy5E6.js.map} +1 -1
  20. package/dist/browser/editor-runtime/{mathjax-CptWnMbQ-BrM8Bh6Q.js → mathjax-CptWnMbQ-CtyDL8bo.js} +2 -2
  21. package/dist/browser/editor-runtime/{mathjax-CptWnMbQ-BrM8Bh6Q.js.map → mathjax-CptWnMbQ-CtyDL8bo.js.map} +1 -1
  22. package/dist/browser/editor-runtime/print/index.js +2 -2
  23. package/dist/browser/editor-runtime/{private-tags-DO9IXiY5.js → private-tags-Dg3xBfFL.js} +3 -3
  24. package/dist/browser/editor-runtime/{private-tags-DO9IXiY5.js.map → private-tags-Dg3xBfFL.js.map} +1 -1
  25. package/dist/browser/{mathjax-CptWnMbQ-2vebNkbo.js → mathjax-CptWnMbQ-CvHw2WHg.js} +2 -2
  26. package/dist/browser/{mathjax-CptWnMbQ-2vebNkbo.js.map → mathjax-CptWnMbQ-CvHw2WHg.js.map} +1 -1
  27. package/dist/browser/print/index.js +2 -2
  28. package/dist/browser/{private-tags-Dyg_lpUm.js → private-tags-X98Rsyj9.js} +3 -3
  29. package/dist/browser/{private-tags-Dyg_lpUm.js.map → private-tags-X98Rsyj9.js.map} +1 -1
  30. package/dist/controller/defaults.d.ts +5 -4
  31. package/dist/controller/index.d.ts +38 -18
  32. package/dist/controller/index.js +3 -3
  33. package/dist/controller/utils.d.ts +4 -2
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.iife.js +1 -1
  36. package/dist/private-tags.js +1 -1
  37. package/dist/schemas/configuration.schema.json +505 -0
  38. package/dist/schemas/model.schema.json +619 -0
  39. package/dist/schemas/session.schema.json +74 -0
  40. package/dist/types.d.ts +86 -0
  41. package/module/print.js +1 -1
  42. package/module/print.js.map +1 -1
  43. package/package.json +16 -12
@@ -1,121 +1,123 @@
1
+ import type { ConfigureLanguageOptionsProp } from '@pie-element/shared-types';
2
+ import type { EbsrPart } from '../types.js';
1
3
  declare const _default: {
2
4
  model: {
3
- partLabels: boolean;
4
- partLabelType: string;
5
- partA: any;
6
- partB: any;
5
+ partLabels: false;
6
+ partLabelType: "Letters";
7
+ partA: EbsrPart;
8
+ partB: EbsrPart;
7
9
  };
8
10
  configuration: {
9
11
  baseInputConfiguration: {
10
12
  h3: {
11
- disabled: boolean;
13
+ disabled: true;
12
14
  };
13
15
  audio: {
14
- disabled: boolean;
16
+ disabled: false;
15
17
  };
16
18
  video: {
17
- disabled: boolean;
19
+ disabled: false;
18
20
  };
19
21
  image: {
20
- disabled: boolean;
22
+ disabled: false;
21
23
  };
22
24
  textAlign: {
23
- disabled: boolean;
25
+ disabled: true;
24
26
  };
25
27
  showParagraphs: {
26
- disabled: boolean;
28
+ disabled: false;
27
29
  };
28
30
  separateParagraphs: {
29
- disabled: boolean;
31
+ disabled: true;
30
32
  };
31
33
  };
32
34
  partialScoring: {
33
35
  label: string;
34
- settings: boolean;
36
+ settings: false;
35
37
  };
36
38
  scoringType: {
37
- settings: boolean;
39
+ settings: false;
38
40
  label: string;
39
41
  };
40
42
  partA: {
41
43
  addChoiceButton: {
42
- settings: boolean;
44
+ settings: true;
43
45
  label: string;
44
46
  };
45
47
  choiceMode: {
46
- settings: boolean;
48
+ settings: true;
47
49
  label: string;
48
50
  };
49
51
  choicePrefix: {
50
- settings: boolean;
52
+ settings: true;
51
53
  label: string;
52
54
  };
53
55
  deleteChoice: {
54
- settings: boolean;
56
+ settings: true;
55
57
  };
56
58
  feedback: {
57
- settings: boolean;
59
+ settings: true;
58
60
  label: string;
59
61
  };
60
62
  lockChoiceOrder: {
61
- settings: boolean;
63
+ settings: true;
62
64
  label: string;
63
65
  };
64
66
  prompt: {
65
- settings: boolean;
67
+ settings: true;
66
68
  label: string;
67
69
  inputConfiguration: {
68
70
  audio: {
69
- disabled: boolean;
71
+ disabled: false;
70
72
  };
71
73
  video: {
72
- disabled: boolean;
74
+ disabled: false;
73
75
  };
74
76
  image: {
75
- disabled: boolean;
77
+ disabled: false;
76
78
  };
77
79
  };
78
- required: boolean;
80
+ required: false;
79
81
  };
80
82
  rationale: {
81
- settings: boolean;
83
+ settings: true;
82
84
  label: string;
83
85
  inputConfiguration: {
84
86
  audio: {
85
- disabled: boolean;
87
+ disabled: false;
86
88
  };
87
89
  video: {
88
- disabled: boolean;
90
+ disabled: false;
89
91
  };
90
92
  image: {
91
- disabled: boolean;
93
+ disabled: false;
92
94
  };
93
95
  };
94
- required: boolean;
96
+ required: false;
95
97
  };
96
- settingsPanelDisabled: boolean;
98
+ settingsPanelDisabled: true;
97
99
  studentInstructions: {
98
- settings: boolean;
100
+ settings: false;
99
101
  label: string;
100
102
  };
101
103
  teacherInstructions: {
102
- settings: boolean;
104
+ settings: true;
103
105
  label: string;
104
106
  inputConfiguration: {
105
107
  audio: {
106
- disabled: boolean;
108
+ disabled: false;
107
109
  };
108
110
  video: {
109
- disabled: boolean;
111
+ disabled: false;
110
112
  };
111
113
  image: {
112
- disabled: boolean;
114
+ disabled: false;
113
115
  };
114
116
  };
115
- required: boolean;
117
+ required: false;
116
118
  };
117
119
  choicesLayout: {
118
- settings: boolean;
120
+ settings: false;
119
121
  label: string;
120
122
  };
121
123
  gridColumns: {
@@ -123,8 +125,8 @@ declare const _default: {
123
125
  };
124
126
  spellCheck: {
125
127
  label: string;
126
- settings: boolean;
127
- enabled: boolean;
128
+ settings: false;
129
+ enabled: true;
128
130
  };
129
131
  maxImageWidth: {
130
132
  teacherInstructions: number;
@@ -139,125 +141,125 @@ declare const _default: {
139
141
  choices: number;
140
142
  };
141
143
  mathMlOptions: {
142
- mmlOutput: boolean;
143
- mmlEditing: boolean;
144
+ mmlOutput: false;
145
+ mmlEditing: false;
144
146
  };
145
147
  choices: {
146
148
  inputConfiguration: {
147
149
  audio: {
148
- disabled: boolean;
150
+ disabled: false;
149
151
  };
150
152
  video: {
151
- disabled: boolean;
153
+ disabled: false;
152
154
  };
153
155
  image: {
154
- disabled: boolean;
156
+ disabled: false;
155
157
  };
156
158
  };
157
159
  };
158
160
  baseInputConfiguration: {
159
161
  h3: {
160
- disabled: boolean;
162
+ disabled: true;
161
163
  };
162
164
  audio: {
163
- disabled: boolean;
165
+ disabled: false;
164
166
  };
165
167
  video: {
166
- disabled: boolean;
168
+ disabled: false;
167
169
  };
168
170
  image: {
169
- disabled: boolean;
171
+ disabled: false;
170
172
  };
171
173
  textAlign: {
172
- disabled: boolean;
174
+ disabled: true;
173
175
  };
174
176
  showParagraphs: {
175
- disabled: boolean;
177
+ disabled: false;
176
178
  };
177
179
  separateParagraphs: {
178
- disabled: boolean;
180
+ disabled: true;
179
181
  };
180
182
  };
181
183
  };
182
184
  partB: {
183
185
  addChoiceButton: {
184
- settings: boolean;
186
+ settings: true;
185
187
  label: string;
186
188
  };
187
189
  choiceMode: {
188
- settings: boolean;
190
+ settings: true;
189
191
  label: string;
190
192
  };
191
193
  choicePrefix: {
192
- settings: boolean;
194
+ settings: true;
193
195
  label: string;
194
196
  };
195
197
  deleteChoice: {
196
- settings: boolean;
198
+ settings: true;
197
199
  };
198
200
  feedback: {
199
- settings: boolean;
201
+ settings: true;
200
202
  label: string;
201
203
  };
202
204
  lockChoiceOrder: {
203
- settings: boolean;
205
+ settings: true;
204
206
  label: string;
205
207
  };
206
208
  prompt: {
207
- settings: boolean;
209
+ settings: true;
208
210
  label: string;
209
211
  inputConfiguration: {
210
212
  audio: {
211
- disabled: boolean;
213
+ disabled: false;
212
214
  };
213
215
  video: {
214
- disabled: boolean;
216
+ disabled: false;
215
217
  };
216
218
  image: {
217
- disabled: boolean;
219
+ disabled: false;
218
220
  };
219
221
  };
220
- required: boolean;
222
+ required: false;
221
223
  };
222
224
  rationale: {
223
- settings: boolean;
225
+ settings: true;
224
226
  label: string;
225
227
  inputConfiguration: {
226
228
  audio: {
227
- disabled: boolean;
229
+ disabled: false;
228
230
  };
229
231
  video: {
230
- disabled: boolean;
232
+ disabled: false;
231
233
  };
232
234
  image: {
233
- disabled: boolean;
235
+ disabled: false;
234
236
  };
235
237
  };
236
- required: boolean;
238
+ required: false;
237
239
  };
238
- settingsPanelDisabled: boolean;
240
+ settingsPanelDisabled: true;
239
241
  studentInstructions: {
240
- settings: boolean;
242
+ settings: false;
241
243
  label: string;
242
244
  };
243
245
  teacherInstructions: {
244
- settings: boolean;
246
+ settings: true;
245
247
  label: string;
246
248
  inputConfiguration: {
247
249
  audio: {
248
- disabled: boolean;
250
+ disabled: false;
249
251
  };
250
252
  video: {
251
- disabled: boolean;
253
+ disabled: false;
252
254
  };
253
255
  image: {
254
- disabled: boolean;
256
+ disabled: false;
255
257
  };
256
258
  };
257
- required: boolean;
259
+ required: false;
258
260
  };
259
261
  choicesLayout: {
260
- settings: boolean;
262
+ settings: false;
261
263
  label: string;
262
264
  };
263
265
  gridColumns: {
@@ -265,8 +267,8 @@ declare const _default: {
265
267
  };
266
268
  spellCheck: {
267
269
  label: string;
268
- settings: boolean;
269
- enabled: boolean;
270
+ settings: false;
271
+ enabled: true;
270
272
  };
271
273
  maxImageWidth: {
272
274
  teacherInstructions: number;
@@ -281,59 +283,59 @@ declare const _default: {
281
283
  choices: number;
282
284
  };
283
285
  mathMlOptions: {
284
- mmlOutput: boolean;
285
- mmlEditing: boolean;
286
+ mmlOutput: false;
287
+ mmlEditing: false;
286
288
  };
287
289
  choices: {
288
290
  inputConfiguration: {
289
291
  audio: {
290
- disabled: boolean;
292
+ disabled: false;
291
293
  };
292
294
  video: {
293
- disabled: boolean;
295
+ disabled: false;
294
296
  };
295
297
  image: {
296
- disabled: boolean;
298
+ disabled: false;
297
299
  };
298
300
  };
299
301
  };
300
302
  baseInputConfiguration: {
301
303
  h3: {
302
- disabled: boolean;
304
+ disabled: true;
303
305
  };
304
306
  audio: {
305
- disabled: boolean;
307
+ disabled: false;
306
308
  };
307
309
  video: {
308
- disabled: boolean;
310
+ disabled: false;
309
311
  };
310
312
  image: {
311
- disabled: boolean;
313
+ disabled: false;
312
314
  };
313
315
  textAlign: {
314
- disabled: boolean;
316
+ disabled: true;
315
317
  };
316
318
  showParagraphs: {
317
- disabled: boolean;
319
+ disabled: false;
318
320
  };
319
321
  separateParagraphs: {
320
- disabled: boolean;
322
+ disabled: true;
321
323
  };
322
324
  };
323
325
  };
324
326
  partLabels: {
325
- settings: boolean;
327
+ settings: true;
326
328
  label: string;
327
329
  };
328
- settingsPanelDisabled: boolean;
330
+ settingsPanelDisabled: false;
329
331
  language: {
330
- settings: boolean;
332
+ settings: false;
331
333
  label: string;
332
- enabled: boolean;
334
+ enabled: false;
333
335
  };
334
336
  languageChoices: {
335
337
  label: string;
336
- options: never[];
338
+ options: ConfigureLanguageOptionsProp[];
337
339
  };
338
340
  };
339
341
  };
@@ -1,26 +1,24 @@
1
+ import { type AuthorModel } from './main.js';
2
+ import type { EbsrConfiguration, EbsrPart } from '../types.js';
3
+ /** A model handed to the author, whose parts may be incomplete. */
4
+ type AuthorModelInput = Omit<Partial<AuthorModel>, 'partA' | 'partB'> & {
5
+ partA?: Partial<EbsrPart>;
6
+ partB?: Partial<EbsrPart>;
7
+ };
1
8
  export default class EbsrConfigure extends HTMLElement {
2
- static createDefaultModel: ({ partA, partB, ...model }?: {
3
- partA?: {} | undefined;
4
- partB?: {} | undefined;
5
- }, defaults?: {
6
- partLabels: boolean;
7
- partLabelType: string;
8
- partA: any;
9
- partB: any;
10
- }) => {
11
- partA: any;
12
- partB: any;
13
- partLabels: boolean;
14
- partLabelType: string;
15
- };
9
+ private _root;
10
+ private _model;
11
+ private _configuration;
12
+ static createDefaultModel: ({ partA, partB, ...model }?: AuthorModelInput, defaults?: AuthorModel) => AuthorModel;
16
13
  constructor();
17
- set model(m: any);
18
- dispatchModelUpdated(reset: any): void;
19
- onModelChanged: any;
20
- set configuration(c: any);
21
- onConfigurationChanged(c: any): void;
22
- onModelUpdated: any;
14
+ set model(m: AuthorModelInput);
15
+ dispatchModelUpdated(reset?: boolean): void;
16
+ onModelChanged: (m: AuthorModel, reset?: boolean) => void;
17
+ set configuration(c: EbsrConfiguration);
18
+ onConfigurationChanged(c: EbsrConfiguration): void;
19
+ onModelUpdated: (event: Event) => void;
23
20
  connectedCallback(): void;
24
21
  _render(): void;
25
22
  disconnectedCallback(): void;
26
23
  }
24
+ export {};
@@ -13,6 +13,9 @@ var d = (e, t) => ({
13
13
  configuration: r(e, n.configuration),
14
14
  model: t
15
15
  }), { model: f } = n || {}, p = class e extends HTMLElement {
16
+ _root;
17
+ _model;
18
+ _configuration;
16
19
  static createDefaultModel = ({ partA: e = {}, partB: t = {}, ...n } = {}, r = f) => ({
17
20
  ...r,
18
21
  ...n,
@@ -45,7 +48,7 @@ var d = (e, t) => ({
45
48
  ...n.configuration,
46
49
  ...t.configuration
47
50
  };
48
- this._configuration = r, r?.language?.enabled ? r?.languageChoices?.options?.length && (this._model.language = r?.languageChoices.options[0].value) : r.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({
51
+ this._configuration = r, r?.language?.enabled ? r?.languageChoices?.options?.length && (this._model.language = r?.languageChoices.options[0].value) : r.language.settings && this._model.language ? (r.language.enabled = !0, (!r.languageChoices.options || !r.languageChoices.options.length) && (r.languageChoices.options = []), r.languageChoices.options.find((e) => e.value === this._model.language) || r.languageChoices.options.push({
49
52
  value: this._model.language,
50
53
  label: this._model.language
51
54
  })) : delete this._model.language, this._render();
@@ -54,10 +57,11 @@ var d = (e, t) => ({
54
57
  this._configuration = d(e, this._model).configuration, this._model && this.onModelChanged(this._model), this._render();
55
58
  }
56
59
  onModelUpdated = (e) => {
57
- if (e.target === this) return;
58
- e.preventDefault(), e.stopImmediatePropagation();
59
- let t = e.target && e.target.getAttribute("data-part");
60
- t && (e.update && (this._model[`part${t}`] = e.update), this.dispatchEvent(new o(this._model)));
60
+ let t = e, n = t.target;
61
+ if (n === this) return;
62
+ t.preventDefault(), t.stopImmediatePropagation();
63
+ let r = n && n.getAttribute("data-part");
64
+ r && (t.update && (this._model[`part${r}`] = t.update), this.dispatchEvent(new o(this._model)));
61
65
  };
62
66
  connectedCallback() {
63
67
  this.addEventListener(c, this.onModelUpdated), this._render();
@@ -1,15 +1,33 @@
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.Requireable<object>;
6
- model: PropTypes.Requireable<object>;
7
- multipleChoiceTagName: PropTypes.Requireable<string>;
8
- onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
9
- onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
2
+ import type { Choice, MultipleChoiceConfiguration } from '@pie-element/multiple-choice';
3
+ import type { MultipleChoiceValidationErrors } from '@pie-element/multiple-choice/controller';
4
+ import type { EbsrValidationErrors } from '../controller/index.js';
5
+ import type { EbsrConfiguration, EbsrModel, EbsrPart } from '../types.js';
6
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
7
+ export type AuthorModel = Partial<EbsrModel> & {
8
+ partA: EbsrPart;
9
+ partB: EbsrPart;
10
+ errors?: EbsrValidationErrors;
11
+ };
12
+ export type MainProps = {
13
+ model: AuthorModel;
14
+ configuration: EbsrConfiguration;
15
+ multipleChoiceTagName?: string;
16
+ onModelChanged: (model: AuthorModel, reset?: boolean) => void;
17
+ onConfigurationChanged: (configuration: EbsrConfiguration) => void;
18
+ };
19
+ /** The multiple-choice configure element of a part, which reads the model it is handed. */
20
+ type PartConfigureElement = HTMLElement & {
21
+ _model: EbsrPart & {
22
+ errors: MultipleChoiceValidationErrors;
10
23
  };
11
- removeExtraChoices: any;
12
- onModelChanged: any;
24
+ configuration: MultipleChoiceConfiguration;
25
+ };
26
+ export declare class Main extends React.Component<MainProps> {
27
+ partA?: PartConfigureElement;
28
+ partB?: PartConfigureElement;
29
+ removeExtraChoices: (choices: Choice[]) => Choice[];
30
+ onModelChanged: (model: AuthorModel, key?: string) => void;
13
31
  render(): React.JSX.Element;
14
32
  }
15
33
  export default Main;