@khanacademy/perseus 43.0.0 → 43.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/components/number-input.d.ts +5 -3
  2. package/dist/components/text-input.d.ts +4 -2
  3. package/dist/es/index.js +475 -306
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/es/strings.js +7 -3
  6. package/dist/es/strings.js.map +1 -1
  7. package/dist/index.js +465 -296
  8. package/dist/index.js.map +1 -1
  9. package/dist/perseus-types.d.ts +14 -7
  10. package/dist/strings.js +7 -3
  11. package/dist/strings.js.map +1 -1
  12. package/dist/util/parse-perseus-json/general-purpose-parsers/defaulted.d.ts +1 -1
  13. package/dist/util/parse-perseus-json/general-purpose-parsers/index.d.ts +2 -0
  14. package/dist/util/parse-perseus-json/general-purpose-parsers/pipe-parsers.d.ts +7 -0
  15. package/dist/util/parse-perseus-json/general-purpose-parsers/pipe-parsers.typetest.d.ts +1 -0
  16. package/dist/util/parse-perseus-json/general-purpose-parsers/unknown.d.ts +2 -0
  17. package/dist/util/parse-perseus-json/perseus-parsers/images-map.d.ts +5 -0
  18. package/dist/util/parse-perseus-json/perseus-parsers/widget.d.ts +4 -0
  19. package/dist/validation.types.d.ts +14 -6
  20. package/dist/widgets/categorizer/categorizer.d.ts +2 -2
  21. package/dist/widgets/categorizer/score-categorizer.d.ts +2 -2
  22. package/dist/widgets/categorizer/validate-categorizer.d.ts +15 -0
  23. package/dist/widgets/dropdown/validate-dropdown.d.ts +10 -0
  24. package/dist/widgets/interactive-graphs/graphs/components/movable-point.d.ts +11 -7
  25. package/dist/widgets/interactive-graphs/graphs/components/use-control-point.d.ts +7 -3
  26. package/dist/widgets/interactive-graphs/types.d.ts +1 -0
  27. package/dist/widgets/interactive-graphs/utils.d.ts +6 -6
  28. package/dist/widgets/matrix/matrix.d.ts +12 -5
  29. package/dist/widgets/measurer/measurer.d.ts +1 -1
  30. package/dist/widgets/orderer/validate-orderer.d.ts +12 -0
  31. package/dist/widgets/plotter/plotter.d.ts +2 -2
  32. package/dist/widgets/plotter/score-plotter.d.ts +2 -2
  33. package/dist/widgets/plotter/validate-plotter.d.ts +12 -0
  34. package/dist/widgets/radio/radio.d.ts +1 -1
  35. package/dist/widgets/radio/validate-radio.d.ts +14 -0
  36. package/dist/widgets/sorter/validate-sorter.d.ts +13 -0
  37. package/package.json +4 -4
  38. package/dist/util/parse-perseus-json/general-purpose-parsers/compose-parsers.d.ts +0 -2
@@ -0,0 +1,14 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusRadioUserInput } from "../../validation.types";
3
+ /**
4
+ * Checks if the user has selected at least one option. Additional validation
5
+ * is done in scoreRadio to check if the number of selected options is correct
6
+ * and if the user has selected both a correct option and the "none of the above"
7
+ * option.
8
+ * @param userInput
9
+ * @see `scoreRadio` for the additional validation logic and the scoring logic.
10
+ */
11
+ declare function validateRadio(userInput: PerseusRadioUserInput): Extract<PerseusScore, {
12
+ type: "invalid";
13
+ }> | null;
14
+ export default validateRadio;
@@ -0,0 +1,13 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusSorterUserInput } from "../../validation.types";
3
+ /**
4
+ * Checks user input for the sorter widget to ensure that the user has made
5
+ * changes before attempting to score the widget.
6
+ * @param userInput
7
+ * @see 'scoreSorter' in 'packages/perseus/src/widgets/sorter/score-sorter.ts'
8
+ * for more details on how the sorter widget is scored.
9
+ */
10
+ declare function validateSorter(userInput: PerseusSorterUserInput): Extract<PerseusScore, {
11
+ type: "invalid";
12
+ }> | null;
13
+ export default validateSorter;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "43.0.0",
6
+ "version": "43.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -40,14 +40,14 @@
40
40
  "test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
41
41
  },
42
42
  "dependencies": {
43
- "@khanacademy/kas": "^0.4.1",
43
+ "@khanacademy/kas": "^0.4.2",
44
44
  "@khanacademy/keypad-context": "^1.0.4",
45
45
  "@khanacademy/kmath": "^0.1.16",
46
46
  "@khanacademy/math-input": "^21.1.5",
47
47
  "@khanacademy/perseus-core": "1.5.3",
48
48
  "@khanacademy/perseus-linter": "^1.2.4",
49
- "@khanacademy/pure-markdown": "^0.3.12",
50
- "@khanacademy/simple-markdown": "^0.13.5",
49
+ "@khanacademy/pure-markdown": "^0.3.13",
50
+ "@khanacademy/simple-markdown": "^0.13.6",
51
51
  "@types/classnames": "2.2.0",
52
52
  "@use-gesture/react": "^10.2.27",
53
53
  "mafs": "0.19.0",
@@ -1,2 +0,0 @@
1
- import type { ParsedValue, PartialParser, Parser } from "../parser-types";
2
- export declare function composeParsers<A extends Parser<any>, B extends PartialParser<ParsedValue<A>, any>>(parserA: A, parserB: B): Parser<ParsedValue<B>>;