one-design-next 0.0.54 → 0.0.56
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/dist/_genui-types.d.ts +2 -0
- package/dist/chat-item/index.js +2 -1
- package/dist/composer/index.js +27 -13
- package/package.json +1 -1
package/dist/_genui-types.d.ts
CHANGED
package/dist/chat-item/index.js
CHANGED
|
@@ -205,7 +205,8 @@ export function ChatItem(_ref2) {
|
|
|
205
205
|
var labelRef = useRef(null);
|
|
206
206
|
var titleRef = useRef(null);
|
|
207
207
|
var trailingRef = useRef(null);
|
|
208
|
-
|
|
208
|
+
// active 时隐藏 waiting/unread/error;generating 仍展示(当前会话仍在生成)
|
|
209
|
+
var showStatus = Boolean(status && (!active || status === 'generating'));
|
|
209
210
|
var showTypeIcon = type === 'human';
|
|
210
211
|
var fitTitle = showTypeIcon || showStatus;
|
|
211
212
|
var displayTitle = useFittedTitle(title, fitTitle, labelRef, titleRef, trailingRef);
|
package/dist/composer/index.js
CHANGED
|
@@ -479,10 +479,15 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
479
479
|
updateAttachments([].concat(_toConsumableArray(attachments), _toConsumableArray(accepted)));
|
|
480
480
|
}, [accept, attachments, attachmentsDisabled, disabled, maxFileCount, maxFileSize, maxTotalSize, onAttachFiles, updateAttachments]);
|
|
481
481
|
var handleFileChange = function handleFileChange(e) {
|
|
482
|
+
var _editorRef$current12;
|
|
482
483
|
var files = e.target.files;
|
|
483
484
|
if (!files) return;
|
|
484
485
|
addFilesFromList(Array.from(files));
|
|
485
486
|
e.target.value = '';
|
|
487
|
+
/* 文件框关闭后焦点回到 editor:
|
|
488
|
+
* 键盘(Tab + Enter)唤起文件框的路径下按钮持有焦点,
|
|
489
|
+
* 不夺回焦点时 Enter 会再次激活按钮而不是发送 */
|
|
490
|
+
(_editorRef$current12 = editorRef.current) === null || _editorRef$current12 === void 0 || _editorRef$current12.focus();
|
|
486
491
|
};
|
|
487
492
|
var _useState17 = useState(false),
|
|
488
493
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
@@ -524,14 +529,14 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
524
529
|
var handleSelectSkill = useCallback(function (skill, source) {
|
|
525
530
|
var data = createInvocationChipData(skill);
|
|
526
531
|
if (source === 'trigger') {
|
|
527
|
-
var _editorRef$
|
|
528
|
-
(_editorRef$
|
|
532
|
+
var _editorRef$current13;
|
|
533
|
+
(_editorRef$current13 = editorRef.current) === null || _editorRef$current13 === void 0 || _editorRef$current13.replaceTriggerWithChip(data);
|
|
529
534
|
setTriggerInfo(null);
|
|
530
535
|
} else {
|
|
531
|
-
var _editorRef$
|
|
532
|
-
(_editorRef$
|
|
536
|
+
var _editorRef$current14, _editorRef$current15;
|
|
537
|
+
(_editorRef$current14 = editorRef.current) === null || _editorRef$current14 === void 0 || _editorRef$current14.insertChip(data);
|
|
533
538
|
setToolMenuOpen(false);
|
|
534
|
-
(_editorRef$
|
|
539
|
+
(_editorRef$current15 = editorRef.current) === null || _editorRef$current15 === void 0 || _editorRef$current15.focus();
|
|
535
540
|
}
|
|
536
541
|
if (skill.initialState === 'pending') openParamPanel(data.id);
|
|
537
542
|
}, [openParamPanel]);
|
|
@@ -615,9 +620,9 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
615
620
|
return true;
|
|
616
621
|
}
|
|
617
622
|
if (e.key === 'Escape') {
|
|
618
|
-
var _editorRef$
|
|
623
|
+
var _editorRef$current16;
|
|
619
624
|
e.preventDefault();
|
|
620
|
-
(_editorRef$
|
|
625
|
+
(_editorRef$current16 = editorRef.current) === null || _editorRef$current16 === void 0 || _editorRef$current16.cancelTrigger();
|
|
621
626
|
setTriggerInfo(null);
|
|
622
627
|
return true;
|
|
623
628
|
}
|
|
@@ -673,6 +678,11 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
673
678
|
var _fileInputRef$current;
|
|
674
679
|
onToolClick === null || onToolClick === void 0 || onToolClick('attachment');
|
|
675
680
|
(_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 || _fileInputRef$current.click();
|
|
681
|
+
}
|
|
682
|
+
/* 防止 mousedown 把焦点从 editor 抢到按钮上——
|
|
683
|
+
* 否则文件框关闭后焦点留在按钮,Enter 会再次触发 click 打开文件框 */,
|
|
684
|
+
onMouseDown: function onMouseDown(e) {
|
|
685
|
+
return e.preventDefault();
|
|
676
686
|
},
|
|
677
687
|
disabled: btnDisabled,
|
|
678
688
|
"data-odn-composer-tool-btn": true,
|
|
@@ -700,6 +710,10 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
700
710
|
setWebSearch(function (v) {
|
|
701
711
|
return !v;
|
|
702
712
|
});
|
|
713
|
+
}
|
|
714
|
+
/* 同附件按钮:防止点击后焦点留在按钮上,Enter 误触发 toggle 而不是发送 */,
|
|
715
|
+
onMouseDown: function onMouseDown(e) {
|
|
716
|
+
return e.preventDefault();
|
|
703
717
|
},
|
|
704
718
|
disabled: disabled,
|
|
705
719
|
"data-odn-composer-tool-btn": true,
|
|
@@ -861,9 +875,9 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
861
875
|
"data-odn-composer-file-input": true,
|
|
862
876
|
onChange: handleFileChange
|
|
863
877
|
});
|
|
864
|
-
var paramPanelNode = function (_editorRef$current$ge3, _editorRef$
|
|
878
|
+
var paramPanelNode = function (_editorRef$current$ge3, _editorRef$current17, _boxRef$current) {
|
|
865
879
|
if (!paramEdit || !renderParamPanel) return null;
|
|
866
|
-
var chips = (_editorRef$current$ge3 = (_editorRef$
|
|
880
|
+
var chips = (_editorRef$current$ge3 = (_editorRef$current17 = editorRef.current) === null || _editorRef$current17 === void 0 ? void 0 : _editorRef$current17.getChips()) !== null && _editorRef$current$ge3 !== void 0 ? _editorRef$current$ge3 : [];
|
|
867
881
|
var chip = chips.find(function (c) {
|
|
868
882
|
return c.id === paramEdit.chipId;
|
|
869
883
|
});
|
|
@@ -873,8 +887,8 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
873
887
|
chip: chip,
|
|
874
888
|
anchor: paramEdit.anchor,
|
|
875
889
|
onApply: function onApply(patch) {
|
|
876
|
-
var _editorRef$
|
|
877
|
-
(_editorRef$
|
|
890
|
+
var _editorRef$current18;
|
|
891
|
+
(_editorRef$current18 = editorRef.current) === null || _editorRef$current18 === void 0 || _editorRef$current18.updateChipData(chip.id, patch);
|
|
878
892
|
},
|
|
879
893
|
onClose: closeParamPanel
|
|
880
894
|
};
|
|
@@ -938,8 +952,8 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
938
952
|
visible: triggerMenuVisible,
|
|
939
953
|
onVisibleChange: function onVisibleChange(v) {
|
|
940
954
|
if (!v) {
|
|
941
|
-
var _editorRef$
|
|
942
|
-
(_editorRef$
|
|
955
|
+
var _editorRef$current19;
|
|
956
|
+
(_editorRef$current19 = editorRef.current) === null || _editorRef$current19 === void 0 || _editorRef$current19.cancelTrigger();
|
|
943
957
|
setTriggerInfo(null);
|
|
944
958
|
}
|
|
945
959
|
},
|