@koine/next 2.0.0-beta.11 → 2.0.0-beta.111
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/12/AnalyticsGoogle.d.ts +1 -2
- package/12/DisableErrorOverlay.d.ts +1 -6
- package/12/Seo.d.ts +8 -26
- package/12/SeoDefaults.d.ts +3 -4
- package/12/seoBuildTags.d.ts +2 -17
- package/12/types.d.ts +2 -0
- package/12.cjs.d.ts +1 -0
- package/12.cjs.default.js +1 -0
- package/12.cjs.js +34 -0
- package/12.cjs.mjs +2 -0
- package/12.d.ts +3 -0
- package/12.esm.js +24 -0
- package/README.md +0 -12
- package/ThemeContext.cjs.d.ts +2 -0
- package/ThemeContext.cjs.default.js +1 -0
- package/ThemeContext.cjs.js +11 -0
- package/ThemeContext.cjs.mjs +2 -0
- package/ThemeContext.d.ts +11 -0
- package/ThemeContext.esm.js +6 -0
- package/ThemeProvider.cjs.d.ts +2 -0
- package/ThemeProvider.cjs.default.js +1 -0
- package/ThemeProvider.cjs.js +47 -0
- package/ThemeProvider.cjs.mjs +2 -0
- package/ThemeProvider.d.ts +17 -0
- package/ThemeProvider.esm.js +38 -0
- package/config.cjs.d.ts +1 -0
- package/config.cjs.default.js +1 -0
- package/config.cjs.js +29 -0
- package/config.cjs.mjs +2 -0
- package/config.d.ts +8 -0
- package/config.esm.js +25 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +19 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +3 -1
- package/index.esm.js +8 -0
- package/load.cjs.d.ts +2 -0
- package/load.cjs.default.js +1 -0
- package/load.cjs.js +15 -0
- package/load.cjs.mjs +2 -0
- package/load.d.ts +0 -8
- package/{load.mjs → load.esm.js} +3 -6
- package/package.json +49 -89
- package/typings.d.ts +39 -50
- package/useTheme.cjs.d.ts +2 -0
- package/useTheme.cjs.default.js +1 -0
- package/useTheme.cjs.js +13 -0
- package/useTheme.cjs.mjs +2 -0
- package/useTheme.d.ts +4 -0
- package/useTheme.esm.js +8 -0
- package/12/AnalyticsGoogle.mjs +0 -60
- package/12/DisableErrorOverlay.mjs +0 -16
- package/12/DynamicNamespaces.d.ts +0 -13
- package/12/DynamicNamespaces.mjs +0 -8
- package/12/Favicon.d.ts +0 -4
- package/12/Favicon.mjs +0 -10
- package/12/Link.d.ts +0 -10
- package/12/Link.mjs +0 -20
- package/12/NextProgress.d.ts +0 -25
- package/12/NextProgress.mjs +0 -51
- package/12/Seo.mjs +0 -30
- package/12/SeoDefaults.mjs +0 -14
- package/12/T.d.ts +0 -16
- package/12/T.mjs +0 -27
- package/12/ThemeContext.d.ts +0 -17
- package/12/ThemeContext.mjs +0 -7
- package/12/ThemeProvider.d.ts +0 -35
- package/12/ThemeProvider.mjs +0 -245
- package/12/TransText.d.ts +0 -3
- package/12/TransText.mjs +0 -4
- package/12/app/AppHead.d.ts +0 -3
- package/12/app/AppHead.mjs +0 -12
- package/12/app/AppMain.d.ts +0 -35
- package/12/app/AppMain.mjs +0 -1
- package/12/app/css/AppMain.d.ts +0 -9
- package/12/app/css/AppMain.mjs +0 -24
- package/12/app/css/AppTheme.d.ts +0 -11
- package/12/app/css/AppTheme.mjs +0 -17
- package/12/app/css/auth/index.d.ts +0 -11
- package/12/app/css/auth/index.mjs +0 -24
- package/12/app/css/index.d.ts +0 -54
- package/12/app/css/index.mjs +0 -65
- package/12/app/index.d.ts +0 -2
- package/12/app/index.mjs +0 -2
- package/12/app/sc/AppMain.d.ts +0 -11
- package/12/app/sc/AppMain.mjs +0 -58
- package/12/app/sc/AppTheme.d.ts +0 -14
- package/12/app/sc/AppTheme.mjs +0 -16
- package/12/app/sc/auth/index.d.ts +0 -11
- package/12/app/sc/auth/index.mjs +0 -24
- package/12/app/sc/index.d.ts +0 -56
- package/12/app/sc/index.mjs +0 -67
- package/12/document/Document.d.ts +0 -15
- package/12/document/Document.mjs +0 -38
- package/12/document/css/index.d.ts +0 -17
- package/12/document/css/index.mjs +0 -53
- package/12/document/index.d.ts +0 -2
- package/12/document/index.mjs +0 -2
- package/12/document/sc/index.d.ts +0 -19
- package/12/document/sc/index.mjs +0 -65
- package/12/getT.d.ts +0 -9
- package/12/getT.mjs +0 -8
- package/12/index.d.ts +0 -24
- package/12/index.mjs +0 -27
- package/12/seoBuildTags.mjs +0 -121
- package/12/to.d.ts +0 -24
- package/12/to.mjs +0 -19
- package/12/translationAsOptions.d.ts +0 -3
- package/12/translationAsOptions.mjs +0 -9
- package/12/types-i18n.d.ts +0 -118
- package/12/types-i18n.mjs +0 -12
- package/12/types-seo.d.ts +0 -7
- package/12/types-seo.mjs +0 -1
- package/12/useBackUrl.d.ts +0 -2
- package/12/useBackUrl.mjs +0 -28
- package/12/useDateFormat.d.ts +0 -7
- package/12/useDateFormat.mjs +0 -26
- package/12/useForm.d.ts +0 -27
- package/12/useForm.mjs +0 -47
- package/12/useLocale.d.ts +0 -2
- package/12/useLocale.mjs +0 -6
- package/12/useT.d.ts +0 -4
- package/12/useT.mjs +0 -39
- package/12/useTheme.d.ts +0 -7
- package/12/useTheme.mjs +0 -7
- package/12/useTo.d.ts +0 -3
- package/12/useTo.mjs +0 -8
- package/config/index.d.ts +0 -160
- package/config/index.mjs +0 -315
- package/getSiteUrl.d.ts +0 -8
- package/getSiteUrl.mjs +0 -10
- package/index.mjs +0 -2
package/12/app/sc/AppTheme.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ThemeProvider } from "styled-components";
|
|
4
|
-
import { StylesGlobal } from "@koine/react/sc";
|
|
5
|
-
/**
|
|
6
|
-
* App theme with `styled-components`
|
|
7
|
-
*/ export const AppTheme = ({ theme, children })=>{
|
|
8
|
-
return /*#__PURE__*/ _jsxs(ThemeProvider, {
|
|
9
|
-
theme: theme,
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ _jsx(StylesGlobal, {}),
|
|
12
|
-
children
|
|
13
|
-
]
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
export default AppTheme;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AppProps } from "next/app";
|
|
2
|
-
import { type AppMainProps } from "../AppMain";
|
|
3
|
-
import { type AppThemeProps } from "../AppTheme";
|
|
4
|
-
export type NextAppProps = AppProps<{
|
|
5
|
-
session: any;
|
|
6
|
-
}> & AppThemeProps & AppMainProps;
|
|
7
|
-
/**
|
|
8
|
-
* App with authentication provided by `next-auth`
|
|
9
|
-
*/
|
|
10
|
-
export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default NextApp;
|
package/12/app/sc/auth/index.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SessionProvider } from "next-auth/react";
|
|
3
|
-
import { AppHead } from "../../AppHead";
|
|
4
|
-
import { AppMain } from "../AppMain";
|
|
5
|
-
import { AppTheme } from "../AppTheme";
|
|
6
|
-
/**
|
|
7
|
-
* App with authentication provided by `next-auth`
|
|
8
|
-
*/ export const NextApp = (props)=>{
|
|
9
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ _jsx(AppHead, {}),
|
|
12
|
-
/*#__PURE__*/ _jsx(SessionProvider, {
|
|
13
|
-
session: props.pageProps.session,
|
|
14
|
-
children: /*#__PURE__*/ _jsx(AppTheme, {
|
|
15
|
-
...props,
|
|
16
|
-
children: /*#__PURE__*/ _jsx(AppMain, {
|
|
17
|
-
...props
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
]
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
export default NextApp;
|
package/12/app/sc/index.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { AppProps } from "next/app";
|
|
2
|
-
import { type AppMainProps } from "./AppMain";
|
|
3
|
-
import { type AppThemeProps } from "./AppTheme";
|
|
4
|
-
export type NextAppProps = AppProps & AppThemeProps & AppMainProps;
|
|
5
|
-
/**
|
|
6
|
-
* App
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
*
|
|
10
|
-
* ```tsx
|
|
11
|
-
* import { NextApp, NextAppProps } from "@koine/next/app/sc/auth";
|
|
12
|
-
* import { Favicon, AnalyticsGoogle } from "@koine/next";
|
|
13
|
-
* import { theme } from "src/helpers/theme";
|
|
14
|
-
* import { Layout, ProgressOverlay } from "src/components/Layout";
|
|
15
|
-
* // import "@fontsource/myfont/800.css";
|
|
16
|
-
* // import "src/helpers/theme.css";
|
|
17
|
-
*
|
|
18
|
-
* const motion = () => import("@koine/react/m/max").then((m) => m.default);
|
|
19
|
-
*
|
|
20
|
-
* export default function App(props: NextAppProps) {
|
|
21
|
-
* return (
|
|
22
|
-
* <NextApp
|
|
23
|
-
* {...props}
|
|
24
|
-
* Layout={Layout}
|
|
25
|
-
* ProgressOverlay={ProgressOverlay}
|
|
26
|
-
* theme={theme}
|
|
27
|
-
* motion={motion}
|
|
28
|
-
* seo={{
|
|
29
|
-
* titleTemplate: "%s | MyApp",
|
|
30
|
-
* defaultTitle: "MyApp",
|
|
31
|
-
* openGraph: {
|
|
32
|
-
* type: "website",
|
|
33
|
-
* locale: "en_US",
|
|
34
|
-
* url: "https://myapp.com/",
|
|
35
|
-
* site_name: "MyApp",
|
|
36
|
-
* },
|
|
37
|
-
* twitter: {
|
|
38
|
-
* handle: "@MklrNl",
|
|
39
|
-
* site: "@MyApp",
|
|
40
|
-
* cardType: "summary_large_image",
|
|
41
|
-
* },
|
|
42
|
-
* }}
|
|
43
|
-
* pre={
|
|
44
|
-
* <>
|
|
45
|
-
* <AnalyticsGoogle id="UA-xxxxxxxx-x" />
|
|
46
|
-
* <Favicon name="MyApp" color="#000000" />
|
|
47
|
-
* </>
|
|
48
|
-
* }
|
|
49
|
-
* />
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
*
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
-
export default NextApp;
|
package/12/app/sc/index.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { AppHead } from "../AppHead";
|
|
3
|
-
import { AppMain } from "./AppMain";
|
|
4
|
-
import { AppTheme } from "./AppTheme";
|
|
5
|
-
/**
|
|
6
|
-
* App
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
*
|
|
10
|
-
* ```tsx
|
|
11
|
-
* import { NextApp, NextAppProps } from "@koine/next/app/sc/auth";
|
|
12
|
-
* import { Favicon, AnalyticsGoogle } from "@koine/next";
|
|
13
|
-
* import { theme } from "src/helpers/theme";
|
|
14
|
-
* import { Layout, ProgressOverlay } from "src/components/Layout";
|
|
15
|
-
* // import "@fontsource/myfont/800.css";
|
|
16
|
-
* // import "src/helpers/theme.css";
|
|
17
|
-
*
|
|
18
|
-
* const motion = () => import("@koine/react/m/max").then((m) => m.default);
|
|
19
|
-
*
|
|
20
|
-
* export default function App(props: NextAppProps) {
|
|
21
|
-
* return (
|
|
22
|
-
* <NextApp
|
|
23
|
-
* {...props}
|
|
24
|
-
* Layout={Layout}
|
|
25
|
-
* ProgressOverlay={ProgressOverlay}
|
|
26
|
-
* theme={theme}
|
|
27
|
-
* motion={motion}
|
|
28
|
-
* seo={{
|
|
29
|
-
* titleTemplate: "%s | MyApp",
|
|
30
|
-
* defaultTitle: "MyApp",
|
|
31
|
-
* openGraph: {
|
|
32
|
-
* type: "website",
|
|
33
|
-
* locale: "en_US",
|
|
34
|
-
* url: "https://myapp.com/",
|
|
35
|
-
* site_name: "MyApp",
|
|
36
|
-
* },
|
|
37
|
-
* twitter: {
|
|
38
|
-
* handle: "@MklrNl",
|
|
39
|
-
* site: "@MyApp",
|
|
40
|
-
* cardType: "summary_large_image",
|
|
41
|
-
* },
|
|
42
|
-
* }}
|
|
43
|
-
* pre={
|
|
44
|
-
* <>
|
|
45
|
-
* <AnalyticsGoogle id="UA-xxxxxxxx-x" />
|
|
46
|
-
* <Favicon name="MyApp" color="#000000" />
|
|
47
|
-
* </>
|
|
48
|
-
* }
|
|
49
|
-
* />
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
*
|
|
53
|
-
* ```
|
|
54
|
-
*/ export const NextApp = (props)=>{
|
|
55
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
56
|
-
children: [
|
|
57
|
-
/*#__PURE__*/ _jsx(AppHead, {}),
|
|
58
|
-
/*#__PURE__*/ _jsx(AppTheme, {
|
|
59
|
-
...props,
|
|
60
|
-
children: /*#__PURE__*/ _jsx(AppMain, {
|
|
61
|
-
...props
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
export default NextApp;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import NextDocument from "next/document";
|
|
2
|
-
/**
|
|
3
|
-
* Next Document wrapper for bare projects
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
*
|
|
7
|
-
* in your `myapp/pages/_document.tsx`:
|
|
8
|
-
* ```tsx
|
|
9
|
-
* export { Document as default } from "@koine/next/document";
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare class Document extends NextDocument {
|
|
13
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
}
|
|
15
|
-
export default Document;
|
package/12/document/Document.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import NextDocument, { Head, Html, Main, NextScript } from "next/document";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import Meta from "@koine/react/Meta";
|
|
5
|
-
import NoJs from "@koine/react/NoJs";
|
|
6
|
-
/**
|
|
7
|
-
* Next Document wrapper for bare projects
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
*
|
|
11
|
-
* in your `myapp/pages/_document.tsx`:
|
|
12
|
-
* ```tsx
|
|
13
|
-
* export { Document as default } from "@koine/next/document";
|
|
14
|
-
* ```
|
|
15
|
-
*/ export class Document extends NextDocument {
|
|
16
|
-
render() {
|
|
17
|
-
const { locale, defaultLocale } = this.props.__NEXT_DATA__;
|
|
18
|
-
return /*#__PURE__*/ _jsxs(Html, {
|
|
19
|
-
lang: locale || defaultLocale,
|
|
20
|
-
className: "no-js",
|
|
21
|
-
children: [
|
|
22
|
-
/*#__PURE__*/ _jsxs(Head, {
|
|
23
|
-
children: [
|
|
24
|
-
/*#__PURE__*/ _jsx(Meta, {}),
|
|
25
|
-
/*#__PURE__*/ _jsx(NoJs, {})
|
|
26
|
-
]
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ _jsxs("body", {
|
|
29
|
-
children: [
|
|
30
|
-
/*#__PURE__*/ _jsx(Main, {}),
|
|
31
|
-
/*#__PURE__*/ _jsx(NextScript, {})
|
|
32
|
-
]
|
|
33
|
-
})
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export default Document;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import NextDocument from "next/document";
|
|
2
|
-
/**
|
|
3
|
-
* Next Document wrapper for `css/tailwind` based projects
|
|
4
|
-
*
|
|
5
|
-
* Uses cookie to manage the current theme
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
*
|
|
9
|
-
* in your `myapp/pages/_document.tsx`:
|
|
10
|
-
* ```tsx
|
|
11
|
-
* export { Document as default } from "@koine/next/document/css";
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare class Document extends NextDocument {
|
|
15
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
}
|
|
17
|
-
export default Document;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import NextDocument, { Head, // type DocumentInitialProps,
|
|
3
|
-
Html, Main, NextScript } from "next/document";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import Meta from "@koine/react/Meta";
|
|
6
|
-
import NoJs from "@koine/react/NoJs";
|
|
7
|
-
// import { getInitialThemeFromRequest, ThemeVanillaValue } from "@koine/react/sc"; // FIXME: this should be imported from another entrypoint
|
|
8
|
-
/**
|
|
9
|
-
* Next Document wrapper for `css/tailwind` based projects
|
|
10
|
-
*
|
|
11
|
-
* Uses cookie to manage the current theme
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
*
|
|
15
|
-
* in your `myapp/pages/_document.tsx`:
|
|
16
|
-
* ```tsx
|
|
17
|
-
* export { Document as default } from "@koine/next/document/css";
|
|
18
|
-
* ```
|
|
19
|
-
*/ export class Document extends NextDocument {
|
|
20
|
-
// static override async getInitialProps(
|
|
21
|
-
// ctx: DocumentContext
|
|
22
|
-
// ): Promise<DocumentInitialProps & { theme: ThemeVanillaValue }> {
|
|
23
|
-
// const initialProps = await NextDocument.getInitialProps(ctx);
|
|
24
|
-
// return {
|
|
25
|
-
// ...initialProps,
|
|
26
|
-
// theme: getInitialThemeFromRequest(
|
|
27
|
-
// ctx.req?.headers.cookie /* || document?.cookie */ || ""
|
|
28
|
-
// ),
|
|
29
|
-
// };
|
|
30
|
-
// }
|
|
31
|
-
render() {
|
|
32
|
-
const { locale, defaultLocale } = this.props.__NEXT_DATA__;
|
|
33
|
-
return /*#__PURE__*/ _jsxs(Html, {
|
|
34
|
-
lang: locale || defaultLocale,
|
|
35
|
-
className: "no-js",
|
|
36
|
-
children: [
|
|
37
|
-
/*#__PURE__*/ _jsxs(Head, {
|
|
38
|
-
children: [
|
|
39
|
-
/*#__PURE__*/ _jsx(Meta, {}),
|
|
40
|
-
/*#__PURE__*/ _jsx(NoJs, {})
|
|
41
|
-
]
|
|
42
|
-
}),
|
|
43
|
-
/*#__PURE__*/ _jsxs("body", {
|
|
44
|
-
children: [
|
|
45
|
-
/*#__PURE__*/ _jsx(Main, {}),
|
|
46
|
-
/*#__PURE__*/ _jsx(NextScript, {})
|
|
47
|
-
]
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export default Document;
|
package/12/document/index.d.ts
DELETED
package/12/document/index.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import NextDocument, { DocumentContext, type DocumentInitialProps } from "next/document";
|
|
2
|
-
/**
|
|
3
|
-
* Next Document wrapper for `styled-components` based projects
|
|
4
|
-
*
|
|
5
|
-
* For typescript safety of this component
|
|
6
|
-
* @see https://bit.ly/3ceuF8m
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
*
|
|
10
|
-
* in your `myapp/pages/_document.tsx`:
|
|
11
|
-
* ```tsx
|
|
12
|
-
* export { Document as default } from "@koine/next/document/sc";
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare class Document extends NextDocument {
|
|
16
|
-
static getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps>;
|
|
17
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
}
|
|
19
|
-
export default Document;
|
package/12/document/sc/index.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* ? eslint-disable @next/next/no-document-import-in-page */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import NextDocument, { Head, Html, Main, NextScript } from "next/document";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { ServerStyleSheet } from "styled-components";
|
|
5
|
-
import Meta from "@koine/react/Meta";
|
|
6
|
-
import NoJs from "@koine/react/NoJs";
|
|
7
|
-
/**
|
|
8
|
-
* Next Document wrapper for `styled-components` based projects
|
|
9
|
-
*
|
|
10
|
-
* For typescript safety of this component
|
|
11
|
-
* @see https://bit.ly/3ceuF8m
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
*
|
|
15
|
-
* in your `myapp/pages/_document.tsx`:
|
|
16
|
-
* ```tsx
|
|
17
|
-
* export { Document as default } from "@koine/next/document/sc";
|
|
18
|
-
* ```
|
|
19
|
-
*/ export class Document extends NextDocument {
|
|
20
|
-
static async getInitialProps(ctx) {
|
|
21
|
-
const sheet = new ServerStyleSheet();
|
|
22
|
-
const originalRenderPage = ctx.renderPage;
|
|
23
|
-
try {
|
|
24
|
-
ctx.renderPage = ()=>originalRenderPage({
|
|
25
|
-
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ _jsx(App, {
|
|
26
|
-
...props
|
|
27
|
-
}))
|
|
28
|
-
});
|
|
29
|
-
const initialProps = await NextDocument.getInitialProps(ctx);
|
|
30
|
-
return {
|
|
31
|
-
...initialProps,
|
|
32
|
-
styles: /*#__PURE__*/ _jsxs(React.Fragment, {
|
|
33
|
-
children: [
|
|
34
|
-
initialProps.styles,
|
|
35
|
-
sheet.getStyleElement()
|
|
36
|
-
]
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
} finally{
|
|
40
|
-
sheet.seal();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
render() {
|
|
44
|
-
const { locale, defaultLocale } = this.props.__NEXT_DATA__;
|
|
45
|
-
return /*#__PURE__*/ _jsxs(Html, {
|
|
46
|
-
lang: locale || defaultLocale,
|
|
47
|
-
className: "no-js",
|
|
48
|
-
children: [
|
|
49
|
-
/*#__PURE__*/ _jsxs(Head, {
|
|
50
|
-
children: [
|
|
51
|
-
/*#__PURE__*/ _jsx(Meta, {}),
|
|
52
|
-
/*#__PURE__*/ _jsx(NoJs, {})
|
|
53
|
-
]
|
|
54
|
-
}),
|
|
55
|
-
/*#__PURE__*/ _jsxs("body", {
|
|
56
|
-
children: [
|
|
57
|
-
/*#__PURE__*/ _jsx(Main, {}),
|
|
58
|
-
/*#__PURE__*/ _jsx(NextScript, {})
|
|
59
|
-
]
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export default Document;
|
package/12/getT.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Translate, TranslateNamespace } from "./types-i18n";
|
|
2
|
-
export type GetT = <TNamespace extends TranslateNamespace | undefined = undefined>(locale?: string, namespace?: TNamespace) => Promise<Translate<TNamespace>>;
|
|
3
|
-
/**
|
|
4
|
-
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
5
|
-
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
6
|
-
* in your `tsconfig.json` file.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getT: GetT;
|
|
9
|
-
export default getT;
|
package/12/getT.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */ import getTranslation from "next-translate/getT";
|
|
3
|
-
/**
|
|
4
|
-
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
5
|
-
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
6
|
-
* in your `tsconfig.json` file.
|
|
7
|
-
*/ export const getT = getTranslation;
|
|
8
|
-
export default getT;
|
package/12/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { AnalyticsGoogle, type AnalyticsGoogleProps } from "./AnalyticsGoogle";
|
|
2
|
-
export { DisableErrorOverlay } from "./DisableErrorOverlay";
|
|
3
|
-
export { DynamicNamespaces, type DynamicNamespacesProps, } from "./DynamicNamespaces";
|
|
4
|
-
export { Favicon, type FaviconProps } from "./Favicon";
|
|
5
|
-
export { getT, type GetT } from "./getT";
|
|
6
|
-
export { Link, type LinkProps } from "./Link";
|
|
7
|
-
export { NextProgress, type NextProgressProps } from "./NextProgress";
|
|
8
|
-
export { Seo, type SeoProps } from "./Seo";
|
|
9
|
-
export { SeoDefaults, type SeoDefaultsProps } from "./SeoDefaults";
|
|
10
|
-
export { T, type TProps } from "./T";
|
|
11
|
-
export { ThemeContext, type ThemeContextProps } from "./ThemeContext";
|
|
12
|
-
export { ThemeProvider, type ThemeProviderProps } from "./ThemeProvider";
|
|
13
|
-
export { to, type ToArgs, type ToTranslate, type ToDynamicRoute, type ToStaticRoute, } from "./to";
|
|
14
|
-
export { translationAsOptions } from "./translationAsOptions";
|
|
15
|
-
export { TransText } from "./TransText";
|
|
16
|
-
export type { Translate, TranslateDefault, TranslateLoose, TranslateNamespace, TranslateNamespaced, TranslatedRoute, TranslatedRoutesChildrenOf, TranslationOptions, TranslationQuery, TranslationShortcut, TranslationsAllPaths, TranslationsDictionary, TranslationsDictionaryDefault, TranslationsPaths, } from "./types-i18n";
|
|
17
|
-
export type { SeoData } from "./types-seo";
|
|
18
|
-
export { useBackUrl } from "./useBackUrl";
|
|
19
|
-
export { useDateFormat } from "./useDateFormat";
|
|
20
|
-
export { useForm } from "./useForm";
|
|
21
|
-
export { useLocale } from "./useLocale";
|
|
22
|
-
export { useT } from "./useT";
|
|
23
|
-
export { useTheme, type UseThemeProps } from "./useTheme";
|
|
24
|
-
export { useTo } from "./useTo";
|
package/12/index.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export { AnalyticsGoogle } from "./AnalyticsGoogle";
|
|
2
|
-
export { DisableErrorOverlay } from "./DisableErrorOverlay";
|
|
3
|
-
export { DynamicNamespaces } from "./DynamicNamespaces";
|
|
4
|
-
export { Favicon } from "./Favicon";
|
|
5
|
-
export { getT } from "./getT";
|
|
6
|
-
export { Link } from "./Link";
|
|
7
|
-
export { NextProgress } from "./NextProgress";
|
|
8
|
-
export { Seo } from "./Seo";
|
|
9
|
-
// export {
|
|
10
|
-
// seoBuildTags,
|
|
11
|
-
// type LinkTag,
|
|
12
|
-
// type MetaTag
|
|
13
|
-
// } from "./seoBuildTags";
|
|
14
|
-
export { SeoDefaults } from "./SeoDefaults";
|
|
15
|
-
export { T } from "./T";
|
|
16
|
-
export { ThemeContext } from "./ThemeContext";
|
|
17
|
-
export { ThemeProvider } from "./ThemeProvider";
|
|
18
|
-
export { to } from "./to";
|
|
19
|
-
export { translationAsOptions } from "./translationAsOptions";
|
|
20
|
-
export { TransText } from "./TransText";
|
|
21
|
-
export { useBackUrl } from "./useBackUrl";
|
|
22
|
-
export { useDateFormat } from "./useDateFormat";
|
|
23
|
-
export { useForm } from "./useForm";
|
|
24
|
-
export { useLocale } from "./useLocale";
|
|
25
|
-
export { useT } from "./useT";
|
|
26
|
-
export { useTheme } from "./useTheme";
|
|
27
|
-
export { useTo } from "./useTo";
|
package/12/seoBuildTags.mjs
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import isArray from "@koine/utils/isArray";
|
|
4
|
-
const defaults = {
|
|
5
|
-
tplTitle: ""
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Comparing to `next-seo` we do a couple of things in addition while many
|
|
9
|
-
* others are removed.
|
|
10
|
-
*
|
|
11
|
-
* - Add `seo` meta object coming from a CMS probably
|
|
12
|
-
* - Add `ogimage` and `openGraph.image` as single image source
|
|
13
|
-
* - Add `og` alias to define `openGraph`
|
|
14
|
-
* - Add check for `title` equal to `templateTitle` to avoid meta titles like
|
|
15
|
-
* "My site | My site" often happening in homepages
|
|
16
|
-
* - Remove the open graph videos and images
|
|
17
|
-
*
|
|
18
|
-
* - Shorter code
|
|
19
|
-
*
|
|
20
|
-
* @returns
|
|
21
|
-
*/ export const seoBuildTags = ({ seo, hidden, keywords, title = "", titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates = [], twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags } = {})=>{
|
|
22
|
-
const id = "seo-";
|
|
23
|
-
const render = [];
|
|
24
|
-
const $names = {};
|
|
25
|
-
const $properties = {};
|
|
26
|
-
if (titleTemplate) {
|
|
27
|
-
defaults.tplTitle = titleTemplate;
|
|
28
|
-
}
|
|
29
|
-
title = title || seo?.title || "";
|
|
30
|
-
if (title) {
|
|
31
|
-
if (defaults.tplTitle && defaults.tplTitle !== title) {
|
|
32
|
-
title = defaults.tplTitle.replace(/%s/g, title);
|
|
33
|
-
}
|
|
34
|
-
} else if (defaultTitle) {
|
|
35
|
-
title = defaultTitle;
|
|
36
|
-
}
|
|
37
|
-
if (title) {
|
|
38
|
-
render.push(/*#__PURE__*/ _jsx("title", {
|
|
39
|
-
children: title
|
|
40
|
-
}, id + "title"));
|
|
41
|
-
$properties["og:title"] = title; // overridden later...
|
|
42
|
-
}
|
|
43
|
-
$names["robots"] = `${noindex || hidden ? "noindex" : "index"},${nofollow || hidden ? "nofollow" : "follow"}`;
|
|
44
|
-
description = description || seo?.description;
|
|
45
|
-
if (description) {
|
|
46
|
-
$names["description"] = description;
|
|
47
|
-
$properties["og:description"] = description; // overridden later...
|
|
48
|
-
}
|
|
49
|
-
keywords = keywords || seo?.keywords;
|
|
50
|
-
if (keywords) {
|
|
51
|
-
$names["keywords"] = isArray(keywords) ? keywords.join(", ") : keywords;
|
|
52
|
-
}
|
|
53
|
-
if (languageAlternates?.length > 0) {
|
|
54
|
-
languageAlternates.forEach(({ href, hrefLang })=>{
|
|
55
|
-
render.push(/*#__PURE__*/ _jsx("link", {
|
|
56
|
-
rel: "alternate",
|
|
57
|
-
hrefLang: hrefLang,
|
|
58
|
-
href: href
|
|
59
|
-
}, id + "languageAlternate-" + hrefLang));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (canonical) {
|
|
63
|
-
render.push(/*#__PURE__*/ _jsx("link", {
|
|
64
|
-
rel: "canonical",
|
|
65
|
-
href: canonical
|
|
66
|
-
}, id + "canonical"));
|
|
67
|
-
$properties["og:url"] = canonical;
|
|
68
|
-
}
|
|
69
|
-
if (facebook?.appId) $properties["fb:app_id"] = facebook.appId;
|
|
70
|
-
if (twitter) {
|
|
71
|
-
if (twitter.cardType) $names["twitter:card"] = twitter.cardType;
|
|
72
|
-
if (twitter.site) $names["twitter:site"] = twitter.site;
|
|
73
|
-
if (twitter.handle) $names["twitter:creator"] = twitter.handle;
|
|
74
|
-
}
|
|
75
|
-
const og = ogAlias || openGraph;
|
|
76
|
-
if (og?.title) $properties["og:title"] = og?.title;
|
|
77
|
-
if (og?.description) $properties["og:description"] = og?.description;
|
|
78
|
-
if (og?.url) $properties["og:url"] = og.url;
|
|
79
|
-
if (og?.type) $properties["og:type"] = og.type.toLowerCase();
|
|
80
|
-
if (og?.locale) $properties["og:locale"] = og.locale;
|
|
81
|
-
if (og?.siteName) $properties["og:siteName"] = og.siteName;
|
|
82
|
-
const ogimage = og?.image || seo?.ogimage;
|
|
83
|
-
if (ogimage) $properties["og:image"] = ogimage;
|
|
84
|
-
Object.keys($names).forEach((key)=>{
|
|
85
|
-
render.push(/*#__PURE__*/ _jsx("meta", {
|
|
86
|
-
name: key,
|
|
87
|
-
content: $names[key]
|
|
88
|
-
}, id + "name-" + key));
|
|
89
|
-
});
|
|
90
|
-
Object.keys($properties).forEach((key)=>{
|
|
91
|
-
render.push(/*#__PURE__*/ _jsx("meta", {
|
|
92
|
-
property: key,
|
|
93
|
-
content: $properties[key]
|
|
94
|
-
}, id + "prop-" + +key));
|
|
95
|
-
});
|
|
96
|
-
if (metaTags && metaTags.length > 0) {
|
|
97
|
-
metaTags.forEach((tag)=>{
|
|
98
|
-
render.push(/*#__PURE__*/ _jsx("meta", {
|
|
99
|
-
...tag
|
|
100
|
-
}, id + "meta-" + (tag.name || tag.property || tag.httpEquiv)));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
if (linkTags?.length) {
|
|
104
|
-
linkTags.forEach((tag)=>{
|
|
105
|
-
render.push(/*#__PURE__*/ _jsx("link", {
|
|
106
|
-
...tag
|
|
107
|
-
}, id + "link-" + (tag.href || tag.rel)));
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
// TODO: alternates and canonical
|
|
111
|
-
// canonical = 'https://www.domain.com/';
|
|
112
|
-
// languageAlternates={[{
|
|
113
|
-
// hrefLang: 'en',
|
|
114
|
-
// href: 'https://www.domain.com/en',
|
|
115
|
-
// }]}
|
|
116
|
-
// <link rel="alternate" hreflang="x-default" href="https://www.domain.com/nl/">
|
|
117
|
-
// <link rel="alternate" hreflang="nl" href="https://www.domain.com/nl/">
|
|
118
|
-
// <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
|
|
119
|
-
return render;
|
|
120
|
-
};
|
|
121
|
-
export default seoBuildTags;
|
package/12/to.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { TranslateNamespaced, TranslatedRoute } from "./types-i18n";
|
|
2
|
-
type OnlyStatic<T extends string> = T extends `${string}.[${string}].${string}` | `${string}.[${string}]` | `[${string}].${string}` | `[${string}]` ? never : T;
|
|
3
|
-
type OnlyDynamic<T extends string> = T extends `${string}.[${string}].${string}` | `${string}.[${string}]` | `[${string}].${string}` | `[${string}]` ? T : never;
|
|
4
|
-
/**
|
|
5
|
-
* @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types#router-params-parsing)
|
|
6
|
-
*/
|
|
7
|
-
type ExtractRouteParams<T extends string> = string extends T ? Record<string, string> : T extends `${infer _Start}[${infer Param}].${infer Rest}` ? {
|
|
8
|
-
[k in Param | keyof ExtractRouteParams<Rest>]: string | number;
|
|
9
|
-
} : T extends `${infer _Start}[${infer Param}]` ? {
|
|
10
|
-
[k in Param]: string | number;
|
|
11
|
-
} : {};
|
|
12
|
-
export type ToTranslate = TranslateNamespaced<"~">;
|
|
13
|
-
export type ToStaticRoute = OnlyStatic<TranslatedRoute>;
|
|
14
|
-
export type ToDynamicRoute = OnlyDynamic<TranslatedRoute>;
|
|
15
|
-
export type ToArgs = [ToStaticRoute] | [ToDynamicRoute, ExtractRouteParams<ToDynamicRoute>];
|
|
16
|
-
/**
|
|
17
|
-
* `To` named route utility. It accept either a single argument if that is a static
|
|
18
|
-
* route name or a second argument that interpolates the dynamic portions of
|
|
19
|
-
* the route name. The types of these portions are automatically inferred.
|
|
20
|
-
*
|
|
21
|
-
* @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types)
|
|
22
|
-
*/
|
|
23
|
-
export declare function to(...args: [ToTranslate, ...ToArgs]): string;
|
|
24
|
-
export default to;
|
package/12/to.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `To` named route utility. It accept either a single argument if that is a static
|
|
3
|
-
* route name or a second argument that interpolates the dynamic portions of
|
|
4
|
-
* the route name. The types of these portions are automatically inferred.
|
|
5
|
-
*
|
|
6
|
-
* @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types)
|
|
7
|
-
*/ export function to(...args) {
|
|
8
|
-
let relative = "";
|
|
9
|
-
const [t] = args;
|
|
10
|
-
if (args.length === 3) {
|
|
11
|
-
if (args[2]) {
|
|
12
|
-
relative = t(args[1], args[2]).replace("*", "");
|
|
13
|
-
}
|
|
14
|
-
} else if (args.length === 2) {
|
|
15
|
-
relative = t(args[1]);
|
|
16
|
-
}
|
|
17
|
-
return relative;
|
|
18
|
-
}
|
|
19
|
-
export default to;
|