{"version":3,"file":"reuseMatchDevice.cjs","names":["useReactiveRender"],"sources":["../../src/useMatchDevice/reuseMatchDevice.ts"],"sourcesContent":["import { useReactiveRender } from '../api/hooks/utils';\nimport type { DevicesResult } from './types';\n\n/**\n * Reuses a tools `useMatchDevice` reactive state inside React rendering.\n *\n * The tools state is created outside React with `@pastweb/tools/useMatchDevice`.\n * `reuseMatchDevice` keeps that same state object and subscribes React rendering\n * to its reactive fields.\n *\n * @param matchDevice - Reactive `DevicesResult` returned by `@pastweb/tools/useMatchDevice`.\n * @returns The same device result object, connected to React rendering.\n *\n * @example\n * ```tsx\n * import { useMatchDevice as createToolsMatchDevice } from '@pastweb/tools';\n * import { reuseMatchDevice } from '@pastweb/react';\n *\n * const deviceState = createToolsMatchDevice({\n *   phone: { mediaQuery: '(max-width: 640px)' },\n * });\n *\n * function Navigation() {\n *   const { devices } = reuseMatchDevice(deviceState);\n *\n *   return devices.phone ? <MobileNav /> : <DesktopNav />;\n * }\n * ```\n */\nexport function reuseMatchDevice(matchDevice: DevicesResult): DevicesResult {\n  return useReactiveRender(() => matchDevice);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,iBAAiB,aAA2C;CAC1E,OAAOA,0CAAAA,wBAAwB,WAAW;AAC5C"}