@ids-group-ltd/ids-design-system 1.0.3 → 1.1.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 +423 -3
- package/agent/INDEX.md +12 -2
- package/agent/feedback/ds-alert.md +3 -2
- package/agent/feedback/ds-attachment.md +12 -0
- package/agent/feedback/ds-chat-attachment.md +10 -0
- package/agent/feedback/ds-chat-message.md +11 -0
- package/agent/feedback/ds-chat-step.md +10 -0
- package/agent/feedback/ds-chat-steps.md +10 -0
- package/agent/feedback/ds-chat-thread.md +11 -0
- package/agent/feedback/ds-timeline-item.md +3 -1
- package/agent/feedback/ds-timeline.md +9 -0
- package/agent/feedback/ds-toast.md +1 -1
- package/agent/feedback/ds-tree.md +3 -1
- package/agent/forms/ds-chat-input.md +16 -0
- package/agent/forms/ds-inline-edit.md +14 -0
- package/agent/foundations/tokens.md +3 -3
- package/agent/navigation/ds-splitter.md +14 -0
- package/agent/platform/toast-service.md +3 -2
- package/agent/tables/ds-table.md +1 -1
- package/components.md +110 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs +928 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs +107 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +16 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs +465 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +74 -17
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +163 -20
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +4 -19
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +182 -24
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +31 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +74 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +4 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.11.2.json +1 -0
- package/migrations/1.0.1.json +4 -0
- package/migrations/1.0.2.json +37 -1
- package/migrations/1.1.0.json +208 -0
- package/migrations/1.1.1.json +190 -0
- package/migrations/README.md +6 -6
- package/package.json +25 -1
- package/schematics/check-overrides/surface.json +199 -6
- package/styles/_dropdown-overlay.scss +11 -6
- package/styles/_field-box.scss +2 -2
- package/styles/_step-marker.scss +51 -0
- package/styles/_tokens.scss +5 -3
- package/themes/README.md +2 -1
- package/themes/_semantic.scss +15 -0
- package/themes/dark/_palette.scss +1 -2
- package/themes/dark/_theme.scss +32 -3
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-chat.d.ts +377 -0
- package/types/ids-group-ltd-ids-design-system-components-inline-edit.d.ts +43 -0
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-splitter.d.ts +97 -0
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +34 -5
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +53 -4
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +87 -7
- package/types/ids-group-ltd-ids-design-system-components.d.ts +8 -4
- package/types/ids-group-ltd-ids-design-system-core.d.ts +126 -0
- package/types/ids-group-ltd-ids-design-system.d.ts +6 -3
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, input, model, inject, signal, effect, untracked, DestroyRef, computed, ViewEncapsulation, Component, contentChildren, forwardRef, booleanAttribute, output, contentChild, ElementRef, afterNextRender, Injector, viewChild } from '@angular/core';
|
|
3
|
+
import { DS_INTL, DS_INTL_DEFAULTS, injectDsLocale } from '@ids-group-ltd/ids-design-system/core';
|
|
4
|
+
import { ButtonComponent } from '@ids-group-ltd/ids-design-system/components/button';
|
|
5
|
+
import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
|
|
6
|
+
import { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';
|
|
7
|
+
import { TextareaComponent } from '@ids-group-ltd/ids-design-system/components/textarea';
|
|
8
|
+
import { FieldClickFocusDirective } from '@ids-group-ltd/ids-design-system/components';
|
|
9
|
+
|
|
10
|
+
const CHAT_THREAD = new InjectionToken('CHAT_THREAD');
|
|
11
|
+
const CHAT_STEPS = new InjectionToken('CHAT_STEPS');
|
|
12
|
+
|
|
13
|
+
const STATUS_ICONS = {
|
|
14
|
+
done: 'check',
|
|
15
|
+
waiting: 'pause',
|
|
16
|
+
error: 'x',
|
|
17
|
+
};
|
|
18
|
+
const STATUS_WORDING = {
|
|
19
|
+
done: 'stepDone',
|
|
20
|
+
running: 'stepRunning',
|
|
21
|
+
pending: 'stepPending',
|
|
22
|
+
waiting: 'stepWaiting',
|
|
23
|
+
error: 'stepFailed',
|
|
24
|
+
};
|
|
25
|
+
let nextId$1 = 0;
|
|
26
|
+
/**
|
|
27
|
+
* One step of an agent's work inside `ds-chat-steps`: a marker for its `status`, the heading, and
|
|
28
|
+
* optional content under it (such as Approve buttons on a `waiting` step). Slots: `[trailing]` at the
|
|
29
|
+
* end of the heading row (Stop, Retry), `[details]` behind a chevron (the step's log).
|
|
30
|
+
*/
|
|
31
|
+
class ChatStepComponent {
|
|
32
|
+
/** What the step does, such as "Run the build". */
|
|
33
|
+
heading = input('', ...(ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** Time or duration label under the content. */
|
|
35
|
+
time = input('', ...(ngDevMode ? [{ debugName: "time" }] : /* istanbul ignore next */ []));
|
|
36
|
+
/** Where the step is: draws the marker and is spoken before the heading. */
|
|
37
|
+
status = input(null, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Whether the `[details]` area is open, two-way bound. */
|
|
39
|
+
expanded = model(false, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
40
|
+
intl = inject(DS_INTL);
|
|
41
|
+
steps = inject(CHAT_STEPS, { optional: true });
|
|
42
|
+
detailsId = `ds-chat-step-${++nextId$1}-details`;
|
|
43
|
+
/** The status on screen: `status`, held back while `ds-chat-steps` paces an instant finish. */
|
|
44
|
+
shownStatus = signal(null, ...(ngDevMode ? [{ debugName: "shownStatus" }] : /* istanbul ignore next */ []));
|
|
45
|
+
runningSince = 0;
|
|
46
|
+
settleTimer;
|
|
47
|
+
constructor() {
|
|
48
|
+
let first = true;
|
|
49
|
+
effect(() => {
|
|
50
|
+
const next = this.status();
|
|
51
|
+
untracked(() => this.show(next, first));
|
|
52
|
+
first = false;
|
|
53
|
+
});
|
|
54
|
+
inject(DestroyRef).onDestroy(() => clearTimeout(this.settleTimer));
|
|
55
|
+
}
|
|
56
|
+
show(next, first) {
|
|
57
|
+
clearTimeout(this.settleTimer);
|
|
58
|
+
const settles = next === 'done' || next === 'error';
|
|
59
|
+
if (first || !settles || !this.steps) {
|
|
60
|
+
if (next === 'running') {
|
|
61
|
+
this.runningSince = performance.now();
|
|
62
|
+
}
|
|
63
|
+
this.shownStatus.set(next);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.shownStatus() !== 'running') {
|
|
67
|
+
this.runningSince = performance.now();
|
|
68
|
+
}
|
|
69
|
+
const delay = this.steps.settleDelay(this.runningSince);
|
|
70
|
+
if (delay <= 0) {
|
|
71
|
+
this.shownStatus.set(next);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.shownStatus.set('running');
|
|
75
|
+
this.settleTimer = setTimeout(() => this.shownStatus.set(next), delay);
|
|
76
|
+
}
|
|
77
|
+
isFirst = computed(() => this.steps?.firstStep() === this, ...(ngDevMode ? [{ debugName: "isFirst" }] : /* istanbul ignore next */ []));
|
|
78
|
+
isLast = computed(() => this.steps?.lastStep() === this, ...(ngDevMode ? [{ debugName: "isLast" }] : /* istanbul ignore next */ []));
|
|
79
|
+
nodeIcon = computed(() => {
|
|
80
|
+
const status = this.shownStatus();
|
|
81
|
+
return status ? (STATUS_ICONS[status] ?? null) : null;
|
|
82
|
+
}, ...(ngDevMode ? [{ debugName: "nodeIcon" }] : /* istanbul ignore next */ []));
|
|
83
|
+
wording = computed(() => ({
|
|
84
|
+
...DS_INTL_DEFAULTS.chat,
|
|
85
|
+
...this.intl().chat,
|
|
86
|
+
}), ...(ngDevMode ? [{ debugName: "wording" }] : /* istanbul ignore next */ []));
|
|
87
|
+
statusLabel = computed(() => {
|
|
88
|
+
const status = this.shownStatus();
|
|
89
|
+
return status ? this.wording()[STATUS_WORDING[status]] : '';
|
|
90
|
+
}, ...(ngDevMode ? [{ debugName: "statusLabel" }] : /* istanbul ignore next */ []));
|
|
91
|
+
detailsLabel = computed(() => this.wording().stepDetails(this.heading()), ...(ngDevMode ? [{ debugName: "detailsLabel" }] : /* istanbul ignore next */ []));
|
|
92
|
+
toggle() {
|
|
93
|
+
this.expanded.set(!this.expanded());
|
|
94
|
+
}
|
|
95
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
96
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChatStepComponent, isStandalone: true, selector: "ds-chat-step", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, time: { classPropertyName: "time", publicName: "time", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { attributes: { "role": "listitem" }, properties: { "attr.data-status": "shownStatus()", "class.is-first": "isFirst()", "class.is-last": "isLast()", "class.is-expanded": "expanded()", "class.outside-steps": "!steps" } }, ngImport: i0, template: "<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (shownStatus() === 'running') {\n <ds-spinner size=\"sm\" />\n } @else if (nodeIcon(); as name) {\n <ds-icon\n [name]=\"name\"\n [size]=\"10\"\n [stroke]=\"2.4\" />\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_step-node-size: var(--chat-step-node-size);--_step-spine-width: var(--timeline-spine-w);--_step-gap: var(--chat-step-gap);--_step-node-bg-color: var(--surface-secondary);--_step-node-color: var(--text-tertiary);--_step-node-border-color: var(--text-tertiary);--_step-spine-color: var(--border-divider);--_step-toggle-icon-color: var(--icon-default);--_step-toggle-icon-color-hover: var(--icon-strong);--_step-open-bg-color: var(--surface-secondary);display:grid;grid-template-columns:var(--_step-node-size) 1fr;column-gap:var(--space-2)}.node-col{grid-area:1/1;display:flex;flex-direction:column;align-items:center}.node{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--_step-node-size);height:var(--_step-node-size);border-radius:var(--radius-pill);background-color:var(--_step-node-bg-color);color:var(--_step-node-color);border:var(--border-width-default) solid var(--_step-node-border-color)}.spine{visibility:hidden;flex:1;width:var(--_step-spine-width);margin-top:var(--space-1);background-color:var(--_step-spine-color)}.lead{margin-top:0;margin-bottom:var(--space-1)}.tail{grid-area:2/1;justify-self:center;margin-top:0}.text{grid-area:1/2;display:flex;flex-direction:column;align-self:center;gap:var(--space-0-5);min-width:0}.rest{grid-area:2/2;padding-bottom:var(--_step-gap);min-width:0}:host(.is-last) .spine:not(.lead),:host(.outside-steps:last-child) .spine:not(.lead){visibility:hidden}:host(.is-last) .rest,:host(.outside-steps:last-child) .rest{padding-bottom:0}:host(.is-first) .lead,:host(.outside-steps:first-child) .lead{visibility:hidden}.head{position:relative;display:flex;align-items:flex-start;gap:var(--space-2);min-width:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.trailing{display:inline-flex;align-items:center;gap:var(--space-2);margin-left:auto;flex:none;height:calc(var(--font-size-xs) * var(--line-height-base))}.head:has(.trailing>:not(.toggle)){align-items:center;margin-bottom:var(--space-1-5);padding-top:var(--space-2)}.head:has(.trailing>:not(.toggle)) .trailing{height:auto}.toggle{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toggle:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toggle{position:relative}.toggle:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toggle:focus-visible{outline-style:none}.toggle:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toggle{color:var(--_step-toggle-icon-color)}.toggle:hover{color:var(--_step-toggle-icon-color-hover)}.toggle .chev{transition:transform var(--duration-base) var(--ease-standard)}.toggle[aria-expanded=true] .chev{transform:rotate(180deg)}:host:not(:has(.details-body>*)) .toggle{display:none}:host(.is-expanded){isolation:isolate}:host(.is-expanded):before{content:\"\";grid-area:1/1/3/3;z-index:-1;margin:0 calc(-1 * var(--space-2)) var(--_step-gap);border-radius:var(--ds-radius-control);background-color:var(--_step-open-bg-color)}:host(.is-expanded.is-last):before,:host(.is-expanded.outside-steps:last-child):before{margin-bottom:0}.details{display:grid;grid-template-rows:0fr;min-width:0;visibility:hidden;transition:grid-template-rows var(--duration-slow) var(--ease-decelerate),visibility var(--duration-slow) allow-discrete}.details:not(:has(.details-body>*)){display:none}:host(.is-expanded) .details{grid-template-rows:1fr;visibility:visible}.details-content{min-height:0;overflow:hidden}.details-body{padding-top:var(--space-1)}.heading{color:var(--text-primary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}.time{color:var(--text-tertiary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}:host([data-status=done]){--_step-node-bg-color: var(--success);--_step-node-color: var(--text-on-success);--_step-node-border-color: var(--success)}:host([data-status=running]){--_step-node-bg-color: var(--surface-default);--_step-node-color: var(--accent);--_step-node-border-color: var(--accent)}:host([data-status=pending]){--_step-node-bg-color: var(--surface-default);--_step-node-color: var(--text-tertiary);--_step-node-border-color: var(--text-tertiary)}:host([data-status=error]){--_step-node-bg-color: var(--error);--_step-node-color: var(--text-on-error);--_step-node-border-color: var(--error)}:host([data-status=pending]) .node{border-style:dashed}:host([data-status=pending]) .heading{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}:host([data-status=waiting]){--_step-node-bg-color: var(--text-secondary);--_step-node-color: var(--surface-default);--_step-node-border-color: var(--text-secondary)}:host{--_step-heading-centre: calc(var(--font-size-xs) * var(--line-height-base) / 2)}:host .text{align-self:start;padding-top:max(0px,var(--_step-node-size) / 2 + var(--space-1) - var(--_step-heading-centre))}:host .lead{flex:none;height:max(0px,var(--_step-heading-centre) - var(--_step-node-size) / 2 - var(--space-1))}:host:has(>.text>.head>.trailing>:not(.toggle)){--_step-heading-centre: calc( var(--space-2) + max(var(--font-size-xs) * var(--line-height-base), var(--field-h-sm)) / 2 )}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }] });
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatStepComponent, decorators: [{
|
|
99
|
+
type: Component,
|
|
100
|
+
args: [{ selector: 'ds-chat-step', standalone: true, imports: [IconComponent, SpinnerComponent], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
101
|
+
role: 'listitem',
|
|
102
|
+
'[attr.data-status]': 'shownStatus()',
|
|
103
|
+
'[class.is-first]': 'isFirst()',
|
|
104
|
+
'[class.is-last]': 'isLast()',
|
|
105
|
+
'[class.is-expanded]': 'expanded()',
|
|
106
|
+
'[class.outside-steps]': '!steps',
|
|
107
|
+
}, template: "<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (shownStatus() === 'running') {\n <ds-spinner size=\"sm\" />\n } @else if (nodeIcon(); as name) {\n <ds-icon\n [name]=\"name\"\n [size]=\"10\"\n [stroke]=\"2.4\" />\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_step-node-size: var(--chat-step-node-size);--_step-spine-width: var(--timeline-spine-w);--_step-gap: var(--chat-step-gap);--_step-node-bg-color: var(--surface-secondary);--_step-node-color: var(--text-tertiary);--_step-node-border-color: var(--text-tertiary);--_step-spine-color: var(--border-divider);--_step-toggle-icon-color: var(--icon-default);--_step-toggle-icon-color-hover: var(--icon-strong);--_step-open-bg-color: var(--surface-secondary);display:grid;grid-template-columns:var(--_step-node-size) 1fr;column-gap:var(--space-2)}.node-col{grid-area:1/1;display:flex;flex-direction:column;align-items:center}.node{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--_step-node-size);height:var(--_step-node-size);border-radius:var(--radius-pill);background-color:var(--_step-node-bg-color);color:var(--_step-node-color);border:var(--border-width-default) solid var(--_step-node-border-color)}.spine{visibility:hidden;flex:1;width:var(--_step-spine-width);margin-top:var(--space-1);background-color:var(--_step-spine-color)}.lead{margin-top:0;margin-bottom:var(--space-1)}.tail{grid-area:2/1;justify-self:center;margin-top:0}.text{grid-area:1/2;display:flex;flex-direction:column;align-self:center;gap:var(--space-0-5);min-width:0}.rest{grid-area:2/2;padding-bottom:var(--_step-gap);min-width:0}:host(.is-last) .spine:not(.lead),:host(.outside-steps:last-child) .spine:not(.lead){visibility:hidden}:host(.is-last) .rest,:host(.outside-steps:last-child) .rest{padding-bottom:0}:host(.is-first) .lead,:host(.outside-steps:first-child) .lead{visibility:hidden}.head{position:relative;display:flex;align-items:flex-start;gap:var(--space-2);min-width:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.trailing{display:inline-flex;align-items:center;gap:var(--space-2);margin-left:auto;flex:none;height:calc(var(--font-size-xs) * var(--line-height-base))}.head:has(.trailing>:not(.toggle)){align-items:center;margin-bottom:var(--space-1-5);padding-top:var(--space-2)}.head:has(.trailing>:not(.toggle)) .trailing{height:auto}.toggle{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toggle:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toggle{position:relative}.toggle:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toggle:focus-visible{outline-style:none}.toggle:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toggle{color:var(--_step-toggle-icon-color)}.toggle:hover{color:var(--_step-toggle-icon-color-hover)}.toggle .chev{transition:transform var(--duration-base) var(--ease-standard)}.toggle[aria-expanded=true] .chev{transform:rotate(180deg)}:host:not(:has(.details-body>*)) .toggle{display:none}:host(.is-expanded){isolation:isolate}:host(.is-expanded):before{content:\"\";grid-area:1/1/3/3;z-index:-1;margin:0 calc(-1 * var(--space-2)) var(--_step-gap);border-radius:var(--ds-radius-control);background-color:var(--_step-open-bg-color)}:host(.is-expanded.is-last):before,:host(.is-expanded.outside-steps:last-child):before{margin-bottom:0}.details{display:grid;grid-template-rows:0fr;min-width:0;visibility:hidden;transition:grid-template-rows var(--duration-slow) var(--ease-decelerate),visibility var(--duration-slow) allow-discrete}.details:not(:has(.details-body>*)){display:none}:host(.is-expanded) .details{grid-template-rows:1fr;visibility:visible}.details-content{min-height:0;overflow:hidden}.details-body{padding-top:var(--space-1)}.heading{color:var(--text-primary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}.time{color:var(--text-tertiary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}:host([data-status=done]){--_step-node-bg-color: var(--success);--_step-node-color: var(--text-on-success);--_step-node-border-color: var(--success)}:host([data-status=running]){--_step-node-bg-color: var(--surface-default);--_step-node-color: var(--accent);--_step-node-border-color: var(--accent)}:host([data-status=pending]){--_step-node-bg-color: var(--surface-default);--_step-node-color: var(--text-tertiary);--_step-node-border-color: var(--text-tertiary)}:host([data-status=error]){--_step-node-bg-color: var(--error);--_step-node-color: var(--text-on-error);--_step-node-border-color: var(--error)}:host([data-status=pending]) .node{border-style:dashed}:host([data-status=pending]) .heading{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}:host([data-status=waiting]){--_step-node-bg-color: var(--text-secondary);--_step-node-color: var(--surface-default);--_step-node-border-color: var(--text-secondary)}:host{--_step-heading-centre: calc(var(--font-size-xs) * var(--line-height-base) / 2)}:host .text{align-self:start;padding-top:max(0px,var(--_step-node-size) / 2 + var(--space-1) - var(--_step-heading-centre))}:host .lead{flex:none;height:max(0px,var(--_step-heading-centre) - var(--_step-node-size) / 2 - var(--space-1))}:host:has(>.text>.head>.trailing>:not(.toggle)){--_step-heading-centre: calc( var(--space-2) + max(var(--font-size-xs) * var(--line-height-base), var(--field-h-sm)) / 2 )}\n"] }]
|
|
108
|
+
}], ctorParameters: () => [], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], time: [{ type: i0.Input, args: [{ isSignal: true, alias: "time", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }] } });
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The steps of an agent's work, in the `[steps]` slot of a `ds-chat-message`: `ds-chat-step`s in
|
|
112
|
+
* order. The message folds them into a chip on its bubble and grows new steps in.
|
|
113
|
+
*/
|
|
114
|
+
class ChatStepsComponent {
|
|
115
|
+
/** How steps that arrive together (a plan given at once) come in: `'together'` grows them in as
|
|
116
|
+
* one block, `'stagger'` one after another. Steps that arrive one at a time grow in either way. */
|
|
117
|
+
enter = input('together', ...(ngDevMode ? [{ debugName: "enter" }] : /* istanbul ignore next */ []));
|
|
118
|
+
// Descendants, so a step inside a wrapper element or an @for block still counts.
|
|
119
|
+
items = contentChildren(ChatStepComponent, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: true });
|
|
120
|
+
/** The step that draws no gap above it. */
|
|
121
|
+
firstStep = computed(() => this.items().at(0), ...(ngDevMode ? [{ debugName: "firstStep" }] : /* istanbul ignore next */ []));
|
|
122
|
+
/** The step that draws no gap below it. */
|
|
123
|
+
lastStep = computed(() => this.items().at(-1), ...(ngDevMode ? [{ debugName: "lastStep" }] : /* istanbul ignore next */ []));
|
|
124
|
+
/** Shortest time a step shows as running before its final status, even when it finishes at once;
|
|
125
|
+
* `0` shows the final status at once. */
|
|
126
|
+
minRunningMs = input(600, ...(ngDevMode ? [{ debugName: "minRunningMs" }] : /* istanbul ignore next */ []));
|
|
127
|
+
/** Shortest gap between two steps showing their final status, so steps that finish together
|
|
128
|
+
* settle one after another; `0` lets them settle together. */
|
|
129
|
+
revealStaggerMs = input(300, ...(ngDevMode ? [{ debugName: "revealStaggerMs" }] : /* istanbul ignore next */ []));
|
|
130
|
+
lastSettle = 0;
|
|
131
|
+
/** @internal */
|
|
132
|
+
settleDelay(runningSince) {
|
|
133
|
+
if (typeof matchMedia === 'function' &&
|
|
134
|
+
matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
const now = performance.now();
|
|
138
|
+
const at = Math.max(now, runningSince + this.minRunningMs(), this.lastSettle + this.revealStaggerMs());
|
|
139
|
+
this.lastSettle = at;
|
|
140
|
+
return at - now;
|
|
141
|
+
}
|
|
142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatStepsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
143
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.22", type: ChatStepsComponent, isStandalone: true, selector: "ds-chat-steps", inputs: { enter: { classPropertyName: "enter", publicName: "enter", isSignal: true, isRequired: false, transformFunction: null }, minRunningMs: { classPropertyName: "minRunningMs", publicName: "minRunningMs", isSignal: true, isRequired: false, transformFunction: null }, revealStaggerMs: { classPropertyName: "revealStaggerMs", publicName: "revealStaggerMs", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "list", "data-density": "compact" } }, providers: [
|
|
144
|
+
{
|
|
145
|
+
provide: CHAT_STEPS,
|
|
146
|
+
useExisting: forwardRef(() => ChatStepsComponent),
|
|
147
|
+
},
|
|
148
|
+
], queries: [{ propertyName: "items", predicate: ChatStepComponent, descendants: true, isSignal: true }], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{display:flex;flex-direction:column}\n"] });
|
|
149
|
+
}
|
|
150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatStepsComponent, decorators: [{
|
|
151
|
+
type: Component,
|
|
152
|
+
args: [{ selector: 'ds-chat-steps', standalone: true, template: '<ng-content></ng-content>', encapsulation: ViewEncapsulation.Emulated, host: {
|
|
153
|
+
role: 'list',
|
|
154
|
+
// The compact density tokens apply to whatever the steps hold.
|
|
155
|
+
'data-density': 'compact',
|
|
156
|
+
}, providers: [
|
|
157
|
+
{
|
|
158
|
+
provide: CHAT_STEPS,
|
|
159
|
+
useExisting: forwardRef(() => ChatStepsComponent),
|
|
160
|
+
},
|
|
161
|
+
], styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{display:flex;flex-direction:column}\n"] }]
|
|
162
|
+
}], propDecorators: { enter: [{ type: i0.Input, args: [{ isSignal: true, alias: "enter", required: false }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ChatStepComponent), { ...{
|
|
163
|
+
descendants: true,
|
|
164
|
+
}, isSignal: true }] }], minRunningMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "minRunningMs", required: false }] }], revealStaggerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "revealStaggerMs", required: false }] }] } });
|
|
165
|
+
|
|
166
|
+
const TONE_ICONS = {
|
|
167
|
+
neutral: null,
|
|
168
|
+
info: 'info',
|
|
169
|
+
success: 'success',
|
|
170
|
+
warning: 'warn',
|
|
171
|
+
error: 'error',
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* One message of a conversation: a bubble on the right for the user, on the left for the
|
|
175
|
+
* assistant. Slots: default (the text or rendered markdown), `[steps]` (a `ds-chat-steps` of the
|
|
176
|
+
* agent's steps, above the bubble), `[attachments]` (under the text), `[actions]` (under the bubble).
|
|
177
|
+
* With `stepsFolded` the steps fold into a chip at the top of the bubble that opens them again.
|
|
178
|
+
*/
|
|
179
|
+
class ChatMessageComponent {
|
|
180
|
+
/** Who wrote it: `'user'` draws a filled bubble on the right, `'assistant'` a subtle one on the left. */
|
|
181
|
+
role = input('assistant', ...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
182
|
+
/** What a `'system'` notice means. `'neutral'` is a quiet one-line plaque for a routine note
|
|
183
|
+
* (saved, switched, started); `'info'`, `'success'`, `'warning'` and `'error'` draw a card in that
|
|
184
|
+
* status colour with its icon, for a note the reader should not miss. Other roles ignore it. */
|
|
185
|
+
tone = input('neutral', ...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
|
|
186
|
+
/** A bold first line of a `'system'` notice, for one that carries a detail under it. */
|
|
187
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
188
|
+
/** Icon at the start of a `'system'` notice. A toned notice shows its tone's icon without it; a
|
|
189
|
+
* `'neutral'` one shows none. */
|
|
190
|
+
icon = input(null, ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
191
|
+
/** Name shown above the bubble. Without it the role is spoken (`DS_INTL.chat.user` / `assistant`). */
|
|
192
|
+
author = input('', ...(ngDevMode ? [{ debugName: "author" }] : /* istanbul ignore next */ []));
|
|
193
|
+
/** Time label, already formatted, shown under the bubble. In a `ds-chat-thread` only the last message
|
|
194
|
+
* of a run shows it. */
|
|
195
|
+
time = input('', ...(ngDevMode ? [{ debugName: "time" }] : /* istanbul ignore next */ []));
|
|
196
|
+
/** When it was sent. Inside a `ds-chat-thread` it splits a run by time and dates the divider. */
|
|
197
|
+
sentAt = input(null, ...(ngDevMode ? [{ debugName: "sentAt" }] : /* istanbul ignore next */ []));
|
|
198
|
+
/** The text is still arriving: a caret blinks after it and `[actions]` stay hidden until it is done. */
|
|
199
|
+
streaming = input(false, { ...(ngDevMode ? { debugName: "streaming" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
200
|
+
/** Delivery of a message the reader sent: `'sending'` dims it and `'failed'` says it was not sent and
|
|
201
|
+
* offers Retry, both in place of `time`. `'sent'` shows nothing and is only spoken. */
|
|
202
|
+
status = input(null, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
203
|
+
/** The `[steps]` fold into a chip at the top of the bubble, which opens them again; two-way bound.
|
|
204
|
+
* Inside a `ds-chat-thread` the steps of the reply before a new user message fold on their own
|
|
205
|
+
* (`foldStepsOnSend`). Folds only steps given as `ds-chat-step`s. */
|
|
206
|
+
stepsFolded = model(false, ...(ngDevMode ? [{ debugName: "stepsFolded" }] : /* istanbul ignore next */ []));
|
|
207
|
+
/** Retry was pressed on a `'failed'` message. Send it again and move `status` back to `'sending'`. */
|
|
208
|
+
retry = output();
|
|
209
|
+
stepList = contentChild(ChatStepsComponent, { ...(ngDevMode ? { debugName: "stepList" } : /* istanbul ignore next */ {}), descendants: true });
|
|
210
|
+
steps = contentChildren(ChatStepComponent, { ...(ngDevMode ? { debugName: "steps" } : /* istanbul ignore next */ {}), descendants: true });
|
|
211
|
+
stepElements = contentChildren(ChatStepComponent, { ...(ngDevMode ? { debugName: "stepElements" } : /* istanbul ignore next */ {}), descendants: true,
|
|
212
|
+
read: (ElementRef) });
|
|
213
|
+
/** How many `ds-chat-step`s the `[steps]` hold. @internal */
|
|
214
|
+
stepCount = computed(() => this.steps().length, ...(ngDevMode ? [{ debugName: "stepCount" }] : /* istanbul ignore next */ []));
|
|
215
|
+
/** How many of them have `status="error"`. @internal */
|
|
216
|
+
failedStepCount = computed(() => this.steps().filter((step) => step.status() === 'error').length, ...(ngDevMode ? [{ debugName: "failedStepCount" }] : /* istanbul ignore next */ []));
|
|
217
|
+
openedFailures = new Set();
|
|
218
|
+
openedFailuresVersion = signal(0, ...(ngDevMode ? [{ debugName: "openedFailuresVersion" }] : /* istanbul ignore next */ []));
|
|
219
|
+
/** Failed steps the reader has not opened yet; while any remain the thread does not fold them.
|
|
220
|
+
* @internal */
|
|
221
|
+
unopenedFailedStepCount = computed(() => {
|
|
222
|
+
this.openedFailuresVersion();
|
|
223
|
+
return this.steps().filter((step) => step.status() === 'error' && !this.openedFailures.has(step)).length;
|
|
224
|
+
}, ...(ngDevMode ? [{ debugName: "unopenedFailedStepCount" }] : /* istanbul ignore next */ []));
|
|
225
|
+
stagger = computed(() => this.stepList()?.enter() === 'stagger', ...(ngDevMode ? [{ debugName: "stagger" }] : /* istanbul ignore next */ []));
|
|
226
|
+
folded = computed(() => this.stepsFolded() && this.stepCount() > 0, ...(ngDevMode ? [{ debugName: "folded" }] : /* istanbul ignore next */ []));
|
|
227
|
+
intl = inject(DS_INTL);
|
|
228
|
+
thread = inject(CHAT_THREAD, { optional: true });
|
|
229
|
+
isFirst = computed(() => this.thread?.firstMessage() === this, ...(ngDevMode ? [{ debugName: "isFirst" }] : /* istanbul ignore next */ []));
|
|
230
|
+
isGrouped = computed(() => this.thread?.groupedMessages().has(this) ?? false, ...(ngDevMode ? [{ debugName: "isGrouped" }] : /* istanbul ignore next */ []));
|
|
231
|
+
isContinued = computed(() => this.thread?.continuedMessages().has(this) ?? false, ...(ngDevMode ? [{ debugName: "isContinued" }] : /* istanbul ignore next */ []));
|
|
232
|
+
timeBreak = computed(() => this.thread?.timeBreaks().get(this) ?? '', ...(ngDevMode ? [{ debugName: "timeBreak" }] : /* istanbul ignore next */ []));
|
|
233
|
+
/** `sentAt` in milliseconds, or `null` when unset or unreadable. */
|
|
234
|
+
sentAtMs = computed(() => {
|
|
235
|
+
const value = this.sentAt();
|
|
236
|
+
const ms = value === null ? Number.NaN : new Date(value).getTime();
|
|
237
|
+
return Number.isNaN(ms) ? null : ms;
|
|
238
|
+
}, ...(ngDevMode ? [{ debugName: "sentAtMs" }] : /* istanbul ignore next */ []));
|
|
239
|
+
wording = computed(() => ({
|
|
240
|
+
...DS_INTL_DEFAULTS.chat,
|
|
241
|
+
...this.intl().chat,
|
|
242
|
+
}), ...(ngDevMode ? [{ debugName: "wording" }] : /* istanbul ignore next */ []));
|
|
243
|
+
noticeIcon = computed(() => this.icon() ?? TONE_ICONS[this.tone()], ...(ngDevMode ? [{ debugName: "noticeIcon" }] : /* istanbul ignore next */ []));
|
|
244
|
+
speaker = computed(() => this.author() || this.wording()[this.role()], ...(ngDevMode ? [{ debugName: "speaker" }] : /* istanbul ignore next */ []));
|
|
245
|
+
host = inject(ElementRef);
|
|
246
|
+
constructor() {
|
|
247
|
+
// The fold is applied here rather than through a template binding, so it can animate from the
|
|
248
|
+
// current boxes. The first state is applied without motion.
|
|
249
|
+
let rendered = false;
|
|
250
|
+
afterNextRender(() => {
|
|
251
|
+
rendered = true;
|
|
252
|
+
this.applyFold(this.folded(), false);
|
|
253
|
+
if (this.thread?.appendedAfterRender(this)) {
|
|
254
|
+
const steps = this.stepElements().map((step) => step.nativeElement);
|
|
255
|
+
// A plan given at once: the steps grow in one after another, or the message as one block.
|
|
256
|
+
if (this.stagger() && steps.length) {
|
|
257
|
+
this.growIn(steps, 70);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.growIn([this.host.nativeElement]);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
effect(() => {
|
|
265
|
+
const folded = this.folded();
|
|
266
|
+
untracked(() => {
|
|
267
|
+
if (rendered) {
|
|
268
|
+
this.applyFold(folded, true);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
// Opening a failed step's details counts as the reader having seen it.
|
|
273
|
+
effect(() => {
|
|
274
|
+
for (const step of this.steps()) {
|
|
275
|
+
if (step.status() === 'error' &&
|
|
276
|
+
step.expanded() &&
|
|
277
|
+
!this.openedFailures.has(step)) {
|
|
278
|
+
this.openedFailures.add(step);
|
|
279
|
+
untracked(() => this.openedFailuresVersion.update((version) => version + 1));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
// A step that fails while folded opens the steps again, so a failure is never hidden.
|
|
284
|
+
effect(() => {
|
|
285
|
+
if (this.stepsFolded() && this.unopenedFailedStepCount() > 0) {
|
|
286
|
+
untracked(() => this.stepsFolded.set(false));
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
// Steps that arrive into a message already on screen grow in, one after another.
|
|
290
|
+
let knownSteps = new Set();
|
|
291
|
+
effect(() => {
|
|
292
|
+
const items = this.steps();
|
|
293
|
+
untracked(() => {
|
|
294
|
+
const added = items.filter((item) => !knownSteps.has(item));
|
|
295
|
+
knownSteps = new Set(items);
|
|
296
|
+
// Started here, before the frame paints, so a step never shows at full height first.
|
|
297
|
+
if (rendered && added.length) {
|
|
298
|
+
const elements = this.stepElements();
|
|
299
|
+
this.growIn(added.map((item) => elements[items.indexOf(item)].nativeElement), this.stagger() ? 70 : 0);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
toggleSteps() {
|
|
305
|
+
this.stepsFolded.set(!this.stepsFolded());
|
|
306
|
+
}
|
|
307
|
+
motion() {
|
|
308
|
+
const host = this.host.nativeElement;
|
|
309
|
+
return (typeof matchMedia === 'function' &&
|
|
310
|
+
!matchMedia('(prefers-reduced-motion: reduce)').matches &&
|
|
311
|
+
typeof host.animate === 'function');
|
|
312
|
+
}
|
|
313
|
+
// Height, not a transform, so the thread's layout follows every frame and a pinned thread keeps
|
|
314
|
+
// its bottom still.
|
|
315
|
+
growIn(elements, stagger = 0) {
|
|
316
|
+
if (!this.motion()) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
// To `auto` (interpolate-size), so nothing is measured and it can start before the first paint.
|
|
320
|
+
elements.forEach((element, index) => {
|
|
321
|
+
element.animate([
|
|
322
|
+
{
|
|
323
|
+
height: '0px',
|
|
324
|
+
opacity: 0,
|
|
325
|
+
transform: 'translateY(-4px)',
|
|
326
|
+
overflow: 'hidden',
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
height: 'auto',
|
|
330
|
+
opacity: 1,
|
|
331
|
+
transform: 'none',
|
|
332
|
+
overflow: 'hidden',
|
|
333
|
+
},
|
|
334
|
+
], {
|
|
335
|
+
duration: 200,
|
|
336
|
+
delay: index * stagger,
|
|
337
|
+
easing: 'cubic-bezier(0.2, 0, 0, 1)',
|
|
338
|
+
fill: 'backwards',
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
// Folding, the chip at the top of the bubble rises into the steps: their height closes from the bottom, so
|
|
343
|
+
// the rows nearest the chip slide under it first, unsquashed, and the last ones fade as it reaches the
|
|
344
|
+
// top. The bubble rides up with the layout, and a new chip opens in the first third so it leads the move.
|
|
345
|
+
// Opening plays it back, the rows sliding out from under the chip. One duration and one easing throughout.
|
|
346
|
+
applyFold(folded, animate) {
|
|
347
|
+
const host = this.host.nativeElement;
|
|
348
|
+
if (host.classList.contains('steps-folded') === folded) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const steps = host.querySelector(':scope > .steps');
|
|
352
|
+
const chip = host.querySelector(':scope > .bubble > .steps-chip');
|
|
353
|
+
const chipNew = folded && !host.classList.contains('steps-chip-shown');
|
|
354
|
+
host.classList.add('steps-chip-shown');
|
|
355
|
+
if (!animate || !this.motion() || !steps) {
|
|
356
|
+
host.classList.toggle('steps-folded', folded);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const timing = {
|
|
360
|
+
duration: 360,
|
|
361
|
+
easing: 'cubic-bezier(0.2, 0, 0, 1)',
|
|
362
|
+
};
|
|
363
|
+
if (chip && chipNew) {
|
|
364
|
+
const chipHeight = `${chip.getBoundingClientRect().height}px`;
|
|
365
|
+
chip.animate([
|
|
366
|
+
{ height: '0px', opacity: 0, overflow: 'hidden' },
|
|
367
|
+
{ height: chipHeight, opacity: 1, overflow: 'hidden', offset: 0.3 },
|
|
368
|
+
{ height: chipHeight, opacity: 1, overflow: 'hidden' },
|
|
369
|
+
], timing);
|
|
370
|
+
}
|
|
371
|
+
if (!folded) {
|
|
372
|
+
host.classList.remove('steps-folded');
|
|
373
|
+
}
|
|
374
|
+
const height = steps.getBoundingClientRect().height;
|
|
375
|
+
const margin = getComputedStyle(steps).marginBottom;
|
|
376
|
+
const open = {
|
|
377
|
+
height: `${height}px`,
|
|
378
|
+
marginBottom: margin,
|
|
379
|
+
opacity: 1,
|
|
380
|
+
overflow: 'hidden',
|
|
381
|
+
};
|
|
382
|
+
const shut = {
|
|
383
|
+
height: '0px',
|
|
384
|
+
marginBottom: '0px',
|
|
385
|
+
opacity: 0,
|
|
386
|
+
overflow: 'hidden',
|
|
387
|
+
};
|
|
388
|
+
const run = steps.animate(folded
|
|
389
|
+
? [open, { opacity: 1, offset: 0.7 }, shut]
|
|
390
|
+
: [shut, { opacity: 1, offset: 0.3 }, open], timing);
|
|
391
|
+
if (folded) {
|
|
392
|
+
run.onfinish = () => host.classList.toggle('steps-folded', this.folded());
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
396
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChatMessageComponent, isStandalone: true, selector: "ds-chat-message", inputs: { role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, author: { classPropertyName: "author", publicName: "author", isSignal: true, isRequired: false, transformFunction: null }, time: { classPropertyName: "time", publicName: "time", isSignal: true, isRequired: false, transformFunction: null }, sentAt: { classPropertyName: "sentAt", publicName: "sentAt", isSignal: true, isRequired: false, transformFunction: null }, streaming: { classPropertyName: "streaming", publicName: "streaming", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, stepsFolded: { classPropertyName: "stepsFolded", publicName: "stepsFolded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stepsFolded: "stepsFoldedChange", retry: "retry" }, host: { properties: { "attr.role": "null", "attr.title": "null", "attr.data-role": "role()", "attr.data-tone": "role() === 'system' ? tone() : null", "class.in-thread": "!!thread", "class.is-first": "isFirst()", "class.is-grouped": "isGrouped()", "class.is-continued": "isContinued()", "class.has-divider": "!!timeBreak()", "attr.data-status": "status()", "attr.aria-busy": "streaming() || null" } }, queries: [{ propertyName: "stepList", first: true, predicate: ChatStepsComponent, descendants: true, isSignal: true }, { propertyName: "steps", predicate: ChatStepComponent, descendants: true, isSignal: true }, { propertyName: "stepElements", predicate: ChatStepComponent, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@if (timeBreak(); as label) {\n <div class=\"divider\">\n <span class=\"divider-label\">\n {{ label }}\n </span>\n </div>\n}\n\n<div class=\"meta\">\n <span\n class=\"speaker\"\n [class.visually-hidden]=\"!author() || isGrouped()\">\n {{ speaker() }}\n </span>\n</div>\n\n<div class=\"steps\">\n <ng-content select=\"[steps]\"></ng-content>\n</div>\n\n<div class=\"bubble\">\n @if (stepCount()) {\n <button\n type=\"button\"\n class=\"steps-chip\"\n [attr.aria-expanded]=\"!folded()\"\n [attr.aria-label]=\"\n folded() ? wording().stepsFolded(stepCount(), failedStepCount()) : null\n \"\n (click)=\"toggleSteps()\">\n @if (failedStepCount()) {\n <ds-icon\n class=\"steps-chip-failed\"\n name=\"error\"\n [size]=\"12\" />\n } @else {\n <ds-icon\n class=\"steps-chip-done\"\n name=\"check\"\n [size]=\"12\" />\n }\n\n <span>\n {{ wording().steps(stepCount()) }}\n </span>\n\n @if (failedStepCount()) {\n <span class=\"steps-chip-failed\">\n \u00B7 {{ wording().stepsFailed(failedStepCount()) }}\n </span>\n }\n\n <ds-icon\n [name]=\"folded() ? 'chevronUp' : 'chevronDown'\"\n [size]=\"12\" />\n </button>\n }\n\n @if (role() === 'system') {\n @if (noticeIcon(); as name) {\n <span class=\"notice-lead\">\n <ds-icon\n [name]=\"name\"\n [size]=\"14\" />\n </span>\n }\n\n @if (title()) {\n <div class=\"notice-title\">\n {{ title() }}\n </div>\n }\n }\n\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n\n <div class=\"attachments\">\n <ng-content select=\"[attachments]\"></ng-content>\n </div>\n</div>\n\n@switch (status()) {\n @case ('sending') {\n <div\n class=\"status\"\n role=\"status\">\n {{ wording().sending }}\n </div>\n }\n @case ('failed') {\n <div\n class=\"status is-failed\"\n role=\"status\">\n <ds-icon\n name=\"error\"\n [size]=\"14\" />\n {{ wording().notSent }}\n <ds-button\n variant=\"text\"\n size=\"sm\"\n (pressed)=\"retry.emit()\">\n {{ wording().retry }}\n </ds-button>\n </div>\n }\n @default {\n @if (status() === 'sent') {\n <span\n class=\"visually-hidden\"\n role=\"status\">\n {{ wording().sent }}\n </span>\n }\n\n @if (\n time() &&\n !isContinued() &&\n !streaming()\n ) {\n <div class=\"status time\">\n {{ time() }}\n </div>\n }\n }\n}\n\n@if (!streaming()) {\n <div class=\"actions\">\n <ng-content select=\"[actions]\"></ng-content>\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_chat-bubble-max-width: var(--ds-chat-message-max-width, 85%);--_chat-bubble-radius: var(--ds-chat-message-radius, var(--ds-radius-panel));--_chat-bubble-padding: var(--ds-chat-message-padding, var(--space-2) var(--space-3));--_chat-bubble-bg-color: var(--ds-chat-message-assistant-bg-color, var(--surface-secondary));--_chat-bubble-color: var(--ds-chat-message-assistant-color, var(--text-primary));position:relative;display:flex;flex-direction:column;align-items:flex-start;min-width:0}:host([data-role=user]){--_chat-bubble-bg-color: var(--ds-chat-message-user-bg-color, var(--primary));--_chat-bubble-color: var(--ds-chat-message-user-color, var(--text-on-primary));align-items:flex-end}:host([data-role=system]){--_chat-bubble-bg-color: var(--ds-chat-message-system-bg-color, var(--surface-secondary));--_chat-bubble-color: var(--ds-chat-message-system-color, var(--text-secondary));--_chat-bubble-radius: var(--ds-radius-control);--_chat-bubble-padding: var(--space-1) var(--space-2);--_chat-notice-border-color: var(--ds-chat-message-system-border-color, var(--border-default));align-items:center}:host([data-role=system]) .bubble{display:grid;grid-template-columns:minmax(0,1fr);gap:0;border:var(--border-width-default) solid var(--_chat-notice-border-color);font-size:var(--font-size-xs);text-wrap:pretty}:host([data-role=system]) .bubble:has(>.notice-lead){grid-template-columns:auto minmax(0,1fr);column-gap:var(--space-2)}:host([data-role=system]) .notice-title,:host([data-role=system]) .body,:host([data-role=system]) .attachments{grid-column:-2}:host([data-role=system]) .attachments{margin-top:var(--space-2)}:host([data-role=system]:not([data-tone=neutral])){--_chat-bubble-padding: var(--space-2) var(--space-3)}:host([data-tone=info]){--_chat-bubble-bg-color: var(--info-subtitle);--_chat-bubble-color: var(--info-text);--_chat-notice-border-color: var(--info-border)}:host([data-tone=success]){--_chat-bubble-bg-color: var(--success-subtitle);--_chat-bubble-color: var(--success-text);--_chat-notice-border-color: var(--success-border)}:host([data-tone=warning]){--_chat-bubble-bg-color: var(--warning-subtitle);--_chat-bubble-color: var(--warning-text);--_chat-notice-border-color: var(--warning-border)}:host([data-tone=error]){--_chat-bubble-bg-color: var(--error-subtitle);--_chat-bubble-color: var(--error-text);--_chat-notice-border-color: var(--error-border)}.notice-lead{grid-row:1/span 3;display:flex;align-items:center;block-size:1lh}.notice-title{font-weight:var(--font-weight-semibold);color:var(--text-primary)}:host(.in-thread){margin-top:var(--_chat-thread-gap)}:host(.is-grouped){margin-top:var(--_chat-thread-group-gap)}:host(.is-first){margin-top:0}.divider{display:flex;align-items:center;gap:var(--space-3);align-self:stretch;margin-bottom:var(--space-3);font-size:var(--font-size-xs);line-height:var(--line-height-base);color:var(--text-tertiary)}.divider:before,.divider:after{content:\"\";flex:1;border-top:var(--border-width-default) solid var(--border-divider)}.divider-label{flex:none}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.meta{display:flex;align-items:baseline;gap:var(--space-2);max-width:100%;font-size:var(--font-size-xs);line-height:var(--line-height-base);color:var(--text-tertiary)}.meta:has(.speaker:not(.visually-hidden)){margin-bottom:var(--space-1)}.speaker{font-weight:var(--font-weight-semibold);color:var(--text-secondary)}.bubble{display:flex;flex-direction:column;gap:var(--space-2);max-width:var(--_chat-bubble-max-width);min-width:0;padding:var(--_chat-bubble-padding);border-radius:var(--_chat-bubble-radius);background-color:var(--_chat-bubble-bg-color);color:var(--_chat-bubble-color);font-size:var(--font-size-s);line-height:var(--line-height-base);overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}:host([data-role=assistant]:not(.is-continued)) .bubble{border-end-start-radius:var(--ds-radius-inner)}:host([data-role=user]:not(.is-continued)) .bubble{border-end-end-radius:var(--ds-radius-inner)}:host([data-role=user]) .bubble ::selection{background-color:var(--_chat-bubble-color);color:var(--_chat-bubble-bg-color)}:host([data-role=user]) .body{white-space:pre-line}.steps,.body,.attachments{min-width:0}.steps{inline-size:100%;max-inline-size:var(--_chat-bubble-max-width);margin-bottom:var(--space-2);padding-inline:var(--space-1);overflow-wrap:anywhere}.bubble:has(>.body:empty):not(:has(>.attachments>*)){display:none}.attachments{display:flex;flex-wrap:wrap;gap:var(--space-1)}:host([aria-busy=true]) .body:after{content:\"\";display:inline-block;inline-size:.5em;block-size:1em;margin-inline-start:var(--space-0-5);vertical-align:text-bottom;background-color:currentcolor;animation:chat-caret var(--duration-loop-fast) steps(1) infinite}@keyframes chat-caret{50%{opacity:0}}:host([data-status=sending]) .bubble{opacity:var(--opacity-disabled)}.status{display:inline-flex;align-items:center;gap:var(--space-1);margin-top:var(--space-1);font-size:var(--font-size-xs);line-height:var(--line-height-base);color:var(--text-tertiary)}.status.is-failed{color:var(--error-text)}.actions{display:flex;align-items:center;gap:var(--space-1);margin-top:var(--space-1);opacity:0;transition:opacity var(--duration-fast) var(--ease-standard)}:host(:hover) .actions,.actions:focus-within{opacity:1}@media(hover:none){.actions{opacity:1}}.steps:not(:has(*)),.attachments:not(:has(*)),.actions:not(:has(*)),.body:empty{display:none}.steps-chip{display:none;align-items:center;align-self:flex-start;gap:var(--space-1);padding:var(--space-0-5) var(--space-2);border:var(--border-width-default) solid var(--border-default);border-radius:var(--ds-radius-pill);background-color:var(--surface-default);color:var(--text-secondary);font:inherit;font-size:var(--font-size-xs);line-height:var(--line-height-base);cursor:pointer}.steps-chip:hover{border-color:var(--border-strong);color:var(--text-primary)}.steps-chip-done{color:var(--success-text)}.steps-chip-failed{color:var(--error-text);font-weight:var(--font-weight-semibold)}:host(.steps-folded)>.steps{display:none}:host(.steps-chip-shown) .steps-chip{display:inline-flex}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "ds-button", inputs: ["color", "variant", "align", "size", "routerLink", "href", "fragment", "queryParams", "queryParamsHandling", "target", "rel", "routerLinkActiveOptions", "ariaCurrent", "type", "disabled", "loading", "loadingMode", "fullWidth", "ariaLabel", "icon", "trailingIcon", "ariaHasPopup", "ariaExpanded", "ariaControls", "disabledReason", "ariaDescribedBy"], outputs: ["pressed"] }, { kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }] });
|
|
397
|
+
}
|
|
398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatMessageComponent, decorators: [{
|
|
399
|
+
type: Component,
|
|
400
|
+
args: [{ selector: 'ds-chat-message', standalone: true, imports: [ButtonComponent, IconComponent], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
401
|
+
// The `role` input would otherwise stay on the host as an invalid ARIA role.
|
|
402
|
+
'[attr.role]': 'null',
|
|
403
|
+
'[attr.title]': 'null',
|
|
404
|
+
'[attr.data-role]': 'role()',
|
|
405
|
+
'[attr.data-tone]': "role() === 'system' ? tone() : null",
|
|
406
|
+
'[class.in-thread]': '!!thread',
|
|
407
|
+
'[class.is-first]': 'isFirst()',
|
|
408
|
+
'[class.is-grouped]': 'isGrouped()',
|
|
409
|
+
'[class.is-continued]': 'isContinued()',
|
|
410
|
+
'[class.has-divider]': '!!timeBreak()',
|
|
411
|
+
'[attr.data-status]': 'status()',
|
|
412
|
+
'[attr.aria-busy]': 'streaming() || null',
|
|
413
|
+
}, template: "@if (timeBreak(); as label) {\n <div class=\"divider\">\n <span class=\"divider-label\">\n {{ label }}\n </span>\n </div>\n}\n\n<div class=\"meta\">\n <span\n class=\"speaker\"\n [class.visually-hidden]=\"!author() || isGrouped()\">\n {{ speaker() }}\n </span>\n</div>\n\n<div class=\"steps\">\n <ng-content select=\"[steps]\"></ng-content>\n</div>\n\n<div class=\"bubble\">\n @if (stepCount()) {\n <button\n type=\"button\"\n class=\"steps-chip\"\n [attr.aria-expanded]=\"!folded()\"\n [attr.aria-label]=\"\n folded() ? wording().stepsFolded(stepCount(), failedStepCount()) : null\n \"\n (click)=\"toggleSteps()\">\n @if (failedStepCount()) {\n <ds-icon\n class=\"steps-chip-failed\"\n name=\"error\"\n [size]=\"12\" />\n } @else {\n <ds-icon\n class=\"steps-chip-done\"\n name=\"check\"\n [size]=\"12\" />\n }\n\n <span>\n {{ wording().steps(stepCount()) }}\n </span>\n\n @if (failedStepCount()) {\n <span class=\"steps-chip-failed\">\n \u00B7 {{ wording().stepsFailed(failedStepCount()) }}\n </span>\n }\n\n <ds-icon\n [name]=\"folded() ? 'chevronUp' : 'chevronDown'\"\n [size]=\"12\" />\n </button>\n }\n\n @if (role() === 'system') {\n @if (noticeIcon(); as name) {\n <span class=\"notice-lead\">\n <ds-icon\n [name]=\"name\"\n [size]=\"14\" />\n </span>\n }\n\n @if (title()) {\n <div class=\"notice-title\">\n {{ title() }}\n </div>\n }\n }\n\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n\n <div class=\"attachments\">\n <ng-content select=\"[attachments]\"></ng-content>\n </div>\n</div>\n\n@switch (status()) {\n @case ('sending') {\n <div\n class=\"status\"\n role=\"status\">\n {{ wording().sending }}\n </div>\n }\n @case ('failed') {\n <div\n class=\"status is-failed\"\n role=\"status\">\n <ds-icon\n name=\"error\"\n [size]=\"14\" />\n {{ wording().notSent }}\n <ds-button\n variant=\"text\"\n size=\"sm\"\n (pressed)=\"retry.emit()\">\n {{ wording().retry }}\n </ds-button>\n </div>\n }\n @default {\n @if (status() === 'sent') {\n <span\n class=\"visually-hidden\"\n role=\"status\">\n {{ wording().sent }}\n </span>\n }\n\n @if (\n time() &&\n !isContinued() &&\n !streaming()\n ) {\n <div class=\"status time\">\n {{ time() }}\n </div>\n }\n }\n}\n\n@if (!streaming()) {\n <div class=\"actions\">\n <ng-content select=\"[actions]\"></ng-content>\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_chat-bubble-max-width: var(--ds-chat-message-max-width, 85%);--_chat-bubble-radius: var(--ds-chat-message-radius, var(--ds-radius-panel));--_chat-bubble-padding: var(--ds-chat-message-padding, var(--space-2) var(--space-3));--_chat-bubble-bg-color: var(--ds-chat-message-assistant-bg-color, var(--surface-secondary));--_chat-bubble-color: var(--ds-chat-message-assistant-color, var(--text-primary));position:relative;display:flex;flex-direction:column;align-items:flex-start;min-width:0}:host([data-role=user]){--_chat-bubble-bg-color: var(--ds-chat-message-user-bg-color, var(--primary));--_chat-bubble-color: var(--ds-chat-message-user-color, var(--text-on-primary));align-items:flex-end}:host([data-role=system]){--_chat-bubble-bg-color: var(--ds-chat-message-system-bg-color, var(--surface-secondary));--_chat-bubble-color: var(--ds-chat-message-system-color, var(--text-secondary));--_chat-bubble-radius: var(--ds-radius-control);--_chat-bubble-padding: var(--space-1) var(--space-2);--_chat-notice-border-color: var(--ds-chat-message-system-border-color, var(--border-default));align-items:center}:host([data-role=system]) .bubble{display:grid;grid-template-columns:minmax(0,1fr);gap:0;border:var(--border-width-default) solid var(--_chat-notice-border-color);font-size:var(--font-size-xs);text-wrap:pretty}:host([data-role=system]) .bubble:has(>.notice-lead){grid-template-columns:auto minmax(0,1fr);column-gap:var(--space-2)}:host([data-role=system]) .notice-title,:host([data-role=system]) .body,:host([data-role=system]) .attachments{grid-column:-2}:host([data-role=system]) .attachments{margin-top:var(--space-2)}:host([data-role=system]:not([data-tone=neutral])){--_chat-bubble-padding: var(--space-2) var(--space-3)}:host([data-tone=info]){--_chat-bubble-bg-color: var(--info-subtitle);--_chat-bubble-color: var(--info-text);--_chat-notice-border-color: var(--info-border)}:host([data-tone=success]){--_chat-bubble-bg-color: var(--success-subtitle);--_chat-bubble-color: var(--success-text);--_chat-notice-border-color: var(--success-border)}:host([data-tone=warning]){--_chat-bubble-bg-color: var(--warning-subtitle);--_chat-bubble-color: var(--warning-text);--_chat-notice-border-color: var(--warning-border)}:host([data-tone=error]){--_chat-bubble-bg-color: var(--error-subtitle);--_chat-bubble-color: var(--error-text);--_chat-notice-border-color: var(--error-border)}.notice-lead{grid-row:1/span 3;display:flex;align-items:center;block-size:1lh}.notice-title{font-weight:var(--font-weight-semibold);color:var(--text-primary)}:host(.in-thread){margin-top:var(--_chat-thread-gap)}:host(.is-grouped){margin-top:var(--_chat-thread-group-gap)}:host(.is-first){margin-top:0}.divider{display:flex;align-items:center;gap:var(--space-3);align-self:stretch;margin-bottom:var(--space-3);font-size:var(--font-size-xs);line-height:var(--line-height-base);color:var(--text-tertiary)}.divider:before,.divider:after{content:\"\";flex:1;border-top:var(--border-width-default) solid var(--border-divider)}.divider-label{flex:none}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.meta{display:flex;align-items:baseline;gap:var(--space-2);max-width:100%;font-size:var(--font-size-xs);line-height:var(--line-height-base);color:var(--text-tertiary)}.meta:has(.speaker:not(.visually-hidden)){margin-bottom:var(--space-1)}.speaker{font-weight:var(--font-weight-semibold);color:var(--text-secondary)}.bubble{display:flex;flex-direction:column;gap:var(--space-2);max-width:var(--_chat-bubble-max-width);min-width:0;padding:var(--_chat-bubble-padding);border-radius:var(--_chat-bubble-radius);background-color:var(--_chat-bubble-bg-color);color:var(--_chat-bubble-color);font-size:var(--font-size-s);line-height:var(--line-height-base);overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}:host([data-role=assistant]:not(.is-continued)) .bubble{border-end-start-radius:var(--ds-radius-inner)}:host([data-role=user]:not(.is-continued)) .bubble{border-end-end-radius:var(--ds-radius-inner)}:host([data-role=user]) .bubble ::selection{background-color:var(--_chat-bubble-color);color:var(--_chat-bubble-bg-color)}:host([data-role=user]) .body{white-space:pre-line}.steps,.body,.attachments{min-width:0}.steps{inline-size:100%;max-inline-size:var(--_chat-bubble-max-width);margin-bottom:var(--space-2);padding-inline:var(--space-1);overflow-wrap:anywhere}.bubble:has(>.body:empty):not(:has(>.attachments>*)){display:none}.attachments{display:flex;flex-wrap:wrap;gap:var(--space-1)}:host([aria-busy=true]) .body:after{content:\"\";display:inline-block;inline-size:.5em;block-size:1em;margin-inline-start:var(--space-0-5);vertical-align:text-bottom;background-color:currentcolor;animation:chat-caret var(--duration-loop-fast) steps(1) infinite}@keyframes chat-caret{50%{opacity:0}}:host([data-status=sending]) .bubble{opacity:var(--opacity-disabled)}.status{display:inline-flex;align-items:center;gap:var(--space-1);margin-top:var(--space-1);font-size:var(--font-size-xs);line-height:var(--line-height-base);color:var(--text-tertiary)}.status.is-failed{color:var(--error-text)}.actions{display:flex;align-items:center;gap:var(--space-1);margin-top:var(--space-1);opacity:0;transition:opacity var(--duration-fast) var(--ease-standard)}:host(:hover) .actions,.actions:focus-within{opacity:1}@media(hover:none){.actions{opacity:1}}.steps:not(:has(*)),.attachments:not(:has(*)),.actions:not(:has(*)),.body:empty{display:none}.steps-chip{display:none;align-items:center;align-self:flex-start;gap:var(--space-1);padding:var(--space-0-5) var(--space-2);border:var(--border-width-default) solid var(--border-default);border-radius:var(--ds-radius-pill);background-color:var(--surface-default);color:var(--text-secondary);font:inherit;font-size:var(--font-size-xs);line-height:var(--line-height-base);cursor:pointer}.steps-chip:hover{border-color:var(--border-strong);color:var(--text-primary)}.steps-chip-done{color:var(--success-text)}.steps-chip-failed{color:var(--error-text);font-weight:var(--font-weight-semibold)}:host(.steps-folded)>.steps{display:none}:host(.steps-chip-shown) .steps-chip{display:inline-flex}\n"] }]
|
|
414
|
+
}], ctorParameters: () => [], propDecorators: { role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], author: [{ type: i0.Input, args: [{ isSignal: true, alias: "author", required: false }] }], time: [{ type: i0.Input, args: [{ isSignal: true, alias: "time", required: false }] }], sentAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "sentAt", required: false }] }], streaming: [{ type: i0.Input, args: [{ isSignal: true, alias: "streaming", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], stepsFolded: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepsFolded", required: false }] }, { type: i0.Output, args: ["stepsFoldedChange"] }], retry: [{ type: i0.Output, args: ["retry"] }], stepList: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ChatStepsComponent), { ...{
|
|
415
|
+
descendants: true,
|
|
416
|
+
}, isSignal: true }] }], steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ChatStepComponent), { ...{
|
|
417
|
+
descendants: true,
|
|
418
|
+
}, isSignal: true }] }], stepElements: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ChatStepComponent), { ...{
|
|
419
|
+
descendants: true,
|
|
420
|
+
read: (ElementRef),
|
|
421
|
+
}, isSignal: true }] }] } });
|
|
422
|
+
|
|
423
|
+
// Closer to the end than this still counts as at the end, so a sub-pixel scroll position or a
|
|
424
|
+
// small nudge does not unpin the thread.
|
|
425
|
+
const PIN_TOLERANCE_PX = 32;
|
|
426
|
+
// Closer to the start than this asks for older messages.
|
|
427
|
+
const OLDER_THRESHOLD_PX = 64;
|
|
428
|
+
/**
|
|
429
|
+
* Scrollable list of `ds-chat-message`s that stays at the newest message unless the reader has
|
|
430
|
+
* scrolled up, then offers a jump button instead. Groups consecutive messages of one role, shows a
|
|
431
|
+
* working row while `working`, and announces each finished reply once.
|
|
432
|
+
*/
|
|
433
|
+
class ChatThreadComponent {
|
|
434
|
+
/** Shows the working row at the end of the thread: a spinner and `workingLabel`. */
|
|
435
|
+
working = input(false, { ...(ngDevMode ? { debugName: "working" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
436
|
+
/** The current step while `working`, such as "Rebuilding"; empty falls back to `DS_INTL.chat.working`. */
|
|
437
|
+
workingLabel = input('', ...(ngDevMode ? [{ debugName: "workingLabel" }] : /* istanbul ignore next */ []));
|
|
438
|
+
/** Accessible name of the scroll area; unset falls back to `DS_INTL.chat.thread`. */
|
|
439
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
440
|
+
/** A new user message folds the steps of the replies before it (`ds-chat-message` `stepsFolded`).
|
|
441
|
+
* A reply keeps its steps open while it has a failed step the reader has not opened. */
|
|
442
|
+
foldStepsOnSend = input(true, { ...(ngDevMode ? { debugName: "foldStepsOnSend" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
443
|
+
/** Minutes between two messages' `sentAt` that start a new section with a time divider. */
|
|
444
|
+
timeBreakMinutes = input(15, ...(ngDevMode ? [{ debugName: "timeBreakMinutes" }] : /* istanbul ignore next */ []));
|
|
445
|
+
/** More messages exist before the first one; scrolling near the start then emits `loadOlder`. */
|
|
446
|
+
hasOlder = input(false, { ...(ngDevMode ? { debugName: "hasOlder" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
447
|
+
/** Older messages are on their way: a spinner shows over the top of the list. */
|
|
448
|
+
loadingOlder = input(false, { ...(ngDevMode ? { debugName: "loadingOlder" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
449
|
+
/** The reader scrolled near the start while `hasOlder` and not `loadingOlder`. Prepend the older
|
|
450
|
+
* messages; the thread keeps the message the reader was looking at in place. */
|
|
451
|
+
loadOlder = output();
|
|
452
|
+
// Descendants, so a message inside a wrapper element or an @for block still counts.
|
|
453
|
+
messages = contentChildren(ChatMessageComponent, { ...(ngDevMode ? { debugName: "messages" } : /* istanbul ignore next */ {}), descendants: true });
|
|
454
|
+
/** The first message, which takes no space above it. */
|
|
455
|
+
firstMessage = computed(() => this.messages().at(0), ...(ngDevMode ? [{ debugName: "firstMessage" }] : /* istanbul ignore next */ []));
|
|
456
|
+
/** Messages that open a time section, with their divider text: the first message with a
|
|
457
|
+
* `sentAt`, and each one sent `timeBreakMinutes` or more after the message before it. */
|
|
458
|
+
timeBreaks = computed(() => {
|
|
459
|
+
const breaks = new Map();
|
|
460
|
+
const gap = this.timeBreakMinutes() * 60_000;
|
|
461
|
+
let previous = null;
|
|
462
|
+
for (const message of this.messages()) {
|
|
463
|
+
const sent = message.sentAtMs();
|
|
464
|
+
if (sent !== null && (previous === null || sent - previous >= gap)) {
|
|
465
|
+
breaks.set(message, this.dividerText(sent));
|
|
466
|
+
}
|
|
467
|
+
previous = sent ?? previous;
|
|
468
|
+
}
|
|
469
|
+
return breaks;
|
|
470
|
+
}, ...(ngDevMode ? [{ debugName: "timeBreaks" }] : /* istanbul ignore next */ []));
|
|
471
|
+
/** Messages that follow one of the same role with no time break between them. */
|
|
472
|
+
groupedMessages = computed(() => {
|
|
473
|
+
const list = this.messages();
|
|
474
|
+
const breaks = this.timeBreaks();
|
|
475
|
+
return new Set(list.filter((message, i) => i > 0 &&
|
|
476
|
+
message.role() === list[i - 1].role() &&
|
|
477
|
+
!breaks.has(message)));
|
|
478
|
+
}, ...(ngDevMode ? [{ debugName: "groupedMessages" }] : /* istanbul ignore next */ []));
|
|
479
|
+
/** Messages followed by one of the same run. */
|
|
480
|
+
continuedMessages = computed(() => {
|
|
481
|
+
const list = this.messages();
|
|
482
|
+
const grouped = this.groupedMessages();
|
|
483
|
+
return new Set(list.filter((_, i) => grouped.has(list[i + 1])));
|
|
484
|
+
}, ...(ngDevMode ? [{ debugName: "continuedMessages" }] : /* istanbul ignore next */ []));
|
|
485
|
+
intl = inject(DS_INTL);
|
|
486
|
+
locale = injectDsLocale();
|
|
487
|
+
host = inject(ElementRef);
|
|
488
|
+
injector = inject(Injector);
|
|
489
|
+
destroyRef = inject(DestroyRef);
|
|
490
|
+
scroller = viewChild.required('scroller');
|
|
491
|
+
content = viewChild.required('content');
|
|
492
|
+
wording = computed(() => ({
|
|
493
|
+
...DS_INTL_DEFAULTS.chat,
|
|
494
|
+
...this.intl().chat,
|
|
495
|
+
}), ...(ngDevMode ? [{ debugName: "wording" }] : /* istanbul ignore next */ []));
|
|
496
|
+
label = computed(() => this.ariaLabel() || this.wording().thread, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
497
|
+
workingText = computed(() => this.workingLabel() || this.wording().working, ...(ngDevMode ? [{ debugName: "workingText" }] : /* istanbul ignore next */ []));
|
|
498
|
+
appended = new WeakSet();
|
|
499
|
+
/** @internal */
|
|
500
|
+
appendedAfterRender(message) {
|
|
501
|
+
return this.appended.has(message);
|
|
502
|
+
}
|
|
503
|
+
/** True once the thread has rendered. @internal */
|
|
504
|
+
live = signal(false, ...(ngDevMode ? [{ debugName: "live" }] : /* istanbul ignore next */ []));
|
|
505
|
+
pinned = signal(true, ...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
506
|
+
unseen = signal(0, ...(ngDevMode ? [{ debugName: "unseen" }] : /* istanbul ignore next */ []));
|
|
507
|
+
announcement = signal('', ...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
|
|
508
|
+
jumpLabel = computed(() => {
|
|
509
|
+
const count = this.unseen();
|
|
510
|
+
return count ? this.wording().newMessages(count) : this.wording().latest;
|
|
511
|
+
}, ...(ngDevMode ? [{ debugName: "jumpLabel" }] : /* istanbul ignore next */ []));
|
|
512
|
+
constructor() {
|
|
513
|
+
afterNextRender(() => {
|
|
514
|
+
this.live.set(true);
|
|
515
|
+
// The kept scrollbar room is as wide as the platform's scrollbar, which no stylesheet can know.
|
|
516
|
+
const scroller = this.scroller().nativeElement;
|
|
517
|
+
scroller.style.setProperty('--_chat-thread-gutter', `${scroller.offsetWidth - scroller.clientWidth}px`);
|
|
518
|
+
this.toEnd();
|
|
519
|
+
// Growth of the content (a new message, a streamed line, an opened snapshot) and a smaller
|
|
520
|
+
// viewport both move the end away; a pinned thread follows it.
|
|
521
|
+
const observer = new ResizeObserver(() => {
|
|
522
|
+
if (this.pinned()) {
|
|
523
|
+
this.toEnd();
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
this.holdAnchor();
|
|
527
|
+
}
|
|
528
|
+
this.recordAnchor();
|
|
529
|
+
});
|
|
530
|
+
observer.observe(this.content().nativeElement);
|
|
531
|
+
observer.observe(this.scroller().nativeElement);
|
|
532
|
+
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
533
|
+
});
|
|
534
|
+
// The messages present at the first render, or the first batch to arrive into an empty
|
|
535
|
+
// thread, are history: they are scrolled to, never announced.
|
|
536
|
+
let seen = -1;
|
|
537
|
+
let lastMessage;
|
|
538
|
+
let known = new Set();
|
|
539
|
+
effect(() => {
|
|
540
|
+
const list = this.messages();
|
|
541
|
+
untracked(() => {
|
|
542
|
+
const previous = seen;
|
|
543
|
+
const previousLast = lastMessage;
|
|
544
|
+
const added = previous > 0 ? list.filter((message) => !known.has(message)) : [];
|
|
545
|
+
const lastKnown = previous > 0
|
|
546
|
+
? list.indexOf(previousLast)
|
|
547
|
+
: -1;
|
|
548
|
+
for (const message of added) {
|
|
549
|
+
if (list.indexOf(message) > lastKnown) {
|
|
550
|
+
this.appended.add(message);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
known = new Set(list);
|
|
554
|
+
seen = list.length;
|
|
555
|
+
lastMessage = list.at(-1);
|
|
556
|
+
if (added.length && this.foldStepsOnSend()) {
|
|
557
|
+
this.afterRender(() => this.foldBefore(list, added));
|
|
558
|
+
}
|
|
559
|
+
this.olderRequested = false;
|
|
560
|
+
// Messages prepended by `loadOlder` leave the last one in place and are not new.
|
|
561
|
+
if (previous > 0 &&
|
|
562
|
+
list.length > previous &&
|
|
563
|
+
list.at(-1) !== previousLast) {
|
|
564
|
+
// After the render: a message created in this pass has not read its `role` input yet.
|
|
565
|
+
this.afterRender(() => this.onArrival());
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
// A reply that was still streaming is read once its text is complete.
|
|
570
|
+
let streaming = new Set();
|
|
571
|
+
effect(() => {
|
|
572
|
+
const now = new Set(this.messages().filter((message) => message.streaming()));
|
|
573
|
+
untracked(() => {
|
|
574
|
+
const finished = [...streaming].some((message) => !now.has(message));
|
|
575
|
+
streaming = now;
|
|
576
|
+
if (finished && !this.working()) {
|
|
577
|
+
this.afterRender(() => this.announceLastReply());
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
effect(() => {
|
|
582
|
+
if (!this.loadingOlder()) {
|
|
583
|
+
this.olderRequested = false;
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
let wasWorking = false;
|
|
587
|
+
effect(() => {
|
|
588
|
+
const working = this.working();
|
|
589
|
+
const text = this.workingText();
|
|
590
|
+
untracked(() => {
|
|
591
|
+
if (working) {
|
|
592
|
+
this.announce(text);
|
|
593
|
+
}
|
|
594
|
+
else if (wasWorking) {
|
|
595
|
+
this.afterRender(() => this.announceLastReply());
|
|
596
|
+
}
|
|
597
|
+
wasWorking = working;
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
/** Scrolls to the newest message and pins the thread there. */
|
|
602
|
+
scrollToEnd() {
|
|
603
|
+
this.pinned.set(true);
|
|
604
|
+
this.unseen.set(0);
|
|
605
|
+
this.toEnd();
|
|
606
|
+
}
|
|
607
|
+
onScroll() {
|
|
608
|
+
const scroller = this.scroller().nativeElement;
|
|
609
|
+
const atEnd = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight <=
|
|
610
|
+
PIN_TOLERANCE_PX;
|
|
611
|
+
// Only the reader scrolling up unpins. The event for the thread's own scroll to the end can land
|
|
612
|
+
// a frame after the content grew again, which reads as "away from the end" without anyone
|
|
613
|
+
// scrolling up.
|
|
614
|
+
const scrolledUp = scroller.scrollTop < this.lastScrollTop - 1;
|
|
615
|
+
this.lastScrollTop = scroller.scrollTop;
|
|
616
|
+
if (atEnd || scrolledUp) {
|
|
617
|
+
this.pinned.set(atEnd);
|
|
618
|
+
}
|
|
619
|
+
if (atEnd) {
|
|
620
|
+
this.unseen.set(0);
|
|
621
|
+
}
|
|
622
|
+
this.recordAnchor();
|
|
623
|
+
if (scroller.scrollTop <= OLDER_THRESHOLD_PX &&
|
|
624
|
+
this.hasOlder() &&
|
|
625
|
+
!this.loadingOlder() &&
|
|
626
|
+
!this.olderRequested) {
|
|
627
|
+
this.olderRequested = true;
|
|
628
|
+
this.loadOlder.emit();
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
olderRequested = false;
|
|
632
|
+
lastScrollTop = 0;
|
|
633
|
+
anchor = null;
|
|
634
|
+
// The first message still in view, and how far below the top of the viewport it sits.
|
|
635
|
+
recordAnchor() {
|
|
636
|
+
const scroller = this.scroller().nativeElement;
|
|
637
|
+
const viewTop = scroller.getBoundingClientRect().top;
|
|
638
|
+
const element = [
|
|
639
|
+
...this.content().nativeElement.querySelectorAll('ds-chat-message'),
|
|
640
|
+
].find((message) => message.getBoundingClientRect().bottom > viewTop);
|
|
641
|
+
this.anchor = element
|
|
642
|
+
? { element, top: element.getBoundingClientRect().top - viewTop }
|
|
643
|
+
: null;
|
|
644
|
+
}
|
|
645
|
+
// Content added or grown above the reader (older messages, an opened snapshot) pushes the message
|
|
646
|
+
// they were reading down; scroll by the same amount so it stays where it was.
|
|
647
|
+
holdAnchor() {
|
|
648
|
+
const anchor = this.anchor;
|
|
649
|
+
if (!anchor?.element.isConnected) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
const scroller = this.scroller().nativeElement;
|
|
653
|
+
const top = anchor.element.getBoundingClientRect().top -
|
|
654
|
+
scroller.getBoundingClientRect().top;
|
|
655
|
+
scroller.scrollTop += top - anchor.top;
|
|
656
|
+
}
|
|
657
|
+
onArrival() {
|
|
658
|
+
if (this.messages().at(-1)?.role() === 'user') {
|
|
659
|
+
// The reader just sent it: show it, wherever they had scrolled to.
|
|
660
|
+
this.scrollToEnd();
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (!this.pinned()) {
|
|
664
|
+
this.unseen.update((count) => count + 1);
|
|
665
|
+
}
|
|
666
|
+
if (!this.working() && !this.messages().at(-1)?.streaming()) {
|
|
667
|
+
this.announceLastReply();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
dividerText(sent) {
|
|
671
|
+
const date = new Date(sent);
|
|
672
|
+
const today = new Date();
|
|
673
|
+
const yesterday = new Date(today);
|
|
674
|
+
yesterday.setDate(today.getDate() - 1);
|
|
675
|
+
const sameDay = (other) => date.toDateString() === other.toDateString();
|
|
676
|
+
let day;
|
|
677
|
+
if (sameDay(today)) {
|
|
678
|
+
day = this.wording().today;
|
|
679
|
+
}
|
|
680
|
+
else if (sameDay(yesterday)) {
|
|
681
|
+
day = this.wording().yesterday;
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
day = date.toLocaleDateString(this.locale, {
|
|
685
|
+
day: 'numeric',
|
|
686
|
+
month: 'short',
|
|
687
|
+
year: date.getFullYear() === today.getFullYear() ? undefined : 'numeric',
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
const time = date.toLocaleTimeString(this.locale, {
|
|
691
|
+
hour: '2-digit',
|
|
692
|
+
minute: '2-digit',
|
|
693
|
+
});
|
|
694
|
+
return `${day} ${time}`;
|
|
695
|
+
}
|
|
696
|
+
// A user message that arrived folds the steps of every reply before it, except a reply whose failed
|
|
697
|
+
// step the reader has not opened yet.
|
|
698
|
+
foldBefore(list, added) {
|
|
699
|
+
const sent = added.find((message) => message.role() === 'user');
|
|
700
|
+
if (!sent) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
for (const reply of list.slice(0, list.indexOf(sent))) {
|
|
704
|
+
if (reply.role() === 'assistant' &&
|
|
705
|
+
reply.stepCount() > 0 &&
|
|
706
|
+
reply.unopenedFailedStepCount() === 0) {
|
|
707
|
+
reply.stepsFolded.set(true);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
toEnd() {
|
|
712
|
+
const scroller = this.scroller().nativeElement;
|
|
713
|
+
scroller.scrollTop = scroller.scrollHeight;
|
|
714
|
+
}
|
|
715
|
+
afterRender(read) {
|
|
716
|
+
afterNextRender({ read }, { injector: this.injector });
|
|
717
|
+
}
|
|
718
|
+
announceLastReply() {
|
|
719
|
+
if (this.messages().at(-1)?.role() !== 'assistant') {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
const replies = this.host.nativeElement.querySelectorAll('ds-chat-message[data-role="assistant"]');
|
|
723
|
+
const reply = replies[replies.length - 1];
|
|
724
|
+
if (!reply) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const speaker = reply.querySelector('.speaker')?.textContent?.trim() ?? '';
|
|
728
|
+
const text = reply.querySelector('.bubble')?.textContent?.trim() ?? '';
|
|
729
|
+
if (text) {
|
|
730
|
+
this.announce(speaker ? `${speaker}: ${text}` : text);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
// Cleared first, so the same words twice in a row are still spoken.
|
|
734
|
+
announce(text) {
|
|
735
|
+
this.announcement.set('');
|
|
736
|
+
this.afterRender(() => this.announcement.set(text));
|
|
737
|
+
}
|
|
738
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatThreadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
739
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChatThreadComponent, isStandalone: true, selector: "ds-chat-thread", inputs: { working: { classPropertyName: "working", publicName: "working", isSignal: true, isRequired: false, transformFunction: null }, workingLabel: { classPropertyName: "workingLabel", publicName: "workingLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, foldStepsOnSend: { classPropertyName: "foldStepsOnSend", publicName: "foldStepsOnSend", isSignal: true, isRequired: false, transformFunction: null }, timeBreakMinutes: { classPropertyName: "timeBreakMinutes", publicName: "timeBreakMinutes", isSignal: true, isRequired: false, transformFunction: null }, hasOlder: { classPropertyName: "hasOlder", publicName: "hasOlder", isSignal: true, isRequired: false, transformFunction: null }, loadingOlder: { classPropertyName: "loadingOlder", publicName: "loadingOlder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loadOlder: "loadOlder" }, providers: [
|
|
740
|
+
{
|
|
741
|
+
provide: CHAT_THREAD,
|
|
742
|
+
useExisting: forwardRef(() => ChatThreadComponent),
|
|
743
|
+
},
|
|
744
|
+
], queries: [{ propertyName: "messages", predicate: ChatMessageComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #scroller\n class=\"scroller\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-label]=\"label()\"\n (scroll)=\"onScroll()\">\n <div\n #content\n class=\"content\">\n <ng-content></ng-content>\n\n @if (working()) {\n <div class=\"working\">\n <span aria-hidden=\"true\">\n <ds-spinner size=\"sm\" />\n </span>\n\n <span class=\"working-label\">\n {{ workingText() }}\n </span>\n </div>\n }\n </div>\n</div>\n\n@if (loadingOlder()) {\n <div class=\"older\">\n <ds-spinner size=\"sm\" />\n </div>\n}\n\n@if (!pinned()) {\n <ds-button\n class=\"jump\"\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n trailingIcon=\"arrowDown\"\n (pressed)=\"scrollToEnd()\">\n {{ jumpLabel() }}\n </ds-button>\n}\n\n<div\n class=\"visually-hidden\"\n aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ announcement() }}\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_chat-thread-gap: var(--ds-chat-thread-gap, var(--space-4));--_chat-thread-group-gap: var(--ds-chat-thread-group-gap, var(--space-1));--_chat-thread-padding: var(--ds-chat-thread-padding, var(--space-4));--_chat-thread-inset-bottom: var(--ds-chat-thread-inset-bottom, 0px);position:relative;display:flex;flex-direction:column;inline-size:100%;min-height:0}.scroller{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;overflow-anchor:none;padding:var(--_chat-thread-padding);padding-block-end:calc(var(--_chat-thread-padding) + var(--_chat-thread-inset-bottom));padding-inline-end:max(0px,var(--_chat-thread-padding) - var(--_chat-thread-gutter, 0px))}.content{display:flex;flex-direction:column}.older{position:absolute;top:var(--space-3);left:50%;translate:-50% 0;display:flex;padding:var(--space-1-5);border-radius:var(--ds-radius-pill);background-color:var(--surface-default);box-shadow:var(--shadow-popover)}.working{display:flex;align-items:center;gap:var(--space-2);margin-top:var(--_chat-thread-gap);font-size:var(--font-size-s);line-height:var(--line-height-base);color:var(--text-secondary)}.working-label{min-width:0;overflow-wrap:anywhere}.jump{position:absolute;bottom:calc(var(--space-3) + var(--_chat-thread-inset-bottom));left:50%;translate:-50% 0;--ds-button-radius: var(--ds-radius-pill);--ds-button-bg-color: var(--surface-default);--ds-button-shadow: var(--shadow-popover)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "ds-button", inputs: ["color", "variant", "align", "size", "routerLink", "href", "fragment", "queryParams", "queryParamsHandling", "target", "rel", "routerLinkActiveOptions", "ariaCurrent", "type", "disabled", "loading", "loadingMode", "fullWidth", "ariaLabel", "icon", "trailingIcon", "ariaHasPopup", "ariaExpanded", "ariaControls", "disabledReason", "ariaDescribedBy"], outputs: ["pressed"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }] });
|
|
745
|
+
}
|
|
746
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatThreadComponent, decorators: [{
|
|
747
|
+
type: Component,
|
|
748
|
+
args: [{ selector: 'ds-chat-thread', standalone: true, imports: [ButtonComponent, SpinnerComponent], encapsulation: ViewEncapsulation.Emulated, providers: [
|
|
749
|
+
{
|
|
750
|
+
provide: CHAT_THREAD,
|
|
751
|
+
useExisting: forwardRef(() => ChatThreadComponent),
|
|
752
|
+
},
|
|
753
|
+
], template: "<div\n #scroller\n class=\"scroller\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-label]=\"label()\"\n (scroll)=\"onScroll()\">\n <div\n #content\n class=\"content\">\n <ng-content></ng-content>\n\n @if (working()) {\n <div class=\"working\">\n <span aria-hidden=\"true\">\n <ds-spinner size=\"sm\" />\n </span>\n\n <span class=\"working-label\">\n {{ workingText() }}\n </span>\n </div>\n }\n </div>\n</div>\n\n@if (loadingOlder()) {\n <div class=\"older\">\n <ds-spinner size=\"sm\" />\n </div>\n}\n\n@if (!pinned()) {\n <ds-button\n class=\"jump\"\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n trailingIcon=\"arrowDown\"\n (pressed)=\"scrollToEnd()\">\n {{ jumpLabel() }}\n </ds-button>\n}\n\n<div\n class=\"visually-hidden\"\n aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ announcement() }}\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_chat-thread-gap: var(--ds-chat-thread-gap, var(--space-4));--_chat-thread-group-gap: var(--ds-chat-thread-group-gap, var(--space-1));--_chat-thread-padding: var(--ds-chat-thread-padding, var(--space-4));--_chat-thread-inset-bottom: var(--ds-chat-thread-inset-bottom, 0px);position:relative;display:flex;flex-direction:column;inline-size:100%;min-height:0}.scroller{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;overflow-anchor:none;padding:var(--_chat-thread-padding);padding-block-end:calc(var(--_chat-thread-padding) + var(--_chat-thread-inset-bottom));padding-inline-end:max(0px,var(--_chat-thread-padding) - var(--_chat-thread-gutter, 0px))}.content{display:flex;flex-direction:column}.older{position:absolute;top:var(--space-3);left:50%;translate:-50% 0;display:flex;padding:var(--space-1-5);border-radius:var(--ds-radius-pill);background-color:var(--surface-default);box-shadow:var(--shadow-popover)}.working{display:flex;align-items:center;gap:var(--space-2);margin-top:var(--_chat-thread-gap);font-size:var(--font-size-s);line-height:var(--line-height-base);color:var(--text-secondary)}.working-label{min-width:0;overflow-wrap:anywhere}.jump{position:absolute;bottom:calc(var(--space-3) + var(--_chat-thread-inset-bottom));left:50%;translate:-50% 0;--ds-button-radius: var(--ds-radius-pill);--ds-button-bg-color: var(--surface-default);--ds-button-shadow: var(--shadow-popover)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"] }]
|
|
754
|
+
}], ctorParameters: () => [], propDecorators: { working: [{ type: i0.Input, args: [{ isSignal: true, alias: "working", required: false }] }], workingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "workingLabel", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], foldStepsOnSend: [{ type: i0.Input, args: [{ isSignal: true, alias: "foldStepsOnSend", required: false }] }], timeBreakMinutes: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeBreakMinutes", required: false }] }], hasOlder: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasOlder", required: false }] }], loadingOlder: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingOlder", required: false }] }], loadOlder: [{ type: i0.Output, args: ["loadOlder"] }], messages: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ChatMessageComponent), { ...{
|
|
755
|
+
descendants: true,
|
|
756
|
+
}, isSignal: true }] }], scroller: [{ type: i0.ViewChild, args: ['scroller', { isSignal: true }] }], content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
|
|
757
|
+
|
|
758
|
+
let nextId = 0;
|
|
759
|
+
/**
|
|
760
|
+
* A chip in a message's `[attachments]` slot that opens to show what was attached as it was when
|
|
761
|
+
* sent. The default slot is the snapshot, shown in a framed preview. A plain file with nothing to show is a `ds-tag`.
|
|
762
|
+
*/
|
|
763
|
+
class ChatAttachmentComponent {
|
|
764
|
+
/** Chip text: the file name, or the picked element's name. */
|
|
765
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
766
|
+
/** Where it came from, shown muted after the label: the page or screen it was picked on. */
|
|
767
|
+
source = input('', ...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
|
|
768
|
+
/** Icon before the label. */
|
|
769
|
+
icon = input('paperclip', ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
770
|
+
/** Whether the snapshot is open, two-way bound. */
|
|
771
|
+
expanded = model(false, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
772
|
+
snapshotId = `ds-chat-attachment-${++nextId}`;
|
|
773
|
+
toggle() {
|
|
774
|
+
this.expanded.set(!this.expanded());
|
|
775
|
+
}
|
|
776
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatAttachmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
777
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChatAttachmentComponent, isStandalone: true, selector: "ds-chat-attachment", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { properties: { "class.is-expanded": "expanded()" } }, ngImport: i0, template: "<button\n type=\"button\"\n class=\"head\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"snapshotId\"\n (click)=\"toggle()\">\n @if (icon(); as name) {\n <ds-icon\n class=\"icon\"\n [name]=\"name\"\n [size]=\"14\" />\n }\n\n <span class=\"label\">\n {{ label() }}\n </span>\n\n @if (source()) {\n <span class=\"source\">\n {{ source() }}\n </span>\n }\n\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"14\" />\n</button>\n\n<div\n class=\"preview\"\n [id]=\"snapshotId\"\n [hidden]=\"!expanded()\">\n <ng-content></ng-content>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_chat-attachment-bg-color: var(--ds-chat-attachment-bg-color, var(--surface-default));--_chat-attachment-preview-bg-color: var(--ds-chat-attachment-preview-bg-color, var(--surface-secondary));--_chat-attachment-preview-max-height: var(--ds-chat-attachment-preview-max-height, 16rem);display:inline-flex;flex-direction:column;max-width:100%;min-width:0}.head{display:inline-flex;align-items:center;gap:var(--space-1-5);max-width:100%;min-width:0;padding:var(--space-1) var(--space-2-5) var(--space-1) var(--space-2);border:0;border-radius:var(--ds-radius-pill);background-color:color-mix(in srgb,currentcolor 14%,transparent);color:inherit;font:inherit;font-size:var(--font-size-xs);line-height:var(--line-height-base);text-align:start;cursor:pointer}.head:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.head:hover{background-color:color-mix(in srgb,currentcolor 22%,transparent)}.icon,.chev{flex:none}.label{min-width:0;font-weight:var(--font-weight-semibold);overflow-wrap:anywhere}.source{min-width:0;opacity:.75;overflow-wrap:anywhere}.chev{margin-inline-start:auto;transition:transform var(--duration-base) var(--ease-standard)}.head[aria-expanded=true] .chev{transform:rotate(180deg)}:host(.is-expanded){flex-basis:100%;border:var(--border-width-default) solid var(--border-default);border-radius:var(--ds-radius-control);background-color:var(--_chat-attachment-bg-color);color:var(--text-primary)}:host(.is-expanded) .head{width:100%;padding:var(--space-2) var(--space-3);border-radius:var(--ds-radius-control) var(--ds-radius-control) 0 0;background-color:transparent}:host(.is-expanded) .head:hover{background-color:var(--surface-secondary)}:host(.is-expanded) .icon,:host(.is-expanded) .source,:host(.is-expanded) .chev{color:var(--text-secondary);opacity:1}.preview{display:flex;align-items:center;justify-content:center;max-height:var(--_chat-attachment-preview-max-height);min-width:0;margin:0 var(--space-2) var(--space-2);padding:var(--space-4);overflow:auto;border-radius:var(--ds-radius-inner);background-color:var(--_chat-attachment-preview-bg-color)}.preview[hidden]{display:none}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }] });
|
|
778
|
+
}
|
|
779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatAttachmentComponent, decorators: [{
|
|
780
|
+
type: Component,
|
|
781
|
+
args: [{ selector: 'ds-chat-attachment', standalone: true, imports: [IconComponent], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
782
|
+
'[class.is-expanded]': 'expanded()',
|
|
783
|
+
}, template: "<button\n type=\"button\"\n class=\"head\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"snapshotId\"\n (click)=\"toggle()\">\n @if (icon(); as name) {\n <ds-icon\n class=\"icon\"\n [name]=\"name\"\n [size]=\"14\" />\n }\n\n <span class=\"label\">\n {{ label() }}\n </span>\n\n @if (source()) {\n <span class=\"source\">\n {{ source() }}\n </span>\n }\n\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"14\" />\n</button>\n\n<div\n class=\"preview\"\n [id]=\"snapshotId\"\n [hidden]=\"!expanded()\">\n <ng-content></ng-content>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_chat-attachment-bg-color: var(--ds-chat-attachment-bg-color, var(--surface-default));--_chat-attachment-preview-bg-color: var(--ds-chat-attachment-preview-bg-color, var(--surface-secondary));--_chat-attachment-preview-max-height: var(--ds-chat-attachment-preview-max-height, 16rem);display:inline-flex;flex-direction:column;max-width:100%;min-width:0}.head{display:inline-flex;align-items:center;gap:var(--space-1-5);max-width:100%;min-width:0;padding:var(--space-1) var(--space-2-5) var(--space-1) var(--space-2);border:0;border-radius:var(--ds-radius-pill);background-color:color-mix(in srgb,currentcolor 14%,transparent);color:inherit;font:inherit;font-size:var(--font-size-xs);line-height:var(--line-height-base);text-align:start;cursor:pointer}.head:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.head:hover{background-color:color-mix(in srgb,currentcolor 22%,transparent)}.icon,.chev{flex:none}.label{min-width:0;font-weight:var(--font-weight-semibold);overflow-wrap:anywhere}.source{min-width:0;opacity:.75;overflow-wrap:anywhere}.chev{margin-inline-start:auto;transition:transform var(--duration-base) var(--ease-standard)}.head[aria-expanded=true] .chev{transform:rotate(180deg)}:host(.is-expanded){flex-basis:100%;border:var(--border-width-default) solid var(--border-default);border-radius:var(--ds-radius-control);background-color:var(--_chat-attachment-bg-color);color:var(--text-primary)}:host(.is-expanded) .head{width:100%;padding:var(--space-2) var(--space-3);border-radius:var(--ds-radius-control) var(--ds-radius-control) 0 0;background-color:transparent}:host(.is-expanded) .head:hover{background-color:var(--surface-secondary)}:host(.is-expanded) .icon,:host(.is-expanded) .source,:host(.is-expanded) .chev{color:var(--text-secondary);opacity:1}.preview{display:flex;align-items:center;justify-content:center;max-height:var(--_chat-attachment-preview-max-height);min-width:0;margin:0 var(--space-2) var(--space-2);padding:var(--space-4);overflow:auto;border-radius:var(--ds-radius-inner);background-color:var(--_chat-attachment-preview-bg-color)}.preview[hidden]{display:none}\n"] }]
|
|
784
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }] } });
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Message box for a chat or an instruction: an auto-growing text area with chips above it, actions
|
|
788
|
+
* on the left of a bottom bar and a send button on the right. Enter submits, Shift+Enter breaks the
|
|
789
|
+
* line. Slots: `[attachments]` above the frame, `[chips]`, `[actions]`, `[send]` (replaces the default send
|
|
790
|
+
* button).
|
|
791
|
+
*/
|
|
792
|
+
class ChatInputComponent {
|
|
793
|
+
intl = inject(DS_INTL);
|
|
794
|
+
textarea = viewChild.required(TextareaComponent);
|
|
795
|
+
/** Message text, two-way bound. Not cleared on submit: clear it once the message is accepted. */
|
|
796
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
797
|
+
/** Placeholder shown when empty. */
|
|
798
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
799
|
+
/** Accessible name of the text area; unset falls back to `DS_INTL.chatInput.label`. */
|
|
800
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
801
|
+
/** Height in lines the text area starts at. */
|
|
802
|
+
minRows = input(1, ...(ngDevMode ? [{ debugName: "minRows" }] : /* istanbul ignore next */ []));
|
|
803
|
+
/** Height in lines the text area grows to before it scrolls. */
|
|
804
|
+
maxRows = input(8, ...(ngDevMode ? [{ debugName: "maxRows" }] : /* istanbul ignore next */ []));
|
|
805
|
+
/** Disables the text area and the send button. Projected controls are the consumer's to disable. */
|
|
806
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
807
|
+
/** Work in flight: the send button keeps its place, shows a spinner and refuses to submit, and
|
|
808
|
+
* Enter does not submit. The text area stays editable. */
|
|
809
|
+
busy = input(false, { ...(ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
810
|
+
/** While `busy`, the default send button becomes Stop: a square inside a turning ring that emits
|
|
811
|
+
* `stopRequested`. */
|
|
812
|
+
stoppable = input(false, { ...(ngDevMode ? { debugName: "stoppable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
813
|
+
/** The current step while `busy`, such as "Rebuilding"; where it shows follows `layout`. */
|
|
814
|
+
busyLabel = input('', ...(ngDevMode ? [{ debugName: "busyLabel" }] : /* istanbul ignore next */ []));
|
|
815
|
+
/** Where the buttons and the step text sit. `'status-bar'`: buttons inside, the step text in the
|
|
816
|
+
* bar beside a fixed-size send button. `'status-above'`: the step text on a line above the box.
|
|
817
|
+
* `'split'`: attach outside on the left, send outside on the right, the step text above.
|
|
818
|
+
* `'send-outside'`: attach and the step inside, a round send button outside on the right.
|
|
819
|
+
* `'toolbar'`: the box holds the text, attach, the step and send sit in a row under it. */
|
|
820
|
+
layout = input('status-bar', ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
821
|
+
/** The trimmed text, on Enter or the send button. Never fires for blank text, while `busy` or
|
|
822
|
+
* while `disabled`. */
|
|
823
|
+
submitted = output();
|
|
824
|
+
/** The Stop button was pressed; fires only while `busy`, `stoppable` and not `disabled`. */
|
|
825
|
+
stopRequested = output();
|
|
826
|
+
/** Image files pasted into the text area. The paste inserts no text when it carries images. */
|
|
827
|
+
filesPasted = output();
|
|
828
|
+
/** True when Enter or the send button would submit; bind it in a `[send]` slot. */
|
|
829
|
+
canSubmit = computed(() => !this.disabled() && !this.busy() && this.value().trim() !== '', ...(ngDevMode ? [{ debugName: "canSubmit" }] : /* istanbul ignore next */ []));
|
|
830
|
+
labels = computed(() => ({
|
|
831
|
+
...DS_INTL_DEFAULTS.chatInput,
|
|
832
|
+
...this.intl().chatInput,
|
|
833
|
+
}), ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
834
|
+
textareaLabel = computed(() => this.ariaLabel() || this.labels().label, ...(ngDevMode ? [{ debugName: "textareaLabel" }] : /* istanbul ignore next */ []));
|
|
835
|
+
sendLabel = computed(() => this.labels().send, ...(ngDevMode ? [{ debugName: "sendLabel" }] : /* istanbul ignore next */ []));
|
|
836
|
+
stopLabel = computed(() => this.labels().stop, ...(ngDevMode ? [{ debugName: "stopLabel" }] : /* istanbul ignore next */ []));
|
|
837
|
+
stopShown = computed(() => this.busy() && this.stoppable() && !this.disabled(), ...(ngDevMode ? [{ debugName: "stopShown" }] : /* istanbul ignore next */ []));
|
|
838
|
+
statusAbove = computed(() => this.layout() === 'status-above' || this.layout() === 'split', ...(ngDevMode ? [{ debugName: "statusAbove" }] : /* istanbul ignore next */ []));
|
|
839
|
+
statusText = computed(() => this.busy() ? this.busyLabel() : '', ...(ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []));
|
|
840
|
+
/** Emits `submitted` when `canSubmit`; for a send button rendered in the `[send]` slot. */
|
|
841
|
+
submit() {
|
|
842
|
+
if (this.canSubmit()) {
|
|
843
|
+
this.submitted.emit(this.value().trim());
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
onSendPressed() {
|
|
847
|
+
if (this.stopShown()) {
|
|
848
|
+
this.stopRequested.emit();
|
|
849
|
+
}
|
|
850
|
+
else if (this.canSubmit()) {
|
|
851
|
+
this.submit();
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
this.focus();
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
/** Moves keyboard focus to the text area. */
|
|
858
|
+
focus(options) {
|
|
859
|
+
this.textarea().focus(options);
|
|
860
|
+
}
|
|
861
|
+
onKeydown(event) {
|
|
862
|
+
// keyCode 229 is the IME key Safari sends after compositionend, with isComposing already false.
|
|
863
|
+
if (event.key !== 'Enter' ||
|
|
864
|
+
event.shiftKey ||
|
|
865
|
+
event.isComposing ||
|
|
866
|
+
event.keyCode === 229) {
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
event.preventDefault();
|
|
870
|
+
this.submit();
|
|
871
|
+
}
|
|
872
|
+
onPaste(event) {
|
|
873
|
+
const images = Array.from(event.clipboardData?.files ?? []).filter((file) => file.type.startsWith('image/'));
|
|
874
|
+
if (images.length) {
|
|
875
|
+
event.preventDefault();
|
|
876
|
+
this.filesPasted.emit(images);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
880
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChatInputComponent, isStandalone: true, selector: "ds-chat-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, minRows: { classPropertyName: "minRows", publicName: "minRows", isSignal: true, isRequired: false, transformFunction: null }, maxRows: { classPropertyName: "maxRows", publicName: "maxRows", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, stoppable: { classPropertyName: "stoppable", publicName: "stoppable", isSignal: true, isRequired: false, transformFunction: null }, busyLabel: { classPropertyName: "busyLabel", publicName: "busyLabel", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", submitted: "submitted", stopRequested: "stopRequested", filesPasted: "filesPasted" }, viewQueries: [{ propertyName: "textarea", first: true, predicate: TextareaComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"'chat-input layout-' + layout()\">\n <div class=\"attachments\">\n <ng-content select=\"[attachments]\" />\n </div>\n\n @if (statusAbove()) {\n <div\n class=\"status status-above\"\n aria-live=\"polite\">\n {{ statusText() }}\n </div>\n }\n\n <div\n class=\"frame\"\n dsFieldClickFocus\n [class.disabled]=\"disabled()\">\n <div class=\"box\"></div>\n\n <div class=\"chips\">\n <ng-content select=\"[chips]\" />\n </div>\n\n <ds-textarea\n autosize\n resize=\"none\"\n [rows]=\"minRows()\"\n [minRows]=\"minRows()\"\n [maxRows]=\"maxRows()\"\n [placeholder]=\"placeholder()\"\n [ariaLabel]=\"textareaLabel()\"\n [disabled]=\"disabled()\"\n [(value)]=\"value\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\" />\n\n <div class=\"actions\">\n <ng-content select=\"[actions]\" />\n </div>\n\n @if (!statusAbove()) {\n <span\n class=\"status status-bar\"\n aria-live=\"polite\">\n {{ statusText() }}\n </span>\n }\n\n <div class=\"send\">\n <ng-content select=\"[send]\">\n <ds-button\n size=\"sm\"\n class=\"send-button\"\n loadingMode=\"icon\"\n [class.stop]=\"stopShown()\"\n [icon]=\"stopShown() ? 'stop' : 'arrowUp'\"\n [ariaLabel]=\"stopShown() ? stopLabel() : sendLabel()\"\n [disabled]=\"disabled()\"\n [loading]=\"busy() && !stopShown()\"\n (pressed)=\"onSendPressed()\" />\n </ng-content>\n </div>\n </div>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_field-border-color: var(--ds-field-border-color, var(--border-field));--_field-border-color-hover: var(--ds-field-border-color-hover, var(--border-field-hover));--_field-border-color-focus: var(--ds-field-border-color-focus, var(--accent));--_field-text-color: var(--ds-field-text-color, var(--text-primary));--_field-placeholder-color: var(--ds-field-placeholder-color, var(--text-tertiary));--_field-font-size: var(--ds-field-font-size, var(--font-size-s));--_chat-input-bg-color: var(--ds-chat-input-bg-color, var(--surface-default));--_chat-input-radius: var(--ds-chat-input-radius, var(--ds-radius-control));--_chat-input-padding: var(--ds-chat-input-padding, var(--space-2));display:block}.chat-input{display:flex;flex-direction:column;gap:var(--space-1)}.frame{--_p: var(--_chat-input-padding);display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto auto;grid-template-areas:\"chips chips chips\" \"text text text\" \"actions status send\";column-gap:var(--space-2);cursor:text}@media not (forced-colors:active){.frame ds-textarea:where(:focus-visible){outline:none}}.box{grid-row:1/4;grid-column:1/4;background-color:var(--_chat-input-bg-color);border:var(--border-width-default) solid var(--_field-border-color);border-radius:var(--_chat-input-radius);transition:border-color var(--duration-fast) var(--ease-standard),box-shadow var(--duration-fast) var(--ease-standard)}.frame:has(ds-textarea:hover,.chips:hover) .box{border-color:var(--_field-border-color-hover)}.frame:has(ds-textarea:focus-within) .box{border-color:var(--_field-border-color-focus);box-shadow:var(--ds-field-focus-shadow)}.frame.disabled{cursor:default}.frame.disabled .box{background-color:var(--surface-disabled);border-color:var(--border-disabled)}ds-textarea{--ds-input-bg-color: transparent;--ds-input-bg-color-disabled: transparent;--ds-input-border: transparent;--ds-input-border-hover: transparent;--ds-input-border-focus: transparent;--ds-input-focus-shadow: none;--ds-input-padding-x: var(--space-2);--ds-input-padding-y: var(--space-1);--border-disabled: transparent;grid-area:text;margin:var(--_p) var(--_p) var(--space-1)}.chips{display:flex;flex-wrap:wrap;grid-area:chips;gap:var(--space-2);margin:var(--_p) calc(var(--_p) + var(--space-1)) 0}.chips:empty{display:none}.actions{display:flex;grid-area:actions;align-items:center;gap:var(--space-1);margin:0 0 var(--_p) var(--_p)}.status{overflow:clip visible;text-overflow:ellipsis;white-space:nowrap;color:var(--text-secondary);font-size:var(--font-size-s);line-height:var(--line-height-base)}.status-bar{grid-area:status;align-self:center;min-width:0;text-align:end;margin-block-end:var(--_p)}.status-above{min-height:1lh;padding-inline:var(--space-4)}.send{display:flex;grid-area:send;align-items:center;gap:var(--space-2);margin:0 var(--_p) var(--_p) 0}.send-button{--ds-button-padding-x: 0;--_send-radius: var(--ds-button-radius, var(--ds-radius-control));width:var(--field-h-sm)}@property --_send-ring-angle{syntax: \"<angle>\"; inherits: false; initial-value: 0deg;}.send-button.stop{position:relative}.send-button.stop:after{content:\"\";position:absolute;inset:calc(var(--space-1) * -1);padding:var(--border-width-strong);border-radius:calc(var(--_send-radius) + var(--space-1));background:conic-gradient(from var(--_send-ring-angle),var(--primary) 0 30%,var(--primary-muted) 30% 100%);-webkit-mask:linear-gradient(var(--primary) 0 0) content-box exclude,linear-gradient(var(--primary) 0 0);mask:linear-gradient(var(--primary) 0 0) content-box exclude,linear-gradient(var(--primary) 0 0);pointer-events:none;animation:send-ring-turn var(--duration-loop-slow) linear infinite}@keyframes send-ring-turn{to{--_send-ring-angle: 360deg}}.layout-split .frame{grid-template-rows:auto auto;grid-template-areas:\". chips .\" \"actions text send\"}.layout-split .frame .box{grid-row:1/3;grid-column:2/3}.layout-split .frame ds-textarea{margin-block-end:var(--_p)}.layout-split .frame .actions,.layout-split .frame .send{align-self:end;margin:0 0 calc(var(--_p) - var(--space-1) / 2)}.layout-send-outside .frame{grid-template-areas:\"chips chips .\" \"text text .\" \"actions status send\"}.layout-send-outside .frame .box{grid-column:1/3}.layout-send-outside .frame .status-bar{margin-inline-end:var(--_p)}.layout-send-outside .frame .send{align-self:end;margin:0}.layout-send-outside .frame .send-button{--ds-button-height: var(--field-h-md);--ds-button-radius: 50%;--_send-radius: 50%;width:var(--field-h-md)}.layout-toolbar .frame .box{grid-row:1/3}.layout-toolbar .frame ds-textarea{margin-block-end:var(--_p)}.layout-toolbar .frame .actions,.layout-toolbar .frame .status-bar,.layout-toolbar .frame .send{margin:var(--space-1) 0 0}.attachments{display:flex;flex-direction:column;gap:var(--space-2);margin-block-end:var(--space-1)}.attachments:empty{display:none}\n"], dependencies: [{ kind: "component", type: TextareaComponent, selector: "ds-textarea", inputs: ["value", "size", "label", "placeholder", "disabled", "readOnly", "readonly", "success", "required", "optional", "rows", "name", "autosize", "minRows", "maxRows", "resize", "ariaLabel", "maxLength", "maxLengthMode", "countTrimmed", "minLength", "pattern"], outputs: ["valueChange"] }, { kind: "component", type: ButtonComponent, selector: "ds-button", inputs: ["color", "variant", "align", "size", "routerLink", "href", "fragment", "queryParams", "queryParamsHandling", "target", "rel", "routerLinkActiveOptions", "ariaCurrent", "type", "disabled", "loading", "loadingMode", "fullWidth", "ariaLabel", "icon", "trailingIcon", "ariaHasPopup", "ariaExpanded", "ariaControls", "disabledReason", "ariaDescribedBy"], outputs: ["pressed"] }, { kind: "directive", type: FieldClickFocusDirective, selector: "[dsFieldClickFocus]" }] });
|
|
881
|
+
}
|
|
882
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChatInputComponent, decorators: [{
|
|
883
|
+
type: Component,
|
|
884
|
+
args: [{ selector: 'ds-chat-input', standalone: true, imports: [TextareaComponent, ButtonComponent, FieldClickFocusDirective], encapsulation: ViewEncapsulation.Emulated, template: "<div [class]=\"'chat-input layout-' + layout()\">\n <div class=\"attachments\">\n <ng-content select=\"[attachments]\" />\n </div>\n\n @if (statusAbove()) {\n <div\n class=\"status status-above\"\n aria-live=\"polite\">\n {{ statusText() }}\n </div>\n }\n\n <div\n class=\"frame\"\n dsFieldClickFocus\n [class.disabled]=\"disabled()\">\n <div class=\"box\"></div>\n\n <div class=\"chips\">\n <ng-content select=\"[chips]\" />\n </div>\n\n <ds-textarea\n autosize\n resize=\"none\"\n [rows]=\"minRows()\"\n [minRows]=\"minRows()\"\n [maxRows]=\"maxRows()\"\n [placeholder]=\"placeholder()\"\n [ariaLabel]=\"textareaLabel()\"\n [disabled]=\"disabled()\"\n [(value)]=\"value\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\" />\n\n <div class=\"actions\">\n <ng-content select=\"[actions]\" />\n </div>\n\n @if (!statusAbove()) {\n <span\n class=\"status status-bar\"\n aria-live=\"polite\">\n {{ statusText() }}\n </span>\n }\n\n <div class=\"send\">\n <ng-content select=\"[send]\">\n <ds-button\n size=\"sm\"\n class=\"send-button\"\n loadingMode=\"icon\"\n [class.stop]=\"stopShown()\"\n [icon]=\"stopShown() ? 'stop' : 'arrowUp'\"\n [ariaLabel]=\"stopShown() ? stopLabel() : sendLabel()\"\n [disabled]=\"disabled()\"\n [loading]=\"busy() && !stopShown()\"\n (pressed)=\"onSendPressed()\" />\n </ng-content>\n </div>\n </div>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_field-border-color: var(--ds-field-border-color, var(--border-field));--_field-border-color-hover: var(--ds-field-border-color-hover, var(--border-field-hover));--_field-border-color-focus: var(--ds-field-border-color-focus, var(--accent));--_field-text-color: var(--ds-field-text-color, var(--text-primary));--_field-placeholder-color: var(--ds-field-placeholder-color, var(--text-tertiary));--_field-font-size: var(--ds-field-font-size, var(--font-size-s));--_chat-input-bg-color: var(--ds-chat-input-bg-color, var(--surface-default));--_chat-input-radius: var(--ds-chat-input-radius, var(--ds-radius-control));--_chat-input-padding: var(--ds-chat-input-padding, var(--space-2));display:block}.chat-input{display:flex;flex-direction:column;gap:var(--space-1)}.frame{--_p: var(--_chat-input-padding);display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto auto;grid-template-areas:\"chips chips chips\" \"text text text\" \"actions status send\";column-gap:var(--space-2);cursor:text}@media not (forced-colors:active){.frame ds-textarea:where(:focus-visible){outline:none}}.box{grid-row:1/4;grid-column:1/4;background-color:var(--_chat-input-bg-color);border:var(--border-width-default) solid var(--_field-border-color);border-radius:var(--_chat-input-radius);transition:border-color var(--duration-fast) var(--ease-standard),box-shadow var(--duration-fast) var(--ease-standard)}.frame:has(ds-textarea:hover,.chips:hover) .box{border-color:var(--_field-border-color-hover)}.frame:has(ds-textarea:focus-within) .box{border-color:var(--_field-border-color-focus);box-shadow:var(--ds-field-focus-shadow)}.frame.disabled{cursor:default}.frame.disabled .box{background-color:var(--surface-disabled);border-color:var(--border-disabled)}ds-textarea{--ds-input-bg-color: transparent;--ds-input-bg-color-disabled: transparent;--ds-input-border: transparent;--ds-input-border-hover: transparent;--ds-input-border-focus: transparent;--ds-input-focus-shadow: none;--ds-input-padding-x: var(--space-2);--ds-input-padding-y: var(--space-1);--border-disabled: transparent;grid-area:text;margin:var(--_p) var(--_p) var(--space-1)}.chips{display:flex;flex-wrap:wrap;grid-area:chips;gap:var(--space-2);margin:var(--_p) calc(var(--_p) + var(--space-1)) 0}.chips:empty{display:none}.actions{display:flex;grid-area:actions;align-items:center;gap:var(--space-1);margin:0 0 var(--_p) var(--_p)}.status{overflow:clip visible;text-overflow:ellipsis;white-space:nowrap;color:var(--text-secondary);font-size:var(--font-size-s);line-height:var(--line-height-base)}.status-bar{grid-area:status;align-self:center;min-width:0;text-align:end;margin-block-end:var(--_p)}.status-above{min-height:1lh;padding-inline:var(--space-4)}.send{display:flex;grid-area:send;align-items:center;gap:var(--space-2);margin:0 var(--_p) var(--_p) 0}.send-button{--ds-button-padding-x: 0;--_send-radius: var(--ds-button-radius, var(--ds-radius-control));width:var(--field-h-sm)}@property --_send-ring-angle{syntax: \"<angle>\"; inherits: false; initial-value: 0deg;}.send-button.stop{position:relative}.send-button.stop:after{content:\"\";position:absolute;inset:calc(var(--space-1) * -1);padding:var(--border-width-strong);border-radius:calc(var(--_send-radius) + var(--space-1));background:conic-gradient(from var(--_send-ring-angle),var(--primary) 0 30%,var(--primary-muted) 30% 100%);-webkit-mask:linear-gradient(var(--primary) 0 0) content-box exclude,linear-gradient(var(--primary) 0 0);mask:linear-gradient(var(--primary) 0 0) content-box exclude,linear-gradient(var(--primary) 0 0);pointer-events:none;animation:send-ring-turn var(--duration-loop-slow) linear infinite}@keyframes send-ring-turn{to{--_send-ring-angle: 360deg}}.layout-split .frame{grid-template-rows:auto auto;grid-template-areas:\". chips .\" \"actions text send\"}.layout-split .frame .box{grid-row:1/3;grid-column:2/3}.layout-split .frame ds-textarea{margin-block-end:var(--_p)}.layout-split .frame .actions,.layout-split .frame .send{align-self:end;margin:0 0 calc(var(--_p) - var(--space-1) / 2)}.layout-send-outside .frame{grid-template-areas:\"chips chips .\" \"text text .\" \"actions status send\"}.layout-send-outside .frame .box{grid-column:1/3}.layout-send-outside .frame .status-bar{margin-inline-end:var(--_p)}.layout-send-outside .frame .send{align-self:end;margin:0}.layout-send-outside .frame .send-button{--ds-button-height: var(--field-h-md);--ds-button-radius: 50%;--_send-radius: 50%;width:var(--field-h-md)}.layout-toolbar .frame .box{grid-row:1/3}.layout-toolbar .frame ds-textarea{margin-block-end:var(--_p)}.layout-toolbar .frame .actions,.layout-toolbar .frame .status-bar,.layout-toolbar .frame .send{margin:var(--space-1) 0 0}.attachments{display:flex;flex-direction:column;gap:var(--space-2);margin-block-end:var(--space-1)}.attachments:empty{display:none}\n"] }]
|
|
885
|
+
}], propDecorators: { textarea: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TextareaComponent), { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], minRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "minRows", required: false }] }], maxRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRows", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }], stoppable: [{ type: i0.Input, args: [{ isSignal: true, alias: "stoppable", required: false }] }], busyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "busyLabel", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], submitted: [{ type: i0.Output, args: ["submitted"] }], stopRequested: [{ type: i0.Output, args: ["stopRequested"] }], filesPasted: [{ type: i0.Output, args: ["filesPasted"] }] } });
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* A file attached to a message: a type tile or an image preview, the file name and a second line
|
|
889
|
+
* such as its size. Place it in the `[chips]` slot of `ds-chat-input`.
|
|
890
|
+
*/
|
|
891
|
+
class AttachmentComponent {
|
|
892
|
+
intl = inject(DS_INTL);
|
|
893
|
+
/** File name, shown on the first line and used in the remove button's accessible name. */
|
|
894
|
+
name = input.required(...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
895
|
+
/** Second line, such as `'PDF · 240 KB'`. */
|
|
896
|
+
meta = input('', ...(ngDevMode ? [{ debugName: "meta" }] : /* istanbul ignore next */ []));
|
|
897
|
+
/** Draws the type tile and is announced before `meta`. */
|
|
898
|
+
kind = input('file', ...(ngDevMode ? [{ debugName: "kind" }] : /* istanbul ignore next */ []));
|
|
899
|
+
/** Image shown in place of the tile when `kind` is `'image'`. */
|
|
900
|
+
previewUrl = input(null, ...(ngDevMode ? [{ debugName: "previewUrl" }] : /* istanbul ignore next */ []));
|
|
901
|
+
/** Shows a remove button that emits `removed`. */
|
|
902
|
+
removable = input(false, { ...(ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
903
|
+
/** Fires when the remove button is pressed. */
|
|
904
|
+
removed = output();
|
|
905
|
+
labels = computed(() => ({
|
|
906
|
+
...DS_INTL_DEFAULTS.attachment,
|
|
907
|
+
...this.intl().attachment,
|
|
908
|
+
}), ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
909
|
+
kindLabel = computed(() => this.labels()[this.kind()], ...(ngDevMode ? [{ debugName: "kindLabel" }] : /* istanbul ignore next */ []));
|
|
910
|
+
removeLabel = computed(() => this.labels().remove(this.name()), ...(ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []));
|
|
911
|
+
showPreview = computed(() => this.kind() === 'image' && !!this.previewUrl(), ...(ngDevMode ? [{ debugName: "showPreview" }] : /* istanbul ignore next */ []));
|
|
912
|
+
tileText = computed(() => ({ pdf: 'PDF', doc: 'DOC', image: 'IMG', file: 'FILE' })[this.kind()], ...(ngDevMode ? [{ debugName: "tileText" }] : /* istanbul ignore next */ []));
|
|
913
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: AttachmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
914
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: AttachmentComponent, isStandalone: true, selector: "ds-attachment", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, kind: { classPropertyName: "kind", publicName: "kind", isSignal: true, isRequired: false, transformFunction: null }, previewUrl: { classPropertyName: "previewUrl", publicName: "previewUrl", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { removed: "removed" }, host: { properties: { "class": "'kind-' + kind()" } }, ngImport: i0, template: "@if (showPreview()) {\n <img\n class=\"preview\"\n [src]=\"previewUrl()\"\n [alt]=\"name()\" />\n} @else {\n <span\n class=\"tile\"\n aria-hidden=\"true\">\n {{ tileText() }}\n </span>\n}\n\n<span class=\"text\">\n <span class=\"name\">\n {{ name() }}\n </span>\n\n <span class=\"meta\">\n <span class=\"visually-hidden\">\n {{ kindLabel() }}\n </span>\n {{ meta() }}\n </span>\n</span>\n\n@if (removable()) {\n <button\n type=\"button\"\n class=\"remove\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"removed.emit()\">\n <ds-icon\n name=\"x\"\n [size]=\"12\" />\n </button>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_attachment-tile-width: 29px;--_attachment-preview-width: 34px;--_attachment-tile-font-size: 9px;--_attachment-tile-bg-color: var(--text-secondary);--_attachment-tile-text-color: var(--surface-default);display:inline-flex;align-items:center;gap:var(--space-1-5);max-inline-size:100%;padding:var(--space-1) var(--space-1-5);border:var(--border-width-default) solid var(--border-default);border-radius:var(--radius-sm);background-color:var(--surface-secondary);color:var(--text-primary);font-size:var(--font-size-2xs);line-height:var(--line-height-flat)}:host(.kind-pdf){--_attachment-tile-bg-color: var(--error);--_attachment-tile-text-color: var(--error-on)}:host(.kind-doc){--_attachment-tile-bg-color: var(--primary);--_attachment-tile-text-color: var(--primary-on)}.tile,.preview{flex:none;block-size:var(--space-6);border-radius:var(--space-0-5)}.tile{display:grid;place-items:center;inline-size:var(--_attachment-tile-width);background-color:var(--_attachment-tile-bg-color);color:var(--_attachment-tile-text-color);font-size:var(--_attachment-tile-font-size);font-weight:var(--font-weight-extrabold)}.preview{inline-size:var(--_attachment-preview-width);object-fit:cover;border:var(--border-width-default) solid var(--border-default)}.text{display:flex;flex-direction:column;gap:var(--space-0-5);min-inline-size:0}.name{overflow:clip visible;text-overflow:ellipsis;white-space:nowrap;font-weight:var(--font-weight-bold)}.meta{overflow:clip visible;text-overflow:ellipsis;white-space:nowrap;color:var(--text-secondary);font-size:var(--font-size-3xs)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.remove{display:inline-flex;flex:none;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;border-radius:var(--ds-radius-inner);background:transparent;color:var(--text-secondary);cursor:pointer;transition:background-color var(--duration-fast) var(--ease-standard)}.remove:hover{background:color-mix(in oklab,currentcolor calc(var(--opacity-state-hover) * 100%),transparent)}.remove:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.remove:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:1px;animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.remove{position:relative}.remove:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.remove:focus-visible{outline-style:none}.remove:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }] });
|
|
915
|
+
}
|
|
916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: AttachmentComponent, decorators: [{
|
|
917
|
+
type: Component,
|
|
918
|
+
args: [{ selector: 'ds-attachment', standalone: true, imports: [IconComponent], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
919
|
+
'[class]': "'kind-' + kind()",
|
|
920
|
+
}, template: "@if (showPreview()) {\n <img\n class=\"preview\"\n [src]=\"previewUrl()\"\n [alt]=\"name()\" />\n} @else {\n <span\n class=\"tile\"\n aria-hidden=\"true\">\n {{ tileText() }}\n </span>\n}\n\n<span class=\"text\">\n <span class=\"name\">\n {{ name() }}\n </span>\n\n <span class=\"meta\">\n <span class=\"visually-hidden\">\n {{ kindLabel() }}\n </span>\n {{ meta() }}\n </span>\n</span>\n\n@if (removable()) {\n <button\n type=\"button\"\n class=\"remove\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"removed.emit()\">\n <ds-icon\n name=\"x\"\n [size]=\"12\" />\n </button>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_attachment-tile-width: 29px;--_attachment-preview-width: 34px;--_attachment-tile-font-size: 9px;--_attachment-tile-bg-color: var(--text-secondary);--_attachment-tile-text-color: var(--surface-default);display:inline-flex;align-items:center;gap:var(--space-1-5);max-inline-size:100%;padding:var(--space-1) var(--space-1-5);border:var(--border-width-default) solid var(--border-default);border-radius:var(--radius-sm);background-color:var(--surface-secondary);color:var(--text-primary);font-size:var(--font-size-2xs);line-height:var(--line-height-flat)}:host(.kind-pdf){--_attachment-tile-bg-color: var(--error);--_attachment-tile-text-color: var(--error-on)}:host(.kind-doc){--_attachment-tile-bg-color: var(--primary);--_attachment-tile-text-color: var(--primary-on)}.tile,.preview{flex:none;block-size:var(--space-6);border-radius:var(--space-0-5)}.tile{display:grid;place-items:center;inline-size:var(--_attachment-tile-width);background-color:var(--_attachment-tile-bg-color);color:var(--_attachment-tile-text-color);font-size:var(--_attachment-tile-font-size);font-weight:var(--font-weight-extrabold)}.preview{inline-size:var(--_attachment-preview-width);object-fit:cover;border:var(--border-width-default) solid var(--border-default)}.text{display:flex;flex-direction:column;gap:var(--space-0-5);min-inline-size:0}.name{overflow:clip visible;text-overflow:ellipsis;white-space:nowrap;font-weight:var(--font-weight-bold)}.meta{overflow:clip visible;text-overflow:ellipsis;white-space:nowrap;color:var(--text-secondary);font-size:var(--font-size-3xs)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.remove{display:inline-flex;flex:none;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;border-radius:var(--ds-radius-inner);background:transparent;color:var(--text-secondary);cursor:pointer;transition:background-color var(--duration-fast) var(--ease-standard)}.remove:hover{background:color-mix(in oklab,currentcolor calc(var(--opacity-state-hover) * 100%),transparent)}.remove:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.remove:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:1px;animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.remove{position:relative}.remove:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.remove:focus-visible{outline-style:none}.remove:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}\n"] }]
|
|
921
|
+
}], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], kind: [{ type: i0.Input, args: [{ isSignal: true, alias: "kind", required: false }] }], previewUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewUrl", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], removed: [{ type: i0.Output, args: ["removed"] }] } });
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Generated bundle index. Do not edit.
|
|
925
|
+
*/
|
|
926
|
+
|
|
927
|
+
export { AttachmentComponent, ChatAttachmentComponent, ChatInputComponent, ChatMessageComponent, ChatStepComponent, ChatStepsComponent, ChatThreadComponent };
|
|
928
|
+
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-chat.mjs.map
|