react-cheminfo 0.14.0 → 0.16.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/README.md +175 -21
- package/lib/about/core/about.d.ts +13 -7
- package/lib/about/core/about.d.ts.map +1 -1
- package/lib/about/core/about.js +4 -2
- package/lib/about/core/about.js.map +1 -1
- package/lib/about/ui/AboutBuild.d.ts +20 -0
- package/lib/about/ui/AboutBuild.d.ts.map +1 -0
- package/lib/about/ui/AboutBuild.js +38 -0
- package/lib/about/ui/AboutBuild.js.map +1 -0
- package/lib/about/ui/AboutPage.d.ts +7 -0
- package/lib/about/ui/AboutPage.d.ts.map +1 -1
- package/lib/about/ui/AboutPage.js +5 -2
- package/lib/about/ui/AboutPage.js.map +1 -1
- package/lib/about/ui/index.d.ts +2 -0
- package/lib/about/ui/index.d.ts.map +1 -1
- package/lib/about/ui/index.js +1 -0
- package/lib/about/ui/index.js.map +1 -1
- package/lib/build/core/buildInfo.d.ts +39 -0
- package/lib/build/core/buildInfo.d.ts.map +1 -0
- package/lib/build/core/buildInfo.js +20 -0
- package/lib/build/core/buildInfo.js.map +1 -0
- package/lib/build/core/current.d.ts +12 -0
- package/lib/build/core/current.d.ts.map +1 -0
- package/lib/build/core/current.js +11 -0
- package/lib/build/core/current.js.map +1 -0
- package/lib/build/core/index.d.ts +3 -0
- package/lib/build/core/index.d.ts.map +1 -0
- package/lib/build/core/index.js +2 -0
- package/lib/build/core/index.js.map +1 -0
- package/lib/build/vite/buildInfo.d.ts +57 -0
- package/lib/build/vite/buildInfo.d.ts.map +1 -0
- package/lib/build/vite/buildInfo.js +151 -0
- package/lib/build/vite/buildInfo.js.map +1 -0
- package/lib/build/vite/gitHead.d.ts +29 -0
- package/lib/build/vite/gitHead.d.ts.map +1 -0
- package/lib/build/vite/gitHead.js +102 -0
- package/lib/build/vite/gitHead.js.map +1 -0
- package/lib/build/vite/index.d.ts +4 -0
- package/lib/build/vite/index.d.ts.map +1 -0
- package/lib/build/vite/index.js +3 -0
- package/lib/build/vite/index.js.map +1 -0
- package/lib/build-info.d.ts +3 -0
- package/lib/build-info.d.ts.map +1 -0
- package/lib/build-info.js +2 -0
- package/lib/build-info.js.map +1 -0
- package/lib/core.d.ts +2 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +2 -0
- package/lib/core.js.map +1 -1
- package/lib/credits/core/credits.d.ts +35 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +41 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +40 -0
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/ui/Wordmark.d.ts +14 -3
- package/lib/ecosystem/ui/Wordmark.d.ts.map +1 -1
- package/lib/ecosystem/ui/Wordmark.js +8 -4
- package/lib/ecosystem/ui/Wordmark.js.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +11 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/parallel/core/index.d.ts +27 -0
- package/lib/parallel/core/index.d.ts.map +1 -0
- package/lib/parallel/core/index.js +20 -0
- package/lib/parallel/core/index.js.map +1 -0
- package/lib/parallel/core/parallelAxes.d.ts +103 -0
- package/lib/parallel/core/parallelAxes.d.ts.map +1 -0
- package/lib/parallel/core/parallelAxes.js +146 -0
- package/lib/parallel/core/parallelAxes.js.map +1 -0
- package/lib/parallel/core/parallelBrush.d.ts +79 -0
- package/lib/parallel/core/parallelBrush.d.ts.map +1 -0
- package/lib/parallel/core/parallelBrush.js +99 -0
- package/lib/parallel/core/parallelBrush.js.map +1 -0
- package/lib/parallel/core/parallelExtent.d.ts +28 -0
- package/lib/parallel/core/parallelExtent.d.ts.map +1 -0
- package/lib/parallel/core/parallelExtent.js +47 -0
- package/lib/parallel/core/parallelExtent.js.map +1 -0
- package/lib/parallel/core/parallelFilter.d.ts +36 -0
- package/lib/parallel/core/parallelFilter.d.ts.map +1 -0
- package/lib/parallel/core/parallelFilter.js +74 -0
- package/lib/parallel/core/parallelFilter.js.map +1 -0
- package/lib/parallel/core/parallelHit.d.ts +47 -0
- package/lib/parallel/core/parallelHit.d.ts.map +1 -0
- package/lib/parallel/core/parallelHit.js +81 -0
- package/lib/parallel/core/parallelHit.js.map +1 -0
- package/lib/parallel/core/parallelPaint.d.ts +104 -0
- package/lib/parallel/core/parallelPaint.d.ts.map +1 -0
- package/lib/parallel/core/parallelPaint.js +160 -0
- package/lib/parallel/core/parallelPaint.js.map +1 -0
- package/lib/parallel/core/parallelPalette.d.ts +31 -0
- package/lib/parallel/core/parallelPalette.d.ts.map +1 -0
- package/lib/parallel/core/parallelPalette.js +68 -0
- package/lib/parallel/core/parallelPalette.js.map +1 -0
- package/lib/parallel/core/parallelTicks.d.ts +34 -0
- package/lib/parallel/core/parallelTicks.d.ts.map +1 -0
- package/lib/parallel/core/parallelTicks.js +116 -0
- package/lib/parallel/core/parallelTicks.js.map +1 -0
- package/lib/parallel/core/parallelTypes.d.ts +129 -0
- package/lib/parallel/core/parallelTypes.d.ts.map +1 -0
- package/lib/parallel/core/parallelTypes.js +29 -0
- package/lib/parallel/core/parallelTypes.js.map +1 -0
- package/lib/parallel/ui/ParallelAxesLayer.d.ts +28 -0
- package/lib/parallel/ui/ParallelAxesLayer.d.ts.map +1 -0
- package/lib/parallel/ui/ParallelAxesLayer.js +29 -0
- package/lib/parallel/ui/ParallelAxesLayer.js.map +1 -0
- package/lib/parallel/ui/ParallelCoordinates.d.ts +21 -0
- package/lib/parallel/ui/ParallelCoordinates.d.ts.map +1 -0
- package/lib/parallel/ui/ParallelCoordinates.js +109 -0
- package/lib/parallel/ui/ParallelCoordinates.js.map +1 -0
- package/lib/parallel/ui/ParallelLabels.d.ts +26 -0
- package/lib/parallel/ui/ParallelLabels.d.ts.map +1 -0
- package/lib/parallel/ui/ParallelLabels.js +25 -0
- package/lib/parallel/ui/ParallelLabels.js.map +1 -0
- package/lib/parallel/ui/ParallelTooltip.d.ts +26 -0
- package/lib/parallel/ui/ParallelTooltip.d.ts.map +1 -0
- package/lib/parallel/ui/ParallelTooltip.js +30 -0
- package/lib/parallel/ui/ParallelTooltip.js.map +1 -0
- package/lib/parallel/ui/index.d.ts +25 -0
- package/lib/parallel/ui/index.d.ts.map +1 -0
- package/lib/parallel/ui/index.js +18 -0
- package/lib/parallel/ui/index.js.map +1 -0
- package/lib/parallel/ui/parallelCoordinatesProps.d.ts +185 -0
- package/lib/parallel/ui/parallelCoordinatesProps.d.ts.map +1 -0
- package/lib/parallel/ui/parallelCoordinatesProps.js +11 -0
- package/lib/parallel/ui/parallelCoordinatesProps.js.map +1 -0
- package/lib/parallel/ui/parallelGestureModel.d.ts +52 -0
- package/lib/parallel/ui/parallelGestureModel.d.ts.map +1 -0
- package/lib/parallel/ui/parallelGestureModel.js +80 -0
- package/lib/parallel/ui/parallelGestureModel.js.map +1 -0
- package/lib/parallel/ui/parallelInk.d.ts +76 -0
- package/lib/parallel/ui/parallelInk.d.ts.map +1 -0
- package/lib/parallel/ui/parallelInk.js +113 -0
- package/lib/parallel/ui/parallelInk.js.map +1 -0
- package/lib/parallel/ui/parallelPlotModel.d.ts +55 -0
- package/lib/parallel/ui/parallelPlotModel.d.ts.map +1 -0
- package/lib/parallel/ui/parallelPlotModel.js +113 -0
- package/lib/parallel/ui/parallelPlotModel.js.map +1 -0
- package/lib/parallel/ui/parallelStyles.d.ts +83 -0
- package/lib/parallel/ui/parallelStyles.d.ts.map +1 -0
- package/lib/parallel/ui/parallelStyles.js +131 -0
- package/lib/parallel/ui/parallelStyles.js.map +1 -0
- package/lib/parallel/ui/useParallelCanvas.d.ts +49 -0
- package/lib/parallel/ui/useParallelCanvas.d.ts.map +1 -0
- package/lib/parallel/ui/useParallelCanvas.js +58 -0
- package/lib/parallel/ui/useParallelCanvas.js.map +1 -0
- package/lib/parallel/ui/useParallelGesture.d.ts +67 -0
- package/lib/parallel/ui/useParallelGesture.d.ts.map +1 -0
- package/lib/parallel/ui/useParallelGesture.js +139 -0
- package/lib/parallel/ui/useParallelGesture.js.map +1 -0
- package/lib/structure/ui/useToolbarFloor.d.ts.map +1 -1
- package/lib/structure/ui/useToolbarFloor.js +29 -22
- package/lib/structure/ui/useToolbarFloor.js.map +1 -1
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/lib/vite.d.ts +1 -0
- package/lib/vite.d.ts.map +1 -1
- package/lib/vite.js +1 -0
- package/lib/vite.js.map +1 -1
- package/package.json +2 -1
- package/src/about/core/about.ts +18 -9
- package/src/about/ui/AboutBuild.tsx +83 -0
- package/src/about/ui/AboutPage.tsx +15 -7
- package/src/about/ui/index.ts +2 -0
- package/src/build/core/buildInfo.ts +48 -0
- package/src/build/core/current.ts +12 -0
- package/src/build/core/index.ts +2 -0
- package/src/build/vite/buildInfo.ts +178 -0
- package/src/build/vite/gitHead.ts +114 -0
- package/src/build/vite/index.ts +8 -0
- package/src/build-info.ts +2 -0
- package/src/core.ts +2 -0
- package/src/credits/core/credits.ts +42 -0
- package/src/ecosystem/core/sites.ts +40 -0
- package/src/ecosystem/core/types.ts +4 -1
- package/src/ecosystem/ui/Wordmark.tsx +22 -7
- package/src/ecosystem/ui/glyphs.tsx +46 -0
- package/src/parallel/core/index.ts +80 -0
- package/src/parallel/core/parallelAxes.ts +207 -0
- package/src/parallel/core/parallelBrush.ts +145 -0
- package/src/parallel/core/parallelExtent.ts +56 -0
- package/src/parallel/core/parallelFilter.ts +94 -0
- package/src/parallel/core/parallelHit.ts +106 -0
- package/src/parallel/core/parallelPaint.ts +231 -0
- package/src/parallel/core/parallelPalette.ts +80 -0
- package/src/parallel/core/parallelTicks.ts +164 -0
- package/src/parallel/core/parallelTypes.ts +147 -0
- package/src/parallel/ui/ParallelAxesLayer.tsx +123 -0
- package/src/parallel/ui/ParallelCoordinates.tsx +233 -0
- package/src/parallel/ui/ParallelLabels.tsx +56 -0
- package/src/parallel/ui/ParallelTooltip.tsx +55 -0
- package/src/parallel/ui/index.ts +50 -0
- package/src/parallel/ui/parallelCoordinatesProps.ts +199 -0
- package/src/parallel/ui/parallelGestureModel.ts +109 -0
- package/src/parallel/ui/parallelInk.ts +182 -0
- package/src/parallel/ui/parallelPlotModel.ts +130 -0
- package/src/parallel/ui/parallelStyles.ts +146 -0
- package/src/parallel/ui/useParallelCanvas.ts +104 -0
- package/src/parallel/ui/useParallelGesture.ts +227 -0
- package/src/structure/ui/useToolbarFloor.ts +27 -22
- package/src/ui.ts +1 -0
- package/src/vite.ts +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PARALLEL_MARGIN, parallelValueToY } from "../core/parallelAxes.js";
|
|
3
|
+
import { PARALLEL_BRUSH_HALF_WIDTH } from "../core/parallelBrush.js";
|
|
4
|
+
import { PARALLEL_HANDLE_HEIGHT, PARALLEL_TICK_LABEL_INSET, PARALLEL_TICK_LABEL_STYLE, PARALLEL_TICK_LENGTH, parallelBandStyle, parallelHandleStyle, } from "./parallelStyles.js";
|
|
5
|
+
/**
|
|
6
|
+
* The axes, their graduations and the intervals brushed on them.
|
|
7
|
+
*
|
|
8
|
+
* Every axis carries a `data-parallel-brush` rectangle over the strip a press
|
|
9
|
+
* on it reaches, which nothing points at: one surface over the whole figure
|
|
10
|
+
* takes every event, so the rectangle exists to be found — by a test driving
|
|
11
|
+
* a drag, and by a reader's eye, which is the same thing.
|
|
12
|
+
* @param props - See {@link ParallelAxesLayerProps}.
|
|
13
|
+
* @returns The axes.
|
|
14
|
+
*/
|
|
15
|
+
export function ParallelAxesLayer(props) {
|
|
16
|
+
const { layouts, innerHeight, bands, axisInk, bandInk } = props;
|
|
17
|
+
const stroke = { stroke: axisInk };
|
|
18
|
+
return (_jsx("g", { transform: `translate(${PARALLEL_MARGIN.left},${PARALLEL_MARGIN.top})`, style: { fill: axisInk }, textAnchor: "middle", children: layouts.map((layout) => {
|
|
19
|
+
const band = bands.get(layout.id) ?? null;
|
|
20
|
+
return (_jsxs("g", { className: "parallel-axis", "data-parallel-axis": layout.id, transform: `translate(${layout.x},0)`, children: [_jsx("line", { y2: innerHeight, style: stroke }), layout.ticks.map((tick) => (_jsxs("g", { transform: `translate(0,${parallelValueToY(tick.value, layout)})`, children: [_jsx("line", { x1: -PARALLEL_TICK_LENGTH, style: stroke }), _jsx("text", { x: -PARALLEL_TICK_LABEL_INSET, dy: "0.32em", textAnchor: "end", style: PARALLEL_TICK_LABEL_STYLE, children: tick.label })] }, tick.value))), _jsx("rect", { "data-parallel-brush": layout.id, x: -PARALLEL_BRUSH_HALF_WIDTH, y: 0, width: PARALLEL_BRUSH_HALF_WIDTH * 2, height: Math.max(0, innerHeight), fill: "transparent", pointerEvents: "none" }), band === null ? null : _jsx(BrushBand, { band: band, ink: bandInk })] }, layout.id));
|
|
21
|
+
}) }));
|
|
22
|
+
}
|
|
23
|
+
function BrushBand(props) {
|
|
24
|
+
const { band, ink } = props;
|
|
25
|
+
const height = Math.max(0, band.bottom - band.top);
|
|
26
|
+
const width = PARALLEL_BRUSH_HALF_WIDTH * 2;
|
|
27
|
+
return (_jsxs("g", { className: "parallel-axis-band", pointerEvents: "none", children: [_jsx("rect", { x: -PARALLEL_BRUSH_HALF_WIDTH, y: band.top, width: width, height: height, style: parallelBandStyle(ink) }), _jsx("rect", { x: -PARALLEL_BRUSH_HALF_WIDTH, y: band.top - PARALLEL_HANDLE_HEIGHT / 2, width: width, height: PARALLEL_HANDLE_HEIGHT, style: parallelHandleStyle(ink) }), _jsx("rect", { x: -PARALLEL_BRUSH_HALF_WIDTH, y: band.bottom - PARALLEL_HANDLE_HEIGHT / 2, width: width, height: PARALLEL_HANDLE_HEIGHT, style: parallelHandleStyle(ink) })] }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ParallelAxesLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelAxesLayer.js","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelAxesLayer.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAgB7B;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAChE,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAEnC,OAAO,CACL,YACE,SAAS,EAAE,aAAa,eAAe,CAAC,IAAI,IAAI,eAAe,CAAC,GAAG,GAAG,EACtE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACxB,UAAU,EAAC,QAAQ,YAElB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACtB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;YAC1C,OAAO,CACL,aAEE,SAAS,EAAC,eAAe,wBACL,MAAM,CAAC,EAAE,EAC7B,SAAS,EAAE,aAAa,MAAM,CAAC,CAAC,KAAK,aAErC,eAAM,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAI,EACvC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,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AK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAC7B,EACF,eACE,CAAC,EAAE,CAAC,yBAAyB,EAC7B,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,sBAAsB,GAAG,CAAC,EACxC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,sBAAsB,EAC9B,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAC/B,EACF,eACE,CAAC,EAAE,CAAC,yBAAyB,EAC7B,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,sBAAsB,GAAG,CAAC,EAC3C,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,sBAAsB,EAC9B,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAC/B,IACA,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { ParallelCoordinatesProps } from './parallelCoordinatesProps.ts';
|
|
3
|
+
/**
|
|
4
|
+
* One vertical axis per column, one line per row, and a brush on every axis.
|
|
5
|
+
*
|
|
6
|
+
* It is told nothing about what the rows are: a library of molecules, a set of
|
|
7
|
+
* runs and a table of measurements all arrive as one `ArrayLike<number>` per
|
|
8
|
+
* axis, read in place. The lines are painted into a canvas because ten
|
|
9
|
+
* thousand of them are not ten thousand elements; everything the reader points
|
|
10
|
+
* at, brushes or reads is SVG and HTML over the top.
|
|
11
|
+
*
|
|
12
|
+
* The brush reports on release, never while the band is being dragged, so a
|
|
13
|
+
* table filtering on the same intervals re-renders once per gesture. What it
|
|
14
|
+
* keeps is `parallelIncludedMask`, which that table should filter with — two
|
|
15
|
+
* definitions of "kept" is how a figure and the list under it come to disagree.
|
|
16
|
+
* @param props - See {@link ParallelCoordinatesProps}.
|
|
17
|
+
* @returns The figure, or what the caller asked to show in its place when
|
|
18
|
+
* there is nothing to draw.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ParallelCoordinates(props: ParallelCoordinatesProps): ReactElement;
|
|
21
|
+
//# sourceMappingURL=ParallelCoordinates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelCoordinates.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelCoordinates.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAoB1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AA0B9E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,YAAY,CAiKd"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { OverlayLayer } from "../../overlay/ui/OverlayLayer.js";
|
|
4
|
+
import { joinClassNames } from "../../shared/ui/joinClassNames.js";
|
|
5
|
+
import { PARALLEL_MARGIN, parallelAxisLayouts } from "../core/parallelAxes.js";
|
|
6
|
+
import { parallelIncludedMask } from "../core/parallelFilter.js";
|
|
7
|
+
import { parallelColorSteps, parallelPalette, } from "../core/parallelPalette.js";
|
|
8
|
+
import { ParallelAxesLayer } from "./ParallelAxesLayer.js";
|
|
9
|
+
import { ParallelLabels } from "./ParallelLabels.js";
|
|
10
|
+
import { ParallelTooltip } from "./ParallelTooltip.js";
|
|
11
|
+
import { useParallelInk } from "./parallelInk.js";
|
|
12
|
+
import { parallelColorOf, parallelFigureLabel, parallelHighlightsOf, parallelIsBrushed, parallelRowCount, } from "./parallelPlotModel.js";
|
|
13
|
+
import { PARALLEL_SVG_STYLE, parallelCanvasStyle, parallelFigureStyle, } from "./parallelStyles.js";
|
|
14
|
+
import { useParallelCanvas } from "./useParallelCanvas.js";
|
|
15
|
+
import { useParallelGesture } from "./useParallelGesture.js";
|
|
16
|
+
/** Height the figure takes when the caller names none. */
|
|
17
|
+
const DEFAULT_HEIGHT = 320;
|
|
18
|
+
/** The smallest drawing area the figure will lay out, in pixels. */
|
|
19
|
+
const SMALLEST_SIDE = 10;
|
|
20
|
+
/** No axis is brushed, shared so an uncontrolled figure never rebuilds it. */
|
|
21
|
+
const NO_RANGES = Object.freeze({});
|
|
22
|
+
/**
|
|
23
|
+
* One vertical axis per column, one line per row, and a brush on every axis.
|
|
24
|
+
*
|
|
25
|
+
* It is told nothing about what the rows are: a library of molecules, a set of
|
|
26
|
+
* runs and a table of measurements all arrive as one `ArrayLike<number>` per
|
|
27
|
+
* axis, read in place. The lines are painted into a canvas because ten
|
|
28
|
+
* thousand of them are not ten thousand elements; everything the reader points
|
|
29
|
+
* at, brushes or reads is SVG and HTML over the top.
|
|
30
|
+
*
|
|
31
|
+
* The brush reports on release, never while the band is being dragged, so a
|
|
32
|
+
* table filtering on the same intervals re-renders once per gesture. What it
|
|
33
|
+
* keeps is `parallelIncludedMask`, which that table should filter with — two
|
|
34
|
+
* definitions of "kept" is how a figure and the list under it come to disagree.
|
|
35
|
+
* @param props - See {@link ParallelCoordinatesProps}.
|
|
36
|
+
* @returns The figure, or what the caller asked to show in its place when
|
|
37
|
+
* there is nothing to draw.
|
|
38
|
+
*/
|
|
39
|
+
export function ParallelCoordinates(props) {
|
|
40
|
+
const { axes, width, height = DEFAULT_HEIGHT, empty, overlay } = props;
|
|
41
|
+
const { selected, renderTooltip, renderAxisLabel } = props;
|
|
42
|
+
const { className, testId, ink: inkProp, label: given } = props;
|
|
43
|
+
const { ranges: ownedRanges, defaultRanges, included: givenMask } = props;
|
|
44
|
+
const { color: givenColor, colorAxis, onRangeChange: report } = props;
|
|
45
|
+
const { onRangePreview, hovered, onHoverChange, onRowClick } = props;
|
|
46
|
+
const count = parallelRowCount(axes, props.count);
|
|
47
|
+
const innerWidth = Math.max(width - PARALLEL_MARGIN.left - PARALLEL_MARGIN.right, SMALLEST_SIDE);
|
|
48
|
+
const innerHeight = Math.max(height - PARALLEL_MARGIN.top - PARALLEL_MARGIN.bottom, SMALLEST_SIDE);
|
|
49
|
+
const [ownRanges, setOwnRanges] = useState(defaultRanges ?? NO_RANGES);
|
|
50
|
+
const ranges = ownedRanges ?? ownRanges;
|
|
51
|
+
const layouts = useMemo(() => parallelAxisLayouts(axes, count, innerWidth, innerHeight), [axes, count, innerWidth, innerHeight]);
|
|
52
|
+
const values = useMemo(() => columnsOf(axes), [axes]);
|
|
53
|
+
const { ink, ref: figure } = useParallelInk(inkProp);
|
|
54
|
+
const color = useMemo(() => parallelColorOf(givenColor, colorAxis, axes), [givenColor, colorAxis, axes]);
|
|
55
|
+
const steps = useMemo(() => (color === undefined ? null : parallelColorSteps(color, count)), [color, count]);
|
|
56
|
+
const palette = useMemo(() => (color === undefined ? [] : parallelPalette(color.scale)), [color]);
|
|
57
|
+
const included = useMemo(() => {
|
|
58
|
+
if (givenMask !== undefined)
|
|
59
|
+
return givenMask;
|
|
60
|
+
if (!parallelIsBrushed(axes, ranges))
|
|
61
|
+
return null;
|
|
62
|
+
return parallelIncludedMask(axes, ranges, count);
|
|
63
|
+
}, [givenMask, axes, ranges, count]);
|
|
64
|
+
function commitRange(axisId, range) {
|
|
65
|
+
if (ownedRanges === undefined) {
|
|
66
|
+
setOwnRanges((previous) => ({ ...previous, [axisId]: range }));
|
|
67
|
+
}
|
|
68
|
+
report?.(axisId, range);
|
|
69
|
+
}
|
|
70
|
+
const gesture = useParallelGesture({
|
|
71
|
+
layouts,
|
|
72
|
+
values,
|
|
73
|
+
count,
|
|
74
|
+
innerHeight,
|
|
75
|
+
included,
|
|
76
|
+
ranges,
|
|
77
|
+
onRangeChange: commitRange,
|
|
78
|
+
onRangePreview,
|
|
79
|
+
hovered,
|
|
80
|
+
onHoverChange,
|
|
81
|
+
onRowClick,
|
|
82
|
+
});
|
|
83
|
+
const highlights = useMemo(() => parallelHighlightsOf(selected, gesture.hovered, ink.selection, ink.hover), [selected, gesture.hovered, ink.selection, ink.hover]);
|
|
84
|
+
const { lines: lineCanvas, marks: markCanvas } = useParallelCanvas({
|
|
85
|
+
width,
|
|
86
|
+
height,
|
|
87
|
+
layouts,
|
|
88
|
+
values,
|
|
89
|
+
count,
|
|
90
|
+
included,
|
|
91
|
+
steps,
|
|
92
|
+
palette,
|
|
93
|
+
highlights,
|
|
94
|
+
ink,
|
|
95
|
+
});
|
|
96
|
+
const label = given ?? parallelFigureLabel(axes, count);
|
|
97
|
+
const canvasStyle = parallelCanvasStyle(height);
|
|
98
|
+
const hover = gesture.pointer === null || gesture.hovered < 0
|
|
99
|
+
? null
|
|
100
|
+
: { index: gesture.hovered, ...gesture.pointer };
|
|
101
|
+
return (_jsxs("div", { ref: figure, className: joinClassNames('parallel-coordinates', className), style: parallelFigureStyle(height), "data-testid": testId, children: [count === 0 || layouts.length === 0 ? (empty) : (_jsxs(_Fragment, { children: [_jsx("canvas", { ref: lineCanvas, className: "parallel-coordinates-canvas", style: canvasStyle }), _jsx("canvas", { ref: markCanvas, className: "parallel-coordinates-canvas", style: canvasStyle }), _jsxs("svg", { width: Math.max(0, width), height: Math.max(0, height), style: PARALLEL_SVG_STYLE, role: "img", "aria-label": label, children: [_jsx(ParallelAxesLayer, { layouts: layouts, innerHeight: innerHeight, bands: gesture.bands, axisInk: ink.axis, bandInk: ink.selection }), _jsx("rect", { x: 0, y: 0, width: Math.max(0, width), height: Math.max(0, height), fill: "transparent", onClick: gesture.onClick, ...gesture.surface })] }), _jsx(ParallelLabels, { axes: axes, layouts: layouts, render: renderAxisLabel }), hover === null || renderTooltip === undefined ? null : (_jsx(ParallelTooltip, { x: hover.x, y: hover.y, boxWidth: width, boxHeight: height, children: renderTooltip(hover) }))] })), overlay === undefined ? null : (_jsx(OverlayLayer, { width: width, busy: gesture.brushing, children: overlay }))] }));
|
|
102
|
+
}
|
|
103
|
+
function columnsOf(axes) {
|
|
104
|
+
const columns = [];
|
|
105
|
+
for (const axis of axes)
|
|
106
|
+
columns.push(axis.values);
|
|
107
|
+
return columns;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ParallelCoordinates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelCoordinates.js","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelCoordinates.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,0DAA0D;AAC1D,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,oEAAoE;AACpE,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,8EAA8E;AAC9E,MAAM,SAAS,GAAmB,MAAM,CAAC,MAAM,CAAC,EAAE,C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eAAe,GACvB,EACD,KAAK,KAAK,IAAI,IAAI,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACtD,KAAC,eAAe,IACd,CAAC,EAAE,KAAK,CAAC,CAAC,EACV,CAAC,EAAE,KAAK,CAAC,CAAC,EACV,QAAQ,EAAE,KAAK,EACf,SAAS,EAAE,MAAM,YAEhB,aAAa,CAAC,KAAK,CAAC,GACL,CACnB,IACA,CACJ,EACA,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC9B,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,YAC/C,OAAO,GACK,CAChB,IACG,CACP,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAA6B;IAC9C,MAAM,OAAO,GAA6B,EAAE,CAAC;IAC7C,KAAK,MAAM,IAAI,IAAI,IAAI;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { ParallelAxisLayout } from '../core/parallelAxes.ts';
|
|
3
|
+
import type { ParallelAxis } from '../core/parallelTypes.ts';
|
|
4
|
+
/** What {@link ParallelLabels} writes. */
|
|
5
|
+
export interface ParallelLabelsProps {
|
|
6
|
+
/** The axes as the caller described them, for a caller's own renderer. */
|
|
7
|
+
axes: readonly ParallelAxis[];
|
|
8
|
+
/** The same axes, placed, so each name sits over its own axis. */
|
|
9
|
+
layouts: readonly ParallelAxisLayout[];
|
|
10
|
+
/**
|
|
11
|
+
* How a name is written. Left out, it is the label and the unit after it.
|
|
12
|
+
* @default undefined
|
|
13
|
+
*/
|
|
14
|
+
render?: ((axis: ParallelAxis, index: number) => ReactNode) | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The axis names, as HTML over the figure.
|
|
18
|
+
*
|
|
19
|
+
* HTML rather than SVG text so that a name can carry a tooltip explaining what
|
|
20
|
+
* the axis measures. The layer lets every pointer event through and only the
|
|
21
|
+
* names themselves take it back, so a brush started under a name still starts.
|
|
22
|
+
* @param props - See {@link ParallelLabelsProps}.
|
|
23
|
+
* @returns The names.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ParallelLabels(props: ParallelLabelsProps): ReactElement;
|
|
26
|
+
//# sourceMappingURL=ParallelLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelLabels.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelLabels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI7D,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAC9B,kEAAkE;IAClE,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,GAAG,SAAS,CAAC;CACzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAqBvE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PARALLEL_MARGIN } from "../core/parallelAxes.js";
|
|
3
|
+
import { PARALLEL_LABELS_STYLE, parallelLabelStyle } from "./parallelStyles.js";
|
|
4
|
+
/**
|
|
5
|
+
* The axis names, as HTML over the figure.
|
|
6
|
+
*
|
|
7
|
+
* HTML rather than SVG text so that a name can carry a tooltip explaining what
|
|
8
|
+
* the axis measures. The layer lets every pointer event through and only the
|
|
9
|
+
* names themselves take it back, so a brush started under a name still starts.
|
|
10
|
+
* @param props - See {@link ParallelLabelsProps}.
|
|
11
|
+
* @returns The names.
|
|
12
|
+
*/
|
|
13
|
+
export function ParallelLabels(props) {
|
|
14
|
+
const { axes, layouts, render } = props;
|
|
15
|
+
return (_jsx("div", { className: "parallel-coordinates-labels", style: PARALLEL_LABELS_STYLE, children: layouts.map((layout, index) => {
|
|
16
|
+
const axis = axes[index];
|
|
17
|
+
return (_jsx("div", { className: "parallel-axis-label", style: parallelLabelStyle(PARALLEL_MARGIN.left + layout.x), children: axis !== undefined && render !== undefined
|
|
18
|
+
? render(axis, index)
|
|
19
|
+
: defaultLabel(layout) }, layout.id));
|
|
20
|
+
}) }));
|
|
21
|
+
}
|
|
22
|
+
function defaultLabel(layout) {
|
|
23
|
+
return layout.unit === '' ? layout.label : `${layout.label} (${layout.unit})`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ParallelLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelLabels.js","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelLabels.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAehF;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAExC,OAAO,CACL,cAAK,SAAS,EAAC,6BAA6B,EAAC,KAAK,EAAE,qBAAqB,YACtE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,OAAO,CACL,cAEE,SAAS,EAAC,qBAAqB,EAC/B,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,YAEzD,IAAI,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;oBACzC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;oBACrB,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IANnB,MAAM,CAAC,EAAE,CAOV,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,MAA0B;IAC9C,OAAO,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/** What {@link ParallelTooltip} shows, and where. */
|
|
3
|
+
export interface ParallelTooltipProps {
|
|
4
|
+
/** Where the pointer is, in pixels from the figure's left edge. */
|
|
5
|
+
x: number;
|
|
6
|
+
/** Where it is, in pixels from its top edge. */
|
|
7
|
+
y: number;
|
|
8
|
+
/** Width of the figure, so the card is flipped rather than clipped. */
|
|
9
|
+
boxWidth: number;
|
|
10
|
+
/** Its height. */
|
|
11
|
+
boxHeight: number;
|
|
12
|
+
/** What the card says, written by the caller. */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The card over the row under the pointer.
|
|
17
|
+
*
|
|
18
|
+
* It measures itself and flips rather than being clipped, because a card that
|
|
19
|
+
* runs off the bottom right of a figure is exactly where a reader points last
|
|
20
|
+
* — and it never takes the pointer, so moving towards it never dismisses it by
|
|
21
|
+
* moving off the line underneath.
|
|
22
|
+
* @param props - See {@link ParallelTooltipProps}.
|
|
23
|
+
* @returns The card.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ParallelTooltip(props: ParallelTooltipProps): ReactElement;
|
|
26
|
+
//# sourceMappingURL=ParallelTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelTooltip.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrD,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,gDAAgD;IAChD,CAAC,EAAE,MAAM,CAAC;IACV,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAsBzE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useContainerSize } from "../../hooks/ui/useContainerSize.js";
|
|
4
|
+
import { placeOverlayCard } from "../../overlay/core/placeOverlayCard.js";
|
|
5
|
+
import { parallelTooltipStyle } from "./parallelStyles.js";
|
|
6
|
+
/**
|
|
7
|
+
* The card over the row under the pointer.
|
|
8
|
+
*
|
|
9
|
+
* It measures itself and flips rather than being clipped, because a card that
|
|
10
|
+
* runs off the bottom right of a figure is exactly where a reader points last
|
|
11
|
+
* — and it never takes the pointer, so moving towards it never dismisses it by
|
|
12
|
+
* moving off the line underneath.
|
|
13
|
+
* @param props - See {@link ParallelTooltipProps}.
|
|
14
|
+
* @returns The card.
|
|
15
|
+
*/
|
|
16
|
+
export function ParallelTooltip(props) {
|
|
17
|
+
const { x, y, boxWidth, boxHeight, children } = props;
|
|
18
|
+
const card = useRef(null);
|
|
19
|
+
const size = useContainerSize(card);
|
|
20
|
+
const placed = placeOverlayCard({
|
|
21
|
+
pointerX: x,
|
|
22
|
+
pointerY: y,
|
|
23
|
+
cardWidth: size.width,
|
|
24
|
+
cardHeight: size.height,
|
|
25
|
+
boxWidth,
|
|
26
|
+
boxHeight,
|
|
27
|
+
});
|
|
28
|
+
return (_jsx("div", { ref: card, className: "parallel-coordinates-tooltip", style: parallelTooltipStyle(placed.left, placed.top), children: children }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ParallelTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelTooltip.js","sourceRoot":"","sources":["../../../src/parallel/ui/ParallelTooltip.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAgB3D;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,IAAI,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAC9B,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,IAAI,CAAC,KAAK;QACrB,UAAU,EAAE,IAAI,CAAC,MAAM;QACvB,QAAQ;QACR,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,CACL,cACE,GAAG,EAAE,IAAI,EACT,SAAS,EAAC,8BAA8B,EACxC,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,YAEnD,QAAQ,GACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A parallel-coordinates figure the reader can interrogate: brush any axis to
|
|
3
|
+
* keep an interval of it, rest on a line for what is known about that row, and
|
|
4
|
+
* colour every line by whichever column answers the question being asked.
|
|
5
|
+
*
|
|
6
|
+
* Nothing here knows what the rows are. The same figure draws a library of
|
|
7
|
+
* molecules, a set of experimental runs and a table of measurements, which is
|
|
8
|
+
* why it is its own domain rather than part of the first viewer to want one.
|
|
9
|
+
*/
|
|
10
|
+
export { ParallelAxesLayer } from './ParallelAxesLayer.tsx';
|
|
11
|
+
export type { ParallelAxesLayerProps } from './ParallelAxesLayer.tsx';
|
|
12
|
+
export { ParallelCoordinates } from './ParallelCoordinates.tsx';
|
|
13
|
+
export type { ParallelCoordinatesProps, ParallelHover, ParallelInk, } from './parallelCoordinatesProps.ts';
|
|
14
|
+
export type { ParallelInkBinding, ParallelInkValues, ParallelTokenInk, } from './parallelInk.ts';
|
|
15
|
+
export { parallelInkFrom, readParallelInk, readParallelTokens, useParallelInk, } from './parallelInk.ts';
|
|
16
|
+
export { ParallelLabels } from './ParallelLabels.tsx';
|
|
17
|
+
export type { ParallelLabelsProps } from './ParallelLabels.tsx';
|
|
18
|
+
export { parallelColorOf, parallelFigureLabel, parallelHighlightsOf, parallelIsBrushed, parallelRowCount, } from './parallelPlotModel.ts';
|
|
19
|
+
export { ParallelTooltip } from './ParallelTooltip.tsx';
|
|
20
|
+
export type { ParallelTooltipProps } from './ParallelTooltip.tsx';
|
|
21
|
+
export type { ParallelCanvasOptions, ParallelCanvases, } from './useParallelCanvas.ts';
|
|
22
|
+
export { useParallelCanvas } from './useParallelCanvas.ts';
|
|
23
|
+
export type { ParallelGesture, ParallelGestureOptions, } from './useParallelGesture.ts';
|
|
24
|
+
export { useParallelGesture } from './useParallelGesture.ts';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EACV,wBAAwB,EACxB,aAAa,EACb,WAAW,GACZ,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EACV,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EACV,eAAe,EACf,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A parallel-coordinates figure the reader can interrogate: brush any axis to
|
|
3
|
+
* keep an interval of it, rest on a line for what is known about that row, and
|
|
4
|
+
* colour every line by whichever column answers the question being asked.
|
|
5
|
+
*
|
|
6
|
+
* Nothing here knows what the rows are. The same figure draws a library of
|
|
7
|
+
* molecules, a set of experimental runs and a table of measurements, which is
|
|
8
|
+
* why it is its own domain rather than part of the first viewer to want one.
|
|
9
|
+
*/
|
|
10
|
+
export { ParallelAxesLayer } from "./ParallelAxesLayer.js";
|
|
11
|
+
export { ParallelCoordinates } from "./ParallelCoordinates.js";
|
|
12
|
+
export { parallelInkFrom, readParallelInk, readParallelTokens, useParallelInk, } from "./parallelInk.js";
|
|
13
|
+
export { ParallelLabels } from "./ParallelLabels.js";
|
|
14
|
+
export { parallelColorOf, parallelFigureLabel, parallelHighlightsOf, parallelIsBrushed, parallelRowCount, } from "./parallelPlotModel.js";
|
|
15
|
+
export { ParallelTooltip } from "./ParallelTooltip.js";
|
|
16
|
+
export { useParallelCanvas } from "./useParallelCanvas.js";
|
|
17
|
+
export { useParallelGesture } from "./useParallelGesture.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parallel/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAWhE,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AAEtD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AAMxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAK3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a caller hands a `ParallelCoordinates`.
|
|
3
|
+
*
|
|
4
|
+
* The types the figure is *told* about — an axis, an interval, a colour ramp —
|
|
5
|
+
* live in `parallel/core`, because the same words describe the mask a table
|
|
6
|
+
* beside the figure filters on and the layout the painter reads. What is left
|
|
7
|
+
* here is what only a React component has: the render props, the inks a canvas
|
|
8
|
+
* cannot read off a stylesheet, and the controlled pairs.
|
|
9
|
+
*/
|
|
10
|
+
import type { ReactNode } from 'react';
|
|
11
|
+
import type { ParallelAxis, ParallelColorBy, ParallelRange, ParallelRanges } from '../core/parallelTypes.ts';
|
|
12
|
+
/** What the pointer is over, and where. */
|
|
13
|
+
export interface ParallelHover {
|
|
14
|
+
/** The row, as an index into the axes' value arrays. */
|
|
15
|
+
index: number;
|
|
16
|
+
/** Where the pointer is, in pixels from the figure's left edge. */
|
|
17
|
+
x: number;
|
|
18
|
+
/** Where it is, in pixels from its top edge. */
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
/** The colours a canvas is painted with, which cannot read a custom property. */
|
|
22
|
+
export interface ParallelInk {
|
|
23
|
+
/**
|
|
24
|
+
* The rows a brush left out, drawn under the rest.
|
|
25
|
+
* @default a light grey the dense mass can only converge on
|
|
26
|
+
*/
|
|
27
|
+
excluded?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The rows nothing is colouring, when no quantity was given.
|
|
30
|
+
* @default the value of `--text-muted` on the figure
|
|
31
|
+
*/
|
|
32
|
+
line?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The row under the pointer.
|
|
35
|
+
* @default the value of `--text` on the figure
|
|
36
|
+
*/
|
|
37
|
+
hover?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The rows singled out elsewhere — picked in a table, pinned by the reader.
|
|
40
|
+
* @default the value of `--accent` on the figure
|
|
41
|
+
*/
|
|
42
|
+
selection?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The halo a singled-out line is drawn over, so it reads against the mass.
|
|
45
|
+
* @default the value of `--surface`, at 85%
|
|
46
|
+
*/
|
|
47
|
+
halo?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The axis lines, their ticks and their labels.
|
|
50
|
+
* @default the value of `--text-muted`
|
|
51
|
+
*/
|
|
52
|
+
axis?: string;
|
|
53
|
+
/**
|
|
54
|
+
* How strongly a kept line is drawn. Turn it down for a dense library.
|
|
55
|
+
* @default 0.35
|
|
56
|
+
*/
|
|
57
|
+
includedAlpha?: number;
|
|
58
|
+
}
|
|
59
|
+
/** What `ParallelCoordinates` needs. */
|
|
60
|
+
export interface ParallelCoordinatesProps {
|
|
61
|
+
/** The axes, from left to right. Fewer than two draws no lines. */
|
|
62
|
+
axes: readonly ParallelAxis[];
|
|
63
|
+
/**
|
|
64
|
+
* How many rows to draw.
|
|
65
|
+
* @default the shortest axis's value count
|
|
66
|
+
*/
|
|
67
|
+
count?: number;
|
|
68
|
+
/** Total width, in pixels, normally from `useContainerSize`. */
|
|
69
|
+
width: number;
|
|
70
|
+
/**
|
|
71
|
+
* Total height, axis names and tick labels included.
|
|
72
|
+
* @default 320
|
|
73
|
+
*/
|
|
74
|
+
height?: number;
|
|
75
|
+
/**
|
|
76
|
+
* The interval each axis keeps, keyed by axis id. Present, the caller owns
|
|
77
|
+
* the brushes — which is what lets a table beside the figure filter on the
|
|
78
|
+
* same ranges. The band being dragged stays inside the component either way,
|
|
79
|
+
* so a controlled parent is never asked to re-render sixty times a second.
|
|
80
|
+
* @default undefined — the figure keeps its own
|
|
81
|
+
*/
|
|
82
|
+
ranges?: ParallelRanges;
|
|
83
|
+
/**
|
|
84
|
+
* The intervals in force before the reader touches anything.
|
|
85
|
+
* @default undefined — no axis is brushed
|
|
86
|
+
*/
|
|
87
|
+
defaultRanges?: ParallelRanges;
|
|
88
|
+
/**
|
|
89
|
+
* Called when a brush is released, with the interval it keeps or `null` when
|
|
90
|
+
* it was cleared — never while the band is being dragged.
|
|
91
|
+
* @default undefined
|
|
92
|
+
*/
|
|
93
|
+
onRangeChange?: (axisId: string, range: ParallelRange | null) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Called on every frame a band grows, for a caption saying what letting go
|
|
96
|
+
* would keep. Nothing else should be wired to it.
|
|
97
|
+
* @default undefined
|
|
98
|
+
*/
|
|
99
|
+
onRangePreview?: (axisId: string, range: ParallelRange | null) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Which rows the brushes keep, one entry per row, a zero meaning excluded.
|
|
102
|
+
* Left out, it is worked out from the ranges with `parallelIncludedMask`,
|
|
103
|
+
* which is exported so a table beside the figure filters on the same answer
|
|
104
|
+
* rather than on a second definition of "kept".
|
|
105
|
+
* @default undefined — worked out from the ranges
|
|
106
|
+
*/
|
|
107
|
+
included?: Uint8Array;
|
|
108
|
+
/**
|
|
109
|
+
* The row under the pointer, or `-1`. Present, the caller owns it, which is
|
|
110
|
+
* what lets a table hovered elsewhere light up its line here.
|
|
111
|
+
* @default undefined — the figure keeps its own
|
|
112
|
+
*/
|
|
113
|
+
hovered?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Called with the row under the pointer, or `-1`, whenever that changes.
|
|
116
|
+
* @default undefined
|
|
117
|
+
*/
|
|
118
|
+
onHoverChange?: (index: number) => void;
|
|
119
|
+
/**
|
|
120
|
+
* The rows singled out elsewhere, drawn over the mass in the selection ink.
|
|
121
|
+
* A row that is also the hovered one is drawn once, in the hover ink.
|
|
122
|
+
* @default undefined — nothing is singled out
|
|
123
|
+
*/
|
|
124
|
+
selected?: readonly number[];
|
|
125
|
+
/**
|
|
126
|
+
* Called when a line is clicked, with the row, or `-1` for empty ground.
|
|
127
|
+
* @default undefined — the lines are not clickable
|
|
128
|
+
*/
|
|
129
|
+
onRowClick?: (index: number) => void;
|
|
130
|
+
/**
|
|
131
|
+
* The quantity the lines are coloured by.
|
|
132
|
+
* @default undefined — every line takes one ink
|
|
133
|
+
*/
|
|
134
|
+
color?: ParallelColorBy;
|
|
135
|
+
/**
|
|
136
|
+
* The id of the axis the lines are coloured by, for the common case where it
|
|
137
|
+
* is one of the axes already drawn. Ignored when `color` is given.
|
|
138
|
+
* @default undefined
|
|
139
|
+
*/
|
|
140
|
+
colorAxis?: string;
|
|
141
|
+
/**
|
|
142
|
+
* The canvas colours, merged over the ones read off the figure's own tokens.
|
|
143
|
+
* @default {}
|
|
144
|
+
*/
|
|
145
|
+
ink?: ParallelInk;
|
|
146
|
+
/**
|
|
147
|
+
* The card shown over the row under the pointer. It is placed by the figure,
|
|
148
|
+
* flipped rather than clipped at either edge, so a caller writes only what
|
|
149
|
+
* it says.
|
|
150
|
+
* @default undefined — no card is shown
|
|
151
|
+
*/
|
|
152
|
+
renderTooltip?: (hover: ParallelHover) => ReactNode;
|
|
153
|
+
/**
|
|
154
|
+
* How an axis is named. The default writes the label and its unit; a caller
|
|
155
|
+
* wraps it to hang a help tooltip off the name.
|
|
156
|
+
* @default the axis label, and its unit after it
|
|
157
|
+
*/
|
|
158
|
+
renderAxisLabel?: (axis: ParallelAxis, index: number) => ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* What is shown in place of the figure when there is nothing to draw.
|
|
161
|
+
* @default undefined — an empty figure of the given height
|
|
162
|
+
*/
|
|
163
|
+
empty?: ReactNode;
|
|
164
|
+
/**
|
|
165
|
+
* What floats over the figure — a legend, a colour scale key, a caption.
|
|
166
|
+
* @default undefined
|
|
167
|
+
*/
|
|
168
|
+
overlay?: ReactNode;
|
|
169
|
+
/**
|
|
170
|
+
* What a screen reader is told the figure shows.
|
|
171
|
+
* @default a sentence naming the axes and the row count
|
|
172
|
+
*/
|
|
173
|
+
label?: string;
|
|
174
|
+
/**
|
|
175
|
+
* A class for the figure's outermost element, for a site placing it.
|
|
176
|
+
* @default undefined
|
|
177
|
+
*/
|
|
178
|
+
className?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Value of the `data-testid` attribute of the wrapper.
|
|
181
|
+
* @default undefined
|
|
182
|
+
*/
|
|
183
|
+
testId?: string;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=parallelCoordinatesProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallelCoordinatesProps.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/parallelCoordinatesProps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAC;AAElC,2CAA2C;AAC3C,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,gDAAgD;IAChD,CAAC,EAAE,MAAM,CAAC;CACX;AAED,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wCAAwC;AACxC,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAC9B;;;OAGG;IACH,KAA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GG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a caller hands a `ParallelCoordinates`.
|
|
3
|
+
*
|
|
4
|
+
* The types the figure is *told* about — an axis, an interval, a colour ramp —
|
|
5
|
+
* live in `parallel/core`, because the same words describe the mask a table
|
|
6
|
+
* beside the figure filters on and the layout the painter reads. What is left
|
|
7
|
+
* here is what only a React component has: the render props, the inks a canvas
|
|
8
|
+
* cannot read off a stylesheet, and the controlled pairs.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=parallelCoordinatesProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallelCoordinatesProps.js","sourceRoot":"","sources":["../../../src/parallel/ui/parallelCoordinatesProps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The questions the gesture asks that need neither React nor state: where a
|
|
3
|
+
* press landed, which axis it reached, and which band each axis should be
|
|
4
|
+
* drawn with once the one being dragged is taken into account.
|
|
5
|
+
*
|
|
6
|
+
* Kept out of the hook the way `lassoGesture.ts` is kept out of its own — each
|
|
7
|
+
* of these has exactly one answer, and none of them needs a render to be read.
|
|
8
|
+
*/
|
|
9
|
+
import type { SurfaceEvent } from '../../scatter/ui/lassoGesture.ts';
|
|
10
|
+
import type { ParallelAxisLayout } from '../core/parallelAxes.ts';
|
|
11
|
+
import type { ParallelBand } from '../core/parallelBrush.ts';
|
|
12
|
+
import type { ParallelRanges } from '../core/parallelTypes.ts';
|
|
13
|
+
/** A band being dragged, before the interval it keeps is reported. */
|
|
14
|
+
export interface ParallelDraft {
|
|
15
|
+
/** The axis it is on. */
|
|
16
|
+
axis: string;
|
|
17
|
+
/** Where it stands this frame. */
|
|
18
|
+
band: ParallelBand;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Where an event landed, relative to the top left of the drawing area.
|
|
22
|
+
* @param event - The event, for where on the surface it happened.
|
|
23
|
+
* @returns The position, in pixels from the corner of the drawing area.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parallelPointOf(event: SurfaceEvent): {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Which axis a press at that horizontal position took hold of.
|
|
31
|
+
* @param x - Pixels from the left of the drawing area.
|
|
32
|
+
* @param axes - The axes, from left to right.
|
|
33
|
+
* @returns The axis's index, or `-1` when the press landed between two of them.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parallelAxisNear(x: number, axes: readonly ParallelAxisLayout[]): number;
|
|
36
|
+
/**
|
|
37
|
+
* One axis, by the id a range is keyed on.
|
|
38
|
+
* @param axes - The axes, from left to right.
|
|
39
|
+
* @param axisId - The id to find.
|
|
40
|
+
* @returns The axis, or `undefined` when it is no longer drawn.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parallelAxisById(axes: readonly ParallelAxisLayout[], axisId: string): ParallelAxisLayout | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The band to draw on each axis: the one being dragged where there is one, and
|
|
45
|
+
* the interval in force everywhere else.
|
|
46
|
+
* @param axes - The axes, from left to right.
|
|
47
|
+
* @param ranges - The interval each axis keeps, or `null` for none.
|
|
48
|
+
* @param draft - The band being dragged, or `null` when nothing is.
|
|
49
|
+
* @returns The bands, keyed by axis id; an axis with none is left out.
|
|
50
|
+
*/
|
|
51
|
+
export declare function parallelBandsOf(axes: readonly ParallelAxisLayout[], ranges: ParallelRanges, draft: ParallelDraft | null): ReadonlyMap<string, ParallelBand>;
|
|
52
|
+
//# sourceMappingURL=parallelGestureModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallelGestureModel.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/parallelGestureModel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG;IACpD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAMA;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAClC,MAAM,CAaR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,MAAM,EAAE,MAAM,GACb,kBAAkB,GAAG,SAAS,CAKhC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,aAAa,GAAG,IAAI,GAC1B,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAYnC"}
|