@koine/next 2.0.0-beta.2 → 2.0.0-beta.5

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 (112) hide show
  1. package/12/AnalyticsGoogle.js +65 -25
  2. package/12/AnalyticsGoogle.mjs +41 -15
  3. package/12/DisableErrorOverlay.js +29 -16
  4. package/12/DisableErrorOverlay.mjs +8 -5
  5. package/12/DynamicNamespaces.d.ts +1 -1
  6. package/12/DynamicNamespaces.js +22 -12
  7. package/12/DynamicNamespaces.mjs +1 -2
  8. package/12/Favicon.js +28 -9
  9. package/12/Favicon.mjs +6 -2
  10. package/12/Link.d.ts +1 -1
  11. package/12/Link.js +36 -13
  12. package/12/Link.mjs +14 -6
  13. package/12/NextProgress.js +47 -24
  14. package/12/NextProgress.mjs +26 -17
  15. package/12/Seo.d.ts +1 -1
  16. package/12/Seo.js +27 -32
  17. package/12/Seo.mjs +5 -4
  18. package/12/SeoDefaults.d.ts +1 -1
  19. package/12/SeoDefaults.js +27 -13
  20. package/12/SeoDefaults.mjs +5 -3
  21. package/12/T.d.ts +1 -1
  22. package/12/T.js +42 -16
  23. package/12/T.mjs +20 -6
  24. package/12/ThemeContext.js +22 -7
  25. package/12/ThemeContext.mjs +3 -3
  26. package/12/ThemeProvider.js +164 -147
  27. package/12/ThemeProvider.mjs +139 -129
  28. package/12/TransText.js +22 -7
  29. package/12/TransText.mjs +1 -1
  30. package/12/app/AppHead.js +29 -9
  31. package/12/app/AppHead.mjs +8 -2
  32. package/12/app/AppMain.d.ts +4 -4
  33. package/12/app/AppMain.js +5 -1
  34. package/12/app/AppMain.mjs +1 -1
  35. package/12/app/css/AppMain.js +37 -16
  36. package/12/app/css/AppMain.mjs +15 -5
  37. package/12/app/css/AppTheme.d.ts +1 -1
  38. package/12/app/css/AppTheme.js +28 -13
  39. package/12/app/css/AppTheme.mjs +7 -4
  40. package/12/app/css/auth/index.d.ts +1 -1
  41. package/12/app/css/auth/index.js +38 -15
  42. package/12/app/css/auth/index.mjs +17 -6
  43. package/12/app/css/index.d.ts +1 -1
  44. package/12/app/css/index.js +34 -59
  45. package/12/app/css/index.mjs +14 -6
  46. package/12/app/index.js +6 -4
  47. package/12/app/sc/AppMain.js +68 -27
  48. package/12/app/sc/AppMain.mjs +46 -13
  49. package/12/app/sc/AppTheme.d.ts +1 -1
  50. package/12/app/sc/AppTheme.js +31 -13
  51. package/12/app/sc/AppTheme.mjs +9 -4
  52. package/12/app/sc/auth/index.d.ts +1 -1
  53. package/12/app/sc/auth/index.js +38 -15
  54. package/12/app/sc/auth/index.mjs +17 -6
  55. package/12/app/sc/index.d.ts +1 -1
  56. package/12/app/sc/index.js +34 -61
  57. package/12/app/sc/index.mjs +14 -6
  58. package/12/document/Document.js +47 -29
  59. package/12/document/Document.mjs +24 -14
  60. package/12/document/css/index.js +47 -32
  61. package/12/document/css/index.mjs +26 -18
  62. package/12/document/index.js +18 -6
  63. package/12/document/sc/index.js +71 -65
  64. package/12/document/sc/index.mjs +46 -45
  65. package/12/getT.js +22 -13
  66. package/12/getT.mjs +2 -4
  67. package/12/index.js +99 -51
  68. package/12/index.mjs +2 -2
  69. package/12/seoBuildTags.js +81 -76
  70. package/12/seoBuildTags.mjs +59 -55
  71. package/12/to.js +21 -19
  72. package/12/to.mjs +4 -10
  73. package/12/translationAsOptions.js +15 -9
  74. package/12/translationAsOptions.mjs +6 -6
  75. package/12/types-i18n.js +4 -3
  76. package/12/types-i18n.mjs +1 -2
  77. package/12/types-seo.js +3 -1
  78. package/12/types-seo.mjs +1 -1
  79. package/12/useBackUrl.js +30 -16
  80. package/12/useBackUrl.mjs +8 -8
  81. package/12/useDateFormat.js +37 -38
  82. package/12/useDateFormat.mjs +15 -28
  83. package/12/useForm.d.ts +1 -1
  84. package/12/useForm.js +46 -20
  85. package/12/useForm.mjs +25 -13
  86. package/12/useLocale.js +22 -8
  87. package/12/useT.d.ts +1 -1
  88. package/12/useT.js +53 -39
  89. package/12/useT.mjs +32 -14
  90. package/12/useTheme.js +22 -11
  91. package/12/useTheme.mjs +1 -2
  92. package/12/useTo.js +23 -16
  93. package/12/useTo.mjs +3 -10
  94. package/README.md +1 -1
  95. package/config/index.js +225 -251
  96. package/config/index.mjs +187 -204
  97. package/getSiteUrl.js +22 -15
  98. package/getSiteUrl.mjs +2 -4
  99. package/index.js +19 -6
  100. package/load.js +21 -8
  101. package/load.mjs +3 -4
  102. package/package.json +19 -17
  103. package/12/app/css/auth/package.json +0 -6
  104. package/12/app/css/package.json +0 -6
  105. package/12/app/package.json +0 -6
  106. package/12/app/sc/auth/package.json +0 -6
  107. package/12/app/sc/package.json +0 -6
  108. package/12/document/css/package.json +0 -6
  109. package/12/document/package.json +0 -6
  110. package/12/document/sc/package.json +0 -6
  111. package/12/package.json +0 -6
  112. package/config/package.json +0 -6
@@ -1,8 +1,6 @@
1
- import { __assign, __awaiter, __extends, __generator } from "tslib";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ /* ? eslint-disable @next/next/no-document-import-in-page */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import NextDocument, { Head, Html, Main, NextScript } from "next/document";
3
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
4
  import { ServerStyleSheet } from "styled-components";
7
5
  import Meta from "@koine/react/Meta";
8
6
  import NoJs from "@koine/react/NoJs";
@@ -18,47 +16,50 @@ import NoJs from "@koine/react/NoJs";
18
16
  * ```tsx
19
17
  * export { Document as default } from "@koine/next/document/sc";
20
18
  * ```
21
- */
22
- var Document = /** @class */ (function (_super) {
23
- __extends(Document, _super);
24
- function Document() {
25
- return _super !== null && _super.apply(this, arguments) || this;
19
+ */ export class Document extends NextDocument {
20
+ static async getInitialProps(ctx) {
21
+ const sheet = new ServerStyleSheet();
22
+ const originalRenderPage = ctx.renderPage;
23
+ try {
24
+ ctx.renderPage = ()=>originalRenderPage({
25
+ enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ _jsx(App, {
26
+ ...props
27
+ }))
28
+ });
29
+ const initialProps = await NextDocument.getInitialProps(ctx);
30
+ return {
31
+ ...initialProps,
32
+ styles: /*#__PURE__*/ _jsxs(React.Fragment, {
33
+ children: [
34
+ initialProps.styles,
35
+ sheet.getStyleElement()
36
+ ]
37
+ })
38
+ };
39
+ } finally{
40
+ sheet.seal();
41
+ }
26
42
  }
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
- });
43
+ render() {
44
+ const { locale, defaultLocale } = this.props.__NEXT_DATA__;
45
+ return /*#__PURE__*/ _jsxs(Html, {
46
+ lang: locale || defaultLocale,
47
+ className: "no-js",
48
+ children: [
49
+ /*#__PURE__*/ _jsxs(Head, {
50
+ children: [
51
+ /*#__PURE__*/ _jsx(Meta, {}),
52
+ /*#__PURE__*/ _jsx(NoJs, {})
53
+ ]
54
+ }),
55
+ /*#__PURE__*/ _jsxs("body", {
56
+ children: [
57
+ /*#__PURE__*/ _jsx(Main, {}),
58
+ /*#__PURE__*/ _jsx(NextScript, {})
59
+ ]
60
+ })
61
+ ]
55
62
  });
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 };
63
+ }
64
+ }
64
65
  export default Document;
package/12/getT.js CHANGED
@@ -1,14 +1,23 @@
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
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ getT: function() {
14
+ return getT;
15
+ },
16
+ default: function() {
17
+ return _default;
18
+ }
19
+ });
20
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
+ const _getT = /*#__PURE__*/ _interop_require_default._(require("next-translate/getT"));
22
+ const getT = _getT.default;
23
+ const _default = getT;
package/12/getT.mjs CHANGED
@@ -1,10 +1,8 @@
1
1
  "use client";
2
- /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
3
- import getTranslation from "next-translate/getT";
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */ import getTranslation from "next-translate/getT";
4
3
  /**
5
4
  * **NOTE**: To make typescript work nicely here make sure to enable
6
5
  * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
7
6
  * in your `tsconfig.json` file.
8
- */
9
- export var getT = getTranslation;
7
+ */ export const getT = getTranslation;
10
8
  export default getT;
package/12/index.js CHANGED
@@ -1,52 +1,100 @@
1
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; } });
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ AnalyticsGoogle: function() {
13
+ return _AnalyticsGoogle.AnalyticsGoogle;
14
+ },
15
+ DisableErrorOverlay: function() {
16
+ return _DisableErrorOverlay.DisableErrorOverlay;
17
+ },
18
+ DynamicNamespaces: function() {
19
+ return _DynamicNamespaces.DynamicNamespaces;
20
+ },
21
+ Favicon: function() {
22
+ return _Favicon.Favicon;
23
+ },
24
+ getT: function() {
25
+ return _getT.getT;
26
+ },
27
+ Link: function() {
28
+ return _Link.Link;
29
+ },
30
+ NextProgress: function() {
31
+ return _NextProgress.NextProgress;
32
+ },
33
+ Seo: function() {
34
+ return _Seo.Seo;
35
+ },
36
+ SeoDefaults: function() {
37
+ return _SeoDefaults.SeoDefaults;
38
+ },
39
+ T: function() {
40
+ return _T.T;
41
+ },
42
+ ThemeContext: function() {
43
+ return _ThemeContext.ThemeContext;
44
+ },
45
+ ThemeProvider: function() {
46
+ return _ThemeProvider.ThemeProvider;
47
+ },
48
+ to: function() {
49
+ return _to.to;
50
+ },
51
+ translationAsOptions: function() {
52
+ return _translationAsOptions.translationAsOptions;
53
+ },
54
+ TransText: function() {
55
+ return _TransText.TransText;
56
+ },
57
+ useBackUrl: function() {
58
+ return _useBackUrl.useBackUrl;
59
+ },
60
+ useDateFormat: function() {
61
+ return _useDateFormat.useDateFormat;
62
+ },
63
+ useForm: function() {
64
+ return _useForm.useForm;
65
+ },
66
+ useLocale: function() {
67
+ return _useLocale.useLocale;
68
+ },
69
+ useT: function() {
70
+ return _useT.useT;
71
+ },
72
+ useTheme: function() {
73
+ return _useTheme.useTheme;
74
+ },
75
+ useTo: function() {
76
+ return _useTo.useTo;
77
+ }
78
+ });
79
+ const _AnalyticsGoogle = require("./AnalyticsGoogle");
80
+ const _DisableErrorOverlay = require("./DisableErrorOverlay");
81
+ const _DynamicNamespaces = require("./DynamicNamespaces");
82
+ const _Favicon = require("./Favicon");
83
+ const _getT = require("./getT");
84
+ const _Link = require("./Link");
85
+ const _NextProgress = require("./NextProgress");
86
+ const _Seo = require("./Seo");
87
+ const _SeoDefaults = require("./SeoDefaults");
88
+ const _T = require("./T");
89
+ const _ThemeContext = require("./ThemeContext");
90
+ const _ThemeProvider = require("./ThemeProvider");
91
+ const _to = require("./to");
92
+ const _translationAsOptions = require("./translationAsOptions");
93
+ const _TransText = require("./TransText");
94
+ const _useBackUrl = require("./useBackUrl");
95
+ const _useDateFormat = require("./useDateFormat");
96
+ const _useForm = require("./useForm");
97
+ const _useLocale = require("./useLocale");
98
+ const _useT = require("./useT");
99
+ const _useTheme = require("./useTheme");
100
+ const _useTo = require("./useTo");
package/12/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AnalyticsGoogle } from "./AnalyticsGoogle";
2
2
  export { DisableErrorOverlay } from "./DisableErrorOverlay";
3
- export { DynamicNamespaces, } from "./DynamicNamespaces";
3
+ export { DynamicNamespaces } from "./DynamicNamespaces";
4
4
  export { Favicon } from "./Favicon";
5
5
  export { getT } from "./getT";
6
6
  export { Link } from "./Link";
@@ -15,7 +15,7 @@ export { SeoDefaults } from "./SeoDefaults";
15
15
  export { T } from "./T";
16
16
  export { ThemeContext } from "./ThemeContext";
17
17
  export { ThemeProvider } from "./ThemeProvider";
18
- export { to, } from "./to";
18
+ export { to } from "./to";
19
19
  export { translationAsOptions } from "./translationAsOptions";
20
20
  export { TransText } from "./TransText";
21
21
  export { useBackUrl } from "./useBackUrl";
@@ -1,109 +1,115 @@
1
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"));
7
- var defaults = {
8
- tplTitle: "",
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ seoBuildTags: function() {
13
+ return seoBuildTags;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _jsxruntime = require("react/jsx-runtime");
21
+ const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
22
+ const _isArray = /*#__PURE__*/ _interop_require_default._(require("@koine/utils/isArray"));
23
+ const defaults = {
24
+ tplTitle: ""
9
25
  };
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) {
26
- 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
- var id = "seo-";
28
- var render = [];
29
- var $names = {};
30
- var $properties = {};
26
+ const seoBuildTags = ({ seo, hidden, keywords, title = "", titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates = [], twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags } = {})=>{
27
+ const id = "seo-";
28
+ const render = [];
29
+ const $names = {};
30
+ const $properties = {};
31
31
  if (titleTemplate) {
32
32
  defaults.tplTitle = titleTemplate;
33
33
  }
34
- title = title || (seo === null || seo === void 0 ? void 0 : seo.title) || "";
34
+ title = title || seo?.title || "";
35
35
  if (title) {
36
36
  if (defaults.tplTitle && defaults.tplTitle !== title) {
37
37
  title = defaults.tplTitle.replace(/%s/g, title);
38
38
  }
39
- }
40
- else if (defaultTitle) {
39
+ } else if (defaultTitle) {
41
40
  title = defaultTitle;
42
41
  }
43
42
  if (title) {
44
- render.push((0, jsx_runtime_1.jsx)("title", { children: title }, id + "title"));
43
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("title", {
44
+ children: title
45
+ }, id + "title"));
45
46
  $properties["og:title"] = title; // overridden later...
46
47
  }
47
- $names["robots"] = "".concat(noindex || hidden ? "noindex" : "index", ",").concat(nofollow || hidden ? "nofollow" : "follow");
48
- description = description || (seo === null || seo === void 0 ? void 0 : seo.description);
48
+ $names["robots"] = `${noindex || hidden ? "noindex" : "index"},${nofollow || hidden ? "nofollow" : "follow"}`;
49
+ description = description || seo?.description;
49
50
  if (description) {
50
51
  $names["description"] = description;
51
52
  $properties["og:description"] = description; // overridden later...
52
53
  }
53
- keywords = keywords || (seo === null || seo === void 0 ? void 0 : seo.keywords);
54
+ keywords = keywords || seo?.keywords;
54
55
  if (keywords) {
55
- $names["keywords"] = (0, isArray_1.default)(keywords) ? keywords.join(", ") : keywords;
56
+ $names["keywords"] = (0, _isArray.default)(keywords) ? keywords.join(", ") : keywords;
56
57
  }
57
- if ((languageAlternates === null || languageAlternates === void 0 ? void 0 : languageAlternates.length) > 0) {
58
- languageAlternates.forEach(function (_a) {
59
- 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));
58
+ if (languageAlternates?.length > 0) {
59
+ languageAlternates.forEach(({ href, hrefLang })=>{
60
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
61
+ rel: "alternate",
62
+ hrefLang: hrefLang,
63
+ href: href
64
+ }, id + "languageAlternate-" + hrefLang));
61
65
  });
62
66
  }
63
67
  if (canonical) {
64
- render.push((0, jsx_runtime_1.jsx)("link", { rel: "canonical", href: canonical }, id + "canonical"));
68
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
69
+ rel: "canonical",
70
+ href: canonical
71
+ }, id + "canonical"));
65
72
  $properties["og:url"] = canonical;
66
73
  }
67
- if (facebook === null || facebook === void 0 ? void 0 : facebook.appId)
68
- $properties["fb:app_id"] = facebook.appId;
74
+ if (facebook?.appId) $properties["fb:app_id"] = facebook.appId;
69
75
  if (twitter) {
70
- if (twitter.cardType)
71
- $names["twitter:card"] = twitter.cardType;
72
- if (twitter.site)
73
- $names["twitter:site"] = twitter.site;
74
- if (twitter.handle)
75
- $names["twitter:creator"] = twitter.handle;
76
+ if (twitter.cardType) $names["twitter:card"] = twitter.cardType;
77
+ if (twitter.site) $names["twitter:site"] = twitter.site;
78
+ if (twitter.handle) $names["twitter:creator"] = twitter.handle;
76
79
  }
77
- var og = ogAlias || openGraph;
78
- if (og === null || og === void 0 ? void 0 : og.title)
79
- $properties["og:title"] = og === null || og === void 0 ? void 0 : og.title;
80
- if (og === null || og === void 0 ? void 0 : og.description)
81
- $properties["og:description"] = og === null || og === void 0 ? void 0 : og.description;
82
- if (og === null || og === void 0 ? void 0 : og.url)
83
- $properties["og:url"] = og.url;
84
- if (og === null || og === void 0 ? void 0 : og.type)
85
- $properties["og:type"] = og.type.toLowerCase();
86
- if (og === null || og === void 0 ? void 0 : og.locale)
87
- $properties["og:locale"] = og.locale;
88
- if (og === null || og === void 0 ? void 0 : og.siteName)
89
- $properties["og:siteName"] = og.siteName;
90
- var ogimage = (og === null || og === void 0 ? void 0 : og.image) || (seo === null || seo === void 0 ? void 0 : seo.ogimage);
91
- if (ogimage)
92
- $properties["og:image"] = ogimage;
93
- Object.keys($names).forEach(function (key) {
94
- render.push((0, jsx_runtime_1.jsx)("meta", { name: key, content: $names[key] }, id + "name-" + key));
80
+ const og = ogAlias || openGraph;
81
+ if (og?.title) $properties["og:title"] = og?.title;
82
+ if (og?.description) $properties["og:description"] = og?.description;
83
+ if (og?.url) $properties["og:url"] = og.url;
84
+ if (og?.type) $properties["og:type"] = og.type.toLowerCase();
85
+ if (og?.locale) $properties["og:locale"] = og.locale;
86
+ if (og?.siteName) $properties["og:siteName"] = og.siteName;
87
+ const ogimage = og?.image || seo?.ogimage;
88
+ if (ogimage) $properties["og:image"] = ogimage;
89
+ Object.keys($names).forEach((key)=>{
90
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
91
+ name: key,
92
+ content: $names[key]
93
+ }, id + "name-" + key));
95
94
  });
96
- Object.keys($properties).forEach(function (key) {
97
- render.push((0, jsx_runtime_1.jsx)("meta", { property: key, content: $properties[key] }, id + "prop-" + +key));
95
+ Object.keys($properties).forEach((key)=>{
96
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
97
+ property: key,
98
+ content: $properties[key]
99
+ }, id + "prop-" + +key));
98
100
  });
99
101
  if (metaTags && metaTags.length > 0) {
100
- 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)));
102
+ metaTags.forEach((tag)=>{
103
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
104
+ ...tag
105
+ }, id + "meta-" + (tag.name || tag.property || tag.httpEquiv)));
102
106
  });
103
107
  }
104
- if (linkTags === null || linkTags === void 0 ? void 0 : linkTags.length) {
105
- linkTags.forEach(function (tag) {
106
- render.push((0, jsx_runtime_1.jsx)("link", tslib_1.__assign({}, tag), id + "link-" + (tag.href || tag.rel)));
108
+ if (linkTags?.length) {
109
+ linkTags.forEach((tag)=>{
110
+ render.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
111
+ ...tag
112
+ }, id + "link-" + (tag.href || tag.rel)));
107
113
  });
108
114
  }
109
115
  // TODO: alternates and canonical
@@ -117,5 +123,4 @@ var seoBuildTags = function (_a) {
117
123
  // <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
118
124
  return render;
119
125
  };
120
- exports.seoBuildTags = seoBuildTags;
121
- exports.default = exports.seoBuildTags;
126
+ const _default = seoBuildTags;