@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
|
@@ -13,7 +13,7 @@ import prefix from '../../../globals/settings.js';
|
|
|
13
13
|
import { adoptOnRoot } from '../../shared/dynamic-css-var-sheet.js';
|
|
14
14
|
import { TextareaController } from './prompt-line-controller.js';
|
|
15
15
|
import { getRichRuntimeIfLoaded, loadRichRuntime } from './prompt-line-rich-loader.js';
|
|
16
|
-
import { getRawText } from './tiptap/json-utils.js';
|
|
16
|
+
import { getRawText, textOffsetToDocPos } from './tiptap/json-utils.js';
|
|
17
17
|
import styles from './prompt-line.scss.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -32,8 +32,16 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
32
32
|
* rich editor mounts. These are *staged*, not a rich-mode trigger: setting
|
|
33
33
|
* them while in textarea mode does not load Tiptap. Select rich explicitly
|
|
34
34
|
* with `rich` or call `ensureEditor()`; the upgrade mounts with these
|
|
35
|
-
* already installed.
|
|
36
|
-
*
|
|
35
|
+
* already installed.
|
|
36
|
+
*
|
|
37
|
+
* A new array is compared by value against the set last supplied, so a config
|
|
38
|
+
* update that rebuilds an equivalent one leaves the live editor and its undo
|
|
39
|
+
* history in place, writing any starter `items`/`isOn` through to storage.
|
|
40
|
+
* Only a genuinely different set recreates the editor, preserving content,
|
|
41
|
+
* selection, and focus but resetting history.
|
|
42
|
+
* Extensions built by `buildCarbonExtensions` compare by their source
|
|
43
|
+
* config; anything you supply directly compares by reference, so memoize
|
|
44
|
+
* those (a fresh instance each render reads as a real change).
|
|
37
45
|
*/
|
|
38
46
|
this.extensions = [];
|
|
39
47
|
/**
|
|
@@ -56,9 +64,18 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
56
64
|
this._mode = 'textarea';
|
|
57
65
|
this._editorHost = null;
|
|
58
66
|
this._lastExtensionsRef = null;
|
|
67
|
+
this._seedPending = false;
|
|
68
|
+
/** Pending deferred teardown, cancelled if the element is reattached. */
|
|
69
|
+
this._pendingTeardownTimer = null;
|
|
59
70
|
/** Sticky latch — once rich is wanted it never reverts. */
|
|
60
71
|
this._richLatched = false;
|
|
61
72
|
this._upgrading = false;
|
|
73
|
+
/**
|
|
74
|
+
* The element owns the host's composition listeners for both layers — it
|
|
75
|
+
* gates its own textarea→rich upgrade on this, and pushes the state to the
|
|
76
|
+
* active controller via `setComposing` so rich mode can withhold a recreate.
|
|
77
|
+
* One observer, so the two layers cannot disagree.
|
|
78
|
+
*/
|
|
62
79
|
this._isComposing = false;
|
|
63
80
|
this._pendingUpgrade = false;
|
|
64
81
|
/**
|
|
@@ -71,9 +88,11 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
71
88
|
this._rejectRichReady = null;
|
|
72
89
|
this._onCompositionStart = () => {
|
|
73
90
|
this._isComposing = true;
|
|
91
|
+
this._controller?.setComposing(true);
|
|
74
92
|
};
|
|
75
93
|
this._onCompositionEnd = () => {
|
|
76
94
|
this._isComposing = false;
|
|
95
|
+
this._controller?.setComposing(false);
|
|
77
96
|
if (this._pendingUpgrade) {
|
|
78
97
|
this._pendingUpgrade = false;
|
|
79
98
|
void this._upgradeToRich();
|
|
@@ -84,28 +103,32 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
84
103
|
// Lifecycle
|
|
85
104
|
// ---------------------------------------------------------------------------
|
|
86
105
|
firstUpdated() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
this._initializeSurface();
|
|
107
|
+
}
|
|
108
|
+
connectedCallback() {
|
|
109
|
+
super.connectedCallback();
|
|
110
|
+
if (this._pendingTeardownTimer !== null) {
|
|
111
|
+
// Reattached before the deferred teardown ran — a move, not an unmount.
|
|
112
|
+
// The controller and its editor host travelled with the element, so the
|
|
113
|
+
// Tiptap instance (and its undo history) survives untouched.
|
|
114
|
+
//
|
|
115
|
+
// Unlike `_teardownSurface`, this deliberately leaves `_isComposing` /
|
|
116
|
+
// `_pendingUpgrade` alone: the host div and its composition listeners are
|
|
117
|
+
// still attached, so a later `compositionend` reaches them and releases
|
|
118
|
+
// whatever was parked. Teardown has to reset eagerly only because it
|
|
119
|
+
// discards the listeners that would otherwise do it.
|
|
120
|
+
clearTimeout(this._pendingTeardownTimer);
|
|
121
|
+
this._pendingTeardownTimer = null;
|
|
122
|
+
const root = this._editorHost?.getRootNode();
|
|
123
|
+
if (root instanceof ShadowRoot || root instanceof Document) {
|
|
124
|
+
adoptOnRoot(root);
|
|
104
125
|
}
|
|
126
|
+
return;
|
|
105
127
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
// Reattached after a real teardown. `firstUpdated` is a one-shot, so
|
|
129
|
+
// without this the element would come back permanently inert.
|
|
130
|
+
if (this._isTornDown()) {
|
|
131
|
+
this._initializeSurface();
|
|
109
132
|
}
|
|
110
133
|
}
|
|
111
134
|
updated(changed) {
|
|
@@ -129,8 +152,17 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
129
152
|
if (changed.has('disabled')) {
|
|
130
153
|
this._controller.setEditable(!this.disabled);
|
|
131
154
|
}
|
|
132
|
-
|
|
133
|
-
|
|
155
|
+
// The seed echo is skipped once — re-applying it would emit a spurious
|
|
156
|
+
// host-origin change event. Every later update lands, including one that
|
|
157
|
+
// returns to the seed value, and including one alongside an extensions
|
|
158
|
+
// change (which may no-op or recreate; either way the seed is the previous
|
|
159
|
+
// doc).
|
|
160
|
+
if (changed.has('content')) {
|
|
161
|
+
const echoesSeed = this._seedPending && this.content === this._seededContent;
|
|
162
|
+
this._seedPending = false;
|
|
163
|
+
if (!echoesSeed) {
|
|
164
|
+
this._controller.setContent(this.content ?? '');
|
|
165
|
+
}
|
|
134
166
|
}
|
|
135
167
|
if (changed.has('placeholder')) {
|
|
136
168
|
this._controller.setPlaceholder(this.placeholder);
|
|
@@ -144,12 +176,65 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
144
176
|
}
|
|
145
177
|
disconnectedCallback() {
|
|
146
178
|
super.disconnectedCallback();
|
|
179
|
+
if (!this._controller || this._pendingTeardownTimer !== null) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// Deferred by a task so a reparent — remove and re-append in the same
|
|
183
|
+
// frame — keeps the live editor instead of destroying and rebuilding it.
|
|
184
|
+
// A macrotask rather than a microtask because the reconnect can be
|
|
185
|
+
// scheduled separately from the removal, and rather than a frame callback
|
|
186
|
+
// because those never fire in a background tab, which would leak the
|
|
187
|
+
// editor of a chat that really was unmounted.
|
|
188
|
+
this._pendingTeardownTimer = setTimeout(() => {
|
|
189
|
+
this._pendingTeardownTimer = null;
|
|
190
|
+
this._teardownSurface();
|
|
191
|
+
}, 0);
|
|
192
|
+
}
|
|
193
|
+
/** Destroy the editing surface. Deferred from `disconnectedCallback`. */
|
|
194
|
+
_teardownSurface() {
|
|
147
195
|
this._failRichReady(new Error('Input is not currently rendered'));
|
|
148
196
|
this._controller?.destroy();
|
|
149
197
|
this._controller = null;
|
|
150
198
|
this._editorHost?.remove();
|
|
151
199
|
this._editorHost = null;
|
|
152
200
|
this._lastExtensionsRef = null;
|
|
201
|
+
// Back to the default surface. `_richLatched` is the sticky flag, so a late
|
|
202
|
+
// reconnect still comes back rich; leaving `_mode` on 'rich' with no
|
|
203
|
+
// controller would just be a field outliving what it describes.
|
|
204
|
+
this._mode = 'textarea';
|
|
205
|
+
// The host div (and its composition listeners) is gone, so a composition
|
|
206
|
+
// that was in flight can never fire its `compositionend`. Left set, these
|
|
207
|
+
// would park the first upgrade after a reattach forever.
|
|
208
|
+
this._isComposing = false;
|
|
209
|
+
this._pendingUpgrade = false;
|
|
210
|
+
}
|
|
211
|
+
/** Mount the editing surface. Runs on first render and on a late reconnect. */
|
|
212
|
+
_initializeSurface() {
|
|
213
|
+
const host = this._mountEditorHost();
|
|
214
|
+
this._lastExtensionsRef = this.extensions;
|
|
215
|
+
this._seededContent = this.content;
|
|
216
|
+
this._seedPending = true;
|
|
217
|
+
this._richLatched = this._wantsRich();
|
|
218
|
+
const warmRuntime = this._richLatched ? getRichRuntimeIfLoaded() : null;
|
|
219
|
+
if (warmRuntime) {
|
|
220
|
+
// Runtime already loaded (e.g. preloaded at boot) — mount rich directly,
|
|
221
|
+
// no textarea flash.
|
|
222
|
+
this._mode = 'rich';
|
|
223
|
+
this._controller = warmRuntime.createRichController();
|
|
224
|
+
this._controller.mount(host, this._makeInit());
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this._mode = 'textarea';
|
|
228
|
+
this._controller = new TextareaController();
|
|
229
|
+
this._controller.mount(host, this._makeInit());
|
|
230
|
+
if (this._richLatched) {
|
|
231
|
+
void this._upgradeToRich();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (this.autofocus) {
|
|
235
|
+
// Defer so consumer listeners are attached first.
|
|
236
|
+
Promise.resolve().then(() => this._controller?.focus());
|
|
237
|
+
}
|
|
153
238
|
}
|
|
154
239
|
render() {
|
|
155
240
|
return html `
|
|
@@ -238,6 +323,14 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
238
323
|
_wantsRich() {
|
|
239
324
|
return this._richLatched || this.rich;
|
|
240
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Rendered once and then torn down — the element is inert until something
|
|
328
|
+
* re-runs the mount path. Distinct from "not yet rendered", where Lit's own
|
|
329
|
+
* `firstUpdated` still has it.
|
|
330
|
+
*/
|
|
331
|
+
_isTornDown() {
|
|
332
|
+
return this.hasUpdated && !this._controller;
|
|
333
|
+
}
|
|
241
334
|
_mountEditorHost() {
|
|
242
335
|
const host = document.createElement('div');
|
|
243
336
|
host.setAttribute('slot', 'editor');
|
|
@@ -340,14 +433,14 @@ let PromptLineElement = class PromptLineElement extends LitElement {
|
|
|
340
433
|
previous.destroy();
|
|
341
434
|
this._controller = rich;
|
|
342
435
|
this._mode = 'rich';
|
|
436
|
+
// Seeded losslessly from the textarea's text, which already reflects
|
|
437
|
+
// `content`, so an in-flight identical `content` update stays a no-op.
|
|
438
|
+
this._seededContent = this.content;
|
|
439
|
+
this._seedPending = true;
|
|
343
440
|
rich.mount(host, this._makeInit(value));
|
|
344
|
-
// Map plain-text caret offsets into the seeded doc. `textToDoc` makes one
|
|
345
|
-
// paragraph per line, so a position costs +1 for the doc/first-paragraph
|
|
346
|
-
// start plus +1 for every newline before it (each opens a new paragraph).
|
|
347
|
-
const toDocPos = (offset) => offset + 1 + (value.slice(0, offset).split('\n').length - 1);
|
|
348
441
|
rich.setTextSelection({
|
|
349
|
-
from:
|
|
350
|
-
to:
|
|
442
|
+
from: textOffsetToDocPos(value, selection.from),
|
|
443
|
+
to: textOffsetToDocPos(value, selection.to),
|
|
351
444
|
});
|
|
352
445
|
if (hadFocus) {
|
|
353
446
|
rich.focus();
|
|
@@ -1 +1 @@
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,EAAA,MAAA,CAAA;AAIH,UAAA,CAAA;AADR,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;AACA,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAzDvB,iBAAiB,GAAA,UAAA,CAAA;AADtB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,YAAA,CAAc;AAChC,CAAA,EAAA,iBAAiB,CAwftB;AAQD,0BAAe,iBAAiB;;;;"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { carbonAutocomplete } from './carbon-autocomplete.js';
|
|
9
9
|
import { carbonMention, carbonCommand } from './carbon-mention.js';
|
|
10
10
|
import { carbonStarterTrigger } from './carbon-starter-trigger.js';
|
|
11
|
+
import { tagExtensionSource } from './extension-equivalence.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @license
|
|
@@ -18,18 +19,47 @@ import { carbonStarterTrigger } from './carbon-starter-trigger.js';
|
|
|
18
19
|
* LICENSE file in the root directory of this source tree.
|
|
19
20
|
*/
|
|
20
21
|
function buildCarbonExtensions(configs) {
|
|
22
|
+
// Each entry is tagged with the config it was built from so the rich runtime
|
|
23
|
+
// can tell a genuinely different extension set from a rebuilt-but-identical
|
|
24
|
+
// one without recreating the editor. See ./extension-equivalence.ts.
|
|
21
25
|
const out = [];
|
|
22
26
|
if (configs.mention) {
|
|
23
|
-
out.push(carbonMention(configs.mention)
|
|
27
|
+
out.push(tagExtensionSource(carbonMention(configs.mention), {
|
|
28
|
+
kind: 'mention',
|
|
29
|
+
config: configs.mention,
|
|
30
|
+
}));
|
|
24
31
|
}
|
|
25
32
|
if (configs.command) {
|
|
26
|
-
out.push(carbonCommand(configs.command)
|
|
33
|
+
out.push(tagExtensionSource(carbonCommand(configs.command), {
|
|
34
|
+
kind: 'command',
|
|
35
|
+
config: configs.command,
|
|
36
|
+
}));
|
|
27
37
|
}
|
|
28
38
|
if (configs.autocomplete) {
|
|
29
|
-
|
|
39
|
+
const excludeTriggers = [];
|
|
40
|
+
if (configs.mention) {
|
|
41
|
+
excludeTriggers.push({
|
|
42
|
+
char: configs.mention.trigger,
|
|
43
|
+
position: configs.mention.triggerPosition === 'start' ? 'start' : 'anywhere',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (configs.command) {
|
|
47
|
+
excludeTriggers.push({
|
|
48
|
+
char: configs.command.trigger,
|
|
49
|
+
position: configs.command.triggerPosition === 'start' ? 'start' : 'anywhere',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
out.push(tagExtensionSource(carbonAutocomplete(configs.autocomplete, excludeTriggers), {
|
|
53
|
+
kind: 'autocomplete',
|
|
54
|
+
config: configs.autocomplete,
|
|
55
|
+
}));
|
|
30
56
|
}
|
|
31
|
-
|
|
32
|
-
|
|
57
|
+
// Installed whenever `starters` is configured, empty list included: it is how
|
|
58
|
+
// `items`/`isOn` reach the live editor, and omitting it for an empty list
|
|
59
|
+
// shortens the set, which the equivalence check rejects — recreating the
|
|
60
|
+
// editor and dropping its undo history. `maybeEmit` stays silent when empty.
|
|
61
|
+
if (configs.starters) {
|
|
62
|
+
out.push(tagExtensionSource(carbonStarterTrigger(configs.starters.items, configs.starters.isOn), { kind: 'starters', config: configs.starters }));
|
|
33
63
|
}
|
|
34
64
|
return out;
|
|
35
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-extensions.js","sources":["../../../../../src/components/prompt-line/src/tiptap/build-extensions.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-extensions.js","sources":["../../../../../src/components/prompt-line/src/tiptap/build-extensions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAsCG,SAAU,qBAAqB,CACnC,OAAoC,EAAA;;;;IAKpC,MAAM,GAAG,GAAgB,EAAE;AAC3B,IAAA,IAAI,OAAO,CAAC,OAAO,EAAE;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ACN,kBAAkB,CAChB,oBAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EACnE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,CAC/C,CACF;IACH;AACA,IAAA,OAAO,GAAG;AACZ;;;;"}
|
|
@@ -18,4 +18,8 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { Extension } from '@tiptap/core';
|
|
20
20
|
import type { AutocompleteConfig } from './types.js';
|
|
21
|
-
export
|
|
21
|
+
export interface ExcludedTrigger {
|
|
22
|
+
char: string;
|
|
23
|
+
position: 'anywhere' | 'start';
|
|
24
|
+
}
|
|
25
|
+
export declare function carbonAutocomplete(config: AutocompleteConfig, excludeTriggers?: ExcludedTrigger[]): Extension;
|
|
@@ -28,11 +28,10 @@ import { dispatchTriggerChange } from './trigger-utils.js';
|
|
|
28
28
|
* the suggestion-render lifecycle via the shared `dispatchTriggerChange`
|
|
29
29
|
* helper.
|
|
30
30
|
*/
|
|
31
|
-
function carbonAutocomplete(config) {
|
|
32
|
-
const
|
|
33
|
-
const pluginKey = new PluginKey(`carbonAutocompleteSuggestion_${name}`);
|
|
31
|
+
function carbonAutocomplete(config, excludeTriggers = []) {
|
|
32
|
+
const pluginKey = new PluginKey('carbonAutocompleteSuggestion');
|
|
34
33
|
return Extension.create({
|
|
35
|
-
name:
|
|
34
|
+
name: 'carbonAutocomplete',
|
|
36
35
|
addProseMirrorPlugins() {
|
|
37
36
|
const editor = this.editor;
|
|
38
37
|
let lastQuery = null;
|
|
@@ -54,6 +53,19 @@ function carbonAutocomplete(config) {
|
|
|
54
53
|
return null;
|
|
55
54
|
}
|
|
56
55
|
const query = trailing[0];
|
|
56
|
+
// Yield to co-installed mention/command extensions so they win
|
|
57
|
+
// when their trigger char is active.
|
|
58
|
+
for (const excluded of excludeTriggers) {
|
|
59
|
+
if (!query.startsWith(excluded.char)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (excluded.position === 'anywhere') {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (text === query) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
57
69
|
const matchStart = $position.start() + $position.parentOffset - query.length;
|
|
58
70
|
return {
|
|
59
71
|
range: {
|
|
@@ -119,9 +131,6 @@ async function resolveItems(config, query) {
|
|
|
119
131
|
const lower = query.toLowerCase();
|
|
120
132
|
return config.items.filter((item) => item.label.toLowerCase().includes(lower));
|
|
121
133
|
}
|
|
122
|
-
function capitalize(value) {
|
|
123
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
124
|
-
}
|
|
125
134
|
|
|
126
135
|
export { carbonAutocomplete };
|
|
127
136
|
//# 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":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;AASG;
|
|
1
|
+
{"version":3,"file":"carbon-autocomplete.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-autocomplete.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;AASG;SAca,kBAAkB,CAChC,MAA0B,EAC1B,kBAAqC,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,CAAC,MAAM;YAC1B,IAAI,SAAS,GAAkB,IAAI;YAEnC,OAAO;AACL,gBAAA,UAAU,CAAiB;oBACzB,MAAM;AACN,oB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AAM,EAAE,IAAI,CAAC;wBAC3C,CAAC;AACD,wBAAA,SAAS,EAAE,MAAM,KAAK;qBACvB,CAAC;iBACH,CAAC;aACH;QACH,CAAC;AACF,KAAA,CAAC;AACJ;AAEA,eAAe,YAAY,CACzB,MAA0B,EAC1B,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;QACtC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C;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;;;;"}
|
|
@@ -20,7 +20,7 @@ import { dispatchTriggerChange } from './trigger-utils.js';
|
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
21
|
*/
|
|
22
22
|
function buildTriggerExtension(config, build) {
|
|
23
|
-
const name =
|
|
23
|
+
const name = build.defaultName;
|
|
24
24
|
const pluginKey = new PluginKey(`${build.defaultPluginKeyName}_${name}`);
|
|
25
25
|
return Mention.extend({
|
|
26
26
|
name,
|
|
@@ -45,8 +45,8 @@ function buildTriggerExtension(config, build) {
|
|
|
45
45
|
return parentPlugins;
|
|
46
46
|
}
|
|
47
47
|
// Fire `onRemove` once per token node of this type that leaves the doc
|
|
48
|
-
// via a USER edit.
|
|
49
|
-
// `
|
|
48
|
+
// via a USER edit. `appendTransaction` records whether the batch was
|
|
49
|
+
// host-origin — `some`, where typing-indicator uses `every` — and the
|
|
50
50
|
// view's `update` runs the diff (after state is applied, so host
|
|
51
51
|
// callbacks never re-enter `dispatch`). Host-origin batches — the
|
|
52
52
|
// framework's post-send clear and any `getEditor()`/`updateContent`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbon-mention.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-mention.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;AAOG;
|
|
1
|
+
{"version":3,"file":"carbon-mention.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-mention.ts"],"sourcesContent":[null],"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,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,aAA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O,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C;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;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;;;;"}
|
|
@@ -14,10 +14,21 @@
|
|
|
14
14
|
* Items are stored on `extension.storage.items` so the prompt-line / shell
|
|
15
15
|
* can swap the list at runtime without recreating the editor.
|
|
16
16
|
*/
|
|
17
|
-
import { Extension } from '@tiptap/core';
|
|
17
|
+
import { Extension, type Editor } from '@tiptap/core';
|
|
18
18
|
import type { SuggestionItem } from './types.js';
|
|
19
19
|
export interface StarterTriggerStorage {
|
|
20
20
|
items: SuggestionItem[];
|
|
21
21
|
isOn: boolean;
|
|
22
22
|
}
|
|
23
|
+
/** Read the starter trigger's live storage, or `undefined` if not installed. */
|
|
24
|
+
export declare function readStarterStorage(editor: Editor | null | undefined): StarterTriggerStorage | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Apply a starter-config patch to the live editor. Starter differences never
|
|
27
|
+
* justify recreating the editor — that would drop undo history — so they are
|
|
28
|
+
* written in place. The empty transaction re-runs this extension's
|
|
29
|
+
* `onTransaction` hook, so a toggle takes effect against the current selection
|
|
30
|
+
* instead of waiting for the next keystroke. No-ops when nothing changed, so
|
|
31
|
+
* callers do not have to guard.
|
|
32
|
+
*/
|
|
33
|
+
export declare function writeStarterStorage(editor: Editor | null | undefined, patch: Partial<StarterTriggerStorage>): void;
|
|
23
34
|
export declare function carbonStarterTrigger(initialItems: SuggestionItem[], initialIsOn?: boolean): Extension;
|
|
@@ -24,6 +24,31 @@ import { resetTriggerChangeState, dispatchTriggerChange } from './trigger-utils.
|
|
|
24
24
|
* Items are stored on `extension.storage.items` so the prompt-line / shell
|
|
25
25
|
* can swap the list at runtime without recreating the editor.
|
|
26
26
|
*/
|
|
27
|
+
/** Read the starter trigger's live storage, or `undefined` if not installed. */
|
|
28
|
+
function readStarterStorage(editor) {
|
|
29
|
+
return editor?.storage
|
|
30
|
+
?.carbonStarterTrigger;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Apply a starter-config patch to the live editor. Starter differences never
|
|
34
|
+
* justify recreating the editor — that would drop undo history — so they are
|
|
35
|
+
* written in place. The empty transaction re-runs this extension's
|
|
36
|
+
* `onTransaction` hook, so a toggle takes effect against the current selection
|
|
37
|
+
* instead of waiting for the next keystroke. No-ops when nothing changed, so
|
|
38
|
+
* callers do not have to guard.
|
|
39
|
+
*/
|
|
40
|
+
function writeStarterStorage(editor, patch) {
|
|
41
|
+
const storage = readStarterStorage(editor);
|
|
42
|
+
if (!editor || !storage) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const entries = Object.entries(patch);
|
|
46
|
+
if (entries.every(([key, value]) => storage[key] === value)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
Object.assign(storage, patch);
|
|
50
|
+
editor.view.dispatch(editor.state.tr);
|
|
51
|
+
}
|
|
27
52
|
function carbonStarterTrigger(initialItems, initialIsOn = true) {
|
|
28
53
|
return Extension.create({
|
|
29
54
|
name: 'carbonStarterTrigger',
|
|
@@ -54,10 +79,10 @@ function carbonStarterTrigger(initialItems, initialIsOn = true) {
|
|
|
54
79
|
});
|
|
55
80
|
}
|
|
56
81
|
function maybeEmit(editor, forceClear = false) {
|
|
57
|
-
const storage = editor
|
|
58
|
-
.carbonStarterTrigger;
|
|
82
|
+
const storage = readStarterStorage(editor);
|
|
59
83
|
const isActive = !forceClear &&
|
|
60
84
|
storage?.isOn !== false &&
|
|
85
|
+
(storage?.items.length ?? 0) > 0 &&
|
|
61
86
|
editor.isEditable &&
|
|
62
87
|
editor.isFocused &&
|
|
63
88
|
editor.isEmpty;
|
|
@@ -72,5 +97,5 @@ function maybeEmit(editor, forceClear = false) {
|
|
|
72
97
|
});
|
|
73
98
|
}
|
|
74
99
|
|
|
75
|
-
export { carbonStarterTrigger };
|
|
100
|
+
export { carbonStarterTrigger, readStarterStorage, writeStarterStorage };
|
|
76
101
|
//# sourceMappingURL=carbon-starter-trigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbon-starter-trigger.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-starter-trigger.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;AAOG;
|
|
1
|
+
{"version":3,"file":"carbon-starter-trigger.js","sources":["../../../../../src/components/prompt-line/src/tiptap/carbon-starter-trigger.ts"],"sourcesContent":[null],"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,CAAC,OAAO,EAAE;QACvB;IACF;IACA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAGjC;IACH,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,EAAE;QAC3D;IACF;AACA,IAAA,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;IAC7B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACvC;SAEgB,oBAAoB,CAClC,YAA8B,EAC9B,WAAW,GAAG,IAAI,EAAA;IAElB,OAAO,SAAS,CAAC,MAAM,CAAiC;AACtD,QAAA,IAAI,EAAE,sBAAsB;QAE5B,UAAU,GAAA;YACR,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE;QACnD,CAAC;QAED,QAAQ,GAAA;AACN,YAAA,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,YAAY;AACjC,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,WAAW;QACjC,CAAC;QAED,QAAQ,GAAA;AACN,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;QACxB,CAAC;QAED,aAAa,GAAA;AACX,YAAA,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;AACzB,gBAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YACxB;QACF,CAAC;QAED,OAAO,CAAC,EAAE,MAAM,EAAE,EAAA;YAChB,SAAS,CAAC,MAAM,CAAC;QACnB,CAAC;QAED,MAAM,CAAC,EAAE,MAAM,EAAE,EAAA;;;;YAIf,uBAAuB,CAAC,MAAM,CAAC;QACjC,CAAC;AACF,KAAA,CAAC;AACJ;AAEA,SAAS,SAAS,CAAC,MAAc,EAAE,UAAU,GAAG,KAAK,EAAA;AACnD,IAAA,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC;IAC1C,MAAM,QAAQ,GACZ,CAAC,UAAU;QACX,OAAO,EAAE,IAAI,KAAK,KAAK;QACvB,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC;AAChC,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;;;;"}
|
|
@@ -30,7 +30,7 @@ function ensurePmContentStyleRules() {
|
|
|
30
30
|
color: 'var(--cds-text-primary, #161616)',
|
|
31
31
|
outline: 'none',
|
|
32
32
|
'white-space': 'pre-wrap',
|
|
33
|
-
'
|
|
33
|
+
'overflow-wrap': 'anywhere',
|
|
34
34
|
'font-size': 'var(--cds-body-01-font-size, 0.875rem)',
|
|
35
35
|
'font-weight': 'var(--cds-body-01-font-weight, 400)',
|
|
36
36
|
'letter-spacing': 'var(--cds-body-01-letter-spacing, 0.16px)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-styles.js","sources":["../../../../../src/components/prompt-line/src/tiptap/editor-styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAKH,MAAM,gBAAgB,GAAG,8BAA8B;AACvD,MAAM,cAAc,GAAG,qCAAqC;AAC5D,IAAI,qBAAqB,GAAG,KAAK;AAEjC,SAAS,yBAAyB,GAAA;IAChC,IAAI,qBAAqB,EAAE;QACzB;IACF;AACA,IAAA,kBAAkB,CAAC,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAE,EAAE;AACzC,QAAA,MAAM,EAAE,MAAM;AACd,QAAA,MAAM,EAAE,GAAG;AACX,QAAA,UAAU,EAAE,aAAa;AACzB,QAAA,KAAK,EAAE,kCAAkC;AACzC,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,
|
|
1
|
+
{"version":3,"file":"editor-styles.js","sources":["../../../../../src/components/prompt-line/src/tiptap/editor-styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAKH,MAAM,gBAAgB,GAAG,8BAA8B;AACvD,MAAM,cAAc,GAAG,qCAAqC;AAC5D,IAAI,qBAAqB,GAAG,KAAK;AAEjC,SAAS,yBAAyB,GAAA;IAChC,IAAI,qBAAqB,EAAE;QACzB;IACF;AACA,IAAA,kBAAkB,CAAC,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAE,EAAE;AACzC,QAAA,MAAM,EAAE,MAAM;AACd,QAAA,MAAM,EAAE,GAAG;AACX,QAAA,UAAU,EAAE,aAAa;AACzB,QAAA,KAAK,EAAE,kCAAkC;AACzC,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,eAAe,EAAE,UAAU;AAC3B,QAAA,WAAW,EAAE,wCAAwC;AACrD,QAAA,aAAa,EAAE,qCAAqC;AACp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