@zeyos/zx 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -0
- package/README.md +49 -16
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
- package/dist/types/components/badge/badge.d.ts +5 -4
- package/dist/types/components/datebox/date-range-box.d.ts +15 -2
- package/dist/types/components/datebox/datebox.d.ts +37 -3
- package/dist/types/components/kbd/kbd.d.ts +41 -0
- package/dist/types/components/launcher/launcher.d.ts +4 -2
- package/dist/types/components/prose/prose.d.ts +69 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
- package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
- package/dist/types/components/tree/tree.d.ts +44 -3
- package/dist/types/core/icons.d.ts +22 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/internal/app-rail.d.ts +10 -3
- package/dist/types/internal/row-actions.d.ts +151 -0
- package/dist/zx-zeyos.esm.js +264 -82
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.css +1288 -439
- package/dist/zx.esm.js +952 -392
- package/dist/zx.esm.min.js +6 -6
- package/dist/zx.global.js +952 -392
- package/dist/zx.global.min.js +6 -6
- package/dist/zx.min.css +1 -1
- package/docs/api.json +112 -4
- package/docs/llms.md +433 -38
- package/docs/llms.txt +21 -1
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.js +2 -2
- package/src/components/app-rail/app-rail.css +11 -11
- package/src/components/app-sidebar/app-sidebar.css +90 -17
- package/src/components/app-sidebar/app-sidebar.js +120 -12
- package/src/components/badge/badge.css +33 -20
- package/src/components/badge/badge.js +5 -4
- package/src/components/breadcrumb/breadcrumb.css +28 -3
- package/src/components/breadcrumb/breadcrumb.js +2 -2
- package/src/components/button/button.css +24 -13
- package/src/components/button/button.js +20 -2
- package/src/components/calendar/calendar.css +14 -4
- package/src/components/card-view/card-view.js +2 -2
- package/src/components/chart/chart.js +20 -5
- package/src/components/check-button/check-button.css +11 -3
- package/src/components/check-button/check-button.js +3 -3
- package/src/components/context-menu/context-menu.css +7 -1
- package/src/components/date-picker/date-picker.css +6 -0
- package/src/components/date-picker/date-picker.js +5 -5
- package/src/components/date-picker/date-range-picker.css +6 -0
- package/src/components/date-picker/date-range-picker.js +3 -3
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.css +6 -0
- package/src/components/datebox/date-range-box.js +30 -6
- package/src/components/datebox/datebox.js +44 -7
- package/src/components/dialog/dialog.css +0 -1
- package/src/components/dialog/dialog.js +2 -1
- package/src/components/dock/dock.js +2 -2
- package/src/components/dropdown/dropdown.css +2 -1
- package/src/components/entity-ref/entity-ref.css +8 -1
- package/src/components/file-item/file-item.css +1 -1
- package/src/components/finder/finder.js +2 -2
- package/src/components/groupbox/groupbox.js +2 -2
- package/src/components/kanban-view/kanban-view.css +8 -4
- package/src/components/kanban-view/kanban-view.js +3 -3
- package/src/components/kbd/kbd.css +64 -0
- package/src/components/kbd/kbd.js +121 -0
- package/src/components/launcher/launcher.css +30 -25
- package/src/components/launcher/launcher.js +15 -21
- package/src/components/list-toolbar/list-toolbar.css +7 -1
- package/src/components/menu-button/menu-button.css +9 -2
- package/src/components/message/message.css +6 -2
- package/src/components/message/message.js +2 -2
- package/src/components/module-bar/module-bar.css +11 -1
- package/src/components/multi-value-editor/multi-value-editor.js +4 -4
- package/src/components/navigation-bar/navigation-bar.css +3 -2
- package/src/components/pagination/pagination.js +2 -2
- package/src/components/panel/panel.js +2 -2
- package/src/components/prose/prose.css +53 -0
- package/src/components/prose/prose.js +152 -0
- package/src/components/questionnaire/questionnaire.css +7 -17
- package/src/components/questionnaire/questionnaire.js +16 -1
- package/src/components/rating/rating.css +3 -1
- package/src/components/search/search.js +2 -2
- package/src/components/select/glyphs.js +3 -3
- package/src/components/select/select.css +35 -7
- package/src/components/select/select.js +4 -4
- package/src/components/stat-tile/stat-tile.css +56 -2
- package/src/components/stat-tile/stat-tile.js +25 -2
- package/src/components/stepper/stepper.css +2 -1
- package/src/components/stepper/stepper.js +3 -3
- package/src/components/tabbox/tabbox.css +2 -2
- package/src/components/tabbox/tabbox.js +2 -2
- package/src/components/table/table.css +52 -16
- package/src/components/table/table.js +7 -5
- package/src/components/tag-picker/tag-picker.css +56 -43
- package/src/components/tag-picker/tag-picker.js +21 -16
- package/src/components/tree/tree.css +44 -0
- package/src/components/tree/tree.js +97 -9
- package/src/components/value-list/value-list.css +25 -4
- package/src/components/value-list/value-list.js +2 -1
- package/src/components/view/record-view.js +3 -3
- package/src/components/view-settings/view-settings.css +2 -1
- package/src/components/workspace-switcher/workspace-switcher.js +3 -3
- package/src/core/icons.js +34 -3
- package/src/elements/define.js +1 -0
- package/src/index.js +4 -2
- package/src/internal/app-rail.js +5 -1
- package/src/internal/row-actions.js +203 -0
- package/styles/base.css +26 -1
- package/styles/prose.css +306 -0
- package/styles/tokens/dark.css +108 -103
- package/styles/tokens/global.css +24 -9
- package/styles/tokens/semantic.css +520 -198
- package/styles/tokens/themes.css +9 -0
- package/styles/zx.css +3 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
inline-size: min(760px, calc(100vw - (2 * var(--zx-space-4))));
|
|
3
3
|
max-block-size: min(720px, calc(100vh - (2 * var(--zx-space-6))));
|
|
4
4
|
border: 1px solid var(--zx-color-overlay-border);
|
|
5
|
-
|
|
5
|
+
/* Concentric with the rows inside it: their corner plus the inset around them. */
|
|
6
|
+
border-radius: var(--zx-radius-panel);
|
|
6
7
|
background-color: var(--zx-color-overlay-panel);
|
|
7
8
|
background-image: var(--zx-overlay-panel-image);
|
|
8
9
|
background-clip: padding-box;
|
|
@@ -97,23 +98,9 @@
|
|
|
97
98
|
|
|
98
99
|
.zx-launcher__input::-webkit-search-cancel-button { display: none; }
|
|
99
100
|
|
|
100
|
-
.
|
|
101
|
-
.zx-launcher__hints kbd,
|
|
102
|
-
.zx-launcher__key {
|
|
103
|
-
border: 1px solid var(--zx-color-border-control);
|
|
104
|
-
border-radius: var(--zx-radius-sm);
|
|
105
|
-
background: var(--zx-color-bg-muted);
|
|
106
|
-
color: var(--zx-color-text-muted);
|
|
107
|
-
font-family: var(--zx-font-mono);
|
|
108
|
-
font-size: var(--zx-text-xs);
|
|
109
|
-
font-weight: 600;
|
|
110
|
-
line-height: 1.5;
|
|
111
|
-
}
|
|
112
|
-
|
|
101
|
+
/* The ⌘K reminder beside the query. Its keycaps are `kbd()`'s. */
|
|
113
102
|
.zx-launcher__shortcut {
|
|
114
103
|
flex: none;
|
|
115
|
-
padding-inline: var(--zx-space-2);
|
|
116
|
-
white-space: nowrap;
|
|
117
104
|
}
|
|
118
105
|
|
|
119
106
|
.zx-launcher__status {
|
|
@@ -179,6 +166,13 @@
|
|
|
179
166
|
color: var(--zx-color-text);
|
|
180
167
|
}
|
|
181
168
|
|
|
169
|
+
/* The row you are in, under the cursor or the pointer, is both: the current fill one step
|
|
170
|
+
stronger than either, still neutral. */
|
|
171
|
+
.zx-launcher__option[aria-current="page"][aria-selected="true"],
|
|
172
|
+
.zx-launcher__option[aria-current="page"]:hover {
|
|
173
|
+
background: color-mix(in srgb, var(--zx-color-text) 14%, transparent);
|
|
174
|
+
}
|
|
175
|
+
|
|
182
176
|
.zx-launcher__option[aria-current="page"] .zx-launcher__label {
|
|
183
177
|
font-weight: var(--zx-weight-semibold);
|
|
184
178
|
}
|
|
@@ -198,6 +192,20 @@
|
|
|
198
192
|
background: var(--zx-color-bg-current);
|
|
199
193
|
}
|
|
200
194
|
|
|
195
|
+
.zx-launcher__option[data-kind="application"][aria-current="page"][aria-selected="true"],
|
|
196
|
+
.zx-launcher__option[data-kind="application"][aria-current="page"]:hover {
|
|
197
|
+
background: color-mix(in srgb, var(--zx-color-text) 14%, transparent);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@media (forced-colors: active) {
|
|
201
|
+
.zx-launcher__option[aria-current="page"][aria-selected="true"],
|
|
202
|
+
.zx-launcher__option[aria-current="page"]:hover,
|
|
203
|
+
.zx-launcher__option[data-kind="application"][aria-current="page"][aria-selected="true"],
|
|
204
|
+
.zx-launcher__option[data-kind="application"][aria-current="page"]:hover {
|
|
205
|
+
background: var(--zx-color-overlay-hover);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
201
209
|
.zx-launcher__option[data-kind="application"] .zx-launcher__icon {
|
|
202
210
|
min-block-size: 36px;
|
|
203
211
|
align-items: center;
|
|
@@ -227,7 +235,12 @@
|
|
|
227
235
|
.zx-launcher__copy { display: grid; min-inline-size: 0; gap: 2px; }
|
|
228
236
|
.zx-launcher__label { overflow: hidden; font-weight: var(--zx-weight-medium); text-overflow: ellipsis; white-space: nowrap; }
|
|
229
237
|
.zx-launcher__description { overflow: hidden; color: var(--zx-color-text-muted); font-size: var(--zx-text-sm); text-overflow: ellipsis; white-space: nowrap; }
|
|
230
|
-
.zx-launcher__badge {
|
|
238
|
+
.zx-launcher__badge {
|
|
239
|
+
margin-inline-start: auto;
|
|
240
|
+
color: var(--zx-color-text-muted);
|
|
241
|
+
font-size: var(--zx-text-xs);
|
|
242
|
+
font-variant-numeric: tabular-nums;
|
|
243
|
+
}
|
|
231
244
|
|
|
232
245
|
/* A row's copy takes the room; what trails it (badge, hint, key caps, the page chevron) sits at
|
|
233
246
|
the end in that order. */
|
|
@@ -247,7 +260,6 @@
|
|
|
247
260
|
.zx-launcher__keys {
|
|
248
261
|
display: inline-flex;
|
|
249
262
|
flex: none;
|
|
250
|
-
gap: var(--zx-space-1);
|
|
251
263
|
}
|
|
252
264
|
|
|
253
265
|
.zx-launcher__chevron {
|
|
@@ -285,13 +297,6 @@
|
|
|
285
297
|
|
|
286
298
|
.zx-launcher__hints span[hidden] { display: none; }
|
|
287
299
|
|
|
288
|
-
.zx-launcher__hints kbd,
|
|
289
|
-
.zx-launcher__key {
|
|
290
|
-
min-inline-size: 1.5rem;
|
|
291
|
-
padding-inline: 4px;
|
|
292
|
-
text-align: center;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
300
|
@media (max-width: 520px) {
|
|
296
301
|
.zx-launcher__group[data-layout="grid"] {
|
|
297
302
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h, safeHref } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { printf } from '../../core/i18n.js';
|
|
5
5
|
import { connectedOverlayHost, overlayScope } from '../../core/overlay-host.js';
|
|
6
6
|
import { pushOverlay } from '../../core/overlay-stack.js';
|
|
7
7
|
import { uid } from '../../core/util.js';
|
|
8
|
+
import { kbd } from '../kbd/kbd.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @typedef {Object} LauncherItem
|
|
@@ -17,7 +18,8 @@ import { uid } from '../../core/util.js';
|
|
|
17
18
|
* @property {string|number} [badge] Compact metadata.
|
|
18
19
|
* @property {string|number} [hint] Muted text at the end of the row, such as a current value or a project.
|
|
19
20
|
* @property {string|string[]|{label: string|string[], keys?: string}} [shortcut] Key labels drawn as
|
|
20
|
-
* key caps (`['⌘', 'K']
|
|
21
|
+
* key caps with `kbd()` (`['⌘', 'K']`; a name such as `'Mod'` or `'Shift'` takes the platform's
|
|
22
|
+
* glyph), or Button's `{label, keys}` shape. Display only: the Launcher binds nothing.
|
|
21
23
|
* @property {string} [keys] The same shortcut in `aria-keyshortcuts` syntax (`'Meta+K'`), exposed on
|
|
22
24
|
* the option for assistive technology.
|
|
23
25
|
* @property {'application'|'record'|'action'} [kind='action'] Tile or row presentation.
|
|
@@ -214,7 +216,7 @@ export class Launcher extends Component {
|
|
|
214
216
|
ref: 'scopeBack',
|
|
215
217
|
class: 'zx-icon-btn zx-launcher__scope-back',
|
|
216
218
|
type: 'button'
|
|
217
|
-
}, icon('x'));
|
|
219
|
+
}, icon('x', { size: ICON_SIZE.dismiss }));
|
|
218
220
|
const scope = h('span', { ref: 'scope', class: 'zx-launcher__scope', hidden: true },
|
|
219
221
|
h('span', { ref: 'scopeLabel', class: 'zx-launcher__scope-label' }), scopeBack);
|
|
220
222
|
const close = h('button', {
|
|
@@ -222,7 +224,7 @@ export class Launcher extends Component {
|
|
|
222
224
|
class: 'zx-icon-btn zx-launcher__close',
|
|
223
225
|
type: 'button',
|
|
224
226
|
ariaLabel: this.options.closeLabel ?? this._message('launcher.close', 'Close launcher')
|
|
225
|
-
}, icon('x'));
|
|
227
|
+
}, icon('x', { size: ICON_SIZE.dismiss }));
|
|
226
228
|
const status = h('div', {
|
|
227
229
|
ref: 'status',
|
|
228
230
|
class: 'zx-launcher__status',
|
|
@@ -245,10 +247,9 @@ export class Launcher extends Component {
|
|
|
245
247
|
role: 'listbox',
|
|
246
248
|
ariaLabel: this.options.resultsLabel ?? this._message('launcher.results', 'Launcher results')
|
|
247
249
|
});
|
|
248
|
-
const shortcut = this.options.shortcut === 'mod+k'
|
|
249
|
-
class: 'zx-launcher__shortcut',
|
|
250
|
-
|
|
251
|
-
}, launcherShortcutLabel()) : null;
|
|
250
|
+
const shortcut = this.options.shortcut === 'mod+k'
|
|
251
|
+
? h('span', { class: 'zx-launcher__shortcut', ariaHidden: 'true' }, kbd('Mod+K'))
|
|
252
|
+
: null;
|
|
252
253
|
const footer = launcherHints(this.options.hints, {
|
|
253
254
|
move: this._message('launcher.hintMove', 'Move'),
|
|
254
255
|
open: this._message('launcher.hintOpen', 'Open'),
|
|
@@ -790,8 +791,8 @@ export class Launcher extends Component {
|
|
|
790
791
|
const caps = launcherShortcutCaps(item.shortcut);
|
|
791
792
|
// Drawn caps are part of the option's name unless `keys` already exposes the shortcut.
|
|
792
793
|
if (caps.length) children.push(h('span', { class: 'zx-launcher__keys', ariaHidden: keys ? 'true' : null },
|
|
793
|
-
caps
|
|
794
|
-
if (page) children.push(h('span', { class: 'zx-launcher__chevron', ariaHidden: 'true' }, icon('chevron-right')));
|
|
794
|
+
kbd(caps, { size: 'sm' })));
|
|
795
|
+
if (page) children.push(h('span', { class: 'zx-launcher__chevron', ariaHidden: 'true' }, icon('chevron-right', { size: ICON_SIZE.chevron })));
|
|
795
796
|
return /** @type {HTMLElement} */ (h(tag, {
|
|
796
797
|
class: 'zx-launcher__option',
|
|
797
798
|
type: tag === 'button' ? 'button' : null,
|
|
@@ -995,13 +996,6 @@ export class Launcher extends Component {
|
|
|
995
996
|
}
|
|
996
997
|
}
|
|
997
998
|
|
|
998
|
-
/** @returns {string} */
|
|
999
|
-
function launcherShortcutLabel() {
|
|
1000
|
-
const platform = String((/** @type {any} */ (navigator)).userAgentData?.platform
|
|
1001
|
-
?? navigator.platform ?? '');
|
|
1002
|
-
return /mac|iphone|ipad/i.test(platform) ? '⌘ K' : 'Ctrl K';
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
999
|
/**
|
|
1006
1000
|
* @param {LauncherOptions['hints']} hints Host-supplied hint labels, or false to omit the row.
|
|
1007
1001
|
* @param {{move: string, open: string, back: string, close: string}} defaults Resolved built-in labels.
|
|
@@ -1011,11 +1005,11 @@ function launcherHints(hints, defaults) {
|
|
|
1011
1005
|
if (hints === false) return null;
|
|
1012
1006
|
const labels = hints && typeof hints === 'object' ? hints : {};
|
|
1013
1007
|
return h('footer', { class: 'zx-launcher__hints', ariaHidden: 'true' },
|
|
1014
|
-
h('span', {},
|
|
1015
|
-
h('span', {},
|
|
1008
|
+
h('span', {}, kbd(['↑↓←→']), labels.move ?? defaults.move),
|
|
1009
|
+
h('span', {}, kbd('Enter'), labels.open ?? defaults.open),
|
|
1016
1010
|
// Shown only on a page (`_syncPage()`).
|
|
1017
|
-
h('span', { ref: 'backHint', hidden: true },
|
|
1018
|
-
h('span', {},
|
|
1011
|
+
h('span', { ref: 'backHint', hidden: true }, kbd('Backspace'), labels.back ?? defaults.back),
|
|
1012
|
+
h('span', {}, kbd('Escape'), labels.close ?? defaults.close));
|
|
1019
1013
|
}
|
|
1020
1014
|
|
|
1021
1015
|
/**
|
|
@@ -109,6 +109,11 @@
|
|
|
109
109
|
background: var(--zx-color-bg-current);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/* Pointed at, a pressed tool keeps its fill and takes the hover step on top of it. */
|
|
113
|
+
.zx-list-toolbar__tool[aria-pressed="true"]:hover:not(:disabled) {
|
|
114
|
+
background: linear-gradient(var(--zx-color-bg-hover), var(--zx-color-bg-hover)), var(--zx-color-bg-current);
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
.zx-list-toolbar__tool:disabled {
|
|
113
118
|
color: var(--zx-color-text-placeholder);
|
|
114
119
|
cursor: default;
|
|
@@ -134,7 +139,8 @@
|
|
|
134
139
|
min-inline-size: 44px;
|
|
135
140
|
padding-inline: var(--zx-space-2);
|
|
136
141
|
border: 0;
|
|
137
|
-
|
|
142
|
+
/* Concentric with the frame: its corner less the 1px border and the 2px padding between them. */
|
|
143
|
+
border-radius: max(0px, calc(var(--zx-control-radius) - 3px));
|
|
138
144
|
background: none;
|
|
139
145
|
color: var(--zx-color-text-muted);
|
|
140
146
|
font-size: var(--zx-control-font-size);
|
|
@@ -89,14 +89,20 @@
|
|
|
89
89
|
padding-inline: var(--zx-space-1);
|
|
90
90
|
color: var(--zx-color-text-muted);
|
|
91
91
|
font-size: var(--zx-text-xs);
|
|
92
|
+
font-variant-numeric: tabular-nums;
|
|
92
93
|
text-align: center;
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
/* A shortcut is text at the right edge, no box — set the way a keycap's label is, so every key
|
|
97
|
+
hint in the library shares one type treatment. */
|
|
95
98
|
.zx-menu-button__shortcut {
|
|
96
99
|
border: 0;
|
|
97
100
|
background: transparent;
|
|
98
101
|
padding: 0;
|
|
99
|
-
font-family: var(--zx-font-
|
|
102
|
+
font-family: var(--zx-font-sans);
|
|
103
|
+
font-weight: var(--zx-weight-medium);
|
|
104
|
+
font-feature-settings: "case", "tnum";
|
|
105
|
+
white-space: nowrap;
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
.zx-menu-button__check {
|
|
@@ -152,7 +158,8 @@
|
|
|
152
158
|
display: inline-flex;
|
|
153
159
|
flex: none;
|
|
154
160
|
gap: 2px;
|
|
155
|
-
|
|
161
|
+
/* The thumb's corner plus the 2px of track around it. */
|
|
162
|
+
border-radius: calc(var(--zx-radius-sm) + 2px);
|
|
156
163
|
background: var(--zx-color-bg-hover);
|
|
157
164
|
padding: 2px;
|
|
158
165
|
}
|
|
@@ -78,7 +78,11 @@
|
|
|
78
78
|
.zx-message__toast {
|
|
79
79
|
border-color: color-mix(in srgb, var(--zx-message-kind) 28%, var(--zx-color-overlay-border));
|
|
80
80
|
background-color: var(--zx-color-overlay-surface);
|
|
81
|
-
|
|
81
|
+
/* The status tint is composed here, not in the token: a token resolves where it is declared,
|
|
82
|
+
so a tint written into it at the theme root would be the info colour for every kind. */
|
|
83
|
+
background-image: radial-gradient(120% 160% at 0% 0%,
|
|
84
|
+
color-mix(in srgb, var(--zx-message-kind) 16%, transparent), transparent 62%),
|
|
85
|
+
var(--zx-overlay-toast-image);
|
|
82
86
|
background-clip: padding-box;
|
|
83
87
|
-webkit-backdrop-filter: var(--zx-glass-filter-overlay);
|
|
84
88
|
backdrop-filter: var(--zx-glass-filter-overlay);
|
|
@@ -87,7 +91,7 @@
|
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
90
|
-
@media (prefers-reduced-transparency: reduce) {
|
|
94
|
+
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
|
|
91
95
|
.zx-message__toast {
|
|
92
96
|
border-color: var(--zx-color-border);
|
|
93
97
|
background: var(--zx-message-fallback-bg);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h, resolveElement } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { overlayScope } from '../../core/overlay-host.js';
|
|
5
5
|
import { overlayStack } from '../../core/overlay-stack.js';
|
|
6
6
|
import { button } from '../button/button.js';
|
|
@@ -422,7 +422,7 @@ export class Message extends Component {
|
|
|
422
422
|
type: 'button',
|
|
423
423
|
ariaLabel: this._message('message.close', 'Close message'),
|
|
424
424
|
title: this._message('message.closeTitle', 'Close')
|
|
425
|
-
}, icon('x', { size:
|
|
425
|
+
}, icon('x', { size: ICON_SIZE.dismiss }));
|
|
426
426
|
node.append(close);
|
|
427
427
|
this.listen(close, 'click', () => this._close(entry));
|
|
428
428
|
}
|
|
@@ -57,13 +57,23 @@
|
|
|
57
57
|
block-size: auto;
|
|
58
58
|
min-block-size: var(--zx-module-bar-target);
|
|
59
59
|
padding: var(--zx-space-1) var(--zx-space-2);
|
|
60
|
-
|
|
60
|
+
/* The names rest one ink step under the content, as navigation does, and come up to the full
|
|
61
|
+
text colour when pointed at, focused, current, or open. */
|
|
62
|
+
color: var(--zx-color-text-chrome);
|
|
61
63
|
font-size: var(--zx-text-md);
|
|
62
64
|
font-weight: 500;
|
|
63
65
|
line-height: 1.3;
|
|
64
66
|
text-align: start;
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
.zx-module-bar[data-labels="beside"] .zx-module-bar__item:is(:hover, :focus-visible, [aria-current], [aria-expanded="true"]):not([aria-disabled="true"]) {
|
|
70
|
+
color: var(--zx-color-text);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.zx-module-bar[data-labels="beside"] .zx-module-bar__item[aria-disabled="true"] {
|
|
74
|
+
color: var(--zx-color-text-muted);
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
.zx-module-bar[data-labels="beside"] .zx-module-bar__label { text-align: start; }
|
|
68
78
|
|
|
69
79
|
.zx-module-bar[data-labels="beside"] .zx-module-bar__badge {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} MultiValueEditorOptions
|
|
@@ -153,20 +153,20 @@ export class MultiValueEditor extends Component {
|
|
|
153
153
|
ariaDisabled: String(index === 0),
|
|
154
154
|
ariaLabel: `Move value ${index + 1} up`,
|
|
155
155
|
dataset: { action: 'up', index }
|
|
156
|
-
}, icon('chevron-up', { size:
|
|
156
|
+
}, icon('chevron-up', { size: ICON_SIZE.chevron })) : null,
|
|
157
157
|
buttons ? h('button', {
|
|
158
158
|
class: 'zx-btn',
|
|
159
159
|
type: 'button',
|
|
160
160
|
ariaDisabled: String(index === last),
|
|
161
161
|
ariaLabel: `Move value ${index + 1} down`,
|
|
162
162
|
dataset: { action: 'down', index }
|
|
163
|
-
}, icon('chevron-down', { size:
|
|
163
|
+
}, icon('chevron-down', { size: ICON_SIZE.chevron })) : null,
|
|
164
164
|
h('button', {
|
|
165
165
|
class: 'zx-btn',
|
|
166
166
|
type: 'button',
|
|
167
167
|
ariaLabel: `Remove value ${index + 1}`,
|
|
168
168
|
dataset: { action: 'remove', index }
|
|
169
|
-
}, icon('x', { size:
|
|
169
|
+
}, icon('x', { size: ICON_SIZE.dismiss }))
|
|
170
170
|
)
|
|
171
171
|
);
|
|
172
172
|
});
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
padding-inline: var(--zx-space-2);
|
|
30
30
|
color: var(--zx-color-accent);
|
|
31
31
|
font-size: var(--zx-text-xl);
|
|
32
|
-
font-weight:
|
|
32
|
+
font-weight: var(--zx-weight-title);
|
|
33
33
|
letter-spacing: var(--zx-tracking-title);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.
|
|
64
|
+
/* The current item is left out, so pointing at it never trades its fill for the lighter hover. */
|
|
65
|
+
.zx-navigation-bar__item:hover:not([aria-disabled="true"], [aria-current="page"], [aria-selected="true"]) {
|
|
65
66
|
background: var(--zx-color-bg-hover);
|
|
66
67
|
color: var(--zx-color-text);
|
|
67
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
3
|
import { printf } from '../../core/i18n.js';
|
|
4
|
-
import { icon } from '../../core/icons.js';
|
|
4
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
5
5
|
|
|
6
6
|
/** @typedef {'pages'|'loadmore'} PaginationMode */
|
|
7
7
|
|
|
@@ -336,7 +336,7 @@ export class Pagination extends Component {
|
|
|
336
336
|
ref,
|
|
337
337
|
ariaLabel: label,
|
|
338
338
|
dataset: { kind: 'default', size: 'sm' }
|
|
339
|
-
}, icon(glyph, { size:
|
|
339
|
+
}, icon(glyph, { size: ICON_SIZE.chevron }));
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
/** @returns {HTMLElement} The append-style trigger. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { isElement, uid } from '../../core/util.js';
|
|
5
5
|
import { button } from '../button/button.js';
|
|
6
6
|
|
|
@@ -83,7 +83,7 @@ export class Panel extends Component {
|
|
|
83
83
|
toggleChildren.push(h('span', {
|
|
84
84
|
class: 'zx-panel__chevron',
|
|
85
85
|
ariaHidden: 'true'
|
|
86
|
-
}, icon('chevron-right', { size:
|
|
86
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron })));
|
|
87
87
|
}
|
|
88
88
|
toggleChildren.push(title);
|
|
89
89
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Section links (`proseAnchors()`). A heading with an id ends in a small link to itself; the heading
|
|
3
|
+
* is the reveal host (base.css), so the link rests out of sight, keeps its room, and shows while the
|
|
4
|
+
* heading is pointed at or the link has focus — and always on a touch screen or under a contrast
|
|
5
|
+
* preference. The link is a square a little smaller than a control, sized so that a heading's line
|
|
6
|
+
* never grows to hold it.
|
|
7
|
+
*/
|
|
8
|
+
.zx-prose__anchor {
|
|
9
|
+
--zx-prose-anchor-size: calc(var(--zx-control-height) - var(--zx-space-1) - 2px);
|
|
10
|
+
display: inline-grid;
|
|
11
|
+
place-items: center;
|
|
12
|
+
inline-size: var(--zx-prose-anchor-size);
|
|
13
|
+
block-size: var(--zx-prose-anchor-size);
|
|
14
|
+
margin-block: calc((1lh - var(--zx-prose-anchor-size)) / 2);
|
|
15
|
+
margin-inline-start: 0.2em;
|
|
16
|
+
border-radius: var(--zx-radius-sm);
|
|
17
|
+
color: var(--zx-color-text-muted);
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
vertical-align: bottom;
|
|
20
|
+
transition: opacity var(--zx-dur-fast) var(--zx-ease), color var(--zx-dur-fast) var(--zx-ease);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.zx-prose__anchor:hover {
|
|
24
|
+
background: var(--zx-color-bg-hover);
|
|
25
|
+
color: var(--zx-color-text);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.zx-prose__anchor:focus-visible {
|
|
29
|
+
outline-color: transparent;
|
|
30
|
+
box-shadow: var(--zx-focus-ring);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.zx-prose__anchor[data-copied] {
|
|
34
|
+
color: var(--zx-color-success);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* The confirmation is spoken, not drawn: the tick already shows it. */
|
|
38
|
+
.zx-prose__status {
|
|
39
|
+
position: absolute;
|
|
40
|
+
inset-block-start: 0;
|
|
41
|
+
inset-inline-start: 0;
|
|
42
|
+
clip-path: inset(50%);
|
|
43
|
+
inline-size: 1px;
|
|
44
|
+
block-size: 1px;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media print {
|
|
50
|
+
.zx-prose__anchor {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { h } from '../../core/dom.js';
|
|
2
|
+
import { copyToClipboard } from '../../core/export.js';
|
|
3
|
+
import { icon } from '../../core/icons.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} ProseAnchorsOptions
|
|
7
|
+
* @property {string} [selector='h2[id], h3[id], h4[id]'] The headings that get a link, inside a
|
|
8
|
+
* `.zx-prose` under the root. A heading without an `id` has nothing to link to and is skipped.
|
|
9
|
+
* @property {string} [label='Copy link to %1'] The link's accessible name; `%1` is the heading.
|
|
10
|
+
* @property {string} [title='Copy link'] The link's tooltip.
|
|
11
|
+
* @property {string} [feedback='Link copied'] What the live region says after a copy.
|
|
12
|
+
* @property {number} [feedbackDuration=2000] Milliseconds the tick and the message stay.
|
|
13
|
+
* @property {(id: string) => string} [href] The address copied for a heading id. Defaults to the
|
|
14
|
+
* current address with its hash replaced (`sectionHref(location.href, id)`).
|
|
15
|
+
* @property {(url: string, copied: boolean) => void} [oncopy] Called with the address and whether
|
|
16
|
+
* the clipboard took it.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} ProseAnchors
|
|
21
|
+
* @property {() => void} refresh Links headings added since, re-attaches the live region if the
|
|
22
|
+
* content was replaced, and updates the address of every link. Call it after re-rendering.
|
|
23
|
+
* @property {() => void} destroy Removes every link, the live region, and the listener.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** @type {Readonly<Required<Omit<ProseAnchorsOptions, 'href'|'oncopy'>>>} */
|
|
27
|
+
const defaults = Object.freeze({
|
|
28
|
+
selector: 'h2[id], h3[id], h4[id]',
|
|
29
|
+
label: 'Copy link to %1',
|
|
30
|
+
title: 'Copy link',
|
|
31
|
+
feedback: 'Link copied',
|
|
32
|
+
feedbackDuration: 2000
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The address of a section: `base` with its hash replaced by the heading's id. The query is kept,
|
|
37
|
+
* and the id is encoded as a fragment.
|
|
38
|
+
* @param {string} base Absolute address, usually `location.href`.
|
|
39
|
+
* @param {string} id Heading id.
|
|
40
|
+
* @returns {string}
|
|
41
|
+
*/
|
|
42
|
+
export function sectionHref(base, id) {
|
|
43
|
+
const url = new URL(String(base));
|
|
44
|
+
url.hash = String(id);
|
|
45
|
+
return url.href;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gives every section heading of authored content a link to itself. Each `h2`–`h4` with an `id`
|
|
50
|
+
* inside a `.zx-prose` under `root` ends in a small link (`<a class="zx-prose__anchor" href="#id">`)
|
|
51
|
+
* that rests out of sight and shows while the heading is pointed at or the link has focus. A plain
|
|
52
|
+
* click copies the section's address and confirms in place, without moving the page or touching
|
|
53
|
+
* the location, so an application's own routing is left alone; a middle or modified click is left
|
|
54
|
+
* to the browser, which opens the address.
|
|
55
|
+
*
|
|
56
|
+
* The heading becomes the reveal host (`data-zx-reveal-host`), so the link is always visible on a
|
|
57
|
+
* touch screen and under a contrast preference, and it stays in the Tab order.
|
|
58
|
+
*
|
|
59
|
+
* @param {Element|string} root The content, or an element holding it; a selector is resolved in
|
|
60
|
+
* the document.
|
|
61
|
+
* @param {ProseAnchorsOptions} [options={}] Anchor options.
|
|
62
|
+
* @returns {ProseAnchors}
|
|
63
|
+
*/
|
|
64
|
+
export function proseAnchors(root, options = {}) {
|
|
65
|
+
const target = typeof root === 'string' ? document.querySelector(root) : root;
|
|
66
|
+
if (!(target instanceof Element)) throw new TypeError('proseAnchors root could not be resolved');
|
|
67
|
+
const settings = { ...defaults, ...options };
|
|
68
|
+
const abort = new AbortController();
|
|
69
|
+
/** @type {Map<HTMLAnchorElement, HTMLElement>} Link → its heading. */
|
|
70
|
+
const anchors = new Map();
|
|
71
|
+
/** @type {Set<HTMLElement>} Headings this call made reveal hosts. */
|
|
72
|
+
const hosts = new Set();
|
|
73
|
+
const status = h('span', { class: 'zx-prose__status', role: 'status' });
|
|
74
|
+
let timer = 0;
|
|
75
|
+
|
|
76
|
+
const hrefFor = (/** @type {string} */ id) => (typeof settings.href === 'function'
|
|
77
|
+
? String(settings.href(id))
|
|
78
|
+
: sectionHref(globalThis.location?.href ?? 'about:blank', id));
|
|
79
|
+
|
|
80
|
+
const refresh = () => {
|
|
81
|
+
if (abort.signal.aborted) return;
|
|
82
|
+
for (const [anchor, heading] of anchors) {
|
|
83
|
+
if (anchor.isConnected && heading.contains(anchor) && heading.id) {
|
|
84
|
+
anchor.setAttribute('href', `#${heading.id}`);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
anchor.remove();
|
|
88
|
+
anchors.delete(anchor);
|
|
89
|
+
}
|
|
90
|
+
const headings = /** @type {HTMLElement[]} */ ([...target.querySelectorAll(String(settings.selector))]);
|
|
91
|
+
for (const heading of headings) {
|
|
92
|
+
if (!heading.id || !heading.closest('.zx-prose')) continue;
|
|
93
|
+
if ([...anchors.values()].includes(heading)) continue;
|
|
94
|
+
const text = (heading.textContent ?? '').trim();
|
|
95
|
+
const anchor = /** @type {HTMLAnchorElement} */ (h('a', {
|
|
96
|
+
class: 'zx-prose__anchor',
|
|
97
|
+
href: `#${heading.id}`,
|
|
98
|
+
ariaLabel: String(settings.label).replace('%1', text),
|
|
99
|
+
title: String(settings.title),
|
|
100
|
+
'data-zx-reveal': ''
|
|
101
|
+
}, icon('link-2')));
|
|
102
|
+
if (!heading.hasAttribute('data-zx-reveal-host')) {
|
|
103
|
+
heading.setAttribute('data-zx-reveal-host', '');
|
|
104
|
+
hosts.add(heading);
|
|
105
|
+
}
|
|
106
|
+
heading.append(anchor);
|
|
107
|
+
anchors.set(anchor, heading);
|
|
108
|
+
}
|
|
109
|
+
// The live region sits beside the content, never inside a heading, whose name it would join.
|
|
110
|
+
if (!status.isConnected) target.append(status);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
target.addEventListener('click', async (event) => {
|
|
114
|
+
const anchor = /** @type {Element} */ (event.target)?.closest?.('.zx-prose__anchor');
|
|
115
|
+
if (!(anchor instanceof HTMLAnchorElement) || !anchors.has(anchor)) return;
|
|
116
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
const heading = anchors.get(anchor);
|
|
119
|
+
const url = hrefFor(heading?.id ?? '');
|
|
120
|
+
const copied = await copyToClipboard(url);
|
|
121
|
+
if (abort.signal.aborted) return;
|
|
122
|
+
settings.oncopy?.(url, copied);
|
|
123
|
+
if (!copied) return;
|
|
124
|
+
clearTimeout(timer);
|
|
125
|
+
for (const other of anchors.keys()) delete other.dataset.copied;
|
|
126
|
+
anchor.dataset.copied = 'true';
|
|
127
|
+
anchor.replaceChildren(icon('check'));
|
|
128
|
+
if (!status.isConnected) target.append(status);
|
|
129
|
+
status.textContent = String(settings.feedback);
|
|
130
|
+
timer = setTimeout(() => {
|
|
131
|
+
delete anchor.dataset.copied;
|
|
132
|
+
anchor.replaceChildren(icon('link-2'));
|
|
133
|
+
status.textContent = '';
|
|
134
|
+
}, Math.max(0, Number(settings.feedbackDuration) || 0));
|
|
135
|
+
}, { signal: abort.signal });
|
|
136
|
+
|
|
137
|
+
refresh();
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
refresh,
|
|
141
|
+
destroy() {
|
|
142
|
+
if (abort.signal.aborted) return;
|
|
143
|
+
abort.abort();
|
|
144
|
+
clearTimeout(timer);
|
|
145
|
+
for (const anchor of anchors.keys()) anchor.remove();
|
|
146
|
+
anchors.clear();
|
|
147
|
+
for (const heading of hosts) heading.removeAttribute('data-zx-reveal-host');
|
|
148
|
+
hosts.clear();
|
|
149
|
+
status.remove();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -223,27 +223,17 @@
|
|
|
223
223
|
line-height: 1.45;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
/* The
|
|
227
|
-
|
|
226
|
+
/* The keycap advertises the shortcut (`kbd()`, the one key-hint construction); it is
|
|
227
|
+
`aria-hidden`, since a screen-reader user moves through the group with the arrow keys. A chosen
|
|
228
|
+
answer draws its cap in the accent, through the keycap's own hooks. */
|
|
228
229
|
.zx-questionnaire__key {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
place-items: center;
|
|
232
|
-
border: 1px solid var(--zx-color-border);
|
|
233
|
-
border-radius: var(--zx-radius-sm);
|
|
234
|
-
background: var(--zx-color-bg-muted);
|
|
235
|
-
padding-inline: var(--zx-space-2);
|
|
236
|
-
min-inline-size: 22px;
|
|
237
|
-
block-size: 22px;
|
|
238
|
-
color: var(--zx-color-text-muted);
|
|
239
|
-
font-family: inherit;
|
|
240
|
-
font-size: var(--zx-text-xs);
|
|
241
|
-
text-transform: uppercase;
|
|
230
|
+
/* Centred on the label's first line, as the marker is. */
|
|
231
|
+
margin-block-start: calc((var(--zx-control-font-size) * 1.4 - var(--zx-kbd-size)) / 2);
|
|
242
232
|
}
|
|
243
233
|
|
|
244
234
|
.zx-questionnaire__choice:has(.zx-questionnaire__control:checked) .zx-questionnaire__key {
|
|
245
|
-
|
|
246
|
-
|
|
235
|
+
--zx-kbd-ink: var(--zx-color-accent);
|
|
236
|
+
--zx-kbd-line: var(--zx-color-accent);
|
|
247
237
|
}
|
|
248
238
|
|
|
249
239
|
/* -------------------------------------------------------------- freeform */
|