@zeyos/zx 5.6.0 → 5.7.1
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 +188 -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/checklist/checklist.d.ts +29 -0
- 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/dialog/dialog.d.ts +2 -2
- 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/modal/modal.d.ts +34 -8
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
- package/dist/types/components/number-field/number-field.d.ts +41 -7
- 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/sheet/sheet.d.ts +2 -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 +15 -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 +16852 -15131
- 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 +520 -143
- package/dist/zx.esm.js +40940 -29684
- package/dist/zx.esm.min.js +36 -23
- package/dist/zx.global.js +40940 -29684
- package/dist/zx.global.min.js +36 -23
- package/dist/zx.layered.css +17315 -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 +909 -137
- package/docs/llms.md +1046 -80
- 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/button/button.css +24 -11
- 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/checklist/checklist.css +9 -1
- package/src/components/checklist/checklist.js +59 -3
- package/src/components/checklist/field-adapter.js +2 -11
- 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 +4 -5
- 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/modal/modal.js +62 -8
- 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 +98 -29
- 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/sheet/sheet.js +12 -5
- 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 +67 -4
- package/src/core/format.js +15 -13
- package/src/core/http.js +29 -20
- package/src/core/i18n.js +83 -10
- package/src/core/icons.js +13 -2
- 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/position.js +3 -2
- 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
|
@@ -13,6 +13,9 @@ import { matchItems } from '../select/filter.js';
|
|
|
13
13
|
* @property {boolean} [search=true] Whether the search field is shown.
|
|
14
14
|
* @property {number} [height=280] Maximum list height in pixels.
|
|
15
15
|
* @property {boolean} [defaultChecked=false] Fallback initial checked state.
|
|
16
|
+
* @property {string|null} [label=null] Heading text, which is also the group's accessible name;
|
|
17
|
+
* null uses the `checklist.label` message.
|
|
18
|
+
* @property {boolean} [disabled=false] Whether the search field and every checkbox are disabled.
|
|
16
19
|
* @property {boolean} [hideLabel=false] Whether the heading is left out. The group keeps the
|
|
17
20
|
* heading text as its accessible name (`aria-label`); a Field labelling the checklist names it
|
|
18
21
|
* instead, which is why the `checklist` field type sets this.
|
|
@@ -43,6 +46,8 @@ export class Checklist extends Component {
|
|
|
43
46
|
search: true,
|
|
44
47
|
height: 280,
|
|
45
48
|
defaultChecked: false,
|
|
49
|
+
label: null,
|
|
50
|
+
disabled: false,
|
|
46
51
|
hideLabel: false,
|
|
47
52
|
load: null
|
|
48
53
|
};
|
|
@@ -57,13 +62,15 @@ export class Checklist extends Component {
|
|
|
57
62
|
const root = /** @type {HTMLElement} */ (this.el ?? h('div'));
|
|
58
63
|
this.el = root;
|
|
59
64
|
if (!this._createdRoot) this._originalChildren = Array.from(root.childNodes);
|
|
60
|
-
|
|
65
|
+
this._disabled = Boolean(this.options.disabled);
|
|
66
|
+
for (const name of ['role', 'aria-label', 'aria-labelledby', 'aria-disabled', 'data-state']) {
|
|
61
67
|
this._originalAttributes.set(name, root.getAttribute(name));
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
const labelText = this.
|
|
70
|
+
const labelText = this._labelText(this.options.label);
|
|
65
71
|
const labelId = uid('zx-checklist-label');
|
|
66
72
|
const title = this.options.hideLabel ? null : h('div', {
|
|
73
|
+
ref: 'label',
|
|
67
74
|
class: 'zx-checklist__label',
|
|
68
75
|
id: labelId
|
|
69
76
|
}, labelText);
|
|
@@ -74,7 +81,8 @@ export class Checklist extends Component {
|
|
|
74
81
|
autocomplete: 'off',
|
|
75
82
|
placeholder: this._message('checklist.search', 'Search'),
|
|
76
83
|
ariaLabel: this._message('checklist.search', 'Search checklist'),
|
|
77
|
-
hidden: !this.options.search
|
|
84
|
+
hidden: !this.options.search,
|
|
85
|
+
disabled: this._disabled
|
|
78
86
|
});
|
|
79
87
|
const list = h('div', {
|
|
80
88
|
ref: 'list',
|
|
@@ -99,6 +107,7 @@ export class Checklist extends Component {
|
|
|
99
107
|
});
|
|
100
108
|
|
|
101
109
|
this._replaceItems(this.options.items);
|
|
110
|
+
this._syncDisabled();
|
|
102
111
|
if (typeof this.options.load === 'function') {
|
|
103
112
|
queueMicrotask(() => {
|
|
104
113
|
if (this._active) void this.reload().catch(() => {});
|
|
@@ -117,6 +126,37 @@ export class Checklist extends Component {
|
|
|
117
126
|
return this;
|
|
118
127
|
}
|
|
119
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Replaces the heading text, which is also the group's accessible name.
|
|
131
|
+
* @param {string|null} label New label; null restores the `checklist.label` message.
|
|
132
|
+
* @returns {this}
|
|
133
|
+
*/
|
|
134
|
+
setLabel(label) {
|
|
135
|
+
const text = this._labelText(label);
|
|
136
|
+
if (this.refs.label) this.refs.label.textContent = text;
|
|
137
|
+
else this.el.setAttribute('aria-label', text);
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Enables the search field and the checkboxes. @returns {this} */
|
|
142
|
+
enable() {
|
|
143
|
+
this._disabled = false;
|
|
144
|
+
this._syncDisabled();
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Disables the search field and the checkboxes; values can still be set programmatically. @returns {this} */
|
|
149
|
+
disable() {
|
|
150
|
+
this._disabled = true;
|
|
151
|
+
this._syncDisabled();
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Whether the checklist is disabled. @returns {boolean} */
|
|
156
|
+
isDisabled() {
|
|
157
|
+
return this._disabled;
|
|
158
|
+
}
|
|
159
|
+
|
|
120
160
|
/** Returns checked IDs in item order. @returns {unknown[]} */
|
|
121
161
|
getValues() {
|
|
122
162
|
return this._items
|
|
@@ -223,6 +263,7 @@ export class Checklist extends Component {
|
|
|
223
263
|
type: 'checkbox',
|
|
224
264
|
id: checkboxId,
|
|
225
265
|
checked: this._checked.has(this._itemValue(item)),
|
|
266
|
+
disabled: this._disabled,
|
|
226
267
|
dataset: { index }
|
|
227
268
|
});
|
|
228
269
|
return h('label', {
|
|
@@ -239,6 +280,21 @@ export class Checklist extends Component {
|
|
|
239
280
|
this.refs.list.replaceChildren(...rows);
|
|
240
281
|
}
|
|
241
282
|
|
|
283
|
+
/** @returns {void} */
|
|
284
|
+
_syncDisabled() {
|
|
285
|
+
if (this._disabled) this.el.setAttribute('aria-disabled', 'true');
|
|
286
|
+
else this.el.removeAttribute('aria-disabled');
|
|
287
|
+
/** @type {HTMLInputElement} */ (this.refs.search).disabled = this._disabled;
|
|
288
|
+
for (const input of this.refs.list.querySelectorAll('input[type="checkbox"]')) {
|
|
289
|
+
/** @type {HTMLInputElement} */ (input).disabled = this._disabled;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** @param {string|null|undefined} label @returns {string} */
|
|
294
|
+
_labelText(label) {
|
|
295
|
+
return label == null || label === '' ? this._message('checklist.label', 'Checklist') : String(label);
|
|
296
|
+
}
|
|
297
|
+
|
|
242
298
|
/** @param {Set<unknown>} next @returns {void} */
|
|
243
299
|
_replaceChecked(next) {
|
|
244
300
|
if (setsEqual(this._checked, next)) return;
|
|
@@ -10,19 +10,11 @@ export function registerChecklistFieldAdapter() {
|
|
|
10
10
|
// The Field's label names the list (`aria-labelledby`), so the checklist draws no heading of
|
|
11
11
|
// its own under it.
|
|
12
12
|
const checklist = field.own(new Checklist(null, { hideLabel: true, ...(options.props ?? {}) }));
|
|
13
|
-
let disabled = false;
|
|
14
13
|
let setting = false;
|
|
15
|
-
const syncDisabled = () => {
|
|
16
|
-
checklist.el.setAttribute('aria-disabled', String(disabled));
|
|
17
|
-
for (const control of checklist.el.querySelectorAll('input, button, select, textarea')) {
|
|
18
|
-
control.disabled = disabled;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
14
|
field.listen(checklist.el, 'change', (event) => event.stopImmediatePropagation());
|
|
22
15
|
checklist.on('change', (event) => {
|
|
23
16
|
if (!setting) field.emit('change', { value: event.detail.values });
|
|
24
17
|
});
|
|
25
|
-
checklist.on('loaded', syncDisabled);
|
|
26
18
|
return {
|
|
27
19
|
el: checklist.el,
|
|
28
20
|
get: () => checklist.getValues(),
|
|
@@ -33,15 +25,14 @@ export function registerChecklistFieldAdapter() {
|
|
|
33
25
|
} finally {
|
|
34
26
|
setting = false;
|
|
35
27
|
}
|
|
36
|
-
syncDisabled();
|
|
37
28
|
},
|
|
38
29
|
focus: () => {
|
|
39
30
|
const search = checklist.el.querySelector('.zx-checklist__search:not([hidden]):not([disabled])');
|
|
40
31
|
(search ?? checklist.el.querySelector('input[type="checkbox"]:not([disabled])'))?.focus();
|
|
41
32
|
},
|
|
42
33
|
setDisabled: (value) => {
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
if (value) checklist.disable();
|
|
35
|
+
else checklist.enable();
|
|
45
36
|
}
|
|
46
37
|
};
|
|
47
38
|
});
|
|
@@ -6,7 +6,8 @@ import { h } from '../../core/dom.js';
|
|
|
6
6
|
* @property {unknown} [value=''] Initial text.
|
|
7
7
|
* @property {string} [name=''] Form field name.
|
|
8
8
|
* @property {string} [language='text'] Language identifier shown to the user and exposed as data.
|
|
9
|
-
* @property {string} [label=
|
|
9
|
+
* @property {string|null} [label=null] Accessible editor label; null reads the `codeEditor.label`
|
|
10
|
+
* message ("Code editor").
|
|
10
11
|
* @property {string} [placeholder=''] Placeholder text.
|
|
11
12
|
* @property {number} [rows=12] Visible textarea rows.
|
|
12
13
|
* @property {string} [indent='\t'] Text inserted by Tab and removed by Shift+Tab.
|
|
@@ -42,7 +43,7 @@ export class CodeEditor extends Component {
|
|
|
42
43
|
value: '',
|
|
43
44
|
name: '',
|
|
44
45
|
language: 'text',
|
|
45
|
-
label:
|
|
46
|
+
label: null,
|
|
46
47
|
placeholder: '',
|
|
47
48
|
rows: 12,
|
|
48
49
|
indent: '\t',
|
|
@@ -73,7 +74,7 @@ export class CodeEditor extends Component {
|
|
|
73
74
|
this._input = /** @type {HTMLTextAreaElement} */ (h('textarea', {
|
|
74
75
|
class: 'zx-code-editor__input',
|
|
75
76
|
name: this.options.name ? String(this.options.name) : undefined,
|
|
76
|
-
ariaLabel: String(this.options.label ?? '
|
|
77
|
+
ariaLabel: String(this.options.label ?? this.msg('codeEditor.label')),
|
|
77
78
|
placeholder: String(this.options.placeholder ?? ''),
|
|
78
79
|
rows: normalizeRows(this.options.rows),
|
|
79
80
|
wrap: normalizeWrap(this.options.wrap),
|
|
@@ -84,6 +85,8 @@ export class CodeEditor extends Component {
|
|
|
84
85
|
autocapitalize: 'off'
|
|
85
86
|
}));
|
|
86
87
|
this._input.value = String(this.options.value ?? '');
|
|
88
|
+
this._committedValue = this._input.value;
|
|
89
|
+
this._indentEditing = false;
|
|
87
90
|
root.dataset.language = this._language;
|
|
88
91
|
root.dataset.readonly = String(Boolean(this.options.readOnly));
|
|
89
92
|
root.dataset.disabled = String(Boolean(this.options.disabled));
|
|
@@ -92,12 +95,16 @@ export class CodeEditor extends Component {
|
|
|
92
95
|
this._tabReleased = false;
|
|
93
96
|
|
|
94
97
|
this.listen(this._input, 'keydown', (event) => this._handleKeydown(event));
|
|
95
|
-
this.listen(this._input, 'blur', () => {
|
|
98
|
+
this.listen(this._input, 'blur', () => {
|
|
99
|
+
this._tabReleased = false;
|
|
100
|
+
this._commitValue();
|
|
101
|
+
});
|
|
96
102
|
this.listen(this._input, 'input', () => {
|
|
103
|
+
if (this._indentEditing) return;
|
|
97
104
|
this._updatePosition();
|
|
98
105
|
this.emit('input', { value: this.getValue() });
|
|
99
106
|
});
|
|
100
|
-
this.listen(this._input, 'change', () => this.
|
|
107
|
+
this.listen(this._input, 'change', () => this._commitValue());
|
|
101
108
|
for (const type of ['click', 'keyup', 'select', 'focus']) {
|
|
102
109
|
this.listen(this._input, type, () => this._updatePosition());
|
|
103
110
|
}
|
|
@@ -118,6 +125,7 @@ export class CodeEditor extends Component {
|
|
|
118
125
|
const next = String(value ?? '');
|
|
119
126
|
if (this._input.value === next) return this;
|
|
120
127
|
this._input.value = next;
|
|
128
|
+
this._committedValue = next;
|
|
121
129
|
this._updatePosition();
|
|
122
130
|
if (!silent) this.emit('change', { value: next });
|
|
123
131
|
return this;
|
|
@@ -170,20 +178,49 @@ export class CodeEditor extends Component {
|
|
|
170
178
|
event.shiftKey
|
|
171
179
|
);
|
|
172
180
|
if (result.value === this._input.value) return;
|
|
173
|
-
|
|
181
|
+
// Native editing commands retain the textarea's undo history; assigning value or using
|
|
182
|
+
// setRangeText does not. Replace only the changed range so surrounding edits stay intact.
|
|
183
|
+
const previous = this._input.value;
|
|
184
|
+
let from = 0;
|
|
185
|
+
while (from < previous.length && previous[from] === result.value[from]) from += 1;
|
|
186
|
+
let tail = 0;
|
|
187
|
+
while (tail < previous.length - from && tail < result.value.length - from
|
|
188
|
+
&& previous[previous.length - tail - 1] === result.value[result.value.length - tail - 1]) tail += 1;
|
|
189
|
+
this._input.setSelectionRange(from, previous.length - tail);
|
|
190
|
+
this._indentEditing = true;
|
|
191
|
+
try {
|
|
192
|
+
const document = this._input.ownerDocument;
|
|
193
|
+
const replacement = result.value.slice(from, result.value.length - tail);
|
|
194
|
+
document?.execCommand?.(replacement ? 'insertText' : 'delete', false, replacement);
|
|
195
|
+
} catch {
|
|
196
|
+
// An unavailable editing command falls through to the same plain-text fallback.
|
|
197
|
+
} finally {
|
|
198
|
+
this._indentEditing = false;
|
|
199
|
+
}
|
|
200
|
+
// Browsers without the editing command still indent and commit, but cannot add that change
|
|
201
|
+
// to native history. Keep this fallback separate from the supported native editing path.
|
|
202
|
+
if (this._input.value !== result.value) this._input.value = result.value;
|
|
174
203
|
this._input.setSelectionRange(result.start, result.end);
|
|
175
204
|
this._updatePosition();
|
|
176
205
|
this.emit('input', { value: this.getValue() });
|
|
177
206
|
}
|
|
178
207
|
|
|
208
|
+
/** Commits once, whether the browser emits change before blur or the fallback edited text. @returns {void} */
|
|
209
|
+
_commitValue() {
|
|
210
|
+
const value = this.getValue();
|
|
211
|
+
if (value === this._committedValue) return;
|
|
212
|
+
this._committedValue = value;
|
|
213
|
+
this.emit('change', { value });
|
|
214
|
+
}
|
|
215
|
+
|
|
179
216
|
/** @returns {void} */
|
|
180
217
|
_updatePosition() {
|
|
181
218
|
if (!this.options.status) return;
|
|
182
219
|
const position = editorPosition(this._input.value, this._input.selectionStart ?? 0,
|
|
183
220
|
this._input.selectionEnd ?? 0);
|
|
184
221
|
this._position.textContent = position.lines > 1
|
|
185
|
-
?
|
|
186
|
-
:
|
|
222
|
+
? this.msgPlural('codeEditor.selection', position.lines, position.line, position.column, position.lines)
|
|
223
|
+
: this.msg('codeEditor.position', position.line, position.column);
|
|
187
224
|
}
|
|
188
225
|
|
|
189
226
|
/** @returns {void} */
|
|
@@ -8,7 +8,7 @@ import { Field } from '../field/field.js';
|
|
|
8
8
|
export function registerCodeEditorFieldAdapter() {
|
|
9
9
|
Field.register('code', (field, options) => {
|
|
10
10
|
const editor = field.own(new CodeEditor(null, {
|
|
11
|
-
label: options.label ? String(options.label) :
|
|
11
|
+
label: options.label ? String(options.label) : null,
|
|
12
12
|
placeholder: options.placeholder,
|
|
13
13
|
readOnly: Boolean(options.props?.readOnly),
|
|
14
14
|
disabled: Boolean(options.disabled),
|
|
@@ -276,6 +276,79 @@
|
|
|
276
276
|
border-radius: var(--zx-radius-sm);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
/* ----------------------------------------------------------------- queue -- */
|
|
280
|
+
|
|
281
|
+
/* What waits for the agent, at the top of the box and set off by a line from the message being
|
|
282
|
+
written: both sit on the same tone. A long queue scrolls, so the text stays on screen. */
|
|
283
|
+
.zx-composer__queue {
|
|
284
|
+
display: grid;
|
|
285
|
+
gap: var(--zx-space-1);
|
|
286
|
+
min-inline-size: 0;
|
|
287
|
+
padding: var(--zx-space-1) 0 var(--zx-space-2);
|
|
288
|
+
border-block-end: 1px solid var(--zx-color-border-subtle);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.zx-composer__queue[hidden] {
|
|
292
|
+
display: none;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.zx-composer__queue-label {
|
|
296
|
+
color: var(--zx-color-text-muted);
|
|
297
|
+
font-size: var(--zx-text-xs);
|
|
298
|
+
font-weight: var(--zx-weight-medium);
|
|
299
|
+
font-variant-numeric: tabular-nums;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.zx-composer__queue-list {
|
|
303
|
+
display: grid;
|
|
304
|
+
gap: 2px;
|
|
305
|
+
min-inline-size: 0;
|
|
306
|
+
max-block-size: calc(5 * var(--zx-control-height));
|
|
307
|
+
margin: 0;
|
|
308
|
+
overflow-y: auto;
|
|
309
|
+
padding: 0;
|
|
310
|
+
list-style: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.zx-composer__queued {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: var(--zx-space-2);
|
|
317
|
+
min-inline-size: 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.zx-composer__queued-text {
|
|
321
|
+
flex: 1 1 auto;
|
|
322
|
+
overflow: hidden;
|
|
323
|
+
min-inline-size: 0;
|
|
324
|
+
font-size: var(--zx-text-sm);
|
|
325
|
+
text-overflow: ellipsis;
|
|
326
|
+
white-space: nowrap;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.zx-composer__queued-meta {
|
|
330
|
+
flex: none;
|
|
331
|
+
color: var(--zx-color-text-muted);
|
|
332
|
+
font-size: var(--zx-text-xs);
|
|
333
|
+
font-variant-numeric: tabular-nums;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.zx-composer__queued-actions {
|
|
337
|
+
display: flex;
|
|
338
|
+
flex: none;
|
|
339
|
+
align-items: center;
|
|
340
|
+
gap: 2px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Words rather than glyphs, quiet until they are pointed at. */
|
|
344
|
+
.zx-composer .zx-composer__queued-action {
|
|
345
|
+
inline-size: auto;
|
|
346
|
+
block-size: calc(var(--zx-control-height) - var(--zx-space-1));
|
|
347
|
+
padding-inline: var(--zx-space-2);
|
|
348
|
+
font-size: var(--zx-text-xs);
|
|
349
|
+
font-weight: var(--zx-weight-medium);
|
|
350
|
+
}
|
|
351
|
+
|
|
279
352
|
/* -------------------------------------------------------------- dropping -- */
|
|
280
353
|
|
|
281
354
|
.zx-composer__drop {
|
|
@@ -320,8 +393,11 @@
|
|
|
320
393
|
border: 1px solid var(--zx-color-overlay-border);
|
|
321
394
|
border-radius: var(--zx-radius-panel);
|
|
322
395
|
background-color: var(--zx-color-overlay-surface);
|
|
396
|
+
background-image: var(--zx-overlay-surface-image);
|
|
323
397
|
background-clip: padding-box;
|
|
324
|
-
|
|
398
|
+
-webkit-backdrop-filter: var(--zx-glass-filter-overlay);
|
|
399
|
+
backdrop-filter: var(--zx-glass-filter-overlay);
|
|
400
|
+
box-shadow: var(--zx-glass-overlay-shadow);
|
|
325
401
|
color: var(--zx-color-text);
|
|
326
402
|
}
|
|
327
403
|
|
|
@@ -333,6 +409,9 @@
|
|
|
333
409
|
.zx-composer__suggestions {
|
|
334
410
|
border-color: var(--zx-color-border-strong);
|
|
335
411
|
background: var(--zx-color-bg-raised);
|
|
412
|
+
-webkit-backdrop-filter: none;
|
|
413
|
+
backdrop-filter: none;
|
|
414
|
+
box-shadow: var(--zx-overlay-shadow);
|
|
336
415
|
}
|
|
337
416
|
}
|
|
338
417
|
|