@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.
Files changed (156) hide show
  1. package/12/AnalyticsGoogle.d.ts +0 -1
  2. package/12/AnalyticsGoogle.js +15 -21
  3. package/12/DisableErrorOverlay.d.ts +0 -5
  4. package/12/DisableErrorOverlay.js +5 -15
  5. package/12/DynamicNamespaces.d.ts +2 -7
  6. package/12/DynamicNamespaces.js +3 -12
  7. package/12/Favicon.d.ts +0 -0
  8. package/12/Favicon.js +6 -10
  9. package/12/Link.d.ts +1 -4
  10. package/12/Link.js +8 -14
  11. package/12/NextProgress.d.ts +1 -4
  12. package/12/NextProgress.js +13 -19
  13. package/12/Seo.d.ts +2 -26
  14. package/12/Seo.js +6 -33
  15. package/12/SeoDefaults.d.ts +1 -4
  16. package/12/SeoDefaults.js +6 -16
  17. package/12/T.d.ts +1 -7
  18. package/12/T.js +6 -15
  19. package/12/TransText.d.ts +0 -0
  20. package/12/TransText.js +3 -7
  21. package/12/app/AppHead.d.ts +0 -0
  22. package/12/app/AppHead.js +5 -10
  23. package/12/app/AppMain.d.ts +4 -22
  24. package/12/app/AppMain.js +1 -2
  25. package/12/app/css/AppMain.d.ts +1 -6
  26. package/12/app/css/AppMain.js +7 -16
  27. package/12/app/css/AppTheme.d.ts +2 -5
  28. package/12/app/css/AppTheme.js +5 -16
  29. package/12/app/css/auth/index.d.ts +2 -5
  30. package/12/app/css/auth/index.js +9 -16
  31. package/12/app/css/index.d.ts +2 -50
  32. package/12/app/css/index.js +8 -60
  33. package/12/app/index.d.ts +2 -2
  34. package/12/app/index.js +2 -5
  35. package/12/app/sc/AppMain.d.ts +1 -8
  36. package/12/app/sc/AppMain.js +12 -23
  37. package/12/app/sc/AppTheme.d.ts +1 -7
  38. package/12/app/sc/AppTheme.js +6 -13
  39. package/12/app/sc/auth/index.d.ts +2 -5
  40. package/12/app/sc/auth/index.js +9 -16
  41. package/12/app/sc/index.d.ts +2 -52
  42. package/12/app/sc/index.js +8 -62
  43. package/12/document/Document.d.ts +0 -10
  44. package/12/document/Document.js +11 -24
  45. package/12/document/css/index.d.ts +0 -12
  46. package/12/document/css/index.js +11 -38
  47. package/12/document/index.d.ts +2 -2
  48. package/12/document/index.js +2 -7
  49. package/12/document/sc/index.d.ts +0 -13
  50. package/12/document/sc/index.js +21 -38
  51. package/12/getT.d.ts +1 -6
  52. package/12/getT.js +3 -13
  53. package/12/index.d.ts +3 -24
  54. package/12/index.js +3 -52
  55. package/12/seoBuildTags.d.ts +2 -17
  56. package/12/seoBuildTags.js +15 -43
  57. package/12/to.d.ts +1 -11
  58. package/12/to.js +4 -14
  59. package/12/translationAsOptions.d.ts +2 -1
  60. package/12/translationAsOptions.js +2 -5
  61. package/12/types-i18n.d.ts +0 -87
  62. package/12/types-i18n.js +1 -14
  63. package/12/types-seo.d.ts +0 -0
  64. package/12/types-seo.js +1 -2
  65. package/12/types.d.ts +7 -0
  66. package/12/types.js +2 -0
  67. package/12/useBackUrl.d.ts +0 -0
  68. package/12/useBackUrl.js +11 -20
  69. package/12/useDateFormat.d.ts +0 -4
  70. package/12/useDateFormat.js +15 -23
  71. package/12/useForm.d.ts +2 -2
  72. package/12/useForm.js +9 -33
  73. package/12/useLocale.d.ts +0 -0
  74. package/12/useLocale.js +4 -9
  75. package/12/useT.d.ts +1 -1
  76. package/12/useT.js +6 -33
  77. package/12/useTo.d.ts +1 -1
  78. package/12/useTo.js +7 -11
  79. package/ThemeContext.d.ts +11 -0
  80. package/{12/ThemeContext.mjs → ThemeContext.js} +0 -1
  81. package/ThemeProvider.d.ts +17 -0
  82. package/{12/ThemeProvider.mjs → ThemeProvider.js} +11 -42
  83. package/config-i18n.d.ts +52 -0
  84. package/config-i18n.js +251 -0
  85. package/config.d.ts +109 -0
  86. package/config.js +118 -0
  87. package/getSiteUrl.d.ts +0 -6
  88. package/getSiteUrl.js +4 -15
  89. package/index.d.ts +5 -2
  90. package/index.js +5 -7
  91. package/load.d.ts +0 -8
  92. package/load.js +2 -14
  93. package/package.json +159 -39
  94. package/useTheme.d.ts +4 -0
  95. package/{12/useTheme.mjs → useTheme.js} +1 -4
  96. package/12/AnalyticsGoogle.mjs +0 -34
  97. package/12/DisableErrorOverlay.mjs +0 -13
  98. package/12/DynamicNamespaces.mjs +0 -9
  99. package/12/Favicon.mjs +0 -6
  100. package/12/Link.mjs +0 -12
  101. package/12/NextProgress.mjs +0 -42
  102. package/12/Seo.mjs +0 -29
  103. package/12/SeoDefaults.mjs +0 -12
  104. package/12/T.mjs +0 -13
  105. package/12/ThemeContext.d.ts +0 -17
  106. package/12/ThemeContext.js +0 -10
  107. package/12/ThemeProvider.d.ts +0 -35
  108. package/12/ThemeProvider.js +0 -239
  109. package/12/TransText.mjs +0 -4
  110. package/12/app/AppHead.mjs +0 -6
  111. package/12/app/AppMain.mjs +0 -1
  112. package/12/app/css/AppMain.mjs +0 -14
  113. package/12/app/css/AppTheme.mjs +0 -14
  114. package/12/app/css/auth/index.mjs +0 -13
  115. package/12/app/css/auth/package.json +0 -6
  116. package/12/app/css/index.mjs +0 -57
  117. package/12/app/css/package.json +0 -6
  118. package/12/app/index.mjs +0 -2
  119. package/12/app/package.json +0 -6
  120. package/12/app/sc/AppMain.mjs +0 -25
  121. package/12/app/sc/AppTheme.mjs +0 -11
  122. package/12/app/sc/auth/index.mjs +0 -13
  123. package/12/app/sc/auth/package.json +0 -6
  124. package/12/app/sc/index.mjs +0 -59
  125. package/12/app/sc/package.json +0 -6
  126. package/12/document/Document.mjs +0 -28
  127. package/12/document/css/index.mjs +0 -45
  128. package/12/document/css/package.json +0 -6
  129. package/12/document/index.mjs +0 -2
  130. package/12/document/package.json +0 -6
  131. package/12/document/sc/index.mjs +0 -64
  132. package/12/document/sc/package.json +0 -6
  133. package/12/getT.mjs +0 -10
  134. package/12/index.mjs +0 -27
  135. package/12/package.json +0 -6
  136. package/12/seoBuildTags.mjs +0 -117
  137. package/12/to.mjs +0 -25
  138. package/12/translationAsOptions.mjs +0 -9
  139. package/12/types-i18n.mjs +0 -13
  140. package/12/types-seo.mjs +0 -1
  141. package/12/useBackUrl.mjs +0 -28
  142. package/12/useDateFormat.mjs +0 -39
  143. package/12/useForm.mjs +0 -35
  144. package/12/useLocale.mjs +0 -6
  145. package/12/useT.mjs +0 -21
  146. package/12/useTheme.d.ts +0 -7
  147. package/12/useTheme.js +0 -12
  148. package/12/useTo.mjs +0 -15
  149. package/README.md +0 -13
  150. package/config/index.d.ts +0 -160
  151. package/config/index.js +0 -343
  152. package/config/index.mjs +0 -332
  153. package/config/package.json +0 -6
  154. package/getSiteUrl.mjs +0 -12
  155. package/index.mjs +0 -2
  156. package/load.mjs +0 -14
@@ -1,39 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Document = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var react_1 = tslib_1.__importDefault(require("react"));
7
- /* ? eslint-disable @next/next/no-document-import-in-page */
8
- var document_1 = tslib_1.__importStar(require("next/document"));
9
- var styled_components_1 = require("styled-components");
10
- var Meta_1 = tslib_1.__importDefault(require("@koine/react/Meta"));
11
- var NoJs_1 = tslib_1.__importDefault(require("@koine/react/NoJs"));
12
- /**
13
- * Next Document wrapper for `styled-components` based projects
14
- *
15
- * For typescript safety of this component
16
- * @see https://bit.ly/3ceuF8m
17
- *
18
- * @example
19
- *
20
- * in your `myapp/pages/_document.tsx`:
21
- * ```tsx
22
- * export { Document as default } from "@koine/next/document/sc";
23
- * ```
24
- */
25
- var Document = /** @class */ (function (_super) {
26
- tslib_1.__extends(Document, _super);
1
+ import { __assign, __awaiter, __extends, __generator } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import NextDocument, { Head, Html, Main, NextScript, } from "next/document";
4
+ import React from "react";
5
+ import { ServerStyleSheet } from "styled-components";
6
+ import Meta from "@koine/react/Meta";
7
+ import NoJs from "@koine/react/NoJs";
8
+ var Document = (function (_super) {
9
+ __extends(Document, _super);
27
10
  function Document() {
28
11
  return _super !== null && _super.apply(this, arguments) || this;
29
12
  }
30
13
  Document.getInitialProps = function (ctx) {
31
- return tslib_1.__awaiter(this, void 0, void 0, function () {
14
+ return __awaiter(this, void 0, void 0, function () {
32
15
  var sheet, originalRenderPage, initialProps;
33
- return tslib_1.__generator(this, function (_a) {
16
+ return __generator(this, function (_a) {
34
17
  switch (_a.label) {
35
18
  case 0:
36
- sheet = new styled_components_1.ServerStyleSheet();
19
+ sheet = new ServerStyleSheet();
37
20
  originalRenderPage = ctx.renderPage;
38
21
  _a.label = 1;
39
22
  case 1:
@@ -41,27 +24,27 @@ var Document = /** @class */ (function (_super) {
41
24
  ctx.renderPage = function () {
42
25
  return originalRenderPage({
43
26
  enhanceApp: function (App) { return function (props) {
44
- return sheet.collectStyles((0, jsx_runtime_1.jsx)(App, tslib_1.__assign({}, props)));
27
+ return sheet.collectStyles(_jsx(App, __assign({}, props)));
45
28
  }; },
46
29
  });
47
30
  };
48
- return [4 /*yield*/, document_1.default.getInitialProps(ctx)];
31
+ return [4, NextDocument.getInitialProps(ctx)];
49
32
  case 2:
50
33
  initialProps = _a.sent();
51
- return [2 /*return*/, tslib_1.__assign(tslib_1.__assign({}, initialProps), { styles: ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [initialProps.styles, sheet.getStyleElement()] })) })];
34
+ return [2, __assign(__assign({}, initialProps), { styles: (_jsxs(React.Fragment, { children: [initialProps.styles, sheet.getStyleElement()] })) })];
52
35
  case 3:
53
36
  sheet.seal();
54
- return [7 /*endfinally*/];
55
- case 4: return [2 /*return*/];
37
+ return [7];
38
+ case 4: return [2];
56
39
  }
57
40
  });
58
41
  });
59
42
  };
60
43
  Document.prototype.render = function () {
61
44
  var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
62
- return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale || defaultLocale, className: "no-js", children: [(0, jsx_runtime_1.jsxs)(document_1.Head, { children: [(0, jsx_runtime_1.jsx)(Meta_1.default, {}), (0, jsx_runtime_1.jsx)(NoJs_1.default, {})] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
45
+ return (_jsxs(Html, { lang: locale || defaultLocale, className: "no-js", children: [_jsxs(Head, { children: [_jsx(Meta, {}), _jsx(NoJs, {})] }), _jsxs("body", { children: [_jsx(Main, {}), _jsx(NextScript, {})] })] }));
63
46
  };
64
47
  return Document;
65
- }(document_1.default));
66
- exports.Document = Document;
67
- exports.default = Document;
48
+ }(NextDocument));
49
+ export { Document };
50
+ export default Document;
package/12/getT.d.ts CHANGED
@@ -1,9 +1,4 @@
1
- import type { Translate, TranslateNamespace } from "./types-i18n";
1
+ import type { Translate, TranslateNamespace } from "./types-i18n.js";
2
2
  export type GetT = <TNamespace extends TranslateNamespace | undefined = undefined>(locale?: string, namespace?: TNamespace) => Promise<Translate<TNamespace>>;
3
- /**
4
- * **NOTE**: To make typescript work nicely here make sure to enable
5
- * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
6
- * in your `tsconfig.json` file.
7
- */
8
3
  export declare const getT: GetT;
9
4
  export default getT;
package/12/getT.js CHANGED
@@ -1,14 +1,4 @@
1
- "use strict";
2
1
  "use client";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getT = void 0;
5
- var tslib_1 = require("tslib");
6
- /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
7
- var getT_1 = tslib_1.__importDefault(require("next-translate/getT"));
8
- /**
9
- * **NOTE**: To make typescript work nicely here make sure to enable
10
- * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
11
- * in your `tsconfig.json` file.
12
- */
13
- exports.getT = getT_1.default;
14
- exports.default = exports.getT;
2
+ import getTranslation from "next-translate/getT";
3
+ export var getT = getTranslation;
4
+ export default getT;
package/12/index.d.ts CHANGED
@@ -1,24 +1,3 @@
1
- export { AnalyticsGoogle, type AnalyticsGoogleProps } from "./AnalyticsGoogle";
2
- export { DisableErrorOverlay } from "./DisableErrorOverlay";
3
- export { DynamicNamespaces, type DynamicNamespacesProps, } from "./DynamicNamespaces";
4
- export { Favicon, type FaviconProps } from "./Favicon";
5
- export { getT, type GetT } from "./getT";
6
- export { Link, type LinkProps } from "./Link";
7
- export { NextProgress, type NextProgressProps } from "./NextProgress";
8
- export { Seo, type SeoProps } from "./Seo";
9
- export { SeoDefaults, type SeoDefaultsProps } from "./SeoDefaults";
10
- export { T, type TProps } from "./T";
11
- export { ThemeContext, type ThemeContextProps } from "./ThemeContext";
12
- export { ThemeProvider, type ThemeProviderProps } from "./ThemeProvider";
13
- export { to, type ToArgs, type ToTranslate, type ToDynamicRoute, type ToStaticRoute, } from "./to";
14
- export { translationAsOptions } from "./translationAsOptions";
15
- export { TransText } from "./TransText";
16
- export type { Translate, TranslateDefault, TranslateLoose, TranslateNamespace, TranslateNamespaced, TranslatedRoute, TranslatedRoutesChildrenOf, TranslationOptions, TranslationQuery, TranslationShortcut, TranslationsAllPaths, TranslationsDictionary, TranslationsDictionaryDefault, TranslationsPaths, } from "./types-i18n";
17
- export type { SeoData } from "./types-seo";
18
- export { useBackUrl } from "./useBackUrl";
19
- export { useDateFormat } from "./useDateFormat";
20
- export { useForm } from "./useForm";
21
- export { useLocale } from "./useLocale";
22
- export { useT } from "./useT";
23
- export { useTheme, type UseThemeProps } from "./useTheme";
24
- export { useTo } from "./useTo";
1
+ export { AnalyticsGoogle, type AnalyticsGoogleProps } from "./AnalyticsGoogle.js";
2
+ export { DisableErrorOverlay } from "./DisableErrorOverlay.js";
3
+ export * from "./types.js";
package/12/index.js CHANGED
@@ -1,52 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTo = exports.useTheme = exports.useT = exports.useLocale = exports.useForm = exports.useDateFormat = exports.useBackUrl = exports.TransText = exports.translationAsOptions = exports.to = exports.ThemeProvider = exports.ThemeContext = exports.T = exports.SeoDefaults = exports.Seo = exports.NextProgress = exports.Link = exports.getT = exports.Favicon = exports.DynamicNamespaces = exports.DisableErrorOverlay = exports.AnalyticsGoogle = void 0;
4
- var AnalyticsGoogle_1 = require("./AnalyticsGoogle");
5
- Object.defineProperty(exports, "AnalyticsGoogle", { enumerable: true, get: function () { return AnalyticsGoogle_1.AnalyticsGoogle; } });
6
- var DisableErrorOverlay_1 = require("./DisableErrorOverlay");
7
- Object.defineProperty(exports, "DisableErrorOverlay", { enumerable: true, get: function () { return DisableErrorOverlay_1.DisableErrorOverlay; } });
8
- var DynamicNamespaces_1 = require("./DynamicNamespaces");
9
- Object.defineProperty(exports, "DynamicNamespaces", { enumerable: true, get: function () { return DynamicNamespaces_1.DynamicNamespaces; } });
10
- var Favicon_1 = require("./Favicon");
11
- Object.defineProperty(exports, "Favicon", { enumerable: true, get: function () { return Favicon_1.Favicon; } });
12
- var getT_1 = require("./getT");
13
- Object.defineProperty(exports, "getT", { enumerable: true, get: function () { return getT_1.getT; } });
14
- var Link_1 = require("./Link");
15
- Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
16
- var NextProgress_1 = require("./NextProgress");
17
- Object.defineProperty(exports, "NextProgress", { enumerable: true, get: function () { return NextProgress_1.NextProgress; } });
18
- var Seo_1 = require("./Seo");
19
- Object.defineProperty(exports, "Seo", { enumerable: true, get: function () { return Seo_1.Seo; } });
20
- // export {
21
- // seoBuildTags,
22
- // type LinkTag,
23
- // type MetaTag
24
- // } from "./seoBuildTags";
25
- var SeoDefaults_1 = require("./SeoDefaults");
26
- Object.defineProperty(exports, "SeoDefaults", { enumerable: true, get: function () { return SeoDefaults_1.SeoDefaults; } });
27
- var T_1 = require("./T");
28
- Object.defineProperty(exports, "T", { enumerable: true, get: function () { return T_1.T; } });
29
- var ThemeContext_1 = require("./ThemeContext");
30
- Object.defineProperty(exports, "ThemeContext", { enumerable: true, get: function () { return ThemeContext_1.ThemeContext; } });
31
- var ThemeProvider_1 = require("./ThemeProvider");
32
- Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return ThemeProvider_1.ThemeProvider; } });
33
- var to_1 = require("./to");
34
- Object.defineProperty(exports, "to", { enumerable: true, get: function () { return to_1.to; } });
35
- var translationAsOptions_1 = require("./translationAsOptions");
36
- Object.defineProperty(exports, "translationAsOptions", { enumerable: true, get: function () { return translationAsOptions_1.translationAsOptions; } });
37
- var TransText_1 = require("./TransText");
38
- Object.defineProperty(exports, "TransText", { enumerable: true, get: function () { return TransText_1.TransText; } });
39
- var useBackUrl_1 = require("./useBackUrl");
40
- Object.defineProperty(exports, "useBackUrl", { enumerable: true, get: function () { return useBackUrl_1.useBackUrl; } });
41
- var useDateFormat_1 = require("./useDateFormat");
42
- Object.defineProperty(exports, "useDateFormat", { enumerable: true, get: function () { return useDateFormat_1.useDateFormat; } });
43
- var useForm_1 = require("./useForm");
44
- Object.defineProperty(exports, "useForm", { enumerable: true, get: function () { return useForm_1.useForm; } });
45
- var useLocale_1 = require("./useLocale");
46
- Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return useLocale_1.useLocale; } });
47
- var useT_1 = require("./useT");
48
- Object.defineProperty(exports, "useT", { enumerable: true, get: function () { return useT_1.useT; } });
49
- var useTheme_1 = require("./useTheme");
50
- Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return useTheme_1.useTheme; } });
51
- var useTo_1 = require("./useTo");
52
- Object.defineProperty(exports, "useTo", { enumerable: true, get: function () { return useTo_1.useTo; } });
1
+ export { AnalyticsGoogle } from "./AnalyticsGoogle.js";
2
+ export { DisableErrorOverlay } from "./DisableErrorOverlay.js";
3
+ export * from "./types.js";
@@ -1,23 +1,8 @@
1
1
  import React from "react";
2
- import type { SeoProps } from "./Seo";
3
- import type { SeoDefaultsProps } from "./SeoDefaults";
2
+ import type { SeoProps } from "./Seo.js";
3
+ import type { SeoDefaultsProps } from "./SeoDefaults.js";
4
4
  export type MetaTag = React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
5
5
  export type LinkTag = React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
6
6
  type BuildTagsParams = SeoProps & SeoDefaultsProps;
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
7
  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[];
23
8
  export default seoBuildTags;
@@ -1,28 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.seoBuildTags = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var isArray_1 = tslib_1.__importDefault(require("@koine/utils/isArray"));
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { isArray } from "@koine/utils";
7
4
  var defaults = {
8
5
  tplTitle: "",
9
6
  };
10
- /**
11
- * Comparing to `next-seo` we do a couple of things in addition while many
12
- * others are removed.
13
- *
14
- * - Add `seo` meta object coming from a CMS probably
15
- * - Add `ogimage` and `openGraph.image` as single image source
16
- * - Add `og` alias to define `openGraph`
17
- * - Add check for `title` equal to `templateTitle` to avoid meta titles like
18
- * "My site | My site" often happening in homepages
19
- * - Remove the open graph videos and images
20
- *
21
- * - Shorter code
22
- *
23
- * @returns
24
- */
25
- var seoBuildTags = function (_a) {
7
+ export var seoBuildTags = function (_a) {
26
8
  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;
27
9
  var id = "seo-";
28
10
  var render = [];
@@ -41,27 +23,27 @@ var seoBuildTags = function (_a) {
41
23
  title = defaultTitle;
42
24
  }
43
25
  if (title) {
44
- render.push((0, jsx_runtime_1.jsx)("title", { children: title }, id + "title"));
45
- $properties["og:title"] = title; // overridden later...
26
+ render.push(_jsx("title", { children: title }, id + "title"));
27
+ $properties["og:title"] = title;
46
28
  }
47
29
  $names["robots"] = "".concat(noindex || hidden ? "noindex" : "index", ",").concat(nofollow || hidden ? "nofollow" : "follow");
48
30
  description = description || (seo === null || seo === void 0 ? void 0 : seo.description);
49
31
  if (description) {
50
32
  $names["description"] = description;
51
- $properties["og:description"] = description; // overridden later...
33
+ $properties["og:description"] = description;
52
34
  }
53
35
  keywords = keywords || (seo === null || seo === void 0 ? void 0 : seo.keywords);
54
36
  if (keywords) {
55
- $names["keywords"] = (0, isArray_1.default)(keywords) ? keywords.join(", ") : keywords;
37
+ $names["keywords"] = isArray(keywords) ? keywords.join(", ") : keywords;
56
38
  }
57
39
  if ((languageAlternates === null || languageAlternates === void 0 ? void 0 : languageAlternates.length) > 0) {
58
40
  languageAlternates.forEach(function (_a) {
59
41
  var href = _a.href, hrefLang = _a.hrefLang;
60
- render.push((0, jsx_runtime_1.jsx)("link", { rel: "alternate", hrefLang: hrefLang, href: href }, id + "languageAlternate-" + hrefLang));
42
+ render.push(_jsx("link", { rel: "alternate", hrefLang: hrefLang, href: href }, id + "languageAlternate-" + hrefLang));
61
43
  });
62
44
  }
63
45
  if (canonical) {
64
- render.push((0, jsx_runtime_1.jsx)("link", { rel: "canonical", href: canonical }, id + "canonical"));
46
+ render.push(_jsx("link", { rel: "canonical", href: canonical }, id + "canonical"));
65
47
  $properties["og:url"] = canonical;
66
48
  }
67
49
  if (facebook === null || facebook === void 0 ? void 0 : facebook.appId)
@@ -91,31 +73,21 @@ var seoBuildTags = function (_a) {
91
73
  if (ogimage)
92
74
  $properties["og:image"] = ogimage;
93
75
  Object.keys($names).forEach(function (key) {
94
- render.push((0, jsx_runtime_1.jsx)("meta", { name: key, content: $names[key] }, id + "name-" + key));
76
+ render.push(_jsx("meta", { name: key, content: $names[key] }, id + "name-" + key));
95
77
  });
96
78
  Object.keys($properties).forEach(function (key) {
97
- render.push((0, jsx_runtime_1.jsx)("meta", { property: key, content: $properties[key] }, id + "prop-" + +key));
79
+ render.push(_jsx("meta", { property: key, content: $properties[key] }, id + "prop-" + +key));
98
80
  });
99
81
  if (metaTags && metaTags.length > 0) {
100
82
  metaTags.forEach(function (tag) {
101
- render.push((0, jsx_runtime_1.jsx)("meta", tslib_1.__assign({}, tag), id + "meta-" + (tag.name || tag.property || tag.httpEquiv)));
83
+ render.push(_jsx("meta", __assign({}, tag), id + "meta-" + (tag.name || tag.property || tag.httpEquiv)));
102
84
  });
103
85
  }
104
86
  if (linkTags === null || linkTags === void 0 ? void 0 : linkTags.length) {
105
87
  linkTags.forEach(function (tag) {
106
- render.push((0, jsx_runtime_1.jsx)("link", tslib_1.__assign({}, tag), id + "link-" + (tag.href || tag.rel)));
88
+ render.push(_jsx("link", __assign({}, tag), id + "link-" + (tag.href || tag.rel)));
107
89
  });
108
90
  }
109
- // TODO: alternates and canonical
110
- // canonical = 'https://www.domain.com/';
111
- // languageAlternates={[{
112
- // hrefLang: 'en',
113
- // href: 'https://www.domain.com/en',
114
- // }]}
115
- // <link rel="alternate" hreflang="x-default" href="https://www.domain.com/nl/">
116
- // <link rel="alternate" hreflang="nl" href="https://www.domain.com/nl/">
117
- // <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
118
91
  return render;
119
92
  };
120
- exports.seoBuildTags = seoBuildTags;
121
- exports.default = exports.seoBuildTags;
93
+ export default seoBuildTags;
package/12/to.d.ts CHANGED
@@ -1,9 +1,6 @@
1
- import type { TranslateNamespaced, TranslatedRoute } from "./types-i18n";
1
+ import type { TranslateNamespaced, TranslatedRoute } from "./types-i18n.js";
2
2
  type OnlyStatic<T extends string> = T extends `${string}.[${string}].${string}` | `${string}.[${string}]` | `[${string}].${string}` | `[${string}]` ? never : T;
3
3
  type OnlyDynamic<T extends string> = T extends `${string}.[${string}].${string}` | `${string}.[${string}]` | `[${string}].${string}` | `[${string}]` ? T : never;
4
- /**
5
- * @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types#router-params-parsing)
6
- */
7
4
  type ExtractRouteParams<T extends string> = string extends T ? Record<string, string> : T extends `${infer _Start}[${infer Param}].${infer Rest}` ? {
8
5
  [k in Param | keyof ExtractRouteParams<Rest>]: string | number;
9
6
  } : T extends `${infer _Start}[${infer Param}]` ? {
@@ -13,12 +10,5 @@ export type ToTranslate = TranslateNamespaced<"~">;
13
10
  export type ToStaticRoute = OnlyStatic<TranslatedRoute>;
14
11
  export type ToDynamicRoute = OnlyDynamic<TranslatedRoute>;
15
12
  export type ToArgs = [ToStaticRoute] | [ToDynamicRoute, ExtractRouteParams<ToDynamicRoute>];
16
- /**
17
- * `To` named route utility. It accept either a single argument if that is a static
18
- * route name or a second argument that interpolates the dynamic portions of
19
- * the route name. The types of these portions are automatically inferred.
20
- *
21
- * @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types)
22
- */
23
13
  export declare function to(...args: [ToTranslate, ...ToArgs]): string;
24
14
  export default to;
package/12/to.js CHANGED
@@ -1,20 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.to = void 0;
4
- /**
5
- * `To` named route utility. It accept either a single argument if that is a static
6
- * route name or a second argument that interpolates the dynamic portions of
7
- * the route name. The types of these portions are automatically inferred.
8
- *
9
- * @borrows [awesome-template-literal-types](https://github.com/ghoullier/awesome-template-literal-types)
10
- */
11
- function to() {
1
+ import { __read } from "tslib";
2
+ export function to() {
12
3
  var args = [];
13
4
  for (var _i = 0; _i < arguments.length; _i++) {
14
5
  args[_i] = arguments[_i];
15
6
  }
16
7
  var relative = "";
17
- var t = args[0];
8
+ var _a = __read(args, 1), t = _a[0];
18
9
  if (args.length === 3) {
19
10
  if (args[2]) {
20
11
  relative = t(args[1], args[2]).replace("*", "");
@@ -25,5 +16,4 @@ function to() {
25
16
  }
26
17
  return relative;
27
18
  }
28
- exports.to = to;
29
- exports.default = to;
19
+ export default to;
@@ -1,3 +1,4 @@
1
1
  import type { Option } from "@koine/react/types";
2
- import type { TranslateLoose } from "./types-i18n";
2
+ import type { TranslateLoose } from "./types-i18n.js";
3
3
  export declare function translationAsOptions(t: TranslateLoose, i18nKey: string): Option[];
4
+ export default translationAsOptions;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.translationAsOptions = void 0;
4
- function translationAsOptions(t, i18nKey) {
1
+ export function translationAsOptions(t, i18nKey) {
5
2
  var dictionary = t(i18nKey, undefined, {
6
3
  returnObjects: true,
7
4
  });
@@ -10,4 +7,4 @@ function translationAsOptions(t, i18nKey) {
10
7
  label: dictionary[key],
11
8
  }); });
12
9
  }
13
- exports.translationAsOptions = translationAsOptions;
10
+ export default translationAsOptions;
@@ -1,118 +1,31 @@
1
- /**
2
- * @file
3
- *
4
- * Test this on TSplayground:
5
- * https://www.typescriptlang.org/play?#code/PTAEFpK6dv4YpSBQJSgJYEYAcA7YAFwE8AHTfAcwGcA6AEzqJrTGQ86+7hRQYCmAYwA2AQwBOA0PjEBbATTJih0gJJ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Qb9ijxDjATEYDqFGd0D4cLUSjtwTAaj8d4YLhmD9DsULj-QYYFDvDmd-jjwK5kTz3ajwoyTgTvD2T9AP47C0kScEE3ygmT5yGQKKUA+hUQjbRY8Q7d4OQcTuvItv5gFlTsANTkEu0TTowVCEKdyfOLyKVOUIzt-HaaQUzn0twCzqdvD6z0KWThwFjhQRT28Dj-9sINFL1sNp9ztvgUIIAA
6
- *
7
- * @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
1
  type Merge<T, K> = Omit<T, keyof K> & K;
14
2
  type Join<S1, S2> = S1 extends string ? S2 extends string ? `${S1}.${S2}` : S1 : never;
15
- /**
16
- *
17
- */
18
3
  export type TranslationsDictionaryDefault = {
19
4
  "~": any;
20
5
  };
21
- /**
22
- * Dictionary of all the translations
23
- *
24
- * It must uses `~` as namespace for routes defintions to make the `to` and `useTo`
25
- * working
26
- */
27
6
  export type TranslationsDictionary = Merge<TranslationsDictionaryDefault, Koine.Translations>;
28
- /**
29
- * Namespaces should match the filenames were translations are defined
30
- */
31
7
  export type TranslateNamespace = Extract<keyof TranslationsDictionary, string>;
32
- /**
33
- * Recursive mapped type to extract all usable string paths from a translation
34
- * definition object (usually from a JSON file).
35
- * It uses the `infer` "trick" to store the object in memory and prevent
36
- * [infinite instantiation errors](https://stackoverflow.com/q/75531366/1938970)
37
- */
38
8
  export type TranslationsPaths<T> = {
39
9
  [K in Extract<keyof T, string>]: T[K] extends Record<string, never> | never[] | "" ? never : T[K] extends Record<string, unknown> ? `${K}` | Join<K, TranslationsPaths<T[K]>> : T[K] extends string | number | boolean | Array<string | number | boolean | object> ? `${K}` : never;
40
10
  }[Extract<keyof T, string>] extends infer O ? O : never;
41
- /**
42
- * Recursive mapped type of all usable string paths from the whole translations
43
- * dictionary. It uses the `infer` "trick" to store the object in memory and prevent
44
- * [infinite instantiation errors](https://stackoverflow.com/q/75531366/1938970)
45
- */
46
11
  export type TranslationsAllPaths = {
47
12
  [N in Extract<keyof TranslationsDictionary, string>]: {
48
13
  [K in Extract<keyof TranslationsDictionary[N], string>]: TranslationsDictionary[N][K] extends Record<string, never> | never[] | "" ? never : TranslationsDictionary[N][K] extends Record<string, unknown> ? `${N}:${K}` | Join<K extends string ? `${N}:${K}` : `${N}:`, TranslationsPaths<TranslationsDictionary[N][K]>> : TranslationsDictionary[N][K] extends string | number | boolean | Array<string | number | boolean | object> ? `${N}:${K}` : never;
49
14
  }[Extract<keyof TranslationsDictionary[N], string>];
50
15
  }[Extract<keyof TranslationsDictionary, string>] extends infer O ? O : never;
51
- /**
52
- * Unlike in `next-translate` we add passing some predefined arguments as
53
- * shortcuts for common use cases:
54
- * - `"obj"` as a shortcut for `{ returnObjects: true }`
55
- * - `""` as a shortcut for `{ fallback: "" }`
56
- *
57
- */
58
16
  export type TranslationShortcut = "obj" | "";
59
- /**
60
- * Query object to populate the returned translated string interpolating data
61
- * or a TranslationShortcut.
62
- *
63
- * NOTE: when using a shortcut passing TranslationOptions to `t()` is not supported
64
- * TODO: type safe this behaviour of the third argument (options).
65
- */
66
17
  export type TranslationQuery = undefined | null | TranslationShortcut | {
67
18
  [key: string]: string | number | boolean;
68
19
  };
69
- /**
70
- * Opions of the translate function or a TranslationShortcut.
71
- *
72
- * NOTE: when using a shortcut passing TranslationOptions to `t()` is not supported
73
- * TODO: type safe this behaviour of the third argument (options).
74
- */
75
20
  export type TranslationOptions = undefined | TranslationShortcut | {
76
21
  returnObjects?: boolean;
77
22
  fallback?: string | string[];
78
23
  default?: string;
79
24
  };
80
- /**
81
- * Translate function which optionally accept a namespace as first argument
82
- */
83
25
  export type Translate<TNamespace extends TranslateNamespace | undefined = TranslateNamespace> = TNamespace extends TranslateNamespace ? TranslateNamespaced<TNamespace> : TranslateDefault;
84
- /**
85
- * Translate function **without** namespace, it allows to select any of the all
86
- * available strings in all namespaces.
87
- */
88
26
  export type TranslateDefault = <TReturn = string>(s: TranslationsAllPaths, q?: TranslationQuery, o?: TranslationOptions) => TReturn;
89
- /**
90
- * Translate function **with** namespace, it allows to select only the all available
91
- * strings in the given namespace.
92
- */
93
27
  export type TranslateNamespaced<TNamespace extends TranslateNamespace> = <TReturn = string>(s: TranslationsPaths<TranslationsDictionary[TNamespace]>, q?: TranslationQuery, o?: TranslationOptions) => TReturn;
94
- /**
95
- * Translate function loose type, to use only in implementations that uses
96
- * the `t` function indirectly without needng knowledge of the string it needs
97
- * to output.
98
- */
99
28
  export type TranslateLoose = (s?: any, q?: TranslationQuery, o?: TranslationOptions) => string;
100
- /**
101
- * By convention routes definitions are in the `~.json` file in the locales/{locale}/
102
- * root folder. This type represent every possibly name of the defined route's
103
- * localised pathname (even with dynamic portions).
104
- */
105
29
  export type TranslatedRoute = TranslationsPaths<TranslationsDictionary["~"]>;
106
- /**
107
- * Utility standalone type to extract all (max two level depth) children routes
108
- * that starts with the given string.
109
- *
110
- * This is useful to get the subroutes of an application area, e.g. all subroutes
111
- * of a dashboard, using it with:
112
- *
113
- * ```
114
- * type DashboardRoutes = TranslatedRoutesChildrenOf<"dashboard">;
115
- * ```
116
- */
117
30
  export type TranslatedRoutesChildrenOf<TStarts extends string, T extends string = TranslatedRoute> = T extends `${TStarts}.${infer First}.${infer Second}` ? First | `${First}.${Second}` : T extends `${TStarts}.${infer First}` ? First : never;
118
31
  export {};
package/12/types-i18n.js CHANGED
@@ -1,14 +1 @@
1
- "use strict";
2
- /**
3
- * @file
4
- *
5
- * Test this on TSplayground:
6
- * https://www.typescriptlang.org/play?#code/PTAEFpK6dv4YpSBQJSgJYEYAcA7YAFwE8AHTfAcwGcA6AEzqJrTGQ86+7hRQYCmAYwA2AQwBOA0PjEBbATTJih0gJJ58oAN4oMlIgIkAzFdIAqEsfhriimAPY2dejKHQAiAH4eAXKGsSAG5XAF8+fXxDEzNQS2tbMXsnGgBhJ2NMKh1w8LYIHk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5yGQKKUA+hUQjbRY8Q7d4OQcTuvItv5gFlTsANTkEu0TTowVCEKdyfOLyKVOUIzt-HaaQUzn0twCzqdvD6z0KWThwFjhQRT28Dj-9sINFL1sNp9ztvgUIIAA
7
- *
8
- * @see
9
- * - https://stackoverflow.com/q/75531366/1938970: fix for `Type instantiation is excessively deep and possibly infinite in Promise.all`
10
- *
11
- * @notes
12
- * I might take a better look at how things were done in [i18next](https://github.com/i18next/i18next/blob/master/index.d.ts)
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/12/types-seo.d.ts CHANGED
File without changes
package/12/types-seo.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/12/types.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./types-i18n.js";
2
+ export * from "./types-seo.js";
3
+ export type { TProps } from "./T.js";
4
+ export type { GetT } from "./getT.js";
5
+ export type { DynamicNamespacesProps } from "./DynamicNamespaces.js";
6
+ export type { SeoDefaultsProps } from "./SeoDefaults.js";
7
+ export type { ToTranslate, ToStaticRoute, ToDynamicRoute, ToArgs } from "./to.js";
package/12/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./types-i18n.js";
2
+ export * from "./types-seo.js";
File without changes