@khanacademy/perseus 93.1.0 → 94.0.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/article-renderer.d.ts +0 -1
- package/dist/components/drag-and-drop/answer-tile/answer-tile.d.ts +3 -2
- package/dist/components/lint.d.ts +1 -6
- package/dist/components/number-input.d.ts +1 -0
- package/dist/hint-renderer.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1938 -1633
- package/dist/index.js.map +1 -1
- package/dist/interactive2/wrapped-ellipse.d.ts +3 -2
- package/dist/renderer.d.ts +8 -2
- package/dist/translation-linter.d.ts +1 -2
- package/dist/util.d.ts +13 -5
- package/dist/widgets/blank/blank-context.d.ts +11 -0
- package/dist/widgets/fill-in-the-blank/fill-in-the-blank.d.ts +4 -2
- package/dist/widgets/fill-in-the-blank/tile-bank.d.ts +23 -0
- package/dist/widgets/fill-in-the-blank/use-fitb-tiles.d.ts +24 -0
- package/dist/widgets/sorter/legend/legend-bar/legend-bar.d.ts +10 -0
- package/dist/widgets/sorter/legend/legend-label/legend-label.d.ts +9 -0
- package/package.json +24 -24
|
@@ -8,8 +8,9 @@ declare class WrappedEllipse extends WrappedDrawing {
|
|
|
8
8
|
visibleShape: VisibleShape;
|
|
9
9
|
constructor(graphie: any, center: Coord, radii: [number, number], options: any);
|
|
10
10
|
/**
|
|
11
|
-
* Turns the ellipse's drop shadow on or off.
|
|
11
|
+
* Turns the ellipse's drop shadow on or off. Static ellipses get a gray
|
|
12
|
+
* shadow to match their disabled color.
|
|
12
13
|
*/
|
|
13
|
-
setShadow(shadow: boolean): void;
|
|
14
|
+
setShadow(shadow: boolean, isStatic?: boolean): void;
|
|
14
15
|
}
|
|
15
16
|
export default WrappedEllipse;
|
package/dist/renderer.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ type WidgetState = {
|
|
|
21
21
|
paragraphIndex?: number;
|
|
22
22
|
foundFullWidth?: boolean;
|
|
23
23
|
baseElements?: any;
|
|
24
|
+
unwrapTitledTableContents?: boolean;
|
|
24
25
|
};
|
|
25
26
|
type Props = Partial<React.ContextType<typeof DependenciesContext>> & {
|
|
26
27
|
content: PerseusRenderer["content"];
|
|
@@ -52,7 +53,6 @@ type Props = Partial<React.ContextType<typeof DependenciesContext>> & {
|
|
|
52
53
|
* the linter and any warnings will be highlighted in the rendered output.
|
|
53
54
|
*/
|
|
54
55
|
linterContext: LinterContextProps;
|
|
55
|
-
legacyPerseusLint?: ReadonlyArray<string>;
|
|
56
56
|
/**
|
|
57
57
|
* Skip adding paragraph class
|
|
58
58
|
*/
|
|
@@ -163,7 +163,13 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
|
|
|
163
163
|
replaceJiptContent(content: string, paragraphIndex?: number): void;
|
|
164
164
|
outputMarkdown: (ast: ASTNode, state: WidgetState) => React.ReactNode;
|
|
165
165
|
outputNested: (ast: ASTNode, state: WidgetState) => React.ReactNode;
|
|
166
|
-
outputNode: (node: SingleASTNode, nestedOutput: (ast:
|
|
166
|
+
outputNode: (node: SingleASTNode, nestedOutput: (ast: ASTNode, state: WidgetState) => React.ReactNode, state: WidgetState) => React.ReactNode;
|
|
167
|
+
/**
|
|
168
|
+
* Renders a markdown table nodes.
|
|
169
|
+
*/
|
|
170
|
+
outputTableElement: (node: SingleASTNode, nestedOutput: (ast: ASTNode, state: WidgetState) => React.ReactNode, state: WidgetState) => React.ReactElement;
|
|
171
|
+
outputTable: (node: SingleASTNode, nestedOutput: (ast: ASTNode, state: WidgetState) => React.ReactNode, state: WidgetState) => React.ReactElement;
|
|
172
|
+
outputTitledTable: (node: SingleASTNode, nestedOutput: (ast: ASTNode, state: WidgetState) => React.ReactNode, state: WidgetState) => React.ReactNode;
|
|
167
173
|
handleRender: (prevProps: Props) => void;
|
|
168
174
|
_setCurrentFocus: (path: FocusPath) => void;
|
|
169
175
|
focus: () => boolean | null | undefined;
|
|
@@ -14,8 +14,7 @@ export default class TranslationLinter {
|
|
|
14
14
|
runLinter: any;
|
|
15
15
|
/**
|
|
16
16
|
* Applies an array of errors generated by linters without position
|
|
17
|
-
* information (TranslationLinter
|
|
18
|
-
* top of a Perseus tree.
|
|
17
|
+
* information (TranslationLinter) to the top of a Perseus tree.
|
|
19
18
|
*/
|
|
20
19
|
applyLintErrors(parsedMarkdown: any, translationLintErrors: ReadonlyArray<string>): void;
|
|
21
20
|
}
|
package/dist/util.d.ts
CHANGED
|
@@ -36,13 +36,21 @@ type TouchHandlers = {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function inputPathsEqual(a?: ReadonlyArray<string> | null, b?: ReadonlyArray<string> | null): boolean;
|
|
38
38
|
export declare const isContentGraphie: (node: SingleASTNode) => boolean;
|
|
39
|
+
type TableCell = Array<SingleASTNode>;
|
|
40
|
+
export declare function isEmptyTableCell(cell: TableCell): boolean;
|
|
41
|
+
export declare function isBoldTableCell(cell: TableCell): boolean;
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
43
|
+
* Markdown has no syntax for row headers, so we infer them from two common
|
|
44
|
+
* authoring patterns:
|
|
45
|
+
*
|
|
46
|
+
* 1. The first column header is empty.
|
|
47
|
+
* Or
|
|
48
|
+
* 2. Every body cell in the first column is bold.
|
|
49
|
+
*
|
|
50
|
+
* Tables with a single column are never treated as having row headers, as
|
|
51
|
+
* there would be no data cells for the headers to describe.
|
|
44
52
|
*/
|
|
45
|
-
export declare
|
|
53
|
+
export declare function tableHasRowHeaders(node: SingleASTNode): boolean;
|
|
46
54
|
/**
|
|
47
55
|
* Combines adjacent text nodes in an ASTNode array into a single text node.
|
|
48
56
|
* Does not recurse.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type BlankContextValue = {
|
|
3
|
+
/** The tile placed in a blank, or null when it is empty. */
|
|
4
|
+
renderPlacedTile: (blankId: string) => React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Connects a parent widget to the blank widgets in its content. The
|
|
8
|
+
* Renderer renders those widgets, so the parent cannot pass them props.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BlankContext: React.Context<BlankContextValue | null>;
|
|
11
|
+
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { WidgetProps, Widget } from "../../types";
|
|
3
|
-
import type { PerseusFillInTheBlankWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
-
type FillInTheBlankProps = WidgetProps<PerseusFillInTheBlankWidgetOptions>;
|
|
3
|
+
import type { PerseusFillInTheBlankUserInput, PerseusFillInTheBlankWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
+
type FillInTheBlankProps = WidgetProps<PerseusFillInTheBlankWidgetOptions, PerseusFillInTheBlankUserInput>;
|
|
5
|
+
declare function getStartUserInput(): PerseusFillInTheBlankUserInput;
|
|
5
6
|
declare const _default: {
|
|
6
7
|
name: string;
|
|
7
8
|
displayName: string;
|
|
8
9
|
widget: React.ForwardRefExoticComponent<FillInTheBlankProps & React.RefAttributes<Widget>>;
|
|
9
10
|
isLintable: false;
|
|
10
11
|
hidden: true;
|
|
12
|
+
getStartUserInput: typeof getStartUserInput;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TilePlacements, TileUsage } from "../../components/drag-and-drop/tile-placements";
|
|
3
|
+
import type { useTileMoveActions } from "../../components/drag-and-drop/use-tile-move-actions";
|
|
4
|
+
import type { PerseusFillInTheBlankWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
+
type TileMoveActions = ReturnType<typeof useTileMoveActions>;
|
|
6
|
+
type TileBankProps = {
|
|
7
|
+
tiles: PerseusFillInTheBlankWidgetOptions["tiles"];
|
|
8
|
+
placements: TilePlacements;
|
|
9
|
+
tileUsage: TileUsage;
|
|
10
|
+
/** Max placements per tile; undefined means unlimited. */
|
|
11
|
+
maxUses: number | undefined;
|
|
12
|
+
blankIds: ReadonlyArray<string>;
|
|
13
|
+
blankLabels: Record<string, string>;
|
|
14
|
+
onMove: TileMoveActions["handleMove"];
|
|
15
|
+
/** Attached to the first bank tile's menu so focus can return to it. */
|
|
16
|
+
firstMenuRef: TileMoveActions["firstBankMenuRef"];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Renders the choice bank: the tiles that haven't been placed in a blank
|
|
20
|
+
* yet, or can be placed again (multi-use).
|
|
21
|
+
*/
|
|
22
|
+
export declare function TileBank({ tiles, placements, tileUsage, maxUses, blankIds, blankLabels, onMove, firstMenuRef, }: TileBankProps): React.ReactElement;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TilePlacements } from "../../components/drag-and-drop/tile-placements";
|
|
2
|
+
import type { PerseusFillInTheBlankUserInput, PerseusFillInTheBlankWidgetOptions } from "@khanacademy/perseus-core";
|
|
3
|
+
type Tile = PerseusFillInTheBlankWidgetOptions["tiles"][number];
|
|
4
|
+
type Args = {
|
|
5
|
+
content: PerseusFillInTheBlankWidgetOptions["content"];
|
|
6
|
+
widgets: PerseusFillInTheBlankWidgetOptions["widgets"];
|
|
7
|
+
tiles: PerseusFillInTheBlankWidgetOptions["tiles"];
|
|
8
|
+
userInput: PerseusFillInTheBlankUserInput;
|
|
9
|
+
};
|
|
10
|
+
type Result = {
|
|
11
|
+
/** The unique blank widget ids, in the order they appear in content. */
|
|
12
|
+
blankIds: ReadonlyArray<string>;
|
|
13
|
+
/** Accessible label for each blank, keyed by blank id. */
|
|
14
|
+
blankLabels: Record<string, string>;
|
|
15
|
+
tilesById: ReadonlyMap<string, Tile>;
|
|
16
|
+
/** Which tile is in each filled blank, keyed by blank id. */
|
|
17
|
+
placements: TilePlacements;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Derives the blanks, tile lookup and current placements that Fill in the
|
|
21
|
+
* Blank renders from its options and user input.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useFITBTiles({ content, widgets, tiles, userInput, }: Args): Result;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SorterLegendCap } from "@khanacademy/perseus-core";
|
|
3
|
+
type LegendBarOrientation = "horizontal" | "vertical";
|
|
4
|
+
export interface LegendBarProps {
|
|
5
|
+
orientation: LegendBarOrientation;
|
|
6
|
+
startCap?: SorterLegendCap;
|
|
7
|
+
endCap?: SorterLegendCap;
|
|
8
|
+
}
|
|
9
|
+
export declare function LegendBar({ orientation, startCap, endCap, }: LegendBarProps): React.ReactElement;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface LegendLabelProps {
|
|
3
|
+
/** Label Content */
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* One visible label at the start or end of the Sorter legend.
|
|
8
|
+
*/
|
|
9
|
+
export declare function LegendLabel({ content }: LegendLabelProps): React.ReactElement;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Core Perseus API (includes renderers and widgets)",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "94.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"@dnd-kit/dom": "^0.5.0",
|
|
29
29
|
"@dnd-kit/react": "^0.5.0",
|
|
30
30
|
"@khanacademy/kas": "3.1.1",
|
|
31
|
-
"@khanacademy/keypad-context": "6.0.
|
|
32
|
-
"@khanacademy/kmath": "3.1.
|
|
33
|
-
"@khanacademy/math-input": "30.2.
|
|
34
|
-
"@khanacademy/perseus-core": "42.
|
|
35
|
-
"@khanacademy/perseus-linter": "8.0
|
|
36
|
-
"@khanacademy/perseus-score": "9.0.
|
|
31
|
+
"@khanacademy/keypad-context": "6.0.14",
|
|
32
|
+
"@khanacademy/kmath": "3.1.7",
|
|
33
|
+
"@khanacademy/math-input": "30.2.4",
|
|
34
|
+
"@khanacademy/perseus-core": "42.4.0",
|
|
35
|
+
"@khanacademy/perseus-linter": "8.1.0",
|
|
36
|
+
"@khanacademy/perseus-score": "9.0.15",
|
|
37
37
|
"@khanacademy/perseus-utils": "3.0.2",
|
|
38
38
|
"@khanacademy/pure-markdown": "4.0.0",
|
|
39
39
|
"@khanacademy/simple-markdown": "4.0.3",
|
|
@@ -48,25 +48,25 @@
|
|
|
48
48
|
"@internal/build-settings": "0.9.2",
|
|
49
49
|
"@khanacademy/mathjax-renderer": "3.2.0",
|
|
50
50
|
"@khanacademy/wonder-blocks-announcer": "1.1.2",
|
|
51
|
-
"@khanacademy/wonder-blocks-banner": "5.2.
|
|
51
|
+
"@khanacademy/wonder-blocks-banner": "5.2.2",
|
|
52
52
|
"@khanacademy/wonder-blocks-button": "11.7.13",
|
|
53
53
|
"@khanacademy/wonder-blocks-clickable": "8.3.2",
|
|
54
54
|
"@khanacademy/wonder-blocks-core": "12.5.0",
|
|
55
55
|
"@khanacademy/wonder-blocks-data": "15.1.0",
|
|
56
|
-
"@khanacademy/wonder-blocks-dropdown": "
|
|
57
|
-
"@khanacademy/wonder-blocks-form": "7.7.
|
|
56
|
+
"@khanacademy/wonder-blocks-dropdown": "11.0.0",
|
|
57
|
+
"@khanacademy/wonder-blocks-form": "7.7.6",
|
|
58
58
|
"@khanacademy/wonder-blocks-icon": "6.0.3",
|
|
59
59
|
"@khanacademy/wonder-blocks-icon-button": "12.0.2",
|
|
60
|
-
"@khanacademy/wonder-blocks-labeled-field": "4.3.
|
|
60
|
+
"@khanacademy/wonder-blocks-labeled-field": "4.3.6",
|
|
61
61
|
"@khanacademy/wonder-blocks-layout": "3.2.1",
|
|
62
|
-
"@khanacademy/wonder-blocks-link": "10.5.
|
|
63
|
-
"@khanacademy/wonder-blocks-modal": "8.10.
|
|
64
|
-
"@khanacademy/wonder-blocks-popover": "7.1.
|
|
62
|
+
"@khanacademy/wonder-blocks-link": "10.5.3",
|
|
63
|
+
"@khanacademy/wonder-blocks-modal": "8.10.3",
|
|
64
|
+
"@khanacademy/wonder-blocks-popover": "7.1.3",
|
|
65
65
|
"@khanacademy/wonder-blocks-progress-spinner": "3.2.0",
|
|
66
66
|
"@khanacademy/wonder-blocks-switch": "3.4.15",
|
|
67
67
|
"@khanacademy/wonder-blocks-timing": "7.1.0",
|
|
68
68
|
"@khanacademy/wonder-blocks-tokens": "18.1.0",
|
|
69
|
-
"@khanacademy/wonder-blocks-tooltip": "4.2.
|
|
69
|
+
"@khanacademy/wonder-blocks-tooltip": "4.2.14",
|
|
70
70
|
"@khanacademy/wonder-blocks-typography": "5.0.6",
|
|
71
71
|
"@khanacademy/wonder-stuff-core": "3.0.0",
|
|
72
72
|
"@phosphor-icons/core": "2.0.2",
|
|
@@ -84,25 +84,25 @@
|
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@khanacademy/mathjax-renderer": "^3.2.0",
|
|
86
86
|
"@khanacademy/wonder-blocks-announcer": "^1.1.2",
|
|
87
|
-
"@khanacademy/wonder-blocks-banner": "^5.2.
|
|
87
|
+
"@khanacademy/wonder-blocks-banner": "^5.2.2",
|
|
88
88
|
"@khanacademy/wonder-blocks-button": "^11.7.13",
|
|
89
89
|
"@khanacademy/wonder-blocks-clickable": "^8.3.2",
|
|
90
90
|
"@khanacademy/wonder-blocks-core": "^12.5.0",
|
|
91
91
|
"@khanacademy/wonder-blocks-data": "^15.1.0",
|
|
92
|
-
"@khanacademy/wonder-blocks-dropdown": "^
|
|
93
|
-
"@khanacademy/wonder-blocks-form": "^7.7.
|
|
92
|
+
"@khanacademy/wonder-blocks-dropdown": "^11.0.0",
|
|
93
|
+
"@khanacademy/wonder-blocks-form": "^7.7.6",
|
|
94
94
|
"@khanacademy/wonder-blocks-icon": "^6.0.3",
|
|
95
95
|
"@khanacademy/wonder-blocks-icon-button": "^12.0.2",
|
|
96
|
-
"@khanacademy/wonder-blocks-labeled-field": "^4.3.
|
|
96
|
+
"@khanacademy/wonder-blocks-labeled-field": "^4.3.6",
|
|
97
97
|
"@khanacademy/wonder-blocks-layout": "^3.2.1",
|
|
98
|
-
"@khanacademy/wonder-blocks-link": "^10.5.
|
|
99
|
-
"@khanacademy/wonder-blocks-modal": "^8.10.
|
|
100
|
-
"@khanacademy/wonder-blocks-popover": "^7.1.
|
|
98
|
+
"@khanacademy/wonder-blocks-link": "^10.5.3",
|
|
99
|
+
"@khanacademy/wonder-blocks-modal": "^8.10.3",
|
|
100
|
+
"@khanacademy/wonder-blocks-popover": "^7.1.3",
|
|
101
101
|
"@khanacademy/wonder-blocks-progress-spinner": "^3.2.0",
|
|
102
102
|
"@khanacademy/wonder-blocks-switch": "^3.4.15",
|
|
103
103
|
"@khanacademy/wonder-blocks-timing": "^7.1.0",
|
|
104
104
|
"@khanacademy/wonder-blocks-tokens": "^18.1.0",
|
|
105
|
-
"@khanacademy/wonder-blocks-tooltip": "^4.2.
|
|
105
|
+
"@khanacademy/wonder-blocks-tooltip": "^4.2.14",
|
|
106
106
|
"@khanacademy/wonder-blocks-typography": "^5.0.6",
|
|
107
107
|
"@khanacademy/wonder-stuff-core": "^3.0.0",
|
|
108
108
|
"@phosphor-icons/core": "^2.0.2",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
},
|
|
118
118
|
"keywords": [],
|
|
119
119
|
"khan": {
|
|
120
|
-
"catalogHash": "
|
|
120
|
+
"catalogHash": "7aaf5fd9f24a04a9"
|
|
121
121
|
},
|
|
122
122
|
"scripts": {}
|
|
123
123
|
}
|