@tylertech/forge-ai 0.7.3 → 0.8.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/custom-elements.json +1068 -828
- package/dist/ai-assistant-response/ai-assistant-response.d.ts +2 -2
- package/dist/ai-assistant-response/ai-assistant-response.mjs +6 -5
- package/dist/ai-assistant-response/ai-assistant-response.scss.mjs +1 -1
- package/dist/ai-chat-header/ai-chat-header.mjs +72 -72
- package/dist/ai-chat-interface/ai-chat-interface.scss.mjs +1 -1
- package/dist/ai-chatbot/ai-chatbot-tool-call.mjs +22 -15
- package/dist/ai-chatbot/ai-chatbot-tool-call.scss.mjs +1 -1
- package/dist/ai-chatbot/ai-chatbot.mjs +62 -3
- package/dist/ai-chatbot/message-state-controller.d.ts +1 -0
- package/dist/ai-chatbot/message-state-controller.mjs +29 -9
- package/dist/ai-chatbot/types.d.ts +1 -0
- package/dist/ai-chatbot/utils.mjs +13 -2
- package/dist/ai-dialog/ai-dialog.scss.mjs +1 -1
- package/dist/ai-empty-state/ai-empty-state.scss.mjs +1 -1
- package/dist/ai-file-picker/ai-file-picker.mjs +3 -0
- package/dist/ai-floating-chat/ai-floating-chat.scss.mjs +1 -1
- package/dist/ai-message-thread/ai-message-thread.d.ts +12 -3
- package/dist/ai-message-thread/ai-message-thread.mjs +81 -8
- package/dist/ai-message-thread/ai-message-thread.scss.mjs +1 -1
- package/dist/ai-message-thread/index.d.ts +1 -1
- package/dist/ai-prompt/ai-prompt.mjs +48 -5
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.d.ts +41 -0
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.mjs +230 -0
- package/dist/{ai-actions-toolbar/ai-actions-toolbar.scss.mjs → ai-response-message-toolbar/ai-response-message-toolbar.scss.mjs} +1 -1
- package/dist/ai-response-message-toolbar/index.d.ts +1 -0
- package/dist/ai-response-message-toolbar/index.mjs +5 -0
- package/dist/ai-slash-command-menu/ai-slash-command-menu.mjs +1 -1
- package/dist/ai-user-message/ai-user-message.d.ts +25 -0
- package/dist/ai-user-message/ai-user-message.mjs +113 -5
- package/dist/ai-user-message/ai-user-message.scss.mjs +1 -1
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.d.ts +28 -0
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.mjs +160 -0
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.scss.mjs +4 -0
- package/dist/ai-user-message-toolbar/index.d.ts +1 -0
- package/dist/ai-user-message-toolbar/index.mjs +5 -0
- package/dist/ai-voice-input/ai-voice-input.mjs +5 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +6 -3
- package/dist/tools/ai-paginator/ai-paginator.mjs +5 -0
- package/package.json +1 -1
- package/dist/ai-actions-toolbar/ai-actions-toolbar.d.ts +0 -51
- package/dist/ai-actions-toolbar/ai-actions-toolbar.mjs +0 -211
- package/dist/ai-actions-toolbar/index.d.ts +0 -1
- package/dist/ai-actions-toolbar/index.mjs +0 -5
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { unsafeCSS, LitElement, html, nothing } from "lit";
|
|
2
|
+
import { property, customElement } from "lit/decorators.js";
|
|
3
|
+
import "../core/tooltip/tooltip.mjs";
|
|
4
|
+
import styles from "./ai-user-message-toolbar.scss.mjs";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
19
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
20
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
21
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
22
|
+
var _resendIcon, _copyIcon, _editIcon, _AiUserMessageToolbarComponent_instances, formattedTime_get, formattedFullDate_get, handleCopy_fn, handleResend_fn, handleEdit_fn, timestampTemplate_get, actionButtons_get, _copyButton;
|
|
23
|
+
const AiUserMessageToolbarComponentTagName = "forge-ai-user-message-toolbar";
|
|
24
|
+
let AiUserMessageToolbarComponent = class extends LitElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
__privateAdd(this, _AiUserMessageToolbarComponent_instances);
|
|
28
|
+
this.streaming = false;
|
|
29
|
+
__privateAdd(this, _resendIcon, html`
|
|
30
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
31
|
+
<path
|
|
32
|
+
d="M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 0 0-8 8 8 8 0 0 0 8 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18a6 6 0 0 1-6-6 6 6 0 0 1 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z" />
|
|
33
|
+
</svg>
|
|
34
|
+
`);
|
|
35
|
+
__privateAdd(this, _copyIcon, html`
|
|
36
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
37
|
+
<path
|
|
38
|
+
d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z" />
|
|
39
|
+
</svg>
|
|
40
|
+
`);
|
|
41
|
+
__privateAdd(this, _editIcon, html`
|
|
42
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
43
|
+
<path
|
|
44
|
+
d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75z" />
|
|
45
|
+
</svg>
|
|
46
|
+
`);
|
|
47
|
+
__privateAdd(this, _copyButton, html`
|
|
48
|
+
<button
|
|
49
|
+
id="copy-btn"
|
|
50
|
+
aria-label="Copy message"
|
|
51
|
+
class="forge-icon-button forge-icon-button--small"
|
|
52
|
+
@click=${__privateMethod(this, _AiUserMessageToolbarComponent_instances, handleCopy_fn)}>
|
|
53
|
+
${__privateGet(this, _copyIcon)}
|
|
54
|
+
</button>
|
|
55
|
+
<forge-ai-tooltip for="copy-btn" placement="bottom">Copy</forge-ai-tooltip>
|
|
56
|
+
`);
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
return html`
|
|
60
|
+
<div class="user-message-toolbar">${__privateGet(this, _AiUserMessageToolbarComponent_instances, timestampTemplate_get)} ${__privateGet(this, _AiUserMessageToolbarComponent_instances, actionButtons_get)} ${__privateGet(this, _copyButton)}</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
_resendIcon = /* @__PURE__ */ new WeakMap();
|
|
65
|
+
_copyIcon = /* @__PURE__ */ new WeakMap();
|
|
66
|
+
_editIcon = /* @__PURE__ */ new WeakMap();
|
|
67
|
+
_AiUserMessageToolbarComponent_instances = /* @__PURE__ */ new WeakSet();
|
|
68
|
+
formattedTime_get = function() {
|
|
69
|
+
if (!this.timestamp) {
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
return new Date(this.timestamp).toLocaleTimeString([], {
|
|
73
|
+
hour: "2-digit",
|
|
74
|
+
minute: "2-digit"
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
formattedFullDate_get = function() {
|
|
78
|
+
if (!this.timestamp) {
|
|
79
|
+
return "";
|
|
80
|
+
}
|
|
81
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
82
|
+
year: "numeric",
|
|
83
|
+
month: "short",
|
|
84
|
+
day: "numeric",
|
|
85
|
+
hour: "numeric",
|
|
86
|
+
minute: "2-digit"
|
|
87
|
+
}).format(this.timestamp);
|
|
88
|
+
};
|
|
89
|
+
handleCopy_fn = function() {
|
|
90
|
+
this.dispatchEvent(
|
|
91
|
+
new CustomEvent("forge-ai-user-message-toolbar-copy", {
|
|
92
|
+
bubbles: true,
|
|
93
|
+
composed: true
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
handleResend_fn = function() {
|
|
98
|
+
this.dispatchEvent(
|
|
99
|
+
new CustomEvent("forge-ai-user-message-toolbar-resend", {
|
|
100
|
+
bubbles: true,
|
|
101
|
+
composed: true
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
handleEdit_fn = function() {
|
|
106
|
+
this.dispatchEvent(
|
|
107
|
+
new CustomEvent("forge-ai-user-message-toolbar-edit", {
|
|
108
|
+
bubbles: true,
|
|
109
|
+
composed: true
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
timestampTemplate_get = function() {
|
|
114
|
+
if (!this.timestamp) {
|
|
115
|
+
return nothing;
|
|
116
|
+
}
|
|
117
|
+
return html`
|
|
118
|
+
<span id="timestamp" class="timestamp">${__privateGet(this, _AiUserMessageToolbarComponent_instances, formattedTime_get)}</span>
|
|
119
|
+
<forge-ai-tooltip for="timestamp" placement="bottom">${__privateGet(this, _AiUserMessageToolbarComponent_instances, formattedFullDate_get)}</forge-ai-tooltip>
|
|
120
|
+
`;
|
|
121
|
+
};
|
|
122
|
+
actionButtons_get = function() {
|
|
123
|
+
if (this.streaming) {
|
|
124
|
+
return nothing;
|
|
125
|
+
}
|
|
126
|
+
return html`
|
|
127
|
+
<button
|
|
128
|
+
id="resend-btn"
|
|
129
|
+
aria-label="Resend message"
|
|
130
|
+
class="forge-icon-button forge-icon-button--small"
|
|
131
|
+
@click=${__privateMethod(this, _AiUserMessageToolbarComponent_instances, handleResend_fn)}>
|
|
132
|
+
${__privateGet(this, _resendIcon)}
|
|
133
|
+
</button>
|
|
134
|
+
<forge-ai-tooltip for="resend-btn" placement="bottom">Resend</forge-ai-tooltip>
|
|
135
|
+
|
|
136
|
+
<button
|
|
137
|
+
id="edit-btn"
|
|
138
|
+
aria-label="Edit message"
|
|
139
|
+
class="forge-icon-button forge-icon-button--small"
|
|
140
|
+
@click=${__privateMethod(this, _AiUserMessageToolbarComponent_instances, handleEdit_fn)}>
|
|
141
|
+
${__privateGet(this, _editIcon)}
|
|
142
|
+
</button>
|
|
143
|
+
<forge-ai-tooltip for="edit-btn" placement="bottom">Edit</forge-ai-tooltip>
|
|
144
|
+
`;
|
|
145
|
+
};
|
|
146
|
+
_copyButton = /* @__PURE__ */ new WeakMap();
|
|
147
|
+
AiUserMessageToolbarComponent.styles = unsafeCSS(styles);
|
|
148
|
+
__decorateClass([
|
|
149
|
+
property({ attribute: false })
|
|
150
|
+
], AiUserMessageToolbarComponent.prototype, "timestamp", 2);
|
|
151
|
+
__decorateClass([
|
|
152
|
+
property({ type: Boolean })
|
|
153
|
+
], AiUserMessageToolbarComponent.prototype, "streaming", 2);
|
|
154
|
+
AiUserMessageToolbarComponent = __decorateClass([
|
|
155
|
+
customElement(AiUserMessageToolbarComponentTagName)
|
|
156
|
+
], AiUserMessageToolbarComponent);
|
|
157
|
+
export {
|
|
158
|
+
AiUserMessageToolbarComponent,
|
|
159
|
+
AiUserMessageToolbarComponentTagName
|
|
160
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/* prettier-ignore */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/* prettier-ignore */\n.forge-icon-button {\n --_icon-button-display: var(--forge-icon-button-display, inline-flex);\n --_icon-button-size: var(--forge-icon-button-size, 48px);\n --_icon-button-gap: var(--forge-icon-button-gap, 0);\n --_icon-button-icon-color: var(--forge-icon-button-icon-color, currentColor);\n --_icon-button-background-color: var(--forge-icon-button-background-color, none);\n --_icon-button-icon-size: var(--forge-icon-button-icon-size, calc(var(--forge-typography-font-size, 1rem) * 1.5));\n --_icon-button-cursor: var(--forge-icon-button-cursor, pointer);\n --_icon-button-padding: var(--forge-icon-button-padding, var(--forge-spacing-xxsmall, 4px));\n --_icon-button-border: var(--forge-icon-button-border, none);\n --_icon-button-shadow: var(--forge-icon-button-shadow, none);\n --_icon-button-transition-duration: var(--forge-icon-button-transition-duration, var(--forge-animation-duration-short3, 150ms));\n --_icon-button-transition-timing: var(--forge-icon-button-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));\n --_icon-button-shape: var(--forge-icon-button-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));\n --_icon-button-shape-start-start: var(--forge-icon-button-shape-start-start, var(--_icon-button-shape));\n --_icon-button-shape-start-end: var(--forge-icon-button-shape-start-end, var(--_icon-button-shape));\n --_icon-button-shape-end-start: var(--forge-icon-button-shape-end-start, var(--_icon-button-shape));\n --_icon-button-shape-end-end: var(--forge-icon-button-shape-end-end, var(--_icon-button-shape));\n --_icon-button-shape-squared: var(--forge-icon-button-shape-squared, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));\n --_icon-button-outlined-border-width: var(--forge-icon-button-outlined-border-width, 1px);\n --_icon-button-outlined-border-style: var(--forge-icon-button-outlined-border-style, solid);\n --_icon-button-outlined-border-color: var(--forge-icon-button-outlined-border-color, var(--_icon-button-icon-color));\n --_icon-button-tonal-icon-color: var(--forge-icon-button-tonal-icon-color, var(--forge-theme-on-primary-container, #222c62));\n --_icon-button-tonal-background-color: var(--forge-icon-button-tonal-background-color, var(--forge-theme-primary-container, #d1d5ed));\n --_icon-button-filled-icon-color: var(--forge-icon-button-filled-icon-color, var(--forge-theme-on-primary, #ffffff));\n --_icon-button-filled-background-color: var(--forge-icon-button-filled-background-color, var(--forge-theme-primary, #3f51b5));\n --_icon-button-raised-shadow: var(--forge-icon-button-raised-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));\n --_icon-button-raised-hover-shadow: var(--forge-icon-button-raised-hover-shadow, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12));\n --_icon-button-raised-active-shadow: var(--forge-icon-button-raised-active-shadow, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12));\n --_icon-button-raised-disabled-shadow: var(--forge-icon-button-raised-disabled-shadow, none);\n --_icon-button-density-small-size: var(--forge-icon-button-density-small-size, 24px);\n --_icon-button-density-small-padding: var(--forge-icon-button-density-small-padding, var(--forge-spacing-xxxsmall, 2px));\n --_icon-button-density-small-icon-size: var(--forge-icon-button-density-small-icon-size, calc(var(--forge-typography-font-size, 1rem) * 1.125));\n --_icon-button-density-medium-size: var(--forge-icon-button-density-medium-size, 36px);\n --_icon-button-density-medium-padding: var(--forge-icon-button-density-medium-padding, var(--forge-spacing-xxsmall, 4px));\n --_icon-button-density-large-size: var(--forge-icon-button-density-large-size, var(--_icon-button-size));\n --_icon-button-toggle-on-background-color: var(--forge-icon-button-toggle-on-background-color, var(--forge-theme-primary-container, #d1d5ed));\n --_icon-button-toggle-on-icon-color: var(--forge-icon-button-toggle-on-icon-color, var(--forge-theme-primary, #3f51b5));\n --_icon-button-outlined-toggle-on-background-color: var(--forge-icon-button-outlined-toggle-on-background-color, var(--forge-theme-primary-container, #d1d5ed));\n --_icon-button-outlined-toggle-on-icon-color: var(--forge-icon-button-outlined-toggle-on-icon-color, var(--forge-theme-primary, #3f51b5));\n --_icon-button-tonal-toggle-background-color: var(--forge-icon-button-tonal-toggle-background-color, var(--forge-theme-surface-container-low, #ebebeb));\n --_icon-button-tonal-toggle-on-background-color: var(--forge-icon-button-tonal-toggle-on-background-color, var(--forge-theme-primary-container, #d1d5ed));\n --_icon-button-tonal-toggle-on-icon-color: var(--forge-icon-button-tonal-toggle-on-icon-color, var(--forge-theme-primary, #3f51b5));\n --_icon-button-filled-toggle-background-color: var(--forge-icon-button-filled-toggle-background-color, var(--forge-theme-surface-container-low, #ebebeb));\n --_icon-button-filled-toggle-icon-color: var(--forge-icon-button-filled-toggle-icon-color, var(--forge-theme-primary, #3f51b5));\n --_icon-button-filled-toggle-on-background-color: var(--forge-icon-button-filled-toggle-on-background-color, var(--forge-theme-primary, #3f51b5));\n --_icon-button-filled-toggle-on-icon-color: var(--forge-icon-button-filled-toggle-on-icon-color, var(--forge-theme-on-primary, #ffffff));\n --_icon-button-disabled-cursor: var(--forge-icon-button-disabled-cursor, not-allowed);\n --_icon-button-disabled-opacity: var(--forge-icon-button-disabled-opacity, 0.38);\n --_icon-button-popover-icon-padding: var(--forge-icon-button-popover-icon-padding, var(--forge-spacing-xsmall, 8px));\n --_icon-button-focus-indicator-color: var(--forge-icon-button-focus-indicator-color, var(--forge-theme-primary, #3f51b5));\n}\n\n.forge-icon-button {\n display: var(--_icon-button-display);\n position: relative;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 0;\n display: var(--_icon-button-display);\n align-items: center;\n justify-content: center;\n gap: var(--_icon-button-gap);\n box-sizing: border-box;\n height: var(--_icon-button-density-large-size);\n min-width: var(--_icon-button-density-large-size);\n border: var(--_icon-button-border);\n border-start-start-radius: var(--_icon-button-shape-start-start);\n border-start-end-radius: var(--_icon-button-shape-start-end);\n border-end-start-radius: var(--_icon-button-shape-end-start);\n border-end-end-radius: var(--_icon-button-shape-end-end);\n padding: var(--_icon-button-padding);\n box-shadow: var(--_icon-button-shadow);\n color: var(--_icon-button-icon-color);\n background: var(--_icon-button-background-color);\n font-size: var(--_icon-button-icon-size);\n cursor: var(--_icon-button-cursor);\n user-select: none;\n transition-property: box-shadow, background;\n transition-duration: var(--_icon-button-transition-duration);\n transition-timing-function: var(--_icon-button-transition-timing);\n}\n\n.forge-icon-button img,\n.forge-icon-button svg {\n height: var(--_icon-button-icon-size);\n width: var(--_icon-button-icon-size);\n}\n\n.forge-icon-button svg {\n fill: currentColor;\n}\n\n.forge-icon-button:not(:disabled) {\n --_state-layer-display: var(--forge-state-layer-display, flex);\n --_state-layer-color: var(--forge-state-layer-color, var(--forge-theme-on-surface, #000000));\n --_state-layer-hover-color: var(--forge-state-layer-hover-color, var(--_state-layer-color));\n --_state-layer-hover-opacity: var(--forge-state-layer-hover-opacity, 0.08);\n --_state-layer-pressed-color: var(--forge-state-layer-pressed-color, var(--_state-layer-color));\n --_state-layer-pressed-opacity: var(--forge-state-layer-pressed-opacity, 0.12);\n --_state-layer-hover-duration: var(--forge-state-layer-hover-duration, 15ms);\n --_state-layer-pressed-duration: var(--forge-state-layer-pressed-duration, 105ms);\n --_state-layer-animation-duration: var(--forge-state-layer-animation-duration, 375ms);\n}\n\n.forge-icon-button:not(:disabled)::before {\n opacity: 0;\n position: absolute;\n backface-visibility: hidden;\n transform: translateZ(0);\n background-color: var(--_state-layer-hover-color);\n inset: 0;\n transition: opacity var(--_state-layer-hover-duration) linear, background-color var(--_state-layer-hover-duration) linear;\n --_state-layer-hover-duration: var(--forge-state-layer-hover-duration, 100ms);\n content: "";\n opacity: 0;\n border-radius: inherit;\n}\n\n.forge-icon-button:not(:disabled):hover::before {\n background-color: var(--_state-layer-hover-color);\n opacity: var(--_state-layer-hover-opacity);\n}\n\n.forge-icon-button:not(:disabled):active::before {\n opacity: var(--_state-layer-pressed-opacity);\n transition-duration: var(--_state-layer-pressed-duration);\n --_state-layer-pressed-opacity: var(--forge-state-layer-pressed-opacity, 0.18);\n}\n\n.forge-icon-button:not(:disabled) {\n --forge-state-layer-color: var(--_icon-button-icon-color);\n}\n\n@keyframes forge-focus-indicator-outward-grow {\n from {\n outline-width: 0;\n }\n to {\n outline-width: var(--_focus-indicator-active-width);\n }\n}\n@keyframes forge-focus-indicator-outward-shrink {\n from {\n outline-width: var(--_focus-indicator-active-width);\n }\n}\n@keyframes forge-focus-indicator-inward-grow {\n from {\n border-width: 0;\n }\n to {\n border-width: var(--_focus-indicator-active-width);\n }\n}\n@keyframes forge-focus-indicator-inward-shrink {\n from {\n border-width: var(--_focus-indicator-active-width);\n }\n}\n.forge-icon-button:not(:disabled) {\n outline: none;\n}\n\n.forge-icon-button:not(:disabled):focus-visible::after {\n --_focus-indicator-display: var(--forge-focus-indicator-display, flex);\n --_focus-indicator-width: var(--forge-focus-indicator-width, var(--forge-border-medium, 2px));\n --_focus-indicator-active-width: var(--forge-focus-indicator-active-width, 6px);\n --_focus-indicator-color: var(--forge-focus-indicator-color, var(--forge-theme-primary, #3f51b5));\n --_focus-indicator-shape: var(--forge-focus-indicator-shape, calc(var(--forge-shape-extra-small, 1px) * var(--forge-shape-factor, 1)));\n --_focus-indicator-duration: var(--forge-focus-indicator-duration, var(--forge-animation-duration-long4, 600ms));\n --_focus-indicator-easing: var(--forge-focus-indicator-easing, var(--forge-animation-easing-emphasized, cubic-bezier(0.2, 0, 0, 1)));\n --_focus-indicator-shape-start-start: var(--forge-focus-indicator-shape-start-start, var(--_focus-indicator-shape));\n --_focus-indicator-shape-start-end: var(--forge-focus-indicator-shape-start-end, var(--_focus-indicator-shape));\n --_focus-indicator-shape-end-end: var(--forge-focus-indicator-shape-end-end, var(--_focus-indicator-shape));\n --_focus-indicator-shape-end-start: var(--forge-focus-indicator-shape-end-start, var(--_focus-indicator-shape));\n --_focus-indicator-outward-offset: var(--forge-focus-indicator-outward-offset, var(--forge-spacing-xxsmall, 4px));\n --_focus-indicator-inward-offset: var(--forge-focus-indicator-inward-offset, 0px);\n --_focus-indicator-offset-block: var(--forge-focus-indicator-offset-block, 0);\n --_focus-indicator-offset-inline: var(--forge-focus-indicator-offset-inline, 0);\n}\n\n.forge-icon-button:not(:disabled):focus-visible::after {\n animation-delay: 0s, calc(var(--_focus-indicator-duration) * 0.25);\n animation-duration: calc(var(--_focus-indicator-duration) * 0.25), calc(var(--_focus-indicator-duration) * 0.75);\n animation-timing-function: var(--_focus-indicator-easing);\n box-sizing: border-box;\n color: var(--_focus-indicator-color);\n display: none;\n pointer-events: none;\n position: absolute;\n margin-block: var(--_focus-indicator-offset-block);\n margin-inline: var(--_focus-indicator-offset-inline);\n animation-name: forge-focus-indicator-outward-grow, forge-focus-indicator-outward-shrink;\n border-end-end-radius: calc(var(--_focus-indicator-shape-end-end) + var(--_focus-indicator-outward-offset));\n border-end-start-radius: calc(var(--_focus-indicator-shape-end-start) + var(--_focus-indicator-outward-offset));\n border-start-end-radius: calc(var(--_focus-indicator-shape-start-end) + var(--_focus-indicator-outward-offset));\n border-start-start-radius: calc(var(--_focus-indicator-shape-start-start) + var(--_focus-indicator-outward-offset));\n inset: calc(-1 * var(--_focus-indicator-outward-offset));\n outline: var(--_focus-indicator-width) solid currentColor;\n content: "";\n display: block;\n}\n\n.forge-icon-button:not(:disabled) {\n --forge-focus-indicator-color: var(--_icon-button-focus-indicator-color);\n --forge-focus-indicator-shape: var(--_icon-button-shape);\n}\n\n.forge-icon-button:not(:disabled):where(.forge-icon-button--text,\n:not(:where(.forge-icon-button--outlined, .forge-icon-button--tonal, .forge-icon-button--filled, .forge-icon-button--raised))) {\n --forge-focus-indicator-outward-offset: 0px;\n}\n\n.forge-icon-button--outlined {\n border-width: var(--_icon-button-outlined-border-width);\n border-style: var(--_icon-button-outlined-border-style);\n border-color: var(--_icon-button-outlined-border-color);\n}\n\n.forge-icon-button--tonal {\n --_icon-button-icon-color: var(--_icon-button-tonal-icon-color);\n --_icon-button-background-color: var(--_icon-button-tonal-background-color);\n}\n\n.forge-icon-button--filled, .forge-icon-button--raised {\n --_icon-button-icon-color: var(--_icon-button-filled-icon-color);\n --_icon-button-background-color: var(--_icon-button-filled-background-color);\n}\n\n.forge-icon-button--raised {\n --_icon-button-shadow: var(--_icon-button-raised-shadow);\n}\n\n.forge-icon-button--raised:hover {\n --_icon-button-raised-shadow: var(--_icon-button-raised-hover-shadow);\n}\n\n.forge-icon-button--raised:active {\n --_icon-button-raised-shadow: var(--_icon-button-raised-active-shadow);\n}\n\n.forge-icon-button--squared {\n --_icon-button-shape: var(--_icon-button-shape-squared);\n}\n\n.forge-icon-button--small {\n --_icon-button-size: var(--_icon-button-density-small-size);\n --_icon-button-icon-size: var(--_icon-button-density-small-icon-size);\n --_icon-button-padding: var(--_icon-button-density-small-padding);\n}\n\n.forge-icon-button--small > * {\n font-size: var(--_icon-button-density-small-icon-size);\n}\n\n.forge-icon-button--medium {\n --_icon-button-size: var(--_icon-button-density-medium-size);\n --_icon-button-padding: var(--_icon-button-density-medium-padding);\n}\n\n.forge-icon-button:disabled {\n pointer-events: none;\n opacity: var(--_icon-button-disabled-opacity);\n pointer-events: auto;\n cursor: not-allowed;\n}\n\n.forge-icon-button forge-circular-progress {\n --forge-circular-progress-indicator-color: var(--_icon-button-icon-color);\n --forge-circular-progress-track-color: transparent;\n --forge-circular-progress-size: 1em;\n}\n\n:host {\n display: block;\n}\n\n.user-message-toolbar {\n display: flex;\n align-items: center;\n gap: var(--forge-spacing-xxsmall, 4px);\n}\n\n.forge-icon-button {\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n}\n.forge-icon-button:hover {\n color: var(--forge-theme-text-high, rgba(0, 0, 0, 0.87));\n}\n\n.timestamp {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-label2-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-label2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, 0.8125)));\n font-weight: var(--forge-typography-label2-font-weight, 400);\n line-height: var(--forge-typography-label2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));\n letter-spacing: var(--forge-typography-label2-letter-spacing, 0.0096153846em);\n text-transform: var(--forge-typography-label2-text-transform, inherit);\n text-decoration: var(--forge-typography-label2-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n padding-inline: var(--forge-spacing-xxsmall, 4px);\n}';
|
|
2
|
+
export {
|
|
3
|
+
styles as default
|
|
4
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ai-user-message-toolbar.js';
|
|
@@ -2,6 +2,7 @@ import { unsafeCSS, LitElement, html } from "lit";
|
|
|
2
2
|
import { state, customElement } from "lit/decorators.js";
|
|
3
3
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
4
|
import styles from "./ai-voice-input.scss.mjs";
|
|
5
|
+
import "../core/tooltip/tooltip.mjs";
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
8
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -80,6 +81,7 @@ let AiVoiceInputComponent = class extends LitElement {
|
|
|
80
81
|
return html`
|
|
81
82
|
<div class="ai-voice-input">
|
|
82
83
|
<button
|
|
84
|
+
id="voice-btn"
|
|
83
85
|
class=${classes}
|
|
84
86
|
@click=${this._toggleRecording}
|
|
85
87
|
aria-label=${this._isRecording ? "Stop recording" : "Start recording"}
|
|
@@ -90,6 +92,9 @@ let AiVoiceInputComponent = class extends LitElement {
|
|
|
90
92
|
d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z" />
|
|
91
93
|
</svg>
|
|
92
94
|
</button>
|
|
95
|
+
<forge-ai-tooltip for="voice-btn" placement="top"
|
|
96
|
+
>${this._isRecording ? "Stop recording" : "Dictate"}</forge-ai-tooltip
|
|
97
|
+
>
|
|
93
98
|
</div>
|
|
94
99
|
`;
|
|
95
100
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './ai-actions-toolbar';
|
|
2
1
|
export * from './ai-assistant-response';
|
|
2
|
+
export * from './ai-response-message-toolbar';
|
|
3
|
+
export * from './ai-user-message-toolbar';
|
|
3
4
|
export * from './ai-agent-info';
|
|
4
5
|
export * from './ai-artifact';
|
|
5
6
|
export * from './ai-attachment';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AiActionsToolbarComponent, AiActionsToolbarComponentTagName } from "./ai-actions-toolbar/ai-actions-toolbar.mjs";
|
|
2
1
|
import { AiAssistantResponseComponent, AiAssistantResponseComponentTagName } from "./ai-assistant-response/ai-assistant-response.mjs";
|
|
2
|
+
import { AiResponseMessageToolbarComponent, AiResponseMessageToolbarComponentTagName } from "./ai-response-message-toolbar/ai-response-message-toolbar.mjs";
|
|
3
|
+
import { AiUserMessageToolbarComponent, AiUserMessageToolbarComponentTagName } from "./ai-user-message-toolbar/ai-user-message-toolbar.mjs";
|
|
3
4
|
import { AiAgentInfoComponent, AiAgentInfoComponentTagName } from "./ai-agent-info/ai-agent-info.mjs";
|
|
4
5
|
import { AiArtifactComponent, AiArtifactComponentTagName } from "./ai-artifact/ai-artifact.mjs";
|
|
5
6
|
import { AiAttachmentComponent, AiAttachmentComponentTagName } from "./ai-attachment/ai-attachment.mjs";
|
|
@@ -57,8 +58,6 @@ export {
|
|
|
57
58
|
AgUiAdapter,
|
|
58
59
|
AgentAdapter,
|
|
59
60
|
AgentRunner,
|
|
60
|
-
AiActionsToolbarComponent,
|
|
61
|
-
AiActionsToolbarComponentTagName,
|
|
62
61
|
AiAgentInfoComponent,
|
|
63
62
|
AiAgentInfoComponentTagName,
|
|
64
63
|
AiArtifactComponent,
|
|
@@ -111,6 +110,8 @@ export {
|
|
|
111
110
|
AiReasoningHeaderComponentTagName,
|
|
112
111
|
AiResponseMessageComponent,
|
|
113
112
|
AiResponseMessageComponentTagName,
|
|
113
|
+
AiResponseMessageToolbarComponent,
|
|
114
|
+
AiResponseMessageToolbarComponentTagName,
|
|
114
115
|
AiSidebarChatComponent,
|
|
115
116
|
AiSidebarChatComponentTagName,
|
|
116
117
|
AiSidebarComponent,
|
|
@@ -125,6 +126,8 @@ export {
|
|
|
125
126
|
AiThreadsComponentTagName,
|
|
126
127
|
AiUserMessageComponent,
|
|
127
128
|
AiUserMessageComponentTagName,
|
|
129
|
+
AiUserMessageToolbarComponent,
|
|
130
|
+
AiUserMessageToolbarComponentTagName,
|
|
128
131
|
AiVoiceInputComponent,
|
|
129
132
|
AiVoiceInputComponentTagName,
|
|
130
133
|
EventEmitter,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { unsafeCSS, LitElement, html } from "lit";
|
|
2
2
|
import { property, state, customElement } from "lit/decorators.js";
|
|
3
3
|
import styles from "./ai-paginator.scss.mjs";
|
|
4
|
+
import "../../core/tooltip/tooltip.mjs";
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
7
|
var __typeError = (msg) => {
|
|
@@ -37,6 +38,7 @@ let AiPaginator = class extends LitElement {
|
|
|
37
38
|
<div class="paginator-container">
|
|
38
39
|
<div class="paginator">
|
|
39
40
|
<button
|
|
41
|
+
id="prev-btn"
|
|
40
42
|
aria-label="View previous page"
|
|
41
43
|
class="forge-icon-button forge-icon-button--medium"
|
|
42
44
|
?disabled=${this._isPreviousDisabled}
|
|
@@ -45,8 +47,10 @@ let AiPaginator = class extends LitElement {
|
|
|
45
47
|
<path d="M15.41 16.58 10.83 12l4.58-4.59L14 6l-6 6 6 6z" />
|
|
46
48
|
</svg>
|
|
47
49
|
</button>
|
|
50
|
+
<forge-ai-tooltip for="prev-btn" placement="bottom">Previous</forge-ai-tooltip>
|
|
48
51
|
<span class="label">${this.currentPage} of ${this.totalPages}</span>
|
|
49
52
|
<button
|
|
53
|
+
id="next-btn"
|
|
50
54
|
aria-label="View next page"
|
|
51
55
|
class="forge-icon-button forge-icon-button--medium"
|
|
52
56
|
?disabled=${this._isNextDisabled}
|
|
@@ -55,6 +59,7 @@ let AiPaginator = class extends LitElement {
|
|
|
55
59
|
<path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6z" />
|
|
56
60
|
</svg>
|
|
57
61
|
</button>
|
|
62
|
+
<forge-ai-tooltip for="next-btn" placement="bottom">Next</forge-ai-tooltip>
|
|
58
63
|
</div>
|
|
59
64
|
</div>
|
|
60
65
|
`;
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
|
-
import { FeedbackType } from '../ai-chatbot/types.js';
|
|
3
|
-
declare global {
|
|
4
|
-
interface HTMLElementTagNameMap {
|
|
5
|
-
'forge-ai-actions-toolbar': AiActionsToolbarComponent;
|
|
6
|
-
}
|
|
7
|
-
interface HTMLElementEventMap {
|
|
8
|
-
'forge-ai-actions-toolbar-action': CustomEvent<ForgeAiActionsToolbarActionEventData>;
|
|
9
|
-
'forge-ai-actions-toolbar-feedback': CustomEvent<ForgeAiActionsToolbarFeedbackEventData>;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export interface ForgeAiActionsToolbarActionEventData {
|
|
13
|
-
action: AiActionsToolbarAction;
|
|
14
|
-
}
|
|
15
|
-
export interface ForgeAiActionsToolbarFeedbackEventData {
|
|
16
|
-
action: 'positive' | 'negative';
|
|
17
|
-
feedback?: string;
|
|
18
|
-
}
|
|
19
|
-
export type AiActionsToolbarAction = 'refresh' | 'copy' | 'thumbs-up' | 'thumbs-down';
|
|
20
|
-
export declare const AiActionsToolbarComponentTagName: keyof HTMLElementTagNameMap;
|
|
21
|
-
/**
|
|
22
|
-
* @tag forge-ai-actions-toolbar
|
|
23
|
-
*
|
|
24
|
-
* @event {CustomEvent<ForgeAiActionsToolbarActionEventData>} forge-ai-actions-toolbar-action - Fired when an action button is clicked. The detail contains the action type.
|
|
25
|
-
* @event {CustomEvent<ForgeAiActionsToolbarFeedbackEventData>} forge-ai-actions-toolbar-feedback - Fired when feedback is submitted. The detail contains the action and optional feedback text.
|
|
26
|
-
*/
|
|
27
|
-
export declare class AiActionsToolbarComponent extends LitElement {
|
|
28
|
-
static styles: import('lit').CSSResult;
|
|
29
|
-
enableReactions: boolean;
|
|
30
|
-
feedbackType?: FeedbackType;
|
|
31
|
-
private _thumbsUpActive;
|
|
32
|
-
private _thumbsDownActive;
|
|
33
|
-
private _popoverOpen;
|
|
34
|
-
private _thumbsDownButton;
|
|
35
|
-
private _thumbsDownPopover;
|
|
36
|
-
private _thumbsDownFeedbackTextarea?;
|
|
37
|
-
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
38
|
-
private _emitActionEvent;
|
|
39
|
-
private _emitFeedbackEvent;
|
|
40
|
-
private _handleThumbsUp;
|
|
41
|
-
private _handleThumbsDown;
|
|
42
|
-
private _handleFeedbackSubmit;
|
|
43
|
-
private _handleFeedbackCancel;
|
|
44
|
-
private _handlePopoverToggle;
|
|
45
|
-
private get _refreshButtonTemplate();
|
|
46
|
-
private get _copyButtonTemplate();
|
|
47
|
-
private get _thumbsUpButtonTemplate();
|
|
48
|
-
private get _thumbsDownButtonTemplate();
|
|
49
|
-
private get _feedbackFormTemplate();
|
|
50
|
-
render(): TemplateResult;
|
|
51
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { unsafeCSS, LitElement, html } from "lit";
|
|
2
|
-
import { property, state, query, customElement } from "lit/decorators.js";
|
|
3
|
-
import { when } from "lit/directives/when.js";
|
|
4
|
-
import "../core/tooltip/tooltip.mjs";
|
|
5
|
-
import "../core/popover/popover.mjs";
|
|
6
|
-
import styles from "./ai-actions-toolbar.scss.mjs";
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
-
if (decorator = decorators[i])
|
|
13
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
-
if (kind && result) __defProp(target, key, result);
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
const AiActionsToolbarComponentTagName = "forge-ai-actions-toolbar";
|
|
18
|
-
let AiActionsToolbarComponent = class extends LitElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.enableReactions = false;
|
|
22
|
-
this._thumbsUpActive = false;
|
|
23
|
-
this._thumbsDownActive = false;
|
|
24
|
-
this._popoverOpen = false;
|
|
25
|
-
}
|
|
26
|
-
willUpdate(changedProperties) {
|
|
27
|
-
if (changedProperties.has("feedbackType") && this.feedbackType) {
|
|
28
|
-
this._thumbsUpActive = this.feedbackType === "positive";
|
|
29
|
-
this._thumbsDownActive = this.feedbackType === "negative";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
_emitActionEvent(action) {
|
|
33
|
-
const event = new CustomEvent("forge-ai-actions-toolbar-action", {
|
|
34
|
-
detail: { action }
|
|
35
|
-
});
|
|
36
|
-
this.dispatchEvent(event);
|
|
37
|
-
}
|
|
38
|
-
_emitFeedbackEvent(action, feedback) {
|
|
39
|
-
const event = new CustomEvent("forge-ai-actions-toolbar-feedback", {
|
|
40
|
-
detail: { action, feedback }
|
|
41
|
-
});
|
|
42
|
-
this.dispatchEvent(event);
|
|
43
|
-
}
|
|
44
|
-
_handleThumbsUp() {
|
|
45
|
-
this._thumbsUpActive = true;
|
|
46
|
-
this._thumbsDownActive = false;
|
|
47
|
-
if (this._thumbsDownPopover) {
|
|
48
|
-
this._thumbsDownPopover.open = false;
|
|
49
|
-
}
|
|
50
|
-
this._emitFeedbackEvent("positive");
|
|
51
|
-
}
|
|
52
|
-
async _handleThumbsDown() {
|
|
53
|
-
if (this._thumbsDownPopover) {
|
|
54
|
-
const willOpen = !this._thumbsDownPopover.open;
|
|
55
|
-
if (willOpen) {
|
|
56
|
-
await this.updateComplete;
|
|
57
|
-
this._thumbsDownPopover.anchor = this._thumbsDownButton;
|
|
58
|
-
}
|
|
59
|
-
this._thumbsDownPopover.open = willOpen;
|
|
60
|
-
if (this._thumbsDownFeedbackTextarea && !willOpen) {
|
|
61
|
-
this._thumbsDownFeedbackTextarea.value = "";
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
this._thumbsUpActive = false;
|
|
65
|
-
}
|
|
66
|
-
_handleFeedbackSubmit() {
|
|
67
|
-
const feedbackText = this._thumbsDownFeedbackTextarea?.value || "";
|
|
68
|
-
this._emitFeedbackEvent("negative", feedbackText);
|
|
69
|
-
this._thumbsDownActive = true;
|
|
70
|
-
if (this._thumbsDownPopover) {
|
|
71
|
-
this._thumbsDownPopover.open = false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
_handleFeedbackCancel() {
|
|
75
|
-
if (this._thumbsDownPopover) {
|
|
76
|
-
this._thumbsDownPopover.open = false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
_handlePopoverToggle(evt) {
|
|
80
|
-
this._popoverOpen = evt.detail.open;
|
|
81
|
-
}
|
|
82
|
-
get _refreshButtonTemplate() {
|
|
83
|
-
return html`
|
|
84
|
-
<button
|
|
85
|
-
id="refresh-btn"
|
|
86
|
-
aria-label="Refresh"
|
|
87
|
-
class="forge-icon-button forge-icon-button--small"
|
|
88
|
-
@click=${() => this._emitActionEvent("refresh")}>
|
|
89
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
90
|
-
<path
|
|
91
|
-
d="M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 0 0-8 8 8 8 0 0 0 8 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18a6 6 0 0 1-6-6 6 6 0 0 1 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z" />
|
|
92
|
-
</svg>
|
|
93
|
-
</button>
|
|
94
|
-
<forge-ai-tooltip for="refresh-btn" placement="bottom">Resend</forge-ai-tooltip>
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
get _copyButtonTemplate() {
|
|
98
|
-
return html`
|
|
99
|
-
<button
|
|
100
|
-
id="copy-btn"
|
|
101
|
-
aria-label="Copy content"
|
|
102
|
-
class="forge-icon-button forge-icon-button--small"
|
|
103
|
-
@click=${() => this._emitActionEvent("copy")}>
|
|
104
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
105
|
-
<path
|
|
106
|
-
d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z" />
|
|
107
|
-
</svg>
|
|
108
|
-
</button>
|
|
109
|
-
<forge-ai-tooltip for="copy-btn" placement="bottom">Copy</forge-ai-tooltip>
|
|
110
|
-
`;
|
|
111
|
-
}
|
|
112
|
-
get _thumbsUpButtonTemplate() {
|
|
113
|
-
return html`
|
|
114
|
-
<button
|
|
115
|
-
id="thumbs-up-btn"
|
|
116
|
-
aria-label="Thumbs up"
|
|
117
|
-
class="forge-icon-button forge-icon-button--small ${this._thumbsUpActive ? "is-active-positive" : ""}"
|
|
118
|
-
@click=${this._handleThumbsUp}>
|
|
119
|
-
${this._thumbsUpActive ? html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
120
|
-
<path
|
|
121
|
-
d="M23 10a2 2 0 0 0-2-2h-6.32l.96-4.57c.02-.1.03-.21.03-.32 0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.58C7.22 7.95 7 8.45 7 9v10a2 2 0 0 0 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73zM1 21h4V9H1z" />
|
|
122
|
-
</svg>` : html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
123
|
-
<path
|
|
124
|
-
d="M5 9v12H1V9zm4 12a2 2 0 0 1-2-2V9c0-.55.22-1.05.59-1.41L14.17 1l1.06 1.06c.27.27.44.64.44 1.05l-.03.32L14.69 8H21a2 2 0 0 1 2 2v2c0 .26-.05.5-.14.73l-3.02 7.05C19.54 20.5 18.83 21 18 21zm0-2h9.03L21 12v-2h-8.79l1.13-5.32L9 9.03z" />
|
|
125
|
-
</svg>`}
|
|
126
|
-
</button>
|
|
127
|
-
<forge-ai-tooltip for="thumbs-up-btn" placement="bottom">Thumbs up</forge-ai-tooltip>
|
|
128
|
-
`;
|
|
129
|
-
}
|
|
130
|
-
get _thumbsDownButtonTemplate() {
|
|
131
|
-
return html`
|
|
132
|
-
<button
|
|
133
|
-
id="thumbs-down-btn"
|
|
134
|
-
aria-label="Thumbs down"
|
|
135
|
-
class="forge-icon-button forge-icon-button--small ${this._thumbsDownActive || this._popoverOpen ? "is-active-negative" : ""}"
|
|
136
|
-
@click=${this._handleThumbsDown}>
|
|
137
|
-
${this._thumbsDownActive || this._popoverOpen ? html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
138
|
-
<path
|
|
139
|
-
d="M19 15h4V3h-4m-4 0H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2a2 2 0 0 0 2 2h6.31l-.95 4.57c-.02.1-.03.2-.03.31 0 .42.17.79.44 1.06L9.83 23l6.58-6.59c.37-.36.59-.86.59-1.41V5a2 2 0 0 0-2-2" />
|
|
140
|
-
</svg>` : html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
141
|
-
<path
|
|
142
|
-
d="M19 15V3h4v12zM15 3a2 2 0 0 1 2 2v10c0 .55-.22 1.05-.59 1.41L9.83 23l-1.06-1.06c-.27-.27-.44-.64-.44-1.06l.03-.31.95-4.57H3a2 2 0 0 1-2-2v-2c0-.26.05-.5.14-.73l3.02-7.05C4.46 3.5 5.17 3 6 3zm0 2H5.97L3 12v2h8.78l-1.13 5.32L15 14.97z" />
|
|
143
|
-
</svg>`}
|
|
144
|
-
</button>
|
|
145
|
-
<forge-ai-tooltip for="thumbs-down-btn" placement="bottom">Thumbs down</forge-ai-tooltip>
|
|
146
|
-
<forge-ai-popover
|
|
147
|
-
.anchor=${this._thumbsDownButton ?? null}
|
|
148
|
-
placement="bottom"
|
|
149
|
-
.shift=${true}
|
|
150
|
-
flip
|
|
151
|
-
arrow
|
|
152
|
-
@forge-ai-popover-toggle=${this._handlePopoverToggle}>
|
|
153
|
-
${this._feedbackFormTemplate}
|
|
154
|
-
</forge-ai-popover>
|
|
155
|
-
`;
|
|
156
|
-
}
|
|
157
|
-
get _feedbackFormTemplate() {
|
|
158
|
-
return html`
|
|
159
|
-
<div class="popover-content">
|
|
160
|
-
<div class="popover-header">Leave feedback for this response</div>
|
|
161
|
-
<div class="forge-field">
|
|
162
|
-
<textarea placeholder="Enter your feedback..."></textarea>
|
|
163
|
-
</div>
|
|
164
|
-
<div class="popover-actions">
|
|
165
|
-
<button class="forge-button forge-button--outlined" @click=${this._handleFeedbackCancel}>Cancel</button>
|
|
166
|
-
<button class="forge-button forge-button--filled" @click=${this._handleFeedbackSubmit}>Submit</button>
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
`;
|
|
170
|
-
}
|
|
171
|
-
render() {
|
|
172
|
-
return html`
|
|
173
|
-
<div class="actions-toolbar">
|
|
174
|
-
${this._refreshButtonTemplate} ${this._copyButtonTemplate}
|
|
175
|
-
${when(this.enableReactions, () => html`${this._thumbsUpButtonTemplate} ${this._thumbsDownButtonTemplate}`)}
|
|
176
|
-
</div>
|
|
177
|
-
`;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
AiActionsToolbarComponent.styles = unsafeCSS(styles);
|
|
181
|
-
__decorateClass([
|
|
182
|
-
property({ type: Boolean, attribute: "enable-reactions" })
|
|
183
|
-
], AiActionsToolbarComponent.prototype, "enableReactions", 2);
|
|
184
|
-
__decorateClass([
|
|
185
|
-
property({ attribute: "feedback-type" })
|
|
186
|
-
], AiActionsToolbarComponent.prototype, "feedbackType", 2);
|
|
187
|
-
__decorateClass([
|
|
188
|
-
state()
|
|
189
|
-
], AiActionsToolbarComponent.prototype, "_thumbsUpActive", 2);
|
|
190
|
-
__decorateClass([
|
|
191
|
-
state()
|
|
192
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownActive", 2);
|
|
193
|
-
__decorateClass([
|
|
194
|
-
state()
|
|
195
|
-
], AiActionsToolbarComponent.prototype, "_popoverOpen", 2);
|
|
196
|
-
__decorateClass([
|
|
197
|
-
query("#thumbs-down-btn")
|
|
198
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownButton", 2);
|
|
199
|
-
__decorateClass([
|
|
200
|
-
query("forge-ai-popover")
|
|
201
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownPopover", 2);
|
|
202
|
-
__decorateClass([
|
|
203
|
-
query("textarea")
|
|
204
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownFeedbackTextarea", 2);
|
|
205
|
-
AiActionsToolbarComponent = __decorateClass([
|
|
206
|
-
customElement(AiActionsToolbarComponentTagName)
|
|
207
|
-
], AiActionsToolbarComponent);
|
|
208
|
-
export {
|
|
209
|
-
AiActionsToolbarComponent,
|
|
210
|
-
AiActionsToolbarComponentTagName
|
|
211
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ai-actions-toolbar';
|