@koine/next 1.0.1 → 1.0.2
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 +6 -0
- package/Analytics/index.d.ts +1 -0
- package/Auth/helpers.d.ts +17 -0
- package/Auth/index.d.ts +4 -0
- package/Auth/useLogin.d.ts +7 -0
- package/Auth/useLoginUrl.d.ts +1 -0
- package/Auth/useLogout.d.ts +6 -0
- package/Favicon/Favicon.d.ts +4 -0
- package/Favicon/index.d.ts +1 -0
- package/Forms/index.d.ts +2 -0
- package/Forms/useForm.d.ts +32 -0
- package/Forms/useSubmit.d.ts +24 -0
- package/Head/Head.d.ts +1 -0
- package/Head/index.d.ts +1 -0
- package/I18n/I18n.d.ts +48 -0
- package/I18n/index.d.ts +1 -0
- package/Img/Img.d.ts +21 -0
- package/Img/index.d.ts +1 -0
- package/Link/Link.d.ts +8 -0
- package/Link/index.d.ts +1 -0
- package/NextProgress/NextProgress.d.ts +14 -0
- package/NextProgress/index.d.ts +1 -0
- package/Seo/Seo.d.ts +3 -0
- package/Seo/SeoDefaults.d.ts +3 -0
- package/Seo/helpers.d.ts +48 -0
- package/Seo/index.d.ts +12 -0
- package/Theme/Theme.d.ts +46 -0
- package/Theme/index.d.ts +1 -0
- package/Theme.js +1905 -0
- package/_tslib.js +41 -0
- package/app/App--emotion.d.ts +10 -0
- package/app/App--sc.d.ts +10 -0
- package/app/App--vanilla.d.ts +10 -0
- package/app/AppAuth--emotion.d.ts +10 -0
- package/app/AppAuth--sc.d.ts +10 -0
- package/app/AppHead.d.ts +3 -0
- package/app/AppMain--vanilla.d.ts +27 -0
- package/app/AppMain.d.ts +34 -0
- package/app/AppTheme--emotion.d.ts +15 -0
- package/app/AppTheme--sc.d.ts +13 -0
- package/app/AppTheme--vanilla.d.ts +10 -0
- package/app/index.d.ts +11 -0
- package/app/motion-features.d.ts +2 -0
- package/app.js +235 -0
- package/config/index.d.ts +58 -0
- package/config.js +156 -880
- package/document/Document--emotion.d.ts +5 -0
- package/document/Document--sc.d.ts +11 -0
- package/document/Document--vanilla.d.ts +11 -0
- package/document/Document.d.ts +10 -0
- package/document/emotion.d.ts +5 -0
- package/document/index.d.ts +4 -0
- package/document.js +207 -0
- package/emotion.js +1329 -0
- package/es.object.assign.js +1074 -0
- package/es.string.replace.js +785 -0
- package/es.string.split.js +201 -0
- package/index.d.ts +12 -0
- package/index.esm.js +4437 -4406
- package/index.js +743 -0
- package/index.umd.js +4635 -4623
- package/package.json +12 -4
- package/types.d.ts +91 -0
- package/utils/api.d.ts +55 -0
- package/utils/index.d.ts +19 -0
- package/motion-features.esm.js +0 -2
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koine/next",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"
|
|
4
|
+
"exports": {
|
|
5
|
+
".": "./index.js",
|
|
6
|
+
"./app": "./app.js",
|
|
7
|
+
"./config": "./config.js",
|
|
8
|
+
"./document": "./document.js"
|
|
9
|
+
},
|
|
10
|
+
"version": "1.0.2",
|
|
5
11
|
"main": "./index.umd.js",
|
|
6
12
|
"module": "./index.esm.js",
|
|
7
13
|
"typings": "./index.d.ts",
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"peerDependencies": {
|
|
14
|
+
"dependencies": {
|
|
10
15
|
"react": "^17.0.2",
|
|
11
16
|
"next": "^12.1.4",
|
|
17
|
+
"@koine/utils": "1.0.2",
|
|
12
18
|
"next-auth": "^4.3.1",
|
|
13
19
|
"framer-motion": "^6.2.9",
|
|
14
20
|
"@mui/material": "^5.6.0",
|
|
15
21
|
"@emotion/react": "^11.9.0",
|
|
22
|
+
"@koine/react": "1.0.2",
|
|
16
23
|
"styled-components": "^5.3.5",
|
|
17
24
|
"react-hook-form": "^7.29.0",
|
|
18
25
|
"@emotion/server": "^11.4.0",
|
|
@@ -22,5 +29,6 @@
|
|
|
22
29
|
"date-fns": "^2.28.0",
|
|
23
30
|
"next-translate": "^1.3.5",
|
|
24
31
|
"next-seo": "^5.4.0"
|
|
25
|
-
}
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {}
|
|
26
34
|
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next utility types
|
|
3
|
+
*/
|
|
4
|
+
declare type PageServer<P> = import("next").InferGetServerSidePropsType<P>;
|
|
5
|
+
declare type PageStatic<P> = import("next").InferGetStaticPropsType<P>;
|
|
6
|
+
declare type DataServer<P, T> = import("next").GetServerSideProps<P, T>;
|
|
7
|
+
declare type DataStatic<P, T> = import("next").GetStaticProps<P, T>;
|
|
8
|
+
declare type DataStaticPaths<P> = import("next").GetStaticPaths<P>;
|
|
9
|
+
declare type DataStaticPathsResult<P> = import("next").GetStaticPathsResult<P>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Nx types
|
|
13
|
+
*
|
|
14
|
+
* Allow to embed SVGs as both URLs string and as React components
|
|
15
|
+
*/
|
|
16
|
+
declare module "*.svg" {
|
|
17
|
+
const content: unknown;
|
|
18
|
+
export const ReactComponent: import("react").FC<
|
|
19
|
+
import("react").ComponentProps<"svg">
|
|
20
|
+
>;
|
|
21
|
+
export default content;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Extend NodeJS `process.env` with variables used by @koine
|
|
26
|
+
*/
|
|
27
|
+
declare namespace NodeJS {
|
|
28
|
+
interface ProcessEnv {
|
|
29
|
+
NEXT_PUBLIC_APP_URL: string;
|
|
30
|
+
AUTH_ROUTE_LOGIN: string;
|
|
31
|
+
AUTH_ROUTE_PROFILE: string;
|
|
32
|
+
AUTH_ROUTE_REGISTER: string;
|
|
33
|
+
AUTH_ROUTES_SECURED: string;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Types specifically related to `@koine/next` exposed on the global unique
|
|
39
|
+
* namespace `Koine`. Most of the types here should be prefixed by `Next`, e.g.
|
|
40
|
+
* `NextSomeFeature` accessible anywhere from `Koine.NextSomeFeature`
|
|
41
|
+
*/
|
|
42
|
+
declare namespace Koine {
|
|
43
|
+
/**
|
|
44
|
+
* Default SEO data structure expected by the `<Seo>` component's prop `seo`
|
|
45
|
+
*/
|
|
46
|
+
type NextSeo = import("./Seo").SeoData;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Next auth routes configurable map
|
|
50
|
+
*
|
|
51
|
+
* @see next/auth `pages` mapping: https://next-auth.js.org/configuration/pages`
|
|
52
|
+
*/
|
|
53
|
+
type NextAuthRoutesMap = {
|
|
54
|
+
login: string;
|
|
55
|
+
profile: string;
|
|
56
|
+
register: string;
|
|
57
|
+
/** Array of regexes to match pathnames of protected routes */
|
|
58
|
+
secured: RegExp[];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Translations dictionary extracted from JSON files. You need to extend this
|
|
63
|
+
* type with something like:
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* "~": typeof import("./public/locales/en/~.json");
|
|
67
|
+
* _: typeof import("./public/locales/en/_.json");
|
|
68
|
+
* $team: typeof import("./public/locales/en/$team.json");
|
|
69
|
+
* home: typeof import("./public/locales/en/home.json");
|
|
70
|
+
* Footer: typeof import("./public/locales/en/Footer.json");
|
|
71
|
+
* Header: typeof import("./public/locales/en/Header.json");
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
75
|
+
interface NextTranslations {
|
|
76
|
+
/** Convention for app wide `common` translations */
|
|
77
|
+
_: Record<string, string>;
|
|
78
|
+
/** Convention for app wide `routes` translated definitions */
|
|
79
|
+
"~": Record<string, string>;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* List here the global variables used by third party scripts supported within
|
|
85
|
+
* the `koine` ecosystem. For instance Google Analytics globally available
|
|
86
|
+
* variables.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
declare const gtag: (
|
|
90
|
+
...args: Record<string, unknown>[]
|
|
91
|
+
) => Record<string, unknown>;
|
package/utils/api.d.ts
ADDED
|
@@ -0,0 +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 {};
|
package/utils/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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>;
|
package/motion-features.esm.js
DELETED