@glimstone/svelte 4.5.5 → 4.5.7
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/PickerWindow.svelte +33 -10
- package/dist/PickerWindow.svelte.d.ts +3 -1
- package/dist/ReadmeButton.svelte +25 -4
- package/dist/ReadmeButton.svelte.d.ts +2 -0
- package/dist/Window.svelte +5 -1
- package/dist/Window.svelte.d.ts +3 -0
- package/dist/WindowFootRow.svelte +10 -1
- package/dist/WindowFootRow.svelte.d.ts +7 -0
- package/dist/glyphs.d.ts +1 -0
- package/dist/glyphs.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/PickerWindow.svelte
CHANGED
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
actions?: WindowAction[];
|
|
25
25
|
/** Back from the form to the tiles, with the search as it was. */
|
|
26
26
|
onBack?: () => void;
|
|
27
|
-
/**
|
|
27
|
+
/** A quiet line at the start of the foot, such as the verdict of a test. */
|
|
28
|
+
start?: string | Snippet;
|
|
29
|
+
/** Called for every way out: the foot, Escape and, while the tiles show, a press beside the window. */
|
|
28
30
|
onClose: () => void;
|
|
29
31
|
}
|
|
30
32
|
</script>
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
holdPickHeight,
|
|
37
39
|
isTileMark,
|
|
38
40
|
pageLocale,
|
|
41
|
+
pickerHue,
|
|
39
42
|
pickSearchKey,
|
|
40
43
|
pickSections,
|
|
41
44
|
pickTileKey,
|
|
@@ -43,7 +46,9 @@
|
|
|
43
46
|
windowFocusTarget,
|
|
44
47
|
} from "@glimstone/core";
|
|
45
48
|
import BrandMark from "./BrandMark.svelte";
|
|
46
|
-
import
|
|
49
|
+
import GlyphField from "./GlyphField.svelte";
|
|
50
|
+
import { IconBack, IconClose, IconSearch } from "./glyphs.js";
|
|
51
|
+
import IconButton from "./IconButton.svelte";
|
|
47
52
|
import InfoBubble from "./InfoBubble.svelte";
|
|
48
53
|
import ReadmeButton from "./ReadmeButton.svelte";
|
|
49
54
|
import { css } from "./style.js";
|
|
@@ -56,11 +61,12 @@
|
|
|
56
61
|
// follows: it closes the window, or passes the picked tile's form as
|
|
57
62
|
// children, which takes the tiles' place with Back and the form's actions in
|
|
58
63
|
// the foot.
|
|
59
|
-
let { title, hint, items, groups = [], text, onPick, children, actions = [], onBack, onClose }: PickerWindowProps = $props();
|
|
64
|
+
let { title, hint, items, groups = [], text, onPick, children, actions = [], onBack, start, onClose }: PickerWindowProps = $props();
|
|
60
65
|
|
|
61
66
|
let query = $state("");
|
|
67
|
+
const hue = pickerHue();
|
|
62
68
|
let card: HTMLElement | null = $state(null);
|
|
63
|
-
let search: HTMLInputElement |
|
|
69
|
+
let search: HTMLInputElement | null = $state(null);
|
|
64
70
|
let scroll: HTMLDivElement | undefined = $state();
|
|
65
71
|
const form = $derived(!!children);
|
|
66
72
|
$effect(() => {
|
|
@@ -92,31 +98,47 @@
|
|
|
92
98
|
}
|
|
93
99
|
</script>
|
|
94
100
|
|
|
101
|
+
{#snippet clearButton()}
|
|
102
|
+
<IconButton
|
|
103
|
+
tip={text.clear}
|
|
104
|
+
glyph={IconClose}
|
|
105
|
+
onclick={() => {
|
|
106
|
+
query = "";
|
|
107
|
+
search?.focus();
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
{/snippet}
|
|
111
|
+
|
|
95
112
|
{#snippet notch()}{title}<InfoBubble tip={hint ?? ""} onAccent />{/snippet}
|
|
96
113
|
|
|
97
114
|
<Window
|
|
98
115
|
data-glim="PickerWindow"
|
|
99
116
|
{title}
|
|
100
117
|
drawn={hint ? notch : undefined}
|
|
101
|
-
class="glim-pick-window"
|
|
118
|
+
class={["glim-pick-window", form && "glim-pick-window--form", hue && "glim-hue"].filter(Boolean).join(" ")}
|
|
119
|
+
style={css(hue ?? undefined)}
|
|
102
120
|
bind:ref={card}
|
|
103
121
|
text={{ cancel: text.cancel, close: text.close }}
|
|
122
|
+
{start}
|
|
104
123
|
actions={form ? [back, ...actions] : [{ label: text.close, labelKey: "common.close", glyph: IconClose, wayOut: true }]}
|
|
124
|
+
closeOnBackdrop={!form}
|
|
105
125
|
{onClose}
|
|
106
126
|
>
|
|
107
127
|
{#if children}
|
|
108
128
|
{@render children()}
|
|
109
129
|
{:else}
|
|
110
|
-
<
|
|
111
|
-
bind:
|
|
130
|
+
<GlyphField
|
|
131
|
+
bind:ref={search}
|
|
112
132
|
bind:value={query}
|
|
113
|
-
class="glim-
|
|
133
|
+
class="glim-pick-search"
|
|
134
|
+
glyph={IconSearch}
|
|
114
135
|
type="search"
|
|
115
|
-
|
|
136
|
+
label={text.search}
|
|
116
137
|
placeholder={text.search}
|
|
117
138
|
spellcheck="false"
|
|
118
139
|
autocomplete="off"
|
|
119
140
|
onkeydown={(e) => used(e, pickSearchKey(e.key, query, scroll ?? null, () => (query = "")))}
|
|
141
|
+
after={query ? clearButton : undefined}
|
|
120
142
|
/>
|
|
121
143
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
122
144
|
<div bind:this={scroll} class="glim-pick-scroll" onkeydown={onTileKey}>
|
|
@@ -132,10 +154,11 @@
|
|
|
132
154
|
<li style={css(pickTileStyle(item.mark))}>
|
|
133
155
|
<ReadmeButton
|
|
134
156
|
brand="house"
|
|
135
|
-
parts={[{ name: item.label, onClick: () => onPick(item.id) }]}
|
|
157
|
+
parts={[{ name: item.label, sub: item.sub, onClick: () => onPick(item.id) }]}
|
|
136
158
|
mark={isTileMark(item.mark) ? brand : (item.mark as Snippet | undefined)}
|
|
137
159
|
markClass={isTileMark(item.mark) ? undefined : "glim-house-mark"}
|
|
138
160
|
hint={item.hint}
|
|
161
|
+
tip={item.tip}
|
|
139
162
|
/>
|
|
140
163
|
</li>
|
|
141
164
|
{/each}
|
|
@@ -20,7 +20,9 @@ export interface PickerWindowProps {
|
|
|
20
20
|
actions?: WindowAction[];
|
|
21
21
|
/** Back from the form to the tiles, with the search as it was. */
|
|
22
22
|
onBack?: () => void;
|
|
23
|
-
/**
|
|
23
|
+
/** A quiet line at the start of the foot, such as the verdict of a test. */
|
|
24
|
+
start?: string | Snippet;
|
|
25
|
+
/** Called for every way out: the foot, Escape and, while the tiles show, a press beside the window. */
|
|
24
26
|
onClose: () => void;
|
|
25
27
|
}
|
|
26
28
|
declare const PickerWindow: import("svelte").Component<PickerWindowProps, {}, "">;
|
package/dist/ReadmeButton.svelte
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
art?: Snippet;
|
|
18
18
|
/** The "(i)" at the end of the unit, for what the name cannot say. */
|
|
19
19
|
hint?: string;
|
|
20
|
+
/** A few words in the first part's bubble, for a name that needs no (i). */
|
|
21
|
+
tip?: string;
|
|
20
22
|
/** Holds the second lines in view while one reports what it did, such as "Copied". */
|
|
21
23
|
note?: boolean;
|
|
22
24
|
/** The second line of a unit whose first part has neither `href` nor `onClick`. */
|
|
@@ -29,7 +31,9 @@
|
|
|
29
31
|
|
|
30
32
|
<script lang="ts">
|
|
31
33
|
import { keepReadmeFit, readmePartClass, readmePartLabel, readmeSoon, readmeUnitClass } from "@glimstone/core";
|
|
34
|
+
import { useTipBubble } from "./bubble.svelte.js";
|
|
32
35
|
import InfoBubble from "./InfoBubble.svelte";
|
|
36
|
+
import TipBubble from "./TipBubble.svelte";
|
|
33
37
|
|
|
34
38
|
// A button in the shape of the README's download buttons, on the App tab and
|
|
35
39
|
// the About card ("The App tab" in design-language.md). The first part carries
|
|
@@ -38,7 +42,7 @@
|
|
|
38
42
|
// brand's colour ("Brand tiles"). A link where a part leads to a file or a
|
|
39
43
|
// listing, a button where it does something on the page, and a quiet unit with
|
|
40
44
|
// "Soon" as its second line where the listing does not exist yet.
|
|
41
|
-
let { brand, parts, mark, markClass, art, hint, note, soonLabel, onLinkClick }: ReadmeButtonProps = $props();
|
|
45
|
+
let { brand, parts, mark, markClass, art, hint, tip, note, soonLabel, onLinkClick }: ReadmeButtonProps = $props();
|
|
42
46
|
|
|
43
47
|
let root: HTMLDivElement;
|
|
44
48
|
const soon = $derived(readmeSoon(parts));
|
|
@@ -49,6 +53,22 @@
|
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
const sub = (part: ReadmePart) => (soon ? soonLabel : part.sub);
|
|
56
|
+
|
|
57
|
+
const tooltip = useTipBubble(() => tip);
|
|
58
|
+
// The first part is the bubble's trigger; the segments after it say nothing of their own.
|
|
59
|
+
const tipped = (i: number) =>
|
|
60
|
+
i === 0
|
|
61
|
+
? {
|
|
62
|
+
"aria-describedby": tooltip.describedBy,
|
|
63
|
+
onmouseenter: tooltip.show,
|
|
64
|
+
onmouseleave: tooltip.hide,
|
|
65
|
+
onfocus: tooltip.showOnFocus,
|
|
66
|
+
onblur: tooltip.hide,
|
|
67
|
+
}
|
|
68
|
+
: {};
|
|
69
|
+
const trigger = (el: HTMLElement) => {
|
|
70
|
+
tooltip.trigger = el;
|
|
71
|
+
};
|
|
52
72
|
</script>
|
|
53
73
|
|
|
54
74
|
{#snippet face(part: ReadmePart, i: number)}
|
|
@@ -68,15 +88,16 @@
|
|
|
68
88
|
<div data-glim="ReadmeButton" bind:this={root} class={readmeUnitClass(brand, parts.length, !!note, soon)}>
|
|
69
89
|
{#each parts as part, i (i)}
|
|
70
90
|
{#if soon}
|
|
71
|
-
<span class={readmePartClass(i, soon)} aria-disabled="true" aria-label={readmePartLabel(part, sub(part))}>{@render face(part, i)}</span>
|
|
91
|
+
<span {...tipped(i)} {@attach i === 0 && trigger} class={readmePartClass(i, soon)} aria-disabled="true" aria-label={readmePartLabel(part, sub(part))}>{@render face(part, i)}</span>
|
|
72
92
|
{:else if part.href}
|
|
73
|
-
<a href={part.href} target="_blank" rel="noreferrer noopener" onclick={onLinkClick} aria-label={readmePartLabel(part, sub(part))} class={readmePartClass(i, soon)}>
|
|
93
|
+
<a {...tipped(i)} {@attach i === 0 && trigger} href={part.href} target="_blank" rel="noreferrer noopener" onclick={onLinkClick} aria-label={readmePartLabel(part, sub(part))} class={readmePartClass(i, soon)}>
|
|
74
94
|
{@render face(part, i)}
|
|
75
95
|
</a>
|
|
76
96
|
{:else}
|
|
77
|
-
<button type="button" onclick={part.onClick} aria-label={readmePartLabel(part, sub(part))} class={readmePartClass(i, soon)}>{@render face(part, i)}</button>
|
|
97
|
+
<button {...tipped(i)} {@attach i === 0 && trigger} type="button" onclick={part.onClick} aria-label={readmePartLabel(part, sub(part))} class={readmePartClass(i, soon)}>{@render face(part, i)}</button>
|
|
78
98
|
{/if}
|
|
79
99
|
{/each}
|
|
80
100
|
{#if !soon}<span class="glim-readme-btn-sheen" aria-hidden="true"></span>{/if}
|
|
81
101
|
{#if hint}<span class="glim-readme-btn-hint"><InfoBubble tip={hint} /></span>{/if}
|
|
102
|
+
<TipBubble state={tooltip} />
|
|
82
103
|
</div>
|
|
@@ -14,6 +14,8 @@ export interface ReadmeButtonProps {
|
|
|
14
14
|
art?: Snippet;
|
|
15
15
|
/** The "(i)" at the end of the unit, for what the name cannot say. */
|
|
16
16
|
hint?: string;
|
|
17
|
+
/** A few words in the first part's bubble, for a name that needs no (i). */
|
|
18
|
+
tip?: string;
|
|
17
19
|
/** Holds the second lines in view while one reports what it did, such as "Copied". */
|
|
18
20
|
note?: boolean;
|
|
19
21
|
/** The second line of a unit whose first part has neither `href` nor `onClick`. */
|
package/dist/Window.svelte
CHANGED
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
size?: WindowSize;
|
|
23
23
|
/** The words of the way out the window adds. */
|
|
24
24
|
text: { cancel: string; close: string };
|
|
25
|
+
/** Off while the window holds typed input, which a stray press beside the
|
|
26
|
+
* card would throw away. Escape and the foot still close it. */
|
|
27
|
+
closeOnBackdrop?: boolean;
|
|
25
28
|
/** Called for every way out: the foot, Escape and a press beside the window. */
|
|
26
29
|
onClose: () => void;
|
|
27
30
|
class?: string;
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
start,
|
|
50
53
|
size = "normal",
|
|
51
54
|
text,
|
|
55
|
+
closeOnBackdrop = true,
|
|
52
56
|
onClose,
|
|
53
57
|
class: className,
|
|
54
58
|
ref = $bindable(null),
|
|
@@ -77,7 +81,7 @@
|
|
|
77
81
|
|
|
78
82
|
// A press beside an open menu only closes the menu, not the window under it.
|
|
79
83
|
function pressBeside(e: MouseEvent) {
|
|
80
|
-
if (e.target === e.currentTarget && !menuIsOpen()) leave();
|
|
84
|
+
if (closeOnBackdrop && e.target === e.currentTarget && !menuIsOpen()) leave();
|
|
81
85
|
}
|
|
82
86
|
</script>
|
|
83
87
|
|
package/dist/Window.svelte.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
|
|
|
22
22
|
cancel: string;
|
|
23
23
|
close: string;
|
|
24
24
|
};
|
|
25
|
+
/** Off while the window holds typed input, which a stray press beside the
|
|
26
|
+
* card would throw away. Escape and the foot still close it. */
|
|
27
|
+
closeOnBackdrop?: boolean;
|
|
25
28
|
/** Called for every way out: the foot, Escape and a press beside the window. */
|
|
26
29
|
onClose: () => void;
|
|
27
30
|
class?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
+
import type { ButtonTone } from "@glimstone/core";
|
|
3
4
|
|
|
4
5
|
export interface WindowAction {
|
|
5
6
|
label: string;
|
|
@@ -11,6 +12,12 @@
|
|
|
11
12
|
/** This action already leaves the window, so no Cancel or Close is added. */
|
|
12
13
|
wayOut?: boolean;
|
|
13
14
|
disabled?: boolean;
|
|
15
|
+
/** Its fill once it has run, such as `ok` or `danger`, in place of the accent or the neutral grey. */
|
|
16
|
+
tone?: ButtonTone;
|
|
17
|
+
/** The busy ring in place of the glyph while it runs. The words, and so the width, stay. */
|
|
18
|
+
busy?: boolean;
|
|
19
|
+
/** What changes, such as how a test came out, in the button's bubble. */
|
|
20
|
+
title?: string;
|
|
14
21
|
/** Attributes for the action's button, such as a data hook. */
|
|
15
22
|
attrs?: Record<string, string>;
|
|
16
23
|
/** Runs on press. The window closes afterwards unless it returns false. */
|
|
@@ -56,7 +63,9 @@
|
|
|
56
63
|
label={a.label}
|
|
57
64
|
labelKey={a.labelKey}
|
|
58
65
|
glyph={a.glyph}
|
|
59
|
-
tone={a.primary ? "accent" : "neutral"}
|
|
66
|
+
tone={a.tone ?? (a.primary ? "accent" : "neutral")}
|
|
67
|
+
busy={a.busy}
|
|
68
|
+
title={a.title}
|
|
60
69
|
disabled={a.disabled}
|
|
61
70
|
onClick={() => {
|
|
62
71
|
if (a.onClick?.() !== false) onClose();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
+
import type { ButtonTone } from "@glimstone/core";
|
|
2
3
|
export interface WindowAction {
|
|
3
4
|
label: string;
|
|
4
5
|
/** The translation key behind `label`, which picks the glyph, or `null`. */
|
|
@@ -9,6 +10,12 @@ export interface WindowAction {
|
|
|
9
10
|
/** This action already leaves the window, so no Cancel or Close is added. */
|
|
10
11
|
wayOut?: boolean;
|
|
11
12
|
disabled?: boolean;
|
|
13
|
+
/** Its fill once it has run, such as `ok` or `danger`, in place of the accent or the neutral grey. */
|
|
14
|
+
tone?: ButtonTone;
|
|
15
|
+
/** The busy ring in place of the glyph while it runs. The words, and so the width, stay. */
|
|
16
|
+
busy?: boolean;
|
|
17
|
+
/** What changes, such as how a test came out, in the button's bubble. */
|
|
18
|
+
title?: string;
|
|
12
19
|
/** Attributes for the action's button, such as a data hook. */
|
|
13
20
|
attrs?: Record<string, string>;
|
|
14
21
|
/** Runs on press. The window closes afterwards unless it returns false. */
|
package/dist/glyphs.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const IconEye: Snippet<[]>;
|
|
|
23
23
|
export declare const IconEyeOff: Snippet<[]>;
|
|
24
24
|
export declare const IconCopy: Snippet<[]>;
|
|
25
25
|
export declare const IconBack: Snippet<[]>;
|
|
26
|
+
export declare const IconSearch: Snippet<[]>;
|
|
26
27
|
export declare const IconForward: Snippet<[]>;
|
|
27
28
|
export declare const IconUpload: Snippet<[]>;
|
|
28
29
|
export declare const IconCalendar: Snippet<[]>;
|
package/dist/glyphs.js
CHANGED
|
@@ -38,6 +38,7 @@ export const IconEye = markSnippet(MARKS.eye);
|
|
|
38
38
|
export const IconEyeOff = markSnippet(MARKS.eyeOff);
|
|
39
39
|
export const IconCopy = markSnippet(MARKS.copy);
|
|
40
40
|
export const IconBack = markSnippet(MARKS.back);
|
|
41
|
+
export const IconSearch = markSnippet(MARKS.search);
|
|
41
42
|
export const IconForward = markSnippet(MARKS.forward);
|
|
42
43
|
export const IconUpload = markSnippet(MARKS.upload);
|
|
43
44
|
export const IconCalendar = markSnippet(MARKS.calendar);
|
package/dist/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export { useAccent, useDensity, useHue, useLabelMode, useMotion, useRainbow, use
|
|
|
70
70
|
export { useConfirm, useDialogKeys, type ConfirmOptions, type ConfirmText } from "./confirm.svelte.js";
|
|
71
71
|
export { useFieldName } from "./fieldName.js";
|
|
72
72
|
export { deviceGlyph } from "./fortressParts.js";
|
|
73
|
-
export { glyphFor, IconBack, IconCalendar, IconCancel, IconCheck, IconClose, IconCopy, IconExpand, IconEye, IconEyeOff, IconFolderOpen, IconForward, IconPause, IconPencil, IconPlay, IconResetArrow, IconStar, IconUpload, IconWindowMaximise, IconWindowMinimise, IconWindowRestore, setGlyphResolver } from "./glyphs.js";
|
|
73
|
+
export { glyphFor, IconBack, IconCalendar, IconCancel, IconCheck, IconClose, IconCopy, IconExpand, IconEye, IconEyeOff, IconFolderOpen, IconForward, IconPause, IconPencil, IconPlay, IconResetArrow, IconSearch, IconStar, IconUpload, IconWindowMaximise, IconWindowMinimise, IconWindowRestore, setGlyphResolver } from "./glyphs.js";
|
|
74
74
|
export * from "./portalHue.svelte.js";
|
|
75
75
|
export { useTipBubble, type TipBubble } from "./bubble.svelte.js";
|
|
76
76
|
export * from "./useDragArmed.svelte.js";
|
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ export { useAccent, useDensity, useHue, useLabelMode, useMotion, useRainbow, use
|
|
|
70
70
|
export { useConfirm, useDialogKeys } from "./confirm.svelte.js";
|
|
71
71
|
export { useFieldName } from "./fieldName.js";
|
|
72
72
|
export { deviceGlyph } from "./fortressParts.js";
|
|
73
|
-
export { glyphFor, IconBack, IconCalendar, IconCancel, IconCheck, IconClose, IconCopy, IconExpand, IconEye, IconEyeOff, IconFolderOpen, IconForward, IconPause, IconPencil, IconPlay, IconResetArrow, IconStar, IconUpload, IconWindowMaximise, IconWindowMinimise, IconWindowRestore, setGlyphResolver } from "./glyphs.js";
|
|
73
|
+
export { glyphFor, IconBack, IconCalendar, IconCancel, IconCheck, IconClose, IconCopy, IconExpand, IconEye, IconEyeOff, IconFolderOpen, IconForward, IconPause, IconPencil, IconPlay, IconResetArrow, IconSearch, IconStar, IconUpload, IconWindowMaximise, IconWindowMinimise, IconWindowRestore, setGlyphResolver } from "./glyphs.js";
|
|
74
74
|
export * from "./portalHue.svelte.js";
|
|
75
75
|
export { useTipBubble } from "./bubble.svelte.js";
|
|
76
76
|
export * from "./useDragArmed.svelte.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glimstone/svelte",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.7",
|
|
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.
|
|
144
|
+
"@glimstone/core": "4.5.7"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|
|
147
147
|
"@internationalized/date": "^3.12.4",
|