@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.
- package/Analytics/AnalyticsGoogle.d.ts +5 -6
- package/Analytics/AnalyticsGoogle.js +37 -0
- package/Analytics/index.d.ts +1 -1
- package/Analytics/index.js +1 -0
- package/Auth/helpers.d.ts +17 -17
- package/Auth/helpers.js +21 -0
- package/Auth/index.d.ts +4 -4
- package/Auth/index.js +4 -0
- package/Auth/useLogin.d.ts +7 -7
- package/Auth/useLogin.js +47 -0
- package/Auth/useLoginUrl.d.ts +1 -1
- package/Auth/useLoginUrl.js +11 -0
- package/Auth/useLogout.d.ts +6 -6
- package/Auth/useLogout.js +52 -0
- package/Favicon/Favicon.d.ts +3 -4
- package/Favicon/Favicon.js +4 -0
- package/Favicon/index.d.ts +1 -1
- package/Favicon/index.js +1 -0
- package/Forms/index.d.ts +2 -2
- package/Forms/index.js +2 -0
- package/Forms/useForm.d.ts +32 -32
- package/Forms/useForm.js +33 -0
- package/Forms/useSubmit.d.ts +24 -24
- package/Forms/useSubmit.js +20 -0
- package/Head/Head.d.ts +1 -1
- package/Head/Head.js +1 -0
- package/Head/index.d.ts +1 -1
- package/Head/index.js +1 -0
- package/I18n/I18n.d.ts +48 -48
- package/I18n/I18n.js +86 -0
- package/I18n/index.d.ts +1 -1
- package/I18n/index.js +1 -0
- package/Img/Img.d.ts +21 -21
- package/Img/Img.js +30 -0
- package/Img/index.d.ts +1 -1
- package/Img/index.js +1 -0
- package/Link/Link.d.ts +8 -8
- package/Link/Link.js +12 -0
- package/Link/index.d.ts +1 -1
- package/Link/index.js +1 -0
- package/NextProgress/NextProgress.d.ts +13 -14
- package/NextProgress/NextProgress.js +38 -0
- package/NextProgress/index.d.ts +1 -1
- package/NextProgress/index.js +1 -0
- package/Seo/Seo.d.ts +3 -3
- package/Seo/Seo.js +8 -0
- package/Seo/SeoDefaults.d.ts +3 -3
- package/Seo/SeoDefaults.js +12 -0
- package/Seo/helpers.d.ts +48 -48
- package/Seo/helpers.js +113 -0
- package/Seo/index.d.ts +12 -12
- package/Seo/index.js +12 -0
- package/Theme/Theme.d.ts +46 -46
- package/Theme/Theme.js +235 -0
- package/Theme/index.d.ts +1 -1
- package/Theme/index.js +1 -0
- package/app/App--emotion.d.ts +10 -10
- package/app/App--emotion.js +11 -0
- package/app/App--sc.d.ts +10 -10
- package/app/App--sc.js +11 -0
- package/app/App--vanilla.d.ts +10 -10
- package/app/App--vanilla.js +11 -0
- package/app/AppAuth--emotion.d.ts +10 -10
- package/app/AppAuth--emotion.js +12 -0
- package/app/AppAuth--sc.d.ts +10 -10
- package/app/AppAuth--sc.js +12 -0
- package/app/AppHead.d.ts +3 -3
- package/app/AppHead.js +5 -0
- package/app/{AppMain.d.ts → AppMain--emotion.d.ts} +34 -34
- package/app/AppMain--emotion.js +27 -0
- package/app/AppMain--sc.d.ts +34 -0
- package/app/AppMain--sc.js +27 -0
- package/app/AppMain--vanilla.d.ts +27 -27
- package/app/AppMain--vanilla.js +11 -0
- package/app/AppTheme--emotion.d.ts +15 -15
- package/app/AppTheme--emotion.js +17 -0
- package/app/AppTheme--sc.d.ts +13 -13
- package/app/AppTheme--sc.js +9 -0
- package/app/AppTheme--vanilla.d.ts +10 -10
- package/app/AppTheme--vanilla.js +12 -0
- package/app/index.d.ts +11 -11
- package/app/index.js +11 -0
- package/app/motion-features.d.ts +2 -2
- package/app/motion-features.js +2 -0
- package/config/index.d.ts +58 -58
- package/config/index.js +144 -0
- package/document/Document--emotion.d.ts +5 -5
- package/document/Document--emotion.js +55 -0
- package/document/Document--sc.d.ts +11 -11
- package/document/Document--sc.js +33 -0
- package/document/Document--vanilla.d.ts +11 -11
- package/document/Document--vanilla.js +20 -0
- package/document/Document.d.ts +10 -10
- package/document/Document.js +14 -0
- package/document/index.d.ts +4 -4
- package/document/index.js +4 -0
- package/index.d.ts +15 -12
- package/index.js +15 -743
- package/index.umd.js +2061 -78
- package/package.json +27 -21
- package/{types.d.ts → typings.d.ts} +0 -0
- package/utils/api.d.ts +55 -55
- package/utils/api.js +33 -0
- package/{document/emotion.d.ts → utils/emotion-cache.d.ts} +5 -5
- package/utils/emotion-cache.js +8 -0
- package/utils/index.d.ts +20 -19
- package/utils/index.js +27 -0
- package/Theme.js +0 -1905
- package/_tslib.js +0 -41
- package/app.js +0 -250
- package/config.js +0 -183
- package/document.js +0 -207
- package/emotion.js +0 -1329
- package/es.object.assign.js +0 -1074
- package/es.string.replace.js +0 -785
- package/es.string.split.js +0 -201
- package/index.esm.js +0 -4600
- 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
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
"
|
|
12
|
-
"react": "^17.0.2",
|
|
8
|
+
"react": ">=17.0.2 || >=18.0.0",
|
|
13
9
|
"next": "^12.1.4",
|
|
14
|
-
"@koine/utils": "1.0.
|
|
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.
|
|
13
|
+
"@mui/material": "^5.6.1",
|
|
18
14
|
"@emotion/react": "^11.9.0",
|
|
19
|
-
"@koine/react": "1.0.
|
|
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
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
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
|
-
"
|
|
31
|
-
"
|
|
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
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - It
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @see https://github.com/vercel/next.js/blob/
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|