gatsby-theme-q3 2.1.0 → 2.3.1
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/CHANGELOG.md +41 -0
- package/gatsby-config.js +12 -1
- package/gatsby-node.js +1 -0
- package/lib/components/LocaleBundles.js +42 -0
- package/lib/components/Wrapper.js +8 -41
- package/package.json +4 -2
- package/src/components/LocaleBundles.jsx +37 -0
- package/src/components/Wrapper.jsx +10 -54
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,47 @@
|
|
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.1](https://github.com/3merge/q/compare/v2.3.0...v2.3.1) (2021-12-09)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* forward all config ([c4c512d](https://github.com/3merge/q/commit/c4c512da530866327940d56dba3976764cf53293))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [2.3.0](https://github.com/3merge/q/compare/v2.2.2...v2.3.0) (2021-12-09)
|
18
|
+
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
* theme for prevent unstyled load ([#361](https://github.com/3merge/q/issues/361)) ([a1f1535](https://github.com/3merge/q/commit/a1f15358262b40829d3e1312864a1c0d08c778dc))
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## [2.2.2](https://github.com/3merge/q/compare/v2.2.1...v2.2.2) (2021-12-09)
|
29
|
+
|
30
|
+
**Note:** Version bump only for package gatsby-theme-q3
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
## [2.1.1](https://github.com/3merge/q/compare/v2.1.0...v2.1.1) (2021-11-29)
|
37
|
+
|
38
|
+
|
39
|
+
### Bug Fixes
|
40
|
+
|
41
|
+
* webpack util resolve ([60b3713](https://github.com/3merge/q/commit/60b37132309dc0b6167b469ee9849a9585b2466b))
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
6
47
|
# [2.1.0](https://github.com/3merge/q/compare/v1.43.11...v2.1.0) (2021-11-29)
|
7
48
|
|
8
49
|
|
package/gatsby-config.js
CHANGED
@@ -12,12 +12,23 @@ module.exports = ({
|
|
12
12
|
brandingColor,
|
13
13
|
icon,
|
14
14
|
netlify,
|
15
|
+
...options
|
15
16
|
}) => {
|
16
17
|
const plugins = [
|
18
|
+
{
|
19
|
+
resolve: 'gatsby-theme-q3-mui',
|
20
|
+
options,
|
21
|
+
},
|
17
22
|
'gatsby-plugin-material-ui',
|
18
23
|
'gatsby-plugin-force-trailing-slashes',
|
19
24
|
'gatsby-plugin-sitemap',
|
20
|
-
|
25
|
+
{
|
26
|
+
resolve: 'gatsby-transformer-sharp',
|
27
|
+
options: {
|
28
|
+
// The option defaults to true
|
29
|
+
checkSupportedExtensions: true,
|
30
|
+
},
|
31
|
+
},
|
21
32
|
'gatsby-plugin-sharp',
|
22
33
|
{
|
23
34
|
resolve: 'gatsby-plugin-robots-txt',
|
package/gatsby-node.js
CHANGED
@@ -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;
|
@@ -7,66 +7,35 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
10
|
-
var _q3Ui = _interopRequireDefault(require("q3-ui"));
|
11
|
-
|
12
10
|
var _axios = _interopRequireDefault(require("axios"));
|
13
11
|
|
14
|
-
var _q3UiLocale = require("q3-ui-locale");
|
15
|
-
|
16
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
17
13
|
|
18
14
|
var _q3UiForms = _interopRequireDefault(require("q3-ui-forms"));
|
19
15
|
|
20
16
|
var _q3UiPermissions = _interopRequireDefault(require("q3-ui-permissions"));
|
21
17
|
|
22
|
-
|
18
|
+
var _LocaleBundles = _interopRequireDefault(require("./LocaleBundles"));
|
23
19
|
|
24
|
-
|
25
|
-
const registeri18ResourceBundles = contentData => {
|
26
|
-
if (!contentData || !('en' in contentData)) return;
|
27
|
-
Object.entries(contentData).forEach(([key, bundle]) => {
|
28
|
-
Object.entries(bundle).forEach(([namespace, data]) => {
|
29
|
-
_q3UiLocale.i18n.addResourceBundle(key, namespace, data, true, true);
|
30
|
-
});
|
31
|
-
});
|
32
|
-
};
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
21
|
|
22
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
34
23
|
const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://localhost:9000') => {
|
35
24
|
_axios.default.defaults.baseURL = baseURL;
|
36
25
|
return _axios.default.defaults;
|
37
26
|
};
|
38
27
|
|
39
|
-
const LocaleBundles = ({
|
40
|
-
children,
|
41
|
-
locale
|
42
|
-
}) => {
|
43
|
-
registeri18ResourceBundles(locale);
|
44
|
-
return children;
|
45
|
-
};
|
46
|
-
|
47
|
-
LocaleBundles.defaultProps = {
|
48
|
-
children: null,
|
49
|
-
locale: {}
|
50
|
-
};
|
51
|
-
LocaleBundles.propTypes = {
|
52
|
-
// eslint-disable-next-line
|
53
|
-
children: _propTypes.default.any,
|
54
|
-
// eslint-disable-next-line
|
55
|
-
locale: _propTypes.default.object
|
56
|
-
};
|
57
|
-
|
58
28
|
const Wrapper = ({
|
59
|
-
children,
|
60
29
|
baseURL,
|
61
|
-
|
62
|
-
|
30
|
+
children,
|
31
|
+
locale
|
63
32
|
}) => {
|
64
33
|
setBaseUrlForRest(baseURL);
|
65
|
-
return /*#__PURE__*/_react.default.createElement(
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_LocaleBundles.default, {
|
66
35
|
locale: locale
|
67
36
|
}, /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
|
68
37
|
preventDuplicate: true
|
69
|
-
}, children)))
|
38
|
+
}, children)));
|
70
39
|
};
|
71
40
|
|
72
41
|
Wrapper.defaultProps = {
|
@@ -76,9 +45,7 @@ Wrapper.propTypes = {
|
|
76
45
|
baseURL: _propTypes.default.string,
|
77
46
|
children: _propTypes.default.node.isRequired,
|
78
47
|
// eslint-disable-next-line
|
79
|
-
locale: _propTypes.default.object.isRequired
|
80
|
-
// eslint-disable-next-line
|
81
|
-
theme: _propTypes.default.object.isRequired
|
48
|
+
locale: _propTypes.default.object.isRequired
|
82
49
|
};
|
83
50
|
var _default = Wrapper;
|
84
51
|
exports.default = _default;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-theme-q3",
|
3
|
-
"version": "2.1
|
3
|
+
"version": "2.3.1",
|
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": "
|
44
|
+
"gitHead": "a74c290023592a55577622eb3530ab72f19702f1"
|
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;
|
@@ -1,27 +1,10 @@
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
1
2
|
import React from 'react';
|
2
|
-
import Provider from 'q3-ui';
|
3
|
-
// eslint-disable-next-line
|
4
3
|
import axios from 'axios';
|
5
|
-
import { i18n } from 'q3-ui-locale';
|
6
4
|
import PropTypes from 'prop-types';
|
7
5
|
import FormProviders from 'q3-ui-forms';
|
8
6
|
import AuthProvider from 'q3-ui-permissions';
|
9
|
-
|
10
|
-
const registeri18ResourceBundles = (contentData) => {
|
11
|
-
if (!contentData || !('en' in contentData)) return;
|
12
|
-
|
13
|
-
Object.entries(contentData).forEach(([key, bundle]) => {
|
14
|
-
Object.entries(bundle).forEach(([namespace, data]) => {
|
15
|
-
i18n.addResourceBundle(
|
16
|
-
key,
|
17
|
-
namespace,
|
18
|
-
data,
|
19
|
-
true,
|
20
|
-
true,
|
21
|
-
);
|
22
|
-
});
|
23
|
-
});
|
24
|
-
};
|
7
|
+
import LocaleBundles from './LocaleBundles';
|
25
8
|
|
26
9
|
const setBaseUrlForRest = (
|
27
10
|
baseURL = process.env.GATSBY_APP_BASE_URL ||
|
@@ -31,41 +14,17 @@ const setBaseUrlForRest = (
|
|
31
14
|
return axios.defaults;
|
32
15
|
};
|
33
16
|
|
34
|
-
const
|
35
|
-
registeri18ResourceBundles(locale);
|
36
|
-
return children;
|
37
|
-
};
|
38
|
-
|
39
|
-
LocaleBundles.defaultProps = {
|
40
|
-
children: null,
|
41
|
-
locale: {},
|
42
|
-
};
|
43
|
-
|
44
|
-
LocaleBundles.propTypes = {
|
45
|
-
// eslint-disable-next-line
|
46
|
-
children: PropTypes.any,
|
47
|
-
// eslint-disable-next-line
|
48
|
-
locale: PropTypes.object,
|
49
|
-
};
|
50
|
-
|
51
|
-
const Wrapper = ({
|
52
|
-
children,
|
53
|
-
baseURL,
|
54
|
-
locale,
|
55
|
-
...providerProps
|
56
|
-
}) => {
|
17
|
+
const Wrapper = ({ baseURL, children, locale }) => {
|
57
18
|
setBaseUrlForRest(baseURL);
|
58
19
|
|
59
20
|
return (
|
60
|
-
<
|
61
|
-
<
|
62
|
-
<
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
</LocaleBundles>
|
68
|
-
</Provider>
|
21
|
+
<LocaleBundles locale={locale}>
|
22
|
+
<AuthProvider>
|
23
|
+
<FormProviders preventDuplicate>
|
24
|
+
{children}
|
25
|
+
</FormProviders>
|
26
|
+
</AuthProvider>
|
27
|
+
</LocaleBundles>
|
69
28
|
);
|
70
29
|
};
|
71
30
|
|
@@ -79,9 +38,6 @@ Wrapper.propTypes = {
|
|
79
38
|
|
80
39
|
// eslint-disable-next-line
|
81
40
|
locale: PropTypes.object.isRequired,
|
82
|
-
|
83
|
-
// eslint-disable-next-line
|
84
|
-
theme: PropTypes.object.isRequired,
|
85
41
|
};
|
86
42
|
|
87
43
|
export default Wrapper;
|