@glimstone/svelte 4.9.1 → 5.0.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.
- package/dist/AngleSlider.svelte +33 -9
- package/dist/AngleSlider.svelte.d.ts +1 -1
- package/dist/Avatar.svelte +1 -1
- package/dist/Badge.svelte +3 -7
- package/dist/Badge.svelte.d.ts +2 -5
- package/dist/Card.svelte +5 -1
- package/dist/Card.svelte.d.ts +3 -0
- package/dist/Chart.svelte +84 -0
- package/dist/Chart.svelte.d.ts +19 -0
- package/dist/ChartLegend.svelte +19 -0
- package/dist/ChartLegend.svelte.d.ts +7 -0
- package/dist/Checkbox.svelte +16 -3
- package/dist/ColorPicker.svelte +49 -4
- package/dist/ColorPicker.svelte.d.ts +2 -0
- package/dist/Combobox.svelte +12 -4
- package/dist/ConfirmDialog.svelte +8 -2
- package/dist/ConnectionRow.svelte +4 -1
- package/dist/ConnectionRow.svelte.d.ts +2 -0
- package/dist/ContextMenu.svelte +4 -2
- package/dist/ContextMenu.svelte.d.ts +2 -0
- package/dist/DatePicker.svelte +21 -11
- package/dist/FieldErrorLine.svelte +24 -0
- package/dist/FieldErrorLine.svelte.d.ts +7 -0
- package/dist/FieldRow.svelte +16 -4
- package/dist/FileUpload.svelte +14 -4
- package/dist/FileUpload.svelte.d.ts +2 -0
- package/dist/FortressPermissions.svelte +3 -1
- package/dist/HoverCard.svelte +34 -5
- package/dist/HoverCard.svelte.d.ts +12 -2
- package/dist/IconTipButton.svelte +6 -2
- package/dist/IconTipButton.svelte.d.ts +3 -0
- package/dist/InfoBubble.svelte +1 -1
- package/dist/ListRow.svelte +71 -6
- package/dist/ListRow.svelte.d.ts +17 -2
- package/dist/ListSelect.svelte +7 -2
- package/dist/ListTable.svelte +36 -16
- package/dist/ListTable.svelte.d.ts +5 -0
- package/dist/MenuSelect.svelte +11 -3
- package/dist/Meter.svelte +21 -3
- package/dist/Meter.svelte.d.ts +4 -0
- package/dist/MultiSelect.svelte +156 -0
- package/dist/MultiSelect.svelte.d.ts +20 -0
- package/dist/NotifyCard.svelte +1 -1
- package/dist/NumberField.svelte +2 -2
- package/dist/Pagination.svelte +15 -5
- package/dist/PasswordField.svelte +7 -6
- package/dist/PinInput.svelte +4 -2
- package/dist/Rating.svelte +10 -1
- package/dist/RevealEye.svelte +17 -0
- package/dist/RevealEye.svelte.d.ts +6 -0
- package/dist/SearchHit.svelte +10 -0
- package/dist/SearchHit.svelte.d.ts +7 -0
- package/dist/Selector.svelte +28 -4
- package/dist/Selector.svelte.d.ts +4 -3
- package/dist/SettingsNav.svelte +152 -0
- package/dist/SettingsNav.svelte.d.ts +46 -0
- package/dist/SignInTile.svelte +124 -114
- package/dist/SkeletonRow.svelte +8 -2
- package/dist/SkeletonRow.svelte.d.ts +4 -0
- package/dist/Slider.svelte +1 -0
- package/dist/Sparkline.svelte +24 -0
- package/dist/Sparkline.svelte.d.ts +11 -0
- package/dist/StatusSummary.svelte +55 -0
- package/dist/StatusSummary.svelte.d.ts +18 -0
- package/dist/SubCard.svelte +16 -16
- package/dist/SubCard.svelte.d.ts +3 -3
- package/dist/TextArea.svelte +13 -3
- package/dist/TextField.svelte +2 -2
- package/dist/TimeDial.svelte +74 -0
- package/dist/TimeDial.svelte.d.ts +13 -0
- package/dist/TimePicker.svelte +57 -0
- package/dist/TimePicker.svelte.d.ts +19 -0
- package/dist/TimeRangePicker.svelte +52 -0
- package/dist/TimeRangePicker.svelte.d.ts +16 -0
- package/dist/TimeShell.svelte +145 -0
- package/dist/TimeShell.svelte.d.ts +16 -0
- package/dist/Timer.svelte +6 -1
- package/dist/TipBubble.svelte +1 -1
- package/dist/ToastCard.svelte +7 -3
- package/dist/ToastCard.svelte.d.ts +2 -0
- package/dist/ToastViewport.svelte +6 -3
- package/dist/Toggle.svelte +3 -1
- package/dist/Tour.svelte +8 -2
- package/dist/Window.svelte +5 -3
- package/dist/Window.svelte.d.ts +3 -1
- package/dist/bubble.svelte.d.ts +12 -1
- package/dist/bubble.svelte.js +13 -5
- package/dist/engines.svelte.d.ts +7 -1
- package/dist/engines.svelte.js +13 -1
- package/dist/entries/multiselect.d.ts +1 -0
- package/dist/entries/multiselect.js +2 -0
- package/dist/glyphs.d.ts +3 -0
- package/dist/glyphs.js +3 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.js +9 -4
- package/package.json +7 -2
- package/dist/AboutCard.svelte +0 -116
- package/dist/AboutCard.svelte.d.ts +0 -40
- package/dist/DropdownListbox.svelte +0 -178
- package/dist/DropdownListbox.svelte.d.ts +0 -23
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import type { SettingsNavText } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface SettingsNavItem {
|
|
7
|
+
/** Stable id, handed back by onChange. */
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
/** The page's glyph, muted until the row is chosen or under the pointer. */
|
|
11
|
+
glyph?: Snippet;
|
|
12
|
+
/** The page's own address, so a modified click opens it beside the current one.
|
|
13
|
+
* Without one the row is a button. */
|
|
14
|
+
href?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SettingsNavGroup {
|
|
18
|
+
/** A short name in sentence case, such as "Sync". */
|
|
19
|
+
title: string;
|
|
20
|
+
items: SettingsNavItem[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SettingsNavProps extends Omit<HTMLAttributes<HTMLDivElement>, "onchange" | "children" | "class" | "style"> {
|
|
24
|
+
groups: SettingsNavGroup[];
|
|
25
|
+
/** The page that is showing. Without one a phone shows the list itself. */
|
|
26
|
+
value: string | null;
|
|
27
|
+
/** Called with the page a row opens, and with null from the back link. Left
|
|
28
|
+
* out, a row with an href is a plain link for the app's router. */
|
|
29
|
+
onChange?: (id: string | null) => void;
|
|
30
|
+
/** The area's name, such as "Settings": the list's accessible name and the
|
|
31
|
+
* back link's words. */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Where the back link leads, the list's own address. Without one it is a button. */
|
|
34
|
+
backHref?: string;
|
|
35
|
+
/** The person's order of the pages as ids, which the tiles follow with cards.
|
|
36
|
+
* Without one they stand in the order of the groups. */
|
|
37
|
+
order?: readonly string[] | null;
|
|
38
|
+
/** Hears the whole new order once a tile is dragged or moved with Alt and an
|
|
39
|
+
* arrow key. Without it, and always without cards, nothing moves. */
|
|
40
|
+
onReorder?: (order: string[]) => void;
|
|
41
|
+
/** The words the component brings along, in the app's language. */
|
|
42
|
+
text?: Partial<SettingsNavText>;
|
|
43
|
+
/** The page that is showing. */
|
|
44
|
+
children?: Snippet;
|
|
45
|
+
class?: string;
|
|
46
|
+
style?: string;
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
import { moveItem, opensInApp, reorderList, SETTINGS_NAV_TEXT, settingsNavTilesView, settingsNavView } from "@glimstone/core";
|
|
52
|
+
import { useLayout } from "./engines.svelte.js";
|
|
53
|
+
import { IconBack, IconForward } from "./glyphs.js";
|
|
54
|
+
import { css } from "./style.js";
|
|
55
|
+
|
|
56
|
+
// The pages of a settings area in a column of its own, and the page beside
|
|
57
|
+
// it: with cards a column of tiles in the person's order, without them a
|
|
58
|
+
// light list in titled groups. Below 36rem of its own width it becomes a
|
|
59
|
+
// phone's two steps, the pages and then a page with a back link to them.
|
|
60
|
+
// The other props of a <div> go to the root.
|
|
61
|
+
let { groups, value, onChange, label, backHref, order, onReorder, text, children, class: className = "", style, ...rest }: SettingsNavProps = $props();
|
|
62
|
+
|
|
63
|
+
const id = $props.id();
|
|
64
|
+
const layout = useLayout();
|
|
65
|
+
const cards = $derived(layout.current !== "flat");
|
|
66
|
+
const reorder = $derived(cards && !!onReorder);
|
|
67
|
+
const view = $derived(settingsNavView(groups, value));
|
|
68
|
+
const tiles = $derived(settingsNavTilesView(groups, value, order));
|
|
69
|
+
let nav: HTMLElement | undefined = $state();
|
|
70
|
+
|
|
71
|
+
$effect(() => {
|
|
72
|
+
const list = nav;
|
|
73
|
+
if (!reorder || !list) return;
|
|
74
|
+
return reorderList(list, {
|
|
75
|
+
items: () => [...list.children] as HTMLElement[],
|
|
76
|
+
onMove: (from, to) => onReorder?.(moveItem(tiles.tiles.map((t) => t.item.id), from, to)),
|
|
77
|
+
moved: (from, to, count) => ({ ...SETTINGS_NAV_TEXT, ...text }).moved(tiles.tiles[from]?.item.label ?? "", to + 1, count),
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
function open(e: MouseEvent, next: string | null, link: boolean) {
|
|
82
|
+
if (!onChange || (link && !opensInApp(e))) return;
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
if (next !== value) onChange(next);
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<div data-glim="SettingsNav" {...rest} data-root={view.root ? "" : undefined} class={`glim-settings ${className}`.trim()} {style}>
|
|
89
|
+
<nav
|
|
90
|
+
bind:this={nav}
|
|
91
|
+
class="glim-settings-nav"
|
|
92
|
+
class:glim-settings-tiles={cards}
|
|
93
|
+
class:glim-settings-tiles--reorder={reorder}
|
|
94
|
+
aria-label={label}
|
|
95
|
+
>
|
|
96
|
+
{#if cards}
|
|
97
|
+
{#each tiles.tiles as tile (tile.item.id)}
|
|
98
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
99
|
+
<svelte:element
|
|
100
|
+
this={tile.item.href ? "a" : "button"}
|
|
101
|
+
href={tile.item.href}
|
|
102
|
+
type={tile.item.href ? undefined : "button"}
|
|
103
|
+
class={tile.className}
|
|
104
|
+
style={css(tile.style)}
|
|
105
|
+
aria-current={tile.active ? "page" : undefined}
|
|
106
|
+
aria-keyshortcuts={reorder ? "Alt+ArrowUp Alt+ArrowDown" : undefined}
|
|
107
|
+
onclick={(e: MouseEvent) => open(e, tile.item.id, !!tile.item.href)}
|
|
108
|
+
>
|
|
109
|
+
{@render tile.item.glyph?.()}
|
|
110
|
+
<span class="glim-sel-tile-label">{tile.item.label}</span>
|
|
111
|
+
<span class="glim-settings-chevron" aria-hidden="true">{@render IconForward()}</span>
|
|
112
|
+
</svelte:element>
|
|
113
|
+
{/each}
|
|
114
|
+
{:else}
|
|
115
|
+
{#each view.groups as g, i (g.title)}
|
|
116
|
+
<div class="glim-settings-group" role="group" aria-labelledby={`${id}-${i}`}>
|
|
117
|
+
<div id={`${id}-${i}`} class="glim-settings-group-title">{g.title}</div>
|
|
118
|
+
{#each g.rows as row (row.item.id)}
|
|
119
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
120
|
+
<svelte:element
|
|
121
|
+
this={row.item.href ? "a" : "button"}
|
|
122
|
+
href={row.item.href}
|
|
123
|
+
type={row.item.href ? undefined : "button"}
|
|
124
|
+
class={row.className}
|
|
125
|
+
style={css(row.style)}
|
|
126
|
+
aria-current={row.active ? "page" : undefined}
|
|
127
|
+
onclick={(e: MouseEvent) => open(e, row.item.id, !!row.item.href)}
|
|
128
|
+
>
|
|
129
|
+
{@render row.item.glyph?.()}
|
|
130
|
+
<span class="glim-nav-label">{row.item.label}</span>
|
|
131
|
+
<span class="glim-settings-chevron" aria-hidden="true">{@render IconForward()}</span>
|
|
132
|
+
</svelte:element>
|
|
133
|
+
{/each}
|
|
134
|
+
</div>
|
|
135
|
+
{/each}
|
|
136
|
+
{/if}
|
|
137
|
+
</nav>
|
|
138
|
+
<div class="glim-settings-page">
|
|
139
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
140
|
+
<svelte:element
|
|
141
|
+
this={backHref ? "a" : "button"}
|
|
142
|
+
href={backHref}
|
|
143
|
+
type={backHref ? undefined : "button"}
|
|
144
|
+
class="glim-settings-back"
|
|
145
|
+
onclick={(e: MouseEvent) => open(e, null, !!backHref)}
|
|
146
|
+
>
|
|
147
|
+
{@render IconBack()}
|
|
148
|
+
<span>{label}</span>
|
|
149
|
+
</svelte:element>
|
|
150
|
+
{@render children?.()}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { SettingsNavText } from "@glimstone/core";
|
|
4
|
+
export interface SettingsNavItem {
|
|
5
|
+
/** Stable id, handed back by onChange. */
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
/** The page's glyph, muted until the row is chosen or under the pointer. */
|
|
9
|
+
glyph?: Snippet;
|
|
10
|
+
/** The page's own address, so a modified click opens it beside the current one.
|
|
11
|
+
* Without one the row is a button. */
|
|
12
|
+
href?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SettingsNavGroup {
|
|
15
|
+
/** A short name in sentence case, such as "Sync". */
|
|
16
|
+
title: string;
|
|
17
|
+
items: SettingsNavItem[];
|
|
18
|
+
}
|
|
19
|
+
export interface SettingsNavProps extends Omit<HTMLAttributes<HTMLDivElement>, "onchange" | "children" | "class" | "style"> {
|
|
20
|
+
groups: SettingsNavGroup[];
|
|
21
|
+
/** The page that is showing. Without one a phone shows the list itself. */
|
|
22
|
+
value: string | null;
|
|
23
|
+
/** Called with the page a row opens, and with null from the back link. Left
|
|
24
|
+
* out, a row with an href is a plain link for the app's router. */
|
|
25
|
+
onChange?: (id: string | null) => void;
|
|
26
|
+
/** The area's name, such as "Settings": the list's accessible name and the
|
|
27
|
+
* back link's words. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Where the back link leads, the list's own address. Without one it is a button. */
|
|
30
|
+
backHref?: string;
|
|
31
|
+
/** The person's order of the pages as ids, which the tiles follow with cards.
|
|
32
|
+
* Without one they stand in the order of the groups. */
|
|
33
|
+
order?: readonly string[] | null;
|
|
34
|
+
/** Hears the whole new order once a tile is dragged or moved with Alt and an
|
|
35
|
+
* arrow key. Without it, and always without cards, nothing moves. */
|
|
36
|
+
onReorder?: (order: string[]) => void;
|
|
37
|
+
/** The words the component brings along, in the app's language. */
|
|
38
|
+
text?: Partial<SettingsNavText>;
|
|
39
|
+
/** The page that is showing. */
|
|
40
|
+
children?: Snippet;
|
|
41
|
+
class?: string;
|
|
42
|
+
style?: string;
|
|
43
|
+
}
|
|
44
|
+
declare const SettingsNav: import("svelte").Component<SettingsNavProps, {}, "">;
|
|
45
|
+
type SettingsNav = ReturnType<typeof SettingsNav>;
|
|
46
|
+
export default SettingsNav;
|
package/dist/SignInTile.svelte
CHANGED
|
@@ -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,
|
|
@@ -51,7 +50,9 @@
|
|
|
51
50
|
signInServiceStatus,
|
|
52
51
|
signInTileCards,
|
|
53
52
|
signInWhen,
|
|
53
|
+
signInCardGlyphKey,
|
|
54
54
|
signInCardNotice,
|
|
55
|
+
signInPasswordAsks,
|
|
55
56
|
signInPasswordElsewhere,
|
|
56
57
|
signInShortHint,
|
|
57
58
|
tokenFacts,
|
|
@@ -61,18 +62,16 @@
|
|
|
61
62
|
import Badge from "./Badge.svelte";
|
|
62
63
|
import Button from "./Button.svelte";
|
|
63
64
|
import Card from "./Card.svelte";
|
|
64
|
-
import
|
|
65
|
+
import ConnectionRow from "./ConnectionRow.svelte";
|
|
65
66
|
import EmptyState from "./EmptyState.svelte";
|
|
66
67
|
import FieldRow from "./FieldRow.svelte";
|
|
67
68
|
import FieldRowGroup from "./FieldRowGroup.svelte";
|
|
68
|
-
import GlyphTile from "./GlyphTile.svelte";
|
|
69
|
-
import ListRow from "./ListRow.svelte";
|
|
70
69
|
import PasswordField from "./PasswordField.svelte";
|
|
71
70
|
import SignInTileWindow from "./SignInTileWindow.svelte";
|
|
72
71
|
import Toggle from "./Toggle.svelte";
|
|
73
72
|
import UnavailableNotice from "./UnavailableNotice.svelte";
|
|
74
73
|
import { useConfirm } from "./confirm.svelte.js";
|
|
75
|
-
import { glyphFor, IconCancel
|
|
74
|
+
import { glyphFor, IconCancel } from "./glyphs.js";
|
|
76
75
|
|
|
77
76
|
// The settings tile "Sign-in" ("The sign-in tile" in the design language):
|
|
78
77
|
// the password, the question before sensitive changes, two-factor, passkeys,
|
|
@@ -125,10 +124,13 @@
|
|
|
125
124
|
const eye = $derived({ show: text.show, hide: text.hide, confirm: text.confirmPassword, mismatch: text.mismatch });
|
|
126
125
|
const err = (field: SignInTileField) => (s.invalid?.field === field ? s.invalid.message : undefined);
|
|
127
126
|
const shown = $derived(signInTileCards(s, cards));
|
|
128
|
-
const notice = (card:
|
|
127
|
+
const notice = (card: Exclude<SignInTileCard, "password">) => signInCardNotice(text, s, card);
|
|
129
128
|
const elsewhere = $derived(signInPasswordElsewhere(text, s));
|
|
130
129
|
const had = $derived(!!s.me?.password);
|
|
130
|
+
const asks = $derived(signInPasswordAsks(s, cards) && !s.editing);
|
|
131
131
|
const glyph = (key: string) => glyphFor(key)!;
|
|
132
|
+
// The words of a row's own buttons: a service's test, edit and remove, and a passkey's rename in place of edit.
|
|
133
|
+
const rowText = (edit = text.services.edit) => ({ test: text.services.test, edit, remove: text.remove });
|
|
132
134
|
|
|
133
135
|
function remove(what: SignInTileRemoval, id: string, name: string) {
|
|
134
136
|
const q = removalQuestion(text, what, name);
|
|
@@ -138,8 +140,16 @@
|
|
|
138
140
|
}
|
|
139
141
|
</script>
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
<!-- A card that waits for a password draws the empty state its list would, with the card's glyph. -->
|
|
144
|
+
{#snippet cardNotice(card: Exclude<SignInTileCard, "password">)}
|
|
145
|
+
{@const n = notice(card)!}
|
|
146
|
+
<EmptyState nested glyph={glyph(keys[signInCardGlyphKey(card)])} title={n.title} />
|
|
147
|
+
{/snippet}
|
|
148
|
+
|
|
149
|
+
{#snippet askPasswordRow()}
|
|
150
|
+
<FieldRow label={text.askPassword.label} hint={text.askPassword.when}>
|
|
151
|
+
<Toggle bind:checked={() => !!s.settings?.askPassword, (on) => void flow.setAskPassword(on)} data-signin-tile="ask-password" />
|
|
152
|
+
</FieldRow>
|
|
143
153
|
{/snippet}
|
|
144
154
|
|
|
145
155
|
<div data-glim="SignInTile" class="glim-signin-tile">
|
|
@@ -149,10 +159,20 @@
|
|
|
149
159
|
{@const t = text.password}
|
|
150
160
|
<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
161
|
{#if elsewhere}
|
|
152
|
-
<
|
|
162
|
+
<div class="glim-signin-tile-body">
|
|
163
|
+
<p class="glim-signin-tile-text">{elsewhere}</p>
|
|
164
|
+
{#if asks}{@render askPasswordRow()}{/if}
|
|
165
|
+
</div>
|
|
153
166
|
{:else}
|
|
154
167
|
<div class="glim-signin-tile-body">
|
|
155
|
-
|
|
168
|
+
{#if had}
|
|
169
|
+
<FieldRowGroup>
|
|
170
|
+
<FieldRow label={t.state} value={t.set} />
|
|
171
|
+
{#if asks}{@render askPasswordRow()}{/if}
|
|
172
|
+
</FieldRowGroup>
|
|
173
|
+
{:else if !s.editing}
|
|
174
|
+
<EmptyState nested glyph={glyph(keys.setPassword)} title={t.none} />
|
|
175
|
+
{/if}
|
|
156
176
|
{#if s.editing}
|
|
157
177
|
<FieldRowGroup>
|
|
158
178
|
{#if had}
|
|
@@ -203,11 +223,9 @@
|
|
|
203
223
|
{@const t = text.askPassword}
|
|
204
224
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="askPassword">
|
|
205
225
|
{#if notice("askPassword")}
|
|
206
|
-
{@render cardNotice(
|
|
226
|
+
{@render cardNotice("askPassword")}
|
|
207
227
|
{:else}
|
|
208
|
-
|
|
209
|
-
<Toggle bind:checked={() => !!s.settings?.askPassword, (on) => void flow.setAskPassword(on)} data-signin-tile="ask-password" />
|
|
210
|
-
</FieldRow>
|
|
228
|
+
{@render askPasswordRow()}
|
|
211
229
|
{/if}
|
|
212
230
|
</Card>
|
|
213
231
|
{:else if c === "twoFactor"}
|
|
@@ -215,13 +233,17 @@
|
|
|
215
233
|
{@const on = !!s.me?.twoFactor}
|
|
216
234
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="twoFactor">
|
|
217
235
|
{#if notice("twoFactor")}
|
|
218
|
-
{@render cardNotice(
|
|
236
|
+
{@render cardNotice("twoFactor")}
|
|
219
237
|
{:else}
|
|
220
238
|
<div class="glim-signin-tile-body">
|
|
221
|
-
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
239
|
+
{#if on}
|
|
240
|
+
<FieldRowGroup>
|
|
241
|
+
<FieldRow label={t.state} value={t.on} tone="ok" />
|
|
242
|
+
<FieldRow label={t.codesLeft} value={plural(lang, t.codesLeftValue, s.me?.recoveryLeft ?? 0)} />
|
|
243
|
+
</FieldRowGroup>
|
|
244
|
+
{:else}
|
|
245
|
+
<EmptyState nested glyph={glyph(keys.setUp)} title={t.none} />
|
|
246
|
+
{/if}
|
|
225
247
|
<div class="glim-signin-tile-foot">
|
|
226
248
|
{#if on}
|
|
227
249
|
<Button label={t.newCodes} labelKey={keys.newCodes} busy={s.busy === "two-factor-codes"} data-signin-tile="two-factor-codes" onClick={() => void flow.newCodes()} />
|
|
@@ -238,24 +260,29 @@
|
|
|
238
260
|
{@const here = s.passkeysHere}
|
|
239
261
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="passkeys">
|
|
240
262
|
{#if notice("passkeys")}
|
|
241
|
-
{@render cardNotice(
|
|
263
|
+
{@render cardNotice("passkeys")}
|
|
242
264
|
{:else}
|
|
243
265
|
<div class="glim-signin-tile-body">
|
|
244
266
|
{#if !here}<UnavailableNotice title={t.unavailableTitle} reason={t.unavailable} />{/if}
|
|
245
267
|
{#if s.passkeys.length > 0}
|
|
246
|
-
<div class="glim-
|
|
268
|
+
<div class="glim-signin-tile-rows">
|
|
247
269
|
{#each s.passkeys as p (p.id)}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
{
|
|
254
|
-
|
|
270
|
+
{@const facts = passkeyFacts(text, p, when)}
|
|
271
|
+
<ConnectionRow
|
|
272
|
+
name={p.name}
|
|
273
|
+
mark={glyph(keys.passkey)}
|
|
274
|
+
status={facts.added}
|
|
275
|
+
text={rowText(t.rename)}
|
|
276
|
+
labelKeys={{ edit: keys.rename, remove: keys.remove }}
|
|
277
|
+
onEdit={() => flow.askRenamePasskey(p.id)}
|
|
278
|
+
onRemove={() => remove("passkey", p.id, p.name)}
|
|
279
|
+
>
|
|
280
|
+
<p class="glim-connection-status">{facts.more}</p>
|
|
281
|
+
</ConnectionRow>
|
|
255
282
|
{/each}
|
|
256
283
|
</div>
|
|
257
284
|
{:else if here}
|
|
258
|
-
<EmptyState nested glyph={glyph(keys.passkey)} title={t.none}
|
|
285
|
+
<EmptyState nested glyph={glyph(keys.passkey)} title={t.none} />
|
|
259
286
|
{/if}
|
|
260
287
|
{#if here}
|
|
261
288
|
<div class="glim-signin-tile-foot">
|
|
@@ -269,32 +296,20 @@
|
|
|
269
296
|
{@const t = text.sessions}
|
|
270
297
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="sessions">
|
|
271
298
|
{#if notice("sessions")}
|
|
272
|
-
{@render cardNotice(
|
|
299
|
+
{@render cardNotice("sessions")}
|
|
273
300
|
{:else}
|
|
274
301
|
<div class="glim-signin-tile-body">
|
|
275
|
-
<div class="glim-
|
|
302
|
+
<div class="glim-signin-tile-rows">
|
|
276
303
|
{#each s.sessions as x (x.id)}
|
|
277
304
|
{@const device = signInDevice(x.agent, t)}
|
|
278
|
-
{#snippet tile()}<GlyphTile glyph={glyph(device.phone ? keys.phone : keys.laptop)} />{/snippet}
|
|
279
305
|
{#snippet badges()}<Badge size="small" tone="active">{t.current}</Badge>{/snippet}
|
|
280
|
-
|
|
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
|
|
306
|
+
<ConnectionRow
|
|
293
307
|
name={device.name}
|
|
294
|
-
|
|
295
|
-
{
|
|
308
|
+
mark={glyph(device.phone ? keys.phone : keys.laptop)}
|
|
309
|
+
status={sessionFacts(text, x, s.serviceLabels, when).join(" · ")}
|
|
296
310
|
badges={x.current ? badges : undefined}
|
|
297
|
-
|
|
311
|
+
text={rowText()}
|
|
312
|
+
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
313
|
/>
|
|
299
314
|
{/each}
|
|
300
315
|
</div>
|
|
@@ -316,24 +331,27 @@
|
|
|
316
331
|
{@const t = text.tokens}
|
|
317
332
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="tokens">
|
|
318
333
|
{#if notice("tokens")}
|
|
319
|
-
{@render cardNotice(
|
|
334
|
+
{@render cardNotice("tokens")}
|
|
320
335
|
{:else}
|
|
321
336
|
<div class="glim-signin-tile-body">
|
|
322
337
|
{#if s.tokens.length > 0}
|
|
323
|
-
<div class="glim-
|
|
338
|
+
<div class="glim-signin-tile-rows">
|
|
324
339
|
{#each s.tokens as k (k.id)}
|
|
325
|
-
{#snippet tile()}<GlyphTile glyph={glyph(keys.token)} />{/snippet}
|
|
326
340
|
{#snippet scopes()}
|
|
327
341
|
{#each k.scopes as scope (scope)}<Badge size="small">{t.scopes[scope] ?? scope}</Badge>{/each}
|
|
328
342
|
{/snippet}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
343
|
+
<ConnectionRow
|
|
344
|
+
name={k.name}
|
|
345
|
+
mark={glyph(keys.token)}
|
|
346
|
+
status={tokenFacts(text, k, when).join(" · ")}
|
|
347
|
+
badges={k.scopes.length > 0 ? scopes : undefined}
|
|
348
|
+
text={rowText()}
|
|
349
|
+
actions={[{ id: "revoke", label: t.revoke, labelKey: keys.revoke, onClick: () => remove("token", k.id, k.name) }]}
|
|
350
|
+
/>
|
|
333
351
|
{/each}
|
|
334
352
|
</div>
|
|
335
353
|
{:else}
|
|
336
|
-
<EmptyState nested glyph={glyph(keys.token)} title={t.none}
|
|
354
|
+
<EmptyState nested glyph={glyph(keys.token)} title={t.none} />
|
|
337
355
|
{/if}
|
|
338
356
|
<div class="glim-signin-tile-foot">
|
|
339
357
|
<Button label={t.create} labelKey={keys.createToken} data-signin-tile="token-ask" onClick={flow.askToken} />
|
|
@@ -345,52 +363,44 @@
|
|
|
345
363
|
{@const t = text.services}
|
|
346
364
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="services">
|
|
347
365
|
{#if notice("services")}
|
|
348
|
-
{@render cardNotice(
|
|
366
|
+
{@render cardNotice("services")}
|
|
349
367
|
{:else}
|
|
350
368
|
<div class="glim-signin-tile-body">
|
|
351
369
|
{#if (s.services?.length ?? 0) > 0}
|
|
352
|
-
<div class="glim-
|
|
370
|
+
<div class="glim-signin-tile-rows">
|
|
353
371
|
{#each s.services ?? [] as x (x.id)}
|
|
354
372
|
{@const badge = signInServiceBadge(text, x)}
|
|
355
373
|
{@const label = signInServiceLabel(x, providers, text)}
|
|
356
|
-
{@const
|
|
357
|
-
{#snippet
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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>
|
|
374
|
+
{@const mine = !x.fromConfig}
|
|
375
|
+
{#snippet stands()}{#if badge}<Badge size="small" tone={badge.tone}>{badge.label}</Badge>{/if}{/snippet}
|
|
376
|
+
{#snippet shown()}
|
|
377
|
+
<Toggle
|
|
378
|
+
bind:checked={() => x.on, (on) => void flow.setServiceOn(x.id, on)}
|
|
379
|
+
label={t.show}
|
|
380
|
+
hideLabel
|
|
381
|
+
refused={!x.tested || x.paused ? t.mustTest : undefined}
|
|
382
|
+
data-signin-tile={`service-on-${x.id}`}
|
|
383
|
+
/>
|
|
384
|
+
{/snippet}
|
|
385
|
+
<ConnectionRow
|
|
386
|
+
name={label.name}
|
|
387
|
+
mark={label.mark ?? glyph(keys.service)}
|
|
388
|
+
status={signInServiceStatus(text, x, when)}
|
|
389
|
+
badges={badge ? stands : undefined}
|
|
390
|
+
data-signin-service={x.provider}
|
|
391
|
+
control={mine ? shown : undefined}
|
|
392
|
+
text={rowText()}
|
|
393
|
+
labelKeys={{ test: keys.test, edit: keys.edit, remove: keys.remove }}
|
|
394
|
+
actions={signInServiceActions(text, x, s, keys.turnOn, (id) => void flow.confirmService(id))}
|
|
395
|
+
test={s.rowTests[x.id]}
|
|
396
|
+
onTest={mine ? () => void flow.testService(x.id) : undefined}
|
|
397
|
+
onEdit={mine ? () => flow.editService(x.id) : undefined}
|
|
398
|
+
onRemove={mine ? () => remove("service", x.id, label.name) : undefined}
|
|
399
|
+
/>
|
|
392
400
|
{/each}
|
|
393
401
|
</div>
|
|
402
|
+
{:else}
|
|
403
|
+
<EmptyState nested glyph={glyph(keys.service)} title={t.none} />
|
|
394
404
|
{/if}
|
|
395
405
|
<div class="glim-signin-tile-foot">
|
|
396
406
|
<Button label={t.add} labelKey={keys.addService} data-signin-tile="service-pick" onClick={flow.pickService} />
|
|
@@ -402,34 +412,34 @@
|
|
|
402
412
|
{@const t = text.accounts}
|
|
403
413
|
<Card title={t.title} hint={t.hint} hueIndex={hue} data-signin-card="accounts">
|
|
404
414
|
{#if notice("accounts")}
|
|
405
|
-
{@render cardNotice(
|
|
415
|
+
{@render cardNotice("accounts")}
|
|
406
416
|
{:else}
|
|
407
|
-
<div class="glim-
|
|
417
|
+
<div class="glim-signin-tile-rows">
|
|
408
418
|
{#each s.accounts ?? [] as a (a.id)}
|
|
409
|
-
{
|
|
419
|
+
{@const mine = a.owner || a.id === s.me?.account}
|
|
410
420
|
{#snippet badges()}
|
|
411
421
|
{#if a.owner}<Badge size="small">{t.owner}</Badge>{/if}
|
|
412
422
|
{#if a.blocked}<Badge size="small" tone="warn">{t.blocked}</Badge>{/if}
|
|
413
423
|
{/snippet}
|
|
414
|
-
|
|
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
|
|
424
|
+
<ConnectionRow
|
|
428
425
|
name={a.name}
|
|
429
|
-
|
|
430
|
-
{
|
|
426
|
+
mark={glyph(keys.account)}
|
|
427
|
+
status={accountFacts(text, a, s.serviceLabels, when).join(" · ")}
|
|
431
428
|
badges={a.owner || a.blocked ? badges : undefined}
|
|
432
|
-
|
|
429
|
+
text={rowText()}
|
|
430
|
+
labelKeys={{ remove: keys.remove }}
|
|
431
|
+
actions={mine
|
|
432
|
+
? []
|
|
433
|
+
: [
|
|
434
|
+
{
|
|
435
|
+
id: "block",
|
|
436
|
+
label: a.blocked ? t.unblock : t.block,
|
|
437
|
+
labelKey: a.blocked ? keys.unblock : keys.block,
|
|
438
|
+
busy: s.busy === `account-block-${a.id}`,
|
|
439
|
+
onClick: () => void flow.block(a.id, !a.blocked),
|
|
440
|
+
},
|
|
441
|
+
]}
|
|
442
|
+
onRemove={mine ? undefined : () => remove("account", a.id, a.name)}
|
|
433
443
|
/>
|
|
434
444
|
{/each}
|
|
435
445
|
</div>
|
package/dist/SkeletonRow.svelte
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
tile?: boolean;
|
|
7
7
|
/** The badge at the row's end, for a list whose rows have one. */
|
|
8
8
|
badge?: boolean;
|
|
9
|
+
/** A bar in the value column, for a list whose rows carry a `value`. */
|
|
10
|
+
value?: boolean;
|
|
11
|
+
/** How many row buttons to keep room for, so the value bar stands where the real rows put their figures. */
|
|
12
|
+
actions?: number;
|
|
9
13
|
class?: string;
|
|
10
14
|
}
|
|
11
15
|
</script>
|
|
@@ -18,12 +22,14 @@
|
|
|
18
22
|
// when the rows arrive. It shows only after BUSY_DELAY. The list around it
|
|
19
23
|
// carries aria-busy and says what is loading; the row itself is hidden from
|
|
20
24
|
// assistive technology.
|
|
21
|
-
let { delay, tile = true, badge = true, class: className }: SkeletonRowProps = $props();
|
|
22
|
-
const view = $derived(skeletonRowView({ delay, tile, badge }));
|
|
25
|
+
let { delay, tile = true, badge = true, value = false, actions = 0, class: className }: SkeletonRowProps = $props();
|
|
26
|
+
const view = $derived(skeletonRowView({ delay, tile, badge, value, actions }));
|
|
23
27
|
</script>
|
|
24
28
|
|
|
25
29
|
<div data-glim="SkeletonRow" aria-hidden="true" class={className ? `${view.className} ${className}` : view.className} style={css(view.style)}>
|
|
26
30
|
{#if view.tile}<span class="glim-skeleton-block glim-skeleton-tile"></span>{/if}
|
|
27
31
|
<span class="glim-skeleton-block glim-skeleton-name"></span>
|
|
28
32
|
{#if view.badge}<span class="glim-skeleton-block glim-skeleton-badge"></span>{/if}
|
|
33
|
+
{#if view.value}<span class="glim-skeleton-block glim-skeleton-value"></span>{/if}
|
|
34
|
+
{#if view.actions > 0}<span class="glim-skeleton-actions"></span>{/if}
|
|
29
35
|
</div>
|
|
@@ -5,6 +5,10 @@ export interface SkeletonRowProps {
|
|
|
5
5
|
tile?: boolean;
|
|
6
6
|
/** The badge at the row's end, for a list whose rows have one. */
|
|
7
7
|
badge?: boolean;
|
|
8
|
+
/** A bar in the value column, for a list whose rows carry a `value`. */
|
|
9
|
+
value?: boolean;
|
|
10
|
+
/** How many row buttons to keep room for, so the value bar stands where the real rows put their figures. */
|
|
11
|
+
actions?: number;
|
|
8
12
|
class?: string;
|
|
9
13
|
}
|
|
10
14
|
declare const SkeletonRow: import("svelte").Component<SkeletonRowProps, {}, "">;
|
package/dist/Slider.svelte
CHANGED
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
</div>
|
|
54
54
|
{#each api.value as _, index (index)}
|
|
55
55
|
<div {...api.getThumbProps({ index })} class="glim-slider-thumb">
|
|
56
|
+
<span class="glim-slider-bubble" aria-hidden="true">{format(api.value[index]!)}</span>
|
|
56
57
|
<input {...api.getHiddenInputProps({ index })} />
|
|
57
58
|
</div>
|
|
58
59
|
{/each}
|