@glimstone/svelte 4.6.0 → 4.7.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.
@@ -0,0 +1,91 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+ import type { ConnectionRowLabelKeys, ConnectionRowText, ConnectionTest, TileMark } from "@glimstone/core";
5
+
6
+ export type { ConnectionRowLabelKeys, ConnectionRowText, ConnectionTest } from "@glimstone/core";
7
+
8
+ export interface ConnectionRowProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "class"> {
9
+ /** The service's name, also the row's accessible name. */
10
+ name: string;
11
+ /** A brand's mark from a catalog, which stands on its own colour, or one of the app's glyphs, which stands on the accent. */
12
+ mark: TileMark | Snippet;
13
+ /** One quiet line under the name, such as who is signed in or where it connects. */
14
+ status?: string;
15
+ /** Badges after the name, for a state that is not the normal case, such as a failed connection. */
16
+ badges?: Snippet;
17
+ /** More quiet lines under the status, such as what uses the connection. */
18
+ children?: Snippet;
19
+ /** Where the test stands: `busy` while it runs, then `tone` and a `title` with what it found. */
20
+ test?: ConnectionTest;
21
+ text: ConnectionRowText;
22
+ labelKeys?: Partial<ConnectionRowLabelKeys>;
23
+ onTest?: () => void;
24
+ onEdit?: () => void;
25
+ onRemove?: () => void;
26
+ class?: string;
27
+ }
28
+ </script>
29
+
30
+ <script lang="ts">
31
+ import { CONNECTION_ROW_KEYS, connectionTestFace, connectionTile } from "@glimstone/core";
32
+ import BrandMark from "./BrandMark.svelte";
33
+ import Button from "./Button.svelte";
34
+ import { IconCheck, IconClose } from "./glyphs.js";
35
+ import { css } from "./style.js";
36
+
37
+ // A connected service or account as a compact row ("Connections" in the design
38
+ // language): its mark lit on a tile the row's whole height, its name with any
39
+ // badges, one quiet line on how it stands, and its test, edit and remove at
40
+ // the end. A button stands only where its handler is passed. The other props
41
+ // of a <div> go to the row.
42
+ let { name, mark, status, badges, children, test, text, labelKeys, onTest, onEdit, onRemove, class: className, ...rest }: ConnectionRowProps = $props();
43
+
44
+ // On a phone the buttons show their glyphs alone, so they keep to one line.
45
+ const NARROW = 640;
46
+
47
+ const keys = $derived({ ...CONNECTION_ROW_KEYS, ...labelKeys });
48
+ const tile = $derived(connectionTile(mark));
49
+ const face = $derived(connectionTestFace(test));
50
+ const outcome = $derived(face.outcome === "check" ? IconCheck : face.outcome === "cross" ? IconClose : undefined);
51
+ </script>
52
+
53
+ <div data-glim="ConnectionRow" role="group" aria-label={name} {...rest} class={["glim-well glim-connection", className].filter(Boolean).join(" ")}>
54
+ <span class="glim-connection-tile" style={css(tile.style)} aria-hidden="true">
55
+ <span class="glim-connection-mark">
56
+ {#if tile.svg !== undefined}<BrandMark svg={tile.svg} />{:else}{@render (mark as Snippet)()}{/if}
57
+ </span>
58
+ </span>
59
+ <div class="glim-connection-main">
60
+ <div class="glim-connection-head">
61
+ <span class="glim-connection-name">{name}</span>
62
+ {#if badges}<span class="glim-connection-badges">{@render badges()}</span>{/if}
63
+ </div>
64
+ <div class="glim-connection-foot">
65
+ <div class="glim-connection-about">
66
+ {#if status}<p class="glim-connection-status">{status}</p>{/if}
67
+ {@render children?.()}
68
+ </div>
69
+ {#if onTest || onEdit || onRemove}
70
+ <span class="glim-connection-actions">
71
+ {#if onTest}
72
+ <Button
73
+ label={text.test}
74
+ labelKey={keys.test}
75
+ glyph={outcome}
76
+ tone={face.tone}
77
+ busy={test?.busy}
78
+ title={test?.title}
79
+ compactBelow={NARROW}
80
+ class={face.shake ? "glim-shake" : ""}
81
+ data-connection="test"
82
+ onClick={onTest}
83
+ />
84
+ {/if}
85
+ {#if onEdit}<Button label={text.edit} labelKey={keys.edit} compactBelow={NARROW} data-connection="edit" onClick={onEdit} />{/if}
86
+ {#if onRemove}<Button label={text.remove} labelKey={keys.remove} compactBelow={NARROW} data-connection="remove" onClick={onRemove} />{/if}
87
+ </span>
88
+ {/if}
89
+ </div>
90
+ </div>
91
+ </div>
@@ -0,0 +1,27 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ import type { ConnectionRowLabelKeys, ConnectionRowText, ConnectionTest, TileMark } from "@glimstone/core";
4
+ export type { ConnectionRowLabelKeys, ConnectionRowText, ConnectionTest } from "@glimstone/core";
5
+ export interface ConnectionRowProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "class"> {
6
+ /** The service's name, also the row's accessible name. */
7
+ name: string;
8
+ /** A brand's mark from a catalog, which stands on its own colour, or one of the app's glyphs, which stands on the accent. */
9
+ mark: TileMark | Snippet;
10
+ /** One quiet line under the name, such as who is signed in or where it connects. */
11
+ status?: string;
12
+ /** Badges after the name, for a state that is not the normal case, such as a failed connection. */
13
+ badges?: Snippet;
14
+ /** More quiet lines under the status, such as what uses the connection. */
15
+ children?: Snippet;
16
+ /** Where the test stands: `busy` while it runs, then `tone` and a `title` with what it found. */
17
+ test?: ConnectionTest;
18
+ text: ConnectionRowText;
19
+ labelKeys?: Partial<ConnectionRowLabelKeys>;
20
+ onTest?: () => void;
21
+ onEdit?: () => void;
22
+ onRemove?: () => void;
23
+ class?: string;
24
+ }
25
+ declare const ConnectionRow: import("svelte").Component<ConnectionRowProps, {}, "">;
26
+ type ConnectionRow = ReturnType<typeof ConnectionRow>;
27
+ export default ConnectionRow;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { default as Checkbox, type CheckboxProps } from "./Checkbox.svelte";
8
8
  export { default as CoffeeDialog, type CoffeeDialogProps } from "./CoffeeDialog.svelte";
9
9
  export { default as ColorPicker, type ColorName, type ColorPickerPanelText, type ColorPickerProps } from "./ColorPicker.svelte";
10
10
  export { default as ConfirmDialog, type ConfirmDialogProps } from "./ConfirmDialog.svelte";
11
+ export { default as ConnectionRow, type ConnectionRowLabelKeys, type ConnectionRowProps, type ConnectionRowText, type ConnectionTest } from "./ConnectionRow.svelte";
11
12
  export { default as ContextMenu, type ContextMenuProps, type MenuEntry, type MenuHead, type MenuItem } from "./ContextMenu.svelte";
12
13
  export { default as CopyField, type CopyFieldProps } from "./CopyField.svelte";
13
14
  export { default as CryptoDonateDialog, type CryptoCoin, type CryptoDonateDialogProps, type CryptoNetwork } from "./CryptoDonateDialog.svelte";
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export { default as Checkbox } from "./Checkbox.svelte";
8
8
  export { default as CoffeeDialog } from "./CoffeeDialog.svelte";
9
9
  export { default as ColorPicker } from "./ColorPicker.svelte";
10
10
  export { default as ConfirmDialog } from "./ConfirmDialog.svelte";
11
+ export { default as ConnectionRow } from "./ConnectionRow.svelte";
11
12
  export { default as ContextMenu } from "./ContextMenu.svelte";
12
13
  export { default as CopyField } from "./CopyField.svelte";
13
14
  export { default as CryptoDonateDialog } from "./CryptoDonateDialog.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glimstone/svelte",
3
- "version": "4.6.0",
3
+ "version": "4.7.0",
4
4
  "description": "GlimStone's components for Svelte",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -141,7 +141,7 @@
141
141
  "build": "svelte-package -i src -o dist"
142
142
  },
143
143
  "dependencies": {
144
- "@glimstone/core": "4.6.0"
144
+ "@glimstone/core": "4.7.0"
145
145
  },
146
146
  "peerDependencies": {
147
147
  "@internationalized/date": "^3.12.4",