@mosaicajs/components 0.3.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 +116 -37
  17. package/dist/explorer.js +476 -210
  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 +47 -16
  27. package/dist/item-card.js +241 -108
  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 +1837 -833
  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/tokens.js CHANGED
@@ -20,16 +20,18 @@ import { css } from 'lit';
20
20
  * @cssprop --mosaica-ink - The colour of body text, values and map tools.
21
21
  * @cssprop --mosaica-ink-2 - The colour of labels, section headings and secondary text.
22
22
  * @cssprop --mosaica-ink-3 - The colour of faint text: placeholders, hints and disabled controls,
23
- * and of the dot in the loading states.
23
+ * and of the ring in the loading states.
24
24
  * @cssprop --mosaica-line - The colour of borders around panels, cards, buttons, chips and
25
25
  * the map toolbar.
26
26
  * @cssprop --mosaica-line-2 - The colour of the rules between sections and between the status
27
27
  * strip's cells.
28
- * @cssprop --mosaica-line-control - The colour of borders around inputs and of a slider's unfilled
29
- * track, at 3:1 against the surface.
28
+ * @cssprop --mosaica-line-control - The colour of borders around inputs, of a slider's unfilled
29
+ * track and of a switch's track when it is off, at 3:1 against the surface.
30
30
  * @cssprop --mosaica-accent - The colour of the active map tool, primary buttons, badges, checked
31
- * boxes and focus rings.
31
+ * boxes, a switch that is on, and the bar on a pressed segment and a chosen row.
32
32
  * @cssprop --mosaica-accent-ink - The text colour on an accent background.
33
+ * @cssprop --mosaica-focus - The colour of the focus ring, at 3:1 or more against each surface and
34
+ * the map's background.
33
35
  * @cssprop --mosaica-highlight - The colour of a highlight chip, a highlighted row's text and its ×.
34
36
  * @cssprop --mosaica-highlight-soft - The background of a highlight chip and a highlighted row.
35
37
  * @cssprop --mosaica-bar - The colour of a field card's bars for the items in view.
@@ -51,6 +53,8 @@ import { css } from 'lit';
51
53
  * @cssprop --mosaica-space - The gap between the content in the map's corners and the map's edges.
52
54
  * Half of it separates items in one corner.
53
55
  * @cssprop --mosaica-density - A multiplier on `--mosaica-space`'s default.
56
+ * @cssprop --mosaica-long-text - What a title or a name too long for its line does: `nowrap`, the
57
+ * default, cuts it with an ellipsis; `normal` wraps it.
54
58
  * @cssprop --mosaica-map-height - The map's height.
55
59
  */
56
60
  export const tokens = css `
@@ -61,12 +65,13 @@ export const tokens = css `
61
65
  --_mosaica-surface-3: var(--mosaica-surface-3, light-dark(#efefeb, #2a2e35));
62
66
  --_mosaica-ink: var(--mosaica-ink, light-dark(#1b1d21, #eceef1));
63
67
  --_mosaica-ink-2: var(--mosaica-ink-2, light-dark(#565c64, #a7adb6));
64
- --_mosaica-ink-3: var(--mosaica-ink-3, light-dark(#6a6f76, #8b919a));
68
+ --_mosaica-ink-3: var(--mosaica-ink-3, light-dark(#676c73, #91979f));
65
69
  --_mosaica-line: var(--mosaica-line, light-dark(#e5e5e1, #2b2f36));
66
70
  --_mosaica-line-2: var(--mosaica-line-2, light-dark(#efefeb, #24272d));
67
71
  --_mosaica-line-control: var(--mosaica-line-control, light-dark(#8a8f96, #6b7079));
68
72
  --_mosaica-accent: var(--mosaica-accent, light-dark(#1b1d21, #eceef1));
69
73
  --_mosaica-accent-ink: var(--mosaica-accent-ink, light-dark(#ffffff, #111317));
74
+ --_mosaica-focus: var(--mosaica-focus, light-dark(#62666d, #999ea6));
70
75
  --_mosaica-highlight: var(--mosaica-highlight, light-dark(#5b3fc4, #c3a6ee));
71
76
  --_mosaica-highlight-soft: var(--mosaica-highlight-soft, light-dark(#f1edfb, #2c2340));
72
77
  /* Each bar stands 3:1 against the surface and a hovered row, and a solid bar 3:1 against the
@@ -74,7 +79,7 @@ export const tokens = css `
74
79
  --_mosaica-bar: var(--mosaica-bar, light-dark(#3a3e45, #d5d9df));
75
80
  --_mosaica-bar-highlight: var(--mosaica-bar-highlight, light-dark(#42269a, #d7c4f7));
76
81
  --_mosaica-bar-match: var(--mosaica-bar-match, light-dark(#868b92, #6b7079));
77
- --_mosaica-warn: var(--mosaica-warn, light-dark(#c98a0a, #e0a940));
82
+ --_mosaica-warn: var(--mosaica-warn, light-dark(#b57c09, #e0a940));
78
83
  --_mosaica-refuse: var(--mosaica-refuse, light-dark(#b42318, #f0857a));
79
84
  --_mosaica-ok: var(--mosaica-ok, light-dark(#1f7a4d, #5cc98a));
80
85
  --_mosaica-map-bg: var(--mosaica-map-bg, light-dark(#f6f6f4, #111317));
@@ -86,6 +91,7 @@ export const tokens = css `
86
91
  --_mosaica-shadow: var(--mosaica-shadow, 0 2px 10px light-dark(rgba(0, 0, 0, 0.06), transparent), 0 4px 16px light-dark(transparent, rgba(0, 0, 0, 0.35)));
87
92
  /* A layout such as the explorer's compact form sets the private base the default scales. */
88
93
  --_mosaica-space: var(--mosaica-space, calc(var(--_mosaica-space-base, 16px) * var(--mosaica-density, 1)));
94
+ --_mosaica-long-text: var(--mosaica-long-text, nowrap);
89
95
  --_mosaica-map-height: var(--mosaica-map-height, 420px);
90
96
  font-family: var(--_mosaica-font);
91
97
  font-size: 13px;
@@ -120,12 +126,23 @@ export const chrome = css `
120
126
  cursor: pointer;
121
127
  padding: 0;
122
128
  }
123
- /* The focus ring: the accent at half strength, close to the control, so it marks the control
124
- without outshining the data. */
129
+ /* The focus ring, close to the control. */
125
130
  :focus-visible {
126
- outline: 2px solid color-mix(in srgb, var(--_mosaica-accent) 50%, transparent);
131
+ outline: 2px solid var(--_mosaica-focus);
127
132
  outline-offset: 1px;
128
133
  }
134
+ /* Read out, not drawn. A control that takes focus is drawn while it has it. */
135
+ .sr-only:not(:focus, :focus-within) {
136
+ position: absolute;
137
+ width: 1px;
138
+ height: 1px;
139
+ margin: -1px;
140
+ padding: 0;
141
+ border: 0;
142
+ overflow: hidden;
143
+ clip-path: inset(50%);
144
+ white-space: nowrap;
145
+ }
129
146
  input[type='checkbox'],
130
147
  input[type='radio'] {
131
148
  accent-color: var(--_mosaica-accent);
@@ -145,6 +162,10 @@ export const chrome = css `
145
162
  [data-unnamed] {
146
163
  color: var(--_mosaica-ink-3);
147
164
  }
165
+ [data-key-name] {
166
+ color: var(--_mosaica-ink-2);
167
+ font-family: var(--_mosaica-font-mono);
168
+ }
148
169
  .sm {
149
170
  font-size: 12px;
150
171
  }
@@ -171,6 +192,7 @@ export const chrome = css `
171
192
  border-bottom: 1px solid var(--_mosaica-panel-rule, var(--_mosaica-line-2));
172
193
  }
173
194
  h2,
195
+ h3,
174
196
  [part='title'],
175
197
  .hd {
176
198
  margin: 0 0 10px;
@@ -186,6 +208,7 @@ export const chrome = css `
186
208
  color: var(--_mosaica-ink-2);
187
209
  }
188
210
  h2 .summary,
211
+ h3 .summary,
189
212
  [part='title'] .summary,
190
213
  .hd .summary {
191
214
  text-transform: none;
@@ -276,7 +299,7 @@ export const chrome = css `
276
299
  outline: none;
277
300
  }
278
301
  .input:focus-within {
279
- outline: 2px solid color-mix(in srgb, var(--_mosaica-accent) 50%, transparent);
302
+ outline: 2px solid var(--_mosaica-focus);
280
303
  outline-offset: 1px;
281
304
  }
282
305
  /* A select drawn as text with a chevron, such as the view and colour choices. */
@@ -300,6 +323,8 @@ export const chrome = css `
300
323
  color: inherit;
301
324
  font: inherit;
302
325
  cursor: pointer;
326
+ white-space: var(--_mosaica-long-text);
327
+ overflow-wrap: anywhere;
303
328
  text-overflow: ellipsis;
304
329
  }
305
330
  .choice svg {
@@ -325,20 +350,30 @@ export const chrome = css `
325
350
  }
326
351
  .seg button[aria-pressed='true'] {
327
352
  background: var(--_mosaica-surface-2);
353
+ box-shadow: inset 0 -2px 0 var(--_mosaica-accent);
328
354
  color: var(--_mosaica-ink);
329
355
  font-weight: 600;
330
356
  }
331
- /* An on-off switch: a button with role="switch" and a knob inside it. */
357
+ /* An on-off switch: a button with role="switch" and a knob inside it. The button's box is the
358
+ track, and the pointer's target is 24 px high around it. */
332
359
  .switch {
360
+ position: relative;
333
361
  width: 34px;
334
362
  height: 20px;
335
363
  padding: 2px;
336
364
  border-radius: 10px;
337
- background: color-mix(in srgb, var(--_mosaica-ink-3) 35%, var(--_mosaica-surface));
365
+ background: var(--_mosaica-line-control);
338
366
  display: flex;
339
367
  justify-content: flex-start;
340
368
  flex: none;
341
369
  }
370
+ .switch::before {
371
+ content: '';
372
+ position: absolute;
373
+ inset: 50% 0 auto;
374
+ height: 24px;
375
+ translate: 0 -50%;
376
+ }
342
377
  .switch[aria-checked='true'] {
343
378
  background: var(--_mosaica-accent);
344
379
  justify-content: flex-end;
@@ -386,7 +421,7 @@ export const chrome = css `
386
421
  border-color: var(--_mosaica-accent);
387
422
  }
388
423
  .btn.small {
389
- height: 22px;
424
+ height: 24px;
390
425
  padding: 0 8px;
391
426
  border-radius: 5px;
392
427
  }
@@ -466,6 +501,15 @@ export const chrome = css `
466
501
  .chip[data-verb='highlight'] button {
467
502
  color: inherit;
468
503
  }
504
+ /* A chip's last button is its ×: a 24 px target around the glyph, which the chip does not grow
505
+ for. */
506
+ .chip > button:last-child {
507
+ min-width: 24px;
508
+ min-height: 24px;
509
+ margin: -4px;
510
+ align-items: center;
511
+ justify-content: center;
512
+ }
469
513
  /* A list of rows with a count at the right. A row keeps its height and the list scrolls. */
470
514
  .list {
471
515
  display: flex;
@@ -489,6 +533,7 @@ export const chrome = css `
489
533
  .list > .item[aria-selected='true'],
490
534
  .list > .item.on {
491
535
  background: var(--_mosaica-surface-2);
536
+ box-shadow: inset 2px 0 0 var(--_mosaica-accent);
492
537
  font-weight: 500;
493
538
  }
494
539
  .list > .item .n {
@@ -561,8 +606,10 @@ export const chrome = css `
561
606
  background: var(--_mosaica-ok);
562
607
  flex: none;
563
608
  }
609
+ /* Updating or counting: a ring, so it differs from the up to date dot by more than its colour. */
564
610
  .dot.quiet {
565
- background: var(--_mosaica-ink-3);
611
+ background: none;
612
+ border: 1.5px solid var(--_mosaica-ink-3);
566
613
  }
567
614
  .dot.warn {
568
615
  background: var(--_mosaica-warn);
@@ -570,4 +617,87 @@ export const chrome = css `
570
617
  .dot.refuse {
571
618
  background: var(--_mosaica-refuse);
572
619
  }
620
+ /* A query running: on the status strip, and in the control that asked for it. */
621
+ .spinner {
622
+ flex: none;
623
+ width: 10px;
624
+ height: 10px;
625
+ border: 1.5px solid var(--_mosaica-line);
626
+ border-top-color: var(--_mosaica-ink-2);
627
+ border-radius: 50%;
628
+ animation: mosaica-spin 0.8s linear infinite;
629
+ }
630
+ @keyframes mosaica-spin {
631
+ to {
632
+ transform: rotate(360deg);
633
+ }
634
+ }
635
+ /* Forced colours keep no author background or shadow, so what is drawn with one takes a system
636
+ colour here. */
637
+ @media (forced-colors: active) {
638
+ :focus-visible,
639
+ .input:focus-within {
640
+ outline-color: Highlight;
641
+ }
642
+ /* A pressed, checked, chosen or current control takes the highlight pair, whatever its own
643
+ rules give it. It leaves forced colours to do so, since text there is drawn on a plate of
644
+ the page's colour; the controls inside it stay in. A colour choice is its colour, and keeps
645
+ it. */
646
+ :is([aria-pressed='true'], [aria-checked='true'], [aria-selected='true'], [aria-current]:not([aria-current='false']), .list > .item.on):not([part~='choice']) {
647
+ forced-color-adjust: none !important;
648
+ background: Highlight !important;
649
+ border-color: Highlight !important;
650
+ box-shadow: none !important;
651
+ color: HighlightText !important;
652
+ }
653
+ :is([aria-pressed='true'], [aria-checked='true'], [aria-selected='true'], [aria-current]:not([aria-current='false']), .list > .item.on):not([part~='choice'])
654
+ :not(button, input, select, a) {
655
+ color: inherit !important;
656
+ }
657
+ :is([aria-pressed='true'], [aria-checked='true'], [aria-selected='true'], [aria-current]:not([aria-current='false']), .list > .item.on):not([part~='choice'])
658
+ :is(button, input, select, a) {
659
+ forced-color-adjust: auto;
660
+ }
661
+ /* A ring in the highlight colour would not show on that control's highlight background, so
662
+ its ring is drawn in the text colour of the pair: where it has the focus, and where the
663
+ arrow keys reached it while a box keeps the focus. That colour may be the page's own, so
664
+ the ring is set in from the control's edge, with the highlight on both sides of it. A
665
+ ring round a control inside it lies on the same background, and takes the same colour. */
666
+ :is([aria-pressed='true'], [aria-checked='true'], [aria-selected='true'], [aria-current]:not([aria-current='false']), .list > .item.on):not([part~='choice']):is(:focus-visible, [data-active]) {
667
+ outline-color: HighlightText !important;
668
+ outline-offset: -4px !important;
669
+ }
670
+ :is([aria-pressed='true'], [aria-checked='true'], [aria-selected='true'], [aria-current]:not([aria-current='false']), .list > .item.on):not([part~='choice'])
671
+ :focus-visible {
672
+ outline-color: HighlightText !important;
673
+ }
674
+ /* Off, a switch is an outlined track with a solid knob. On, the track is solid. */
675
+ .switch {
676
+ padding: 1px;
677
+ border: 1px solid ButtonText;
678
+ }
679
+ .switch[aria-checked='true'] {
680
+ border-color: Highlight;
681
+ }
682
+ .switch .knob {
683
+ background: ButtonText;
684
+ }
685
+ .switch[aria-checked='true'] .knob {
686
+ background: HighlightText;
687
+ }
688
+ .dot:not(.quiet) {
689
+ background: CanvasText;
690
+ }
691
+ .dot.quiet {
692
+ border-color: CanvasText;
693
+ }
694
+ .skel,
695
+ .skeleton {
696
+ background: GrayText;
697
+ }
698
+ .spinner {
699
+ border-color: GrayText;
700
+ border-top-color: CanvasText;
701
+ }
702
+ }
573
703
  `;
@@ -36,6 +36,11 @@ export class MosaicaViewPicker extends MosaicaElement {
36
36
  font-weight: 600;
37
37
  line-height: 1.3;
38
38
  }
39
+ /* The select's box is 24 px high for the pointer, in the room its one line takes. */
40
+ [part='select'] {
41
+ min-height: 24px;
42
+ margin-block: calc((1lh - 24px) / 2);
43
+ }
39
44
  `
40
45
  ];
41
46
  /** The key this element last left each group on, which `enterGroup` prefers. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mosaicajs/components",
3
- "version": "0.3.0",
3
+ "version": "0.4.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",
@@ -112,8 +112,8 @@
112
112
  },
113
113
  "dependencies": {
114
114
  "@lit/context": "^1.1.0",
115
- "@mosaicajs/client": "0.3.0",
116
- "@mosaicajs/deck": "0.3.0"
115
+ "@mosaicajs/client": "0.4.0",
116
+ "@mosaicajs/deck": "0.4.0"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "@deck.gl/aggregation-layers": "^9.3.7",
@@ -127,6 +127,7 @@
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
+ "axe-core": "^4.14.0",
130
131
  "happy-dom": "^21.0.4",
131
132
  "lit": "^3.3.0",
132
133
  "playwright": "^1.62.1",