@dr.pogodin/react-utils 1.21.1 → 1.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/development/client/index.js +0 -7
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +3 -17
- package/build/development/client/init.js.map +1 -1
- package/build/development/index.js +0 -13
- package/build/development/index.js.map +1 -1
- package/build/development/server/Cache.js +2 -9
- package/build/development/server/Cache.js.map +1 -1
- package/build/development/server/index.js +7 -32
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +24 -80
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +21 -61
- package/build/development/server/server.js.map +1 -1
- package/build/development/server/utils/errors.js +2 -9
- package/build/development/server/utils/errors.js.map +1 -1
- package/build/development/server/utils/index.js +0 -4
- package/build/development/shared/components/Button/index.js +2 -13
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +2 -9
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/CodeSplit/index.js +11 -22
- package/build/development/shared/components/CodeSplit/index.js.map +1 -1
- package/build/development/shared/components/Dropdown/index.js +0 -11
- package/build/development/shared/components/Dropdown/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +3 -9
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +0 -7
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Link.js +3 -6
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/MetaTags.js +1 -8
- package/build/development/shared/components/MetaTags.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +2 -19
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/NavLink.js +2 -6
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +0 -7
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/ScalableRect/index.js +1 -6
- package/build/development/shared/components/ScalableRect/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +0 -9
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +9 -28
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +0 -16
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +3 -11
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/index.js +0 -17
- package/build/development/shared/components/index.js.map +1 -1
- package/build/development/shared/utils/Barrier.js +1 -13
- package/build/development/shared/utils/Barrier.js.map +1 -1
- package/build/development/shared/utils/Emitter.js +4 -13
- package/build/development/shared/utils/Emitter.js.map +1 -1
- package/build/development/shared/utils/Semaphore.js +13 -19
- package/build/development/shared/utils/Semaphore.js.map +1 -1
- package/build/development/shared/utils/config.js +0 -5
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/index.js +5 -26
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/isomorphy.js +6 -12
- package/build/development/shared/utils/isomorphy.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +20 -41
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +10 -31
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +2 -5
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/shared/utils/time.js +52 -14
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/development/shared/utils/webpack.js +1 -5
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/development/style.css +5 -24
- package/build/development/web.bundle.js +27 -27
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js.map +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/Cache.js.map +1 -1
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js.map +1 -1
- package/build/production/server/utils/errors.js.map +1 -1
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/CodeSplit/index.js.map +1 -1
- package/build/production/shared/components/Dropdown/index.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/MetaTags.js.map +1 -1
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/NavLink.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/ScalableRect/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/index.js.map +1 -1
- package/build/production/shared/utils/Barrier.js.map +1 -1
- package/build/production/shared/utils/Emitter.js.map +1 -1
- package/build/production/shared/utils/Semaphore.js.map +1 -1
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/isomorphy.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/shared/utils/time.js +21 -2
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/production/shared/utils/webpack.js.map +1 -1
- package/build/production/style.css +1 -1
- package/build/production/style.css.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/config/babel/node-ssr.js +1 -1
- package/package.json +33 -31
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _qs = _interopRequireDefault(require("qs"));
|
|
13
|
-
|
|
14
10
|
var _ScalableRect = _interopRequireDefault(require("../ScalableRect"));
|
|
15
|
-
|
|
16
11
|
var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
|
|
17
|
-
|
|
18
12
|
var _Throbber = _interopRequireDefault(require("../Throbber"));
|
|
19
|
-
|
|
20
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
14
|
const baseTheme = {
|
|
23
15
|
"context": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___context___veKyYi",
|
|
24
16
|
"ad": "-dr-pogodin-react-utils___src-shared-components-YouTubeVideo-base___ad___r3ABzd",
|
|
@@ -47,7 +39,6 @@ const throbberTheme = {
|
|
|
47
39
|
* @param {string} [props.title] The `title` attribute to add to the player
|
|
48
40
|
* IFrame.
|
|
49
41
|
*/
|
|
50
|
-
|
|
51
42
|
function YouTubeVideo({
|
|
52
43
|
autoplay,
|
|
53
44
|
src,
|
|
@@ -60,7 +51,9 @@ function YouTubeVideo({
|
|
|
60
51
|
url = `https://www.youtube.com/embed/${videoId}`;
|
|
61
52
|
delete query.v;
|
|
62
53
|
query.autoplay = autoplay ? 1 : 0;
|
|
63
|
-
url += `?${_qs.default.stringify(query)}`;
|
|
54
|
+
url += `?${_qs.default.stringify(query)}`;
|
|
55
|
+
|
|
56
|
+
// TODO: https://developers.google.com/youtube/player_parameters
|
|
64
57
|
// More query parameters can be exposed via the component props.
|
|
65
58
|
|
|
66
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ScalableRect.default, {
|
|
@@ -77,7 +70,6 @@ function YouTubeVideo({
|
|
|
77
70
|
})]
|
|
78
71
|
});
|
|
79
72
|
}
|
|
80
|
-
|
|
81
73
|
const ThemedYouTubeVideo = (0, _reactThemes.default)('YouTubeVideo', ['container', 'video'], baseTheme)(YouTubeVideo);
|
|
82
74
|
YouTubeVideo.propTypes = {
|
|
83
75
|
autoplay: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","container","throbberTheme","video","ThemedYouTubeVideo","themed","baseTheme","propTypes","PT","bool","string","isRequired","themeType","defaultProps"],"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":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","container","throbberTheme","video","ThemedYouTubeVideo","themed","baseTheme","propTypes","PT","bool","string","isRequired","themeType","defaultProps"],"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":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAA2C;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,CAAC;EACpBC,QAAQ;EACRC,GAAG;EACHC,KAAK;EACLC;AACF,CAAC,EAAE;EACD,IAAI,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAGJ,GAAG,CAACK,KAAK,CAAC,GAAG,CAAC;EACjCD,KAAK,GAAGA,KAAK,GAAGE,WAAE,CAACC,KAAK,CAACH,KAAK,CAAC,GAAG,CAAC,CAAC;EAEpC,MAAMI,OAAO,GAAGJ,KAAK,CAACK,CAAC,IAAIN,GAAG,CAACO,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;EAC9DP,GAAG,GAAI,iCAAgCK,OAAQ,EAAC;EAEhD,OAAOJ,KAAK,CAACK,CAAC;EACdL,KAAK,CAACL,QAAQ,GAAGA,QAAQ,GAAG,CAAC,GAAG,CAAC;EACjCI,GAAG,IAAK,IAAGG,WAAE,CAACK,SAAS,CAACP,KAAK,CAAE,EAAC;;EAEhC;EACA;;EAEA,oBACE,sBAAC,qBAAY;IAAC,SAAS,EAAEH,KAAK,CAACW,SAAU;IAAC,KAAK,EAAC,MAAM;IAAA,wBACpD,qBAAC,iBAAQ;MAAC,KAAK,EAAEC;IAAc,EAAG,eAClC;MACE,KAAK,EAAC,UAAU;MAChB,eAAe;MACf,SAAS,EAAEZ,KAAK,CAACa,KAAM;MACvB,GAAG,EAAEX,GAAI;MACT,KAAK,EAAED;IAAM,EACb;EAAA,EACW;AAEnB;AAEA,MAAMa,kBAAkB,GAAG,IAAAC,oBAAM,EAC/B,cAAc,EACd,CACE,WAAW,EACX,OAAO,CACR,EACDC,SAAS,CACV,CAACnB,YAAY,CAAC;AAEfA,YAAY,CAACoB,SAAS,GAAG;EACvBnB,QAAQ,EAAEoB,kBAAE,CAACC,IAAI;EACjBpB,GAAG,EAAEmB,kBAAE,CAACE,MAAM,CAACC,UAAU;EACzBrB,KAAK,EAAEc,kBAAkB,CAACQ,SAAS,CAACD,UAAU;EAC9CpB,KAAK,EAAEiB,kBAAE,CAACE;AACZ,CAAC;AAEDvB,YAAY,CAAC0B,YAAY,GAAG;EAC1BzB,QAAQ,EAAE,KAAK;EACfG,KAAK,EAAE;AACT,CAAC;AAAC,eAEaa,kBAAkB;AAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -95,36 +94,20 @@ Object.defineProperty(exports, "client", {
|
|
|
95
94
|
return _client.default;
|
|
96
95
|
}
|
|
97
96
|
});
|
|
98
|
-
|
|
99
97
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
100
|
-
|
|
101
98
|
var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
102
|
-
|
|
103
99
|
var _client = _interopRequireDefault(require("../../client"));
|
|
104
|
-
|
|
105
100
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
106
|
-
|
|
107
101
|
var _Input = _interopRequireDefault(require("./Input"));
|
|
108
|
-
|
|
109
102
|
var _Link = _interopRequireDefault(require("./Link"));
|
|
110
|
-
|
|
111
103
|
var _PageLayout = _interopRequireDefault(require("./PageLayout"));
|
|
112
|
-
|
|
113
104
|
var _MetaTags = _interopRequireDefault(require("./MetaTags"));
|
|
114
|
-
|
|
115
105
|
var _Modal = _interopRequireWildcard(require("./Modal"));
|
|
116
|
-
|
|
117
106
|
var _NavLink = _interopRequireDefault(require("./NavLink"));
|
|
118
|
-
|
|
119
107
|
var _ScalableRect = _interopRequireDefault(require("./ScalableRect"));
|
|
120
|
-
|
|
121
108
|
var _Throbber = _interopRequireDefault(require("./Throbber"));
|
|
122
|
-
|
|
123
109
|
var _WithTooltip = _interopRequireDefault(require("./WithTooltip"));
|
|
124
|
-
|
|
125
110
|
var _YouTubeVideo = _interopRequireDefault(require("./YouTubeVideo"));
|
|
126
|
-
|
|
127
111
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
128
|
-
|
|
129
112
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
130
113
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/shared/components/index.js"],"sourcesContent":["/**\n * Just an aggregation of all exported components into a single module.\n */\n\nexport { default as Button } from 'components/Button';\nexport { default as Checkbox } from 'components/Checkbox';\nexport { default as client } from 'client';\nexport { default as Dropdown } from 'components/Dropdown';\nexport { default as Input } from 'components/Input';\nexport { default as Link } from 'components/Link';\nexport { default as PageLayout } from 'components/PageLayout';\nexport { default as MetaTags } from 'components/MetaTags';\nexport { default as Modal, BaseModal } from 'components/Modal';\nexport { default as NavLink } from 'components/NavLink';\nexport { default as ScalableRect } from 'components/ScalableRect';\nexport { default as Throbber } from 'components/Throbber';\nexport { default as WithTooltip } from 'components/WithTooltip';\nexport { default as YouTubeVideo } from 'components/YouTubeVideo';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/shared/components/index.js"],"sourcesContent":["/**\n * Just an aggregation of all exported components into a single module.\n */\n\nexport { default as Button } from 'components/Button';\nexport { default as Checkbox } from 'components/Checkbox';\nexport { default as client } from 'client';\nexport { default as Dropdown } from 'components/Dropdown';\nexport { default as Input } from 'components/Input';\nexport { default as Link } from 'components/Link';\nexport { default as PageLayout } from 'components/PageLayout';\nexport { default as MetaTags } from 'components/MetaTags';\nexport { default as Modal, BaseModal } from 'components/Modal';\nexport { default as NavLink } from 'components/NavLink';\nexport { default as ScalableRect } from 'components/ScalableRect';\nexport { default as Throbber } from 'components/Throbber';\nexport { default as WithTooltip } from 'components/WithTooltip';\nexport { default as YouTubeVideo } from 'components/YouTubeVideo';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAkE;AAAA"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Barrier = void 0;
|
|
7
7
|
exports.newBarrier = newBarrier;
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Barrier is just a Promise which has resolve and reject exposed as instance
|
|
11
10
|
* methods.
|
|
@@ -15,7 +14,6 @@ class Barrier extends Promise {
|
|
|
15
14
|
#resolved = false;
|
|
16
15
|
#reject;
|
|
17
16
|
#rejected = false;
|
|
18
|
-
|
|
19
17
|
constructor(executor) {
|
|
20
18
|
let resolveRef;
|
|
21
19
|
let rejectRef;
|
|
@@ -24,50 +22,40 @@ class Barrier extends Promise {
|
|
|
24
22
|
resolve(value);
|
|
25
23
|
this.#resolved = true;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
25
|
rejectRef = error => {
|
|
29
26
|
reject(error);
|
|
30
27
|
this.#rejected = true;
|
|
31
28
|
};
|
|
32
|
-
|
|
33
29
|
if (executor) executor(resolveRef, rejectRef);
|
|
34
30
|
});
|
|
35
31
|
this.#resolve = resolveRef;
|
|
36
32
|
this.#reject = rejectRef;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
get resolve() {
|
|
40
35
|
return this.#resolve;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
get resolved() {
|
|
44
38
|
return this.#resolved;
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
get reject() {
|
|
48
41
|
return this.#reject;
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
get rejected() {
|
|
52
44
|
return this.#rejected;
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
then(onFulfilled, onRejected) {
|
|
56
47
|
const res = super.then(onFulfilled, onRejected);
|
|
57
48
|
res.#resolve = this.#resolve;
|
|
58
49
|
res.#reject = this.#reject;
|
|
59
50
|
return res;
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
}
|
|
53
|
+
|
|
63
54
|
/**
|
|
64
55
|
* Creates a new Barrier.
|
|
65
56
|
* @returns {Barrier}
|
|
66
57
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
58
|
exports.Barrier = Barrier;
|
|
70
|
-
|
|
71
59
|
function newBarrier(executor) {
|
|
72
60
|
return new Barrier(executor);
|
|
73
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Barrier.js","names":["Barrier","Promise","resolve","resolved","reject","rejected","constructor","executor","resolveRef","rejectRef","value","error","then","onFulfilled","onRejected","res","newBarrier"],"sources":["../../../../src/shared/utils/Barrier.js"],"sourcesContent":["/**\n * Barrier is just a Promise which has resolve and reject exposed as instance\n * methods.\n */\nexport class Barrier extends Promise {\n #resolve;\n\n #resolved = false;\n\n #reject;\n\n #rejected = false;\n\n constructor(executor) {\n let resolveRef;\n let rejectRef;\n super((resolve, reject) => {\n resolveRef = (value) => {\n resolve(value);\n this.#resolved = true;\n };\n rejectRef = (error) => {\n reject(error);\n this.#rejected = true;\n };\n if (executor) executor(resolveRef, rejectRef);\n });\n this.#resolve = resolveRef;\n this.#reject = rejectRef;\n }\n\n get resolve() { return this.#resolve; }\n\n get resolved() { return this.#resolved; }\n\n get reject() { return this.#reject; }\n\n get rejected() { return this.#rejected; }\n\n then(onFulfilled, onRejected) {\n const res = super.then(onFulfilled, onRejected);\n res.#resolve = this.#resolve;\n res.#reject = this.#reject;\n return res;\n }\n}\n\n/**\n * Creates a new Barrier.\n * @returns {Barrier}\n */\nexport function newBarrier(executor) {\n return new Barrier(executor);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Barrier.js","names":["Barrier","Promise","resolve","resolved","reject","rejected","constructor","executor","resolveRef","rejectRef","value","error","then","onFulfilled","onRejected","res","newBarrier"],"sources":["../../../../src/shared/utils/Barrier.js"],"sourcesContent":["/**\n * Barrier is just a Promise which has resolve and reject exposed as instance\n * methods.\n */\nexport class Barrier extends Promise {\n #resolve;\n\n #resolved = false;\n\n #reject;\n\n #rejected = false;\n\n constructor(executor) {\n let resolveRef;\n let rejectRef;\n super((resolve, reject) => {\n resolveRef = (value) => {\n resolve(value);\n this.#resolved = true;\n };\n rejectRef = (error) => {\n reject(error);\n this.#rejected = true;\n };\n if (executor) executor(resolveRef, rejectRef);\n });\n this.#resolve = resolveRef;\n this.#reject = rejectRef;\n }\n\n get resolve() { return this.#resolve; }\n\n get resolved() { return this.#resolved; }\n\n get reject() { return this.#reject; }\n\n get rejected() { return this.#rejected; }\n\n then(onFulfilled, onRejected) {\n const res = super.then(onFulfilled, onRejected);\n res.#resolve = this.#resolve;\n res.#reject = this.#reject;\n return res;\n }\n}\n\n/**\n * Creates a new Barrier.\n * @returns {Barrier}\n */\nexport function newBarrier(executor) {\n return new Barrier(executor);\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,OAAO,SAASC,OAAO,CAAC;EACnC,CAACC,OAAO;EAER,CAACC,QAAQ,GAAG,KAAK;EAEjB,CAACC,MAAM;EAEP,CAACC,QAAQ,GAAG,KAAK;EAEjBC,WAAW,CAACC,QAAQ,EAAE;IACpB,IAAIC,UAAU;IACd,IAAIC,SAAS;IACb,KAAK,CAAC,CAACP,OAAO,EAAEE,MAAM,KAAK;MACzBI,UAAU,GAAIE,KAAK,IAAK;QACtBR,OAAO,CAACQ,KAAK,CAAC;QACd,IAAI,CAAC,CAACP,QAAQ,GAAG,IAAI;MACvB,CAAC;MACDM,SAAS,GAAIE,KAAK,IAAK;QACrBP,MAAM,CAACO,KAAK,CAAC;QACb,IAAI,CAAC,CAACN,QAAQ,GAAG,IAAI;MACvB,CAAC;MACD,IAAIE,QAAQ,EAAEA,QAAQ,CAACC,UAAU,EAAEC,SAAS,CAAC;IAC/C,CAAC,CAAC;IACF,IAAI,CAAC,CAACP,OAAO,GAAGM,UAAU;IAC1B,IAAI,CAAC,CAACJ,MAAM,GAAGK,SAAS;EAC1B;EAEA,IAAIP,OAAO,GAAG;IAAE,OAAO,IAAI,CAAC,CAACA,OAAO;EAAE;EAEtC,IAAIC,QAAQ,GAAG;IAAE,OAAO,IAAI,CAAC,CAACA,QAAQ;EAAE;EAExC,IAAIC,MAAM,GAAG;IAAE,OAAO,IAAI,CAAC,CAACA,MAAM;EAAE;EAEpC,IAAIC,QAAQ,GAAG;IAAE,OAAO,IAAI,CAAC,CAACA,QAAQ;EAAE;EAExCO,IAAI,CAACC,WAAW,EAAEC,UAAU,EAAE;IAC5B,MAAMC,GAAG,GAAG,KAAK,CAACH,IAAI,CAACC,WAAW,EAAEC,UAAU,CAAC;IAC/CC,GAAG,CAAC,CAACb,OAAO,GAAG,IAAI,CAAC,CAACA,OAAO;IAC5Ba,GAAG,CAAC,CAACX,MAAM,GAAG,IAAI,CAAC,CAACA,MAAM;IAC1B,OAAOW,GAAG;EACZ;AACF;;AAEA;AACA;AACA;AACA;AAHA;AAIO,SAASC,UAAU,CAACT,QAAQ,EAAE;EACnC,OAAO,IAAIP,OAAO,CAACO,QAAQ,CAAC;AAC9B"}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Simple listeneable data Emitter.
|
|
10
9
|
*/
|
|
@@ -15,56 +14,48 @@ class Emitter {
|
|
|
15
14
|
constructor() {
|
|
16
15
|
this.listeners = [];
|
|
17
16
|
}
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* Returns "true" if any listener is connected; "false" otherwise.
|
|
20
20
|
* @return {boolean}
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
22
|
get hasListeners() {
|
|
25
23
|
return !!this.listeners.length;
|
|
26
24
|
}
|
|
25
|
+
|
|
27
26
|
/**
|
|
28
27
|
* Adds `listener` if it is not already connected.
|
|
29
28
|
* @param {function} listener
|
|
30
29
|
* @return {function} Unsubscribe function.
|
|
31
30
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
31
|
addListener(listener) {
|
|
35
32
|
if (!this.listeners.includes(listener)) {
|
|
36
33
|
this.listeners.push(listener);
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
return () => this.removeListener(listener);
|
|
40
36
|
}
|
|
37
|
+
|
|
41
38
|
/**
|
|
42
39
|
* Calls every connected listener with the given arguments.
|
|
43
40
|
* @param {...any} args
|
|
44
41
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
42
|
emit(...args) {
|
|
48
43
|
const {
|
|
49
44
|
listeners
|
|
50
45
|
} = this;
|
|
51
|
-
|
|
52
46
|
for (let i = 0; i < listeners.length; ++i) {
|
|
53
47
|
listeners[i](...args);
|
|
54
48
|
}
|
|
55
49
|
}
|
|
50
|
+
|
|
56
51
|
/**
|
|
57
52
|
* Removes specified `listener`, if connected.
|
|
58
53
|
* @param {function} listener
|
|
59
54
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
55
|
removeListener(listener) {
|
|
63
56
|
const idx = this.listeners.indexOf(listener);
|
|
64
57
|
if (idx >= 0) this.listeners.splice(idx, 1);
|
|
65
58
|
}
|
|
66
|
-
|
|
67
59
|
}
|
|
68
|
-
|
|
69
60
|
exports.default = Emitter;
|
|
70
61
|
//# sourceMappingURL=Emitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emitter.js","names":["Emitter","constructor","listeners","hasListeners","length","addListener","listener","includes","push","removeListener","emit","args","i","idx","indexOf","splice"],"sources":["../../../../src/shared/utils/Emitter.js"],"sourcesContent":["/**\n * Simple listeneable data Emitter.\n */\nexport default class Emitter {\n /**\n * Creates a new Emitter.\n */\n constructor() {\n this.listeners = [];\n }\n\n /**\n * Returns \"true\" if any listener is connected; \"false\" otherwise.\n * @return {boolean}\n */\n get hasListeners() {\n return !!this.listeners.length;\n }\n\n /**\n * Adds `listener` if it is not already connected.\n * @param {function} listener\n * @return {function} Unsubscribe function.\n */\n addListener(listener) {\n if (!this.listeners.includes(listener)) {\n this.listeners.push(listener);\n }\n return () => this.removeListener(listener);\n }\n\n /**\n * Calls every connected listener with the given arguments.\n * @param {...any} args\n */\n emit(...args) {\n const { listeners } = this;\n for (let i = 0; i < listeners.length; ++i) {\n listeners[i](...args);\n }\n }\n\n /**\n * Removes specified `listener`, if connected.\n * @param {function} listener\n */\n removeListener(listener) {\n const idx = this.listeners.indexOf(listener);\n if (idx >= 0) this.listeners.splice(idx, 1);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Emitter.js","names":["Emitter","constructor","listeners","hasListeners","length","addListener","listener","includes","push","removeListener","emit","args","i","idx","indexOf","splice"],"sources":["../../../../src/shared/utils/Emitter.js"],"sourcesContent":["/**\n * Simple listeneable data Emitter.\n */\nexport default class Emitter {\n /**\n * Creates a new Emitter.\n */\n constructor() {\n this.listeners = [];\n }\n\n /**\n * Returns \"true\" if any listener is connected; \"false\" otherwise.\n * @return {boolean}\n */\n get hasListeners() {\n return !!this.listeners.length;\n }\n\n /**\n * Adds `listener` if it is not already connected.\n * @param {function} listener\n * @return {function} Unsubscribe function.\n */\n addListener(listener) {\n if (!this.listeners.includes(listener)) {\n this.listeners.push(listener);\n }\n return () => this.removeListener(listener);\n }\n\n /**\n * Calls every connected listener with the given arguments.\n * @param {...any} args\n */\n emit(...args) {\n const { listeners } = this;\n for (let i = 0; i < listeners.length; ++i) {\n listeners[i](...args);\n }\n }\n\n /**\n * Removes specified `listener`, if connected.\n * @param {function} listener\n */\n removeListener(listener) {\n const idx = this.listeners.indexOf(listener);\n if (idx >= 0) this.listeners.splice(idx, 1);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACe,MAAMA,OAAO,CAAC;EAC3B;AACF;AACA;EACEC,WAAW,GAAG;IACZ,IAAI,CAACC,SAAS,GAAG,EAAE;EACrB;;EAEA;AACF;AACA;AACA;EACE,IAAIC,YAAY,GAAG;IACjB,OAAO,CAAC,CAAC,IAAI,CAACD,SAAS,CAACE,MAAM;EAChC;;EAEA;AACF;AACA;AACA;AACA;EACEC,WAAW,CAACC,QAAQ,EAAE;IACpB,IAAI,CAAC,IAAI,CAACJ,SAAS,CAACK,QAAQ,CAACD,QAAQ,CAAC,EAAE;MACtC,IAAI,CAACJ,SAAS,CAACM,IAAI,CAACF,QAAQ,CAAC;IAC/B;IACA,OAAO,MAAM,IAAI,CAACG,cAAc,CAACH,QAAQ,CAAC;EAC5C;;EAEA;AACF;AACA;AACA;EACEI,IAAI,CAAC,GAAGC,IAAI,EAAE;IACZ,MAAM;MAAET;IAAU,CAAC,GAAG,IAAI;IAC1B,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,SAAS,CAACE,MAAM,EAAE,EAAEQ,CAAC,EAAE;MACzCV,SAAS,CAACU,CAAC,CAAC,CAAC,GAAGD,IAAI,CAAC;IACvB;EACF;;EAEA;AACF;AACA;AACA;EACEF,cAAc,CAACH,QAAQ,EAAE;IACvB,MAAMO,GAAG,GAAG,IAAI,CAACX,SAAS,CAACY,OAAO,CAACR,QAAQ,CAAC;IAC5C,IAAIO,GAAG,IAAI,CAAC,EAAE,IAAI,CAACX,SAAS,CAACa,MAAM,CAACF,GAAG,EAAE,CAAC,CAAC;EAC7C;AACF;AAAC"}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _Barrier = require("./Barrier");
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* Implements a simple semaphore for async code logic.
|
|
12
10
|
*/
|
|
@@ -14,30 +12,25 @@ class Semaphore {
|
|
|
14
12
|
constructor(ready) {
|
|
15
13
|
this.#ready = !!ready;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
get ready() {
|
|
19
16
|
return this.#ready;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
setReady(ready) {
|
|
23
19
|
const bool = !!ready;
|
|
24
|
-
|
|
25
20
|
if (this.#ready !== bool) {
|
|
26
21
|
this.#ready = bool;
|
|
27
22
|
if (bool && !this.#draining) this.#drainQueue();
|
|
28
23
|
}
|
|
29
24
|
}
|
|
25
|
+
|
|
30
26
|
/**
|
|
31
27
|
* Waits until the semaphore is ready, and marks it as non-ready (seizes it).
|
|
32
28
|
* @return {Promise}
|
|
33
29
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
30
|
async seize() {
|
|
37
31
|
await this.waitReady();
|
|
38
32
|
this.setReady(false);
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
async waitReady() {
|
|
42
35
|
if (!this.#ready || this.#queue.length) {
|
|
43
36
|
const barrier = (0, _Barrier.newBarrier)();
|
|
@@ -45,7 +38,9 @@ class Semaphore {
|
|
|
45
38
|
await barrier;
|
|
46
39
|
this.#queue.shift();
|
|
47
40
|
}
|
|
48
|
-
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Private members below this point.
|
|
49
44
|
|
|
50
45
|
/**
|
|
51
46
|
* If semaphore is ready, it releases the next barrier in the queue, if any,
|
|
@@ -53,31 +48,30 @@ class Semaphore {
|
|
|
53
48
|
* Otherwise, it breaks the queue draining loop, which will be restarted
|
|
54
49
|
* the next time the semaphore is set ready.
|
|
55
50
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
51
|
#drainQueue() {
|
|
59
52
|
if (this.#ready && this.#queue.length) {
|
|
60
|
-
this.#queue[0].resolve();
|
|
53
|
+
this.#queue[0].resolve();
|
|
61
54
|
|
|
55
|
+
// Re-schedules itself for the next event loop iteration.
|
|
62
56
|
if (this.#queue.length) {
|
|
63
57
|
setTimeout(this.#drainQueue.bind(this));
|
|
64
58
|
this.#draining = true;
|
|
65
59
|
return; // Exit here to avoid the drain loop termination below.
|
|
66
60
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
61
|
+
}
|
|
69
62
|
|
|
63
|
+
// Cleans up for the drain loop termination.
|
|
70
64
|
this.#draining = false;
|
|
71
|
-
}
|
|
72
|
-
// a new one).
|
|
65
|
+
}
|
|
73
66
|
|
|
67
|
+
// "true" when the drain queue process is running (and thus no need to start
|
|
68
|
+
// a new one).
|
|
69
|
+
#draining = false;
|
|
74
70
|
|
|
75
|
-
|
|
71
|
+
// The array of barriers set for each async code flow awaiting for
|
|
76
72
|
// the Semaphore to become ready.
|
|
77
|
-
|
|
78
73
|
#queue = [];
|
|
79
74
|
#ready;
|
|
80
75
|
}
|
|
81
|
-
|
|
82
76
|
exports.default = Semaphore;
|
|
83
77
|
//# sourceMappingURL=Semaphore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Semaphore.js","names":["Semaphore","constructor","ready","setReady","bool","draining","drainQueue","seize","waitReady","queue","length","barrier","newBarrier","push","shift","resolve","setTimeout","bind"],"sources":["../../../../src/shared/utils/Semaphore.js"],"sourcesContent":["import { newBarrier } from './Barrier';\n\n/**\n * Implements a simple semaphore for async code logic.\n */\nexport default class Semaphore {\n constructor(ready) {\n this.#ready = !!ready;\n }\n\n get ready() { return this.#ready; }\n\n setReady(ready) {\n const bool = !!ready;\n if (this.#ready !== bool) {\n this.#ready = bool;\n if (bool && !this.#draining) this.#drainQueue();\n }\n }\n\n /**\n * Waits until the semaphore is ready, and marks it as non-ready (seizes it).\n * @return {Promise}\n */\n async seize() {\n await this.waitReady();\n this.setReady(false);\n }\n\n async waitReady() {\n if (!this.#ready || this.#queue.length) {\n const barrier = newBarrier();\n this.#queue.push(barrier);\n await barrier;\n this.#queue.shift();\n }\n }\n\n // Private members below this point.\n\n /**\n * If semaphore is ready, it releases the next barrier in the queue, if any,\n * and reschedules itself for a call in the next event loop iteration.\n * Otherwise, it breaks the queue draining loop, which will be restarted\n * the next time the semaphore is set ready.\n */\n #drainQueue() {\n if (this.#ready && this.#queue.length) {\n this.#queue[0].resolve();\n\n // Re-schedules itself for the next event loop iteration.\n if (this.#queue.length) {\n setTimeout(this.#drainQueue.bind(this));\n this.#draining = true;\n return; // Exit here to avoid the drain loop termination below.\n }\n }\n\n // Cleans up for the drain loop termination.\n this.#draining = false;\n }\n\n // \"true\" when the drain queue process is running (and thus no need to start\n // a new one).\n #draining = false;\n\n // The array of barriers set for each async code flow awaiting for\n // the Semaphore to become ready.\n #queue = [];\n\n #ready;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Semaphore.js","names":["Semaphore","constructor","ready","setReady","bool","draining","drainQueue","seize","waitReady","queue","length","barrier","newBarrier","push","shift","resolve","setTimeout","bind"],"sources":["../../../../src/shared/utils/Semaphore.js"],"sourcesContent":["import { newBarrier } from './Barrier';\n\n/**\n * Implements a simple semaphore for async code logic.\n */\nexport default class Semaphore {\n constructor(ready) {\n this.#ready = !!ready;\n }\n\n get ready() { return this.#ready; }\n\n setReady(ready) {\n const bool = !!ready;\n if (this.#ready !== bool) {\n this.#ready = bool;\n if (bool && !this.#draining) this.#drainQueue();\n }\n }\n\n /**\n * Waits until the semaphore is ready, and marks it as non-ready (seizes it).\n * @return {Promise}\n */\n async seize() {\n await this.waitReady();\n this.setReady(false);\n }\n\n async waitReady() {\n if (!this.#ready || this.#queue.length) {\n const barrier = newBarrier();\n this.#queue.push(barrier);\n await barrier;\n this.#queue.shift();\n }\n }\n\n // Private members below this point.\n\n /**\n * If semaphore is ready, it releases the next barrier in the queue, if any,\n * and reschedules itself for a call in the next event loop iteration.\n * Otherwise, it breaks the queue draining loop, which will be restarted\n * the next time the semaphore is set ready.\n */\n #drainQueue() {\n if (this.#ready && this.#queue.length) {\n this.#queue[0].resolve();\n\n // Re-schedules itself for the next event loop iteration.\n if (this.#queue.length) {\n setTimeout(this.#drainQueue.bind(this));\n this.#draining = true;\n return; // Exit here to avoid the drain loop termination below.\n }\n }\n\n // Cleans up for the drain loop termination.\n this.#draining = false;\n }\n\n // \"true\" when the drain queue process is running (and thus no need to start\n // a new one).\n #draining = false;\n\n // The array of barriers set for each async code flow awaiting for\n // the Semaphore to become ready.\n #queue = [];\n\n #ready;\n}\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACe,MAAMA,SAAS,CAAC;EAC7BC,WAAW,CAACC,KAAK,EAAE;IACjB,IAAI,CAAC,CAACA,KAAK,GAAG,CAAC,CAACA,KAAK;EACvB;EAEA,IAAIA,KAAK,GAAG;IAAE,OAAO,IAAI,CAAC,CAACA,KAAK;EAAE;EAElCC,QAAQ,CAACD,KAAK,EAAE;IACd,MAAME,IAAI,GAAG,CAAC,CAACF,KAAK;IACpB,IAAI,IAAI,CAAC,CAACA,KAAK,KAAKE,IAAI,EAAE;MACxB,IAAI,CAAC,CAACF,KAAK,GAAGE,IAAI;MAClB,IAAIA,IAAI,IAAI,CAAC,IAAI,CAAC,CAACC,QAAQ,EAAE,IAAI,CAAC,CAACC,UAAU,EAAE;IACjD;EACF;;EAEA;AACF;AACA;AACA;EACE,MAAMC,KAAK,GAAG;IACZ,MAAM,IAAI,CAACC,SAAS,EAAE;IACtB,IAAI,CAACL,QAAQ,CAAC,KAAK,CAAC;EACtB;EAEA,MAAMK,SAAS,GAAG;IAChB,IAAI,CAAC,IAAI,CAAC,CAACN,KAAK,IAAI,IAAI,CAAC,CAACO,KAAK,CAACC,MAAM,EAAE;MACtC,MAAMC,OAAO,GAAG,IAAAC,mBAAU,GAAE;MAC5B,IAAI,CAAC,CAACH,KAAK,CAACI,IAAI,CAACF,OAAO,CAAC;MACzB,MAAMA,OAAO;MACb,IAAI,CAAC,CAACF,KAAK,CAACK,KAAK,EAAE;IACrB;EACF;;EAEA;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,CAACR,UAAU,GAAG;IACZ,IAAI,IAAI,CAAC,CAACJ,KAAK,IAAI,IAAI,CAAC,CAACO,KAAK,CAACC,MAAM,EAAE;MACrC,IAAI,CAAC,CAACD,KAAK,CAAC,CAAC,CAAC,CAACM,OAAO,EAAE;;MAExB;MACA,IAAI,IAAI,CAAC,CAACN,KAAK,CAACC,MAAM,EAAE;QACtBM,UAAU,CAAC,IAAI,CAAC,CAACV,UAAU,CAACW,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,CAACZ,QAAQ,GAAG,IAAI;QACrB,OAAO,CAAC;MACV;IACF;;IAEA;IACA,IAAI,CAAC,CAACA,QAAQ,GAAG,KAAK;EACxB;;EAEA;EACA;EACA,CAACA,QAAQ,GAAG,KAAK;;EAEjB;EACA;EACA,CAACI,KAAK,GAAG,EAAE;EAEX,CAACP,KAAK;AACR;AAAC"}
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _webpack = require("./webpack");
|
|
9
|
-
|
|
10
8
|
/* global window */
|
|
11
|
-
|
|
12
9
|
/* eslint-disable global-require */
|
|
13
10
|
var _default = (0, _webpack.requireWeak)('config') || window.CONFIG || {};
|
|
14
11
|
/* eslint-enable global-require */
|
|
15
|
-
|
|
16
|
-
|
|
17
12
|
exports.default = _default;
|
|
18
13
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["requireWeak","window","CONFIG"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global window */\n\nimport { requireWeak } from './webpack';\n\n/* eslint-disable global-require */\nexport default requireWeak('config') || window.CONFIG || {};\n/* eslint-enable global-require */\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","names":["requireWeak","window","CONFIG"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global window */\n\nimport { requireWeak } from './webpack';\n\n/* eslint-disable global-require */\nexport default requireWeak('config') || window.CONFIG || {};\n/* eslint-enable global-require */\n"],"mappings":";;;;;;AAEA;AAFA;AAIA;AAAA,eACe,IAAAA,oBAAW,EAAC,QAAQ,CAAC,IAAIC,MAAM,CAACC,MAAM,IAAI,CAAC,CAAC;AAC3D;AAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -64,23 +63,14 @@ Object.defineProperty(exports, "time", {
|
|
|
64
63
|
});
|
|
65
64
|
exports.webpack = void 0;
|
|
66
65
|
exports.withRetries = withRetries;
|
|
67
|
-
|
|
68
66
|
var _reactThemes = _interopRequireWildcard(require("@dr.pogodin/react-themes"));
|
|
69
|
-
|
|
70
67
|
var _config = _interopRequireDefault(require("./config"));
|
|
71
|
-
|
|
72
68
|
var isomorphy = _interopRequireWildcard(require("./isomorphy"));
|
|
73
|
-
|
|
74
69
|
exports.isomorphy = isomorphy;
|
|
75
|
-
|
|
76
70
|
var _time = _interopRequireWildcard(require("./time"));
|
|
77
|
-
|
|
78
71
|
var webpack = _interopRequireWildcard(require("./webpack"));
|
|
79
|
-
|
|
80
72
|
exports.webpack = webpack;
|
|
81
|
-
|
|
82
73
|
var _Barrier = require("./Barrier");
|
|
83
|
-
|
|
84
74
|
Object.keys(_Barrier).forEach(function (key) {
|
|
85
75
|
if (key === "default" || key === "__esModule") return;
|
|
86
76
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -92,32 +82,24 @@ Object.keys(_Barrier).forEach(function (key) {
|
|
|
92
82
|
}
|
|
93
83
|
});
|
|
94
84
|
});
|
|
95
|
-
|
|
96
85
|
var _Emitter = _interopRequireDefault(require("./Emitter"));
|
|
97
|
-
|
|
98
86
|
var _Semaphore = _interopRequireDefault(require("./Semaphore"));
|
|
99
|
-
|
|
100
87
|
var _splitComponent = _interopRequireDefault(require("./splitComponent"));
|
|
101
|
-
|
|
102
88
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
103
|
-
|
|
104
89
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
105
|
-
|
|
106
90
|
_reactThemes.default.COMPOSE = _reactThemes.COMPOSE;
|
|
107
|
-
_reactThemes.default.PRIORITY = _reactThemes.PRIORITY;
|
|
91
|
+
_reactThemes.default.PRIORITY = _reactThemes.PRIORITY;
|
|
92
|
+
|
|
93
|
+
// Note: it should be done this way, as in some environments
|
|
108
94
|
// "process" might not exist, and process.env.NODE_CONFIG_ENV
|
|
109
95
|
// not injected by Webpack.
|
|
110
|
-
|
|
111
96
|
let NODE_CONFIG_ENV;
|
|
112
|
-
|
|
113
97
|
try {
|
|
114
98
|
NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;
|
|
115
|
-
} catch {
|
|
116
|
-
/* noop */
|
|
117
|
-
}
|
|
118
|
-
|
|
99
|
+
} catch {/* noop */}
|
|
119
100
|
const env = NODE_CONFIG_ENV || process.env.NODE_ENV;
|
|
120
101
|
const JU = env !== 'production' && webpack.requireWeak("./jest", __dirname);
|
|
102
|
+
|
|
121
103
|
/**
|
|
122
104
|
* @category Utilities
|
|
123
105
|
* @global
|
|
@@ -153,9 +135,7 @@ const JU = env !== 'production' && webpack.requireWeak("./jest", __dirname);
|
|
|
153
135
|
* // It will print 'success' after one second, once the second attempt
|
|
154
136
|
* // is performed.
|
|
155
137
|
*/
|
|
156
|
-
|
|
157
138
|
exports.JU = JU;
|
|
158
|
-
|
|
159
139
|
async function withRetries(action, maxRetries = 5, interval = 1000) {
|
|
160
140
|
/* eslint-disable no-await-in-loop */
|
|
161
141
|
for (let n = 1;; ++n) {
|
|
@@ -166,6 +146,5 @@ async function withRetries(action, maxRetries = 5, interval = 1000) {
|
|
|
166
146
|
}
|
|
167
147
|
}
|
|
168
148
|
/* eslint-enable no-await-in-loop */
|
|
169
|
-
|
|
170
149
|
}
|
|
171
150
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","webpack","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","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, { timer } from './time';\nimport * as webpack from './webpack';\n\nexport * from './Barrier';\nexport { default as Emitter } from './Emitter';\nexport { default as Semaphore } from './Semaphore';\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 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":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","webpack","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","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, { timer } from './time';\nimport * as webpack from './webpack';\n\nexport * from './Barrier';\nexport { default as Emitter } from './Emitter';\nexport { default as Semaphore } from './Semaphore';\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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAMA;AACA;AAAyC;AACzC;AACA;AAAqC;AAErC;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AACA;AACA;AAA6D;AAAA;AAE7DA,oBAAM,CAACC,OAAO,GAAGA,oBAAO;AACxBD,oBAAM,CAACE,QAAQ,GAAGA,qBAAQ;;AAE1B;AACA;AACA;AACA,IAAIC,eAAe;AACnB,IAAI;EACFA,eAAe,GAAGC,OAAO,CAACC,GAAG,CAACF,eAAe;AAC/C,CAAC,CAAC,MAAM,CAAE,UAAW;AAErB,MAAME,GAAG,GAAGF,eAAe,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ;AACnD,MAAMC,EAAE,GAAGF,GAAG,KAAK,YAAY,IAAIG,OAAO,CAACC,WAAW,WAAWC,SAAS,CAAC;;AAE3E;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;AAlCA;AAmCO,eAAeC,WAAW,CAACC,MAAM,EAAEC,UAAU,GAAG,CAAC,EAAEC,QAAQ,GAAG,IAAI,EAAE;EACzE;EACA,KAAK,IAAIC,CAAC,GAAG,CAAC,GAAI,EAAEA,CAAC,EAAE;IACrB,IAAI;MACF,OAAO,MAAMH,MAAM,EAAE;IACvB,CAAC,CAAC,OAAOI,KAAK,EAAE;MACd,IAAID,CAAC,GAAGF,UAAU,EAAE,MAAM,IAAAI,WAAK,EAACH,QAAQ,CAAC,CAAC,KACrC,MAAME,KAAK;IAClB;EACF;EACA;AACF"}
|
|
@@ -8,64 +8,58 @@ exports.buildTimestamp = buildTimestamp;
|
|
|
8
8
|
exports.getBuildInfo = getBuildInfo;
|
|
9
9
|
exports.isDevBuild = isDevBuild;
|
|
10
10
|
exports.isProdBuild = isProdBuild;
|
|
11
|
-
|
|
12
11
|
/* global window */
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* `true` within client-side environment (browser), `false` at server-side.
|
|
16
15
|
*/
|
|
17
16
|
const IS_CLIENT_SIDE = typeof process !== 'object' || !process.versions || !process.versions.node || !!global.REACT_UTILS_FORCE_CLIENT_SIDE;
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* `true` within the server-side environment (node), `false` at client-side.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
21
|
exports.IS_CLIENT_SIDE = IS_CLIENT_SIDE;
|
|
23
22
|
const IS_SERVER_SIDE = !IS_CLIENT_SIDE;
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* @ignore
|
|
26
26
|
* @return {string} Code mode: "development" or "production".
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
28
|
exports.IS_SERVER_SIDE = IS_SERVER_SIDE;
|
|
30
|
-
|
|
31
29
|
function getMode() {
|
|
32
30
|
return process.env.NODE_ENV;
|
|
33
31
|
}
|
|
32
|
+
|
|
34
33
|
/**
|
|
35
34
|
* Returns `true` if development version of the code is running;
|
|
36
35
|
* `false` otherwise.
|
|
37
36
|
* @return {boolean}
|
|
38
37
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
38
|
function isDevBuild() {
|
|
42
39
|
return getMode() === 'development';
|
|
43
40
|
}
|
|
41
|
+
|
|
44
42
|
/**
|
|
45
43
|
* Returns `true` if production build of the code is running;
|
|
46
44
|
* `false` otherwise.
|
|
47
45
|
* @return {boolean}
|
|
48
46
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
47
|
function isProdBuild() {
|
|
52
48
|
return getMode() === 'production';
|
|
53
49
|
}
|
|
50
|
+
|
|
54
51
|
/**
|
|
55
52
|
* Returns build info object.
|
|
56
53
|
* @returns {object}
|
|
57
54
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
55
|
function getBuildInfo() {
|
|
61
56
|
return (IS_CLIENT_SIDE ? window : global).TRU_BUILD_INFO;
|
|
62
57
|
}
|
|
58
|
+
|
|
63
59
|
/**
|
|
64
60
|
* Returns build timestamp of the front-end JS bundle.
|
|
65
61
|
* @return {string} ISO date/time string.
|
|
66
62
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
63
|
function buildTimestamp() {
|
|
70
64
|
return getBuildInfo().timestamp;
|
|
71
65
|
}
|