@dr.pogodin/react-utils 1.10.2 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/bin/build.js +1 -3
  2. package/bin/setup.js +2 -2
  3. package/build/development/client/index.js.map +1 -1
  4. package/build/development/index.js +0 -9
  5. package/build/development/index.js.map +1 -1
  6. package/build/development/server/index.js +9 -12
  7. package/build/development/server/index.js.map +1 -1
  8. package/build/development/server/renderer.js +13 -16
  9. package/build/development/server/renderer.js.map +1 -1
  10. package/build/development/shared/components/Button/index.js +6 -6
  11. package/build/development/shared/components/Checkbox/index.js +6 -6
  12. package/build/development/shared/components/CodeSplit/ServerSide.js +2 -3
  13. package/build/development/shared/components/CodeSplit/ServerSide.js.map +1 -1
  14. package/build/development/shared/components/Dropdown/index.js +9 -9
  15. package/build/development/shared/components/GenericLink/index.js +1 -1
  16. package/build/development/shared/components/Input/index.js +6 -6
  17. package/build/development/shared/components/MetaTags.js +10 -9
  18. package/build/development/shared/components/MetaTags.js.map +1 -1
  19. package/build/development/shared/components/Modal/index.js +5 -5
  20. package/build/development/shared/components/PageLayout/index.js +6 -6
  21. package/build/development/shared/components/ScalableRect/index.js +2 -2
  22. package/build/development/shared/components/Throbber/index.js +10 -10
  23. package/build/development/shared/components/WithTooltip/index.js +7 -7
  24. package/build/development/shared/components/YouTubeVideo/index.js +9 -9
  25. package/build/development/shared/utils/index.js +1 -5
  26. package/build/development/shared/utils/index.js.map +1 -1
  27. package/build/development/shared/utils/time.js +3 -1
  28. package/build/development/shared/utils/time.js.map +1 -1
  29. package/build/development/style.css +149 -149
  30. package/build/development/web.bundle.js +19 -29
  31. package/build/production/client/index.js.map +1 -1
  32. package/build/production/index.js +1 -1
  33. package/build/production/index.js.map +1 -1
  34. package/build/production/server/index.js +3 -3
  35. package/build/production/server/index.js.map +1 -1
  36. package/build/production/server/renderer.js +8 -7
  37. package/build/production/server/renderer.js.map +1 -1
  38. package/build/production/shared/components/Button/index.js +1 -1
  39. package/build/production/shared/components/Button/index.js.map +1 -1
  40. package/build/production/shared/components/Checkbox/index.js +1 -1
  41. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  42. package/build/production/shared/components/CodeSplit/ServerSide.js +2 -2
  43. package/build/production/shared/components/CodeSplit/ServerSide.js.map +1 -1
  44. package/build/production/shared/components/Dropdown/index.js +1 -1
  45. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  46. package/build/production/shared/components/GenericLink/index.js +1 -1
  47. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  48. package/build/production/shared/components/Input/index.js +1 -1
  49. package/build/production/shared/components/Input/index.js.map +1 -1
  50. package/build/production/shared/components/MetaTags.js +1 -1
  51. package/build/production/shared/components/MetaTags.js.map +1 -1
  52. package/build/production/shared/components/Modal/index.js +1 -1
  53. package/build/production/shared/components/Modal/index.js.map +1 -1
  54. package/build/production/shared/components/PageLayout/index.js +1 -1
  55. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  56. package/build/production/shared/components/ScalableRect/index.js +1 -1
  57. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  58. package/build/production/shared/components/Throbber/index.js +2 -2
  59. package/build/production/shared/components/Throbber/index.js.map +1 -1
  60. package/build/production/shared/components/WithTooltip/index.js +1 -1
  61. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  62. package/build/production/shared/components/YouTubeVideo/index.js +1 -1
  63. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  64. package/build/production/shared/utils/index.js +1 -1
  65. package/build/production/shared/utils/index.js.map +1 -1
  66. package/build/production/shared/utils/time.js +1 -1
  67. package/build/production/shared/utils/time.js.map +1 -1
  68. package/build/production/style.css +1 -1
  69. package/build/production/style.css.map +1 -1
  70. package/build/production/web.bundle.js +1 -1
  71. package/build/production/web.bundle.js.map +1 -1
  72. package/config/babel/node-ssr.js +3 -3
  73. package/config/babel/webpack.js +2 -2
  74. package/config/eslint/default.json +6 -1
  75. package/config/stylelint/default.js +1 -0
  76. package/config/webpack/app-base.js +10 -4
  77. package/config/webpack/app-development.js +2 -2
  78. package/package.json +30 -29
  79. package/build/development/shared/utils/url.js +0 -41
  80. package/build/development/shared/utils/url.js.map +0 -1
  81. package/build/production/shared/utils/url.js +0 -23
  82. package/build/production/shared/utils/url.js.map +0 -1
@@ -82,6 +82,15 @@ function MetaTags({
82
82
  }) {
83
83
  const socTitle = socialTitle || title;
84
84
  const socDesc = socialDescription || description;
85
+ const context = (0, _react.useMemo)(() => ({
86
+ description,
87
+ image,
88
+ siteName,
89
+ socialDescription,
90
+ socialTitle,
91
+ title,
92
+ url
93
+ }), [description, image, siteName, socialDescription, socialTitle, title, url]);
85
94
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
86
95
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactHelmet.Helmet, {
87
96
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
@@ -124,15 +133,7 @@ function MetaTags({
124
133
  content: url
125
134
  }) : null]
126
135
  }), children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
127
- value: {
128
- description,
129
- image,
130
- siteName,
131
- socialDescription,
132
- socialTitle,
133
- title,
134
- url
135
- },
136
+ value: context,
136
137
  children: children
137
138
  }) : null]
138
139
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/components/MetaTags.jsx"],"names":["Context","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","defaultProps","propTypes","PT","node","string","isRequired"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,gBAAG,2BAAhB;AAEA;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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K,EAAEM,mBAAGE,MAAH,CAAUC,UAPE;AAQnBR,EAAAA,GAAG,EAAEK,mBAAGE;AARW,CAArB","sourcesContent":["import PT from 'prop-types';\nimport { createContext } 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 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\n value={{\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }}\n >\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"],"file":"MetaTags.js"}
1
+ {"version":3,"sources":["../../../../src/shared/components/MetaTags.jsx"],"names":["Context","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","context","defaultProps","propTypes","PT","node","string","isRequired"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,gBAAG,2BAAhB;A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;AAMtBE,EAAAA,GAAG,EAAE;AANiB,CAAxB;AASAR,QAAQ,CAACa,SAAT,GAAqB;AACnBZ,EAAAA,QAAQ,EAAEa,mBAAGC,IADM;AAEnBb,EAAAA,WAAW,EAAEY,mBAAGE,MAAH,CAAUC,UAFJ;AAGnBd,EAAAA,KAAK,EAAEW,mBAAGE,MAHS;AAInBZ,EAAAA,QAAQ,EAAEU,mBAAGE,MAJM;AAKnBX,EAAAA,iBAAiB,EAAES,mBAAGE,MALH;AAMnBV,EAAAA,WAAW,EAAEQ,mBAAGE,MANG;AAOnBT,EAAAA,KAAK,EAAEO,mBAAGE,MAAH,CAAUC,UAPE;AAQnBT,EAAAA,GAAG,EAAEM,mBAAGE;AARW,CAArB","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"],"file":"MetaTags.js"}
@@ -22,11 +22,11 @@ var _jsxRuntime = require("react/jsx-runtime");
22
22
 
23
23
  /* global document */
24
24
  var baseTheme = {
25
- "context": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___context___1ItZNx",
26
- "ad": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___ad___1uOejq",
27
- "hoc": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___hoc___2XWVy4",
28
- "overlay": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___overlay___3eQXFG",
29
- "container": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___container___S6eRC0"
25
+ "context": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___context___Szmbbz",
26
+ "ad": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___ad___Ah-Nsc",
27
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___hoc___Wki41G",
28
+ "overlay": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___overlay___ye2BZo",
29
+ "container": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___container___gyZ4rc"
30
30
  };
31
31
 
32
32
  /**
@@ -14,12 +14,12 @@ var _utils = require("../../utils");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
 
16
16
  var baseTheme = {
17
- "context": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___context___ct8AYv",
18
- "ad": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___ad___3ATReA",
19
- "hoc": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___hoc___1-IZXw",
20
- "container": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___container___1IWLUF",
21
- "mainPanel": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___mainPanel___rzMRqr",
22
- "sidePanel": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___sidePanel___1LD0Kd"
17
+ "context": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___context___m4mL-M",
18
+ "ad": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___ad___m3-mdC",
19
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___hoc___J15Z4H",
20
+ "container": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___container___T3cuHB",
21
+ "mainPanel": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___mainPanel___pPlQO2",
22
+ "sidePanel": "-dr-pogodin-react-utils___src-shared-components-PageLayout-base-theme___sidePanel___lqNh4h"
23
23
  };
24
24
  /**
25
25
  * Simple and themeable page layout. It keeps the main content centered in
@@ -40,9 +40,9 @@ function ScalableRect({
40
40
  style: {
41
41
  paddingBottom
42
42
  },
43
- className: "-dr-pogodin-react-utils___src-shared-components-ScalableRect-style___container___3XzGXs",
43
+ className: "-dr-pogodin-react-utils___src-shared-components-ScalableRect-style___container___EznFz3",
44
44
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
45
- className: "-dr-pogodin-react-utils___src-shared-components-ScalableRect-style___wrapper___1vMblT",
45
+ className: "-dr-pogodin-react-utils___src-shared-components-ScalableRect-style___wrapper___0vb7tq",
46
46
  children: children
47
47
  })
48
48
  });
@@ -14,12 +14,12 @@ var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
 
16
16
  var defaultTheme = {
17
- "context": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___context___3F9X6R",
18
- "ad": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___ad___27RWOc",
19
- "hoc": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___hoc___1mH4lL",
20
- "bouncing": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___bouncing___2Zvm3x",
21
- "container": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___container___YlvKSG",
22
- "circle": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___QhSt1A"
17
+ "context": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___context___uIObt7",
18
+ "ad": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___ad___XIxe9o",
19
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___hoc___YOyORH",
20
+ "bouncing": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___bouncing___TJe-6j",
21
+ "container": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___container___7zdld4",
22
+ "circle": "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___dBrB4g"
23
23
  };
24
24
  /**
25
25
  * Throbber is an "action in progress" indicator, which renders
@@ -35,13 +35,13 @@ function Throbber({
35
35
  theme
36
36
  }) {
37
37
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
38
- className: (theme.container ? theme.container + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___container___YlvKSG",
38
+ className: (theme.container ? theme.container + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___container___7zdld4",
39
39
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
40
- className: (theme.circle ? theme.circle + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___QhSt1A"
40
+ className: (theme.circle ? theme.circle + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___dBrB4g"
41
41
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
42
- className: (theme.circle ? theme.circle + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___QhSt1A"
42
+ className: (theme.circle ? theme.circle + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___dBrB4g"
43
43
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
44
- className: (theme.circle ? theme.circle + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___QhSt1A"
44
+ className: (theme.circle ? theme.circle + " " : "") + "-dr-pogodin-react-utils___src-shared-components-Throbber-theme___circle___dBrB4g"
45
45
  })]
46
46
  });
47
47
  }
@@ -23,13 +23,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
23
23
 
24
24
  /* global window */
25
25
  var defaultTheme = {
26
- "ad": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___ad___37hn-I",
27
- "hoc": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___hoc___2CTWO-",
28
- "context": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___context___1sPLIy",
29
- "appearance": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___appearance___1_CLjK",
30
- "arrow": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___arrow___1My0bf",
31
- "container": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___container___1RivOp",
32
- "wrapper": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___wrapper___23r31M"
26
+ "ad": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___ad___4xT7zE",
27
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___hoc___zd-vnH",
28
+ "context": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___context___GdZucr",
29
+ "appearance": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___appearance___L4ubm-",
30
+ "arrow": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___arrow___M9gywF",
31
+ "container": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___container___f9gY8K",
32
+ "wrapper": "-dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___wrapper___4qDBRM"
33
33
  };
34
34
  /**
35
35
  * Implements a simple to use and themeable tooltip component, _e.g._
@@ -20,17 +20,17 @@ var _Throbber = _interopRequireDefault(require("../Throbber"));
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
21
 
22
22
  var baseTheme = {
23
- "context": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___context___2wWh54",
24
- "ad": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___ad___ZI1L-P",
25
- "hoc": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___hoc___zCNKnQ",
26
- "container": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___container___1-I6ek",
27
- "video": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___video___2hd-z-"
23
+ "context": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___context___veKyYi",
24
+ "ad": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___ad___r3ABzd",
25
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___hoc___YKcPnR",
26
+ "container": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___container___sXHM81",
27
+ "video": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___video___SlV2zw"
28
28
  };
29
29
  var throbberTheme = {
30
- "context": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___context___3R7Jzw",
31
- "ad": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___ad___2H1dS-",
32
- "hoc": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___hoc___3U7SmJ",
33
- "container": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___container___2O23yT"
30
+ "context": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___context___dzIcLh",
31
+ "ad": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___ad___5a9XX1",
32
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___hoc___7sH52O",
33
+ "container": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-throbber___container___jTxmOX"
34
34
  };
35
35
  /**
36
36
  * A component for embeding a YouTube video.
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "time", {
32
32
  return _time.default;
33
33
  }
34
34
  });
35
- exports.webpack = exports.url = void 0;
35
+ exports.webpack = void 0;
36
36
  exports.withRetries = withRetries;
37
37
 
38
38
  var _reactThemes = _interopRequireWildcard(require("@dr.pogodin/react-themes"));
@@ -45,10 +45,6 @@ exports.isomorphy = isomorphy;
45
45
 
46
46
  var _time = _interopRequireDefault(require("./time"));
47
47
 
48
- var url = _interopRequireWildcard(require("./url"));
49
-
50
- exports.url = url;
51
-
52
48
  var webpack = _interopRequireWildcard(require("./webpack"));
53
49
 
54
50
  exports.webpack = webpack;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/utils/index.js"],"names":["themed","COMPOSE","PRIORITY","JU","isomorphy","IS_SERVER_SIDE","process","env","NODE_CONFIG_ENV","NODE_ENV","path","webpack","requireWeak","resolve","__dirname","newBarrier","promise","Promise","res","withRetries","action","maxRetries","interval","n","error","time","timer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AACA;;;;AACA;;AACA;;;;AACA;;;;;;;;AAEAA,qBAAOC,OAAP,GAAiBA,oBAAjB;AACAD,qBAAOE,QAAP,GAAkBA,qBAAlB;AAEA,IAAIC,EAAE,GAAG,IAAT,C,CAAe;;;;AACf,IAAIC,SAAS,CAACC,cAAV,IACC,CAACC,OAAO,CAACC,GAAR,CAAYC,eAAZ,IAA+BF,OAAO,CAACC,GAAR,CAAYE,QAA5C,MAA0D,YAD/D,EAEE;AACA;AACA,QAAMC,IAAI,GAAGC,OAAO,CAACC,WAAR,CAAoB,MAApB,CAAb;AACA,eAAAT,EAAE,GAAGQ,OAAO,CAACC,WAAR,CAAoBF,IAAI,CAACG,OAAL,CAAaC,SAAb,EAAwB,QAAxB,CAApB,CAAL;AACA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,UAAT,GAAsB;AACpB,MAAIF,OAAJ;AACA,QAAMG,OAAO,GAAG,IAAIC,OAAJ,CAAaC,GAAD,IAAS;AAAEL,IAAAA,OAAO,GAAGK,GAAV;AAAgB,GAAvC,CAAhB;AACAF,EAAAA,OAAO,CAACH,OAAR,GAAkBA,OAAlB;AACA,SAAOG,OAAP;AACD;AAED;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;;;AACO,eAAeG,WAAf,CAA2BC,MAA3B,EAAmCC,UAAU,GAAG,CAAhD,EAAmDC,QAAQ,GAAG,IAA9D,EAAoE;AACzE;AACA,OAAK,IAAIC,CAAC,GAAG,CAAb,GAAkB,EAAEA,CAApB,EAAuB;AACrB,QAAI;AACF,aAAO,MAAMH,MAAM,EAAnB;AACD,KAFD,CAEE,OAAOI,KAAP,EAAc;AACd,UAAID,CAAC,GAAGF,UAAR,EAAoB,MAAMI,cAAKC,KAAL,CAAWJ,QAAX,CAAN,CAApB,KACK,MAAME,KAAN;AACN;AACF;AACD;;AACD","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 url from './url';\nimport * as webpack from './webpack';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\nlet JU = null; // eslint-disable-line import/no-mutable-exports\nif (isomorphy.IS_SERVER_SIDE\n && (process.env.NODE_CONFIG_ENV || process.env.NODE_ENV) !== 'production'\n) {\n /* eslint-disable global-require */\n const path = webpack.requireWeak('path');\n JU = webpack.requireWeak(path.resolve(__dirname, './jest'));\n /* eslint-enable global-require */\n}\n\n/**\n * @category Utilities\n * @func newBarrier\n * @global\n * @desc\n * ```js\n * import { newBarrier } from '@dr.pogodin/react-utils';\n * ```\n * Creates a new async barrier: a Promise instance with its resolve method\n * attached as `.resolve` field.\n * @return {Promise}\n * @example\n * import { newBarrier } from '@dr.pogodin/react-utils';\n * (async () => {\n * const barrier = newBarrier();\n * setTimeout(() => barrier.resolve(), 5000);\n * await barrier;\n * console.log('This will be printed only after the timeout fires.');\n * })();\n */\nfunction newBarrier() {\n let resolve;\n const promise = new Promise((res) => { resolve = res; });\n promise.resolve = resolve;\n return promise;\n}\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 newBarrier,\n themed,\n ThemeProvider,\n time,\n url,\n webpack,\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/shared/utils/index.js"],"names":["themed","COMPOSE","PRIORITY","JU","isomorphy","IS_SERVER_SIDE","process","env","NODE_CONFIG_ENV","NODE_ENV","path","webpack","requireWeak","resolve","__dirname","newBarrier","promise","Promise","res","withRetries","action","maxRetries","interval","n","error","time","timer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AACA;;;;AACA;;AACA;;;;;;;;AAEAA,qBAAOC,OAAP,GAAiBA,oBAAjB;AACAD,qBAAOE,QAAP,GAAkBA,qBAAlB;AAEA,IAAIC,EAAE,GAAG,IAAT,C,CAAe;;;;AACf,IAAIC,SAAS,CAACC,cAAV,IACC,CAACC,OAAO,CAACC,GAAR,CAAYC,eAAZ,IAA+BF,OAAO,CAACC,GAAR,CAAYE,QAA5C,MAA0D,YAD/D,EAEE;AACA;AACA,QAAMC,IAAI,GAAGC,OAAO,CAACC,WAAR,CAAoB,MAApB,CAAb;AACA,eAAAT,EAAE,GAAGQ,OAAO,CAACC,WAAR,CAAoBF,IAAI,CAACG,OAAL,CAAaC,SAAb,EAAwB,QAAxB,CAApB,CAAL;AACA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,UAAT,GAAsB;AACpB,MAAIF,OAAJ;AACA,QAAMG,OAAO,GAAG,IAAIC,OAAJ,CAAaC,GAAD,IAAS;AAAEL,IAAAA,OAAO,GAAGK,GAAV;AAAgB,GAAvC,CAAhB;AACAF,EAAAA,OAAO,CAACH,OAAR,GAAkBA,OAAlB;AACA,SAAOG,OAAP;AACD;AAED;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;;;AACO,eAAeG,WAAf,CAA2BC,MAA3B,EAAmCC,UAAU,GAAG,CAAhD,EAAmDC,QAAQ,GAAG,IAA9D,EAAoE;AACzE;AACA,OAAK,IAAIC,CAAC,GAAG,CAAb,GAAkB,EAAEA,CAApB,EAAuB;AACrB,QAAI;AACF,aAAO,MAAMH,MAAM,EAAnB;AACD,KAFD,CAEE,OAAOI,KAAP,EAAc;AACd,UAAID,CAAC,GAAGF,UAAR,EAAoB,MAAMI,cAAKC,KAAL,CAAWJ,QAAX,CAAN,CAApB,KACK,MAAME,KAAN;AACN;AACF;AACD;;AACD","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\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\nlet JU = null; // eslint-disable-line import/no-mutable-exports\nif (isomorphy.IS_SERVER_SIDE\n && (process.env.NODE_CONFIG_ENV || process.env.NODE_ENV) !== 'production'\n) {\n /* eslint-disable global-require */\n const path = webpack.requireWeak('path');\n JU = webpack.requireWeak(path.resolve(__dirname, './jest'));\n /* eslint-enable global-require */\n}\n\n/**\n * @category Utilities\n * @func newBarrier\n * @global\n * @desc\n * ```js\n * import { newBarrier } from '@dr.pogodin/react-utils';\n * ```\n * Creates a new async barrier: a Promise instance with its resolve method\n * attached as `.resolve` field.\n * @return {Promise}\n * @example\n * import { newBarrier } from '@dr.pogodin/react-utils';\n * (async () => {\n * const barrier = newBarrier();\n * setTimeout(() => barrier.resolve(), 5000);\n * await barrier;\n * console.log('This will be printed only after the timeout fires.');\n * })();\n */\nfunction newBarrier() {\n let resolve;\n const promise = new Promise((res) => { resolve = res; });\n promise.resolve = resolve;\n return promise;\n}\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 newBarrier,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"file":"index.js"}
@@ -95,7 +95,9 @@ _dayjs.default.now = Date.now;
95
95
  */
96
96
 
97
97
  _dayjs.default.timer = async function timer(timeout) {
98
- return new Promise(resolve => setTimeout(resolve, timeout));
98
+ return new Promise(resolve => {
99
+ setTimeout(resolve, timeout);
100
+ });
99
101
  };
100
102
 
101
103
  var _default = _dayjs.default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/utils/time.js"],"names":["dayjs","SEC_MS","MIN_MS","HOUR_MS","DAY_MS","YEAR_MS","now","Date","timer","timeout","Promise","resolve","setTimeout"],"mappings":";;;;;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAA,eAAMC,MAAN,GAAe,IAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAME,MAAN,GAAe,KAAKF,eAAMC,MAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAMG,OAAN,GAAgB,KAAKH,eAAME,MAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAF,eAAMI,MAAN,GAAe,KAAKJ,eAAMG,OAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAH,eAAMK,OAAN,GAAgB,MAAML,eAAMI,MAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAJ,eAAMM,GAAN,GAAYC,IAAI,CAACD,GAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAN,eAAMQ,KAAN,GAAc,eAAeA,KAAf,CAAqBC,OAArB,EAA8B;AAC1C,SAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAaC,UAAU,CAACD,OAAD,EAAUF,OAAV,CAAnC,CAAP;AACD,CAFD;;eAIeT,c","sourcesContent":["/**\n * @category Utilities\n * @module time\n * @desc\n * ```js\n * import { time } from '@dr.pogodin/react-utils';\n * ```\n * Date & time utilities. The `time` export is a convenient alias for\n * [dayjs](https://day.js.org/en/) library, _i.e._ you can use `time`\n * in all ways you would use `dayjs`. It is further extended with\n * the following additional members.\n */\n\nimport dayjs from 'dayjs';\n\n/**\n * @static\n * @const SEC_MS\n * @desc One second, expressed in milliseconds (equals 1000 ms).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.SEC_MS); // Prints: 1000\n */\ndayjs.SEC_MS = 1000;\n\n/**\n * @static\n * @const MIN_MS\n * @desc One minute, expressed in milliseconds (equals 60 &times; `SEC_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.MIN_MS); // Prints: 60000\n */\ndayjs.MIN_MS = 60 * dayjs.SEC_MS;\n\n/**\n * @static\n * @const HOUR_MS\n * @desc One hour, expressed in milliseconds (equals 60 &times; `MIN_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.HOUR_MS); // Prints: 3600000\n */\ndayjs.HOUR_MS = 60 * dayjs.MIN_MS;\n\n/**\n * @static\n * @const DAY_MS\n * @desc One day, expressed in milliseconds (equals 24 &times; `HOUR_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.DAY_MS); // Prints: 86400000\n */\ndayjs.DAY_MS = 24 * dayjs.HOUR_MS;\n\n/**\n * @static\n * @const YEAR_MS\n * @desc One year, expressed in milliseconds (equals 365 &times; `DAY_MS`,\n * thus a normal, non-leap year).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.YEAR_MS); // Prints: 31536000000\n */\ndayjs.YEAR_MS = 365 * dayjs.DAY_MS;\n\n/**\n * @static\n * @func now\n * @desc Returns Unix timestamp [ms] (thus, it is just an alias for `Date.now`).\n * @return {number}\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.now()); // Prints the current timestamp, e.g. 1618608761000.\n */\ndayjs.now = Date.now;\n\n/**\n * @static\n * @func timer\n * @desc Creates a Promise, which resolves after the given timeout.\n * @param {number} timeout Timeout [ms].\n * @return {Promise} Resolves after the timeout.\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * time.timer(5000).then(() => console.log('5 seconds have passed'))\n */\ndayjs.timer = async function timer(timeout) {\n return new Promise((resolve) => setTimeout(resolve, timeout));\n};\n\nexport default dayjs;\n"],"file":"time.js"}
1
+ {"version":3,"sources":["../../../../src/shared/utils/time.js"],"names":["dayjs","SEC_MS","MIN_MS","HOUR_MS","DAY_MS","YEAR_MS","now","Date","timer","timeout","Promise","resolve","setTimeout"],"mappings":";;;;;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAA,eAAMC,MAAN,GAAe,IAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAME,MAAN,GAAe,KAAKF,eAAMC,MAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAMG,OAAN,GAAgB,KAAKH,eAAME,MAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAF,eAAMI,MAAN,GAAe,KAAKJ,eAAMG,OAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAH,eAAMK,OAAN,GAAgB,MAAML,eAAMI,MAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAJ,eAAMM,GAAN,GAAYC,IAAI,CAACD,GAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAN,eAAMQ,KAAN,GAAc,eAAeA,KAAf,CAAqBC,OAArB,EAA8B;AAC1C,SAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAa;AAC9BC,IAAAA,UAAU,CAACD,OAAD,EAAUF,OAAV,CAAV;AACD,GAFM,CAAP;AAGD,CAJD;;eAMeT,c","sourcesContent":["/**\n * @category Utilities\n * @module time\n * @desc\n * ```js\n * import { time } from '@dr.pogodin/react-utils';\n * ```\n * Date & time utilities. The `time` export is a convenient alias for\n * [dayjs](https://day.js.org/en/) library, _i.e._ you can use `time`\n * in all ways you would use `dayjs`. It is further extended with\n * the following additional members.\n */\n\nimport dayjs from 'dayjs';\n\n/**\n * @static\n * @const SEC_MS\n * @desc One second, expressed in milliseconds (equals 1000 ms).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.SEC_MS); // Prints: 1000\n */\ndayjs.SEC_MS = 1000;\n\n/**\n * @static\n * @const MIN_MS\n * @desc One minute, expressed in milliseconds (equals 60 &times; `SEC_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.MIN_MS); // Prints: 60000\n */\ndayjs.MIN_MS = 60 * dayjs.SEC_MS;\n\n/**\n * @static\n * @const HOUR_MS\n * @desc One hour, expressed in milliseconds (equals 60 &times; `MIN_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.HOUR_MS); // Prints: 3600000\n */\ndayjs.HOUR_MS = 60 * dayjs.MIN_MS;\n\n/**\n * @static\n * @const DAY_MS\n * @desc One day, expressed in milliseconds (equals 24 &times; `HOUR_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.DAY_MS); // Prints: 86400000\n */\ndayjs.DAY_MS = 24 * dayjs.HOUR_MS;\n\n/**\n * @static\n * @const YEAR_MS\n * @desc One year, expressed in milliseconds (equals 365 &times; `DAY_MS`,\n * thus a normal, non-leap year).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.YEAR_MS); // Prints: 31536000000\n */\ndayjs.YEAR_MS = 365 * dayjs.DAY_MS;\n\n/**\n * @static\n * @func now\n * @desc Returns Unix timestamp [ms] (thus, it is just an alias for `Date.now`).\n * @return {number}\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.now()); // Prints the current timestamp, e.g. 1618608761000.\n */\ndayjs.now = Date.now;\n\n/**\n * @static\n * @func timer\n * @desc Creates a Promise, which resolves after the given timeout.\n * @param {number} timeout Timeout [ms].\n * @return {Promise} Resolves after the timeout.\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * time.timer(5000).then(() => console.log('5 seconds have passed'))\n */\ndayjs.timer = async function timer(timeout) {\n return new Promise((resolve) => {\n setTimeout(resolve, timeout);\n });\n};\n\nexport default dayjs;\n"],"file":"time.js"}