@khanacademy/perseus-core 0.0.0-PR862-20231207182234 → 0.0.0-PR875-20250222011102

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