@filipgutica/design-system 1.0.8 → 1.0.10
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.
- package/README.md +2 -2
- package/dist/class/themes/mauve.css +133 -0
- package/dist/class/themes/pine.css +133 -0
- package/language/components.html +29 -3
- package/language/components.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Filip's design language for any framework: the spec, the tokens, the component catalogue, and the editor themes. It ships as the npm package `@filipgutica/design-system`.
|
|
4
4
|
|
|
5
|
-
- **Agents** get `language/` at `~/design-language` through filip-stack host config.
|
|
5
|
+
- **Agents** get `language/` at `~/design-language` through filip-stack host config, or by copying it from the package; the site's [Agents](https://filipgutica.github.io/design-system/#agents) section has both.
|
|
6
6
|
- **Vue apps** use [`@filipgutica/ui`](https://github.com/filipgutica/ui), which implements this design language.
|
|
7
7
|
- **Site:** <https://filipgutica.github.io/design-system/> has the Overview, Foundations, and Components pages, with `index.json` and `llms.txt` for agents.
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ npm install @filipgutica/design-system
|
|
|
31
31
|
| Import | What it is |
|
|
32
32
|
| --- | --- |
|
|
33
33
|
| `@filipgutica/design-system/tokens.css` | The tokens with their standalone names. Dark mode follows `prefers-color-scheme`; set `data-theme="light"` or `"dark"` on `<html>` to override it. |
|
|
34
|
-
| `@filipgutica/design-system/class/base.css`, `class/themes/*.css` | The same values with `@filipgutica/ui`'s names, for apps that toggle a `.dark` class on `<html>`. Use one flavour per app.
|
|
34
|
+
| `@filipgutica/design-system/class/base.css`, `class/themes/*.css` | The same values with `@filipgutica/ui`'s names, for apps that toggle a `.dark` class on `<html>`. Use one flavour per app. Import `class/base.css`, then one theme's roles: `class/themes/graphite-indigo.css` (the default), `mauve.css`, or `pine.css`. |
|
|
35
35
|
| `@filipgutica/design-system/themes/*.css` | A theme's identity inputs (hue pair and fonts): `graphite-indigo` (the default, already in `tokens.css`), `mauve`, or `pine`. Load one after `tokens.css`, on `:root`. |
|
|
36
36
|
| `@filipgutica/design-system/fonts.css` | IBM Plex Sans and Mono. |
|
|
37
37
|
| `@filipgutica/design-system` | `tokens` (resolved values per theme and mode) and `cssVar(name)`, with types. |
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* Generated from tokens/core.json and tokens/themes/mauve.json by scripts/build-tokens.mjs in @filipgutica/design-system. Do not edit.
|
|
2
|
+
* Opt-in Mauve roles for the class flavour. Import after class/base.css (theme.css in @filipgutica/ui).
|
|
3
|
+
* Dark mode uses the same .dark class as the base. Keep exactly one :root.dark block:
|
|
4
|
+
* sites copy it into a <noscript> prefers-color-scheme rule. */
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
color-scheme: light;
|
|
8
|
+
--color-project: #6c5267;
|
|
9
|
+
--color-project-dark: #d1b3c8;
|
|
10
|
+
--color-bg: #f4f5f6;
|
|
11
|
+
--color-surface: #e9ebed;
|
|
12
|
+
--color-surface-raised: #fbfbfc;
|
|
13
|
+
--color-surface-muted: #e2e5e8;
|
|
14
|
+
--color-text: #101315;
|
|
15
|
+
--color-muted: #50575e;
|
|
16
|
+
--color-link: #0b5f7c;
|
|
17
|
+
--color-accent: var(--color-project);
|
|
18
|
+
--color-accent-text: var(--color-bg);
|
|
19
|
+
--color-focus: var(--color-accent);
|
|
20
|
+
--color-border: #6d747b;
|
|
21
|
+
--color-border-subtle: #d3d8dd;
|
|
22
|
+
--color-button-bg: var(--color-accent);
|
|
23
|
+
--color-button-text: var(--color-accent-text);
|
|
24
|
+
--color-button-hover: color-mix(in srgb, var(--color-accent) 85%, var(--color-text));
|
|
25
|
+
--color-input-bg: var(--color-surface-raised);
|
|
26
|
+
--color-input-text: var(--color-text);
|
|
27
|
+
--color-input-border: var(--color-border);
|
|
28
|
+
--color-input-placeholder: var(--color-muted);
|
|
29
|
+
--color-row-hover: #e2e5e8;
|
|
30
|
+
--color-row-selected: var(--color-surface-raised);
|
|
31
|
+
--color-row-selected-text: var(--color-text);
|
|
32
|
+
--color-code: var(--color-surface);
|
|
33
|
+
--color-code-text: var(--color-text);
|
|
34
|
+
--color-syntax-comment: #626772;
|
|
35
|
+
--color-syntax-keyword: #715b42;
|
|
36
|
+
--color-syntax-string: #346347;
|
|
37
|
+
--color-syntax-number: #86532e;
|
|
38
|
+
--color-syntax-function: var(--color-syntax-keyword);
|
|
39
|
+
--color-syntax-type: var(--color-syntax-number);
|
|
40
|
+
--color-syntax-variable: var(--color-code-text);
|
|
41
|
+
--color-syntax-operator: var(--color-muted);
|
|
42
|
+
--color-syntax-punctuation: var(--color-muted);
|
|
43
|
+
--color-syntax-tag: var(--color-syntax-keyword);
|
|
44
|
+
--color-syntax-attribute: var(--color-syntax-number);
|
|
45
|
+
--color-error: #bd342b;
|
|
46
|
+
--color-warning: #86532e;
|
|
47
|
+
--color-success: #157249;
|
|
48
|
+
--color-info: #175cd3;
|
|
49
|
+
--color-progress: var(--color-accent);
|
|
50
|
+
--color-error-surface: #efe4e4;
|
|
51
|
+
--color-warning-surface: #e7e2de;
|
|
52
|
+
--color-success-surface: #d9e5e1;
|
|
53
|
+
--color-info-surface: #d9e3f2;
|
|
54
|
+
--shadow-dialog: 0 8px 24px rgb(16 16 24 / 12%), 0 0 0 1px var(--color-border-subtle);
|
|
55
|
+
--color-status-text: var(--color-text);
|
|
56
|
+
--color-terminal: #0a0c0e;
|
|
57
|
+
--color-terminal-text: #e6e9eb;
|
|
58
|
+
--color-terminal-border: #2a3036;
|
|
59
|
+
--color-terminal-caption: #13171a;
|
|
60
|
+
--color-terminal-caption-text: #c9d0d6;
|
|
61
|
+
--color-accent-hover: var(--color-text);
|
|
62
|
+
--color-command-bg: color-mix(in srgb, var(--color-project) 25%, #101010);
|
|
63
|
+
--color-command-border: transparent;
|
|
64
|
+
--text-3xl: 2.75rem;
|
|
65
|
+
--text-reading: 1rem;
|
|
66
|
+
--text-display: 3.5rem;
|
|
67
|
+
--text-display-sm: 2.125rem;
|
|
68
|
+
--tracking-tight: -0.03em;
|
|
69
|
+
--space-20: 5rem;
|
|
70
|
+
--space-24: 6rem;
|
|
71
|
+
--row: 2.25rem;
|
|
72
|
+
--page-wide: 1120px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:root.dark {
|
|
76
|
+
color-scheme: dark;
|
|
77
|
+
--color-project: var(--color-project-dark);
|
|
78
|
+
--color-project-dark: #d1b3c8;
|
|
79
|
+
--color-bg: #0d1012;
|
|
80
|
+
--color-surface: #13171a;
|
|
81
|
+
--color-surface-raised: #181d21;
|
|
82
|
+
--color-surface-muted: #20262b;
|
|
83
|
+
--color-text: #e6e9eb;
|
|
84
|
+
--color-muted: #9aa3ab;
|
|
85
|
+
--color-link: #67c1df;
|
|
86
|
+
--color-accent: var(--color-project);
|
|
87
|
+
--color-accent-text: var(--color-bg);
|
|
88
|
+
--color-focus: var(--color-accent);
|
|
89
|
+
--color-border: #78818a;
|
|
90
|
+
--color-border-subtle: #262d33;
|
|
91
|
+
--color-button-bg: var(--color-accent);
|
|
92
|
+
--color-button-text: var(--color-accent-text);
|
|
93
|
+
--color-button-hover: color-mix(in srgb, var(--color-accent) 85%, var(--color-text));
|
|
94
|
+
--color-input-bg: var(--color-surface-raised);
|
|
95
|
+
--color-input-text: var(--color-text);
|
|
96
|
+
--color-input-border: var(--color-border);
|
|
97
|
+
--color-input-placeholder: var(--color-muted);
|
|
98
|
+
--color-row-hover: #20262b;
|
|
99
|
+
--color-row-selected: var(--color-surface-raised);
|
|
100
|
+
--color-row-selected-text: var(--color-text);
|
|
101
|
+
--color-code: var(--color-surface);
|
|
102
|
+
--color-code-text: var(--color-text);
|
|
103
|
+
--color-syntax-comment: #a0a6b1;
|
|
104
|
+
--color-syntax-keyword: #d8c2a5;
|
|
105
|
+
--color-syntax-string: #a8bd9c;
|
|
106
|
+
--color-syntax-number: #d5b98c;
|
|
107
|
+
--color-syntax-function: var(--color-syntax-keyword);
|
|
108
|
+
--color-syntax-type: var(--color-syntax-number);
|
|
109
|
+
--color-syntax-variable: var(--color-code-text);
|
|
110
|
+
--color-syntax-operator: var(--color-muted);
|
|
111
|
+
--color-syntax-punctuation: var(--color-muted);
|
|
112
|
+
--color-syntax-tag: var(--color-syntax-keyword);
|
|
113
|
+
--color-syntax-attribute: var(--color-syntax-number);
|
|
114
|
+
--color-error: #f0776c;
|
|
115
|
+
--color-warning: #e2a54b;
|
|
116
|
+
--color-success: #4cc38a;
|
|
117
|
+
--color-info: #84adff;
|
|
118
|
+
--color-progress: var(--color-accent);
|
|
119
|
+
--color-error-surface: #312020;
|
|
120
|
+
--color-warning-surface: #2f281b;
|
|
121
|
+
--color-success-surface: #172d25;
|
|
122
|
+
--color-info-surface: #202938;
|
|
123
|
+
--shadow-dialog: 0 8px 24px rgb(0 0 0 / 45%), 0 0 0 1px var(--color-border-subtle);
|
|
124
|
+
--color-status-text: var(--color-text);
|
|
125
|
+
--color-terminal: #0a0c0e;
|
|
126
|
+
--color-terminal-text: #e6e9eb;
|
|
127
|
+
--color-terminal-border: #2a3036;
|
|
128
|
+
--color-terminal-caption: #13171a;
|
|
129
|
+
--color-terminal-caption-text: #c9d0d6;
|
|
130
|
+
--color-accent-hover: var(--color-text);
|
|
131
|
+
--color-command-bg: color-mix(in srgb, var(--color-project) 16%, black);
|
|
132
|
+
--color-command-border: color-mix(in srgb, var(--color-project) 28%, black);
|
|
133
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* Generated from tokens/core.json and tokens/themes/pine.json by scripts/build-tokens.mjs in @filipgutica/design-system. Do not edit.
|
|
2
|
+
* Opt-in Pine roles for the class flavour. Import after class/base.css (theme.css in @filipgutica/ui).
|
|
3
|
+
* Dark mode uses the same .dark class as the base. Keep exactly one :root.dark block:
|
|
4
|
+
* sites copy it into a <noscript> prefers-color-scheme rule. */
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
color-scheme: light;
|
|
8
|
+
--color-project: #00543f;
|
|
9
|
+
--color-project-dark: #3fe0c0;
|
|
10
|
+
--color-bg: #f4f5f6;
|
|
11
|
+
--color-surface: #e9ebed;
|
|
12
|
+
--color-surface-raised: #fbfbfc;
|
|
13
|
+
--color-surface-muted: #e2e5e8;
|
|
14
|
+
--color-text: #101315;
|
|
15
|
+
--color-muted: #50575e;
|
|
16
|
+
--color-link: #0b5f7c;
|
|
17
|
+
--color-accent: var(--color-project);
|
|
18
|
+
--color-accent-text: var(--color-bg);
|
|
19
|
+
--color-focus: var(--color-accent);
|
|
20
|
+
--color-border: #6d747b;
|
|
21
|
+
--color-border-subtle: #d3d8dd;
|
|
22
|
+
--color-button-bg: var(--color-accent);
|
|
23
|
+
--color-button-text: var(--color-accent-text);
|
|
24
|
+
--color-button-hover: color-mix(in srgb, var(--color-accent) 85%, var(--color-text));
|
|
25
|
+
--color-input-bg: var(--color-surface-raised);
|
|
26
|
+
--color-input-text: var(--color-text);
|
|
27
|
+
--color-input-border: var(--color-border);
|
|
28
|
+
--color-input-placeholder: var(--color-muted);
|
|
29
|
+
--color-row-hover: #e2e5e8;
|
|
30
|
+
--color-row-selected: var(--color-surface-raised);
|
|
31
|
+
--color-row-selected-text: var(--color-text);
|
|
32
|
+
--color-code: var(--color-surface);
|
|
33
|
+
--color-code-text: var(--color-text);
|
|
34
|
+
--color-syntax-comment: #626772;
|
|
35
|
+
--color-syntax-keyword: #715b42;
|
|
36
|
+
--color-syntax-string: #346347;
|
|
37
|
+
--color-syntax-number: #86532e;
|
|
38
|
+
--color-syntax-function: var(--color-syntax-keyword);
|
|
39
|
+
--color-syntax-type: var(--color-syntax-number);
|
|
40
|
+
--color-syntax-variable: var(--color-code-text);
|
|
41
|
+
--color-syntax-operator: var(--color-muted);
|
|
42
|
+
--color-syntax-punctuation: var(--color-muted);
|
|
43
|
+
--color-syntax-tag: var(--color-syntax-keyword);
|
|
44
|
+
--color-syntax-attribute: var(--color-syntax-number);
|
|
45
|
+
--color-error: #bd342b;
|
|
46
|
+
--color-warning: #86532e;
|
|
47
|
+
--color-success: #157249;
|
|
48
|
+
--color-info: #175cd3;
|
|
49
|
+
--color-progress: var(--color-accent);
|
|
50
|
+
--color-error-surface: #efe4e4;
|
|
51
|
+
--color-warning-surface: #e7e2de;
|
|
52
|
+
--color-success-surface: #d9e5e1;
|
|
53
|
+
--color-info-surface: #d9e3f2;
|
|
54
|
+
--shadow-dialog: 0 8px 24px rgb(16 16 24 / 12%), 0 0 0 1px var(--color-border-subtle);
|
|
55
|
+
--color-status-text: var(--color-text);
|
|
56
|
+
--color-terminal: #0a0c0e;
|
|
57
|
+
--color-terminal-text: #e6e9eb;
|
|
58
|
+
--color-terminal-border: #2a3036;
|
|
59
|
+
--color-terminal-caption: #13171a;
|
|
60
|
+
--color-terminal-caption-text: #c9d0d6;
|
|
61
|
+
--color-accent-hover: var(--color-text);
|
|
62
|
+
--color-command-bg: color-mix(in srgb, var(--color-project) 25%, #101010);
|
|
63
|
+
--color-command-border: transparent;
|
|
64
|
+
--text-3xl: 2.75rem;
|
|
65
|
+
--text-reading: 1rem;
|
|
66
|
+
--text-display: 3.5rem;
|
|
67
|
+
--text-display-sm: 2.125rem;
|
|
68
|
+
--tracking-tight: -0.03em;
|
|
69
|
+
--space-20: 5rem;
|
|
70
|
+
--space-24: 6rem;
|
|
71
|
+
--row: 2.25rem;
|
|
72
|
+
--page-wide: 1120px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:root.dark {
|
|
76
|
+
color-scheme: dark;
|
|
77
|
+
--color-project: var(--color-project-dark);
|
|
78
|
+
--color-project-dark: #3fe0c0;
|
|
79
|
+
--color-bg: #0d1012;
|
|
80
|
+
--color-surface: #13171a;
|
|
81
|
+
--color-surface-raised: #181d21;
|
|
82
|
+
--color-surface-muted: #20262b;
|
|
83
|
+
--color-text: #e6e9eb;
|
|
84
|
+
--color-muted: #9aa3ab;
|
|
85
|
+
--color-link: #67c1df;
|
|
86
|
+
--color-accent: var(--color-project);
|
|
87
|
+
--color-accent-text: var(--color-bg);
|
|
88
|
+
--color-focus: var(--color-accent);
|
|
89
|
+
--color-border: #78818a;
|
|
90
|
+
--color-border-subtle: #262d33;
|
|
91
|
+
--color-button-bg: var(--color-accent);
|
|
92
|
+
--color-button-text: var(--color-accent-text);
|
|
93
|
+
--color-button-hover: color-mix(in srgb, var(--color-accent) 85%, var(--color-text));
|
|
94
|
+
--color-input-bg: var(--color-surface-raised);
|
|
95
|
+
--color-input-text: var(--color-text);
|
|
96
|
+
--color-input-border: var(--color-border);
|
|
97
|
+
--color-input-placeholder: var(--color-muted);
|
|
98
|
+
--color-row-hover: #20262b;
|
|
99
|
+
--color-row-selected: var(--color-surface-raised);
|
|
100
|
+
--color-row-selected-text: var(--color-text);
|
|
101
|
+
--color-code: var(--color-surface);
|
|
102
|
+
--color-code-text: var(--color-text);
|
|
103
|
+
--color-syntax-comment: #a0a6b1;
|
|
104
|
+
--color-syntax-keyword: #d8c2a5;
|
|
105
|
+
--color-syntax-string: #a8bd9c;
|
|
106
|
+
--color-syntax-number: #d5b98c;
|
|
107
|
+
--color-syntax-function: var(--color-syntax-keyword);
|
|
108
|
+
--color-syntax-type: var(--color-syntax-number);
|
|
109
|
+
--color-syntax-variable: var(--color-code-text);
|
|
110
|
+
--color-syntax-operator: var(--color-muted);
|
|
111
|
+
--color-syntax-punctuation: var(--color-muted);
|
|
112
|
+
--color-syntax-tag: var(--color-syntax-keyword);
|
|
113
|
+
--color-syntax-attribute: var(--color-syntax-number);
|
|
114
|
+
--color-error: #f0776c;
|
|
115
|
+
--color-warning: #e2a54b;
|
|
116
|
+
--color-success: #4cc38a;
|
|
117
|
+
--color-info: #84adff;
|
|
118
|
+
--color-progress: var(--color-accent);
|
|
119
|
+
--color-error-surface: #312020;
|
|
120
|
+
--color-warning-surface: #2f281b;
|
|
121
|
+
--color-success-surface: #172d25;
|
|
122
|
+
--color-info-surface: #202938;
|
|
123
|
+
--shadow-dialog: 0 8px 24px rgb(0 0 0 / 45%), 0 0 0 1px var(--color-border-subtle);
|
|
124
|
+
--color-status-text: var(--color-text);
|
|
125
|
+
--color-terminal: #0a0c0e;
|
|
126
|
+
--color-terminal-text: #e6e9eb;
|
|
127
|
+
--color-terminal-border: #2a3036;
|
|
128
|
+
--color-terminal-caption: #13171a;
|
|
129
|
+
--color-terminal-caption-text: #c9d0d6;
|
|
130
|
+
--color-accent-hover: var(--color-text);
|
|
131
|
+
--color-command-bg: color-mix(in srgb, var(--color-project) 16%, black);
|
|
132
|
+
--color-command-border: color-mix(in srgb, var(--color-project) 28%, black);
|
|
133
|
+
}
|
package/language/components.html
CHANGED
|
@@ -1693,6 +1693,7 @@
|
|
|
1693
1693
|
});
|
|
1694
1694
|
|
|
1695
1695
|
// Full size: open the selected capture in a named modal; the native dialog restores focus to the trigger.
|
|
1696
|
+
// Safari does not focus a button on click, so the trigger takes focus first and the dialog has it to return to.
|
|
1696
1697
|
const viewer = document.getElementById('capture-viewer');
|
|
1697
1698
|
document.querySelectorAll('[data-full-size]').forEach((button) => button.addEventListener('click', () => {
|
|
1698
1699
|
const panel = button.closest('.capture').querySelector('.tabpanel:not([hidden])');
|
|
@@ -1701,6 +1702,7 @@
|
|
|
1701
1702
|
const screen = panel.querySelector('.screen').cloneNode(true);
|
|
1702
1703
|
screen.setAttribute('aria-label', `${name} capture, full size`);
|
|
1703
1704
|
document.getElementById('capture-viewer-body').replaceChildren(screen, panel.querySelector('.capture-caption').cloneNode(true));
|
|
1705
|
+
button.focus({ preventScroll: true });
|
|
1704
1706
|
viewer.showModal();
|
|
1705
1707
|
}));
|
|
1706
1708
|
|
|
@@ -1733,8 +1735,26 @@
|
|
|
1733
1735
|
showCopied(button, ok);
|
|
1734
1736
|
}));
|
|
1735
1737
|
|
|
1736
|
-
// Live dialog and drawer: native modal dialogs return focus to the trigger on close.
|
|
1737
|
-
|
|
1738
|
+
// Live dialog and drawer: native modal dialogs return focus to the trigger on close. Safari does not focus a
|
|
1739
|
+
// button on click, so the trigger takes focus first and the dialog has it to return to.
|
|
1740
|
+
document.querySelectorAll('[data-open]').forEach((button) => button.addEventListener('click', () => {
|
|
1741
|
+
button.focus();
|
|
1742
|
+
document.getElementById(button.dataset.open).showModal();
|
|
1743
|
+
}));
|
|
1744
|
+
// A tap or click on the backdrop, which belongs to the dialog element, lands outside the dialog's box and
|
|
1745
|
+
// closes it. closedby="any" would do this, but Safari does not support it. Only a press that starts outside
|
|
1746
|
+
// counts, so a drag out of the dialog keeps it open. It closes on the click, not the press: a dialog that
|
|
1747
|
+
// closes at once would otherwise pass the release and its click to the page behind.
|
|
1748
|
+
const closeOnBackdrop = (dialog, close) => {
|
|
1749
|
+
const outside = (e) => {
|
|
1750
|
+
const box = dialog.getBoundingClientRect();
|
|
1751
|
+
return e.clientX < box.left || e.clientX > box.right || e.clientY < box.top || e.clientY > box.bottom;
|
|
1752
|
+
};
|
|
1753
|
+
let pressedOutside = false;
|
|
1754
|
+
dialog.addEventListener('pointerdown', (e) => { pressedOutside = outside(e); });
|
|
1755
|
+
dialog.addEventListener('click', (e) => { if (pressedOutside && e.target === dialog && outside(e)) close(); });
|
|
1756
|
+
};
|
|
1757
|
+
document.querySelectorAll('dialog.dialog').forEach((dialog) => closeOnBackdrop(dialog, () => dialog.close()));
|
|
1738
1758
|
// Following an in-page link closes the drawer, then focus moves to the destination instead of the trigger.
|
|
1739
1759
|
// Every close path slides the drawer out first. Under reduced motion there is no animation, so it closes at once.
|
|
1740
1760
|
// A slide that is cancelled, such as by turning on reduced motion mid-slide, still closes the drawer.
|
|
@@ -1755,6 +1775,7 @@
|
|
|
1755
1775
|
};
|
|
1756
1776
|
drawer.addEventListener('cancel', (e) => { e.preventDefault(); slideOut(); });
|
|
1757
1777
|
drawer.querySelector('form[method="dialog"]')?.addEventListener('submit', (e) => { e.preventDefault(); slideOut(); });
|
|
1778
|
+
closeOnBackdrop(drawer, slideOut);
|
|
1758
1779
|
drawer.addEventListener('click', (e) => {
|
|
1759
1780
|
const link = e.target.closest('a[href^="#"]');
|
|
1760
1781
|
if (!link || e.button !== 0 || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
|
|
@@ -1880,9 +1901,14 @@
|
|
|
1880
1901
|
|
|
1881
1902
|
// A tap opens the drawer with focus on its body, so no ring shows and no keyboard opens. A keyboard
|
|
1882
1903
|
// open moves focus to the current row, where the ring shows the reader's place. Find focuses the field.
|
|
1904
|
+
// Every open, by the trigger or the / shortcut, focuses the trigger first, without scrolling, so the drawer
|
|
1905
|
+
// returns focus to it on close. Safari does not focus a button on click, and the shortcut starts anywhere.
|
|
1883
1906
|
drawerBody.tabIndex = -1;
|
|
1884
1907
|
const openDrawer = ({ toFind = false, byPointer = false } = {}) => {
|
|
1885
|
-
if (!drawer.open)
|
|
1908
|
+
if (!drawer.open) {
|
|
1909
|
+
trigger.focus({ preventScroll: true });
|
|
1910
|
+
drawer.showModal();
|
|
1911
|
+
}
|
|
1886
1912
|
const current = rail.querySelector('[aria-current="location"]:not([hidden])');
|
|
1887
1913
|
if (current) centre(drawerBody, current);
|
|
1888
1914
|
if (toFind || !current) find.focus({ preventScroll: true });
|
package/language/components.md
CHANGED
|
@@ -279,6 +279,7 @@ Layer: Core. ui: `UiDialog`.
|
|
|
279
279
|
- **Do.** Use a dialog for a short task the reader must finish or cancel before the page continues, such as confirming a deletion. Title it with that task.
|
|
280
280
|
- **Don't.** A dialog that opens without the reader asking, such as on page load, or one that holds a long form. A long form gets its own page.
|
|
281
281
|
- **Keyboard and screen reader.** `role="dialog"`, `aria-modal="true"`, named by its title. Focus moves in on open and is trapped. Escape closes it, and focus returns to the trigger. A native `<dialog>` opened with `showModal()` provides most of this.
|
|
282
|
+
- **Backdrop.** A tap or click on the backdrop, outside the dialog, closes it, the same way Escape does, and focus returns to the trigger. Only a press that starts outside counts: a drag that starts inside the dialog and ends outside leaves it open. Safari does not support `closedby="any"`, so a script closes it.
|
|
282
283
|
- **Motion.** None: it opens and closes at once. Only the drawer slides, because it enters from an edge.
|
|
283
284
|
- **Forced colors.** The shadow drops and the transparent border draws as the system edge, so the dialog keeps its outline over the page.
|
|
284
285
|
|
|
@@ -292,6 +293,7 @@ Layer: Core. ui: `UiDrawer`.
|
|
|
292
293
|
- **Do.** Use a drawer for navigation or supporting detail that slides in from the side its trigger sits on, such as phone navigation, and open it from a named button.
|
|
293
294
|
- **Don't.** The page's main task inside a drawer. The drawer holds navigation or detail; the task stays on the page.
|
|
294
295
|
- **Keyboard and screen reader.** As for the dialog. Following an in-page link inside the drawer closes it and moves focus to the link's destination (given `tabindex="-1"` if it is not focusable), not back to the trigger. Modified clicks (a new tab or window) leave it open.
|
|
296
|
+
- **Backdrop.** A tap or click on the backdrop, outside the drawer, closes it, the same way Escape does, and focus returns to the trigger. Only a press that starts outside counts: a drag that starts inside the drawer and ends outside leaves it open. Safari does not support `closedby="any"`, so a script closes it.
|
|
295
297
|
- **Page behind.** While the drawer is open, until it has slid out, the page behind it does not scroll: the root takes `overflow: hidden`, which keeps the reader's position. The page reserves the scrollbar gutter all the time (`scrollbar-gutter: stable` on the root), so hiding a classic scrollbar does not reflow it.
|
|
296
298
|
- **Motion.** It slides in over `--duration` and out over `--duration-fast`, with `--ease-out`, while the overlay fades. Reduced motion shows and hides it at once.
|
|
297
299
|
- **Forced colors.** As for the dialog: the shadow drops and the edge draws in the system colour.
|