gatsby-theme-q3 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.3.0](https://github.com/3merge/q/compare/v2.2.2...v2.3.0) (2021-12-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * theme for prevent unstyled load ([#361](https://github.com/3merge/q/issues/361)) ([a1f1535](https://github.com/3merge/q/commit/a1f15358262b40829d3e1312864a1c0d08c778dc))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.2.2](https://github.com/3merge/q/compare/v2.2.1...v2.2.2) (2021-12-09)
7
18
 
8
19
  **Note:** Version bump only for package gatsby-theme-q3
package/gatsby-config.js CHANGED
@@ -12,12 +12,14 @@ module.exports = ({
12
12
  brandingColor,
13
13
  icon,
14
14
  netlify,
15
+ theme,
15
16
  }) => {
16
17
  const plugins = [
17
18
  {
18
- resolve: require.resolve(
19
- './src/plugins/gatsby-local-top-layout',
20
- ),
19
+ resolve: 'gatsby-theme-q3-mui',
20
+ options: {
21
+ theme,
22
+ },
21
23
  },
22
24
  'gatsby-plugin-material-ui',
23
25
  'gatsby-plugin-force-trailing-slashes',
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _q3UiLocale = require("q3-ui-locale");
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const registeri18ResourceBundles = contentData => {
15
+ if (!contentData || !('en' in contentData)) return;
16
+ Object.entries(contentData).forEach(([key, bundle]) => {
17
+ Object.entries(bundle).forEach(([namespace, data]) => {
18
+ _q3UiLocale.i18n.addResourceBundle(key, namespace, data, true, true);
19
+ });
20
+ });
21
+ };
22
+
23
+ const LocaleBundles = ({
24
+ children,
25
+ locale
26
+ }) => {
27
+ registeri18ResourceBundles(locale);
28
+ return children;
29
+ };
30
+
31
+ LocaleBundles.defaultProps = {
32
+ children: null,
33
+ locale: {}
34
+ };
35
+ LocaleBundles.propTypes = {
36
+ // eslint-disable-next-line
37
+ children: _propTypes.default.any,
38
+ // eslint-disable-next-line
39
+ locale: _propTypes.default.object
40
+ };
41
+ var _default = LocaleBundles;
42
+ exports.default = _default;
@@ -15,6 +15,8 @@ var _q3UiForms = _interopRequireDefault(require("q3-ui-forms"));
15
15
 
16
16
  var _q3UiPermissions = _interopRequireDefault(require("q3-ui-permissions"));
17
17
 
18
+ var _LocaleBundles = _interopRequireDefault(require("./LocaleBundles"));
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  /* eslint-disable import/no-extraneous-dependencies */
@@ -24,13 +26,16 @@ const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://
24
26
  };
25
27
 
26
28
  const Wrapper = ({
29
+ baseURL,
27
30
  children,
28
- baseURL
31
+ locale
29
32
  }) => {
30
33
  setBaseUrlForRest(baseURL);
31
- return /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
34
+ return /*#__PURE__*/_react.default.createElement(_LocaleBundles.default, {
35
+ locale: locale
36
+ }, /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
32
37
  preventDuplicate: true
33
- }, children));
38
+ }, children)));
34
39
  };
35
40
 
36
41
  Wrapper.defaultProps = {
@@ -38,7 +43,9 @@ Wrapper.defaultProps = {
38
43
  };
39
44
  Wrapper.propTypes = {
40
45
  baseURL: _propTypes.default.string,
41
- children: _propTypes.default.node.isRequired
46
+ children: _propTypes.default.node.isRequired,
47
+ // eslint-disable-next-line
48
+ locale: _propTypes.default.object.isRequired
42
49
  };
43
50
  var _default = Wrapper;
44
51
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-theme-q3",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
@@ -29,15 +29,17 @@
29
29
  "gatsby-plugin-sharp": "^4.2.0",
30
30
  "gatsby-plugin-sitemap": "^5.2.0",
31
31
  "gatsby-source-contentful": "^7.0.0",
32
+ "gatsby-theme-q3-mui": "^2.3.0",
32
33
  "gatsby-transformer-sharp": "^4.2.0",
33
34
  "lodash": "^4.17.20",
34
35
  "process": "^0.11.10",
35
36
  "prop-types": "^15.7.2",
37
+ "q3-ui-locale": "^2.2.2",
36
38
  "query-string": "^7.0.1",
37
39
  "react-share": "^4.3.1",
38
40
  "slugify": "^1.6.3",
39
41
  "transform-loader": "^0.2.4",
40
42
  "yarn": "^1.22.17"
41
43
  },
42
- "gitHead": "57057a3cc44effedb0abd4635d3aee6f1eaf866c"
44
+ "gitHead": "4faefb196bc5f15db568e7ca0df98e7f108e4c25"
43
45
  }
@@ -0,0 +1,37 @@
1
+ import { i18n } from 'q3-ui-locale';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const registeri18ResourceBundles = (contentData) => {
5
+ if (!contentData || !('en' in contentData)) return;
6
+
7
+ Object.entries(contentData).forEach(([key, bundle]) => {
8
+ Object.entries(bundle).forEach(([namespace, data]) => {
9
+ i18n.addResourceBundle(
10
+ key,
11
+ namespace,
12
+ data,
13
+ true,
14
+ true,
15
+ );
16
+ });
17
+ });
18
+ };
19
+
20
+ const LocaleBundles = ({ children, locale }) => {
21
+ registeri18ResourceBundles(locale);
22
+ return children;
23
+ };
24
+
25
+ LocaleBundles.defaultProps = {
26
+ children: null,
27
+ locale: {},
28
+ };
29
+
30
+ LocaleBundles.propTypes = {
31
+ // eslint-disable-next-line
32
+ children: PropTypes.any,
33
+ // eslint-disable-next-line
34
+ locale: PropTypes.object,
35
+ };
36
+
37
+ export default LocaleBundles;
@@ -4,6 +4,7 @@ import axios from 'axios';
4
4
  import PropTypes from 'prop-types';
5
5
  import FormProviders from 'q3-ui-forms';
6
6
  import AuthProvider from 'q3-ui-permissions';
7
+ import LocaleBundles from './LocaleBundles';
7
8
 
8
9
  const setBaseUrlForRest = (
9
10
  baseURL = process.env.GATSBY_APP_BASE_URL ||
@@ -13,15 +14,17 @@ const setBaseUrlForRest = (
13
14
  return axios.defaults;
14
15
  };
15
16
 
16
- const Wrapper = ({ children, baseURL }) => {
17
+ const Wrapper = ({ baseURL, children, locale }) => {
17
18
  setBaseUrlForRest(baseURL);
18
19
 
19
20
  return (
20
- <AuthProvider>
21
- <FormProviders preventDuplicate>
22
- {children}
23
- </FormProviders>
24
- </AuthProvider>
21
+ <LocaleBundles locale={locale}>
22
+ <AuthProvider>
23
+ <FormProviders preventDuplicate>
24
+ {children}
25
+ </FormProviders>
26
+ </AuthProvider>
27
+ </LocaleBundles>
25
28
  );
26
29
  };
27
30
 
@@ -32,6 +35,9 @@ Wrapper.defaultProps = {
32
35
  Wrapper.propTypes = {
33
36
  baseURL: PropTypes.string,
34
37
  children: PropTypes.node.isRequired,
38
+
39
+ // eslint-disable-next-line
40
+ locale: PropTypes.object.isRequired,
35
41
  };
36
42
 
37
43
  export default Wrapper;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "wrapRootElement", {
7
- enumerable: true,
8
- get: function () {
9
- return _gatsbySsr.wrapRootElement;
10
- }
11
- });
12
-
13
- var _gatsbySsr = require("./gatsby-ssr");
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.wrapRootElement = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _q3Ui = _interopRequireDefault(require("q3-ui"));
11
-
12
- var _q3UiLocale = require("q3-ui-locale");
13
-
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- /* eslint-disable import/prefer-default-export, import/no-extraneous-dependencies, react/prop-types, react/jsx-filename-extension */
19
- const registeri18ResourceBundles = contentData => {
20
- if (!contentData || !('en' in contentData)) return;
21
- Object.entries(contentData).forEach(([key, bundle]) => {
22
- Object.entries(bundle).forEach(([namespace, data]) => {
23
- _q3UiLocale.i18n.addResourceBundle(key, namespace, data, true, true);
24
- });
25
- });
26
- };
27
-
28
- const LocaleBundles = ({
29
- children,
30
- locale
31
- }) => {
32
- registeri18ResourceBundles(locale);
33
- return children;
34
- };
35
-
36
- LocaleBundles.defaultProps = {
37
- children: null,
38
- locale: {}
39
- };
40
- LocaleBundles.propTypes = {
41
- // eslint-disable-next-line
42
- children: _propTypes.default.any,
43
- // eslint-disable-next-line
44
- locale: _propTypes.default.object
45
- };
46
-
47
- const Wrapper = ({
48
- children,
49
- locale,
50
- ...providerProps
51
- }) => /*#__PURE__*/_react.default.createElement(_q3Ui.default, providerProps, /*#__PURE__*/_react.default.createElement(LocaleBundles, {
52
- locale: locale
53
- }, children));
54
-
55
- Wrapper.propTypes = {
56
- children: _propTypes.default.node.isRequired,
57
- // eslint-disable-next-line
58
- locale: _propTypes.default.object.isRequired,
59
- // eslint-disable-next-line
60
- theme: _propTypes.default.object.isRequired
61
- };
62
-
63
- const wrapRootElement = ({
64
- element
65
- }, {
66
- locale,
67
- ...providerProps
68
- }) => /*#__PURE__*/_react.default.createElement(_q3Ui.default, providerProps, /*#__PURE__*/_react.default.createElement(LocaleBundles, {
69
- locale: locale
70
- }, element));
71
-
72
- exports.wrapRootElement = wrapRootElement;
@@ -1,2 +0,0 @@
1
- // noop
2
- "use strict";
@@ -1,5 +0,0 @@
1
- {
2
- "name": "gatsby-local-top-layout",
3
- "private": true,
4
- "main": "index.js"
5
- }
@@ -1 +0,0 @@
1
- export { wrapRootElement } from './gatsby-ssr';
@@ -1,67 +0,0 @@
1
- /* eslint-disable import/prefer-default-export, import/no-extraneous-dependencies, react/prop-types, react/jsx-filename-extension */
2
- import React from 'react';
3
- import Provider from 'q3-ui';
4
- import { i18n } from 'q3-ui-locale';
5
- import PropTypes from 'prop-types';
6
-
7
- const registeri18ResourceBundles = (contentData) => {
8
- if (!contentData || !('en' in contentData)) return;
9
-
10
- Object.entries(contentData).forEach(([key, bundle]) => {
11
- Object.entries(bundle).forEach(([namespace, data]) => {
12
- i18n.addResourceBundle(
13
- key,
14
- namespace,
15
- data,
16
- true,
17
- true,
18
- );
19
- });
20
- });
21
- };
22
-
23
- const LocaleBundles = ({ children, locale }) => {
24
- registeri18ResourceBundles(locale);
25
- return children;
26
- };
27
-
28
- LocaleBundles.defaultProps = {
29
- children: null,
30
- locale: {},
31
- };
32
-
33
- LocaleBundles.propTypes = {
34
- // eslint-disable-next-line
35
- children: PropTypes.any,
36
- // eslint-disable-next-line
37
- locale: PropTypes.object,
38
- };
39
-
40
- const Wrapper = ({
41
- children,
42
- locale,
43
- ...providerProps
44
- }) => (
45
- <Provider {...providerProps}>
46
- <LocaleBundles locale={locale}>
47
- {children}
48
- </LocaleBundles>
49
- </Provider>
50
- );
51
-
52
- Wrapper.propTypes = {
53
- children: PropTypes.node.isRequired,
54
- // eslint-disable-next-line
55
- locale: PropTypes.object.isRequired,
56
- // eslint-disable-next-line
57
- theme: PropTypes.object.isRequired,
58
- };
59
-
60
- export const wrapRootElement = (
61
- { element },
62
- { locale, ...providerProps },
63
- ) => (
64
- <Provider {...providerProps}>
65
- <LocaleBundles locale={locale}>{element}</LocaleBundles>
66
- </Provider>
67
- );
@@ -1 +0,0 @@
1
- // noop
@@ -1,5 +0,0 @@
1
- {
2
- "name": "gatsby-local-top-layout",
3
- "private": true,
4
- "main": "index.js"
5
- }