@khanacademy/perseus 11.6.0 → 12.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/CHANGELOG.md +35 -0
- package/dist/components/math-input.d.ts +38 -11
- package/dist/components/tex-buttons.d.ts +2 -1
- package/dist/es/index.css +5 -6
- package/dist/es/index.js +1454 -1371
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +5 -6
- package/dist/index.d.ts +2 -8
- package/dist/index.js +1475 -1390
- package/dist/index.js.map +1 -1
- package/dist/item-renderer.d.ts +3 -0
- package/dist/perseus-types.d.ts +2 -1
- package/dist/perseus-version.d.ts +8 -0
- package/dist/strings.js +3 -0
- package/dist/version.d.ts +1 -11
- package/dist/widgets/expression.d.ts +15 -14
- package/package.json +9 -9
- package/src/__tests__/mock-asset-loading-widget.tsx +1 -2
- package/src/components/__stories__/graphie.stories.tsx +2 -2
- package/src/components/__stories__/math-input.stories.tsx +17 -4
- package/src/components/__tests__/math-input.test.tsx +95 -8
- package/src/components/math-input.tsx +274 -96
- package/src/components/tex-buttons.tsx +2 -2
- package/src/index.ts +2 -5
- package/src/item-renderer.tsx +3 -0
- package/src/item-version.ts +2 -2
- package/src/perseus-types.ts +11 -1
- package/src/perseus-version.ts +9 -0
- package/src/styles/perseus-renderer.less +5 -6
- package/src/styles/widgets/expression.less +0 -6
- package/src/version.ts +9 -10
- package/src/widgets/__stories__/expression.stories.tsx +24 -13
- package/src/widgets/__tests__/expression.test.tsx +4 -77
- package/src/widgets/expression.tsx +99 -94
- package/tsconfig-build.json +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 12.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 5bcf118c: # Update MathInput
|
|
8
|
+
|
|
9
|
+
- `buttonSets` is now deprecated in favor of `keypadButtonSets`, but currently maps to the new prop for backwards compatability.
|
|
10
|
+
- `buttonsVisible` is now a bit misleading: "focused" is the default state with a toggle-able keypad and "always" shows the keypad by default.
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 5bcf118c: Desktop Expression Widget now uses v2 keypad
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [5bcf118c]
|
|
19
|
+
- @khanacademy/math-input@14.1.0
|
|
20
|
+
|
|
21
|
+
## 11.6.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 1721c05c: Fix broken Expression Mobile test
|
|
26
|
+
- 55d4cd00: Print package name and version when loaded in the page
|
|
27
|
+
- Updated dependencies [4f8afadd]
|
|
28
|
+
- Updated dependencies [7d8905b6]
|
|
29
|
+
- Updated dependencies [55d4cd00]
|
|
30
|
+
- @khanacademy/math-input@14.0.1
|
|
31
|
+
- @khanacademy/kas@0.3.2
|
|
32
|
+
- @khanacademy/kmath@0.1.3
|
|
33
|
+
- @khanacademy/perseus-core@1.1.1
|
|
34
|
+
- @khanacademy/perseus-linter@0.3.5
|
|
35
|
+
- @khanacademy/pure-markdown@0.2.7
|
|
36
|
+
- @khanacademy/simple-markdown@0.10.1
|
|
37
|
+
|
|
3
38
|
## 11.6.0
|
|
4
39
|
|
|
5
40
|
### Minor Changes
|
|
@@ -1,25 +1,55 @@
|
|
|
1
|
+
import { CursorContext } from "@khanacademy/math-input";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
3
|
+
import type { LegacyButtonSets } from "../perseus-types";
|
|
4
|
+
import type { PerseusDependenciesV2 } from "../types";
|
|
5
|
+
import type { Keys, MathFieldInterface } from "@khanacademy/math-input";
|
|
4
6
|
type ButtonsVisibleType = "always" | "never" | "focused";
|
|
7
|
+
type KeypadButtonSets = {
|
|
8
|
+
advancedRelations?: boolean;
|
|
9
|
+
basicRelations?: boolean;
|
|
10
|
+
divisionKey?: boolean;
|
|
11
|
+
logarithms?: boolean;
|
|
12
|
+
preAlgebra?: boolean;
|
|
13
|
+
trigonometry?: boolean;
|
|
14
|
+
};
|
|
5
15
|
type Props = {
|
|
6
16
|
className?: string;
|
|
7
17
|
value: string;
|
|
8
18
|
onChange: any;
|
|
9
19
|
convertDotToTimes: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `keypadButtonSets` instead. Maps to `keypadButtonSets`.
|
|
22
|
+
* @see keypadButtonSets
|
|
23
|
+
*/
|
|
24
|
+
buttonSets?: LegacyButtonSets;
|
|
25
|
+
/**
|
|
26
|
+
* Overrides deprecated `buttonSets` prop.
|
|
27
|
+
*/
|
|
28
|
+
keypadButtonSets?: KeypadButtonSets;
|
|
12
29
|
labelText?: string;
|
|
13
30
|
onFocus?: () => void;
|
|
14
31
|
onBlur?: () => void;
|
|
32
|
+
hasError?: boolean;
|
|
33
|
+
extraKeys?: ReadonlyArray<Keys>;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to show the keypad buttons.
|
|
36
|
+
* The strings now misleading, but we keep them for backwards compatibility.
|
|
37
|
+
* - `focused` means that the keypad **appears on toggle, *off* by default**.
|
|
38
|
+
* - `always` means that the keypad **appears on toggle, *on* by default.**
|
|
39
|
+
* - `never` means that the keypad is **never shown**.
|
|
40
|
+
*/
|
|
41
|
+
buttonsVisible?: ButtonsVisibleType;
|
|
42
|
+
analytics: PerseusDependenciesV2["analytics"];
|
|
15
43
|
};
|
|
16
44
|
type DefaultProps = {
|
|
17
45
|
value: Props["value"];
|
|
18
46
|
convertDotToTimes: Props["convertDotToTimes"];
|
|
19
|
-
buttonsVisible: Props["buttonsVisible"];
|
|
20
47
|
};
|
|
21
48
|
type State = {
|
|
22
49
|
focused: boolean;
|
|
50
|
+
keypadOpen: boolean;
|
|
51
|
+
cursorContext: typeof CursorContext[keyof typeof CursorContext];
|
|
52
|
+
openedWithEventType?: string;
|
|
23
53
|
};
|
|
24
54
|
declare class MathInput extends React.Component<Props, State> {
|
|
25
55
|
mouseDown: boolean;
|
|
@@ -28,16 +58,13 @@ declare class MathInput extends React.Component<Props, State> {
|
|
|
28
58
|
static defaultProps: DefaultProps;
|
|
29
59
|
state: State;
|
|
30
60
|
componentDidMount(): void;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
handleMouseDown: (arg1: MouseEvent) => void;
|
|
34
|
-
handleMouseUp: (arg1: MouseEvent) => void;
|
|
35
|
-
handleBlur: (arg1: React.FocusEvent) => void;
|
|
36
|
-
_shouldShowButtons: () => boolean;
|
|
61
|
+
openKeypad(): void;
|
|
62
|
+
closeKeypad(): void;
|
|
37
63
|
insert: (value: any) => void;
|
|
38
64
|
mathField: () => MathFieldInterface | null;
|
|
39
65
|
focus: () => void;
|
|
40
66
|
blur: () => void;
|
|
67
|
+
handleKeypadPress: (key: Keys, e: any) => void;
|
|
41
68
|
render(): React.ReactNode;
|
|
42
69
|
}
|
|
43
70
|
export default MathInput;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LegacyButtonSets } from "../perseus-types";
|
|
2
3
|
import type { Keys } from "@khanacademy/math-input";
|
|
3
4
|
type ButtonSet = (props: any) => [
|
|
4
5
|
React.ReactNode,
|
|
@@ -6,7 +7,7 @@ type ButtonSet = (props: any) => [
|
|
|
6
7
|
string
|
|
7
8
|
];
|
|
8
9
|
type ButtonSets = {
|
|
9
|
-
readonly [key
|
|
10
|
+
readonly [key in LegacyButtonSets[number]]: ReadonlyArray<ButtonSet>;
|
|
10
11
|
};
|
|
11
12
|
declare const buttonSets: ButtonSets;
|
|
12
13
|
export type ButtonSetsType = ReadonlyArray<keyof typeof buttonSets>;
|
package/dist/es/index.css
CHANGED
|
@@ -2666,9 +2666,6 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
|
|
|
2666
2666
|
padding: 5px;
|
|
2667
2667
|
width: 210px;
|
|
2668
2668
|
}
|
|
2669
|
-
.perseus-widget-expression.show-error-tooltip .perseus-math-input.mq-editable-field.mq-math-mode > .mq-root-block {
|
|
2670
|
-
padding-right: 25px;
|
|
2671
|
-
}
|
|
2672
2669
|
.perseus-widget-expression .perseus-formats-tooltip {
|
|
2673
2670
|
width: 190px;
|
|
2674
2671
|
}
|
|
@@ -3562,11 +3559,13 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
|
|
|
3562
3559
|
list-style-type: none;
|
|
3563
3560
|
}
|
|
3564
3561
|
.perseus-math-input.mq-editable-field.mq-math-mode {
|
|
3565
|
-
background:
|
|
3562
|
+
background-color: transparent;
|
|
3566
3563
|
font-size: 18px;
|
|
3567
3564
|
min-width: 100px;
|
|
3568
|
-
border
|
|
3569
|
-
|
|
3565
|
+
border: unset;
|
|
3566
|
+
}
|
|
3567
|
+
.perseus-math-input.mq-editable-field.mq-math-mode.mq-focused {
|
|
3568
|
+
box-shadow: unset;
|
|
3570
3569
|
}
|
|
3571
3570
|
.perseus-math-input.mq-editable-field.mq-math-mode > .mq-root-block {
|
|
3572
3571
|
padding: 4px;
|