@koine/next 1.1.10 → 1.1.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/AnalyticsGoogle.js +19 -15
- package/AnalyticsGoogle.mjs +34 -0
- package/DisableErrorOverlay.js +10 -5
- package/DisableErrorOverlay.mjs +13 -0
- package/DynamicNamespaces.js +7 -3
- package/DynamicNamespaces.mjs +8 -0
- package/Favicon.js +10 -6
- package/Favicon.mjs +6 -0
- package/Head.js +7 -3
- package/Head.mjs +3 -0
- package/Link.js +11 -8
- package/Link.mjs +12 -0
- package/NextProgress.js +16 -12
- package/{node/NextProgress.js → NextProgress.mjs} +12 -16
- package/Seo.js +11 -6
- package/{node/Seo.js → Seo.mjs} +6 -11
- package/SeoDefaults.js +11 -6
- package/SeoDefaults.mjs +12 -0
- package/T.js +9 -5
- package/T.mjs +10 -0
- package/ThemeContext.js +6 -3
- package/ThemeContext.mjs +7 -0
- package/ThemeProvider.js +28 -24
- package/{node/ThemeProvider.js → ThemeProvider.mjs} +24 -28
- package/TransText.js +7 -3
- package/TransText.mjs +3 -0
- package/app/AppHead.js +10 -5
- package/app/AppHead.mjs +6 -0
- package/app/AppMain.js +2 -1
- package/app/AppMain.mjs +1 -0
- package/app/css/AppMain.js +11 -7
- package/app/css/AppMain.mjs +14 -0
- package/app/css/AppTheme.js +10 -6
- package/app/css/AppTheme.mjs +15 -0
- package/app/css/auth/index.js +13 -9
- package/app/css/auth/index.mjs +13 -0
- package/app/css/auth/package.json +2 -2
- package/app/css/index.js +12 -8
- package/{node/app/css/index.js → app/css/index.mjs} +8 -12
- package/app/css/package.json +2 -2
- package/app/em/AppMain.js +16 -12
- package/app/em/AppMain.mjs +25 -0
- package/app/em/AppTheme.js +16 -12
- package/app/em/AppTheme.mjs +19 -0
- package/app/em/auth/index.js +13 -9
- package/app/em/auth/index.mjs +13 -0
- package/app/em/auth/package.json +2 -2
- package/app/em/index.js +12 -8
- package/app/em/index.mjs +12 -0
- package/app/em/package.json +2 -2
- package/app/index.js +5 -2
- package/app/index.mjs +2 -0
- package/app/package.json +2 -2
- package/app/sc/AppMain.js +16 -12
- package/app/sc/AppMain.mjs +25 -0
- package/app/sc/AppTheme.js +11 -7
- package/app/sc/AppTheme.mjs +12 -0
- package/app/sc/auth/index.js +13 -9
- package/app/sc/auth/index.mjs +13 -0
- package/app/sc/auth/package.json +2 -2
- package/app/sc/index.js +12 -8
- package/{node/app/sc/index.js → app/sc/index.mjs} +8 -12
- package/app/sc/package.json +2 -2
- package/auth/helpers.js +13 -7
- package/auth/helpers.mjs +22 -0
- package/auth/index.js +7 -4
- package/auth/index.mjs +4 -0
- package/auth/package.json +2 -2
- package/auth/useLogin.js +22 -18
- package/auth/useLogin.mjs +50 -0
- package/auth/useLoginUrl.js +13 -9
- package/auth/useLoginUrl.mjs +12 -0
- package/auth/useLogout.js +23 -18
- package/auth/useLogout.mjs +53 -0
- package/config/index.js +36 -25
- package/{node/config/index.js → config/index.mjs} +25 -36
- package/config/package.json +2 -2
- package/createEmotionCache.js +9 -4
- package/createEmotionCache.mjs +9 -0
- package/document/Document.js +13 -10
- package/document/Document.mjs +28 -0
- package/document/css/index.js +18 -15
- package/document/css/index.mjs +45 -0
- package/document/css/package.json +2 -2
- package/document/em/index.js +22 -19
- package/document/em/index.mjs +60 -0
- package/document/em/package.json +2 -2
- package/document/index.js +7 -2
- package/document/index.mjs +2 -0
- package/document/package.json +2 -2
- package/document/sc/index.js +21 -18
- package/document/sc/index.mjs +64 -0
- package/document/sc/package.json +2 -2
- package/getSiteUrl.js +9 -4
- package/getSiteUrl.mjs +12 -0
- package/getT.js +7 -3
- package/{node/getT.js → getT.mjs} +3 -7
- package/index.js +31 -28
- package/index.mjs +30 -0
- package/load.js +6 -2
- package/{node/load.js → load.mjs} +2 -6
- package/package.json +6 -4
- package/revalidate.js +5 -2
- package/revalidate.mjs +5 -0
- package/seoBuildTags.js +17 -13
- package/{node/seoBuildTags.js → seoBuildTags.mjs} +13 -17
- package/to.js +6 -2
- package/{node/to.js → to.mjs} +2 -6
- package/translationAsOptions.js +5 -1
- package/{node/translationAsOptions.js → translationAsOptions.mjs} +1 -5
- package/types-i18n.js +2 -1
- package/{node/types-i18n.js → types-i18n.mjs} +1 -2
- package/types-seo.js +2 -1
- package/types-seo.mjs +1 -0
- package/useBackUrl.js +15 -10
- package/useBackUrl.mjs +27 -0
- package/useDateFormat.js +17 -13
- package/useDateFormat.mjs +38 -0
- package/useForm.js +14 -10
- package/{node/useForm.js → useForm.mjs} +10 -14
- package/useLocale.js +9 -4
- package/useLocale.mjs +5 -0
- package/useT.js +11 -6
- package/{node/useT.js → useT.mjs} +6 -11
- package/useTheme.js +8 -4
- package/useTheme.mjs +7 -0
- package/useTo.js +11 -7
- package/useTo.mjs +14 -0
- package/NextImg.d.ts +0 -16
- package/NextImg.js +0 -20
- package/NextImgSmart.d.ts +0 -6
- package/NextImgSmart.js +0 -13
- package/node/AnalyticsGoogle.js +0 -38
- package/node/DisableErrorOverlay.js +0 -18
- package/node/DynamicNamespaces.js +0 -12
- package/node/Favicon.js +0 -10
- package/node/Head.js +0 -7
- package/node/Link.js +0 -15
- package/node/SeoDefaults.js +0 -17
- package/node/T.js +0 -14
- package/node/ThemeContext.js +0 -10
- package/node/TransText.js +0 -7
- package/node/app/AppHead.js +0 -11
- package/node/app/AppMain.js +0 -2
- package/node/app/css/AppMain.js +0 -18
- package/node/app/css/AppTheme.js +0 -19
- package/node/app/css/auth/index.js +0 -17
- package/node/app/em/AppMain.js +0 -29
- package/node/app/em/AppTheme.js +0 -23
- package/node/app/em/auth/index.js +0 -17
- package/node/app/em/index.js +0 -16
- package/node/app/index.js +0 -5
- package/node/app/sc/AppMain.js +0 -29
- package/node/app/sc/AppTheme.js +0 -16
- package/node/app/sc/auth/index.js +0 -17
- package/node/auth/helpers.js +0 -28
- package/node/auth/index.js +0 -7
- package/node/auth/useLogin.js +0 -54
- package/node/auth/useLoginUrl.js +0 -16
- package/node/auth/useLogout.js +0 -58
- package/node/createEmotionCache.js +0 -14
- package/node/document/Document.js +0 -31
- package/node/document/css/index.js +0 -48
- package/node/document/em/index.js +0 -63
- package/node/document/index.js +0 -7
- package/node/document/sc/index.js +0 -67
- package/node/getSiteUrl.js +0 -17
- package/node/index.js +0 -33
- package/node/revalidate.js +0 -8
- package/node/types-seo.js +0 -2
- package/node/useBackUrl.js +0 -32
- package/node/useDateFormat.js +0 -42
- package/node/useLocale.js +0 -10
- package/node/useTheme.js +0 -11
- package/node/useTo.js +0 -18
package/AnalyticsGoogle.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalyticsGoogle = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var router_1 = require("next/router");
|
|
8
|
+
var script_1 = tslib_1.__importDefault(require("next/script"));
|
|
9
|
+
var gtagPageview_1 = tslib_1.__importDefault(require("@koine/browser/gtagPageview"));
|
|
10
|
+
var AnalyticsGoogle = function (_a) {
|
|
8
11
|
var id = _a.id;
|
|
9
12
|
var uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
|
|
10
|
-
var _b = useRouter(), events = _b.events, asPath = _b.asPath, query = _b.query;
|
|
11
|
-
var _c = useState(false), ready = _c[0], setReady = _c[1];
|
|
12
|
-
var _d = useState(false), routed = _d[0], setRouted = _d[1];
|
|
13
|
+
var _b = (0, router_1.useRouter)(), events = _b.events, asPath = _b.asPath, query = _b.query;
|
|
14
|
+
var _c = (0, react_1.useState)(false), ready = _c[0], setReady = _c[1];
|
|
15
|
+
var _d = (0, react_1.useState)(false), routed = _d[0], setRouted = _d[1];
|
|
13
16
|
// const [url, setUrl] = useState("");
|
|
14
|
-
useEffect(function () {
|
|
17
|
+
(0, react_1.useEffect)(function () {
|
|
15
18
|
var handleRouteChange = function () {
|
|
16
19
|
setRouted(true);
|
|
17
20
|
};
|
|
@@ -20,15 +23,16 @@ export var AnalyticsGoogle = function (_a) {
|
|
|
20
23
|
events.off("routeChangeComplete", handleRouteChange);
|
|
21
24
|
};
|
|
22
25
|
}, [events]);
|
|
23
|
-
useEffect(function () {
|
|
26
|
+
(0, react_1.useEffect)(function () {
|
|
24
27
|
if (routed && ready && asPath) {
|
|
25
28
|
// const search = query;
|
|
26
|
-
|
|
29
|
+
(0, gtagPageview_1.default)(asPath);
|
|
27
30
|
}
|
|
28
31
|
}, [asPath, query, routed, ready]);
|
|
29
32
|
if (!uid) {
|
|
30
33
|
return null;
|
|
31
34
|
}
|
|
32
|
-
return (
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(script_1.default, { id: "google-tagmanager", src: "https://www.googletagmanager.com/gtag/js?id=".concat(id), strategy: "afterInteractive", onLoad: function () { return setReady(true); } }), (0, jsx_runtime_1.jsx)(script_1.default, tslib_1.__assign({ id: "google-analytics", strategy: "afterInteractive" }, { children: "\n window.dataLayer = window.dataLayer || [];\n function gtag(){window.dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '".concat(id, "', { 'send_page_view': false });\n ") }))] }));
|
|
33
36
|
};
|
|
34
|
-
|
|
37
|
+
exports.AnalyticsGoogle = AnalyticsGoogle;
|
|
38
|
+
exports.default = exports.AnalyticsGoogle;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { useRouter } from "next/router";
|
|
5
|
+
import Script from "next/script";
|
|
6
|
+
import gtagPageview from "@koine/browser/gtagPageview";
|
|
7
|
+
export var AnalyticsGoogle = function (_a) {
|
|
8
|
+
var id = _a.id;
|
|
9
|
+
var uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
|
|
10
|
+
var _b = useRouter(), events = _b.events, asPath = _b.asPath, query = _b.query;
|
|
11
|
+
var _c = useState(false), ready = _c[0], setReady = _c[1];
|
|
12
|
+
var _d = useState(false), routed = _d[0], setRouted = _d[1];
|
|
13
|
+
// const [url, setUrl] = useState("");
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
var handleRouteChange = function () {
|
|
16
|
+
setRouted(true);
|
|
17
|
+
};
|
|
18
|
+
events.on("routeChangeComplete", handleRouteChange);
|
|
19
|
+
return function () {
|
|
20
|
+
events.off("routeChangeComplete", handleRouteChange);
|
|
21
|
+
};
|
|
22
|
+
}, [events]);
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
if (routed && ready && asPath) {
|
|
25
|
+
// const search = query;
|
|
26
|
+
gtagPageview(asPath);
|
|
27
|
+
}
|
|
28
|
+
}, [asPath, query, routed, ready]);
|
|
29
|
+
if (!uid) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsx(Script, { id: "google-tagmanager", src: "https://www.googletagmanager.com/gtag/js?id=".concat(id), strategy: "afterInteractive", onLoad: function () { return setReady(true); } }), _jsx(Script, __assign({ id: "google-analytics", strategy: "afterInteractive" }, { children: "\n window.dataLayer = window.dataLayer || [];\n function gtag(){window.dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '".concat(id, "', { 'send_page_view': false });\n ") }))] }));
|
|
33
|
+
};
|
|
34
|
+
export default AnalyticsGoogle;
|
package/DisableErrorOverlay.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisableErrorOverlay = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var head_1 = tslib_1.__importDefault(require("next/head"));
|
|
3
7
|
/**
|
|
4
8
|
* Disable error overlay during `dev`
|
|
5
9
|
*
|
|
6
10
|
* @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
|
|
7
11
|
*/
|
|
8
|
-
|
|
9
|
-
return (
|
|
12
|
+
var DisableErrorOverlay = function () {
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(head_1.default, { children: process.env["NODE_ENV"] !== "production" && ((0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: {
|
|
10
14
|
__html: "window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});",
|
|
11
15
|
} })) }));
|
|
12
16
|
};
|
|
13
|
-
|
|
17
|
+
exports.DisableErrorOverlay = DisableErrorOverlay;
|
|
18
|
+
exports.default = exports.DisableErrorOverlay;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Head from "next/head";
|
|
3
|
+
/**
|
|
4
|
+
* Disable error overlay during `dev`
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
|
|
7
|
+
*/
|
|
8
|
+
export var DisableErrorOverlay = function () {
|
|
9
|
+
return (_jsx(Head, { children: process.env["NODE_ENV"] !== "production" && (_jsx("script", { dangerouslySetInnerHTML: {
|
|
10
|
+
__html: "window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});",
|
|
11
|
+
} })) }));
|
|
12
|
+
};
|
|
13
|
+
export default DisableErrorOverlay;
|
package/DynamicNamespaces.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamicNamespaces = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var DynamicNamespaces_1 = tslib_1.__importDefault(require("next-translate/DynamicNamespaces"));
|
|
2
6
|
/**
|
|
3
7
|
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
4
8
|
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
5
9
|
* in your `tsconfig.json` file.
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
exports.DynamicNamespaces = DynamicNamespaces_1.default;
|
|
12
|
+
exports.default = exports.DynamicNamespaces;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
|
|
2
|
+
/**
|
|
3
|
+
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
4
|
+
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
5
|
+
* in your `tsconfig.json` file.
|
|
6
|
+
*/
|
|
7
|
+
export var DynamicNamespaces = BaseDynamicNamespaces;
|
|
8
|
+
export default DynamicNamespaces;
|
package/Favicon.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Favicon = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var head_1 = tslib_1.__importDefault(require("next/head"));
|
|
7
|
+
var FaviconTags_1 = tslib_1.__importDefault(require("@koine/react/FaviconTags"));
|
|
8
|
+
var Favicon = function (props) { return ((0, jsx_runtime_1.jsx)(head_1.default, { children: (0, jsx_runtime_1.jsx)(FaviconTags_1.default, tslib_1.__assign({}, props)) })); };
|
|
9
|
+
exports.Favicon = Favicon;
|
|
10
|
+
exports.default = exports.Favicon;
|
package/Favicon.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import Head from "next/head";
|
|
4
|
+
import FaviconTags from "@koine/react/FaviconTags";
|
|
5
|
+
export var Favicon = function (props) { return (_jsx(Head, { children: _jsx(FaviconTags, __assign({}, props)) })); };
|
|
6
|
+
export default Favicon;
|
package/Head.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Head = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var head_1 = tslib_1.__importDefault(require("next/head"));
|
|
6
|
+
exports.Head = head_1.default;
|
|
7
|
+
exports.default = exports.Head;
|
package/Head.mjs
ADDED
package/Link.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Link = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var link_1 = tslib_1.__importDefault(require("next/link"));
|
|
5
8
|
/**
|
|
6
9
|
* @see https://next.js.org/docs/api-reference/next/link
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
var href = _a.href, prefetch = _a.prefetch, replace = _a.replace, scroll = _a.scroll, shallow = _a.shallow, locale = _a.locale, _b = _a.Link, Link = _b === void 0 ? "span" : _b, props = __rest(_a, ["href", "prefetch", "replace", "scroll", "shallow", "locale", "Link"]);
|
|
10
|
-
return (
|
|
11
|
+
exports.Link = (0, react_1.forwardRef)(function Link(_a, ref) {
|
|
12
|
+
var href = _a.href, prefetch = _a.prefetch, replace = _a.replace, scroll = _a.scroll, shallow = _a.shallow, locale = _a.locale, _b = _a.Link, Link = _b === void 0 ? "span" : _b, props = tslib_1.__rest(_a, ["href", "prefetch", "replace", "scroll", "shallow", "locale", "Link"]);
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(link_1.default, tslib_1.__assign({ href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true }, { children: (0, jsx_runtime_1.jsx)(Link, tslib_1.__assign({ ref: ref }, props)) })));
|
|
11
14
|
});
|
|
12
|
-
|
|
15
|
+
exports.default = exports.Link;
|
package/Link.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import NextLink from "next/link";
|
|
5
|
+
/**
|
|
6
|
+
* @see https://next.js.org/docs/api-reference/next/link
|
|
7
|
+
*/
|
|
8
|
+
export var Link = forwardRef(function Link(_a, ref) {
|
|
9
|
+
var href = _a.href, prefetch = _a.prefetch, replace = _a.replace, scroll = _a.scroll, shallow = _a.shallow, locale = _a.locale, _b = _a.Link, Link = _b === void 0 ? "span" : _b, props = __rest(_a, ["href", "prefetch", "replace", "scroll", "shallow", "locale", "Link"]);
|
|
10
|
+
return (_jsx(NextLink, __assign({ href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true }, { children: _jsx(Link, __assign({ ref: ref }, props)) })));
|
|
11
|
+
});
|
|
12
|
+
export default Link;
|
package/NextProgress.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextProgress = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var router_1 = require("next/router");
|
|
7
|
+
var NextProgress = function (_a) {
|
|
5
8
|
var _b = _a.startAt, startAt = _b === void 0 ? 0.3 : _b, _c = _a.showOnShallow, showOnShallow = _c === void 0 ? true : _c, _d = _a.stopDelayMs, stopDelayMs = _d === void 0 ? 200 : _d, _e = _a.Overlay, Overlay = _e === void 0 ? "div" : _e;
|
|
6
|
-
var events = useRouter().events;
|
|
9
|
+
var events = (0, router_1.useRouter)().events;
|
|
7
10
|
// const [progress, setProgress] = useState(0);
|
|
8
|
-
var _f = useState(false), running = _f[0], setRunning = _f[1];
|
|
9
|
-
var timer = useRef(null);
|
|
10
|
-
var routeChangeStart = useCallback(function (_, _a) {
|
|
11
|
+
var _f = (0, react_1.useState)(false), running = _f[0], setRunning = _f[1];
|
|
12
|
+
var timer = (0, react_1.useRef)(null);
|
|
13
|
+
var routeChangeStart = (0, react_1.useCallback)(function (_, _a) {
|
|
11
14
|
var shallow = _a.shallow;
|
|
12
15
|
if (!shallow || showOnShallow) {
|
|
13
16
|
// setProgress(startAt);
|
|
14
17
|
setRunning(true);
|
|
15
18
|
}
|
|
16
19
|
}, [showOnShallow]);
|
|
17
|
-
var routeChangeEnd = useCallback(function (_, _a) {
|
|
20
|
+
var routeChangeEnd = (0, react_1.useCallback)(function (_, _a) {
|
|
18
21
|
var shallow = _a.shallow;
|
|
19
22
|
if (!shallow || showOnShallow) {
|
|
20
23
|
if (timer.current) {
|
|
@@ -26,7 +29,7 @@ export var NextProgress = function (_a) {
|
|
|
26
29
|
}, stopDelayMs);
|
|
27
30
|
}
|
|
28
31
|
}, [showOnShallow, stopDelayMs, timer]);
|
|
29
|
-
useEffect(function () {
|
|
32
|
+
(0, react_1.useEffect)(function () {
|
|
30
33
|
events.on("routeChangeStart", routeChangeStart);
|
|
31
34
|
events.on("routeChangeComplete", routeChangeEnd);
|
|
32
35
|
events.on("routeChangeError", routeChangeEnd);
|
|
@@ -36,6 +39,7 @@ export var NextProgress = function (_a) {
|
|
|
36
39
|
events.off("routeChangeError", routeChangeEnd);
|
|
37
40
|
};
|
|
38
41
|
}, [events, routeChangeStart, routeChangeEnd]);
|
|
39
|
-
return
|
|
42
|
+
return (0, jsx_runtime_1.jsx)(Overlay, { running: running });
|
|
40
43
|
};
|
|
41
|
-
|
|
44
|
+
exports.NextProgress = NextProgress;
|
|
45
|
+
exports.default = exports.NextProgress;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var router_1 = require("next/router");
|
|
7
|
-
var NextProgress = function (_a) {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useRouter } from "next/router";
|
|
4
|
+
export var NextProgress = function (_a) {
|
|
8
5
|
var _b = _a.startAt, startAt = _b === void 0 ? 0.3 : _b, _c = _a.showOnShallow, showOnShallow = _c === void 0 ? true : _c, _d = _a.stopDelayMs, stopDelayMs = _d === void 0 ? 200 : _d, _e = _a.Overlay, Overlay = _e === void 0 ? "div" : _e;
|
|
9
|
-
var events =
|
|
6
|
+
var events = useRouter().events;
|
|
10
7
|
// const [progress, setProgress] = useState(0);
|
|
11
|
-
var _f =
|
|
12
|
-
var timer =
|
|
13
|
-
var routeChangeStart =
|
|
8
|
+
var _f = useState(false), running = _f[0], setRunning = _f[1];
|
|
9
|
+
var timer = useRef(null);
|
|
10
|
+
var routeChangeStart = useCallback(function (_, _a) {
|
|
14
11
|
var shallow = _a.shallow;
|
|
15
12
|
if (!shallow || showOnShallow) {
|
|
16
13
|
// setProgress(startAt);
|
|
17
14
|
setRunning(true);
|
|
18
15
|
}
|
|
19
16
|
}, [showOnShallow]);
|
|
20
|
-
var routeChangeEnd =
|
|
17
|
+
var routeChangeEnd = useCallback(function (_, _a) {
|
|
21
18
|
var shallow = _a.shallow;
|
|
22
19
|
if (!shallow || showOnShallow) {
|
|
23
20
|
if (timer.current) {
|
|
@@ -29,7 +26,7 @@ var NextProgress = function (_a) {
|
|
|
29
26
|
}, stopDelayMs);
|
|
30
27
|
}
|
|
31
28
|
}, [showOnShallow, stopDelayMs, timer]);
|
|
32
|
-
|
|
29
|
+
useEffect(function () {
|
|
33
30
|
events.on("routeChangeStart", routeChangeStart);
|
|
34
31
|
events.on("routeChangeComplete", routeChangeEnd);
|
|
35
32
|
events.on("routeChangeError", routeChangeEnd);
|
|
@@ -39,7 +36,6 @@ var NextProgress = function (_a) {
|
|
|
39
36
|
events.off("routeChangeError", routeChangeEnd);
|
|
40
37
|
};
|
|
41
38
|
}, [events, routeChangeStart, routeChangeEnd]);
|
|
42
|
-
return (
|
|
39
|
+
return _jsx(Overlay, { running: running });
|
|
43
40
|
};
|
|
44
|
-
|
|
45
|
-
exports.default = exports.NextProgress;
|
|
41
|
+
export default NextProgress;
|
package/Seo.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Seo = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
6
|
// import { memo } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
var head_1 = tslib_1.__importDefault(require("next/head"));
|
|
8
|
+
var seoBuildTags_1 = require("./seoBuildTags");
|
|
5
9
|
/**
|
|
6
10
|
* Adapted from [garmeeh/next-seo](https://github.com/garmeeh/next-seo)
|
|
7
11
|
*
|
|
@@ -23,7 +27,8 @@ import { seoBuildTags } from "./seoBuildTags";
|
|
|
23
27
|
* <Seo title="MyApp | Some description" titleTemplate="%s" />
|
|
24
28
|
* ```
|
|
25
29
|
*/
|
|
26
|
-
|
|
27
|
-
return
|
|
30
|
+
var Seo = function (props) {
|
|
31
|
+
return (0, jsx_runtime_1.jsx)(head_1.default, { children: (0, seoBuildTags_1.seoBuildTags)(props) });
|
|
28
32
|
};
|
|
29
|
-
|
|
33
|
+
exports.Seo = Seo;
|
|
34
|
+
exports.default = exports.Seo;
|
package/{node/Seo.js → Seo.mjs}
RENAMED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Seo = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
2
|
// import { memo } from "react";
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import Head from "next/head";
|
|
4
|
+
import { seoBuildTags } from "./seoBuildTags";
|
|
9
5
|
/**
|
|
10
6
|
* Adapted from [garmeeh/next-seo](https://github.com/garmeeh/next-seo)
|
|
11
7
|
*
|
|
@@ -27,8 +23,7 @@ var seoBuildTags_1 = require("./seoBuildTags");
|
|
|
27
23
|
* <Seo title="MyApp | Some description" titleTemplate="%s" />
|
|
28
24
|
* ```
|
|
29
25
|
*/
|
|
30
|
-
var Seo = function (props) {
|
|
31
|
-
return (
|
|
26
|
+
export var Seo = function (props) {
|
|
27
|
+
return _jsx(Head, { children: seoBuildTags(props) });
|
|
32
28
|
};
|
|
33
|
-
|
|
34
|
-
exports.default = exports.Seo;
|
|
29
|
+
export default Seo;
|
package/SeoDefaults.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SeoDefaults = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
6
|
// import { memo } from "react";
|
|
3
|
-
|
|
7
|
+
var head_1 = tslib_1.__importDefault(require("next/head"));
|
|
4
8
|
// import { useRouter } from "next/router";
|
|
5
9
|
// import { getSiteUrl } from "../utils";
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
var seoBuildTags_1 = require("./seoBuildTags");
|
|
11
|
+
var SeoDefaults = function (props) {
|
|
8
12
|
// const router = useRouter();
|
|
9
13
|
// props.openGraph.url = getSiteUrl(router.asPath);
|
|
10
|
-
return
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(head_1.default, { children: (0, seoBuildTags_1.seoBuildTags)(props) });
|
|
11
15
|
};
|
|
12
|
-
|
|
16
|
+
exports.SeoDefaults = SeoDefaults;
|
|
17
|
+
exports.default = exports.SeoDefaults;
|
package/SeoDefaults.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// import { memo } from "react";
|
|
3
|
+
import Head from "next/head";
|
|
4
|
+
// import { useRouter } from "next/router";
|
|
5
|
+
// import { getSiteUrl } from "../utils";
|
|
6
|
+
import { seoBuildTags } from "./seoBuildTags";
|
|
7
|
+
export var SeoDefaults = function (props) {
|
|
8
|
+
// const router = useRouter();
|
|
9
|
+
// props.openGraph.url = getSiteUrl(router.asPath);
|
|
10
|
+
return _jsx(Head, { children: seoBuildTags(props) });
|
|
11
|
+
};
|
|
12
|
+
export default SeoDefaults;
|
package/T.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.T = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var Trans_1 = tslib_1.__importDefault(require("next-translate/Trans"));
|
|
4
7
|
/**
|
|
5
8
|
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
6
9
|
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
7
10
|
* in your `tsconfig.json` file.
|
|
8
11
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
var T = function (props) { return (0, jsx_runtime_1.jsx)(Trans_1.default, tslib_1.__assign({}, props)); };
|
|
13
|
+
exports.T = T;
|
|
14
|
+
exports.default = exports.T;
|
package/T.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import Trans from "next-translate/Trans";
|
|
4
|
+
/**
|
|
5
|
+
* **NOTE**: To make typescript work nicely here make sure to enable
|
|
6
|
+
* [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
|
|
7
|
+
* in your `tsconfig.json` file.
|
|
8
|
+
*/
|
|
9
|
+
export var T = function (props) { return _jsx(Trans, __assign({}, props)); };
|
|
10
|
+
export default T;
|
package/ThemeContext.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeContext = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
exports.ThemeContext = (0, react_1.createContext)({
|
|
3
6
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
4
7
|
setTheme: function (_) { },
|
|
5
8
|
themes: [],
|
|
6
9
|
});
|
|
7
|
-
|
|
10
|
+
exports.default = exports.ThemeContext;
|
package/ThemeContext.mjs
ADDED
package/ThemeProvider.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeProvider = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var script_1 = tslib_1.__importDefault(require("next/script"));
|
|
8
|
+
var isServer_1 = tslib_1.__importDefault(require("@koine/utils/isServer"));
|
|
9
|
+
var ThemeContext_1 = require("./ThemeContext");
|
|
7
10
|
var colorSchemes = ["light", "dark"];
|
|
8
11
|
var MEDIA = "(prefers-color-scheme: dark)";
|
|
9
12
|
var THEME_STORAGE_KEY = "theme";
|
|
@@ -16,19 +19,19 @@ var THEME_STORAGE_KEY = "theme";
|
|
|
16
19
|
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
17
20
|
* controlled by tailwind modifiers
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
var ThemeProvider = function (_a) {
|
|
20
23
|
var forcedTheme = _a.forcedTheme, _b = _a.disableTransitionOnChange, disableTransitionOnChange = _b === void 0 ? false : _b, _c = _a.enableSystem, enableSystem = _c === void 0 ? true : _c, enableColorScheme = _a.enableColorScheme, _d = _a.themes, themes = _d === void 0 ? ["light", "dark"] : _d, _e = _a.defaultTheme, defaultTheme = _e === void 0 ? enableSystem ? "system" : "light" : _e, _f = _a.attribute, attribute = _f === void 0 ? "data-theme" : _f, value = _a.value, children = _a.children, nonce = _a.nonce;
|
|
21
|
-
var _g = useState(function () {
|
|
24
|
+
var _g = (0, react_1.useState)(function () {
|
|
22
25
|
return getTheme(THEME_STORAGE_KEY, defaultTheme);
|
|
23
26
|
}), theme = _g[0], setThemeState = _g[1];
|
|
24
|
-
var _h = useState(function () {
|
|
27
|
+
var _h = (0, react_1.useState)(function () {
|
|
25
28
|
return getTheme(THEME_STORAGE_KEY);
|
|
26
29
|
}), resolvedTheme = _h[0], setResolvedTheme = _h[1];
|
|
27
30
|
var attrs = !value ? themes : Object.values(value);
|
|
28
|
-
var applyTheme = useCallback(function (theme) {
|
|
31
|
+
var applyTheme = (0, react_1.useCallback)(function (theme) {
|
|
29
32
|
var _a;
|
|
30
33
|
var resolved = theme;
|
|
31
|
-
if (
|
|
34
|
+
if (isServer_1.default || !resolved)
|
|
32
35
|
return;
|
|
33
36
|
// If theme is system, resolve it before setting theme
|
|
34
37
|
if (theme === "system" && enableSystem) {
|
|
@@ -69,7 +72,7 @@ export var ThemeProvider = function (_a) {
|
|
|
69
72
|
enableSystem,
|
|
70
73
|
value,
|
|
71
74
|
]);
|
|
72
|
-
var setTheme = useCallback(function (theme) {
|
|
75
|
+
var setTheme = (0, react_1.useCallback)(function (theme) {
|
|
73
76
|
setThemeState(theme);
|
|
74
77
|
// Save to storage
|
|
75
78
|
try {
|
|
@@ -79,7 +82,7 @@ export var ThemeProvider = function (_a) {
|
|
|
79
82
|
// Unsupported
|
|
80
83
|
}
|
|
81
84
|
}, []);
|
|
82
|
-
var handleMediaQuery = useCallback(function (e) {
|
|
85
|
+
var handleMediaQuery = (0, react_1.useCallback)(function (e) {
|
|
83
86
|
var resolved = getSystemTheme(e);
|
|
84
87
|
setResolvedTheme(resolved);
|
|
85
88
|
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
@@ -87,7 +90,7 @@ export var ThemeProvider = function (_a) {
|
|
|
87
90
|
}
|
|
88
91
|
}, [theme, enableSystem, forcedTheme, applyTheme]);
|
|
89
92
|
// Always listen to System preference
|
|
90
|
-
useEffect(function () {
|
|
93
|
+
(0, react_1.useEffect)(function () {
|
|
91
94
|
var media = window.matchMedia(MEDIA);
|
|
92
95
|
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
93
96
|
media.addListener(handleMediaQuery);
|
|
@@ -95,7 +98,7 @@ export var ThemeProvider = function (_a) {
|
|
|
95
98
|
return function () { return media.removeListener(handleMediaQuery); };
|
|
96
99
|
}, [handleMediaQuery]);
|
|
97
100
|
// localStorage event handling
|
|
98
|
-
useEffect(function () {
|
|
101
|
+
(0, react_1.useEffect)(function () {
|
|
99
102
|
var handleStorage = function (e) {
|
|
100
103
|
if (e.key !== THEME_STORAGE_KEY) {
|
|
101
104
|
return;
|
|
@@ -108,17 +111,17 @@ export var ThemeProvider = function (_a) {
|
|
|
108
111
|
return function () { return window.removeEventListener("storage", handleStorage); };
|
|
109
112
|
}, [defaultTheme, setTheme]);
|
|
110
113
|
// Whenever theme or forcedTheme changes, apply it
|
|
111
|
-
useEffect(function () {
|
|
114
|
+
(0, react_1.useEffect)(function () {
|
|
112
115
|
applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
|
|
113
116
|
}, [applyTheme, forcedTheme, theme]);
|
|
114
|
-
return (
|
|
117
|
+
return ((0, jsx_runtime_1.jsxs)(ThemeContext_1.ThemeContext.Provider, tslib_1.__assign({ value: {
|
|
115
118
|
theme: theme,
|
|
116
119
|
setTheme: setTheme,
|
|
117
120
|
forcedTheme: forcedTheme,
|
|
118
121
|
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
119
|
-
themes: enableSystem ? __spreadArray(__spreadArray([], themes, true), ["system"], false) : themes,
|
|
122
|
+
themes: enableSystem ? tslib_1.__spreadArray(tslib_1.__spreadArray([], themes, true), ["system"], false) : themes,
|
|
120
123
|
systemTheme: (enableSystem ? resolvedTheme : undefined),
|
|
121
|
-
} }, { children: [
|
|
124
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(ThemeScript, tslib_1.__assign({}, {
|
|
122
125
|
forcedTheme: forcedTheme,
|
|
123
126
|
disableTransitionOnChange: disableTransitionOnChange,
|
|
124
127
|
enableSystem: enableSystem,
|
|
@@ -132,7 +135,8 @@ export var ThemeProvider = function (_a) {
|
|
|
132
135
|
nonce: nonce,
|
|
133
136
|
})), children] })));
|
|
134
137
|
};
|
|
135
|
-
|
|
138
|
+
exports.ThemeProvider = ThemeProvider;
|
|
139
|
+
var ThemeScript = (0, react_1.memo)(function (_a) {
|
|
136
140
|
var forcedTheme = _a.forcedTheme, attribute = _a.attribute, enableSystem = _a.enableSystem, enableColorScheme = _a.enableColorScheme, defaultTheme = _a.defaultTheme, value = _a.value, attrs = _a.attrs, nonce = _a.nonce;
|
|
137
141
|
var defaultSystem = defaultTheme === "system";
|
|
138
142
|
// Code-golfing the amount of characters in the script
|
|
@@ -202,13 +206,13 @@ var ThemeScript = memo(function (_a) {
|
|
|
202
206
|
// But our script cannot be external because it changes at runtime based on React props
|
|
203
207
|
// so we trick next/script by passing `src` as a base64 JS script
|
|
204
208
|
var encodedScript = "data:text/javascript;base64,".concat(encodeBase64(scriptSrc));
|
|
205
|
-
return (
|
|
209
|
+
return ((0, jsx_runtime_1.jsx)(script_1.default, { id: "next-theme-script", strategy: "beforeInteractive", src: encodedScript, nonce: nonce }));
|
|
206
210
|
},
|
|
207
211
|
// Never re-render this component
|
|
208
212
|
function () { return true; });
|
|
209
213
|
// Helpers
|
|
210
214
|
var getTheme = function (key, fallback) {
|
|
211
|
-
if (
|
|
215
|
+
if (isServer_1.default)
|
|
212
216
|
return undefined;
|
|
213
217
|
var theme;
|
|
214
218
|
try {
|
|
@@ -241,6 +245,6 @@ var getSystemTheme = function (e) {
|
|
|
241
245
|
return systemTheme;
|
|
242
246
|
};
|
|
243
247
|
var encodeBase64 = function (str) {
|
|
244
|
-
return
|
|
248
|
+
return isServer_1.default ? Buffer.from(str).toString("base64") : btoa(str);
|
|
245
249
|
};
|
|
246
|
-
|
|
250
|
+
exports.default = exports.ThemeProvider;
|