@zeyos/zx 5.5.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 +210 -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 +711 -0
- 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/approval-card/approval-card.d.ts +596 -0
- package/dist/types/components/avatar/avatar.d.ts +91 -4
- package/dist/types/components/block-view/block-view.d.ts +205 -0
- 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 +938 -0
- 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/run-status/run-status.d.ts +393 -0
- package/dist/types/components/run-trace/run-trace.d.ts +624 -0
- 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 +179 -0
- 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 +479 -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 +18 -1
- package/dist/types/internal/agent-model.d.ts +587 -0
- package/dist/types/internal/date-locale.d.ts +7 -0
- package/dist/types/internal/highlight.d.ts +24 -0
- package/dist/types/internal/json-patch.d.ts +146 -0
- package/dist/types/internal/presence-loop.d.ts +148 -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 +20505 -18748
- 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 +2424 -134
- package/dist/zx.esm.js +46167 -28468
- package/dist/zx.esm.min.js +40 -8
- package/dist/zx.global.js +46167 -28468
- package/dist/zx.global.min.js +40 -8
- 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 +2057 -166
- package/docs/llms.md +1458 -58
- package/docs/llms.txt +38 -8
- 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.css +417 -0
- package/src/components/agent-thread/agent-thread.js +1670 -0
- 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.css +289 -0
- package/src/components/approval-card/approval-card.js +1378 -0
- package/src/components/avatar/avatar.css +56 -1
- package/src/components/avatar/avatar.js +148 -26
- package/src/components/block-view/block-view.css +300 -0
- package/src/components/block-view/block-view.js +524 -0
- 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 +482 -0
- package/src/components/composer/composer.js +1815 -0
- 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.css +208 -0
- package/src/components/run-status/run-status.js +782 -0
- package/src/components/run-trace/run-trace.css +443 -0
- package/src/components/run-trace/run-trace.js +1209 -0
- 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.css +208 -0
- package/src/components/source-list/source-list.js +358 -0
- 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 +519 -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 +18 -1
- package/src/internal/agent-model.js +488 -0
- package/src/internal/date-locale.js +11 -0
- package/src/internal/highlight.js +104 -0
- package/src/internal/json-patch.js +405 -0
- package/src/internal/presence-loop.js +343 -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 +11 -8
- package/styles/zx.layered.css +1 -0
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { Launcher } from '../launcher/launcher.js';
|
|
3
|
+
export type LauncherItem = import('../launcher/launcher.js').LauncherItem;
|
|
4
|
+
export type MentionItem = {
|
|
5
|
+
/**
|
|
6
|
+
* Stable identifier.
|
|
7
|
+
*/
|
|
8
|
+
id: string | number;
|
|
9
|
+
/**
|
|
10
|
+
* Visible name; picking the item writes `@<label> ` into the text.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Secondary line in the suggestion list.
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Icon name drawn before the label.
|
|
19
|
+
*/
|
|
20
|
+
icon?: string;
|
|
21
|
+
};
|
|
22
|
+
export type MentionSource = {
|
|
23
|
+
/**
|
|
24
|
+
* Character that starts a mention.
|
|
25
|
+
*/
|
|
26
|
+
trigger?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The
|
|
29
|
+
* items, filtered by the composer as the query changes, or a function that answers a query itself.
|
|
30
|
+
*/
|
|
31
|
+
items: MentionItem[] | ((query: string) => MentionItem[] | Promise<MentionItem[]>);
|
|
32
|
+
};
|
|
33
|
+
export type ContextChip = {
|
|
34
|
+
/**
|
|
35
|
+
* Stable identifier.
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Visible label.
|
|
40
|
+
*/
|
|
41
|
+
label: string;
|
|
42
|
+
/**
|
|
43
|
+
* Icon name drawn before the label.
|
|
44
|
+
*/
|
|
45
|
+
icon?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Application data handed back in `send`; the composer never reads it.
|
|
48
|
+
*/
|
|
49
|
+
ref?: unknown;
|
|
50
|
+
};
|
|
51
|
+
export type ComposerTool = {
|
|
52
|
+
/**
|
|
53
|
+
* Stable identifier, handed back in `tool`.
|
|
54
|
+
*/
|
|
55
|
+
id: string;
|
|
56
|
+
/**
|
|
57
|
+
* Accessible name and tooltip; the button shows only the icon.
|
|
58
|
+
*/
|
|
59
|
+
label: string;
|
|
60
|
+
/**
|
|
61
|
+
* Icon name: a built-in glyph or one the application registered.
|
|
62
|
+
*/
|
|
63
|
+
icon: string;
|
|
64
|
+
/**
|
|
65
|
+
* Makes the tool a toggle, drawn with `aria-pressed`. Leave it out for
|
|
66
|
+
* a plain button. The composer never changes it on its own: call `setToolPressed()`.
|
|
67
|
+
*/
|
|
68
|
+
pressed?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the tool takes no clicks.
|
|
71
|
+
*/
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Makes the tool a disclosure, drawn with `aria-expanded`: a panel
|
|
75
|
+
* of settings it opens. Like `pressed`, the application sets it.
|
|
76
|
+
*/
|
|
77
|
+
expanded?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Id of what the tool opens, drawn as `aria-controls`.
|
|
80
|
+
*/
|
|
81
|
+
controls?: string;
|
|
82
|
+
};
|
|
83
|
+
export type ComposerToolDetail = {
|
|
84
|
+
/**
|
|
85
|
+
* The tool's id.
|
|
86
|
+
*/
|
|
87
|
+
id: string;
|
|
88
|
+
/**
|
|
89
|
+
* A copy of the tool as it stands, `pressed` included.
|
|
90
|
+
*/
|
|
91
|
+
tool: ComposerTool;
|
|
92
|
+
};
|
|
93
|
+
export type ComposerUpdate = {
|
|
94
|
+
/**
|
|
95
|
+
* Accessible name; null resolves `composer.label` again.
|
|
96
|
+
*/
|
|
97
|
+
label?: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Placeholder of the text; empty removes it.
|
|
100
|
+
*/
|
|
101
|
+
placeholder?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Quiet text beside Send, as `setHint()`.
|
|
104
|
+
*/
|
|
105
|
+
hint?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Line under the composer, as `setNote()`.
|
|
108
|
+
*/
|
|
109
|
+
note?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The key that sends.
|
|
112
|
+
*/
|
|
113
|
+
submitKey?: 'enter' | 'mod+enter';
|
|
114
|
+
/**
|
|
115
|
+
* Visible text on Send; null or empty makes it icon-only.
|
|
116
|
+
*/
|
|
117
|
+
sendLabel?: string | null;
|
|
118
|
+
/**
|
|
119
|
+
* As `setDisabled()`.
|
|
120
|
+
*/
|
|
121
|
+
disabled?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* As `setBusy()`.
|
|
124
|
+
*/
|
|
125
|
+
busy?: boolean;
|
|
126
|
+
};
|
|
127
|
+
export type ComposerSendDetail = {
|
|
128
|
+
/**
|
|
129
|
+
* The message, trimmed.
|
|
130
|
+
*/
|
|
131
|
+
text: string;
|
|
132
|
+
/**
|
|
133
|
+
* Attached files, in the order they were added.
|
|
134
|
+
*/
|
|
135
|
+
files: File[];
|
|
136
|
+
/**
|
|
137
|
+
* The picked mentions whose `@<label>` is still in the text.
|
|
138
|
+
*/
|
|
139
|
+
mentions: MentionItem[];
|
|
140
|
+
/**
|
|
141
|
+
* The context chips.
|
|
142
|
+
*/
|
|
143
|
+
context: ContextChip[];
|
|
144
|
+
/**
|
|
145
|
+
* `true` on a message that waited in the queue. Absent otherwise.
|
|
146
|
+
*/
|
|
147
|
+
queued?: boolean;
|
|
148
|
+
};
|
|
149
|
+
export type QueuedMessage = {
|
|
150
|
+
/**
|
|
151
|
+
* Stable identifier, for `removeQueued()`.
|
|
152
|
+
*/
|
|
153
|
+
id: string;
|
|
154
|
+
/**
|
|
155
|
+
* The message, trimmed.
|
|
156
|
+
*/
|
|
157
|
+
text: string;
|
|
158
|
+
/**
|
|
159
|
+
* Attached files, in the order they were added.
|
|
160
|
+
*/
|
|
161
|
+
files: File[];
|
|
162
|
+
/**
|
|
163
|
+
* The picked mentions whose `@<label>` is in the text.
|
|
164
|
+
*/
|
|
165
|
+
mentions: MentionItem[];
|
|
166
|
+
/**
|
|
167
|
+
* The context chips when it was queued.
|
|
168
|
+
*/
|
|
169
|
+
context: ContextChip[];
|
|
170
|
+
};
|
|
171
|
+
export type ComposerQueueDetail = {
|
|
172
|
+
/**
|
|
173
|
+
* The message added.
|
|
174
|
+
*/
|
|
175
|
+
item: QueuedMessage;
|
|
176
|
+
/**
|
|
177
|
+
* The whole queue, in order, the message added included.
|
|
178
|
+
*/
|
|
179
|
+
items: QueuedMessage[];
|
|
180
|
+
};
|
|
181
|
+
export type ComposerDequeueDetail = {
|
|
182
|
+
/**
|
|
183
|
+
* The message that left the queue.
|
|
184
|
+
*/
|
|
185
|
+
item: QueuedMessage;
|
|
186
|
+
/**
|
|
187
|
+
* What is left of the queue, in order.
|
|
188
|
+
*/
|
|
189
|
+
items: QueuedMessage[];
|
|
190
|
+
/**
|
|
191
|
+
* Why it left.
|
|
192
|
+
*/
|
|
193
|
+
reason: 'sent' | 'removed' | 'edited' | 'cleared';
|
|
194
|
+
};
|
|
195
|
+
export type ComposerRemoveDetail = {
|
|
196
|
+
/**
|
|
197
|
+
* What was removed.
|
|
198
|
+
*/
|
|
199
|
+
kind: 'file' | 'context';
|
|
200
|
+
/**
|
|
201
|
+
* The attachment's or chip's id.
|
|
202
|
+
*/
|
|
203
|
+
id: string;
|
|
204
|
+
/**
|
|
205
|
+
* The removed file, for `kind: 'file'`.
|
|
206
|
+
*/
|
|
207
|
+
file?: File;
|
|
208
|
+
/**
|
|
209
|
+
* The removed chip, for `kind: 'context'`.
|
|
210
|
+
*/
|
|
211
|
+
chip?: ContextChip;
|
|
212
|
+
};
|
|
213
|
+
export type ComposerOptions = {
|
|
214
|
+
/**
|
|
215
|
+
* Accessible name of the text and of the group around it.
|
|
216
|
+
* Omitted resolves `composer.label`, English `Message`.
|
|
217
|
+
*/
|
|
218
|
+
label?: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Placeholder of the text.
|
|
221
|
+
*/
|
|
222
|
+
placeholder?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Initial text. Without it, a saved draft is restored.
|
|
225
|
+
*/
|
|
226
|
+
value?: string;
|
|
227
|
+
/**
|
|
228
|
+
* `'enter'`: Enter sends and Shift+Enter breaks
|
|
229
|
+
* the line. `'mod+enter'`: Cmd+Enter (Ctrl+Enter elsewhere) sends and Enter breaks the line.
|
|
230
|
+
*/
|
|
231
|
+
submitKey?: 'enter' | 'mod+enter';
|
|
232
|
+
/**
|
|
233
|
+
* Whether an agent is working: Send becomes Stop.
|
|
234
|
+
*/
|
|
235
|
+
busy?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Whether the send key holds a message back while the agent works.
|
|
238
|
+
* It is sent when the agent is no longer busy, one message each time busy ends, in order. The queue
|
|
239
|
+
* lives as long as the composer: it is not kept with the draft.
|
|
240
|
+
*/
|
|
241
|
+
queue?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Most messages that wait at once. At the limit the send key is
|
|
244
|
+
* refused, and the hint says why.
|
|
245
|
+
*/
|
|
246
|
+
queueLimit?: number;
|
|
247
|
+
/**
|
|
248
|
+
* Whether the composer takes no input.
|
|
249
|
+
*/
|
|
250
|
+
disabled?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether files can be attached: an Attach button, paste,
|
|
253
|
+
* and drop.
|
|
254
|
+
*/
|
|
255
|
+
attachments?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* File types accepted, in the `<input type="file">` syntax
|
|
258
|
+
* (`'image/*,.pdf'`). Empty accepts every file.
|
|
259
|
+
*/
|
|
260
|
+
accept?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Most files one message carries.
|
|
263
|
+
*/
|
|
264
|
+
maxFiles?: number;
|
|
265
|
+
/**
|
|
266
|
+
* Enables `@` mentions.
|
|
267
|
+
*/
|
|
268
|
+
mentions?: MentionSource | null;
|
|
269
|
+
/**
|
|
270
|
+
* Commands opened by `/` on an empty text, in a
|
|
271
|
+
* Launcher; an item with `items` opens a page of further commands.
|
|
272
|
+
*/
|
|
273
|
+
commands?: LauncherItem[] | null;
|
|
274
|
+
/**
|
|
275
|
+
* Initial context chips.
|
|
276
|
+
*/
|
|
277
|
+
context?: ContextChip[];
|
|
278
|
+
/**
|
|
279
|
+
* Quiet text in the bar beside Send.
|
|
280
|
+
*/
|
|
281
|
+
hint?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Quiet line under the composer.
|
|
284
|
+
*/
|
|
285
|
+
note?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Key the unsent text is kept under (through `storage()`),
|
|
288
|
+
* restored on create and cleared on send.
|
|
289
|
+
*/
|
|
290
|
+
draftKey?: string | null;
|
|
291
|
+
/**
|
|
292
|
+
* Rows the text never shrinks below, even when empty. Capped at
|
|
293
|
+
* `maxRows`.
|
|
294
|
+
*/
|
|
295
|
+
minRows?: number;
|
|
296
|
+
/**
|
|
297
|
+
* Rows the text grows to before it scrolls.
|
|
298
|
+
*/
|
|
299
|
+
maxRows?: number;
|
|
300
|
+
/**
|
|
301
|
+
* Glyph names for the Attach and Commands
|
|
302
|
+
* buttons (a paperclip, a book) where the application registered its own.
|
|
303
|
+
*/
|
|
304
|
+
icons?: {
|
|
305
|
+
attach?: string;
|
|
306
|
+
commands?: string;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Further icon buttons in the bar, after Attach and Commands.
|
|
310
|
+
* An entry without `id`, `label` or `icon` is left out, as is a repeated id.
|
|
311
|
+
*/
|
|
312
|
+
tools?: ComposerTool[];
|
|
313
|
+
/**
|
|
314
|
+
* Visible text beside the Send glyph (`'Start task'`), which
|
|
315
|
+
* is then also its accessible name; while busy the button reads `composer.stop`. Null keeps Send
|
|
316
|
+
* icon-only. In a composer narrower than 24rem the text is visually hidden and stays the name.
|
|
317
|
+
*/
|
|
318
|
+
sendLabel?: string | null;
|
|
319
|
+
/**
|
|
320
|
+
* Localized messages.
|
|
321
|
+
*/
|
|
322
|
+
msg?: Record<string, string> | Record<string, Record<string, string>>;
|
|
323
|
+
/**
|
|
324
|
+
* Preventable send listener.
|
|
325
|
+
*/
|
|
326
|
+
onsend?: (event: CustomEvent<ComposerSendDetail>) => void;
|
|
327
|
+
/**
|
|
328
|
+
* Stop listener.
|
|
329
|
+
*/
|
|
330
|
+
onstop?: (event: CustomEvent<Record<string, never>>) => void;
|
|
331
|
+
/**
|
|
332
|
+
* Text listener.
|
|
333
|
+
*/
|
|
334
|
+
oninput?: (event: CustomEvent<{
|
|
335
|
+
text: string;
|
|
336
|
+
}>) => void;
|
|
337
|
+
/**
|
|
338
|
+
* Preventable attach listener.
|
|
339
|
+
*/
|
|
340
|
+
onattach?: (event: CustomEvent<{
|
|
341
|
+
files: File[];
|
|
342
|
+
}>) => void;
|
|
343
|
+
/**
|
|
344
|
+
* Chip removal listener.
|
|
345
|
+
*/
|
|
346
|
+
onremove?: (event: CustomEvent<ComposerRemoveDetail>) => void;
|
|
347
|
+
/**
|
|
348
|
+
* Mention listener.
|
|
349
|
+
*/
|
|
350
|
+
onmention?: (event: CustomEvent<{
|
|
351
|
+
item: MentionItem;
|
|
352
|
+
}>) => void;
|
|
353
|
+
/**
|
|
354
|
+
* Command listener.
|
|
355
|
+
*/
|
|
356
|
+
oncommand?: (event: CustomEvent<{
|
|
357
|
+
item: LauncherItem;
|
|
358
|
+
}>) => void;
|
|
359
|
+
/**
|
|
360
|
+
* Tool listener.
|
|
361
|
+
*/
|
|
362
|
+
ontool?: (event: CustomEvent<ComposerToolDetail>) => void;
|
|
363
|
+
/**
|
|
364
|
+
* Listener for a message being
|
|
365
|
+
* queued.
|
|
366
|
+
*/
|
|
367
|
+
onqueue?: (event: CustomEvent<ComposerQueueDetail>) => void;
|
|
368
|
+
/**
|
|
369
|
+
* Listener for a message
|
|
370
|
+
* leaving the queue.
|
|
371
|
+
*/
|
|
372
|
+
ondequeue?: (event: CustomEvent<ComposerDequeueDetail>) => void;
|
|
373
|
+
/**
|
|
374
|
+
* Listener for
|
|
375
|
+
* ArrowUp on an empty text.
|
|
376
|
+
*/
|
|
377
|
+
onhistoryprevious?: (event: CustomEvent<Record<string, never>>) => void;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Where a mention starts and what has been typed of it: the text after the trigger up to the caret,
|
|
381
|
+
* when the trigger opens a word and the query holds no whitespace.
|
|
382
|
+
* @param {string} text The whole text.
|
|
383
|
+
* @param {number} caret Caret offset.
|
|
384
|
+
* @param {string} [trigger='@'] Character that starts a mention.
|
|
385
|
+
* @returns {{start: number, query: string}|null}
|
|
386
|
+
*/
|
|
387
|
+
export declare function mentionQuery(text: string, caret: number, trigger?: string): {
|
|
388
|
+
start: number;
|
|
389
|
+
query: string;
|
|
390
|
+
} | null;
|
|
391
|
+
/**
|
|
392
|
+
* The items that match a mention query, best first: a label that starts with it, then a word in
|
|
393
|
+
* the label that does, then a label or description that contains it. Case and accents are ignored;
|
|
394
|
+
* items that rank the same keep their order. An empty query keeps every item.
|
|
395
|
+
* @param {MentionItem[]} items
|
|
396
|
+
* @param {string} query
|
|
397
|
+
* @returns {MentionItem[]}
|
|
398
|
+
*/
|
|
399
|
+
export declare function filterMentions(items: MentionItem[], query: string): MentionItem[];
|
|
400
|
+
/**
|
|
401
|
+
* The picked mentions whose `@<label>` is still in the text, each once.
|
|
402
|
+
* @param {string} text
|
|
403
|
+
* @param {MentionItem[]} mentions Mentions in the order they were picked.
|
|
404
|
+
* @param {string} [trigger='@']
|
|
405
|
+
* @returns {MentionItem[]}
|
|
406
|
+
*/
|
|
407
|
+
export declare function mentionsInText(text: string, mentions: MentionItem[], trigger?: string): MentionItem[];
|
|
408
|
+
/**
|
|
409
|
+
* Whether a key press sends. A press during an IME composition never does.
|
|
410
|
+
* @param {{key: string, shiftKey?: boolean, metaKey?: boolean, ctrlKey?: boolean, altKey?: boolean,
|
|
411
|
+
* isComposing?: boolean, keyCode?: number}} event Key event, or its fields.
|
|
412
|
+
* @param {'enter'|'mod+enter'} [submitKey='enter']
|
|
413
|
+
* @param {{apple?: boolean}} [platform] `apple`: whether Mod is Cmd (otherwise Ctrl). Read from the
|
|
414
|
+
* browser when omitted.
|
|
415
|
+
* @returns {boolean}
|
|
416
|
+
*/
|
|
417
|
+
export declare function isSubmitKey(event: {
|
|
418
|
+
key: string;
|
|
419
|
+
shiftKey?: boolean;
|
|
420
|
+
metaKey?: boolean;
|
|
421
|
+
ctrlKey?: boolean;
|
|
422
|
+
altKey?: boolean;
|
|
423
|
+
isComposing?: boolean;
|
|
424
|
+
keyCode?: number;
|
|
425
|
+
}, submitKey?: 'enter' | 'mod+enter', { apple }?: {
|
|
426
|
+
apple?: boolean;
|
|
427
|
+
}): boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Whether a file matches an `accept` list in the `<input type="file">` syntax: extensions
|
|
430
|
+
* (`.pdf`), whole MIME types (`application/json`), and MIME groups (`image/*`).
|
|
431
|
+
* @param {{name?: string, type?: string}} file
|
|
432
|
+
* @param {string} [accept='']
|
|
433
|
+
* @returns {boolean}
|
|
434
|
+
*/
|
|
435
|
+
export declare function acceptsFile(file: {
|
|
436
|
+
name?: string;
|
|
437
|
+
type?: string;
|
|
438
|
+
}, accept?: string): boolean;
|
|
439
|
+
/**
|
|
440
|
+
* The rows the text spans at least and at most: whole numbers of one or more, the least never above
|
|
441
|
+
* the most.
|
|
442
|
+
* @param {number} [minRows=1]
|
|
443
|
+
* @param {number} [maxRows=10]
|
|
444
|
+
* @returns {{min: number, max: number}}
|
|
445
|
+
*/
|
|
446
|
+
export declare function rowRange(minRows?: number, maxRows?: number): {
|
|
447
|
+
min: number;
|
|
448
|
+
max: number;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* The height an auto-growing text area takes for its content: at least `minRows` lines, at most
|
|
452
|
+
* `maxRows`, scrolling beyond that.
|
|
453
|
+
* @param {number} scrollHeight The content height, padding included (`textarea.scrollHeight`).
|
|
454
|
+
* @param {{lineHeight: number, padding?: number, border?: number, minRows?: number, maxRows?: number}} metrics
|
|
455
|
+
* Line height and the block padding and border, in pixels.
|
|
456
|
+
* @returns {{height: number, scrolls: boolean}} The border-box height, and whether the content
|
|
457
|
+
* overflows it.
|
|
458
|
+
*/
|
|
459
|
+
export declare function autosizeHeight(scrollHeight: number, { lineHeight, padding, border, minRows, maxRows }: {
|
|
460
|
+
lineHeight: number;
|
|
461
|
+
padding?: number;
|
|
462
|
+
border?: number;
|
|
463
|
+
minRows?: number;
|
|
464
|
+
maxRows?: number;
|
|
465
|
+
}): {
|
|
466
|
+
height: number;
|
|
467
|
+
scrolls: boolean;
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* The bar's extra tools as the composer draws them: entries without an `id`, a non-empty `label`
|
|
471
|
+
* or an `icon` are left out, a repeated id keeps its first entry, `id`, `label` and `icon` become
|
|
472
|
+
* strings, `disabled` a boolean, and `pressed` stays only when it is a boolean. Any other field the
|
|
473
|
+
* application put on a tool is kept, and handed back in `tool`.
|
|
474
|
+
* @param {unknown} tools
|
|
475
|
+
* @returns {ComposerTool[]}
|
|
476
|
+
*/
|
|
477
|
+
export declare function normalizeTools(tools: unknown): ComposerTool[];
|
|
478
|
+
/**
|
|
479
|
+
* A message box for talking to an agent: a text that grows with what is written, Send (Stop while
|
|
480
|
+
* the agent works), attachments, `@` mentions, `/` commands, and context chips. It keeps nothing
|
|
481
|
+
* but the unsent message: sending hands the text, files, mentions and context to the application,
|
|
482
|
+
* which owns the conversation. With `queue`, a message written while the agent works waits here
|
|
483
|
+
* until it is no longer busy.
|
|
484
|
+
*
|
|
485
|
+
* @fires Composer#send
|
|
486
|
+
* @fires Composer#stop
|
|
487
|
+
* @fires Composer#input
|
|
488
|
+
* @fires Composer#attach
|
|
489
|
+
* @fires Composer#remove
|
|
490
|
+
* @fires Composer#mention
|
|
491
|
+
* @fires Composer#command
|
|
492
|
+
* @fires Composer#tool
|
|
493
|
+
* @fires Composer#queue
|
|
494
|
+
* @fires Composer#dequeue
|
|
495
|
+
* @fires Composer#historyprevious
|
|
496
|
+
* @extends {Component<ComposerOptions>}
|
|
497
|
+
*/
|
|
498
|
+
export declare class Composer extends Component<ComposerOptions> {
|
|
499
|
+
_original: import("../../core/dom.js").TargetSnapshot;
|
|
500
|
+
/** @type {{id: string, file: File}[]} */
|
|
501
|
+
_files: {
|
|
502
|
+
id: string;
|
|
503
|
+
file: File;
|
|
504
|
+
}[];
|
|
505
|
+
/** @type {ContextChip[]} */
|
|
506
|
+
_context: ContextChip[];
|
|
507
|
+
/** @type {MentionItem[]} */
|
|
508
|
+
_mentions: MentionItem[];
|
|
509
|
+
/** @type {{start: number, end: number, items: MentionItem[], index: number}|null} */
|
|
510
|
+
_mention: {
|
|
511
|
+
start: number;
|
|
512
|
+
end: number;
|
|
513
|
+
items: MentionItem[];
|
|
514
|
+
index: number;
|
|
515
|
+
} | null;
|
|
516
|
+
_mentionSequence: number;
|
|
517
|
+
/** @type {import('../../core/position.js').PositionController|null} */
|
|
518
|
+
_position: import('../../core/position.js').PositionController | null;
|
|
519
|
+
/** @type {Launcher|null} */
|
|
520
|
+
_launcher: Launcher | null;
|
|
521
|
+
_announced: any;
|
|
522
|
+
_busy: boolean;
|
|
523
|
+
_disabled: boolean;
|
|
524
|
+
_destroyed: boolean;
|
|
525
|
+
_width: any;
|
|
526
|
+
/** What the Send button last drew: mode, send key and label, so it redraws only on a change. */
|
|
527
|
+
_sendDrawn: any;
|
|
528
|
+
/** @type {QueuedMessage[]} Session state: never saved with the draft. */
|
|
529
|
+
_queue: QueuedMessage[];
|
|
530
|
+
_queueLimit: number;
|
|
531
|
+
/** Whether the send key was refused at the limit, which the hint then says. */
|
|
532
|
+
_queueRefused: boolean;
|
|
533
|
+
/** @type {{destroy: () => void}[]} The keyboard of each queued row. */
|
|
534
|
+
_queueRoving: {
|
|
535
|
+
destroy: () => void;
|
|
536
|
+
}[];
|
|
537
|
+
/** Whether a queued message is being sent, and whether busy ended again meanwhile. */
|
|
538
|
+
_sendingQueued: boolean;
|
|
539
|
+
_busyEndedAgain: boolean;
|
|
540
|
+
/** The application's hint, which `_syncHint()` shows unless the queue has something to say. */
|
|
541
|
+
_hint: string;
|
|
542
|
+
_mentionSource: {
|
|
543
|
+
trigger: string;
|
|
544
|
+
items: MentionSource['items'];
|
|
545
|
+
};
|
|
546
|
+
_commands: import("../launcher/launcher.js").LauncherItem[];
|
|
547
|
+
_draft: import("../../core/storage.js").NamespacedStorage;
|
|
548
|
+
_tools: ComposerTool[];
|
|
549
|
+
_sendLabel: string;
|
|
550
|
+
_rows: {
|
|
551
|
+
min: number;
|
|
552
|
+
max: number;
|
|
553
|
+
};
|
|
554
|
+
/** @type {'enter'|'mod+enter'} */
|
|
555
|
+
_submitKey: 'enter' | 'mod+enter';
|
|
556
|
+
_input: HTMLTextAreaElement;
|
|
557
|
+
_observer: ResizeObserver;
|
|
558
|
+
static cssName: string;
|
|
559
|
+
/** @type {Readonly<ComposerOptions>} */
|
|
560
|
+
static defaults: Readonly<ComposerOptions>;
|
|
561
|
+
/** @returns {HTMLElement} */
|
|
562
|
+
render(): HTMLElement;
|
|
563
|
+
/** Focuses the text. @returns {this} */
|
|
564
|
+
focus(): this;
|
|
565
|
+
/** @returns {string} The text as written. */
|
|
566
|
+
getValue(): string;
|
|
567
|
+
/**
|
|
568
|
+
* Replaces the text, keeps the draft in step, and puts the caret at the end. Emits nothing.
|
|
569
|
+
* @param {string} text
|
|
570
|
+
* @returns {this}
|
|
571
|
+
*/
|
|
572
|
+
setValue(text: string): this;
|
|
573
|
+
/**
|
|
574
|
+
* Types text at the caret, replacing any selection, as if the person had typed it: the draft
|
|
575
|
+
* follows, and text ending in the mention trigger (`'@'`) opens the suggestions. Emits `input`.
|
|
576
|
+
* Use it for a button that starts a mention or inserts a snippet.
|
|
577
|
+
* @param {string} text
|
|
578
|
+
* @returns {this}
|
|
579
|
+
*/
|
|
580
|
+
insertText(text: string): this;
|
|
581
|
+
/**
|
|
582
|
+
* Empties the text, the attachments and the draft. Context chips stay. Emits nothing.
|
|
583
|
+
* @returns {this}
|
|
584
|
+
*/
|
|
585
|
+
clear(): this;
|
|
586
|
+
/**
|
|
587
|
+
* Shows Stop in place of Send while an agent works; Escape in the text then emits `stop`. When
|
|
588
|
+
* busy ends, the first queued message is sent; the next waits for the next time it ends.
|
|
589
|
+
* @param {boolean} busy
|
|
590
|
+
* @returns {this}
|
|
591
|
+
* @fires Composer#send
|
|
592
|
+
* @fires Composer#dequeue
|
|
593
|
+
*/
|
|
594
|
+
setBusy(busy: boolean): this;
|
|
595
|
+
/** @returns {boolean} Whether Stop is showing. */
|
|
596
|
+
isBusy(): boolean;
|
|
597
|
+
/**
|
|
598
|
+
* Changes the quiet text in the bar beside Send — what Enter does now, or why sending waits.
|
|
599
|
+
* An empty text hides it.
|
|
600
|
+
* @param {string} text
|
|
601
|
+
* @returns {this}
|
|
602
|
+
*/
|
|
603
|
+
setHint(text: string): this;
|
|
604
|
+
/**
|
|
605
|
+
* Changes the line under the composer, which also describes the text box. An empty text hides
|
|
606
|
+
* it.
|
|
607
|
+
* @param {string} text
|
|
608
|
+
* @returns {this}
|
|
609
|
+
*/
|
|
610
|
+
setNote(text: string): this;
|
|
611
|
+
/**
|
|
612
|
+
* Turns input on or off.
|
|
613
|
+
* @param {boolean} disabled
|
|
614
|
+
* @returns {this}
|
|
615
|
+
*/
|
|
616
|
+
setDisabled(disabled: boolean): this;
|
|
617
|
+
/**
|
|
618
|
+
* Changes the composer in place: the text, its caret and selection, the focus, the attachments,
|
|
619
|
+
* the context chips and the draft all stay. This is how a placeholder follows the model picked
|
|
620
|
+
* beside the composer. Keys left out (or `undefined`) are kept; other keys are ignored. Emits
|
|
621
|
+
* nothing.
|
|
622
|
+
* @param {ComposerUpdate} [partial={}]
|
|
623
|
+
* @returns {this}
|
|
624
|
+
*/
|
|
625
|
+
update(partial?: ComposerUpdate): this;
|
|
626
|
+
/**
|
|
627
|
+
* Replaces the bar's extra tools. A tool that held the focus keeps it when a tool with the same
|
|
628
|
+
* id is still there (and enabled); otherwise the focus moves to the text. Emits nothing.
|
|
629
|
+
* @param {ComposerTool[]} tools
|
|
630
|
+
* @returns {this}
|
|
631
|
+
*/
|
|
632
|
+
setTools(tools: ComposerTool[]): this;
|
|
633
|
+
/**
|
|
634
|
+
* Presses or releases a tool, which makes it a toggle if it was a plain button. Emits nothing.
|
|
635
|
+
* @param {string} id
|
|
636
|
+
* @param {boolean} pressed
|
|
637
|
+
* @returns {this}
|
|
638
|
+
*/
|
|
639
|
+
setToolPressed(id: string, pressed: boolean): this;
|
|
640
|
+
/**
|
|
641
|
+
* Attaches files, as far as `accept` and `maxFiles` allow. Emits `attach` with the files taken.
|
|
642
|
+
* @param {FileList|File[]} files
|
|
643
|
+
* @returns {this}
|
|
644
|
+
*/
|
|
645
|
+
addFiles(files: FileList | File[]): this;
|
|
646
|
+
/** @returns {File[]} The attached files. */
|
|
647
|
+
getFiles(): File[];
|
|
648
|
+
/**
|
|
649
|
+
* Adds a context chip, or replaces the chip with the same id. Emits nothing.
|
|
650
|
+
* @param {ContextChip} chip
|
|
651
|
+
* @returns {this}
|
|
652
|
+
*/
|
|
653
|
+
addContext(chip: ContextChip): this;
|
|
654
|
+
/**
|
|
655
|
+
* Removes a context chip. Emits nothing.
|
|
656
|
+
* @param {string} id
|
|
657
|
+
* @returns {this}
|
|
658
|
+
*/
|
|
659
|
+
removeContext(id: string): this;
|
|
660
|
+
/** @returns {ContextChip[]} The context chips. */
|
|
661
|
+
getContext(): ContextChip[];
|
|
662
|
+
/** @returns {QueuedMessage[]} Copies of the queued messages, the next to be sent first. */
|
|
663
|
+
getQueue(): QueuedMessage[];
|
|
664
|
+
/**
|
|
665
|
+
* Removes every queued message. Emits `dequeue` for each, with `reason: 'cleared'`. Stop does not
|
|
666
|
+
* do this: call it from a `stop` listener to drop what was waiting along with the run.
|
|
667
|
+
* @returns {this}
|
|
668
|
+
* @fires Composer#dequeue
|
|
669
|
+
*/
|
|
670
|
+
clearQueue(): this;
|
|
671
|
+
/**
|
|
672
|
+
* Removes one queued message. Emits `dequeue` with `reason: 'removed'`. An id that is not queued,
|
|
673
|
+
* because the message has been sent, say, changes nothing.
|
|
674
|
+
* @param {string} id
|
|
675
|
+
* @returns {this}
|
|
676
|
+
* @fires Composer#dequeue
|
|
677
|
+
*/
|
|
678
|
+
removeQueued(id: string): this;
|
|
679
|
+
/**
|
|
680
|
+
* Removes what the composer drew and the launcher it opened, drops the queue, and stops listening.
|
|
681
|
+
* @returns {void}
|
|
682
|
+
*/
|
|
683
|
+
destroy(): void;
|
|
684
|
+
/** @private @returns {void} */
|
|
685
|
+
private _onInput;
|
|
686
|
+
/** @private @returns {void} */
|
|
687
|
+
private _afterTextChange;
|
|
688
|
+
/** @private @returns {void} */
|
|
689
|
+
private _saveDraft;
|
|
690
|
+
/** Grows the text with its content, between `minRows` and `maxRows`. @private @returns {void} */
|
|
691
|
+
private _autosize;
|
|
692
|
+
/**
|
|
693
|
+
* @private
|
|
694
|
+
* @param {KeyboardEvent} event
|
|
695
|
+
* @returns {void}
|
|
696
|
+
*/
|
|
697
|
+
private _onKeydown;
|
|
698
|
+
/**
|
|
699
|
+
* The message as it stands in the composer, or null when there is nothing to send.
|
|
700
|
+
* @private
|
|
701
|
+
* @returns {ComposerSendDetail|null}
|
|
702
|
+
*/
|
|
703
|
+
private _message;
|
|
704
|
+
/** @private @returns {void} @fires Composer#send @fires Composer#queue */
|
|
705
|
+
private _send;
|
|
706
|
+
/** @private @returns {void} @fires Composer#stop */
|
|
707
|
+
private _stop;
|
|
708
|
+
/**
|
|
709
|
+
* The Send button's glyph, text, name and readiness. With `sendLabel` the text is visible and is
|
|
710
|
+
* the name; without it the button is a glyph named by `aria-label` alone.
|
|
711
|
+
* @private
|
|
712
|
+
* @returns {void}
|
|
713
|
+
*/
|
|
714
|
+
private _syncSend;
|
|
715
|
+
/** The quiet text beside Send: why the queue refused, else the application's. @private @returns {void} */
|
|
716
|
+
private _syncHint;
|
|
717
|
+
/** Disabled state on the text and the buttons. @private @returns {void} */
|
|
718
|
+
private _syncState;
|
|
719
|
+
/**
|
|
720
|
+
* The accessible name for a `label` option: the text given, or the `composer.label` message.
|
|
721
|
+
* @private
|
|
722
|
+
* @param {string|null|undefined} label
|
|
723
|
+
* @returns {string}
|
|
724
|
+
*/
|
|
725
|
+
private _labelText;
|
|
726
|
+
/**
|
|
727
|
+
* Draws the extra tools, and puts the focus back on the tool that held it.
|
|
728
|
+
* @private
|
|
729
|
+
* @returns {void}
|
|
730
|
+
*/
|
|
731
|
+
private _renderTools;
|
|
732
|
+
/**
|
|
733
|
+
* @private
|
|
734
|
+
* @param {string} id
|
|
735
|
+
* @returns {HTMLButtonElement|null}
|
|
736
|
+
*/
|
|
737
|
+
private _toolButton;
|
|
738
|
+
/**
|
|
739
|
+
* @private
|
|
740
|
+
* @param {MouseEvent} event
|
|
741
|
+
* @returns {void}
|
|
742
|
+
* @fires Composer#tool
|
|
743
|
+
*/
|
|
744
|
+
private _onToolClick;
|
|
745
|
+
/**
|
|
746
|
+
* Opens, filters or closes the suggestions from the word the caret is in.
|
|
747
|
+
* @private
|
|
748
|
+
* @returns {void}
|
|
749
|
+
*/
|
|
750
|
+
private _updateMentions;
|
|
751
|
+
/**
|
|
752
|
+
* @private
|
|
753
|
+
* @param {number} start Offset of the trigger.
|
|
754
|
+
* @param {number} end Caret offset.
|
|
755
|
+
* @param {MentionItem[]} items
|
|
756
|
+
* @returns {void}
|
|
757
|
+
*/
|
|
758
|
+
private _showMentions;
|
|
759
|
+
/**
|
|
760
|
+
* @private
|
|
761
|
+
* @param {number} index
|
|
762
|
+
* @returns {void}
|
|
763
|
+
*/
|
|
764
|
+
private _highlight;
|
|
765
|
+
/** @private @returns {void} */
|
|
766
|
+
private _closeMentions;
|
|
767
|
+
/**
|
|
768
|
+
* Writes `@<label> ` where the mention was typed and records the item.
|
|
769
|
+
* @private
|
|
770
|
+
* @param {number} index
|
|
771
|
+
* @returns {void}
|
|
772
|
+
* @fires Composer#mention
|
|
773
|
+
*/
|
|
774
|
+
private _pickMention;
|
|
775
|
+
/**
|
|
776
|
+
* Sets the polite status, once per change.
|
|
777
|
+
* @private
|
|
778
|
+
* @param {string} text
|
|
779
|
+
* @param {boolean} [again=false] Whether the same text is news again: a no-break space then tells
|
|
780
|
+
* it apart from the last time, because a live region says nothing about a text that did not change.
|
|
781
|
+
* @returns {void}
|
|
782
|
+
*/
|
|
783
|
+
private _announce;
|
|
784
|
+
/**
|
|
785
|
+
* Holds the message back until the agent is no longer busy, or refuses it at the limit: the
|
|
786
|
+
* message then stays where it was written.
|
|
787
|
+
* @private
|
|
788
|
+
* @returns {void}
|
|
789
|
+
* @fires Composer#queue
|
|
790
|
+
*/
|
|
791
|
+
private _enqueue;
|
|
792
|
+
/**
|
|
793
|
+
* Sends the first queued message for an end of busy. A `send` listener that ends busy again,
|
|
794
|
+
* before it returns, does not send from inside this one: the next message goes when it is done.
|
|
795
|
+
* @private
|
|
796
|
+
* @returns {void}
|
|
797
|
+
*/
|
|
798
|
+
private _sendNextQueued;
|
|
799
|
+
/**
|
|
800
|
+
* Sends the first queued message, unless it must wait. What is being written stays: it is not the
|
|
801
|
+
* message that goes. A prevented `send` was not sent, so the message stays first in line.
|
|
802
|
+
* @private
|
|
803
|
+
* @returns {void}
|
|
804
|
+
* @fires Composer#send
|
|
805
|
+
* @fires Composer#dequeue
|
|
806
|
+
*/
|
|
807
|
+
private _sendQueued;
|
|
808
|
+
/**
|
|
809
|
+
* @private
|
|
810
|
+
* @param {QueuedMessage} item
|
|
811
|
+
* @param {ComposerDequeueDetail['reason']} reason
|
|
812
|
+
* @returns {void}
|
|
813
|
+
* @fires Composer#dequeue
|
|
814
|
+
*/
|
|
815
|
+
private _emitDequeue;
|
|
816
|
+
/**
|
|
817
|
+
* Takes a queued message back into the composer, asking first when that would replace what is
|
|
818
|
+
* being written. The message may have been sent while the question was open; nothing happens then.
|
|
819
|
+
* @private
|
|
820
|
+
* @param {string} id
|
|
821
|
+
* @returns {Promise<void>}
|
|
822
|
+
* @fires Composer#dequeue
|
|
823
|
+
* @fires Composer#input
|
|
824
|
+
*/
|
|
825
|
+
private _editQueued;
|
|
826
|
+
/**
|
|
827
|
+
* @private
|
|
828
|
+
* @param {MouseEvent} event
|
|
829
|
+
* @returns {void}
|
|
830
|
+
*/
|
|
831
|
+
private _onQueueClick;
|
|
832
|
+
/**
|
|
833
|
+
* Delete on a focused row removes it. The arrow keys inside a row belong to its toolbar.
|
|
834
|
+
* @private
|
|
835
|
+
* @param {KeyboardEvent} event
|
|
836
|
+
* @returns {void}
|
|
837
|
+
*/
|
|
838
|
+
private _onQueueKeydown;
|
|
839
|
+
/**
|
|
840
|
+
* Draws the queue, and keeps the focus in it: on the same button of the same row, on the row now
|
|
841
|
+
* in that place when the row has gone, and in the text when no row is left.
|
|
842
|
+
* @private
|
|
843
|
+
* @returns {void}
|
|
844
|
+
*/
|
|
845
|
+
private _renderQueue;
|
|
846
|
+
/**
|
|
847
|
+
* One queued message on one line: its text, or the names of its files when it has none, and a
|
|
848
|
+
* toolbar named by that line.
|
|
849
|
+
* @private
|
|
850
|
+
* @param {QueuedMessage} item
|
|
851
|
+
* @returns {HTMLElement}
|
|
852
|
+
*/
|
|
853
|
+
private _queueRow;
|
|
854
|
+
/**
|
|
855
|
+
* @private
|
|
856
|
+
* @param {'edit'|'remove'} action
|
|
857
|
+
* @param {string} label
|
|
858
|
+
* @returns {HTMLElement}
|
|
859
|
+
*/
|
|
860
|
+
private _queueButton;
|
|
861
|
+
/** @private @returns {void} */
|
|
862
|
+
private _releaseQueueRoving;
|
|
863
|
+
/**
|
|
864
|
+
* Opens the commands in a launcher, created on first use.
|
|
865
|
+
* @private
|
|
866
|
+
* @returns {void}
|
|
867
|
+
* @fires Composer#command
|
|
868
|
+
*/
|
|
869
|
+
private _openCommands;
|
|
870
|
+
/**
|
|
871
|
+
* @private
|
|
872
|
+
* @param {File[]} files
|
|
873
|
+
* @param {boolean} fromPicker Whether the files came through the file input, which applied
|
|
874
|
+
* `accept` already.
|
|
875
|
+
* @returns {void}
|
|
876
|
+
* @fires Composer#attach
|
|
877
|
+
*/
|
|
878
|
+
private _addFiles;
|
|
879
|
+
/**
|
|
880
|
+
* @private
|
|
881
|
+
* @param {ClipboardEvent} event
|
|
882
|
+
* @returns {void}
|
|
883
|
+
*/
|
|
884
|
+
private _onPaste;
|
|
885
|
+
/**
|
|
886
|
+
* @private
|
|
887
|
+
* @param {DragEvent} event
|
|
888
|
+
* @returns {void}
|
|
889
|
+
*/
|
|
890
|
+
private _onDrag;
|
|
891
|
+
/**
|
|
892
|
+
* @private
|
|
893
|
+
* @param {DragEvent} event
|
|
894
|
+
* @returns {void}
|
|
895
|
+
*/
|
|
896
|
+
private _onDrop;
|
|
897
|
+
/**
|
|
898
|
+
* @private
|
|
899
|
+
* @param {boolean} dropping
|
|
900
|
+
* @returns {void}
|
|
901
|
+
*/
|
|
902
|
+
private _setDropping;
|
|
903
|
+
/**
|
|
904
|
+
* @private
|
|
905
|
+
* @param {ContextChip} chip
|
|
906
|
+
* @returns {void}
|
|
907
|
+
*/
|
|
908
|
+
private _putContext;
|
|
909
|
+
/** @private @returns {void} */
|
|
910
|
+
private _renderFiles;
|
|
911
|
+
/** @private @returns {void} */
|
|
912
|
+
private _renderContext;
|
|
913
|
+
/**
|
|
914
|
+
* @private
|
|
915
|
+
* @param {{kind: 'file'|'context', id: string, label: string, glyph: string|null, meta: string}} chip
|
|
916
|
+
* @returns {HTMLElement}
|
|
917
|
+
*/
|
|
918
|
+
private _chip;
|
|
919
|
+
/**
|
|
920
|
+
* Removes the chip whose button was pressed, and keeps the focus in the list.
|
|
921
|
+
* @private
|
|
922
|
+
* @param {MouseEvent} event
|
|
923
|
+
* @returns {void}
|
|
924
|
+
* @fires Composer#remove
|
|
925
|
+
*/
|
|
926
|
+
private _onChipClick;
|
|
927
|
+
}
|
|
928
|
+
/** Fired when the message is sent; preventable, which keeps the text and files. @event Composer#send @type {CustomEvent<ComposerSendDetail>} */
|
|
929
|
+
/** Fired when Stop is pressed, or Escape in the text while busy. @event Composer#stop @type {CustomEvent<Record<string, never>>} */
|
|
930
|
+
/** Fired when the reader changes the text. @event Composer#input @type {CustomEvent<{text: string}>} */
|
|
931
|
+
/** Fired before files are attached; preventable. @event Composer#attach @type {CustomEvent<{files: File[]}>} */
|
|
932
|
+
/** Fired after the reader removes an attachment or a context chip. @event Composer#remove @type {CustomEvent<ComposerRemoveDetail>} */
|
|
933
|
+
/** Fired when a suggestion is picked. @event Composer#mention @type {CustomEvent<{item: MentionItem}>} */
|
|
934
|
+
/** Fired when a command is chosen. @event Composer#command @type {CustomEvent<{item: LauncherItem}>} */
|
|
935
|
+
/** Fired when one of the extra tools is pressed; the composer changes nothing itself. @event Composer#tool @type {CustomEvent<ComposerToolDetail>} */
|
|
936
|
+
/** Fired when a message is added to the queue. @event Composer#queue @type {CustomEvent<ComposerQueueDetail>} */
|
|
937
|
+
/** Fired when a message leaves the queue: sent, removed, taken back to edit, or cleared. @event Composer#dequeue @type {CustomEvent<ComposerDequeueDetail>} */
|
|
938
|
+
/** Fired for ArrowUp on an empty text. @event Composer#historyprevious @type {CustomEvent<Record<string, never>>} */
|