@koine/next 1.0.43 → 1.0.46
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 → AnalyticsGoogle.d.ts} +1 -0
- package/{Analytics/AnalyticsGoogle.js → AnalyticsGoogle.js} +1 -0
- package/DynamicNamespaces.d.ts +13 -0
- package/DynamicNamespaces.js +8 -0
- package/{Favicon/Favicon.d.ts → Favicon.d.ts} +1 -0
- package/{Favicon/Favicon.js → Favicon.js} +1 -0
- package/Head.d.ts +3 -0
- package/Head.js +3 -0
- package/Link.d.ts +10 -0
- package/{Link/Link.js → Link.js} +1 -0
- package/{Img/Img.d.ts → NextImg.d.ts} +2 -6
- package/{Img/Img.js → NextImg.js} +2 -10
- package/NextImgSmart.d.ts +6 -0
- package/NextImgSmart.js +13 -0
- package/{NextProgress/NextProgress.d.ts → NextProgress.d.ts} +1 -1
- package/{NextProgress/NextProgress.js → NextProgress.js} +1 -0
- package/Seo.d.ts +27 -0
- package/Seo.js +16 -0
- package/SeoDefaults.d.ts +11 -0
- package/{Seo/SeoDefaults.js → SeoDefaults.js} +3 -2
- package/{i18n/T/index.d.ts → T.d.ts} +1 -1
- package/{i18n/T/index.js → T.js} +0 -0
- package/app/AppMain.d.ts +1 -1
- package/app/css/AppMain.js +1 -1
- package/app/css/AppTheme.d.ts +1 -1
- package/app/css/AppTheme.js +1 -1
- package/app/em/AppMain.js +1 -1
- package/app/em/AppTheme.js +1 -1
- package/app/sc/AppMain.js +1 -1
- package/{Auth → auth}/helpers.d.ts +1 -1
- package/{Auth → auth}/helpers.js +0 -0
- package/{Auth → auth}/index.d.ts +0 -0
- package/{Auth → auth}/index.js +0 -0
- package/{Head → auth}/package.json +1 -1
- package/{Auth → auth}/useLogin.d.ts +1 -0
- package/{Auth → auth}/useLogin.js +2 -1
- package/{Auth → auth}/useLoginUrl.d.ts +1 -0
- package/{Auth → auth}/useLoginUrl.js +2 -1
- package/{Auth → auth}/useLogout.d.ts +1 -0
- package/{Auth → auth}/useLogout.js +2 -1
- package/config/index.d.ts +11 -4
- package/config/index.js +20 -10
- package/{utils/emotion-cache.d.ts → createEmotionCache.d.ts} +1 -0
- package/{utils/emotion-cache.js → createEmotionCache.js} +1 -0
- package/document/em/index.js +1 -1
- package/document/sc/index.js +1 -3
- package/getSiteUrl.d.ts +8 -0
- package/getSiteUrl.js +12 -0
- package/{i18n/getT/index.d.ts → getT.d.ts} +2 -1
- package/{i18n/getT/index.js → getT.js} +1 -0
- package/index.d.ts +21 -7
- package/index.js +23 -7
- package/{utils/index.d.ts → load.d.ts} +1 -9
- package/{utils/index.js → load.js} +1 -13
- package/node/{Analytics/AnalyticsGoogle.js → AnalyticsGoogle.js} +1 -0
- package/node/DynamicNamespaces.js +12 -0
- package/node/{Favicon/Favicon.js → Favicon.js} +1 -0
- package/node/Head.js +7 -0
- package/node/{Link/Link.js → Link.js} +1 -0
- package/node/{Img/Img.js → NextImg.js} +2 -11
- package/node/NextImgSmart.js +17 -0
- package/node/{NextProgress/NextProgress.js → NextProgress.js} +1 -0
- package/node/{Seo/Seo.js → Seo.js} +10 -2
- package/node/{Seo/SeoDefaults.js → SeoDefaults.js} +3 -2
- package/node/{i18n/T/index.js → T.js} +0 -0
- package/node/app/css/AppMain.js +2 -2
- package/node/app/css/AppTheme.js +2 -2
- package/node/app/em/AppMain.js +2 -2
- package/node/app/em/AppTheme.js +2 -2
- package/node/app/sc/AppMain.js +2 -2
- package/node/{Auth → auth}/helpers.js +0 -0
- package/node/{Auth → auth}/index.js +0 -0
- package/node/{Auth → auth}/useLogin.js +3 -2
- package/node/{Auth → auth}/useLoginUrl.js +3 -2
- package/node/{Auth → auth}/useLogout.js +3 -2
- package/node/config/index.js +20 -10
- package/node/{utils/emotion-cache.js → createEmotionCache.js} +1 -0
- package/node/document/em/index.js +2 -2
- package/node/document/sc/index.js +1 -3
- package/node/getSiteUrl.js +16 -0
- package/node/{i18n/getT/index.js → getT.js} +1 -0
- package/node/index.js +23 -7
- package/node/{utils/index.js → load.js} +2 -15
- package/node/revalidate.js +8 -0
- package/node/{Seo/helpers.js → seoBuildTags.js} +7 -5
- package/node/to.js +29 -0
- package/node/{i18n/translationAsOptions/index.js → translationAsOptions.js} +0 -0
- package/node/{i18n/types.js → types-i18n.js} +0 -0
- package/node/types-seo.js +2 -0
- package/node/useBackUrl.js +31 -0
- package/node/{i18n/useDateFormat/index.js → useDateFormat.js} +0 -0
- package/node/{Forms/useForm.js → useForm.js} +0 -0
- package/node/{i18n/useLocale/index.js → useLocale.js} +0 -0
- package/node/{i18n/useT/index.js → useT.js} +0 -0
- package/node/{Theme/Theme.js → useTheme.js} +7 -0
- package/node/useTo.js +18 -0
- package/package.json +10 -10
- package/revalidate.d.ts +5 -0
- package/revalidate.js +5 -0
- package/seoBuildTags.d.ts +21 -0
- package/{Seo/helpers.js → seoBuildTags.js} +5 -3
- package/to.d.ts +24 -0
- package/to.js +25 -0
- package/{i18n/translationAsOptions/index.d.ts → translationAsOptions.d.ts} +1 -1
- package/{i18n/translationAsOptions/index.js → translationAsOptions.js} +0 -0
- package/{i18n/types.d.ts → types-i18n.d.ts} +6 -0
- package/{i18n/types.js → types-i18n.js} +0 -0
- package/types-seo.d.ts +7 -0
- package/types-seo.js +1 -0
- package/useBackUrl.d.ts +2 -0
- package/useBackUrl.js +27 -0
- package/{i18n/useDateFormat/index.d.ts → useDateFormat.d.ts} +0 -0
- package/{i18n/useDateFormat/index.js → useDateFormat.js} +0 -0
- package/{Forms/useForm.d.ts → useForm.d.ts} +1 -1
- package/{Forms/useForm.js → useForm.js} +0 -0
- package/{i18n/useLocale/index.d.ts → useLocale.d.ts} +0 -0
- package/{i18n/useLocale/index.js → useLocale.js} +0 -0
- package/{i18n/useT/index.d.ts → useT.d.ts} +1 -1
- package/{i18n/useT/index.js → useT.js} +0 -0
- package/{Theme/Theme.d.ts → useTheme.d.ts} +8 -13
- package/{Theme/Theme.js → useTheme.js} +7 -0
- package/useTo.d.ts +3 -0
- package/useTo.js +14 -0
- package/Analytics/index.d.ts +0 -1
- package/Analytics/index.js +0 -1
- package/Analytics/package.json +0 -6
- package/Auth/package.json +0 -6
- package/Favicon/index.d.ts +0 -1
- package/Favicon/index.js +0 -1
- package/Favicon/package.json +0 -6
- package/Forms/index.d.ts +0 -1
- package/Forms/index.js +0 -1
- package/Forms/package.json +0 -6
- package/Head/Head.d.ts +0 -1
- package/Head/Head.js +0 -1
- package/Head/index.d.ts +0 -1
- package/Head/index.js +0 -1
- package/Img/index.d.ts +0 -1
- package/Img/index.js +0 -1
- package/Img/package.json +0 -6
- package/Link/Link.d.ts +0 -9
- package/Link/index.d.ts +0 -1
- package/Link/index.js +0 -1
- package/Link/package.json +0 -6
- package/NextProgress/index.d.ts +0 -2
- package/NextProgress/index.js +0 -1
- package/NextProgress/package.json +0 -6
- package/Seo/Seo.d.ts +0 -3
- package/Seo/Seo.js +0 -8
- package/Seo/SeoDefaults.d.ts +0 -3
- package/Seo/helpers.d.ts +0 -48
- package/Seo/index.d.ts +0 -12
- package/Seo/index.js +0 -12
- package/Seo/package.json +0 -6
- package/Theme/index.d.ts +0 -1
- package/Theme/index.js +0 -1
- package/Theme/package.json +0 -6
- package/i18n/T/package.json +0 -6
- package/i18n/getT/package.json +0 -6
- package/i18n/index.d.ts +0 -7
- package/i18n/index.js +0 -7
- package/i18n/package.json +0 -6
- package/i18n/translationAsOptions/package.json +0 -6
- package/i18n/useDateFormat/package.json +0 -6
- package/i18n/useLocale/package.json +0 -6
- package/i18n/useT/package.json +0 -6
- package/node/Analytics/index.js +0 -4
- package/node/Favicon/index.js +0 -4
- package/node/Forms/index.js +0 -4
- package/node/Head/Head.js +0 -5
- package/node/Head/index.js +0 -4
- package/node/Img/index.js +0 -4
- package/node/Link/index.js +0 -4
- package/node/NextProgress/index.js +0 -5
- package/node/Seo/index.js +0 -15
- package/node/Theme/index.js +0 -4
- package/node/i18n/index.js +0 -10
- package/utils/package.json +0 -6
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBackUrl = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var router_1 = require("next/router");
|
|
6
|
+
var utils_1 = require("@koine/utils");
|
|
7
|
+
var back = (0, utils_1.createStorage)({
|
|
8
|
+
lastUrl: "",
|
|
9
|
+
});
|
|
10
|
+
function useBackUrl() {
|
|
11
|
+
var asPath = (0, router_1.useRouter)().asPath;
|
|
12
|
+
var calledOnce = (0, react_1.useRef)(false);
|
|
13
|
+
var _a = (0, react_1.useState)(), backUrl = _a[0], setBackUrl = _a[1];
|
|
14
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
|
+
(0, react_1.useEffect)(function () {
|
|
16
|
+
if (calledOnce.current) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
var prevLastUrl = back.get("lastUrl");
|
|
20
|
+
// console.log("useBackUrl: prevLastUrl", prevLastUrl);
|
|
21
|
+
// first set it to use on a link, set to undefined if the previous URL
|
|
22
|
+
// is the same as the current one
|
|
23
|
+
setBackUrl(asPath === prevLastUrl || !prevLastUrl ? undefined : prevLastUrl);
|
|
24
|
+
// then update the local storage
|
|
25
|
+
back.set("lastUrl", asPath);
|
|
26
|
+
calledOnce.current = true;
|
|
27
|
+
});
|
|
28
|
+
return backUrl;
|
|
29
|
+
}
|
|
30
|
+
exports.useBackUrl = useBackUrl;
|
|
31
|
+
exports.default = useBackUrl;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,8 +25,14 @@ var ThemeContext = (0, react_1.createContext)({
|
|
|
25
25
|
setTheme: function (_) { },
|
|
26
26
|
themes: [],
|
|
27
27
|
});
|
|
28
|
+
/**
|
|
29
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
30
|
+
*/
|
|
28
31
|
var useTheme = function () { return (0, react_1.useContext)(ThemeContext); };
|
|
29
32
|
exports.useTheme = useTheme;
|
|
33
|
+
/**
|
|
34
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
35
|
+
*/
|
|
30
36
|
var ThemeProvider = function (_a) {
|
|
31
37
|
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;
|
|
32
38
|
var _g = (0, react_1.useState)(function () {
|
|
@@ -254,3 +260,4 @@ var getSystemTheme = function (e) {
|
|
|
254
260
|
var encodeBase64 = function (str) {
|
|
255
261
|
return utils_1.isServer ? Buffer.from(str).toString("base64") : btoa(str);
|
|
256
262
|
};
|
|
263
|
+
exports.default = exports.useTheme;
|
package/node/useTo.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTo = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var useT_1 = require("./useT");
|
|
6
|
+
var to_1 = require("./to");
|
|
7
|
+
function useTo() {
|
|
8
|
+
var t = (0, useT_1.useT)("~");
|
|
9
|
+
return function () {
|
|
10
|
+
var args = [];
|
|
11
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
12
|
+
args[_i] = arguments[_i];
|
|
13
|
+
}
|
|
14
|
+
return to_1.to.apply(void 0, tslib_1.__spreadArray([t], args, false));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.useTo = useTo;
|
|
18
|
+
exports.default = useTo;
|
package/package.json
CHANGED
|
@@ -17,15 +17,11 @@
|
|
|
17
17
|
"dependencies": {},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^16.8 || ^17 || ^18",
|
|
20
|
-
"next": "^12.
|
|
21
|
-
"@koine/utils": "1.0.
|
|
20
|
+
"next": "^12.2.0",
|
|
21
|
+
"@koine/utils": "1.0.46",
|
|
22
22
|
"framer-motion": "^6.3.16",
|
|
23
|
-
"
|
|
24
|
-
"@mui/material": "^5.8.6",
|
|
25
|
-
"@emotion/react": "^11.9.3",
|
|
23
|
+
"@koine/react": "1.0.46",
|
|
26
24
|
"styled-components": "^5.3.5",
|
|
27
|
-
"react-hook-form": "^7.33.0",
|
|
28
|
-
"@koine/react": "1.0.43",
|
|
29
25
|
"@mui/base": "^5.0.0-alpha.87",
|
|
30
26
|
"react-icons": "^4.4.0",
|
|
31
27
|
"date-fns": "^2.28.0",
|
|
@@ -33,15 +29,19 @@
|
|
|
33
29
|
"@tiptap/react": "^2.0.0-beta.114",
|
|
34
30
|
"@tiptap/starter-kit": "^2.0.0-beta.190",
|
|
35
31
|
"@kuus/yup": "^1.0.0-beta.4",
|
|
32
|
+
"react-hook-form": "^7.33.0",
|
|
36
33
|
"type-fest": "^2.14.0",
|
|
37
34
|
"react-popper": "^2.3.0",
|
|
38
35
|
"tslib": "^2.4.0",
|
|
36
|
+
"next-auth": "^4.7.0",
|
|
37
|
+
"@mui/material": "^5.8.6",
|
|
38
|
+
"@emotion/react": "^11.9.3",
|
|
39
39
|
"@emotion/server": "^11.4.0",
|
|
40
|
-
"@hookform/resolvers": "^2.9.3",
|
|
41
40
|
"next-translate": "^1.4.0",
|
|
42
|
-
"next-seo": "^5.4.0"
|
|
41
|
+
"next-seo": "^5.4.0",
|
|
42
|
+
"@hookform/resolvers": "^2.9.3"
|
|
43
43
|
},
|
|
44
|
-
"version": "1.0.
|
|
44
|
+
"version": "1.0.46",
|
|
45
45
|
"module": "./index.js",
|
|
46
46
|
"types": "./index.d.ts"
|
|
47
47
|
}
|
package/revalidate.d.ts
ADDED
package/revalidate.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SeoProps } from "./Seo";
|
|
3
|
+
import type { SeoDefaultsProps } from "./SeoDefaults";
|
|
4
|
+
declare type BuildTagsParams = SeoProps & SeoDefaultsProps;
|
|
5
|
+
/**
|
|
6
|
+
* Comparing to `next-seo` we do a couple of things in addition while many
|
|
7
|
+
* others are removed.
|
|
8
|
+
*
|
|
9
|
+
* - Add `seo` meta object coming from a CMS probably
|
|
10
|
+
* - Add `ogimage` and `openGraph.image` as single image source
|
|
11
|
+
* - Add `og` alias to define `openGraph`
|
|
12
|
+
* - Add check for `title` equal to `templateTitle` to avoid meta titles like
|
|
13
|
+
* "My site | My site" often happening in homepages
|
|
14
|
+
* - Remove the open graph videos and images
|
|
15
|
+
*
|
|
16
|
+
* - Shorter code
|
|
17
|
+
*
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const seoBuildTags: ({ seo, hidden, keywords, title, titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates, twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags, }?: BuildTagsParams) => React.ReactNode[];
|
|
21
|
+
export default seoBuildTags;
|
|
@@ -5,12 +5,13 @@ var defaults = {
|
|
|
5
5
|
tplTitle: "",
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Comparing to `next-seo` we do a couple of things in addition while many
|
|
9
|
+
* others are removed.
|
|
9
10
|
*
|
|
10
11
|
* - Add `seo` meta object coming from a CMS probably
|
|
11
12
|
* - Add `ogimage` and `openGraph.image` as single image source
|
|
12
13
|
* - Add `og` alias to define `openGraph`
|
|
13
|
-
* - Add check for `title`
|
|
14
|
+
* - Add check for `title` equal to `templateTitle` to avoid meta titles like
|
|
14
15
|
* "My site | My site" often happening in homepages
|
|
15
16
|
* - Remove the open graph videos and images
|
|
16
17
|
*
|
|
@@ -18,7 +19,7 @@ var defaults = {
|
|
|
18
19
|
*
|
|
19
20
|
* @returns
|
|
20
21
|
*/
|
|
21
|
-
export var
|
|
22
|
+
export var seoBuildTags = function (_a) {
|
|
22
23
|
var _b = _a === void 0 ? {} : _a, seo = _b.seo, hidden = _b.hidden, keywords = _b.keywords, _c = _b.title, title = _c === void 0 ? "" : _c, titleTemplate = _b.titleTemplate, defaultTitle = _b.defaultTitle, noindex = _b.noindex, nofollow = _b.nofollow, description = _b.description, _d = _b.languageAlternates, languageAlternates = _d === void 0 ? [] : _d, twitter = _b.twitter, facebook = _b.facebook, openGraph = _b.openGraph, ogAlias = _b.og, canonical = _b.canonical, metaTags = _b.metaTags, linkTags = _b.linkTags;
|
|
23
24
|
var render = [];
|
|
24
25
|
var $names = {};
|
|
@@ -113,3 +114,4 @@ export var buildTags = function (_a) {
|
|
|
113
114
|
// <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
|
|
114
115
|
return render;
|
|
115
116
|
};
|
|
117
|
+
export default seoBuildTags;
|
package/to.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TranslateNamespaced, TranslatedRoute } from "./types-i18n";
|
|
2
|
+
declare type OnlyStatic<T extends string> = T extends `${string}.[${string}]` | `[${string}].${string}` | `[${string}]` ? T : never;
|
|
3
|
+
declare type OnlyDynamic<T extends string> = T extends `${string}.[${string}]` | `[${string}].${string}` | `[${string}]` ? never : T;
|
|
4
|
+
/**
|
|
5
|
+
* @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types#router-params-parsing)
|
|
6
|
+
*/
|
|
7
|
+
declare 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;
|
|
9
|
+
} : T extends `${infer _Start}[${infer Param}]` ? {
|
|
10
|
+
[k in Param]: string;
|
|
11
|
+
} : {};
|
|
12
|
+
export declare type ToTranslate = TranslateNamespaced<"~">;
|
|
13
|
+
export declare type ToStaticRoute = OnlyStatic<TranslatedRoute>;
|
|
14
|
+
export declare type ToDynamicRoute = OnlyDynamic<TranslatedRoute>;
|
|
15
|
+
export declare 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/to.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
*/
|
|
8
|
+
export function to() {
|
|
9
|
+
var args = [];
|
|
10
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
+
args[_i] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
var relative = "";
|
|
14
|
+
var t = args[0];
|
|
15
|
+
if (args.length === 3) {
|
|
16
|
+
if (args[2]) {
|
|
17
|
+
relative = t(args[1], args[2]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (args.length === 2) {
|
|
21
|
+
relative = t(args[1]);
|
|
22
|
+
}
|
|
23
|
+
return relative;
|
|
24
|
+
}
|
|
25
|
+
export default to;
|
|
File without changes
|
|
@@ -101,4 +101,10 @@ export declare type TranslateNamespaced<TNamespace extends TranslateNamespace> =
|
|
|
101
101
|
* to output.
|
|
102
102
|
*/
|
|
103
103
|
export declare type TranslateLoose = (s?: any, q?: TranslationQuery, o?: TranslationOptions) => string;
|
|
104
|
+
/**
|
|
105
|
+
* By convention routes definitions are in the `~.json` file in the locales/{locale}/
|
|
106
|
+
* root folder. This type represent every possibly name of the defined route's
|
|
107
|
+
* localised pathname (even with dynamic portions).
|
|
108
|
+
*/
|
|
109
|
+
export declare type TranslatedRoute = TranslationsPaths<TranslationsDictionary["~"]>;
|
|
104
110
|
export {};
|
|
File without changes
|
package/types-seo.d.ts
ADDED
package/types-seo.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/useBackUrl.d.ts
ADDED
package/useBackUrl.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useRouter } from "next/router";
|
|
3
|
+
import { createStorage } from "@koine/utils";
|
|
4
|
+
var back = createStorage({
|
|
5
|
+
lastUrl: "",
|
|
6
|
+
});
|
|
7
|
+
export function useBackUrl() {
|
|
8
|
+
var asPath = useRouter().asPath;
|
|
9
|
+
var calledOnce = useRef(false);
|
|
10
|
+
var _a = useState(), backUrl = _a[0], setBackUrl = _a[1];
|
|
11
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (calledOnce.current) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var prevLastUrl = back.get("lastUrl");
|
|
17
|
+
// console.log("useBackUrl: prevLastUrl", prevLastUrl);
|
|
18
|
+
// first set it to use on a link, set to undefined if the previous URL
|
|
19
|
+
// is the same as the current one
|
|
20
|
+
setBackUrl(asPath === prevLastUrl || !prevLastUrl ? undefined : prevLastUrl);
|
|
21
|
+
// then update the local storage
|
|
22
|
+
back.set("lastUrl", asPath);
|
|
23
|
+
calledOnce.current = true;
|
|
24
|
+
});
|
|
25
|
+
return backUrl;
|
|
26
|
+
}
|
|
27
|
+
export default useBackUrl;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UseFormProps, FieldValues } from "react-hook-form";
|
|
2
2
|
import type { ObjectSchema } from "@kuus/yup";
|
|
3
|
-
import { type TranslateLoose } from "
|
|
3
|
+
import { type TranslateLoose } from "./types-i18n";
|
|
4
4
|
export declare function useForm<T extends FieldValues>(schema: ObjectSchema<any>, t: TranslateLoose, formProps?: UseFormProps, debug?: boolean): {
|
|
5
5
|
watch: import("react-hook-form").UseFormWatch<T>;
|
|
6
6
|
getValues: import("react-hook-form").UseFormGetValues<T>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TranslateNamespace, TranslateDefault, TranslateNamespaced } from "
|
|
1
|
+
import type { TranslateNamespace, TranslateDefault, TranslateNamespaced } from "./types-i18n";
|
|
2
2
|
/**
|
|
3
3
|
* Wrap `next-translate` useTranslations for type safety and adds TranslationShortcut
|
|
4
4
|
* as second/thir argument.
|
|
File without changes
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @file
|
|
3
|
-
*
|
|
4
|
-
* Adapted from [next-themes](https://github.com/pacocoursey/next-themes)
|
|
5
|
-
*
|
|
6
|
-
* Differences:
|
|
7
|
-
*
|
|
8
|
-
* - enableColorScheme: `false` by default (instead of `true`), this plays more
|
|
9
|
-
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
10
|
-
* controlled by tailwind modifiers
|
|
11
|
-
*/
|
|
12
|
-
import React from "react";
|
|
1
|
+
/// <reference types="react" />
|
|
13
2
|
declare type ValueObject = {
|
|
14
3
|
[themeName: string]: string;
|
|
15
4
|
};
|
|
@@ -47,6 +36,12 @@ export declare type ThemeProviderProps = React.PropsWithChildren<{
|
|
|
47
36
|
/** Nonce string to pass to the inline script for CSP headers */
|
|
48
37
|
nonce?: string;
|
|
49
38
|
}>;
|
|
39
|
+
/**
|
|
40
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
41
|
+
*/
|
|
50
42
|
export declare const useTheme: () => UseThemeProps;
|
|
43
|
+
/**
|
|
44
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
45
|
+
*/
|
|
51
46
|
export declare const ThemeProvider: ({ forcedTheme, disableTransitionOnChange, enableSystem, enableColorScheme, themes, defaultTheme, attribute, value, children, nonce, }: ThemeProviderProps) => JSX.Element;
|
|
52
|
-
export
|
|
47
|
+
export default useTheme;
|
|
@@ -22,7 +22,13 @@ var ThemeContext = createContext({
|
|
|
22
22
|
setTheme: function (_) { },
|
|
23
23
|
themes: [],
|
|
24
24
|
});
|
|
25
|
+
/**
|
|
26
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
27
|
+
*/
|
|
25
28
|
export var useTheme = function () { return useContext(ThemeContext); };
|
|
29
|
+
/**
|
|
30
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
31
|
+
*/
|
|
26
32
|
export var ThemeProvider = function (_a) {
|
|
27
33
|
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;
|
|
28
34
|
var _g = useState(function () {
|
|
@@ -249,3 +255,4 @@ var getSystemTheme = function (e) {
|
|
|
249
255
|
var encodeBase64 = function (str) {
|
|
250
256
|
return isServer ? Buffer.from(str).toString("base64") : btoa(str);
|
|
251
257
|
};
|
|
258
|
+
export default useTheme;
|
package/useTo.d.ts
ADDED
package/useTo.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
|
+
import { useT } from "./useT";
|
|
3
|
+
import { to } from "./to";
|
|
4
|
+
export function useTo() {
|
|
5
|
+
var t = useT("~");
|
|
6
|
+
return function () {
|
|
7
|
+
var args = [];
|
|
8
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9
|
+
args[_i] = arguments[_i];
|
|
10
|
+
}
|
|
11
|
+
return to.apply(void 0, __spreadArray([t], args, false));
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default useTo;
|
package/Analytics/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AnalyticsGoogle";
|
package/Analytics/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AnalyticsGoogle";
|
package/Analytics/package.json
DELETED
package/Auth/package.json
DELETED
package/Favicon/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Favicon";
|
package/Favicon/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Favicon";
|
package/Favicon/package.json
DELETED
package/Forms/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useForm";
|
package/Forms/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useForm";
|
package/Forms/package.json
DELETED
package/Head/Head.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Head } from "next/head";
|
package/Head/Head.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Head } from "next/head";
|
package/Head/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Head";
|
package/Head/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Head";
|
package/Img/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Img";
|
package/Img/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Img";
|
package/Img/package.json
DELETED
package/Link/Link.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { LinkProps as NextLinkProps } from "next/link";
|
|
3
|
-
export declare type LinkProps = Omit<React.ComponentPropsWithRef<"a">, "href"> & Omit<NextLinkProps, "as" | "passHref" | "children"> & {
|
|
4
|
-
Link?: React.ComponentType<any>;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* @see https://next.js.org/docs/api-reference/next/link
|
|
8
|
-
*/
|
|
9
|
-
export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "key" | "title" | "hidden" | "type" | "locale" | "replace" | "slot" | "style" | "children" | "rel" | "href" | "hrefLang" | "property" | "id" | "prefetch" | "onLoad" | "color" | "onBlur" | "onChange" | "onSubmit" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "download" | "media" | "ping" | "target" | "scroll" | "shallow" | "legacyBehavior" | "Link"> & React.RefAttributes<HTMLAnchorElement>>;
|
package/Link/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Link";
|
package/Link/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Link";
|
package/Link/package.json
DELETED
package/NextProgress/index.d.ts
DELETED
package/NextProgress/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NextProgress } from "./NextProgress";
|
package/Seo/Seo.d.ts
DELETED
package/Seo/Seo.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "react";
|
|
3
|
-
import Head from "next/head";
|
|
4
|
-
import { buildTags } from "./helpers";
|
|
5
|
-
var _Seo = function (props) {
|
|
6
|
-
return _jsx(Head, { children: buildTags(props) });
|
|
7
|
-
};
|
|
8
|
-
export var Seo = memo(_Seo);
|
package/Seo/SeoDefaults.d.ts
DELETED
package/Seo/helpers.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { NextSeoProps, DefaultSeoProps } from "next-seo/lib/types";
|
|
3
|
-
export declare type SeoData = {
|
|
4
|
-
hidden?: boolean;
|
|
5
|
-
title?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
keywords?: string | string[];
|
|
8
|
-
ogimage?: string;
|
|
9
|
-
};
|
|
10
|
-
declare type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
|
|
11
|
-
image?: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L395
|
|
15
|
-
*/
|
|
16
|
-
export declare type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLinkTags" | "mobileAlternate" | "robotsProps"> & {
|
|
17
|
-
metaTags?: NextSeoProps["additionalMetaTags"];
|
|
18
|
-
linkTags?: NextSeoProps["additionalLinkTags"];
|
|
19
|
-
seo?: SeoData;
|
|
20
|
-
hidden?: SeoData["hidden"];
|
|
21
|
-
keywords?: SeoData["keywords"];
|
|
22
|
-
openGraph?: SeoPropsOpenGraph;
|
|
23
|
-
og?: SeoPropsOpenGraph;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
|
|
27
|
-
*/
|
|
28
|
-
export declare type SeoDefaultsProps = Omit<DefaultSeoProps, "additionalMetaTags" | "additionalLinkTags" | "dangerouslySetAllPagesToNoIndex" | "dangerouslySetAllPagesToNoFollow" | "defaultOpenGraphImageWidth" | "defaultOpenGraphImageHeight" | "defaultOpenGraphVideoWidth" | "defaultOpenGraphVideoHeight" | "mobileAlternate" | "robotsProps"> & {
|
|
29
|
-
metaTags?: DefaultSeoProps["additionalMetaTags"];
|
|
30
|
-
linkTags?: DefaultSeoProps["additionalLinkTags"];
|
|
31
|
-
};
|
|
32
|
-
declare type BuildTagsParams = SeoProps & SeoDefaultsProps;
|
|
33
|
-
/**
|
|
34
|
-
* We do a couple of things in addition while many other are removed.
|
|
35
|
-
*
|
|
36
|
-
* - Add `seo` meta object coming from a CMS probably
|
|
37
|
-
* - Add `ogimage` and `openGraph.image` as single image source
|
|
38
|
-
* - Add `og` alias to define `openGraph`
|
|
39
|
-
* - Add check for `title` equale to `templateTitle` to avoid meta titles like
|
|
40
|
-
* "My site | My site" often happening in homepages
|
|
41
|
-
* - Remove the open graph videos and images
|
|
42
|
-
*
|
|
43
|
-
* - Shorter code
|
|
44
|
-
*
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
export declare const buildTags: ({ seo, hidden, keywords, title, titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates, twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags, }?: BuildTagsParams) => React.ReactNode[];
|
|
48
|
-
export {};
|