diff --git a/.changeset/thick-jokes-judge.md b/.changeset/thick-jokes-judge.md new file mode 100644 index 0000000000..e91b6cc2ee --- /dev/null +++ b/.changeset/thick-jokes-judge.md @@ -0,0 +1,5 @@ +--- +"@khanacademy/perseus": patch +--- + +Clear seemingly useless widget rubrics diff --git a/packages/perseus/src/types.ts b/packages/perseus/src/types.ts index 4720430b86..3cde049346 100644 --- a/packages/perseus/src/types.ts +++ b/packages/perseus/src/types.ts @@ -657,7 +657,7 @@ export type FilterCriterion = // and Rubric is what we use to score the widgets (which not all widgets need validation) export type WidgetProps< RenderProps, - Rubric, + Rubric = Empty, // Defines the arguments that can be passed to the `trackInteraction` // function from APIOptions for this widget. TrackingExtraArgs = Empty, diff --git a/packages/perseus/src/validation.types.ts b/packages/perseus/src/validation.types.ts index addeb6fed0..73ef3880b2 100644 --- a/packages/perseus/src/validation.types.ts +++ b/packages/perseus/src/validation.types.ts @@ -1,29 +1,22 @@ import type { GrapherAnswerTypes, - PerseusDefinitionWidgetOptions, PerseusDropdownChoice, - PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, - PerseusImageWidgetOptions, - PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, - PerseusPassageRefWidgetOptions, - PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, - PerseusVideoWidgetOptions, } from "./perseus-types"; import type {InteractiveMarkerType} from "./widgets/label-image/types"; import type {Relationship} from "./widgets/number-line/number-line"; @@ -50,9 +43,6 @@ export type PerseusCSProgramUserInput = { message: string | null; }; -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusDefinitionRubric = PerseusDefinitionWidgetOptions; - export type PerseusDropdownRubric = { choices: ReadonlyArray; }; @@ -61,9 +51,6 @@ export type PerseusDropdownUserInput = { value: number; }; -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusExplanationRubric = PerseusExplanationWidgetOptions; - export type PerseusExpressionRubric = { answerForms: ReadonlyArray; functions: ReadonlyArray; @@ -90,9 +77,6 @@ export type PerseusIFrameUserInput = { message: string | null; }; -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusImageRubric = PerseusImageWidgetOptions; - export type PerseusInputNumberRubric = { answerType?: | "number" @@ -113,9 +97,6 @@ export type PerseusInputNumberUserInput = { currentValue: string; }; -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusInteractionRubric = PerseusInteractionWidgetOptions; - export type PerseusInteractiveGraphRubric = { // TODO(LEMS-2344): make the type of `correct` more specific correct: PerseusGraphType; @@ -167,12 +148,6 @@ export type PerseusOrdererUserInput = { current: ReadonlyArray; }; -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusPassageRubric = PerseusPassageWidgetOptions; - -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusPassageRefRubric = PerseusPassageRefWidgetOptions; - export type PerseusPlotterRubric = PerseusPlotterWidgetOptions; export type PerseusPlotterUserInput = ReadonlyArray; @@ -198,24 +173,17 @@ export type PerseusTableRubric = PerseusTableWidgetOptions; export type PerseusTableUserInput = ReadonlyArray>; -// TODO (LEMS-2396): remove validation logic from widgets that don't validate -export type PerseusVideoRubric = PerseusVideoWidgetOptions; - export type Rubric = | PerseusCategorizerRubric | PerseusCSProgramRubric - | PerseusDefinitionRubric | PerseusDropdownRubric - | PerseusExplanationRubric | PerseusExpressionRubric | PerseusGroupRubric | PerseusGradedGroupRubric | PerseusGradedGroupSetRubric | PerseusGrapherRubric | PerseusIFrameRubric - | PerseusImageRubric | PerseusInputNumberRubric - | PerseusInteractionRubric | PerseusInteractiveGraphRubric | PerseusLabelImageRubric | PerseusMatcherRubric @@ -223,13 +191,10 @@ export type Rubric = | PerseusNumberLineRubric | PerseusNumericInputRubric | PerseusOrdererRubric - | PerseusPassageRubric - | PerseusPassageRefRubric | PerseusPlotterRubric | PerseusRadioRubric | PerseusSorterRubric - | PerseusTableRubric - | PerseusVideoRubric; + | PerseusTableRubric; export type UserInput = | PerseusCategorizerUserInput diff --git a/packages/perseus/src/widgets/__shared__/noop-validator.ts b/packages/perseus/src/widgets/__shared__/noop-validator.ts index 7061a20748..ccb7ed2de4 100644 --- a/packages/perseus/src/widgets/__shared__/noop-validator.ts +++ b/packages/perseus/src/widgets/__shared__/noop-validator.ts @@ -4,7 +4,7 @@ import type {PerseusScore} from "../../types"; * Several widgets don't have "right"/"wrong" validation logic, * so this just says to move on past those widgets * - * TODO(LEMS-2396) widgets that use this probably shouldn't have any + * TODO(LEMS-2543) widgets that use this probably shouldn't have any * validation logic and the thing validating an exercise * should just know to skip these */ diff --git a/packages/perseus/src/widgets/definition/definition.tsx b/packages/perseus/src/widgets/definition/definition.tsx index 0395a57270..822461fc46 100644 --- a/packages/perseus/src/widgets/definition/definition.tsx +++ b/packages/perseus/src/widgets/definition/definition.tsx @@ -13,11 +13,10 @@ import type { PerseusDefinitionWidgetOptions, } from "../../perseus-types"; import type {Widget, WidgetExports, WidgetProps} from "../../types"; -import type {PerseusDefinitionRubric} from "../../validation.types"; type RenderProps = PerseusDefinitionWidgetOptions; -type DefinitionProps = WidgetProps & { +type DefinitionProps = WidgetProps & { widgets: PerseusRenderer["widgets"]; }; diff --git a/packages/perseus/src/widgets/explanation/explanation.tsx b/packages/perseus/src/widgets/explanation/explanation.tsx index e1e1b820f5..6497ff10f9 100644 --- a/packages/perseus/src/widgets/explanation/explanation.tsx +++ b/packages/perseus/src/widgets/explanation/explanation.tsx @@ -14,11 +14,10 @@ import noopValidator from "../__shared__/noop-validator"; import type {PerseusExplanationWidgetOptions} from "../../perseus-types"; import type {Widget, WidgetExports, WidgetProps} from "../../types"; -import type {PerseusExplanationRubric} from "../../validation.types"; type RenderProps = PerseusExplanationWidgetOptions; // transform = _.identity -type Props = WidgetProps; +type Props = WidgetProps; type DefaultProps = { showPrompt: Props["showPrompt"]; diff --git a/packages/perseus/src/widgets/image/image.tsx b/packages/perseus/src/widgets/image/image.tsx index ebd208343f..a41c76a830 100644 --- a/packages/perseus/src/widgets/image/image.tsx +++ b/packages/perseus/src/widgets/image/image.tsx @@ -12,7 +12,6 @@ import noopValidator from "../__shared__/noop-validator"; import type {Range, PerseusImageWidgetOptions} from "../../perseus-types"; import type {ChangeFn, WidgetExports, WidgetProps, Widget} from "../../types"; -import type {PerseusImageRubric} from "../../validation.types"; const defaultBoxSize = 400; const defaultRange: Range = [0, 10]; @@ -28,7 +27,7 @@ const DEFAULT_ALIGNMENT = "block"; type RenderProps = PerseusImageWidgetOptions; // there is no transform as part of exports -type ExternalProps = WidgetProps; +type ExternalProps = WidgetProps; type Props = ExternalProps & { alignment: NonNullable; diff --git a/packages/perseus/src/widgets/interaction/interaction.tsx b/packages/perseus/src/widgets/interaction/interaction.tsx index 105d3a660f..c2c5c69217 100644 --- a/packages/perseus/src/widgets/interaction/interaction.tsx +++ b/packages/perseus/src/widgets/interaction/interaction.tsx @@ -16,7 +16,6 @@ import type { PerseusInteractionWidgetOptions, } from "../../perseus-types"; import type {Widget, WidgetExports, WidgetProps} from "../../types"; -import type {PerseusInteractionRubric} from "../../validation.types"; // @ts-expect-error - TS2339 - Property 'Label' does not exist on type 'typeof Graphie'. const Label = Graphie.Label; @@ -97,7 +96,7 @@ const KAScompile = ( }; type RenderProps = PerseusInteractionWidgetOptions; // There's no transform function in exports -type Props = WidgetProps; +type Props = WidgetProps; type DefaultProps = { graph: Props["graph"]; diff --git a/packages/perseus/src/widgets/passage-ref/passage-ref.tsx b/packages/perseus/src/widgets/passage-ref/passage-ref.tsx index b222fddeca..47d3291b07 100644 --- a/packages/perseus/src/widgets/passage-ref/passage-ref.tsx +++ b/packages/perseus/src/widgets/passage-ref/passage-ref.tsx @@ -9,7 +9,6 @@ import {isPassageWidget} from "../passage/utils"; import type {PerseusPassageRefWidgetOptions} from "../../perseus-types"; import type {ChangeFn, Widget, WidgetExports, WidgetProps} from "../../types"; -import type {PerseusPassageRefRubric} from "../../validation.types"; const EN_DASH = "\u2013"; @@ -19,7 +18,7 @@ type RenderProps = { summaryText: PerseusPassageRefWidgetOptions["summaryText"]; }; -type Props = WidgetProps; +type Props = WidgetProps; type DefaultProps = { passageNumber: Props["passageNumber"]; diff --git a/packages/perseus/src/widgets/passage/passage.tsx b/packages/perseus/src/widgets/passage/passage.tsx index 8b21b6f65a..53a2f1725c 100644 --- a/packages/perseus/src/widgets/passage/passage.tsx +++ b/packages/perseus/src/widgets/passage/passage.tsx @@ -22,7 +22,6 @@ import type { PerseusWidget, } from "../../perseus-types"; import type {WidgetExports, WidgetProps, Widget} from "../../types"; -import type {PerseusPassageRubric} from "../../validation.types"; import type {SingleASTNode} from "@khanacademy/simple-markdown"; // A fake paragraph to measure the line height of the passage, @@ -71,7 +70,7 @@ type RenderProps = { type FindWidgetsCallback = (id: string, widgetInfo: PerseusWidget) => boolean; type PassageProps = ChangeableProps & - WidgetProps & { + WidgetProps & { findWidgets: (arg1: FindWidgetsCallback) => ReadonlyArray; highlights: SerializedHighlightSet; }; diff --git a/packages/perseus/src/widgets/video/video.tsx b/packages/perseus/src/widgets/video/video.tsx index 8098facd14..55685e1237 100644 --- a/packages/perseus/src/widgets/video/video.tsx +++ b/packages/perseus/src/widgets/video/video.tsx @@ -17,7 +17,6 @@ import VideoTranscriptLink from "./video-transcript-link"; import type {PerseusVideoWidgetOptions} from "../../perseus-types"; import type {Widget, WidgetExports, WidgetProps} from "../../types"; -import type {PerseusVideoRubric} from "../../validation.types"; // Current default is 720p, based on the typical videos we upload currently const DEFAULT_WIDTH = 1280; @@ -29,7 +28,7 @@ const IS_KA_SITE = /(khanacademy\.org|localhost)/; const IS_VIMEO = /(vimeo\.com)/; type RenderProps = PerseusVideoWidgetOptions; // exports has no 'transform' -type Props = WidgetProps & { +type Props = WidgetProps & { alignment: string; // Where does this get set? };