UNPKG

hydrogen-sanity

Version:
1 lines 1.7 kB
{"version":3,"file":"index.cjs","sources":["../../src/visual-editing/VisualEditing.tsx"],"sourcesContent":["import type {VisualEditingProps} from '@sanity/visual-editing/remix'\nimport {lazy, type ReactElement, Suspense} from 'react'\n\n/**\n * Provide a consistent fallback to prevent hydration mismatch errors.\n */\nfunction VisualEditingFallback(): ReactElement {\n return <></>\n}\n\n/**\n * If server-side rendering, then return the fallback instead of the heavy dependency.\n * @see https://remix.run/docs/en/1.14.3/guides/constraints#browser-only-code-on-the-server\n */\nconst VisualEditingComponent =\n typeof document === 'undefined'\n ? VisualEditingFallback\n : lazy(\n () =>\n /**\n * `lazy` expects the component as the default export\n * @see https://react.dev/reference/react/lazy\n */\n import('./VisualEditing.client'),\n )\n\nexport function VisualEditing(props: VisualEditingProps): ReactElement {\n return (\n <Suspense>\n <VisualEditingComponent {...props} />\n </Suspense>\n )\n}\n"],"names":["Object","defineProperty","exports","value","jsxRuntime","require","react","createDataAttribute","VisualEditingComponent","document","jsx","Fragment","lazy","Promise","enumerable","get","VisualEditing","props","Suspense","children"],"mappings":"aAMAA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,IAAAC,EAAAC,QAAA,qBAAAC,EAAAD,QAAA,SAAAE,EAAAF,QAAA,gDAQA,MAAMG,SACGC,SAAa,IATtB,WACE,OAASL,EAAAM,IAAAC,EAAAA,SAAA,GACX,EASMC,EAAAA,MACE,IAKEC,kDAAO,0CAAwB,MASzCb,OAAAC,eAAAC,QAAA,sBAAA,CAAAY,YAAA,EAAAC,IAAA,WAAA,OAAAR,EAAAA,mBAAA,IAAAL,QAAAc,cANO,SAAuBC,GAC5B,aACGC,WACC,CAAAC,SAAAT,EAAAA,IAACF,EAAwB,IAAGS,KAGlC"}