@khanacademy/perseus-core
Advanced tools
Comparing version 0.0.0-PR2202-20250210201250 to 0.0.0-PR2202-20250219231926
@@ -1,2 +0,2 @@ | ||
export type VirtualKeypadVersion = "MATH_INPUT_KEYPAD_V2" | "REACT_NATIVE_KEYPAD"; | ||
type VirtualKeypadVersion = "MATH_INPUT_KEYPAD_V2" | "REACT_NATIVE_KEYPAD"; | ||
/** | ||
@@ -18,6 +18,18 @@ * A type union of all the events that any package in the Perseus ecosystem can | ||
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"; | ||
@@ -53,1 +81,2 @@ payload: { | ||
export type AnalyticsEventHandlerFn = (event: PerseusAnalyticsEvent) => Promise<void>; | ||
export {}; |
@@ -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[]; | ||
@@ -569,0 +576,0 @@ ariaLabel?: string; |
@@ -13,3 +13,3 @@ export type { PerseusAnalyticsEvent, AnalyticsEventHandlerFn } from "./analytics"; | ||
export * as GrapherUtil from "./utils/grapher-util"; | ||
export { parsePerseusItem, parseAndMigratePerseusItem, parseAndMigratePerseusArticle, } from "./parse-perseus-json"; | ||
export { parsePerseusItem, parseAndMigratePerseusItem, parseAndMigratePerseusArticle, type ParseFailureDetail, } from "./parse-perseus-json"; | ||
export { isSuccess, isFailure, type Result, type Success, type Failure, } from "./parse-perseus-json/result"; | ||
@@ -86,2 +86,3 @@ export { libVersion } from "./version"; | ||
export { getUpgradedWidgetOptions, upgradeWidgetInfoToLatestVersion, } from "./widgets/upgrade"; | ||
export { default as splitPerseusItem } from "./utils/split-perseus-item"; | ||
export type * from "./widgets/logic-export.types"; | ||
@@ -105,1 +106,3 @@ export * as CoreWidgetRegistry from "./widgets/core-widget-registry"; | ||
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"; |
@@ -17,2 +17,1 @@ export * from "./any"; | ||
export * from "./union"; | ||
export * from "./unknown"; |
@@ -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; |
@@ -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; | ||
}; |
@@ -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-PR2202-20250210201250", | ||
"version": "0.0.0-PR2202-20250219231926", | ||
"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
1153477
161
9651