@lvce-editor/chat-view 1.1.0 → 1.2.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/dist/chatViewWorkerMain.js +7 -55
- package/package.json +1 -1
|
@@ -1206,8 +1206,6 @@ const createDefaultState = () => {
|
|
|
1206
1206
|
messages: [],
|
|
1207
1207
|
title: 'Chat 1'
|
|
1208
1208
|
}],
|
|
1209
|
-
statusBarItemsLeft: [],
|
|
1210
|
-
statusBarItemsRight: [],
|
|
1211
1209
|
uid: 0,
|
|
1212
1210
|
warningCount: 0
|
|
1213
1211
|
};
|
|
@@ -1262,6 +1260,10 @@ const diff2 = uid => {
|
|
|
1262
1260
|
return result;
|
|
1263
1261
|
};
|
|
1264
1262
|
|
|
1263
|
+
const getKeyBindings = () => {
|
|
1264
|
+
return [];
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1265
1267
|
const CREATE_SESSION = 'create-session';
|
|
1266
1268
|
const SESSION_PREFIX = 'session:';
|
|
1267
1269
|
const RENAME_PREFIX = 'session-rename:';
|
|
@@ -1476,51 +1478,6 @@ const initialize = async () => {
|
|
|
1476
1478
|
set$2(rpc);
|
|
1477
1479
|
};
|
|
1478
1480
|
|
|
1479
|
-
const getIndex = (items, item) => {
|
|
1480
|
-
for (let i = 0; i < items.length; i++) {
|
|
1481
|
-
if (items[i].name === item.name) {
|
|
1482
|
-
return i;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
return -1;
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
const updateArray = (items, newItem) => {
|
|
1489
|
-
const index = getIndex(items, newItem);
|
|
1490
|
-
const before = items.slice(0, index);
|
|
1491
|
-
const after = items.slice(index + 1);
|
|
1492
|
-
return [...before, newItem, ...after];
|
|
1493
|
-
};
|
|
1494
|
-
|
|
1495
|
-
const itemLeftUpdate = (state, newItem) => {
|
|
1496
|
-
return {
|
|
1497
|
-
...state,
|
|
1498
|
-
statusBarItemsLeft: updateArray([...state.statusBarItemsLeft], newItem)
|
|
1499
|
-
};
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
const itemRightCreate = (state, newItem) => {
|
|
1503
|
-
const {
|
|
1504
|
-
statusBarItemsRight
|
|
1505
|
-
} = state;
|
|
1506
|
-
const newStatusBarItemsRight = [...statusBarItemsRight, newItem];
|
|
1507
|
-
return {
|
|
1508
|
-
...state,
|
|
1509
|
-
statusBarItemsRight: newStatusBarItemsRight
|
|
1510
|
-
};
|
|
1511
|
-
};
|
|
1512
|
-
|
|
1513
|
-
const itemRightUpdate = (state, newItem) => {
|
|
1514
|
-
const {
|
|
1515
|
-
statusBarItemsRight
|
|
1516
|
-
} = state;
|
|
1517
|
-
const newStatusBarItemsRight = updateArray([...statusBarItemsRight], newItem);
|
|
1518
|
-
return {
|
|
1519
|
-
...state,
|
|
1520
|
-
statusBarItemsRight: newStatusBarItemsRight
|
|
1521
|
-
};
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
1481
|
const ensureSessions = state => {
|
|
1525
1482
|
if (state.sessions.length > 0) {
|
|
1526
1483
|
return state.sessions;
|
|
@@ -2062,14 +2019,10 @@ const saveState = state => {
|
|
|
2062
2019
|
nextSessionId,
|
|
2063
2020
|
renamingSessionId,
|
|
2064
2021
|
selectedSessionId,
|
|
2065
|
-
sessions
|
|
2066
|
-
statusBarItemsLeft,
|
|
2067
|
-
statusBarItemsRight
|
|
2022
|
+
sessions
|
|
2068
2023
|
} = state;
|
|
2069
2024
|
return {
|
|
2070
2025
|
composerValue,
|
|
2071
|
-
itemsLeft: statusBarItemsLeft,
|
|
2072
|
-
itemsRight: statusBarItemsRight,
|
|
2073
2026
|
nextMessageId,
|
|
2074
2027
|
nextSessionId,
|
|
2075
2028
|
renamingSessionId,
|
|
@@ -2082,14 +2035,13 @@ const commandMap = {
|
|
|
2082
2035
|
'Chat.create': create,
|
|
2083
2036
|
'Chat.diff2': diff2,
|
|
2084
2037
|
'Chat.getCommandIds': getCommandIds,
|
|
2038
|
+
'Chat.getKeyBindings': getKeyBindings,
|
|
2085
2039
|
'Chat.handleClick': wrapCommand(handleClick),
|
|
2086
2040
|
'Chat.handleInput': wrapCommand(handleInput),
|
|
2087
2041
|
'Chat.handleKeyDown': wrapCommand(handleKeyDown),
|
|
2088
2042
|
'Chat.initialize': initialize,
|
|
2089
|
-
'Chat.itemLeftUpdate': wrapCommand(itemLeftUpdate),
|
|
2090
|
-
'Chat.itemRightCreate': wrapCommand(itemRightCreate),
|
|
2091
|
-
'Chat.itemRightUpdate': wrapCommand(itemRightUpdate),
|
|
2092
2043
|
'Chat.loadContent': wrapCommand(loadContent),
|
|
2044
|
+
'Chat.loadContent2': wrapCommand(loadContent),
|
|
2093
2045
|
'Chat.render2': render2,
|
|
2094
2046
|
'Chat.renderEventListeners': renderEventListeners,
|
|
2095
2047
|
'Chat.resize': wrapCommand(resize),
|