@lvce-editor/extension-search-view 7.0.0 → 7.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.
@@ -1061,6 +1061,7 @@ const ExtensionManagementWorker = 9006;
1061
1061
  const RendererWorker = 1;
1062
1062
 
1063
1063
  const FocusSelector = 'Viewlet.focusSelector';
1064
+ const SetCss = 'Viewlet.setCss';
1064
1065
  const SetDom2 = 'Viewlet.setDom2';
1065
1066
  const SetPatches = 'Viewlet.setPatches';
1066
1067
 
@@ -1854,6 +1855,10 @@ const create = (id, uri, x, y, width, height, platform, assetDir) => {
1854
1855
  set$1(id, state, state);
1855
1856
  };
1856
1857
 
1858
+ const isEqual$3 = (oldState, newState) => {
1859
+ return newState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarY === newState.scrollBarY && oldState.initial === newState.initial && oldState.deltaY === newState.deltaY;
1860
+ };
1861
+
1857
1862
  const isEqual$2 = (oldState, newState) => {
1858
1863
  if (!newState.focus) {
1859
1864
  return true;
@@ -1862,7 +1867,7 @@ const isEqual$2 = (oldState, newState) => {
1862
1867
  };
1863
1868
 
1864
1869
  const isEqual$1 = (oldState, newState) => {
1865
- return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY && oldState.focusedIndex === newState.focusedIndex && oldState.message === newState.message && oldState.focus === newState.focus && oldState.inputActions === newState.inputActions && oldState.placeholder === newState.placeholder && oldState.scrollBarHeight === newState.scrollBarHeight;
1870
+ return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.message === newState.message && oldState.focus === newState.focus && oldState.inputActions === newState.inputActions && oldState.placeholder === newState.placeholder;
1866
1871
  };
1867
1872
 
1868
1873
  const User = 1;
@@ -1880,9 +1885,10 @@ const RenderMessage = 6;
1880
1885
  const RenderSearchValue = 7;
1881
1886
  const RenderFocusContext = 8;
1882
1887
  const RenderIncremental = 9;
1888
+ const RenderCss = 10;
1883
1889
 
1884
- const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2];
1885
- const numbers = [RenderIncremental, RenderFocus, RenderSearchValue, RenderFocusContext];
1890
+ const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2, isEqual$3];
1891
+ const numbers = [RenderIncremental, RenderFocus, RenderSearchValue, RenderFocusContext, RenderCss];
1886
1892
 
1887
1893
  const diff2 = uid => {
1888
1894
  return diff(uid, modules, numbers);
@@ -2845,9 +2851,13 @@ const handleScrollBarMove = (state, eventY) => {
2845
2851
  handleOffset,
2846
2852
  headerHeight,
2847
2853
  height,
2854
+ scrollBarActive,
2848
2855
  scrollBarHeight,
2849
2856
  y
2850
2857
  } = state;
2858
+ if (!scrollBarActive) {
2859
+ return state;
2860
+ }
2851
2861
  const relativeY = eventY - y - headerHeight - handleOffset;
2852
2862
  const contentHeight = height - headerHeight;
2853
2863
  const newPercent = getNewPercent(contentHeight, scrollBarHeight, relativeY);
@@ -3117,6 +3127,37 @@ const openSuggest = state => {
3117
3127
  return state;
3118
3128
  };
3119
3129
 
3130
+ const getCss = state => {
3131
+ const {
3132
+ deltaY,
3133
+ itemHeight,
3134
+ scrollBarHeight,
3135
+ scrollBarY
3136
+ } = state;
3137
+ const relative = -(deltaY % itemHeight);
3138
+ const roundedScrollBarY = Math.round(scrollBarY);
3139
+ return `.Extensions .ScrollBarThumb {
3140
+ height: ${scrollBarHeight}px;
3141
+ translate: 0 ${roundedScrollBarY}px;
3142
+ }
3143
+
3144
+ .Extensions .ListItems {
3145
+ translate: 0 ${relative}px;
3146
+
3147
+ .ExtensionListItem {
3148
+ position: relative !important;
3149
+ }
3150
+ `;
3151
+ };
3152
+
3153
+ const renderCss = newState => {
3154
+ const {
3155
+ uid
3156
+ } = newState;
3157
+ const css = getCss(newState);
3158
+ return [SetCss, uid, css];
3159
+ };
3160
+
3120
3161
  const Extensions$1 = 'extensions';
3121
3162
 
3122
3163
  const getSelector = focus => {
@@ -3317,8 +3358,7 @@ const getExtensionListItemVirtualDom = extension => {
3317
3358
  name,
3318
3359
  posInSet,
3319
3360
  publisher,
3320
- setSize,
3321
- top
3361
+ setSize
3322
3362
  } = extension;
3323
3363
  const dom = [{
3324
3364
  ariaPosInSet: posInSet,
@@ -3328,7 +3368,6 @@ const getExtensionListItemVirtualDom = extension => {
3328
3368
  className: getClassName(focused),
3329
3369
  id: getId(focused),
3330
3370
  role: ListItem,
3331
- top,
3332
3371
  type: Div
3333
3372
  }, {
3334
3373
  childCount: 0,
@@ -3380,21 +3419,14 @@ const getNoExtensionsFoundVirtualDom = message => {
3380
3419
  }, text(message)];
3381
3420
  };
3382
3421
 
3383
- const px = value => {
3384
- return `${value}px`;
3385
- };
3386
- const position = (x, y) => {
3387
- return `${x}px ${y}px`;
3388
- };
3389
-
3390
3422
  const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
3391
3423
  const shouldShowScrollbar = scrollBarHeight > 0;
3392
3424
  if (!shouldShowScrollbar) {
3393
3425
  return [];
3394
3426
  }
3395
3427
  // TODO move the dynamic css into a css adopted stylesheet
3396
- const heightString = px(scrollBarHeight);
3397
- const translateString = position(0, scrollBarTop);
3428
+ // const heightString = Px.px(scrollBarHeight)
3429
+ // const translateString = Px.position(0, scrollBarTop)
3398
3430
  return [{
3399
3431
  childCount: 1,
3400
3432
  className: mergeClassNames(ScrollBar, ScrollBarSmall),
@@ -3404,8 +3436,8 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
3404
3436
  }, {
3405
3437
  childCount: 0,
3406
3438
  className: ScrollBarThumb,
3407
- height: heightString,
3408
- translate: translateString,
3439
+ // height: heightString,
3440
+ // translate: translateString,
3409
3441
  type: Div
3410
3442
  }];
3411
3443
  };
@@ -3459,7 +3491,7 @@ const getContentVirtualDom = (visibleExtensions, message, scrollBarHeight, scrol
3459
3491
  childCount: 2,
3460
3492
  className: mergeClassNames(Viewlet, List$1),
3461
3493
  type: Div
3462
- }, ...getExtensionsVirtualDom(visibleExtensions, focusOutline), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarY)];
3494
+ }, ...getExtensionsVirtualDom(visibleExtensions, focusOutline), ...getScrollBarVirtualDom(scrollBarHeight)];
3463
3495
  };
3464
3496
  const getExtensionsViewVirtualDom = state => {
3465
3497
  const visibleExtensions = getVisible(state);
@@ -3509,6 +3541,13 @@ const renderMessage = newState => {
3509
3541
  return [/* method */SetMessage, /* message */newState.message];
3510
3542
  };
3511
3543
 
3544
+ const px = value => {
3545
+ return `${value}px`;
3546
+ };
3547
+ const position = (x, y) => {
3548
+ return `${x}px ${y}px`;
3549
+ };
3550
+
3512
3551
  const renderScrollBar = newState => {
3513
3552
  const listHeight = getListHeight(newState.items.length, newState.itemHeight, newState.height);
3514
3553
  const total = newState.items.length;
@@ -3531,6 +3570,8 @@ const renderSearchValue = newState => {
3531
3570
 
3532
3571
  const getRenderer = diffType => {
3533
3572
  switch (diffType) {
3573
+ case RenderCss:
3574
+ return renderCss;
3534
3575
  case RenderFocus:
3535
3576
  return renderFocus;
3536
3577
  case RenderFocusContext:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",