@lvce-editor/main-area-worker 9.37.4 → 9.37.6
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/mainAreaWorkerMain.js +377 -389
- package/package.json +1 -1
|
@@ -54,6 +54,61 @@ class VError extends Error {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
class AssertionError extends Error {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'AssertionError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String$1 = 4;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown = 8;
|
|
71
|
+
const getType = value => {
|
|
72
|
+
switch (typeof value) {
|
|
73
|
+
case 'number':
|
|
74
|
+
return Number$1;
|
|
75
|
+
case 'function':
|
|
76
|
+
return Function;
|
|
77
|
+
case 'string':
|
|
78
|
+
return String$1;
|
|
79
|
+
case 'object':
|
|
80
|
+
if (value === null) {
|
|
81
|
+
return Null;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
return Array$1;
|
|
85
|
+
}
|
|
86
|
+
return Object$1;
|
|
87
|
+
case 'boolean':
|
|
88
|
+
return Boolean$1;
|
|
89
|
+
default:
|
|
90
|
+
return Unknown;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const object = value => {
|
|
94
|
+
const type = getType(value);
|
|
95
|
+
if (type !== Object$1) {
|
|
96
|
+
throw new AssertionError('expected value to be of type object');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const number = value => {
|
|
100
|
+
const type = getType(value);
|
|
101
|
+
if (type !== Number$1) {
|
|
102
|
+
throw new AssertionError('expected value to be of type number');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const string = value => {
|
|
106
|
+
const type = getType(value);
|
|
107
|
+
if (type !== String$1) {
|
|
108
|
+
throw new AssertionError('expected value to be of type string');
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
57
112
|
const isMessagePort = value => {
|
|
58
113
|
return value && value instanceof MessagePort;
|
|
59
114
|
};
|
|
@@ -1074,41 +1129,6 @@ const create$b = async ({
|
|
|
1074
1129
|
return rpc;
|
|
1075
1130
|
};
|
|
1076
1131
|
|
|
1077
|
-
const create$a = async ({
|
|
1078
|
-
commandMap,
|
|
1079
|
-
isMessagePortOpen = true,
|
|
1080
|
-
messagePort
|
|
1081
|
-
}) => {
|
|
1082
|
-
// TODO create a commandMap per rpc instance
|
|
1083
|
-
register(commandMap);
|
|
1084
|
-
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1085
|
-
isMessagePortOpen,
|
|
1086
|
-
messagePort
|
|
1087
|
-
});
|
|
1088
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1089
|
-
handleIpc(ipc);
|
|
1090
|
-
const rpc = createRpc(ipc);
|
|
1091
|
-
messagePort.start();
|
|
1092
|
-
return rpc;
|
|
1093
|
-
};
|
|
1094
|
-
|
|
1095
|
-
const create$9 = async ({
|
|
1096
|
-
commandMap,
|
|
1097
|
-
isMessagePortOpen,
|
|
1098
|
-
send
|
|
1099
|
-
}) => {
|
|
1100
|
-
const {
|
|
1101
|
-
port1,
|
|
1102
|
-
port2
|
|
1103
|
-
} = new MessageChannel();
|
|
1104
|
-
await send(port1);
|
|
1105
|
-
return create$a({
|
|
1106
|
-
commandMap,
|
|
1107
|
-
isMessagePortOpen,
|
|
1108
|
-
messagePort: port2
|
|
1109
|
-
});
|
|
1110
|
-
};
|
|
1111
|
-
|
|
1112
1132
|
const createSharedLazyRpc = factory => {
|
|
1113
1133
|
let rpcPromise;
|
|
1114
1134
|
const getOrCreate = () => {
|
|
@@ -1137,7 +1157,7 @@ const createSharedLazyRpc = factory => {
|
|
|
1137
1157
|
};
|
|
1138
1158
|
};
|
|
1139
1159
|
|
|
1140
|
-
const create$
|
|
1160
|
+
const create$a = async ({
|
|
1141
1161
|
commandMap,
|
|
1142
1162
|
getPortTuple,
|
|
1143
1163
|
send
|
|
@@ -1154,13 +1174,13 @@ const create$8 = async ({
|
|
|
1154
1174
|
return rpc;
|
|
1155
1175
|
};
|
|
1156
1176
|
|
|
1157
|
-
const create$
|
|
1177
|
+
const create$9 = async ({
|
|
1158
1178
|
commandMap,
|
|
1159
1179
|
getPortTuple,
|
|
1160
1180
|
send
|
|
1161
1181
|
}) => {
|
|
1162
1182
|
return createSharedLazyRpc(() => {
|
|
1163
|
-
return create$
|
|
1183
|
+
return create$a({
|
|
1164
1184
|
commandMap,
|
|
1165
1185
|
getPortTuple,
|
|
1166
1186
|
send
|
|
@@ -1168,13 +1188,48 @@ const create$7 = async ({
|
|
|
1168
1188
|
});
|
|
1169
1189
|
};
|
|
1170
1190
|
|
|
1191
|
+
const create$8 = async ({
|
|
1192
|
+
commandMap,
|
|
1193
|
+
isMessagePortOpen = true,
|
|
1194
|
+
messagePort
|
|
1195
|
+
}) => {
|
|
1196
|
+
// TODO create a commandMap per rpc instance
|
|
1197
|
+
register(commandMap);
|
|
1198
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1199
|
+
isMessagePortOpen,
|
|
1200
|
+
messagePort
|
|
1201
|
+
});
|
|
1202
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1203
|
+
handleIpc(ipc);
|
|
1204
|
+
const rpc = createRpc(ipc);
|
|
1205
|
+
messagePort.start();
|
|
1206
|
+
return rpc;
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
const create$7 = async ({
|
|
1210
|
+
commandMap,
|
|
1211
|
+
isMessagePortOpen,
|
|
1212
|
+
send
|
|
1213
|
+
}) => {
|
|
1214
|
+
const {
|
|
1215
|
+
port1,
|
|
1216
|
+
port2
|
|
1217
|
+
} = new MessageChannel();
|
|
1218
|
+
await send(port1);
|
|
1219
|
+
return create$8({
|
|
1220
|
+
commandMap,
|
|
1221
|
+
isMessagePortOpen,
|
|
1222
|
+
messagePort: port2
|
|
1223
|
+
});
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1171
1226
|
const create$6 = async ({
|
|
1172
1227
|
commandMap,
|
|
1173
1228
|
isMessagePortOpen,
|
|
1174
1229
|
send
|
|
1175
1230
|
}) => {
|
|
1176
1231
|
return createSharedLazyRpc(() => {
|
|
1177
|
-
return create$
|
|
1232
|
+
return create$7({
|
|
1178
1233
|
commandMap,
|
|
1179
1234
|
isMessagePortOpen,
|
|
1180
1235
|
send
|
|
@@ -1214,7 +1269,7 @@ const createMockRpc = ({
|
|
|
1214
1269
|
};
|
|
1215
1270
|
|
|
1216
1271
|
const rpcs = Object.create(null);
|
|
1217
|
-
const set$
|
|
1272
|
+
const set$6 = (id, rpc) => {
|
|
1218
1273
|
rpcs[id] = rpc;
|
|
1219
1274
|
};
|
|
1220
1275
|
const get$1 = id => {
|
|
@@ -1247,7 +1302,7 @@ const create$4 = rpcId => {
|
|
|
1247
1302
|
const mockRpc = createMockRpc({
|
|
1248
1303
|
commandMap
|
|
1249
1304
|
});
|
|
1250
|
-
set$
|
|
1305
|
+
set$6(rpcId, mockRpc);
|
|
1251
1306
|
// @ts-ignore
|
|
1252
1307
|
mockRpc[Symbol.dispose] = () => {
|
|
1253
1308
|
remove(rpcId);
|
|
@@ -1256,7 +1311,7 @@ const create$4 = rpcId => {
|
|
|
1256
1311
|
return mockRpc;
|
|
1257
1312
|
},
|
|
1258
1313
|
set(rpc) {
|
|
1259
|
-
set$
|
|
1314
|
+
set$6(rpcId, rpc);
|
|
1260
1315
|
}
|
|
1261
1316
|
};
|
|
1262
1317
|
};
|
|
@@ -1438,7 +1493,6 @@ const VirtualDomElements = {
|
|
|
1438
1493
|
const Button$1 = 'event.button';
|
|
1439
1494
|
const ClientX = 'event.clientX';
|
|
1440
1495
|
const ClientY = 'event.clientY';
|
|
1441
|
-
const DataTransferFiles = 'event.dataTransfer.files';
|
|
1442
1496
|
const DataTransferFiles2 = 'event.dataTransfer.files2';
|
|
1443
1497
|
const EventTargetClassName = 'event.target.className';
|
|
1444
1498
|
const TargetName = 'event.target.name';
|
|
@@ -1453,11 +1507,11 @@ const Add$1 = 6;
|
|
|
1453
1507
|
const NavigateChild$1 = 7;
|
|
1454
1508
|
const NavigateParent$1 = 8;
|
|
1455
1509
|
|
|
1456
|
-
const Web = 1;
|
|
1457
1510
|
const Electron = 2;
|
|
1458
1511
|
|
|
1459
1512
|
const ClipBoardWorker = 3400;
|
|
1460
1513
|
const DialogWorker = 7014;
|
|
1514
|
+
const DragAndDropWorker = 3404;
|
|
1461
1515
|
const IconThemeWorker = 7009;
|
|
1462
1516
|
const RendererWorker = 1;
|
|
1463
1517
|
|
|
@@ -1468,17 +1522,25 @@ const SetPatches = 'Viewlet.setPatches';
|
|
|
1468
1522
|
const FocusEditorText = 12;
|
|
1469
1523
|
|
|
1470
1524
|
const {
|
|
1471
|
-
invoke: invoke$
|
|
1472
|
-
set: set$
|
|
1525
|
+
invoke: invoke$4,
|
|
1526
|
+
set: set$5
|
|
1473
1527
|
} = create$4(ClipBoardWorker);
|
|
1474
1528
|
const writeText = async text => {
|
|
1475
|
-
return invoke$
|
|
1529
|
+
return invoke$4('ClipBoard.writeText', text);
|
|
1476
1530
|
};
|
|
1477
1531
|
|
|
1532
|
+
const {
|
|
1533
|
+
invoke: invoke$3,
|
|
1534
|
+
set: set$4
|
|
1535
|
+
} = create$4(DialogWorker);
|
|
1536
|
+
|
|
1478
1537
|
const {
|
|
1479
1538
|
invoke: invoke$2,
|
|
1480
1539
|
set: set$3
|
|
1481
|
-
} = create$4(
|
|
1540
|
+
} = create$4(DragAndDropWorker);
|
|
1541
|
+
const getDroppedItems = async (itemIds, isElectron) => {
|
|
1542
|
+
return invoke$2('DragAndDrop.getDroppedItems', itemIds, isElectron);
|
|
1543
|
+
};
|
|
1482
1544
|
|
|
1483
1545
|
const {
|
|
1484
1546
|
invoke: invoke$1,
|
|
@@ -1489,61 +1551,6 @@ const getIcons = async iconRequests => {
|
|
|
1489
1551
|
return invoke$1('IconTheme.getIcons', iconRequests);
|
|
1490
1552
|
};
|
|
1491
1553
|
|
|
1492
|
-
class AssertionError extends Error {
|
|
1493
|
-
constructor(message) {
|
|
1494
|
-
super(message);
|
|
1495
|
-
this.name = 'AssertionError';
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
const Object$1 = 1;
|
|
1499
|
-
const Number$1 = 2;
|
|
1500
|
-
const Array$1 = 3;
|
|
1501
|
-
const String$1 = 4;
|
|
1502
|
-
const Boolean$1 = 5;
|
|
1503
|
-
const Function = 6;
|
|
1504
|
-
const Null = 7;
|
|
1505
|
-
const Unknown = 8;
|
|
1506
|
-
const getType = value => {
|
|
1507
|
-
switch (typeof value) {
|
|
1508
|
-
case 'number':
|
|
1509
|
-
return Number$1;
|
|
1510
|
-
case 'function':
|
|
1511
|
-
return Function;
|
|
1512
|
-
case 'string':
|
|
1513
|
-
return String$1;
|
|
1514
|
-
case 'object':
|
|
1515
|
-
if (value === null) {
|
|
1516
|
-
return Null;
|
|
1517
|
-
}
|
|
1518
|
-
if (Array.isArray(value)) {
|
|
1519
|
-
return Array$1;
|
|
1520
|
-
}
|
|
1521
|
-
return Object$1;
|
|
1522
|
-
case 'boolean':
|
|
1523
|
-
return Boolean$1;
|
|
1524
|
-
default:
|
|
1525
|
-
return Unknown;
|
|
1526
|
-
}
|
|
1527
|
-
};
|
|
1528
|
-
const object = value => {
|
|
1529
|
-
const type = getType(value);
|
|
1530
|
-
if (type !== Object$1) {
|
|
1531
|
-
throw new AssertionError('expected value to be of type object');
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
const number = value => {
|
|
1535
|
-
const type = getType(value);
|
|
1536
|
-
if (type !== Number$1) {
|
|
1537
|
-
throw new AssertionError('expected value to be of type number');
|
|
1538
|
-
}
|
|
1539
|
-
};
|
|
1540
|
-
const string = value => {
|
|
1541
|
-
const type = getType(value);
|
|
1542
|
-
if (type !== String$1) {
|
|
1543
|
-
throw new AssertionError('expected value to be of type string');
|
|
1544
|
-
}
|
|
1545
|
-
};
|
|
1546
|
-
|
|
1547
1554
|
const {
|
|
1548
1555
|
invoke,
|
|
1549
1556
|
invokeAndTransfer,
|
|
@@ -1559,14 +1566,14 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1559
1566
|
number(y);
|
|
1560
1567
|
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1561
1568
|
};
|
|
1562
|
-
const getFileHandles = async fileIds => {
|
|
1563
|
-
const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
|
|
1564
|
-
return files;
|
|
1565
|
-
};
|
|
1566
1569
|
const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
|
|
1567
1570
|
const command = 'ClipBoard.handleMessagePort';
|
|
1568
1571
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
1569
1572
|
};
|
|
1573
|
+
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1574
|
+
const command = 'DragAndDrop.handleMessagePort';
|
|
1575
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDragAndDropWorker', port, command);
|
|
1576
|
+
};
|
|
1570
1577
|
const sendMessagePortToDialogWorker = async port => {
|
|
1571
1578
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1572
1579
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
@@ -1962,7 +1969,7 @@ const handleAttach = async command => {
|
|
|
1962
1969
|
await invoke('Layout.attachViewlet', parentNodeSelector, command.instanceId);
|
|
1963
1970
|
};
|
|
1964
1971
|
|
|
1965
|
-
const
|
|
1972
|
+
const getViewletTitle = async editorUid => {
|
|
1966
1973
|
try {
|
|
1967
1974
|
const title = await invoke('Viewlet.getTitle', editorUid);
|
|
1968
1975
|
return typeof title === 'string' && title ? title : undefined;
|
|
@@ -1970,13 +1977,16 @@ const getTitle$1 = async editorUid => {
|
|
|
1970
1977
|
return undefined;
|
|
1971
1978
|
}
|
|
1972
1979
|
};
|
|
1973
|
-
const
|
|
1980
|
+
const createViewletContent = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
|
|
1974
1981
|
if (args === undefined) {
|
|
1975
1982
|
await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
|
|
1976
1983
|
} else {
|
|
1977
1984
|
await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri, args);
|
|
1978
1985
|
}
|
|
1979
|
-
|
|
1986
|
+
};
|
|
1987
|
+
const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
|
|
1988
|
+
await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, args);
|
|
1989
|
+
return getViewletTitle(editorUid);
|
|
1980
1990
|
};
|
|
1981
1991
|
|
|
1982
1992
|
const getActiveFileUri = state => {
|
|
@@ -2416,7 +2426,7 @@ const saveEditor = async editorUid => {
|
|
|
2416
2426
|
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
2417
2427
|
const confirm = async (message, options) => {
|
|
2418
2428
|
try {
|
|
2419
|
-
return await invoke$
|
|
2429
|
+
return await invoke$3('ConfirmPrompt.prompt', message, options);
|
|
2420
2430
|
} catch (error) {
|
|
2421
2431
|
if (!String(error).includes(missingDialogWorkerRelay)) {
|
|
2422
2432
|
throw error;
|
|
@@ -4208,6 +4218,13 @@ const updateTabIcon = async (context, readyState, tabId) => {
|
|
|
4208
4218
|
}
|
|
4209
4219
|
};
|
|
4210
4220
|
|
|
4221
|
+
const renderMainAreaPending = async uid => {
|
|
4222
|
+
try {
|
|
4223
|
+
await invoke('Layout.renderMainAreaPending', uid);
|
|
4224
|
+
} catch {
|
|
4225
|
+
// Older renderer workers render the final state when openInput completes.
|
|
4226
|
+
}
|
|
4227
|
+
};
|
|
4211
4228
|
const getExistingTabState = (state, existingTab, preview) => {
|
|
4212
4229
|
const focusedState = focusEditorGroup(state, existingTab.groupId);
|
|
4213
4230
|
const pinnedState = !preview && existingTab.tab.isPreview ? updateTab(focusedState, existingTab.tab.id, {
|
|
@@ -4239,7 +4256,7 @@ const openInputWithContext = async (context, options) => {
|
|
|
4239
4256
|
const title = getEditorInputTitle(editorInput);
|
|
4240
4257
|
const editorType = getEditorInputEditorType(editorInput);
|
|
4241
4258
|
const currentState = state;
|
|
4242
|
-
const existingTab = findTabByUri(currentState, uri);
|
|
4259
|
+
const existingTab = options.reuseExisting === false ? undefined : findTabByUri(currentState, uri);
|
|
4243
4260
|
const shouldRetryExistingTab = !!existingTab && existingTab.tab.loadingState === 'error';
|
|
4244
4261
|
if (existingTab && !shouldRetryExistingTab) {
|
|
4245
4262
|
const switchedState = getExistingTabState(currentState, existingTab, preview);
|
|
@@ -4299,10 +4316,16 @@ const openInputWithContext = async (context, options) => {
|
|
|
4299
4316
|
if (editorUid === -1) {
|
|
4300
4317
|
throw new Error('invalid editorUid');
|
|
4301
4318
|
}
|
|
4302
|
-
|
|
4319
|
+
await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, options.args);
|
|
4303
4320
|
const latestState = context.getState();
|
|
4304
|
-
|
|
4321
|
+
let readyState = handleViewletReady(latestState, editorUid);
|
|
4305
4322
|
await context.updateState(() => readyState);
|
|
4323
|
+
await renderMainAreaPending(state.uid);
|
|
4324
|
+
const renderedTitle = await getViewletTitle(editorUid);
|
|
4325
|
+
if (renderedTitle) {
|
|
4326
|
+
readyState = handleViewletReady(context.getState(), editorUid, renderedTitle);
|
|
4327
|
+
await context.updateState(() => readyState);
|
|
4328
|
+
}
|
|
4306
4329
|
const stateWithIcon = await updateTabIcon(context, readyState, tabId);
|
|
4307
4330
|
if (stateWithIcon) {
|
|
4308
4331
|
return;
|
|
@@ -4347,12 +4370,13 @@ const getViewletContext = (options, viewletContext) => {
|
|
|
4347
4370
|
if (viewletContext !== undefined || typeof options === 'string') {
|
|
4348
4371
|
return viewletContext;
|
|
4349
4372
|
}
|
|
4350
|
-
const context = Object.fromEntries(Object.entries(options).filter(([key]) => key !== 'focus' && key !== 'preview' && key !== 'uri'));
|
|
4373
|
+
const context = Object.fromEntries(Object.entries(options).filter(([key]) => key !== 'focus' && key !== 'preview' && key !== 'reuseExisting' && key !== 'uri'));
|
|
4351
4374
|
return Object.keys(context).length === 0 ? undefined : context;
|
|
4352
4375
|
};
|
|
4353
4376
|
const getOpenInputOptions = (options, focus = true, viewletContext) => {
|
|
4354
4377
|
const uri = getOptionUriOptions(options);
|
|
4355
4378
|
const preview = typeof options === 'string' ? false : options.preview ?? false;
|
|
4379
|
+
const reuseExisting = typeof options === 'string' ? true : options.reuseExisting ?? true;
|
|
4356
4380
|
const context = getViewletContext(options, viewletContext);
|
|
4357
4381
|
return {
|
|
4358
4382
|
...(context !== undefined && {
|
|
@@ -4360,7 +4384,8 @@ const getOpenInputOptions = (options, focus = true, viewletContext) => {
|
|
|
4360
4384
|
}),
|
|
4361
4385
|
editorInput: getNormalizedOpenEditorInput(uri),
|
|
4362
4386
|
focus: typeof options === 'string' ? focus : options.focus,
|
|
4363
|
-
preview
|
|
4387
|
+
preview,
|
|
4388
|
+
reuseExisting
|
|
4364
4389
|
};
|
|
4365
4390
|
};
|
|
4366
4391
|
const openUri = async (state, options, focus = true, viewletContext) => {
|
|
@@ -4747,6 +4772,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4747
4772
|
case Down:
|
|
4748
4773
|
return {
|
|
4749
4774
|
height: halfHeight,
|
|
4775
|
+
splitDirection,
|
|
4750
4776
|
width,
|
|
4751
4777
|
x,
|
|
4752
4778
|
y: y + halfHeight
|
|
@@ -4754,6 +4780,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4754
4780
|
case Left:
|
|
4755
4781
|
return {
|
|
4756
4782
|
height,
|
|
4783
|
+
splitDirection,
|
|
4757
4784
|
width: halfWidth,
|
|
4758
4785
|
x,
|
|
4759
4786
|
y
|
|
@@ -4761,6 +4788,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4761
4788
|
case Right:
|
|
4762
4789
|
return {
|
|
4763
4790
|
height,
|
|
4791
|
+
splitDirection,
|
|
4764
4792
|
width: halfWidth,
|
|
4765
4793
|
x: x + halfWidth,
|
|
4766
4794
|
y
|
|
@@ -4768,6 +4796,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4768
4796
|
case Up:
|
|
4769
4797
|
return {
|
|
4770
4798
|
height: halfHeight,
|
|
4799
|
+
splitDirection,
|
|
4771
4800
|
width,
|
|
4772
4801
|
x,
|
|
4773
4802
|
y
|
|
@@ -4775,6 +4804,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4775
4804
|
default:
|
|
4776
4805
|
return {
|
|
4777
4806
|
height,
|
|
4807
|
+
splitDirection,
|
|
4778
4808
|
width,
|
|
4779
4809
|
x,
|
|
4780
4810
|
y
|
|
@@ -4825,7 +4855,7 @@ const getDragOverlay = (state, eventX, eventY) => {
|
|
|
4825
4855
|
};
|
|
4826
4856
|
|
|
4827
4857
|
const isEqual = (oldOverlay, newOverlay) => {
|
|
4828
|
-
return oldOverlay?.x === newOverlay?.x && oldOverlay?.y === newOverlay?.y && oldOverlay?.width === newOverlay?.width && oldOverlay?.height === newOverlay?.height;
|
|
4858
|
+
return oldOverlay?.x === newOverlay?.x && oldOverlay?.y === newOverlay?.y && oldOverlay?.width === newOverlay?.width && oldOverlay?.height === newOverlay?.height && oldOverlay?.splitDirection === newOverlay?.splitDirection;
|
|
4829
4859
|
};
|
|
4830
4860
|
const handleDragOver = (state, eventX, eventY) => {
|
|
4831
4861
|
const {
|
|
@@ -4841,139 +4871,229 @@ const handleDragOver = (state, eventX, eventY) => {
|
|
|
4841
4871
|
};
|
|
4842
4872
|
};
|
|
4843
4873
|
|
|
4844
|
-
const
|
|
4845
|
-
const
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
};
|
|
4852
|
-
|
|
4853
|
-
const isDroppedFileSystemHandle = item => {
|
|
4854
|
-
if (!item || typeof item !== 'object') {
|
|
4855
|
-
return false;
|
|
4856
|
-
}
|
|
4857
|
-
const candidate = item;
|
|
4858
|
-
const handle = candidate.value;
|
|
4859
|
-
return candidate.kind === 'file' && Boolean(handle) && typeof handle === 'object' && (handle.kind === 'directory' || handle.kind === 'file') && typeof handle.name === 'string';
|
|
4860
|
-
};
|
|
4861
|
-
|
|
4862
|
-
const isUriList = item => {
|
|
4863
|
-
if (!item || typeof item !== 'object') {
|
|
4864
|
-
return false;
|
|
4874
|
+
const openUrisWithContext = async (context, uris, reuseExisting = true) => {
|
|
4875
|
+
for (const uri of uris) {
|
|
4876
|
+
await openUriWithContext(context, {
|
|
4877
|
+
focus: true,
|
|
4878
|
+
reuseExisting,
|
|
4879
|
+
uri
|
|
4880
|
+
});
|
|
4865
4881
|
}
|
|
4866
|
-
const candidate = item;
|
|
4867
|
-
return candidate.kind === 'string' && candidate.type === 'text/uri-list' && typeof candidate.value === 'string';
|
|
4868
4882
|
};
|
|
4869
4883
|
|
|
4870
|
-
const
|
|
4871
|
-
const
|
|
4872
|
-
|
|
4873
|
-
};
|
|
4884
|
+
const splitDown$1 = (state, groupId) => {
|
|
4885
|
+
const {
|
|
4886
|
+
layout
|
|
4887
|
+
} = state;
|
|
4888
|
+
const {
|
|
4889
|
+
activeGroupId,
|
|
4890
|
+
direction,
|
|
4891
|
+
groups
|
|
4892
|
+
} = layout;
|
|
4874
4893
|
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4894
|
+
// If there are no groups, create an initial empty group first
|
|
4895
|
+
if (groups.length === 0) {
|
|
4896
|
+
const initialGroupId = create$2();
|
|
4897
|
+
const initialGroup = {
|
|
4898
|
+
activeTabId: -1,
|
|
4899
|
+
direction,
|
|
4900
|
+
focused: true,
|
|
4901
|
+
id: initialGroupId,
|
|
4902
|
+
isEmpty: true,
|
|
4903
|
+
size: 100,
|
|
4904
|
+
tabs: []
|
|
4905
|
+
};
|
|
4906
|
+
const stateWithInitialGroup = {
|
|
4907
|
+
...state,
|
|
4908
|
+
layout: {
|
|
4909
|
+
...layout,
|
|
4910
|
+
activeGroupId: initialGroupId,
|
|
4911
|
+
groups: [initialGroup]
|
|
4912
|
+
}
|
|
4913
|
+
};
|
|
4914
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
|
|
4882
4915
|
}
|
|
4883
|
-
const
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
for (const [index, item] of items.entries()) {
|
|
4887
|
-
if (isUriList(item)) {
|
|
4888
|
-
uris.push(...parseUriList(item.value));
|
|
4889
|
-
continue;
|
|
4890
|
-
}
|
|
4891
|
-
if (isChromiumDragId(item)) {
|
|
4892
|
-
hasChromiumDragId = true;
|
|
4893
|
-
continue;
|
|
4894
|
-
}
|
|
4895
|
-
if (!isDroppedFileSystemHandle(item)) {
|
|
4896
|
-
continue;
|
|
4897
|
-
}
|
|
4898
|
-
const handle = item.value;
|
|
4899
|
-
const suffix = suffixByHandleKind[handle.kind];
|
|
4900
|
-
const uri = `html:///dropped-files/${Date.now()}/${itemIds[index]}/${handle.name}${suffix}`;
|
|
4901
|
-
await invoke('PersistentFileHandle.addHandle', uri, handle);
|
|
4902
|
-
uris.push(uri);
|
|
4903
|
-
}
|
|
4904
|
-
if (uris.length > 0 || !hasChromiumDragId) {
|
|
4905
|
-
return uris;
|
|
4906
|
-
}
|
|
4907
|
-
const dragInfo = await invoke('Viewlet.getDragData');
|
|
4908
|
-
if (!dragInfo || typeof dragInfo !== 'object' || !Array.isArray(dragInfo.items)) {
|
|
4909
|
-
return uris;
|
|
4910
|
-
}
|
|
4911
|
-
for (const item of dragInfo.items) {
|
|
4912
|
-
const candidate = item;
|
|
4913
|
-
if (candidate.type === 'text/uri-list' && typeof candidate.data === 'string') {
|
|
4914
|
-
uris.push(...parseUriList(candidate.data));
|
|
4915
|
-
}
|
|
4916
|
+
const resolvedGroupId = groupId ?? activeGroupId;
|
|
4917
|
+
if (!resolvedGroupId) {
|
|
4918
|
+
return state;
|
|
4916
4919
|
}
|
|
4917
|
-
return
|
|
4920
|
+
return splitEditorGroup$1(state, resolvedGroupId, 'down');
|
|
4918
4921
|
};
|
|
4919
4922
|
|
|
4920
|
-
const
|
|
4921
|
-
const
|
|
4922
|
-
|
|
4923
|
-
};
|
|
4924
|
-
const
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4923
|
+
const splitLeft$1 = (state, groupId) => {
|
|
4924
|
+
const {
|
|
4925
|
+
layout
|
|
4926
|
+
} = state;
|
|
4927
|
+
const {
|
|
4928
|
+
activeGroupId,
|
|
4929
|
+
direction,
|
|
4930
|
+
groups
|
|
4931
|
+
} = layout;
|
|
4932
|
+
if (groups.length === 0) {
|
|
4933
|
+
const initialGroupId = create$2();
|
|
4934
|
+
const initialGroup = {
|
|
4935
|
+
activeTabId: -1,
|
|
4936
|
+
direction,
|
|
4937
|
+
focused: true,
|
|
4938
|
+
id: initialGroupId,
|
|
4939
|
+
isEmpty: true,
|
|
4940
|
+
size: 100,
|
|
4941
|
+
tabs: []
|
|
4942
|
+
};
|
|
4943
|
+
const stateWithInitialGroup = {
|
|
4944
|
+
...state,
|
|
4945
|
+
layout: {
|
|
4946
|
+
...layout,
|
|
4947
|
+
activeGroupId: initialGroupId,
|
|
4948
|
+
groups: [initialGroup]
|
|
4949
|
+
}
|
|
4950
|
+
};
|
|
4951
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left$1);
|
|
4931
4952
|
}
|
|
4932
|
-
|
|
4953
|
+
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
4954
|
+
return splitEditorGroup$1(state, targetGroupId, Left$1);
|
|
4933
4955
|
};
|
|
4934
4956
|
|
|
4935
|
-
const
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
}
|
|
4939
|
-
const
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4957
|
+
const splitRight$1 = (state, groupId) => {
|
|
4958
|
+
const {
|
|
4959
|
+
layout
|
|
4960
|
+
} = state;
|
|
4961
|
+
const {
|
|
4962
|
+
activeGroupId,
|
|
4963
|
+
direction,
|
|
4964
|
+
groups
|
|
4965
|
+
} = layout;
|
|
4966
|
+
|
|
4967
|
+
// If there are no groups, create an initial empty group first
|
|
4968
|
+
if (groups.length === 0) {
|
|
4969
|
+
const initialGroupId = create$2();
|
|
4970
|
+
const initialGroup = {
|
|
4971
|
+
activeTabId: -1,
|
|
4972
|
+
direction,
|
|
4973
|
+
focused: true,
|
|
4974
|
+
id: initialGroupId,
|
|
4975
|
+
isEmpty: true,
|
|
4976
|
+
size: 100,
|
|
4977
|
+
tabs: []
|
|
4978
|
+
};
|
|
4979
|
+
const stateWithInitialGroup = {
|
|
4980
|
+
...state,
|
|
4981
|
+
layout: {
|
|
4982
|
+
...layout,
|
|
4983
|
+
activeGroupId: initialGroupId,
|
|
4984
|
+
groups: [initialGroup]
|
|
4985
|
+
}
|
|
4986
|
+
};
|
|
4987
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right$1);
|
|
4943
4988
|
}
|
|
4944
|
-
|
|
4989
|
+
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
4990
|
+
return splitEditorGroup$1(state, targetGroupId, Right$1);
|
|
4945
4991
|
};
|
|
4946
4992
|
|
|
4947
|
-
const
|
|
4948
|
-
|
|
4949
|
-
|
|
4993
|
+
const splitUp$1 = (state, groupId) => {
|
|
4994
|
+
const {
|
|
4995
|
+
layout
|
|
4996
|
+
} = state;
|
|
4997
|
+
const {
|
|
4998
|
+
activeGroupId,
|
|
4999
|
+
direction,
|
|
5000
|
+
groups
|
|
5001
|
+
} = layout;
|
|
5002
|
+
if (groups.length === 0) {
|
|
5003
|
+
const initialGroupId = create$2();
|
|
5004
|
+
const initialGroup = {
|
|
5005
|
+
activeTabId: -1,
|
|
5006
|
+
direction,
|
|
5007
|
+
focused: true,
|
|
5008
|
+
id: initialGroupId,
|
|
5009
|
+
isEmpty: true,
|
|
5010
|
+
size: 100,
|
|
5011
|
+
tabs: []
|
|
5012
|
+
};
|
|
5013
|
+
const stateWithInitialGroup = {
|
|
5014
|
+
...state,
|
|
5015
|
+
layout: {
|
|
5016
|
+
...layout,
|
|
5017
|
+
activeGroupId: initialGroupId,
|
|
5018
|
+
groups: [initialGroup]
|
|
5019
|
+
}
|
|
5020
|
+
};
|
|
5021
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
|
|
5022
|
+
}
|
|
5023
|
+
const resolvedGroupId = groupId ?? activeGroupId;
|
|
5024
|
+
if (!resolvedGroupId) {
|
|
5025
|
+
return state;
|
|
4950
5026
|
}
|
|
4951
|
-
return
|
|
5027
|
+
return splitEditorGroup$1(state, resolvedGroupId, 'up');
|
|
4952
5028
|
};
|
|
4953
5029
|
|
|
4954
|
-
const
|
|
4955
|
-
|
|
4956
|
-
|
|
5030
|
+
const splitForDrop = (state, splitDirection) => {
|
|
5031
|
+
switch (splitDirection) {
|
|
5032
|
+
case Down:
|
|
5033
|
+
return splitDown$1(state);
|
|
5034
|
+
case Left:
|
|
5035
|
+
return splitLeft$1(state);
|
|
5036
|
+
case Right:
|
|
5037
|
+
return splitRight$1(state);
|
|
5038
|
+
case Up:
|
|
5039
|
+
return splitUp$1(state);
|
|
5040
|
+
default:
|
|
5041
|
+
return state;
|
|
4957
5042
|
}
|
|
4958
5043
|
};
|
|
4959
|
-
|
|
4960
|
-
const handleDrop = async (context, itemIds, files = []) => {
|
|
4961
|
-
await context.updateState(handleDragLeave);
|
|
4962
|
-
const {
|
|
4963
|
-
platform
|
|
4964
|
-
} = context.getState();
|
|
4965
|
-
const uris = await getDroppedUris(itemIds, files, platform);
|
|
5044
|
+
const getDropAction = async uris => {
|
|
4966
5045
|
for (const uri of uris) {
|
|
4967
5046
|
if (uri.endsWith('/') || (await isDirectoryEditorInput({
|
|
4968
5047
|
type: 'editor',
|
|
4969
5048
|
uri
|
|
4970
5049
|
}))) {
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
5050
|
+
if (uri.startsWith('file://')) {
|
|
5051
|
+
return {
|
|
5052
|
+
command: 'setUri',
|
|
5053
|
+
value: uri
|
|
5054
|
+
};
|
|
5055
|
+
}
|
|
5056
|
+
return {
|
|
5057
|
+
command: 'setPath',
|
|
5058
|
+
value: uri
|
|
5059
|
+
};
|
|
4974
5060
|
}
|
|
4975
5061
|
}
|
|
4976
|
-
|
|
5062
|
+
return {
|
|
5063
|
+
command: 'openFiles',
|
|
5064
|
+
uris
|
|
5065
|
+
};
|
|
5066
|
+
};
|
|
5067
|
+
const applyDropAction = async (context, action, splitDirection) => {
|
|
5068
|
+
switch (action.command) {
|
|
5069
|
+
case 'openFiles':
|
|
5070
|
+
{
|
|
5071
|
+
if (action.uris.length > 0 && splitDirection !== None) {
|
|
5072
|
+
await context.updateState(state => splitForDrop(state, splitDirection));
|
|
5073
|
+
}
|
|
5074
|
+
await openUrisWithContext(context, action.uris, splitDirection === None);
|
|
5075
|
+
break;
|
|
5076
|
+
}
|
|
5077
|
+
case 'setPath':
|
|
5078
|
+
void invoke('Workspace.setPath', action.value).catch(() => {});
|
|
5079
|
+
break;
|
|
5080
|
+
case 'setUri':
|
|
5081
|
+
void invoke('Workspace.setUri', action.value).catch(() => {});
|
|
5082
|
+
break;
|
|
5083
|
+
}
|
|
5084
|
+
};
|
|
5085
|
+
const handleDrop = async (context, itemIds) => {
|
|
5086
|
+
const splitDirection = context.getState().dragOverlay?.splitDirection ?? None;
|
|
5087
|
+
await context.updateState(handleDragLeave);
|
|
5088
|
+
const {
|
|
5089
|
+
platform
|
|
5090
|
+
} = context.getState();
|
|
5091
|
+
const isElectron = platform === Electron;
|
|
5092
|
+
const {
|
|
5093
|
+
uris
|
|
5094
|
+
} = await getDroppedItems(itemIds, isElectron);
|
|
5095
|
+
const actions = await getDropAction(uris);
|
|
5096
|
+
await applyDropAction(context, actions, splitDirection);
|
|
4977
5097
|
};
|
|
4978
5098
|
|
|
4979
5099
|
const EditorGroupHeader = 'EditorGroupHeader';
|
|
@@ -6008,16 +6128,16 @@ const Retry = 'Retry';
|
|
|
6008
6128
|
const openFile = () => {
|
|
6009
6129
|
return i18nString(OpenFile);
|
|
6010
6130
|
};
|
|
6011
|
-
const splitUp
|
|
6131
|
+
const splitUp = () => {
|
|
6012
6132
|
return i18nString(SplitUp);
|
|
6013
6133
|
};
|
|
6014
|
-
const splitDown
|
|
6134
|
+
const splitDown = () => {
|
|
6015
6135
|
return i18nString(SplitDown);
|
|
6016
6136
|
};
|
|
6017
|
-
const splitLeft
|
|
6137
|
+
const splitLeft = () => {
|
|
6018
6138
|
return i18nString(SplitLeft);
|
|
6019
6139
|
};
|
|
6020
|
-
const splitRight
|
|
6140
|
+
const splitRight = () => {
|
|
6021
6141
|
return i18nString(SplitRight);
|
|
6022
6142
|
};
|
|
6023
6143
|
const splitEditorGroup = () => {
|
|
@@ -6133,25 +6253,25 @@ const getMenuEntries$2 = (state, groupId) => {
|
|
|
6133
6253
|
command: 'Main.splitUp',
|
|
6134
6254
|
flags: None$1,
|
|
6135
6255
|
id: 'splitUp',
|
|
6136
|
-
label: splitUp
|
|
6256
|
+
label: splitUp()
|
|
6137
6257
|
}, {
|
|
6138
6258
|
args: groupArgs,
|
|
6139
6259
|
command: 'Main.splitDown',
|
|
6140
6260
|
flags: None$1,
|
|
6141
6261
|
id: 'splitDown',
|
|
6142
|
-
label: splitDown
|
|
6262
|
+
label: splitDown()
|
|
6143
6263
|
}, {
|
|
6144
6264
|
args: groupArgs,
|
|
6145
6265
|
command: 'Main.splitLeft',
|
|
6146
6266
|
flags: None$1,
|
|
6147
6267
|
id: 'splitLeft',
|
|
6148
|
-
label: splitLeft
|
|
6268
|
+
label: splitLeft()
|
|
6149
6269
|
}, {
|
|
6150
6270
|
args: groupArgs,
|
|
6151
6271
|
command: 'Main.splitRight',
|
|
6152
6272
|
flags: None$1,
|
|
6153
6273
|
id: 'splitRight',
|
|
6154
|
-
label: splitRight
|
|
6274
|
+
label: splitRight()
|
|
6155
6275
|
}, ...getNewWindowMenuEntries(state)];
|
|
6156
6276
|
if (!hasTargetGroup(groupId)) {
|
|
6157
6277
|
return entries;
|
|
@@ -6265,7 +6385,7 @@ const getMenuEntries$1 = state => {
|
|
|
6265
6385
|
command: 'Main.splitRight',
|
|
6266
6386
|
flags: None$1,
|
|
6267
6387
|
id: 'splitRight',
|
|
6268
|
-
label: splitRight
|
|
6388
|
+
label: splitRight()
|
|
6269
6389
|
}, {
|
|
6270
6390
|
command: '',
|
|
6271
6391
|
flags: None$1,
|
|
@@ -7434,7 +7554,7 @@ const renderEventListeners = () => {
|
|
|
7434
7554
|
params: ['handleDragLeave']
|
|
7435
7555
|
}, {
|
|
7436
7556
|
name: HandleDrop,
|
|
7437
|
-
params: ['handleDrop', DataTransferFiles2
|
|
7557
|
+
params: ['handleDrop', DataTransferFiles2],
|
|
7438
7558
|
preventDefault: true
|
|
7439
7559
|
}];
|
|
7440
7560
|
};
|
|
@@ -7862,152 +7982,6 @@ const setEditorLayoutTwoColumnsBottom = state => {
|
|
|
7862
7982
|
}]);
|
|
7863
7983
|
};
|
|
7864
7984
|
|
|
7865
|
-
const splitDown = (state, groupId) => {
|
|
7866
|
-
const {
|
|
7867
|
-
layout
|
|
7868
|
-
} = state;
|
|
7869
|
-
const {
|
|
7870
|
-
activeGroupId,
|
|
7871
|
-
direction,
|
|
7872
|
-
groups
|
|
7873
|
-
} = layout;
|
|
7874
|
-
|
|
7875
|
-
// If there are no groups, create an initial empty group first
|
|
7876
|
-
if (groups.length === 0) {
|
|
7877
|
-
const initialGroupId = create$2();
|
|
7878
|
-
const initialGroup = {
|
|
7879
|
-
activeTabId: -1,
|
|
7880
|
-
direction,
|
|
7881
|
-
focused: true,
|
|
7882
|
-
id: initialGroupId,
|
|
7883
|
-
isEmpty: true,
|
|
7884
|
-
size: 100,
|
|
7885
|
-
tabs: []
|
|
7886
|
-
};
|
|
7887
|
-
const stateWithInitialGroup = {
|
|
7888
|
-
...state,
|
|
7889
|
-
layout: {
|
|
7890
|
-
...layout,
|
|
7891
|
-
activeGroupId: initialGroupId,
|
|
7892
|
-
groups: [initialGroup]
|
|
7893
|
-
}
|
|
7894
|
-
};
|
|
7895
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
|
|
7896
|
-
}
|
|
7897
|
-
const resolvedGroupId = groupId ?? activeGroupId;
|
|
7898
|
-
if (!resolvedGroupId) {
|
|
7899
|
-
return state;
|
|
7900
|
-
}
|
|
7901
|
-
return splitEditorGroup$1(state, resolvedGroupId, 'down');
|
|
7902
|
-
};
|
|
7903
|
-
|
|
7904
|
-
const splitLeft = (state, groupId) => {
|
|
7905
|
-
const {
|
|
7906
|
-
layout
|
|
7907
|
-
} = state;
|
|
7908
|
-
const {
|
|
7909
|
-
activeGroupId,
|
|
7910
|
-
direction,
|
|
7911
|
-
groups
|
|
7912
|
-
} = layout;
|
|
7913
|
-
if (groups.length === 0) {
|
|
7914
|
-
const initialGroupId = create$2();
|
|
7915
|
-
const initialGroup = {
|
|
7916
|
-
activeTabId: -1,
|
|
7917
|
-
direction,
|
|
7918
|
-
focused: true,
|
|
7919
|
-
id: initialGroupId,
|
|
7920
|
-
isEmpty: true,
|
|
7921
|
-
size: 100,
|
|
7922
|
-
tabs: []
|
|
7923
|
-
};
|
|
7924
|
-
const stateWithInitialGroup = {
|
|
7925
|
-
...state,
|
|
7926
|
-
layout: {
|
|
7927
|
-
...layout,
|
|
7928
|
-
activeGroupId: initialGroupId,
|
|
7929
|
-
groups: [initialGroup]
|
|
7930
|
-
}
|
|
7931
|
-
};
|
|
7932
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left$1);
|
|
7933
|
-
}
|
|
7934
|
-
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
7935
|
-
return splitEditorGroup$1(state, targetGroupId, Left$1);
|
|
7936
|
-
};
|
|
7937
|
-
|
|
7938
|
-
const splitRight = (state, groupId) => {
|
|
7939
|
-
const {
|
|
7940
|
-
layout
|
|
7941
|
-
} = state;
|
|
7942
|
-
const {
|
|
7943
|
-
activeGroupId,
|
|
7944
|
-
direction,
|
|
7945
|
-
groups
|
|
7946
|
-
} = layout;
|
|
7947
|
-
|
|
7948
|
-
// If there are no groups, create an initial empty group first
|
|
7949
|
-
if (groups.length === 0) {
|
|
7950
|
-
const initialGroupId = create$2();
|
|
7951
|
-
const initialGroup = {
|
|
7952
|
-
activeTabId: -1,
|
|
7953
|
-
direction,
|
|
7954
|
-
focused: true,
|
|
7955
|
-
id: initialGroupId,
|
|
7956
|
-
isEmpty: true,
|
|
7957
|
-
size: 100,
|
|
7958
|
-
tabs: []
|
|
7959
|
-
};
|
|
7960
|
-
const stateWithInitialGroup = {
|
|
7961
|
-
...state,
|
|
7962
|
-
layout: {
|
|
7963
|
-
...layout,
|
|
7964
|
-
activeGroupId: initialGroupId,
|
|
7965
|
-
groups: [initialGroup]
|
|
7966
|
-
}
|
|
7967
|
-
};
|
|
7968
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right$1);
|
|
7969
|
-
}
|
|
7970
|
-
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
7971
|
-
return splitEditorGroup$1(state, targetGroupId, Right$1);
|
|
7972
|
-
};
|
|
7973
|
-
|
|
7974
|
-
const splitUp = (state, groupId) => {
|
|
7975
|
-
const {
|
|
7976
|
-
layout
|
|
7977
|
-
} = state;
|
|
7978
|
-
const {
|
|
7979
|
-
activeGroupId,
|
|
7980
|
-
direction,
|
|
7981
|
-
groups
|
|
7982
|
-
} = layout;
|
|
7983
|
-
if (groups.length === 0) {
|
|
7984
|
-
const initialGroupId = create$2();
|
|
7985
|
-
const initialGroup = {
|
|
7986
|
-
activeTabId: -1,
|
|
7987
|
-
direction,
|
|
7988
|
-
focused: true,
|
|
7989
|
-
id: initialGroupId,
|
|
7990
|
-
isEmpty: true,
|
|
7991
|
-
size: 100,
|
|
7992
|
-
tabs: []
|
|
7993
|
-
};
|
|
7994
|
-
const stateWithInitialGroup = {
|
|
7995
|
-
...state,
|
|
7996
|
-
layout: {
|
|
7997
|
-
...layout,
|
|
7998
|
-
activeGroupId: initialGroupId,
|
|
7999
|
-
groups: [initialGroup]
|
|
8000
|
-
}
|
|
8001
|
-
};
|
|
8002
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
|
|
8003
|
-
}
|
|
8004
|
-
const resolvedGroupId = groupId ?? activeGroupId;
|
|
8005
|
-
if (!resolvedGroupId) {
|
|
8006
|
-
return state;
|
|
8007
|
-
}
|
|
8008
|
-
return splitEditorGroup$1(state, resolvedGroupId, 'up');
|
|
8009
|
-
};
|
|
8010
|
-
|
|
8011
7985
|
const pendingLoads = new Map();
|
|
8012
7986
|
const loadContent = wrapSerialCommand(loadContent$1);
|
|
8013
7987
|
const loadContentTracked = async (uid, ...args) => {
|
|
@@ -8059,7 +8033,7 @@ const commandMap = {
|
|
|
8059
8033
|
'Main.restoreClosedTab': wrapSerialCommand(restoreClosedTab),
|
|
8060
8034
|
'Main.save': wrapSerialCommand(save),
|
|
8061
8035
|
'Main.saveState': wrapGetter(saveState),
|
|
8062
|
-
'Main.splitRight': wrapSerialCommand(splitRight),
|
|
8036
|
+
'Main.splitRight': wrapSerialCommand(splitRight$1),
|
|
8063
8037
|
'MainArea.closeActiveEditor': wrapSerialCommand(closeActiveEditor),
|
|
8064
8038
|
'MainArea.closeAll': wrapSerialCommand(closeAll$1),
|
|
8065
8039
|
'MainArea.closeAllEditors': wrapSerialCommand(closeAll$1),
|
|
@@ -8133,10 +8107,10 @@ const commandMap = {
|
|
|
8133
8107
|
'MainArea.setEditorLayoutTwoColumnsBottom': wrapSerialCommand(setEditorLayoutTwoColumnsBottom),
|
|
8134
8108
|
'MainArea.setEditorLayoutTwoRows': wrapSerialCommand(setEditorLayoutTwoRows),
|
|
8135
8109
|
'MainArea.setEditorLayoutTwoRowsRight': wrapSerialCommand(setEditorLayoutTwoRowsRight),
|
|
8136
|
-
'MainArea.splitDown': wrapSerialCommand(splitDown),
|
|
8137
|
-
'MainArea.splitLeft': wrapSerialCommand(splitLeft),
|
|
8138
|
-
'MainArea.splitRight': wrapSerialCommand(splitRight),
|
|
8139
|
-
'MainArea.splitUp': wrapSerialCommand(splitUp),
|
|
8110
|
+
'MainArea.splitDown': wrapSerialCommand(splitDown$1),
|
|
8111
|
+
'MainArea.splitLeft': wrapSerialCommand(splitLeft$1),
|
|
8112
|
+
'MainArea.splitRight': wrapSerialCommand(splitRight$1),
|
|
8113
|
+
'MainArea.splitUp': wrapSerialCommand(splitUp$1),
|
|
8140
8114
|
'MainArea.terminate': terminate
|
|
8141
8115
|
};
|
|
8142
8116
|
|
|
@@ -8146,11 +8120,25 @@ const sendMessagePortToClipBoardWorker = async port => {
|
|
|
8146
8120
|
};
|
|
8147
8121
|
|
|
8148
8122
|
const initializeClipBoardWorker = async () => {
|
|
8149
|
-
const rpc = await create$
|
|
8123
|
+
const rpc = await create$9({
|
|
8150
8124
|
commandMap: {},
|
|
8151
8125
|
send: sendMessagePortToClipBoardWorker
|
|
8152
8126
|
});
|
|
8153
|
-
set$
|
|
8127
|
+
set$5(rpc);
|
|
8128
|
+
};
|
|
8129
|
+
|
|
8130
|
+
const send$1 = async port => {
|
|
8131
|
+
await sendMessagePortToDragAndDropWorker(port);
|
|
8132
|
+
};
|
|
8133
|
+
const createDragAndDropWorkerRpc = async () => {
|
|
8134
|
+
return create$6({
|
|
8135
|
+
commandMap: {},
|
|
8136
|
+
send: send$1
|
|
8137
|
+
});
|
|
8138
|
+
};
|
|
8139
|
+
|
|
8140
|
+
const initializeDragAndDropWorker = async () => {
|
|
8141
|
+
set$3(await createDragAndDropWorkerRpc());
|
|
8154
8142
|
};
|
|
8155
8143
|
|
|
8156
8144
|
const send = port => {
|
|
@@ -8195,12 +8183,12 @@ const initializeRendererWorker = async () => {
|
|
|
8195
8183
|
|
|
8196
8184
|
const listen = async () => {
|
|
8197
8185
|
registerCommands(commandMap);
|
|
8198
|
-
await Promise.all([initializeRendererWorker(), initializeIconThemeWorker(), initializeClipBoardWorker()]);
|
|
8186
|
+
await Promise.all([initializeRendererWorker(), initializeIconThemeWorker(), initializeClipBoardWorker(), initializeDragAndDropWorker()]);
|
|
8199
8187
|
const dialogRpc = await create$6({
|
|
8200
8188
|
commandMap: {},
|
|
8201
8189
|
send: sendMessagePortToDialogWorker
|
|
8202
8190
|
});
|
|
8203
|
-
set$
|
|
8191
|
+
set$4(dialogRpc);
|
|
8204
8192
|
};
|
|
8205
8193
|
|
|
8206
8194
|
const main$1 = async () => {
|