@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
|
@@ -17,15 +17,11 @@ const imgUrl = "https://www.khanacademy.org/images/hand-tree.new.png";
|
|
|
17
17
|
const graphieUrl =
|
|
18
18
|
"web+graphie://ka-perseus-graphie.s3.amazonaws.com/1e06f6d4071f30cee2cc3ccb7435b3a66a62fe3f";
|
|
19
19
|
|
|
20
|
-
export const MostlyEmptyPropsObject: React.
|
|
21
|
-
args,
|
|
22
|
-
): React.ReactElement => {
|
|
20
|
+
export const MostlyEmptyPropsObject = (args: StoryArgs): React.ReactElement => {
|
|
23
21
|
return <SvgImage alt="ALT" />;
|
|
24
22
|
};
|
|
25
23
|
|
|
26
|
-
export const SvgImageThatDoesntLoad: React.
|
|
27
|
-
args,
|
|
28
|
-
): React.ReactElement => {
|
|
24
|
+
export const SvgImageThatDoesntLoad = (args: StoryArgs): React.ReactElement => {
|
|
29
25
|
return (
|
|
30
26
|
<SvgImage
|
|
31
27
|
alt="ALT"
|
|
@@ -36,26 +32,22 @@ export const SvgImageThatDoesntLoad: React.FC<StoryArgs> = (
|
|
|
36
32
|
);
|
|
37
33
|
};
|
|
38
34
|
|
|
39
|
-
export const SvgImageBasic: React.
|
|
40
|
-
args,
|
|
41
|
-
): React.ReactElement => {
|
|
35
|
+
export const SvgImageBasic = (args: StoryArgs): React.ReactElement => {
|
|
42
36
|
return <SvgImage src={svgUrl} alt="ALT" />;
|
|
43
37
|
};
|
|
44
38
|
|
|
45
|
-
export const SvgImageWithFixedHeight
|
|
46
|
-
args,
|
|
39
|
+
export const SvgImageWithFixedHeight = (
|
|
40
|
+
args: StoryArgs,
|
|
47
41
|
): React.ReactElement => {
|
|
48
42
|
return <SvgImage height={50} src={svgUrl} alt="ALT" />;
|
|
49
43
|
};
|
|
50
44
|
|
|
51
|
-
export const SvgImageWithFixedWidth: React.
|
|
52
|
-
args,
|
|
53
|
-
): React.ReactElement => {
|
|
45
|
+
export const SvgImageWithFixedWidth = (args: StoryArgs): React.ReactElement => {
|
|
54
46
|
return <SvgImage src={svgUrl} width={50} alt="ALT" />;
|
|
55
47
|
};
|
|
56
48
|
|
|
57
|
-
export const SvgImageWithExtraGraphieProps
|
|
58
|
-
args,
|
|
49
|
+
export const SvgImageWithExtraGraphieProps = (
|
|
50
|
+
args: StoryArgs,
|
|
59
51
|
): React.ReactElement => {
|
|
60
52
|
return (
|
|
61
53
|
<SvgImage
|
|
@@ -73,10 +65,10 @@ export const SvgImageWithExtraGraphieProps: React.FC<StoryArgs> = (
|
|
|
73
65
|
);
|
|
74
66
|
};
|
|
75
67
|
|
|
76
|
-
export const PngImage
|
|
68
|
+
export const PngImage = (args: StoryArgs): React.ReactElement => {
|
|
77
69
|
return <SvgImage src={imgUrl} alt="ALT" />;
|
|
78
70
|
};
|
|
79
71
|
|
|
80
|
-
export const GraphieImage
|
|
72
|
+
export const GraphieImage = (args: StoryArgs): React.ReactElement => {
|
|
81
73
|
return <SvgImage src={graphieUrl} alt="ALT" />;
|
|
82
74
|
};
|
|
@@ -18,8 +18,6 @@ export default {
|
|
|
18
18
|
},
|
|
19
19
|
} as Story;
|
|
20
20
|
|
|
21
|
-
export const BasicOperation: React.
|
|
22
|
-
args,
|
|
23
|
-
): React.ReactElement => {
|
|
21
|
+
export const BasicOperation = (args: StoryArgs): React.ReactElement => {
|
|
24
22
|
return <TeX setAssetStatus={() => {}} children={args.equation} />;
|
|
25
23
|
};
|
|
@@ -12,51 +12,39 @@ export default {
|
|
|
12
12
|
title: "Perseus/Components/Tex Buttons",
|
|
13
13
|
} as Story;
|
|
14
14
|
|
|
15
|
-
export const ButtonSetBasic: React.
|
|
16
|
-
args,
|
|
17
|
-
): React.ReactElement => {
|
|
15
|
+
export const ButtonSetBasic = (args: StoryArgs): React.ReactElement => {
|
|
18
16
|
return <TexButtons sets={["basic"]} onInsert={() => {}} />;
|
|
19
17
|
};
|
|
20
18
|
|
|
21
|
-
export const ButtonSetBasicDiv: React.
|
|
22
|
-
args,
|
|
23
|
-
): React.ReactElement => {
|
|
19
|
+
export const ButtonSetBasicDiv = (args: StoryArgs): React.ReactElement => {
|
|
24
20
|
return <TexButtons sets={["basic+div"]} onInsert={() => {}} />;
|
|
25
21
|
};
|
|
26
22
|
|
|
27
|
-
export const ButtonSetTrig: React.
|
|
28
|
-
args,
|
|
29
|
-
): React.ReactElement => {
|
|
23
|
+
export const ButtonSetTrig = (args: StoryArgs): React.ReactElement => {
|
|
30
24
|
return <TexButtons sets={["trig"]} onInsert={() => {}} />;
|
|
31
25
|
};
|
|
32
26
|
|
|
33
|
-
export const ButtonSetPrealgebra: React.
|
|
34
|
-
args,
|
|
35
|
-
): React.ReactElement => {
|
|
27
|
+
export const ButtonSetPrealgebra = (args: StoryArgs): React.ReactElement => {
|
|
36
28
|
return <TexButtons sets={["prealgebra"]} onInsert={() => {}} />;
|
|
37
29
|
};
|
|
38
30
|
|
|
39
|
-
export const ButtonSetLogarithms: React.
|
|
40
|
-
args,
|
|
41
|
-
): React.ReactElement => {
|
|
31
|
+
export const ButtonSetLogarithms = (args: StoryArgs): React.ReactElement => {
|
|
42
32
|
return <TexButtons sets={["logarithms"]} onInsert={() => {}} />;
|
|
43
33
|
};
|
|
44
34
|
|
|
45
|
-
export const ButtonSetBasicRelations
|
|
46
|
-
args,
|
|
35
|
+
export const ButtonSetBasicRelations = (
|
|
36
|
+
args: StoryArgs,
|
|
47
37
|
): React.ReactElement => {
|
|
48
38
|
return <TexButtons sets={["basic relations"]} onInsert={() => {}} />;
|
|
49
39
|
};
|
|
50
40
|
|
|
51
|
-
export const ButtonSetAdvancedRelations
|
|
52
|
-
args,
|
|
41
|
+
export const ButtonSetAdvancedRelations = (
|
|
42
|
+
args: StoryArgs,
|
|
53
43
|
): React.ReactElement => {
|
|
54
44
|
return <TexButtons sets={["advanced relations"]} onInsert={() => {}} />;
|
|
55
45
|
};
|
|
56
46
|
|
|
57
|
-
export const ButtonSetMultiple: React.
|
|
58
|
-
args,
|
|
59
|
-
): React.ReactElement => {
|
|
47
|
+
export const ButtonSetMultiple = (args: StoryArgs): React.ReactElement => {
|
|
60
48
|
return (
|
|
61
49
|
<TexButtons
|
|
62
50
|
sets={["basic", "trig", "advanced relations"]}
|
|
@@ -16,24 +16,18 @@ const defaultObject = {
|
|
|
16
16
|
onChange: () => {},
|
|
17
17
|
} as const;
|
|
18
18
|
|
|
19
|
-
export const EmptyPropsObject: React.
|
|
20
|
-
args,
|
|
21
|
-
): React.ReactElement => {
|
|
19
|
+
export const EmptyPropsObject = (args: StoryArgs): React.ReactElement => {
|
|
22
20
|
return <TextInput {...defaultObject} />;
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
export const TestValueProvided: React.
|
|
26
|
-
args,
|
|
27
|
-
): React.ReactElement => {
|
|
23
|
+
export const TestValueProvided = (args: StoryArgs): React.ReactElement => {
|
|
28
24
|
return <TextInput {...defaultObject} value="Test value" />;
|
|
29
25
|
};
|
|
30
26
|
|
|
31
|
-
export const AriaLabelTextProvided: React.
|
|
32
|
-
args,
|
|
33
|
-
): React.ReactElement => {
|
|
27
|
+
export const AriaLabelTextProvided = (args: StoryArgs): React.ReactElement => {
|
|
34
28
|
return <TextInput {...defaultObject} labelText="Test label" />;
|
|
35
29
|
};
|
|
36
30
|
|
|
37
|
-
export const Disabled
|
|
31
|
+
export const Disabled = (args: StoryArgs): React.ReactElement => {
|
|
38
32
|
return <TextInput {...defaultObject} disabled={true} />;
|
|
39
33
|
};
|
|
@@ -22,9 +22,7 @@ const defaultObject = {
|
|
|
22
22
|
|
|
23
23
|
const ClassName = "framework-perseus orderer";
|
|
24
24
|
|
|
25
|
-
export const SimpleListOfOptions: React.
|
|
26
|
-
args,
|
|
27
|
-
): React.ReactElement => {
|
|
25
|
+
export const SimpleListOfOptions = (args: StoryArgs): React.ReactElement => {
|
|
28
26
|
return (
|
|
29
27
|
// @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: Element; class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
|
|
30
28
|
<div class={ClassName}>
|
|
@@ -12,16 +12,18 @@ export default {
|
|
|
12
12
|
title: "Perseus/Components/Zoomable Tex",
|
|
13
13
|
} as Story;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
type Props = {
|
|
16
16
|
children: React.ReactNode;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ForceZoomWrapper = ({children}: Props): React.ReactElement => (
|
|
18
20
|
<>
|
|
19
21
|
<h1>Click on equation to zoom/unzoom</h1>
|
|
20
22
|
<div style={{width: "50px"}}>{children}</div>
|
|
21
23
|
</>
|
|
22
24
|
);
|
|
23
25
|
|
|
24
|
-
export const KaTeX
|
|
26
|
+
export const KaTeX = (args: StoryArgs): React.ReactElement => {
|
|
25
27
|
return (
|
|
26
28
|
<ForceZoomWrapper>
|
|
27
29
|
<ZoomableTex children="\sum_{i=1}^\infty\frac{1}{n^2} =\frac{\pi^2}{6}" />
|
|
@@ -29,7 +31,7 @@ export const KaTeX: React.FC<StoryArgs> = (args): React.ReactElement => {
|
|
|
29
31
|
);
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
export const ComplexKaTeX
|
|
34
|
+
export const ComplexKaTeX = (args: StoryArgs): React.ReactElement => {
|
|
33
35
|
return (
|
|
34
36
|
<ForceZoomWrapper>
|
|
35
37
|
{" "}
|
|
@@ -27,9 +27,7 @@ const computeChildBounds = (
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const ZoomableExample: React.
|
|
31
|
-
args,
|
|
32
|
-
): React.ReactElement => {
|
|
30
|
+
export const ZoomableExample = (args: StoryArgs): React.ReactElement => {
|
|
33
31
|
return (
|
|
34
32
|
<Zoomable computeChildBounds={computeChildBounds}>
|
|
35
33
|
<span>
|
|
@@ -103,7 +103,6 @@ const FixedToResponsive: any = createReactClass({
|
|
|
103
103
|
const spacer = (
|
|
104
104
|
<div
|
|
105
105
|
style={{
|
|
106
|
-
// $FlowFixMe[unsafe-addition]
|
|
107
106
|
// @ts-expect-error [FEI-5003] - TS2362 - The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
|
108
107
|
paddingBottom: (1 / aspectRatio).toFixed(4) * 100 + "%",
|
|
109
108
|
}}
|
package/src/components/graph.tsx
CHANGED
|
@@ -97,7 +97,6 @@ class Graph extends React.Component<any> {
|
|
|
97
97
|
if (imageData.url) {
|
|
98
98
|
const scale = this.props.box[0] / interactiveSizes.defaultBoxSize;
|
|
99
99
|
image = (
|
|
100
|
-
// $FlowFixMe[prop-missing]: `alt` is missing
|
|
101
100
|
// @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; width: any; height: any; scale: number; responsive: false; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'.
|
|
102
101
|
<SvgImage
|
|
103
102
|
src={imageData.url}
|
|
@@ -118,13 +117,10 @@ class Graph extends React.Component<any> {
|
|
|
118
117
|
width: this.props.box[0],
|
|
119
118
|
height: this.props.box[1],
|
|
120
119
|
}}
|
|
121
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
122
120
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOut' does not exist on type 'Graph'.
|
|
123
121
|
onMouseOut={this.onMouseOut}
|
|
124
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
125
122
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOver' does not exist on type 'Graph'.
|
|
126
123
|
onMouseOver={this.onMouseOver}
|
|
127
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
128
124
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onClick' does not exist on type 'Graph'.
|
|
129
125
|
onClick={this.onClick}
|
|
130
126
|
>
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
DOMRange,
|
|
32
32
|
} from "./types";
|
|
33
33
|
|
|
34
|
-
type
|
|
34
|
+
type Props = {
|
|
35
35
|
// The highlightable content itself. Highlights will be defined relative to
|
|
36
36
|
// the content specified here.
|
|
37
37
|
children?: React.ReactElement<any>;
|
|
@@ -57,21 +57,18 @@ type HighlightableContentProps = {
|
|
|
57
57
|
serializedHighlights: SerializedHighlightSet;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
type
|
|
60
|
+
type State = {
|
|
61
61
|
// A cached list of DOMRanges, each representing one of the content's
|
|
62
62
|
// semantic words. Sorted in document order.
|
|
63
63
|
wordRanges: ReadonlyArray<DOMRange>;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
class HighlightableContent extends React.PureComponent<
|
|
67
|
-
HighlightableContentProps,
|
|
68
|
-
HighlightableContentState
|
|
69
|
-
> {
|
|
66
|
+
class HighlightableContent extends React.PureComponent<Props, State> {
|
|
70
67
|
// References to the mounted container and content divs.
|
|
71
68
|
_container: HTMLElement | null | undefined;
|
|
72
69
|
_content: HTMLElement | null | undefined;
|
|
73
70
|
|
|
74
|
-
state:
|
|
71
|
+
state: State = {
|
|
75
72
|
wordRanges: [],
|
|
76
73
|
};
|
|
77
74
|
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
|
|
22
22
|
import type {DOMHighlight, Position, Rect, ZIndexes} from "./types";
|
|
23
23
|
|
|
24
|
-
type
|
|
24
|
+
type Props = {
|
|
25
25
|
// The DOMHighlight to render.
|
|
26
26
|
highlight: DOMHighlight;
|
|
27
27
|
// A unique key corresponding to the given `highlight`.
|
|
@@ -36,7 +36,7 @@ type HighlightRendererProps = {
|
|
|
36
36
|
zIndexes: ZIndexes;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
type
|
|
39
|
+
type State = {
|
|
40
40
|
// The set of rectangles that cover this highlight's content, relative to
|
|
41
41
|
// the offset parent. This cache is updated on mount and on changes to
|
|
42
42
|
// the `highlight` and `offsetParent` props.
|
|
@@ -50,17 +50,14 @@ type HighlightRendererState = {
|
|
|
50
50
|
cachedHighlightRects: ReadonlyArray<Rect>;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
class HighlightRenderer extends React.PureComponent<
|
|
54
|
-
|
|
55
|
-
HighlightRendererState
|
|
56
|
-
> {
|
|
57
|
-
state: HighlightRendererState = {
|
|
53
|
+
class HighlightRenderer extends React.PureComponent<Props, State> {
|
|
54
|
+
state: State = {
|
|
58
55
|
cachedHighlightRects: this._computeRects(this.props),
|
|
59
56
|
// @ts-expect-error [FEI-5003] - TS2322 - Type '{ cachedHighlightRects: readonly Rect[]; tooltipIsHovered: boolean; }' is not assignable to type 'HighlightRendererState'.
|
|
60
57
|
tooltipIsHovered: false,
|
|
61
58
|
};
|
|
62
59
|
|
|
63
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
60
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
|
64
61
|
if (
|
|
65
62
|
this.props.highlight !== nextProps.highlight ||
|
|
66
63
|
this.props.offsetParent !== nextProps.offsetParent
|
|
@@ -76,7 +73,7 @@ class HighlightRenderer extends React.PureComponent<
|
|
|
76
73
|
* coordinates relative to the offset parent. That way, we can use them
|
|
77
74
|
* for CSS positioning.
|
|
78
75
|
*/
|
|
79
|
-
_computeRects(props:
|
|
76
|
+
_computeRects(props: Props): ReadonlyArray<Rect> {
|
|
80
77
|
const {highlight, offsetParent} = props;
|
|
81
78
|
|
|
82
79
|
// Get the set of rectangles that covers the range's text, relative to
|
|
@@ -15,7 +15,7 @@ import HighlightTooltip from "./highlight-tooltip";
|
|
|
15
15
|
|
|
16
16
|
import type {DOMHighlightSet, Position, ZIndexes} from "./types";
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type Props = {
|
|
19
19
|
// Whether the highlights are user-editable. If false, highlights are
|
|
20
20
|
// read-only.
|
|
21
21
|
editable: boolean;
|
|
@@ -33,7 +33,7 @@ type HighlightSetRendererProps = {
|
|
|
33
33
|
// highlights below content.
|
|
34
34
|
zIndexes: ZIndexes;
|
|
35
35
|
};
|
|
36
|
-
type
|
|
36
|
+
type State = {
|
|
37
37
|
// If the user is currently hovering over a highlight, this field contains
|
|
38
38
|
// its key.
|
|
39
39
|
hoveredHighlightKey: string | null | undefined;
|
|
@@ -42,11 +42,8 @@ type HighlightSetRendererState = {
|
|
|
42
42
|
hoveringTooltipFor: string | null | undefined;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
class HighlightSetRenderer extends React.PureComponent<
|
|
46
|
-
|
|
47
|
-
HighlightSetRendererState
|
|
48
|
-
> {
|
|
49
|
-
state: HighlightSetRendererState = {
|
|
45
|
+
class HighlightSetRenderer extends React.PureComponent<Props, State> {
|
|
46
|
+
state: State = {
|
|
50
47
|
hoveredHighlightKey: null,
|
|
51
48
|
hoveringTooltipFor: null,
|
|
52
49
|
};
|
|
@@ -60,7 +57,7 @@ class HighlightSetRenderer extends React.PureComponent<
|
|
|
60
57
|
this._updateEditListeners(false, this.props.editable);
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
UNSAFE_componentWillReceiveProps(nextProps:
|
|
60
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
|
64
61
|
this._updateEditListeners(this.props.editable, nextProps.editable);
|
|
65
62
|
|
|
66
63
|
// If we were previously hovering over a highlight that has been
|
|
@@ -23,7 +23,7 @@ import {getRelativeRect} from "./util";
|
|
|
23
23
|
|
|
24
24
|
import type {Rect} from "./types";
|
|
25
25
|
|
|
26
|
-
type
|
|
26
|
+
type Props = {
|
|
27
27
|
label: string;
|
|
28
28
|
onClick: () => unknown;
|
|
29
29
|
onMouseEnter?: () => unknown;
|
|
@@ -33,7 +33,7 @@ type HighlightTooltipProps = {
|
|
|
33
33
|
offsetParent: Element;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
class HighlightTooltip extends React.PureComponent<
|
|
36
|
+
class HighlightTooltip extends React.PureComponent<Props> {
|
|
37
37
|
_getFocusRect(): Rect | null | undefined {
|
|
38
38
|
const {focusNode, focusOffset, offsetParent} = this.props;
|
|
39
39
|
|
|
@@ -21,7 +21,7 @@ import SelectionTracker from "./selection-tracker";
|
|
|
21
21
|
import type {TrackedSelection} from "./selection-tracker";
|
|
22
22
|
import type {DOMHighlight, DOMHighlightSet, DOMRange, ZIndexes} from "./types";
|
|
23
23
|
|
|
24
|
-
type
|
|
24
|
+
type Props = {
|
|
25
25
|
// A function that builds a DOMHighlight from the given DOMRange, if
|
|
26
26
|
// possible. If it would not currently be valid to add a highlight over the
|
|
27
27
|
// given DOMRange, returns null.
|
|
@@ -49,7 +49,7 @@ type HighlightingUIProps = {
|
|
|
49
49
|
zIndexes: ZIndexes;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
class HighlightingUI extends React.PureComponent<
|
|
52
|
+
class HighlightingUI extends React.PureComponent<Props> {
|
|
53
53
|
_handleAddHighlight(highlightToAdd: DOMHighlight) {
|
|
54
54
|
this.props.onAddHighlight(highlightToAdd);
|
|
55
55
|
|
|
@@ -61,7 +61,9 @@ class HighlightingUI extends React.PureComponent<HighlightingUIProps> {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
_selectionIsValid(
|
|
64
|
+
_selectionIsValid(
|
|
65
|
+
trackedSelection?: TrackedSelection | null,
|
|
66
|
+
): trackedSelection is TrackedSelection {
|
|
65
67
|
if (!trackedSelection) {
|
|
66
68
|
return false;
|
|
67
69
|
}
|
|
@@ -123,22 +125,10 @@ class HighlightingUI extends React.PureComponent<HighlightingUIProps> {
|
|
|
123
125
|
label={i18n._("Add highlight")}
|
|
124
126
|
onClick={() =>
|
|
125
127
|
this._handleAddHighlight(
|
|
126
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
127
|
-
// "proposedHighlight (Cannot get `trackedSelection.proposedHighlight` because property `proposedHighlight` is missing in null or undefined [1].)"
|
|
128
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
129
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
130
128
|
trackedSelection.proposedHighlight,
|
|
131
129
|
)
|
|
132
130
|
}
|
|
133
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
134
|
-
// "focusNode (Cannot get `trackedSelection.focusNode` because property `focusNode` is missing in null or undefined [1].)"
|
|
135
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
136
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
137
131
|
focusNode={trackedSelection.focusNode}
|
|
138
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
139
|
-
// "focusOffset (Cannot get `trackedSelection.focusOffset` because property `focusOffset` is missing in null or undefined [1].)"
|
|
140
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
141
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
142
132
|
focusOffset={trackedSelection.focusOffset}
|
|
143
133
|
offsetParent={this.props.offsetParent}
|
|
144
134
|
/>
|
|
@@ -22,7 +22,7 @@ export type TrackedSelection = {
|
|
|
22
22
|
proposedHighlight: DOMHighlight;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
type
|
|
25
|
+
type Props = {
|
|
26
26
|
// A function that builds a DOMHighlight from the given DOMRange, if
|
|
27
27
|
// possible. If it would not currently be valid to add a highlight over the
|
|
28
28
|
// given DOMRange, returns null.
|
|
@@ -38,7 +38,7 @@ type SelectionTrackerProps = {
|
|
|
38
38
|
enabled: boolean;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
type
|
|
41
|
+
type State = {
|
|
42
42
|
// The current state of the mouse button. We distinguish between down,
|
|
43
43
|
// down and the selection has changed since going down, and up.
|
|
44
44
|
mouseState: "down" | "down-and-selecting" | "up";
|
|
@@ -46,11 +46,8 @@ type SelectionTrackerState = {
|
|
|
46
46
|
trackedSelection: TrackedSelection | null | undefined;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
class SelectionTracker extends React.PureComponent<
|
|
50
|
-
|
|
51
|
-
SelectionTrackerState
|
|
52
|
-
> {
|
|
53
|
-
state: SelectionTrackerState = {
|
|
49
|
+
class SelectionTracker extends React.PureComponent<Props, State> {
|
|
50
|
+
state: State = {
|
|
54
51
|
mouseState: "up",
|
|
55
52
|
trackedSelection: null,
|
|
56
53
|
};
|
|
@@ -59,7 +56,7 @@ class SelectionTracker extends React.PureComponent<
|
|
|
59
56
|
this._updateListeners(false, this.props.enabled);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
componentDidUpdate(prevProps:
|
|
59
|
+
componentDidUpdate(prevProps: Props) {
|
|
63
60
|
if (this.props.buildHighlight !== prevProps.buildHighlight) {
|
|
64
61
|
// The highlight-building function changed, so the
|
|
65
62
|
// proposedHighlight we built with it might be different, or no
|
|
@@ -124,7 +121,7 @@ class SelectionTracker extends React.PureComponent<
|
|
|
124
121
|
}
|
|
125
122
|
|
|
126
123
|
// NOTE(mdr): The focus node is guaranteed to exist, because
|
|
127
|
-
// there's a range, but the
|
|
124
|
+
// there's a range, but the type annotations for
|
|
128
125
|
// Selection don't know that. Cast it ourselves.
|
|
129
126
|
const focusNode: Node = selection.focusNode as any;
|
|
130
127
|
const focusOffset = selection.focusOffset;
|
|
@@ -18,7 +18,7 @@ import {PerseusError} from "../../perseus-error";
|
|
|
18
18
|
|
|
19
19
|
import type {DOMRange} from "./types";
|
|
20
20
|
|
|
21
|
-
type
|
|
21
|
+
type Props = {
|
|
22
22
|
// The content to display and traverse in search of words.
|
|
23
23
|
children?: React.ReactElement<any>;
|
|
24
24
|
// After each mount and update, this callback is called with the list of
|
|
@@ -26,7 +26,7 @@ type WordIndexerProps = {
|
|
|
26
26
|
onWordsUpdate: (wordRanges: ReadonlyArray<DOMRange>) => unknown;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
class WordIndexer extends React.PureComponent<
|
|
29
|
+
class WordIndexer extends React.PureComponent<Props> {
|
|
30
30
|
_container: HTMLElement | null | undefined;
|
|
31
31
|
/* eslint-enable react/sort-comp */
|
|
32
32
|
|
|
@@ -103,11 +103,7 @@ class WordIndexer extends React.PureComponent<WordIndexerProps> {
|
|
|
103
103
|
let newTrailingWordRange = null;
|
|
104
104
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null' is not assignable to parameter of type 'string'.
|
|
105
105
|
while ((wordMatch = wordPattern.exec(text)) !== null) {
|
|
106
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
107
|
-
// "index (Cannot get `wordMatch.index` because property `index` is missing in null [1].)"
|
|
108
106
|
const startOffset = wordMatch.index;
|
|
109
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
110
|
-
// "index (Cannot get `wordMatch.index` because property `index` is missing in null [1].)", "0 (Cannot get `wordMatch[0]` because an indexer property is missing in null [1].)"
|
|
111
107
|
const endOffset = wordMatch.index + wordMatch[0].length;
|
|
112
108
|
|
|
113
109
|
let range;
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
import PropTypes from "prop-types";
|
|
27
27
|
import * as React from "react";
|
|
28
28
|
|
|
29
|
-
const InlineIcon
|
|
29
|
+
const InlineIcon = ({
|
|
30
30
|
path,
|
|
31
31
|
width,
|
|
32
32
|
height,
|
|
33
33
|
style = {},
|
|
34
34
|
title,
|
|
35
|
-
}): React.ReactElement => (
|
|
35
|
+
}: InlineIconProps): React.ReactElement => (
|
|
36
36
|
<svg
|
|
37
37
|
role="img"
|
|
38
38
|
aria-hidden={!title}
|
|
@@ -191,8 +191,6 @@ class MathInput extends React.Component<Props, State> {
|
|
|
191
191
|
// close (blur) the button group in order to focus on next page element.
|
|
192
192
|
if (
|
|
193
193
|
!this.mouseDown &&
|
|
194
|
-
// $FlowFixMe[incompatible-use]
|
|
195
|
-
// $FlowFixMe[incompatible-call]
|
|
196
194
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
197
195
|
!ReactDOM.findDOMNode(this).contains(e.relatedTarget)
|
|
198
196
|
) {
|
|
@@ -110,8 +110,6 @@ class NumberInput extends React.Component<any, any> {
|
|
|
110
110
|
*/
|
|
111
111
|
getValue: () => any = () => {
|
|
112
112
|
return this.parseInputValue(
|
|
113
|
-
// $FlowFixMe[incompatible-use]
|
|
114
|
-
// $FlowFixMe[prop-missing]
|
|
115
113
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
116
114
|
ReactDOM.findDOMNode(this.refs.input).value, // eslint-disable-line react/no-string-refs
|
|
117
115
|
);
|
|
@@ -17,6 +17,8 @@ import PropTypes from "prop-types";
|
|
|
17
17
|
import * as React from "react";
|
|
18
18
|
|
|
19
19
|
export default class SimpleKeypadInput extends React.Component<any> {
|
|
20
|
+
_isMounted = false;
|
|
21
|
+
|
|
20
22
|
componentDidMount() {
|
|
21
23
|
// TODO(scottgrant): This is a hack to remove the deprecated call to
|
|
22
24
|
// this.isMounted() but is still considered an anti-pattern.
|
|
@@ -27,8 +29,6 @@ export default class SimpleKeypadInput extends React.Component<any> {
|
|
|
27
29
|
this._isMounted = false;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
_isMounted = false;
|
|
31
|
-
|
|
32
32
|
focus() {
|
|
33
33
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
|
|
34
34
|
this.refs.input.focus(); // eslint-disable-line react/no-string-refs
|
|
@@ -253,7 +253,7 @@ const buttonSets: ButtonSets = {
|
|
|
253
253
|
|
|
254
254
|
export type ButtonSetsType = ReadonlyArray<keyof typeof buttonSets>;
|
|
255
255
|
|
|
256
|
-
type
|
|
256
|
+
type Props = {
|
|
257
257
|
sets: ButtonSetsType;
|
|
258
258
|
onInsert: (arg1: Inserter) => void;
|
|
259
259
|
className?: string;
|
|
@@ -264,7 +264,7 @@ const buttonSetsPropType = PropTypes.arrayOf(
|
|
|
264
264
|
PropTypes.oneOf(_(buttonSets).keys()),
|
|
265
265
|
);
|
|
266
266
|
|
|
267
|
-
class TexButtons extends React.Component<
|
|
267
|
+
class TexButtons extends React.Component<Props> {
|
|
268
268
|
static buttonSets: typeof buttonSets = buttonSets;
|
|
269
269
|
static buttonSetsType: any = buttonSetsPropType;
|
|
270
270
|
|
|
@@ -116,8 +116,6 @@ class TextListEditor extends React.Component<any, any> {
|
|
|
116
116
|
// eslint-disable-next-line react/no-string-refs
|
|
117
117
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
118
118
|
this.refs["input_" + focusIndex],
|
|
119
|
-
// $FlowFixMe[incompatible-use]
|
|
120
|
-
// $FlowFixMe[prop-missing]
|
|
121
119
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
122
120
|
).focus();
|
|
123
121
|
});
|
|
@@ -156,8 +154,6 @@ class TextListEditor extends React.Component<any, any> {
|
|
|
156
154
|
// eslint-disable-next-line react/no-string-refs
|
|
157
155
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
158
156
|
this.refs["input_" + focusIndex],
|
|
159
|
-
// $FlowFixMe[incompatible-use]
|
|
160
|
-
// $FlowFixMe[prop-missing]
|
|
161
157
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
162
158
|
).focus();
|
|
163
159
|
});
|
|
@@ -136,8 +136,6 @@ class VisibilityTest extends React.Component<Props, State> {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
export const AlertWhenNotVisible: React.
|
|
140
|
-
args,
|
|
141
|
-
): React.ReactElement => {
|
|
139
|
+
export const AlertWhenNotVisible = (args: StoryArgs): React.ReactElement => {
|
|
142
140
|
return <VisibilityTest />;
|
|
143
141
|
};
|
|
@@ -26,10 +26,8 @@ const computeMathBounds = (
|
|
|
26
26
|
parentNode.querySelector(".katex-html") ||
|
|
27
27
|
parentNode.querySelector(".MathJax");
|
|
28
28
|
const textBounds = {
|
|
29
|
-
// $FlowFixMe[incompatible-use]
|
|
30
29
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetWidth' does not exist on type 'Element'.
|
|
31
30
|
width: textElement.offsetWidth,
|
|
32
|
-
// $FlowFixMe[incompatible-use]
|
|
33
31
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element'.
|
|
34
32
|
height: textElement.offsetHeight,
|
|
35
33
|
} as const;
|