@pie-element/select-text 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,141 +1,143 @@
1
+ import type { ConfigureLanguageOptionsProp } from '@pie-element/shared-types';
2
+ import type { TextToken } from '../types.js';
1
3
  declare const _default: {
2
4
  model: {
3
- feedbackEnabled: boolean;
4
- highlightChoices: boolean;
5
+ feedbackEnabled: false;
6
+ highlightChoices: false;
5
7
  maxSelections: number;
6
- mode: string;
7
- partialScoring: boolean;
8
+ mode: "sentence";
9
+ partialScoring: false;
8
10
  prompt: string;
9
- promptEnabled: boolean;
11
+ promptEnabled: true;
10
12
  rationale: string;
11
- rationaleEnabled: boolean;
12
- scoringType: string;
13
- studentInstructionsEnabled: boolean;
13
+ rationaleEnabled: true;
14
+ scoringType: "auto";
15
+ studentInstructionsEnabled: true;
14
16
  teacherInstructions: string;
15
- teacherInstructionsEnabled: boolean;
17
+ teacherInstructionsEnabled: true;
16
18
  text: string;
17
- tokens: never[];
18
- toolbarEditorPosition: string;
19
+ tokens: TextToken[];
20
+ toolbarEditorPosition: "bottom";
19
21
  };
20
22
  configuration: {
21
23
  baseInputConfiguration: {
22
24
  h3: {
23
- disabled: boolean;
25
+ disabled: true;
24
26
  };
25
27
  audio: {
26
- disabled: boolean;
28
+ disabled: false;
27
29
  };
28
30
  video: {
29
- disabled: boolean;
31
+ disabled: false;
30
32
  };
31
33
  image: {
32
- disabled: boolean;
34
+ disabled: false;
33
35
  };
34
36
  textAlign: {
35
- disabled: boolean;
37
+ disabled: true;
36
38
  };
37
39
  showParagraphs: {
38
- disabled: boolean;
40
+ disabled: false;
39
41
  };
40
42
  separateParagraphs: {
41
- disabled: boolean;
43
+ disabled: true;
42
44
  };
43
45
  };
44
46
  selectionCount: {
45
- settings: boolean;
47
+ settings: true;
46
48
  label: string;
47
49
  };
48
50
  correctAnswer: {
49
- settings: boolean;
51
+ settings: true;
50
52
  label: string;
51
53
  };
52
54
  selections: {
53
- settings: boolean;
55
+ settings: true;
54
56
  label: string;
55
57
  };
56
58
  highlightChoices: {
57
- settings: boolean;
59
+ settings: true;
58
60
  label: string;
59
61
  };
60
62
  rationale: {
61
- settings: boolean;
63
+ settings: true;
62
64
  label: string;
63
65
  inputConfiguration: {
64
66
  audio: {
65
- disabled: boolean;
67
+ disabled: false;
66
68
  };
67
69
  video: {
68
- disabled: boolean;
70
+ disabled: false;
69
71
  };
70
72
  image: {
71
- disabled: boolean;
73
+ disabled: false;
72
74
  };
73
75
  };
74
- required: boolean;
76
+ required: false;
75
77
  };
76
78
  scoringType: {
77
- settings: boolean;
79
+ settings: false;
78
80
  label: string;
79
81
  };
80
82
  studentInstructions: {
81
- settings: boolean;
83
+ settings: false;
82
84
  label: string;
83
85
  };
84
86
  teacherInstructions: {
85
- settings: boolean;
87
+ settings: true;
86
88
  label: string;
87
89
  inputConfiguration: {
88
90
  audio: {
89
- disabled: boolean;
91
+ disabled: false;
90
92
  };
91
93
  video: {
92
- disabled: boolean;
94
+ disabled: false;
93
95
  };
94
96
  image: {
95
- disabled: boolean;
97
+ disabled: false;
96
98
  };
97
99
  };
98
- required: boolean;
100
+ required: false;
99
101
  };
100
102
  prompt: {
101
103
  label: string;
102
- settings: boolean;
104
+ settings: true;
103
105
  inputConfiguration: {
104
106
  audio: {
105
- disabled: boolean;
107
+ disabled: false;
106
108
  };
107
109
  video: {
108
- disabled: boolean;
110
+ disabled: false;
109
111
  };
110
112
  image: {
111
- disabled: boolean;
113
+ disabled: false;
112
114
  };
113
115
  };
114
- required: boolean;
116
+ required: false;
115
117
  };
116
118
  text: {
117
- settings: boolean;
119
+ settings: true;
118
120
  label: string;
119
121
  };
120
122
  tokens: {
121
- settings: boolean;
123
+ settings: true;
122
124
  label: string;
123
125
  };
124
126
  feedback: {
125
- settings: boolean;
127
+ settings: true;
126
128
  label: string;
127
129
  };
128
130
  spellCheck: {
129
131
  label: string;
130
- settings: boolean;
131
- enabled: boolean;
132
+ settings: false;
133
+ enabled: true;
132
134
  };
133
135
  partialScoring: {
134
- settings: boolean;
136
+ settings: false;
135
137
  label: string;
136
138
  };
137
139
  mode: {
138
- settings: boolean;
140
+ settings: true;
139
141
  label: string;
140
142
  };
141
143
  minTokens: number;
@@ -150,21 +152,21 @@ declare const _default: {
150
152
  rationale: number;
151
153
  };
152
154
  withRubric: {
153
- settings: boolean;
155
+ settings: false;
154
156
  label: string;
155
157
  };
156
158
  mathMlOptions: {
157
- mmlOutput: boolean;
158
- mmlEditing: boolean;
159
+ mmlOutput: false;
160
+ mmlEditing: false;
159
161
  };
160
162
  language: {
161
- settings: boolean;
163
+ settings: false;
162
164
  label: string;
163
- enabled: boolean;
165
+ enabled: false;
164
166
  };
165
167
  languageChoices: {
166
168
  label: string;
167
- options: never[];
169
+ options: ConfigureLanguageOptionsProp[];
168
170
  };
169
171
  };
170
172
  };
@@ -1,30 +1,42 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Design extends React.Component {
4
- static propTypes: {
5
- model: PropTypes.Validator<object>;
6
- configuration: PropTypes.Validator<object>;
7
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
8
- onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
9
- imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
10
- add: PropTypes.Validator<(...args: any[]) => any>;
11
- delete: PropTypes.Validator<(...args: any[]) => any>;
12
- }>>;
13
- uploadSoundSupport: PropTypes.Requireable<object>;
2
+ import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { SelectTextValidationErrors } from '../controller/index.js';
4
+ import type { ComplexFeedbackType, SelectTextConfiguration, SelectTextModel, TextToken } from '../types.js';
5
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
6
+ export type AuthorModel = Partial<SelectTextModel> & {
7
+ errors?: SelectTextValidationErrors;
8
+ };
9
+ export type DesignProps = {
10
+ model: AuthorModel;
11
+ configuration: SelectTextConfiguration;
12
+ onModelChanged: (model: AuthorModel) => void;
13
+ onConfigurationChanged: (configuration: SelectTextConfiguration) => void;
14
+ imageSupport?: {
15
+ add: (handler: ImageHandler) => void;
16
+ delete: (src: string, done: DeleteDone) => void;
14
17
  };
18
+ uploadSoundSupport?: {
19
+ add: (handler: SoundHandler) => void;
20
+ delete: (src: string, done: DeleteDone) => void;
21
+ };
22
+ };
23
+ type DesignState = {
24
+ text: string;
25
+ };
26
+ export declare class Design extends React.Component<DesignProps, DesignState> {
15
27
  static defaultProps: {};
16
- constructor(props: any);
17
- UNSAFE_componentWillReceiveProps(nProps: any): void;
18
- updateText: import("@pie-element/shared-lodash").CancelableFunction<(val: any) => void>;
19
- changeText: (event: any) => void | undefined;
20
- changeTokens: any;
21
- changeMaxSelections: any;
22
- apply: any;
23
- changeFeedback: any;
24
- changePartialScoring: any;
25
- onPromptChanged: any;
26
- onTeacherInstructionsChanged: any;
27
- onRationaleChanged: any;
28
+ constructor(props: DesignProps);
29
+ UNSAFE_componentWillReceiveProps(nProps: DesignProps): void;
30
+ updateText: import("@pie-element/shared-lodash").CancelableFunction<(val: string) => void>;
31
+ changeText: (event: React.ChangeEvent<HTMLInputElement>) => void | undefined;
32
+ changeTokens: (tokens: TextToken[], mode: SelectTextModel["mode"]) => void;
33
+ changeMaxSelections: (_event: unknown, max: number) => void;
34
+ apply: (fn: (update: AuthorModel) => void) => void;
35
+ changeFeedback: (feedback: ComplexFeedbackType) => void;
36
+ changePartialScoring: (partialScoring: boolean) => void;
37
+ onPromptChanged: (prompt: string) => void;
38
+ onTeacherInstructionsChanged: (teacherInstructions: string) => void;
39
+ onRationaleChanged: (rationale: string) => void;
28
40
  render(): React.JSX.Element;
29
41
  }
30
42
  export default Design;
@@ -1,27 +1,26 @@
1
1
  import { generateValidationMessage as e } from "./utils.js";
2
2
  import t from "react";
3
- import n from "prop-types";
4
- import { Tokenizer as r } from "@pie-lib/text-select";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import { styled as o } from "@mui/material/styles";
7
- import s from "debug";
8
- import { cloneDeep as c, debounce as l } from "@pie-element/shared-lodash";
9
- import u from "@mui/material/TextField";
10
- import { FeedbackConfig as ee, InputContainer as d, NumberTextField as f, layout as p, settings as m } from "@pie-lib/config-ui";
11
- import h from "@mui/material/Chip";
3
+ import { Tokenizer as n } from "@pie-lib/text-select";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { styled as a } from "@mui/material/styles";
6
+ import o from "debug";
7
+ import { cloneDeep as s, debounce as c } from "@pie-element/shared-lodash";
8
+ import l from "@mui/material/TextField";
9
+ import { FeedbackConfig as ee, InputContainer as u, NumberTextField as d, layout as f, settings as p } from "@pie-lib/config-ui";
10
+ import m from "@mui/material/Chip";
12
11
  import te from "@mui/icons-material/Info";
13
- import g from "@pie-lib/editable-html-tip-tap";
14
- import _ from "@mui/material/Tooltip";
12
+ import h from "@pie-lib/editable-html-tip-tap";
13
+ import g from "@mui/material/Tooltip";
15
14
  //#region src/author/design.tsx
16
- var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }) => ({
15
+ var { Panel: ne, toggle: _, radio: v, dropdown: y } = p, b = a(u)(({ theme: e }) => ({
17
16
  width: "100%",
18
17
  paddingTop: e.spacing(2),
19
18
  marginBottom: e.spacing(2)
20
- })), x = o(g)({ width: "100%" }), S = o("div")(({ theme: e }) => ({
19
+ })), x = a(h)({ width: "100%" }), S = a("div")(({ theme: e }) => ({
21
20
  fontSize: e.typography.fontSize - 2,
22
21
  color: e.palette.error.main,
23
22
  paddingTop: e.spacing(1)
24
- })), ie = o(u)({ width: "100%" }), ae = o(d)(({ theme: e }) => ({
23
+ })), re = a(l)({ width: "100%" }), ie = a(u)(({ theme: e }) => ({
25
24
  paddingRight: 0,
26
25
  marginRight: 0,
27
26
  position: "relative",
@@ -35,33 +34,22 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
35
34
  backgroundColor: e.palette.primary.main
36
35
  },
37
36
  marginBottom: e.spacing(1)
38
- })), C = o(_)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
37
+ })), ae = a(g)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
39
38
  fontSize: e.typography.fontSize - 2,
40
39
  whiteSpace: "pre",
41
40
  maxWidth: "500px"
42
- } })), oe = o(r)(({ theme: e }) => ({ marginTop: e.spacing(2) })), w = o(h)(({ theme: e }) => ({
41
+ } })), oe = a(n)(({ theme: e }) => ({ marginTop: e.spacing(2) })), C = a(m)(({ theme: e }) => ({
43
42
  marginTop: e.spacing(.5),
44
43
  marginRight: e.spacing(2)
45
- })), se = o("div")(({ theme: e }) => ({
44
+ })), se = a("div")(({ theme: e }) => ({
46
45
  display: "flex",
47
46
  alignItems: "center",
48
47
  flexWrap: "wrap",
49
48
  marginBottom: e.spacing(2.5)
50
- })), ce = o(f)(({ theme: e }) => ({
49
+ })), ce = a(d)(({ theme: e }) => ({
51
50
  width: "180px",
52
51
  margin: `${e.spacing(.5)} auto 0`
53
- })), le = s("@pie-element:select-text:configure"), T = class extends t.Component {
54
- static propTypes = {
55
- model: n.object.isRequired,
56
- configuration: n.object.isRequired,
57
- onModelChanged: n.func.isRequired,
58
- onConfigurationChanged: n.func.isRequired,
59
- imageSupport: n.shape({
60
- add: n.func.isRequired,
61
- delete: n.func.isRequired
62
- }),
63
- uploadSoundSupport: n.object
64
- };
52
+ })), le = o("@pie-element:select-text:configure"), w = class extends t.Component {
65
53
  static defaultProps = {};
66
54
  constructor(e) {
67
55
  super(e);
@@ -72,7 +60,7 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
72
60
  let { model: t } = e;
73
61
  t && t.text && this.setState({ text: t.text });
74
62
  }
75
- updateText = l((e) => {
63
+ updateText = c((e) => {
76
64
  this.apply((t) => {
77
65
  t.text = e, t.tokens = [];
78
66
  });
@@ -89,22 +77,22 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
89
77
  this.apply((e) => e.maxSelections = t);
90
78
  };
91
79
  apply = (e) => {
92
- let { onModelChanged: t, model: n } = this.props, r = c(n);
80
+ let { onModelChanged: t, model: n } = this.props, r = s(n);
93
81
  e(r), t(r);
94
82
  };
95
83
  changeFeedback = (e) => {
96
84
  this.apply((t) => t.feedback = e);
97
85
  };
98
86
  changePartialScoring = (e) => {
99
- let { onModelChanged: t, model: n } = this.props, r = c(n);
87
+ let { onModelChanged: t, model: n } = this.props, r = s(n);
100
88
  r.partialScoring = e, t(r);
101
89
  };
102
90
  onPromptChanged = (e) => {
103
- let { onModelChanged: t, model: n } = this.props, r = c(n);
91
+ let { onModelChanged: t, model: n } = this.props, r = s(n);
104
92
  r.prompt = e, t(r);
105
93
  };
106
94
  onTeacherInstructionsChanged = (e) => {
107
- let { onModelChanged: t, model: n } = this.props, r = c(n);
95
+ let { onModelChanged: t, model: n } = this.props, r = s(n);
108
96
  r.teacherInstructions = e, t(r);
109
97
  };
110
98
  onRationaleChanged = (e) => {
@@ -115,33 +103,33 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
115
103
  });
116
104
  };
117
105
  render() {
118
- let { text: t } = this.state, { configuration: n, imageSupport: r, model: o, onConfigurationChanged: s, onModelChanged: c, uploadSoundSupport: l } = this.props, { baseInputConfiguration: u = {}, correctAnswer: d = {}, contentDimensions: f = {}, feedback: m = {}, highlightChoices: h = {}, mode: g = {}, partialScoring: _ = {}, prompt: T = {}, rationale: E = {}, selectionCount: D = {}, selections: O = {}, settingsPanelDisabled: ue, scoringType: k = {}, spellCheck: A = {}, studentInstructions: j = {}, teacherInstructions: M = {}, text: N = {}, tokens: P = {}, maxImageWidth: F = {}, maxImageHeight: I = {}, withRubric: L = {}, mathMlOptions: R = {}, language: z = {}, languageChoices: B = {} } = n || {}, { errors: V, extraCSSRules: H, feedbackEnabled: de, promptEnabled: fe, rationaleEnabled: pe, spellCheckEnabled: U, teacherInstructionsEnabled: me, toolbarEditorPosition: he } = o || {}, { prompt: W, rationale: G, selectionsError: K, teacherInstructions: q, tokensError: J } = V || {}, ge = e(n), Y = F && F.prompt, X = I && I.prompt, { tokens: Z } = o;
106
+ let { text: t } = this.state, { configuration: n, imageSupport: a, model: o, onConfigurationChanged: s, onModelChanged: c, uploadSoundSupport: l } = this.props, { baseInputConfiguration: u = {}, correctAnswer: d = {}, contentDimensions: p = {}, feedback: m = {}, highlightChoices: h = {}, mode: g = {}, partialScoring: w = {}, prompt: T = {}, rationale: E = {}, selectionCount: D = {}, selections: O = {}, settingsPanelDisabled: ue, scoringType: k = {}, spellCheck: A = {}, studentInstructions: j = {}, teacherInstructions: M = {}, text: N = {}, tokens: P = {}, maxImageWidth: F = {}, maxImageHeight: I = {}, withRubric: L = {}, mathMlOptions: R = {}, language: z = {}, languageChoices: B = {} } = n || {}, { errors: V, extraCSSRules: H, feedbackEnabled: de, promptEnabled: fe, rationaleEnabled: pe, spellCheckEnabled: U, teacherInstructionsEnabled: me, toolbarEditorPosition: he } = o || {}, { prompt: W, rationale: G, selectionsError: K, teacherInstructions: q, tokensError: J } = V || {}, ge = e(n), Y = F && F.prompt, X = I && I.prompt, { tokens: Z } = o;
119
107
  Z ||= [];
120
108
  let Q = { position: he === "top" ? "top" : "bottom" };
121
109
  le("[render] maxSelections:", o.maxSelections);
122
110
  let _e = {
123
- partialScoring: _.settings && v(_.label),
124
- highlightChoices: h.settings && v(h.label),
125
- feedbackEnabled: m.settings && v(m.label),
126
- "language.enabled": z.settings && v(z.label, !0),
127
- language: z.settings && z.enabled && re(B.label, B.options)
111
+ partialScoring: w.settings && _(w.label),
112
+ highlightChoices: h.settings && _(h.label),
113
+ feedbackEnabled: m.settings && _(m.label),
114
+ "language.enabled": z.settings && _(z.label, !0),
115
+ language: z.settings && z.enabled && y(B.label, B.options)
128
116
  }, ve = {
129
- teacherInstructionsEnabled: M.settings && v(M.label),
130
- studentInstructionsEnabled: j.settings && v(j.label),
131
- promptEnabled: T.settings && v(T.label),
132
- rationaleEnabled: E.settings && v(E.label),
133
- spellCheckEnabled: A.settings && v(A.label),
134
- scoringType: k.settings && y(k.label, ["auto", "rubric"]),
135
- rubricEnabled: L?.settings && v(L?.label)
117
+ teacherInstructionsEnabled: M.settings && _(M.label),
118
+ studentInstructionsEnabled: j.settings && _(j.label),
119
+ promptEnabled: T.settings && _(T.label),
120
+ rationaleEnabled: E.settings && _(E.label),
121
+ spellCheckEnabled: A.settings && _(A.label),
122
+ scoringType: k.settings && v(k.label, ["auto", "rubric"]),
123
+ rubricEnabled: L?.settings && _(L?.label)
136
124
  }, $ = (e = {}) => ({
137
125
  ...u,
138
126
  ...e
139
127
  });
140
- return /* @__PURE__ */ a(p.ConfigLayout, {
128
+ return /* @__PURE__ */ i(f.ConfigLayout, {
141
129
  extraCSSRules: H,
142
- dimensions: f,
130
+ dimensions: p,
143
131
  hideSettings: ue,
144
- settings: /* @__PURE__ */ i(ne, {
132
+ settings: /* @__PURE__ */ r(ne, {
145
133
  model: o,
146
134
  configuration: n,
147
135
  onChangeModel: (e) => c(e),
@@ -152,12 +140,12 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
152
140
  }
153
141
  }),
154
142
  children: [
155
- me && /* @__PURE__ */ a(b, {
143
+ me && /* @__PURE__ */ i(b, {
156
144
  label: M.label,
157
- children: [/* @__PURE__ */ i(x, {
145
+ children: [/* @__PURE__ */ r(x, {
158
146
  markup: o.teacherInstructions || "",
159
147
  onChange: this.onTeacherInstructionsChanged,
160
- imageSupport: r,
148
+ imageSupport: a,
161
149
  nonEmpty: !1,
162
150
  error: q,
163
151
  toolbarOpts: Q,
@@ -168,14 +156,14 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
168
156
  uploadSoundSupport: l,
169
157
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
170
158
  mathMlOptions: R
171
- }), q && /* @__PURE__ */ i(S, { children: q })]
159
+ }), q && /* @__PURE__ */ r(S, { children: q })]
172
160
  }),
173
- fe && /* @__PURE__ */ a(b, {
161
+ fe && /* @__PURE__ */ i(b, {
174
162
  label: T.label || "",
175
- children: [/* @__PURE__ */ i(x, {
163
+ children: [/* @__PURE__ */ r(x, {
176
164
  markup: o.prompt,
177
165
  onChange: this.onPromptChanged,
178
- imageSupport: r,
166
+ imageSupport: a,
179
167
  error: W,
180
168
  toolbarOpts: Q,
181
169
  pluginProps: $(n?.prompt?.inputConfiguration),
@@ -185,11 +173,11 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
185
173
  uploadSoundSupport: l,
186
174
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
187
175
  mathMlOptions: R
188
- }), W && /* @__PURE__ */ i(S, { children: W })]
176
+ }), W && /* @__PURE__ */ r(S, { children: W })]
189
177
  }),
190
- N.settings && /* @__PURE__ */ i(b, {
178
+ N.settings && /* @__PURE__ */ r(b, {
191
179
  label: N.label || "",
192
- children: /* @__PURE__ */ i(ie, {
180
+ children: /* @__PURE__ */ r(re, {
193
181
  variant: "standard",
194
182
  multiline: !0,
195
183
  defaultValue: t,
@@ -197,14 +185,14 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
197
185
  spellCheck: U
198
186
  })
199
187
  }),
200
- P.settings && /* @__PURE__ */ a(ae, {
188
+ P.settings && /* @__PURE__ */ i(ie, {
201
189
  label: P.label || "",
202
- children: [/* @__PURE__ */ i(C, {
190
+ children: [/* @__PURE__ */ r(ae, {
203
191
  disableFocusListener: !0,
204
192
  disableTouchListener: !0,
205
193
  placement: "right",
206
194
  title: ge,
207
- children: /* @__PURE__ */ i(te, {
195
+ children: /* @__PURE__ */ r(te, {
208
196
  fontSize: "small",
209
197
  color: "primary",
210
198
  style: {
@@ -213,19 +201,19 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
213
201
  top: "-3px"
214
202
  }
215
203
  })
216
- }), /* @__PURE__ */ i(oe, {
204
+ }), /* @__PURE__ */ r(oe, {
217
205
  text: o.text,
218
206
  tokens: Z,
219
207
  onChange: this.changeTokens
220
208
  })]
221
209
  }),
222
- J && /* @__PURE__ */ i(S, { children: J }),
223
- K && /* @__PURE__ */ i(S, { children: K }),
224
- /* @__PURE__ */ a(se, { children: [
225
- g.settings && /* @__PURE__ */ i(w, { label: `${g.label}: ${o.mode ? o.mode : "None"}` }),
226
- O.settings && /* @__PURE__ */ i(w, { label: `${O.label}: ${Z.length}` }),
227
- d.settings && /* @__PURE__ */ i(w, { label: `${d.label}: ${Z.filter((e) => e.correct).length}` }),
228
- D.settings && /* @__PURE__ */ i(ce, {
210
+ J && /* @__PURE__ */ r(S, { children: J }),
211
+ K && /* @__PURE__ */ r(S, { children: K }),
212
+ /* @__PURE__ */ i(se, { children: [
213
+ g.settings && /* @__PURE__ */ r(C, { label: `${g.label}: ${o.mode ? o.mode : "None"}` }),
214
+ O.settings && /* @__PURE__ */ r(C, { label: `${O.label}: ${Z.length}` }),
215
+ d.settings && /* @__PURE__ */ r(C, { label: `${d.label}: ${Z.filter((e) => e.correct).length}` }),
216
+ D.settings && /* @__PURE__ */ r(ce, {
229
217
  min: Z.filter((e) => e.correct).length || 0,
230
218
  label: `${D.label} (0:any)`,
231
219
  max: Z.length,
@@ -233,12 +221,12 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
233
221
  onChange: this.changeMaxSelections
234
222
  })
235
223
  ] }),
236
- pe && /* @__PURE__ */ a(b, {
224
+ pe && /* @__PURE__ */ i(b, {
237
225
  label: E.label || "",
238
- children: [/* @__PURE__ */ i(x, {
226
+ children: [/* @__PURE__ */ r(x, {
239
227
  markup: o.rationale || "",
240
228
  onChange: this.onRationaleChanged,
241
- imageSupport: r,
229
+ imageSupport: a,
242
230
  error: G,
243
231
  toolbarOpts: Q,
244
232
  pluginProps: $(n?.rationale?.inputConfiguration),
@@ -248,9 +236,9 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
248
236
  uploadSoundSupport: l,
249
237
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
250
238
  mathMlOptions: R
251
- }), G && /* @__PURE__ */ i(S, { children: G })]
239
+ }), G && /* @__PURE__ */ r(S, { children: G })]
252
240
  }),
253
- de && /* @__PURE__ */ i(ee, {
241
+ de && /* @__PURE__ */ r(ee, {
254
242
  feedback: o.feedback,
255
243
  onChange: this.changeFeedback,
256
244
  toolbarOpts: Q
@@ -260,4 +248,4 @@ var { Panel: ne, toggle: v, radio: y, dropdown: re } = m, b = o(d)(({ theme: e }
260
248
  }
261
249
  };
262
250
  //#endregion
263
- export { T as Design, T as default };
251
+ export { w as Design, w as default };
@@ -1,19 +1,25 @@
1
+ import { type AuthorModel } from './design.js';
2
+ import { type DeleteDone, type ImageHandler, type SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { SelectTextConfiguration, SelectTextModel } from '../types.js';
1
4
  export default class SelectTextConfigure extends HTMLElement {
2
- static createDefaultModel: (model?: {}) => any;
5
+ private _root;
6
+ private _model;
7
+ private _configuration;
8
+ static createDefaultModel: (model?: Partial<SelectTextModel>) => AuthorModel;
3
9
  constructor();
4
- set model(m: any);
5
- set configuration(c: any);
10
+ set model(m: Partial<SelectTextModel>);
11
+ set configuration(c: SelectTextConfiguration);
6
12
  connectedCallback(): void;
7
- modelChanged(m: any): void;
8
- onConfigurationChanged(c: any): void;
13
+ modelChanged(m: AuthorModel): void;
14
+ onConfigurationChanged(c: SelectTextConfiguration): void;
9
15
  /**
10
16
  *
11
17
  * @param {done, progress, file} handler
12
18
  */
13
- insertImage(handler: any): void;
14
- onDeleteImage(src: any, done: any): void;
15
- insertSound(handler: any): void;
16
- onDeleteSound(src: any, done: any): void;
19
+ insertImage(handler: ImageHandler): void;
20
+ onDeleteImage(src: string, done: DeleteDone): void;
21
+ insertSound(handler: SoundHandler): void;
22
+ onDeleteSound(src: string, done: DeleteDone): void;
17
23
  render(): void;
18
24
  disconnectedCallback(): void;
19
25
  }
@@ -6,6 +6,9 @@ import { createRoot as i } from "react-dom/client";
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 = (t = {}) => e({
10
13
  ...n.model,
11
14
  ...t
@@ -21,7 +24,7 @@ var u = class u extends HTMLElement {
21
24
  ...n.configuration,
22
25
  ...e
23
26
  };
24
- 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({
27
+ this._configuration = t, t?.language?.enabled ? t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value) : t.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({
25
28
  value: this._model.language,
26
29
  label: this._model.language
27
30
  })) : delete this._model.language, this.render();
@@ -30,10 +33,10 @@ var u = class u extends HTMLElement {
30
33
  this.render();
31
34
  }
32
35
  modelChanged(e) {
33
- this._model = e, this.dispatchEvent(new l(this._model), !0), this.render();
36
+ this._model = e, this.dispatchEvent(new l(this._model)), this.render();
34
37
  }
35
38
  onConfigurationChanged(e) {
36
- this._configuration = e, this._model && this.dispatchEvent(new l(this._model), !1), this.render();
39
+ this._configuration = e, this._model && this.dispatchEvent(new l(this._model)), this.render();
37
40
  }
38
41
  insertImage(e) {
39
42
  this.dispatchEvent(new s(e));