@glimstone/svelte 4.9.0 → 4.9.2

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.
@@ -18,6 +18,8 @@
18
18
  badges?: Snippet;
19
19
  /** More quiet lines under the status, such as what uses the connection. */
20
20
  children?: Snippet;
21
+ /** A switch of the row, such as whether a service shows on the sign-in page, at the end of the name's line above the buttons. */
22
+ control?: Snippet;
21
23
  /** Where the test stands: `busy` while it runs, then `tone` and a `title` with what it found. */
22
24
  test?: ConnectionTest;
23
25
  /** Buttons of the app's own, such as Mount, before Test, Edit and Remove, so those keep their places at the end. */
@@ -43,7 +45,7 @@
43
45
  // badges, one quiet line on how it stands, and at the end the app's own
44
46
  // actions, then its test, edit and remove. A built-in button stands only where
45
47
  // its handler is passed. The other props of a <div> go to the row.
46
- let { name, mark, status, badges, children, test, actions, text, labelKeys, onTest, onEdit, onRemove, class: className, ...rest }: ConnectionRowProps = $props();
48
+ let { name, mark, status, badges, children, control, test, actions, text, labelKeys, onTest, onEdit, onRemove, class: className, ...rest }: ConnectionRowProps = $props();
47
49
 
48
50
  // On a phone the buttons show their glyphs alone, so they keep to one line.
49
51
  const NARROW = 640;
@@ -67,6 +69,7 @@
67
69
  <div class="glim-connection-head">
68
70
  <span class="glim-connection-name">{name}</span>
69
71
  {#if badges}<span class="glim-connection-badges">{@render badges()}</span>{/if}
72
+ {@render control?.()}
70
73
  </div>
71
74
  <div class="glim-connection-foot">
72
75
  <div class="glim-connection-about">
@@ -14,6 +14,8 @@ export interface ConnectionRowProps extends Omit<HTMLAttributes<HTMLDivElement>,
14
14
  badges?: Snippet;
15
15
  /** More quiet lines under the status, such as what uses the connection. */
16
16
  children?: Snippet;
17
+ /** A switch of the row, such as whether a service shows on the sign-in page, at the end of the name's line above the buttons. */
18
+ control?: Snippet;
17
19
  /** Where the test stands: `busy` while it runs, then `tone` and a `title` with what it found. */
18
20
  test?: ConnectionTest;
19
21
  /** Buttons of the app's own, such as Mount, before Test, Edit and Remove, so those keep their places at the end. */
@@ -39,6 +39,7 @@
39
39
  type ListSort,
40
40
  } from "@glimstone/core";
41
41
  import Checkbox from "./Checkbox.svelte";
42
+ import InfoBubble from "./InfoBubble.svelte";
42
43
  import MarkSvg from "./MarkSvg.svelte";
43
44
  import Popover from "./Popover.svelte";
44
45
 
@@ -128,6 +129,7 @@
128
129
  }}
129
130
  />
130
131
  {/if}
132
+ <span class="glim-list-info"><InfoBubble tip={text.hint} /></span>
131
133
  <table bind:this={grid} role="grid" aria-label={label} aria-multiselectable="true" aria-describedby={hintId} class="glim-list-table">
132
134
  <thead>
133
135
  <tr>
@@ -170,7 +172,7 @@
170
172
  </tbody>
171
173
  </table>
172
174
  {#if view.length === 0}<p class="glim-list-empty">{text.noMatch}</p>{/if}
173
- <p id={hintId} class="glim-list-hint">{text.hint}</p>
175
+ <p id={hintId} class="glim-sr-only">{text.hint}</p>
174
176
  {#if open && filterOpen}
175
177
  <Popover open anchor={filterOpen.at} label={text.filterOf(open.label)} onClose={() => (filterOpen = null)}>
176
178
  <div class="glim-list-filter-values">
@@ -0,0 +1,155 @@
1
+ <script lang="ts" module>
2
+ import type { MultiSelectText } from "@glimstone/core";
3
+ import type { SelectOption } from "./selectParts.svelte.js";
4
+
5
+ export type { MultiSelectText } from "@glimstone/core";
6
+
7
+ export interface MultiSelectProps {
8
+ label?: string;
9
+ hideLabel?: boolean;
10
+ options: SelectOption[];
11
+ /** The picked values, bound with `bind:value`, in the order they were picked. */
12
+ value: string[];
13
+ onChange?: (value: string[]) => void;
14
+ /** Shown while nothing is picked. */
15
+ placeholder?: string;
16
+ /** How many choices the list shows before the field takes a search, seven unless given. */
17
+ searchAfter?: number;
18
+ disabled?: boolean;
19
+ text?: Partial<MultiSelectText>;
20
+ }
21
+ </script>
22
+
23
+ <script lang="ts">
24
+ import * as combobox from "@zag-js/combobox";
25
+ import { normalizeProps, useMachine } from "@zag-js/svelte";
26
+ import {
27
+ MULTI_SELECT_SEARCH_AFTER,
28
+ MULTI_SELECT_TEXT,
29
+ multiSelectMatches,
30
+ multiSelectSearches,
31
+ multiSelectWithout,
32
+ pageDir,
33
+ } from "@glimstone/core";
34
+ import { useFieldName } from "./fieldName.js";
35
+ import { IconCheck, IconClose, IconExpand } from "./glyphs.js";
36
+ import { lift } from "./lift.js";
37
+
38
+ // A field that picks several choices from a list and keeps them as tags,
39
+ // each with its own remove mark. It is Zag's combobox in multiple mode, so
40
+ // focus stays in the field while the arrows move through the list, and a
41
+ // pick keeps the list open for the next. A short list takes no typing and
42
+ // answers Space the way a Select does; a long one filters as somebody types.
43
+ let {
44
+ label,
45
+ hideLabel,
46
+ options,
47
+ value = $bindable(),
48
+ onChange,
49
+ placeholder,
50
+ searchAfter,
51
+ disabled = false,
52
+ text,
53
+ }: MultiSelectProps = $props();
54
+
55
+ const name = useFieldName(() => label);
56
+ const words = $derived({ ...MULTI_SELECT_TEXT, ...text });
57
+ const searches = $derived(multiSelectSearches(options.length, searchAfter ?? MULTI_SELECT_SEARCH_AFTER));
58
+ let query = $state("");
59
+ const shown = $derived(searches ? multiSelectMatches(options, query) : options);
60
+ let field: HTMLInputElement | undefined = $state();
61
+ const id = $props.id();
62
+
63
+ function pick(next: string[]) {
64
+ value = next;
65
+ onChange?.(next);
66
+ }
67
+
68
+ const service = useMachine(combobox.machine, () => ({
69
+ id,
70
+ dir: pageDir(),
71
+ collection: combobox.collection({
72
+ items: shown,
73
+ itemToValue: (o: SelectOption) => o.value,
74
+ itemToString: (o: SelectOption) => o.label,
75
+ isItemDisabled: (o: SelectOption) => !!o.disabled,
76
+ }),
77
+ value,
78
+ multiple: true,
79
+ disabled,
80
+ openOnClick: true,
81
+ selectionBehavior: "clear" as const,
82
+ positioning: { sameWidth: true, gutter: 6 },
83
+ onOpenChange: ({ open }: { open: boolean }) => {
84
+ if (!open) query = "";
85
+ },
86
+ onInputValueChange: ({ inputValue }: { inputValue: string }) => (query = inputValue),
87
+ onValueChange: (d: { value: string[] }) => pick(d.value),
88
+ }));
89
+ const api = $derived(combobox.connect(service, normalizeProps));
90
+ const labelOf = (v: string) => options.find((o) => o.value === v)?.label ?? v;
91
+ const input = $derived.by(() => {
92
+ const { onkeydown, ...rest } = api.getInputProps() as Record<string, unknown> & { onkeydown?: (e: KeyboardEvent) => void };
93
+ return { rest, onkeydown };
94
+ });
95
+
96
+ function onkeydown(e: KeyboardEvent) {
97
+ if (e.key === "Backspace" && api.inputValue === "" && value.length > 0) {
98
+ e.preventDefault();
99
+ pick(value.slice(0, -1));
100
+ return;
101
+ }
102
+ if (!searches && e.key === " ") {
103
+ e.preventDefault();
104
+ if (!api.open) api.setOpen(true);
105
+ else if (api.highlightedValue) api.selectValue(api.highlightedValue);
106
+ return;
107
+ }
108
+ input.onkeydown?.(e);
109
+ }
110
+
111
+ function remove(v: string) {
112
+ pick(multiSelectWithout(value, v));
113
+ field?.focus();
114
+ }
115
+ </script>
116
+
117
+ <div data-glim="MultiSelect" {...api.getRootProps()} class="glim-tags">
118
+ <label {...api.getLabelProps()} class={hideLabel || label === undefined ? "glim-sr-only" : "glim-field-label"}>{name()}</label>
119
+ <div {...api.getControlProps()} class={searches ? "glim-tags-control" : "glim-tags-control glim-tags-control--pick"}>
120
+ {#each value as v (v)}
121
+ <span class="glim-tag-item">
122
+ <span class="glim-tag">
123
+ <span class="glim-tag-text">{labelOf(v)}</span>
124
+ <button type="button" {disabled} aria-label={words.remove(labelOf(v))} onclick={() => remove(v)} class="glim-tag-remove">
125
+ {@render IconClose()}
126
+ </button>
127
+ </span>
128
+ </span>
129
+ {/each}
130
+ <input
131
+ {...input.rest}
132
+ bind:this={field}
133
+ readonly={!searches}
134
+ placeholder={value.length === 0 ? placeholder : searches ? words.search : undefined}
135
+ {onkeydown}
136
+ class="glim-tags-input"
137
+ />
138
+ <button {...api.getTriggerProps()} aria-label={words.toggle} class="glim-combobox-toggle">
139
+ <span class="glim-select-indicator" data-state={api.open ? "open" : "closed"}>{@render IconExpand()}</span>
140
+ </button>
141
+ </div>
142
+ <div {@attach lift} {...api.getPositionerProps()} class="glim-select-positioner">
143
+ <ul {...api.getContentProps()} class="glim-select-content">
144
+ {#if shown.length === 0}
145
+ <li class="glim-select-empty">{words.empty}</li>
146
+ {/if}
147
+ {#each shown as item (item.value)}
148
+ <li {...api.getItemProps({ item })} class="glim-select-item">
149
+ <span {...api.getItemTextProps({ item })}>{item.label}</span>
150
+ <span {...api.getItemIndicatorProps({ item })} class="glim-select-check">{@render IconCheck()}</span>
151
+ </li>
152
+ {/each}
153
+ </ul>
154
+ </div>
155
+ </div>
@@ -0,0 +1,20 @@
1
+ import type { MultiSelectText } from "@glimstone/core";
2
+ import type { SelectOption } from "./selectParts.svelte.js";
3
+ export type { MultiSelectText } from "@glimstone/core";
4
+ export interface MultiSelectProps {
5
+ label?: string;
6
+ hideLabel?: boolean;
7
+ options: SelectOption[];
8
+ /** The picked values, bound with `bind:value`, in the order they were picked. */
9
+ value: string[];
10
+ onChange?: (value: string[]) => void;
11
+ /** Shown while nothing is picked. */
12
+ placeholder?: string;
13
+ /** How many choices the list shows before the field takes a search, seven unless given. */
14
+ searchAfter?: number;
15
+ disabled?: boolean;
16
+ text?: Partial<MultiSelectText>;
17
+ }
18
+ declare const MultiSelect: import("svelte").Component<MultiSelectProps, {}, "value">;
19
+ type MultiSelect = ReturnType<typeof MultiSelect>;
20
+ export default MultiSelect;
@@ -0,0 +1,147 @@
1
+ <script lang="ts" module>
2
+ import type { Catalog, NotifyApi, NotifyCardLabelKeys, NotifyCardText, NotifyChoice, NotifyKind, ToastSeverity } from "@glimstone/core";
3
+
4
+ export type { NotifyCardLabelKeys, NotifyCardText } from "@glimstone/core";
5
+
6
+ export interface NotifyCardProps {
7
+ /** Loads, saves and tests the channels in the kit's notify format. */
8
+ api: NotifyApi;
9
+ /** The card's words, `notifyCardText(lang)` or the app's own. */
10
+ text: NotifyCardText;
11
+ /** The app's name, for the sentences that say it. */
12
+ app: string;
13
+ /** The interface language, which sorts the picker. */
14
+ lang: string;
15
+ /** The notification catalog, `NOTIFY_PROVIDERS`. */
16
+ providers: Catalog;
17
+ /** The kinds the app sends to, every kind of the kit by default. */
18
+ kinds?: readonly NotifyKind[];
19
+ /** The event kinds the app sends, which each channel can choose among. */
20
+ events?: readonly NotifyChoice[];
21
+ /** The keys a Healthchecks channel can give a check of their own, such as a job. */
22
+ checks?: readonly NotifyChoice[];
23
+ /** Kinds that send nothing where the app runs, with the sentence that says why. */
24
+ unavailable?: Partial<Record<NotifyKind, string>>;
25
+ /** Puts what a change did, or why it failed, into the app's toasts. */
26
+ notify?: (message: string, severity: ToastSeverity) => void;
27
+ /** The card's rainbow position. */
28
+ hueIndex?: number;
29
+ labelKeys?: Partial<NotifyCardLabelKeys>;
30
+ }
31
+ </script>
32
+
33
+ <script lang="ts">
34
+ import { onDestroy, onMount, untrack, type Snippet } from "svelte";
35
+ import { connectionTestFace, createNotifyCardFlow, fill, notifyGlyphKey, notifyRemoval, notifyRows, showNotifyRefusal, NOTIFY_CARD_KEYS, NOTIFY_KINDS } from "@glimstone/core";
36
+ import Badge from "./Badge.svelte";
37
+ import BrandMark from "./BrandMark.svelte";
38
+ import Button from "./Button.svelte";
39
+ import Card from "./Card.svelte";
40
+ import EmptyState from "./EmptyState.svelte";
41
+ import GlyphTile from "./GlyphTile.svelte";
42
+ import ListRow from "./ListRow.svelte";
43
+ import NotifyCardWindow from "./NotifyCardWindow.svelte";
44
+ import Toggle from "./Toggle.svelte";
45
+ import { useConfirm } from "./confirm.svelte.js";
46
+ import { glyphFor, IconCheck, IconClose, IconPencil, IconTrash } from "./glyphs.js";
47
+
48
+ // The settings card "Notifications" ("The notification card" in the design
49
+ // language): the app's channels as rows, each with its switch, its test, Edit
50
+ // and Remove, and the catalog's picker to add one. The flow lives in the core
51
+ // and talks to the app through three calls, so the card names no app or route.
52
+ let { api, text, app, lang, providers, kinds = NOTIFY_KINDS, events = [], checks = [], unavailable = {}, notify, hueIndex, labelKeys }: NotifyCardProps = $props();
53
+
54
+ const flow = createNotifyCardFlow(() => ({ api, text, app, lang, providers, kinds, events, checks, unavailable, notify }));
55
+ let s = $state.raw(flow.state());
56
+ onDestroy(flow.subscribe(() => (s = flow.state())));
57
+ onMount(() => flow.start());
58
+ const refusals = $derived(s.refusal?.count);
59
+ $effect(() => {
60
+ void refusals;
61
+ return untrack(() => showNotifyRefusal(s.refusal));
62
+ });
63
+ const ask = useConfirm({
64
+ get title() {
65
+ return text.remove;
66
+ },
67
+ get cancel() {
68
+ return text.cancel;
69
+ },
70
+ get confirm() {
71
+ return text.remove;
72
+ },
73
+ });
74
+
75
+ const keys = $derived<NotifyCardLabelKeys>({ ...NOTIFY_CARD_KEYS, ...labelKeys });
76
+ const rows = $derived(notifyRows(s, { text, providers, unavailable }));
77
+ const glyph = (kind: NotifyKind): Snippet => glyphFor(notifyGlyphKey(kind, keys))!;
78
+ const markOf = (kind: NotifyKind) => providers.entries.find((e) => e.id === kind)?.mark;
79
+
80
+ function remove(id: string) {
81
+ const c = s.channels.find((x) => x.id === id);
82
+ if (!c) return;
83
+ const q = notifyRemoval(text, c);
84
+ void ask.confirm(q.message, { confirmLabel: q.confirm, confirmLabelKey: keys.remove }).then((yes) => {
85
+ if (yes) void flow.remove(id);
86
+ });
87
+ }
88
+ </script>
89
+
90
+ <div data-glim="NotifyCard">
91
+ <Card title={text.title} hint={text.hint} {hueIndex}>
92
+ <div class="glim-notify-body">
93
+ {#if s.loadFailed}
94
+ <p class="glim-notify-said glim-notify-said--fail" role="alert">{text.notLoaded}</p>
95
+ {/if}
96
+ {#if rows.length > 0}
97
+ <div class="glim-list glim-notify-rows">
98
+ {#each rows as row (row.id)}
99
+ {@const test = s.rowTests[row.id]}
100
+ {@const face = connectionTestFace(test)}
101
+ {@const m = markOf(row.kind)}
102
+ {#snippet brand()}<BrandMark svg={m?.svg ?? ""} />{/snippet}
103
+ {#snippet idle()}<Badge size="small" tone="warn">{text.idle}</Badge>{/snippet}
104
+ <ListRow steady name={row.name} meta={row.meta} badges={row.idle ? idle : undefined} data-notify-channel={row.id}>
105
+ {#snippet tile()}<GlyphTile glyph={m ? brand : glyph(row.kind)} />{/snippet}
106
+ {#snippet actions()}
107
+ <Toggle bind:checked={() => row.enabled, (on) => void flow.setEnabled(row.id, on)} label={row.name} hideLabel data-notify={`switch-${row.id}`} />
108
+ <Button
109
+ compact
110
+ tone={face.tone === "neutral" ? "subtle" : face.tone}
111
+ label={text.test}
112
+ labelKey={keys.test}
113
+ glyph={face.outcome === "cross" ? IconClose : IconCheck}
114
+ busy={test?.busy}
115
+ title={test?.title}
116
+ class={face.shake ? "glim-shake" : undefined}
117
+ data-notify={`test-${row.id}`}
118
+ onClick={() => void flow.testRow(row.id)}
119
+ />
120
+ <Button compact tone="subtle" label={text.edit} labelKey={keys.edit} glyph={IconPencil} data-notify={`edit-${row.id}`} onClick={() => flow.edit(row.id)} />
121
+ <Button
122
+ compact
123
+ tone="subtle"
124
+ label={text.remove}
125
+ labelKey={keys.remove}
126
+ glyph={IconTrash}
127
+ busy={s.busy === `remove-${row.id}`}
128
+ data-notify={`remove-${row.id}`}
129
+ onClick={() => remove(row.id)}
130
+ />
131
+ {/snippet}
132
+ </ListRow>
133
+ {/each}
134
+ </div>
135
+ {:else if s.loaded}
136
+ <EmptyState nested title={fill(text.empty, { app })} />
137
+ {/if}
138
+ <div class="glim-notify-foot">
139
+ <Button label={text.add} labelKey={keys.add} disabled={!s.loaded} data-notify="add" onClick={flow.pick} />
140
+ </div>
141
+ </div>
142
+ </Card>
143
+ {#if s.window}
144
+ <NotifyCardWindow {flow} flowState={s} {text} {app} {lang} {providers} {kinds} {events} {checks} {unavailable} {keys} {glyph} />
145
+ {/if}
146
+ <ask.confirmDialog />
147
+ </div>
@@ -0,0 +1,30 @@
1
+ import type { Catalog, NotifyApi, NotifyCardLabelKeys, NotifyCardText, NotifyChoice, NotifyKind, ToastSeverity } from "@glimstone/core";
2
+ export type { NotifyCardLabelKeys, NotifyCardText } from "@glimstone/core";
3
+ export interface NotifyCardProps {
4
+ /** Loads, saves and tests the channels in the kit's notify format. */
5
+ api: NotifyApi;
6
+ /** The card's words, `notifyCardText(lang)` or the app's own. */
7
+ text: NotifyCardText;
8
+ /** The app's name, for the sentences that say it. */
9
+ app: string;
10
+ /** The interface language, which sorts the picker. */
11
+ lang: string;
12
+ /** The notification catalog, `NOTIFY_PROVIDERS`. */
13
+ providers: Catalog;
14
+ /** The kinds the app sends to, every kind of the kit by default. */
15
+ kinds?: readonly NotifyKind[];
16
+ /** The event kinds the app sends, which each channel can choose among. */
17
+ events?: readonly NotifyChoice[];
18
+ /** The keys a Healthchecks channel can give a check of their own, such as a job. */
19
+ checks?: readonly NotifyChoice[];
20
+ /** Kinds that send nothing where the app runs, with the sentence that says why. */
21
+ unavailable?: Partial<Record<NotifyKind, string>>;
22
+ /** Puts what a change did, or why it failed, into the app's toasts. */
23
+ notify?: (message: string, severity: ToastSeverity) => void;
24
+ /** The card's rainbow position. */
25
+ hueIndex?: number;
26
+ labelKeys?: Partial<NotifyCardLabelKeys>;
27
+ }
28
+ declare const NotifyCard: import("svelte").Component<NotifyCardProps, {}, "">;
29
+ type NotifyCard = ReturnType<typeof NotifyCard>;
30
+ export default NotifyCard;
@@ -0,0 +1,206 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import {
4
+ connectionTestFace,
5
+ fill,
6
+ notifyChannelName,
7
+ notifyForm,
8
+ notifyPicker,
9
+ NOTIFY_REDACTED,
10
+ type Catalog,
11
+ type NotifyCardFlow,
12
+ type NotifyCardLabelKeys,
13
+ type NotifyCardState,
14
+ type NotifyCardText,
15
+ type NotifyChoice,
16
+ type NotifyField,
17
+ type NotifyKind,
18
+ } from "@glimstone/core";
19
+ import Button from "./Button.svelte";
20
+ import Checkbox from "./Checkbox.svelte";
21
+ import FieldRow from "./FieldRow.svelte";
22
+ import FieldRowGroup from "./FieldRowGroup.svelte";
23
+ import NumberField from "./NumberField.svelte";
24
+ import PasswordField from "./PasswordField.svelte";
25
+ import PickerWindow from "./PickerWindow.svelte";
26
+ import Select from "./Select.svelte";
27
+ import Selector from "./Selector.svelte";
28
+ import TextArea from "./TextArea.svelte";
29
+ import TextField from "./TextField.svelte";
30
+ import UnavailableNotice from "./UnavailableNotice.svelte";
31
+ import Window, { type WindowAction } from "./Window.svelte";
32
+ import { IconCheck, IconClose, IconTrash } from "./glyphs.js";
33
+
34
+ // The notification card's window: the picker, and the form of the channel
35
+ // being added or edited.
36
+ let {
37
+ flow,
38
+ flowState: s,
39
+ text,
40
+ app,
41
+ lang,
42
+ providers,
43
+ kinds,
44
+ events,
45
+ checks,
46
+ unavailable,
47
+ keys,
48
+ glyph,
49
+ }: {
50
+ flow: NotifyCardFlow;
51
+ flowState: NotifyCardState;
52
+ text: NotifyCardText;
53
+ app: string;
54
+ lang: string;
55
+ providers: Catalog;
56
+ kinds: readonly NotifyKind[];
57
+ events: readonly NotifyChoice[];
58
+ checks: readonly NotifyChoice[];
59
+ unavailable: Partial<Record<NotifyKind, string>>;
60
+ keys: NotifyCardLabelKeys;
61
+ glyph: (kind: NotifyKind) => Snippet;
62
+ } = $props();
63
+
64
+ const w = $derived(s.window!);
65
+ const picker = $derived(notifyPicker(providers, text, lang, kinds, glyph));
66
+ const pickerText = $derived({ search: text.search, none: text.noMatch, clear: text.clear, close: text.close, cancel: text.cancel, back: text.back });
67
+ const form = $derived(w.kind === "form" ? notifyForm(s, { text, app, events, checks, unavailable }) : null);
68
+ const eye = $derived({ show: text.show, hide: text.hide });
69
+ const title = $derived(s.draft ? fill(text.editTitle, { name: notifyChannelName(text, s.draft) }) : "");
70
+ const actions = $derived.by<WindowAction[]>(() => {
71
+ const test = s.formTest;
72
+ const face = connectionTestFace(test);
73
+ return [
74
+ {
75
+ label: text.test,
76
+ labelKey: keys.test,
77
+ glyph: face.outcome === "cross" ? IconClose : face.outcome === "check" ? IconCheck : undefined,
78
+ tone: test?.busy ? undefined : test?.tone,
79
+ busy: !!test?.busy,
80
+ title: test?.title,
81
+ attrs: { "data-notify": "form-test" },
82
+ onClick: () => {
83
+ void flow.test();
84
+ return false;
85
+ },
86
+ },
87
+ {
88
+ label: text.save,
89
+ labelKey: keys.save,
90
+ primary: true,
91
+ busy: s.busy === "save",
92
+ attrs: { "data-notify": "save" },
93
+ onClick: () => {
94
+ void flow.save();
95
+ return false;
96
+ },
97
+ },
98
+ ];
99
+ });
100
+ const items = (options: NotifyField["options"]) => (options ?? []).map((o) => ({ id: o.value, label: o.label }));
101
+ const port = (v: string) => (v === "" ? null : Number(v));
102
+ </script>
103
+
104
+ {#snippet problem(f: NotifyField)}
105
+ {#if f.error}
106
+ <p class="glim-notify-problem" role="alert">{f.error}</p>
107
+ {/if}
108
+ {/snippet}
109
+
110
+ {#snippet body()}
111
+ {#if form}
112
+ <div class="glim-notify-form" data-notify-form={form.kind}>
113
+ {#if form.hint}
114
+ <p class="glim-notify-text">{form.hint}</p>
115
+ {/if}
116
+ {#if form.unavailable}
117
+ <UnavailableNotice title={text.idle} reason={form.unavailable} />
118
+ {/if}
119
+ {#each form.loose as line, i (i)}
120
+ <p class="glim-notify-problem" role="alert">{line}</p>
121
+ {/each}
122
+ <FieldRowGroup>
123
+ {#each form.fields as f (f.path)}
124
+ <FieldRow label={f.label} hint={f.hint}>
125
+ {#if f.control === "secret"}
126
+ <PasswordField autocomplete="new-password" value={f.value} text={eye} note={f.note} error={f.error} oninput={(e) => flow.set(f.path, e.currentTarget.value)} />
127
+ {:else if f.control === "number"}
128
+ <NumberField
129
+ min={1}
130
+ max={65535}
131
+ value={port(f.value)}
132
+ placeholder={f.placeholder}
133
+ error={f.error}
134
+ onChange={(e) => flow.set(f.path, e.currentTarget.value)}
135
+ />
136
+ {:else if f.control === "area"}
137
+ <TextArea mono={f.mono} value={f.value} placeholder={f.placeholder} error={f.error} oninput={(e) => flow.set(f.path, e.currentTarget.value)} />
138
+ {:else if f.control === "select"}
139
+ <Select value={f.value} options={(f.options ?? []).map((o) => ({ value: o.value, label: o.label }))} onChange={(v) => flow.set(f.path, v)} />
140
+ {@render problem(f)}
141
+ {:else if f.control === "segments"}
142
+ <Selector inline activation="manual" value={f.value} items={items(f.options)} onChange={(v) => flow.set(f.path, v)} />
143
+ {@render problem(f)}
144
+ {:else if f.control === "checks"}
145
+ <div class="glim-notify-checks" data-notify="events">
146
+ {#each f.options ?? [] as o (o.value)}
147
+ <Checkbox bind:checked={() => !!o.checked, (on) => flow.setEvent(o.value, on)} label={o.label} />
148
+ {/each}
149
+ </div>
150
+ {:else if f.control === "headers"}
151
+ <div class="glim-notify-headers">
152
+ {#each s.headers as h, i (i)}
153
+ <div class="glim-notify-header">
154
+ <TextField mono label={text.fields.headerName} value={h.name} placeholder="Authorization" oninput={(e) => flow.setHeader(i, "name", e.currentTarget.value)} />
155
+ <PasswordField
156
+ autocomplete="new-password"
157
+ aria-label={text.fields.headerValue}
158
+ value={h.value === NOTIFY_REDACTED ? "" : h.value}
159
+ text={eye}
160
+ oninput={(e) => flow.setHeader(i, "value", e.currentTarget.value)}
161
+ />
162
+ <Button compact tone="subtle" label={text.fields.headerRemove} labelKey={keys.remove} glyph={IconTrash} onClick={() => flow.removeHeader(i)} />
163
+ </div>
164
+ {/each}
165
+ <div>
166
+ <Button label={text.fields.headerAdd} labelKey={keys.add} onClick={flow.addHeader} />
167
+ </div>
168
+ {#if f.note}
169
+ <p class="glim-notify-text">{f.note}</p>
170
+ {/if}
171
+ {@render problem(f)}
172
+ </div>
173
+ {:else}
174
+ <TextField mono={f.mono} value={f.value} placeholder={f.placeholder} error={f.error} oninput={(e) => flow.set(f.path, e.currentTarget.value)} />
175
+ {/if}
176
+ </FieldRow>
177
+ {/each}
178
+ </FieldRowGroup>
179
+ {#if s.said}
180
+ <p class={s.said.ok ? "glim-notify-said" : "glim-notify-said glim-notify-said--fail"} role={s.said.ok ? "status" : "alert"}>{s.said.message}</p>
181
+ {/if}
182
+ </div>
183
+ {/if}
184
+ {/snippet}
185
+
186
+ {#if w.kind === "pick"}
187
+ <PickerWindow title={text.add} hint={text.hint} items={picker.items} groups={picker.groups} text={pickerText} onPick={flow.choose} onClose={flow.close} />
188
+ {:else if form && w.adding}
189
+ <PickerWindow
190
+ title={text.add}
191
+ items={picker.items}
192
+ groups={picker.groups}
193
+ text={pickerText}
194
+ selected={form.kind}
195
+ {actions}
196
+ onPick={flow.choose}
197
+ onBack={flow.pick}
198
+ onClose={flow.close}
199
+ >
200
+ {@render body()}
201
+ </PickerWindow>
202
+ {:else if form}
203
+ <Window {title} text={{ cancel: text.cancel, close: text.close }} closeOnBackdrop={false} {actions} onClose={flow.close}>
204
+ {@render body()}
205
+ </Window>
206
+ {/if}
@@ -0,0 +1,19 @@
1
+ import type { Snippet } from "svelte";
2
+ import { type Catalog, type NotifyCardFlow, type NotifyCardLabelKeys, type NotifyCardState, type NotifyCardText, type NotifyChoice, type NotifyKind } from "@glimstone/core";
3
+ type $$ComponentProps = {
4
+ flow: NotifyCardFlow;
5
+ flowState: NotifyCardState;
6
+ text: NotifyCardText;
7
+ app: string;
8
+ lang: string;
9
+ providers: Catalog;
10
+ kinds: readonly NotifyKind[];
11
+ events: readonly NotifyChoice[];
12
+ checks: readonly NotifyChoice[];
13
+ unavailable: Partial<Record<NotifyKind, string>>;
14
+ keys: NotifyCardLabelKeys;
15
+ glyph: (kind: NotifyKind) => Snippet;
16
+ };
17
+ declare const NotifyCardWindow: import("svelte").Component<$$ComponentProps, {}, "">;
18
+ type NotifyCardWindow = ReturnType<typeof NotifyCardWindow>;
19
+ export default NotifyCardWindow;
@@ -19,13 +19,14 @@
19
19
  <script lang="ts">
20
20
  import * as pagination from "@zag-js/pagination";
21
21
  import { normalizeProps, useMachine } from "@zag-js/svelte";
22
- import { PAGINATION_TEXT, pageDir } from "@glimstone/core";
22
+ import { PAGINATION_TEXT, pageDir, watchPaginationFit } from "@glimstone/core";
23
23
  import Button from "./Button.svelte";
24
24
  import { IconBack, IconForward } from "./glyphs.js";
25
25
 
26
26
  // The pages of a long list, for the place a list cannot show every row at once.
27
27
  // The page in force is filled with the accent, as anything chosen is, and the
28
- // two steps follow the label mode like every other button.
28
+ // two steps follow the label mode like every other button. Where the row has
29
+ // no room, the steps stand as glyphs around "3 / 20" (watchPaginationFit).
29
30
  let { count, pageSize = 10, page = $bindable(), onPageChange, siblingCount = 1, text }: PaginationProps = $props();
30
31
 
31
32
  const words = $derived({ ...PAGINATION_TEXT, ...text });
@@ -47,10 +48,14 @@
47
48
  },
48
49
  }));
49
50
  const api = $derived(pagination.connect(service, normalizeProps));
51
+
52
+ let nav: HTMLElement;
53
+ $effect(() => watchPaginationFit(nav));
50
54
  </script>
51
55
 
52
- <nav data-glim="Pagination" {...api.getRootProps()} class="glim-pagination">
53
- <Button label={words.previous} labelKey={null} glyph={IconBack} variant="icon" disabled={api.previousPage === null} onClick={() => api.goToPrevPage()} />
56
+ <nav bind:this={nav} data-glim="Pagination" {...api.getRootProps()} class="glim-pagination">
57
+ <Button class="glim-page-step" label={words.previous} labelKey={null} glyph={IconBack} variant="icon" disabled={api.previousPage === null} onClick={() => api.goToPrevPage()} />
58
+ <Button class="glim-page-step-short" label={words.previous} labelKey={null} glyph={IconBack} compact disabled={api.previousPage === null} onClick={() => api.goToPrevPage()} />
54
59
  {#each api.pages as p, index (p.type === "page" ? p.value : `gap-${index}`)}
55
60
  {#if p.type === "page"}
56
61
  <button {...api.getItemProps(p)} class="glim-page glim-num">{p.value}</button>
@@ -58,5 +63,10 @@
58
63
  <span {...api.getEllipsisProps({ index })} class="glim-page-gap">…</span>
59
64
  {/if}
60
65
  {/each}
61
- <Button label={words.next} labelKey={null} glyph={IconForward} variant="icon" disabled={api.nextPage === null} onClick={() => api.goToNextPage()} />
66
+ <span class="glim-page-status glim-num">
67
+ <span aria-hidden="true">{words.status(api.page, api.totalPages)}</span>
68
+ <span class="glim-sr-only">{words.page(api.page, api.totalPages)}</span>
69
+ </span>
70
+ <Button class="glim-page-step" label={words.next} labelKey={null} glyph={IconForward} variant="icon" disabled={api.nextPage === null} onClick={() => api.goToNextPage()} />
71
+ <Button class="glim-page-step-short" label={words.next} labelKey={null} glyph={IconForward} compact disabled={api.nextPage === null} onClick={() => api.goToNextPage()} />
62
72
  </nav>
@@ -34,7 +34,6 @@
34
34
  import { onDestroy, onMount, untrack } from "svelte";
35
35
  import {
36
36
  accountFacts,
37
- connectionTestFace,
38
37
  createSignInTileFlow,
39
38
  fill,
40
39
  passkeyFacts,
@@ -52,6 +51,7 @@
52
51
  signInTileCards,
53
52
  signInWhen,
54
53
  signInCardNotice,
54
+ signInPasswordAsks,
55
55
  signInPasswordElsewhere,
56
56
  signInShortHint,
57
57
  tokenFacts,
@@ -61,18 +61,16 @@
61
61
  import Badge from "./Badge.svelte";
62
62
  import Button from "./Button.svelte";
63
63
  import Card from "./Card.svelte";
64
- import BrandMark from "./BrandMark.svelte";
64
+ import ConnectionRow from "./ConnectionRow.svelte";
65
65
  import EmptyState from "./EmptyState.svelte";
66
66
  import FieldRow from "./FieldRow.svelte";
67
67
  import FieldRowGroup from "./FieldRowGroup.svelte";
68
- import GlyphTile from "./GlyphTile.svelte";
69
- import ListRow from "./ListRow.svelte";
70
68
  import PasswordField from "./PasswordField.svelte";
71
69
  import SignInTileWindow from "./SignInTileWindow.svelte";
72
70
  import Toggle from "./Toggle.svelte";
73
71
  import UnavailableNotice from "./UnavailableNotice.svelte";
74
72
  import { useConfirm } from "./confirm.svelte.js";
75
- import { glyphFor, IconCancel, IconCheck, IconClose, IconPencil, IconTrash } from "./glyphs.js";
73
+ import { glyphFor, IconCancel } from "./glyphs.js";
76
74
 
77
75
  // The settings tile "Sign-in" ("The sign-in tile" in the design language):
78
76
  // the password, the question before sensitive changes, two-factor, passkeys,
@@ -128,7 +126,10 @@
128
126
  const notice = (card: "askPassword" | "twoFactor" | "passkeys" | "tokens" | "services" | "sessions" | "accounts") => signInCardNotice(text, s, card);
129
127
  const elsewhere = $derived(signInPasswordElsewhere(text, s));
130
128
  const had = $derived(!!s.me?.password);
129
+ const asks = $derived(signInPasswordAsks(s, cards) && !s.editing);
131
130
  const glyph = (key: string) => glyphFor(key)!;
131
+ // The words of a row's own buttons: a service's test, edit and remove, and a passkey's rename in place of edit.
132
+ const rowText = (edit = text.services.edit) => ({ test: text.services.test, edit, remove: text.remove });
132
133
 
133
134
  function remove(what: SignInTileRemoval, id: string, name: string) {
134
135
  const q = removalQuestion(text, what, name);
@@ -142,6 +143,12 @@
142
143
  <UnavailableNotice title={n.title} reason={n.reason} />
143
144
  {/snippet}
144
145
 
146
+ {#snippet askPasswordRow()}
147
+ <FieldRow label={text.askPassword.label} hint={text.askPassword.when}>
148
+ <Toggle bind:checked={() => !!s.settings?.askPassword, (on) => void flow.setAskPassword(on)} data-signin-tile="ask-password" />
149
+ </FieldRow>
150
+ {/snippet}
151
+
145
152
  <div data-glim="SignInTile" class="glim-signin-tile">
146
153
  {#each shown as c, i (c)}
147
154
  {@const hue = hueStart + i}
@@ -149,10 +156,20 @@
149
156
  {@const t = text.password}
150
157
  <Card title={t.title} hint={s.me?.via === "open" ? t.openHint : fill(t.hint, { min: s.offer?.minPassword ?? 12 })} hueIndex={hue} data-signin-card="password">
151
158
  {#if elsewhere}
152
- <p class="glim-signin-tile-text">{elsewhere}</p>
159
+ <div class="glim-signin-tile-body">
160
+ <p class="glim-signin-tile-text">{elsewhere}</p>
161
+ {#if asks}{@render askPasswordRow()}{/if}
162
+ </div>
153
163
  {:else}
154
164
  <div class="glim-signin-tile-body">
155
- <FieldRow label={t.state} value={had ? t.set : t.none} tone={had ? undefined : "warn"} />
165
+ {#if had}
166
+ <FieldRowGroup>
167
+ <FieldRow label={t.state} value={t.set} />
168
+ {#if asks}{@render askPasswordRow()}{/if}
169
+ </FieldRowGroup>
170
+ {:else if !s.editing}
171
+ <EmptyState nested glyph={glyph(keys.setPassword)} title={t.none} hint={t.noneHint} />
172
+ {/if}
156
173
  {#if s.editing}
157
174
  <FieldRowGroup>
158
175
  {#if had}
@@ -205,9 +222,7 @@
205
222
  {#if notice("askPassword")}
206
223
  {@render cardNotice(notice("askPassword")!)}
207
224
  {:else}
208
- <FieldRow label={t.label} hint={t.when}>
209
- <Toggle bind:checked={() => !!s.settings?.askPassword, (on) => void flow.setAskPassword(on)} data-signin-tile="ask-password" />
210
- </FieldRow>
225
+ {@render askPasswordRow()}
211
226
  {/if}
212
227
  </Card>
213
228
  {:else if c === "twoFactor"}
@@ -218,10 +233,14 @@
218
233
  {@render cardNotice(notice("twoFactor")!)}
219
234
  {:else}
220
235
  <div class="glim-signin-tile-body">
221
- <FieldRowGroup>
222
- <FieldRow label={t.state} value={on ? t.on : t.off} tone={on ? "ok" : undefined} />
223
- {#if on}<FieldRow label={t.codesLeft} value={plural(lang, t.codesLeftValue, s.me?.recoveryLeft ?? 0)} />{/if}
224
- </FieldRowGroup>
236
+ {#if on}
237
+ <FieldRowGroup>
238
+ <FieldRow label={t.state} value={t.on} tone="ok" />
239
+ <FieldRow label={t.codesLeft} value={plural(lang, t.codesLeftValue, s.me?.recoveryLeft ?? 0)} />
240
+ </FieldRowGroup>
241
+ {:else}
242
+ <EmptyState nested glyph={glyph(keys.setUp)} title={t.none} hint={t.noneHint} />
243
+ {/if}
225
244
  <div class="glim-signin-tile-foot">
226
245
  {#if on}
227
246
  <Button label={t.newCodes} labelKey={keys.newCodes} busy={s.busy === "two-factor-codes"} data-signin-tile="two-factor-codes" onClick={() => void flow.newCodes()} />
@@ -243,15 +262,20 @@
243
262
  <div class="glim-signin-tile-body">
244
263
  {#if !here}<UnavailableNotice title={t.unavailableTitle} reason={t.unavailable} />{/if}
245
264
  {#if s.passkeys.length > 0}
246
- <div class="glim-list glim-signin-tile-rows">
265
+ <div class="glim-signin-tile-rows">
247
266
  {#each s.passkeys as p (p.id)}
248
- <ListRow steady name={p.name} meta={passkeyFacts(text, p, when).added} tip={passkeyFacts(text, p, when).more}>
249
- {#snippet tile()}<GlyphTile glyph={glyph(keys.passkey)} />{/snippet}
250
- {#snippet actions()}
251
- <Button compact tone="subtle" label={t.rename} labelKey={keys.rename} glyph={IconPencil} data-signin-tile={`passkey-rename-${p.id}`} onClick={() => flow.askRenamePasskey(p.id)} />
252
- <Button compact tone="subtle" label={text.remove} labelKey={keys.remove} glyph={IconTrash} data-signin-tile={`remove-passkey-${p.id}`} onClick={() => remove("passkey", p.id, p.name)} />
253
- {/snippet}
254
- </ListRow>
267
+ {@const facts = passkeyFacts(text, p, when)}
268
+ <ConnectionRow
269
+ name={p.name}
270
+ mark={glyph(keys.passkey)}
271
+ status={facts.added}
272
+ text={rowText(t.rename)}
273
+ labelKeys={{ edit: keys.rename, remove: keys.remove }}
274
+ onEdit={() => flow.askRenamePasskey(p.id)}
275
+ onRemove={() => remove("passkey", p.id, p.name)}
276
+ >
277
+ <p class="glim-connection-status">{facts.more}</p>
278
+ </ConnectionRow>
255
279
  {/each}
256
280
  </div>
257
281
  {:else if here}
@@ -272,29 +296,17 @@
272
296
  {@render cardNotice(notice("sessions")!)}
273
297
  {:else}
274
298
  <div class="glim-signin-tile-body">
275
- <div class="glim-list glim-signin-tile-rows">
299
+ <div class="glim-signin-tile-rows">
276
300
  {#each s.sessions as x (x.id)}
277
301
  {@const device = signInDevice(x.agent, t)}
278
- {#snippet tile()}<GlyphTile glyph={glyph(device.phone ? keys.phone : keys.laptop)} />{/snippet}
279
302
  {#snippet badges()}<Badge size="small" tone="active">{t.current}</Badge>{/snippet}
280
- {#snippet end()}
281
- <Button
282
- compact
283
- tone="subtle"
284
- label={t.end}
285
- labelKey={keys.end}
286
- busy={s.busy === `session-end-${x.id}`}
287
- data-signin-tile={`session-end-${x.id}`}
288
- onClick={() => void flow.endSession(x.id)}
289
- />
290
- {/snippet}
291
- <ListRow
292
- steady
303
+ <ConnectionRow
293
304
  name={device.name}
294
- meta={sessionFacts(text, x, s.serviceLabels, when).join(" · ")}
295
- {tile}
305
+ mark={glyph(device.phone ? keys.phone : keys.laptop)}
306
+ status={sessionFacts(text, x, s.serviceLabels, when).join(" · ")}
296
307
  badges={x.current ? badges : undefined}
297
- actions={x.current ? undefined : end}
308
+ text={rowText()}
309
+ actions={x.current ? [] : [{ id: "end", label: t.end, labelKey: keys.end, busy: s.busy === `session-end-${x.id}`, onClick: () => void flow.endSession(x.id) }]}
298
310
  />
299
311
  {/each}
300
312
  </div>
@@ -320,16 +332,19 @@
320
332
  {:else}
321
333
  <div class="glim-signin-tile-body">
322
334
  {#if s.tokens.length > 0}
323
- <div class="glim-list glim-signin-tile-rows">
335
+ <div class="glim-signin-tile-rows">
324
336
  {#each s.tokens as k (k.id)}
325
- {#snippet tile()}<GlyphTile glyph={glyph(keys.token)} />{/snippet}
326
337
  {#snippet scopes()}
327
338
  {#each k.scopes as scope (scope)}<Badge size="small">{t.scopes[scope] ?? scope}</Badge>{/each}
328
339
  {/snippet}
329
- {#snippet actions()}
330
- <Button compact tone="subtle" label={t.revoke} labelKey={keys.revoke} data-signin-tile={`remove-token-${k.id}`} onClick={() => remove("token", k.id, k.name)} />
331
- {/snippet}
332
- <ListRow steady name={k.name} meta={tokenFacts(text, k, when).join(" · ")} {tile} badges={k.scopes.length > 0 ? scopes : undefined} {actions} />
340
+ <ConnectionRow
341
+ name={k.name}
342
+ mark={glyph(keys.token)}
343
+ status={tokenFacts(text, k, when).join(" · ")}
344
+ badges={k.scopes.length > 0 ? scopes : undefined}
345
+ text={rowText()}
346
+ actions={[{ id: "revoke", label: t.revoke, labelKey: keys.revoke, onClick: () => remove("token", k.id, k.name) }]}
347
+ />
333
348
  {/each}
334
349
  </div>
335
350
  {:else}
@@ -349,46 +364,36 @@
349
364
  {:else}
350
365
  <div class="glim-signin-tile-body">
351
366
  {#if (s.services?.length ?? 0) > 0}
352
- <div class="glim-list glim-signin-tile-rows">
367
+ <div class="glim-signin-tile-rows">
353
368
  {#each s.services ?? [] as x (x.id)}
354
369
  {@const badge = signInServiceBadge(text, x)}
355
370
  {@const label = signInServiceLabel(x, providers, text)}
356
- {@const face = connectionTestFace(s.rowTests[x.id])}
357
- {#snippet brand()}<BrandMark svg={label.mark?.svg ?? ""} />{/snippet}
358
- <ListRow steady name={label.name} meta={signInServiceStatus(text, x, when)} data-signin-service={x.provider}>
359
- {#snippet tile()}<GlyphTile glyph={label.mark ? brand : glyph(keys.service)} />{/snippet}
360
- {#snippet badges()}<Badge size="small" tone={badge.tone}>{badge.label}</Badge>{/snippet}
361
- {#snippet actions()}
362
- {#if !x.fromConfig}
363
- <Toggle
364
- bind:checked={() => x.on, (on) => void flow.setServiceOn(x.id, on)}
365
- label={t.show}
366
- hideLabel
367
- refused={!x.tested || x.paused ? t.mustTest : undefined}
368
- data-signin-tile={`service-on-${x.id}`}
369
- />
370
- {/if}
371
- {#each signInServiceActions(text, x, s, keys.turnOn, (id) => void flow.confirmService(id)) as a (a.id)}
372
- <Button compact tone="subtle" label={a.label} labelKey={a.labelKey} busy={a.busy} data-signin-tile={`service-${a.id}-${x.id}`} onClick={a.onClick} />
373
- {/each}
374
- {#if !x.fromConfig}
375
- <Button
376
- compact
377
- tone={face.tone === "neutral" ? "subtle" : face.tone}
378
- label={t.test}
379
- labelKey={keys.test}
380
- glyph={face.outcome === "cross" ? IconClose : IconCheck}
381
- busy={s.rowTests[x.id]?.busy}
382
- title={s.rowTests[x.id]?.title}
383
- class={face.shake ? "glim-shake" : undefined}
384
- data-signin-tile={`service-test-${x.id}`}
385
- onClick={() => void flow.testService(x.id)}
386
- />
387
- <Button compact tone="subtle" label={t.edit} labelKey={keys.edit} glyph={IconPencil} data-signin-tile={`service-edit-${x.id}`} onClick={() => flow.editService(x.id)} />
388
- <Button compact tone="subtle" label={text.remove} labelKey={keys.remove} glyph={IconTrash} data-signin-tile={`remove-service-${x.id}`} onClick={() => remove("service", x.id, label.name)} />
389
- {/if}
390
- {/snippet}
391
- </ListRow>
371
+ {@const mine = !x.fromConfig}
372
+ {#snippet stands()}{#if badge}<Badge size="small" tone={badge.tone}>{badge.label}</Badge>{/if}{/snippet}
373
+ {#snippet shown()}
374
+ <Toggle
375
+ bind:checked={() => x.on, (on) => void flow.setServiceOn(x.id, on)}
376
+ label={t.show}
377
+ hideLabel
378
+ refused={!x.tested || x.paused ? t.mustTest : undefined}
379
+ data-signin-tile={`service-on-${x.id}`}
380
+ />
381
+ {/snippet}
382
+ <ConnectionRow
383
+ name={label.name}
384
+ mark={label.mark ?? glyph(keys.service)}
385
+ status={signInServiceStatus(text, x, when)}
386
+ badges={badge ? stands : undefined}
387
+ data-signin-service={x.provider}
388
+ control={mine ? shown : undefined}
389
+ text={rowText()}
390
+ labelKeys={{ test: keys.test, edit: keys.edit, remove: keys.remove }}
391
+ actions={signInServiceActions(text, x, s, keys.turnOn, (id) => void flow.confirmService(id))}
392
+ test={s.rowTests[x.id]}
393
+ onTest={mine ? () => void flow.testService(x.id) : undefined}
394
+ onEdit={mine ? () => flow.editService(x.id) : undefined}
395
+ onRemove={mine ? () => remove("service", x.id, label.name) : undefined}
396
+ />
392
397
  {/each}
393
398
  </div>
394
399
  {/if}
@@ -404,32 +409,32 @@
404
409
  {#if notice("accounts")}
405
410
  {@render cardNotice(notice("accounts")!)}
406
411
  {:else}
407
- <div class="glim-list glim-signin-tile-rows">
412
+ <div class="glim-signin-tile-rows">
408
413
  {#each s.accounts ?? [] as a (a.id)}
409
- {#snippet tile()}<GlyphTile glyph={glyph(keys.account)} />{/snippet}
414
+ {@const mine = a.owner || a.id === s.me?.account}
410
415
  {#snippet badges()}
411
416
  {#if a.owner}<Badge size="small">{t.owner}</Badge>{/if}
412
417
  {#if a.blocked}<Badge size="small" tone="warn">{t.blocked}</Badge>{/if}
413
418
  {/snippet}
414
- {#snippet manage()}
415
- <Button
416
- compact
417
- tone="subtle"
418
- label={a.blocked ? t.unblock : t.block}
419
- labelKey={a.blocked ? keys.unblock : keys.block}
420
- busy={s.busy === `account-block-${a.id}`}
421
- data-signin-tile={`account-block-${a.id}`}
422
- onClick={() => void flow.block(a.id, !a.blocked)}
423
- />
424
- <Button compact tone="subtle" label={text.remove} labelKey={keys.remove} glyph={IconTrash} data-signin-tile={`remove-account-${a.id}`} onClick={() => remove("account", a.id, a.name)} />
425
- {/snippet}
426
- <ListRow
427
- steady
419
+ <ConnectionRow
428
420
  name={a.name}
429
- meta={accountFacts(text, a, s.serviceLabels, when).join(" · ")}
430
- {tile}
421
+ mark={glyph(keys.account)}
422
+ status={accountFacts(text, a, s.serviceLabels, when).join(" · ")}
431
423
  badges={a.owner || a.blocked ? badges : undefined}
432
- actions={!a.owner && a.id !== s.me?.account ? manage : undefined}
424
+ text={rowText()}
425
+ labelKeys={{ remove: keys.remove }}
426
+ actions={mine
427
+ ? []
428
+ : [
429
+ {
430
+ id: "block",
431
+ label: a.blocked ? t.unblock : t.block,
432
+ labelKey: a.blocked ? keys.unblock : keys.block,
433
+ busy: s.busy === `account-block-${a.id}`,
434
+ onClick: () => void flow.block(a.id, !a.blocked),
435
+ },
436
+ ]}
437
+ onRemove={mine ? undefined : () => remove("account", a.id, a.name)}
433
438
  />
434
439
  {/each}
435
440
  </div>
@@ -0,0 +1 @@
1
+ export { default as MultiSelect, type MultiSelectProps, type MultiSelectText } from "../MultiSelect.svelte";
@@ -0,0 +1,2 @@
1
+ // Its own entry, so an app that uses none of the Zag controls needs none of the Zag packages.
2
+ export { default as MultiSelect } from "../MultiSelect.svelte";
package/dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ export { default as SignInCard, type ResetAnswer, type SignInAnswer, type SignIn
58
58
  export { default as SignInField, type SignInFieldProps } from "./SignInField.svelte";
59
59
  export { default as SignInReauthWindow, type SignInReauthText, type SignInReauthWindowProps } from "./SignInReauthWindow.svelte";
60
60
  export { default as SignInTile, type SignInTileCard, type SignInTileLabelKeys, type SignInTileProps, type SignInTileText } from "./SignInTile.svelte";
61
+ export { default as NotifyCard, type NotifyCardLabelKeys, type NotifyCardProps, type NotifyCardText } from "./NotifyCard.svelte";
61
62
  export { default as SkeletonRow, type SkeletonRowProps } from "./SkeletonRow.svelte";
62
63
  export { default as SubCard, type SubCardProps } from "./SubCard.svelte";
63
64
  export { default as Table, type TableColumn, type TableProps } from "./Table.svelte";
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ export { default as SignInCard } from "./SignInCard.svelte";
58
58
  export { default as SignInField } from "./SignInField.svelte";
59
59
  export { default as SignInReauthWindow } from "./SignInReauthWindow.svelte";
60
60
  export { default as SignInTile } from "./SignInTile.svelte";
61
+ export { default as NotifyCard } from "./NotifyCard.svelte";
61
62
  export { default as SkeletonRow } from "./SkeletonRow.svelte";
62
63
  export { default as SubCard } from "./SubCard.svelte";
63
64
  export { default as Table } from "./Table.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glimstone/svelte",
3
- "version": "4.9.0",
3
+ "version": "4.9.2",
4
4
  "description": "GlimStone's components for Svelte",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -28,6 +28,11 @@
28
28
  "svelte": "./dist/entries/combobox.js",
29
29
  "default": "./dist/entries/combobox.js"
30
30
  },
31
+ "./MultiSelect": {
32
+ "types": "./dist/entries/multiselect.d.ts",
33
+ "svelte": "./dist/entries/multiselect.js",
34
+ "default": "./dist/entries/multiselect.js"
35
+ },
31
36
  "./Slider": {
32
37
  "types": "./dist/entries/slider.d.ts",
33
38
  "svelte": "./dist/entries/slider.js",
@@ -141,7 +146,7 @@
141
146
  "build": "svelte-package -i src -o dist"
142
147
  },
143
148
  "dependencies": {
144
- "@glimstone/core": "4.9.0"
149
+ "@glimstone/core": "4.9.2"
145
150
  },
146
151
  "peerDependencies": {
147
152
  "@internationalized/date": "^3.12.4",