@lvce-editor/editor-worker 18.17.0 → 18.18.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.
@@ -4093,7 +4093,7 @@ const isEqual$1 = (oldState, newState) => {
4093
4093
  };
4094
4094
 
4095
4095
  const isEqual = (oldState, newState) => {
4096
- return oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarWidth === newState.scrollBarWidth && oldState.selectionInfos === newState.selectionInfos;
4096
+ return oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.deltaY === newState.deltaY && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarWidth === newState.scrollBarWidth && oldState.selectionInfos === newState.selectionInfos;
4097
4097
  };
4098
4098
 
4099
4099
  const RenderFocus = 6;
@@ -6775,6 +6775,13 @@ const handleTouchMove = (editor, touchEvent) => {
6775
6775
  setDeltaYFixedValue(editor, offsetY);
6776
6776
  };
6777
6777
 
6778
+ // Keep wheel handling as a dedicated command entry point and delegate
6779
+ // the actual scroll state update to the shared setDelta logic.
6780
+ // @ts-ignore
6781
+ const handleWheel$2 = (editor, deltaMode, eventDeltaX, eventDeltaY) => {
6782
+ return setDelta(editor, deltaMode, eventDeltaX, eventDeltaY);
6783
+ };
6784
+
6778
6785
  // @ts-ignore
6779
6786
  const getChanges$2 = selections => {
6780
6787
  const changes = [];
@@ -11536,6 +11543,7 @@ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, hig
11536
11543
  className: 'EditorRows',
11537
11544
  onMouseDown: HandleMouseDown,
11538
11545
  onPointerDown: HandlePointerDown,
11546
+ onWheel: HandleWheel,
11539
11547
  type: Div
11540
11548
  }, ...rowsDom];
11541
11549
  };
@@ -11585,7 +11593,8 @@ const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
11585
11593
  }, ...getDiagnosticsVirtualDom([...scrollBarDiagnostics])];
11586
11594
  };
11587
11595
 
11588
- const getScrollBarVirtualDom = () => {
11596
+ const getScrollBarVirtualDom = (deltaY, finalDeltaY, height, scrollBarHeight) => {
11597
+ const scrollBarY = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
11589
11598
  return [{
11590
11599
  childCount: 1,
11591
11600
  className: 'ScrollBar ScrollBarVertical',
@@ -11595,6 +11604,8 @@ const getScrollBarVirtualDom = () => {
11595
11604
  }, {
11596
11605
  childCount: 0,
11597
11606
  className: 'ScrollBarThumb ScrollBarThumbVertical',
11607
+ style: `height:${scrollBarHeight}px;`,
11608
+ translate: `0 ${scrollBarY}px`,
11598
11609
  type: Div
11599
11610
  }, {
11600
11611
  childCount: 1,
@@ -11610,11 +11621,15 @@ const getScrollBarVirtualDom = () => {
11610
11621
 
11611
11622
  const getEditorContentVirtualDom = ({
11612
11623
  cursorInfos = [],
11624
+ deltaY = 0,
11613
11625
  diagnostics = [],
11614
11626
  differences,
11627
+ finalDeltaY = 0,
11628
+ height = 0,
11615
11629
  highlightedLine = -1,
11616
11630
  lineNumbers = true,
11617
11631
  scrollBarDiagnostics = [],
11632
+ scrollBarHeight = 0,
11618
11633
  selectionInfos = [],
11619
11634
  textInfos
11620
11635
  }) => {
@@ -11623,7 +11638,7 @@ const getEditorContentVirtualDom = ({
11623
11638
  className: 'EditorContent',
11624
11639
  onMouseMove: HandleMouseMove,
11625
11640
  type: Div
11626
- }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
11641
+ }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(deltaY, finalDeltaY, height, scrollBarHeight)];
11627
11642
  };
11628
11643
 
11629
11644
  const getGutterInfoVirtualDom = gutterInfo => {
@@ -11649,12 +11664,16 @@ const getEditorGutterVirtualDom = gutterInfos => {
11649
11664
 
11650
11665
  const getEditorVirtualDom = ({
11651
11666
  cursorInfos = [],
11667
+ deltaY = 0,
11652
11668
  diagnostics = [],
11653
11669
  differences,
11670
+ finalDeltaY = 0,
11654
11671
  gutterInfos = [],
11672
+ height = 0,
11655
11673
  highlightedLine = -1,
11656
11674
  lineNumbers = true,
11657
11675
  scrollBarDiagnostics = [],
11676
+ scrollBarHeight = 0,
11658
11677
  selectionInfos = [],
11659
11678
  textInfos
11660
11679
  }) => {
@@ -11662,16 +11681,19 @@ const getEditorVirtualDom = ({
11662
11681
  childCount: 2,
11663
11682
  className: 'Viewlet Editor',
11664
11683
  onContextMenu: HandleContextMenu,
11665
- onWheel: HandleWheel,
11666
11684
  role: 'code',
11667
11685
  type: Div
11668
11686
  }, ...getEditorGutterVirtualDom(gutterInfos), ...getEditorContentVirtualDom({
11669
11687
  cursorInfos,
11688
+ deltaY,
11670
11689
  diagnostics,
11671
11690
  differences,
11691
+ finalDeltaY,
11692
+ height,
11672
11693
  highlightedLine,
11673
11694
  lineNumbers,
11674
11695
  scrollBarDiagnostics,
11696
+ scrollBarHeight,
11675
11697
  selectionInfos,
11676
11698
  textInfos
11677
11699
  })];
@@ -11998,7 +12020,7 @@ const renderEventListeners = () => {
11998
12020
  params: ['handlePointerUp']
11999
12021
  }, {
12000
12022
  name: HandleWheel,
12001
- params: ['setDelta', DeltaMode, DeltaY],
12023
+ params: ['handleWheel', DeltaMode, 'event.deltaX', DeltaY],
12002
12024
  passive: true
12003
12025
  }, {
12004
12026
  name: HandleContextMenu,
@@ -12217,6 +12239,7 @@ const commandMap = {
12217
12239
  'Editor.handleTouchMove': wrapCommandOld(handleTouchMove),
12218
12240
  'Editor.handleTouchStart': wrapCommandOld(handleTouchStart),
12219
12241
  'Editor.handleTripleClick': wrapCommandOld(handleTripleClick),
12242
+ 'Editor.handleWheel': wrapCommandOld(handleWheel$2),
12220
12243
  'Editor.hotReload': hotReload,
12221
12244
  'Editor.indendLess': wrapCommandOld(indentLess),
12222
12245
  'Editor.indentMore': wrapCommandOld(indentMore),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "18.17.0",
3
+ "version": "18.18.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"