@khanacademy/perseus 5.0.0 → 6.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/CHANGELOG.md +62 -0
- package/dist/components/fixed-to-responsive.d.ts +27 -1
- package/dist/components/fixed-to-responsive.js.flow +27 -1
- package/dist/components/graph.d.ts +42 -26
- package/dist/components/graph.js.flow +42 -28
- package/dist/components/graphie.d.ts +34 -22
- package/dist/components/graphie.js.flow +37 -24
- package/dist/components/hud.d.ts +8 -14
- package/dist/components/hud.js.flow +7 -14
- package/dist/components/inline-icon.d.ts +9 -19
- package/dist/components/inline-icon.js.flow +26 -13
- package/dist/components/lint.d.ts +41 -13
- package/dist/components/lint.js.flow +42 -13
- package/dist/components/math-output.d.ts +15 -11
- package/dist/components/math-output.js.flow +15 -11
- package/dist/components/sortable.d.ts +17 -9
- package/dist/components/sortable.js.flow +22 -9
- package/dist/components/svg-image.d.ts +5 -3
- package/dist/components/svg-image.js.flow +5 -3
- package/dist/components/tooltip.d.ts +45 -4
- package/dist/components/tooltip.js.flow +44 -31
- package/dist/es/index.css +0 -3
- package/dist/es/index.js +478 -649
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +0 -3
- package/dist/index.js +482 -646
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +11 -9
- package/dist/perseus-types.js.flow +11 -9
- package/dist/renderer.d.ts +2 -2
- package/dist/renderer.js.flow +1 -3
- package/dist/styles/shared.d.ts +0 -1
- package/dist/styles/shared.js.flow +0 -1
- package/dist/types.d.ts +0 -10
- package/dist/types.js.flow +0 -13
- package/dist/util/a11y.d.ts +0 -1
- package/dist/util/a11y.js.flow +0 -1
- package/dist/util/interactive.d.ts +2 -0
- package/dist/util/interactive.js.flow +2 -0
- package/dist/util.d.ts +3 -3
- package/dist/util.js.flow +4 -3
- package/dist/widgets/grapher.d.ts +1 -1
- package/dist/widgets/grapher.js.flow +12 -3
- package/dist/widgets/matcher.d.ts +7 -3
- package/dist/widgets/matcher.js.flow +7 -3
- package/dist/widgets/number-line.d.ts +1 -1
- package/dist/widgets/number-line.js.flow +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/item-renderer.test.tsx.snap +151 -159
- package/src/__tests__/__snapshots__/renderer.test.tsx.snap +358 -394
- package/src/__tests__/__snapshots__/server-item-renderer.test.tsx.snap +169 -189
- package/src/components/__stories__/lint.stories.tsx +56 -21
- package/src/components/__stories__/sortable.stories.tsx +5 -5
- package/src/components/__stories__/tooltip.stories.tsx +52 -0
- package/src/components/__tests__/__snapshots__/sortable.test.tsx.snap +114 -30
- package/src/components/__tests__/__snapshots__/sorter.test.tsx.snap +172 -204
- package/src/components/__tests__/sortable.test.tsx +54 -16
- package/src/components/__tests__/sorter.test.tsx +12 -9
- package/src/components/fixed-to-responsive.tsx +43 -38
- package/src/components/graph.tsx +95 -81
- package/src/components/graphie.tsx +62 -32
- package/src/components/hud.tsx +104 -115
- package/src/components/inline-icon.tsx +15 -32
- package/src/components/input-with-examples.tsx +4 -4
- package/src/components/lint.tsx +47 -41
- package/src/components/math-output.tsx +17 -11
- package/src/components/simple-keypad-input.tsx +2 -2
- package/src/components/sortable.tsx +134 -94
- package/src/components/svg-image.tsx +10 -11
- package/src/components/tooltip.tsx +189 -171
- package/src/interactive2/types.ts +2 -2
- package/src/mixins/provide-keypad.tsx +2 -2
- package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +708 -764
- package/src/perseus-types.ts +13 -9
- package/src/renderer.tsx +11 -22
- package/src/types.ts +0 -18
- package/src/util/interactive.ts +18 -5
- package/src/util/tex.ts +13 -77
- package/src/util.ts +3 -4
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +2 -2
- package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +717 -773
- package/src/widgets/__tests__/__snapshots__/cs-program.test.ts.snap +28 -36
- package/src/widgets/__tests__/__snapshots__/definition.test.ts.snap +52 -60
- package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +100 -108
- package/src/widgets/__tests__/__snapshots__/explanation.test.ts.snap +212 -260
- package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +613 -641
- package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +249 -261
- package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +671 -735
- package/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap +2676 -2684
- package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +938 -1002
- package/src/widgets/__tests__/__snapshots__/iframe.test.ts.snap +28 -36
- package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +227 -255
- package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +353 -357
- package/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap +255 -259
- package/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap +2401 -2433
- package/src/widgets/__tests__/__snapshots__/matcher.test.tsx.snap +600 -756
- package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +420 -428
- package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +762 -770
- package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +373 -393
- package/src/widgets/__tests__/__snapshots__/orderer.test.ts.snap +116 -148
- package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +289 -301
- package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +1679 -1711
- package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +2692 -2960
- package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +90 -98
- package/src/widgets/__tests__/matcher.test.tsx +33 -9
- package/src/widgets/expression.tsx +9 -6
- package/src/widgets/grapher.tsx +3 -3
- package/src/widgets/image.tsx +2 -2
- package/src/widgets/interactive-graph.tsx +5 -5
- package/src/widgets/matcher.tsx +43 -24
- package/src/widgets/number-line.tsx +1 -1
- package/src/widgets/simulator.tsx +4 -6
- package/{tsconfig.json → tsconfig-build.json} +6 -6
- package/tsconfig-build.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 6.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e86cc72f: Keypad API: Button sets on keypad switched to optional booleans. Added all designed button sets as props, but not all are yet implemented.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ec37eb3d: Export v2 keypad, rename v1 keypad to ProvidedKeypad
|
|
12
|
+
- Updated dependencies [46417c53]
|
|
13
|
+
- Updated dependencies [97438065]
|
|
14
|
+
- Updated dependencies [85d9132a]
|
|
15
|
+
- Updated dependencies [42297993]
|
|
16
|
+
- Updated dependencies [1ffbe3ef]
|
|
17
|
+
- Updated dependencies [e86cc72f]
|
|
18
|
+
- Updated dependencies [ec37eb3d]
|
|
19
|
+
- Updated dependencies [c0a15907]
|
|
20
|
+
- Updated dependencies [d9759ea6]
|
|
21
|
+
- @khanacademy/math-input@3.0.0
|
|
22
|
+
|
|
23
|
+
## 6.0.0
|
|
24
|
+
|
|
25
|
+
### Major Changes
|
|
26
|
+
|
|
27
|
+
- 4a368030: Remove getKaTeX from the PerseusDependencies type
|
|
28
|
+
|
|
29
|
+
perseus-editor now detects KaTeX rendering errors by calling KaTeX directly,
|
|
30
|
+
rather than using getKaTeX from PerseusDependencies.
|
|
31
|
+
|
|
32
|
+
The logKaTeXError method, which was unused by Perseus, has been removed from
|
|
33
|
+
the PerseusDependencies type as well.
|
|
34
|
+
|
|
35
|
+
Clients should update their code by removing the getKaTeX and logKaTeXError
|
|
36
|
+
properties from their PerseusDependencies object. If they want to log an error
|
|
37
|
+
when TeX fails to render, they should do so in their TeX component.
|
|
38
|
+
|
|
39
|
+
- 9c4a6c96: Remove obsolete properties from the PerseusDependencies type
|
|
40
|
+
|
|
41
|
+
We are in the process of migrating the webapp and mobile repos to use
|
|
42
|
+
MathJax 3 as their math renderer instead of KaTeX. This change removes some of
|
|
43
|
+
Perseus's dependencies on KaTeX.
|
|
44
|
+
|
|
45
|
+
Clients should update their code by removing the `getRenderA11yString`,
|
|
46
|
+
`loadMathjax`, `KatexProvider`, and `shouldUseFutureKaTeX` properties from
|
|
47
|
+
their PerseusDependencies object.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- 5cc23179: Upgraded <Lint> component to use TypeScript types for props
|
|
52
|
+
- e0a087d0: Upgraded <InlineIcon> component to use TypeScript types for props
|
|
53
|
+
- b062ad47: Upgraded <MathOutput> component to use TypeScript types for props
|
|
54
|
+
- 8a47076d: Upgraded <Tooltip> component to use TypeScript types for props
|
|
55
|
+
- 09ab3260: Upgraded HUD component to use TypeScript types for props
|
|
56
|
+
- 5432857d: Upgraded <Sortable> component (not widget) to use TypeScript types for props
|
|
57
|
+
- 40c2736d: Upgraded Graphie component to use TypeScript types for props
|
|
58
|
+
- b585fe29: Switch most @khanacademy/math-input psuedo-enums to enums
|
|
59
|
+
- 91617cfa: Upgraded FixedToResponsive component to use TypeScript types for props
|
|
60
|
+
- e284e7c1: Upgraded Graph component to use TypeScript types for props
|
|
61
|
+
- Updated dependencies [b585fe29]
|
|
62
|
+
- Updated dependencies [0c1cf562]
|
|
63
|
+
- @khanacademy/math-input@2.0.0
|
|
64
|
+
|
|
3
65
|
## 5.0.0
|
|
4
66
|
|
|
5
67
|
### Major Changes
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
constrainHeight?: boolean;
|
|
8
|
+
allowFullBleed?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type DefaultProps = {
|
|
11
|
+
className: Props["className"];
|
|
12
|
+
constrainHeight: Props["constrainHeight"];
|
|
13
|
+
allowFullBleed: Props["allowFullBleed"];
|
|
14
|
+
};
|
|
15
|
+
type State = {
|
|
16
|
+
viewportHeight: number | null;
|
|
17
|
+
viewportWidth: number | null;
|
|
18
|
+
};
|
|
19
|
+
declare class FixedToResponsive extends React.Component<Props, State> {
|
|
20
|
+
_isMounted: boolean;
|
|
21
|
+
static defaultProps: DefaultProps;
|
|
22
|
+
state: State;
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentWillUnmount(): void;
|
|
25
|
+
_cacheViewportSize: () => void;
|
|
26
|
+
render(): JSX.Element;
|
|
27
|
+
}
|
|
2
28
|
export default FixedToResponsive;
|
|
@@ -4,5 +4,31 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
declare type Props = {|
|
|
9
|
+
width: number,
|
|
10
|
+
height: number,
|
|
11
|
+
children: React.Node,
|
|
12
|
+
className?: string,
|
|
13
|
+
constrainHeight?: boolean,
|
|
14
|
+
allowFullBleed?: boolean,
|
|
15
|
+
|};
|
|
16
|
+
declare type DefaultProps = {|
|
|
17
|
+
className: $PropertyType<Props, "className">,
|
|
18
|
+
constrainHeight: $PropertyType<Props, "constrainHeight">,
|
|
19
|
+
allowFullBleed: $PropertyType<Props, "allowFullBleed">,
|
|
20
|
+
|};
|
|
21
|
+
declare type State = {|
|
|
22
|
+
viewportHeight: number | null,
|
|
23
|
+
viewportWidth: number | null,
|
|
24
|
+
|};
|
|
25
|
+
declare class FixedToResponsive extends React.Component<Props, State> {
|
|
26
|
+
_isMounted: boolean;
|
|
27
|
+
static defaultProps: DefaultProps;
|
|
28
|
+
state: State;
|
|
29
|
+
componentDidMount(): void;
|
|
30
|
+
componentWillUnmount(): void;
|
|
31
|
+
_cacheViewportSize: () => void;
|
|
32
|
+
render(): React$Node;
|
|
33
|
+
}
|
|
8
34
|
declare export default typeof FixedToResponsive;
|
|
@@ -1,37 +1,52 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
|
|
2
|
+
import { Coord } from "../interactive2/types";
|
|
3
|
+
import { PerseusImageBackground } from "../perseus-types";
|
|
4
|
+
type Props = {
|
|
5
|
+
box: Readonly<[number, number]>;
|
|
6
|
+
labels: ReadonlyArray<string>;
|
|
7
|
+
range: Readonly<[Coord, Coord]>;
|
|
8
|
+
step: Readonly<[number, number]>;
|
|
9
|
+
gridStep: Readonly<[number, number]>;
|
|
10
|
+
snapStep: Readonly<[number, number]>;
|
|
11
|
+
markings: string;
|
|
12
|
+
backgroundImage: PerseusImageBackground;
|
|
13
|
+
showProtractor: boolean;
|
|
14
|
+
showRuler: boolean;
|
|
15
|
+
rulerLabel: string;
|
|
16
|
+
rulerTicks: number;
|
|
17
|
+
instructions?: string;
|
|
18
|
+
isMobile: boolean;
|
|
19
|
+
onGraphieUpdated?: (graphie: any) => void;
|
|
20
|
+
onClick?: (Coord: any) => void;
|
|
21
|
+
onMouseDown?: (Coord: any) => void;
|
|
22
|
+
onMouseUp?: (Coord: any) => void;
|
|
23
|
+
onMouseMove?: (Coord: any) => void;
|
|
24
|
+
setDrawingAreaAvailable?: (boolean: any) => void;
|
|
25
|
+
};
|
|
26
|
+
type DefaultProps = {
|
|
27
|
+
labels: Props["labels"];
|
|
28
|
+
range: Props["range"];
|
|
29
|
+
step: Props["step"];
|
|
30
|
+
gridStep: Props["gridStep"];
|
|
31
|
+
snapStep: Props["snapStep"];
|
|
32
|
+
markings: Props["markings"];
|
|
33
|
+
backgroundImage: Props["backgroundImage"];
|
|
34
|
+
showProtractor: Props["showProtractor"];
|
|
35
|
+
showRuler: Props["showRuler"];
|
|
36
|
+
rulerLabel: Props["rulerLabel"];
|
|
37
|
+
rulerTicks: Props["rulerTicks"];
|
|
38
|
+
isMobile: Props["isMobile"];
|
|
39
|
+
};
|
|
40
|
+
declare class Graph extends React.Component<Props> {
|
|
4
41
|
protractor: any;
|
|
5
42
|
ruler: any;
|
|
6
43
|
_graphie: any;
|
|
7
44
|
_hasSetupGraphieThisUpdate: boolean;
|
|
8
45
|
_shouldSetupGraphie: boolean;
|
|
9
|
-
static
|
|
10
|
-
box: PropTypes.Validator<any[]>;
|
|
11
|
-
labels: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
12
|
-
range: PropTypes.Requireable<((number | null | undefined)[] | null | undefined)[]>;
|
|
13
|
-
step: PropTypes.Requireable<(number | null | undefined)[]>;
|
|
14
|
-
gridStep: PropTypes.Requireable<(number | null | undefined)[]>;
|
|
15
|
-
snapStep: PropTypes.Requireable<(number | null | undefined)[]>;
|
|
16
|
-
markings: PropTypes.Requireable<string>;
|
|
17
|
-
backgroundImage: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
|
-
url: PropTypes.Requireable<string>;
|
|
19
|
-
}>>;
|
|
20
|
-
showProtractor: PropTypes.Requireable<boolean>;
|
|
21
|
-
showRuler: PropTypes.Requireable<boolean>;
|
|
22
|
-
rulerLabel: PropTypes.Requireable<string>;
|
|
23
|
-
rulerTicks: PropTypes.Requireable<number>;
|
|
24
|
-
onGraphieUpdated: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
-
instructions: PropTypes.Requireable<string>;
|
|
26
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
isMobile: PropTypes.Requireable<boolean>;
|
|
29
|
-
};
|
|
30
|
-
static defaultProps: any;
|
|
31
|
-
render(): React.ReactNode;
|
|
46
|
+
static defaultProps: DefaultProps;
|
|
32
47
|
componentDidMount(): void;
|
|
33
|
-
componentDidUpdate(): void;
|
|
34
48
|
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
49
|
+
componentDidUpdate(): void;
|
|
35
50
|
reset: () => void;
|
|
36
51
|
graphie: () => any;
|
|
37
52
|
pointsFromNormalized: (arg1: any, arg2: any) => any;
|
|
@@ -40,5 +55,6 @@ declare class Graph extends React.Component<any> {
|
|
|
40
55
|
_updateProtractor: () => void;
|
|
41
56
|
_updateRuler: () => void;
|
|
42
57
|
toJSON: () => any;
|
|
58
|
+
render(): React.ReactNode;
|
|
43
59
|
}
|
|
44
60
|
export default Graph;
|
|
@@ -4,42 +4,55 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from "prop-types";
|
|
8
7
|
import * as React from "react";
|
|
9
|
-
|
|
8
|
+
import { Coord } from "../interactive2/types";
|
|
9
|
+
import { PerseusImageBackground } from "../perseus-types";
|
|
10
|
+
declare type Props = {|
|
|
11
|
+
box: $ReadOnly<[number, number]>,
|
|
12
|
+
labels: $ReadOnlyArray<string>,
|
|
13
|
+
range: $ReadOnly<[Coord, Coord]>,
|
|
14
|
+
step: $ReadOnly<[number, number]>,
|
|
15
|
+
gridStep: $ReadOnly<[number, number]>,
|
|
16
|
+
snapStep: $ReadOnly<[number, number]>,
|
|
17
|
+
markings: string,
|
|
18
|
+
backgroundImage: PerseusImageBackground,
|
|
19
|
+
showProtractor: boolean,
|
|
20
|
+
showRuler: boolean,
|
|
21
|
+
rulerLabel: string,
|
|
22
|
+
rulerTicks: number,
|
|
23
|
+
instructions?: string,
|
|
24
|
+
isMobile: boolean,
|
|
25
|
+
onGraphieUpdated?: (graphie: any) => void,
|
|
26
|
+
onClick?: (Coord: any) => void,
|
|
27
|
+
onMouseDown?: (Coord: any) => void,
|
|
28
|
+
onMouseUp?: (Coord: any) => void,
|
|
29
|
+
onMouseMove?: (Coord: any) => void,
|
|
30
|
+
setDrawingAreaAvailable?: (boolean: any) => void,
|
|
31
|
+
|};
|
|
32
|
+
declare type DefaultProps = {|
|
|
33
|
+
labels: $PropertyType<Props, "labels">,
|
|
34
|
+
range: $PropertyType<Props, "range">,
|
|
35
|
+
step: $PropertyType<Props, "step">,
|
|
36
|
+
gridStep: $PropertyType<Props, "gridStep">,
|
|
37
|
+
snapStep: $PropertyType<Props, "snapStep">,
|
|
38
|
+
markings: $PropertyType<Props, "markings">,
|
|
39
|
+
backgroundImage: $PropertyType<Props, "backgroundImage">,
|
|
40
|
+
showProtractor: $PropertyType<Props, "showProtractor">,
|
|
41
|
+
showRuler: $PropertyType<Props, "showRuler">,
|
|
42
|
+
rulerLabel: $PropertyType<Props, "rulerLabel">,
|
|
43
|
+
rulerTicks: $PropertyType<Props, "rulerTicks">,
|
|
44
|
+
isMobile: $PropertyType<Props, "isMobile">,
|
|
45
|
+
|};
|
|
46
|
+
declare class Graph extends React.Component<Props> {
|
|
10
47
|
protractor: any;
|
|
11
48
|
ruler: any;
|
|
12
49
|
_graphie: any;
|
|
13
50
|
_hasSetupGraphieThisUpdate: boolean;
|
|
14
51
|
_shouldSetupGraphie: boolean;
|
|
15
|
-
static
|
|
16
|
-
box: PropTypes.Validator<any[]>,
|
|
17
|
-
labels: PropTypes.Requireable<(string | null | void)[]>,
|
|
18
|
-
range: PropTypes.Requireable<((number | null | void)[] | null | void)[]>,
|
|
19
|
-
step: PropTypes.Requireable<(number | null | void)[]>,
|
|
20
|
-
gridStep: PropTypes.Requireable<(number | null | void)[]>,
|
|
21
|
-
snapStep: PropTypes.Requireable<(number | null | void)[]>,
|
|
22
|
-
markings: PropTypes.Requireable<string>,
|
|
23
|
-
backgroundImage: PropTypes.Requireable<
|
|
24
|
-
PropTypes.InferProps<{|
|
|
25
|
-
url: PropTypes.Requireable<string>,
|
|
26
|
-
|}>
|
|
27
|
-
>,
|
|
28
|
-
showProtractor: PropTypes.Requireable<boolean>,
|
|
29
|
-
showRuler: PropTypes.Requireable<boolean>,
|
|
30
|
-
rulerLabel: PropTypes.Requireable<string>,
|
|
31
|
-
rulerTicks: PropTypes.Requireable<number>,
|
|
32
|
-
onGraphieUpdated: PropTypes.Requireable<(...args: any[]) => any>,
|
|
33
|
-
instructions: PropTypes.Requireable<string>,
|
|
34
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>,
|
|
35
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>,
|
|
36
|
-
isMobile: PropTypes.Requireable<boolean>,
|
|
37
|
-
|};
|
|
38
|
-
static defaultProps: any;
|
|
39
|
-
render(): React.Node;
|
|
52
|
+
static defaultProps: DefaultProps;
|
|
40
53
|
componentDidMount(): void;
|
|
41
|
-
componentDidUpdate(): void;
|
|
42
54
|
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
55
|
+
componentDidUpdate(): void;
|
|
43
56
|
reset: () => void;
|
|
44
57
|
graphie: () => any;
|
|
45
58
|
pointsFromNormalized: (arg1: any, arg2: any) => any;
|
|
@@ -48,5 +61,6 @@ declare class Graph extends React.Component<any> {
|
|
|
48
61
|
_updateProtractor: () => void;
|
|
49
62
|
_updateRuler: () => void;
|
|
50
63
|
toJSON: () => any;
|
|
64
|
+
render(): React.Node;
|
|
51
65
|
}
|
|
52
66
|
declare export default typeof Graph;
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { Coord } from "../interactive2/types";
|
|
3
|
+
import type { Range, Size } from "../perseus-types";
|
|
4
|
+
type Props = {
|
|
5
|
+
addMouseLayer?: boolean;
|
|
6
|
+
box: Size;
|
|
7
|
+
range: [Coord, Coord];
|
|
8
|
+
ranges?: [Range, Range];
|
|
9
|
+
gridStep?: [number, number];
|
|
10
|
+
step?: [number, number];
|
|
11
|
+
scale?: [number, number];
|
|
12
|
+
isMobile?: boolean;
|
|
13
|
+
responsive?: boolean;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
options: any;
|
|
16
|
+
setDrawingAreaAvailable?: (boolean: any) => void;
|
|
17
|
+
setup: (graphie: any, options: {
|
|
18
|
+
range: [Coord, Coord];
|
|
19
|
+
scale: [number, number];
|
|
20
|
+
}) => void;
|
|
21
|
+
onClick?: (at: Coord) => void;
|
|
22
|
+
onMouseDown?: (at: Coord) => void;
|
|
23
|
+
onMouseMove?: (at: Coord) => void;
|
|
24
|
+
onMouseUp?: (at: Coord) => void;
|
|
25
|
+
};
|
|
26
|
+
type DefaultProps = {
|
|
27
|
+
range: Props["range"];
|
|
28
|
+
options: Props["options"];
|
|
29
|
+
responsive: Props["responsive"];
|
|
30
|
+
addMouseLayer: Props["addMouseLayer"];
|
|
31
|
+
};
|
|
4
32
|
declare class Graphie extends React.Component<Props> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
box: PropTypes.Validator<(number | null | undefined)[]>;
|
|
8
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
9
|
-
isMobile: PropTypes.Requireable<boolean>;
|
|
10
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
-
onMouseMove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
-
onMouseUp: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
-
options: PropTypes.Requireable<PropTypes.InferProps<{
|
|
15
|
-
snapStep: PropTypes.Requireable<(number | null | undefined)[]>;
|
|
16
|
-
}>>;
|
|
17
|
-
range: PropTypes.Requireable<((number | null | undefined)[] | null | undefined)[]>;
|
|
18
|
-
responsive: PropTypes.Requireable<boolean>;
|
|
19
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
setup: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
};
|
|
22
|
-
static defaultProps: any;
|
|
33
|
+
graphieDivRef: React.RefObject<HTMLDivElement>;
|
|
34
|
+
static defaultProps: DefaultProps;
|
|
23
35
|
componentDidMount(): void;
|
|
24
36
|
shouldComponentUpdate(nextProps: Props): boolean;
|
|
25
37
|
componentDidUpdate(prevProps: Props): void;
|
|
@@ -32,8 +44,8 @@ declare class Graphie extends React.Component<Props> {
|
|
|
32
44
|
* Use it for good and not evil.
|
|
33
45
|
*/
|
|
34
46
|
getGraphie: () => any;
|
|
35
|
-
_range: () =>
|
|
36
|
-
_box: () =>
|
|
47
|
+
_range: () => [Coord, Coord];
|
|
48
|
+
_box: () => Size;
|
|
37
49
|
_scale: () => ReadonlyArray<number>;
|
|
38
50
|
_setupGraphie: () => void;
|
|
39
51
|
_removeMovables: () => void;
|
|
@@ -4,30 +4,43 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from "prop-types";
|
|
8
7
|
import * as React from "react";
|
|
9
|
-
|
|
8
|
+
import type { Coord } from "../interactive2/types";
|
|
9
|
+
import type { Range, Size } from "../perseus-types";
|
|
10
|
+
declare type Props = {|
|
|
11
|
+
addMouseLayer?: boolean,
|
|
12
|
+
box: Size,
|
|
13
|
+
range: [Coord, Coord],
|
|
14
|
+
ranges?: [Range, Range],
|
|
15
|
+
gridStep?: [number, number],
|
|
16
|
+
step?: [number, number],
|
|
17
|
+
scale?: [number, number],
|
|
18
|
+
isMobile?: boolean,
|
|
19
|
+
responsive?: boolean,
|
|
20
|
+
children?: React.Node,
|
|
21
|
+
options: any,
|
|
22
|
+
setDrawingAreaAvailable?: (boolean: any) => void,
|
|
23
|
+
setup: (
|
|
24
|
+
graphie: any,
|
|
25
|
+
options: {|
|
|
26
|
+
range: [Coord, Coord],
|
|
27
|
+
scale: [number, number],
|
|
28
|
+
|}
|
|
29
|
+
) => void,
|
|
30
|
+
onClick?: (at: Coord) => void,
|
|
31
|
+
onMouseDown?: (at: Coord) => void,
|
|
32
|
+
onMouseMove?: (at: Coord) => void,
|
|
33
|
+
onMouseUp?: (at: Coord) => void,
|
|
34
|
+
|};
|
|
35
|
+
declare type DefaultProps = {|
|
|
36
|
+
range: $PropertyType<Props, "range">,
|
|
37
|
+
options: $PropertyType<Props, "options">,
|
|
38
|
+
responsive: $PropertyType<Props, "responsive">,
|
|
39
|
+
addMouseLayer: $PropertyType<Props, "addMouseLayer">,
|
|
40
|
+
|};
|
|
10
41
|
declare class Graphie extends React.Component<Props> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
box: PropTypes.Validator<(number | null | void)[]>,
|
|
14
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>,
|
|
15
|
-
isMobile: PropTypes.Requireable<boolean>,
|
|
16
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>,
|
|
17
|
-
onMouseDown: PropTypes.Requireable<(...args: any[]) => any>,
|
|
18
|
-
onMouseMove: PropTypes.Requireable<(...args: any[]) => any>,
|
|
19
|
-
onMouseUp: PropTypes.Requireable<(...args: any[]) => any>,
|
|
20
|
-
options: PropTypes.Requireable<
|
|
21
|
-
PropTypes.InferProps<{|
|
|
22
|
-
snapStep: PropTypes.Requireable<(number | null | void)[]>,
|
|
23
|
-
|}>
|
|
24
|
-
>,
|
|
25
|
-
range: PropTypes.Requireable<((number | null | void)[] | null | void)[]>,
|
|
26
|
-
responsive: PropTypes.Requireable<boolean>,
|
|
27
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>,
|
|
28
|
-
setup: PropTypes.Validator<(...args: any[]) => any>,
|
|
29
|
-
|};
|
|
30
|
-
static defaultProps: any;
|
|
42
|
+
graphieDivRef: React.RefObject<HTMLDivElement>;
|
|
43
|
+
static defaultProps: DefaultProps;
|
|
31
44
|
componentDidMount(): void;
|
|
32
45
|
shouldComponentUpdate(nextProps: Props): boolean;
|
|
33
46
|
componentDidUpdate(prevProps: Props): void;
|
|
@@ -41,8 +54,8 @@ declare class Graphie extends React.Component<Props> {
|
|
|
41
54
|
* Use it for good and not evil.
|
|
42
55
|
*/
|
|
43
56
|
getGraphie: () => any;
|
|
44
|
-
_range: () =>
|
|
45
|
-
_box: () =>
|
|
57
|
+
_range: () => [Coord, Coord];
|
|
58
|
+
_box: () => Size;
|
|
46
59
|
_scale: () => $ReadOnlyArray<number>;
|
|
47
60
|
_setupGraphie: () => void;
|
|
48
61
|
_removeMovables: () => void;
|
package/dist/components/hud.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
static defaultProps: any;
|
|
11
|
-
renderVisibleIcon: () => React.ReactElement;
|
|
12
|
-
renderHiddenIcon: () => React.ReactElement;
|
|
13
|
-
render(): React.ReactNode;
|
|
14
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
message: string;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
fixedPosition?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const HUD: ({ message, enabled, onClick, fixedPosition }: Props) => JSX.Element;
|
|
15
9
|
export default HUD;
|
|
@@ -4,18 +4,11 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
fixedPosition: PropTypes.Requireable<boolean>,
|
|
15
|
-
|};
|
|
16
|
-
static defaultProps: any;
|
|
17
|
-
renderVisibleIcon: () => React.Element<any>;
|
|
18
|
-
renderHiddenIcon: () => React.Element<any>;
|
|
19
|
-
render(): React.Node;
|
|
20
|
-
}
|
|
7
|
+
declare type Props = {|
|
|
8
|
+
message: string,
|
|
9
|
+
enabled: boolean,
|
|
10
|
+
onClick: () => void,
|
|
11
|
+
fixedPosition?: boolean,
|
|
12
|
+
|};
|
|
13
|
+
declare var HUD: (x: Props) => React$Node;
|
|
21
14
|
declare export default typeof HUD;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type InlineIconProps = {
|
|
3
|
+
path: string;
|
|
4
|
+
height: number;
|
|
5
|
+
width: number;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
title?: string;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* A stripped version of Icon.jsx from webapp. Takes an SVG icon and renders it
|
|
3
11
|
* inline like Font Awesome did.
|
|
@@ -22,23 +30,5 @@
|
|
|
22
30
|
* <InlineIcon {...editIcon} />
|
|
23
31
|
*
|
|
24
32
|
*/
|
|
25
|
-
|
|
26
|
-
import * as React from "react";
|
|
27
|
-
declare const InlineIcon: {
|
|
28
|
-
({ path, width, height, style, title, }: InlineIconProps): React.ReactElement;
|
|
29
|
-
propTypes: {
|
|
30
|
-
path: PropTypes.Validator<string>;
|
|
31
|
-
height: PropTypes.Validator<number>;
|
|
32
|
-
width: PropTypes.Validator<number>;
|
|
33
|
-
style: PropTypes.Requireable<object>;
|
|
34
|
-
title: PropTypes.Requireable<string>;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export type InlineIconProps = {
|
|
38
|
-
path: string;
|
|
39
|
-
height: number;
|
|
40
|
-
width: number;
|
|
41
|
-
style?: any;
|
|
42
|
-
title?: string;
|
|
43
|
-
};
|
|
33
|
+
declare const InlineIcon: ({ path, width, height, style, title, }: InlineIconProps) => React.ReactElement;
|
|
44
34
|
export default InlineIcon;
|
|
@@ -4,23 +4,36 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from "prop-types";
|
|
8
7
|
import * as React from "react";
|
|
9
|
-
declare
|
|
10
|
-
(x: InlineIconProps): React.Element<any>,
|
|
11
|
-
propTypes: {|
|
|
12
|
-
path: PropTypes.Validator<string>,
|
|
13
|
-
height: PropTypes.Validator<number>,
|
|
14
|
-
width: PropTypes.Validator<number>,
|
|
15
|
-
style: PropTypes.Requireable<{ ... }>,
|
|
16
|
-
title: PropTypes.Requireable<string>,
|
|
17
|
-
|},
|
|
18
|
-
|};
|
|
19
|
-
export type InlineIconProps = {|
|
|
8
|
+
declare type InlineIconProps = {|
|
|
20
9
|
path: string,
|
|
21
10
|
height: number,
|
|
22
11
|
width: number,
|
|
23
|
-
style?:
|
|
12
|
+
style?: React.CSSProperties,
|
|
24
13
|
title?: string,
|
|
25
14
|
|};
|
|
15
|
+
/**
|
|
16
|
+
* A stripped version of Icon.jsx from webapp. Takes an SVG icon and renders it
|
|
17
|
+
* inline like Font Awesome did.
|
|
18
|
+
*
|
|
19
|
+
* If you are looking for an icon that we've used before you should look in
|
|
20
|
+
* webapp's `icon-paths.js` which is a reference file for all the SVG paths
|
|
21
|
+
* that we've used. You'll need to copy the object from that file into
|
|
22
|
+
* whichever file you're using the icon and explicitly pass it in to the
|
|
23
|
+
* <InlineIcon/> React component.
|
|
24
|
+
*
|
|
25
|
+
* We assume that the viewBox is cropped and aligned to (0, 0), but icons can
|
|
26
|
+
* be defined differently. At some point we might want to add these attributes
|
|
27
|
+
* to `icon-paths.js`, but for now this is a fairly safe assumption.
|
|
28
|
+
*
|
|
29
|
+
* Sample usage:
|
|
30
|
+
*
|
|
31
|
+
* const editIcon = {
|
|
32
|
+
* path: "M41.209 53.753l5.39 0l0 5.39l3.136 0l6.468-6.517-8.477-8.526-6.517 6.517l0 3.136zm33.173-34.937q-.882-.882-1.862.049l-19.6 19.6q-.931.98-.049 1.862t1.862-.049l19.6-19.6q.931-.98.049-1.862zm-38.563 45.668l0-16.121l37.632-37.632 16.17 16.121-37.632 37.632l-16.17 0zm43.022-12.397l0 10.633q-.049 6.713-4.753 11.417t-11.368 4.704l-46.599 0q-6.713 0-11.417-4.753t-4.704-11.368l0-46.599q0-6.664 4.753-11.417t11.368-4.704l46.599 0q3.528 0 6.566 1.372.833.392.98 1.323t-.49 1.617l-2.744 2.744q-.784.784-1.96.441t-2.352-.343l-46.599 0q-3.675 0-6.321 2.646t-2.646 6.321l0 46.599q0 3.675 2.646 6.321t6.321 2.646l46.599 0q3.675 0 6.321-2.646t2.646-6.321l0-7.056q0-.735.49-1.225l3.577-3.577q.833-.833 1.96-.392t1.127 1.617zm7.203-51.646q2.254 0 3.773 1.568l8.526 8.526q1.568 1.568 1.568 3.822t-1.568 3.773l-5.145 5.145-16.121-16.121 5.145-5.145q1.568-1.568 3.822-1.568z",
|
|
33
|
+
* width: 100,
|
|
34
|
+
* height: 78.912,
|
|
35
|
+
* };
|
|
36
|
+
* <InlineIcon {...editIcon} />
|
|
37
|
+
*/
|
|
38
|
+
declare var InlineIcon: (x: InlineIconProps) => React.Element<any>;
|
|
26
39
|
declare export default typeof InlineIcon;
|
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare enum Severity {
|
|
3
|
+
Error = 1,
|
|
4
|
+
Warning = 2,
|
|
5
|
+
Recommendation = 3,
|
|
6
|
+
OfflineReportingOnly = 4
|
|
7
|
+
}
|
|
8
|
+
type Props = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
message: string;
|
|
12
|
+
ruleName: string;
|
|
13
|
+
insideTable: boolean;
|
|
14
|
+
blockHighlight?: boolean;
|
|
15
|
+
severity?: Severity;
|
|
16
|
+
};
|
|
17
|
+
type State = {
|
|
18
|
+
tooltipAbove: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* This component renders "lint" nodes in a markdown parse tree. Lint nodes
|
|
22
|
+
* are inserted into the tree by the Perseus linter (see
|
|
23
|
+
* perseus-linter/src/index).
|
|
24
|
+
*
|
|
25
|
+
* This component serves multiple purposes
|
|
26
|
+
*
|
|
27
|
+
* 1) It renders a small circle in the right margin to indicate that there
|
|
28
|
+
* is lint on (or near) that line.
|
|
29
|
+
*
|
|
30
|
+
* 2) The area around the circle is hoverable: when the mouse moves over it
|
|
31
|
+
* the linty content is highlighted and a tooltip is displayed that explains
|
|
32
|
+
* what the problem is.
|
|
33
|
+
*
|
|
34
|
+
* 3) The hoverable area is also an HTML <a> tag. Clicking on it opens
|
|
35
|
+
* a new tab and links to additional details about the specific lint rule.
|
|
36
|
+
*
|
|
37
|
+
* The CSS required to position the circles in the right margin is tricky
|
|
38
|
+
* and it does not always work perfectly. When lint occurs on a block element
|
|
39
|
+
* that has a right margin (like anything blockquoted) the circle will appear
|
|
40
|
+
* to the left of where it belongs. And if there is more
|
|
41
|
+
**/
|
|
5
42
|
declare class Lint extends React.Component<Props, State> {
|
|
6
|
-
_positionTimeout: number |
|
|
7
|
-
static propTypes: {
|
|
8
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
9
|
-
inline: PropTypes.Requireable<boolean>;
|
|
10
|
-
message: PropTypes.Validator<string>;
|
|
11
|
-
ruleName: PropTypes.Validator<string>;
|
|
12
|
-
insideTable: PropTypes.Validator<boolean>;
|
|
13
|
-
blockHighlight: PropTypes.Requireable<boolean>;
|
|
14
|
-
severity: PropTypes.Requireable<number>;
|
|
15
|
-
};
|
|
43
|
+
_positionTimeout: number | undefined;
|
|
16
44
|
state: State;
|
|
17
45
|
componentDidMount(): void;
|
|
18
46
|
componentWillUnmount(): void;
|