@jbrowse/display-ui 5.0.0-beta.2 → 5.0.0-beta.4

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.
@@ -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 — guides, a tooltip, a
5
- * highlighted column — rendered off the chrome's `mouseTracker` in a leaf of
6
- * its own, so a mousemove re-renders this and nothing else. Read in the
7
- * component that mounts `DisplayChrome` instead, the position would re-render
8
- * the chrome, its status container and every overlay under it on each move
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
- * `rowsTopOffset` answers whether the pointer is over the rows rather than a
12
- * band stacked above them, for a display that gates its crosshair to the rows:
13
- * a guide drawn while the pointer is over a variant lane or a connector zone
14
- * names a row the pointer is not on. The tooltip is usually not gated with it,
15
- * which is why the child decides. `children` is also handed an absent state, so
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 function PointerLayer({ mouseTracker, rowsTopOffset, children, }: {
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
- }): import("react").JSX.Element;
20
+ }) => ReactNode;
@@ -1,30 +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 — guides, a tooltip, a
7
- * highlighted column — rendered off the chrome's `mouseTracker` in a leaf of
8
- * its own, so a mousemove re-renders this and nothing else. Read in the
9
- * component that mounts `DisplayChrome` instead, the position would re-render
10
- * the chrome, its status container and every overlay under it on each move
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
- * `rowsTopOffset` answers whether the pointer is over the rows rather than a
14
- * band stacked above them, for a display that gates its crosshair to the rows:
15
- * a guide drawn while the pointer is over a variant lane or a connector zone
16
- * names a row the pointer is not on. The tooltip is usually not gated with it,
17
- * which is why the child decides. `children` is also handed an absent state, so
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, }) {
25
- // >=: the rows begin AT the offset (their container sits at
26
- // `top: rowsTopOffset`), so the boundary pixel is row 0's top edge — and with
27
- // no band above, y=0 is the display's own top edge, not a dead line.
18
+ export const PointerLayer = observer(function PointerLayer({ mouseTracker, rowsTopOffset = 0, children, }) {
28
19
  const state = useMouseState(mouseTracker);
29
- return _jsx(_Fragment, { children: children(state, !!state && state.y >= rowsTopOffset) });
30
- }
20
+ return children(state, !!state && state.y >= rowsTopOffset);
21
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/display-ui",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.4",
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.2"
27
+ "@jbrowse/core": "^5.0.0-beta.4"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=19.0.0",