@khanacademy/perseus-core 3.0.4 → 3.1.0
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.
- package/dist/data-schema.d.ts +981 -0
- package/dist/es/index.js +2305 -2
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2312 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/objective_.d.ts +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Perseus "data schema" file.
|
|
3
|
+
*
|
|
4
|
+
* This file, and the types in it, represents the "data schema" that Perseus
|
|
5
|
+
* uses. The @khanacademy/perseus-editor package edits and produces objects
|
|
6
|
+
* that conform to the types in this file. Similarly, the top-level renderers
|
|
7
|
+
* in @khanacademy/perseus, consume objects that conform to these types.
|
|
8
|
+
*
|
|
9
|
+
* WARNING: This file should not import any types from elsewhere so that it is
|
|
10
|
+
* easy to reason about changes that alter the Perseus schema. This helps
|
|
11
|
+
* ensure that it is not changed accidentally when upgrading a dependant
|
|
12
|
+
* package or other part of Perseus code. Note that TypeScript does type
|
|
13
|
+
* checking via something called "structural typing". This means that as long
|
|
14
|
+
* as the shape of a type matches, the name it goes by doesn't matter. As a
|
|
15
|
+
* result, a `Coord` type that looks like this `[x: number, y: number]` is
|
|
16
|
+
* _identical_, in TypeScript's eyes, to this `Vector2` type `[x: number, y:
|
|
17
|
+
* number]`. Also, with tuples, the labels for each entry is ignored, so `[x:
|
|
18
|
+
* number, y: number]` is compatible with `[min: number, max: number]`. The
|
|
19
|
+
* labels are for humans, not TypeScript. :)
|
|
20
|
+
*
|
|
21
|
+
* If you make changes to types in this file, be very sure that:
|
|
22
|
+
*
|
|
23
|
+
* a) the changes are backwards compatible. If they are not, old data from
|
|
24
|
+
* previous versions of the "schema" could become unrenderable, or worse,
|
|
25
|
+
* introduce hard-to-diagnose bugs.
|
|
26
|
+
* b) the parsing code (`util/parse-perseus-json/`) is updated to handle
|
|
27
|
+
* the new format _as well as_ the old format.
|
|
28
|
+
*/
|
|
29
|
+
export type Coord = [x: number, y: number];
|
|
30
|
+
export type Interval = [min: number, max: number];
|
|
31
|
+
export type Vector2 = Coord;
|
|
32
|
+
export type Range = Interval;
|
|
33
|
+
export type Size = [width: number, height: number];
|
|
34
|
+
export type CollinearTuple = [Vector2, Vector2];
|
|
35
|
+
export type ShowSolutions = "all" | "selected" | "none";
|
|
36
|
+
/**
|
|
37
|
+
* Our core set of Perseus widgets.
|
|
38
|
+
*
|
|
39
|
+
* This interface is the basis for "registering" all Perseus widget types.
|
|
40
|
+
* There should be one key/value pair for each supported widget. If you create
|
|
41
|
+
* a new widget, an entry should be added to this interface. Note that this
|
|
42
|
+
* only registers the widget options type, you'll also need to register the
|
|
43
|
+
* widget so that it's available at runtime (@see
|
|
44
|
+
* {@link file://./widgets.ts#registerWidget}).
|
|
45
|
+
*
|
|
46
|
+
* Importantly, the key should be the name that is used in widget IDs. For most
|
|
47
|
+
* widgets that is the same as the widget option's `type` field. In cases where
|
|
48
|
+
* a widget has been deprecated and replaced with the deprecated-standin
|
|
49
|
+
* widget, it should be the original widget type!
|
|
50
|
+
*
|
|
51
|
+
* If you define the widget outside of this package, you can still add the new
|
|
52
|
+
* widget to this interface by writing the following in that package that
|
|
53
|
+
* contains the widget. TypeScript will merge that definition of the
|
|
54
|
+
* `PerseusWidgets` with the one defined below.
|
|
55
|
+
*
|
|
56
|
+
* ```typescript
|
|
57
|
+
* declare module "@khanacademy/perseus" {
|
|
58
|
+
* interface PerseusWidgetTypes {
|
|
59
|
+
* // A new widget
|
|
60
|
+
* "new-awesomeness": MyAwesomeNewWidget;
|
|
61
|
+
*
|
|
62
|
+
* // A deprecated widget
|
|
63
|
+
* "super-old-widget": DeprecatedStandinWidget;
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
*
|
|
67
|
+
* // The new widget's options definition
|
|
68
|
+
* type MyAwesomeNewWidget = WidgetOptions<'new-awesomeness', MyAwesomeNewWidgetOptions>;
|
|
69
|
+
*
|
|
70
|
+
* // The deprecated widget's options definition
|
|
71
|
+
* type SuperOldWidget = WidgetOptions<'super-old-widget', object>;
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* This interface can be extended through the magic of TypeScript "Declaration
|
|
75
|
+
* merging". Specifically, we augment this module and extend this interface.
|
|
76
|
+
*
|
|
77
|
+
* @see {@link https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation}
|
|
78
|
+
*/
|
|
79
|
+
export interface PerseusWidgetTypes {
|
|
80
|
+
categorizer: CategorizerWidget;
|
|
81
|
+
"cs-program": CSProgramWidget;
|
|
82
|
+
definition: DefinitionWidget;
|
|
83
|
+
dropdown: DropdownWidget;
|
|
84
|
+
explanation: ExplanationWidget;
|
|
85
|
+
expression: ExpressionWidget;
|
|
86
|
+
grapher: GrapherWidget;
|
|
87
|
+
"graded-group-set": GradedGroupSetWidget;
|
|
88
|
+
"graded-group": GradedGroupWidget;
|
|
89
|
+
group: GroupWidget;
|
|
90
|
+
iframe: IFrameWidget;
|
|
91
|
+
image: ImageWidget;
|
|
92
|
+
"input-number": InputNumberWidget;
|
|
93
|
+
interaction: InteractionWidget;
|
|
94
|
+
"interactive-graph": InteractiveGraphWidget;
|
|
95
|
+
"label-image": LabelImageWidget;
|
|
96
|
+
matcher: MatcherWidget;
|
|
97
|
+
matrix: MatrixWidget;
|
|
98
|
+
measurer: MeasurerWidget;
|
|
99
|
+
"mock-widget": MockWidget;
|
|
100
|
+
"molecule-renderer": MoleculeRendererWidget;
|
|
101
|
+
"number-line": NumberLineWidget;
|
|
102
|
+
"numeric-input": NumericInputWidget;
|
|
103
|
+
orderer: OrdererWidget;
|
|
104
|
+
"passage-ref-target": RefTargetWidget;
|
|
105
|
+
"passage-ref": PassageRefWidget;
|
|
106
|
+
passage: PassageWidget;
|
|
107
|
+
"phet-simulation": PhetSimulationWidget;
|
|
108
|
+
"python-program": PythonProgramWidget;
|
|
109
|
+
plotter: PlotterWidget;
|
|
110
|
+
radio: RadioWidget;
|
|
111
|
+
sorter: SorterWidget;
|
|
112
|
+
table: TableWidget;
|
|
113
|
+
video: VideoWidget;
|
|
114
|
+
"lights-puzzle": DeprecatedStandinWidget;
|
|
115
|
+
sequence: DeprecatedStandinWidget;
|
|
116
|
+
simulator: DeprecatedStandinWidget;
|
|
117
|
+
transformer: DeprecatedStandinWidget;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A map of widget IDs to widget options. This is most often used as the type
|
|
121
|
+
* for a set of widgets defined in a `PerseusItem` but can also be useful to
|
|
122
|
+
* represent a function parameter where only `widgets` from a `PerseusItem` are
|
|
123
|
+
* needed. Today Widget IDs are made up of the widget type and an incrementing
|
|
124
|
+
* integer (eg. `interactive-graph 1` or `radio 3`). It is suggested to avoid
|
|
125
|
+
* reading/parsing the widget id to derive any information from it, except in
|
|
126
|
+
* the case of this map.
|
|
127
|
+
*
|
|
128
|
+
* @see {@link PerseusWidgetTypes} additional widgets can be added to this map type
|
|
129
|
+
* by augmenting the PerseusWidgetTypes with new widget types!
|
|
130
|
+
*/
|
|
131
|
+
export type PerseusWidgetsMap = {
|
|
132
|
+
[Property in keyof PerseusWidgetTypes as `${Property} ${number}`]: PerseusWidgetTypes[Property];
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* A "PerseusItem" is a classic Perseus item. It is rendered by the
|
|
136
|
+
* `ServerItemRenderer` and the layout is pre-set.
|
|
137
|
+
*
|
|
138
|
+
* To render more complex Perseus items, see the `Item` type in the multi item
|
|
139
|
+
* area.
|
|
140
|
+
*/
|
|
141
|
+
export type PerseusItem = {
|
|
142
|
+
question: PerseusRenderer;
|
|
143
|
+
hints: ReadonlyArray<Hint>;
|
|
144
|
+
answerArea: PerseusAnswerArea | null | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* The version of the item.
|
|
147
|
+
* @deprecated Not used.
|
|
148
|
+
*/
|
|
149
|
+
itemDataVersion: any;
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated Superseded by per-widget answers.
|
|
152
|
+
*/
|
|
153
|
+
answer: any;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A "PerseusArticle" is an item that is meant to be rendered as an article.
|
|
157
|
+
* This item is never scored and is rendered by the `ArticleRenderer`.
|
|
158
|
+
*/
|
|
159
|
+
export type PerseusArticle = PerseusRenderer | ReadonlyArray<PerseusRenderer>;
|
|
160
|
+
export type Version = {
|
|
161
|
+
major: number;
|
|
162
|
+
minor: number;
|
|
163
|
+
};
|
|
164
|
+
export type PerseusRenderer = {
|
|
165
|
+
/**
|
|
166
|
+
* Translatable Markdown content to be rendered. May include references to
|
|
167
|
+
* widgets (as [[☃ widgetName]]) or images (as ).
|
|
168
|
+
* For each image found in this content, there can be an entry in the
|
|
169
|
+
* `images` dict (below) with the key being the image's url which defines
|
|
170
|
+
* additional attributes for the image.
|
|
171
|
+
*/
|
|
172
|
+
content: string;
|
|
173
|
+
/**
|
|
174
|
+
* A dictionary of {[widgetName]: Widget} to be referenced from the content
|
|
175
|
+
* field.
|
|
176
|
+
*/
|
|
177
|
+
widgets: PerseusWidgetsMap;
|
|
178
|
+
metadata?: ReadonlyArray<string>;
|
|
179
|
+
/**
|
|
180
|
+
* A dictionary of {[imageUrl]: PerseusImageDetail}.
|
|
181
|
+
*/
|
|
182
|
+
images: {
|
|
183
|
+
[imageUrl: string]: PerseusImageDetail;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
export type Hint = PerseusRenderer & {
|
|
187
|
+
/**
|
|
188
|
+
* When `true`, causes the previous hint to be replaced with this hint when
|
|
189
|
+
* displayed. When `false`, the previous hint remains visible when this one
|
|
190
|
+
* is displayed. This allows for hints that build upon each other.
|
|
191
|
+
*/
|
|
192
|
+
replace?: boolean;
|
|
193
|
+
};
|
|
194
|
+
export type PerseusImageDetail = {
|
|
195
|
+
width: number;
|
|
196
|
+
height: number;
|
|
197
|
+
};
|
|
198
|
+
export declare const ItemExtras: readonly ["calculator", "chi2Table", "financialCalculatorMonthlyPayment", "financialCalculatorTotalAmount", "financialCalculatorTimeToPayOff", "periodicTable", "periodicTableWithKey", "tTable", "zTable"];
|
|
199
|
+
export type PerseusAnswerArea = Record<(typeof ItemExtras)[number], boolean>;
|
|
200
|
+
/**
|
|
201
|
+
* The type representing the common structure of all widget's options. The
|
|
202
|
+
* `Options` generic type represents the widget-specific option data.
|
|
203
|
+
*/
|
|
204
|
+
export type WidgetOptions<Type extends string, Options> = {
|
|
205
|
+
type: Type;
|
|
206
|
+
static?: boolean;
|
|
207
|
+
graded?: boolean;
|
|
208
|
+
alignment?: string;
|
|
209
|
+
options: Options;
|
|
210
|
+
key?: number;
|
|
211
|
+
version?: Version;
|
|
212
|
+
};
|
|
213
|
+
export type CategorizerWidget = WidgetOptions<'categorizer', PerseusCategorizerWidgetOptions>;
|
|
214
|
+
export type CSProgramWidget = WidgetOptions<'cs-program', PerseusCSProgramWidgetOptions>;
|
|
215
|
+
export type DefinitionWidget = WidgetOptions<'definition', PerseusDefinitionWidgetOptions>;
|
|
216
|
+
export type DropdownWidget = WidgetOptions<'dropdown', PerseusDropdownWidgetOptions>;
|
|
217
|
+
export type ExplanationWidget = WidgetOptions<'explanation', PerseusExplanationWidgetOptions>;
|
|
218
|
+
export type ExpressionWidget = WidgetOptions<'expression', PerseusExpressionWidgetOptions>;
|
|
219
|
+
export type GradedGroupSetWidget = WidgetOptions<'graded-group-set', PerseusGradedGroupSetWidgetOptions>;
|
|
220
|
+
export type GradedGroupWidget = WidgetOptions<'graded-group', PerseusGradedGroupWidgetOptions>;
|
|
221
|
+
export type GrapherWidget = WidgetOptions<'grapher', PerseusGrapherWidgetOptions>;
|
|
222
|
+
export type GroupWidget = WidgetOptions<'group', PerseusGroupWidgetOptions>;
|
|
223
|
+
export type IFrameWidget = WidgetOptions<'iframe', PerseusIFrameWidgetOptions>;
|
|
224
|
+
export type ImageWidget = WidgetOptions<'image', PerseusImageWidgetOptions>;
|
|
225
|
+
export type InteractionWidget = WidgetOptions<'interaction', PerseusInteractionWidgetOptions>;
|
|
226
|
+
export type InteractiveGraphWidget = WidgetOptions<'interactive-graph', PerseusInteractiveGraphWidgetOptions>;
|
|
227
|
+
export type LabelImageWidget = WidgetOptions<'label-image', PerseusLabelImageWidgetOptions>;
|
|
228
|
+
export type MatcherWidget = WidgetOptions<'matcher', PerseusMatcherWidgetOptions>;
|
|
229
|
+
export type MatrixWidget = WidgetOptions<'matrix', PerseusMatrixWidgetOptions>;
|
|
230
|
+
export type MeasurerWidget = WidgetOptions<'measurer', PerseusMeasurerWidgetOptions>;
|
|
231
|
+
export type MockWidget = WidgetOptions<'mock-widget', MockWidgetOptions>;
|
|
232
|
+
export type NumberLineWidget = WidgetOptions<'number-line', PerseusNumberLineWidgetOptions>;
|
|
233
|
+
export type NumericInputWidget = WidgetOptions<'numeric-input', PerseusNumericInputWidgetOptions>;
|
|
234
|
+
export type OrdererWidget = WidgetOptions<'orderer', PerseusOrdererWidgetOptions>;
|
|
235
|
+
export type PassageRefWidget = WidgetOptions<'passage-ref', PerseusPassageRefWidgetOptions>;
|
|
236
|
+
export type PassageWidget = WidgetOptions<'passage', PerseusPassageWidgetOptions>;
|
|
237
|
+
export type PhetSimulationWidget = WidgetOptions<'phet-simulation', PerseusPhetSimulationWidgetOptions>;
|
|
238
|
+
export type PlotterWidget = WidgetOptions<'plotter', PerseusPlotterWidgetOptions>;
|
|
239
|
+
export type PythonProgramWidget = WidgetOptions<'python-program', PerseusPythonProgramWidgetOptions>;
|
|
240
|
+
export type RadioWidget = WidgetOptions<'radio', PerseusRadioWidgetOptions>;
|
|
241
|
+
export type SorterWidget = WidgetOptions<'sorter', PerseusSorterWidgetOptions>;
|
|
242
|
+
export type TableWidget = WidgetOptions<'table', PerseusTableWidgetOptions>;
|
|
243
|
+
export type InputNumberWidget = WidgetOptions<'input-number', PerseusInputNumberWidgetOptions>;
|
|
244
|
+
export type MoleculeRendererWidget = WidgetOptions<'molecule-renderer', PerseusMoleculeRendererWidgetOptions>;
|
|
245
|
+
export type RefTargetWidget = WidgetOptions<'passage-ref-target', PerseusPassageRefTargetWidgetOptions>;
|
|
246
|
+
export type VideoWidget = WidgetOptions<'video', PerseusVideoWidgetOptions>;
|
|
247
|
+
export type DeprecatedStandinWidget = WidgetOptions<'deprecated-standin', object>;
|
|
248
|
+
export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget | MatcherWidget | MatrixWidget | MeasurerWidget | MockWidget | MoleculeRendererWidget | NumberLineWidget | NumericInputWidget | OrdererWidget | PassageRefWidget | PassageWidget | PhetSimulationWidget | PlotterWidget | PythonProgramWidget | RadioWidget | RefTargetWidget | SorterWidget | TableWidget | VideoWidget | DeprecatedStandinWidget;
|
|
249
|
+
/**
|
|
250
|
+
* A background image applied to various widgets.
|
|
251
|
+
*/
|
|
252
|
+
export type PerseusImageBackground = {
|
|
253
|
+
url: string | null | undefined;
|
|
254
|
+
width?: number;
|
|
255
|
+
height?: number;
|
|
256
|
+
top?: number;
|
|
257
|
+
left?: number;
|
|
258
|
+
scale?: number | string;
|
|
259
|
+
bottom?: number;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* The type of markings to display on the graph.
|
|
263
|
+
* - axes: shows the axes without the gride lines
|
|
264
|
+
* - graph: shows the axes and the grid lines
|
|
265
|
+
* - grid: shows only the grid lines
|
|
266
|
+
* - none: shows no markings
|
|
267
|
+
*/
|
|
268
|
+
export type MarkingsType = "axes" | "graph" | "grid" | "none";
|
|
269
|
+
export type PerseusCategorizerWidgetOptions = {
|
|
270
|
+
items: ReadonlyArray<string>;
|
|
271
|
+
categories: ReadonlyArray<string>;
|
|
272
|
+
randomizeItems: boolean;
|
|
273
|
+
static: boolean;
|
|
274
|
+
values: ReadonlyArray<number>;
|
|
275
|
+
highlightLint?: boolean;
|
|
276
|
+
linterContext?: PerseusLinterContext;
|
|
277
|
+
};
|
|
278
|
+
export type PerseusLinterContext = {
|
|
279
|
+
contentType: string;
|
|
280
|
+
paths: ReadonlyArray<string>;
|
|
281
|
+
stack: ReadonlyArray<string>;
|
|
282
|
+
};
|
|
283
|
+
export type PerseusDefinitionWidgetOptions = {
|
|
284
|
+
togglePrompt: string;
|
|
285
|
+
definition: string;
|
|
286
|
+
static: boolean;
|
|
287
|
+
};
|
|
288
|
+
export type PerseusDropdownWidgetOptions = {
|
|
289
|
+
choices: ReadonlyArray<PerseusDropdownChoice>;
|
|
290
|
+
placeholder: string;
|
|
291
|
+
static: boolean;
|
|
292
|
+
visibleLabel?: string;
|
|
293
|
+
ariaLabel?: string;
|
|
294
|
+
};
|
|
295
|
+
export type PerseusDropdownChoice = {
|
|
296
|
+
content: string;
|
|
297
|
+
correct: boolean;
|
|
298
|
+
};
|
|
299
|
+
export type PerseusExplanationWidgetOptions = {
|
|
300
|
+
showPrompt: string;
|
|
301
|
+
hidePrompt: string;
|
|
302
|
+
explanation: string;
|
|
303
|
+
widgets: PerseusWidgetsMap;
|
|
304
|
+
static: boolean;
|
|
305
|
+
};
|
|
306
|
+
export type LegacyButtonSets = ReadonlyArray<"basic" | "basic+div" | "trig" | "prealgebra" | "logarithms" | "basic relations" | "advanced relations" | "scientific">;
|
|
307
|
+
export type PerseusExpressionWidgetOptions = {
|
|
308
|
+
answerForms: ReadonlyArray<PerseusExpressionAnswerForm>;
|
|
309
|
+
buttonSets: LegacyButtonSets;
|
|
310
|
+
functions: ReadonlyArray<string>;
|
|
311
|
+
times: boolean;
|
|
312
|
+
visibleLabel?: string;
|
|
313
|
+
ariaLabel?: string;
|
|
314
|
+
buttonsVisible?: "always" | "never" | "focused";
|
|
315
|
+
};
|
|
316
|
+
export declare const PerseusExpressionAnswerFormConsidered: readonly ["correct", "wrong", "ungraded"];
|
|
317
|
+
export type PerseusExpressionAnswerForm = {
|
|
318
|
+
value: string;
|
|
319
|
+
form: boolean;
|
|
320
|
+
simplify: boolean;
|
|
321
|
+
considered: (typeof PerseusExpressionAnswerFormConsidered)[number];
|
|
322
|
+
key?: string;
|
|
323
|
+
};
|
|
324
|
+
export type PerseusGradedGroupWidgetOptions = {
|
|
325
|
+
title: string;
|
|
326
|
+
hasHint?: boolean | null | undefined;
|
|
327
|
+
hint?: PerseusRenderer | null | undefined;
|
|
328
|
+
content: string;
|
|
329
|
+
widgets: PerseusWidgetsMap;
|
|
330
|
+
widgetEnabled?: boolean | null | undefined;
|
|
331
|
+
immutableWidgets?: boolean | null | undefined;
|
|
332
|
+
images: {
|
|
333
|
+
[key: string]: PerseusImageDetail;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
export type PerseusGradedGroupSetWidgetOptions = {
|
|
337
|
+
gradedGroups: ReadonlyArray<PerseusGradedGroupWidgetOptions>;
|
|
338
|
+
};
|
|
339
|
+
export type GraphRange = [
|
|
340
|
+
x: [min: number, max: number],
|
|
341
|
+
y: [min: number, max: number]
|
|
342
|
+
];
|
|
343
|
+
export type GrapherAnswerTypes = {
|
|
344
|
+
type: "absolute_value";
|
|
345
|
+
coords: null | [vertex: Coord, secondPoint: Coord];
|
|
346
|
+
} | {
|
|
347
|
+
type: "exponential";
|
|
348
|
+
asymptote: [Coord, Coord];
|
|
349
|
+
coords: null | [Coord, Coord];
|
|
350
|
+
} | {
|
|
351
|
+
type: "linear";
|
|
352
|
+
coords: null | [Coord, Coord];
|
|
353
|
+
} | {
|
|
354
|
+
type: "logarithm";
|
|
355
|
+
asymptote: [Coord, Coord];
|
|
356
|
+
coords: null | [Coord, Coord];
|
|
357
|
+
} | {
|
|
358
|
+
type: "quadratic";
|
|
359
|
+
coords: null | [vertex: Coord, secondPoint: Coord];
|
|
360
|
+
} | {
|
|
361
|
+
type: "sinusoid";
|
|
362
|
+
coords: null | [Coord, Coord];
|
|
363
|
+
} | {
|
|
364
|
+
type: "tangent";
|
|
365
|
+
coords: null | [Coord, Coord];
|
|
366
|
+
};
|
|
367
|
+
export type PerseusGrapherWidgetOptions = {
|
|
368
|
+
availableTypes: ReadonlyArray<"absolute_value" | "exponential" | "linear" | "logarithm" | "quadratic" | "sinusoid" | "tangent">;
|
|
369
|
+
correct: GrapherAnswerTypes;
|
|
370
|
+
graph: {
|
|
371
|
+
backgroundImage: {
|
|
372
|
+
bottom?: number;
|
|
373
|
+
height?: number;
|
|
374
|
+
left?: number;
|
|
375
|
+
scale?: number;
|
|
376
|
+
url?: string | null | undefined;
|
|
377
|
+
width?: number;
|
|
378
|
+
};
|
|
379
|
+
box?: [number, number];
|
|
380
|
+
editableSettings?: ReadonlyArray<"graph" | "snap" | "image" | "measure">;
|
|
381
|
+
gridStep?: [number, number];
|
|
382
|
+
labels: [string, string];
|
|
383
|
+
markings: MarkingsType;
|
|
384
|
+
range: GraphRange;
|
|
385
|
+
rulerLabel: "";
|
|
386
|
+
rulerTicks: number;
|
|
387
|
+
showProtractor?: boolean;
|
|
388
|
+
showRuler?: boolean;
|
|
389
|
+
showTooltips?: boolean;
|
|
390
|
+
snapStep?: [number, number];
|
|
391
|
+
step: [number, number];
|
|
392
|
+
valid?: boolean | string;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
export type PerseusGroupWidgetOptions = PerseusRenderer;
|
|
396
|
+
export type PerseusImageWidgetOptions = {
|
|
397
|
+
title?: string;
|
|
398
|
+
caption?: string;
|
|
399
|
+
alt?: string;
|
|
400
|
+
backgroundImage: PerseusImageBackground;
|
|
401
|
+
static?: boolean;
|
|
402
|
+
labels?: ReadonlyArray<PerseusImageLabel>;
|
|
403
|
+
range?: [Interval, Interval];
|
|
404
|
+
box?: Size;
|
|
405
|
+
};
|
|
406
|
+
export type PerseusImageLabel = {
|
|
407
|
+
content: string;
|
|
408
|
+
alignment: string;
|
|
409
|
+
coordinates: ReadonlyArray<number>;
|
|
410
|
+
};
|
|
411
|
+
export type PerseusInteractiveGraphWidgetOptions = {
|
|
412
|
+
step: [number, number];
|
|
413
|
+
gridStep?: [x: number, y: number];
|
|
414
|
+
snapStep?: [x: number, y: number];
|
|
415
|
+
backgroundImage?: PerseusImageBackground;
|
|
416
|
+
/**
|
|
417
|
+
* The type of markings to display on the graph.
|
|
418
|
+
*/
|
|
419
|
+
markings: MarkingsType;
|
|
420
|
+
labels?: ReadonlyArray<string>;
|
|
421
|
+
showProtractor: boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Whether to show the Ruler tool overlayed on top of the graph.
|
|
424
|
+
* @deprecated - no longer used by the InteractiveGraph widget. The
|
|
425
|
+
* property is kept on this type to prevent its accidental reuse in future
|
|
426
|
+
* features, since it may appear in production data.
|
|
427
|
+
*/
|
|
428
|
+
showRuler?: boolean;
|
|
429
|
+
showTooltips?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* The unit to show on the ruler. e.g. "mm", "cm", "m", "km", "in", "ft",
|
|
432
|
+
* "yd", "mi".
|
|
433
|
+
* @deprecated - no longer used by the InteractiveGraph widget. The
|
|
434
|
+
* property is kept on this type to prevent its accidental reuse in future
|
|
435
|
+
* features, since it may appear in production data.
|
|
436
|
+
*/
|
|
437
|
+
rulerLabel?: string;
|
|
438
|
+
/**
|
|
439
|
+
* How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16. Must be
|
|
440
|
+
* an integer.
|
|
441
|
+
* @deprecated - no longer used by the InteractiveGraph widget. The
|
|
442
|
+
* property is kept on this type to prevent its accidental reuse in future
|
|
443
|
+
* features, since it may appear in production data.
|
|
444
|
+
*/
|
|
445
|
+
rulerTicks?: number;
|
|
446
|
+
range: GraphRange;
|
|
447
|
+
graph: PerseusGraphType;
|
|
448
|
+
correct: PerseusGraphType;
|
|
449
|
+
lockedFigures?: ReadonlyArray<LockedFigure>;
|
|
450
|
+
fullGraphAriaLabel?: string;
|
|
451
|
+
fullGraphAriaDescription?: string;
|
|
452
|
+
};
|
|
453
|
+
export declare const lockedFigureColorNames: readonly ["blue", "green", "grayH", "purple", "pink", "orange", "red"];
|
|
454
|
+
export type LockedFigureColor = (typeof lockedFigureColorNames)[number];
|
|
455
|
+
export declare const lockedFigureColors: Record<LockedFigureColor, string>;
|
|
456
|
+
export type LockedFigure = LockedPointType | LockedLineType | LockedVectorType | LockedEllipseType | LockedPolygonType | LockedFunctionType | LockedLabelType;
|
|
457
|
+
export type LockedFigureType = LockedFigure["type"];
|
|
458
|
+
export type LockedLineStyle = "solid" | "dashed";
|
|
459
|
+
export type LockedPointType = {
|
|
460
|
+
type: "point";
|
|
461
|
+
coord: Coord;
|
|
462
|
+
color: LockedFigureColor;
|
|
463
|
+
filled: boolean;
|
|
464
|
+
labels?: LockedLabelType[];
|
|
465
|
+
ariaLabel?: string;
|
|
466
|
+
};
|
|
467
|
+
export type LockedLineType = {
|
|
468
|
+
type: "line";
|
|
469
|
+
kind: "line" | "ray" | "segment";
|
|
470
|
+
points: [point1: LockedPointType, point2: LockedPointType];
|
|
471
|
+
color: LockedFigureColor;
|
|
472
|
+
lineStyle: LockedLineStyle;
|
|
473
|
+
showPoint1: boolean;
|
|
474
|
+
showPoint2: boolean;
|
|
475
|
+
labels?: LockedLabelType[];
|
|
476
|
+
ariaLabel?: string;
|
|
477
|
+
};
|
|
478
|
+
export type LockedVectorType = {
|
|
479
|
+
type: "vector";
|
|
480
|
+
points: [tail: Coord, tip: Coord];
|
|
481
|
+
color: LockedFigureColor;
|
|
482
|
+
labels?: LockedLabelType[];
|
|
483
|
+
ariaLabel?: string;
|
|
484
|
+
};
|
|
485
|
+
export type LockedFigureFillType = "none" | "white" | "translucent" | "solid";
|
|
486
|
+
export declare const lockedFigureFillStyles: Record<LockedFigureFillType, number>;
|
|
487
|
+
export type LockedEllipseType = {
|
|
488
|
+
type: "ellipse";
|
|
489
|
+
center: Coord;
|
|
490
|
+
radius: [x: number, y: number];
|
|
491
|
+
angle: number;
|
|
492
|
+
color: LockedFigureColor;
|
|
493
|
+
fillStyle: LockedFigureFillType;
|
|
494
|
+
strokeStyle: LockedLineStyle;
|
|
495
|
+
labels?: LockedLabelType[];
|
|
496
|
+
ariaLabel?: string;
|
|
497
|
+
};
|
|
498
|
+
export type LockedPolygonType = {
|
|
499
|
+
type: "polygon";
|
|
500
|
+
points: ReadonlyArray<Coord>;
|
|
501
|
+
color: LockedFigureColor;
|
|
502
|
+
showVertices: boolean;
|
|
503
|
+
fillStyle: LockedFigureFillType;
|
|
504
|
+
strokeStyle: LockedLineStyle;
|
|
505
|
+
labels?: LockedLabelType[];
|
|
506
|
+
ariaLabel?: string;
|
|
507
|
+
};
|
|
508
|
+
export type LockedFunctionType = {
|
|
509
|
+
type: "function";
|
|
510
|
+
color: LockedFigureColor;
|
|
511
|
+
strokeStyle: LockedLineStyle;
|
|
512
|
+
equation: string;
|
|
513
|
+
directionalAxis: "x" | "y";
|
|
514
|
+
domain?: Interval;
|
|
515
|
+
labels?: LockedLabelType[];
|
|
516
|
+
ariaLabel?: string;
|
|
517
|
+
};
|
|
518
|
+
export type LockedLabelType = {
|
|
519
|
+
type: "label";
|
|
520
|
+
coord: Coord;
|
|
521
|
+
text: string;
|
|
522
|
+
color: LockedFigureColor;
|
|
523
|
+
size: "small" | "medium" | "large";
|
|
524
|
+
};
|
|
525
|
+
export type PerseusGraphType = PerseusGraphTypeAngle | PerseusGraphTypeCircle | PerseusGraphTypeLinear | PerseusGraphTypeLinearSystem | PerseusGraphTypeNone | PerseusGraphTypePoint | PerseusGraphTypePolygon | PerseusGraphTypeQuadratic | PerseusGraphTypeRay | PerseusGraphTypeSegment | PerseusGraphTypeSinusoid;
|
|
526
|
+
type PerseusGraphTypeCommon = {
|
|
527
|
+
coord?: Coord;
|
|
528
|
+
};
|
|
529
|
+
export type PerseusGraphTypeAngle = {
|
|
530
|
+
type: "angle";
|
|
531
|
+
showAngles?: boolean;
|
|
532
|
+
allowReflexAngles?: boolean;
|
|
533
|
+
angleOffsetDeg?: number;
|
|
534
|
+
snapDegrees?: number;
|
|
535
|
+
match?: "congruent";
|
|
536
|
+
coords?: [Coord, Coord, Coord] | null;
|
|
537
|
+
startCoords?: [Coord, Coord, Coord];
|
|
538
|
+
};
|
|
539
|
+
export type PerseusGraphTypeCircle = {
|
|
540
|
+
type: "circle";
|
|
541
|
+
center?: Coord;
|
|
542
|
+
radius?: number;
|
|
543
|
+
startCoords?: {
|
|
544
|
+
center: Coord;
|
|
545
|
+
radius: number;
|
|
546
|
+
};
|
|
547
|
+
} & PerseusGraphTypeCommon;
|
|
548
|
+
export type PerseusGraphTypeLinear = {
|
|
549
|
+
type: "linear";
|
|
550
|
+
coords?: CollinearTuple | null;
|
|
551
|
+
startCoords?: CollinearTuple;
|
|
552
|
+
} & PerseusGraphTypeCommon;
|
|
553
|
+
export type PerseusGraphTypeLinearSystem = {
|
|
554
|
+
type: "linear-system";
|
|
555
|
+
coords?: CollinearTuple[] | null;
|
|
556
|
+
startCoords?: CollinearTuple[];
|
|
557
|
+
} & PerseusGraphTypeCommon;
|
|
558
|
+
export type PerseusGraphTypeNone = {
|
|
559
|
+
type: "none";
|
|
560
|
+
};
|
|
561
|
+
export type PerseusGraphTypePoint = {
|
|
562
|
+
type: "point";
|
|
563
|
+
numPoints?: number | "unlimited";
|
|
564
|
+
coords?: ReadonlyArray<Coord> | null;
|
|
565
|
+
startCoords?: ReadonlyArray<Coord>;
|
|
566
|
+
} & PerseusGraphTypeCommon;
|
|
567
|
+
export type PerseusGraphTypePolygon = {
|
|
568
|
+
type: "polygon";
|
|
569
|
+
numSides?: number | "unlimited";
|
|
570
|
+
showAngles?: boolean;
|
|
571
|
+
showSides?: boolean;
|
|
572
|
+
snapTo?: "grid" | "angles" | "sides";
|
|
573
|
+
match?: "similar" | "congruent" | "approx" | "exact";
|
|
574
|
+
coords?: ReadonlyArray<Coord> | null;
|
|
575
|
+
startCoords?: ReadonlyArray<Coord>;
|
|
576
|
+
} & PerseusGraphTypeCommon;
|
|
577
|
+
export type PerseusGraphTypeQuadratic = {
|
|
578
|
+
type: "quadratic";
|
|
579
|
+
coords?: [Coord, Coord, Coord] | null;
|
|
580
|
+
startCoords?: [Coord, Coord, Coord];
|
|
581
|
+
} & PerseusGraphTypeCommon;
|
|
582
|
+
export type PerseusGraphTypeSegment = {
|
|
583
|
+
type: "segment";
|
|
584
|
+
numSegments?: number;
|
|
585
|
+
coords?: CollinearTuple[] | null;
|
|
586
|
+
startCoords?: CollinearTuple[];
|
|
587
|
+
} & PerseusGraphTypeCommon;
|
|
588
|
+
export type PerseusGraphTypeSinusoid = {
|
|
589
|
+
type: "sinusoid";
|
|
590
|
+
coords?: ReadonlyArray<Coord> | null;
|
|
591
|
+
startCoords?: ReadonlyArray<Coord>;
|
|
592
|
+
} & PerseusGraphTypeCommon;
|
|
593
|
+
export type PerseusGraphTypeRay = {
|
|
594
|
+
type: "ray";
|
|
595
|
+
coords?: CollinearTuple | null;
|
|
596
|
+
startCoords?: CollinearTuple;
|
|
597
|
+
} & PerseusGraphTypeCommon;
|
|
598
|
+
type AngleGraphCorrect = {
|
|
599
|
+
type: "angle";
|
|
600
|
+
allowReflexAngles: boolean;
|
|
601
|
+
match: "congruent";
|
|
602
|
+
coords: [Coord, Coord, Coord];
|
|
603
|
+
};
|
|
604
|
+
type CircleGraphCorrect = {
|
|
605
|
+
type: "circle";
|
|
606
|
+
center: Coord;
|
|
607
|
+
radius: number;
|
|
608
|
+
};
|
|
609
|
+
type LinearGraphCorrect = {
|
|
610
|
+
type: "linear";
|
|
611
|
+
coords: CollinearTuple;
|
|
612
|
+
};
|
|
613
|
+
type LinearSystemGraphCorrect = {
|
|
614
|
+
type: "linear-system";
|
|
615
|
+
coords: [CollinearTuple, CollinearTuple];
|
|
616
|
+
};
|
|
617
|
+
type NoneGraphCorrect = {
|
|
618
|
+
type: "none";
|
|
619
|
+
};
|
|
620
|
+
type PointGraphCorrect = {
|
|
621
|
+
type: "point";
|
|
622
|
+
coords: ReadonlyArray<Coord>;
|
|
623
|
+
};
|
|
624
|
+
type PolygonGraphCorrect = {
|
|
625
|
+
type: "polygon";
|
|
626
|
+
match: "similar" | "congruent" | "approx";
|
|
627
|
+
coords: ReadonlyArray<Coord>;
|
|
628
|
+
};
|
|
629
|
+
type QuadraticGraphCorrect = {
|
|
630
|
+
type: "quadratic";
|
|
631
|
+
coords: [Coord, Coord, Coord];
|
|
632
|
+
};
|
|
633
|
+
type SegmentGraphCorrect = {
|
|
634
|
+
type: "segment";
|
|
635
|
+
coords: CollinearTuple[];
|
|
636
|
+
};
|
|
637
|
+
type SinusoidGraphCorrect = {
|
|
638
|
+
type: "sinusoid";
|
|
639
|
+
coords: CollinearTuple;
|
|
640
|
+
};
|
|
641
|
+
type RayGraphCorrect = {
|
|
642
|
+
type: "ray";
|
|
643
|
+
coords: CollinearTuple;
|
|
644
|
+
};
|
|
645
|
+
export type PerseusGraphCorrectType = AngleGraphCorrect | CircleGraphCorrect | LinearGraphCorrect | LinearSystemGraphCorrect | NoneGraphCorrect | PointGraphCorrect | PolygonGraphCorrect | QuadraticGraphCorrect | RayGraphCorrect | SegmentGraphCorrect | SinusoidGraphCorrect;
|
|
646
|
+
export type PerseusLabelImageWidgetOptions = {
|
|
647
|
+
choices: ReadonlyArray<string>;
|
|
648
|
+
imageUrl: string;
|
|
649
|
+
imageAlt: string;
|
|
650
|
+
imageHeight: number;
|
|
651
|
+
imageWidth: number;
|
|
652
|
+
markers: ReadonlyArray<PerseusLabelImageMarker>;
|
|
653
|
+
hideChoicesFromInstructions: boolean;
|
|
654
|
+
multipleAnswers: boolean;
|
|
655
|
+
static: boolean;
|
|
656
|
+
};
|
|
657
|
+
export type PerseusLabelImageMarker = {
|
|
658
|
+
answers: ReadonlyArray<string>;
|
|
659
|
+
label: string;
|
|
660
|
+
x: number;
|
|
661
|
+
y: number;
|
|
662
|
+
};
|
|
663
|
+
export type PerseusMatcherWidgetOptions = {
|
|
664
|
+
labels: ReadonlyArray<string>;
|
|
665
|
+
left: ReadonlyArray<string>;
|
|
666
|
+
right: ReadonlyArray<string>;
|
|
667
|
+
orderMatters: boolean;
|
|
668
|
+
padding: boolean;
|
|
669
|
+
};
|
|
670
|
+
export type PerseusMatrixWidgetAnswers = ReadonlyArray<ReadonlyArray<number>>;
|
|
671
|
+
export type PerseusMatrixWidgetOptions = {
|
|
672
|
+
prefix?: string | undefined;
|
|
673
|
+
suffix?: string | undefined;
|
|
674
|
+
answers: PerseusMatrixWidgetAnswers;
|
|
675
|
+
cursorPosition?: ReadonlyArray<number> | undefined;
|
|
676
|
+
matrixBoardSize: ReadonlyArray<number>;
|
|
677
|
+
static?: boolean | undefined;
|
|
678
|
+
};
|
|
679
|
+
export type PerseusMeasurerWidgetOptions = {
|
|
680
|
+
image: PerseusImageBackground;
|
|
681
|
+
showProtractor: boolean;
|
|
682
|
+
showRuler: boolean;
|
|
683
|
+
rulerLabel: string;
|
|
684
|
+
rulerTicks: number;
|
|
685
|
+
rulerPixels: number;
|
|
686
|
+
rulerLength: number;
|
|
687
|
+
box: [number, number];
|
|
688
|
+
static: boolean;
|
|
689
|
+
};
|
|
690
|
+
export type MathFormat = "integer" | "mixed" | "improper" | "proper" | "decimal" | "percent" | "pi";
|
|
691
|
+
export type PerseusNumericInputAnswerForm = {
|
|
692
|
+
simplify: "required" | "correct" | "enforced" | "optional" | null | undefined;
|
|
693
|
+
name: MathFormat;
|
|
694
|
+
};
|
|
695
|
+
export type PerseusNumericInputWidgetOptions = {
|
|
696
|
+
answers: ReadonlyArray<PerseusNumericInputAnswer>;
|
|
697
|
+
labelText?: string | undefined;
|
|
698
|
+
size: string;
|
|
699
|
+
coefficient: boolean;
|
|
700
|
+
rightAlign?: boolean;
|
|
701
|
+
static: boolean;
|
|
702
|
+
answerForms?: ReadonlyArray<PerseusNumericInputAnswerForm>;
|
|
703
|
+
};
|
|
704
|
+
export type PerseusNumericInputAnswer = {
|
|
705
|
+
message: string;
|
|
706
|
+
value?: number | null;
|
|
707
|
+
status: string;
|
|
708
|
+
answerForms?: ReadonlyArray<MathFormat>;
|
|
709
|
+
strict: boolean;
|
|
710
|
+
maxError: number | null | undefined;
|
|
711
|
+
simplify: string | null | undefined;
|
|
712
|
+
};
|
|
713
|
+
export type PerseusNumberLineWidgetOptions = {
|
|
714
|
+
range: ReadonlyArray<number>;
|
|
715
|
+
labelRange: ReadonlyArray<number | null>;
|
|
716
|
+
labelStyle: string;
|
|
717
|
+
labelTicks: boolean;
|
|
718
|
+
isTickCtrl?: boolean | null | undefined;
|
|
719
|
+
divisionRange: ReadonlyArray<number>;
|
|
720
|
+
numDivisions: number | null | undefined;
|
|
721
|
+
snapDivisions: number;
|
|
722
|
+
tickStep: number | null | undefined;
|
|
723
|
+
correctRel: string | null | undefined;
|
|
724
|
+
correctX: number | null;
|
|
725
|
+
initialX: number | null | undefined;
|
|
726
|
+
showTooltip?: boolean;
|
|
727
|
+
static: boolean;
|
|
728
|
+
};
|
|
729
|
+
export type PerseusOrdererWidgetOptions = {
|
|
730
|
+
options: ReadonlyArray<PerseusRenderer>;
|
|
731
|
+
correctOptions: ReadonlyArray<PerseusRenderer>;
|
|
732
|
+
otherOptions: ReadonlyArray<PerseusRenderer>;
|
|
733
|
+
height: "normal" | "auto";
|
|
734
|
+
layout: "horizontal" | "vertical";
|
|
735
|
+
};
|
|
736
|
+
export type PerseusPassageWidgetOptions = {
|
|
737
|
+
footnotes: string;
|
|
738
|
+
passageText: string;
|
|
739
|
+
passageTitle: string;
|
|
740
|
+
showLineNumbers: boolean;
|
|
741
|
+
static: boolean;
|
|
742
|
+
};
|
|
743
|
+
export type PerseusPassageRefWidgetOptions = {
|
|
744
|
+
passageNumber: number;
|
|
745
|
+
referenceNumber: number;
|
|
746
|
+
summaryText?: string;
|
|
747
|
+
};
|
|
748
|
+
export declare const plotterPlotTypes: readonly ["bar", "line", "pic", "histogram", "dotplot"];
|
|
749
|
+
export type PlotType = (typeof plotterPlotTypes)[number];
|
|
750
|
+
export type PerseusPlotterWidgetOptions = {
|
|
751
|
+
labels: ReadonlyArray<string>;
|
|
752
|
+
categories: ReadonlyArray<string>;
|
|
753
|
+
type: PlotType;
|
|
754
|
+
maxY: number;
|
|
755
|
+
scaleY: number;
|
|
756
|
+
labelInterval: number | null | undefined;
|
|
757
|
+
snapsPerLine: number;
|
|
758
|
+
starting: ReadonlyArray<number>;
|
|
759
|
+
correct: ReadonlyArray<number>;
|
|
760
|
+
picUrl: string | null | undefined;
|
|
761
|
+
picSize: number | null | undefined;
|
|
762
|
+
picBoxHeight: number | null | undefined;
|
|
763
|
+
plotDimensions: ReadonlyArray<number>;
|
|
764
|
+
};
|
|
765
|
+
export type PerseusRadioWidgetOptions = {
|
|
766
|
+
choices: ReadonlyArray<PerseusRadioChoice>;
|
|
767
|
+
hasNoneOfTheAbove?: boolean;
|
|
768
|
+
countChoices?: boolean;
|
|
769
|
+
randomize?: boolean;
|
|
770
|
+
multipleSelect?: boolean;
|
|
771
|
+
deselectEnabled?: boolean;
|
|
772
|
+
onePerLine?: boolean;
|
|
773
|
+
displayCount?: any;
|
|
774
|
+
noneOfTheAbove?: false;
|
|
775
|
+
};
|
|
776
|
+
export type PerseusRadioChoice = {
|
|
777
|
+
content: string;
|
|
778
|
+
clue?: string;
|
|
779
|
+
correct?: boolean;
|
|
780
|
+
isNoneOfTheAbove?: boolean;
|
|
781
|
+
widgets?: PerseusWidgetsMap;
|
|
782
|
+
};
|
|
783
|
+
export type PerseusSorterWidgetOptions = {
|
|
784
|
+
correct: ReadonlyArray<string>;
|
|
785
|
+
padding: boolean;
|
|
786
|
+
layout: "horizontal" | "vertical";
|
|
787
|
+
};
|
|
788
|
+
export type PerseusTableWidgetOptions = {
|
|
789
|
+
headers: ReadonlyArray<string>;
|
|
790
|
+
rows: number;
|
|
791
|
+
columns: number;
|
|
792
|
+
answers: ReadonlyArray<ReadonlyArray<string>>;
|
|
793
|
+
};
|
|
794
|
+
export type PerseusInteractionWidgetOptions = {
|
|
795
|
+
graph: PerseusInteractionGraph;
|
|
796
|
+
elements: ReadonlyArray<PerseusInteractionElement>;
|
|
797
|
+
static: boolean;
|
|
798
|
+
};
|
|
799
|
+
export type PerseusInteractionGraph = {
|
|
800
|
+
editableSettings?: ReadonlyArray<"canvas" | "graph">;
|
|
801
|
+
box: Size;
|
|
802
|
+
labels: ReadonlyArray<string>;
|
|
803
|
+
range: [Interval, Interval];
|
|
804
|
+
gridStep: [number, number];
|
|
805
|
+
/**
|
|
806
|
+
* The type of markings to display on the graph.
|
|
807
|
+
*/
|
|
808
|
+
markings: MarkingsType;
|
|
809
|
+
snapStep?: [number, number];
|
|
810
|
+
valid?: boolean | string;
|
|
811
|
+
backgroundImage?: PerseusImageBackground;
|
|
812
|
+
showProtractor?: boolean;
|
|
813
|
+
showRuler?: boolean;
|
|
814
|
+
rulerLabel?: string;
|
|
815
|
+
rulerTicks?: number;
|
|
816
|
+
tickStep: [number, number];
|
|
817
|
+
};
|
|
818
|
+
export type PerseusInteractionElement = {
|
|
819
|
+
type: "function";
|
|
820
|
+
key: string;
|
|
821
|
+
options: PerseusInteractionFunctionElementOptions;
|
|
822
|
+
} | {
|
|
823
|
+
type: "label";
|
|
824
|
+
key: string;
|
|
825
|
+
options: PerseusInteractionLabelElementOptions;
|
|
826
|
+
} | {
|
|
827
|
+
type: "line";
|
|
828
|
+
key: string;
|
|
829
|
+
options: PerseusInteractionLineElementOptions;
|
|
830
|
+
} | {
|
|
831
|
+
type: "movable-line";
|
|
832
|
+
key: string;
|
|
833
|
+
options: PerseusInteractionMovableLineElementOptions;
|
|
834
|
+
} | {
|
|
835
|
+
type: "movable-point";
|
|
836
|
+
key: string;
|
|
837
|
+
options: PerseusInteractionMovablePointElementOptions;
|
|
838
|
+
} | {
|
|
839
|
+
type: "parametric";
|
|
840
|
+
key: string;
|
|
841
|
+
options: PerseusInteractionParametricElementOptions;
|
|
842
|
+
} | {
|
|
843
|
+
type: "point";
|
|
844
|
+
key: string;
|
|
845
|
+
options: PerseusInteractionPointElementOptions;
|
|
846
|
+
} | {
|
|
847
|
+
type: "rectangle";
|
|
848
|
+
key: string;
|
|
849
|
+
options: PerseusInteractionRectangleElementOptions;
|
|
850
|
+
};
|
|
851
|
+
export type PerseusInteractionFunctionElementOptions = {
|
|
852
|
+
value: string;
|
|
853
|
+
funcName: string;
|
|
854
|
+
rangeMin: string;
|
|
855
|
+
rangeMax: string;
|
|
856
|
+
color: string;
|
|
857
|
+
strokeDasharray: string;
|
|
858
|
+
strokeWidth: number;
|
|
859
|
+
};
|
|
860
|
+
export type PerseusInteractionLabelElementOptions = {
|
|
861
|
+
label: string;
|
|
862
|
+
color: string;
|
|
863
|
+
coordX: string;
|
|
864
|
+
coordY: string;
|
|
865
|
+
};
|
|
866
|
+
export type PerseusInteractionLineElementOptions = {
|
|
867
|
+
color: string;
|
|
868
|
+
startX: string;
|
|
869
|
+
startY: string;
|
|
870
|
+
endX: string;
|
|
871
|
+
endY: string;
|
|
872
|
+
strokeDasharray: string;
|
|
873
|
+
strokeWidth: number;
|
|
874
|
+
arrows: string;
|
|
875
|
+
};
|
|
876
|
+
export type PerseusInteractionMovableLineElementOptions = {
|
|
877
|
+
startX: string;
|
|
878
|
+
startY: string;
|
|
879
|
+
startSubscript: number;
|
|
880
|
+
endX: string;
|
|
881
|
+
endY: string;
|
|
882
|
+
endSubscript: number;
|
|
883
|
+
constraint: string;
|
|
884
|
+
snap: number;
|
|
885
|
+
constraintFn: string;
|
|
886
|
+
constraintXMin: string;
|
|
887
|
+
constraintXMax: string;
|
|
888
|
+
constraintYMin: string;
|
|
889
|
+
constraintYMax: string;
|
|
890
|
+
};
|
|
891
|
+
export type PerseusInteractionMovablePointElementOptions = {
|
|
892
|
+
startX: string;
|
|
893
|
+
startY: string;
|
|
894
|
+
varSubscript: number;
|
|
895
|
+
constraint: string;
|
|
896
|
+
snap: number;
|
|
897
|
+
constraintFn: string;
|
|
898
|
+
constraintXMin: string;
|
|
899
|
+
constraintXMax: string;
|
|
900
|
+
constraintYMin: string;
|
|
901
|
+
constraintYMax: string;
|
|
902
|
+
};
|
|
903
|
+
export type PerseusInteractionParametricElementOptions = {
|
|
904
|
+
x: string;
|
|
905
|
+
y: string;
|
|
906
|
+
rangeMin: string;
|
|
907
|
+
rangeMax: string;
|
|
908
|
+
color: string;
|
|
909
|
+
strokeDasharray: string;
|
|
910
|
+
strokeWidth: number;
|
|
911
|
+
};
|
|
912
|
+
export type PerseusInteractionPointElementOptions = {
|
|
913
|
+
color: string;
|
|
914
|
+
coordX: string;
|
|
915
|
+
coordY: string;
|
|
916
|
+
};
|
|
917
|
+
export type PerseusInteractionRectangleElementOptions = {
|
|
918
|
+
color: string;
|
|
919
|
+
coordX: string;
|
|
920
|
+
coordY: string;
|
|
921
|
+
width: string;
|
|
922
|
+
height: string;
|
|
923
|
+
};
|
|
924
|
+
export type PerseusCSProgramWidgetOptions = {
|
|
925
|
+
programID: string;
|
|
926
|
+
programType?: any;
|
|
927
|
+
settings: ReadonlyArray<PerseusCSProgramSetting>;
|
|
928
|
+
showEditor: boolean;
|
|
929
|
+
showButtons: boolean;
|
|
930
|
+
height: number;
|
|
931
|
+
static: boolean;
|
|
932
|
+
};
|
|
933
|
+
export type PerseusCSProgramSetting = {
|
|
934
|
+
name: string;
|
|
935
|
+
value: string;
|
|
936
|
+
};
|
|
937
|
+
export type PerseusPythonProgramWidgetOptions = {
|
|
938
|
+
programID: string;
|
|
939
|
+
height: number;
|
|
940
|
+
};
|
|
941
|
+
export type PerseusIFrameWidgetOptions = {
|
|
942
|
+
url: string;
|
|
943
|
+
settings?: ReadonlyArray<PerseusCSProgramSetting>;
|
|
944
|
+
width: number | string;
|
|
945
|
+
height: number | string;
|
|
946
|
+
allowFullScreen: boolean;
|
|
947
|
+
allowTopNavigation?: boolean;
|
|
948
|
+
static: boolean;
|
|
949
|
+
};
|
|
950
|
+
export type PerseusPhetSimulationWidgetOptions = {
|
|
951
|
+
url: string;
|
|
952
|
+
description: string;
|
|
953
|
+
};
|
|
954
|
+
export type PerseusVideoWidgetOptions = {
|
|
955
|
+
location: string;
|
|
956
|
+
static?: boolean;
|
|
957
|
+
};
|
|
958
|
+
export type MockWidgetOptions = {
|
|
959
|
+
static?: boolean;
|
|
960
|
+
value: string;
|
|
961
|
+
};
|
|
962
|
+
export type PerseusInputNumberWidgetOptions = {
|
|
963
|
+
answerType?: "number" | "decimal" | "integer" | "rational" | "improper" | "mixed" | "percent" | "pi";
|
|
964
|
+
inexact?: boolean;
|
|
965
|
+
maxError?: number | string;
|
|
966
|
+
rightAlign?: boolean;
|
|
967
|
+
simplify: "required" | "optional" | "enforced";
|
|
968
|
+
size: "normal" | "small";
|
|
969
|
+
value: string | number;
|
|
970
|
+
customKeypad?: boolean;
|
|
971
|
+
};
|
|
972
|
+
export type PerseusMoleculeRendererWidgetOptions = {
|
|
973
|
+
widgetId: string;
|
|
974
|
+
rotationAngle?: number;
|
|
975
|
+
smiles?: string;
|
|
976
|
+
};
|
|
977
|
+
export type PerseusPassageRefTargetWidgetOptions = {
|
|
978
|
+
content: string;
|
|
979
|
+
};
|
|
980
|
+
export type PerseusWidgetOptions = PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions | PerseusMatcherWidgetOptions | PerseusMatrixWidgetOptions | PerseusMeasurerWidgetOptions | PerseusMoleculeRendererWidgetOptions | PerseusNumberLineWidgetOptions | PerseusNumericInputWidgetOptions | PerseusOrdererWidgetOptions | PerseusPassageRefTargetWidgetOptions | PerseusPassageRefWidgetOptions | PerseusPassageWidgetOptions | PerseusPhetSimulationWidgetOptions | PerseusPlotterWidgetOptions | PerseusRadioWidgetOptions | PerseusSorterWidgetOptions | PerseusTableWidgetOptions | PerseusVideoWidgetOptions;
|
|
981
|
+
export {};
|