@dr.pogodin/react-utils 1.25.5 → 1.25.6

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.
Files changed (78) hide show
  1. package/bin/build.js +7 -1
  2. package/build/development/index.js +2 -4
  3. package/build/development/index.js.map +1 -1
  4. package/build/development/server/index.js +1 -2
  5. package/build/development/server/index.js.map +1 -1
  6. package/build/development/server/renderer.js +1 -2
  7. package/build/development/server/renderer.js.map +1 -1
  8. package/build/development/shared/components/Button/index.js +1 -2
  9. package/build/development/shared/components/Button/index.js.map +1 -1
  10. package/build/development/shared/components/Checkbox/index.js +1 -2
  11. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  12. package/build/development/shared/components/Dropdown/index.js +1 -2
  13. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  14. package/build/development/shared/components/Input/index.js +1 -2
  15. package/build/development/shared/components/Input/index.js.map +1 -1
  16. package/build/development/shared/components/Modal/index.js +1 -2
  17. package/build/development/shared/components/Modal/index.js.map +1 -1
  18. package/build/development/shared/components/PageLayout/index.js +1 -2
  19. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  20. package/build/development/shared/components/Throbber/index.js +1 -2
  21. package/build/development/shared/components/Throbber/index.js.map +1 -1
  22. package/build/development/shared/components/WithTooltip/Tooltip.js +2 -4
  23. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  24. package/build/development/shared/components/WithTooltip/index.js +1 -2
  25. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  26. package/build/development/shared/components/YouTubeVideo/index.js +1 -2
  27. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  28. package/build/development/shared/utils/config.js +1 -2
  29. package/build/development/shared/utils/config.js.map +1 -1
  30. package/build/development/shared/utils/index.js +1 -2
  31. package/build/development/shared/utils/index.js.map +1 -1
  32. package/build/development/shared/utils/isomorphy/environment-check.js +2 -4
  33. package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
  34. package/build/development/shared/utils/jest/index.js +1 -2
  35. package/build/development/shared/utils/jest/index.js.map +1 -1
  36. package/build/development/shared/utils/time.js +1 -2
  37. package/build/development/shared/utils/time.js.map +1 -1
  38. package/build/development/web.bundle.js +2 -2
  39. package/build/production/index.js +1 -1
  40. package/build/production/index.js.map +1 -1
  41. package/build/production/server/index.js +1 -1
  42. package/build/production/server/index.js.map +1 -1
  43. package/build/production/server/renderer.js +2 -2
  44. package/build/production/server/renderer.js.map +1 -1
  45. package/build/production/shared/components/Button/index.js +1 -1
  46. package/build/production/shared/components/Button/index.js.map +1 -1
  47. package/build/production/shared/components/Checkbox/index.js +1 -1
  48. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  49. package/build/production/shared/components/Dropdown/index.js +1 -1
  50. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  51. package/build/production/shared/components/Input/index.js +1 -1
  52. package/build/production/shared/components/Input/index.js.map +1 -1
  53. package/build/production/shared/components/Modal/index.js +1 -1
  54. package/build/production/shared/components/Modal/index.js.map +1 -1
  55. package/build/production/shared/components/PageLayout/index.js +1 -1
  56. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  57. package/build/production/shared/components/Throbber/index.js +1 -1
  58. package/build/production/shared/components/Throbber/index.js.map +1 -1
  59. package/build/production/shared/components/WithTooltip/Tooltip.js +2 -2
  60. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  61. package/build/production/shared/components/WithTooltip/index.js +1 -1
  62. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  63. package/build/production/shared/components/YouTubeVideo/index.js +1 -1
  64. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  65. package/build/production/shared/utils/config.js +1 -1
  66. package/build/production/shared/utils/config.js.map +1 -1
  67. package/build/production/shared/utils/index.js +2 -2
  68. package/build/production/shared/utils/index.js.map +1 -1
  69. package/build/production/shared/utils/isomorphy/environment-check.js +2 -2
  70. package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
  71. package/build/production/shared/utils/jest/index.js +1 -1
  72. package/build/production/shared/utils/jest/index.js.map +1 -1
  73. package/build/production/shared/utils/time.js +1 -1
  74. package/build/production/shared/utils/time.js.map +1 -1
  75. package/build/production/web.bundle.js +1 -1
  76. package/build/production/web.bundle.js.map +1 -1
  77. package/config/babel/webpack.js +2 -1
  78. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require","_http","_interopRequireDefault","_https","_lodash","_server","_interopRequireWildcard","_renderer","_utils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","normalizePort","value","port","toNumber","isFinite","isNumber","launch","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS","_default"],"sources":["../../../src/server/index.js"],"sourcesContent":["import 'source-map-support/register';\n\nimport http from 'http';\nimport https from 'https';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport serverFactory from './server';\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nexport { getDefaultCspSettings } from './server';\nexport * from './utils';\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @ignore\n * @param {String} value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\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 {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\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` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\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 * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nasync function launch(webpackConfig, options) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error) => {\n if (error.syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch (error.code) {\n case 'EACCES':\n ops.logger.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address();\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunch.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\n\nexport default launch;\n"],"mappings":"4VAAAA,OAAA,gCAEA,IAAAC,KAAA,CAAAC,sBAAA,CAAAF,OAAA,UACA,IAAAG,MAAA,CAAAD,sBAAA,CAAAF,OAAA,WAEA,IAAAI,OAAA,CAAAJ,OAAA,WAUAA,OAAA,iBAEA,IAAAK,OAAA,CAAAC,uBAAA,CAAAN,OAAA,cACA,IAAAO,SAAA,CAAAP,OAAA,eAGA,IAAAQ,MAAA,CAAAR,OAAA,YAAAS,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,UAAAC,GAAA,KAAAA,GAAA,cAAAA,GAAA,0BAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,CAAAJ,GAAA,YAAAA,GAAA,IAAAK,OAAA,EAAAA,OAAA,CAAAL,GAAA,IAAAJ,MAAA,CAAAI,GAAA,SAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,CAAAL,GAAA,EAAAO,UAAA,MAAAC,GAAA,SAAAA,CAAA,SAAAZ,MAAA,CAAAI,GAAA,OAAwB,SAAAS,yBAAAC,WAAA,YAAAC,OAAA,8BAAAC,iBAAA,KAAAD,OAAA,KAAAE,gBAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,WAAA,SAAAA,WAAA,CAAAG,gBAAA,CAAAD,iBAAA,GAAAF,WAAA,WAAAhB,wBAAAoB,GAAA,CAAAJ,WAAA,MAAAA,WAAA,EAAAI,GAAA,EAAAA,GAAA,CAAAC,UAAA,SAAAD,GAAA,IAAAA,GAAA,gBAAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,cAAe,CAAAK,MAAMA,CAACC,aAAa,CAAEC,OAAO,CAAE,CAC5C,4BACA,KAAM,CAAAC,GAAG,CAAGD,OAAO,CAAG,GAAAE,iBAAS,EAACF,OAAO,CAAC,CAAG,CAAC,CAAC,CAC7CC,GAAG,CAACP,IAAI,CAAGF,aAAa,CAACS,GAAG,CAACP,IAAI,EAAIS,OAAO,CAACC,GAAG,CAACC,IAAI,EAAI,IAAI,CAAC,CAC9D,GAAAC,gBAAQ,EAACL,GAAG,CAAE,CAAEM,aAAa,CAAE,IAAK,CAAC,CAAC,CAEtC,GAAIN,GAAG,CAACO,MAAM,GAAKC,SAAS,CAAE,CAC5BR,GAAG,CAACO,MAAM,CAAG,GAAAE,0BAAgB,EAAC,CAC5BC,eAAe,CAAEV,GAAG,CAACW,qBACvB,CAAC,CACH,CAEA,kDACA,KAAM,CAAAC,aAAa,CAAG,KAAM,GAAAC,eAAa,EAACf,aAAa,CAAEE,GAAG,CAAC,CAE7D,GAAI,CAAAc,UAAU,CACd,GAAId,GAAG,CAACe,KAAK,CAAE,CACbD,UAAU,CAAGC,cAAK,CAACC,YAAY,CAAC,CAC9BC,IAAI,CAAEjB,GAAG,CAACe,KAAK,CAACE,IAAI,CACpBlD,GAAG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I,CAAC,CAE3B,MAAO,CACLmB,aAAa,CACbE,UACF,CACF,CAEAjB,MAAM,CAACkC,gBAAgB,CAAGA,0BAAgB,CAAC,IAAAC,QAAA,CAE5BnC,MAAM,CAAAzB,OAAA,CAAAW,OAAA,CAAAiD,QAAA"}
1
+ {"version":3,"file":"index.js","names":["require","_http","_interopRequireDefault","_https","_lodash","_server","_interopRequireWildcard","_renderer","_utils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","normalizePort","value","port","toNumber","isFinite","isNumber","launch","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS","_default"],"sources":["../../../src/server/index.js"],"sourcesContent":["import 'source-map-support/register';\n\nimport http from 'http';\nimport https from 'https';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport serverFactory from './server';\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nexport { getDefaultCspSettings } from './server';\nexport * from './utils';\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @ignore\n * @param {String} value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\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 {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\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` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\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 * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nasync function launch(webpackConfig, options) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error) => {\n if (error.syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch (error.code) {\n case 'EACCES':\n ops.logger.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address();\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunch.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\n\nexport default launch;\n"],"mappings":"4VAAAA,OAAA,gCAEA,IAAAC,KAAA,CAAAC,sBAAA,CAAAF,OAAA,UACA,IAAAG,MAAA,CAAAD,sBAAA,CAAAF,OAAA,WAEA,IAAAI,OAAA,CAAAJ,OAAA,WAUAA,OAAA,iBAEA,IAAAK,OAAA,CAAAC,uBAAA,CAAAN,OAAA,cACA,IAAAO,SAAA,CAAAP,OAAA,eAGA,IAAAQ,MAAA,CAAAR,OAAA,YAAAS,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,UAAAC,GAAA,KAAAA,GAAA,cAAAA,GAAA,0BAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,CAAAJ,GAAA,YAAAA,GAAA,IAAAK,OAAA,EAAAA,OAAA,CAAAL,GAAA,IAAAJ,MAAA,CAAAI,GAAA,SAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,CAAAL,GAAA,EAAAO,UAAA,MAAAC,GAAA,SAAAA,CAAA,SAAAZ,MAAA,CAAAI,GAAA,OAAwB,SAAAS,yBAAAC,WAAA,YAAAC,OAAA,8BAAAC,iBAAA,KAAAD,OAAA,KAAAE,gBAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,WAAA,SAAAA,WAAA,CAAAG,gBAAA,CAAAD,iBAAA,GAAAF,WAAA,WAAAhB,wBAAAoB,GAAA,CAAAJ,WAAA,MAAAA,WAAA,EAAAI,GAAA,EAAAA,GAAA,CAAAC,UAAA,SAAAD,GAAA,IAAAA,GAAA,gBAAAA,GAAA,oBAAAA,GAAA,sBAAAE,OAAA,CAAAF,GAAA,MAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,cAAe,CAAAK,MAAMA,CAACC,aAAa,CAAEC,OAAO,CAAE,CAC5C,4BACA,KAAM,CAAAC,GAAG,CAAGD,OAAO,CAAG,GAAAE,iBAAS,EAACF,OAAO,CAAC,CAAG,CAAC,CAAC,CAC7CC,GAAG,CAACP,IAAI,CAAGF,aAAa,CAACS,GAAG,CAACP,IAAI,EAAIS,OAAO,CAACC,GAAG,CAACC,IAAI,EAAI,IAAI,CAAC,CAC9D,GAAAC,gBAAQ,EAACL,GAAG,CAAE,CAAEM,aAAa,CAAE,IAAK,CAAC,CAAC,CAEtC,GAAIN,GAAG,CAACO,MAAM,GAAKC,SAAS,CAAE,CAC5BR,GAAG,CAACO,MAAM,CAAG,GAAAE,0BAAgB,EAAC,CAC5BC,eAAe,CAAEV,GAAG,CAACW,qBACvB,CAAC,CACH,CAEA,kDACA,KAAM,CAAAC,aAAa,CAAG,KAAM,GAAAC,eAAa,EAACf,aAAa,CAAEE,GAAG,CAAC,CAE7D,GAAI,CAAAc,UAAU,CACd,GAAId,GAAG,CAACe,KAAK,CAAE,CACbD,UAAU,CAAGC,cAAK,CAACC,YAAY,CAAC,CAC9BC,IAAI,CAAEjB,GAAG,CAACe,KAAK,CAACE,IAAI,CACpBlD,GAAG,CAAEiC,GAAG,CAACe,KAAK,CAAChD,GACjB,CAAC,CAAE6C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AjB,MAAM,CAACkC,gBAAgB,CAAGA,0BAAgB,CAAC,IAAAC,QAAA,CAAA5D,OAAA,CAAAW,OAAA,CAE5Bc,MAAM"}
@@ -1,6 +1,6 @@
1
1
  "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SCRIPT_LOCATIONS=void 0;exports.default=factory;exports.isBrotliAcceptable=isBrotliAcceptable;exports.newDefaultLogger=newDefaultLogger;var _fs=_interopRequireDefault(require("fs"));var _path=_interopRequireDefault(require("path"));var _stream=require("stream");var _zlib=require("zlib");var _winston=_interopRequireDefault(require("winston"));var _reactGlobalState=require("@dr.pogodin/react-global-state");var _jsUtils=require("@dr.pogodin/js-utils");var _lodash=require("lodash");var _config=_interopRequireDefault(require("config"));var _nodeForge=_interopRequireDefault(require("node-forge"));var _server=require("react-dom/server");var _reactHelmet=require("react-helmet");var _server2=require("react-router-dom/server");var _serializeJavascript=_interopRequireDefault(require("serialize-javascript"));var _buildInfo=require("../shared/utils/isomorphy/buildInfo");var _Cache=_interopRequireDefault(require("./Cache"));var _jsxRuntime=require("react/jsx-runtime");/**
2
2
  * ExpressJS middleware for server-side rendering of a ReactJS app.
3
- */const sanitizedConfig=(0,_lodash.omit)(_config.default,"SECRET");const SCRIPT_LOCATIONS={BODY_OPEN:"BODY_OPEN",DEFAULT:"DEFAULT",HEAD_OPEN:"HEAD_OPEN"};/**
3
+ */const sanitizedConfig=(0,_lodash.omit)(_config.default,"SECRET");const SCRIPT_LOCATIONS=exports.SCRIPT_LOCATIONS={BODY_OPEN:"BODY_OPEN",DEFAULT:"DEFAULT",HEAD_OPEN:"HEAD_OPEN"};/**
4
4
  * Reads build-time information about the app. This information is generated
5
5
  * by our standard Webpack config for apps, and it is written into
6
6
  * ".build-info" file in the context folder specified in Webpack config.
@@ -9,7 +9,7 @@
9
9
  * @ignore
10
10
  * @param {String} context Webpack context path used during the build.
11
11
  * @return {Object} Resolves to the build-time information.
12
- */exports.SCRIPT_LOCATIONS=SCRIPT_LOCATIONS;function getBuildInfo(context){const url=_path.default.resolve(context,".build-info");return JSON.parse(_fs.default.readFileSync(url))}/**
12
+ */function getBuildInfo(context){const url=_path.default.resolve(context,".build-info");return JSON.parse(_fs.default.readFileSync(url))}/**
13
13
  * Attempts to read from disk the named chunk groups mapping generated
14
14
  * by Webpack during the compilation.
15
15
  * It will not work for development builds, where these stats should be captured
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.js","names":["_fs","_interopRequireDefault","require","_path","_stream","_zlib","_winston","_reactGlobalState","_jsUtils","_lodash","_config","_nodeForge","_server","_reactHelmet","_server2","_serializeJavascript","_buildInfo","_Cache","_jsxRuntime","sanitizedConfig","omit","config","SCRIPT_LOCATIONS","BODY_OPEN","DEFAULT","HEAD_OPEN","exports","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","setBuildInfo","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","chunkGroups","webpackStats","locals","mapValues","toJson","namedChunkGroups","item","assets","map","name","App","Application","ssrContext","state","cloneDeep","chunks","stream","ssrStart","Date","now","renderPass","pipeableStream","renderToPipeableStream","jsx","GlobalStateProvider","children","StaticRouter","onAllReady","onError","ssrRound","bailed","dirty","timeout","race","allSettled","pending","timer","then","logMsg","log","pipe","Writable","write","chunk","_","Helmet","renderStatic","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 fs from 'fs';\nimport path from 'path';\n\nimport { Writable } from 'stream';\nimport { brotliCompress, brotliDecompress } from 'zlib';\nimport winston from 'winston';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\nimport { timer } from '@dr.pogodin/js-utils';\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';\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 { setBuildInfo } from 'utils/isomorphy/buildInfo';\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` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; 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 setBuildInfo(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 // Gets the mapping between code chunk names and their asset files.\n // These data come from the Webpack compilation, either from the stats\n // attached to the request (in dev mode), or from a file output during\n // the build (in prod mode).\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 /* 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 chunkGroups,\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 /* 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 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 <meta itemprop=\"drpruinj\" content=\"${INJ}\">\n </head>\n <body>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.BODY_OPEN]}\n <div id=\"react-view\">${App || ''}</div>\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,IAAAA,GAAA,CAAAC,sBAAA,CAAAC,OAAA,QACA,IAAAC,KAAA,CAAAF,sBAAA,CAAAC,OAAA,UAEA,IAAAE,OAAA,CAAAF,OAAA,WACA,IAAAG,KAAA,CAAAH,OAAA,SACA,IAAAI,QAAA,CAAAL,sBAAA,CA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ACC,SAAS,CAAE;AAC/D,mCAAmC6H,GAAG,EAAI,EAAG;AAC7C,cAAcuD,iBAAkB;AAChC,cAAcE,oBAAoB,CAACvL,gBAAgB,CAACE,OAAO,CAAE;AAC7D;AACA,gBAAgB,CAEV,KAAM,CAAA+F,MAAM,CAAG+B,UAAU,CAAC/B,MAAM,EAAI,GAAG,CACvC,GAAIA,MAAM,GAAK,GAAG,CAAEjF,GAAG,CAACiF,MAAM,CAACA,MAAM,CAAC,CAEtC,GAAIH,QAAQ,EAAIG,MAAM,CAAG,GAAG,CAAE,CAC5B;AACA;AACA,KAAM,IAAI,CAAA7E,OAAO,CAAC,CAACgF,IAAI,CAAEC,MAAM,GAAK,CAClC,GAAAuF,oBAAc,EAACpF,IAAI,CAAE,CAACD,KAAK,CAAEP,MAAM,GAAK,CACtC,GAAIO,KAAK,CAAEF,MAAM,CAACE,KAAK,CAAC,CAAC,IACpB,CACHP,MAAM,CAACa,KAAK,CAAG/E,GAAG,CAAC+E,KAAK,CAAE;AAC1BvB,KAAK,CAAC6F,GAAG,CAAC,CAAEnF,MAAM,CAAEC,MAAO,CAAC,CAAEH,QAAQ,CAAC3E,GAAG,CAAC,CAC3CiF,IAAI,CAAC,CACP,CACF,CAAC,CACH,CAAC,CACH,CAEA;AACA;AACA;AACApF,GAAG,CAACmF,IAAI,CAACK,IAAI,CACf,CAAE,MAAOD,KAAK,CAAE,CACdb,IAAI,CAACa,KAAK,CACZ,CACF,CACF"}
1
+ {"version":3,"file":"renderer.js","names":["_fs","_interopRequireDefault","require","_path","_stream","_zlib","_winston","_reactGlobalState","_jsUtils","_lodash","_config","_nodeForge","_server","_reactHelmet","_server2","_serializeJavascript","_buildInfo","_Cache","_jsxRuntime","sanitizedConfig","omit","config","SCRIPT_LOCATIONS","exports","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","setBuildInfo","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","chunkGroups","webpackStats","locals","mapValues","toJson","namedChunkGroups","item","assets","map","name","App","Application","ssrContext","state","cloneDeep","chunks","stream","ssrStart","Date","now","renderPass","pipeableStream","renderToPipeableStream","jsx","GlobalStateProvider","children","StaticRouter","onAllReady","onError","ssrRound","bailed","dirty","timeout","race","allSettled","pending","timer","then","logMsg","log","pipe","Writable","write","chunk","_","Helmet","renderStatic","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 fs from 'fs';\nimport path from 'path';\n\nimport { Writable } from 'stream';\nimport { brotliCompress, brotliDecompress } from 'zlib';\nimport winston from 'winston';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\nimport { timer } from '@dr.pogodin/js-utils';\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';\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 { setBuildInfo } from 'utils/isomorphy/buildInfo';\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` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; 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 setBuildInfo(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 // Gets the mapping between code chunk names and their asset files.\n // These data come from the Webpack compilation, either from the stats\n // attached to the request (in dev mode), or from a file output during\n // the build (in prod mode).\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 /* 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 chunkGroups,\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 /* 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 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 <meta itemprop=\"drpruinj\" content=\"${INJ}\">\n </head>\n <body>\n ${grouppedExtraScripts[SCRIPT_LOCATIONS.BODY_OPEN]}\n <div id=\"react-view\">${App || ''}</div>\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,IAAAA,GAAA,CAAAC,sBAAA,CAAAC,OAAA,QACA,IAAAC,KAAA,CAAAF,sBAAA,CAAAC,OAAA,UAEA,IAAAE,OAAA,CAAAF,OAAA,WACA,IAAAG,KAAA,CAAAH,OAAA,SACA,IAAAI,QAAA,CAAAL,sBAAA,CAAAC,OAAA,aAEA,IAAAK,iBAAA,CAAAL,OAAA,mCACA,IAAAM,QAAA,CAAAN,OAAA,yBAEA,IAAAO,OAAA,CAAAP,OAAA,WAUA,IAAAQ,OAAA,CAAAT,sBAAA,CAAAC,OAAA,YACA,IAAAS,UAAA,CAAAV,sBAAA,CAAAC,OAAA,gBAEA,IAAAU,OAAA,CAAAV,OAAA,qBACA,IAAAW,YAAA,CAAAX,OAAA,iBACA,IAAAY,QAAA,CAAAZ,OAAA,4BACA,IAAAa,oBAAA,CAAAd,sBAAA,CAAAC,OAAA,0BACA,IAAAc,UAAA,CAAAd,OAAA,wCAEA,IAAAe,MAAA,CAAAhB,sBAAA,CAAAC,OAAA,aAA4B,IAAAgB,WAAA,CAAAhB,OAAA,sBAjC5B;AACA;AACA,GAiCA,KAAM,CAAAiB,eAAe,CAAG,GAAAC,YAAI,EAACC,eAAM,CAAE,QAAQ,CAAC,CAEvC,KAAM,CAAAC,gBAAgB,CAAAC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CAAE;AAC1BvB,KAAK,CAAC6F,GAAG,CAAC,CAAEnF,MAAM,CAAEC,MAAO,CAAC,CAAEH,QAAQ,CAAC3E,GAAG,CAAC,CAC3CiF,IAAI,CAAC,CACP,CACF,CAAC,CACH,CAAC,CACH,CAEA;AACA;AACA;AACApF,GAAG,CAACmF,IAAI,CAACK,IAAI,CACf,CAAE,MAAOD,KAAK,CAAE,CACdb,IAAI,CAACa,KAAK,CACZ,CACF,CACF"}
@@ -30,5 +30,5 @@ const defaultTheme={"context":"KM0v4f","ad":"_3jm1-Q","hoc":"_0plpDL","button":"
30
30
  * or URL.
31
31
  * @param {...any} [props....]
32
32
  * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
33
- */BaseButton.defaultProps={active:false,children:undefined,disabled:false,enforceA:false,onClick:undefined,onMouseDown:undefined,openNewTab:false,replace:false,to:undefined};BaseButton.propTypes={active:_propTypes.default.bool,children:_propTypes.default.node,disabled:_propTypes.default.bool,enforceA:_propTypes.default.bool,onClick:_propTypes.default.func,onMouseDown:_propTypes.default.func,openNewTab:_propTypes.default.bool,replace:_propTypes.default.bool,theme:ThemedButton.themeType.isRequired,to:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.string])};var _default=ThemedButton;exports.default=_default;
33
+ */BaseButton.defaultProps={active:false,children:undefined,disabled:false,enforceA:false,onClick:undefined,onMouseDown:undefined,openNewTab:false,replace:false,to:undefined};BaseButton.propTypes={active:_propTypes.default.bool,children:_propTypes.default.node,disabled:_propTypes.default.bool,enforceA:_propTypes.default.bool,onClick:_propTypes.default.func,onMouseDown:_propTypes.default.func,openNewTab:_propTypes.default.bool,replace:_propTypes.default.bool,theme:ThemedButton.themeType.isRequired,to:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.string])};var _default=exports.default=ThemedButton;
34
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_Link","_utils","_jsxRuntime","defaultTheme","BaseButton","active","children","disabled","enforceA","onClick","onMouseDown","openNewTab","replace","theme","to","className","button","jsx","default","onKeyDown","role","tabIndex","ThemedButton","themed","defaultProps","undefined","propTypes","PT","bool","node","func","themeType","isRequired","oneOfType","object","string","_default","exports"],"sources":["../../../../../src/shared/components/Button/index.jsx"],"sourcesContent":["// The <Button> component implements a standard button / button-like link.\n\nimport PT from 'prop-types';\n\nimport Link from 'components/Link';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './style.scss';\n\nfunction BaseButton({\n active,\n children,\n disabled,\n enforceA,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n theme,\n to,\n}) {\n let className = theme.button;\n if (active && theme.active) className += ` ${theme.active}`;\n if (disabled) {\n if (theme.disabled) className += ` ${theme.disabled}`;\n return (\n <div className={className}>\n {children}\n </div>\n );\n }\n if (to) {\n return (\n <Link\n className={className}\n enforceA={enforceA}\n onClick={onClick}\n onMouseDown={onMouseDown}\n openNewTab={openNewTab}\n replace={replace}\n to={to}\n >\n {children}\n </Link>\n );\n }\n return (\n <div\n className={className}\n onClick={onClick}\n onKeyDown={onClick}\n onMouseDown={onMouseDown}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Button component theme: a map of CSS\n * class names to append to button elements:\n * @prop {string} [active] to the root element of active button.\n * @prop {string} [button] to the root element of any button.\n * @prop {string} [disabled] to the root element of disabled button.\n */\nconst ThemedButton = themed('Button', [\n 'active',\n 'button',\n 'disabled',\n], defaultTheme)(BaseButton);\n\n/**\n * Implements themeable buttons, and button-line links (elements which look\n * like buttons, but behave as links) in the same uniform manner.\n * @param {object} [props] Component props.\n * @param {boolean} [props.active] Set `true` to render the button as\n * active, even if it is not active otherwise.\n * @param {boolean} [props.disabled] Set `true` to disable the button.\n * @param {boolean} [props.enforceA] When the button is rendered as `<Link>`\n * component, this prop enforces it to be rendered as a simple `<a>` element\n * (external link), rather than the React router's internal link.\n * See `<Link>` documentation to learn when links are rendered as `<a>`\n * by default.\n * @param {function} [props.onClick] Click event handler.\n * @param {function} [props.onMouseDown] Mouse down event handler.\n * @param {boolean} [props.openNewTab] Set `true` to open link in the new tab.\n * @param {boolean} [props.replace] When the button is rendered as\n * `<Link>`, and the target URL is internal, this property tells that\n * the new route should replace the last record in the browser's history,\n * rather than to be pushed as a new entry into the history stack.\n * @param {ButtonTheme} [props.theme] _Ad hoc_ button theme.\n * @param {object|string} [props.to] If specified, the button will be rendered\n * as `<Link>` (if not disabled), and it will point to the specified location\n * or URL.\n * @param {...any} [props....]\n * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nBaseButton.defaultProps = {\n active: false,\n children: undefined,\n disabled: false,\n enforceA: false,\n onClick: undefined,\n onMouseDown: undefined,\n openNewTab: false,\n replace: false,\n to: undefined,\n};\n\nBaseButton.propTypes = {\n active: PT.bool,\n children: PT.node,\n disabled: PT.bool,\n enforceA: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n theme: ThemedButton.themeType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n\nexport default ThemedButton;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,KAAA,CAAAF,sBAAA,CAAAC,OAAA,aAEA,IAAAE,MAAA,CAAAF,OAAA,gBAA+B,IAAAG,WAAA,CAAAH,OAAA,sBAN/B;AAAA,MAAAI,YAAA,6GAUA,QAAS,CAAAC,UAAUA,CAAC,CAClBC,MAAM,CACNC,QAAQ,CACRC,QAAQ,CACRC,QAAQ,CACRC,OAAO,CACPC,WAAW,CACXC,UAAU,CACVC,OAAO,CACPC,KAAK,CACLC,EACF,CAAC,CAAE,CACD,GAAI,CAAAC,SAAS,CAAGF,KAAK,CAACG,MAAM,CAC5B,GAAIX,MAAM,EAAIQ,KAAK,CAACR,MAAM,CAAEU,SAAS,EAAK,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E,KAAK,CACfC,OAAO,CAAEgB,SAAS,CAClBf,WAAW,CAAEe,SAAS,CACtBd,UAAU,CAAE,KAAK,CACjBC,OAAO,CAAE,KAAK,CACdE,EAAE,CAAEW,SACN,CAAC,CAEDrB,UAAU,CAACsB,SAAS,CAAG,CACrBrB,MAAM,CAAEsB,kBAAE,CAACC,IAAI,CACftB,QAAQ,CAAEqB,kBAAE,CAACE,IAAI,CACjBtB,QAAQ,CAAEoB,kBAAE,CAACC,IAAI,CACjBpB,QAAQ,CAAEmB,kBAAE,CAACC,IAAI,CACjBnB,OAAO,CAAEkB,kBAAE,CAACG,IAAI,CAChBpB,WAAW,CAAEiB,kBAAE,CAACG,IAAI,CACpBnB,UAAU,CAAEgB,kBAAE,CAACC,IAAI,CACnBhB,OAAO,CAAEe,kBAAE,CAACC,IAAI,CAChBf,KAAK,CAAES,YAAY,CAACS,SAAS,CAACC,UAAU,CACxClB,EAAE,CAAEa,kBAAE,CAACM,SAAS,CAAC,CAACN,kBAAE,CAACO,MAAM,CAAEP,kBAAE,CAACQ,MAAM,CAAC,CACzC,CAAC,CAAC,IAAAC,QAAA,CAEad,YAAY,CAAAe,OAAA,CAAAnB,OAAA,CAAAkB,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_Link","_utils","_jsxRuntime","defaultTheme","BaseButton","active","children","disabled","enforceA","onClick","onMouseDown","openNewTab","replace","theme","to","className","button","jsx","default","onKeyDown","role","tabIndex","ThemedButton","themed","defaultProps","undefined","propTypes","PT","bool","node","func","themeType","isRequired","oneOfType","object","string","_default","exports"],"sources":["../../../../../src/shared/components/Button/index.jsx"],"sourcesContent":["// The <Button> component implements a standard button / button-like link.\n\nimport PT from 'prop-types';\n\nimport Link from 'components/Link';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './style.scss';\n\nfunction BaseButton({\n active,\n children,\n disabled,\n enforceA,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n theme,\n to,\n}) {\n let className = theme.button;\n if (active && theme.active) className += ` ${theme.active}`;\n if (disabled) {\n if (theme.disabled) className += ` ${theme.disabled}`;\n return (\n <div className={className}>\n {children}\n </div>\n );\n }\n if (to) {\n return (\n <Link\n className={className}\n enforceA={enforceA}\n onClick={onClick}\n onMouseDown={onMouseDown}\n openNewTab={openNewTab}\n replace={replace}\n to={to}\n >\n {children}\n </Link>\n );\n }\n return (\n <div\n className={className}\n onClick={onClick}\n onKeyDown={onClick}\n onMouseDown={onMouseDown}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Button component theme: a map of CSS\n * class names to append to button elements:\n * @prop {string} [active] to the root element of active button.\n * @prop {string} [button] to the root element of any button.\n * @prop {string} [disabled] to the root element of disabled button.\n */\nconst ThemedButton = themed('Button', [\n 'active',\n 'button',\n 'disabled',\n], defaultTheme)(BaseButton);\n\n/**\n * Implements themeable buttons, and button-line links (elements which look\n * like buttons, but behave as links) in the same uniform manner.\n * @param {object} [props] Component props.\n * @param {boolean} [props.active] Set `true` to render the button as\n * active, even if it is not active otherwise.\n * @param {boolean} [props.disabled] Set `true` to disable the button.\n * @param {boolean} [props.enforceA] When the button is rendered as `<Link>`\n * component, this prop enforces it to be rendered as a simple `<a>` element\n * (external link), rather than the React router's internal link.\n * See `<Link>` documentation to learn when links are rendered as `<a>`\n * by default.\n * @param {function} [props.onClick] Click event handler.\n * @param {function} [props.onMouseDown] Mouse down event handler.\n * @param {boolean} [props.openNewTab] Set `true` to open link in the new tab.\n * @param {boolean} [props.replace] When the button is rendered as\n * `<Link>`, and the target URL is internal, this property tells that\n * the new route should replace the last record in the browser's history,\n * rather than to be pushed as a new entry into the history stack.\n * @param {ButtonTheme} [props.theme] _Ad hoc_ button theme.\n * @param {object|string} [props.to] If specified, the button will be rendered\n * as `<Link>` (if not disabled), and it will point to the specified location\n * or URL.\n * @param {...any} [props....]\n * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nBaseButton.defaultProps = {\n active: false,\n children: undefined,\n disabled: false,\n enforceA: false,\n onClick: undefined,\n onMouseDown: undefined,\n openNewTab: false,\n replace: false,\n to: undefined,\n};\n\nBaseButton.propTypes = {\n active: PT.bool,\n children: PT.node,\n disabled: PT.bool,\n enforceA: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n theme: ThemedButton.themeType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n\nexport default ThemedButton;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,KAAA,CAAAF,sBAAA,CAAAC,OAAA,aAEA,IAAAE,MAAA,CAAAF,OAAA,gBAA+B,IAAAG,WAAA,CAAAH,OAAA,sBAN/B;AAAA,MAAAI,YAAA,6GAUA,QAAS,CAAAC,UAAUA,CAAC,CAClBC,MAAM,CACNC,QAAQ,CACRC,QAAQ,CACRC,QAAQ,CACRC,OAAO,CACPC,WAAW,CACXC,UAAU,CACVC,OAAO,CACPC,KAAK,CACLC,EACF,CAAC,CAAE,CACD,GAAI,CAAAC,SAAS,CAAGF,KAAK,CAACG,MAAM,CAC5B,GAAIX,MAAM,EAAIQ,KAAK,CAACR,MAAM,CAAEU,SAAS,EAAK,IAAGF,KAAK,CAACR,MAAO,EAAC,CAC3D,GAAIE,QAAQ,CAAE,CACZ,GAAIM,KAAK,CAACN,QAAQ,CAAEQ,SAAS,EAAK,IAAGF,KAAK,CAACN,QAAS,EAAC,CACrD,mBACE,GAAAL,WAAA,CAAAe,GAAA,SAAKF,SAAS,CAAEA,SAAU,CAAAT,QAAA,CACvBA,QAAQ,CACN,CAET,CACA,GAAIQ,EAAE,CAAE,CACN,mBACE,GAAAZ,WAAA,CAAAe,GAAA,EAACjB,KAAA,CAAAkB,OAAI,EACHH,SAAS,CAAEA,SAAU,CACrBP,QAAQ,CAAEA,QAAS,CACnBC,OAAO,CAAEA,OAAQ,CACjBC,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AAI,CACpBnB,UAAU,CAAEgB,kBAAE,CAACC,IAAI,CACnBhB,OAAO,CAAEe,kBAAE,CAACC,IAAI,CAChBf,KAAK,CAAES,YAAY,CAACS,SAAS,CAACC,UAAU,CACxClB,EAAE,CAAEa,kBAAE,CAACM,SAAS,CAAC,CAACN,kBAAE,CAACO,MAAM,CAAEP,kBAAE,CAACQ,MAAM,CAAC,CACzC,CAAC,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAnB,OAAA,CAEaI,YAAY"}
@@ -13,5 +13,5 @@
13
13
  * @param {CheckboxTheme} [props.theme] _Ad hoc_ theme.
14
14
  * @param {...any} [props....]
15
15
  * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties).
16
- */Checkbox.propTypes={checked:_propTypes.default.bool,label:_propTypes.default.string,onChange:_propTypes.default.func,theme:ThemedCheckbox.themeType.isRequired};Checkbox.defaultProps={checked:undefined,label:undefined,onChange:undefined};var _default=ThemedCheckbox;exports.default=_default;
16
+ */Checkbox.propTypes={checked:_propTypes.default.bool,label:_propTypes.default.string,onChange:_propTypes.default.func,theme:ThemedCheckbox.themeType.isRequired};Checkbox.defaultProps={checked:undefined,label:undefined,onChange:undefined};var _default=exports.default=ThemedCheckbox;
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","defaultTheme","Checkbox","checked","label","onChange","theme","jsxs","className","container","children","undefined","jsx","checkbox","type","ThemedCheckbox","themed","propTypes","PT","bool","string","func","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Checkbox/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\nfunction Checkbox({\n checked,\n label,\n onChange,\n theme,\n}) {\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n checked={checked}\n className={theme.checkbox}\n onChange={onChange}\n type=\"checkbox\"\n />\n </div>\n );\n}\n\n/**\n * Checkbox component theme: a map of\n * CSS classes to append to its elements:\n * @prop {string} [checkbox] to the underlying checkbox `<input>` element.\n * @prop {string} [container] to the root checkbox element.\n * @prop {string} [label] to the checkbox label element.\n */\nconst ThemedCheckbox = themed('Checkbox', [\n 'checkbox',\n 'container',\n 'label',\n], defaultTheme)(Checkbox);\n\n/**\n * The `<Checkbox>` component implements themeable checkboxes.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.checked] Checkbox value.\n * @param {string} [props.label] Checkbox label.\n * @param {function} [props.onChange] State change handler.\n * @param {CheckboxTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties).\n */\nCheckbox.propTypes = {\n checked: PT.bool,\n label: PT.string,\n onChange: PT.func,\n theme: ThemedCheckbox.themeType.isRequired,\n};\n\nCheckbox.defaultProps = {\n checked: undefined,\n label: undefined,\n onChange: undefined,\n};\n\nexport default ThemedCheckbox;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,8GAI/B,QAAS,CAAAC,QAAQA,CAAC,CAChBC,OAAO,CACPC,KAAK,CACLC,QAAQ,CACRC,KACF,CAAC,CAAE,CACD,mBACE,GAAAN,WAAA,CAAAO,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAC,QAAA,EAC5BN,KAAK,GAAKO,SAAS,CAAG,IAAI,cAAG,GAAAX,WAAA,CAAAY,GAAA,OAAGJ,SAAS,CAAEF,KAAK,CAACF,KAAM,CAAAM,QAAA,CAAEN,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAY,GAAA,WACET,OAAO,CAAEA,OAAQ,CACjBK,SAAS,CAAEF,KAAK,CAACO,QAAS,CAC1BR,QAAQ,CAAEA,QAAS,CACnBS,IAAI,CAAC,UAAU,CAChB,CAAC,EACC,CAET,CAEA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,cAAc,CAAG,GAAAC,aAAM,EAAC,UAAU,CAAE,CACxC,UAAU,CACV,WAAW,CACX,OAAO,CACR,CAAEf,YAAY,CAAC,CAACC,QAAQ,CAAC,CAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACAA,QAAQ,CAACe,SAAS,CAAG,CACnBd,OAAO,CAAEe,kBAAE,CAACC,IAAI,CAChBf,KAAK,CAAEc,kBAAE,CAACE,MAAM,CAChBf,QAAQ,CAAEa,kBAAE,CAACG,IAAI,CACjBf,KAAK,CAAES,cAAc,CAACO,SAAS,CAACC,UAClC,CAAC,CAEDrB,QAAQ,CAACsB,YAAY,CAAG,CACtBrB,OAAO,CAAEQ,SAAS,CAClBP,KAAK,CAAEO,SAAS,CAChBN,QAAQ,CAAEM,SACZ,CAAC,CAAC,IAAAc,QAAA,CAEaV,cAAc,CAAAW,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","defaultTheme","Checkbox","checked","label","onChange","theme","jsxs","className","container","children","undefined","jsx","checkbox","type","ThemedCheckbox","themed","propTypes","PT","bool","string","func","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Checkbox/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\nfunction Checkbox({\n checked,\n label,\n onChange,\n theme,\n}) {\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n checked={checked}\n className={theme.checkbox}\n onChange={onChange}\n type=\"checkbox\"\n />\n </div>\n );\n}\n\n/**\n * Checkbox component theme: a map of\n * CSS classes to append to its elements:\n * @prop {string} [checkbox] to the underlying checkbox `<input>` element.\n * @prop {string} [container] to the root checkbox element.\n * @prop {string} [label] to the checkbox label element.\n */\nconst ThemedCheckbox = themed('Checkbox', [\n 'checkbox',\n 'container',\n 'label',\n], defaultTheme)(Checkbox);\n\n/**\n * The `<Checkbox>` component implements themeable checkboxes.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.checked] Checkbox value.\n * @param {string} [props.label] Checkbox label.\n * @param {function} [props.onChange] State change handler.\n * @param {CheckboxTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties).\n */\nCheckbox.propTypes = {\n checked: PT.bool,\n label: PT.string,\n onChange: PT.func,\n theme: ThemedCheckbox.themeType.isRequired,\n};\n\nCheckbox.defaultProps = {\n checked: undefined,\n label: undefined,\n onChange: undefined,\n};\n\nexport default ThemedCheckbox;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,8GAI/B,QAAS,CAAAC,QAAQA,CAAC,CAChBC,OAAO,CACPC,KAAK,CACLC,QAAQ,CACRC,KACF,CAAC,CAAE,CACD,mBACE,GAAAN,WAAA,CAAAO,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAC,QAAA,EAC5BN,KAAK,GAAKO,SAAS,CAAG,IAAI,cAAG,GAAAX,WAAA,CAAAY,GAAA,OAAGJ,SAAS,CAAEF,KAAK,CAACF,KAAM,CAAAM,QAAA,CAAEN,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAY,GAAA,WACET,OAAO,CAAEA,OAAQ,CACjBK,SAAS,CAAEF,KAAK,CAACO,QAAS,CAC1BR,QAAQ,CAAEA,QAAS,CACnBS,IAAI,CAAC,UAAU,CAChB,CAAC,EACC,CAET,CAEA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,cAAc,CAAG,GAAAC,aAAM,EAAC,UAAU,CAAE,CACxC,UAAU,CACV,WAAW,CACX,OAAO,CACR,CAAEf,YAAY,CAAC,CAACC,QAAQ,CAAC,CAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACAA,QAAQ,CAACe,SAAS,CAAG,CACnBd,OAAO,CAAEe,kBAAE,CAACC,IAAI,CAChBf,KAAK,CAAEc,kBAAE,CAACE,MAAM,CAChBf,QAAQ,CAAEa,kBAAE,CAACG,IAAI,CACjBf,KAAK,CAAES,cAAc,CAACO,SAAS,CAACC,UAClC,CAAC,CAEDrB,QAAQ,CAACsB,YAAY,CAAG,CACtBrB,OAAO,CAAEQ,SAAS,CAClBP,KAAK,CAAEO,SAAS,CAChBN,QAAQ,CAAEM,SACZ,CAAC,CAAC,IAAAc,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaZ,cAAc"}
@@ -20,5 +20,5 @@
20
20
  // any valid option. In Chrome, and some other browsers, we are able to hide
21
21
  // it from the opened dropdown; in others, e.g. Safari, the best we can do is
22
22
  // to show it as disabled.
23
- const hiddenOption=isValidValue?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("option",{disabled:true,className:theme.hiddenOption,value:value,children:value},"__reactUtilsHiddenOption");return/*#__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.jsxs)("select",{className:theme.select,onChange:onChange,value:value,children:[hiddenOption,optionElements]}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.arrow,children:"\u25BC"})]})}const ThemedDropdown=(0,_utils.themed)("Dropdown",["arrow","container","hiddenOption","label","option","select"],defaultTheme)(Dropdown);Dropdown.propTypes={filter:_propTypes.default.func,label:_propTypes.default.string,onChange:_propTypes.default.func,options:_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({name:_propTypes.default.node,value:_propTypes.default.string.isRequired}),_propTypes.default.string]).isRequired),theme:ThemedDropdown.themeType.isRequired,value:_propTypes.default.string};Dropdown.defaultProps={filter:undefined,label:undefined,onChange:undefined,options:[],value:""};var _default=ThemedDropdown;exports.default=_default;
23
+ const hiddenOption=isValidValue?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("option",{disabled:true,className:theme.hiddenOption,value:value,children:value},"__reactUtilsHiddenOption");return/*#__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.jsxs)("select",{className:theme.select,onChange:onChange,value:value,children:[hiddenOption,optionElements]}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.arrow,children:"\u25BC"})]})}const ThemedDropdown=(0,_utils.themed)("Dropdown",["arrow","container","hiddenOption","label","option","select"],defaultTheme)(Dropdown);Dropdown.propTypes={filter:_propTypes.default.func,label:_propTypes.default.string,onChange:_propTypes.default.func,options:_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({name:_propTypes.default.node,value:_propTypes.default.string.isRequired}),_propTypes.default.string]).isRequired),theme:ThemedDropdown.themeType.isRequired,value:_propTypes.default.string};Dropdown.defaultProps={filter:undefined,label:undefined,onChange:undefined,options:[],value:""};var _default=exports.default=ThemedDropdown;
24
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","defaultTheme","Dropdown","filter","label","onChange","options","theme","value","isValidValue","optionElements","i","length","option","optionValue","optionName","name","undefined","push","jsx","className","children","hiddenOption","disabled","jsxs","container","select","arrow","ThemedDropdown","themed","propTypes","PT","func","string","arrayOf","oneOfType","shape","node","isRequired","themeType","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Dropdown/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Implements a themeable dropdown list. Internally it is rendered with help of\n * the standard HTML `<select>` element, thus the styling support is somewhat\n * limited.\n * @param {object} [props] Component properties.\n * @param {function} [props.filter] Options filter function. If provided, only\n * those elements of `options` list will be used by the dropdown, for which this\n * filter returns `true`.\n * @param {string} [props.label] Dropdown label.\n * @param {string} [props.onChange] Selection event handler.\n * @param {DropdownOption[]|string[]} [props.options=[]] Array of dropdown\n * options. For string elements the option value and name will be the same.\n * It is allowed to mix DropdownOption and string elements in the same option\n * list.\n * @param {DropdownTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.value] Currently selected value.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Dropdown({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) {\n let isValidValue = false;\n const optionElements = [];\n\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const optionValue = typeof option === 'string' ? option : option.value;\n const optionName = option.name === undefined ? optionValue : option.name;\n isValidValue ||= optionValue === value;\n optionElements.push(\n <option className={theme.option} key={optionValue} value={optionValue}>\n {optionName}\n </option>,\n );\n }\n }\n\n // NOTE: This element represents the current `value` when it does not match\n // any valid option. In Chrome, and some other browsers, we are able to hide\n // it from the opened dropdown; in others, e.g. Safari, the best we can do is\n // to show it as disabled.\n const hiddenOption = isValidValue ? null : (\n <option\n disabled\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n value={value}\n >\n {value}\n </option>\n );\n\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {hiddenOption}\n {optionElements}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n}\n\nconst ThemedDropdown = themed('Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme)(Dropdown);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.node,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: '',\n};\n\nexport default ThemedDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,uKAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,QAAQA,CAAC,CAChBC,MAAM,CACNC,KAAK,CACLC,QAAQ,CACRC,OAAO,CACPC,KAAK,CACLC,KACF,CAAC,CAAE,CACD,GAAI,CAAAC,YAAY,CAAG,KAAK,CACxB,KAAM,CAAAC,cAAc,CAAG,EAAE,CAEzB,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGL,OAAO,CAACM,MAAM,CAAE,EAAED,CAAC,CAAE,CACvC,KAAM,CAAAE,MAAM,CAAGP,OAAO,CAACK,CAAC,CAAC,CACzB,GAAI,CAACR,MAAM,EAAIA,MAAM,CAACU,MAAM,CAAC,CAAE,CAC7B,KAAM,CAAAC,WAAW,CAAG,MAAO,CAAAD,MAAM,GAAK,QAAQ,CAAGA,MAAM,CAAGA,MAAM,CAACL,KAAK,CACtE,KAAM,CAAAO,UAAU,CAAGF,MAAM,CAACG,IAAI,GAAKC,SAAS,CAAGH,WAAW,CAAGD,MAAM,CAACG,IAAI,CACxEP,YA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,CAACC,IAAI,CACf5B,KAAK,CAAE2B,kBAAE,CAACE,MAAM,CAChB5B,QAAQ,CAAE0B,kBAAE,CAACC,IAAI,CACjB1B,OAAO,CAAEyB,kBAAE,CAACG,OAAO,CACjBH,kBAAE,CAACI,SAAS,CAAC,CACXJ,kBAAE,CAACK,KAAK,CAAC,CACPpB,IAAI,CAAEe,kBAAE,CAACM,IAAI,CACb7B,KAAK,CAAEuB,kBAAE,CAACE,MAAM,CAACK,UACnB,CAAC,CAAC,CACFP,kBAAE,CAACE,MAAM,CACV,CAAC,CAACK,UACL,CAAC,CACD/B,KAAK,CAAEqB,cAAc,CAACW,SAAS,CAACD,UAAU,CAC1C9B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED/B,QAAQ,CAACsC,YAAY,CAAG,CACtBrC,MAAM,CAAEc,SAAS,CACjBb,KAAK,CAAEa,SAAS,CAChBZ,QAAQ,CAAEY,SAAS,CACnBX,OAAO,CAAE,EAAE,CACXE,KAAK,CAAE,EACT,CAAC,CAAC,IAAAiC,QAAA,CAEab,cAAc,CAAAc,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","defaultTheme","Dropdown","filter","label","onChange","options","theme","value","isValidValue","optionElements","i","length","option","optionValue","optionName","name","undefined","push","jsx","className","children","hiddenOption","disabled","jsxs","container","select","arrow","ThemedDropdown","themed","propTypes","PT","func","string","arrayOf","oneOfType","shape","node","isRequired","themeType","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Dropdown/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Implements a themeable dropdown list. Internally it is rendered with help of\n * the standard HTML `<select>` element, thus the styling support is somewhat\n * limited.\n * @param {object} [props] Component properties.\n * @param {function} [props.filter] Options filter function. If provided, only\n * those elements of `options` list will be used by the dropdown, for which this\n * filter returns `true`.\n * @param {string} [props.label] Dropdown label.\n * @param {string} [props.onChange] Selection event handler.\n * @param {DropdownOption[]|string[]} [props.options=[]] Array of dropdown\n * options. For string elements the option value and name will be the same.\n * It is allowed to mix DropdownOption and string elements in the same option\n * list.\n * @param {DropdownTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.value] Currently selected value.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Dropdown({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) {\n let isValidValue = false;\n const optionElements = [];\n\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const optionValue = typeof option === 'string' ? option : option.value;\n const optionName = option.name === undefined ? optionValue : option.name;\n isValidValue ||= optionValue === value;\n optionElements.push(\n <option className={theme.option} key={optionValue} value={optionValue}>\n {optionName}\n </option>,\n );\n }\n }\n\n // NOTE: This element represents the current `value` when it does not match\n // any valid option. In Chrome, and some other browsers, we are able to hide\n // it from the opened dropdown; in others, e.g. Safari, the best we can do is\n // to show it as disabled.\n const hiddenOption = isValidValue ? null : (\n <option\n disabled\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n value={value}\n >\n {value}\n </option>\n );\n\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {hiddenOption}\n {optionElements}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n}\n\nconst ThemedDropdown = themed('Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme)(Dropdown);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.node,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: '',\n};\n\nexport default ThemedDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,uKAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,QAAQA,CAAC,CAChBC,MAAM,CACNC,KAAK,CACLC,QAAQ,CACRC,OAAO,CACPC,KAAK,CACLC,KACF,CAAC,CAAE,CACD,GAAI,CAAAC,YAAY,CAAG,KAAK,CACxB,KAAM,CAAAC,cAAc,CAAG,EAAE,CAEzB,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGL,OAAO,CAACM,MAAM,CAAE,EAAED,CAAC,CAAE,CACvC,KAAM,CAAAE,MAAM,CAAGP,OAAO,CAACK,CAAC,CAAC,CACzB,GAAI,CAACR,MAAM,EAAIA,MAAM,CAACU,MAAM,CAAC,CAAE,CAC7B,KAAM,CAAAC,WAAW,CAAG,MAAO,CAAAD,MAAM,GAAK,QAAQ,CAAGA,MAAM,CAAGA,MAAM,CAACL,KAAK,CACtE,KAAM,CAAAO,UAAU,CAAGF,MAAM,CAACG,IAAI,GAAKC,SAAS,CAAGH,WAAW,CAAGD,MAAM,CAACG,IAAI,CACxEP,YAAY,GAAKK,WAAW,GAAKN,KAAK,CACtCE,cAAc,CAACQ,IAAI,cACjB,GAAAlB,WAAA,CAAAmB,GAAA,YAAQC,SAAS,CAAEb,KAAK,CAACM,MAAO,CAAmBL,KAAK,CAAEM,WAAY,CAAAO,QAAA,CACnEN,UAAU,EADyBD,WAE9B,CACV,CACF,CACF,CAEA;AACA;AACA;AACA;AACA,KAAM,CAAAQ,YAAY,CA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EuB,kBAAE,CAACE,MAAM,CAACK,UACnB,CAAC,CAAC,CACFP,kBAAE,CAACE,MAAM,CACV,CAAC,CAACK,UACL,CAAC,CACD/B,KAAK,CAAEqB,cAAc,CAACW,SAAS,CAACD,UAAU,CAC1C9B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED/B,QAAQ,CAACsC,YAAY,CAAG,CACtBrC,MAAM,CAAEc,SAAS,CACjBb,KAAK,CAAEa,SAAS,CAChBZ,QAAQ,CAAEY,SAAS,CACnBX,OAAO,CAAE,EAAE,CACXE,KAAK,CAAE,EACT,CAAC,CAAC,IAAAiC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaf,cAAc"}
@@ -6,5 +6,5 @@
6
6
  * @param {...any} [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
7
7
  * @param {...any} [props...] Any other properties are passed to the underlying
8
8
  * `<input>` element.
9
- */const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{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;
9
+ */const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{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=exports.default=ThemedInput;
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_jsxRuntime","defaultTheme","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","string","themeType","isRequired","defaultProps","_default","exports","default"],"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 <span 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 </span>\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,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,MAAA,CAAAF,OAAA,gBAA+B,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,2GAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,KAAK,cAAG,GAAAC,iBAAU,EAAC,CAAC,CACxBC,KAAK,CACLC,KAAK,CACL,GAAGC,IACL,CAAC,CAAEC,GAAG,gBACJ,GAAAP,WAAA,CAAAQ,IAAA,UAAMC,SAAS,CAAEJ,KAAK,CAACK,SAAU,CAAAC,QAAA,EAC7BP,KAAK,GAAKQ,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,OAAGJ,SAAS,CAAEJ,KAAK,CAACD,KAAM,CAAAO,QAAA,CAAEP,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAa,GAAA,WACEJ,SAAS,CAAEJ,KAAK,CAACS,KAAM,CACvBP,GAAG,CAAEA,GAAI,IACLD,IAAI,CACT,CAAC,EACE,CACP,CAAC,CAEF,KAAM,CAAAS,WAAW,CAAG,GAAAC,aAAM,EAAC,OAAO,CAAE,CAClC,WAAW,CACX,OAAO,CACP,OAAO,CACR,CAAEf,YAAY,CAAC,CAACC,KAAK,CAAC,CAEvBA,KAAK,CAACe,SAAS,CAAG,CAChBb,KAAK,CAAEc,kBAAE,CAACC,MAAM,CAChBd,KAAK,CAAEU,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDnB,KAAK,CAACoB,YAAY,CAAG,CACnBlB,KAAK,CAAEQ,SACT,CAAC,CAAC,IAAAW,QAAA,CAEaR,WAAW,CAAAS,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_jsxRuntime","defaultTheme","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","string","themeType","isRequired","defaultProps","_default","exports","default"],"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 <span 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 </span>\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,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,MAAA,CAAAF,OAAA,gBAA+B,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,2GAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,KAAK,cAAG,GAAAC,iBAAU,EAAC,CAAC,CACxBC,KAAK,CACLC,KAAK,CACL,GAAGC,IACL,CAAC,CAAEC,GAAG,gBACJ,GAAAP,WAAA,CAAAQ,IAAA,UAAMC,SAAS,CAAEJ,KAAK,CAACK,SAAU,CAAAC,QAAA,EAC7BP,KAAK,GAAKQ,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,OAAGJ,SAAS,CAAEJ,KAAK,CAACD,KAAM,CAAAO,QAAA,CAAEP,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAa,GAAA,WACEJ,SAAS,CAAEJ,KAAK,CAACS,KAAM,CACvBP,GAAG,CAAEA,GAAI,IACLD,IAAI,CACT,CAAC,EACE,CACP,CAAC,CAEF,KAAM,CAAAS,WAAW,CAAG,GAAAC,aAAM,EAAC,OAAO,CAAE,CAClC,WAAW,CACX,OAAO,CACP,OAAO,CACR,CAAEf,YAAY,CAAC,CAACC,KAAK,CAAC,CAEvBA,KAAK,CAACe,SAAS,CAAG,CAChBb,KAAK,CAAEc,kBAAE,CAACC,MAAM,CAChBd,KAAK,CAAEU,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDnB,KAAK,CAACoB,YAAY,CAAG,CACnBlB,KAAK,CAAEQ,SACT,CAAC,CAAC,IAAAW,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaV,WAAW"}
@@ -8,5 +8,5 @@
8
8
  * clicks outside the modal, or presses Escape. It is expected to hide the
9
9
  * modal.
10
10
  * @param {ModalTheme} [props.theme] _Ad hoc_ theme.
11
- */function BaseModal({children,onCancel,theme}){const containerRef=(0,_react.useRef)();const overlayRef=(0,_react.useRef)();const[portal,setPortal]=(0,_react.useState)();(0,_react.useEffect)(()=>{const p=document.createElement("div");document.body.classList.add("scrolling-disabled-by-modal");document.body.appendChild(p);setPortal(p);return()=>{document.body.classList.remove("scrolling-disabled-by-modal");document.body.removeChild(p)}},[]);const focusLast=(0,_react.useMemo)(()=>/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{const elems=containerRef.current.querySelectorAll("*");for(let i=elems.length-1;i>=0;--i){elems[i].focus();if(document.activeElement===elems[i])return}overlayRef.current.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:"0"/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),[]);return portal?/*#__PURE__*/_reactDom.default.createPortal(/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[focusLast,/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-label":"Cancel",className:theme.overlay,onClick:()=>onCancel(),onKeyDown:e=>{if(e.key==="Escape")onCancel()},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus()}},role:"button",tabIndex:"0"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-modal":"true",className:theme.container,onWheel:event=>event.stopPropagation(),ref:containerRef,role:"dialog",children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{overlayRef.current.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:"0"/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),focusLast]}),portal):null}const ThemedModal=(0,_reactThemes.default)("Modal",["container","overlay"],baseTheme)(BaseModal);BaseModal.propTypes={onCancel:_propTypes.default.func,children:_propTypes.default.node,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={onCancel:_lodash.noop,children:null};var _default=ThemedModal;/* Non-themed version of the Modal. */exports.default=_default;
11
+ */function BaseModal({children,onCancel,theme}){const containerRef=(0,_react.useRef)();const overlayRef=(0,_react.useRef)();const[portal,setPortal]=(0,_react.useState)();(0,_react.useEffect)(()=>{const p=document.createElement("div");document.body.classList.add("scrolling-disabled-by-modal");document.body.appendChild(p);setPortal(p);return()=>{document.body.classList.remove("scrolling-disabled-by-modal");document.body.removeChild(p)}},[]);const focusLast=(0,_react.useMemo)(()=>/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{const elems=containerRef.current.querySelectorAll("*");for(let i=elems.length-1;i>=0;--i){elems[i].focus();if(document.activeElement===elems[i])return}overlayRef.current.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:"0"/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),[]);return portal?/*#__PURE__*/_reactDom.default.createPortal(/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[focusLast,/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-label":"Cancel",className:theme.overlay,onClick:()=>onCancel(),onKeyDown:e=>{if(e.key==="Escape")onCancel()},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus()}},role:"button",tabIndex:"0"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-modal":"true",className:theme.container,onWheel:event=>event.stopPropagation(),ref:containerRef,role:"dialog",children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{overlayRef.current.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:"0"/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),focusLast]}),portal):null}const ThemedModal=(0,_reactThemes.default)("Modal",["container","overlay"],baseTheme)(BaseModal);BaseModal.propTypes={onCancel:_propTypes.default.func,children:_propTypes.default.node,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={onCancel:_lodash.noop,children:null};var _default=exports.default=ThemedModal;/* Non-themed version of the Modal. */
12
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","exports","default"],"sources":["../../../../../src/shared/components/Modal/index.jsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nfunction BaseModal({\n children,\n onCancel,\n theme,\n}) {\n const containerRef = useRef();\n const overlayRef = useRef();\n const [portal, setPortal] = useState();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex=\"0\"\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n}\n\nconst ThemedModal = themed(\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n)(BaseModal);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"4MAEA,IAAAA,OAAA,CAAAC,OAAA,WAEA,IAAAC,MAAA,CAAAD,OAAA,UAOA,IAAAE,SAAA,CAAAC,sBAAA,CAAAH,OAAA,eACA,IAAAI,UAAA,CAAAD,sBAAA,CAAAH,OAAA,gBACA,IAAAK,YAAA,CAAAF,sBAAA,CAAAH,OAAA,8BAA8C,IAAAM,WAAA,CAAAN,OAAA,sBAb9C,2BAAAO,SAAA,2FAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,SAASA,CAAC,CACjBC,QAAQ,CACRC,QAAQ,CACRC,KACF,CAAC,CAAE,CACD,KAAM,CAAAC,YAAY,CAAG,GAAAC,aAAM,EAAC,CAAC,CAC7B,KAAM,CAAAC,UAAU,CAAG,GAAAD,aAAM,EAAC,CAAC,CAC3B,KAAM,CAACE,MAAM,CAAEC,SAAS,CAAC,CAAG,GAAAC,eAAQ,EAAC,CAAC,CAEtC,GAAAC,gBAAS,EAAC,IAAM,CACd,KAAM,CAAAC,CAAC,CAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CACvCD,QAAQ,CAACE,IAAI,CAACC,SAAS,CAACC,GAAG,CAAC,6BAA6B,CAAC,CAC1DJ,QAAQ,CAACE,IAAI,CAACG,WAAW,CAACN,CAAC,CAAC,CAC5BH,SAAS,CAACG,CAAC,CAAC,CACZ,MAAO,IAAM,CACXC,QAAQ,CAACE,IAAI,CAACC,SAAS,CAACG,MAAM,CAAC,6BAA6B,CAAC,CAC7DN,QAAQ,CAACE,IAAI,CAACK,WAAW,CAACR,CAAC,CAC7B,CACF,CAAC,CAAE,EAAE,CAAC,CAEN,KAAM,CAAAS,SAAS,CAA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AAW,MAAM,CACjBc,SAAS,CAAEjC,KAAK,CAAC0C,SAAU,CAC3BC,OAAO,CAAGC,KAAK,EAAKA,KAAK,CAACC,eAAe,CAAC,CAAE,CAC5CN,GAAG,CAAEtC,YAAa,CAClBwC,IAAI,CAAC,QAAQ,CAAA3C,QAAA,CAEZA,QAAQ,CACN,CAAC,cACN,GAAAH,WAAA,CAAAwB,GAAA,SACEC,OAAO,CAAEA,CAAA,GAAM,CACbjB,UAAU,CAACmB,OAAO,CAACI,KAAK,CAAC,CAC3B,CACA,yDACAE,QAAQ,CAAC,GACT,wDACD,CAAC,CACDX,SAAS,EACV,CAAC,CAELb,MACF,CAAC,CAAG,IACN,CAEA,KAAM,CAAA0C,WAAW,CAAG,GAAAC,oBAAM,EACxB,OAAO,CACP,CACE,WAAW,CACX,SAAS,CACV,CACDnD,SACF,CAAC,CAACC,SAAS,CAAC,CAEZA,SAAS,CAACmD,SAAS,CAAG,CACpBjD,QAAQ,CAAEkD,kBAAE,CAACC,IAAI,CACjBpD,QAAQ,CAAEmD,kBAAE,CAACT,IAAI,CACjBxC,KAAK,CAAE8C,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDvD,SAAS,CAACwD,YAAY,CAAG,CACvBtD,QAAQ,CAAEuD,YAAI,CACdxD,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAyD,QAAA,CAEaT,WAAW,CAE1B,sCAAAU,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","exports","default"],"sources":["../../../../../src/shared/components/Modal/index.jsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nfunction BaseModal({\n children,\n onCancel,\n theme,\n}) {\n const containerRef = useRef();\n const overlayRef = useRef();\n const [portal, setPortal] = useState();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex=\"0\"\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n}\n\nconst ThemedModal = themed(\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n)(BaseModal);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"4MAEA,IAAAA,OAAA,CAAAC,OAAA,WAEA,IAAAC,MAAA,CAAAD,OAAA,UAOA,IAAAE,SAAA,CAAAC,sBAAA,CAAAH,OAAA,eACA,IAAAI,UAAA,CAAAD,sBAAA,CAAAH,OAAA,gBACA,IAAAK,YAAA,CAAAF,sBAAA,CAAAH,OAAA,8BAA8C,IAAAM,WAAA,CAAAN,OAAA,sBAb9C,2BAAAO,SAAA,2FAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,SAASA,CAAC,CACjBC,QAAQ,CACRC,QAAQ,CACRC,KACF,CAAC,CAAE,CACD,KAAM,CAAAC,YAAY,CAAG,GAAAC,aAAM,EAAC,CAAC,CAC7B,KAAM,CAAAC,UAAU,CAAG,GAAAD,aAAM,EAAC,CAAC,CAC3B,KAAM,CAACE,MAAM,CAAEC,SAAS,CAAC,CAAG,GAAAC,eAAQ,EAAC,CAAC,CAEtC,GAAAC,gBAAS,EAAC,IAAM,CACd,KAAM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CAAE,IACZ,CAAC,CAAC,IAAAyD,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaX,WAAW,CAE1B"}
@@ -12,5 +12,5 @@
12
12
  * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.
13
13
  * @param {...any} [props....]
14
14
  * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
15
- */function PageLayout({children,leftSidePanelContent,rightSidePanelContent,theme}){return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.leftSidePanel].join(" "),children:leftSidePanelContent}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.mainPanel,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.rightSidePanel].join(" "),children:rightSidePanelContent})]})}const ThemedPageLayout=(0,_utils.themed)("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],baseTheme)(PageLayout);PageLayout.propTypes={children:_propTypes.default.node,leftSidePanelContent:_propTypes.default.node,rightSidePanelContent:_propTypes.default.node,theme:ThemedPageLayout.themeType.isRequired};PageLayout.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var _default=ThemedPageLayout;exports.default=_default;
15
+ */function PageLayout({children,leftSidePanelContent,rightSidePanelContent,theme}){return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.leftSidePanel].join(" "),children:leftSidePanelContent}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.mainPanel,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.rightSidePanel].join(" "),children:rightSidePanelContent})]})}const ThemedPageLayout=(0,_utils.themed)("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],baseTheme)(PageLayout);PageLayout.propTypes={children:_propTypes.default.node,leftSidePanelContent:_propTypes.default.node,rightSidePanelContent:_propTypes.default.node,theme:ThemedPageLayout.themeType.isRequired};PageLayout.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var _default=exports.default=ThemedPageLayout;
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","baseTheme","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","jsxs","className","container","jsx","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","themed","propTypes","PT","node","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/PageLayout/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport baseTheme from './base-theme.scss';\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction PageLayout({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) {\n return (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n );\n}\n\nconst ThemedPageLayout = themed('PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme)(PageLayout);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent: null,\n};\n\nexport default ThemedPageLayout;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,SAAA,kHAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,UAAUA,CAAC,CAClBC,QAAQ,CACRC,oBAAoB,CACpBC,qBAAqB,CACrBC,KACF,CAAC,CAAE,CACD,mBACE,GAAAN,WAAA,CAAAO,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAN,QAAA,eAC9B,GAAAH,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAE,CAACF,KAAK,CAACK,SAAS,CAAEL,KAAK,CAACM,aAAa,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE,CAAAV,QAAA,CAC9DC,oBAAoB,CAClB,CAAC,cACN,GAAAJ,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAEF,KAAK,CAACQ,SAAU,CAAAX,QAAA,CAC7BA,QAAQ,CACN,CAAC,cACN,GAAAH,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAE,CAACF,KAAK,CAACK,SAAS,CAAEL,KAAK,CAACS,cAAc,CAAC,CAACF,IAAI,CAAC,GAAG,CAAE,CAAAV,QAAA,CAC/DE,qBAAqB,CACnB,CAAC,EACH,CAET,CAEA,KAAM,CAAAW,gBAAgB,CAAG,GAAAC,aAAM,EAAC,YAAY,CAAE,CAC5C,WAAW,CACX,eAAe,CACf,WAAW,CACX,gBAAgB,CAChB,WAAW,CACZ,CAAEhB,SAAS,CAAC,CAACC,UAAU,CAAC,CAEzBA,UAAU,CAACgB,SAAS,CAAG,CACrBf,QAAQ,CAAEgB,kBAAE,CAACC,IAAI,CACjBhB,oBAAoB,CAAEe,kBAAE,CAACC,IAAI,CAC7Bf,qBAAqB,CAAEc,kBAAE,CAACC,IAAI,CAC9Bd,KAAK,CAAEU,gBAAgB,CAACK,SAAS,CAACC,UACpC,CAAC,CAEDpB,UAAU,CAACqB,YAAY,CAAG,CACxBpB,QAAQ,CAAE,IAAI,CACdC,oBAAoB,CAAE,IAAI,CAC1BC,qBAAqB,CAAE,IACzB,CAAC,CAAC,IAAAmB,QAAA,CAEaR,gBAAgB,CAAAS,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","baseTheme","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","jsxs","className","container","jsx","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","themed","propTypes","PT","node","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/PageLayout/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport baseTheme from './base-theme.scss';\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction PageLayout({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) {\n return (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n );\n}\n\nconst ThemedPageLayout = themed('PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme)(PageLayout);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent: null,\n};\n\nexport default ThemedPageLayout;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,SAAA,kHAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,UAAUA,CAAC,CAClBC,QAAQ,CACRC,oBAAoB,CACpBC,qBAAqB,CACrBC,KACF,CAAC,CAAE,CACD,mBACE,GAAAN,WAAA,CAAAO,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAN,QAAA,eAC9B,GAAAH,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAE,CAACF,KAAK,CAACK,SAAS,CAAEL,KAAK,CAACM,aAAa,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE,CAAAV,QAAA,CAC9DC,oBAAoB,CAClB,CAAC,cACN,GAAAJ,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAEF,KAAK,CAACQ,SAAU,CAAAX,QAAA,CAC7BA,QAAQ,CACN,CAAC,cACN,GAAAH,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAE,CAACF,KAAK,CAACK,SAAS,CAAEL,KAAK,CAACS,cAAc,CAAC,CAACF,IAAI,CAAC,GAAG,CAAE,CAAAV,QAAA,CAC/DE,qBAAqB,CACnB,CAAC,EACH,CAET,CAEA,KAAM,CAAAW,gBAAgB,CAAG,GAAAC,aAAM,EAAC,YAAY,CAAE,CAC5C,WAAW,CACX,eAAe,CACf,WAAW,CACX,gBAAgB,CAChB,WAAW,CACZ,CAAEhB,SAAS,CAAC,CAACC,UAAU,CAAC,CAEzBA,UAAU,CAACgB,SAAS,CAAG,CACrBf,QAAQ,CAAEgB,kBAAE,CAACC,IAAI,CACjBhB,oBAAoB,CAAEe,kBAAE,CAACC,IAAI,CAC7Bf,qBAAqB,CAAEc,kBAAE,CAACC,IAAI,CAC9Bd,KAAK,CAAEU,gBAAgB,CAACK,SAAS,CAACC,UACpC,CAAC,CAEDpB,UAAU,CAACqB,YAAY,CAAG,CACxBpB,QAAQ,CAAE,IAAI,CACdC,oBAAoB,CAAE,IAAI,CAC1BC,qBAAqB,CAAE,IACzB,CAAC,CAAC,IAAAmB,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaV,gBAAgB"}
@@ -6,5 +6,5 @@
6
6
  * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.
7
7
  * @param {...any} [props....]
8
8
  * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
9
- */function Throbber({theme}){return/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:(theme.container?theme.container+" ":"")+"_7zdld4",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"})]})}Throbber.defaultProps={theme:{}};Throbber.propTypes={theme:_propTypes.default.shape({container:_propTypes.default.string,circle:_propTypes.default.string})};var _default=(0,_reactThemes.default)("Throbber",["circle","container"],defaultTheme)(Throbber);exports.default=_default;
9
+ */function Throbber({theme}){return/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:(theme.container?theme.container+" ":"")+"_7zdld4",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"})]})}Throbber.defaultProps={theme:{}};Throbber.propTypes={theme:_propTypes.default.shape({container:_propTypes.default.string,circle:_propTypes.default.string})};var _default=exports.default=(0,_reactThemes.default)("Throbber",["circle","container"],defaultTheme)(Throbber);
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","defaultTheme","Throbber","theme","jsxs","className","container","children","jsx","circle","defaultProps","propTypes","PT","shape","string","_default","themed","exports","default"],"sources":["../../../../../src/shared/components/Throbber/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Throbber({\n theme,\n}) {\n return (\n <span className={theme.container} styleName=\"container\">\n <span className={theme.circle} styleName=\"circle\" />\n <span className={theme.circle} styleName=\"circle\" />\n <span className={theme.circle} styleName=\"circle\" />\n </span>\n );\n}\n\nThrobber.defaultProps = {\n theme: {},\n};\n\nThrobber.propTypes = {\n theme: PT.shape({\n container: PT.string,\n circle: PT.string,\n }),\n};\n\nexport default themed('Throbber', [\n 'circle',\n 'container',\n], defaultTheme)(Throbber);\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8C,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,+GAI9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,QAAQA,CAAC,CAChBC,KACF,CAAC,CAAE,CACD,mBACE,GAAAH,WAAA,CAAAI,IAAA,UAAMC,SAAS,EAAEF,KAAK,CAACG,SAAS,CAAfH,KAAK,CAACG,SAAS,kBAAC,CAAAC,QAAA,eAC/B,GAAAP,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,CAAqB,CAAC,cACpD,GAAAT,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,CAAqB,CAAC,cACpD,GAAAT,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,CAAqB,CAAC,EAChD,CAEV,CAEAP,QAAQ,CAACQ,YAAY,CAAG,CACtBP,KAAK,CAAE,CAAC,CACV,CAAC,CAEDD,QAAQ,CAACS,SAAS,CAAG,CACnBR,KAAK,CAAES,kBAAE,CAACC,KAAK,CAAC,CACdP,SAAS,CAAEM,kBAAE,CAACE,MAAM,CACpBL,MAAM,CAAEG,kBAAE,CAACE,MACb,CAAC,CACH,CAAC,CAAC,IAAAC,QAAA,CAEa,GAAAC,oBAAM,EAAC,UAAU,CAAE,CAChC,QAAQ,CACR,WAAW,CACZ,CAAEf,YAAY,CAAC,CAACC,QAAQ,CAAC,CAAAe,OAAA,CAAAC,OAAA,CAAAH,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","defaultTheme","Throbber","theme","jsxs","className","container","children","jsx","circle","defaultProps","propTypes","PT","shape","string","_default","exports","default","themed"],"sources":["../../../../../src/shared/components/Throbber/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Throbber({\n theme,\n}) {\n return (\n <span className={theme.container} styleName=\"container\">\n <span className={theme.circle} styleName=\"circle\" />\n <span className={theme.circle} styleName=\"circle\" />\n <span className={theme.circle} styleName=\"circle\" />\n </span>\n );\n}\n\nThrobber.defaultProps = {\n theme: {},\n};\n\nThrobber.propTypes = {\n theme: PT.shape({\n container: PT.string,\n circle: PT.string,\n }),\n};\n\nexport default themed('Throbber', [\n 'circle',\n 'container',\n], defaultTheme)(Throbber);\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8C,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,+GAI9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,QAAQA,CAAC,CAChBC,KACF,CAAC,CAAE,CACD,mBACE,GAAAH,WAAA,CAAAI,IAAA,UAAMC,SAAS,EAAEF,KAAK,CAACG,SAAS,CAAfH,KAAK,CAACG,SAAS,kBAAC,CAAAC,QAAA,eAC/B,GAAAP,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,CAAqB,CAAC,cACpD,GAAAT,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,CAAqB,CAAC,cACpD,GAAAT,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,CAAqB,CAAC,EAChD,CAEV,CAEAP,QAAQ,CAACQ,YAAY,CAAG,CACtBP,KAAK,CAAE,CAAC,CACV,CAAC,CAEDD,QAAQ,CAACS,SAAS,CAAG,CACnBR,KAAK,CAAES,kBAAE,CAACC,KAAK,CAAC,CACdP,SAAS,CAAEM,kBAAE,CAACE,MAAM,CACpBL,MAAM,CAAEG,kBAAE,CAACE,MACb,CAAC,CACH,CAAC,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEa,GAAAC,oBAAM,EAAC,UAAU,CAAE,CAChC,QAAQ,CACR,WAAW,CACZ,CAAEjB,YAAY,CAAC,CAACC,QAAQ,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * hierarchy, and with sub-components managed without React to achieve the best
4
4
  * performance during animation.
5
5
  */ /* global document, window */ /* Valid placements of the rendered tooltip. They will be overriden when
6
- * necessary to fit the tooltip within the viewport. */const PLACEMENTS={ABOVE_CURSOR:"ABOVE_CURSOR",ABOVE_ELEMENT:"ABOVE_ELEMENT",BELOW_CURSOR:"BELOW_CURSOR",BELOW_ELEMENT:"BELOW_ELEMENT"};exports.PLACEMENTS=PLACEMENTS;const ARROW_STYLE_DOWN=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");const ARROW_STYLE_UP=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");/**
6
+ * necessary to fit the tooltip within the viewport. */const PLACEMENTS=exports.PLACEMENTS={ABOVE_CURSOR:"ABOVE_CURSOR",ABOVE_ELEMENT:"ABOVE_ELEMENT",BELOW_CURSOR:"BELOW_CURSOR",BELOW_ELEMENT:"BELOW_ELEMENT"};const ARROW_STYLE_DOWN=["border-bottom-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");const ARROW_STYLE_UP=["border-top-color:transparent","border-left-color:transparent","border-right-color:transparent"].join(";");/**
7
7
  * Creates tooltip components.
8
8
  * @ignore
9
9
  * @param {object} theme Themes to use for tooltip container, arrow,
@@ -107,5 +107,5 @@ const{current:heap}=(0,_react.useRef)({lastElement:undefined,lastPageX:0,lastPag
107
107
  // happen now just because the mouse movements themselves are not causing
108
108
  // the component re-rendering, thus dependencies of this effect are not
109
109
  // really re-evaluated.
110
- heap.lastPageX,heap.lastPageY,heap.lastPlacement,heap.lastElement]);return components?/*#__PURE__*/(0,_reactDom.createPortal)(children,components.content):null});Tooltip.propTypes={children:_propTypes.default.node,theme:_propTypes.default.shape().isRequired};Tooltip.defaultProps={children:null};var _default=Tooltip;exports.default=_default;
110
+ heap.lastPageX,heap.lastPageY,heap.lastPlacement,heap.lastElement]);return components?/*#__PURE__*/(0,_reactDom.createPortal)(children,components.content):null});Tooltip.propTypes={children:_propTypes.default.node,theme:_propTypes.default.shape().isRequired};Tooltip.defaultProps={children:null};var _default=exports.default=Tooltip;
111
111
  //# sourceMappingURL=Tooltip.js.map