@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.
@@ -0,0 +1,203 @@
1
+ import type { ConfigureLanguageOptions, ConfigureMathMLProp, ConfigureMaxImageDimensionsProp, ConfigureProp, ConfigurePropWithEnabled, ContentDimensions, EditableHtmlConfigureProp, EditableHtmlPluginConfigureRequired, ExtraCSSRules, PieModel } from '@pie-element/shared-types';
2
+ /** A selectable span of the main text */
3
+ export interface TextToken {
4
+ /** The token text */
5
+ text?: string;
6
+ /** The start point in the main text for this token */
7
+ start: number;
8
+ /** The end point in the main text for this token */
9
+ end: number;
10
+ /** Is selected does the token represent a correct response */
11
+ correct?: boolean;
12
+ /** The start point before the author re-parsed the text; scoring matches a selection on either position */
13
+ oldStart?: number;
14
+ /** The end point before the author re-parsed the text; scoring matches a selection on either position */
15
+ oldEnd?: number;
16
+ }
17
+ /**
18
+ * Feedback for one correctness level. The author's feedback selector changes `type` and keeps the other
19
+ * message, so a `custom` type can arrive without `custom` text, and then the default message shows.
20
+ */
21
+ export interface FeedbackType {
22
+ /** Indicates the feedback type */
23
+ type: 'default' | 'none' | 'custom';
24
+ /** Indicates the feedback value */
25
+ default?: string;
26
+ /** Indicates the feedback custom value */
27
+ custom?: string;
28
+ }
29
+ /** Feedback for each correctness level */
30
+ export interface ComplexFeedbackType {
31
+ /** Indicates the configuration for feedback when answer is correct */
32
+ correct: FeedbackType;
33
+ /** Indicates the configuration for feedback when answer is incorrect */
34
+ incorrect: FeedbackType;
35
+ /** Indicates the configuration for feedback when answer is partially correct */
36
+ partial?: FeedbackType;
37
+ }
38
+ /** Pie Model Object for `@pie-element/select-text` */
39
+ export interface SelectTextModel extends PieModel {
40
+ /**
41
+ * The maximum number of token selections a user can make when responding; 0 allows any number
42
+ * @default 0
43
+ */
44
+ maxSelections?: number;
45
+ /**
46
+ * The selected mode for tokenizing the text.
47
+ * This is only used in the config UI to present the mode by which text has been tokenized for selection.
48
+ * The tokenizer writes `sentence`, `words` or `paragraphs`, and an empty string after a token edit in a
49
+ * newly opened author; `word` and `paragraph` are accepted for content written to the legacy contract.
50
+ * @default "sentence"
51
+ */
52
+ mode?: 'sentence' | 'words' | 'paragraphs' | 'word' | 'paragraph' | '';
53
+ /**
54
+ * Indicates if partial scoring should be used. Scoring treats an absent value as enabled, while the
55
+ * default models set false.
56
+ */
57
+ partialScoring?: boolean;
58
+ /** Feedback for student responses */
59
+ feedback?: ComplexFeedbackType;
60
+ /** The selectable text tokens in the main text content */
61
+ tokens: TextToken[];
62
+ /** The passage of text from which user may select responses */
63
+ text: string;
64
+ /** The user prompt/item stem */
65
+ prompt?: string;
66
+ /**
67
+ * Determines if prompt should show
68
+ * @default true
69
+ */
70
+ promptEnabled?: boolean;
71
+ /**
72
+ * Indicates if the parts of text that are choosable, should be highligned when presented to student.
73
+ * @default false
74
+ */
75
+ highlightChoices?: boolean;
76
+ /** Indicates rationale for correct answer */
77
+ rationale?: string;
78
+ /**
79
+ * Indicates scoring type
80
+ * @default "auto"
81
+ */
82
+ scoringType?: 'auto' | 'rubric';
83
+ /** Not read by this element: it renders no student instructions */
84
+ studentInstructions?: string;
85
+ /** Indicates teacher instructions */
86
+ teacherInstructions?: string;
87
+ /**
88
+ * Indicates if Feedback is enabled
89
+ * @default false
90
+ */
91
+ feedbackEnabled?: boolean;
92
+ /**
93
+ * Indicates if Rationale are enabled
94
+ * @default true
95
+ */
96
+ rationaleEnabled?: boolean;
97
+ /**
98
+ * Indicates if Student Instructions are enabled; the author shows the toggle, and nothing renders them
99
+ * @default true
100
+ */
101
+ studentInstructionsEnabled?: boolean;
102
+ /**
103
+ * Indicates if Teacher Instructions are enabled
104
+ * @default true
105
+ */
106
+ teacherInstructionsEnabled?: boolean;
107
+ /** Indicates if spellcheck is enabled */
108
+ spellCheckEnabled?: boolean;
109
+ /**
110
+ * Indicates the editor's toolbar position which can be 'bottom' or 'top'
111
+ * @default "bottom"
112
+ */
113
+ toolbarEditorPosition?: 'bottom' | 'top';
114
+ /** Indicates if Rubric is enabled */
115
+ rubricEnabled?: boolean;
116
+ /**
117
+ * Indicates the language of the component
118
+ * Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
119
+ */
120
+ language?: string;
121
+ /** Host-supplied CSS scoped to the element */
122
+ extraCSSRules?: ExtraCSSRules;
123
+ }
124
+ /** Config Object for `@pie-element/select-text` */
125
+ export interface SelectTextConfiguration {
126
+ /**
127
+ * Base editable html input configuration regarding plugins that are enabled/disabled
128
+ * E.g. audio, video, image
129
+ */
130
+ baseInputConfiguration?: EditableHtmlConfigureProp;
131
+ /** Selection Count configuration */
132
+ selectionCount?: ConfigureProp;
133
+ /** Correct answer count configuration */
134
+ correctAnswer?: ConfigureProp;
135
+ /** Selections configuration */
136
+ selections?: ConfigureProp;
137
+ /** Mode configuration */
138
+ mode?: ConfigureProp;
139
+ /** Partial Scoring configuration */
140
+ partialScoring?: ConfigureProp;
141
+ /** Feedback configuration */
142
+ feedback?: ConfigureProp;
143
+ /** Tokens configuration */
144
+ tokens?: ConfigureProp;
145
+ /** Text Content configuration */
146
+ text?: ConfigureProp;
147
+ /** Prompt configuration */
148
+ prompt?: EditableHtmlPluginConfigureRequired;
149
+ /** Highlight Choices configuration */
150
+ highlightChoices?: ConfigureProp;
151
+ /** Rationale configuration */
152
+ rationale?: EditableHtmlPluginConfigureRequired;
153
+ /** Indicates if the settings panel is not available */
154
+ settingsPanelDisabled?: boolean;
155
+ /** Configuration for the spellcheck; `enabled` is not read */
156
+ spellCheck?: ConfigurePropWithEnabled;
157
+ /** Scoring Type configuration */
158
+ scoringType?: ConfigureProp;
159
+ /** Student Instructions configuration */
160
+ studentInstructions?: ConfigureProp;
161
+ /** Teacher Instructions configuration */
162
+ teacherInstructions?: EditableHtmlPluginConfigureRequired;
163
+ /** Maximum number of selected tokens in correct answer */
164
+ maxSelections?: number;
165
+ /**
166
+ * Minimum number of tokens
167
+ * @default 2
168
+ */
169
+ minTokens?: number;
170
+ /** Maximum number of tokens */
171
+ maxTokens?: number;
172
+ /** Maximum image width for input fields */
173
+ maxImageWidth?: ConfigureMaxImageDimensionsProp;
174
+ /** Maximum image height for input fields */
175
+ maxImageHeight?: ConfigureMaxImageDimensionsProp;
176
+ /** Rubric configuration - only relevant in environments that use pie-player-components */
177
+ withRubric?: ConfigureProp;
178
+ /** Configuration for editable-html */
179
+ mathMlOptions?: ConfigureMathMLProp;
180
+ /** Language configuration */
181
+ language?: ConfigurePropWithEnabled;
182
+ /**
183
+ * Language choices configuration
184
+ * Only available if language is enabled
185
+ */
186
+ languageChoices?: ConfigureLanguageOptions;
187
+ /** Dimensions of the authoring container */
188
+ contentDimensions?: ContentDimensions;
189
+ /** Not read by this element: the model's `promptEnabled` shows the prompt */
190
+ showPrompt?: boolean;
191
+ /** Not read by this element: `prompt.label` labels the prompt */
192
+ promptLabel?: string;
193
+ /** Not read by this element: `partialScoring.settings` shows the partial scoring control */
194
+ settingsPartialScoring?: boolean;
195
+ }
196
+ export interface SelectTextSession {
197
+ /** Identifier of the session */
198
+ id?: string;
199
+ /** The element the session belongs to */
200
+ element?: string;
201
+ /** The tokens the student selected */
202
+ selectedTokens?: TextToken[];
203
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/select-text",
3
- "version": "14.0.4-next.20261011174919",
3
+ "version": "14.0.4",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,23 +11,24 @@
11
11
  "@emotion/react": "^11.14.0",
12
12
  "@mui/icons-material": "^7.3.4",
13
13
  "@mui/material": "^7.3.4",
14
- "@pie-element/shared-utils": "0.1.4-next.20261008072957",
15
- "@pie-lib/correct-answer-toggle": "5.0.4-next.20261011174919",
16
- "@pie-lib/render-ui": "8.0.4-next.20261009061152",
17
- "@pie-lib/translator": "5.0.2-next.20261006160832",
18
- "@pie-lib/text-select": "4.0.4-next.20261009061152",
14
+ "@pie-element/shared-utils": "0.1.4",
15
+ "@pie-lib/correct-answer-toggle": "5.0.4",
16
+ "@pie-lib/render-ui": "8.0.4",
17
+ "@pie-lib/translator": "5.0.1",
18
+ "@pie-lib/text-select": "4.0.4",
19
19
  "prop-types": "^15.8.1",
20
- "@pie-element/shared-lodash": "0.1.3-next.20261006160832",
21
- "@pie-lib/config-ui": "14.0.4-next.20261011174919",
20
+ "@pie-element/shared-lodash": "0.1.2",
21
+ "@pie-lib/config-ui": "14.0.4",
22
22
  "debug": "^4.4.3",
23
- "@pie-lib/editable-html-tip-tap": "3.0.4-next.20261009061152",
24
- "@pie-element/shared-configure-events": "0.1.2-next.20261002215153",
25
- "@pie-element/shared-feedback": "0.1.3-next.20261006160832",
26
- "@pie-element/shared-controller-utils": "0.1.2-next.20261002215153",
27
- "@pie-element/shared-player-events": "0.1.2-next.20261002215153",
28
- "@pie-element/shared-math-rendering-mathjax": "0.1.5-next.20261009061152",
23
+ "@pie-lib/editable-html-tip-tap": "3.0.4",
24
+ "@pie-element/shared-configure-events": "0.1.1",
25
+ "@pie-element/shared-feedback": "0.1.2",
26
+ "@pie-element/shared-controller-utils": "0.1.2",
27
+ "@pie-element/shared-player-events": "0.1.1",
28
+ "@pie-element/shared-math-rendering-mathjax": "0.1.5",
29
29
  "react": "^18.2.0",
30
- "react-dom": "^18.2.0"
30
+ "react-dom": "^18.2.0",
31
+ "@pie-element/shared-types": "0.2.1"
31
32
  },
32
33
  "exports": {
33
34
  ".": {
@@ -82,6 +83,9 @@
82
83
  "types": "./dist/runtime-support.d.ts",
83
84
  "default": "./dist/runtime-support.js"
84
85
  },
86
+ "./schemas/model.schema.json": "./dist/schemas/model.schema.json",
87
+ "./schemas/configuration.schema.json": "./dist/schemas/configuration.schema.json",
88
+ "./schemas/session.schema.json": "./dist/schemas/session.schema.json",
85
89
  "./package.json": "./package.json"
86
90
  },
87
91
  "type": "module",
@@ -97,7 +101,7 @@
97
101
  ],
98
102
  "sideEffects": false,
99
103
  "scripts": {
100
- "build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
104
+ "build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly && bun ../../../tools/schemas/build.ts",
101
105
  "dev": "bun x vite",
102
106
  "demo": "bun x vite --mode demo",
103
107
  "test": "bun x vitest run"
@@ -111,7 +115,7 @@
111
115
  },
112
116
  "browserEditorRuntime": {
113
117
  "name": "@pie-element/shared-editor-runtime",
114
- "version": "0.1.3-next.20261006160832",
118
+ "version": "0.1.2",
115
119
  "views": {
116
120
  "delivery": "editor-runtime/delivery",
117
121
  "author": "editor-runtime/author",