gatsby-theme-q3 2.1.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/gatsby-config.js +12 -1
- package/lib/components/Wrapper.js +5 -45
- package/lib/plugins/gatsby-local-top-layout/gatsby-browser.js +13 -0
- package/lib/plugins/gatsby-local-top-layout/gatsby-ssr.js +72 -0
- package/lib/plugins/gatsby-local-top-layout/index.js +2 -0
- package/lib/plugins/gatsby-local-top-layout/package.json +5 -0
- package/package.json +2 -2
- package/src/components/Wrapper.jsx +7 -57
- package/src/plugins/gatsby-local-top-layout/gatsby-browser.js +1 -0
- package/src/plugins/gatsby-local-top-layout/gatsby-ssr.js +67 -0
- package/src/plugins/gatsby-local-top-layout/index.js +1 -0
- package/src/plugins/gatsby-local-top-layout/package.json +5 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
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.2.2](https://github.com/3merge/q/compare/v2.2.1...v2.2.2) (2021-12-09)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package gatsby-theme-q3
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
6
14
|
## [2.1.1](https://github.com/3merge/q/compare/v2.1.0...v2.1.1) (2021-11-29)
|
7
15
|
|
8
16
|
|
package/gatsby-config.js
CHANGED
@@ -14,10 +14,21 @@ module.exports = ({
|
|
14
14
|
netlify,
|
15
15
|
}) => {
|
16
16
|
const plugins = [
|
17
|
+
{
|
18
|
+
resolve: require.resolve(
|
19
|
+
'./src/plugins/gatsby-local-top-layout',
|
20
|
+
),
|
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',
|
@@ -7,12 +7,8 @@ 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"));
|
@@ -21,52 +17,20 @@ var _q3UiPermissions = _interopRequireDefault(require("q3-ui-permissions"));
|
|
21
17
|
|
22
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
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
|
-
};
|
33
|
-
|
20
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
34
21
|
const setBaseUrlForRest = (baseURL = process.env.GATSBY_APP_BASE_URL || 'http://localhost:9000') => {
|
35
22
|
_axios.default.defaults.baseURL = baseURL;
|
36
23
|
return _axios.default.defaults;
|
37
24
|
};
|
38
25
|
|
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
26
|
const Wrapper = ({
|
59
27
|
children,
|
60
|
-
baseURL
|
61
|
-
locale,
|
62
|
-
...providerProps
|
28
|
+
baseURL
|
63
29
|
}) => {
|
64
30
|
setBaseUrlForRest(baseURL);
|
65
|
-
return /*#__PURE__*/_react.default.createElement(
|
66
|
-
locale: locale
|
67
|
-
}, /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_q3UiPermissions.default, null, /*#__PURE__*/_react.default.createElement(_q3UiForms.default, {
|
68
32
|
preventDuplicate: true
|
69
|
-
}, children))
|
33
|
+
}, children));
|
70
34
|
};
|
71
35
|
|
72
36
|
Wrapper.defaultProps = {
|
@@ -74,11 +38,7 @@ Wrapper.defaultProps = {
|
|
74
38
|
};
|
75
39
|
Wrapper.propTypes = {
|
76
40
|
baseURL: _propTypes.default.string,
|
77
|
-
children: _propTypes.default.node.isRequired
|
78
|
-
// eslint-disable-next-line
|
79
|
-
locale: _propTypes.default.object.isRequired,
|
80
|
-
// eslint-disable-next-line
|
81
|
-
theme: _propTypes.default.object.isRequired
|
41
|
+
children: _propTypes.default.node.isRequired
|
82
42
|
};
|
83
43
|
var _default = Wrapper;
|
84
44
|
exports.default = _default;
|
@@ -0,0 +1,13 @@
|
|
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");
|
@@ -0,0 +1,72 @@
|
|
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;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-theme-q3",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.2",
|
4
4
|
"main": "index.js",
|
5
5
|
"license": "MIT",
|
6
6
|
"peerDependencies": {
|
@@ -39,5 +39,5 @@
|
|
39
39
|
"transform-loader": "^0.2.4",
|
40
40
|
"yarn": "^1.22.17"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "57057a3cc44effedb0abd4635d3aee6f1eaf866c"
|
43
43
|
}
|
@@ -1,28 +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
7
|
|
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
|
-
};
|
25
|
-
|
26
8
|
const setBaseUrlForRest = (
|
27
9
|
baseURL = process.env.GATSBY_APP_BASE_URL ||
|
28
10
|
'http://localhost:9000',
|
@@ -31,41 +13,15 @@ const setBaseUrlForRest = (
|
|
31
13
|
return axios.defaults;
|
32
14
|
};
|
33
15
|
|
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
|
-
}) => {
|
16
|
+
const Wrapper = ({ children, baseURL }) => {
|
57
17
|
setBaseUrlForRest(baseURL);
|
58
18
|
|
59
19
|
return (
|
60
|
-
<
|
61
|
-
<
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
</FormProviders>
|
66
|
-
</AuthProvider>
|
67
|
-
</LocaleBundles>
|
68
|
-
</Provider>
|
20
|
+
<AuthProvider>
|
21
|
+
<FormProviders preventDuplicate>
|
22
|
+
{children}
|
23
|
+
</FormProviders>
|
24
|
+
</AuthProvider>
|
69
25
|
);
|
70
26
|
};
|
71
27
|
|
@@ -76,12 +32,6 @@ Wrapper.defaultProps = {
|
|
76
32
|
Wrapper.propTypes = {
|
77
33
|
baseURL: PropTypes.string,
|
78
34
|
children: PropTypes.node.isRequired,
|
79
|
-
|
80
|
-
// eslint-disable-next-line
|
81
|
-
locale: PropTypes.object.isRequired,
|
82
|
-
|
83
|
-
// eslint-disable-next-line
|
84
|
-
theme: PropTypes.object.isRequired,
|
85
35
|
};
|
86
36
|
|
87
37
|
export default Wrapper;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { wrapRootElement } from './gatsby-ssr';
|
@@ -0,0 +1,67 @@
|
|
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
|
+
);
|
@@ -0,0 +1 @@
|
|
1
|
+
// noop
|