@digigov/nextjs 0.6.3 → 0.6.4
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/App.js +12 -0
- package/CHANGELOG.md +9 -1
- package/Document.js +5 -47
- package/es/App.js +12 -0
- package/es/Document.js +5 -45
- package/esm/App.js +12 -0
- package/esm/Document.js +5 -45
- package/esm/index.js +1 -1
- package/package.json +4 -4
package/App.js
CHANGED
|
@@ -75,6 +75,18 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
|
|
|
75
75
|
if (jssStyles && jssStyles.parentElement) {
|
|
76
76
|
jssStyles.parentElement.removeChild(jssStyles);
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
this.updateHtmlLang();
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "componentDidUpdate",
|
|
83
|
+
value: function componentDidUpdate() {
|
|
84
|
+
this.updateHtmlLang();
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "updateHtmlLang",
|
|
88
|
+
value: function updateHtmlLang() {
|
|
89
|
+
document.documentElement.lang = this.props.i18n.language;
|
|
78
90
|
}
|
|
79
91
|
}, {
|
|
80
92
|
key: "render",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Change Log - @digigov/nextjs
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue, 27 Sep 2022
|
|
3
|
+
This log was last generated on Tue, 27 Sep 2022 14:49:37 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.6.4
|
|
6
|
+
Tue, 27 Sep 2022 14:49:37 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- add default lang to html tag in DOM
|
|
11
|
+
- specify the peerDependencies range in a better way
|
|
4
12
|
|
|
5
13
|
## 0.6.3
|
|
6
14
|
Tue, 27 Sep 2022 10:00:49 GMT
|
package/Document.js
CHANGED
|
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
exports.Fonts = Fonts;
|
|
11
11
|
exports["default"] = void 0;
|
|
12
12
|
|
|
13
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
|
-
|
|
15
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
14
|
|
|
17
15
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -30,8 +28,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
30
28
|
|
|
31
29
|
var _document = _interopRequireWildcard(require("next/document"));
|
|
32
30
|
|
|
33
|
-
var _styles = require("@material-ui/core/styles");
|
|
34
|
-
|
|
35
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
36
32
|
|
|
37
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -88,57 +84,19 @@ exports["default"] = DigiGOVDocument;
|
|
|
88
84
|
|
|
89
85
|
DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
|
|
90
86
|
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
|
|
91
|
-
var
|
|
87
|
+
var initialProps;
|
|
92
88
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
93
89
|
while (1) {
|
|
94
90
|
switch (_context.prev = _context.next) {
|
|
95
91
|
case 0:
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
// On the server:
|
|
99
|
-
// 1. app.getInitialProps
|
|
100
|
-
// 2. page.getInitialProps
|
|
101
|
-
// 3. document.getInitialProps
|
|
102
|
-
// 4. app.render
|
|
103
|
-
// 5. page.render
|
|
104
|
-
// 6. document.render
|
|
105
|
-
//
|
|
106
|
-
// On the server with error:
|
|
107
|
-
// 1. document.getInitialProps
|
|
108
|
-
// 2. app.render
|
|
109
|
-
// 3. page.render
|
|
110
|
-
// 4. document.render
|
|
111
|
-
//
|
|
112
|
-
// On the client
|
|
113
|
-
// 1. app.getInitialProps
|
|
114
|
-
// 2. page.getInitialProps
|
|
115
|
-
// 3. app.render
|
|
116
|
-
// 4. page.render
|
|
117
|
-
// Render app and page and get the context of the page with collected side effects.
|
|
118
|
-
sheets = new _styles.ServerStyleSheets();
|
|
119
|
-
originalRenderPage = ctx.renderPage;
|
|
120
|
-
|
|
121
|
-
ctx.renderPage = function () {
|
|
122
|
-
return originalRenderPage({
|
|
123
|
-
enhanceApp: function enhanceApp(App) {
|
|
124
|
-
return function (props) {
|
|
125
|
-
return sheets.collect( /*#__PURE__*/_react["default"].createElement(App, props));
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
_context.next = 5;
|
|
92
|
+
_context.next = 2;
|
|
132
93
|
return _document["default"].getInitialProps(ctx);
|
|
133
94
|
|
|
134
|
-
case
|
|
95
|
+
case 2:
|
|
135
96
|
initialProps = _context.sent;
|
|
136
|
-
return _context.abrupt("return", (0, _extends2["default"])({}, initialProps
|
|
137
|
-
// Styles fragment is rendered after the app and page rendering finish.
|
|
138
|
-
styles: [].concat((0, _toConsumableArray2["default"])(_react["default"].Children.toArray(initialProps.styles)), [sheets.getStyleElement()])
|
|
139
|
-
}));
|
|
97
|
+
return _context.abrupt("return", (0, _extends2["default"])({}, initialProps));
|
|
140
98
|
|
|
141
|
-
case
|
|
99
|
+
case 4:
|
|
142
100
|
case "end":
|
|
143
101
|
return _context.stop();
|
|
144
102
|
}
|
package/es/App.js
CHANGED
|
@@ -47,6 +47,18 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
|
|
|
47
47
|
if (jssStyles && jssStyles.parentElement) {
|
|
48
48
|
jssStyles.parentElement.removeChild(jssStyles);
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
this.updateHtmlLang();
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "componentDidUpdate",
|
|
55
|
+
value: function componentDidUpdate() {
|
|
56
|
+
this.updateHtmlLang();
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "updateHtmlLang",
|
|
60
|
+
value: function updateHtmlLang() {
|
|
61
|
+
document.documentElement.lang = this.props.i18n.language;
|
|
50
62
|
}
|
|
51
63
|
}, {
|
|
52
64
|
key: "render",
|
package/es/Document.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
@@ -17,7 +16,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
17
16
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
18
17
|
import React from 'react';
|
|
19
18
|
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
20
|
-
import { ServerStyleSheets } from '@material-ui/core/styles';
|
|
21
19
|
|
|
22
20
|
var _ref = /*#__PURE__*/React.createElement("link", {
|
|
23
21
|
rel: "stylesheet",
|
|
@@ -67,57 +65,19 @@ export { DigiGOVDocument as default };
|
|
|
67
65
|
|
|
68
66
|
DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
|
|
69
67
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
|
|
70
|
-
var
|
|
68
|
+
var initialProps;
|
|
71
69
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72
70
|
while (1) {
|
|
73
71
|
switch (_context.prev = _context.next) {
|
|
74
72
|
case 0:
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
// On the server:
|
|
78
|
-
// 1. app.getInitialProps
|
|
79
|
-
// 2. page.getInitialProps
|
|
80
|
-
// 3. document.getInitialProps
|
|
81
|
-
// 4. app.render
|
|
82
|
-
// 5. page.render
|
|
83
|
-
// 6. document.render
|
|
84
|
-
//
|
|
85
|
-
// On the server with error:
|
|
86
|
-
// 1. document.getInitialProps
|
|
87
|
-
// 2. app.render
|
|
88
|
-
// 3. page.render
|
|
89
|
-
// 4. document.render
|
|
90
|
-
//
|
|
91
|
-
// On the client
|
|
92
|
-
// 1. app.getInitialProps
|
|
93
|
-
// 2. page.getInitialProps
|
|
94
|
-
// 3. app.render
|
|
95
|
-
// 4. page.render
|
|
96
|
-
// Render app and page and get the context of the page with collected side effects.
|
|
97
|
-
sheets = new ServerStyleSheets();
|
|
98
|
-
originalRenderPage = ctx.renderPage;
|
|
99
|
-
|
|
100
|
-
ctx.renderPage = function () {
|
|
101
|
-
return originalRenderPage({
|
|
102
|
-
enhanceApp: function enhanceApp(App) {
|
|
103
|
-
return function (props) {
|
|
104
|
-
return sheets.collect( /*#__PURE__*/React.createElement(App, props));
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
_context.next = 5;
|
|
73
|
+
_context.next = 2;
|
|
111
74
|
return Document.getInitialProps(ctx);
|
|
112
75
|
|
|
113
|
-
case
|
|
76
|
+
case 2:
|
|
114
77
|
initialProps = _context.sent;
|
|
115
|
-
return _context.abrupt("return", _extends({}, initialProps
|
|
116
|
-
// Styles fragment is rendered after the app and page rendering finish.
|
|
117
|
-
styles: [].concat(_toConsumableArray(React.Children.toArray(initialProps.styles)), [sheets.getStyleElement()])
|
|
118
|
-
}));
|
|
78
|
+
return _context.abrupt("return", _extends({}, initialProps));
|
|
119
79
|
|
|
120
|
-
case
|
|
80
|
+
case 4:
|
|
121
81
|
case "end":
|
|
122
82
|
return _context.stop();
|
|
123
83
|
}
|
package/esm/App.js
CHANGED
|
@@ -47,6 +47,18 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
|
|
|
47
47
|
if (jssStyles && jssStyles.parentElement) {
|
|
48
48
|
jssStyles.parentElement.removeChild(jssStyles);
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
this.updateHtmlLang();
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "componentDidUpdate",
|
|
55
|
+
value: function componentDidUpdate() {
|
|
56
|
+
this.updateHtmlLang();
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "updateHtmlLang",
|
|
60
|
+
value: function updateHtmlLang() {
|
|
61
|
+
document.documentElement.lang = this.props.i18n.language;
|
|
50
62
|
}
|
|
51
63
|
}, {
|
|
52
64
|
key: "render",
|
package/esm/Document.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
@@ -17,7 +16,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
17
16
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
18
17
|
import React from 'react';
|
|
19
18
|
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
20
|
-
import { ServerStyleSheets } from '@material-ui/core/styles';
|
|
21
19
|
|
|
22
20
|
var _ref = /*#__PURE__*/React.createElement("link", {
|
|
23
21
|
rel: "stylesheet",
|
|
@@ -67,57 +65,19 @@ export { DigiGOVDocument as default };
|
|
|
67
65
|
|
|
68
66
|
DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
|
|
69
67
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
|
|
70
|
-
var
|
|
68
|
+
var initialProps;
|
|
71
69
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72
70
|
while (1) {
|
|
73
71
|
switch (_context.prev = _context.next) {
|
|
74
72
|
case 0:
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
// On the server:
|
|
78
|
-
// 1. app.getInitialProps
|
|
79
|
-
// 2. page.getInitialProps
|
|
80
|
-
// 3. document.getInitialProps
|
|
81
|
-
// 4. app.render
|
|
82
|
-
// 5. page.render
|
|
83
|
-
// 6. document.render
|
|
84
|
-
//
|
|
85
|
-
// On the server with error:
|
|
86
|
-
// 1. document.getInitialProps
|
|
87
|
-
// 2. app.render
|
|
88
|
-
// 3. page.render
|
|
89
|
-
// 4. document.render
|
|
90
|
-
//
|
|
91
|
-
// On the client
|
|
92
|
-
// 1. app.getInitialProps
|
|
93
|
-
// 2. page.getInitialProps
|
|
94
|
-
// 3. app.render
|
|
95
|
-
// 4. page.render
|
|
96
|
-
// Render app and page and get the context of the page with collected side effects.
|
|
97
|
-
sheets = new ServerStyleSheets();
|
|
98
|
-
originalRenderPage = ctx.renderPage;
|
|
99
|
-
|
|
100
|
-
ctx.renderPage = function () {
|
|
101
|
-
return originalRenderPage({
|
|
102
|
-
enhanceApp: function enhanceApp(App) {
|
|
103
|
-
return function (props) {
|
|
104
|
-
return sheets.collect( /*#__PURE__*/React.createElement(App, props));
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
_context.next = 5;
|
|
73
|
+
_context.next = 2;
|
|
111
74
|
return Document.getInitialProps(ctx);
|
|
112
75
|
|
|
113
|
-
case
|
|
76
|
+
case 2:
|
|
114
77
|
initialProps = _context.sent;
|
|
115
|
-
return _context.abrupt("return", _extends({}, initialProps
|
|
116
|
-
// Styles fragment is rendered after the app and page rendering finish.
|
|
117
|
-
styles: [].concat(_toConsumableArray(React.Children.toArray(initialProps.styles)), [sheets.getStyleElement()])
|
|
118
|
-
}));
|
|
78
|
+
return _context.abrupt("return", _extends({}, initialProps));
|
|
119
79
|
|
|
120
|
-
case
|
|
80
|
+
case 4:
|
|
121
81
|
case "end":
|
|
122
82
|
return _context.stop();
|
|
123
83
|
}
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/nextjs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "next specific utilities for @digigov apps",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"main": "dist/index.js"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@digigov/ui": "0.26.
|
|
13
|
+
"@digigov/ui": "0.26.6",
|
|
14
14
|
"@material-ui/core": "4.11.3",
|
|
15
15
|
"@material-ui/icons": "4.11.2",
|
|
16
16
|
"clsx": "1.1.1",
|
|
17
17
|
"i18next": "19.1.0",
|
|
18
|
-
"react": "
|
|
19
|
-
"react-dom": "
|
|
18
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
19
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
20
20
|
"next": "10.0.9",
|
|
21
21
|
"react-i18next": "11.3.3"
|
|
22
22
|
},
|