@jbrowse/display-ui 5.0.0-beta.1 → 5.0.0-beta.3
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/esm/FloatingSvgOverlay.d.ts +5 -0
- package/esm/FloatingSvgOverlay.js +25 -0
- package/esm/PointerLayer.d.ts +12 -18
- package/esm/PointerLayer.js +14 -20
- package/esm/index.d.ts +1 -0
- package/esm/index.js +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { observer } from 'mobx-react';
|
|
3
|
+
import { TrackOverlayPortal } from './trackOverlay/TrackOverlayPortal.js';
|
|
4
|
+
// Lifts an SVG legend / chrome above the inter-region padding masks: a
|
|
5
|
+
// full-track, pointer-events:none <svg> portaled into the TrackContainer overlay
|
|
6
|
+
// node (see TrackOverlayPortal). The SVG counterpart to the HTML overlays
|
|
7
|
+
// (FloatingLegend, HicOverlayPanel) — used where the same legend
|
|
8
|
+
// markup is also drawn by an SVG-export path, so it must stay <svg>.
|
|
9
|
+
//
|
|
10
|
+
// Children draw in <svg> user space; the wrapping <svg> stays pointer-events:none
|
|
11
|
+
// so it doesn't eat canvas events, so any interactive sub-content (a dismiss
|
|
12
|
+
// "×", clickable swatches) must set pointer-events:auto on its own element.
|
|
13
|
+
// fallbackInline={false}: outside a TrackContainer it renders nothing, matching
|
|
14
|
+
// callers whose export path draws its own inline legend.
|
|
15
|
+
export const FloatingSvgOverlay = observer(function FloatingSvgOverlay({ width, height, children, }) {
|
|
16
|
+
return (_jsx(TrackOverlayPortal, { fallbackInline: false, children: _jsx("svg", { style: {
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
top: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
pointerEvents: 'none',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
}, children: children }) }));
|
|
25
|
+
});
|
package/esm/PointerLayer.d.ts
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import type { MouseState, MouseTracker } from '@jbrowse/core/ui/useMouseTracking';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
|
-
* The part of a display that follows the pointer
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* (see `useMouseTracking`).
|
|
4
|
+
* The part of a display that follows the pointer, in a leaf of its own so a
|
|
5
|
+
* mousemove re-renders this and not the chrome, its status container and every
|
|
6
|
+
* overlay under it (see `useMouseTracking`). An observer, so a model read in
|
|
7
|
+
* `children` is tracked here too rather than freezing under a stationary
|
|
8
|
+
* cursor.
|
|
10
9
|
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* a layer that has to render while nothing is hovered — the matrix display's
|
|
17
|
-
* connector lines, with no column highlighted — can.
|
|
18
|
-
*
|
|
19
|
-
* Four displays used to write this component out, with the same paragraph over
|
|
20
|
-
* each.
|
|
10
|
+
* `inRows` is whether the pointer is past `rowsTopOffset`, the bands a display
|
|
11
|
+
* stacks above its rows — a crosshair drawn over one names a row the pointer is
|
|
12
|
+
* not on, and `>=` because the rows begin AT the offset. A tooltip usually
|
|
13
|
+
* wants it ungated, which is why the child decides, and `children` is handed an
|
|
14
|
+
* absent state so a layer that draws with nothing hovered still can.
|
|
21
15
|
*/
|
|
22
|
-
export declare
|
|
16
|
+
export declare const PointerLayer: ({ mouseTracker, rowsTopOffset, children, }: {
|
|
23
17
|
mouseTracker: MouseTracker;
|
|
24
18
|
rowsTopOffset?: number;
|
|
25
19
|
children: (state: MouseState | undefined, inRows: boolean) => ReactNode;
|
|
26
|
-
})
|
|
20
|
+
}) => ReactNode;
|
package/esm/PointerLayer.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// deep subpath, never the `@jbrowse/core/ui` barrel: this package reaches no
|
|
3
2
|
// UI toolkit, and the barrel pulls MUI in
|
|
4
3
|
import { useMouseState } from '@jbrowse/core/ui/useMouseTracking';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
5
|
/**
|
|
6
|
-
* The part of a display that follows the pointer
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* (see `useMouseTracking`).
|
|
6
|
+
* The part of a display that follows the pointer, in a leaf of its own so a
|
|
7
|
+
* mousemove re-renders this and not the chrome, its status container and every
|
|
8
|
+
* overlay under it (see `useMouseTracking`). An observer, so a model read in
|
|
9
|
+
* `children` is tracked here too rather than freezing under a stationary
|
|
10
|
+
* cursor.
|
|
12
11
|
*
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* a layer that has to render while nothing is hovered — the matrix display's
|
|
19
|
-
* connector lines, with no column highlighted — can.
|
|
20
|
-
*
|
|
21
|
-
* Four displays used to write this component out, with the same paragraph over
|
|
22
|
-
* each.
|
|
12
|
+
* `inRows` is whether the pointer is past `rowsTopOffset`, the bands a display
|
|
13
|
+
* stacks above its rows — a crosshair drawn over one names a row the pointer is
|
|
14
|
+
* not on, and `>=` because the rows begin AT the offset. A tooltip usually
|
|
15
|
+
* wants it ungated, which is why the child decides, and `children` is handed an
|
|
16
|
+
* absent state so a layer that draws with nothing hovered still can.
|
|
23
17
|
*/
|
|
24
|
-
export function PointerLayer({ mouseTracker, rowsTopOffset = 0, children, }) {
|
|
18
|
+
export const PointerLayer = observer(function PointerLayer({ mouseTracker, rowsTopOffset = 0, children, }) {
|
|
25
19
|
const state = useMouseState(mouseTracker);
|
|
26
|
-
return
|
|
27
|
-
}
|
|
20
|
+
return children(state, !!state && state.y >= rowsTopOffset);
|
|
21
|
+
});
|
package/esm/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type { TrackControlMenu } from './trackControl/useTrackControlMenu.tsx';
|
|
|
9
9
|
export type { TrackControlComponent, TrackControlIcon, TrackControlOption, TrackControlProps, } from './trackControl/types.ts';
|
|
10
10
|
export { default as FloatingLegend } from './FloatingLegend.tsx';
|
|
11
11
|
export type { LegendItem, LegendSection } from './FloatingLegend.tsx';
|
|
12
|
+
export { FloatingSvgOverlay } from './FloatingSvgOverlay.tsx';
|
|
12
13
|
export { default as Tooltip } from './tooltip/Tooltip.tsx';
|
|
13
14
|
export { useTooltip } from './tooltip/useTooltip.tsx';
|
|
14
15
|
export type { TooltipTrigger } from './tooltip/useTooltip.tsx';
|
package/esm/index.js
CHANGED
|
@@ -23,6 +23,12 @@ export { useTrackControlMenu } from './trackControl/useTrackControlMenu.js';
|
|
|
23
23
|
// a display draws that is not its data. `@jbrowse/plugin-linear-genome-view`
|
|
24
24
|
// re-exports it, so its published name is unchanged.
|
|
25
25
|
export { default as FloatingLegend } from './FloatingLegend.js';
|
|
26
|
+
// The <svg> counterpart of that legend, for a display whose key is drawn by an
|
|
27
|
+
// SVG-export path as well as on screen. Beside it for the same reasons — it
|
|
28
|
+
// reaches no UI toolkit, and portaling chrome above the region masks is what
|
|
29
|
+
// this package is — and re-exported by `@jbrowse/plugin-linear-genome-view`, so
|
|
30
|
+
// its published name is unchanged.
|
|
31
|
+
export { FloatingSvgOverlay } from './FloatingSvgOverlay.js';
|
|
26
32
|
// The hover label every control in here used to delegate to the browser's
|
|
27
33
|
// `title` attribute. The box it draws is `@jbrowse/core`'s `BaseTooltip`, the
|
|
28
34
|
// same one the display tooltips draw, anchored to the control instead of to the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/display-ui",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The UI a display draws that is not data: the swappable chrome contract, its toolkit-free implementations, and the track overlay layer",
|
|
6
6
|
"keywords": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@jbrowse/mobx-state-tree": "^6.5.1",
|
|
26
26
|
"mobx-react": "^10.0.2",
|
|
27
|
-
"@jbrowse/core": "^5.0.0-beta.
|
|
27
|
+
"@jbrowse/core": "^5.0.0-beta.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=19.0.0",
|