@glimstone/svelte 0.0.0-stage → 4.5.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/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,61 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
import type { FieldWidth } from "@glimstone/core";
|
|
4
|
+
|
|
5
|
+
export type { FieldWidth } from "@glimstone/core";
|
|
6
|
+
|
|
7
|
+
export interface TextFieldProps extends Omit<HTMLInputAttributes, "width" | "class"> {
|
|
8
|
+
/** The accessible name. Inside a FieldRow the row gives it. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Sets a path or a token in monospace. */
|
|
11
|
+
mono?: boolean;
|
|
12
|
+
width?: FieldWidth;
|
|
13
|
+
/** Why the value cannot stand, as a line under the field until it is fixed. */
|
|
14
|
+
error?: string;
|
|
15
|
+
class?: string;
|
|
16
|
+
/** The <input>, bound with `bind:ref`. */
|
|
17
|
+
ref?: HTMLInputElement | null;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { fieldErrorView, textFieldClass } from "@glimstone/core";
|
|
23
|
+
import FieldError from "./FieldError.svelte";
|
|
24
|
+
import { useFieldName } from "./fieldName.js";
|
|
25
|
+
|
|
26
|
+
// A line of text: borderless and filled, focus a step up the ramp (rule 14).
|
|
27
|
+
// The props are a native element's, so a call site swaps
|
|
28
|
+
// `<input class="glim-input"` for `<TextField` and keeps its own listeners;
|
|
29
|
+
// the text is bound with `bind:value`.
|
|
30
|
+
let {
|
|
31
|
+
label,
|
|
32
|
+
mono,
|
|
33
|
+
width,
|
|
34
|
+
error,
|
|
35
|
+
class: className,
|
|
36
|
+
type = "text",
|
|
37
|
+
id,
|
|
38
|
+
"aria-describedby": describedBy,
|
|
39
|
+
value = $bindable(),
|
|
40
|
+
ref = $bindable(null),
|
|
41
|
+
...rest
|
|
42
|
+
}: TextFieldProps = $props();
|
|
43
|
+
|
|
44
|
+
const name = useFieldName(() => label);
|
|
45
|
+
const own = $props.id();
|
|
46
|
+
const err = $derived(fieldErrorView(error, id ?? own, describedBy ?? undefined));
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<input
|
|
50
|
+
data-glim="TextField"
|
|
51
|
+
aria-label={name()}
|
|
52
|
+
{...rest}
|
|
53
|
+
bind:this={ref}
|
|
54
|
+
bind:value
|
|
55
|
+
{id}
|
|
56
|
+
aria-invalid={err.invalid}
|
|
57
|
+
aria-describedby={err.describedBy}
|
|
58
|
+
{type}
|
|
59
|
+
class={`${textFieldClass({ width, mono })} ${className ?? ""}`.trim()}
|
|
60
|
+
/>
|
|
61
|
+
{#if err.errorId}<FieldError id={err.errorId}>{error}</FieldError>{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
import type { FieldWidth } from "@glimstone/core";
|
|
3
|
+
export type { FieldWidth } from "@glimstone/core";
|
|
4
|
+
export interface TextFieldProps extends Omit<HTMLInputAttributes, "width" | "class"> {
|
|
5
|
+
/** The accessible name. Inside a FieldRow the row gives it. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Sets a path or a token in monospace. */
|
|
8
|
+
mono?: boolean;
|
|
9
|
+
width?: FieldWidth;
|
|
10
|
+
/** Why the value cannot stand, as a line under the field until it is fixed. */
|
|
11
|
+
error?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
/** The <input>, bound with `bind:ref`. */
|
|
14
|
+
ref?: HTMLInputElement | null;
|
|
15
|
+
}
|
|
16
|
+
declare const TextField: import("svelte").Component<TextFieldProps, {}, "value" | "ref">;
|
|
17
|
+
type TextField = ReturnType<typeof TextField>;
|
|
18
|
+
export default TextField;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { TimerText } from "@glimstone/core";
|
|
3
|
+
|
|
4
|
+
export type { TimerText } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface TimerProps {
|
|
7
|
+
/** Counts down from startMs to zero rather than up. */
|
|
8
|
+
countdown?: boolean;
|
|
9
|
+
/** Where it starts, in milliseconds. */
|
|
10
|
+
startMs?: number;
|
|
11
|
+
/** Where a count up stops, in milliseconds. */
|
|
12
|
+
targetMs?: number;
|
|
13
|
+
autoStart?: boolean;
|
|
14
|
+
/** Called once a countdown reaches zero or a count up its target. */
|
|
15
|
+
onComplete?: () => void;
|
|
16
|
+
text?: Partial<TimerText>;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import * as timer from "@zag-js/timer";
|
|
22
|
+
import { normalizeProps, useMachine } from "@zag-js/svelte";
|
|
23
|
+
import { TIMER_TEXT } from "@glimstone/core";
|
|
24
|
+
import Button from "./Button.svelte";
|
|
25
|
+
import { IconPause, IconPlay, IconResetArrow } from "./glyphs.js";
|
|
26
|
+
|
|
27
|
+
// A clock that counts up from a start or down to zero, such as the time a
|
|
28
|
+
// test may run. The figure is data and runs left to right in every language,
|
|
29
|
+
// and it takes the accent's ink while it runs, the one moment it is activity.
|
|
30
|
+
let { countdown = false, startMs = 0, targetMs, autoStart = false, onComplete, text }: TimerProps = $props();
|
|
31
|
+
|
|
32
|
+
const words = $derived({ ...TIMER_TEXT, ...text });
|
|
33
|
+
const id = $props.id();
|
|
34
|
+
const service = useMachine(timer.machine, () => ({
|
|
35
|
+
id,
|
|
36
|
+
countdown,
|
|
37
|
+
startMs,
|
|
38
|
+
targetMs,
|
|
39
|
+
autoStart,
|
|
40
|
+
interval: 250,
|
|
41
|
+
onComplete: () => onComplete?.(),
|
|
42
|
+
}));
|
|
43
|
+
const api = $derived(timer.connect(service, normalizeProps));
|
|
44
|
+
const spoken = $derived(words.spoken(api.time.hours, api.time.minutes, api.time.seconds));
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div data-glim="Timer" {...api.getRootProps()} class="glim-timer">
|
|
48
|
+
<div {...api.getAreaProps()} role="timer" aria-label={spoken} data-running={api.running ? "" : undefined} class="glim-timer-figure glim-num">
|
|
49
|
+
<!-- One line, since a line break between the digits would read as a space. -->
|
|
50
|
+
<span {...api.getItemProps({ type: "hours" })}>{api.formattedTime.hours}</span><span {...api.getSeparatorProps()}>:</span><span {...api.getItemProps({ type: "minutes" })}>{api.formattedTime.minutes}</span><span {...api.getSeparatorProps()}>:</span><span {...api.getItemProps({ type: "seconds" })}>{api.formattedTime.seconds}</span>
|
|
51
|
+
</div>
|
|
52
|
+
<div {...api.getControlProps()} class="glim-timer-control">
|
|
53
|
+
{#if api.running}
|
|
54
|
+
<Button label={words.pause} labelKey={null} glyph={IconPause} onClick={() => api.pause()} />
|
|
55
|
+
{:else if api.paused}
|
|
56
|
+
<Button label={words.resume} labelKey={null} glyph={IconPlay} onClick={() => api.resume()} />
|
|
57
|
+
{:else}
|
|
58
|
+
<Button label={words.start} labelKey={null} glyph={IconPlay} onClick={() => api.start()} />
|
|
59
|
+
{/if}
|
|
60
|
+
<Button label={words.reset} labelKey={null} glyph={IconResetArrow} onClick={() => api.reset()} />
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TimerText } from "@glimstone/core";
|
|
2
|
+
export type { TimerText } from "@glimstone/core";
|
|
3
|
+
export interface TimerProps {
|
|
4
|
+
/** Counts down from startMs to zero rather than up. */
|
|
5
|
+
countdown?: boolean;
|
|
6
|
+
/** Where it starts, in milliseconds. */
|
|
7
|
+
startMs?: number;
|
|
8
|
+
/** Where a count up stops, in milliseconds. */
|
|
9
|
+
targetMs?: number;
|
|
10
|
+
autoStart?: boolean;
|
|
11
|
+
/** Called once a countdown reaches zero or a count up its target. */
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
text?: Partial<TimerText>;
|
|
14
|
+
}
|
|
15
|
+
declare const Timer: import("svelte").Component<TimerProps, {}, "">;
|
|
16
|
+
type Timer = ReturnType<typeof Timer>;
|
|
17
|
+
export default Timer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { lift } from "./lift.js";
|
|
3
|
+
import type { TipBubble } from "./bubble.svelte.js";
|
|
4
|
+
|
|
5
|
+
// Lifted to the body, or into an open sheet, so no card's `overflow: hidden` clips it.
|
|
6
|
+
let { state }: { state: TipBubble } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#if state.shown}
|
|
10
|
+
<div {@attach lift} bind:this={state.bubble} id={state.id} role="tooltip" class="glim-bubble glim-fade">{state.text}</div>
|
|
11
|
+
{/if}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
// Boxes a disabled trigger with a tip in a span that still sees the pointer,
|
|
5
|
+
// since a disabled <button> emits no mouse events. Otherwise the trigger
|
|
6
|
+
// renders as it is.
|
|
7
|
+
let { on, show, hide, children }: { on: boolean; show: () => void; hide: () => void; children: Snippet } = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if on}
|
|
11
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
12
|
+
<span class="glim-tip-wrap" onmouseenter={show} onmouseleave={hide}>{@render children()}</span>
|
|
13
|
+
{:else}
|
|
14
|
+
{@render children()}
|
|
15
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
on: boolean;
|
|
4
|
+
show: () => void;
|
|
5
|
+
hide: () => void;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const TipWrap: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type TipWrap = ReturnType<typeof TipWrap>;
|
|
10
|
+
export default TipWrap;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ToastAction, ToastSeverity } from "@glimstone/core";
|
|
3
|
+
|
|
4
|
+
export interface ToastCardProps {
|
|
5
|
+
id: string;
|
|
6
|
+
message: string;
|
|
7
|
+
severity: ToastSeverity;
|
|
8
|
+
/** A button such as Undo. A press runs it and dismisses the toast. */
|
|
9
|
+
action?: ToastAction;
|
|
10
|
+
/** Accessible name for the dismiss button, the same for every toast. */
|
|
11
|
+
dismissLabel: string;
|
|
12
|
+
onDismiss: (id: string) => void;
|
|
13
|
+
onMouseEnter: (id: string) => void;
|
|
14
|
+
onMouseLeave: (id: string) => void;
|
|
15
|
+
onFocus: (id: string) => void;
|
|
16
|
+
onBlur: (id: string) => void;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { MARKS, softBreaks, TOAST_MARKS } from "@glimstone/core";
|
|
22
|
+
import Button from "./Button.svelte";
|
|
23
|
+
import MarkSvg from "./MarkSvg.svelte";
|
|
24
|
+
|
|
25
|
+
// One toast, without state, so a test can mount it with props. Focus is
|
|
26
|
+
// heard on focusin and focusout, so tabbing onto the dismiss button pauses
|
|
27
|
+
// the countdown like a hover does.
|
|
28
|
+
let { id, message, severity, action, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur }: ToastCardProps = $props();
|
|
29
|
+
|
|
30
|
+
function keys(e: KeyboardEvent) {
|
|
31
|
+
if (e.key === "Escape") {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
onDismiss(id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
39
|
+
<div
|
|
40
|
+
data-glim="ToastCard"
|
|
41
|
+
onmouseenter={() => onMouseEnter(id)}
|
|
42
|
+
onmouseleave={() => onMouseLeave(id)}
|
|
43
|
+
onfocusin={() => onFocus(id)}
|
|
44
|
+
onfocusout={() => onBlur(id)}
|
|
45
|
+
onkeydown={keys}
|
|
46
|
+
class="glim-toast glim-toast-card"
|
|
47
|
+
>
|
|
48
|
+
<MarkSvg mark={TOAST_MARKS[severity]} class={`glim-toast-glyph glim-toast-glyph--${severity}`} />
|
|
49
|
+
<div class="glim-toast-body">
|
|
50
|
+
<p class="glim-toast-message">{#each softBreaks(message) as part, i}{#if i > 0}<wbr />{/if}{part}{/each}</p>
|
|
51
|
+
{#if action}
|
|
52
|
+
{@const act = action}
|
|
53
|
+
<Button
|
|
54
|
+
class="glim-toast-action"
|
|
55
|
+
tone="subtle"
|
|
56
|
+
label={act.label}
|
|
57
|
+
labelKey={null}
|
|
58
|
+
onClick={() => {
|
|
59
|
+
act.onClick();
|
|
60
|
+
onDismiss(id);
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
{/if}
|
|
64
|
+
</div>
|
|
65
|
+
<button type="button" onclick={() => onDismiss(id)} aria-label={dismissLabel} class="glim-btn-bare glim-toast-dismiss">
|
|
66
|
+
<MarkSvg mark={MARKS.dismiss} />
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ToastAction, ToastSeverity } from "@glimstone/core";
|
|
2
|
+
export interface ToastCardProps {
|
|
3
|
+
id: string;
|
|
4
|
+
message: string;
|
|
5
|
+
severity: ToastSeverity;
|
|
6
|
+
/** A button such as Undo. A press runs it and dismisses the toast. */
|
|
7
|
+
action?: ToastAction;
|
|
8
|
+
/** Accessible name for the dismiss button, the same for every toast. */
|
|
9
|
+
dismissLabel: string;
|
|
10
|
+
onDismiss: (id: string) => void;
|
|
11
|
+
onMouseEnter: (id: string) => void;
|
|
12
|
+
onMouseLeave: (id: string) => void;
|
|
13
|
+
onFocus: (id: string) => void;
|
|
14
|
+
onBlur: (id: string) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const ToastCard: import("svelte").Component<ToastCardProps, {}, "">;
|
|
17
|
+
type ToastCard = ReturnType<typeof ToastCard>;
|
|
18
|
+
export default ToastCard;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ToastViewportEntry } from "@glimstone/core";
|
|
3
|
+
|
|
4
|
+
export type { ToastViewportEntry } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface ToastViewportProps {
|
|
7
|
+
toasts: ToastViewportEntry[];
|
|
8
|
+
dismissLabel: string;
|
|
9
|
+
onDismiss: (id: string) => void;
|
|
10
|
+
// Four separate events rather than onPause and onResume, because the caller
|
|
11
|
+
// resumes only once hover and focus have both ended (applyEngagement).
|
|
12
|
+
onMouseEnter: (id: string) => void;
|
|
13
|
+
onMouseLeave: (id: string) => void;
|
|
14
|
+
onFocus: (id: string) => void;
|
|
15
|
+
onBlur: (id: string) => void;
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { announce, liveRegionAttrs, toastPoliteness } from "@glimstone/core";
|
|
21
|
+
import ToastCard from "./ToastCard.svelte";
|
|
22
|
+
|
|
23
|
+
// The toast system's presentational half (design-language.md, "Toasts"). It
|
|
24
|
+
// holds no state: the app keeps the queue with the core's toastEngine and its
|
|
25
|
+
// own timers. Toasts render in array order, so the newest sits nearest the
|
|
26
|
+
// bottom edge.
|
|
27
|
+
//
|
|
28
|
+
// A toast never blocks the page: the viewport is `pointer-events: none` and only
|
|
29
|
+
// each card turns them back on, so clicks pass through the empty corner.
|
|
30
|
+
//
|
|
31
|
+
// The viewport holds the page's two live regions for good, and a new toast's
|
|
32
|
+
// message is read out through them. A card that carried a live role itself
|
|
33
|
+
// would be announced on arrival by some screen readers and not by others.
|
|
34
|
+
let { toasts, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur }: ToastViewportProps = $props();
|
|
35
|
+
|
|
36
|
+
const heard = new Set<string>();
|
|
37
|
+
$effect(() => {
|
|
38
|
+
const ids = new Set(toasts.map((t) => t.id));
|
|
39
|
+
for (const id of heard) if (!ids.has(id)) heard.delete(id);
|
|
40
|
+
for (const t of toasts) {
|
|
41
|
+
if (heard.has(t.id)) continue;
|
|
42
|
+
heard.add(t.id);
|
|
43
|
+
announce(t.message, toastPoliteness(t.severity));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<div class="glim-sr-only" {...liveRegionAttrs("polite")}></div>
|
|
49
|
+
<div class="glim-sr-only" {...liveRegionAttrs("assertive")}></div>
|
|
50
|
+
<div data-glim="ToastViewport" class="glim-toast-stack">
|
|
51
|
+
{#each toasts as t (t.id)}
|
|
52
|
+
<ToastCard
|
|
53
|
+
id={t.id}
|
|
54
|
+
message={t.message}
|
|
55
|
+
severity={t.severity}
|
|
56
|
+
action={t.action}
|
|
57
|
+
{dismissLabel}
|
|
58
|
+
{onDismiss}
|
|
59
|
+
{onMouseEnter}
|
|
60
|
+
{onMouseLeave}
|
|
61
|
+
{onFocus}
|
|
62
|
+
{onBlur}
|
|
63
|
+
/>
|
|
64
|
+
{/each}
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToastViewportEntry } from "@glimstone/core";
|
|
2
|
+
export type { ToastViewportEntry } from "@glimstone/core";
|
|
3
|
+
export interface ToastViewportProps {
|
|
4
|
+
toasts: ToastViewportEntry[];
|
|
5
|
+
dismissLabel: string;
|
|
6
|
+
onDismiss: (id: string) => void;
|
|
7
|
+
onMouseEnter: (id: string) => void;
|
|
8
|
+
onMouseLeave: (id: string) => void;
|
|
9
|
+
onFocus: (id: string) => void;
|
|
10
|
+
onBlur: (id: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const ToastViewport: import("svelte").Component<ToastViewportProps, {}, "">;
|
|
13
|
+
type ToastViewport = ReturnType<typeof ToastViewport>;
|
|
14
|
+
export default ToastViewport;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
+
|
|
4
|
+
export interface ToggleProps extends Omit<HTMLButtonAttributes, "onchange" | "children" | "type" | "role" | "class" | "style"> {
|
|
5
|
+
/** Current on/off state, bound with `bind:checked`. */
|
|
6
|
+
checked: boolean;
|
|
7
|
+
/** Called with the flipped value when the switch is activated. */
|
|
8
|
+
onChange?: (next: boolean) => void;
|
|
9
|
+
/** Always used as the accessible name; shown as visible text unless hideLabel. Inside a FieldRow the row gives it. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Suppress the visible caption; the text stays as aria-label. Use it only
|
|
12
|
+
* when the caller draws the same text right next to the switch, never
|
|
13
|
+
* because a card title further up already says it. */
|
|
14
|
+
hideLabel?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Why the switch cannot be flipped right now, as OLED while Light is chosen
|
|
17
|
+
* (`oledRefusal`). It keeps its state and its focus, its track dims, a press
|
|
18
|
+
* shakes it, and the reason is its bubble, or a line under the row on a
|
|
19
|
+
* touch screen. */
|
|
20
|
+
refused?: string;
|
|
21
|
+
/** Extra classes for the outer wrapper (e.g. row-alignment nudges). */
|
|
22
|
+
class?: string;
|
|
23
|
+
style?: string;
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script lang="ts">
|
|
28
|
+
import { shake } from "@glimstone/core";
|
|
29
|
+
import { useFieldName } from "./fieldName.js";
|
|
30
|
+
import { useTipBubble } from "./bubble.svelte.js";
|
|
31
|
+
import TipBubble from "./TipBubble.svelte";
|
|
32
|
+
|
|
33
|
+
// The shared switch control. The label is always the accessible name;
|
|
34
|
+
// `hideLabel` only drops the visible caption. The other props of a <button>
|
|
35
|
+
// go to the switch, which is what a script asks for its state; `class` and
|
|
36
|
+
// `style` go to the frame, which carries the row's layout. Inside a FieldRow
|
|
37
|
+
// the row names the switch and draws the words.
|
|
38
|
+
let { checked = $bindable(), onChange, label, hideLabel = false, disabled, refused, class: className, style, onclick, ...rest }: ToggleProps = $props();
|
|
39
|
+
|
|
40
|
+
const name = useFieldName(() => label);
|
|
41
|
+
const tip = useTipBubble(() => refused);
|
|
42
|
+
const reason = $props.id();
|
|
43
|
+
let frame: HTMLSpanElement;
|
|
44
|
+
let stopShake: (() => void) | undefined;
|
|
45
|
+
$effect(() => () => stopShake?.());
|
|
46
|
+
|
|
47
|
+
function press(e: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
48
|
+
onclick?.(e);
|
|
49
|
+
if (!refused) {
|
|
50
|
+
checked = !checked;
|
|
51
|
+
onChange?.(checked);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
stopShake?.();
|
|
55
|
+
stopShake = shake(frame);
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<span data-glim="Toggle" bind:this={frame} class={`glim-toggle${className ? ` ${className}` : ""}`} {style}>
|
|
60
|
+
{#if label !== undefined && !hideLabel}<span class="glim-toggle-label">{label}</span>{/if}
|
|
61
|
+
<!-- No title: the label is always visible beside the switch, so a tooltip
|
|
62
|
+
would only repeat it. A refused switch's bubble says why. -->
|
|
63
|
+
<button
|
|
64
|
+
{...rest}
|
|
65
|
+
bind:this={tip.trigger}
|
|
66
|
+
type="button"
|
|
67
|
+
role="switch"
|
|
68
|
+
aria-checked={checked}
|
|
69
|
+
aria-label={name()}
|
|
70
|
+
aria-disabled={refused ? true : undefined}
|
|
71
|
+
aria-describedby={refused ? reason : rest["aria-describedby"]}
|
|
72
|
+
{disabled}
|
|
73
|
+
onclick={press}
|
|
74
|
+
onmouseenter={() => refused && tip.show()}
|
|
75
|
+
onmouseleave={tip.hide}
|
|
76
|
+
onfocus={() => refused && tip.showOnFocus()}
|
|
77
|
+
onblur={tip.hide}
|
|
78
|
+
class="glim-toggle-track"
|
|
79
|
+
>
|
|
80
|
+
<span class="glim-toggle-thumb"></span>
|
|
81
|
+
</button>
|
|
82
|
+
</span>
|
|
83
|
+
{#if refused}<span id={reason} class="glim-toggle-refusal">{refused}</span>{/if}
|
|
84
|
+
<TipBubble state={tip} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
|
+
export interface ToggleProps extends Omit<HTMLButtonAttributes, "onchange" | "children" | "type" | "role" | "class" | "style"> {
|
|
3
|
+
/** Current on/off state, bound with `bind:checked`. */
|
|
4
|
+
checked: boolean;
|
|
5
|
+
/** Called with the flipped value when the switch is activated. */
|
|
6
|
+
onChange?: (next: boolean) => void;
|
|
7
|
+
/** Always used as the accessible name; shown as visible text unless hideLabel. Inside a FieldRow the row gives it. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Suppress the visible caption; the text stays as aria-label. Use it only
|
|
10
|
+
* when the caller draws the same text right next to the switch, never
|
|
11
|
+
* because a card title further up already says it. */
|
|
12
|
+
hideLabel?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Why the switch cannot be flipped right now, as OLED while Light is chosen
|
|
15
|
+
* (`oledRefusal`). It keeps its state and its focus, its track dims, a press
|
|
16
|
+
* shakes it, and the reason is its bubble, or a line under the row on a
|
|
17
|
+
* touch screen. */
|
|
18
|
+
refused?: string;
|
|
19
|
+
/** Extra classes for the outer wrapper (e.g. row-alignment nudges). */
|
|
20
|
+
class?: string;
|
|
21
|
+
style?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const Toggle: import("svelte").Component<ToggleProps, {}, "checked">;
|
|
24
|
+
type Toggle = ReturnType<typeof Toggle>;
|
|
25
|
+
export default Toggle;
|
package/dist/Tour.svelte
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { TourStep, TourText } from "@glimstone/core";
|
|
3
|
+
|
|
4
|
+
export type { TourStep, TourText } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface TourProps {
|
|
7
|
+
steps: readonly TourStep[];
|
|
8
|
+
/** Bound with `bind:open`. Turning it on starts the tour at its first step. It turns off once the tour ends. */
|
|
9
|
+
open: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
text?: Partial<TourText>;
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { untrack } from "svelte";
|
|
17
|
+
import * as tour from "@zag-js/tour";
|
|
18
|
+
import { normalizeProps, useMachine } from "@zag-js/svelte";
|
|
19
|
+
import { TOUR_TEXT, pageDir, tourSteps } from "@glimstone/core";
|
|
20
|
+
import Badge from "./Badge.svelte";
|
|
21
|
+
import Button from "./Button.svelte";
|
|
22
|
+
import { IconBack, IconCheck, IconForward } from "./glyphs.js";
|
|
23
|
+
import { lift } from "./lift.js";
|
|
24
|
+
|
|
25
|
+
// A short walk through a screen, one step a part of it, such as the first
|
|
26
|
+
// start of a new page. The page behind is darkened and blurred like the page
|
|
27
|
+
// behind a window, with the part the step points at left clear, and the step
|
|
28
|
+
// is a small window beside it: its title in the notch, Back and Next in its foot.
|
|
29
|
+
let { steps, open = $bindable(), onOpenChange, text }: TourProps = $props();
|
|
30
|
+
|
|
31
|
+
const words = $derived({ ...TOUR_TEXT, ...text });
|
|
32
|
+
const id = $props.id();
|
|
33
|
+
const service = useMachine(tour.machine, () => ({
|
|
34
|
+
id,
|
|
35
|
+
dir: pageDir(),
|
|
36
|
+
steps: tourSteps(steps),
|
|
37
|
+
onStatusChange: (d: { status: string }) => {
|
|
38
|
+
if (d.status === "dismissed" || d.status === "completed" || d.status === "skipped") {
|
|
39
|
+
open = false;
|
|
40
|
+
onOpenChange?.(false);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
}));
|
|
44
|
+
const api = $derived(tour.connect(service, normalizeProps));
|
|
45
|
+
// The machine ends a tour through its close trigger. Next on the last step
|
|
46
|
+
// would only stay where it is.
|
|
47
|
+
const end = () => (api.getCloseTriggerProps() as { onclick: () => void }).onclick();
|
|
48
|
+
$effect(() => {
|
|
49
|
+
if (open) untrack(() => !api.open && api.start());
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
{#if api.open && api.step}
|
|
54
|
+
<div {@attach lift} data-glim="Tour" class="glim-tour-layer">
|
|
55
|
+
<div {...api.getBackdropProps()} class="glim-tour-backdrop"></div>
|
|
56
|
+
<div {...api.getSpotlightProps()} class="glim-tour-spotlight"></div>
|
|
57
|
+
<div {...api.getPositionerProps()} class="glim-tour-positioner">
|
|
58
|
+
<div {...api.getContentProps()} class="glim-tour">
|
|
59
|
+
<h2 {...api.getTitleProps()} class="glim-panel-heading">
|
|
60
|
+
<Badge tone="heading" size="heading" wrap>{api.step.title}</Badge>
|
|
61
|
+
</h2>
|
|
62
|
+
<p {...api.getDescriptionProps()} class="glim-tour-text">{api.step.description}</p>
|
|
63
|
+
<div class="glim-tour-foot">
|
|
64
|
+
<span {...api.getProgressTextProps()} class="glim-tour-progress glim-num">{words.progress(api.stepIndex + 1, api.totalSteps)}</span>
|
|
65
|
+
<Button label={words.back} labelKey={null} glyph={IconBack} disabled={!api.hasPrevStep} onClick={() => api.prev()} />
|
|
66
|
+
{#if api.lastStep}
|
|
67
|
+
<Button label={words.close} labelKey={null} glyph={IconCheck} tone="accent" onClick={end} />
|
|
68
|
+
{:else}
|
|
69
|
+
<Button label={words.next} labelKey={null} glyph={IconForward} tone="accent" onClick={() => api.next()} />
|
|
70
|
+
{/if}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TourStep, TourText } from "@glimstone/core";
|
|
2
|
+
export type { TourStep, TourText } from "@glimstone/core";
|
|
3
|
+
export interface TourProps {
|
|
4
|
+
steps: readonly TourStep[];
|
|
5
|
+
/** Bound with `bind:open`. Turning it on starts the tour at its first step. It turns off once the tour ends. */
|
|
6
|
+
open: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
text?: Partial<TourText>;
|
|
9
|
+
}
|
|
10
|
+
declare const Tour: import("svelte").Component<TourProps, {}, "open">;
|
|
11
|
+
type Tour = ReturnType<typeof Tour>;
|
|
12
|
+
export default Tour;
|