@koine/next 2.0.0-beta.2 → 2.0.0-beta.21
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 +0 -1
- package/12/AnalyticsGoogle.js +15 -21
- package/12/DisableErrorOverlay.d.ts +0 -5
- package/12/DisableErrorOverlay.js +5 -15
- package/12/DynamicNamespaces.d.ts +2 -7
- package/12/DynamicNamespaces.js +3 -12
- package/12/Favicon.d.ts +0 -0
- package/12/Favicon.js +6 -10
- package/12/Link.d.ts +1 -4
- package/12/Link.js +8 -14
- package/12/NextProgress.d.ts +1 -4
- package/12/NextProgress.js +13 -19
- package/12/Seo.d.ts +2 -26
- package/12/Seo.js +6 -33
- package/12/SeoDefaults.d.ts +1 -4
- package/12/SeoDefaults.js +6 -16
- package/12/T.d.ts +1 -7
- package/12/T.js +6 -15
- package/12/TransText.d.ts +0 -0
- package/12/TransText.js +3 -7
- package/12/app/AppHead.d.ts +0 -0
- package/12/app/AppHead.js +5 -10
- package/12/app/AppMain.d.ts +4 -22
- package/12/app/AppMain.js +1 -2
- package/12/app/css/AppMain.d.ts +1 -6
- package/12/app/css/AppMain.js +7 -16
- package/12/app/css/AppTheme.d.ts +2 -5
- package/12/app/css/AppTheme.js +5 -16
- package/12/app/css/auth/index.d.ts +2 -5
- package/12/app/css/auth/index.js +9 -16
- package/12/app/css/index.d.ts +2 -50
- package/12/app/css/index.js +8 -60
- package/12/app/index.d.ts +2 -2
- package/12/app/index.js +2 -5
- package/12/app/sc/AppMain.d.ts +1 -8
- package/12/app/sc/AppMain.js +12 -23
- package/12/app/sc/AppTheme.d.ts +1 -7
- package/12/app/sc/AppTheme.js +6 -13
- package/12/app/sc/auth/index.d.ts +2 -5
- package/12/app/sc/auth/index.js +9 -16
- package/12/app/sc/index.d.ts +2 -52
- package/12/app/sc/index.js +8 -62
- package/12/document/Document.d.ts +0 -10
- package/12/document/Document.js +11 -24
- package/12/document/css/index.d.ts +0 -12
- package/12/document/css/index.js +11 -38
- package/12/document/index.d.ts +2 -2
- package/12/document/index.js +2 -7
- package/12/document/sc/index.d.ts +0 -13
- package/12/document/sc/index.js +21 -38
- package/12/getT.d.ts +1 -6
- package/12/getT.js +3 -13
- package/12/index.d.ts +3 -24
- package/12/index.js +3 -52
- package/12/seoBuildTags.d.ts +2 -17
- package/12/seoBuildTags.js +15 -43
- package/12/to.d.ts +1 -11
- package/12/to.js +4 -14
- package/12/translationAsOptions.d.ts +2 -1
- package/12/translationAsOptions.js +2 -5
- package/12/types-i18n.d.ts +0 -87
- package/12/types-i18n.js +1 -14
- package/12/types-seo.d.ts +0 -0
- package/12/types-seo.js +1 -2
- package/12/types.d.ts +7 -0
- package/12/types.js +2 -0
- package/12/useBackUrl.d.ts +0 -0
- package/12/useBackUrl.js +11 -20
- package/12/useDateFormat.d.ts +0 -4
- package/12/useDateFormat.js +15 -23
- package/12/useForm.d.ts +2 -2
- package/12/useForm.js +9 -33
- package/12/useLocale.d.ts +0 -0
- package/12/useLocale.js +4 -9
- package/12/useT.d.ts +1 -1
- package/12/useT.js +6 -33
- package/12/useTo.d.ts +1 -1
- package/12/useTo.js +7 -11
- package/ThemeContext.d.ts +11 -0
- package/{12/ThemeContext.mjs → ThemeContext.js} +0 -1
- package/ThemeProvider.d.ts +17 -0
- package/{12/ThemeProvider.mjs → ThemeProvider.js} +11 -42
- package/config-i18n.d.ts +52 -0
- package/config-i18n.js +251 -0
- package/config.d.ts +109 -0
- package/config.js +118 -0
- package/getSiteUrl.d.ts +0 -6
- package/getSiteUrl.js +4 -15
- package/index.d.ts +5 -2
- package/index.js +5 -7
- package/load.d.ts +0 -8
- package/load.js +2 -14
- package/package.json +159 -39
- package/useTheme.d.ts +4 -0
- package/{12/useTheme.mjs → useTheme.js} +1 -4
- package/12/AnalyticsGoogle.mjs +0 -34
- package/12/DisableErrorOverlay.mjs +0 -13
- package/12/DynamicNamespaces.mjs +0 -9
- package/12/Favicon.mjs +0 -6
- package/12/Link.mjs +0 -12
- package/12/NextProgress.mjs +0 -42
- package/12/Seo.mjs +0 -29
- package/12/SeoDefaults.mjs +0 -12
- package/12/T.mjs +0 -13
- package/12/ThemeContext.d.ts +0 -17
- package/12/ThemeContext.js +0 -10
- package/12/ThemeProvider.d.ts +0 -35
- package/12/ThemeProvider.js +0 -239
- package/12/TransText.mjs +0 -4
- package/12/app/AppHead.mjs +0 -6
- package/12/app/AppMain.mjs +0 -1
- package/12/app/css/AppMain.mjs +0 -14
- package/12/app/css/AppTheme.mjs +0 -14
- package/12/app/css/auth/index.mjs +0 -13
- package/12/app/css/auth/package.json +0 -6
- package/12/app/css/index.mjs +0 -57
- package/12/app/css/package.json +0 -6
- package/12/app/index.mjs +0 -2
- package/12/app/package.json +0 -6
- package/12/app/sc/AppMain.mjs +0 -25
- package/12/app/sc/AppTheme.mjs +0 -11
- package/12/app/sc/auth/index.mjs +0 -13
- package/12/app/sc/auth/package.json +0 -6
- package/12/app/sc/index.mjs +0 -59
- package/12/app/sc/package.json +0 -6
- package/12/document/Document.mjs +0 -28
- package/12/document/css/index.mjs +0 -45
- package/12/document/css/package.json +0 -6
- package/12/document/index.mjs +0 -2
- package/12/document/package.json +0 -6
- package/12/document/sc/index.mjs +0 -64
- package/12/document/sc/package.json +0 -6
- package/12/getT.mjs +0 -10
- package/12/index.mjs +0 -27
- package/12/package.json +0 -6
- package/12/seoBuildTags.mjs +0 -117
- package/12/to.mjs +0 -25
- package/12/translationAsOptions.mjs +0 -9
- package/12/types-i18n.mjs +0 -13
- package/12/types-seo.mjs +0 -1
- package/12/useBackUrl.mjs +0 -28
- package/12/useDateFormat.mjs +0 -39
- package/12/useForm.mjs +0 -35
- package/12/useLocale.mjs +0 -6
- package/12/useT.mjs +0 -21
- package/12/useTheme.d.ts +0 -7
- package/12/useTheme.js +0 -12
- package/12/useTo.mjs +0 -15
- package/README.md +0 -13
- package/config/index.d.ts +0 -160
- package/config/index.js +0 -343
- package/config/index.mjs +0 -332
- package/config/package.json +0 -6
- package/getSiteUrl.mjs +0 -12
- package/index.mjs +0 -2
- package/load.mjs +0 -14
package/12/document/sc/index.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
4
|
-
/* ? eslint-disable @next/next/no-document-import-in-page */
|
|
5
|
-
import NextDocument, { Html, Head, Main, NextScript, } from "next/document";
|
|
6
|
-
import { ServerStyleSheet } from "styled-components";
|
|
7
|
-
import Meta from "@koine/react/Meta";
|
|
8
|
-
import NoJs from "@koine/react/NoJs";
|
|
9
|
-
/**
|
|
10
|
-
* Next Document wrapper for `styled-components` based projects
|
|
11
|
-
*
|
|
12
|
-
* For typescript safety of this component
|
|
13
|
-
* @see https://bit.ly/3ceuF8m
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* in your `myapp/pages/_document.tsx`:
|
|
18
|
-
* ```tsx
|
|
19
|
-
* export { Document as default } from "@koine/next/document/sc";
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
var Document = /** @class */ (function (_super) {
|
|
23
|
-
__extends(Document, _super);
|
|
24
|
-
function Document() {
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
Document.getInitialProps = function (ctx) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
29
|
-
var sheet, originalRenderPage, initialProps;
|
|
30
|
-
return __generator(this, function (_a) {
|
|
31
|
-
switch (_a.label) {
|
|
32
|
-
case 0:
|
|
33
|
-
sheet = new ServerStyleSheet();
|
|
34
|
-
originalRenderPage = ctx.renderPage;
|
|
35
|
-
_a.label = 1;
|
|
36
|
-
case 1:
|
|
37
|
-
_a.trys.push([1, , 3, 4]);
|
|
38
|
-
ctx.renderPage = function () {
|
|
39
|
-
return originalRenderPage({
|
|
40
|
-
enhanceApp: function (App) { return function (props) {
|
|
41
|
-
return sheet.collectStyles(_jsx(App, __assign({}, props)));
|
|
42
|
-
}; },
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
return [4 /*yield*/, NextDocument.getInitialProps(ctx)];
|
|
46
|
-
case 2:
|
|
47
|
-
initialProps = _a.sent();
|
|
48
|
-
return [2 /*return*/, __assign(__assign({}, initialProps), { styles: (_jsxs(React.Fragment, { children: [initialProps.styles, sheet.getStyleElement()] })) })];
|
|
49
|
-
case 3:
|
|
50
|
-
sheet.seal();
|
|
51
|
-
return [7 /*endfinally*/];
|
|
52
|
-
case 4: return [2 /*return*/];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
Document.prototype.render = function () {
|
|
58
|
-
var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
|
|
59
|
-
return (_jsxs(Html, { lang: locale || defaultLocale, className: "no-js", children: [_jsxs(Head, { children: [_jsx(Meta, {}), _jsx(NoJs, {})] }), _jsxs("body", { children: [_jsx(Main, {}), _jsx(NextScript, {})] })] }));
|
|
60
|
-
};
|
|
61
|
-
return Document;
|
|
62
|
-
}(NextDocument));
|
|
63
|
-
export { Document };
|
|
64
|
-
export default Document;
|
package/12/getT.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
|
|
3
|
-
import getTranslation from "next-translate/getT";
|
|
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 getT = getTranslation;
|
|
10
|
-
export default getT;
|
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/package.json
DELETED
package/12/seoBuildTags.mjs
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import isArray from "@koine/utils/isArray";
|
|
4
|
-
var 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
|
-
*/
|
|
22
|
-
export var seoBuildTags = function (_a) {
|
|
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;
|
|
24
|
-
var id = "seo-";
|
|
25
|
-
var render = [];
|
|
26
|
-
var $names = {};
|
|
27
|
-
var $properties = {};
|
|
28
|
-
if (titleTemplate) {
|
|
29
|
-
defaults.tplTitle = titleTemplate;
|
|
30
|
-
}
|
|
31
|
-
title = title || (seo === null || seo === void 0 ? void 0 : seo.title) || "";
|
|
32
|
-
if (title) {
|
|
33
|
-
if (defaults.tplTitle && defaults.tplTitle !== title) {
|
|
34
|
-
title = defaults.tplTitle.replace(/%s/g, title);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else if (defaultTitle) {
|
|
38
|
-
title = defaultTitle;
|
|
39
|
-
}
|
|
40
|
-
if (title) {
|
|
41
|
-
render.push(_jsx("title", { children: title }, id + "title"));
|
|
42
|
-
$properties["og:title"] = title; // overridden later...
|
|
43
|
-
}
|
|
44
|
-
$names["robots"] = "".concat(noindex || hidden ? "noindex" : "index", ",").concat(nofollow || hidden ? "nofollow" : "follow");
|
|
45
|
-
description = description || (seo === null || seo === void 0 ? void 0 : seo.description);
|
|
46
|
-
if (description) {
|
|
47
|
-
$names["description"] = description;
|
|
48
|
-
$properties["og:description"] = description; // overridden later...
|
|
49
|
-
}
|
|
50
|
-
keywords = keywords || (seo === null || seo === void 0 ? void 0 : seo.keywords);
|
|
51
|
-
if (keywords) {
|
|
52
|
-
$names["keywords"] = isArray(keywords) ? keywords.join(", ") : keywords;
|
|
53
|
-
}
|
|
54
|
-
if ((languageAlternates === null || languageAlternates === void 0 ? void 0 : languageAlternates.length) > 0) {
|
|
55
|
-
languageAlternates.forEach(function (_a) {
|
|
56
|
-
var href = _a.href, hrefLang = _a.hrefLang;
|
|
57
|
-
render.push(_jsx("link", { rel: "alternate", hrefLang: hrefLang, href: href }, id + "languageAlternate-" + hrefLang));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (canonical) {
|
|
61
|
-
render.push(_jsx("link", { rel: "canonical", href: canonical }, id + "canonical"));
|
|
62
|
-
$properties["og:url"] = canonical;
|
|
63
|
-
}
|
|
64
|
-
if (facebook === null || facebook === void 0 ? void 0 : facebook.appId)
|
|
65
|
-
$properties["fb:app_id"] = facebook.appId;
|
|
66
|
-
if (twitter) {
|
|
67
|
-
if (twitter.cardType)
|
|
68
|
-
$names["twitter:card"] = twitter.cardType;
|
|
69
|
-
if (twitter.site)
|
|
70
|
-
$names["twitter:site"] = twitter.site;
|
|
71
|
-
if (twitter.handle)
|
|
72
|
-
$names["twitter:creator"] = twitter.handle;
|
|
73
|
-
}
|
|
74
|
-
var og = ogAlias || openGraph;
|
|
75
|
-
if (og === null || og === void 0 ? void 0 : og.title)
|
|
76
|
-
$properties["og:title"] = og === null || og === void 0 ? void 0 : og.title;
|
|
77
|
-
if (og === null || og === void 0 ? void 0 : og.description)
|
|
78
|
-
$properties["og:description"] = og === null || og === void 0 ? void 0 : og.description;
|
|
79
|
-
if (og === null || og === void 0 ? void 0 : og.url)
|
|
80
|
-
$properties["og:url"] = og.url;
|
|
81
|
-
if (og === null || og === void 0 ? void 0 : og.type)
|
|
82
|
-
$properties["og:type"] = og.type.toLowerCase();
|
|
83
|
-
if (og === null || og === void 0 ? void 0 : og.locale)
|
|
84
|
-
$properties["og:locale"] = og.locale;
|
|
85
|
-
if (og === null || og === void 0 ? void 0 : og.siteName)
|
|
86
|
-
$properties["og:siteName"] = og.siteName;
|
|
87
|
-
var ogimage = (og === null || og === void 0 ? void 0 : og.image) || (seo === null || seo === void 0 ? void 0 : seo.ogimage);
|
|
88
|
-
if (ogimage)
|
|
89
|
-
$properties["og:image"] = ogimage;
|
|
90
|
-
Object.keys($names).forEach(function (key) {
|
|
91
|
-
render.push(_jsx("meta", { name: key, content: $names[key] }, id + "name-" + key));
|
|
92
|
-
});
|
|
93
|
-
Object.keys($properties).forEach(function (key) {
|
|
94
|
-
render.push(_jsx("meta", { property: key, content: $properties[key] }, id + "prop-" + +key));
|
|
95
|
-
});
|
|
96
|
-
if (metaTags && metaTags.length > 0) {
|
|
97
|
-
metaTags.forEach(function (tag) {
|
|
98
|
-
render.push(_jsx("meta", __assign({}, tag), id + "meta-" + (tag.name || tag.property || tag.httpEquiv)));
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (linkTags === null || linkTags === void 0 ? void 0 : linkTags.length) {
|
|
102
|
-
linkTags.forEach(function (tag) {
|
|
103
|
-
render.push(_jsx("link", __assign({}, tag), id + "link-" + (tag.href || tag.rel)));
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
// TODO: alternates and canonical
|
|
107
|
-
// canonical = 'https://www.domain.com/';
|
|
108
|
-
// languageAlternates={[{
|
|
109
|
-
// hrefLang: 'en',
|
|
110
|
-
// href: 'https://www.domain.com/en',
|
|
111
|
-
// }]}
|
|
112
|
-
// <link rel="alternate" hreflang="x-default" href="https://www.domain.com/nl/">
|
|
113
|
-
// <link rel="alternate" hreflang="nl" href="https://www.domain.com/nl/">
|
|
114
|
-
// <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
|
|
115
|
-
return render;
|
|
116
|
-
};
|
|
117
|
-
export default seoBuildTags;
|
package/12/to.mjs
DELETED
|
@@ -1,25 +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
|
-
*/
|
|
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]).replace("*", "");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else if (args.length === 2) {
|
|
21
|
-
relative = t(args[1]);
|
|
22
|
-
}
|
|
23
|
-
return relative;
|
|
24
|
-
}
|
|
25
|
-
export default to;
|
package/12/types-i18n.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file
|
|
3
|
-
*
|
|
4
|
-
* Test this on TSplayground:
|
|
5
|
-
* https://www.typescriptlang.org/play?#code/PTAEFpK6dv4YpSBQJSgJYEYAcA7YAFwE8AHTfAcwGcA6AEzqJrTGQ86+7hRQYCmAYwA2AQwBOA0PjEBbATTJih0gJJ58oAN4oMlIgIkAzFdIAqEsfhriimAPY2dejKHQAiAH4eAXKGsSAG5XAF8+fXxDEzNQS2tbMXsnGgBhJ2NMKh1w8LYIHkKi4sh8rE1ickVmVnQS+obUFFIyaQApB0oAHgBlbAAaUB6AJgA+UABeIexQAQAPQ3wGGlAaIglKKlcAfiHh2YWBJZW1jepXDF2AAwASbT7QujuR0KuL0H8+1398AQA3IwhNAAKmBemBoAAIpghMlZBISKA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see
|
|
8
|
-
* - https://stackoverflow.com/q/75531366/1938970: fix for `Type instantiation is excessively deep and possibly infinite in Promise.all`
|
|
9
|
-
*
|
|
10
|
-
* @notes
|
|
11
|
-
* I might take a better look at how things were done in [i18next](https://github.com/i18next/i18next/blob/master/index.d.ts)
|
|
12
|
-
*/
|
|
13
|
-
export {};
|
package/12/types-seo.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/12/useBackUrl.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { useRouter } from "next/router";
|
|
4
|
-
import createStorage from "@koine/browser/createStorage";
|
|
5
|
-
var back = createStorage({
|
|
6
|
-
lastUrl: "",
|
|
7
|
-
});
|
|
8
|
-
export function useBackUrl() {
|
|
9
|
-
var asPath = useRouter().asPath;
|
|
10
|
-
var calledOnce = useRef(false);
|
|
11
|
-
var _a = useState(), backUrl = _a[0], setBackUrl = _a[1];
|
|
12
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
useEffect(function () {
|
|
14
|
-
if (calledOnce.current) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
var prevLastUrl = back.get("lastUrl");
|
|
18
|
-
// console.log("useBackUrl: prevLastUrl", prevLastUrl);
|
|
19
|
-
// first set it to use on a link, set to undefined if the previous URL
|
|
20
|
-
// is the same as the current one
|
|
21
|
-
setBackUrl(asPath === prevLastUrl || !prevLastUrl ? undefined : prevLastUrl);
|
|
22
|
-
// then update the local storage
|
|
23
|
-
back.set("lastUrl", asPath);
|
|
24
|
-
calledOnce.current = true;
|
|
25
|
-
});
|
|
26
|
-
return backUrl;
|
|
27
|
-
}
|
|
28
|
-
export default useBackUrl;
|
package/12/useDateFormat.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __assign } from "tslib";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { useRouter } from "next/router";
|
|
5
|
-
import format from "date-fns/format";
|
|
6
|
-
import useDateLocale from "@koine/react/hooks/useDateLocale";
|
|
7
|
-
/**
|
|
8
|
-
* Automatically returns the `date-fns/format` function with the right locale
|
|
9
|
-
* passed as option (grabbed from next router value).
|
|
10
|
-
*/
|
|
11
|
-
export var useDateFormat = function () {
|
|
12
|
-
var _a = useState(function () {
|
|
13
|
-
return function () {
|
|
14
|
-
var args = [];
|
|
15
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
16
|
-
args[_i] = arguments[_i];
|
|
17
|
-
}
|
|
18
|
-
return format.apply(void 0, args);
|
|
19
|
-
};
|
|
20
|
-
}), formatter = _a[0], setFormatter = _a[1];
|
|
21
|
-
var router = useRouter();
|
|
22
|
-
var locale = useDateLocale(router.locale);
|
|
23
|
-
useEffect(function () {
|
|
24
|
-
if (locale) {
|
|
25
|
-
var newFormatter_1 = function (date, _format, options) { return format(date, _format, __assign(__assign({}, (options || {})), { locale: locale })); };
|
|
26
|
-
setFormatter(function () {
|
|
27
|
-
return function () {
|
|
28
|
-
var args = [];
|
|
29
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
30
|
-
args[_i] = arguments[_i];
|
|
31
|
-
}
|
|
32
|
-
return newFormatter_1.apply(void 0, args);
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}, [locale]);
|
|
37
|
-
return formatter;
|
|
38
|
-
};
|
|
39
|
-
export default useDateFormat;
|
package/12/useForm.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __assign } from "tslib";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { useForm as _useForm } from "react-hook-form";
|
|
5
|
-
import { yupResolver as resolver } from "@hookform/resolvers/yup";
|
|
6
|
-
export function useForm(
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
schema, t, formProps, debug) {
|
|
9
|
-
if (formProps === void 0) { formProps = {}; }
|
|
10
|
-
// const form = _useForm<InferType<ObjectSchema<T, object>>>({
|
|
11
|
-
var form = _useForm(__assign({
|
|
12
|
-
// @ts-expect-error FIXME:
|
|
13
|
-
resolver: resolver(schema) }, formProps));
|
|
14
|
-
// const { control, register, setValue } = form;
|
|
15
|
-
// const field = { control, register, setValue, t };
|
|
16
|
-
// if (process.env["NODE_ENV"] !== "production") {
|
|
17
|
-
// if (debug) {
|
|
18
|
-
// console.info(
|
|
19
|
-
// `Form ${i18nNamespace} data`,
|
|
20
|
-
// form.watch(),
|
|
21
|
-
// `errors: `,
|
|
22
|
-
// form.formState.errors
|
|
23
|
-
// );
|
|
24
|
-
// }
|
|
25
|
-
// }
|
|
26
|
-
// if (formProps.mode === "onChange") {
|
|
27
|
-
// return { field, ...form };
|
|
28
|
-
// }
|
|
29
|
-
return useMemo(function () {
|
|
30
|
-
var control = form.control, register = form.register, setValue = form.setValue;
|
|
31
|
-
var field = { control: control, register: register, setValue: setValue, t: t };
|
|
32
|
-
return __assign({ field: field }, form);
|
|
33
|
-
}, [t, form]);
|
|
34
|
-
}
|
|
35
|
-
export default useForm;
|
package/12/useLocale.mjs
DELETED
package/12/useT.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useContext, useMemo } from "react";
|
|
3
|
-
// import useTranslation from "next-translate/useTranslation";
|
|
4
|
-
import I18nContext from "next-translate/context";
|
|
5
|
-
export function useT(namespace) {
|
|
6
|
-
var t = useContext(I18nContext).t;
|
|
7
|
-
// const t = useTranslation().t;
|
|
8
|
-
var tMemoized = useMemo(function () {
|
|
9
|
-
return function (s, q, o) {
|
|
10
|
-
return t(namespace ? "".concat(namespace, ":").concat(s) : "".concat(s), q === "obj" || q === "" ? null : q, q === "obj" || o === "obj"
|
|
11
|
-
? { returnObjects: true }
|
|
12
|
-
: q === "" || o === ""
|
|
13
|
-
? { fallback: "" }
|
|
14
|
-
: o);
|
|
15
|
-
// ) as TReturn extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : TReturn;
|
|
16
|
-
// );
|
|
17
|
-
};
|
|
18
|
-
}, [t, namespace]);
|
|
19
|
-
return tMemoized;
|
|
20
|
-
}
|
|
21
|
-
export default useT;
|
package/12/useTheme.d.ts
DELETED
package/12/useTheme.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useTheme = void 0;
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var ThemeContext_1 = require("./ThemeContext");
|
|
7
|
-
/**
|
|
8
|
-
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
9
|
-
*/
|
|
10
|
-
var useTheme = function () { return (0, react_1.useContext)(ThemeContext_1.ThemeContext); };
|
|
11
|
-
exports.useTheme = useTheme;
|
|
12
|
-
exports.default = exports.useTheme;
|
package/12/useTo.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __spreadArray } from "tslib";
|
|
3
|
-
import { useT } from "./useT";
|
|
4
|
-
import { to } from "./to";
|
|
5
|
-
export function useTo() {
|
|
6
|
-
var t = useT("~");
|
|
7
|
-
return function () {
|
|
8
|
-
var args = [];
|
|
9
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
-
args[_i] = arguments[_i];
|
|
11
|
-
}
|
|
12
|
-
return to.apply(void 0, __spreadArray([t], args, false));
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export default useTo;
|
package/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# @koine/next
|
|
2
|
-
|
|
3
|
-
## i18n
|
|
4
|
-
|
|
5
|
-
To make typescript work nicely with `useT`, `getT` and `T` make sure to enable [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule) in your `tsconfig.json` file:
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"compilerOptions": {
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
```
|
package/config/index.d.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import type { NextConfig } from "next";
|
|
2
|
-
import type { Redirect, Rewrite } from "next/dist/lib/load-custom-routes";
|
|
3
|
-
type Route = string | {
|
|
4
|
-
[key: string]: Route | string;
|
|
5
|
-
};
|
|
6
|
-
type Routes = Record<string, Route>;
|
|
7
|
-
type RoutesMapRoute = {
|
|
8
|
-
template: string;
|
|
9
|
-
pathname: string;
|
|
10
|
-
wildcard?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Normalise pathname
|
|
14
|
-
*
|
|
15
|
-
* From a path like `/some//malformed/path///` it returns `some/malformed/path`
|
|
16
|
-
*
|
|
17
|
-
* - Removes subsequent slashes
|
|
18
|
-
* - Removing initial and ending slashes
|
|
19
|
-
* - Returns an empty string `"""` if only slashes are given
|
|
20
|
-
*/
|
|
21
|
-
export declare function normaliseUrlPathname(pathname?: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Transform to path any absolute or relative URL
|
|
24
|
-
*
|
|
25
|
-
* Useful when setting up `rewrites` and `redirects` especally in a [multi-zones
|
|
26
|
-
* setup](https://nextjs.org/docs/advanced-features/multi-zones).
|
|
27
|
-
*
|
|
28
|
-
* From a path like `http://localhost/some//malformed/path///` it returns `/some/malformed/path`
|
|
29
|
-
*
|
|
30
|
-
* @see {@link normaliseUrlPathname}
|
|
31
|
-
*/
|
|
32
|
-
export declare function toPath(urlOrPathname?: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Clean a pathname and encode each part
|
|
35
|
-
*
|
|
36
|
-
* @see {@link normaliseUrlPathname}
|
|
37
|
-
*/
|
|
38
|
-
export declare function encodePathname(pathname?: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Get path rewrite
|
|
41
|
-
*/
|
|
42
|
-
export declare function getPathRewrite(route: RoutesMapRoute): {
|
|
43
|
-
source: string;
|
|
44
|
-
destination: string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Get path redirect
|
|
48
|
-
*/
|
|
49
|
-
export declare function getPathRedirect(locale: string | undefined, route: RoutesMapRoute, permanent?: boolean): {
|
|
50
|
-
source: string;
|
|
51
|
-
destination: string;
|
|
52
|
-
permanent: boolean;
|
|
53
|
-
locale: false;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
*/
|
|
57
|
-
export declare function getRedirects(defaultLocale: string, routes: Routes, permanent?: boolean, debug?: boolean): Promise<Redirect[]>;
|
|
58
|
-
/**
|
|
59
|
-
*/
|
|
60
|
-
export declare function getRewrites(routes: Routes, debug?: boolean): Promise<Rewrite[]>;
|
|
61
|
-
type KoineNextConfig = {
|
|
62
|
-
/** @default true Nx monorepo setup */
|
|
63
|
-
nx?: boolean;
|
|
64
|
-
/** @default true Svg to react components */
|
|
65
|
-
svg?: boolean;
|
|
66
|
-
/** @default true Styled components enabled */
|
|
67
|
-
sc?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* When true uses `*.page.ts` or `*.page.tsx` extension for next.js config option [`pageExtensions`](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory). When `true` it enables the same for `next-translate`
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
page?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* A JSON file containing the routes definition mapping template folders
|
|
75
|
-
* to localised slugs. It supports slugs's dynamic portions.
|
|
76
|
-
* All translated slugs needs to be defined starting from root `/`.
|
|
77
|
-
* The `require("...json")` file for each locale should look like:
|
|
78
|
-
*
|
|
79
|
-
* ```json
|
|
80
|
-
* {
|
|
81
|
-
* "home": "/",
|
|
82
|
-
* "products": {
|
|
83
|
-
* "list": "/products",
|
|
84
|
-
* "[category]": "/products/{{ category }}",
|
|
85
|
-
* "[tag]": {
|
|
86
|
-
* "view": "/products/{{ category }}/{{ tag }}",
|
|
87
|
-
* "related": "/products/{{ category }}/{{ tag }}/related"
|
|
88
|
-
* }
|
|
89
|
-
* },
|
|
90
|
-
* "company": {
|
|
91
|
-
* "about": "/about",
|
|
92
|
-
* "contact": "/contact"
|
|
93
|
-
* }
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* Here we also account for wildcards, those should only be defined in the
|
|
98
|
-
* pathname part of the JSON file, e.g.:
|
|
99
|
-
*
|
|
100
|
-
* ```json
|
|
101
|
-
* {
|
|
102
|
-
* "category": {
|
|
103
|
-
* "[slug]": {
|
|
104
|
-
* "[id]": "/categories/{{ slug }}/{{ id }}*"
|
|
105
|
-
* }
|
|
106
|
-
* }
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
* This might be desired when we want to have param-based pagination, e.g. when
|
|
110
|
-
* we have the following folder structure:
|
|
111
|
-
*
|
|
112
|
-
* ```yml
|
|
113
|
-
* |__/category
|
|
114
|
-
* |__/[slug]
|
|
115
|
-
* |__/[id]
|
|
116
|
-
* |__/[[...page]].tsx
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* NOTE1:
|
|
120
|
-
* You cannot name your dynamic template file "index.tsx" when they have nested
|
|
121
|
-
* segments or the rewrites won't work. So while this is allowed:
|
|
122
|
-
* `/pages/cats/[category]/index.tsx` it is not when you also have e.g.:
|
|
123
|
-
* `/pages/cats/[category]/reviews.tsx`
|
|
124
|
-
* TODO: This might be fixable? Is this fixed now?
|
|
125
|
-
*
|
|
126
|
-
* NOTE2:
|
|
127
|
-
* When `routes` is used be sure to pass before than the `i18n.defaultLocale`
|
|
128
|
-
* configuration. That is used for localised routing. By default we set `i18n`
|
|
129
|
-
* as such:
|
|
130
|
-
* ```js
|
|
131
|
-
* {
|
|
132
|
-
* // ...nextConfig,
|
|
133
|
-
* i18n: {
|
|
134
|
-
* defaultLocale: "en",
|
|
135
|
-
* locales: ["en"],
|
|
136
|
-
* }
|
|
137
|
-
* }
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
routes?: Routes;
|
|
141
|
-
/**
|
|
142
|
-
* Whether the routes redirecting should be permanent. Switch this on once you
|
|
143
|
-
* go live and the routes structure is stable.
|
|
144
|
-
*/
|
|
145
|
-
permanent?: boolean;
|
|
146
|
-
debug?: boolean;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Get Next.js config with some basic opinionated defaults
|
|
150
|
-
*
|
|
151
|
-
* @param {object} options
|
|
152
|
-
* @property {boolean} [options.nx=false] Nx monorepo setup
|
|
153
|
-
* @property {boolean} [options.svg=false] Svg to react components
|
|
154
|
-
* @property {boolean} [options.sc=false] Styled components enabled
|
|
155
|
-
* @property {boolean} [options.page=false] When `true` uses `*.page.ts` or `*.page.tsx`
|
|
156
|
-
* extension for next.js config option [`pageExtensions`](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory)
|
|
157
|
-
* and it enables the same for `next-translate`.
|
|
158
|
-
*/
|
|
159
|
-
export declare function withKoine({ nx, svg, sc, page, routes, permanent, debug, ...custom }?: NextConfig & KoineNextConfig): NextConfig;
|
|
160
|
-
export default withKoine;
|