@genome-spy/core 0.59.0 → 0.60.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/dist/bundle/index.es.js +6170 -5616
- package/dist/bundle/index.js +144 -119
- package/dist/schema.json +304 -22
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +1 -0
- package/dist/src/data/sources/dataUtils.d.ts +2 -1
- package/dist/src/data/sources/dataUtils.d.ts.map +1 -1
- package/dist/src/data/sources/dataUtils.js +3 -4
- package/dist/src/data/sources/inlineSource.d.ts +8 -0
- package/dist/src/data/sources/inlineSource.d.ts.map +1 -1
- package/dist/src/data/sources/inlineSource.js +17 -1
- package/dist/src/data/sources/urlSource.d.ts +1 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +33 -4
- package/dist/src/encoder/encoder.d.ts +1 -1
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +39 -6
- package/dist/src/gl/colorUtils.d.ts +4 -0
- package/dist/src/gl/colorUtils.d.ts.map +1 -1
- package/dist/src/gl/colorUtils.js +8 -0
- package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +1 -9
- package/dist/src/gl/includes/common.glsl.js +1 -1
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.js +8 -0
- package/dist/src/marks/mark.d.ts +8 -0
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +101 -3
- package/dist/src/marks/point.fragment.glsl.js +1 -1
- package/dist/src/marks/point.vertex.glsl.js +1 -1
- package/dist/src/marks/rect.common.glsl.js +1 -1
- package/dist/src/marks/rect.d.ts.map +1 -1
- package/dist/src/marks/rect.fragment.glsl.js +1 -1
- package/dist/src/marks/rect.js +41 -0
- package/dist/src/marks/rect.vertex.glsl.js +1 -1
- package/dist/src/selection/selection.d.ts +27 -2
- package/dist/src/selection/selection.d.ts.map +1 -1
- package/dist/src/selection/selection.js +53 -3
- package/dist/src/spec/data.d.ts +18 -1
- package/dist/src/spec/mark.d.ts +58 -1
- package/dist/src/spec/parameter.d.ts +71 -31
- package/dist/src/spec/view.d.ts +9 -2
- package/dist/src/styles/genome-spy.css.d.ts +1 -1
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
- package/dist/src/styles/genome-spy.css.js +12 -1
- package/dist/src/styles/genome-spy.scss +19 -1
- package/dist/src/types/selectionTypes.d.ts +4 -7
- package/dist/src/utils/expression.d.ts.map +1 -1
- package/dist/src/utils/expression.js +4 -0
- package/dist/src/utils/ui/tooltip.d.ts +6 -10
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
- package/dist/src/utils/ui/tooltip.js +74 -42
- package/dist/src/view/concatView.d.ts +1 -1
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +53 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -0
- package/dist/src/view/gridView/gridChild.js +753 -0
- package/dist/src/view/gridView/gridView.d.ts +64 -0
- package/dist/src/view/gridView/gridView.d.ts.map +1 -0
- package/dist/src/view/{gridView.js → gridView/gridView.js} +40 -595
- package/dist/src/view/gridView/scrollbar.d.ts +32 -0
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -0
- package/dist/src/view/gridView/scrollbar.js +186 -0
- package/dist/src/view/gridView/selectionRect.d.ts +10 -0
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -0
- package/dist/src/view/gridView/selectionRect.js +182 -0
- package/dist/src/view/layout/rectangle.d.ts +11 -1
- package/dist/src/view/layout/rectangle.d.ts.map +1 -1
- package/dist/src/view/layout/rectangle.js +22 -2
- package/dist/src/view/layout/rectangle.test.js +12 -0
- package/dist/src/view/paramMediator.d.ts.map +1 -1
- package/dist/src/view/paramMediator.js +9 -0
- package/dist/src/view/scaleResolution.d.ts +1 -0
- package/dist/src/view/scaleResolution.d.ts.map +1 -1
- package/dist/src/view/scaleResolution.js +43 -33
- package/dist/src/view/view.d.ts +6 -0
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +19 -0
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +13 -1
- package/package.json +2 -2
- package/dist/src/view/gridView.d.ts +0 -135
- package/dist/src/view/gridView.d.ts.map +0 -1
|
@@ -5,68 +5,96 @@ import { peek } from "../arrayUtils.js";
|
|
|
5
5
|
export const SUPPRESS_TOOLTIP_CLASS_NAME = "gs-suppress-tooltip";
|
|
6
6
|
|
|
7
7
|
export default class Tooltip {
|
|
8
|
+
#sticky = false;
|
|
9
|
+
#visible = true;
|
|
10
|
+
|
|
11
|
+
/** @type {any} */
|
|
12
|
+
#previousTooltipDatum = undefined;
|
|
13
|
+
|
|
14
|
+
#penaltyUntil = 0;
|
|
15
|
+
|
|
16
|
+
/** @type {[number, number]} */
|
|
17
|
+
#lastCoords = undefined;
|
|
18
|
+
|
|
19
|
+
#previousMove = 0;
|
|
20
|
+
|
|
21
|
+
/** @type {HTMLDivElement} */
|
|
22
|
+
#element;
|
|
23
|
+
|
|
24
|
+
/** @type {HTMLElement} */
|
|
25
|
+
#container;
|
|
26
|
+
|
|
27
|
+
#enabledStack = [true];
|
|
28
|
+
|
|
8
29
|
/**
|
|
9
30
|
* @param {HTMLElement} container
|
|
10
31
|
*/
|
|
11
32
|
constructor(container) {
|
|
12
|
-
this
|
|
13
|
-
|
|
14
|
-
this.element = document.createElement("div");
|
|
15
|
-
this.element.className = "tooltip";
|
|
16
|
-
this._visible = true;
|
|
17
|
-
this.container.appendChild(this.element);
|
|
33
|
+
this.#container = container;
|
|
18
34
|
|
|
19
|
-
|
|
20
|
-
this.
|
|
35
|
+
this.#element = document.createElement("div");
|
|
36
|
+
this.#element.className = "tooltip";
|
|
37
|
+
this.#container.appendChild(this.#element);
|
|
21
38
|
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
this._penaltyUntil = 0;
|
|
25
|
-
/** @type {[number, number]} */
|
|
26
|
-
this._lastCoords = undefined;
|
|
39
|
+
this.clear();
|
|
40
|
+
}
|
|
27
41
|
|
|
28
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @param {boolean} sticky
|
|
44
|
+
*/
|
|
45
|
+
set sticky(sticky) {
|
|
46
|
+
if (!sticky && this.#sticky) {
|
|
47
|
+
this.clear();
|
|
48
|
+
}
|
|
49
|
+
this.#sticky = sticky;
|
|
50
|
+
this.#element.classList.toggle("sticky", this.#sticky);
|
|
51
|
+
}
|
|
29
52
|
|
|
30
|
-
|
|
53
|
+
get sticky() {
|
|
54
|
+
return this.#sticky;
|
|
31
55
|
}
|
|
32
56
|
|
|
33
57
|
/**
|
|
34
58
|
* @param {boolean} visible
|
|
35
59
|
*/
|
|
36
60
|
set visible(visible) {
|
|
37
|
-
if (visible != this
|
|
38
|
-
this
|
|
39
|
-
this
|
|
61
|
+
if (visible != this.#visible) {
|
|
62
|
+
this.#element.style.display = visible ? null : "none";
|
|
63
|
+
this.#visible = visible;
|
|
40
64
|
}
|
|
41
65
|
}
|
|
42
66
|
|
|
43
67
|
get visible() {
|
|
44
|
-
return this
|
|
68
|
+
return this.#visible;
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
get enabled() {
|
|
48
|
-
return peek(this
|
|
72
|
+
return peek(this.#enabledStack) ?? true;
|
|
49
73
|
}
|
|
50
74
|
|
|
51
75
|
/**
|
|
52
76
|
* @param {boolean} enabled True if tooltip is enabled (allowed to be shown)
|
|
53
77
|
*/
|
|
54
78
|
pushEnabledState(enabled) {
|
|
55
|
-
this
|
|
79
|
+
this.#enabledStack.push(enabled);
|
|
56
80
|
if (!enabled) {
|
|
57
81
|
this.visible = false;
|
|
58
82
|
}
|
|
59
83
|
}
|
|
60
84
|
|
|
61
85
|
popEnabledState() {
|
|
62
|
-
this
|
|
86
|
+
this.#enabledStack.pop();
|
|
63
87
|
}
|
|
64
88
|
|
|
65
89
|
/**
|
|
66
90
|
* @param {MouseEvent} mouseEvent
|
|
67
91
|
*/
|
|
68
92
|
handleMouseMove(mouseEvent) {
|
|
69
|
-
|
|
93
|
+
if (this.#sticky) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.mouseCoords = clientPoint(this.#container, mouseEvent);
|
|
70
98
|
|
|
71
99
|
const now = performance.now();
|
|
72
100
|
|
|
@@ -75,28 +103,28 @@ export default class Tooltip {
|
|
|
75
103
|
if (
|
|
76
104
|
!this.visible &&
|
|
77
105
|
!this._isPenalty() &&
|
|
78
|
-
now - this
|
|
106
|
+
now - this.#previousMove > 500
|
|
79
107
|
) {
|
|
80
|
-
this
|
|
108
|
+
this.#penaltyUntil = now + 70;
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
// Disable the tooltip for a while if the mouse is being moved very quickly.
|
|
84
112
|
// Makes the tooltip less annoying.
|
|
85
113
|
// TODO: Should calculate speed: pixels per millisecond or something
|
|
86
114
|
if (
|
|
87
|
-
this
|
|
88
|
-
distance(this.mouseCoords, this
|
|
115
|
+
this.#lastCoords &&
|
|
116
|
+
distance(this.mouseCoords, this.#lastCoords) > 20
|
|
89
117
|
) {
|
|
90
|
-
this
|
|
118
|
+
this.#penaltyUntil = now + 400;
|
|
91
119
|
}
|
|
92
120
|
|
|
93
|
-
this
|
|
121
|
+
this.#lastCoords = this.mouseCoords;
|
|
94
122
|
|
|
95
123
|
if (this.visible) {
|
|
96
124
|
this.updatePlacement();
|
|
97
125
|
}
|
|
98
126
|
|
|
99
|
-
this
|
|
127
|
+
this.#previousMove = now;
|
|
100
128
|
}
|
|
101
129
|
|
|
102
130
|
updatePlacement() {
|
|
@@ -106,15 +134,15 @@ export default class Tooltip {
|
|
|
106
134
|
const [mouseX, mouseY] = this.mouseCoords;
|
|
107
135
|
|
|
108
136
|
let x = mouseX + spacing;
|
|
109
|
-
if (x > this
|
|
110
|
-
x = mouseX - spacing - this
|
|
137
|
+
if (x > this.#container.clientWidth - this.#element.offsetWidth) {
|
|
138
|
+
x = mouseX - spacing - this.#element.offsetWidth;
|
|
111
139
|
}
|
|
112
|
-
this
|
|
140
|
+
this.#element.style.left = x + "px";
|
|
113
141
|
|
|
114
|
-
this
|
|
142
|
+
this.#element.style.top =
|
|
115
143
|
Math.min(
|
|
116
144
|
mouseY + spacing,
|
|
117
|
-
this
|
|
145
|
+
this.#container.clientHeight - this.#element.offsetHeight
|
|
118
146
|
) + "px";
|
|
119
147
|
}
|
|
120
148
|
|
|
@@ -122,16 +150,20 @@ export default class Tooltip {
|
|
|
122
150
|
* @param {string | import("lit").TemplateResult | HTMLElement} content
|
|
123
151
|
*/
|
|
124
152
|
setContent(content) {
|
|
153
|
+
if (this.#sticky) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
125
157
|
if (!content || !this.enabled || this._isPenalty()) {
|
|
126
158
|
if (this.visible) {
|
|
127
|
-
render("", this
|
|
159
|
+
render("", this.#element);
|
|
128
160
|
this.visible = false;
|
|
129
161
|
}
|
|
130
|
-
this
|
|
162
|
+
this.#previousTooltipDatum = undefined;
|
|
131
163
|
return;
|
|
132
164
|
}
|
|
133
165
|
|
|
134
|
-
render(content, this
|
|
166
|
+
render(content, this.#element);
|
|
135
167
|
|
|
136
168
|
this.visible = true;
|
|
137
169
|
|
|
@@ -139,7 +171,7 @@ export default class Tooltip {
|
|
|
139
171
|
}
|
|
140
172
|
|
|
141
173
|
clear() {
|
|
142
|
-
this
|
|
174
|
+
this.#previousTooltipDatum = undefined;
|
|
143
175
|
this.setContent(undefined);
|
|
144
176
|
}
|
|
145
177
|
|
|
@@ -152,8 +184,8 @@ export default class Tooltip {
|
|
|
152
184
|
* @template T
|
|
153
185
|
*/
|
|
154
186
|
updateWithDatum(datum, converter) {
|
|
155
|
-
if (datum !== this
|
|
156
|
-
this
|
|
187
|
+
if (datum !== this.#previousTooltipDatum) {
|
|
188
|
+
this.#previousTooltipDatum = datum;
|
|
157
189
|
if (!converter) {
|
|
158
190
|
converter = (d) =>
|
|
159
191
|
Promise.resolve(html` ${JSON.stringify(d)} `);
|
|
@@ -170,7 +202,7 @@ export default class Tooltip {
|
|
|
170
202
|
}
|
|
171
203
|
|
|
172
204
|
_isPenalty() {
|
|
173
|
-
return this
|
|
205
|
+
return this.#penaltyUntil && this.#penaltyUntil > performance.now();
|
|
174
206
|
}
|
|
175
207
|
}
|
|
176
208
|
|
|
@@ -12,5 +12,5 @@ export default class ConcatView extends GridView {
|
|
|
12
12
|
*/
|
|
13
13
|
constructor(spec: import("../spec/view.js").AnyConcatSpec, context: import("../types/viewContext.js").default, layoutParent: import("./containerView.js").default, dataParent: import("./view.js").default, name: string);
|
|
14
14
|
}
|
|
15
|
-
import GridView from "./gridView.js";
|
|
15
|
+
import GridView from "./gridView/gridView.js";
|
|
16
16
|
//# sourceMappingURL=concatView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concatView.d.ts","sourceRoot":"","sources":["../../../src/view/concatView.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,kBANW,OAAO,iBAAiB,EAAE,aAAa,WACvC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,EAiBhB;CAqDJ;qBAlFoB,
|
|
1
|
+
{"version":3,"file":"concatView.d.ts","sourceRoot":"","sources":["../../../src/view/concatView.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,kBANW,OAAO,iBAAiB,EAAE,aAAa,WACvC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,EAiBhB;CAqDJ;qBAlFoB,wBAAwB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../../spec/view.js").ViewBackground} viewBackground
|
|
3
|
+
* @returns {import("../../spec/view.js").UnitSpec}
|
|
4
|
+
*/
|
|
5
|
+
export function createBackground(viewBackground: import("../../spec/view.js").ViewBackground): import("../../spec/view.js").UnitSpec;
|
|
6
|
+
/**
|
|
7
|
+
* @param {import("../../spec/view.js").ViewBackground} viewBackground
|
|
8
|
+
* @returns {import("../../spec/view.js").UnitSpec}
|
|
9
|
+
*/
|
|
10
|
+
export function createBackgroundStroke(viewBackground: import("../../spec/view.js").ViewBackground): import("../../spec/view.js").UnitSpec;
|
|
11
|
+
export default class GridChild {
|
|
12
|
+
/**
|
|
13
|
+
* @param {import("../view.js").default} view
|
|
14
|
+
* @param {import("../containerView.js").default} layoutParent
|
|
15
|
+
* @param {number} serial
|
|
16
|
+
*/
|
|
17
|
+
constructor(view: import("../view.js").default, layoutParent: import("../containerView.js").default, serial: number);
|
|
18
|
+
layoutParent: import("../containerView.js").default;
|
|
19
|
+
view: import("../view.js").default;
|
|
20
|
+
serial: number;
|
|
21
|
+
/** @type {UnitView} */
|
|
22
|
+
background: UnitView;
|
|
23
|
+
/** @type {UnitView} */
|
|
24
|
+
backgroundStroke: UnitView;
|
|
25
|
+
/** @type {Partial<Record<import("../../spec/axis.js").AxisOrient, AxisView>>} axes */
|
|
26
|
+
axes: Partial<Record<import("../../spec/axis.js").AxisOrient, AxisView>>;
|
|
27
|
+
/** @type {Partial<Record<import("../../spec/axis.js").AxisOrient, AxisGridView>>} gridLines */
|
|
28
|
+
gridLines: Partial<Record<import("../../spec/axis.js").AxisOrient, AxisGridView>>;
|
|
29
|
+
/** @type {Partial<Record<import("./scrollbar.js").ScrollDirection, Scrollbar>>} */
|
|
30
|
+
scrollbars: Partial<Record<import("./scrollbar.js").ScrollDirection, Scrollbar>>;
|
|
31
|
+
/** @type {SelectionRect} */
|
|
32
|
+
selectionRect: SelectionRect;
|
|
33
|
+
/** @type {UnitView} */
|
|
34
|
+
title: UnitView;
|
|
35
|
+
/** @type {Rectangle} */
|
|
36
|
+
coords: Rectangle;
|
|
37
|
+
getChildren(): Generator<import("../view.js").default, void, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Create view decorations, grid lines, axes, etc.
|
|
40
|
+
*/
|
|
41
|
+
createAxes(): Promise<void>;
|
|
42
|
+
getOverhang(): Padding;
|
|
43
|
+
getOverhangAndPadding(): Padding;
|
|
44
|
+
#private;
|
|
45
|
+
}
|
|
46
|
+
import UnitView from "../unitView.js";
|
|
47
|
+
import AxisView from "../axisView.js";
|
|
48
|
+
import AxisGridView from "../axisGridView.js";
|
|
49
|
+
import Scrollbar from "./scrollbar.js";
|
|
50
|
+
import SelectionRect from "./selectionRect.js";
|
|
51
|
+
import Rectangle from "../layout/rectangle.js";
|
|
52
|
+
import Padding from "../layout/padding.js";
|
|
53
|
+
//# sourceMappingURL=gridChild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridChild.d.ts","sourceRoot":"","sources":["../../../../src/view/gridView/gridChild.js"],"names":[],"mappings":"AA+pBA;;;GAGG;AACH,iDAHW,OAAO,oBAAoB,EAAE,cAAc,GACzC,OAAO,oBAAoB,EAAE,QAAQ,CA8BjD;AAED;;;GAGG;AACH,uDAHW,OAAO,oBAAoB,EAAE,cAAc,GACzC,OAAO,oBAAoB,EAAE,QAAQ,CA6CjD;AA7tBD;IACI;;;;OAIG;IACH,kBAJW,OAAO,YAAY,EAAE,OAAO,gBAC5B,OAAO,qBAAqB,EAAE,OAAO,UACrC,MAAM,EAyFhB;IAtFG,oDAAgC;IAChC,mCAAgB;IAChB,eAAoB;IAEpB,uBAAuB;IACvB,YADW,QAAQ,CACQ;IAE3B,uBAAuB;IACvB,kBADW,QAAQ,CACc;IAEjC,sFAAsF;IACtF,MADW,OAAO,CAAC,MAAM,CAAC,OAAO,oBAAoB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAC/D;IAEd,+FAA+F;IAC/F,WADW,OAAO,CAAC,MAAM,CAAC,OAAO,oBAAoB,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAC9D;IAEnB,mFAAmF;IACnF,YADW,OAAO,CAAC,MAAM,CAAC,OAAO,gBAAgB,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,CAC3D;IAEpB,4BAA4B;IAC5B,eADW,aAAa,CACM;IAE9B,uBAAuB;IACvB,OADW,QAAQ,CACG;IAEtB,wBAAwB;IACxB,QADW,SAAS,CACQ;IAiZhC,sEAiBC;IAED;;OAEG;IACH,4BAsKC;IAED,uBAqBC;IAED,iCAEC;;CACJ;qBA9oBoB,gBAAgB;qBANK,gBAAgB;yBADjC,oBAAoB;sBAQvB,gBAAgB;0BACZ,oBAAoB;sBAJxB,wBAAwB;oBAF1B,sBAAsB"}
|