@dr.pogodin/react-utils 1.33.1 → 1.33.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.
Files changed (33) hide show
  1. package/build/development/server/index.js +2 -0
  2. package/build/development/server/index.js.map +1 -1
  3. package/build/development/shared/components/Checkbox/index.js +1 -0
  4. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  5. package/build/development/shared/components/selectors/Switch/index.js +3 -3
  6. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  7. package/build/development/shared/utils/webpack.js +5 -2
  8. package/build/development/shared/utils/webpack.js.map +1 -1
  9. package/build/development/style.css +3 -3
  10. package/build/development/web.bundle.js +4 -4
  11. package/build/production/server/index.js +1 -1
  12. package/build/production/server/index.js.map +1 -1
  13. package/build/production/shared/components/Checkbox/index.js +1 -1
  14. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  15. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  16. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  17. package/build/production/shared/utils/webpack.js +1 -1
  18. package/build/production/shared/utils/webpack.js.map +1 -1
  19. package/build/production/style.css +1 -1
  20. package/build/production/style.css.map +1 -1
  21. package/build/production/web.bundle.js +1 -1
  22. package/build/production/web.bundle.js.map +1 -1
  23. package/build/types-code/server/index.d.ts +5 -3
  24. package/build/types-code/shared/components/selectors/Switch/index.d.ts +1 -1
  25. package/build/types-scss/src/shared/components/selectors/Switch/theme.scss.d.ts +1 -0
  26. package/config/webpack/app-base.js +4 -7
  27. package/config/webpack/lib-base.js +4 -7
  28. package/package.json +3 -3
  29. package/src/server/index.ts +9 -5
  30. package/src/shared/components/Checkbox/index.tsx +1 -0
  31. package/src/shared/components/selectors/Switch/index.tsx +2 -2
  32. package/src/shared/components/selectors/Switch/theme.scss +1 -1
  33. package/src/shared/utils/webpack.ts +5 -2
@@ -4,9 +4,9 @@ import 'source-map-support/register';
4
4
  import http from 'http';
5
5
  import 'raf/polyfill';
6
6
  import { type Configuration } from 'webpack';
7
- import { type OptionsT as ServerOptionsT } from './server';
8
- export { getDefaultCspSettings, } from './server';
9
- export { errors } from './utils';
7
+ import { type OptionsT as ServerOptionsT, getDefaultCspSettings } from './server';
8
+ import { errors } from './utils';
9
+ export { errors, getDefaultCspSettings };
10
10
  type OptionsT = ServerOptionsT & {
11
11
  https?: {
12
12
  cert: string;
@@ -141,5 +141,7 @@ declare function launchServer(webpackConfig: Configuration, options: OptionsT):
141
141
  }>;
142
142
  declare namespace launchServer {
143
143
  var SCRIPT_LOCATIONS: typeof import("./renderer").SCRIPT_LOCATIONS;
144
+ var getDefaultCspSettings: typeof import("./server").getDefaultCspSettings;
145
+ var errors: typeof import("./utils/errors");
144
146
  }
145
147
  export default launchServer;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type Theme } from '@dr.pogodin/react-themes';
3
3
  import { type OptionsT } from '../common';
4
- declare const validThemeKeys: readonly ["container", "label", "option", "selected", "switch"];
4
+ declare const validThemeKeys: readonly ["container", "label", "option", "options", "selected"];
5
5
  type PropsT = {
6
6
  label?: React.ReactNode;
7
7
  onChange?: (value: string) => void;
@@ -3,4 +3,5 @@ export declare const container: string;
3
3
  export declare const context: string;
4
4
  export declare const hoc: string;
5
5
  export declare const option: string;
6
+ export declare const options: string;
6
7
  export declare const selected: string;
@@ -282,14 +282,11 @@ function configFactory(ops) {
282
282
  modules: {
283
283
  getLocalIdent: utils_1.getLocalIdent,
284
284
  localIdentName: o.cssLocalIdent,
285
- // TODO: This flag defaults `true` for ES module builds since
286
- // css-loader@7.0.0:
285
+ // This flag defaults `true` for ES module builds since css-loader@7.0.0:
287
286
  // https://github.com/webpack-contrib/css-loader/releases/tag/v7.0.0
288
- // For now we'll keep it `false` to avoid a breaking change for
289
- // host projects, and also because babel-plugin-react-css-modules
290
- // we rely upon is pending an upgrade to support named style
291
- // imports:
292
- // https://github.com/birdofpreyru/babel-plugin-react-css-modules/issues/44
287
+ // We'll keep it `false` to avoid a breaking change for dependant
288
+ // projects, and I am also not sure what are the benefits of
289
+ // named CSS exports anyway.
293
290
  namedExport: false,
294
291
  },
295
292
  },
@@ -103,14 +103,11 @@ function configFactory(ops) {
103
103
  modules: {
104
104
  getLocalIdent: utils_1.getLocalIdent,
105
105
  localIdentName: ops.cssLocalIdent,
106
- // TODO: This flag defaults `true` for ES module builds since
107
- // css-loader@7.0.0:
106
+ // This flag defaults `true` for ES module builds since css-loader@7.0.0:
108
107
  // https://github.com/webpack-contrib/css-loader/releases/tag/v7.0.0
109
- // For now we'll keep it `false` to avoid a breaking change for
110
- // host projects, and also because babel-plugin-react-css-modules
111
- // we rely upon is pending an upgrade to support named style
112
- // imports:
113
- // https://github.com/birdofpreyru/babel-plugin-react-css-modules/issues/44
108
+ // We'll keep it `false` to avoid a breaking change for dependant
109
+ // projects, and I am also not sure what are the benefits of
110
+ // named CSS exports anyway.
114
111
  namedExport: false,
115
112
  },
116
113
  },
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.33.1",
2
+ "version": "1.33.3",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@babel/runtime": "^7.24.4",
12
- "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.0",
12
+ "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.1",
13
13
  "@dr.pogodin/csurf": "^1.13.0",
14
14
  "@dr.pogodin/js-utils": "^0.0.9",
15
15
  "@dr.pogodin/react-global-state": "^0.14.0",
@@ -95,7 +95,7 @@
95
95
  "eslint-config-airbnb-typescript": "^18.0.0",
96
96
  "eslint-import-resolver-babel-module": "^5.3.2",
97
97
  "eslint-plugin-import": "^2.29.1",
98
- "eslint-plugin-jest": "^28.0.0",
98
+ "eslint-plugin-jest": "^28.2.0",
99
99
  "eslint-plugin-jsx-a11y": "^6.8.0",
100
100
  "eslint-plugin-react": "^7.34.1",
101
101
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -17,14 +17,16 @@ import 'raf/polyfill';
17
17
 
18
18
  import { type Configuration } from 'webpack';
19
19
 
20
- import serverFactory, { type OptionsT as ServerOptionsT } from './server';
21
- import { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';
22
-
23
- export {
20
+ import serverFactory, {
21
+ type OptionsT as ServerOptionsT,
24
22
  getDefaultCspSettings,
25
23
  } from './server';
26
24
 
27
- export { errors } from './utils';
25
+ import { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';
26
+
27
+ import { errors } from './utils';
28
+
29
+ export { errors, getDefaultCspSettings };
28
30
 
29
31
  /**
30
32
  * Normalizes a port into a number, string, or false.
@@ -228,3 +230,5 @@ export default async function launchServer(webpackConfig: Configuration, options
228
230
  }
229
231
 
230
232
  launchServer.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;
233
+ launchServer.getDefaultCspSettings = getDefaultCspSettings;
234
+ launchServer.errors = errors;
@@ -25,6 +25,7 @@ const Checkbox: React.FunctionComponent<PropT> = ({
25
25
  checked={checked}
26
26
  className={theme.checkbox}
27
27
  onChange={onChange}
28
+ onClick={(e) => e.stopPropagation()}
28
29
  type="checkbox"
29
30
  />
30
31
  </div>
@@ -9,8 +9,8 @@ const validThemeKeys = [
9
9
  'container',
10
10
  'label',
11
11
  'option',
12
+ 'options',
12
13
  'selected',
13
- 'switch',
14
14
  ] as const;
15
15
 
16
16
  type PropsT = {
@@ -62,7 +62,7 @@ const BaseSwitch: React.FunctionComponent<PropsT> = ({
62
62
  return (
63
63
  <div className={theme.container}>
64
64
  {label ? <div className={theme.label}>{label}</div> : null}
65
- <div className={theme.switch}>
65
+ <div className={theme.options}>
66
66
  {optionNodes}
67
67
  </div>
68
68
  </div>
@@ -26,7 +26,7 @@
26
26
  cursor: default;
27
27
  }
28
28
 
29
- &.switch {
29
+ &.options {
30
30
  align-items: center;
31
31
  background: whitesmoke;
32
32
  border: 1px solid gray;
@@ -23,8 +23,11 @@ export function requireWeak(
23
23
  if (!def) return named;
24
24
 
25
25
  Object.entries(named).forEach(([key, value]) => {
26
- if (def[key]) throw Error('Conflict between default and named exports');
27
- def[key] = value;
26
+ if (def[key]) {
27
+ if (def[key] !== value) {
28
+ throw Error('Conflict between default and named exports');
29
+ }
30
+ } else def[key] = value;
28
31
  });
29
32
  return def;
30
33
  } catch {