@sequent-org/moodboard 1.4.31 → 1.4.32
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/package.json
CHANGED
|
@@ -13,7 +13,7 @@ const CLOSE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12
|
|
|
13
13
|
|
|
14
14
|
export class ChatComposer {
|
|
15
15
|
/**
|
|
16
|
-
* @param {{ textarea: HTMLTextAreaElement, send: HTMLButtonElement, attach: HTMLButtonElement, fileInput: HTMLInputElement, attachmentsPreview: HTMLElement,
|
|
16
|
+
* @param {{ textarea: HTMLTextAreaElement, send: HTMLButtonElement, attach: HTMLButtonElement, fileInput: HTMLInputElement, attachmentsPreview: HTMLElement, statusBar?: HTMLElement }} refs
|
|
17
17
|
* @param {{ onSubmit: (text: string, attachments: File[]) => void, onAbort: () => void }} handlers
|
|
18
18
|
*/
|
|
19
19
|
constructor(refs, handlers) {
|
|
@@ -22,7 +22,6 @@ export class ChatComposer {
|
|
|
22
22
|
this._attach = refs.attach ?? null;
|
|
23
23
|
this._fileInput = refs.fileInput ?? null;
|
|
24
24
|
this._attachmentsPreview = refs.attachmentsPreview ?? null;
|
|
25
|
-
this._enhancePrompt = refs.enhancePrompt ?? null;
|
|
26
25
|
this._statusBar = refs.statusBar ?? null;
|
|
27
26
|
this._handlers = handlers;
|
|
28
27
|
this._listeners = [];
|
|
@@ -105,9 +104,6 @@ export class ChatComposer {
|
|
|
105
104
|
const hasAttachments = this._attachments.length > 0;
|
|
106
105
|
this._send.dataset.state = (hasText || hasAttachments) ? 'ready' : 'idle';
|
|
107
106
|
this._send.disabled = false;
|
|
108
|
-
if (this._enhancePrompt) {
|
|
109
|
-
this._enhancePrompt.dataset.empty = hasText ? 'false' : 'true';
|
|
110
|
-
}
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
_handleFileChange() {
|
|
@@ -36,11 +36,6 @@ export class ChatExtendedPromptModal {
|
|
|
36
36
|
this._sourceTextarea.value = '';
|
|
37
37
|
this._sourceTextarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
this._on(this._refs.enhanceBtn, 'click', () => {
|
|
41
|
-
const originalEnhance = this._sourceTextarea.parentElement?.querySelector('.moodboard-chat__input-icon-btn--enhance-prompt');
|
|
42
|
-
if (originalEnhance) originalEnhance.click();
|
|
43
|
-
});
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
show() {
|
|
@@ -111,13 +106,7 @@ export class ChatExtendedPromptModal {
|
|
|
111
106
|
clearBtn.className = 'moodboard-chat__extended-clear';
|
|
112
107
|
clearBtn.textContent = 'Очистить';
|
|
113
108
|
|
|
114
|
-
const enhanceBtn = document.createElement('button');
|
|
115
|
-
enhanceBtn.type = 'button';
|
|
116
|
-
enhanceBtn.className = 'moodboard-chat__extended-enhance';
|
|
117
|
-
enhanceBtn.innerHTML = `<span class="moodboard-chat__extended-enhance-icon">${ICONS.enhancePrompt}</span> Улучшить`;
|
|
118
|
-
|
|
119
109
|
actions.appendChild(clearBtn);
|
|
120
|
-
actions.appendChild(enhanceBtn);
|
|
121
110
|
|
|
122
111
|
body.appendChild(textarea);
|
|
123
112
|
body.appendChild(actions);
|
|
@@ -126,6 +115,6 @@ export class ChatExtendedPromptModal {
|
|
|
126
115
|
modal.appendChild(body);
|
|
127
116
|
overlay.appendChild(modal);
|
|
128
117
|
|
|
129
|
-
return { overlay, modal, header, title, closeBtn, body, textarea, clearBtn
|
|
118
|
+
return { overlay, modal, header, title, closeBtn, body, textarea, clearBtn };
|
|
130
119
|
}
|
|
131
120
|
}
|
|
@@ -67,26 +67,19 @@ function buildInputRow(collect) {
|
|
|
67
67
|
const promptActionsWrapper = document.createElement('div');
|
|
68
68
|
promptActionsWrapper.className = 'moodboard-chat__pill-wrapper';
|
|
69
69
|
|
|
70
|
-
const enhancePrompt = createInputIconButton(
|
|
71
|
-
'enhance-prompt',
|
|
72
|
-
'Улучшить промпт',
|
|
73
|
-
ICONS.enhancePrompt
|
|
74
|
-
);
|
|
75
|
-
enhancePrompt.dataset.empty = 'true';
|
|
76
70
|
const extendPromptField = createInputIconButton(
|
|
77
71
|
'extend-promt-field',
|
|
78
72
|
'Развернуть поле ввода',
|
|
79
73
|
ICONS.extendPromptField
|
|
80
74
|
);
|
|
81
75
|
|
|
82
|
-
promptActionsWrapper.appendChild(enhancePrompt);
|
|
83
76
|
promptActionsWrapper.appendChild(extendPromptField);
|
|
84
77
|
textareaRow.appendChild(textarea);
|
|
85
78
|
textareaRow.appendChild(promptActionsWrapper);
|
|
86
79
|
row.appendChild(attachmentsPreview);
|
|
87
80
|
row.appendChild(textareaRow);
|
|
88
81
|
|
|
89
|
-
collect({ textarea,
|
|
82
|
+
collect({ textarea, extendPromptField, attachmentsPreview });
|
|
90
83
|
return row;
|
|
91
84
|
}
|
|
92
85
|
|
package/src/ui/chat/icons.js
CHANGED
|
@@ -39,9 +39,6 @@ const ATTACHMENTS_ICON = `<svg xmlns="http://www.w3.org/2000/svg" width="16" hei
|
|
|
39
39
|
/** Кнопка отправки в composer */
|
|
40
40
|
const SEND_ICON = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M7.453 1.204a.87.87 0 0 1 1.093 0l.066.06 4.962 4.961a.6.6 0 0 1-.849.849L8.6 2.949v11.45a.6.6 0 0 1-1.199 0V2.946L3.273 7.074a.6.6 0 1 1-.847-.849l4.96-4.962z"/></svg>`;
|
|
41
41
|
|
|
42
|
-
/** public/icons/enhance-prompt.svg */
|
|
43
|
-
const ENHANCE_PROMPT_ICON = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 11.771a.6.6 0 1 1 0 1.2L1.6 13a.6.6 0 0 1 0-1.2zm2-4.37A.6.6 0 1 1 10 8.6H1.6a.6.6 0 1 1 0-1.2zM14.4 3a.6.6 0 1 1 0 1.2H1.6a.6.6 0 1 1 0-1.2zm-1.101 5.5a.346.346 0 0 0-.643 0l-.174.417a2.98 2.98 0 0 1-1.538 1.59l-.489.218a.362.362 0 0 0 0 .658l.519.231c.675.3 1.216.85 1.516 1.538l.168.387a.347.347 0 0 0 .639 0l.168-.387c.3-.689.841-1.237 1.516-1.538l.519-.231a.362.362 0 0 0 0-.658l-.49-.218a3 3 0 0 1-1.538-1.59z"/></svg>`;
|
|
44
|
-
|
|
45
42
|
/** public/icons/extend-promt-field.svg */
|
|
46
43
|
const EXTEND_PROMPT_FIELD_ICON = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M9.696 7.151a.599.599 0 1 1-.847-.847L12.55 2.6H9.272a.6.6 0 0 1 0-1.2H14a.6.6 0 0 1 .6.599v4.728a.6.6 0 1 1-1.2 0V3.449zM1.4 9.272a.6.6 0 1 1 1.2 0v3.28l3.704-3.703a.599.599 0 1 1 .847.847L3.45 13.4h3.279a.6.6 0 0 1 0 1.2H2A.6.6 0 0 1 1.4 14z"/></svg>`;
|
|
47
44
|
|
|
@@ -69,7 +66,6 @@ export const ICONS = {
|
|
|
69
66
|
palette: svg('<path d="M12 3a9 9 0 0 0 0 18c1.7 0 2-1 2-2 0-1.5 1-2 2-2h2a3 3 0 0 0 3-3c0-5-4-9-9-9z"/><circle cx="7.5" cy="11" r="1"/><circle cx="11" cy="7" r="1"/><circle cx="15" cy="7" r="1"/><circle cx="17.5" cy="11" r="1"/>'),
|
|
70
67
|
attach: ATTACHMENTS_ICON,
|
|
71
68
|
send: SEND_ICON,
|
|
72
|
-
enhancePrompt: ENHANCE_PROMPT_ICON,
|
|
73
69
|
extendPromptField: EXTEND_PROMPT_FIELD_ICON,
|
|
74
70
|
sliders: svg('<path d="M4 7h10M18 7h2M4 17h2M10 17h10"/><circle cx="16" cy="7" r="2"/><circle cx="8" cy="17" r="2"/>'),
|
|
75
71
|
chevronDown: svg('<path d="M6 9l6 6 6-6"/>'),
|
package/src/ui/styles/chat.css
CHANGED
|
@@ -289,14 +289,6 @@
|
|
|
289
289
|
color: #374151;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
.moodboard-chat__input-icon-btn--enhance-prompt[data-empty="true"] {
|
|
293
|
-
color: lab(5.0601 0 0 / 0.3216);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.moodboard-chat__input-icon-btn--enhance-prompt[data-empty="true"]:hover {
|
|
297
|
-
color: lab(5.0601 0 0 / 0.3216);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
292
|
.moodboard-chat__actions-row {
|
|
301
293
|
display: flex;
|
|
302
294
|
align-items: center;
|
|
@@ -424,7 +416,7 @@
|
|
|
424
416
|
}
|
|
425
417
|
|
|
426
418
|
.moodboard-chat__send[data-state="streaming"] {
|
|
427
|
-
background: #
|
|
419
|
+
background: #111827;
|
|
428
420
|
color: #ffffff;
|
|
429
421
|
}
|
|
430
422
|
|
|
@@ -984,31 +976,3 @@
|
|
|
984
976
|
.moodboard-chat__extended-clear:hover {
|
|
985
977
|
color: #374151;
|
|
986
978
|
}
|
|
987
|
-
|
|
988
|
-
.moodboard-chat__extended-enhance {
|
|
989
|
-
background: transparent;
|
|
990
|
-
border: none;
|
|
991
|
-
color: #6B7280;
|
|
992
|
-
font-size: 13px;
|
|
993
|
-
font-weight: 500;
|
|
994
|
-
cursor: pointer;
|
|
995
|
-
padding: 0;
|
|
996
|
-
display: inline-flex;
|
|
997
|
-
align-items: center;
|
|
998
|
-
gap: 6px;
|
|
999
|
-
transition: color 120ms ease;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
.moodboard-chat__extended-enhance:hover {
|
|
1003
|
-
color: #374151;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
.moodboard-chat__extended-enhance-icon {
|
|
1007
|
-
display: inline-flex;
|
|
1008
|
-
color: inherit;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
.moodboard-chat__extended-enhance-icon svg {
|
|
1012
|
-
width: 16px;
|
|
1013
|
-
height: 16px;
|
|
1014
|
-
}
|