higlass 2.2.3 → 2.3.1
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/app/scripts/Autocomplete.jsx +12 -3
- package/app/scripts/Button.jsx +20 -24
- package/app/scripts/ContextMenuContainer.jsx +1 -3
- package/app/scripts/ContextMenuItem.jsx +15 -16
- package/app/scripts/Dialog.jsx +30 -29
- package/app/scripts/HiGlassComponent.jsx +74 -40
- package/app/scripts/HorizontalItem.jsx +50 -21
- package/app/scripts/HorizontalTrack.jsx +1 -0
- package/app/scripts/ListWrapper.jsx +6 -17
- package/app/scripts/Modal.jsx +14 -13
- package/app/scripts/PopupMenu.jsx +6 -12
- package/app/scripts/SortableList.jsx +119 -64
- package/app/scripts/TrackArea.jsx +19 -24
- package/app/scripts/TrackControl.jsx +16 -27
- package/app/scripts/VerticalItem.jsx +53 -22
- package/app/scripts/VerticalTrack.jsx +1 -0
- package/app/scripts/api.js +5 -4
- package/app/scripts/hglib.jsx +34 -4
- package/app/scripts/test-helpers/test-helpers.jsx +2 -2
- package/app/scripts/utils/get-higlass-components.js +2 -2
- package/app/scripts/utils/react-dom-compat.js +100 -0
- package/app/styles/HiGlass.scss +1 -0
- package/dist/app/scripts/Autocomplete.d.ts +3 -1
- package/dist/app/scripts/ContextMenuContainer.d.ts +0 -1
- package/dist/app/scripts/ContextMenuItem.d.ts +9 -15
- package/dist/app/scripts/HiGlassComponent.d.ts +0 -3
- package/dist/app/scripts/HorizontalItem.d.ts +1 -1
- package/dist/app/scripts/ListWrapper.d.ts +2 -7
- package/dist/app/scripts/PopupMenu.d.ts +2 -4
- package/dist/app/scripts/SortableList.d.ts +6 -2
- package/dist/app/scripts/VerticalItem.d.ts +1 -1
- package/dist/app/scripts/utils/react-dom-compat.d.ts +27 -0
- package/dist/hglib.js +13142 -11160
- package/dist/hglib.min.js +89 -89
- package/dist/higlass.mjs +13150 -11168
- package/dist/package.json +7 -5
- package/package.json +7 -5
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compatibility layer for ReactDOM.render / createRoot APIs.
|
|
6
|
+
*
|
|
7
|
+
* - React 18+: uses `createRoot` from `react-dom/client`
|
|
8
|
+
* - React 16/17: falls back to legacy `ReactDOM.render`
|
|
9
|
+
*
|
|
10
|
+
* This allows HiGlass to support React 16–19 as peer dependencies.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** @type {WeakMap<HTMLElement, { unmount: () => void }>} */
|
|
14
|
+
const containerRoots = new WeakMap();
|
|
15
|
+
|
|
16
|
+
/** @type {((container: HTMLElement) => import('react-dom/client').Root) | null} */
|
|
17
|
+
let _createRoot = null;
|
|
18
|
+
|
|
19
|
+
/** @type {boolean} */
|
|
20
|
+
let _resolved = false;
|
|
21
|
+
|
|
22
|
+
// Check synchronously first (UMD builds expose createRoot on ReactDOM)
|
|
23
|
+
if (typeof ReactDOM.createRoot === 'function') {
|
|
24
|
+
_createRoot = ReactDOM.createRoot;
|
|
25
|
+
_resolved = true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Attempt dynamic import for ESM builds (react-dom/client is a separate entry point).
|
|
29
|
+
// The module specifier is built via concatenation so that bundlers (Vite, Rollup)
|
|
30
|
+
// do not try to statically resolve it — it may not exist in React 16/17.
|
|
31
|
+
/** @type {string} */
|
|
32
|
+
const _clientModuleId = 'react-dom' + '/client';
|
|
33
|
+
/** @type {Promise<void>} */
|
|
34
|
+
const _clientPromise = _resolved
|
|
35
|
+
? Promise.resolve()
|
|
36
|
+
: import(/* @vite-ignore */ /* webpackIgnore: true */ _clientModuleId)
|
|
37
|
+
.then((mod) => {
|
|
38
|
+
if (typeof mod.createRoot === 'function') {
|
|
39
|
+
_createRoot = mod.createRoot;
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.catch(() => {
|
|
43
|
+
// React 16/17: react-dom/client doesn't exist, use legacy API
|
|
44
|
+
})
|
|
45
|
+
.finally(() => {
|
|
46
|
+
_resolved = true;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Wait for the createRoot detection to complete.
|
|
51
|
+
* Call this before the first `renderToContainer` in async contexts.
|
|
52
|
+
* @returns {Promise<void>}
|
|
53
|
+
*/
|
|
54
|
+
export async function ensureReady() {
|
|
55
|
+
if (!_resolved) await _clientPromise;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Render a React element into a container, using `createRoot` if available.
|
|
60
|
+
*
|
|
61
|
+
* @param {HTMLElement} container
|
|
62
|
+
* @param {React.ReactNode} element
|
|
63
|
+
* @returns {{ unmount: () => void }}
|
|
64
|
+
*/
|
|
65
|
+
export function renderToContainer(container, element) {
|
|
66
|
+
if (_createRoot) {
|
|
67
|
+
const root = _createRoot(container);
|
|
68
|
+
root.render(element);
|
|
69
|
+
const handle = { unmount: () => root.unmount() };
|
|
70
|
+
containerRoots.set(container, handle);
|
|
71
|
+
return handle;
|
|
72
|
+
}
|
|
73
|
+
// Legacy fallback (React 16/17)
|
|
74
|
+
ReactDOM.render(element, container);
|
|
75
|
+
const handle = {
|
|
76
|
+
unmount: () => ReactDOM.unmountComponentAtNode(container),
|
|
77
|
+
};
|
|
78
|
+
containerRoots.set(container, handle);
|
|
79
|
+
return handle;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Unmount a React tree from a container.
|
|
84
|
+
*
|
|
85
|
+
* Looks up the handle from `renderToContainer`, or falls back to the legacy
|
|
86
|
+
* `ReactDOM.unmountComponentAtNode` (for trees mounted outside the compat layer,
|
|
87
|
+
* e.g. by Enzyme in tests).
|
|
88
|
+
*
|
|
89
|
+
* @param {HTMLElement} container
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
export function unmountFromContainer(container) {
|
|
93
|
+
const handle = containerRoots.get(container);
|
|
94
|
+
if (handle) {
|
|
95
|
+
handle.unmount();
|
|
96
|
+
containerRoots.delete(container);
|
|
97
|
+
} else if (typeof ReactDOM.unmountComponentAtNode === 'function') {
|
|
98
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
99
|
+
}
|
|
100
|
+
}
|
package/app/styles/HiGlass.scss
CHANGED
|
@@ -8,6 +8,8 @@ declare class Autocomplete extends React.Component<any, any, any> {
|
|
|
8
8
|
menuWidth: number;
|
|
9
9
|
isOpen: boolean;
|
|
10
10
|
};
|
|
11
|
+
itemRefs: {};
|
|
12
|
+
menuRef: any;
|
|
11
13
|
keyDownHandlers: {
|
|
12
14
|
ArrowDown(event: any): void;
|
|
13
15
|
ArrowUp(event: any): void;
|
|
@@ -35,7 +37,7 @@ declare class Autocomplete extends React.Component<any, any, any> {
|
|
|
35
37
|
selectItemFromMouse(item: any): void;
|
|
36
38
|
setIgnoreBlur(ignore: any): void;
|
|
37
39
|
renderMenu(): React.FunctionComponentElement<{
|
|
38
|
-
ref:
|
|
40
|
+
ref: (el: any) => void;
|
|
39
41
|
}> | null;
|
|
40
42
|
handleInputBlur(): void;
|
|
41
43
|
handleInputFocus(): void;
|
|
@@ -19,7 +19,6 @@ declare class ContextMenuContainer extends React.Component<any, any, any> {
|
|
|
19
19
|
handleMouseLeave(): void;
|
|
20
20
|
handleOtherMouseEnter(): void;
|
|
21
21
|
updateOrientation(): void;
|
|
22
|
-
divDom: Element | Text | null | undefined;
|
|
23
22
|
render(): React.JSX.Element;
|
|
24
23
|
div: HTMLDivElement | null | undefined;
|
|
25
24
|
}
|
|
@@ -2,32 +2,26 @@ export default ContextMenuItem;
|
|
|
2
2
|
export type ContextMenuItemProps = {
|
|
3
3
|
className?: string | undefined;
|
|
4
4
|
onClick: (evt: React.MouseEvent) => void;
|
|
5
|
-
onMouseEnter
|
|
6
|
-
onMouseLeave
|
|
5
|
+
onMouseEnter?: ((evt: React.MouseEvent) => void) | undefined;
|
|
6
|
+
onMouseLeave?: ((evt: React.MouseEvent) => void) | undefined;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* @typedef ContextMenuItemProps
|
|
10
10
|
* @prop {string} [className]
|
|
11
11
|
* @prop {(evt: React.MouseEvent) => void} onClick
|
|
12
|
-
* @prop {(evt: React.MouseEvent) => void} onMouseEnter
|
|
13
|
-
* @prop {(evt: React.MouseEvent) => void} onMouseLeave
|
|
12
|
+
* @prop {(evt: React.MouseEvent) => void} [onMouseEnter]
|
|
13
|
+
* @prop {(evt: React.MouseEvent) => void} [onMouseLeave]
|
|
14
14
|
*/
|
|
15
15
|
/**
|
|
16
16
|
* @param {React.PropsWithChildren<ContextMenuItemProps>} props
|
|
17
17
|
*/
|
|
18
|
-
declare function ContextMenuItem(
|
|
18
|
+
declare function ContextMenuItem({ onMouseEnter, onMouseLeave, onClick, className, children, }: React.PropsWithChildren<ContextMenuItemProps>): React.JSX.Element;
|
|
19
19
|
declare namespace ContextMenuItem {
|
|
20
|
-
namespace defaultProps {
|
|
21
|
-
function onMouseEnter(): undefined;
|
|
22
|
-
function onMouseLeave(): undefined;
|
|
23
|
-
}
|
|
24
20
|
namespace propTypes {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
let onMouseLeave_1: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
|
-
export { onMouseLeave_1 as onMouseLeave };
|
|
21
|
+
let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
22
|
+
let onClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
+
let onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
+
let onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
27
|
import React from 'react';
|
|
@@ -58,7 +58,6 @@ declare class HiGlassComponent extends React.Component<any, any, any> {
|
|
|
58
58
|
pluginTracks: {};
|
|
59
59
|
pluginDataFetchers: any;
|
|
60
60
|
state: {
|
|
61
|
-
currentBreakpoint: string;
|
|
62
61
|
width: number;
|
|
63
62
|
height: number;
|
|
64
63
|
rowHeight: number;
|
|
@@ -223,7 +222,6 @@ declare class HiGlassComponent extends React.Component<any, any, any> {
|
|
|
223
222
|
animateOnGlobalEvent({ sourceUid }?: {}): void;
|
|
224
223
|
measureSize(): void;
|
|
225
224
|
updateAfterResize(): void;
|
|
226
|
-
onBreakpointChange(breakpoint: any): void;
|
|
227
225
|
handleOverlayMouseEnter(uid: any): void;
|
|
228
226
|
handleOverlayMouseLeave(): void;
|
|
229
227
|
/**
|
|
@@ -731,7 +729,6 @@ declare class HiGlassComponent extends React.Component<any, any, any> {
|
|
|
731
729
|
render(): React.JSX.Element;
|
|
732
730
|
tiledAreasDivs: {} | undefined;
|
|
733
731
|
tiledAreas: React.JSX.Element | React.JSX.Element[] | undefined;
|
|
734
|
-
gridLayout: any;
|
|
735
732
|
canvasElement: HTMLCanvasElement | null | undefined;
|
|
736
733
|
scrollContainer: HTMLDivElement | null | undefined;
|
|
737
734
|
divDrawingSurface: HTMLDivElement | null | undefined;
|
|
@@ -8,21 +8,16 @@ declare class ListWrapper extends React.Component<any, any, any> {
|
|
|
8
8
|
isSorting: boolean;
|
|
9
9
|
};
|
|
10
10
|
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
11
|
-
onSortStart({
|
|
12
|
-
node: any;
|
|
11
|
+
onSortStart({ index }: {
|
|
13
12
|
index: any;
|
|
14
|
-
|
|
15
|
-
}, e: any): void;
|
|
13
|
+
}): void;
|
|
16
14
|
sortingIndex: any;
|
|
17
|
-
sortStartTop: any;
|
|
18
|
-
sortStartLeft: any;
|
|
19
15
|
onSortMove(): void;
|
|
20
16
|
onSortEnd({ oldIndex, newIndex }: {
|
|
21
17
|
oldIndex: any;
|
|
22
18
|
newIndex: any;
|
|
23
19
|
}): void;
|
|
24
20
|
render(): React.JSX.Element;
|
|
25
|
-
ref: any;
|
|
26
21
|
}
|
|
27
22
|
declare namespace ListWrapper {
|
|
28
23
|
namespace propTypes {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
export default PopupMenu;
|
|
2
2
|
declare class PopupMenu extends React.Component<any, any, any> {
|
|
3
3
|
constructor(props: any);
|
|
4
|
+
popup: HTMLDivElement | null;
|
|
4
5
|
clickHandlerBound: (event: any) => void;
|
|
5
6
|
contextMenuHandlerBound: (event: any) => void;
|
|
6
7
|
resizeHandlerBound: () => void;
|
|
7
8
|
componentDidMount(): void;
|
|
8
|
-
popup: HTMLDivElement | undefined;
|
|
9
|
-
componentDidUpdate(): void;
|
|
10
9
|
componentWillUnmount(): void;
|
|
11
|
-
_renderLayer(): void;
|
|
12
10
|
clickHandler(event: any): void;
|
|
13
11
|
contextMenuHandler(event: any): void;
|
|
14
12
|
resizeHandler(): void;
|
|
15
|
-
render(): React.
|
|
13
|
+
render(): React.ReactPortal | null;
|
|
16
14
|
}
|
|
17
15
|
declare namespace PopupMenu {
|
|
18
16
|
namespace defaultProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default SortableList;
|
|
2
|
-
declare
|
|
2
|
+
declare function SortableList({ className, items, itemClass, itemControlAlignLeft, sortingIndex, useDragHandle, sortableHandlers, height, width, onCloseTrack, onCollapseTrack, onExpandTrack, onCloseTrackMenuOpened, onConfigTrackMenuOpened, onAddSeries, handleConfigTrack, editable, itemReactClass, handleResizeTrack, resizeHandles, onSortEnd, onSortStart, onSortMove, axis, }: {
|
|
3
3
|
className: any;
|
|
4
4
|
items: any;
|
|
5
5
|
itemClass: any;
|
|
@@ -20,5 +20,9 @@ declare const SortableList: React.ComponentClass<{
|
|
|
20
20
|
itemReactClass: any;
|
|
21
21
|
handleResizeTrack: any;
|
|
22
22
|
resizeHandles: any;
|
|
23
|
-
|
|
23
|
+
onSortEnd: any;
|
|
24
|
+
onSortStart: any;
|
|
25
|
+
onSortMove: any;
|
|
26
|
+
axis: any;
|
|
27
|
+
}): React.JSX.Element;
|
|
24
28
|
import React from 'react';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait for the createRoot detection to complete.
|
|
3
|
+
* Call this before the first `renderToContainer` in async contexts.
|
|
4
|
+
* @returns {Promise<void>}
|
|
5
|
+
*/
|
|
6
|
+
export function ensureReady(): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Render a React element into a container, using `createRoot` if available.
|
|
9
|
+
*
|
|
10
|
+
* @param {HTMLElement} container
|
|
11
|
+
* @param {React.ReactNode} element
|
|
12
|
+
* @returns {{ unmount: () => void }}
|
|
13
|
+
*/
|
|
14
|
+
export function renderToContainer(container: HTMLElement, element: React.ReactNode): {
|
|
15
|
+
unmount: () => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Unmount a React tree from a container.
|
|
19
|
+
*
|
|
20
|
+
* Looks up the handle from `renderToContainer`, or falls back to the legacy
|
|
21
|
+
* `ReactDOM.unmountComponentAtNode` (for trees mounted outside the compat layer,
|
|
22
|
+
* e.g. by Enzyme in tests).
|
|
23
|
+
*
|
|
24
|
+
* @param {HTMLElement} container
|
|
25
|
+
* @returns {void}
|
|
26
|
+
*/
|
|
27
|
+
export function unmountFromContainer(container: HTMLElement): void;
|