@dr.pogodin/react-utils 1.18.6 → 1.19.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.
- package/build/development/client/init.js +4 -0
- package/build/development/client/init.js.map +1 -1
- package/build/development/server/renderer.js +1 -0
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +5 -0
- package/build/development/server/server.js.map +1 -1
- package/build/development/shared/components/Input/index.js +16 -16
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +3 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/style.css +15 -13
- package/build/development/web.bundle.js +1 -1
- package/build/production/client/init.js +2 -2
- package/build/production/client/init.js.map +1 -1
- package/build/production/server/renderer.js +1 -1
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +2 -2
- package/build/production/server/server.js.map +1 -1
- package/build/production/shared/components/Input/index.js +4 -4
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +2 -2
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/style.css +1 -1
- package/build/production/style.css.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/package.json +10 -8
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
// renderer is imported directly.
|
|
85
85
|
if(ops.logger===undefined){ops.logger=newDefaultLogger({defaultLogLevel:ops.defaultLoggerLogLevel})}const buildInfo=ops.buildInfo||getBuildInfo(webpackConfig.context);global.TRU_BUILD_INFO=buildInfo;// publicPath from webpack.output has a trailing slash at the end.
|
|
86
86
|
const{publicPath,path:outputPath}=webpackConfig.output;const manifestLink=_fs.default.existsSync(`${outputPath}/manifest.json`)?`<link rel="manifest" href="${publicPath}manifest.json">`:"";const cache=ops.staticCacheController?new _Cache.default(ops.staticCacheSize):null;const CHUNK_GROUPS=readChunkGroupsJson(outputPath);return async(req,res,next)=>{try{// Ensures any caches always revalidate HTML markup before reuse.
|
|
87
|
-
res.set("Cache-Control","no-cache");let cacheRef;if(cache){cacheRef=ops.staticCacheController(req);if(cacheRef){const data=cache.get(cacheRef);if(data!==null){const{buffer,status}=data;if(ops.noCsp&&isBrotliAcceptable(req)){res.set("Content-Type","text/html");res.set("Content-Encoding","br");if(status!==200)res.status(status);res.send(buffer)}else{await new Promise((done,failed)=>{(0,_zlib.brotliDecompress)(buffer,(error,html)=>{if(error)failed(error);else{let h=html.toString();if(!ops.noCsp){// TODO: Starting from Node v15 we'll be able to use string's
|
|
87
|
+
res.set("Cache-Control","no-cache");res.cookie("csrfToken",req.csrfToken());let cacheRef;if(cache){cacheRef=ops.staticCacheController(req);if(cacheRef){const data=cache.get(cacheRef);if(data!==null){const{buffer,status}=data;if(ops.noCsp&&isBrotliAcceptable(req)){res.set("Content-Type","text/html");res.set("Content-Encoding","br");if(status!==200)res.status(status);res.send(buffer)}else{await new Promise((done,failed)=>{(0,_zlib.brotliDecompress)(buffer,(error,html)=>{if(error)failed(error);else{let h=html.toString();if(!ops.noCsp){// TODO: Starting from Node v15 we'll be able to use string's
|
|
88
88
|
// .replaceAll() method instead relying on reg. expression for
|
|
89
89
|
// global matching.
|
|
90
90
|
const regex=new RegExp(buffer.nonce,"g");h=h.replace(regex,req.nonce)}if(status!==200)res.status(status);res.send(h);done()}})})}return}}}const[{configToInject,extraScripts,initialState},{cipher,iv}]=await Promise.all([ops.beforeRender(req,sanitizedConfig),prepareCipher(buildInfo.key)]);let helmet;/* Optional server-side rendering. */let App=ops.Application;const ssrContext={req,state:(0,_lodash.cloneDeep)(initialState||{}),// Array of chunk names encountered during the rendering.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","names":["sanitizedConfig","omit","config","SCRIPT_LOCATIONS","BODY_OPEN","DEFAULT","HEAD_OPEN","getBuildInfo","context","url","path","resolve","JSON","parse","fs","readFileSync","readChunkGroupsJson","buildDir","res","err","prepareCipher","key","Promise","reject","forge","random","getBytes","iv","cipher","createCipher","start","isBrotliAcceptable","req","acceptable","get","ops","split","i","length","type","priority","trim","parseFloat","groupExtraScripts","scripts","script","isString","code","location","undefined","Error","newDefaultLogger","defaultLogLevel","format","transports","winston","createLogger","level","combine","splat","timestamp","colorize","printf","message","stack","rest","Object","keys","stringify","Console","factory","webpackConfig","options","defaults","clone","beforeRender","maxSsrRounds","ssrTimeout","staticCacheSize","logger","defaultLoggerLogLevel","buildInfo","global","TRU_BUILD_INFO","publicPath","outputPath","output","manifestLink","existsSync","cache","staticCacheController","Cache","CHUNK_GROUPS","next","set","cacheRef","data","buffer","status","noCsp","send","done","failed","brotliDecompress","error","html","h","toString","regex","RegExp","nonce","replace","configToInject","extraScripts","initialState","all","helmet","App","Application","ssrContext","state","cloneDeep","chunks","stream","ssrStart","Date","now","renderPass","pipeableStream","renderToPipeableStream","onAllReady","onError","ssrRound","bailed","dirty","timeout","race","allSettled","pending","timer","then","logMsg","log","pipe","Writable","write","chunk","_","Helmet","renderStatic","chunkGroups","webpackStats","locals","mapValues","toJson","namedChunkGroups","item","assets","map","name","dr_pogodin_react_utils___split_components","payload","serializeJs","CONFIG","ISTATE","ignoreFunction","unsafe","update","util","createBuffer","finish","INJ","encode64","chunkSet","Set","forEach","asset","add","styleChunkString","scriptChunkString","endsWith","grouppedExtraScripts","faviconLink","favicon","title","meta","brotliCompress"],"sources":["../../../src/server/renderer.jsx"],"sourcesContent":["/**\n * ExpressJS middleware for server-side rendering of a ReactJS app.\n */\n\nimport { Writable } from 'stream';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport {\n clone,\n cloneDeep,\n defaults,\n isString,\n get,\n mapValues,\n omit,\n} from 'lodash';\n\nimport config from 'config';\nimport forge from 'node-forge';\nimport fs from 'fs';\nimport path from 'path';\nimport { brotliCompress, brotliDecompress } from 'zlib';\n\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { Helmet } from 'react-helmet';\nimport { StaticRouter } from 'react-router-dom/server';\nimport serializeJs from 'serialize-javascript';\nimport { timer } from 'utils/time';\nimport winston from 'winston';\n\nimport Cache from './Cache';\n\nconst sanitizedConfig = omit(config, 'SECRET');\n\nexport const SCRIPT_LOCATIONS = {\n BODY_OPEN: 'BODY_OPEN',\n DEFAULT: 'DEFAULT',\n HEAD_OPEN: 'HEAD_OPEN',\n};\n\n/**\n * Reads build-time information about the app. This information is generated\n * by our standard Webpack config for apps, and it is written into\n * \".build-info\" file in the context folder specified in Webpack config.\n * At the moment, that file contains build timestamp and a random 32-bit key,\n * suitable for cryptographical use.\n * @ignore\n * @param {String} context Webpack context path used during the build.\n * @return {Object} Resolves to the build-time information.\n */\nfunction getBuildInfo(context) {\n const url = path.resolve(context, '.build-info');\n return JSON.parse(fs.readFileSync(url));\n}\n\n/**\n * Attempts to read from disk the named chunk groups mapping generated\n * by Webpack during the compilation.\n * It will not work for development builds, where these stats should be captured\n * via compilator callback.\n * @ignore\n * @param {string} buildDir\n * @return {object}\n */\nfunction readChunkGroupsJson(buildDir) {\n const url = path.resolve(buildDir, '__chunk_groups__.json');\n let res;\n try {\n res = JSON.parse(fs.readFileSync(url));\n } catch (err) {\n res = null;\n }\n return res;\n}\n\n/**\n * Prepares a new Cipher for data encryption.\n * @ignore\n * @param {String} key Encryption key (32-bit random key is expected, see\n * node-forge documentation, in case of doubts).\n * @return {Promise} Resolves to the object with two fields:\n * 1. cipher - a new Cipher, ready for encryption;\n * 2. iv - initial vector used by the cipher.\n */\nfunction prepareCipher(key) {\n return new Promise((resolve, reject) => {\n forge.random.getBytes(32, (err, iv) => {\n if (err) reject(err);\n else {\n const cipher = forge.cipher.createCipher('AES-CBC', key);\n cipher.start({ iv });\n resolve({ cipher, iv });\n }\n });\n });\n}\n\n/**\n * Given an incoming HTTP requests, it deduces whether Brotli-encoded responses\n * are acceptable to the caller.\n * @param {object} req\n * @return {boolean}\n * @ignore\n */\nexport function isBrotliAcceptable(req) {\n const acceptable = req.get('accept-encoding');\n if (acceptable) {\n const ops = acceptable.split(',');\n for (let i = 0; i < ops.length; ++i) {\n const [type, priority] = ops[i].trim().split(';q=');\n if ((type === '*' || type === 'br')\n && (!priority || parseFloat(priority) > 0)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Given an array of extra script strings / objects, it returns an object with\n * arrays of scripts to inject in different HTML template locations. During\n * the script groupping it also filters out any empty scripts.\n * @param {({\n * code: string;\n * location: string;\n * }|string)[]} [scripts=[]]\n * @return {{\n * BODY_OPEN: string[];\n * DEFAULT: string[];\n * HEAD_OPEN: string[];\n * }}\n */\nfunction groupExtraScripts(scripts = []) {\n const res = {\n [SCRIPT_LOCATIONS.BODY_OPEN]: '',\n [SCRIPT_LOCATIONS.DEFAULT]: '',\n [SCRIPT_LOCATIONS.HEAD_OPEN]: '',\n };\n for (let i = 0; i < scripts.length; ++i) {\n const script = scripts[i];\n if (isString(script)) {\n if (script) res[SCRIPT_LOCATIONS.DEFAULT] += script;\n } else if (script.code) {\n if (res[script.location] !== undefined) {\n res[script.location] += script.code;\n } else throw Error(`Invalid location \"${script.location}\"`);\n }\n }\n return res;\n}\n\n/**\n * Creates a new default (Winston) logger.\n * @param {object} [options={}]\n * @param {string} [options.defaultLogLevel='info']\n * @return {object}\n */\nexport function newDefaultLogger({\n defaultLogLevel = 'info',\n} = {}) {\n const { format, transports } = winston;\n return winston.createLogger({\n level: defaultLogLevel,\n format: format.combine(\n format.splat(),\n format.timestamp(),\n format.colorize(),\n format.printf(\n ({\n level,\n message,\n timestamp,\n stack,\n ...rest\n }) => {\n let res = `${level}\\t(at ${timestamp}):\\t${message}`;\n if (Object.keys(rest).length) {\n res += `\\n${JSON.stringify(rest, null, 2)}`;\n }\n if (stack) res += `\\n${stack}`;\n return res;\n },\n ),\n ),\n transports: [new transports.Console()],\n });\n}\n\n/**\n * Creates the middleware.\n * @param {object} webpackConfig\n * @param {object} options Additional options:\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {object} [options.buildInfo] \"Build info\" object to use. If provided,\n * it will be used, instead of trying to load from the filesystem the one\n * generated by the Webpack build. It is intended for test environments,\n * where passing this stuff via file system is no bueno.\n * @param {boolean} [options.favicon] `true` will include favicon\n * link into the rendered HTML templates.\n * @param {boolean} [options.noCsp] `true` means that no\n * Content-Security-Policy (CSP) is used by server, thus the renderer\n * may cut a few corners.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` – the cache key for the response;\n * - `maxage?: number` – the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @return {function} Created middleware.\n */\nexport default function factory(webpackConfig, options) {\n const ops = defaults(clone(options), {\n beforeRender: () => Promise.resolve({}),\n maxSsrRounds: 10,\n ssrTimeout: 1000,\n staticCacheSize: 1.e7,\n });\n\n // Note: in normal use the default logger is created and set in the root\n // server function, and this initialization is for testing uses, where\n // renderer is imported directly.\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n const buildInfo = ops.buildInfo || getBuildInfo(webpackConfig.context);\n global.TRU_BUILD_INFO = buildInfo;\n\n // publicPath from webpack.output has a trailing slash at the end.\n const { publicPath, path: outputPath } = webpackConfig.output;\n\n const manifestLink = fs.existsSync(`${outputPath}/manifest.json`)\n ? `<link rel=\"manifest\" href=\"${publicPath}manifest.json\">` : '';\n\n const cache = ops.staticCacheController\n ? new Cache(ops.staticCacheSize) : null;\n\n const CHUNK_GROUPS = readChunkGroupsJson(outputPath);\n\n return async (req, res, next) => {\n try {\n // Ensures any caches always revalidate HTML markup before reuse.\n res.set('Cache-Control', 'no-cache');\n\n let cacheRef;\n if (cache) {\n cacheRef = ops.staticCacheController(req);\n if (cacheRef) {\n const data = cache.get(cacheRef);\n if (data !== null) {\n const { buffer, status } = data;\n if (ops.noCsp && isBrotliAcceptable(req)) {\n res.set('Content-Type', 'text/html');\n res.set('Content-Encoding', 'br');\n if (status !== 200) res.status(status);\n res.send(buffer);\n } else {\n await new Promise((done, failed) => {\n brotliDecompress(buffer, (error, html) => {\n if (error) failed(error);\n else {\n let h = html.toString();\n if (!ops.noCsp) {\n // TODO: Starting from Node v15 we'll be able to use string's\n // .replaceAll() method instead relying on reg. expression for\n // global matching.\n const regex = new RegExp(buffer.nonce, 'g');\n h = h.replace(regex, req.nonce);\n }\n if (status !== 200) res.status(status);\n res.send(h);\n done();\n }\n });\n });\n }\n return;\n }\n }\n }\n\n const [{\n configToInject,\n extraScripts,\n initialState,\n }, {\n cipher,\n iv,\n }] = await Promise.all([\n ops.beforeRender(req, sanitizedConfig),\n prepareCipher(buildInfo.key),\n ]);\n\n let helmet;\n\n /* Optional server-side rendering. */\n let App = ops.Application;\n const ssrContext = {\n req,\n state: cloneDeep(initialState || {}),\n\n // Array of chunk names encountered during the rendering.\n chunks: [],\n };\n let stream;\n if (App) {\n const ssrStart = Date.now();\n\n const renderPass = async () => {\n ssrContext.chunks = [];\n return new Promise((resolve, reject) => {\n const pipeableStream = renderToPipeableStream(\n <GlobalStateProvider\n initialState={ssrContext.state}\n ssrContext={ssrContext}\n >\n <StaticRouter location={req.url}>\n <App />\n </StaticRouter>\n </GlobalStateProvider>,\n {\n onAllReady: () => resolve(pipeableStream),\n onError: reject,\n },\n );\n });\n };\n\n let ssrRound = 0;\n let bailed = false;\n for (; ssrRound < ops.maxSsrRounds; ++ssrRound) {\n stream = await renderPass(); // eslint-disable-line no-await-in-loop\n\n if (!ssrContext.dirty) break;\n\n /* eslint-disable no-await-in-loop */\n const timeout = ops.ssrTimeout + ssrStart - Date.now();\n bailed = timeout <= 0 || !await Promise.race([\n Promise.allSettled(ssrContext.pending),\n timer(timeout).then(() => false),\n ]);\n if (bailed) break;\n /* eslint-enable no-await-in-loop */\n }\n\n let logMsg;\n if (ssrContext.dirty) {\n // NOTE: In the case of incomplete SSR one more round is necessary\n // to ensure the correct hydration when some pending promises have\n // resolved and placed their data into the initial global state.\n stream = await renderPass();\n\n logMsg = bailed ? `SSR timed out after ${ops.ssrTimeout} second(s)`\n : `SSR bailed out after ${ops.maxSsrRounds} round(s)`;\n } else logMsg = `SSR completed in ${ssrRound + 1} round(s)`;\n\n ops.logger.log(ssrContext.dirty ? 'warn' : 'info', logMsg);\n\n App = '';\n stream.pipe(new Writable({\n write: (chunk, _, done) => {\n App += chunk.toString();\n done();\n },\n }));\n\n /* This takes care about server-side rendering of page title and meta tags\n * (still demands injection into HTML template, which happens below). */\n helmet = Helmet.renderStatic();\n }\n\n let chunkGroups;\n const webpackStats = get(res.locals, 'webpack.devMiddleware.stats');\n if (webpackStats) {\n chunkGroups = mapValues(\n webpackStats.toJson({\n all: false,\n chunkGroups: true,\n }).namedChunkGroups,\n (item) => item.assets.map(({ name }) => name),\n );\n } else if (CHUNK_GROUPS) chunkGroups = CHUNK_GROUPS;\n else chunkGroups = {};\n\n /* Encrypts data to be injected into HTML.\n * Keep in mind, that this encryption is no way secure: as the JS bundle\n * contains decryption key and is able to decode it at the client side.\n * Hovewer, for a number of reasons, encryption of injected data is still\n * better than injection of a plain text. */\n delete ssrContext.state.dr_pogodin_react_utils___split_components;\n\n const payload = serializeJs({\n CHUNK_GROUPS: chunkGroups,\n CONFIG: configToInject || sanitizedConfig,\n ISTATE: ssrContext.state,\n }, {\n ignoreFunction: true,\n unsafe: true,\n });\n cipher.update(forge.util.createBuffer(payload, 'utf8'));\n cipher.finish();\n const INJ = forge.util.encode64(`${iv}${cipher.output.data}`);\n\n const chunkSet = new Set();\n\n // TODO: \"main\" chunk has to be added explicitly,\n // because unlike all other chunks they are not managed by <CodeSplit>\n // component, thus they are not added to the ssrContext.chunks\n // automatically. Actually, names of these entry chunks should be\n // read from Wepback config, as the end user may customize them,\n // remove or add other entry points, but it requires additional\n // efforts to figure out how to automatically order them right,\n // thus for now this handles the default config.\n [\n 'main',\n ...ssrContext.chunks,\n ].forEach((chunk) => {\n const assets = chunkGroups[chunk];\n if (assets) assets.forEach((asset) => chunkSet.add(asset));\n });\n\n let styleChunkString = '';\n let scriptChunkString = '';\n chunkSet.forEach((chunk) => {\n if (chunk.endsWith('.css')) {\n styleChunkString += `<link href=\"${publicPath}${chunk}\" rel=\"stylesheet\">`;\n } else if (\n chunk.endsWith('.js')\n // In dev mode HMR adds JS updates into asset arrays,\n // and they (updates) should be ignored.\n && !chunk.endsWith('.hot-update.js')\n ) {\n scriptChunkString += `<script src=\"${publicPath}${chunk}\" type=\"application/javascript\"></script>`;\n }\n });\n\n const grouppedExtraScripts = groupExtraScripts(extraScripts);\n\n const faviconLink = ops.favicon ? (\n '<link rel=\"shortcut icon\" href=\"/favicon.ico\">'\n ) : '';\n\n const html = `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.HEAD_OPEN]}\n ${helmet ? helmet.title.toString() : ''}\n ${helmet ? helmet.meta.toString() : ''}\n <meta name=\"theme-color\" content=\"#FFFFFF\">\n ${manifestLink}\n ${styleChunkString}\n ${faviconLink}\n <meta charset=\"utf-8\">\n <meta\n content=\"width=device-width,initial-scale=1.0\"\n name=\"viewport\"\n >\n </head>\n <body>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.BODY_OPEN]}\n <div id=\"react-view\">${App || ''}</div>\n <script\n id=\"inj\"\n type=\"application/javascript\"\n ${ops.noCsp ? '' : `nonce=\"${req.nonce}\"`}\n >\n window.INJ=\"${INJ}\"\n </script>\n ${scriptChunkString}\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.DEFAULT]}\n </body>\n </html>`;\n\n const status = ssrContext.status || 200;\n if (status !== 200) res.status(status);\n\n if (cacheRef && status < 500) {\n // Note: waiting for the caching to complete is not strictly necessary,\n // but it greately simplifies testing, and error reporting.\n await new Promise((done, failed) => {\n brotliCompress(html, (error, buffer) => {\n if (error) failed(error);\n else {\n buffer.nonce = req.nonce; // eslint-disable-line no-param-reassign\n cache.add({ buffer, status }, cacheRef.key);\n done();\n }\n });\n });\n }\n\n // Note: as caching code above may throw in some cases, sending response\n // before it completes will likely hide the error, making it difficult\n // to debug. Thus, at least for now, lets send response after it.\n res.send(html);\n } catch (error) {\n next(error);\n }\n };\n}\n"],"mappings":"ySAIA,8BAEA,gEAEA,8BAUA,sDACA,6DACA,8CACA,kDACA,0BAEA,wCACA,yCACA,gDACA,iFACA,0CACA,wDAEA,sD,6CA/BA;AACA;AACA,GA+BA,KAAMA,gBAAe,CAAG,GAAAC,YAAA,EAAKC,eAAL,CAAa,QAAb,CAAxB,CAEO,KAAMC,iBAAgB,CAAG,CAC9BC,SAAS,CAAE,WADmB,CAE9BC,OAAO,CAAE,SAFqB,CAG9BC,SAAS,CAAE,WAHmB,CAAzB,CAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G,0CACA,QAASC,aAAT,CAAsBC,OAAtB,CAA+B,CAC7B,KAAMC,IAAG,CAAGC,aAAA,CAAKC,OAAL,CAAaH,OAAb,CAAsB,aAAtB,CAAZ,CACA,MAAOI,KAAI,CAACC,KAAL,CAAWC,WAAA,CAAGC,YAAH,CAAgBN,GAAhB,CAAX,CACR,CAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAASO,oBAAT,CAA6BC,QAA7B,CAAuC,CACrC,KAAMR,IAAG,CAAGC,aAAA,CAAKC,OAAL,CAAaM,QAAb,CAAuB,uBAAvB,CAAZ,CACA,GAAIC,IAAJ,CACA,GAAI,CACFA,GAAG,CAAGN,IAAI,CAACC,KAAL,CAAWC,WAAA,CAAGC,YAAH,CAAgBN,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E,KAAnB,CAA0B;AAC1BrB,KAAK,CAACwF,GAAN,CAAU,CAAEhF,MAAF,CAAUC,MAAV,CAAV,CAA8BH,QAAQ,CAAC1E,GAAvC,EACAgF,IAAI,EACL,CACF,CAPD,CAQD,CATK,CAUP,CAED;AACA;AACA;AACAnF,GAAG,CAACkF,IAAJ,CAASK,IAAT,CACD,CAAC,MAAOD,KAAP,CAAc,CACdX,IAAI,CAACW,KAAD,CACL,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"renderer.js","names":["sanitizedConfig","omit","config","SCRIPT_LOCATIONS","BODY_OPEN","DEFAULT","HEAD_OPEN","getBuildInfo","context","url","path","resolve","JSON","parse","fs","readFileSync","readChunkGroupsJson","buildDir","res","err","prepareCipher","key","Promise","reject","forge","random","getBytes","iv","cipher","createCipher","start","isBrotliAcceptable","req","acceptable","get","ops","split","i","length","type","priority","trim","parseFloat","groupExtraScripts","scripts","script","isString","code","location","undefined","Error","newDefaultLogger","defaultLogLevel","format","transports","winston","createLogger","level","combine","splat","timestamp","colorize","printf","message","stack","rest","Object","keys","stringify","Console","factory","webpackConfig","options","defaults","clone","beforeRender","maxSsrRounds","ssrTimeout","staticCacheSize","logger","defaultLoggerLogLevel","buildInfo","global","TRU_BUILD_INFO","publicPath","outputPath","output","manifestLink","existsSync","cache","staticCacheController","Cache","CHUNK_GROUPS","next","set","cookie","csrfToken","cacheRef","data","buffer","status","noCsp","send","done","failed","brotliDecompress","error","html","h","toString","regex","RegExp","nonce","replace","configToInject","extraScripts","initialState","all","helmet","App","Application","ssrContext","state","cloneDeep","chunks","stream","ssrStart","Date","now","renderPass","pipeableStream","renderToPipeableStream","onAllReady","onError","ssrRound","bailed","dirty","timeout","race","allSettled","pending","timer","then","logMsg","log","pipe","Writable","write","chunk","_","Helmet","renderStatic","chunkGroups","webpackStats","locals","mapValues","toJson","namedChunkGroups","item","assets","map","name","dr_pogodin_react_utils___split_components","payload","serializeJs","CONFIG","ISTATE","ignoreFunction","unsafe","update","util","createBuffer","finish","INJ","encode64","chunkSet","Set","forEach","asset","add","styleChunkString","scriptChunkString","endsWith","grouppedExtraScripts","faviconLink","favicon","title","meta","brotliCompress"],"sources":["../../../src/server/renderer.jsx"],"sourcesContent":["/**\n * ExpressJS middleware for server-side rendering of a ReactJS app.\n */\n\nimport { Writable } from 'stream';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport {\n clone,\n cloneDeep,\n defaults,\n isString,\n get,\n mapValues,\n omit,\n} from 'lodash';\n\nimport config from 'config';\nimport forge from 'node-forge';\nimport fs from 'fs';\nimport path from 'path';\nimport { brotliCompress, brotliDecompress } from 'zlib';\n\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { Helmet } from 'react-helmet';\nimport { StaticRouter } from 'react-router-dom/server';\nimport serializeJs from 'serialize-javascript';\nimport { timer } from 'utils/time';\nimport winston from 'winston';\n\nimport Cache from './Cache';\n\nconst sanitizedConfig = omit(config, 'SECRET');\n\nexport const SCRIPT_LOCATIONS = {\n BODY_OPEN: 'BODY_OPEN',\n DEFAULT: 'DEFAULT',\n HEAD_OPEN: 'HEAD_OPEN',\n};\n\n/**\n * Reads build-time information about the app. This information is generated\n * by our standard Webpack config for apps, and it is written into\n * \".build-info\" file in the context folder specified in Webpack config.\n * At the moment, that file contains build timestamp and a random 32-bit key,\n * suitable for cryptographical use.\n * @ignore\n * @param {String} context Webpack context path used during the build.\n * @return {Object} Resolves to the build-time information.\n */\nfunction getBuildInfo(context) {\n const url = path.resolve(context, '.build-info');\n return JSON.parse(fs.readFileSync(url));\n}\n\n/**\n * Attempts to read from disk the named chunk groups mapping generated\n * by Webpack during the compilation.\n * It will not work for development builds, where these stats should be captured\n * via compilator callback.\n * @ignore\n * @param {string} buildDir\n * @return {object}\n */\nfunction readChunkGroupsJson(buildDir) {\n const url = path.resolve(buildDir, '__chunk_groups__.json');\n let res;\n try {\n res = JSON.parse(fs.readFileSync(url));\n } catch (err) {\n res = null;\n }\n return res;\n}\n\n/**\n * Prepares a new Cipher for data encryption.\n * @ignore\n * @param {String} key Encryption key (32-bit random key is expected, see\n * node-forge documentation, in case of doubts).\n * @return {Promise} Resolves to the object with two fields:\n * 1. cipher - a new Cipher, ready for encryption;\n * 2. iv - initial vector used by the cipher.\n */\nfunction prepareCipher(key) {\n return new Promise((resolve, reject) => {\n forge.random.getBytes(32, (err, iv) => {\n if (err) reject(err);\n else {\n const cipher = forge.cipher.createCipher('AES-CBC', key);\n cipher.start({ iv });\n resolve({ cipher, iv });\n }\n });\n });\n}\n\n/**\n * Given an incoming HTTP requests, it deduces whether Brotli-encoded responses\n * are acceptable to the caller.\n * @param {object} req\n * @return {boolean}\n * @ignore\n */\nexport function isBrotliAcceptable(req) {\n const acceptable = req.get('accept-encoding');\n if (acceptable) {\n const ops = acceptable.split(',');\n for (let i = 0; i < ops.length; ++i) {\n const [type, priority] = ops[i].trim().split(';q=');\n if ((type === '*' || type === 'br')\n && (!priority || parseFloat(priority) > 0)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Given an array of extra script strings / objects, it returns an object with\n * arrays of scripts to inject in different HTML template locations. During\n * the script groupping it also filters out any empty scripts.\n * @param {({\n * code: string;\n * location: string;\n * }|string)[]} [scripts=[]]\n * @return {{\n * BODY_OPEN: string[];\n * DEFAULT: string[];\n * HEAD_OPEN: string[];\n * }}\n */\nfunction groupExtraScripts(scripts = []) {\n const res = {\n [SCRIPT_LOCATIONS.BODY_OPEN]: '',\n [SCRIPT_LOCATIONS.DEFAULT]: '',\n [SCRIPT_LOCATIONS.HEAD_OPEN]: '',\n };\n for (let i = 0; i < scripts.length; ++i) {\n const script = scripts[i];\n if (isString(script)) {\n if (script) res[SCRIPT_LOCATIONS.DEFAULT] += script;\n } else if (script.code) {\n if (res[script.location] !== undefined) {\n res[script.location] += script.code;\n } else throw Error(`Invalid location \"${script.location}\"`);\n }\n }\n return res;\n}\n\n/**\n * Creates a new default (Winston) logger.\n * @param {object} [options={}]\n * @param {string} [options.defaultLogLevel='info']\n * @return {object}\n */\nexport function newDefaultLogger({\n defaultLogLevel = 'info',\n} = {}) {\n const { format, transports } = winston;\n return winston.createLogger({\n level: defaultLogLevel,\n format: format.combine(\n format.splat(),\n format.timestamp(),\n format.colorize(),\n format.printf(\n ({\n level,\n message,\n timestamp,\n stack,\n ...rest\n }) => {\n let res = `${level}\\t(at ${timestamp}):\\t${message}`;\n if (Object.keys(rest).length) {\n res += `\\n${JSON.stringify(rest, null, 2)}`;\n }\n if (stack) res += `\\n${stack}`;\n return res;\n },\n ),\n ),\n transports: [new transports.Console()],\n });\n}\n\n/**\n * Creates the middleware.\n * @param {object} webpackConfig\n * @param {object} options Additional options:\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {object} [options.buildInfo] \"Build info\" object to use. If provided,\n * it will be used, instead of trying to load from the filesystem the one\n * generated by the Webpack build. It is intended for test environments,\n * where passing this stuff via file system is no bueno.\n * @param {boolean} [options.favicon] `true` will include favicon\n * link into the rendered HTML templates.\n * @param {boolean} [options.noCsp] `true` means that no\n * Content-Security-Policy (CSP) is used by server, thus the renderer\n * may cut a few corners.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` – the cache key for the response;\n * - `maxage?: number` – the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @return {function} Created middleware.\n */\nexport default function factory(webpackConfig, options) {\n const ops = defaults(clone(options), {\n beforeRender: () => Promise.resolve({}),\n maxSsrRounds: 10,\n ssrTimeout: 1000,\n staticCacheSize: 1.e7,\n });\n\n // Note: in normal use the default logger is created and set in the root\n // server function, and this initialization is for testing uses, where\n // renderer is imported directly.\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n const buildInfo = ops.buildInfo || getBuildInfo(webpackConfig.context);\n global.TRU_BUILD_INFO = buildInfo;\n\n // publicPath from webpack.output has a trailing slash at the end.\n const { publicPath, path: outputPath } = webpackConfig.output;\n\n const manifestLink = fs.existsSync(`${outputPath}/manifest.json`)\n ? `<link rel=\"manifest\" href=\"${publicPath}manifest.json\">` : '';\n\n const cache = ops.staticCacheController\n ? new Cache(ops.staticCacheSize) : null;\n\n const CHUNK_GROUPS = readChunkGroupsJson(outputPath);\n\n return async (req, res, next) => {\n try {\n // Ensures any caches always revalidate HTML markup before reuse.\n res.set('Cache-Control', 'no-cache');\n\n res.cookie('csrfToken', req.csrfToken());\n\n let cacheRef;\n if (cache) {\n cacheRef = ops.staticCacheController(req);\n if (cacheRef) {\n const data = cache.get(cacheRef);\n if (data !== null) {\n const { buffer, status } = data;\n if (ops.noCsp && isBrotliAcceptable(req)) {\n res.set('Content-Type', 'text/html');\n res.set('Content-Encoding', 'br');\n if (status !== 200) res.status(status);\n res.send(buffer);\n } else {\n await new Promise((done, failed) => {\n brotliDecompress(buffer, (error, html) => {\n if (error) failed(error);\n else {\n let h = html.toString();\n if (!ops.noCsp) {\n // TODO: Starting from Node v15 we'll be able to use string's\n // .replaceAll() method instead relying on reg. expression for\n // global matching.\n const regex = new RegExp(buffer.nonce, 'g');\n h = h.replace(regex, req.nonce);\n }\n if (status !== 200) res.status(status);\n res.send(h);\n done();\n }\n });\n });\n }\n return;\n }\n }\n }\n\n const [{\n configToInject,\n extraScripts,\n initialState,\n }, {\n cipher,\n iv,\n }] = await Promise.all([\n ops.beforeRender(req, sanitizedConfig),\n prepareCipher(buildInfo.key),\n ]);\n\n let helmet;\n\n /* Optional server-side rendering. */\n let App = ops.Application;\n const ssrContext = {\n req,\n state: cloneDeep(initialState || {}),\n\n // Array of chunk names encountered during the rendering.\n chunks: [],\n };\n let stream;\n if (App) {\n const ssrStart = Date.now();\n\n const renderPass = async () => {\n ssrContext.chunks = [];\n return new Promise((resolve, reject) => {\n const pipeableStream = renderToPipeableStream(\n <GlobalStateProvider\n initialState={ssrContext.state}\n ssrContext={ssrContext}\n >\n <StaticRouter location={req.url}>\n <App />\n </StaticRouter>\n </GlobalStateProvider>,\n {\n onAllReady: () => resolve(pipeableStream),\n onError: reject,\n },\n );\n });\n };\n\n let ssrRound = 0;\n let bailed = false;\n for (; ssrRound < ops.maxSsrRounds; ++ssrRound) {\n stream = await renderPass(); // eslint-disable-line no-await-in-loop\n\n if (!ssrContext.dirty) break;\n\n /* eslint-disable no-await-in-loop */\n const timeout = ops.ssrTimeout + ssrStart - Date.now();\n bailed = timeout <= 0 || !await Promise.race([\n Promise.allSettled(ssrContext.pending),\n timer(timeout).then(() => false),\n ]);\n if (bailed) break;\n /* eslint-enable no-await-in-loop */\n }\n\n let logMsg;\n if (ssrContext.dirty) {\n // NOTE: In the case of incomplete SSR one more round is necessary\n // to ensure the correct hydration when some pending promises have\n // resolved and placed their data into the initial global state.\n stream = await renderPass();\n\n logMsg = bailed ? `SSR timed out after ${ops.ssrTimeout} second(s)`\n : `SSR bailed out after ${ops.maxSsrRounds} round(s)`;\n } else logMsg = `SSR completed in ${ssrRound + 1} round(s)`;\n\n ops.logger.log(ssrContext.dirty ? 'warn' : 'info', logMsg);\n\n App = '';\n stream.pipe(new Writable({\n write: (chunk, _, done) => {\n App += chunk.toString();\n done();\n },\n }));\n\n /* This takes care about server-side rendering of page title and meta tags\n * (still demands injection into HTML template, which happens below). */\n helmet = Helmet.renderStatic();\n }\n\n let chunkGroups;\n const webpackStats = get(res.locals, 'webpack.devMiddleware.stats');\n if (webpackStats) {\n chunkGroups = mapValues(\n webpackStats.toJson({\n all: false,\n chunkGroups: true,\n }).namedChunkGroups,\n (item) => item.assets.map(({ name }) => name),\n );\n } else if (CHUNK_GROUPS) chunkGroups = CHUNK_GROUPS;\n else chunkGroups = {};\n\n /* Encrypts data to be injected into HTML.\n * Keep in mind, that this encryption is no way secure: as the JS bundle\n * contains decryption key and is able to decode it at the client side.\n * Hovewer, for a number of reasons, encryption of injected data is still\n * better than injection of a plain text. */\n delete ssrContext.state.dr_pogodin_react_utils___split_components;\n\n const payload = serializeJs({\n CHUNK_GROUPS: chunkGroups,\n CONFIG: configToInject || sanitizedConfig,\n ISTATE: ssrContext.state,\n }, {\n ignoreFunction: true,\n unsafe: true,\n });\n cipher.update(forge.util.createBuffer(payload, 'utf8'));\n cipher.finish();\n const INJ = forge.util.encode64(`${iv}${cipher.output.data}`);\n\n const chunkSet = new Set();\n\n // TODO: \"main\" chunk has to be added explicitly,\n // because unlike all other chunks they are not managed by <CodeSplit>\n // component, thus they are not added to the ssrContext.chunks\n // automatically. Actually, names of these entry chunks should be\n // read from Wepback config, as the end user may customize them,\n // remove or add other entry points, but it requires additional\n // efforts to figure out how to automatically order them right,\n // thus for now this handles the default config.\n [\n 'main',\n ...ssrContext.chunks,\n ].forEach((chunk) => {\n const assets = chunkGroups[chunk];\n if (assets) assets.forEach((asset) => chunkSet.add(asset));\n });\n\n let styleChunkString = '';\n let scriptChunkString = '';\n chunkSet.forEach((chunk) => {\n if (chunk.endsWith('.css')) {\n styleChunkString += `<link href=\"${publicPath}${chunk}\" rel=\"stylesheet\">`;\n } else if (\n chunk.endsWith('.js')\n // In dev mode HMR adds JS updates into asset arrays,\n // and they (updates) should be ignored.\n && !chunk.endsWith('.hot-update.js')\n ) {\n scriptChunkString += `<script src=\"${publicPath}${chunk}\" type=\"application/javascript\"></script>`;\n }\n });\n\n const grouppedExtraScripts = groupExtraScripts(extraScripts);\n\n const faviconLink = ops.favicon ? (\n '<link rel=\"shortcut icon\" href=\"/favicon.ico\">'\n ) : '';\n\n const html = `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.HEAD_OPEN]}\n ${helmet ? helmet.title.toString() : ''}\n ${helmet ? helmet.meta.toString() : ''}\n <meta name=\"theme-color\" content=\"#FFFFFF\">\n ${manifestLink}\n ${styleChunkString}\n ${faviconLink}\n <meta charset=\"utf-8\">\n <meta\n content=\"width=device-width,initial-scale=1.0\"\n name=\"viewport\"\n >\n </head>\n <body>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.BODY_OPEN]}\n <div id=\"react-view\">${App || ''}</div>\n <script\n id=\"inj\"\n type=\"application/javascript\"\n ${ops.noCsp ? '' : `nonce=\"${req.nonce}\"`}\n >\n window.INJ=\"${INJ}\"\n </script>\n ${scriptChunkString}\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.DEFAULT]}\n </body>\n </html>`;\n\n const status = ssrContext.status || 200;\n if (status !== 200) res.status(status);\n\n if (cacheRef && status < 500) {\n // Note: waiting for the caching to complete is not strictly necessary,\n // but it greately simplifies testing, and error reporting.\n await new Promise((done, failed) => {\n brotliCompress(html, (error, buffer) => {\n if (error) failed(error);\n else {\n buffer.nonce = req.nonce; // eslint-disable-line no-param-reassign\n cache.add({ buffer, status }, cacheRef.key);\n done();\n }\n });\n });\n }\n\n // Note: as caching code above may throw in some cases, sending response\n // before it completes will likely hide the error, making it difficult\n // to debug. Thus, at least for now, lets send response after it.\n res.send(html);\n } catch (error) {\n next(error);\n }\n };\n}\n"],"mappings":"ySAIA,8BAEA,gEAEA,8BAUA,sDACA,6DACA,8CACA,kDACA,0BAEA,wCACA,yCACA,gDACA,iFACA,0CACA,wDAEA,sD,6CA/BA;AACA;AACA,GA+BA,KAAMA,gBAAe,CAAG,GAAAC,YAAA,EAAKC,eAAL,CAAa,QAAb,CAAxB,CAEO,KAAMC,iBAAgB,CAAG,CAC9BC,SAAS,CAAE,WADmB,CAE9BC,OAAO,CAAE,SAFqB,CAG9BC,SAAS,CAAE,WAHmB,CAAzB,CAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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C;AACA,cAAcQ,iBAAkB;AAChC,cAAcE,oBAAoB,CAACpL,gBAAgB,CAACE,OAAlB,CAA2B;AAC7D;AACA,gBA7BM,CA+BA,KAAM+F,OAAM,CAAGqB,UAAU,CAACrB,MAAX,EAAqB,GAApC,CACA,GAAIA,MAAM,GAAK,GAAf,CAAoBlF,GAAG,CAACkF,MAAJ,CAAWA,MAAX,EAEpB,GAAIH,QAAQ,EAAIG,MAAM,CAAG,GAAzB,CAA8B,CAC5B;AACA;AACA,KAAM,IAAI9E,QAAJ,CAAY,CAACiF,IAAD,CAAOC,MAAP,GAAkB,CAClC,GAAAoF,oBAAA,EAAejF,IAAf,CAAqB,CAACD,KAAD,CAAQP,MAAR,GAAmB,CACtC,GAAIO,KAAJ,CAAWF,MAAM,CAACE,KAAD,CAAN,CAAX,IACK,CACHP,MAAM,CAACa,KAAP,CAAehF,GAAG,CAACgF,KAAnB,CAA0B;AAC1BvB,KAAK,CAAC0F,GAAN,CAAU,CAAEhF,MAAF,CAAUC,MAAV,CAAV,CAA8BH,QAAQ,CAAC5E,GAAvC,EACAkF,IAAI,EACL,CACF,CAPD,CAQD,CATK,CAUP,CAED;AACA;AACA;AACArF,GAAG,CAACoF,IAAJ,CAASK,IAAT,CACD,CAAC,MAAOD,KAAP,CAAc,CACdb,IAAI,CAACa,KAAD,CACL,CACF,CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=factory;exports.getDefaultCspSettings=getDefaultCspSettings;var _path=require("path");var _url=require("url");var _lodash=require("lodash");var _compression=_interopRequireDefault(require("compression"));var _cookieParser=_interopRequireDefault(require("cookie-parser"));var _express=_interopRequireDefault(require("express"));var _serveFavicon=_interopRequireDefault(require("serve-favicon"));var _helmet=_interopRequireDefault(require("helmet"));var _morgan=_interopRequireDefault(require("morgan"));var _requestIp=_interopRequireDefault(require("request-ip"));var _uuid=require("uuid");var _renderer=_interopRequireDefault(require("./renderer"));var _errors=require("./utils/errors");/**
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=factory;exports.getDefaultCspSettings=getDefaultCspSettings;var _path=require("path");var _url=require("url");var _lodash=require("lodash");var _compression=_interopRequireDefault(require("compression"));var _cookieParser=_interopRequireDefault(require("cookie-parser"));var _csurf=_interopRequireDefault(require("csurf"));var _express=_interopRequireDefault(require("express"));var _serveFavicon=_interopRequireDefault(require("serve-favicon"));var _helmet=_interopRequireDefault(require("helmet"));var _morgan=_interopRequireDefault(require("morgan"));var _requestIp=_interopRequireDefault(require("request-ip"));var _uuid=require("uuid");var _renderer=_interopRequireDefault(require("./renderer"));var _errors=require("./utils/errors");/**
|
|
2
2
|
* Creation of standard ExpressJS server for ReactJS apps.
|
|
3
3
|
*/ /**
|
|
4
4
|
* Default Content Security Policy settings.
|
|
@@ -30,7 +30,7 @@ delete defaultCspSettings.directives["upgrade-insecure-requests"];/**
|
|
|
30
30
|
// compatibility. Should be removed sometime later.
|
|
31
31
|
req.cspNonce=req.nonce;// The deep clone is necessary here to ensure that default value can't be
|
|
32
32
|
// mutated during request processing.
|
|
33
|
-
let cspSettings=(0,_lodash.cloneDeep)(defaultCspSettings);cspSettings.directives["script-src"].push(`'nonce-${req.nonce}'`);if(options.cspSettingsHook){cspSettings=options.cspSettingsHook(cspSettings,req)}_helmet.default.contentSecurityPolicy(cspSettings)(req,res,next)})}if(options.favicon){server.use((0,_serveFavicon.default)(options.favicon))}server.use("/robots.txt",(req,res)=>res.send("User-agent: *\nDisallow:"));server.use(_express.default.json({limit:"300kb"}));server.use(_express.default.urlencoded({extended:false}));server.use((0,_cookieParser.default)());server.use(_requestIp.default.mw());_morgan.default.token("ip",req=>req.clientIp);const FORMAT=":ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent";server.use((0,_morgan.default)(FORMAT,{stream:{write:options.logger.info.bind(options.logger)}}));// Note: no matter the "public path", we want the service worker, if any,
|
|
33
|
+
let cspSettings=(0,_lodash.cloneDeep)(defaultCspSettings);cspSettings.directives["script-src"].push(`'nonce-${req.nonce}'`);if(options.cspSettingsHook){cspSettings=options.cspSettingsHook(cspSettings,req)}_helmet.default.contentSecurityPolicy(cspSettings)(req,res,next)})}if(options.favicon){server.use((0,_serveFavicon.default)(options.favicon))}server.use("/robots.txt",(req,res)=>res.send("User-agent: *\nDisallow:"));server.use(_express.default.json({limit:"300kb"}));server.use(_express.default.urlencoded({extended:false}));server.use((0,_cookieParser.default)());server.use(_requestIp.default.mw());server.use((0,_csurf.default)({cookie:true}));_morgan.default.token("ip",req=>req.clientIp);const FORMAT=":ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent";server.use((0,_morgan.default)(FORMAT,{stream:{write:options.logger.info.bind(options.logger)}}));// Note: no matter the "public path", we want the service worker, if any,
|
|
34
34
|
// to be served from the root, to have all web app pages in its scope.
|
|
35
35
|
// Thus, this setup to serve it. Probably, need some more configuration
|
|
36
36
|
// for special cases, but this will do for now.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["defaultCspSettings","directives","mapValues","helmet","contentSecurityPolicy","getDefaultDirectives","array","filter","item","push","getDefaultCspSettings","cloneDeep","factory","webpackConfig","options","rendererOps","pick","renderer","rendererFactory","publicPath","output","server","express","beforeExpressJsSetup","logger","httpsRedirect","use","req","res","next","schema","headers","url","host","originalUrl","redirect","compression","crossOriginEmbedderPolicy","crossOriginOpenerPolicy","crossOriginResourcePolicy","noCsp","nonce","uuid","cspNonce","cspSettings","cspSettingsHook","favicon","send","json","limit","urlencoded","extended","cookieParser","requestIp","mw","loggerMiddleware","token","clientIp","FORMAT","stream","write","info","bind","get","static","path","setHeaders","set","devMode","global","location","href","pathToFileURL","process","cwd","sep","webpack","require","webpackDevMiddleware","webpackHotMiddleware","compiler","serverSideRender","onExpressJsSetup","newError","ERRORS","NOT_FOUND","CODES","dontAttachDefaultErrorHandler","beforeExpressJsError","error","headersSent","status","INTERNAL_SERVER_ERROR","serverSide","log","message","getErrorForCode","env","NODE_ENV","undefined"],"sources":["../../../src/server/server.js"],"sourcesContent":["/**\n * Creation of standard ExpressJS server for ReactJS apps.\n */\n\nimport { sep } from 'path';\nimport { pathToFileURL } from 'url';\n\nimport {\n cloneDeep,\n mapValues,\n pick,\n} from 'lodash';\n\nimport compression from 'compression';\nimport cookieParser from 'cookie-parser';\nimport express from 'express';\nimport favicon from 'serve-favicon';\nimport helmet from 'helmet';\nimport loggerMiddleware from 'morgan';\nimport requestIp from 'request-ip';\nimport { v4 as uuid } from 'uuid';\n\nimport rendererFactory from './renderer';\n\nimport {\n CODES,\n ERRORS,\n getErrorForCode,\n newError,\n} from './utils/errors';\n\n/**\n * Default Content Security Policy settings.\n * @ignore\n */\nconst defaultCspSettings = {\n directives: mapValues(\n helmet.contentSecurityPolicy.getDefaultDirectives(),\n\n // 'https:' options (automatic re-write of insecure URLs to secure ones)\n // is removed to facilitate local development with HTTP server. In cloud\n // deployments we assume Apache or Nginx server in front of out app takes\n // care about such re-writes.\n (array) => array.filter((item) => item !== 'https:'),\n ),\n};\ndefaultCspSettings.directives['frame-src'] = [\n \"'self'\",\n\n // YouTube domain is whitelisted to allow <YouTubeVideo> component to work\n // out of box.\n 'https://*.youtube.com',\n];\ndefaultCspSettings.directives['script-src'].push(\"'unsafe-eval'\");\n\n// No need for automatic re-writes via Content Security Policy settings:\n// the forefront Apache or Nginx server is supposed to take care of this\n// in production cloud deployments.\ndelete defaultCspSettings.directives['upgrade-insecure-requests'];\n\n/**\n * @category Utilities\n * @func server/getDefaultCspSettings\n * @global\n * @desc\n * ```js\n * import { server } from '@dr.pogodin/react-utils';\n * const { getDefaultCspSettings } from '@dr.pogodin/react-utils';\n * ```\n * @return {{\n * directives: object\n * }} A deep copy of default CSP settings object used by `react-utils`,\n * with the exception of `nonce-xxx` clause in `script-src` directive,\n * which is added dynamically for each request.\n */\nexport function getDefaultCspSettings() {\n return cloneDeep(defaultCspSettings);\n}\n\nexport default async function factory(webpackConfig, options) {\n const rendererOps = pick(options, [\n 'Application',\n 'beforeRender',\n 'favicon',\n 'logger',\n 'maxSsrRounds',\n 'noCsp',\n 'ssrTimeout',\n 'staticCacheController',\n 'staticCacheSize',\n ]);\n const renderer = rendererFactory(webpackConfig, rendererOps);\n const { publicPath } = webpackConfig.output;\n\n const server = express();\n\n if (options.beforeExpressJsSetup) {\n await options.beforeExpressJsSetup(server);\n }\n\n server.logger = options.logger;\n\n if (options.httpsRedirect) {\n server.use((req, res, next) => {\n const schema = req.headers['x-forwarded-proto'];\n if (schema === 'http') {\n let url = `https://${req.headers.host}`;\n if (req.originalUrl !== '/') url += req.originalUrl;\n return res.redirect(url);\n }\n return next();\n });\n }\n\n server.use(compression());\n server.use(\n helmet({\n contentSecurityPolicy: false,\n crossOriginEmbedderPolicy: false,\n crossOriginOpenerPolicy: false,\n crossOriginResourcePolicy: false,\n }),\n );\n\n if (!options.noCsp) {\n server.use((req, res, next) => {\n req.nonce = uuid();\n\n // TODO: This is deprecated, but it is kept for now for backward\n // compatibility. Should be removed sometime later.\n req.cspNonce = req.nonce;\n\n // The deep clone is necessary here to ensure that default value can't be\n // mutated during request processing.\n let cspSettings = cloneDeep(defaultCspSettings);\n cspSettings.directives['script-src'].push(`'nonce-${req.nonce}'`);\n if (options.cspSettingsHook) {\n cspSettings = options.cspSettingsHook(cspSettings, req);\n }\n helmet.contentSecurityPolicy(cspSettings)(req, res, next);\n });\n }\n\n if (options.favicon) {\n server.use(favicon(options.favicon));\n }\n\n server.use('/robots.txt', (req, res) => res.send('User-agent: *\\nDisallow:'));\n\n server.use(express.json({ limit: '300kb' }));\n server.use(express.urlencoded({ extended: false }));\n server.use(cookieParser());\n server.use(requestIp.mw());\n\n loggerMiddleware.token('ip', (req) => req.clientIp);\n const FORMAT = ':ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent';\n server.use(loggerMiddleware(FORMAT, {\n stream: {\n write: options.logger.info.bind(options.logger),\n },\n }));\n\n // Note: no matter the \"public path\", we want the service worker, if any,\n // to be served from the root, to have all web app pages in its scope.\n // Thus, this setup to serve it. Probably, need some more configuration\n // for special cases, but this will do for now.\n server.get('/__service-worker.js', express.static(\n webpackConfig.output.path,\n {\n setHeaders: (res) => res.set('Cache-Control', 'no-cache'),\n },\n ));\n\n /* Setup of Hot Module Reloading for development environment.\n * These dependencies are not used, nor installed for production use,\n * hence we should violate some import-related lint rules. */\n /* eslint-disable global-require */\n /* eslint-disable import/no-extraneous-dependencies */\n /* eslint-disable import/no-unresolved */\n if (options.devMode) {\n // This is a workaround for SASS bug:\n // https://github.com/dart-lang/sdk/issues/27979\n // which manifests itself sometimes when webpack dev middleware is used\n // (in dev mode), and app modules are imported in some unfortunate ways.\n if (!global.location) {\n global.location = {\n href: `${pathToFileURL(process.cwd()).href}${sep}`,\n };\n }\n\n const webpack = require('webpack');\n const webpackDevMiddleware = require('webpack-dev-middleware');\n const webpackHotMiddleware = require('webpack-hot-middleware');\n const compiler = webpack(webpackConfig);\n server.use(webpackDevMiddleware(compiler, {\n publicPath,\n serverSideRender: true,\n }));\n server.use(webpackHotMiddleware(compiler));\n }\n /* eslint-enable global-require */\n /* eslint-enable import/no-extraneous-dependencies */\n /* eslint-enable import/no-unresolved */\n\n server.use(publicPath, express.static(webpackConfig.output.path));\n\n if (options.onExpressJsSetup) {\n await options.onExpressJsSetup(server);\n }\n server.use(renderer);\n\n /* Detects 404 errors, and forwards them to the error handler. */\n server.use((req, res, next) => {\n next(newError(ERRORS.NOT_FOUND, CODES.NOT_FOUND));\n });\n\n let dontAttachDefaultErrorHandler;\n if (options.beforeExpressJsError) {\n dontAttachDefaultErrorHandler = await options.beforeExpressJsError(server);\n }\n\n /* Error handler. */\n if (!dontAttachDefaultErrorHandler) {\n // TODO: Do we need this error handler at all? It actually seems to do\n // what the default ExpressJS error handler does anyway, see:\n // https://expressjs.com/en/guide/error-handling.html\n //\n // TODO: It is better to move the default error handler definition\n // to a stand-alone function at top-level, but the use of options.logger\n // prevents to do it without some extra refactoring. Should be done sometime\n // though.\n server.use((error, req, res, next) => {\n // TODO: This is needed to correctly handled any errors thrown after\n // sending initial response to the client.\n if (res.headersSent) return next(error);\n\n const status = error.status || CODES.INTERNAL_SERVER_ERROR;\n const serverSide = status >= CODES.INTERNAL_SERVER_ERROR;\n\n // Log server-side errors always, client-side at debug level only.\n options.logger.log(serverSide ? 'error' : 'debug', error);\n\n let message = error.message || getErrorForCode(status);\n if (serverSide && process.env.NODE_ENV === 'production') {\n message = ERRORS.INTERNAL_SERVER_ERROR;\n }\n\n res.status(status).send(message);\n return undefined;\n });\n }\n\n return server;\n}\n"],"mappings":"qOAIA,0BACA,wBAEA,8BAMA,gEACA,mEACA,wDACA,mEACA,sDACA,sDACA,6DACA,0BAEA,4DAEA,sCAxBA;AACA;AACA,G,CA6BA;AACA;AACA;AACA,GACA,KAAMA,mBAAkB,CAAG,CACzBC,UAAU,CAAE,GAAAC,iBAAA,EACVC,eAAA,CAAOC,qBAAP,CAA6BC,oBAA7B,EADU,CAGV;AACA;AACA;AACA;AACCC,KAAD,EAAWA,KAAK,CAACC,MAAN,CAAcC,IAAD,EAAUA,IAAI,GAAK,QAAhC,CAPD,CADa,CAA3B,CAWAR,kBAAkB,CAACC,UAAnB,CAA8B,WAA9B,EAA6C,CAC3C,QAD2C,CAG3C;AACA;AACA,uBAL2C,CAA7C,CAOAD,kBAAkB,CAACC,UAAnB,CAA8B,YAA9B,EAA4CQ,IAA5C,CAAiD,eAAjD,EAEA;AACA;AACA;AACA,MAAOT,mBAAkB,CAACC,UAAnB,CAA8B,2BAA9B,CAAP,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAASS,sBAAT,EAAiC,CACtC,MAAO,GAAAC,iBAAA,EAAUX,kBAAV,CACR,CAEc,cAAeY,QAAf,CAAuBC,aAAv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AA/B,CACA,GAAIE,UAAU,EAAIpB,OAAO,CAACwB,GAAR,CAAYC,QAAZ,GAAyB,YAA3C,CAAyD,CACvDH,OAAO,CAAGX,cAAA,CAAOQ,qBAClB,CAEDhE,GAAG,CAAC+D,MAAJ,CAAWA,MAAX,EAAmB5C,IAAnB,CAAwBgD,OAAxB,EACA,MAAOI,UACR,CAlBD,CAmBD,CAED,MAAO9E,OACR"}
|
|
1
|
+
{"version":3,"file":"server.js","names":["defaultCspSettings","directives","mapValues","helmet","contentSecurityPolicy","getDefaultDirectives","array","filter","item","push","getDefaultCspSettings","cloneDeep","factory","webpackConfig","options","rendererOps","pick","renderer","rendererFactory","publicPath","output","server","express","beforeExpressJsSetup","logger","httpsRedirect","use","req","res","next","schema","headers","url","host","originalUrl","redirect","compression","crossOriginEmbedderPolicy","crossOriginOpenerPolicy","crossOriginResourcePolicy","noCsp","nonce","uuid","cspNonce","cspSettings","cspSettingsHook","favicon","send","json","limit","urlencoded","extended","cookieParser","requestIp","mw","csrf","cookie","loggerMiddleware","token","clientIp","FORMAT","stream","write","info","bind","get","static","path","setHeaders","set","devMode","global","location","href","pathToFileURL","process","cwd","sep","webpack","require","webpackDevMiddleware","webpackHotMiddleware","compiler","serverSideRender","onExpressJsSetup","newError","ERRORS","NOT_FOUND","CODES","dontAttachDefaultErrorHandler","beforeExpressJsError","error","headersSent","status","INTERNAL_SERVER_ERROR","serverSide","log","message","getErrorForCode","env","NODE_ENV","undefined"],"sources":["../../../src/server/server.js"],"sourcesContent":["/**\n * Creation of standard ExpressJS server for ReactJS apps.\n */\n\nimport { sep } from 'path';\nimport { pathToFileURL } from 'url';\n\nimport {\n cloneDeep,\n mapValues,\n pick,\n} from 'lodash';\n\nimport compression from 'compression';\nimport cookieParser from 'cookie-parser';\nimport csrf from 'csurf';\nimport express from 'express';\nimport favicon from 'serve-favicon';\nimport helmet from 'helmet';\nimport loggerMiddleware from 'morgan';\nimport requestIp from 'request-ip';\nimport { v4 as uuid } from 'uuid';\n\nimport rendererFactory from './renderer';\n\nimport {\n CODES,\n ERRORS,\n getErrorForCode,\n newError,\n} from './utils/errors';\n\n/**\n * Default Content Security Policy settings.\n * @ignore\n */\nconst defaultCspSettings = {\n directives: mapValues(\n helmet.contentSecurityPolicy.getDefaultDirectives(),\n\n // 'https:' options (automatic re-write of insecure URLs to secure ones)\n // is removed to facilitate local development with HTTP server. In cloud\n // deployments we assume Apache or Nginx server in front of out app takes\n // care about such re-writes.\n (array) => array.filter((item) => item !== 'https:'),\n ),\n};\ndefaultCspSettings.directives['frame-src'] = [\n \"'self'\",\n\n // YouTube domain is whitelisted to allow <YouTubeVideo> component to work\n // out of box.\n 'https://*.youtube.com',\n];\ndefaultCspSettings.directives['script-src'].push(\"'unsafe-eval'\");\n\n// No need for automatic re-writes via Content Security Policy settings:\n// the forefront Apache or Nginx server is supposed to take care of this\n// in production cloud deployments.\ndelete defaultCspSettings.directives['upgrade-insecure-requests'];\n\n/**\n * @category Utilities\n * @func server/getDefaultCspSettings\n * @global\n * @desc\n * ```js\n * import { server } from '@dr.pogodin/react-utils';\n * const { getDefaultCspSettings } from '@dr.pogodin/react-utils';\n * ```\n * @return {{\n * directives: object\n * }} A deep copy of default CSP settings object used by `react-utils`,\n * with the exception of `nonce-xxx` clause in `script-src` directive,\n * which is added dynamically for each request.\n */\nexport function getDefaultCspSettings() {\n return cloneDeep(defaultCspSettings);\n}\n\nexport default async function factory(webpackConfig, options) {\n const rendererOps = pick(options, [\n 'Application',\n 'beforeRender',\n 'favicon',\n 'logger',\n 'maxSsrRounds',\n 'noCsp',\n 'ssrTimeout',\n 'staticCacheController',\n 'staticCacheSize',\n ]);\n const renderer = rendererFactory(webpackConfig, rendererOps);\n const { publicPath } = webpackConfig.output;\n\n const server = express();\n\n if (options.beforeExpressJsSetup) {\n await options.beforeExpressJsSetup(server);\n }\n\n server.logger = options.logger;\n\n if (options.httpsRedirect) {\n server.use((req, res, next) => {\n const schema = req.headers['x-forwarded-proto'];\n if (schema === 'http') {\n let url = `https://${req.headers.host}`;\n if (req.originalUrl !== '/') url += req.originalUrl;\n return res.redirect(url);\n }\n return next();\n });\n }\n\n server.use(compression());\n server.use(\n helmet({\n contentSecurityPolicy: false,\n crossOriginEmbedderPolicy: false,\n crossOriginOpenerPolicy: false,\n crossOriginResourcePolicy: false,\n }),\n );\n\n if (!options.noCsp) {\n server.use((req, res, next) => {\n req.nonce = uuid();\n\n // TODO: This is deprecated, but it is kept for now for backward\n // compatibility. Should be removed sometime later.\n req.cspNonce = req.nonce;\n\n // The deep clone is necessary here to ensure that default value can't be\n // mutated during request processing.\n let cspSettings = cloneDeep(defaultCspSettings);\n cspSettings.directives['script-src'].push(`'nonce-${req.nonce}'`);\n if (options.cspSettingsHook) {\n cspSettings = options.cspSettingsHook(cspSettings, req);\n }\n helmet.contentSecurityPolicy(cspSettings)(req, res, next);\n });\n }\n\n if (options.favicon) {\n server.use(favicon(options.favicon));\n }\n\n server.use('/robots.txt', (req, res) => res.send('User-agent: *\\nDisallow:'));\n\n server.use(express.json({ limit: '300kb' }));\n server.use(express.urlencoded({ extended: false }));\n server.use(cookieParser());\n server.use(requestIp.mw());\n\n server.use(csrf({ cookie: true }));\n\n loggerMiddleware.token('ip', (req) => req.clientIp);\n const FORMAT = ':ip > :status :method :url :response-time ms :res[content-length] :referrer :user-agent';\n server.use(loggerMiddleware(FORMAT, {\n stream: {\n write: options.logger.info.bind(options.logger),\n },\n }));\n\n // Note: no matter the \"public path\", we want the service worker, if any,\n // to be served from the root, to have all web app pages in its scope.\n // Thus, this setup to serve it. Probably, need some more configuration\n // for special cases, but this will do for now.\n server.get('/__service-worker.js', express.static(\n webpackConfig.output.path,\n {\n setHeaders: (res) => res.set('Cache-Control', 'no-cache'),\n },\n ));\n\n /* Setup of Hot Module Reloading for development environment.\n * These dependencies are not used, nor installed for production use,\n * hence we should violate some import-related lint rules. */\n /* eslint-disable global-require */\n /* eslint-disable import/no-extraneous-dependencies */\n /* eslint-disable import/no-unresolved */\n if (options.devMode) {\n // This is a workaround for SASS bug:\n // https://github.com/dart-lang/sdk/issues/27979\n // which manifests itself sometimes when webpack dev middleware is used\n // (in dev mode), and app modules are imported in some unfortunate ways.\n if (!global.location) {\n global.location = {\n href: `${pathToFileURL(process.cwd()).href}${sep}`,\n };\n }\n\n const webpack = require('webpack');\n const webpackDevMiddleware = require('webpack-dev-middleware');\n const webpackHotMiddleware = require('webpack-hot-middleware');\n const compiler = webpack(webpackConfig);\n server.use(webpackDevMiddleware(compiler, {\n publicPath,\n serverSideRender: true,\n }));\n server.use(webpackHotMiddleware(compiler));\n }\n /* eslint-enable global-require */\n /* eslint-enable import/no-extraneous-dependencies */\n /* eslint-enable import/no-unresolved */\n\n server.use(publicPath, express.static(webpackConfig.output.path));\n\n if (options.onExpressJsSetup) {\n await options.onExpressJsSetup(server);\n }\n server.use(renderer);\n\n /* Detects 404 errors, and forwards them to the error handler. */\n server.use((req, res, next) => {\n next(newError(ERRORS.NOT_FOUND, CODES.NOT_FOUND));\n });\n\n let dontAttachDefaultErrorHandler;\n if (options.beforeExpressJsError) {\n dontAttachDefaultErrorHandler = await options.beforeExpressJsError(server);\n }\n\n /* Error handler. */\n if (!dontAttachDefaultErrorHandler) {\n // TODO: Do we need this error handler at all? It actually seems to do\n // what the default ExpressJS error handler does anyway, see:\n // https://expressjs.com/en/guide/error-handling.html\n //\n // TODO: It is better to move the default error handler definition\n // to a stand-alone function at top-level, but the use of options.logger\n // prevents to do it without some extra refactoring. Should be done sometime\n // though.\n server.use((error, req, res, next) => {\n // TODO: This is needed to correctly handled any errors thrown after\n // sending initial response to the client.\n if (res.headersSent) return next(error);\n\n const status = error.status || CODES.INTERNAL_SERVER_ERROR;\n const serverSide = status >= CODES.INTERNAL_SERVER_ERROR;\n\n // Log server-side errors always, client-side at debug level only.\n options.logger.log(serverSide ? 'error' : 'debug', error);\n\n let message = error.message || getErrorForCode(status);\n if (serverSide && process.env.NODE_ENV === 'production') {\n message = ERRORS.INTERNAL_SERVER_ERROR;\n }\n\n res.status(status).send(message);\n return undefined;\n });\n }\n\n return server;\n}\n"],"mappings":"qOAIA,0BACA,wBAEA,8BAMA,gEACA,mEACA,oDACA,wDACA,mEACA,sDACA,sDACA,6DACA,0BAEA,4DAEA,sCAzBA;AACA;AACA,G,CA8BA;AACA;AACA;AACA,GACA,KAAMA,mBAAkB,CAAG,CACzBC,UAAU,CAAE,GAAAC,iBAAA,EACVC,eAAA,CAAOC,qBAAP,CAA6BC,oBAA7B,EADU,CAGV;AACA;AACA;AACA;AACCC,KAAD,EAAWA,KAAK,CAACC,MAAN,CAAcC,IAAD,EAAUA,IAAI,GAAK,QAAhC,CAPD,CADa,CAA3B,CAWAR,kBAAkB,CAACC,UAAnB,CAA8B,WAA9B,EAA6C,CAC3C,QAD2C,CAG3C;AACA;AACA,uBAL2C,CAA7C,CAOAD,kBAAkB,CAACC,UAAnB,CAA8B,YAA9B,EAA4CQ,IAA5C,CAAiD,eAAjD,EAEA;AACA;AACA;AACA,MAAOT,mBAAkB,CAACC,UAAnB,CAA8B,2BAA9B,CAAP,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAASS,sBAAT,EAAiC,CACtC,MAAO,GAAAC,iBAAA,EAAUX,kBAAV,CACR,CAEc,cAAeY,QAAf,CAAuBC,aAAvB,CAAsCC,OAAtC,CAA+C,CAC5D,KAAMC,YAAW,CAAG,GAAAC,YAAA,EAAKF,OAAL,CAAc,CAChC,aADgC,CAEhC,cAFgC,CAGhC,SAHgC,CAIhC,QAJgC,CAKhC,cALgC,CAMhC,OANgC,CAOhC,YAPgC,CAQhC,uBARgC,CAShC,iBATgC,CAAd,CAApB,CAWA,KAAMG,SAAQ,CAAG,GAAAC,iBAAA,EAAgBL,aAAhB,CAA+BE,WAA/B,CAAjB,CACA,KAAM,CAAEI,UAAF,EAAiBN,aAAa,CAACO,MAArC,CAEA,KAAMC,OAAM,CAAG,GAAAC,gBAAA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interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _utils=require("../../utils");var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"X5WszA","ad":"_8s7GCr","hoc":"TVlBYc","container":"Cxx397","input":"M07d4s","label":"gfbdq-"};/**
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _utils=require("../../utils");var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"X5WszA","ad":"_8s7GCr","hoc":"TVlBYc","container":"Cxx397","input":"M07d4s","label":"gfbdq-"};/**
|
|
2
2
|
* Themeable input field, based on the standard HTML `<input>` element.
|
|
3
3
|
* @param {object} [props]
|
|
4
4
|
* @param {string} [props.label] Input label.
|
|
5
5
|
* @param {InputTheme} [props.theme] _Ad hoc_ theme.
|
|
6
|
-
* @param {...any} [props
|
|
7
|
-
* @param {...any} [props
|
|
6
|
+
* @param {...any} [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
7
|
+
* @param {...any} [props...] Any other properties are passed to the underlying
|
|
8
8
|
* `<input>` element.
|
|
9
|
-
*/
|
|
9
|
+
*/const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("p",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{className:theme.input,ref:ref,...rest})]}));const ThemedInput=(0,_utils.themed)("Input",["container","input","label"],defaultTheme)(Input);Input.propTypes={label:_propTypes.default.string,theme:ThemedInput.themeType.isRequired};Input.defaultProps={label:undefined};var _default=ThemedInput;exports.default=_default;
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Input","label","theme","rest","container","undefined","input","ThemedInput","themed","defaultTheme","propTypes","PT","string","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/Input/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param {object} [props]\n * @param {string} [props.label] Input label.\n * @param {InputTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props
|
|
1
|
+
{"version":3,"file":"index.js","names":["Input","forwardRef","label","theme","rest","ref","container","undefined","input","ThemedInput","themed","defaultTheme","propTypes","PT","string","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/Input/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { forwardRef } from 'react';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param {object} [props]\n * @param {string} [props.label] Input label.\n * @param {InputTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param {...any} [props...] Any other properties are passed to the underlying\n * `<input>` element.\n */\nconst Input = forwardRef(({\n label,\n theme,\n ...rest\n}, ref) => (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n ref={ref}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </div>\n));\n\nconst ThemedInput = themed('Input', [\n 'container',\n 'input',\n 'label',\n], defaultTheme)(Input);\n\nInput.propTypes = {\n label: PT.string,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":"gLAAA,6DACA,4BAEA,kC,0KAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAMA,MAAK,cAAG,GAAAC,iBAAA,EAAW,CAAC,CACxBC,KADwB,CAExBC,KAFwB,CAGxB,GAAGC,IAHqB,CAAD,CAItBC,GAJsB,gBAKvB,4BAAK,SAAS,CAAEF,KAAK,CAACG,SAAtB,WACIJ,KAAK,GAAKK,SAAV,CAAsB,IAAtB,cAA6B,yBAAG,SAAS,CAAEJ,KAAK,CAACD,KAApB,UAA4BA,KAA5B,EADjC,cAEE,6BACE,SAAS,CAAEC,KAAK,CAACK,KADnB,CAEE,GAAG,CAAEH,GAFP,IAGMD,IAHN,EAFF,GALY,CAAd,CAeA,KAAMK,YAAW,CAAG,GAAAC,aAAA,EAAO,OAAP,CAAgB,CAClC,WADkC,CAElC,OAFkC,CAGlC,OAHkC,CAAhB,CAIjBC,YAJiB,EAIHX,KAJG,CAApB,CAMAA,KAAK,CAACY,SAAN,CAAkB,CAChBV,KAAK,CAAEW,kBAAA,CAAGC,MADM,CAEhBX,KAAK,CAAEM,WAAW,CAACM,SAAZ,CAAsBC,UAFb,CAAlB,CAKAhB,KAAK,CAACiB,YAAN,CAAqB,CACnBf,KAAK,CAAEK,SADY,CAArB,C,aAIeE,W"}
|
|
@@ -30,10 +30,10 @@ if(options.logger===undefined){options.logger={debug:_lodash.noop,info:_lodash.n
|
|
|
30
30
|
const markup=await new Promise((done,fail)=>{renderer(this.ssrRequest,// TODO: This will do for now, with the current implementation of
|
|
31
31
|
// the renderer, but it will require a rework once the renderer is
|
|
32
32
|
// updated to do streaming.
|
|
33
|
-
{send:done,set:_lodash.noop,status:value=>{status=value},// This is how up-to-date Webpack stats are passed to the server in
|
|
33
|
+
{cookie:_lodash.noop,send:done,set:_lodash.noop,status:value=>{status=value},// This is how up-to-date Webpack stats are passed to the server in
|
|
34
34
|
// development mode, and we use this here always, instead of having
|
|
35
35
|
// to pass some information via filesystem.
|
|
36
|
-
locals:{webpack:{devMiddleware:{stats:this.webpackStats}}}},error=>{if(error)fail(error);else done("")})});this.global.ssrMarkup=markup;this.global.ssrOptions=options;this.global.ssrStatus=status}constructor(config,context){const pragmas=context.docblockPragmas;let request=pragmas["ssr-request"];request=request?JSON.parse(request):{};if(!request.url)request.url="/";// This ensures the initial JsDom URL matches the value we use for SSR.
|
|
36
|
+
locals:{webpack:{devMiddleware:{stats:this.webpackStats}}}},error=>{if(error)fail(error);else done("")})});this.global.ssrMarkup=markup;this.global.ssrOptions=options;this.global.ssrStatus=status}constructor(config,context){const pragmas=context.docblockPragmas;let request=pragmas["ssr-request"];request=request?JSON.parse(request):{};if(!request.url)request.url="/";request.csrfToken=_lodash.noop;// This ensures the initial JsDom URL matches the value we use for SSR.
|
|
37
37
|
(0,_lodash.set)(config.projectConfig,"testEnvironmentOptions.url",`http://localhost${request.url}`);super(config,context);this.global.dom=this.dom;this.global.webpackOutputFs=(0,_memfs.createFsFromVolume)(new _memfs.Volume);// Extracts necessary settings from config and context.
|
|
38
38
|
const{projectConfig}=config;this.rootDir=projectConfig.rootDir;this.testFolder=_path.default.dirname(context.testPath);this.withSsr=!pragmas["no-ssr"];this.ssrRequest=request;this.pragmas=pragmas}async setup(){await super.setup();await this.runWebpack();if(this.withSsr)await this.runSsr();this.global.REACT_UTILS_FORCE_CLIENT_SIDE=true}async teardown(){delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;// Resets module cache and @babel/register. Effectively this ensures that
|
|
39
39
|
// the next time an instance of this environment is set up, all modules are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","webpackStats","toJson","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","send","set","value","locals","devMiddleware","error","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n let status = 200; // OK\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n send: done,\n set: noop,\n status: (value) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":"gLAiBA,kDACA,0EAEA,8BAKA,iEACA,oFACA,4BACA,wDA5BA;AACA;AACA;AACA;AACA;AACA,G,CACA,8D,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA,sD,CAKA,qDAEe,KAAMA,UAAN,QAAwBC,8BAAS,CAC9C;AACF;AACA;AACA,KACEC,iBAAiB,EAAG,CAClB,GAAIC,QAAO,CAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd,CACAD,OAAO,CAAGA,OAAO,CAAGE,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAH,CAAyB,EAA1C,CACA,GAAAI,gBA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AAM,CAAEH,aAAF,EAAoBJ,MAA1B,CACA,KAAKnD,OAAL,CAAeuD,aAAa,CAACvD,OAA7B,CACA,KAAKR,UAAL,CAAkBM,aAAA,CAAK6D,OAAL,CAAapE,OAAO,CAACqE,QAArB,CAAlB,CACA,KAAKC,OAAL,CAAe,CAAC1E,OAAO,CAAC,QAAD,CAAvB,CACA,KAAKqD,UAAL,CAAkBa,OAAlB,CACA,KAAKlE,OAAL,CAAeA,OAChB,CAEU,KAAL2E,MAAK,EAAG,CACZ,KAAM,OAAMA,KAAN,EAAN,CACA,KAAM,MAAKzD,UAAL,EAAN,CACA,GAAI,KAAKwD,OAAT,CAAkB,KAAM,MAAK5C,MAAL,EAAN,CAClB,KAAKvB,MAAL,CAAYqE,6BAAZ,CAA4C,IAC7C,CAEa,KAARC,SAAQ,EAAG,CACf,MAAO,MAAKtE,MAAL,CAAYqE,6BAAnB,CAEA;AACA;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAP,CAAYrE,OAAO,CAACsE,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,EAAS,CAC1C,MAAOxE,QAAO,CAACsE,KAAR,CAAcE,GAAd,CACR,CAFD,EAGAzC,iBAAA,CAAS0C,MAAT,GACA,MAAMN,QAAN,EACD,CA9K6C,C"}
|
|
1
|
+
{"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","webpackStats","toJson","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","error","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n let status = 200; // OK\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":"gLAiBA,kDACA,0EAEA,8BAKA,iEACA,oFACA,4BACA,wDA5BA;AACA;AACA;AACA;AACA;AACA,G,CACA,8D,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA,sD,CAKA,qDAEe,KAAMA,UAAN,QAAwBC,8BAAS,CAC9C;AACF;AACA;AACA,KACEC,iBAAiB,EAAG,CAClB,GAAIC,QAAO,CAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd,CACAD,OAAO,CAAGA,OAAO,CAAGE,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAH,CAAyB,EAA1C,CACA,GAAAI,gBAAA,EAASJ,OAAT,CAAkB,CAChBK,OAAO,CAAE,KAAKC,UADE,CAEhBC,EAAE,CAAE,KAA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AEH,aAAF,EAAoBL,MAA1B,CACA,KAAKpD,OAAL,CAAeyD,aAAa,CAACzD,OAA7B,CACA,KAAKR,UAAL,CAAkBM,aAAA,CAAK+D,OAAL,CAAatE,OAAO,CAACuE,QAArB,CAAlB,CACA,KAAKC,OAAL,CAAe,CAAC5E,OAAO,CAAC,QAAD,CAAvB,CACA,KAAKqD,UAAL,CAAkBc,OAAlB,CACA,KAAKnE,OAAL,CAAeA,OAChB,CAEU,KAAL6E,MAAK,EAAG,CACZ,KAAM,OAAMA,KAAN,EAAN,CACA,KAAM,MAAK3D,UAAL,EAAN,CACA,GAAI,KAAK0D,OAAT,CAAkB,KAAM,MAAK9C,MAAL,EAAN,CAClB,KAAKvB,MAAL,CAAYuE,6BAAZ,CAA4C,IAC7C,CAEa,KAARC,SAAQ,EAAG,CACf,MAAO,MAAKxE,MAAL,CAAYuE,6BAAnB,CAEA;AACA;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAP,CAAYvE,OAAO,CAACwE,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,EAAS,CAC1C,MAAO1E,QAAO,CAACwE,KAAR,CAAcE,GAAd,CACR,CAFD,EAGA3C,iBAAA,CAAS4C,MAAT,GACA,MAAMN,QAAN,EACD,CAhL6C,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{border:0;font:inherit;font-size:100%;margin:0;padding:0;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0}body{text-rendering:auto}*{box-sizing:border-box}.zH52sA[disabled]{cursor:not-allowed}.E1FNQT,.KM0v4f.E1FNQT,._3jm1-Q._0plpDL.E1FNQT{background-image:linear-gradient(0deg,#d3d3d3,#fff 50%,#fff);border:1px solid gray;border-radius:.3em;color:inherit;cursor:pointer;display:inline-block;font:inherit;margin:.1em;padding:.3em 1.2em;text-align:center;text-decoration:none}.E1FNQT:visited,.KM0v4f.E1FNQT:visited,._3jm1-Q._0plpDL.E1FNQT:visited{color:inherit}.E1FNQT:
|
|
1
|
+
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{border:0;font:inherit;font-size:100%;margin:0;padding:0;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0}body{text-rendering:auto}*{box-sizing:border-box}.zH52sA[disabled]{cursor:not-allowed}.E1FNQT,.KM0v4f.E1FNQT,._3jm1-Q._0plpDL.E1FNQT{background-image:linear-gradient(0deg,#d3d3d3,#fff 50%,#fff);border:1px solid gray;border-radius:.3em;color:inherit;cursor:pointer;display:inline-block;font:inherit;margin:.1em;padding:.3em 1.2em;text-align:center;text-decoration:none}.E1FNQT:visited,.KM0v4f.E1FNQT:visited,._3jm1-Q._0plpDL.E1FNQT:visited{color:inherit}.E1FNQT.MAe9O6,.E1FNQT:active,.KM0v4f.E1FNQT.MAe9O6,.KM0v4f.E1FNQT:active,._3jm1-Q._0plpDL.E1FNQT.MAe9O6,._3jm1-Q._0plpDL.E1FNQT:active{background-image:linear-gradient(180deg,#d3d3d3,#fff 50%,#fff);border-color:gray;box-shadow:inset 0 1px 3px 0 #d3d3d3}.E1FNQT:focus,.KM0v4f.E1FNQT:focus,._3jm1-Q._0plpDL.E1FNQT:focus{border-color:blue;box-shadow:0 0 3px 1px #add8e6;outline:none}.Br9IWV,.KM0v4f.Br9IWV,._3jm1-Q._0plpDL.Br9IWV{cursor:not-allowed;opacity:.33}.Br9IWV.MAe9O6,.Br9IWV:active,.KM0v4f.Br9IWV.MAe9O6,.KM0v4f.Br9IWV:active,._3jm1-Q._0plpDL.Br9IWV.MAe9O6,._3jm1-Q._0plpDL.Br9IWV:active{background-image:linear-gradient(0deg,#d3d3d3,#fff 50%,#fff);box-shadow:none}.A-f8qJ,.dNQcC6.A-f8qJ,.earXxa.qAPfQ6.A-f8qJ{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:1px solid gray;border-radius:.3em;cursor:pointer;font:inherit;height:1.5em;margin:0;outline:none;width:1.5em}.A-f8qJ:checked:after,.dNQcC6.A-f8qJ:checked:after,.earXxa.qAPfQ6.A-f8qJ:checked:after{background:#000;border-radius:.3em;content:"";display:block;height:1em;margin:.2em;width:1em}.A-f8qJ:focus,.dNQcC6.A-f8qJ:focus,.earXxa.qAPfQ6.A-f8qJ:focus{border-color:blue;box-shadow:0 0 3px 1px #add8e6}.Kr0g3M,.dNQcC6.Kr0g3M,.earXxa.qAPfQ6.Kr0g3M{align-items:center;display:inline-flex;margin:.1em}._3dML-O,.dNQcC6._3dML-O,.earXxa.qAPfQ6._3dML-O{margin:0 .6em 0 1.5em}.-zPK7Y,.D4XHG2.N3nd34.-zPK7Y,.haRIry.-zPK7Y{background-image:linear-gradient(0deg,#d3d3d3,#fff 50%,#fff);border:1px solid gray;border-radius:0 .3em .3em 0;padding:.3em .6em;pointer-events:none;position:absolute;right:0}.D4XHG2.N3nd34._9CQpeA,._9CQpeA,.haRIry._9CQpeA{align-items:center;display:inline-flex;margin:.1em;position:relative}:active+.-zPK7Y,:active+.D4XHG2.N3nd34.-zPK7Y,:active+.haRIry.-zPK7Y{background-image:linear-gradient(180deg,#d3d3d3,#fff 50%,#fff);border-bottom-right-radius:0}:focus+.-zPK7Y,:focus+.D4XHG2.N3nd34.-zPK7Y,:focus+.haRIry.-zPK7Y{border-color:blue blue blue gray}.D4XHG2.N3nd34.Gv0kyu,.Gv0kyu,.haRIry.Gv0kyu{margin:0 .6em 0 1.5em}.D4XHG2.N3nd34.RdW3yR,.RdW3yR,.haRIry.RdW3yR{display:none}.D4XHG2.N3nd34.JXK1uw,.JXK1uw,.haRIry.JXK1uw{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:1px solid gray;border-radius:.3em;color:inherit;cursor:pointer;display:inline-block;font:inherit;outline:none;padding:.3em 3.3em calc(.3em + 1px) 1.2em}.D4XHG2.N3nd34.JXK1uw:active,.JXK1uw:active,.haRIry.JXK1uw:active{background:#fff;border-bottom-left-radius:0;border-bottom-right-radius:0}.D4XHG2.N3nd34.JXK1uw:focus,.JXK1uw:focus,.haRIry.JXK1uw:focus{border-color:blue;box-shadow:0 0 3px 1px #add8e6}.Cxx397,.X5WszA.Cxx397,._8s7GCr.TVlBYc.Cxx397{align-items:center;display:inline-flex;margin:.1em}.M07d4s,.X5WszA.M07d4s,._8s7GCr.TVlBYc.M07d4s{border:1px solid gray;border-radius:.3em;cursor:text;font:inherit;outline:none;padding:.3em .3em calc(.3em + 1px)}.M07d4s:focus,.X5WszA.M07d4s:focus,._8s7GCr.TVlBYc.M07d4s:focus{border-color:blue;box-shadow:0 0 3px 1px #add8e6}.X5WszA.gfbdq-,._8s7GCr.TVlBYc.gfbdq-,.gfbdq-{margin:0 .6em 0 1.5em}.T3cuHB,.m3-mdC.J15Z4H.T3cuHB,.m4mL-M.T3cuHB{align-items:stretch;display:flex;min-height:100vh;overflow:hidden;width:100%}.m3-mdC.J15Z4H.pPlQO2,.m4mL-M.pPlQO2,.pPlQO2{overflow:hidden;padding:1.2em;width:1024px}.lqNh4h,.m3-mdC.J15Z4H.lqNh4h,.m4mL-M.lqNh4h{overflow:hidden;width:calc(50% - 512px)}.Ah-Nsc.Wki41G.ye2BZo,.Szmbbz.ye2BZo,.ye2BZo{background:#eee;height:100%;left:0;opacity:.8;position:fixed;top:0;width:100%;z-index:998}.Ah-Nsc.Wki41G.ye2BZo:focus,.Szmbbz.ye2BZo:focus,.ye2BZo:focus{outline:none}.Ah-Nsc.Wki41G.gyZ4rc,.Szmbbz.gyZ4rc,.gyZ4rc{background:#fff;border-radius:4;box-shadow:0 0 14px 1px rgba(38,38,40,.15);left:50%;max-height:95vh;max-width:1024px;overflow:hidden;padding:.6em 1.2em;position:fixed;top:50%;transform:translate(-50%,-50%);width:480px;z-index:999}@media(max-width:1280px){.Ah-Nsc.Wki41G.gyZ4rc,.Szmbbz.gyZ4rc,.gyZ4rc{max-width:95vw}}body.scrolling-disabled-by-modal{overflow:hidden}.EznFz3{position:relative;width:100%}._0vb7tq{height:100%;position:absolute;width:100%}.XIxe9o.YOyORH._7zdld4,._7zdld4,.uIObt7._7zdld4{display:inline-block}.XIxe9o.YOyORH.dBrB4g,.dBrB4g,.uIObt7.dBrB4g{-webkit-animation:TJe-6j .4s ease-in infinite alternate;animation:TJe-6j .4s ease-in infinite alternate;background:#000;border-radius:.3em;display:inline-block;height:.6em;margin:0 .1em;position:relative;width:.6em}@-webkit-keyframes TJe-6j{0%{top:-.3em}to{top:.3em}}@keyframes TJe-6j{0%{top:-.3em}to{top:.3em}}.XIxe9o.YOyORH.dBrB4g:first-child,.dBrB4g:first-child,.uIObt7.dBrB4g:first-child{-webkit-animation-delay:-.2s;animation-delay:-.2s}.XIxe9o.YOyORH.dBrB4g:last-child,.dBrB4g:last-child,.uIObt7.dBrB4g:last-child{-webkit-animation-delay:.2s;animation-delay:.2s}@-webkit-keyframes L4ubm-{0%{opacity:0}to{opacity:1}}@keyframes L4ubm-{0%{opacity:0}to{opacity:1}}.GdZucr.M9gywF,.M9gywF,._4xT7zE.zd-vnH.M9gywF{border:.6em solid gray;height:0;pointer-events:none;position:absolute;width:0}.GdZucr.f9gY8K,._4xT7zE.zd-vnH.f9gY8K,.f9gY8K{-webkit-animation:L4ubm- .6s;animation:L4ubm- .6s;background:gray;border-radius:.3em;color:#fff;display:inline-block;left:0;padding:0 .3em;position:absolute;top:0}.GdZucr._4qDBRM,._4qDBRM,._4xT7zE.zd-vnH._4qDBRM{display:inline-block}* .sXHM81,.r3ABzd.YKcPnR .sXHM81,.veKyYi .sXHM81{background:#f5f5f5}* .SlV2zw,.r3ABzd.YKcPnR .SlV2zw,.veKyYi .SlV2zw{height:100%;position:relative;width:100%}* .jTxmOX,._5a9XX1._7sH52O .jTxmOX,.dzIcLh .jTxmOX{position:absolute;text-align:center;top:40%;transform:translateY(50%);width:100%}
|
|
2
2
|
/*# sourceMappingURL=style.css.map*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.css","mappings":"AAUA,2ZASE,SACA,aACA,eAJA,SACA,UAIA,wBAIF,8EAEE,cAGF,KACE,cAGF,MACE,gBAGF,aACE,YAGF,oDACE,WACA,aAGF,MACE,yBACA,iBC9CF,KACE,oBAGF,EACE,sBCTF,kBACE,mBCMA,+CACE,6DACA,sBACA,mBACA,cACA,eACA,qBACA,aACA,YACA,mBACA,kBACA,qBAEA,uEACE,cAGF,iEACE,kBACA,eAGF,iEAEE,kBADA,+BAEA,aAGF,wIAEE,+DAEA,kBADA,oCACA,CAKJ,+CACE,mBACA,YC3CF,6CACE,6DACA,gBACA,sBACA,mBACA,eACA,aACA,aAEA,SADA,aAEA,YAGE,uFACE,gBACA,mBACA,WACA,cACA,WACA,YACA,UAIJ,+DACE,kBACA,+BAIJ,6CACE,mBACA,oBACA,YAGF,gDACE,sBCnCF,6CACE,6DACA,sBACA,4BACA,kBACA,oBACA,kBACA,QAGF,gDACE,mBACA,oBACA,YACA,kBAGF,qEACE,+DACA,6BAGF,kEAEE,iCAGF,6CACE,sBAIF,0DAEA,6CACE,6DACA,gBACA,sBACA,mBACA,cACA,eACA,qBACA,aACA,aACA,0CAEA,kEACE,gBACA,4BACA,6BAGF,+DACE,kBACA,+BCxDJ,8CACE,mBACA,oBACA,YAGF,8CACE,sBACA,mBACA,YACA,aACA,aACA,mCAEA,gEACE,kBACA,+BAIJ,8CACE,sBCZF,6CACE,oBACA,aACA,iBACA,gBACA,WAGF,6CACE,gBACA,cACA,YCPQ,CDUV,6CACE,gBACA,wBEvBF,6CACE,gBACA,YACA,OACA,WACA,eACA,MACA,WACA,YAEA,4EAGF,6CACE,gBAEA,gBADA,2CASA,SAPA,gBACA,gBDPQ,CCQR,gBACA,mBAEA,eACA,QAEA,+BAJA,YAKA,YDeF,yBC5BA,6CAgBI,gBCjCJ,iCACE,gBCFJ,QACE,kBACA,WAGF,SACE,YACA,kBACA,WCLA,gDACE,qBAGF,6CAME,wGACA,gBACA,mBACA,qBACA,YACA,cACA,kBACA,WAZA,0BACE,aACA,aAFF,kBACE,aACA,aAYF,mIACA,8HCvBJ,0BACE,aACA,cAFF,kBACE,aACA,cAMA,8CACE,uBAIA,QAAO,CAHP,oBACA,kBACA,OACA,CAOF,8CASE,kDARA,gBACA,mBACA,WACA,qBAIA,OAHA,eACA,kBACA,KAEA,CAGF,iDACE,qBC9BF,iDACE,mBAGF,iDACE,YACA,kBACA,WCPF,mDACE,kBACA,kBACA,QACA,0BACA","sources":["webpack://@dr.pogodin/react-utils/./src/styles/_global/reset.css","webpack://@dr.pogodin/react-utils/./src/styles/global.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/GenericLink/style.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Button/style.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Checkbox/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Dropdown/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Input/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/PageLayout/base-theme.scss","webpack://@dr.pogodin/react-utils/./src/styles/_mixins/media.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Modal/base-theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Modal/styles.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/ScalableRect/style.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Throbber/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/WithTooltip/default-theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/YouTubeVideo/base.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/YouTubeVideo/throbber.scss"],"sourcesContent":["/* Eric Meyer's \"Reset CSS\" 2.0 */\n\n/* http://meyerweb.com/eric/tools/css/reset/\n v2.0 | 20110126\n License: none (public domain)\n*/\n\n/* Having all selectors at individual lines is unreadable in the case of this\n * style reset sheet. */\n/* stylelint-disable selector-list-comma-newline-after */\na, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote,\nbody, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt,\nem, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6,\nheader, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu,\nnav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span,\nstrike, strong,sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr,\ntt, u, ul, var, video {\n margin: 0;\n padding: 0;\n border: 0;\n font: inherit;\n font-size: 100%;\n vertical-align: baseline;\n}\n\n/* HTML5 display-role reset for older browsers */\narticle, aside, details, figcaption, figure, footer, header, hgroup, menu, nav,\nsection {\n display: block;\n}\n\nbody {\n line-height: 1;\n}\n\nol, ul {\n list-style: none;\n}\n\nblockquote, q {\n quotes: none;\n}\n\nblockquote::before, blockquote::after, q::before, q::after {\n content: \"\";\n content: none;\n}\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n","/* Global styles. */\n\n@import \"_global/reset\";\n\nbody {\n text-rendering: auto;\n}\n\n* {\n box-sizing: border-box;\n}\n",".link[disabled] {\n cursor: not-allowed;\n}\n","/**\n * The default button theme.\n */\n\n*,\n.context,\n.ad.hoc {\n &.button {\n background-image: linear-gradient(to top, lightgray, white 50%, white);\n border: solid 1px gray;\n border-radius: 0.3em;\n color: inherit;\n cursor: pointer;\n display: inline-block;\n font: inherit;\n margin: 0.1em;\n padding: 0.3em 1.2em;\n text-align: center;\n text-decoration: none;\n\n &:visited {\n color: inherit;\n }\n\n &:hover {\n border-color: gray;\n cursor: pointer;\n }\n\n &:focus {\n box-shadow: 0 0 3px 1px lightblue;\n border-color: blue;\n outline: none;\n }\n\n &.active,\n &:active {\n background-image: linear-gradient(to bottom, lightgray, white 50%, white);\n box-shadow: inset 0 1px 3px 0 lightgray;\n border-color: gray;\n }\n }\n\n /* Additional styling of disabled buttons. */\n &.disabled {\n cursor: not-allowed;\n opacity: 0.33;\n }\n}\n","*,\n.context,\n.ad.hoc {\n &.checkbox {\n appearance: none;\n background: white;\n border: 1px solid gray;\n border-radius: 0.3em;\n cursor: pointer;\n font: inherit;\n height: 1.5em;\n outline: none;\n margin: 0;\n width: 1.5em;\n\n &:checked {\n &::after {\n background: black;\n border-radius: 0.3em;\n content: \"\";\n display: block;\n height: 1em;\n margin: 0.2em;\n width: 1em;\n }\n }\n\n &:focus {\n border-color: blue;\n box-shadow: 0 0 3px 1px lightblue;\n }\n }\n\n &.container {\n align-items: center;\n display: inline-flex;\n margin: 0.1em;\n }\n\n &.label {\n margin: 0 0.6em 0 1.5em;\n }\n}\n","@import \"styles/mixins\";\n\n*,\n.context,\n.ad.hoc {\n &.arrow {\n background-image: linear-gradient(to top, lightgray, white 50%, white);\n border: 1px solid gray;\n border-radius: 0 0.3em 0.3em 0;\n padding: 0.3em 0.6em;\n pointer-events: none;\n position: absolute;\n right: 0;\n }\n\n &.container {\n align-items: center;\n display: inline-flex;\n margin: 0.1em;\n position: relative;\n }\n\n :active + &.arrow {\n background-image: linear-gradient(to bottom, lightgray, white 50%, white);\n border-bottom-right-radius: 0;\n }\n\n :focus + &.arrow {\n border-color: blue;\n border-left-color: gray;\n }\n\n &.label {\n margin: 0 0.6em 0 1.5em;\n }\n\n &.option { /* Empty style */ }\n &.hiddenOption { display: none; }\n\n &.select {\n appearance: none;\n background: white;\n border: 1px solid gray;\n border-radius: 0.3em;\n color: inherit;\n cursor: pointer;\n display: inline-block;\n font: inherit;\n outline: none;\n padding: 0.3em 3.3em calc(0.3em + 1px) 1.2em;\n\n &:active {\n background: white;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &:focus {\n border-color: blue;\n box-shadow: 0 0 3px 1px lightblue;\n }\n }\n}\n","*,\n.context,\n.ad.hoc {\n &.container {\n align-items: center;\n display: inline-flex;\n margin: 0.1em;\n }\n\n &.input {\n border: 1px solid gray;\n border-radius: 0.3em;\n cursor: text;\n font: inherit;\n outline: none;\n padding: 0.3em 0.3em calc(0.3em + 1px);\n\n &:focus {\n border-color: blue;\n box-shadow: 0 0 3px 1px lightblue;\n }\n }\n\n &.label {\n margin: 0 0.6em 0 1.5em;\n }\n}\n","/**\n * Base theme: symmetric 3-columns layout, with the center column occupying all\n * screen up to mid screen size. For larger screen sizes the main column is\n * limited by the mid screen size, and the free space is filled with side\n * columns on left and right.\n */\n\n@import \"styles/mixins\";\n\n*,\n.context,\n.ad.hoc {\n &.container {\n align-items: stretch;\n display: flex;\n min-height: 100vh;\n overflow: hidden;\n width: 100%;\n }\n\n &.mainPanel {\n overflow: hidden;\n padding: 1.2em;\n width: $screen-md;\n }\n\n &.sidePanel {\n overflow: hidden;\n width: calc((100% - #{$screen-md}) / 2);\n }\n}\n","/**\n * Mixins for different layout sizes: xs, sm, md, lg.\n * Breaking points are defined in _variables.scss\n * The range mixins A-to-B all means \"for the sizes from A to B, both\n * inclusive\", in particular it means that mixin A-to-lg is equivalent to\n * all sizes from A (inclusive) and larger.\n *\n * NOTE: For convenience, these mixins are sorted not alphabetically, but,\n * first, by increase of the first size; second, by increase of the second size.\n */\n\n/* Break points. */\n\n$screen-xs: 320px !default;\n$screen-sm: 495px !default;\n$screen-mm: 768px !default;\n$screen-md: 1024px !default;\n$screen-lg: 1280px !default;\n\n/* XS */\n\n@mixin xs {\n @media (max-width: #{$screen-xs}) {\n @content;\n }\n}\n\n@mixin xs-to-sm {\n @media (max-width: #{$screen-sm}) {\n @content;\n }\n}\n\n@mixin xs-to-mm {\n @media (max-width: #{$screen-mm}) {\n @content;\n }\n}\n\n@mixin xs-to-md {\n @media (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin xs-to-lg {\n @media (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n/* SM */\n\n@mixin sm {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-sm}) {\n @content;\n }\n}\n\n@mixin sm-to-mm {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-mm}) {\n @content;\n }\n}\n\n@mixin sm-to-md {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin sm-to-lg {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin sm-to-xl {\n @media (min-width: #{$screen-xs + 1px}) {\n @content;\n }\n}\n\n/* MM */\n\n@mixin mm {\n @media (min-width: #{$screen-sm + 1px}) and (max-width: #{$screen-mm}) {\n @content;\n }\n}\n\n@mixin mm-to-md {\n @media (min-width: #{$screen-sm + 1px}) and (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin mm-to-lg {\n @media (min-width: #{$screen-sm + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin mm-to-xl {\n @media (min-width: #{$screen-sm + 1px}) {\n @content;\n }\n}\n\n/* MD */\n\n@mixin md {\n @media (min-width: #{$screen-mm + 1px}) and (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin md-to-lg {\n @media (min-width: #{$screen-mm + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin md-to-xl {\n @media (min-width: #{$screen-mm + 1px}) {\n @content;\n }\n}\n\n/* LG */\n\n@mixin lg {\n @media (min-width: #{$screen-md + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin lg-to-xl {\n @media (min-width: #{$screen-md + 1px}) {\n @content;\n }\n}\n\n/* XL */\n\n@mixin xl {\n @media (min-width: #{$screen-lg + 1px}) {\n @content;\n }\n}\n","@import \"styles/mixins\";\n\n*,\n.context,\n.ad.hoc {\n &.overlay {\n background: #eee;\n height: 100%;\n left: 0;\n opacity: 0.8;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 998;\n\n &:focus { outline: none; }\n }\n\n &.container {\n background: #fff;\n box-shadow: 0 0 14px 1px rgba(38 38 40 / 15%);\n border-radius: 4;\n max-height: 95vh;\n max-width: $screen-md;\n overflow: hidden;\n padding: 0.6em 1.2em;\n width: 480px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 999;\n\n @include xs-to-lg {\n max-width: 95vw;\n }\n }\n}\n",":global {\n body.scrolling-disabled-by-modal {\n overflow: hidden;\n }\n}\n",".container {\n position: relative;\n width: 100%;\n}\n\n.wrapper {\n height: 100%;\n position: absolute;\n width: 100%;\n}\n","*,\n.context,\n.ad.hoc {\n &.container {\n display: inline-block;\n }\n\n &.circle {\n @keyframes bouncing {\n from { top: -0.3em; }\n to { top: 0.3em; }\n }\n\n animation: bouncing 0.4s ease-in infinite alternate;\n background: black;\n border-radius: 0.3em;\n display: inline-block;\n height: 0.6em;\n margin: 0 0.1em;\n position: relative;\n width: 0.6em;\n\n &:first-child { animation-delay: -0.2s; }\n &:last-child { animation-delay: 0.2s; }\n }\n}\n","@keyframes appearance {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n*,\n.ad.hoc,\n.context {\n &.arrow {\n border: 0.6em solid grey;\n pointer-events: none;\n position: absolute;\n width: 0;\n height: 0;\n }\n\n /*\n &.content { }\n */\n\n &.container {\n background: grey;\n border-radius: 0.3em;\n color: white;\n display: inline-block;\n padding: 0 0.3em;\n position: absolute;\n top: 0;\n left: 0;\n animation: appearance 0.6s;\n }\n\n &.wrapper {\n display: inline-block;\n }\n}\n","*,\n.context,\n.ad.hoc {\n .container {\n background: whitesmoke;\n }\n\n .video {\n height: 100%;\n position: relative;\n width: 100%;\n }\n}\n","*,\n.context,\n.ad.hoc {\n .container {\n position: absolute;\n text-align: center;\n top: 40%;\n transform: translateY(50%);\n width: 100%;\n }\n}\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"style.css","mappings":"AAUA,2ZASE,SACA,aACA,eAJA,SACA,UAIA,wBAIF,8EAEE,cAGF,KACE,cAGF,MACE,gBAGF,aACE,YAGF,oDACE,WACA,aAGF,MACE,yBACA,iBC9CF,KACE,oBAGF,EACE,sBCTF,kBACE,mBCMA,+CACE,6DACA,sBACA,mBACA,cACA,eACA,qBACA,aACA,YACA,mBACA,kBACA,qBAEA,uEACE,cAGF,wIAEE,+DAEA,kBADA,oCACA,CAGF,iEAEE,kBADA,+BAEA,aAKJ,+CACE,mBACA,YAKA,wIAEE,6DACA,gBC9CJ,6CACE,6DACA,gBACA,sBACA,mBACA,eACA,aACA,aAEA,SADA,aAEA,YAGE,uFACE,gBACA,mBACA,WACA,cACA,WACA,YACA,UAIJ,+DACE,kBACA,+BAIJ,6CACE,mBACA,oBACA,YAGF,gDACE,sBCnCF,6CACE,6DACA,sBACA,4BACA,kBACA,oBACA,kBACA,QAGF,gDACE,mBACA,oBACA,YACA,kBAGF,qEACE,+DACA,6BAGF,kEAEE,iCAGF,6CACE,sBAIF,0DAEA,6CACE,6DACA,gBACA,sBACA,mBACA,cACA,eACA,qBACA,aACA,aACA,0CAEA,kEACE,gBACA,4BACA,6BAGF,+DACE,kBACA,+BCxDJ,8CACE,mBACA,oBACA,YAGF,8CACE,sBACA,mBACA,YACA,aACA,aACA,mCAEA,gEACE,kBACA,+BAIJ,8CACE,sBCZF,6CACE,oBACA,aACA,iBACA,gBACA,WAGF,6CACE,gBACA,cACA,YCPQ,CDUV,6CACE,gBACA,wBEvBF,6CACE,gBACA,YACA,OACA,WACA,eACA,MACA,WACA,YAEA,4EAGF,6CACE,gBAEA,gBADA,2CASA,SAPA,gBACA,gBDPQ,CCQR,gBACA,mBAEA,eACA,QAEA,+BAJA,YAKA,YDeF,yBC5BA,6CAgBI,gBCjCJ,iCACE,gBCFJ,QACE,kBACA,WAGF,SACE,YACA,kBACA,WCLA,gDACE,qBAGF,6CAME,wGACA,gBACA,mBACA,qBACA,YACA,cACA,kBACA,WAZA,0BACE,aACA,aAFF,kBACE,aACA,aAYF,mIACA,8HCvBJ,0BACE,aACA,cAFF,kBACE,aACA,cAMA,8CACE,uBAIA,QAAO,CAHP,oBACA,kBACA,OACA,CAOF,8CASE,kDARA,gBACA,mBACA,WACA,qBAIA,OAHA,eACA,kBACA,KAEA,CAGF,iDACE,qBC9BF,iDACE,mBAGF,iDACE,YACA,kBACA,WCPF,mDACE,kBACA,kBACA,QACA,0BACA","sources":["webpack://@dr.pogodin/react-utils/./src/styles/_global/reset.css","webpack://@dr.pogodin/react-utils/./src/styles/global.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/GenericLink/style.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Button/style.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Checkbox/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Dropdown/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Input/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/PageLayout/base-theme.scss","webpack://@dr.pogodin/react-utils/./src/styles/_mixins/media.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Modal/base-theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Modal/styles.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/ScalableRect/style.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/Throbber/theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/WithTooltip/default-theme.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/YouTubeVideo/base.scss","webpack://@dr.pogodin/react-utils/./src/shared/components/YouTubeVideo/throbber.scss"],"sourcesContent":["/* Eric Meyer's \"Reset CSS\" 2.0 */\n\n/* http://meyerweb.com/eric/tools/css/reset/\n v2.0 | 20110126\n License: none (public domain)\n*/\n\n/* Having all selectors at individual lines is unreadable in the case of this\n * style reset sheet. */\n/* stylelint-disable selector-list-comma-newline-after */\na, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote,\nbody, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt,\nem, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6,\nheader, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu,\nnav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span,\nstrike, strong,sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr,\ntt, u, ul, var, video {\n margin: 0;\n padding: 0;\n border: 0;\n font: inherit;\n font-size: 100%;\n vertical-align: baseline;\n}\n\n/* HTML5 display-role reset for older browsers */\narticle, aside, details, figcaption, figure, footer, header, hgroup, menu, nav,\nsection {\n display: block;\n}\n\nbody {\n line-height: 1;\n}\n\nol, ul {\n list-style: none;\n}\n\nblockquote, q {\n quotes: none;\n}\n\nblockquote::before, blockquote::after, q::before, q::after {\n content: \"\";\n content: none;\n}\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n","/* Global styles. */\n\n@import \"_global/reset\";\n\nbody {\n text-rendering: auto;\n}\n\n* {\n box-sizing: border-box;\n}\n",".link[disabled] {\n cursor: not-allowed;\n}\n","/**\n * The default button theme.\n */\n\n*,\n.context,\n.ad.hoc {\n &.button {\n background-image: linear-gradient(to top, lightgray, white 50%, white);\n border: solid 1px gray;\n border-radius: 0.3em;\n color: inherit;\n cursor: pointer;\n display: inline-block;\n font: inherit;\n margin: 0.1em;\n padding: 0.3em 1.2em;\n text-align: center;\n text-decoration: none;\n\n &:visited {\n color: inherit;\n }\n\n &.active,\n &:active {\n background-image: linear-gradient(to bottom, lightgray, white 50%, white);\n box-shadow: inset 0 1px 3px 0 lightgray;\n border-color: gray;\n }\n\n &:focus {\n box-shadow: 0 0 3px 1px lightblue;\n border-color: blue;\n outline: none;\n }\n }\n\n /* Additional styling of disabled buttons. */\n &.disabled {\n cursor: not-allowed;\n opacity: 0.33;\n\n // Note: this \"cancels out\" the active state styling of an active button,\n // which is defined above, thus ensuring a click on disabled button does\n // not alter its appearance (does not result in visual press).\n &.active,\n &:active {\n background-image: linear-gradient(to top, lightgray, white 50%, white);\n box-shadow: none;\n }\n }\n}\n","*,\n.context,\n.ad.hoc {\n &.checkbox {\n appearance: none;\n background: white;\n border: 1px solid gray;\n border-radius: 0.3em;\n cursor: pointer;\n font: inherit;\n height: 1.5em;\n outline: none;\n margin: 0;\n width: 1.5em;\n\n &:checked {\n &::after {\n background: black;\n border-radius: 0.3em;\n content: \"\";\n display: block;\n height: 1em;\n margin: 0.2em;\n width: 1em;\n }\n }\n\n &:focus {\n border-color: blue;\n box-shadow: 0 0 3px 1px lightblue;\n }\n }\n\n &.container {\n align-items: center;\n display: inline-flex;\n margin: 0.1em;\n }\n\n &.label {\n margin: 0 0.6em 0 1.5em;\n }\n}\n","@import \"styles/mixins\";\n\n*,\n.context,\n.ad.hoc {\n &.arrow {\n background-image: linear-gradient(to top, lightgray, white 50%, white);\n border: 1px solid gray;\n border-radius: 0 0.3em 0.3em 0;\n padding: 0.3em 0.6em;\n pointer-events: none;\n position: absolute;\n right: 0;\n }\n\n &.container {\n align-items: center;\n display: inline-flex;\n margin: 0.1em;\n position: relative;\n }\n\n :active + &.arrow {\n background-image: linear-gradient(to bottom, lightgray, white 50%, white);\n border-bottom-right-radius: 0;\n }\n\n :focus + &.arrow {\n border-color: blue;\n border-left-color: gray;\n }\n\n &.label {\n margin: 0 0.6em 0 1.5em;\n }\n\n &.option { /* Empty style */ }\n &.hiddenOption { display: none; }\n\n &.select {\n appearance: none;\n background: white;\n border: 1px solid gray;\n border-radius: 0.3em;\n color: inherit;\n cursor: pointer;\n display: inline-block;\n font: inherit;\n outline: none;\n padding: 0.3em 3.3em calc(0.3em + 1px) 1.2em;\n\n &:active {\n background: white;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &:focus {\n border-color: blue;\n box-shadow: 0 0 3px 1px lightblue;\n }\n }\n}\n","*,\n.context,\n.ad.hoc {\n &.container {\n align-items: center;\n display: inline-flex;\n margin: 0.1em;\n }\n\n &.input {\n border: 1px solid gray;\n border-radius: 0.3em;\n cursor: text;\n font: inherit;\n outline: none;\n padding: 0.3em 0.3em calc(0.3em + 1px);\n\n &:focus {\n border-color: blue;\n box-shadow: 0 0 3px 1px lightblue;\n }\n }\n\n &.label {\n margin: 0 0.6em 0 1.5em;\n }\n}\n","/**\n * Base theme: symmetric 3-columns layout, with the center column occupying all\n * screen up to mid screen size. For larger screen sizes the main column is\n * limited by the mid screen size, and the free space is filled with side\n * columns on left and right.\n */\n\n@import \"styles/mixins\";\n\n*,\n.context,\n.ad.hoc {\n &.container {\n align-items: stretch;\n display: flex;\n min-height: 100vh;\n overflow: hidden;\n width: 100%;\n }\n\n &.mainPanel {\n overflow: hidden;\n padding: 1.2em;\n width: $screen-md;\n }\n\n &.sidePanel {\n overflow: hidden;\n width: calc((100% - #{$screen-md}) / 2);\n }\n}\n","/**\n * Mixins for different layout sizes: xs, sm, md, lg.\n * Breaking points are defined in _variables.scss\n * The range mixins A-to-B all means \"for the sizes from A to B, both\n * inclusive\", in particular it means that mixin A-to-lg is equivalent to\n * all sizes from A (inclusive) and larger.\n *\n * NOTE: For convenience, these mixins are sorted not alphabetically, but,\n * first, by increase of the first size; second, by increase of the second size.\n */\n\n/* Break points. */\n\n$screen-xs: 320px !default;\n$screen-sm: 495px !default;\n$screen-mm: 768px !default;\n$screen-md: 1024px !default;\n$screen-lg: 1280px !default;\n\n/* XS */\n\n@mixin xs {\n @media (max-width: #{$screen-xs}) {\n @content;\n }\n}\n\n@mixin xs-to-sm {\n @media (max-width: #{$screen-sm}) {\n @content;\n }\n}\n\n@mixin xs-to-mm {\n @media (max-width: #{$screen-mm}) {\n @content;\n }\n}\n\n@mixin xs-to-md {\n @media (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin xs-to-lg {\n @media (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n/* SM */\n\n@mixin sm {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-sm}) {\n @content;\n }\n}\n\n@mixin sm-to-mm {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-mm}) {\n @content;\n }\n}\n\n@mixin sm-to-md {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin sm-to-lg {\n @media (min-width: #{$screen-xs + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin sm-to-xl {\n @media (min-width: #{$screen-xs + 1px}) {\n @content;\n }\n}\n\n/* MM */\n\n@mixin mm {\n @media (min-width: #{$screen-sm + 1px}) and (max-width: #{$screen-mm}) {\n @content;\n }\n}\n\n@mixin mm-to-md {\n @media (min-width: #{$screen-sm + 1px}) and (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin mm-to-lg {\n @media (min-width: #{$screen-sm + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin mm-to-xl {\n @media (min-width: #{$screen-sm + 1px}) {\n @content;\n }\n}\n\n/* MD */\n\n@mixin md {\n @media (min-width: #{$screen-mm + 1px}) and (max-width: #{$screen-md}) {\n @content;\n }\n}\n\n@mixin md-to-lg {\n @media (min-width: #{$screen-mm + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin md-to-xl {\n @media (min-width: #{$screen-mm + 1px}) {\n @content;\n }\n}\n\n/* LG */\n\n@mixin lg {\n @media (min-width: #{$screen-md + 1px}) and (max-width: #{$screen-lg}) {\n @content;\n }\n}\n\n@mixin lg-to-xl {\n @media (min-width: #{$screen-md + 1px}) {\n @content;\n }\n}\n\n/* XL */\n\n@mixin xl {\n @media (min-width: #{$screen-lg + 1px}) {\n @content;\n }\n}\n","@import \"styles/mixins\";\n\n*,\n.context,\n.ad.hoc {\n &.overlay {\n background: #eee;\n height: 100%;\n left: 0;\n opacity: 0.8;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 998;\n\n &:focus { outline: none; }\n }\n\n &.container {\n background: #fff;\n box-shadow: 0 0 14px 1px rgba(38 38 40 / 15%);\n border-radius: 4;\n max-height: 95vh;\n max-width: $screen-md;\n overflow: hidden;\n padding: 0.6em 1.2em;\n width: 480px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 999;\n\n @include xs-to-lg {\n max-width: 95vw;\n }\n }\n}\n",":global {\n body.scrolling-disabled-by-modal {\n overflow: hidden;\n }\n}\n",".container {\n position: relative;\n width: 100%;\n}\n\n.wrapper {\n height: 100%;\n position: absolute;\n width: 100%;\n}\n","*,\n.context,\n.ad.hoc {\n &.container {\n display: inline-block;\n }\n\n &.circle {\n @keyframes bouncing {\n from { top: -0.3em; }\n to { top: 0.3em; }\n }\n\n animation: bouncing 0.4s ease-in infinite alternate;\n background: black;\n border-radius: 0.3em;\n display: inline-block;\n height: 0.6em;\n margin: 0 0.1em;\n position: relative;\n width: 0.6em;\n\n &:first-child { animation-delay: -0.2s; }\n &:last-child { animation-delay: 0.2s; }\n }\n}\n","@keyframes appearance {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n*,\n.ad.hoc,\n.context {\n &.arrow {\n border: 0.6em solid grey;\n pointer-events: none;\n position: absolute;\n width: 0;\n height: 0;\n }\n\n /*\n &.content { }\n */\n\n &.container {\n background: grey;\n border-radius: 0.3em;\n color: white;\n display: inline-block;\n padding: 0 0.3em;\n position: absolute;\n top: 0;\n left: 0;\n animation: appearance 0.6s;\n }\n\n &.wrapper {\n display: inline-block;\n }\n}\n","*,\n.context,\n.ad.hoc {\n .container {\n background: whitesmoke;\n }\n\n .video {\n height: 100%;\n position: relative;\n width: 100%;\n }\n}\n","*,\n.context,\n.ad.hoc {\n .container {\n position: absolute;\n text-align: center;\n top: 40%;\n transform: translateY(50%);\n width: 100%;\n }\n}\n"],"names":[],"sourceRoot":""}
|