@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.
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,60 @@
1
+ <script lang="ts" module>
2
+ import type { FieldWidth } from "@glimstone/core";
3
+
4
+ export interface CopyFieldProps {
5
+ value: string;
6
+ /** The field's accessible name, such as "Token". Inside a FieldRow the row gives it. */
7
+ label?: string;
8
+ width?: FieldWidth;
9
+ /** The button's words, before and for a moment after it copied. */
10
+ text?: { copy: string; copied: string };
11
+ /** Called after every press, with whether the value reached the clipboard. */
12
+ onCopy?: (done: boolean) => void;
13
+ /** Classes for the row, which carries the width. */
14
+ class?: string;
15
+ }
16
+ </script>
17
+
18
+ <script lang="ts">
19
+ import { COPIED_MS, copyText, fieldWidthClass } from "@glimstone/core";
20
+ import Button from "./Button.svelte";
21
+ import { useFieldName } from "./fieldName.js";
22
+ import { IconCheck, IconCopy } from "./glyphs.js";
23
+
24
+ // A value somebody copies rather than types, such as a token, a path or an
25
+ // address: the value in monospace and a button that copies it and says so for
26
+ // a moment. Where the browser refuses to copy, the value is selected instead,
27
+ // so Ctrl+C still works.
28
+ let { value, label, width, text = { copy: "Copy", copied: "Copied" }, onCopy, class: className }: CopyFieldProps = $props();
29
+
30
+ const name = useFieldName(() => label);
31
+ let copied = $state(false);
32
+ let field: HTMLInputElement;
33
+ let timer: number | undefined;
34
+ $effect(() => () => clearTimeout(timer));
35
+
36
+ async function copy() {
37
+ const done = await copyText(value);
38
+ onCopy?.(done);
39
+ if (!done) {
40
+ field.focus();
41
+ field.select();
42
+ return;
43
+ }
44
+ copied = true;
45
+ clearTimeout(timer);
46
+ timer = window.setTimeout(() => (copied = false), COPIED_MS);
47
+ }
48
+ </script>
49
+
50
+ <span data-glim="CopyField" class={["glim-copy", fieldWidthClass(width), className].filter(Boolean).join(" ")}>
51
+ <input bind:this={field} readonly {value} aria-label={name()} spellcheck={false} class="glim-input glim-input--mono" />
52
+ <Button
53
+ label={copied ? text.copied : text.copy}
54
+ labelKey={copied ? "copied" : "copy"}
55
+ glyph={copied ? IconCheck : IconCopy}
56
+ variant="icon"
57
+ onClick={copy}
58
+ />
59
+ <span role="status" class="glim-sr-only">{copied ? text.copied : ""}</span>
60
+ </span>
@@ -0,0 +1,19 @@
1
+ import type { FieldWidth } from "@glimstone/core";
2
+ export interface CopyFieldProps {
3
+ value: string;
4
+ /** The field's accessible name, such as "Token". Inside a FieldRow the row gives it. */
5
+ label?: string;
6
+ width?: FieldWidth;
7
+ /** The button's words, before and for a moment after it copied. */
8
+ text?: {
9
+ copy: string;
10
+ copied: string;
11
+ };
12
+ /** Called after every press, with whether the value reached the clipboard. */
13
+ onCopy?: (done: boolean) => void;
14
+ /** Classes for the row, which carries the width. */
15
+ class?: string;
16
+ }
17
+ declare const CopyField: import("svelte").Component<CopyFieldProps, {}, "">;
18
+ type CopyField = ReturnType<typeof CopyField>;
19
+ export default CopyField;
@@ -0,0 +1,162 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+ import type { CryptoCoin, CryptoNetwork } from "@glimstone/core";
4
+
5
+ export type { CryptoCoin, CryptoNetwork } from "@glimstone/core";
6
+
7
+ export interface CryptoDonateDialogProps {
8
+ /** The coins on offer. See the rule at the top of this component. */
9
+ coins: CryptoCoin[];
10
+ /** What is shown right now. The app owns this, so it can remember it. */
11
+ coin: CryptoCoin;
12
+ network: CryptoNetwork;
13
+ /** Picking a coin lands on that coin's first network rather than keeping the
14
+ * previous chain, which the donor never checked against the new coin. */
15
+ onPick: (coin: CryptoCoin, network: CryptoNetwork) => void;
16
+ text: {
17
+ title: string;
18
+ /** The app's appeal, the same in every giving window. */
19
+ appeal: string;
20
+ /** One sentence saying what to do: pick a currency and a network, then scan
21
+ * or copy. */
22
+ intro: string;
23
+ /** The label over the chain row ("Networks"). */
24
+ networks: string;
25
+ copyLabel: string;
26
+ closeLabel: string;
27
+ };
28
+ /** The address as a scannable square. */
29
+ renderQr?: Snippet<[string]>;
30
+ /** A coin's own mark. */
31
+ renderMark?: Snippet<[CryptoCoin]>;
32
+ /** Copy the address and say so in a toast, in the app's own words. */
33
+ onCopy: (coin: CryptoCoin, network: CryptoNetwork) => void;
34
+ onClose: () => void;
35
+ /** The window's own card, bound with `bind:ref`, for the app's Escape handling and focus trap. */
36
+ ref?: HTMLDivElement | null;
37
+ }
38
+ </script>
39
+
40
+ <script lang="ts">
41
+ import { hueVars } from "@glimstone/core";
42
+ import { useLabelMode } from "./engines.svelte.js";
43
+ import { css } from "./style.js";
44
+ import Badge from "./Badge.svelte";
45
+ import Button from "./Button.svelte";
46
+
47
+ // The window for giving from a crypto wallet.
48
+ //
49
+ // Every network a donor can pick carries its own address, so a chain the
50
+ // recipient cannot receive on cannot be offered: one 0x address listed under
51
+ // "Tether" beside Tron would lose the money of anyone who picked Tron. The donor
52
+ // picks the coin first and the chain second, each in its own row. The address
53
+ // sits above the picker, since it is what the window is opened for.
54
+ //
55
+ // The component holds no state and touches no `document`; the app owns the
56
+ // selection, Escape, the portal and the toast. `renderQr` and `renderMark` are
57
+ // props because a QR code needs a library and a coin's mark is someone else's
58
+ // brand; without them the window shows the address, a copy button and tickers.
59
+ let { coins, coin, network, onPick, text, renderQr, renderMark, onCopy, onClose, ref = $bindable(null) }: CryptoDonateDialogProps = $props();
60
+
61
+ // `reactive` shows both mark and ticker here: somebody searching a grid of
62
+ // coins should not have to hover every tile to find USDT.
63
+ const mode = useLabelMode("buttons");
64
+ const showMark = $derived(mode.current !== "text");
65
+ const showTicker = $derived(mode.current !== "glyph");
66
+ </script>
67
+
68
+ <!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->
69
+ <div
70
+ class="glim-modal-backdrop"
71
+ onclick={(e) => {
72
+ if (e.target === e.currentTarget) onClose();
73
+ }}
74
+ >
75
+ <div
76
+ data-glim="CryptoDonateDialog"
77
+ data-glim-title={text.title}
78
+ bind:this={ref}
79
+ tabindex={-1}
80
+ role="dialog"
81
+ aria-modal="true"
82
+ aria-labelledby="cryptodonate-title"
83
+ class="glim-modal-card glim-modal-card--wide"
84
+ >
85
+ <!-- Rule 15: the title is a badge straddling the top edge. No corner X,
86
+ since the footer already closes the window. -->
87
+ <div class="glim-modal-head">
88
+ <h2 id="cryptodonate-title" class="glim-modal-title">
89
+ <Badge tone="heading" size="heading" wrap>{text.title}</Badge>
90
+ </h2>
91
+ </div>
92
+
93
+ <div class="glim-give-body glim-give-body--scroll">
94
+ <p class="glim-give-appeal">{text.appeal}</p>
95
+ <p class="glim-give-intro">{text.intro}</p>
96
+
97
+ <div class="glim-give-well">
98
+ {@render renderQr?.(network.address)}
99
+ <!-- Never shortened, since an address is checked by eye before sending.
100
+ `dir="ltr"` keeps it left-to-right in a right-to-left interface. -->
101
+ <p dir="ltr" class="glim-give-address">{network.address}</p>
102
+ <!-- The chain row sits directly under the address it changes, and shows
103
+ even for a coin with one chain because it also says which network
104
+ the address belongs to. Chain names stay words in every label mode;
105
+ each chain owns a rainbow position. -->
106
+ <div class="glim-give-networks" role="listbox" aria-label={text.networks}>
107
+ {#each coin.networks as n, i (n.id)}
108
+ <button
109
+ type="button"
110
+ role="option"
111
+ aria-selected={n.id === network.id}
112
+ onclick={() => onPick(coin, n)}
113
+ style={css(hueVars(i))}
114
+ class={`glim-give-network glim-hue${n.id === network.id ? " glim-active" : ""}`}
115
+ >
116
+ {n.name}
117
+ </button>
118
+ {/each}
119
+ </div>
120
+ {#if network.note}<p class="glim-give-note">{network.note}</p>{/if}
121
+ <!-- Takes the coin's rainbow position, so in rainbow mode it matches the
122
+ tile the address came from. -->
123
+ <Button
124
+ label={text.copyLabel}
125
+ labelKey="common.copy"
126
+ tone="accent"
127
+ hueIndex={coins.findIndex((c) => c.id === coin.id)}
128
+ onClick={() => onCopy(coin, network)}
129
+ />
130
+ </div>
131
+
132
+ <!-- `.glim-hue-icon` tints the mark while the ticker is shown and is
133
+ dropped in glyph mode, where only the fill of an icon-only tile
134
+ carries colour. -->
135
+ <div class="glim-give-coins" role="listbox" aria-label={text.title}>
136
+ {#each coins as c, i (c.id)}
137
+ {@const picked = c.id === coin.id}
138
+ {@const lit = !picked && c.tile}
139
+ <button
140
+ type="button"
141
+ role="option"
142
+ aria-selected={picked}
143
+ aria-label={`${c.name} (${c.symbol})`}
144
+ title={c.name}
145
+ onclick={() => onPick(c, c.networks[0]!)}
146
+ style={css({ ...hueVars(i), ...(lit && { "--tile": c.tile!.color, "--tile-ink": c.tile!.ink }) })}
147
+ class={`glim-give-coin ${showTicker ? "glim-hue glim-hue-icon" : "glim-hue"} ${
148
+ picked ? "glim-active" : lit ? "glim-brand-tile" : "glim-give-coin--plain"
149
+ }`}
150
+ >
151
+ {#if showMark}{@render renderMark?.(c)}{/if}
152
+ {#if showTicker}<span class="glim-give-ticker">{c.symbol}</span>{/if}
153
+ </button>
154
+ {/each}
155
+ </div>
156
+ </div>
157
+
158
+ <div class="glim-give-foot">
159
+ <Button label={text.closeLabel} labelKey="common.close" tone="neutral" onClick={onClose} />
160
+ </div>
161
+ </div>
162
+ </div>
@@ -0,0 +1,37 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { CryptoCoin, CryptoNetwork } from "@glimstone/core";
3
+ export type { CryptoCoin, CryptoNetwork } from "@glimstone/core";
4
+ export interface CryptoDonateDialogProps {
5
+ /** The coins on offer. See the rule at the top of this component. */
6
+ coins: CryptoCoin[];
7
+ /** What is shown right now. The app owns this, so it can remember it. */
8
+ coin: CryptoCoin;
9
+ network: CryptoNetwork;
10
+ /** Picking a coin lands on that coin's first network rather than keeping the
11
+ * previous chain, which the donor never checked against the new coin. */
12
+ onPick: (coin: CryptoCoin, network: CryptoNetwork) => void;
13
+ text: {
14
+ title: string;
15
+ /** The app's appeal, the same in every giving window. */
16
+ appeal: string;
17
+ /** One sentence saying what to do: pick a currency and a network, then scan
18
+ * or copy. */
19
+ intro: string;
20
+ /** The label over the chain row ("Networks"). */
21
+ networks: string;
22
+ copyLabel: string;
23
+ closeLabel: string;
24
+ };
25
+ /** The address as a scannable square. */
26
+ renderQr?: Snippet<[string]>;
27
+ /** A coin's own mark. */
28
+ renderMark?: Snippet<[CryptoCoin]>;
29
+ /** Copy the address and say so in a toast, in the app's own words. */
30
+ onCopy: (coin: CryptoCoin, network: CryptoNetwork) => void;
31
+ onClose: () => void;
32
+ /** The window's own card, bound with `bind:ref`, for the app's Escape handling and focus trap. */
33
+ ref?: HTMLDivElement | null;
34
+ }
35
+ declare const CryptoDonateDialog: import("svelte").Component<CryptoDonateDialogProps, {}, "ref">;
36
+ type CryptoDonateDialog = ReturnType<typeof CryptoDonateDialog>;
37
+ export default CryptoDonateDialog;
@@ -0,0 +1,149 @@
1
+ <script lang="ts" module>
2
+ import type { DatePickerText } from "@glimstone/core";
3
+
4
+ export type { DatePickerText, DateView } from "@glimstone/core";
5
+
6
+ export interface DatePickerProps {
7
+ label?: string;
8
+ /** The day as "2026-11-14", or null for none, bound with `bind:value`. */
9
+ value: string | null;
10
+ onChange?: (value: string | null) => void;
11
+ /** The first and the last day it offers, as "2026-11-14". */
12
+ min?: string;
13
+ max?: string;
14
+ /** The language the calendar is drawn in; the page's by default. */
15
+ locale?: string;
16
+ disabled?: boolean;
17
+ text?: Partial<DatePickerText>;
18
+ }
19
+ </script>
20
+
21
+ <script lang="ts">
22
+ import * as datePicker from "@zag-js/date-picker";
23
+ import { mergeProps, normalizeProps, useMachine } from "@zag-js/svelte";
24
+ import { DATE_PICKER_TEXT, formatDay, pageDir, pageLocale, SELECT_POSITIONING, type DateView } from "@glimstone/core";
25
+ import { useFieldName } from "./fieldName.js";
26
+ import { IconBack, IconCalendar, IconForward } from "./glyphs.js";
27
+ import { lift } from "./lift.js";
28
+ import { usePortalHue } from "./portalHue.svelte.js";
29
+
30
+ // A day picked from a calendar. The trigger is a field that shows the day and
31
+ // takes no typing, like the time picker's ("The time picker"), and the
32
+ // calendar opens beside it on the body, so no card clips it. The arrows walk
33
+ // the days, Page Up and Page Down the months, and the head steps out to the
34
+ // months and the years. Inside a FieldRow the row names it.
35
+ let { label, value = $bindable(), onChange, min, max, locale, disabled = false, text }: DatePickerProps = $props();
36
+
37
+ const name = useFieldName(() => label);
38
+ const words = $derived({ ...DATE_PICKER_TEXT, ...text });
39
+ const lang = $derived(locale ?? pageLocale());
40
+ const shown = $derived(value ? formatDay(value, lang) : words.placeholder);
41
+ const id = $props.id();
42
+ const service = useMachine(datePicker.machine, () => ({
43
+ id,
44
+ dir: pageDir(),
45
+ locale: lang,
46
+ value: value ? [datePicker.parse(value)] : [],
47
+ min: min ? datePicker.parse(min) : undefined,
48
+ max: max ? datePicker.parse(max) : undefined,
49
+ disabled,
50
+ positioning: SELECT_POSITIONING,
51
+ onValueChange: (d: { value: datePicker.DateValue[] }) => {
52
+ value = d.value[0]?.toString() ?? null;
53
+ onChange?.(value);
54
+ },
55
+ translations: {
56
+ content: words.calendar,
57
+ trigger: () => (name() ? `${name()}, ${shown}` : shown),
58
+ prevTrigger: (view: DateView) => words.previous[view],
59
+ nextTrigger: (view: DateView) => words.next[view],
60
+ viewTrigger: () => words.zoomOut,
61
+ },
62
+ }));
63
+ const api = $derived(datePicker.connect(service, normalizeProps));
64
+ let trigger = $state<HTMLButtonElement | null>(null);
65
+ const hue = usePortalHue(() => api.open, () => trigger);
66
+ const months = $derived(api.getMonthsGrid({ columns: 4, format: "short" }));
67
+ const years = $derived(api.getYearsGrid({ columns: 4 }));
68
+ </script>
69
+
70
+ <div data-glim="DatePicker" {...api.getRootProps()} class="glim-date">
71
+ <label {...api.getLabelProps()} class={label === undefined ? "glim-sr-only" : "glim-field-label"}>{name()}</label>
72
+ <div {...api.getControlProps()} class="glim-date-control">
73
+ <button {...api.getTriggerProps()} bind:this={trigger} class="glim-input glim-date-trigger">
74
+ <span class={value ? "glim-date-value" : "glim-date-value glim-date-value--empty"}>{shown}</span>
75
+ {@render IconCalendar()}
76
+ </button>
77
+ </div>
78
+ <div {@attach lift} {...mergeProps(api.getPositionerProps(), { style: hue.style })} class={`glim-date-positioner ${hue.className}`.trim()}>
79
+ <div {...api.getContentProps()} class="glim-date-panel">
80
+ <div {...api.getViewProps({ view: "day" })} hidden={api.view !== "day"}>
81
+ <div {...api.getViewControlProps({ view: "day" })} class="glim-date-head">
82
+ <button {...api.getPrevTriggerProps({ view: "day" })} class="glim-date-step">{@render IconBack()}</button>
83
+ <button {...api.getViewTriggerProps({ view: "day" })} class="glim-date-title">{api.visibleRangeText.start}</button>
84
+ <button {...api.getNextTriggerProps({ view: "day" })} class="glim-date-step">{@render IconForward()}</button>
85
+ </div>
86
+ <table {...api.getTableProps({ view: "day" })} class="glim-date-grid">
87
+ <thead {...api.getTableHeadProps({ view: "day" })}>
88
+ <tr {...api.getTableRowProps({ view: "day" })}>
89
+ {#each api.weekDays as day, i (i)}
90
+ <th scope="col" aria-label={day.long} class="glim-date-weekday">{day.narrow}</th>
91
+ {/each}
92
+ </tr>
93
+ </thead>
94
+ <tbody {...api.getTableBodyProps({ view: "day" })}>
95
+ {#each api.weeks as week, i (i)}
96
+ <tr {...api.getTableRowProps({ view: "day" })}>
97
+ {#each week as day, j (j)}
98
+ <td {...api.getDayTableCellProps({ value: day })}>
99
+ <div {...api.getDayTableCellTriggerProps({ value: day })} class="glim-date-cell glim-num">{day.day}</div>
100
+ </td>
101
+ {/each}
102
+ </tr>
103
+ {/each}
104
+ </tbody>
105
+ </table>
106
+ </div>
107
+ <div {...api.getViewProps({ view: "month" })} hidden={api.view !== "month"}>
108
+ <div {...api.getViewControlProps({ view: "month" })} class="glim-date-head">
109
+ <button {...api.getPrevTriggerProps({ view: "month" })} class="glim-date-step">{@render IconBack()}</button>
110
+ <button {...api.getViewTriggerProps({ view: "month" })} class="glim-date-title">{api.visibleRange.start.year}</button>
111
+ <button {...api.getNextTriggerProps({ view: "month" })} class="glim-date-step">{@render IconForward()}</button>
112
+ </div>
113
+ <table {...api.getTableProps({ view: "month", columns: 4 })} class="glim-date-grid">
114
+ <tbody {...api.getTableBodyProps({ view: "month" })}>
115
+ {#each months as row, i (i)}
116
+ <tr {...api.getTableRowProps()}>
117
+ {#each row as month, j (j)}
118
+ <td {...api.getMonthTableCellProps({ ...month, columns: 4 })}>
119
+ <div {...api.getMonthTableCellTriggerProps({ ...month, columns: 4 })} class="glim-date-cell glim-date-cell--wide">{month.label}</div>
120
+ </td>
121
+ {/each}
122
+ </tr>
123
+ {/each}
124
+ </tbody>
125
+ </table>
126
+ </div>
127
+ <div {...api.getViewProps({ view: "year" })} hidden={api.view !== "year"}>
128
+ <div {...api.getViewControlProps({ view: "year" })} class="glim-date-head">
129
+ <button {...api.getPrevTriggerProps({ view: "year" })} class="glim-date-step">{@render IconBack()}</button>
130
+ <span class="glim-date-title glim-num">{`${api.getDecade().start} - ${api.getDecade().end}`}</span>
131
+ <button {...api.getNextTriggerProps({ view: "year" })} class="glim-date-step">{@render IconForward()}</button>
132
+ </div>
133
+ <table {...api.getTableProps({ view: "year", columns: 4 })} class="glim-date-grid">
134
+ <tbody {...api.getTableBodyProps({ view: "year" })}>
135
+ {#each years as row, i (i)}
136
+ <tr {...api.getTableRowProps({ view: "year" })}>
137
+ {#each row as year, j (j)}
138
+ <td {...api.getYearTableCellProps({ ...year, columns: 4 })}>
139
+ <div {...api.getYearTableCellTriggerProps({ ...year, columns: 4 })} class="glim-date-cell glim-date-cell--wide glim-num">{year.label}</div>
140
+ </td>
141
+ {/each}
142
+ </tr>
143
+ {/each}
144
+ </tbody>
145
+ </table>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
@@ -0,0 +1,18 @@
1
+ import type { DatePickerText } from "@glimstone/core";
2
+ export type { DatePickerText, DateView } from "@glimstone/core";
3
+ export interface DatePickerProps {
4
+ label?: string;
5
+ /** The day as "2026-11-14", or null for none, bound with `bind:value`. */
6
+ value: string | null;
7
+ onChange?: (value: string | null) => void;
8
+ /** The first and the last day it offers, as "2026-11-14". */
9
+ min?: string;
10
+ max?: string;
11
+ /** The language the calendar is drawn in; the page's by default. */
12
+ locale?: string;
13
+ disabled?: boolean;
14
+ text?: Partial<DatePickerText>;
15
+ }
16
+ declare const DatePicker: import("svelte").Component<DatePickerProps, {}, "value">;
17
+ type DatePicker = ReturnType<typeof DatePicker>;
18
+ export default DatePicker;
@@ -0,0 +1,178 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+
4
+ export interface DropdownListboxProps {
5
+ /** Whether the panel is mounted. The caller owns the trigger; only the
6
+ * panel is shared. */
7
+ open: boolean;
8
+ /** Called when the panel dismisses itself (outside click, Escape, scroll,
9
+ * resize). Picking an option does not call it: a single-select list closes
10
+ * itself at the call site, a multi-select one stays open. */
11
+ onClose: () => void;
12
+ /** The trigger, which anchors the panel and is exempt from the outside-click
13
+ * dismissal so clicking it does not close and reopen the list. */
14
+ triggerRef: HTMLElement | null | undefined;
15
+ /** Accessible name for the listbox, normally the same label the trigger
16
+ * carries. */
17
+ label: string;
18
+ /** `aria-multiselectable`, for a checkbox multi-select list. */
19
+ multiselectable?: boolean;
20
+ /** The `role="option"` buttons. */
21
+ children: Snippet;
22
+ }
23
+ </script>
24
+
25
+ <script lang="ts">
26
+ import { tick } from "svelte";
27
+ import { computeBubblePosition, focusByLetter, isTypeahead, warnDeprecated } from "@glimstone/core";
28
+ import { lift } from "./lift.js";
29
+ import { usePortalHue } from "./portalHue.svelte.js";
30
+ import { css } from "./style.js";
31
+
32
+ // The `role="listbox"` panel a button-opens-a-list picker drops open. It is
33
+ // lifted to the portal target, because a card with `overflow: hidden` clips
34
+ // an absolutely positioned panel whatever its z-index, and placed with
35
+ // computeBubblePosition, which clamps it into the viewport and flips it above
36
+ // the trigger when needed. The panel takes the trigger's width and is centred
37
+ // on it with `translateX(-50%)`, since computeBubblePosition returns the
38
+ // centre.
39
+ //
40
+ // Kept for the apps that already use it; Select keeps focus on its trigger
41
+ // and adds typeahead.
42
+ let { open, onClose, triggerRef, label, multiselectable, children }: DropdownListboxProps = $props();
43
+ warnDeprecated("DropdownListbox");
44
+
45
+ /** The gap to the trigger and the least distance from the viewport's edge, 4px to match `mt-1`. */
46
+ const GAP = 4;
47
+
48
+ let panel = $state<HTMLDivElement | null>(null);
49
+ let pos = $state<{ left: number; top: number; width: number } | null>(null);
50
+ // The portal leaves the trigger's rainbow subtree, so the panel copies the
51
+ // trigger's hue.
52
+ const hue = usePortalHue(() => open, () => triggerRef);
53
+ // Whether focus was in the list as it closed. It is read the moment `open`
54
+ // turns false, before the list leaves the page: a browser that blurs a
55
+ // removed element reports the focus gone before the list is.
56
+ let focusWasInside = false;
57
+ let wasOpen = false;
58
+ $effect.pre(() => {
59
+ if (wasOpen && !open) focusWasInside = !!panel?.contains(document.activeElement);
60
+ wasOpen = open;
61
+ });
62
+
63
+ const options = () => [...(panel?.querySelectorAll<HTMLElement>('[role="option"]') ?? [])];
64
+
65
+ function place(el: HTMLDivElement, trigger: HTMLElement) {
66
+ const rect = trigger.getBoundingClientRect();
67
+ // Option labels wrap against the width, so it is set before the height is read.
68
+ el.style.width = `${rect.width}px`;
69
+ const viewport = {
70
+ width: document.documentElement.clientWidth || window.innerWidth,
71
+ height: document.documentElement.clientHeight || window.innerHeight,
72
+ };
73
+ const { left, top } = computeBubblePosition(rect, { width: rect.width, height: el.offsetHeight }, viewport, GAP);
74
+ pos = { left, top, width: rect.width };
75
+ }
76
+
77
+ // A fixed panel that has lost its trigger reads as broken, so an outside
78
+ // press, Escape, scroll or resize closes it. The panel itself is exempt from
79
+ // the outside press, or pressing an option would unmount the list before its
80
+ // click landed. A scroll inside the panel, which scrolls a long list itself,
81
+ // does not close it either.
82
+ $effect(() => {
83
+ if (!open) return;
84
+ const onPointerDown = (e: MouseEvent) => {
85
+ const target = e.target as Node;
86
+ if (panel?.contains(target) || triggerRef?.contains(target)) return;
87
+ onClose();
88
+ };
89
+ const onKey = (e: KeyboardEvent) => {
90
+ if (e.key === "Escape") onClose();
91
+ };
92
+ const onScroll = (e: Event) => {
93
+ if (e.target instanceof Node && panel?.contains(e.target)) return;
94
+ onClose();
95
+ };
96
+ const onResize = () => onClose();
97
+ document.addEventListener("mousedown", onPointerDown);
98
+ document.addEventListener("keydown", onKey);
99
+ window.addEventListener("scroll", onScroll, true);
100
+ window.addEventListener("resize", onResize);
101
+ return () => {
102
+ document.removeEventListener("mousedown", onPointerDown);
103
+ document.removeEventListener("keydown", onKey);
104
+ window.removeEventListener("scroll", onScroll, true);
105
+ window.removeEventListener("resize", onResize);
106
+ };
107
+ });
108
+
109
+ // Measured and placed before paint, so the panel never jumps from its
110
+ // off-screen parking spot. Focus then moves to the selected option, so a
111
+ // keyboard user reaches the list, but only once the panel stands at its real
112
+ // place: focusing an option parked off-screen makes the browser scroll to
113
+ // it, and that scroll closes the list.
114
+ $effect.pre(() => {
115
+ if (!open) {
116
+ pos = null;
117
+ // Focus goes back to the trigger only if it was in the list; a press
118
+ // elsewhere has already put it where somebody wants it.
119
+ if (focusWasInside) triggerRef?.focus();
120
+ focusWasInside = false;
121
+ return;
122
+ }
123
+ if (!panel || !triggerRef) return;
124
+ place(panel, triggerRef);
125
+ tick().then(() => {
126
+ const opts = options();
127
+ const active = opts.find((o) => o.getAttribute("aria-selected") === "true") ?? opts[0];
128
+ active?.scrollIntoView?.({ block: "nearest" });
129
+ active?.focus();
130
+ });
131
+ });
132
+
133
+ // Arrows, Home, End and a typed letter move between the options so every
134
+ // listbox behaves alike. Enter and Space need nothing: the options are real
135
+ // buttons.
136
+ function onPanelKey(e: KeyboardEvent) {
137
+ if (isTypeahead(e)) {
138
+ if (focusByLetter(options(), e.key)) e.preventDefault();
139
+ return;
140
+ }
141
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
142
+ const opts = options();
143
+ if (opts.length === 0) return;
144
+ e.preventDefault();
145
+ const at = opts.indexOf(document.activeElement as HTMLElement);
146
+ let next: number;
147
+ if (e.key === "Home") next = 0;
148
+ else if (e.key === "End") next = opts.length - 1;
149
+ else {
150
+ const dir = e.key === "ArrowDown" ? 1 : -1;
151
+ next = at < 0 ? (dir === 1 ? 0 : opts.length - 1) : (at + dir + opts.length) % opts.length;
152
+ }
153
+ opts[next]!.scrollIntoView?.({ block: "nearest" });
154
+ opts[next]!.focus();
155
+ }
156
+
157
+ </script>
158
+
159
+ {#if open}
160
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions, a11y_interactive_supports_focus -->
161
+ <div
162
+ {@attach lift}
163
+ bind:this={panel}
164
+ data-glim="DropdownListbox"
165
+ role="listbox"
166
+ onkeydown={onPanelKey}
167
+ aria-multiselectable={multiselectable ? "true" : undefined}
168
+ aria-label={label}
169
+ class={`glim-listbox glim-fade${hue.className ? ` ${hue.className}` : ""}`}
170
+ style:left={`${pos?.left ?? -9999}px`}
171
+ style:top={`${pos?.top ?? -9999}px`}
172
+ style:width={pos ? `${pos.width}px` : undefined}
173
+ style:transform="translateX(-50%)"
174
+ style={css(hue.style)}
175
+ >
176
+ {@render children()}
177
+ </div>
178
+ {/if}
@@ -0,0 +1,23 @@
1
+ import type { Snippet } from "svelte";
2
+ export interface DropdownListboxProps {
3
+ /** Whether the panel is mounted. The caller owns the trigger; only the
4
+ * panel is shared. */
5
+ open: boolean;
6
+ /** Called when the panel dismisses itself (outside click, Escape, scroll,
7
+ * resize). Picking an option does not call it: a single-select list closes
8
+ * itself at the call site, a multi-select one stays open. */
9
+ onClose: () => void;
10
+ /** The trigger, which anchors the panel and is exempt from the outside-click
11
+ * dismissal so clicking it does not close and reopen the list. */
12
+ triggerRef: HTMLElement | null | undefined;
13
+ /** Accessible name for the listbox, normally the same label the trigger
14
+ * carries. */
15
+ label: string;
16
+ /** `aria-multiselectable`, for a checkbox multi-select list. */
17
+ multiselectable?: boolean;
18
+ /** The `role="option"` buttons. */
19
+ children: Snippet;
20
+ }
21
+ declare const DropdownListbox: import("svelte").Component<DropdownListboxProps, {}, "">;
22
+ type DropdownListbox = ReturnType<typeof DropdownListbox>;
23
+ export default DropdownListbox;