react-cheminfo 0.15.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.
Files changed (142) hide show
  1. package/README.md +96 -0
  2. package/lib/core.d.ts +1 -0
  3. package/lib/core.d.ts.map +1 -1
  4. package/lib/core.js +1 -0
  5. package/lib/core.js.map +1 -1
  6. package/lib/credits/core/credits.d.ts +17 -0
  7. package/lib/credits/core/credits.d.ts.map +1 -1
  8. package/lib/credits/core/credits.js +20 -0
  9. package/lib/credits/core/credits.js.map +1 -1
  10. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  11. package/lib/ecosystem/core/sites.js +40 -0
  12. package/lib/ecosystem/core/sites.js.map +1 -1
  13. package/lib/ecosystem/core/types.d.ts +1 -1
  14. package/lib/ecosystem/core/types.d.ts.map +1 -1
  15. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  16. package/lib/ecosystem/ui/glyphs.js +11 -0
  17. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  18. package/lib/parallel/core/index.d.ts +27 -0
  19. package/lib/parallel/core/index.d.ts.map +1 -0
  20. package/lib/parallel/core/index.js +20 -0
  21. package/lib/parallel/core/index.js.map +1 -0
  22. package/lib/parallel/core/parallelAxes.d.ts +103 -0
  23. package/lib/parallel/core/parallelAxes.d.ts.map +1 -0
  24. package/lib/parallel/core/parallelAxes.js +146 -0
  25. package/lib/parallel/core/parallelAxes.js.map +1 -0
  26. package/lib/parallel/core/parallelBrush.d.ts +79 -0
  27. package/lib/parallel/core/parallelBrush.d.ts.map +1 -0
  28. package/lib/parallel/core/parallelBrush.js +99 -0
  29. package/lib/parallel/core/parallelBrush.js.map +1 -0
  30. package/lib/parallel/core/parallelExtent.d.ts +28 -0
  31. package/lib/parallel/core/parallelExtent.d.ts.map +1 -0
  32. package/lib/parallel/core/parallelExtent.js +47 -0
  33. package/lib/parallel/core/parallelExtent.js.map +1 -0
  34. package/lib/parallel/core/parallelFilter.d.ts +36 -0
  35. package/lib/parallel/core/parallelFilter.d.ts.map +1 -0
  36. package/lib/parallel/core/parallelFilter.js +74 -0
  37. package/lib/parallel/core/parallelFilter.js.map +1 -0
  38. package/lib/parallel/core/parallelHit.d.ts +47 -0
  39. package/lib/parallel/core/parallelHit.d.ts.map +1 -0
  40. package/lib/parallel/core/parallelHit.js +81 -0
  41. package/lib/parallel/core/parallelHit.js.map +1 -0
  42. package/lib/parallel/core/parallelPaint.d.ts +104 -0
  43. package/lib/parallel/core/parallelPaint.d.ts.map +1 -0
  44. package/lib/parallel/core/parallelPaint.js +160 -0
  45. package/lib/parallel/core/parallelPaint.js.map +1 -0
  46. package/lib/parallel/core/parallelPalette.d.ts +31 -0
  47. package/lib/parallel/core/parallelPalette.d.ts.map +1 -0
  48. package/lib/parallel/core/parallelPalette.js +68 -0
  49. package/lib/parallel/core/parallelPalette.js.map +1 -0
  50. package/lib/parallel/core/parallelTicks.d.ts +34 -0
  51. package/lib/parallel/core/parallelTicks.d.ts.map +1 -0
  52. package/lib/parallel/core/parallelTicks.js +116 -0
  53. package/lib/parallel/core/parallelTicks.js.map +1 -0
  54. package/lib/parallel/core/parallelTypes.d.ts +129 -0
  55. package/lib/parallel/core/parallelTypes.d.ts.map +1 -0
  56. package/lib/parallel/core/parallelTypes.js +29 -0
  57. package/lib/parallel/core/parallelTypes.js.map +1 -0
  58. package/lib/parallel/ui/ParallelAxesLayer.d.ts +28 -0
  59. package/lib/parallel/ui/ParallelAxesLayer.d.ts.map +1 -0
  60. package/lib/parallel/ui/ParallelAxesLayer.js +29 -0
  61. package/lib/parallel/ui/ParallelAxesLayer.js.map +1 -0
  62. package/lib/parallel/ui/ParallelCoordinates.d.ts +21 -0
  63. package/lib/parallel/ui/ParallelCoordinates.d.ts.map +1 -0
  64. package/lib/parallel/ui/ParallelCoordinates.js +109 -0
  65. package/lib/parallel/ui/ParallelCoordinates.js.map +1 -0
  66. package/lib/parallel/ui/ParallelLabels.d.ts +26 -0
  67. package/lib/parallel/ui/ParallelLabels.d.ts.map +1 -0
  68. package/lib/parallel/ui/ParallelLabels.js +25 -0
  69. package/lib/parallel/ui/ParallelLabels.js.map +1 -0
  70. package/lib/parallel/ui/ParallelTooltip.d.ts +26 -0
  71. package/lib/parallel/ui/ParallelTooltip.d.ts.map +1 -0
  72. package/lib/parallel/ui/ParallelTooltip.js +30 -0
  73. package/lib/parallel/ui/ParallelTooltip.js.map +1 -0
  74. package/lib/parallel/ui/index.d.ts +25 -0
  75. package/lib/parallel/ui/index.d.ts.map +1 -0
  76. package/lib/parallel/ui/index.js +18 -0
  77. package/lib/parallel/ui/index.js.map +1 -0
  78. package/lib/parallel/ui/parallelCoordinatesProps.d.ts +185 -0
  79. package/lib/parallel/ui/parallelCoordinatesProps.d.ts.map +1 -0
  80. package/lib/parallel/ui/parallelCoordinatesProps.js +11 -0
  81. package/lib/parallel/ui/parallelCoordinatesProps.js.map +1 -0
  82. package/lib/parallel/ui/parallelGestureModel.d.ts +52 -0
  83. package/lib/parallel/ui/parallelGestureModel.d.ts.map +1 -0
  84. package/lib/parallel/ui/parallelGestureModel.js +80 -0
  85. package/lib/parallel/ui/parallelGestureModel.js.map +1 -0
  86. package/lib/parallel/ui/parallelInk.d.ts +76 -0
  87. package/lib/parallel/ui/parallelInk.d.ts.map +1 -0
  88. package/lib/parallel/ui/parallelInk.js +113 -0
  89. package/lib/parallel/ui/parallelInk.js.map +1 -0
  90. package/lib/parallel/ui/parallelPlotModel.d.ts +55 -0
  91. package/lib/parallel/ui/parallelPlotModel.d.ts.map +1 -0
  92. package/lib/parallel/ui/parallelPlotModel.js +113 -0
  93. package/lib/parallel/ui/parallelPlotModel.js.map +1 -0
  94. package/lib/parallel/ui/parallelStyles.d.ts +83 -0
  95. package/lib/parallel/ui/parallelStyles.d.ts.map +1 -0
  96. package/lib/parallel/ui/parallelStyles.js +131 -0
  97. package/lib/parallel/ui/parallelStyles.js.map +1 -0
  98. package/lib/parallel/ui/useParallelCanvas.d.ts +49 -0
  99. package/lib/parallel/ui/useParallelCanvas.d.ts.map +1 -0
  100. package/lib/parallel/ui/useParallelCanvas.js +58 -0
  101. package/lib/parallel/ui/useParallelCanvas.js.map +1 -0
  102. package/lib/parallel/ui/useParallelGesture.d.ts +67 -0
  103. package/lib/parallel/ui/useParallelGesture.d.ts.map +1 -0
  104. package/lib/parallel/ui/useParallelGesture.js +139 -0
  105. package/lib/parallel/ui/useParallelGesture.js.map +1 -0
  106. package/lib/structure/ui/useToolbarFloor.d.ts.map +1 -1
  107. package/lib/structure/ui/useToolbarFloor.js +29 -22
  108. package/lib/structure/ui/useToolbarFloor.js.map +1 -1
  109. package/lib/ui.d.ts +1 -0
  110. package/lib/ui.d.ts.map +1 -1
  111. package/lib/ui.js +1 -0
  112. package/lib/ui.js.map +1 -1
  113. package/package.json +1 -1
  114. package/src/core.ts +1 -0
  115. package/src/credits/core/credits.ts +21 -0
  116. package/src/ecosystem/core/sites.ts +40 -0
  117. package/src/ecosystem/core/types.ts +4 -1
  118. package/src/ecosystem/ui/glyphs.tsx +46 -0
  119. package/src/parallel/core/index.ts +80 -0
  120. package/src/parallel/core/parallelAxes.ts +207 -0
  121. package/src/parallel/core/parallelBrush.ts +145 -0
  122. package/src/parallel/core/parallelExtent.ts +56 -0
  123. package/src/parallel/core/parallelFilter.ts +94 -0
  124. package/src/parallel/core/parallelHit.ts +106 -0
  125. package/src/parallel/core/parallelPaint.ts +231 -0
  126. package/src/parallel/core/parallelPalette.ts +80 -0
  127. package/src/parallel/core/parallelTicks.ts +164 -0
  128. package/src/parallel/core/parallelTypes.ts +147 -0
  129. package/src/parallel/ui/ParallelAxesLayer.tsx +123 -0
  130. package/src/parallel/ui/ParallelCoordinates.tsx +233 -0
  131. package/src/parallel/ui/ParallelLabels.tsx +56 -0
  132. package/src/parallel/ui/ParallelTooltip.tsx +55 -0
  133. package/src/parallel/ui/index.ts +50 -0
  134. package/src/parallel/ui/parallelCoordinatesProps.ts +199 -0
  135. package/src/parallel/ui/parallelGestureModel.ts +109 -0
  136. package/src/parallel/ui/parallelInk.ts +182 -0
  137. package/src/parallel/ui/parallelPlotModel.ts +130 -0
  138. package/src/parallel/ui/parallelStyles.ts +146 -0
  139. package/src/parallel/ui/useParallelCanvas.ts +104 -0
  140. package/src/parallel/ui/useParallelGesture.ts +227 -0
  141. package/src/structure/ui/useToolbarFloor.ts +27 -22
  142. package/src/ui.ts +1 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ * The small answers the figure needs before it renders: how many rows there
3
+ * are, what is colouring the lines, which rows are drawn over the mass, and
4
+ * what a screen reader is told.
5
+ *
6
+ * Kept out of the component for the reason `scatterPlotModel.ts` is: none of
7
+ * them needs React to be read or checked, and a component that is mostly
8
+ * arithmetic is a component nobody can see the layout in.
9
+ */
10
+ import { formatInteger } from "../../format/core/numbers.js";
11
+ /**
12
+ * How many rows the figure draws.
13
+ * @param axes - The axes, whose columns are read.
14
+ * @param count - What the caller insists on, if anything.
15
+ * @returns The count — the shortest column, so no axis is ever read past its
16
+ * own end.
17
+ */
18
+ export function parallelRowCount(axes, count) {
19
+ if (count !== undefined)
20
+ return Math.max(0, Math.trunc(count));
21
+ let shortest = 0;
22
+ for (let index = 0; index < axes.length; index++) {
23
+ const axis = axes[index];
24
+ if (axis === undefined)
25
+ continue;
26
+ const length = axis.values.length;
27
+ if (index === 0 || length < shortest)
28
+ shortest = length;
29
+ }
30
+ return shortest;
31
+ }
32
+ /**
33
+ * The quantity the lines are coloured by.
34
+ * @param color - The quantity the caller gave outright.
35
+ * @param colorAxis - The id of an axis already drawn, for the common case.
36
+ * @param axes - The axes, to find that id among.
37
+ * @returns The quantity, or `undefined` when the lines all take one ink. An
38
+ * axis named by `colorAxis` lends its own domain as well as its values, so the
39
+ * ramp and the axis beside it read the same range.
40
+ */
41
+ export function parallelColorOf(color, colorAxis, axes) {
42
+ if (color !== undefined)
43
+ return color;
44
+ if (colorAxis === undefined)
45
+ return undefined;
46
+ for (const axis of axes) {
47
+ if (axis.id !== colorAxis)
48
+ continue;
49
+ const domain = axis.domain;
50
+ if (domain === undefined)
51
+ return { values: axis.values };
52
+ return {
53
+ values: axis.values,
54
+ min: Math.min(domain[0], domain[1]),
55
+ max: Math.max(domain[0], domain[1]),
56
+ logarithmic: axis.scale === 'log',
57
+ };
58
+ }
59
+ return undefined;
60
+ }
61
+ /**
62
+ * Whether any axis on the figure carries an interval at all.
63
+ * @param axes - The axes, whose ids the intervals are keyed by.
64
+ * @param ranges - The interval each axis keeps.
65
+ * @returns Whether anything is brushed, which is what decides whether a line
66
+ * is ever drawn in the excluded ink.
67
+ */
68
+ export function parallelIsBrushed(axes, ranges) {
69
+ for (const axis of axes) {
70
+ const range = ranges[axis.id];
71
+ if (range !== null && range !== undefined)
72
+ return true;
73
+ }
74
+ return false;
75
+ }
76
+ /**
77
+ * The rows drawn over the mass, in the order they are painted.
78
+ * @param selected - The rows singled out elsewhere.
79
+ * @param hovered - The row under the pointer, or `-1`.
80
+ * @param selectionInk - The ink a singled-out row takes.
81
+ * @param hoverInk - The ink the hovered row takes.
82
+ * @returns The highlights, the hovered row last so that it paints on top and
83
+ * a row that is both selected and hovered is drawn once rather than twice.
84
+ */
85
+ export function parallelHighlightsOf(selected, hovered, selectionInk, hoverInk) {
86
+ const highlights = [];
87
+ if (selected !== undefined) {
88
+ for (const row of selected) {
89
+ if (row < 0 || row === hovered)
90
+ continue;
91
+ highlights.push({ row, color: selectionInk });
92
+ }
93
+ }
94
+ if (hovered >= 0)
95
+ highlights.push({ row: hovered, color: hoverInk });
96
+ return highlights;
97
+ }
98
+ /**
99
+ * What a screen reader is told the figure shows.
100
+ * @param axes - The axes, from left to right.
101
+ * @param count - How many rows are drawn.
102
+ * @returns The sentence, naming every axis and how much is on the figure.
103
+ */
104
+ export function parallelFigureLabel(axes, count) {
105
+ const names = [];
106
+ for (const axis of axes)
107
+ names.push(axis.label);
108
+ const rows = count === 1 ? '1 row' : `${formatInteger(count)} rows`;
109
+ if (names.length === 0)
110
+ return `Parallel coordinates of ${rows}.`;
111
+ return `Parallel coordinates of ${rows}, on ${names.join(', ')}.`;
112
+ }
113
+ //# sourceMappingURL=parallelPlotModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelPlotModel.js","sourceRoot":"","sources":["../../../src/parallel/ui/parallelPlotModel.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAQ7D;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAA6B,EAC7B,KAAc;IAEd,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,GAAG,QAAQ;YAAE,QAAQ,GAAG,MAAM,CAAC;IAC1D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAkC,EAClC,SAA6B,EAC7B,IAA6B;IAE7B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9C,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS;YAAE,SAAS;QACpC,MAAM,MAAM,G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AU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrE,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAA6B,EAC7B,KAAa;IAEb,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;IACpE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,2BAA2B,IAAI,GAAG,CAAC;IAClE,OAAO,2BAA2B,IAAI,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACpE,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Every rule the figure is drawn with.
3
+ *
4
+ * The library ships no stylesheet for a figure — a chart writes inline style
5
+ * objects, so a site that never renders one pays nothing and a site that does
6
+ * cannot forget to import a file. The two colours that are not fixed here, the
7
+ * axis ink and the band's, are resolved off the page by `parallelInk.ts` and
8
+ * written onto the elements, so an override applies to the canvas and to the
9
+ * markup alike.
10
+ */
11
+ import type { CSSProperties } from 'react';
12
+ /** A layer covering the whole figure, stacked over the ones before it. */
13
+ export declare const PARALLEL_LAYER_STYLE: {
14
+ readonly position: "absolute";
15
+ readonly inset: 0;
16
+ };
17
+ /**
18
+ * The block the figure occupies, which every layer is positioned against.
19
+ * @param height - Total height of the figure, in pixels.
20
+ * @returns The wrapper's rules.
21
+ */
22
+ export declare function parallelFigureStyle(height: number): CSSProperties;
23
+ /**
24
+ * One of the two canvases, stretched over the figure.
25
+ * @param height - Total height of the figure, in pixels.
26
+ * @returns The canvas's rules.
27
+ */
28
+ export declare function parallelCanvasStyle(height: number): CSSProperties;
29
+ /** The drawing surface the axes, the bands and the pointer target live in. */
30
+ export declare const PARALLEL_SVG_STYLE: {
31
+ readonly display: "block";
32
+ readonly overflow: "visible";
33
+ readonly position: "absolute";
34
+ readonly inset: 0;
35
+ };
36
+ /**
37
+ * The layer the axis names sit in. It is HTML rather than SVG text so that a
38
+ * name can carry a tooltip, and it lets every pointer event through so that a
39
+ * brush started under a name still starts.
40
+ */
41
+ export declare const PARALLEL_LABELS_STYLE: {
42
+ readonly pointerEvents: "none";
43
+ readonly position: "absolute";
44
+ readonly inset: 0;
45
+ };
46
+ /**
47
+ * One axis name, centred over its axis and taking the pointer back.
48
+ * @param left - Where the axis stands, in pixels from the figure's left edge.
49
+ * @returns The name's rules.
50
+ */
51
+ export declare function parallelLabelStyle(left: number): CSSProperties;
52
+ /** One tick written out, tabular so a column of them lines up on the point. */
53
+ export declare const PARALLEL_TICK_LABEL_STYLE: {
54
+ readonly fontSize: 10;
55
+ readonly fontVariantNumeric: "tabular-nums";
56
+ readonly userSelect: "none";
57
+ };
58
+ /** How far a tick mark reaches out of the axis, in pixels. */
59
+ export declare const PARALLEL_TICK_LENGTH = 4;
60
+ /** How far a tick label ends before its axis. */
61
+ export declare const PARALLEL_TICK_LABEL_INSET = 7;
62
+ /**
63
+ * The interval one brush keeps, filled in the site's own colour.
64
+ * @param ink - The colour to fill and outline it in.
65
+ * @returns The band's rules.
66
+ */
67
+ export declare function parallelBandStyle(ink: string): CSSProperties;
68
+ /**
69
+ * Either edge of a band, drawn so the reader can see it can be dragged.
70
+ * @param ink - The colour to draw it in.
71
+ * @returns The handle's rules.
72
+ */
73
+ export declare function parallelHandleStyle(ink: string): CSSProperties;
74
+ /** How tall an edge handle is drawn, in pixels. */
75
+ export declare const PARALLEL_HANDLE_HEIGHT = 3;
76
+ /**
77
+ * The card over the row under the pointer.
78
+ * @param left - Where it sits, in pixels from the figure's left edge.
79
+ * @param top - Where it sits, in pixels from its top edge.
80
+ * @returns The card's rules.
81
+ */
82
+ export declare function parallelTooltipStyle(left: number, top: number): CSSProperties;
83
+ //# sourceMappingURL=parallelStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelStyles.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/parallelStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB;;;CAGC,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAMjE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAMjE;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB;;;;;CAIG,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;CAGA,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAY9D;AAED,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB;;;;CAIJ,CAAC;AAEnC,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,iDAAiD;AACjD,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAO5D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAE9D;AAED,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa,CAiB7E"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Every rule the figure is drawn with.
3
+ *
4
+ * The library ships no stylesheet for a figure — a chart writes inline style
5
+ * objects, so a site that never renders one pays nothing and a site that does
6
+ * cannot forget to import a file. The two colours that are not fixed here, the
7
+ * axis ink and the band's, are resolved off the page by `parallelInk.ts` and
8
+ * written onto the elements, so an override applies to the canvas and to the
9
+ * markup alike.
10
+ */
11
+ import { TOKEN } from "../../tokens/core/familyTokens.js";
12
+ /** A layer covering the whole figure, stacked over the ones before it. */
13
+ export const PARALLEL_LAYER_STYLE = {
14
+ position: 'absolute',
15
+ inset: 0,
16
+ };
17
+ /**
18
+ * The block the figure occupies, which every layer is positioned against.
19
+ * @param height - Total height of the figure, in pixels.
20
+ * @returns The wrapper's rules.
21
+ */
22
+ export function parallelFigureStyle(height) {
23
+ return {
24
+ position: 'relative',
25
+ height: Math.max(0, height),
26
+ minWidth: 0,
27
+ };
28
+ }
29
+ /**
30
+ * One of the two canvases, stretched over the figure.
31
+ * @param height - Total height of the figure, in pixels.
32
+ * @returns The canvas's rules.
33
+ */
34
+ export function parallelCanvasStyle(height) {
35
+ return {
36
+ ...PARALLEL_LAYER_STYLE,
37
+ width: '100%',
38
+ height: Math.max(0, height),
39
+ };
40
+ }
41
+ /** The drawing surface the axes, the bands and the pointer target live in. */
42
+ export const PARALLEL_SVG_STYLE = {
43
+ ...PARALLEL_LAYER_STYLE,
44
+ display: 'block',
45
+ overflow: 'visible',
46
+ };
47
+ /**
48
+ * The layer the axis names sit in. It is HTML rather than SVG text so that a
49
+ * name can carry a tooltip, and it lets every pointer event through so that a
50
+ * brush started under a name still starts.
51
+ */
52
+ export const PARALLEL_LABELS_STYLE = {
53
+ ...PARALLEL_LAYER_STYLE,
54
+ pointerEvents: 'none',
55
+ };
56
+ /**
57
+ * One axis name, centred over its axis and taking the pointer back.
58
+ * @param left - Where the axis stands, in pixels from the figure's left edge.
59
+ * @returns The name's rules.
60
+ */
61
+ export function parallelLabelStyle(left) {
62
+ return {
63
+ position: 'absolute',
64
+ top: 2,
65
+ left,
66
+ transform: 'translateX(-50%)',
67
+ color: TOKEN.text,
68
+ fontSize: 11,
69
+ fontWeight: 600,
70
+ whiteSpace: 'nowrap',
71
+ pointerEvents: 'auto',
72
+ };
73
+ }
74
+ /** One tick written out, tabular so a column of them lines up on the point. */
75
+ export const PARALLEL_TICK_LABEL_STYLE = {
76
+ fontSize: 10,
77
+ fontVariantNumeric: 'tabular-nums',
78
+ userSelect: 'none',
79
+ };
80
+ /** How far a tick mark reaches out of the axis, in pixels. */
81
+ export const PARALLEL_TICK_LENGTH = 4;
82
+ /** How far a tick label ends before its axis. */
83
+ export const PARALLEL_TICK_LABEL_INSET = 7;
84
+ /**
85
+ * The interval one brush keeps, filled in the site's own colour.
86
+ * @param ink - The colour to fill and outline it in.
87
+ * @returns The band's rules.
88
+ */
89
+ export function parallelBandStyle(ink) {
90
+ return {
91
+ fill: ink,
92
+ fillOpacity: 0.16,
93
+ stroke: ink,
94
+ strokeOpacity: 0.55,
95
+ };
96
+ }
97
+ /**
98
+ * Either edge of a band, drawn so the reader can see it can be dragged.
99
+ * @param ink - The colour to draw it in.
100
+ * @returns The handle's rules.
101
+ */
102
+ export function parallelHandleStyle(ink) {
103
+ return { fill: ink, fillOpacity: 0.9 };
104
+ }
105
+ /** How tall an edge handle is drawn, in pixels. */
106
+ export const PARALLEL_HANDLE_HEIGHT = 3;
107
+ /**
108
+ * The card over the row under the pointer.
109
+ * @param left - Where it sits, in pixels from the figure's left edge.
110
+ * @param top - Where it sits, in pixels from its top edge.
111
+ * @returns The card's rules.
112
+ */
113
+ export function parallelTooltipStyle(left, top) {
114
+ return {
115
+ position: 'absolute',
116
+ zIndex: 5,
117
+ left,
118
+ top,
119
+ padding: '4px 8px',
120
+ borderRadius: 6,
121
+ background: TOKEN.text,
122
+ color: TOKEN.surface,
123
+ fontSize: 11,
124
+ fontVariantNumeric: 'tabular-nums',
125
+ lineHeight: 1.4,
126
+ pointerEvents: 'none',
127
+ whiteSpace: 'nowrap',
128
+ boxShadow: TOKEN.shadowMedium,
129
+ };
130
+ }
131
+ //# sourceMappingURL=parallelStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelStyles.js","sourceRoot":"","sources":["../../../src/parallel/ui/parallelStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE1D,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;CACwB,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO;QACL,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC;QAC3B,QAAQ,EAAE,CAAC;KACZ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO;QACL,GAAG,oBAAoB;QACvB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,GAAG,oBAAoB;IACvB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,SAAS;CACa,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,GAAG,oBAAoB;IACvB,aAAa,EAAE,MAAM;CACW,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO;QACL,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI;QACJ,SAAS,EAAE,kBAAkB;QAC7B,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,QAAQ,EAAE,EAAE;QACZ,UAAU,EA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canvases, and when they are repainted.
3
+ *
4
+ * Two rather than one, because the mass of lines changes when the data or the
5
+ * brushes do, while the row under the pointer changes on every frame the
6
+ * pointer moves. Repainting ten thousand lines to move one highlight is the
7
+ * difference between a figure that follows the pointer and one that lags it.
8
+ */
9
+ import type { RefObject } from 'react';
10
+ import type { ParallelAxisLayout } from '../core/parallelAxes.ts';
11
+ import type { ParallelHighlight } from '../core/parallelPaint.ts';
12
+ import type { ParallelInkValues } from './parallelInk.ts';
13
+ /** What {@link useParallelCanvas} needs. */
14
+ export interface ParallelCanvasOptions {
15
+ /** Total width of the figure, in CSS pixels. */
16
+ width: number;
17
+ /** Its total height. */
18
+ height: number;
19
+ /** The axes, from left to right. */
20
+ layouts: readonly ParallelAxisLayout[];
21
+ /** Each axis's column, in the same order. */
22
+ values: ReadonlyArray<ArrayLike<number>>;
23
+ /** How many rows are drawn. */
24
+ count: number;
25
+ /** Which rows the brushes keep, or `null` when they keep every one. */
26
+ included: Uint8Array | null;
27
+ /** Which colour each row takes, or `null` when nothing is colouring them. */
28
+ steps: Uint8Array | null;
29
+ /** The colours a step indexes. */
30
+ palette: readonly string[];
31
+ /** The rows drawn over the mass, the last one on top. */
32
+ highlights: readonly ParallelHighlight[];
33
+ /** The colours to paint with. */
34
+ ink: ParallelInkValues;
35
+ }
36
+ /** The two canvases a figure stacks. */
37
+ export interface ParallelCanvases {
38
+ /** The mass of lines, underneath. */
39
+ lines: RefObject<HTMLCanvasElement | null>;
40
+ /** The singled-out rows, over them. */
41
+ marks: RefObject<HTMLCanvasElement | null>;
42
+ }
43
+ /**
44
+ * Keep both canvases sized to the device pixel grid and painted.
45
+ * @param options - See {@link ParallelCanvasOptions}.
46
+ * @returns The two refs to hand to the `<canvas>` elements.
47
+ */
48
+ export declare function useParallelCanvas(options: ParallelCanvasOptions): ParallelCanvases;
49
+ //# sourceMappingURL=useParallelCanvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParallelCanvas.d.ts","sourceRoot":"","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canvases, and when they are repainted.
3
+ *
4
+ * Two rather than one, because the mass of lines changes when the data or the
5
+ * brushes do, while the row under the pointer changes on every frame the
6
+ * pointer moves. Repainting ten thousand lines to move one highlight is the
7
+ * difference between a figure that follows the pointer and one that lags it.
8
+ */
9
+ import { useEffect, useRef } from 'react';
10
+ import { paintParallelHighlights, paintParallelLines, preparePlotCanvas, } from "../core/parallelPaint.js";
11
+ /**
12
+ * Keep both canvases sized to the device pixel grid and painted.
13
+ * @param options - See {@link ParallelCanvasOptions}.
14
+ * @returns The two refs to hand to the `<canvas>` elements.
15
+ */
16
+ export function useParallelCanvas(options) {
17
+ const { width, height, layouts, values, count } = options;
18
+ const { included, steps, palette, highlights, ink } = options;
19
+ const lines = useRef(null);
20
+ const marks = useRef(null);
21
+ const { line, excluded, includedAlpha, halo } = ink;
22
+ useEffect(() => {
23
+ const context = preparePlotCanvas(lines.current, width, height);
24
+ if (context === null)
25
+ return;
26
+ paintParallelLines(context, {
27
+ layouts,
28
+ values,
29
+ count,
30
+ included,
31
+ steps,
32
+ palette,
33
+ line,
34
+ excluded,
35
+ includedAlpha,
36
+ });
37
+ }, [
38
+ width,
39
+ height,
40
+ layouts,
41
+ values,
42
+ count,
43
+ included,
44
+ steps,
45
+ palette,
46
+ line,
47
+ excluded,
48
+ includedAlpha,
49
+ ]);
50
+ useEffect(() => {
51
+ const context = preparePlotCanvas(marks.current, width, height);
52
+ if (context === null)
53
+ return;
54
+ paintParallelHighlights(context, { highlights, layouts, values, halo });
55
+ }, [width, height, highlights, layouts, values, halo]);
56
+ return { lines, marks };
57
+ }
58
+ //# sourceMappingURL=useParallelCanvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParallelCanvas.js","sourceRoot":"","sources":["../../../src/parallel/ui/useParallelCanvas.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,EACL,uBAAuB,EACvB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AC,CAAC;IAC1E,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEvD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * One pointer over the whole figure, serving both the brush and the hover.
3
+ *
4
+ * A hook cannot be called inside a `map`, so a brush per axis would have to
5
+ * live in refs and be attached by hand; one surface that works out from the
6
+ * press which axis was grabbed has no such problem, and it gives the hover
7
+ * search the same once-a-frame coalescing the drag already pays for.
8
+ *
9
+ * The band follows the pointer live and the interval is reported on release
10
+ * only: a table filtering on the reported interval is asked to re-render once
11
+ * per gesture rather than sixty times a second.
12
+ */
13
+ import type { MouseEvent as ReactMouseEvent } from 'react';
14
+ import type { ScatterSurfaceProps } from '../../scatter/ui/lassoGesture.ts';
15
+ import type { ParallelAxisLayout } from '../core/parallelAxes.ts';
16
+ import type { ParallelBand } from '../core/parallelBrush.ts';
17
+ import type { ParallelRange, ParallelRanges } from '../core/parallelTypes.ts';
18
+ /** What {@link useParallelGesture} needs. */
19
+ export interface ParallelGestureOptions {
20
+ /** The axes, from left to right. */
21
+ layouts: readonly ParallelAxisLayout[];
22
+ /** Each axis's column, in the same order. */
23
+ values: ReadonlyArray<ArrayLike<number>>;
24
+ /** How many rows are drawn. */
25
+ count: number;
26
+ /** Height of the drawing area, in pixels. */
27
+ innerHeight: number;
28
+ /** Which rows a brush keeps, so an excluded line cannot be pointed at. */
29
+ included: Uint8Array | null;
30
+ /** The intervals in force, whoever owns them. */
31
+ ranges: ParallelRanges;
32
+ /** Called when a brush is released, with the interval it keeps or `null`. */
33
+ onRangeChange: (axisId: string, range: ParallelRange | null) => void;
34
+ /** Called on every frame a band grows. */
35
+ onRangePreview?: ((axisId: string, range: ParallelRange | null) => void) | undefined;
36
+ /** The row the caller says is hovered, if it owns that. */
37
+ hovered?: number | undefined;
38
+ /** Called with the row under the pointer, or `-1`. */
39
+ onHoverChange?: ((index: number) => void) | undefined;
40
+ /** Called when a line is clicked, with the row, or `-1` for empty ground. */
41
+ onRowClick?: ((index: number) => void) | undefined;
42
+ }
43
+ /** The gesture, as the figure renders it. */
44
+ export interface ParallelGesture {
45
+ /** Spread onto the transparent rectangle laid over the figure. */
46
+ surface: ScatterSurfaceProps;
47
+ /** Put on the same rectangle, for the click that picks a line. */
48
+ onClick: (event: ReactMouseEvent<Element>) => void;
49
+ /** The band to draw on each axis, the one being dragged included. */
50
+ bands: ReadonlyMap<string, ParallelBand>;
51
+ /** The row under the pointer, or `-1`. */
52
+ hovered: number;
53
+ /** Where the pointer is in the figure, or `null` when it is away. */
54
+ pointer: {
55
+ x: number;
56
+ y: number;
57
+ } | null;
58
+ /** Whether a band is being dragged right now. */
59
+ brushing: boolean;
60
+ }
61
+ /**
62
+ * The brush and the hover, over one surface.
63
+ * @param options - See {@link ParallelGestureOptions}.
64
+ * @returns The gesture. See {@link ParallelGesture}.
65
+ */
66
+ export declare function useParallelGesture(options: ParallelGestureOptions): ParallelGesture;
67
+ //# sourceMappingURL=useParallelGesture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParallelGesture.d.ts","sourceRoot":"","sources":["../../../src/parallel/ui/useParallelGesture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,0BAA0B,CAAC;AAShF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAU9E,6CAA6C;AAC7C,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,OA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