@fusion.dev/helix-headless 0.190.0 → 0.192.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/api.json +1 -1
- package/custom-elements.json +47 -36
- package/dist/spatial-heatmap/projection.d.ts +28 -18
- package/dist/spatial-heatmap/projection.js +79 -51
- package/dist/spatial-heatmap/root/spatial-heatmap-root.d.ts +26 -17
- package/dist/spatial-heatmap/root/spatial-heatmap-root.js +32 -21
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +1 -1
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +24 -14
- package/types/vue.d.ts +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { CHART_PLOT, commaList, customElement, drawTooltip, HelixPlotChangeEvent, HelixPlotTurnEvent, isRtl, MIRROR_RULE, spokenReading, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
|
|
2
|
+
import { CHART_PLOT, commaList, customElement, drawTooltip, HelixPlotChangeEvent, HelixPlotTurnEvent, ISOMETRIC, isRtl, MIRROR_RULE, spokenReading, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg, } from 'lit';
|
|
4
4
|
import { property, state } from 'lit/decorators.js';
|
|
5
5
|
import '../../tooltip/index.js';
|
|
6
6
|
import { fits, toneOf } from '../../heatmap/root/buckets.js';
|
|
7
7
|
import { HelixHeadlessHeatmap } from '../../heatmap/root/heatmap-root.js';
|
|
8
|
-
import {
|
|
8
|
+
import { turned } from '../../spatial-scatter-chart/view.js';
|
|
9
|
+
import { ACROSS, heightsOf, highestOf, reliefOf, } from '../projection.js';
|
|
9
10
|
const TURNS = {
|
|
10
11
|
ArrowDown: { across: 0, up: -1 },
|
|
11
12
|
ArrowLeft: { across: -1, up: 0 },
|
|
@@ -18,12 +19,12 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
18
19
|
this.flat = false;
|
|
19
20
|
this.relief = 2;
|
|
20
21
|
this.shown = undefined;
|
|
22
|
+
this.camera = ISOMETRIC;
|
|
21
23
|
this.rendered = false;
|
|
22
24
|
this.told = { at: -1, field: '' };
|
|
23
25
|
this.onTurnKeydown = (event) => {
|
|
24
26
|
const turn = TURNS[event.key];
|
|
25
|
-
if (!
|
|
26
|
-
!event.shiftKey ||
|
|
27
|
+
if (!event.shiftKey ||
|
|
27
28
|
!turn ||
|
|
28
29
|
this.selectionMode === 'multiple' ||
|
|
29
30
|
event.altKey ||
|
|
@@ -34,7 +35,12 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
34
35
|
}
|
|
35
36
|
event.preventDefault();
|
|
36
37
|
event.stopPropagation();
|
|
37
|
-
this.
|
|
38
|
+
if (this.rendered) {
|
|
39
|
+
this.dispatchEvent(new HelixPlotTurnEvent(turn));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.camera = turned(this.camera, turn.across, turn.up);
|
|
43
|
+
}
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
46
|
static { this.words = 'helix-spatial-heatmap'; }
|
|
@@ -111,7 +117,7 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
111
117
|
const tallest = this.flat ? 0 : Math.max(0, this.relief || 0);
|
|
112
118
|
const highest = highestOf(this.points.map((point) => point.value));
|
|
113
119
|
const heights = heightsOf(this.drawn.map((point) => point.value), highest, tallest);
|
|
114
|
-
return reliefOf(heights, this.rowCount, this.cellPx / (this.cellPx + this.gapPx));
|
|
120
|
+
return reliefOf(heights, this.rowCount, this.cellPx / (this.cellPx + this.gapPx), this.camera);
|
|
115
121
|
}
|
|
116
122
|
render() {
|
|
117
123
|
const bounds = writtenNumbers(this.thresholds);
|
|
@@ -124,7 +130,7 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
124
130
|
const relief = this.drawnRelief();
|
|
125
131
|
this.shown = relief;
|
|
126
132
|
const at = this.pointer.at;
|
|
127
|
-
const prisms = relief.
|
|
133
|
+
const prisms = relief.order.map((index) => this.renderPrism(relief.prisms[index], at === index, chosen.has(keys[index] ?? ''), grid, toneOf(cells[index] ?? { value: undefined }, bounds, palette)));
|
|
128
134
|
const { box } = relief;
|
|
129
135
|
const drawing = readable
|
|
130
136
|
? html `<svg
|
|
@@ -135,7 +141,7 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
135
141
|
style=${this.rendered ? 'opacity: 0; pointer-events: none' : nothing}
|
|
136
142
|
viewBox="${box.x} ${box.y} ${box.width} ${box.height}"
|
|
137
143
|
xmlns="http://www.w3.org/2000/svg"
|
|
138
|
-
>${relief.base ? this.renderBase(relief.base) : nothing}${grid ? this.
|
|
144
|
+
>${relief.base ? this.renderBase(relief.base) : nothing}${prisms}${grid ? this.renderGridRows(cells.length, keys, chosen) : nothing}</svg>`
|
|
139
145
|
: nothing;
|
|
140
146
|
return html `<div
|
|
141
147
|
aria-activedescendant=${grid && at >= 0 ? `cell-${at}` : nothing}
|
|
@@ -162,19 +168,14 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
162
168
|
? html `<span part="selection" role="status">${this.status.said}</span>`
|
|
163
169
|
: nothing}${this.renderTable()}`;
|
|
164
170
|
}
|
|
165
|
-
renderPrism(
|
|
166
|
-
const row = grid ? this.sourceRows[this.points.length - this.drawn.length + index] : undefined;
|
|
167
|
-
const name = row ? spokenReading(row) : '';
|
|
171
|
+
renderPrism(prism, active, picked, grid, tone) {
|
|
168
172
|
return svg `<g
|
|
169
|
-
aria-
|
|
170
|
-
|
|
171
|
-
data-index=${index}
|
|
173
|
+
aria-hidden=${grid ? 'true' : nothing}
|
|
174
|
+
data-index=${prism.index}
|
|
172
175
|
data-tone=${tone ?? nothing}
|
|
173
|
-
id=${grid ? `cell-${index}` : nothing}
|
|
174
176
|
part="cell${active ? ' cell-active' : ''}${picked ? ' cell-selected' : ''}"
|
|
175
|
-
role=${grid ? 'gridcell' : nothing}
|
|
176
177
|
style=${tone === undefined ? nothing : `--heatmap-tone: var(--heatmap-tone-${tone})`}
|
|
177
|
-
|
|
178
|
+
>${prism.left ? svg `<path d=${prism.left} part="left-face"></path>` : nothing}${prism.right ? svg `<path d=${prism.right} part="right-face"></path>` : nothing}<path d=${prism.top} part="top-face"></path></g>`;
|
|
178
179
|
}
|
|
179
180
|
renderBase(base) {
|
|
180
181
|
return svg `<g aria-hidden="true" part="base"><path d=${base.left} part="base-left"></path><path d=${base.right} part="base-right"></path><path d=${base.top} part="base-top"></path></g>`;
|
|
@@ -202,11 +203,18 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
|
|
|
202
203
|
`--spatial-heatmap-start-y: ${share(start.y)}`,
|
|
203
204
|
].join('; ');
|
|
204
205
|
}
|
|
205
|
-
|
|
206
|
-
const size = this.rowCount === 1 ?
|
|
206
|
+
renderGridRows(count, keys, chosen) {
|
|
207
|
+
const size = this.rowCount === 1 ? count : this.rowCount;
|
|
208
|
+
const first = this.points.length - this.drawn.length;
|
|
207
209
|
const rows = [];
|
|
208
|
-
for (let start = 0; start <
|
|
209
|
-
|
|
210
|
+
for (let start = 0; start < count; start += size) {
|
|
211
|
+
const cells = [];
|
|
212
|
+
for (let index = start; index < Math.min(start + size, count); index++) {
|
|
213
|
+
const row = this.sourceRows[first + index];
|
|
214
|
+
const name = row ? spokenReading(row) : '';
|
|
215
|
+
cells.push(svg `<g aria-label=${name || nothing} aria-selected=${chosen.has(keys[index] ?? '') ? 'true' : 'false'} id=${`cell-${index}`} role="gridcell"></g>`);
|
|
216
|
+
}
|
|
217
|
+
rows.push(svg `<g part="row" role="row">${cells}</g>`);
|
|
210
218
|
}
|
|
211
219
|
return rows;
|
|
212
220
|
}
|
|
@@ -237,6 +245,9 @@ __decorate([
|
|
|
237
245
|
__decorate([
|
|
238
246
|
property({ type: Number })
|
|
239
247
|
], HelixHeadlessSpatialHeatmap.prototype, "relief", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
state()
|
|
250
|
+
], HelixHeadlessSpatialHeatmap.prototype, "camera", void 0);
|
|
240
251
|
__decorate([
|
|
241
252
|
state()
|
|
242
253
|
], HelixHeadlessSpatialHeatmap.prototype, "rendered", void 0);
|
|
@@ -52,7 +52,7 @@ declare const HelixHeadlessSpatialScatterChart_base: typeof HelixElement & (new
|
|
|
52
52
|
* | Enter, Space | Presses the point, which sends `helix-reading-press`. |
|
|
53
53
|
* | Escape | Lets the point go. |
|
|
54
54
|
*
|
|
55
|
-
* @since 0.
|
|
55
|
+
* @since 0.190.0
|
|
56
56
|
* @status experimental
|
|
57
57
|
* @category charts
|
|
58
58
|
* @aliases 3D scatter chart, 3D scatter plot, Point cloud, Three-dimensional scatter
|
|
@@ -54,7 +54,7 @@ declare const HelixHeadlessSpatialSurfaceChart_base: typeof HelixElement & (new
|
|
|
54
54
|
* | Enter, Space | Presses the place, which sends `helix-reading-press`. |
|
|
55
55
|
* | Escape | Lets the place go. |
|
|
56
56
|
*
|
|
57
|
-
* @since 0.
|
|
57
|
+
* @since 0.190.0
|
|
58
58
|
* @status experimental
|
|
59
59
|
* @category charts
|
|
60
60
|
* @aliases 3D surface chart, 3D surface plot, Surface chart, Height map, Terrain chart
|