@lvce-editor/extension-search-view 7.4.0 → 7.6.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.
@@ -1174,13 +1174,13 @@ const create$1 = () => {
1174
1174
  },
1175
1175
  diff(uid, modules, numbers) {
1176
1176
  const {
1177
- newState,
1178
- oldState
1177
+ oldState,
1178
+ scheduledState
1179
1179
  } = states[uid];
1180
1180
  const diffResult = [];
1181
1181
  for (let i = 0; i < modules.length; i++) {
1182
1182
  const fn = modules[i];
1183
- if (!fn(oldState, newState)) {
1183
+ if (!fn(oldState, scheduledState)) {
1184
1184
  diffResult.push(numbers[i]);
1185
1185
  }
1186
1186
  }
@@ -1198,17 +1198,16 @@ const create$1 = () => {
1198
1198
  return ids;
1199
1199
  },
1200
1200
  getKeys() {
1201
- return Object.keys(states).map(key => {
1202
- return Number.parseFloat(key);
1203
- });
1201
+ return Object.keys(states).map(Number);
1204
1202
  },
1205
1203
  registerCommands(commandMap) {
1206
1204
  Object.assign(commandMapRef, commandMap);
1207
1205
  },
1208
- set(uid, oldState, newState) {
1206
+ set(uid, oldState, newState, scheduledState) {
1209
1207
  states[uid] = {
1210
1208
  newState,
1211
- oldState
1209
+ oldState,
1210
+ scheduledState: scheduledState ?? newState
1212
1211
  };
1213
1212
  },
1214
1213
  wrapCommand(fn) {
@@ -1228,7 +1227,8 @@ const create$1 = () => {
1228
1227
  };
1229
1228
  states[uid] = {
1230
1229
  newState: latestNew,
1231
- oldState: latestOld.oldState
1230
+ oldState: latestOld.oldState,
1231
+ scheduledState: latestNew
1232
1232
  };
1233
1233
  };
1234
1234
  return wrapped;
@@ -1265,7 +1265,8 @@ const create$1 = () => {
1265
1265
  };
1266
1266
  states[uid] = {
1267
1267
  newState: latestNew,
1268
- oldState: latestOld.oldState
1268
+ oldState: latestOld.oldState,
1269
+ scheduledState: latestNew
1269
1270
  };
1270
1271
  return {
1271
1272
  error
@@ -1723,13 +1724,14 @@ const handleChange = async (state, update) => {
1723
1724
  };
1724
1725
  }
1725
1726
  const total = items.length;
1726
- const listHeight = getListHeight(total, itemHeight, height);
1727
+ const availableHeight = height - headerHeight;
1728
+ const listHeight = getListHeight(total, itemHeight, availableHeight);
1727
1729
  const contentHeight = total * itemHeight;
1728
- const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
1730
+ const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, minimumSliderSize);
1729
1731
  const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
1730
1732
  const maxLineY = Math.min(numberOfVisible, total);
1731
1733
  const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
1732
- const scrollBarY = getScrollBarY$1(0, finalDeltaY, height - headerHeight, scrollBarHeight);
1734
+ const scrollBarY = getScrollBarY$1(0, finalDeltaY, listHeight, scrollBarHeight);
1733
1735
  return {
1734
1736
  ...state,
1735
1737
  allExtensions,
@@ -3643,11 +3645,12 @@ const position = (x, y) => {
3643
3645
  };
3644
3646
 
3645
3647
  const renderScrollBar = newState => {
3646
- const listHeight = getListHeight(newState.items.length, newState.itemHeight, newState.height);
3648
+ const availableHeight = newState.height - newState.headerHeight;
3649
+ const listHeight = getListHeight(newState.items.length, newState.itemHeight, availableHeight);
3647
3650
  const total = newState.items.length;
3648
3651
  const contentHeight = total * newState.itemHeight;
3649
3652
  const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, newState.minimumSliderSize);
3650
- const scrollBarY = getScrollBarY$1(newState.deltaY, newState.finalDeltaY, newState.height - newState.headerHeight, scrollBarHeight);
3653
+ const scrollBarY = getScrollBarY$1(newState.deltaY, newState.finalDeltaY, listHeight, scrollBarHeight);
3651
3654
  const roundedScrollBarY = Math.round(scrollBarY);
3652
3655
  const heightString = px(scrollBarHeight);
3653
3656
  const translateString = position(0, roundedScrollBarY);
@@ -3820,16 +3823,19 @@ const resize = async (state, dimensions) => {
3820
3823
  y
3821
3824
  } = dimensions;
3822
3825
  const total = items.length;
3823
- const listHeight = getListHeight(total, itemHeight, height);
3826
+ const availableHeight = height - headerHeight;
3827
+ const listHeight = getListHeight(total, itemHeight, availableHeight);
3824
3828
  const contentHeight = total * itemHeight;
3825
- const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
3829
+ const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, minimumSliderSize);
3826
3830
  const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
3827
- const minLineY = Math.floor(deltaY / itemHeight);
3828
- const maxLineY = Math.min(minLineY + numberOfVisible, total);
3829
3831
  const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
3830
- const scrollBarY = getScrollBarY$1(deltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
3832
+ const newDeltaY = clamp(deltaY, 0, finalDeltaY);
3833
+ const minLineY = Math.floor(newDeltaY / itemHeight);
3834
+ const maxLineY = Math.min(minLineY + numberOfVisible, total);
3835
+ const scrollBarY = getScrollBarY$1(newDeltaY, finalDeltaY, listHeight, scrollBarHeight);
3831
3836
  return {
3832
3837
  ...state,
3838
+ deltaY: newDeltaY,
3833
3839
  finalDeltaY,
3834
3840
  height,
3835
3841
  maxLineY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "7.4.0",
3
+ "version": "7.6.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",