@zeyos/zx 5.5.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 (48) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
  3. package/dist/types/components/approval-card/approval-card.d.ts +596 -0
  4. package/dist/types/components/avatar/avatar.d.ts +91 -4
  5. package/dist/types/components/block-view/block-view.d.ts +205 -0
  6. package/dist/types/components/composer/composer.d.ts +736 -0
  7. package/dist/types/components/run-status/run-status.d.ts +393 -0
  8. package/dist/types/components/run-trace/run-trace.d.ts +624 -0
  9. package/dist/types/components/source-list/source-list.d.ts +177 -0
  10. package/dist/types/core/messages.d.ts +135 -0
  11. package/dist/types/index.d.ts +8 -0
  12. package/dist/types/internal/agent-model.d.ts +587 -0
  13. package/dist/types/internal/highlight.d.ts +24 -0
  14. package/dist/types/internal/presence-loop.d.ts +148 -0
  15. package/dist/zx-zeyos.esm.js +4648 -4513
  16. package/dist/zx-zeyos.esm.min.js +2 -2
  17. package/dist/zx.css +1927 -1
  18. package/dist/zx.esm.js +15769 -9194
  19. package/dist/zx.esm.min.js +27 -8
  20. package/dist/zx.global.js +15769 -9194
  21. package/dist/zx.global.min.js +27 -8
  22. package/dist/zx.min.css +1 -1
  23. package/docs/api.json +1166 -5
  24. package/docs/llms.md +455 -2
  25. package/docs/llms.txt +10 -1
  26. package/package.json +1 -1
  27. package/src/components/agent-thread/agent-thread.css +417 -0
  28. package/src/components/agent-thread/agent-thread.js +1365 -0
  29. package/src/components/approval-card/approval-card.css +289 -0
  30. package/src/components/approval-card/approval-card.js +1377 -0
  31. package/src/components/avatar/avatar.css +56 -1
  32. package/src/components/avatar/avatar.js +148 -26
  33. package/src/components/block-view/block-view.css +300 -0
  34. package/src/components/block-view/block-view.js +523 -0
  35. package/src/components/composer/composer.css +403 -0
  36. package/src/components/composer/composer.js +1441 -0
  37. package/src/components/run-status/run-status.css +208 -0
  38. package/src/components/run-status/run-status.js +782 -0
  39. package/src/components/run-trace/run-trace.css +443 -0
  40. package/src/components/run-trace/run-trace.js +1209 -0
  41. package/src/components/source-list/source-list.css +208 -0
  42. package/src/components/source-list/source-list.js +355 -0
  43. package/src/core/messages.js +143 -0
  44. package/src/index.js +8 -0
  45. package/src/internal/agent-model.js +488 -0
  46. package/src/internal/highlight.js +104 -0
  47. package/src/internal/presence-loop.js +343 -0
  48. package/styles/zx.css +7 -0
@@ -47,7 +47,8 @@
47
47
 
48
48
  .zx-avatar__image[hidden],
49
49
  .zx-avatar__fallback[hidden],
50
- .zx-avatar__status[hidden] {
50
+ .zx-avatar__status[hidden],
51
+ .zx-avatar__activity[hidden] {
51
52
  display: none;
52
53
  }
53
54
 
@@ -80,7 +81,61 @@
80
81
  .zx-avatar__status[data-status="away"] { background: var(--zx-color-warning); }
81
82
  .zx-avatar__status[data-status="busy"] { background: var(--zx-color-danger); }
82
83
 
84
+ /*
85
+ * An agent's activity. Each one is a shape as well as a tone, so it reads where the colour does
86
+ * not: a solid dot for working, thinking and needs-you, a square for blocked, a hollow ring for
87
+ * idle, and a dashed ring for offline. The outline cuts the dot out of the avatar it sits on.
88
+ */
89
+ .zx-avatar__activity {
90
+ position: absolute;
91
+ inset-inline-end: 0;
92
+ inset-block-end: 0;
93
+ box-sizing: border-box;
94
+ inline-size: max(8px, calc(var(--zx-avatar-size) * .3));
95
+ block-size: max(8px, calc(var(--zx-avatar-size) * .3));
96
+ border-radius: 50%;
97
+ outline: 2px solid var(--zx-color-bg-raised);
98
+ background: var(--zx-color-text-muted);
99
+ }
100
+
101
+ .zx-avatar[data-activity="working"] > .zx-avatar__activity { background: var(--zx-color-success); }
102
+ .zx-avatar[data-activity="thinking"] > .zx-avatar__activity { background: var(--zx-color-info); }
103
+ .zx-avatar[data-activity="needs-you"] > .zx-avatar__activity { background: var(--zx-color-warning); }
104
+
105
+ /* A square, whatever the theme's radius: the shape is the signal. */
106
+ .zx-avatar[data-activity="blocked"] > .zx-avatar__activity {
107
+ border-radius: 15%;
108
+ background: var(--zx-color-danger);
109
+ }
110
+
111
+ .zx-avatar[data-activity="idle"] > .zx-avatar__activity {
112
+ border: 1.5px solid var(--zx-color-text-muted);
113
+ background: var(--zx-color-bg-raised);
114
+ }
115
+
116
+ .zx-avatar[data-activity="offline"] > .zx-avatar__activity {
117
+ border: 1.5px dashed var(--zx-color-text-subtle);
118
+ background: var(--zx-color-bg-raised);
119
+ }
120
+
121
+ /* An animated avatar pivots low, the way a head nods; the shared loop writes only `transform`. */
122
+ .zx-avatar[data-animate] {
123
+ transform-origin: 50% 75%;
124
+ }
125
+
126
+ @media (prefers-reduced-motion: no-preference) {
127
+ .zx-avatar[data-animate] {
128
+ will-change: transform;
129
+ }
130
+ }
131
+
83
132
  /* Forced colours drop the tint; a system-coloured edge keeps the fallback a shape. */
84
133
  @media (forced-colors: active) {
85
134
  .zx-avatar__fallback { border: 1px solid CanvasText; }
135
+ .zx-avatar[data-activity] > .zx-avatar__activity { background: CanvasText; }
136
+
137
+ .zx-avatar:is([data-activity="idle"], [data-activity="offline"]) > .zx-avatar__activity {
138
+ border-color: CanvasText;
139
+ background: Canvas;
140
+ }
86
141
  }
@@ -1,11 +1,16 @@
1
+ // @ts-check
1
2
  import { Component } from '../../core/component.js';
2
3
  import { h } from '../../core/dom.js';
4
+ import { ACTIVITY, AGENT_MESSAGES, normalizeActivity } from '../../internal/agent-model.js';
5
+ import { normalizePhase, presencePhase, trackPresence } from '../../internal/presence-loop.js';
3
6
 
4
7
  /**
5
8
  * A categorical tone from the design system's tone palette (`--zx-color-tone-*`).
6
9
  * @typedef {'blue'|'teal'|'green'|'amber'|'orange'|'red'|'pink'|'violet'|'slate'} AvatarTone
7
10
  */
8
11
 
12
+ /** @typedef {import('../../internal/agent-model.js').AgentActivity} AgentActivity */
13
+
9
14
  /**
10
15
  * @typedef {Object} AvatarOptions
11
16
  * @property {string|null} [src=null] Image URL.
@@ -18,8 +23,28 @@ import { h } from '../../core/dom.js';
18
23
  * @property {AvatarTone|null} [tone=null] Fallback colour from the tone palette. `null` derives a
19
24
  * stable tone from the name (or the initials when there is no name), so the same person gets the
20
25
  * same colour on every screen; see {@link avatarTone}.
21
- * @property {'online'|'away'|'busy'|'offline'|null} [status=null] Optional presence state.
26
+ * @property {'online'|'away'|'busy'|'offline'|null} [status=null] Optional presence state of a
27
+ * person. An agent's `activity` takes its place: when both are given, only the activity is drawn
28
+ * and named.
22
29
  * @property {string|null} [statusLabel=null] Text alternative for the presence state.
30
+ * @property {AgentActivity|null} [activity=null] What an agent is doing: `'idle'`, `'thinking'`,
31
+ * `'working'`, `'needs-you'`, `'blocked'` or `'offline'`. Drawn as a dot whose shape and tone
32
+ * differ per activity (a square for blocked, a hollow ring for idle, a dashed ring for offline);
33
+ * its word joins the accessible name and the dot's tooltip. Wins over `status`.
34
+ * @property {string|null} [activityLabel=null] The activity's word, when the default ("Working",
35
+ * "Needs you", …) is not the one to show.
36
+ * @property {boolean} [animate=false] Moves the avatar with its activity — idle breathes, thinking
37
+ * sways, working bobs, needs-you leans and blinks — in the one animation loop every animated
38
+ * avatar on the page shares. Motion is never the only signal, stops off screen and while the page
39
+ * is hidden, and returns the avatar to rest under reduced motion (the system's, or a
40
+ * `data-zx-motion="reduced"` region). While it is on, the root's `transform` belongs to the loop.
41
+ * @property {number|null} [phase=null] Where in its activity's cycle the avatar moves, as a
42
+ * fraction from 0 up to 1 (whole turns wrap): two avatars of the same agent on one screen — a
43
+ * roster and an inspector — at different phases never move in step, and 0.5 puts them half a cycle
44
+ * apart. `null` derives the phase from the name (or the initials), so the same agent always moves
45
+ * the same way.
46
+ * @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized
47
+ * messages: the activity words, `agent.activity.<activity>`.
23
48
  */
24
49
 
25
50
  /**
@@ -36,9 +61,16 @@ const HASHED_TONES = Object.freeze(AVATAR_TONES.filter((tone) => tone !== 'slate
36
61
  /** Below this rendered size the fallback has room for one initial, not two. */
37
62
  const SINGLE_INITIAL_BELOW = 24;
38
63
 
64
+ /** The presence states a person can have. */
65
+ const PRESENCE = Object.freeze(['online', 'away', 'busy', 'offline']);
66
+
67
+ /** The values `set()` accepts. */
68
+ const SETTABLE = Object.freeze(['src', 'name', 'initials', 'label', 'size', 'shape', 'tone', 'status', 'statusLabel',
69
+ 'activity', 'activityLabel', 'animate', 'phase']);
70
+
39
71
  /**
40
72
  * Stable-size user image with a deterministic fallback — initials on a tone picked from the name —
41
- * and an optional presence state.
73
+ * and an optional presence state for a person, or activity for an agent.
42
74
  * @extends {Component<AvatarOptions>}
43
75
  */
44
76
  export class Avatar extends Component {
@@ -54,7 +86,12 @@ export class Avatar extends Component {
54
86
  shape: 'circle',
55
87
  tone: null,
56
88
  status: null,
57
- statusLabel: null
89
+ statusLabel: null,
90
+ activity: null,
91
+ activityLabel: null,
92
+ animate: false,
93
+ phase: null,
94
+ msg: AGENT_MESSAGES
58
95
  };
59
96
 
60
97
  /** @returns {HTMLElement} */
@@ -75,8 +112,14 @@ export class Avatar extends Component {
75
112
  shape: this.options.shape,
76
113
  tone: this.options.tone,
77
114
  status: this.options.status,
78
- statusLabel: this.options.statusLabel
115
+ statusLabel: this.options.statusLabel,
116
+ activity: this.options.activity ?? null,
117
+ activityLabel: this.options.activityLabel ?? null,
118
+ animate: Boolean(this.options.animate),
119
+ phase: this.options.phase ?? null
79
120
  };
121
+ /** @type {import('../../internal/presence-loop.js').PresenceHandle|null} */
122
+ this._presence = null;
80
123
 
81
124
  const image = /** @type {HTMLImageElement} */ (h('img', {
82
125
  ref: 'image',
@@ -95,7 +138,13 @@ export class Avatar extends Component {
95
138
  ariaHidden: 'true',
96
139
  hidden: true
97
140
  });
98
- root.replaceChildren(image, fallback, status);
141
+ const activity = h('span', {
142
+ ref: 'activity',
143
+ class: 'zx-avatar__activity',
144
+ ariaHidden: 'true',
145
+ hidden: true
146
+ });
147
+ root.replaceChildren(image, fallback, status, activity);
99
148
  this.listen(image, 'load', () => {
100
149
  if (this._isCurrentImageSource()) this._showImage(true);
101
150
  });
@@ -107,14 +156,15 @@ export class Avatar extends Component {
107
156
  }
108
157
 
109
158
  /**
110
- * Replaces avatar identity and presentation values.
159
+ * Replaces avatar identity and presentation values: any option but `msg`, `phase` included, so
160
+ * an animated avatar can be moved out of step with another of the same agent while it runs.
111
161
  * @param {Partial<AvatarOptions>} values New values.
112
162
  * @returns {this}
113
163
  */
114
164
  set(values = {}) {
115
165
  if (!values || typeof values !== 'object') return this;
116
- for (const key of ['src', 'name', 'initials', 'label', 'size', 'shape', 'tone', 'status', 'statusLabel']) {
117
- if (Object.hasOwn(values, key)) this._state[key] = values[key];
166
+ for (const key of SETTABLE) {
167
+ if (Object.hasOwn(values, key)) this._state[key] = key === 'animate' ? Boolean(values[key]) : values[key];
118
168
  }
119
169
  this._sync();
120
170
  return this;
@@ -129,14 +179,36 @@ export class Avatar extends Component {
129
179
  return this;
130
180
  }
131
181
 
182
+ /**
183
+ * Sets what an agent is doing and, optionally, the word for it. `null` clears the activity, and
184
+ * a person's `status` shows again if one is set.
185
+ * @param {AgentActivity|null} activity
186
+ * @param {string|null} [label=null] The word, when the default is not the one to show.
187
+ * @returns {this}
188
+ */
189
+ setActivity(activity, label = null) {
190
+ this._state.activity = activity;
191
+ this._state.activityLabel = label;
192
+ this._syncLabel();
193
+ this._syncStatus();
194
+ return this;
195
+ }
196
+
197
+ /** @returns {AgentActivity|null} What the agent is doing, or null. */
198
+ getActivity() {
199
+ return normalizeActivity(this._state.activity);
200
+ }
201
+
132
202
  /** Returns whether the image is currently visible. @returns {boolean} */
133
203
  hasImage() {
134
- return !this.refs.image.hidden;
204
+ return !(/** @type {HTMLElement} */ (this.refs.image)).hidden;
135
205
  }
136
206
 
137
207
  /** Restores an enhanced target or removes an owned root. @returns {void} */
138
208
  destroy() {
139
209
  const original = this._original;
210
+ this._presence?.untrack();
211
+ this._presence = null;
140
212
  super.destroy();
141
213
  if (!this._createdRoot && original) {
142
214
  for (const attribute of Array.from(this.el.attributes)) this.el.removeAttribute(attribute.name);
@@ -147,13 +219,14 @@ export class Avatar extends Component {
147
219
 
148
220
  /** @returns {void} */
149
221
  _sync() {
150
- const { size, shape, label } = this._state;
151
- this.el.dataset.size = typeof size === 'string' ? size : 'custom';
152
- this.el.dataset.shape = ['circle', 'rounded', 'square'].includes(shape) ? shape : 'circle';
222
+ const root = /** @type {HTMLElement} */ (this.el);
223
+ const { size, shape } = this._state;
224
+ root.dataset.size = typeof size === 'string' ? size : 'custom';
225
+ root.dataset.shape = ['circle', 'rounded', 'square'].includes(shape) ? shape : 'circle';
153
226
  if (typeof size === 'number' && Number.isFinite(size)) {
154
- this.el.style.setProperty('--zx-avatar-size', `${Math.max(1, size)}px`);
227
+ root.style.setProperty('--zx-avatar-size', `${Math.max(1, size)}px`);
155
228
  } else {
156
- this.el.style.removeProperty('--zx-avatar-size');
229
+ root.style.removeProperty('--zx-avatar-size');
157
230
  }
158
231
  this._syncLabel();
159
232
  const name = String(this._state.name ?? '');
@@ -164,7 +237,7 @@ export class Avatar extends Component {
164
237
  const tone = AVATAR_TONES.includes(this._state.tone)
165
238
  ? this._state.tone
166
239
  : avatarTone(name.trim() ? name : this._state.initials);
167
- this.el.dataset.tone = tone;
240
+ root.dataset.tone = tone;
168
241
  const src = this._state.src == null ? '' : String(this._state.src).trim();
169
242
  if (src) {
170
243
  this.refs.image.setAttribute('src', src);
@@ -182,7 +255,8 @@ export class Avatar extends Component {
182
255
  _syncLabel() {
183
256
  const { label, status, statusLabel } = this._state;
184
257
  if (label) {
185
- const presence = ['online', 'away', 'busy', 'offline'].includes(status) ? statusLabel : null;
258
+ const word = this._activityWord();
259
+ const presence = word ?? (PRESENCE.includes(status) ? statusLabel : null);
186
260
  this.el.setAttribute('role', 'img');
187
261
  this.el.setAttribute('aria-label', [label, presence].filter(Boolean).join(', '));
188
262
  this.el.removeAttribute('aria-hidden');
@@ -195,9 +269,9 @@ export class Avatar extends Component {
195
269
 
196
270
  /** @param {boolean} visible @returns {void} */
197
271
  _showImage(visible) {
198
- this.refs.image.hidden = !visible;
199
- this.refs.fallback.hidden = visible;
200
- this.el.dataset.fallback = String(!visible);
272
+ (/** @type {HTMLElement} */ (this.refs.image)).hidden = !visible;
273
+ (/** @type {HTMLElement} */ (this.refs.fallback)).hidden = visible;
274
+ (/** @type {HTMLElement} */ (this.el)).dataset.fallback = String(!visible);
201
275
  }
202
276
 
203
277
  /** Ignores a late load/error from a source that has already been replaced. @returns {boolean} */
@@ -212,20 +286,68 @@ export class Avatar extends Component {
212
286
  }
213
287
  }
214
288
 
289
+ /** The word for the current activity, or null without one. @returns {string|null} */
290
+ _activityWord() {
291
+ const activity = normalizeActivity(this._state.activity);
292
+ if (!activity) return null;
293
+ return this._state.activityLabel ? String(this._state.activityLabel) : this.msg(ACTIVITY[activity].key);
294
+ }
295
+
215
296
  /** @returns {void} */
216
297
  _syncStatus() {
217
- const allowed = ['online', 'away', 'busy', 'offline'];
218
- const status = allowed.includes(this._state.status) ? this._state.status : null;
219
- this.refs.status.hidden = status === null;
220
- if (status) this.refs.status.dataset.status = status;
221
- else delete this.refs.status.dataset.status;
298
+ const root = /** @type {HTMLElement} */ (this.el);
299
+ const activity = normalizeActivity(this._state.activity);
300
+ const dot = /** @type {HTMLElement} */ (this.refs.activity);
301
+ dot.hidden = activity === null;
302
+ if (activity) {
303
+ root.dataset.activity = activity;
304
+ dot.setAttribute('title', String(this._activityWord()));
305
+ } else {
306
+ delete root.dataset.activity;
307
+ dot.removeAttribute('title');
308
+ }
309
+ this._syncMotion(activity);
310
+ const status = !activity && PRESENCE.includes(this._state.status) ? this._state.status : null;
311
+ const presence = /** @type {HTMLElement} */ (this.refs.status);
312
+ presence.hidden = status === null;
313
+ if (status) presence.dataset.status = status;
314
+ else delete presence.dataset.status;
222
315
  const label = this._state.statusLabel;
223
316
  if (label) {
224
- this.refs.status.setAttribute('title', String(label));
317
+ presence.setAttribute('title', String(label));
225
318
  } else {
226
- this.refs.status.removeAttribute('title');
319
+ presence.removeAttribute('title');
227
320
  }
228
321
  }
322
+
323
+ /**
324
+ * Joins, follows, or leaves the shared presence loop.
325
+ * @param {AgentActivity|null} activity
326
+ * @returns {void}
327
+ */
328
+ _syncMotion(activity) {
329
+ const root = /** @type {HTMLElement} */ (this.el);
330
+ const animate = Boolean(this._state.animate) && activity !== null;
331
+ if (animate) root.dataset.animate = '';
332
+ else delete root.dataset.animate;
333
+ if (!animate) {
334
+ this._presence?.untrack();
335
+ this._presence = null;
336
+ } else if (this._presence) {
337
+ this._presence.set(activity, { phase: this._phase() });
338
+ } else {
339
+ this._presence = trackPresence(root, activity, { phase: this._phase() });
340
+ }
341
+ }
342
+
343
+ /**
344
+ * The phase the avatar moves at: the `phase` option, or one derived from the name or initials.
345
+ * @returns {number} A fraction of the cycle.
346
+ */
347
+ _phase() {
348
+ const key = String(this._state.name ?? '') || String(this._state.initials ?? '');
349
+ return normalizePhase(this._state.phase) ?? presencePhase(key);
350
+ }
229
351
  }
230
352
 
231
353
  /**
@@ -0,0 +1,300 @@
1
+ /*
2
+ * BlockView — an answer an agent wrote. The root is `.zx-prose`, which sets the paragraphs,
3
+ * headings, lists, quotes, and tables; this sheet adds only what prose has no element for: code
4
+ * with its caption, figures, citations, artifact cards, and the line a stopped answer ends with.
5
+ */
6
+ .zx-block-view {
7
+ min-inline-size: 0;
8
+ overflow-wrap: anywhere;
9
+ }
10
+
11
+ .zx-block-view:empty {
12
+ display: none;
13
+ }
14
+
15
+ /* A single line break in model text is meant: an address, a sign-off. A blank line is a new
16
+ paragraph and never reaches here. */
17
+ .zx-block-view :is(p, li, td) {
18
+ white-space: pre-line;
19
+ }
20
+
21
+ /* ------------------------------------------------------------------ quote -- */
22
+
23
+ .zx-block-view__quote {
24
+ white-space: pre-line;
25
+ }
26
+
27
+ /* ------------------------------------------------------------------ code -- */
28
+
29
+ .zx-block-view__code {
30
+ position: relative;
31
+ display: block;
32
+ overflow: hidden;
33
+ margin-inline: 0;
34
+ border-radius: var(--zx-radius-md);
35
+ background: var(--zx-color-bg-muted);
36
+ }
37
+
38
+ .zx-block-view__code-head {
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: space-between;
42
+ gap: var(--zx-space-2);
43
+ padding: var(--zx-space-1) var(--zx-space-3);
44
+ }
45
+
46
+ .zx-block-view__code-language {
47
+ color: var(--zx-color-text-muted);
48
+ font-family: var(--zx-font-mono);
49
+ font-size: var(--zx-text-xs);
50
+ }
51
+
52
+ .zx-block-view .zx-block-view__pre {
53
+ margin: 0;
54
+ padding: 0 var(--zx-space-3) var(--zx-space-3);
55
+ border-radius: 0;
56
+ background: none;
57
+ overflow-wrap: normal;
58
+ }
59
+
60
+ /* Numbered lines (`lines: true`), for code read at length: a long line wraps a step deeper than
61
+ its own indent instead of scrolling, and the numbers are drawn by CSS, so copying the code takes
62
+ the code alone. */
63
+ .zx-block-view .zx-block-view__pre[data-lines] {
64
+ --zx-block-view-gutter: 3ch;
65
+ --zx-block-view-hang: 2ch;
66
+ padding-block-start: var(--zx-space-1);
67
+ counter-reset: zx-block-view-line;
68
+ overflow-wrap: anywhere;
69
+ white-space: pre-wrap;
70
+ }
71
+
72
+ .zx-block-view__line {
73
+ position: relative;
74
+ display: block;
75
+ min-block-size: 1lh;
76
+ padding-inline-start: calc(var(--zx-block-view-gutter) + var(--zx-space-3) + var(--zx-block-view-indent, 0ch) + var(--zx-block-view-hang));
77
+ text-indent: calc(-1 * (var(--zx-block-view-indent, 0ch) + var(--zx-block-view-hang)));
78
+ }
79
+
80
+ .zx-block-view__line::before {
81
+ content: counter(zx-block-view-line);
82
+ counter-increment: zx-block-view-line;
83
+ position: absolute;
84
+ inset-inline-start: 0;
85
+ inline-size: var(--zx-block-view-gutter);
86
+ color: var(--zx-color-text-subtle);
87
+ text-align: end;
88
+ text-indent: 0;
89
+ user-select: none;
90
+ }
91
+
92
+ .zx-block-view__pre:focus-visible {
93
+ outline-color: transparent;
94
+ box-shadow: inset var(--zx-focus-ring);
95
+ }
96
+
97
+ .zx-block-view__token[data-token="keyword"] { color: var(--zx-color-tone-violet-fg); }
98
+ .zx-block-view__token[data-token="string"] { color: var(--zx-color-tone-green-fg); }
99
+ .zx-block-view__token[data-token="number"] { color: var(--zx-color-tone-orange-fg); }
100
+ .zx-block-view__token[data-token="comment"] { color: var(--zx-color-text-muted); }
101
+
102
+ /* ------------------------------------------------------------------ table -- */
103
+
104
+ /* A wide table scrolls inside the answer; its cells keep their words whole. */
105
+ .zx-block-view__table {
106
+ overflow-x: auto;
107
+ overflow-wrap: normal;
108
+ }
109
+
110
+ .zx-block-view__table:focus-visible {
111
+ outline-color: transparent;
112
+ box-shadow: var(--zx-focus-ring);
113
+ }
114
+
115
+ .zx-block-view__table :is(th, td)[data-align="end"] {
116
+ text-align: end;
117
+ }
118
+
119
+ .zx-block-view__table :is(th, td)[data-align="center"] {
120
+ text-align: center;
121
+ }
122
+
123
+ .zx-block-view__table td {
124
+ font-variant-numeric: tabular-nums;
125
+ }
126
+
127
+ /* ------------------------------------------------------------------ figures -- */
128
+
129
+ .zx-block-view__figures {
130
+ display: grid;
131
+ /* The label keeps a readable width; a long detail wraps rather than squeezing it. */
132
+ grid-template-columns: minmax(min(12ch, 40%), 1fr) minmax(0, auto) auto;
133
+ margin-inline: 0;
134
+ font-size: var(--zx-text-sm);
135
+ font-variant-numeric: tabular-nums;
136
+ }
137
+
138
+ .zx-block-view__figure {
139
+ display: grid;
140
+ grid-column: 1 / -1;
141
+ grid-template-columns: subgrid;
142
+ align-items: baseline;
143
+ border-block-start: 1px solid var(--zx-color-border-subtle);
144
+ }
145
+
146
+ .zx-block-view__figure:first-child {
147
+ border-block-start: 0;
148
+ }
149
+
150
+ .zx-block-view__figure > :is(dt, dd) {
151
+ margin: 0;
152
+ padding-block: var(--zx-space-1);
153
+ }
154
+
155
+ .zx-block-view__figure-detail {
156
+ padding-inline-start: var(--zx-space-5);
157
+ color: var(--zx-color-text-muted);
158
+ text-align: end;
159
+ }
160
+
161
+ .zx-block-view__figure-value {
162
+ grid-column: 3;
163
+ padding-inline-start: var(--zx-space-5);
164
+ font-weight: var(--zx-weight-medium);
165
+ text-align: end;
166
+ }
167
+
168
+ /* ------------------------------------------------------------------ citations -- */
169
+
170
+ .zx-block-view__cite {
171
+ font-size: 0.7em;
172
+ line-height: 1;
173
+ vertical-align: 0.4em;
174
+ }
175
+
176
+ .zx-block-view__cite,
177
+ .zx-block-view__cite-button {
178
+ display: inline-block;
179
+ min-inline-size: 1.6em;
180
+ border-radius: var(--zx-radius-sm);
181
+ background: var(--zx-color-bg-muted);
182
+ color: var(--zx-color-text-muted);
183
+ font-weight: var(--zx-weight-medium);
184
+ font-variant-numeric: tabular-nums;
185
+ text-align: center;
186
+ }
187
+
188
+ .zx-block-view__cite:has(> .zx-block-view__cite-button) {
189
+ min-inline-size: 0;
190
+ background: none;
191
+ }
192
+
193
+ .zx-block-view__cite-button {
194
+ margin-inline-start: 1px;
195
+ padding: 0.15em 0.3em;
196
+ border: 0;
197
+ font: inherit;
198
+ font-weight: var(--zx-weight-medium);
199
+ line-height: 1.2;
200
+ cursor: pointer;
201
+ }
202
+
203
+ .zx-block-view__cite-button:hover {
204
+ background: var(--zx-color-bg-hover);
205
+ color: var(--zx-color-text);
206
+ }
207
+
208
+ .zx-block-view__cite-button:focus-visible {
209
+ outline-color: transparent;
210
+ box-shadow: var(--zx-focus-ring);
211
+ }
212
+
213
+ /* ------------------------------------------------------------------ artifacts -- */
214
+
215
+ .zx-block-view__artifact-row {
216
+ margin-inline: 0;
217
+ }
218
+
219
+ .zx-block-view__artifact {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: var(--zx-space-3);
223
+ inline-size: min(100%, 24rem);
224
+ padding: var(--zx-space-2) var(--zx-space-3);
225
+ padding-inline-start: var(--zx-space-2);
226
+ border: 1px solid var(--zx-color-border-subtle);
227
+ border-radius: var(--zx-radius-lg);
228
+ background: var(--zx-color-bg-surface);
229
+ color: inherit;
230
+ font: inherit;
231
+ font-size: var(--zx-text-sm);
232
+ text-align: start;
233
+ }
234
+
235
+ button.zx-block-view__artifact {
236
+ cursor: pointer;
237
+ }
238
+
239
+ button.zx-block-view__artifact:hover {
240
+ border-color: var(--zx-color-border);
241
+ background: var(--zx-color-bg-hover);
242
+ }
243
+
244
+ button.zx-block-view__artifact[aria-expanded="true"] {
245
+ border-color: transparent;
246
+ background: var(--zx-color-bg-current);
247
+ }
248
+
249
+ button.zx-block-view__artifact:focus-visible {
250
+ outline-color: transparent;
251
+ box-shadow: var(--zx-focus-ring);
252
+ }
253
+
254
+ .zx-block-view__artifact-tile {
255
+ display: inline-grid;
256
+ flex: 0 0 auto;
257
+ place-items: center;
258
+ inline-size: var(--zx-control-height);
259
+ block-size: var(--zx-control-height);
260
+ border-radius: var(--zx-radius-md);
261
+ background: var(--zx-color-tone-amber-bg);
262
+ color: var(--zx-color-tone-amber-fg);
263
+ }
264
+
265
+ .zx-block-view__artifact-tile[data-kind="code"] {
266
+ background: var(--zx-color-tone-violet-bg);
267
+ color: var(--zx-color-tone-violet-fg);
268
+ }
269
+
270
+ .zx-block-view__artifact-copy {
271
+ display: grid;
272
+ flex: 1 1 auto;
273
+ min-inline-size: 0;
274
+ line-height: 1.4;
275
+ }
276
+
277
+ .zx-block-view__artifact-name {
278
+ overflow: hidden;
279
+ font-weight: var(--zx-weight-medium);
280
+ text-overflow: ellipsis;
281
+ white-space: nowrap;
282
+ }
283
+
284
+ .zx-block-view__artifact-meta {
285
+ color: var(--zx-color-text-muted);
286
+ font-size: var(--zx-text-xs);
287
+ }
288
+
289
+ .zx-block-view__artifact-chevron {
290
+ display: inline-flex;
291
+ flex: 0 0 auto;
292
+ color: var(--zx-color-text-subtle);
293
+ }
294
+
295
+ /* ------------------------------------------------------------------ states -- */
296
+
297
+ .zx-block-view__stopped {
298
+ color: var(--zx-color-text-muted);
299
+ font-size: var(--zx-text-sm);
300
+ }