@fileverse-dev/fortune-react 1.2.96-scroll-4 → 1.2.97

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.
@@ -74,7 +74,7 @@ var NotationBoxes = function NotationBoxes() {
74
74
  position: "absolute",
75
75
  left: size.left,
76
76
  top: size.top,
77
- zIndex: 100,
77
+ zIndex: 400,
78
78
  pointerEvents: "none"
79
79
  }
80
80
  }), /*#__PURE__*/React.createElement("div", {
@@ -83,7 +83,7 @@ var NotationBoxes = function NotationBoxes() {
83
83
  position: "absolute",
84
84
  left: left,
85
85
  top: top,
86
- zIndex: isEditing ? 200 : 100,
86
+ zIndex: isEditing ? 500 : 400,
87
87
  boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
88
88
  },
89
89
  onMouseDown: function onMouseDown(e) {
@@ -62,91 +62,6 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
62
62
  }
63
63
  };
64
64
  }
65
- function handleMouseDragScroll(containerEl, scrollHandler, getPixelScale) {
66
- if (context.luckysheetCellUpdate.length > 0) {
67
- stopAutoScroll();
68
- return;
69
- }
70
- var isDragging = false;
71
- var startY = 0;
72
- var lastY = 0;
73
- var velocityY = 0;
74
- var autoScrollAnimationId = 0;
75
- var lastMoveTime = 0;
76
- var VELOCITY_SMOOTHING = 0.3;
77
- var MIN_DRAG_THRESHOLD = 5;
78
- var ACCELERATION_FACTOR = 1.02;
79
- var MAX_VELOCITY = 50;
80
- function stopAutoScroll() {
81
- if (autoScrollAnimationId) {
82
- cancelAnimationFrame(autoScrollAnimationId);
83
- autoScrollAnimationId = 0;
84
- }
85
- velocityY = 0;
86
- }
87
- function autoScroll() {
88
- if (!isDragging) {
89
- stopAutoScroll();
90
- return;
91
- }
92
- if (Math.abs(velocityY) > 0.1) {
93
- velocityY *= ACCELERATION_FACTOR;
94
- velocityY = Math.max(-MAX_VELOCITY, Math.min(MAX_VELOCITY, velocityY));
95
- }
96
- var scale = getPixelScale();
97
- scrollHandler(0, velocityY * scale);
98
- autoScrollAnimationId = requestAnimationFrame(autoScroll);
99
- }
100
- function onMouseDown(e) {
101
- if (e.button !== 0) return;
102
- var target = e.target;
103
- if (target.tagName === "INPUT" || target.tagName === "BUTTON" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.closest("button") || target.closest("input")) {
104
- return;
105
- }
106
- isDragging = true;
107
- startY = e.clientY;
108
- lastY = e.clientY;
109
- lastMoveTime = performance.now();
110
- velocityY = 0;
111
- containerEl.style.cursor = "grabbing";
112
- e.preventDefault();
113
- }
114
- function onMouseMove(e) {
115
- if (!isDragging) return;
116
- var currentTime = performance.now();
117
- var deltaTime = Math.max(1, currentTime - lastMoveTime);
118
- var deltaY = e.clientY - lastY;
119
- var totalMovedY = Math.abs(e.clientY - startY);
120
- if (totalMovedY > MIN_DRAG_THRESHOLD) {
121
- if (Math.abs(deltaY) > 0.1) {
122
- var instantVelocityY = deltaY / deltaTime * 16;
123
- velocityY = velocityY * (1 - VELOCITY_SMOOTHING) + instantVelocityY * VELOCITY_SMOOTHING;
124
- }
125
- if (!autoScrollAnimationId) {
126
- autoScrollAnimationId = requestAnimationFrame(autoScroll);
127
- }
128
- }
129
- lastY = e.clientY;
130
- lastMoveTime = currentTime;
131
- e.preventDefault();
132
- }
133
- function onMouseUp(e) {
134
- console.log("Mouse up, stopping drag scroll", e);
135
- if (!isDragging) return;
136
- isDragging = false;
137
- stopAutoScroll();
138
- containerEl.style.cursor = "";
139
- }
140
- containerEl.addEventListener("mousedown", onMouseDown);
141
- window.addEventListener("mousemove", onMouseMove);
142
- window.addEventListener("mouseup", onMouseUp);
143
- return function () {
144
- stopAutoScroll();
145
- containerEl.removeEventListener("mousedown", onMouseDown);
146
- window.removeEventListener("mousemove", onMouseMove);
147
- window.removeEventListener("mouseup", onMouseUp);
148
- };
149
- }
150
65
  function handleMobileScroll(containerEl, scrollHandler, getPixelScale) {
151
66
  var isScrolling = false;
152
67
  var gestureStartClientX = 0;
@@ -295,16 +210,9 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
295
210
  var unmountMobileScrollHandler = handleMobileScroll(scrollContainerEl, scrollHandler, function () {
296
211
  return (window.devicePixelRatio || 1) * context.zoomRatio;
297
212
  });
298
- var unmountMouseDragHandler;
299
- if (context.luckysheetCellUpdate.length === 0) {
300
- unmountMouseDragHandler = handleMouseDragScroll(scrollContainerEl, scrollHandler, function () {
301
- return (window.devicePixelRatio || 1) * context.zoomRatio;
302
- });
303
- }
304
213
  return function () {
305
214
  unmountScrollHandler();
306
215
  unmountMobileScrollHandler();
307
- unmountMouseDragHandler === null || unmountMouseDragHandler === void 0 ? void 0 : unmountMouseDragHandler();
308
216
  };
309
217
  }
310
218
  useEffect(function () {
@@ -4,7 +4,7 @@
4
4
  /* background: #fafafc; */
5
5
  position: relative;
6
6
  padding: 4px 8px;
7
- border-bottom: 1px solid #E8EBEC;
7
+ border-bottom: 1px solid #e8ebec;
8
8
  white-space: nowrap;
9
9
  align-items: center;
10
10
  gap: 4px;
@@ -12,13 +12,13 @@
12
12
  }
13
13
 
14
14
  .scrollbar-hidden {
15
- overflow: auto; /* enables scrolling */
16
- -ms-overflow-style: none; /* IE and Edge */
17
- scrollbar-width: none; /* Firefox */
15
+ overflow: auto; /* enables scrolling */
16
+ -ms-overflow-style: none; /* IE and Edge */
17
+ scrollbar-width: none; /* Firefox */
18
18
  }
19
19
 
20
20
  .scrollbar-hidden::-webkit-scrollbar {
21
- display: none; /* Chrome, Safari, Opera */
21
+ display: none; /* Chrome, Safari, Opera */
22
22
  }
23
23
 
24
24
  .fortune-toolbar-divider {
@@ -164,7 +164,6 @@
164
164
  height: 32px;
165
165
  display: flex;
166
166
  align-items: center;
167
-
168
167
  }
169
168
 
170
169
  .fortune-toolbar-select-option:hover {
@@ -237,7 +236,7 @@
237
236
  align-items: center;
238
237
  align-self: flex-end;
239
238
  top: 40px;
240
- right: 32px;
239
+ right: 80px;
241
240
  max-width: 348px;
242
241
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
243
242
  background: white;
@@ -438,4 +437,4 @@
438
437
  border: 1px solid hsl(var(--color-border-default));
439
438
  border-radius: 8px;
440
439
  margin: 8px 8px 0px 8px;
441
- }
440
+ }
@@ -475,7 +475,7 @@ var Toolbar = function Toolbar(_a) {
475
475
  var _j = useState(false),
476
476
  showDuneModal = _j[0],
477
477
  setShowDuneModal = _j[1];
478
- var _k = useState(window.innerWidth >= 1280),
478
+ var _k = useState(window.innerWidth >= 1480),
479
479
  isDesktop = _k[0],
480
480
  setIsDesktop = _k[1];
481
481
  var _l = useDialog(),
@@ -543,7 +543,7 @@ var Toolbar = function Toolbar(_a) {
543
543
  }, []);
544
544
  useEffect(function () {
545
545
  var handleResize = function handleResize() {
546
- setIsDesktop(window.innerWidth >= 1280);
546
+ setIsDesktop(window.innerWidth >= 1480);
547
547
  };
548
548
  window.addEventListener("resize", handleResize);
549
549
  return function () {
@@ -83,7 +83,7 @@ var NotationBoxes = function NotationBoxes() {
83
83
  position: "absolute",
84
84
  left: size.left,
85
85
  top: size.top,
86
- zIndex: 100,
86
+ zIndex: 400,
87
87
  pointerEvents: "none"
88
88
  }
89
89
  }), /*#__PURE__*/_react.default.createElement("div", {
@@ -92,7 +92,7 @@ var NotationBoxes = function NotationBoxes() {
92
92
  position: "absolute",
93
93
  left: left,
94
94
  top: top,
95
- zIndex: isEditing ? 200 : 100,
95
+ zIndex: isEditing ? 500 : 400,
96
96
  boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
97
97
  },
98
98
  onMouseDown: function onMouseDown(e) {
@@ -69,91 +69,6 @@ var useSmoothScroll = exports.useSmoothScroll = function useSmoothScroll(scrollC
69
69
  }
70
70
  };
71
71
  }
72
- function handleMouseDragScroll(containerEl, scrollHandler, getPixelScale) {
73
- if (context.luckysheetCellUpdate.length > 0) {
74
- stopAutoScroll();
75
- return;
76
- }
77
- var isDragging = false;
78
- var startY = 0;
79
- var lastY = 0;
80
- var velocityY = 0;
81
- var autoScrollAnimationId = 0;
82
- var lastMoveTime = 0;
83
- var VELOCITY_SMOOTHING = 0.3;
84
- var MIN_DRAG_THRESHOLD = 5;
85
- var ACCELERATION_FACTOR = 1.02;
86
- var MAX_VELOCITY = 50;
87
- function stopAutoScroll() {
88
- if (autoScrollAnimationId) {
89
- cancelAnimationFrame(autoScrollAnimationId);
90
- autoScrollAnimationId = 0;
91
- }
92
- velocityY = 0;
93
- }
94
- function autoScroll() {
95
- if (!isDragging) {
96
- stopAutoScroll();
97
- return;
98
- }
99
- if (Math.abs(velocityY) > 0.1) {
100
- velocityY *= ACCELERATION_FACTOR;
101
- velocityY = Math.max(-MAX_VELOCITY, Math.min(MAX_VELOCITY, velocityY));
102
- }
103
- var scale = getPixelScale();
104
- scrollHandler(0, velocityY * scale);
105
- autoScrollAnimationId = requestAnimationFrame(autoScroll);
106
- }
107
- function onMouseDown(e) {
108
- if (e.button !== 0) return;
109
- var target = e.target;
110
- if (target.tagName === "INPUT" || target.tagName === "BUTTON" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.closest("button") || target.closest("input")) {
111
- return;
112
- }
113
- isDragging = true;
114
- startY = e.clientY;
115
- lastY = e.clientY;
116
- lastMoveTime = performance.now();
117
- velocityY = 0;
118
- containerEl.style.cursor = "grabbing";
119
- e.preventDefault();
120
- }
121
- function onMouseMove(e) {
122
- if (!isDragging) return;
123
- var currentTime = performance.now();
124
- var deltaTime = Math.max(1, currentTime - lastMoveTime);
125
- var deltaY = e.clientY - lastY;
126
- var totalMovedY = Math.abs(e.clientY - startY);
127
- if (totalMovedY > MIN_DRAG_THRESHOLD) {
128
- if (Math.abs(deltaY) > 0.1) {
129
- var instantVelocityY = deltaY / deltaTime * 16;
130
- velocityY = velocityY * (1 - VELOCITY_SMOOTHING) + instantVelocityY * VELOCITY_SMOOTHING;
131
- }
132
- if (!autoScrollAnimationId) {
133
- autoScrollAnimationId = requestAnimationFrame(autoScroll);
134
- }
135
- }
136
- lastY = e.clientY;
137
- lastMoveTime = currentTime;
138
- e.preventDefault();
139
- }
140
- function onMouseUp(e) {
141
- console.log("Mouse up, stopping drag scroll", e);
142
- if (!isDragging) return;
143
- isDragging = false;
144
- stopAutoScroll();
145
- containerEl.style.cursor = "";
146
- }
147
- containerEl.addEventListener("mousedown", onMouseDown);
148
- window.addEventListener("mousemove", onMouseMove);
149
- window.addEventListener("mouseup", onMouseUp);
150
- return function () {
151
- stopAutoScroll();
152
- containerEl.removeEventListener("mousedown", onMouseDown);
153
- window.removeEventListener("mousemove", onMouseMove);
154
- window.removeEventListener("mouseup", onMouseUp);
155
- };
156
- }
157
72
  function handleMobileScroll(containerEl, scrollHandler, getPixelScale) {
158
73
  var isScrolling = false;
159
74
  var gestureStartClientX = 0;
@@ -302,16 +217,9 @@ var useSmoothScroll = exports.useSmoothScroll = function useSmoothScroll(scrollC
302
217
  var unmountMobileScrollHandler = handleMobileScroll(scrollContainerEl, scrollHandler, function () {
303
218
  return (window.devicePixelRatio || 1) * context.zoomRatio;
304
219
  });
305
- var unmountMouseDragHandler;
306
- if (context.luckysheetCellUpdate.length === 0) {
307
- unmountMouseDragHandler = handleMouseDragScroll(scrollContainerEl, scrollHandler, function () {
308
- return (window.devicePixelRatio || 1) * context.zoomRatio;
309
- });
310
- }
311
220
  return function () {
312
221
  unmountScrollHandler();
313
222
  unmountMobileScrollHandler();
314
- unmountMouseDragHandler === null || unmountMouseDragHandler === void 0 ? void 0 : unmountMouseDragHandler();
315
223
  };
316
224
  }
317
225
  (0, _react.useEffect)(function () {
@@ -4,7 +4,7 @@
4
4
  /* background: #fafafc; */
5
5
  position: relative;
6
6
  padding: 4px 8px;
7
- border-bottom: 1px solid #E8EBEC;
7
+ border-bottom: 1px solid #e8ebec;
8
8
  white-space: nowrap;
9
9
  align-items: center;
10
10
  gap: 4px;
@@ -12,13 +12,13 @@
12
12
  }
13
13
 
14
14
  .scrollbar-hidden {
15
- overflow: auto; /* enables scrolling */
16
- -ms-overflow-style: none; /* IE and Edge */
17
- scrollbar-width: none; /* Firefox */
15
+ overflow: auto; /* enables scrolling */
16
+ -ms-overflow-style: none; /* IE and Edge */
17
+ scrollbar-width: none; /* Firefox */
18
18
  }
19
19
 
20
20
  .scrollbar-hidden::-webkit-scrollbar {
21
- display: none; /* Chrome, Safari, Opera */
21
+ display: none; /* Chrome, Safari, Opera */
22
22
  }
23
23
 
24
24
  .fortune-toolbar-divider {
@@ -164,7 +164,6 @@
164
164
  height: 32px;
165
165
  display: flex;
166
166
  align-items: center;
167
-
168
167
  }
169
168
 
170
169
  .fortune-toolbar-select-option:hover {
@@ -237,7 +236,7 @@
237
236
  align-items: center;
238
237
  align-self: flex-end;
239
238
  top: 40px;
240
- right: 32px;
239
+ right: 80px;
241
240
  max-width: 348px;
242
241
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
243
242
  background: white;
@@ -438,4 +437,4 @@
438
437
  border: 1px solid hsl(var(--color-border-default));
439
438
  border-radius: 8px;
440
439
  margin: 8px 8px 0px 8px;
441
- }
440
+ }
@@ -484,7 +484,7 @@ var Toolbar = function Toolbar(_a) {
484
484
  var _j = (0, _react.useState)(false),
485
485
  showDuneModal = _j[0],
486
486
  setShowDuneModal = _j[1];
487
- var _k = (0, _react.useState)(window.innerWidth >= 1280),
487
+ var _k = (0, _react.useState)(window.innerWidth >= 1480),
488
488
  isDesktop = _k[0],
489
489
  setIsDesktop = _k[1];
490
490
  var _l = (0, _useDialog.useDialog)(),
@@ -552,7 +552,7 @@ var Toolbar = function Toolbar(_a) {
552
552
  }, []);
553
553
  (0, _react.useEffect)(function () {
554
554
  var handleResize = function handleResize() {
555
- setIsDesktop(window.innerWidth >= 1280);
555
+ setIsDesktop(window.innerWidth >= 1480);
556
556
  };
557
557
  window.addEventListener("resize", handleResize);
558
558
  return function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.96-scroll-4",
3
+ "version": "1.2.97",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.2.96-scroll-4",
19
+ "@fileverse-dev/fortune-core": "1.2.97",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",