@mondarth/ui 0.0.0-stage → 0.8.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 (76) hide show
  1. package/LICENSE +21 -0
  2. package/dist/AppShell.svelte +107 -0
  3. package/dist/AppShell.svelte.d.ts +14 -0
  4. package/dist/Badge.svelte +54 -0
  5. package/dist/Badge.svelte.d.ts +9 -0
  6. package/dist/Brand.svelte +62 -0
  7. package/dist/Brand.svelte.d.ts +14 -0
  8. package/dist/Button.svelte +73 -0
  9. package/dist/Button.svelte.d.ts +10 -0
  10. package/dist/Callout.svelte +40 -0
  11. package/dist/Callout.svelte.d.ts +9 -0
  12. package/dist/CalloutMark.svelte +104 -0
  13. package/dist/CalloutMark.svelte.d.ts +14 -0
  14. package/dist/Checkbox.svelte +60 -0
  15. package/dist/Checkbox.svelte.d.ts +15 -0
  16. package/dist/ContextMenu.svelte +151 -0
  17. package/dist/ContextMenu.svelte.d.ts +15 -0
  18. package/dist/Dialog.svelte +73 -0
  19. package/dist/Dialog.svelte.d.ts +14 -0
  20. package/dist/DrawerLayout.svelte +182 -0
  21. package/dist/DrawerLayout.svelte.d.ts +26 -0
  22. package/dist/DrawerToggle.svelte +66 -0
  23. package/dist/DrawerToggle.svelte.d.ts +11 -0
  24. package/dist/ExpandableList.svelte +164 -0
  25. package/dist/ExpandableList.svelte.d.ts +46 -0
  26. package/dist/Field.svelte +109 -0
  27. package/dist/Field.svelte.d.ts +28 -0
  28. package/dist/FooterLinks.svelte +54 -0
  29. package/dist/FooterLinks.svelte.d.ts +15 -0
  30. package/dist/LanguagePicker.svelte +48 -0
  31. package/dist/LanguagePicker.svelte.d.ts +33 -0
  32. package/dist/Logo.svelte +36 -0
  33. package/dist/Logo.svelte.d.ts +12 -0
  34. package/dist/Notice.svelte +116 -0
  35. package/dist/Notice.svelte.d.ts +13 -0
  36. package/dist/Panel.svelte +41 -0
  37. package/dist/Panel.svelte.d.ts +11 -0
  38. package/dist/Prose.svelte +23 -0
  39. package/dist/Prose.svelte.d.ts +8 -0
  40. package/dist/ReturnLink.svelte +50 -0
  41. package/dist/ReturnLink.svelte.d.ts +12 -0
  42. package/dist/SplitPanes.svelte +92 -0
  43. package/dist/SplitPanes.svelte.d.ts +21 -0
  44. package/dist/Splitter.svelte +160 -0
  45. package/dist/Splitter.svelte.d.ts +20 -0
  46. package/dist/Table.svelte +65 -0
  47. package/dist/Table.svelte.d.ts +12 -0
  48. package/dist/Toast.svelte +143 -0
  49. package/dist/Toast.svelte.d.ts +18 -0
  50. package/dist/TopBar.svelte +68 -0
  51. package/dist/TopBar.svelte.d.ts +19 -0
  52. package/dist/Tree.svelte +367 -0
  53. package/dist/Tree.svelte.d.ts +27 -0
  54. package/dist/UserMenu.svelte +209 -0
  55. package/dist/UserMenu.svelte.d.ts +10 -0
  56. package/dist/WarningMark.svelte +33 -0
  57. package/dist/WarningMark.svelte.d.ts +10 -0
  58. package/dist/context-menu.d.ts +41 -0
  59. package/dist/context-menu.js +80 -0
  60. package/dist/dates.d.ts +37 -0
  61. package/dist/dates.js +69 -0
  62. package/dist/index.d.ts +46 -0
  63. package/dist/index.js +42 -0
  64. package/dist/language.d.ts +7 -0
  65. package/dist/language.js +12 -0
  66. package/dist/remembered.d.ts +30 -0
  67. package/dist/remembered.js +50 -0
  68. package/dist/site.d.ts +7 -0
  69. package/dist/site.js +5 -0
  70. package/dist/theme.css +61 -0
  71. package/dist/top-bar.d.ts +29 -0
  72. package/dist/top-bar.js +2 -0
  73. package/dist/tree.d.ts +29 -0
  74. package/dist/tree.js +27 -0
  75. package/package.json +84 -3
  76. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ulenar of Mondarth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,107 @@
1
+ <!--
2
+ The frame of every page: a link to skip to the page's content, the header (the logo, and the top bar once signed
3
+ in), the page itself in its main landmark, and the footer. An application's frame takes the window's whole width,
4
+ with a side gutter that grows with it; a page meant to be read, such as the Terms, keeps its text to a readable width
5
+ within it (`Prose`). With `fill`, as for an application's workspace, it is the window's height, and the page fills
6
+ what the header and footer leave, edge to edge, for a `DrawerLayout` and `SplitPanes` to share.
7
+ -->
8
+ <script lang="ts">
9
+ import type { Snippet } from 'svelte';
10
+
11
+ interface Props {
12
+ /** The skip link's words, in the page's language. */
13
+ skipLabel: string;
14
+ header: Snippet;
15
+ footer?: Snippet;
16
+ /** The page. */
17
+ children: Snippet;
18
+ /** Whether the page fills the window's height, edge to edge, below the header. */
19
+ fill?: boolean;
20
+ }
21
+
22
+ let { skipLabel, header, footer, children, fill = false }: Props = $props();
23
+ </script>
24
+
25
+ <div class={['shell', { fill }]}>
26
+ <a class="skip" href="#main">{skipLabel}</a>
27
+ <header class="frame">{@render header()}</header>
28
+ <main id="main" class="frame" tabindex="-1">{@render children()}</main>
29
+ {#if footer}<footer class="frame">{@render footer()}</footer>{/if}
30
+ </div>
31
+
32
+ <style>
33
+ .frame {
34
+ box-sizing: border-box;
35
+ width: 100%;
36
+ padding-inline: clamp(var(--mdr-space-4), 3vw, var(--mdr-space-7));
37
+ }
38
+
39
+ header {
40
+ display: flex;
41
+ flex-wrap: wrap;
42
+ gap: var(--mdr-space-4);
43
+ align-items: center;
44
+ padding-block: var(--mdr-space-3);
45
+ }
46
+
47
+ main {
48
+ padding-block: var(--mdr-space-5) var(--mdr-space-7);
49
+ }
50
+
51
+ main:focus {
52
+ outline: none;
53
+ }
54
+
55
+ /* Filling the window: the page takes what the header and footer leave, and scrolls within itself. */
56
+ .fill {
57
+ display: flex;
58
+ flex-direction: column;
59
+ height: 100dvh;
60
+ }
61
+
62
+ .fill header {
63
+ flex: none;
64
+ }
65
+
66
+ /* Its content in a column: what comes first, as a notice, at its own height, and a workspace, given \`flex: 1\`, the rest.
67
+ What would run past it is clipped, so that nothing a page holds can paint over the footer: a workspace scrolls
68
+ within itself. */
69
+ .fill main {
70
+ display: flex;
71
+ flex: 1;
72
+ flex-direction: column;
73
+ min-height: 0;
74
+ padding: 0;
75
+ overflow: hidden;
76
+ border-top: var(--mdr-border-width-thin) solid var(--mdr-color-border);
77
+ }
78
+
79
+ /* Filling the window, the footer is a line along its foot. */
80
+ .fill footer {
81
+ flex: none;
82
+ padding-block: var(--mdr-space-2);
83
+ }
84
+
85
+ footer {
86
+ padding-block: var(--mdr-space-5);
87
+ border-top: var(--mdr-border-width-thin) solid var(--mdr-color-border);
88
+ color: var(--mdr-color-text-muted);
89
+ font-size: var(--mdr-font-size-small);
90
+ }
91
+
92
+ .skip {
93
+ position: absolute;
94
+ inset-inline-start: var(--mdr-space-4);
95
+ top: calc(-1 * var(--mdr-space-7));
96
+ padding: var(--mdr-space-2) var(--mdr-space-4);
97
+ border-radius: var(--mdr-radius-small);
98
+ background: var(--mdr-color-action);
99
+ color: var(--mdr-color-text-on-action);
100
+ font-weight: var(--mdr-font-weight-strong);
101
+ }
102
+
103
+ .skip:focus {
104
+ top: var(--mdr-space-2);
105
+ outline: var(--mdr-border-width-focus) solid var(--mdr-color-focus);
106
+ }
107
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ /** The skip link's words, in the page's language. */
4
+ skipLabel: string;
5
+ header: Snippet;
6
+ footer?: Snippet;
7
+ /** The page. */
8
+ children: Snippet;
9
+ /** Whether the page fills the window's height, edge to edge, below the header. */
10
+ fill?: boolean;
11
+ }
12
+ declare const AppShell: import("svelte").Component<Props, {}, "">;
13
+ type AppShell = ReturnType<typeof AppShell>;
14
+ export default AppShell;
@@ -0,0 +1,54 @@
1
+ <!--
2
+ A badge: a word or two of state beside what it is about, such as "Introductory" or "Disputed". Its tone is a colour
3
+ of the theme; its words say what it means, as colour alone never does.
4
+ -->
5
+ <script lang="ts">
6
+ import type { Snippet } from 'svelte';
7
+
8
+ interface Props {
9
+ /** Its colour, by what it means. */
10
+ tone?: 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
11
+ children: Snippet;
12
+ }
13
+
14
+ let { tone = 'neutral', children }: Props = $props();
15
+ </script>
16
+
17
+ <span class="badge {tone}">{@render children()}</span>
18
+
19
+ <style>
20
+ .badge {
21
+ --tone: var(--mdr-color-text-muted);
22
+
23
+ display: inline-block;
24
+ padding: 0 var(--mdr-space-2);
25
+ border: var(--mdr-border-width-thin) solid var(--tone);
26
+ border-radius: var(--mdr-radius-pill);
27
+ background: var(--mdr-color-subtle);
28
+ color: var(--tone);
29
+ font-size: var(--mdr-font-size-small);
30
+ font-weight: var(--mdr-font-weight-strong);
31
+ line-height: var(--mdr-font-line-height-body);
32
+ white-space: nowrap;
33
+ }
34
+
35
+ .accent {
36
+ --tone: var(--mdr-color-accent);
37
+ }
38
+
39
+ .success {
40
+ --tone: var(--mdr-color-success);
41
+ }
42
+
43
+ .warning {
44
+ --tone: var(--mdr-color-warning);
45
+ }
46
+
47
+ .danger {
48
+ --tone: var(--mdr-color-danger);
49
+ }
50
+
51
+ .info {
52
+ --tone: var(--mdr-color-info);
53
+ }
54
+ </style>
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ /** Its colour, by what it means. */
4
+ tone?: 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
5
+ children: Snippet;
6
+ }
7
+ declare const Badge: import("svelte").Component<Props, {}, "">;
8
+ type Badge = ReturnType<typeof Badge>;
9
+ export default Badge;
@@ -0,0 +1,62 @@
1
+ <!--
2
+ A Mondarth website's brand, at the left of its header, linking home: its logo, and beside it its name on two lines,
3
+ "Mondarth" in Mondarth's colour over the site's own name in the site's colour, each as text readable in either theme
4
+ (the design tokens' `color.site-text`). It marks itself with its site, so that its colours are its own wherever it is.
5
+ -->
6
+ <script lang="ts">
7
+ import type { Site } from './site.js';
8
+ import Logo from './Logo.svelte';
9
+
10
+ interface Props {
11
+ /** Where its link goes: the site's home. */
12
+ href: string;
13
+ /** Which site it is: its logo, and its colour. */
14
+ site: Site;
15
+ /** The site's own name, under "Mondarth", in the page's language. */
16
+ name: string;
17
+ /** What the link says to a screen reader: its visible words, and where it goes, such as "Mondarth Accounts: home". */
18
+ label: string;
19
+ }
20
+
21
+ let { href, site, name, label }: Props = $props();
22
+ </script>
23
+
24
+ <a class="brand" {href} aria-label={label} data-site={site}>
25
+ <Logo {site} height="2.5rem" />
26
+ <span class="name">
27
+ <span class="mondarth">Mondarth</span>
28
+ <span class="site">{name}</span>
29
+ </span>
30
+ </a>
31
+
32
+ <style>
33
+ .brand {
34
+ display: inline-flex;
35
+ flex: none;
36
+ gap: var(--mdr-space-2);
37
+ align-items: center;
38
+ text-decoration: none;
39
+ }
40
+
41
+ .name {
42
+ display: grid;
43
+ line-height: var(--mdr-font-line-height-tight);
44
+ }
45
+
46
+ .mondarth {
47
+ color: var(--mdr-color-site-text-mondarth);
48
+ font-size: var(--mdr-font-size-large);
49
+ font-weight: var(--mdr-font-weight-strong);
50
+ }
51
+
52
+ .site {
53
+ color: var(--mdr-color-site-text);
54
+ font-size: var(--mdr-font-size-small);
55
+ font-weight: var(--mdr-font-weight-strong);
56
+ }
57
+
58
+ .brand:hover .name,
59
+ .brand:focus-visible .name {
60
+ text-decoration: underline;
61
+ }
62
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Site } from './site.js';
2
+ interface Props {
3
+ /** Where its link goes: the site's home. */
4
+ href: string;
5
+ /** Which site it is: its logo, and its colour. */
6
+ site: Site;
7
+ /** The site's own name, under "Mondarth", in the page's language. */
8
+ name: string;
9
+ /** What the link says to a screen reader: its visible words, and where it goes, such as "Mondarth Accounts: home". */
10
+ label: string;
11
+ }
12
+ declare const Brand: import("svelte").Component<Props, {}, "">;
13
+ type Brand = ReturnType<typeof Brand>;
14
+ export default Brand;
@@ -0,0 +1,73 @@
1
+ <!--
2
+ A button: `primary` for the one main action of a view (the gear's gold), `secondary` for the rest, `danger` for what
3
+ cannot be undone. A native button, so that it submits a form as the page's form would; whatever else it is given
4
+ (`name`, `value`, `formaction`, `aria-*`) it passes on.
5
+ -->
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import type { HTMLButtonAttributes } from 'svelte/elements';
9
+
10
+ interface Props extends HTMLButtonAttributes {
11
+ /** What kind of action it is. */
12
+ variant?: 'primary' | 'secondary' | 'danger';
13
+ children: Snippet;
14
+ }
15
+
16
+ let { variant = 'secondary', type = 'button', children, ...rest }: Props = $props();
17
+ </script>
18
+
19
+ <button {...rest} {type} class="button {variant}">{@render children()}</button>
20
+
21
+ <style>
22
+ .button {
23
+ display: inline-flex;
24
+ gap: var(--mdr-space-2);
25
+ align-items: center;
26
+ justify-content: center;
27
+ padding: var(--mdr-space-2) var(--mdr-space-4);
28
+ border: var(--mdr-border-width-thin) solid var(--mdr-color-border-strong);
29
+ border-radius: var(--mdr-radius-small);
30
+ background: var(--mdr-color-surface);
31
+ color: var(--mdr-color-text);
32
+ font: inherit;
33
+ font-weight: var(--mdr-font-weight-strong);
34
+ line-height: var(--mdr-font-line-height-tight);
35
+ cursor: pointer;
36
+ }
37
+
38
+ .button:hover {
39
+ border-color: var(--mdr-color-accent);
40
+ }
41
+
42
+ .button:focus-visible {
43
+ outline: var(--mdr-border-width-focus) solid var(--mdr-color-focus);
44
+ outline-offset: 2px;
45
+ }
46
+
47
+ .primary {
48
+ border-color: var(--mdr-color-action);
49
+ background: var(--mdr-color-action);
50
+ color: var(--mdr-color-text-on-action);
51
+ }
52
+
53
+ .primary:hover {
54
+ border-color: var(--mdr-color-text);
55
+ }
56
+
57
+ .danger {
58
+ border-color: var(--mdr-color-danger);
59
+ color: var(--mdr-color-danger);
60
+ }
61
+
62
+ .danger:hover {
63
+ border-color: var(--mdr-color-danger);
64
+ background: var(--mdr-color-subtle);
65
+ }
66
+
67
+ .button:disabled {
68
+ border-color: var(--mdr-color-border);
69
+ background: var(--mdr-color-subtle);
70
+ color: var(--mdr-color-text-muted);
71
+ cursor: not-allowed;
72
+ }
73
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ interface Props extends HTMLButtonAttributes {
4
+ /** What kind of action it is. */
5
+ variant?: 'primary' | 'secondary' | 'danger';
6
+ children: Snippet;
7
+ }
8
+ declare const Button: import("svelte").Component<Props, {}, "">;
9
+ type Button = ReturnType<typeof Button>;
10
+ export default Button;
@@ -0,0 +1,40 @@
1
+ <!--
2
+ A problem with what was just done, beside the form it is about: it stands out, is announced as an alert, and takes
3
+ the focus when the page shows it, which scrolls it into view, so that the eye is drawn to it wherever it is.
4
+ -->
5
+ <script lang="ts">
6
+ import type { Snippet } from 'svelte';
7
+
8
+ interface Props {
9
+ /** Its id, for the fields it is about to name it with `aria-describedby`. */
10
+ id?: string;
11
+ children: Snippet;
12
+ }
13
+
14
+ let { id, children }: Props = $props();
15
+ let element: HTMLElement | undefined = $state();
16
+
17
+ $effect(() => {
18
+ element?.focus();
19
+ });
20
+ </script>
21
+
22
+ <div bind:this={element} {id} class="callout" role="alert" tabindex="-1">
23
+ {@render children()}
24
+ </div>
25
+
26
+ <style>
27
+ .callout {
28
+ margin-block: var(--mdr-space-2);
29
+ padding: var(--mdr-space-3) var(--mdr-space-4);
30
+ border-inline-start: var(--mdr-border-width-rule) solid var(--mdr-color-accent);
31
+ background: var(--mdr-color-subtle);
32
+ color: var(--mdr-color-text);
33
+ font-weight: var(--mdr-font-weight-strong);
34
+ }
35
+
36
+ .callout:focus {
37
+ outline: var(--mdr-border-width-focus) solid var(--mdr-color-focus);
38
+ outline-offset: 2px;
39
+ }
40
+ </style>
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ /** Its id, for the fields it is about to name it with `aria-describedby`. */
4
+ id?: string;
5
+ children: Snippet;
6
+ }
7
+ declare const Callout: import("svelte").Component<Props, {}, "">;
8
+ type Callout = ReturnType<typeof Callout>;
9
+ export default Callout;
@@ -0,0 +1,104 @@
1
+ <!--
2
+ A mark beside what it is about, which, pointed at, focused or pressed, shows its callout: what it means. The callout
3
+ describes the mark for a screen reader, so it is heard where it is seen. Escape hides it again. Its icon is the
4
+ application's, in its tone's colour: a warning's, or a quieter note's.
5
+ -->
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+
9
+ interface Props {
10
+ /** What the mark is called, such as "Warning", in the application's words. */
11
+ label: string;
12
+ /** Its colour, by what it means: a warning, or a note, muted. */
13
+ tone?: 'warning' | 'note';
14
+ /** Its icon, drawn in its tone's colour (`currentColor`), hidden from screen readers. */
15
+ icon: Snippet;
16
+ /** What it means. */
17
+ children: Snippet;
18
+ }
19
+
20
+ let { label, tone = 'note', icon, children }: Props = $props();
21
+
22
+ const id = $props.id();
23
+ /** Whether it was pressed open, as on a touch screen, where nothing is pointed at. */
24
+ let open = $state(false);
25
+ </script>
26
+
27
+ <span class="callout-mark">
28
+ <button
29
+ type="button"
30
+ class={['mark', tone]}
31
+ aria-label={label}
32
+ aria-describedby="{id}-callout"
33
+ aria-expanded={open}
34
+ onclick={() => {
35
+ open = !open;
36
+ }}
37
+ onkeydown={event => {
38
+ if (event.key === 'Escape') open = false;
39
+ }}
40
+ onblur={() => {
41
+ open = false;
42
+ }}>
43
+ {@render icon()}
44
+ </button>
45
+ <span class={['callout', tone, { open }]} id="{id}-callout" role="tooltip">{@render children()}</span>
46
+ </span>
47
+
48
+ <style>
49
+ .callout-mark {
50
+ position: relative;
51
+ display: inline-flex;
52
+ vertical-align: middle;
53
+ }
54
+
55
+ .mark {
56
+ display: inline-grid;
57
+ place-items: center;
58
+ padding: var(--mdr-space-1);
59
+ border: var(--mdr-border-width-thin) solid transparent;
60
+ border-radius: var(--mdr-radius-small);
61
+ background: none;
62
+ color: var(--mdr-color-text-muted);
63
+ cursor: help;
64
+ }
65
+
66
+ .mark:focus-visible {
67
+ outline: var(--mdr-border-width-focus) solid var(--mdr-color-focus);
68
+ outline-offset: var(--mdr-border-width-thin);
69
+ }
70
+
71
+ /* Above what it is about, from its start, over what is around it; hidden until wanted. */
72
+ .callout {
73
+ position: absolute;
74
+ inset-block-end: calc(100% + var(--mdr-space-1));
75
+ inset-inline-start: 0;
76
+ z-index: 10;
77
+ width: max-content;
78
+ max-width: min(20rem, 80vw);
79
+ padding: var(--mdr-space-2) var(--mdr-space-3);
80
+ border: var(--mdr-border-width-thin) solid var(--mdr-color-border);
81
+ border-radius: var(--mdr-radius-small);
82
+ background: var(--mdr-color-surface);
83
+ color: var(--mdr-color-text);
84
+ font-size: var(--mdr-font-size-small);
85
+ font-weight: var(--mdr-font-weight-regular);
86
+ white-space: normal;
87
+ visibility: hidden;
88
+ }
89
+
90
+ /* A warning's mark and callout in the warning's colour. */
91
+ .mark.warning {
92
+ color: var(--mdr-color-warning);
93
+ }
94
+
95
+ .callout.warning {
96
+ border-color: var(--mdr-color-warning);
97
+ }
98
+
99
+ .mark:hover + .callout,
100
+ .mark:focus-visible + .callout,
101
+ .callout.open {
102
+ visibility: visible;
103
+ }
104
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ /** What the mark is called, such as "Warning", in the application's words. */
4
+ label: string;
5
+ /** Its colour, by what it means: a warning, or a note, muted. */
6
+ tone?: 'warning' | 'note';
7
+ /** Its icon, drawn in its tone's colour (`currentColor`), hidden from screen readers. */
8
+ icon: Snippet;
9
+ /** What it means. */
10
+ children: Snippet;
11
+ }
12
+ declare const CalloutMark: import("svelte").Component<Props, {}, "">;
13
+ type CalloutMark = ReturnType<typeof CalloutMark>;
14
+ export default CalloutMark;
@@ -0,0 +1,60 @@
1
+ <!--
2
+ A checkbox, its label beside it, and a hint below; a native one, posting `name` as the page's form would. Whatever
3
+ else it is given (`name`, `value`, `required`, `aria-*`) it passes on.
4
+ -->
5
+ <script lang="ts">
6
+ import type { Snippet } from 'svelte';
7
+ import type { HTMLInputAttributes } from 'svelte/elements';
8
+
9
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'children'> {
10
+ /** Its id, which the label names. */
11
+ id: string;
12
+ /** Whether it is ticked. */
13
+ checked?: boolean;
14
+ /** What helps to decide. */
15
+ hint?: string | undefined;
16
+ /** The label: words, or words with a link. */
17
+ children: Snippet;
18
+ }
19
+
20
+ let { id, checked = $bindable(false), hint, children, ...rest }: Props = $props();
21
+ </script>
22
+
23
+ <div class="checkbox">
24
+ <input
25
+ {...rest}
26
+ {id}
27
+ type="checkbox"
28
+ bind:checked
29
+ aria-describedby={hint === undefined ? rest['aria-describedby'] : `${id}-hint`} />
30
+ <label for={id}>{@render children()}</label>
31
+ {#if hint !== undefined}<p class="hint" id="{id}-hint">{hint}</p>{/if}
32
+ </div>
33
+
34
+ <style>
35
+ .checkbox {
36
+ display: grid;
37
+ grid-template-columns: auto 1fr;
38
+ gap: var(--mdr-space-1) var(--mdr-space-2);
39
+ align-items: baseline;
40
+ }
41
+
42
+ input {
43
+ width: 1.1rem;
44
+ height: 1.1rem;
45
+ margin: 0;
46
+ accent-color: var(--mdr-color-accent);
47
+ }
48
+
49
+ input:focus-visible {
50
+ outline: var(--mdr-border-width-focus) solid var(--mdr-color-focus);
51
+ outline-offset: 2px;
52
+ }
53
+
54
+ .hint {
55
+ grid-column: 2;
56
+ margin: 0;
57
+ color: var(--mdr-color-text-muted);
58
+ font-size: var(--mdr-font-size-small);
59
+ }
60
+ </style>
@@ -0,0 +1,15 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'children'> {
4
+ /** Its id, which the label names. */
5
+ id: string;
6
+ /** Whether it is ticked. */
7
+ checked?: boolean;
8
+ /** What helps to decide. */
9
+ hint?: string | undefined;
10
+ /** The label: words, or words with a link. */
11
+ children: Snippet;
12
+ }
13
+ declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
14
+ type Checkbox = ReturnType<typeof Checkbox>;
15
+ export default Checkbox;