@zeyos/zx 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +154 -0
- package/README.md +73 -7
- package/bin/zx-css.js +328 -0
- package/dist/types/components/account-menu/account-menu.d.ts +4 -2
- package/dist/types/components/activity-list/activity-list.d.ts +14 -8
- package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
- package/dist/types/components/agent-thread/agent-thread.d.ts +142 -14
- package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
- package/dist/types/components/calendar/calendar-model.d.ts +9 -2
- package/dist/types/components/calendar/calendar.d.ts +12 -4
- package/dist/types/components/chart/chart.d.ts +25 -13
- package/dist/types/components/code-editor/code-editor.d.ts +7 -2
- package/dist/types/components/composer/composer.d.ts +206 -4
- package/dist/types/components/composer/queue.d.ts +76 -0
- package/dist/types/components/copy/copy-button.d.ts +6 -4
- package/dist/types/components/copy/copy-input.d.ts +10 -6
- package/dist/types/components/datebox/date-range-box.d.ts +33 -0
- package/dist/types/components/datebox/placeholder.d.ts +7 -0
- package/dist/types/components/dock/dock.d.ts +12 -3
- package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
- package/dist/types/components/field-upload/field-upload.d.ts +3 -2
- package/dist/types/components/file-item/file-item.d.ts +3 -2
- package/dist/types/components/file-list/file-list.d.ts +14 -8
- package/dist/types/components/filter/filter-model.d.ts +31 -1
- package/dist/types/components/filter/filter.d.ts +20 -2
- package/dist/types/components/finder/finder.d.ts +14 -6
- package/dist/types/components/flag/flag.d.ts +99 -0
- package/dist/types/components/grid/grid.d.ts +1 -1
- package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
- package/dist/types/components/launcher/launcher.d.ts +2 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
- package/dist/types/components/number-field/number-field.d.ts +17 -6
- package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
- package/dist/types/components/prose/prose.d.ts +9 -6
- package/dist/types/components/questionnaire/conditions.d.ts +270 -0
- package/dist/types/components/questionnaire/items.d.ts +52 -30
- package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
- package/dist/types/components/rating/rating.d.ts +5 -3
- package/dist/types/components/select/country.d.ts +106 -0
- package/dist/types/components/select/field-adapter.d.ts +2 -1
- package/dist/types/components/select/locale.d.ts +102 -0
- package/dist/types/components/select/select.d.ts +41 -2
- package/dist/types/components/slider/slider.d.ts +1 -0
- package/dist/types/components/sort-control/sort-control.d.ts +7 -3
- package/dist/types/components/source-list/source-list.d.ts +7 -5
- package/dist/types/components/split-view/split-view.d.ts +5 -3
- package/dist/types/components/surface/catalog.d.ts +260 -0
- package/dist/types/components/surface/elicit.d.ts +81 -0
- package/dist/types/components/surface/mcp.d.ts +165 -0
- package/dist/types/components/surface/schema.d.ts +314 -0
- package/dist/types/components/surface/stream.d.ts +118 -0
- package/dist/types/components/surface/surface.d.ts +718 -0
- package/dist/types/components/surface/text.d.ts +277 -0
- package/dist/types/components/surface/validate.d.ts +339 -0
- package/dist/types/components/table/table.d.ts +55 -3
- package/dist/types/components/table/window.d.ts +203 -0
- package/dist/types/components/toolbar/toolbar.d.ts +10 -6
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +20 -13
- package/dist/types/core/component.d.ts +10 -0
- package/dist/types/core/date.d.ts +8 -1
- package/dist/types/core/dom.d.ts +1 -0
- package/dist/types/core/http.d.ts +10 -0
- package/dist/types/core/i18n.d.ts +38 -0
- package/dist/types/core/messages.d.ts +344 -1
- package/dist/types/core/storage.d.ts +7 -2
- package/dist/types/elements/define.d.ts +21 -46
- package/dist/types/elements/definitions.d.ts +147 -0
- package/dist/types/elements/kit.d.ts +7 -0
- package/dist/types/elements/reflect.d.ts +6 -3
- package/dist/types/index.d.ts +10 -1
- package/dist/types/internal/date-locale.d.ts +7 -0
- package/dist/types/internal/json-patch.d.ts +146 -0
- package/dist/types/locales/de.d.ts +13 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/index.d.ts +823 -0
- package/dist/types/zeyos/view.d.ts +8 -1
- package/dist/zx-zeyos.esm.js +16802 -15180
- package/dist/zx-zeyos.esm.min.js +5 -5
- package/dist/zx.core.css +1276 -0
- package/dist/zx.core.min.css +1 -0
- package/dist/zx.css +498 -134
- package/dist/zx.esm.js +40778 -29654
- package/dist/zx.esm.min.js +36 -23
- package/dist/zx.global.js +40778 -29654
- package/dist/zx.global.min.js +36 -23
- package/dist/zx.layered.css +17302 -0
- package/dist/zx.layered.min.css +1 -0
- package/dist/zx.min.css +1 -1
- package/docs/agent-catalog.json +12501 -0
- package/docs/agent-surfaces.md +340 -0
- package/docs/api.json +851 -121
- package/docs/llms.md +1018 -71
- package/docs/llms.txt +30 -9
- package/package.json +29 -6
- package/src/components/account-menu/account-menu.js +6 -3
- package/src/components/activity-item/activity-item.js +2 -1
- package/src/components/activity-list/activity-list.js +16 -10
- package/src/components/agent-thread/ag-ui.js +1439 -0
- package/src/components/agent-thread/agent-thread.js +359 -54
- package/src/components/agent-thread/ui-message-stream.js +1281 -0
- package/src/components/app-sidebar/app-sidebar.js +18 -8
- package/src/components/approval-card/approval-card.js +3 -2
- package/src/components/block-view/block-view.js +7 -6
- package/src/components/breadcrumb/breadcrumb.js +8 -5
- package/src/components/calendar/calendar-model.js +8 -2
- package/src/components/calendar/calendar.js +53 -18
- package/src/components/chart/chart.js +54 -23
- package/src/components/code-editor/code-editor.js +45 -8
- package/src/components/code-editor/field-adapter.js +1 -1
- package/src/components/composer/composer.css +80 -1
- package/src/components/composer/composer.js +390 -16
- package/src/components/composer/queue.js +78 -0
- package/src/components/context-menu/context-menu.js +12 -1
- package/src/components/copy/copy-button.js +9 -7
- package/src/components/copy/copy-input.js +10 -6
- package/src/components/date-picker/date-picker.js +2 -1
- package/src/components/date-picker/date-range-picker.js +8 -7
- package/src/components/datebox/date-range-box.js +3 -9
- package/src/components/datebox/datebox.js +18 -21
- package/src/components/datebox/placeholder.js +18 -0
- package/src/components/dialog/dialog.js +1 -1
- package/src/components/dock/dock.js +34 -13
- package/src/components/entity-ref/entity-ref.js +16 -5
- package/src/components/field-upload/field-upload.js +81 -38
- package/src/components/file-item/file-item.js +70 -40
- package/src/components/file-list/file-list.js +15 -9
- package/src/components/filter/filter-model.js +46 -8
- package/src/components/filter/filter.css +3 -3
- package/src/components/filter/filter.js +29 -10
- package/src/components/filter-panel/filter-panel.js +13 -5
- package/src/components/finder/finder.js +50 -26
- package/src/components/flag/flag.css +40 -0
- package/src/components/flag/flag.js +177 -0
- package/src/components/form/form.js +1 -1
- package/src/components/grid/grid.js +22 -8
- package/src/components/kanban-view/kanban-view.js +51 -81
- package/src/components/launcher/launcher.js +17 -2
- package/src/components/list-toolbar/list-toolbar.js +2 -1
- package/src/components/master-panel/master-panel.js +1 -1
- package/src/components/menu-button/menu-button.js +4 -0
- package/src/components/message/message.js +3 -0
- package/src/components/multi-value-editor/multi-value-editor.js +10 -9
- package/src/components/navigation-bar/navigation-bar.js +3 -3
- package/src/components/number-field/number-field.js +29 -13
- package/src/components/prompt-starters/prompt-starters.css +91 -0
- package/src/components/prompt-starters/prompt-starters.js +206 -0
- package/src/components/prose/prose.js +14 -10
- package/src/components/questionnaire/conditions.js +666 -0
- package/src/components/questionnaire/items.js +150 -41
- package/src/components/questionnaire/questionnaire.js +126 -32
- package/src/components/rating/rating.js +5 -4
- package/src/components/run-status/run-status.js +2 -2
- package/src/components/select/country.js +136 -0
- package/src/components/select/field-adapter.js +7 -2
- package/src/components/select/locale.js +219 -0
- package/src/components/select/select.css +20 -22
- package/src/components/select/select.js +94 -12
- package/src/components/sheet/sheet-stack.js +10 -1
- package/src/components/slider/slider.js +7 -2
- package/src/components/sort-control/sort-control.js +15 -5
- package/src/components/source-list/source-list.js +7 -4
- package/src/components/split-view/split-view.js +5 -3
- package/src/components/surface/catalog.js +1334 -0
- package/src/components/surface/elicit.js +107 -0
- package/src/components/surface/mcp.js +243 -0
- package/src/components/surface/schema.js +644 -0
- package/src/components/surface/stream.js +245 -0
- package/src/components/surface/surface.css +308 -0
- package/src/components/surface/surface.js +2291 -0
- package/src/components/surface/text.js +513 -0
- package/src/components/surface/validate.js +2218 -0
- package/src/components/tabbox/tabbox.js +9 -0
- package/src/components/table/table.css +63 -3
- package/src/components/table/table.js +167 -28
- package/src/components/table/window.js +317 -0
- package/src/components/toolbar/toolbar.js +12 -7
- package/src/components/tooltip/tooltip.css +2 -3
- package/src/components/tooltip/tooltip.js +32 -5
- package/src/components/tree/tree.js +53 -23
- package/src/core/component.js +25 -1
- package/src/core/date.js +62 -16
- package/src/core/dom.js +22 -2
- package/src/core/format.js +15 -13
- package/src/core/http.js +29 -20
- package/src/core/i18n.js +83 -10
- package/src/core/keyboard.js +79 -8
- package/src/core/messages.js +376 -2
- package/src/core/overlay-host.js +1 -0
- package/src/core/storage.js +59 -6
- package/src/elements/define.js +178 -130
- package/src/elements/definitions.js +229 -0
- package/src/elements/kit.js +444 -0
- package/src/elements/reflect.js +8 -3
- package/src/index.js +10 -1
- package/src/internal/date-locale.js +11 -0
- package/src/internal/json-patch.js +405 -0
- package/src/locales/de.js +911 -0
- package/src/locales/en.js +2 -0
- package/src/locales/index.js +7 -0
- package/src/zeyos/calendar.js +2 -1
- package/src/zeyos/form.js +2 -1
- package/src/zeyos/launcher.js +7 -6
- package/src/zeyos/module-bar.js +2 -1
- package/src/zeyos/schema.js +37 -23
- package/src/zeyos/select.js +4 -3
- package/src/zeyos/table.js +2 -13
- package/src/zeyos/view.js +57 -17
- package/styles/core.css +11 -0
- package/styles/tokens/semantic.css +1 -0
- package/styles/zeyos.css +2 -0
- package/styles/zx.css +4 -8
- package/styles/zx.layered.css +1 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* Splitting streamed text into the operation lines of a surface.
|
|
4
|
+
*
|
|
5
|
+
* A surface arrives as JSON Lines. `lineSplitter()` turns string chunks of any size into whole
|
|
6
|
+
* lines, and `inlineSplitter()` separates the lines of a fenced surface from the prose of an answer
|
|
7
|
+
* that carries one, without holding the prose back.
|
|
8
|
+
*
|
|
9
|
+
* The module touches no DOM and imports nothing, so it runs unchanged in a browser and on a server.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Longest line `lineSplitter()` buffers by default: 256 KiB of characters. */
|
|
13
|
+
export const MAX_LINE = 262144;
|
|
14
|
+
|
|
15
|
+
/** The line that opens a surface inside answer text. */
|
|
16
|
+
export const OPEN_FENCE = '```zx-surface';
|
|
17
|
+
|
|
18
|
+
/** The line that closes it. */
|
|
19
|
+
export const CLOSE_FENCE = '```';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A problem found while splitting a stream.
|
|
23
|
+
* - `line-too-long`: a line grew past `maxLine`; it is dropped up to its end.
|
|
24
|
+
* - `unterminated-fence`: the text ended inside a surface fence.
|
|
25
|
+
* @typedef {Object} StreamError
|
|
26
|
+
* @property {'line-too-long'|'unterminated-fence'} code What went wrong.
|
|
27
|
+
* @property {string} message Human-readable description.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Options of `lineSplitter()`.
|
|
32
|
+
* @typedef {Object} LineSplitterOptions
|
|
33
|
+
* @property {number} [maxLine=262144] Longest line, in characters, that is buffered. A longer one
|
|
34
|
+
* is reported once and dropped up to its end rather than held in memory.
|
|
35
|
+
* @property {(error: StreamError) => void} [onerror] Receives an over-long line's report.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* What both splitters return: feed it chunks, then end it once.
|
|
40
|
+
* @typedef {Object} StreamSplitter
|
|
41
|
+
* @property {(chunk: string) => void} write Takes the next chunk. Chunk boundaries may fall
|
|
42
|
+
* anywhere, between `\r` and `\n` included.
|
|
43
|
+
* @property {() => void} end Flushes what is left: a last line without a line break is emitted.
|
|
44
|
+
* Writing after `end()` is ignored.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Splits string chunks into whole lines. Lines end at `\n`; a `\r` right before it is removed, so
|
|
49
|
+
* `\r\n` works too. Every line is emitted, empty ones included, without its line break.
|
|
50
|
+
* @param {(line: string) => void} onLine Receives each complete line.
|
|
51
|
+
* @param {LineSplitterOptions} [options]
|
|
52
|
+
* @returns {StreamSplitter}
|
|
53
|
+
*/
|
|
54
|
+
export function lineSplitter(onLine, options = {}) {
|
|
55
|
+
const maxLine = positive(options.maxLine, MAX_LINE);
|
|
56
|
+
const onerror = typeof options.onerror === 'function' ? options.onerror : () => {};
|
|
57
|
+
let buffer = '';
|
|
58
|
+
let skipping = false;
|
|
59
|
+
let ended = false;
|
|
60
|
+
|
|
61
|
+
const report = () => onerror({ code: 'line-too-long', message: `A line is longer than ${maxLine} characters and was dropped` });
|
|
62
|
+
|
|
63
|
+
/** @param {string} line A whole line, possibly still ending in `\r`. */
|
|
64
|
+
const emit = (line) => {
|
|
65
|
+
const text = line.endsWith('\r') ? line.slice(0, -1) : line;
|
|
66
|
+
if (text.length > maxLine) report();
|
|
67
|
+
else onLine(text);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
write(chunk) {
|
|
72
|
+
if (ended || typeof chunk !== 'string' || chunk === '') return;
|
|
73
|
+
let start = 0;
|
|
74
|
+
for (let newline = chunk.indexOf('\n'); newline !== -1; newline = chunk.indexOf('\n', start)) {
|
|
75
|
+
const piece = chunk.slice(start, newline);
|
|
76
|
+
start = newline + 1;
|
|
77
|
+
// The end of a line already reported as too long: drop it and start afresh.
|
|
78
|
+
if (skipping) {
|
|
79
|
+
skipping = false;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const line = buffer + piece;
|
|
83
|
+
buffer = '';
|
|
84
|
+
emit(line);
|
|
85
|
+
}
|
|
86
|
+
if (skipping) return;
|
|
87
|
+
buffer += chunk.slice(start);
|
|
88
|
+
// One more character than the limit is tolerated: it may be the `\r` of a `\r\n`.
|
|
89
|
+
if (buffer.length > maxLine + 1) {
|
|
90
|
+
buffer = '';
|
|
91
|
+
skipping = true;
|
|
92
|
+
report();
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
end() {
|
|
96
|
+
if (ended) return;
|
|
97
|
+
ended = true;
|
|
98
|
+
if (!skipping && buffer !== '') emit(buffer);
|
|
99
|
+
buffer = '';
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Callbacks of `inlineSplitter()`.
|
|
106
|
+
* @typedef {Object} InlineSplitterOptions
|
|
107
|
+
* @property {(text: string) => void} [ontext] Receives prose, as it arrives, unchanged.
|
|
108
|
+
* @property {(line: string) => void} [online] Receives each line inside a surface fence.
|
|
109
|
+
* @property {(error: StreamError) => void} [onerror] Receives an over-long line inside a fence and
|
|
110
|
+
* a fence still open at `end()`.
|
|
111
|
+
* @property {number} [maxLine=262144] Longest line inside a fence.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Separates surface fences from the prose of an answer. A fence opens with a line reading exactly
|
|
116
|
+
* `` ```zx-surface `` and closes with a line reading exactly `` ``` ``; the fence lines themselves
|
|
117
|
+
* go nowhere, and each line between them goes to `online`. Prose goes to `ontext` as soon as it
|
|
118
|
+
* arrives: only the start of a line that could still turn out to be the opening fence is held
|
|
119
|
+
* back, and only until it can no longer be one. Any other line starting with three backticks stays
|
|
120
|
+
* prose.
|
|
121
|
+
* @param {InlineSplitterOptions} options
|
|
122
|
+
* @returns {StreamSplitter}
|
|
123
|
+
*/
|
|
124
|
+
export function inlineSplitter(options = {}) {
|
|
125
|
+
const ontext = typeof options.ontext === 'function' ? options.ontext : () => {};
|
|
126
|
+
const online = typeof options.online === 'function' ? options.online : () => {};
|
|
127
|
+
const onerror = typeof options.onerror === 'function' ? options.onerror : () => {};
|
|
128
|
+
|
|
129
|
+
/** `start`: at the beginning of a prose line; `held`: holding a possible opening fence; `prose`: inside a prose line; `fence`: inside a surface. */
|
|
130
|
+
let mode = /** @type {'start'|'held'|'prose'|'fence'} */ ('start');
|
|
131
|
+
let held = '';
|
|
132
|
+
let ended = false;
|
|
133
|
+
|
|
134
|
+
const closeFence = () => { mode = 'start'; };
|
|
135
|
+
/** @type {StreamSplitter} */
|
|
136
|
+
let lines = fenceLines();
|
|
137
|
+
|
|
138
|
+
/** @returns {StreamSplitter} A line splitter for one fence's body. */
|
|
139
|
+
function fenceLines() {
|
|
140
|
+
return lineSplitter((line) => {
|
|
141
|
+
if (mode !== 'fence') return;
|
|
142
|
+
if (line === CLOSE_FENCE) closeFence();
|
|
143
|
+
else online(line);
|
|
144
|
+
}, { maxLine: options.maxLine, onerror });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {string} text
|
|
149
|
+
* @returns {void}
|
|
150
|
+
*/
|
|
151
|
+
function feed(text) {
|
|
152
|
+
let index = 0;
|
|
153
|
+
while (index < text.length) {
|
|
154
|
+
if (mode === 'fence') {
|
|
155
|
+
// Hand the fence body to the line splitter up to and including the closing line; what
|
|
156
|
+
// follows the closing line is prose again.
|
|
157
|
+
const closed = feedFence(text.slice(index));
|
|
158
|
+
if (closed < 0) return;
|
|
159
|
+
index += closed;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (mode === 'prose') {
|
|
163
|
+
const newline = text.indexOf('\n', index);
|
|
164
|
+
if (newline === -1) {
|
|
165
|
+
ontext(text.slice(index));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
ontext(text.slice(index, newline + 1));
|
|
169
|
+
index = newline + 1;
|
|
170
|
+
mode = 'start';
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
// `start` or `held`: compare against the opening fence one character at a time.
|
|
174
|
+
const char = text[index];
|
|
175
|
+
const candidate = held + char;
|
|
176
|
+
if (OPEN_FENCE.startsWith(candidate) || candidate === `${OPEN_FENCE}\r`) {
|
|
177
|
+
held = candidate;
|
|
178
|
+
mode = 'held';
|
|
179
|
+
index += 1;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (char === '\n' && (held === OPEN_FENCE || held === `${OPEN_FENCE}\r`)) {
|
|
183
|
+
held = '';
|
|
184
|
+
mode = 'fence';
|
|
185
|
+
lines = fenceLines();
|
|
186
|
+
index += 1;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
// It can no longer be the fence: release what was held and carry on as prose.
|
|
190
|
+
const release = held;
|
|
191
|
+
held = '';
|
|
192
|
+
mode = 'prose';
|
|
193
|
+
if (release) ontext(release);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Feeds fence text line by line until the closing line, so the prose after it is not swallowed.
|
|
199
|
+
* @param {string} text
|
|
200
|
+
* @returns {number} Characters consumed when the fence closed, or -1 when all were consumed.
|
|
201
|
+
*/
|
|
202
|
+
function feedFence(text) {
|
|
203
|
+
let index = 0;
|
|
204
|
+
while (index < text.length) {
|
|
205
|
+
const newline = text.indexOf('\n', index);
|
|
206
|
+
if (newline === -1) {
|
|
207
|
+
lines.write(text.slice(index));
|
|
208
|
+
return -1;
|
|
209
|
+
}
|
|
210
|
+
lines.write(text.slice(index, newline + 1));
|
|
211
|
+
index = newline + 1;
|
|
212
|
+
if (mode !== 'fence') return index;
|
|
213
|
+
}
|
|
214
|
+
return -1;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return {
|
|
218
|
+
write(chunk) {
|
|
219
|
+
if (ended || typeof chunk !== 'string' || chunk === '') return;
|
|
220
|
+
feed(chunk);
|
|
221
|
+
},
|
|
222
|
+
end() {
|
|
223
|
+
if (ended) return;
|
|
224
|
+
ended = true;
|
|
225
|
+
if (mode === 'held') {
|
|
226
|
+
if (held === OPEN_FENCE || held === `${OPEN_FENCE}\r`) {
|
|
227
|
+
onerror({ code: 'unterminated-fence', message: 'The answer ended inside a surface fence' });
|
|
228
|
+
} else {
|
|
229
|
+
ontext(held);
|
|
230
|
+
}
|
|
231
|
+
held = '';
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (mode === 'fence') {
|
|
235
|
+
lines.end();
|
|
236
|
+
if (mode === 'fence') onerror({ code: 'unterminated-fence', message: 'The answer ended inside a surface fence' });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** @param {unknown} value @param {number} fallback @returns {number} */
|
|
243
|
+
function positive(value, fallback) {
|
|
244
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : fallback;
|
|
245
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Surface — a piece of interface an agent composed: a rich answer, or a dialog asking the person
|
|
3
|
+
* something. One quiet frame around library components, a byline saying who composed it, and
|
|
4
|
+
* the actions; answered, it stays as the record of what was decided.
|
|
5
|
+
*/
|
|
6
|
+
.zx-surface {
|
|
7
|
+
display: block;
|
|
8
|
+
inline-size: 100%;
|
|
9
|
+
min-inline-size: 0;
|
|
10
|
+
color: var(--zx-color-text);
|
|
11
|
+
container-type: inline-size;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.zx-surface__frame {
|
|
15
|
+
display: grid;
|
|
16
|
+
gap: var(--zx-space-3);
|
|
17
|
+
min-inline-size: 0;
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: var(--zx-space-4);
|
|
20
|
+
border: 1px solid var(--zx-color-border-subtle);
|
|
21
|
+
border-radius: var(--zx-radius-lg);
|
|
22
|
+
background: var(--zx-color-bg-surface);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.zx-surface[data-state="open"] .zx-surface__frame:is(form) {
|
|
26
|
+
border-color: var(--zx-color-border);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Inside a dialog or a sheet the overlay is the frame. */
|
|
30
|
+
.zx-surface-host .zx-surface__frame {
|
|
31
|
+
padding: 0;
|
|
32
|
+
border: 0;
|
|
33
|
+
background: transparent;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:is(.zx-surface__actions, .zx-surface__receipt, .zx-surface__choice-error)[hidden],
|
|
37
|
+
.zx-surface [data-surface-node][hidden] {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ------------------------------------------------------------------ head -- */
|
|
42
|
+
|
|
43
|
+
.zx-surface__header {
|
|
44
|
+
display: grid;
|
|
45
|
+
gap: 2px;
|
|
46
|
+
min-inline-size: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.zx-surface__title {
|
|
50
|
+
margin: 0;
|
|
51
|
+
font-size: var(--zx-text-md);
|
|
52
|
+
font-weight: var(--zx-weight-semibold);
|
|
53
|
+
line-height: 1.35;
|
|
54
|
+
overflow-wrap: anywhere;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.zx-surface__description {
|
|
58
|
+
margin: 0;
|
|
59
|
+
color: var(--zx-color-text-muted);
|
|
60
|
+
font-size: var(--zx-text-sm);
|
|
61
|
+
overflow-wrap: anywhere;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.zx-surface__byline {
|
|
65
|
+
margin: 0;
|
|
66
|
+
color: var(--zx-color-text-muted);
|
|
67
|
+
font-size: var(--zx-text-xs);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ------------------------------------------------------------------ body -- */
|
|
71
|
+
|
|
72
|
+
.zx-surface__body {
|
|
73
|
+
display: grid;
|
|
74
|
+
gap: var(--zx-space-3);
|
|
75
|
+
min-inline-size: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.zx-surface__body > *,
|
|
79
|
+
.zx-surface__stack > *,
|
|
80
|
+
.zx-surface__columns > * {
|
|
81
|
+
min-inline-size: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.zx-surface__blocks > :first-child { margin-block-start: 0; }
|
|
85
|
+
.zx-surface__blocks > :last-child { margin-block-end: 0; }
|
|
86
|
+
|
|
87
|
+
.zx-surface__placeholder {
|
|
88
|
+
padding-block: var(--zx-space-1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.zx-surface__fallback {
|
|
92
|
+
display: flex;
|
|
93
|
+
gap: var(--zx-space-2);
|
|
94
|
+
align-items: center;
|
|
95
|
+
margin: 0;
|
|
96
|
+
padding: var(--zx-space-2) var(--zx-space-3);
|
|
97
|
+
border: 1px dashed var(--zx-color-border);
|
|
98
|
+
border-radius: var(--zx-radius-md);
|
|
99
|
+
color: var(--zx-color-text-muted);
|
|
100
|
+
font-size: var(--zx-text-sm);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.zx-surface__fallback-icon {
|
|
104
|
+
display: inline-flex;
|
|
105
|
+
color: var(--zx-color-text-subtle);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.zx-surface__link {
|
|
109
|
+
margin: 0;
|
|
110
|
+
font-size: var(--zx-text-sm);
|
|
111
|
+
overflow-wrap: anywhere;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.zx-surface__link-text:is(a) {
|
|
115
|
+
color: var(--zx-color-accent);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.zx-surface__link-text:is(a):focus-visible {
|
|
119
|
+
border-radius: var(--zx-radius-sm);
|
|
120
|
+
outline-color: transparent;
|
|
121
|
+
box-shadow: var(--zx-focus-ring);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.zx-surface__host,
|
|
125
|
+
.zx-surface__none,
|
|
126
|
+
.zx-surface__ref-id {
|
|
127
|
+
color: var(--zx-color-text-muted);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.zx-surface__chart {
|
|
131
|
+
display: grid;
|
|
132
|
+
gap: var(--zx-space-2);
|
|
133
|
+
justify-items: start;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.zx-surface__chart > .zx-chart {
|
|
137
|
+
justify-self: stretch;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.zx-surface__diff-label {
|
|
141
|
+
display: inline-flex;
|
|
142
|
+
flex-wrap: wrap;
|
|
143
|
+
gap: var(--zx-space-2);
|
|
144
|
+
align-items: center;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* ------------------------------------------------------------------ choice -- */
|
|
148
|
+
|
|
149
|
+
.zx-surface__choice {
|
|
150
|
+
display: grid;
|
|
151
|
+
gap: var(--zx-space-2);
|
|
152
|
+
min-inline-size: 0;
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
border: 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.zx-surface__choice-legend {
|
|
159
|
+
padding: 0;
|
|
160
|
+
margin-block-end: var(--zx-space-2);
|
|
161
|
+
color: var(--zx-color-text-muted);
|
|
162
|
+
font-size: var(--zx-text-sm);
|
|
163
|
+
font-weight: var(--zx-weight-medium);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.zx-surface__choice-list {
|
|
167
|
+
display: grid;
|
|
168
|
+
gap: var(--zx-space-1);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.zx-surface__option {
|
|
172
|
+
display: grid;
|
|
173
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
174
|
+
gap: var(--zx-space-2);
|
|
175
|
+
align-items: start;
|
|
176
|
+
padding: var(--zx-space-2) var(--zx-space-3);
|
|
177
|
+
border: 1px solid var(--zx-color-border-subtle);
|
|
178
|
+
border-radius: var(--zx-radius-md);
|
|
179
|
+
background: var(--zx-color-bg-surface);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.zx-surface__option:hover {
|
|
183
|
+
background: var(--zx-color-bg-hover);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.zx-surface__option:has(input:checked) {
|
|
187
|
+
border-color: var(--zx-color-accent);
|
|
188
|
+
background: var(--zx-color-bg-selected);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.zx-surface__option input {
|
|
192
|
+
margin: 0;
|
|
193
|
+
margin-block-start: 2px;
|
|
194
|
+
accent-color: var(--zx-color-accent);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.zx-surface__option input:focus-visible {
|
|
198
|
+
outline-color: transparent;
|
|
199
|
+
box-shadow: var(--zx-focus-ring);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.zx-surface__option-label {
|
|
203
|
+
display: flex;
|
|
204
|
+
gap: var(--zx-space-2);
|
|
205
|
+
align-items: start;
|
|
206
|
+
font-size: var(--zx-text-sm);
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.zx-surface__option-icon {
|
|
211
|
+
display: inline-flex;
|
|
212
|
+
color: var(--zx-color-text-muted);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.zx-surface__option-text {
|
|
216
|
+
display: grid;
|
|
217
|
+
gap: 2px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.zx-surface__option-description {
|
|
221
|
+
color: var(--zx-color-text-muted);
|
|
222
|
+
font-size: var(--zx-text-xs);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.zx-surface__choice-error {
|
|
226
|
+
margin: 0;
|
|
227
|
+
color: var(--zx-color-danger);
|
|
228
|
+
font-size: var(--zx-text-xs);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* ------------------------------------------------------------------ receipt -- */
|
|
232
|
+
|
|
233
|
+
.zx-surface__answers {
|
|
234
|
+
display: grid;
|
|
235
|
+
gap: var(--zx-space-2);
|
|
236
|
+
margin: 0;
|
|
237
|
+
font-size: var(--zx-text-sm);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.zx-surface__answer {
|
|
241
|
+
display: grid;
|
|
242
|
+
grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr);
|
|
243
|
+
gap: var(--zx-space-3);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.zx-surface__answer dt {
|
|
247
|
+
color: var(--zx-color-text-muted);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.zx-surface__answer dd {
|
|
251
|
+
margin: 0;
|
|
252
|
+
overflow-wrap: anywhere;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@container (max-width: 30rem) {
|
|
256
|
+
.zx-surface__answer {
|
|
257
|
+
grid-template-columns: minmax(0, 1fr);
|
|
258
|
+
gap: 0;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.zx-surface__mark {
|
|
263
|
+
display: inline-flex;
|
|
264
|
+
color: var(--zx-color-success);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.zx-surface__sr {
|
|
268
|
+
position: absolute;
|
|
269
|
+
inline-size: 1px;
|
|
270
|
+
block-size: 1px;
|
|
271
|
+
overflow: hidden;
|
|
272
|
+
clip-path: inset(50%);
|
|
273
|
+
white-space: nowrap;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* ------------------------------------------------------------------ actions -- */
|
|
277
|
+
|
|
278
|
+
.zx-surface__actions {
|
|
279
|
+
display: flex;
|
|
280
|
+
flex-wrap: wrap;
|
|
281
|
+
gap: var(--zx-space-2);
|
|
282
|
+
justify-content: flex-end;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.zx-surface__verdict {
|
|
286
|
+
display: flex;
|
|
287
|
+
gap: var(--zx-space-2);
|
|
288
|
+
align-items: center;
|
|
289
|
+
margin: 0;
|
|
290
|
+
color: var(--zx-color-text-muted);
|
|
291
|
+
font-size: var(--zx-text-sm);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.zx-surface__verdict:focus-visible {
|
|
295
|
+
border-radius: var(--zx-radius-sm);
|
|
296
|
+
outline-color: transparent;
|
|
297
|
+
box-shadow: var(--zx-focus-ring);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.zx-surface__verdict-icon {
|
|
301
|
+
display: inline-flex;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
/* A questionnaire whose Submit the application's policy denied offers no way to submit. */
|
|
306
|
+
.zx-surface[data-submit="denied"] .zx-questionnaire__actions [data-role="submit"] {
|
|
307
|
+
display: none;
|
|
308
|
+
}
|