@digigov/nextjs 0.6.3-alpha → 0.6.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 (54) hide show
  1. package/{dist/App.js → App.js} +0 -0
  2. package/CHANGELOG.md +8 -1
  3. package/{dist/Document.js → Document.js} +0 -0
  4. package/{dist/Image.js → Image.js} +0 -0
  5. package/{dist/LICENSE → LICENSE} +0 -0
  6. package/{dist/Link.js → Link.js} +0 -0
  7. package/{dist/es → es}/App.js +0 -0
  8. package/{dist/es → es}/Document.js +0 -0
  9. package/{dist/es → es}/Image.js +0 -0
  10. package/{dist/es → es}/Link.js +0 -0
  11. package/{dist/es → es}/hooks.js +0 -0
  12. package/{dist/es → es}/i18n.js +0 -0
  13. package/{dist/es → es}/index.js +0 -0
  14. package/{dist/esm → esm}/App.js +0 -0
  15. package/{dist/esm → esm}/Document.js +0 -0
  16. package/{dist/esm → esm}/Image.js +0 -0
  17. package/{dist/esm → esm}/Link.js +0 -0
  18. package/{dist/esm → esm}/hooks.js +0 -0
  19. package/{dist/esm → esm}/i18n.js +0 -0
  20. package/{dist/esm → esm}/index.js +1 -1
  21. package/{dist/hooks.js → hooks.js} +0 -0
  22. package/{dist/i18n.js → i18n.js} +0 -0
  23. package/{dist/index.js → index.js} +0 -0
  24. package/{dist/libs → libs}/nextjs/src/App.d.ts +0 -0
  25. package/{dist/libs → libs}/nextjs/src/Document.d.ts +0 -0
  26. package/{dist/libs → libs}/nextjs/src/Image.d.ts +0 -0
  27. package/{dist/libs → libs}/nextjs/src/Link.d.ts +0 -0
  28. package/{dist/libs → libs}/nextjs/src/hooks.d.ts +0 -0
  29. package/{dist/libs → libs}/nextjs/src/i18n.d.ts +0 -0
  30. package/{dist/libs → libs}/nextjs/src/index.d.ts +0 -0
  31. package/{dist/libs → libs}/ui/src/app/App.d.ts +0 -0
  32. package/{dist/libs → libs}/ui/src/app/i18n.d.ts +0 -0
  33. package/{dist/libs → libs}/ui/src/core/Link/index.d.ts +0 -0
  34. package/{dist/libs → libs}/ui/src/locales/el.d.ts +0 -0
  35. package/{dist/libs-ui → libs-ui}/react-core/src/Base/index.d.ts +0 -0
  36. package/{dist/libs-ui → libs-ui}/react-core/src/Link/index.d.ts +0 -0
  37. package/package.json +25 -38
  38. package/.eslintrc.js +0 -3
  39. package/.prettierrc.js +0 -3
  40. package/.rush/temp/package-deps_build.json +0 -21
  41. package/.rush/temp/shrinkwrap-deps.json +0 -334
  42. package/CHANGELOG.json +0 -918
  43. package/dist/CHANGELOG.md +0 -248
  44. package/dist/README.md +0 -52
  45. package/dist/package.json +0 -26
  46. package/nextjs.build.log +0 -17
  47. package/src/App.tsx +0 -52
  48. package/src/Document.tsx +0 -86
  49. package/src/Image.tsx +0 -10
  50. package/src/Link.tsx +0 -33
  51. package/src/hooks.ts +0 -6
  52. package/src/i18n.tsx +0 -18
  53. package/src/index.ts +0 -0
  54. package/tsconfig.json +0 -14
package/dist/CHANGELOG.md DELETED
@@ -1,248 +0,0 @@
1
- # Change Log - @digigov/nextjs
2
-
3
- This log was last generated on Tue, 06 Sep 2022 08:27:15 GMT and should not be manually modified.
4
-
5
- ## 0.6.2
6
- Tue, 06 Sep 2022 08:27:15 GMT
7
-
8
- ### Patches
9
-
10
- - remove theme material-ui from App.tsx
11
-
12
- ## 0.6.1
13
- Wed, 31 Aug 2022 16:10:12 GMT
14
-
15
- _Version update only_
16
-
17
- ## 0.6.0
18
- Tue, 16 Aug 2022 14:59:01 GMT
19
-
20
- ### Minor changes
21
-
22
- - add new Image wrapper with built-in basePath support
23
-
24
- ## 0.5.4
25
- Wed, 08 Jun 2022 13:32:34 GMT
26
-
27
- ### Patches
28
-
29
- - Fix i18NProvider string interpolation support
30
-
31
- ## 0.5.3
32
- Tue, 17 May 2022 11:04:22 GMT
33
-
34
- _Version update only_
35
-
36
- ## 0.5.2
37
- Mon, 16 May 2022 14:42:45 GMT
38
-
39
- ### Patches
40
-
41
- - Change MIT License to BSD-2-Clause
42
-
43
- ## 0.5.1
44
- Tue, 19 Apr 2022 12:17:34 GMT
45
-
46
- ### Patches
47
-
48
- - Fix a bug where using target=_blank would not open the link at all. Now it opens in a new window using our CoreLink.
49
-
50
- ## 0.5.0
51
- Mon, 18 Apr 2022 13:00:33 GMT
52
-
53
- ### Minor changes
54
-
55
- - Upgrade @types/node version
56
-
57
- ## 0.4.6
58
- Thu, 14 Apr 2022 12:32:51 GMT
59
-
60
- _Version update only_
61
-
62
- ## 0.4.5
63
- Wed, 30 Mar 2022 13:17:56 GMT
64
-
65
- ### Patches
66
-
67
- - incorrect regex pattern was causing build failure
68
-
69
- ## 0.4.4
70
- Wed, 30 Mar 2022 12:28:30 GMT
71
-
72
- ### Patches
73
-
74
- - allow file links to be used with internal Nextjs router
75
-
76
- ## 0.4.2
77
- Thu, 24 Feb 2022 14:51:06 GMT
78
-
79
- _Version update only_
80
-
81
- ## 0.4.1
82
- Wed, 16 Feb 2022 12:49:28 GMT
83
-
84
- _Version update only_
85
-
86
- ## 0.4.0
87
- Mon, 14 Feb 2022 09:56:29 GMT
88
-
89
- ### Minor changes
90
-
91
- - Replace <a> with Link from @digigov/react-core
92
-
93
- ## 0.3.6
94
- Thu, 10 Feb 2022 13:45:56 GMT
95
-
96
- _Version update only_
97
-
98
- ## 0.3.5
99
- Tue, 08 Feb 2022 15:21:11 GMT
100
-
101
- _Version update only_
102
-
103
- ## 0.3.4
104
- Thu, 03 Feb 2022 15:47:05 GMT
105
-
106
- _Version update only_
107
-
108
- ## 0.3.3
109
- Wed, 02 Feb 2022 15:44:29 GMT
110
-
111
- ### Patches
112
-
113
- - fix package.json inconsistencies by running cli-lab verify-and-update-local-package-versions
114
-
115
- ## 0.3.2
116
- Thu, 30 Dec 2021 12:54:03 GMT
117
-
118
- _Version update only_
119
-
120
- ## 0.3.1
121
- Tue, 02 Nov 2021 13:03:39 GMT
122
-
123
- _Version update only_
124
-
125
- ## 0.3.0
126
- Tue, 12 Oct 2021 09:13:08 GMT
127
-
128
- ### Minor changes
129
-
130
- - Warn if browser is IE
131
-
132
- ## 0.2.27
133
- Wed, 22 Sep 2021 10:15:42 GMT
134
-
135
- ### Patches
136
-
137
- - Add missing props to the Link component
138
-
139
- ## 0.2.26
140
- Thu, 12 Aug 2021 08:56:35 GMT
141
-
142
- _Version update only_
143
-
144
- ## 0.2.25
145
- Thu, 12 Aug 2021 06:18:14 GMT
146
-
147
- _Version update only_
148
-
149
- ## 0.2.24
150
- Tue, 03 Aug 2021 12:09:02 GMT
151
-
152
- _Version update only_
153
-
154
- ## 0.2.23
155
- Tue, 03 Aug 2021 10:22:51 GMT
156
-
157
- _Version update only_
158
-
159
- ## 0.2.22
160
- Fri, 30 Jul 2021 13:01:30 GMT
161
-
162
- _Version update only_
163
-
164
- ## 0.2.21
165
- Fri, 30 Jul 2021 11:35:29 GMT
166
-
167
- _Version update only_
168
-
169
- ## 0.2.20
170
- Fri, 30 Jul 2021 10:46:37 GMT
171
-
172
- _Version update only_
173
-
174
- ## 0.2.19
175
- Fri, 30 Jul 2021 08:49:46 GMT
176
-
177
- _Version update only_
178
-
179
- ## 0.2.18
180
- Fri, 30 Jul 2021 07:46:24 GMT
181
-
182
- _Version update only_
183
-
184
- ## 0.2.17
185
- Tue, 27 Jul 2021 10:14:43 GMT
186
-
187
- _Version update only_
188
-
189
- ## 0.2.16
190
- Thu, 15 Jul 2021 11:16:22 GMT
191
-
192
- _Version update only_
193
-
194
- ## 0.2.15
195
- Fri, 09 Jul 2021 08:59:32 GMT
196
-
197
- _Version update only_
198
-
199
- ## 0.2.14
200
- Thu, 08 Jul 2021 15:08:50 GMT
201
-
202
- _Version update only_
203
-
204
- ## 0.2.13
205
- Wed, 30 Jun 2021 12:09:21 GMT
206
-
207
- _Version update only_
208
-
209
- ## 0.2.12
210
- Wed, 23 Jun 2021 13:04:19 GMT
211
-
212
- _Version update only_
213
-
214
- ## 0.2.11
215
- Wed, 02 Jun 2021 12:04:27 GMT
216
-
217
- _Version update only_
218
-
219
- ## 0.2.10
220
- Wed, 02 Jun 2021 08:33:44 GMT
221
-
222
- _Version update only_
223
-
224
- ## 0.2.9
225
- Wed, 05 May 2021 14:11:41 GMT
226
-
227
- _Version update only_
228
-
229
- ## 0.2.8
230
- Thu, 22 Apr 2021 15:04:42 GMT
231
-
232
- _Version update only_
233
-
234
- ## 0.2.7
235
- Thu, 22 Apr 2021 14:39:18 GMT
236
-
237
- _Version update only_
238
-
239
- ## 0.2.6
240
- Thu, 22 Apr 2021 14:06:40 GMT
241
-
242
- _Version update only_
243
-
244
- ## 0.2.5
245
- Thu, 22 Apr 2021 12:56:25 GMT
246
-
247
- _Initial release_
248
-
package/dist/README.md DELETED
@@ -1,52 +0,0 @@
1
- # @digigov/nextjs
2
-
3
- Next.js utilities for @digigov projects.
4
-
5
- Included,
6
-
7
- * common `_app` and `_document` components with support for,
8
- - SSR style handling.
9
- - `@digigov/ui/app/App` component.
10
- - use `@digigov/ui/core/Link/LinkProvider` to set `next/Link` as the default
11
- Link component across app.
12
-
13
- * react-i18next initializer
14
-
15
-
16
- ## Usage
17
-
18
- ```shell
19
- $ yarn add @digigov/nextjs
20
- ```
21
-
22
- Create `_app` and `_document` components,
23
-
24
- **pages/_app.js**
25
-
26
- ```js
27
- import initI18n from '@digigov/nextjs/i18n';
28
- import el from '../locales/el';
29
- initI18n({
30
- el: {
31
- translation: el
32
- }
33
- });
34
-
35
- import App from '@digigov/nextjs/App';
36
- export default App;
37
- ```
38
-
39
- **pages/_document.js**
40
- ```js
41
- import Document from '@digigov/nextjs/Document';
42
- export default Document;
43
- ```
44
-
45
-
46
- ## Drawbacks
47
-
48
- `next.js` spawns two transpilation processes for SSR and client code using
49
- different configuration options. `_app`, `_doc` are provided as raw `.tsx`
50
- modules to prevent transpilation conflicts. You need to modify `next.js`
51
- webpack configuration to include `@digigov/nextjs` components as though they
52
- where located in locally in your project.
package/dist/package.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "name": "@digigov/nextjs",
3
- "version": "0.6.2",
4
- "description": "next specific utilities for @digigov apps",
5
- "author": "GRNET Developers <devs@lists.grnet.gr>",
6
- "license": "BSD-2-Clause",
7
- "main": "./index.js",
8
- "module": "./esm/index.js",
9
- "publishConfig": {
10
- "main": "dist/index.js"
11
- },
12
- "peerDependencies": {
13
- "@digigov/ui": "0.26.4",
14
- "@material-ui/core": "4.11.3",
15
- "@material-ui/icons": "4.11.2",
16
- "clsx": "1.1.1",
17
- "i18next": "19.1.0",
18
- "react": ">= 16.14.0 <= 18.2.0",
19
- "react-dom": ">= 16.14.0 <= 18.2.0",
20
- "next": "10.0.9",
21
- "react-i18next": "11.3.3"
22
- },
23
- "gitHead": "7237a2d58c6b30979837579e51251543aff0c240",
24
- "private": false,
25
- "typings": "./index.d.ts"
26
- }
package/nextjs.build.log DELETED
@@ -1,17 +0,0 @@
1
- Invoking: digigov build --subpackages
2
-
3
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/rimraf dist
4
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/tsc --emitDeclarationOnly --outDir dist
5
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/babel --config-file /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/babel.config.js src --extensions .tsx,.ts,.js,.jsx --copy-files --out-dir dist/esm
6
- Successfully compiled 7 files with Babel (2276ms).
7
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/babel --config-file /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/babel.config.js src --extensions .tsx,.ts,.js,.jsx --copy-files --out-dir dist/es
8
- Successfully compiled 7 files with Babel (1864ms).
9
- Created package.json in /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/package.json
10
- Copied /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/CHANGELOG.md to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/CHANGELOG.md
11
- Copied /Users/dimitristsironis/grnet/digigov-sdk/LICENSE to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/LICENSE
12
- Copied /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/README.md to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/README.md
13
- Skipped license for ./index.js
14
- Skipped license for ./umd/digigov-ui.production.min.js
15
- Skipped license for ./umd/digigov-ui.development.js
16
- Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/babel --config-file /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/babel.config.js src --extensions .tsx,.ts,.js,.jsx --copy-files --out-dir dist
17
- Successfully compiled 7 files with Babel (1560ms).
package/src/App.tsx DELETED
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import App from 'next/app';
3
- import Head from 'next/head';
4
- import { LinkProvider } from '@digigov/ui/core/Link';
5
- import NextLink from '@digigov/nextjs/Link';
6
- import dynamic from 'next/dynamic';
7
- import type { AppProps } from '@digigov/ui/app/App';
8
- import { I18NProvider } from '@digigov/ui/app/i18n';
9
- import { withTranslation, WithTranslation } from 'react-i18next';
10
- import { i18n } from 'i18next';
11
-
12
- const DigiGOVApp = dynamic(() => import('@digigov/ui/app/App'), {
13
- ssr: false,
14
- }) as React.FC<AppProps>;
15
- export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
16
- children?: React.ReactNode;
17
- t: (string) => string;
18
- i18n: i18n;
19
- }
20
- class DigiGOVNextApp extends App<DigiGOVNextAppProps> {
21
- componentDidMount(): void {
22
- // Remove the server-side injected CSS.
23
- const jssStyles = document.querySelector('#jss-server-side');
24
- if (jssStyles && jssStyles.parentElement) {
25
- jssStyles.parentElement.removeChild(jssStyles);
26
- }
27
- }
28
-
29
- render(): React.ReactElement {
30
- const { Component, pageProps, t, i18n } = this.props;
31
- return (
32
- <I18NProvider
33
- t={(str) => (typeof str === 'string' ? t(str) : str)}
34
- i18n={i18n}
35
- >
36
- <LinkProvider component={NextLink}>
37
- <Head>
38
- <meta
39
- name="viewport"
40
- content="minimum-scale=1, initial-scale=1, width=device-width"
41
- />
42
- </Head>
43
- <DigiGOVApp>
44
- <Component {...pageProps} />
45
- </DigiGOVApp>
46
- </LinkProvider>
47
- </I18NProvider>
48
- );
49
- }
50
- }
51
- const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
52
- export default DigiGOVNextAppWithTranslation;
package/src/Document.tsx DELETED
@@ -1,86 +0,0 @@
1
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
- import React from 'react';
3
- import Document, { Html, Head, Main, NextScript } from 'next/document';
4
- import { ServerStyleSheets } from '@material-ui/core/styles';
5
-
6
- export function Fonts() {
7
- return (
8
- <>
9
- <link
10
- rel="stylesheet"
11
- href="https://fonts.googleapis.com/icon?family=Material+Icons"
12
- />
13
- <link
14
- rel="stylesheet"
15
- href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
16
- />
17
- </>
18
- );
19
- }
20
- export default class DigiGOVDocument extends Document {
21
- render() {
22
- return (
23
- <Html>
24
- <Head>
25
- <script
26
- type="text/javascript"
27
- dangerouslySetInnerHTML={{
28
- __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
29
- `,
30
- }}
31
- ></script>
32
- {/* PWA primary color */}
33
- <Fonts />
34
- </Head>
35
- <body>
36
- <Main />
37
- <NextScript />
38
- </body>
39
- </Html>
40
- );
41
- }
42
- }
43
-
44
- DigiGOVDocument.getInitialProps = async (ctx) => {
45
- // Resolution order
46
- //
47
- // On the server:
48
- // 1. app.getInitialProps
49
- // 2. page.getInitialProps
50
- // 3. document.getInitialProps
51
- // 4. app.render
52
- // 5. page.render
53
- // 6. document.render
54
- //
55
- // On the server with error:
56
- // 1. document.getInitialProps
57
- // 2. app.render
58
- // 3. page.render
59
- // 4. document.render
60
- //
61
- // On the client
62
- // 1. app.getInitialProps
63
- // 2. page.getInitialProps
64
- // 3. app.render
65
- // 4. page.render
66
-
67
- // Render app and page and get the context of the page with collected side effects.
68
- const sheets = new ServerStyleSheets();
69
- const originalRenderPage = ctx.renderPage;
70
-
71
- ctx.renderPage = () =>
72
- originalRenderPage({
73
- enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
74
- });
75
-
76
- const initialProps = await Document.getInitialProps(ctx);
77
-
78
- return {
79
- ...initialProps,
80
- // Styles fragment is rendered after the app and page rendering finish.
81
- styles: [
82
- ...React.Children.toArray(initialProps.styles),
83
- sheets.getStyleElement(),
84
- ],
85
- };
86
- };
package/src/Image.tsx DELETED
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import NextImage, { ImageProps } from 'next/image';
3
- import { useBasePath } from '@digigov/nextjs/hooks';
4
-
5
- const Image: React.FC<ImageProps> = ({ src, ...rest }) => {
6
- const basePathSrc = useBasePath(src);
7
- return <NextImage src={basePathSrc} {...rest} />;
8
- };
9
-
10
- export default Image;
package/src/Link.tsx DELETED
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { LinkProps } from '@digigov/ui/core/Link';
3
- import Link from 'next/link';
4
- import CoreLink from '@digigov/react-core/Link';
5
-
6
- const NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (
7
- props,
8
- ref
9
- ) => {
10
- const { href, ...other } = props;
11
- const isExternalLink =
12
- //check if url has a file extension
13
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||
14
- // or if props has a target or rel
15
- other.target === '_blank';
16
-
17
- if (isExternalLink) {
18
- return (
19
- <CoreLink ref={ref} href={href || '#'} {...other}>
20
- {props.children}
21
- </CoreLink>
22
- );
23
- }
24
- return (
25
- <Link href={href || '#'} {...other}>
26
- <CoreLink ref={ref} {...other}>
27
- {props.children}
28
- </CoreLink>
29
- </Link>
30
- );
31
- };
32
-
33
- export default React.forwardRef(NextLink);
package/src/hooks.ts DELETED
@@ -1,6 +0,0 @@
1
- import { useRouter } from 'next/router';
2
-
3
- export function useBasePath(src: string): string {
4
- const router = useRouter();
5
- return router.basePath + src;
6
- }
package/src/i18n.tsx DELETED
@@ -1,18 +0,0 @@
1
- import i18n, { Resource, TFunction } from 'i18next';
2
- import { initReactI18next } from 'react-i18next';
3
-
4
- export default function initI18n(
5
- resources: Resource,
6
- language = 'el'
7
- ): Promise<TFunction> {
8
- return i18n
9
- .use(initReactI18next) // passes i18n down to react-i18next
10
- .init({
11
- resources: resources,
12
- lng: language,
13
- keySeparator: '.', // we use keys in form messages.welcome
14
- interpolation: {
15
- escapeValue: false, // react already safes from xss
16
- },
17
- });
18
- }
package/src/index.ts DELETED
File without changes
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@digigov/cli-build/tsconfig.base",
3
- "compilerOptions": {
4
- "outDir": "dist"
5
- },
6
- "include": [
7
- "./src"
8
- ],
9
- "exclude": [
10
- "node_modules",
11
- "dist",
12
- "*.svg"
13
- ]
14
- }