@carbon/ai-chat-components 1.10.0 → 1.11.0-rc.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/custom-elements.json +2063 -2102
- package/es/components/audio-player/src/utils/url-detector.d.ts +0 -14
- package/es/components/audio-player/src/utils/url-detector.js +1 -19
- package/es/components/audio-player/src/utils/url-detector.js.map +1 -1
- 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/code-snippet/src/codemirror/codemirror-loader.d.ts +0 -5
- package/es/components/code-snippet/src/codemirror/codemirror-loader.js +1 -8
- package/es/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -1
- package/es/components/markdown/src/markdown-token-tree.js +1 -1
- package/es/components/markdown/src/plugins/markdown-it-attrs.d.ts +0 -1
- package/es/components/markdown/src/plugins/markdown-it-attrs.js +1 -1
- package/es/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -1
- package/es/components/markdown/src/utils/plugin-fallback.js +3 -1
- package/es/components/markdown/src/utils/plugin-fallback.js.map +1 -1
- package/es/components/markdown/src/utils/table-helpers.d.ts +0 -26
- package/es/components/markdown/src/utils/table-helpers.js +1 -4
- package/es/components/markdown/src/utils/table-helpers.js.map +1 -1
- package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
- package/es/components/prompt-line/src/prompt-line-constants.d.ts +9 -1
- package/es/components/prompt-line/src/prompt-line-constants.js +10 -2
- package/es/components/prompt-line/src/prompt-line-constants.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-controller.d.ts +25 -78
- package/es/components/prompt-line/src/prompt-line-controller.js +0 -389
- package/es/components/prompt-line/src/prompt-line-controller.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-mouse-focus.d.ts +45 -0
- package/es/components/prompt-line/src/prompt-line-mouse-focus.js +83 -0
- package/es/components/prompt-line/src/prompt-line-mouse-focus.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.d.ts +0 -2
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js +30 -53
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +87 -0
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +390 -0
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line.d.ts +1 -1
- package/es/components/prompt-line/src/prompt-line.js +6 -5
- package/es/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/extension-equivalence.d.ts +2 -1
- package/es/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/typing-indicator.js +1 -1
- package/es/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -1
- package/es/components/truncated-text/src/truncated-text.js +2 -2
- package/es/components/truncated-text/src/truncated-text.js.map +1 -1
- package/es/components/video-player/src/utils/url-detector.d.ts +0 -28
- package/es/components/video-player/src/utils/url-detector.js +1 -37
- package/es/components/video-player/src/utils/url-detector.js.map +1 -1
- package/es/globals/utils/browser-utils.d.ts +3 -5
- package/es/globals/utils/browser-utils.js +1 -1
- package/es/globals/utils/browser-utils.js.map +1 -1
- package/es/globals/utils/csv.d.ts +0 -1
- package/es/globals/utils/csv.js.map +1 -1
- package/es/react/truncated-text.d.ts +12 -0
- package/es/react/truncated-text.js +28 -0
- package/es/react/truncated-text.js.map +1 -0
- package/es/testing/PageObjectId.d.ts +0 -4
- package/es/testing/PageObjectId.js.map +1 -1
- package/es/testing/load-all-lazy-deps.d.ts +1 -2
- package/es/testing/load-all-lazy-deps.js +3 -3
- package/es/testing/load-all-lazy-deps.js.map +1 -1
- package/es-custom/components/audio-player/src/utils/url-detector.d.ts +0 -14
- package/es-custom/components/audio-player/src/utils/url-detector.js +1 -19
- package/es-custom/components/audio-player/src/utils/url-detector.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/code-snippet/src/codemirror/codemirror-loader.d.ts +0 -5
- package/es-custom/components/code-snippet/src/codemirror/codemirror-loader.js +1 -8
- package/es-custom/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -1
- package/es-custom/components/markdown/src/markdown-token-tree.js +1 -1
- package/es-custom/components/markdown/src/plugins/markdown-it-attrs.d.ts +0 -1
- package/es-custom/components/markdown/src/plugins/markdown-it-attrs.js +1 -1
- package/es-custom/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -1
- package/es-custom/components/markdown/src/utils/plugin-fallback.js +3 -1
- package/es-custom/components/markdown/src/utils/plugin-fallback.js.map +1 -1
- package/es-custom/components/markdown/src/utils/table-helpers.d.ts +0 -26
- package/es-custom/components/markdown/src/utils/table-helpers.js +1 -4
- package/es-custom/components/markdown/src/utils/table-helpers.js.map +1 -1
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-constants.d.ts +9 -1
- package/es-custom/components/prompt-line/src/prompt-line-constants.js +10 -2
- package/es-custom/components/prompt-line/src/prompt-line-constants.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +25 -78
- package/es-custom/components/prompt-line/src/prompt-line-controller.js +0 -389
- package/es-custom/components/prompt-line/src/prompt-line-controller.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-mouse-focus.d.ts +45 -0
- package/es-custom/components/prompt-line/src/prompt-line-mouse-focus.js +83 -0
- package/es-custom/components/prompt-line/src/prompt-line-mouse-focus.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.d.ts +0 -2
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +30 -53
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +87 -0
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +390 -0
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line.d.ts +1 -1
- package/es-custom/components/prompt-line/src/prompt-line.js +6 -5
- package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.d.ts +2 -1
- package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js +1 -1
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -1
- package/es-custom/components/truncated-text/src/truncated-text.js +2 -2
- package/es-custom/components/truncated-text/src/truncated-text.js.map +1 -1
- package/es-custom/components/video-player/src/utils/url-detector.d.ts +0 -28
- package/es-custom/components/video-player/src/utils/url-detector.js +1 -37
- package/es-custom/components/video-player/src/utils/url-detector.js.map +1 -1
- package/es-custom/globals/utils/browser-utils.d.ts +3 -5
- package/es-custom/globals/utils/browser-utils.js +1 -1
- package/es-custom/globals/utils/browser-utils.js.map +1 -1
- package/es-custom/globals/utils/csv.d.ts +0 -1
- package/es-custom/globals/utils/csv.js.map +1 -1
- package/es-custom/react/truncated-text.d.ts +12 -0
- package/es-custom/react/truncated-text.js +28 -0
- package/es-custom/react/truncated-text.js.map +1 -0
- package/es-custom/testing/PageObjectId.d.ts +0 -4
- package/es-custom/testing/PageObjectId.js.map +1 -1
- package/es-custom/testing/load-all-lazy-deps.d.ts +1 -2
- package/es-custom/testing/load-all-lazy-deps.js +3 -3
- package/es-custom/testing/load-all-lazy-deps.js.map +1 -1
- package/package.json +3 -4
- package/es/components/markdown/src/markdown.template.d.ts +0 -6
- package/es/components/markdown/src/markdown.template.js +0 -29
- package/es/components/markdown/src/markdown.template.js.map +0 -1
- package/es-custom/components/markdown/src/markdown.template.d.ts +0 -6
- package/es-custom/components/markdown/src/markdown.template.js +0 -29
- package/es-custom/components/markdown/src/markdown.template.js.map +0 -1
|
@@ -18,9 +18,6 @@ import { isTableAtStreamingTail } from './streaming-table.js';
|
|
|
18
18
|
*
|
|
19
19
|
* @license
|
|
20
20
|
*/
|
|
21
|
-
// Default localization functions for table pagination
|
|
22
|
-
const DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT = ({ count, }) => `${count} items`;
|
|
23
|
-
const DEFAULT_PAGINATION_STATUS_TEXT = ({ start, end, count, }) => `${start}–${end} of ${count} items`;
|
|
24
21
|
/**
|
|
25
22
|
* Extracts tabular data from a table TokenTree node.
|
|
26
23
|
*
|
|
@@ -202,5 +199,5 @@ function renderTable(token, node, attrs, options, renderToken, slotName) {
|
|
|
202
199
|
return defaultTableTemplate;
|
|
203
200
|
}
|
|
204
201
|
|
|
205
|
-
export {
|
|
202
|
+
export { renderTable };
|
|
206
203
|
//# sourceMappingURL=table-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-helpers.js","sources":["../../../../../src/components/markdown/src/utils/table-helpers.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { html, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Token } from 'markdown-it';\n\nimport type {\n TableCellContent,\n TableRowContent,\n} from '../../../table/src/table.js';\nimport { combineConsecutiveHtmlInline } from './html-helpers.js';\nimport { isTableAtStreamingTail } from './streaming-table.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\nimport type { TokenTree } from '../markdown-token-tree';\n\n// Default localization functions for table pagination\nexport const DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT = ({\n count,\n}: {\n count: number;\n}) => `${count} items`;\nexport const DEFAULT_PAGINATION_STATUS_TEXT = ({\n start,\n end,\n count,\n}: {\n start: number;\n end: number;\n count: number;\n}) => `${start}–${end} of ${count} items`;\n\n/**\n * One cell of a parsed markdown table. A custom table renderer reads these\n * from the `headers` and `rows` it is handed.\n */\nexport interface TableCellData {\n /** Plain text of the cell, with markdown syntax stripped. */\n text: string;\n /**\n * Token tree for the cell's content, or `null` when the cell is plain\n * text. Render it to keep the links, code spans, and emphasis that `text`\n * drops.\n */\n tokens: TokenTree[] | null;\n}\n\n/**\n * Extracts tabular data from a table TokenTree node.\n *\n * Converts the hierarchical markdown table structure into the flat\n * header/rows format expected by the cds-custom-aichat-table component while retaining\n * the TokenTree children required for rich rendering within cells.\n */\nexport function extractTableData(tableNode: TokenTree): {\n headers: TableCellData[];\n rows: TableCellData[][];\n} {\n const headers: TableCellData[] = [];\n const rows: TableCellData[][] = [];\n\n for (const child of tableNode.children) {\n if (child.token.tag === 'thead') {\n // Extract column headers\n for (const theadChild of child.children) {\n if (theadChild.token.tag === 'tr') {\n for (const thChild of theadChild.children) {\n if (thChild.token.tag === 'th') {\n headers.push(extractCellData(thChild));\n }\n }\n }\n }\n } else if (child.token.tag === 'tbody') {\n // Extract data rows\n for (const tbodyChild of child.children) {\n if (tbodyChild.token.tag === 'tr') {\n const row: TableCellData[] = [];\n for (const tdChild of tbodyChild.children) {\n if (tdChild.token.tag === 'td') {\n row.push(extractCellData(tdChild));\n }\n }\n rows.push(row);\n }\n }\n }\n }\n\n return { headers, rows };\n}\n\n/**\n * Recursively extracts plain text content from a TokenTree node.\n *\n * This is used for table cells and other contexts where we need the\n * text content without HTML formatting.\n */\nexport function extractTextContent(node: TokenTree): string {\n // Handle direct text tokens\n if (node.token.type === 'text') {\n return node.token.content || '';\n }\n\n // Handle inline code\n if (node.token.type === 'code_inline') {\n return node.token.content || '';\n }\n\n if (node.token.type === 'softbreak' || node.token.type === 'hardbreak') {\n return '\\n';\n }\n\n // Recursively extract text from child nodes\n let text = '';\n for (const child of node.children) {\n text += extractTextContent(child);\n }\n\n return text;\n}\n\nfunction extractCellData(node: TokenTree): TableCellData {\n const text = extractTextContent(node);\n const tokens = extractRenderableChildren(node);\n const hasRichContent = tokens.some((child) => child.token.type !== 'text');\n\n return {\n text,\n tokens: hasRichContent ? tokens : null,\n };\n}\n\nfunction extractRenderableChildren(node: TokenTree): TokenTree[] {\n if (node.children.length === 1) {\n const onlyChild = node.children[0];\n if (\n onlyChild.token.type === 'inline' &&\n onlyChild.children &&\n onlyChild.children.length\n ) {\n return onlyChild.children;\n }\n }\n\n return node.children;\n}\n\n/**\n * Renders the body of the `case \"table\"` branch of `renderWithStaticTag`.\n *\n * Lives outside the renderer's switch because it covers three flows: streaming\n * loading state, default Carbon-table rendering, and the `customRenderers.table`\n * slot override.\n *\n * `renderToken` is the recursive renderer the caller dispatched from, passed in\n * to avoid a cycle with `markdown-renderer.ts`. `slotName` is non-undefined when\n * the consumer registered a `table` custom renderer, in which case the result is\n * wrapped in a named `<slot>` and an override descriptor is reported via\n * `recordCustomRender`.\n */\nexport function renderTable(\n token: Token,\n node: TokenTree,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n renderToken: (\n node: TokenTree,\n options: RenderTokenTreeOptions\n ) => TemplateResult,\n slotName: string | undefined\n): TemplateResult {\n const {\n streaming,\n forceTableLoading,\n context: parentContext,\n tableFilterPlaceholderText,\n tablePreviousPageText,\n tableNextPageText,\n tableItemsPerPageText,\n tableDownloadLabelText,\n tableLocale,\n tableGetPaginationSupplementalText,\n tableGetPaginationStatusText,\n } = options;\n\n // Determine if we should show loading state during streaming\n let isLoading = Boolean(forceTableLoading);\n if (\n !isLoading &&\n streaming &&\n parentContext?.parentChildren &&\n parentContext?.currentIndex !== undefined\n ) {\n isLoading = isTableAtStreamingTail(\n parentContext.parentChildren,\n parentContext.currentIndex\n );\n }\n\n const renderCellTokens = (tokens: TokenTree[], contextOverrides = {}) => {\n // Same as block/inline rendering: merge split raw HTML (e.g. `<a>…</a>`)\n // so each cell is not rendered as separate unsafeHTML + text chunks.\n const normalizedTokens = combineConsecutiveHtmlInline(tokens);\n return html`${repeat(\n normalizedTokens,\n (child, index) => `cell-${index}:${child.token.type}:${child.token.tag}`,\n (child, index) =>\n renderToken(child, {\n ...options,\n context: {\n ...options.context,\n ...contextOverrides,\n parentChildren: normalizedTokens,\n currentIndex: index,\n },\n })\n )}`;\n };\n\n const createCellContent = (\n cell: TableCellData,\n contextOverrides?: Record<string, unknown>\n ): TableCellContent => ({\n text: cell.text,\n template: cell.tokens\n ? renderCellTokens(cell.tokens, contextOverrides)\n : null,\n });\n\n // Only extract and process table data when not loading to avoid unnecessary work.\n // During loading, the table shows a skeleton and doesn't need the actual data.\n let headers: TableCellContent[] = [];\n let tableRows: TableRowContent[] = [];\n\n if (!isLoading) {\n const extractedData = extractTableData(node);\n headers = extractedData.headers.map((cell) =>\n createCellContent(cell, { isInThead: true })\n );\n tableRows = extractedData.rows.map((row) => ({\n cells: row.map((cell) => createCellContent(cell)),\n }));\n }\n\n // Always return the same structure to allow Lit to reuse the table element.\n // When isLoading is true, the table component will show a skeleton state.\n // When isLoading is false, it will show the actual data.\n // This prevents recreating the table element and preserves its internal state.\n const defaultTableTemplate = html`<div class=\"cds-custom-aichat-table--square\">\n <cds-custom-aichat-table\n data-rounded\n .headers=${headers}\n .rows=${tableRows}\n .loading=${isLoading}\n .filterPlaceholderText=${tableFilterPlaceholderText}\n .previousPageText=${tablePreviousPageText}\n .nextPageText=${tableNextPageText}\n .itemsPerPageText=${tableItemsPerPageText}\n .downloadLabelText=${tableDownloadLabelText}\n .locale=${tableLocale}\n .getPaginationSupplementalText=${tableGetPaginationSupplementalText}\n .getPaginationStatusText=${tableGetPaginationStatusText}\n ...=${attrs}></cds-custom-aichat-table>\n </div>`;\n\n if (slotName !== undefined) {\n // For the override path we pass the raw extracted cell data (not the\n // Lit-wrapped TableCellContent) so consumers can render however they\n // like. Extract once even when loading so the consumer always gets\n // the data — they can read `isLoading` to choose a skeleton state.\n const { headers: dataHeaders, rows: dataRows } = extractTableData(node);\n options.recordCustomRender?.({\n slotName,\n kind: 'table',\n token,\n data: {\n headers: dataHeaders,\n rows: dataRows,\n isStreaming: !!streaming,\n isLoading,\n },\n });\n return html`<slot name=${slotName}>${defaultTableTemplate}</slot>`;\n }\n\n return defaultTableTemplate;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAeH;AACO,MAAM,oCAAoC,GAAG,CAAC,EACnD,KAAK,GAGN,KAAK,CAAA,EAAG,KAAK;MACD,8BAA8B,GAAG,CAAC,EAC7C,KAAK,EACL,GAAG,EACH,KAAK,GAKN,KAAK,CAAA,EAAG,KAAK,IAAI,GAAG,CAAA,IAAA,EAAO,KAAK,CAAA,MAAA;AAiBjC;;;;;;AAMG;AACG,SAAU,gBAAgB,CAAC,SAAoB,EAAA;IAInD,MAAM,OAAO,GAAoB,EAAE;IACnC,MAAM,IAAI,GAAsB,EAAE;AAElC,IAAA,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtC,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAE/B,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;AACjC,oBAAA,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE;wBACzC,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;4BAC9B,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;wBACxC;oBACF;gBACF;YACF;QACF;aAAO,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAEtC,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;oBACjC,MAAM,GAAG,GAAoB,EAAE;AAC/B,o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AA0B;0BAC/B,qBAAqB;sBACzB,iBAAiB;0BACb,qBAAqB;2BACpB,sBAAsB;gBACjC,WAAW;uCACY,kCAAkC;iCACxC,4BAA4B;YACjD,KAAK,CAAA;SACR;AAEP,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;;;;;AAK1B,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACvE,OAAO,CAAC,kBAAkB,GAAG;YAC3B,QAAQ;AACR,YAAA,IAAI,EAAE,OAAO;YACb,KAAK;AACL,YAAA,IAAI,EAAE;AACJ,gBAAA,OAAO,EAAE,WAAW;AACpB,gBAAA,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,CAAC,CAAC,SAAS;gBACxB,SAAS;AACV,aAAA;AACF,SAAA,CAAC;AACF,QAAA,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,oBAAoB,SAAS;IACpE;AAEA,IAAA,OAAO,oBAAoB;AAC7B;;"}
|
|
1
|
+
{"version":3,"file":"table-helpers.js","sources":["../../../../../src/components/markdown/src/utils/table-helpers.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { html, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Token } from 'markdown-it';\n\nimport type {\n TableCellContent,\n TableRowContent,\n} from '../../../table/src/table.js';\nimport { combineConsecutiveHtmlInline } from './html-helpers.js';\nimport { isTableAtStreamingTail } from './streaming-table.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\nimport type { TokenTree } from '../markdown-token-tree';\n\n/**\n * One cell of a parsed markdown table. A custom table renderer reads these\n * from the `headers` and `rows` it is handed.\n */\nexport interface TableCellData {\n /** Plain text of the cell, with markdown syntax stripped. */\n text: string;\n /**\n * Token tree for the cell's content, or `null` when the cell is plain\n * text. Render it to keep the links, code spans, and emphasis that `text`\n * drops.\n */\n tokens: TokenTree[] | null;\n}\n\n/**\n * Extracts tabular data from a table TokenTree node.\n *\n * Converts the hierarchical markdown table structure into the flat\n * header/rows format expected by the cds-custom-aichat-table component while retaining\n * the TokenTree children required for rich rendering within cells.\n */\nfunction extractTableData(tableNode: TokenTree): {\n headers: TableCellData[];\n rows: TableCellData[][];\n} {\n const headers: TableCellData[] = [];\n const rows: TableCellData[][] = [];\n\n for (const child of tableNode.children) {\n if (child.token.tag === 'thead') {\n // Extract column headers\n for (const theadChild of child.children) {\n if (theadChild.token.tag === 'tr') {\n for (const thChild of theadChild.children) {\n if (thChild.token.tag === 'th') {\n headers.push(extractCellData(thChild));\n }\n }\n }\n }\n } else if (child.token.tag === 'tbody') {\n // Extract data rows\n for (const tbodyChild of child.children) {\n if (tbodyChild.token.tag === 'tr') {\n const row: TableCellData[] = [];\n for (const tdChild of tbodyChild.children) {\n if (tdChild.token.tag === 'td') {\n row.push(extractCellData(tdChild));\n }\n }\n rows.push(row);\n }\n }\n }\n }\n\n return { headers, rows };\n}\n\n/**\n * Recursively extracts plain text content from a TokenTree node.\n *\n * This is used for table cells and other contexts where we need the\n * text content without HTML formatting.\n */\nfunction extractTextContent(node: TokenTree): string {\n // Handle direct text tokens\n if (node.token.type === 'text') {\n return node.token.content || '';\n }\n\n // Handle inline code\n if (node.token.type === 'code_inline') {\n return node.token.content || '';\n }\n\n if (node.token.type === 'softbreak' || node.token.type === 'hardbreak') {\n return '\\n';\n }\n\n // Recursively extract text from child nodes\n let text = '';\n for (const child of node.children) {\n text += extractTextContent(child);\n }\n\n return text;\n}\n\nfunction extractCellData(node: TokenTree): TableCellData {\n const text = extractTextContent(node);\n const tokens = extractRenderableChildren(node);\n const hasRichContent = tokens.some((child) => child.token.type !== 'text');\n\n return {\n text,\n tokens: hasRichContent ? tokens : null,\n };\n}\n\nfunction extractRenderableChildren(node: TokenTree): TokenTree[] {\n if (node.children.length === 1) {\n const onlyChild = node.children[0];\n if (\n onlyChild.token.type === 'inline' &&\n onlyChild.children &&\n onlyChild.children.length\n ) {\n return onlyChild.children;\n }\n }\n\n return node.children;\n}\n\n/**\n * Renders the body of the `case \"table\"` branch of `renderWithStaticTag`.\n *\n * Lives outside the renderer's switch because it covers three flows: streaming\n * loading state, default Carbon-table rendering, and the `customRenderers.table`\n * slot override.\n *\n * `renderToken` is the recursive renderer the caller dispatched from, passed in\n * to avoid a cycle with `markdown-renderer.ts`. `slotName` is non-undefined when\n * the consumer registered a `table` custom renderer, in which case the result is\n * wrapped in a named `<slot>` and an override descriptor is reported via\n * `recordCustomRender`.\n */\nexport function renderTable(\n token: Token,\n node: TokenTree,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n renderToken: (\n node: TokenTree,\n options: RenderTokenTreeOptions\n ) => TemplateResult,\n slotName: string | undefined\n): TemplateResult {\n const {\n streaming,\n forceTableLoading,\n context: parentContext,\n tableFilterPlaceholderText,\n tablePreviousPageText,\n tableNextPageText,\n tableItemsPerPageText,\n tableDownloadLabelText,\n tableLocale,\n tableGetPaginationSupplementalText,\n tableGetPaginationStatusText,\n } = options;\n\n // Determine if we should show loading state during streaming\n let isLoading = Boolean(forceTableLoading);\n if (\n !isLoading &&\n streaming &&\n parentContext?.parentChildren &&\n parentContext?.currentIndex !== undefined\n ) {\n isLoading = isTableAtStreamingTail(\n parentContext.parentChildren,\n parentContext.currentIndex\n );\n }\n\n const renderCellTokens = (tokens: TokenTree[], contextOverrides = {}) => {\n // Same as block/inline rendering: merge split raw HTML (e.g. `<a>…</a>`)\n // so each cell is not rendered as separate unsafeHTML + text chunks.\n const normalizedTokens = combineConsecutiveHtmlInline(tokens);\n return html`${repeat(\n normalizedTokens,\n (child, index) => `cell-${index}:${child.token.type}:${child.token.tag}`,\n (child, index) =>\n renderToken(child, {\n ...options,\n context: {\n ...options.context,\n ...contextOverrides,\n parentChildren: normalizedTokens,\n currentIndex: index,\n },\n })\n )}`;\n };\n\n const createCellContent = (\n cell: TableCellData,\n contextOverrides?: Record<string, unknown>\n ): TableCellContent => ({\n text: cell.text,\n template: cell.tokens\n ? renderCellTokens(cell.tokens, contextOverrides)\n : null,\n });\n\n // Only extract and process table data when not loading to avoid unnecessary work.\n // During loading, the table shows a skeleton and doesn't need the actual data.\n let headers: TableCellContent[] = [];\n let tableRows: TableRowContent[] = [];\n\n if (!isLoading) {\n const extractedData = extractTableData(node);\n headers = extractedData.headers.map((cell) =>\n createCellContent(cell, { isInThead: true })\n );\n tableRows = extractedData.rows.map((row) => ({\n cells: row.map((cell) => createCellContent(cell)),\n }));\n }\n\n // Always return the same structure to allow Lit to reuse the table element.\n // When isLoading is true, the table component will show a skeleton state.\n // When isLoading is false, it will show the actual data.\n // This prevents recreating the table element and preserves its internal state.\n const defaultTableTemplate = html`<div class=\"cds-custom-aichat-table--square\">\n <cds-custom-aichat-table\n data-rounded\n .headers=${headers}\n .rows=${tableRows}\n .loading=${isLoading}\n .filterPlaceholderText=${tableFilterPlaceholderText}\n .previousPageText=${tablePreviousPageText}\n .nextPageText=${tableNextPageText}\n .itemsPerPageText=${tableItemsPerPageText}\n .downloadLabelText=${tableDownloadLabelText}\n .locale=${tableLocale}\n .getPaginationSupplementalText=${tableGetPaginationSupplementalText}\n .getPaginationStatusText=${tableGetPaginationStatusText}\n ...=${attrs}></cds-custom-aichat-table>\n </div>`;\n\n if (slotName !== undefined) {\n // For the override path we pass the raw extracted cell data (not the\n // Lit-wrapped TableCellContent) so consumers can render however they\n // like. Extract once even when loading so the consumer always gets\n // the data — they can read `isLoading` to choose a skeleton state.\n const { headers: dataHeaders, rows: dataRows } = extractTableData(node);\n options.recordCustomRender?.({\n slotName,\n kind: 'table',\n token,\n data: {\n headers: dataHeaders,\n rows: dataRows,\n isStreaming: !!streaming,\n isLoading,\n },\n });\n return html`<slot name=${slotName}>${defaultTableTemplate}</slot>`;\n }\n\n return defaultTableTemplate;\n}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AAK;AACL,YAAA,IAAI,EAAE;AACJ,gBAAA,OAAO,EAAE,WAAW;AACpB,gBAAA,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,CAAC,CAAC,SAAS;gBACxB,SAAS;AACV,aAAA;AACF,SAAA,CAAC;AACF,QAAA,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,oBAAoB,SAAS;IACpE;AAEA,IAAA,OAAO,oBAAoB;AAC7B;;"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { css } from 'lit';
|
|
9
9
|
|
|
10
|
-
var styles = css([":host :host([data-rounded=\"\"]),:host [data-rounded=\"\"]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=\"\"])::part(button),:host :host([data-rounded=\"\"])::part(link),:host [data-rounded=\"\"]::part(button),:host [data-rounded=\"\"]::part(link){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem);outline-offset:-.0625rem}:host :host([data-rounded=\"\"])>:only-child,:host [data-rounded=\"\"]>:only-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]),:host [data-rounded=top]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]),:host [data-rounded=top-left]{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]),:host [data-rounded=top-right]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]),:host [data-rounded=bottom]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]),:host [data-rounded=bottom-left]{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]),:host [data-rounded=bottom-right]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child,:host [data-rounded=top]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child,:host [data-rounded=top]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child,:host [data-rounded=top-left]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top-left]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child,:host [data-rounded=top-right]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top-right]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child,:host [data-rounded=bottom]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child,:host [data-rounded=bottom]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child,:host [data-rounded=bottom-left]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom-left]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child,:host [data-rounded=bottom-right]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom-right]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child,:host [data-rounded=top][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child::part(button),:host [data-rounded=top][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child,:host [data-rounded=top-right][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child::part(button),:host [data-rounded=top-right][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child,:host [data-rounded=top-left][data-stacked]>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child::part(button),:host [data-rounded=top-left][data-stacked]>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child,:host [data-rounded=bottom][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child::part(button),:host [data-rounded=bottom][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child,:host [data-rounded=bottom-right][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-right][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child,:host [data-rounded=bottom-left][data-stacked]>:last-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-left][data-stacked]>:last-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;--cds-aichat-autocomplete-max-height:none}:host .cds-custom-aichat-autocomplete{background:var(--cds-chat-prompt-background,#fff);border:1px solid var(--cds-chat-prompt-border-start,#f4f4f4);border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0);border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0);display:flex;flex-direction:column;max-block-size:var(--cds-aichat-autocomplete-max-height)}:host .cds-custom-aichat-autocomplete__header{align-items:center;border-block-end:1px solid var(--cds-border-subtle-00,#e0e0e0);display:flex;flex-shrink:0;gap:1rem;justify-content:space-between;min-block-size:2.5rem;padding-block:0;padding-inline:1rem}:host .cds-custom-aichat-autocomplete__title{color:var(--cds-text-primary,#161616);font-size:var(--cds-heading-compact-01-font-size,.875rem);font-weight:var(--cds-heading-compact-01-font-weight,600);letter-spacing:var(--cds-heading-compact-01-letter-spacing,.16px);line-height:var(--cds-heading-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete__items{display:flex;flex:1 1 auto;flex-direction:column;margin:0;min-block-size:0;overflow-y:auto;padding:0}:host .cds-custom-aichat-autocomplete__live-region{clip:rect(0,0,0,0);block-size:1px;border:0;inline-size:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap}:host .cds-custom-aichat-autocomplete-item-group__title{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);letter-spacing:var(--cds-label-01-letter-spacing,.32px);line-height:var(--cds-label-01-line-height,1.33333);padding-block-end:.25rem;padding-block-start:1rem;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item-group__items{display:flex;flex-direction:column;margin:0;padding:0}:host .cds-custom-aichat-autocomplete-item{align-items:start;background:none;border:none;cursor:pointer;display:flex;font:inherit;inline-size:100%;min-block-size:2.5rem;padding-block:0;padding-inline:0;position:relative;text-align:start}:host .cds-custom-aichat-autocomplete-item:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-custom-aichat-autocomplete-item:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){:host .cds-custom-aichat-autocomplete-item:focus{outline-style:dotted}}:host .cds-custom-aichat-autocomplete-item--active,:host .cds-custom-aichat-autocomplete-item--active:hover{background:var(--cds-background-selected,hsla(0,0%,55%,.2))}:host .cds-custom-aichat-autocomplete-item--disabled{cursor:default;pointer-events:none}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-remainder,:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-icon-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item__content{align-items:start;display:flex;flex:1;gap:.5rem;padding-block:11px;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item__text{display:flex;flex-direction:column;gap:.125rem}:host .cds-custom-aichat-autocomplete-item__label{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-placeholder,hsla(0,0%,9%,.4))}:host .cds-custom-aichat-autocomplete-item__label-remainder{color:var(--cds-text-primary,#161616)}:host .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-helper-text-01-font-size,.75rem);letter-spacing:var(--cds-helper-text-01-letter-spacing,.32px);line-height:var(--cds-helper-text-01-line-height,1.33333)}:host .cds-custom-aichat-autocomplete-item__send-icon{align-self:start;display:flex;padding-block:.75rem;padding-inline:.75rem;pointer-events:none;visibility:hidden;z-index:1}:host .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-interactive,#0f62fe)}:host .cds-custom-aichat-autocomplete-item--active .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus-within .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:hover .cds-custom-aichat-autocomplete-item__send-icon{visibility:visible}:host .cds-custom-aichat-autocomplete-item:after{background:var(--cds-border-subtle-00,#e0e0e0);block-size:1px;content:\"\";display:block;inset-block-end:0;inset-inline:1rem;position:absolute}:host .cds-custom-aichat-autocomplete-item:focus:after,:host .cds-custom-aichat-autocomplete-item:hover:after{display:none}:host .cds-custom-aichat-autocomplete-item[first-item]{border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]{border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]:after{display:none}:host([attached]){--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}"]);
|
|
10
|
+
var styles = css([":host :host([data-rounded=\"\"]),:host [data-rounded=\"\"]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=\"\"])::part(button),:host :host([data-rounded=\"\"])::part(link),:host [data-rounded=\"\"]::part(button),:host [data-rounded=\"\"]::part(link){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem);outline-offset:-.0625rem}:host :host([data-rounded=\"\"])>:only-child,:host [data-rounded=\"\"]>:only-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]),:host [data-rounded=top]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]),:host [data-rounded=top-left]{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]),:host [data-rounded=top-right]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]),:host [data-rounded=bottom]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]),:host [data-rounded=bottom-left]{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]),:host [data-rounded=bottom-right]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child,:host [data-rounded=top]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child,:host [data-rounded=top]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child,:host [data-rounded=top-left]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top-left]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child,:host [data-rounded=top-right]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top-right]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child,:host [data-rounded=bottom]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child,:host [data-rounded=bottom]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child,:host [data-rounded=bottom-left]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom-left]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child,:host [data-rounded=bottom-right]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom-right]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child,:host [data-rounded=top][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child::part(button),:host [data-rounded=top][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child,:host [data-rounded=top-right][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child::part(button),:host [data-rounded=top-right][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child,:host [data-rounded=top-left][data-stacked]>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child::part(button),:host [data-rounded=top-left][data-stacked]>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child,:host [data-rounded=bottom][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child::part(button),:host [data-rounded=bottom][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child,:host [data-rounded=bottom-right][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-right][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child,:host [data-rounded=bottom-left][data-stacked]>:last-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-left][data-stacked]>:last-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;--cds-aichat-autocomplete-max-height:none}:host .cds-custom-aichat-autocomplete{background:var(--cds-chat-prompt-background,#fff);border:1px solid var(--cds-chat-prompt-border-start,#f4f4f4);border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0);border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0);display:flex;flex-direction:column;max-block-size:var(--cds-aichat-autocomplete-max-height)}:host .cds-custom-aichat-autocomplete__header{align-items:center;border-block-end:1px solid var(--cds-border-subtle-00,#e0e0e0);display:flex;flex-shrink:0;gap:1rem;justify-content:space-between;min-block-size:2.5rem;padding-block:0;padding-inline:1rem}:host .cds-custom-aichat-autocomplete__title{color:var(--cds-text-primary,#161616);font-size:var(--cds-heading-compact-01-font-size,.875rem);font-weight:var(--cds-heading-compact-01-font-weight,600);letter-spacing:var(--cds-heading-compact-01-letter-spacing,.16px);line-height:var(--cds-heading-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete__items{display:flex;flex:1 1 auto;flex-direction:column;margin:0;min-block-size:0;overflow-y:auto;padding:0}:host .cds-custom-aichat-autocomplete__live-region{clip:rect(0,0,0,0);block-size:1px;border:0;inline-size:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap}:host .cds-custom-aichat-autocomplete-item-group__title{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);letter-spacing:var(--cds-label-01-letter-spacing,.32px);line-height:var(--cds-label-01-line-height,1.33333);padding-block-end:.25rem;padding-block-start:1rem;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item-group__items{display:flex;flex-direction:column;margin:0;padding:0}:host .cds-custom-aichat-autocomplete-item{align-items:start;background:none;border:none;cursor:pointer;display:flex;font:inherit;inline-size:100%;min-block-size:2.5rem;padding-block:0;padding-inline:0;position:relative;text-align:start}:host .cds-custom-aichat-autocomplete-item:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-custom-aichat-autocomplete-item:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){:host .cds-custom-aichat-autocomplete-item:focus{outline-style:dotted}}:host .cds-custom-aichat-autocomplete-item--active,:host .cds-custom-aichat-autocomplete-item--active:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-custom-aichat-autocomplete-item--disabled{cursor:default;pointer-events:none}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-remainder,:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-icon-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item__content{align-items:start;display:flex;flex:1;gap:.5rem;padding-block:11px;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item__text{display:flex;flex-direction:column;gap:.125rem}:host .cds-custom-aichat-autocomplete-item__label{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-placeholder,hsla(0,0%,9%,.4))}:host .cds-custom-aichat-autocomplete-item__label-remainder{color:var(--cds-text-primary,#161616)}:host .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-secondary,#525252);font-size:var(--cds-helper-text-01-font-size,.75rem);letter-spacing:var(--cds-helper-text-01-letter-spacing,.32px);line-height:var(--cds-helper-text-01-line-height,1.33333)}:host .cds-custom-aichat-autocomplete-item__send-icon{align-self:start;display:flex;padding-block:.75rem;padding-inline:.75rem;pointer-events:none;visibility:hidden;z-index:1}:host .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-interactive,#0f62fe)}:host .cds-custom-aichat-autocomplete-item--active .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus-within .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:hover .cds-custom-aichat-autocomplete-item__send-icon{visibility:visible}:host .cds-custom-aichat-autocomplete-item:after{background:var(--cds-border-subtle-00,#e0e0e0);block-size:1px;content:\"\";display:block;inset-block-end:0;inset-inline:1rem;position:absolute}:host .cds-custom-aichat-autocomplete-item:focus:after,:host .cds-custom-aichat-autocomplete-item:hover:after{display:none}:host .cds-custom-aichat-autocomplete-item[first-item]{border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]{border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]:after{display:none}:host([attached]){--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}"]);
|
|
11
11
|
|
|
12
12
|
export { styles as default };
|
|
13
13
|
//# sourceMappingURL=autocomplete.scss.js.map
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Max block size the prompt line grows to before it caps and shows a vertical
|
|
11
11
|
* scrollbar. Shared by both editing surfaces — the lite `<textarea>`
|
|
12
|
-
* ([./prompt-line-
|
|
12
|
+
* ([./prompt-line-textarea-runtime.ts]) and the rich Tiptap content node
|
|
13
13
|
* ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and
|
|
14
14
|
* the textarea→rich swap stays imperceptible. Keep them reading this one
|
|
15
15
|
* constant so they can't drift.
|
|
@@ -25,3 +25,11 @@ export declare const HISTORY_DEFAULTS: {
|
|
|
25
25
|
readonly depth: 100;
|
|
26
26
|
readonly newGroupDelay: 500;
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* How long (in milliseconds) to wait after the last keystroke before the
|
|
30
|
+
* `cds-custom-aichat-prompt-typing` event fires with `isTyping = false`. Shared by
|
|
31
|
+
* the textarea controller ([./prompt-line-textarea-runtime.ts]) and the
|
|
32
|
+
* Tiptap typing-indicator extension ([./tiptap/typing-indicator.ts]) so the
|
|
33
|
+
* two surfaces can't drift.
|
|
34
|
+
*/
|
|
35
|
+
export declare const TYPING_TIMEOUT_MS = 5000;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* Max block size the prompt line grows to before it caps and shows a vertical
|
|
18
18
|
* scrollbar. Shared by both editing surfaces — the lite `<textarea>`
|
|
19
|
-
* ([./prompt-line-
|
|
19
|
+
* ([./prompt-line-textarea-runtime.ts]) and the rich Tiptap content node
|
|
20
20
|
* ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and
|
|
21
21
|
* the textarea→rich swap stays imperceptible. Keep them reading this one
|
|
22
22
|
* constant so they can't drift.
|
|
@@ -29,6 +29,14 @@ const PROMPT_LINE_MAX_BLOCK_SIZE = '157px';
|
|
|
29
29
|
* the lazily-imported Tiptap chunk. Re-exported from [./tiptap/index.ts].
|
|
30
30
|
*/
|
|
31
31
|
const HISTORY_DEFAULTS = { depth: 100, newGroupDelay: 500 };
|
|
32
|
+
/**
|
|
33
|
+
* How long (in milliseconds) to wait after the last keystroke before the
|
|
34
|
+
* `cds-custom-aichat-prompt-typing` event fires with `isTyping = false`. Shared by
|
|
35
|
+
* the textarea controller ([./prompt-line-textarea-runtime.ts]) and the
|
|
36
|
+
* Tiptap typing-indicator extension ([./tiptap/typing-indicator.ts]) so the
|
|
37
|
+
* two surfaces can't drift.
|
|
38
|
+
*/
|
|
39
|
+
const TYPING_TIMEOUT_MS = 5000;
|
|
32
40
|
|
|
33
|
-
export { HISTORY_DEFAULTS, PROMPT_LINE_MAX_BLOCK_SIZE };
|
|
41
|
+
export { HISTORY_DEFAULTS, PROMPT_LINE_MAX_BLOCK_SIZE, TYPING_TIMEOUT_MS };
|
|
34
42
|
//# sourceMappingURL=prompt-line-constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-line-constants.js","sources":["../../../../src/components/prompt-line/src/prompt-line-constants.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Max block size the prompt line grows to before it caps and shows a vertical\n * scrollbar. Shared by both editing surfaces — the lite `<textarea>`\n * ([./prompt-line-
|
|
1
|
+
{"version":3,"file":"prompt-line-constants.js","sources":["../../../../src/components/prompt-line/src/prompt-line-constants.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Max block size the prompt line grows to before it caps and shows a vertical\n * scrollbar. Shared by both editing surfaces — the lite `<textarea>`\n * ([./prompt-line-textarea-runtime.ts]) and the rich Tiptap content node\n * ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and\n * the textarea→rich swap stays imperceptible. Keep them reading this one\n * constant so they can't drift.\n */\nexport const PROMPT_LINE_MAX_BLOCK_SIZE = '157px';\n\n/**\n * Undo/redo tuning for the rich editor's `UndoRedo` extension. Lives here rather\n * than in the tiptap barrel so [./prompt-line-rich-runtime.ts] can read it\n * without importing the barrel — that would pull the whole curated bundle into\n * the lazily-imported Tiptap chunk. Re-exported from [./tiptap/index.ts].\n */\nexport const HISTORY_DEFAULTS = { depth: 100, newGroupDelay: 500 } as const;\n\n/**\n * How long (in milliseconds) to wait after the last keystroke before the\n * `cds-custom-aichat-prompt-typing` event fires with `isTyping = false`. Shared by\n * the textarea controller ([./prompt-line-textarea-runtime.ts]) and the\n * Tiptap typing-indicator extension ([./tiptap/typing-indicator.ts]) so the\n * two surfaces can't drift.\n */\nexport const TYPING_TIMEOUT_MS = 5000;\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;AAOG;AACI,MAAM,0BAA0B,GAAG;AAE1C;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG;AAEhE;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG;;"}
|
|
@@ -7,25 +7,10 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Shared types for the prompt-line controller abstraction.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* - `TextareaController` (this file) — a Tiptap-free `<textarea>`. It is the
|
|
16
|
-
* default and keeps the shell's static import graph free of `@tiptap/*`.
|
|
17
|
-
* - The rich controller ([./prompt-line-rich-runtime.ts]) — a Tiptap `Editor`,
|
|
18
|
-
* reached only through a dynamic `import()` so Tiptap lands in its own lazy
|
|
19
|
-
* chunk.
|
|
20
|
-
*
|
|
21
|
-
* Both controllers emit the **same** `cds-custom-aichat-prompt-*` events with the
|
|
22
|
-
* same detail shapes, so the React wrapper and `@carbon/ai-chat`'s `Input`
|
|
23
|
-
* handlers are identical regardless of mode. The shell can swap a
|
|
24
|
-
* `TextareaController` for the rich controller in place (text, caret, and
|
|
25
|
-
* focus transfer losslessly because the textarea holds plain text).
|
|
26
|
-
*
|
|
27
|
-
* `Editor` / `JSONContent` are **type-only** imports here — erased at compile,
|
|
28
|
-
* so this module carries no Tiptap runtime.
|
|
12
|
+
* `Editor` / `JSONContent` / `Extension` are **type-only** imports here —
|
|
13
|
+
* erased at compile, so this module carries no Tiptap runtime.
|
|
29
14
|
*/
|
|
30
15
|
import type { Editor, Extension, JSONContent } from '@tiptap/core';
|
|
31
16
|
/** Updater shape accepted by `setContent` for reduce-style edits. */
|
|
@@ -55,8 +40,24 @@ export interface PromptLineControllerInit {
|
|
|
55
40
|
extensions?: Extension[];
|
|
56
41
|
}
|
|
57
42
|
/**
|
|
58
|
-
* The surface
|
|
59
|
-
*
|
|
43
|
+
* The editing-surface controller abstraction for `<cds-custom-aichat-prompt-line>`.
|
|
44
|
+
*
|
|
45
|
+
* The prompt-line shell ([./prompt-line.ts]) delegates all editing behavior to
|
|
46
|
+
* a `PromptLineController`. Two implementations exist:
|
|
47
|
+
*
|
|
48
|
+
* - `TextareaController` (./prompt-line-textarea-runtime.ts) — a Tiptap-free
|
|
49
|
+
* `<textarea>`. It is the default and keeps the shell's static import graph
|
|
50
|
+
* free of `@tiptap/*`.
|
|
51
|
+
* - The rich controller ([./prompt-line-rich-runtime.ts]) — a Tiptap `Editor`,
|
|
52
|
+
* reached only through a dynamic `import()` so Tiptap lands in its own lazy
|
|
53
|
+
* chunk.
|
|
54
|
+
*
|
|
55
|
+
* Both controllers emit the **same** `cds-custom-aichat-prompt-*` events with the
|
|
56
|
+
* same detail shapes, so the React wrapper and `@carbon/ai-chat`'s `Input`
|
|
57
|
+
* handlers are identical regardless of mode. The shell can swap a
|
|
58
|
+
* `TextareaController` for the rich controller in place (text, caret, focus,
|
|
59
|
+
* and keyboard-focus state transfer losslessly because the textarea holds plain
|
|
60
|
+
* text and both controllers share the same focus-tracking contract).
|
|
60
61
|
*/
|
|
61
62
|
export interface PromptLineController {
|
|
62
63
|
/** Mount the editing surface into the (already-slotted) light-DOM host. */
|
|
@@ -72,7 +73,8 @@ export interface PromptLineController {
|
|
|
72
73
|
clearContent(): void;
|
|
73
74
|
/** Live Tiptap editor, or `null` in textarea mode. */
|
|
74
75
|
getEditor(): Editor | null;
|
|
75
|
-
focus
|
|
76
|
+
/** Accepts `keyboardFocus`, which when true specifies that a focus ring should be visible around the prompt line text area */
|
|
77
|
+
focus(keyboardFocus: boolean): void;
|
|
76
78
|
blur(): void;
|
|
77
79
|
hasFocus(): boolean;
|
|
78
80
|
/** Selection as plain-text offsets (used for seamless transfer). */
|
|
@@ -108,61 +110,6 @@ export interface PromptLineController {
|
|
|
108
110
|
setComposing(composing: boolean): void;
|
|
109
111
|
undo(): boolean;
|
|
110
112
|
redo(): boolean;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* `<textarea>`-backed controller. Tiptap-free; emits the same prompt events as
|
|
114
|
-
* the rich editor. Auto-grows via a hidden mirror, capped at
|
|
115
|
-
* `PROMPT_LINE_MAX_BLOCK_SIZE` with the field scrolling past it — the same cap
|
|
116
|
-
* the rich contenteditable applies (see ./tiptap/editor-styles.ts), so the
|
|
117
|
-
* textarea→rich swap is imperceptible.
|
|
118
|
-
*/
|
|
119
|
-
export declare class TextareaController implements PromptLineController {
|
|
120
|
-
private _wrap;
|
|
121
|
-
private _textarea;
|
|
122
|
-
private _mirror;
|
|
123
|
-
private _host;
|
|
124
|
-
private _focusFromMouse;
|
|
125
|
-
private _isTyping;
|
|
126
|
-
private _typingTimer;
|
|
127
|
-
mount(host: HTMLElement, init: PromptLineControllerInit): void;
|
|
128
|
-
destroy(): void;
|
|
129
|
-
getValue(): string;
|
|
130
|
-
setContent(next: JSONContent | string | SetContentUpdater): void;
|
|
131
|
-
insertContent(content: JSONContent | string, opts?: {
|
|
132
|
-
at?: number;
|
|
133
|
-
}): void;
|
|
134
|
-
clearContent(): void;
|
|
135
|
-
getEditor(): Editor | null;
|
|
136
|
-
focus(): void;
|
|
137
|
-
blur(): void;
|
|
138
|
-
hasFocus(): boolean;
|
|
139
|
-
getSelection(): {
|
|
140
|
-
from: number;
|
|
141
|
-
to: number;
|
|
142
|
-
};
|
|
143
|
-
setTextSelection(pos: number | {
|
|
144
|
-
from: number;
|
|
145
|
-
to: number;
|
|
146
|
-
}): void;
|
|
147
|
-
selectAll(): void;
|
|
148
|
-
setEditable(editable: boolean): void;
|
|
149
|
-
setPlaceholder(placeholder: string): void;
|
|
150
|
-
setAriaLabel(ariaLabel: string): void;
|
|
151
|
-
setTestId(testId: string): void;
|
|
152
|
-
setExtensions(_extensions: Extension[]): void;
|
|
153
|
-
setComposing(_composing: boolean): void;
|
|
154
|
-
undo(): boolean;
|
|
155
|
-
redo(): boolean;
|
|
156
|
-
private _onInput;
|
|
157
|
-
private _onKeydown;
|
|
158
|
-
private _setMouseFlag;
|
|
159
|
-
private _onFocus;
|
|
160
|
-
private _onBlur;
|
|
161
|
-
/** Programmatic value write: updates the field, mirror, and emits change. */
|
|
162
|
-
private _setValue;
|
|
163
|
-
private _emitChange;
|
|
164
|
-
private _syncMirror;
|
|
165
|
-
private _markTyping;
|
|
166
|
-
private _clearTypingTimer;
|
|
167
|
-
private _dispatch;
|
|
113
|
+
/** Whether the most recent focus event was driven by keyboard (not pointer/touch-driven). */
|
|
114
|
+
getKeyboardFocus(): boolean;
|
|
168
115
|
}
|