@glimstone/svelte 0.0.0-stage → 4.5.1
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/README.md +53 -2
- package/dist/AboutCard.svelte +87 -0
- package/dist/AboutCard.svelte.d.ts +37 -0
- package/dist/Accordion.svelte +60 -0
- package/dist/Accordion.svelte.d.ts +38 -0
- package/dist/AngleSlider.svelte +56 -0
- package/dist/AngleSlider.svelte.d.ts +13 -0
- package/dist/Avatar.svelte +37 -0
- package/dist/Avatar.svelte.d.ts +13 -0
- package/dist/Badge.svelte +119 -0
- package/dist/Badge.svelte.d.ts +54 -0
- package/dist/BrandMark.svelte +12 -0
- package/dist/BrandMark.svelte.d.ts +6 -0
- package/dist/BusyRing.svelte +39 -0
- package/dist/BusyRing.svelte.d.ts +15 -0
- package/dist/Button.svelte +172 -0
- package/dist/Button.svelte.d.ts +57 -0
- package/dist/Card.svelte +61 -0
- package/dist/Card.svelte.d.ts +23 -0
- package/dist/Carousel.svelte +72 -0
- package/dist/Carousel.svelte.d.ts +41 -0
- package/dist/Checkbox.svelte +48 -0
- package/dist/Checkbox.svelte.d.ts +17 -0
- package/dist/CoffeeDialog.svelte +70 -0
- package/dist/CoffeeDialog.svelte.d.ts +18 -0
- package/dist/Collapsible.svelte +49 -0
- package/dist/Collapsible.svelte.d.ts +14 -0
- package/dist/ColorPicker.svelte +122 -0
- package/dist/ColorPicker.svelte.d.ts +23 -0
- package/dist/Combobox.svelte +87 -0
- package/dist/Combobox.svelte.d.ts +18 -0
- package/dist/ConfirmDialog.svelte +106 -0
- package/dist/ConfirmDialog.svelte.d.ts +31 -0
- package/dist/ConfirmHost.svelte +41 -0
- package/dist/ConfirmHost.svelte.d.ts +7 -0
- package/dist/ContextMenu.svelte +213 -0
- package/dist/ContextMenu.svelte.d.ts +29 -0
- package/dist/CopyField.svelte +60 -0
- package/dist/CopyField.svelte.d.ts +19 -0
- package/dist/CryptoDonateDialog.svelte +162 -0
- package/dist/CryptoDonateDialog.svelte.d.ts +37 -0
- package/dist/DatePicker.svelte +149 -0
- package/dist/DatePicker.svelte.d.ts +18 -0
- package/dist/DropdownListbox.svelte +178 -0
- package/dist/DropdownListbox.svelte.d.ts +23 -0
- package/dist/EmptyState.svelte +31 -0
- package/dist/EmptyState.svelte.d.ts +16 -0
- package/dist/FieldError.svelte +20 -0
- package/dist/FieldError.svelte.d.ts +8 -0
- package/dist/FieldRow.svelte +52 -0
- package/dist/FieldRow.svelte.d.ts +23 -0
- package/dist/FieldRowGroup.svelte +33 -0
- package/dist/FieldRowGroup.svelte.d.ts +13 -0
- package/dist/FileUpload.svelte +74 -0
- package/dist/FileUpload.svelte.d.ts +18 -0
- package/dist/FloatingPanel.svelte +89 -0
- package/dist/FloatingPanel.svelte.d.ts +17 -0
- package/dist/Fortress.svelte +222 -0
- package/dist/Fortress.svelte.d.ts +62 -0
- package/dist/FortressAppCard.svelte +115 -0
- package/dist/FortressAppCard.svelte.d.ts +18 -0
- package/dist/FortressDoubtWindow.svelte +37 -0
- package/dist/FortressDoubtWindow.svelte.d.ts +12 -0
- package/dist/FortressPairing.svelte +85 -0
- package/dist/FortressPairing.svelte.d.ts +32 -0
- package/dist/FortressPermissions.svelte +93 -0
- package/dist/FortressPermissions.svelte.d.ts +24 -0
- package/dist/FortressStatusWindow.svelte +128 -0
- package/dist/FortressStatusWindow.svelte.d.ts +20 -0
- package/dist/FortressWindow.svelte +271 -0
- package/dist/FortressWindow.svelte.d.ts +18 -0
- package/dist/GlyphField.svelte +52 -0
- package/dist/GlyphField.svelte.d.ts +20 -0
- package/dist/GlyphTile.svelte +25 -0
- package/dist/GlyphTile.svelte.d.ts +14 -0
- package/dist/HoverCard.svelte +47 -0
- package/dist/HoverCard.svelte.d.ts +14 -0
- package/dist/IconButton.svelte +49 -0
- package/dist/IconButton.svelte.d.ts +20 -0
- package/dist/IconTipButton.svelte +67 -0
- package/dist/IconTipButton.svelte.d.ts +23 -0
- package/dist/InfoAboutCard.svelte +65 -0
- package/dist/InfoAboutCard.svelte.d.ts +35 -0
- package/dist/InfoBubble.svelte +50 -0
- package/dist/InfoBubble.svelte.d.ts +7 -0
- package/dist/InfoHelpCard.svelte +93 -0
- package/dist/InfoHelpCard.svelte.d.ts +44 -0
- package/dist/InfoTile.svelte +31 -0
- package/dist/InfoTile.svelte.d.ts +15 -0
- package/dist/InfoVersionCard.svelte +99 -0
- package/dist/InfoVersionCard.svelte.d.ts +29 -0
- package/dist/InstanceCard.svelte +85 -0
- package/dist/InstanceCard.svelte.d.ts +27 -0
- package/dist/Kbd.svelte +16 -0
- package/dist/Kbd.svelte.d.ts +8 -0
- package/dist/ListRow.svelte +51 -0
- package/dist/ListRow.svelte.d.ts +19 -0
- package/dist/ListSelect.svelte +135 -0
- package/dist/ListSelect.svelte.d.ts +25 -0
- package/dist/ListTable.svelte +183 -0
- package/dist/ListTable.svelte.d.ts +44 -0
- package/dist/MarkSvg.svelte +9 -0
- package/dist/MarkSvg.svelte.d.ts +8 -0
- package/dist/Marquee.svelte +63 -0
- package/dist/Marquee.svelte.d.ts +39 -0
- package/dist/MenuBar.svelte +98 -0
- package/dist/MenuBar.svelte.d.ts +19 -0
- package/dist/MenuChoice.svelte +30 -0
- package/dist/MenuChoice.svelte.d.ts +33 -0
- package/dist/MenuHeadEdit.svelte +29 -0
- package/dist/MenuHeadEdit.svelte.d.ts +10 -0
- package/dist/MenuRows.svelte +57 -0
- package/dist/MenuRows.svelte.d.ts +9 -0
- package/dist/MenuSelect.svelte +145 -0
- package/dist/MenuSelect.svelte.d.ts +25 -0
- package/dist/MenuSubmenu.svelte +64 -0
- package/dist/MenuSubmenu.svelte.d.ts +37 -0
- package/dist/Meter.svelte +55 -0
- package/dist/Meter.svelte.d.ts +20 -0
- package/dist/NumberField.svelte +70 -0
- package/dist/NumberField.svelte.d.ts +23 -0
- package/dist/Pagination.svelte +62 -0
- package/dist/Pagination.svelte.d.ts +16 -0
- package/dist/PasswordField.svelte +69 -0
- package/dist/PasswordField.svelte.d.ts +21 -0
- package/dist/PathField.svelte +111 -0
- package/dist/PathField.svelte.d.ts +33 -0
- package/dist/PaypalDialog.svelte +174 -0
- package/dist/PaypalDialog.svelte.d.ts +54 -0
- package/dist/Pill.svelte +25 -0
- package/dist/Pill.svelte.d.ts +14 -0
- package/dist/PinInput.svelte +81 -0
- package/dist/PinInput.svelte.d.ts +23 -0
- package/dist/Popover.svelte +38 -0
- package/dist/Popover.svelte.d.ts +16 -0
- package/dist/PresenceBadges.svelte +22 -0
- package/dist/PresenceBadges.svelte.d.ts +8 -0
- package/dist/ProgressBar.svelte +37 -0
- package/dist/ProgressBar.svelte.d.ts +16 -0
- package/dist/Rating.svelte +65 -0
- package/dist/Rating.svelte.d.ts +18 -0
- package/dist/ReadmeButton.svelte +82 -0
- package/dist/ReadmeButton.svelte.d.ts +27 -0
- package/dist/RowMark.svelte +16 -0
- package/dist/RowMark.svelte.d.ts +7 -0
- package/dist/ScrollArea.svelte +46 -0
- package/dist/ScrollArea.svelte.d.ts +11 -0
- package/dist/Select.svelte +97 -0
- package/dist/Select.svelte.d.ts +67 -0
- package/dist/SelectFace.svelte +18 -0
- package/dist/SelectFace.svelte.d.ts +32 -0
- package/dist/Selector.svelte +264 -0
- package/dist/Selector.svelte.d.ts +77 -0
- package/dist/SelectorSegment.svelte +159 -0
- package/dist/SelectorSegment.svelte.d.ts +27 -0
- package/dist/Sheet.svelte +51 -0
- package/dist/Sheet.svelte.d.ts +23 -0
- package/dist/SidebarRow.svelte +91 -0
- package/dist/SidebarRow.svelte.d.ts +31 -0
- package/dist/SignInCard.svelte +251 -0
- package/dist/SignInCard.svelte.d.ts +34 -0
- package/dist/SignInField.svelte +32 -0
- package/dist/SignInField.svelte.d.ts +11 -0
- package/dist/SignaturePad.svelte +72 -0
- package/dist/SignaturePad.svelte.d.ts +13 -0
- package/dist/SkeletonRow.svelte +29 -0
- package/dist/SkeletonRow.svelte.d.ts +12 -0
- package/dist/Slider.svelte +60 -0
- package/dist/Slider.svelte.d.ts +15 -0
- package/dist/Splitter.svelte +59 -0
- package/dist/Splitter.svelte.d.ts +37 -0
- package/dist/Steps.svelte +90 -0
- package/dist/Steps.svelte.d.ts +40 -0
- package/dist/SubCard.svelte +45 -0
- package/dist/SubCard.svelte.d.ts +14 -0
- package/dist/Table.svelte +48 -0
- package/dist/Table.svelte.d.ts +37 -0
- package/dist/TagsInput.svelte +77 -0
- package/dist/TagsInput.svelte.d.ts +18 -0
- package/dist/TextArea.svelte +55 -0
- package/dist/TextArea.svelte.d.ts +17 -0
- package/dist/TextField.svelte +61 -0
- package/dist/TextField.svelte.d.ts +18 -0
- package/dist/Timer.svelte +62 -0
- package/dist/Timer.svelte.d.ts +17 -0
- package/dist/TipBubble.svelte +11 -0
- package/dist/TipBubble.svelte.d.ts +7 -0
- package/dist/TipWrap.svelte +15 -0
- package/dist/TipWrap.svelte.d.ts +10 -0
- package/dist/ToastCard.svelte +68 -0
- package/dist/ToastCard.svelte.d.ts +18 -0
- package/dist/ToastViewport.svelte +65 -0
- package/dist/ToastViewport.svelte.d.ts +14 -0
- package/dist/Toggle.svelte +84 -0
- package/dist/Toggle.svelte.d.ts +25 -0
- package/dist/Tour.svelte +75 -0
- package/dist/Tour.svelte.d.ts +12 -0
- package/dist/Tree.svelte +122 -0
- package/dist/Tree.svelte.d.ts +22 -0
- package/dist/UnavailableNotice.svelte +36 -0
- package/dist/UnavailableNotice.svelte.d.ts +18 -0
- package/dist/Window.svelte +108 -0
- package/dist/Window.svelte.d.ts +33 -0
- package/dist/WindowBar.svelte +76 -0
- package/dist/WindowBar.svelte.d.ts +26 -0
- package/dist/WindowFootRow.svelte +67 -0
- package/dist/WindowFootRow.svelte.d.ts +28 -0
- package/dist/bubble.svelte.d.ts +15 -0
- package/dist/bubble.svelte.js +66 -0
- package/dist/confirm.svelte.d.ts +37 -0
- package/dist/confirm.svelte.js +62 -0
- package/dist/engines.svelte.d.ts +18 -0
- package/dist/engines.svelte.js +57 -0
- package/dist/entries/accordion.d.ts +1 -0
- package/dist/entries/accordion.js +2 -0
- package/dist/entries/angleslider.d.ts +1 -0
- package/dist/entries/angleslider.js +2 -0
- package/dist/entries/avatar.d.ts +1 -0
- package/dist/entries/avatar.js +2 -0
- package/dist/entries/carousel.d.ts +1 -0
- package/dist/entries/carousel.js +2 -0
- package/dist/entries/collapsible.d.ts +1 -0
- package/dist/entries/collapsible.js +2 -0
- package/dist/entries/combobox.d.ts +1 -0
- package/dist/entries/combobox.js +2 -0
- package/dist/entries/datepicker.d.ts +1 -0
- package/dist/entries/datepicker.js +2 -0
- package/dist/entries/fileupload.d.ts +1 -0
- package/dist/entries/fileupload.js +2 -0
- package/dist/entries/floatingpanel.d.ts +1 -0
- package/dist/entries/floatingpanel.js +2 -0
- package/dist/entries/hovercard.d.ts +1 -0
- package/dist/entries/hovercard.js +2 -0
- package/dist/entries/marquee.d.ts +1 -0
- package/dist/entries/marquee.js +2 -0
- package/dist/entries/pagination.d.ts +1 -0
- package/dist/entries/pagination.js +2 -0
- package/dist/entries/pininput.d.ts +1 -0
- package/dist/entries/pininput.js +2 -0
- package/dist/entries/rating.d.ts +1 -0
- package/dist/entries/rating.js +2 -0
- package/dist/entries/scrollarea.d.ts +1 -0
- package/dist/entries/scrollarea.js +2 -0
- package/dist/entries/select.d.ts +1 -0
- package/dist/entries/select.js +2 -0
- package/dist/entries/signaturepad.d.ts +1 -0
- package/dist/entries/signaturepad.js +2 -0
- package/dist/entries/slider.d.ts +1 -0
- package/dist/entries/slider.js +2 -0
- package/dist/entries/splitter.d.ts +1 -0
- package/dist/entries/splitter.js +2 -0
- package/dist/entries/steps.d.ts +1 -0
- package/dist/entries/steps.js +2 -0
- package/dist/entries/tagsinput.d.ts +1 -0
- package/dist/entries/tagsinput.js +2 -0
- package/dist/entries/timer.d.ts +1 -0
- package/dist/entries/timer.js +2 -0
- package/dist/entries/tour.d.ts +1 -0
- package/dist/entries/tour.js +2 -0
- package/dist/fieldName.d.ts +4 -0
- package/dist/fieldName.js +9 -0
- package/dist/fortressParts.d.ts +5 -0
- package/dist/fortressParts.js +16 -0
- package/dist/glyphs.d.ts +32 -0
- package/dist/glyphs.js +47 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +77 -0
- package/dist/lift.d.ts +5 -0
- package/dist/lift.js +9 -0
- package/dist/portalHue.svelte.d.ts +9 -0
- package/dist/portalHue.svelte.js +16 -0
- package/dist/selectParts.svelte.d.ts +39 -0
- package/dist/selectParts.svelte.js +28 -0
- package/dist/selectorItem.d.ts +22 -0
- package/dist/selectorItem.js +1 -0
- package/dist/style.d.ts +5 -0
- package/dist/style.js +12 -0
- package/dist/useDragArmed.svelte.d.ts +6 -0
- package/dist/useDragArmed.svelte.js +24 -0
- package/dist/usePaypalButtons.svelte.d.ts +18 -0
- package/dist/usePaypalButtons.svelte.js +41 -0
- package/package.json +173 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { WindowAction } from "./WindowFootRow.svelte";
|
|
4
|
+
|
|
5
|
+
export interface SheetProps {
|
|
6
|
+
open: boolean;
|
|
7
|
+
/** The notch's words, also the sheet's accessible name. */
|
|
8
|
+
title: string;
|
|
9
|
+
children: Snippet;
|
|
10
|
+
/** The foot's buttons, in reading order, as a Window's. */
|
|
11
|
+
actions?: WindowAction[];
|
|
12
|
+
/** A quiet line at the start of the foot. */
|
|
13
|
+
start?: string | Snippet;
|
|
14
|
+
/** The words of the way out the sheet adds. */
|
|
15
|
+
text: { cancel: string; close: string };
|
|
16
|
+
/** Called for every way out; the caller sets `open` back. */
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
class?: string;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { openSheet } from "@glimstone/core";
|
|
24
|
+
import Badge from "./Badge.svelte";
|
|
25
|
+
import WindowFootRow from "./WindowFootRow.svelte";
|
|
26
|
+
|
|
27
|
+
// A panel at the end edge, or rising from the bottom on a phone, for the
|
|
28
|
+
// details of a row or a longer form beside the list. It is a <dialog> shown
|
|
29
|
+
// modal: the page behind it is inert, Escape and a press on the scrim close it,
|
|
30
|
+
// and focus goes back to the control that opened it. Its foot works as a
|
|
31
|
+
// Window's, with Cancel or Close added, so it has no close mark in its head.
|
|
32
|
+
let { open, title, children, actions = [], start, text, onClose, class: className }: SheetProps = $props();
|
|
33
|
+
let dialog = $state<HTMLDialogElement | null>(null);
|
|
34
|
+
const titleId = $props.id();
|
|
35
|
+
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (open && dialog) return openSheet(dialog, () => onClose());
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
{#if open}
|
|
42
|
+
<dialog data-glim="Sheet" data-glim-title={title} bind:this={dialog} aria-labelledby={titleId} class={className ? `glim-sheet ${className}` : "glim-sheet"}>
|
|
43
|
+
<div class="glim-sheet-panel">
|
|
44
|
+
<h2 id={titleId} class="glim-sheet-title">
|
|
45
|
+
<Badge tone="heading" size="heading" wrap insetStart={5}>{title}</Badge>
|
|
46
|
+
</h2>
|
|
47
|
+
<div class="glim-sheet-body">{@render children()}</div>
|
|
48
|
+
<WindowFootRow {actions} {start} {text} onClose={() => onClose()} />
|
|
49
|
+
</div>
|
|
50
|
+
</dialog>
|
|
51
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { WindowAction } from "./WindowFootRow.svelte";
|
|
3
|
+
export interface SheetProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** The notch's words, also the sheet's accessible name. */
|
|
6
|
+
title: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
/** The foot's buttons, in reading order, as a Window's. */
|
|
9
|
+
actions?: WindowAction[];
|
|
10
|
+
/** A quiet line at the start of the foot. */
|
|
11
|
+
start?: string | Snippet;
|
|
12
|
+
/** The words of the way out the sheet adds. */
|
|
13
|
+
text: {
|
|
14
|
+
cancel: string;
|
|
15
|
+
close: string;
|
|
16
|
+
};
|
|
17
|
+
/** Called for every way out; the caller sets `open` back. */
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
class?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const Sheet: import("svelte").Component<SheetProps, {}, "">;
|
|
22
|
+
type Sheet = ReturnType<typeof Sheet>;
|
|
23
|
+
export default Sheet;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
|
+
import type { SidebarCount } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export type { SidebarCount } from "@glimstone/core";
|
|
7
|
+
|
|
8
|
+
export interface SidebarRowProps extends Omit<HTMLAnchorAttributes, "children" | "class" | "style"> {
|
|
9
|
+
/** The destination's name: shown, or hidden but still the link's name. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** The destination's glyph. Without one the row shows its name in every mode. */
|
|
12
|
+
glyph?: Snippet;
|
|
13
|
+
/** Without one the row is a button. */
|
|
14
|
+
href?: string;
|
|
15
|
+
/** This destination is showing; the row is filled and marked as the current page. */
|
|
16
|
+
active?: boolean;
|
|
17
|
+
/** The row's rainbow position: its rank among the rows the rail shows, so a
|
|
18
|
+
* hidden row leaves no gap. */
|
|
19
|
+
hueIndex?: number;
|
|
20
|
+
/** The figure on the row, such as items that need attention. Nothing shows at zero. */
|
|
21
|
+
count?: SidebarCount;
|
|
22
|
+
/** A tree's row at this level, stepped in with a smaller glyph and gap. */
|
|
23
|
+
depth?: number;
|
|
24
|
+
/** What stands in the row before the link, such as a tree's toggle. */
|
|
25
|
+
before?: Snippet;
|
|
26
|
+
/** What stands in the row after the link, such as a meter or a pin. The link's
|
|
27
|
+
* press still covers the rest of the row. */
|
|
28
|
+
after?: Snippet;
|
|
29
|
+
class?: string;
|
|
30
|
+
style?: string;
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
import { sidebarRowView } from "@glimstone/core";
|
|
36
|
+
import { useLabelMode } from "./engines.svelte.js";
|
|
37
|
+
import { css } from "./style.js";
|
|
38
|
+
import { useTipBubble } from "./bubble.svelte.js";
|
|
39
|
+
import TipBubble from "./TipBubble.svelte";
|
|
40
|
+
|
|
41
|
+
// One destination of the navigation rail; what it shows comes from
|
|
42
|
+
// sidebarRowView() in the core. The other props of an <a> go to the link, so a
|
|
43
|
+
// router can take the click.
|
|
44
|
+
let { label, glyph, href, active = false, hueIndex, count, depth, before, after, class: className = "", style, ...rest }: SidebarRowProps = $props();
|
|
45
|
+
|
|
46
|
+
const mode = useLabelMode("sidebar");
|
|
47
|
+
const framed = $derived(!!(before || after));
|
|
48
|
+
const view = $derived(
|
|
49
|
+
sidebarRowView({ mode: mode.current, label, hasGlyph: !!glyph, active, hueIndex, count: count?.value, framed, depth }),
|
|
50
|
+
);
|
|
51
|
+
const tooltip = useTipBubble(() => view.tip);
|
|
52
|
+
const viewStyle = $derived([css(view.style), style].filter(Boolean).join("; ") || undefined);
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
{#snippet link()}
|
|
56
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
57
|
+
<svelte:element
|
|
58
|
+
this={href ? "a" : "button"}
|
|
59
|
+
data-glim={framed ? undefined : "SidebarRow"}
|
|
60
|
+
{...rest}
|
|
61
|
+
{href}
|
|
62
|
+
type={href ? undefined : "button"}
|
|
63
|
+
bind:this={tooltip.trigger}
|
|
64
|
+
aria-current={active ? "page" : undefined}
|
|
65
|
+
aria-describedby={tooltip.describedBy}
|
|
66
|
+
onmouseenter={tooltip.show}
|
|
67
|
+
onmouseleave={tooltip.hide}
|
|
68
|
+
onfocus={tooltip.showOnFocus}
|
|
69
|
+
onblur={tooltip.hide}
|
|
70
|
+
class={framed ? "glim-nav-row-main" : `${view.className} ${className}`.trim()}
|
|
71
|
+
style={framed ? undefined : viewStyle}
|
|
72
|
+
>
|
|
73
|
+
{#if view.showGlyph}{@render glyph?.()}{/if}
|
|
74
|
+
<span class={view.labelClass}>{label}</span>
|
|
75
|
+
{#if view.countClass}
|
|
76
|
+
<span class={view.countClass} aria-hidden="true">{count!.value}</span>
|
|
77
|
+
<span class="glim-sr-only">{count!.label}</span>
|
|
78
|
+
{/if}
|
|
79
|
+
</svelte:element>
|
|
80
|
+
{/snippet}
|
|
81
|
+
|
|
82
|
+
{#if framed}
|
|
83
|
+
<div data-glim="SidebarRow" class={`${view.className} glim-nav-row--slots ${className}`.trim()} style={viewStyle}>
|
|
84
|
+
{#if before}<span class="glim-nav-row-slot">{@render before()}</span>{/if}
|
|
85
|
+
{@render link()}
|
|
86
|
+
{#if after}<span class="glim-nav-row-slot">{@render after()}</span>{/if}
|
|
87
|
+
</div>
|
|
88
|
+
{:else}
|
|
89
|
+
{@render link()}
|
|
90
|
+
{/if}
|
|
91
|
+
<TipBubble state={tooltip} />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
+
import type { SidebarCount } from "@glimstone/core";
|
|
4
|
+
export type { SidebarCount } from "@glimstone/core";
|
|
5
|
+
export interface SidebarRowProps extends Omit<HTMLAnchorAttributes, "children" | "class" | "style"> {
|
|
6
|
+
/** The destination's name: shown, or hidden but still the link's name. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** The destination's glyph. Without one the row shows its name in every mode. */
|
|
9
|
+
glyph?: Snippet;
|
|
10
|
+
/** Without one the row is a button. */
|
|
11
|
+
href?: string;
|
|
12
|
+
/** This destination is showing; the row is filled and marked as the current page. */
|
|
13
|
+
active?: boolean;
|
|
14
|
+
/** The row's rainbow position: its rank among the rows the rail shows, so a
|
|
15
|
+
* hidden row leaves no gap. */
|
|
16
|
+
hueIndex?: number;
|
|
17
|
+
/** The figure on the row, such as items that need attention. Nothing shows at zero. */
|
|
18
|
+
count?: SidebarCount;
|
|
19
|
+
/** A tree's row at this level, stepped in with a smaller glyph and gap. */
|
|
20
|
+
depth?: number;
|
|
21
|
+
/** What stands in the row before the link, such as a tree's toggle. */
|
|
22
|
+
before?: Snippet;
|
|
23
|
+
/** What stands in the row after the link, such as a meter or a pin. The link's
|
|
24
|
+
* press still covers the rest of the row. */
|
|
25
|
+
after?: Snippet;
|
|
26
|
+
class?: string;
|
|
27
|
+
style?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const SidebarRow: import("svelte").Component<SidebarRowProps, {}, "">;
|
|
30
|
+
type SidebarRow = ReturnType<typeof SidebarRow>;
|
|
31
|
+
export default SidebarRow;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { SignInHandlers, SignInLabelKeys, SignInText } from "@glimstone/core";
|
|
4
|
+
|
|
5
|
+
export type { ResetAnswer, SignInAnswer, SignInLabelKeys, SignInText } from "@glimstone/core";
|
|
6
|
+
|
|
7
|
+
export interface SignInCardProps extends SignInHandlers {
|
|
8
|
+
/** The app's logo, as an address or as an inline `<svg>` with a viewBox. It stands 7.5rem tall above the name, as wide as its shape asks. */
|
|
9
|
+
logo?: string | Snippet;
|
|
10
|
+
/** The page's heading. */
|
|
11
|
+
appName: string;
|
|
12
|
+
text: SignInText;
|
|
13
|
+
/** Offers Sign in with a passkey. Pass it only where a passkey can answer on this address. */
|
|
14
|
+
passkey?: boolean;
|
|
15
|
+
/** Offers Forgot password? and the reset form. */
|
|
16
|
+
reset?: boolean;
|
|
17
|
+
/** The shortest new password the reset form takes, as the server says. */
|
|
18
|
+
minPassword?: number;
|
|
19
|
+
/** One line at the top of the sign-in form, such as "You are signed out". */
|
|
20
|
+
note?: string;
|
|
21
|
+
/** The app's own fields, above the password. */
|
|
22
|
+
fields?: Snippet;
|
|
23
|
+
/** The app's own buttons, under Sign in and the passkey. */
|
|
24
|
+
actions?: Snippet;
|
|
25
|
+
/** A step the app runs itself, in place of the card's forms. */
|
|
26
|
+
step?: Snippet;
|
|
27
|
+
labelKeys?: Partial<SignInLabelKeys>;
|
|
28
|
+
/** The start of the fields' ids: `-password`, `-code`, `-reset-code`, `-new` and `-confirm` follow it. */
|
|
29
|
+
idPrefix?: string;
|
|
30
|
+
/** Puts the focus in the first empty field when the card opens. */
|
|
31
|
+
autoFocus?: boolean;
|
|
32
|
+
/** Classes for the page around the card. */
|
|
33
|
+
class?: string;
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
import { onDestroy, untrack } from "svelte";
|
|
39
|
+
import { createSignInFlow, focusFirstField, resetBlocked, showRefusal, signInBlocked, signInStage } from "@glimstone/core";
|
|
40
|
+
import Button from "./Button.svelte";
|
|
41
|
+
import PasswordField from "./PasswordField.svelte";
|
|
42
|
+
import SignInField from "./SignInField.svelte";
|
|
43
|
+
import TextField from "./TextField.svelte";
|
|
44
|
+
|
|
45
|
+
// The way into an app with a login ("The sign-in card" in the design
|
|
46
|
+
// language). The flow lives in the core; the app answers each step through a
|
|
47
|
+
// callback and brings its own words.
|
|
48
|
+
let {
|
|
49
|
+
logo,
|
|
50
|
+
appName,
|
|
51
|
+
text,
|
|
52
|
+
passkey = false,
|
|
53
|
+
reset = false,
|
|
54
|
+
minPassword = 12,
|
|
55
|
+
note,
|
|
56
|
+
fields,
|
|
57
|
+
actions,
|
|
58
|
+
step,
|
|
59
|
+
labelKeys,
|
|
60
|
+
idPrefix,
|
|
61
|
+
autoFocus = true,
|
|
62
|
+
class: className,
|
|
63
|
+
onSignIn,
|
|
64
|
+
onPasskey,
|
|
65
|
+
onAskCode,
|
|
66
|
+
onSetPassword,
|
|
67
|
+
}: SignInCardProps = $props();
|
|
68
|
+
|
|
69
|
+
const LABEL_KEYS: SignInLabelKeys = {
|
|
70
|
+
signIn: "signIn",
|
|
71
|
+
passkey: "signInWithPasskey",
|
|
72
|
+
forgot: "forgotPassword",
|
|
73
|
+
back: "back",
|
|
74
|
+
setPassword: "setPassword",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const flow = createSignInFlow(() => ({ onSignIn, onPasskey, onAskCode, onSetPassword, text, minPassword }));
|
|
78
|
+
let s = $state.raw(flow.state());
|
|
79
|
+
onDestroy(flow.subscribe(() => (s = flow.state())));
|
|
80
|
+
const ownId = $props.id();
|
|
81
|
+
const id = (name: string) => `${idPrefix ?? ownId}-${name}`;
|
|
82
|
+
const keys = $derived({ ...LABEL_KEYS, ...labelKeys });
|
|
83
|
+
const eye = $derived({ show: text.show, hide: text.hide });
|
|
84
|
+
let card: HTMLDivElement;
|
|
85
|
+
|
|
86
|
+
const stage = $derived(step ? "step" : signInStage(s));
|
|
87
|
+
let opened = false;
|
|
88
|
+
$effect(() => {
|
|
89
|
+
void stage;
|
|
90
|
+
untrack(() => {
|
|
91
|
+
if (opened || autoFocus) focusFirstField(card);
|
|
92
|
+
opened = true;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const refusals = $derived(s.refusal?.count);
|
|
97
|
+
$effect(() => {
|
|
98
|
+
void refusals;
|
|
99
|
+
const refusal = untrack(() => s.refusal);
|
|
100
|
+
if (refusal) return showRefusal(card, refusal);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
function submit(e: SubmitEvent) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
void flow.submit();
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
{#snippet error()}
|
|
110
|
+
{#if s.error}<p class="glim-signin-error" role="alert">{s.error}</p>{/if}
|
|
111
|
+
{/snippet}
|
|
112
|
+
|
|
113
|
+
{#snippet back()}
|
|
114
|
+
<Button label={text.back} labelKey={keys.back} tone="subtle" data-signin="back" disabled={!!s.busy} onClick={flow.back} />
|
|
115
|
+
{/snippet}
|
|
116
|
+
|
|
117
|
+
<div data-glim="SignInCard" class={["glim-signin", className].filter(Boolean).join(" ")}>
|
|
118
|
+
<div bind:this={card} class="glim-card glim-signin-card">
|
|
119
|
+
<div class="glim-signin-head">
|
|
120
|
+
{#if logo}
|
|
121
|
+
<span class="glim-signin-logo" aria-hidden="true">
|
|
122
|
+
{#if typeof logo === "string"}<img src={logo} alt="" draggable="false" />{:else}{@render logo()}{/if}
|
|
123
|
+
</span>
|
|
124
|
+
{/if}
|
|
125
|
+
<h1 class="glim-signin-name">{appName}</h1>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{#if step}
|
|
129
|
+
{@render step()}
|
|
130
|
+
{:else if s.view === "reset"}
|
|
131
|
+
<form class="glim-signin-form" novalidate onsubmit={submit}>
|
|
132
|
+
<SignInField label={text.resetCode} htmlFor={id("reset-code")} hint={text.resetCodeTip}>
|
|
133
|
+
<TextField
|
|
134
|
+
id={id("reset-code")}
|
|
135
|
+
data-signin-field="resetCode"
|
|
136
|
+
class="glim-signin-log-code"
|
|
137
|
+
value={s.resetCode}
|
|
138
|
+
oninput={(e) => flow.set("resetCode", e.currentTarget.value)}
|
|
139
|
+
autocomplete="one-time-code"
|
|
140
|
+
autocapitalize="characters"
|
|
141
|
+
spellcheck={false}
|
|
142
|
+
placeholder="XXXX-XXXX-XXXX"
|
|
143
|
+
/>
|
|
144
|
+
</SignInField>
|
|
145
|
+
<SignInField label={text.newPassword} htmlFor={id("new")}>
|
|
146
|
+
<PasswordField
|
|
147
|
+
id={id("new")}
|
|
148
|
+
data-signin-field="newPassword"
|
|
149
|
+
value={s.newPassword}
|
|
150
|
+
oninput={(e) => flow.set("newPassword", e.currentTarget.value)}
|
|
151
|
+
autocomplete="new-password"
|
|
152
|
+
text={eye}
|
|
153
|
+
/>
|
|
154
|
+
</SignInField>
|
|
155
|
+
<SignInField label={text.confirmPassword} htmlFor={id("confirm")}>
|
|
156
|
+
<PasswordField
|
|
157
|
+
id={id("confirm")}
|
|
158
|
+
data-signin-field="confirm"
|
|
159
|
+
value={s.confirm}
|
|
160
|
+
oninput={(e) => flow.set("confirm", e.currentTarget.value)}
|
|
161
|
+
autocomplete="new-password"
|
|
162
|
+
text={eye}
|
|
163
|
+
/>
|
|
164
|
+
</SignInField>
|
|
165
|
+
{@render error()}
|
|
166
|
+
<!-- Stacked, since the longer translations of the two labels do not fit side by side. -->
|
|
167
|
+
<Button
|
|
168
|
+
label={text.setPassword}
|
|
169
|
+
labelKey={keys.setPassword}
|
|
170
|
+
tone="accent"
|
|
171
|
+
type="submit"
|
|
172
|
+
data-signin="set-password"
|
|
173
|
+
disabled={resetBlocked(s)}
|
|
174
|
+
busy={s.busy === "setPassword"}
|
|
175
|
+
title={s.busy === "setPassword" ? text.saving : undefined}
|
|
176
|
+
/>
|
|
177
|
+
{@render back()}
|
|
178
|
+
</form>
|
|
179
|
+
{:else}
|
|
180
|
+
<form class="glim-signin-form" novalidate onsubmit={submit}>
|
|
181
|
+
{#if note}<p class="glim-signin-note" role="status">{note}</p>{/if}
|
|
182
|
+
{#if !s.viaPasskey}{@render fields?.()}{/if}
|
|
183
|
+
<!-- Kept while a passkey asks for the code, so the password survives a step back. -->
|
|
184
|
+
<SignInField label={text.password} htmlFor={id("password")} hidden={s.viaPasskey}>
|
|
185
|
+
<PasswordField
|
|
186
|
+
id={id("password")}
|
|
187
|
+
data-signin-field="password"
|
|
188
|
+
value={s.password}
|
|
189
|
+
oninput={(e) => flow.set("password", e.currentTarget.value)}
|
|
190
|
+
autocomplete="current-password"
|
|
191
|
+
text={eye}
|
|
192
|
+
/>
|
|
193
|
+
</SignInField>
|
|
194
|
+
{#if s.needCode}
|
|
195
|
+
<div class="glim-signin-field">
|
|
196
|
+
<label for={id("code")} class="glim-signin-label">{text.code}</label>
|
|
197
|
+
<TextField
|
|
198
|
+
id={id("code")}
|
|
199
|
+
data-signin-field="code"
|
|
200
|
+
class="glim-signin-code"
|
|
201
|
+
value={s.code}
|
|
202
|
+
oninput={(e) => flow.set("code", e.currentTarget.value)}
|
|
203
|
+
inputmode="numeric"
|
|
204
|
+
autocomplete="one-time-code"
|
|
205
|
+
spellcheck={false}
|
|
206
|
+
placeholder="000000"
|
|
207
|
+
/>
|
|
208
|
+
<p class="glim-signin-hint">{text.codeHint}</p>
|
|
209
|
+
</div>
|
|
210
|
+
{/if}
|
|
211
|
+
{@render error()}
|
|
212
|
+
<Button
|
|
213
|
+
label={text.signIn}
|
|
214
|
+
labelKey={keys.signIn}
|
|
215
|
+
tone="accent"
|
|
216
|
+
type="submit"
|
|
217
|
+
data-signin="submit"
|
|
218
|
+
disabled={signInBlocked(s)}
|
|
219
|
+
busy={s.busy === "signIn"}
|
|
220
|
+
title={s.busy === "signIn" ? text.signingIn : undefined}
|
|
221
|
+
/>
|
|
222
|
+
<!-- Left out rather than disabled where it cannot work: a disabled
|
|
223
|
+
control on a sign-in page reads as being locked out. -->
|
|
224
|
+
{#if !s.needCode && passkey}
|
|
225
|
+
<Button
|
|
226
|
+
label={text.passkey}
|
|
227
|
+
labelKey={keys.passkey}
|
|
228
|
+
data-signin="passkey"
|
|
229
|
+
disabled={!!s.busy}
|
|
230
|
+
busy={s.busy === "passkey"}
|
|
231
|
+
onClick={() => void flow.passkey()}
|
|
232
|
+
/>
|
|
233
|
+
{/if}
|
|
234
|
+
{#if !s.needCode}{@render actions?.()}{/if}
|
|
235
|
+
{#if s.needCode}
|
|
236
|
+
{@render back()}
|
|
237
|
+
{:else if reset}
|
|
238
|
+
<Button
|
|
239
|
+
label={text.forgot}
|
|
240
|
+
labelKey={keys.forgot}
|
|
241
|
+
tone="subtle"
|
|
242
|
+
data-signin="forgot"
|
|
243
|
+
disabled={!!s.busy}
|
|
244
|
+
busy={s.busy === "askCode"}
|
|
245
|
+
onClick={() => void flow.forgot()}
|
|
246
|
+
/>
|
|
247
|
+
{/if}
|
|
248
|
+
</form>
|
|
249
|
+
{/if}
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { SignInHandlers, SignInLabelKeys, SignInText } from "@glimstone/core";
|
|
3
|
+
export type { ResetAnswer, SignInAnswer, SignInLabelKeys, SignInText } from "@glimstone/core";
|
|
4
|
+
export interface SignInCardProps extends SignInHandlers {
|
|
5
|
+
/** The app's logo, as an address or as an inline `<svg>` with a viewBox. It stands 7.5rem tall above the name, as wide as its shape asks. */
|
|
6
|
+
logo?: string | Snippet;
|
|
7
|
+
/** The page's heading. */
|
|
8
|
+
appName: string;
|
|
9
|
+
text: SignInText;
|
|
10
|
+
/** Offers Sign in with a passkey. Pass it only where a passkey can answer on this address. */
|
|
11
|
+
passkey?: boolean;
|
|
12
|
+
/** Offers Forgot password? and the reset form. */
|
|
13
|
+
reset?: boolean;
|
|
14
|
+
/** The shortest new password the reset form takes, as the server says. */
|
|
15
|
+
minPassword?: number;
|
|
16
|
+
/** One line at the top of the sign-in form, such as "You are signed out". */
|
|
17
|
+
note?: string;
|
|
18
|
+
/** The app's own fields, above the password. */
|
|
19
|
+
fields?: Snippet;
|
|
20
|
+
/** The app's own buttons, under Sign in and the passkey. */
|
|
21
|
+
actions?: Snippet;
|
|
22
|
+
/** A step the app runs itself, in place of the card's forms. */
|
|
23
|
+
step?: Snippet;
|
|
24
|
+
labelKeys?: Partial<SignInLabelKeys>;
|
|
25
|
+
/** The start of the fields' ids: `-password`, `-code`, `-reset-code`, `-new` and `-confirm` follow it. */
|
|
26
|
+
idPrefix?: string;
|
|
27
|
+
/** Puts the focus in the first empty field when the card opens. */
|
|
28
|
+
autoFocus?: boolean;
|
|
29
|
+
/** Classes for the page around the card. */
|
|
30
|
+
class?: string;
|
|
31
|
+
}
|
|
32
|
+
declare const SignInCard: import("svelte").Component<SignInCardProps, {}, "">;
|
|
33
|
+
type SignInCard = ReturnType<typeof SignInCard>;
|
|
34
|
+
export default SignInCard;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
export interface SignInFieldProps {
|
|
5
|
+
label: string;
|
|
6
|
+
htmlFor: string;
|
|
7
|
+
hint?: string;
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
children: Snippet;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { labelInside } from "@glimstone/core";
|
|
15
|
+
import InfoBubble from "./InfoBubble.svelte";
|
|
16
|
+
|
|
17
|
+
// A field on the sign-in card. Its label stands inside the field until the
|
|
18
|
+
// first key, and above it when the field brings a placeholder or a hint.
|
|
19
|
+
let { label, htmlFor, hint, hidden, children }: SignInFieldProps = $props();
|
|
20
|
+
|
|
21
|
+
let inside = $state(false);
|
|
22
|
+
let was: string | undefined;
|
|
23
|
+
$effect(() => {
|
|
24
|
+
inside = labelInside(document.getElementById(htmlFor) as HTMLInputElement | null, label, hint, was);
|
|
25
|
+
was = label;
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div data-glim="SignInField" class="glim-signin-field" {hidden}>
|
|
30
|
+
<label for={htmlFor} class={inside ? "glim-sr-only" : "glim-signin-label"}>{label}{#if hint}<InfoBubble tip={hint} />{/if}</label>
|
|
31
|
+
{@render children()}
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface SignInFieldProps {
|
|
3
|
+
label: string;
|
|
4
|
+
htmlFor: string;
|
|
5
|
+
hint?: string;
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const SignInField: import("svelte").Component<SignInFieldProps, {}, "">;
|
|
10
|
+
type SignInField = ReturnType<typeof SignInField>;
|
|
11
|
+
export default SignInField;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { SignaturePadText } from "@glimstone/core";
|
|
3
|
+
|
|
4
|
+
export type { SignaturePadText } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface SignaturePadProps {
|
|
7
|
+
label: string;
|
|
8
|
+
/** The strokes as SVG path data, one entry a stroke, bound with `bind:value`. */
|
|
9
|
+
value: string[];
|
|
10
|
+
onChange?: (value: string[]) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
text?: Partial<SignaturePadText>;
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import * as signaturePad from "@zag-js/signature-pad";
|
|
18
|
+
import { normalizeProps, useMachine } from "@zag-js/svelte";
|
|
19
|
+
import { SIGNATURE_PAD_TEXT, pageDir } from "@glimstone/core";
|
|
20
|
+
import Button from "./Button.svelte";
|
|
21
|
+
import { IconResetArrow } from "./glyphs.js";
|
|
22
|
+
|
|
23
|
+
// A signature drawn with a mouse, a pen or a finger, such as the approval of
|
|
24
|
+
// a handover. The strokes are SVG paths, drawn in the text colour on the
|
|
25
|
+
// second surface over a hairline to sign on, and the paths are the value.
|
|
26
|
+
let { label, value = $bindable(), onChange, disabled = false, text }: SignaturePadProps = $props();
|
|
27
|
+
|
|
28
|
+
const words = $derived({ ...SIGNATURE_PAD_TEXT, ...text });
|
|
29
|
+
const id = $props.id();
|
|
30
|
+
|
|
31
|
+
function set(paths: string[]) {
|
|
32
|
+
value = paths;
|
|
33
|
+
onChange?.(paths);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const service = useMachine(signaturePad.machine, () => ({
|
|
37
|
+
id,
|
|
38
|
+
dir: pageDir(),
|
|
39
|
+
paths: value,
|
|
40
|
+
disabled,
|
|
41
|
+
drawing: { fill: "currentColor", size: 2, simulatePressure: true },
|
|
42
|
+
// Controlled, the machine hands a finished stroke over through onDraw. While
|
|
43
|
+
// a stroke is under way it reports it as currentPath.
|
|
44
|
+
onDraw: (d: { paths: string[]; currentPath: string | null }) => d.currentPath === null && set(d.paths),
|
|
45
|
+
translations: { control: words.area, clearTrigger: words.clear },
|
|
46
|
+
}));
|
|
47
|
+
const api = $derived(signaturePad.connect(service, normalizeProps));
|
|
48
|
+
|
|
49
|
+
function clear() {
|
|
50
|
+
api.clear();
|
|
51
|
+
set([]);
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<div data-glim="SignaturePad" {...api.getRootProps()} class="glim-signature">
|
|
56
|
+
<label {...api.getLabelProps()} class="glim-field-label">{label}</label>
|
|
57
|
+
<div {...api.getControlProps()} class="glim-signature-pad">
|
|
58
|
+
<svg {...api.getSegmentProps()} class="glim-signature-ink">
|
|
59
|
+
{#each api.paths as path, i (i)}
|
|
60
|
+
<path {...api.getSegmentPathProps({ path })} />
|
|
61
|
+
{/each}
|
|
62
|
+
{#if api.currentPath}
|
|
63
|
+
<path {...api.getSegmentPathProps({ path: api.currentPath })} />
|
|
64
|
+
{/if}
|
|
65
|
+
</svg>
|
|
66
|
+
<div {...api.getGuideProps()} class="glim-signature-guide"></div>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="glim-signature-foot">
|
|
69
|
+
<Button label={words.clear} labelKey={null} glyph={IconResetArrow} disabled={api.empty || disabled} onClick={clear} />
|
|
70
|
+
</div>
|
|
71
|
+
<input {...api.getHiddenInputProps({ value: api.paths.join(" ") })} />
|
|
72
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SignaturePadText } from "@glimstone/core";
|
|
2
|
+
export type { SignaturePadText } from "@glimstone/core";
|
|
3
|
+
export interface SignaturePadProps {
|
|
4
|
+
label: string;
|
|
5
|
+
/** The strokes as SVG path data, one entry a stroke, bound with `bind:value`. */
|
|
6
|
+
value: string[];
|
|
7
|
+
onChange?: (value: string[]) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
text?: Partial<SignaturePadText>;
|
|
10
|
+
}
|
|
11
|
+
declare const SignaturePad: import("svelte").Component<SignaturePadProps, {}, "value">;
|
|
12
|
+
type SignaturePad = ReturnType<typeof SignaturePad>;
|
|
13
|
+
export default SignaturePad;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface SkeletonRowProps {
|
|
3
|
+
/** Milliseconds before it shows; 0 shows it at once. */
|
|
4
|
+
delay?: number;
|
|
5
|
+
/** The tile at the row's start, for a list whose rows have one. */
|
|
6
|
+
tile?: boolean;
|
|
7
|
+
/** The badge at the row's end, for a list whose rows have one. */
|
|
8
|
+
badge?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { skeletonRowView } from "@glimstone/core";
|
|
15
|
+
import { css } from "./style.js";
|
|
16
|
+
|
|
17
|
+
// A row that holds a ListRow's place while the list loads, so nothing jumps
|
|
18
|
+
// when the rows arrive. It shows only after BUSY_DELAY. The list around it
|
|
19
|
+
// carries aria-busy and says what is loading; the row itself is hidden from
|
|
20
|
+
// assistive technology.
|
|
21
|
+
let { delay, tile = true, badge = true, class: className }: SkeletonRowProps = $props();
|
|
22
|
+
const view = $derived(skeletonRowView({ delay, tile, badge }));
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div data-glim="SkeletonRow" aria-hidden="true" class={className ? `${view.className} ${className}` : view.className} style={css(view.style)}>
|
|
26
|
+
{#if view.tile}<span class="glim-skeleton-block glim-skeleton-tile"></span>{/if}
|
|
27
|
+
<span class="glim-skeleton-block glim-skeleton-name"></span>
|
|
28
|
+
{#if view.badge}<span class="glim-skeleton-block glim-skeleton-badge"></span>{/if}
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SkeletonRowProps {
|
|
2
|
+
/** Milliseconds before it shows; 0 shows it at once. */
|
|
3
|
+
delay?: number;
|
|
4
|
+
/** The tile at the row's start, for a list whose rows have one. */
|
|
5
|
+
tile?: boolean;
|
|
6
|
+
/** The badge at the row's end, for a list whose rows have one. */
|
|
7
|
+
badge?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SkeletonRow: import("svelte").Component<SkeletonRowProps, {}, "">;
|
|
11
|
+
type SkeletonRow = ReturnType<typeof SkeletonRow>;
|
|
12
|
+
export default SkeletonRow;
|