@mosaicajs/deck 0.1.0-rc.4 → 0.1.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/layer.d.ts CHANGED
@@ -11,160 +11,146 @@ import { type Sizing } from './size.js';
11
11
  import { MarkSlab } from './slab.js';
12
12
  /**
13
13
  * The props of a {@link MosaicaLayer}: deck.gl's `CompositeLayerProps` and the props below, all
14
- * optional. `pickable` defaults to true. Set `store`, or set the projection props (`marks`,
15
- * `depth`, `artifacts`, `meta`, `legend`, `status`) yourself. A projection prop set beside
16
- * `store` is drawn in place of the store's.
14
+ * optional. `pickable` defaults to true.
15
+ *
16
+ * Usually you set `store` and the layer reads `marks`, `depth`, `artifacts`, `meta`, `legend` and
17
+ * `status` from the store's projections. You can set any of those six yourself, and your value is
18
+ * drawn in place of the store's. Without a `store`, set the ones you need; the rest draw nothing.
17
19
  */
18
20
  export type MosaicaLayerProps = CompositeLayerProps & {
19
- /** The store to read projections from. The layer subscribes to it and redraws on each change. Defaults to `null`. */
21
+ /** The store to draw. The layer redraws whenever its projections change. Defaults to `null`. */
20
22
  store?: Store | null;
21
- /** The marks to draw, in place of the store's `marks`. Defaults to `null`. */
23
+ /** The marks to draw. Defaults to the store's `marks`. */
22
24
  marks?: MarksProjection | null;
23
- /**
24
- * The depth of the frame's bands, which chooses the mark buffers drawn. Defaults to 0, which with
25
- * `store` reads the store's `view.depth`.
26
- */
25
+ /** The tile depth of the frame drawn. Defaults to 0. With a store, 0 reads the store's `view.depth`. */
27
26
  depth?: number;
28
- /** The served artifacts to name, outline and colour by, in place of the store's `artifacts`. Defaults to `null`. */
27
+ /** The artifacts to name, outline and colour by. Defaults to the store's `artifacts`. */
29
28
  artifacts?: ArtifactsProjection | null;
30
29
  /**
31
- * The `/v1/meta` answer, in place of the store's `meta`. Column colour reads its columns and the
32
- * labels and outlines read its layers; without it the marks draw in one colour. Defaults to
33
- * `null`.
30
+ * The server's `/v1/meta` response, which describes the columns and artifact layers. Defaults to
31
+ * the store's `meta`. Without it every mark is drawn in one colour.
34
32
  */
35
33
  meta?: Meta | null;
36
34
  /**
37
- * The colouring and sizing, in place of the store's `legend`. Its `colourBy` names a column, or
38
- * `cluster:<layer>` to colour each mark by the artifact it belongs to, and its `sizeBy` a number
39
- * column to size each mark by. Defaults to `null`, which draws every mark in one colour and one
40
- * size. The store's points carry a column only when the store is asked for it, through
41
- * `setColourBy`, `setSizeBy` or `setPointColumns`.
35
+ * The column the marks are coloured and sized by. Defaults to the store's `legend`. Its
36
+ * `colourBy` is a column, or `cluster:<layer>` to colour each mark by the artifact it belongs to.
37
+ * Its `sizeBy` is a number column. The store fetches a column with the points only after you call
38
+ * its `setColourBy`, `setSizeBy` or `setPointColumns`.
42
39
  */
43
40
  legend?: LegendProjection | null;
44
41
  /**
45
- * The display status, in place of the store's `status`. Under `refused` no marks are drawn.
46
- * Defaults to `idle`, which with `store` reads the store's.
42
+ * The map's status. Defaults to `idle`. With a store, `idle` reads the store's `status`. No marks
43
+ * are drawn while it is `refused`.
47
44
  */
48
45
  status?: PresentedStatus;
49
46
  /**
50
- * The level of a `stacked` or `tiered` layer to colour, name and outline artifacts at. Defaults to
51
- * `undefined`, the layer's top (coarsest) level; on a `nested` or `dag` layer, the cut served.
47
+ * The level of a `stacked` or `tiered` artifact layer to colour, name and outline artifacts at.
48
+ * Defaults to the coarsest level served. On a `nested` or `dag` layer it has no default, and each
49
+ * mark takes the nearest artifact served.
52
50
  */
53
51
  clusterLevel?: number;
54
- /** Whether the artifacts' names are drawn at their centroids, with the hovered one's count. Defaults to true. */
52
+ /** Whether to draw the artifacts' names, with the count of the one under the pointer. Defaults to `true`. */
55
53
  labels?: boolean;
56
54
  /**
57
- * The ground under the map, `light` or `dark`. The ink and halo of names, the hovered outline's
58
- * fill and the colours of the picked mark's ring and the selected region follow it. Defaults to
59
- * `dark`.
55
+ * Whether the map's background is `light` or `dark`. The colours of names, outlines, the
56
+ * picked mark's ring and the selected region are chosen to suit it. Defaults to `dark`.
60
57
  */
61
58
  scheme?: 'light' | 'dark';
62
59
  /**
63
- * The picked mark's position in world units, where a ring is drawn. {@link resolvePick} gives it
64
- * as `worldXY`. Defaults to `null`, which draws no ring.
60
+ * Where to draw a ring round the picked mark, in world units. {@link resolvePick} returns it as
61
+ * `worldXY`. Defaults to `null`, no ring.
65
62
  */
66
63
  selectedWorldXY?: [number, number] | null;
67
64
  /**
68
- * The `mosaicaId` of the opened artifact, whose outline is drawn. Under cluster colour, the marks
69
- * coloured by any other artifact, or by none, draw dimmed. Defaults to `null`.
65
+ * The `mosaicaId` of the opened artifact, which is outlined. While marks are coloured by
66
+ * artifact, every mark outside it is dimmed. Defaults to `null`.
70
67
  */
71
68
  openedArtifact?: bigint | null;
72
- /** The `mosaicaId` of the artifact under the pointer, whose outline is drawn. Defaults to `null`. */
69
+ /** The `mosaicaId` of the artifact under the pointer, which is outlined. Defaults to `null`. */
73
70
  hoveredArtifact?: bigint | null;
74
- /** The selected region as a box `[x0, y0, x1, y1]` in world units. Defaults to `null`. */
71
+ /** The selected region as a box, `[x0, y0, x1, y1]` in world units. Defaults to `null`. */
75
72
  region?: [number, number, number, number] | null;
76
73
  /**
77
- * The selected region as a polygon of world points. With two or more points it is drawn in place
78
- * of `region` and of `drag`. Defaults to `null`.
74
+ * The selected region as a polygon of world points. If it has two or more points it is drawn in
75
+ * place of `region` and `drag`. Defaults to `null`.
79
76
  */
80
77
  regionPolygon?: [number, number][] | null;
81
78
  /**
82
- * The box being dragged, `[x0, y0, x1, y1]` in world units, drawn in place of `region` with a
83
- * fainter fill and an opaque line. Defaults to `null`.
79
+ * The box the user is dragging, `[x0, y0, x1, y1]` in world units. It is drawn in place of
80
+ * `region`, with a fainter fill. Defaults to `null`.
84
81
  */
85
82
  drag?: [number, number, number, number] | null;
86
83
  /**
87
- * The lasso being drawn, as world points, drawn in place of `regionPolygon` and `drag` with a
88
- * fainter fill and an opaque line. Defaults to `null`.
84
+ * The lasso the user is drawing, as world points. It is drawn in place of `regionPolygon` and
85
+ * `drag`, with a fainter fill. Defaults to `null`.
89
86
  */
90
87
  dragPolygon?: [number, number][] | null;
91
88
  /**
92
- * Whether the request carried a highlight. When true, the marks that satisfy it keep their
93
- * colour, draw larger and carry a soft glow of their own colour, and the rest draw light grey and
94
- * faint. The layer does not read this from `store`: pass the store's `view.highlighting`.
95
- * Defaults to false.
89
+ * Whether a highlight is set. If it is, the marks it matches keep their colour and are drawn
90
+ * larger with a glow, and the rest are drawn faint grey. The layer does not read this from the
91
+ * store, so pass the store's `view.highlighting`. Defaults to `false`.
96
92
  */
97
93
  highlighting?: boolean;
98
- /** Whether the marks are drawn. Off, only density, outlines, labels and the selection draw. Defaults to true. */
94
+ /** Whether to draw the marks. Density, outlines, names and the selection are drawn either way. Defaults to `true`. */
99
95
  points?: boolean;
100
96
  /**
101
- * A fixed mark radius in pixels. Defaults to `null`, which sizes marks by how many are drawn and
102
- * by the zoom: 1.7 px at a hundred marks or fewer down to 1.1 px at a million, plus 0.05 px per
103
- * zoom level up to zoom 10. Under the legend's `sizeBy`, `sizing` sizes the marks in its place.
97
+ * A fixed mark radius in pixels. Defaults to `null`, which chooses a radius from the number of
98
+ * marks and the zoom: 2 px for ten thousand marks or fewer, down to 1.1 px for a million, plus
99
+ * 0.05 px per zoom level up to zoom 10. While the legend has a `sizeBy`, `sizing` is used instead.
104
100
  */
105
101
  radius?: number | null;
106
102
  /**
107
- * The smallest and largest radius and the scale a number column sizes marks on, under the
108
- * legend's `sizeBy`. A mark with no value, NaN or an infinity draws as a ring, at the smallest
109
- * radius or 3 px, whichever is larger. A radius that is not a finite number above zero is the
110
- * default's. Under `rank` the store keeps the sample ranked against only where it was asked to,
111
- * with `setSizeBy(column, {rank: true})`. Defaults to {@link DEFAULT_SIZING}.
103
+ * How marks are sized while the legend has a `sizeBy`. A radius that is not a positive finite
104
+ * number is replaced by the default's. For the `rank` scale, call the store's
105
+ * `setSizeBy(column, {rank: true})`, or every mark is drawn at the smallest size. Defaults to
106
+ * {@link DEFAULT_SIZING}.
112
107
  */
113
108
  sizing?: Sizing;
114
109
  /**
115
- * A fixed mark alpha from 0 to 1, as a fraction of the colour's own alpha. Defaults to `null`,
116
- * which sets it by how many marks are drawn: 0.78 at a hundred or fewer down to 0.34 at a
117
- * million, plus a little per zoom level.
110
+ * A fixed mark opacity from 0 to 1, multiplied by the colour's own alpha. Defaults to `null`,
111
+ * which chooses it from the number of marks: 0.8 for ten thousand or fewer, down to 0.34 for a
112
+ * million, plus 0.015 per zoom level up to zoom 10, and at most 0.9.
118
113
  */
119
114
  pointOpacity?: number | null;
120
115
  /**
121
- * How density is drawn under the marks, from `densityCounts`: `none`, `smooth` (a soft wash),
122
- * `hex` (hexagons), `grid` (square cells one cell wide) or `contours` (lines of equal density).
123
- * Defaults to `none`, as on `<mosaica-map>`.
116
+ * How density is drawn under the marks: `none`, `smooth` (a soft wash), `hex` (hexagons), `grid`
117
+ * (square cells) or `contours` (lines of equal density). Defaults to `none`.
124
118
  */
125
119
  density?: DensityMode;
126
120
  /**
127
- * The counts by cell density is drawn from, in place of `densityCounter`'s. A new object rebuilds
128
- * the smooth wash or the grid outside the render, and the previous one is drawn until then.
129
- * Defaults to `null`.
121
+ * The counts by cell that density is drawn from. Set it to draw counts you fetched yourself.
122
+ * Defaults to `null`, which draws the counts from `densityCounter` or the layer's own counter.
130
123
  */
131
124
  densityCounts?: DensityCounts | null;
132
125
  /**
133
- * The {@link DensityCounter} whose counts density is drawn from, where the host keeps one, as
134
- * `<mosaica-map>` does. Defaults to `null`: with `store` set and no `densityCounts`, the layer
135
- * keeps a counter of its own over `store`, told of the layer's viewport and of `density` and
136
- * `densityResolution`.
126
+ * A {@link DensityCounter} to draw density from, if you keep one yourself. Defaults to `null`, in
127
+ * which case a layer with a `store` keeps its own counter, which follows the layer's camera,
128
+ * `density` and `densityResolution`.
137
129
  */
138
130
  densityCounter?: DensityCounter | null;
139
- /**
140
- * The cell size on screen, in CSS pixels, the layer's own counter asks for; see
141
- * {@link DensityCounter}. Defaults to 12.
142
- */
131
+ /** The size on screen of a density cell, in CSS pixels, for the layer's own counter. Defaults to 12. */
143
132
  densityResolution?: number;
144
133
  /**
145
134
  * The colours density is drawn in. Defaults to `null`, which draws the smooth wash in warm grey
146
- * while the marks are drawn, and every other case in Viridis.
135
+ * while marks are drawn, and Viridis otherwise.
147
136
  */
148
137
  densityColours?: DensityColours | null;
149
138
  /** How strongly density is drawn, from 0 (not at all) to 1 (fully). Defaults to 1. */
150
139
  densityStrength?: number;
151
140
  /**
152
- * How a cell's count is placed between no items and the largest count drawn, which picks its
153
- * colour, its alpha in the wash and the contour levels: `linear` or `log`. Defaults to `log`.
141
+ * How a cell's count maps to its colour, its opacity in the wash and the contour levels: `linear`
142
+ * or `log`. Defaults to `log`.
154
143
  */
155
144
  densityScale?: DensityScale;
156
- /**
157
- * The palette, ramp and chosen value colours column colour uses. Defaults to
158
- * {@link DEFAULT_COLOURING}.
159
- */
145
+ /** The palette, ramp and per-value colours used when colouring by a column. Defaults to {@link DEFAULT_COLOURING}. */
160
146
  colouring?: Colouring;
161
147
  /**
162
- * Called each time the layer renders, with the marks it drew: `drawn` exact marks held for the
163
- * frame, and `provisional` stand-ins drawn until the exact bands arrive. Called with `(0, 0)`
164
- * when no marks are drawn. Defaults to `null`.
148
+ * Called after each render with the number of marks drawn: `drawn` marks of the current frame,
149
+ * and `provisional` stand-ins from another depth, shown until the frame's own marks arrive.
150
+ * Defaults to `null`.
165
151
  */
166
152
  onDrawn?: ((drawn: number, provisional: number) => void) | null;
167
- /** Called each time the layer renders, with what the render cost and drew. Defaults to `null`. */
153
+ /** Called after each render with what it cost and drew. Defaults to `null`. */
168
154
  onTimings?: ((t: LayerTimings) => void) | null;
169
155
  };
170
156
  /**
@@ -172,34 +158,34 @@ export type MosaicaLayerProps = CompositeLayerProps & {
172
158
  * milliseconds. On a render that draws no marks, `slabMs`, `densityMs` and the mark figures are 0.
173
159
  */
174
160
  export type LayerTimings = {
175
- /** Time spent writing new bands into the mark buffers. */
161
+ /** Time spent writing newly arrived marks into the GPU buffers. */
176
162
  slabMs: number;
177
163
  /**
178
- * Time spent on the density layers. The smooth wash's image is built later, outside the render,
179
- * and the other modes aggregate inside deck.gl's own update; neither is counted.
164
+ * Time spent building the density layers. It excludes the smooth wash's image, which is built
165
+ * after the render, and the aggregation deck.gl does for the other modes.
180
166
  */
181
167
  densityMs: number;
182
- /** Time spent updating the cluster colour lookup texture. */
168
+ /** Time spent updating the texture that colours marks by artifact. */
183
169
  lutMs: number;
184
170
  /** Time spent building the outlines. */
185
171
  outlinesMs: number;
186
- /** Time spent placing labels. */
172
+ /** Time spent placing names. */
187
173
  labelsMs: number;
188
- /** Time for the whole render, every stage included. */
174
+ /** Time for the whole render. */
189
175
  layersMs: number;
190
- /** Writes to the cluster colour lookup texture since the layer made it. */
176
+ /** How many times the texture that colours marks by artifact has been written since the layer was created. */
191
177
  lutWrites: number;
192
178
  /** Outline parts drawn. An artifact in several pieces has several parts. */
193
179
  outlines: number;
194
180
  /** Artifacts outlined: 0, 1 or 2 (the hovered and the opened). */
195
181
  outlinesDrawn: number;
196
- /** Labels placed. */
182
+ /** Names placed. */
197
183
  labels: number;
198
- /** The mark radius drawn, in pixels; under sizing by a column, the largest. */
184
+ /** The mark radius drawn, in pixels. While marks are sized by a column, the largest. */
199
185
  markRadius: number;
200
- /** The alpha the marks are composited at, from 0 to 1, as a fraction of their colour's own alpha. */
186
+ /** The opacity the marks are drawn at, from 0 to 1, multiplied by their colour's own alpha. */
201
187
  markAlpha: number;
202
- /** The number of marks the radius and alpha were chosen for: the exact marks held and the stand-ins. */
188
+ /** The number of marks the radius and opacity were chosen for, stand-ins included. */
203
189
  markCount: number;
204
190
  };
205
191
  /** A layer's colouring, as the store's `colourBy` names it: `cluster:<layer>` or a column. */
@@ -378,29 +364,23 @@ export type MosaicaLayerInternalProps = MosaicaLayerProps & {
378
364
  slab?: MarkSlab | null;
379
365
  };
380
366
  /**
381
- * A deck.gl `CompositeLayer` that draws a Mosaica store's marks and artifacts and density from
382
- * counts by cell. From bottom to top it draws the hovered and the opened artifact's outline, the
383
- * density from `densityCounts`, the marks, the artifacts' names at their centroids (with the hovered one's
384
- * count), the selected region and the picked mark's ring. The props are {@link MosaicaLayerProps}.
385
- *
386
- * The layer draws in the 512-unit world square (`WORLD_SIZE`) for an `OrthographicView` with
387
- * `flipY: true`, and {@link viewInputOf} turns that view's camera into what `store.setView` takes.
388
- * It has no adapter for a geographic `MapView` or a MapLibre host.
389
- *
390
- * With `store` set, the layer subscribes to it and redraws on each change. The layer does not
391
- * fetch. Every served mark is drawn, with no budget, cap or filter applied in the layer, and a
392
- * value the colouring cannot resolve draws grey.
393
- *
394
- * Only an artifact at the level drawn (`clusterLevel`) is outlined. On a layer that declares a
395
- * shape, the outline appears once `store.needShape` has fetched the shape. On a layer that declares
396
- * none, the outline is the artifact's box, drawn as a thin unfilled rectangle.
367
+ * A deck.gl layer that draws a Mosaica map. Give it a `store` and it draws the store's projections
368
+ * and redraws whenever they change. From bottom to top it draws the outlines of the hovered and
369
+ * opened artifacts, density, the points as marks, the artifacts' names, the selected region and a
370
+ * ring round the picked mark. The props are {@link MosaicaLayerProps}.
397
371
  *
398
- * Hover and pick are the host's: pass deck's pick info to {@link resolvePick}, which returns the
399
- * mark or the artifact name under the pointer. Outlines, the wash and the selected region are not
400
- * pickable.
372
+ * The layer fetches nothing itself. The store decides what to fetch from the camera you give it,
373
+ * and the layer draws every mark the store holds. Use it in an `OrthographicView` with
374
+ * `flipY: true`. It draws in a world square 512 units across, and {@link viewInputOf} converts
375
+ * that view's camera for the store's `setView`. It cannot be used in a geographic `MapView` or
376
+ * with MapLibre.
401
377
  *
402
- * The layer makes its mark buffers and colour lookup texture on its deck's device, and releases
403
- * them when deck finalises it.
378
+ * The layer does not handle hover or clicks. Pass the pick info from deck's `onHover` or `onClick`
379
+ * to {@link resolvePick} to find the item or artifact under the pointer, then set the props that
380
+ * show it, such as `selectedWorldXY` and `hoveredArtifact`. If the artifact's layer declares
381
+ * shapes, call the store's `needShape` with its id: the outline appears once the shape arrives.
382
+ * Otherwise the outline is the artifact's bounding box. Only an artifact drawn at `clusterLevel`
383
+ * is outlined.
404
384
  */
405
385
  export declare class MosaicaLayer extends CompositeLayer<MosaicaLayerInternalProps> {
406
386
  /** @internal */
package/dist/layer.js CHANGED
@@ -440,29 +440,23 @@ export function outlineOf(a, fetched) {
440
440
  return null;
441
441
  }
442
442
  /**
443
- * A deck.gl `CompositeLayer` that draws a Mosaica store's marks and artifacts and density from
444
- * counts by cell. From bottom to top it draws the hovered and the opened artifact's outline, the
445
- * density from `densityCounts`, the marks, the artifacts' names at their centroids (with the hovered one's
446
- * count), the selected region and the picked mark's ring. The props are {@link MosaicaLayerProps}.
443
+ * A deck.gl layer that draws a Mosaica map. Give it a `store` and it draws the store's projections
444
+ * and redraws whenever they change. From bottom to top it draws the outlines of the hovered and
445
+ * opened artifacts, density, the points as marks, the artifacts' names, the selected region and a
446
+ * ring round the picked mark. The props are {@link MosaicaLayerProps}.
447
447
  *
448
- * The layer draws in the 512-unit world square (`WORLD_SIZE`) for an `OrthographicView` with
449
- * `flipY: true`, and {@link viewInputOf} turns that view's camera into what `store.setView` takes.
450
- * It has no adapter for a geographic `MapView` or a MapLibre host.
448
+ * The layer fetches nothing itself. The store decides what to fetch from the camera you give it,
449
+ * and the layer draws every mark the store holds. Use it in an `OrthographicView` with
450
+ * `flipY: true`. It draws in a world square 512 units across, and {@link viewInputOf} converts
451
+ * that view's camera for the store's `setView`. It cannot be used in a geographic `MapView` or
452
+ * with MapLibre.
451
453
  *
452
- * With `store` set, the layer subscribes to it and redraws on each change. The layer does not
453
- * fetch. Every served mark is drawn, with no budget, cap or filter applied in the layer, and a
454
- * value the colouring cannot resolve draws grey.
455
- *
456
- * Only an artifact at the level drawn (`clusterLevel`) is outlined. On a layer that declares a
457
- * shape, the outline appears once `store.needShape` has fetched the shape. On a layer that declares
458
- * none, the outline is the artifact's box, drawn as a thin unfilled rectangle.
459
- *
460
- * Hover and pick are the host's: pass deck's pick info to {@link resolvePick}, which returns the
461
- * mark or the artifact name under the pointer. Outlines, the wash and the selected region are not
462
- * pickable.
463
- *
464
- * The layer makes its mark buffers and colour lookup texture on its deck's device, and releases
465
- * them when deck finalises it.
454
+ * The layer does not handle hover or clicks. Pass the pick info from deck's `onHover` or `onClick`
455
+ * to {@link resolvePick} to find the item or artifact under the pointer, then set the props that
456
+ * show it, such as `selectedWorldXY` and `hoveredArtifact`. If the artifact's layer declares
457
+ * shapes, call the store's `needShape` with its id: the outline appears once the shape arrives.
458
+ * Otherwise the outline is the artifact's bounding box. Only an artifact drawn at `clusterLevel`
459
+ * is outlined.
466
460
  */
467
461
  export class MosaicaLayer extends CompositeLayer {
468
462
  /** @internal */
package/dist/pick.d.ts CHANGED
@@ -2,13 +2,13 @@ import { type ArtifactsProjection, type Band } from '@mosaicajs/client';
2
2
  /**
3
3
  * What {@link resolvePick} found under the pointer, by `kind`:
4
4
  *
5
- * - `mark`: an item's mark. `id` is the item's `mosaicaId`. `worldXY` is the mark's position in
6
- * world units, or the pointer's where the sublayer holds no positions, or `null` with neither.
7
- * - `artifact`: an artifact's name label. `id` is the artifact's `mosaicaId`.
8
- * - `miss`: nothing under the pointer.
9
- * - `broken`: a hit on a sublayer with no id array, or at an `index` past its end. This is a defect
10
- * in the layer, reported apart from a miss so the host can show it. `layer` is the sublayer's
11
- * id, `hasIds` whether it has an id array and `idCount` that array's length.
5
+ * - `mark`: an item. `id` is its `mosaicaId`, and `worldXY` the mark's position in world units, or
6
+ * the pointer's if the mark's position is not known, or `null` if neither is known.
7
+ * - `artifact`: an artifact's name. `id` is the artifact's `mosaicaId`.
8
+ * - `miss`: nothing.
9
+ * - `broken`: a hit the layer cannot resolve to an id, which is a bug in the layer. It is kept
10
+ * apart from a miss so that you can report it. `layer` is the sublayer's id, `hasIds` whether it
11
+ * has ids and `idCount` how many.
12
12
  */
13
13
  export type Picked = {
14
14
  kind: 'mark';
@@ -26,7 +26,7 @@ export type Picked = {
26
26
  hasIds: boolean;
27
27
  idCount: number;
28
28
  };
29
- /** The fields of deck.gl's `PickingInfo` that {@link resolvePick} reads. A `PickingInfo` can be passed as it is. */
29
+ /** The fields of deck.gl's `PickingInfo` that {@link resolvePick} reads. Pass deck's `PickingInfo` as it is. */
30
30
  export type PickInfo = {
31
31
  /** The index of the hit within the sublayer's data, or -1 for no hit. */
32
32
  index: number;
@@ -40,13 +40,24 @@ export type PickInfo = {
40
40
  id: string;
41
41
  props: object;
42
42
  } | null;
43
- /** The pointer's position in world units, used as a mark's `worldXY` when the sublayer holds no positions. */
43
+ /** The pointer's position in world units, used as a mark's `worldXY` if the mark's own position is not known. */
44
44
  coordinate?: number[] | null;
45
45
  };
46
46
  /**
47
- * Resolves a deck.gl pick on a {@link MosaicaLayer} to the item's mark or the artifact's name under
48
- * the pointer. Pass the pick info deck gives `onClick` or `onHover`. Only marks and artifact names
49
- * are pickable, so a pointer over an outline, a count or the wash away from any mark is a `miss`.
47
+ * Finds the item or artifact under the pointer from a deck.gl pick on a {@link MosaicaLayer}. Pass
48
+ * it the pick info that deck gives `onHover` or `onClick`. Only marks and artifact names can be
49
+ * picked, so anything else, such as an outline or the density wash, is a `miss`.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * new Deck({
54
+ * // ...
55
+ * onClick: (info) => {
56
+ * const picked = resolvePick(info);
57
+ * if (picked.kind === 'mark') store.pick(picked.id);
58
+ * }
59
+ * });
60
+ * ```
50
61
  */
51
62
  export declare function resolvePick(info: PickInfo): Picked;
52
63
  /**
package/dist/pick.js CHANGED
@@ -1,8 +1,19 @@
1
1
  import { NO_ORDINAL } from '@mosaicajs/client';
2
2
  /**
3
- * Resolves a deck.gl pick on a {@link MosaicaLayer} to the item's mark or the artifact's name under
4
- * the pointer. Pass the pick info deck gives `onClick` or `onHover`. Only marks and artifact names
5
- * are pickable, so a pointer over an outline, a count or the wash away from any mark is a `miss`.
3
+ * Finds the item or artifact under the pointer from a deck.gl pick on a {@link MosaicaLayer}. Pass
4
+ * it the pick info that deck gives `onHover` or `onClick`. Only marks and artifact names can be
5
+ * picked, so anything else, such as an outline or the density wash, is a `miss`.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * new Deck({
10
+ * // ...
11
+ * onClick: (info) => {
12
+ * const picked = resolvePick(info);
13
+ * if (picked.kind === 'mark') store.pick(picked.id);
14
+ * }
15
+ * });
16
+ * ```
6
17
  */
7
18
  export function resolvePick(info) {
8
19
  if (info.index < 0)
package/dist/size.d.ts CHANGED
@@ -8,30 +8,33 @@
8
8
  */
9
9
  import type { LegendProjection, Meta, ScalarColumn } from '@mosaicajs/client';
10
10
  /**
11
- * How a number is placed between the smallest and largest size: `linear` in the value; `log`, which
12
- * places `log(1 + (v − min))`, so a long tail of counts does not leave most points at the smallest
13
- * size; or `rank`, the value's rank among a sample of the values drawn, which spreads skewed values
14
- * evenly. A rank is an estimate from the points drawn, which are themselves a sample.
11
+ * How a number is placed between the smallest and largest size: `linear`, in proportion to the
12
+ * value; `log`, in proportion to `log(1 + (v − min))`, so a long tail does not leave most marks at
13
+ * the smallest size; or `rank`, by the value's rank in a sample of the values drawn, which spreads
14
+ * skewed values evenly. The rank is an estimate, because the marks drawn are themselves a sample.
15
15
  *
16
16
  * @category Size
17
17
  */
18
18
  export type SizeScale = 'linear' | 'log' | 'rank';
19
19
  /**
20
- * The size choices for a number column: the radius in pixels of the smallest and the largest value,
20
+ * How to size marks by a number column: the radius in pixels of the smallest and largest values,
21
21
  * and the scale between them.
22
22
  *
23
23
  * @category Size
24
24
  */
25
25
  export type Sizing = {
26
- /** The radius in pixels of the smallest value, and of a point with no value. */
26
+ /**
27
+ * The radius in pixels of the smallest value. A mark with no value, or a value that is not
28
+ * finite, is drawn as a ring, at this radius or 3 px, whichever is larger.
29
+ */
27
30
  min: number;
28
31
  /** The radius in pixels of the largest value. */
29
32
  max: number;
30
- /** How a value is placed between the two. */
33
+ /** How a value is placed between `min` and `max`. */
31
34
  scale: SizeScale;
32
35
  };
33
36
  /**
34
- * The sizing with nothing chosen: from 2 to 9 pixels, on a linear scale.
37
+ * The default sizing: 2 to 9 pixels on a linear scale.
35
38
  *
36
39
  * @category Size
37
40
  */
package/dist/size.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { numericValues, sizesPoints } from '@mosaicajs/client/internal';
2
2
  import { fractionOf } from './colour.js';
3
3
  /**
4
- * The sizing with nothing chosen: from 2 to 9 pixels, on a linear scale.
4
+ * The default sizing: 2 to 9 pixels on a linear scale.
5
5
  *
6
6
  * @category Size
7
7
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mosaicajs/deck",
3
- "version": "0.1.0-rc.4",
3
+ "version": "0.1.0",
4
4
  "description": "A deck.gl layer that draws a Mosaica store, for a host with its own Deck.",
5
5
  "keywords": [
6
6
  "mosaica",
@@ -19,7 +19,7 @@
19
19
  "directory": "clients/ts/deck"
20
20
  },
21
21
  "license": "Apache-2.0",
22
- "author": "Joe Ennis",
22
+ "author": "mosaicadb",
23
23
  "type": "module",
24
24
  "main": "./dist/index.js",
25
25
  "types": "./dist/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "typecheck": "tsc -p tsconfig.json --noEmit"
46
46
  },
47
47
  "dependencies": {
48
- "@mosaicajs/client": "0.1.0-rc.4"
48
+ "@mosaicajs/client": "0.1.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@deck.gl/aggregation-layers": "^9.3.7",
@@ -59,7 +59,7 @@
59
59
  "@deck.gl/layers": "^9.3.7",
60
60
  "@luma.gl/core": "^9.3.6",
61
61
  "typescript": "^5.9.0",
62
- "vitest": "^3.2.0"
62
+ "vitest": "^4.1.12"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"