@lvce-editor/extension-search-view 5.0.0 → 5.2.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.
@@ -1269,17 +1269,17 @@ const Ellipsis = 'Ellipsis';
1269
1269
  const getInputActions = hasValue => {
1270
1270
  const clearEnabled = hasValue;
1271
1271
  const actions = [{
1272
- onClick: HandleClearSearchResults,
1272
+ enabled: clearEnabled,
1273
1273
  icon: `MaskIcon${ClearAll}`,
1274
+ onClick: HandleClearSearchResults,
1274
1275
  title: clearExtensionSearchResults(),
1275
- type: Button,
1276
- enabled: clearEnabled
1276
+ type: Button
1277
1277
  }, {
1278
+ enabled: true,
1278
1279
  icon: `MaskIcon${Filter}`,
1279
- title: filter(),
1280
- type: Button,
1281
1280
  onClick: HandleClickFilter,
1282
- enabled: true
1281
+ title: filter(),
1282
+ type: Button
1283
1283
  }];
1284
1284
  return actions;
1285
1285
  };
@@ -1383,16 +1383,16 @@ const parseValue = value => {
1383
1383
  });
1384
1384
  const isLocal = enabled || builtin || disabled || outdated || installed;
1385
1385
  return {
1386
- query: replaced,
1387
- enabled,
1388
1386
  builtin,
1387
+ category,
1389
1388
  disabled,
1390
- outdated,
1391
- installed,
1389
+ enabled,
1392
1390
  id,
1393
- sort,
1391
+ installed,
1394
1392
  isLocal,
1395
- category
1393
+ outdated,
1394
+ query: replaced,
1395
+ sort
1396
1396
  };
1397
1397
  };
1398
1398
 
@@ -1473,12 +1473,12 @@ const handleChange = async (state, update) => {
1473
1473
  const inputActions = getInputActions(hasValue);
1474
1474
  const {
1475
1475
  allExtensions,
1476
+ assetDir,
1477
+ headerHeight,
1478
+ height,
1476
1479
  itemHeight,
1477
1480
  minimumSliderSize,
1478
- height,
1479
- platform,
1480
- assetDir,
1481
- headerHeight
1481
+ platform
1482
1482
  } = state;
1483
1483
  // TODO cancel ongoing requests
1484
1484
  // TODO handle errors
@@ -1490,15 +1490,15 @@ const handleChange = async (state, update) => {
1490
1490
  deltaY: 0,
1491
1491
  finalDeltaY: 0,
1492
1492
  focus: Input,
1493
+ inputActions,
1494
+ inputSource,
1493
1495
  items,
1494
1496
  maxLineY: 0,
1495
1497
  message: noExtensionsFound(),
1496
1498
  minLineY: 0,
1497
1499
  placeholder: searchExtensionsInMarketPlace(),
1498
1500
  scrollBarHeight: 0,
1499
- searchValue: value,
1500
- inputSource,
1501
- inputActions
1501
+ searchValue: value
1502
1502
  };
1503
1503
  }
1504
1504
  const total = items.length;
@@ -1514,6 +1514,8 @@ const handleChange = async (state, update) => {
1514
1514
  allExtensions,
1515
1515
  deltaY: 0,
1516
1516
  finalDeltaY,
1517
+ inputActions,
1518
+ inputSource,
1517
1519
  items,
1518
1520
  maxLineY,
1519
1521
  message: '',
@@ -1521,9 +1523,7 @@ const handleChange = async (state, update) => {
1521
1523
  placeholder: searchExtensionsInMarketPlace(),
1522
1524
  scrollBarHeight,
1523
1525
  scrollBarY,
1524
- searchValue: value,
1525
- inputSource,
1526
- inputActions
1526
+ searchValue: value
1527
1527
  };
1528
1528
 
1529
1529
  // TODO handle out of order responses (a bit complicated)
@@ -1542,8 +1542,8 @@ const clearSearchResults = state => {
1542
1542
  return handleChange(state, {
1543
1543
  ...state,
1544
1544
  focus: Input,
1545
- searchValue: '',
1546
- inputSource: Script$1
1545
+ inputSource: Script$1,
1546
+ searchValue: ''
1547
1547
  });
1548
1548
  };
1549
1549
 
@@ -2003,8 +2003,8 @@ const RendererWorker = {
2003
2003
 
2004
2004
  const getFocusedItem = state => {
2005
2005
  const {
2006
- items,
2007
- focusedIndex
2006
+ focusedIndex,
2007
+ items
2008
2008
  } = state;
2009
2009
  if (focusedIndex === -1) {
2010
2010
  return undefined;
@@ -2034,10 +2034,10 @@ const stringifyRow = row => {
2034
2034
  };
2035
2035
  const getExtensionInfoText = extension => {
2036
2036
  const {
2037
- name: name$1,
2037
+ description: description$1,
2038
2038
  id: id$1,
2039
- publisher: publisher$1,
2040
- description: description$1
2039
+ name: name$1,
2040
+ publisher: publisher$1
2041
2041
  } = extension;
2042
2042
  const version$1 = ''; // TODO
2043
2043
  const marketplaceLink$1 = ''; // TODO
@@ -2076,14 +2076,14 @@ const copyExtensionInfo = async state => {
2076
2076
  };
2077
2077
 
2078
2078
  const {
2079
- get,
2080
- set: set$2,
2079
+ diff,
2081
2080
  dispose: dispose$1,
2082
- wrapCommand,
2081
+ get,
2083
2082
  getCommandIds,
2084
2083
  registerCommands,
2085
- wrapGetter,
2086
- diff
2084
+ set: set$2,
2085
+ wrapCommand,
2086
+ wrapGetter
2087
2087
  } = create$2();
2088
2088
 
2089
2089
  const create = (id, uri, x, y, width, height, platform, assetDir) => {
@@ -2331,15 +2331,15 @@ const focusPreviousPage = state => {
2331
2331
 
2332
2332
  const getActions = () => {
2333
2333
  return [{
2334
- type: Button,
2335
- id: refresh(),
2334
+ command: '',
2336
2335
  icon: Refresh,
2337
- command: ''
2336
+ id: refresh(),
2337
+ type: Button
2338
2338
  }, {
2339
- type: Button,
2340
- id: viewsAndMoreActions(),
2339
+ command: '',
2341
2340
  icon: Ellipsis,
2342
- command: ''
2341
+ id: viewsAndMoreActions(),
2342
+ type: Button
2343
2343
  }];
2344
2344
  };
2345
2345
 
@@ -2359,44 +2359,44 @@ const FocusExtensionsInput = 7000;
2359
2359
 
2360
2360
  const getKeyBindings = () => {
2361
2361
  return [{
2362
- key: Home,
2363
2362
  command: 'Extensions.focusFirst',
2363
+ key: Home,
2364
2364
  when: FocusExtensions
2365
2365
  }, {
2366
- key: End,
2367
2366
  command: 'Extensions.focusLast',
2367
+ key: End,
2368
2368
  when: FocusExtensions
2369
2369
  }, {
2370
- key: PageUp,
2371
2370
  command: 'Extensions.focusPreviousPage',
2371
+ key: PageUp,
2372
2372
  when: FocusExtensions
2373
2373
  }, {
2374
- key: PageDown,
2375
2374
  command: 'Extensions.focusNextPage',
2375
+ key: PageDown,
2376
2376
  when: FocusExtensions
2377
2377
  }, {
2378
- key: UpArrow,
2379
2378
  command: 'Extensions.focusPrevious',
2379
+ key: UpArrow,
2380
2380
  when: FocusExtensions
2381
2381
  }, {
2382
- key: DownArrow,
2383
2382
  command: 'Extensions.focusNext',
2383
+ key: DownArrow,
2384
2384
  when: FocusExtensions
2385
2385
  }, {
2386
- key: Space,
2387
2386
  command: 'Extensions.handleClickCurrentButKeepFocus',
2387
+ key: Space,
2388
2388
  when: FocusExtensions
2389
2389
  }, {
2390
- key: Enter,
2391
2390
  command: 'Extensions.handleClickCurrent',
2391
+ key: Enter,
2392
2392
  when: FocusExtensions
2393
2393
  }, {
2394
- key: CtrlCmd | Space,
2395
2394
  command: 'Extensions.toggleSuggest',
2395
+ key: CtrlCmd | Space,
2396
2396
  when: FocusExtensions
2397
2397
  }, {
2398
- key: CtrlCmd | DownArrow,
2399
2398
  command: 'Extensions.scrollDown',
2399
+ key: CtrlCmd | DownArrow,
2400
2400
  when: FocusExtensions
2401
2401
  }];
2402
2402
  };
@@ -2405,30 +2405,30 @@ const None$1 = 0;
2405
2405
 
2406
2406
  const getMenuEntries = () => {
2407
2407
  return [{
2408
- id: 'enable',
2409
- label: enable(),
2408
+ command: 'SearchExtensions.enable',
2410
2409
  flags: None$1,
2411
- command: 'SearchExtensions.enable'
2410
+ id: 'enable',
2411
+ label: enable()
2412
2412
  }, {
2413
- id: 'disable',
2414
- label: disable(),
2413
+ command: 'SearchExtensions.disable',
2415
2414
  flags: None$1,
2416
- command: 'SearchExtensions.disable'
2415
+ id: 'disable',
2416
+ label: disable()
2417
2417
  }, {
2418
- id: 'installAnotherVersion',
2419
- label: installAnotherVersion(),
2418
+ command: 'SearchExtensions.installAnotherVersion',
2420
2419
  flags: None$1,
2421
- command: 'SearchExtensions.installAnotherVersion'
2420
+ id: 'installAnotherVersion',
2421
+ label: installAnotherVersion()
2422
2422
  }, {
2423
- id: 'copy',
2424
- label: copy(),
2423
+ command: 'Extensions.copyExtensionInfo',
2425
2424
  flags: None$1,
2426
- command: 'Extensions.copyExtensionInfo'
2425
+ id: 'copy',
2426
+ label: copy()
2427
2427
  }, {
2428
- id: 'copyExtensionId',
2429
- label: copyExtensionId$1(),
2428
+ command: 'Extensions.copyExtensionId',
2430
2429
  flags: None$1,
2431
- command: 'Extensions.copyExtensionId'
2430
+ id: 'copyExtensionId',
2431
+ label: copyExtensionId$1()
2432
2432
  }];
2433
2433
  };
2434
2434
 
@@ -2453,10 +2453,9 @@ const getExtensionDetailUri = extensionId => {
2453
2453
 
2454
2454
  const {
2455
2455
  invoke: invoke$1,
2456
- set: set$1,
2457
2456
  openUri: openUri$1,
2458
- sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1
2459
- } = RendererWorker;
2457
+ sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
2458
+ set: set$1} = RendererWorker;
2460
2459
 
2461
2460
  const openUri = async uri => {
2462
2461
  return openUri$1(uri);
@@ -2468,6 +2467,9 @@ const handleClick = async (state, index) => {
2468
2467
  minLineY
2469
2468
  } = state;
2470
2469
  const actualIndex = index + minLineY;
2470
+ if (actualIndex < 0 || actualIndex >= items.length) {
2471
+ return state;
2472
+ }
2471
2473
  const extension = items[actualIndex];
2472
2474
  const uri = getExtensionDetailUri(extension.id);
2473
2475
  await openUri(uri);
@@ -2503,11 +2505,11 @@ const handleClickAt = async (state, button, eventX, eventY) => {
2503
2505
  return state;
2504
2506
  }
2505
2507
  const {
2506
- x,
2507
- y,
2508
- itemHeight,
2509
2508
  deltaY,
2510
- headerHeight
2509
+ headerHeight,
2510
+ itemHeight,
2511
+ x,
2512
+ y
2511
2513
  } = state;
2512
2514
  const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, headerHeight);
2513
2515
  return handleClick(state, index);
@@ -2566,8 +2568,8 @@ const handleHeaderContextMenu = async state => {
2566
2568
 
2567
2569
  const handleInput = async (state, value, inputSource = User) => {
2568
2570
  return handleChange(state, {
2569
- searchValue: value,
2570
- inputSource
2571
+ inputSource,
2572
+ searchValue: value
2571
2573
  });
2572
2574
  };
2573
2575
 
@@ -2589,21 +2591,21 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
2589
2591
  if (relativeY <= halfScrollBarHeight) {
2590
2592
  // clicked at top
2591
2593
  return {
2592
- percent: 0,
2593
- handleOffset: relativeY
2594
+ handleOffset: relativeY,
2595
+ percent: 0
2594
2596
  };
2595
2597
  }
2596
2598
  if (relativeY <= height - halfScrollBarHeight) {
2597
2599
  // clicked in middle
2598
2600
  return {
2599
- percent: (relativeY - halfScrollBarHeight) / (height - scrollBarHeight),
2600
- handleOffset: halfScrollBarHeight
2601
+ handleOffset: halfScrollBarHeight,
2602
+ percent: (relativeY - halfScrollBarHeight) / (height - scrollBarHeight)
2601
2603
  };
2602
2604
  }
2603
2605
  // clicked at bottom
2604
2606
  return {
2605
- percent: 1,
2606
- handleOffset: scrollBarHeight - height + relativeY
2607
+ handleOffset: scrollBarHeight - height + relativeY,
2608
+ percent: 1
2607
2609
  };
2608
2610
  };
2609
2611
 
@@ -2618,11 +2620,11 @@ const setDeltaY = (state, value) => {
2618
2620
  object(state);
2619
2621
  number(value);
2620
2622
  const {
2621
- itemHeight,
2622
- finalDeltaY,
2623
2623
  deltaY,
2624
- height,
2624
+ finalDeltaY,
2625
2625
  headerHeight,
2626
+ height,
2627
+ itemHeight,
2626
2628
  items,
2627
2629
  minimumSliderSize
2628
2630
  } = state;
@@ -2641,8 +2643,8 @@ const setDeltaY = (state, value) => {
2641
2643
  return {
2642
2644
  ...state,
2643
2645
  deltaY: newDeltaY,
2644
- minLineY,
2645
2646
  maxLineY,
2647
+ minLineY,
2646
2648
  scrollBarY
2647
2649
  };
2648
2650
  };
@@ -2650,12 +2652,12 @@ const setDeltaY = (state, value) => {
2650
2652
  const handleScrollBarClick = (state, eventY) => {
2651
2653
  // TODO move this to list
2652
2654
  const {
2653
- y,
2654
2655
  deltaY,
2655
- headerHeight,
2656
2656
  finalDeltaY,
2657
+ headerHeight,
2658
+ height,
2657
2659
  scrollBarHeight,
2658
- height
2660
+ y
2659
2661
  } = state;
2660
2662
  const contentHeight = height - headerHeight;
2661
2663
  const relativeY = eventY - y - headerHeight;
@@ -2669,8 +2671,8 @@ const handleScrollBarClick = (state, eventY) => {
2669
2671
  };
2670
2672
  }
2671
2673
  const {
2672
- percent,
2673
- handleOffset
2674
+ handleOffset,
2675
+ percent
2674
2676
  } = getNewDeltaPercent(contentHeight, scrollBarHeight, relativeY);
2675
2677
  const newDeltaY = percent * finalDeltaY;
2676
2678
  return {
@@ -2690,12 +2692,12 @@ const getNewPercent = (contentHeight, scrollBarHeight, relativeY) => {
2690
2692
  };
2691
2693
  const handleScrollBarMove = (state, eventY) => {
2692
2694
  const {
2693
- y,
2694
- headerHeight,
2695
- handleOffset,
2696
2695
  finalDeltaY,
2696
+ handleOffset,
2697
+ headerHeight,
2697
2698
  height,
2698
- scrollBarHeight
2699
+ scrollBarHeight,
2700
+ y
2699
2701
  } = state;
2700
2702
  const relativeY = eventY - y - headerHeight - handleOffset;
2701
2703
  const contentHeight = height - headerHeight;
@@ -2732,8 +2734,9 @@ const createExtensionHostWorkerRpc = async () => {
2732
2734
  };
2733
2735
 
2734
2736
  const {
2735
- set,
2736
- invoke} = ExtensionHost;
2737
+ invoke,
2738
+ set
2739
+ } = ExtensionHost;
2737
2740
 
2738
2741
  const initializeExtensionHostWorker = async () => {
2739
2742
  const rpc = await createExtensionHostWorkerRpc();
@@ -2875,13 +2878,13 @@ const getPublisher = extension => {
2875
2878
 
2876
2879
  const normalizeExtension$1 = (extension, platform, assetDir) => {
2877
2880
  return {
2881
+ categories: getCategories(extension),
2882
+ description: getDescription(extension),
2883
+ icon: getIcon(extension, platform, assetDir),
2878
2884
  id: getId$1(extension),
2879
2885
  name: getName(extension),
2880
- description: getDescription(extension),
2881
- uri: '',
2882
2886
  publisher: getPublisher(extension),
2883
- icon: getIcon(extension, platform, assetDir),
2884
- categories: getCategories(extension)
2887
+ uri: ''
2885
2888
  };
2886
2889
  };
2887
2890
 
@@ -2910,20 +2913,20 @@ const restoreState = savedState => {
2910
2913
  const searchValue = getSavedValue(savedState);
2911
2914
  const savedDeltaY = getSavedDeltaY(savedState);
2912
2915
  return {
2913
- searchValue,
2914
- deltaY: savedDeltaY
2916
+ deltaY: savedDeltaY,
2917
+ searchValue
2915
2918
  };
2916
2919
  };
2917
2920
 
2918
2921
  const loadContent = async (state, savedState) => {
2919
2922
  const {
2920
- width,
2923
+ assetDir,
2921
2924
  platform,
2922
- assetDir
2925
+ width
2923
2926
  } = state;
2924
2927
  const {
2925
- searchValue,
2926
- deltaY
2928
+ deltaY,
2929
+ searchValue
2927
2930
  } = restoreState(savedState);
2928
2931
  // TODO just get local extensions on demand (not when query string is already different)
2929
2932
  const allExtensions = await getAllExtensions(platform);
@@ -2932,9 +2935,9 @@ const loadContent = async (state, savedState) => {
2932
2935
  const updatedState = await handleInput({
2933
2936
  ...state,
2934
2937
  allExtensions: normalized,
2935
- size,
2938
+ deltaY,
2936
2939
  inputSource: Script,
2937
- deltaY
2940
+ size
2938
2941
  }, searchValue, Script);
2939
2942
  return updatedState;
2940
2943
  };
@@ -2957,8 +2960,8 @@ const getSelector = focus => {
2957
2960
  };
2958
2961
  const renderFocus = newState => {
2959
2962
  const {
2960
- uid,
2961
- focus
2963
+ focus,
2964
+ uid
2962
2965
  } = newState;
2963
2966
  if (!focus) {
2964
2967
  return [];
@@ -3022,56 +3025,56 @@ const getClassName$1 = enabled => {
3022
3025
  };
3023
3026
  const getSearchFieldButtonVirtualDom = button => {
3024
3027
  const {
3025
- icon,
3026
- title,
3027
3028
  enabled,
3028
- onClick
3029
+ icon,
3030
+ onClick,
3031
+ title
3029
3032
  } = button;
3030
3033
  return [{
3031
- type: Button$2,
3034
+ childCount: 1,
3032
3035
  className: getClassName$1(enabled),
3033
- title,
3036
+ onClick,
3034
3037
  tabIndex: 0,
3035
- childCount: 1,
3036
- onClick
3038
+ title,
3039
+ type: Button$2
3037
3040
  }, {
3038
- type: Div,
3041
+ childCount: 0,
3039
3042
  className: mergeClassNames(MaskIcon, icon),
3040
- childCount: 0
3043
+ type: Div
3041
3044
  }];
3042
3045
  };
3043
3046
 
3044
3047
  const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '') => {
3045
3048
  // TODO avoid mutation
3046
3049
  const dom = [{
3047
- type: Div,
3050
+ childCount: 2,
3048
3051
  className: SearchField,
3049
3052
  role: None,
3050
- childCount: 2
3053
+ type: Div
3051
3054
  }, {
3052
- type: Input$1,
3053
- inputType: 'search',
3054
- className: MultilineInputBox,
3055
- spellcheck: false,
3056
3055
  autocapitalize: 'off',
3057
- autocorrect: 'off',
3058
3056
  autocomplete: 'off',
3059
- placeholder,
3057
+ autocorrect: 'off',
3058
+ childCount: 0,
3059
+ className: MultilineInputBox,
3060
+ inputType: 'search',
3060
3061
  name,
3061
- onInput,
3062
3062
  onFocus,
3063
- childCount: 0
3063
+ onInput,
3064
+ placeholder,
3065
+ spellcheck: false,
3066
+ type: Input$1
3064
3067
  }, {
3065
- type: Div,
3068
+ childCount: insideButtons.length,
3066
3069
  className: SearchFieldButtons,
3067
- childCount: insideButtons.length
3070
+ type: Div
3068
3071
  }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
3069
3072
  if (outsideButtons.length > 0) {
3070
3073
  dom.unshift({
3071
- type: Div,
3074
+ childCount: 1 + outsideButtons.length,
3072
3075
  className: SearchFieldContainer,
3073
3076
  role: None,
3074
- childCount: 1 + outsideButtons.length
3077
+ type: Div
3075
3078
  });
3076
3079
  dom.push(...outsideButtons.flatMap(getSearchFieldButtonVirtualDom));
3077
3080
  }
@@ -3079,10 +3082,10 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
3079
3082
  };
3080
3083
 
3081
3084
  const parentNode = {
3082
- type: Div,
3083
- className: ExtensionHeader,
3084
3085
  childCount: 1,
3085
- onContextMenu: HandleHeaderContextMenu
3086
+ className: ExtensionHeader,
3087
+ onContextMenu: HandleHeaderContextMenu,
3088
+ type: Div
3086
3089
  };
3087
3090
  const getExtensionHeaderVirtualDom = (placeholder, actions) => {
3088
3091
  return [parentNode, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [])];
@@ -3097,29 +3100,29 @@ const renderHeader = newState => {
3097
3100
  const Extension = 'Extension';
3098
3101
 
3099
3102
  const listItemDetail = {
3100
- type: Div,
3103
+ childCount: 3,
3101
3104
  className: ExtensionListItemDetail,
3102
- childCount: 3
3105
+ type: Div
3103
3106
  };
3104
3107
  const listItemName = {
3105
- type: Div,
3108
+ childCount: 1,
3106
3109
  className: ExtensionListItemName,
3107
- childCount: 1
3110
+ type: Div
3108
3111
  };
3109
3112
  const listItemDescription = {
3110
- type: Div,
3113
+ childCount: 1,
3111
3114
  className: ExtensionListItemDescription,
3112
- childCount: 1
3115
+ type: Div
3113
3116
  };
3114
3117
  const listItemFooter = {
3115
- type: Div,
3118
+ childCount: 2,
3116
3119
  className: ExtensionListItemFooter,
3117
- childCount: 2
3120
+ type: Div
3118
3121
  };
3119
3122
  const listItemAuthorName = {
3120
- type: Div,
3123
+ childCount: 1,
3121
3124
  className: ExtensionListItemAuthorName,
3122
- childCount: 1
3125
+ type: Div
3123
3126
  };
3124
3127
  const getClassName = focused => {
3125
3128
  if (focused) {
@@ -3135,46 +3138,44 @@ const getId = focused => {
3135
3138
  };
3136
3139
  const getExtensionListItemVirtualDom = extension => {
3137
3140
  const {
3138
- posInSet,
3139
- setSize,
3140
- top,
3141
+ description,
3142
+ focused,
3141
3143
  icon,
3142
3144
  name,
3143
- description,
3145
+ posInSet,
3144
3146
  publisher,
3145
- focused
3147
+ setSize,
3148
+ top
3146
3149
  } = extension;
3147
3150
  const dom = [{
3148
- type: Div,
3149
- role: ListItem,
3151
+ ariaPosInSet: posInSet,
3150
3152
  ariaRoleDescription: Extension,
3153
+ ariaSetSize: setSize,
3154
+ childCount: 2,
3151
3155
  className: getClassName(focused),
3152
3156
  id: getId(focused),
3153
- ariaPosInSet: posInSet,
3154
- ariaSetSize: setSize,
3157
+ role: ListItem,
3155
3158
  top,
3156
- childCount: 2
3159
+ type: Div
3157
3160
  }, {
3158
- type: Img,
3159
- src: icon,
3161
+ childCount: 0,
3160
3162
  className: ExtensionListItemIcon,
3161
3163
  role: None,
3162
- childCount: 0
3164
+ src: icon,
3165
+ type: Img
3163
3166
  }, listItemDetail, listItemName, text(name), listItemDescription, text(description), listItemFooter, listItemAuthorName, text(publisher), {
3164
- type: Div,
3167
+ childCount: 0,
3165
3168
  className: ExtensionActions,
3166
- childCount: 0
3169
+ type: Div
3167
3170
  }];
3168
3171
  return dom;
3169
3172
  };
3170
3173
 
3171
3174
  const getExtensionsListVirtualDom = visibleExtensions => {
3172
3175
  const dom = [{
3173
- type: Div,
3174
- className: ListItems,
3175
- tabIndex: 0,
3176
3176
  ariaLabel: extensions(),
3177
- role: List,
3177
+ childCount: visibleExtensions.length,
3178
+ className: ListItems,
3178
3179
  onContextmenu: HandleContextMenu,
3179
3180
  onContextMenu: HandleContextMenu,
3180
3181
  onFocus: HandleFocus,
@@ -3183,7 +3184,9 @@ const getExtensionsListVirtualDom = visibleExtensions => {
3183
3184
  onTouchMove: HandleTouchMove,
3184
3185
  onTouchStart: HandleTouchStart,
3185
3186
  onWheel: HandleWheel,
3186
- childCount: visibleExtensions.length
3187
+ role: List,
3188
+ tabIndex: 0,
3189
+ type: Div
3187
3190
  }, ...visibleExtensions.flatMap(getExtensionListItemVirtualDom)];
3188
3191
  return dom;
3189
3192
  };
@@ -3210,50 +3213,50 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
3210
3213
  const heightString = px(scrollBarHeight);
3211
3214
  const translateString = position(0, scrollBarTop);
3212
3215
  return [{
3213
- type: Div,
3216
+ childCount: 1,
3214
3217
  className: mergeClassNames(ScrollBar, ScrollBarSmall),
3215
3218
  onPointerDown: HandleScrollBarPointerDown,
3216
3219
  // TODO support pointercapture event
3217
- childCount: 1
3220
+ type: Div
3218
3221
  }, {
3219
- type: Div,
3220
- className: ScrollBarThumb,
3221
3222
  childCount: 0,
3223
+ className: ScrollBarThumb,
3222
3224
  height: heightString,
3223
- translate: translateString
3225
+ translate: translateString,
3226
+ type: Div
3224
3227
  }];
3225
3228
  };
3226
3229
 
3227
3230
  const getVisibleItem = (item, setSize, itemHeight, minLineY, relative, i, focusedIndex) => {
3228
3231
  // TODO use normal parameters
3229
3232
  const {
3230
- publisher,
3231
3233
  description,
3232
3234
  icon,
3233
3235
  id,
3234
- name
3236
+ name,
3237
+ publisher
3235
3238
  } = item;
3236
3239
  return {
3237
- setSize,
3238
- posInSet: i + 1,
3239
- top: (i - minLineY) * itemHeight - relative,
3240
- focused: i === focusedIndex,
3241
- publisher,
3242
3240
  description,
3241
+ focused: i === focusedIndex,
3243
3242
  icon,
3244
3243
  id,
3245
- name
3244
+ name,
3245
+ posInSet: i + 1,
3246
+ publisher,
3247
+ setSize,
3248
+ top: (i - minLineY) * itemHeight - relative
3246
3249
  };
3247
3250
  };
3248
3251
 
3249
3252
  const getVisible = state => {
3250
3253
  const {
3251
- minLineY,
3252
- maxLineY,
3253
- items,
3254
- itemHeight,
3255
3254
  deltaY,
3256
- focusedIndex
3255
+ focusedIndex,
3256
+ itemHeight,
3257
+ items,
3258
+ maxLineY,
3259
+ minLineY
3257
3260
  } = state;
3258
3261
  const setSize = items.length;
3259
3262
  const visible = [];
@@ -3268,32 +3271,32 @@ const getVisible = state => {
3268
3271
  const getContentVirtualDom = (visibleExtensions, message, scrollBarHeight, scrollBarY) => {
3269
3272
  if (message) {
3270
3273
  return [{
3271
- type: Div,
3272
- childCount: 1
3274
+ childCount: 1,
3275
+ type: Div
3273
3276
  }, text(message)];
3274
3277
  }
3275
3278
  return [{
3276
- type: Div,
3279
+ childCount: 2,
3277
3280
  className: mergeClassNames(Viewlet, List$1),
3278
- childCount: 2
3281
+ type: Div
3279
3282
  }, ...getExtensionsVirtualDom(visibleExtensions), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarY)];
3280
3283
  };
3281
3284
  const getExtensionsViewVirtualDom = state => {
3282
3285
  const visibleExtensions = getVisible(state);
3283
3286
  const {
3284
- placeholder,
3285
3287
  inputActions,
3286
3288
  message,
3289
+ placeholder,
3287
3290
  scrollBarHeight,
3288
3291
  scrollBarY
3289
3292
  } = state;
3290
3293
  return [{
3291
- type: Div,
3292
- className: mergeClassNames(Viewlet, Extensions),
3293
- childCount: 2,
3294
- ariaLive: 'polite',
3295
3294
  ariaBusy: false,
3296
- role: None$3
3295
+ ariaLive: 'polite',
3296
+ childCount: 2,
3297
+ className: mergeClassNames(Viewlet, Extensions),
3298
+ role: None$3,
3299
+ type: Div
3297
3300
  }, ...getExtensionHeaderVirtualDom(placeholder, inputActions), ...getContentVirtualDom(visibleExtensions, message, scrollBarHeight, scrollBarY)];
3298
3301
  };
3299
3302
 
@@ -3331,6 +3334,12 @@ const renderSearchValue = newState => {
3331
3334
 
3332
3335
  const getRenderer = diffType => {
3333
3336
  switch (diffType) {
3337
+ case RenderFocus:
3338
+ return renderFocus;
3339
+ case RenderFocusContext:
3340
+ return renderFocusContext;
3341
+ case RenderHeader:
3342
+ return renderHeader;
3334
3343
  case RenderItems:
3335
3344
  return renderItems2;
3336
3345
  case RenderMessage:
@@ -3339,12 +3348,6 @@ const getRenderer = diffType => {
3339
3348
  return renderScrollBar;
3340
3349
  case RenderSearchValue:
3341
3350
  return renderSearchValue;
3342
- case RenderHeader:
3343
- return renderHeader;
3344
- case RenderFocus:
3345
- return renderFocus;
3346
- case RenderFocusContext:
3347
- return renderFocusContext;
3348
3351
  default:
3349
3352
  throw new Error('unknown renderer');
3350
3353
  }
@@ -3361,8 +3364,8 @@ const applyRender = (oldState, newState, diffResult) => {
3361
3364
 
3362
3365
  const render3 = (uid, diffResult) => {
3363
3366
  const {
3364
- oldState,
3365
- newState
3367
+ newState,
3368
+ oldState
3366
3369
  } = get(uid);
3367
3370
  set$2(uid, newState, newState);
3368
3371
  const commands = applyRender(oldState, newState, diffResult);
@@ -3371,23 +3374,23 @@ const render3 = (uid, diffResult) => {
3371
3374
 
3372
3375
  const getIconVirtualDom = (icon, type = Div) => {
3373
3376
  return {
3374
- type,
3377
+ childCount: 0,
3375
3378
  className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
3376
3379
  role: None,
3377
- childCount: 0
3380
+ type
3378
3381
  };
3379
3382
  };
3380
3383
 
3381
3384
  const getActionButtonVirtualDom = action => {
3382
3385
  const {
3383
- id,
3384
- icon
3386
+ icon,
3387
+ id
3385
3388
  } = action;
3386
3389
  return [{
3387
- type: Button$2,
3390
+ childCount: 1,
3388
3391
  className: IconButton,
3389
3392
  title: id,
3390
- childCount: 1
3393
+ type: Button$2
3391
3394
  }, getIconVirtualDom(icon)];
3392
3395
  };
3393
3396
 
@@ -3402,17 +3405,17 @@ const getActionVirtualDom = action => {
3402
3405
 
3403
3406
  const getActionsVirtualDom = actions => {
3404
3407
  return [{
3405
- type: Div,
3408
+ childCount: actions.length,
3406
3409
  className: Actions,
3407
3410
  role: ToolBar,
3408
- childCount: actions.length
3411
+ type: Div
3409
3412
  }, ...actions.flatMap(getActionVirtualDom)];
3410
3413
  };
3411
3414
 
3412
3415
  const renderActions = uid => {
3413
3416
  const {
3414
- oldState,
3415
- newState
3417
+ newState,
3418
+ oldState
3416
3419
  } = get(uid);
3417
3420
  if (oldState === newState) {
3418
3421
  return [];
@@ -3467,16 +3470,16 @@ const renderEventListeners = () => {
3467
3470
 
3468
3471
  const resize = async (state, dimensions) => {
3469
3472
  const {
3470
- items,
3471
- itemHeight,
3472
3473
  headerHeight,
3474
+ itemHeight,
3475
+ items,
3473
3476
  minimumSliderSize
3474
3477
  } = state;
3475
3478
  const {
3476
- x,
3477
- y,
3479
+ height,
3478
3480
  width,
3479
- height
3481
+ x,
3482
+ y
3480
3483
  } = dimensions;
3481
3484
  const total = items.length;
3482
3485
  const listHeight = getListHeight(total, itemHeight, height);
@@ -3501,19 +3504,19 @@ const resize = async (state, dimensions) => {
3501
3504
 
3502
3505
  const saveState = state => {
3503
3506
  const {
3504
- searchValue,
3505
- deltaY
3507
+ deltaY,
3508
+ searchValue
3506
3509
  } = state;
3507
3510
  return {
3508
- searchValue,
3509
- deltaY
3511
+ deltaY,
3512
+ searchValue
3510
3513
  };
3511
3514
  };
3512
3515
 
3513
3516
  const scrollDown = state => {
3514
3517
  const {
3515
- finalDeltaY,
3516
- deltaY
3518
+ deltaY,
3519
+ finalDeltaY
3517
3520
  } = state;
3518
3521
  const newDeltaY = Math.min(deltaY + 20, finalDeltaY);
3519
3522
  return setDeltaY(state, newDeltaY);
@@ -3541,9 +3544,7 @@ const commandMap = {
3541
3544
  'SearchExtensions.focusFirst': wrapCommand(focusFirst),
3542
3545
  'SearchExtensions.focusIndex': wrapCommand(focusIndex),
3543
3546
  'SearchExtensions.focusLast': wrapCommand(focusLast),
3544
- 'SearchExtensions.getMenuEntries2': wrapGetter(getMenuEntries2),
3545
3547
  'SearchExtensions.focusNext': wrapCommand(focusNext),
3546
- 'SearchExtensions.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
3547
3548
  'SearchExtensions.focusNextPage': wrapCommand(focusNextPage),
3548
3549
  'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
3549
3550
  'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
@@ -3551,6 +3552,8 @@ const commandMap = {
3551
3552
  'SearchExtensions.getCommandIds': getCommandIds,
3552
3553
  'SearchExtensions.getKeyBindings': getKeyBindings,
3553
3554
  'SearchExtensions.getMenuEntries': getMenuEntries,
3555
+ 'SearchExtensions.getMenuEntries2': wrapGetter(getMenuEntries2),
3556
+ 'SearchExtensions.getMenuIds': getMenuIds,
3554
3557
  'SearchExtensions.handleBlur': wrapCommand(handleBlur),
3555
3558
  'SearchExtensions.handleClick': wrapCommand(handleClick),
3556
3559
  'SearchExtensions.handleClickAt': wrapCommand(handleClickAt),
@@ -3560,6 +3563,7 @@ const commandMap = {
3560
3563
  'SearchExtensions.handleDisable': wrapCommand(handleDisable),
3561
3564
  'SearchExtensions.handleEnable': wrapCommand(handleEnable),
3562
3565
  'SearchExtensions.handleFocus': wrapCommand(handleFocus),
3566
+ 'SearchExtensions.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
3563
3567
  'SearchExtensions.handleInput': wrapCommand(handleInput),
3564
3568
  'SearchExtensions.handleInstall': wrapCommand(handleInstall),
3565
3569
  'SearchExtensions.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
@@ -3574,6 +3578,7 @@ const commandMap = {
3574
3578
  'SearchExtensions.render3': render3,
3575
3579
  'SearchExtensions.renderActions': renderActions,
3576
3580
  'SearchExtensions.renderEventListeners': renderEventListeners,
3581
+ 'SearchExtensions.resize': wrapCommand(resize),
3577
3582
  'SearchExtensions.restoreState': restoreState,
3578
3583
  'SearchExtensions.saveState': wrapGetter(saveState),
3579
3584
  'SearchExtensions.scrollDown': wrapCommand(scrollDown),
@@ -3581,9 +3586,7 @@ const commandMap = {
3581
3586
  'SearchExtensions.selectIndex': wrapCommand(selectIndex),
3582
3587
  'SearchExtensions.setDeltaY': wrapCommand(setDeltaY),
3583
3588
  'SearchExtensions.terminate': terminate,
3584
- 'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest),
3585
- 'SearchExtensions.resize': wrapCommand(resize),
3586
- 'SearchExtensions.getMenuIds': getMenuIds
3589
+ 'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest)
3587
3590
  };
3588
3591
 
3589
3592
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",