@hanzogui/native 4.3.1 → 7.0.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.
Files changed (59) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/cjs/PressBoundary.cjs +92 -0
  3. package/dist/cjs/PressBoundary.native.js +105 -0
  4. package/dist/cjs/PressBoundary.native.js.map +1 -0
  5. package/dist/cjs/gesture-handler.cjs +36 -0
  6. package/dist/cjs/gesture-handler.native.js +39 -0
  7. package/dist/cjs/gesture-handler.native.js.map +1 -0
  8. package/dist/cjs/gestureState.cjs +94 -5
  9. package/dist/cjs/gestureState.native.js +98 -13
  10. package/dist/cjs/gestureState.native.js.map +1 -1
  11. package/dist/cjs/index.cjs +4 -1
  12. package/dist/cjs/index.native.js +4 -1
  13. package/dist/cjs/index.native.js.map +1 -1
  14. package/dist/cjs/setup-gesture-handler.cjs +44 -8
  15. package/dist/cjs/setup-gesture-handler.native.js +44 -8
  16. package/dist/cjs/setup-gesture-handler.native.js.map +1 -1
  17. package/dist/esm/PressBoundary.mjs +56 -0
  18. package/dist/esm/PressBoundary.mjs.map +1 -0
  19. package/dist/esm/PressBoundary.native.js +66 -0
  20. package/dist/esm/PressBoundary.native.js.map +1 -0
  21. package/dist/esm/gesture-handler.mjs +6 -0
  22. package/dist/esm/gesture-handler.mjs.map +1 -0
  23. package/dist/esm/gesture-handler.native.js +6 -0
  24. package/dist/esm/gesture-handler.native.js.map +1 -0
  25. package/dist/esm/gestureState.mjs +92 -5
  26. package/dist/esm/gestureState.mjs.map +1 -1
  27. package/dist/esm/gestureState.native.js +96 -13
  28. package/dist/esm/gestureState.native.js.map +1 -1
  29. package/dist/esm/index.js +2 -1
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/index.mjs +2 -1
  32. package/dist/esm/index.mjs.map +1 -1
  33. package/dist/esm/index.native.js +2 -1
  34. package/dist/esm/index.native.js.map +1 -1
  35. package/dist/esm/setup-gesture-handler.mjs +17 -8
  36. package/dist/esm/setup-gesture-handler.mjs.map +1 -1
  37. package/dist/esm/setup-gesture-handler.native.js +17 -8
  38. package/dist/esm/setup-gesture-handler.native.js.map +1 -1
  39. package/gesture-handler/index.cjs +1 -0
  40. package/gesture-handler/index.js +1 -0
  41. package/gesture-handler/index.native.cjs +1 -0
  42. package/gesture-handler/index.native.js +1 -0
  43. package/gesture-handler.cjs +1 -0
  44. package/package.json +17 -4
  45. package/src/PressBoundary.tsx +81 -0
  46. package/src/gesture-handler.ts +17 -0
  47. package/src/gestureState.ts +137 -6
  48. package/src/index.ts +12 -1
  49. package/src/setup-gesture-handler.ts +38 -11
  50. package/types/PressBoundary.d.ts +14 -0
  51. package/types/PressBoundary.d.ts.map +11 -0
  52. package/types/gesture-handler.d.ts +8 -0
  53. package/types/gesture-handler.d.ts.map +11 -0
  54. package/types/gestureState.d.ts +4 -0
  55. package/types/gestureState.d.ts.map +2 -2
  56. package/types/index.d.ts +3 -1
  57. package/types/index.d.ts.map +2 -2
  58. package/types/setup-gesture-handler.d.ts +8 -1
  59. package/types/setup-gesture-handler.d.ts.map +2 -2
@@ -0,0 +1,8 @@
1
+ export { getGestureHandler } from "./gestureState";
2
+ export type { ExternalPressOwnershipToken, GestureHandlerAccessor, PressGestureConfig } from "./gestureState";
3
+ export { claimExternalPressOwnership as unstable_claimExternalPressOwnership, releaseExternalPressOwnership as unstable_releaseExternalPressOwnership } from "./gestureState";
4
+ export { PressBoundary } from "./PressBoundary";
5
+ export type { PressBoundaryProps } from "./PressBoundary";
6
+ export { getGestureHandlerConfig, setupGestureHandler, type GestureHandlerConfig } from "./setup-gesture-handler";
7
+
8
+ //# sourceMappingURL=gesture-handler.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,SAAS,yBAAyB;AAClC,cACE,6BACA,wBACA,0BACK;AACP,SACE,+BAA+B,sCAC/B,iCAAiC,8CAC5B;AACP,SAAS,qBAAqB;AAC9B,cAAc,0BAA0B;AACxC,SACE,yBACA,0BACK,4BACA",
3
+ "names": [],
4
+ "sources": [
5
+ "src/gesture-handler.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "export { getGestureHandler } from './gestureState'\nexport type {\n ExternalPressOwnershipToken,\n GestureHandlerAccessor,\n PressGestureConfig,\n} from './gestureState'\nexport {\n claimExternalPressOwnership as unstable_claimExternalPressOwnership,\n releaseExternalPressOwnership as unstable_releaseExternalPressOwnership,\n} from './gestureState'\nexport { PressBoundary } from './PressBoundary'\nexport type { PressBoundaryProps } from './PressBoundary'\nexport {\n getGestureHandlerConfig,\n setupGestureHandler,\n type GestureHandlerConfig,\n} from './setup-gesture-handler'\n"
10
+ ]
11
+ }
@@ -6,6 +6,7 @@ export interface Insets {
6
6
  right?: number;
7
7
  }
8
8
  export type PressGestureConfig = {
9
+ debugName?: string | null;
9
10
  onPressIn?: (e: any) => void;
10
11
  onPressOut?: (e: any) => void;
11
12
  onPress?: (e: any) => void;
@@ -20,6 +21,9 @@ export interface GestureHandlerAccessor {
20
21
  disable(): void;
21
22
  createPressGesture(config: PressGestureConfig): any;
22
23
  }
24
+ export type ExternalPressOwnershipToken = object;
25
+ export declare function claimExternalPressOwnership(debugName?: string | null): ExternalPressOwnershipToken;
26
+ export declare function releaseExternalPressOwnership(token: ExternalPressOwnershipToken | null | undefined, debugName?: string | null): void;
23
27
  export declare function getGestureHandler(): GestureHandlerAccessor;
24
28
 
25
29
  //# sourceMappingURL=gestureState.d.ts.map
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": "AACA,cAAc,oBAAoB;AASlC,iBAAiB,OAAO;CACtB;CACA;CACA;CACA;;AAGF,YAAY,qBAAqB;CAC/B,aAAa;CACb,cAAc;CACd,WAAW;CACX,eAAe;CACf;CACA,mBAAmB;;AAGrB,iBAAiB,uBAAuB;UAC7B;UACA,OAAO;CAChB,IAAI,SAAS,QAAQ;CACrB;CACA,mBAAmB,QAAQ;;AAG7B,OAAO,iBAAS,qBAAqB",
2
+ "mappings": "AACA,cAAc,oBAAoB;AA2BlC,iBAAiB,OAAO;CACtB;CACA;CACA;CACA;;AAGF,YAAY,qBAAqB;CAC/B;CACA,aAAa;CACb,cAAc;CACd,WAAW;CACX,eAAe;CACf;CACA,mBAAmB;;AAGrB,iBAAiB,uBAAuB;UAC7B;UACA,OAAO;CAChB,IAAI,SAAS,QAAQ;CACrB;CACA,mBAAmB,QAAQ;;AAG7B,YAAY;AAeZ,OAAO,iBAAS,4BACd,4BACC;AAiBH,OAAO,iBAAS,8BACd,OAAO,gDACP;AASF,OAAO,iBAAS,qBAAqB",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/gestureState.ts"
6
6
  ],
7
7
  "version": 3,
8
8
  "sourcesContent": [
9
- "import { createGlobalState } from './globalState'\nimport type { GestureState } from './types'\n\nconst state = createGlobalState<GestureState>(`gesture`, {\n enabled: false,\n Gesture: null,\n GestureDetector: null,\n ScrollView: null,\n})\n\nexport interface Insets {\n top?: number\n left?: number\n bottom?: number\n right?: number\n}\n\nexport type PressGestureConfig = {\n onPressIn?: (e: any) => void\n onPressOut?: (e: any) => void\n onPress?: (e: any) => void\n onLongPress?: (e: any) => void\n delayLongPress?: number\n hitSlop?: number | Insets | null\n}\n\nexport interface GestureHandlerAccessor {\n readonly isEnabled: boolean\n readonly state: GestureState\n set(updates: Partial<GestureState>): void\n disable(): void\n createPressGesture(config: PressGestureConfig): any\n}\n\nexport function getGestureHandler(): GestureHandlerAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): GestureState {\n return state.get()\n },\n set(updates: Partial<GestureState>): void {\n Object.assign(state.get(), updates)\n },\n\n disable(): void {\n state.get().enabled = false\n },\n\n createPressGesture(config: PressGestureConfig): any {\n const { Gesture } = state.get()\n if (!Gesture) return null\n\n const longPressDuration = config.delayLongPress ?? 500\n\n // Tap gesture for regular presses\n // Use long maxDuration to not cancel during long presses\n const tap = Gesture.Tap()\n .runOnJS(true)\n .maxDuration(10000) // allow very long presses\n .onBegin((e: any) => {\n config.onPressIn?.(e)\n })\n .onEnd((e: any) => {\n config.onPress?.(e)\n })\n .onFinalize((e: any) => {\n config.onPressOut?.(e)\n })\n\n if (config.hitSlop) tap.hitSlop(config.hitSlop)\n\n // if no long press handler, just use tap\n if (!config.onLongPress) return tap\n\n // LongPress gesture for long press handling\n const longPress = Gesture.LongPress()\n .runOnJS(true)\n .minDuration(longPressDuration)\n .onBegin((e: any) => config.onPressIn?.(e))\n .onStart((e: any) => config.onLongPress?.(e))\n .onFinalize((e: any) => config.onPressOut?.(e))\n\n if (config.hitSlop) longPress.hitSlop(config.hitSlop)\n\n // exclusive: longPress has priority, tap is fallback for quick presses\n return Gesture.Exclusive(longPress, tap)\n },\n }\n}\n"
9
+ "import { createGlobalState } from './globalState'\nimport type { GestureState } from './types'\n\nconst state = createGlobalState<GestureState>(`gesture`, {\n enabled: false,\n Gesture: null,\n GestureDetector: null,\n ScrollView: null,\n})\n\nlet pressGestureDebugId = 0\nlet externalPressDebugId = 0\n\ntype PressOwnerSource = 'internal' | 'external' | null\n\n/**\n * Global press coordination - ensures only innermost pressable fires press events,\n * matching RN Pressable/responder system semantics where deepest component wins.\n * Uses a grace period to allow child gestures to steal ownership from parent,\n * since RNGH fires parent gestures before child gestures.\n */\nconst pressState = {\n owner: null as object | null,\n ownerId: null as number | null,\n ownerSource: null as PressOwnerSource,\n timestamp: 0,\n}\n\nexport interface Insets {\n top?: number\n left?: number\n bottom?: number\n right?: number\n}\n\nexport type PressGestureConfig = {\n debugName?: string | null\n onPressIn?: (e: any) => void\n onPressOut?: (e: any) => void\n onPress?: (e: any) => void\n onLongPress?: (e: any) => void\n delayLongPress?: number\n hitSlop?: number | Insets | null\n}\n\nexport interface GestureHandlerAccessor {\n readonly isEnabled: boolean\n readonly state: GestureState\n set(updates: Partial<GestureState>): void\n disable(): void\n createPressGesture(config: PressGestureConfig): any\n}\n\nexport type ExternalPressOwnershipToken = object\n\nfunction resetPressOwner() {\n pressState.owner = null\n pressState.ownerId = null\n pressState.ownerSource = null\n pressState.timestamp = 0\n}\n\nfunction resetStaleOwner(now: number, debugName?: string | null) {\n if (now - pressState.timestamp > 2000) {\n resetPressOwner()\n }\n}\n\nexport function claimExternalPressOwnership(\n debugName?: string | null\n): ExternalPressOwnershipToken {\n const now = Date.now()\n resetStaleOwner(now, debugName)\n\n const token = {}\n const ownerId = ++externalPressDebugId\n const previousOwnerId = pressState.ownerId\n const previousOwnerSource = pressState.ownerSource\n\n pressState.owner = token\n pressState.ownerId = ownerId\n pressState.ownerSource = 'external'\n pressState.timestamp = now\n\n return token\n}\n\nexport function releaseExternalPressOwnership(\n token: ExternalPressOwnershipToken | null | undefined,\n debugName?: string | null\n): void {\n if (!token || pressState.owner !== token) {\n return\n }\n\n resetPressOwner()\n}\n\nexport function getGestureHandler(): GestureHandlerAccessor {\n return {\n get isEnabled(): boolean {\n return state.get().enabled\n },\n get state(): GestureState {\n return state.get()\n },\n set(updates: Partial<GestureState>): void {\n Object.assign(state.get(), updates)\n },\n\n disable(): void {\n state.get().enabled = false\n },\n\n createPressGesture(config: PressGestureConfig): any {\n const { Gesture } = state.get()\n if (!Gesture) return null\n\n const longPressDuration = config.delayLongPress ?? 500\n\n // unique token for this gesture instance - used to track ownership\n const myToken = {}\n const myDebugId = ++pressGestureDebugId\n\n // Grace period for child gestures to steal ownership from parent.\n // RNGH fires parent before child, but we want innermost to win.\n // Claims typically span a few ms, 24ms gives enough room to observe\n // ordering while debugging slower frames.\n const GRACE_PERIOD_MS = process.env.TAMAGUI_RNGH_PRESS_DELAY\n ? +process.env.TAMAGUI_RNGH_PRESS_DELAY\n : 24\n\n const tryClaimOwnership = () => {\n const now = Date.now()\n resetStaleOwner(now, config.debugName)\n\n // within grace period, last claimer wins (child fires after parent)\n const withinGrace = now - pressState.timestamp < GRACE_PERIOD_MS\n const previousOwnerId = pressState.ownerId\n const previousOwnerSource = pressState.ownerSource\n if (\n pressState.owner === null ||\n (withinGrace && pressState.ownerSource !== 'external')\n ) {\n pressState.owner = myToken\n pressState.ownerId = myDebugId\n pressState.ownerSource = 'internal'\n pressState.timestamp = now\n }\n return pressState.owner === myToken\n }\n\n const isOwner = () => pressState.owner === myToken\n\n const releaseOwnership = () => {\n if (pressState.owner === myToken) {\n resetPressOwner()\n }\n }\n\n // Tap gesture for regular presses\n // Use long maxDuration to not cancel during long presses\n const tap = Gesture.Tap()\n .runOnJS(true)\n .maxDuration(10000) // allow very long presses\n .onBegin((e: any) => {\n tryClaimOwnership()\n // defer onPressIn until after grace period to ensure we're the final owner\n setTimeout(() => {\n if (isOwner()) {\n config.onPressIn?.(e)\n }\n }, GRACE_PERIOD_MS + 1)\n })\n .onEnd((e: any) => {\n if (isOwner()) {\n config.onPress?.(e)\n }\n })\n .onFinalize((e: any) => {\n if (isOwner()) {\n config.onPressOut?.(e)\n releaseOwnership()\n }\n })\n\n if (config.hitSlop) tap.hitSlop(config.hitSlop)\n\n // if no long press handler, just use tap\n if (!config.onLongPress) return tap\n\n // LongPress gesture for long press handling\n const longPress = Gesture.LongPress()\n .runOnJS(true)\n .minDuration(longPressDuration)\n .onBegin((e: any) => {\n tryClaimOwnership()\n setTimeout(() => {\n if (isOwner()) {\n config.onPressIn?.(e)\n }\n }, GRACE_PERIOD_MS + 1)\n })\n .onStart((e: any) => {\n if (isOwner()) {\n config.onLongPress?.(e)\n }\n })\n .onFinalize((e: any) => {\n if (isOwner()) {\n config.onPressOut?.(e)\n releaseOwnership()\n }\n })\n\n if (config.hitSlop) longPress.hitSlop(config.hitSlop)\n\n // exclusive: longPress has priority, tap is fallback for quick presses\n return Gesture.Exclusive(longPress, tap)\n },\n }\n}\n"
10
10
  ]
11
11
  }
package/types/index.d.ts CHANGED
@@ -22,7 +22,9 @@ export type { NativePortalState, GestureState, WorkletsState, SafeAreaState, Saf
22
22
  export { getPortal } from "./portalState";
23
23
  export type { PortalAccessor } from "./portalState";
24
24
  export { getGestureHandler } from "./gestureState";
25
- export type { GestureHandlerAccessor, PressGestureConfig } from "./gestureState";
25
+ export { claimExternalPressOwnership as unstable_claimExternalPressOwnership, releaseExternalPressOwnership as unstable_releaseExternalPressOwnership } from "./gestureState";
26
+ export type { ExternalPressOwnershipToken, GestureHandlerAccessor, PressGestureConfig } from "./gestureState";
27
+ export type { GestureHandlerConfig } from "./setup-gesture-handler";
26
28
  export { getWorklets } from "./workletsState";
27
29
  export type { WorkletsAccessor } from "./workletsState";
28
30
  export { getSafeArea } from "./safeAreaState";
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAsBA,cACE,mBACA,cACA,eACA,eACA,gBACA,eACA,iBACA,qBACA,YACA,YACA,mBACA,uBACA,iCACK;AAGP,SAAS,iBAAiB;AAC1B,cAAc,sBAAsB;AAGpC,SAAS,yBAAyB;AAClC,cAAc,wBAAwB,0BAA0B;AAGhE,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,yBAAyB;AAClC,cAAc,8BAA8B;AAG5C,SACE,6BACA,4BACA,kCACK;AACP,cAAc,+BAA+B;AAG7C,SAAS,gBAAgB;AACzB,cAAc,qBAAqB;AACnC,SAAS,yBAAyB;AAGlC,SAAS,gBAAgB;AACzB,cAAc,qBAAqB;AAGnC,SAAS,cAAc,kBAAkB,4BAA4B",
2
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAsBA,cACE,mBACA,cACA,eACA,eACA,gBACA,eACA,iBACA,qBACA,YACA,YACA,mBACA,uBACA,iCACK;AAGP,SAAS,iBAAiB;AAC1B,cAAc,sBAAsB;AAGpC,SAAS,yBAAyB;AAClC,SACE,+BAA+B,sCAC/B,iCAAiC,8CAC5B;AACP,cACE,6BACA,wBACA,0BACK;AAGP,cAAc,4BAA4B;AAG1C,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,mBAAmB;AAC5B,cAAc,wBAAwB;AAGtC,SAAS,yBAAyB;AAClC,cAAc,8BAA8B;AAG5C,SACE,6BACA,4BACA,kCACK;AACP,cAAc,+BAA+B;AAG7C,SAAS,gBAAgB;AACzB,cAAc,qBAAqB;AACnC,SAAS,yBAAyB;AAGlC,SAAS,gBAAgB;AACzB,cAAc,qBAAqB;AAGnC,SAAS,cAAc,kBAAkB,4BAA4B",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/index.ts"
6
6
  ],
7
7
  "version": 3,
8
8
  "sourcesContent": [
9
- "/**\n * @hanzogui/native\n *\n * Native setup modules for Gui. Import these at the top of your app entry point.\n *\n * @example\n * ```tsx\n * // In your app entry (index.js or App.tsx)\n * import '@hanzogui/native/setup-teleport'\n * import '@hanzogui/native/setup-gesture-handler'\n * import '@hanzogui/native/setup-worklets'\n * import '@hanzogui/native/setup-safe-area'\n * import '@hanzogui/native/expo-linear-gradient'\n * import '@hanzogui/native/setup-keyboard-controller'\n *\n * // Then use GUI components normally\n * // Sheet will automatically use native gestures when available\n * // LinearGradient will use expo-linear-gradient when installed\n * ```\n */\n\n// types\nexport type {\n NativePortalState,\n GestureState,\n WorkletsState,\n SafeAreaState,\n SafeAreaInsets,\n SafeAreaFrame,\n SafeAreaMetrics,\n LinearGradientState,\n ZeegoState,\n BurntState,\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\n\n// portal\nexport { getPortal } from './portalState'\nexport type { PortalAccessor } from './portalState'\n\n// gesture handler\nexport { getGestureHandler } from './gestureState'\nexport type { GestureHandlerAccessor, PressGestureConfig } from './gestureState'\n\n// worklets\nexport { getWorklets } from './workletsState'\nexport type { WorkletsAccessor } from './workletsState'\n\n// safe area\nexport { getSafeArea } from './safeAreaState'\nexport type { SafeAreaAccessor } from './safeAreaState'\n\n// linear gradient\nexport { getLinearGradient } from './linearGradientState'\nexport type { LinearGradientAccessor } from './linearGradientState'\n\n// keyboard controller state exports (safe - no side effects)\nexport {\n isKeyboardControllerEnabled,\n getKeyboardControllerState,\n setKeyboardControllerState,\n} from './keyboardControllerState'\nexport type { KeyboardControllerState } from './keyboardControllerState'\n\n// zeego (native menus)\nexport { getZeego } from './zeegoState'\nexport type { ZeegoAccessor } from './zeegoState'\nexport { NativeMenuContext } from './nativeMenuContext'\n\n// burnt (native toasts)\nexport { getBurnt } from './burntState'\nexport type { BurntAccessor } from './burntState'\n\n// components\nexport { NativePortal, NativePortalHost, NativePortalProvider } from './components'\n"
9
+ "/**\n * @hanzogui/native\n *\n * Native setup modules for Gui. Import these at the top of your app entry point.\n *\n * @example\n * ```tsx\n * // In your app entry (index.js or App.tsx)\n * import '@hanzogui/native/setup-teleport'\n * import '@hanzogui/native/setup-gesture-handler'\n * import '@hanzogui/native/setup-worklets'\n * import '@hanzogui/native/setup-safe-area'\n * import '@hanzogui/native/expo-linear-gradient'\n * import '@hanzogui/native/setup-keyboard-controller'\n *\n * // Then use GUI components normally\n * // Sheet will automatically use native gestures when available\n * // LinearGradient will use expo-linear-gradient when installed\n * ```\n */\n\n// types\nexport type {\n NativePortalState,\n GestureState,\n WorkletsState,\n SafeAreaState,\n SafeAreaInsets,\n SafeAreaFrame,\n SafeAreaMetrics,\n LinearGradientState,\n ZeegoState,\n BurntState,\n NativePortalProps,\n NativePortalHostProps,\n NativePortalProviderProps,\n} from './types'\n\n// portal\nexport { getPortal } from './portalState'\nexport type { PortalAccessor } from './portalState'\n\n// gesture handler\nexport { getGestureHandler } from './gestureState'\nexport {\n claimExternalPressOwnership as unstable_claimExternalPressOwnership,\n releaseExternalPressOwnership as unstable_releaseExternalPressOwnership,\n} from './gestureState'\nexport type {\n ExternalPressOwnershipToken,\n GestureHandlerAccessor,\n PressGestureConfig,\n} from './gestureState'\n// NOTE: setupGestureHandler is exported from setup-gesture-handler.ts entry point,\n// not here, to avoid bundler pulling in RNGH require during tree-shaking\nexport type { GestureHandlerConfig } from './setup-gesture-handler'\n\n// worklets\nexport { getWorklets } from './workletsState'\nexport type { WorkletsAccessor } from './workletsState'\n\n// safe area\nexport { getSafeArea } from './safeAreaState'\nexport type { SafeAreaAccessor } from './safeAreaState'\n\n// linear gradient\nexport { getLinearGradient } from './linearGradientState'\nexport type { LinearGradientAccessor } from './linearGradientState'\n\n// keyboard controller state exports (safe - no side effects)\nexport {\n isKeyboardControllerEnabled,\n getKeyboardControllerState,\n setKeyboardControllerState,\n} from './keyboardControllerState'\nexport type { KeyboardControllerState } from './keyboardControllerState'\n\n// zeego (native menus)\nexport { getZeego } from './zeegoState'\nexport type { ZeegoAccessor } from './zeegoState'\nexport { NativeMenuContext } from './nativeMenuContext'\n\n// burnt (native toasts)\nexport { getBurnt } from './burntState'\nexport type { BurntAccessor } from './burntState'\n\n// components\nexport { NativePortal, NativePortalHost, NativePortalProvider } from './components'\n"
10
10
  ]
11
11
  }
@@ -1,3 +1,10 @@
1
- export {};
1
+ export interface GestureHandlerConfig {
2
+ /** use RNGH for press events on Tamagui components (default: true) */
3
+ pressEvents?: boolean;
4
+ /** use RNGH for Sheet drag gestures (default: true) */
5
+ sheet?: boolean;
6
+ }
7
+ export declare function getGestureHandlerConfig(): GestureHandlerConfig;
8
+ export declare function setupGestureHandler(config?: GestureHandlerConfig): void;
2
9
 
3
10
  //# sourceMappingURL=setup-gesture-handler.d.ts.map
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": "",
2
+ "mappings": "AAqBA,iBAAiB,qBAAqB;;CAEpC;;CAEA;;AAQF,OAAO,iBAAS,2BAA2B;AAI3C,OAAO,iBAAS,oBAAoB,SAAS",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/setup-gesture-handler.ts"
6
6
  ],
7
7
  "version": 3,
8
8
  "sourcesContent": [
9
- "/**\n * Setup gesture handler for GUI native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * import '@hanzogui/native/setup-gesture-handler'\n * ```\n *\n * This automatically detects and configures react-native-gesture-handler\n * for use with Sheet and other gesture-aware components.\n */\n\nimport { getGestureHandler } from './gestureState'\n\nfunction setup() {\n const g = globalThis as any\n if (g.__gui_native_gesture_setup_complete) {\n return\n }\n g.__gui_native_gesture_setup_complete = true\n\n try {\n // dynamically require RNGH - it should already be imported by the app\n const rngh = require('react-native-gesture-handler')\n const { Gesture, GestureDetector, ScrollView } = rngh\n\n if (Gesture && GestureDetector) {\n getGestureHandler().set({\n enabled: true,\n Gesture,\n GestureDetector,\n ScrollView: ScrollView || null,\n })\n\n // also set on the legacy key for backward compat with @hanzogui/sheet\n g.__gui_sheet_gesture_state__ = {\n enabled: true,\n Gesture,\n GestureDetector,\n ScrollView: ScrollView || null,\n }\n }\n } catch {\n // RNGH not available, that's fine\n }\n}\n\n// run setup immediately on import\nsetup()\n"
9
+ "/**\n * Setup gesture handler for Tamagui native components.\n *\n * Simply import this module at the top of your app entry point:\n *\n * @example\n * ```tsx\n * // auto-setup with all features enabled\n * import '@hanzogui/native/setup-gesture-handler'\n *\n * // or configure selectively\n * import { setupGestureHandler } from '@hanzogui/native/setup-gesture-handler'\n * setupGestureHandler({ pressEvents: true, sheet: false })\n * ```\n *\n * This automatically detects and configures react-native-gesture-handler\n * for use with Sheet and other gesture-aware components.\n */\n\nimport { getGestureHandler } from './gestureState'\n\nexport interface GestureHandlerConfig {\n /** use RNGH for press events on Tamagui components (default: true) */\n pressEvents?: boolean\n /** use RNGH for Sheet drag gestures (default: true) */\n sheet?: boolean\n}\n\nlet currentConfig: GestureHandlerConfig = {\n pressEvents: true,\n sheet: true,\n}\n\nexport function getGestureHandlerConfig(): GestureHandlerConfig {\n return currentConfig\n}\n\nexport function setupGestureHandler(config?: GestureHandlerConfig): void {\n const g = globalThis as any\n\n // override config if provided\n if (config) {\n currentConfig = config\n }\n\n // allow re-running setup to change config\n const isFirstRun = !g.__tamagui_native_gesture_setup_complete\n g.__tamagui_native_gesture_setup_complete = true\n\n try {\n // dynamically require RNGH - it should already be imported by the app\n const rngh = require('react-native-gesture-handler')\n const { Gesture, GestureDetector, ScrollView } = rngh\n\n if (Gesture && GestureDetector) {\n // only enable if pressEvents is true\n getGestureHandler().set({\n enabled: currentConfig.pressEvents !== false,\n Gesture,\n GestureDetector,\n ScrollView: ScrollView || null,\n })\n\n // sheet state - only enable if sheet is true\n g.__tamagui_sheet_gesture_state__ = {\n enabled: currentConfig.sheet !== false,\n Gesture,\n GestureDetector,\n ScrollView: ScrollView || null,\n }\n }\n } catch {\n // RNGH not available, that's fine\n }\n}\n\n// run setup immediately on import (can be overridden by calling setupGestureHandler)\nsetupGestureHandler()\n"
10
10
  ]
11
11
  }