@pie-element/categorize 14.0.4-next.20261011174919 → 14.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,174 +1,176 @@
1
+ import type { ConfigureLanguageOptionsProp } from '@pie-element/shared-types';
2
+ import type { Category, CategoryChoice, CategoryCorrectResponse } from '../types.js';
1
3
  declare const _default: {
2
4
  model: {
3
- allowAlternateEnabled: boolean;
4
- allowMaxChoicesPerCategory: boolean;
5
- alternates: never[];
6
- categories: never[];
5
+ allowAlternateEnabled: true;
6
+ allowMaxChoicesPerCategory: false;
7
+ alternates: unknown[];
8
+ categories: Category[];
7
9
  categoriesPerRow: number;
8
- choices: never[];
10
+ choices: CategoryChoice[];
9
11
  choicesLabel: string;
10
- choicesPosition: string;
11
- correctResponse: never[];
12
- feedbackEnabled: boolean;
13
- lockChoiceOrder: boolean;
12
+ choicesPosition: "below";
13
+ correctResponse: CategoryCorrectResponse[];
14
+ feedbackEnabled: false;
15
+ lockChoiceOrder: true;
14
16
  maxAnswerChoices: number;
15
17
  maxChoicesPerCategory: number;
16
- partialScoring: boolean;
17
- promptEnabled: boolean;
18
- rationaleEnabled: boolean;
18
+ partialScoring: true;
19
+ promptEnabled: true;
20
+ rationaleEnabled: true;
19
21
  rowLabels: string[];
20
- studentInstructionsEnabled: boolean;
21
- teacherInstructionsEnabled: boolean;
22
- toolbarEditorPosition: string;
22
+ studentInstructionsEnabled: true;
23
+ teacherInstructionsEnabled: true;
24
+ toolbarEditorPosition: "bottom";
23
25
  minRowHeight: string;
24
26
  };
25
27
  configuration: {
26
28
  baseInputConfiguration: {
27
29
  h3: {
28
- disabled: boolean;
30
+ disabled: true;
29
31
  };
30
32
  audio: {
31
- disabled: boolean;
33
+ disabled: false;
32
34
  };
33
35
  video: {
34
- disabled: boolean;
36
+ disabled: false;
35
37
  };
36
38
  image: {
37
- disabled: boolean;
39
+ disabled: false;
38
40
  };
39
41
  textAlign: {
40
- disabled: boolean;
42
+ disabled: true;
41
43
  };
42
44
  showParagraphs: {
43
- disabled: boolean;
45
+ disabled: false;
44
46
  };
45
47
  separateParagraphs: {
46
- disabled: boolean;
48
+ disabled: true;
47
49
  };
48
50
  };
49
51
  spellCheck: {
50
52
  label: string;
51
- settings: boolean;
52
- enabled: boolean;
53
+ settings: false;
54
+ enabled: true;
53
55
  };
54
56
  feedback: {
55
- settings: boolean;
57
+ settings: true;
56
58
  label: string;
57
- enabled: boolean;
59
+ enabled: true;
58
60
  };
59
61
  lockChoiceOrder: {
60
- settings: boolean;
62
+ settings: true;
61
63
  label: string;
62
64
  };
63
65
  choicesPosition: {
64
- settings: boolean;
66
+ settings: true;
65
67
  label: string;
66
68
  };
67
69
  allowMultiplePlacements: {
68
- settings: boolean;
70
+ settings: true;
69
71
  label: string;
70
72
  };
71
73
  maxPlacements: {
72
- settings: boolean;
74
+ settings: true;
73
75
  label: string;
74
76
  };
75
77
  allowAlternate: {
76
- settings: boolean;
78
+ settings: true;
77
79
  label: string;
78
80
  };
79
81
  categoriesPerRow: {
80
- settings: boolean;
82
+ settings: true;
81
83
  label: string;
82
84
  };
83
85
  partialScoring: {
84
- settings: boolean;
86
+ settings: false;
85
87
  label: string;
86
88
  };
87
89
  prompt: {
88
- settings: boolean;
90
+ settings: true;
89
91
  label: string;
90
- required: boolean;
92
+ required: false;
91
93
  inputConfiguration: {
92
94
  audio: {
93
- disabled: boolean;
95
+ disabled: false;
94
96
  };
95
97
  video: {
96
- disabled: boolean;
98
+ disabled: false;
97
99
  };
98
100
  image: {
99
- disabled: boolean;
101
+ disabled: false;
100
102
  };
101
103
  };
102
104
  };
103
105
  rationale: {
104
- settings: boolean;
106
+ settings: true;
105
107
  label: string;
106
- required: boolean;
108
+ required: false;
107
109
  inputConfiguration: {
108
110
  audio: {
109
- disabled: boolean;
111
+ disabled: false;
110
112
  };
111
113
  video: {
112
- disabled: boolean;
114
+ disabled: false;
113
115
  };
114
116
  image: {
115
- disabled: boolean;
117
+ disabled: false;
116
118
  };
117
119
  };
118
120
  };
119
121
  scoringType: {
120
- settings: boolean;
122
+ settings: false;
121
123
  label: string;
122
124
  };
123
- settingsPanelDisabled: boolean;
125
+ settingsPanelDisabled: false;
124
126
  studentInstructions: {
125
- settings: boolean;
127
+ settings: false;
126
128
  label: string;
127
129
  };
128
130
  teacherInstructions: {
129
- settings: boolean;
131
+ settings: true;
130
132
  label: string;
131
- required: boolean;
133
+ required: false;
132
134
  inputConfiguration: {
133
135
  audio: {
134
- disabled: boolean;
136
+ disabled: false;
135
137
  };
136
138
  video: {
137
- disabled: boolean;
139
+ disabled: false;
138
140
  };
139
141
  image: {
140
- disabled: boolean;
142
+ disabled: false;
141
143
  };
142
144
  };
143
145
  };
144
146
  headers: {
145
147
  inputConfiguration: {
146
148
  audio: {
147
- disabled: boolean;
149
+ disabled: true;
148
150
  };
149
151
  video: {
150
- disabled: boolean;
152
+ disabled: true;
151
153
  };
152
154
  image: {
153
- disabled: boolean;
155
+ disabled: false;
154
156
  };
155
157
  };
156
158
  };
157
159
  rowLabels: {
158
160
  inputConfiguration: {
159
161
  audio: {
160
- disabled: boolean;
162
+ disabled: false;
161
163
  };
162
164
  video: {
163
- disabled: boolean;
165
+ disabled: false;
164
166
  };
165
167
  image: {
166
- disabled: boolean;
168
+ disabled: false;
167
169
  };
168
170
  };
169
171
  };
170
172
  toolbarEditorPosition: {
171
- settings: boolean;
173
+ settings: false;
172
174
  label: string;
173
175
  };
174
176
  maxImageWidth: {
@@ -188,26 +190,26 @@ declare const _default: {
188
190
  choices: number;
189
191
  };
190
192
  withRubric: {
191
- settings: boolean;
193
+ settings: false;
192
194
  label: string;
193
195
  };
194
196
  minCategoriesPerRow: number;
195
197
  allowMaxAnswerChoices: {
196
- settings: boolean;
198
+ settings: true;
197
199
  label: string;
198
200
  };
199
201
  mathMlOptions: {
200
- mmlOutput: boolean;
201
- mmlEditing: boolean;
202
+ mmlOutput: false;
203
+ mmlEditing: false;
202
204
  };
203
205
  language: {
204
- settings: boolean;
206
+ settings: false;
205
207
  label: string;
206
- enabled: boolean;
208
+ enabled: false;
207
209
  };
208
210
  languageChoices: {
209
211
  label: string;
210
- options: never[];
212
+ options: ConfigureLanguageOptionsProp[];
211
213
  };
212
214
  };
213
215
  };
@@ -1,42 +1,69 @@
1
+ import { type DeleteDone, type ImageHandler, type SoundHandler } from '@pie-element/shared-configure-events';
2
+ import { type AuthorModel } from './main.js';
3
+ import type { CategorizeConfiguration, CategorizeModel } from '../types.js';
1
4
  export default class CategorizeConfigure extends HTMLElement {
2
- static createDefaultModel: (model?: {}) => {
5
+ private _root;
6
+ private _model;
7
+ private _configuration;
8
+ static createDefaultModel: (model?: Partial<CategorizeModel>) => AuthorModel;
9
+ static disableAlternateResponses: (m: Partial<CategorizeModel>) => {
10
+ correctResponse: {
11
+ category: string;
12
+ choices: string[];
13
+ }[];
3
14
  allowAlternateEnabled: boolean;
4
- allowMaxChoicesPerCategory: boolean;
5
- alternates: never[];
6
- categories: never[];
7
- categoriesPerRow: number;
8
- choices: never[];
9
- choicesLabel: string;
10
- choicesPosition: string;
11
- correctResponse: never[];
12
- feedbackEnabled: boolean;
13
- lockChoiceOrder: boolean;
14
- maxAnswerChoices: number;
15
- maxChoicesPerCategory: number;
16
- partialScoring: boolean;
17
- promptEnabled: boolean;
18
- rationaleEnabled: boolean;
19
- rowLabels: string[];
20
- studentInstructionsEnabled: boolean;
21
- teacherInstructionsEnabled: boolean;
22
- toolbarEditorPosition: string;
23
- minRowHeight: string;
15
+ allowMaxChoicesPerCategory?: boolean | undefined;
16
+ allowMultiplePlacementsEnabled?: import("../types.js").MultiplePlacements | undefined;
17
+ alternates?: unknown[] | undefined;
18
+ choices?: import("../types.js").CategoryChoice[] | undefined;
19
+ categoriesPerRow?: number | undefined;
20
+ choicesPosition?: "above" | "below" | "left" | "right" | undefined;
21
+ choicesLabel?: string | undefined;
22
+ lockChoiceOrder?: boolean | undefined;
23
+ prompt?: string | undefined;
24
+ promptEnabled?: boolean | undefined;
25
+ categories?: import("../types.js").Category[] | undefined;
26
+ feedback?: import("../types.js").CategorizeFeedback | undefined;
27
+ maxChoicesPerCategory?: number | undefined;
28
+ rationale?: string | undefined;
29
+ partialScoring?: boolean | undefined;
30
+ feedbackEnabled?: boolean | undefined;
31
+ rationaleEnabled?: boolean | undefined;
32
+ spellCheckEnabled?: boolean | undefined;
33
+ studentInstructionsEnabled?: boolean | undefined;
34
+ teacherInstructions?: string | undefined;
35
+ teacherInstructionsEnabled?: boolean | undefined;
36
+ note?: string | undefined;
37
+ toolbarEditorPosition?: "bottom" | "top" | undefined;
38
+ rubricEnabled?: boolean | undefined;
39
+ scoringType?: "auto" | "rubric" | undefined;
40
+ language?: string | undefined;
41
+ maxAnswerChoices?: number | undefined;
42
+ rowLabels?: string[] | undefined;
43
+ minRowHeight?: string | undefined;
44
+ fontSizeFactor?: number | undefined;
45
+ autoplayAudioEnabled?: boolean | undefined;
46
+ completeAudioEnabled?: boolean | undefined;
47
+ customAudioButton?: import("@pie-element/shared-types").CustomAudioButton | undefined;
48
+ extraCSSRules?: import("@pie-element/shared-types").ExtraCSSRules | undefined;
49
+ id?: string | undefined;
50
+ element?: string | undefined;
51
+ accessibilityCatalogs?: import("@pie-element/shared-types").AccessibilityCatalog[] | undefined;
24
52
  };
25
- static disableAlternateResponses: (m: any) => any;
26
53
  constructor();
27
- set model(m: any);
28
- set configuration(c: any);
29
- onModelChanged(m: any): void;
30
- onConfigurationChanged(c: any): void;
54
+ set model(m: Partial<CategorizeModel>);
55
+ set configuration(c: CategorizeConfiguration);
56
+ onModelChanged(m: AuthorModel): void;
57
+ onConfigurationChanged(c: CategorizeConfiguration): void;
31
58
  connectedCallback(): void;
32
59
  /**
33
60
  *
34
61
  * @param {done, progress, file} handler
35
62
  */
36
- insertImage(handler: any): void;
37
- onDeleteImage(src: any, done: any): void;
38
- insertSound(handler: any): void;
39
- onDeleteSound(src: any, done: any): void;
63
+ insertImage(handler: ImageHandler): void;
64
+ onDeleteImage(src: string, done: DeleteDone): void;
65
+ insertSound(handler: SoundHandler): void;
66
+ onDeleteSound(src: string, done: DeleteDone): void;
40
67
  render(): void;
41
68
  disconnectedCallback(): void;
42
69
  }
@@ -6,6 +6,9 @@ import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
6
6
  import { DeleteImageEvent as a, DeleteSoundEvent as o, InsertImageEvent as s, InsertSoundEvent as c, ModelUpdatedEvent as l } from "@pie-element/shared-configure-events";
7
7
  //#region src/author/index.ts
8
8
  var u = class u extends HTMLElement {
9
+ _root;
10
+ _model;
11
+ _configuration;
9
12
  static createDefaultModel = (e = {}) => ({
10
13
  ...t.model,
11
14
  ...e
@@ -27,17 +30,23 @@ var u = class u extends HTMLElement {
27
30
  super(), this._root = null, this._model = u.createDefaultModel(), this._configuration = t.configuration;
28
31
  }
29
32
  set model(e) {
30
- this._model = u.createDefaultModel(e), e.choices && e.choices.length >= e.maxAnswerChoices && (this._model.maxAnswerChoices = e.choices.length, console.warn("Max Answer Choices can't be less than choices length!")), this.render();
33
+ this._model = u.createDefaultModel(e), e.choices && e.maxAnswerChoices !== void 0 && e.choices.length >= e.maxAnswerChoices && (this._model.maxAnswerChoices = e.choices.length, console.warn("Max Answer Choices can't be less than choices length!")), this.render();
31
34
  }
32
35
  set configuration(e) {
33
36
  let n = {
34
37
  ...t.configuration,
35
38
  ...e
36
39
  };
37
- this._configuration = n, n?.language?.enabled ? n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value) : n.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
- value: this._model.language,
39
- label: this._model.language
40
- })) : delete this._model.language, this.render();
40
+ if (this._configuration = n, n?.language?.enabled) n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value);
41
+ else if (n.language.settings && this._model.language) {
42
+ n.language.enabled = !0, (!n.languageChoices.options || !n.languageChoices.options.length) && (n.languageChoices.options = []);
43
+ let e = this._model.language;
44
+ n.languageChoices.options.find((t) => t.value === e) || n.languageChoices.options.push({
45
+ value: e,
46
+ label: e
47
+ });
48
+ } else delete this._model.language;
49
+ this.render();
41
50
  }
42
51
  onModelChanged(e) {
43
52
  this._model = e, this.render(), this.dispatchEvent(new l(this._model, !1));
@@ -1,15 +1,24 @@
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
- onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
7
- model: PropTypes.Validator<object>;
8
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
9
- imageSupport: PropTypes.Requireable<object>;
10
- uploadSoundSupport: PropTypes.Requireable<object>;
11
- };
12
- static defaultProps: {};
2
+ import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { CategorizeValidationErrors } from '../controller/index.js';
4
+ import type { CategorizeConfiguration, CategorizeModel } from '../types.js';
5
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
6
+ export type AuthorModel = Partial<CategorizeModel> & {
7
+ errors?: CategorizeValidationErrors;
8
+ };
9
+ type MediaSupport<Handler> = {
10
+ add: (handler: Handler) => void;
11
+ delete: (src: string, done: DeleteDone) => void;
12
+ };
13
+ export type MainProps = {
14
+ model: AuthorModel;
15
+ configuration?: CategorizeConfiguration;
16
+ onModelChanged: (model: AuthorModel) => void;
17
+ onConfigurationChanged?: (configuration: CategorizeConfiguration) => void;
18
+ imageSupport?: MediaSupport<ImageHandler>;
19
+ uploadSoundSupport?: MediaSupport<SoundHandler>;
20
+ };
21
+ export declare class Main extends React.Component<MainProps> {
13
22
  render(): React.JSX.Element;
14
23
  }
15
24
  export default Main;
@@ -1,27 +1,17 @@
1
1
  import { Design as e } from "./design/index.js";
2
2
  import t from "react";
3
- import n from "prop-types";
4
- import { jsx as r } from "react/jsx-runtime";
3
+ import { jsx as n } from "react/jsx-runtime";
5
4
  //#region src/author/main.tsx
6
- var i = class extends t.Component {
7
- static propTypes = {
8
- configuration: n.object,
9
- onConfigurationChanged: n.func,
10
- model: n.object.isRequired,
11
- onModelChanged: n.func.isRequired,
12
- imageSupport: n.object,
13
- uploadSoundSupport: n.object
14
- };
15
- static defaultProps = {};
5
+ var r = e, i = class extends t.Component {
16
6
  render() {
17
- let { model: t, onModelChanged: n, configuration: i, onConfigurationChanged: a, imageSupport: o, uploadSoundSupport: s } = this.props;
18
- return /* @__PURE__ */ r(e, {
7
+ let { model: e, onModelChanged: t, configuration: i, onConfigurationChanged: a, imageSupport: o, uploadSoundSupport: s } = this.props;
8
+ return /* @__PURE__ */ n(r, {
19
9
  imageSupport: o,
20
10
  uploadSoundSupport: s,
21
11
  title: "Design",
22
- model: t,
12
+ model: e,
23
13
  configuration: i,
24
- onChange: n,
14
+ onChange: t,
25
15
  onConfigurationChanged: a
26
16
  });
27
17
  }
@@ -1,8 +1,9 @@
1
- export declare const generateValidationMessage: (config: any) => string;
1
+ import type { CategorizeConfiguration, CategorizeModel } from '../types.js';
2
+ export declare const generateValidationMessage: (config?: CategorizeConfiguration) => string;
2
3
  export declare const multiplePlacements: {
3
- enabled: string;
4
- disabled: string;
5
- perChoice: string;
4
+ readonly enabled: "Yes";
5
+ readonly disabled: "No";
6
+ readonly perChoice: "Set Per Choice";
6
7
  };
7
- export declare const maxLength: (array: any) => any;
8
- export declare const getMaxCategoryChoices: (model: any) => any;
8
+ export declare const maxLength: (array: unknown[][] | undefined) => number;
9
+ export declare const getMaxCategoryChoices: (model: Partial<CategorizeModel> | undefined) => number;
@@ -34783,15 +34783,12 @@ var VU = class extends P.Component {
34783
34783
  }), GU = (e) => typeof e == "string" ? {
34784
34784
  label: e,
34785
34785
  value: e
34786
- } : e, KU = function() {
34787
- let [e, t, n = !1] = Array.prototype.slice.call(arguments);
34788
- return {
34789
- type: "radio",
34790
- label: e,
34791
- choices: t && t.map((e) => GU(e)),
34792
- isConfigProperty: n
34793
- };
34794
- }, qU = (e, t, n = !1) => ({
34786
+ } : e, KU = (e, t, n = !1) => ({
34787
+ type: "radio",
34788
+ label: e,
34789
+ choices: t && t.map((e) => GU(e)),
34790
+ isConfigProperty: n
34791
+ }), qU = (e, t, n = !1) => ({
34795
34792
  type: "dropdown",
34796
34793
  label: e,
34797
34794
  choices: t,
@@ -36102,15 +36099,6 @@ var hG = Me.withUid(mG), gG = u("div")(({ theme: e }) => ({
36102
36099
  });
36103
36100
  }
36104
36101
  }, RG = class extends P.Component {
36105
- static propTypes = {
36106
- configuration: L.default.object,
36107
- onConfigurationChanged: L.default.func,
36108
- model: L.default.object.isRequired,
36109
- onModelChanged: L.default.func.isRequired,
36110
- imageSupport: L.default.object,
36111
- uploadSoundSupport: L.default.object
36112
- };
36113
- static defaultProps = {};
36114
36102
  render() {
36115
36103
  let { model: e, onModelChanged: t, configuration: n, onConfigurationChanged: r, imageSupport: i, uploadSoundSupport: a } = this.props;
36116
36104
  return /* @__PURE__ */ F(LG, {
@@ -36288,6 +36276,9 @@ var hG = Me.withUid(mG), gG = u("div")(({ theme: e }) => ({
36288
36276
  }
36289
36277
  }
36290
36278
  }, BG = class e extends HTMLElement {
36279
+ _root;
36280
+ _model;
36281
+ _configuration;
36291
36282
  static createDefaultModel = (e = {}) => ({
36292
36283
  ...zG.model,
36293
36284
  ...e
@@ -36309,17 +36300,23 @@ var hG = Me.withUid(mG), gG = u("div")(({ theme: e }) => ({
36309
36300
  super(), this._root = null, this._model = e.createDefaultModel(), this._configuration = zG.configuration;
36310
36301
  }
36311
36302
  set model(t) {
36312
- this._model = e.createDefaultModel(t), t.choices && t.choices.length >= t.maxAnswerChoices && (this._model.maxAnswerChoices = t.choices.length, console.warn("Max Answer Choices can't be less than choices length!")), this.render();
36303
+ this._model = e.createDefaultModel(t), t.choices && t.maxAnswerChoices !== void 0 && t.choices.length >= t.maxAnswerChoices && (this._model.maxAnswerChoices = t.choices.length, console.warn("Max Answer Choices can't be less than choices length!")), this.render();
36313
36304
  }
36314
36305
  set configuration(e) {
36315
36306
  let t = {
36316
36307
  ...zG.configuration,
36317
36308
  ...e
36318
36309
  };
36319
- 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({
36320
- value: this._model.language,
36321
- label: this._model.language
36322
- })) : delete this._model.language, this.render();
36310
+ if (this._configuration = t, t?.language?.enabled) t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value);
36311
+ else if (t.language.settings && this._model.language) {
36312
+ t.language.enabled = !0, (!t.languageChoices.options || !t.languageChoices.options.length) && (t.languageChoices.options = []);
36313
+ let e = this._model.language;
36314
+ t.languageChoices.options.find((t) => t.value === e) || t.languageChoices.options.push({
36315
+ value: e,
36316
+ label: e
36317
+ });
36318
+ } else delete this._model.language;
36319
+ this.render();
36323
36320
  }
36324
36321
  onModelChanged(e) {
36325
36322
  this._model = e, this.render(), this.dispatchEvent(new iW(this._model, !1));