@digigov/nextjs 0.6.4-alpha → 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.
Files changed (54) hide show
  1. package/{dist/App.js → App.js} +0 -0
  2. package/CHANGELOG.md +9 -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 -935
  43. package/dist/CHANGELOG.md +0 -255
  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 -61
  48. package/src/Document.tsx +0 -73
  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,255 +0,0 @@
1
- # Change Log - @digigov/nextjs
2
-
3
- This log was last generated on Tue, 27 Sep 2022 10:00:49 GMT and should not be manually modified.
4
-
5
- ## 0.6.3
6
- Tue, 27 Sep 2022 10:00:49 GMT
7
-
8
- ### Patches
9
-
10
- - increase the range of accepted react version specified in peerDependencies
11
-
12
- ## 0.6.2
13
- Tue, 06 Sep 2022 08:27:15 GMT
14
-
15
- ### Patches
16
-
17
- - remove theme material-ui from App.tsx
18
-
19
- ## 0.6.1
20
- Wed, 31 Aug 2022 16:10:12 GMT
21
-
22
- _Version update only_
23
-
24
- ## 0.6.0
25
- Tue, 16 Aug 2022 14:59:01 GMT
26
-
27
- ### Minor changes
28
-
29
- - add new Image wrapper with built-in basePath support
30
-
31
- ## 0.5.4
32
- Wed, 08 Jun 2022 13:32:34 GMT
33
-
34
- ### Patches
35
-
36
- - Fix i18NProvider string interpolation support
37
-
38
- ## 0.5.3
39
- Tue, 17 May 2022 11:04:22 GMT
40
-
41
- _Version update only_
42
-
43
- ## 0.5.2
44
- Mon, 16 May 2022 14:42:45 GMT
45
-
46
- ### Patches
47
-
48
- - Change MIT License to BSD-2-Clause
49
-
50
- ## 0.5.1
51
- Tue, 19 Apr 2022 12:17:34 GMT
52
-
53
- ### Patches
54
-
55
- - Fix a bug where using target=_blank would not open the link at all. Now it opens in a new window using our CoreLink.
56
-
57
- ## 0.5.0
58
- Mon, 18 Apr 2022 13:00:33 GMT
59
-
60
- ### Minor changes
61
-
62
- - Upgrade @types/node version
63
-
64
- ## 0.4.6
65
- Thu, 14 Apr 2022 12:32:51 GMT
66
-
67
- _Version update only_
68
-
69
- ## 0.4.5
70
- Wed, 30 Mar 2022 13:17:56 GMT
71
-
72
- ### Patches
73
-
74
- - incorrect regex pattern was causing build failure
75
-
76
- ## 0.4.4
77
- Wed, 30 Mar 2022 12:28:30 GMT
78
-
79
- ### Patches
80
-
81
- - allow file links to be used with internal Nextjs router
82
-
83
- ## 0.4.2
84
- Thu, 24 Feb 2022 14:51:06 GMT
85
-
86
- _Version update only_
87
-
88
- ## 0.4.1
89
- Wed, 16 Feb 2022 12:49:28 GMT
90
-
91
- _Version update only_
92
-
93
- ## 0.4.0
94
- Mon, 14 Feb 2022 09:56:29 GMT
95
-
96
- ### Minor changes
97
-
98
- - Replace <a> with Link from @digigov/react-core
99
-
100
- ## 0.3.6
101
- Thu, 10 Feb 2022 13:45:56 GMT
102
-
103
- _Version update only_
104
-
105
- ## 0.3.5
106
- Tue, 08 Feb 2022 15:21:11 GMT
107
-
108
- _Version update only_
109
-
110
- ## 0.3.4
111
- Thu, 03 Feb 2022 15:47:05 GMT
112
-
113
- _Version update only_
114
-
115
- ## 0.3.3
116
- Wed, 02 Feb 2022 15:44:29 GMT
117
-
118
- ### Patches
119
-
120
- - fix package.json inconsistencies by running cli-lab verify-and-update-local-package-versions
121
-
122
- ## 0.3.2
123
- Thu, 30 Dec 2021 12:54:03 GMT
124
-
125
- _Version update only_
126
-
127
- ## 0.3.1
128
- Tue, 02 Nov 2021 13:03:39 GMT
129
-
130
- _Version update only_
131
-
132
- ## 0.3.0
133
- Tue, 12 Oct 2021 09:13:08 GMT
134
-
135
- ### Minor changes
136
-
137
- - Warn if browser is IE
138
-
139
- ## 0.2.27
140
- Wed, 22 Sep 2021 10:15:42 GMT
141
-
142
- ### Patches
143
-
144
- - Add missing props to the Link component
145
-
146
- ## 0.2.26
147
- Thu, 12 Aug 2021 08:56:35 GMT
148
-
149
- _Version update only_
150
-
151
- ## 0.2.25
152
- Thu, 12 Aug 2021 06:18:14 GMT
153
-
154
- _Version update only_
155
-
156
- ## 0.2.24
157
- Tue, 03 Aug 2021 12:09:02 GMT
158
-
159
- _Version update only_
160
-
161
- ## 0.2.23
162
- Tue, 03 Aug 2021 10:22:51 GMT
163
-
164
- _Version update only_
165
-
166
- ## 0.2.22
167
- Fri, 30 Jul 2021 13:01:30 GMT
168
-
169
- _Version update only_
170
-
171
- ## 0.2.21
172
- Fri, 30 Jul 2021 11:35:29 GMT
173
-
174
- _Version update only_
175
-
176
- ## 0.2.20
177
- Fri, 30 Jul 2021 10:46:37 GMT
178
-
179
- _Version update only_
180
-
181
- ## 0.2.19
182
- Fri, 30 Jul 2021 08:49:46 GMT
183
-
184
- _Version update only_
185
-
186
- ## 0.2.18
187
- Fri, 30 Jul 2021 07:46:24 GMT
188
-
189
- _Version update only_
190
-
191
- ## 0.2.17
192
- Tue, 27 Jul 2021 10:14:43 GMT
193
-
194
- _Version update only_
195
-
196
- ## 0.2.16
197
- Thu, 15 Jul 2021 11:16:22 GMT
198
-
199
- _Version update only_
200
-
201
- ## 0.2.15
202
- Fri, 09 Jul 2021 08:59:32 GMT
203
-
204
- _Version update only_
205
-
206
- ## 0.2.14
207
- Thu, 08 Jul 2021 15:08:50 GMT
208
-
209
- _Version update only_
210
-
211
- ## 0.2.13
212
- Wed, 30 Jun 2021 12:09:21 GMT
213
-
214
- _Version update only_
215
-
216
- ## 0.2.12
217
- Wed, 23 Jun 2021 13:04:19 GMT
218
-
219
- _Version update only_
220
-
221
- ## 0.2.11
222
- Wed, 02 Jun 2021 12:04:27 GMT
223
-
224
- _Version update only_
225
-
226
- ## 0.2.10
227
- Wed, 02 Jun 2021 08:33:44 GMT
228
-
229
- _Version update only_
230
-
231
- ## 0.2.9
232
- Wed, 05 May 2021 14:11:41 GMT
233
-
234
- _Version update only_
235
-
236
- ## 0.2.8
237
- Thu, 22 Apr 2021 15:04:42 GMT
238
-
239
- _Version update only_
240
-
241
- ## 0.2.7
242
- Thu, 22 Apr 2021 14:39:18 GMT
243
-
244
- _Version update only_
245
-
246
- ## 0.2.6
247
- Thu, 22 Apr 2021 14:06:40 GMT
248
-
249
- _Version update only_
250
-
251
- ## 0.2.5
252
- Thu, 22 Apr 2021 12:56:25 GMT
253
-
254
- _Initial release_
255
-
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.4-alpha",
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.6-alpha",
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.8.0 || ^17.0.0",
19
- "react-dom": "^16.8.0 || ^17.0.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 (1634ms).
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 (1260ms).
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/libs/nextjs/README.md to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/README.md
12
- Copied /Users/dimitristsironis/grnet/digigov-sdk/LICENSE to /Users/dimitristsironis/grnet/digigov-sdk/libs/nextjs/dist/LICENSE
13
- Skipped license for ./index.js
14
- Skipped license for ./umd/digigov-ui.development.js
15
- Skipped license for ./umd/digigov-ui.production.min.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 (1217ms).
package/src/App.tsx DELETED
@@ -1,61 +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
- this.updateHtmlLang();
28
- }
29
-
30
- componentDidUpdate(): void {
31
- this.updateHtmlLang();
32
- }
33
-
34
- updateHtmlLang(): void {
35
- document.documentElement.lang = this.props.i18n.language;
36
- }
37
-
38
- render(): React.ReactElement {
39
- const { Component, pageProps, t, i18n } = this.props;
40
- return (
41
- <I18NProvider
42
- t={(str) => (typeof str === 'string' ? t(str) : str)}
43
- i18n={i18n}
44
- >
45
- <LinkProvider component={NextLink}>
46
- <Head>
47
- <meta
48
- name="viewport"
49
- content="minimum-scale=1, initial-scale=1, width=device-width"
50
- />
51
- </Head>
52
- <DigiGOVApp>
53
- <Component {...pageProps} />
54
- </DigiGOVApp>
55
- </LinkProvider>
56
- </I18NProvider>
57
- );
58
- }
59
- }
60
- const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
61
- export default DigiGOVNextAppWithTranslation;
package/src/Document.tsx DELETED
@@ -1,73 +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
-
5
- export function Fonts() {
6
- return (
7
- <>
8
- <link
9
- rel="stylesheet"
10
- href="https://fonts.googleapis.com/icon?family=Material+Icons"
11
- />
12
- <link
13
- rel="stylesheet"
14
- href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
15
- />
16
- </>
17
- );
18
- }
19
- export default class DigiGOVDocument extends Document {
20
- render() {
21
- return (
22
- <Html>
23
- <Head>
24
- <script
25
- type="text/javascript"
26
- dangerouslySetInnerHTML={{
27
- __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
28
- `,
29
- }}
30
- ></script>
31
- {/* PWA primary color */}
32
- <Fonts />
33
- </Head>
34
- <body>
35
- <Main />
36
- <NextScript />
37
- </body>
38
- </Html>
39
- );
40
- }
41
- }
42
-
43
- DigiGOVDocument.getInitialProps = async (ctx) => {
44
- // Resolution order
45
- //
46
- // On the server:
47
- // 1. app.getInitialProps
48
- // 2. page.getInitialProps
49
- // 3. document.getInitialProps
50
- // 4. app.render
51
- // 5. page.render
52
- // 6. document.render
53
- //
54
- // On the server with error:
55
- // 1. document.getInitialProps
56
- // 2. app.render
57
- // 3. page.render
58
- // 4. document.render
59
- //
60
- // On the client
61
- // 1. app.getInitialProps
62
- // 2. page.getInitialProps
63
- // 3. app.render
64
- // 4. page.render
65
-
66
- // Render app and page and get the context of the page with collected side effects.
67
- const initialProps = await Document.getInitialProps(ctx);
68
-
69
- return {
70
- ...initialProps,
71
- // Styles fragment is rendered after the app and page rendering finish.
72
- };
73
- };
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
- }