@khanacademy/perseus 0.0.1 → 0.2.1

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 (507) hide show
  1. package/.babelrc.js +1 -1
  2. package/CHANGELOG.md +29 -0
  3. package/dist/es/index.css +4361 -0
  4. package/dist/es/index.js +7 -1
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.css +4361 -0
  7. package/dist/index.js +7 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/strings.js +148 -46
  10. package/package.json +50 -4
  11. package/src/README.md +35 -0
  12. package/src/__stories__/item-renderer.stories.jsx +27 -0
  13. package/src/__stories__/server-item-renderer.stories.jsx +27 -0
  14. package/src/__testdata__/item-renderer_testdata.js +161 -0
  15. package/src/__testdata__/renderer_testdata.js +123 -0
  16. package/src/__tests__/__snapshots__/item-renderer_test.jsx.snap +233 -0
  17. package/src/__tests__/__snapshots__/perseus-markdown_test.jsx.snap +516 -0
  18. package/src/__tests__/__snapshots__/pure-markdown_test.js.snap +113 -0
  19. package/src/__tests__/__snapshots__/renderer_test.jsx.snap +576 -0
  20. package/src/__tests__/__snapshots__/server-item-renderer_test.jsx.snap +306 -0
  21. package/src/__tests__/a11y_test.jsx +304 -0
  22. package/src/__tests__/item-renderer_test.jsx +892 -0
  23. package/src/__tests__/mock-asset-loading-widget.jsx +57 -0
  24. package/src/__tests__/mock-widget.jsx +35 -0
  25. package/src/__tests__/perseus-markdown_test.jsx +747 -0
  26. package/src/__tests__/pure-markdown_test.js +552 -0
  27. package/src/__tests__/renderability_test.jsx +481 -0
  28. package/src/__tests__/renderer-api_test.jsx +333 -0
  29. package/src/__tests__/renderer_test.jsx +1792 -0
  30. package/src/__tests__/server-item-renderer_test.jsx +516 -0
  31. package/src/__tests__/test-items/image-item.js +25 -0
  32. package/src/__tests__/test-items/input-number-1-item.js +27 -0
  33. package/src/__tests__/test-items/input-number-2-item.js +39 -0
  34. package/src/__tests__/test-items/table-item.js +30 -0
  35. package/src/__tests__/tex-wrangler_test.js +83 -0
  36. package/src/__tests__/util_test.js +41 -0
  37. package/src/a11y.js +46 -0
  38. package/src/all-widgets.js +9 -0
  39. package/src/article-renderer.jsx +215 -0
  40. package/src/asset-context.js +30 -0
  41. package/src/basic-widgets.js +13 -0
  42. package/src/components/__stories__/button-group.stories.jsx +61 -0
  43. package/src/components/__stories__/fixed-to-responsive.stories.jsx +132 -0
  44. package/src/components/__stories__/graph.stories.jsx +27 -0
  45. package/src/components/__stories__/graphie.stories.jsx +28 -0
  46. package/src/components/__stories__/hud.stories.jsx +36 -0
  47. package/src/components/__stories__/icon.stories.jsx +56 -0
  48. package/src/components/__stories__/image-loader.stories.jsx +60 -0
  49. package/src/components/__stories__/info-tip.stories.jsx +33 -0
  50. package/src/components/__stories__/inline-icon.stories.jsx +39 -0
  51. package/src/components/__stories__/input-with-examples.stories.jsx +51 -0
  52. package/src/components/__stories__/lint.stories.jsx +40 -0
  53. package/src/components/__stories__/math-input.stories.jsx +29 -0
  54. package/src/components/__stories__/math-output.stories.jsx +24 -0
  55. package/src/components/__stories__/multi-button-group.stories.jsx +69 -0
  56. package/src/components/__stories__/number-input.stories.jsx +42 -0
  57. package/src/components/__stories__/possible-answers.stories.jsx +22 -0
  58. package/src/components/__stories__/prop-check-box.stories.jsx +62 -0
  59. package/src/components/__stories__/range-input.stories.jsx +28 -0
  60. package/src/components/__stories__/simple-keypad-input.stories.jsx +28 -0
  61. package/src/components/__stories__/sortable.stories.jsx +73 -0
  62. package/src/components/__stories__/stub-tag-editor.stories.jsx +44 -0
  63. package/src/components/__stories__/svg-image.stories.jsx +60 -0
  64. package/src/components/__stories__/tex.stories.jsx +18 -0
  65. package/src/components/__stories__/text-buttons.stories.jsx +51 -0
  66. package/src/components/__stories__/text-input.stories.jsx +34 -0
  67. package/src/components/__stories__/text-list-editor.stories.jsx +33 -0
  68. package/src/components/__stories__/zoomable-tex.stories.jsx +39 -0
  69. package/src/components/__stories__/zoomable.stories.jsx +40 -0
  70. package/src/components/__testdata__/sorter_testdata.js +20 -0
  71. package/src/components/__tests__/__snapshots__/sortable_test.jsx.snap +79 -0
  72. package/src/components/__tests__/__snapshots__/sorter_test.jsx.snap +297 -0
  73. package/src/components/__tests__/number-input_test.jsx +112 -0
  74. package/src/components/__tests__/sortable_test.jsx +234 -0
  75. package/src/components/__tests__/sorter_test.jsx +111 -0
  76. package/src/components/__tests__/zoomable_test.jsx +388 -0
  77. package/src/components/button-group.jsx +131 -0
  78. package/src/components/constants.js +15 -0
  79. package/src/components/fixed-to-responsive.jsx +164 -0
  80. package/src/components/graph.jsx +415 -0
  81. package/src/components/graphie-classes.jsx +148 -0
  82. package/src/components/graphie-movables.jsx +342 -0
  83. package/src/components/graphie.jsx +353 -0
  84. package/src/components/highlighting/highlightable-content.jsx +245 -0
  85. package/src/components/highlighting/highlights.js +208 -0
  86. package/src/components/highlighting/ranges.js +299 -0
  87. package/src/components/highlighting/types.js +73 -0
  88. package/src/components/highlighting/ui/highlight-renderer.jsx +179 -0
  89. package/src/components/highlighting/ui/highlight-set-renderer.jsx +190 -0
  90. package/src/components/highlighting/ui/highlight-tooltip.jsx +153 -0
  91. package/src/components/highlighting/ui/highlighting-ui.jsx +163 -0
  92. package/src/components/highlighting/ui/selection-tracker.jsx +195 -0
  93. package/src/components/highlighting/ui/types.js +21 -0
  94. package/src/components/highlighting/ui/util.js +166 -0
  95. package/src/components/highlighting/word-indexer.jsx +155 -0
  96. package/src/components/hud.jsx +179 -0
  97. package/src/components/icon.jsx +149 -0
  98. package/src/components/image-loader.jsx +175 -0
  99. package/src/components/info-tip/info-tip.jsx +146 -0
  100. package/src/components/info-tip.jsx +38 -0
  101. package/src/components/inline-icon.jsx +81 -0
  102. package/src/components/input-with-examples.jsx +231 -0
  103. package/src/components/lint.jsx +454 -0
  104. package/src/components/math-input.jsx +282 -0
  105. package/src/components/math-output.jsx +128 -0
  106. package/src/components/multi-button-group.jsx +137 -0
  107. package/src/components/new-tooltip/README.md +110 -0
  108. package/src/components/new-tooltip/__stories__/flexible-position.stories.jsx +437 -0
  109. package/src/components/new-tooltip/__stories__/new-tooltip.stories.jsx +665 -0
  110. package/src/components/new-tooltip/__stories__/tooltip-arrow.stories.jsx +70 -0
  111. package/src/components/new-tooltip/__stories__/tooltip-bubble.stories.jsx +98 -0
  112. package/src/components/new-tooltip/__tests__/style-constants_test.js +8 -0
  113. package/src/components/new-tooltip/__tests__/util_test.js +47 -0
  114. package/src/components/new-tooltip/flexible-position.jsx +182 -0
  115. package/src/components/new-tooltip/new-tooltip.jsx +399 -0
  116. package/src/components/new-tooltip/style-constants.js +13 -0
  117. package/src/components/new-tooltip/tooltip-arrow.jsx +184 -0
  118. package/src/components/new-tooltip/tooltip-bubble.jsx +223 -0
  119. package/src/components/new-tooltip/tooltip-portal.jsx +101 -0
  120. package/src/components/new-tooltip/tooltip-positioner.jsx +529 -0
  121. package/src/components/new-tooltip/types.js +183 -0
  122. package/src/components/new-tooltip/util.js +27 -0
  123. package/src/components/number-input.jsx +253 -0
  124. package/src/components/possible-answers.jsx +36 -0
  125. package/src/components/prop-check-box.jsx +80 -0
  126. package/src/components/range-input.jsx +61 -0
  127. package/src/components/simple-keypad-input.jsx +91 -0
  128. package/src/components/sortable.jsx +873 -0
  129. package/src/components/stub-tag-editor.jsx +54 -0
  130. package/src/components/svg-image.jsx +762 -0
  131. package/src/components/tex-buttons.jsx +322 -0
  132. package/src/components/tex.jsx +70 -0
  133. package/src/components/text-input.jsx +82 -0
  134. package/src/components/text-list-editor.jsx +157 -0
  135. package/src/components/tooltip.jsx +395 -0
  136. package/src/components/visibility-observer/__stories__/visibility-observer.stories.jsx +140 -0
  137. package/src/components/visibility-observer/get-scroll-parent.js +45 -0
  138. package/src/components/visibility-observer/visibility-observer.js +109 -0
  139. package/src/components/visibility-observer/visibility-observer.jsx +123 -0
  140. package/src/components/zoomable-tex.jsx +70 -0
  141. package/src/components/zoomable.jsx +304 -0
  142. package/src/components.js +17 -0
  143. package/src/dependencies.js +22 -0
  144. package/src/error-boundary.jsx +48 -0
  145. package/src/extra-widgets.js +75 -0
  146. package/src/gorgon/README +40 -0
  147. package/src/gorgon/__tests__/matcher_test.js +497 -0
  148. package/src/gorgon/__tests__/rule_test.js +101 -0
  149. package/src/gorgon/__tests__/rules_test.js +487 -0
  150. package/src/gorgon/__tests__/selector-parser_test.js +52 -0
  151. package/src/gorgon/__tests__/tree-transformer_test.js +446 -0
  152. package/src/gorgon/gorgon.js +290 -0
  153. package/src/gorgon/proptypes.js +29 -0
  154. package/src/gorgon/rule.js +413 -0
  155. package/src/gorgon/rules/absolute-url.js +24 -0
  156. package/src/gorgon/rules/all-rules.js +72 -0
  157. package/src/gorgon/rules/blockquoted-math.js +10 -0
  158. package/src/gorgon/rules/blockquoted-widget.js +10 -0
  159. package/src/gorgon/rules/double-spacing-after-terminal.js +12 -0
  160. package/src/gorgon/rules/extra-content-spacing.js +12 -0
  161. package/src/gorgon/rules/heading-level-1.js +14 -0
  162. package/src/gorgon/rules/heading-level-skip.js +20 -0
  163. package/src/gorgon/rules/heading-sentence-case.js +11 -0
  164. package/src/gorgon/rules/heading-title-case.js +63 -0
  165. package/src/gorgon/rules/image-alt-text.js +21 -0
  166. package/src/gorgon/rules/image-in-table.js +10 -0
  167. package/src/gorgon/rules/image-spaces-around-urls.js +35 -0
  168. package/src/gorgon/rules/image-widget.js +50 -0
  169. package/src/gorgon/rules/link-click-here.js +11 -0
  170. package/src/gorgon/rules/lint-utils.js +48 -0
  171. package/src/gorgon/rules/long-paragraph.js +14 -0
  172. package/src/gorgon/rules/math-adjacent.js +10 -0
  173. package/src/gorgon/rules/math-align-extra-break.js +11 -0
  174. package/src/gorgon/rules/math-align-linebreaks.js +43 -0
  175. package/src/gorgon/rules/math-empty.js +10 -0
  176. package/src/gorgon/rules/math-font-size.js +12 -0
  177. package/src/gorgon/rules/math-frac.js +10 -0
  178. package/src/gorgon/rules/math-nested.js +11 -0
  179. package/src/gorgon/rules/math-starts-with-space.js +12 -0
  180. package/src/gorgon/rules/math-text-empty.js +10 -0
  181. package/src/gorgon/rules/math-without-dollars.js +14 -0
  182. package/src/gorgon/rules/nested-lists.js +11 -0
  183. package/src/gorgon/rules/profanity.js +10 -0
  184. package/src/gorgon/rules/table-missing-cells.js +20 -0
  185. package/src/gorgon/rules/unbalanced-code-delimiters.js +14 -0
  186. package/src/gorgon/rules/unescaped-dollar.js +10 -0
  187. package/src/gorgon/rules/widget-in-table.js +10 -0
  188. package/src/gorgon/selector.js +506 -0
  189. package/src/gorgon/tree-transformer.js +588 -0
  190. package/src/hint-renderer.jsx +159 -0
  191. package/src/hints-renderer.jsx +359 -0
  192. package/src/icon-paths.js +120 -0
  193. package/src/index.js +149 -2
  194. package/src/init.js +49 -0
  195. package/src/interaction-tracker.js +60 -0
  196. package/src/interactive2/__tests__/movable-mock.js +48 -0
  197. package/src/interactive2/__tests__/movable-point_test.js +146 -0
  198. package/src/interactive2/interactive-util.js +152 -0
  199. package/src/interactive2/movable-helper-methods.js +160 -0
  200. package/src/interactive2/movable-line-options.js +392 -0
  201. package/src/interactive2/movable-line.js +322 -0
  202. package/src/interactive2/movable-point-options.js +190 -0
  203. package/src/interactive2/movable-point.jsx +603 -0
  204. package/src/interactive2/movable-polygon-options.js +351 -0
  205. package/src/interactive2/movable-polygon.js +368 -0
  206. package/src/interactive2/movable.js +273 -0
  207. package/src/interactive2/objective_.js +79 -0
  208. package/src/interactive2/types.js +3 -0
  209. package/src/interactive2/wrapped-defaults.js +86 -0
  210. package/src/interactive2/wrapped-ellipse.js +87 -0
  211. package/src/interactive2/wrapped-line.js +109 -0
  212. package/src/interactive2/wrapped-path.js +47 -0
  213. package/src/interactive2.js +91 -0
  214. package/src/item-renderer.jsx +518 -0
  215. package/src/item-version.js +12 -0
  216. package/src/jipt-paragraphs.js +44 -0
  217. package/src/jquery.mobile.vmouse.js +545 -0
  218. package/src/keypad-context.js +33 -0
  219. package/src/loading-context.js +20 -0
  220. package/src/logging/log.js +107 -0
  221. package/src/logging/log_test.js +41 -0
  222. package/src/mixins/changeable.jsx +115 -0
  223. package/src/mixins/editor-jsonify.jsx +13 -0
  224. package/src/mixins/provide-keypad.jsx +129 -0
  225. package/src/mixins/widget-jsonify-deprecated.jsx +23 -0
  226. package/src/mixins/widget-prop-blacklist.js +36 -0
  227. package/src/multi-items/__stories__/multi-renderer.stories.js +88 -0
  228. package/src/multi-items/__testdata__/multi-renderer_testdata.js +174 -0
  229. package/src/multi-items/__tests__/__snapshots__/multi-renderer_test.js.snap +994 -0
  230. package/src/multi-items/__tests__/items_test.js +245 -0
  231. package/src/multi-items/__tests__/multi-renderer_test.js +903 -0
  232. package/src/multi-items/__tests__/prop-type-builders_test.js +134 -0
  233. package/src/multi-items/__tests__/shapes_test.js +44 -0
  234. package/src/multi-items/__tests__/trees_test.js +316 -0
  235. package/src/multi-items/item-types.js +55 -0
  236. package/src/multi-items/items.js +176 -0
  237. package/src/multi-items/multi-renderer.jsx +543 -0
  238. package/src/multi-items/prop-type-builders.js +105 -0
  239. package/src/multi-items/shape-types.js +47 -0
  240. package/src/multi-items/shapes.js +53 -0
  241. package/src/multi-items/tree-types.js +42 -0
  242. package/src/multi-items/trees.js +345 -0
  243. package/src/multi-items.js +76 -0
  244. package/src/not-gorgon.js +129 -0
  245. package/src/perseus-api.jsx +270 -0
  246. package/src/perseus-env.js +26 -0
  247. package/src/perseus-error.js +19 -0
  248. package/src/perseus-markdown.jsx +433 -0
  249. package/src/perseus-types.js +1597 -0
  250. package/src/pure-markdown.js +347 -0
  251. package/src/question-paragraph.jsx +30 -0
  252. package/src/renderability.jsx +108 -0
  253. package/src/renderer.jsx +1932 -0
  254. package/src/server-item-renderer.jsx +467 -0
  255. package/src/sigfigs.jsx +492 -0
  256. package/src/styles/articles.less +748 -0
  257. package/src/styles/constants.js +119 -0
  258. package/src/styles/global-constants.js +350 -0
  259. package/src/styles/global-styles.js +307 -0
  260. package/src/styles/khan-exercise.css +1304 -0
  261. package/src/styles/media-queries.js +48 -0
  262. package/src/styles/perseus-renderer.less +1007 -0
  263. package/src/styles/shared.js +132 -0
  264. package/src/styles/util.less +47 -0
  265. package/src/styles/variables.boostrap.less +301 -0
  266. package/src/styles/variables.less +68 -0
  267. package/src/styles/variables.shared.less +356 -0
  268. package/src/styles/widgets/categorizer.less +39 -0
  269. package/src/styles/widgets/definition.less +86 -0
  270. package/src/styles/widgets/dropdown.less +3 -0
  271. package/src/styles/widgets/expression.less +147 -0
  272. package/src/styles/widgets/graded-group.less +36 -0
  273. package/src/styles/widgets/grapher.less +11 -0
  274. package/src/styles/widgets/group.less +19 -0
  275. package/src/styles/widgets/image.less +29 -0
  276. package/src/styles/widgets/interactive-graph.less +61 -0
  277. package/src/styles/widgets/label-image.less +41 -0
  278. package/src/styles/widgets/matcher.less +8 -0
  279. package/src/styles/widgets/matrix.less +120 -0
  280. package/src/styles/widgets/measurer.less +20 -0
  281. package/src/styles/widgets/orderer.less +97 -0
  282. package/src/styles/widgets/passage.less +151 -0
  283. package/src/styles/widgets/plotter.less +33 -0
  284. package/src/styles/widgets/radio.less +52 -0
  285. package/src/styles/widgets/reaction-diagram.less +35 -0
  286. package/src/styles/widgets/sequence.less +5 -0
  287. package/src/styles/widgets/sortable.less +127 -0
  288. package/src/styles/widgets/table.less +56 -0
  289. package/src/styles/widgets/transformer.less +28 -0
  290. package/src/styles/widgets/unit.less +14 -0
  291. package/src/tex-wrangler.js +176 -0
  292. package/src/traversal.jsx +141 -0
  293. package/src/types.js +538 -0
  294. package/src/util/a11y.js +24 -0
  295. package/src/util/answer-types.js +862 -0
  296. package/src/util/answer-types_test.js +115 -0
  297. package/src/util/colors.js +94 -0
  298. package/src/util/fix-passage-refs.jsx +122 -0
  299. package/src/util/graph-utils.js +16 -0
  300. package/src/util/graphie.js +1586 -0
  301. package/src/util/interactive.js +4078 -0
  302. package/src/util/katex-preprocess.js +16 -0
  303. package/src/util/math.js +296 -0
  304. package/src/util/mobile-native-utils.js +14 -0
  305. package/src/util/mobile-native-utils_test.js +24 -0
  306. package/src/util/register-all-widgets-for-testing.js +12 -0
  307. package/src/util/scroll-utils.js +162 -0
  308. package/src/util/sizing-utils.js +46 -0
  309. package/src/util/tex.js +203 -0
  310. package/src/util/url-utils.js +36 -0
  311. package/src/util.js +990 -0
  312. package/src/version.js +11 -0
  313. package/src/widget-container.jsx +174 -0
  314. package/src/widgets/__stories__/categorizer.stories.jsx +15 -0
  315. package/src/widgets/__stories__/cs-program.stories.jsx +15 -0
  316. package/src/widgets/__stories__/definition.stories.jsx +38 -0
  317. package/src/widgets/__stories__/dropdown.stories.jsx +15 -0
  318. package/src/widgets/__stories__/explanation.stories.jsx +19 -0
  319. package/src/widgets/__stories__/expression.stories.jsx +26 -0
  320. package/src/widgets/__stories__/graded-group-set.stories.jsx +32 -0
  321. package/src/widgets/__stories__/graded-group.stories.jsx +32 -0
  322. package/src/widgets/__stories__/grapher.stories.jsx +47 -0
  323. package/src/widgets/__stories__/group.stories.jsx +15 -0
  324. package/src/widgets/__stories__/iframe.stories.jsx +15 -0
  325. package/src/widgets/__stories__/image.stories.jsx +62 -0
  326. package/src/widgets/__stories__/input-number.stories.jsx +90 -0
  327. package/src/widgets/__stories__/interaction.stories.jsx +15 -0
  328. package/src/widgets/__stories__/interactive-graph.stories.jsx +61 -0
  329. package/src/widgets/__stories__/matcher.stories.jsx +15 -0
  330. package/src/widgets/__stories__/matrix.stories.jsx +15 -0
  331. package/src/widgets/__stories__/number-line.stories.jsx +15 -0
  332. package/src/widgets/__stories__/numeric-input.stories.jsx +19 -0
  333. package/src/widgets/__stories__/orderer.stories.jsx +15 -0
  334. package/src/widgets/__stories__/passage-ref.stories.jsx +19 -0
  335. package/src/widgets/__stories__/passage.stories.jsx +19 -0
  336. package/src/widgets/__stories__/radio.stories.jsx +82 -0
  337. package/src/widgets/__stories__/sorter.stories.jsx +15 -0
  338. package/src/widgets/__stories__/transformer.stories.jsx +15 -0
  339. package/src/widgets/__stories__/unit.stories.jsx +45 -0
  340. package/src/widgets/__stories__/video-transcript-link.stories.jsx +24 -0
  341. package/src/widgets/__stories__/video.stories.jsx +15 -0
  342. package/src/widgets/__testdata__/categorizer_testdata.js +50 -0
  343. package/src/widgets/__testdata__/cs-program_testdata.js +28 -0
  344. package/src/widgets/__testdata__/dropdown_testdata.js +34 -0
  345. package/src/widgets/__testdata__/explanation_testdata.js +56 -0
  346. package/src/widgets/__testdata__/expression_testdata.js +95 -0
  347. package/src/widgets/__testdata__/graded-group-set_testdata.js +358 -0
  348. package/src/widgets/__testdata__/graded-group_testdata.js +79 -0
  349. package/src/widgets/__testdata__/grapher_testdata.js +376 -0
  350. package/src/widgets/__testdata__/group_testdata.js +156 -0
  351. package/src/widgets/__testdata__/iframe_testdata.js +36 -0
  352. package/src/widgets/__testdata__/image_testdata.js +38 -0
  353. package/src/widgets/__testdata__/input-number_testdata.js +73 -0
  354. package/src/widgets/__testdata__/interaction_testdata.js +264 -0
  355. package/src/widgets/__testdata__/interactive-graph_testdata.js +646 -0
  356. package/src/widgets/__testdata__/matcher_testdata.js +34 -0
  357. package/src/widgets/__testdata__/matrix_testdata.js +29 -0
  358. package/src/widgets/__testdata__/number-line_testdata.js +31 -0
  359. package/src/widgets/__testdata__/numeric-input_testdata.js +266 -0
  360. package/src/widgets/__testdata__/orderer_testdata.js +58 -0
  361. package/src/widgets/__testdata__/passage-ref_testdata.js +41 -0
  362. package/src/widgets/__testdata__/passage_testdata.js +71 -0
  363. package/src/widgets/__testdata__/radio_testdata.js +210 -0
  364. package/src/widgets/__testdata__/sorter_testdata.js +20 -0
  365. package/src/widgets/__testdata__/transformer_testdata.js +109 -0
  366. package/src/widgets/__testdata__/video_testdata.js +22 -0
  367. package/src/widgets/__tests__/__snapshots__/categorizer_test.jsx.snap +928 -0
  368. package/src/widgets/__tests__/__snapshots__/cs-program_test.jsx.snap +75 -0
  369. package/src/widgets/__tests__/__snapshots__/definition_test.js.snap +99 -0
  370. package/src/widgets/__tests__/__snapshots__/dropdown_test.jsx.snap +143 -0
  371. package/src/widgets/__tests__/__snapshots__/explanation_test.js.snap +473 -0
  372. package/src/widgets/__tests__/__snapshots__/expression_test.jsx.snap +38 -0
  373. package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt_test.jsx.snap +754 -0
  374. package/src/widgets/__tests__/__snapshots__/graded-group-set_test.jsx.snap +310 -0
  375. package/src/widgets/__tests__/__snapshots__/graded-group_test.jsx.snap +863 -0
  376. package/src/widgets/__tests__/__snapshots__/grapher_test.jsx.snap +2880 -0
  377. package/src/widgets/__tests__/__snapshots__/group_test.jsx.snap +1154 -0
  378. package/src/widgets/__tests__/__snapshots__/iframe_test.jsx.snap +69 -0
  379. package/src/widgets/__tests__/__snapshots__/image_test.jsx.snap +388 -0
  380. package/src/widgets/__tests__/__snapshots__/input-number_test.jsx.snap +978 -0
  381. package/src/widgets/__tests__/__snapshots__/interaction_test.jsx.snap +311 -0
  382. package/src/widgets/__tests__/__snapshots__/interactive-graph_test.jsx.snap +2915 -0
  383. package/src/widgets/__tests__/__snapshots__/matcher_test.jsx.snap +1039 -0
  384. package/src/widgets/__tests__/__snapshots__/matrix_test.jsx.snap +450 -0
  385. package/src/widgets/__tests__/__snapshots__/number-line_test.jsx.snap +888 -0
  386. package/src/widgets/__tests__/__snapshots__/numeric-input_test.jsx.snap +930 -0
  387. package/src/widgets/__tests__/__snapshots__/orderer_test.jsx.snap +275 -0
  388. package/src/widgets/__tests__/__snapshots__/passage-ref_test.jsx.snap +446 -0
  389. package/src/widgets/__tests__/__snapshots__/passage_test.jsx.snap +1988 -0
  390. package/src/widgets/__tests__/__snapshots__/radio_test.jsx.snap +7107 -0
  391. package/src/widgets/__tests__/__snapshots__/video_test.jsx.snap +163 -0
  392. package/src/widgets/__tests__/categorizer_test.jsx +205 -0
  393. package/src/widgets/__tests__/cs-program_test.jsx +45 -0
  394. package/src/widgets/__tests__/definition_test.js +152 -0
  395. package/src/widgets/__tests__/dropdown_test.jsx +106 -0
  396. package/src/widgets/__tests__/explanation_test.js +199 -0
  397. package/src/widgets/__tests__/expression_test.jsx +439 -0
  398. package/src/widgets/__tests__/graded-group-set-jipt_test.jsx +33 -0
  399. package/src/widgets/__tests__/graded-group-set_test.jsx +270 -0
  400. package/src/widgets/__tests__/graded-group_test.jsx +233 -0
  401. package/src/widgets/__tests__/grapher.cypress.jsx +486 -0
  402. package/src/widgets/__tests__/grapher_test.jsx +35 -0
  403. package/src/widgets/__tests__/group_test.jsx +512 -0
  404. package/src/widgets/__tests__/iframe_test.jsx +47 -0
  405. package/src/widgets/__tests__/image_test.jsx +65 -0
  406. package/src/widgets/__tests__/input-number_test.jsx +360 -0
  407. package/src/widgets/__tests__/interaction_test.jsx +33 -0
  408. package/src/widgets/__tests__/interactive-graph.cypress.jsx +697 -0
  409. package/src/widgets/__tests__/interactive-graph_test.jsx +105 -0
  410. package/src/widgets/__tests__/matcher_test.jsx +157 -0
  411. package/src/widgets/__tests__/matrix_test.jsx +84 -0
  412. package/src/widgets/__tests__/number-line_test.jsx +81 -0
  413. package/src/widgets/__tests__/numeric-input_test.jsx +574 -0
  414. package/src/widgets/__tests__/orderer_test.jsx +75 -0
  415. package/src/widgets/__tests__/passage-ref_test.jsx +166 -0
  416. package/src/widgets/__tests__/passage_test.jsx +133 -0
  417. package/src/widgets/__tests__/radio/base-radio_test.jsx +82 -0
  418. package/src/widgets/__tests__/radio_test.jsx +651 -0
  419. package/src/widgets/__tests__/renderQuestion.jsx +66 -0
  420. package/src/widgets/__tests__/unit_test.jsx +144 -0
  421. package/src/widgets/__tests__/video_test.jsx +55 -0
  422. package/src/widgets/categorizer.jsx +338 -0
  423. package/src/widgets/cs-program.jsx +227 -0
  424. package/src/widgets/definition.jsx +141 -0
  425. package/src/widgets/dropdown.jsx +143 -0
  426. package/src/widgets/explanation.jsx +315 -0
  427. package/src/widgets/expression.jsx +652 -0
  428. package/src/widgets/graded-group-answer-bar.jsx +152 -0
  429. package/src/widgets/graded-group-set.jsx +285 -0
  430. package/src/widgets/graded-group.jsx +448 -0
  431. package/src/widgets/grapher/util.jsx +806 -0
  432. package/src/widgets/grapher.jsx +663 -0
  433. package/src/widgets/group.jsx +213 -0
  434. package/src/widgets/iframe.jsx +198 -0
  435. package/src/widgets/image.jsx +310 -0
  436. package/src/widgets/input-number.jsx +411 -0
  437. package/src/widgets/interaction/arrow-picker.jsx +39 -0
  438. package/src/widgets/interaction/color-picker.jsx +69 -0
  439. package/src/widgets/interaction/dash-picker.jsx +46 -0
  440. package/src/widgets/interaction/element-container.jsx +97 -0
  441. package/src/widgets/interaction.jsx +742 -0
  442. package/src/widgets/interactive-graph.jsx +2820 -0
  443. package/src/widgets/label-image/__stories__/answer-choices.stories.jsx +93 -0
  444. package/src/widgets/label-image/__stories__/marker.stories.jsx +172 -0
  445. package/src/widgets/label-image/answer-choices.jsx +311 -0
  446. package/src/widgets/label-image/marker.jsx +365 -0
  447. package/src/widgets/label-image/types.js +33 -0
  448. package/src/widgets/label-image.jsx +841 -0
  449. package/src/widgets/label-image_test.js +840 -0
  450. package/src/widgets/lights-puzzle.jsx +356 -0
  451. package/src/widgets/matcher.jsx +271 -0
  452. package/src/widgets/matrix.jsx +616 -0
  453. package/src/widgets/measurer.jsx +215 -0
  454. package/src/widgets/molecule/__tests__/layout_test.jsx +159 -0
  455. package/src/widgets/molecule/__tests__/parser_test.jsx +142 -0
  456. package/src/widgets/molecule/molecule-drawing.jsx +175 -0
  457. package/src/widgets/molecule/molecule-layout.jsx +367 -0
  458. package/src/widgets/molecule/smiles-parser.jsx +300 -0
  459. package/src/widgets/molecule.jsx +172 -0
  460. package/src/widgets/number-line.jsx +858 -0
  461. package/src/widgets/numeric-input.jsx +622 -0
  462. package/src/widgets/orderer.jsx +753 -0
  463. package/src/widgets/passage/__tests__/passage-markdown_test.jsx +382 -0
  464. package/src/widgets/passage/get-line-height-for-node.js +10 -0
  465. package/src/widgets/passage/passage-markdown.jsx +416 -0
  466. package/src/widgets/passage-ref-target.jsx +70 -0
  467. package/src/widgets/passage-ref.jsx +198 -0
  468. package/src/widgets/passage.jsx +601 -0
  469. package/src/widgets/plotter.jsx +1198 -0
  470. package/src/widgets/radio/__stories__/base-radio.stories.jsx +40 -0
  471. package/src/widgets/radio/__stories__/choice-icon.stories.jsx +157 -0
  472. package/src/widgets/radio/__stories__/choice-none-above.stories.jsx +26 -0
  473. package/src/widgets/radio/__stories__/cross-out-button.stories.jsx +64 -0
  474. package/src/widgets/radio/__stories__/cross-out-menu.stories.jsx +59 -0
  475. package/src/widgets/radio/__stories__/cross-out-tooltip.stories.jsx +59 -0
  476. package/src/widgets/radio/__stories__/focus-ring.stories.jsx +38 -0
  477. package/src/widgets/radio/__stories__/option-status.stories.jsx +118 -0
  478. package/src/widgets/radio/__stories__/toggleable-radio-button.stories.jsx +28 -0
  479. package/src/widgets/radio/base-radio.jsx +642 -0
  480. package/src/widgets/radio/choice-icon.jsx +468 -0
  481. package/src/widgets/radio/choice-none-above.jsx +54 -0
  482. package/src/widgets/radio/choice.jsx +692 -0
  483. package/src/widgets/radio/choice.jsx.fixture.js +64 -0
  484. package/src/widgets/radio/cross-out-button.jsx +136 -0
  485. package/src/widgets/radio/cross-out-menu-wrapper.jsx +492 -0
  486. package/src/widgets/radio/cross-out-tooltip.jsx +129 -0
  487. package/src/widgets/radio/focus-ring.jsx +51 -0
  488. package/src/widgets/radio/option-status.jsx +89 -0
  489. package/src/widgets/radio/toggleable-radio-button.jsx +133 -0
  490. package/src/widgets/radio/util.js +32 -0
  491. package/src/widgets/radio/util_test.js +19 -0
  492. package/src/widgets/radio/widget.jsx +470 -0
  493. package/src/widgets/radio.jsx +156 -0
  494. package/src/widgets/reaction-diagram.jsx +137 -0
  495. package/src/widgets/sequence.jsx +140 -0
  496. package/src/widgets/simulator.jsx +808 -0
  497. package/src/widgets/sorter.jsx +146 -0
  498. package/src/widgets/table.jsx +394 -0
  499. package/src/widgets/transformer.jsx +2876 -0
  500. package/src/widgets/unit.jsx +372 -0
  501. package/src/widgets/video-transcript-link.jsx +84 -0
  502. package/src/widgets/video-transcript-link_test.js +211 -0
  503. package/src/widgets/video.jsx +126 -0
  504. package/src/widgets.js +431 -0
  505. package/src/zoom.js +539 -0
  506. package/README.md +0 -3
  507. package/src/__tests__/index.test.js +0 -14
@@ -0,0 +1,1597 @@
1
+ // @flow
2
+ // TODO(FEI-4010): Remove `Perseus` prefix for all types here
3
+ // TODO(FEI-4011): Use types generated by https://github.com/jaredly/generate-perseus-flowtypes
4
+
5
+ import type {Coord} from "./interactive2/types.js";
6
+
7
+ // sync-start:perseus-data-format 445282759 services/content-editing/perseus/perseus_data.go
8
+
9
+ // sync-start:perseus-data-format-perseus-item 1142141354 services/content-editing/perseus/perseus_data.go
10
+ export type PerseusItem = {|
11
+ // The details of the question being asked to the user.
12
+ question: PerseusRenderer,
13
+ // A collection of hints to be offered to the user that support answering the question.
14
+ hints: $ReadOnlyArray<PerseusRenderer>,
15
+ // Details about the tools the user might need to answer the question
16
+ answerArea: ?PerseusAnswerArea,
17
+ // Multi-item should only show up in Test Prep content and it is a variant of a PerseusItem
18
+ _multi: *,
19
+ // The version of the item. Not used by Perseus
20
+ itemDataVersion: Version,
21
+ // Deprecated field
22
+ answer: *,
23
+ |};
24
+ // sync-end:perseus-data-format-perseus-item
25
+
26
+ // sync-start:perseus-data-format-perseus-article 702711982 services/content-editing/perseus/perseus_data.go
27
+ export type PerseusArticle = $ReadOnlyArray<PerseusRenderer>;
28
+ // sync-end:perseus-data-format-perseus-article
29
+
30
+ // sync-start:perseus-data-format-perseus-version 402776191 services/content-editing/perseus/perseus_data.go
31
+ export type Version = {|
32
+ // The major part of the version
33
+ major: number,
34
+ // The minor part of the version
35
+ minor: number,
36
+ |};
37
+ // sync-end:perseus-data-format-perseus-version
38
+
39
+ // sync-start:perseus-data-format-perseus-renderer 43032456 services/content-editing/perseus/perseus_data.go
40
+ export type PerseusRenderer = {|
41
+ // Translatable Markdown content to be rendered. May include references to
42
+ // widgets (as [[☃ widgetName]]) or images (as ![image text](imageUrl)).
43
+ // For each image found in this content, there can be an entry in the
44
+ // `images` dict (below) with the key being the image's url which defines
45
+ // additional attributes for the image.
46
+ content: string,
47
+ // A dictionary of {[widgetName]: Widget} to be referenced from the content field
48
+ widgets: {|[string]: PerseusWidget|},
49
+ // Used only for PerseusItem.hints. If true, it replaces the previous hint in the list with the current one. This allows for hints that build upon each other.
50
+ replace?: boolean,
51
+ // Used in the PerseusGradedGroup widget. A list of "tags" that are keys that represent other content in the system. Not rendered to the user.
52
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
53
+ metadata?: $ReadOnlyArray<string>,
54
+ // A dictionary of {[imageUrl]: PerseusImageDetail}.
55
+ images: {|[string]: PerseusImageDetail|},
56
+ |};
57
+ // sync-end:perseus-data-format-perseus-renderer
58
+
59
+ // sync-start:perseus-data-format-image-size 1357702236 services/content-editing/perseus/translation/types.go
60
+ export type PerseusImageDetail = {|
61
+ // The width of the image
62
+ width: number,
63
+ // the height of the image
64
+ height: number,
65
+ |};
66
+ // sync-end:perseus-data-format-image-size
67
+
68
+ // sync-start:perseus-data-format-answer-area 2042787453 services/content-editing/perseus/perseus_data.go
69
+ export type PerseusAnswerArea = {|
70
+ // The user might benefit from using a statistics Z Table like https://www.ztable.net/
71
+ zTable: boolean,
72
+ // The user might benefit from using a statistics Chi Squared Table like https://people.richland.edu/james/lecture/m170/tbl-chi.html
73
+ chi2Table: boolean,
74
+ // The user might benefit from using a statistics T Table like https://www.statisticshowto.com/tables/t-distribution-table/
75
+ tTable: boolean,
76
+ // The user might benefit from using a Scientific Calculator. Provided on Khan Academy when true
77
+ calculator: boolean,
78
+ // The user might benefit from using a Periodic Table of Elements. Provided on Khan Academy when true
79
+ periodicTable: boolean,
80
+ |};
81
+ // sync-end:perseus-data-format-answer-area
82
+
83
+ // sync-start:perseus-data-format-perseus-header 444775300 services/content-editing/perseus/perseus_data.go
84
+ type Widget<Type: string, Options> = {|
85
+ // The "type" of widget which will define what the Options field looks like
86
+ type: Type,
87
+ // Whether this widget is displayed with the values and is immutable. For display only
88
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
89
+ static?: boolean,
90
+ // Whether a widget is scored. Usually true except for IFrame widgets (deprecated) and Transformer widgets
91
+ // Default: true
92
+ graded?: boolean,
93
+ // The HTML alignment of the widget. "default" or "block"
94
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
95
+ alignment?: string,
96
+ // Options specific to the type field of the widget. See Perseus*WidgetOptions for more details
97
+ options: ?Options,
98
+ // Only used by interactive child widgets (line, point, etc) to identify the components
99
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
100
+ key?: number,
101
+ // The version of the widget data spec. Used to differentiate between newer and older content data.
102
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
103
+ version?: Version,
104
+ |};
105
+ // sync-end:perseus-data-format-perseus-header
106
+
107
+ // prettier-ignore
108
+ export type CategorizerWidget = Widget<"categorizer", PerseusCategorizerWidgetOptions>;
109
+ // prettier-ignore
110
+ export type CSProgramWidget = Widget<"cs-program", PerseusCSProgramWidgetOptions>;
111
+ // prettier-ignore
112
+ export type DefinitionWidget = Widget<"definition", PerseusDefinitionWidgetOptions>;
113
+ // prettier-ignore
114
+ export type DropdownWidget = Widget<"dropdown", PerseusDropdownWidgetOptions>;
115
+ // prettier-ignore
116
+ export type ExplanationWidget = Widget<"explanation", PerseusExplanationWidgetOptions>;
117
+ // prettier-ignore
118
+ export type ExpressionWidget = Widget<"expression", PerseusExpressionWidgetOptions>;
119
+ // prettier-ignore
120
+ export type GradedGroupSetWidget = Widget<"graded-group-set", PerseusGradedGroupSetWidgetOptions>;
121
+ // prettier-ignore
122
+ export type GradedGroupWidget = Widget<"graded-group", PerseusGradedGroupWidgetOptions>;
123
+ // prettier-ignore
124
+ export type GrapherWidget = Widget<"grapher", PerseusGrapherWidgetOptions>;
125
+ // prettier-ignore
126
+ export type GroupWidget = Widget<"group", PerseusGroupWidgetOptions>;
127
+ // prettier-ignore
128
+ export type IFrameWidget = Widget<"iframe", PerseusIFrameWidgetOptions>;
129
+ // prettier-ignore
130
+ export type ImageWidget = Widget<"image", PerseusImageWidgetOptions>;
131
+ // prettier-ignore
132
+ export type InteractionWidget = Widget<"interaction", PerseusInteractionWidgetOptions>;
133
+ // prettier-ignore
134
+ export type InteractiveGraphWidget = Widget<"interactive-graph", PerseusInteractiveGraphWidgetOptions>;
135
+ // prettier-ignore
136
+ export type LabelImageWidget = Widget<"label-image", PerseusLabelImageWidgetOptions>;
137
+ // prettier-ignore
138
+ export type MatcherWidget = Widget<"matcher", PerseusMatcherWidgetOptions>;
139
+ // prettier-ignore
140
+ export type MatrixWidget = Widget<"matrix", PerseusMatrixWidgetOptions>;
141
+ // prettier-ignore
142
+ export type MeasurerWidget = Widget<"measurer", PerseusMeasurerWidgetOptions>;
143
+ // prettier-ignore
144
+ export type NumberLineWidget = Widget<"number-line", PerseusNumberLineWidgetOptions>;
145
+ // prettier-ignore
146
+ export type NumericInputWidget = Widget<"numeric-input", PerseusNumericInputWidgetOptions>;
147
+ // prettier-ignore
148
+ export type OrdererWidget = Widget<"orderer", PerseusOrdererWidgetOptions>;
149
+ // prettier-ignore
150
+ export type PassageRefWidget = Widget<"passage-ref", PerseusPassageRefWidgetOptions>;
151
+ // prettier-ignore
152
+ export type PassageWidget = Widget<"passage", PerseusPassageWidgetOptions>;
153
+ // prettier-ignore
154
+ export type PlotterWidget = Widget<"plotter", PerseusPlotterWidgetOptions>;
155
+ // prettier-ignore
156
+ export type RadioWidget = Widget<"radio", PerseusRadioWidgetOptions>;
157
+ // prettier-ignore
158
+ export type SequenceWidget = Widget<"sequence", PerseusSequenceWidgetOptions>;
159
+ // prettier-ignore
160
+ export type SimulatorWidget = Widget<"simulator", PerseusSimulatorWidgetOptions>;
161
+ // prettier-ignore
162
+ export type SorterWidget = Widget<"sorter", PerseusSorterWidgetOptions>;
163
+ // prettier-ignore
164
+ export type TableWidget = Widget<"table", PerseusTableWidgetOptions>;
165
+ // prettier-ignore
166
+ export type TransformerWidget = Widget<"transformer", PerseusTransformerWidgetOptions>;
167
+
168
+ // prettier-ignore
169
+ export type ExampleGraphieWidget = Widget<"example-graphie-widget", PerseusExampleGraphieWidgetOptions>;
170
+ // prettier-ignore
171
+ export type ExampleWidget = Widget<"example-widget", PerseusExampleWidgetOptions>;
172
+ // prettier-ignore
173
+ export type InputNumberWidget = Widget<"input-number", PerseusInputNumberWidgetOptions>;
174
+ // prettier-ignore
175
+ export type LightsPuzzleWidget = Widget<"lights-puzzle", PerseusLightsPuzzleWidgetOptions>;
176
+ // prettier-ignore
177
+ export type MoleculeRendererWidget = Widget<"molecule-renderer", PerseusMoleculeRendererWidgetOptions>;
178
+ // prettier-ignore
179
+ export type RefTargetWidget = Widget<"passage-ref-target", PerseusPassageRefTargetWidgetOptions>;
180
+ // prettier-ignore
181
+ export type ReactionDiagramWidget = Widget<"reaction-diagtram", PerseusReactionDiagramWidgetOptions>;
182
+ // prettier-ignore
183
+ export type SimpleMarkdownTesterWidget = Widget<"simple-markdown-tester", PerseusSimpleMarkdownTesterWidgetOptions>;
184
+ // prettier-ignore
185
+ export type UnitInputWidget = Widget<"unit-input", PerseusUnitInputWidgetOptions>;
186
+ // prettier-ignore
187
+ export type VideoWidget = Widget<"video", PerseusVideoWidgetOptions>;
188
+
189
+ export type PerseusWidget =
190
+ | CategorizerWidget
191
+ | CSProgramWidget
192
+ | DefinitionWidget
193
+ | DropdownWidget
194
+ | ExampleGraphieWidget
195
+ | ExampleWidget
196
+ | ExplanationWidget
197
+ | ExpressionWidget
198
+ | GradedGroupSetWidget
199
+ | GradedGroupWidget
200
+ | GrapherWidget
201
+ | GroupWidget
202
+ | IFrameWidget
203
+ | ImageWidget
204
+ | InputNumberWidget
205
+ | InteractionWidget
206
+ | InteractiveGraphWidget
207
+ | LabelImageWidget
208
+ | LightsPuzzleWidget
209
+ | MatcherWidget
210
+ | MatrixWidget
211
+ | MeasurerWidget
212
+ | MoleculeRendererWidget
213
+ | NumberLineWidget
214
+ | NumericInputWidget
215
+ | OrdererWidget
216
+ | PassageRefWidget
217
+ | PassageWidget
218
+ | PlotterWidget
219
+ | RadioWidget
220
+ | ReactionDiagramWidget
221
+ | RefTargetWidget
222
+ | SequenceWidget
223
+ | SimpleMarkdownTesterWidget
224
+ | SimulatorWidget
225
+ | SorterWidget
226
+ | TableWidget
227
+ | TransformerWidget
228
+ | UnitInputWidget
229
+ | VideoWidget;
230
+
231
+ // sync-start:perseus-data-format-image-background 705138305 services/content-editing/perseus/perseus_data.go
232
+ export type PerseusImageBackground = {|
233
+ // The URL of the image
234
+ url: ?string,
235
+ // The width of the image
236
+ width: number,
237
+ // The height of the image
238
+ height: number,
239
+ // The top offset of the image
240
+ // NOTE: perseus_data.go says this is required, but nullable, even though
241
+ // it isn't necessary at all.
242
+ top?: number,
243
+ // The left offset of the image
244
+ // NOTE: perseus_data.go says this is required, but nullable, even though
245
+ // it isn't necessary at all.
246
+ left?: number,
247
+ // The scale of the image
248
+ // NOTE: perseus_data.go says this is required, but nullable, even though
249
+ // it isn't necessary at all.
250
+ // Yikes, production data as this as both a number (1) and string ("1")
251
+ scale?: number | string,
252
+ // The bottom offset of the image
253
+ // NOTE: perseus_data.go says this is required, but nullable, even though
254
+ // it isn't necessary at all.
255
+ bottom?: number,
256
+ |};
257
+ // sync-end:perseus-data-format-image-background
258
+
259
+ // sync-start:perseus-data-format-categorizer 196107932 services/content-editing/perseus/perseus_data.go
260
+ export type PerseusCategorizerWidgetOptions = {|
261
+ // Translatable text; a list of items to categorize. e.g. ["banana", "yellow", "apple", "purple", "shirt"]
262
+ items: $ReadOnlyArray<string>,
263
+ // Translatable text; a list of categories. e.g. ["fruits", "colors", "clothing"]
264
+ categories: $ReadOnlyArray<string>,
265
+ // Whether the items should be randemized
266
+ randomizeItems: boolean,
267
+ // Whether this widget is displayed with the results and immutable
268
+ static: boolean,
269
+ // The correct answers where index relates to the items and value relates to the category. e.g. [0, 1, 0, 1, 2]
270
+ values: $ReadOnlyArray<number>,
271
+ // Whether we should highlight i18n linter errors found on this widget
272
+ highlightLint?: boolean,
273
+ // Internal editor configuration. Can be ignored by consumers.
274
+ linterContext?: PerseusLinterContext,
275
+ |};
276
+ // sync-end:perseus-data-format-categorizer
277
+
278
+ export type PerseusLinterContext = {|
279
+ contentType: string,
280
+ paths: $ReadOnlyArray<string>,
281
+ stack: $ReadOnlyArray<string>,
282
+ |};
283
+
284
+ // sync-start:perseus-data-format-definition 1136634440 services/content-editing/perseus/perseus_data.go
285
+ export type PerseusDefinitionWidgetOptions = {|
286
+ // Translatable text; the word to define. e.g. "vertex"
287
+ togglePrompt: string,
288
+ // Translatable text; the definition of the word. e.g. "where 2 rays connect"
289
+ definition: string,
290
+ // Always false. Not used for this widget
291
+ static: boolean,
292
+ |};
293
+ // sync-end:perseus-data-format-definition
294
+
295
+ // sync-start:perseus-data-format-dropdown 680573227 services/content-editing/perseus/perseus_data.go
296
+ export type PerseusDropdownWidgetOptions = {|
297
+ // A list of choices for the dropdown
298
+ choices: $ReadOnlyArray<PerseusDropdownChoice>,
299
+ // Translatable Text; placeholder text for a dropdown. e.g. "Please select a fruit"
300
+ placeholder: string,
301
+ // Always false. Not used for this widget
302
+ static: boolean,
303
+ |};
304
+ // sync-end:perseus-data-format-dropdown
305
+
306
+ // sync-start:perseus-data-format-dropdown-choice 1551360173 services/content-editing/perseus/perseus_data.go
307
+ export type PerseusDropdownChoice = {|
308
+ // Translatable text; The text for the option. e.g. "Banana" or "Orange"
309
+ content: string,
310
+ // Whether this is the correct option or not
311
+ correct: boolean,
312
+ |};
313
+ // sync-end:perseus-data-format-dropdown-choice
314
+
315
+ // sync-start:perseus-data-format-explanation 1697542234 services/content-editing/perseus/perseus_data.go
316
+ export type PerseusExplanationWidgetOptions = {|
317
+ // Translatable Text; The clickable text to expand an explanation. e.g. "What is an apple?"
318
+ showPrompt: string,
319
+ // Translatable Text; The cliclable text to hide an explanation. e.g. "Thanks. I got it!"
320
+ hidePrompt: string,
321
+ // Translatable Markdown; The explanation that is shown when showPrompt is clicked. e.g. "An apple is a tasty fruit."
322
+ explanation: string,
323
+ // explanation fields can embed widgets. When they do, the details of the widgets are here.
324
+ widgets: {|[string]: PerseusWidget|},
325
+ // Always false. Not used for this widget
326
+ static: boolean,
327
+ |};
328
+ // sync-end:perseus-data-format-explanation
329
+
330
+ // sync-start:perseus-data-format-expression 786922927 services/content-editing/perseus/perseus_data.go
331
+ export type PerseusExpressionWidgetOptions = {|
332
+ // The expression forms the answer may come in
333
+ answerForms: $ReadOnlyArray<PerseusExpressionAnswerForm>,
334
+ // Different buttons sets that can show in the expression. Options are "basic", "basic+div", "trig", "prealgebra", "logarithms", "basic relations", "advanced relations"
335
+ buttonSets: $ReadOnlyArray<string>,
336
+ // Variables that can be used as functions. Default: ["f", "g", "h"]
337
+ functions: $ReadOnlyArray<string>,
338
+ // Use x for rendering multiplication instead of a center dot.
339
+ times: boolean,
340
+ // Controls when buttons for special characters are visible when using a
341
+ // desktop browser. Defaults to "focused".
342
+ // NOTE: This isn't listed in perseus-format.js or perseus_data.go, but
343
+ // appears in item data in the datastore.
344
+ buttonsVisible?: "always" | "never" | "focused",
345
+ |};
346
+ // sync-end:perseus-data-format-expression
347
+
348
+ // sync-start:perseus-data-format-expression-answer-form 786922927 services/content-editing/perseus/perseus_data.go
349
+ export type PerseusExpressionAnswerForm = {|
350
+ // The Katex form of the expression. e.g. "x\\cdot3=y"
351
+ value: string,
352
+ // The Answer expression must have the same form
353
+ form: boolean,
354
+ // The answer expression must be fully expanded and simplified
355
+ simplify: boolean,
356
+ // Whether the form is considered "correct", "wrong", or "ungraded"
357
+ considered: string,
358
+ // A key to identify the answer form in a list
359
+ // NOTE: perseus-format.js says this is required even though it isn't necessary.
360
+ key?: string,
361
+ |};
362
+ // sync-end:perseus-data-format-expression-answer-form
363
+
364
+ // sync-start:perseus-data-format-graded-group 1776015670 services/content-editing/perseus/perseus_data.go
365
+ export type PerseusGradedGroupWidgetOptions = {|
366
+ // Translatable Text; A title to be displayed for the group.
367
+ title: string,
368
+ // Not used in Perseus (but is set in (en, pt) production data)
369
+ hasHint?: ?boolean,
370
+ // A section to define hints for the group.
371
+ hint?: ?PerseusRenderer,
372
+ // Translatable Markdown. May include widgets and images embedded.
373
+ content: string,
374
+ // See PerseusRenderer.widgets
375
+ widgets: {|[string]: PerseusWidget|},
376
+ // Not used in Perseus
377
+ widgetEnabled?: ?boolean,
378
+ // Not used in Perseus
379
+ immutableWidgets?: ?boolean,
380
+ // See PerseusRenderer.images
381
+ images: {|[string]: PerseusImageDetail|},
382
+ |};
383
+ // sync-end:perseus-data-format-graded-group
384
+
385
+ // sync-start:perseus-data-format-graded-group-set 692073834 services/content-editing/perseus/perseus_data.go
386
+ export type PerseusGradedGroupSetWidgetOptions = {|
387
+ // A list of Widget Groups
388
+ gradedGroups: $ReadOnlyArray<PerseusGradedGroupWidgetOptions>,
389
+ |};
390
+ // sync-end:perseus-data-format-graded-group-set
391
+
392
+ // sync-start:perseus-data-format-grapher 666534562 services/content-editing/perseus/perseus_data.go
393
+ export type PerseusGrapherWidgetOptions = {|
394
+ availableTypes: $ReadOnlyArray<
395
+ | "absolute_value"
396
+ | "exponential"
397
+ | "linear"
398
+ | "logarithm"
399
+ | "quadratic"
400
+ | "sinusoid"
401
+ | "tangent",
402
+ >,
403
+ correct:
404
+ | {|
405
+ type: "absolute_value",
406
+ coords: [
407
+ // The vertex
408
+ Coord,
409
+ // A point along one line of the absolute value "V" lines
410
+ Coord,
411
+ ],
412
+ |}
413
+ | {|
414
+ type: "exponential",
415
+ // Two points along the asymptote line. Usually (always?) a
416
+ // horizontal or vertical line.
417
+ asymptote: [Coord, Coord],
418
+ // Two points along the exponential curve. One end of the curve
419
+ // trends towards the asymptote.
420
+ coords: [Coord, Coord],
421
+ |}
422
+ | {|
423
+ type: "linear",
424
+ // Two points along the straight line
425
+ coords: [Coord, Coord],
426
+ |}
427
+ | {|
428
+ type: "logarithm",
429
+ // Two points along the asymptote line.
430
+ asymptote: [Coord, Coord],
431
+ // Two points along the logarithmic curve. One end of the curve
432
+ // trends towards the asymptote.
433
+ coords: [Coord, Coord],
434
+ |}
435
+ | {|
436
+ type: "quadratic",
437
+ coords: [
438
+ // The vertex of the parabola
439
+ Coord,
440
+ // A point along the parabola
441
+ Coord,
442
+ ],
443
+ |}
444
+ | {|
445
+ type: "sinusoid",
446
+ // Two points on the same slope in the sinusoid wave line.
447
+ coords: [Coord, Coord],
448
+ |}
449
+ | {|
450
+ type: "tangent",
451
+ // Two points on the same slope in the tangent wave line.
452
+ coords: [Coord, Coord],
453
+ |},
454
+ // TODO(jeremy): Unify with PerseusTransformerWidgetOptions's .graph
455
+ graph: {|
456
+ backgroundImage: {|
457
+ bottom?: number,
458
+ height?: number,
459
+ left?: number,
460
+ scale?: number,
461
+ url?: ?string,
462
+ width?: number,
463
+ |},
464
+ box?: [number, number],
465
+ editableSettings?: $ReadOnlyArray<
466
+ "graph" | "snap" | "image" | "measure",
467
+ >,
468
+ gridStep?: [number, number],
469
+ labels: [string, string],
470
+ markings: "graph" | "none" | "grid",
471
+ range: [[number, number], [number, number]],
472
+ rulerLabel: "",
473
+ rulerTicks: number,
474
+ showProtractor?: boolean,
475
+ showRuler?: boolean,
476
+ showTooltips?: boolean,
477
+ snapStep?: [number, number],
478
+ step: [number, number],
479
+ valid?: boolean | string,
480
+ |},
481
+ |};
482
+ // sync-end:perseus-data-format-grapher
483
+
484
+ // sync-start:perseus-data-format-group 683548434 services/content-editing/perseus/perseus_data.go
485
+ export type PerseusGroupWidgetOptions = {|
486
+ ...PerseusRenderer,
487
+ |};
488
+ // sync-end:perseus-data-format-group
489
+
490
+ // sync-start:perseus-data-format-image 1902443006 services/content-editing/perseus/perseus_data.go
491
+ export type PerseusImageWidgetOptions = {|
492
+ // Translatable Markdown; Text to be shown for the title of the image
493
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
494
+ title?: string,
495
+ // Translatable Markdown; Text to be shown in the caption section of an image
496
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
497
+ caption?: string,
498
+ // Translatable Text; The alt text to be shown in the img.alt attribute
499
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
500
+ alt?: string,
501
+ // The image details for the image to be displayed
502
+ backgroundImage: PerseusImageBackground,
503
+ // Always false. Not used for this widget
504
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
505
+ static?: boolean,
506
+ // A list of labels to display on the image
507
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
508
+ labels?: $ReadOnlyArray<PerseusImageLabel>,
509
+ // The range on the image render for labels
510
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
511
+ range?: $ReadOnlyArray<$ReadOnlyArray<number>>,
512
+ // The box on the image render for labels. The same as backgroundImage.width and backgroundImage.height
513
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
514
+ box?: $ReadOnlyArray<number>,
515
+ |};
516
+ // sync-end:perseus-data-format-image
517
+
518
+ // sync-start:perseus-data-format-image-label 1815359548 services/content-editing/perseus/perseus_data.go
519
+ export type PerseusImageLabel = {|
520
+ // Translatable Text; The content of the label to display
521
+ content: string,
522
+ // The visual alignment of the label. default: "center"
523
+ alignment: string,
524
+ // The point on the image to display the label
525
+ coordinates: $ReadOnlyArray<number>,
526
+ |};
527
+ // sync-end:perseus-data-format-image-label
528
+
529
+ // sync-start:perseus-data-format-interactive-graph 1553046458 services/content-editing/perseus/perseus_data.go
530
+ export type PerseusInteractiveGraphWidgetOptions = {|
531
+ // The tick steps. default [1, 1]
532
+ // NOTE(kevinb): perseus_data.go defines this as Array<number>
533
+ step: [number, number],
534
+ // The steps in the grid. default [1, 1]
535
+ // NOTE(kevinb): perseus_data.go defines this as Array<number>
536
+ gridStep: [number, number],
537
+ // The snap steps. default [0.5, 0.5]
538
+ // NOTE(kevinb): perseus_data.go defines this as Array<number>
539
+ snapStep: [number, number],
540
+ // An optional image to use in the background
541
+ backgroundImage?: PerseusImageBackground,
542
+ // What to show on the graph. "graph", "grid", or "none"
543
+ markings: string,
544
+ // How to label the X and Y axis. default: ["x", "y"]
545
+ labels: $ReadOnlyArray<string>,
546
+ // Whether to show the Protractor tool overlayed on top of the graph
547
+ showProtractor: boolean,
548
+ // Whether to show the Ruler tool overlayed on top of the graph
549
+ showRuler: boolean,
550
+ // Whether to show tooltips on the graph
551
+ showTooltips?: boolean,
552
+ // The unit to show on the ruler. e.g. "mm", "cm", "m", "km", "in", "ft", "yd", "mi"
553
+ rulerLabel: string,
554
+ // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16
555
+ rulerTicks: number,
556
+ // The X and Y coordinate ranges for the view of the graph. default: [[-10, 10], [-10, 10]]
557
+ // NOTE(kevinb): perseus_data.go defines this as Array<Array<number>>
558
+ // TODO(kevinb): Add a transform function to interactive-graph.jsx to
559
+ // rename `range` to `ranges` so that things are less confusing.
560
+ range: [[number, number], [number, number]],
561
+ // The type of graph
562
+ graph: PerseusGraphType,
563
+ // The correct kind of graph, if being used to select function type
564
+ correct: PerseusGraphType,
565
+ |};
566
+ // sync-end:perseus-data-format-interactive-graph
567
+
568
+ // sync-start:perseus-data-format-graph-type 1191842797 services/content-editing/perseus/perseus_data.go
569
+
570
+ export type PerseusGraphType =
571
+ | PerseusGraphTypeAngle
572
+ | PerseusGraphTypeCircle
573
+ | PerseusGraphTypeLinear
574
+ | PerseusGraphTypeLinearSystem
575
+ | PerseusGraphTypePoint
576
+ | PerseusGraphTypePolygon
577
+ | PerseusGraphTypeQuadratic
578
+ | PerseusGraphTypeRay
579
+ | PerseusGraphTypeSegment
580
+ | PerseusGraphTypeSinusoid;
581
+
582
+ export type PerseusGraphTypeCommon = {|
583
+ // NOTE(jeremy): This is referenced in the component. Verify if there's any
584
+ // production data that still has this.
585
+ coord?: Coord, // Legacy!
586
+ |};
587
+
588
+ export type PerseusGraphTypeAngle = {|
589
+ type: "angle",
590
+ // Whether to show the angle measurements. default: false
591
+ showAngles?: boolean,
592
+ // Allow Reflex Angles if an "angle" type. default: true
593
+ allowReflexAngles?: boolean,
594
+ // The angle offset in degrees if an "angle" type. default: 0
595
+ angleOffsetDeg?: number,
596
+ // Snap to degree increments if an "angle" type. default: 1
597
+ snapDegrees?: number,
598
+ // How to match the answer. If missing, defaults to exact matching.
599
+ match?: "congruent",
600
+
601
+ coords?: $ReadOnlyArray<Coord>,
602
+ |};
603
+
604
+ export type PerseusGraphTypeCircle = {|
605
+ type: "circle",
606
+ center?: Coord,
607
+ radius?: number,
608
+ ...PerseusGraphTypeCommon,
609
+ |};
610
+
611
+ export type PerseusGraphTypeLinear = {|
612
+ type: "linear",
613
+ coords?: $ReadOnlyArray<Coord>,
614
+ ...PerseusGraphTypeCommon,
615
+ |};
616
+
617
+ export type PerseusGraphTypeLinearSystem = {|
618
+ type: "linear-system",
619
+ coords?: $ReadOnlyArray<$ReadOnlyArray<Coord>>,
620
+ ...PerseusGraphTypeCommon,
621
+ |};
622
+
623
+ export type PerseusGraphTypePoint = {|
624
+ type: "point",
625
+ // The number of points if a "point" type. default: 1. "unlimited" if no limit
626
+ numPoints?: number | "unlimited",
627
+ coords?: $ReadOnlyArray<Coord>,
628
+ ...PerseusGraphTypeCommon,
629
+ |};
630
+
631
+ export type PerseusGraphTypePolygon = {|
632
+ type: "polygon",
633
+ // The number of sides. default: 3. "unlimited" if no limit
634
+ numSides?: number | "unlimited",
635
+ // Whether to the angle measurements. default: false
636
+ showAngles?: boolean,
637
+ // Whether to show side measurements. default: false
638
+ showSides?: boolean,
639
+ // How to snap points. e.g. "grid", "angles", or "sides"
640
+ snapTo?: string,
641
+ // How to match the answer. If missing, defaults to exact matching.
642
+ match?: "similar" | "congruent" | "approx",
643
+
644
+ coords?: $ReadOnlyArray<Coord>,
645
+ ...PerseusGraphTypeCommon,
646
+ |};
647
+
648
+ export type PerseusGraphTypeQuadratic = {|
649
+ type: "quadratic",
650
+ coords?: $ReadOnlyArray<Coord>,
651
+ ...PerseusGraphTypeCommon,
652
+ |};
653
+
654
+ export type PerseusGraphTypeSegment = {|
655
+ type: "segment",
656
+ // The number of segments if a "segment" type. default: 1. Max: 6
657
+ numSegments?: number,
658
+ // A list of segments (each segment is a list of coordinates).
659
+ // Length should match the `numSegments` value.
660
+ coords?: $ReadOnlyArray<$ReadOnlyArray<Coord>>,
661
+ ...PerseusGraphTypeCommon,
662
+ |};
663
+
664
+ export type PerseusGraphTypeSinusoid = {|
665
+ type: "sinusoid",
666
+ coords?: $ReadOnlyArray<Coord>,
667
+ ...PerseusGraphTypeCommon,
668
+ |};
669
+
670
+ export type PerseusGraphTypeRay = {|
671
+ type: "ray",
672
+ coords?: $ReadOnlyArray<Coord>,
673
+ ...PerseusGraphTypeCommon,
674
+ |};
675
+
676
+ // sync-end:perseus-data-format-graph-type
677
+
678
+ // sync-start:perseus-data-format-label-image 2032676206 services/content-editing/perseus/perseus_data.go
679
+ export type PerseusLabelImageWidgetOptions = {|
680
+ // Translatable Text; Katex representation of choices
681
+ choices: $ReadOnlyArray<string>,
682
+ // The URL of the image
683
+ imageUrl: string,
684
+ // Translatable Text; To show up in the img.alt attribute
685
+ imageAlt: string,
686
+ // The height of the image
687
+ imageHeight: number,
688
+ // The width of the image
689
+ imageWidth: number,
690
+ // A list of markers to display on the image
691
+ markers: $ReadOnlyArray<PerseusLabelImageMarker>,
692
+ // Do not display answer choices in instructions
693
+ hideChoicesFromInstructions: boolean,
694
+ // Allow multiple answers per marker
695
+ multipleAnswers: boolean,
696
+ // Always false. Not used for this widget
697
+ static: boolean,
698
+ |};
699
+ // sync-end:perseus-data-format-label-image
700
+
701
+ // sync-start:perseus-data-format-label-image-marker 1027558334 services/content-editing/perseus/perseus_data.go
702
+ export type PerseusLabelImageMarker = {|
703
+ // A list of correct answers for this marker. Often only one but can have multiple
704
+ answers: $ReadOnlyArray<string>,
705
+ // Translatable Text; The text to show for the marker. Not displayed directly to the user
706
+ label: string,
707
+ // X Coordiate location of the marker on the image
708
+ x: number,
709
+ // Y Coordinate location of the marker on the image
710
+ y: number,
711
+ |};
712
+ // sync-end:perseus-data-format-label-image-marker
713
+
714
+ // sync-start:perseus-data-format-matcher 601321477 services/content-editing/perseus/perseus_data.go
715
+ export type PerseusMatcherWidgetOptions = {|
716
+ // Translatable Text; Labels to adorn the headings for the columns. Only 2 values [left, right]. e.g. ["Concepts", "Things"]
717
+ labels: $ReadOnlyArray<string>,
718
+ // Translatable Text; Static concepts to show in the left column. e.g. ["Fruit", "Color", "Clothes"]
719
+ left: $ReadOnlyArray<string>,
720
+ // Translatable Markup; Values that represent the concepts to be correlated with the concepts. e.g. ["Red", "Shirt", "Banana"]
721
+ right: $ReadOnlyArray<string>,
722
+ // Order of the matched pairs matters. With this option enabled, only the order provided above will be treated as correct. This is useful when ordering is significant, such as in the context of a proof. If disabled, pairwise matching is sufficient. To make this clear, the left column becomes fixed in the provided order and only the cards in the right column can be moved.
723
+ orderMatters: boolean,
724
+ // Adds padding to the rows. Padding is good for text, but not needed for images.
725
+ padding: boolean,
726
+ |};
727
+ // sync-end:perseus-data-format-matcher
728
+
729
+ // sync-start:perseus-data-format-matrix 1000243376 services/content-editing/perseus/perseus_data.go
730
+ export type PerseusMatrixWidgetOptions = {|
731
+ // Translatable Text; Shown before the matrix
732
+ prefix: string,
733
+ // Translatable Text; Shown after the matrix
734
+ suffix: string,
735
+ // A data matrix representing the "correct" answers to be entered into the matrix
736
+ answers: $ReadOnlyArray<$ReadOnlyArray<number>>,
737
+ // The coordinate location of the cursor position at start. default: [0, 0]
738
+ cursorPosition: $ReadOnlyArray<number>,
739
+ // The coordinate size of the matrix. Only supports 2-dimensional matrix. default: [3, 3]
740
+ matrixBoardSize: $ReadOnlyArray<number>,
741
+ // Whether this is meant to statically display the answers (true) or be used as an input field, graded against the answers
742
+ static: boolean,
743
+ |};
744
+ // sync-end:perseus-data-format-matrix
745
+
746
+ // sync-start:perseus-data-format-measurer 150148873 services/content-editing/perseus/perseus_data.go
747
+ export type PerseusMeasurerWidgetOptions = {|
748
+ // The image that the user is meant to measure
749
+ image: PerseusImageBackground,
750
+ // Whether to show the Protractor tool overlayed on top of the image
751
+ showProtractor: boolean,
752
+ // Whether to show the Ruler tool overlayed on top of the image
753
+ showRuler: boolean,
754
+ // The unit to show on the ruler. e.g. "mm", "cm", "m", "km", "in", "ft", "yd", "mi"
755
+ rulerLabel: string,
756
+ // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16
757
+ rulerTicks: number,
758
+ // The number of image pixels per unit (label)
759
+ rulerPixels: number,
760
+ // The number of units to display on the ruler
761
+ rulerLength: number,
762
+ // Containing area [width, height]
763
+ box: $ReadOnlyArray<number>,
764
+ // Always false. Not used for this widget
765
+ static: boolean,
766
+ |};
767
+ // sync-end:perseus-data-format-measurer
768
+
769
+ // sync-start:perseus-data-format-numeric-input 1220587654 services/content-editing/perseus/perseus_data.go
770
+ export type PerseusNumericInputWidgetOptions = {|
771
+ // A list of all the possible correct and incorrect answers
772
+ answers: $ReadOnlyArray<PerseusNumericInputAnswer>,
773
+ // Translatable Text; Text to describe this input. This will be shown to users using screenreaders.
774
+ labelText: string,
775
+ // Use size "Normal" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them. Options: "normal" or "small"
776
+ size: string,
777
+ // A coefficient style number allows the student to use - for -1 and an empty string to mean 1.
778
+ coefficient: boolean,
779
+ // Whether we're asking for all correct solutions or only one
780
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
781
+ multipleNumberInput?: boolean,
782
+ // Whether to right-align the text or not
783
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
784
+ rightAlign?: boolean,
785
+ // Always false. Not used for this widget
786
+ static: boolean,
787
+
788
+ // Used by examples, maybe not used and should be removed in the future
789
+ // see TODO in numeric-input
790
+ answerForms?: $ReadOnlyArray<{|
791
+ simplify: ?("required" | "correct" | "enforced"),
792
+ name: "integer" | "decimal" | "proper" | "improper" | "mixed" | "pi",
793
+ |}>,
794
+ |};
795
+ // sync-end:perseus-data-format-numeric-input
796
+
797
+ // sync-start:perseus-data-format-numeric-input-answer 2103478468 services/content-editing/perseus/perseus_data.go
798
+ export type PerseusNumericInputAnswer = {|
799
+ // Translatable Display; A description for why this answer is correct, wrong, or ungraded
800
+ message: string,
801
+ // The expected answer
802
+ value: ?number,
803
+ // Whether this answer is "correct", "wrong", or "ungraded"
804
+ status: string,
805
+ // The forms available for this answer. Options: "integer, ""decimal", "proper", "improper", "mixed", or "pi"
806
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
807
+ answerForms?: $ReadOnlyArray<string>,
808
+ // Whether the answerForms should be strictly matched
809
+ strict: boolean,
810
+ // A range of error +/- the value
811
+ // NOTE: perseus_data.go says this is non-nullable even though we handle null values.
812
+ maxError: ?number,
813
+ // Unsimplified answers are Ungraded, Accepted, or Wrong. Options: "required", "correct", or "enforced"
814
+ simplify: ?string,
815
+ |};
816
+ // sync-end:perseus-data-format-numeric-input-answer
817
+
818
+ // sync-start:perseus-data-format-number-line 786922927 services/content-editing/perseus/perseus_data.go
819
+ export type PerseusNumberLineWidgetOptions = {|
820
+ // The position of the endpoints of the number line. Setting the range constrains the position of the answer and the labels.
821
+ range: $ReadOnlyArray<number>,
822
+ // This controls the position of the left / right labels. By default, the labels are set by the range. Note: Ensure that the labels line up with the tick marks, or it may be confusing for users.
823
+ labelRange: $ReadOnlyArray<number | null>,
824
+ // This controls the styling of the labels for the two main labels as well as all the tick mark labels, if applicable. Options: "decimal", "improper", "mixed", "non-reduced"
825
+ labelStyle: string,
826
+ // Show label ticks
827
+ labelTicks: boolean,
828
+ // Show tick controller
829
+ isTickCtrl?: ?boolean,
830
+ // The range of divisions within the line
831
+ divisionRange: $ReadOnlyArray<number>,
832
+ // This controls the number (and position) of the tick marks. The number of divisions is constrained to the division range. Note: The user will be able to specify the number of divisions in a number input.
833
+ numDivisions: ?number,
834
+ // This determines the number of different places the point will snap between two adjacent tick marks. Note: Ensure the required number of snap increments is provided to answer the question.
835
+ snapDivisions: number,
836
+ // This controls the number (and position) of the tick marks; you can either set the number of divisions (2 divisions would split the entire range in two halves), or the tick step (the distance between ticks) and the other value will be updated accordingly. Note: There is no check to see if labels coordinate with the tick marks, which may be confusing for users if the blue labels and black ticks are off-step.
837
+ tickStep: ?number,
838
+ // The correct relative value. default: "eq". options: "eq", "lt", "gt", "le", "ge"
839
+ correctRel: ?string,
840
+ // This is the correct answer. The answer is validated (as right or wrong) by using only the end position of the point and the relation (=, &lt;, &gt;, ≤, ≥).
841
+ correctX: ?number,
842
+ // This controls the initial position of the point along the number line
843
+ initialX: ?number,
844
+ // Show tooltips
845
+ showTooltip?: boolean,
846
+ // When true, the answer is displayed and is immutable
847
+ static: boolean,
848
+ |};
849
+ // sync-end:perseus-data-format-number-line
850
+
851
+ // sync-start:perseus-data-format-orderer 42703989 services/content-editing/perseus/perseus_data.go
852
+ export type PerseusOrdererWidgetOptions = {|
853
+ // All of the options available to the user. Place the cards in the correct order. The same card can be used more than once in the answer but will only be displayed once at the top of a stack of identical cards.
854
+ options: $ReadOnlyArray<PerseusRenderer>,
855
+ // The correct order of the options
856
+ correctOptions: $ReadOnlyArray<PerseusRenderer>,
857
+ // Cards that are not part of the answer
858
+ otherOptions: $ReadOnlyArray<PerseusRenderer>,
859
+ // "normal" for text options. "auto" for image options.
860
+ height: string,
861
+ // Use the "horizontal" layout for short text and small images. The "vertical" layout is best for longer text (e.g. proofs).
862
+ layout: string,
863
+ |};
864
+ // sync-end:perseus-data-format-orderer
865
+
866
+ // sync-start:perseus-data-format-passage 1782937597 services/content-editing/perseus/perseus_data.go
867
+ export type PerseusPassageWidgetOptions = {|
868
+ // Translatable Text; To add footnotes, add ^ characters where they belong in the passage. Then, add ^ in the footnotes area to reference the footnotes in the passage.
869
+ footnotes: string,
870
+ // Translatable Text; The text of the passage
871
+ passageText: string,
872
+ // translatableText - An optional title that will appear directly above the passage in the same font style. (e.g. Passage 1)
873
+ passageTitle: string,
874
+ // Should we show line numbers along with the passage?
875
+ showLineNumbers: boolean,
876
+ // Always false. Not used for this widget
877
+ static: boolean,
878
+ |};
879
+ // sync-end:perseus-data-format-passage
880
+
881
+ // sync-start:perseus-data-format-passage-ref 786922927 services/content-editing/perseus/perseus_data.go
882
+ export type PerseusPassageRefWidgetOptions = {|
883
+ // The passage number
884
+ passageNumber: number,
885
+ // The reference number
886
+ referenceNumber: number,
887
+ // Short summary of the referenced section. This will be included in parentheses and quotes automatically.
888
+ summaryText: string,
889
+ |};
890
+ // sync-end:perseus-data-format-passage-ref
891
+
892
+ // sync-start:perseus-data-format-plotter 1511242700 services/content-editing/perseus/perseus_data.go
893
+ export type PerseusPlotterWidgetOptions = {|
894
+ // Translatable Text; The Axis labels. e.g. ["X Label", "Y Label"]
895
+ labels: $ReadOnlyArray<string>,
896
+ // Translatable Text; Categories to display along the X access. e.g. [">0", ">6", ">12", ">18"]
897
+ categories: $ReadOnlyArray<string>,
898
+ // The type of the graph. options "bar", "line", "pic", "histogram", "dotplot"
899
+ type: string,
900
+ // The maximimum Y tick to display in the graph
901
+ maxY: number,
902
+ // The scale of the Y Axis
903
+ scaleY: number,
904
+ // Which ticks to display the labels for. For instance, setting this to "4" will only show every 4th label (plus the last one)
905
+ labelInterval: ?number,
906
+ // Creates the specified number of divisions between the horizontal lines. Fewer snaps between lines makes the graph easier for the student to create correctly.
907
+ snapsPerLine: number,
908
+ // The Y values the graph should start with
909
+ starting: $ReadOnlyArray<number>,
910
+ // The Y values that represent the correct answer expected
911
+ correct: $ReadOnlyArray<number>,
912
+ // A picture to represent items in a graph.
913
+ picUrl: ?number,
914
+ // deprecated
915
+ picSize: ?number,
916
+ // deprecated
917
+ picBoxHeight: ?number,
918
+ // deprecated
919
+ plotDimensions: $ReadOnlyArray<number>,
920
+ |};
921
+ // sync-end:perseus-data-format-plotter
922
+
923
+ // sync-start:perseus-data-format-radio 1165510766 services/content-editing/perseus/perseus_data.go
924
+ export type PerseusRadioWidgetOptions = {|
925
+ // The choices provided to the user.
926
+ choices: $ReadOnlyArray<PerseusRadioChoice>,
927
+ // Does this have a "none of the above" option?
928
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
929
+ hasNoneOfTheAbove?: boolean,
930
+ // If multipleSelect is enabled, Specify the number expected to be correct.
931
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
932
+ countChoices?: boolean,
933
+ // Randomize the order of the options or keep them as defined
934
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
935
+ randomize?: boolean,
936
+ // Does this set allow for multiple selections to be correct?
937
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
938
+ multipleSelect?: boolean,
939
+ // deprecated
940
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
941
+ deselectEnabled?: boolean,
942
+ // deprecated
943
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
944
+ onePerLine?: boolean,
945
+ // deprecated
946
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
947
+ displayCount?: *,
948
+
949
+ // v0 props
950
+ // `noneOfTheAbove` is still in use (but only set to `false`).
951
+ noneOfTheAbove?: false,
952
+ |};
953
+ // sync-end:perseus-data-format-radio
954
+
955
+ // sync-start:perseus-data-format-radio-choice 1184662431 services/content-editing/perseus/perseus_data.go
956
+ export type PerseusRadioChoice = {|
957
+ // Translatable Markdown; The label for this choice
958
+ content: string,
959
+ // Translatable Markdown; A clue to give the user when they get it wrong
960
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
961
+ clue?: string,
962
+ // Whether this option is a correct answer or not
963
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
964
+ correct?: boolean,
965
+ // If this is none of the above, override the content with "None of the above"
966
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
967
+ isNoneOfTheAbove?: boolean,
968
+ // deprecated
969
+ // NOTE: perseus_data.go says this is required even though it isn't necessary.
970
+ widgets?: {|[string]: PerseusWidget|},
971
+ |};
972
+ // sync-end:perseus-data-format-radio-choice
973
+
974
+ // sync-start:perseus-data-format-sequence 1719933825 services/content-editing/perseus/perseus_data.go
975
+ export type PerseusSequenceWidgetOptions = {|
976
+ // A list of Renderers to display in sequence
977
+ json: $ReadOnlyArray<PerseusRenderer>,
978
+ |};
979
+ // sync-end:perseus-data-format-sequence
980
+
981
+ // sync-start:perseus-data-format-simulator 235177664 services/content-editing/perseus/perseus_data.go
982
+ export type PerseusSimulatorWidgetOptions = {|
983
+ // Translatable Text; The X Axis
984
+ xAxisLabel: string,
985
+ // Translatable Text; The Y Axis
986
+ yAxisLabel: string,
987
+ // Translatable Text; A lable to define the proportion of the simulation
988
+ proportionLabel: string,
989
+ // The type of simulation. options: "proportion", "percentage"
990
+ proportionOrPercentage: string,
991
+ // The number of times to run the simulation
992
+ numTrials: number,
993
+ |};
994
+ // sync-end:perseus-data-format-simulator
995
+
996
+ // sync-start:perseus-data-format-sorter 1524711769 services/content-editing/perseus/perseus_data.go
997
+ export type PerseusSorterWidgetOptions = {|
998
+ // Translatable Text; The correct answer (in the correct order). The user will see the cards in a randomized order.
999
+ correct: $ReadOnlyArray<string>,
1000
+ // Adds padding to the options. Padding is good for text but not needed for images
1001
+ padding: boolean,
1002
+ // Use the "horizontal" layout for short text and small images. The "vertical" layout is best for longer text and larger images.
1003
+ layout: string,
1004
+ |};
1005
+ // sync-end:perseus-data-format-sorter
1006
+
1007
+ // sync-start:perseus-data-format-table 1956164389 services/content-editing/perseus/perseus_data.go
1008
+ export type PerseusTableWidgetOptions = {|
1009
+ // Translatable Text; A list of column headers
1010
+ headers: $ReadOnlyArray<string>,
1011
+ // The number of rows to display
1012
+ rows: number,
1013
+ // The number of columns to display
1014
+ columns: number,
1015
+ // Translatable Text; A 2-dimensional array of text to populate the table with
1016
+ answers: $ReadOnlyArray<$ReadOnlyArray<string>>,
1017
+ |};
1018
+ // sync-end:perseus-data-format-table
1019
+
1020
+ // sync-start:perseus-data-format-transformer 28164718 services/content-editing/perseus/perseus_data.go
1021
+ export type PerseusTransformerWidgetOptions = {|
1022
+ correct: {|
1023
+ shape: {|
1024
+ type: $ReadOnlyArray<
1025
+ | "polygon-5"
1026
+ | "polygon-3"
1027
+ | "polygon-4"
1028
+ | "lineSegment"
1029
+ | "polygon-6"
1030
+ | "angle"
1031
+ | "line"
1032
+ | "circle",
1033
+ >,
1034
+ coords: $ReadOnlyArray<Coord>,
1035
+ options?: $ReadOnlyArray<{|
1036
+ reflex?: boolean,
1037
+ |}>,
1038
+ |},
1039
+ transformations: $ReadOnlyArray<PerseusTransformerTransformation>,
1040
+ |},
1041
+ drawSolutionShape: boolean,
1042
+ gradeEmpty: boolean,
1043
+ // TODO(jeremy): Unify with PerseusGrapherWidgetOptions's .graph
1044
+ graph: {|
1045
+ backgroundImage: {|
1046
+ bottom?: number,
1047
+ height?: number,
1048
+ left?: number,
1049
+ scale?: number,
1050
+ url?: string,
1051
+ width?: number,
1052
+ |},
1053
+ gridStep?: [number, number],
1054
+ labels?: ["x", "y"],
1055
+ markings: "none" | "graph" | "grid",
1056
+ range: [[number, number], [number, number]],
1057
+ rulerLabel?: string,
1058
+ rulerTicks?: number,
1059
+ showProtractor: boolean,
1060
+ showRuler?: boolean,
1061
+ snapStep?: [number, number],
1062
+ step: [number, number],
1063
+ |},
1064
+ graphMode: "dynamic" | "interactive" | "static",
1065
+ listMode: "interactive" | "dynamic" | "static",
1066
+ starting: {|
1067
+ shape:
1068
+ | {|
1069
+ type: $ReadOnlyArray<
1070
+ | "polygon-5"
1071
+ | "polygon-3"
1072
+ | "polygon-4"
1073
+ | "lineSegment"
1074
+ | "polygon-6",
1075
+ >,
1076
+ coords: $ReadOnlyArray<Coord>,
1077
+ options?: $ReadOnlyArray<Empty>,
1078
+ |}
1079
+ | {|
1080
+ type: "polygon-3",
1081
+ coords: [Coord, Coord, Coord],
1082
+ |}
1083
+ | {|
1084
+ type: [
1085
+ | "polygon-3"
1086
+ | "lineSegment"
1087
+ | "polygon-4"
1088
+ | "polygon-5"
1089
+ | "polygon-6"
1090
+ | "line"
1091
+ | "circle",
1092
+ ],
1093
+ coords: $ReadOnlyArray<Coord>,
1094
+ options: [Empty],
1095
+ |}
1096
+ | {|
1097
+ type: ["polygon-3"],
1098
+ coords: [Coord, Coord, Coord],
1099
+ options?: [Empty],
1100
+ |}
1101
+ | {|
1102
+ type: ["angle"],
1103
+ coords: [Coord, Coord, Coord],
1104
+ options: [
1105
+ {|
1106
+ reflex: boolean,
1107
+ |},
1108
+ ],
1109
+ |}
1110
+ | {|
1111
+ type: ["line" | "lineSegment"],
1112
+ coords: [Coord, Coord],
1113
+ options?: [Empty],
1114
+ |}
1115
+ | {|
1116
+ type: "polygon",
1117
+ coords: $ReadOnlyArray<Coord>,
1118
+ |},
1119
+ transformations: $ReadOnlyArray<PerseusTransformerTransformation>,
1120
+ |},
1121
+ tools: {|
1122
+ dilation: DilationTool,
1123
+ reflection: ReflectionTool,
1124
+ rotation: RotationTool,
1125
+ translation: TranslationTool,
1126
+ |},
1127
+ version: number,
1128
+ |};
1129
+
1130
+ export type DilationTransformation = {|
1131
+ type: "dilation",
1132
+ center: Coord,
1133
+ scale: number,
1134
+ constraints: {|
1135
+ fixed: boolean,
1136
+ |},
1137
+ |};
1138
+
1139
+ export type ReflectionTransformation = {|
1140
+ type: "reflection",
1141
+ line: [Coord, Coord],
1142
+ constraints?: {|
1143
+ fixed: boolean,
1144
+ |},
1145
+ |};
1146
+
1147
+ export type RotationTransformation = {|
1148
+ type: "rotation",
1149
+ angleDeg: number,
1150
+ center: Coord,
1151
+ constraints: {|
1152
+ fixed: boolean,
1153
+ |},
1154
+ |};
1155
+
1156
+ export type TranslationTransformation = {|
1157
+ type: "translation",
1158
+ vector: Coord,
1159
+ contraints: Empty,
1160
+ |};
1161
+
1162
+ export type PerseusTransformerTransformation =
1163
+ | DilationTransformation
1164
+ | ReflectionTransformation
1165
+ | RotationTransformation
1166
+ | TranslationTransformation;
1167
+
1168
+ type DilationTool = {|
1169
+ constraints: PerseusTransformerToolConstraints,
1170
+ coord: Coord,
1171
+ enabled: boolean,
1172
+ required?: boolean,
1173
+ |};
1174
+
1175
+ type ReflectionTool = {|
1176
+ constraints: PerseusTransformerToolConstraints,
1177
+ coords: [Coord, Coord],
1178
+ enabled: boolean,
1179
+ required?: boolean,
1180
+ |};
1181
+
1182
+ type RotationTool = {|
1183
+ constraints: PerseusTransformerToolConstraints,
1184
+ coord: Coord,
1185
+ enabled: boolean,
1186
+ required?: boolean,
1187
+ |};
1188
+
1189
+ type TranslationTool = {|
1190
+ constraints: Empty,
1191
+ enabled: boolean,
1192
+ required?: boolean,
1193
+ |};
1194
+
1195
+ export type PerseusTransformerToolConstraints = {|
1196
+ // Whether we should prevent the student from repositioning the tool
1197
+ fixed: boolean,
1198
+ |};
1199
+
1200
+ // sync-end:perseus-data-format-transformer
1201
+
1202
+ // sync-start:perseus-data-format-interaction 1099589221 services/content-editing/perseus/perseus_data.go
1203
+ export type PerseusInteractionWidgetOptions = {|
1204
+ // The definition of the graph
1205
+ graph: PerseusInteractionGraph,
1206
+ // The elements of the graph
1207
+ elements: $ReadOnlyArray<PerseusInteractionElement>,
1208
+ // Always false. Not used for this widget
1209
+ static: boolean,
1210
+ |};
1211
+ // sync-end:perseus-data-format-interaction
1212
+
1213
+ // sync-start:perseus-data-format-interaction-graph 174409695 services/content-editing/perseus/perseus_data.go
1214
+ export type PerseusInteractionGraph = {|
1215
+ // "canvas", "graph"
1216
+ editableSettings?: $ReadOnlyArray<"canvas" | "graph">,
1217
+ // The Grid Canvas size. e.g. [400, 140]
1218
+ box: $ReadOnlyArray<number>,
1219
+ // The Axis labels. e.g. ["x", "y"]
1220
+ labels: $ReadOnlyArray<string>,
1221
+ // The Axis ranges. e.g. [[-10, 10], [-10, 10]]
1222
+ range: $ReadOnlyArray<$ReadOnlyArray<number>>,
1223
+ // The steps in the grid. default [1, 1]
1224
+ gridStep: $ReadOnlyArray<number>,
1225
+ // What to show on the graph. "graph", "grid", or "none"
1226
+ markings: string,
1227
+ // The snap steps. default [0.5, 0.5]
1228
+ snapStep?: $ReadOnlyArray<number>,
1229
+ // Whether the grid is valid or not. Do the numbers all make sense?
1230
+ // NOTE(jeremy) The editor for this widget sometimes stores the graph
1231
+ // editor validation error message into this field. It seems innocuous
1232
+ // because it looks like many of these usages don't actually use the graph
1233
+ // at all.
1234
+ valid?: boolean | string,
1235
+ // An optional background image to use
1236
+ backgroundImage?: PerseusImageBackground,
1237
+ // Whether to show the Protractor tool overlayed on top of the graph
1238
+ showProtractor?: boolean,
1239
+ // Whether to show the Ruler tool overlayed on top of the graph
1240
+ showRuler?: boolean,
1241
+ // The unit to show on the ruler. e.g. "mm", "cm", "m", "km", "in", "ft", "yd", "mi"
1242
+ rulerLabel?: string,
1243
+ // How many ticks to show on the ruler. e.g. 1, 2, 4, 8, 10, 16
1244
+ rulerTicks?: number,
1245
+ // This controls the number (and position) of the tick marks for the X and Y axis. e.g. [1, 1]
1246
+ tickStep: $ReadOnlyArray<number>,
1247
+ |};
1248
+ // sync-end:perseus-data-format-interaction-graph
1249
+
1250
+ // sync-start:perseus-data-format-interaction-element 865922566 services/content-editing/perseus/perseus_data.go
1251
+ export type PerseusInteractionElement =
1252
+ | {|
1253
+ type: "function",
1254
+ // An identifier for the element
1255
+ key: string,
1256
+ options: PerseusInteractionFunctionElementOptions,
1257
+ |}
1258
+ | {|
1259
+ type: "label",
1260
+ // An identifier for the element
1261
+ key: string,
1262
+ options: PerseusInteractionLabelElementOptions,
1263
+ |}
1264
+ | {|
1265
+ type: "line",
1266
+ // An identifier for the element
1267
+ key: string,
1268
+ options: PerseusInteractionLineElementOptions,
1269
+ |}
1270
+ | {|
1271
+ type: "movable-line",
1272
+ // An identifier for the element
1273
+ key: string,
1274
+ options: PerseusInteractionMovableLineElementOptions,
1275
+ |}
1276
+ | {|
1277
+ type: "movable-point",
1278
+ // An identifier for the element
1279
+ key: string,
1280
+ options: PerseusInteractionMovablePointElementOptions,
1281
+ |}
1282
+ | {|
1283
+ type: "parametric",
1284
+ // An identifier for the element
1285
+ key: string,
1286
+ options: PerseusInteractionParametricElementOptions,
1287
+ |}
1288
+ | {|
1289
+ type: "point",
1290
+ // An identifier for the element
1291
+ key: string,
1292
+ options: PerseusInteractionPointElementOptions,
1293
+ |}
1294
+ | {|
1295
+ type: "rectangle",
1296
+ // An identifier for the element
1297
+ key: string,
1298
+ options: PerseusInteractionRectangleElementOptions,
1299
+ |};
1300
+
1301
+ // sync-end:perseus-data-format-interaction-element
1302
+
1303
+ // sync-start:perseus-data-format-interaction-function 81160594 services/content-editing/perseus/perseus_data.go
1304
+ export type PerseusInteractionFunctionElementOptions = {|
1305
+ // The definition of the function to draw on the graph. e.g "x^2 + 1"
1306
+ value: string,
1307
+ // The name of the function like f(n). default: "f"
1308
+ funcName: string,
1309
+ // The range of points to start plotting
1310
+ rangeMin: string,
1311
+ // The range of points to end plotting
1312
+ rangeMax: string,
1313
+ // The color of the stroke. e.g. #6495ED
1314
+ color: string,
1315
+ // If the function stroke has a dash, what is it? options: "", "-", "- ", ".", ". "
1316
+ strokeDasharray: string,
1317
+ // The thickness of the stroke
1318
+ strokeWidth: number,
1319
+ |};
1320
+ // sync-end:perseus-data-format-interaction-function
1321
+
1322
+ // sync-start:perseus-data-format-interaction-label 1111537285 services/content-editing/perseus/perseus_data.go
1323
+ export type PerseusInteractionLabelElementOptions = {|
1324
+ // Translatable Text; the content of the label
1325
+ label: string,
1326
+ // The color of the label. e.g. "red"
1327
+ color: string,
1328
+ // The X location of the label
1329
+ coordX: string,
1330
+ // The Y location of the label
1331
+ coordY: string,
1332
+ |};
1333
+ // sync-end:perseus-data-format-interaction-label
1334
+
1335
+ // sync-start:perseus-data-format-interaction-line 1331716694 services/content-editing/perseus/perseus_data.go
1336
+ export type PerseusInteractionLineElementOptions = {|
1337
+ // A color code for the line segment. e.g. "#FFOOAF"
1338
+ color: string,
1339
+ // The start of the line segment (X)
1340
+ startX: string,
1341
+ // The start of the line segment (Y)
1342
+ startY: string,
1343
+ // The end of the line segment (X)
1344
+ endX: string,
1345
+ // The end of the line segment (Y)
1346
+ endY: string,
1347
+ // If the line stroke has a dash, what is it? options: "", "-", "- ", ".", ". "
1348
+ strokeDasharray: string,
1349
+ // The thickness of the line
1350
+ strokeWidth: number,
1351
+ // Does the line have an arrow point to it? options: "", "->"
1352
+ arrows: string,
1353
+ |};
1354
+ // sync-end:perseus-data-format-interaction-line
1355
+
1356
+ // sync-start:perseus-data-format-interaction-movable-line 1201996829 services/content-editing/perseus/perseus_data.go
1357
+ export type PerseusInteractionMovableLineElementOptions = {|
1358
+ // The start of the line segment (X)
1359
+ startX: string,
1360
+ // The start of the line segment (Y)
1361
+ startY: string,
1362
+ // Start updates (Xn, Yn) for n
1363
+ startSubscript: number,
1364
+ // The end of the line segment (X)
1365
+ endX: string,
1366
+ // The end of the line segment (Y)
1367
+ endY: string,
1368
+ // End updates (Xm, Ym) for m
1369
+ endSubscript: number,
1370
+ // How to constrain this line? options "none", "snap", "x", "y"
1371
+ constraint: string,
1372
+ // The snap resolution when constraint is set to "snap"
1373
+ snap: number,
1374
+ // The constraint function for when constraint is set to "x" or "y"
1375
+ constraintFn: string,
1376
+ // The lowest possible X value
1377
+ constraintXMin: string,
1378
+ // The highest possible X value
1379
+ constraintXMax: string,
1380
+ // The lowest possible Y value
1381
+ constraintYMin: string,
1382
+ // The highest possible Y value
1383
+ constraintYMax: string,
1384
+ |};
1385
+ // sync-end:perseus-data-format-interaction-movable-line
1386
+
1387
+ // sync-start:perseus-data-format-interaction-movable-point 993274163 services/content-editing/perseus/perseus_data.go
1388
+ export type PerseusInteractionMovablePointElementOptions = {|
1389
+ // The X position of the point
1390
+ startX: string,
1391
+ // The Y position of the point
1392
+ startY: string,
1393
+ // Update (Xn, Yn) for n
1394
+ varSubscript: number,
1395
+ // How to constrain this line? options "none", "snap", "x", "y"
1396
+ constraint: string,
1397
+ // The snap resolution when constraint is set to "snap"
1398
+ snap: number,
1399
+ // The constraint function for when constraint is set to "x" or "y"
1400
+ constraintFn: string,
1401
+ // The lowest possible X value
1402
+ constraintXMin: string,
1403
+ // The highest possible X value
1404
+ constraintXMax: string,
1405
+ // The lowest possible Y value
1406
+ constraintYMin: string,
1407
+ // The highest possible Y value
1408
+ constraintYMax: string,
1409
+ |};
1410
+ // sync-end:perseus-data-format-interaction-movable-point
1411
+
1412
+ // sync-start:perseus-data-format-interaction-parametric 2038394914 services/content-editing/perseus/perseus_data.go
1413
+ export type PerseusInteractionParametricElementOptions = {|
1414
+ // The function for the X coordinate. e.g. "\\cos(t)"
1415
+ x: string,
1416
+ // The function for the Y coordinate. e.g. "\\sin(t)"
1417
+ y: string,
1418
+ // The range of points to start plotting
1419
+ rangeMin: string,
1420
+ // The range of points to end plotting
1421
+ rangeMax: string,
1422
+ // The color of the stroke. e.g. #6495ED
1423
+ color: string,
1424
+ // If the function stroke has a dash, what is it? options: "", "-", "- ", ".", ". "
1425
+ strokeDasharray: string,
1426
+ // The thickness of the stroke
1427
+ strokeWidth: number,
1428
+ |};
1429
+ // sync-end:perseus-data-format-interaction-parametric
1430
+
1431
+ // sync-start:perseus-data-format-interaction-point 489666139 services/content-editing/perseus/perseus_data.go
1432
+ export type PerseusInteractionPointElementOptions = {|
1433
+ // The color of the point. e.g. "black"
1434
+ color: string,
1435
+ // The X coordinate of the point
1436
+ coordX: string,
1437
+ // The Y coordinate of the point
1438
+ coordY: string,
1439
+ |};
1440
+ // sync-end:perseus-data-format-interaction-point
1441
+
1442
+ // sync-start:perseus-data-format-interaction-rectangle 999004794 services/content-editing/perseus/perseus_data.go
1443
+ export type PerseusInteractionRectangleElementOptions = {|
1444
+ // The fill color. e.g. "#EDD19B"
1445
+ color: string,
1446
+ // The lower left point X
1447
+ coordX: string,
1448
+ // The lower left point Y
1449
+ coordY: string,
1450
+ // The width of the rectangle
1451
+ width: string,
1452
+ // The height of the rectangle
1453
+ height: string,
1454
+ |};
1455
+ // sync-end:perseus-data-format-interaction-rectangle
1456
+
1457
+ // sync-start:perseus-data-format-cs-program 786922927 services/content-editing/perseus/perseus_data.go
1458
+ export type PerseusCSProgramWidgetOptions = {|
1459
+ // The ID of the CS program to embed
1460
+ programID: string,
1461
+ // Deprecated. Always null and sometimes omitted entirely.
1462
+ programType?: *,
1463
+ // Settings that you add here are available to the program as an object returned by Program.settings()
1464
+ settings: $ReadOnlyArray<PerseusCSProgramSetting>,
1465
+ // If you show the editor, you should use the "full-width" alignment to make room for the width of the editor.
1466
+ showEditor: boolean,
1467
+ // Whether to show the execute buttons
1468
+ showButtons: boolean,
1469
+ // The width of the widget
1470
+ width: number,
1471
+ // The height of the widget
1472
+ height: number,
1473
+ // Always false
1474
+ static: boolean,
1475
+ |};
1476
+
1477
+ export type PerseusCSProgramSetting = {|
1478
+ // The name/key of the setting
1479
+ name: string,
1480
+ // The value of the setting
1481
+ value: string,
1482
+ |};
1483
+ // sync-end:perseus-data-format-cs-program
1484
+
1485
+ // sync-start:perseus-data-format-iframe 786922927 services/content-editing/perseus/perseus_data.go
1486
+ export type PerseusIFrameWidgetOptions = {|
1487
+ // A URL to display OR a CS Program ID
1488
+ url: string,
1489
+ // Settings that you add here are available to the program as an object returned by Program.settings()
1490
+ settings: $ReadOnlyArray<PerseusCSProgramSetting>,
1491
+ // The width of the widget
1492
+ width: number | string,
1493
+ // The height of the widget
1494
+ height: number | string,
1495
+ // Whether to allow the IFrame to become full-screen (like a video)
1496
+ allowFullScreen: boolean,
1497
+ // Whether to allow the iframe content to redirect the page
1498
+ allowTopNavigation?: boolean,
1499
+ // Always false
1500
+ static: boolean,
1501
+ |};
1502
+ // sync-end:perseus-data-format-iframe
1503
+
1504
+ // sync-start:perseus-data-format-video 786922927 services/content-editing/perseus/perseus_data.go
1505
+ export type PerseusVideoWidgetOptions = {|
1506
+ location: string,
1507
+ static?: boolean,
1508
+ |};
1509
+ // sync-end:perseus-data-format-video
1510
+
1511
+ // sync-start:perseus-data-format-input-number 786922927 services/content-editing/perseus/perseus_data.go
1512
+ export type PerseusInputNumberWidgetOptions = {|
1513
+ answerType?:
1514
+ | "number"
1515
+ | "percent"
1516
+ | "integer"
1517
+ | "improper"
1518
+ | "rational"
1519
+ | "pi"
1520
+ | "decimal",
1521
+ inexact?: boolean,
1522
+ maxError?: number | string,
1523
+ rightAlign?: boolean,
1524
+ simplify: "required" | "optional" | "enforced",
1525
+ size: "normal" | "small",
1526
+ value: string | number | boolean,
1527
+ customKeypad?: boolean,
1528
+ |};
1529
+ // sync-end:perseus-data-format-input-number
1530
+
1531
+ // TODO(FEI-3983): Create proper flow types for these.
1532
+ // sync-start:perseus-data-format-example-graphie 786922927 services/content-editing/perseus/perseus_data.go
1533
+ export type PerseusExampleGraphieWidgetOptions = $FlowFixMe;
1534
+ // sync-end:perseus-data-format-example-graphie
1535
+ // sync-start:perseus-data-format-example 786922927 services/content-editing/perseus/perseus_data.go
1536
+ export type PerseusExampleWidgetOptions = $FlowFixMe;
1537
+ // sync-end:perseus-data-format-example
1538
+ // sync-start:perseus-data-format-lights-puzzle 786922927 services/content-editing/perseus/perseus_data.go
1539
+ export type PerseusLightsPuzzleWidgetOptions = $FlowFixMe;
1540
+ // sync-end:perseus-data-format-lights-puzzle
1541
+ // sync-start:perseus-data-format-molecule-renderer 786922927 services/content-editing/perseus/perseus_data.go
1542
+ export type PerseusMoleculeRendererWidgetOptions = $FlowFixMe;
1543
+ // sync-end:perseus-data-format-molecule-renderer
1544
+ // sync-start:perseus-data-format-passage-ref-target 786922927 services/content-editing/perseus/perseus_data.go
1545
+ export type PerseusPassageRefTargetWidgetOptions = $FlowFixMe;
1546
+ // sync-end:perseus-data-format-passage-ref-target
1547
+ // sync-start:perseus-data-format-reaction-diagram 786922927 services/content-editing/perseus/perseus_data.go
1548
+ export type PerseusReactionDiagramWidgetOptions = $FlowFixMe;
1549
+ // sync-end:perseus-data-format-reaction-diagram
1550
+ // sync-start:perseus-data-format-simple-markdown-tester 786922927 services/content-editing/perseus/perseus_data.go
1551
+ export type PerseusSimpleMarkdownTesterWidgetOptions = $FlowFixMe;
1552
+ // sync-end:perseus-data-format-simple-markdown-tester
1553
+ // sync-start:perseus-data-format-unit-input 786922927 services/content-editing/perseus/perseus_data.go
1554
+ export type PerseusUnitInputWidgetOptions = $FlowFixMe;
1555
+ // sync-end:perseus-data-format-unit-input
1556
+
1557
+ export type PerseusWidgetOptions =
1558
+ | PerseusCategorizerWidgetOptions
1559
+ | PerseusCSProgramWidgetOptions
1560
+ | PerseusDefinitionWidgetOptions
1561
+ | PerseusDropdownWidgetOptions
1562
+ | PerseusExampleGraphieWidgetOptions
1563
+ | PerseusExampleWidgetOptions
1564
+ | PerseusExplanationWidgetOptions
1565
+ | PerseusExpressionWidgetOptions
1566
+ | PerseusGradedGroupSetWidgetOptions
1567
+ | PerseusGradedGroupWidgetOptions
1568
+ | PerseusIFrameWidgetOptions
1569
+ | PerseusImageWidgetOptions
1570
+ | PerseusInputNumberWidgetOptions
1571
+ | PerseusInteractionWidgetOptions
1572
+ | PerseusInteractiveGraphWidgetOptions
1573
+ | PerseusLabelImageWidgetOptions
1574
+ | PerseusLightsPuzzleWidgetOptions
1575
+ | PerseusMatcherWidgetOptions
1576
+ | PerseusMatrixWidgetOptions
1577
+ | PerseusMeasurerWidgetOptions
1578
+ | PerseusMoleculeRendererWidgetOptions
1579
+ | PerseusNumberLineWidgetOptions
1580
+ | PerseusNumericInputWidgetOptions
1581
+ | PerseusOrdererWidgetOptions
1582
+ | PerseusPassageRefTargetWidgetOptions
1583
+ | PerseusPassageRefWidgetOptions
1584
+ | PerseusPassageWidgetOptions
1585
+ | PerseusPlotterWidgetOptions
1586
+ | PerseusRadioWidgetOptions
1587
+ | PerseusReactionDiagramWidgetOptions
1588
+ | PerseusSequenceWidgetOptions
1589
+ | PerseusSimpleMarkdownTesterWidgetOptions
1590
+ | PerseusSimulatorWidgetOptions
1591
+ | PerseusSorterWidgetOptions
1592
+ | PerseusTableWidgetOptions
1593
+ | PerseusTransformerWidgetOptions
1594
+ | PerseusUnitInputWidgetOptions
1595
+ | PerseusVideoWidgetOptions;
1596
+
1597
+ // sync-end:perseus-data-format