@carbon/ai-chat-components 1.11.0 → 1.12.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +2358 -1973
- package/es/components/card/src/card-footer.scss.js +1 -1
- package/es/components/card/src/card-steps.scss.js +1 -1
- package/es/components/card/src/card.scss.js +1 -1
- package/es/components/chat-button/src/chat-button.scss.js +1 -1
- package/es/components/chat-history/src/history-panel-item-input.js +0 -1
- package/es/components/chat-history/src/history-panel-item-input.js.map +1 -1
- package/es/components/code-snippet/src/codemirror/language-controller.js +1 -1
- package/es/components/code-snippet/src/codemirror/language-controller.js.map +1 -1
- package/es/components/file-uploads/src/file-upload-item.d.ts +14 -1
- package/es/components/file-uploads/src/file-upload-item.js +78 -2
- package/es/components/file-uploads/src/file-upload-item.js.map +1 -1
- package/es/components/file-uploads/src/file-uploads.d.ts +29 -4
- package/es/components/file-uploads/src/file-uploads.js +69 -16
- package/es/components/file-uploads/src/file-uploads.js.map +1 -1
- package/es/components/launcher/src/launcher.scss.js +1 -1
- package/es/components/prompt-line/autocomplete/index.d.ts +1 -1
- package/es/components/prompt-line/autocomplete/src/autocomplete.d.ts +6 -0
- package/es/components/prompt-line/autocomplete/src/autocomplete.js +37 -11
- package/es/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
- package/es/components/prompt-line/index.d.ts +3 -2
- package/es/components/prompt-line/index.js +2 -1
- package/es/components/prompt-line/index.js.map +1 -1
- package/es/components/prompt-line/src/__tests__/wait-for-rich.d.ts +20 -0
- package/es/components/prompt-line/src/autocomplete-controller-element.d.ts +84 -0
- package/es/components/prompt-line/src/autocomplete-controller-element.js +262 -0
- package/es/components/prompt-line/src/autocomplete-controller-element.js.map +1 -0
- package/es/components/prompt-line/src/autocomplete-controller.d.ts +10 -69
- package/es/components/prompt-line/src/autocomplete-controller.js +57 -251
- package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js +3 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +0 -5
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line.js +1 -1
- package/es/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es/components/prompt-line/src/send-control.d.ts +7 -0
- package/es/components/prompt-line/src/send-control.js +53 -5
- package/es/components/prompt-line/src/send-control.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/build-extensions.js +1 -1
- 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 -6
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js +24 -48
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/carbon-mention.js +14 -48
- package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js +3 -4
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/keymap.d.ts +1 -1
- package/es/components/prompt-line/src/tiptap/keymap.js +3 -4
- package/es/components/prompt-line/src/tiptap/keymap.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/render-token-chip.js +0 -1
- package/es/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/resolve-config-items.d.ts +18 -0
- package/es/components/prompt-line/src/tiptap/resolve-config-items.js +32 -0
- package/es/components/prompt-line/src/tiptap/resolve-config-items.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/strip-presentation-fields.d.ts +18 -0
- package/es/components/prompt-line/src/tiptap/strip-presentation-fields.js +22 -0
- package/es/components/prompt-line/src/tiptap/strip-presentation-fields.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.d.ts +12 -8
- package/es/components/prompt-line/src/tiptap/trigger-utils.js +16 -1
- package/es/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/types.d.ts +11 -3
- package/es/components/toolbar/src/toolbar.d.ts +8 -0
- package/es/components/toolbar/src/toolbar.js +65 -19
- package/es/components/toolbar/src/toolbar.js.map +1 -1
- package/es/components/video-player/src/providers/vimeo-provider.js +1 -1
- package/es/components/video-player/src/providers/vimeo-provider.js.map +1 -1
- package/es/globals/decorators/carbon-element.js +2 -3
- package/es/globals/decorators/carbon-element.js.map +1 -1
- package/es/globals/utils/aria-announcer-manager.d.ts +56 -0
- package/es/globals/utils/aria-announcer-manager.js +46 -1
- package/es/globals/utils/aria-announcer-manager.js.map +1 -1
- package/es/globals/utils/focus-utils.js +1 -3
- package/es/globals/utils/focus-utils.js.map +1 -1
- package/es/globals/utils/iconTransform.d.ts +16 -2
- package/es/globals/utils/iconTransform.js +22 -1
- package/es/globals/utils/iconTransform.js.map +1 -1
- package/es/react/hooks/useChatAutocomplete.d.ts +5 -0
- package/es/react/hooks/useChatAutocomplete.js +26 -1
- package/es/react/hooks/useChatAutocomplete.js.map +1 -1
- package/es/react/markdown.js +0 -1
- package/es/react/markdown.js.map +1 -1
- package/es/typings/overflow-menu.d.ts +4 -0
- package/es-custom/components/card/src/card-footer.scss.js +1 -1
- package/es-custom/components/card/src/card-steps.scss.js +1 -1
- package/es-custom/components/card/src/card.scss.js +1 -1
- package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
- package/es-custom/components/chat-history/src/history-panel-item-input.js +0 -1
- package/es-custom/components/chat-history/src/history-panel-item-input.js.map +1 -1
- package/es-custom/components/code-snippet/src/codemirror/language-controller.js +1 -1
- package/es-custom/components/code-snippet/src/codemirror/language-controller.js.map +1 -1
- package/es-custom/components/file-uploads/src/file-upload-item.d.ts +14 -1
- package/es-custom/components/file-uploads/src/file-upload-item.js +78 -2
- package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -1
- package/es-custom/components/file-uploads/src/file-uploads.d.ts +29 -4
- package/es-custom/components/file-uploads/src/file-uploads.js +69 -16
- package/es-custom/components/file-uploads/src/file-uploads.js.map +1 -1
- package/es-custom/components/launcher/src/launcher.scss.js +1 -1
- package/es-custom/components/prompt-line/autocomplete/index.d.ts +1 -1
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.d.ts +6 -0
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js +37 -11
- package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
- package/es-custom/components/prompt-line/index.d.ts +3 -2
- package/es-custom/components/prompt-line/index.js +2 -1
- package/es-custom/components/prompt-line/index.js.map +1 -1
- package/es-custom/components/prompt-line/src/__tests__/wait-for-rich.d.ts +20 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller-element.d.ts +84 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller-element.js +262 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller-element.js.map +1 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.d.ts +10 -69
- package/es-custom/components/prompt-line/src/autocomplete-controller.js +57 -251
- package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +3 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +0 -5
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line.js +1 -1
- package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es-custom/components/prompt-line/src/send-control.d.ts +7 -0
- package/es-custom/components/prompt-line/src/send-control.js +53 -5
- package/es-custom/components/prompt-line/src/send-control.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js +1 -1
- 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 -6
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js +24 -48
- 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 +14 -48
- 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.js +3 -4
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/keymap.d.ts +1 -1
- package/es-custom/components/prompt-line/src/tiptap/keymap.js +3 -4
- package/es-custom/components/prompt-line/src/tiptap/keymap.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js +0 -1
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/resolve-config-items.d.ts +18 -0
- package/es-custom/components/prompt-line/src/tiptap/resolve-config-items.js +32 -0
- package/es-custom/components/prompt-line/src/tiptap/resolve-config-items.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.d.ts +18 -0
- package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.js +22 -0
- package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.d.ts +12 -8
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js +16 -1
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/types.d.ts +11 -3
- package/es-custom/components/toolbar/src/toolbar.d.ts +8 -0
- package/es-custom/components/toolbar/src/toolbar.js +65 -19
- package/es-custom/components/toolbar/src/toolbar.js.map +1 -1
- package/es-custom/components/video-player/src/providers/vimeo-provider.js +1 -1
- package/es-custom/components/video-player/src/providers/vimeo-provider.js.map +1 -1
- package/es-custom/globals/decorators/carbon-element.js +2 -3
- package/es-custom/globals/decorators/carbon-element.js.map +1 -1
- package/es-custom/globals/utils/aria-announcer-manager.d.ts +56 -0
- package/es-custom/globals/utils/aria-announcer-manager.js +46 -1
- package/es-custom/globals/utils/aria-announcer-manager.js.map +1 -1
- package/es-custom/globals/utils/focus-utils.js +1 -3
- package/es-custom/globals/utils/focus-utils.js.map +1 -1
- package/es-custom/globals/utils/iconTransform.d.ts +16 -2
- package/es-custom/globals/utils/iconTransform.js +22 -1
- package/es-custom/globals/utils/iconTransform.js.map +1 -1
- package/es-custom/react/hooks/useChatAutocomplete.d.ts +5 -0
- package/es-custom/react/hooks/useChatAutocomplete.js +26 -1
- package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -1
- package/es-custom/react/markdown.js +0 -1
- package/es-custom/react/markdown.js.map +1 -1
- package/es-custom/typings/overflow-menu.d.ts +4 -0
- package/package.json +6 -6
- package/scss/_custom-properties.scss +0 -17
- package/scss/_tokens-component.scss +1 -2
|
@@ -20,15 +20,15 @@ import { dispatchTriggerChange } from './trigger-utils.js';
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* `carbonAutocomplete` factory. Wraps `@tiptap/suggestion` directly (no
|
|
23
|
-
* Mention node)
|
|
24
|
-
* schema node. Activates whenever the input has any non-empty text (the
|
|
23
|
+
* Mention node). Activates whenever the input has any non-empty text (the
|
|
25
24
|
* legacy autocomplete contract).
|
|
26
25
|
*
|
|
27
26
|
* Dispatches `cds-aichat-trigger-change` with `type: "autocomplete"` from
|
|
28
27
|
* the suggestion-render lifecycle via the shared `dispatchTriggerChange`
|
|
29
|
-
* helper.
|
|
28
|
+
* helper. Selection is routed through `AutocompleteController.select()` —
|
|
29
|
+
* the `@tiptap/suggestion` `command` hook is intentionally unused.
|
|
30
30
|
*/
|
|
31
|
-
function carbonAutocomplete(
|
|
31
|
+
function carbonAutocomplete(excludeTriggers = []) {
|
|
32
32
|
const pluginKey = new PluginKey('carbonAutocompleteSuggestion');
|
|
33
33
|
return Extension.create({
|
|
34
34
|
name: 'carbonAutocomplete',
|
|
@@ -47,45 +47,35 @@ function carbonAutocomplete(config, excludeTriggers = []) {
|
|
|
47
47
|
if (!text || text.length === 0) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
|
-
// Restrict the query to the trailing word (split on whitespace).
|
|
51
|
-
const trailing = /\S+$/.exec(text);
|
|
52
|
-
if (!trailing) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
const query = trailing[0];
|
|
56
50
|
// Yield to co-installed mention/command extensions so they win
|
|
57
|
-
// when their trigger char is active.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
// when their trigger char is the active (trailing) word.
|
|
52
|
+
const trailing = /\S+$/.exec(text);
|
|
53
|
+
if (trailing) {
|
|
54
|
+
const trailingWord = trailing[0];
|
|
55
|
+
for (const excluded of excludeTriggers) {
|
|
56
|
+
if (!trailingWord.startsWith(excluded.char)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (excluded.position === 'anywhere') {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
// text matches an excluded trigger
|
|
63
|
+
if (text === trailingWord) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
// Use the full paragraph text as the query so spaces are included.
|
|
69
|
+
const matchStart = $position.start();
|
|
70
70
|
return {
|
|
71
71
|
range: {
|
|
72
72
|
from: matchStart,
|
|
73
73
|
to: $position.start() + $position.parentOffset,
|
|
74
74
|
},
|
|
75
|
-
query,
|
|
76
|
-
text
|
|
75
|
+
query: text,
|
|
76
|
+
text,
|
|
77
77
|
};
|
|
78
78
|
},
|
|
79
|
-
items: ({ query }) => resolveItems(config, query),
|
|
80
|
-
command: ({ editor: ed, range, props }) => {
|
|
81
|
-
const item = props;
|
|
82
|
-
const insertText = item.value ?? item.label;
|
|
83
|
-
ed.chain()
|
|
84
|
-
.focus()
|
|
85
|
-
.insertContentAt(range, [{ type: 'text', text: insertText }])
|
|
86
|
-
.run();
|
|
87
|
-
config.onSelect?.(item);
|
|
88
|
-
},
|
|
89
79
|
render: () => ({
|
|
90
80
|
onStart: (props) => {
|
|
91
81
|
lastQuery = props.query;
|
|
@@ -108,7 +98,7 @@ function carbonAutocomplete(config, excludeTriggers = []) {
|
|
|
108
98
|
},
|
|
109
99
|
onExit: (props) => {
|
|
110
100
|
lastQuery = null;
|
|
111
|
-
dispatchTriggerChange(props.editor, null);
|
|
101
|
+
dispatchTriggerChange(props.editor, null, 'autocomplete');
|
|
112
102
|
},
|
|
113
103
|
onKeyDown: () => false,
|
|
114
104
|
}),
|
|
@@ -117,20 +107,6 @@ function carbonAutocomplete(config, excludeTriggers = []) {
|
|
|
117
107
|
},
|
|
118
108
|
});
|
|
119
109
|
}
|
|
120
|
-
async function resolveItems(config, query) {
|
|
121
|
-
const minQueryLength = config.minQueryLength ?? 0;
|
|
122
|
-
if (query.length < minQueryLength) {
|
|
123
|
-
return [];
|
|
124
|
-
}
|
|
125
|
-
if (typeof config.items === 'function') {
|
|
126
|
-
return Promise.resolve(config.items(query));
|
|
127
|
-
}
|
|
128
|
-
if (!query) {
|
|
129
|
-
return config.items;
|
|
130
|
-
}
|
|
131
|
-
const lower = query.toLowerCase();
|
|
132
|
-
return config.items.filter((item) => item.label.toLowerCase().includes(lower));
|
|
133
|
-
}
|
|
134
110
|
|
|
135
111
|
export { carbonAutocomplete };
|
|
136
112
|
//# sourceMappingURL=carbon-autocomplete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbon-autocomplete.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-autocomplete.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 * `carbonAutocomplete` factory. Wraps `@tiptap/suggestion` directly (no\n * Mention node)
|
|
1
|
+
{"version":3,"file":"carbon-autocomplete.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-autocomplete.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 * `carbonAutocomplete` factory. Wraps `@tiptap/suggestion` directly (no\n * Mention node). Activates whenever the input has any non-empty text (the\n * legacy autocomplete contract).\n *\n * Dispatches `cds-aichat-trigger-change` with `type: \"autocomplete\"` from\n * the suggestion-render lifecycle via the shared `dispatchTriggerChange`\n * helper. Selection is routed through `AutocompleteController.select()` —\n * the `@tiptap/suggestion` `command` hook is intentionally unused.\n */\n\nimport { Extension } from '@tiptap/core';\nimport { PluginKey } from '@tiptap/pm/state';\nimport Suggestion from '@tiptap/suggestion';\n\nimport { dispatchTriggerChange } from './trigger-utils.js';\nimport type { SuggestionItem } from './types.js';\n\n/**\n * A trigger character that autocomplete stands down for, so a co-installed\n * mention or command picker wins while its trigger is active. Pass a list of\n * these as the only argument to {@link carbonAutocomplete}.\n */\nexport interface ExcludedTrigger {\n /** The character to stand down for, such as `\"@\"` or `\"/\"`. */\n char: string;\n /**\n * Where that character has to sit. `\"anywhere\"` stands down for any word\n * starting with it; `\"start\"` stands down only when that word starts the\n * line. Mirrors the picker's own\n * {@link TriggerSuggestionConfig.triggerPosition}.\n */\n position: 'anywhere' | 'start';\n}\n\nexport function carbonAutocomplete(\n excludeTriggers: ExcludedTrigger[] = []\n): Extension {\n const pluginKey = new PluginKey('carbonAutocompleteSuggestion');\n\n return Extension.create({\n name: 'carbonAutocomplete',\n\n addProseMirrorPlugins() {\n const editor = this.editor;\n let lastQuery: string | null = null;\n\n return [\n Suggestion<SuggestionItem>({\n editor,\n char: '',\n pluginKey,\n // Match any non-empty text as the autocomplete query.\n allowedPrefixes: null,\n findSuggestionMatch: ({ $position }) => {\n const text = $position.parent.textBetween(\n 0,\n $position.parentOffset,\n '\\n',\n '\\0'\n );\n if (!text || text.length === 0) {\n return null;\n }\n // Yield to co-installed mention/command extensions so they win\n // when their trigger char is the active (trailing) word.\n const trailing = /\\S+$/.exec(text);\n if (trailing) {\n const trailingWord = trailing[0];\n for (const excluded of excludeTriggers) {\n if (!trailingWord.startsWith(excluded.char)) {\n continue;\n }\n if (excluded.position === 'anywhere') {\n return null;\n }\n // text matches an excluded trigger\n if (text === trailingWord) {\n return null;\n }\n }\n }\n // Use the full paragraph text as the query so spaces are included.\n const matchStart = $position.start();\n return {\n range: {\n from: matchStart,\n to: $position.start() + $position.parentOffset,\n },\n query: text,\n text,\n };\n },\n render: () => ({\n onStart: (props) => {\n lastQuery = props.query;\n dispatchTriggerChange(props.editor, {\n type: 'autocomplete',\n query: props.query,\n triggerOffset: props.range.from,\n });\n },\n onUpdate: (props) => {\n if (props.query === lastQuery) {\n return;\n }\n lastQuery = props.query;\n dispatchTriggerChange(props.editor, {\n type: 'autocomplete',\n query: props.query,\n triggerOffset: props.range.from,\n });\n },\n onExit: (props) => {\n lastQuery = null;\n dispatchTriggerChange(props.editor, null, 'autocomplete');\n },\n onKeyDown: () => false,\n }),\n }),\n ];\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;AASG;AA0BG,SAAU,kBAAkB,CAChC,eAAA,GAAqC,EAAE,EAAA;AAEvC,IAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,8BAA8B,CAAC;IAE/D,OAAO,SAAS,CAAC,MAAM,CAAC;AACtB,QAAA,IAAI,EAAE,oBAAoB;QAE1B,qBAAqB,GAAA;AACnB,YAAA,MAAM,MAAM,GAAG,IAAI,C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,CAAC,KAAK,KAAI;AACjB,4BAAA,SAAS,GAAG,KAAK,CAAC,KAAK;AACvB,4BAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,EAAE;AAClC,gCAAA,IAAI,EAAE,cAAc;gCACpB,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,gCAAA,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;AAChC,6BAAA,CAAC;wBACJ,CAAC;AACD,wBAAA,QAAQ,EAAE,CAAC,KAAK,KAAI;AAClB,4BAAA,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE;gCAC7B;4BACF;AACA,4BAAA,SAAS,GAAG,KAAK,CAAC,KAAK;AACvB,4BAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,EAAE;AAClC,gCAAA,IAAI,EAAE,cAAc;gCACpB,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,gCAAA,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;AAChC,6BAAA,CAAC;wBACJ,CAAC;AACD,wBAAA,MAAM,EAAE,CAAC,KAAK,KAAI;4BAChB,SAAS,GAAG,IAAI;4BAChB,qBAAqB,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;wBAC3D,CAAC;AACD,wBAAA,SAAS,EAAE,MAAM,KAAK;qBACvB,CAAC;iBACH,CAAC;aACH;QACH,CAAC;AACF,KAAA,CAAC;AACJ;;"}
|
|
@@ -30,7 +30,11 @@ function buildTriggerExtension(config, build) {
|
|
|
30
30
|
...parent,
|
|
31
31
|
mentionSuggestionChar: { default: config.trigger },
|
|
32
32
|
value: { default: null },
|
|
33
|
-
|
|
33
|
+
// Host custom fields, held in editor state only: they survive the JSON
|
|
34
|
+
// round-trip, undo/redo, and moves within the document, and never
|
|
35
|
+
// reach HTML. Tiptap's default attribute rendering would stringify the
|
|
36
|
+
// object into the markup as "[object Object]".
|
|
37
|
+
data: { default: null, renderHTML: () => ({}) },
|
|
34
38
|
trigger: { default: null },
|
|
35
39
|
};
|
|
36
40
|
},
|
|
@@ -80,33 +84,6 @@ function buildTriggerExtension(config, build) {
|
|
|
80
84
|
char: config.trigger,
|
|
81
85
|
pluginKey,
|
|
82
86
|
startOfLine: config.triggerPosition === 'start',
|
|
83
|
-
items: ({ query }) => resolveItems(config, query),
|
|
84
|
-
command: ({ editor, range, props }) => {
|
|
85
|
-
const item = props;
|
|
86
|
-
// Insert the mention/command node with our extended attrs.
|
|
87
|
-
editor
|
|
88
|
-
.chain()
|
|
89
|
-
.focus()
|
|
90
|
-
.insertContentAt(range, [
|
|
91
|
-
{
|
|
92
|
-
type: name,
|
|
93
|
-
attrs: {
|
|
94
|
-
id: item.id,
|
|
95
|
-
label: item.label,
|
|
96
|
-
value: item.value ?? item.label,
|
|
97
|
-
// Item overrides config overrides the command/mention
|
|
98
|
-
// default (see resolveShowTriggerInChip).
|
|
99
|
-
trigger: resolveShowTriggerInChip(item, config, build.defaultName === 'command')
|
|
100
|
-
? config.trigger
|
|
101
|
-
: null,
|
|
102
|
-
data: stripPresentationFields(item),
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{ type: 'text', text: ' ' },
|
|
106
|
-
])
|
|
107
|
-
.run();
|
|
108
|
-
config.onSelect?.(item);
|
|
109
|
-
},
|
|
110
87
|
render: () => {
|
|
111
88
|
let lastQuery = null;
|
|
112
89
|
return {
|
|
@@ -122,7 +99,7 @@ function buildTriggerExtension(config, build) {
|
|
|
122
99
|
},
|
|
123
100
|
onExit: (props) => {
|
|
124
101
|
lastQuery = null;
|
|
125
|
-
dispatchTriggerChange(props.editor, null);
|
|
102
|
+
dispatchTriggerChange(props.editor, null, name);
|
|
126
103
|
},
|
|
127
104
|
onKeyDown: () => false,
|
|
128
105
|
};
|
|
@@ -168,7 +145,14 @@ function collectTokenAttrsById(doc, name) {
|
|
|
168
145
|
* `label`, `value`, and any custom fields stashed in `data` survive.
|
|
169
146
|
*/
|
|
170
147
|
function attrsToItem(attrs) {
|
|
171
|
-
|
|
148
|
+
// `data` holds whatever a caller put in the node's attrs, and
|
|
149
|
+
// `insertContent()` takes a raw node spec — so a host can land a string or
|
|
150
|
+
// an array here. Spreading either yields index keys ({...'abc'} → {0:'a'}),
|
|
151
|
+
// which would then reach onRemove as if the host had set them.
|
|
152
|
+
const raw = attrs.data;
|
|
153
|
+
const data = raw && typeof raw === 'object' && !Array.isArray(raw)
|
|
154
|
+
? raw
|
|
155
|
+
: {};
|
|
172
156
|
return {
|
|
173
157
|
...data,
|
|
174
158
|
id: String(attrs.id),
|
|
@@ -193,20 +177,6 @@ function diffRemovedTokens(before, after, name) {
|
|
|
193
177
|
}
|
|
194
178
|
return removed;
|
|
195
179
|
}
|
|
196
|
-
async function resolveItems(config, query) {
|
|
197
|
-
const minQueryLength = config.minQueryLength ?? 0;
|
|
198
|
-
if (query.length < minQueryLength) {
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
if (typeof config.items === 'function') {
|
|
202
|
-
return Promise.resolve(config.items(query));
|
|
203
|
-
}
|
|
204
|
-
if (!query) {
|
|
205
|
-
return config.items;
|
|
206
|
-
}
|
|
207
|
-
const lower = query.toLowerCase();
|
|
208
|
-
return config.items.filter((item) => item.label.toLowerCase().includes(lower));
|
|
209
|
-
}
|
|
210
180
|
/**
|
|
211
181
|
* Resolve whether a selected item's chip should be prefixed with the
|
|
212
182
|
* trigger character: the item's own {@link SuggestionItem.showTriggerInChip}
|
|
@@ -217,10 +187,6 @@ async function resolveItems(config, query) {
|
|
|
217
187
|
function resolveShowTriggerInChip(item, config, isCommand) {
|
|
218
188
|
return item.showTriggerInChip ?? config.showTriggerInChip ?? isCommand;
|
|
219
189
|
}
|
|
220
|
-
function stripPresentationFields(item) {
|
|
221
|
-
const { id: _id, label: _label, value: _value, avatar: _avatar, description: _description, disabled: _disabled, showTriggerInChip: _showTriggerInChip, ...rest } = item;
|
|
222
|
-
return rest;
|
|
223
|
-
}
|
|
224
190
|
function carbonMention(config) {
|
|
225
191
|
return buildTriggerExtension(config, {
|
|
226
192
|
defaultName: 'mention',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbon-mention.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-mention.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 * `carbonMention` and `carbonCommand` factories. Both wrap\n * `@tiptap/extension-mention` with carbon-specific:\n * - chip rendering via `CarbonTokenNodeView` (uses the light-DOM portal\n * handshake so React portal consumers render in light DOM).\n * - extra schema attrs (`value`, `data`, `trigger`) layered on top of\n * Mention's default `id` + `label`.\n * - direct `cds-aichat-trigger-change` dispatch from the suggestion-render\n * lifecycle via the shared `dispatchTriggerChange` helper.\n * - an `onRemove` callback fired when a user edit deletes a token node, the\n * mirror of the suggestion `onSelect` (see the removal ProseMirror plugin).\n *\n * They share an internal builder. The two exports differ only in their\n * default schema-node name (`\"mention\"` vs `\"command\"`), the dispatched\n * trigger type, the default chip color (handled inside the NodeView), and\n * the default for whether the trigger char is stored on inserted nodes —\n * `carbonCommand` defaults to on, `carbonMention` to off, so command chips\n * default to reading as `/summarize` while mention chips stay a bare name.\n * Either default can be overridden per-config (`TriggerSuggestionConfig.\n * showTriggerInChip`) or per-item (`SuggestionItem.showTriggerInChip`, which\n * wins when set — e.g. a single `@` picker mixing people and agents).\n * Each chat supports one mention trigger and one command trigger, because\n * Tiptap resolves extensions by name.\n */\n\nimport type { Editor, Range } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport type { Node as PMNode } from '@tiptap/pm/model';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\n\nimport { isHostOrigin } from './origin-meta.js';\nimport { CarbonTokenNodeView } from './token-node-view.js';\nimport { dispatchTriggerChange } from './trigger-utils.js';\nimport type { SuggestionItem, TriggerSuggestionConfig } from './types.js';\n\ninterface BuildOptions {\n defaultName: 'mention' | 'command';\n defaultPluginKeyName: string;\n}\n\nfunction buildTriggerExtension(\n config: TriggerSuggestionConfig,\n build: BuildOptions\n) {\n const name = build.defaultName;\n const pluginKey = new PluginKey(`${build.defaultPluginKeyName}_${name}`);\n\n return Mention.extend({\n name,\n\n addAttributes() {\n const parent = (this.parent?.() ?? {}) as Record<string, unknown>;\n return {\n ...parent,\n mentionSuggestionChar: { default: config.trigger },\n value: { default: null },\n data: { default: null },\n trigger: { default: null },\n };\n },\n\n addNodeView() {\n return ({ node, editor }) =>\n new CarbonTokenNodeView(node, editor.view, {\n renderCustomToken: config.renderCustomToken,\n });\n },\n\n addProseMirrorPlugins() {\n const parentPlugins = this.parent?.() ?? [];\n const onRemove = config.onRemove;\n if (!onRemove) {\n return parentPlugins;\n }\n\n // Fire `onRemove` once per token node of this type that leaves the doc\n // via a USER edit. `appendTransaction` records whether the batch was\n // host-origin — `some`, where typing-indicator uses `every` — and the\n // view's `update` runs the diff (after state is applied, so host\n // callbacks never re-enter `dispatch`). Host-origin batches — the\n // framework's post-send clear and any `getEditor()`/`updateContent`\n // mutation — are skipped, symmetric with `onSelect` firing only on user\n // popup selection.\n let lastBatchIsHost = false;\n\n const removalPlugin = new Plugin({\n key: new PluginKey(`${name}_removal`),\n appendTransaction(transactions) {\n lastBatchIsHost = transactions.some((tr) => isHostOrigin(tr));\n return null;\n },\n view: () => ({\n update(view, prevState) {\n if (view.state.doc === prevState.doc || lastBatchIsHost) {\n return;\n }\n const removed = diffRemovedTokens(\n prevState.doc,\n view.state.doc,\n name\n );\n for (const item of removed) {\n onRemove(item);\n }\n },\n }),\n });\n\n return [...parentPlugins, removalPlugin];\n },\n }).configure({\n HTMLAttributes: { 'data-token-type': name },\n suggestion: {\n char: config.trigger,\n pluginKey,\n startOfLine: config.triggerPosition === 'start',\n items: ({ query }) => resolveItems(config, query),\n command: ({ editor, range, props }) => {\n const item = props as SuggestionItem;\n // Insert the mention/command node with our extended attrs.\n editor\n .chain()\n .focus()\n .insertContentAt(range, [\n {\n type: name,\n attrs: {\n id: item.id,\n label: item.label,\n value: item.value ?? item.label,\n // Item overrides config overrides the command/mention\n // default (see resolveShowTriggerInChip).\n trigger: resolveShowTriggerInChip(\n item,\n config,\n build.defaultName === 'command'\n )\n ? config.trigger\n : null,\n data: stripPresentationFields(item),\n },\n },\n { type: 'text', text: ' ' },\n ])\n .run();\n config.onSelect?.(item);\n },\n render: () => {\n let lastQuery: string | null = null;\n return {\n onStart: (props) =>\n emitTrigger(props.editor, name, props.query, props.range, () => {\n lastQuery = props.query;\n }),\n onUpdate: (props) => {\n if (props.query === lastQuery) {\n return;\n }\n lastQuery = props.query;\n emitTrigger(props.editor, name, props.query, props.range);\n },\n onExit: (props) => {\n lastQuery = null;\n dispatchTriggerChange(props.editor, null);\n },\n onKeyDown: () => false,\n };\n },\n },\n });\n}\n\nfunction emitTrigger(\n editor: Editor,\n type: string,\n query: string,\n range: Range,\n postEmit?: () => void\n): void {\n dispatchTriggerChange(editor, {\n type,\n query,\n triggerOffset: range.from,\n });\n postEmit?.();\n}\n\n/**\n * Collect the attrs of every node named `name` in `doc`, grouped by id and\n * kept in document order, so a multiset diff can tell which specific node\n * instances were removed (duplicate chips with the same id are tracked by\n * count, not collapsed).\n */\nfunction collectTokenAttrsById(\n doc: PMNode,\n name: string\n): Map<string, Record<string, unknown>[]> {\n const byId = new Map<string, Record<string, unknown>[]>();\n doc.descendants((node) => {\n if (node.type.name !== name) {\n return;\n }\n const attrs = node.attrs as Record<string, unknown>;\n const id = String(attrs.id);\n const bucket = byId.get(id);\n if (bucket) {\n bucket.push(attrs);\n } else {\n byId.set(id, [attrs]);\n }\n });\n return byId;\n}\n\n/**\n * Reconstruct a {@link SuggestionItem} from a removed token node's attrs.\n * Presentation-only fields were stripped at insert time, so only `id`,\n * `label`, `value`, and any custom fields stashed in `data` survive.\n */\nfunction attrsToItem(attrs: Record<string, unknown>): SuggestionItem {\n const data = (attrs.data ?? {}) as Record<string, unknown>;\n return {\n ...data,\n id: String(attrs.id),\n label: attrs.label as string,\n value: (attrs.value ?? undefined) as string | undefined,\n };\n}\n\n/**\n * Diff token nodes named `name` between `before` and `after`, returning the\n * reconstructed items for each removed node instance (one entry per removed\n * duplicate).\n */\nfunction diffRemovedTokens(\n before: PMNode,\n after: PMNode,\n name: string\n): SuggestionItem[] {\n const beforeById = collectTokenAttrsById(before, name);\n const afterById = collectTokenAttrsById(after, name);\n const removed: SuggestionItem[] = [];\n for (const [id, beforeAttrs] of beforeById) {\n const afterCount = afterById.get(id)?.length ?? 0;\n for (let i = afterCount; i < beforeAttrs.length; i += 1) {\n removed.push(attrsToItem(beforeAttrs[i]));\n }\n }\n return removed;\n}\n\nasync function resolveItems(\n config: TriggerSuggestionConfig,\n query: string\n): Promise<SuggestionItem[]> {\n const minQueryLength = config.minQueryLength ?? 0;\n if (query.length < minQueryLength) {\n return [];\n }\n if (typeof config.items === 'function') {\n return Promise.resolve(config.items(query));\n }\n if (!query) {\n return config.items;\n }\n const lower = query.toLowerCase();\n return config.items.filter((item) =>\n item.label.toLowerCase().includes(lower)\n );\n}\n\n/**\n * Resolve whether a selected item's chip should be prefixed with the\n * trigger character: the item's own {@link SuggestionItem.showTriggerInChip}\n * wins when set, then the config's\n * {@link TriggerSuggestionConfig.showTriggerInChip}, then the\n * command/mention default.\n */\nexport function resolveShowTriggerInChip(\n item: SuggestionItem,\n config: Pick<TriggerSuggestionConfig, 'showTriggerInChip'>,\n isCommand: boolean\n): boolean {\n return item.showTriggerInChip ?? config.showTriggerInChip ?? isCommand;\n}\n\nfunction stripPresentationFields(\n item: SuggestionItem\n): Record<string, unknown> {\n const {\n id: _id,\n label: _label,\n value: _value,\n avatar: _avatar,\n description: _description,\n disabled: _disabled,\n showTriggerInChip: _showTriggerInChip,\n ...rest\n } = item;\n void _id;\n void _label;\n void _value;\n void _avatar;\n void _description;\n void _disabled;\n void _showTriggerInChip;\n return rest;\n}\n\nexport function carbonMention(config: TriggerSuggestionConfig) {\n return buildTriggerExtension(config, {\n defaultName: 'mention',\n defaultPluginKeyName: 'carbonMentionSuggestion',\n });\n}\n\nexport function carbonCommand(config: TriggerSuggestionConfig) {\n return buildTriggerExtension(config, {\n defaultName: 'command',\n defaultPluginKeyName: 'carbonCommandSuggestion',\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;AAOG;AA0CH,SAAS,qBAAqB,CAC5B,MAA+B,EAC/B,KAAmB,EAAA;AAEnB,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW;AAC9B,IAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,CAAA,EAAG,KAAK,CAAC,oBAAoB,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,CAAC;IAExE,OAAO,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI;QAEJ,aAAa,GAAA;YACX,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAA4B;YACjE,OAAO;AACL,gBAAA,GAAG,MAAM;AACT,gBAAA,qBAAqB,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;AAClD,gBAAA,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACxB,gBAAA,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACvB,gBAAA,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;aAC3B;QACH,CAAC;QAED,WAAW,GAAA;AACT,YAAA,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KACtB,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;gBACzC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;AAC5C,aAAA,CAAC;QACN,CAAC;QAED,qBAAqB,GAAA;YACnB,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;AAC3C,YAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ;YAChC,IAAI,CAAC,QA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AC,WAAW,EAAE;IACjC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAC9B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzC;AACH;AAEA;;;;;;AAMG;SACa,wBAAwB,CACtC,IAAoB,EACpB,MAA0D,EAC1D,SAAkB,EAAA;IAElB,OAAO,IAAI,CAAC,iBAAiB,IAAI,MAAM,CAAC,iBAAiB,IAAI,SAAS;AACxE;AAEA,SAAS,uBAAuB,CAC9B,IAAoB,EAAA;AAEpB,IAAA,MAAM,EACJ,EAAE,EAAE,GAAG,EACP,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,SAAS,EACnB,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,IAAI,EACR,GAAG,IAAI;AAQR,IAAA,OAAO,IAAI;AACb;AAEM,SAAU,aAAa,CAAC,MAA+B,EAAA;IAC3D,OAAO,qBAAqB,CAAC,MAAM,EAAE;AACnC,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,oBAAoB,EAAE,yBAAyB;AAChD,KAAA,CAAC;AACJ;AAEM,SAAU,aAAa,CAAC,MAA+B,EAAA;IAC3D,OAAO,qBAAqB,CAAC,MAAM,EAAE;AACnC,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,oBAAoB,EAAE,yBAAyB;AAChD,KAAA,CAAC;AACJ;;"}
|
|
1
|
+
{"version":3,"file":"carbon-mention.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-mention.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 * `carbonMention` and `carbonCommand` factories. Both wrap\n * `@tiptap/extension-mention` with carbon-specific:\n * - chip rendering via `CarbonTokenNodeView` (uses the light-DOM portal\n * handshake so React portal consumers render in light DOM).\n * - extra schema attrs (`value`, `data`, `trigger`) layered on top of\n * Mention's default `id` + `label`.\n * - direct `cds-aichat-trigger-change` dispatch from the suggestion-render\n * lifecycle via the shared `dispatchTriggerChange` helper.\n * - an `onRemove` callback fired when a user edit deletes a token node, the\n * mirror of the suggestion `onSelect` (see the removal ProseMirror plugin).\n *\n * They share an internal builder. The two exports differ only in their\n * default schema-node name (`\"mention\"` vs `\"command\"`), the dispatched\n * trigger type, the default chip color (handled inside the NodeView), and\n * the default for whether the trigger char is stored on inserted nodes —\n * `carbonCommand` defaults to on, `carbonMention` to off, so command chips\n * default to reading as `/summarize` while mention chips stay a bare name.\n * Either default can be overridden per-config (`TriggerSuggestionConfig.\n * showTriggerInChip`) or per-item (`SuggestionItem.showTriggerInChip`, which\n * wins when set — e.g. a single `@` picker mixing people and agents).\n * Each chat supports one mention trigger and one command trigger, because\n * Tiptap resolves extensions by name.\n */\n\nimport type { Editor, Range } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport type { Node as PMNode } from '@tiptap/pm/model';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\n\nimport { isHostOrigin } from './origin-meta.js';\nimport { CarbonTokenNodeView } from './token-node-view.js';\nimport { dispatchTriggerChange } from './trigger-utils.js';\nimport type { SuggestionItem, TriggerSuggestionConfig } from './types.js';\n\ninterface BuildOptions {\n defaultName: 'mention' | 'command';\n defaultPluginKeyName: string;\n}\n\nfunction buildTriggerExtension(\n config: TriggerSuggestionConfig,\n build: BuildOptions\n) {\n const name = build.defaultName;\n const pluginKey = new PluginKey(`${build.defaultPluginKeyName}_${name}`);\n\n return Mention.extend({\n name,\n\n addAttributes() {\n const parent = (this.parent?.() ?? {}) as Record<string, unknown>;\n return {\n ...parent,\n mentionSuggestionChar: { default: config.trigger },\n value: { default: null },\n // Host custom fields, held in editor state only: they survive the JSON\n // round-trip, undo/redo, and moves within the document, and never\n // reach HTML. Tiptap's default attribute rendering would stringify the\n // object into the markup as \"[object Object]\".\n data: { default: null, renderHTML: () => ({}) },\n trigger: { default: null },\n };\n },\n\n addNodeView() {\n return ({ node, editor }) =>\n new CarbonTokenNodeView(node, editor.view, {\n renderCustomToken: config.renderCustomToken,\n });\n },\n\n addProseMirrorPlugins() {\n const parentPlugins = this.parent?.() ?? [];\n const onRemove = config.onRemove;\n if (!onRemove) {\n return parentPlugins;\n }\n\n // Fire `onRemove` once per token node of this type that leaves the doc\n // via a USER edit. `appendTransaction` records whether the batch was\n // host-origin — `some`, where typing-indicator uses `every` — and the\n // view's `update` runs the diff (after state is applied, so host\n // callbacks never re-enter `dispatch`). Host-origin batches — the\n // framework's post-send clear and any `getEditor()`/`updateContent`\n // mutation — are skipped, symmetric with `onSelect` firing only on user\n // popup selection.\n let lastBatchIsHost = false;\n\n const removalPlugin = new Plugin({\n key: new PluginKey(`${name}_removal`),\n appendTransaction(transactions) {\n lastBatchIsHost = transactions.some((tr) => isHostOrigin(tr));\n return null;\n },\n view: () => ({\n update(view, prevState) {\n if (view.state.doc === prevState.doc || lastBatchIsHost) {\n return;\n }\n const removed = diffRemovedTokens(\n prevState.doc,\n view.state.doc,\n name\n );\n for (const item of removed) {\n onRemove(item);\n }\n },\n }),\n });\n\n return [...parentPlugins, removalPlugin];\n },\n }).configure({\n HTMLAttributes: { 'data-token-type': name },\n suggestion: {\n char: config.trigger,\n pluginKey,\n startOfLine: config.triggerPosition === 'start',\n render: () => {\n let lastQuery: string | null = null;\n return {\n onStart: (props) =>\n emitTrigger(props.editor, name, props.query, props.range, () => {\n lastQuery = props.query;\n }),\n onUpdate: (props) => {\n if (props.query === lastQuery) {\n return;\n }\n lastQuery = props.query;\n emitTrigger(props.editor, name, props.query, props.range);\n },\n onExit: (props) => {\n lastQuery = null;\n dispatchTriggerChange(props.editor, null, name);\n },\n onKeyDown: () => false,\n };\n },\n },\n });\n}\n\nfunction emitTrigger(\n editor: Editor,\n type: string,\n query: string,\n range: Range,\n postEmit?: () => void\n): void {\n dispatchTriggerChange(editor, {\n type,\n query,\n triggerOffset: range.from,\n });\n postEmit?.();\n}\n\n/**\n * Collect the attrs of every node named `name` in `doc`, grouped by id and\n * kept in document order, so a multiset diff can tell which specific node\n * instances were removed (duplicate chips with the same id are tracked by\n * count, not collapsed).\n */\nfunction collectTokenAttrsById(\n doc: PMNode,\n name: string\n): Map<string, Record<string, unknown>[]> {\n const byId = new Map<string, Record<string, unknown>[]>();\n doc.descendants((node) => {\n if (node.type.name !== name) {\n return;\n }\n const attrs = node.attrs as Record<string, unknown>;\n const id = String(attrs.id);\n const bucket = byId.get(id);\n if (bucket) {\n bucket.push(attrs);\n } else {\n byId.set(id, [attrs]);\n }\n });\n return byId;\n}\n\n/**\n * Reconstruct a {@link SuggestionItem} from a removed token node's attrs.\n * Presentation-only fields were stripped at insert time, so only `id`,\n * `label`, `value`, and any custom fields stashed in `data` survive.\n */\nfunction attrsToItem(attrs: Record<string, unknown>): SuggestionItem {\n // `data` holds whatever a caller put in the node's attrs, and\n // `insertContent()` takes a raw node spec — so a host can land a string or\n // an array here. Spreading either yields index keys ({...'abc'} → {0:'a'}),\n // which would then reach onRemove as if the host had set them.\n const raw = attrs.data;\n const data =\n raw && typeof raw === 'object' && !Array.isArray(raw)\n ? (raw as Record<string, unknown>)\n : {};\n return {\n ...data,\n id: String(attrs.id),\n label: attrs.label as string,\n value: (attrs.value ?? undefined) as string | undefined,\n };\n}\n\n/**\n * Diff token nodes named `name` between `before` and `after`, returning the\n * reconstructed items for each removed node instance (one entry per removed\n * duplicate).\n */\nfunction diffRemovedTokens(\n before: PMNode,\n after: PMNode,\n name: string\n): SuggestionItem[] {\n const beforeById = collectTokenAttrsById(before, name);\n const afterById = collectTokenAttrsById(after, name);\n const removed: SuggestionItem[] = [];\n for (const [id, beforeAttrs] of beforeById) {\n const afterCount = afterById.get(id)?.length ?? 0;\n for (let i = afterCount; i < beforeAttrs.length; i += 1) {\n removed.push(attrsToItem(beforeAttrs[i]));\n }\n }\n return removed;\n}\n\n/**\n * Resolve whether a selected item's chip should be prefixed with the\n * trigger character: the item's own {@link SuggestionItem.showTriggerInChip}\n * wins when set, then the config's\n * {@link TriggerSuggestionConfig.showTriggerInChip}, then the\n * command/mention default.\n */\nexport function resolveShowTriggerInChip(\n item: SuggestionItem,\n config: Pick<TriggerSuggestionConfig, 'showTriggerInChip'>,\n isCommand: boolean\n): boolean {\n return item.showTriggerInChip ?? config.showTriggerInChip ?? isCommand;\n}\n\nexport function carbonMention(config: TriggerSuggestionConfig) {\n return buildTriggerExtension(config, {\n defaultName: 'mention',\n defaultPluginKeyName: 'carbonMentionSuggestion',\n });\n}\n\nexport function carbonCommand(config: TriggerSuggestionConfig) {\n return buildTriggerExtension(config, {\n defaultName: 'command',\n defaultPluginKeyName: 'carbonCommandSuggestion',\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;AAOG;AA0CH,SAAS,qBAAqB,CAC5B,MAA+B,EAC/B,KAAmB,EAAA;AAEnB,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW;AAC9B,IAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,CAAA,EAAG,KAAK,CAAC,oBAAoB,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,CAAC;IAExE,OAAO,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI;QAEJ,aAAa,GAAA;YACX,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAA4B;YACjE,OAAO;AACL,gBAAA,GAAG,MAAM;AACT,gBAAA,qBAAqB,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;AAClD,gBAAA,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;;;;;AAKxB,gBAAA,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE;AAC/C,gBAAA,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EA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B,CAAC,KAAK,EAAE,IAAI,CAAC;IACpD,MAAM,OAAO,GAAqB,EAAE;IACpC,KAAK,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,UAAU,EAAE;AAC1C,QAAA,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC;AACjD,QAAA,KAAK,IAAI,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YACvD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C;IACF;AACA,IAAA,OAAO,OAAO;AAChB;AAEA;;;;;;AAMG;SACa,wBAAwB,CACtC,IAAoB,EACpB,MAA0D,EAC1D,SAAkB,EAAA;IAElB,OAAO,IAAI,CAAC,iBAAiB,IAAI,MAAM,CAAC,iBAAiB,IAAI,SAAS;AACxE;AAEM,SAAU,aAAa,CAAC,MAA+B,EAAA;IAC3D,OAAO,qBAAqB,CAAC,MAAM,EAAE;AACnC,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,oBAAoB,EAAE,yBAAyB;AAChD,KAAA,CAAC;AACJ;AAEM,SAAU,aAAa,CAAC,MAA+B,EAAA;IAC3D,OAAO,qBAAqB,CAAC,MAAM,EAAE;AACnC,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,oBAAoB,EAAE,yBAAyB;AAChD,KAAA,CAAC;AACJ;;"}
|
|
@@ -52,13 +52,12 @@ function writeStarterStorage(editor, patch) {
|
|
|
52
52
|
function carbonStarterTrigger(initialItems, initialIsOn = true) {
|
|
53
53
|
return Extension.create({
|
|
54
54
|
name: 'carbonStarterTrigger',
|
|
55
|
+
// Each editor gets fresh storage from here. Tiptap emits `create` a
|
|
56
|
+
// macrotask later, so resetting storage there would drop a write the host
|
|
57
|
+
// made in between.
|
|
55
58
|
addStorage() {
|
|
56
59
|
return { items: initialItems, isOn: initialIsOn };
|
|
57
60
|
},
|
|
58
|
-
onCreate() {
|
|
59
|
-
this.storage.items = initialItems;
|
|
60
|
-
this.storage.isOn = initialIsOn;
|
|
61
|
-
},
|
|
62
61
|
onUpdate() {
|
|
63
62
|
maybeEmit(this.editor);
|
|
64
63
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbon-starter-trigger.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-starter-trigger.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 * `carbonStarterTrigger` factory. Watches the editor's empty + focused +\n * editable state and emits `cds-aichat-trigger-change` with `type: \"starter\"`\n * via the shared `dispatchTriggerChange` helper.\n *\n * Items are stored on `extension.storage.items` so the prompt-line / shell\n * can swap the list at runtime without recreating the editor.\n */\n\nimport { Extension, type Editor } from '@tiptap/core';\n\nimport {\n dispatchTriggerChange,\n resetTriggerChangeState,\n} from './trigger-utils.js';\nimport type { SuggestionItem } from './types.js';\n\nexport interface StarterTriggerStorage {\n items: SuggestionItem[];\n isOn: boolean;\n}\n\n/** Read the starter trigger's live storage, or `undefined` if not installed. */\nexport function readStarterStorage(\n editor: Editor | null | undefined\n): StarterTriggerStorage | undefined {\n return (editor?.storage as unknown as Record<string, unknown> | undefined)\n ?.carbonStarterTrigger as StarterTriggerStorage | undefined;\n}\n\n/**\n * Apply a starter-config patch to the live editor. Starter differences never\n * justify recreating the editor — that would drop undo history — so they are\n * written in place. The empty transaction re-runs this extension's\n * `onTransaction` hook, so a toggle takes effect against the current selection\n * instead of waiting for the next keystroke. No-ops when nothing changed, so\n * callers do not have to guard.\n */\nexport function writeStarterStorage(\n editor: Editor | null | undefined,\n patch: Partial<StarterTriggerStorage>\n): void {\n const storage = readStarterStorage(editor);\n if (!editor || !storage) {\n return;\n }\n const entries = Object.entries(patch) as [\n keyof StarterTriggerStorage,\n StarterTriggerStorage[keyof StarterTriggerStorage],\n ][];\n if (entries.every(([key, value]) => storage[key] === value)) {\n return;\n }\n Object.assign(storage, patch);\n editor.view.dispatch(editor.state.tr);\n}\n\nexport function carbonStarterTrigger(\n initialItems: SuggestionItem[],\n initialIsOn = true\n): Extension {\n return Extension.create<unknown, StarterTriggerStorage>({\n name: 'carbonStarterTrigger',\n\n
|
|
1
|
+
{"version":3,"file":"carbon-starter-trigger.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-starter-trigger.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 * `carbonStarterTrigger` factory. Watches the editor's empty + focused +\n * editable state and emits `cds-aichat-trigger-change` with `type: \"starter\"`\n * via the shared `dispatchTriggerChange` helper.\n *\n * Items are stored on `extension.storage.items` so the prompt-line / shell\n * can swap the list at runtime without recreating the editor.\n */\n\nimport { Extension, type Editor } from '@tiptap/core';\n\nimport {\n dispatchTriggerChange,\n resetTriggerChangeState,\n} from './trigger-utils.js';\nimport type { SuggestionItem } from './types.js';\n\nexport interface StarterTriggerStorage {\n items: SuggestionItem[];\n isOn: boolean;\n}\n\n/** Read the starter trigger's live storage, or `undefined` if not installed. */\nexport function readStarterStorage(\n editor: Editor | null | undefined\n): StarterTriggerStorage | undefined {\n return (editor?.storage as unknown as Record<string, unknown> | undefined)\n ?.carbonStarterTrigger as StarterTriggerStorage | undefined;\n}\n\n/**\n * Apply a starter-config patch to the live editor. Starter differences never\n * justify recreating the editor — that would drop undo history — so they are\n * written in place. The empty transaction re-runs this extension's\n * `onTransaction` hook, so a toggle takes effect against the current selection\n * instead of waiting for the next keystroke. No-ops when nothing changed, so\n * callers do not have to guard.\n */\nexport function writeStarterStorage(\n editor: Editor | null | undefined,\n patch: Partial<StarterTriggerStorage>\n): void {\n const storage = readStarterStorage(editor);\n if (!editor || !storage) {\n return;\n }\n const entries = Object.entries(patch) as [\n keyof StarterTriggerStorage,\n StarterTriggerStorage[keyof StarterTriggerStorage],\n ][];\n if (entries.every(([key, value]) => storage[key] === value)) {\n return;\n }\n Object.assign(storage, patch);\n editor.view.dispatch(editor.state.tr);\n}\n\nexport function carbonStarterTrigger(\n initialItems: SuggestionItem[],\n initialIsOn = true\n): Extension {\n return Extension.create<unknown, StarterTriggerStorage>({\n name: 'carbonStarterTrigger',\n\n // Each editor gets fresh storage from here. Tiptap emits `create` a\n // macrotask later, so resetting storage there would drop a write the host\n // made in between.\n addStorage() {\n return { items: initialItems, isOn: initialIsOn };\n },\n\n onUpdate() {\n maybeEmit(this.editor);\n },\n\n onTransaction() {\n if (this.editor.isFocused) {\n maybeEmit(this.editor);\n }\n },\n\n onFocus({ editor }) {\n maybeEmit(editor);\n },\n\n onBlur({ editor }) {\n // Clear coalescing state on blur so the next focus can re-emit the\n // starter trigger even if the detail hasn't changed (e.g. after the\n // send button was clicked, which uses keepCoalesced: true on dismiss).\n resetTriggerChangeState(editor);\n },\n });\n}\n\nfunction maybeEmit(editor: Editor): void {\n const storage = readStarterStorage(editor);\n const isActive =\n storage?.isOn !== false &&\n (storage?.items.length ?? 0) > 0 &&\n editor.isEditable &&\n editor.isFocused &&\n editor.isEmpty;\n if (!isActive) {\n dispatchTriggerChange(editor, null);\n return;\n }\n dispatchTriggerChange(editor, {\n type: 'starter',\n query: '',\n triggerOffset: 0,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;AAOG;AAeH;AACM,SAAU,kBAAkB,CAChC,MAAiC,EAAA;IAEjC,OAAQ,MAAM,EAAE;AACd,UAAE,oBAAyD;AAC/D;AAEA;;;;;;;AAOG;AACG,SAAU,mBAAmB,CACjC,MAAiC,EACjC,KAAqC,EAAA;AAErC,IAAA,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC;AAC1C,IAAA,IAAI,CAAC,MAAM,IAAI,CAA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C,QAAA,MAAM,CAAC,UAAU;AACjB,QAAA,MAAM,CAAC,SAAS;QAChB,MAAM,CAAC,OAAO;IAChB,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC;QACnC;IACF;IACA,qBAAqB,CAAC,MAAM,EAAE;AAC5B,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,aAAa,EAAE,CAAC;AACjB,KAAA,CAAC;AACJ;;"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - `Mod-Enter` → emit `cds-aichat-prompt-send-intent`. The shell decides
|
|
13
13
|
* whether to honor (re-dispatch as `cds-aichat-input-send`) or gate
|
|
14
14
|
* (`isSendDisabled` per PLAN.md decision 19).
|
|
15
|
-
* - `Escape` →
|
|
15
|
+
* - `Escape` → no-op (returns `false`; host `<dialog>`/`Modal` sees it).
|
|
16
16
|
* - Plain `Enter` is not bound here. `<cds-aichat-prompt-line>` adds
|
|
17
17
|
* `carbonChatEnter` to its base bundle for "Enter sends, Shift-Enter
|
|
18
18
|
* newlines"; this extension stays Enter-agnostic so it can be reused on its
|
|
@@ -21,7 +21,7 @@ import { Extension } from '@tiptap/core';
|
|
|
21
21
|
* - `Mod-Enter` → emit `cds-aichat-prompt-send-intent`. The shell decides
|
|
22
22
|
* whether to honor (re-dispatch as `cds-aichat-input-send`) or gate
|
|
23
23
|
* (`isSendDisabled` per PLAN.md decision 19).
|
|
24
|
-
* - `Escape` →
|
|
24
|
+
* - `Escape` → no-op (returns `false`; host `<dialog>`/`Modal` sees it).
|
|
25
25
|
* - Plain `Enter` is not bound here. `<cds-aichat-prompt-line>` adds
|
|
26
26
|
* `carbonChatEnter` to its base bundle for "Enter sends, Shift-Enter
|
|
27
27
|
* newlines"; this extension stays Enter-agnostic so it can be reused on its
|
|
@@ -47,9 +47,8 @@ const Keymap = Extension.create({
|
|
|
47
47
|
}));
|
|
48
48
|
return true;
|
|
49
49
|
},
|
|
50
|
-
Escape: (
|
|
51
|
-
|
|
52
|
-
return true;
|
|
50
|
+
Escape: () => {
|
|
51
|
+
return false;
|
|
53
52
|
},
|
|
54
53
|
};
|
|
55
54
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.js","sources":["../../../../../src/components/prompt-line/src/tiptap/keymap.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 * Tiptap keymap extension for the prompt-line.\n *\n * - `Mod-Enter` → emit `cds-aichat-prompt-send-intent`. The shell decides\n * whether to honor (re-dispatch as `cds-aichat-input-send`) or gate\n * (`isSendDisabled` per PLAN.md decision 19).\n * - `Escape` →
|
|
1
|
+
{"version":3,"file":"keymap.js","sources":["../../../../../src/components/prompt-line/src/tiptap/keymap.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 * Tiptap keymap extension for the prompt-line.\n *\n * - `Mod-Enter` → emit `cds-aichat-prompt-send-intent`. The shell decides\n * whether to honor (re-dispatch as `cds-aichat-input-send`) or gate\n * (`isSendDisabled` per PLAN.md decision 19).\n * - `Escape` → no-op (returns `false`; host `<dialog>`/`Modal` sees it).\n * - Plain `Enter` is not bound here. `<cds-aichat-prompt-line>` adds\n * `carbonChatEnter` to its base bundle for \"Enter sends, Shift-Enter\n * newlines\"; this extension stays Enter-agnostic so it can be reused on its\n * own.\n *\n * Undo / redo come from the `UndoRedo` extension. ArrowUp / ArrowDown /\n * Enter / Escape forwarding to the active autocomplete list is **not** done\n * here — the `AutocompleteController` (see ../autocomplete-controller.ts)\n * installs its own capture-phase keydown listener on the editor view DOM\n * when a trigger is active and a list element is registered, and\n * re-dispatches those keys on the list. The Tiptap suggestion factories\n * (`carbonMention`, `carbonAutocomplete`) deliberately return `false` from\n * `onKeyDown` so they don't consume those keys either.\n */\n\nimport { Extension } from '@tiptap/core';\n\nexport const Keymap = Extension.create({\n name: 'carbonChatKeymap',\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Enter': ({ editor }) => {\n editor.view.dom.dispatchEvent(\n new CustomEvent('cds-aichat-prompt-send-intent', {\n bubbles: true,\n composed: true,\n })\n );\n return true;\n },\n Escape: () => {\n return false;\n },\n };\n },\n});\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;;;;;;;AAoBG;AAII,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AACrC,IAAA,IAAI,EAAE,kBAAkB;IAExB,oBAAoB,GAAA;QAClB,OAAO;AACL,YAAA,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAI;gBAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAC3B,IAAI,WAAW,CAAC,+BAA+B,EAAE;AAC/C,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,QAAQ,EAAE,IAAI;AACf,iBAAA,CAAC,CACH;AACD,gBAAA,OAAO,IAAI;YACb,CAAC;YACD,MAAM,EAAE,MAAK;AACX,gBAAA,OAAO,KAAK;YACd,CAAC;SACF;IACH,CAAC;AACF,CAAA;;"}
|
|
@@ -48,7 +48,6 @@ function renderTokenChip(args) {
|
|
|
48
48
|
result = renderer(item);
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
|
-
// eslint-disable-next-line no-console
|
|
52
51
|
console.error('Error in renderCustomToken, falling back to default chip:', error);
|
|
53
52
|
dom.appendChild(createDefaultChip(args.attrs));
|
|
54
53
|
return dom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-token-chip.js","sources":["../../../../../src/components/prompt-line/src/tiptap/render-token-chip.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 * Shared chip-rendering implementation used by both the editor's\n * `CarbonTokenNodeView` and the chat-side rich user message bubble. Builds\n * the wrapping `<span class=\"cds-aichat--token\">` container, honors a\n * consumer-supplied `renderCustomToken`, and delegates the light-DOM portal\n * handshake to `renderInLightDom` so React adapters can hydrate custom chip\n * content. This is a thin token-specific wrapper over `renderInLightDom`.\n */\n\nimport type { ReactNode } from 'react';\n\nimport { setVarsForSelector } from '../../../shared/dynamic-css-var-sheet.js';\nimport { renderInLightDom } from './render-in-light-dom.js';\nimport type { SuggestionItem, TriggerSuggestionConfig } from './types.js';\n\nlet tokenStyleRulesInstalled = false;\n\nfunction ensureTokenStyleRules(): void {\n if (tokenStyleRulesInstalled) {\n return;\n }\n setVarsForSelector('.cds-aichat--token', { 'white-space': 'normal' });\n setVarsForSelector('.cds-aichat--token[data-token-context=\"composer\"]', {\n color: 'var(--cds-tag-color-blue, #0043ce)',\n });\n setVarsForSelector(\n '.cds-aichat--token[data-token-context=\"composer\"]::selection',\n { 'background-color': 'var(--cds-tag-background-blue, #d0e2ff)' }\n );\n setVarsForSelector('.cds-aichat--token[data-token-context=\"historical\"]', {\n color: 'var(--cds-link-secondary, #0043ce)',\n });\n tokenStyleRulesInstalled = true;\n}\n\n/**\n * Attributes carried by a mention/command JSONContent node. Matches the\n * Tiptap mention shape (`id`, `label`) plus the carbon-specific `value`,\n * `data`, and `trigger` extensions added by `carbonMention`/`carbonCommand`.\n */\nexport interface TokenChipAttrs {\n /** Identifier of the item the chip came from. */\n id?: string;\n /** Text shown on the chip. */\n label?: string;\n /**\n * String the chip contributes to the message text. Falls back to `label`\n * when unset.\n */\n value?: string;\n /**\n * Custom fields carried over from the selected item. Everything the\n * suggestion item held beyond `id`, `label`, `value`, `avatar`,\n * `description`, `disabled`, and `showTriggerInChip` lands here, so it\n * survives a round trip through the editor's JSON.\n */\n data?: unknown;\n /**\n * Trigger character to prefix onto the default chip text (e.g.\n * `/summarize` vs `summarize`). Set at insert time by\n * `resolveShowTriggerInChip` — defaults to command nodes only, but is\n * overridable per-config or per-item via `TriggerSuggestionConfig`/\n * `SuggestionItem`'s `showTriggerInChip`.\n */\n trigger?: string | null;\n}\n\nexport interface RenderTokenChipArgs {\n /** Node attrs in mention shape. */\n attrs: TokenChipAttrs;\n /**\n * Subset of the trigger-suggestion config relevant to chip rendering. Only\n * `renderCustomToken` is read; other config fields are ignored.\n */\n config?: Pick<TriggerSuggestionConfig, 'renderCustomToken'>;\n /** Token type — usually `\"mention\"` or `\"command\"`. */\n type: 'mention' | 'command' | string;\n /**\n * Where to dispatch the light-DOM portal event when `renderCustomToken`\n * returns custom content. The NodeView passes the editor's `view.dom`\n * (already mounted under the chat wrapper) so the event reaches the portal\n * listener synchronously. When omitted, the event fires from the portal\n * container element itself with `bubbles: true, composed: true` — callers\n * that mount the chip lazily must ensure it lives under a listener subtree\n * before connection.\n */\n dispatchTarget?: EventTarget;\n /**\n * Visual variant to render. `\"composer\"` is the live, being-typed token in\n * the prompt-line editor; `\"historical\"` is a token inside an already-sent\n * message in the transcript. Drives the default chip's color/highlight —\n * see `ensureTokenStyleRules`.\n */\n context: 'composer' | 'historical';\n}\n\nexport function renderTokenChip(args: RenderTokenChipArgs): HTMLElement {\n const dom = createTokenContainer(args.attrs, args.type, args.context);\n const renderer = args.config?.renderCustomToken;\n\n if (!renderer) {\n dom.appendChild(createDefaultChip(args.attrs));\n return dom;\n }\n\n const item: SuggestionItem = {\n id: typeof args.attrs.id === 'string' ? args.attrs.id : '',\n label: typeof args.attrs.label === 'string' ? args.attrs.label : '',\n ...((args.attrs.data ?? {}) as Record<string, unknown>),\n };\n\n let result: HTMLElement | ReactNode | undefined;\n try {\n result = renderer(item);\n } catch (error) {\n
|
|
1
|
+
{"version":3,"file":"render-token-chip.js","sources":["../../../../../src/components/prompt-line/src/tiptap/render-token-chip.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 * Shared chip-rendering implementation used by both the editor's\n * `CarbonTokenNodeView` and the chat-side rich user message bubble. Builds\n * the wrapping `<span class=\"cds-aichat--token\">` container, honors a\n * consumer-supplied `renderCustomToken`, and delegates the light-DOM portal\n * handshake to `renderInLightDom` so React adapters can hydrate custom chip\n * content. This is a thin token-specific wrapper over `renderInLightDom`.\n */\n\nimport type { ReactNode } from 'react';\n\nimport { setVarsForSelector } from '../../../shared/dynamic-css-var-sheet.js';\nimport { renderInLightDom } from './render-in-light-dom.js';\nimport type { SuggestionItem, TriggerSuggestionConfig } from './types.js';\n\nlet tokenStyleRulesInstalled = false;\n\nfunction ensureTokenStyleRules(): void {\n if (tokenStyleRulesInstalled) {\n return;\n }\n setVarsForSelector('.cds-aichat--token', { 'white-space': 'normal' });\n setVarsForSelector('.cds-aichat--token[data-token-context=\"composer\"]', {\n color: 'var(--cds-tag-color-blue, #0043ce)',\n });\n setVarsForSelector(\n '.cds-aichat--token[data-token-context=\"composer\"]::selection',\n { 'background-color': 'var(--cds-tag-background-blue, #d0e2ff)' }\n );\n setVarsForSelector('.cds-aichat--token[data-token-context=\"historical\"]', {\n color: 'var(--cds-link-secondary, #0043ce)',\n });\n tokenStyleRulesInstalled = true;\n}\n\n/**\n * Attributes carried by a mention/command JSONContent node. Matches the\n * Tiptap mention shape (`id`, `label`) plus the carbon-specific `value`,\n * `data`, and `trigger` extensions added by `carbonMention`/`carbonCommand`.\n */\nexport interface TokenChipAttrs {\n /** Identifier of the item the chip came from. */\n id?: string;\n /** Text shown on the chip. */\n label?: string;\n /**\n * String the chip contributes to the message text. Falls back to `label`\n * when unset.\n */\n value?: string;\n /**\n * Custom fields carried over from the selected item. Everything the\n * suggestion item held beyond `id`, `label`, `value`, `avatar`,\n * `description`, `disabled`, and `showTriggerInChip` lands here, so it\n * survives a round trip through the editor's JSON.\n */\n data?: unknown;\n /**\n * Trigger character to prefix onto the default chip text (e.g.\n * `/summarize` vs `summarize`). Set at insert time by\n * `resolveShowTriggerInChip` — defaults to command nodes only, but is\n * overridable per-config or per-item via `TriggerSuggestionConfig`/\n * `SuggestionItem`'s `showTriggerInChip`.\n */\n trigger?: string | null;\n}\n\nexport interface RenderTokenChipArgs {\n /** Node attrs in mention shape. */\n attrs: TokenChipAttrs;\n /**\n * Subset of the trigger-suggestion config relevant to chip rendering. Only\n * `renderCustomToken` is read; other config fields are ignored.\n */\n config?: Pick<TriggerSuggestionConfig, 'renderCustomToken'>;\n /** Token type — usually `\"mention\"` or `\"command\"`. */\n type: 'mention' | 'command' | string;\n /**\n * Where to dispatch the light-DOM portal event when `renderCustomToken`\n * returns custom content. The NodeView passes the editor's `view.dom`\n * (already mounted under the chat wrapper) so the event reaches the portal\n * listener synchronously. When omitted, the event fires from the portal\n * container element itself with `bubbles: true, composed: true` — callers\n * that mount the chip lazily must ensure it lives under a listener subtree\n * before connection.\n */\n dispatchTarget?: EventTarget;\n /**\n * Visual variant to render. `\"composer\"` is the live, being-typed token in\n * the prompt-line editor; `\"historical\"` is a token inside an already-sent\n * message in the transcript. Drives the default chip's color/highlight —\n * see `ensureTokenStyleRules`.\n */\n context: 'composer' | 'historical';\n}\n\nexport function renderTokenChip(args: RenderTokenChipArgs): HTMLElement {\n const dom = createTokenContainer(args.attrs, args.type, args.context);\n const renderer = args.config?.renderCustomToken;\n\n if (!renderer) {\n dom.appendChild(createDefaultChip(args.attrs));\n return dom;\n }\n\n const item: SuggestionItem = {\n id: typeof args.attrs.id === 'string' ? args.attrs.id : '',\n label: typeof args.attrs.label === 'string' ? args.attrs.label : '',\n ...((args.attrs.data ?? {}) as Record<string, unknown>),\n };\n\n let result: HTMLElement | ReactNode | undefined;\n try {\n result = renderer(item);\n } catch (error) {\n console.error(\n 'Error in renderCustomToken, falling back to default chip:',\n error\n );\n dom.appendChild(createDefaultChip(args.attrs));\n return dom;\n }\n\n if (result == null) {\n dom.appendChild(createDefaultChip(args.attrs));\n return dom;\n }\n\n // Bridge the custom chip into the page's light DOM via the shared portal\n // handshake. The default chip rides along as the `<slot>` fallback so the\n // token still shows something until the portal commits.\n const { container } = renderInLightDom({\n content: result,\n dispatchTarget: args.dispatchTarget ?? dom,\n fallback: createDefaultChip(args.attrs),\n });\n dom.appendChild(container);\n\n return dom;\n}\n\nfunction createTokenContainer(\n attrs: TokenChipAttrs,\n type: string,\n context: 'composer' | 'historical'\n): HTMLElement {\n ensureTokenStyleRules();\n const dom = document.createElement('span');\n const value = typeof attrs.value === 'string' ? attrs.value : null;\n const label = typeof attrs.label === 'string' ? attrs.label : null;\n dom.setAttribute('contenteditable', 'false');\n dom.setAttribute('data-token-type', type);\n dom.setAttribute('data-token-context', context);\n dom.setAttribute('data-raw-value', value ?? label ?? '');\n dom.className = 'cds-aichat--token';\n return dom;\n}\n\nfunction createDefaultChip(attrs: TokenChipAttrs): HTMLElement {\n const chip = document.createElement('span');\n const label = typeof attrs.label === 'string' ? attrs.label : null;\n const value = typeof attrs.value === 'string' ? attrs.value : null;\n const trigger = typeof attrs.trigger === 'string' ? attrs.trigger : '';\n chip.textContent = `${trigger}${label || value || ''}`;\n return chip;\n}\n"],"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,oCAAoC;AAC5C,KAAA,CAAC;IACF,kBAAkB,CAChB,8DAA8D,EAC9D,EAAE,kBAAkB,EAAE,yCAAyC,EAAE,CAClE;IACD,kBAAkB,CAAC,qDAAqD,EAAE;AACxE,QAAA,KAAK,EAAE,oCAAoC;AAC5C,KAAA,CAAC;IACF,wBAAwB,GAAG,IAAI;AACjC;AA+D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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;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
* Shared resolver for BaseSuggestionConfig items: applies minQueryLength
|
|
11
|
+
* gating, delegates to the async function or filters the static array.
|
|
12
|
+
* Used by AutocompleteController — the canonical resolution path.
|
|
13
|
+
*/
|
|
14
|
+
import type { SuggestionItem } from './types.js';
|
|
15
|
+
export declare function resolveConfigItems(config: {
|
|
16
|
+
items: SuggestionItem[] | ((query: string) => Promise<SuggestionItem[]> | SuggestionItem[]);
|
|
17
|
+
minQueryLength?: number;
|
|
18
|
+
}, query: string): Promise<SuggestionItem[]>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*
|
|
11
|
+
* Copyright IBM Corp. 2026
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
async function resolveConfigItems(config, query) {
|
|
17
|
+
const minQueryLength = config.minQueryLength ?? 0;
|
|
18
|
+
if (query.length < minQueryLength) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
if (typeof config.items === 'function') {
|
|
22
|
+
return await Promise.resolve(config.items(query));
|
|
23
|
+
}
|
|
24
|
+
if (!query) {
|
|
25
|
+
return config.items;
|
|
26
|
+
}
|
|
27
|
+
const lower = query.toLowerCase();
|
|
28
|
+
return config.items.filter((item) => item.label.toLowerCase().includes(lower));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { resolveConfigItems };
|
|
32
|
+
//# sourceMappingURL=resolve-config-items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-config-items.js","sources":["../../../../../src/components/prompt-line/src/tiptap/resolve-config-items.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 * Shared resolver for BaseSuggestionConfig items: applies minQueryLength\n * gating, delegates to the async function or filters the static array.\n * Used by AutocompleteController — the canonical resolution path.\n */\n\nimport type { SuggestionItem } from './types.js';\n\nexport async function resolveConfigItems(\n config: {\n items:\n | SuggestionItem[]\n | ((query: string) => Promise<SuggestionItem[]> | SuggestionItem[]);\n minQueryLength?: number;\n },\n query: string\n): Promise<SuggestionItem[]> {\n const minQueryLength = config.minQueryLength ?? 0;\n if (query.length < minQueryLength) {\n return [];\n }\n if (typeof config.items === 'function') {\n return await Promise.resolve(config.items(query));\n }\n if (!query) {\n return config.items;\n }\n const lower = query.toLowerCase();\n return config.items.filter((item) =>\n item.label.toLowerCase().includes(lower)\n );\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAUI,eAAe,kBAAkB,CACtC,MAKC,EACD,KAAa,EAAA;AAEb,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC;AACjD,IAAA,IAAI,KAAK,CAAC,MAAM,GAAG,cAAc,EAAE;AACjC,QAAA,OAAO,EAAE;IACX;AACA,IAAA,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU,EAAE;AACtC,QAAA,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnD;IACA,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,MAAM,CAAC,KAAK;IACrB;AACA,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE;IACjC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAC9B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzC;AACH;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
* Drops the fields a chip renders from its own attrs: `id`, `label`, `value`,
|
|
11
|
+
* and the presentation-only `avatar`, `description`, `disabled`, and
|
|
12
|
+
* `showTriggerInChip`. Grouping metadata (`groupId`, `groupTitle`) survives,
|
|
13
|
+
* matching what `TriggerSuggestionConfig.onRemove` documents as retained.
|
|
14
|
+
* Used by AutocompleteController at insert time to fill the token node's
|
|
15
|
+
* `data` attr, so `onRemove` can hand those fields back.
|
|
16
|
+
*/
|
|
17
|
+
import type { SuggestionItem } from './types.js';
|
|
18
|
+
export declare function stripPresentationFields(item: SuggestionItem): Record<string, unknown>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*
|
|
11
|
+
* Copyright IBM Corp. 2026
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
function stripPresentationFields(item) {
|
|
17
|
+
const { id: _id, label: _label, value: _value, avatar: _avatar, description: _description, disabled: _disabled, showTriggerInChip: _showTriggerInChip, ...rest } = item;
|
|
18
|
+
return rest;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { stripPresentationFields };
|
|
22
|
+
//# sourceMappingURL=strip-presentation-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-presentation-fields.js","sources":["../../../../../src/components/prompt-line/src/tiptap/strip-presentation-fields.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 * Drops the fields a chip renders from its own attrs: `id`, `label`, `value`,\n * and the presentation-only `avatar`, `description`, `disabled`, and\n * `showTriggerInChip`. Grouping metadata (`groupId`, `groupTitle`) survives,\n * matching what `TriggerSuggestionConfig.onRemove` documents as retained.\n * Used by AutocompleteController at insert time to fill the token node's\n * `data` attr, so `onRemove` can hand those fields back.\n */\n\nimport type { SuggestionItem } from './types.js';\n\nexport function stripPresentationFields(\n item: SuggestionItem\n): Record<string, unknown> {\n const {\n id: _id,\n label: _label,\n value: _value,\n avatar: _avatar,\n description: _description,\n disabled: _disabled,\n showTriggerInChip: _showTriggerInChip,\n ...rest\n } = item;\n void _id;\n void _label;\n void _value;\n void _avatar;\n void _description;\n void _disabled;\n void _showTriggerInChip;\n return rest;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAaG,SAAU,uBAAuB,CACrC,IAAoB,EAAA;AAEpB,IAAA,MAAM,EACJ,EAAE,EAAE,GAAG,EACP,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,SAAS,EACnB,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,IAAI,EACR,GAAG,IAAI;AAQR,IAAA,OAAO,IAAI;AACb;;"}
|