@mosaicajs/components 0.2.0 → 0.4.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 (52) hide show
  1. package/README.md +2 -0
  2. package/dist/aggregate.d.ts +4 -10
  3. package/dist/aggregate.js +7 -13
  4. package/dist/artifact-card.d.ts +21 -7
  5. package/dist/artifact-card.js +136 -79
  6. package/dist/base.d.ts +44 -5
  7. package/dist/base.js +54 -5
  8. package/dist/cluster-filter.d.ts +29 -25
  9. package/dist/cluster-filter.js +123 -106
  10. package/dist/colour-editor.d.ts +15 -4
  11. package/dist/colour-editor.js +107 -34
  12. package/dist/colour-picker.d.ts +12 -5
  13. package/dist/colour-picker.js +119 -32
  14. package/dist/display.js +77 -9
  15. package/dist/events.d.ts +21 -7
  16. package/dist/explorer.d.ts +118 -37
  17. package/dist/explorer.js +487 -212
  18. package/dist/field-card.d.ts +304 -48
  19. package/dist/field-card.js +1364 -244
  20. package/dist/filter-panel.d.ts +54 -10
  21. package/dist/filter-panel.js +242 -42
  22. package/dist/filter.d.ts +22 -4
  23. package/dist/filter.js +113 -34
  24. package/dist/hierarchy.d.ts +68 -45
  25. package/dist/hierarchy.js +320 -243
  26. package/dist/item-card.d.ts +62 -14
  27. package/dist/item-card.js +310 -110
  28. package/dist/key-picker.d.ts +2 -1
  29. package/dist/key-picker.js +4 -3
  30. package/dist/layer-picker.d.ts +4 -2
  31. package/dist/layer-picker.js +16 -7
  32. package/dist/lineage.d.ts +132 -0
  33. package/dist/lineage.js +307 -0
  34. package/dist/map.d.ts +135 -24
  35. package/dist/map.js +387 -117
  36. package/dist/mosaica-components.js +1848 -832
  37. package/dist/mosaica-components.js.sri +1 -1
  38. package/dist/mosaica-components.json +2 -2
  39. package/dist/parts.d.ts +4 -4
  40. package/dist/parts.js +18 -4
  41. package/dist/paths.d.ts +34 -12
  42. package/dist/paths.js +84 -46
  43. package/dist/selection.d.ts +22 -3
  44. package/dist/selection.js +125 -59
  45. package/dist/states.d.ts +72 -0
  46. package/dist/states.js +135 -26
  47. package/dist/status.d.ts +63 -5
  48. package/dist/status.js +215 -36
  49. package/dist/tokens.d.ts +8 -4
  50. package/dist/tokens.js +144 -14
  51. package/dist/view-picker.js +5 -0
  52. package/package.json +4 -3
package/dist/map.d.ts CHANGED
@@ -114,13 +114,29 @@ export type MapProbe = {
114
114
  * A box or lasso drawn with the toolbar becomes the store's selected region, which narrows the map
115
115
  * and every count to the items inside it. Shift-drag draws a box without changing tool. With the
116
116
  * map focused, the arrow keys pan and `+` and `-` zoom. Escape cancels a shape being drawn, or
117
- * clears the region when there is no shape, or drops the picked item when there is neither.
117
+ * clears the region when there is no shape, or drops the picked item when there is neither. With
118
+ * none of the three, the map leaves Escape to the page, so a dialog holding the map still closes.
118
119
  *
119
- * When the map cannot draw the view, it says why over the canvas.
120
+ * The hover tooltip follows the pointer and stays inside the map. Escape dismisses it wherever the
121
+ * focus is, and it stays away until the pointer moves onto another point. With the focus in the
122
+ * map, or in an element that renders the map inside its own shadow root, such as
123
+ * `<mosaica-explorer>`, the press does nothing else: the map calls `preventDefault` on it, and
124
+ * clears no selection on it. With the focus anywhere else on the page, the map leaves the press as
125
+ * it was, so the page's own Escape still acts.
126
+ *
127
+ * When the map cannot draw the view, it says why over the canvas, and screen readers announce it.
128
+ * Nothing in view is announced as the answer to a change of filters, highlight or selection, and
129
+ * only shown where a pan went. Screen readers also announce the basemap's note, and how many items
130
+ * match inside the selected region, once, when the query that counts it has finished loading. Set
131
+ * `quiet` where another element on the page says the same things, such as a status strip: the map
132
+ * shows the same, and announces only what it alone knows, the basemap's note and a basemap it
133
+ * refuses.
134
+ *
135
+ * With `ground` unset the map follows the page's colour scheme, and draws again when it changes.
120
136
  *
121
137
  * The canvas is a single tab stop, and it takes any `tabindex` or `aria-label` you set on the map.
122
- * Without an `aria-label`, the canvas is labelled with its keys, "map: arrow keys pan, + and -
123
- * zoom", so that someone using a screen reader knows how to move it.
138
+ * Without an `aria-label` the canvas is named "Map". Either way its description lists its keys, so
139
+ * that someone using a screen reader knows how to move it.
124
140
  *
125
141
  * @summary An interactive map with no panels around it.
126
142
  * @tagname mosaica-map
@@ -149,23 +165,26 @@ export type MapProbe = {
149
165
  * @fires {CustomEvent<MosaicaEventDetails['mosaica-layerchange']>} mosaica-layerchange - The
150
166
  * `layers` attribute changed.
151
167
  * @csspart canvas - The deck.gl canvas's container.
152
- * @csspart overlay - The message over the canvas when the view is refused, expired or empty, or the
153
- * server cannot be reached, did not answer or is too busy. If the viewer may see no item in the
154
- * view at all, it says so instead of "Nothing in view".
168
+ * @csspart overlay - The layer over the canvas that holds the state line.
155
169
  * @csspart state - The state line inside the overlay, with `data-state`, and `data-visible="none"`
156
- * if the viewer may see no item in the view.
170
+ * if the viewer may see no item in the view. It shows a message when the view is refused,
171
+ * expired or empty, or the server cannot be reached, did not answer or is too busy; if the viewer
172
+ * may see no item in the view at all, it says so instead of "Nothing in view". It is in the page
173
+ * in every state, and drawn only while it has a message.
157
174
  * @csspart retry - The Retry button in the overlay, after a refusal, no answer or a busy server.
158
175
  * @csspart refusal - The words "View refused", or "Server busy", inside the overlay, with
159
176
  * `data-code` set to the refusal's code.
160
177
  * @csspart reason - The server's reason for a refusal, as it sent it, on a line under "View
161
178
  * refused".
162
179
  * @csspart controls - The toolbar.
163
- * @csspart region-tag - The tag on the selected region's top-left corner, with how many items
164
- * match inside it (or outside it, for its complement) and a button that clears it.
180
+ * @csspart region-tag - The tag above the selected region's top-left corner, with how many items
181
+ * match inside it (or outside it, for its complement) and a button that clears it. It stays
182
+ * inside the map when the corner is off it.
165
183
  * @csspart tooltip - The hover tooltip.
166
184
  * @csspart density-key - The key to density's colours in items per cell, in the bottom-left corner.
167
185
  * Shown while density is drawn in a colour ramp or without the points.
168
- * @csspart note - Why no basemap is drawn under this view, in the bottom-right corner.
186
+ * @csspart note - Why no basemap is drawn under this view, in the bottom-right corner. It is in the
187
+ * page whether or not there is a note, and drawn only while there is one.
169
188
  * @csspart attribution - The tile server's credit, in the bottom-right corner while tiles are drawn.
170
189
  * @cssprop --mosaica-map-height - The map's height.
171
190
  * @cssprop --mosaica-map-bg - The canvas's background, behind the points and any basemap.
@@ -188,10 +207,20 @@ export declare class MosaicaMap extends MosaicaElement {
188
207
  /** How many marks to aim for on screen. `0` keeps the store's budget, which starts at 250000. */
189
208
  accessor budget: number;
190
209
  /**
191
- * The most clusters a `nested` or `dag` layer is cut to (`Store.setClusterBudget`). `0` keeps the
192
- * store's setting; setting `0` after another value removes the limit, giving the finest cut.
210
+ * The side in CSS pixels of the square of the map each cluster is given (`Store.setClusterSpacing`),
211
+ * so the map shows about one cluster per square whatever its size: at 100, a map 1,200 by 800
212
+ * pixels shows 96. `0` keeps the store's setting; setting `0` after another value removes the
213
+ * limit.
214
+ *
215
+ * A `nested` or `dag` layer is cut to that many clusters. A `stacked` or `tiered` layer whose
216
+ * levels declare no zoom range and which `clusterLevels` leaves to follow the zoom is drawn at the
217
+ * finest level with no more than that many clusters in view and no tile in view holding the most a
218
+ * tile is served, so the world view shows a broad level and finer ones appear as the camera zooms
219
+ * in. Without a spacing only a full tile holds a level back, so such a layer is drawn at its
220
+ * finest level at every zoom until its tiles fill, world zoom included, and a `nested` or `dag`
221
+ * layer is drawn at its finest cut.
193
222
  */
194
- accessor clusterBudget: number;
223
+ accessor clusterSpacing: number;
195
224
  /**
196
225
  * The columns the hover tooltip shows under the point's title, separated by spaces or commas.
197
226
  * Only rendered columns arrive with the points, so another column shows nothing.
@@ -212,10 +241,13 @@ export declare class MosaicaMap extends MosaicaElement {
212
241
  */
213
242
  accessor palette: PaletteName | '';
214
243
  /**
215
- * The level of a `stacked` or `tiered` layer at which clusters are coloured, labelled and
216
- * outlined. Unset, the coarsest level. A `nested` or `dag` layer ignores it.
244
+ * The level at which each `stacked` or `tiered` layer's clusters are coloured, labelled and
245
+ * outlined, keyed by layer name. A layer with no entry is drawn at the level that follows the zoom
246
+ * where its levels declare no zoom range (see `cluster-spacing`), and otherwise at the coarsest
247
+ * level the camera's zoom serves. A `nested` or `dag` layer ignores its entry. Set it as a
248
+ * property; it has no attribute.
217
249
  */
218
- accessor clusterLevel: number | null;
250
+ accessor clusterLevels: ReadonlyMap<string, number>;
219
251
  /**
220
252
  * What is drawn under the points. `world` is the server's outline of land, coastlines and country
221
253
  * borders, and needs a view with a map projection. `{tiles, attribution}` is a tile server's URL
@@ -231,8 +263,9 @@ export declare class MosaicaMap extends MosaicaElement {
231
263
  accessor basemap: BasemapChoice | null;
232
264
  /**
233
265
  * Whether the map's background is `light` or `dark`, for when it differs from the page's, such as
234
- * a light basemap on a dark page. Labels and density colours follow it; the toolbar and panels
235
- * follow the page. Unset, it follows the page's `color-scheme`.
266
+ * a light basemap on a dark page. The points' single colour, labels and density colours follow
267
+ * it; the toolbar and panels follow the page. Unset, it follows the page's `color-scheme`, and
268
+ * the system's where the page allows both.
236
269
  */
237
270
  accessor ground: 'light' | 'dark' | '';
238
271
  /** Hides the points. Density, outlines, labels and the selection are still drawn. */
@@ -337,6 +370,13 @@ export declare class MosaicaMap extends MosaicaElement {
337
370
  accessor sizeScale: SizeScale | '';
338
371
  /** Hides the toolbar. */
339
372
  accessor noControls: boolean;
373
+ /**
374
+ * Leaves to another element what that element also says: the view's state over the canvas and
375
+ * the selected region's count are still shown, and neither is put in a live region. Set it when
376
+ * another element on the page says the same things, such as a status strip. What only the map
377
+ * knows is announced either way: the basemap's note, and a basemap it refuses.
378
+ */
379
+ accessor quiet: boolean;
340
380
  /**
341
381
  * The corner the toolbar sits in: `top-left`, `top-right`, `bottom-left` or `bottom-right`.
342
382
  * Content in the same corner's slot sits below the toolbar in a top corner, and above it in a
@@ -442,6 +482,11 @@ export declare class MosaicaMap extends MosaicaElement {
442
482
  * styles, which is light where the host's `color-scheme` names neither.
443
483
  */
444
484
  private scheme;
485
+ /**
486
+ * Draw for the other ground when the page's or the system's colour scheme changes, which the
487
+ * colour of the `#ground` element follows: the basemap, the points and names, and the density key.
488
+ */
489
+ private onGroundChange;
445
490
  protected resetServerData(): void;
446
491
  /** Stops following the colour and size choices of the store adopted last. */
447
492
  private unwatchChoices;
@@ -457,6 +502,11 @@ export declare class MosaicaMap extends MosaicaElement {
457
502
  protected onStoreAdopted(store: Store | null): void;
458
503
  /** A store adopted since the last update, to which the host's settings are not yet written. */
459
504
  private unpushed;
505
+ /** Keeps the focus on the map when the overlay's Retry goes with its state. */
506
+ private readonly actionFocus;
507
+ private readonly emptyAnswer;
508
+ /** Whether the view is empty as a query's answer, which is announced, and not where a pan went. */
509
+ private emptyAnswered;
460
510
  /**
461
511
  * Write the host's settings to the store before the render: every one to a store adopted since
462
512
  * the last update, else those that changed. `layers` set or changed in this update fires
@@ -486,9 +536,15 @@ export declare class MosaicaMap extends MosaicaElement {
486
536
  private basemapInput;
487
537
  private syncBasemap;
488
538
  private paint;
539
+ /**
540
+ * What deck's own input handling does. Its keyboard is off in every mode, since the map takes
541
+ * the keys itself and a key would otherwise move the camera twice. In box and lasso modes the
542
+ * drag is the selection's; the wheel still zooms.
543
+ */
544
+ private controller;
489
545
  /**
490
546
  * The shapes a hover or click is resolved against ({@link contourShapes}), held until the served
491
- * set, the fetched shapes, the level or the roster change. Each is the artifact's box until its
547
+ * set, the fetched shapes, the levels or the roster change. Each is the artifact's box until its
492
548
  * shape is fetched; where boxes overlap, depth and the mark under the pointer decide.
493
549
  */
494
550
  private contoursHeld;
@@ -524,6 +580,31 @@ export declare class MosaicaMap extends MosaicaElement {
524
580
  * the pointer moved on is dropped.
525
581
  */
526
582
  private describeHovered;
583
+ /** The mark whose tooltip Escape dismissed, while the pointer stays on it. */
584
+ private dismissedHover;
585
+ /** Whether the document is listened to for the Escape that dismisses the tooltip. */
586
+ private tooltipKeys;
587
+ /** Listen to the document for Escape while a tooltip shows, wherever the focus is. */
588
+ private watchTooltipKeys;
589
+ /**
590
+ * Escape dismisses the tooltip. Pressed in the map, or in an element whose shadow tree holds the
591
+ * map, such as an explorer, it does nothing else: it is marked as taken, so the same press clears
592
+ * no selection there. Pressed anywhere else on the page it is left as it was, for the page.
593
+ */
594
+ private onTooltipKey;
595
+ /** The region's tag as last measured: its size, the map's, and how far in the top-left corner's content starts. */
596
+ private tagBox;
597
+ /** Measures the tag again when it or the map changes size, so that placing it as the camera moves reads no layout. */
598
+ private readonly tagSized;
599
+ private measureTag;
600
+ /** Put the region's tag above its region's top-left corner, inside the map, from the sizes last measured. */
601
+ private placeTag;
602
+ /**
603
+ * Move the tooltip beside the pointer and the region's tag above its region's corner, each kept
604
+ * inside the map. The tooltip is measured each time it is drawn; the tag when it is first drawn
605
+ * and when it or the map changes size.
606
+ */
607
+ private placeFloats;
527
608
  /** The element that takes the map's focus: the canvas, a tab stop of its own. @internal */
528
609
  get focusTarget(): HTMLElement | null;
529
610
  /** Focus the canvas, which takes the map's keys. */
@@ -555,12 +636,27 @@ export declare class MosaicaMap extends MosaicaElement {
555
636
  private cameraSet;
556
637
  private setViewState;
557
638
  /**
558
- * The drawn region's tag at its top-left corner: how many items match inside it (or outside, for
559
- * its complement) and a button that clears it. A region drawn as an artifact's outline has none.
639
+ * The drawn region's tag: how many items match inside it (or outside, for its complement) and a
640
+ * button that clears it. A region drawn as an artifact's outline has none. {@link placeFloats}
641
+ * puts it above the region's top-left corner.
560
642
  */
561
643
  private regionTag;
562
- /** The level clusters are drawn at: `cluster-level` where set, else the top level of a levelled layer. */
563
- private drawnLevel;
644
+ /** The top-left corner of the drawn region's bounds, in world coordinates; `null` where no shape is drawn. */
645
+ private regionCorner;
646
+ /** What the map last announced of the selected region, and the shape it said it of. */
647
+ private regionHeard;
648
+ private heardShape;
649
+ /**
650
+ * Decide what the map announces of the selected region: how many items match inside it (or
651
+ * outside), once the query that counts it has finished loading, since the figure a frame gives
652
+ * first is an estimate. The words change only with the figure or the shape, so a count is
653
+ * announced once, whatever else the map says in the meantime.
654
+ */
655
+ private hearRegion;
656
+ /** The level the layer `name` is drawn at: its entry in `clusterLevels`, else the level in view of a levelled layer. */
657
+ private levelOf;
658
+ /** {@link levelOf} for each layer drawn. */
659
+ private drawnLevels;
564
660
  /** Whether the map is drawn on a light or dark background now: `ground` if set, else the page's scheme. */
565
661
  get drawnGround(): 'light' | 'dark';
566
662
  /**
@@ -611,6 +707,21 @@ export declare class MosaicaMap extends MosaicaElement {
611
707
  private basemapCorner;
612
708
  render(): TemplateResult | typeof nothing;
613
709
  }
710
+ /**
711
+ * A box's top-left corner, moved as little as keeps the box between `min` and `max` on each axis.
712
+ * A box larger than that room starts at `min`.
713
+ *
714
+ * @internal
715
+ */
716
+ export declare function keptInside(at: readonly [number, number], size: readonly [number, number], min: readonly [number, number], max: readonly [number, number]): [number, number];
717
+ /**
718
+ * The tooltip's top-left corner for a pointer at `pointer` on a map of size `map`: below and right
719
+ * of the pointer, on the pointer's other side along an axis where it would cross the map's far
720
+ * edge, and inside the map either way.
721
+ *
722
+ * @internal
723
+ */
724
+ export declare function tooltipCorner(pointer: readonly [number, number], size: readonly [number, number], map: readonly [number, number]): [number, number];
614
725
  /** The density scale drawn: `linear` where set, else `log`. */
615
726
  export declare function drawnDensityScale(scale: string): DensityScale;
616
727
  /** The density colours drawn: those chosen, else warm grey for a wash under the points, else Viridis. */