@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.
Files changed (114) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +49 -16
  3. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
  4. package/dist/types/components/badge/badge.d.ts +5 -4
  5. package/dist/types/components/datebox/date-range-box.d.ts +15 -2
  6. package/dist/types/components/datebox/datebox.d.ts +37 -3
  7. package/dist/types/components/kbd/kbd.d.ts +41 -0
  8. package/dist/types/components/launcher/launcher.d.ts +4 -2
  9. package/dist/types/components/prose/prose.d.ts +69 -0
  10. package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
  11. package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
  12. package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
  13. package/dist/types/components/tree/tree.d.ts +44 -3
  14. package/dist/types/core/icons.d.ts +22 -1
  15. package/dist/types/index.d.ts +4 -2
  16. package/dist/types/internal/app-rail.d.ts +10 -3
  17. package/dist/types/internal/row-actions.d.ts +151 -0
  18. package/dist/zx-zeyos.esm.js +264 -82
  19. package/dist/zx-zeyos.esm.min.js +4 -4
  20. package/dist/zx.css +1288 -439
  21. package/dist/zx.esm.js +952 -392
  22. package/dist/zx.esm.min.js +6 -6
  23. package/dist/zx.global.js +952 -392
  24. package/dist/zx.global.min.js +6 -6
  25. package/dist/zx.min.css +1 -1
  26. package/docs/api.json +112 -4
  27. package/docs/llms.md +433 -38
  28. package/docs/llms.txt +21 -1
  29. package/package.json +1 -1
  30. package/src/components/account-menu/account-menu.js +2 -2
  31. package/src/components/app-rail/app-rail.css +11 -11
  32. package/src/components/app-sidebar/app-sidebar.css +90 -17
  33. package/src/components/app-sidebar/app-sidebar.js +120 -12
  34. package/src/components/badge/badge.css +33 -20
  35. package/src/components/badge/badge.js +5 -4
  36. package/src/components/breadcrumb/breadcrumb.css +28 -3
  37. package/src/components/breadcrumb/breadcrumb.js +2 -2
  38. package/src/components/button/button.css +24 -13
  39. package/src/components/button/button.js +20 -2
  40. package/src/components/calendar/calendar.css +14 -4
  41. package/src/components/card-view/card-view.js +2 -2
  42. package/src/components/chart/chart.js +20 -5
  43. package/src/components/check-button/check-button.css +11 -3
  44. package/src/components/check-button/check-button.js +3 -3
  45. package/src/components/context-menu/context-menu.css +7 -1
  46. package/src/components/date-picker/date-picker.css +6 -0
  47. package/src/components/date-picker/date-picker.js +5 -5
  48. package/src/components/date-picker/date-range-picker.css +6 -0
  49. package/src/components/date-picker/date-range-picker.js +3 -3
  50. package/src/components/date-picker/month-picker.js +3 -3
  51. package/src/components/date-picker/time-picker.css +6 -0
  52. package/src/components/datebox/date-range-box.js +30 -6
  53. package/src/components/datebox/datebox.js +44 -7
  54. package/src/components/dialog/dialog.css +0 -1
  55. package/src/components/dialog/dialog.js +2 -1
  56. package/src/components/dock/dock.js +2 -2
  57. package/src/components/dropdown/dropdown.css +2 -1
  58. package/src/components/entity-ref/entity-ref.css +8 -1
  59. package/src/components/file-item/file-item.css +1 -1
  60. package/src/components/finder/finder.js +2 -2
  61. package/src/components/groupbox/groupbox.js +2 -2
  62. package/src/components/kanban-view/kanban-view.css +8 -4
  63. package/src/components/kanban-view/kanban-view.js +3 -3
  64. package/src/components/kbd/kbd.css +64 -0
  65. package/src/components/kbd/kbd.js +121 -0
  66. package/src/components/launcher/launcher.css +30 -25
  67. package/src/components/launcher/launcher.js +15 -21
  68. package/src/components/list-toolbar/list-toolbar.css +7 -1
  69. package/src/components/menu-button/menu-button.css +9 -2
  70. package/src/components/message/message.css +6 -2
  71. package/src/components/message/message.js +2 -2
  72. package/src/components/module-bar/module-bar.css +11 -1
  73. package/src/components/multi-value-editor/multi-value-editor.js +4 -4
  74. package/src/components/navigation-bar/navigation-bar.css +3 -2
  75. package/src/components/pagination/pagination.js +2 -2
  76. package/src/components/panel/panel.js +2 -2
  77. package/src/components/prose/prose.css +53 -0
  78. package/src/components/prose/prose.js +152 -0
  79. package/src/components/questionnaire/questionnaire.css +7 -17
  80. package/src/components/questionnaire/questionnaire.js +16 -1
  81. package/src/components/rating/rating.css +3 -1
  82. package/src/components/search/search.js +2 -2
  83. package/src/components/select/glyphs.js +3 -3
  84. package/src/components/select/select.css +35 -7
  85. package/src/components/select/select.js +4 -4
  86. package/src/components/stat-tile/stat-tile.css +56 -2
  87. package/src/components/stat-tile/stat-tile.js +25 -2
  88. package/src/components/stepper/stepper.css +2 -1
  89. package/src/components/stepper/stepper.js +3 -3
  90. package/src/components/tabbox/tabbox.css +2 -2
  91. package/src/components/tabbox/tabbox.js +2 -2
  92. package/src/components/table/table.css +52 -16
  93. package/src/components/table/table.js +7 -5
  94. package/src/components/tag-picker/tag-picker.css +56 -43
  95. package/src/components/tag-picker/tag-picker.js +21 -16
  96. package/src/components/tree/tree.css +44 -0
  97. package/src/components/tree/tree.js +97 -9
  98. package/src/components/value-list/value-list.css +25 -4
  99. package/src/components/value-list/value-list.js +2 -1
  100. package/src/components/view/record-view.js +3 -3
  101. package/src/components/view-settings/view-settings.css +2 -1
  102. package/src/components/workspace-switcher/workspace-switcher.js +3 -3
  103. package/src/core/icons.js +34 -3
  104. package/src/elements/define.js +1 -0
  105. package/src/index.js +4 -2
  106. package/src/internal/app-rail.js +5 -1
  107. package/src/internal/row-actions.js +203 -0
  108. package/styles/base.css +26 -1
  109. package/styles/prose.css +306 -0
  110. package/styles/tokens/dark.css +108 -103
  111. package/styles/tokens/global.css +24 -9
  112. package/styles/tokens/semantic.css +520 -198
  113. package/styles/tokens/themes.css +9 -0
  114. package/styles/zx.css +3 -0
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
2
2
  import { formatDate, parseDate } from '../../core/date.js';
3
3
  import { h } from '../../core/dom.js';
4
4
  import { printf, translate } from '../../core/i18n.js';
5
- import { icon } from '../../core/icons.js';
5
+ import { ICON_SIZE, icon } from '../../core/icons.js';
6
6
  import { position } from '../../core/position.js';
7
7
  import { escapeRegExp, uid } from '../../core/util.js';
8
8
  import { DateRangePicker, clampRange, normalizeRange } from '../date-picker/date-range-picker.js';
@@ -16,7 +16,11 @@ import { DateRangePicker, clampRange, normalizeRange } from '../date-picker/date
16
16
  * @typedef {Object} DateRangeBoxOptions
17
17
  * @property {Date|number|string|null} [start=null] Initial start: Date, Unix seconds, or formatted text.
18
18
  * @property {Date|number|string|null} [end=null] Initial end: Date, Unix seconds, or formatted text.
19
- * @property {string} [format='%d.%m.%Y'] Kernel date format used for both endpoints.
19
+ * @property {string} [format='%d.%m.%Y'] Kernel date format the reader types for both endpoints,
20
+ * shown while the field has focus. Numeric tokens only, since it is parsed.
21
+ * @property {string|null} [displayFormat=null] Format both endpoints are shown in while the field
22
+ * does not have focus. It is never parsed, so it may use any `formatDate()` token, month and
23
+ * weekday names included. Null shows `format`.
20
24
  * @property {string} [separator=' – '] Text placed between the two formatted dates.
21
25
  * @property {string|null} [placeholder=null] Input placeholder; null derives one from the format.
22
26
  * @property {boolean} [clearable=true] Show a clear button while a range is present and the box is
@@ -110,6 +114,7 @@ export class DateRangeBox extends Component {
110
114
  start: null,
111
115
  end: null,
112
116
  format: '%d.%m.%Y',
117
+ displayFormat: null,
113
118
  separator: ' – ',
114
119
  placeholder: null,
115
120
  clearable: true,
@@ -136,9 +141,11 @@ export class DateRangeBox extends Component {
136
141
  this._originalClearable = root.getAttribute('data-clearable');
137
142
  root.toggleAttribute('data-clearable', Boolean(this.options.clearable));
138
143
  this._format = String(this.options.format || '%d.%m.%Y');
144
+ this._displayFormat = this.options.displayFormat ? String(this.options.displayFormat) : this._format;
139
145
  this._separator = String(this.options.separator ?? ' – ');
140
146
  this._disabled = Boolean(this.options.disabled);
141
147
  this._open = false;
148
+ this._focused = false;
142
149
  this._position = null;
143
150
  this._range = this._coerce({ start: this.options.start, end: this.options.end });
144
151
  const popoverId = uid('zx-date-range-box-popover');
@@ -160,7 +167,7 @@ export class DateRangeBox extends Component {
160
167
  class: 'zx-icon-btn zx-date-range-box__clear',
161
168
  type: 'button',
162
169
  ariaLabel: text('daterange.clear', 'Clear date range')
163
- }, icon('x', { size: 13 })),
170
+ }, icon('x', { size: ICON_SIZE.dismiss })),
164
171
  h('button', {
165
172
  ref: 'toggle',
166
173
  class: 'zx-date-range-box__toggle',
@@ -206,10 +213,20 @@ export class DateRangeBox extends Component {
206
213
  if (event.detail.start && event.detail.end) this._close(true);
207
214
  });
208
215
 
216
+ // Focus swaps the resting text for the typing text; a valid commit on blur swaps it back.
217
+ this.listen(this.refs.input, 'focus', () => {
218
+ this._focused = true;
219
+ if (this.el.dataset.state !== 'invalid') this._syncDisplay();
220
+ });
209
221
  // Moving focus into the open calendar blurs the input; committing then would turn a
210
- // half-picked range into a one-day range behind the user's back.
222
+ // half-picked range into a one-day range behind the user's back. Untouched text still goes
223
+ // back to the display format.
211
224
  this.listen(this.refs.input, 'blur', () => {
225
+ this._focused = false;
212
226
  if (!this._open) this._commitText();
227
+ else if (this.refs.input.value === formatRangeText(this._range, this._format, this._separator)) {
228
+ this._syncDisplay();
229
+ }
213
230
  });
214
231
  this.listen(this.refs.input, 'keydown', (event) => this._onInputKeydown(event));
215
232
  this.listen(this.refs.toggle, 'click', () => this._open ? this.close() : this.open());
@@ -436,9 +453,16 @@ export class DateRangeBox extends Component {
436
453
  return `${one}${this._separator}${one}`;
437
454
  }
438
455
 
439
- /** @returns {void} */
456
+ /**
457
+ * Writes the range into the input: in the typing format while the input has focus, in the
458
+ * display format otherwise. Text that is already there is left alone, so the caret stays put.
459
+ * @returns {void}
460
+ */
440
461
  _syncDisplay() {
441
- this.refs.input.value = formatRangeText(this._range, this._format, this._separator);
462
+ const input = this.refs.input;
463
+ const format = this._focused ? this._format : this._displayFormat;
464
+ const text = formatRangeText(this._range, format, this._separator);
465
+ if (input.value !== text) input.value = text;
442
466
  this._syncClear();
443
467
  }
444
468
 
@@ -1,7 +1,7 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { clampDate, formatDate, parseDate } from '../../core/date.js';
3
3
  import { h } from '../../core/dom.js';
4
- import { icon } from '../../core/icons.js';
4
+ import { ICON_SIZE, icon } from '../../core/icons.js';
5
5
  import { position } from '../../core/position.js';
6
6
  import { uid } from '../../core/util.js';
7
7
  import { DatePicker } from '../date-picker/date-picker.js';
@@ -9,7 +9,11 @@ import { DatePicker } from '../date-picker/date-picker.js';
9
9
  /**
10
10
  * @typedef {Object} DateboxOptions
11
11
  * @property {Date|number|string|null} [value=null] Date, Unix seconds, or formatted string.
12
- * @property {string} [format='%d.%m.%Y'] Kernel date format.
12
+ * @property {string} [format='%d.%m.%Y'] Kernel date format the reader types, shown while the
13
+ * field has focus. Numeric tokens only (`%d %e %m %Y %y %H %M %S`), since it is parsed.
14
+ * @property {string|null} [displayFormat=null] Format the field shows while it does not have focus,
15
+ * so a date reads as the rest of the screen writes dates. It is never parsed, so it may use any
16
+ * `formatDate()` token, month and weekday names included. Null shows `format`.
13
17
  * @property {boolean} [time=false] Append `%H:%M` and show time controls.
14
18
  * @property {Date|null} [min=null] Earliest selectable date.
15
19
  * @property {Date|null} [max=null] Latest selectable date.
@@ -40,6 +44,7 @@ export class Datebox extends Component {
40
44
  static defaults = {
41
45
  value: null,
42
46
  format: '%d.%m.%Y',
47
+ displayFormat: null,
43
48
  time: false,
44
49
  min: null,
45
50
  max: null,
@@ -56,9 +61,12 @@ export class Datebox extends Component {
56
61
  this._originalAriaDisabled = root.getAttribute('aria-disabled');
57
62
  this._originalClearable = root.getAttribute('data-clearable');
58
63
  root.toggleAttribute('data-clearable', Boolean(this.options.clearable));
59
- this._format = effectiveFormat(this.options.format, this.options.time);
64
+ const formats = dateboxFormats(this.options);
65
+ this._format = formats.format;
66
+ this._displayFormat = formats.display;
60
67
  this._disabled = Boolean(this.options.disabled);
61
68
  this._open = false;
69
+ this._focused = false;
62
70
  this._position = null;
63
71
  this._min = validDate(this.options.min);
64
72
  this._max = validDate(this.options.max);
@@ -82,7 +90,7 @@ export class Datebox extends Component {
82
90
  class: 'zx-icon-btn zx-datebox__clear',
83
91
  type: 'button',
84
92
  ariaLabel: 'Clear date'
85
- }, icon('x', { size: 13 })),
93
+ }, icon('x', { size: ICON_SIZE.dismiss })),
86
94
  h('button', {
87
95
  ref: 'toggle',
88
96
  class: 'zx-datebox__toggle',
@@ -116,7 +124,15 @@ export class Datebox extends Component {
116
124
  if (!this.options.time) this._close(true);
117
125
  });
118
126
 
119
- this.listen(this.refs.input, 'blur', () => this._commitText());
127
+ // Focus swaps the resting text for the typing text; a valid commit on blur swaps it back.
128
+ this.listen(this.refs.input, 'focus', () => {
129
+ this._focused = true;
130
+ if (this.el.dataset.state !== 'invalid') this._syncDisplay();
131
+ });
132
+ this.listen(this.refs.input, 'blur', () => {
133
+ this._focused = false;
134
+ this._commitText();
135
+ });
120
136
  this.listen(this.refs.input, 'keydown', (event) => this._onInputKeydown(event));
121
137
  this.listen(this.refs.toggle, 'click', () => this._open ? this.close() : this.open());
122
138
  this.listen(this.refs.toggle, 'keydown', (event) => {
@@ -280,9 +296,16 @@ export class Datebox extends Component {
280
296
  return clampDate(date, this._min, this._max);
281
297
  }
282
298
 
283
- /** @returns {void} */
299
+ /**
300
+ * Writes the value into the input: in the typing format while the input has focus, in the
301
+ * display format otherwise. Text that is already there is left alone, so the caret stays put.
302
+ * @returns {void}
303
+ */
284
304
  _syncDisplay() {
285
- this.refs.input.value = this._value ? formatDate(this._value, this._format) : '';
305
+ const input = this.refs.input;
306
+ const format = this._focused ? this._format : this._displayFormat;
307
+ const text = this._value ? formatDate(this._value, format) : '';
308
+ if (input.value !== text) input.value = text;
286
309
  this._syncClear();
287
310
  }
288
311
 
@@ -348,6 +371,20 @@ function validDate(value) {
348
371
  return value instanceof Date && !Number.isNaN(value.getTime()) ? new Date(value.getTime()) : null;
349
372
  }
350
373
 
374
+ /**
375
+ * Resolves the two formats a Datebox works with: `format`, which the reader types and the field
376
+ * shows while focused, and `display`, which the field shows at rest. A missing format is
377
+ * `'%d.%m.%Y'`, a missing display format is the typing format, and with `time` either one that
378
+ * names no hour or minute gets `' %H:%M'` appended, so the time is never hidden.
379
+ * @param {{format?: string|null, displayFormat?: string|null, time?: boolean}} [options={}]
380
+ * The Datebox options that decide them.
381
+ * @returns {{format: string, display: string}}
382
+ */
383
+ export function dateboxFormats({ format = null, displayFormat = null, time = false } = {}) {
384
+ const typing = effectiveFormat(format, time);
385
+ return { format: typing, display: displayFormat ? effectiveFormat(displayFormat, time) : typing };
386
+ }
387
+
351
388
  /** @param {unknown} format @param {unknown} time @returns {string} */
352
389
  function effectiveFormat(format, time) {
353
390
  const value = String(format || '%d.%m.%Y');
@@ -33,7 +33,6 @@
33
33
  flex: none;
34
34
  inline-size: var(--zx-control-height);
35
35
  padding-inline: 0;
36
- font-size: var(--zx-text-xl);
37
36
  }
38
37
 
39
38
  .zx-dialog__body {
@@ -1,4 +1,5 @@
1
1
  import { h } from '../../core/dom.js';
2
+ import { ICON_SIZE, icon } from '../../core/icons.js';
2
3
  import { uid } from '../../core/util.js';
3
4
  import { Modal } from '../modal/modal.js';
4
5
  import { button } from '../button/button.js';
@@ -139,7 +140,7 @@ export class Dialog extends Modal {
139
140
  'data-kind': 'ghost',
140
141
  ariaLabel: close,
141
142
  title: close
142
- }, '×')
143
+ }, icon('x', { size: ICON_SIZE.dismiss }))
143
144
  ),
144
145
  h('div', { class: 'zx-modal__content zx-dialog__body', ref: 'content' }),
145
146
  h('footer', { class: 'zx-dialog__footer', ref: 'footer' })
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
2
2
  import { STEP, STEP_LARGE, dragAxis } from '../../core/drag-axis.js';
3
3
  import { matchBreakpoint, onBreakpoint } from '../../core/breakpoint.js';
4
4
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
5
- import { icon } from '../../core/icons.js';
5
+ import { ICON_SIZE, icon } from '../../core/icons.js';
6
6
  import { rovingTabindex } from '../../core/keyboard.js';
7
7
  import { storage } from '../../core/storage.js';
8
8
  import { clamp, uid } from '../../core/util.js';
@@ -444,7 +444,7 @@ export class Dock extends Component {
444
444
  const hasTabs = Array.isArray(definition.tabs) && definition.tabs.length > 0;
445
445
 
446
446
  const chevron = h('span', { class: 'zx-dock__chevron', ariaHidden: 'true' },
447
- icon('chevron-right', { size: 14 }));
447
+ icon('chevron-right', { size: ICON_SIZE.chevron }));
448
448
  const toggle = h('button', {
449
449
  class: 'zx-dock__toggle',
450
450
  type: 'button',
@@ -3,7 +3,8 @@
3
3
  max-block-size: calc(100vh - (2 * var(--zx-space-3)));
4
4
  overflow: auto;
5
5
  border: 1px solid var(--zx-color-overlay-border);
6
- border-radius: var(--zx-radius-lg);
6
+ /* Concentric with the items a panel holds: their corner plus the inset around them. */
7
+ border-radius: var(--zx-radius-panel);
7
8
  background-color: var(--zx-color-overlay-surface);
8
9
  background-image: var(--zx-overlay-surface-image);
9
10
  background-clip: padding-box;
@@ -23,7 +23,8 @@
23
23
  inline-size: var(--zx-entity-ref-visual-size);
24
24
  block-size: var(--zx-entity-ref-visual-size);
25
25
  overflow: hidden;
26
- border: 1px solid var(--zx-color-border);
26
+ /* One fill, not a fill and a line: the edge stays, transparent, to keep the tile's size. */
27
+ border: 1px solid transparent;
27
28
  border-radius: var(--zx-radius-md);
28
29
  background: var(--zx-color-bg-muted);
29
30
  color: var(--zx-color-text-muted);
@@ -174,6 +175,12 @@
174
175
  cursor: default;
175
176
  }
176
177
 
178
+ @media (prefers-contrast: more) {
179
+ .zx-entity-ref__icon {
180
+ border-color: var(--zx-color-border-strong);
181
+ }
182
+ }
183
+
177
184
  @media (forced-colors: active) {
178
185
  .zx-entity-ref__icon,
179
186
  .zx-entity-ref__action[data-kind="default"] {
@@ -38,7 +38,7 @@
38
38
  grid-column: 1 / -1;
39
39
  block-size: 4px;
40
40
  overflow: hidden;
41
- border-radius: var(--zx-radius-pill);
41
+ border-radius: var(--zx-radius-full);
42
42
  background: var(--zx-color-bg-muted);
43
43
  }
44
44
 
@@ -1,6 +1,6 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
3
- import { icon } from '../../core/icons.js';
3
+ import { ICON_SIZE, icon } from '../../core/icons.js';
4
4
  import { typeahead } from '../../core/keyboard.js';
5
5
  import { uid } from '../../core/util.js';
6
6
  import { createReaders, isBranch, pathTo } from '../tree/hierarchy.js';
@@ -276,7 +276,7 @@ export class Finder extends Component {
276
276
  this.options.renderItem ? this.options.renderItem(node) : this._readers.label(node)));
277
277
  if (branch) {
278
278
  row.append(h('span', { class: 'zx-finder__chevron', ariaHidden: 'true' },
279
- icon('chevron-right', { size: 11 })));
279
+ icon('chevron-right', { size: ICON_SIZE.chevron })));
280
280
  }
281
281
  row.toggleAttribute('data-branch', branch);
282
282
  list.append(row);
@@ -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
 
5
5
  /**
6
6
  * @typedef {Object} GroupboxOptions
@@ -69,7 +69,7 @@ export class Groupbox extends Component {
69
69
  );
70
70
  const summary = h('summary', { class: 'zx-groupbox__summary', ref: 'summary' },
71
71
  h('span', { class: 'zx-groupbox__chevron', ariaHidden: 'true' },
72
- icon('chevron-right', { size: 16 })
72
+ icon('chevron-right', { size: ICON_SIZE.chevron })
73
73
  ),
74
74
  h('span', { class: 'zx-groupbox__title', ref: 'title' }, String(this.options.title))
75
75
  );
@@ -143,6 +143,7 @@
143
143
  flex: 0 0 auto;
144
144
  color: var(--zx-color-text-muted);
145
145
  font-size: var(--zx-text-xs);
146
+ font-variant-numeric: tabular-nums;
146
147
  font-weight: 400;
147
148
  line-height: 1.25;
148
149
  white-space: nowrap;
@@ -772,7 +773,7 @@
772
773
  /*
773
774
  * A face is a small Avatar: the initials on the tint of the tone the component derives from the
774
775
  * name with Avatar's own hash (`data-tone`), so a person has the same colour on the board as
775
- * everywhere else. The surface-coloured edge is what separates overlapping faces.
776
+ * everywhere else. A 2px ring in the surface colour is what separates overlapping faces.
776
777
  */
777
778
  .zx-kanban-view__avatar {
778
779
  display: inline-grid;
@@ -781,8 +782,8 @@
781
782
  inline-size: 1.5rem;
782
783
  block-size: 1.5rem;
783
784
  overflow: hidden;
784
- border: 1px solid var(--zx-color-bg-surface);
785
785
  border-radius: var(--zx-radius-full);
786
+ box-shadow: 0 0 0 2px var(--zx-color-bg-surface);
786
787
  background: var(--zx-kanban-avatar-bg, var(--zx-color-bg-muted));
787
788
  color: var(--zx-kanban-avatar-fg, var(--zx-color-text-muted));
788
789
  }
@@ -797,12 +798,15 @@
797
798
  .zx-kanban-view__avatar[data-tone="violet"] { --zx-kanban-avatar-bg: var(--zx-color-tone-violet-bg); --zx-kanban-avatar-fg: var(--zx-color-tone-violet-fg); }
798
799
  .zx-kanban-view__avatar[data-tone="slate"] { --zx-kanban-avatar-bg: var(--zx-color-tone-slate-bg); --zx-kanban-avatar-fg: var(--zx-color-tone-slate-fg); }
799
800
 
801
+ /* Faces overlap by no more than a small step, so each stays a face rather than a sliver. */
800
802
  .zx-kanban-view__avatar + .zx-kanban-view__avatar {
801
- margin-inline-start: calc(var(--zx-space-2) * -1);
803
+ margin-inline-start: calc(-1 * var(--zx-space-1));
802
804
  }
803
805
 
806
+ /* The overflow count overlaps the face before it, so its fill is opaque: the text tint mixed into
807
+ the surface, never a translucent fill the face would show through. */
804
808
  .zx-kanban-view__avatar[data-overflow="true"] {
805
- background: var(--zx-color-bg-current);
809
+ background: color-mix(in srgb, var(--zx-color-text) 8%, var(--zx-color-bg-surface));
806
810
  color: var(--zx-color-text-muted);
807
811
  }
808
812
 
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
  import { h, restoreTarget, snapshotTarget } 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 { uid } from '../../core/util.js';
6
6
  import { badge } from '../badge/badge.js';
@@ -1021,7 +1021,7 @@ export class KanbanView extends RecordView {
1021
1021
  class: 'zx-kanban-view__collapse', type: 'button', ariaExpanded: String(!collapsed),
1022
1022
  ariaControls: bodyId, ariaLabel: this._text(collapsed ? 'expandLane' : 'collapseLane', { label: lane.label }),
1023
1023
  dataset: { kanbanCollapse: 'swimlane', kanbanId: lane.id }
1024
- }, icon(collapsed ? 'chevron-right' : 'chevron-down', { size: 13 }));
1024
+ }, icon(collapsed ? 'chevron-right' : 'chevron-down', { size: ICON_SIZE.chevron }));
1025
1025
  const limit = lane.limit ?? null;
1026
1026
  const wip = wipState(total, limit);
1027
1027
  const custom = this._renderHook('renderSwimlaneHeader', {
@@ -1074,7 +1074,7 @@ export class KanbanView extends RecordView {
1074
1074
  class: 'zx-kanban-view__collapse', type: 'button', ariaExpanded: String(!collapsed),
1075
1075
  ariaControls: listId, ariaLabel: this._text(collapsed ? 'expandColumn' : 'collapseColumn', { label: column.label }),
1076
1076
  dataset: { kanbanCollapse: 'column', kanbanId: column.id }
1077
- }, icon(collapsed ? 'chevron-right' : 'chevron-down', { size: 13 }));
1077
+ }, icon(collapsed ? 'chevron-right' : 'chevron-down', { size: ICON_SIZE.chevron }));
1078
1078
  const custom = this._renderHook('renderColumnHeader', {
1079
1079
  column: { ...column }, swimlane: lane ? { ...lane } : null,
1080
1080
  count: visible.length, total: entries.length, columnTotal, limit, wip, collapsed
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Keycaps. One construction for every key hint: a surface fill, one hairline, and a 1px foot, the
3
+ * label at the small size and medium weight, centred on its capital height. A single key is square,
4
+ * so a column of hints lines up. Three hooks retint it for a host that is not a plain surface —
5
+ * `--zx-kbd-ink`, `--zx-kbd-fill`, `--zx-kbd-line` — and `data-tone="inherit"` sets all three from
6
+ * the surrounding text colour, which is what a keycap on a solid button wants.
7
+ */
8
+ .zx-kbd {
9
+ --zx-kbd-size: calc(var(--zx-text-xs) + 6px);
10
+ display: inline-flex;
11
+ flex: none;
12
+ align-items: center;
13
+ gap: 2px;
14
+ font-family: var(--zx-font-sans);
15
+ font-size: var(--zx-text-xs);
16
+ font-weight: var(--zx-weight-medium);
17
+ font-feature-settings: "case", "tnum";
18
+ font-style: normal;
19
+ letter-spacing: 0;
20
+ line-height: 1;
21
+ vertical-align: middle;
22
+ white-space: nowrap;
23
+ }
24
+
25
+ .zx-kbd[data-size="sm"] {
26
+ --zx-kbd-size: calc(var(--zx-text-xs) + 4px);
27
+ font-size: calc(var(--zx-text-xs) - 1px);
28
+ }
29
+
30
+ .zx-kbd[data-tone="inherit"] {
31
+ --zx-kbd-ink: currentColor;
32
+ --zx-kbd-fill: color-mix(in srgb, currentColor 14%, transparent);
33
+ --zx-kbd-line: color-mix(in srgb, currentColor 32%, transparent);
34
+ }
35
+
36
+ .zx-kbd__key {
37
+ display: inline-grid;
38
+ box-sizing: border-box;
39
+ min-inline-size: var(--zx-kbd-size);
40
+ block-size: var(--zx-kbd-size);
41
+ place-items: center;
42
+ padding: 0 0.25em;
43
+ border: 1px solid var(--zx-kbd-line, var(--zx-color-border));
44
+ border-radius: var(--zx-radius-sm);
45
+ background: var(--zx-kbd-fill, var(--zx-color-bg-surface));
46
+ box-shadow: 0 1px 0 var(--zx-kbd-line, var(--zx-color-border));
47
+ color: var(--zx-kbd-ink, var(--zx-color-text-muted));
48
+ font: inherit;
49
+ font-feature-settings: inherit;
50
+ }
51
+
52
+ /* Centre the label on its capital height rather than its line box, where capitals sit low. */
53
+ @supports (text-box: trim-both cap alphabetic) {
54
+ .zx-kbd__key {
55
+ text-box: trim-both cap alphabetic;
56
+ }
57
+ }
58
+
59
+ @media (forced-colors: active) {
60
+ .zx-kbd__key {
61
+ border-color: CanvasText;
62
+ box-shadow: none;
63
+ }
64
+ }
@@ -0,0 +1,121 @@
1
+ import { h } from '../../core/dom.js';
2
+
3
+ /**
4
+ * @typedef {Object} KbdOptions
5
+ * @property {'md'|'sm'} [size='md'] Keycap size; `sm` sits inside a button or a menu row.
6
+ * @property {'neutral'|'inherit'} [tone='neutral'] `inherit` draws the keycaps in the surrounding
7
+ * ink — on a solid primary button, a dark toast — instead of the neutral surface keycap.
8
+ */
9
+
10
+ /** Key names that become a glyph on Apple platforms and a word elsewhere. */
11
+ const MODIFIERS = Object.freeze({
12
+ mod: ['⌘', 'Ctrl'],
13
+ meta: ['⌘', 'Meta'],
14
+ cmd: ['⌘', 'Ctrl'],
15
+ command: ['⌘', 'Ctrl'],
16
+ ctrl: ['⌃', 'Ctrl'],
17
+ control: ['⌃', 'Ctrl'],
18
+ alt: ['⌥', 'Alt'],
19
+ option: ['⌥', 'Alt'],
20
+ shift: ['⇧', 'Shift'],
21
+ backspace: ['⌫', 'Backspace'],
22
+ delete: ['⌦', 'Del'],
23
+ tab: ['⇥', 'Tab']
24
+ });
25
+
26
+ /** Key names that read the same on every platform. */
27
+ const KEYS = Object.freeze({
28
+ enter: '↵',
29
+ return: '↵',
30
+ escape: 'Esc',
31
+ esc: 'Esc',
32
+ space: 'Space',
33
+ arrowup: '↑',
34
+ up: '↑',
35
+ arrowdown: '↓',
36
+ down: '↓',
37
+ arrowleft: '←',
38
+ left: '←',
39
+ arrowright: '→',
40
+ right: '→',
41
+ pageup: 'PgUp',
42
+ pagedown: 'PgDn',
43
+ home: 'Home',
44
+ end: 'End'
45
+ });
46
+
47
+ /** @returns {boolean} Whether the platform names its command modifier ⌘. */
48
+ function isApplePlatform() {
49
+ const nav = globalThis.navigator;
50
+ if (!nav) return false;
51
+ const platform = /** @type {{userAgentData?: {platform?: string}}} */ (nav).userAgentData?.platform || nav.platform || '';
52
+ return /mac|iphone|ipad|ios/i.test(platform);
53
+ }
54
+
55
+ /**
56
+ * Splits a chord such as `'Mod+Shift+K'` into its keys. A literal plus is written as the last key
57
+ * (`'Mod++'`) or on its own (`'+'`).
58
+ * @param {string} chord
59
+ * @returns {string[]}
60
+ */
61
+ function splitChord(chord) {
62
+ if (chord === '+') return ['+'];
63
+ const keys = chord.split('+');
64
+ if (chord.endsWith('++')) keys.splice(-2, 2, '+');
65
+ return keys.map((key) => key.trim()).filter((key) => key !== '');
66
+ }
67
+
68
+ /**
69
+ * The label a key is shown with: a platform glyph for a modifier or a named key, the upper-case
70
+ * character for a letter, and anything else as written.
71
+ * @param {string} key
72
+ * @param {boolean} apple
73
+ * @returns {string}
74
+ */
75
+ function keyLabel(key, apple) {
76
+ const name = key.toLowerCase();
77
+ if (Object.hasOwn(MODIFIERS, name)) return MODIFIERS[name][apple ? 0 : 1];
78
+ if (Object.hasOwn(KEYS, name)) return KEYS[name];
79
+ return key.length === 1 ? key.toUpperCase() : key;
80
+ }
81
+
82
+ /**
83
+ * The keycap labels `kbd()` draws for a chord or a list of keys, without building any DOM.
84
+ * @example
85
+ * keyLabels('Mod+Shift+K'); // ['⌘', '⇧', 'K'] on macOS, ['Ctrl', 'Shift', 'K'] elsewhere
86
+ * keyLabels('Mod+K', { apple: false }); // ['Ctrl', 'K']
87
+ * @param {string|string[]} keys A chord (`'Mod+Shift+K'`) or the key labels, in order.
88
+ * @param {{apple?: boolean}} [options] `apple` overrides the platform check.
89
+ * @returns {string[]}
90
+ */
91
+ export function keyLabels(keys, { apple = isApplePlatform() } = {}) {
92
+ const list = Array.isArray(keys) ? keys.map(String) : splitChord(String(keys));
93
+ return list.map((key) => keyLabel(key, apple));
94
+ }
95
+
96
+ /**
97
+ * Renders a key or key combination as keycaps: one `<kbd class="zx-kbd">` holding a nested
98
+ * `<kbd class="zx-kbd__key">` per key, which is how HTML marks up a combination. Every place that
99
+ * shows a shortcut — a button, a menu, the launcher's hints, a shortcut sheet — uses it, so keys
100
+ * look the same everywhere.
101
+ *
102
+ * The keycaps are presentation. A control that has a shortcut announces it with
103
+ * `aria-keyshortcuts` on the control itself; mark a hint that repeats it `aria-hidden`.
104
+ *
105
+ * @example
106
+ * kbd('Mod+K'); // ⌘ K on macOS, Ctrl K elsewhere
107
+ * kbd(['g', 'h']); // a sequence written as two caps
108
+ * kbd('Enter', { size: 'sm' });
109
+ * @param {string|string[]} keys A chord (`'Mod+Shift+K'`) or the key labels, in order.
110
+ * @param {KbdOptions} [options]
111
+ * @returns {HTMLElement}
112
+ */
113
+ export function kbd(keys, options = {}) {
114
+ return h('kbd', {
115
+ class: 'zx-kbd',
116
+ dataset: {
117
+ size: options.size === 'sm' ? 'sm' : undefined,
118
+ tone: options.tone === 'inherit' ? 'inherit' : undefined
119
+ }
120
+ }, keyLabels(keys).map((label) => h('kbd', { class: 'zx-kbd__key' }, label)));
121
+ }