@carbon/ai-chat-components 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/custom-elements.json +917 -258
- package/es/components/card/src/card-footer.scss.js +1 -1
- package/es/components/card/src/card-steps.scss.js +1 -1
- package/es/components/card/src/card.scss.js +1 -1
- package/es/components/chat-button/src/chat-button.scss.js +1 -1
- package/es/components/chat-shell/index.d.ts +2 -2
- package/es/components/chat-shell/index.js +2 -2
- package/es/components/chat-shell/src/{cds-aichat-panel.d.ts → panel.d.ts} +11 -2
- package/es/components/chat-shell/src/{cds-aichat-panel.js → panel.js} +79 -26
- package/es/components/chat-shell/src/panel.js.map +1 -0
- package/es/components/chat-shell/src/panel.scss.js +13 -0
- package/es/components/chat-shell/src/panel.scss.js.map +1 -0
- package/es/components/chat-shell/src/{cds-aichat-shell.d.ts → shell.d.ts} +20 -3
- package/es/components/chat-shell/src/{cds-aichat-shell.js → shell.js} +298 -97
- package/es/components/chat-shell/src/shell.js.map +1 -0
- package/es/components/chat-shell/src/shell.scss.js +13 -0
- package/es/components/chat-shell/src/shell.scss.js.map +1 -0
- package/es/components/chat-shell/src/workspace-manager-utils.d.ts +90 -0
- package/es/components/chat-shell/src/workspace-manager-utils.js +120 -0
- package/es/components/chat-shell/src/workspace-manager-utils.js.map +1 -0
- package/es/components/chat-shell/src/workspace-manager.d.ts +52 -8
- package/es/components/chat-shell/src/workspace-manager.js +330 -117
- package/es/components/chat-shell/src/workspace-manager.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.d.ts +27 -11
- package/es/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es/components/markdown/src/markdown.js +1 -1
- package/es/components/markdown/src/markdown.js.map +1 -1
- package/es/components/toolbar/src/toolbar.d.ts +4 -0
- package/es/components/toolbar/src/toolbar.js +62 -28
- package/es/components/toolbar/src/toolbar.js.map +1 -1
- package/es/components/toolbar/src/toolbar.scss.js +1 -1
- package/es/components/workspace-shell/src/workspace-shell-footer.js +6 -1
- package/es/components/workspace-shell/src/workspace-shell-footer.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell-footer.scss.js +1 -1
- package/es/components/workspace-shell/src/workspace-shell.d.ts +0 -1
- package/es/components/workspace-shell/src/workspace-shell.js +0 -6
- package/es/components/workspace-shell/src/workspace-shell.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell.scss.js +1 -1
- package/es/react/chat-shell.d.ts +3 -3
- package/es/react/chat-shell.js +4 -4
- package/es/react/chat-shell.js.map +1 -1
- package/es/react/panel.d.ts +3 -3
- package/es/react/panel.js +5 -4
- package/es/react/panel.js.map +1 -1
- package/es/react/toolbar.js +1 -1
- package/es/react/toolbar.js.map +1 -1
- package/es-custom/components/card/src/card-footer.scss.js +1 -1
- package/es-custom/components/card/src/card-steps.scss.js +1 -1
- package/es-custom/components/card/src/card.scss.js +1 -1
- package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
- package/es-custom/components/chat-shell/index.d.ts +2 -2
- package/es-custom/components/chat-shell/index.js +2 -2
- package/es-custom/components/chat-shell/src/{cds-aichat-panel.d.ts → panel.d.ts} +11 -2
- package/es-custom/components/chat-shell/src/{cds-aichat-panel.js → panel.js} +79 -26
- package/es-custom/components/chat-shell/src/panel.js.map +1 -0
- package/es-custom/components/chat-shell/src/panel.scss.js +13 -0
- package/es-custom/components/chat-shell/src/panel.scss.js.map +1 -0
- package/es-custom/components/chat-shell/src/{cds-aichat-shell.d.ts → shell.d.ts} +20 -3
- package/es-custom/components/chat-shell/src/{cds-aichat-shell.js → shell.js} +298 -97
- package/es-custom/components/chat-shell/src/shell.js.map +1 -0
- package/es-custom/components/chat-shell/src/shell.scss.js +13 -0
- package/es-custom/components/chat-shell/src/shell.scss.js.map +1 -0
- package/es-custom/components/chat-shell/src/workspace-manager-utils.d.ts +90 -0
- package/es-custom/components/chat-shell/src/workspace-manager-utils.js +120 -0
- package/es-custom/components/chat-shell/src/workspace-manager-utils.js.map +1 -0
- package/es-custom/components/chat-shell/src/workspace-manager.d.ts +52 -8
- package/es-custom/components/chat-shell/src/workspace-manager.js +330 -117
- package/es-custom/components/chat-shell/src/workspace-manager.js.map +1 -1
- package/es-custom/components/code-snippet/src/code-snippet.d.ts +27 -11
- package/es-custom/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es-custom/components/markdown/src/markdown.js +1 -1
- package/es-custom/components/markdown/src/markdown.js.map +1 -1
- package/es-custom/components/toolbar/src/toolbar.d.ts +4 -0
- package/es-custom/components/toolbar/src/toolbar.js +62 -28
- package/es-custom/components/toolbar/src/toolbar.js.map +1 -1
- package/es-custom/components/toolbar/src/toolbar.scss.js +1 -1
- package/es-custom/components/workspace-shell/src/workspace-shell-footer.js +6 -1
- package/es-custom/components/workspace-shell/src/workspace-shell-footer.js.map +1 -1
- package/es-custom/components/workspace-shell/src/workspace-shell-footer.scss.js +1 -1
- package/es-custom/components/workspace-shell/src/workspace-shell.d.ts +0 -1
- package/es-custom/components/workspace-shell/src/workspace-shell.js +0 -6
- package/es-custom/components/workspace-shell/src/workspace-shell.js.map +1 -1
- package/es-custom/components/workspace-shell/src/workspace-shell.scss.js +1 -1
- package/es-custom/react/chat-shell.d.ts +3 -3
- package/es-custom/react/chat-shell.js +4 -4
- package/es-custom/react/chat-shell.js.map +1 -1
- package/es-custom/react/panel.d.ts +3 -3
- package/es-custom/react/panel.js +5 -4
- package/es-custom/react/panel.js.map +1 -1
- package/es-custom/react/toolbar.js +1 -1
- package/es-custom/react/toolbar.js.map +1 -1
- package/package.json +13 -10
- package/es/components/chat-shell/src/cds-aichat-panel.js.map +0 -1
- package/es/components/chat-shell/src/cds-aichat-panel.scss.js +0 -13
- package/es/components/chat-shell/src/cds-aichat-panel.scss.js.map +0 -1
- package/es/components/chat-shell/src/cds-aichat-shell.js.map +0 -1
- package/es/components/chat-shell/src/cds-aichat-shell.scss.js +0 -13
- package/es/components/chat-shell/src/cds-aichat-shell.scss.js.map +0 -1
- package/es-custom/components/chat-shell/src/cds-aichat-panel.js.map +0 -1
- package/es-custom/components/chat-shell/src/cds-aichat-panel.scss.js +0 -13
- package/es-custom/components/chat-shell/src/cds-aichat-panel.scss.js.map +0 -1
- package/es-custom/components/chat-shell/src/cds-aichat-shell.js.map +0 -1
- package/es-custom/components/chat-shell/src/cds-aichat-shell.scss.js +0 -13
- package/es-custom/components/chat-shell/src/cds-aichat-shell.scss.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
var styles = css([":host{background:transparent;block-size:100%;box-sizing:border-box;container-type:inline-size;display:block;font-family:var(--cds-aichat-font-family,\"IBM Plex Sans\",\"Helvetica Neue\",arial,sans-serif);inline-size:100%}.shell{--cds-aichat-rounded-modifier-radius:0;--cds-aichat-rounded-modifier-radius-start-start:0;--cds-aichat-rounded-modifier-radius-start-end:0;--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;background-color:var(--cds-chat-shell-background,#fff);background-image:none;block-size:100%;border:1px solid var(--cds-border-subtle-00,#e0e0e0);border-radius:var(--cds-aichat-rounded-modifier-radius,0);box-shadow:0 2px 6px var(--cds-shadow,var(--cds-shadow,rgba(0,0,0,.3)));display:block;inline-size:100%;position:relative}.shell.shell--panels-animating{overflow:hidden}.shell.ai-theme{background:linear-gradient(to top,var(--cds-chat-shell-background,var(--cds-ai-popover-background,#fff)) 0,var(--cds-ai-aura-start,rgba(69,137,255,.1)) 0,15%,var(--cds-ai-aura-end,hsla(0,0%,100%,0)) 50%) padding-box,linear-gradient(to top,var(--cds-chat-shell-background,var(--cds-ai-popover-background,#fff)),var(--cds-chat-shell-background,var(--cds-ai-popover-background,#fff))) padding-box,linear-gradient(to bottom,var(--cds-ai-border-start,rgba(166,200,255,.64)),var(--cds-ai-border-end,#78a9ff)) border-box,linear-gradient(to top,var(--cds-chat-shell-background,var(--cds-ai-popover-background,#fff)),var(--cds-chat-shell-background,var(--cds-ai-popover-background,#fff))) border-box;background-color:var(--cds-chat-shell-background,#fff);border:1px solid transparent;box-shadow:inset 0 -80px 70px -65px var(--cds-ai-inner-shadow,var(--cds-ai-inner-shadow,rgba(69,137,255,.1))),0 4px 10px 2px var(--cds-ai-drop-shadow,var(--cds-ai-drop-shadow,rgba(15,98,254,.1))),-40px 44px 60px -24px var(--cds-ai-popover-shadow-outer-01,var(--cds-ai-popover-shadow-outer-01,rgba(0,67,206,.06))),-56px 64px 64px -24px var(--cds-ai-popover-shadow-outer-02,var(--cds-ai-popover-shadow-outer-02,rgba(0,0,0,.04)))}.shell.frameless,.shell.frameless.rounded{--cds-aichat-rounded-modifier-radius:0;--cds-aichat-rounded-modifier-radius-start-start:0;--cds-aichat-rounded-modifier-radius-start-end:0;--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;border:none;border-radius:var(--cds-aichat-rounded-modifier-radius,0);box-shadow:none}.shell.frameless.ai-theme{background-image:none}.main-chat{align-items:stretch;block-size:100%;display:flex;flex-direction:column;inline-size:100%;min-block-size:0}.shell.rounded{--cds-aichat-rounded-modifier-radius:0.5rem;--cds-aichat-rounded-modifier-radius-start-start:0.5rem;--cds-aichat-rounded-modifier-radius-start-end:0.5rem;--cds-aichat-rounded-modifier-radius-end-start:0.5rem;--cds-aichat-rounded-modifier-radius-end-end:0.5rem}.shell.rounded,.shell.rounded .main-chat{border-radius:var(--cds-aichat-rounded-modifier-radius,0)}.shell.rounded .header-with-header-after,.shell.rounded .header-with-header-after>.header.has-content,.shell.rounded .header-with-header-after>.header:not(.has-content)+.header-after.has-content{border-start-end-radius:var(--cds-aichat-rounded-modifier-radius-start-end,0);border-start-start-radius:var(--cds-aichat-rounded-modifier-radius-start-start,0)}.shell.rounded .header-with-header-after>.header:not(.has-content)+.header-after.has-content{--cds-aichat-rounded-modifier-radius-start-end:var(\n --cds-aichat-rounded-modifier-radius,0\n );--cds-aichat-rounded-modifier-radius-start-start:var(\n --cds-aichat-rounded-modifier-radius,0\n );--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0}.shell.rounded .header-with-header-after>.header-after:not(.has-content),.shell.rounded .header-with-header-after>.header.has-content+.header-after.has-content,.shell.rounded .header-with-header-after>.header:not(.has-content){--cds-aichat-rounded-modifier-radius-start-end:0;--cds-aichat-rounded-modifier-radius-start-start:0;border-start-end-radius:0;border-start-start-radius:0}.shell.rounded .header-with-header-after>.header.has-content+.header-after.has-content{--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;border-end-end-radius:0;border-end-start-radius:0}[data-panel-slot]{opacity:1}[data-panel-slot][inert]{opacity:0}@media screen and (prefers-reduced-motion:no-preference){[data-panel-slot]{transition:opacity .11s cubic-bezier(.2,0,.38,.9)}}.main-content{flex-direction:column;flex-grow:1}.main-content,.main-content-body{align-items:stretch;display:flex;max-inline-size:100%;min-block-size:0;min-inline-size:0}.main-content-body{block-size:100%;flex:1 1 0%;overflow-x:visible;position:relative}.shell.workspace-closing .main-content-body,.shell.workspace-opening .main-content-body{overflow-x:hidden}.shell.ai-theme .main-chat{background-color:var(--cds-chat-shell-background,#fff);background-image:linear-gradient(0deg,var(--cds-ai-aura-start-sm,rgba(69,137,255,.16)) 0,15%,var(--cds-ai-aura-end,hsla(0,0%,100%,0)) 50%,transparent 100%);border-block-end-color:var(--cds-ai-border-strong,#4589ff)}.history{display:flex;flex-direction:column}.history>[data-panel-slot]{block-size:100%;display:flex;flex:1;flex-direction:column;min-block-size:0}:host([show-history]) .history{flex:0 0 auto;inline-size:var(--cds-aichat-history-width,320px);max-inline-size:var(--cds-aichat-history-width,320px)}:host([show-history][history-location=end]) .history{order:3}:host([show-history][show-workspace][workspace-location=end]) .workspace{order:2}.input-and-messages{align-items:stretch;block-size:100%;display:flex;flex-direction:column;flex-grow:1;inline-size:100%;margin:auto;min-block-size:0;min-inline-size:var(--cds-aichat-messages-min-width,320px)}.input-and-messages .messages-max-width{inline-size:100%;margin:auto;max-inline-size:var(--cds-aichat-messages-max-width,672px)}:host([show-history][history-location=end]) .input-and-messages{order:1}.messages{flex-grow:1;min-block-size:0}.workspace{display:flex;flex-direction:column;min-block-size:0}.workspace-content,.workspace-slot{block-size:100%;inline-size:100%;min-block-size:0}.workspace-content{opacity:1}@media (prefers-reduced-motion:no-preference){.workspace-content{transition:opacity .11s cubic-bezier(.2,0,.38,.9)}}.workspace-content--hidden{opacity:0;pointer-events:none}.shell.workspace-checking .workspace{flex:1 1 0;margin:0;min-inline-size:0;overflow:hidden;padding:0;visibility:hidden}.shell.workspace-checking .input-and-messages{flex:1 1 auto;max-inline-size:var(--cds-aichat-messages-max-width,672px)}.shell.workspace-checking-closing .workspace{flex:1 1 auto;min-inline-size:0;overflow:hidden}.shell.workspace-checking-closing .input-and-messages{flex:0 1 auto;min-inline-size:0}.shell.workspace-checking-closing .workspace,.shell.workspace-closing .workspace{flex:1 1 0;min-inline-size:0;overflow:hidden}.shell.workspace-checking-closing .input-and-messages,.shell.workspace-closing .input-and-messages{box-sizing:border-box;flex:0 1 var(--cds-aichat-messages-min-width,320px);max-inline-size:var(--cds-aichat-messages-min-width,320px);min-inline-size:0}.shell.workspace-opening .workspace{flex:1 1 0;min-inline-size:0;overflow:hidden;visibility:hidden}.shell.workspace-opening .input-and-messages{box-sizing:border-box;flex:0 1 var(--cds-aichat-messages-min-width,320px);min-inline-size:0}.shell.workspace-checking-closing .main-content-body,.shell.workspace-closing .main-content-body,:host([show-workspace]) .main-content-body{container-name:main-content-body;container-type:inline-size;flex-direction:row}:host([show-workspace][workspace-location=end]) .input-and-messages{order:1}:host([workspace-location=end]) .shell.workspace-checking-closing .input-and-messages,:host([workspace-location=end]) .shell.workspace-closing .input-and-messages{order:1}:host([workspace-location=end]) .shell.workspace-checking-closing .workspace,:host([workspace-location=end]) .shell.workspace-closing .workspace{order:2}:host([workspace-in-container][show-workspace]) .workspace{box-sizing:border-box;flex:1 1 auto;min-inline-size:var(--cds-aichat-workspace-min-width,640px);padding-block-end:1rem;padding-block-start:1rem;padding-inline-end:0;padding-inline-start:1rem}:host([workspace-in-container][show-workspace]) .input-and-messages{box-sizing:border-box;flex:0 0 var(--cds-aichat-messages-min-width,320px);inline-size:var(--cds-aichat-messages-min-width,320px);max-inline-size:var(--cds-aichat-messages-min-width,320px);padding:1rem}:host([workspace-in-panel][show-workspace]) .input-and-messages{flex:1 1 auto;inline-size:100%;max-inline-size:var(--cds-aichat-messages-max-width,672px)}:host([workspace-in-panel][show-workspace]) .main-content-body{flex-direction:column}:host([workspace-in-container][show-workspace][workspace-location=end]) .workspace{order:2;padding-inline-end:1rem}:host([workspace-in-container][show-workspace][workspace-location=end]) .input-and-messages{padding-inline-end:0}:host([workspace-in-container]) .shell.workspace-opening .workspace{flex:1 1 0;min-inline-size:0;padding-block-end:1rem;padding-block-start:1rem;padding-inline-end:0;padding-inline-start:1rem}:host([workspace-in-container]) .shell.workspace-opening .input-and-messages{flex:0 1 var(--cds-aichat-messages-min-width,320px);min-inline-size:0;padding:1rem}:host([workspace-in-container][workspace-location=end]) .shell.workspace-opening .workspace{padding-inline-end:1rem;padding-inline-start:0}:host([workspace-in-container][workspace-location=end]) .shell.workspace-opening .input-and-messages{padding-inline-end:0}:host([workspace-in-container]) .shell.workspace-checking-closing .workspace,:host([workspace-in-container]) .shell.workspace-closing .workspace{padding-block-end:1rem;padding-block-start:1rem;padding-inline-end:0;padding-inline-start:1rem}:host([workspace-in-container]) .shell.workspace-checking-closing .input-and-messages,:host([workspace-in-container]) .shell.workspace-closing .input-and-messages{padding:0}:host([workspace-in-container][workspace-location=end]) .shell.workspace-checking-closing .workspace,:host([workspace-in-container][workspace-location=end]) .shell.workspace-closing .workspace{padding-inline-end:1rem;padding-inline-start:0}:host([workspace-in-container][workspace-location=end]) .shell.workspace-checking-closing .input-and-messages,:host([workspace-in-container][workspace-location=end]) .shell.workspace-closing .input-and-messages{padding:0}.shell.rounded .main-content,.shell.rounded .main-content>.footer.has-content{border-end-end-radius:var(--cds-aichat-rounded-modifier-radius-end-end,0);border-end-start-radius:var(--cds-aichat-rounded-modifier-radius-end-start,0)}.shell.rounded .main-content>.footer.has-content{--cds-aichat-rounded-modifier-radius-start-start:0;--cds-aichat-rounded-modifier-radius-start-end:0}.shell.rounded .main-content>.footer:not(.has-content){--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;border-end-end-radius:0;border-end-start-radius:0}.shell.rounded .input-and-messages:not(.at-max-width),.shell.rounded.has-header-content .input-and-messages{--cds-aichat-rounded-modifier-radius-start-start:0;--cds-aichat-rounded-modifier-radius-start-end:0}.shell.rounded .input-and-messages:not(.at-max-width),.shell.rounded.has-footer-content .input-and-messages{--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0}.shell.rounded:not(.has-header-content) .input-and-messages.at-max-width{--cds-aichat-rounded-modifier-radius-start-start:0.5rem;--cds-aichat-rounded-modifier-radius-start-end:0.5rem}.shell.rounded:not(.has-footer-content) .input-and-messages.at-max-width{--cds-aichat-rounded-modifier-radius-end-start:0.5rem;--cds-aichat-rounded-modifier-radius-end-end:0.5rem}.shell.rounded .input-and-messages>.input-after:not(.has-content),.shell.rounded .input-and-messages>.input-before:not(.has-content),.shell.rounded .input-and-messages>.input:not(.has-content){--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;border-end-end-radius:0;border-end-start-radius:0}.shell.rounded .input-and-messages:not(.has-input-after-content,.has-input-content,.has-input-before-content)>.messages{border-end-end-radius:var(--cds-aichat-rounded-modifier-radius-end-end,0);border-end-start-radius:var(--cds-aichat-rounded-modifier-radius-end-start,0)}.shell.rounded .input-and-messages.has-input-after-content>.messages,.shell.rounded .input-and-messages:not(.has-input-after-content).has-input-content>.messages,.shell.rounded .input-and-messages:not(.has-input-after-content,.has-input-content).has-input-before-content>.messages{--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;border-end-end-radius:0;border-end-start-radius:0}.shell.rounded .input-and-messages>.input-after.has-content{border-end-end-radius:var(--cds-aichat-rounded-modifier-radius-end-end,0);border-end-start-radius:var(--cds-aichat-rounded-modifier-radius-end-start,0)}.shell.rounded:not(.has-footer-content) .input-and-messages.at-max-width>.input-after.has-content{--cds-aichat-rounded-modifier-radius-end-start:0.5rem;--cds-aichat-rounded-modifier-radius-end-end:0.5rem}:host(:not([show-workspace])) .input-and-messages:not(.at-max-width)>.input-after{margin-block-end:32px}.shell.rounded .input-and-messages:not(.has-input-after-content)>.input.has-content,.shell.rounded .input-and-messages:not(.has-input-after-content,.has-input-content)>.input-before.has-content{border-end-end-radius:var(--cds-aichat-rounded-modifier-radius-end-end,0);border-end-start-radius:var(--cds-aichat-rounded-modifier-radius-end-start,0)}.shell.rounded .input-and-messages.has-input-after-content>.input,.shell.rounded .input-and-messages.has-input-after-content>.input-before,.shell.rounded .input-and-messages:not(.has-input-after-content).has-input-content>.input-before{--cds-aichat-rounded-modifier-radius-end-start:0;--cds-aichat-rounded-modifier-radius-end-end:0;border-end-end-radius:0;border-end-start-radius:0}"]);
|
|
11
|
+
|
|
12
|
+
export { styles as default };
|
|
13
|
+
//# sourceMappingURL=shell.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Pure utility functions for workspace layout calculations.
|
|
11
|
+
* These functions have no side effects and depend only on their inputs.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Calculate the minimum width required for side-by-side layout.
|
|
15
|
+
*
|
|
16
|
+
* @param dimensions - Layout dimensions
|
|
17
|
+
* @param dimensions.workspaceMinWidth - Minimum width for workspace area
|
|
18
|
+
* @param dimensions.messagesMinWidth - Minimum width for messages area
|
|
19
|
+
* @param dimensions.historyWidth - Width for history panel
|
|
20
|
+
* @returns Total minimum width required
|
|
21
|
+
*/
|
|
22
|
+
export declare function calculateRequiredWidth(dimensions: {
|
|
23
|
+
workspaceMinWidth: number;
|
|
24
|
+
messagesMinWidth: number;
|
|
25
|
+
historyWidth: number;
|
|
26
|
+
}): number;
|
|
27
|
+
/**
|
|
28
|
+
* Check if width change exceeds the threshold for meaningful expansion.
|
|
29
|
+
*
|
|
30
|
+
* @param current - Current width value
|
|
31
|
+
* @param initial - Initial width value
|
|
32
|
+
* @param threshold - Minimum change threshold in pixels
|
|
33
|
+
* @returns True if the absolute difference exceeds the threshold
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasSignificantWidthChange(current: number, initial: number, threshold: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Check if the host element is wide enough for side-by-side layout.
|
|
38
|
+
*
|
|
39
|
+
* @param inlineSize - Current width of the host element
|
|
40
|
+
* @param requiredWidth - Minimum width required for side-by-side layout
|
|
41
|
+
* @returns True if wide enough, or if running in SSR context
|
|
42
|
+
*/
|
|
43
|
+
export declare function isWideEnough(inlineSize: number, requiredWidth: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Check if the host element can potentially grow to the required width.
|
|
46
|
+
*
|
|
47
|
+
* @param requiredWidth - Minimum width required for side-by-side layout
|
|
48
|
+
* @returns True if window width is sufficient, false in SSR context
|
|
49
|
+
*/
|
|
50
|
+
export declare function canHostGrow(requiredWidth: number): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Extract inline size from a ResizeObserverEntry.
|
|
53
|
+
*
|
|
54
|
+
* @param entry - ResizeObserver entry containing size information
|
|
55
|
+
* @returns The inline size in pixels
|
|
56
|
+
*/
|
|
57
|
+
export declare function getInlineSizeFromEntry(entry: ResizeObserverEntry): number;
|
|
58
|
+
/**
|
|
59
|
+
* Parse a CSS length value from a computed style property.
|
|
60
|
+
*
|
|
61
|
+
* @param element - Element to get computed style from
|
|
62
|
+
* @param propertyName - CSS custom property name
|
|
63
|
+
* @param fallback - Fallback value if property is not set or invalid
|
|
64
|
+
* @returns Parsed numeric value or fallback
|
|
65
|
+
*/
|
|
66
|
+
export declare function getCssLengthFromProperty(element: HTMLElement, propertyName: string, fallback: number): number;
|
|
67
|
+
/**
|
|
68
|
+
* Check if workspace DOM attributes match the expected panel state.
|
|
69
|
+
*
|
|
70
|
+
* @param element - Host element containing workspace attributes
|
|
71
|
+
* @param inPanel - Expected panel state
|
|
72
|
+
* @returns True if both attributes are correctly set
|
|
73
|
+
*/
|
|
74
|
+
export declare function areWorkspaceAttributesCorrect(element: HTMLElement, inPanel: boolean): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check if workspace update should be skipped based on current state.
|
|
77
|
+
*
|
|
78
|
+
* @param config - Workspace configuration
|
|
79
|
+
* @param config.showWorkspace - Whether workspace is enabled
|
|
80
|
+
* @param state - Current workspace state
|
|
81
|
+
* @param state.containerVisible - Whether workspace container is visible
|
|
82
|
+
* @param state.isContracting - Whether workspace is currently contracting
|
|
83
|
+
* @returns True if update should be skipped
|
|
84
|
+
*/
|
|
85
|
+
export declare function shouldSkipWorkspaceUpdate(config: {
|
|
86
|
+
showWorkspace: boolean;
|
|
87
|
+
}, state: {
|
|
88
|
+
containerVisible: boolean;
|
|
89
|
+
isContracting: boolean;
|
|
90
|
+
}): boolean;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*
|
|
11
|
+
* Copyright IBM Corp. 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Pure utility functions for workspace layout calculations.
|
|
18
|
+
* These functions have no side effects and depend only on their inputs.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Calculate the minimum width required for side-by-side layout.
|
|
22
|
+
*
|
|
23
|
+
* @param dimensions - Layout dimensions
|
|
24
|
+
* @param dimensions.workspaceMinWidth - Minimum width for workspace area
|
|
25
|
+
* @param dimensions.messagesMinWidth - Minimum width for messages area
|
|
26
|
+
* @param dimensions.historyWidth - Width for history panel
|
|
27
|
+
* @returns Total minimum width required
|
|
28
|
+
*/
|
|
29
|
+
function calculateRequiredWidth(dimensions) {
|
|
30
|
+
return (dimensions.workspaceMinWidth +
|
|
31
|
+
dimensions.messagesMinWidth +
|
|
32
|
+
dimensions.historyWidth);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if width change exceeds the threshold for meaningful expansion.
|
|
36
|
+
*
|
|
37
|
+
* @param current - Current width value
|
|
38
|
+
* @param initial - Initial width value
|
|
39
|
+
* @param threshold - Minimum change threshold in pixels
|
|
40
|
+
* @returns True if the absolute difference exceeds the threshold
|
|
41
|
+
*/
|
|
42
|
+
function hasSignificantWidthChange(current, initial, threshold) {
|
|
43
|
+
return Math.abs(current - initial) > threshold;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if the host element is wide enough for side-by-side layout.
|
|
47
|
+
*
|
|
48
|
+
* @param inlineSize - Current width of the host element
|
|
49
|
+
* @param requiredWidth - Minimum width required for side-by-side layout
|
|
50
|
+
* @returns True if wide enough, or if running in SSR context
|
|
51
|
+
*/
|
|
52
|
+
function isWideEnough(inlineSize, requiredWidth) {
|
|
53
|
+
return typeof window === "undefined" || inlineSize >= requiredWidth;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check if the host element can potentially grow to the required width.
|
|
57
|
+
*
|
|
58
|
+
* @param requiredWidth - Minimum width required for side-by-side layout
|
|
59
|
+
* @returns True if window width is sufficient, false in SSR context
|
|
60
|
+
*/
|
|
61
|
+
function canHostGrow(requiredWidth) {
|
|
62
|
+
return typeof window !== "undefined" && window.innerWidth >= requiredWidth;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Extract inline size from a ResizeObserverEntry.
|
|
66
|
+
*
|
|
67
|
+
* @param entry - ResizeObserver entry containing size information
|
|
68
|
+
* @returns The inline size in pixels
|
|
69
|
+
*/
|
|
70
|
+
function getInlineSizeFromEntry(entry) {
|
|
71
|
+
const borderBoxSize = Array.isArray(entry.borderBoxSize)
|
|
72
|
+
? entry.borderBoxSize[0]
|
|
73
|
+
: entry.borderBoxSize;
|
|
74
|
+
return borderBoxSize?.inlineSize ?? entry.contentRect.width;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse a CSS length value from a computed style property.
|
|
78
|
+
*
|
|
79
|
+
* @param element - Element to get computed style from
|
|
80
|
+
* @param propertyName - CSS custom property name
|
|
81
|
+
* @param fallback - Fallback value if property is not set or invalid
|
|
82
|
+
* @returns Parsed numeric value or fallback
|
|
83
|
+
*/
|
|
84
|
+
function getCssLengthFromProperty(element, propertyName, fallback) {
|
|
85
|
+
const value = getComputedStyle(element).getPropertyValue(propertyName).trim();
|
|
86
|
+
if (!value) {
|
|
87
|
+
return fallback;
|
|
88
|
+
}
|
|
89
|
+
const parsed = Number.parseFloat(value);
|
|
90
|
+
return Number.isNaN(parsed) ? fallback : parsed;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check if workspace DOM attributes match the expected panel state.
|
|
94
|
+
*
|
|
95
|
+
* @param element - Host element containing workspace attributes
|
|
96
|
+
* @param inPanel - Expected panel state
|
|
97
|
+
* @returns True if both attributes are correctly set
|
|
98
|
+
*/
|
|
99
|
+
function areWorkspaceAttributesCorrect(element, inPanel) {
|
|
100
|
+
const panelAttrExists = element.hasAttribute("workspace-in-panel");
|
|
101
|
+
const containerAttrExists = element.hasAttribute("workspace-in-container");
|
|
102
|
+
return panelAttrExists === inPanel && containerAttrExists === !inPanel;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check if workspace update should be skipped based on current state.
|
|
106
|
+
*
|
|
107
|
+
* @param config - Workspace configuration
|
|
108
|
+
* @param config.showWorkspace - Whether workspace is enabled
|
|
109
|
+
* @param state - Current workspace state
|
|
110
|
+
* @param state.containerVisible - Whether workspace container is visible
|
|
111
|
+
* @param state.isContracting - Whether workspace is currently contracting
|
|
112
|
+
* @returns True if update should be skipped
|
|
113
|
+
*/
|
|
114
|
+
function shouldSkipWorkspaceUpdate(config, state) {
|
|
115
|
+
return (!config.showWorkspace || !state.containerVisible || state.isContracting);
|
|
116
|
+
}
|
|
117
|
+
// Made with Bob
|
|
118
|
+
|
|
119
|
+
export { areWorkspaceAttributesCorrect, calculateRequiredWidth, canHostGrow, getCssLengthFromProperty, getInlineSizeFromEntry, hasSignificantWidthChange, isWideEnough, shouldSkipWorkspaceUpdate };
|
|
120
|
+
//# sourceMappingURL=workspace-manager-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-manager-utils.js","sources":["../../../../src/components/chat-shell/src/workspace-manager-utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;AAGG;AAEH;;;;;;;;AAQG;AACG,SAAU,sBAAsB,CAAC,UAItC,EAAA;IACC,QACE,UAAU,CAAC,iBAAiB;AAC5B,QAAA,UAAU,CAAC,gBAAgB;QAC3B,UAAU,CAAC,YAAY;AAE3B;AAEA;;;;;;;AAOG;SACa,yBAAyB,CACvC,OAAe,EACf,OAAe,EACf,SAAiB,EAAA;IAEjB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,SAAS;AAChD;AAEA;;;;;;AAMG;AACG,SAAU,YAAY,CAC1B,UAAkB,EAClB,aAAqB,EAAA;IAErB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,UAAU,IAAI,aAAa;AACrE;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAC,aAAqB,EAAA;IAC/C,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,IAAI,aAAa;AAC5E;AAEA;;;;;AAKG;AACG,SAAU,sBAAsB,CAAC,KAA0B,EAAA;IAC/D,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa;AACrD,UAAE,KAAK,CAAC,aAAa,CAAC,CAAC;AACvB,UAAE,KAAK,CAAC,aAAa;IACvB,OAAO,aAAa,EAAE,UAAU,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK;AAC7D;AAEA;;;;;;;AAOG;SACa,wBAAwB,CACtC,OAAoB,EACpB,YAAoB,EACpB,QAAgB,EAAA;AAEhB,IAAA,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE;IAC7E,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,QAAQ;IACjB;IACA,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;AACvC,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,QAAQ,GAAG,MAAM;AACjD;AAEA;;;;;;AAMG;AACG,SAAU,6BAA6B,CAC3C,OAAoB,EACpB,OAAgB,EAAA;IAEhB,MAAM,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC;IAClE,MAAM,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,wBAAwB,CAAC;IAE1E,OAAO,eAAe,KAAK,OAAO,IAAI,mBAAmB,KAAK,CAAC,OAAO;AACxE;AAEA;;;;;;;;;AASG;AACG,SAAU,yBAAyB,CACvC,MAAkC,EAClC,KAA4D,EAAA;AAE5D,IAAA,QACE,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,aAAa;AAE3E;AAEA;;;;"}
|
|
@@ -16,7 +16,9 @@ interface WorkspaceState {
|
|
|
16
16
|
inPanel: boolean;
|
|
17
17
|
contentVisible: boolean;
|
|
18
18
|
containerVisible: boolean;
|
|
19
|
+
isCheckingExpansion: boolean;
|
|
19
20
|
isExpanding: boolean;
|
|
21
|
+
isCheckingContracting: boolean;
|
|
20
22
|
isContracting: boolean;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
@@ -33,8 +35,9 @@ export declare class WorkspaceManager {
|
|
|
33
35
|
private windowResizeHandler?;
|
|
34
36
|
private expansionCheckInterval?;
|
|
35
37
|
private expansionLastInlineSize?;
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
+
private contractionCheckInterval?;
|
|
39
|
+
private contractionLastInlineSize?;
|
|
40
|
+
private contractionInitialInlineSize?;
|
|
38
41
|
private throttledHandleHostResize;
|
|
39
42
|
private cssPropertyObserver?;
|
|
40
43
|
private lastKnownCssValues;
|
|
@@ -79,15 +82,60 @@ export declare class WorkspaceManager {
|
|
|
79
82
|
private performInitialHostMeasurement;
|
|
80
83
|
private handleHostResize;
|
|
81
84
|
private updateWorkspaceInPanelState;
|
|
85
|
+
/**
|
|
86
|
+
* Get layout dimensions from cache or compute if not available.
|
|
87
|
+
* Uses cached CSS values for performance, falling back to live computation.
|
|
88
|
+
*/
|
|
89
|
+
private getLayoutDimensions;
|
|
82
90
|
private handleShowWorkspaceEnabled;
|
|
91
|
+
private initializeImmediateDisplay;
|
|
92
|
+
private initializeExpansionTracking;
|
|
83
93
|
private handleShowWorkspaceDisabled;
|
|
84
94
|
private startExpansionPolling;
|
|
85
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Check expansion progress and determine if transition is complete.
|
|
97
|
+
*/
|
|
98
|
+
private checkExpansionProgress;
|
|
99
|
+
/**
|
|
100
|
+
* Handle ongoing width changes during expansion.
|
|
101
|
+
*/
|
|
102
|
+
private handleOngoingExpansion;
|
|
103
|
+
/**
|
|
104
|
+
* Set workspace to container mode by updating DOM attributes.
|
|
105
|
+
*/
|
|
106
|
+
private setWorkspaceInContainerMode;
|
|
107
|
+
private setupContractionTracking;
|
|
108
|
+
private initializeImmediateClosing;
|
|
109
|
+
private startContractionPolling;
|
|
110
|
+
private checkContractionProgress;
|
|
111
|
+
private handleOngoingContraction;
|
|
112
|
+
private finishWorkspaceContraction;
|
|
113
|
+
private startFinalContractionPolling;
|
|
114
|
+
private trackExpectedContraction;
|
|
86
115
|
private finishWorkspaceExpansion;
|
|
87
116
|
private finishWorkspaceClosing;
|
|
88
117
|
private trackExpectedExpansion;
|
|
89
118
|
private clearExpansionTimers;
|
|
90
|
-
private
|
|
119
|
+
private clearContractionTimers;
|
|
120
|
+
/**
|
|
121
|
+
* Updates workspace DOM attributes to match the panel state.
|
|
122
|
+
* Maintains inverse relationship between panel and container attributes.
|
|
123
|
+
*
|
|
124
|
+
* @param inPanel - True for panel mode, false for container mode
|
|
125
|
+
*/
|
|
126
|
+
private updateWorkspaceAttributes;
|
|
127
|
+
/**
|
|
128
|
+
* Updates the workspace panel state and corresponding DOM attributes.
|
|
129
|
+
*
|
|
130
|
+
* Synchronizes internal state with DOM attributes that control whether
|
|
131
|
+
* the workspace is displayed as an overlay panel or inline container.
|
|
132
|
+
*
|
|
133
|
+
* Ignores calls during expansion/contraction transitions. Only updates if
|
|
134
|
+
* state or attributes need changes. Maintains inverse relationship between
|
|
135
|
+
* panel and container attributes.
|
|
136
|
+
*
|
|
137
|
+
* @param inPanel - True to display workspace as overlay panel, false for inline
|
|
138
|
+
*/
|
|
91
139
|
private setWorkspaceInPanel;
|
|
92
140
|
private setWorkspaceContentVisible;
|
|
93
141
|
private setShowWorkspaceContainer;
|
|
@@ -95,12 +143,8 @@ export declare class WorkspaceManager {
|
|
|
95
143
|
private updateShellClasses;
|
|
96
144
|
private requestHostUpdate;
|
|
97
145
|
private getRequiredMinWidth;
|
|
98
|
-
private isWideEnough;
|
|
99
|
-
private canHostGrow;
|
|
100
146
|
private finalizeImmediateDisplay;
|
|
101
147
|
private setupExpansionTracking;
|
|
102
|
-
private getInlineSizeFromEntry;
|
|
103
|
-
private getCssLengthFromProperty;
|
|
104
148
|
/**
|
|
105
149
|
* Observe CSS custom properties that affect workspace layout.
|
|
106
150
|
* When these properties change, recalculate workspace positioning.
|