@glimstone/svelte 4.5.7 → 4.5.8

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.
@@ -1,12 +1,20 @@
1
1
  <script lang="ts" module>
2
2
  export interface BrandMarkProps {
3
3
  svg: string;
4
+ /** The drawing a lit tile shows instead. */
5
+ hover?: string;
4
6
  }
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
8
10
  // A vendor mark kept as its own markup, from appMarks.ts.
9
- let { svg }: BrandMarkProps = $props();
11
+ let { svg, hover }: BrandMarkProps = $props();
10
12
  </script>
11
13
 
12
- <span data-glim="BrandMark" class="glim-brand-svg" aria-hidden="true">{@html svg}</span>
14
+ {#if hover}
15
+ <span data-glim="BrandMark" class="glim-brand-svg" aria-hidden="true"
16
+ ><span class="glim-mark-rest">{@html svg}</span><span class="glim-mark-hover">{@html hover}</span></span
17
+ >
18
+ {:else}
19
+ <span data-glim="BrandMark" class="glim-brand-svg" aria-hidden="true">{@html svg}</span>
20
+ {/if}
@@ -1,5 +1,7 @@
1
1
  export interface BrandMarkProps {
2
2
  svg: string;
3
+ /** The drawing a lit tile shows instead. */
4
+ hover?: string;
3
5
  }
4
6
  declare const BrandMark: import("svelte").Component<BrandMarkProps, {}, "">;
5
7
  type BrandMark = ReturnType<typeof BrandMark>;
@@ -3,7 +3,7 @@
3
3
  import type { PickGroup, PickItem, PickerText } from "@glimstone/core";
4
4
  import type { WindowAction } from "./WindowFootRow.svelte";
5
5
 
6
- export type { PickGroup, PickerText, TileMark } from "@glimstone/core";
6
+ export type { PickBadge, PickGroup, PickerText, TileMark } from "@glimstone/core";
7
7
 
8
8
  export type PickerItem = PickItem<Snippet>;
9
9
 
@@ -26,6 +26,8 @@
26
26
  onBack?: () => void;
27
27
  /** A quiet line at the start of the foot, such as the verdict of a test. */
28
28
  start?: string | Snippet;
29
+ /** The id of the tile picked before, which stands marked and takes the focus when the tiles show. */
30
+ selected?: string;
29
31
  /** Called for every way out: the foot, Escape and, while the tiles show, a press beside the window. */
30
32
  onClose: () => void;
31
33
  }
@@ -39,12 +41,14 @@
39
41
  isTileMark,
40
42
  pageLocale,
41
43
  pickerHue,
44
+ pickFocusTarget,
45
+ pickMarkClass,
42
46
  pickSearchKey,
43
47
  pickSections,
44
48
  pickTileKey,
45
49
  pickTileStyle,
46
- windowFocusTarget,
47
50
  } from "@glimstone/core";
51
+ import Badge from "./Badge.svelte";
48
52
  import BrandMark from "./BrandMark.svelte";
49
53
  import GlyphField from "./GlyphField.svelte";
50
54
  import { IconBack, IconClose, IconSearch } from "./glyphs.js";
@@ -61,7 +65,7 @@
61
65
  // follows: it closes the window, or passes the picked tile's form as
62
66
  // children, which takes the tiles' place with Back and the form's actions in
63
67
  // the foot.
64
- let { title, hint, items, groups = [], text, onPick, children, actions = [], onBack, start, onClose }: PickerWindowProps = $props();
68
+ let { title, hint, items, groups = [], text, onPick, children, actions = [], onBack, start, selected, onClose }: PickerWindowProps = $props();
65
69
 
66
70
  let query = $state("");
67
71
  const hue = pickerHue();
@@ -73,7 +77,7 @@
73
77
  void form;
74
78
  void tick().then(() => {
75
79
  if (scroll) holdPickHeight(scroll);
76
- if (card) windowFocusTarget(card)?.focus();
80
+ if (card) pickFocusTarget(card, scroll ?? null)?.focus();
77
81
  });
78
82
  });
79
83
  // Back keeps the window open, so it returns false.
@@ -147,16 +151,24 @@
147
151
  {:else}
148
152
  {#each sections as s (s.id)}
149
153
  <section class="glim-pick-section">
150
- {#if s.title}<h3 class="glim-eyebrow">{s.title}</h3>{/if}
154
+ {#if s.title}
155
+ <div class="glim-pick-eyebrow">
156
+ <h3 class="glim-eyebrow">{s.title}</h3>
157
+ {#if s.badge}<Badge size="small" tone={s.badge.tone}>{s.badge.label}</Badge>{/if}
158
+ {#if s.hint}<InfoBubble tip={s.hint} />{/if}
159
+ </div>
160
+ {/if}
151
161
  <ul class="glim-provider-pick">
152
162
  {#each s.items as item (item.id)}
153
- {#snippet brand()}{#if isTileMark(item.mark)}<BrandMark svg={item.mark.svg} />{/if}{/snippet}
163
+ {#snippet brand()}{#if isTileMark(item.mark)}<BrandMark svg={item.mark.svg} hover={item.mark.hover} />{/if}{/snippet}
154
164
  <li style={css(pickTileStyle(item.mark))}>
155
165
  <ReadmeButton
156
166
  brand="house"
157
- parts={[{ name: item.label, sub: item.sub, onClick: () => onPick(item.id) }]}
167
+ parts={[{ name: item.label, sub: item.sub, onClick: item.status ? undefined : () => onPick(item.id) }]}
168
+ soonLabel={item.status}
169
+ current={item.id === selected}
158
170
  mark={isTileMark(item.mark) ? brand : (item.mark as Snippet | undefined)}
159
- markClass={isTileMark(item.mark) ? undefined : "glim-house-mark"}
171
+ markClass={pickMarkClass(item.mark)}
160
172
  hint={item.hint}
161
173
  tip={item.tip}
162
174
  />
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from "svelte";
2
2
  import type { PickGroup, PickItem, PickerText } from "@glimstone/core";
3
3
  import type { WindowAction } from "./WindowFootRow.svelte";
4
- export type { PickGroup, PickerText, TileMark } from "@glimstone/core";
4
+ export type { PickBadge, PickGroup, PickerText, TileMark } from "@glimstone/core";
5
5
  export type PickerItem = PickItem<Snippet>;
6
6
  export interface PickerWindowProps {
7
7
  /** The notch's words, also the window's accessible name. */
@@ -22,6 +22,8 @@ export interface PickerWindowProps {
22
22
  onBack?: () => void;
23
23
  /** A quiet line at the start of the foot, such as the verdict of a test. */
24
24
  start?: string | Snippet;
25
+ /** The id of the tile picked before, which stands marked and takes the focus when the tiles show. */
26
+ selected?: string;
25
27
  /** Called for every way out: the foot, Escape and, while the tiles show, a press beside the window. */
26
28
  onClose: () => void;
27
29
  }
@@ -23,6 +23,8 @@
23
23
  note?: boolean;
24
24
  /** The second line of a unit whose first part has neither `href` nor `onClick`. */
25
25
  soonLabel?: string;
26
+ /** Marks the first part as the one chosen, such as a picker's tile picked before. */
27
+ current?: boolean;
26
28
  /** Runs on a click on a part's link, for an app whose webview has no browser
27
29
  * behind it to open the address in. */
28
30
  onLinkClick?: (e: MouseEvent) => void;
@@ -42,7 +44,7 @@
42
44
  // brand's colour ("Brand tiles"). A link where a part leads to a file or a
43
45
  // listing, a button where it does something on the page, and a quiet unit with
44
46
  // "Soon" as its second line where the listing does not exist yet.
45
- let { brand, parts, mark, markClass, art, hint, tip, note, soonLabel, onLinkClick }: ReadmeButtonProps = $props();
47
+ let { brand, parts, mark, markClass, art, hint, tip, note, soonLabel, current, onLinkClick }: ReadmeButtonProps = $props();
46
48
 
47
49
  let root: HTMLDivElement;
48
50
  const soon = $derived(readmeSoon(parts));
@@ -60,6 +62,7 @@
60
62
  i === 0
61
63
  ? {
62
64
  "aria-describedby": tooltip.describedBy,
65
+ "aria-current": current || undefined,
63
66
  onmouseenter: tooltip.show,
64
67
  onmouseleave: tooltip.hide,
65
68
  onfocus: tooltip.showOnFocus,
@@ -20,6 +20,8 @@ export interface ReadmeButtonProps {
20
20
  note?: boolean;
21
21
  /** The second line of a unit whose first part has neither `href` nor `onClick`. */
22
22
  soonLabel?: string;
23
+ /** Marks the first part as the one chosen, such as a picker's tile picked before. */
24
+ current?: boolean;
23
25
  /** Runs on a click on a part's link, for an app whose webview has no browser
24
26
  * behind it to open the address in. */
25
27
  onLinkClick?: (e: MouseEvent) => void;
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ export { default as NumberField, type NumberFieldProps } from "./NumberField.sve
42
42
  export { default as PasswordField, type PasswordFieldProps } from "./PasswordField.svelte";
43
43
  export { default as PathField, type PathFieldProps } from "./PathField.svelte";
44
44
  export { default as PaypalDialog, type PaypalDialogProps, type PaypalSelectorProps } from "./PaypalDialog.svelte";
45
- export { default as PickerWindow, type PickGroup, type PickerItem, type PickerText, type PickerWindowProps, type TileMark } from "./PickerWindow.svelte";
45
+ export { default as PickerWindow, type PickBadge, type PickGroup, type PickerItem, type PickerText, type PickerWindowProps, type TileMark } from "./PickerWindow.svelte";
46
46
  export { default as Pill, type PillProps, type PillTone } from "./Pill.svelte";
47
47
  export { default as Popover, type PopoverProps } from "./Popover.svelte";
48
48
  export { default as PresenceBadges, type PresenceBadgesProps } from "./PresenceBadges.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glimstone/svelte",
3
- "version": "4.5.7",
3
+ "version": "4.5.8",
4
4
  "description": "GlimStone's components for Svelte",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -141,7 +141,7 @@
141
141
  "build": "svelte-package -i src -o dist"
142
142
  },
143
143
  "dependencies": {
144
- "@glimstone/core": "4.5.7"
144
+ "@glimstone/core": "4.5.8"
145
145
  },
146
146
  "peerDependencies": {
147
147
  "@internationalized/date": "^3.12.4",