@lvce-editor/explorer-view 6.14.0 → 6.16.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.
@@ -13,13 +13,13 @@ const create$a = () => {
13
13
  },
14
14
  diff(uid, modules, numbers) {
15
15
  const {
16
- newState,
17
- oldState
16
+ oldState,
17
+ scheduledState
18
18
  } = states[uid];
19
19
  const diffResult = [];
20
20
  for (let i = 0; i < modules.length; i++) {
21
21
  const fn = modules[i];
22
- if (!fn(oldState, newState)) {
22
+ if (!fn(oldState, scheduledState)) {
23
23
  diffResult.push(numbers[i]);
24
24
  }
25
25
  }
@@ -37,17 +37,16 @@ const create$a = () => {
37
37
  return ids;
38
38
  },
39
39
  getKeys() {
40
- return Object.keys(states).map(key => {
41
- return Number.parseFloat(key);
42
- });
40
+ return Object.keys(states).map(Number);
43
41
  },
44
42
  registerCommands(commandMap) {
45
43
  Object.assign(commandMapRef, commandMap);
46
44
  },
47
- set(uid, oldState, newState) {
45
+ set(uid, oldState, newState, scheduledState) {
48
46
  states[uid] = {
49
47
  newState,
50
- oldState
48
+ oldState,
49
+ scheduledState: scheduledState ?? newState
51
50
  };
52
51
  },
53
52
  wrapCommand(fn) {
@@ -67,7 +66,8 @@ const create$a = () => {
67
66
  };
68
67
  states[uid] = {
69
68
  newState: latestNew,
70
- oldState: latestOld.oldState
69
+ oldState: latestOld.oldState,
70
+ scheduledState: latestNew
71
71
  };
72
72
  };
73
73
  return wrapped;
@@ -104,7 +104,8 @@ const create$a = () => {
104
104
  };
105
105
  states[uid] = {
106
106
  newState: latestNew,
107
- oldState: latestOld.oldState
107
+ oldState: latestOld.oldState,
108
+ scheduledState: latestNew
108
109
  };
109
110
  return {
110
111
  error
@@ -1668,9 +1669,10 @@ const getChildDirentsRaw = async uri => {
1668
1669
 
1669
1670
  const RE_CHARACTERS = /^[a-zA-Z.-]+$/;
1670
1671
  const RE_LEADING_DIGITS = /^\d+/;
1672
+ const RE_LEADING_ZEROES = /^0+/;
1671
1673
  const compareLeadingDigits = (a, b) => {
1672
- const normalizedA = a.replace(/^0+/, '') || '0';
1673
- const normalizedB = b.replace(/^0+/, '') || '0';
1674
+ const normalizedA = a.replace(RE_LEADING_ZEROES, '') || '0';
1675
+ const normalizedB = b.replace(RE_LEADING_ZEROES, '') || '0';
1674
1676
  if (normalizedA.length !== normalizedB.length) {
1675
1677
  return normalizedA.length - normalizedB.length;
1676
1678
  }
@@ -2970,7 +2972,7 @@ const wrapListItemCommand = fn => {
2970
2972
  useChevrons
2971
2973
  } = updatedState;
2972
2974
  const intermediate = get(id);
2973
- set(id, intermediate.oldState, updatedState);
2975
+ set(id, intermediate.oldState, updatedState, intermediate.scheduledState);
2974
2976
  if (hasSameVisibleExplorerItemInputs(intermediate.newState, updatedState)) {
2975
2977
  return;
2976
2978
  }
@@ -3002,11 +3004,13 @@ const Slash = '/';
3002
3004
  const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, assetDir = '') => {
3003
3005
  const state = {
3004
3006
  assetDir,
3007
+ chevronSpace: 22,
3005
3008
  compareSourceUri: '',
3006
3009
  confirmDelete: false,
3007
3010
  confirmPaste: false,
3008
3011
  cutItems: [],
3009
3012
  decorations: [],
3013
+ defaultPaddingLeft: 0,
3010
3014
  deltaY: 0,
3011
3015
  dropTargets: [],
3012
3016
  editingErrorMessage: '',
@@ -3023,6 +3027,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
3023
3027
  errorMessageWidth: 0,
3024
3028
  excluded: [],
3025
3029
  fileIconCache: Object.create(null),
3030
+ fileIconWidth: 16,
3026
3031
  finalDeltaY: 0,
3027
3032
  focus: 0,
3028
3033
  focused: false,
@@ -3034,6 +3039,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
3034
3039
  height,
3035
3040
  hoverIndex: -1,
3036
3041
  icons: [],
3042
+ indent: 8,
3037
3043
  initial: true,
3038
3044
  inputSource: 0,
3039
3045
  isPointerDown: false,
@@ -3042,6 +3048,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
3042
3048
  maxIndent: 0,
3043
3049
  maxLineY: 0,
3044
3050
  minLineY: 0,
3051
+ padding: 10,
3045
3052
  parentUid,
3046
3053
  pasteShouldMove: false,
3047
3054
  pathSeparator: Slash,
@@ -3124,10 +3131,10 @@ const diff = (oldState, newState) => {
3124
3131
 
3125
3132
  const diff2 = uid => {
3126
3133
  const {
3127
- newState,
3128
- oldState
3134
+ oldState,
3135
+ scheduledState
3129
3136
  } = get(uid);
3130
- const result = diff(oldState, newState);
3137
+ const result = diff(oldState, scheduledState);
3131
3138
  return result;
3132
3139
  };
3133
3140
 
@@ -5286,8 +5293,8 @@ const handleKeyDown = (state, key) => {
5286
5293
  if (typeAheadTimeout.value) {
5287
5294
  clearTimeout(typeAheadTimeout.value);
5288
5295
  }
5289
- typeAheadTimeout.value = setTimeout(async () => {
5290
- await invoke$2('Explorer.cancelTypeAhead');
5296
+ typeAheadTimeout.value = setTimeout(() => {
5297
+ void invoke$2('Explorer.cancelTypeAhead');
5291
5298
  }, focusWordTimeout);
5292
5299
  if (matchingIndex === -1) {
5293
5300
  return {
@@ -5869,12 +5876,17 @@ const getUniqueIndents = items => {
5869
5876
 
5870
5877
  const renderCss = (oldState, newState) => {
5871
5878
  const {
5879
+ chevronSpace,
5880
+ defaultPaddingLeft,
5872
5881
  deltaY,
5882
+ fileIconWidth,
5873
5883
  focusedIndex,
5874
5884
  height,
5885
+ indent,
5875
5886
  itemHeight,
5876
5887
  items,
5877
5888
  minLineY,
5889
+ padding,
5878
5890
  uid,
5879
5891
  visibleExplorerItems,
5880
5892
  width
@@ -5883,11 +5895,6 @@ const renderCss = (oldState, newState) => {
5883
5895
  const contentHeight = items.length * itemHeight;
5884
5896
  const scrollBarTop = getScrollBarTop(height, contentHeight, deltaY);
5885
5897
  const scrollBarHeight = getScrollBarSize(height, contentHeight, 20);
5886
- const indent = 8;
5887
- const padding = 10;
5888
- const fileIconWidth = 16;
5889
- const defaultPaddingLeft = 0;
5890
- const chevronSpace = 22;
5891
5898
  const depth = items[focusedIndex]?.depth || 0;
5892
5899
  const {
5893
5900
  errorMessageWidth,
@@ -6384,11 +6391,11 @@ const applyRender = (oldState, newState, diffResult) => {
6384
6391
 
6385
6392
  const render2 = (uid, diffResult) => {
6386
6393
  const {
6387
- newState,
6388
- oldState
6394
+ oldState,
6395
+ scheduledState
6389
6396
  } = get(uid);
6390
- set(uid, newState, newState);
6391
- const commands = applyRender(oldState, newState, diffResult);
6397
+ set(uid, scheduledState, scheduledState);
6398
+ const commands = applyRender(oldState, scheduledState, diffResult);
6392
6399
  return commands;
6393
6400
  };
6394
6401
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "6.14.0",
3
+ "version": "6.16.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",