@koine/next 2.0.0-beta.1 → 2.0.0-beta.11
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.mjs +41 -15
- package/12/DisableErrorOverlay.mjs +8 -5
- package/12/DynamicNamespaces.d.ts +1 -1
- package/12/DynamicNamespaces.mjs +1 -2
- package/12/Favicon.mjs +6 -2
- package/12/Link.d.ts +1 -1
- package/12/Link.mjs +14 -6
- package/12/NextProgress.mjs +26 -17
- package/12/Seo.d.ts +1 -1
- package/12/Seo.mjs +5 -4
- package/12/SeoDefaults.d.ts +1 -1
- package/12/SeoDefaults.mjs +5 -3
- package/12/T.d.ts +1 -1
- package/12/T.mjs +20 -6
- package/12/ThemeContext.mjs +3 -3
- package/12/ThemeProvider.mjs +139 -129
- package/12/TransText.mjs +1 -1
- package/12/app/AppHead.mjs +8 -2
- package/12/app/AppMain.d.ts +4 -4
- package/12/app/AppMain.mjs +1 -1
- package/12/app/css/AppMain.mjs +15 -5
- package/12/app/css/AppTheme.d.ts +1 -1
- package/12/app/css/AppTheme.mjs +7 -4
- package/12/app/css/auth/index.d.ts +1 -1
- package/12/app/css/auth/index.mjs +17 -6
- package/12/app/css/index.d.ts +1 -1
- package/12/app/css/index.mjs +14 -6
- package/12/app/sc/AppMain.mjs +46 -13
- package/12/app/sc/AppTheme.d.ts +1 -1
- package/12/app/sc/AppTheme.mjs +9 -4
- package/12/app/sc/auth/index.d.ts +1 -1
- package/12/app/sc/auth/index.mjs +17 -6
- package/12/app/sc/index.d.ts +1 -1
- package/12/app/sc/index.mjs +14 -6
- package/12/document/Document.mjs +24 -14
- package/12/document/css/index.mjs +26 -18
- package/12/document/sc/index.mjs +46 -45
- package/12/getT.mjs +2 -4
- package/12/index.mjs +2 -2
- package/12/seoBuildTags.mjs +59 -55
- package/12/to.mjs +4 -10
- package/12/translationAsOptions.mjs +6 -6
- package/12/types-i18n.mjs +1 -2
- package/12/types-seo.mjs +1 -1
- package/12/useBackUrl.mjs +8 -8
- package/12/useDateFormat.mjs +15 -28
- package/12/useForm.d.ts +1 -1
- package/12/useForm.mjs +25 -13
- package/12/useT.d.ts +1 -1
- package/12/useT.mjs +32 -14
- package/12/useTheme.mjs +1 -2
- package/12/useTo.mjs +3 -10
- package/README.md +1 -1
- package/config/index.mjs +187 -204
- package/getSiteUrl.mjs +2 -4
- package/load.mjs +3 -4
- package/package.json +25 -18
- package/typings.d.ts +60 -0
- package/12/AnalyticsGoogle.js +0 -39
- package/12/DisableErrorOverlay.js +0 -18
- package/12/DynamicNamespaces.js +0 -13
- package/12/Favicon.js +0 -10
- package/12/Link.js +0 -15
- package/12/NextProgress.js +0 -46
- package/12/Seo.js +0 -34
- package/12/SeoDefaults.js +0 -17
- package/12/T.js +0 -17
- package/12/ThemeContext.js +0 -10
- package/12/ThemeProvider.js +0 -239
- package/12/TransText.js +0 -8
- package/12/app/AppHead.js +0 -11
- package/12/app/AppMain.js +0 -2
- package/12/app/css/AppMain.js +0 -18
- package/12/app/css/AppTheme.js +0 -18
- package/12/app/css/auth/index.js +0 -17
- package/12/app/css/auth/package.json +0 -6
- package/12/app/css/index.js +0 -61
- package/12/app/css/package.json +0 -6
- package/12/app/index.js +0 -5
- package/12/app/package.json +0 -6
- package/12/app/sc/AppMain.js +0 -29
- package/12/app/sc/AppTheme.js +0 -15
- package/12/app/sc/auth/index.js +0 -17
- package/12/app/sc/auth/package.json +0 -6
- package/12/app/sc/index.js +0 -63
- package/12/app/sc/package.json +0 -6
- package/12/document/Document.js +0 -31
- package/12/document/css/index.js +0 -45
- package/12/document/css/package.json +0 -6
- package/12/document/index.js +0 -7
- package/12/document/package.json +0 -6
- package/12/document/sc/index.js +0 -67
- package/12/document/sc/package.json +0 -6
- package/12/getT.js +0 -14
- package/12/index.js +0 -52
- package/12/package.json +0 -6
- package/12/seoBuildTags.js +0 -121
- package/12/to.js +0 -29
- package/12/translationAsOptions.js +0 -13
- package/12/types-i18n.js +0 -14
- package/12/types-seo.js +0 -2
- package/12/useBackUrl.js +0 -33
- package/12/useDateFormat.js +0 -43
- package/12/useForm.js +0 -39
- package/12/useLocale.js +0 -11
- package/12/useT.js +0 -44
- package/12/useTheme.js +0 -12
- package/12/useTo.js +0 -19
- package/config/index.js +0 -343
- package/config/package.json +0 -6
- package/getSiteUrl.js +0 -17
- package/index.js +0 -7
- package/load.js +0 -18
package/12/AnalyticsGoogle.mjs
CHANGED
|
@@ -1,34 +1,60 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
3
|
import { useRouter } from "next/router";
|
|
5
4
|
import Script from "next/script";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
6
|
import gtagPageview from "@koine/browser/gtagPageview";
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _d = useState(false), routed = _d[0], setRouted = _d[1];
|
|
7
|
+
export const AnalyticsGoogle = ({ id })=>{
|
|
8
|
+
const uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
|
|
9
|
+
const { events, asPath, query } = useRouter();
|
|
10
|
+
const [ready, setReady] = useState(false);
|
|
11
|
+
const [routed, setRouted] = useState(false);
|
|
13
12
|
// const [url, setUrl] = useState("");
|
|
14
|
-
useEffect(
|
|
15
|
-
|
|
13
|
+
useEffect(()=>{
|
|
14
|
+
const handleRouteChange = ()=>{
|
|
16
15
|
setRouted(true);
|
|
17
16
|
};
|
|
18
17
|
events.on("routeChangeComplete", handleRouteChange);
|
|
19
|
-
return
|
|
18
|
+
return ()=>{
|
|
20
19
|
events.off("routeChangeComplete", handleRouteChange);
|
|
21
20
|
};
|
|
22
|
-
}, [
|
|
23
|
-
|
|
21
|
+
}, [
|
|
22
|
+
events
|
|
23
|
+
]);
|
|
24
|
+
useEffect(()=>{
|
|
24
25
|
if (routed && ready && asPath) {
|
|
25
26
|
// const search = query;
|
|
26
27
|
gtagPageview(asPath);
|
|
27
28
|
}
|
|
28
|
-
}, [
|
|
29
|
+
}, [
|
|
30
|
+
asPath,
|
|
31
|
+
query,
|
|
32
|
+
routed,
|
|
33
|
+
ready
|
|
34
|
+
]);
|
|
29
35
|
if (!uid) {
|
|
30
36
|
return null;
|
|
31
37
|
}
|
|
32
|
-
return
|
|
38
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ _jsx(Script, {
|
|
41
|
+
id: "google-tagmanager",
|
|
42
|
+
src: `https://www.googletagmanager.com/gtag/js?id=${id}`,
|
|
43
|
+
strategy: "afterInteractive",
|
|
44
|
+
onLoad: ()=>setReady(true)
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ _jsx(Script, {
|
|
47
|
+
id: "google-analytics",
|
|
48
|
+
strategy: "afterInteractive",
|
|
49
|
+
children: `
|
|
50
|
+
window.dataLayer = window.dataLayer || [];
|
|
51
|
+
function gtag(){window.dataLayer.push(arguments);}
|
|
52
|
+
gtag('js', new Date());
|
|
53
|
+
|
|
54
|
+
gtag('config', '${id}', { 'send_page_view': false });
|
|
55
|
+
`
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
33
59
|
};
|
|
34
60
|
export default AnalyticsGoogle;
|
|
@@ -4,10 +4,13 @@ import Head from "next/head";
|
|
|
4
4
|
* Disable error overlay during `dev`
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
*/ export const DisableErrorOverlay = ()=>{
|
|
8
|
+
return /*#__PURE__*/ _jsx(Head, {
|
|
9
|
+
children: process.env["NODE_ENV"] !== "production" && /*#__PURE__*/ _jsx("script", {
|
|
10
|
+
dangerouslySetInnerHTML: {
|
|
11
|
+
__html: `window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});`
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
});
|
|
12
15
|
};
|
|
13
16
|
export default DisableErrorOverlay;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
|
|
2
1
|
import type { DynamicNamespacesProps as BaseDynamicNamespacesProps } from "next-translate";
|
|
2
|
+
import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
|
|
3
3
|
import type { TranslateNamespace } from "./types-i18n";
|
|
4
4
|
export type DynamicNamespacesProps = Omit<BaseDynamicNamespacesProps, "namespaces"> & {
|
|
5
5
|
namespaces: TranslateNamespace[];
|
package/12/DynamicNamespaces.mjs
CHANGED
|
@@ -4,6 +4,5 @@ import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
|
|
|
4
4
|
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
5
5
|
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
6
6
|
* in your `tsconfig.json` file.
|
|
7
|
-
*/
|
|
8
|
-
export var DynamicNamespaces = BaseDynamicNamespaces;
|
|
7
|
+
*/ export const DynamicNamespaces = BaseDynamicNamespaces;
|
|
9
8
|
export default DynamicNamespaces;
|
package/12/Favicon.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import Head from "next/head";
|
|
3
|
+
import React from "react";
|
|
4
4
|
import FaviconTags from "@koine/react/FaviconTags";
|
|
5
|
-
export
|
|
5
|
+
export const Favicon = (props)=>/*#__PURE__*/ _jsx(Head, {
|
|
6
|
+
children: /*#__PURE__*/ _jsx(FaviconTags, {
|
|
7
|
+
...props
|
|
8
|
+
})
|
|
9
|
+
});
|
|
6
10
|
export default Favicon;
|
package/12/Link.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { LinkProps as NextLinkProps } from "next/link";
|
|
2
|
+
import React from "react";
|
|
3
3
|
export type LinkProps = Omit<React.ComponentPropsWithRef<"a">, "href"> & Omit<NextLinkProps, "as" | "passHref" | "children"> & {
|
|
4
4
|
Link?: React.ComponentType<any>;
|
|
5
5
|
};
|
package/12/Link.mjs
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
2
|
import NextLink from "next/link";
|
|
3
|
+
import React, { forwardRef } from "react";
|
|
5
4
|
/**
|
|
6
5
|
* @see https://next.js.org/docs/api-reference/next/link
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
*/ export const Link = /*#__PURE__*/ forwardRef(function Link({ href, prefetch, replace, scroll, shallow, locale, Link = "span", ...props }, ref) {
|
|
7
|
+
return /*#__PURE__*/ _jsx(NextLink, {
|
|
8
|
+
href: href,
|
|
9
|
+
replace: replace,
|
|
10
|
+
scroll: scroll,
|
|
11
|
+
shallow: shallow,
|
|
12
|
+
locale: locale,
|
|
13
|
+
passHref: true,
|
|
14
|
+
children: /*#__PURE__*/ _jsx(Link, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
...props
|
|
17
|
+
})
|
|
18
|
+
});
|
|
11
19
|
});
|
|
12
20
|
export default Link;
|
package/12/NextProgress.mjs
CHANGED
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
3
|
import { useRouter } from "next/router";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
export const NextProgress = ({ startAt = 0.3, showOnShallow = true, stopDelayMs = 200, Overlay = "div" })=>{
|
|
6
|
+
const { events } = useRouter();
|
|
8
7
|
// const [progress, setProgress] = useState(0);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var shallow = _a.shallow;
|
|
8
|
+
const [running, setRunning] = useState(false);
|
|
9
|
+
const timer = useRef(null);
|
|
10
|
+
const routeChangeStart = useCallback((_, { shallow })=>{
|
|
13
11
|
if (!shallow || showOnShallow) {
|
|
14
12
|
// setProgress(startAt);
|
|
15
13
|
setRunning(true);
|
|
16
14
|
}
|
|
17
|
-
}, [
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
}, [
|
|
16
|
+
showOnShallow
|
|
17
|
+
]);
|
|
18
|
+
const routeChangeEnd = useCallback((_, { shallow })=>{
|
|
20
19
|
if (!shallow || showOnShallow) {
|
|
21
20
|
if (timer.current) {
|
|
22
21
|
clearTimeout(timer.current);
|
|
23
22
|
}
|
|
24
|
-
timer.current = setTimeout(
|
|
23
|
+
timer.current = setTimeout(()=>{
|
|
25
24
|
// setProgress(100);
|
|
26
25
|
setRunning(false);
|
|
27
26
|
}, stopDelayMs);
|
|
28
27
|
}
|
|
29
|
-
}, [
|
|
30
|
-
|
|
28
|
+
}, [
|
|
29
|
+
showOnShallow,
|
|
30
|
+
stopDelayMs,
|
|
31
|
+
timer
|
|
32
|
+
]);
|
|
33
|
+
useEffect(()=>{
|
|
31
34
|
events.on("routeChangeStart", routeChangeStart);
|
|
32
35
|
events.on("routeChangeComplete", routeChangeEnd);
|
|
33
36
|
events.on("routeChangeError", routeChangeEnd);
|
|
34
|
-
return
|
|
37
|
+
return ()=>{
|
|
35
38
|
events.off("routeChangeStart", routeChangeStart);
|
|
36
39
|
events.off("routeChangeComplete", routeChangeEnd);
|
|
37
40
|
events.off("routeChangeError", routeChangeEnd);
|
|
38
41
|
};
|
|
39
|
-
}, [
|
|
40
|
-
|
|
42
|
+
}, [
|
|
43
|
+
events,
|
|
44
|
+
routeChangeStart,
|
|
45
|
+
routeChangeEnd
|
|
46
|
+
]);
|
|
47
|
+
return /*#__PURE__*/ _jsx(Overlay, {
|
|
48
|
+
running: running
|
|
49
|
+
});
|
|
41
50
|
};
|
|
42
51
|
export default NextProgress;
|
package/12/Seo.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextSeoProps } from "next-seo/lib/types";
|
|
2
|
+
import { type LinkTag, type MetaTag } from "./seoBuildTags";
|
|
2
3
|
import type { SeoData } from "./types-seo";
|
|
3
|
-
import { type MetaTag, type LinkTag } from "./seoBuildTags";
|
|
4
4
|
type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
|
|
5
5
|
image?: string;
|
|
6
6
|
};
|
package/12/Seo.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// import { memo } from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import Head from "next/head";
|
|
4
4
|
import { seoBuildTags } from "./seoBuildTags";
|
|
5
5
|
/**
|
|
@@ -22,8 +22,9 @@ import { seoBuildTags } from "./seoBuildTags";
|
|
|
22
22
|
* ```js
|
|
23
23
|
* <Seo title="MyApp | Some description" titleTemplate="%s" />
|
|
24
24
|
* ```
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
*/ export const Seo = (props)=>{
|
|
26
|
+
return /*#__PURE__*/ _jsx(Head, {
|
|
27
|
+
children: seoBuildTags(props)
|
|
28
|
+
});
|
|
28
29
|
};
|
|
29
30
|
export default Seo;
|
package/12/SeoDefaults.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DefaultSeoProps } from "next-seo/lib/types";
|
|
2
|
-
import { type
|
|
2
|
+
import { type LinkTag, type MetaTag } from "./seoBuildTags";
|
|
3
3
|
/**
|
|
4
4
|
* @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
|
|
5
5
|
*/
|
package/12/SeoDefaults.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// import { memo } from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import Head from "next/head";
|
|
4
4
|
// import { useRouter } from "next/router";
|
|
5
5
|
// import { getSiteUrl } from "../utils";
|
|
6
6
|
import { seoBuildTags } from "./seoBuildTags";
|
|
7
|
-
export
|
|
7
|
+
export const SeoDefaults = (props)=>{
|
|
8
8
|
// const router = useRouter();
|
|
9
9
|
// props.openGraph.url = getSiteUrl(router.asPath);
|
|
10
|
-
return _jsx(Head, {
|
|
10
|
+
return /*#__PURE__*/ _jsx(Head, {
|
|
11
|
+
children: seoBuildTags(props)
|
|
12
|
+
});
|
|
11
13
|
};
|
|
12
14
|
export default SeoDefaults;
|
package/12/T.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TransProps } from "next-translate";
|
|
3
|
-
import type { TranslateNamespace,
|
|
3
|
+
import type { TranslateNamespace, TranslationsAllPaths, TranslationsPaths } from "./types-i18n";
|
|
4
4
|
export type TProps<TNamespace extends TranslateNamespace | undefined = undefined> = (Omit<TransProps, "i18nKey" | "ns"> & {
|
|
5
5
|
i18nKey: TranslationsAllPaths;
|
|
6
6
|
}) | (Omit<TransProps, "i18nKey" | "ns"> & {
|
package/12/T.mjs
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { __assign } from "tslib";
|
|
3
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
import Trans from "next-translate/Trans";
|
|
5
4
|
/**
|
|
6
5
|
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
7
6
|
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
8
7
|
* in your `tsconfig.json` file.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
*/ export const T = (props)=>/*#__PURE__*/ _jsx(Trans, {
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
export default T; // export type TProps = Omit<TransProps, "i18nKey" | "ns"> & {
|
|
12
|
+
// i18nKey: TranslationsAllPaths;
|
|
13
|
+
// };
|
|
14
|
+
// export type TPropsNamespaced<
|
|
15
|
+
// TNamespace extends TranslateNamespace
|
|
16
|
+
// > = Omit<TransProps, "i18nKey" | "ns"> & {
|
|
17
|
+
// i18nKey: TranslationsPaths<Translations[TNamespace]>;
|
|
18
|
+
// ns?: TNamespace;
|
|
19
|
+
// };
|
|
20
|
+
// export function T(props: TProps): JSX.Element;
|
|
21
|
+
// export function T<TNamespace extends TranslateNamespace>(props: TPropsNamespaced<TNamespace>): JSX.Element;
|
|
22
|
+
// export function T<TNamespace extends TranslateNamespace>(
|
|
23
|
+
// props: TProps<TNamespace>
|
|
24
|
+
// ) {
|
|
25
|
+
// return <Trans {...props} />;
|
|
26
|
+
// }
|
|
27
|
+
// export { default as T } from "next-translate/Trans";
|
package/12/ThemeContext.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
export
|
|
2
|
+
export const ThemeContext = /*#__PURE__*/ createContext({
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
4
|
-
setTheme:
|
|
5
|
-
themes: []
|
|
4
|
+
setTheme: (_)=>{},
|
|
5
|
+
themes: []
|
|
6
6
|
});
|
|
7
7
|
export default ThemeContext;
|