@khanacademy/perseus 4.0.1 → 5.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 +26 -0
- package/dist/components/highlighting/highlightable-content.d.ts +4 -4
- package/dist/components/highlighting/highlightable-content.js.flow +4 -7
- package/dist/components/highlighting/ui/highlight-renderer.d.ts +6 -6
- package/dist/components/highlighting/ui/highlight-renderer.js.flow +6 -8
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +5 -5
- package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +5 -8
- package/dist/components/highlighting/ui/highlight-tooltip.d.ts +2 -2
- package/dist/components/highlighting/ui/highlight-tooltip.js.flow +2 -4
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +3 -3
- package/dist/components/highlighting/ui/highlighting-ui.js.flow +2 -2
- package/dist/components/highlighting/ui/selection-tracker.d.ts +5 -5
- package/dist/components/highlighting/ui/selection-tracker.js.flow +5 -7
- package/dist/components/highlighting/word-indexer.d.ts +2 -2
- package/dist/components/highlighting/word-indexer.js.flow +2 -2
- package/dist/components/inline-icon.d.ts +35 -1
- package/dist/components/inline-icon.js.flow +11 -1
- package/dist/components/simple-keypad-input.d.ts +1 -1
- package/dist/components/simple-keypad-input.js.flow +1 -1
- package/dist/components/tex-buttons.d.ts +2 -2
- package/dist/components/tex-buttons.js.flow +2 -2
- package/dist/error-boundary.d.ts +4 -4
- package/dist/error-boundary.js.flow +4 -6
- package/dist/es/index.js +53 -233
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +53 -233
- package/dist/index.js.map +1 -1
- package/dist/multi-items/multi-renderer.d.ts +1 -1
- package/dist/multi-items/multi-renderer.js.flow +1 -1
- package/dist/multi-items/prop-type-builders.d.ts +1 -1
- package/dist/multi-items/shape-types.d.ts +1 -1
- package/dist/multi-items/shape-types.js.flow +1 -1
- package/dist/multi-items/tree-types.d.ts +1 -1
- package/dist/multi-items/tree-types.js.flow +1 -1
- package/dist/perseus-types.d.ts +0 -1
- package/dist/perseus-types.js.flow +0 -1
- package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +6 -0
- package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +12 -0
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/expression.js.flow +2 -2
- package/dist/widgets/interaction/element-container.d.ts +5 -4
- package/dist/widgets/interaction/element-container.js.flow +6 -11
- package/dist/widgets/label-image/marker.d.ts +4 -4
- package/dist/widgets/label-image/marker.js.flow +4 -6
- package/dist/widgets/numeric-input.d.ts +0 -2
- package/dist/widgets/numeric-input.js.flow +0 -4
- package/dist/widgets/radio/base-radio.d.ts +7 -1
- package/dist/widgets/radio/base-radio.js.flow +7 -1
- package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
- package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
- package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
- package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
- package/dist/widgets/radio/focus-ring.d.ts +8 -1
- package/dist/widgets/radio/focus-ring.js.flow +8 -1
- package/dist/widgets/radio/option-status.d.ts +2 -2
- package/dist/widgets/radio/option-status.js.flow +2 -2
- package/dist/widgets/video-transcript-link.d.ts +1 -1
- package/dist/widgets/video-transcript-link.js.flow +1 -1
- package/package.json +4 -4
- package/src/__stories__/item-renderer.stories.tsx +2 -6
- package/src/__stories__/server-item-renderer.stories.tsx +2 -6
- package/src/__testdata__/item-renderer.testdata.ts +1 -1
- package/src/__testdata__/renderer.testdata.ts +1 -1
- package/src/__tests__/item-renderer.test.tsx +1 -2
- package/src/__tests__/renderer-api.test.tsx +1 -5
- package/src/__tests__/renderer.test.tsx +1 -1
- package/src/components/__stories__/button-group.stories.tsx +2 -6
- package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
- package/src/components/__stories__/graph.stories.tsx +3 -5
- package/src/components/__stories__/graphie.stories.tsx +3 -5
- package/src/components/__stories__/hud.stories.tsx +2 -6
- package/src/components/__stories__/icon.stories.tsx +1 -1
- package/src/components/__stories__/image-loader.stories.tsx +4 -4
- package/src/components/__stories__/info-tip.stories.tsx +2 -6
- package/src/components/__stories__/inline-icon.stories.tsx +4 -8
- package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
- package/src/components/__stories__/lint.stories.tsx +12 -12
- package/src/components/__stories__/math-input.stories.tsx +4 -8
- package/src/components/__stories__/math-output.stories.tsx +3 -5
- package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
- package/src/components/__stories__/number-input.stories.tsx +6 -8
- package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
- package/src/components/__stories__/range-input.stories.tsx +4 -6
- package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
- package/src/components/__stories__/sortable.stories.tsx +15 -15
- package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
- package/src/components/__stories__/svg-image.stories.tsx +10 -18
- package/src/components/__stories__/tex.stories.tsx +1 -3
- package/src/components/__stories__/text-buttons.stories.tsx +10 -22
- package/src/components/__stories__/text-input.stories.tsx +4 -10
- package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
- package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
- package/src/components/__stories__/zoomable.stories.tsx +1 -3
- package/src/components/fixed-to-responsive.tsx +0 -1
- package/src/components/graph.tsx +0 -4
- package/src/components/highlighting/highlightable-content.tsx +4 -7
- package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
- package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
- package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
- package/src/components/highlighting/ui/highlighting-ui.tsx +5 -15
- package/src/components/highlighting/ui/selection-tracker.tsx +6 -9
- package/src/components/highlighting/word-indexer.tsx +2 -6
- package/src/components/inline-icon.tsx +2 -2
- package/src/components/math-input.tsx +0 -2
- package/src/components/number-input.tsx +0 -2
- package/src/components/simple-keypad-input.tsx +2 -2
- package/src/components/tex-buttons.tsx +2 -2
- package/src/components/text-list-editor.tsx +0 -4
- package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
- package/src/components/zoomable-tex.tsx +0 -2
- package/src/components/zoomable.tsx +0 -4
- package/src/definition-context.tsx +0 -1
- package/src/error-boundary.tsx +4 -7
- package/src/hints-renderer.tsx +1 -1
- package/src/interactive2/__tests__/movable-point.test.ts +0 -1
- package/src/item-renderer.tsx +0 -5
- package/src/mixins/changeable.ts +1 -1
- package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -5
- package/src/multi-items/__tests__/items.test.ts +3 -13
- package/src/multi-items/__tests__/multi-renderer.test.tsx +3 -4
- package/src/multi-items/__tests__/prop-type-builders.test.ts +1 -1
- package/src/multi-items/__tests__/trees.test.ts +2 -10
- package/src/multi-items/multi-renderer.tsx +7 -10
- package/src/multi-items/prop-type-builders.ts +1 -1
- package/src/multi-items/shape-types.ts +1 -1
- package/src/multi-items/tree-types.ts +1 -1
- package/src/perseus-markdown.tsx +0 -2
- package/src/perseus-types.ts +1 -4
- package/src/renderer.tsx +2 -5
- package/src/server-item-renderer.tsx +0 -3
- package/src/util/graphie.ts +3 -3
- package/src/util/interactive.ts +0 -4
- package/src/util/math.ts +0 -3
- package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
- package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
- package/src/widgets/__stories__/definition.stories.tsx +3 -7
- package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
- package/src/widgets/__stories__/explanation.stories.tsx +2 -2
- package/src/widgets/__stories__/expression.stories.tsx +113 -13
- package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
- package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
- package/src/widgets/__stories__/grapher.stories.tsx +7 -21
- package/src/widgets/__stories__/group.stories.tsx +1 -1
- package/src/widgets/__stories__/iframe.stories.tsx +1 -1
- package/src/widgets/__stories__/image.stories.tsx +2 -2
- package/src/widgets/__stories__/input-number.stories.tsx +3 -12
- package/src/widgets/__stories__/interaction.stories.tsx +1 -1
- package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
- package/src/widgets/__stories__/matcher.stories.tsx +1 -1
- package/src/widgets/__stories__/matrix.stories.tsx +1 -1
- package/src/widgets/__stories__/number-line.stories.tsx +1 -1
- package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
- package/src/widgets/__stories__/orderer.stories.tsx +1 -1
- package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
- package/src/widgets/__stories__/passage.stories.tsx +3 -9
- package/src/widgets/__stories__/radio.stories.tsx +3 -5
- package/src/widgets/__stories__/sorter.stories.tsx +1 -1
- package/src/widgets/__stories__/{on-screen-keypad.stories.tsx → test-keypad-context-wrapper.tsx} +15 -57
- package/src/widgets/__stories__/transformer.stories.tsx +1 -1
- package/src/widgets/__stories__/unit.stories.tsx +1 -3
- package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
- package/src/widgets/__stories__/video.stories.tsx +1 -1
- package/src/widgets/__testdata__/expression.testdata.ts +16 -12
- package/src/widgets/__testdata__/group.testdata.ts +0 -2
- package/src/widgets/__testdata__/numeric-input.testdata.ts +0 -1
- package/src/widgets/__testdata__/transformer.testdata.ts +0 -1
- package/src/widgets/__tests__/group.test.tsx +0 -2
- package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
- package/src/widgets/__tests__/radio.test.ts +1 -1
- package/src/widgets/expression.tsx +4 -4
- package/src/widgets/graded-group-set.tsx +0 -4
- package/src/widgets/graded-group.tsx +0 -4
- package/src/widgets/grapher/util.tsx +1 -5
- package/src/widgets/grapher.tsx +0 -5
- package/src/widgets/group.tsx +0 -1
- package/src/widgets/interaction/element-container.tsx +7 -8
- package/src/widgets/interaction.tsx +0 -1
- package/src/widgets/interactive-graph.tsx +3 -62
- package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
- package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
- package/src/widgets/label-image/marker.tsx +4 -4
- package/src/widgets/label-image.tsx +1 -1
- package/src/widgets/measurer.tsx +0 -1
- package/src/widgets/number-line.tsx +0 -2
- package/src/widgets/numeric-input.tsx +0 -3
- package/src/widgets/orderer.tsx +0 -3
- package/src/widgets/passage/passage-markdown.tsx +3 -3
- package/src/widgets/passage-ref-target.tsx +0 -1
- package/src/widgets/passage.tsx +1 -1
- package/src/widgets/plotter.tsx +0 -1
- package/src/widgets/radio/__stories__/base-radio.stories.tsx +13 -21
- package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
- package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
- package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
- package/src/widgets/radio/base-radio.tsx +2 -2
- package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
- package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
- package/src/widgets/radio/choice-none-above.tsx +2 -2
- package/src/widgets/radio/choice.tsx +1 -3
- package/src/widgets/radio/focus-ring.tsx +1 -1
- package/src/widgets/radio/option-status.tsx +2 -4
- package/src/widgets/radio/widget.tsx +0 -1
- package/src/widgets/reaction-diagram.tsx +2 -2
- package/src/widgets/transformer.tsx +1 -16
- package/src/widgets/video-transcript-link.tsx +1 -1
- package/src/widgets.ts +1 -1
- package/src/zoom.ts +0 -3
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 472e20e1: Remove all references to multipleNumberInput (ie. Ask for (one|all) correct solution)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 22c5d564: Remove the use of React.FC<> and use types named Props/State in more components
|
|
12
|
+
- Updated dependencies [4c03a43d]
|
|
13
|
+
- Updated dependencies [22c5d564]
|
|
14
|
+
- @khanacademy/math-input@1.0.0
|
|
15
|
+
- @khanacademy/simple-markdown@0.9.3
|
|
16
|
+
- @khanacademy/pure-markdown@0.2.3
|
|
17
|
+
|
|
18
|
+
## 4.0.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 90c1833e: Fix lint
|
|
23
|
+
- Updated dependencies [8e8d85cd]
|
|
24
|
+
- Updated dependencies [77391aa8]
|
|
25
|
+
- @khanacademy/math-input@0.7.2
|
|
26
|
+
- @khanacademy/simple-markdown@0.9.2
|
|
27
|
+
- @khanacademy/pure-markdown@0.2.2
|
|
28
|
+
|
|
3
29
|
## 4.0.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { DOMHighlight, DOMHighlightSet, SerializedHighlightSet, DOMRange } from "./types";
|
|
3
|
-
type
|
|
3
|
+
type Props = {
|
|
4
4
|
children?: React.ReactElement<any>;
|
|
5
5
|
editable: boolean;
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
onSerializedHighlightsUpdate: (serializedHighlights: SerializedHighlightSet) => unknown;
|
|
8
8
|
serializedHighlights: SerializedHighlightSet;
|
|
9
9
|
};
|
|
10
|
-
type
|
|
10
|
+
type State = {
|
|
11
11
|
wordRanges: ReadonlyArray<DOMRange>;
|
|
12
12
|
};
|
|
13
|
-
declare class HighlightableContent extends React.PureComponent<
|
|
13
|
+
declare class HighlightableContent extends React.PureComponent<Props, State> {
|
|
14
14
|
_container: HTMLElement | null | undefined;
|
|
15
15
|
_content: HTMLElement | null | undefined;
|
|
16
|
-
state:
|
|
16
|
+
state: State;
|
|
17
17
|
_buildHighlight(highlightRange: DOMRange): DOMHighlight | null | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* Take the highlights from props, and deserialize them into DOMHighlights,
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
SerializedHighlightSet,
|
|
12
12
|
DOMRange,
|
|
13
13
|
} from "./types";
|
|
14
|
-
declare type
|
|
14
|
+
declare type Props = {|
|
|
15
15
|
children?: React.Element<any>,
|
|
16
16
|
editable: boolean,
|
|
17
17
|
enabled: boolean,
|
|
@@ -20,16 +20,13 @@ declare type HighlightableContentProps = {|
|
|
|
20
20
|
) => mixed,
|
|
21
21
|
serializedHighlights: SerializedHighlightSet,
|
|
22
22
|
|};
|
|
23
|
-
declare type
|
|
23
|
+
declare type State = {|
|
|
24
24
|
wordRanges: $ReadOnlyArray<DOMRange>,
|
|
25
25
|
|};
|
|
26
|
-
declare class HighlightableContent
|
|
27
|
-
extends
|
|
28
|
-
React.PureComponent<HighlightableContentProps, HighlightableContentState>
|
|
29
|
-
{
|
|
26
|
+
declare class HighlightableContent extends React.PureComponent<Props, State> {
|
|
30
27
|
_container: HTMLElement | null | void;
|
|
31
28
|
_content: HTMLElement | null | void;
|
|
32
|
-
state:
|
|
29
|
+
state: State;
|
|
33
30
|
_buildHighlight(highlightRange: DOMRange): DOMHighlight | null | void;
|
|
34
31
|
|
|
35
32
|
/**
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { DOMHighlight, Position, Rect, ZIndexes } from "./types";
|
|
3
|
-
type
|
|
3
|
+
type Props = {
|
|
4
4
|
highlight: DOMHighlight;
|
|
5
5
|
highlightKey: string;
|
|
6
6
|
offsetParent: Element;
|
|
7
7
|
zIndexes: ZIndexes;
|
|
8
8
|
};
|
|
9
|
-
type
|
|
9
|
+
type State = {
|
|
10
10
|
cachedHighlightRects: ReadonlyArray<Rect>;
|
|
11
11
|
};
|
|
12
|
-
declare class HighlightRenderer extends React.PureComponent<
|
|
13
|
-
state:
|
|
14
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
12
|
+
declare class HighlightRenderer extends React.PureComponent<Props, State> {
|
|
13
|
+
state: State;
|
|
14
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
15
15
|
/**
|
|
16
16
|
* Compute the set of rectangles that cover the highlighted content, with
|
|
17
17
|
* coordinates relative to the offset parent. That way, we can use them
|
|
18
18
|
* for CSS positioning.
|
|
19
19
|
*/
|
|
20
|
-
_computeRects(props:
|
|
20
|
+
_computeRects(props: Props): ReadonlyArray<Rect>;
|
|
21
21
|
/**
|
|
22
22
|
* Return whether the given mouse position (coordinates relative to this
|
|
23
23
|
* component's offset parent) is hovering over the given rectangle
|
|
@@ -6,27 +6,25 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import type { DOMHighlight, Position, Rect, ZIndexes } from "./types";
|
|
9
|
-
declare type
|
|
9
|
+
declare type Props = {|
|
|
10
10
|
highlight: DOMHighlight,
|
|
11
11
|
highlightKey: string,
|
|
12
12
|
offsetParent: Element,
|
|
13
13
|
zIndexes: ZIndexes,
|
|
14
14
|
|};
|
|
15
|
-
declare type
|
|
15
|
+
declare type State = {|
|
|
16
16
|
cachedHighlightRects: $ReadOnlyArray<Rect>,
|
|
17
17
|
|};
|
|
18
|
-
declare class HighlightRenderer
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
state: HighlightRendererState;
|
|
22
|
-
UNSAFE_componentWillReceiveProps(nextProps: HighlightRendererProps): void;
|
|
18
|
+
declare class HighlightRenderer extends React.PureComponent<Props, State> {
|
|
19
|
+
state: State;
|
|
20
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* Compute the set of rectangles that cover the highlighted content, with
|
|
26
24
|
* coordinates relative to the offset parent. That way, we can use them
|
|
27
25
|
* for CSS positioning.
|
|
28
26
|
*/
|
|
29
|
-
_computeRects(props:
|
|
27
|
+
_computeRects(props: Props): $ReadOnlyArray<Rect>;
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
30
|
* Return whether the given mouse position (coordinates relative to this
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import HighlightRenderer from "./highlight-renderer";
|
|
3
3
|
import type { DOMHighlightSet, Position, ZIndexes } from "./types";
|
|
4
|
-
type
|
|
4
|
+
type Props = {
|
|
5
5
|
editable: boolean;
|
|
6
6
|
highlights: DOMHighlightSet;
|
|
7
7
|
offsetParent: Element;
|
|
8
8
|
onRemoveHighlight: (highlightKey: string) => unknown;
|
|
9
9
|
zIndexes: ZIndexes;
|
|
10
10
|
};
|
|
11
|
-
type
|
|
11
|
+
type State = {
|
|
12
12
|
hoveredHighlightKey: string | null | undefined;
|
|
13
13
|
hoveringTooltipFor: string | null | undefined;
|
|
14
14
|
};
|
|
15
|
-
declare class HighlightSetRenderer extends React.PureComponent<
|
|
16
|
-
state:
|
|
15
|
+
declare class HighlightSetRenderer extends React.PureComponent<Props, State> {
|
|
16
|
+
state: State;
|
|
17
17
|
_highlightRenderers: {
|
|
18
18
|
[highlightKey: string]: HighlightRenderer;
|
|
19
19
|
};
|
|
20
20
|
componentDidMount(): void;
|
|
21
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
21
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
22
22
|
componentWillUnmount(): void;
|
|
23
23
|
/**
|
|
24
24
|
* Given whether we were previously listening to mousemove events, and
|
|
@@ -7,27 +7,24 @@
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import HighlightRenderer from "./highlight-renderer";
|
|
9
9
|
import type { DOMHighlightSet, Position, ZIndexes } from "./types";
|
|
10
|
-
declare type
|
|
10
|
+
declare type Props = {|
|
|
11
11
|
editable: boolean,
|
|
12
12
|
highlights: DOMHighlightSet,
|
|
13
13
|
offsetParent: Element,
|
|
14
14
|
onRemoveHighlight: (highlightKey: string) => mixed,
|
|
15
15
|
zIndexes: ZIndexes,
|
|
16
16
|
|};
|
|
17
|
-
declare type
|
|
17
|
+
declare type State = {|
|
|
18
18
|
hoveredHighlightKey: string | null | void,
|
|
19
19
|
hoveringTooltipFor: string | null | void,
|
|
20
20
|
|};
|
|
21
|
-
declare class HighlightSetRenderer
|
|
22
|
-
|
|
23
|
-
React.PureComponent<HighlightSetRendererProps, HighlightSetRendererState>
|
|
24
|
-
{
|
|
25
|
-
state: HighlightSetRendererState;
|
|
21
|
+
declare class HighlightSetRenderer extends React.PureComponent<Props, State> {
|
|
22
|
+
state: State;
|
|
26
23
|
_highlightRenderers: {
|
|
27
24
|
[highlightKey: string]: HighlightRenderer,
|
|
28
25
|
};
|
|
29
26
|
componentDidMount(): void;
|
|
30
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
27
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
31
28
|
componentWillUnmount(): void;
|
|
32
29
|
|
|
33
30
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Rect } from "./types";
|
|
3
|
-
type
|
|
3
|
+
type Props = {
|
|
4
4
|
label: string;
|
|
5
5
|
onClick: () => unknown;
|
|
6
6
|
onMouseEnter?: () => unknown;
|
|
@@ -9,7 +9,7 @@ type HighlightTooltipProps = {
|
|
|
9
9
|
focusOffset: number;
|
|
10
10
|
offsetParent: Element;
|
|
11
11
|
};
|
|
12
|
-
declare class HighlightTooltip extends React.PureComponent<
|
|
12
|
+
declare class HighlightTooltip extends React.PureComponent<Props> {
|
|
13
13
|
_getFocusRect(): Rect | null | undefined;
|
|
14
14
|
render(): null | React.ReactNode;
|
|
15
15
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import type { Rect } from "./types";
|
|
9
|
-
declare type
|
|
9
|
+
declare type Props = {|
|
|
10
10
|
label: string,
|
|
11
11
|
onClick: () => mixed,
|
|
12
12
|
onMouseEnter?: () => mixed,
|
|
@@ -15,9 +15,7 @@ declare type HighlightTooltipProps = {|
|
|
|
15
15
|
focusOffset: number,
|
|
16
16
|
offsetParent: Element,
|
|
17
17
|
|};
|
|
18
|
-
declare class HighlightTooltip
|
|
19
|
-
extends React.PureComponent<HighlightTooltipProps>
|
|
20
|
-
{
|
|
18
|
+
declare class HighlightTooltip extends React.PureComponent<Props> {
|
|
21
19
|
_getFocusRect(): Rect | null | void;
|
|
22
20
|
render(): null | React.Node;
|
|
23
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { TrackedSelection } from "./selection-tracker";
|
|
3
3
|
import type { DOMHighlight, DOMHighlightSet, DOMRange, ZIndexes } from "./types";
|
|
4
|
-
type
|
|
4
|
+
type Props = {
|
|
5
5
|
buildHighlight: (range: DOMRange) => DOMHighlight | null | undefined;
|
|
6
6
|
contentNode: Node;
|
|
7
7
|
editable: boolean;
|
|
@@ -11,9 +11,9 @@ type HighlightingUIProps = {
|
|
|
11
11
|
onRemoveHighlight: (highlightKey: string) => unknown;
|
|
12
12
|
zIndexes: ZIndexes;
|
|
13
13
|
};
|
|
14
|
-
declare class HighlightingUI extends React.PureComponent<
|
|
14
|
+
declare class HighlightingUI extends React.PureComponent<Props> {
|
|
15
15
|
_handleAddHighlight(highlightToAdd: DOMHighlight): void;
|
|
16
|
-
_selectionIsValid(trackedSelection?: TrackedSelection | null):
|
|
16
|
+
_selectionIsValid(trackedSelection?: TrackedSelection | null): trackedSelection is TrackedSelection;
|
|
17
17
|
render(): React.ReactNode;
|
|
18
18
|
}
|
|
19
19
|
export default HighlightingUI;
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
DOMRange,
|
|
13
13
|
ZIndexes,
|
|
14
14
|
} from "./types";
|
|
15
|
-
declare type
|
|
15
|
+
declare type Props = {|
|
|
16
16
|
buildHighlight: (range: DOMRange) => DOMHighlight | null | void,
|
|
17
17
|
contentNode: Node,
|
|
18
18
|
editable: boolean,
|
|
@@ -22,7 +22,7 @@ declare type HighlightingUIProps = {|
|
|
|
22
22
|
onRemoveHighlight: (highlightKey: string) => mixed,
|
|
23
23
|
zIndexes: ZIndexes,
|
|
24
24
|
|};
|
|
25
|
-
declare class HighlightingUI extends React.PureComponent<
|
|
25
|
+
declare class HighlightingUI extends React.PureComponent<Props> {
|
|
26
26
|
_handleAddHighlight(highlightToAdd: DOMHighlight): void;
|
|
27
27
|
_selectionIsValid(trackedSelection?: TrackedSelection | null): boolean;
|
|
28
28
|
render(): React.Node;
|
|
@@ -9,19 +9,19 @@ export type TrackedSelection = {
|
|
|
9
9
|
focusOffset: number;
|
|
10
10
|
proposedHighlight: DOMHighlight;
|
|
11
11
|
};
|
|
12
|
-
type
|
|
12
|
+
type Props = {
|
|
13
13
|
buildHighlight: (domRange: DOMRange) => DOMHighlight | null | undefined;
|
|
14
14
|
children?: (trackedSelection: TrackedSelection | null | undefined, userIsMouseSelecting: boolean) => React.ReactElement<any>;
|
|
15
15
|
enabled: boolean;
|
|
16
16
|
};
|
|
17
|
-
type
|
|
17
|
+
type State = {
|
|
18
18
|
mouseState: "down" | "down-and-selecting" | "up";
|
|
19
19
|
trackedSelection: TrackedSelection | null | undefined;
|
|
20
20
|
};
|
|
21
|
-
declare class SelectionTracker extends React.PureComponent<
|
|
22
|
-
state:
|
|
21
|
+
declare class SelectionTracker extends React.PureComponent<Props, State> {
|
|
22
|
+
state: State;
|
|
23
23
|
componentDidMount(): void;
|
|
24
|
-
componentDidUpdate(prevProps:
|
|
24
|
+
componentDidUpdate(prevProps: Props): void;
|
|
25
25
|
componentWillUnmount(): void;
|
|
26
26
|
_updateListeners(wasListening: boolean, willListen: boolean): void;
|
|
27
27
|
/**
|
|
@@ -11,7 +11,7 @@ export type TrackedSelection = {|
|
|
|
11
11
|
focusOffset: number,
|
|
12
12
|
proposedHighlight: DOMHighlight,
|
|
13
13
|
|};
|
|
14
|
-
declare type
|
|
14
|
+
declare type Props = {|
|
|
15
15
|
buildHighlight: (domRange: DOMRange) => DOMHighlight | null | void,
|
|
16
16
|
children?: (
|
|
17
17
|
trackedSelection: TrackedSelection | null | void,
|
|
@@ -19,16 +19,14 @@ declare type SelectionTrackerProps = {|
|
|
|
19
19
|
) => React.Element<any>,
|
|
20
20
|
enabled: boolean,
|
|
21
21
|
|};
|
|
22
|
-
declare type
|
|
22
|
+
declare type State = {|
|
|
23
23
|
mouseState: "down" | "down-and-selecting" | "up",
|
|
24
24
|
trackedSelection: TrackedSelection | null | void,
|
|
25
25
|
|};
|
|
26
|
-
declare class SelectionTracker
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
state: SelectionTrackerState;
|
|
26
|
+
declare class SelectionTracker extends React.PureComponent<Props, State> {
|
|
27
|
+
state: State;
|
|
30
28
|
componentDidMount(): void;
|
|
31
|
-
componentDidUpdate(prevProps:
|
|
29
|
+
componentDidUpdate(prevProps: Props): void;
|
|
32
30
|
componentWillUnmount(): void;
|
|
33
31
|
_updateListeners(wasListening: boolean, willListen: boolean): void;
|
|
34
32
|
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import type { DOMRange } from "./types";
|
|
16
|
-
type
|
|
16
|
+
type Props = {
|
|
17
17
|
children?: React.ReactElement<any>;
|
|
18
18
|
onWordsUpdate: (wordRanges: ReadonlyArray<DOMRange>) => unknown;
|
|
19
19
|
};
|
|
20
|
-
declare class WordIndexer extends React.PureComponent<
|
|
20
|
+
declare class WordIndexer extends React.PureComponent<Props> {
|
|
21
21
|
_container: HTMLElement | null | undefined;
|
|
22
22
|
componentDidMount(): void;
|
|
23
23
|
componentDidUpdate(): void;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import type { DOMRange } from "./types";
|
|
9
|
-
declare type
|
|
9
|
+
declare type Props = {|
|
|
10
10
|
children?: React.Element<any>,
|
|
11
11
|
onWordsUpdate: (wordRanges: $ReadOnlyArray<DOMRange>) => mixed,
|
|
12
12
|
|};
|
|
13
|
-
declare class WordIndexer extends React.PureComponent<
|
|
13
|
+
declare class WordIndexer extends React.PureComponent<Props> {
|
|
14
14
|
_container: HTMLElement | null | void;
|
|
15
15
|
componentDidMount(): void;
|
|
16
16
|
componentDidUpdate(): void;
|
|
@@ -1,5 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stripped version of Icon.jsx from webapp. Takes an SVG icon and renders it
|
|
3
|
+
* inline like Font Awesome did.
|
|
4
|
+
*
|
|
5
|
+
* If you are looking for an icon that we've used before you should look in
|
|
6
|
+
* webapp's `icon-paths.js` which is a reference file for all the SVG paths
|
|
7
|
+
* that we've used. You'll need to copy the object from that file into
|
|
8
|
+
* whichever file you're using the icon and explicitly pass it in to the
|
|
9
|
+
* <InlineIcon/> React component.
|
|
10
|
+
*
|
|
11
|
+
* We assume that the viewBox is cropped and aligned to (0, 0), but icons can
|
|
12
|
+
* be defined differently. At some point we might want to add these attributes
|
|
13
|
+
* to `icon-paths.js`, but for now this is a fairly safe assumption.
|
|
14
|
+
*
|
|
15
|
+
* Sample usage:
|
|
16
|
+
*
|
|
17
|
+
* const editIcon = {
|
|
18
|
+
* 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",
|
|
19
|
+
* width: 100,
|
|
20
|
+
* height: 78.912,
|
|
21
|
+
* };
|
|
22
|
+
* <InlineIcon {...editIcon} />
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
import PropTypes from "prop-types";
|
|
1
26
|
import * as React from "react";
|
|
2
|
-
declare const InlineIcon:
|
|
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
|
+
};
|
|
3
37
|
export type InlineIconProps = {
|
|
4
38
|
path: string;
|
|
5
39
|
height: number;
|
|
@@ -4,8 +4,18 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
+
import PropTypes from "prop-types";
|
|
7
8
|
import * as React from "react";
|
|
8
|
-
declare var InlineIcon:
|
|
9
|
+
declare var InlineIcon: {|
|
|
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
|
+
|};
|
|
9
19
|
export type InlineIconProps = {|
|
|
10
20
|
path: string,
|
|
11
21
|
height: number,
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
export default class SimpleKeypadInput extends React.Component<any> {
|
|
12
|
+
_isMounted: boolean;
|
|
12
13
|
componentDidMount(): void;
|
|
13
14
|
componentWillUnmount(): void;
|
|
14
|
-
_isMounted: boolean;
|
|
15
15
|
focus(): void;
|
|
16
16
|
blur(): void;
|
|
17
17
|
getValue(): string | number;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
declare export default class SimpleKeypadInput extends React.Component<any> {
|
|
9
|
+
_isMounted: boolean;
|
|
9
10
|
componentDidMount(): void;
|
|
10
11
|
componentWillUnmount(): void;
|
|
11
|
-
_isMounted: boolean;
|
|
12
12
|
focus(): void;
|
|
13
13
|
blur(): void;
|
|
14
14
|
getValue(): string | number;
|
|
@@ -6,13 +6,13 @@ type ButtonSets = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const buttonSets: ButtonSets;
|
|
8
8
|
export type ButtonSetsType = ReadonlyArray<keyof typeof buttonSets>;
|
|
9
|
-
type
|
|
9
|
+
type Props = {
|
|
10
10
|
sets: ButtonSetsType;
|
|
11
11
|
onInsert: (arg1: Inserter) => void;
|
|
12
12
|
className?: string;
|
|
13
13
|
convertDotToTimes?: boolean;
|
|
14
14
|
};
|
|
15
|
-
declare class TexButtons extends React.Component<
|
|
15
|
+
declare class TexButtons extends React.Component<Props> {
|
|
16
16
|
static buttonSets: typeof buttonSets;
|
|
17
17
|
static buttonSetsType: any;
|
|
18
18
|
render(): React.ReactNode;
|
|
@@ -12,13 +12,13 @@ declare type ButtonSets = {
|
|
|
12
12
|
};
|
|
13
13
|
declare var buttonSets: ButtonSets;
|
|
14
14
|
export type ButtonSetsType = $ReadOnlyArray<$Keys<typeof buttonSets>>;
|
|
15
|
-
declare type
|
|
15
|
+
declare type Props = {|
|
|
16
16
|
sets: ButtonSetsType,
|
|
17
17
|
onInsert: (arg1: Inserter) => void,
|
|
18
18
|
className?: string,
|
|
19
19
|
convertDotToTimes?: boolean,
|
|
20
20
|
|};
|
|
21
|
-
declare class TexButtons extends React.Component<
|
|
21
|
+
declare class TexButtons extends React.Component<Props> {
|
|
22
22
|
static buttonSets: typeof buttonSets;
|
|
23
23
|
static buttonSetsType: any;
|
|
24
24
|
render(): React.Node;
|
package/dist/error-boundary.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
type
|
|
2
|
+
type Props = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
5
|
+
type State = {
|
|
6
6
|
error: string;
|
|
7
7
|
};
|
|
8
|
-
declare class ErrorBoundary extends React.Component<
|
|
9
|
-
constructor(props:
|
|
8
|
+
declare class ErrorBoundary extends React.Component<Props, State> {
|
|
9
|
+
constructor(props: Props);
|
|
10
10
|
componentDidCatch(error: Error, info: any): void;
|
|
11
11
|
render(): React.ReactNode;
|
|
12
12
|
}
|
|
@@ -5,16 +5,14 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
declare type
|
|
8
|
+
declare type Props = {|
|
|
9
9
|
children: React.Node,
|
|
10
10
|
|};
|
|
11
|
-
declare type
|
|
11
|
+
declare type State = {|
|
|
12
12
|
error: string,
|
|
13
13
|
|};
|
|
14
|
-
declare class ErrorBoundary
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
constructor(props: ErrorBoundaryProps): this;
|
|
14
|
+
declare class ErrorBoundary extends React.Component<Props, State> {
|
|
15
|
+
constructor(props: Props): this;
|
|
18
16
|
componentDidCatch(error: Error, info: any): void;
|
|
19
17
|
render(): React.Node;
|
|
20
18
|
}
|