@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
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
|
-
export interface AboutCardProps {
|
|
3
|
-
text: {
|
|
4
|
-
title: string;
|
|
5
|
-
body: string;
|
|
6
|
-
coffee: string;
|
|
7
|
-
coffeeButton: string;
|
|
8
|
-
cryptoButton?: string;
|
|
9
|
-
paypalButton?: string;
|
|
10
|
-
report: string;
|
|
11
|
-
repoButton: string;
|
|
12
|
-
discordButton?: string;
|
|
13
|
-
mailButton: string;
|
|
14
|
-
mailSubject: string;
|
|
15
|
-
version: string;
|
|
16
|
-
unreleased: (version: string) => string;
|
|
17
|
-
/** The Help card's heading. Without it the card draws none. */
|
|
18
|
-
helpTitle?: string;
|
|
19
|
-
};
|
|
20
|
-
version: string | null;
|
|
21
|
-
glimstoneVersion: string;
|
|
22
|
-
repoUrl: string;
|
|
23
|
-
repoGlyph?: Snippet;
|
|
24
|
-
glimstoneRepoUrl: string;
|
|
25
|
-
onCoffee: () => void;
|
|
26
|
-
coffeeArt: Snippet;
|
|
27
|
-
cryptoGlyph?: Snippet;
|
|
28
|
-
paypalGlyph?: Snippet;
|
|
29
|
-
onPaypal?: () => void;
|
|
30
|
-
onCrypto?: () => void;
|
|
31
|
-
discordUrl?: string;
|
|
32
|
-
discordGlyph?: Snippet;
|
|
33
|
-
mailAddress?: string;
|
|
34
|
-
mailGlyph?: Snippet;
|
|
35
|
-
openUrl?: (url: string) => void;
|
|
36
|
-
hueIndex?: number;
|
|
37
|
-
}
|
|
38
|
-
declare const AboutCard: import("svelte").Component<AboutCardProps, {}, "">;
|
|
39
|
-
type AboutCard = ReturnType<typeof AboutCard>;
|
|
40
|
-
export default AboutCard;
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Snippet } from "svelte";
|
|
3
|
-
|
|
4
|
-
export interface DropdownListboxProps {
|
|
5
|
-
/** Whether the panel is mounted. The caller owns the trigger; only the
|
|
6
|
-
* panel is shared. */
|
|
7
|
-
open: boolean;
|
|
8
|
-
/** Called when the panel dismisses itself (outside click, Escape, scroll,
|
|
9
|
-
* resize). Picking an option does not call it: a single-select list closes
|
|
10
|
-
* itself at the call site, a multi-select one stays open. */
|
|
11
|
-
onClose: () => void;
|
|
12
|
-
/** The trigger, which anchors the panel and is exempt from the outside-click
|
|
13
|
-
* dismissal so clicking it does not close and reopen the list. */
|
|
14
|
-
triggerRef: HTMLElement | null | undefined;
|
|
15
|
-
/** Accessible name for the listbox, normally the same label the trigger
|
|
16
|
-
* carries. */
|
|
17
|
-
label: string;
|
|
18
|
-
/** `aria-multiselectable`, for a checkbox multi-select list. */
|
|
19
|
-
multiselectable?: boolean;
|
|
20
|
-
/** The `role="option"` buttons. */
|
|
21
|
-
children: Snippet;
|
|
22
|
-
}
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<script lang="ts">
|
|
26
|
-
import { tick } from "svelte";
|
|
27
|
-
import { computeBubblePosition, focusByLetter, isTypeahead, warnDeprecated } from "@glimstone/core";
|
|
28
|
-
import { lift } from "./lift.js";
|
|
29
|
-
import { usePortalHue } from "./portalHue.svelte.js";
|
|
30
|
-
import { css } from "./style.js";
|
|
31
|
-
|
|
32
|
-
// The `role="listbox"` panel a button-opens-a-list picker drops open. It is
|
|
33
|
-
// lifted to the portal target, because a card with `overflow: hidden` clips
|
|
34
|
-
// an absolutely positioned panel whatever its z-index, and placed with
|
|
35
|
-
// computeBubblePosition, which clamps it into the viewport and flips it above
|
|
36
|
-
// the trigger when needed. The panel takes the trigger's width and is centred
|
|
37
|
-
// on it with `translateX(-50%)`, since computeBubblePosition returns the
|
|
38
|
-
// centre.
|
|
39
|
-
//
|
|
40
|
-
// Kept for the apps that already use it; Select keeps focus on its trigger
|
|
41
|
-
// and adds typeahead.
|
|
42
|
-
let { open, onClose, triggerRef, label, multiselectable, children }: DropdownListboxProps = $props();
|
|
43
|
-
warnDeprecated("DropdownListbox");
|
|
44
|
-
|
|
45
|
-
/** The gap to the trigger and the least distance from the viewport's edge, 4px to match `mt-1`. */
|
|
46
|
-
const GAP = 4;
|
|
47
|
-
|
|
48
|
-
let panel = $state<HTMLDivElement | null>(null);
|
|
49
|
-
let pos = $state<{ left: number; top: number; width: number } | null>(null);
|
|
50
|
-
// The portal leaves the trigger's rainbow subtree, so the panel copies the
|
|
51
|
-
// trigger's hue.
|
|
52
|
-
const hue = usePortalHue(() => open, () => triggerRef);
|
|
53
|
-
// Whether focus was in the list as it closed. It is read the moment `open`
|
|
54
|
-
// turns false, before the list leaves the page: a browser that blurs a
|
|
55
|
-
// removed element reports the focus gone before the list is.
|
|
56
|
-
let focusWasInside = false;
|
|
57
|
-
let wasOpen = false;
|
|
58
|
-
$effect.pre(() => {
|
|
59
|
-
if (wasOpen && !open) focusWasInside = !!panel?.contains(document.activeElement);
|
|
60
|
-
wasOpen = open;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const options = () => [...(panel?.querySelectorAll<HTMLElement>('[role="option"]') ?? [])];
|
|
64
|
-
|
|
65
|
-
function place(el: HTMLDivElement, trigger: HTMLElement) {
|
|
66
|
-
const rect = trigger.getBoundingClientRect();
|
|
67
|
-
// Option labels wrap against the width, so it is set before the height is read.
|
|
68
|
-
el.style.width = `${rect.width}px`;
|
|
69
|
-
const viewport = {
|
|
70
|
-
width: document.documentElement.clientWidth || window.innerWidth,
|
|
71
|
-
height: document.documentElement.clientHeight || window.innerHeight,
|
|
72
|
-
};
|
|
73
|
-
const { left, top } = computeBubblePosition(rect, { width: rect.width, height: el.offsetHeight }, viewport, GAP);
|
|
74
|
-
pos = { left, top, width: rect.width };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// A fixed panel that has lost its trigger reads as broken, so an outside
|
|
78
|
-
// press, Escape, scroll or resize closes it. The panel itself is exempt from
|
|
79
|
-
// the outside press, or pressing an option would unmount the list before its
|
|
80
|
-
// click landed. A scroll inside the panel, which scrolls a long list itself,
|
|
81
|
-
// does not close it either.
|
|
82
|
-
$effect(() => {
|
|
83
|
-
if (!open) return;
|
|
84
|
-
const onPointerDown = (e: MouseEvent) => {
|
|
85
|
-
const target = e.target as Node;
|
|
86
|
-
if (panel?.contains(target) || triggerRef?.contains(target)) return;
|
|
87
|
-
onClose();
|
|
88
|
-
};
|
|
89
|
-
const onKey = (e: KeyboardEvent) => {
|
|
90
|
-
if (e.key === "Escape") onClose();
|
|
91
|
-
};
|
|
92
|
-
const onScroll = (e: Event) => {
|
|
93
|
-
if (e.target instanceof Node && panel?.contains(e.target)) return;
|
|
94
|
-
onClose();
|
|
95
|
-
};
|
|
96
|
-
const onResize = () => onClose();
|
|
97
|
-
document.addEventListener("mousedown", onPointerDown);
|
|
98
|
-
document.addEventListener("keydown", onKey);
|
|
99
|
-
window.addEventListener("scroll", onScroll, true);
|
|
100
|
-
window.addEventListener("resize", onResize);
|
|
101
|
-
return () => {
|
|
102
|
-
document.removeEventListener("mousedown", onPointerDown);
|
|
103
|
-
document.removeEventListener("keydown", onKey);
|
|
104
|
-
window.removeEventListener("scroll", onScroll, true);
|
|
105
|
-
window.removeEventListener("resize", onResize);
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// Measured and placed before paint, so the panel never jumps from its
|
|
110
|
-
// off-screen parking spot. Focus then moves to the selected option, so a
|
|
111
|
-
// keyboard user reaches the list, but only once the panel stands at its real
|
|
112
|
-
// place: focusing an option parked off-screen makes the browser scroll to
|
|
113
|
-
// it, and that scroll closes the list.
|
|
114
|
-
$effect.pre(() => {
|
|
115
|
-
if (!open) {
|
|
116
|
-
pos = null;
|
|
117
|
-
// Focus goes back to the trigger only if it was in the list; a press
|
|
118
|
-
// elsewhere has already put it where somebody wants it.
|
|
119
|
-
if (focusWasInside) triggerRef?.focus();
|
|
120
|
-
focusWasInside = false;
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (!panel || !triggerRef) return;
|
|
124
|
-
place(panel, triggerRef);
|
|
125
|
-
tick().then(() => {
|
|
126
|
-
const opts = options();
|
|
127
|
-
const active = opts.find((o) => o.getAttribute("aria-selected") === "true") ?? opts[0];
|
|
128
|
-
active?.scrollIntoView?.({ block: "nearest" });
|
|
129
|
-
active?.focus();
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// Arrows, Home, End and a typed letter move between the options so every
|
|
134
|
-
// listbox behaves alike. Enter and Space need nothing: the options are real
|
|
135
|
-
// buttons.
|
|
136
|
-
function onPanelKey(e: KeyboardEvent) {
|
|
137
|
-
if (isTypeahead(e)) {
|
|
138
|
-
if (focusByLetter(options(), e.key)) e.preventDefault();
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
|
|
142
|
-
const opts = options();
|
|
143
|
-
if (opts.length === 0) return;
|
|
144
|
-
e.preventDefault();
|
|
145
|
-
const at = opts.indexOf(document.activeElement as HTMLElement);
|
|
146
|
-
let next: number;
|
|
147
|
-
if (e.key === "Home") next = 0;
|
|
148
|
-
else if (e.key === "End") next = opts.length - 1;
|
|
149
|
-
else {
|
|
150
|
-
const dir = e.key === "ArrowDown" ? 1 : -1;
|
|
151
|
-
next = at < 0 ? (dir === 1 ? 0 : opts.length - 1) : (at + dir + opts.length) % opts.length;
|
|
152
|
-
}
|
|
153
|
-
opts[next]!.scrollIntoView?.({ block: "nearest" });
|
|
154
|
-
opts[next]!.focus();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
</script>
|
|
158
|
-
|
|
159
|
-
{#if open}
|
|
160
|
-
<!-- svelte-ignore a11y_no_noninteractive_element_interactions, a11y_interactive_supports_focus -->
|
|
161
|
-
<div
|
|
162
|
-
{@attach lift}
|
|
163
|
-
bind:this={panel}
|
|
164
|
-
data-glim="DropdownListbox"
|
|
165
|
-
role="listbox"
|
|
166
|
-
onkeydown={onPanelKey}
|
|
167
|
-
aria-multiselectable={multiselectable ? "true" : undefined}
|
|
168
|
-
aria-label={label}
|
|
169
|
-
class={`glim-listbox glim-fade${hue.className ? ` ${hue.className}` : ""}`}
|
|
170
|
-
style:left={`${pos?.left ?? -9999}px`}
|
|
171
|
-
style:top={`${pos?.top ?? -9999}px`}
|
|
172
|
-
style:width={pos ? `${pos.width}px` : undefined}
|
|
173
|
-
style:transform="translateX(-50%)"
|
|
174
|
-
style={css(hue.style)}
|
|
175
|
-
>
|
|
176
|
-
{@render children()}
|
|
177
|
-
</div>
|
|
178
|
-
{/if}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
|
-
export interface DropdownListboxProps {
|
|
3
|
-
/** Whether the panel is mounted. The caller owns the trigger; only the
|
|
4
|
-
* panel is shared. */
|
|
5
|
-
open: boolean;
|
|
6
|
-
/** Called when the panel dismisses itself (outside click, Escape, scroll,
|
|
7
|
-
* resize). Picking an option does not call it: a single-select list closes
|
|
8
|
-
* itself at the call site, a multi-select one stays open. */
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
/** The trigger, which anchors the panel and is exempt from the outside-click
|
|
11
|
-
* dismissal so clicking it does not close and reopen the list. */
|
|
12
|
-
triggerRef: HTMLElement | null | undefined;
|
|
13
|
-
/** Accessible name for the listbox, normally the same label the trigger
|
|
14
|
-
* carries. */
|
|
15
|
-
label: string;
|
|
16
|
-
/** `aria-multiselectable`, for a checkbox multi-select list. */
|
|
17
|
-
multiselectable?: boolean;
|
|
18
|
-
/** The `role="option"` buttons. */
|
|
19
|
-
children: Snippet;
|
|
20
|
-
}
|
|
21
|
-
declare const DropdownListbox: import("svelte").Component<DropdownListboxProps, {}, "">;
|
|
22
|
-
type DropdownListbox = ReturnType<typeof DropdownListbox>;
|
|
23
|
-
export default DropdownListbox;
|