@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,14 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PillTone } from "@glimstone/core";
3
+ export type { PillTone } from "@glimstone/core";
4
+ export interface PillProps {
5
+ children: Snippet;
6
+ /** `state` lifts a word that says what the row is doing; the other three
7
+ * wash the pill in their state colour. */
8
+ tone?: PillTone;
9
+ /** Extra classes, such as `glim-num` for figures that line up in a column. */
10
+ class?: string;
11
+ }
12
+ declare const Pill: import("svelte").Component<PillProps, {}, "">;
13
+ type Pill = ReturnType<typeof Pill>;
14
+ export default Pill;
@@ -0,0 +1,81 @@
1
+ <script lang="ts" module>
2
+ import type { PinInputText } from "@glimstone/core";
3
+
4
+ export type { PinInputText } from "@glimstone/core";
5
+
6
+ export interface PinInputProps {
7
+ label?: string;
8
+ /** The code as one string, bound with `bind:value`. An empty box is a missing character at its end. */
9
+ value: string;
10
+ onChange?: (value: string) => void;
11
+ /** Called once every box holds a character. */
12
+ onComplete?: (value: string) => void;
13
+ length?: number;
14
+ /** What a box takes: digits by default. */
15
+ type?: "numeric" | "alphanumeric" | "alphabetic";
16
+ /** Draws dots instead of the characters, for a code that is a secret. */
17
+ mask?: boolean;
18
+ /** Offers the code the phone just received, as a one-time code. */
19
+ otp?: boolean;
20
+ invalid?: boolean;
21
+ disabled?: boolean;
22
+ text?: Partial<PinInputText>;
23
+ }
24
+ </script>
25
+
26
+ <script lang="ts">
27
+ import * as pinInput from "@zag-js/pin-input";
28
+ import { normalizeProps, useMachine } from "@zag-js/svelte";
29
+ import { PIN_INPUT_TEXT, pinCells } from "@glimstone/core";
30
+ import { useFieldName } from "./fieldName.js";
31
+
32
+ // A short code typed one character to a box, such as the six digits of a
33
+ // second factor. A code is data, so the boxes run left to right in every
34
+ // language. Inside a FieldRow the row names it.
35
+ let {
36
+ label,
37
+ value = $bindable(),
38
+ onChange,
39
+ onComplete,
40
+ length = 6,
41
+ type = "numeric",
42
+ mask = false,
43
+ otp = false,
44
+ invalid = false,
45
+ disabled = false,
46
+ text,
47
+ }: PinInputProps = $props();
48
+
49
+ const name = useFieldName(() => label);
50
+ const words = $derived({ ...PIN_INPUT_TEXT, ...text });
51
+ const id = $props.id();
52
+ const service = useMachine(pinInput.machine, () => ({
53
+ id,
54
+ dir: "ltr" as const,
55
+ count: length,
56
+ value: pinCells(value, length),
57
+ type,
58
+ mask,
59
+ otp,
60
+ invalid,
61
+ disabled,
62
+ placeholder: "",
63
+ onValueChange: (d: { valueAsString: string }) => {
64
+ value = d.valueAsString;
65
+ onChange?.(d.valueAsString);
66
+ },
67
+ onValueComplete: (d: { valueAsString: string }) => onComplete?.(d.valueAsString),
68
+ translations: { inputLabel: (index: number, count: number) => words.cell(index + 1, count) },
69
+ }));
70
+ const api = $derived(pinInput.connect(service, normalizeProps));
71
+ </script>
72
+
73
+ <div data-glim="PinInput" {...api.getRootProps()} class="glim-pin">
74
+ <label {...api.getLabelProps()} class={label === undefined ? "glim-sr-only" : "glim-field-label"}>{name()}</label>
75
+ <div {...api.getControlProps()} class="glim-pin-control">
76
+ {#each api.items as index (index)}
77
+ <input {...api.getInputProps({ index })} class="glim-input glim-pin-cell glim-num" />
78
+ {/each}
79
+ </div>
80
+ <input {...api.getHiddenInputProps()} />
81
+ </div>
@@ -0,0 +1,23 @@
1
+ import type { PinInputText } from "@glimstone/core";
2
+ export type { PinInputText } from "@glimstone/core";
3
+ export interface PinInputProps {
4
+ label?: string;
5
+ /** The code as one string, bound with `bind:value`. An empty box is a missing character at its end. */
6
+ value: string;
7
+ onChange?: (value: string) => void;
8
+ /** Called once every box holds a character. */
9
+ onComplete?: (value: string) => void;
10
+ length?: number;
11
+ /** What a box takes: digits by default. */
12
+ type?: "numeric" | "alphanumeric" | "alphabetic";
13
+ /** Draws dots instead of the characters, for a code that is a secret. */
14
+ mask?: boolean;
15
+ /** Offers the code the phone just received, as a one-time code. */
16
+ otp?: boolean;
17
+ invalid?: boolean;
18
+ disabled?: boolean;
19
+ text?: Partial<PinInputText>;
20
+ }
21
+ declare const PinInput: import("svelte").Component<PinInputProps, {}, "value">;
22
+ type PinInput = ReturnType<typeof PinInput>;
23
+ export default PinInput;
@@ -0,0 +1,38 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+
4
+ export interface PopoverProps {
5
+ /** Whether it shows. */
6
+ open: boolean;
7
+ /** The control it stands beside. */
8
+ anchor: HTMLElement | null;
9
+ /** Its accessible name. */
10
+ label: string;
11
+ /** Called when the browser closes it; the caller sets `open` back. */
12
+ onClose: () => void;
13
+ children: Snippet;
14
+ class?: string;
15
+ }
16
+ </script>
17
+
18
+ <script lang="ts">
19
+ import { anchorName, openPopover } from "@glimstone/core";
20
+
21
+ // A small panel beside the control that opened it, such as a filter. It lives
22
+ // in the top layer through the popover attribute, so no card or scroll box
23
+ // clips it, and it renders where it stands rather than in a portal. Escape and
24
+ // a press beside it close it, and focus goes back to the trigger.
25
+ let { open, anchor, label, onClose, children, class: className }: PopoverProps = $props();
26
+ let panel = $state<HTMLElement | null>(null);
27
+ const id = $props.id();
28
+
29
+ $effect(() => {
30
+ if (open && anchor && panel) return openPopover(panel, anchor, anchorName(id), () => onClose());
31
+ });
32
+ </script>
33
+
34
+ {#if open}
35
+ <div data-glim="Popover" bind:this={panel} popover="auto" role="dialog" aria-label={label} class={className ? `glim-popover ${className}` : "glim-popover"}>
36
+ {@render children()}
37
+ </div>
38
+ {/if}
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from "svelte";
2
+ export interface PopoverProps {
3
+ /** Whether it shows. */
4
+ open: boolean;
5
+ /** The control it stands beside. */
6
+ anchor: HTMLElement | null;
7
+ /** Its accessible name. */
8
+ label: string;
9
+ /** Called when the browser closes it; the caller sets `open` back. */
10
+ onClose: () => void;
11
+ children: Snippet;
12
+ class?: string;
13
+ }
14
+ declare const Popover: import("svelte").Component<PopoverProps, {}, "">;
15
+ type Popover = ReturnType<typeof Popover>;
16
+ export default Popover;
@@ -0,0 +1,22 @@
1
+ <script lang="ts" module>
2
+ import type { FortressInstance, FortressText } from "@glimstone/core";
3
+
4
+ export interface PresenceBadgesProps {
5
+ instance: FortressInstance;
6
+ text: FortressText;
7
+ }
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import { presenceTone } from "@glimstone/core";
12
+ import Badge from "./Badge.svelte";
13
+ import { presenceText } from "./fortressParts.js";
14
+
15
+ // The state of one instance: reached through the relay, and connected, checking or away.
16
+ let { instance, text }: PresenceBadgesProps = $props();
17
+ </script>
18
+
19
+ <span data-glim="PresenceBadges" style="display: contents">
20
+ {#if instance.relay}<Badge>{text.viaRelay}</Badge>{/if}
21
+ <Badge tone={presenceTone(instance.presence)}>{presenceText(text, instance)}</Badge>
22
+ </span>
@@ -0,0 +1,8 @@
1
+ import type { FortressInstance, FortressText } from "@glimstone/core";
2
+ export interface PresenceBadgesProps {
3
+ instance: FortressInstance;
4
+ text: FortressText;
5
+ }
6
+ declare const PresenceBadges: import("svelte").Component<PresenceBadgesProps, {}, "">;
7
+ type PresenceBadges = ReturnType<typeof PresenceBadges>;
8
+ export default PresenceBadges;
@@ -0,0 +1,37 @@
1
+ <script lang="ts" module>
2
+ export interface ProgressBarProps {
3
+ /** From 0 to 1. Without it the bar runs indeterminate, while the work has no measure yet. */
4
+ value?: number | null;
5
+ /** The accessible name, such as what is being copied. */
6
+ label: string;
7
+ /** The work waits: the fill takes the waiting tone and the sheen stops. */
8
+ paused?: boolean;
9
+ /** The work stopped on an error: the fill takes the fault colour. */
10
+ failed?: boolean;
11
+ /** The progress in words, such as "1.2 GB of 4 GB", read out instead of the percentage. */
12
+ valueText?: string;
13
+ class?: string;
14
+ }
15
+ </script>
16
+
17
+ <script lang="ts">
18
+ import { progressView } from "@glimstone/core";
19
+
20
+ // Work that moves toward its end, such as a copy. A sheen runs over the fill
21
+ // while the work does; progressView() in the core says when it stops.
22
+ let { value, label, paused, failed, valueText, class: className }: ProgressBarProps = $props();
23
+ const view = $derived(progressView(value, { paused, failed }));
24
+ </script>
25
+
26
+ <span
27
+ data-glim="ProgressBar"
28
+ role="progressbar"
29
+ aria-label={label}
30
+ aria-valuemin={view.percent === null ? undefined : 0}
31
+ aria-valuemax={view.percent === null ? undefined : 100}
32
+ aria-valuenow={view.percent ?? undefined}
33
+ aria-valuetext={valueText}
34
+ class={className ? `${view.className} ${className}` : view.className}
35
+ >
36
+ <span class="glim-progress-fill" style={view.width ? `width: ${view.width}` : undefined}></span>
37
+ </span>
@@ -0,0 +1,16 @@
1
+ export interface ProgressBarProps {
2
+ /** From 0 to 1. Without it the bar runs indeterminate, while the work has no measure yet. */
3
+ value?: number | null;
4
+ /** The accessible name, such as what is being copied. */
5
+ label: string;
6
+ /** The work waits: the fill takes the waiting tone and the sheen stops. */
7
+ paused?: boolean;
8
+ /** The work stopped on an error: the fill takes the fault colour. */
9
+ failed?: boolean;
10
+ /** The progress in words, such as "1.2 GB of 4 GB", read out instead of the percentage. */
11
+ valueText?: string;
12
+ class?: string;
13
+ }
14
+ declare const ProgressBar: import("svelte").Component<ProgressBarProps, {}, "">;
15
+ type ProgressBar = ReturnType<typeof ProgressBar>;
16
+ export default ProgressBar;
@@ -0,0 +1,65 @@
1
+ <script lang="ts" module>
2
+ import type { RatingText } from "@glimstone/core";
3
+
4
+ export type { RatingText } from "@glimstone/core";
5
+
6
+ export interface RatingProps {
7
+ label?: string;
8
+ /** The value, bound with `bind:value`. */
9
+ value: number;
10
+ onChange?: (value: number) => void;
11
+ count?: number;
12
+ /** Takes half stars, from the pointer and from the arrows. */
13
+ allowHalf?: boolean;
14
+ /** Shows the value and takes no input, such as an average. */
15
+ readOnly?: boolean;
16
+ disabled?: boolean;
17
+ text?: Partial<RatingText>;
18
+ }
19
+ </script>
20
+
21
+ <script lang="ts">
22
+ import * as ratingGroup from "@zag-js/rating-group";
23
+ import { normalizeProps, useMachine } from "@zag-js/svelte";
24
+ import { RATING_TEXT, pageDir } from "@glimstone/core";
25
+ import { useFieldName } from "./fieldName.js";
26
+ import { IconStar } from "./glyphs.js";
27
+
28
+ // A value given in stars, such as how well a release worked. The stars up to
29
+ // the value are filled with the accent, the rest stand on the third surface.
30
+ // It is a radio group: the arrows move the value, and a pointer over a star
31
+ // shows what a press would give. Inside a FieldRow the row names it.
32
+ let { label, value = $bindable(), onChange, count = 5, allowHalf = false, readOnly = false, disabled = false, text }: RatingProps = $props();
33
+
34
+ const name = useFieldName(() => label);
35
+ const words = $derived({ ...RATING_TEXT, ...text });
36
+ const id = $props.id();
37
+ const service = useMachine(ratingGroup.machine, () => ({
38
+ id,
39
+ dir: pageDir(),
40
+ value,
41
+ count,
42
+ allowHalf,
43
+ readOnly,
44
+ disabled,
45
+ onValueChange: (d: { value: number }) => {
46
+ value = d.value;
47
+ onChange?.(d.value);
48
+ },
49
+ translations: { ratingValueText: (index: number) => words.star(index, count) },
50
+ }));
51
+ const api = $derived(ratingGroup.connect(service, normalizeProps));
52
+ </script>
53
+
54
+ <div data-glim="Rating" {...api.getRootProps()} class="glim-rating">
55
+ <label {...api.getLabelProps()} class={label === undefined ? "glim-sr-only" : "glim-field-label"}>{name()}</label>
56
+ <div {...api.getControlProps()} class="glim-rating-control">
57
+ {#each api.items as index (index)}
58
+ <span {...api.getItemProps({ index })} class="glim-rating-star">
59
+ {@render IconStar()}
60
+ <span class="glim-rating-fill" aria-hidden="true">{@render IconStar()}</span>
61
+ </span>
62
+ {/each}
63
+ </div>
64
+ <input {...api.getHiddenInputProps()} />
65
+ </div>
@@ -0,0 +1,18 @@
1
+ import type { RatingText } from "@glimstone/core";
2
+ export type { RatingText } from "@glimstone/core";
3
+ export interface RatingProps {
4
+ label?: string;
5
+ /** The value, bound with `bind:value`. */
6
+ value: number;
7
+ onChange?: (value: number) => void;
8
+ count?: number;
9
+ /** Takes half stars, from the pointer and from the arrows. */
10
+ allowHalf?: boolean;
11
+ /** Shows the value and takes no input, such as an average. */
12
+ readOnly?: boolean;
13
+ disabled?: boolean;
14
+ text?: Partial<RatingText>;
15
+ }
16
+ declare const Rating: import("svelte").Component<RatingProps, {}, "value">;
17
+ type Rating = ReturnType<typeof Rating>;
18
+ export default Rating;
@@ -0,0 +1,82 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+ import type { ReadmeBrand, ReadmePart } from "@glimstone/core";
4
+
5
+ export type { ReadmeBrand, ReadmePart } from "@glimstone/core";
6
+
7
+ export interface ReadmeButtonProps {
8
+ /** The brand whose colour the unit lights up in. */
9
+ brand: ReadmeBrand;
10
+ /** The button, then its segments. */
11
+ parts: [ReadmePart, ...ReadmePart[]];
12
+ mark?: Snippet;
13
+ /** The class that paints the mark at rest, such as `glim-windows-mark`. It
14
+ * sits on the mark's box, where the lit unit's ink can override it. */
15
+ markClass?: string;
16
+ /** A vendor's own button artwork, which replaces the first part's mark and words. */
17
+ art?: Snippet;
18
+ /** The "(i)" at the end of the unit, for what the name cannot say. */
19
+ hint?: string;
20
+ /** Holds the second lines in view while one reports what it did, such as "Copied". */
21
+ note?: boolean;
22
+ /** The second line of a unit whose first part has neither `href` nor `onClick`. */
23
+ soonLabel?: string;
24
+ /** Runs on a click on a part's link, for an app whose webview has no browser
25
+ * behind it to open the address in. */
26
+ onLinkClick?: (e: MouseEvent) => void;
27
+ }
28
+ </script>
29
+
30
+ <script lang="ts">
31
+ import { keepReadmeFit, readmePartClass, readmePartLabel, readmeSoon, readmeUnitClass } from "@glimstone/core";
32
+ import InfoBubble from "./InfoBubble.svelte";
33
+
34
+ // A button in the shape of the README's download buttons, on the App tab and
35
+ // the About card ("The App tab" in design-language.md). The first part carries
36
+ // the mark and the full name; the parts after it are segments that name only
37
+ // what differs, such as ARM beside Windows. The unit lights up as one in its
38
+ // brand's colour ("Brand tiles"). A link where a part leads to a file or a
39
+ // listing, a button where it does something on the page, and a quiet unit with
40
+ // "Soon" as its second line where the listing does not exist yet.
41
+ let { brand, parts, mark, markClass, art, hint, note, soonLabel, onLinkClick }: ReadmeButtonProps = $props();
42
+
43
+ let root: HTMLDivElement;
44
+ const soon = $derived(readmeSoon(parts));
45
+ const words = $derived(parts.map((p) => `${p.name}\n${p.sub ?? ""}`).join("\n") + (soon ? soonLabel : ""));
46
+ $effect(() => {
47
+ void words;
48
+ return keepReadmeFit(root);
49
+ });
50
+
51
+ const sub = (part: ReadmePart) => (soon ? soonLabel : part.sub);
52
+ </script>
53
+
54
+ {#snippet face(part: ReadmePart, i: number)}
55
+ {#if i === 0 && art}
56
+ <span class="glim-readme-btn-art" aria-hidden="true">{@render art()}</span>
57
+ {:else}
58
+ {#if i === 0 && mark}
59
+ <span class={`glim-readme-btn-mark ${markClass ?? ""}`} aria-hidden="true">{@render mark()}</span>
60
+ {/if}
61
+ <span class="glim-readme-btn-text">
62
+ <span class="glim-readme-btn-name">{part.name}</span>
63
+ {#if sub(part)}<span class="glim-readme-btn-sub">{sub(part)}</span>{/if}
64
+ </span>
65
+ {/if}
66
+ {/snippet}
67
+
68
+ <div data-glim="ReadmeButton" bind:this={root} class={readmeUnitClass(brand, parts.length, !!note, soon)}>
69
+ {#each parts as part, i (i)}
70
+ {#if soon}
71
+ <span class={readmePartClass(i, soon)} aria-disabled="true" aria-label={readmePartLabel(part, sub(part))}>{@render face(part, i)}</span>
72
+ {:else if part.href}
73
+ <a href={part.href} target="_blank" rel="noreferrer noopener" onclick={onLinkClick} aria-label={readmePartLabel(part, sub(part))} class={readmePartClass(i, soon)}>
74
+ {@render face(part, i)}
75
+ </a>
76
+ {:else}
77
+ <button type="button" onclick={part.onClick} aria-label={readmePartLabel(part, sub(part))} class={readmePartClass(i, soon)}>{@render face(part, i)}</button>
78
+ {/if}
79
+ {/each}
80
+ {#if !soon}<span class="glim-readme-btn-sheen" aria-hidden="true"></span>{/if}
81
+ {#if hint}<span class="glim-readme-btn-hint"><InfoBubble tip={hint} /></span>{/if}
82
+ </div>
@@ -0,0 +1,27 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { ReadmeBrand, ReadmePart } from "@glimstone/core";
3
+ export type { ReadmeBrand, ReadmePart } from "@glimstone/core";
4
+ export interface ReadmeButtonProps {
5
+ /** The brand whose colour the unit lights up in. */
6
+ brand: ReadmeBrand;
7
+ /** The button, then its segments. */
8
+ parts: [ReadmePart, ...ReadmePart[]];
9
+ mark?: Snippet;
10
+ /** The class that paints the mark at rest, such as `glim-windows-mark`. It
11
+ * sits on the mark's box, where the lit unit's ink can override it. */
12
+ markClass?: string;
13
+ /** A vendor's own button artwork, which replaces the first part's mark and words. */
14
+ art?: Snippet;
15
+ /** The "(i)" at the end of the unit, for what the name cannot say. */
16
+ hint?: string;
17
+ /** Holds the second lines in view while one reports what it did, such as "Copied". */
18
+ note?: boolean;
19
+ /** The second line of a unit whose first part has neither `href` nor `onClick`. */
20
+ soonLabel?: string;
21
+ /** Runs on a click on a part's link, for an app whose webview has no browser
22
+ * behind it to open the address in. */
23
+ onLinkClick?: (e: MouseEvent) => void;
24
+ }
25
+ declare const ReadmeButton: import("svelte").Component<ReadmeButtonProps, {}, "">;
26
+ type ReadmeButton = ReturnType<typeof ReadmeButton>;
27
+ export default ReadmeButton;
@@ -0,0 +1,16 @@
1
+ <script lang="ts" module>
2
+ export interface RowMarkProps {
3
+ on?: boolean;
4
+ class?: string;
5
+ }
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { IconCheck } from "./glyphs.js";
10
+
11
+ // The round mark on a row picked for an action on many (rule 39). It is a
12
+ // picture: the row says it is picked, with aria-selected.
13
+ let { on, class: className }: RowMarkProps = $props();
14
+ </script>
15
+
16
+ <span data-glim="RowMark" class={["glim-rowmark", on && "glim-rowmark--on", className].filter(Boolean).join(" ")} aria-hidden="true">{@render IconCheck()}</span>
@@ -0,0 +1,7 @@
1
+ export interface RowMarkProps {
2
+ on?: boolean;
3
+ class?: string;
4
+ }
5
+ declare const RowMark: import("svelte").Component<RowMarkProps, {}, "">;
6
+ type RowMark = ReturnType<typeof RowMark>;
7
+ export default RowMark;
@@ -0,0 +1,46 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+
4
+ export interface ScrollAreaProps {
5
+ /** The region's accessible name. */
6
+ label: string;
7
+ /** How tall it grows before it scrolls, as a CSS length. */
8
+ maxHeight: string;
9
+ children: Snippet;
10
+ }
11
+ </script>
12
+
13
+ <script lang="ts">
14
+ import * as scrollArea from "@zag-js/scroll-area";
15
+ import { mergeProps, normalizeProps, useMachine } from "@zag-js/svelte";
16
+ import { pageDir } from "@glimstone/core";
17
+
18
+ // A box that scrolls its content behind thin bars of the house's own, instead
19
+ // of the platform's, which draw a different width and colour on every system.
20
+ // The box is a region a keyboard can reach and scroll with the arrow keys.
21
+ let { label, maxHeight, children }: ScrollAreaProps = $props();
22
+
23
+ const id = $props.id();
24
+ const service = useMachine(scrollArea.machine, () => ({ id, dir: pageDir() }));
25
+ const api = $derived(scrollArea.connect(service, normalizeProps));
26
+ </script>
27
+
28
+ <div data-glim="ScrollArea" {...api.getRootProps()} class="glim-scroll">
29
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
30
+ <div
31
+ {...mergeProps(api.getViewportProps(), { style: { "max-height": maxHeight } })}
32
+ role="region"
33
+ aria-label={label}
34
+ tabindex="0"
35
+ class="glim-scroll-viewport"
36
+ >
37
+ <div {...api.getContentProps()} class="glim-scroll-content">{@render children()}</div>
38
+ </div>
39
+ <div {...api.getScrollbarProps({ orientation: "vertical" })} class="glim-scroll-bar">
40
+ <div {...api.getThumbProps({ orientation: "vertical" })} class="glim-scroll-thumb"></div>
41
+ </div>
42
+ <div {...api.getScrollbarProps({ orientation: "horizontal" })} class="glim-scroll-bar">
43
+ <div {...api.getThumbProps({ orientation: "horizontal" })} class="glim-scroll-thumb"></div>
44
+ </div>
45
+ <div {...api.getCornerProps()} class="glim-scroll-corner"></div>
46
+ </div>
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from "svelte";
2
+ export interface ScrollAreaProps {
3
+ /** The region's accessible name. */
4
+ label: string;
5
+ /** How tall it grows before it scrolls, as a CSS length. */
6
+ maxHeight: string;
7
+ children: Snippet;
8
+ }
9
+ declare const ScrollArea: import("svelte").Component<ScrollAreaProps, {}, "">;
10
+ type ScrollArea = ReturnType<typeof ScrollArea>;
11
+ export default ScrollArea;
@@ -0,0 +1,97 @@
1
+ <script lang="ts" module>
2
+ import type { SelectRows, SelectSize, SelectWidth } from "@glimstone/core";
3
+ import type { SelectGroup, SelectOption } from "./selectParts.svelte.js";
4
+
5
+ export type { SelectEntry, SelectGroup, SelectOption, SelectSubmenu } from "./selectParts.svelte.js";
6
+ export type { SelectRows, SelectSize, SelectWidth } from "@glimstone/core";
7
+
8
+ export interface SelectProps<T extends string = string> {
9
+ /** The field's name, always the accessible name. Inside a FieldRow the row gives it and draws the words. */
10
+ label?: string;
11
+ /** Draw the label off screen, for a settings row that names the field at its start. */
12
+ hideLabel?: boolean;
13
+ /** Every choice, in list order, for a list without groups. */
14
+ options?: SelectOption<T>[];
15
+ /** The list in runs, with headings and submenus. The wheel steps through every option in list order. */
16
+ groups?: SelectGroup<T>[];
17
+ /** Bound with `bind:value`. Null when there is no one value, such as over a selection whose rows disagree. */
18
+ value: T | null;
19
+ onChange?: (value: T) => void;
20
+ /** Shown while the value is null. */
21
+ placeholder?: string;
22
+ /** Defaults to `fill` for a field and to `steady` for the smaller sizes and inside a FieldRow. */
23
+ width?: SelectWidth;
24
+ size?: SelectSize;
25
+ /** `menu` draws the open list with a context menu's rows, so an app with both shows one kind of menu row. */
26
+ rows?: SelectRows;
27
+ /** Lets a long value run onto a second line instead of ending in an ellipsis, for one whose end says as much as its start, such as a path. */
28
+ wrap?: boolean;
29
+ /** The trigger's id, for a `<label for>` outside the select. */
30
+ id?: string;
31
+ /** Attributes for the trigger, such as a data hook that says the value. */
32
+ triggerAttrs?: Record<string, string>;
33
+ /** The open list's id. */
34
+ listId?: string;
35
+ /** The trigger's own node, bound with `bind:ref`, for a caller that hands it the focus. */
36
+ ref?: HTMLButtonElement | null;
37
+ disabled?: boolean;
38
+ /** A choice is out and its answer not back yet: the trigger keeps its focus but takes no input. */
39
+ busy?: boolean;
40
+ /** A hover bubble, for a trigger with no label beside it whose value does not say what it picks. */
41
+ tip?: string;
42
+ /** The caller's failure counter. Each bump shakes the trigger once, as the value snaps back. */
43
+ shake?: number;
44
+ /** Classes for the trigger, for a size the call site needs. */
45
+ class?: string;
46
+ }
47
+ </script>
48
+
49
+ <script lang="ts" generics="T extends string">
50
+ import { defaultWidth, hasSubmenu, selectTriggerClass } from "@glimstone/core";
51
+ import { useFieldName } from "./fieldName.js";
52
+ import ListSelect from "./ListSelect.svelte";
53
+ import MenuSelect from "./MenuSelect.svelte";
54
+
55
+ // The one dropdown. Zag carries the behaviour the contract asks for and the
56
+ // select rules in tokens.css carry the look. A list is Zag's select machine;
57
+ // a list with a submenu is its menu machine, since a listbox cannot nest.
58
+ // Both render into the portal target, so no card or scroll box can clip them.
59
+ let {
60
+ size = "field",
61
+ rows = "list",
62
+ label,
63
+ hideLabel,
64
+ width,
65
+ wrap = false,
66
+ class: className = "",
67
+ options,
68
+ groups,
69
+ value = $bindable(),
70
+ onChange,
71
+ ref = $bindable(null),
72
+ ...rest
73
+ }: SelectProps<T> = $props();
74
+
75
+ const name = useFieldName(() => label);
76
+ const fromRow = $derived(label === undefined);
77
+ const runs = $derived(groups ?? [{ entries: options ?? [] }]);
78
+ const shared = $derived({
79
+ label: name() ?? "",
80
+ hideLabel: !!hideLabel || fromRow,
81
+ width: width ?? (fromRow ? "steady" : defaultWidth(size)),
82
+ rows,
83
+ groups: runs,
84
+ triggerClass: `${selectTriggerClass(size, wrap)} ${className}`.trim(),
85
+ });
86
+
87
+ function pick(next: T) {
88
+ value = next;
89
+ onChange?.(next);
90
+ }
91
+ </script>
92
+
93
+ {#if hasSubmenu(runs)}
94
+ <MenuSelect data-glim="Select" {...rest} {...shared} {value} onChange={pick} bind:ref />
95
+ {:else}
96
+ <ListSelect data-glim="Select" {...rest} {...shared} {value} onChange={pick} bind:ref />
97
+ {/if}