@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
@@ -9,19 +9,25 @@ import { MosaicaElement, type PickOutcome } from './base.js';
9
9
  *
10
10
  * The headline is the `title-field` field, or the item's `mosaica_id` when that field is unset or
11
11
  * empty. To render a field your own way, as a link for example, put an element in its
12
- * `field-<name>` slot.
12
+ * `field-<name>` slot. The card is headed "Item" for a screen reader, with the headline a heading
13
+ * under it.
14
+ *
15
+ * A value over 60 characters is kept to six lines, with a Show more button under it where that
16
+ * cuts it short. A `compact` card also keeps its headline to three lines and its subtitle to two,
17
+ * and its Show all button shows every field and all of each.
13
18
  *
14
19
  * A field named in `image-fields` whose value is an `http:` or `https:` address, or a path
15
20
  * resolved against the page, is drawn as the image at that address, across the card's width. The viewer's browser loads it from the host
16
- * that serves it, without a referrer. A value that is not such an address, and an image that does
17
- * not load, are shown as text.
21
+ * that serves it, without a referrer. Its alternative text is the item's `title-field` value, or
22
+ * the field's name where the item has none. A value that is not such an address, and an image that
23
+ * does not load, are shown as text.
18
24
  *
19
25
  * The Open button appears only when you set `open-url` or `open`. `open-url` is a link template
20
26
  * such as `https://www.geonames.org/{geonameid}`, in which each `{name}` is replaced by the item's
21
27
  * value for that field. Because the values are URL-encoded, a template cannot open an address that
22
28
  * a field already holds, so set `open` to a function for that. An item gets no Open button when it
23
- * has no value for a field the template names. A function in `open` is called with the item's
24
- * `mosaica_id` and fields, and it takes precedence over `open-url`.
29
+ * has no value for a field the template names. The link opens in a new tab. A function in `open`
30
+ * is called with the item's `mosaica_id` and fields, and it takes precedence over `open-url`.
25
31
  *
26
32
  * @summary A card showing an item's fields, with an optional Open button.
27
33
  * @tagname mosaica-item-card
@@ -36,23 +42,26 @@ import { MosaicaElement, type PickOutcome } from './base.js';
36
42
  * @csspart title - The header row: the headline or the state, and the close button.
37
43
  * @csspart close - The close button.
38
44
  * @csspart state - The state line, with `data-state`: `shown`, `empty` (no item, or a click that
39
- * found nothing), `refused` or `detached`.
45
+ * found nothing), `refused` or `detached`. It is inside a `role="status"` region.
40
46
  * @csspart refusal - The words "Item unavailable", with `data-code` set to the refusal's code if
41
47
  * the server refused the record. For a broken pick, the details are in the map's `lastPick`.
42
48
  * @csspart reason - The server's reason for refusing the record, under "Item unavailable".
43
- * @csspart headline - The headline, with `data-name` set to the field it shows.
49
+ * @csspart headline - The headline, an `<h3>`, with `data-name` set to the field it shows.
44
50
  * @csspart subtitle - The `subtitle-field` value under the headline, when `compact` is set.
45
51
  * @csspart show-all - The "Show all N fields" button, when `compact` is set, with `aria-expanded`.
46
- * @csspart view-chip - One view the item is in, with `data-view` and `aria-current` on the current
47
- * view.
52
+ * It reads "Show all" where every field is shown and only text is cut short.
53
+ * @csspart view-chip - One view the item is in, with `data-view`, and `aria-current` and a bar
54
+ * under the current view.
48
55
  * @csspart field - One field, with `data-name`, and `data-prose` on a value over 60 characters.
49
- * @csspart label - A field's name, and the heading above the view chips.
50
- * @csspart value - A field's value.
56
+ * @csspart label - A field's name, a `<dt>`, and the heading above the view chips.
57
+ * @csspart value - A field's value, a `<dd>`.
58
+ * @csspart more - The Show more button under a long value that is cut short, with `aria-expanded`.
51
59
  * @csspart image - A field's value drawn as an image, under `image-fields`.
52
60
  * @csspart scoped - The group-scoped values, grouped by key.
53
61
  * @csspart key - One key's heading among the group-scoped values, with `data-key`.
54
62
  * @csspart open - The Open button.
55
- * @csspart copy - The Copy id button, which copies the `mosaica_id` to the clipboard.
63
+ * @csspart copy - The Copy id button, which copies the `mosaica_id` to the clipboard and says to a
64
+ * screen reader whether it did.
56
65
  */
57
66
  export declare class MosaicaItemCard extends MosaicaElement {
58
67
  static styles: import("lit").CSSResult[];
@@ -96,6 +105,13 @@ export declare class MosaicaItemCard extends MosaicaElement {
96
105
  /** Whether "Show all" was pressed, for the item it was pressed on. @internal */
97
106
  accessor expanded: boolean;
98
107
  private expandedFor;
108
+ /** The long values shown whole on the full card, by field, for the item shown. @internal */
109
+ accessor opened: ReadonlySet<string>;
110
+ /** The fields whose headline, subtitle or value is cut short where it is drawn. @internal */
111
+ accessor clipped: ReadonlySet<string>;
112
+ /** What the last press of Copy id came to, for the item shown. @internal */
113
+ accessor copied: string;
114
+ private resized;
99
115
  /** The image addresses that failed to load, shown as text. @internal */
100
116
  accessor broken: ReadonlySet<string>;
101
117
  /** `image-fields` as a list, kept in step by `willUpdate`. */
@@ -109,13 +125,24 @@ export declare class MosaicaItemCard extends MosaicaElement {
109
125
  * set before the render, so the render changes nothing it reads.
110
126
  */
111
127
  protected willUpdate(changed: PropertyValues<this>): void;
128
+ connectedCallback(): void;
129
+ disconnectedCallback(): void;
130
+ protected updated(changed: PropertyValues<this>): void;
131
+ /**
132
+ * Note which clamped texts are cut short at the card's width, so each is offered whole. A text
133
+ * shown whole keeps what was noted while it was clamped, so the button that shows it stays.
134
+ */
135
+ private measure;
136
+ /** Copy the id to the clipboard and say in the status region how that went. */
137
+ private copy;
112
138
  private get shown();
113
139
  render(): TemplateResult | typeof nothing;
114
- /** The card under `compact`: headline and subtitle, three fields, and Show all beside Open. */
115
- private compactBody;
140
+ /** An item's headline, for the header row, and what the card shows under it: the full card's, or under `compact` the shorter one's. */
141
+ private card;
116
142
  /**
117
143
  * Open, where the host says what it does: a button that calls `open`, else a link to `open-url`
118
- * filled from the item, else nothing. Each fires `mosaica-open`.
144
+ * filled from the item, which opens in a new tab and says so to a screen reader, else nothing.
145
+ * Each fires `mosaica-open`. `mark` is drawn before the word.
119
146
  */
120
147
  private openButton;
121
148
  /** The fields of `fields` that `card-fields` names, in its order. */
@@ -141,7 +168,11 @@ export declare class MosaicaItemCard extends MosaicaElement {
141
168
  * key through a `members` group share a heading.
142
169
  */
143
170
  private scoped;
144
- /** One field, presented by its declared type; prose and images span the grid. */
171
+ /**
172
+ * One field, presented by its declared type; prose and images span the grid. An image's
173
+ * alternative text is the item's `headline` where it has one, since its caption is the label
174
+ * above it. On the full card, prose a clamp cuts short has a button that shows it whole.
175
+ */
145
176
  private field;
146
177
  }
147
178
  declare global {