@khanacademy/perseus-core
Advanced tools
Comparing version 0.0.0-PR2249-20250218230904 to 0.0.0-PR2254-20250219234711
@@ -18,6 +18,18 @@ type VirtualKeypadVersion = "MATH_INPUT_KEYPAD_V2" | "REACT_NATIVE_KEYPAD"; | ||
payload: { | ||
widgetSubType: string; | ||
widgetType: string; | ||
widgetId: string; | ||
message: string; | ||
userAgent: string; | ||
}; | ||
} | { | ||
type: "perseus:widget-rendering-error:ti"; | ||
payload: { | ||
widgetSubType: string; | ||
widgetType: string; | ||
widgetId: string; | ||
message: string; | ||
userAgent: string; | ||
}; | ||
} | { | ||
type: "perseus:interactive-graph-widget:rendered"; | ||
@@ -30,2 +42,9 @@ payload: { | ||
} | { | ||
type: "perseus:widget:rendered:ti"; | ||
payload: { | ||
widgetSubType: string; | ||
widgetType: string; | ||
widgetId: string; | ||
}; | ||
} | { | ||
type: "perseus:label-image:toggle-answers-hidden"; | ||
@@ -40,2 +59,11 @@ payload: null; | ||
} | { | ||
type: "perseus:label-image:toggle-answers-hidden:ti"; | ||
payload: null; | ||
} | { | ||
type: "perseus:label-image:marker-interacted-with:ti"; | ||
payload: null; | ||
} | { | ||
type: "perseus:label-image:choiced-interacted-with:ti"; | ||
payload: null; | ||
} | { | ||
type: "math-input:keypad-closed"; | ||
@@ -42,0 +70,0 @@ payload: { |
@@ -229,4 +229,11 @@ /** | ||
widgets: PerseusWidgetsMap; | ||
metadata?: ReadonlyArray<string>; | ||
/** | ||
* Formerly used in the PerseusGradedGroup widget. A list of "tags" that | ||
* are keys that represent other content in the system. Not rendered to | ||
* the user. NOTE: perseus_data.go says this is required even though it | ||
* isn't necessary. | ||
* @deprecated | ||
*/ | ||
metadata?: any; | ||
/** | ||
* A dictionary of {[imageUrl]: PerseusImageDetail}. | ||
@@ -262,3 +269,3 @@ */ | ||
options: Options; | ||
key?: number; | ||
key?: number | null; | ||
version?: Version; | ||
@@ -309,3 +316,3 @@ }; | ||
left?: number; | ||
scale?: number | string; | ||
scale?: number; | ||
bottom?: number; | ||
@@ -566,3 +573,3 @@ }; | ||
directionalAxis: "x" | "y"; | ||
domain?: Interval; | ||
domain?: [min: number | null, max: number | null]; | ||
labels?: LockedLabelType[]; | ||
@@ -745,6 +752,5 @@ ariaLabel?: string; | ||
export type PerseusNumericInputAnswerForm = { | ||
simplify: PerseusNumericInputSimplify | null | undefined; | ||
simplify: "required" | "correct" | "enforced" | "optional" | null | undefined; | ||
name: MathFormat; | ||
}; | ||
export type PerseusNumericInputSimplify = "required" | "correct" | "enforced" | "optional"; | ||
export type PerseusNumericInputWidgetOptions = { | ||
@@ -758,3 +764,2 @@ answers: ReadonlyArray<PerseusNumericInputAnswer>; | ||
answerForms?: ReadonlyArray<PerseusNumericInputAnswerForm>; | ||
fullAnswerForms?: ReadonlyArray<PerseusNumericInputAnswerForm>; | ||
}; | ||
@@ -768,3 +773,3 @@ export type PerseusNumericInputAnswer = { | ||
maxError: number | null | undefined; | ||
simplify: PerseusNumericInputSimplify | null | undefined; | ||
simplify: string | null | undefined; | ||
}; | ||
@@ -771,0 +776,0 @@ export type PerseusNumberLineWidgetOptions = { |
@@ -60,3 +60,3 @@ export type { PerseusAnalyticsEvent, AnalyticsEventHandlerFn } from "./analytics"; | ||
export type { NumberLineDefaultWidgetOptions } from "./widgets/number-line"; | ||
export { default as numericInputLogic, getUniqueAnswerForms, } from "./widgets/numeric-input"; | ||
export { default as numericInputLogic } from "./widgets/numeric-input"; | ||
export type { NumericInputDefaultWidgetOptions } from "./widgets/numeric-input"; | ||
@@ -86,2 +86,3 @@ export { default as ordererLogic } from "./widgets/orderer"; | ||
export { getUpgradedWidgetOptions, upgradeWidgetInfoToLatestVersion, } from "./widgets/upgrade"; | ||
export { default as splitPerseusItem } from "./utils/split-perseus-item"; | ||
export type * from "./widgets/logic-export.types"; | ||
@@ -94,3 +95,3 @@ export * as CoreWidgetRegistry from "./widgets/core-widget-registry"; | ||
export { default as getGrapherPublicWidgetOptions } from "./widgets/grapher/grapher-util"; | ||
export { default as getInteractiveGraphPublicWidgetOptions } from "./widgets/interactive-graph/interactive-graph-util"; | ||
export { default as getInteractiveGraphPublicWidgetOptions, type InteractiveGraphPublicWidgetOptions, } from "./widgets/interactive-graph/interactive-graph-util"; | ||
export { default as getLabelImagePublicWidgetOptions } from "./widgets/label-image/label-image-util"; | ||
@@ -106,1 +107,3 @@ export { default as getSorterPublicWidgetOptions } from "./widgets/sorter/sorter-util"; | ||
export { default as getPlotterPublicWidgetOptions } from "./widgets/plotter/plotter-util"; | ||
export { default as getMatcherPublicWidgetOptions, shuffleMatcher, } from "./widgets/matcher/matcher-util"; | ||
export { shuffle, seededRNG, random } from "./utils/random-util"; |
@@ -9,1 +9,2 @@ import { ErrorTrackingParseContext } from "../error-tracking-parse-context"; | ||
export declare function summonParsedValue<P extends Parser<any>>(): ParsedValue<P>; | ||
export declare function summon<T>(): T; |
@@ -16,2 +16,9 @@ export type Result<S, F> = Success<S> | Failure<F>; | ||
export declare function assertSuccess<S, F>(result: Result<S, F>): asserts result is Success<S>; | ||
/** | ||
* @returns a function that transforms the `detail` value of any Failure result | ||
* passed to it, and leaves Success results unchanged. `mapFailure` is curried | ||
* for easy composition with Array.map(), mu-lambda's pipe(), etc. | ||
* @param f the function to apply to Failure `detail`s. | ||
*/ | ||
export declare function mapFailure<S, DetailIn, DetailOut>(f: (detail: DetailIn) => DetailOut): (result: Result<S, DetailIn>) => Result<S, DetailOut>; | ||
export declare function all<S, F>(results: Array<Result<S, F>>, combineFailureDetails?: (a: F, b: F) => F): Result<S[], F>; |
@@ -0,4 +1,6 @@ | ||
import type { PublicWidgetOptionsFunction } from "./logic-export.types"; | ||
import type { Alignment } from "../types"; | ||
export declare function isWidgetRegistered(type: string): boolean; | ||
export declare function getCurrentVersion(type: string): any; | ||
export declare const getPublicWidgetOptionsFunction: (name: string) => PublicWidgetOptionsFunction; | ||
export declare function getWidgetOptionsUpgrades(type: string): any; | ||
@@ -5,0 +7,0 @@ export declare function getDefaultWidgetOptions(type: string): any; |
import type { PerseusGroupWidgetOptions } from "../../data-schema"; | ||
import type { WidgetLogic } from "../logic-export.types"; | ||
export type GroupDefaultWidgetOptions = Pick<PerseusGroupWidgetOptions, "content" | "widgets" | "images" | "metadata">; | ||
export type GroupDefaultWidgetOptions = Pick<PerseusGroupWidgetOptions, "content" | "widgets" | "images">; | ||
declare const groupWidgetLogic: WidgetLogic; | ||
export default groupWidgetLogic; |
import type { PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core"; | ||
type InteractiveGraphPublicWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | "showProtractor" | "showRuler" | "showTooltips" | "rulerLabel" | "rulerTicks" | "range" | "graph" | "lockedFigures" | "fullGraphAriaLabel" | "fullGraphAriaDescription">; | ||
export type InteractiveGraphPublicWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | "showProtractor" | "showRuler" | "showTooltips" | "rulerLabel" | "rulerTicks" | "range" | "graph" | "lockedFigures" | "fullGraphAriaLabel" | "fullGraphAriaDescription">; | ||
export default function getInteractiveGraphPublicWidgetOptions(options: PerseusInteractiveGraphWidgetOptions): InteractiveGraphPublicWidgetOptions; | ||
export {}; |
@@ -0,1 +1,18 @@ | ||
import type getCategorizerPublicWidgetOptions from "./categorizer/categorizer-util"; | ||
import type getCSProgramPublicWidgetOptions from "./cs-program/cs-program-util"; | ||
import type getDropdownPublicWidgetOptions from "./dropdown/dropdown-util"; | ||
import type getExpressionPublicWidgetOptions from "./expression/expression-util"; | ||
import type getGrapherPublicWidgetOptions from "./grapher/grapher-util"; | ||
import type getIFramePublicWidgetOptions from "./iframe/iframe-util"; | ||
import type getInteractiveGraphPublicWidgetOptions from "./interactive-graph/interactive-graph-util"; | ||
import type getLabelImagePublicWidgetOptions from "./label-image/label-image-util"; | ||
import type getMatcherPublicWidgetOptions from "./matcher/matcher-util"; | ||
import type getMatrixPublicWidgetOptions from "./matrix/matrix-util"; | ||
import type getNumberLinePublicWidgetOptions from "./number-line/number-line-util"; | ||
import type getNumericInputPublicWidgetOptions from "./numeric-input/numeric-input-util"; | ||
import type getOrdererPublicWidgetOptions from "./orderer/orderer-util"; | ||
import type getPlotterPublicWidgetOptions from "./plotter/plotter-util"; | ||
import type getRadioPublicWidgetOptions from "./radio/radio-util"; | ||
import type getSorterPublicWidgetOptions from "./sorter/sorter-util"; | ||
import type getTablePublicWidgetOptions from "./table/table-util"; | ||
import type { Version } from "../data-schema"; | ||
@@ -6,2 +23,9 @@ import type { Alignment } from "../types"; | ||
}; | ||
/** | ||
* A union type of all the functions that provide public widget options. | ||
* | ||
* TODO(LEMS-2870): figure out how to make this generic so we don't need to be | ||
* so reliant on a set group of widgets | ||
*/ | ||
export type PublicWidgetOptionsFunction = typeof getMatcherPublicWidgetOptions | typeof getPlotterPublicWidgetOptions | typeof getIFramePublicWidgetOptions | typeof getRadioPublicWidgetOptions | typeof getNumericInputPublicWidgetOptions | typeof getDropdownPublicWidgetOptions | typeof getCategorizerPublicWidgetOptions | typeof getOrdererPublicWidgetOptions | typeof getExpressionPublicWidgetOptions | typeof getInteractiveGraphPublicWidgetOptions | typeof getLabelImagePublicWidgetOptions | typeof getSorterPublicWidgetOptions | typeof getCSProgramPublicWidgetOptions | typeof getNumberLinePublicWidgetOptions | typeof getTablePublicWidgetOptions | typeof getGrapherPublicWidgetOptions | typeof getMatrixPublicWidgetOptions; | ||
export type WidgetLogic = { | ||
@@ -14,2 +38,7 @@ name: string; | ||
defaultAlignment?: Alignment; | ||
/** | ||
* A function that provides a public version of the widget options that can | ||
* be shared with the client. | ||
*/ | ||
getPublicWidgetOptions?: PublicWidgetOptionsFunction; | ||
}; |
@@ -0,5 +1,5 @@ | ||
import type { PerseusNumericInputWidgetOptions } from "../../data-schema"; | ||
import type { WidgetLogic } from "../logic-export.types"; | ||
export type { NumericInputDefaultWidgetOptions } from "./numeric-input-upgrade"; | ||
export type NumericInputDefaultWidgetOptions = Pick<PerseusNumericInputWidgetOptions, "answers" | "size" | "coefficient" | "labelText" | "rightAlign">; | ||
declare const numericInputWidgetLogic: WidgetLogic; | ||
export { getUniqueAnswerForms } from "./util"; | ||
export default numericInputWidgetLogic; |
@@ -10,2 +10,3 @@ import type { PerseusSorterWidgetOptions } from "@khanacademy/perseus-core"; | ||
layout: PerseusSorterWidgetOptions["layout"]; | ||
isCorrectShuffled: boolean; | ||
}; | ||
@@ -12,0 +13,0 @@ /** |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.0-PR2249-20250218230904", | ||
"version": "0.0.0-PR2254-20250219234711", | ||
"publishConfig": { | ||
@@ -9,0 +9,0 @@ "access": "public" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1592356
160
13260
2
4