@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.
Files changed (282) hide show
  1. package/README.md +53 -2
  2. package/dist/AboutCard.svelte +87 -0
  3. package/dist/AboutCard.svelte.d.ts +37 -0
  4. package/dist/Accordion.svelte +60 -0
  5. package/dist/Accordion.svelte.d.ts +38 -0
  6. package/dist/AngleSlider.svelte +56 -0
  7. package/dist/AngleSlider.svelte.d.ts +13 -0
  8. package/dist/Avatar.svelte +37 -0
  9. package/dist/Avatar.svelte.d.ts +13 -0
  10. package/dist/Badge.svelte +119 -0
  11. package/dist/Badge.svelte.d.ts +54 -0
  12. package/dist/BrandMark.svelte +12 -0
  13. package/dist/BrandMark.svelte.d.ts +6 -0
  14. package/dist/BusyRing.svelte +39 -0
  15. package/dist/BusyRing.svelte.d.ts +15 -0
  16. package/dist/Button.svelte +172 -0
  17. package/dist/Button.svelte.d.ts +57 -0
  18. package/dist/Card.svelte +61 -0
  19. package/dist/Card.svelte.d.ts +23 -0
  20. package/dist/Carousel.svelte +72 -0
  21. package/dist/Carousel.svelte.d.ts +41 -0
  22. package/dist/Checkbox.svelte +48 -0
  23. package/dist/Checkbox.svelte.d.ts +17 -0
  24. package/dist/CoffeeDialog.svelte +70 -0
  25. package/dist/CoffeeDialog.svelte.d.ts +18 -0
  26. package/dist/Collapsible.svelte +49 -0
  27. package/dist/Collapsible.svelte.d.ts +14 -0
  28. package/dist/ColorPicker.svelte +122 -0
  29. package/dist/ColorPicker.svelte.d.ts +23 -0
  30. package/dist/Combobox.svelte +87 -0
  31. package/dist/Combobox.svelte.d.ts +18 -0
  32. package/dist/ConfirmDialog.svelte +106 -0
  33. package/dist/ConfirmDialog.svelte.d.ts +31 -0
  34. package/dist/ConfirmHost.svelte +41 -0
  35. package/dist/ConfirmHost.svelte.d.ts +7 -0
  36. package/dist/ContextMenu.svelte +213 -0
  37. package/dist/ContextMenu.svelte.d.ts +29 -0
  38. package/dist/CopyField.svelte +60 -0
  39. package/dist/CopyField.svelte.d.ts +19 -0
  40. package/dist/CryptoDonateDialog.svelte +162 -0
  41. package/dist/CryptoDonateDialog.svelte.d.ts +37 -0
  42. package/dist/DatePicker.svelte +149 -0
  43. package/dist/DatePicker.svelte.d.ts +18 -0
  44. package/dist/DropdownListbox.svelte +178 -0
  45. package/dist/DropdownListbox.svelte.d.ts +23 -0
  46. package/dist/EmptyState.svelte +31 -0
  47. package/dist/EmptyState.svelte.d.ts +16 -0
  48. package/dist/FieldError.svelte +20 -0
  49. package/dist/FieldError.svelte.d.ts +8 -0
  50. package/dist/FieldRow.svelte +52 -0
  51. package/dist/FieldRow.svelte.d.ts +23 -0
  52. package/dist/FieldRowGroup.svelte +33 -0
  53. package/dist/FieldRowGroup.svelte.d.ts +13 -0
  54. package/dist/FileUpload.svelte +74 -0
  55. package/dist/FileUpload.svelte.d.ts +18 -0
  56. package/dist/FloatingPanel.svelte +89 -0
  57. package/dist/FloatingPanel.svelte.d.ts +17 -0
  58. package/dist/Fortress.svelte +222 -0
  59. package/dist/Fortress.svelte.d.ts +62 -0
  60. package/dist/FortressAppCard.svelte +115 -0
  61. package/dist/FortressAppCard.svelte.d.ts +18 -0
  62. package/dist/FortressDoubtWindow.svelte +37 -0
  63. package/dist/FortressDoubtWindow.svelte.d.ts +12 -0
  64. package/dist/FortressPairing.svelte +85 -0
  65. package/dist/FortressPairing.svelte.d.ts +32 -0
  66. package/dist/FortressPermissions.svelte +93 -0
  67. package/dist/FortressPermissions.svelte.d.ts +24 -0
  68. package/dist/FortressStatusWindow.svelte +128 -0
  69. package/dist/FortressStatusWindow.svelte.d.ts +20 -0
  70. package/dist/FortressWindow.svelte +271 -0
  71. package/dist/FortressWindow.svelte.d.ts +18 -0
  72. package/dist/GlyphField.svelte +52 -0
  73. package/dist/GlyphField.svelte.d.ts +20 -0
  74. package/dist/GlyphTile.svelte +25 -0
  75. package/dist/GlyphTile.svelte.d.ts +14 -0
  76. package/dist/HoverCard.svelte +47 -0
  77. package/dist/HoverCard.svelte.d.ts +14 -0
  78. package/dist/IconButton.svelte +49 -0
  79. package/dist/IconButton.svelte.d.ts +20 -0
  80. package/dist/IconTipButton.svelte +67 -0
  81. package/dist/IconTipButton.svelte.d.ts +23 -0
  82. package/dist/InfoAboutCard.svelte +65 -0
  83. package/dist/InfoAboutCard.svelte.d.ts +35 -0
  84. package/dist/InfoBubble.svelte +50 -0
  85. package/dist/InfoBubble.svelte.d.ts +7 -0
  86. package/dist/InfoHelpCard.svelte +93 -0
  87. package/dist/InfoHelpCard.svelte.d.ts +44 -0
  88. package/dist/InfoTile.svelte +31 -0
  89. package/dist/InfoTile.svelte.d.ts +15 -0
  90. package/dist/InfoVersionCard.svelte +99 -0
  91. package/dist/InfoVersionCard.svelte.d.ts +29 -0
  92. package/dist/InstanceCard.svelte +85 -0
  93. package/dist/InstanceCard.svelte.d.ts +27 -0
  94. package/dist/Kbd.svelte +16 -0
  95. package/dist/Kbd.svelte.d.ts +8 -0
  96. package/dist/ListRow.svelte +51 -0
  97. package/dist/ListRow.svelte.d.ts +19 -0
  98. package/dist/ListSelect.svelte +135 -0
  99. package/dist/ListSelect.svelte.d.ts +25 -0
  100. package/dist/ListTable.svelte +183 -0
  101. package/dist/ListTable.svelte.d.ts +44 -0
  102. package/dist/MarkSvg.svelte +9 -0
  103. package/dist/MarkSvg.svelte.d.ts +8 -0
  104. package/dist/Marquee.svelte +63 -0
  105. package/dist/Marquee.svelte.d.ts +39 -0
  106. package/dist/MenuBar.svelte +98 -0
  107. package/dist/MenuBar.svelte.d.ts +19 -0
  108. package/dist/MenuChoice.svelte +30 -0
  109. package/dist/MenuChoice.svelte.d.ts +33 -0
  110. package/dist/MenuHeadEdit.svelte +29 -0
  111. package/dist/MenuHeadEdit.svelte.d.ts +10 -0
  112. package/dist/MenuRows.svelte +57 -0
  113. package/dist/MenuRows.svelte.d.ts +9 -0
  114. package/dist/MenuSelect.svelte +145 -0
  115. package/dist/MenuSelect.svelte.d.ts +25 -0
  116. package/dist/MenuSubmenu.svelte +64 -0
  117. package/dist/MenuSubmenu.svelte.d.ts +37 -0
  118. package/dist/Meter.svelte +55 -0
  119. package/dist/Meter.svelte.d.ts +20 -0
  120. package/dist/NumberField.svelte +70 -0
  121. package/dist/NumberField.svelte.d.ts +23 -0
  122. package/dist/Pagination.svelte +62 -0
  123. package/dist/Pagination.svelte.d.ts +16 -0
  124. package/dist/PasswordField.svelte +69 -0
  125. package/dist/PasswordField.svelte.d.ts +21 -0
  126. package/dist/PathField.svelte +111 -0
  127. package/dist/PathField.svelte.d.ts +33 -0
  128. package/dist/PaypalDialog.svelte +174 -0
  129. package/dist/PaypalDialog.svelte.d.ts +54 -0
  130. package/dist/Pill.svelte +25 -0
  131. package/dist/Pill.svelte.d.ts +14 -0
  132. package/dist/PinInput.svelte +81 -0
  133. package/dist/PinInput.svelte.d.ts +23 -0
  134. package/dist/Popover.svelte +38 -0
  135. package/dist/Popover.svelte.d.ts +16 -0
  136. package/dist/PresenceBadges.svelte +22 -0
  137. package/dist/PresenceBadges.svelte.d.ts +8 -0
  138. package/dist/ProgressBar.svelte +37 -0
  139. package/dist/ProgressBar.svelte.d.ts +16 -0
  140. package/dist/Rating.svelte +65 -0
  141. package/dist/Rating.svelte.d.ts +18 -0
  142. package/dist/ReadmeButton.svelte +82 -0
  143. package/dist/ReadmeButton.svelte.d.ts +27 -0
  144. package/dist/RowMark.svelte +16 -0
  145. package/dist/RowMark.svelte.d.ts +7 -0
  146. package/dist/ScrollArea.svelte +46 -0
  147. package/dist/ScrollArea.svelte.d.ts +11 -0
  148. package/dist/Select.svelte +97 -0
  149. package/dist/Select.svelte.d.ts +67 -0
  150. package/dist/SelectFace.svelte +18 -0
  151. package/dist/SelectFace.svelte.d.ts +32 -0
  152. package/dist/Selector.svelte +264 -0
  153. package/dist/Selector.svelte.d.ts +77 -0
  154. package/dist/SelectorSegment.svelte +159 -0
  155. package/dist/SelectorSegment.svelte.d.ts +27 -0
  156. package/dist/Sheet.svelte +51 -0
  157. package/dist/Sheet.svelte.d.ts +23 -0
  158. package/dist/SidebarRow.svelte +91 -0
  159. package/dist/SidebarRow.svelte.d.ts +31 -0
  160. package/dist/SignInCard.svelte +251 -0
  161. package/dist/SignInCard.svelte.d.ts +34 -0
  162. package/dist/SignInField.svelte +32 -0
  163. package/dist/SignInField.svelte.d.ts +11 -0
  164. package/dist/SignaturePad.svelte +72 -0
  165. package/dist/SignaturePad.svelte.d.ts +13 -0
  166. package/dist/SkeletonRow.svelte +29 -0
  167. package/dist/SkeletonRow.svelte.d.ts +12 -0
  168. package/dist/Slider.svelte +60 -0
  169. package/dist/Slider.svelte.d.ts +15 -0
  170. package/dist/Splitter.svelte +59 -0
  171. package/dist/Splitter.svelte.d.ts +37 -0
  172. package/dist/Steps.svelte +90 -0
  173. package/dist/Steps.svelte.d.ts +40 -0
  174. package/dist/SubCard.svelte +45 -0
  175. package/dist/SubCard.svelte.d.ts +14 -0
  176. package/dist/Table.svelte +48 -0
  177. package/dist/Table.svelte.d.ts +37 -0
  178. package/dist/TagsInput.svelte +77 -0
  179. package/dist/TagsInput.svelte.d.ts +18 -0
  180. package/dist/TextArea.svelte +55 -0
  181. package/dist/TextArea.svelte.d.ts +17 -0
  182. package/dist/TextField.svelte +61 -0
  183. package/dist/TextField.svelte.d.ts +18 -0
  184. package/dist/Timer.svelte +62 -0
  185. package/dist/Timer.svelte.d.ts +17 -0
  186. package/dist/TipBubble.svelte +11 -0
  187. package/dist/TipBubble.svelte.d.ts +7 -0
  188. package/dist/TipWrap.svelte +15 -0
  189. package/dist/TipWrap.svelte.d.ts +10 -0
  190. package/dist/ToastCard.svelte +68 -0
  191. package/dist/ToastCard.svelte.d.ts +18 -0
  192. package/dist/ToastViewport.svelte +65 -0
  193. package/dist/ToastViewport.svelte.d.ts +14 -0
  194. package/dist/Toggle.svelte +84 -0
  195. package/dist/Toggle.svelte.d.ts +25 -0
  196. package/dist/Tour.svelte +75 -0
  197. package/dist/Tour.svelte.d.ts +12 -0
  198. package/dist/Tree.svelte +122 -0
  199. package/dist/Tree.svelte.d.ts +22 -0
  200. package/dist/UnavailableNotice.svelte +36 -0
  201. package/dist/UnavailableNotice.svelte.d.ts +18 -0
  202. package/dist/Window.svelte +108 -0
  203. package/dist/Window.svelte.d.ts +33 -0
  204. package/dist/WindowBar.svelte +76 -0
  205. package/dist/WindowBar.svelte.d.ts +26 -0
  206. package/dist/WindowFootRow.svelte +67 -0
  207. package/dist/WindowFootRow.svelte.d.ts +28 -0
  208. package/dist/bubble.svelte.d.ts +15 -0
  209. package/dist/bubble.svelte.js +66 -0
  210. package/dist/confirm.svelte.d.ts +37 -0
  211. package/dist/confirm.svelte.js +62 -0
  212. package/dist/engines.svelte.d.ts +18 -0
  213. package/dist/engines.svelte.js +57 -0
  214. package/dist/entries/accordion.d.ts +1 -0
  215. package/dist/entries/accordion.js +2 -0
  216. package/dist/entries/angleslider.d.ts +1 -0
  217. package/dist/entries/angleslider.js +2 -0
  218. package/dist/entries/avatar.d.ts +1 -0
  219. package/dist/entries/avatar.js +2 -0
  220. package/dist/entries/carousel.d.ts +1 -0
  221. package/dist/entries/carousel.js +2 -0
  222. package/dist/entries/collapsible.d.ts +1 -0
  223. package/dist/entries/collapsible.js +2 -0
  224. package/dist/entries/combobox.d.ts +1 -0
  225. package/dist/entries/combobox.js +2 -0
  226. package/dist/entries/datepicker.d.ts +1 -0
  227. package/dist/entries/datepicker.js +2 -0
  228. package/dist/entries/fileupload.d.ts +1 -0
  229. package/dist/entries/fileupload.js +2 -0
  230. package/dist/entries/floatingpanel.d.ts +1 -0
  231. package/dist/entries/floatingpanel.js +2 -0
  232. package/dist/entries/hovercard.d.ts +1 -0
  233. package/dist/entries/hovercard.js +2 -0
  234. package/dist/entries/marquee.d.ts +1 -0
  235. package/dist/entries/marquee.js +2 -0
  236. package/dist/entries/pagination.d.ts +1 -0
  237. package/dist/entries/pagination.js +2 -0
  238. package/dist/entries/pininput.d.ts +1 -0
  239. package/dist/entries/pininput.js +2 -0
  240. package/dist/entries/rating.d.ts +1 -0
  241. package/dist/entries/rating.js +2 -0
  242. package/dist/entries/scrollarea.d.ts +1 -0
  243. package/dist/entries/scrollarea.js +2 -0
  244. package/dist/entries/select.d.ts +1 -0
  245. package/dist/entries/select.js +2 -0
  246. package/dist/entries/signaturepad.d.ts +1 -0
  247. package/dist/entries/signaturepad.js +2 -0
  248. package/dist/entries/slider.d.ts +1 -0
  249. package/dist/entries/slider.js +2 -0
  250. package/dist/entries/splitter.d.ts +1 -0
  251. package/dist/entries/splitter.js +2 -0
  252. package/dist/entries/steps.d.ts +1 -0
  253. package/dist/entries/steps.js +2 -0
  254. package/dist/entries/tagsinput.d.ts +1 -0
  255. package/dist/entries/tagsinput.js +2 -0
  256. package/dist/entries/timer.d.ts +1 -0
  257. package/dist/entries/timer.js +2 -0
  258. package/dist/entries/tour.d.ts +1 -0
  259. package/dist/entries/tour.js +2 -0
  260. package/dist/fieldName.d.ts +4 -0
  261. package/dist/fieldName.js +9 -0
  262. package/dist/fortressParts.d.ts +5 -0
  263. package/dist/fortressParts.js +16 -0
  264. package/dist/glyphs.d.ts +32 -0
  265. package/dist/glyphs.js +47 -0
  266. package/dist/index.d.ts +78 -0
  267. package/dist/index.js +77 -0
  268. package/dist/lift.d.ts +5 -0
  269. package/dist/lift.js +9 -0
  270. package/dist/portalHue.svelte.d.ts +9 -0
  271. package/dist/portalHue.svelte.js +16 -0
  272. package/dist/selectParts.svelte.d.ts +39 -0
  273. package/dist/selectParts.svelte.js +28 -0
  274. package/dist/selectorItem.d.ts +22 -0
  275. package/dist/selectorItem.js +1 -0
  276. package/dist/style.d.ts +5 -0
  277. package/dist/style.js +12 -0
  278. package/dist/useDragArmed.svelte.d.ts +6 -0
  279. package/dist/useDragArmed.svelte.js +24 -0
  280. package/dist/usePaypalButtons.svelte.d.ts +18 -0
  281. package/dist/usePaypalButtons.svelte.js +41 -0
  282. package/package.json +173 -4
@@ -0,0 +1,62 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { ChangeAnswer, FortressAnswer, FortressApp, FortressInstance, FortressLabelKeys, FortressPermission, FortressText, PhraseAnswer, ToastSeverity } from "@glimstone/core";
3
+ export type { ChangeAnswer, FortressAnswer, FortressLabelKeys, FortressText, PhraseAnswer } from "@glimstone/core";
4
+ export interface FortressProps {
5
+ text: FortressText;
6
+ /** The interface language, for counts and lists. */
7
+ lang: string;
8
+ /** The app showing the page. */
9
+ app: {
10
+ id: string;
11
+ name: string;
12
+ logo?: string;
13
+ };
14
+ joined: boolean;
15
+ /** The other apps of the fortress, each with its instances. */
16
+ apps: FortressApp[];
17
+ permissions: FortressPermission[];
18
+ onPermission: (id: string, on: boolean) => Promise<FortressAnswer>;
19
+ /** Puts the small confirmation of a saved permission, or the reason it failed, into the app's toasts. */
20
+ notify?: (message: string, severity: ToastSeverity) => void;
21
+ onJoin: (words: string[]) => Promise<FortressAnswer>;
22
+ /** Removes an instance, of this app or another. Without it no other app offers Remove. */
23
+ onRemove?: (id: string) => Promise<FortressAnswer>;
24
+ /** `password` is set where `phrasePassword` asks for it first. Without it there is no Show phrase. */
25
+ onShowPhrase?: (password?: string) => Promise<PhraseAnswer>;
26
+ /** Offered right after a removal and beside `removed`, since until the phrase changes the fortress takes no new app. */
27
+ onChangePhrase?: () => Promise<ChangeAnswer>;
28
+ /** 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. */
29
+ removed?: string[];
30
+ /** Another member removed this app, so the empty place says so until it joins again. */
31
+ removedHere?: boolean;
32
+ /** Whether the other apps show. Without it the switch keeps its state on this device. */
33
+ showOthers?: boolean;
34
+ onShowOthers?: (on: boolean) => void;
35
+ /** The app draws the switch for the other apps itself, such as at the top of its pairing card, with `showOthers` and `othersLine`. */
36
+ hideSwitch?: boolean;
37
+ /** The devices this app is paired with today, whose pairing moves into the fortress on joining. */
38
+ pairedWith?: string[];
39
+ /** A member of a fortress this app saw on the network while it is in none. */
40
+ found?: {
41
+ app: string;
42
+ device: string;
43
+ logo?: string;
44
+ };
45
+ /** Asks for the app's password before the phrase shows. */
46
+ phrasePassword?: boolean;
47
+ onOpen?: (app: FortressApp, instance: FortressInstance) => void;
48
+ /** 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. */
49
+ renderApp?: Snippet<[app: FortressApp, hueIndex: number, remove: ((id: string, name: string) => void) | undefined]>;
50
+ /** What the QR code beside the words carries, the words alone without it. */
51
+ phraseQr?: (words: string[]) => string;
52
+ /** Something of the app's own under a permission's words. */
53
+ permissionExtra?: Snippet<[permission: FortressPermission]>;
54
+ labelKeys?: Partial<FortressLabelKeys>;
55
+ /** The rainbow position the fortress's first card takes, after the app's own cards. */
56
+ hueStart?: number;
57
+ /** This app's own instance cards. The snippet gets `remove`, which asks before an instance goes. */
58
+ children?: Snippet<[remove: (id: string, device: string) => void]>;
59
+ }
60
+ declare const Fortress: import("svelte").Component<FortressProps, {}, "">;
61
+ type Fortress = ReturnType<typeof Fortress>;
62
+ export default Fortress;
@@ -0,0 +1,115 @@
1
+ <script lang="ts" module>
2
+ import type { FortressApp, FortressInstance, FortressText } from "@glimstone/core";
3
+
4
+ export type { FortressApp, FortressInstance } from "@glimstone/core";
5
+
6
+ export interface FortressAppCardProps {
7
+ app: FortressApp;
8
+ text: FortressText;
9
+ /** The interface language, for the counts. */
10
+ lang: string;
11
+ hueIndex?: number;
12
+ /** Opens an instance, through the fortress where it runs elsewhere. Without it the instance's `open.href` opens in a new tab. */
13
+ onOpen?: (app: FortressApp, instance: FortressInstance) => void;
14
+ /** Asks before an instance is removed, with its name. Without it nothing here removes. */
15
+ onRemove?: (id: string, name: string) => void;
16
+ /** The label key behind Remove, which picks its glyph. */
17
+ removeKey?: string;
18
+ }
19
+ </script>
20
+
21
+ <script lang="ts">
22
+ import { appCardView, memberName, openInstance, presenceTone } from "@glimstone/core";
23
+ import Badge from "./Badge.svelte";
24
+ import Button from "./Button.svelte";
25
+ import FortressDoubtWindow from "./FortressDoubtWindow.svelte";
26
+ import InfoBubble from "./InfoBubble.svelte";
27
+ import InstanceCard from "./InstanceCard.svelte";
28
+ import PresenceBadges from "./PresenceBadges.svelte";
29
+ import { deviceGlyph, presenceText } from "./fortressParts.js";
30
+
31
+ // Another app of the fortress: its state, where it runs, and the way to open it.
32
+ let { app, text, lang, hueIndex, onOpen, onRemove, removeKey = "delete" }: FortressAppCardProps = $props();
33
+
34
+ const view = $derived(appCardView(app, text, lang));
35
+ const single = $derived(view.rows.length === 0);
36
+ const removes = $derived(single && !!onRemove && !view.main.self);
37
+ let asking = $state.raw<FortressInstance | null>(null);
38
+ const open = (instance: FortressInstance) => (instance.doubt ? (asking = instance) : openInstance(app, instance, onOpen));
39
+ const name = (instance: FortressInstance) => memberName(text, app, instance);
40
+ </script>
41
+
42
+ <!-- Remove stays quiet at the end of a row, or after Open on a card with one instance. -->
43
+ {#snippet remove(instance: FortressInstance, inRow: boolean)}
44
+ {#if onRemove && !instance.self}
45
+ <Button
46
+ label={text.remove}
47
+ labelKey={removeKey}
48
+ tone="subtle"
49
+ variant={inRow ? "icon" : "default"}
50
+ compact={inRow}
51
+ title={name(instance)}
52
+ onClick={() => onRemove(instance.id, name(instance))}
53
+ data-fortress="open-remove"
54
+ />
55
+ {/if}
56
+ {/snippet}
57
+
58
+ {#snippet badges()}
59
+ {#if view.doubt}<Badge tone="warn">{view.doubt.label}<InfoBubble tip={view.doubt.tip} onAccent /></Badge>{/if}
60
+ {#if view.needs}<Badge tone="warn">{view.needs}</Badge>{/if}
61
+ <PresenceBadges instance={view.main} {text} />
62
+ {/snippet}
63
+
64
+ {#snippet actions()}
65
+ {#if view.open}<Button label={view.open.label} labelKey="open" onClick={() => open(view.main)} data-fortress="open" />{/if}
66
+ {#if single}{@render remove(view.main, false)}{/if}
67
+ {/snippet}
68
+
69
+ {#snippet rows()}
70
+ <ul class="glim-instance-rows">
71
+ {#each view.rows as { instance, sub, open: opens } (instance.id)}
72
+ {@const device = deviceGlyph(instance.deviceKind)}
73
+ <li class="glim-instance-row" data-instance={instance.id}>
74
+ <span class="glim-instance-device" aria-hidden="true">{#if device}{@render device()}{/if}</span>
75
+ <span class="glim-instance-row-text">
76
+ <span class="glim-instance-row-name">{instance.device}</span>
77
+ <span class="glim-instance-row-sub glim-num">{sub}</span>
78
+ </span>
79
+ <span class="glim-instance-row-end">
80
+ <Badge tone={presenceTone(instance.presence)}>{presenceText(text, instance)}</Badge>
81
+ {#if opens}
82
+ <Button
83
+ label={text.open}
84
+ labelKey="open"
85
+ tone="subtle"
86
+ variant="icon"
87
+ compact
88
+ title={name(instance)}
89
+ onClick={() => open(instance)}
90
+ data-fortress="open"
91
+ />
92
+ {/if}
93
+ {@render remove(instance, true)}
94
+ </span>
95
+ </li>
96
+ {/each}
97
+ </ul>
98
+ {/snippet}
99
+
100
+ <InstanceCard
101
+ data-glim="FortressAppCard"
102
+ data-fortress-app={app.id}
103
+ logo={app.logo}
104
+ name={app.name}
105
+ eyebrow={view.eyebrow}
106
+ {hueIndex}
107
+ {badges}
108
+ facts={view.facts}
109
+ actions={view.open || removes ? actions : undefined}
110
+ children={single ? undefined : rows}
111
+ />
112
+ {#if asking}
113
+ {@const instance = asking}
114
+ <FortressDoubtWindow {app} {instance} {text} onOpen={() => openInstance(app, instance, onOpen)} onClose={() => (asking = null)} />
115
+ {/if}
@@ -0,0 +1,18 @@
1
+ import type { FortressApp, FortressInstance, FortressText } from "@glimstone/core";
2
+ export type { FortressApp, FortressInstance } from "@glimstone/core";
3
+ export interface FortressAppCardProps {
4
+ app: FortressApp;
5
+ text: FortressText;
6
+ /** The interface language, for the counts. */
7
+ lang: string;
8
+ hueIndex?: number;
9
+ /** Opens an instance, through the fortress where it runs elsewhere. Without it the instance's `open.href` opens in a new tab. */
10
+ onOpen?: (app: FortressApp, instance: FortressInstance) => void;
11
+ /** Asks before an instance is removed, with its name. Without it nothing here removes. */
12
+ onRemove?: (id: string, name: string) => void;
13
+ /** The label key behind Remove, which picks its glyph. */
14
+ removeKey?: string;
15
+ }
16
+ declare const FortressAppCard: import("svelte").Component<FortressAppCardProps, {}, "">;
17
+ type FortressAppCard = ReturnType<typeof FortressAppCard>;
18
+ export default FortressAppCard;
@@ -0,0 +1,37 @@
1
+ <script lang="ts" module>
2
+ import type { FortressApp, FortressInstance, FortressText } from "@glimstone/core";
3
+
4
+ export interface FortressDoubtWindowProps {
5
+ app: FortressApp;
6
+ instance: FortressInstance;
7
+ text: FortressText;
8
+ /** Runs on Open anyway. The window closes either way. */
9
+ onOpen: () => void;
10
+ onClose: () => void;
11
+ }
12
+ </script>
13
+
14
+ <script lang="ts">
15
+ import { doubtView } from "@glimstone/core";
16
+ import Window from "./Window.svelte";
17
+
18
+ // The question before an instance with `doubt` opens: two members claim the
19
+ // same app on the same device, so the person opens one only by the end of its
20
+ // id. An app that draws the other apps in cards of its own shows it before
21
+ // `onOpen`.
22
+ let { app, instance, text, onOpen, onClose }: FortressDoubtWindowProps = $props();
23
+
24
+ const view = $derived(doubtView(text, app, instance));
25
+ </script>
26
+
27
+ <Window
28
+ data-glim="FortressDoubtWindow"
29
+ title={view.title}
30
+ text={{ cancel: text.cancel, close: text.close }}
31
+ {onClose}
32
+ actions={[{ label: view.open, labelKey: "open", primary: true, attrs: { "data-fortress": "open-anyway" }, onClick: onOpen }]}
33
+ >
34
+ <div class="glim-fortress-text">
35
+ <p>{view.body}</p>
36
+ </div>
37
+ </Window>
@@ -0,0 +1,12 @@
1
+ import type { FortressApp, FortressInstance, FortressText } from "@glimstone/core";
2
+ export interface FortressDoubtWindowProps {
3
+ app: FortressApp;
4
+ instance: FortressInstance;
5
+ text: FortressText;
6
+ /** Runs on Open anyway. The window closes either way. */
7
+ onOpen: () => void;
8
+ onClose: () => void;
9
+ }
10
+ declare const FortressDoubtWindow: import("svelte").Component<FortressDoubtWindowProps, {}, "">;
11
+ type FortressDoubtWindow = ReturnType<typeof FortressDoubtWindow>;
12
+ export default FortressDoubtWindow;
@@ -0,0 +1,85 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+ import type { ChangeAnswer, FortressAnswer, FortressLabelKeys, FortressText, PhraseAnswer } from "@glimstone/core";
4
+
5
+ export interface FortressPairingProps {
6
+ text: FortressText;
7
+ lang: string;
8
+ app: { id: string; name: string };
9
+ onLeave: () => Promise<FortressAnswer>;
10
+ /** `password` is set where `phrasePassword` asks for it first. Without it there is no Show phrase here. */
11
+ onShowPhrase?: (password?: string) => Promise<PhraseAnswer>;
12
+ /** Asks for the app's password before the phrase shows. */
13
+ phrasePassword?: boolean;
14
+ /** What the QR code beside the words carries, the words alone without it. */
15
+ phraseQr?: (words: string[]) => string;
16
+ /** Without it there is no way to change the phrase here, for an app that cannot keep a new one. */
17
+ onChangePhrase?: () => Promise<ChangeAnswer>;
18
+ /** The devices whose pairing ends with leaving. */
19
+ pairedWith?: string[];
20
+ /** A sentence of the app's own for the leave window, such as what stays as it is. */
21
+ leaveNote?: string;
22
+ labelKeys?: Partial<FortressLabelKeys>;
23
+ hueIndex?: number;
24
+ /** Rows of the app's own above the phrase, such as the name the instance goes by. */
25
+ children?: Snippet;
26
+ /** Rows of the app's own below leaving, such as the switch for the other apps. */
27
+ after?: Snippet;
28
+ }
29
+ </script>
30
+
31
+ <script lang="ts">
32
+ import { createFortressFlow, fill } from "@glimstone/core";
33
+ import Button from "./Button.svelte";
34
+ import Card from "./Card.svelte";
35
+ import FieldRow from "./FieldRow.svelte";
36
+ import FortressWindow from "./FortressWindow.svelte";
37
+ import { LABEL_KEYS } from "./fortressParts.js";
38
+
39
+ // The fortress in the app's pairing settings: the one place where the phrase
40
+ // shows and changes and the app leaves, each behind a window that says what
41
+ // it does. An app that shows the phrase here leaves Show phrase out of its
42
+ // Fortress.
43
+ let {
44
+ text,
45
+ lang,
46
+ app,
47
+ onLeave,
48
+ onShowPhrase,
49
+ phrasePassword,
50
+ phraseQr,
51
+ onChangePhrase,
52
+ pairedWith,
53
+ leaveNote,
54
+ labelKeys,
55
+ hueIndex,
56
+ children,
57
+ after,
58
+ }: FortressPairingProps = $props();
59
+
60
+ const flow = createFortressFlow(() => ({ onLeave, onShowPhrase, onChangePhrase, phrasePassword, failed: text.failed }));
61
+ let s = $state.raw(flow.state());
62
+ $effect(() => flow.subscribe(() => (s = flow.state())));
63
+ const keys = $derived({ ...LABEL_KEYS, ...labelKeys });
64
+ </script>
65
+
66
+ <Card data-glim="FortressPairing" title={text.pairing} {hueIndex}>
67
+ {@render children?.()}
68
+ {#if onShowPhrase || onChangePhrase}
69
+ <FieldRow label={text.phraseTitle} hint={onChangePhrase && text.changePhraseAbout}>
70
+ {#if onShowPhrase}
71
+ <Button label={text.showPhrase} labelKey={keys.showPhrase} busy={s.busy === "show"} onClick={() => void flow.openPhrase()} data-fortress="show" />
72
+ {/if}
73
+ {#if onChangePhrase}
74
+ <Button label={text.change} labelKey={keys.changePhrase} onClick={flow.openChange} data-fortress="open-change" />
75
+ {/if}
76
+ </FieldRow>
77
+ {/if}
78
+ <FieldRow label={text.leaveRow} hint={fill(text.leaveAbout, { app: app.name })}>
79
+ <Button label={text.leaveConfirm} labelKey={keys.leave} onClick={flow.openLeave} data-fortress="open-leave" />
80
+ </FieldRow>
81
+ {@render after?.()}
82
+ {#if s.window}
83
+ <FortressWindow {flow} flowState={s} {text} {lang} {app} {pairedWith} {leaveNote} {phraseQr} {keys} />
84
+ {/if}
85
+ </Card>
@@ -0,0 +1,32 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { ChangeAnswer, FortressAnswer, FortressLabelKeys, FortressText, PhraseAnswer } from "@glimstone/core";
3
+ export interface FortressPairingProps {
4
+ text: FortressText;
5
+ lang: string;
6
+ app: {
7
+ id: string;
8
+ name: string;
9
+ };
10
+ onLeave: () => Promise<FortressAnswer>;
11
+ /** `password` is set where `phrasePassword` asks for it first. Without it there is no Show phrase here. */
12
+ onShowPhrase?: (password?: string) => Promise<PhraseAnswer>;
13
+ /** Asks for the app's password before the phrase shows. */
14
+ phrasePassword?: boolean;
15
+ /** What the QR code beside the words carries, the words alone without it. */
16
+ phraseQr?: (words: string[]) => string;
17
+ /** Without it there is no way to change the phrase here, for an app that cannot keep a new one. */
18
+ onChangePhrase?: () => Promise<ChangeAnswer>;
19
+ /** The devices whose pairing ends with leaving. */
20
+ pairedWith?: string[];
21
+ /** A sentence of the app's own for the leave window, such as what stays as it is. */
22
+ leaveNote?: string;
23
+ labelKeys?: Partial<FortressLabelKeys>;
24
+ hueIndex?: number;
25
+ /** Rows of the app's own above the phrase, such as the name the instance goes by. */
26
+ children?: Snippet;
27
+ /** Rows of the app's own below leaving, such as the switch for the other apps. */
28
+ after?: Snippet;
29
+ }
30
+ declare const FortressPairing: import("svelte").Component<FortressPairingProps, {}, "">;
31
+ type FortressPairing = ReturnType<typeof FortressPairing>;
32
+ export default FortressPairing;
@@ -0,0 +1,93 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+ import type { FortressAnswer, FortressApp, FortressPermission, FortressText, ToastSeverity } from "@glimstone/core";
4
+
5
+ export type { FortressPermission } from "@glimstone/core";
6
+
7
+ export interface FortressPermissionsProps {
8
+ text: FortressText;
9
+ /** The app showing the card, for the filter "With {app}". */
10
+ app: { id: string; name: string };
11
+ /** Every app of the fortress, this one included, for the marks. */
12
+ apps: Pick<FortressApp, "id" | "name" | "logo">[];
13
+ permissions: FortressPermission[];
14
+ /** Saves one switch the moment it flips. A refusal leaves it as it was and shakes it. */
15
+ onPermission: (id: string, on: boolean) => Promise<FortressAnswer>;
16
+ /** Puts the small confirmation of a save, or the reason it failed, into the app's toasts. */
17
+ notify?: (message: string, severity: ToastSeverity) => void;
18
+ hueIndex?: number;
19
+ /** Something of the app's own under one permission's words, such as the folder it writes to. */
20
+ extra?: Snippet<[permission: FortressPermission]>;
21
+ }
22
+ </script>
23
+
24
+ <script lang="ts">
25
+ import { fill, MARKS, permissionsWith, shake } from "@glimstone/core";
26
+ import Card from "./Card.svelte";
27
+ import MarkSvg from "./MarkSvg.svelte";
28
+ import Selector from "./Selector.svelte";
29
+ import Toggle from "./Toggle.svelte";
30
+
31
+ // What one app may do at another, a switch for each, all on unless switched off.
32
+ let { text, app, apps, permissions, onPermission, notify, hueIndex, extra }: FortressPermissionsProps = $props();
33
+
34
+ let filter = $state<"all" | "with">("all");
35
+ const mine = $derived(permissionsWith(permissions, app.id));
36
+ // The filter is offered only where it leaves some permissions out.
37
+ const narrows = $derived(mine.length < permissions.length);
38
+ const shown = $derived(filter === "all" || !narrows ? permissions : mine);
39
+
40
+ async function flip(p: FortressPermission) {
41
+ const answer = await onPermission(p.id, !p.on).catch((): FortressAnswer => ({}));
42
+ if (answer.ok) {
43
+ notify?.(fill(p.on ? text.permissionOff : text.permissionOn, { permission: p.title }), "success");
44
+ return;
45
+ }
46
+ notify?.(answer.error ?? text.failed, "fail");
47
+ const toggle = document.querySelector<HTMLElement>(`[data-permission="${CSS.escape(p.id)}"] .glim-toggle`);
48
+ if (toggle) shake(toggle);
49
+ }
50
+ </script>
51
+
52
+ {#snippet logo(id: string)}
53
+ {@const a = apps.find((x) => x.id === id)}
54
+ {#if a?.logo}<img src={a.logo} alt="" draggable="false" />{/if}
55
+ {/snippet}
56
+
57
+ <Card data-glim="FortressPermissions" title={text.permissions} hint={text.permissionsAbout} {hueIndex}>
58
+ {#if permissions.length === 0}
59
+ <p class="glim-fortress-sub">{text.noPermissions}</p>
60
+ {:else}
61
+ {#if narrows}
62
+ <Selector
63
+ label={text.permissions}
64
+ inline
65
+ activation="manual"
66
+ value={filter}
67
+ onChange={(next) => (filter = next)}
68
+ items={[
69
+ { id: "all" as const, label: `${text.all} ${permissions.length}` },
70
+ { id: "with" as const, label: `${fill(text.withApp, { app: app.name })} ${mine.length}` },
71
+ ]}
72
+ />
73
+ {/if}
74
+ <ul class="glim-permissions">
75
+ {#each shown as p (p.id)}
76
+ <li class={`glim-permission${p.on ? " glim-permission--on" : ""}`} data-permission={p.id}>
77
+ <span class="glim-permission-pair" aria-hidden="true">
78
+ {@render logo(p.from)}
79
+ <MarkSvg mark={MARKS.expand} class="glim-permission-arrow" />
80
+ <span class="glim-permission-to">{#each p.to as id (id)}{@render logo(id)}{/each}</span>
81
+ </span>
82
+ <span class="glim-permission-text">
83
+ <span class="glim-permission-title">{p.title}</span>
84
+ {#if p.detail}<span class="glim-fortress-sub">{p.detail}</span>{/if}
85
+ {@render extra?.(p)}
86
+ </span>
87
+ <!-- The switch shows what the app holds, so a refused flip stays where it was. -->
88
+ <Toggle label={p.title} hideLabel bind:checked={() => p.on, () => flip(p)} />
89
+ </li>
90
+ {/each}
91
+ </ul>
92
+ {/if}
93
+ </Card>
@@ -0,0 +1,24 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { FortressAnswer, FortressApp, FortressPermission, FortressText, ToastSeverity } from "@glimstone/core";
3
+ export type { FortressPermission } from "@glimstone/core";
4
+ export interface FortressPermissionsProps {
5
+ text: FortressText;
6
+ /** The app showing the card, for the filter "With {app}". */
7
+ app: {
8
+ id: string;
9
+ name: string;
10
+ };
11
+ /** Every app of the fortress, this one included, for the marks. */
12
+ apps: Pick<FortressApp, "id" | "name" | "logo">[];
13
+ permissions: FortressPermission[];
14
+ /** Saves one switch the moment it flips. A refusal leaves it as it was and shakes it. */
15
+ onPermission: (id: string, on: boolean) => Promise<FortressAnswer>;
16
+ /** Puts the small confirmation of a save, or the reason it failed, into the app's toasts. */
17
+ notify?: (message: string, severity: ToastSeverity) => void;
18
+ hueIndex?: number;
19
+ /** Something of the app's own under one permission's words, such as the folder it writes to. */
20
+ extra?: Snippet<[permission: FortressPermission]>;
21
+ }
22
+ declare const FortressPermissions: import("svelte").Component<FortressPermissionsProps, {}, "">;
23
+ type FortressPermissions = ReturnType<typeof FortressPermissions>;
24
+ export default FortressPermissions;
@@ -0,0 +1,128 @@
1
+ <script lang="ts" module>
2
+ import type { FortressApp, FortressInstance, FortressLogLine, FortressStatusReport, FortressText } from "@glimstone/core";
3
+
4
+ export type { FortressLogLine, FortressStatusReport } from "@glimstone/core";
5
+
6
+ export interface FortressStatusWindowProps {
7
+ app: FortressApp;
8
+ instance: FortressInstance;
9
+ /** The member's status report, its words and times already in the person's language. */
10
+ report?: FortressStatusReport;
11
+ /** The member's log, newest first. The window shows the first ten lines. */
12
+ log?: FortressLogLine[];
13
+ loading?: boolean;
14
+ /** Why the report did not come, such as `openRefusalText` puts it. */
15
+ error?: string;
16
+ text: FortressText;
17
+ /** The interface language. */
18
+ lang: string;
19
+ onClose: () => void;
20
+ }
21
+ </script>
22
+
23
+ <script lang="ts">
24
+ import { statusView } from "@glimstone/core";
25
+ import Badge from "./Badge.svelte";
26
+ import BusyRing from "./BusyRing.svelte";
27
+ import ProgressBar from "./ProgressBar.svelte";
28
+ import Window from "./Window.svelte";
29
+ import { glyphFor, IconClose } from "./glyphs.js";
30
+
31
+ // What Open shows for a member without pages of its own, such as an Unraid
32
+ // plugin, whose pages need Unraid's own sign-in and so never go through the
33
+ // fortress: its state from the status report, its last log lines and, for a
34
+ // plugin, where its settings are.
35
+ let { app, instance, report, log, loading, error, text, lang, onClose }: FortressStatusWindowProps = $props();
36
+
37
+ const view = $derived(statusView({ app, instance, report, log, loading, error, text }));
38
+ const info = $derived(glyphFor("info"));
39
+ </script>
40
+
41
+ {#snippet title()}
42
+ <span class="glim-status-title">{#if app.logo}<img src={app.logo} alt="" />{/if}{view.title}</span>
43
+ {/snippet}
44
+
45
+ <Window
46
+ data-glim="FortressStatusWindow"
47
+ {lang}
48
+ title={view.title}
49
+ drawn={title}
50
+ text={{ cancel: text.cancel, close: text.close }}
51
+ {onClose}
52
+ actions={[{ label: text.close, labelKey: "common.close", glyph: IconClose, wayOut: true }]}
53
+ >
54
+ <div class="glim-fortress-text" data-fortress="status">
55
+ {#if view.loading}
56
+ <p class="glim-fortress-note" data-fortress="loading">
57
+ <BusyRing size="small" delay={0} />
58
+ <span role="status">{view.loading}</span>
59
+ </p>
60
+ {/if}
61
+ {#if view.error !== undefined}
62
+ <p class="glim-fortress-note" role="status" data-fortress="error">
63
+ {#if info}{@render info()}{/if}
64
+ <span>{view.error}</span>
65
+ </p>
66
+ {/if}
67
+ {#if view.state}
68
+ <p class="glim-status-state" data-fortress="state">
69
+ <Badge tone={view.state.tone}>{view.state.label}</Badge>
70
+ {#if view.quiet}<span class="glim-fortress-sub">{view.quiet}</span>{/if}
71
+ </p>
72
+ {/if}
73
+ {#if view.needsYou.length > 0}
74
+ <section class="glim-status-section" data-fortress="needs">
75
+ <h3 class="glim-status-heading">{text.statusNeedsYou}</h3>
76
+ <ul class="glim-status-list">
77
+ {#each view.needsYou as n, i (i)}
78
+ <li class="glim-status-line">
79
+ {#if n.level}<Badge tone={n.level.tone}>{n.level.label}</Badge>{/if}
80
+ <span>{n.text}</span>
81
+ </li>
82
+ {/each}
83
+ </ul>
84
+ </section>
85
+ {/if}
86
+ {#if view.work.length > 0}
87
+ <section class="glim-status-section" data-fortress="work">
88
+ <h3 class="glim-status-heading">{text.statusWork}</h3>
89
+ <ul class="glim-status-list">
90
+ {#each view.work as w, i (i)}
91
+ <li class="glim-status-work">
92
+ <span>{w.title}</span>
93
+ <ProgressBar value={w.progress} label={w.title} />
94
+ </li>
95
+ {/each}
96
+ </ul>
97
+ </section>
98
+ {/if}
99
+ {#if view.next.length > 0}
100
+ <section class="glim-status-section" data-fortress="next">
101
+ <h3 class="glim-status-heading">{text.statusNext}</h3>
102
+ <ul class="glim-status-list">
103
+ {#each view.next as n, i (i)}
104
+ <li class="glim-status-line">
105
+ <span>{n.title}</span>
106
+ <span class="glim-status-at glim-num">{n.at}</span>
107
+ </li>
108
+ {/each}
109
+ </ul>
110
+ </section>
111
+ {/if}
112
+ {#if view.log.length > 0}
113
+ <section class="glim-status-section" data-fortress="log">
114
+ <h3 class="glim-status-heading">{text.statusLog}</h3>
115
+ <ul class="glim-status-list">
116
+ {#each view.log as l, i (i)}
117
+ <li class="glim-status-line">
118
+ <span class="glim-status-at glim-num">{l.at}</span>
119
+ {#if l.level}<Badge tone={l.level.tone}>{l.level.label}</Badge>{/if}
120
+ <span>{l.text}</span>
121
+ </li>
122
+ {/each}
123
+ </ul>
124
+ </section>
125
+ {/if}
126
+ {#if view.where}<p class="glim-fortress-sub" data-fortress="where">{view.where}</p>{/if}
127
+ </div>
128
+ </Window>
@@ -0,0 +1,20 @@
1
+ import type { FortressApp, FortressInstance, FortressLogLine, FortressStatusReport, FortressText } from "@glimstone/core";
2
+ export type { FortressLogLine, FortressStatusReport } from "@glimstone/core";
3
+ export interface FortressStatusWindowProps {
4
+ app: FortressApp;
5
+ instance: FortressInstance;
6
+ /** The member's status report, its words and times already in the person's language. */
7
+ report?: FortressStatusReport;
8
+ /** The member's log, newest first. The window shows the first ten lines. */
9
+ log?: FortressLogLine[];
10
+ loading?: boolean;
11
+ /** Why the report did not come, such as `openRefusalText` puts it. */
12
+ error?: string;
13
+ text: FortressText;
14
+ /** The interface language. */
15
+ lang: string;
16
+ onClose: () => void;
17
+ }
18
+ declare const FortressStatusWindow: import("svelte").Component<FortressStatusWindowProps, {}, "">;
19
+ type FortressStatusWindow = ReturnType<typeof FortressStatusWindow>;
20
+ export default FortressStatusWindow;