@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 1.23 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":["MotionComponent: Context<MotionComponentType>"],"sources":["../../src/MotionProvider/index.tsx"],"sourcesContent":["'use client';\n\nimport type * as m from 'motion/react-m';\nimport { type Context, type ReactNode, createContext, memo, use } from 'react';\n\nexport type MotionComponentType = typeof import('motion/react').motion | typeof m;\n\nexport const MotionComponent: Context<MotionComponentType> = createContext<MotionComponentType>(\n null!,\n);\n\nexport const MotionProvider = memo<{ children: ReactNode; motion: MotionComponentType }>(\n ({ children, motion }) => {\n return <MotionComponent value={motion}>{children}</MotionComponent>;\n },\n);\n\nexport const useMotionComponent = (): MotionComponentType => {\n const context = use(MotionComponent);\n if (!context) {\n throw new Error(\n 'Please wrap your app with <ConfigProvider> (or <MotionProvider>) and pass the motion component',\n );\n }\n return context;\n};\n"],"mappings":";;;;;;AAOA,MAAaA,kBAAgD,cAC3D,KACD;AAED,MAAa,iBAAiB,MAC3B,EAAE,UAAU,aAAa;AACxB,QAAO,oBAAC;EAAgB,OAAO;EAAS;GAA2B;EAEtE;AAED,MAAa,2BAAgD;CAC3D,MAAM,UAAU,IAAI,gBAAgB;AACpC,KAAI,CAAC,QACH,OAAM,IAAI,MACR,iGACD;AAEH,QAAO"}