@carbon/ai-chat-components 1.9.0-rc.1 → 1.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/custom-elements.json +345 -21
- package/es/components/prompt-line/autocomplete/src/autocomplete.d.ts +8 -1
- package/es/components/prompt-line/autocomplete/src/autocomplete.js +58 -13
- package/es/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
- package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
- package/es/components/prompt-line/src/autocomplete-controller.js +5 -15
- package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-constants.d.ts +10 -0
- package/es/components/prompt-line/src/prompt-line-constants.js +8 -1
- package/es/components/prompt-line/src/prompt-line-constants.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-controller.d.ts +15 -2
- package/es/components/prompt-line/src/prompt-line-controller.js +5 -2
- package/es/components/prompt-line/src/prompt-line-controller.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-rich-loader.js +5 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-rich-runtime.d.ts +2 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js +111 -15
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line.d.ts +44 -7
- package/es/components/prompt-line/src/prompt-line.js +124 -31
- package/es/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/build-extensions.js +35 -5
- package/es/components/prompt-line/src/tiptap/build-extensions.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +5 -1
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js +16 -7
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/carbon-mention.js +3 -3
- package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.d.ts +12 -1
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js +28 -3
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/editor-styles.js +1 -1
- package/es/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/extension-equivalence.d.ts +63 -0
- package/es/components/prompt-line/src/tiptap/extension-equivalence.js +80 -0
- package/es/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/index.d.ts +1 -4
- package/es/components/prompt-line/src/tiptap/index.js +1 -18
- package/es/components/prompt-line/src/tiptap/index.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/json-utils.d.ts +8 -0
- package/es/components/prompt-line/src/tiptap/json-utils.js +11 -1
- package/es/components/prompt-line/src/tiptap/json-utils.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/render-token-chip.js +3 -5
- package/es/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/types.d.ts +5 -15
- package/es/react/hooks/useChatAutocomplete.js +14 -1
- package/es/react/hooks/useChatAutocomplete.js.map +1 -1
- package/es/react/prompt-line.d.ts +3 -2
- package/es/react/prompt-line.js +3 -2
- package/es/react/prompt-line.js.map +1 -1
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.d.ts +8 -1
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js +58 -13
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
- package/es-custom/components/prompt-line/src/autocomplete-controller.js +5 -15
- package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-constants.d.ts +10 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.js +8 -1
- 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 +15 -2
- package/es-custom/components/prompt-line/src/prompt-line-controller.js +5 -2
- package/es-custom/components/prompt-line/src/prompt-line-controller.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js +5 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.d.ts +2 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +111 -15
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line.d.ts +44 -7
- package/es-custom/components/prompt-line/src/prompt-line.js +124 -31
- package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js +35 -5
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +5 -1
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js +16 -7
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js +3 -3
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.d.ts +12 -1
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js +28 -3
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js +1 -1
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.d.ts +63 -0
- package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.js +80 -0
- package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/index.d.ts +1 -4
- package/es-custom/components/prompt-line/src/tiptap/index.js +1 -18
- package/es-custom/components/prompt-line/src/tiptap/index.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/json-utils.d.ts +8 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.js +11 -1
- package/es-custom/components/prompt-line/src/tiptap/json-utils.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js +3 -5
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/types.d.ts +5 -15
- package/es-custom/react/hooks/useChatAutocomplete.js +14 -1
- package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -1
- package/es-custom/react/prompt-line.d.ts +3 -2
- package/es-custom/react/prompt-line.js +3 -2
- package/es-custom/react/prompt-line.js.map +1 -1
- package/package.json +14 -24
- package/telemetry.yml +13 -8
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2026
|
|
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
|
+
* Value-level equivalence for the extension list handed to
|
|
11
|
+
* `<cds-custom-aichat-prompt-line>`, so a host config update that says the same thing
|
|
12
|
+
* does not recreate the live editor (which resets undo history).
|
|
13
|
+
*
|
|
14
|
+
* The built Tiptap instances cannot be compared directly: `carbonAutocomplete`
|
|
15
|
+
* and `carbonStarterTrigger` capture their config in closures, leaving
|
|
16
|
+
* `.options` empty (two different item lists would compare equal), while
|
|
17
|
+
* `carbonMention` / `carbonCommand` install fresh function identities on every
|
|
18
|
+
* `.configure()` (identical configs would compare unequal). So each factory
|
|
19
|
+
* output is tagged here with the source config it was built from, and
|
|
20
|
+
* equivalence compares those configs instead.
|
|
21
|
+
*
|
|
22
|
+
* Only the appended list is compared. The base bundle (schema, undo/redo,
|
|
23
|
+
* placeholder, keymap, value-sync, ...) is constructed inside the rich runtime
|
|
24
|
+
* and never reaches this module.
|
|
25
|
+
*/
|
|
26
|
+
import type { Extension } from '@tiptap/core';
|
|
27
|
+
import type { AutocompleteConfig, StartersConfig, TriggerSuggestionConfig } from './types.js';
|
|
28
|
+
/** Which carbon factory produced an extension. */
|
|
29
|
+
export type ExtensionSourceKind = 'mention' | 'command' | 'autocomplete' | 'starters';
|
|
30
|
+
/** The config an extension was built from, recorded at build time. */
|
|
31
|
+
export interface ExtensionSourceDescriptor {
|
|
32
|
+
kind: ExtensionSourceKind;
|
|
33
|
+
config: TriggerSuggestionConfig | AutocompleteConfig | StartersConfig | undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Record the source config on a built extension. Returns the same instance so
|
|
37
|
+
* factories can tag inline.
|
|
38
|
+
*/
|
|
39
|
+
export declare function tagExtensionSource<T>(extension: T, descriptor: ExtensionSourceDescriptor): T;
|
|
40
|
+
/** Read back a descriptor, or `undefined` for host-supplied extensions. */
|
|
41
|
+
export declare function getExtensionSource(extension: unknown): ExtensionSourceDescriptor | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Whether two extension lists install the same editor behavior.
|
|
44
|
+
*
|
|
45
|
+
* Compared positionally — extension order is ProseMirror plugin order, so a
|
|
46
|
+
* reordered list is a genuinely different editor and never reorder-matched.
|
|
47
|
+
*
|
|
48
|
+
* Per pair:
|
|
49
|
+
* - Same instance wins outright. This is the only rule available for
|
|
50
|
+
* host-supplied extensions, whose documented contract already asks hosts to
|
|
51
|
+
* memoize them.
|
|
52
|
+
* - Two carbon extensions of the same kind compare their source configs by
|
|
53
|
+
* value, with functions compared by reference (lodash `isEqual` semantics) —
|
|
54
|
+
* a host that rebuilds its callbacks each render genuinely gets a new editor,
|
|
55
|
+
* same as before.
|
|
56
|
+
* - Starter triggers are always equivalent: every difference they can carry
|
|
57
|
+
* (`items`, `isOn`) is applied to the live editor's storage instead. See
|
|
58
|
+
* `RichController.setExtensions`. `buildCarbonExtensions` installs the
|
|
59
|
+
* extension for an empty list too, so emptying `items` stays a storage write
|
|
60
|
+
* instead of a length change that rejects the pair before this rule is
|
|
61
|
+
* reached.
|
|
62
|
+
*/
|
|
63
|
+
export declare function areExtensionSetsEquivalent(previous: readonly Extension[], next: readonly Extension[]): boolean;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 isEqual from 'lodash-es/isEqual.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
*
|
|
13
|
+
* Copyright IBM Corp. 2026
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
const EXTENSION_SOURCE = Symbol.for('cds-custom-aichat.prompt-line.extension-source');
|
|
19
|
+
/**
|
|
20
|
+
* Record the source config on a built extension. Returns the same instance so
|
|
21
|
+
* factories can tag inline.
|
|
22
|
+
*/
|
|
23
|
+
function tagExtensionSource(extension, descriptor) {
|
|
24
|
+
extension[EXTENSION_SOURCE] = descriptor;
|
|
25
|
+
return extension;
|
|
26
|
+
}
|
|
27
|
+
/** Read back a descriptor, or `undefined` for host-supplied extensions. */
|
|
28
|
+
function getExtensionSource(extension) {
|
|
29
|
+
if (!extension || typeof extension !== 'object') {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return extension[EXTENSION_SOURCE];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether two extension lists install the same editor behavior.
|
|
36
|
+
*
|
|
37
|
+
* Compared positionally — extension order is ProseMirror plugin order, so a
|
|
38
|
+
* reordered list is a genuinely different editor and never reorder-matched.
|
|
39
|
+
*
|
|
40
|
+
* Per pair:
|
|
41
|
+
* - Same instance wins outright. This is the only rule available for
|
|
42
|
+
* host-supplied extensions, whose documented contract already asks hosts to
|
|
43
|
+
* memoize them.
|
|
44
|
+
* - Two carbon extensions of the same kind compare their source configs by
|
|
45
|
+
* value, with functions compared by reference (lodash `isEqual` semantics) —
|
|
46
|
+
* a host that rebuilds its callbacks each render genuinely gets a new editor,
|
|
47
|
+
* same as before.
|
|
48
|
+
* - Starter triggers are always equivalent: every difference they can carry
|
|
49
|
+
* (`items`, `isOn`) is applied to the live editor's storage instead. See
|
|
50
|
+
* `RichController.setExtensions`. `buildCarbonExtensions` installs the
|
|
51
|
+
* extension for an empty list too, so emptying `items` stays a storage write
|
|
52
|
+
* instead of a length change that rejects the pair before this rule is
|
|
53
|
+
* reached.
|
|
54
|
+
*/
|
|
55
|
+
function areExtensionSetsEquivalent(previous, next) {
|
|
56
|
+
if (previous === next) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (previous.length !== next.length) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return previous.every((prevExtension, index) => isExtensionEquivalent(prevExtension, next[index]));
|
|
63
|
+
}
|
|
64
|
+
function isExtensionEquivalent(previous, next) {
|
|
65
|
+
if (previous === next) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
const prevSource = getExtensionSource(previous);
|
|
69
|
+
const nextSource = getExtensionSource(next);
|
|
70
|
+
if (!prevSource || !nextSource || prevSource.kind !== nextSource.kind) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (prevSource.kind === 'starters') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return isEqual(prevSource.config, nextSource.config);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { areExtensionSetsEquivalent, getExtensionSource, tagExtensionSource };
|
|
80
|
+
//# sourceMappingURL=extension-equivalence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-equivalence.js","sources":["../../../../../src/components/prompt-line/src/tiptap/extension-equivalence.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAwCH,MAAM,gBAAgB,GAAkB,MAAM,CAAC,GAAG,CAChD,yCAAyC,CAC1C;AAED;;;AAGG;AACG,SAAU,kBAAkB,CAChC,SAAY,EACZ,UAAqC,EAAA;AAEpC,IAAA,SAAqC,CAAC,gBAAgB,CAAC,GAAG,UAAU;AACrE,IAAA,OAAO,SAAS;AAClB;AAEA;AACM,SAAU,kBAAkB,CAChC,SAAkB,EAAA;IAElB,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AAC/C,QAAA,OAAO,SAAS;IAClB;AACA,IAAA,OAAQ,SAAqC,CAAC,gBAAgB,CACvB;AACzC;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,0BAA0B,CACxC,QAA8B,EAC9B,IAA0B,EAAA;AAE1B,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,OAAO,IAAI;IACb;IACA,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;AACnC,QAAA,OAAO,KAAK;IACd;IACA,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,KAAK,KACzC,qBAAqB,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAClD;AACH;AAEA,SAAS,qBAAqB,CAAC,QAAmB,EAAE,IAAe,EAAA;AACjE,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,CAAC;AAC/C,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC;AAC3C,IAAA,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;AACrE,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,EAAE;AAClC,QAAA,OAAO,IAAI;IACb;IACA,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;AACtD;;;;"}
|
|
@@ -35,8 +35,5 @@ export { PlainTextPaste } from './plain-text-paste.js';
|
|
|
35
35
|
export { Keymap } from './keymap.js';
|
|
36
36
|
export { default as Placeholder } from '@tiptap/extension-placeholder';
|
|
37
37
|
export { UndoRedo } from '@tiptap/extensions';
|
|
38
|
-
export
|
|
39
|
-
readonly depth: 100;
|
|
40
|
-
readonly newGroupDelay: 500;
|
|
41
|
-
};
|
|
38
|
+
export { HISTORY_DEFAULTS } from '../prompt-line-constants.js';
|
|
42
39
|
export type { StarterTriggerStorage } from './carbon-starter-trigger.js';
|
|
@@ -22,22 +22,5 @@ export { PlainTextPaste } from './plain-text-paste.js';
|
|
|
22
22
|
export { Keymap } from './keymap.js';
|
|
23
23
|
export { default as Placeholder } from '@tiptap/extension-placeholder';
|
|
24
24
|
export { UndoRedo } from '@tiptap/extensions';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @license
|
|
28
|
-
*
|
|
29
|
-
* Copyright IBM Corp. 2026
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* Public barrel for the carbon Tiptap factories and helpers. Imported by the
|
|
36
|
-
* `<cds-custom-aichat-prompt-line>` element and re-exported from
|
|
37
|
-
* [../../index.ts] so consumers can do
|
|
38
|
-
* `import { carbonMention, ... } from "@carbon/ai-chat-components"`.
|
|
39
|
-
*/
|
|
40
|
-
const HISTORY_DEFAULTS = { depth: 100, newGroupDelay: 500 };
|
|
41
|
-
|
|
42
|
-
export { HISTORY_DEFAULTS };
|
|
25
|
+
export { HISTORY_DEFAULTS } from '../prompt-line-constants.js';
|
|
43
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -59,3 +59,11 @@ export declare function projectRawValue(editor: Editor): string;
|
|
|
59
59
|
* prompt-line upgrades from textarea to Tiptap mode.
|
|
60
60
|
*/
|
|
61
61
|
export declare function textToDoc(text: string): JSONContent;
|
|
62
|
+
/**
|
|
63
|
+
* Map a plain-text offset into a ProseMirror position inside the doc
|
|
64
|
+
* {@link textToDoc} builds from the same text. Lives here because it encodes
|
|
65
|
+
* that function's shape: one paragraph per line, so a position costs +1 for the
|
|
66
|
+
* doc/first-paragraph start plus +1 for every newline before it, each of which
|
|
67
|
+
* opens another paragraph. Change `textToDoc` and this has to change with it.
|
|
68
|
+
*/
|
|
69
|
+
export declare function textOffsetToDocPos(text: string, offset: number): number;
|
|
@@ -153,6 +153,16 @@ function textToDoc(text) {
|
|
|
153
153
|
: { type: 'paragraph' }),
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Map a plain-text offset into a ProseMirror position inside the doc
|
|
158
|
+
* {@link textToDoc} builds from the same text. Lives here because it encodes
|
|
159
|
+
* that function's shape: one paragraph per line, so a position costs +1 for the
|
|
160
|
+
* doc/first-paragraph start plus +1 for every newline before it, each of which
|
|
161
|
+
* opens another paragraph. Change `textToDoc` and this has to change with it.
|
|
162
|
+
*/
|
|
163
|
+
function textOffsetToDocPos(text, offset) {
|
|
164
|
+
return offset + 1 + (text.slice(0, offset).split('\n').length - 1);
|
|
165
|
+
}
|
|
156
166
|
|
|
157
|
-
export { findNodesByType, getRawText, mapNodes, projectRawValue, removeNodesByType, textToDoc };
|
|
167
|
+
export { findNodesByType, getRawText, mapNodes, projectRawValue, removeNodesByType, textOffsetToDocPos, textToDoc };
|
|
158
168
|
//# sourceMappingURL=json-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utils.js","sources":["../../../../../src/components/prompt-line/src/tiptap/json-utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAYH;;;AAGG;SACa,iBAAiB,CAC/B,IAAiB,EACjB,GAAG,KAAe,EAAA;AAElB,IAAA,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC;AAC7B,IAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC9E;AAEA;;;;;;;AAOG;AACG,SAAU,QAAQ,CACtB,IAAiB,EACjB,EAA6C,EAAA;IAE7C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;AAC7B,IAAA,OAAO,MAAM,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE;AACpE;AAEA,SAAS,IAAI,CACX,IAAiB,EACjB,EAA6C,EAAA;IAE7C,IAAI,IAAI,GAAgB,IAAI;AAC5B,IAAA,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3C,MAAM,cAAc,GAAkB,EAAE;AACxC,QAAA,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;YAChC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;AAC9B,YAAA,IAAI,MAAM,KAAK,IAAI,E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;AAEJ;AAEA;;;AAGG;AACG,SAAU,eAAe,CAAC,MAAc,EAAA;AAC5C,IAAA,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;AACrC;AAEA;;;;;AAKG;AACG,SAAU,SAAS,CAAC,IAAY,EAAA;IACpC,OAAO;AACL,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,OAAO,EAAE;aACN,KAAK,CAAC,IAAI;AACV,aAAA,GAAG,CAAC,CAAC,IAAI,KACR;AACE,cAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC9D,cAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAC1B;KACJ;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"json-utils.js","sources":["../../../../../src/components/prompt-line/src/tiptap/json-utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAYH;;;AAGG;SACa,iBAAiB,CAC/B,IAAiB,EACjB,GAAG,KAAe,EAAA;AAElB,IAAA,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC;AAC7B,IAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC9E;AAEA;;;;;;;AAOG;AACG,SAAU,QAAQ,CACtB,IAAiB,EACjB,EAA6C,EAAA;IAE7C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;AAC7B,IAAA,OAAO,MAAM,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE;AACpE;AAEA,SAAS,IAAI,CACX,IAAiB,EACjB,EAA6C,EAAA;IAE7C,IAAI,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,IAAI,KAAK,KAAK,IAAI,EAAE;gBACpC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC;gBAC9B;YACF;;AAEA,YAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,gBAAA,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;oBAChC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,CAAC;gBAC5C;YACF;QACF;;AAEJ;AAEA;;;AAGG;AACG,SAAU,eAAe,CAAC,MAAc,EAAA;AAC5C,IAAA,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;AACrC;AAEA;;;;;AAKG;AACG,SAAU,SAAS,CAAC,IAAY,EAAA;IACpC,OAAO;AACL,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,OAAO,EAAE;aACN,KAAK,CAAC,IAAI;AACV,aAAA,GAAG,CAAC,CAAC,IAAI,KACR;AACE,cAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC9D,cAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAC1B;KACJ;AACH;AAEA;;;;;;AAMG;AACG,SAAU,kBAAkB,CAAC,IAAY,EAAE,MAAc,EAAA;IAC7D,OAAO,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACpE;;;;"}
|
|
@@ -23,11 +23,11 @@ function ensureTokenStyleRules() {
|
|
|
23
23
|
}
|
|
24
24
|
setVarsForSelector('.cds-custom-aichat--token', { 'white-space': 'normal' });
|
|
25
25
|
setVarsForSelector('.cds-custom-aichat--token[data-token-context="composer"]', {
|
|
26
|
-
color: 'var(--cds-tag-color-blue)',
|
|
26
|
+
color: 'var(--cds-tag-color-blue, #0043ce)',
|
|
27
27
|
});
|
|
28
|
-
setVarsForSelector('.cds-custom-aichat--token[data-token-context="composer"]::selection', { 'background-color': 'var(--cds-tag-background-blue)' });
|
|
28
|
+
setVarsForSelector('.cds-custom-aichat--token[data-token-context="composer"]::selection', { 'background-color': 'var(--cds-tag-background-blue, #d0e2ff)' });
|
|
29
29
|
setVarsForSelector('.cds-custom-aichat--token[data-token-context="historical"]', {
|
|
30
|
-
color: 'var(--cds-link-secondary)',
|
|
30
|
+
color: 'var(--cds-link-secondary, #0043ce)',
|
|
31
31
|
});
|
|
32
32
|
tokenStyleRulesInstalled = true;
|
|
33
33
|
}
|
|
@@ -77,8 +77,6 @@ function createTokenContainer(attrs, type, context) {
|
|
|
77
77
|
dom.setAttribute('data-token-type', type);
|
|
78
78
|
dom.setAttribute('data-token-context', context);
|
|
79
79
|
dom.setAttribute('data-raw-value', value ?? label ?? '');
|
|
80
|
-
dom.setAttribute('role', 'img');
|
|
81
|
-
dom.setAttribute('aria-label', label || value || '');
|
|
82
80
|
dom.className = 'cds-custom-aichat--token';
|
|
83
81
|
return dom;
|
|
84
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-token-chip.js","sources":["../../../../../src/components/prompt-line/src/tiptap/render-token-chip.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAiBH,IAAI,wBAAwB,GAAG,KAAK;AAEpC,SAAS,qBAAqB,GAAA;IAC5B,IAAI,wBAAwB,EAAE;QAC5B;IACF;IACA,kBAAkB,CAAC,oBAAoB,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;IACrE,kBAAkB,CAAC,mDAAmD,EAAE;AACtE,QAAA,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"render-token-chip.js","sources":["../../../../../src/components/prompt-line/src/tiptap/render-token-chip.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;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CAAC,gBAAgB,EAAE,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC;AACxD,IAAA,GAAG,CAAC,SAAS,GAAG,mBAAmB;AACnC,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,iBAAiB,CAAC,KAAqB,EAAA;IAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AAC3C,IAAA,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI;AAClE,IAAA,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI;AAClE,IAAA,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAG,EAAE;AACtE,IAAA,IAAI,CAAC,WAAW,GAAG,CAAA,EAAG,OAAO,CAAA,EAAG,KAAK,IAAI,KAAK,IAAI,EAAE,CAAA,CAAE;AACtD,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -94,8 +94,6 @@ export interface BaseSuggestionConfig {
|
|
|
94
94
|
items: SuggestionItem[] | ((query: string) => Promise<SuggestionItem[]> | SuggestionItem[]);
|
|
95
95
|
/** Minimum query length before items() is called. Defaults to 0. */
|
|
96
96
|
minQueryLength?: number;
|
|
97
|
-
/** Debounce delay in ms for the async items function. Defaults to 200. */
|
|
98
|
-
debounceMs?: number;
|
|
99
97
|
/** Called after the user selects an item and insertion is complete. */
|
|
100
98
|
onSelect?: (item: SuggestionItem) => void;
|
|
101
99
|
/** Replace the built-in suggestion list UI. */
|
|
@@ -103,7 +101,7 @@ export interface BaseSuggestionConfig {
|
|
|
103
101
|
/**
|
|
104
102
|
* When `true`, clicking a suggestion item fires `cds-custom-aichat-autocomplete-select`
|
|
105
103
|
* and inserts the item into the editor rather than sending immediately.
|
|
106
|
-
* Defaults to `false`. This property is
|
|
104
|
+
* Defaults to `false`. This property is omitted in TriggerSuggestionConfig
|
|
107
105
|
* since mentions and commands should always insert into the editor.
|
|
108
106
|
*/
|
|
109
107
|
disableDirectSend?: boolean;
|
|
@@ -123,14 +121,6 @@ export interface TriggerSuggestionConfig extends Omit<BaseSuggestionConfig, 'dis
|
|
|
123
121
|
/** Whether the trigger must appear at the start of the input/line, or
|
|
124
122
|
* anywhere. Defaults to "anywhere". */
|
|
125
123
|
triggerPosition?: 'start' | 'anywhere';
|
|
126
|
-
/**
|
|
127
|
-
* Override the schema-node name. Threaded through `Mention.extend({ name })`
|
|
128
|
-
* inside the carbon factory to sidestep Tiptap's last-named-wins stacking
|
|
129
|
-
* caveat when multiple triggers coexist.
|
|
130
|
-
*
|
|
131
|
-
* Defaults: `"mention"` (carbonMention) / `"command"` (carbonCommand).
|
|
132
|
-
*/
|
|
133
|
-
name?: string;
|
|
134
124
|
/** Replace the visual element rendered inside the token chip. */
|
|
135
125
|
renderCustomToken?: (item: SuggestionItem) => HTMLElement | ReactNode;
|
|
136
126
|
/**
|
|
@@ -159,11 +149,11 @@ export interface TriggerSuggestionConfig extends Omit<BaseSuggestionConfig, 'dis
|
|
|
159
149
|
}
|
|
160
150
|
/**
|
|
161
151
|
* Live autocomplete config. Selection inserts plain text (no token chip).
|
|
152
|
+
*
|
|
153
|
+
* Note: only one autocomplete config per editor is supported, because Tiptap
|
|
154
|
+
* resolves extensions by name.
|
|
162
155
|
*/
|
|
163
|
-
export
|
|
164
|
-
/** Override the suggestion plugin key name. Defaults to `"autocomplete"`. */
|
|
165
|
-
name?: string;
|
|
166
|
-
}
|
|
156
|
+
export type AutocompleteConfig = BaseSuggestionConfig;
|
|
167
157
|
/**
|
|
168
158
|
* Configuration for starter prompts — shown when the editor is empty and
|
|
169
159
|
* focused. Extends {@link BaseSuggestionConfig} so consumers can supply a
|
|
@@ -187,7 +187,6 @@ function CustomReactNodePortal({ slot, node, onMount, onMousedown, }) {
|
|
|
187
187
|
}
|
|
188
188
|
chatWrapper.appendChild(hostEl);
|
|
189
189
|
setHostElement(hostEl);
|
|
190
|
-
onMount?.(hostEl);
|
|
191
190
|
return () => {
|
|
192
191
|
onMount?.(null);
|
|
193
192
|
if (onMousedown) {
|
|
@@ -202,6 +201,20 @@ function CustomReactNodePortal({ slot, node, onMount, onMousedown, }) {
|
|
|
202
201
|
// those updates in place.
|
|
203
202
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
204
203
|
}, []);
|
|
204
|
+
// After the portal content is committed into hostElement, hand the first
|
|
205
|
+
// child element to the controller. This is typically a custom element (e.g.
|
|
206
|
+
// <cds-custom-aichat-autocomplete>) whose properties (anchorElement, keydown
|
|
207
|
+
// forwarding) only work on the element itself — not on the plain <div>
|
|
208
|
+
// wrapper that createPortal renders into. Custom elements are defined
|
|
209
|
+
// synchronously at module load, so by the time useEffect fires (post-paint)
|
|
210
|
+
// the element is fully upgraded and its properties are available.
|
|
211
|
+
React.useEffect(() => {
|
|
212
|
+
if (!hostElement) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const child = hostElement.firstElementChild;
|
|
216
|
+
onMount?.(child ?? hostElement);
|
|
217
|
+
}, [hostElement, onMount]);
|
|
205
218
|
return (jsx("div", { slot: slot, ref: containerRef, children: hostElement ? ReactDOM.createPortal(node, hostElement) : null }));
|
|
206
219
|
}
|
|
207
220
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatAutocomplete.js","sources":["../../../src/react/hooks/useChatAutocomplete.tsx"],"sourcesContent":[null],"names":["_jsx","Autocomplete"],"mappings":";;;;;;;;;;;;;AA2EM,SAAU,mBAAmB,CACjC,OAAmC,EAAA;IAEnC,MAAM,EACJ,OAAO,EACP,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,GAAG,IAAI,EACf,SAAS,GACV,GAAG,OAAO;IAEX,MAAM,CA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AC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC;AACrC,QAAA,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC;QAE7B,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AAC5C,QAAA,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC;QACrC,IAAI,WAAW,EAAE;AACf,YAAA,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC;QACnD;AACA,QAAA,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC;QAE/B,cAAc,CAAC,MAAM,CAAC;AACtB,QAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useChatAutocomplete.js","sources":["../../../src/react/hooks/useChatAutocomplete.tsx"],"sourcesContent":[null],"names":["_jsx","Autocomplete"],"mappings":";;;;;;;;;;;;;AA2EM,SAAU,mBAAmB,CACjC,OAAmC,EAAA;IAEnC,MAAM,EACJ,OAAO,EACP,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,GAAG,IAAI,EACf,SAAS,GACV,GAAG,OAAO;IAEX,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA8B;AACpE,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,KAAK,EAAE,EAAE;AACV,KAAA,CAAC;;;IAIF,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAgC,IAAI,CAAC;;;IAGvE,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;AACpD,IAAA,YAAY,CAAC,OAAO,GAAG,iBAAiB;IACxC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;AAClD,IAAA,eAAe,CAAC,OAAO,GAAG,YAAY;IACtC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC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AAA,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC;YACtD;YACA,MAAM,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,MAAM,EAAE;YACf,cAAc,CAAC,IAAI,CAAC;AACtB,QAAA,CAAC;;;;;IAKH,CAAC,EAAE,EAAE,CAAC;;;;;;;;AASN,IAAA,KAAK,CAAC,SAAS,CAAC,MAAK;QACnB,IAAI,CAAC,WAAW,EAAE;YAChB;QACF;AACA,QAAA,MAAM,KAAK,GAAG,WAAW,CAAC,iBAAuC;AACjE,QAAA,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC;AACjC,IAAA,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAE1B,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAA,QAAA,EAC/B,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,IAAI,EAAA,CAC1D;AAEV;;;;"}
|
|
@@ -11,8 +11,9 @@ import React from 'react';
|
|
|
11
11
|
* React wrapper for `<cds-custom-aichat-prompt-line>`. Mirrors the WC's prompt-line
|
|
12
12
|
* surface verbatim — no host-side prop transformation required. The element
|
|
13
13
|
* renders a Tiptap-free textarea by default and upgrades to the rich Tiptap
|
|
14
|
-
* editor in place when the `rich` prop is set
|
|
15
|
-
*
|
|
14
|
+
* editor in place when the `rich` prop is set, or `ensureEditor()` is called —
|
|
15
|
+
* `extensions` alone are staged, not a trigger. Chat-domain config layering
|
|
16
|
+
* happens one level up at the shell. Imperative
|
|
16
17
|
* methods are reachable via ref.
|
|
17
18
|
*
|
|
18
19
|
* Wrapped in `withWebComponentBridge` so testId / rich / extensions / content
|
|
@@ -22,8 +22,9 @@ import { withWebComponentBridge } from './utils/withWebComponentBridge.js';
|
|
|
22
22
|
* React wrapper for `<cds-custom-aichat-prompt-line>`. Mirrors the WC's prompt-line
|
|
23
23
|
* surface verbatim — no host-side prop transformation required. The element
|
|
24
24
|
* renders a Tiptap-free textarea by default and upgrades to the rich Tiptap
|
|
25
|
-
* editor in place when the `rich` prop is set
|
|
26
|
-
*
|
|
25
|
+
* editor in place when the `rich` prop is set, or `ensureEditor()` is called —
|
|
26
|
+
* `extensions` alone are staged, not a trigger. Chat-domain config layering
|
|
27
|
+
* happens one level up at the shell. Imperative
|
|
27
28
|
* methods are reachable via ref.
|
|
28
29
|
*
|
|
29
30
|
* Wrapped in `withWebComponentBridge` so testId / rich / extensions / content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-line.js","sources":["../../src/react/prompt-line.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAQH
|
|
1
|
+
{"version":3,"file":"prompt-line.js","sources":["../../src/react/prompt-line.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAQH;;;;;;;;;;;;;;AAcG;AACH,MAAM,UAAU,GAAG,sBAAsB,CACvC,eAAe,CAAC;AACd,IAAA,OAAO,EAAE,wBAAwB;AACjC,IAAA,YAAY,EAAE,iBAAiB;AAC/B,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE;AACN,QAAA,QAAQ,EAAE,0BAA0B;AACpC,QAAA,OAAO,EAAE,yBAAyB;AAClC,QAAA,MAAM,EAAE,wBAAwB;AAChC,QAAA,QAAQ,EAAE,0BAA0B;AACpC,QAAA,SAAS,EAAE,2BAA2B;AACtC,QAAA,YAAY,EAAE,+BAA+B;AAC7C,QAAA,eAAe,EAAE,2BAA2B;AAC5C,QAAA,gBAAgB,EAAE,6BAA6B;AAChD,KAAA;AACF,CAAA,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/ai-chat-components",
|
|
3
3
|
"description": "AI Chat Components",
|
|
4
|
-
"version": "1.9.0
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -46,23 +46,13 @@
|
|
|
46
46
|
"test:web-components": "web-test-runner \"src/components/**/*.test.ts\" --node-resolve"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@tiptap/core": "^3.22.0",
|
|
50
|
-
"@tiptap/extension-document": "^3.22.5",
|
|
51
|
-
"@tiptap/extension-hard-break": "^3.22.5",
|
|
52
|
-
"@tiptap/extension-mention": "^3.22.5",
|
|
53
|
-
"@tiptap/extension-paragraph": "^3.22.5",
|
|
54
|
-
"@tiptap/extension-placeholder": "^3.22.5",
|
|
55
|
-
"@tiptap/extension-text": "^3.22.5",
|
|
56
|
-
"@tiptap/extensions": "^3.22.5",
|
|
57
|
-
"@tiptap/pm": "^3.22.0",
|
|
58
|
-
"@tiptap/suggestion": "^3.22.5",
|
|
59
49
|
"react": ">=17.0.0 <20.0.0"
|
|
60
50
|
},
|
|
61
51
|
"dependencies": {
|
|
62
52
|
"@carbon/icon-helpers": "^10.47.0",
|
|
63
53
|
"@carbon/icons": "^11.53.0",
|
|
64
54
|
"@carbon/styles": "^1.106.0",
|
|
65
|
-
"@carbon/utilities": "^0.
|
|
55
|
+
"@carbon/utilities": "^0.24.0",
|
|
66
56
|
"@carbon/web-components": "^2.58.1",
|
|
67
57
|
"@codemirror/autocomplete": "^6.20.0",
|
|
68
58
|
"@codemirror/commands": "^6.10.1",
|
|
@@ -95,7 +85,17 @@
|
|
|
95
85
|
"@ibm/telemetry-js": "^1.10.2",
|
|
96
86
|
"@lezer/highlight": "^1.1.6",
|
|
97
87
|
"@lit/react": "^1.0.8",
|
|
98
|
-
"
|
|
88
|
+
"@tiptap/core": "^3.22.5",
|
|
89
|
+
"@tiptap/extension-document": "^3.22.5",
|
|
90
|
+
"@tiptap/extension-hard-break": "^3.22.5",
|
|
91
|
+
"@tiptap/extension-mention": "^3.22.5",
|
|
92
|
+
"@tiptap/extension-paragraph": "^3.22.5",
|
|
93
|
+
"@tiptap/extension-placeholder": "^3.22.5",
|
|
94
|
+
"@tiptap/extension-text": "^3.22.5",
|
|
95
|
+
"@tiptap/extensions": "^3.22.5",
|
|
96
|
+
"@tiptap/pm": "^3.22.5",
|
|
97
|
+
"@tiptap/suggestion": "^3.22.5",
|
|
98
|
+
"dompurify": "^3.4.13",
|
|
99
99
|
"lit": "^3.1.0",
|
|
100
100
|
"lodash-es": "^4.18.1",
|
|
101
101
|
"markdown-it": "^14.3.0",
|
|
@@ -127,16 +127,6 @@
|
|
|
127
127
|
"@storybook/addon-links": "^10.2.8",
|
|
128
128
|
"@storybook/react-vite": "^10.2.8",
|
|
129
129
|
"@storybook/web-components-vite": "^10.2.8",
|
|
130
|
-
"@tiptap/core": "^3.22.5",
|
|
131
|
-
"@tiptap/extension-document": "^3.22.5",
|
|
132
|
-
"@tiptap/extension-hard-break": "^3.22.5",
|
|
133
|
-
"@tiptap/extension-mention": "^3.22.5",
|
|
134
|
-
"@tiptap/extension-paragraph": "^3.22.5",
|
|
135
|
-
"@tiptap/extension-placeholder": "^3.22.5",
|
|
136
|
-
"@tiptap/extension-text": "^3.22.5",
|
|
137
|
-
"@tiptap/extensions": "^3.22.5",
|
|
138
|
-
"@tiptap/pm": "^3.22.5",
|
|
139
|
-
"@tiptap/suggestion": "^3.22.5",
|
|
140
130
|
"@types/jest": "^30.0.0",
|
|
141
131
|
"@types/markdown-it": "^14.1.2",
|
|
142
132
|
"@types/mocha": "^10.0.10",
|
|
@@ -169,5 +159,5 @@
|
|
|
169
159
|
"web-dev-server-plugin-lit-css": "^4.0.0",
|
|
170
160
|
"webpack-dev-server": "^5.2.5"
|
|
171
161
|
},
|
|
172
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "8c0dc69d44e90f93730cb052bfe9c5bfdf418c73"
|
|
173
163
|
}
|
package/telemetry.yml
CHANGED
|
@@ -18,7 +18,6 @@ collect:
|
|
|
18
18
|
- collapsible
|
|
19
19
|
- controlled
|
|
20
20
|
- disabled
|
|
21
|
-
- enable-send-button
|
|
22
21
|
- error-label
|
|
23
22
|
- error-message
|
|
24
23
|
- expand-label
|
|
@@ -63,21 +62,17 @@ collect:
|
|
|
63
62
|
- oncds-aichat-audio-player-ready
|
|
64
63
|
# cds-aichat-autocomplete
|
|
65
64
|
- attached
|
|
65
|
+
- disable-direct-send
|
|
66
66
|
- input-text
|
|
67
67
|
- oncds-aichat-autocomplete-dismiss
|
|
68
68
|
- oncds-aichat-autocomplete-select
|
|
69
69
|
- oncds-aichat-autocomplete-send
|
|
70
70
|
# cds-aichat-autocomplete-controller
|
|
71
71
|
- is-send-disabled
|
|
72
|
+
- oncds-aichat-autocomplete-item-selected
|
|
73
|
+
- oncds-aichat-autocomplete-item-send
|
|
72
74
|
- oncds-aichat-custom-list-render
|
|
73
75
|
- oncds-aichat-starter-selected
|
|
74
|
-
# cds-aichat-autocomplete-item
|
|
75
|
-
- index
|
|
76
|
-
- is-active
|
|
77
|
-
- oncds-aichat-autocomplete-item-send
|
|
78
|
-
# cds-aichat-autocomplete-item-group
|
|
79
|
-
- data-last-group
|
|
80
|
-
- oncds-aichat-autocomplete-item-click
|
|
81
76
|
# cds-aichat-button
|
|
82
77
|
- is-quick-action
|
|
83
78
|
# cds-aichat-card
|
|
@@ -221,6 +216,16 @@ collect:
|
|
|
221
216
|
- oncds-aichat-input-stop-streaming
|
|
222
217
|
- show-stop-streaming
|
|
223
218
|
- stop-response-label
|
|
219
|
+
# cds-aichat-launcher
|
|
220
|
+
- ai-enabled
|
|
221
|
+
- closed-label
|
|
222
|
+
- launcher-avatar-url
|
|
223
|
+
- oncds-aichat-launcher-toggle
|
|
224
|
+
- open-label
|
|
225
|
+
- show-unread-indicator
|
|
226
|
+
- tooltip-position
|
|
227
|
+
- unread-label
|
|
228
|
+
- unread-message-count
|
|
224
229
|
# cds-aichat-markdown
|
|
225
230
|
- code-snippet-aria-label-editable
|
|
226
231
|
- code-snippet-aria-label-readonly
|