@dr.pogodin/react-utils 1.35.3 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/bin/build.js +7 -6
- package/build/development/client/getInj.js +3 -10
- package/build/development/client/getInj.js.map +1 -1
- package/build/development/client/index.js +2 -9
- package/build/development/client/index.js.map +1 -1
- package/build/development/index.js +1 -15
- package/build/development/index.js.map +1 -1
- package/build/development/server/Cache.js +19 -19
- package/build/development/server/Cache.js.map +1 -1
- package/build/development/server/renderer.js +7 -4
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +4 -1
- package/build/development/server/server.js.map +1 -1
- package/build/development/shared/components/Button/index.js +1 -16
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +1 -29
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +0 -15
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +1 -8
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/MetaTags.js +0 -12
- package/build/development/shared/components/MetaTags.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +2 -13
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +1 -10
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +1 -12
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +1 -6
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +1 -8
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +1 -9
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +2 -11
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +1 -16
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +2 -12
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +2 -12
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +21 -28
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js +0 -19
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/components/selectors/index.js +0 -13
- package/build/development/shared/components/selectors/index.js.map +1 -1
- package/build/development/shared/utils/globalState.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +4 -2
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +21 -28
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/web.bundle.js +28 -38
- package/build/production/client/getInj.js +3 -7
- package/build/production/client/getInj.js.map +1 -1
- package/build/production/client/index.js +1 -1
- package/build/production/client/index.js.map +1 -1
- package/build/production/index.js +1 -4
- package/build/production/index.js.map +1 -1
- package/build/production/server/Cache.js +3 -3
- package/build/production/server/Cache.js.map +1 -1
- package/build/production/server/renderer.js +2 -2
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +1 -1
- package/build/production/server/server.js.map +1 -1
- package/build/production/shared/components/Button/index.js +3 -3
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +1 -16
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js +2 -2
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +2 -2
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/MetaTags.js +2 -2
- package/build/production/shared/components/MetaTags.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +2 -2
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js +2 -2
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/TextArea/index.js +2 -2
- package/build/production/shared/components/TextArea/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js +2 -2
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js +3 -3
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +2 -2
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +3 -3
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +3 -3
- package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/Switch/index.js +1 -1
- package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/production/shared/components/selectors/common.js +2 -4
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/components/selectors/index.js +1 -1
- package/build/production/shared/components/selectors/index.js.map +1 -1
- package/build/production/shared/utils/globalState.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +1 -1
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js +10 -12
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/client/getInj.d.ts +0 -6
- package/build/types-code/client/index.d.ts +1 -2
- package/build/types-code/index.d.ts +2 -3
- package/build/types-code/server/Cache.d.ts +3 -11
- package/build/types-code/server/index.d.ts +0 -2
- package/build/types-code/server/renderer.d.ts +0 -1
- package/build/types-code/server/server.d.ts +0 -1
- package/build/types-code/shared/components/Button/index.d.ts +3 -4
- package/build/types-code/shared/components/Checkbox/index.d.ts +3 -12
- package/build/types-code/shared/components/Input/index.d.ts +4 -5
- package/build/types-code/shared/components/Link.d.ts +0 -1
- package/build/types-code/shared/components/Modal/index.d.ts +3 -4
- package/build/types-code/shared/components/NavLink.d.ts +0 -1
- package/build/types-code/shared/components/PageLayout/index.d.ts +4 -4
- package/build/types-code/shared/components/TextArea/index.d.ts +4 -5
- package/build/types-code/shared/components/Throbber/index.d.ts +4 -4
- package/build/types-code/shared/components/WithTooltip/Tooltip.d.ts +1 -1
- package/build/types-code/shared/components/WithTooltip/index.d.ts +2 -3
- package/build/types-code/shared/components/YouTubeVideo/index.d.ts +3 -4
- package/build/types-code/shared/components/selectors/CustomDropdown/Options/index.d.ts +1 -2
- package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +2 -3
- package/build/types-code/shared/components/selectors/NativeDropdown/index.d.ts +2 -2
- package/build/types-code/shared/components/selectors/Switch/index.d.ts +4 -5
- package/build/types-code/shared/components/selectors/common.d.ts +5 -11
- package/build/types-code/shared/components/selectors/index.d.ts +1 -1
- package/build/types-code/shared/utils/globalState.d.ts +6 -2
- package/build/types-code/shared/utils/jest/index.d.ts +4 -1
- package/build/types-code/shared/utils/splitComponent.d.ts +0 -1
- package/build/types-code/shared/utils/webpack.d.ts +0 -1
- package/config/babel/node-ssr.js +1 -1
- package/config/babel/webpack.js +1 -1
- package/config/eslint/default.json +1 -0
- package/config/eslint/jest.json +1 -0
- package/config/eslint/typescript.js +7 -0
- package/config/typescript/base.json +9 -0
- package/config/webpack/app-base.d.ts +0 -1
- package/config/webpack/app-base.js +1 -1
- package/config/webpack/app-development.js +1 -1
- package/config/webpack/app-production.js +1 -1
- package/config/webpack/lib-base.js +1 -2
- package/config/webpack/lib-development.js +1 -1
- package/config/webpack/lib-production.js +1 -1
- package/package.json +28 -27
- package/src/client/getInj.ts +3 -9
- package/src/client/index.tsx +1 -3
- package/src/index.ts +1 -10
- package/src/server/Cache.ts +31 -30
- package/src/server/renderer.tsx +8 -5
- package/src/server/server.ts +6 -1
- package/src/shared/components/Button/index.tsx +2 -20
- package/src/shared/components/Checkbox/index.tsx +2 -37
- package/src/shared/components/GenericLink/index.tsx +0 -15
- package/src/shared/components/Input/index.tsx +6 -15
- package/src/shared/components/MetaTags.tsx +0 -12
- package/src/shared/components/Modal/index.tsx +3 -22
- package/src/shared/components/PageLayout/index.tsx +8 -24
- package/src/shared/components/TextArea/index.tsx +6 -24
- package/src/shared/components/Throbber/index.tsx +6 -18
- package/src/shared/components/WithTooltip/Tooltip.tsx +6 -14
- package/src/shared/components/WithTooltip/index.tsx +3 -24
- package/src/shared/components/YouTubeVideo/index.tsx +3 -20
- package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +2 -20
- package/src/shared/components/selectors/CustomDropdown/index.tsx +3 -27
- package/src/shared/components/selectors/NativeDropdown/index.tsx +3 -27
- package/src/shared/components/selectors/Switch/index.tsx +34 -50
- package/src/shared/components/selectors/common.ts +13 -45
- package/src/shared/components/selectors/index.ts +0 -2
- package/src/shared/utils/globalState.ts +6 -0
- package/src/shared/utils/jest/index.tsx +13 -2
- package/src/shared/utils/splitComponent.tsx +24 -29
- package/tsconfig.configs.json +7 -3
- package/tsconfig.json +3 -10
- package/tsconfig.types.json +1 -7
- package/tstyche.config.json +6 -0
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
8
|
var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
|
|
10
9
|
var _common = require("../common");
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -18,7 +17,6 @@ const defaultTheme = {
|
|
|
18
17
|
"selected": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___selected___Wco-qk",
|
|
19
18
|
"options": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___options___CZYtcC"
|
|
20
19
|
};
|
|
21
|
-
const validThemeKeys = ['container', 'label', 'option', 'options', 'selected'];
|
|
22
20
|
const BaseSwitch = ({
|
|
23
21
|
label,
|
|
24
22
|
onChange,
|
|
@@ -29,23 +27,26 @@ const BaseSwitch = ({
|
|
|
29
27
|
if (!options || !theme.option) throw Error('Internal error');
|
|
30
28
|
const optionNodes = [];
|
|
31
29
|
for (let i = 0; i < options?.length; ++i) {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
const option = options[i];
|
|
31
|
+
if (option !== undefined) {
|
|
32
|
+
const [iValue, iName] = (0, _common.optionValueName)(option);
|
|
33
|
+
let className = theme.option;
|
|
34
|
+
let onPress;
|
|
35
|
+
if (iValue === value) className += ` ${theme.selected}`;else if (onChange) onPress = () => onChange(iValue);
|
|
36
|
+
optionNodes.push(onPress ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
37
|
+
className: className,
|
|
38
|
+
onClick: onPress,
|
|
39
|
+
onKeyDown: e => {
|
|
40
|
+
if (onPress && e.key === 'Enter') onPress();
|
|
41
|
+
},
|
|
42
|
+
role: "button",
|
|
43
|
+
tabIndex: 0,
|
|
44
|
+
children: iName
|
|
45
|
+
}, iValue) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
46
|
+
className: className,
|
|
47
|
+
children: iName
|
|
48
|
+
}, iValue));
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
51
52
|
className: theme.container,
|
|
@@ -58,13 +59,5 @@ const BaseSwitch = ({
|
|
|
58
59
|
})]
|
|
59
60
|
});
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
-
BaseSwitch.propTypes = {
|
|
63
|
-
label: _propTypes.default.node,
|
|
64
|
-
onChange: _propTypes.default.func,
|
|
65
|
-
options: _common.optionsValidator,
|
|
66
|
-
theme: ThemedSwitch.themeType.isRequired,
|
|
67
|
-
value: _common.valueValidator
|
|
68
|
-
};
|
|
69
|
-
var _default = exports.default = ThemedSwitch;
|
|
62
|
+
var _default = exports.default = (0, _reactThemes.default)(BaseSwitch, 'Switch', defaultTheme);
|
|
70
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["_reactThemes","_interopRequireDefault","require","_common","_jsxRuntime","defaultTheme","BaseSwitch","label","onChange","options","theme","value","option","Error","optionNodes","i","length","undefined","iValue","iName","optionValueName","className","onPress","selected","push","jsx","onClick","onKeyDown","e","key","role","tabIndex","children","jsxs","container","_default","exports","default","themed"],"sources":["../../../../../../src/shared/components/selectors/Switch/index.tsx"],"sourcesContent":["import themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport {\n type OptionsT,\n type ValueT,\n optionValueName,\n} from '../common';\n\nimport defaultTheme from './theme.scss';\n\ntype ThemeKeyT =\n | 'container'\n | 'label'\n | 'option'\n | 'options'\n | 'selected';\n\ntype PropsT = {\n label?: React.ReactNode;\n onChange?: (value: ValueT) => void;\n options?: Readonly<OptionsT<React.ReactNode>>;\n theme: Theme<ThemeKeyT>;\n value?: ValueT;\n};\n\nconst BaseSwitch: React.FunctionComponent<PropsT> = ({\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options || !theme.option) throw Error('Internal error');\n\n const optionNodes: React.ReactNode[] = [];\n for (let i = 0; i < options?.length; ++i) {\n const option = options[i];\n if (option !== undefined) {\n const [iValue, iName] = optionValueName(option);\n\n let className: string = theme.option;\n let onPress: (() => void) | undefined;\n if (iValue === value) className += ` ${theme.selected}`;\n else if (onChange) onPress = () => onChange(iValue);\n\n optionNodes.push(\n onPress ? (\n <div\n className={className}\n onClick={onPress}\n onKeyDown={(e) => {\n if (onPress && e.key === 'Enter') onPress();\n }}\n key={iValue}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>\n ) : (\n <div className={className} key={iValue}>{iName}</div>\n ),\n );\n }\n }\n\n return (\n <div className={theme.container}>\n {label ? <div className={theme.label}>{label}</div> : null}\n <div className={theme.options}>\n {optionNodes}\n </div>\n </div>\n );\n};\n\nexport default themed(BaseSwitch, 'Switch', defaultTheme);\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAImB,IAAAE,WAAA,GAAAF,OAAA;AAAA,MAAAG,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAmBnB,MAAMC,UAA2C,GAAGA,CAAC;EACnDC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,IAAI,CAACF,OAAO,IAAI,CAACC,KAAK,CAACE,MAAM,EAAE,MAAMC,KAAK,CAAC,gBAAgB,CAAC;EAE5D,MAAMC,WAA8B,GAAG,EAAE;EACzC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,OAAO,EAAEO,MAAM,EAAE,EAAED,CAAC,EAAE;IACxC,MAAMH,MAAM,GAAGH,OAAO,CAACM,CAAC,CAAC;IACzB,IAAIH,MAAM,KAAKK,SAAS,EAAE;MACxB,MAAM,CAACC,MAAM,EAAEC,KAAK,CAAC,GAAG,IAAAC,uBAAe,EAACR,MAAM,CAAC;MAE/C,IAAIS,SAAiB,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
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.optionValidator = void 0;
|
|
8
6
|
exports.optionValueName = optionValueName;
|
|
9
|
-
exports.valueValidator = exports.validThemeKeys = exports.stringOptionsValidator = exports.stringOptionValidator = exports.optionsValidator = void 0;
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
7
|
// The stuff common between different dropdown implementations.
|
|
12
8
|
|
|
13
|
-
const validThemeKeys = exports.validThemeKeys = ['active', 'arrow', 'container', 'dropdown', 'hiddenOption', 'label', 'option', 'select',
|
|
14
|
-
// TODO: This is only valid for <CustomDropdown>, thus we need to re-factor it
|
|
15
|
-
// into a separate theme spec for that component.
|
|
16
|
-
'upward'];
|
|
17
|
-
const valueValidator = exports.valueValidator = _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.string.isRequired]);
|
|
18
|
-
const optionValidator = exports.optionValidator = _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
19
|
-
name: _propTypes.default.node,
|
|
20
|
-
value: valueValidator.isRequired
|
|
21
|
-
}).isRequired, _propTypes.default.number.isRequired, _propTypes.default.string.isRequired]);
|
|
22
|
-
const optionsValidator = exports.optionsValidator = _propTypes.default.arrayOf(optionValidator.isRequired);
|
|
23
|
-
const stringOptionValidator = exports.stringOptionValidator = _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
24
|
-
name: _propTypes.default.string,
|
|
25
|
-
value: valueValidator.isRequired
|
|
26
|
-
}).isRequired, _propTypes.default.number.isRequired, _propTypes.default.string.isRequired]);
|
|
27
|
-
const stringOptionsValidator = exports.stringOptionsValidator = _propTypes.default.arrayOf(stringOptionValidator.isRequired);
|
|
28
9
|
function isValue(x) {
|
|
29
10
|
const type = typeof x;
|
|
30
11
|
return type === 'number' || type === 'string';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","names":["
|
|
1
|
+
{"version":3,"file":"common.js","names":["isValue","x","type","optionValueName","option","value","name"],"sources":["../../../../../src/shared/components/selectors/common.ts"],"sourcesContent":["// The stuff common between different dropdown implementations.\n\nimport type { Theme } from '@dr.pogodin/react-themes';\n\ntype ThemeKeyT =\n | 'active'\n | 'arrow'\n | 'container'\n | 'dropdown'\n | 'hiddenOption'\n | 'label'\n | 'option'\n | 'select'\n\n // TODO: This is only valid for <CustomDropdown>, thus we need to re-factor it\n // into a separate theme spec for that component.\n | 'upward';\n\nexport type ValueT = number | string;\n\nexport type OptionT<NameT> = {\n name?: NameT | null;\n value: ValueT;\n};\n\nexport type OptionsT<NameT> = Readonly<Array<OptionT<NameT> | ValueT>>;\n\nexport type PropsT<\n NameT,\n OnChangeT = React.ChangeEventHandler<HTMLSelectElement>,\n> = {\n filter?: (item: OptionT<NameT> | ValueT) => boolean;\n label?: React.ReactNode;\n onChange?: OnChangeT;\n options?: Readonly<OptionsT<NameT>>;\n theme: Theme<ThemeKeyT>;\n value?: ValueT;\n};\n\nfunction isValue<T>(x: OptionT<T> | ValueT): x is ValueT {\n const type = typeof x;\n return type === 'number' || type === 'string';\n}\n\n/** Returns option value and name as a tuple. */\nexport function optionValueName<NameT>(\n option: OptionT<NameT> | ValueT,\n): [ValueT, NameT | ValueT] {\n return isValue(option)\n ? [option, option]\n : [option.value, option.name ?? option.value];\n}\n"],"mappings":";;;;;;AAAA;;AAuCA,SAASA,OAAOA,CAAIC,CAAsB,EAAe;EACvD,MAAMC,IAAI,GAAG,OAAOD,CAAC;EACrB,OAAOC,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,QAAQ;AAC/C;;AAEA;AACO,SAASC,eAAeA,CAC7BC,MAA+B,EACL;EAC1B,OAAOJ,OAAO,CAACI,MAAM,CAAC,GAClB,CAACA,MAAM,EAAEA,MAAM,CAAC,GAChB,CAACA,MAAM,CAACC,KAAK,EAAED,MAAM,CAACE,IAAI,IAAIF,MAAM,CAACC,KAAK,CAAC;AACjD","ignoreList":[]}
|
|
@@ -22,20 +22,7 @@ Object.defineProperty(exports, "Switch", {
|
|
|
22
22
|
return _Switch.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
Object.defineProperty(exports, "optionValidator", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _common.optionValidator;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "optionsValidator", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _common.optionsValidator;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
25
|
var _CustomDropdown = _interopRequireDefault(require("./CustomDropdown"));
|
|
38
26
|
var _NativeDropdown = _interopRequireDefault(require("./NativeDropdown"));
|
|
39
27
|
var _Switch = _interopRequireDefault(require("./Switch"));
|
|
40
|
-
var _common = require("./common");
|
|
41
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_CustomDropdown","_interopRequireDefault","require","_NativeDropdown","_Switch"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CustomDropdown","_interopRequireDefault","require","_NativeDropdown","_Switch"],"sources":["../../../../../src/shared/components/selectors/index.ts"],"sourcesContent":["export { default as CustomDropdown } from './CustomDropdown';\nexport { default as Dropdown } from './NativeDropdown';\nexport { default as Switch } from './Switch';\n\nexport {\n type OptionT,\n type OptionsT,\n} from './common';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalState.js","names":["_reactGlobalState","require","getSsrContext","withGlobalStateType","exports"],"sources":["../../../../src/shared/utils/globalState.ts"],"sourcesContent":["import type { Request } from 'express';\n\nimport { type SsrContext, withGlobalStateType } from '@dr.pogodin/react-global-state';\n\nexport type ChunkGroupsT = {\n [chunkName: string]: string[];\n};\n\n// The type of data object injected by server into generated markup.\nexport type InjT = {\n CHUNK_GROUPS?: ChunkGroupsT;\n CONFIG?: { [key: string]: any },\n ISTATE?: unknown;\n};\n\nexport interface SsrContextT<StateT> extends SsrContext<StateT> {\n chunkGroups: ChunkGroupsT;\n chunks: string[];\n req: Request,\n status: number;\n}\n\nconst {\n getSsrContext,\n} = withGlobalStateType<unknown, SsrContextT<unknown>>();\n\nexport {\n getSsrContext,\n};\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAMA;;
|
|
1
|
+
{"version":3,"file":"globalState.js","names":["_reactGlobalState","require","getSsrContext","withGlobalStateType","exports"],"sources":["../../../../src/shared/utils/globalState.ts"],"sourcesContent":["import type { Request } from 'express';\n\nimport { type SsrContext, withGlobalStateType } from '@dr.pogodin/react-global-state';\n\nexport type ChunkGroupsT = {\n [chunkName: string]: string[];\n};\n\n// The type of data object injected by server into generated markup.\nexport type InjT = {\n CHUNK_GROUPS?: ChunkGroupsT;\n CONFIG?: { [key: string]: any },\n ISTATE?: unknown;\n};\n\ndeclare global {\n interface Window {\n REACT_UTILS_INJECTION?: InjT;\n }\n}\n\nexport interface SsrContextT<StateT> extends SsrContext<StateT> {\n chunkGroups: ChunkGroupsT;\n chunks: string[];\n req: Request,\n status: number;\n}\n\nconst {\n getSsrContext,\n} = withGlobalStateType<unknown, SsrContextT<unknown>>();\n\nexport {\n getSsrContext,\n};\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAMA;;AAoBA,MAAM;EACJC;AACF,CAAC,GAAG,IAAAC,qCAAmB,EAAgC,CAAC;AAACC,OAAA,CAAAF,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -107,12 +107,14 @@ function mount(scene) {
|
|
|
107
107
|
});
|
|
108
108
|
return res;
|
|
109
109
|
}
|
|
110
|
-
function snapshot(element) {
|
|
110
|
+
async function snapshot(element, options) {
|
|
111
111
|
let res;
|
|
112
|
-
(0, _react.act)(() => {
|
|
112
|
+
const promise = (0, _react.act)(() => {
|
|
113
113
|
res = (0, _react2.render)(element);
|
|
114
|
+
return options?.await;
|
|
114
115
|
});
|
|
115
116
|
if (res === undefined) throw Error('Render failed');
|
|
117
|
+
if (options?.await) await promise;
|
|
116
118
|
const nodes = res.asFragment().childNodes;
|
|
117
119
|
expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();
|
|
118
120
|
return res;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_react","_client","_react2","_global","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","set","Date","now","jest","advanceTimersByTime","mount","scene","root","element","document","createElement","body","appendChild","res","destroy","act","unmount","remove","createRoot","render","snapshot","undefined","Error","nodes","asFragment","childNodes","expect","length","toMatchSnapshot"],"sources":["../../../../../src/shared/utils/jest/index.tsx"],"sourcesContent":["/* global jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { type ReactNode, act } from 'react';\nimport { type Root, createRoot } from 'react-dom/client';\n\nimport { type RenderResult, render } from '@testing-library/react';\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react`.\n */\nexport { act };\n\nexport { default as getGlobal } from './global';\n\ndeclare global {\n // eslint-disable-next-line no-var, vars-on-top\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time: number) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\nexport type MountedSceneT = HTMLElement & {\n destroy: () => void;\n};\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param scene\n * @return Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene: ReactNode): MountedSceneT {\n let root: Root;\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const res: MountedSceneT = (element as unknown) as MountedSceneT;\n res.destroy = () => {\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => root.unmount());\n res.remove();\n };\n\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\nexport function snapshot(element: React.ReactElement) {\n let res: RenderResult | undefined;\n act(() => {\n res = render(element);\n });\n if (res === undefined) throw Error('Render failed');\n\n const nodes = res.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchS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ACC,IAAY,EAAE;EAC5CC,iBAAQ,CAACC,GAAG,CAACF,IAAI,GAAGG,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC;EAC/BC,IAAI,CAACC,mBAAmB,CAACN,IAAI,CAAC;AAChC;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,KAAKA,CAACC,KAAgB,EAAiB;EACrD,IAAIC,IAAU;EACd,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAC7CD,QAAQ,CAACE,IAAI,CAACC,WAAW,CAACJ,OAAO,CAAC;EAElC,MAAMK,GAAkB,GAAIL,OAAoC;EAChEK,GAAG,CAACC,OAAO,GAAG,MAAM;IAClB;IACA;IACAlC,MAAM,CAACC,wBAAwB,GAAG,IAAI;IAEtC,IAAAkC,UAAG,EAAC,MAAMR,IAAI,CAACS,OAAO,CAAC,CAAC,CAAC;IACzBH,GAAG,CAACI,MAAM,CAAC,CAAC;EACd,CAAC;;EAED;EACA;EACArC,MAAM,CAACC,wBAAwB,GAAG,IAAI;EAEtC,IAAAkC,UAAG,EAAC,MAAM;IACRR,IAAI,GAAG,IAAAW,kBAAU,EAACL,GAAG,CAAC;IACtBN,IAAI,CAACY,MAAM,CAACb,KAAK,CAAC;EACpB,CAAC,CAAC;EACF,OAAOO,GAAG;AACZ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_mockdate","_interopRequireDefault","require","_react","_client","_react2","_global","global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","set","Date","now","jest","advanceTimersByTime","mount","scene","root","element","document","createElement","body","appendChild","res","destroy","act","unmount","remove","createRoot","render","snapshot","options","promise","await","undefined","Error","nodes","asFragment","childNodes","expect","length","toMatchSnapshot"],"sources":["../../../../../src/shared/utils/jest/index.tsx"],"sourcesContent":["/* global jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { type ReactNode, act } from 'react';\nimport { type Root, createRoot } from 'react-dom/client';\n\nimport { type RenderResult, render } from '@testing-library/react';\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react`.\n */\nexport { act };\n\nexport { default as getGlobal } from './global';\n\ndeclare global {\n // eslint-disable-next-line no-var, vars-on-top\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time: number) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\nexport type MountedSceneT = HTMLElement & {\n destroy: () => void;\n};\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param scene\n * @return Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene: ReactNode): MountedSceneT {\n let root: Root;\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const res: MountedSceneT = (element as unknown) as MountedSceneT;\n res.destroy = () => {\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => root.unmount());\n res.remove();\n };\n\n // NOTE: As it seems @testing-library may reset this flag to false\n // when it is simulating user events.\n global.IS_REACT_ACT_ENVIRONMENT = true;\n\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\ntype SnapshotOptionsT = {\n await?: Promise<void>;\n};\n\nexport async function snapshot(\n element: React.ReactElement,\n options?: SnapshotOptionsT,\n) {\n let res: RenderResult | undefined;\n\n const promise = act(() => {\n res = render(element);\n return options?.await;\n });\n\n if (res === undefined) throw Error('Render failed');\n if (options?.await) await promise;\n\n const nodes = res.asFragment().childNodes;\n expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();\n return res;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAQA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;;AAQA;AACA;AACA;AACA;;AAUAK,MAAM,CAACC,wBAAwB,GAAG,IAAI;AAEtC,MAAMC,uBAAuB,GAAGC,OAAO,CAACC,QAAQ;;AAEhD;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAA,EAAG;EAC/BC,MAAM,CAACC,cAAc,CAACJ,OAAO,EAAE,UAAU,EAAE;IAAEK,KAAK,EAAE;EAAK,CAAC,CAAC;AAC7D;;AAEA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAAG;EACjCH,MAAM,CAACC,cAAc,CAACJ,OAAO,EAAE,UAAU,EAAE;IACzCK,KAAK,EAAEN,uBAAuB;IAC9BQ,QAAQ,EAAE;EACZ,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAACC,IAAI,G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b,KAAK,CAAC;EACpB,CAAC,CAAC;EACF,OAAOO,GAAG;AACZ;AAMO,eAAeO,QAAQA,CAC5BZ,OAA2B,EAC3Ba,OAA0B,EAC1B;EACA,IAAIR,GAA6B;EAEjC,MAAMS,OAAO,GAAG,IAAAP,UAAG,EAAC,MAAM;IACxBF,GAAG,GAAG,IAAAM,cAAM,EAACX,OAAO,CAAC;IACrB,OAAOa,OAAO,EAAEE,KAAK;EACvB,CAAC,CAAC;EAEF,IAAIV,GAAG,KAAKW,SAAS,EAAE,MAAMC,KAAK,CAAC,eAAe,CAAC;EACnD,IAAIJ,OAAO,EAAEE,KAAK,EAAE,MAAMD,OAAO;EAEjC,MAAMI,KAAK,GAAGb,GAAG,CAACc,UAAU,CAAC,CAAC,CAACC,UAAU;EACzCC,MAAM,CAACH,KAAK,CAACI,MAAM,GAAG,CAAC,GAAG,CAAC,GAAGJ,KAAK,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,CAAC,CAACK,eAAe,CAAC,CAAC;EAClE,OAAOlB,GAAG;AACZ","ignoreList":[]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.bookStyleSheets = bookStyleSheets;
|
|
8
7
|
exports.default = splitComponent;
|
|
9
8
|
exports.freeStyleSheets = freeStyleSheets;
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
9
|
var _react = require("react");
|
|
12
10
|
var _jsUtils = require("@dr.pogodin/js-utils");
|
|
13
11
|
var _globalState = require("./globalState");
|
|
@@ -16,20 +14,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
16
14
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
17
15
|
/* global document */
|
|
18
16
|
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// alongside custom chunk info injection in server-less scenario);
|
|
22
|
-
// at the server-side we only can get them within React render flow.
|
|
17
|
+
// Note: At the client side we can get chunk groups immediately when loading
|
|
18
|
+
// the module; at the server-side we only can get them within React render flow.
|
|
23
19
|
// Thus, we set and use the following variable at the client-side, and then when
|
|
24
20
|
// needed on the server side, we'll fetch it differently.
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cachedClientChunkGroups = require("../../client/getInj").default().CHUNK_GROUPS || {};
|
|
30
|
-
}
|
|
31
|
-
if (!cachedClientChunkGroups) throw Error('Internal error');
|
|
32
|
-
return cachedClientChunkGroups;
|
|
21
|
+
let clientChunkGroups;
|
|
22
|
+
if (_isomorphy.IS_CLIENT_SIDE) {
|
|
23
|
+
// eslint-disable-next-line global-require
|
|
24
|
+
clientChunkGroups = require("../../client/getInj").default().CHUNK_GROUPS || {};
|
|
33
25
|
}
|
|
34
26
|
const refCounts = {};
|
|
35
27
|
function getPublicPath() {
|
|
@@ -78,9 +70,7 @@ function getLoadedStyleSheets() {
|
|
|
78
70
|
styleSheets
|
|
79
71
|
} = document;
|
|
80
72
|
for (let i = 0; i < styleSheets.length; ++i) {
|
|
81
|
-
const
|
|
82
|
-
href
|
|
83
|
-
} = styleSheets[i];
|
|
73
|
+
const href = styleSheets[i]?.href;
|
|
84
74
|
if (href) res.add(href);
|
|
85
75
|
}
|
|
86
76
|
return res;
|
|
@@ -102,10 +92,11 @@ function assertChunkName(chunkName, chunkGroups) {
|
|
|
102
92
|
function bookStyleSheets(chunkName, chunkGroups, refCount) {
|
|
103
93
|
const promises = [];
|
|
104
94
|
const assets = chunkGroups[chunkName];
|
|
95
|
+
if (!assets) return Promise.resolve();
|
|
105
96
|
const loadedSheets = getLoadedStyleSheets();
|
|
106
97
|
for (let i = 0; i < assets.length; ++i) {
|
|
107
98
|
const asset = assets[i];
|
|
108
|
-
if (asset
|
|
99
|
+
if (asset?.endsWith('.css')) {
|
|
109
100
|
const promise = bookStyleSheet(asset, loadedSheets, refCount);
|
|
110
101
|
if (promise) promises.push(promise);
|
|
111
102
|
}
|
|
@@ -122,12 +113,17 @@ function bookStyleSheets(chunkName, chunkGroups, refCount) {
|
|
|
122
113
|
*/
|
|
123
114
|
function freeStyleSheets(chunkName, chunkGroups) {
|
|
124
115
|
const assets = chunkGroups[chunkName];
|
|
116
|
+
if (!assets) return;
|
|
125
117
|
for (let i = 0; i < assets.length; ++i) {
|
|
126
118
|
const asset = assets[i];
|
|
127
|
-
if (asset
|
|
119
|
+
if (asset?.endsWith('.css')) {
|
|
128
120
|
const path = `${getPublicPath()}/${asset}`;
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
const pathRefCount = refCounts[path];
|
|
122
|
+
if (pathRefCount) {
|
|
123
|
+
if (pathRefCount <= 1) {
|
|
124
|
+
document.head.querySelector(`link[href="${path}"]`).remove();
|
|
125
|
+
delete refCounts[path];
|
|
126
|
+
} else refCounts[path] = pathRefCount - 1;
|
|
131
127
|
}
|
|
132
128
|
}
|
|
133
129
|
}
|
|
@@ -151,7 +147,7 @@ function splitComponent({
|
|
|
151
147
|
placeholder
|
|
152
148
|
}) {
|
|
153
149
|
// On the client side we can check right away if the chunk name is known.
|
|
154
|
-
if (_isomorphy.IS_CLIENT_SIDE) assertChunkName(chunkName,
|
|
150
|
+
if (_isomorphy.IS_CLIENT_SIDE) assertChunkName(chunkName, clientChunkGroups);
|
|
155
151
|
|
|
156
152
|
// The correct usage of splitComponent() assumes a single call per chunk.
|
|
157
153
|
if (usedChunkNames.has(chunkName)) {
|
|
@@ -165,7 +161,7 @@ function splitComponent({
|
|
|
165
161
|
// the component (the lazy load function is executed by React one at
|
|
166
162
|
// the frist mount).
|
|
167
163
|
if (_isomorphy.IS_CLIENT_SIDE) {
|
|
168
|
-
await bookStyleSheets(chunkName,
|
|
164
|
+
await bookStyleSheets(chunkName, clientChunkGroups, false);
|
|
169
165
|
}
|
|
170
166
|
const Wrapper = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
171
167
|
children,
|
|
@@ -185,8 +181,8 @@ function splitComponent({
|
|
|
185
181
|
// This takes care about stylesheets management every time an instance of
|
|
186
182
|
// this component is mounted / unmounted.
|
|
187
183
|
(0, _react.useInsertionEffect)(() => {
|
|
188
|
-
bookStyleSheets(chunkName,
|
|
189
|
-
return () => freeStyleSheets(chunkName,
|
|
184
|
+
bookStyleSheets(chunkName, clientChunkGroups, true);
|
|
185
|
+
return () => freeStyleSheets(chunkName, clientChunkGroups);
|
|
190
186
|
}, []);
|
|
191
187
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
192
188
|
ref: ref,
|
|
@@ -208,9 +204,6 @@ function splitComponent({
|
|
|
208
204
|
children: children
|
|
209
205
|
})
|
|
210
206
|
});
|
|
211
|
-
CodeSplit.propTypes = {
|
|
212
|
-
children: _propTypes.default.node
|
|
213
|
-
};
|
|
214
207
|
return CodeSplit;
|
|
215
208
|
}
|
|
216
209
|
//# sourceMappingURL=splitComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitComponent.js","names":["_propTypes","_interopRequireDefault","require","_react","_jsUtils","_globalState","_isomorphy","_jsxRuntime","cachedClientChunkGroups","getClientChunkGroups","IS_CLIENT_SIDE","default","CHUNK_GROUPS","Error","refCounts","getPublicPath","getBuildInfo","publicPath","bookStyleSheet","name","loadedSheets","refCount","res","path","fullPath","document","location","origin","has","link","querySelector","createElement","setAttribute","head","appendChild","Barrier","addEventListener","resolve","current","getLoadedStyleSheets","Set","styleSheets","i","length","href","add","assertChunkName","chunkName","chunkGroups","bookStyleSheets","promises","assets","asset","endsWith","promise","push","Promise","allSettled","then","freeStyleSheets","remove","usedChunkNames","splitComponent","getComponent","placeholder","LazyComponent","lazy","resolved","Component","Wrapper","forwardRef","children","rest","ref","IS_SERVER_SIDE","chunks","getSsrContext","includes","useInsertionEffect","jsx","CodeSplit","Suspense","fallback","propTypes","PT","node"],"sources":["../../../../src/shared/utils/splitComponent.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document */\n\nimport PT from 'prop-types';\n\nimport {\n type ComponentType,\n type ReactNode,\n forwardRef,\n lazy,\n Suspense,\n useInsertionEffect,\n} from 'react';\n\nimport { Barrier } from '@dr.pogodin/js-utils';\n\nimport { type ChunkGroupsT, getSsrContext } from './globalState';\n\nimport {\n IS_CLIENT_SIDE,\n IS_SERVER_SIDE,\n getBuildInfo,\n} from './isomorphy';\n\n// NOTE: At the client-side we get chunk groups the first time they are needed\n// (we used to get them eagerly when this module loaded, but it did not work well\n// alongside custom chunk info injection in server-less scenario);\n// at the server-side we only can get them within React render flow.\n// Thus, we set and use the following variable at the client-side, and then when\n// needed on the server side, we'll fetch it differently.\nlet cachedClientChunkGroups: ChunkGroupsT | undefined;\n\nfunction getClientChunkGroups(): ChunkGroupsT {\n if (IS_CLIENT_SIDE && !cachedClientChunkGroups) {\n // eslint-disable-next-line global-require\n cachedClientChunkGroups = require('client/getInj').default().CHUNK_GROUPS || {};\n }\n\n if (!cachedClientChunkGroups) throw Error('Internal error');\n\n return cachedClientChunkGroups;\n}\n\nconst refCounts: { [path: string]: number } = {};\n\nfunction getPublicPath() {\n return getBuildInfo().publicPath;\n}\n\n/**\n * Client-side only! Ensures the specified CSS stylesheet is loaded into\n * the document; loads if it is missing; and does simple reference counting\n * to facilitate future clean-up.\n * @param name\n * @param loadedSheets\n * @param refCount\n * @return\n */\nfunction bookStyleSheet(\n name: string,\n loadedSheets: Set<string>,\n refCount: boolean,\n): Promise<void> | undefined {\n let res: Barrier<void> | undefined;\n const path = `${getPublicPath()}/${name}`;\n const fullPath = `${document.location.origin}${path}`;\n\n if (!loadedSheets.has(fullPath)) {\n let link = document.querySelector(`link[href=\"${path}\"]`);\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('href', path);\n document.head.appendChild(link);\n }\n\n res = new Barrier<void>();\n link.addEventListener('load', () => res!.resolve());\n link.addEventListener('error', () => res!.resolve());\n }\n\n if (refCount) {\n const current = refCounts[path] || 0;\n refCounts[path] = 1 + current;\n }\n\n return res;\n}\n\n/**\n * Generates the set of URLs for currently loaded, linked stylesheets.\n * @return\n */\nfunction getLoadedStyleSheets(): Set<string> {\n const res = new Set<string>();\n const { styleSheets } = document;\n for (let i = 0; i < styleSheets.length; ++i) {\n const { href } = styleSheets[i];\n if (href) res.add(href);\n }\n return res;\n}\n\nfunction assertChunkName(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n if (chunkGroups[chunkName]) return;\n throw Error(`Unknown chunk name \"${chunkName}\"`);\n}\n\n/**\n * Client-side only! Ensures all CSS stylesheets required for the specified\n * code chunk are loaded into the document; loads the missing ones; and does\n * simple reference counting to facilitate future clean-up.\n * @param chunkName Chunk name.\n * @param refCount\n * @return Resolves once all pending stylesheets, necessary for\n * the chunk, are either loaded, or failed to load.\n */\nexport function bookStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n refCount: boolean,\n): Promise<void> {\n const promises = [];\n const assets = chunkGroups[chunkName];\n const loadedSheets = getLoadedStyleSheets();\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset.endsWith('.css')) {\n const promise = bookStyleSheet(asset, loadedSheets, refCount);\n if (promise) promises.push(promise);\n }\n }\n\n return promises.length\n ? Promise.allSettled(promises).then()\n : Promise.resolve();\n}\n\n/**\n * Client-side only! Frees from the document all CSS stylesheets that are\n * required by the specified chunk, and have reference counter equal to one\n * (for chunks with larger reference counter values, it just decrements\n * the reference counter).\n * @param {string} chunkName\n */\nexport function freeStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n const assets = chunkGroups[chunkName];\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset.endsWith('.css')) {\n const path = `${getPublicPath()}/${asset}`;\n if (--refCounts[path] <= 0) {\n document.head.querySelector(`link[href=\"${path}\"]`)!.remove();\n }\n }\n }\n}\n\n// Holds the set of chunk names already used for splitComponent() calls.\nconst usedChunkNames = new Set();\n\ntype ComponentOrModule<PropsT> = ComponentType<PropsT> | {\n default: ComponentType<PropsT>,\n};\n\n/**\n * Given an async component retrieval function `getComponent()` it creates\n * a special \"code split\" component, which uses <Suspense> to asynchronously\n * load on demand the code required by `getComponent()`.\n * @param options\n * @param options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent<\n ComponentPropsT extends { children?: ReactNode },\n>({\n chunkName,\n getComponent,\n placeholder,\n}: {\n chunkName: string;\n getComponent: () => Promise<ComponentOrModule<ComponentPropsT>>,\n placeholder?: ReactNode,\n}) {\n // On the client side we can check right away if the chunk name is known.\n if (IS_CLIENT_SIDE) assertChunkName(chunkName, getClientChunkGroups());\n\n // The correct usage of splitComponent() assumes a single call per chunk.\n if (usedChunkNames.has(chunkName)) {\n throw Error(`Repeated splitComponent() call for the chunk \"${chunkName}\"`);\n } else usedChunkNames.add(chunkName);\n\n const LazyComponent = lazy(async () => {\n const resolved = await getComponent();\n const Component = 'default' in resolved ? resolved.default : resolved;\n\n // This pre-loads necessary stylesheets prior to the first mount of\n // the component (the lazy load function is executed by React one at\n // the frist mount).\n if (IS_CLIENT_SIDE) {\n await bookStyleSheets(chunkName, getClientChunkGroups(), false);\n }\n\n const Wrapper = forwardRef((\n { children, ...rest }: ComponentPropsT,\n ref,\n ) => {\n // On the server side we'll assert the chunk name here,\n // and also push it to the SSR chunks array.\n if (IS_SERVER_SIDE) {\n const { chunkGroups, chunks } = getSsrContext()!;\n assertChunkName(chunkName, chunkGroups);\n if (!chunks.includes(chunkName)) chunks.push(chunkName);\n }\n\n // This takes care about stylesheets management every time an instance of\n // this component is mounted / unmounted.\n useInsertionEffect(() => {\n bookStyleSheets(chunkName, getClientChunkGroups(), true);\n return () => freeStyleSheets(chunkName, getClientChunkGroups());\n }, []);\n\n return (\n <Component ref={ref} {...rest as ComponentPropsT}>\n {children}\n </Component>\n );\n });\n\n return { default: Wrapper };\n });\n\n const CodeSplit: React.FunctionComponent<ComponentPropsT> = ({\n children,\n ...rest\n }: ComponentPropsT) => (\n <Suspense fallback={placeholder}>\n <LazyComponent {...rest as Parameters<typeof LazyComponent>[0]}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n\n CodeSplit.propTypes = {\n children: PT.node,\n } as PT.WeakValidationMap<ComponentPropsT>;\n\n return CodeSplit;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AASA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAIqB,IAAAK,WAAA,GAAAL,OAAA;AAtBrB;AACA;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIM,uBAAiD;AAErD,SAASC,oBAAoBA,CAAA,EAAiB;EAC5C,IAAIC,yBAAc,IAAI,CAACF,uBAAuB,EAAE;IAC9C;IACAA,uBAAuB,GAAGN,OAAO,sBAAgB,CAAC,CAACS,OAAO,CAAC,CAAC,CAACC,YAAY,IAAI,CAAC,CAAC;EACjF;EAEA,IAAI,CAACJ,uBAAuB,EAAE,MAAMK,KAAK,CAAC,gBAAgB,CAAC;EAE3D,OAAOL,uBAAuB;AAChC;AAEA,MAAMM,SAAqC,GAAG,CAAC,CAAC;AAEhD,SAASC,aAAaA,CAAA,EAAG;EACvB,OAAO,IAAAC,uBAAY,EAAC,CAAC,CAACC,UAAU;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CACrBC,IAAY,EACZC,YAAyB,EACzBC,QAAiB,EACU;EAC3B,IAAIC,GAA8B;EAClC,MAAMC,IAAI,GAAG,GAAGR,aAAa,CAAC,CAAC,IAAII,IAAI,EAAE;EACzC,MAAM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phy","_jsxRuntime","clientChunkGroups","IS_CLIENT_SIDE","default","CHUNK_GROUPS","refCounts","getPublicPath","getBuildInfo","publicPath","bookStyleSheet","name","loadedSheets","refCount","res","path","fullPath","document","location","origin","has","link","querySelector","createElement","setAttribute","head","appendChild","Barrier","addEventListener","resolve","current","getLoadedStyleSheets","Set","styleSheets","i","length","href","add","assertChunkName","chunkName","chunkGroups","Error","bookStyleSheets","promises","assets","Promise","asset","endsWith","promise","push","allSettled","then","freeStyleSheets","pathRefCount","remove","usedChunkNames","splitComponent","getComponent","placeholder","LazyComponent","lazy","resolved","Component","Wrapper","forwardRef","children","rest","ref","IS_SERVER_SIDE","chunks","getSsrContext","includes","useInsertionEffect","jsx","CodeSplit","Suspense","fallback"],"sources":["../../../../src/shared/utils/splitComponent.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document */\n\nimport {\n type ComponentType,\n type ReactNode,\n forwardRef,\n lazy,\n Suspense,\n useInsertionEffect,\n} from 'react';\n\nimport { Barrier } from '@dr.pogodin/js-utils';\n\nimport { type ChunkGroupsT, getSsrContext } from './globalState';\n\nimport {\n IS_CLIENT_SIDE,\n IS_SERVER_SIDE,\n getBuildInfo,\n} from './isomorphy';\n\n// Note: At the client side we can get chunk groups immediately when loading\n// the module; at the server-side we only can get them within React render flow.\n// Thus, we set and use the following variable at the client-side, and then when\n// needed on the server side, we'll fetch it differently.\nlet clientChunkGroups: ChunkGroupsT;\n\nif (IS_CLIENT_SIDE) {\n // eslint-disable-next-line global-require\n clientChunkGroups = require('client/getInj').default().CHUNK_GROUPS || {};\n}\n\nconst refCounts: { [path: string]: number } = {};\n\nfunction getPublicPath() {\n return getBuildInfo().publicPath;\n}\n\n/**\n * Client-side only! Ensures the specified CSS stylesheet is loaded into\n * the document; loads if it is missing; and does simple reference counting\n * to facilitate future clean-up.\n * @param name\n * @param loadedSheets\n * @param refCount\n * @return\n */\nfunction bookStyleSheet(\n name: string,\n loadedSheets: Set<string>,\n refCount: boolean,\n): Promise<void> | undefined {\n let res: Barrier<void> | undefined;\n const path = `${getPublicPath()}/${name}`;\n const fullPath = `${document.location.origin}${path}`;\n\n if (!loadedSheets.has(fullPath)) {\n let link = document.querySelector(`link[href=\"${path}\"]`);\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('href', path);\n document.head.appendChild(link);\n }\n\n res = new Barrier<void>();\n link.addEventListener('load', () => res!.resolve());\n link.addEventListener('error', () => res!.resolve());\n }\n\n if (refCount) {\n const current = refCounts[path] || 0;\n refCounts[path] = 1 + current;\n }\n\n return res;\n}\n\n/**\n * Generates the set of URLs for currently loaded, linked stylesheets.\n * @return\n */\nfunction getLoadedStyleSheets(): Set<string> {\n const res = new Set<string>();\n const { styleSheets } = document;\n for (let i = 0; i < styleSheets.length; ++i) {\n const href = styleSheets[i]?.href;\n if (href) res.add(href);\n }\n return res;\n}\n\nfunction assertChunkName(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n if (chunkGroups[chunkName]) return;\n throw Error(`Unknown chunk name \"${chunkName}\"`);\n}\n\n/**\n * Client-side only! Ensures all CSS stylesheets required for the specified\n * code chunk are loaded into the document; loads the missing ones; and does\n * simple reference counting to facilitate future clean-up.\n * @param chunkName Chunk name.\n * @param refCount\n * @return Resolves once all pending stylesheets, necessary for\n * the chunk, are either loaded, or failed to load.\n */\nexport function bookStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n refCount: boolean,\n): Promise<void> {\n const promises = [];\n const assets = chunkGroups[chunkName];\n if (!assets) return Promise.resolve();\n\n const loadedSheets = getLoadedStyleSheets();\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset?.endsWith('.css')) {\n const promise = bookStyleSheet(asset, loadedSheets, refCount);\n if (promise) promises.push(promise);\n }\n }\n\n return promises.length\n ? Promise.allSettled(promises).then()\n : Promise.resolve();\n}\n\n/**\n * Client-side only! Frees from the document all CSS stylesheets that are\n * required by the specified chunk, and have reference counter equal to one\n * (for chunks with larger reference counter values, it just decrements\n * the reference counter).\n * @param {string} chunkName\n */\nexport function freeStyleSheets(\n chunkName: string,\n chunkGroups: ChunkGroupsT,\n) {\n const assets = chunkGroups[chunkName];\n if (!assets) return;\n\n for (let i = 0; i < assets.length; ++i) {\n const asset = assets[i];\n if (asset?.endsWith('.css')) {\n const path = `${getPublicPath()}/${asset}`;\n\n const pathRefCount = refCounts[path];\n if (pathRefCount) {\n if (pathRefCount <= 1) {\n document.head.querySelector(`link[href=\"${path}\"]`)!.remove();\n delete refCounts[path];\n } else refCounts[path] = pathRefCount - 1;\n }\n }\n }\n}\n\n// Holds the set of chunk names already used for splitComponent() calls.\nconst usedChunkNames = new Set();\n\ntype ComponentOrModule<PropsT> = ComponentType<PropsT> | {\n default: ComponentType<PropsT>,\n};\n\n/**\n * Given an async component retrieval function `getComponent()` it creates\n * a special \"code split\" component, which uses <Suspense> to asynchronously\n * load on demand the code required by `getComponent()`.\n * @param options\n * @param options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent<\n ComponentPropsT extends { children?: ReactNode },\n>({\n chunkName,\n getComponent,\n placeholder,\n}: {\n chunkName: string;\n getComponent: () => Promise<ComponentOrModule<ComponentPropsT>>,\n placeholder?: ReactNode,\n}) {\n // On the client side we can check right away if the chunk name is known.\n if (IS_CLIENT_SIDE) assertChunkName(chunkName, clientChunkGroups);\n\n // The correct usage of splitComponent() assumes a single call per chunk.\n if (usedChunkNames.has(chunkName)) {\n throw Error(`Repeated splitComponent() call for the chunk \"${chunkName}\"`);\n } else usedChunkNames.add(chunkName);\n\n const LazyComponent = lazy(async () => {\n const resolved = await getComponent();\n const Component = 'default' in resolved ? resolved.default : resolved;\n\n // This pre-loads necessary stylesheets prior to the first mount of\n // the component (the lazy load function is executed by React one at\n // the frist mount).\n if (IS_CLIENT_SIDE) {\n await bookStyleSheets(chunkName, clientChunkGroups, false);\n }\n\n const Wrapper = forwardRef((\n { children, ...rest }: ComponentPropsT,\n ref,\n ) => {\n // On the server side we'll assert the chunk name here,\n // and also push it to the SSR chunks array.\n if (IS_SERVER_SIDE) {\n const { chunkGroups, chunks } = getSsrContext()!;\n assertChunkName(chunkName, chunkGroups);\n if (!chunks.includes(chunkName)) chunks.push(chunkName);\n }\n\n // This takes care about stylesheets management every time an instance of\n // this component is mounted / unmounted.\n useInsertionEffect(() => {\n bookStyleSheets(chunkName, clientChunkGroups, true);\n return () => freeStyleSheets(chunkName, clientChunkGroups);\n }, []);\n\n return (\n <Component ref={ref} {...rest as ComponentPropsT}>\n {children}\n </Component>\n );\n });\n\n return { default: Wrapper };\n });\n\n const CodeSplit: React.FunctionComponent<ComponentPropsT> = ({\n children,\n ...rest\n }: ComponentPropsT) => (\n <Suspense fallback={placeholder}>\n <LazyComponent {...rest as Parameters<typeof LazyComponent>[0]}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n\n return CodeSplit;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAIqB,IAAAI,WAAA,GAAAJ,OAAA;AApBrB;AACA;;AAqBA;AACA;AACA;AACA;AACA,IAAIK,iBAA+B;AAEnC,IAAIC,yBAAc,EAAE;EAClB;EACAD,iBAAiB,GAAGL,OAAO,sBAAgB,CAAC,CAACO,OAAO,CAAC,CAAC,CAACC,YAAY,IAAI,CAAC,CAAC;AAC3E;AAEA,MAAMC,SAAqC,GAAG,CAAC,CAAC;AAEhD,SAASC,aAAaA,CAAA,EAAG;EACvB,OAAO,IAAAC,uBAAY,EAAC,CAAC,CAACC,UAAU;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CACrBC,IAAY,EACZC,YAAyB,EACzBC,QAAiB,EACU;EA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