@tamagui/sheet 3.0.17 → 3.1.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.
- package/dist/cjs/Sheet.cjs +6 -3
- package/dist/cjs/Sheet.native.cjs +6 -6
- package/dist/cjs/Sheet.native.js +6 -6
- package/dist/cjs/Sheet.native.js.map +1 -1
- package/dist/cjs/SheetImplementationCustom.cjs +13 -1
- package/dist/cjs/SheetImplementationCustom.native.cjs +13 -1
- package/dist/cjs/SheetImplementationCustom.native.js +13 -1
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +3 -2
- package/dist/cjs/SheetScrollView.native.cjs +3 -3
- package/dist/cjs/SheetScrollView.native.js +3 -3
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/webViewport.cjs +16 -2
- package/dist/cjs/webViewport.native.cjs +17 -2
- package/dist/cjs/webViewport.native.js +17 -2
- package/dist/cjs/webViewport.native.js.map +1 -1
- package/dist/esm/Sheet.mjs +6 -3
- package/dist/esm/Sheet.mjs.map +1 -1
- package/dist/esm/Sheet.native.js +6 -6
- package/dist/esm/Sheet.native.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.mjs +14 -2
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +14 -2
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +3 -2
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +3 -3
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/webViewport.mjs +16 -3
- package/dist/esm/webViewport.mjs.map +1 -1
- package/dist/esm/webViewport.native.js +17 -3
- package/dist/esm/webViewport.native.js.map +1 -1
- package/dist/jsx/Sheet.mjs +6 -3
- package/dist/jsx/Sheet.mjs.map +1 -1
- package/dist/jsx/Sheet.native.cjs +6 -6
- package/dist/jsx/Sheet.native.js +6 -6
- package/dist/jsx/Sheet.native.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.mjs +14 -2
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.cjs +13 -1
- package/dist/jsx/SheetImplementationCustom.native.js +13 -1
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +3 -2
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.cjs +3 -3
- package/dist/jsx/SheetScrollView.native.js +3 -3
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/webViewport.mjs +16 -3
- package/dist/jsx/webViewport.mjs.map +1 -1
- package/dist/jsx/webViewport.native.cjs +17 -2
- package/dist/jsx/webViewport.native.js +17 -2
- package/dist/jsx/webViewport.native.js.map +1 -1
- package/package.json +25 -25
- package/src/Sheet.tsx +13 -12
- package/src/SheetImplementationCustom.tsx +19 -0
- package/src/SheetScrollView.tsx +5 -3
- package/src/webViewport.ts +24 -2
- package/types/Sheet.d.ts +86 -114
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +15 -16
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/webViewport.d.ts +6 -0
- package/types/webViewport.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetScrollView.js","names":[],"sources":["jsx/SheetScrollView.js"],"sourcesContent":["import { composeRefs } from \"@tamagui/compose-refs\";\nimport {\n createRefComponent,\n createStyledHOC,\n isWeb,\n View\n} from \"@tamagui/core\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { useGestureSheetContext } from \"./GestureSheetContext\";\nimport { getGestureHandlerState, isGestureHandlerEnabled } from \"./gestureState\";\nimport { useSheetContext } from \"./SheetContext\";\nimport { useSheetScrollViewGestures } from \"./useSheetScrollViewGestures\";\nimport {\n getStableLayoutViewportHeight,\n getWebKeyboardBottomInset,\n getWebKeyboardResizeHeight,\n isEditableElement,\n MIN_KEYBOARD_HEIGHT\n} from \"./webViewport\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SHEET_SCROLL_VIEW_NAME = \"SheetScrollView\";\nconst sheetContentStyle = { minHeight: \"100%\" };\nconst SheetScrollViewCustom = createRefComponent(\n ({\n scope,\n children,\n onScroll,\n scrollEnabled: scrollEnabledProp,\n style,\n ...props\n }, ref) => {\n const context = useSheetContext(scope);\n if (context.onlyShowContainer)\n throw new Error(\"Custom Sheet scrolling requires a custom Sheet\");\n const gestureContext = useGestureSheetContext();\n const { scrollBridge, setHasScrollView, hasFit, screenSize } = context;\n const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);\n const isKeyboardVisible = context.isKeyboardVisible === true || isWeb && getWebKeyboardResizeHeight() >= MIN_KEYBOARD_HEIGHT;\n const [scrollEnabled] = useControllableState({\n prop: scrollEnabledProp,\n defaultProp: true\n });\n const scrollRef = React.useRef(null);\n const [hasScrollableContent, setHasScrollableContent] = useState(true);\n const parentHeight = useRef(0);\n const contentHeight = useRef(0);\n const frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0);\n const fitSizingProps = hasFit ? {\n flex: void 0,\n height: void 0,\n maxHeight: screenSize || void 0\n } : { flex: 1 };\n const contentContainerStyle = hasFit ? void 0 : sheetContentStyle;\n const keyboardFrozenOverride = hasFit && isKeyboardVisible && frozenFrameHeight > 0 ? { height: frozenFrameHeight, maxHeight: frozenFrameHeight } : null;\n const scrollViewStyle = [\n ...Array.isArray(style) ? style : [style],\n keyboardFrozenOverride\n ];\n const panGestureRef = gestureContext?.panGestureRef;\n const { ScrollView: RNGHScrollView } = getGestureHandlerState();\n const useRNGHScrollView = isGestureHandlerEnabled() && RNGHScrollView && panGestureRef;\n const currentScrollOffset = useRef(0);\n const lastEmittedScrollOffset = useRef(0);\n const lockedScrollY = useRef(0);\n const focusedInputScrollFrame = useRef(0);\n const setScrollEnabled = (next, lockTo) => {\n if (!next) {\n const lockY = lockTo ?? scrollBridge.scrollLockY ?? currentScrollOffset.current;\n if (scrollBridge.enabled === false && scrollBridge.scrollLockY === lockY) {\n return;\n }\n scrollBridge.enabled = false;\n lockedScrollY.current = lockY;\n scrollBridge.scrollLockY = lockY;\n if (currentScrollOffset.current !== lockY) {\n scrollRef.current?.scrollTo?.({ x: 0, y: lockY, animated: false });\n currentScrollOffset.current = lockY;\n }\n } else {\n if (scrollBridge.enabled === true && scrollBridge.scrollLockY === void 0) {\n return;\n }\n scrollBridge.enabled = true;\n lockedScrollY.current = currentScrollOffset.current;\n scrollBridge.scrollLockY = void 0;\n }\n };\n const forceScrollTo = (y) => {\n scrollRef.current?.scrollTo?.({ x: 0, y, animated: false });\n currentScrollOffset.current = y;\n };\n const emitManualScroll = React.useCallback(\n (node, y) => {\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.({\n nativeEvent: {\n contentOffset: {\n x: node.scrollLeft,\n y\n },\n contentSize: {\n height: node.scrollHeight,\n width: node.scrollWidth\n },\n layoutMeasurement: {\n height: node.offsetHeight,\n width: node.offsetWidth\n }\n },\n timeStamp: Date.now()\n });\n },\n [onScroll, scrollBridge]\n );\n const scrollFocusedInputClearOfKeyboard = React.useCallback(() => {\n if (!isWeb || !hasFit || !isKeyboardVisible || keyboardOccludedHeight <= 0) {\n return;\n }\n const node = scrollRef.current?.getScrollableNode();\n const active = document.activeElement;\n if (!node || !active || !isEditableElement(active) || !node.contains(active)) {\n return;\n }\n const keyboardHeight = Math.max(keyboardOccludedHeight, getWebKeyboardBottomInset());\n if (keyboardHeight <= 0) return;\n const activeRect = active.getBoundingClientRect();\n const nodeRect = node.getBoundingClientRect();\n const margin = 12;\n const keyboardTop = getStableLayoutViewportHeight() - keyboardHeight;\n const visibleTop = nodeRect.top + margin;\n const visibleBottom = Math.min(nodeRect.bottom, keyboardTop) - margin;\n let nextScrollTop = node.scrollTop;\n if (activeRect.bottom > visibleBottom) {\n nextScrollTop += Math.ceil(activeRect.bottom - visibleBottom);\n } else if (activeRect.top < visibleTop) {\n nextScrollTop -= Math.ceil(visibleTop - activeRect.top);\n }\n const maxScrollTop = Math.max(0, node.scrollHeight - node.clientHeight);\n nextScrollTop = Math.max(0, Math.min(maxScrollTop, nextScrollTop));\n if (nextScrollTop === node.scrollTop) return;\n node.scrollTop = nextScrollTop;\n currentScrollOffset.current = nextScrollTop;\n scrollBridge.y = nextScrollTop;\n if (nextScrollTop > 0) scrollBridge.scrollStartY = -1;\n }, [hasFit, isKeyboardVisible, keyboardOccludedHeight, scrollBridge]);\n const scheduleFocusedInputScroll = React.useCallback(() => {\n if (!isWeb || !hasFit) return;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n focusedInputScrollFrame.current = requestAnimationFrame(() => {\n scrollFocusedInputClearOfKeyboard();\n focusedInputScrollFrame.current = requestAnimationFrame(\n scrollFocusedInputClearOfKeyboard\n );\n });\n }, [hasFit, scrollFocusedInputClearOfKeyboard]);\n useEffect(() => {\n if (!isWeb || !hasFit) return;\n scheduleFocusedInputScroll();\n window.addEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.addEventListener(\"resize\", scheduleFocusedInputScroll);\n return () => {\n cancelAnimationFrame(focusedInputScrollFrame.current);\n window.removeEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.removeEventListener(\"resize\", scheduleFocusedInputScroll);\n };\n }, [hasFit, scheduleFocusedInputScroll]);\n useEffect(() => {\n setHasScrollView(true);\n if (isGestureHandlerEnabled()) {\n scrollBridge.setScrollEnabled = setScrollEnabled;\n scrollBridge.forceScrollTo = forceScrollTo;\n }\n return () => {\n setHasScrollView(false);\n scrollBridge.setScrollEnabled = void 0;\n scrollBridge.forceScrollTo = void 0;\n };\n }, []);\n const updateScrollable = () => {\n if (parentHeight.current && contentHeight.current) {\n setHasScrollableContent(contentHeight.current > parentHeight.current);\n }\n };\n const recordFitHeight = (height) => {\n parentHeight.current = height;\n };\n useEffect(() => {\n scrollBridge.hasScrollableContent = hasScrollableContent;\n }, [hasScrollableContent]);\n const gestureProps = useSheetScrollViewGestures({\n scrollRef,\n scrollBridge,\n hasScrollableContent,\n scrollEnabled,\n setScrollEnabled,\n onManualScroll: emitManualScroll\n });\n const contentWrapper = /* @__PURE__ */ jsxs(\n View,\n {\n onLayout: (e) => {\n const height = Math.floor(e.nativeEvent.layout.height);\n if (height !== contentHeight.current) {\n contentHeight.current = height;\n updateScrollable();\n if (keyboardOccludedHeight > 0) {\n scheduleFocusedInputScroll();\n }\n }\n },\n children: [\n children,\n keyboardOccludedHeight > 0 && /* @__PURE__ */ jsx(\n View,\n {\n \"data-sheet-keyboard-scroll-pad\": true,\n height: keyboardOccludedHeight,\n width: \"100%\"\n }\n )\n ]\n }\n );\n if (useRNGHScrollView && RNGHScrollView && panGestureRef) {\n const RNGHComponent = RNGHScrollView;\n return /* @__PURE__ */ jsx(\n RNGHComponent,\n {\n ref: composeRefs(scrollRef, ref),\n style: [fitSizingProps, ...scrollViewStyle],\n scrollEventThrottle: 1,\n scrollEnabled,\n simultaneousHandlers: [panGestureRef],\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n if (scrollBridge.scrollLockY !== void 0) {\n if (y !== scrollBridge.scrollLockY) {\n scrollRef.current?.scrollTo?.({\n x: 0,\n y: scrollBridge.scrollLockY,\n animated: false\n });\n }\n currentScrollOffset.current = scrollBridge.scrollLockY;\n scrollBridge.y = scrollBridge.scrollLockY;\n if (lastEmittedScrollOffset.current !== scrollBridge.scrollLockY) {\n lastEmittedScrollOffset.current = scrollBridge.scrollLockY;\n onScroll?.({\n ...e,\n nativeEvent: {\n ...e.nativeEvent,\n contentOffset: {\n ...e.nativeEvent.contentOffset,\n y: scrollBridge.scrollLockY\n }\n }\n });\n }\n return;\n }\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n bounces: false,\n keyboardShouldPersistTaps: \"always\",\n keyboardDismissMode: \"none\",\n ...props,\n children: contentWrapper\n }\n );\n }\n return /* @__PURE__ */ jsx(\n ScrollView,\n {\n ...fitSizingProps,\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n ref: composeRefs(scrollRef, ref),\n scrollEventThrottle: 1,\n className: \"_ovs-contain\",\n scrollEnabled,\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n ...gestureProps,\n ...props,\n style: scrollViewStyle,\n children: contentWrapper\n }\n );\n }\n);\nconst SheetScrollView = createStyledHOC(\n ScrollView,\n ({ scope, ...props }, ref) => {\n const context = useSheetContext(scope);\n return context.onlyShowContainer ? /* @__PURE__ */ jsx(ScrollView, { ...props, ref }) : /* @__PURE__ */ jsx(SheetScrollViewCustom, { ...props, scope, ref });\n },\n {\n disableTheme: true,\n displayName: SHEET_SCROLL_VIEW_NAME\n }\n);\nexport {\n SheetScrollView\n};\n//# sourceMappingURL=SheetScrollView.js.map\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB,EAAE,WAAW,OAAO;AAC9C,MAAM,wBAAwB,oBAC3B,EACC,OACA,UACA,UACA,eAAe,mBACf,OACA,GAAG,SACF,QAAQ;CACT,MAAM,UAAU,gBAAgB,KAAK;CACrC,IAAI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EAAO;CAAI,CAAC;AAC7J,GACA;CACE,cAAc;CACd,aAAa;AACf,CACF"}
|
|
1
|
+
{"version":3,"file":"SheetScrollView.js","names":[],"sources":["jsx/SheetScrollView.js"],"sourcesContent":["import { composeRefs } from \"@tamagui/compose-refs\";\nimport {\n createRefComponent,\n createStyledHOC,\n isWeb,\n View\n} from \"@tamagui/core\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { useGestureSheetContext } from \"./GestureSheetContext\";\nimport { getGestureHandlerState, isGestureHandlerEnabled } from \"./gestureState\";\nimport { useSheetContext } from \"./SheetContext\";\nimport { useSheetScrollViewGestures } from \"./useSheetScrollViewGestures\";\nimport {\n getStableLayoutViewportHeight,\n getWebKeyboardBottomInset,\n getWebKeyboardResizeHeight,\n isEditableElement,\n MIN_KEYBOARD_HEIGHT\n} from \"./webViewport\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SHEET_SCROLL_VIEW_NAME = \"SheetScrollView\";\nconst sheetContentStyle = { minHeight: \"100%\" };\nconst SheetScrollViewCustom = createRefComponent(\n ({\n scope,\n children,\n onScroll,\n scrollEnabled: scrollEnabledProp,\n style,\n ...props\n }, ref) => {\n const context = useSheetContext(scope);\n if (context.onlyShowContainer)\n throw new Error(\"Custom Sheet scrolling requires a custom Sheet\");\n const gestureContext = useGestureSheetContext();\n const { scrollBridge, setHasScrollView, hasFit, screenSize } = context;\n const keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);\n const isKeyboardVisible = hasFit && (context.isKeyboardVisible === true || isWeb && getWebKeyboardResizeHeight() >= MIN_KEYBOARD_HEIGHT);\n const [scrollEnabled] = useControllableState({\n prop: scrollEnabledProp,\n defaultProp: true\n });\n const scrollRef = React.useRef(null);\n const [hasScrollableContent, setHasScrollableContent] = useState(true);\n const parentHeight = useRef(0);\n const contentHeight = useRef(0);\n const frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0);\n const fitSizingProps = hasFit ? {\n flex: void 0,\n height: void 0,\n maxHeight: screenSize || void 0\n } : { flex: 1 };\n const contentContainerStyle = hasFit ? void 0 : sheetContentStyle;\n const keyboardFrozenOverride = hasFit && isKeyboardVisible && frozenFrameHeight > 0 ? { height: frozenFrameHeight, maxHeight: frozenFrameHeight } : null;\n const scrollViewStyle = [\n ...Array.isArray(style) ? style : [style],\n keyboardFrozenOverride\n ];\n const panGestureRef = gestureContext?.panGestureRef;\n const { ScrollView: RNGHScrollView } = getGestureHandlerState();\n const useRNGHScrollView = isGestureHandlerEnabled() && RNGHScrollView && panGestureRef;\n const currentScrollOffset = useRef(0);\n const lastEmittedScrollOffset = useRef(0);\n const lockedScrollY = useRef(0);\n const focusedInputScrollFrame = useRef(0);\n const setScrollEnabled = (next, lockTo) => {\n if (!next) {\n const lockY = lockTo ?? scrollBridge.scrollLockY ?? currentScrollOffset.current;\n if (scrollBridge.enabled === false && scrollBridge.scrollLockY === lockY) {\n return;\n }\n scrollBridge.enabled = false;\n lockedScrollY.current = lockY;\n scrollBridge.scrollLockY = lockY;\n if (currentScrollOffset.current !== lockY) {\n scrollRef.current?.scrollTo?.({ x: 0, y: lockY, animated: false });\n currentScrollOffset.current = lockY;\n }\n } else {\n if (scrollBridge.enabled === true && scrollBridge.scrollLockY === void 0) {\n return;\n }\n scrollBridge.enabled = true;\n lockedScrollY.current = currentScrollOffset.current;\n scrollBridge.scrollLockY = void 0;\n }\n };\n const forceScrollTo = (y) => {\n scrollRef.current?.scrollTo?.({ x: 0, y, animated: false });\n currentScrollOffset.current = y;\n };\n const emitManualScroll = React.useCallback(\n (node, y) => {\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.({\n nativeEvent: {\n contentOffset: {\n x: node.scrollLeft,\n y\n },\n contentSize: {\n height: node.scrollHeight,\n width: node.scrollWidth\n },\n layoutMeasurement: {\n height: node.offsetHeight,\n width: node.offsetWidth\n }\n },\n timeStamp: Date.now()\n });\n },\n [onScroll, scrollBridge]\n );\n const scrollFocusedInputClearOfKeyboard = React.useCallback(() => {\n if (!isWeb || !hasFit || !isKeyboardVisible || keyboardOccludedHeight <= 0) {\n return;\n }\n const node = scrollRef.current?.getScrollableNode();\n const active = document.activeElement;\n if (!node || !active || !isEditableElement(active) || !node.contains(active)) {\n return;\n }\n const keyboardHeight = Math.max(keyboardOccludedHeight, getWebKeyboardBottomInset());\n if (keyboardHeight <= 0) return;\n const activeRect = active.getBoundingClientRect();\n const nodeRect = node.getBoundingClientRect();\n const margin = 12;\n const keyboardTop = getStableLayoutViewportHeight() - keyboardHeight;\n const visibleTop = nodeRect.top + margin;\n const visibleBottom = Math.min(nodeRect.bottom, keyboardTop) - margin;\n let nextScrollTop = node.scrollTop;\n if (activeRect.bottom > visibleBottom) {\n nextScrollTop += Math.ceil(activeRect.bottom - visibleBottom);\n } else if (activeRect.top < visibleTop) {\n nextScrollTop -= Math.ceil(visibleTop - activeRect.top);\n }\n const maxScrollTop = Math.max(0, node.scrollHeight - node.clientHeight);\n nextScrollTop = Math.max(0, Math.min(maxScrollTop, nextScrollTop));\n if (nextScrollTop === node.scrollTop) return;\n node.scrollTop = nextScrollTop;\n currentScrollOffset.current = nextScrollTop;\n scrollBridge.y = nextScrollTop;\n if (nextScrollTop > 0) scrollBridge.scrollStartY = -1;\n }, [hasFit, isKeyboardVisible, keyboardOccludedHeight, scrollBridge]);\n const scheduleFocusedInputScroll = React.useCallback(() => {\n if (!isWeb || !hasFit) return;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n focusedInputScrollFrame.current = requestAnimationFrame(() => {\n scrollFocusedInputClearOfKeyboard();\n focusedInputScrollFrame.current = requestAnimationFrame(\n scrollFocusedInputClearOfKeyboard\n );\n });\n }, [hasFit, scrollFocusedInputClearOfKeyboard]);\n useEffect(() => {\n if (!isWeb || !hasFit) return;\n scheduleFocusedInputScroll();\n window.addEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.addEventListener(\"resize\", scheduleFocusedInputScroll);\n return () => {\n cancelAnimationFrame(focusedInputScrollFrame.current);\n window.removeEventListener(\"focusin\", scheduleFocusedInputScroll);\n window.visualViewport?.removeEventListener(\"resize\", scheduleFocusedInputScroll);\n };\n }, [hasFit, scheduleFocusedInputScroll]);\n useEffect(() => {\n setHasScrollView(true);\n if (isGestureHandlerEnabled()) {\n scrollBridge.setScrollEnabled = setScrollEnabled;\n scrollBridge.forceScrollTo = forceScrollTo;\n }\n return () => {\n setHasScrollView(false);\n scrollBridge.setScrollEnabled = void 0;\n scrollBridge.forceScrollTo = void 0;\n };\n }, []);\n const updateScrollable = () => {\n if (parentHeight.current && contentHeight.current) {\n setHasScrollableContent(contentHeight.current > parentHeight.current);\n }\n };\n const recordFitHeight = (height) => {\n parentHeight.current = height;\n };\n useEffect(() => {\n scrollBridge.hasScrollableContent = hasScrollableContent;\n }, [hasScrollableContent]);\n const gestureProps = useSheetScrollViewGestures({\n scrollRef,\n scrollBridge,\n hasScrollableContent,\n scrollEnabled,\n setScrollEnabled,\n onManualScroll: emitManualScroll\n });\n const contentWrapper = /* @__PURE__ */ jsxs(\n View,\n {\n onLayout: (e) => {\n const height = Math.floor(e.nativeEvent.layout.height);\n if (height !== contentHeight.current) {\n contentHeight.current = height;\n updateScrollable();\n if (keyboardOccludedHeight > 0) {\n scheduleFocusedInputScroll();\n }\n }\n },\n children: [\n children,\n keyboardOccludedHeight > 0 && /* @__PURE__ */ jsx(\n View,\n {\n \"data-sheet-keyboard-scroll-pad\": true,\n height: keyboardOccludedHeight,\n width: \"100%\"\n }\n )\n ]\n }\n );\n if (useRNGHScrollView && RNGHScrollView && panGestureRef) {\n const RNGHComponent = RNGHScrollView;\n return /* @__PURE__ */ jsx(\n RNGHComponent,\n {\n ref: composeRefs(scrollRef, ref),\n style: [fitSizingProps, ...scrollViewStyle],\n scrollEventThrottle: 1,\n scrollEnabled,\n simultaneousHandlers: [panGestureRef],\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n if (scrollBridge.scrollLockY !== void 0) {\n if (y !== scrollBridge.scrollLockY) {\n scrollRef.current?.scrollTo?.({\n x: 0,\n y: scrollBridge.scrollLockY,\n animated: false\n });\n }\n currentScrollOffset.current = scrollBridge.scrollLockY;\n scrollBridge.y = scrollBridge.scrollLockY;\n if (lastEmittedScrollOffset.current !== scrollBridge.scrollLockY) {\n lastEmittedScrollOffset.current = scrollBridge.scrollLockY;\n onScroll?.({\n ...e,\n nativeEvent: {\n ...e.nativeEvent,\n contentOffset: {\n ...e.nativeEvent.contentOffset,\n y: scrollBridge.scrollLockY\n }\n }\n });\n }\n return;\n }\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n bounces: false,\n keyboardShouldPersistTaps: \"always\",\n keyboardDismissMode: \"none\",\n ...props,\n children: contentWrapper\n }\n );\n }\n return /* @__PURE__ */ jsx(\n ScrollView,\n {\n ...fitSizingProps,\n onLayout: (e) => {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n ref: composeRefs(scrollRef, ref),\n scrollEventThrottle: 1,\n className: \"_ovs-contain\",\n scrollEnabled,\n onScroll: (e) => {\n const { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll?.(e);\n },\n contentContainerStyle,\n ...gestureProps,\n ...props,\n style: scrollViewStyle,\n children: contentWrapper\n }\n );\n }\n);\nconst SheetScrollView = createStyledHOC(\n ScrollView,\n (propsIn, ref) => {\n const { scope, ...props } = propsIn;\n const context = useSheetContext(scope);\n return context.onlyShowContainer ? /* @__PURE__ */ jsx(ScrollView, { ...props, ref }) : /* @__PURE__ */ jsx(SheetScrollViewCustom, { ...props, scope, ref });\n },\n {\n disableTheme: true,\n displayName: SHEET_SCROLL_VIEW_NAME\n }\n);\nexport {\n SheetScrollView\n};\n//# sourceMappingURL=SheetScrollView.js.map\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB,EAAE,WAAW,OAAO;AAC9C,MAAM,wBAAwB,oBAC3B,EACC,OACA,UACA,UACA,eAAe,mBACf,OACA,GAAG,SACF,QAAQ;CACT,MAAM,UAAU,gBAAgB,KAAK;CACrC,IAAI,QAAQ,mBACV,MAAM,IAAI,MAAM,gDAAgD;CAClE,MAAM,iBAAiB,uBAAuB;CAC9C,MAAM,EAAE,cAAc,kBAAkB,QAAQ,eAAe;CAC/D,MAAM,yBAAyB,KAAK,IAAI,GAAG,QAAQ,0BAA0B,CAAC;CAC9E,MAAM,oBAAoB,WAAW,QAAQ,sBAAsB,QAAQ,SAAS,2BAA2B,KAAK;CACpH,MAAM,CAAC,iBAAiB,qBAAqB;EAC3C,MAAM;EACN,aAAa;CACf,CAAC;CACD,MAAM,YAAY,MAAM,OAAO,IAAI;CACnC,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,IAAI;CACrE,MAAM,eAAe,OAAO,CAAC;CAC7B,MAAM,gBAAgB,OAAO,CAAC;CAC9B,MAAM,oBAAoB,KAAK,IAAI,GAAG,QAAQ,6BAA6B,CAAC;CAC5E,MAAM,iBAAiB,SAAS;EAC9B,MAAM,KAAK;EACX,QAAQ,KAAK;EACb,WAAW,cAAc,KAAK;CAChC,IAAI,EAAE,MAAM,EAAE;CACd,MAAM,wBAAwB,SAAS,KAAK,IAAI;CAChD,MAAM,yBAAyB,UAAU,qBAAqB,oBAAoB,IAAI;EAAE,QAAQ;EAAmB,WAAW;CAAkB,IAAI;CACpJ,MAAM,kBAAkB,CACtB,GAAG,MAAM,QA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AAE,MAAM,EAAE,YAAY;GAC5B,oBAAoB,UAAU;GAC9B,aAAa,IAAI;GACjB,IAAI,IAAI,GAAG,aAAa,eAAe,CAAC;GACxC,wBAAwB,UAAU;GAClC,WAAW,CAAC;EACd;EACA;EACA,GAAG;EACH,GAAG;EACH,OAAO;EACP,UAAU;CACZ,CACF;AACF,CACF;AACA,MAAM,kBAAkB,gBACtB,aACC,SAAS,QAAQ;CAChB,MAAM,EAAE,OAAO,GAAG,UAAU;CAC5B,MAAM,UAAU,gBAAgB,KAAK;CACrC,OAAO,QAAQ,oBAAoC,oBAAI,YAAY;EAAE,GAAG;EAAO;CAAI,CAAC,IAAoB,oBAAI,uBAAuB;EAAE,GAAG;EAAO;EAAO;CAAI,CAAC;AAC7J,GACA;CACE,cAAc;CACd,aAAa;AACf,CACF"}
|
|
@@ -49,7 +49,7 @@ var SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param,
|
|
|
49
49
|
var gestureContext = (0, import_GestureSheetContext.useGestureSheetContext)();
|
|
50
50
|
var { scrollBridge, setHasScrollView, hasFit, screenSize } = context;
|
|
51
51
|
var keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);
|
|
52
|
-
var isKeyboardVisible = context.isKeyboardVisible === true || import_core.isWeb && (0, import_webViewport.getWebKeyboardResizeHeight)() >= import_webViewport.MIN_KEYBOARD_HEIGHT;
|
|
52
|
+
var isKeyboardVisible = hasFit && (context.isKeyboardVisible === true || import_core.isWeb && (0, import_webViewport.getWebKeyboardResizeHeight)() >= import_webViewport.MIN_KEYBOARD_HEIGHT);
|
|
53
53
|
var [scrollEnabled] = (0, import_use_controllable_state.useControllableState)({
|
|
54
54
|
prop: scrollEnabledProp,
|
|
55
55
|
defaultProp: true
|
|
@@ -322,8 +322,8 @@ var SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param,
|
|
|
322
322
|
children: contentWrapper
|
|
323
323
|
});
|
|
324
324
|
});
|
|
325
|
-
var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(
|
|
326
|
-
var { scope, ...props } =
|
|
325
|
+
var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(propsIn, ref) {
|
|
326
|
+
var { scope, ...props } = propsIn;
|
|
327
327
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
328
328
|
return context.onlyShowContainer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {
|
|
329
329
|
...props,
|
|
@@ -49,7 +49,7 @@ var SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param,
|
|
|
49
49
|
var gestureContext = (0, import_GestureSheetContext.useGestureSheetContext)();
|
|
50
50
|
var { scrollBridge, setHasScrollView, hasFit, screenSize } = context;
|
|
51
51
|
var keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);
|
|
52
|
-
var isKeyboardVisible = context.isKeyboardVisible === true || import_core.isWeb && (0, import_webViewport.getWebKeyboardResizeHeight)() >= import_webViewport.MIN_KEYBOARD_HEIGHT;
|
|
52
|
+
var isKeyboardVisible = hasFit && (context.isKeyboardVisible === true || import_core.isWeb && (0, import_webViewport.getWebKeyboardResizeHeight)() >= import_webViewport.MIN_KEYBOARD_HEIGHT);
|
|
53
53
|
var [scrollEnabled] = (0, import_use_controllable_state.useControllableState)({
|
|
54
54
|
prop: scrollEnabledProp,
|
|
55
55
|
defaultProp: true
|
|
@@ -322,8 +322,8 @@ var SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param,
|
|
|
322
322
|
children: contentWrapper
|
|
323
323
|
});
|
|
324
324
|
});
|
|
325
|
-
var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(
|
|
326
|
-
var { scope, ...props } =
|
|
325
|
+
var SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(propsIn, ref) {
|
|
326
|
+
var { scope, ...props } = propsIn;
|
|
327
327
|
var context = (0, import_SheetContext.useSheetContext)(scope);
|
|
328
328
|
return context.onlyShowContainer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {
|
|
329
329
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetScrollView.native.js","names":[],"sources":["jsx/SheetScrollView.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SheetScrollView_exports = {};\n__export(SheetScrollView_exports, {\n SheetScrollView: () => SheetScrollView\n});\nmodule.exports = __toCommonJS(SheetScrollView_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_core = require(\"@tamagui/core\");\nvar import_scroll_view = require(\"@tamagui/scroll-view\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_GestureSheetContext = require(\"./GestureSheetContext\");\nvar import_gestureState = require(\"./gestureState\");\nvar import_SheetContext = require(\"./SheetContext\");\nvar import_useSheetScrollViewGestures = require(\"./useSheetScrollViewGestures\");\nvar import_webViewport = require(\"./webViewport\");\nvar SHEET_SCROLL_VIEW_NAME = \"SheetScrollView\";\nvar sheetContentStyle = {\n minHeight: \"100%\"\n};\nvar SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param, ref) {\n var { scope, children, onScroll, scrollEnabled: scrollEnabledProp, style, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n if (context.onlyShowContainer) throw new Error(\"Custom Sheet scrolling requires a custom Sheet\");\n var gestureContext = (0, import_GestureSheetContext.useGestureSheetContext)();\n var { scrollBridge, setHasScrollView, hasFit, screenSize } = context;\n var keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);\n var isKeyboardVisible = context.isKeyboardVisible === true || import_core.isWeb && (0, import_webViewport.getWebKeyboardResizeHeight)() >= import_webViewport.MIN_KEYBOARD_HEIGHT;\n var [scrollEnabled] = (0, import_use_controllable_state.useControllableState)({\n prop: scrollEnabledProp,\n defaultProp: true\n });\n var scrollRef = import_react.default.useRef(null);\n var [hasScrollableContent, setHasScrollableContent] = (0, import_react.useState)(true);\n var parentHeight = (0, import_react.useRef)(0);\n var contentHeight = (0, import_react.useRef)(0);\n var frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0);\n var fitSizingProps = hasFit ? {\n flex: void 0,\n height: void 0,\n maxHeight: screenSize || void 0\n } : {\n flex: 1\n };\n var contentContainerStyle = hasFit ? void 0 : sheetContentStyle;\n var keyboardFrozenOverride = hasFit && isKeyboardVisible && frozenFrameHeight > 0 ? {\n height: frozenFrameHeight,\n maxHeight: frozenFrameHeight\n } : null;\n var scrollViewStyle = [\n ...Array.isArray(style) ? style : [\n style\n ],\n keyboardFrozenOverride\n ];\n var panGestureRef = gestureContext === null || gestureContext === void 0 ? void 0 : gestureContext.panGestureRef;\n var { ScrollView: RNGHScrollView } = (0, import_gestureState.getGestureHandlerState)();\n var useRNGHScrollView = (0, import_gestureState.isGestureHandlerEnabled)() && RNGHScrollView && panGestureRef;\n var currentScrollOffset = (0, import_react.useRef)(0);\n var lastEmittedScrollOffset = (0, import_react.useRef)(0);\n var lockedScrollY = (0, import_react.useRef)(0);\n var focusedInputScrollFrame = (0, import_react.useRef)(0);\n var setScrollEnabled = function setScrollEnabled2(next, lockTo) {\n if (!next) {\n var _ref;\n var lockY = (_ref = lockTo !== null && lockTo !== void 0 ? lockTo : scrollBridge.scrollLockY) !== null && _ref !== void 0 ? _ref : currentScrollOffset.current;\n if (scrollBridge.enabled === false && scrollBridge.scrollLockY === lockY) {\n return;\n }\n scrollBridge.enabled = false;\n lockedScrollY.current = lockY;\n scrollBridge.scrollLockY = lockY;\n if (currentScrollOffset.current !== lockY) {\n var _scrollRef_current_scrollTo, _scrollRef_current;\n (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : (_scrollRef_current_scrollTo = _scrollRef_current.scrollTo) === null || _scrollRef_current_scrollTo === void 0 ? void 0 : _scrollRef_current_scrollTo.call(_scrollRef_current, {\n x: 0,\n y: lockY,\n animated: false\n });\n currentScrollOffset.current = lockY;\n }\n } else {\n if (scrollBridge.enabled === true && scrollBridge.scrollLockY === void 0) {\n return;\n }\n scrollBridge.enabled = true;\n lockedScrollY.current = currentScrollOffset.current;\n scrollBridge.scrollLockY = void 0;\n }\n };\n var forceScrollTo = function forceScrollTo2(y) {\n var _scrollRef_current_scrollTo, _scrollRef_current;\n (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : (_scrollRef_current_scrollTo = _scrollRef_current.scrollTo) === null || _scrollRef_current_scrollTo === void 0 ? void 0 : _scrollRef_current_scrollTo.call(_scrollRef_current, {\n x: 0,\n y,\n animated: false\n });\n currentScrollOffset.current = y;\n };\n var emitManualScroll = import_react.default.useCallback(function(node, y) {\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll({\n nativeEvent: {\n contentOffset: {\n x: node.scrollLeft,\n y\n },\n contentSize: {\n height: node.scrollHeight,\n width: node.scrollWidth\n },\n layoutMeasurement: {\n height: node.offsetHeight,\n width: node.offsetWidth\n }\n },\n timeStamp: Date.now()\n });\n }, [\n onScroll,\n scrollBridge\n ]);\n var scrollFocusedInputClearOfKeyboard = import_react.default.useCallback(function() {\n var _scrollRef_current;\n if (!import_core.isWeb || !hasFit || !isKeyboardVisible || keyboardOccludedHeight <= 0) {\n return;\n }\n var node = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.getScrollableNode();\n var active = document.activeElement;\n if (!node || !active || !(0, import_webViewport.isEditableElement)(active) || !node.contains(active)) {\n return;\n }\n var keyboardHeight = Math.max(keyboardOccludedHeight, (0, import_webViewport.getWebKeyboardBottomInset)());\n if (keyboardHeight <= 0) return;\n var activeRect = active.getBoundingClientRect();\n var nodeRect = node.getBoundingClientRect();\n var margin = 12;\n var keyboardTop = (0, import_webViewport.getStableLayoutViewportHeight)() - keyboardHeight;\n var visibleTop = nodeRect.top + margin;\n var visibleBottom = Math.min(nodeRect.bottom, keyboardTop) - margin;\n var nextScrollTop = node.scrollTop;\n if (activeRect.bottom > visibleBottom) {\n nextScrollTop += Math.ceil(activeRect.bottom - visibleBottom);\n } else if (activeRect.top < visibleTop) {\n nextScrollTop -= Math.ceil(visibleTop - activeRect.top);\n }\n var maxScrollTop = Math.max(0, node.scrollHeight - node.clientHeight);\n nextScrollTop = Math.max(0, Math.min(maxScrollTop, nextScrollTop));\n if (nextScrollTop === node.scrollTop) return;\n node.scrollTop = nextScrollTop;\n currentScrollOffset.current = nextScrollTop;\n scrollBridge.y = nextScrollTop;\n if (nextScrollTop > 0) scrollBridge.scrollStartY = -1;\n }, [\n hasFit,\n isKeyboardVisible,\n keyboardOccludedHeight,\n scrollBridge\n ]);\n var scheduleFocusedInputScroll = import_react.default.useCallback(function() {\n if (!import_core.isWeb || !hasFit) return;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n focusedInputScrollFrame.current = requestAnimationFrame(function() {\n scrollFocusedInputClearOfKeyboard();\n focusedInputScrollFrame.current = requestAnimationFrame(scrollFocusedInputClearOfKeyboard);\n });\n }, [\n hasFit,\n scrollFocusedInputClearOfKeyboard\n ]);\n (0, import_react.useEffect)(function() {\n var _window_visualViewport;\n if (!import_core.isWeb || !hasFit) return;\n scheduleFocusedInputScroll();\n window.addEventListener(\"focusin\", scheduleFocusedInputScroll);\n (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.addEventListener(\"resize\", scheduleFocusedInputScroll);\n return function() {\n var _window_visualViewport2;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n window.removeEventListener(\"focusin\", scheduleFocusedInputScroll);\n (_window_visualViewport2 = window.visualViewport) === null || _window_visualViewport2 === void 0 ? void 0 : _window_visualViewport2.removeEventListener(\"resize\", scheduleFocusedInputScroll);\n };\n }, [\n hasFit,\n scheduleFocusedInputScroll\n ]);\n (0, import_react.useEffect)(function() {\n setHasScrollView(true);\n if ((0, import_gestureState.isGestureHandlerEnabled)()) {\n scrollBridge.setScrollEnabled = setScrollEnabled;\n scrollBridge.forceScrollTo = forceScrollTo;\n }\n return function() {\n setHasScrollView(false);\n scrollBridge.setScrollEnabled = void 0;\n scrollBridge.forceScrollTo = void 0;\n };\n }, []);\n var updateScrollable = function updateScrollable2() {\n if (parentHeight.current && contentHeight.current) {\n setHasScrollableContent(contentHeight.current > parentHeight.current);\n }\n };\n var recordFitHeight = function recordFitHeight2(height) {\n parentHeight.current = height;\n };\n (0, import_react.useEffect)(function() {\n scrollBridge.hasScrollableContent = hasScrollableContent;\n }, [\n hasScrollableContent\n ]);\n var gestureProps = (0, import_useSheetScrollViewGestures.useSheetScrollViewGestures)({\n scrollRef,\n scrollBridge,\n hasScrollableContent,\n scrollEnabled,\n setScrollEnabled,\n onManualScroll: emitManualScroll\n });\n var contentWrapper = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.View, {\n onLayout: function onLayout(e) {\n var height = Math.floor(e.nativeEvent.layout.height);\n if (height !== contentHeight.current) {\n contentHeight.current = height;\n updateScrollable();\n if (keyboardOccludedHeight > 0) {\n scheduleFocusedInputScroll();\n }\n }\n },\n children: [\n children,\n keyboardOccludedHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {\n \"data-sheet-keyboard-scroll-pad\": true,\n height: keyboardOccludedHeight,\n width: \"100%\"\n })\n ]\n });\n if (useRNGHScrollView && RNGHScrollView && panGestureRef) {\n var RNGHComponent = RNGHScrollView;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RNGHComponent, {\n ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),\n style: [\n fitSizingProps,\n ...scrollViewStyle\n ],\n scrollEventThrottle: 1,\n scrollEnabled,\n simultaneousHandlers: [\n panGestureRef\n ],\n onLayout: function onLayout(e) {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n onScroll: function onScroll1(e) {\n var { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n if (scrollBridge.scrollLockY !== void 0) {\n if (y !== scrollBridge.scrollLockY) {\n var _scrollRef_current_scrollTo, _scrollRef_current;\n (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : (_scrollRef_current_scrollTo = _scrollRef_current.scrollTo) === null || _scrollRef_current_scrollTo === void 0 ? void 0 : _scrollRef_current_scrollTo.call(_scrollRef_current, {\n x: 0,\n y: scrollBridge.scrollLockY,\n animated: false\n });\n }\n currentScrollOffset.current = scrollBridge.scrollLockY;\n scrollBridge.y = scrollBridge.scrollLockY;\n if (lastEmittedScrollOffset.current !== scrollBridge.scrollLockY) {\n lastEmittedScrollOffset.current = scrollBridge.scrollLockY;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll({\n ...e,\n nativeEvent: {\n ...e.nativeEvent,\n contentOffset: {\n ...e.nativeEvent.contentOffset,\n y: scrollBridge.scrollLockY\n }\n }\n });\n }\n return;\n }\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(e);\n },\n contentContainerStyle,\n bounces: false,\n keyboardShouldPersistTaps: \"always\",\n keyboardDismissMode: \"none\",\n ...props,\n children: contentWrapper\n });\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {\n ...fitSizingProps,\n onLayout: function onLayout(e) {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),\n scrollEventThrottle: 1,\n className: \"_ovs-contain\",\n scrollEnabled,\n onScroll: function onScroll1(e) {\n var { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(e);\n },\n contentContainerStyle,\n ...gestureProps,\n ...props,\n style: scrollViewStyle,\n children: contentWrapper\n });\n});\nvar SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(param, ref) {\n var { scope, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n return context.onlyShowContainer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {\n ...props,\n ref\n }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetScrollViewCustom, {\n ...props,\n scope,\n ref\n });\n}, {\n disableTheme: true,\n displayName: SHEET_SCROLL_VIEW_NAME\n});\n//# sourceMappingURL=SheetScrollView.js.map\n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.native.js","names":[],"sources":["jsx/SheetScrollView.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SheetScrollView_exports = {};\n__export(SheetScrollView_exports, {\n SheetScrollView: () => SheetScrollView\n});\nmodule.exports = __toCommonJS(SheetScrollView_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_core = require(\"@tamagui/core\");\nvar import_scroll_view = require(\"@tamagui/scroll-view\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_GestureSheetContext = require(\"./GestureSheetContext\");\nvar import_gestureState = require(\"./gestureState\");\nvar import_SheetContext = require(\"./SheetContext\");\nvar import_useSheetScrollViewGestures = require(\"./useSheetScrollViewGestures\");\nvar import_webViewport = require(\"./webViewport\");\nvar SHEET_SCROLL_VIEW_NAME = \"SheetScrollView\";\nvar sheetContentStyle = {\n minHeight: \"100%\"\n};\nvar SheetScrollViewCustom = (0, import_core.createRefComponent)(function(param, ref) {\n var { scope, children, onScroll, scrollEnabled: scrollEnabledProp, style, ...props } = param;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n if (context.onlyShowContainer) throw new Error(\"Custom Sheet scrolling requires a custom Sheet\");\n var gestureContext = (0, import_GestureSheetContext.useGestureSheetContext)();\n var { scrollBridge, setHasScrollView, hasFit, screenSize } = context;\n var keyboardOccludedHeight = Math.max(0, context.keyboardOccludedHeight || 0);\n var isKeyboardVisible = hasFit && (context.isKeyboardVisible === true || import_core.isWeb && (0, import_webViewport.getWebKeyboardResizeHeight)() >= import_webViewport.MIN_KEYBOARD_HEIGHT);\n var [scrollEnabled] = (0, import_use_controllable_state.useControllableState)({\n prop: scrollEnabledProp,\n defaultProp: true\n });\n var scrollRef = import_react.default.useRef(null);\n var [hasScrollableContent, setHasScrollableContent] = (0, import_react.useState)(true);\n var parentHeight = (0, import_react.useRef)(0);\n var contentHeight = (0, import_react.useRef)(0);\n var frozenFrameHeight = Math.max(0, context.keyboardStableFrameHeight || 0);\n var fitSizingProps = hasFit ? {\n flex: void 0,\n height: void 0,\n maxHeight: screenSize || void 0\n } : {\n flex: 1\n };\n var contentContainerStyle = hasFit ? void 0 : sheetContentStyle;\n var keyboardFrozenOverride = hasFit && isKeyboardVisible && frozenFrameHeight > 0 ? {\n height: frozenFrameHeight,\n maxHeight: frozenFrameHeight\n } : null;\n var scrollViewStyle = [\n ...Array.isArray(style) ? style : [\n style\n ],\n keyboardFrozenOverride\n ];\n var panGestureRef = gestureContext === null || gestureContext === void 0 ? void 0 : gestureContext.panGestureRef;\n var { ScrollView: RNGHScrollView } = (0, import_gestureState.getGestureHandlerState)();\n var useRNGHScrollView = (0, import_gestureState.isGestureHandlerEnabled)() && RNGHScrollView && panGestureRef;\n var currentScrollOffset = (0, import_react.useRef)(0);\n var lastEmittedScrollOffset = (0, import_react.useRef)(0);\n var lockedScrollY = (0, import_react.useRef)(0);\n var focusedInputScrollFrame = (0, import_react.useRef)(0);\n var setScrollEnabled = function setScrollEnabled2(next, lockTo) {\n if (!next) {\n var _ref;\n var lockY = (_ref = lockTo !== null && lockTo !== void 0 ? lockTo : scrollBridge.scrollLockY) !== null && _ref !== void 0 ? _ref : currentScrollOffset.current;\n if (scrollBridge.enabled === false && scrollBridge.scrollLockY === lockY) {\n return;\n }\n scrollBridge.enabled = false;\n lockedScrollY.current = lockY;\n scrollBridge.scrollLockY = lockY;\n if (currentScrollOffset.current !== lockY) {\n var _scrollRef_current_scrollTo, _scrollRef_current;\n (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : (_scrollRef_current_scrollTo = _scrollRef_current.scrollTo) === null || _scrollRef_current_scrollTo === void 0 ? void 0 : _scrollRef_current_scrollTo.call(_scrollRef_current, {\n x: 0,\n y: lockY,\n animated: false\n });\n currentScrollOffset.current = lockY;\n }\n } else {\n if (scrollBridge.enabled === true && scrollBridge.scrollLockY === void 0) {\n return;\n }\n scrollBridge.enabled = true;\n lockedScrollY.current = currentScrollOffset.current;\n scrollBridge.scrollLockY = void 0;\n }\n };\n var forceScrollTo = function forceScrollTo2(y) {\n var _scrollRef_current_scrollTo, _scrollRef_current;\n (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : (_scrollRef_current_scrollTo = _scrollRef_current.scrollTo) === null || _scrollRef_current_scrollTo === void 0 ? void 0 : _scrollRef_current_scrollTo.call(_scrollRef_current, {\n x: 0,\n y,\n animated: false\n });\n currentScrollOffset.current = y;\n };\n var emitManualScroll = import_react.default.useCallback(function(node, y) {\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll({\n nativeEvent: {\n contentOffset: {\n x: node.scrollLeft,\n y\n },\n contentSize: {\n height: node.scrollHeight,\n width: node.scrollWidth\n },\n layoutMeasurement: {\n height: node.offsetHeight,\n width: node.offsetWidth\n }\n },\n timeStamp: Date.now()\n });\n }, [\n onScroll,\n scrollBridge\n ]);\n var scrollFocusedInputClearOfKeyboard = import_react.default.useCallback(function() {\n var _scrollRef_current;\n if (!import_core.isWeb || !hasFit || !isKeyboardVisible || keyboardOccludedHeight <= 0) {\n return;\n }\n var node = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.getScrollableNode();\n var active = document.activeElement;\n if (!node || !active || !(0, import_webViewport.isEditableElement)(active) || !node.contains(active)) {\n return;\n }\n var keyboardHeight = Math.max(keyboardOccludedHeight, (0, import_webViewport.getWebKeyboardBottomInset)());\n if (keyboardHeight <= 0) return;\n var activeRect = active.getBoundingClientRect();\n var nodeRect = node.getBoundingClientRect();\n var margin = 12;\n var keyboardTop = (0, import_webViewport.getStableLayoutViewportHeight)() - keyboardHeight;\n var visibleTop = nodeRect.top + margin;\n var visibleBottom = Math.min(nodeRect.bottom, keyboardTop) - margin;\n var nextScrollTop = node.scrollTop;\n if (activeRect.bottom > visibleBottom) {\n nextScrollTop += Math.ceil(activeRect.bottom - visibleBottom);\n } else if (activeRect.top < visibleTop) {\n nextScrollTop -= Math.ceil(visibleTop - activeRect.top);\n }\n var maxScrollTop = Math.max(0, node.scrollHeight - node.clientHeight);\n nextScrollTop = Math.max(0, Math.min(maxScrollTop, nextScrollTop));\n if (nextScrollTop === node.scrollTop) return;\n node.scrollTop = nextScrollTop;\n currentScrollOffset.current = nextScrollTop;\n scrollBridge.y = nextScrollTop;\n if (nextScrollTop > 0) scrollBridge.scrollStartY = -1;\n }, [\n hasFit,\n isKeyboardVisible,\n keyboardOccludedHeight,\n scrollBridge\n ]);\n var scheduleFocusedInputScroll = import_react.default.useCallback(function() {\n if (!import_core.isWeb || !hasFit) return;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n focusedInputScrollFrame.current = requestAnimationFrame(function() {\n scrollFocusedInputClearOfKeyboard();\n focusedInputScrollFrame.current = requestAnimationFrame(scrollFocusedInputClearOfKeyboard);\n });\n }, [\n hasFit,\n scrollFocusedInputClearOfKeyboard\n ]);\n (0, import_react.useEffect)(function() {\n var _window_visualViewport;\n if (!import_core.isWeb || !hasFit) return;\n scheduleFocusedInputScroll();\n window.addEventListener(\"focusin\", scheduleFocusedInputScroll);\n (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.addEventListener(\"resize\", scheduleFocusedInputScroll);\n return function() {\n var _window_visualViewport2;\n cancelAnimationFrame(focusedInputScrollFrame.current);\n window.removeEventListener(\"focusin\", scheduleFocusedInputScroll);\n (_window_visualViewport2 = window.visualViewport) === null || _window_visualViewport2 === void 0 ? void 0 : _window_visualViewport2.removeEventListener(\"resize\", scheduleFocusedInputScroll);\n };\n }, [\n hasFit,\n scheduleFocusedInputScroll\n ]);\n (0, import_react.useEffect)(function() {\n setHasScrollView(true);\n if ((0, import_gestureState.isGestureHandlerEnabled)()) {\n scrollBridge.setScrollEnabled = setScrollEnabled;\n scrollBridge.forceScrollTo = forceScrollTo;\n }\n return function() {\n setHasScrollView(false);\n scrollBridge.setScrollEnabled = void 0;\n scrollBridge.forceScrollTo = void 0;\n };\n }, []);\n var updateScrollable = function updateScrollable2() {\n if (parentHeight.current && contentHeight.current) {\n setHasScrollableContent(contentHeight.current > parentHeight.current);\n }\n };\n var recordFitHeight = function recordFitHeight2(height) {\n parentHeight.current = height;\n };\n (0, import_react.useEffect)(function() {\n scrollBridge.hasScrollableContent = hasScrollableContent;\n }, [\n hasScrollableContent\n ]);\n var gestureProps = (0, import_useSheetScrollViewGestures.useSheetScrollViewGestures)({\n scrollRef,\n scrollBridge,\n hasScrollableContent,\n scrollEnabled,\n setScrollEnabled,\n onManualScroll: emitManualScroll\n });\n var contentWrapper = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.View, {\n onLayout: function onLayout(e) {\n var height = Math.floor(e.nativeEvent.layout.height);\n if (height !== contentHeight.current) {\n contentHeight.current = height;\n updateScrollable();\n if (keyboardOccludedHeight > 0) {\n scheduleFocusedInputScroll();\n }\n }\n },\n children: [\n children,\n keyboardOccludedHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {\n \"data-sheet-keyboard-scroll-pad\": true,\n height: keyboardOccludedHeight,\n width: \"100%\"\n })\n ]\n });\n if (useRNGHScrollView && RNGHScrollView && panGestureRef) {\n var RNGHComponent = RNGHScrollView;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RNGHComponent, {\n ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),\n style: [\n fitSizingProps,\n ...scrollViewStyle\n ],\n scrollEventThrottle: 1,\n scrollEnabled,\n simultaneousHandlers: [\n panGestureRef\n ],\n onLayout: function onLayout(e) {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n onScroll: function onScroll1(e) {\n var { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n if (scrollBridge.scrollLockY !== void 0) {\n if (y !== scrollBridge.scrollLockY) {\n var _scrollRef_current_scrollTo, _scrollRef_current;\n (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : (_scrollRef_current_scrollTo = _scrollRef_current.scrollTo) === null || _scrollRef_current_scrollTo === void 0 ? void 0 : _scrollRef_current_scrollTo.call(_scrollRef_current, {\n x: 0,\n y: scrollBridge.scrollLockY,\n animated: false\n });\n }\n currentScrollOffset.current = scrollBridge.scrollLockY;\n scrollBridge.y = scrollBridge.scrollLockY;\n if (lastEmittedScrollOffset.current !== scrollBridge.scrollLockY) {\n lastEmittedScrollOffset.current = scrollBridge.scrollLockY;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll({\n ...e,\n nativeEvent: {\n ...e.nativeEvent,\n contentOffset: {\n ...e.nativeEvent.contentOffset,\n y: scrollBridge.scrollLockY\n }\n }\n });\n }\n return;\n }\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(e);\n },\n contentContainerStyle,\n bounces: false,\n keyboardShouldPersistTaps: \"always\",\n keyboardDismissMode: \"none\",\n ...props,\n children: contentWrapper\n });\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {\n ...fitSizingProps,\n onLayout: function onLayout(e) {\n recordFitHeight(Math.ceil(e.nativeEvent.layout.height));\n updateScrollable();\n },\n ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),\n scrollEventThrottle: 1,\n className: \"_ovs-contain\",\n scrollEnabled,\n onScroll: function onScroll1(e) {\n var { y } = e.nativeEvent.contentOffset;\n currentScrollOffset.current = y;\n scrollBridge.y = y;\n if (y > 0) scrollBridge.scrollStartY = -1;\n lastEmittedScrollOffset.current = y;\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(e);\n },\n contentContainerStyle,\n ...gestureProps,\n ...props,\n style: scrollViewStyle,\n children: contentWrapper\n });\n});\nvar SheetScrollView = (0, import_core.createStyledHOC)(import_scroll_view.ScrollView, function(propsIn, ref) {\n var { scope, ...props } = propsIn;\n var context = (0, import_SheetContext.useSheetContext)(scope);\n return context.onlyShowContainer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {\n ...props,\n ref\n }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetScrollViewCustom, {\n ...props,\n scope,\n ref\n });\n}, {\n disableTheme: true,\n displayName: SHEET_SCROLL_VIEW_NAME\n});\n//# sourceMappingURL=SheetScrollView.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe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AI,SAAS,CAAC;GAChE;GACA;GACA,SAAS;GACT,2BAA2B;GAC3B,qBAAqB;GACrB,GAAG;GACH,UAAU;EACZ,CAAC;CACH;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,mBAAmB,YAAY;EAChF,GAAG;EACH,UAAU,SAAS,SAAS,GAAG;GAC7B,gBAAgB,KAAK,KAAK,EAAE,YAAY,OAAO,MAAM,CAAC;GACtD,iBAAiB;EACnB;EACA,MAAM,GAAG,oBAAoB,YAAW,CAAE,WAAW,GAAG;EACxD,qBAAqB;EACrB,WAAW;EACX;EACA,UAAU,SAAS,UAAU,GAAG;GAC9B,IAAI,EAAE,MAAM,EAAE,YAAY;GAC1B,oBAAoB,UAAU;GAC9B,aAAa,IAAI;GACjB,IAAI,IAAI,GAAG,aAAa,eAAe,CAAC;GACxC,wBAAwB,UAAU;GAClC,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,CAAC;EAChE;EACA;EACA,GAAG;EACH,GAAG;EACH,OAAO;EACP,UAAU;CACZ,CAAC;AACH,CAAC;AACD,IAAI,mBAAmB,GAAG,YAAY,gBAAe,CAAE,mBAAmB,YAAY,SAAS,SAAS,KAAK;CAC3G,IAAI,EAAE,OAAO,GAAG,UAAU;CAC1B,IAAI,WAAW,GAAG,oBAAoB,gBAAe,CAAE,KAAK;CAC5D,OAAO,QAAQ,oBAAoC,iBAAC,GAAG,mBAAmB,IAAG,CAAE,mBAAmB,YAAY;EAC5G,GAAG;EACH;CACF,CAAC,IAAoB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,uBAAuB;EACtE,GAAG;EACH;EACA;CACF,CAAC;AACH,GAAG;CACD,cAAc;CACd,aAAa;AACf,CAAC"}
|
package/dist/jsx/webViewport.mjs
CHANGED
|
@@ -13,12 +13,25 @@ function getStableLayoutViewportHeight() {
|
|
|
13
13
|
return Math.max(window.innerHeight || 0, window.visualViewport?.height || 0);
|
|
14
14
|
}
|
|
15
15
|
let _maxViewportHeight = 0;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let _visibleViewportHeight = 0;
|
|
17
|
+
function updateMaxViewportHeight() {
|
|
18
18
|
const ch = typeof document !== "undefined" ? document.documentElement?.clientHeight : 0;
|
|
19
|
+
_visibleViewportHeight = Math.max(ch || 0, window.innerHeight || 0);
|
|
19
20
|
_maxViewportHeight = Math.max(_maxViewportHeight, ch || 0, window.innerHeight || 0, window.visualViewport?.height || 0, window.screen?.height || 0);
|
|
21
|
+
}
|
|
22
|
+
function getMaxViewportHeight() {
|
|
23
|
+
if (typeof window === "undefined") return 0;
|
|
24
|
+
if (!_maxViewportHeight) {
|
|
25
|
+
updateMaxViewportHeight();
|
|
26
|
+
window.addEventListener("resize", updateMaxViewportHeight);
|
|
27
|
+
window.visualViewport?.addEventListener("resize", updateMaxViewportHeight);
|
|
28
|
+
}
|
|
20
29
|
return _maxViewportHeight;
|
|
21
30
|
}
|
|
31
|
+
function getVisibleViewportHeight() {
|
|
32
|
+
getMaxViewportHeight();
|
|
33
|
+
return _visibleViewportHeight;
|
|
34
|
+
}
|
|
22
35
|
function getWebKeyboardResizeHeight() {
|
|
23
36
|
if (typeof window === "undefined") return 0;
|
|
24
37
|
const vv = window.visualViewport;
|
|
@@ -40,5 +53,5 @@ function getWebKeyboardHeight() {
|
|
|
40
53
|
return getWebKeyboardResizeHeight();
|
|
41
54
|
}
|
|
42
55
|
|
|
43
|
-
export { MIN_KEYBOARD_HEIGHT, getMaxViewportHeight, getStableLayoutViewportHeight, getWebKeyboardBottomInset, getWebKeyboardHeight, getWebKeyboardResizeHeight, getWebVisualViewportOffsetTop, isEditableElement };
|
|
56
|
+
export { MIN_KEYBOARD_HEIGHT, getMaxViewportHeight, getStableLayoutViewportHeight, getVisibleViewportHeight, getWebKeyboardBottomInset, getWebKeyboardHeight, getWebKeyboardResizeHeight, getWebVisualViewportOffsetTop, isEditableElement };
|
|
44
57
|
//# sourceMappingURL=webViewport.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webViewport.js","names":[],"sources":["jsx/webViewport.js"],"sourcesContent":["const MIN_KEYBOARD_HEIGHT = 80;\nfunction isEditableElement(el) {\n if (!el) return false;\n const tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (el.isContentEditable) return true;\n return false;\n}\nfunction getStableLayoutViewportHeight() {\n if (typeof window === \"undefined\") return 0;\n const ch = typeof document !== \"undefined\" ? document.documentElement?.clientHeight : 0;\n if (ch && ch > 0) return ch;\n return Math.max(window.innerHeight || 0, window.visualViewport?.height || 0);\n}\nlet _maxViewportHeight = 0;\nfunction
|
|
1
|
+
{"version":3,"file":"webViewport.js","names":[],"sources":["jsx/webViewport.js"],"sourcesContent":["const MIN_KEYBOARD_HEIGHT = 80;\nfunction isEditableElement(el) {\n if (!el) return false;\n const tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (el.isContentEditable) return true;\n return false;\n}\nfunction getStableLayoutViewportHeight() {\n if (typeof window === \"undefined\") return 0;\n const ch = typeof document !== \"undefined\" ? document.documentElement?.clientHeight : 0;\n if (ch && ch > 0) return ch;\n return Math.max(window.innerHeight || 0, window.visualViewport?.height || 0);\n}\nlet _maxViewportHeight = 0;\nlet _visibleViewportHeight = 0;\nfunction updateMaxViewportHeight() {\n const ch = typeof document !== \"undefined\" ? document.documentElement?.clientHeight : 0;\n _visibleViewportHeight = Math.max(ch || 0, window.innerHeight || 0);\n _maxViewportHeight = Math.max(\n _maxViewportHeight,\n ch || 0,\n window.innerHeight || 0,\n window.visualViewport?.height || 0,\n window.screen?.height || 0\n );\n}\nfunction getMaxViewportHeight() {\n if (typeof window === \"undefined\") return 0;\n if (!_maxViewportHeight) {\n updateMaxViewportHeight();\n window.addEventListener(\"resize\", updateMaxViewportHeight);\n window.visualViewport?.addEventListener(\"resize\", updateMaxViewportHeight);\n }\n return _maxViewportHeight;\n}\nfunction getVisibleViewportHeight() {\n getMaxViewportHeight();\n return _visibleViewportHeight;\n}\nfunction getWebKeyboardResizeHeight() {\n if (typeof window === \"undefined\") return 0;\n const vv = window.visualViewport;\n if (!vv) return 0;\n return Math.max(0, Math.round(getStableLayoutViewportHeight() - vv.height));\n}\nfunction getWebVisualViewportOffsetTop() {\n if (typeof window === \"undefined\") return 0;\n return Math.max(0, Math.round(window.visualViewport?.offsetTop || 0));\n}\nfunction getWebKeyboardBottomInset() {\n if (typeof window === \"undefined\") return 0;\n const vv = window.visualViewport;\n if (!vv) return 0;\n const visibleBottom = getWebVisualViewportOffsetTop() + vv.height;\n return Math.max(0, Math.round(getStableLayoutViewportHeight() - visibleBottom));\n}\nfunction getWebKeyboardHeight() {\n return getWebKeyboardResizeHeight();\n}\nexport {\n MIN_KEYBOARD_HEIGHT,\n getMaxViewportHeight,\n getStableLayoutViewportHeight,\n getVisibleViewportHeight,\n getWebKeyboardBottomInset,\n getWebKeyboardHeight,\n getWebKeyboardResizeHeight,\n getWebVisualViewportOffsetTop,\n isEditableElement\n};\n//# sourceMappingURL=webViewport.js.map\n"],"mappings":";AAAA,MAAM,sBAAsB;AAC5B,SAAS,kBAAkB,IAAI;CAC7B,IAAI,CAAC,IAAI,OAAO;CAChB,MAAM,MAAM,GAAG;CACf,IAAI,QAAQ,WAAW,QAAQ,cAAc,QAAQ,UAAU,OAAO;CACtE,IAAI,GAAG,mBAAmB,OAAO;CACjC,OAAO;AACT;AACA,SAAS,gCAAgC;CACvC,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,MAAM,KAAK,OAAO,aAAa,cAAc,SAAS,iBAAiB,eAAe;CACtF,IAAI,MAAM,KAAK,GAAG,OAAO;CACzB,OAAO,KAAK,IAAI,OAAO,eAAe,GAAG,OAAO,gBAAgB,UAAU,CAAC;AAC7E;AACA,IAAI,qBAAqB;AACzB,IAAI,yBAAyB;AAC7B,SAAS,0BAA0B;CACjC,MAAM,KAAK,OAAO,aAAa,cAAc,SAAS,iBAAiB,eAAe;CACtF,yBAAyB,KAAK,IAAI,MAAM,GAAG,OAAO,eAAe,CAAC;CAClE,qBAAqB,KAAK,IACxB,oBACA,MAAM,GACN,OAAO,eAAe,GACtB,OAAO,gBAAgB,UAAU,GACjC,OAAO,QAAQ,UAAU,CAC3B;AACF;AACA,SAAS,uBAAuB;CAC9B,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,IAAI,CAAC,oBAAoB;EACvB,wBAAwB;EACxB,OAAO,iBAAiB,UAAU,uBAAuB;EACzD,OAAO,gBAAgB,iBAAiB,UAAU,uBAAuB;CAC3E;CACA,OAAO;AACT;AACA,SAAS,2BAA2B;CAClC,qBAAqB;CACrB,OAAO;AACT;AACA,SAAS,6BAA6B;CACpC,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,MAAM,KAAK,OAAO;CAClB,IAAI,CAAC,IAAI,OAAO;CAChB,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,8BAA8B,IAAI,GAAG,MAAM,CAAC;AAC5E;AACA,SAAS,gCAAgC;CACvC,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,gBAAgB,aAAa,CAAC,CAAC;AACtE;AACA,SAAS,4BAA4B;CACnC,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,MAAM,KAAK,OAAO;CAClB,IAAI,CAAC,IAAI,OAAO;CAChB,MAAM,gBAAgB,8BAA8B,IAAI,GAAG;CAC3D,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,8BAA8B,IAAI,aAAa,CAAC;AAChF;AACA,SAAS,uBAAuB;CAC9B,OAAO,2BAA2B;AACpC"}
|
|
@@ -25,6 +25,7 @@ __export(webViewport_exports, {
|
|
|
25
25
|
MIN_KEYBOARD_HEIGHT: () => MIN_KEYBOARD_HEIGHT,
|
|
26
26
|
getMaxViewportHeight: () => getMaxViewportHeight,
|
|
27
27
|
getStableLayoutViewportHeight: () => getStableLayoutViewportHeight,
|
|
28
|
+
getVisibleViewportHeight: () => getVisibleViewportHeight,
|
|
28
29
|
getWebKeyboardBottomInset: () => getWebKeyboardBottomInset,
|
|
29
30
|
getWebKeyboardHeight: () => getWebKeyboardHeight,
|
|
30
31
|
getWebKeyboardResizeHeight: () => getWebKeyboardResizeHeight,
|
|
@@ -48,13 +49,27 @@ function getStableLayoutViewportHeight() {
|
|
|
48
49
|
return Math.max(window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0);
|
|
49
50
|
}
|
|
50
51
|
var _maxViewportHeight = 0;
|
|
51
|
-
|
|
52
|
+
var _visibleViewportHeight = 0;
|
|
53
|
+
function updateMaxViewportHeight() {
|
|
52
54
|
var _document_documentElement, _window_visualViewport, _window_screen;
|
|
53
|
-
if (typeof window === "undefined") return 0;
|
|
54
55
|
var ch = typeof document !== "undefined" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;
|
|
56
|
+
_visibleViewportHeight = Math.max(ch || 0, window.innerHeight || 0);
|
|
55
57
|
_maxViewportHeight = Math.max(_maxViewportHeight, ch || 0, window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0, ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.height) || 0);
|
|
58
|
+
}
|
|
59
|
+
function getMaxViewportHeight() {
|
|
60
|
+
if (typeof window === "undefined") return 0;
|
|
61
|
+
if (!_maxViewportHeight) {
|
|
62
|
+
var _window_visualViewport;
|
|
63
|
+
updateMaxViewportHeight();
|
|
64
|
+
window.addEventListener("resize", updateMaxViewportHeight);
|
|
65
|
+
(_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.addEventListener("resize", updateMaxViewportHeight);
|
|
66
|
+
}
|
|
56
67
|
return _maxViewportHeight;
|
|
57
68
|
}
|
|
69
|
+
function getVisibleViewportHeight() {
|
|
70
|
+
getMaxViewportHeight();
|
|
71
|
+
return _visibleViewportHeight;
|
|
72
|
+
}
|
|
58
73
|
function getWebKeyboardResizeHeight() {
|
|
59
74
|
if (typeof window === "undefined") return 0;
|
|
60
75
|
var vv = window.visualViewport;
|
|
@@ -25,6 +25,7 @@ __export(webViewport_exports, {
|
|
|
25
25
|
MIN_KEYBOARD_HEIGHT: () => MIN_KEYBOARD_HEIGHT,
|
|
26
26
|
getMaxViewportHeight: () => getMaxViewportHeight,
|
|
27
27
|
getStableLayoutViewportHeight: () => getStableLayoutViewportHeight,
|
|
28
|
+
getVisibleViewportHeight: () => getVisibleViewportHeight,
|
|
28
29
|
getWebKeyboardBottomInset: () => getWebKeyboardBottomInset,
|
|
29
30
|
getWebKeyboardHeight: () => getWebKeyboardHeight,
|
|
30
31
|
getWebKeyboardResizeHeight: () => getWebKeyboardResizeHeight,
|
|
@@ -48,13 +49,27 @@ function getStableLayoutViewportHeight() {
|
|
|
48
49
|
return Math.max(window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0);
|
|
49
50
|
}
|
|
50
51
|
var _maxViewportHeight = 0;
|
|
51
|
-
|
|
52
|
+
var _visibleViewportHeight = 0;
|
|
53
|
+
function updateMaxViewportHeight() {
|
|
52
54
|
var _document_documentElement, _window_visualViewport, _window_screen;
|
|
53
|
-
if (typeof window === "undefined") return 0;
|
|
54
55
|
var ch = typeof document !== "undefined" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;
|
|
56
|
+
_visibleViewportHeight = Math.max(ch || 0, window.innerHeight || 0);
|
|
55
57
|
_maxViewportHeight = Math.max(_maxViewportHeight, ch || 0, window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0, ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.height) || 0);
|
|
58
|
+
}
|
|
59
|
+
function getMaxViewportHeight() {
|
|
60
|
+
if (typeof window === "undefined") return 0;
|
|
61
|
+
if (!_maxViewportHeight) {
|
|
62
|
+
var _window_visualViewport;
|
|
63
|
+
updateMaxViewportHeight();
|
|
64
|
+
window.addEventListener("resize", updateMaxViewportHeight);
|
|
65
|
+
(_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.addEventListener("resize", updateMaxViewportHeight);
|
|
66
|
+
}
|
|
56
67
|
return _maxViewportHeight;
|
|
57
68
|
}
|
|
69
|
+
function getVisibleViewportHeight() {
|
|
70
|
+
getMaxViewportHeight();
|
|
71
|
+
return _visibleViewportHeight;
|
|
72
|
+
}
|
|
58
73
|
function getWebKeyboardResizeHeight() {
|
|
59
74
|
if (typeof window === "undefined") return 0;
|
|
60
75
|
var vv = window.visualViewport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webViewport.native.js","names":[],"sources":["jsx/webViewport.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar webViewport_exports = {};\n__export(webViewport_exports, {\n MIN_KEYBOARD_HEIGHT: () => MIN_KEYBOARD_HEIGHT,\n getMaxViewportHeight: () => getMaxViewportHeight,\n getStableLayoutViewportHeight: () => getStableLayoutViewportHeight,\n getWebKeyboardBottomInset: () => getWebKeyboardBottomInset,\n getWebKeyboardHeight: () => getWebKeyboardHeight,\n getWebKeyboardResizeHeight: () => getWebKeyboardResizeHeight,\n getWebVisualViewportOffsetTop: () => getWebVisualViewportOffsetTop,\n isEditableElement: () => isEditableElement\n});\nmodule.exports = __toCommonJS(webViewport_exports);\nvar MIN_KEYBOARD_HEIGHT = 80;\nfunction isEditableElement(el) {\n if (!el) return false;\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (el.isContentEditable) return true;\n return false;\n}\nfunction getStableLayoutViewportHeight() {\n var _document_documentElement, _window_visualViewport;\n if (typeof window === \"undefined\") return 0;\n var ch = typeof document !== \"undefined\" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;\n if (ch && ch > 0) return ch;\n return Math.max(window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0);\n}\nvar _maxViewportHeight = 0;\nfunction
|
|
1
|
+
{"version":3,"file":"webViewport.native.js","names":[],"sources":["jsx/webViewport.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar webViewport_exports = {};\n__export(webViewport_exports, {\n MIN_KEYBOARD_HEIGHT: () => MIN_KEYBOARD_HEIGHT,\n getMaxViewportHeight: () => getMaxViewportHeight,\n getStableLayoutViewportHeight: () => getStableLayoutViewportHeight,\n getVisibleViewportHeight: () => getVisibleViewportHeight,\n getWebKeyboardBottomInset: () => getWebKeyboardBottomInset,\n getWebKeyboardHeight: () => getWebKeyboardHeight,\n getWebKeyboardResizeHeight: () => getWebKeyboardResizeHeight,\n getWebVisualViewportOffsetTop: () => getWebVisualViewportOffsetTop,\n isEditableElement: () => isEditableElement\n});\nmodule.exports = __toCommonJS(webViewport_exports);\nvar MIN_KEYBOARD_HEIGHT = 80;\nfunction isEditableElement(el) {\n if (!el) return false;\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (el.isContentEditable) return true;\n return false;\n}\nfunction getStableLayoutViewportHeight() {\n var _document_documentElement, _window_visualViewport;\n if (typeof window === \"undefined\") return 0;\n var ch = typeof document !== \"undefined\" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;\n if (ch && ch > 0) return ch;\n return Math.max(window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0);\n}\nvar _maxViewportHeight = 0;\nvar _visibleViewportHeight = 0;\nfunction updateMaxViewportHeight() {\n var _document_documentElement, _window_visualViewport, _window_screen;\n var ch = typeof document !== \"undefined\" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;\n _visibleViewportHeight = Math.max(ch || 0, window.innerHeight || 0);\n _maxViewportHeight = Math.max(_maxViewportHeight, ch || 0, window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0, ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.height) || 0);\n}\nfunction getMaxViewportHeight() {\n if (typeof window === \"undefined\") return 0;\n if (!_maxViewportHeight) {\n var _window_visualViewport;\n updateMaxViewportHeight();\n window.addEventListener(\"resize\", updateMaxViewportHeight);\n (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.addEventListener(\"resize\", updateMaxViewportHeight);\n }\n return _maxViewportHeight;\n}\nfunction getVisibleViewportHeight() {\n getMaxViewportHeight();\n return _visibleViewportHeight;\n}\nfunction getWebKeyboardResizeHeight() {\n if (typeof window === \"undefined\") return 0;\n var vv = window.visualViewport;\n if (!vv) return 0;\n return Math.max(0, Math.round(getStableLayoutViewportHeight() - vv.height));\n}\nfunction getWebVisualViewportOffsetTop() {\n var _window_visualViewport;\n if (typeof window === \"undefined\") return 0;\n return Math.max(0, Math.round(((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.offsetTop) || 0));\n}\nfunction getWebKeyboardBottomInset() {\n if (typeof window === \"undefined\") return 0;\n var vv = window.visualViewport;\n if (!vv) return 0;\n var visibleBottom = getWebVisualViewportOffsetTop() + vv.height;\n return Math.max(0, Math.round(getStableLayoutViewportHeight() - visibleBottom));\n}\nfunction getWebKeyboardHeight() {\n return getWebKeyboardResizeHeight();\n}\n//# sourceMappingURL=webViewport.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAA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KAAK,IAAI,GAAG,KAAK,MAAM,8BAA8B,IAAI,aAAa,CAAC;AAChF;AACA,SAAS,uBAAuB;CAC9B,OAAO,2BAA2B;AACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/sheet",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -43,31 +43,31 @@
|
|
|
43
43
|
"clean": "tamagui-build clean"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tamagui/adapt": "3.0
|
|
47
|
-
"@tamagui/animate-presence": "3.0
|
|
48
|
-
"@tamagui/animation-helpers": "3.0
|
|
49
|
-
"@tamagui/animations-react-native": "3.0
|
|
50
|
-
"@tamagui/compose-refs": "3.0
|
|
51
|
-
"@tamagui/constants": "3.0
|
|
52
|
-
"@tamagui/core": "3.0
|
|
53
|
-
"@tamagui/helpers": "3.0
|
|
54
|
-
"@tamagui/native": "3.0
|
|
55
|
-
"@tamagui/portal": "3.0
|
|
56
|
-
"@tamagui/react-native-pan-responder": "3.0
|
|
57
|
-
"@tamagui/react-native-types": "3.0
|
|
58
|
-
"@tamagui/react-native-use-responder-events": "3.0
|
|
59
|
-
"@tamagui/remove-scroll": "3.0
|
|
60
|
-
"@tamagui/scroll-view": "3.0
|
|
61
|
-
"@tamagui/stacks": "3.0
|
|
62
|
-
"@tamagui/use-constant": "3.0
|
|
63
|
-
"@tamagui/use-controllable-state": "3.0
|
|
64
|
-
"@tamagui/use-did-finish-ssr": "3.0
|
|
65
|
-
"@tamagui/z-index-stack": "3.0
|
|
46
|
+
"@tamagui/adapt": "3.1.0",
|
|
47
|
+
"@tamagui/animate-presence": "3.1.0",
|
|
48
|
+
"@tamagui/animation-helpers": "3.1.0",
|
|
49
|
+
"@tamagui/animations-react-native": "3.1.0",
|
|
50
|
+
"@tamagui/compose-refs": "3.1.0",
|
|
51
|
+
"@tamagui/constants": "3.1.0",
|
|
52
|
+
"@tamagui/core": "3.1.0",
|
|
53
|
+
"@tamagui/helpers": "3.1.0",
|
|
54
|
+
"@tamagui/native": "3.1.0",
|
|
55
|
+
"@tamagui/portal": "3.1.0",
|
|
56
|
+
"@tamagui/react-native-pan-responder": "3.1.0",
|
|
57
|
+
"@tamagui/react-native-types": "3.1.0",
|
|
58
|
+
"@tamagui/react-native-use-responder-events": "3.1.0",
|
|
59
|
+
"@tamagui/remove-scroll": "3.1.0",
|
|
60
|
+
"@tamagui/scroll-view": "3.1.0",
|
|
61
|
+
"@tamagui/stacks": "3.1.0",
|
|
62
|
+
"@tamagui/use-constant": "3.1.0",
|
|
63
|
+
"@tamagui/use-controllable-state": "3.1.0",
|
|
64
|
+
"@tamagui/use-did-finish-ssr": "3.1.0",
|
|
65
|
+
"@tamagui/z-index-stack": "3.1.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@tamagui/build": "3.0
|
|
69
|
-
"react": "19.
|
|
70
|
-
"react-native": "0.
|
|
68
|
+
"@tamagui/build": "3.1.0",
|
|
69
|
+
"react": "19.3.0",
|
|
70
|
+
"react-native": "0.88.0",
|
|
71
71
|
"react-native-gesture-handler": "3.3.0",
|
|
72
72
|
"react-native-safe-area-context": "5.10.1"
|
|
73
73
|
},
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"url": "git+https://github.com/tamagui/tamagui.git",
|
|
89
89
|
"directory": "code/ui/sheet"
|
|
90
90
|
},
|
|
91
|
-
"releaseSourceCommit": "
|
|
91
|
+
"releaseSourceCommit": "690ee7d9f451e684f0f197d160c261cdf37dd79f"
|
|
92
92
|
}
|
package/src/Sheet.tsx
CHANGED
|
@@ -109,7 +109,8 @@ const SheetBackgroundFrame = styled(YStack, {
|
|
|
109
109
|
|
|
110
110
|
export const SheetHandle = createStyledHOC(
|
|
111
111
|
SheetHandleFrame,
|
|
112
|
-
({
|
|
112
|
+
(propsIn: SheetScopedProps<{}>, forwardedRef) => {
|
|
113
|
+
const { scope, ...props }: SheetViewProps = propsIn
|
|
113
114
|
const context = useSheetContext(scope)
|
|
114
115
|
const composedRef = useComposedRefs<TamaguiElement>(context.handleRef, forwardedRef)
|
|
115
116
|
const wasDraggingRef = useRef(false)
|
|
@@ -151,8 +152,8 @@ export const SheetHandle = createStyledHOC(
|
|
|
151
152
|
|
|
152
153
|
export const SheetOverlay = createStyledHOC(
|
|
153
154
|
SheetOverlayFrame,
|
|
154
|
-
(propsIn:
|
|
155
|
-
const { scope, ...props } = propsIn
|
|
155
|
+
(propsIn: SheetScopedProps<{}>, ref) => {
|
|
156
|
+
const { scope, ...props }: SheetViewProps = propsIn
|
|
156
157
|
const context = useSheetContext(scope)
|
|
157
158
|
const isInOverlayLayer = useContext(SheetOverlayLayerContext)
|
|
158
159
|
const didWarn = useRef(false)
|
|
@@ -200,15 +201,13 @@ type ExtraContainerProps = {
|
|
|
200
201
|
|
|
201
202
|
export const SheetContainer = createStyledHOC(
|
|
202
203
|
SheetContainerFrame,
|
|
203
|
-
(
|
|
204
|
-
{
|
|
204
|
+
(propsIn: SheetScopedProps<ExtraContainerProps>, forwardedRef) => {
|
|
205
|
+
const {
|
|
205
206
|
scope,
|
|
206
207
|
adjustPaddingForOffscreenContent,
|
|
207
208
|
children,
|
|
208
209
|
...props
|
|
209
|
-
}: SheetViewProps<ExtraContainerProps
|
|
210
|
-
forwardedRef
|
|
211
|
-
) => {
|
|
210
|
+
}: SheetViewProps<ExtraContainerProps> = propsIn
|
|
212
211
|
const context = useSheetContext(scope)
|
|
213
212
|
const { hasFit, frameSize, contentRef, open } = context
|
|
214
213
|
const composedContentRef = useComposedRefs(forwardedRef, contentRef)
|
|
@@ -301,10 +300,12 @@ type ExtraBackgroundProps = {
|
|
|
301
300
|
|
|
302
301
|
export const SheetBackground = createStyledHOC(
|
|
303
302
|
SheetBackgroundFrame,
|
|
304
|
-
(
|
|
305
|
-
{
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
(propsIn: SheetScopedProps<ExtraBackgroundProps>, forwardedRef) => {
|
|
304
|
+
const {
|
|
305
|
+
scope,
|
|
306
|
+
disableHideBottomOverflow,
|
|
307
|
+
...props
|
|
308
|
+
}: SheetViewProps<ExtraBackgroundProps> = propsIn
|
|
308
309
|
const context = useSheetContext(scope)
|
|
309
310
|
if (context.onlyShowContainer) return null
|
|
310
311
|
const bottomOverflow = isWeb
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
getWebKeyboardResizeHeight,
|
|
42
42
|
getMaxViewportHeight,
|
|
43
|
+
getVisibleViewportHeight,
|
|
43
44
|
getWebVisualViewportOffsetTop,
|
|
44
45
|
MIN_KEYBOARD_HEIGHT,
|
|
45
46
|
} from './webViewport'
|
|
@@ -400,6 +401,11 @@ export const SheetImplementationCustom = createRefComponent<View, SheetProps>(
|
|
|
400
401
|
}
|
|
401
402
|
)
|
|
402
403
|
|
|
404
|
+
// true once a close animation has fully completed, until the next move
|
|
405
|
+
// starts. a sheet parked past the viewport (the web high-water close target)
|
|
406
|
+
// can then open from the visible edge; a reversal mid-close never can.
|
|
407
|
+
const isParkedClosedRef = React.useRef(false)
|
|
408
|
+
|
|
403
409
|
const syncAnimatedPosition = useEvent((value: number) => {
|
|
404
410
|
at.current = value
|
|
405
411
|
scrollBridge.paneY = value
|
|
@@ -494,12 +500,14 @@ export const SheetImplementationCustom = createRefComponent<View, SheetProps>(
|
|
|
494
500
|
lastPositionIndexRef.current = -1
|
|
495
501
|
emitTransition('start', event)
|
|
496
502
|
syncAnimatedPosition(toValue)
|
|
503
|
+
isParkedClosedRef.current = true
|
|
497
504
|
setIsFullyClosed(true)
|
|
498
505
|
emitTransition('end', event, true)
|
|
499
506
|
}
|
|
500
507
|
return
|
|
501
508
|
}
|
|
502
509
|
|
|
510
|
+
const from = at.current
|
|
503
511
|
at.current = toValue
|
|
504
512
|
|
|
505
513
|
const cause: SheetTransitionCause = !isOpenAnimation
|
|
@@ -518,6 +526,16 @@ export const SheetImplementationCustom = createRefComponent<View, SheetProps>(
|
|
|
518
526
|
|
|
519
527
|
stopSpring()
|
|
520
528
|
|
|
529
|
+
// web: a fully closed sheet is parked at the high-water close target, past
|
|
530
|
+
// the visible viewport. opening from there spends its first frames
|
|
531
|
+
// travelling out of sight, so start at the visible edge instead.
|
|
532
|
+
const wasParkedClosed = isParkedClosedRef.current
|
|
533
|
+
isParkedClosedRef.current = false
|
|
534
|
+
if (isWeb && isOpenAnimation && wasParkedClosed) {
|
|
535
|
+
const visibleEdge = getVisibleViewportHeight()
|
|
536
|
+
if (from > visibleEdge) animatedNumber.setValue(visibleEdge, { type: 'direct' })
|
|
537
|
+
}
|
|
538
|
+
|
|
521
539
|
const animationCompleteCallback = () => {
|
|
522
540
|
// a newer animateTo supersedes this one: drivers still fire the owed
|
|
523
541
|
// completion callback when a new setValue replaces an in-flight one.
|
|
@@ -534,6 +552,7 @@ export const SheetImplementationCustom = createRefComponent<View, SheetProps>(
|
|
|
534
552
|
// reopened before this callback fires (e.g. cancelled close animation),
|
|
535
553
|
// we must not hide it
|
|
536
554
|
if (!isOpenAnimation && !openRef.current) {
|
|
555
|
+
isParkedClosedRef.current = true
|
|
537
556
|
setIsFullyClosed(true)
|
|
538
557
|
}
|
|
539
558
|
emitTransition('end', event, true)
|