New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@khanacademy/perseus-core

Package Overview
Dependencies
Maintainers
0
Versions
515
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khanacademy/perseus-core - npm Package Compare versions

Comparing version 0.0.0-PR2082-20250110234415 to 0.0.0-PR2083-20250121185624

dist/utils/objective_.d.ts

81

dist/data-schema.d.ts

@@ -37,2 +37,45 @@ /**

/**
* A utility type that constructs a widget map from a "registry interface".
* The keys of the registry should be the widget type (aka, "categorizer" or
* "radio", etc) and the value should be the option type stored in the value
* of the map.
*
* You can think of this as a type that generates another type. We use
* "registry interfaces" as a way to keep a set of widget types to their data
* type in several places in Perseus. This type then allows us to generate a
* map type that maps a widget id to its data type and keep strong typing by
* widget id.
*
* For example, given a fictitious registry such as this:
*
* ```
* interface DummyRegistry {
* categorizer: { categories: ReadonlyArray<string> };
* dropdown: { choices: ReadonlyArray<string> }:
* }
* ```
*
* If we create a DummyMap using this helper:
*
* ```
* type DummyMap = MakeWidgetMap<DummyRegistry>;
* ```
*
* We'll get a map that looks like this:
*
* ```
* type DummyMap = {
* `categorizer ${number}`: { categories: ReadonlyArray<string> };
* `dropdown ${number}`: { choices: ReadonlyArray<string> };
* }
* ```
*
* We use interfaces for the registries so that they can be extended in cases
* where the consuming app brings along their own widgets. Interfaces in
* TypeScript are always open (ie. you can extend them) whereas types aren't.
*/
export type MakeWidgetMap<TRegistry> = {
[Property in keyof TRegistry as `${Property & string} ${number}`]: TRegistry[Property];
};
/**
* Our core set of Perseus widgets.

@@ -58,3 +101,3 @@ *

* ```typescript
* declare module "@khanacademy/perseus" {
* declare module "@khanacademy/perseus-core" {
* interface PerseusWidgetTypes {

@@ -132,6 +175,15 @@ * // A new widget

*/
export type PerseusWidgetsMap = {
[Property in keyof PerseusWidgetTypes as `${Property} ${number}`]: PerseusWidgetTypes[Property];
};
export type PerseusWidgetsMap = MakeWidgetMap<PerseusWidgetTypes>;
/**
* PerseusWidget is a union of all the different types of widget options that
* Perseus knows about.
*
* Thanks to it being based on PerseusWidgetTypes interface, this union is
* automatically extended to include widgets used in tests without those widget
* option types seeping into our production types.
*
* @see MockWidget for an example
*/
export type PerseusWidget = PerseusWidgetTypes[keyof PerseusWidgetTypes];
/**
* A "PerseusItem" is a classic Perseus item. It is rendered by the

@@ -249,3 +301,2 @@ * `ServerItemRenderer` and the layout is pre-set.

export type DeprecatedStandinWidget = WidgetOptions<'deprecated-standin', object>;
export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget | MatcherWidget | MatrixWidget | MeasurerWidget | MoleculeRendererWidget | NumberLineWidget | NumericInputWidget | OrdererWidget | PassageRefWidget | PassageWidget | PhetSimulationWidget | PlotterWidget | PythonProgramWidget | RadioWidget | RefTargetWidget | SorterWidget | TableWidget | VideoWidget | DeprecatedStandinWidget;
/**

@@ -263,2 +314,10 @@ * A background image applied to various widgets.

};
/**
* The type of markings to display on the graph.
* - axes: shows the axes without the gride lines
* - graph: shows the axes and the grid lines
* - grid: shows only the grid lines
* - none: shows no markings
*/
export type MarkingsType = "axes" | "graph" | "grid" | "none";
export type PerseusCategorizerWidgetOptions = {

@@ -378,3 +437,3 @@ items: ReadonlyArray<string>;

labels: [string, string];
markings: "graph" | "none" | "grid";
markings: MarkingsType;
range: GraphRange;

@@ -414,7 +473,4 @@ rulerLabel: "";

* The type of markings to display on the graph.
* - graph: shows the axes and the grid lines
* - grid: shows only the grid lines
* - none: shows no markings
*/
markings: "graph" | "grid" | "none";
markings: MarkingsType;
labels?: ReadonlyArray<string>;

@@ -807,7 +863,4 @@ showProtractor: boolean;

* The type of markings to display on the graph.
* - graph: shows the axes and the grid lines
* - grid: shows only the grid lines
* - none: shows no markings
*/
markings: "graph" | "grid" | "none";
markings: MarkingsType;
snapStep?: [number, number];

@@ -814,0 +867,0 @@ valid?: boolean | string;

@@ -9,1 +9,2 @@ export type { PerseusAnalyticsEvent, AnalyticsEventHandlerFn } from "./analytics";

export * from "./data-schema";
export { pluck, mapObject } from "./utils/objective_";

2

package.json

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "0.0.0-PR2082-20250110234415",
"version": "0.0.0-PR2083-20250121185624",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc