@lvce-editor/explorer-view 2.26.0 → 2.28.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.
@@ -467,7 +467,7 @@ const registerPromise = () => {
467
467
  promise
468
468
  };
469
469
  };
470
- const create$2 = (method, params) => {
470
+ const create$2$1 = (method, params) => {
471
471
  const {
472
472
  id,
473
473
  promise
@@ -759,7 +759,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
759
759
  const {
760
760
  message,
761
761
  promise
762
- } = create$2(method, params);
762
+ } = create$2$1(method, params);
763
763
  if (useSendAndTransfer && ipc.sendAndTransfer) {
764
764
  ipc.sendAndTransfer(message);
765
765
  } else {
@@ -846,7 +846,7 @@ const listen$1 = async (module, options) => {
846
846
  const ipc = module.wrap(rawIpc);
847
847
  return ipc;
848
848
  };
849
- const create$1 = async ({
849
+ const create$2 = async ({
850
850
  commandMap
851
851
  }) => {
852
852
  // TODO create a commandMap per rpc instance
@@ -858,7 +858,7 @@ const create$1 = async ({
858
858
  };
859
859
  const WebWorkerRpcClient = {
860
860
  __proto__: null,
861
- create: create$1
861
+ create: create$2
862
862
  };
863
863
 
864
864
  const None$5 = 0;
@@ -1539,17 +1539,57 @@ const copyRelativePath = async state => {
1539
1539
  return state;
1540
1540
  };
1541
1541
 
1542
- const states = Object.create(null);
1543
- const get = uid => {
1544
- return states[uid];
1545
- };
1546
- const set = (uid, oldState, newState) => {
1547
- states[uid] = {
1548
- oldState,
1549
- newState
1542
+ const create$1 = () => {
1543
+ const states = Object.create(null);
1544
+ return {
1545
+ get(uid) {
1546
+ return states[uid];
1547
+ },
1548
+ set(uid, oldState, newState) {
1549
+ states[uid] = {
1550
+ oldState,
1551
+ newState
1552
+ };
1553
+ },
1554
+ dispose(uid) {
1555
+ delete states[uid];
1556
+ },
1557
+ getKeys() {
1558
+ return Object.keys(states).map(key => {
1559
+ return Number.parseInt(key);
1560
+ });
1561
+ },
1562
+ clear() {
1563
+ for (const key of Object.keys(states)) {
1564
+ delete states[key];
1565
+ }
1566
+ },
1567
+ wrapCommand(fn) {
1568
+ const wrapped = async (uid, ...args) => {
1569
+ const {
1570
+ newState
1571
+ } = states[uid];
1572
+ const newerState = await fn(newState, ...args);
1573
+ if (newState === newerState) {
1574
+ return;
1575
+ }
1576
+ const latest = states[uid];
1577
+ states[uid] = {
1578
+ oldState: latest.oldState,
1579
+ newState: newerState
1580
+ };
1581
+ };
1582
+ return wrapped;
1583
+ }
1550
1584
  };
1551
1585
  };
1552
1586
 
1587
+ const {
1588
+ get,
1589
+ set,
1590
+ wrapCommand
1591
+ } = create$1();
1592
+
1553
1593
  const ListItem = 22;
1554
1594
 
1555
1595
  const Slash = '/';
@@ -4838,21 +4878,6 @@ const updateEditingValue = async (state, value, inputSource = User) => {
4838
4878
  };
4839
4879
  };
4840
4880
 
4841
- const wrapCommand = fn => {
4842
- const wrapped = async (uid, ...args) => {
4843
- const {
4844
- newState
4845
- } = get(uid);
4846
- const newerState = await fn(newState, ...args);
4847
- if (newState === newerState) {
4848
- return;
4849
- }
4850
- const latest = get(uid);
4851
- set(uid, latest.oldState, newerState);
4852
- };
4853
- return wrapped;
4854
- };
4855
-
4856
4881
  const commandMap = {
4857
4882
  'Explorer.acceptEdit': wrapCommand(acceptEdit),
4858
4883
  'Explorer.cancelEdit': wrapCommand(cancelEdit),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "2.26.0",
3
+ "version": "2.28.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",