@zeyos/zx 5.4.0 → 5.6.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 (145) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/README.md +23 -16
  3. package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
  4. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
  5. package/dist/types/components/approval-card/approval-card.d.ts +596 -0
  6. package/dist/types/components/avatar/avatar.d.ts +91 -4
  7. package/dist/types/components/badge/badge.d.ts +5 -4
  8. package/dist/types/components/block-view/block-view.d.ts +205 -0
  9. package/dist/types/components/composer/composer.d.ts +736 -0
  10. package/dist/types/components/datebox/date-range-box.d.ts +15 -2
  11. package/dist/types/components/datebox/datebox.d.ts +37 -3
  12. package/dist/types/components/kbd/kbd.d.ts +41 -0
  13. package/dist/types/components/launcher/launcher.d.ts +4 -2
  14. package/dist/types/components/prose/prose.d.ts +69 -0
  15. package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
  16. package/dist/types/components/run-status/run-status.d.ts +393 -0
  17. package/dist/types/components/run-trace/run-trace.d.ts +624 -0
  18. package/dist/types/components/source-list/source-list.d.ts +177 -0
  19. package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
  20. package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
  21. package/dist/types/components/tree/tree.d.ts +44 -3
  22. package/dist/types/core/icons.d.ts +22 -1
  23. package/dist/types/core/messages.d.ts +135 -0
  24. package/dist/types/index.d.ts +12 -2
  25. package/dist/types/internal/agent-model.d.ts +587 -0
  26. package/dist/types/internal/app-rail.d.ts +10 -3
  27. package/dist/types/internal/highlight.d.ts +24 -0
  28. package/dist/types/internal/presence-loop.d.ts +148 -0
  29. package/dist/types/internal/row-actions.d.ts +151 -0
  30. package/dist/zx-zeyos.esm.js +4852 -4535
  31. package/dist/zx-zeyos.esm.min.js +4 -4
  32. package/dist/zx.css +3152 -434
  33. package/dist/zx.esm.js +13730 -6595
  34. package/dist/zx.esm.min.js +27 -8
  35. package/dist/zx.global.js +13730 -6595
  36. package/dist/zx.global.min.js +27 -8
  37. package/dist/zx.min.css +1 -1
  38. package/docs/api.json +1474 -205
  39. package/docs/llms.md +698 -39
  40. package/docs/llms.txt +12 -1
  41. package/package.json +1 -1
  42. package/src/components/account-menu/account-menu.js +2 -2
  43. package/src/components/agent-thread/agent-thread.css +417 -0
  44. package/src/components/agent-thread/agent-thread.js +1365 -0
  45. package/src/components/app-rail/app-rail.css +11 -11
  46. package/src/components/app-sidebar/app-sidebar.css +90 -17
  47. package/src/components/app-sidebar/app-sidebar.js +120 -12
  48. package/src/components/approval-card/approval-card.css +289 -0
  49. package/src/components/approval-card/approval-card.js +1377 -0
  50. package/src/components/avatar/avatar.css +56 -1
  51. package/src/components/avatar/avatar.js +148 -26
  52. package/src/components/badge/badge.css +33 -20
  53. package/src/components/badge/badge.js +5 -4
  54. package/src/components/block-view/block-view.css +300 -0
  55. package/src/components/block-view/block-view.js +523 -0
  56. package/src/components/breadcrumb/breadcrumb.css +28 -3
  57. package/src/components/breadcrumb/breadcrumb.js +2 -2
  58. package/src/components/button/button.css +24 -13
  59. package/src/components/button/button.js +20 -2
  60. package/src/components/calendar/calendar.css +14 -4
  61. package/src/components/card-view/card-view.js +2 -2
  62. package/src/components/chart/chart.js +20 -5
  63. package/src/components/check-button/check-button.css +11 -3
  64. package/src/components/check-button/check-button.js +3 -3
  65. package/src/components/composer/composer.css +403 -0
  66. package/src/components/composer/composer.js +1441 -0
  67. package/src/components/context-menu/context-menu.css +7 -1
  68. package/src/components/date-picker/date-picker.css +6 -0
  69. package/src/components/date-picker/date-picker.js +5 -5
  70. package/src/components/date-picker/date-range-picker.css +6 -0
  71. package/src/components/date-picker/date-range-picker.js +3 -3
  72. package/src/components/date-picker/month-picker.js +3 -3
  73. package/src/components/date-picker/time-picker.css +6 -0
  74. package/src/components/datebox/date-range-box.js +30 -6
  75. package/src/components/datebox/datebox.js +44 -7
  76. package/src/components/dialog/dialog.css +0 -1
  77. package/src/components/dialog/dialog.js +2 -1
  78. package/src/components/dock/dock.js +2 -2
  79. package/src/components/dropdown/dropdown.css +2 -1
  80. package/src/components/entity-ref/entity-ref.css +8 -1
  81. package/src/components/file-item/file-item.css +1 -1
  82. package/src/components/finder/finder.js +2 -2
  83. package/src/components/groupbox/groupbox.js +2 -2
  84. package/src/components/kanban-view/kanban-view.css +8 -4
  85. package/src/components/kanban-view/kanban-view.js +3 -3
  86. package/src/components/kbd/kbd.css +64 -0
  87. package/src/components/kbd/kbd.js +121 -0
  88. package/src/components/launcher/launcher.css +30 -25
  89. package/src/components/launcher/launcher.js +15 -21
  90. package/src/components/list-toolbar/list-toolbar.css +7 -1
  91. package/src/components/menu-button/menu-button.css +9 -2
  92. package/src/components/message/message.js +2 -2
  93. package/src/components/module-bar/module-bar.css +11 -1
  94. package/src/components/multi-value-editor/multi-value-editor.js +4 -4
  95. package/src/components/navigation-bar/navigation-bar.css +3 -2
  96. package/src/components/pagination/pagination.js +2 -2
  97. package/src/components/panel/panel.js +2 -2
  98. package/src/components/prose/prose.css +53 -0
  99. package/src/components/prose/prose.js +152 -0
  100. package/src/components/questionnaire/questionnaire.css +7 -17
  101. package/src/components/questionnaire/questionnaire.js +16 -1
  102. package/src/components/rating/rating.css +3 -1
  103. package/src/components/run-status/run-status.css +208 -0
  104. package/src/components/run-status/run-status.js +782 -0
  105. package/src/components/run-trace/run-trace.css +443 -0
  106. package/src/components/run-trace/run-trace.js +1209 -0
  107. package/src/components/search/search.js +2 -2
  108. package/src/components/select/glyphs.js +3 -3
  109. package/src/components/select/select.css +35 -7
  110. package/src/components/select/select.js +4 -4
  111. package/src/components/source-list/source-list.css +208 -0
  112. package/src/components/source-list/source-list.js +355 -0
  113. package/src/components/stat-tile/stat-tile.css +56 -2
  114. package/src/components/stat-tile/stat-tile.js +25 -2
  115. package/src/components/stepper/stepper.css +2 -1
  116. package/src/components/stepper/stepper.js +3 -3
  117. package/src/components/tabbox/tabbox.css +2 -2
  118. package/src/components/tabbox/tabbox.js +2 -2
  119. package/src/components/table/table.css +52 -16
  120. package/src/components/table/table.js +7 -5
  121. package/src/components/tag-picker/tag-picker.css +56 -43
  122. package/src/components/tag-picker/tag-picker.js +21 -16
  123. package/src/components/tree/tree.css +44 -0
  124. package/src/components/tree/tree.js +97 -9
  125. package/src/components/value-list/value-list.css +25 -4
  126. package/src/components/value-list/value-list.js +2 -1
  127. package/src/components/view/record-view.js +3 -3
  128. package/src/components/view-settings/view-settings.css +2 -1
  129. package/src/components/workspace-switcher/workspace-switcher.js +3 -3
  130. package/src/core/icons.js +34 -3
  131. package/src/core/messages.js +143 -0
  132. package/src/elements/define.js +1 -0
  133. package/src/index.js +12 -2
  134. package/src/internal/agent-model.js +488 -0
  135. package/src/internal/app-rail.js +5 -1
  136. package/src/internal/highlight.js +104 -0
  137. package/src/internal/presence-loop.js +343 -0
  138. package/src/internal/row-actions.js +203 -0
  139. package/styles/base.css +26 -1
  140. package/styles/prose.css +306 -0
  141. package/styles/tokens/dark.css +97 -120
  142. package/styles/tokens/global.css +24 -9
  143. package/styles/tokens/semantic.css +464 -184
  144. package/styles/tokens/themes.css +9 -0
  145. package/styles/zx.css +10 -0
@@ -1,13 +1,15 @@
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
+ import { renderRowActions, rowActionMenu, setRowActionsTabbable } from '../../internal/row-actions.js';
6
7
  import {
7
8
  createReaders, descendants, filterTree, findNode, flattenVisible, isBranch, pathTo, walk
8
9
  } from './hierarchy.js';
9
10
 
10
11
  /** @typedef {import('./hierarchy.js').TreeNode} TreeNode */
12
+ /** @typedef {import('../../internal/row-actions.js').RowAction} RowAction */
11
13
  /**
12
14
  * @typedef {Object} TreeOptions
13
15
  * @property {TreeNode[]} [items=[]] Nested nodes.
@@ -21,6 +23,13 @@ import {
21
23
  * @property {unknown[]} [checked=[]] Initially checked node IDs.
22
24
  * @property {boolean} [icons=true] Whether to render folder and file icons.
23
25
  * @property {((node: TreeNode) => Node|string)|null} [renderLabel=null] Label renderer.
26
+ * @property {((node: TreeNode) => Array<RowAction|Node>)|null} [rowActions=null] A row's actions:
27
+ * `{icon, label, onSelect(node), disabled?, danger?}` descriptors, or nodes placed as given. They
28
+ * rest out of sight and show while the row is pointed at, focused or selected; one or two show
29
+ * as icon buttons, more fold after the first into a "More actions" menu. Every descriptor is also
30
+ * in the row's context menu, and the focused row's actions follow it in the Tab order.
31
+ * @property {string} [moreLabel='More actions'] Name of a row's overflow menu; every action name
32
+ * is followed by the row's name ("More actions: Q3 plan").
24
33
  * @property {((node: TreeNode) => Promise<TreeNode[]>|TreeNode[])|null} [load=null] Lazy child loader.
25
34
  * @property {string} [filter=''] Label substring the tree is filtered by.
26
35
  * @property {string} [label='Tree'] Accessible name of the tree.
@@ -66,6 +75,8 @@ export class TreeView extends Component {
66
75
  checked: [],
67
76
  icons: true,
68
77
  renderLabel: null,
78
+ rowActions: null,
79
+ moreLabel: 'More actions',
69
80
  load: null,
70
81
  filter: '',
71
82
  label: 'Tree',
@@ -85,6 +96,9 @@ export class TreeView extends Component {
85
96
  this._loading = new Map();
86
97
  this._focusId = null;
87
98
  this._filter = '';
99
+ /** @type {Array<import('../../internal/row-actions.js').RowActionStrip|undefined>} Per visible row. */
100
+ this._strips = [];
101
+ this._rowMenu = null;
88
102
  this._createdRoot = this.el === null;
89
103
  this._snapshot = this._createdRoot ? null : snapshotTarget(this.el);
90
104
 
@@ -131,6 +145,22 @@ export class TreeView extends Component {
131
145
  // Focusing the container hands focus straight to the active row.
132
146
  if (this._rows.length > 0 && !this._rowElement(this._focusId)) this._focusRow(0);
133
147
  });
148
+ // Focus arriving on a row's action makes that row the tree's tab stop, without moving focus.
149
+ this.listen(root, 'focusin', (event) => {
150
+ const strip = this._stripOf(event.target);
151
+ const row = strip ? this._rows[this._rowIndex(strip.closest('.zx-tree__row'))] : null;
152
+ if (row && !Object.is(row.id, this._focusId)) {
153
+ this._focusId = row.id;
154
+ this._syncRows();
155
+ }
156
+ });
157
+ if (typeof this.options.rowActions === 'function') {
158
+ this._rowMenu = rowActionMenu(root, '.zx-tree__row', (element) => {
159
+ const index = this._rowIndex(element);
160
+ const strip = this._strips[index];
161
+ return strip ? { actions: strip.actions, subject: this._subject(this._rows[index]) } : null;
162
+ });
163
+ }
134
164
 
135
165
  // Runs the same expansion logic as setFilter() so an initial filter behaves identically.
136
166
  if (String(this.options.filter ?? '') !== '') this.setFilter(this.options.filter);
@@ -409,21 +439,23 @@ export class TreeView extends Component {
409
439
  _renderRows() {
410
440
  const items = this._visibleItems();
411
441
  this._rows = flattenVisible(items, this._readers, this._expanded);
442
+ for (const strip of this._strips.splice(0)) strip?.destroy();
412
443
 
413
444
  if (this._rows.length === 0) {
414
445
  this.el.replaceChildren(h('div', { class: 'zx-tree__empty' },
415
446
  this._message('tree.empty', this.options.emptyText)));
416
447
  return;
417
448
  }
418
- this.el.replaceChildren(...this._rows.map((row) => this._renderRow(row)));
449
+ this.el.replaceChildren(...this._rows.map((row, index) => this._renderRow(row, index)));
419
450
  this._syncRows();
420
451
  }
421
452
 
422
453
  /**
423
454
  * @param {{node: TreeNode, id: unknown, level: number, posinset: number, setsize: number}} row Row spec.
455
+ * @param {number} index Visible position.
424
456
  * @returns {HTMLElement}
425
457
  */
426
- _renderRow(row) {
458
+ _renderRow(row, index) {
427
459
  const branch = isBranch(row.node, this._readers);
428
460
  const expanded = branch && this._expanded.has(row.id);
429
461
  const element = h('div', {
@@ -439,7 +471,7 @@ export class TreeView extends Component {
439
471
  element.style.setProperty('--zx-tree-level', String(row.level - 1));
440
472
 
441
473
  const twisty = h('span', { class: 'zx-tree__twisty', ariaHidden: 'true' },
442
- branch ? icon('chevron-right', { size: 12 }) : null);
474
+ branch ? icon('chevron-right', { size: ICON_SIZE.chevron }) : null);
443
475
  twisty.dataset.action = 'twisty';
444
476
  element.append(twisty);
445
477
 
@@ -462,10 +494,28 @@ export class TreeView extends Component {
462
494
  const content = this.options.renderLabel
463
495
  ? this.options.renderLabel(row.node)
464
496
  : this._readers.label(row.node);
465
- element.append(h('span', { class: 'zx-tree__label' }, content));
466
-
467
- if (row.node.badge != null) {
468
- element.append(h('span', { class: 'zx-tree__badge' }, String(row.node.badge)));
497
+ const label = h('span', { class: 'zx-tree__label' }, content);
498
+ element.append(label);
499
+
500
+ const badge = row.node.badge != null ? h('span', { class: 'zx-tree__badge' }, String(row.node.badge)) : null;
501
+ if (badge) element.append(badge);
502
+
503
+ const strip = typeof this.options.rowActions === 'function'
504
+ ? renderRowActions(this.options.rowActions(this._subject(row)), {
505
+ block: 'tree',
506
+ name: this._readers.label(row.node),
507
+ moreLabel: String(this.options.moreLabel ?? 'More actions'),
508
+ run: (action) => action.onSelect(this._subject(row))
509
+ })
510
+ : null;
511
+ if (strip) {
512
+ this._strips[index] = strip;
513
+ // The row keeps the name its label (and count) gives it; the action names stay out of it.
514
+ label.id = uid('zx-tree-label');
515
+ if (badge) badge.id = uid('zx-tree-badge');
516
+ element.setAttribute('aria-labelledby', badge ? `${label.id} ${badge.id}` : label.id);
517
+ element.setAttribute('data-zx-reveal-host', '');
518
+ element.append(strip.element);
469
519
  }
470
520
  return element;
471
521
  }
@@ -489,6 +539,8 @@ export class TreeView extends Component {
489
539
  element.toggleAttribute('data-branch', branch);
490
540
  element.toggleAttribute('data-loading', this._loading.has(row.id));
491
541
  element.tabIndex = index === focusIndex ? 0 : -1;
542
+ // The row holding the tab stop lends it to its actions: Tab walks them, then leaves the tree.
543
+ setRowActionsTabbable(this._strips[index]?.element, index === focusIndex);
492
544
 
493
545
  const box = /** @type {HTMLInputElement|null} */ (element.querySelector('.zx-tree__checkbox'));
494
546
  if (box) {
@@ -513,6 +565,15 @@ export class TreeView extends Component {
513
565
 
514
566
  /** @param {MouseEvent} event @returns {void} */
515
567
  _onClick(event) {
568
+ const strip = this._stripOf(event.target);
569
+ if (strip) {
570
+ // An action acts on its row; it neither selects nor focuses it.
571
+ const control = /** @type {HTMLElement|null} */ (/** @type {Element} */ (event.target).closest('[data-row-action]'));
572
+ const index = this._rowIndex(strip.closest('.zx-tree__row'));
573
+ const action = control ? this._strips[index]?.actions[Number(control.dataset.rowAction)] : null;
574
+ if (action && !action.disabled) action.onSelect(this._subject(this._rows[index]));
575
+ return;
576
+ }
516
577
  const element = /** @type {Element} */ (event.target).closest('.zx-tree__row');
517
578
  if (!element) return;
518
579
  const index = this._rowIndex(element);
@@ -540,6 +601,7 @@ export class TreeView extends Component {
540
601
 
541
602
  /** @param {MouseEvent} event @returns {void} */
542
603
  _onDoubleClick(event) {
604
+ if (this._stripOf(event.target)) return;
543
605
  const element = /** @type {Element} */ (event.target).closest('.zx-tree__row');
544
606
  if (!element) return;
545
607
  const row = this._rows[this._rowIndex(element)];
@@ -553,6 +615,9 @@ export class TreeView extends Component {
553
615
 
554
616
  /** @param {KeyboardEvent} event @returns {void} */
555
617
  _onKeydown(event) {
618
+ // Keys pressed on a row's action belong to that control: Enter runs it, the menu's arrows move
619
+ // through the menu, and nothing walks the tree.
620
+ if (this._stripOf(event.target)) return;
556
621
  const index = this._rows.findIndex((row) => Object.is(row.id, this._focusId));
557
622
  if (index < 0 || this._rows.length === 0) return;
558
623
  const row = this._rows[index];
@@ -716,7 +781,27 @@ export class TreeView extends Component {
716
781
  return [...this._rows.slice(from + 1), ...this._rows.slice(0, from + 1)];
717
782
  }
718
783
 
719
- /** @param {Element} element @returns {number} */
784
+ /**
785
+ * The action strip an event target sits in, if any.
786
+ * @param {EventTarget|null} target Event target.
787
+ * @returns {HTMLElement|null}
788
+ */
789
+ _stripOf(target) {
790
+ const element = target && /** @type {Node} */ (target).nodeType === 1 ? /** @type {Element} */ (target) : null;
791
+ const strip = /** @type {HTMLElement|null} */ (element?.closest('.zx-tree__actions') ?? null);
792
+ return strip && this.el.contains(strip) ? strip : null;
793
+ }
794
+
795
+ /**
796
+ * What a row's actions receive: the node in the working tree, not a filtered copy.
797
+ * @param {{node: TreeNode, id: unknown}|undefined} row Visible row.
798
+ * @returns {TreeNode|null}
799
+ */
800
+ _subject(row) {
801
+ return row ? this.getNode(row.id) ?? row.node : null;
802
+ }
803
+
804
+ /** @param {Element|null} element @returns {number} */
720
805
  _rowIndex(element) {
721
806
  return [...this.el.querySelectorAll('.zx-tree__row')].indexOf(element);
722
807
  }
@@ -754,6 +839,9 @@ export class TreeView extends Component {
754
839
  /** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
755
840
  destroy() {
756
841
  const root = this.el;
842
+ for (const strip of this._strips?.splice(0) ?? []) strip?.destroy();
843
+ this._rowMenu?.destroy();
844
+ this._rowMenu = null;
757
845
  super.destroy();
758
846
  if (!this._createdRoot && root) restoreTarget(root, this._snapshot);
759
847
  }
@@ -28,9 +28,12 @@
28
28
  min-block-size: calc(var(--zx-control-height) - var(--zx-space-2));
29
29
  max-inline-size: 100%;
30
30
  padding-inline: var(--zx-space-2);
31
- border: 1px solid var(--zx-color-border);
31
+ /* One fill, not a fill and a line: the edge stays, transparent, to keep the chip's size. */
32
+ border: 1px solid transparent;
32
33
  border-radius: var(--zx-radius-md);
33
- background: var(--zx-color-bg-muted);
34
+ /* A text-colour step, not the muted surface: it reads on the control's own fill in both themes,
35
+ where the hairline used to do the separating. */
36
+ background: color-mix(in srgb, var(--zx-color-text) 8%, transparent);
34
37
  color: var(--zx-color-text);
35
38
  cursor: grab;
36
39
  }
@@ -45,11 +48,14 @@
45
48
  text-wrap: nowrap;
46
49
  }
47
50
 
51
+ /* Stretched to the chip's line and held 1px in from it, so the hover fill sits 2px inside the chip
52
+ at top and bottom, however tall the control makes the chip. */
48
53
  .zx-value-list__remove {
49
54
  display: inline-grid;
55
+ align-self: stretch;
50
56
  place-items: center;
51
57
  min-inline-size: 1.25rem;
52
- min-block-size: 1.25rem;
58
+ margin-block: 1px;
53
59
  border-radius: var(--zx-radius-sm);
54
60
  color: var(--zx-color-text-muted);
55
61
  cursor: pointer;
@@ -64,7 +70,9 @@
64
70
  flex: 1 1 8rem;
65
71
  min-inline-size: 6rem;
66
72
  border: 0;
67
- background: inherit;
73
+ /* Nothing of its own: the control's fill is translucent in dark, and an inherited copy of it
74
+ would be painted over the original as a second, lighter box. */
75
+ background: none;
68
76
  box-shadow: none;
69
77
  }
70
78
 
@@ -106,3 +114,16 @@
106
114
  .zx-value-list[data-disabled="true"] .zx-value-list__remove {
107
115
  display: none;
108
116
  }
117
+
118
+ /* Someone who asked for more contrast, or whose colours are forced, gets the chip's edge back. */
119
+ @media (prefers-contrast: more) {
120
+ .zx-value-list__chip {
121
+ border-color: var(--zx-color-border-strong);
122
+ }
123
+ }
124
+
125
+ @media (forced-colors: active) {
126
+ .zx-value-list__chip {
127
+ border-color: CanvasText;
128
+ }
129
+ }
@@ -1,5 +1,6 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h } from '../../core/dom.js';
3
+ import { ICON_SIZE, icon } from '../../core/icons.js';
3
4
  import { printf } from '../../core/i18n.js';
4
5
  import { uid } from '../../core/util.js';
5
6
 
@@ -206,7 +207,7 @@ export class ValueList extends Component {
206
207
  class: 'zx-value-list__remove',
207
208
  dataset: { remove: '' },
208
209
  ariaHidden: 'true'
209
- }, '×') : null));
210
+ }, icon('x', { size: ICON_SIZE.chip })) : null));
210
211
  this._list.replaceChildren(...chips);
211
212
  if (focusIndex >= 0) chips[Math.min(focusIndex, chips.length - 1)]?.focus();
212
213
  }
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
  import { Component } from '../../core/component.js';
3
3
  import { h, resolveElement, restoreTarget, snapshotTarget } from '../../core/dom.js';
4
- import { icon } from '../../core/icons.js';
4
+ import { ICON_SIZE, icon } from '../../core/icons.js';
5
5
  import { printf } from '../../core/i18n.js';
6
6
  import { sortRows } from '../table/sort.js';
7
7
 
@@ -784,14 +784,14 @@ export class RecordView extends Component {
784
784
  ariaLabel: this._message('recordView.moveFieldUp', 'Move %1 up', field.label),
785
785
  disabled: index === 0,
786
786
  dataset: { viewFieldAction: 'up', fieldId: field.id }
787
- }, icon('chevron-up', { size: 11 }));
787
+ }, icon('chevron-up', { size: ICON_SIZE.chevron }));
788
788
  const down = h('button', {
789
789
  class: 'zx-record-view__field-move',
790
790
  type: 'button',
791
791
  ariaLabel: this._message('recordView.moveFieldDown', 'Move %1 down', field.label),
792
792
  disabled: index === fields.length - 1,
793
793
  dataset: { viewFieldAction: 'down', fieldId: field.id }
794
- }, icon('chevron-down', { size: 11 }));
794
+ }, icon('chevron-down', { size: ICON_SIZE.chevron }));
795
795
  return h('div', { class: 'zx-record-view__field-option' },
796
796
  h('label', {}, toggle, h('span', {}, field.label)),
797
797
  h('span', { class: 'zx-record-view__field-order' }, up, down));
@@ -160,7 +160,8 @@ button.zx-view-settings__handle {
160
160
  flex: none;
161
161
  place-items: center;
162
162
  inline-size: var(--zx-control-height);
163
- color: var(--zx-color-text-placeholder);
163
+ /* An icon that says something (the field cannot be hidden): the subtle icon role, at 3:1. */
164
+ color: var(--zx-color-text-subtle);
164
165
  }
165
166
 
166
167
  .zx-view-settings__add {
@@ -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
  import { APP_ICON_TONES, appIcon } from '../app-icon/app-icon.js';
6
6
  import { avatarInitials, avatarTone } from '../avatar/avatar.js';
7
7
  import { MenuButton } from '../menu-button/menu-button.js';
@@ -124,7 +124,7 @@ export class WorkspaceSwitcher extends Component {
124
124
  h('span', { class: 'zx-workspace-switcher__text' },
125
125
  h('span', { ref: 'name', class: 'zx-workspace-switcher__name' }),
126
126
  h('span', { ref: 'secondary', class: 'zx-workspace-switcher__secondary' })),
127
- h('span', { class: 'zx-workspace-switcher__chevron', ariaHidden: 'true' }, icon('chevron-down'))));
127
+ h('span', { class: 'zx-workspace-switcher__chevron', ariaHidden: 'true' }, icon('chevron-down', { size: ICON_SIZE.chevron }))));
128
128
  return root;
129
129
  }
130
130
 
@@ -269,7 +269,7 @@ export class WorkspaceSwitcher extends Component {
269
269
  description: workspace.secondary || undefined,
270
270
  badge: workspace.badge ?? undefined,
271
271
  disabled: workspace.disabled,
272
- adornment: h('span', { class: 'zx-workspace-switcher__check', ariaHidden: 'true' }, icon('check'))
272
+ adornment: h('span', { class: 'zx-workspace-switcher__check', ariaHidden: 'true' }, icon('check', { size: ICON_SIZE.check }))
273
273
  };
274
274
  this._entries.set(entry, workspace);
275
275
  rows.push([entries.length, workspace]);
package/src/core/icons.js CHANGED
@@ -15,9 +15,38 @@ import { faIconClasses, kitUrl, loadFontAwesomeKit, parseIconSpec } from './font
15
15
 
16
16
  const SVG_NS = 'http://www.w3.org/2000/svg';
17
17
 
18
+ /**
19
+ * Icon sizes in CSS pixels, named by the role an icon plays rather than by its measure, so a call
20
+ * site says what a glyph is for and every glyph in that role renders at one size:
21
+ *
22
+ * icon('chevron-down', { size: ICON_SIZE.chevron });
23
+ *
24
+ * Several roles share a value; they are named apart so one can change without a sweep. At 14px and
25
+ * below an outline glyph is drawn with a one-pixel line, so the roles that share 14 also share a
26
+ * stroke weight.
27
+ * @type {Readonly<{control: number, chevron: number, dismiss: number, check: number, sort: number,
28
+ * chip: number, marker: number}>}
29
+ */
30
+ export const ICON_SIZE = Object.freeze({
31
+ /** The default: an icon that is a control's content or leads its label. */
32
+ control: 16,
33
+ /** Dropdown, disclosure, and reorder chevrons; calendar and pager arrows; breadcrumb separators. */
34
+ chevron: 14,
35
+ /** The × that clears a field, closes a tab, dialog, or message, or removes a row. */
36
+ dismiss: 14,
37
+ /** The check of a selected option, a pressed toggle button, or a completed step. */
38
+ check: 14,
39
+ /** The sort-direction arrow beside a column heading. */
40
+ sort: 14,
41
+ /** Any glyph inside a chip or token, its remove × included. */
42
+ chip: 12,
43
+ /** A glyph drawn inside a small status marker. */
44
+ marker: 8
45
+ });
46
+
18
47
  /**
19
48
  * @typedef {Object} IconOptions
20
- * @property {number|string} [size=16] Rendered width and height.
49
+ * @property {number|string} [size=16] Rendered width and height; `ICON_SIZE` names one per role.
21
50
  * @property {string|null} [label=null] Accessible label; null marks the icon decorative.
22
51
  * @property {string|string[]} [class] Extra class names added to the element.
23
52
  * @property {string} [style] Font Awesome style for this icon only (`'solid'`, `'duotone'`, …).
@@ -126,6 +155,8 @@ export const icons = Object.freeze({
126
155
  // <lucide-glyphs>
127
156
  'arrow-up-wide-short': outline('M3 8l4-4 4 4M7 4v16M11 12h10M11 16h7M11 20h4'), // arrow-up-wide-narrow
128
157
  'arrow-down-wide-short': outline('M3 16l4 4 4-4M7 20V4M11 4h10M11 8h7M11 12h4'), // arrow-down-wide-narrow
158
+ 'arrow-up': outline('M5 12l7-7 7 7M12 19V5'),
159
+ 'arrow-down': outline('M12 5v14M19 12l-7 7-7-7'),
129
160
  'chevron-down': outline('M6 9l6 6 6-6'),
130
161
  'chevron-up': outline('M18 15l-6-6-6 6'),
131
162
  'chevron-left': outline('M15 18l-6-6 6-6'),
@@ -376,7 +407,7 @@ function builtinIcon(name, options) {
376
407
  * @returns {SVGSVGElement}
377
408
  */
378
409
  function iconSvg(viewBox, paint, options) {
379
- const { size = 16 } = options;
410
+ const { size = ICON_SIZE.control } = options;
380
411
  const svg = document.createElementNS(SVG_NS, 'svg');
381
412
  svg.setAttribute('class', classList('zx-icon', options.class));
382
413
  svg.setAttribute('viewBox', viewBox);
@@ -462,7 +493,7 @@ function warnMissingIcon(name) {
462
493
  * @returns {HTMLElement}
463
494
  */
464
495
  function faIcon(classes, options) {
465
- const { size = 16 } = options;
496
+ const { size = ICON_SIZE.control } = options;
466
497
  const element = document.createElement('i');
467
498
  element.className = classList('zx-icon', ...classes, options.class);
468
499
  element.style.fontSize = typeof size === 'number' ? `${size}px` : String(size);
@@ -24,6 +24,47 @@ export const defaultMessages = Object.freeze({
24
24
  'activityItem.pending': 'Sending…',
25
25
  'activityItem.untitled': 'activity',
26
26
 
27
+ 'agent.activity.blocked': 'Blocked',
28
+ 'agent.activity.idle': 'Idle',
29
+ 'agent.activity.needsYou': 'Needs you',
30
+ 'agent.activity.offline': 'Offline',
31
+ 'agent.activity.thinking': 'Thinking',
32
+ 'agent.activity.working': 'Working',
33
+ 'agent.status.done': 'Done',
34
+ 'agent.status.failed': 'Failed',
35
+ 'agent.status.paused': 'Paused',
36
+ 'agent.status.queued': 'Not started',
37
+ 'agent.status.running': 'Running',
38
+ 'agent.status.skipped': 'Skipped',
39
+ 'agent.status.stopped': 'Stopped',
40
+ 'agent.status.waiting': 'Waiting for you',
41
+ 'agent.status.blocked': 'Blocked',
42
+
43
+ 'agentThread.agent': 'Agent',
44
+ 'agentThread.answered': '%1 answered',
45
+ 'agentThread.attachments': 'Attachments',
46
+ 'agentThread.branch': 'Branch into a new conversation',
47
+ 'agentThread.copy': 'Copy answer',
48
+ 'agentThread.label': 'Conversation',
49
+ 'agentThread.latest': 'Jump to latest',
50
+ 'agentThread.needsApproval': '%1 needs your approval',
51
+ 'agentThread.nextVersion': 'Next version',
52
+ 'agentThread.previousVersion': 'Previous version',
53
+ 'agentThread.rateDown': 'Not helpful',
54
+ 'agentThread.rateUp': 'Helpful',
55
+ 'agentThread.regenerate': 'Regenerate answer',
56
+ 'agentThread.sources': 'Sources',
57
+ 'agentThread.stopped': 'Stopped',
58
+ 'agentThread.stoppedAnnounce': 'Stopped',
59
+ 'agentThread.version': 'Version %1 of %2',
60
+ 'agentThread.via': 'via %1',
61
+ 'agentThread.working': '%1 is working',
62
+ 'agentThread.writing': '%1 is writing an answer',
63
+ 'agentThread.you': 'You',
64
+ 'agentThread.writingNow': '%1 is writing…',
65
+ 'agentThread.edit': 'Edit message',
66
+ 'agentThread.copyMessage': 'Copy message',
67
+
27
68
  'appRail.subNavigation': '%1 sub-navigation',
28
69
 
29
70
  'appSidebar.expand': 'Expand application sidebar',
@@ -34,6 +75,44 @@ export const defaultMessages = Object.freeze({
34
75
  'appSidebar.presentationCompact': 'Module menu collapsed',
35
76
  'appSidebar.presentationExpanded': 'Both menus expanded',
36
77
 
78
+ 'approvalCard.approve': 'Approve',
79
+ 'approvalCard.approvedBy': 'Approved by %1 at %2',
80
+ 'approvalCard.approvedByUndated': 'Approved by %1',
81
+ 'approvalCard.cancel': 'Cancel',
82
+ 'approvalCard.edit': 'Edit',
83
+ 'approvalCard.editTitle': 'Edit the request',
84
+ 'approvalCard.editedBy': 'Edited by %1',
85
+ 'approvalCard.expiredAt': 'Expired at %1',
86
+ 'approvalCard.expiredUndated': 'Expired without an answer',
87
+ 'approvalCard.paused': 'The run is paused until you answer.',
88
+ 'approvalCard.preview': 'Preview',
89
+ 'approvalCard.reason': 'Reason',
90
+ 'approvalCard.reasonLabel': 'Why not?',
91
+ 'approvalCard.reasonMissing': 'Say why, so the agent can do better next time.',
92
+ 'approvalCard.reasonOptional': 'Optional. Your reason stays with the request.',
93
+ 'approvalCard.reasonRequired': 'Your reason stays with the request.',
94
+ 'approvalCard.reject': 'Reject',
95
+ 'approvalCard.rejectTitle': 'Reject the request?',
96
+ 'approvalCard.rejectedBy': 'Rejected by %1 at %2',
97
+ 'approvalCard.rejectedByUndated': 'Rejected by %1',
98
+ 'approvalCard.required': 'Fill this in to save.',
99
+ 'approvalCard.save': 'Save changes',
100
+ 'approvalCard.status.approved': 'Approved',
101
+ 'approvalCard.status.expired': 'Expired',
102
+ 'approvalCard.status.pending': 'Waiting for you',
103
+ 'approvalCard.status.rejected': 'Rejected',
104
+ 'approvalCard.you': 'you',
105
+
106
+ 'blockView.cite': 'Source %1',
107
+ 'blockView.citeTitled': 'Source %1: %2',
108
+ 'blockView.code': 'Code',
109
+ 'blockView.copyCode': 'Copy code',
110
+ 'blockView.document': 'Document',
111
+ 'blockView.stopped': 'Stopped here.',
112
+ 'blockView.table': 'Table',
113
+ 'blockView.version': '1 version',
114
+ 'blockView.versions': '%1 versions',
115
+
37
116
  'breadcrumb.label': 'Breadcrumb',
38
117
  'breadcrumb.more': 'Show hidden levels',
39
118
 
@@ -77,6 +156,20 @@ export const defaultMessages = Object.freeze({
77
156
  'checklist.label': 'Checklist',
78
157
  'checklist.search': 'Search',
79
158
 
159
+ 'composer.attach': 'Attach files',
160
+ 'composer.attachments': 'Attachments',
161
+ 'composer.commands': 'Commands',
162
+ 'composer.commandsPlaceholder': 'Search commands',
163
+ 'composer.context': 'Context',
164
+ 'composer.drop': 'Drop files to attach',
165
+ 'composer.label': 'Message',
166
+ 'composer.match': '1 suggestion',
167
+ 'composer.matches': '%1 suggestions',
168
+ 'composer.remove': 'Remove %1',
169
+ 'composer.send': 'Send',
170
+ 'composer.stop': 'Stop',
171
+ 'composer.suggestions': 'Suggestions',
172
+
80
173
  'dataFilter.all': 'All',
81
174
  'dataFilter.clear': 'Clear',
82
175
 
@@ -277,6 +370,53 @@ export const defaultMessages = Object.freeze({
277
370
  'recordView.moveFieldDown': 'Move %1 down',
278
371
  'recordView.moveFieldUp': 'Move %1 up',
279
372
 
373
+ 'runStatus.cost': '%1 of %2',
374
+ 'runStatus.costLabel': 'Cost',
375
+ 'runStatus.dateTimeFormat': '%e %b, %H:%M',
376
+ 'runStatus.failedAt': 'Failed at',
377
+ 'runStatus.finished': 'Finished',
378
+ 'runStatus.model': 'Model',
379
+ 'runStatus.started': 'Started',
380
+ 'runStatus.steps': '%1 of %2 steps',
381
+ 'runStatus.stepsLabel': 'Steps done',
382
+ 'runStatus.stoppedAt': 'Stopped at',
383
+ 'runStatus.timeFormat': '%H:%M',
384
+ 'runStatus.tokens': 'Tokens',
385
+ 'runStatus.tokensValue': '%1 in · %2 out',
386
+ 'runStatus.waitingSince': 'Waiting since',
387
+ 'runStatus.workingTime': 'Working time',
388
+ 'runStatus.blockedSince': 'Blocked since',
389
+ 'runStatus.tokenBudget': '%1 of %2 tokens',
390
+
391
+ 'runTrace.arguments': 'Arguments',
392
+ 'runTrace.awaiting': 'Waiting for the result…',
393
+ 'runTrace.call': '1 tool call',
394
+ 'runTrace.calls': '%1 tool calls',
395
+ 'runTrace.copied': 'Copied',
396
+ 'runTrace.copyArguments': 'Copy arguments',
397
+ 'runTrace.copyError': 'Copy error',
398
+ 'runTrace.copyResult': 'Copy result',
399
+ 'runTrace.doing': '%1…',
400
+ 'runTrace.error': 'Error',
401
+ 'runTrace.failedAfter': 'Failed after %1',
402
+ 'runTrace.handoff': '%1 handed over to %2',
403
+ 'runTrace.label': 'Steps',
404
+ 'runTrace.result': 'Result',
405
+ 'runTrace.retried': 'Retried',
406
+ 'runTrace.retries': '%1 retries',
407
+ 'runTrace.retry': '1 retry',
408
+ 'runTrace.showAll': 'Show all',
409
+ 'runTrace.source': '1 source',
410
+ 'runTrace.sources': '%1 sources',
411
+ 'runTrace.step': '1 step',
412
+ 'runTrace.steps': '%1 steps',
413
+ 'runTrace.stoppedAfter': 'Stopped after %1',
414
+ 'runTrace.worked': 'Worked for %1',
415
+ 'runTrace.working': 'Working…',
416
+ 'runTrace.blockedAfter': 'Blocked after %1',
417
+ 'runTrace.token': '1 token',
418
+ 'runTrace.tokens': '%1 tokens',
419
+
280
420
  'search.clear': 'Clear search',
281
421
  'search.label': 'Search',
282
422
  'search.submit': 'Submit search',
@@ -290,6 +430,9 @@ export const defaultMessages = Object.freeze({
290
430
 
291
431
  'sheet.resize': 'Resize sheet',
292
432
 
433
+ 'sourceList.label': 'Sources',
434
+ 'sourceList.source': 'Source',
435
+
293
436
  'statTile.down': 'down %1',
294
437
  'statTile.loading': 'Loading',
295
438
  'statTile.unchanged': 'no change',
@@ -88,6 +88,7 @@ const CHECKLIST_ATTRS = attributes({
88
88
 
89
89
  const DATEBOX_ATTRS = attributes({
90
90
  format: text({ default: '%d.%m.%Y', rebuild: true }),
91
+ 'display-format': text({ property: 'displayFormat', default: null, rebuild: true }),
91
92
  time: bool({ always: true, rebuild: true }),
92
93
  value: text({ option: null, default: null, normalize: normalizeDateValue, set: (component, value) => component.set(value, { silent: true }), get: (component, host) => dateValue(component.get(), Boolean(host.time)), serialize: serializeDateValue }),
93
94
  placeholder: text({ default: null, rebuild: true }),
package/src/index.js CHANGED
@@ -60,7 +60,7 @@ export {
60
60
  formatDate, parseDate, clampDate, isSameDay, addDays, addMonths, getWeekStart
61
61
  } from './core/date.js';
62
62
  export {
63
- icon, icons, iconNames, registerIcons,
63
+ icon, icons, iconNames, registerIcons, ICON_SIZE,
64
64
  configureIcons, getIconConfig, useFontAwesome, useBuiltinIcons, loadFontAwesome
65
65
  } from './core/icons.js';
66
66
  export {
@@ -78,6 +78,7 @@ export { toCsv, downloadBlob, copyToClipboard } from './core/export.js';
78
78
  export { defineElements } from './elements/define.js';
79
79
  export { button, buttonGroup, setButtonBusy } from './components/button/button.js';
80
80
  export { BADGE_TONES, badge, badgeGroup } from './components/badge/badge.js';
81
+ export { kbd, keyLabels } from './components/kbd/kbd.js';
81
82
  export { CheckButton } from './components/check-button/check-button.js';
82
83
  export { emptyState } from './components/empty-state/empty-state.js';
83
84
  export { spinner } from './components/loading/spinner.js';
@@ -88,6 +89,7 @@ export { stack, grid, aspect } from './components/layout/layout.js';
88
89
  export { truncate, isTruncated } from './components/truncate/truncate.js';
89
90
  export { copyButton } from './components/copy/copy-button.js';
90
91
  export { CopyInput } from './components/copy/copy-input.js';
92
+ export { proseAnchors, sectionHref } from './components/prose/prose.js';
91
93
  export { CodeEditor, indentSelection, editorPosition } from './components/code-editor/code-editor.js';
92
94
  export { Toolbar } from './components/toolbar/toolbar.js';
93
95
  export { Toggle } from './components/toggle/toggle.js';
@@ -122,6 +124,14 @@ export {
122
124
  export {
123
125
  ActivityList, groupActivityItems, normalizeActivityItems
124
126
  } from './components/activity-list/activity-list.js';
127
+ export { BlockView, renderBlocks } from './components/block-view/block-view.js';
128
+ export { blocksToMarkdown, blocksToText } from './internal/agent-model.js';
129
+ export { RunStatus } from './components/run-status/run-status.js';
130
+ export { Composer } from './components/composer/composer.js';
131
+ export { ApprovalCard } from './components/approval-card/approval-card.js';
132
+ export { RunTrace } from './components/run-trace/run-trace.js';
133
+ export { SourceList } from './components/source-list/source-list.js';
134
+ export { AgentThread } from './components/agent-thread/agent-thread.js';
125
135
  export { AccountMenu } from './components/account-menu/account-menu.js';
126
136
  export { WorkspaceSwitcher } from './components/workspace-switcher/workspace-switcher.js';
127
137
  export { normalizeAppItems } from './internal/app-rail.js';
@@ -146,7 +156,7 @@ export { Slider, stepPrecision } from './components/slider/slider.js';
146
156
  export { DatePicker } from './components/date-picker/date-picker.js';
147
157
  export { MonthPicker } from './components/date-picker/month-picker.js';
148
158
  export { TimePicker } from './components/date-picker/time-picker.js';
149
- export { Datebox, DateTimeBox } from './components/datebox/datebox.js';
159
+ export { Datebox, DateTimeBox, dateboxFormats } from './components/datebox/datebox.js';
150
160
  export {
151
161
  DateRangePicker, clampRange, defaultDateRangePresets, normalizeRange, rangeNights, rangeStateOf
152
162
  } from './components/date-picker/date-range-picker.js';