@lvce-editor/quick-pick-worker 4.22.3 → 4.23.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.
@@ -3468,6 +3468,7 @@ const toProtoVisibleItem = uri => {
3468
3468
  iconName: isRemoteSsh ? folderName : undefined,
3469
3469
  label,
3470
3470
  matches: [],
3471
+ removeButton: true,
3471
3472
  uri
3472
3473
  };
3473
3474
  };
@@ -3969,20 +3970,6 @@ const getIndex = (top, headerHeight, itemHeight, y) => {
3969
3970
  return index;
3970
3971
  };
3971
3972
 
3972
- const getPick = (items, index) => {
3973
- array(items);
3974
- number(index);
3975
- // if (index < state.recentPicks.length) {
3976
- // return state.recentPicks[index]
3977
- // }
3978
- // index -= state.recentPicks.length
3979
- if (index < items.length) {
3980
- return items[index];
3981
- }
3982
- console.warn('no pick matching index', index);
3983
- return undefined;
3984
- };
3985
-
3986
3973
  const Commands = 'quickPick://commands';
3987
3974
  const EveryThing = 'quickPick://everything';
3988
3975
  const Recent = 'quickPick://recent';
@@ -4171,6 +4158,20 @@ const loadContentWithContext = async context => {
4171
4158
  notifyVisible();
4172
4159
  };
4173
4160
 
4161
+ const getPick = (items, index) => {
4162
+ array(items);
4163
+ number(index);
4164
+ // if (index < state.recentPicks.length) {
4165
+ // return state.recentPicks[index]
4166
+ // }
4167
+ // index -= state.recentPicks.length
4168
+ if (index < items.length) {
4169
+ return items[index];
4170
+ }
4171
+ console.warn('no pick matching index', index);
4172
+ return undefined;
4173
+ };
4174
+
4174
4175
  const createCustomPick = value => {
4175
4176
  return {
4176
4177
  description: '',
@@ -4256,7 +4257,18 @@ const selectIndex = async (state, index, button = /* left */0) => {
4256
4257
  // }
4257
4258
  };
4258
4259
 
4259
- const handleClickAt = (state, x, y) => {
4260
+ const handleClickAt = async (state, x, y, uri) => {
4261
+ if (uri) {
4262
+ if (state.providerId !== Recent$1 || state.items.every(item => item.uri !== uri)) {
4263
+ return state;
4264
+ }
4265
+ await invoke$3('RecentlyOpened.removeRecentlyOpened', uri);
4266
+ const next = await loadContent({
4267
+ ...state,
4268
+ value: ''
4269
+ });
4270
+ return state.value ? setValue(next, state.value) : next;
4271
+ }
4260
4272
  const {
4261
4273
  headerHeight,
4262
4274
  itemHeight,
@@ -4928,7 +4940,9 @@ const getQuickPickItemVirtualDom = visibleItem => {
4928
4940
  isActive,
4929
4941
  label,
4930
4942
  posInSet,
4931
- setSize
4943
+ removeButton,
4944
+ setSize,
4945
+ uri
4932
4946
  } = visibleItem;
4933
4947
  const dom = [{
4934
4948
  ariaPosInSet: posInSet,
@@ -4964,6 +4978,17 @@ const getQuickPickItemVirtualDom = visibleItem => {
4964
4978
  type: Div
4965
4979
  }, text(description));
4966
4980
  }
4981
+ if (removeButton) {
4982
+ parent.childCount++;
4983
+ dom.push({
4984
+ ariaLabel: 'Remove from Recently Opened',
4985
+ childCount: 1,
4986
+ className: 'QuickPickItemRemove',
4987
+ 'data-uri': uri,
4988
+ title: 'Remove from Recently Opened',
4989
+ type: Button
4990
+ }, text('×'));
4991
+ }
4967
4992
  return dom;
4968
4993
  };
4969
4994
 
@@ -5154,7 +5179,7 @@ const render2 = (uid, diffResult) => {
5154
5179
  const renderEventListeners = () => {
5155
5180
  return [{
5156
5181
  name: HandlePointerDown,
5157
- params: ['handleClickAt', 'event.clientX', 'event.clientY'],
5182
+ params: ['handleClickAt', 'event.clientX', 'event.clientY', 'event.target.dataset.uri'],
5158
5183
  preventDefault: true
5159
5184
  }, {
5160
5185
  name: HandleWheel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.22.3",
3
+ "version": "4.23.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"