-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseStyles.js.map
1 lines (1 loc) · 1.72 KB
/
useStyles.js.map
1
{"version":3,"file":"useStyles.js","sources":["src/useStyles.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport { useContext, useEffect } from 'react'\nimport StyleContext from './StyleContext'\n\n// To detect if it's in SSR process or in browser. Wrapping with\n// the function makes rollup's replacement of \"this\" avoidable\n// eslint-disable-next-line func-names\nconst isBrowser = (function() {\n return this && typeof this.window === 'object'\n})()\n\nfunction useStyles(...styles) {\n const { insertCss } = useContext(StyleContext)\n if (!insertCss) throw new Error('Please provide \"insertCss\" function by StyleContext.Provider')\n const runEffect = () => {\n const removeCss = insertCss(...styles)\n return () => {\n setTimeout(removeCss, 0)\n }\n }\n if (isBrowser) {\n useEffect(runEffect, [])\n } else {\n runEffect()\n }\n}\n\nexport default useStyles\n"],"names":["isBrowser","window","useStyles","styles","useContext","StyleContext","insertCss","Error","runEffect","removeCss","setTimeout","useEffect"],"mappings":";;;;;;;AAeA,IAAMA,SAAS,GAAI,YAAW;SACrB,QAAQ,OAAO,KAAKC,MAAZ,KAAuB,QAAtC;CADgB,EAAlB;;AAIA,SAASC,SAAT,GAA8B;oCAARC,MAAQ;IAARA,MAAQ;;;oBACNC,gBAAU,CAACC,YAAD,CADJ;MACpBC,SADoB,eACpBA,SADoB;;MAExB,CAACA,SAAL,EAAgB,MAAM,IAAIC,KAAJ,CAAU,8DAAV,CAAN;;MACVC,SAAS,GAAG,SAAZA,SAAY,GAAM;QAChBC,SAAS,GAAGH,SAAS,MAAT,SAAaH,MAAb,CAAlB;WACO,YAAM;MACXO,UAAU,CAACD,SAAD,EAAY,CAAZ,CAAV;KADF;GAFF;;MAMIT,SAAJ,EAAe;IACbW,eAAS,CAACH,SAAD,EAAY,EAAZ,CAAT;GADF,MAEO;IACLA,SAAS;;;;;;"}