@lvce-editor/main-area-worker 9.54.2 → 9.55.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.
@@ -158,55 +158,6 @@ const getTransferrables = value => {
158
158
  walkValue(value, transferrables, isTransferrable);
159
159
  return transferrables;
160
160
  };
161
- const removeValues = (value, toRemove) => {
162
- if (!value) {
163
- return value;
164
- }
165
- if (Array.isArray(value)) {
166
- const newItems = [];
167
- for (const item of value) {
168
- if (!toRemove.includes(item)) {
169
- newItems.push(removeValues(item, toRemove));
170
- }
171
- }
172
- return newItems;
173
- }
174
- if (typeof value === 'object') {
175
- const newObject = Object.create(null);
176
- for (const [key, property] of Object.entries(value)) {
177
- if (!toRemove.includes(property)) {
178
- newObject[key] = removeValues(property, toRemove);
179
- }
180
- }
181
- return newObject;
182
- }
183
- return value;
184
- };
185
-
186
- // workaround for electron not supporting transferrable objects
187
- // as parameters. If the transferrable object is a parameter, in electron
188
- // only an empty objected is received in the main process
189
- const fixElectronParameters = value => {
190
- const transfer = getTransferrables(value);
191
- const newValue = removeValues(value, transfer);
192
- return {
193
- newValue,
194
- transfer
195
- };
196
- };
197
- const getActualDataElectron = event => {
198
- const {
199
- data,
200
- ports
201
- } = event;
202
- if (ports.length === 0) {
203
- return data;
204
- }
205
- return {
206
- ...data,
207
- params: [...ports, ...data.params]
208
- };
209
- };
210
161
  const attachEvents = that => {
211
162
  const handleMessage = (...args) => {
212
163
  const data = that.getData(...args);
@@ -373,48 +324,6 @@ class IpcError extends VError {
373
324
  this.stderr = stderr;
374
325
  }
375
326
  }
376
- const listen$b = ({
377
- messagePort
378
- }) => {
379
- if (!isMessagePortMain(messagePort)) {
380
- throw new IpcError('port must be of type MessagePortMain');
381
- }
382
- return messagePort;
383
- };
384
- const signal$c = messagePort => {
385
- messagePort.start();
386
- };
387
- class IpcChildWithElectronMessagePort extends Ipc {
388
- getData = getActualDataElectron;
389
- send(message) {
390
- this._rawIpc.postMessage(message);
391
- }
392
- sendAndTransfer(message) {
393
- const {
394
- newValue,
395
- transfer
396
- } = fixElectronParameters(message);
397
- this._rawIpc.postMessage(newValue, transfer);
398
- }
399
- dispose() {
400
- this._rawIpc.close();
401
- }
402
- onMessage(callback) {
403
- this._rawIpc.on('message', callback);
404
- }
405
- onClose(callback) {
406
- this._rawIpc.on('close', callback);
407
- }
408
- }
409
- const wrap$j = messagePort => {
410
- return new IpcChildWithElectronMessagePort(messagePort);
411
- };
412
- const IpcChildWithElectronMessagePort$1 = {
413
- __proto__: null,
414
- listen: listen$b,
415
- signal: signal$c,
416
- wrap: wrap$j
417
- };
418
327
  const readyMessage = 'ready';
419
328
  const getData$2 = event => {
420
329
  return event.data;
@@ -832,7 +741,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
832
741
  const errorProperty = getErrorProperty(error, prettyError);
833
742
  return create$1$1(id, errorProperty);
834
743
  };
835
- const create$f = (message, result) => {
744
+ const create$c = (message, result) => {
836
745
  return {
837
746
  id: message.id,
838
747
  jsonrpc: Two$1,
@@ -841,7 +750,7 @@ const create$f = (message, result) => {
841
750
  };
842
751
  const getSuccessResponse = (message, result) => {
843
752
  const resultProperty = result ?? null;
844
- return create$f(message, resultProperty);
753
+ return create$c(message, resultProperty);
845
754
  };
846
755
  const getErrorResponseSimple = (id, error) => {
847
756
  return {
@@ -935,7 +844,7 @@ const handleJsonRpcMessage = async (...args) => {
935
844
 
936
845
  const Two = '2.0';
937
846
 
938
- const create$e = (method, params) => {
847
+ const create$b = (method, params) => {
939
848
  return {
940
849
  jsonrpc: Two,
941
850
  method,
@@ -943,7 +852,7 @@ const create$e = (method, params) => {
943
852
  };
944
853
  };
945
854
 
946
- const create$d = (id, method, params) => {
855
+ const create$a = (id, method, params) => {
947
856
  const message = {
948
857
  id,
949
858
  jsonrpc: Two,
@@ -954,12 +863,12 @@ const create$d = (id, method, params) => {
954
863
  };
955
864
 
956
865
  let id = 0;
957
- const create$c = () => {
866
+ const create$9 = () => {
958
867
  return ++id;
959
868
  };
960
869
 
961
870
  const registerPromise = map => {
962
- const id = create$c();
871
+ const id = create$9();
963
872
  const {
964
873
  promise,
965
874
  resolve
@@ -976,7 +885,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
976
885
  id,
977
886
  promise
978
887
  } = registerPromise(callbacks);
979
- const message = create$d(id, method, params);
888
+ const message = create$a(id, method, params);
980
889
  if (useSendAndTransfer && ipc.sendAndTransfer) {
981
890
  ipc.sendAndTransfer(message);
982
891
  } else {
@@ -1012,7 +921,7 @@ const createRpc = ipc => {
1012
921
  * @deprecated
1013
922
  */
1014
923
  send(method, ...params) {
1015
- const message = create$e(method, params);
924
+ const message = create$b(method, params);
1016
925
  ipc.send(message);
1017
926
  }
1018
927
  };
@@ -1052,24 +961,6 @@ const listen$1 = async (module, options) => {
1052
961
  return ipc;
1053
962
  };
1054
963
 
1055
- const create$b = async ({
1056
- commandMap,
1057
- messagePort,
1058
- requiresSocket
1059
- }) => {
1060
- // TODO create a commandMap per rpc instance
1061
- register(commandMap);
1062
- const ipc = await listen$1(IpcChildWithElectronMessagePort$1, {
1063
- messagePort
1064
- });
1065
- if (requiresSocket) {
1066
- ipc.requiresSocket = requiresSocket;
1067
- }
1068
- handleIpc(ipc);
1069
- const rpc = createRpc(ipc);
1070
- return rpc;
1071
- };
1072
-
1073
964
  const createSharedLazyRpc = factory => {
1074
965
  let rpcPromise;
1075
966
  const getOrCreate = () => {
@@ -1098,37 +989,6 @@ const createSharedLazyRpc = factory => {
1098
989
  };
1099
990
  };
1100
991
 
1101
- const create$a = async ({
1102
- commandMap,
1103
- getPortTuple,
1104
- send
1105
- }) => {
1106
- const {
1107
- port1,
1108
- port2
1109
- } = await getPortTuple();
1110
- await send(port1);
1111
- const rpc = create$b({
1112
- commandMap,
1113
- messagePort: port2
1114
- });
1115
- return rpc;
1116
- };
1117
-
1118
- const create$9 = async ({
1119
- commandMap,
1120
- getPortTuple,
1121
- send
1122
- }) => {
1123
- return createSharedLazyRpc(() => {
1124
- return create$a({
1125
- commandMap,
1126
- getPortTuple,
1127
- send
1128
- });
1129
- });
1130
- };
1131
-
1132
992
  const create$8 = async ({
1133
993
  commandMap,
1134
994
  isMessagePortOpen = true,
@@ -1746,9 +1606,6 @@ const {
1746
1606
  invoke: invoke$4,
1747
1607
  set: set$5
1748
1608
  } = create$3(DragAndDropWorker);
1749
- const getDroppedItems = async (itemIds, isElectron) => {
1750
- return invoke$4('DragAndDrop.getDroppedItems', itemIds, isElectron);
1751
- };
1752
1609
  const getDroppedUrisByDropId = async (dropId, isElectron) => {
1753
1610
  return invoke$4('DragAndDrop.getDroppedUrisByDropId', dropId, isElectron);
1754
1611
  };
@@ -5415,7 +5272,7 @@ const getDropAction = async uris => {
5415
5272
  const normalizeUri = uri => {
5416
5273
  return uri.startsWith('/') ? `file://${uri}` : uri;
5417
5274
  };
5418
- const handleDrop = async (context, dropIdOrItemIds) => {
5275
+ const handleDrop = async (context, dropId) => {
5419
5276
  const initialState = context.getState();
5420
5277
  const {
5421
5278
  pointerDownGroupIndex,
@@ -5432,15 +5289,7 @@ const handleDrop = async (context, dropIdOrItemIds) => {
5432
5289
  platform
5433
5290
  } = context.getState();
5434
5291
  const isElectron = platform === Electron;
5435
- let uris;
5436
- if (typeof dropIdOrItemIds === 'number') {
5437
- uris = await getDroppedUrisByDropId(dropIdOrItemIds, isElectron);
5438
- } else {
5439
- const {
5440
- uris: droppedUris
5441
- } = await getDroppedItems(dropIdOrItemIds, isElectron);
5442
- uris = droppedUris;
5443
- }
5292
+ const uris = await getDroppedUrisByDropId(dropId, isElectron);
5444
5293
  if (draggedTab?.uri && uris.length === 1 && normalizeUri(uris[0]) === normalizeUri(draggedTab.uri)) {
5445
5294
  await context.updateState(state => resetPointerDown(applyTabDrop(state, sourceGroup.id, draggedTab.id, splitDirection, targetGroupId)));
5446
5295
  return;
@@ -8828,7 +8677,7 @@ const sendMessagePortToClipBoardWorker = async port => {
8828
8677
  };
8829
8678
 
8830
8679
  const initializeClipBoardWorker = async () => {
8831
- const rpc = await create$9({
8680
+ const rpc = await create$6({
8832
8681
  commandMap: {},
8833
8682
  send: sendMessagePortToClipBoardWorker
8834
8683
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.54.2",
3
+ "version": "9.55.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",