@tylertech/forge-ai 0.15.1 → 0.15.3-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/custom-elements.json +8152 -6309
  2. package/dist/ai-artifact-card/ai-artifact-card.d.ts +75 -0
  3. package/dist/ai-artifact-card/ai-artifact-card.mjs +142 -0
  4. package/dist/ai-artifact-card/ai-artifact-card.scss.mjs +283 -0
  5. package/dist/ai-artifact-card/index.d.ts +1 -0
  6. package/dist/ai-artifact-card/index.mjs +5 -0
  7. package/dist/ai-artifact-card-group/ai-artifact-card-group.d.ts +57 -0
  8. package/dist/ai-artifact-card-group/ai-artifact-card-group.mjs +137 -0
  9. package/dist/ai-artifact-card-group/ai-artifact-card-group.scss.mjs +173 -0
  10. package/dist/ai-artifact-card-group/index.d.ts +1 -0
  11. package/dist/ai-artifact-card-group/index.mjs +5 -0
  12. package/dist/ai-assistant-response/ai-assistant-response.mjs +25 -2
  13. package/dist/ai-chatbot/ag-ui-adapter.mjs +1 -1
  14. package/dist/ai-chatbot/agent-adapter.d.ts +108 -1
  15. package/dist/ai-chatbot/agent-adapter.mjs +22 -0
  16. package/dist/ai-chatbot/ai-chatbot-base.d.ts +26 -0
  17. package/dist/ai-chatbot/ai-chatbot-base.mjs +136 -3
  18. package/dist/ai-chatbot/index.d.ts +2 -2
  19. package/dist/ai-chatbot/message-state-controller.d.ts +10 -1
  20. package/dist/ai-chatbot/message-state-controller.mjs +78 -20
  21. package/dist/ai-chatbot/types.d.ts +199 -1
  22. package/dist/ai-chatbot/utils.mjs +3 -1
  23. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +14 -4
  24. package/dist/ai-message-thread/ai-message-thread.d.ts +1 -0
  25. package/dist/ai-message-thread/ai-message-thread.mjs +35 -3
  26. package/dist/ai-sidebar/ai-sidebar.d.ts +17 -6
  27. package/dist/ai-sidebar/ai-sidebar.mjs +78 -36
  28. package/dist/ai-sidebar/ai-sidebar.scss.mjs +1 -1
  29. package/dist/ai-sidebar/index.d.ts +1 -0
  30. package/dist/ai-sidebar-chat/ai-sidebar-chat.d.ts +14 -1
  31. package/dist/ai-sidebar-chat/ai-sidebar-chat.mjs +18 -14
  32. package/dist/ai-steps/ai-steps.d.ts +67 -0
  33. package/dist/ai-steps/ai-steps.mjs +163 -0
  34. package/dist/ai-steps/ai-steps.scss.mjs +4 -0
  35. package/dist/ai-steps/index.d.ts +1 -0
  36. package/dist/ai-steps/index.mjs +5 -0
  37. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.mjs +1 -1
  38. package/dist/core/chatbot-core-controller.d.ts +2 -0
  39. package/dist/core/chatbot-core-controller.mjs +99 -4
  40. package/dist/core/resize-controller.d.ts +1 -0
  41. package/dist/core/resize-controller.mjs +11 -2
  42. package/dist/index.d.ts +3 -0
  43. package/dist/index.mjs +9 -0
  44. package/dist/tools/ai-mcp-app/ai-mcp-app.d.ts +69 -0
  45. package/dist/tools/ai-mcp-app/ai-mcp-app.mjs +574 -0
  46. package/dist/tools/ai-mcp-app/ai-mcp-app.scss.mjs +4 -0
  47. package/dist/tools/ai-mcp-app/index.d.ts +3 -0
  48. package/dist/tools/ai-mcp-app/index.mjs +6 -0
  49. package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.d.ts +61 -0
  50. package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.mjs +156 -0
  51. package/dist/tools/ai-mcp-app/mcp-app-bridge-types.d.ts +123 -0
  52. package/dist/tools/ai-mcp-app/mcp-app-bridge.d.ts +41 -0
  53. package/dist/tools/ai-mcp-app/mcp-app-bridge.mjs +293 -0
  54. package/dist/tools/ai-mcp-app/mcp-app-context.d.ts +46 -0
  55. package/dist/tools/ai-mcp-app/mcp-app-context.mjs +5 -0
  56. package/dist/tools/ai-steps/ai-steps-definition.d.ts +2 -0
  57. package/dist/tools/ai-steps/ai-steps-definition.mjs +50 -0
  58. package/dist/tools/ai-steps/ai-steps.d.ts +28 -0
  59. package/dist/tools/ai-steps/ai-steps.mjs +49 -0
  60. package/dist/tools/ai-steps/ai-steps.scss.mjs +4 -0
  61. package/dist/tools/ai-steps/index.d.ts +2 -0
  62. package/dist/tools/ai-steps/index.mjs +6 -0
  63. package/dist/tools/index.d.ts +1 -0
  64. package/dist/tools/index.mjs +5 -1
  65. package/dist/utils/index.d.ts +1 -0
  66. package/dist/utils/index.mjs +5 -1
  67. package/dist/utils/inert-outside.d.ts +7 -0
  68. package/dist/utils/inert-outside.mjs +28 -0
  69. package/dist/utils/storage-utils.d.ts +26 -0
  70. package/dist/utils/storage-utils.mjs +32 -0
  71. package/package.json +4 -1
@@ -40,7 +40,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
40
40
  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);
41
41
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
42
42
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
43
- var _headerRef, _gradientContainerRef, _historyButtonRef, _historyPopoverSearchRef, _historyViewSearchRef, _internals, _pendingThreadDeleteSource, _deleteThreadController, _AiChatbotLauncherComponent_instances, setViewState_fn, focusAfterUpdate_fn, transitionToConversation_fn, commitConversationTransition_fn, transitionToWelcome_fn, transitionToHistory_fn, handleHistoryBack_fn, handleHeaderClear_fn, handleHeaderInfo_fn, handleThreadRename_fn, handleEditSave_fn, handleEditCancel_fn, handleThreadNameClick_fn, handleThreadDelete_fn, handleHistoryButtonClick_fn, handleHistoryPopoverToggle_fn, handleViewAllClick_fn, handleThreadsSearchQuery_fn, handleThreadsSearchLoadMore_fn, handleThreadsSearchSelect_fn, handleThreadsSearchRetry_fn, handleThreadsSearchNewChat_fn, handleThreadsSearchRename_fn, handleThreadsSearchDelete_fn, handleThreadsSearchDeleteConfirm_fn, headingElement_get, promptTemplate_get, welcomeHeaderTemplate_get, welcomeSuggestionsTemplate_get, threadName_get, threadActionsMenu_get, conversationContentTemplate_get, historyContentTemplate_get, mainContentTemplate_get, showThreadsLoading_get, historyButtonTemplate_get, historyPopoverTemplate_get, promptSectionTemplate_get;
43
+ var _headerRef, _gradientContainerRef, _historyButtonRef, _historyPopoverSearchRef, _historyViewSearchRef, _internals, _pendingThreadDeleteSource, _deleteThreadController, _AiChatbotLauncherComponent_instances, setViewState_fn, focusAfterUpdate_fn, transitionToConversation_fn, commitConversationTransition_fn, transitionToWelcome_fn, transitionToHistory_fn, handleHistoryBack_fn, handleHeaderClear_fn, handleHeaderInfo_fn, handleThreadRename_fn, handleEditSave_fn, handleEditCancel_fn, handleThreadNameClick_fn, handleThreadDelete_fn, handleHistoryButtonClick_fn, handleHistoryPopoverToggle_fn, handleHistoryPopoverKeydown_fn, handleViewAllClick_fn, handleThreadsSearchQuery_fn, handleThreadsSearchLoadMore_fn, handleThreadsSearchSelect_fn, handleThreadsSearchRetry_fn, handleThreadsSearchNewChat_fn, handleThreadsSearchRename_fn, handleThreadsSearchDelete_fn, handleThreadsSearchDeleteConfirm_fn, headingElement_get, promptTemplate_get, welcomeHeaderTemplate_get, welcomeSuggestionsTemplate_get, threadName_get, threadActionsMenu_get, conversationContentTemplate_get, historyContentTemplate_get, mainContentTemplate_get, showThreadsLoading_get, historyButtonTemplate_get, historyPopoverTemplate_get, promptSectionTemplate_get;
44
44
  const HISTORY_POPOVER_INSET = 48;
45
45
  const AiChatbotLauncherComponentTagName = "forge-ai-chatbot-launcher";
46
46
  let AiChatbotLauncherComponent = class extends AiChatbotBase {
@@ -315,11 +315,22 @@ handleHistoryPopoverToggle_fn = function(evt) {
315
315
  void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => __privateGet(this, _historyPopoverSearchRef).value);
316
316
  return;
317
317
  }
318
+ const activeElement = this.shadowRoot?.activeElement ?? null;
319
+ const focusInsidePopover = evt.currentTarget.contains(activeElement);
318
320
  const focusLost = this.ownerDocument.activeElement === this.ownerDocument.body;
319
- if (focusLost && this._viewState !== "history") {
321
+ if ((focusInsidePopover || focusLost) && this._viewState !== "history") {
320
322
  __privateGet(this, _historyButtonRef).value?.focus();
321
323
  }
322
324
  };
325
+ handleHistoryPopoverKeydown_fn = function(evt) {
326
+ if (evt.key !== "Escape" || evt.defaultPrevented) {
327
+ return;
328
+ }
329
+ evt.preventDefault();
330
+ evt.stopPropagation();
331
+ this._historyPopoverOpen = false;
332
+ void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => __privateGet(this, _historyButtonRef).value);
333
+ };
323
334
  handleViewAllClick_fn = function() {
324
335
  this._historyPopoverOpen = false;
325
336
  __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToHistory_fn).call(this);
@@ -468,7 +479,6 @@ threadName_get = function() {
468
479
  isEditing,
469
480
  () => html`
470
481
  <forge-ai-edit-thread
471
- density="medium"
472
482
  .thread=${{
473
483
  id: threadId,
474
484
  title: this.threadName || "",
@@ -511,7 +521,6 @@ threadActionsMenu_get = function() {
511
521
  };
512
522
  return html`
513
523
  <forge-ai-thread-actions-menu
514
- density="medium"
515
524
  .thread=${thread}
516
525
  ?show-rename=${this.showThreadRename}
517
526
  ?show-delete=${this.showThreadDelete}
@@ -659,6 +668,7 @@ historyPopoverTemplate_get = function() {
659
668
  .flip=${true}
660
669
  .autoSize=${true}
661
670
  ?open=${this._historyPopoverOpen}
671
+ @keydown=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHistoryPopoverKeydown_fn)}
662
672
  @forge-ai-popover-toggle=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHistoryPopoverToggle_fn)}>
663
673
  <div class="history-popover" style=${popoverWidth ? `width: ${popoverWidth}px` : ""}>
664
674
  <forge-ai-threads-search
@@ -61,6 +61,7 @@ export declare class AiMessageThreadComponent extends LitElement {
61
61
  debugMode: boolean;
62
62
  autoScroll: FeatureToggle;
63
63
  private _messageThreadContainer;
64
+ private _messageThreadContent;
64
65
  connectedCallback(): void;
65
66
  disconnectedCallback(): void;
66
67
  firstUpdated(): void;
@@ -2,6 +2,7 @@ import { unsafeCSS, LitElement, html, nothing } from "lit";
2
2
  import { property, query, customElement } from "lit/decorators.js";
3
3
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
4
4
  import { when } from "lit/directives/when.js";
5
+ import { keyed } from "lit/directives/keyed.js";
5
6
  import { MarkdownStreamController } from "../ai-chatbot/markdown-stream-controller.mjs";
6
7
  import "../ai-assistant-response/ai-assistant-response.mjs";
7
8
  import "../ai-client-message/ai-client-message.mjs";
@@ -12,6 +13,7 @@ import "../ai-thinking-indicator/ai-thinking-indicator.mjs";
12
13
  import "../ai-user-message/ai-user-message.mjs";
13
14
  import "../ai-chatbot/ai-chatbot-tool-call.mjs";
14
15
  import "../core/tooltip/tooltip.mjs";
16
+ import "../tools/ai-mcp-app/ai-mcp-app.mjs";
15
17
  import styles from "./ai-message-thread.scss.mjs";
16
18
  var __defProp = Object.defineProperty;
17
19
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -31,7 +33,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
31
33
  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);
32
34
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
33
35
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
34
- var _markdownController, _canAutoScroll, _resizeObserver, _AiMessageThreadComponent_instances, scheduleScroll_fn, checkScrollState_fn, _handleScroll, _handleScrollToBottomClick, scrollToBottomButton_get, handleCopy_fn, handleResend_fn, handleThumbsUp_fn, handleThumbsDown_fn, handleUserCopy_fn, handleUserResend_fn, handleUserEdit_fn, renderToolCall_fn, activeResponse_get, renderAssistantResponse_fn, emptyState_get, thinkingIndicator_get, messages_get, dispatchEvent_fn;
36
+ var _markdownController, _canAutoScroll, _lastScrollTop, _resizeObserver, _contentResizeObserver, _AiMessageThreadComponent_instances, observe_fn, handleContentResize_fn, scheduleScroll_fn, checkScrollState_fn, _handleScroll, _handleScrollToBottomClick, scrollToBottomButton_get, handleCopy_fn, handleResend_fn, handleThumbsUp_fn, handleThumbsDown_fn, handleUserCopy_fn, handleUserResend_fn, handleUserEdit_fn, renderToolCall_fn, activeResponse_get, renderAssistantResponse_fn, emptyState_get, thinkingIndicator_get, messages_get, dispatchEvent_fn;
35
37
  const AiMessageThreadComponentTagName = "forge-ai-message-thread";
36
38
  const SCROLL_THRESHOLD = 100;
37
39
  let AiMessageThreadComponent = class extends LitElement {
@@ -45,7 +47,9 @@ let AiMessageThreadComponent = class extends LitElement {
45
47
  this.autoScroll = "on";
46
48
  __privateAdd(this, _markdownController);
47
49
  __privateAdd(this, _canAutoScroll, true);
50
+ __privateAdd(this, _lastScrollTop, 0);
48
51
  __privateAdd(this, _resizeObserver);
52
+ __privateAdd(this, _contentResizeObserver);
49
53
  __privateAdd(this, _handleScroll, () => {
50
54
  __privateMethod(this, _AiMessageThreadComponent_instances, checkScrollState_fn).call(this);
51
55
  });
@@ -57,13 +61,18 @@ let AiMessageThreadComponent = class extends LitElement {
57
61
  super.connectedCallback();
58
62
  __privateSet(this, _markdownController, new MarkdownStreamController(this));
59
63
  __privateSet(this, _resizeObserver, new ResizeObserver(() => __privateMethod(this, _AiMessageThreadComponent_instances, checkScrollState_fn).call(this)));
64
+ __privateSet(this, _contentResizeObserver, new ResizeObserver(() => __privateMethod(this, _AiMessageThreadComponent_instances, handleContentResize_fn).call(this)));
65
+ if (this.hasUpdated) {
66
+ __privateMethod(this, _AiMessageThreadComponent_instances, observe_fn).call(this);
67
+ }
60
68
  }
61
69
  disconnectedCallback() {
62
70
  super.disconnectedCallback();
63
71
  __privateGet(this, _resizeObserver)?.disconnect();
72
+ __privateGet(this, _contentResizeObserver)?.disconnect();
64
73
  }
65
74
  firstUpdated() {
66
- __privateGet(this, _resizeObserver)?.observe(this._messageThreadContainer);
75
+ __privateMethod(this, _AiMessageThreadComponent_instances, observe_fn).call(this);
67
76
  }
68
77
  updated(changedProperties) {
69
78
  super.updated(changedProperties);
@@ -95,8 +104,19 @@ let AiMessageThreadComponent = class extends LitElement {
95
104
  };
96
105
  _markdownController = /* @__PURE__ */ new WeakMap();
97
106
  _canAutoScroll = /* @__PURE__ */ new WeakMap();
107
+ _lastScrollTop = /* @__PURE__ */ new WeakMap();
98
108
  _resizeObserver = /* @__PURE__ */ new WeakMap();
109
+ _contentResizeObserver = /* @__PURE__ */ new WeakMap();
99
110
  _AiMessageThreadComponent_instances = /* @__PURE__ */ new WeakSet();
111
+ observe_fn = function() {
112
+ __privateGet(this, _resizeObserver)?.observe(this._messageThreadContainer);
113
+ __privateGet(this, _contentResizeObserver)?.observe(this._messageThreadContent);
114
+ };
115
+ handleContentResize_fn = function() {
116
+ if (this.autoScroll === "on") {
117
+ this.scrollToBottom({ behavior: "instant" });
118
+ }
119
+ };
100
120
  scheduleScroll_fn = async function() {
101
121
  await this.updateComplete;
102
122
  await new Promise(requestAnimationFrame);
@@ -108,7 +128,10 @@ checkScrollState_fn = function() {
108
128
  return;
109
129
  }
110
130
  const { scrollTop, scrollHeight, clientHeight } = container;
111
- const canAutoScroll = scrollTop + clientHeight >= scrollHeight - SCROLL_THRESHOLD;
131
+ const isNearBottom = scrollTop + clientHeight >= scrollHeight - SCROLL_THRESHOLD;
132
+ const scrolledUp = scrollTop < __privateGet(this, _lastScrollTop);
133
+ __privateSet(this, _lastScrollTop, scrollTop);
134
+ const canAutoScroll = isNearBottom || __privateGet(this, _canAutoScroll) && !scrolledUp;
112
135
  if (canAutoScroll !== __privateGet(this, _canAutoScroll)) {
113
136
  __privateSet(this, _canAutoScroll, canAutoScroll);
114
137
  this.requestUpdate();
@@ -173,6 +196,9 @@ handleUserEdit_fn = function(messageId, content) {
173
196
  });
174
197
  };
175
198
  renderToolCall_fn = function(toolCall) {
199
+ if (toolCall.uiResource) {
200
+ return keyed(toolCall.id, html`<forge-ai-mcp-app .toolCall=${toolCall}></forge-ai-mcp-app>`);
201
+ }
176
202
  const toolDefinition = this.tools?.get(toolCall.name);
177
203
  return html`<forge-ai-chatbot-tool-call
178
204
  .toolCall=${toolCall}
@@ -231,6 +257,9 @@ messages_get = function() {
231
257
  return true;
232
258
  }
233
259
  if (item.type === "toolCall") {
260
+ if (item.data.uiResource) {
261
+ return true;
262
+ }
234
263
  const toolDef = this.tools?.get(item.data.name);
235
264
  return !!toolDef?.renderer;
236
265
  }
@@ -318,6 +347,9 @@ __decorateClass([
318
347
  __decorateClass([
319
348
  query(".message-thread")
320
349
  ], AiMessageThreadComponent.prototype, "_messageThreadContainer", 2);
350
+ __decorateClass([
351
+ query(".message-thread-content")
352
+ ], AiMessageThreadComponent.prototype, "_messageThreadContent", 2);
321
353
  AiMessageThreadComponent = __decorateClass([
322
354
  customElement(AiMessageThreadComponentTagName)
323
355
  ], AiMessageThreadComponent);
@@ -1,4 +1,5 @@
1
- import { LitElement, TemplateResult, CSSResult } from 'lit';
1
+ import { LitElement, PropertyValues, TemplateResult, CSSResult } from 'lit';
2
+ import { FeatureToggle } from '../ai-chatbot';
2
3
  declare global {
3
4
  interface HTMLElementTagNameMap {
4
5
  'forge-ai-sidebar': AiSidebarComponent;
@@ -6,8 +7,12 @@ declare global {
6
7
  interface HTMLElementEventMap {
7
8
  'forge-ai-sidebar-open': CustomEvent<void>;
8
9
  'forge-ai-sidebar-close': CustomEvent<void>;
10
+ 'forge-ai-sidebar-resize': CustomEvent<ForgeAiSidebarResizeEventData>;
9
11
  }
10
12
  }
13
+ export interface ForgeAiSidebarResizeEventData {
14
+ width: number;
15
+ }
11
16
  export declare const AiSidebarComponentTagName: keyof HTMLElementTagNameMap;
12
17
  /**
13
18
  * @tag forge-ai-sidebar
@@ -16,6 +21,7 @@ export declare const AiSidebarComponentTagName: keyof HTMLElementTagNameMap;
16
21
  *
17
22
  * @fires forge-ai-sidebar-open - Fired when the sidebar is opened
18
23
  * @fires forge-ai-sidebar-close - Fired when the sidebar is closed
24
+ * @fires forge-ai-sidebar-resize - Fired when a resize is committed via pointer release or keyboard step
19
25
  */
20
26
  export declare class AiSidebarComponent extends LitElement {
21
27
  #private;
@@ -25,10 +31,15 @@ export declare class AiSidebarComponent extends LitElement {
25
31
  */
26
32
  open: boolean;
27
33
  /**
28
- * Enables sidebar resizing.
34
+ * Enables sidebar resizing. Set to `'off'` to disable and reset to the default width.
35
+ */
36
+ resizable: FeatureToggle;
37
+ /**
38
+ * The current width of the sidebar in pixels. Clamped to the min/max bounds and viewport.
39
+ * Resized widths are persisted per tab in sessionStorage and shared across tabs via localStorage.
40
+ * On load the session value is preferred, then the local value, then the default.
29
41
  */
30
- resizable: boolean;
31
- private _width;
42
+ width: number;
32
43
  /**
33
44
  * Indicates whether the sidebar is in a closing animation state.
34
45
  */
@@ -41,6 +52,7 @@ export declare class AiSidebarComponent extends LitElement {
41
52
  * Indicates whether the sidebar is being resized.
42
53
  */
43
54
  private _isResizing;
55
+ constructor();
44
56
  render(): TemplateResult;
45
57
  /**
46
58
  * Opens the sidebar.
@@ -54,6 +66,5 @@ export declare class AiSidebarComponent extends LitElement {
54
66
  * Toggles the sidebar open state.
55
67
  */
56
68
  toggle(): void;
57
- firstUpdated(): void;
58
- updated(changedProperties: Map<string, unknown>): void;
69
+ willUpdate(changedProperties: PropertyValues<this>): void;
59
70
  }
@@ -5,6 +5,7 @@ import { styleMap } from "lit/directives/style-map.js";
5
5
  import { createRef, ref } from "lit/directives/ref.js";
6
6
  import { when } from "lit/directives/when.js";
7
7
  import { ResizeController } from "../core/resize-controller.mjs";
8
+ import { readStoredNumber, writeStoredNumber, removeStoredValue } from "../utils/storage-utils.mjs";
8
9
  import styles from "./ai-sidebar.scss.mjs";
9
10
  var __defProp = Object.defineProperty;
10
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -24,18 +25,20 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
24
25
  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);
25
26
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
26
27
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
27
- var _resizeHandleRef, _drawerRef, _containerRef, _resizeController, _AiSidebarComponent_instances, handleContainerTransitionEnd_fn, handleDrawerTransitionEnd_fn, handleResizePointerDown_fn, handleResizeKeyDown_fn, dispatchEvent_fn;
28
+ var _resizeHandleRef, _drawerRef, _containerRef, _resizeController, _AiSidebarComponent_instances, handleContainerTransitionEnd_fn, handleDrawerTransitionEnd_fn, handleResizePointerDown_fn, handleResizeKeyDown_fn, handleResizeCommit_fn, readPersistedWidth_fn, persistWidth_fn, clearPersistedWidth_fn, dispatchEvent_fn;
28
29
  const DEFAULT_WIDTH = 420;
29
30
  const MIN_WIDTH = 360;
30
31
  const MAX_WIDTH = 800;
32
+ const WIDTH_STORAGE_KEY = "forge-ai-sidebar-width";
33
+ const WIDTH_STORAGE_KINDS = ["session", "local"];
31
34
  const AiSidebarComponentTagName = "forge-ai-sidebar";
32
35
  let AiSidebarComponent = class extends LitElement {
33
36
  constructor() {
34
- super(...arguments);
37
+ super();
35
38
  __privateAdd(this, _AiSidebarComponent_instances);
36
39
  this.open = false;
37
- this.resizable = true;
38
- this._width = DEFAULT_WIDTH;
40
+ this.resizable = "on";
41
+ this.width = DEFAULT_WIDTH;
39
42
  this._closing = false;
40
43
  this._containerClosing = false;
41
44
  this._isResizing = false;
@@ -43,6 +46,26 @@ let AiSidebarComponent = class extends LitElement {
43
46
  __privateAdd(this, _drawerRef, createRef());
44
47
  __privateAdd(this, _containerRef, createRef());
45
48
  __privateAdd(this, _resizeController);
49
+ this.width = __privateMethod(this, _AiSidebarComponent_instances, readPersistedWidth_fn).call(this) ?? DEFAULT_WIDTH;
50
+ __privateSet(this, _resizeController, new ResizeController(this, {
51
+ targetElementRef: __privateGet(this, _containerRef),
52
+ resizeHandleRef: __privateGet(this, _resizeHandleRef),
53
+ minWidth: MIN_WIDTH,
54
+ maxWidth: MAX_WIDTH,
55
+ defaultWidth: DEFAULT_WIDTH,
56
+ onResize: (width) => {
57
+ this.width = width;
58
+ },
59
+ onResizeStart: () => {
60
+ this._isResizing = true;
61
+ },
62
+ onResizeEnd: () => {
63
+ this._isResizing = false;
64
+ },
65
+ onCommit: (width) => {
66
+ __privateMethod(this, _AiSidebarComponent_instances, handleResizeCommit_fn).call(this, width);
67
+ }
68
+ }));
46
69
  }
47
70
  render() {
48
71
  const containerClasses = {
@@ -64,7 +87,7 @@ let AiSidebarComponent = class extends LitElement {
64
87
  "resize-handle--active": this._isResizing
65
88
  };
66
89
  const containerStyles = {
67
- "--forge-drawer-width": `${this._width}px`
90
+ "--forge-drawer-width": `${this.width}px`
68
91
  };
69
92
  return html`
70
93
  <div
@@ -80,7 +103,7 @@ let AiSidebarComponent = class extends LitElement {
80
103
  aria-hidden=${!this.open}
81
104
  @transitionend=${__privateMethod(this, _AiSidebarComponent_instances, handleDrawerTransitionEnd_fn)}>
82
105
  ${when(
83
- this.resizable,
106
+ this.resizable === "on",
84
107
  () => html`
85
108
  <div
86
109
  ${ref(__privateGet(this, _resizeHandleRef))}
@@ -90,11 +113,18 @@ let AiSidebarComponent = class extends LitElement {
90
113
  aria-label="Resize chatbot panel, use left and right arrow keys"
91
114
  aria-valuemin="${MIN_WIDTH}"
92
115
  aria-valuemax="${MAX_WIDTH}"
93
- aria-valuenow=${this._width}
94
- aria-valuetext="${this._width} pixels"
116
+ aria-valuenow=${this.width}
117
+ aria-valuetext="${this.width} pixels"
95
118
  tabindex="0"
96
119
  @pointerdown=${__privateMethod(this, _AiSidebarComponent_instances, handleResizePointerDown_fn)}
97
- @keydown=${__privateMethod(this, _AiSidebarComponent_instances, handleResizeKeyDown_fn)}></div>
120
+ @keydown=${__privateMethod(this, _AiSidebarComponent_instances, handleResizeKeyDown_fn)}>
121
+ <span class="resize-handle__grip" aria-hidden="true">
122
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
123
+ <path
124
+ d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" />
125
+ </svg>
126
+ </span>
127
+ </div>
98
128
  `
99
129
  )}
100
130
  <slot></slot>
@@ -132,27 +162,15 @@ let AiSidebarComponent = class extends LitElement {
132
162
  this.show();
133
163
  }
134
164
  }
135
- firstUpdated() {
136
- __privateSet(this, _resizeController, new ResizeController(this, {
137
- targetElementRef: __privateGet(this, _containerRef),
138
- resizeHandleRef: __privateGet(this, _resizeHandleRef),
139
- minWidth: MIN_WIDTH,
140
- maxWidth: MAX_WIDTH,
141
- defaultWidth: DEFAULT_WIDTH,
142
- onResize: (width) => {
143
- this._width = width;
144
- },
145
- onResizeStart: () => {
146
- this._isResizing = true;
147
- },
148
- onResizeEnd: () => {
149
- this._isResizing = false;
165
+ willUpdate(changedProperties) {
166
+ if (changedProperties.has("width") && this.width !== __privateGet(this, _resizeController).currentWidth) {
167
+ __privateGet(this, _resizeController).setWidth(this.width);
168
+ }
169
+ if (changedProperties.has("resizable") && this.resizable === "off") {
170
+ __privateGet(this, _resizeController).resetWidth();
171
+ if (this.hasUpdated) {
172
+ __privateMethod(this, _AiSidebarComponent_instances, clearPersistedWidth_fn).call(this);
150
173
  }
151
- }));
152
- }
153
- updated(changedProperties) {
154
- if (changedProperties.has("resizable") && !this.resizable) {
155
- this._width = DEFAULT_WIDTH;
156
174
  }
157
175
  }
158
176
  };
@@ -174,15 +192,39 @@ handleDrawerTransitionEnd_fn = function(evt) {
174
192
  }
175
193
  };
176
194
  handleResizePointerDown_fn = function(event) {
177
- __privateGet(this, _resizeController)?.handlePointerDown(event);
195
+ __privateGet(this, _resizeController).handlePointerDown(event);
178
196
  };
179
197
  handleResizeKeyDown_fn = function(event) {
180
- __privateGet(this, _resizeController)?.handleKeyDown(event);
198
+ __privateGet(this, _resizeController).handleKeyDown(event);
181
199
  };
182
- dispatchEvent_fn = function(type) {
200
+ handleResizeCommit_fn = function(width) {
201
+ __privateMethod(this, _AiSidebarComponent_instances, dispatchEvent_fn).call(this, "forge-ai-sidebar-resize", { width });
202
+ __privateMethod(this, _AiSidebarComponent_instances, persistWidth_fn).call(this, width);
203
+ };
204
+ readPersistedWidth_fn = function() {
205
+ for (const kind of WIDTH_STORAGE_KINDS) {
206
+ const width = readStoredNumber({ kind, key: WIDTH_STORAGE_KEY });
207
+ if (width !== void 0) {
208
+ return width;
209
+ }
210
+ }
211
+ return void 0;
212
+ };
213
+ persistWidth_fn = function(width) {
214
+ for (const kind of WIDTH_STORAGE_KINDS) {
215
+ writeStoredNumber({ kind, key: WIDTH_STORAGE_KEY, value: width });
216
+ }
217
+ };
218
+ clearPersistedWidth_fn = function() {
219
+ for (const kind of WIDTH_STORAGE_KINDS) {
220
+ removeStoredValue({ kind, key: WIDTH_STORAGE_KEY });
221
+ }
222
+ };
223
+ dispatchEvent_fn = function(type, detail) {
183
224
  const event = new CustomEvent(type, {
184
225
  bubbles: true,
185
- composed: true
226
+ composed: true,
227
+ detail
186
228
  });
187
229
  this.dispatchEvent(event);
188
230
  };
@@ -191,11 +233,11 @@ __decorateClass([
191
233
  property({ type: Boolean })
192
234
  ], AiSidebarComponent.prototype, "open", 2);
193
235
  __decorateClass([
194
- property({ type: Boolean })
236
+ property()
195
237
  ], AiSidebarComponent.prototype, "resizable", 2);
196
238
  __decorateClass([
197
- state()
198
- ], AiSidebarComponent.prototype, "_width", 2);
239
+ property({ type: Number })
240
+ ], AiSidebarComponent.prototype, "width", 2);
199
241
  __decorateClass([
200
242
  state()
201
243
  ], AiSidebarComponent.prototype, "_closing", 2);
@@ -1,4 +1,4 @@
1
- const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc.\n * License: Apache-2.0\n */\n.forge-drawer {\n --_drawer-background:var(--forge-drawer-background, var(--forge-theme-surface, #ffffff));\n --_drawer-border-color:var(--forge-drawer-border-color, var(--forge-theme-outline, #e0e0e0));\n --_drawer-width:var(--forge-drawer-width, 256px);\n --_drawer-border-width:var(--forge-drawer-border-width, var(--forge-border-thin, 1px));\n --_drawer-transition-duration:var(--forge-drawer-transition-duration, var(--forge-animation-duration-medium1, 250ms));\n --_drawer-transition-easing:var(--forge-drawer-transition-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));\n --_drawer-transition-duration-close:var(--forge-drawer-transition-duration-close, var(--forge-animation-duration-short4, 200ms));\n}\n\n.forge-drawer {\n width: var(--_drawer-width);\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n display: grid;\n grid-template-columns: 1fr;\n grid-template-rows: auto 1fr auto;\n background-color: var(--_drawer-background);\n border-color: var(--_drawer-border-color);\n transition-property: transform;\n transition-duration: var(--_drawer-transition-duration);\n transition-timing-function: var(--_drawer-transition-easing);\n border-right-width: var(--_drawer-border-width);\n border-right-style: solid;\n}\n\n.forge-drawer--closing {\n transform: translateX(-100%);\n left: 0;\n z-index: var(--forge-z-index-surface, 1);\n position: absolute;\n top: 0;\n right: 0;\n transition-duration: var(--_drawer-transition-duration-close);\n}\n\n.forge-drawer--closed {\n transform: translateX(-100%);\n left: 0;\n width: 0;\n border: none;\n}\n\n.forge-drawer--right {\n border-left-width: var(--_drawer-border-width);\n border-left-style: solid;\n border-right: none;\n}\n\n.forge-drawer--right.forge-drawer--closing {\n transform: translateX(100%);\n right: 0;\n left: auto;\n z-index: var(--forge-z-index-surface, 1);\n position: absolute;\n top: 0;\n right: 0;\n transition-duration: var(--_drawer-transition-duration-close);\n}\n\n.forge-drawer--right.forge-drawer--closed {\n transform: translateX(100%);\n right: 0;\n left: auto;\n width: 0;\n border: none;\n}\n\n.forge-drawer--mini {\n width: var(--_mini-drawer-width);\n z-index: var(--forge-z-index-surface, 1);\n transition: width var(--_mini-drawer-transition-duration) var(--_mini-drawer-transition-easing);\n}\n\n:host {\n display: block;\n width: auto;\n height: 100%;\n overflow: hidden;\n}\n\n.animation-container {\n --forge-drawer-width: 420px;\n width: var(--forge-drawer-width);\n height: 100%;\n position: relative;\n transition: width 250ms cubic-bezier(0.2, 0, 0, 1);\n overflow: hidden;\n}\n.animation-container--closed {\n width: 0;\n}\n.animation-container--closing {\n width: 0;\n}\n.animation-container--open {\n width: var(--forge-drawer-width);\n}\n.animation-container--resizing {\n transition: none;\n}\n\n.forge-drawer {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: var(--forge-drawer-width);\n height: 100%;\n position: absolute;\n top: 0;\n right: 0;\n}\n.forge-drawer--resizing {\n user-select: none;\n transition: none;\n}\n\n.resize-handle {\n position: absolute;\n top: 0;\n left: 0;\n width: 8px;\n height: 100%;\n cursor: ew-resize;\n z-index: 10;\n}\n.resize-handle::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 1px;\n background-color: var(--forge-theme-outline, #e0e0e0);\n opacity: 0;\n transition: all var(--forge-animation-duration-short4, 200ms) var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1));\n}\n.resize-handle:hover::before {\n opacity: 0.4;\n width: 2px;\n background-color: var(--forge-theme-primary, #3f51b5);\n}\n.resize-handle:focus-visible {\n outline: 2px solid var(--forge-theme-primary, #3f51b5);\n outline-offset: -2px;\n}\n.resize-handle:focus-visible::before {\n opacity: 0.6;\n width: 2px;\n background-color: var(--forge-theme-primary, #3f51b5);\n}\n.resize-handle--active::before {\n opacity: 0.8;\n width: 3px;\n background-color: var(--forge-theme-primary, #3f51b5);\n}\n\n:host([resizable=false]) .resize-handle {\n display: none;\n}';
1
+ const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc.\n * License: Apache-2.0\n */\n.forge-drawer {\n --_drawer-background:var(--forge-drawer-background, var(--forge-theme-surface, #ffffff));\n --_drawer-border-color:var(--forge-drawer-border-color, var(--forge-theme-outline, #e0e0e0));\n --_drawer-width:var(--forge-drawer-width, 256px);\n --_drawer-border-width:var(--forge-drawer-border-width, var(--forge-border-thin, 1px));\n --_drawer-transition-duration:var(--forge-drawer-transition-duration, var(--forge-animation-duration-medium1, 250ms));\n --_drawer-transition-easing:var(--forge-drawer-transition-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));\n --_drawer-transition-duration-close:var(--forge-drawer-transition-duration-close, var(--forge-animation-duration-short4, 200ms));\n}\n\n.forge-drawer {\n width: var(--_drawer-width);\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n display: grid;\n grid-template-columns: 1fr;\n grid-template-rows: auto 1fr auto;\n background-color: var(--_drawer-background);\n border-color: var(--_drawer-border-color);\n transition-property: transform;\n transition-duration: var(--_drawer-transition-duration);\n transition-timing-function: var(--_drawer-transition-easing);\n border-right-width: var(--_drawer-border-width);\n border-right-style: solid;\n}\n\n.forge-drawer--closing {\n transform: translateX(-100%);\n left: 0;\n z-index: var(--forge-z-index-surface, 1);\n position: absolute;\n top: 0;\n right: 0;\n transition-duration: var(--_drawer-transition-duration-close);\n}\n\n.forge-drawer--closed {\n transform: translateX(-100%);\n left: 0;\n width: 0;\n border: none;\n}\n\n.forge-drawer--right {\n border-left-width: var(--_drawer-border-width);\n border-left-style: solid;\n border-right: none;\n}\n\n.forge-drawer--right.forge-drawer--closing {\n transform: translateX(100%);\n right: 0;\n left: auto;\n z-index: var(--forge-z-index-surface, 1);\n position: absolute;\n top: 0;\n right: 0;\n transition-duration: var(--_drawer-transition-duration-close);\n}\n\n.forge-drawer--right.forge-drawer--closed {\n transform: translateX(100%);\n right: 0;\n left: auto;\n width: 0;\n border: none;\n}\n\n.forge-drawer--mini {\n width: var(--_mini-drawer-width);\n z-index: var(--forge-z-index-surface, 1);\n transition: width var(--_mini-drawer-transition-duration) var(--_mini-drawer-transition-easing);\n}\n\n:host {\n display: block;\n width: auto;\n height: 100%;\n overflow: hidden;\n}\n\n.animation-container {\n --forge-drawer-width: 420px;\n width: var(--forge-drawer-width);\n height: 100%;\n position: relative;\n transition: width 250ms cubic-bezier(0.2, 0, 0, 1);\n overflow: hidden;\n}\n.animation-container--closed {\n width: 0;\n}\n.animation-container--closing {\n width: 0;\n}\n.animation-container--open {\n width: var(--forge-drawer-width);\n}\n.animation-container--resizing {\n transition: none;\n}\n\n.forge-drawer {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: var(--forge-drawer-width);\n height: 100%;\n position: absolute;\n top: 0;\n right: 0;\n}\n.forge-drawer--resizing {\n user-select: none;\n transition: none;\n}\n\n.resize-handle {\n position: absolute;\n top: 0;\n left: 0;\n width: 8px;\n height: 100%;\n cursor: ew-resize;\n z-index: 10;\n}\n.resize-handle::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 1px;\n background-color: var(--forge-theme-outline, #e0e0e0);\n opacity: 0;\n transition: all var(--forge-animation-duration-short4, 200ms) var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1));\n}\n.resize-handle__grip {\n position: absolute;\n top: 50%;\n left: 0;\n translate: 0 -50%;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 6px;\n height: 32px;\n color: var(--forge-theme-text-low, rgba(0, 0, 0, 0.38));\n background-color: var(--forge-theme-surface, #ffffff);\n border: 1px solid var(--forge-theme-outline, #e0e0e0);\n border-inline-start: none;\n border-start-end-radius: calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1));\n border-end-end-radius: calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1));\n pointer-events: none;\n transition: color var(--forge-animation-duration-short4, 200ms) var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)), border-color var(--forge-animation-duration-short4, 200ms) var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1));\n}\n.resize-handle__grip svg {\n flex-shrink: 0;\n width: 12px;\n height: 12px;\n fill: currentColor;\n}\n.resize-handle:hover::before {\n opacity: 0.4;\n width: 2px;\n background-color: var(--forge-theme-primary, #3f51b5);\n}\n.resize-handle:focus-visible {\n outline: 2px solid var(--forge-theme-primary, #3f51b5);\n outline-offset: -2px;\n}\n.resize-handle:focus-visible::before {\n opacity: 0.6;\n width: 2px;\n background-color: var(--forge-theme-primary, #3f51b5);\n}\n.resize-handle--active::before {\n opacity: 0.8;\n width: 3px;\n background-color: var(--forge-theme-primary, #3f51b5);\n}\n.resize-handle:hover .resize-handle__grip, .resize-handle:focus-visible .resize-handle__grip, .resize-handle--active .resize-handle__grip {\n color: var(--forge-theme-primary, #3f51b5);\n border-color: var(--forge-theme-primary, #3f51b5);\n}';
2
2
  export {
3
3
  styles as default
4
4
  };
@@ -1 +1,2 @@
1
1
  export { AiSidebarComponent, AiSidebarComponentTagName } from './ai-sidebar';
2
+ export type { ForgeAiSidebarResizeEventData } from './ai-sidebar';
@@ -1,4 +1,5 @@
1
1
  import { LitElement, TemplateResult, CSSResult } from 'lit';
2
+ import { FeatureToggle } from '../ai-chatbot';
2
3
  declare global {
3
4
  interface HTMLElementTagNameMap {
4
5
  'forge-ai-sidebar-chat': AiSidebarChatComponent;
@@ -8,8 +9,12 @@ declare global {
8
9
  'forge-ai-sidebar-chat-close': CustomEvent<void>;
9
10
  'forge-ai-sidebar-chat-expand': CustomEvent<void>;
10
11
  'forge-ai-sidebar-chat-collapse': CustomEvent<void>;
12
+ 'forge-ai-sidebar-chat-resize': CustomEvent<ForgeAiSidebarChatResizeEventData>;
11
13
  }
12
14
  }
15
+ export interface ForgeAiSidebarChatResizeEventData {
16
+ width: number;
17
+ }
13
18
  export declare const AiSidebarChatComponentTagName: keyof HTMLElementTagNameMap;
14
19
  /**
15
20
  * @tag forge-ai-sidebar-chat
@@ -20,6 +25,7 @@ export declare const AiSidebarChatComponentTagName: keyof HTMLElementTagNameMap;
20
25
  * @fires forge-ai-sidebar-chat-close - Fired when the sidebar chat is closed
21
26
  * @fires forge-ai-sidebar-chat-expand - Fired when the sidebar chat is expanded to modal
22
27
  * @fires forge-ai-sidebar-chat-collapse - Fired when the sidebar chat is collapsed from modal
28
+ * @fires forge-ai-sidebar-chat-resize - Fired when the sidebar width is resized
23
29
  *
24
30
  * @description A form factor component that positions a slotted chatbot in a sidebar or modal.
25
31
  * Manages positioning and expand/collapse state while delegating chat functionality to the slotted chatbot.
@@ -31,7 +37,14 @@ export declare class AiSidebarChatComponent extends LitElement {
31
37
  static styles: CSSResult;
32
38
  open: boolean;
33
39
  expanded: boolean;
34
- resizable: boolean;
40
+ /**
41
+ * Enables sidebar resizing. Set to `'off'` to disable.
42
+ */
43
+ resizable: FeatureToggle;
44
+ /**
45
+ * The current width of the sidebar in pixels. Retained across expand/collapse.
46
+ */
47
+ width?: number;
35
48
  render(): TemplateResult;
36
49
  show(): void;
37
50
  close(): void;
@@ -1,6 +1,6 @@
1
1
  import { unsafeCSS, LitElement, html } from "lit";
2
2
  import { property, customElement } from "lit/decorators.js";
3
- import { createRef, ref } from "lit/directives/ref.js";
3
+ import { ifDefined } from "lit/directives/if-defined.js";
4
4
  import { when } from "lit/directives/when.js";
5
5
  import "../ai-sidebar/ai-sidebar.mjs";
6
6
  import "../ai-modal/ai-modal.mjs";
@@ -22,7 +22,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
22
22
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
23
23
  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);
24
24
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
25
- var _sidebarRef, _modalRef, _slotContent, _AiSidebarChatComponent_instances, handleSidebarOpen_fn, handleSidebarClose_fn, handleFullscreenChange_fn, handleChatbotExpand_fn, handleChatbotMinimize_fn, handleModalClose_fn, dispatchEvent_fn;
25
+ var _slotContent, _AiSidebarChatComponent_instances, handleSidebarOpen_fn, handleSidebarClose_fn, handleSidebarResize_fn, handleFullscreenChange_fn, handleChatbotExpand_fn, handleChatbotMinimize_fn, handleModalClose_fn, dispatchEvent_fn;
26
26
  const AiSidebarChatComponentTagName = "forge-ai-sidebar-chat";
27
27
  let AiSidebarChatComponent = class extends LitElement {
28
28
  constructor() {
@@ -30,9 +30,7 @@ let AiSidebarChatComponent = class extends LitElement {
30
30
  __privateAdd(this, _AiSidebarChatComponent_instances);
31
31
  this.open = false;
32
32
  this.expanded = false;
33
- this.resizable = true;
34
- __privateAdd(this, _sidebarRef, createRef());
35
- __privateAdd(this, _modalRef, createRef());
33
+ this.resizable = "on";
36
34
  __privateAdd(this, _slotContent, html`
37
35
  <slot
38
36
  @forge-ai-chatbot-expand=${__privateMethod(this, _AiSidebarChatComponent_instances, handleChatbotExpand_fn)}
@@ -45,7 +43,6 @@ let AiSidebarChatComponent = class extends LitElement {
45
43
  this.expanded,
46
44
  () => html`
47
45
  <forge-ai-modal
48
- ${ref(__privateGet(this, _modalRef))}
49
46
  ?open=${this.open && this.expanded}
50
47
  @forge-ai-modal-fullscreen-change=${__privateMethod(this, _AiSidebarChatComponent_instances, handleFullscreenChange_fn)}
51
48
  @forge-ai-modal-close=${__privateMethod(this, _AiSidebarChatComponent_instances, handleModalClose_fn)}>
@@ -54,11 +51,12 @@ let AiSidebarChatComponent = class extends LitElement {
54
51
  `,
55
52
  () => html`
56
53
  <forge-ai-sidebar
57
- ${ref(__privateGet(this, _sidebarRef))}
58
54
  ?open=${this.open && !this.expanded}
59
- ?resizable=${this.resizable}
55
+ resizable=${this.resizable}
56
+ width=${ifDefined(this.width)}
60
57
  @forge-ai-sidebar-open=${__privateMethod(this, _AiSidebarChatComponent_instances, handleSidebarOpen_fn)}
61
- @forge-ai-sidebar-close=${__privateMethod(this, _AiSidebarChatComponent_instances, handleSidebarClose_fn)}>
58
+ @forge-ai-sidebar-close=${__privateMethod(this, _AiSidebarChatComponent_instances, handleSidebarClose_fn)}
59
+ @forge-ai-sidebar-resize=${__privateMethod(this, _AiSidebarChatComponent_instances, handleSidebarResize_fn)}>
62
60
  ${__privateGet(this, _slotContent)}
63
61
  </forge-ai-sidebar>
64
62
  `
@@ -97,8 +95,6 @@ let AiSidebarChatComponent = class extends LitElement {
97
95
  }
98
96
  }
99
97
  };
100
- _sidebarRef = /* @__PURE__ */ new WeakMap();
101
- _modalRef = /* @__PURE__ */ new WeakMap();
102
98
  _slotContent = /* @__PURE__ */ new WeakMap();
103
99
  _AiSidebarChatComponent_instances = /* @__PURE__ */ new WeakSet();
104
100
  handleSidebarOpen_fn = function() {
@@ -109,6 +105,10 @@ handleSidebarClose_fn = function() {
109
105
  this.open = false;
110
106
  __privateMethod(this, _AiSidebarChatComponent_instances, dispatchEvent_fn).call(this, "forge-ai-sidebar-chat-close");
111
107
  };
108
+ handleSidebarResize_fn = function(event) {
109
+ this.width = event.detail.width;
110
+ __privateMethod(this, _AiSidebarChatComponent_instances, dispatchEvent_fn).call(this, "forge-ai-sidebar-chat-resize", { width: this.width });
111
+ };
112
112
  handleFullscreenChange_fn = function(event) {
113
113
  const { isFullscreen } = event.detail;
114
114
  if (isFullscreen && !this.expanded) {
@@ -133,10 +133,11 @@ handleChatbotMinimize_fn = function() {
133
133
  handleModalClose_fn = function() {
134
134
  this.collapse();
135
135
  };
136
- dispatchEvent_fn = function(type) {
136
+ dispatchEvent_fn = function(type, detail) {
137
137
  const event = new CustomEvent(type, {
138
138
  bubbles: true,
139
- composed: true
139
+ composed: true,
140
+ detail
140
141
  });
141
142
  this.dispatchEvent(event);
142
143
  };
@@ -148,8 +149,11 @@ __decorateClass([
148
149
  property({ type: Boolean })
149
150
  ], AiSidebarChatComponent.prototype, "expanded", 2);
150
151
  __decorateClass([
151
- property({ type: Boolean })
152
+ property()
152
153
  ], AiSidebarChatComponent.prototype, "resizable", 2);
154
+ __decorateClass([
155
+ property({ type: Number })
156
+ ], AiSidebarChatComponent.prototype, "width", 2);
153
157
  AiSidebarChatComponent = __decorateClass([
154
158
  customElement(AiSidebarChatComponentTagName)
155
159
  ], AiSidebarChatComponent);