@mosaicajs/components 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.
Files changed (52) hide show
  1. package/dist/artifact-card.d.ts +20 -26
  2. package/dist/artifact-card.js +20 -26
  3. package/dist/base.d.ts +21 -29
  4. package/dist/base.js +18 -26
  5. package/dist/basemap.d.ts +2 -2
  6. package/dist/cluster-filter.d.ts +19 -25
  7. package/dist/cluster-filter.js +19 -25
  8. package/dist/colour-editor.d.ts +16 -36
  9. package/dist/colour-editor.js +16 -36
  10. package/dist/context.d.ts +4 -4
  11. package/dist/context.js +4 -4
  12. package/dist/count.d.ts +16 -15
  13. package/dist/count.js +16 -15
  14. package/dist/events.d.ts +63 -68
  15. package/dist/explorer.d.ts +76 -119
  16. package/dist/explorer.js +76 -121
  17. package/dist/field-card.d.ts +24 -56
  18. package/dist/field-card.js +24 -56
  19. package/dist/filter-panel.d.ts +31 -45
  20. package/dist/filter-panel.js +31 -45
  21. package/dist/filter.d.ts +20 -28
  22. package/dist/filter.js +20 -28
  23. package/dist/hierarchy.d.ts +35 -36
  24. package/dist/hierarchy.js +35 -36
  25. package/dist/index.d.ts +5 -4
  26. package/dist/index.js +5 -4
  27. package/dist/item-card.d.ts +34 -55
  28. package/dist/item-card.js +34 -55
  29. package/dist/key-picker.d.ts +5 -5
  30. package/dist/key-picker.js +5 -5
  31. package/dist/layer-picker.d.ts +11 -9
  32. package/dist/layer-picker.js +11 -9
  33. package/dist/map.d.ts +134 -172
  34. package/dist/map.js +136 -188
  35. package/dist/mosaica-components.js +5599 -1594
  36. package/dist/mosaica-components.js.LICENSE.txt +80 -16
  37. package/dist/mosaica-components.js.sri +1 -1
  38. package/dist/mosaica-components.json +2 -2
  39. package/dist/parts.d.ts +3 -4
  40. package/dist/parts.js +3 -4
  41. package/dist/selection.d.ts +21 -27
  42. package/dist/selection.js +21 -27
  43. package/dist/states.d.ts +15 -20
  44. package/dist/status.d.ts +26 -38
  45. package/dist/status.js +26 -38
  46. package/dist/store-element.d.ts +8 -7
  47. package/dist/store-element.js +8 -7
  48. package/dist/tokens.d.ts +12 -13
  49. package/dist/tokens.js +12 -13
  50. package/dist/view-picker.d.ts +10 -6
  51. package/dist/view-picker.js +10 -6
  52. package/package.json +6 -6
package/dist/status.js CHANGED
@@ -41,53 +41,41 @@ import { NOTHING_VISIBLE, renderState, seesNothing, showsContent, stateOf } from
41
41
  import { chrome, tokens } from './tokens.js';
42
42
  import './count.js';
43
43
  /**
44
- * The view's state and counts on one line: `● | 16,822,190 of 21,406,522 match | 5,390 shown`.
45
- * The counts are the store's counts in view (`ViewProjection.inView`): over the camera's box, or
46
- * over the selected region while one is selected, as the selection card counts it. While a
47
- * highlight is set, a cell reads `N highlighted of M`, M being the matched count, and the
48
- * match cell is left out unless a filter or selection narrows what matches. While the view is up to
49
- * date the first cell is a dot alone, titled "Up to date", and while it updates a grey dot alone,
50
- * titled "Updating", so the strip keeps its width through a pan. Where the viewer can see no item in
51
- * the view at all, it is a grey dot alone titled "Nothing visible to you", which the map says in
52
- * words. Otherwise it names the state in two or three words beside its dot (Connecting,
53
- * Reconnecting, Server unreachable, Server did not answer, Server busy, Nothing in view, Data
54
- * updated, View refused, Session expired) with the action the state offers: Refresh when the data
55
- * changed, Retry when the view was refused, the server did not answer or is too busy, and Sign in
56
- * on expiry where `reauthorise` is set. View refused has the server's reason on a line under it.
57
- * The counts grey out while they are not current. The strip sizes to its content and does not
58
- * wrap. `compact` shortens the figures (`16.8M of 21.4M match`) and drops the shown count.
59
- * `expanded` renders the figures again as a card below the strip.
44
+ * Use the status line with a map so that viewers know whether what they see is current and how much
45
+ * of the data it covers. A typical line reads `● | 16,822,190 of 21,406,522 match | 5,390 shown`,
46
+ * where the first figure is the items the filters match out of those the viewer may see. The
47
+ * figures count the camera's box, or the selected region while there is one. While a highlight is
48
+ * set, the counts cell reads `N highlighted of M`.
60
49
  *
61
- * The state cell is an `aria-live` region, so a refusal, an expiry or a change of data is announced;
62
- * the counts are not, so a pan does not read them out. The
63
- * state is one of the ten panel states (see `PanelState`); the refusal behind it stays in the
64
- * store's `status.refusal`, which `mosaica-statechange` carries, and the refusal's code is on the
65
- * refusal part's `data-code`.
50
+ * While the view is up to date, the first cell is a dot alone. When something goes wrong, the cell
51
+ * names the state and offers a button if the viewer can act, such as Retry when the server is busy.
52
+ * Sign in appears when the session expires only if you have set `reauthorise`.
66
53
  *
67
- * @summary The state and the counts of the view, on one line.
54
+ * Screen readers announce a refusal or an expiry, because the state cell is an `aria-live` region.
55
+ * The counts sit outside it, so they are not read out every time the map pans.
56
+ *
57
+ * @summary A status line showing whether the map is up to date and how many items it shows.
68
58
  * @tagname mosaica-status
69
59
  * @category Elements
70
- * @fires {CustomEvent<MosaicaEventDetails['mosaica-statechange']>} mosaica-statechange - On every
71
- * change of panel state, including the first render, with the refusal behind it.
72
- * @fires {CustomEvent<MosaicaEventDetails['mosaica-expired']>} mosaica-expired - Once each time the
73
- * session expires.
60
+ * @fires {CustomEvent<MosaicaEventDetails['mosaica-statechange']>} mosaica-statechange - The panel
61
+ * state changed, including on the first render.
62
+ * @fires {CustomEvent<MosaicaEventDetails['mosaica-expired']>} mosaica-expired - The session expired.
63
+ * Fires once each time.
74
64
  * @csspart strip - The one-line strip.
75
65
  * @csspart state - The state's dot and words, with `data-state` set to the panel state.
76
66
  * @csspart refusal - The words "View refused", or "Server busy", with `data-code` set to the
77
67
  * refusal's code.
78
- * @csspart reason - The server's reason for a refusal, as it sent it, on a line under "View
79
- * refused".
80
- * @csspart refresh - The Refresh button, when the data changed under the view.
81
- * @csspart retry - The Retry button, when the view was refused or the server did not answer or is
82
- * too busy.
83
- * @csspart reauthorise - The Sign in button, on expiry where `reauthorise` is set.
68
+ * @csspart reason - The server's reason for a refusal, under "View refused".
69
+ * @csspart refresh - The Refresh button, shown when the data has changed.
70
+ * @csspart retry - The Retry button, after a refusal, no answer or a busy server.
71
+ * @csspart reauthorise - The Sign in button, shown on expiry if `reauthorise` is set.
84
72
  * @csspart count-shown - The `<mosaica-count>` of marks shown.
85
- * @csspart count-matched - The `<mosaica-count>` matched by the filters.
86
- * @csspart count-highlighted - The `<mosaica-count>` the highlight matched, while a highlight is set.
73
+ * @csspart count-matched - The `<mosaica-count>` of items the filters match.
74
+ * @csspart count-highlighted - The `<mosaica-count>` of highlighted items, while a highlight is set.
87
75
  * @csspart count-of - The matched count the highlighted count is out of, while a highlight is set.
88
76
  * @csspart count-visible - The `<mosaica-count>` of items the viewer may see here, which the matched
89
77
  * count is out of.
90
- * @csspart card - The card of figures, under `expanded`.
78
+ * @csspart card - The card of figures, when `expanded` is set.
91
79
  */
92
80
  let MosaicaStatus = (() => {
93
81
  let _classSuper = MosaicaElement;
@@ -213,15 +201,15 @@ let MosaicaStatus = (() => {
213
201
  `
214
202
  ];
215
203
  #expanded_accessor_storage = __runInitializers(this, _expanded_initializers, false);
216
- /** Renders the figures again as a card below the strip. */
204
+ /** Adds a card of the figures below the strip. */
217
205
  get expanded() { return this.#expanded_accessor_storage; }
218
206
  set expanded(value) { this.#expanded_accessor_storage = value; }
219
207
  #compact_accessor_storage = (__runInitializers(this, _expanded_extraInitializers), __runInitializers(this, _compact_initializers, false));
220
- /** Shortens the figures to one decimal (`16.8M`) and drops the shown count, where room is short. */
208
+ /** Shortens the figures to one decimal (`16.8M`) and drops the shown count. */
221
209
  get compact() { return this.#compact_accessor_storage; }
222
210
  set compact(value) { this.#compact_accessor_storage = value; }
223
211
  #reauthorise_accessor_storage = (__runInitializers(this, _compact_extraInitializers), __runInitializers(this, _reauthorise_initializers, null));
224
- /** Called by the Sign in button that the expired state shows; without it, no button. */
212
+ /** A function the Sign in button calls when the session has expired. Without it there is no Sign in button. */
225
213
  get reauthorise() { return this.#reauthorise_accessor_storage; }
226
214
  set reauthorise(value) { this.#reauthorise_accessor_storage = value; }
227
215
  lastState = (__runInitializers(this, _reauthorise_extraInitializers), null);
@@ -2,17 +2,18 @@ import { nothing, type TemplateResult } from 'lit';
2
2
  import type { Store } from '@mosaicajs/client';
3
3
  import { MosaicaElement } from './base.js';
4
4
  /**
5
- * Provides one store, and so one view, to the panels and maps inside it, which find it by context.
6
- * An overview beside a detail is two of these. `<mosaica-explorer>` is its own provider and needs
7
- * none.
5
+ * Use `<mosaica-store>` when you lay out the elements yourself, so that the map, the filter panel
6
+ * and the cards all show the same view and filters. The elements inside it find its store through
7
+ * context, which means you do not pass the store to each one. Put each map of a different view in
8
+ * its own wrapper. `<mosaica-explorer>` provides its own store, so it needs no wrapper.
8
9
  *
9
- * Takes a `store` property, or builds a store from `token` or an `authorise` property and
10
- * `viewer-url`, the page's own origin where unset, or from `viewer-url` alone for an open server. It renders its children and nothing else (`display: contents`).
10
+ * The wrapper uses the store in its `store` property. When that is not set, it builds one from
11
+ * `viewer-url` and `token` or `authorise`.
11
12
  *
12
- * @summary Provides one store to the elements inside it.
13
+ * @summary A wrapper that shares one store between the elements inside it.
13
14
  * @tagname mosaica-store
14
15
  * @category Elements
15
- * @slot - The panels and maps that read the store.
16
+ * @slot - The elements that use the store.
16
17
  */
17
18
  export declare class MosaicaStore extends MosaicaElement {
18
19
  static styles: import("lit").CSSResult;
@@ -4,17 +4,18 @@ import { MosaicaElement } from './base.js';
4
4
  import { storeContext } from './context.js';
5
5
  import { attachContextRoot, defineOnce } from './define.js';
6
6
  /**
7
- * Provides one store, and so one view, to the panels and maps inside it, which find it by context.
8
- * An overview beside a detail is two of these. `<mosaica-explorer>` is its own provider and needs
9
- * none.
7
+ * Use `<mosaica-store>` when you lay out the elements yourself, so that the map, the filter panel
8
+ * and the cards all show the same view and filters. The elements inside it find its store through
9
+ * context, which means you do not pass the store to each one. Put each map of a different view in
10
+ * its own wrapper. `<mosaica-explorer>` provides its own store, so it needs no wrapper.
10
11
  *
11
- * Takes a `store` property, or builds a store from `token` or an `authorise` property and
12
- * `viewer-url`, the page's own origin where unset, or from `viewer-url` alone for an open server. It renders its children and nothing else (`display: contents`).
12
+ * The wrapper uses the store in its `store` property. When that is not set, it builds one from
13
+ * `viewer-url` and `token` or `authorise`.
13
14
  *
14
- * @summary Provides one store to the elements inside it.
15
+ * @summary A wrapper that shares one store between the elements inside it.
15
16
  * @tagname mosaica-store
16
17
  * @category Elements
17
- * @slot - The panels and maps that read the store.
18
+ * @slot - The elements that use the store.
18
19
  */
19
20
  export class MosaicaStore extends MosaicaElement {
20
21
  static styles = css `
package/dist/tokens.d.ts CHANGED
@@ -1,17 +1,16 @@
1
1
  /**
2
- * The theme every element shares, as a Lit `CSSResult` a host element can add to its own `styles`.
3
- * Every colour and font, the corner radii and the shadow are `--mosaica-*` custom properties, as
4
- * are the map's height and the spacing of the map's corners; other spacing is fixed. The elements
5
- * do not declare those names: each reads a private twin that falls back to the default, so a value
6
- * set on the element or on any ancestor, including an enclosing `<mosaica-explorer>`, wins, and the
7
- * default applies where nothing is set. Each colour's default is a light and a dark value, chosen
8
- * by the `color-scheme` the element inherits from the page.
2
+ * The theme every element shares, as a Lit `CSSResult`. Add it to your own Lit element's `styles`
3
+ * to use the same tokens. The elements take every colour and font, the corner radii, the shadow,
4
+ * the map's height and the spacing of the map's corners from the `--mosaica-*` custom properties
5
+ * that the components reference lists under Theme tokens; other spacing is fixed. Set a token on an element or any ancestor, including an
6
+ * enclosing `<mosaica-explorer>`, to override its default. Each colour has a light and a dark
7
+ * default, chosen by the page's `color-scheme`.
9
8
  *
10
- * The interface is neutral so that colour on screen belongs to the data. The map's data palette is
11
- * not a token: it encodes data, and it is the map's `palette` property.
9
+ * The colours the map uses for data are not tokens. Set them with the map's `palette`,
10
+ * `category-palette` and `ramp`.
12
11
  *
13
- * The default font is Instrument Sans where the page has loaded it; the elements fetch no font
14
- * themselves, so a page that wants it links it.
12
+ * The default font is Instrument Sans if the page has loaded it. The elements fetch no fonts, so
13
+ * link it from your page if you want it.
15
14
  *
16
15
  * @cssprop --mosaica-surface - The background of panels, cards, inputs and buttons.
17
16
  * @cssprop --mosaica-surface-2 - The background of a chip, a hovered row and a chosen row.
@@ -48,8 +47,8 @@
48
47
  * @cssprop --mosaica-font-mono - The font family of identifiers.
49
48
  * @cssprop --mosaica-shadow - The shadow under anything that floats over the map: the status
50
49
  * strip, the map toolbar, the map tooltip, cards and popovers.
51
- * @cssprop --mosaica-space - The gap between the map's corner content and the map's edges; half of
52
- * it separates items in one corner.
50
+ * @cssprop --mosaica-space - The gap between the content in the map's corners and the map's edges.
51
+ * Half of it separates items in one corner.
53
52
  * @cssprop --mosaica-density - A multiplier on `--mosaica-space`'s default.
54
53
  * @cssprop --mosaica-map-height - The map's height.
55
54
  */
package/dist/tokens.js CHANGED
@@ -1,18 +1,17 @@
1
1
  import { css } from 'lit';
2
2
  /**
3
- * The theme every element shares, as a Lit `CSSResult` a host element can add to its own `styles`.
4
- * Every colour and font, the corner radii and the shadow are `--mosaica-*` custom properties, as
5
- * are the map's height and the spacing of the map's corners; other spacing is fixed. The elements
6
- * do not declare those names: each reads a private twin that falls back to the default, so a value
7
- * set on the element or on any ancestor, including an enclosing `<mosaica-explorer>`, wins, and the
8
- * default applies where nothing is set. Each colour's default is a light and a dark value, chosen
9
- * by the `color-scheme` the element inherits from the page.
3
+ * The theme every element shares, as a Lit `CSSResult`. Add it to your own Lit element's `styles`
4
+ * to use the same tokens. The elements take every colour and font, the corner radii, the shadow,
5
+ * the map's height and the spacing of the map's corners from the `--mosaica-*` custom properties
6
+ * that the components reference lists under Theme tokens; other spacing is fixed. Set a token on an element or any ancestor, including an
7
+ * enclosing `<mosaica-explorer>`, to override its default. Each colour has a light and a dark
8
+ * default, chosen by the page's `color-scheme`.
10
9
  *
11
- * The interface is neutral so that colour on screen belongs to the data. The map's data palette is
12
- * not a token: it encodes data, and it is the map's `palette` property.
10
+ * The colours the map uses for data are not tokens. Set them with the map's `palette`,
11
+ * `category-palette` and `ramp`.
13
12
  *
14
- * The default font is Instrument Sans where the page has loaded it; the elements fetch no font
15
- * themselves, so a page that wants it links it.
13
+ * The default font is Instrument Sans if the page has loaded it. The elements fetch no fonts, so
14
+ * link it from your page if you want it.
16
15
  *
17
16
  * @cssprop --mosaica-surface - The background of panels, cards, inputs and buttons.
18
17
  * @cssprop --mosaica-surface-2 - The background of a chip, a hovered row and a chosen row.
@@ -49,8 +48,8 @@ import { css } from 'lit';
49
48
  * @cssprop --mosaica-font-mono - The font family of identifiers.
50
49
  * @cssprop --mosaica-shadow - The shadow under anything that floats over the map: the status
51
50
  * strip, the map toolbar, the map tooltip, cards and popovers.
52
- * @cssprop --mosaica-space - The gap between the map's corner content and the map's edges; half of
53
- * it separates items in one corner.
51
+ * @cssprop --mosaica-space - The gap between the content in the map's corners and the map's edges.
52
+ * Half of it separates items in one corner.
54
53
  * @cssprop --mosaica-density - A multiplier on `--mosaica-space`'s default.
55
54
  * @cssprop --mosaica-map-height - The map's height.
56
55
  */
@@ -1,17 +1,21 @@
1
1
  import { nothing, type PropertyValues, type TemplateResult } from 'lit';
2
2
  import { MosaicaElement } from './base.js';
3
3
  /**
4
- * A select over the views the viewer may reach, one entry per plain view and one per view group,
5
- * in `/v1/meta`'s order, drawn as the current view's title with a chevron. Choosing a group enters
6
- * it under the current view's key where the two groups share keys, else at the key this element
7
- * last left it on, else at its first view. Renders nothing where the bundle offers one entry.
4
+ * Use the view picker when the bundle lays its items out in more than one way and viewers should
5
+ * choose the layout. Each view that belongs to no group is one entry, and so is each group of
6
+ * views. When there is only one entry, the picker shows nothing.
8
7
  *
9
- * @summary Chooses the view.
8
+ * Choosing a group opens the view the viewer last left that group on, or the group's first view.
9
+ * When the current view's group shares keys with the chosen group, the picker opens the view under
10
+ * the current key instead, so that the viewer stays on the same year or quarter. Viewers step
11
+ * between the views inside a group with `<mosaica-key-picker>`.
12
+ *
13
+ * @summary A drop-down menu for switching views.
10
14
  * @tagname mosaica-view-picker
11
15
  * @category Elements
12
16
  * @fires {CustomEvent<MosaicaEventDetails['mosaica-viewswitch']>} mosaica-viewswitch - The view
13
17
  * changed.
14
- * @csspart field - The select and its chevron, drawn as the view's title in bold.
18
+ * @csspart field - The select and its chevron, shown as the view's title in bold.
15
19
  * @csspart select - The select.
16
20
  */
17
21
  export declare class MosaicaViewPicker extends MosaicaElement {
@@ -6,17 +6,21 @@ import { icon } from './icons.js';
6
6
  import { switchView } from './view-switch.js';
7
7
  import { chrome, tokens } from './tokens.js';
8
8
  /**
9
- * A select over the views the viewer may reach, one entry per plain view and one per view group,
10
- * in `/v1/meta`'s order, drawn as the current view's title with a chevron. Choosing a group enters
11
- * it under the current view's key where the two groups share keys, else at the key this element
12
- * last left it on, else at its first view. Renders nothing where the bundle offers one entry.
9
+ * Use the view picker when the bundle lays its items out in more than one way and viewers should
10
+ * choose the layout. Each view that belongs to no group is one entry, and so is each group of
11
+ * views. When there is only one entry, the picker shows nothing.
13
12
  *
14
- * @summary Chooses the view.
13
+ * Choosing a group opens the view the viewer last left that group on, or the group's first view.
14
+ * When the current view's group shares keys with the chosen group, the picker opens the view under
15
+ * the current key instead, so that the viewer stays on the same year or quarter. Viewers step
16
+ * between the views inside a group with `<mosaica-key-picker>`.
17
+ *
18
+ * @summary A drop-down menu for switching views.
15
19
  * @tagname mosaica-view-picker
16
20
  * @category Elements
17
21
  * @fires {CustomEvent<MosaicaEventDetails['mosaica-viewswitch']>} mosaica-viewswitch - The view
18
22
  * changed.
19
- * @csspart field - The select and its chevron, drawn as the view's title in bold.
23
+ * @csspart field - The select and its chevron, shown as the view's title in bold.
20
24
  * @csspart select - The select.
21
25
  */
22
26
  export class MosaicaViewPicker extends MosaicaElement {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mosaicajs/components",
3
- "version": "0.1.0-rc.4",
3
+ "version": "0.1.0",
4
4
  "description": "The mosaica-* web components: a map, filters, counts, item cards and an explorer over a Mosaica server, plus a single-file bundle.",
5
5
  "keywords": [
6
6
  "mosaica",
@@ -19,7 +19,7 @@
19
19
  "directory": "clients/ts/components"
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",
@@ -112,8 +112,8 @@
112
112
  },
113
113
  "dependencies": {
114
114
  "@lit/context": "^1.1.0",
115
- "@mosaicajs/client": "0.1.0-rc.4",
116
- "@mosaicajs/deck": "0.1.0-rc.4"
115
+ "@mosaicajs/client": "0.1.0",
116
+ "@mosaicajs/deck": "0.1.0"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "@deck.gl/aggregation-layers": "^9.3.7",
@@ -127,12 +127,12 @@
127
127
  "@deck.gl/core": "^9.3.7",
128
128
  "@deck.gl/layers": "^9.3.7",
129
129
  "@luma.gl/core": "^9.3.6",
130
- "happy-dom": "^20.0.0",
130
+ "happy-dom": "^21.0.4",
131
131
  "lit": "^3.3.0",
132
132
  "playwright": "^1.62.1",
133
133
  "typescript": "^5.9.0",
134
134
  "vite": "^8.2.0",
135
- "vitest": "^3.2.0",
135
+ "vitest": "^4.1.12",
136
136
  "esbuild": "^0.28.0"
137
137
  },
138
138
  "publishConfig": {