@khanacademy/perseus 25.0.0 → 25.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.
- package/dist/es/index.js +36 -5
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +33 -2
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +2 -0
- package/dist/perseus-types.d.ts +10 -0
- package/dist/server-item-renderer.d.ts +2 -0
- package/dist/types.d.ts +3 -0
- package/dist/widgets/expression.d.ts +12 -0
- package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +3 -2
- package/dist/widgets/label-image.d.ts +4 -0
- package/package.json +1 -1
package/dist/perseus-api.d.ts
CHANGED
|
@@ -106,6 +106,8 @@ export declare const ApiOptions: {
|
|
|
106
106
|
} & {
|
|
107
107
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
108
108
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
109
|
+
} & {
|
|
110
|
+
"start-coords-ui"?: boolean | undefined;
|
|
109
111
|
}) | undefined;
|
|
110
112
|
} | undefined;
|
|
111
113
|
onWidgetStartProps?: ((widgets: import("./perseus-types").PerseusWidgetsMap) => void) | undefined;
|
package/dist/perseus-types.d.ts
CHANGED
|
@@ -417,24 +417,29 @@ export type PerseusGraphTypeAngle = {
|
|
|
417
417
|
snapDegrees?: number;
|
|
418
418
|
match?: "congruent";
|
|
419
419
|
coords?: [Coord, Coord, Coord];
|
|
420
|
+
startCoords?: [Coord, Coord, Coord];
|
|
420
421
|
};
|
|
421
422
|
export type PerseusGraphTypeCircle = {
|
|
422
423
|
type: "circle";
|
|
423
424
|
center?: Coord;
|
|
424
425
|
radius?: number;
|
|
426
|
+
startCoords?: Coord;
|
|
425
427
|
} & PerseusGraphTypeCommon;
|
|
426
428
|
export type PerseusGraphTypeLinear = {
|
|
427
429
|
type: "linear";
|
|
428
430
|
coords?: CollinearTuple;
|
|
431
|
+
startCoords?: CollinearTuple;
|
|
429
432
|
} & PerseusGraphTypeCommon;
|
|
430
433
|
export type PerseusGraphTypeLinearSystem = {
|
|
431
434
|
type: "linear-system";
|
|
432
435
|
coords?: CollinearTuple[];
|
|
436
|
+
startCoords?: CollinearTuple[];
|
|
433
437
|
} & PerseusGraphTypeCommon;
|
|
434
438
|
export type PerseusGraphTypePoint = {
|
|
435
439
|
type: "point";
|
|
436
440
|
numPoints?: number | "unlimited";
|
|
437
441
|
coords?: ReadonlyArray<Coord>;
|
|
442
|
+
startCoords?: ReadonlyArray<Coord>;
|
|
438
443
|
} & PerseusGraphTypeCommon;
|
|
439
444
|
export type PerseusGraphTypePolygon = {
|
|
440
445
|
type: "polygon";
|
|
@@ -444,23 +449,28 @@ export type PerseusGraphTypePolygon = {
|
|
|
444
449
|
snapTo?: "grid" | "angles" | "sides";
|
|
445
450
|
match?: "similar" | "congruent" | "approx";
|
|
446
451
|
coords?: ReadonlyArray<Coord>;
|
|
452
|
+
startCoords?: ReadonlyArray<Coord>;
|
|
447
453
|
} & PerseusGraphTypeCommon;
|
|
448
454
|
export type PerseusGraphTypeQuadratic = {
|
|
449
455
|
type: "quadratic";
|
|
450
456
|
coords?: [Coord, Coord, Coord];
|
|
457
|
+
startCoords?: [Coord, Coord, Coord];
|
|
451
458
|
} & PerseusGraphTypeCommon;
|
|
452
459
|
export type PerseusGraphTypeSegment = {
|
|
453
460
|
type: "segment";
|
|
454
461
|
numSegments?: number;
|
|
455
462
|
coords?: CollinearTuple[];
|
|
463
|
+
startCoords?: CollinearTuple[];
|
|
456
464
|
} & PerseusGraphTypeCommon;
|
|
457
465
|
export type PerseusGraphTypeSinusoid = {
|
|
458
466
|
type: "sinusoid";
|
|
459
467
|
coords?: ReadonlyArray<Coord>;
|
|
468
|
+
startCoords?: ReadonlyArray<Coord>;
|
|
460
469
|
} & PerseusGraphTypeCommon;
|
|
461
470
|
export type PerseusGraphTypeRay = {
|
|
462
471
|
type: "ray";
|
|
463
472
|
coords?: CollinearTuple;
|
|
473
|
+
startCoords?: CollinearTuple;
|
|
464
474
|
} & PerseusGraphTypeCommon;
|
|
465
475
|
export type PerseusLabelImageWidgetOptions = {
|
|
466
476
|
choices: ReadonlyArray<string>;
|
|
@@ -153,6 +153,8 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<OwnProps & HOCProps
|
|
|
153
153
|
} & {
|
|
154
154
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
155
155
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
156
|
+
} & {
|
|
157
|
+
"start-coords-ui"?: boolean | undefined;
|
|
156
158
|
}) | undefined;
|
|
157
159
|
} | undefined;
|
|
158
160
|
onWidgetStartProps?: ((widgets: import("./perseus-types").PerseusWidgetsMap) => void) | undefined;
|
package/dist/types.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ type TrackInteractionArgs = {
|
|
|
79
79
|
} & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
|
|
80
80
|
export declare const MafsGraphTypeFlags: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "circle", "quadratic", "sinusoid", "point"];
|
|
81
81
|
export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-m2", "interactive-graph-locked-features-m2b"];
|
|
82
|
+
export declare const InteractiveGraphEditorFlags: readonly ["start-coords-ui"];
|
|
82
83
|
/**
|
|
83
84
|
* APIOptions provides different ways to customize the behaviour of Perseus.
|
|
84
85
|
*
|
|
@@ -206,6 +207,8 @@ export type APIOptions = Readonly<{
|
|
|
206
207
|
[Key in (typeof MafsGraphTypeFlags)[number]]?: boolean;
|
|
207
208
|
} & {
|
|
208
209
|
[Key in (typeof InteractiveGraphLockedFeaturesFlags)[number]]?: boolean;
|
|
210
|
+
} & {
|
|
211
|
+
[Key in (typeof InteractiveGraphEditorFlags)[number]]?: boolean;
|
|
209
212
|
});
|
|
210
213
|
};
|
|
211
214
|
/**
|
|
@@ -147,6 +147,8 @@ declare const _default: Readonly<{
|
|
|
147
147
|
} & {
|
|
148
148
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
149
149
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
150
|
+
} & {
|
|
151
|
+
"start-coords-ui"?: boolean | undefined;
|
|
150
152
|
}) | undefined;
|
|
151
153
|
} | undefined;
|
|
152
154
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -226,6 +228,8 @@ declare const _default: Readonly<{
|
|
|
226
228
|
} & {
|
|
227
229
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
228
230
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
231
|
+
} & {
|
|
232
|
+
"start-coords-ui"?: boolean | undefined;
|
|
229
233
|
}) | undefined;
|
|
230
234
|
} | undefined;
|
|
231
235
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -305,6 +309,8 @@ declare const _default: Readonly<{
|
|
|
305
309
|
} & {
|
|
306
310
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
307
311
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
312
|
+
} & {
|
|
313
|
+
"start-coords-ui"?: boolean | undefined;
|
|
308
314
|
}) | undefined;
|
|
309
315
|
} | undefined;
|
|
310
316
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -381,6 +387,8 @@ declare const _default: Readonly<{
|
|
|
381
387
|
} & {
|
|
382
388
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
383
389
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
390
|
+
} & {
|
|
391
|
+
"start-coords-ui"?: boolean | undefined;
|
|
384
392
|
}) | undefined;
|
|
385
393
|
} | undefined;
|
|
386
394
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -460,6 +468,8 @@ declare const _default: Readonly<{
|
|
|
460
468
|
} & {
|
|
461
469
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
462
470
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
471
|
+
} & {
|
|
472
|
+
"start-coords-ui"?: boolean | undefined;
|
|
463
473
|
}) | undefined;
|
|
464
474
|
} | undefined;
|
|
465
475
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -539,6 +549,8 @@ declare const _default: Readonly<{
|
|
|
539
549
|
} & {
|
|
540
550
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
541
551
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
552
|
+
} & {
|
|
553
|
+
"start-coords-ui"?: boolean | undefined;
|
|
542
554
|
}) | undefined;
|
|
543
555
|
} | undefined;
|
|
544
556
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PerseusGraphType } from "../../../perseus-types";
|
|
2
|
-
import type { InteractiveGraphState } from "../types";
|
|
1
|
+
import type { PerseusGraphType, PerseusGraphTypeLinear, PerseusGraphTypeRay } from "../../../perseus-types";
|
|
2
|
+
import type { InteractiveGraphState, PairOfPoints } from "../types";
|
|
3
3
|
import type { Interval } from "mafs";
|
|
4
4
|
export type InitializeGraphStateParams = {
|
|
5
5
|
range: [x: Interval, y: Interval];
|
|
@@ -8,3 +8,4 @@ export type InitializeGraphStateParams = {
|
|
|
8
8
|
graph: PerseusGraphType;
|
|
9
9
|
};
|
|
10
10
|
export declare function initializeGraphState(params: InitializeGraphStateParams): InteractiveGraphState;
|
|
11
|
+
export declare function getLineCoords(graph: PerseusGraphTypeRay | PerseusGraphTypeLinear, range: [x: Interval, y: Interval], step: [x: number, y: number]): PairOfPoints;
|
|
@@ -141,6 +141,8 @@ declare const _default: Readonly<{
|
|
|
141
141
|
} & {
|
|
142
142
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
143
143
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
144
|
+
} & {
|
|
145
|
+
"start-coords-ui"?: boolean | undefined;
|
|
144
146
|
}) | undefined;
|
|
145
147
|
} | undefined;
|
|
146
148
|
onWidgetStartProps?: ((widgets: import("..").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -204,6 +206,8 @@ declare const _default: Readonly<{
|
|
|
204
206
|
} & {
|
|
205
207
|
"interactive-graph-locked-features-m2"?: boolean | undefined;
|
|
206
208
|
"interactive-graph-locked-features-m2b"?: boolean | undefined;
|
|
209
|
+
} & {
|
|
210
|
+
"start-coords-ui"?: boolean | undefined;
|
|
207
211
|
}) | undefined;
|
|
208
212
|
} | undefined;
|
|
209
213
|
onWidgetStartProps?: ((widgets: import("..").PerseusWidgetsMap) => void) | undefined;
|