@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,31 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
export interface EmptyStateProps {
|
|
5
|
+
/** The page's own glyph, so the empty state echoes the place it is on. */
|
|
6
|
+
glyph?: Snippet;
|
|
7
|
+
/** What is missing, such as "No backups yet" or "No backups match the filter". */
|
|
8
|
+
title: string;
|
|
9
|
+
/** One line on how to get there; anything longer goes into a bubble or a window. */
|
|
10
|
+
hint?: string;
|
|
11
|
+
/** A Button that gets out of the empty state, such as "Add a backup" or "Clear the filter". */
|
|
12
|
+
action?: Snippet;
|
|
13
|
+
/** It stands inside a card, which already provides the surface. */
|
|
14
|
+
nested?: boolean;
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
// What a list, table or panel shows when it holds nothing: a muted, oversized
|
|
20
|
+
// glyph, a title, an optional hint and an optional action. "Nothing here yet"
|
|
21
|
+
// and "nothing matches the filter" take the same shape with different words,
|
|
22
|
+
// so somebody is not sent looking for a filter that was never set.
|
|
23
|
+
let { glyph, title, hint, action, nested = false }: EmptyStateProps = $props();
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div data-glim="EmptyState" data-glim-title={title} class={nested ? "glim-empty" : "glim-card glim-empty"}>
|
|
27
|
+
{#if glyph}<span class="glim-empty-glyph" aria-hidden="true">{@render glyph()}</span>{/if}
|
|
28
|
+
<p class="glim-empty-title">{title}</p>
|
|
29
|
+
{#if hint}<p class="glim-empty-hint">{hint}</p>{/if}
|
|
30
|
+
{@render action?.()}
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface EmptyStateProps {
|
|
3
|
+
/** The page's own glyph, so the empty state echoes the place it is on. */
|
|
4
|
+
glyph?: Snippet;
|
|
5
|
+
/** What is missing, such as "No backups yet" or "No backups match the filter". */
|
|
6
|
+
title: string;
|
|
7
|
+
/** One line on how to get there; anything longer goes into a bubble or a window. */
|
|
8
|
+
hint?: string;
|
|
9
|
+
/** A Button that gets out of the empty state, such as "Add a backup" or "Clear the filter". */
|
|
10
|
+
action?: Snippet;
|
|
11
|
+
/** It stands inside a card, which already provides the surface. */
|
|
12
|
+
nested?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const EmptyState: import("svelte").Component<EmptyStateProps, {}, "">;
|
|
15
|
+
type EmptyState = ReturnType<typeof EmptyState>;
|
|
16
|
+
export default EmptyState;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
export interface FieldErrorProps {
|
|
5
|
+
id: string;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { TOAST_MARKS } from "@glimstone/core";
|
|
12
|
+
import MarkSvg from "./MarkSvg.svelte";
|
|
13
|
+
|
|
14
|
+
// The line under a field whose value it cannot take, with the fault mark.
|
|
15
|
+
// The fields draw it from their `error`; an app's own field draws it with
|
|
16
|
+
// the id its aria-describedby names.
|
|
17
|
+
let { id, children }: FieldErrorProps = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<span data-glim="FieldError" {id} class="glim-field-error"><MarkSvg mark={TOAST_MARKS.fail} />{@render children()}</span>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface FieldErrorProps {
|
|
3
|
+
id: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const FieldError: import("svelte").Component<FieldErrorProps, {}, "">;
|
|
7
|
+
type FieldError = ReturnType<typeof FieldError>;
|
|
8
|
+
export default FieldError;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import type { PillTone } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface FieldRowProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "class"> {
|
|
7
|
+
/** The row's name, and the accessible name of the control in it. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Draws the words in other markup, such as a quiet "optional". The name stays `label`. */
|
|
10
|
+
drawn?: Snippet;
|
|
11
|
+
/** What the row does, drawn as an "(i)" beside the name. */
|
|
12
|
+
hint?: string;
|
|
13
|
+
/** A row with only a value to show holds it as a pill. */
|
|
14
|
+
value?: string | number;
|
|
15
|
+
/** The pill's tone. */
|
|
16
|
+
tone?: PillTone;
|
|
17
|
+
/** In a FieldRowGroup with columns, spans all of them. */
|
|
18
|
+
wide?: boolean;
|
|
19
|
+
/** The control. */
|
|
20
|
+
children?: Snippet;
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { getContext, setContext } from "svelte";
|
|
27
|
+
import { pressRowControl } from "@glimstone/core";
|
|
28
|
+
import { FIELD_ROW, FIELD_ROW_GROUP } from "./fieldName.js";
|
|
29
|
+
import InfoBubble from "./InfoBubble.svelte";
|
|
30
|
+
import Pill from "./Pill.svelte";
|
|
31
|
+
|
|
32
|
+
// One labelled row of a card or a window (rule 35): the name at its start and
|
|
33
|
+
// the control at its end, which takes its accessible name from `label`.
|
|
34
|
+
let { label, drawn, hint, value, tone, wide, children, class: className, ...rest }: FieldRowProps = $props();
|
|
35
|
+
|
|
36
|
+
setContext(FIELD_ROW, () => label);
|
|
37
|
+
const inGroup = getContext<boolean | undefined>(FIELD_ROW_GROUP) ?? false;
|
|
38
|
+
let row: HTMLDivElement;
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
{#snippet control()}
|
|
42
|
+
{#if children}{@render children()}{:else if value !== undefined}<Pill class="glim-num" {tone}>{value}</Pill>{/if}
|
|
43
|
+
{/snippet}
|
|
44
|
+
|
|
45
|
+
<div data-glim="FieldRow" {...rest} bind:this={row} class={["glim-field-row", wide && "glim-field-row--wide", className].filter(Boolean).join(" ")}>
|
|
46
|
+
<span class="glim-field-row-name">
|
|
47
|
+
<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->
|
|
48
|
+
<span class="glim-field-row-label" onclick={() => pressRowControl(row)}>{#if drawn}{@render drawn()}{:else}{label}{/if}</span>
|
|
49
|
+
{#if hint}<InfoBubble tip={hint} />{/if}
|
|
50
|
+
</span>
|
|
51
|
+
{#if inGroup}<span class="glim-field-row-controls">{@render control()}</span>{:else}{@render control()}{/if}
|
|
52
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { PillTone } from "@glimstone/core";
|
|
4
|
+
export interface FieldRowProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "class"> {
|
|
5
|
+
/** The row's name, and the accessible name of the control in it. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Draws the words in other markup, such as a quiet "optional". The name stays `label`. */
|
|
8
|
+
drawn?: Snippet;
|
|
9
|
+
/** What the row does, drawn as an "(i)" beside the name. */
|
|
10
|
+
hint?: string;
|
|
11
|
+
/** A row with only a value to show holds it as a pill. */
|
|
12
|
+
value?: string | number;
|
|
13
|
+
/** The pill's tone. */
|
|
14
|
+
tone?: PillTone;
|
|
15
|
+
/** In a FieldRowGroup with columns, spans all of them. */
|
|
16
|
+
wide?: boolean;
|
|
17
|
+
/** The control. */
|
|
18
|
+
children?: Snippet;
|
|
19
|
+
class?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const FieldRow: import("svelte").Component<FieldRowProps, {}, "">;
|
|
22
|
+
type FieldRow = ReturnType<typeof FieldRow>;
|
|
23
|
+
export default FieldRow;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
export interface FieldRowGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "class" | "style" | "children"> {
|
|
6
|
+
/** The FieldRows. */
|
|
7
|
+
children: Snippet;
|
|
8
|
+
/** Rows side by side, each column lining up its own names. A `wide` row spans them all. */
|
|
9
|
+
columns?: 1 | 2;
|
|
10
|
+
class?: string;
|
|
11
|
+
style?: string;
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { setContext } from "svelte";
|
|
17
|
+
import { FIELD_ROW_GROUP } from "./fieldName.js";
|
|
18
|
+
|
|
19
|
+
// Rows that share one column for their names, as wide as the longest, so fields
|
|
20
|
+
// that grow start at one edge. The rows stand directly inside it.
|
|
21
|
+
let { children, columns, class: className, style, ...rest }: FieldRowGroupProps = $props();
|
|
22
|
+
|
|
23
|
+
setContext(FIELD_ROW_GROUP, true);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div
|
|
27
|
+
data-glim="FieldRowGroup"
|
|
28
|
+
{...rest}
|
|
29
|
+
style={columns ? [style, `--field-columns: ${columns}`].filter(Boolean).join("; ") : style}
|
|
30
|
+
class={className ? `glim-field-row-group ${className}` : "glim-field-row-group"}
|
|
31
|
+
>
|
|
32
|
+
{@render children()}
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
export interface FieldRowGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "class" | "style" | "children"> {
|
|
4
|
+
/** The FieldRows. */
|
|
5
|
+
children: Snippet;
|
|
6
|
+
/** Rows side by side, each column lining up its own names. A `wide` row spans them all. */
|
|
7
|
+
columns?: 1 | 2;
|
|
8
|
+
class?: string;
|
|
9
|
+
style?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const FieldRowGroup: import("svelte").Component<FieldRowGroupProps, {}, "">;
|
|
12
|
+
type FieldRowGroup = ReturnType<typeof FieldRowGroup>;
|
|
13
|
+
export default FieldRowGroup;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { FileUploadText } from "@glimstone/core";
|
|
3
|
+
|
|
4
|
+
export type { FileRefusal, FileUploadText } from "@glimstone/core";
|
|
5
|
+
|
|
6
|
+
export interface FileUploadProps {
|
|
7
|
+
label: string;
|
|
8
|
+
/** The files, bound with `bind:value`. */
|
|
9
|
+
value: File[];
|
|
10
|
+
onChange?: (files: File[]) => void;
|
|
11
|
+
/** The kinds of file it takes, as media types such as "image/*" or "application/json". */
|
|
12
|
+
accept?: string[];
|
|
13
|
+
maxFiles?: number;
|
|
14
|
+
/** The largest file it takes, in bytes. */
|
|
15
|
+
maxFileSize?: number;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
text?: Partial<FileUploadText>;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import * as fileUpload from "@zag-js/file-upload";
|
|
23
|
+
import { normalizeProps, useMachine } from "@zag-js/svelte";
|
|
24
|
+
import { FILE_UPLOAD_TEXT, formatFileSize, pageDir, type FileRefusal } from "@glimstone/core";
|
|
25
|
+
import IconButton from "./IconButton.svelte";
|
|
26
|
+
import { IconClose, IconUpload } from "./glyphs.js";
|
|
27
|
+
|
|
28
|
+
// Files handed to the app by dropping them or from the picker, such as a
|
|
29
|
+
// settings file to import. The drop zone is itself the button that opens the
|
|
30
|
+
// picker, so there is one control and one stop for Tab. The files stand under
|
|
31
|
+
// it as rows, and a refused one is named with its reason.
|
|
32
|
+
let { label, value = $bindable(), onChange, accept, maxFiles = 1, maxFileSize, disabled = false, text }: FileUploadProps = $props();
|
|
33
|
+
|
|
34
|
+
const words = $derived({ ...FILE_UPLOAD_TEXT, ...text });
|
|
35
|
+
const id = $props.id();
|
|
36
|
+
const service = useMachine(fileUpload.machine, () => ({
|
|
37
|
+
id,
|
|
38
|
+
dir: pageDir(),
|
|
39
|
+
acceptedFiles: value,
|
|
40
|
+
accept: accept as fileUpload.Props["accept"],
|
|
41
|
+
maxFiles,
|
|
42
|
+
maxFileSize,
|
|
43
|
+
disabled,
|
|
44
|
+
onFileChange: (d: { acceptedFiles: File[] }) => {
|
|
45
|
+
value = d.acceptedFiles;
|
|
46
|
+
onChange?.(d.acceptedFiles);
|
|
47
|
+
},
|
|
48
|
+
translations: { dropzone: words.drop, deleteFile: (file: File) => words.remove(file.name) },
|
|
49
|
+
}));
|
|
50
|
+
const api = $derived(fileUpload.connect(service, normalizeProps));
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<div data-glim="FileUpload" {...api.getRootProps()} class="glim-upload">
|
|
54
|
+
<label {...api.getLabelProps()} class="glim-field-label">{label}</label>
|
|
55
|
+
<div {...api.getDropzoneProps()} class="glim-upload-drop">
|
|
56
|
+
{@render IconUpload()}
|
|
57
|
+
<span class="glim-upload-words">{words.drop}</span>
|
|
58
|
+
</div>
|
|
59
|
+
<input {...api.getHiddenInputProps()} />
|
|
60
|
+
{#if api.acceptedFiles.length > 0}
|
|
61
|
+
<ul {...api.getItemGroupProps()} class="glim-upload-files">
|
|
62
|
+
{#each api.acceptedFiles as file (`${file.name}-${file.size}`)}
|
|
63
|
+
<li {...api.getItemProps({ file })} class="glim-upload-file">
|
|
64
|
+
<span {...api.getItemNameProps({ file })} class="glim-upload-name">{file.name}</span>
|
|
65
|
+
<span {...api.getItemSizeTextProps({ file })} class="glim-upload-size glim-num">{formatFileSize(file.size)}</span>
|
|
66
|
+
<IconButton tip={words.remove(file.name)} glyph={IconClose} onclick={() => api.deleteFile(file)} />
|
|
67
|
+
</li>
|
|
68
|
+
{/each}
|
|
69
|
+
</ul>
|
|
70
|
+
{/if}
|
|
71
|
+
{#each api.rejectedFiles as { file, errors } (`${file.name}-${file.size}`)}
|
|
72
|
+
<p class="glim-field-error">{words.refused(file.name, errors[0] as FileRefusal)}</p>
|
|
73
|
+
{/each}
|
|
74
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FileUploadText } from "@glimstone/core";
|
|
2
|
+
export type { FileRefusal, FileUploadText } from "@glimstone/core";
|
|
3
|
+
export interface FileUploadProps {
|
|
4
|
+
label: string;
|
|
5
|
+
/** The files, bound with `bind:value`. */
|
|
6
|
+
value: File[];
|
|
7
|
+
onChange?: (files: File[]) => void;
|
|
8
|
+
/** The kinds of file it takes, as media types such as "image/*" or "application/json". */
|
|
9
|
+
accept?: string[];
|
|
10
|
+
maxFiles?: number;
|
|
11
|
+
/** The largest file it takes, in bytes. */
|
|
12
|
+
maxFileSize?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
text?: Partial<FileUploadText>;
|
|
15
|
+
}
|
|
16
|
+
declare const FileUpload: import("svelte").Component<FileUploadProps, {}, "value">;
|
|
17
|
+
type FileUpload = ReturnType<typeof FileUpload>;
|
|
18
|
+
export default FileUpload;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { FloatingPanelText, PanelSize } from "@glimstone/core";
|
|
4
|
+
|
|
5
|
+
export type { FloatingPanelText, PanelSize } from "@glimstone/core";
|
|
6
|
+
|
|
7
|
+
export interface FloatingPanelProps {
|
|
8
|
+
title: string;
|
|
9
|
+
/** Whether it is open, bound with `bind:open`. */
|
|
10
|
+
open: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
/** The size it opens at. */
|
|
13
|
+
defaultSize?: PanelSize;
|
|
14
|
+
resizable?: boolean;
|
|
15
|
+
children: Snippet;
|
|
16
|
+
text?: Partial<FloatingPanelText>;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import * as floatingPanel from "@zag-js/floating-panel";
|
|
22
|
+
import { normalizeProps, useMachine } from "@zag-js/svelte";
|
|
23
|
+
import { FLOATING_PANEL_TEXT, pageDir } from "@glimstone/core";
|
|
24
|
+
import Badge from "./Badge.svelte";
|
|
25
|
+
import Button from "./Button.svelte";
|
|
26
|
+
import { IconClose, IconWindowMaximise, IconWindowMinimise, IconWindowRestore } from "./glyphs.js";
|
|
27
|
+
import { lift } from "./lift.js";
|
|
28
|
+
|
|
29
|
+
// A window that stays open beside the work, such as a transfer log, and that
|
|
30
|
+
// somebody moves by its head and sizes by its edges. It is a window like any
|
|
31
|
+
// other (rule 15): the same surface and radius, its title in the notch and its
|
|
32
|
+
// way out in the foot, at the float step since nothing behind it is darkened.
|
|
33
|
+
let {
|
|
34
|
+
title,
|
|
35
|
+
open = $bindable(),
|
|
36
|
+
onOpenChange,
|
|
37
|
+
defaultSize = { width: 360, height: 280 },
|
|
38
|
+
resizable = true,
|
|
39
|
+
children,
|
|
40
|
+
text,
|
|
41
|
+
}: FloatingPanelProps = $props();
|
|
42
|
+
|
|
43
|
+
const AXES = ["n", "e", "s", "w", "ne", "se", "sw", "nw"] as const;
|
|
44
|
+
const words = $derived({ ...FLOATING_PANEL_TEXT, ...text });
|
|
45
|
+
const id = $props.id();
|
|
46
|
+
const service = useMachine(floatingPanel.machine, () => ({
|
|
47
|
+
id,
|
|
48
|
+
dir: pageDir(),
|
|
49
|
+
open,
|
|
50
|
+
defaultSize,
|
|
51
|
+
resizable,
|
|
52
|
+
strategy: "fixed" as const,
|
|
53
|
+
closeOnEscape: true,
|
|
54
|
+
onOpenChange: (d: { open: boolean }) => {
|
|
55
|
+
open = d.open;
|
|
56
|
+
onOpenChange?.(d.open);
|
|
57
|
+
},
|
|
58
|
+
translations: { minimize: words.minimize, maximize: words.maximize, restore: words.restore },
|
|
59
|
+
}));
|
|
60
|
+
const api = $derived(floatingPanel.connect(service, normalizeProps));
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<div {@attach lift} data-glim="FloatingPanel" class="glim-fpanel-layer">
|
|
64
|
+
<div {...api.getPositionerProps()} class="glim-fpanel-positioner">
|
|
65
|
+
<div {...api.getContentProps()} class="glim-fpanel">
|
|
66
|
+
<div {...api.getDragTriggerProps()} class="glim-fpanel-drag">
|
|
67
|
+
<div {...api.getHeaderProps()} class="glim-fpanel-head">
|
|
68
|
+
<h2 {...api.getTitleProps()} class="glim-panel-heading">
|
|
69
|
+
<Badge tone="heading" size="heading" wrap>{title}</Badge>
|
|
70
|
+
</h2>
|
|
71
|
+
<div {...api.getControlProps()} class="glim-fpanel-control">
|
|
72
|
+
<button {...api.getStageTriggerProps({ stage: "minimized" })} class="glim-btn-bare glim-icon-btn">{@render IconWindowMinimise()}</button>
|
|
73
|
+
<button {...api.getStageTriggerProps({ stage: "maximized" })} class="glim-btn-bare glim-icon-btn">{@render IconWindowMaximise()}</button>
|
|
74
|
+
<button {...api.getStageTriggerProps({ stage: "default" })} class="glim-btn-bare glim-icon-btn">{@render IconWindowRestore()}</button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div {...api.getBodyProps()} class="glim-fpanel-body">{@render children()}</div>
|
|
79
|
+
<div class="glim-fpanel-foot">
|
|
80
|
+
<Button label={words.close} labelKey={null} glyph={IconClose} onClick={() => api.setOpen(false)} />
|
|
81
|
+
</div>
|
|
82
|
+
{#if resizable}
|
|
83
|
+
{#each AXES as axis (axis)}
|
|
84
|
+
<div {...api.getResizeTriggerProps({ axis })} class="glim-fpanel-edge"></div>
|
|
85
|
+
{/each}
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { FloatingPanelText, PanelSize } from "@glimstone/core";
|
|
3
|
+
export type { FloatingPanelText, PanelSize } from "@glimstone/core";
|
|
4
|
+
export interface FloatingPanelProps {
|
|
5
|
+
title: string;
|
|
6
|
+
/** Whether it is open, bound with `bind:open`. */
|
|
7
|
+
open: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
/** The size it opens at. */
|
|
10
|
+
defaultSize?: PanelSize;
|
|
11
|
+
resizable?: boolean;
|
|
12
|
+
children: Snippet;
|
|
13
|
+
text?: Partial<FloatingPanelText>;
|
|
14
|
+
}
|
|
15
|
+
declare const FloatingPanel: import("svelte").Component<FloatingPanelProps, {}, "open">;
|
|
16
|
+
type FloatingPanel = ReturnType<typeof FloatingPanel>;
|
|
17
|
+
export default FloatingPanel;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type {
|
|
4
|
+
ChangeAnswer,
|
|
5
|
+
FortressAnswer,
|
|
6
|
+
FortressApp,
|
|
7
|
+
FortressInstance,
|
|
8
|
+
FortressLabelKeys,
|
|
9
|
+
FortressPermission,
|
|
10
|
+
FortressText,
|
|
11
|
+
PhraseAnswer,
|
|
12
|
+
ToastSeverity,
|
|
13
|
+
} from "@glimstone/core";
|
|
14
|
+
|
|
15
|
+
export type { ChangeAnswer, FortressAnswer, FortressLabelKeys, FortressText, PhraseAnswer } from "@glimstone/core";
|
|
16
|
+
|
|
17
|
+
export interface FortressProps {
|
|
18
|
+
text: FortressText;
|
|
19
|
+
/** The interface language, for counts and lists. */
|
|
20
|
+
lang: string;
|
|
21
|
+
/** The app showing the page. */
|
|
22
|
+
app: { id: string; name: string; logo?: string };
|
|
23
|
+
joined: boolean;
|
|
24
|
+
/** The other apps of the fortress, each with its instances. */
|
|
25
|
+
apps: FortressApp[];
|
|
26
|
+
permissions: FortressPermission[];
|
|
27
|
+
onPermission: (id: string, on: boolean) => Promise<FortressAnswer>;
|
|
28
|
+
/** Puts the small confirmation of a saved permission, or the reason it failed, into the app's toasts. */
|
|
29
|
+
notify?: (message: string, severity: ToastSeverity) => void;
|
|
30
|
+
onJoin: (words: string[]) => Promise<FortressAnswer>;
|
|
31
|
+
/** Removes an instance, of this app or another. Without it no other app offers Remove. */
|
|
32
|
+
onRemove?: (id: string) => Promise<FortressAnswer>;
|
|
33
|
+
/** `password` is set where `phrasePassword` asks for it first. Without it there is no Show phrase. */
|
|
34
|
+
onShowPhrase?: (password?: string) => Promise<PhraseAnswer>;
|
|
35
|
+
/** Offered right after a removal and beside `removed`, since until the phrase changes the fortress takes no new app. */
|
|
36
|
+
onChangePhrase?: () => Promise<ChangeAnswer>;
|
|
37
|
+
/** The instances removed since the phrase last changed, by name ("Bravo on Atlas"). While there are any, a line says that no new app can join. */
|
|
38
|
+
removed?: string[];
|
|
39
|
+
/** Another member removed this app, so the empty place says so until it joins again. */
|
|
40
|
+
removedHere?: boolean;
|
|
41
|
+
/** Whether the other apps show. Without it the switch keeps its state on this device. */
|
|
42
|
+
showOthers?: boolean;
|
|
43
|
+
onShowOthers?: (on: boolean) => void;
|
|
44
|
+
/** The app draws the switch for the other apps itself, such as at the top of its pairing card, with `showOthers` and `othersLine`. */
|
|
45
|
+
hideSwitch?: boolean;
|
|
46
|
+
/** The devices this app is paired with today, whose pairing moves into the fortress on joining. */
|
|
47
|
+
pairedWith?: string[];
|
|
48
|
+
/** A member of a fortress this app saw on the network while it is in none. */
|
|
49
|
+
found?: { app: string; device: string; logo?: string };
|
|
50
|
+
/** Asks for the app's password before the phrase shows. */
|
|
51
|
+
phrasePassword?: boolean;
|
|
52
|
+
onOpen?: (app: FortressApp, instance: FortressInstance) => void;
|
|
53
|
+
/** The app's own card for another app, such as the one its Instances tab draws, in place of FortressAppCard. With `onRemove` it gets `remove`, which asks before an instance goes, as the app's own cards do. */
|
|
54
|
+
renderApp?: Snippet<[app: FortressApp, hueIndex: number, remove: ((id: string, name: string) => void) | undefined]>;
|
|
55
|
+
/** What the QR code beside the words carries, the words alone without it. */
|
|
56
|
+
phraseQr?: (words: string[]) => string;
|
|
57
|
+
/** Something of the app's own under a permission's words. */
|
|
58
|
+
permissionExtra?: Snippet<[permission: FortressPermission]>;
|
|
59
|
+
labelKeys?: Partial<FortressLabelKeys>;
|
|
60
|
+
/** The rainbow position the fortress's first card takes, after the app's own cards. */
|
|
61
|
+
hueStart?: number;
|
|
62
|
+
/** This app's own instance cards. The snippet gets `remove`, which asks before an instance goes. */
|
|
63
|
+
children?: Snippet<[remove: (id: string, device: string) => void]>;
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<script lang="ts">
|
|
68
|
+
import { createFortressFlow, fill, hueVars, joinRefusalText, listOf, othersLine, storedShowOthers, storeShowOthers } from "@glimstone/core";
|
|
69
|
+
import Button from "./Button.svelte";
|
|
70
|
+
import FortressAppCard from "./FortressAppCard.svelte";
|
|
71
|
+
import FortressPermissions from "./FortressPermissions.svelte";
|
|
72
|
+
import FortressWindow from "./FortressWindow.svelte";
|
|
73
|
+
import InfoBubble from "./InfoBubble.svelte";
|
|
74
|
+
import Toggle from "./Toggle.svelte";
|
|
75
|
+
import { LABEL_KEYS } from "./fortressParts.js";
|
|
76
|
+
import { glyphFor } from "./glyphs.js";
|
|
77
|
+
import { css } from "./style.js";
|
|
78
|
+
|
|
79
|
+
// The fortress in the Instances tab ("The fortress" in the design language):
|
|
80
|
+
// the app's own instances first, the switch for the other apps and, once it is
|
|
81
|
+
// on, their cards and the permissions, with Show phrase or Enter phrase in the
|
|
82
|
+
// corner. Changing the phrase and leaving live in the pairing settings
|
|
83
|
+
// (FortressPairing).
|
|
84
|
+
let {
|
|
85
|
+
text,
|
|
86
|
+
lang,
|
|
87
|
+
app,
|
|
88
|
+
joined,
|
|
89
|
+
apps,
|
|
90
|
+
permissions,
|
|
91
|
+
onPermission,
|
|
92
|
+
notify,
|
|
93
|
+
onJoin,
|
|
94
|
+
onRemove,
|
|
95
|
+
onShowPhrase,
|
|
96
|
+
onChangePhrase,
|
|
97
|
+
removed = [],
|
|
98
|
+
removedHere,
|
|
99
|
+
showOthers,
|
|
100
|
+
onShowOthers,
|
|
101
|
+
hideSwitch,
|
|
102
|
+
pairedWith,
|
|
103
|
+
found,
|
|
104
|
+
phrasePassword,
|
|
105
|
+
onOpen,
|
|
106
|
+
renderApp,
|
|
107
|
+
phraseQr,
|
|
108
|
+
permissionExtra,
|
|
109
|
+
labelKeys,
|
|
110
|
+
hueStart = 0,
|
|
111
|
+
children,
|
|
112
|
+
}: FortressProps = $props();
|
|
113
|
+
|
|
114
|
+
const flow = createFortressFlow(() => ({
|
|
115
|
+
onJoin,
|
|
116
|
+
onRemove,
|
|
117
|
+
onShowPhrase,
|
|
118
|
+
onChangePhrase,
|
|
119
|
+
phrasePassword,
|
|
120
|
+
failed: text.failed,
|
|
121
|
+
joinRefusal: (code) => joinRefusalText(text, code),
|
|
122
|
+
}));
|
|
123
|
+
let s = $state.raw(flow.state());
|
|
124
|
+
$effect(() => flow.subscribe(() => (s = flow.state())));
|
|
125
|
+
const keys = $derived({ ...LABEL_KEYS, ...labelKeys });
|
|
126
|
+
|
|
127
|
+
let ownShow = $state(storedShowOthers());
|
|
128
|
+
const others = $derived(showOthers ?? ownShow);
|
|
129
|
+
function setShowOthers(on: boolean) {
|
|
130
|
+
if (onShowOthers) onShowOthers(on);
|
|
131
|
+
else {
|
|
132
|
+
storeShowOthers(on);
|
|
133
|
+
ownShow = on;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const info = $derived(glyphFor("info"));
|
|
137
|
+
const remove = $derived(onRemove && flow.openRemove);
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<div data-glim="Fortress" class="glim-fortress">
|
|
141
|
+
<div class="glim-fortress-grid">
|
|
142
|
+
{@render children?.(flow.openRemove)}
|
|
143
|
+
{#if !joined}
|
|
144
|
+
<div class="glim-card glim-instance glim-instance--out" data-fortress="out">
|
|
145
|
+
<h3 class="glim-instance-title">{removedHere ? text.removedHereTitle : text.outTitle}</h3>
|
|
146
|
+
<p class="glim-instance-hint">{fill(removedHere ? text.removedHereHint : text.outHint, { app: app.name })}</p>
|
|
147
|
+
{#if found}
|
|
148
|
+
<p class="glim-instance-found">
|
|
149
|
+
{#if found.logo}<img src={found.logo} alt="" />{/if}
|
|
150
|
+
<span>{fill(text.found, { app: found.app, device: found.device })}</span>
|
|
151
|
+
</p>
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
154
|
+
{/if}
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{#if joined && !hideSwitch}
|
|
158
|
+
<div class="glim-card glim-fortress-switch glim-hue" style={css(hueVars(hueStart))}>
|
|
159
|
+
<span class="glim-fortress-switch-text">
|
|
160
|
+
<span class="glim-fortress-switch-name">{text.showOthers}<InfoBubble tip={text.about} /></span>
|
|
161
|
+
<span class="glim-fortress-sub">{othersLine(text, lang, apps)}</span>
|
|
162
|
+
</span>
|
|
163
|
+
<!-- The switch shows what the app holds, so an app that keeps it itself decides. -->
|
|
164
|
+
<Toggle label={text.showOthers} hideLabel bind:checked={() => others, setShowOthers} data-fortress="others" />
|
|
165
|
+
</div>
|
|
166
|
+
{/if}
|
|
167
|
+
|
|
168
|
+
{#if joined && removed.length > 0}
|
|
169
|
+
<div class="glim-fortress-removed" data-fortress="removed" role="status">
|
|
170
|
+
{#if info}{@render info()}{/if}
|
|
171
|
+
<span>{fill(text.removedNote, { devices: listOf(lang, removed) })}</span>
|
|
172
|
+
{#if onChangePhrase}
|
|
173
|
+
<Button label={text.changePhrase} labelKey={keys.changePhrase} tone="subtle" onClick={flow.openChange} data-fortress="open-change" />
|
|
174
|
+
{/if}
|
|
175
|
+
</div>
|
|
176
|
+
{/if}
|
|
177
|
+
|
|
178
|
+
{#if joined && others}
|
|
179
|
+
<div class="glim-fortress-grid">
|
|
180
|
+
{#each apps as a, i (a.id)}
|
|
181
|
+
{#if renderApp}
|
|
182
|
+
{@render renderApp(a, hueStart + 1 + i, remove)}
|
|
183
|
+
{:else}
|
|
184
|
+
<FortressAppCard app={a} {text} {lang} hueIndex={hueStart + 1 + i} {onOpen} onRemove={remove} removeKey={keys.remove} />
|
|
185
|
+
{/if}
|
|
186
|
+
{/each}
|
|
187
|
+
</div>
|
|
188
|
+
<FortressPermissions
|
|
189
|
+
{text}
|
|
190
|
+
{app}
|
|
191
|
+
apps={[app, ...apps]}
|
|
192
|
+
{permissions}
|
|
193
|
+
{onPermission}
|
|
194
|
+
{notify}
|
|
195
|
+
hueIndex={hueStart + 1 + apps.length}
|
|
196
|
+
extra={permissionExtra}
|
|
197
|
+
/>
|
|
198
|
+
{/if}
|
|
199
|
+
|
|
200
|
+
<!-- An app that shows the phrase in its pairing settings leaves the corner out. -->
|
|
201
|
+
{#if !joined || onShowPhrase}
|
|
202
|
+
<div class="glim-fortress-actions">
|
|
203
|
+
{#if !joined}
|
|
204
|
+
<Button label={text.enterPhrase} labelKey={keys.join} tone="accent" size="key" onClick={flow.openJoin} data-fortress="open-join" />
|
|
205
|
+
{:else}
|
|
206
|
+
<Button
|
|
207
|
+
label={text.showPhrase}
|
|
208
|
+
labelKey={keys.showPhrase}
|
|
209
|
+
tone="accent"
|
|
210
|
+
size="key"
|
|
211
|
+
busy={s.busy === "show"}
|
|
212
|
+
onClick={() => void flow.openPhrase()}
|
|
213
|
+
data-fortress="show"
|
|
214
|
+
/>
|
|
215
|
+
{/if}
|
|
216
|
+
</div>
|
|
217
|
+
{/if}
|
|
218
|
+
|
|
219
|
+
{#if s.window}
|
|
220
|
+
<FortressWindow {flow} flowState={s} {text} {lang} {app} {pairedWith} {phraseQr} {keys} />
|
|
221
|
+
{/if}
|
|
222
|
+
</div>
|