@rzymek/react-pdf-highlighter 8.0.1-rc.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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/components/AreaHighlight.d.ts +8 -0
- package/dist/components/Highlight.d.ts +17 -0
- package/dist/components/HighlightLayer.d.ts +26 -0
- package/dist/components/MouseMonitor.d.ts +15 -0
- package/dist/components/MouseSelection.d.ts +10 -0
- package/dist/components/PdfHighlighter.d.ts +92 -0
- package/dist/components/PdfLoader.d.ts +32 -0
- package/dist/components/Popup.d.ts +8 -0
- package/dist/components/Tip.d.ts +20 -0
- package/dist/components/TipContainer.d.ts +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/lib/coordinates.d.ts +8 -0
- package/dist/lib/get-area-as-png.d.ts +2 -0
- package/dist/lib/get-bounding-rect.d.ts +2 -0
- package/dist/lib/get-client-rects.d.ts +2 -0
- package/dist/lib/optimize-client-rects.d.ts +2 -0
- package/dist/lib/pdfjs-dom.d.ts +8 -0
- package/dist/node_modules/.pnpm/pdfjs-dist@4.4.168/node_modules/pdfjs-dist/web/pdf_viewer.js +8022 -0
- package/dist/node_modules/.pnpm/ts-debounce@4.0.0/node_modules/ts-debounce/dist/src/index.esm.js +38 -0
- package/dist/src/components/AreaHighlight.js +58 -0
- package/dist/src/components/Highlight.js +45 -0
- package/dist/src/components/HighlightLayer.js +47 -0
- package/dist/src/components/MouseMonitor.js +45 -0
- package/dist/src/components/MouseSelection.js +119 -0
- package/dist/src/components/PdfHighlighter.js +543 -0
- package/dist/src/components/PdfLoader.js +81 -0
- package/dist/src/components/Popup.js +42 -0
- package/dist/src/components/Tip.js +82 -0
- package/dist/src/components/TipContainer.js +62 -0
- package/dist/src/index.js +15 -0
- package/dist/src/lib/coordinates.js +50 -0
- package/dist/src/lib/get-area-as-png.js +31 -0
- package/dist/src/lib/get-bounding-rect.js +40 -0
- package/dist/src/lib/get-client-rects.js +39 -0
- package/dist/src/lib/optimize-client-rects.js +54 -0
- package/dist/src/lib/pdfjs-dom.js +64 -0
- package/dist/src/style/AreaHighlight.module.css.js +14 -0
- package/dist/src/style/Highlight.module.css.js +20 -0
- package/dist/src/style/MouseSelection.module.css.js +8 -0
- package/dist/src/style/PdfHighlighter.module.css.js +14 -0
- package/dist/src/style/Tip.module.css.js +11 -0
- package/dist/src/style/TipContainer.module.css.js +8 -0
- package/dist/style.css +2903 -0
- package/dist/types.d.ts +62 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Artem Tyurin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
☕️ [Buy me a coffee](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SC4D2NS8G2JJ8&source=url)
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
# react-pdf-highlighter
|
|
6
|
+
|
|
7
|
+
Set of React components for PDF annotation.
|
|
8
|
+
|
|
9
|
+
Features:
|
|
10
|
+
|
|
11
|
+
- Built on top of PDF.js
|
|
12
|
+
- Text and image highlights
|
|
13
|
+
- Popover text for highlights
|
|
14
|
+
- Scroll to highlights
|
|
15
|
+
|
|
16
|
+
## Importing CSS
|
|
17
|
+
|
|
18
|
+
The bundled CSS include the CSS for pdfjs.
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import "react-pdf-highlighter/dist/style.css";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
See demo https://agentcooper.github.io/react-pdf-highlighter/.
|
|
27
|
+
|
|
28
|
+
To run the example app locally:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install
|
|
32
|
+
npm start
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install react-pdf-highlighter
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## How to use
|
|
42
|
+
|
|
43
|
+
See [`./example/src/App.tsx`](https://github.com/agentcooper/react-pdf-highlighter/blob/main/example/src/App.tsx) for the React component API example.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LTWHP, ViewportHighlight } from '../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
highlight: ViewportHighlight;
|
|
4
|
+
onChange: (rect: LTWHP) => void;
|
|
5
|
+
isScrolledTo: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function AreaHighlight({ highlight, onChange, isScrolledTo, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LTWHP } from '../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
position: {
|
|
4
|
+
boundingRect: LTWHP;
|
|
5
|
+
rects: Array<LTWHP>;
|
|
6
|
+
};
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
onMouseOver?: () => void;
|
|
9
|
+
onMouseOut?: () => void;
|
|
10
|
+
comment: {
|
|
11
|
+
emoji: string;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
isScrolledTo: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function Highlight({ position, onClick, onMouseOver, onMouseOut, comment, isScrolledTo, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PDFViewer } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
2
|
+
import { IHighlight, LTWH, LTWHP, Position, Scaled, ScaledPosition } from '../types';
|
|
3
|
+
import { T_ViewportHighlight } from './PdfHighlighter';
|
|
4
|
+
interface HighlightLayerProps<T_HT> {
|
|
5
|
+
highlightsByPage: {
|
|
6
|
+
[pageNumber: string]: Array<T_HT>;
|
|
7
|
+
};
|
|
8
|
+
pageNumber: string;
|
|
9
|
+
scrolledToHighlightId: string;
|
|
10
|
+
highlightTransform: (highlight: T_ViewportHighlight<T_HT>, index: number, setTip: (highlight: T_ViewportHighlight<T_HT>, callback: (highlight: T_ViewportHighlight<T_HT>) => JSX.Element) => void, hideTip: () => void, viewportToScaled: (rect: LTWHP) => Scaled, screenshot: (position: LTWH) => string, isScrolledTo: boolean) => JSX.Element;
|
|
11
|
+
tip: {
|
|
12
|
+
highlight: T_ViewportHighlight<T_HT>;
|
|
13
|
+
callback: (highlight: T_ViewportHighlight<T_HT>) => JSX.Element;
|
|
14
|
+
} | null;
|
|
15
|
+
scaledPositionToViewport: (scaledPosition: ScaledPosition) => Position;
|
|
16
|
+
hideTipAndSelection: () => void;
|
|
17
|
+
viewer: PDFViewer | undefined;
|
|
18
|
+
screenshot: (position: LTWH, pageNumber: number) => string;
|
|
19
|
+
showTip: (highlight: T_ViewportHighlight<T_HT>, content: JSX.Element) => void;
|
|
20
|
+
setTip: (state: {
|
|
21
|
+
highlight: T_ViewportHighlight<T_HT>;
|
|
22
|
+
callback: (highlight: T_ViewportHighlight<T_HT>) => JSX.Element;
|
|
23
|
+
}) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function HighlightLayer<T_HT extends IHighlight>({ highlightsByPage, scaledPositionToViewport, pageNumber, scrolledToHighlightId, highlightTransform, tip, hideTipAndSelection, viewer, screenshot, showTip, setTip, }: HighlightLayerProps<T_HT>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
onMoveAway: () => void;
|
|
4
|
+
paddingX: number;
|
|
5
|
+
paddingY: number;
|
|
6
|
+
children: JSX.Element;
|
|
7
|
+
}
|
|
8
|
+
export declare class MouseMonitor extends Component<Props> {
|
|
9
|
+
container: HTMLDivElement | null;
|
|
10
|
+
unsubscribe: () => void;
|
|
11
|
+
onMouseMove: (event: MouseEvent) => void;
|
|
12
|
+
attachRef: (ref: HTMLDivElement | null) => void;
|
|
13
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LTWH } from '../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
onSelection: (startTarget: HTMLElement, boundingRect: LTWH, resetSelection: () => void) => void;
|
|
4
|
+
onDragStart: () => void;
|
|
5
|
+
onDragEnd: () => void;
|
|
6
|
+
shouldStart: (event: MouseEvent) => boolean;
|
|
7
|
+
onChange: (isVisible: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function MouseSelection({ onSelection, onDragStart, onDragEnd, shouldStart, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PDFDocumentProxy } from 'pdfjs-dist';
|
|
2
|
+
import { EventBus, PDFViewer } from 'pdfjs-dist/legacy/web/pdf_viewer.mjs';
|
|
3
|
+
import { PDFViewerOptions } from 'pdfjs-dist/types/web/pdf_viewer';
|
|
4
|
+
import { PointerEventHandler, PureComponent, RefObject } from 'react';
|
|
5
|
+
import { Root } from 'react-dom/client';
|
|
6
|
+
import { IHighlight, LTWH, LTWHP, Position, Scaled, ScaledPosition } from '../types';
|
|
7
|
+
export type T_ViewportHighlight<T_HT> = {
|
|
8
|
+
position: Position;
|
|
9
|
+
} & T_HT;
|
|
10
|
+
interface State<T_HT> {
|
|
11
|
+
ghostHighlight: {
|
|
12
|
+
position: ScaledPosition;
|
|
13
|
+
content?: {
|
|
14
|
+
text?: string;
|
|
15
|
+
image?: string;
|
|
16
|
+
};
|
|
17
|
+
} | null;
|
|
18
|
+
isCollapsed: boolean;
|
|
19
|
+
range: Range | null;
|
|
20
|
+
tip: {
|
|
21
|
+
highlight: T_ViewportHighlight<T_HT>;
|
|
22
|
+
callback: (highlight: T_ViewportHighlight<T_HT>) => JSX.Element;
|
|
23
|
+
} | null;
|
|
24
|
+
tipPosition: Position | null;
|
|
25
|
+
tipChildren: JSX.Element | null;
|
|
26
|
+
isAreaSelectionInProgress: boolean;
|
|
27
|
+
scrolledToHighlightId: string;
|
|
28
|
+
}
|
|
29
|
+
interface Props<T_HT> {
|
|
30
|
+
highlightTransform: (highlight: T_ViewportHighlight<T_HT>, index: number, setTip: (highlight: T_ViewportHighlight<T_HT>, callback: (highlight: T_ViewportHighlight<T_HT>) => JSX.Element) => void, hideTip: () => void, viewportToScaled: (rect: LTWHP) => Scaled, screenshot: (position: LTWH) => string, isScrolledTo: boolean) => JSX.Element;
|
|
31
|
+
highlights: Array<T_HT>;
|
|
32
|
+
onScrollChange: () => void;
|
|
33
|
+
scrollRef: (scrollTo: (highlight: T_HT) => void) => void;
|
|
34
|
+
pdfDocument: PDFDocumentProxy;
|
|
35
|
+
pdfScaleValue: string;
|
|
36
|
+
onSelectionFinished: (position: ScaledPosition, content: {
|
|
37
|
+
text?: string;
|
|
38
|
+
image?: string;
|
|
39
|
+
}, hideTipAndSelection: () => void, transformSelection: () => void) => JSX.Element | null;
|
|
40
|
+
enableAreaSelection: (event: MouseEvent) => boolean;
|
|
41
|
+
pdfViewerOptions?: PDFViewerOptions;
|
|
42
|
+
}
|
|
43
|
+
export declare class PdfHighlighter<T_HT extends IHighlight> extends PureComponent<Props<T_HT>, State<T_HT>> {
|
|
44
|
+
static defaultProps: {
|
|
45
|
+
pdfScaleValue: string;
|
|
46
|
+
};
|
|
47
|
+
state: State<T_HT>;
|
|
48
|
+
viewer: PDFViewer | undefined;
|
|
49
|
+
resizeObserver: ResizeObserver | null;
|
|
50
|
+
containerNode?: HTMLDivElement | null;
|
|
51
|
+
containerNodeRef: RefObject<HTMLDivElement>;
|
|
52
|
+
highlightRoots: {
|
|
53
|
+
[page: number]: {
|
|
54
|
+
reactRoot: Root;
|
|
55
|
+
container: Element;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
unsubscribe: () => void;
|
|
59
|
+
constructor(props: Props<T_HT>);
|
|
60
|
+
componentDidMount(): void;
|
|
61
|
+
attachRef: (eventBus: EventBus) => void;
|
|
62
|
+
componentDidUpdate(prevProps: Props<T_HT>): void;
|
|
63
|
+
init(): Promise<void>;
|
|
64
|
+
componentWillUnmount(): void;
|
|
65
|
+
findOrCreateHighlightLayer(page: number): Element | null;
|
|
66
|
+
groupHighlightsByPage(highlights: Array<T_HT>): {
|
|
67
|
+
[pageNumber: string]: Array<T_HT>;
|
|
68
|
+
};
|
|
69
|
+
showTip(highlight: T_ViewportHighlight<T_HT>, content: JSX.Element): void;
|
|
70
|
+
scaledPositionToViewport({ pageNumber, boundingRect, rects, usePdfCoordinates, }: ScaledPosition): Position;
|
|
71
|
+
viewportPositionToScaled({ pageNumber, boundingRect, rects, }: Position): ScaledPosition;
|
|
72
|
+
screenshot(position: LTWH, pageNumber: number): string;
|
|
73
|
+
hideTipAndSelection: () => void;
|
|
74
|
+
setTip(position: Position, inner: JSX.Element | null): void;
|
|
75
|
+
renderTip: () => import("react/jsx-runtime").JSX.Element | null;
|
|
76
|
+
onTextLayerRendered: () => void;
|
|
77
|
+
scrollTo: (highlight: T_HT) => void;
|
|
78
|
+
onDocumentReady: () => void;
|
|
79
|
+
onSelectionChange: () => void;
|
|
80
|
+
onScroll: () => void;
|
|
81
|
+
onMouseDown: PointerEventHandler;
|
|
82
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
83
|
+
afterSelection: () => void;
|
|
84
|
+
debouncedAfterSelection: () => void;
|
|
85
|
+
toggleTextSelection(flag: boolean): void;
|
|
86
|
+
handleScaleValue: () => void;
|
|
87
|
+
debouncedScaleValue: () => void;
|
|
88
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
private renderHighlightLayers;
|
|
90
|
+
private renderHighlightLayer;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PDFDocumentProxy } from 'pdfjs-dist';
|
|
2
|
+
import { default as React, Component } from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** See `GlobalWorkerOptionsType`. */
|
|
5
|
+
workerSrc: string;
|
|
6
|
+
url: string;
|
|
7
|
+
beforeLoad: JSX.Element;
|
|
8
|
+
errorMessage?: JSX.Element;
|
|
9
|
+
children: (pdfDocument: PDFDocumentProxy) => JSX.Element;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
cMapUrl?: string;
|
|
12
|
+
cMapPacked?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface State {
|
|
15
|
+
pdfDocument: PDFDocumentProxy | null;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
}
|
|
18
|
+
export declare class PdfLoader extends Component<Props, State> {
|
|
19
|
+
state: State;
|
|
20
|
+
static defaultProps: {
|
|
21
|
+
workerSrc: string;
|
|
22
|
+
};
|
|
23
|
+
documentRef: React.RefObject<HTMLElement>;
|
|
24
|
+
componentDidMount(): void;
|
|
25
|
+
componentWillUnmount(): void;
|
|
26
|
+
componentDidUpdate({ url }: Props): void;
|
|
27
|
+
componentDidCatch(error: Error): void;
|
|
28
|
+
load(): void;
|
|
29
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
renderError(): React.FunctionComponentElement<any> | null;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
onMouseOver: (content: JSX.Element) => void;
|
|
3
|
+
popupContent: JSX.Element;
|
|
4
|
+
onMouseOut: () => void;
|
|
5
|
+
children: JSX.Element;
|
|
6
|
+
}
|
|
7
|
+
export declare function Popup({ onMouseOver, popupContent, onMouseOut, children, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
interface State {
|
|
3
|
+
compact: boolean;
|
|
4
|
+
text: string;
|
|
5
|
+
emoji: string;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
onConfirm: (comment: {
|
|
9
|
+
text: string;
|
|
10
|
+
emoji: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
onOpen: () => void;
|
|
13
|
+
onUpdate?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class Tip extends Component<Props, State> {
|
|
16
|
+
state: State;
|
|
17
|
+
componentDidUpdate(_: Props, nextState: State): void;
|
|
18
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LTWHP } from '../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: JSX.Element | null;
|
|
4
|
+
style: {
|
|
5
|
+
top: number;
|
|
6
|
+
left: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
};
|
|
9
|
+
scrollTop: number;
|
|
10
|
+
pageBoundingRect: LTWHP;
|
|
11
|
+
}
|
|
12
|
+
export declare function TipContainer({ children, style, scrollTop, pageBoundingRect, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { PdfHighlighter } from './components/PdfHighlighter';
|
|
2
|
+
export { Tip } from './components/Tip';
|
|
3
|
+
export { Highlight } from './components/Highlight';
|
|
4
|
+
export { Popup } from './components/Popup';
|
|
5
|
+
export { AreaHighlight } from './components/AreaHighlight';
|
|
6
|
+
export { PdfLoader } from './components/PdfLoader';
|
|
7
|
+
export * from './types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LTWHP, Scaled, Viewport } from '../types';
|
|
2
|
+
interface WIDTH_HEIGHT {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const viewportToScaled: (rect: LTWHP, { width, height }: WIDTH_HEIGHT) => Scaled;
|
|
7
|
+
export declare const scaledToViewport: (scaled: Scaled, viewport: Viewport, usePdfCoordinates?: boolean) => LTWHP;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Page } from '../types';
|
|
2
|
+
export declare const getDocument: (element: Element) => Document;
|
|
3
|
+
export declare const getWindow: (element: Element) => typeof window;
|
|
4
|
+
export declare const isHTMLElement: (element: Element | null) => element is HTMLElement;
|
|
5
|
+
export declare const isHTMLCanvasElement: (element: Element) => element is HTMLCanvasElement;
|
|
6
|
+
export declare const getPageFromElement: (target: HTMLElement) => Page | null;
|
|
7
|
+
export declare const getPagesFromRange: (range: Range) => Page[];
|
|
8
|
+
export declare const findOrCreateContainerLayer: (container: HTMLElement, className: string, selector?: string) => Element;
|