@dr.pogodin/react-utils 1.23.9 → 1.23.11

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 (70) hide show
  1. package/README.md +3 -2
  2. package/build/development/client/getInj.js.map +1 -1
  3. package/build/development/client/index.js.map +1 -1
  4. package/build/development/client/init.js.map +1 -1
  5. package/build/development/index.js.map +1 -1
  6. package/build/development/server/Cache.js.map +1 -1
  7. package/build/development/server/index.js.map +1 -1
  8. package/build/development/server/renderer.js.map +1 -1
  9. package/build/development/server/server.js.map +1 -1
  10. package/build/development/shared/components/Button/index.js.map +1 -1
  11. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  12. package/build/development/shared/components/CodeSplit/index.js.map +1 -1
  13. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  14. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  15. package/build/development/shared/components/Input/index.js.map +1 -1
  16. package/build/development/shared/components/Link.js.map +1 -1
  17. package/build/development/shared/components/MetaTags.js.map +1 -1
  18. package/build/development/shared/components/Modal/index.js.map +1 -1
  19. package/build/development/shared/components/NavLink.js.map +1 -1
  20. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  21. package/build/development/shared/components/ScalableRect/index.js.map +1 -1
  22. package/build/development/shared/components/Throbber/index.js.map +1 -1
  23. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  24. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  25. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  26. package/build/development/shared/utils/config.js.map +1 -1
  27. package/build/development/shared/utils/index.js.map +1 -1
  28. package/build/development/shared/utils/isomorphy/index.js.map +1 -1
  29. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  30. package/build/development/shared/utils/jest/index.js.map +1 -1
  31. package/build/development/shared/utils/splitComponent.js.map +1 -1
  32. package/build/development/shared/utils/time.js.map +1 -1
  33. package/build/development/web.bundle.js +49 -191
  34. package/build/production/client/getInj.js.map +1 -1
  35. package/build/production/client/index.js.map +1 -1
  36. package/build/production/client/init.js.map +1 -1
  37. package/build/production/index.js.map +1 -1
  38. package/build/production/server/Cache.js.map +1 -1
  39. package/build/production/server/index.js +1 -1
  40. package/build/production/server/index.js.map +1 -1
  41. package/build/production/server/renderer.js.map +1 -1
  42. package/build/production/server/server.js.map +1 -1
  43. package/build/production/shared/components/Button/index.js.map +1 -1
  44. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  45. package/build/production/shared/components/CodeSplit/index.js.map +1 -1
  46. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  47. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  48. package/build/production/shared/components/Input/index.js.map +1 -1
  49. package/build/production/shared/components/Link.js.map +1 -1
  50. package/build/production/shared/components/MetaTags.js.map +1 -1
  51. package/build/production/shared/components/Modal/index.js.map +1 -1
  52. package/build/production/shared/components/NavLink.js.map +1 -1
  53. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  54. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  55. package/build/production/shared/components/Throbber/index.js.map +1 -1
  56. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  57. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  58. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  59. package/build/production/shared/utils/config.js.map +1 -1
  60. package/build/production/shared/utils/index.js.map +1 -1
  61. package/build/production/shared/utils/isomorphy/index.js.map +1 -1
  62. package/build/production/shared/utils/jest/E2eSsrEnv.js +1 -1
  63. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  64. package/build/production/shared/utils/jest/index.js.map +1 -1
  65. package/build/production/shared/utils/splitComponent.js.map +1 -1
  66. package/build/production/shared/utils/time.js.map +1 -1
  67. package/build/production/web.bundle.js +1 -1
  68. package/build/production/web.bundle.js.map +1 -1
  69. package/config/webpack/lib-base.js +2 -0
  70. package/package.json +31 -31
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_jsxRuntime","GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","jsx","href","e","preventDefault","rel","target","createElement","window","scroll","defaultProps","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object"],"sources":["../../../../../src/shared/components/GenericLink/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { createElement } from 'react';\n\nimport './style.scss';\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param {object} [props] Component properties.\n * @param {string} [props.className] CSS classes to apply to the link.\n * @param {boolean} [props.disabled] Disables the link.\n * @param {boolean} [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param {boolean} [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param {function} [props.onClick] Event handler to trigger upon click.\n * @param {function} [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param {boolean} [props.openNewTab] If `true` the link opens in a new tab.\n * @param {boolean} [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param {string} [props.to] Link URL.\n * @param {string} [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param {string} [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param {boolean} [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param {function} [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param {object} [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param {boolean} [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nexport default function GenericLink({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || to.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n disabled={disabled}\n href={to}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n /* Otherwise we render the link as React Router's Link or NavLink element. */\n return createElement(routerLinkType, {\n className,\n disabled,\n onMouseDown,\n replace,\n to,\n onClick: (e) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n },\n ...rest,\n }, children);\n}\n\nGenericLink.defaultProps = {\n children: null,\n className: null,\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: null,\n onMouseDown: null,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n"],"mappings":"qLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAA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AAEgB,MAAM,CAACC,MAAM,CAAC,CAAC,CAAE,CAAC,CAC7C,CAAC,CACD,GAAGV,IACL,CAAC,CAAEX,QAAQ,CACb,CAEAD,WAAW,CAACuB,YAAY,CAAG,CACzBtB,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAE,IAAI,CACfC,QAAQ,CAAE,KAAK,CACfC,QAAQ,CAAE,KAAK,CACfC,kBAAkB,CAAE,KAAK,CACzBC,OAAO,CAAE,IAAI,CACbC,WAAW,CAAE,IAAI,CACjBC,UAAU,CAAE,KAAK,CACjBC,OAAO,CAAE,KAAK,CACdE,EAAE,CAAE,EACN,CAAC,CAEDX,WAAW,CAACwB,SAAS,CAAG,CACtBvB,QAAQ,CAAEwB,kBAAE,CAACC,IAAI,CACjBxB,SAAS,CAAEuB,kBAAE,CAACE,MAAM,CACpBxB,QAAQ,CAAEsB,kBAAE,CAACG,IAAI,CACjBxB,QAAQ,CAAEqB,kBAAE,CAACG,IAAI,CACjBvB,kBAAkB,CAAEoB,kBAAE,CAACG,IAAI,CAC3BtB,OAAO,CAAEmB,kBAAE,CAACI,IAAI,CAChBtB,WAAW,CAAEkB,kBAAE,CAACI,IAAI,CACpBrB,UAAU,CAAEiB,kBAAE,CAACG,IAAI,CACnBnB,OAAO,CAAEgB,kBAAE,CAACG,IAAI,CAChBlB,cAAc,CAAEe,kBAAE,CAACK,WAAW,CAACC,UAAU,CACzCpB,EAAE,CAAEc,kBAAE,CAACO,SAAS,CAAC,CAACP,kBAAE,CAACQ,MAAM,CAAER,kBAAE,CAACE,MAAM,CAAC,CACzC,CAAC"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_jsxRuntime","GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","jsx","href","e","preventDefault","rel","target","createElement","window","scroll","defaultProps","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object"],"sources":["../../../../../src/shared/components/GenericLink/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { createElement } from 'react';\n\nimport './style.scss';\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param {object} [props] Component properties.\n * @param {string} [props.className] CSS classes to apply to the link.\n * @param {boolean} [props.disabled] Disables the link.\n * @param {boolean} [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param {boolean} [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param {function} [props.onClick] Event handler to trigger upon click.\n * @param {function} [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param {boolean} [props.openNewTab] If `true` the link opens in a new tab.\n * @param {boolean} [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param {string} [props.to] Link URL.\n * @param {string} [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param {string} [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param {boolean} [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param {function} [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param {object} [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param {boolean} [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nexport default function GenericLink({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || to.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n disabled={disabled}\n href={to}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n /* Otherwise we render the link as React Router's Link or NavLink element. */\n return createElement(routerLinkType, {\n className,\n disabled,\n onMouseDown,\n replace,\n to,\n onClick: (e) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n },\n ...rest,\n }, children);\n}\n\nGenericLink.defaultProps = {\n children: null,\n className: null,\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: null,\n onMouseDown: null,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n"],"mappings":"qLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAAsC,IAAAE,WAAA,CAAAF,OAAA,sBAHtC,oBAOA;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;A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AAQ,CAAE,KAAK,CACfC,kBAAkB,CAAE,KAAK,CACzBC,OAAO,CAAE,IAAI,CACbC,WAAW,CAAE,IAAI,CACjBC,UAAU,CAAE,KAAK,CACjBC,OAAO,CAAE,KAAK,CACdE,EAAE,CAAE,EACN,CAAC,CAEDX,WAAW,CAACwB,SAAS,CAAG,CACtBvB,QAAQ,CAAEwB,kBAAE,CAACC,IAAI,CACjBxB,SAAS,CAAEuB,kBAAE,CAACE,MAAM,CACpBxB,QAAQ,CAAEsB,kBAAE,CAACG,IAAI,CACjBxB,QAAQ,CAAEqB,kBAAE,CAACG,IAAI,CACjBvB,kBAAkB,CAAEoB,kBAAE,CAACG,IAAI,CAC3BtB,OAAO,CAAEmB,kBAAE,CAACI,IAAI,CAChBtB,WAAW,CAAEkB,kBAAE,CAACI,IAAI,CACpBrB,UAAU,CAAEiB,kBAAE,CAACG,IAAI,CACnBnB,OAAO,CAAEgB,kBAAE,CAACG,IAAI,CAChBlB,cAAc,CAAEe,kBAAE,CAACK,WAAW,CAACC,UAAU,CACzCpB,EAAE,CAAEc,kBAAE,CAACO,SAAS,CAAC,CAACP,kBAAE,CAACQ,MAAM,CAAER,kBAAE,CAACE,MAAM,CAAC,CACzC,CAAC"}
@@ -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,EAAK,cACrE,GAAAJ,WAAA,CAAAa,GAAA,WACEJ,SAAS,CAAEJ,KAAK,CAACS,KAAM,CACvBP,GAAG,CAAEA,GAAI,IACLD,IAAI,EACR,GAEL,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,CAEaR,WAAW,CAAAS,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","Link","props","jsx","default","routerLinkType","RrLink"],"sources":["../../../../src/shared/components/Link.jsx"],"sourcesContent":["/**\n * The Link wraps around React Router's Link component, to automatically replace\n * it by the regular <a> element when:\n * - The target reference points to another domain;\n * - User opts to open the reference in a new tab;\n * - User explicitely opts to use <a>.\n */\n\nimport { Link as RrLink } from 'react-router-dom';\n\nimport GenericLink from './GenericLink';\n\nexport default function Link(props) {\n /* eslint-disable react/jsx-props-no-spreading */\n return <GenericLink {...props} routerLinkType={RrLink} />;\n /* eslint-enable react/jsx-props-no-spreading */\n}\n"],"mappings":"8KAQA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAAwC,IAAAG,WAAA,CAAAH,OAAA,sBAVxC;AACA;AACA;AACA;AACA;AACA;AACA,GAMe,QAAS,CAAAI,IAAIA,CAACC,KAAK,CAAE,CAClC,iDACA,mBAAO,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,oBAAO,EAAG,CACzD,gDACF"}
1
+ {"version":3,"file":"Link.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","Link","props","jsx","default","routerLinkType","RrLink"],"sources":["../../../../src/shared/components/Link.jsx"],"sourcesContent":["/**\n * The Link wraps around React Router's Link component, to automatically replace\n * it by the regular <a> element when:\n * - The target reference points to another domain;\n * - User opts to open the reference in a new tab;\n * - User explicitely opts to use <a>.\n */\n\nimport { Link as RrLink } from 'react-router-dom';\n\nimport GenericLink from './GenericLink';\n\nexport default function Link(props) {\n /* eslint-disable react/jsx-props-no-spreading */\n return <GenericLink {...props} routerLinkType={RrLink} />;\n /* eslint-enable react/jsx-props-no-spreading */\n}\n"],"mappings":"8KAQA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAAwC,IAAAG,WAAA,CAAAH,OAAA,sBAVxC;AACA;AACA;AACA;AACA;AACA;AACA,GAMe,QAAS,CAAAI,IAAIA,CAACC,KAAK,CAAE,CAClC,iDACA,mBAAO,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,oBAAO,CAAE,CAAC,CACzD,gDACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"MetaTags.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactHelmet","_jsxRuntime","Context","createContext","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","context","useMemo","jsxs","Fragment","Helmet","jsx","name","content","Provider","value","defaultProps","propTypes","PT","node","string","isRequired"],"sources":["../../../../src/shared/components/MetaTags.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\nconst Context = createContext();\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param {object} [props]\n * @param {string} [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param {string} [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param {string} [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param {string} [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param {string} [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param {string} props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param {string} [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nexport default function MetaTags({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n}\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: null,\n siteName: null,\n socialDescription: null,\n socialTitle: null,\n url: null,\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n"],"mappings":"kLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,YAAA,CAAAF,OAAA,iBAAsC,IAAAG,WAAA,CAAAH,OAAA,sBAEtC,KAAM,CAAAI,OAAO,cAAG,GAAAC,oBAAa,GAAE,CAE/B;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,GACe,QAAS,CAAAC,QAAQA,CAAC,CAC/BC,QAAQ,CACRC,WAAW,CACXC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXC,KAAK,CACLC,GACF,CAAC,CAAE,CACD,KAAM,CAAAC,QAAQ,CAAGH,WAAW,EAAIC,KAAK,CACrC,KAAM,CAAAG,OAAO,CAAGL,iBAAiB,EAAIH,WAAW,CAEhD,KAAM,CAAAS,OAAO,CAAG,GAAAC,cAAO,EAAC,KAAO,CAC7BV,WAAW,CACXC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXC,KAAK,CACLC,GACF,CAAC,CAAC,CAAE,CACFN,WAAW,CACXC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXC,KAAK,CACLC,GAAG,CACJ,CAAC,CAEF,mBACE,GAAAX,WAAA,CAAAgB,IAAA,EAAAhB,WAAA,CAAAiB,QAAA,EAAAb,QAAA,eACE,GAAAJ,WAAA,CAAAgB,IAAA,EAACjB,YAAA,CAA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AElEI,GAAG,cAAI,GAAAX,WAAA,CAAAmB,GAAA,UAAMC,IAAI,CAAC,QAAQ,CAACC,OAAO,CAAEV,GAAI,EAAG,CAAI,IAAI,GAC9C,CAEPP,QAAQ,cACN,GAAAJ,WAAA,CAAAmB,GAAA,EAAClB,OAAO,CAACqB,QAAQ,EAACC,KAAK,CAAET,OAAQ,CAAAV,QAAA,CAC9BA,QAAQ,EACQ,CACjB,IAAI,GAIhB,CAEAD,QAAQ,CAACF,OAAO,CAAGA,OAAO,CAE1BE,QAAQ,CAACqB,YAAY,CAAG,CACtBpB,QAAQ,CAAE,IAAI,CACdE,KAAK,CAAE,IAAI,CACXC,QAAQ,CAAE,IAAI,CACdC,iBAAiB,CAAE,IAAI,CACvBC,WAAW,CAAE,IAAI,CACjBE,GAAG,CAAE,IACP,CAAC,CAEDR,QAAQ,CAACsB,SAAS,CAAG,CACnBrB,QAAQ,CAAEsB,kBAAE,CAACC,IAAI,CACjBtB,WAAW,CAAEqB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACjCvB,KAAK,CAAEoB,kBAAE,CAACE,MAAM,CAChBrB,QAAQ,CAAEmB,kBAAE,CAACE,MAAM,CACnBpB,iBAAiB,CAAEkB,kBAAE,CAACE,MAAM,CAC5BnB,WAAW,CAAEiB,kBAAE,CAACE,MAAM,CACtBlB,KAAK,CAAEgB,kBAAE,CAACE,MAAM,CAACC,UAAU,CAC3BlB,GAAG,CAAEe,kBAAE,CAACE,MACV,CAAC"}
1
+ {"version":3,"file":"MetaTags.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactHelmet","_jsxRuntime","Context","createContext","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","context","useMemo","jsxs","Fragment","Helmet","jsx","name","content","Provider","value","defaultProps","propTypes","PT","node","string","isRequired"],"sources":["../../../../src/shared/components/MetaTags.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\nconst Context = createContext();\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param {object} [props]\n * @param {string} [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param {string} [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param {string} [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param {string} [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param {string} [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param {string} props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param {string} [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nexport default function MetaTags({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n}\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: null,\n siteName: null,\n socialDescription: null,\n socialTitle: null,\n url: null,\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n"],"mappings":"kLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,YAAA,CAAAF,OAAA,iBAAsC,IAAAG,WAAA,CAAAH,OAAA,sBAEtC,KAAM,CAAAI,OAAO,cAAG,GAAAC,oBAAa,EAAC,CAAC,CAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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1BE,QAAQ,CAACqB,YAAY,CAAG,CACtBpB,QAAQ,CAAE,IAAI,CACdE,KAAK,CAAE,IAAI,CACXC,QAAQ,CAAE,IAAI,CACdC,iBAAiB,CAAE,IAAI,CACvBC,WAAW,CAAE,IAAI,CACjBE,GAAG,CAAE,IACP,CAAC,CAEDR,QAAQ,CAACsB,SAAS,CAAG,CACnBrB,QAAQ,CAAEsB,kBAAE,CAACC,IAAI,CACjBtB,WAAW,CAAEqB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACjCvB,KAAK,CAAEoB,kBAAE,CAACE,MAAM,CAChBrB,QAAQ,CAAEmB,kBAAE,CAACE,MAAM,CACnBpB,iBAAiB,CAAEkB,kBAAE,CAACE,MAAM,CAC5BnB,WAAW,CAAEiB,kBAAE,CAACE,MAAM,CACtBlB,KAAK,CAAEgB,kBAAE,CAACE,MAAM,CAACC,UAAU,CAC3BlB,GAAG,CAAEe,kBAAE,CAACE,MACV,CAAC"}
@@ -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,GAAE,CAC7B,KAAM,CAAAC,UAAU,CAAG,GAAAD,aAAM,GAAE,CAC3B,KAAM,CAACE,MAAM,CAAEC,SAAS,CAAC,CAAG,GAAAC,eAAQ,GAAE,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,CAC7D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,CACbb,QAAQ,CAAC,GAAG,EACZ,cACF,GAAAjC,WAAA,CAAAwB,GAAA,SACE,aAAW,MAAM,CACjBc,SAAS,CAAEjC,KAAK,CAAC0C,SAAU,CAC3BC,OAAO,CAAGC,KAAK,EAAKA,KAAK,CAACC,eAAe,EAAG,CAC5CN,GAAG,CAAEtC,YAAa,CAClBwC,IAAI,CAAC,QAAQ,CAAA3C,QAAA,CAEZA,QAAQ,EACL,cACN,GAAAH,WAAA,CAAAwB,GAAA,SACEC,OAAO,CAAEA,CAAA,GAAM,CACbjB,UAAU,CAACmB,OAAO,CAACI,KAAK,EAC1B,CACA,yDACAE,QAAQ,CAAC,GACT,yDACA,CACDX,SAAS,GACT,CAELb,MAAM,CACP,CAAG,IACN,CAEA,KAAM,CAAA0C,WAAW,CAAG,GAAAC,oBAAM,EACxB,OAAO,CACP,CACE,WAAW,CACX,SAAS,CACV,CACDnD,SAAS,CACV,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,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ACvBtD,QAAQ,CAAEuD,YAAI,CACdxD,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAyD,QAAA,CAEaT,WAAW,CAE1B,sCAAAU,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"NavLink.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","NavLink","props","jsx","default","routerLinkType","RrNavLink"],"sources":["../../../../src/shared/components/NavLink.jsx"],"sourcesContent":["import { NavLink as RrNavLink } from 'react-router-dom';\n\nimport GenericLink from './GenericLink';\n\nexport default function NavLink(props) {\n /* eslint-disable react/jsx-props-no-spreading */\n return <GenericLink {...props} routerLinkType={RrNavLink} />;\n /* eslint-enable react/jsx-props-no-spreading */\n}\n"],"mappings":"iLAAA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAAwC,IAAAG,WAAA,CAAAH,OAAA,sBAEzB,QAAS,CAAAI,OAAOA,CAACC,KAAK,CAAE,CACrC,iDACA,mBAAO,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,uBAAU,EAAG,CAC5D,gDACF"}
1
+ {"version":3,"file":"NavLink.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","NavLink","props","jsx","default","routerLinkType","RrNavLink"],"sources":["../../../../src/shared/components/NavLink.jsx"],"sourcesContent":["import { NavLink as RrNavLink } from 'react-router-dom';\n\nimport GenericLink from './GenericLink';\n\nexport default function NavLink(props) {\n /* eslint-disable react/jsx-props-no-spreading */\n return <GenericLink {...props} routerLinkType={RrNavLink} />;\n /* eslint-enable react/jsx-props-no-spreading */\n}\n"],"mappings":"iLAAA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAAwC,IAAAG,WAAA,CAAAH,OAAA,sBAEzB,QAAS,CAAAI,OAAOA,CAACC,KAAK,CAAE,CACrC,iDACA,mBAAO,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,uBAAU,CAAE,CAAC,CAC5D,gDACF"}
@@ -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,EACjB,cACN,GAAAJ,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAEF,KAAK,CAACQ,SAAU,CAAAX,QAAA,CAC7BA,QAAQ,EACL,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,EAClB,GAGZ,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,CAEaR,gBAAgB,CAAAS,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","ScalableRect","children","className","ratio","aux","split","paddingBottom","rect","jsx","style","defaultProps","propTypes","PT","node","string"],"sources":["../../../../../src/shared/components/ScalableRect/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport './style.scss';\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nexport default function ScalableRect({ children, className, ratio }) {\n const aux = ratio.split(':');\n const paddingBottom = `${(100 * aux[1]) / aux[0]}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n}\n\nScalableRect.defaultProps = {\n children: null,\n className: null,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: PT.string,\n};\n"],"mappings":"sLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAA4B,IAAAC,WAAA,CAAAD,OAAA,sBAI5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,QAAS,CAAAE,YAAYA,CAAC,CAAEC,QAAQ,CAAEC,SAAS,CAAEC,KAAM,CAAC,CAAE,CACnE,KAAM,CAAAC,GAAG,CAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC,CAC5B,KAAM,CAAAC,aAAa,CAAI,GAAG,GAAG,CAAGF,GAAG,CAAC,CAAC,CAAC,CAAIA,GAAG,CAAC,CAAC,CAAE,GAAE,CAEnD;AACF;AACA;AACA;AACA;AACA;AACA,wDACE,KAAM,CAAAG,IAAI,cACR,GAAAR,WAAA,CAAAS,GAAA,SACEC,KAAK,CAAE,CAAEH,aAAc,CAAE,CACzBJ,SAAS,CAAC,QAAW,CAAAD,QAAA,cAErB,GAAAF,WAAA,CAAAS,GAAA,SAAKN,SAAS,CAAC,SAAS,CAAAD,QAAA,CACrBA,QAAQ,EACL,EAET,CACD,MAAO,CAAAC,SAAS,cACd,GAAAH,WAAA,CAAAS,GAAA,SAAKN,SAAS,CAAEA,SAAU,CAAAD,QAAA,CACvBM,IAAI,EACD,CACJA,IACN,CAEAP,YAAY,CAACU,YAAY,CAAG,CAC1BT,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAE,IAAI,CACfC,KAAK,CAAE,KACT,CAAC,CAEDH,YAAY,CAACW,SAAS,CAAG,CACvBV,QAAQ,CAAEW,kBAAE,CAACC,IAAI,CACjBX,SAAS,CAAEU,kBAAE,CAACE,MAAM,CACpBX,KAAK,CAAES,kBAAE,CAACE,MACZ,CAAC"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","ScalableRect","children","className","ratio","aux","split","paddingBottom","rect","jsx","style","defaultProps","propTypes","PT","node","string"],"sources":["../../../../../src/shared/components/ScalableRect/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport './style.scss';\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nexport default function ScalableRect({ children, className, ratio }) {\n const aux = ratio.split(':');\n const paddingBottom = `${(100 * aux[1]) / aux[0]}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n}\n\nScalableRect.defaultProps = {\n children: null,\n className: null,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: PT.string,\n};\n"],"mappings":"sLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAA4B,IAAAC,WAAA,CAAAD,OAAA,sBAI5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,QAAS,CAAAE,YAAYA,CAAC,CAAEC,QAAQ,CAAEC,SAAS,CAAEC,KAAM,CAAC,CAAE,CACnE,KAAM,CAAAC,GAAG,CAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC,CAC5B,KAAM,CAAAC,aAAa,CAAI,GAAG,GAAG,CAAGF,GAAG,CAAC,CAAC,CAAC,CAAIA,GAAG,CAAC,CAAC,CAAE,GAAE,CAEnD;AACF;AACA;AACA;AACA;AACA;AACA,wDACE,KAAM,CAAAG,IAAI,cACR,GAAAR,WAAA,CAAAS,GAAA,SACEC,KAAK,CAAE,CAAEH,aAAc,CAAE,CACzBJ,SAAS,CAAC,QAAW,CAAAD,QAAA,cAErB,GAAAF,WAAA,CAAAS,GAAA,SAAKN,SAAS,CAAC,SAAS,CAAAD,QAAA,CACrBA,QAAQ,CACN,CAAC,CACH,CACN,CACD,MAAO,CAAAC,SAAS,cACd,GAAAH,WAAA,CAAAS,GAAA,SAAKN,SAAS,CAAEA,SAAU,CAAAD,QAAA,CACvBM,IAAI,CACF,CAAC,CACJA,IACN,CAEAP,YAAY,CAACU,YAAY,CAAG,CAC1BT,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAE,IAAI,CACfC,KAAK,CAAE,KACT,CAAC,CAEDH,YAAY,CAACW,SAAS,CAAG,CACvBV,QAAQ,CAAEW,kBAAE,CAACC,IAAI,CACjBX,SAAS,CAAEU,kBAAE,CAACE,MAAM,CACpBX,KAAK,CAAES,kBAAE,CAACE,MACZ,CAAC"}
@@ -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,EAAsB,cACpD,GAAAT,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,EAAsB,cACpD,GAAAT,WAAA,CAAAQ,GAAA,UAAMH,SAAS,EAAEF,KAAK,CAACM,MAAM,CAAZN,KAAK,CAACM,MAAM,iBAAC,EAAsB,GAG1D,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","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)(Thro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efault","PLACEMENTS","ABOVE_CURSOR","ABOVE_ELEMENT","BELOW_CURSOR","BELOW_ELEMENT","exports","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","createTooltipComponents","theme","arrow","document","createElement","setAttribute","content","container","appendChild","body","calcTooltipRects","tooltip","getBoundingClientRect","calcViewportRect","pageXOffset","pageYOffset","window","documentElement","clientHeight","clientWidth","left","right","top","bottom","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","arrowStyle","Tooltip","forwardRef","children","ref","components","setComponents","useState","pointTo","useImperativeHandle","useEffect","removeChild","createPortal","propTypes","PT","node","shape","isRequired","defaultProps","_default","default"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.jsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n/* global document, window */\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport PT from 'prop-types';\n\n/* Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport. */\nexport const PLACEMENTS = {\n ABOVE_CURSOR: 'ABOVE_CURSOR',\n ABOVE_ELEMENT: 'ABOVE_ELEMENT',\n BELOW_CURSOR: 'BELOW_CURSOR',\n BELOW_ELEMENT: 'BELOW_ELEMENT',\n};\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\n/**\n * Creates tooltip components.\n * @ignore\n * @param {object} theme Themes to use for tooltip container, arrow,\n * and content.\n * @return {object} Object with DOM references to the container components:\n * container, arrow, content.\n */\nfunction createTooltipComponents(theme) {\n const arrow = document.createElement('div');\n if (theme.arrow) arrow.setAttribute('class', theme.arrow);\n\n const content = document.createElement('div');\n if (theme.content) content.setAttribute('class', theme.content);\n\n const container = document.createElement('div');\n if (theme.container) container.setAttribute('class', theme.container);\n\n container.appendChild(arrow);\n container.appendChild(content);\n document.body.appendChild(container);\n\n return { container, arrow, content };\n}\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param {object} tooltip DOM references to the tooltip components.\n * @param {object} tooltip.arrow\n * @param {object} tooltip.container\n * @return {{ arrow: object, container}} Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip) {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { pageXOffset, pageYOffset } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n left: pageXOffset,\n right: pageXOffset + clientWidth,\n top: pageYOffset,\n bottom: pageYOffset + clientHeight,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(x, y, tooltipRects) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n/*\nconst HIT = {\n NONE: false,\n LEFT: 'LEFT',\n RIGHT: 'RIGHT',\n TOP: 'TOP',\n BOTTOM: 'BOTTOM',\n};\n*/\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n/*\nfunction checkViewportFit(pos, tooltipRects, viewportRect) {\n const { containerX, containerY } = pos;\n if (containerX < viewportRect.left + 6) return HIT.LEFT;\n if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n return HIT.NONE;\n}\n*/\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n/*\nfunction xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n if (pos.containerX < pageXOffset + 6) {\n pos.containerX = pageXOffset + 6;\n pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n } else {\n const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n if (containerX > maxX) {\n containerX = maxX;\n arrowX = Math.min(\n containerRect.width - 6,\n pageX - containerX - arrowRect.width / 2,\n );\n }\n }\n}\n*/\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param {number} pageX\n * @param {number} pageY\n * @param {PLACEMENTS} placement\n * @param {object} element DOM reference to the element wrapped by the tooltip.\n * @param {object} tooltip\n * @param {object} tooltip.arrow DOM reference to the tooltip arrow.\n * @param {object} tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX,\n pageY,\n placement,\n element,\n tooltip,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip = forwardRef(({ children, theme }, ref) => {\n const [components, setComponents] = useState(null);\n\n const pointTo = (pageX, pageY, placement, element) => components\n && setComponentPositions(pageX, pageY, placement, element, components);\n useImperativeHandle(ref, () => ({ pointTo }));\n\n /* Inits and destroys tooltip components. */\n useEffect(() => {\n const x = createTooltipComponents(theme);\n setComponents(x);\n return () => {\n document.body.removeChild(x.container);\n setComponents(null);\n };\n }, [theme]);\n\n return components ? createPortal(children, components.content) : null;\n});\n\nTooltip.propTypes = {\n children: PT.node,\n theme: PT.shape().isRequired,\n};\n\nTooltip.defaultProps = {\n children: null,\n};\n\nexport default Tooltip;\n"],"mappings":"mMAOA,IAAAA,MAAA,CAAAC,OAAA,UAMA,IAAAC,SAAA,CAAAD,OAAA,cAEA,IAAAE,UAAA,CAAAC,sBAAA,CAAAH,OAAA,gBAfA;AACA;AACA;AACA;AACA,GAJA,CAKA,8BAYA;AACA,uDACO,KAAM,CAAAI,UAAU,CAAG,CACxBC,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eAAe,CAC9BC,YAAY,CAAE,cAAc,CAC5BC,aAAa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M,IAAI,CAACiD,WAAW,CAACjC,CAAC,CAAClB,SAAS,CAAC,CACtC8C,aAAa,CAAC,IAAI,CACpB,CACF,CAAC,CAAE,CAACpD,KAAK,CAAC,CAAC,CAEX,MAAO,CAAAmD,UAAU,cAAG,GAAAO,sBAAY,EAACT,QAAQ,CAAEE,UAAU,CAAC9C,OAAO,CAAC,CAAG,IACnE,CAAC,CAAC,CAEF0C,OAAO,CAACY,SAAS,CAAG,CAClBV,QAAQ,CAAEW,kBAAE,CAACC,IAAI,CACjB7D,KAAK,CAAE4D,kBAAE,CAACE,KAAK,EAAE,CAACC,UACpB,CAAC,CAEDhB,OAAO,CAACiB,YAAY,CAAG,CACrBf,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAgB,QAAA,CAEalB,OAAO,CAAApD,OAAA,CAAAuE,OAAA,CAAAD,QAAA"}
1
+ {"version":3,"file":"Tooltip.js","names":["_react","require","_reactDom","_propTypes","_interopRequireDefault","PLACEMENTS","ABOVE_CURSOR","ABOVE_ELEMENT","BELOW_CURSOR","BELOW_ELEMENT","exports","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","createTooltipComponents","theme","arrow","document","createElement","setAttribute","content","container","appendChild","body","calcTooltipRects","tooltip","getBoundingClientRect","calcViewportRect","pageXOffset","pageYOffset","window","documentElement","clientHeight","clientWidth","left","right","top","bottom","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","arrowStyle","Tooltip","forwardRef","children","ref","components","setComponents","useState","pointTo","useImperativeHandle","useEffect","removeChild","createPortal","propTypes","PT","node","shape","isRequired","defaultProps","_default","default"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.jsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n/* global document, window */\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport PT from 'prop-types';\n\n/* Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport. */\nexport const PLACEMENTS = {\n ABOVE_CURSOR: 'ABOVE_CURSOR',\n ABOVE_ELEMENT: 'ABOVE_ELEMENT',\n BELOW_CURSOR: 'BELOW_CURSOR',\n BELOW_ELEMENT: 'BELOW_ELEMENT',\n};\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\n/**\n * Creates tooltip components.\n * @ignore\n * @param {object} theme Themes to use for tooltip container, arrow,\n * and content.\n * @return {object} Object with DOM references to the container components:\n * container, arrow, content.\n */\nfunction createTooltipComponents(theme) {\n const arrow = document.createElement('div');\n if (theme.arrow) arrow.setAttribute('class', theme.arrow);\n\n const content = document.createElement('div');\n if (theme.content) content.setAttribute('class', theme.content);\n\n const container = document.createElement('div');\n if (theme.container) container.setAttribute('class', theme.container);\n\n container.appendChild(arrow);\n container.appendChild(content);\n document.body.appendChild(container);\n\n return { container, arrow, content };\n}\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param {object} tooltip DOM references to the tooltip components.\n * @param {object} tooltip.arrow\n * @param {object} tooltip.container\n * @return {{ arrow: object, container}} Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip) {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { pageXOffset, pageYOffset } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n left: pageXOffset,\n right: pageXOffset + clientWidth,\n top: pageYOffset,\n bottom: pageYOffset + clientHeight,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(x, y, tooltipRects) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n/*\nconst HIT = {\n NONE: false,\n LEFT: 'LEFT',\n RIGHT: 'RIGHT',\n TOP: 'TOP',\n BOTTOM: 'BOTTOM',\n};\n*/\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n/*\nfunction checkViewportFit(pos, tooltipRects, viewportRect) {\n const { containerX, containerY } = pos;\n if (containerX < viewportRect.left + 6) return HIT.LEFT;\n if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n return HIT.NONE;\n}\n*/\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n/*\nfunction xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n if (pos.containerX < pageXOffset + 6) {\n pos.containerX = pageXOffset + 6;\n pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n } else {\n const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n if (containerX > maxX) {\n containerX = maxX;\n arrowX = Math.min(\n containerRect.width - 6,\n pageX - containerX - arrowRect.width / 2,\n );\n }\n }\n}\n*/\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param {number} pageX\n * @param {number} pageY\n * @param {PLACEMENTS} placement\n * @param {object} element DOM reference to the element wrapped by the tooltip.\n * @param {object} tooltip\n * @param {object} tooltip.arrow DOM reference to the tooltip arrow.\n * @param {object} tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX,\n pageY,\n placement,\n element,\n tooltip,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip = forwardRef(({ children, theme }, ref) => {\n const [components, setComponents] = useState(null);\n\n const pointTo = (pageX, pageY, placement, element) => components\n && setComponentPositions(pageX, pageY, placement, element, components);\n useImperativeHandle(ref, () => ({ pointTo }));\n\n /* Inits and destroys tooltip components. */\n useEffect(() => {\n const x = createTooltipComponents(theme);\n setComponents(x);\n return () => {\n document.body.removeChild(x.container);\n setComponents(null);\n };\n }, [theme]);\n\n return components ? createPortal(children, components.content) : null;\n});\n\nTooltip.propTypes = {\n children: PT.node,\n theme: PT.shape().isRequired,\n};\n\nTooltip.defaultProps = {\n children: null,\n};\n\nexport default Tooltip;\n"],"mappings":"mMAOA,IAAAA,MAAA,CAAAC,OAAA,UAMA,IAAAC,SAAA,CAAAD,OAAA,cAEA,IAAAE,UAAA,CAAAC,sBAAA,CAAAH,OAAA,gBAfA;AACA;AACA;AACA;AACA,GAJA,CAKA,8BAYA;AACA,uDACO,KAAM,CAAAI,UAAU,CAAG,CACxBC,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eAAe,CAC9BC,YAAY,CAAE,cAAc,CAC5BC,aAAa,CAAE,eACjB,CAAC,CAACC,OAAA,CAAAL,UAAA,CAAAA,UAAA,CAEF,KAAM,CAAAM,gBAAgB,CAAG,CACvB,iCAAiC,CACjC,+BAA+B,CAC/B,gCAAgC,CACjC,CAACC,IAAI,CAAC,GAAG,CAAC,CAEX,KAAM,CAAAC,cAAc,CAAG,CACrB,8BAA8B,CAC9B,+BAA+B,CAC/B,gCAAgC,CACjC,CAACD,IAAI,CAAC,GAAG,CAAC,CAEX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAE,uBAAuBA,CAACC,KAAK,CAAE,CACtC,KAAM,CAAAC,KAAK,CAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAC3C,GAAIH,KAAK,CAACC,KAAK,CAAEA,KAAK,CAACG,YAAY,CAAC,OAAO,CAAEJ,KAAK,CAACC,KAAK,CAAC,CAEzD,KAAM,CAAAI,OAAO,CAAGH,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAC7C,GAAIH,KAAK,CAACK,OAA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,GAAAC,iBAAU,EAAC,CAAC,CAAEC,QAAQ,CAAEjD,KAAM,CAAC,CAAEkD,GAAG,GAAK,CACvD,KAAM,CAACC,UAAU,CAAEC,aAAa,CAAC,CAAG,GAAAC,eAAQ,EAAC,IAAI,CAAC,CAElD,KAAM,CAAAC,OAAO,CAAGA,CAACnB,KAAK,CAAEC,KAAK,CAAEC,SAAS,CAAEC,OAAO,GAAKa,UAAU,EAC3DjB,qBAAqB,CAACC,KAAK,CAAEC,KAAK,CAAEC,SAAS,CAAEC,OAAO,CAAEa,UAAU,CAAC,CACxE,GAAAI,0BAAmB,EAACL,GAAG,CAAE,KAAO,CAAEI,OAAQ,CAAC,CAAC,CAAC,CAE7C,4CACA,GAAAE,gBAAS,EAAC,IAAM,CACd,KAAM,CAAAhC,CAAC,CAAGzB,uBAAuB,CAACC,KAAK,CAAC,CACxCoD,aAAa,CAAC5B,CAAC,CAAC,CAChB,MAAO,IAAM,CACXtB,QAAQ,CAACM,IAAI,CAACiD,WAAW,CAACjC,CAAC,CAAClB,SAAS,CAAC,CACtC8C,aAAa,CAAC,IAAI,CACpB,CACF,CAAC,CAAE,CAACpD,KAAK,CAAC,CAAC,CAEX,MAAO,CAAAmD,UAAU,cAAG,GAAAO,sBAAY,EAACT,QAAQ,CAAEE,UAAU,CAAC9C,OAAO,CAAC,CAAG,IACnE,CAAC,CAAC,CAEF0C,OAAO,CAACY,SAAS,CAAG,CAClBV,QAAQ,CAAEW,kBAAE,CAACC,IAAI,CACjB7D,KAAK,CAAE4D,kBAAE,CAACE,KAAK,CAAC,CAAC,CAACC,UACpB,CAAC,CAEDhB,OAAO,CAACiB,YAAY,CAAG,CACrBf,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAgB,QAAA,CAEalB,OAAO,CAAApD,OAAA,CAAAuE,OAAA,CAAAD,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_Tooltip","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","defaultTheme","Wrapper","children","placement","tip","theme","tooltipRef","useRef","wrapperRef","showTooltip","setShowTooltip","useState","updatePortalPosition","cursorX","cursorY","wrapperRect","current","getBoundingClientRect","left","right","top","bottom","pointTo","window","pageXOffset","pageYOffset","useEffect","listener","addEventListener","removeEventListener","undefined","jsxs","className","wrapper","onMouseLeave","onMouseMove","e","clientX","clientY","ref","jsx","ThemedWrapper","themed","PLACEMENTS","propTypes","PT","node","oneOf","values","themeType","isRequired","defaultProps","ABOVE_CURSOR","_default","exports"],"sources":["../../../../../src/shared/components/WithTooltip/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { themed } from 'utils';\n\nimport Tooltip, { PLACEMENTS } from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param {object} props Component properties.\n * @param {React.node} props.tip &ndash; Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nfunction Wrapper({\n children,\n placement,\n tip,\n theme,\n}) {\n const tooltipRef = useRef();\n const wrapperRef = useRef();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX, cursorY) => {\n if (!showTooltip) setShowTooltip(true);\n else {\n const wrapperRect = wrapperRef.current.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.pageXOffset,\n cursorY + window.pageYOffset,\n placement,\n wrapperRef.current,\n );\n }\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n const listener = () => setShowTooltip(false);\n window.addEventListener('scroll', listener);\n return () => window.removeEventListener('scroll', listener);\n }\n return undefined;\n }, [showTooltip, tip]);\n\n return (\n <div\n className={theme.wrapper}\n onMouseLeave={() => setShowTooltip(false)}\n onMouseMove={(e) => updatePortalPosition(e.clientX, e.clientY)}\n ref={wrapperRef}\n >\n {\n showTooltip && tip !== null ? (\n <Tooltip ref={tooltipRef} theme={theme}>{tip}</Tooltip>\n ) : null\n }\n {children}\n </div>\n );\n}\n\nconst ThemedWrapper = themed(\n 'WithTooltip',\n [\n 'appearance',\n 'arrow',\n 'container',\n 'content',\n 'wrapper',\n ],\n defaultTheme,\n)(Wrapper);\n\nThemedWrapper.PLACEMENTS = PLACEMENTS;\n\nWrapper.propTypes = {\n children: PT.node,\n placement: PT.oneOf(Object.values(PLACEMENTS)),\n theme: ThemedWrapper.themeType.isRequired,\n tip: PT.node,\n};\n\nWrapper.defaultProps = {\n children: null,\n placement: PLACEMENTS.ABOVE_CURSOR,\n tip: null,\n};\n\nexport default ThemedWrapper;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,MAAA,CAAAF,OAAA,gBAEA,IAAAG,QAAA,CAAAC,uBAAA,CAAAJ,OAAA,eAAgD,IAAAK,WAAA,CAAAL,OAAA,+BAAAM,yBAAAC,WAAA,YAAAC,OAAA,8BAAAC,iBAAA,KAAAD,OAAA,KAAAE,gBAAA,KAAAF,OAAA,QAAAF,wBAAA,SAAAA,CAAAC,WAAA,SAAAA,WAAA,CAAAG,gBAAA,CAAAD,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xB,oBAAoB,CAACwB,CAAC,CAACC,OAAO,CAAED,CAAC,CAACE,OAAO,CAAE,CAC/DC,GAAG,CAAE/B,UAAW,CAAAN,QAAA,EAGdO,WAAW,EAAIL,GAAG,GAAK,IAAI,cACzB,GAAA3B,WAAA,CAAA+D,GAAA,EAACjE,QAAA,CAAAU,OAAO,EAACsD,GAAG,CAAEjC,UAAW,CAACD,KAAK,CAAEA,KAAM,CAAAH,QAAA,CAAEE,GAAG,EAAW,CACrD,IAAI,CAETF,QAAQ,GAGf,CAEA,KAAM,CAAAuC,aAAa,CAAG,GAAAC,aAAM,EAC1B,aAAa,CACb,CACE,YAAY,CACZ,OAAO,CACP,WAAW,CACX,SAAS,CACT,SAAS,CACV,CACD1C,YAAY,CACb,CAACC,OAAO,CAAC,CAEVwC,aAAa,CAACE,UAAU,CAAGA,mBAAU,CAErC1C,OAAO,CAAC2C,SAAS,CAAG,CAClB1C,QAAQ,CAAE2C,kBAAE,CAACC,IAAI,CACjB3C,SAAS,CAAE0C,kBAAE,CAACE,KAAK,CAACxD,MAAM,CAACyD,MAAM,CAACL,mBAAU,CAAC,CAAC,CAC9CtC,KAAK,CAAEoC,aAAa,CAACQ,SAAS,CAACC,UAAU,CACzC9C,GAAG,CAAEyC,kBAAE,CAACC,IACV,CAAC,CAED7C,OAAO,CAACkD,YAAY,CAAG,CACrBjD,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAEwC,mBAAU,CAACS,YAAY,CAClChD,GAAG,CAAE,IACP,CAAC,CAAC,IAAAiD,QAAA,CAEaZ,aAAa,CAAAa,OAAA,CAAArE,OAAA,CAAAoE,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_Tooltip","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","defaultTheme","Wrapper","children","placement","tip","theme","tooltipRef","useRef","wrapperRef","showTooltip","setShowTooltip","useState","updatePortalPosition","cursorX","cursorY","wrapperRect","current","getBoundingClientRect","left","right","top","bottom","pointTo","window","pageXOffset","pageYOffset","useEffect","listener","addEventListener","removeEventListener","undefined","jsxs","className","wrapper","onMouseLeave","onMouseMove","e","clientX","clientY","ref","jsx","ThemedWrapper","themed","PLACEMENTS","propTypes","PT","node","oneOf","values","themeType","isRequired","defaultProps","ABOVE_CURSOR","_default","exports"],"sources":["../../../../../src/shared/components/WithTooltip/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { themed } from 'utils';\n\nimport Tooltip, { PLACEMENTS } from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param {object} props Component properties.\n * @param {React.node} props.tip &ndash; Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nfunction Wrapper({\n children,\n placement,\n tip,\n theme,\n}) {\n const tooltipRef = useRef();\n const wrapperRef = useRef();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX, cursorY) => {\n if (!showTooltip) setShowTooltip(true);\n else {\n const wrapperRect = wrapperRef.current.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.pageXOffset,\n cursorY + window.pageYOffset,\n placement,\n wrapperRef.current,\n );\n }\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n const listener = () => setShowTooltip(false);\n window.addEventListener('scroll', listener);\n return () => window.removeEventListener('scroll', listener);\n }\n return undefined;\n }, [showTooltip, tip]);\n\n return (\n <div\n className={theme.wrapper}\n onMouseLeave={() => setShowTooltip(false)}\n onMouseMove={(e) => updatePortalPosition(e.clientX, e.clientY)}\n ref={wrapperRef}\n >\n {\n showTooltip && tip !== null ? (\n <Tooltip ref={tooltipRef} theme={theme}>{tip}</Tooltip>\n ) : null\n }\n {children}\n </div>\n );\n}\n\nconst ThemedWrapper = themed(\n 'WithTooltip',\n [\n 'appearance',\n 'arrow',\n 'container',\n 'content',\n 'wrapper',\n ],\n defaultTheme,\n)(Wrapper);\n\nThemedWrapper.PLACEMENTS = PLACEMENTS;\n\nWrapper.propTypes = {\n children: PT.node,\n placement: PT.oneOf(Object.values(PLACEMENTS)),\n theme: ThemedWrapper.themeType.isRequired,\n tip: PT.node,\n};\n\nWrapper.defaultProps = {\n children: null,\n placement: PLACEMENTS.ABOVE_CURSOR,\n tip: null,\n};\n\nexport default ThemedWrapper;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,MAAA,CAAAF,OAAA,gBAEA,IAAAG,QAAA,CAAAC,uBAAA,CAAAJ,OAAA,eAAgD,IAAAK,WAAA,CAAAL,OAAA,+BAAAM,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,WAAAH,wBAAAO,GAAA,CAAAJ,WAAA,MAAAA,WAAA,EAAAI,GAAA,EAAAA,GAAA,CAAAC,UAAA,SAAAD,GAAA,IAAAA,GAAA,gBAA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IL,GAAG,GAAK,IAAI,cACzB,GAAA3B,WAAA,CAAA+D,GAAA,EAACjE,QAAA,CAAAU,OAAO,EAACsD,GAAG,CAAEjC,UAAW,CAACD,KAAK,CAAEA,KAAM,CAAAH,QAAA,CAAEE,GAAG,CAAU,CAAC,CACrD,IAAI,CAETF,QAAQ,EACN,CAET,CAEA,KAAM,CAAAuC,aAAa,CAAG,GAAAC,aAAM,EAC1B,aAAa,CACb,CACE,YAAY,CACZ,OAAO,CACP,WAAW,CACX,SAAS,CACT,SAAS,CACV,CACD1C,YACF,CAAC,CAACC,OAAO,CAAC,CAEVwC,aAAa,CAACE,UAAU,CAAGA,mBAAU,CAErC1C,OAAO,CAAC2C,SAAS,CAAG,CAClB1C,QAAQ,CAAE2C,kBAAE,CAACC,IAAI,CACjB3C,SAAS,CAAE0C,kBAAE,CAACE,KAAK,CAACxD,MAAM,CAACyD,MAAM,CAACL,mBAAU,CAAC,CAAC,CAC9CtC,KAAK,CAAEoC,aAAa,CAACQ,SAAS,CAACC,UAAU,CACzC9C,GAAG,CAAEyC,kBAAE,CAACC,IACV,CAAC,CAED7C,OAAO,CAACkD,YAAY,CAAG,CACrBjD,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAEwC,mBAAU,CAACS,YAAY,CAClChD,GAAG,CAAE,IACP,CAAC,CAAC,IAAAiD,QAAA,CAEaZ,aAAa,CAAAa,OAAA,CAAArE,OAAA,CAAAoE,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_qs","_ScalableRect","_reactThemes","_Throbber","_jsxRuntime","baseTheme","throbberTheme","YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","jsxs","default","className","container","ratio","children","jsx","allow","allowFullScreen","video","ThemedYouTubeVideo","themed","propTypes","PT","bool","string","isRequired","themeType","defaultProps","_default","exports"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\nimport ScalableRect from 'components/ScalableRect';\nimport themed from '@dr.pogodin/react-themes';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\n/**\n * A component for embeding a YouTube video.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param {string} [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param {YouTubeVideoTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nfunction YouTubeVideo({\n autoplay,\n src,\n theme,\n title,\n}) {\n let [url, query] = src.split('?');\n query = query ? qs.parse(query) : {};\n\n const videoId = query.v || url.match(/\\/([a-zA-Z0-9-_]*)$/)[1];\n url = `https://www.youtube.com/embed/${videoId}`;\n\n delete query.v;\n query.autoplay = autoplay ? 1 : 0;\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <ScalableRect className={theme.container} ratio=\"16:9\">\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </ScalableRect>\n );\n}\n\nconst ThemedYouTubeVideo = themed(\n 'YouTubeVideo',\n [\n 'container',\n 'video',\n ],\n baseTheme,\n)(YouTubeVideo);\n\nYouTubeVideo.propTypes = {\n autoplay: PT.bool,\n src: PT.string.isRequired,\n theme: ThemedYouTubeVideo.themeType.isRequired,\n title: PT.string,\n};\n\nYouTubeVideo.defaultProps = {\n autoplay: false,\n title: '',\n};\n\nexport default ThemedYouTubeVideo;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,C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AK,CAAC,UAAU,CAChBC,eAAe,MACfN,SAAS,CAAEb,KAAK,CAACoB,KAAM,CACvBrB,GAAG,CAAEG,GAAI,CACTD,KAAK,CAAEA,KAAM,EACb,GAGR,CAEA,KAAM,CAAAoB,kBAAkB,CAAG,GAAAC,oBAAM,EAC/B,cAAc,CACd,CACE,WAAW,CACX,OAAO,CACR,CACD3B,SAAS,CACV,CAACE,YAAY,CAAC,CAEfA,YAAY,CAAC0B,SAAS,CAAG,CACvBzB,QAAQ,CAAE0B,kBAAE,CAACC,IAAI,CACjB1B,GAAG,CAAEyB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACzB3B,KAAK,CAAEqB,kBAAkB,CAACO,SAAS,CAACD,UAAU,CAC9C1B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED7B,YAAY,CAACgC,YAAY,CAAG,CAC1B/B,QAAQ,CAAE,KAAK,CACfG,KAAK,CAAE,EACT,CAAC,CAAC,IAAA6B,QAAA,CAEaT,kBAAkB,CAAAU,OAAA,CAAAnB,OAAA,CAAAkB,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_qs","_ScalableRect","_reactThemes","_Throbber","_jsxRuntime","baseTheme","throbberTheme","YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","jsxs","default","className","container","ratio","children","jsx","allow","allowFullScreen","video","ThemedYouTubeVideo","themed","propTypes","PT","bool","string","isRequired","themeType","defaultProps","_default","exports"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\nimport ScalableRect from 'components/ScalableRect';\nimport themed from '@dr.pogodin/react-themes';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\n/**\n * A component for embeding a YouTube video.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param {string} [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param {YouTubeVideoTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nfunction YouTubeVideo({\n autoplay,\n src,\n theme,\n title,\n}) {\n let [url, query] = src.split('?');\n query = query ? qs.parse(query) : {};\n\n const videoId = query.v || url.match(/\\/([a-zA-Z0-9-_]*)$/)[1];\n url = `https://www.youtube.com/embed/${videoId}`;\n\n delete query.v;\n query.autoplay = autoplay ? 1 : 0;\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <ScalableRect className={theme.container} ratio=\"16:9\">\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </ScalableRect>\n );\n}\n\nconst ThemedYouTubeVideo = themed(\n 'YouTubeVideo',\n [\n 'container',\n 'video',\n ],\n baseTheme,\n)(YouTubeVideo);\n\nYouTubeVideo.propTypes = {\n autoplay: PT.bool,\n src: PT.string.isRequired,\n theme: ThemedYouTubeVideo.themeType.isRequired,\n title: PT.string,\n};\n\nYouTubeVideo.defaultProps = {\n autoplay: false,\n title: '',\n};\n\nexport default ThemedYouTubeVideo;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,GAAA,CAAAF,sBAAA,CAAAC,OAAA,QACA,IAAAE,aAAA,CAAAH,sBAAA,CAAAC,OAAA,qBACA,IAAAG,YAAA,CAAAJ,sBAAA,CAAAC,OAAA,8BACA,IAAAI,SAAA,CAAAL,sBAAA,CAAAC,OAAA,iBAA2C,IAAAK,WAAA,CAAAL,OAAA,4BA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ACR,CACD3B,SACF,CAAC,CAACE,YAAY,CAAC,CAEfA,YAAY,CAAC0B,SAAS,CAAG,CACvBzB,QAAQ,CAAE0B,kBAAE,CAACC,IAAI,CACjB1B,GAAG,CAAEyB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACzB3B,KAAK,CAAEqB,kBAAkB,CAACO,SAAS,CAACD,UAAU,CAC9C1B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED7B,YAAY,CAACgC,YAAY,CAAG,CAC1B/B,QAAQ,CAAE,KAAK,CACfG,KAAK,CAAE,EACT,CAAC,CAAC,IAAA6B,QAAA,CAEaT,kBAAkB,CAAAU,OAAA,CAAAnB,OAAA,CAAAkB,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["_environmentCheck","require","_webpack","config","IS_CLIENT_SIDE","default","CONFIG","requireWeak","document","cookie","CSRF","parse","csrfToken","_default","exports"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global document */\n\nimport { IS_CLIENT_SIDE } from './isomorphy/environment-check';\nimport { requireWeak } from './webpack';\n\nconst config = (\n IS_CLIENT_SIDE\n // eslint-disable-next-line global-require\n ? require('client/getInj').default().CONFIG\n : requireWeak('config')\n) || {};\n\n// The safeguard for \"document\" is necessary because in non-Node environments,\n// like React Native, IS_CLIENT_SIDE is \"true\", however \"document\" and a bunch\n// of other browser-world features are not available.\nif (IS_CLIENT_SIDE && typeof document !== 'undefined') {\n const cookie = require('cookie'); // eslint-disable-line global-require\n config.CSRF = cookie.parse(document.cookie).csrfToken;\n}\n\nexport default config;\n"],"mappings":"6FAEA,IAAAA,iBAAA,CAAAC,OAAA,kCACA,IAAAC,QAAA,CAAAD,OAAA,cAHA,qBAKA,KAAM,CAAAE,MAAM,CAAG,CACbC,gCACE;AAAA,CACEH,OAAO,uBAAiB,CAACI,OAAO,EAAE,CAACC,MAAM,CACzC,GAAAC,oBAAW,EAAC,QAAQ,CAAC,GACtB,CAAC,CAAC,CAEP;AACA;AACA;AACA,GAAIH,gCAAc,EAAI,MAAO,CAAAI,QAAQ,GAAK,WAAW,CAAE,CACrD,KAAM,CAAAC,MAAM,CAAGR,OAAO,CAAC,QAAQ,CAAC,CAAE;AAClCE,MAAM,CAACO,IAAI,CAAGD,MAAM,CAACE,KAAK,CAACH,QAAQ,CAACC,MAAM,CAAC,CAACG,SAC9C,CAAC,IAAAC,QAAA,CAEcV,MAAM,CAAAW,OAAA,CAAAT,OAAA,CAAAQ,QAAA"}
1
+ {"version":3,"file":"config.js","names":["_environmentCheck","require","_webpack","config","IS_CLIENT_SIDE","default","CONFIG","requireWeak","document","cookie","CSRF","parse","csrfToken","_default","exports"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global document */\n\nimport { IS_CLIENT_SIDE } from './isomorphy/environment-check';\nimport { requireWeak } from './webpack';\n\nconst config = (\n IS_CLIENT_SIDE\n // eslint-disable-next-line global-require\n ? require('client/getInj').default().CONFIG\n : requireWeak('config')\n) || {};\n\n// The safeguard for \"document\" is necessary because in non-Node environments,\n// like React Native, IS_CLIENT_SIDE is \"true\", however \"document\" and a bunch\n// of other browser-world features are not available.\nif (IS_CLIENT_SIDE && typeof document !== 'undefined') {\n const cookie = require('cookie'); // eslint-disable-line global-require\n config.CSRF = cookie.parse(document.cookie).csrfToken;\n}\n\nexport default config;\n"],"mappings":"6FAEA,IAAAA,iBAAA,CAAAC,OAAA,kCACA,IAAAC,QAAA,CAAAD,OAAA,cAHA,qBAKA,KAAM,CAAAE,MAAM,CAAG,CACbC,gCACE;AAAA,CACEH,OAAO,sBAAgB,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,MAAM,CACzC,GAAAC,oBAAW,EAAC,QAAQ,CAAC,GACtB,CAAC,CAAC,CAEP;AACA;AACA;AACA,GAAIH,gCAAc,EAAI,MAAO,CAAAI,QAAQ,GAAK,WAAW,CAAE,CACrD,KAAM,CAAAC,MAAM,CAAGR,OAAO,CAAC,QAAQ,CAAC,CAAE;AAClCE,MAAM,CAACO,IAAI,CAAGD,MAAM,CAACE,KAAK,CAACH,QAAQ,CAACC,MAAM,CAAC,CAACG,SAC9C,CAAC,IAAAC,QAAA,CAEcV,MAAM,CAAAW,OAAA,CAAAT,OAAA,CAAAQ,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_reactThemes","_interopRequireWildcard","require","_config","_interopRequireDefault","isomorphy","exports","_time","webpack","_jsUtils","_Barrier","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_splitComponent","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","time","timer"],"sources":["../../../../src/shared/utils/index.js"],"sourcesContent":["import themed, {\n COMPOSE,\n PRIORITY,\n ThemeProvider,\n} from '@dr.pogodin/react-themes';\n\nimport config from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport { Emitter, Semaphore } from '@dr.pogodin/js-utils';\n\nexport * from './Barrier';\nexport { default as splitComponent } from './splitComponent';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\n// Note: it should be done this way, as in some environments\n// \"process\" might not exist, and process.env.NODE_CONFIG_ENV\n// not injected by Webpack.\nlet NODE_CONFIG_ENV;\ntry {\n NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;\n} catch { /* noop */ }\n\nconst env = NODE_CONFIG_ENV || process.env.NODE_ENV;\nconst JU = env !== 'production' && webpack.requireWeak('./jest', __dirname);\n\n/**\n * @category Utilities\n * @global\n * @func withRetries\n * @desc\n * ```js\n * import { withRetries } from '@dr.pogodin/react-utils';\n * ```\n * Attempts to perform given asynchronous `action` up to `maxRetries` times,\n * with the given `interval` between attempts. If any attempt is successful,\n * the result is returned immediately, with no further attempts done;\n * otherwise, if all attempts fail, the result Promise rejects after the last\n * attempt.\n * @param {function} action\n * @param {number} [maxRetries=5] Optional. Maximum number of retries. Defaults\n * to 5 attempts.\n * @param {number} [interval=1000] Optional. Interval between retries [ms].\n * Defaults to 1 second.\n * @return {Promise} Resolves to the result of successful operation, or\n * rejects with the error from the latst failed attempt.\n * @example\n * import { withRetries } from '@dr.pogodin/react-utils';\n *\n * let firstCall = true;\n *\n * function sampleAction() {\n * if (!firstCall) return 'success';\n * firstCall = false;\n * throw Error('The first call to this method fails');\n * }\n *\n * withRetries(sampleAction).then(console.log);\n * // It will print 'success' after one second, once the second attempt\n * // is performed.\n */\nexport async function withRetries(action, maxRetries = 5, interval = 1000) {\n /* eslint-disable no-await-in-loop */\n for (let n = 1; ; ++n) {\n try {\n return await action();\n } catch (error) {\n if (n < maxRetries) await time.timer(interval);\n else throw error;\n }\n }\n /* eslint-enable no-await-in-loop */\n}\n\nexport {\n config,\n isomorphy,\n JU,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"mappings":"0nCAAA,IAAAA,YAAA,CAAAC,uBAAA,CAAAC,OAAA,8BAMA,IAAAC,OAAA,CAAAC,sBAAA,CAAAF,OAAA,cACA,IAAAG,SAAA,CAAAJ,uBAAA,CAAAC,OAAA,iBAAyCI,OAAA,CAAAD,SAAA,CAAAA,SAAA,CACzC,IAAAE,KAAA,CAAAH,sBAAA,CAAAF,OAAA,YACA,IAAAM,OAAA,CAAAP,uBAAA,CAAAC,OAAA,eAAqCI,OAAA,CAAAE,OAAA,CAAAA,OAAA,CAErC,IAAAC,QAAA,CAAAP,OAAA,yBAEA,IAAAQ,QAAA,CAAAR,OAAA,cAAAS,MAAA,CAAAC,IAAA,CAAAF,QAAA,EAAAG,OAAA,UAAAC,GAAA,KAAAA,GAAA,cAAAA,GAAA,0BAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,Y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c,GAAA,CAAAd,GAAA,IAAAmB,MAAA,CAAAH,OAAA,CAAAF,GAAA,IAAAG,KAAA,EAAAA,KAAA,CAAAM,GAAA,CAAAT,GAAA,CAAAK,MAAA,SAAAA,MAAA,CAE7DK,oBAAM,CAACC,OAAO,CAAGA,oBAAO,CACxBD,oBAAM,CAACE,QAAQ,CAAGA,qBAAQ,CAE1B;AACA;AACA;AACA,GAAI,CAAAC,eAAe,CACnB,GAAI,CACFA,eAAe,CAAGC,OAAO,CAACC,GAAG,CAACF,eAChC,CAAE,KAAM,CAAE,WAEV,KAAM,CAAAE,GAAG,CAAGF,eAAe,EAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,CACnD,KAAM,CAAAC,EAAE,CAAGF,GAAG,GAAK,YAAY,EAAInC,OAAO,CAACsC,WAAW,UAAWC,SAAS,CAAC,CAE3E;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,GAlCAzC,OAAA,CAAAuC,EAAA,CAAAA,EAAA,CAmCO,cAAe,CAAAG,WAAWA,CAACC,MAAM,CAAEC,UAAU,CAAG,CAAC,CAAEC,QAAQ,CAAG,IAAI,CAAE,CACzE,qCACA,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,EAAI,EAAEA,CAAC,CAAE,CACrB,GAAI,CACF,MAAO,MAAM,CAAAH,MAAM,EACrB,CAAE,MAAOI,KAAK,CAAE,CACd,GAAID,CAAC,CAAGF,UAAU,CAAE,KAAM,CAAAI,aAAI,CAACC,KAAK,CAACJ,QAAQ,CAAC,CAAC,IAC1C,MAAM,CAAAE,KACb,CACF,CACA,oCACF"}
1
+ {"version":3,"file":"index.js","names":["_reactThemes","_interopRequireWildcard","require","_config","_interopRequireDefault","isomorphy","exports","_time","webpack","_jsUtils","_Barrier","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_splitComponent","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","time","timer"],"sources":["../../../../src/shared/utils/index.js"],"sourcesContent":["import themed, {\n COMPOSE,\n PRIORITY,\n ThemeProvider,\n} from '@dr.pogodin/react-themes';\n\nimport config from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport { Emitter, Semaphore } from '@dr.pogodin/js-utils';\n\nexport * from './Barrier';\nexport { default as splitComponent } from './splitComponent';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\n// Note: it should be done this way, as in some environments\n// \"process\" might not exist, and process.env.NODE_CONFIG_ENV\n// not injected by Webpack.\nlet NODE_CONFIG_ENV;\ntry {\n NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;\n} catch { /* noop */ }\n\nconst env = NODE_CONFIG_ENV || process.env.NODE_ENV;\nconst JU = env !== 'production' && webpack.requireWeak('./jest', __dirname);\n\n/**\n * @category Utilities\n * @global\n * @func withRetries\n * @desc\n * ```js\n * import { withRetries } from '@dr.pogodin/react-utils';\n * ```\n * Attempts to perform given asynchronous `action` up to `maxRetries` times,\n * with the given `interval` between attempts. If any attempt is successful,\n * the result is returned immediately, with no further attempts done;\n * otherwise, if all attempts fail, the result Promise rejects after the last\n * attempt.\n * @param {function} action\n * @param {number} [maxRetries=5] Optional. Maximum number of retries. Defaults\n * to 5 attempts.\n * @param {number} [interval=1000] Optional. Interval between retries [ms].\n * Defaults to 1 second.\n * @return {Promise} Resolves to the result of successful operation, or\n * rejects with the error from the latst failed attempt.\n * @example\n * import { withRetries } from '@dr.pogodin/react-utils';\n *\n * let firstCall = true;\n *\n * function sampleAction() {\n * if (!firstCall) return 'success';\n * firstCall = false;\n * throw Error('The first call to this method fails');\n * }\n *\n * withRetries(sampleAction).then(console.log);\n * // It will print 'success' after one second, once the second attempt\n * // is performed.\n */\nexport async function withRetries(action, maxRetries = 5, interval = 1000) {\n /* eslint-disable no-await-in-loop */\n for (let n = 1; ; ++n) {\n try {\n return await action();\n } catch (error) {\n if (n < maxRetries) await time.timer(interval);\n else throw error;\n }\n }\n /* eslint-enable no-await-in-loop */\n}\n\nexport {\n config,\n isomorphy,\n JU,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"mappings":"0nCAAA,IAAAA,YAAA,CAAAC,uBAAA,CAAAC,OAAA,8BAMA,IAAAC,OAAA,CAAAC,sBAAA,CAAAF,OAAA,cACA,IAAAG,SAAA,CAAAJ,uBAAA,CAAAC,OAAA,iBAAyCI,OAAA,CAAAD,SAAA,CAAAA,SAAA,CACzC,IAAAE,KAAA,CAAAH,sBAAA,CAAAF,OAAA,YACA,IAAAM,OAAA,CAAAP,uBAAA,CAAAC,OAAA,eAAqCI,OAAA,CAAAE,OAAA,CAAAA,OAAA,CAErC,IAAAC,QAAA,CAAAP,OAAA,yBAEA,IAAAQ,QAAA,CAAAR,OAAA,cAAAS,MAAA,CAAAC,IAAA,CAAAF,QAAA,EAAAG,OAAA,UAAAC,GAAA,KAAAA,GAAA,cAAAA,GAAA,0BAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,CAAAJ,GAAA,YAAAA,GAAA,IAAAR,OAAA,EAAAA,OAAA,CAAAQ,GAAA,IAAAJ,QAAA,CAAAI,GAAA,SAAAH,MAAA,CAAAQ,cAAA,CAAAb,OAAA,CAAAQ,GAAA,EAAAM,UAAA,MAAAC,GAAA,SAAAA,CAAA,SAAAX,QAAA,CAAAI,GAAA,OACA,IAAAQ,eAAA,CAAAlB,sBAAA,CAAAF,OAAA,sBAA6D,SAAAqB,yBAAAC,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GC,OAAO,CAACC,GAAG,CAACF,eAChC,CAAE,KAAM,CAAE,WAEV,KAAM,CAAAE,GAAG,CAAGF,eAAe,EAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,CACnD,KAAM,CAAAC,EAAE,CAAGF,GAAG,GAAK,YAAY,EAAInC,OAAO,CAACsC,WAAW,UAAWC,SAAS,CAAC,CAE3E;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,GAlCAzC,OAAA,CAAAuC,EAAA,CAAAA,EAAA,CAmCO,cAAe,CAAAG,WAAWA,CAACC,MAAM,CAAEC,UAAU,CAAG,CAAC,CAAEC,QAAQ,CAAG,IAAI,CAAE,CACzE,qCACA,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,EAAI,EAAEA,CAAC,CAAE,CACrB,GAAI,CACF,MAAO,MAAM,CAAAH,MAAM,CAAC,CACtB,CAAE,MAAOI,KAAK,CAAE,CACd,GAAID,CAAC,CAAGF,UAAU,CAAE,KAAM,CAAAI,aAAI,CAACC,KAAK,CAACJ,QAAQ,CAAC,CAAC,IAC1C,MAAM,CAAAE,KACb,CACF,CACA,oCACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_buildInfo","require","_environmentCheck","getMode","process","env","NODE_ENV","isDevBuild","isProdBuild","buildTimestamp","getBuildInfo","timestamp"],"sources":["../../../../../src/shared/utils/isomorphy/index.js"],"sourcesContent":["import { getBuildInfo } from './buildInfo';\nimport { IS_CLIENT_SIDE, IS_SERVER_SIDE } from './environment-check';\n\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\nfunction getMode() {\n return process.env.NODE_ENV;\n}\n\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isDevBuild() {\n return getMode() === 'development';\n}\n\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isProdBuild() {\n return getMode() === 'production';\n}\n\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\nexport function buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n\nexport { IS_CLIENT_SIDE, IS_SERVER_SIDE, getBuildInfo };\n"],"mappings":"6gBAAA,IAAAA,UAAA,CAAAC,OAAA,gBACA,IAAAC,iBAAA,CAAAD,OAAA,wBAEA;AACA;AACA;AACA,GACA,QAAS,CAAAE,OAAOA,CAAA,CAAG,CACjB,MAAO,CAAAC,OAAO,CAACC,GAAG,CAACC,QACrB,CAEA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,UAAUA,CAAA,CAAG,CAC3B,MAAO,CAAAJ,OAAO,EAAE,GAAK,aACvB,CAEA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAK,WAAWA,CAAA,CAAG,CAC5B,MAAO,CAAAL,OAAO,EAAE,GAAK,YACvB,CAEA;AACA;AACA;AACA,GACO,QAAS,CAAAM,cAAcA,CAAA,CAAG,CAC/B,MAAO,GAAAC,uBAAY,GAAE,CAACC,SACxB"}
1
+ {"version":3,"file":"index.js","names":["_buildInfo","require","_environmentCheck","getMode","process","env","NODE_ENV","isDevBuild","isProdBuild","buildTimestamp","getBuildInfo","timestamp"],"sources":["../../../../../src/shared/utils/isomorphy/index.js"],"sourcesContent":["import { getBuildInfo } from './buildInfo';\nimport { IS_CLIENT_SIDE, IS_SERVER_SIDE } from './environment-check';\n\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\nfunction getMode() {\n return process.env.NODE_ENV;\n}\n\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isDevBuild() {\n return getMode() === 'development';\n}\n\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isProdBuild() {\n return getMode() === 'production';\n}\n\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\nexport function buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n\nexport { IS_CLIENT_SIDE, IS_SERVER_SIDE, getBuildInfo };\n"],"mappings":"6gBAAA,IAAAA,UAAA,CAAAC,OAAA,gBACA,IAAAC,iBAAA,CAAAD,OAAA,wBAEA;AACA;AACA;AACA,GACA,QAAS,CAAAE,OAAOA,CAAA,CAAG,CACjB,MAAO,CAAAC,OAAO,CAACC,GAAG,CAACC,QACrB,CAEA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAC,UAAUA,CAAA,CAAG,CAC3B,MAAO,CAAAJ,OAAO,CAAC,CAAC,GAAK,aACvB,CAEA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAK,WAAWA,CAAA,CAAG,CAC5B,MAAO,CAAAL,OAAO,CAAC,CAAC,GAAK,YACvB,CAEA;AACA;AACA;AACA,GACO,QAAS,CAAAM,cAAcA,CAAA,CAAG,CAC/B,MAAO,GAAAC,uBAAY,EAAC,CAAC,CAACC,SACxB"}
@@ -23,7 +23,7 @@
23
23
  // explicitly passed to the server-side renderer alongside the request,
24
24
  // so that it can to pick up asset paths for different named chunks.
25
25
  this.webpackStats=stats;done()})})}async runSsr(){let options=this.pragmas["ssr-options"];options=options?JSON.parse(options):{};// TODO: This is temporary to shortcut the logging added to SSR.
26
- if(options.logger===undefined){options.logger={debug:_lodash.noop,info:_lodash.noop,log:_lodash.noop,warn:_lodash.noop}}let root;switch(options.root){case"TEST":root=this.testFolder;break;default:root=process.cwd();}// Note: This enables Babel transformation for the code dynamically loaded
26
+ if(options.logger===undefined){options.logger={debug:_lodash.noop,info:_lodash.noop,log:_lodash.noop,warn:_lodash.noop}}let root;switch(options.root){case"TEST":root=this.testFolder;break;default:root=process.cwd()}// Note: This enables Babel transformation for the code dynamically loaded
27
27
  // below, as the usual Jest Babel setup does not seem to apply to
28
28
  // the environment code, and imports from it.
29
29
  (0,_register.default)({envName:options.babelEnv,extensions:[".js",".jsx",".svg"],root});if(!options.buildInfo)options.buildInfo=this.global.buildInfo;if(options.entry){const p=_path.default.resolve(this.testFolder,options.entry);options.Application=require(p)[options.entryExportName||"default"]}const renderer=(0,_renderer.default)(this.global.webpackConfig,options);let status=200;// OK
@@ -1 +1 @@
1
- {"version":3,"file":"E2eSsrEnv.js","names":["_path","_interopRequireDefault","require","_renderer","_lodash","_register","_jestEnvironmentJsdom","_memfs","_webpack","E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","Error","webpackStats","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert","exports","default"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats.hasErrors()) {\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n let status = 200; // OK\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":"gLAiBA,IAAAA,KAAA,CAAAC,sBAAA,CAAAC,OAAA,UACA,IAAAC,SAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAEA,IAAAE,OAAA,CAAAF,OAAA,WAKA,IAAAG,SAAA,CAAAJ,sBAAA,CAAAC,OAAA,qBACA,IAAAI,qBAAA,CAAAL,sBAAA,CAAAC,OAAA,4BACA,IAAAK,MAAA,CAAAL,OAAA,UACA,IAAAM,QAAA,CAAAP,sBAAA,CAAAC,OAAA,aA5BA;AACA;AACA;AACA;AACA;AACA,GALA,CAMA,+DAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA,uDAKA,qDAEe,KAAM,CAAAO,SAAS,QAAS,CAAAC,6BAAS,CAC9C;AACF;AACA;AACA,KACEC,iBAAiBA,CAAA,CAAG,CAClB,GAAI,CAAAC,OAAO,CAAG,IAAI,CAACC,OAAO,CAAC,wBAAwB,CAAC,CACpDD,OAAO,CAAGA,OAAO,CAAGE,IAAI,CAACC,KAAK,CAACH,OAAO,CAAC,CAAG,CAAC,CAAC,CAC5C,GAAAI,gBAAQ,EAACJ,OAAO,CAAE,CAChBK,OAAO,CAAE,IAAI,CAACC,UAAU,CACxBC,EAAE,CAAE,IAAI,CAACC,MAAM,CAACC,eAClB,CAAC,CAAC,CAEF,GAAI,CAAAC,OAAO,CAAG,IAAI,CAACT,OAAO,CAAC,wBAAwB,CAAC,EAAI,EAAE,CAC1DS,OAAO,CAAGpB,OAAO,CAACqB,aA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MAAM,CAAEhE,OAAO,CAAC,CAEtB,IAAI,CAACG,MAAM,CAACmE,GAAG,CAAG,IAAI,CAACA,GAAG,CAC1B,IAAI,CAACnE,MAAM,CAACC,eAAe,CAAG,GAAAmE,yBAAkB,EAAC,GAAI,CAAAC,aAAQ,CAAC,CAE9D;AACA,KAAM,CAAEH,aAAc,CAAC,CAAGL,MAAM,CAChC,IAAI,CAACxD,OAAO,CAAG6D,aAAa,CAAC7D,OAAO,CACpC,IAAI,CAACP,UAAU,CAAGK,aAAI,CAACmE,OAAO,CAACzE,OAAO,CAAC0E,QAAQ,CAAC,CAChD,IAAI,CAACC,OAAO,CAAG,CAAC/E,OAAO,CAAC,QAAQ,CAAC,CACjC,IAAI,CAACyD,UAAU,CAAGa,OAAO,CACzB,IAAI,CAACtE,OAAO,CAAGA,OACjB,CAEA,KAAM,CAAAgF,KAAKA,CAAA,CAAG,CACZ,KAAM,MAAK,CAACA,KAAK,EAAE,CACnB,KAAM,KAAI,CAAC/D,UAAU,EAAE,CACvB,GAAI,IAAI,CAAC8D,OAAO,CAAE,KAAM,KAAI,CAAC7C,MAAM,EAAE,CACrC,IAAI,CAAC3B,MAAM,CAAC0E,6BAA6B,CAAG,IAC9C,CAEA,KAAM,CAAAC,QAAQA,CAAA,CAAG,CACf,MAAO,KAAI,CAAC3E,MAAM,CAAC0E,6BAA6B,CAEhD;AACA;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAI,CAAC/F,OAAO,CAACgG,KAAK,CAAC,CAACC,OAAO,CAAEC,GAAG,EAAK,CAC1C,MAAO,CAAAlG,OAAO,CAACgG,KAAK,CAACE,GAAG,CAC1B,CAAC,CAAC,CACF1C,iBAAQ,CAAC2C,MAAM,EAAE,CACjB,KAAK,CAACN,QAAQ,EAChB,CACF,CAACO,OAAA,CAAAC,OAAA,CAAA9F,SAAA"}
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["_path","_interopRequireDefault","require","_renderer","_lodash","_register","_jestEnvironmentJsdom","_memfs","_webpack","E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","Error","webpackStats","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert","exports","default"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats.hasErrors()) {\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n let status = 200; // OK\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();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AG6D,aAAa,CAAC7D,OAAO,CACpC,IAAI,CAACP,UAAU,CAAGK,aAAI,CAACmE,OAAO,CAACzE,OAAO,CAAC0E,QAAQ,CAAC,CAChD,IAAI,CAACC,OAAO,CAAG,CAAC/E,OAAO,CAAC,QAAQ,CAAC,CACjC,IAAI,CAACyD,UAAU,CAAGa,OAAO,CACzB,IAAI,CAACtE,OAAO,CAAGA,OACjB,CAEA,KAAM,CAAAgF,KAAKA,CAAA,CAAG,CACZ,KAAM,MAAK,CAACA,KAAK,CAAC,CAAC,CACnB,KAAM,KAAI,CAAC/D,UAAU,CAAC,CAAC,CACvB,GAAI,IAAI,CAAC8D,OAAO,CAAE,KAAM,KAAI,CAAC7C,MAAM,CAAC,CAAC,CACrC,IAAI,CAAC3B,MAAM,CAAC0E,6BAA6B,CAAG,IAC9C,CAEA,KAAM,CAAAC,QAAQA,CAAA,CAAG,CACf,MAAO,KAAI,CAAC3E,MAAM,CAAC0E,6BAA6B,CAEhD;AACA;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAI,CAAC/F,OAAO,CAACgG,KAAK,CAAC,CAACC,OAAO,CAAEC,GAAG,EAAK,CAC1C,MAAO,CAAAlG,OAAO,CAACgG,KAAK,CAACE,GAAG,CAC1B,CAAC,CAAC,CACF1C,iBAAQ,CAAC2C,MAAM,CAAC,CAAC,CACjB,KAAK,CAACN,QAAQ,CAAC,CACjB,CACF,CAACO,OAAA,CAAAC,OAAA,CAAA9F,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_client","_testUtils","_interopRequireWildcard","_reactTestRenderer","_shallow","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","Date","now","jest","advanceTimersByTime","mount","scene","root","res","document","createElement","body","appendChild","destroy","act","unmount","remove","createRoot","render","component","Renderer","create","toJSON","shallowRender","renderer","ShallowRenderer","getRenderOutput","shallowSnapshot","expect","toMatchSnapshot","snapshot","simulate","TU","Simulate","exports"],"sources":["../../../../../src/shared/utils/jest/index.jsx"],"sourcesContent":["/* global expect, jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { createRoot } from 'react-dom/client';\nimport TU, { act } from 'react-dom/test-utils';\n\n/* eslint-disable import/no-extraneous-dependencies */\nimport Renderer from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow';\n/* eslint-enable import/no-extraneous-dependencies */\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react-dom/test-utils`.\n * @param {function} action\n */\nexport { act };\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param {React.ReactNode} scene\n * @return {HTMLElement} Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene) {\n let root;\n const res = document.createElement('div');\n document.body.appendChild(res);\n res.destroy = () => {\n act(() => root.unmount());\n res.remove();\n };\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\n/* OLD STUFF BELOW THIS MARK */\n\n/**\n * Renders provided ReactJS component into JSON representation of the component\n * tree, using [`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer).\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the rendered tree.\n * @example\n * import { JU } from '@dr.pogodin/react-utils';\n * console.log(JU.render(<div>Example</div>));\n */\nexport function render(component) {\n return Renderer.create(component).toJSON();\n}\n\n/**\n * Generates a shallow render of given ReactJS component, using\n * [react-test-renderer/shallow](https://reactjs.org/docs/shallow-renderer.html)\n * and returns the result.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the shallow component's render tree.\n */\nexport function shallowRender(component) {\n const renderer = new ShallowRenderer();\n renderer.render(component);\n return renderer.getRenderOutput();\n}\n\n/**\n * Makes a shallow snapshot test of the given ReactJS component, and also\n * returns JSON representation of the rendered component tree. Under the hood\n * it uses {@link module:JU.shallowRender shallowRender(..)} to generate\n * the render, then executes `expect(RENDER_RESULT).toMatchSnapshot()`,\n * and finally returns the `RENDER_RESULT` to the caller.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of shallow render.\n */\nexport function shallowSnapshot(component) {\n const res = shallowRender(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\n/**\n * Makes snapshot test of the given ReactJS component, and also returns JSON\n * representation of the rendered component tree. Under the hood, it uses\n * {@link module:JU.render render(..)} to render it, then executes\n * `expect(RENDER_RESULT).toMatchSnapshot()`, and then returns `RENDER_RESULT`.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON render of the component.\n */\nexport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AO,CAAArB,GACT,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACO,QAAS,CAAAsB,QAAQA,CAACX,SAAS,CAAE,CAClC,KAAM,CAAAX,GAAG,CAAGU,MAAM,CAACC,SAAS,CAAC,CAC7BS,MAAM,CAACpB,GAAG,CAAC,CAACqB,eAAe,EAAE,CAC7B,MAAO,CAAArB,GACT,CAEO,KAAM,CAAAuB,QAAQ,CAAGC,kBAAE,CAACC,QAAQ,CAACC,OAAA,CAAAH,QAAA,CAAAA,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_client","_testUtils","_interopRequireWildcard","_reactTestRenderer","_shallow","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","Date","now","jest","advanceTimersByTime","mount","scene","root","res","document","createElement","body","appendChild","destroy","act","unmount","remove","createRoot","render","component","Renderer","create","toJSON","shallowRender","renderer","ShallowRenderer","getRenderOutput","shallowSnapshot","expect","toMatchSnapshot","snapshot","simulate","TU","Simulate","exports"],"sources":["../../../../../src/shared/utils/jest/index.jsx"],"sourcesContent":["/* global expect, jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { createRoot } from 'react-dom/client';\nimport TU, { act } from 'react-dom/test-utils';\n\n/* eslint-disable import/no-extraneous-dependencies */\nimport Renderer from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow';\n/* eslint-enable import/no-extraneous-dependencies */\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react-dom/test-utils`.\n * @param {function} action\n */\nexport { act };\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param {React.ReactNode} scene\n * @return {HTMLElement} Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene) {\n let root;\n const res = document.createElement('div');\n document.body.appendChild(res);\n res.destroy = () => {\n act(() => root.unmount());\n res.remove();\n };\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\n/* OLD STUFF BELOW THIS MARK */\n\n/**\n * Renders provided ReactJS component into JSON representation of the component\n * tree, using [`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer).\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the rendered tree.\n * @example\n * import { JU } from '@dr.pogodin/react-utils';\n * console.log(JU.render(<div>Example</div>));\n */\nexport function render(component) {\n return Renderer.create(component).toJSON();\n}\n\n/**\n * Generates a shallow render of given ReactJS component, using\n * [react-test-renderer/shallow](https://reactjs.org/docs/shallow-renderer.html)\n * and returns the result.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the shallow component's render tree.\n */\nexport function shallowRender(component) {\n const renderer = new ShallowRenderer();\n renderer.render(component);\n return renderer.getRenderOutput();\n}\n\n/**\n * Makes a shallow snapshot test of the given ReactJS component, and also\n * returns JSON representation of the rendered component tree. Under the hood\n * it uses {@link module:JU.shallowRender shallowRender(..)} to generate\n * the render, then executes `expect(RENDER_RESULT).toMatchSnapshot()`,\n * and finally returns the `RENDER_RESULT` to the caller.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of shallow render.\n */\nexport function shallowSnapshot(component) {\n const res = shallowRender(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\n/**\n * Makes snapshot test of the given ReactJS component, and also returns JSON\n * representation of the rendered component tree. Under the hood, it uses\n * {@link module:JU.render render(..)} to render it, then executes\n * `expect(RENDER_RESULT).toMatchSnapshot()`, and then returns `RENDER_RESULT`.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON render of the component.\n */\nexport function snapshot(component) {\n const res = render(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\nexport const simulate = TU.Simulate;\n"],"mappings":"0iBAGA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,cACA,IAAAC,OAAA,CAAAD,OAAA,qBACA,IAAAE,UAAA,CAAAC,uBAAA,CAAAH,OAAA,0BAGA,IAAAI,kBAAA,CAAAL,sBAAA,CAAAC,OAAA,yBACA,IAAAK,QAAA,CAAAN,sBAAA,CAAAC,OAAA,iCAA0D,SAAAM,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,WAAAJ,wBAAAQ,GAAA,CAAAJ,WAAA,MAAAA,WAAA,EAAAI,GAAA,EAAAA,GAAA,CAAAC,UAAA,SAAAD,G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