@number10/phaserjsx 0.2.0 → 0.3.1

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.
@@ -6644,10 +6644,6 @@ function resolveCalcOperand(operand, parentSize, viewportSize) {
6644
6644
  }
6645
6645
  if (operand.type === "percent") {
6646
6646
  if (parentSize === void 0) {
6647
- DebugLogger.warn(
6648
- "Size",
6649
- "Cannot resolve percentage in calc() without parent size. Using 0."
6650
- );
6651
6647
  return 0;
6652
6648
  }
6653
6649
  return parentSize * operand.value / 100;
@@ -7055,6 +7051,9 @@ class GestureManager {
7055
7051
  this.activePointerDown = null;
7056
7052
  }
7057
7053
  this.hoveredContainers.delete(container);
7054
+ for (const hitContainers of this.activeContainersForMove.values()) {
7055
+ hitContainers.delete(container);
7056
+ }
7058
7057
  }
7059
7058
  /**
7060
7059
  * Check if a container is registered
@@ -11250,9 +11249,9 @@ class MountRegistry {
11250
11249
  * @param rootNode - Root game object
11251
11250
  * @returns Registry ID for this mount
11252
11251
  */
11253
- register(parent, type, props, rootNode) {
11252
+ register(parent, type, props, rootNode, vnode) {
11254
11253
  const id = this.nextId++;
11255
- this.entries.set(id, { id, parent, type, props, rootNode });
11254
+ this.entries.set(id, { id, parent, type, props, rootNode, vnode });
11256
11255
  DebugLogger.log("vdom", `Registered mount ${id}`);
11257
11256
  return id;
11258
11257
  }
@@ -11267,6 +11266,14 @@ class MountRegistry {
11267
11266
  this.entries.delete(id);
11268
11267
  }
11269
11268
  }
11269
+ /**
11270
+ * Get a specific mount entry by registry ID
11271
+ * @param id - Registry ID
11272
+ * @returns Mount entry or undefined if not found
11273
+ */
11274
+ getEntry(id) {
11275
+ return this.entries.get(id);
11276
+ }
11270
11277
  /**
11271
11278
  * Get all active mount entries
11272
11279
  * @returns Array of mount entries
@@ -11344,7 +11351,9 @@ function remountAll() {
11344
11351
  rootNode.__mountRootId = generateMountRootId();
11345
11352
  }
11346
11353
  entry.rootNode = rootNode;
11354
+ entry.vnode = vnode;
11347
11355
  rootNode.__registryId = entry.id;
11356
+ rootNode.__rootVNode = vnode;
11348
11357
  console.log("[REMOUNT] Successfully remounted entry", entry.id);
11349
11358
  } catch (error) {
11350
11359
  console.error("[REMOUNT] Failed to remount entry", entry.id, error);
@@ -12024,9 +12033,36 @@ function mountJSX(parentOrScene, type, props = { width: 0, height: 0 }) {
12024
12033
  if (rootNode instanceof Phaser$1.GameObjects.Container) {
12025
12034
  rootNode.__mountRootId = generateMountRootId();
12026
12035
  }
12027
- const registryId = mountRegistry.register(parentOrScene, type, props, rootNode);
12036
+ rootNode.__rootVNode = vnode;
12037
+ const registryId = mountRegistry.register(parentOrScene, type, props, rootNode, vnode);
12028
12038
  rootNode.__registryId = registryId;
12029
- return rootNode;
12039
+ const handle = rootNode;
12040
+ handle.unmount = () => unmountJSX(handle);
12041
+ return handle;
12042
+ }
12043
+ function unmountJSX(target) {
12044
+ const scene = target instanceof Phaser$1.Scene ? target : target.scene;
12045
+ const targetWithVNode = target;
12046
+ const sceneWithVNode = scene;
12047
+ const rootVNode = targetWithVNode.__rootVNode ?? sceneWithVNode?.__rootVNode;
12048
+ if (rootVNode) {
12049
+ unmount(rootVNode);
12050
+ if (targetWithVNode.__rootVNode === rootVNode) {
12051
+ delete targetWithVNode.__rootVNode;
12052
+ }
12053
+ if (sceneWithVNode?.__rootVNode === rootVNode) {
12054
+ delete sceneWithVNode.__rootVNode;
12055
+ }
12056
+ return;
12057
+ }
12058
+ if (targetWithVNode.__registryId !== void 0) {
12059
+ const entry = mountRegistry.getEntry(targetWithVNode.__registryId);
12060
+ if (entry?.vnode) {
12061
+ unmount(entry.vnode);
12062
+ return;
12063
+ }
12064
+ }
12065
+ DebugLogger.log("vdom", "unmountJSX called but no root VNode found on target");
12030
12066
  }
12031
12067
  const vdom = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12032
12068
  __proto__: null,
@@ -12035,7 +12071,8 @@ const vdom = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
12035
12071
  mountJSX,
12036
12072
  patchVNode,
12037
12073
  remountAll,
12038
- unmount
12074
+ unmount,
12075
+ unmountJSX
12039
12076
  }, Symbol.toStringTag, { value: "Module" }));
12040
12077
  function getCurrent() {
12041
12078
  return _currentCtx;
@@ -13998,6 +14035,8 @@ function Portal(props) {
13998
14035
  const depth = props.depth ?? 1e3;
13999
14036
  const scene = useScene();
14000
14037
  const blockEvents = props.blockEvents ?? true;
14038
+ const mountedNodesRef = useRef([]);
14039
+ const previousChildrenRef = useRef([]);
14001
14040
  useEffect(() => {
14002
14041
  const portalContainer = portalRegistry.register(
14003
14042
  portalId,
@@ -14013,14 +14052,18 @@ function Portal(props) {
14013
14052
  blockerContainer.setDepth(-1);
14014
14053
  }
14015
14054
  const children = Array.isArray(props.children) ? props.children : [props.children];
14055
+ const mountedNodes = [];
14016
14056
  for (const child of children) {
14017
14057
  if (child) {
14018
14058
  const mountedNode = mount(portalContainer, child);
14019
14059
  if (mountedNode) {
14020
14060
  portalContainer.add(mountedNode);
14061
+ mountedNodes.push(mountedNode);
14021
14062
  }
14022
14063
  }
14023
14064
  }
14065
+ mountedNodesRef.current = mountedNodes;
14066
+ previousChildrenRef.current = children;
14024
14067
  const gestureManager = getGestureManager(scene);
14025
14068
  if (blockEvents && blockerContainer) {
14026
14069
  const blocker = blockerContainer;
@@ -14067,7 +14110,31 @@ function Portal(props) {
14067
14110
  }
14068
14111
  portalRegistry.unregister(portalId);
14069
14112
  };
14070
- }, [portalId, depth, scene, props.children, blockEvents]);
14113
+ }, [portalId, depth, scene, blockEvents]);
14114
+ useEffect(() => {
14115
+ const portal = portalRegistry.get(portalId);
14116
+ if (!portal) return;
14117
+ const portalContainer = portal.container;
14118
+ const newChildren = Array.isArray(props.children) ? props.children : [props.children];
14119
+ const oldChildren = previousChildrenRef.current;
14120
+ const maxLen = Math.max(oldChildren.length, newChildren.length);
14121
+ for (let i = 0; i < maxLen; i++) {
14122
+ const oldChild = oldChildren[i];
14123
+ const newChild = newChildren[i];
14124
+ if (oldChild && newChild) {
14125
+ patchVNode(portalContainer, oldChild, newChild);
14126
+ } else if (!oldChild && newChild) {
14127
+ const mountedNode = mount(portalContainer, newChild);
14128
+ if (mountedNode) {
14129
+ portalContainer.add(mountedNode);
14130
+ mountedNodesRef.current.push(mountedNode);
14131
+ }
14132
+ } else if (oldChild && !newChild) {
14133
+ unmount(oldChild);
14134
+ }
14135
+ }
14136
+ previousChildrenRef.current = newChildren;
14137
+ }, [props.children, portalId]);
14071
14138
  return null;
14072
14139
  }
14073
14140
  function Modal(props) {
@@ -14154,19 +14221,7 @@ function Modal(props) {
14154
14221
  view.setVisible(false);
14155
14222
  backdrop.setVisible(false);
14156
14223
  }
14157
- }, [
14158
- backdropAnimation,
14159
- closeDurationMs,
14160
- isVisible,
14161
- openDurationMs,
14162
- props.onClosed,
14163
- props.onOpen,
14164
- props.onRequestClose,
14165
- props.show,
14166
- stopBackdropEffects,
14167
- stopViewEffects,
14168
- viewAnimation
14169
- ]);
14224
+ }, [props.show]);
14170
14225
  useEffect(() => {
14171
14226
  if (!closeOnEscape || !props.show) return;
14172
14227
  const handleKeyDown = (e) => {
@@ -15472,11 +15527,22 @@ function calculateSliderSize(size) {
15472
15527
  return { border, outer, dimension };
15473
15528
  }
15474
15529
  function ScrollSlider(props) {
15475
- const { direction, scrollPosition, viewportSize, contentSize, onScroll } = props;
15530
+ const {
15531
+ direction,
15532
+ scrollPosition,
15533
+ viewportSize,
15534
+ contentSize,
15535
+ onScroll,
15536
+ momentum = true,
15537
+ onMomentumEnd
15538
+ } = props;
15476
15539
  const { props: themed } = getThemedProps("ScrollSlider", void 0, {});
15477
15540
  const sliderRef = useRef(null);
15478
15541
  const isDraggingRef = useRef(false);
15479
15542
  const trackContainerRef = useRef(null);
15543
+ const velocityRef = useRef(0);
15544
+ const lastTimeRef = useRef(0);
15545
+ const tweenRef = useRef(null);
15480
15546
  const isVertical = direction === "vertical";
15481
15547
  const { border, outer, dimension } = calculateSliderSize(props.size);
15482
15548
  const containerWithLayout = trackContainerRef.current;
@@ -15492,18 +15558,60 @@ function ScrollSlider(props) {
15492
15558
  data.stopPropagation();
15493
15559
  if (data.state === "start") {
15494
15560
  isDraggingRef.current = true;
15561
+ velocityRef.current = 0;
15562
+ lastTimeRef.current = Date.now();
15563
+ if (tweenRef.current) {
15564
+ tweenRef.current.stop();
15565
+ tweenRef.current = null;
15566
+ }
15495
15567
  return;
15496
15568
  }
15497
15569
  if (data.state === "end") {
15498
15570
  isDraggingRef.current = false;
15571
+ if (momentum && Math.abs(velocityRef.current) > 0.1) {
15572
+ startMomentum(scrollPosition);
15573
+ } else if (onMomentumEnd) {
15574
+ onMomentumEnd();
15575
+ }
15499
15576
  return;
15500
15577
  }
15501
15578
  if (!isDraggingRef.current) return;
15502
15579
  const delta = isVertical ? data.dy ?? 0 : data.dx ?? 0;
15580
+ const now = Date.now();
15581
+ const deltaTime = now - lastTimeRef.current;
15582
+ if (deltaTime > 0) {
15583
+ velocityRef.current = delta / deltaTime * 1e3;
15584
+ lastTimeRef.current = now;
15585
+ }
15503
15586
  const newThumbPos = Math.max(0, Math.min(thumbRange, thumbPosition + delta));
15504
15587
  const newScrollPos = thumbRange > 0 ? newThumbPos / thumbRange * maxScroll : 0;
15505
15588
  onScroll(newScrollPos);
15506
15589
  };
15590
+ const startMomentum = (startPos) => {
15591
+ if (!sliderRef.current?.scene) return;
15592
+ const scene = sliderRef.current.scene;
15593
+ const duration = Math.min(1e3, Math.max(200, Math.abs(velocityRef.current)));
15594
+ const targetScrollPos = Math.max(
15595
+ 0,
15596
+ Math.min(maxScroll, startPos + velocityRef.current * (duration / 1e3))
15597
+ );
15598
+ tweenRef.current = scene.tweens.add({
15599
+ targets: { pos: startPos },
15600
+ pos: targetScrollPos,
15601
+ duration,
15602
+ ease: "Quad.easeOut",
15603
+ onUpdate: (tween) => {
15604
+ const target = tween.targets[0];
15605
+ onScroll(target.pos);
15606
+ },
15607
+ onComplete: () => {
15608
+ tweenRef.current = null;
15609
+ if (onMomentumEnd) {
15610
+ onMomentumEnd();
15611
+ }
15612
+ }
15613
+ });
15614
+ };
15507
15615
  const handleBackgroundTouch = (data) => {
15508
15616
  data.stopPropagation();
15509
15617
  const localPos = isVertical ? data.localY ?? 0 : data.localX ?? 0;
@@ -15569,13 +15677,23 @@ function ScrollView(props) {
15569
15677
  showVerticalSlider = "auto",
15570
15678
  showHorizontalSlider = "auto",
15571
15679
  scroll: initialScroll,
15572
- onScrollInfoChange
15680
+ onScrollInfoChange,
15681
+ snap = false,
15682
+ snapAlignment = "start",
15683
+ snapThreshold = 20,
15684
+ momentum = true
15573
15685
  } = props;
15574
15686
  const [scroll, setScroll] = useState(initialScroll ?? { dx: 0, dy: 0 });
15687
+ const scrollRef = useRef(scroll);
15575
15688
  const contentRef = useRef(null);
15576
15689
  const viewportRef = useRef(null);
15577
15690
  const [contentHeight, setContentHeight] = useState(0);
15578
15691
  const [contentWidth, setContentWidth] = useState(0);
15692
+ const [velocity, setVelocity] = useState({ vx: 0, vy: 0 });
15693
+ const [lastTime, setLastTime] = useState(0);
15694
+ const tweenRef = useRef(null);
15695
+ const wheelSnapTimeoutRef = useRef(null);
15696
+ const WHEEL_SNAP_DELAY = 200;
15579
15697
  const { outer: sliderSize } = calculateSliderSize(props.sliderSize);
15580
15698
  const viewportHeight = viewportRef.current?.height ?? 0;
15581
15699
  const viewportWidth = viewportRef.current?.width ?? 0;
@@ -15588,9 +15706,24 @@ function ScrollView(props) {
15588
15706
  const showHorizontalSliderActual = showHorizontalSlider === true || needsHorizontalScroll && showHorizontalSlider === "auto";
15589
15707
  const maxScrollY = Math.max(0, effectiveContentHeight - viewportHeight);
15590
15708
  const maxScrollX = Math.max(0, effectiveContentWidth - viewportWidth);
15709
+ const updateScroll = (value) => {
15710
+ setScroll((prev) => {
15711
+ const next = typeof value === "function" ? value(prev) : value;
15712
+ scrollRef.current = next;
15713
+ return next;
15714
+ });
15715
+ };
15716
+ const stopActiveTween = () => {
15717
+ if (tweenRef.current) {
15718
+ tweenRef.current.stop();
15719
+ tweenRef.current = null;
15720
+ }
15721
+ };
15722
+ const resolvedSnapThreshold = typeof snap === "object" && "positions" in snap ? snap.threshold ?? snapThreshold : snapThreshold;
15723
+ const effectiveSnapThreshold = resolvedSnapThreshold === void 0 || resolvedSnapThreshold < 0 ? Infinity : resolvedSnapThreshold;
15591
15724
  useEffect(() => {
15592
15725
  if (initialScroll) {
15593
- setScroll(initialScroll);
15726
+ updateScroll(initialScroll);
15594
15727
  }
15595
15728
  }, [initialScroll]);
15596
15729
  useEffect(() => {
@@ -15645,27 +15778,168 @@ function ScrollView(props) {
15645
15778
  const maxScrollX2 = Math.max(0, contentWidth2 - viewportWidth2);
15646
15779
  const newScrollY = Math.max(0, Math.min(maxScrollY2, scroll.dy - deltaY));
15647
15780
  const newScrollX = Math.max(0, Math.min(maxScrollX2, scroll.dx - deltaX));
15648
- setScroll({ dx: newScrollX, dy: newScrollY });
15781
+ updateScroll({ dx: newScrollX, dy: newScrollY });
15782
+ };
15783
+ const startMomentum = () => {
15784
+ if (!contentRef.current?.scene) return;
15785
+ const scene = contentRef.current.scene;
15786
+ const duration = Math.min(1e3, Math.max(200, Math.abs(velocity.vx) + Math.abs(velocity.vy)));
15787
+ const currentScroll = scrollRef.current;
15788
+ const baseTargetDx = Math.max(
15789
+ 0,
15790
+ Math.min(maxScrollX, currentScroll.dx - velocity.vx * (duration / 1e3))
15791
+ );
15792
+ const baseTargetDy = Math.max(
15793
+ 0,
15794
+ Math.min(maxScrollY, currentScroll.dy - velocity.vy * (duration / 1e3))
15795
+ );
15796
+ const snappedTarget = snap ? calculateSnapDestination(baseTargetDx, baseTargetDy) : null;
15797
+ stopActiveTween();
15798
+ tweenRef.current = scene.tweens.add({
15799
+ targets: { dx: currentScroll.dx, dy: currentScroll.dy },
15800
+ dx: snappedTarget?.dx ?? baseTargetDx,
15801
+ dy: snappedTarget?.dy ?? baseTargetDy,
15802
+ duration,
15803
+ ease: "Quad.easeOut",
15804
+ onUpdate: (tween) => {
15805
+ const target = tween.targets[0];
15806
+ updateScroll({ dx: target.dx, dy: target.dy });
15807
+ },
15808
+ onComplete: () => {
15809
+ tweenRef.current = null;
15810
+ }
15811
+ });
15812
+ };
15813
+ const getSnapTargets = () => {
15814
+ const viewportHeightCurrent = viewportRef.current?.height ?? viewportHeight;
15815
+ const viewportWidthCurrent = viewportRef.current?.width ?? viewportWidth;
15816
+ if (typeof snap === "object" && "positions" in snap) {
15817
+ const sorted = [...snap.positions].sort((a, b) => a - b);
15818
+ const inferredSizeY = sorted.length > 1 ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0)) : viewportHeightCurrent || 0;
15819
+ const inferredSizeX = sorted.length > 1 ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0)) : viewportWidthCurrent || 0;
15820
+ const targetsX = sorted.map((position, index) => {
15821
+ const next = sorted[index + 1];
15822
+ const size = next !== void 0 ? Math.max(0, next - position) : inferredSizeX > 0 ? inferredSizeX : viewportWidthCurrent || 0;
15823
+ return { position, size };
15824
+ });
15825
+ const targetsY = sorted.map((position, index) => {
15826
+ const next = sorted[index + 1];
15827
+ const size = next !== void 0 ? Math.max(0, next - position) : inferredSizeY > 0 ? inferredSizeY : viewportHeightCurrent || 0;
15828
+ return { position, size };
15829
+ });
15830
+ return { x: targetsX, y: targetsY };
15831
+ }
15832
+ return { x: [], y: [] };
15833
+ };
15834
+ const findNearestSnap = (current, targets, viewportSize, maxScroll) => {
15835
+ if (targets.length === 0) return current;
15836
+ let nearest = current;
15837
+ let minDistance = Infinity;
15838
+ for (const { position, size } of targets) {
15839
+ let adjustedPos = position;
15840
+ if (snapAlignment === "center") {
15841
+ adjustedPos = position + size / 2 - viewportSize / 2;
15842
+ } else if (snapAlignment === "end") {
15843
+ adjustedPos = position + size - viewportSize;
15844
+ }
15845
+ adjustedPos = Math.max(0, Math.min(maxScroll, adjustedPos));
15846
+ const distance = Math.abs(current - adjustedPos);
15847
+ if (distance < minDistance && distance <= effectiveSnapThreshold) {
15848
+ minDistance = distance;
15849
+ nearest = adjustedPos;
15850
+ } else if (distance < minDistance && effectiveSnapThreshold === Infinity) {
15851
+ minDistance = distance;
15852
+ nearest = adjustedPos;
15853
+ }
15854
+ }
15855
+ return nearest;
15856
+ };
15857
+ const calculateSnapDestination = (baseDx, baseDy) => {
15858
+ const { x: xTargets, y: yTargets } = getSnapTargets();
15859
+ const viewportHeightLocal = viewportRef.current?.height ?? 0;
15860
+ const viewportWidthLocal = viewportRef.current?.width ?? 0;
15861
+ const targetDx = findNearestSnap(baseDx, xTargets, viewportWidthLocal, maxScrollX);
15862
+ const targetDy = findNearestSnap(baseDy, yTargets, viewportHeightLocal, maxScrollY);
15863
+ return { dx: targetDx, dy: targetDy };
15864
+ };
15865
+ const applySnap = () => {
15866
+ if (!contentRef.current?.scene || !snap) return;
15867
+ const currentScroll = scrollRef.current;
15868
+ const { dx: targetDx, dy: targetDy } = calculateSnapDestination(
15869
+ currentScroll.dx,
15870
+ currentScroll.dy
15871
+ );
15872
+ if (targetDx === currentScroll.dx && targetDy === currentScroll.dy) return;
15873
+ const scene = contentRef.current.scene;
15874
+ stopActiveTween();
15875
+ tweenRef.current = scene.tweens.add({
15876
+ targets: { dx: currentScroll.dx, dy: currentScroll.dy },
15877
+ dx: targetDx,
15878
+ dy: targetDy,
15879
+ duration: 250,
15880
+ ease: "Quad.easeOut",
15881
+ onUpdate: (tween) => {
15882
+ const target = tween.targets[0];
15883
+ updateScroll({ dx: target.dx, dy: target.dy });
15884
+ },
15885
+ onComplete: () => {
15886
+ tweenRef.current = null;
15887
+ }
15888
+ });
15649
15889
  };
15650
15890
  const handleVerticalScroll = (scrollPos) => {
15651
15891
  const clampedScrollPos = Math.max(0, Math.min(maxScrollY, scrollPos));
15652
- setScroll((prev) => ({ ...prev, dy: clampedScrollPos }));
15892
+ updateScroll((prev) => ({ ...prev, dy: clampedScrollPos }));
15653
15893
  };
15654
15894
  const handleHorizontalScroll = (scrollPos) => {
15655
15895
  const clampedScrollPos = Math.max(0, Math.min(maxScrollX, scrollPos));
15656
- setScroll((prev) => ({ ...prev, dx: clampedScrollPos }));
15896
+ updateScroll((prev) => ({ ...prev, dx: clampedScrollPos }));
15897
+ };
15898
+ const handleSliderMomentumEnd = () => {
15899
+ if (snap) {
15900
+ applySnap();
15901
+ }
15657
15902
  };
15658
15903
  const handleTouchMove = (data) => {
15659
- if (data.state === "end") return;
15904
+ if (data.state === "end") {
15905
+ if (momentum && (Math.abs(velocity.vx) > 0.1 || Math.abs(velocity.vy) > 0.1)) {
15906
+ startMomentum();
15907
+ } else if (snap) {
15908
+ applySnap();
15909
+ }
15910
+ return;
15911
+ }
15912
+ if (data.state === "start") {
15913
+ stopActiveTween();
15914
+ setVelocity({ vx: 0, vy: 0 });
15915
+ setLastTime(Date.now());
15916
+ data.stopPropagation();
15917
+ return;
15918
+ }
15660
15919
  data.stopPropagation();
15661
15920
  const deltaX = data.dx ?? 0;
15662
15921
  const deltaY = data.dy ?? 0;
15922
+ const now = Date.now();
15923
+ const deltaTime = now - lastTime;
15924
+ if (deltaTime > 0) {
15925
+ const newVx = deltaX / deltaTime * 1e3;
15926
+ const newVy = deltaY / deltaTime * 1e3;
15927
+ setVelocity({ vx: newVx, vy: newVy });
15928
+ setLastTime(now);
15929
+ }
15663
15930
  calc(deltaX, deltaY);
15664
15931
  };
15665
15932
  const handleWheel = (data) => {
15666
15933
  data.stopPropagation();
15667
15934
  data.preventDefault();
15935
+ stopActiveTween();
15668
15936
  calc(-data.deltaX, -data.deltaY);
15937
+ if (snap) {
15938
+ if (wheelSnapTimeoutRef.current) {
15939
+ clearTimeout(wheelSnapTimeoutRef.current);
15940
+ }
15941
+ wheelSnapTimeoutRef.current = setTimeout(() => applySnap(), WHEEL_SNAP_DELAY);
15942
+ }
15669
15943
  };
15670
15944
  const redraw = useRedraw();
15671
15945
  const [visible, setVisible] = useState(false);
@@ -15675,6 +15949,10 @@ function ScrollView(props) {
15675
15949
  return () => {
15676
15950
  clearTimeout(timer1);
15677
15951
  clearTimeout(timer2);
15952
+ if (wheelSnapTimeoutRef.current) {
15953
+ clearTimeout(wheelSnapTimeoutRef.current);
15954
+ }
15955
+ stopActiveTween();
15678
15956
  };
15679
15957
  }, [showVerticalSliderActual, showHorizontalSliderActual]);
15680
15958
  return /* @__PURE__ */ jsxRuntime.jsx(View, { visible, children: /* @__PURE__ */ jsxRuntime.jsxs(View, { direction: "row", width: "100%", height: "100%", gap: 0, padding: 0, children: [
@@ -15731,7 +16009,9 @@ function ScrollView(props) {
15731
16009
  scrollPosition: scroll.dx,
15732
16010
  viewportSize: viewportWidth,
15733
16011
  contentSize: contentWidth,
15734
- onScroll: handleHorizontalScroll
16012
+ onScroll: handleHorizontalScroll,
16013
+ momentum,
16014
+ onMomentumEnd: handleSliderMomentumEnd
15735
16015
  }
15736
16016
  ) })
15737
16017
  ] }),
@@ -15744,7 +16024,9 @@ function ScrollView(props) {
15744
16024
  scrollPosition: scroll.dy,
15745
16025
  viewportSize: viewportHeight,
15746
16026
  contentSize: effectiveContentHeight,
15747
- onScroll: handleVerticalScroll
16027
+ onScroll: handleVerticalScroll,
16028
+ momentum,
16029
+ onMomentumEnd: handleSliderMomentumEnd
15748
16030
  }
15749
16031
  ) }),
15750
16032
  showHorizontalSliderActual && // Placeholder corner for potential icon - matches slider dimensions
@@ -17198,6 +17480,7 @@ exports.themeRegistry = themeRegistry;
17198
17480
  exports.tileSpriteCreator = tileSpriteCreator;
17199
17481
  exports.tileSpritePatcher = tileSpritePatcher;
17200
17482
  exports.unmount = unmount;
17483
+ exports.unmountJSX = unmountJSX;
17201
17484
  exports.unwrapSignal = unwrapSignal;
17202
17485
  exports.useCallback = useCallback;
17203
17486
  exports.useEffect = useEffect;
@@ -17219,4 +17502,4 @@ exports.viewCreator = viewCreator;
17219
17502
  exports.viewPatcher = viewPatcher;
17220
17503
  exports.viewportRegistry = viewportRegistry;
17221
17504
  exports.withHooks = withHooks;
17222
- //# sourceMappingURL=TransformOriginView-BDM6GE2F.cjs.map
17505
+ //# sourceMappingURL=TransformOriginView-KcTgaYRi.cjs.map