@koine/next 1.0.3 → 1.0.8

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 (118) hide show
  1. package/Analytics/AnalyticsGoogle.d.ts +5 -6
  2. package/Analytics/AnalyticsGoogle.js +37 -0
  3. package/Analytics/index.d.ts +1 -1
  4. package/Analytics/index.js +1 -0
  5. package/Auth/helpers.d.ts +17 -17
  6. package/Auth/helpers.js +21 -0
  7. package/Auth/index.d.ts +4 -4
  8. package/Auth/index.js +4 -0
  9. package/Auth/useLogin.d.ts +7 -7
  10. package/Auth/useLogin.js +47 -0
  11. package/Auth/useLoginUrl.d.ts +1 -1
  12. package/Auth/useLoginUrl.js +11 -0
  13. package/Auth/useLogout.d.ts +6 -6
  14. package/Auth/useLogout.js +52 -0
  15. package/Favicon/Favicon.d.ts +3 -4
  16. package/Favicon/Favicon.js +4 -0
  17. package/Favicon/index.d.ts +1 -1
  18. package/Favicon/index.js +1 -0
  19. package/Forms/index.d.ts +2 -2
  20. package/Forms/index.js +2 -0
  21. package/Forms/useForm.d.ts +32 -32
  22. package/Forms/useForm.js +33 -0
  23. package/Forms/useSubmit.d.ts +24 -24
  24. package/Forms/useSubmit.js +20 -0
  25. package/Head/Head.d.ts +1 -1
  26. package/Head/Head.js +1 -0
  27. package/Head/index.d.ts +1 -1
  28. package/Head/index.js +1 -0
  29. package/I18n/I18n.d.ts +48 -48
  30. package/I18n/I18n.js +86 -0
  31. package/I18n/index.d.ts +1 -1
  32. package/I18n/index.js +1 -0
  33. package/Img/Img.d.ts +21 -21
  34. package/Img/Img.js +30 -0
  35. package/Img/index.d.ts +1 -1
  36. package/Img/index.js +1 -0
  37. package/Link/Link.d.ts +8 -8
  38. package/Link/Link.js +12 -0
  39. package/Link/index.d.ts +1 -1
  40. package/Link/index.js +1 -0
  41. package/NextProgress/NextProgress.d.ts +13 -14
  42. package/NextProgress/NextProgress.js +38 -0
  43. package/NextProgress/index.d.ts +1 -1
  44. package/NextProgress/index.js +1 -0
  45. package/Seo/Seo.d.ts +3 -3
  46. package/Seo/Seo.js +8 -0
  47. package/Seo/SeoDefaults.d.ts +3 -3
  48. package/Seo/SeoDefaults.js +12 -0
  49. package/Seo/helpers.d.ts +48 -48
  50. package/Seo/helpers.js +113 -0
  51. package/Seo/index.d.ts +12 -12
  52. package/Seo/index.js +12 -0
  53. package/Theme/Theme.d.ts +46 -46
  54. package/Theme/Theme.js +235 -0
  55. package/Theme/index.d.ts +1 -1
  56. package/Theme/index.js +1 -0
  57. package/app/App--emotion.d.ts +10 -10
  58. package/app/App--emotion.js +11 -0
  59. package/app/App--sc.d.ts +10 -10
  60. package/app/App--sc.js +11 -0
  61. package/app/App--vanilla.d.ts +10 -10
  62. package/app/App--vanilla.js +11 -0
  63. package/app/AppAuth--emotion.d.ts +10 -10
  64. package/app/AppAuth--emotion.js +12 -0
  65. package/app/AppAuth--sc.d.ts +10 -10
  66. package/app/AppAuth--sc.js +12 -0
  67. package/app/AppHead.d.ts +3 -3
  68. package/app/AppHead.js +5 -0
  69. package/app/{AppMain.d.ts → AppMain--emotion.d.ts} +34 -34
  70. package/app/AppMain--emotion.js +27 -0
  71. package/app/AppMain--sc.d.ts +34 -0
  72. package/app/AppMain--sc.js +27 -0
  73. package/app/AppMain--vanilla.d.ts +27 -27
  74. package/app/AppMain--vanilla.js +11 -0
  75. package/app/AppTheme--emotion.d.ts +15 -15
  76. package/app/AppTheme--emotion.js +17 -0
  77. package/app/AppTheme--sc.d.ts +13 -13
  78. package/app/AppTheme--sc.js +9 -0
  79. package/app/AppTheme--vanilla.d.ts +10 -10
  80. package/app/AppTheme--vanilla.js +12 -0
  81. package/app/index.d.ts +11 -11
  82. package/app/index.js +11 -0
  83. package/app/motion-features.d.ts +2 -2
  84. package/app/motion-features.js +2 -0
  85. package/config/index.d.ts +58 -58
  86. package/config/index.js +144 -0
  87. package/document/Document--emotion.d.ts +5 -5
  88. package/document/Document--emotion.js +55 -0
  89. package/document/Document--sc.d.ts +11 -11
  90. package/document/Document--sc.js +33 -0
  91. package/document/Document--vanilla.d.ts +11 -11
  92. package/document/Document--vanilla.js +20 -0
  93. package/document/Document.d.ts +10 -10
  94. package/document/Document.js +14 -0
  95. package/document/index.d.ts +4 -4
  96. package/document/index.js +4 -0
  97. package/index.d.ts +15 -12
  98. package/index.js +15 -743
  99. package/index.umd.js +2061 -78
  100. package/package.json +27 -21
  101. package/{types.d.ts → typings.d.ts} +0 -0
  102. package/utils/api.d.ts +55 -55
  103. package/utils/api.js +33 -0
  104. package/{document/emotion.d.ts → utils/emotion-cache.d.ts} +5 -5
  105. package/utils/emotion-cache.js +8 -0
  106. package/utils/index.d.ts +20 -19
  107. package/utils/index.js +27 -0
  108. package/Theme.js +0 -1905
  109. package/_tslib.js +0 -41
  110. package/app.js +0 -250
  111. package/config.js +0 -183
  112. package/document.js +0 -207
  113. package/emotion.js +0 -1329
  114. package/es.object.assign.js +0 -1074
  115. package/es.string.replace.js +0 -785
  116. package/es.string.split.js +0 -201
  117. package/index.esm.js +0 -4600
  118. package/motion-features.js +0 -10
package/package.json CHANGED
@@ -1,35 +1,41 @@
1
1
  {
2
2
  "name": "@koine/next",
3
3
  "sideEffects": false,
4
- "exports": {
5
- ".": "./index.js",
6
- "./app": "./app.js",
7
- "./config": "./config.js",
8
- "./document": "./document.js"
9
- },
4
+ "version": "1.0.8",
5
+ "main": "./index.umd.js",
6
+ "typings": "./index.d.ts",
10
7
  "dependencies": {
11
- "@emotion/styled": "^11.8.1",
12
- "react": "^17.0.2",
8
+ "react": ">=17.0.2 || >=18.0.0",
13
9
  "next": "^12.1.4",
14
- "@koine/utils": "1.0.3",
10
+ "@koine/utils": "1.0.8",
15
11
  "next-auth": "^4.3.1",
16
12
  "framer-motion": "^6.2.9",
17
- "@mui/material": "^5.6.0",
13
+ "@mui/material": "^5.6.1",
18
14
  "@emotion/react": "^11.9.0",
19
- "@koine/react": "1.0.3",
15
+ "@koine/react": "1.0.8",
20
16
  "styled-components": "^5.3.5",
17
+ "@mui/base": "^5.0.0-alpha.76",
18
+ "react-icons": "^4.3.1",
19
+ "date-fns": "^2.28.0",
20
+ "react-swipeable": "^6.2.1",
21
+ "@reach/disclosure": "^0.16.2",
22
+ "@reach/dialog": "^0.16.2",
23
+ "@tiptap/react": "^2.0.0-beta.108",
24
+ "@tiptap/starter-kit": "^2.0.0-beta.183",
25
+ "yup": "^0.32.11",
21
26
  "react-hook-form": "^7.29.0",
27
+ "@n8tb1t/use-scroll-position": "^2.0.3",
28
+ "@types/react-is": "^17.0.3",
29
+ "@types/styled-components": "^5.1.25",
30
+ "@types/yup": "^0.29.13",
31
+ "react-use": "^17.3.2",
32
+ "@reach/tabs": "^0.16.4",
22
33
  "@emotion/server": "^11.4.0",
23
- "yup": "^0.32.11",
24
34
  "@hookform/resolvers": "^2.8.8",
25
- "react-use": "^17.3.2",
26
- "date-fns": "^2.28.0",
27
- "next-translate": "^1.3.5",
28
- "next-seo": "^5.4.0"
35
+ "next-translate": "^1.4.0",
36
+ "next-seo": "^5.4.0",
37
+ "tslib": "^2.3.1"
29
38
  },
30
- "version": "1.0.3",
31
- "main": "./index.umd.js",
32
- "module": "./index.esm.js",
33
- "typings": "./index.d.ts",
34
- "peerDependencies": {}
39
+ "peerDependencies": {},
40
+ "module": "./index.js"
35
41
  }
File without changes
package/utils/api.d.ts CHANGED
@@ -1,55 +1,55 @@
1
- declare type _Response = Response;
2
- export declare namespace KoineApi {
3
- type ResponseSuccesfull = unknown;
4
- type ResponseFailed = unknown;
5
- type ResponseShared<T extends Record<string, unknown> = {}> = T & {
6
- status: _Response["status"];
7
- msg: _Response["statusText"];
8
- };
9
- type Response<Succesfull extends ResponseSuccesfull = ResponseSuccesfull, Failed extends ResponseFailed = ResponseFailed> = {
10
- status: _Response["status"];
11
- msg: _Response["statusText"];
12
- ok: true;
13
- fail?: false;
14
- data: Succesfull;
15
- } | {
16
- status: _Response["status"];
17
- msg: _Response["statusText"];
18
- ok?: false;
19
- fail: true;
20
- data: Failed;
21
- };
22
- /**
23
- * Request options
24
- */
25
- type RequestOptions<TJson = unknown> = {
26
- /**
27
- * JSON request body
28
- *
29
- * @default {}
30
- */
31
- json?: TJson;
32
- /**
33
- * Params will be serialized into a string and appended to the URL
34
- */
35
- params?: Record<string, unknown>;
36
- /**
37
- * Headers will be merged with
38
- * ```
39
- * { "content-type": "application/json" }
40
- * ```
41
- */
42
- headers?: RequestInit["headers"];
43
- /**
44
- * Timeout in `ms`, if `falsy` there is no timeout
45
- *
46
- * @default 10000
47
- */
48
- timeout?: number | false | null;
49
- };
50
- type RequestMethod = "get" | "post" | "put" | "patch" | "delete";
51
- type RequestFn = <Succesfull extends ResponseSuccesfull = unknown, Failed extends ResponseFailed = unknown>(endpoint: string, options?: RequestOptions) => Promise<Response<Succesfull, Failed>>;
52
- type Client = Record<RequestMethod, RequestFn>;
53
- }
54
- export declare const api: KoineApi.Client;
55
- export {};
1
+ declare type _Response = Response;
2
+ export declare namespace KoineApi {
3
+ type ResponseSuccesfull = unknown;
4
+ type ResponseFailed = unknown;
5
+ type ResponseShared<T extends Record<string, unknown> = {}> = T & {
6
+ status: _Response["status"];
7
+ msg: _Response["statusText"];
8
+ };
9
+ type Response<Succesfull extends ResponseSuccesfull = ResponseSuccesfull, Failed extends ResponseFailed = ResponseFailed> = {
10
+ status: _Response["status"];
11
+ msg: _Response["statusText"];
12
+ ok: true;
13
+ fail?: false;
14
+ data: Succesfull;
15
+ } | {
16
+ status: _Response["status"];
17
+ msg: _Response["statusText"];
18
+ ok?: false;
19
+ fail: true;
20
+ data: Failed;
21
+ };
22
+ /**
23
+ * Request options
24
+ */
25
+ type RequestOptions<TJson = unknown> = {
26
+ /**
27
+ * JSON request body
28
+ *
29
+ * @default {}
30
+ */
31
+ json?: TJson;
32
+ /**
33
+ * Params will be serialized into a string and appended to the URL
34
+ */
35
+ params?: Record<string, unknown>;
36
+ /**
37
+ * Headers will be merged with
38
+ * ```
39
+ * { "content-type": "application/json" }
40
+ * ```
41
+ */
42
+ headers?: RequestInit["headers"];
43
+ /**
44
+ * Timeout in `ms`, if `falsy` there is no timeout
45
+ *
46
+ * @default 10000
47
+ */
48
+ timeout?: number | false | null;
49
+ };
50
+ type RequestMethod = "get" | "post" | "put" | "patch" | "delete";
51
+ type RequestFn = <Succesfull extends ResponseSuccesfull = unknown, Failed extends ResponseFailed = unknown>(endpoint: string, options?: RequestOptions) => Promise<Response<Succesfull, Failed>>;
52
+ type Client = Record<RequestMethod, RequestFn>;
53
+ }
54
+ export declare const api: KoineApi.Client;
55
+ export {};
package/utils/api.js ADDED
@@ -0,0 +1,33 @@
1
+ import { __awaiter } from "tslib";
2
+ import { buildUrlQueryString } from "@koine/utils";
3
+ export const api = ["get", "post", "put", "patch", "delete"].reduce((api, method) => {
4
+ api[method] = (endpoint, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
5
+ const { json = {}, params, headers = {}, timeout = 10000 } = options;
6
+ const requestInit = {
7
+ method: method.toUpperCase(),
8
+ headers: Object.assign({ "content-type": "application/json" }, headers),
9
+ };
10
+ const timeoutNumber = Number(timeout);
11
+ let controller;
12
+ let timeoutId;
13
+ let url = `/api/${endpoint.replace(/^\/*/, "")}`;
14
+ if (method !== "get") {
15
+ requestInit.body = JSON.stringify(json);
16
+ }
17
+ if (timeoutNumber > 0) {
18
+ controller = new AbortController();
19
+ timeoutId = setTimeout(() => controller.abort(), timeoutNumber);
20
+ requestInit.signal = controller.signal;
21
+ }
22
+ if (params) {
23
+ url += buildUrlQueryString(params);
24
+ }
25
+ const response = yield fetch(url, requestInit);
26
+ if (timeoutId) {
27
+ clearTimeout(timeoutId);
28
+ }
29
+ const result = (yield response.json());
30
+ return result;
31
+ });
32
+ return api;
33
+ }, {});
@@ -1,5 +1,5 @@
1
- /**
2
- * prepend: true moves MUI styles to the top of the <head> so they're loaded first.
3
- * It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
4
- */
5
- export declare function createEmotionCache(): import("@emotion/utils").EmotionCache;
1
+ /**
2
+ * prepend: true moves MUI styles to the top of the <head> so they're loaded first.
3
+ * It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
4
+ */
5
+ export declare function createEmotionCache(): import("@emotion/utils").EmotionCache;
@@ -0,0 +1,8 @@
1
+ import createCache from "@emotion/cache";
2
+ /**
3
+ * prepend: true moves MUI styles to the top of the <head> so they're loaded first.
4
+ * It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
5
+ */
6
+ export function createEmotionCache() {
7
+ return createCache({ key: "css", prepend: true });
8
+ }
package/utils/index.d.ts CHANGED
@@ -1,19 +1,20 @@
1
- export * from "./api";
2
- export declare const ONE_HOUR = 3600;
3
- export declare const ONE_DAY = 84000;
4
- /**
5
- * Get site absolute url with the given path
6
- *
7
- * - It uses the `NEXT_PUBLIC_APP_URL` env variable
8
- * - It removes the trailing slashes
9
- */
10
- export declare function getSiteUrl(path?: string): string;
11
- /**
12
- * Utility to load a component with an optional pre-determined delay.
13
- *
14
- * This was designed to improve anti spam wit async form loading.
15
- *
16
- * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
17
- * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
18
- */
19
- export declare function load<T>(component: T, milliseconds: number): Promise<T>;
1
+ export * from "./api";
2
+ export * from "./emotion-cache";
3
+ export declare const ONE_HOUR = 3600;
4
+ export declare const ONE_DAY = 84000;
5
+ /**
6
+ * Get site absolute url with the given path
7
+ *
8
+ * - It uses the `NEXT_PUBLIC_APP_URL` env variable
9
+ * - It removes the trailing slashes
10
+ */
11
+ export declare function getSiteUrl(path?: string): string;
12
+ /**
13
+ * Utility to load a component with an optional pre-determined delay.
14
+ *
15
+ * This was designed to improve anti spam wit async form loading.
16
+ *
17
+ * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
18
+ * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
19
+ */
20
+ export declare function load<T>(component: T, milliseconds: number): Promise<T>;
package/utils/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { normaliseUrl } from "@koine/utils";
2
+ export * from "./api";
3
+ export * from "./emotion-cache";
4
+ export const ONE_HOUR = 3600;
5
+ export const ONE_DAY = 84000;
6
+ /**
7
+ * Get site absolute url with the given path
8
+ *
9
+ * - It uses the `NEXT_PUBLIC_APP_URL` env variable
10
+ * - It removes the trailing slashes
11
+ */
12
+ export function getSiteUrl(path = "") {
13
+ return normaliseUrl(`${process.env["NEXT_PUBLIC_APP_URL"]}/${path}`);
14
+ }
15
+ /**
16
+ * Utility to load a component with an optional pre-determined delay.
17
+ *
18
+ * This was designed to improve anti spam wit async form loading.
19
+ *
20
+ * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
21
+ * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
22
+ */
23
+ export function load(component, milliseconds) {
24
+ return new Promise((resolve) => {
25
+ setTimeout(() => resolve(component), milliseconds);
26
+ });
27
+ }