@koine/next 1.0.44 → 1.0.47

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 (176) hide show
  1. package/{Analytics/AnalyticsGoogle.d.ts → AnalyticsGoogle.d.ts} +1 -0
  2. package/{Analytics/AnalyticsGoogle.js → AnalyticsGoogle.js} +1 -0
  3. package/DynamicNamespaces.d.ts +13 -0
  4. package/DynamicNamespaces.js +8 -0
  5. package/{Favicon/Favicon.d.ts → Favicon.d.ts} +1 -0
  6. package/{Favicon/Favicon.js → Favicon.js} +1 -0
  7. package/Head.d.ts +3 -0
  8. package/Head.js +3 -0
  9. package/Link.d.ts +10 -0
  10. package/{Link/Link.js → Link.js} +1 -0
  11. package/{Img/Img.d.ts → NextImg.d.ts} +2 -6
  12. package/{Img/Img.js → NextImg.js} +2 -10
  13. package/NextImgSmart.d.ts +6 -0
  14. package/NextImgSmart.js +13 -0
  15. package/{NextProgress/NextProgress.d.ts → NextProgress.d.ts} +1 -1
  16. package/{NextProgress/NextProgress.js → NextProgress.js} +1 -0
  17. package/Seo.d.ts +27 -0
  18. package/Seo.js +16 -0
  19. package/SeoDefaults.d.ts +11 -0
  20. package/{Seo/SeoDefaults.js → SeoDefaults.js} +3 -2
  21. package/{i18n/T/index.d.ts → T.d.ts} +1 -1
  22. package/{i18n/T/index.js → T.js} +0 -0
  23. package/app/AppMain.d.ts +1 -1
  24. package/app/css/AppMain.js +1 -1
  25. package/app/css/AppTheme.d.ts +1 -1
  26. package/app/css/AppTheme.js +1 -1
  27. package/app/em/AppMain.js +1 -1
  28. package/app/em/AppTheme.js +1 -1
  29. package/app/sc/AppMain.js +1 -1
  30. package/{Auth → auth}/helpers.d.ts +1 -1
  31. package/{Auth → auth}/helpers.js +0 -0
  32. package/{Auth → auth}/index.d.ts +0 -0
  33. package/{Auth → auth}/index.js +0 -0
  34. package/{Head → auth}/package.json +1 -1
  35. package/{Auth → auth}/useLogin.d.ts +1 -0
  36. package/{Auth → auth}/useLogin.js +2 -1
  37. package/{Auth → auth}/useLoginUrl.d.ts +1 -0
  38. package/{Auth → auth}/useLoginUrl.js +2 -1
  39. package/{Auth → auth}/useLogout.d.ts +1 -0
  40. package/{Auth → auth}/useLogout.js +2 -1
  41. package/config/index.d.ts +3 -3
  42. package/config/index.js +20 -10
  43. package/{utils/emotion-cache.d.ts → createEmotionCache.d.ts} +1 -0
  44. package/{utils/emotion-cache.js → createEmotionCache.js} +1 -0
  45. package/document/em/index.js +1 -1
  46. package/getSiteUrl.d.ts +8 -0
  47. package/getSiteUrl.js +12 -0
  48. package/{i18n/getT/index.d.ts → getT.d.ts} +2 -1
  49. package/{i18n/getT/index.js → getT.js} +1 -0
  50. package/index.d.ts +21 -7
  51. package/index.js +23 -7
  52. package/{utils/index.d.ts → load.d.ts} +1 -9
  53. package/{utils/index.js → load.js} +1 -13
  54. package/node/{Analytics/AnalyticsGoogle.js → AnalyticsGoogle.js} +1 -0
  55. package/node/DynamicNamespaces.js +12 -0
  56. package/node/{Favicon/Favicon.js → Favicon.js} +1 -0
  57. package/node/Head.js +7 -0
  58. package/node/{Link/Link.js → Link.js} +1 -0
  59. package/node/{Img/Img.js → NextImg.js} +2 -11
  60. package/node/NextImgSmart.js +17 -0
  61. package/node/{NextProgress/NextProgress.js → NextProgress.js} +1 -0
  62. package/node/{Seo/Seo.js → Seo.js} +10 -2
  63. package/node/{Seo/SeoDefaults.js → SeoDefaults.js} +3 -2
  64. package/node/{i18n/T/index.js → T.js} +0 -0
  65. package/node/app/css/AppMain.js +2 -2
  66. package/node/app/css/AppTheme.js +2 -2
  67. package/node/app/em/AppMain.js +2 -2
  68. package/node/app/em/AppTheme.js +2 -2
  69. package/node/app/sc/AppMain.js +2 -2
  70. package/node/{Auth → auth}/helpers.js +0 -0
  71. package/node/{Auth → auth}/index.js +0 -0
  72. package/node/{Auth → auth}/useLogin.js +3 -2
  73. package/node/{Auth → auth}/useLoginUrl.js +3 -2
  74. package/node/{Auth → auth}/useLogout.js +3 -2
  75. package/node/config/index.js +20 -10
  76. package/node/{utils/emotion-cache.js → createEmotionCache.js} +1 -0
  77. package/node/document/em/index.js +2 -2
  78. package/node/getSiteUrl.js +16 -0
  79. package/node/{i18n/getT/index.js → getT.js} +1 -0
  80. package/node/index.js +23 -7
  81. package/node/{utils/index.js → load.js} +2 -15
  82. package/node/revalidate.js +8 -0
  83. package/node/{Seo/helpers.js → seoBuildTags.js} +7 -5
  84. package/node/to.js +29 -0
  85. package/node/{i18n/translationAsOptions/index.js → translationAsOptions.js} +0 -0
  86. package/node/{i18n/types.js → types-i18n.js} +0 -0
  87. package/node/types-seo.js +2 -0
  88. package/node/useBackUrl.js +31 -0
  89. package/node/{i18n/useDateFormat/index.js → useDateFormat.js} +0 -0
  90. package/node/{Forms/useForm.js → useForm.js} +0 -0
  91. package/node/{i18n/useLocale/index.js → useLocale.js} +0 -0
  92. package/node/{i18n/useT/index.js → useT.js} +0 -0
  93. package/node/{Theme/Theme.js → useTheme.js} +7 -0
  94. package/node/useTo.js +18 -0
  95. package/package.json +5 -5
  96. package/revalidate.d.ts +5 -0
  97. package/revalidate.js +5 -0
  98. package/seoBuildTags.d.ts +21 -0
  99. package/{Seo/helpers.js → seoBuildTags.js} +5 -3
  100. package/to.d.ts +24 -0
  101. package/to.js +25 -0
  102. package/{i18n/translationAsOptions/index.d.ts → translationAsOptions.d.ts} +1 -1
  103. package/{i18n/translationAsOptions/index.js → translationAsOptions.js} +0 -0
  104. package/{i18n/types.d.ts → types-i18n.d.ts} +6 -0
  105. package/{i18n/types.js → types-i18n.js} +0 -0
  106. package/types-seo.d.ts +7 -0
  107. package/types-seo.js +1 -0
  108. package/useBackUrl.d.ts +2 -0
  109. package/useBackUrl.js +27 -0
  110. package/{i18n/useDateFormat/index.d.ts → useDateFormat.d.ts} +0 -0
  111. package/{i18n/useDateFormat/index.js → useDateFormat.js} +0 -0
  112. package/{Forms/useForm.d.ts → useForm.d.ts} +1 -1
  113. package/{Forms/useForm.js → useForm.js} +0 -0
  114. package/{i18n/useLocale/index.d.ts → useLocale.d.ts} +0 -0
  115. package/{i18n/useLocale/index.js → useLocale.js} +0 -0
  116. package/{i18n/useT/index.d.ts → useT.d.ts} +1 -1
  117. package/{i18n/useT/index.js → useT.js} +0 -0
  118. package/{Theme/Theme.d.ts → useTheme.d.ts} +8 -13
  119. package/{Theme/Theme.js → useTheme.js} +7 -0
  120. package/useTo.d.ts +3 -0
  121. package/useTo.js +14 -0
  122. package/Analytics/index.d.ts +0 -1
  123. package/Analytics/index.js +0 -1
  124. package/Analytics/package.json +0 -6
  125. package/Auth/package.json +0 -6
  126. package/Favicon/index.d.ts +0 -1
  127. package/Favicon/index.js +0 -1
  128. package/Favicon/package.json +0 -6
  129. package/Forms/index.d.ts +0 -1
  130. package/Forms/index.js +0 -1
  131. package/Forms/package.json +0 -6
  132. package/Head/Head.d.ts +0 -1
  133. package/Head/Head.js +0 -1
  134. package/Head/index.d.ts +0 -1
  135. package/Head/index.js +0 -1
  136. package/Img/index.d.ts +0 -1
  137. package/Img/index.js +0 -1
  138. package/Img/package.json +0 -6
  139. package/Link/Link.d.ts +0 -9
  140. package/Link/index.d.ts +0 -1
  141. package/Link/index.js +0 -1
  142. package/Link/package.json +0 -6
  143. package/NextProgress/index.d.ts +0 -2
  144. package/NextProgress/index.js +0 -1
  145. package/NextProgress/package.json +0 -6
  146. package/Seo/Seo.d.ts +0 -3
  147. package/Seo/Seo.js +0 -8
  148. package/Seo/SeoDefaults.d.ts +0 -3
  149. package/Seo/helpers.d.ts +0 -48
  150. package/Seo/index.d.ts +0 -12
  151. package/Seo/index.js +0 -12
  152. package/Seo/package.json +0 -6
  153. package/Theme/index.d.ts +0 -1
  154. package/Theme/index.js +0 -1
  155. package/Theme/package.json +0 -6
  156. package/i18n/T/package.json +0 -6
  157. package/i18n/getT/package.json +0 -6
  158. package/i18n/index.d.ts +0 -7
  159. package/i18n/index.js +0 -7
  160. package/i18n/package.json +0 -6
  161. package/i18n/translationAsOptions/package.json +0 -6
  162. package/i18n/useDateFormat/package.json +0 -6
  163. package/i18n/useLocale/package.json +0 -6
  164. package/i18n/useT/package.json +0 -6
  165. package/node/Analytics/index.js +0 -4
  166. package/node/Favicon/index.js +0 -4
  167. package/node/Forms/index.js +0 -4
  168. package/node/Head/Head.js +0 -5
  169. package/node/Head/index.js +0 -4
  170. package/node/Img/index.js +0 -4
  171. package/node/Link/index.js +0 -4
  172. package/node/NextProgress/index.js +0 -5
  173. package/node/Seo/index.js +0 -15
  174. package/node/Theme/index.js +0 -4
  175. package/node/i18n/index.js +0 -10
  176. package/utils/package.json +0 -6
package/index.js CHANGED
@@ -1,12 +1,28 @@
1
- export * from "./Analytics";
2
- export * from "./Auth";
1
+ export * from "./AnalyticsGoogle";
2
+ // export * from "./createEmotionCache";
3
+ export * from "./DynamicNamespaces";
3
4
  export * from "./Favicon";
4
- export * from "./Forms";
5
+ export * from "./getSiteUrl";
6
+ export * from "./getT";
5
7
  export * from "./Head";
6
- export * from "./i18n";
7
- export * from "./Img";
8
8
  export * from "./Link";
9
+ export * from "./load";
10
+ export * from "./NextImg";
11
+ export * from "./NextImgSmart";
9
12
  export * from "./NextProgress";
13
+ export * from "./revalidate";
10
14
  export * from "./Seo";
11
- export * from "./Theme";
12
- export * from "./utils";
15
+ // export * from "./seoBuildTags";
16
+ export * from "./SeoDefaults";
17
+ export * from "./T";
18
+ export * from "./to";
19
+ export * from "./translationAsOptions";
20
+ export * from "./types-i18n";
21
+ export * from "./types-seo";
22
+ export * from "./useBackUrl";
23
+ export * from "./useDateFormat";
24
+ export * from "./useForm";
25
+ export * from "./useLocale";
26
+ export * from "./useT";
27
+ export * from "./useTheme";
28
+ export * from "./useTo";
@@ -1,12 +1,3 @@
1
- export declare const ONE_HOUR = 3600;
2
- export declare const ONE_DAY = 84000;
3
- /**
4
- * Get site absolute url with the given path
5
- *
6
- * - It uses the `NEXT_PUBLIC_APP_URL` env variable
7
- * - It removes the trailing slashes
8
- */
9
- export declare function getSiteUrl(path?: string): string;
10
1
  /**
11
2
  * Utility to load a component with an optional pre-determined delay.
12
3
  *
@@ -16,3 +7,4 @@ export declare function getSiteUrl(path?: string): string;
16
7
  * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
17
8
  */
18
9
  export declare function load<T>(component: T, milliseconds: number): Promise<T>;
10
+ export default load;
@@ -1,16 +1,3 @@
1
- import { normaliseUrl } from "@koine/utils";
2
- export var ONE_HOUR = 3600;
3
- export var ONE_DAY = 84000;
4
- /**
5
- * Get site absolute url with the given path
6
- *
7
- * - It uses the `NEXT_PUBLIC_APP_URL` env variable
8
- * - It removes the trailing slashes
9
- */
10
- export function getSiteUrl(path) {
11
- if (path === void 0) { path = ""; }
12
- return normaliseUrl("".concat(process.env["NEXT_PUBLIC_APP_URL"], "/").concat(path));
13
- }
14
1
  /**
15
2
  * Utility to load a component with an optional pre-determined delay.
16
3
  *
@@ -24,3 +11,4 @@ export function load(component, milliseconds) {
24
11
  setTimeout(function () { return resolve(component); }, milliseconds);
25
12
  });
26
13
  }
14
+ export default load;
@@ -35,3 +35,4 @@ var AnalyticsGoogle = function (_a) {
35
35
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(script_1.default, { id: "google-tagmanager", src: "https://www.googletagmanager.com/gtag/js?id=".concat(id), strategy: "afterInteractive", onLoad: function () { return setReady(true); } }), (0, jsx_runtime_1.jsx)(script_1.default, tslib_1.__assign({ id: "google-analytics", strategy: "afterInteractive" }, { children: "\n window.dataLayer = window.dataLayer || [];\n function gtag(){window.dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '".concat(id, "', { 'send_page_view': false });\n ") }))] }));
36
36
  };
37
37
  exports.AnalyticsGoogle = AnalyticsGoogle;
38
+ exports.default = exports.AnalyticsGoogle;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamicNamespaces = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var DynamicNamespaces_1 = tslib_1.__importDefault(require("next-translate/DynamicNamespaces"));
6
+ /**
7
+ * **NOTE**: To make typescript work nicely here make sure to enable
8
+ * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
9
+ * in your `tsconfig.json` file.
10
+ */
11
+ exports.DynamicNamespaces = DynamicNamespaces_1.default;
12
+ exports.default = exports.DynamicNamespaces;
@@ -7,3 +7,4 @@ var head_1 = tslib_1.__importDefault(require("next/head"));
7
7
  var react_1 = require("@koine/react");
8
8
  var Favicon = function (props) { return ((0, jsx_runtime_1.jsx)(head_1.default, { children: (0, jsx_runtime_1.jsx)(react_1.FaviconTags, tslib_1.__assign({}, props)) })); };
9
9
  exports.Favicon = Favicon;
10
+ exports.default = exports.Favicon;
package/node/Head.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Head = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var head_1 = tslib_1.__importDefault(require("next/head"));
6
+ exports.Head = head_1.default;
7
+ exports.default = exports.Head;
@@ -12,3 +12,4 @@ exports.Link = (0, react_1.forwardRef)(function Link(_a, ref) {
12
12
  var href = _a.href, prefetch = _a.prefetch, replace = _a.replace, scroll = _a.scroll, shallow = _a.shallow, locale = _a.locale, _b = _a.Link, Link = _b === void 0 ? "span" : _b, props = tslib_1.__rest(_a, ["href", "prefetch", "replace", "scroll", "shallow", "locale", "Link"]);
13
13
  return ((0, jsx_runtime_1.jsx)(link_1.default, tslib_1.__assign({ href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true }, { children: (0, jsx_runtime_1.jsx)(Link, tslib_1.__assign({ ref: ref }, props)) })));
14
14
  });
15
+ exports.default = exports.Link;
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNextImgProps = exports.NextImgSmart = exports.NextImg = void 0;
3
+ exports.getNextImgProps = exports.NextImg = void 0;
4
4
  var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var react_1 = require("react");
7
5
  var image_1 = tslib_1.__importDefault(require("next/image"));
8
6
  exports.NextImg = image_1.default;
9
- var NextImgSmart = function (props) {
10
- var _a = (0, react_1.useState)(false), $loaded = _a[0], setLoaded = _a[1];
11
- var _b = (0, react_1.useState)(false), $error = _b[0], setError = _b[1];
12
- var _c = getNextImgProps(props), nextImgProps = _c.nextImgProps, restProps = _c.restProps;
13
- var Wrap = restProps.Wrap;
14
- return nextImgProps.priority ? ((0, jsx_runtime_1.jsx)(image_1.default, tslib_1.__assign({}, nextImgProps))) : ((0, jsx_runtime_1.jsx)(Wrap, tslib_1.__assign({}, restProps, { "$loaded": $loaded, "$error": $error }, { children: (0, jsx_runtime_1.jsx)(image_1.default, tslib_1.__assign({}, nextImgProps, { onLoadingComplete: function () { return setLoaded(true); }, onError: function () { return setError(true); } })) })));
15
- };
16
- exports.NextImgSmart = NextImgSmart;
17
7
  function getNextImgProps(_a) {
18
8
  var src = _a.src, alt = _a.alt, layout = _a.layout, blurDataURL = _a.blurDataURL, width = _a.width, height = _a.height, priority = _a.priority, objectFit = _a.objectFit, objectPosition = _a.objectPosition, restProps = tslib_1.__rest(_a, ["src", "alt", "layout", "blurDataURL", "width", "height", "priority", "objectFit", "objectPosition"]);
19
9
  var nextImgProps = {
@@ -33,3 +23,4 @@ function getNextImgProps(_a) {
33
23
  };
34
24
  }
35
25
  exports.getNextImgProps = getNextImgProps;
26
+ exports.default = exports.NextImg;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NextImgSmart = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var jsx_runtime_1 = require("react/jsx-runtime");
6
+ var react_1 = require("react");
7
+ var image_1 = tslib_1.__importDefault(require("next/image"));
8
+ var NextImg_1 = require("./NextImg");
9
+ var NextImgSmart = function (props) {
10
+ var _a = (0, react_1.useState)(false), $loaded = _a[0], setLoaded = _a[1];
11
+ var _b = (0, react_1.useState)(false), $error = _b[0], setError = _b[1];
12
+ var _c = (0, NextImg_1.getNextImgProps)(props), nextImgProps = _c.nextImgProps, restProps = _c.restProps;
13
+ var Wrap = restProps.Wrap;
14
+ return nextImgProps.priority ? ((0, jsx_runtime_1.jsx)(image_1.default, tslib_1.__assign({}, nextImgProps))) : ((0, jsx_runtime_1.jsx)(Wrap, tslib_1.__assign({}, restProps, { "$loaded": $loaded, "$error": $error }, { children: (0, jsx_runtime_1.jsx)(image_1.default, tslib_1.__assign({}, nextImgProps, { onLoadingComplete: function () { return setLoaded(true); }, onError: function () { return setError(true); } })) })));
15
+ };
16
+ exports.NextImgSmart = NextImgSmart;
17
+ exports.default = exports.NextImgSmart;
@@ -42,3 +42,4 @@ var NextProgress = function (_a) {
42
42
  return (0, jsx_runtime_1.jsx)(Overlay, { running: running });
43
43
  };
44
44
  exports.NextProgress = NextProgress;
45
+ exports.default = exports.NextProgress;
@@ -5,8 +5,16 @@ var tslib_1 = require("tslib");
5
5
  var jsx_runtime_1 = require("react/jsx-runtime");
6
6
  var react_1 = require("react");
7
7
  var head_1 = tslib_1.__importDefault(require("next/head"));
8
- var helpers_1 = require("./helpers");
8
+ var seoBuildTags_1 = require("./seoBuildTags");
9
9
  var _Seo = function (props) {
10
- return (0, jsx_runtime_1.jsx)(head_1.default, { children: (0, helpers_1.buildTags)(props) });
10
+ return (0, jsx_runtime_1.jsx)(head_1.default, { children: (0, seoBuildTags_1.seoBuildTags)(props) });
11
11
  };
12
+ /**
13
+ * Adapted from [garmeeh/next-seo](https://github.com/garmeeh/next-seo)
14
+ *
15
+ * See also:
16
+ * - https://github.com/catnose99/next-head-seo
17
+ * - https://nextjs.org/docs/api-reference/next/head
18
+ */
12
19
  exports.Seo = (0, react_1.memo)(_Seo);
20
+ exports.default = exports.Seo;
@@ -7,10 +7,11 @@ var react_1 = require("react");
7
7
  var head_1 = tslib_1.__importDefault(require("next/head"));
8
8
  // import { useRouter } from "next/router";
9
9
  // import { getSiteUrl } from "../utils";
10
- var helpers_1 = require("./helpers");
10
+ var seoBuildTags_1 = require("./seoBuildTags");
11
11
  var _SeoDefaults = function (props) {
12
12
  // const router = useRouter();
13
13
  // props.openGraph.url = getSiteUrl(router.asPath);
14
- return (0, jsx_runtime_1.jsx)(head_1.default, { children: (0, helpers_1.buildTags)(props) });
14
+ return (0, jsx_runtime_1.jsx)(head_1.default, { children: (0, seoBuildTags_1.seoBuildTags)(props) });
15
15
  };
16
16
  exports.SeoDefaults = (0, react_1.memo)(_SeoDefaults);
17
+ exports.default = exports.SeoDefaults;
File without changes
@@ -4,7 +4,7 @@ exports.AppMain = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var jsx_runtime_1 = require("react/jsx-runtime");
6
6
  var react_1 = tslib_1.__importDefault(require("react"));
7
- var Seo_1 = require("../../Seo");
7
+ var SeoDefaults_1 = require("../../SeoDefaults");
8
8
  /**
9
9
  * App main
10
10
  *
@@ -12,6 +12,6 @@ var Seo_1 = require("../../Seo");
12
12
  */
13
13
  var AppMain = function (_a) {
14
14
  var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, seo = _a.seo, pre = _a.pre, post = _a.post;
15
- return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Seo_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(Component, tslib_1.__assign({}, pageProps)) }), post] }));
15
+ return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(SeoDefaults_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(Component, tslib_1.__assign({}, pageProps)) }), post] }));
16
16
  };
17
17
  exports.AppMain = AppMain;
@@ -4,7 +4,7 @@ exports.AppTheme = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var jsx_runtime_1 = require("react/jsx-runtime");
6
6
  // import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react";
7
- var Theme_1 = require("../../Theme");
7
+ var useTheme_1 = require("../../useTheme");
8
8
  /**
9
9
  * App theme with vanilla class based theme (good for `tailwindcss`)
10
10
  */
@@ -13,6 +13,6 @@ var AppTheme = function (_a) {
13
13
  // return (
14
14
  // <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
15
15
  // );
16
- return ((0, jsx_runtime_1.jsx)(Theme_1.ThemeProvider, tslib_1.__assign({ defaultTheme: theme, attribute: "class" }, { children: children })));
16
+ return ((0, jsx_runtime_1.jsx)(useTheme_1.ThemeProvider, tslib_1.__assign({ defaultTheme: theme, attribute: "class" }, { children: children })));
17
17
  };
18
18
  exports.AppTheme = AppTheme;
@@ -7,7 +7,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
7
7
  var router_1 = require("next/router");
8
8
  var framer_motion_1 = require("framer-motion");
9
9
  var m_1 = require("@koine/react/m");
10
- var Seo_1 = require("../../Seo");
10
+ var SeoDefaults_1 = require("../../SeoDefaults");
11
11
  var NextProgress_1 = require("../../NextProgress");
12
12
  /**
13
13
  * App main
@@ -23,6 +23,6 @@ var AppMain = function (_a) {
23
23
  exit: { opacity: 0 },
24
24
  } : _b, pre = _a.pre, post = _a.post;
25
25
  var pathname = (0, router_1.useRouter)().pathname;
26
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Seo_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(m_1.MotionProvider, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
26
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SeoDefaults_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(m_1.MotionProvider, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
27
27
  };
28
28
  exports.AppMain = AppMain;
@@ -8,9 +8,9 @@ var react_1 = require("@emotion/react");
8
8
  var CssBaseline_1 = tslib_1.__importDefault(require("@mui/material/CssBaseline"));
9
9
  var react_2 = require("@emotion/react");
10
10
  var sc_1 = require("@koine/react/sc");
11
- var emotion_cache_1 = require("../../utils/emotion-cache");
11
+ var createEmotionCache_1 = require("../../createEmotionCache");
12
12
  // client-side cache, shared for the whole session of the user in the browser.
13
- var clientSideEmotionCache = (0, emotion_cache_1.createEmotionCache)();
13
+ var clientSideEmotionCache = (0, createEmotionCache_1.createEmotionCache)();
14
14
  /**
15
15
  * App theme with `emotion` (good for `@mui`)s
16
16
  */
@@ -7,7 +7,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
7
7
  var router_1 = require("next/router");
8
8
  var framer_motion_1 = require("framer-motion");
9
9
  var m_1 = require("@koine/react/m");
10
- var Seo_1 = require("../../Seo");
10
+ var SeoDefaults_1 = require("../../SeoDefaults");
11
11
  var NextProgress_1 = require("../../NextProgress");
12
12
  /**
13
13
  * App main
@@ -23,6 +23,6 @@ var AppMain = function (_a) {
23
23
  exit: { opacity: 0 },
24
24
  } : _b, pre = _a.pre, post = _a.post;
25
25
  var pathname = (0, router_1.useRouter)().pathname;
26
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Seo_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(m_1.MotionProvider, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
26
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SeoDefaults_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(m_1.MotionProvider, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
27
27
  };
28
28
  exports.AppMain = AppMain;
File without changes
File without changes
@@ -6,10 +6,10 @@ var react_1 = require("react");
6
6
  var router_1 = require("next/router");
7
7
  var react_2 = require("next-auth/react");
8
8
  var utils_1 = require("@koine/utils");
9
- var i18n_1 = require("../i18n");
9
+ var useT_1 = require("../useT");
10
10
  var helpers_1 = require("./helpers");
11
11
  function useLogin() {
12
- var t = (0, i18n_1.useT)();
12
+ var t = (0, useT_1.useT)();
13
13
  var push = (0, router_1.useRouter)().push;
14
14
  var _a = (0, react_1.useState)(false), loading = _a[0], setLoading = _a[1];
15
15
  var _b = (0, react_1.useState)(false), ok = _b[0], setOk = _b[1];
@@ -51,3 +51,4 @@ function useLogin() {
51
51
  };
52
52
  }
53
53
  exports.useLogin = useLogin;
54
+ exports.default = useLogin;
@@ -2,14 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLoginUrl = void 0;
4
4
  var react_1 = require("react");
5
- var i18n_1 = require("../i18n");
5
+ var useT_1 = require("../useT");
6
6
  var helpers_1 = require("./helpers");
7
7
  function useLoginUrl() {
8
8
  var _a = (0, react_1.useState)(""), currentUrl = _a[0], setCurrentUrl = _a[1];
9
- var t = (0, i18n_1.useT)();
9
+ var t = (0, useT_1.useT)();
10
10
  (0, react_1.useEffect)(function () {
11
11
  setCurrentUrl("?callbackUrl=".concat(window.location.href));
12
12
  }, []);
13
13
  return "".concat((0, helpers_1.getAuthRoutes)(t).login).concat(currentUrl);
14
14
  }
15
15
  exports.useLoginUrl = useLoginUrl;
16
+ exports.default = useLoginUrl;
@@ -5,10 +5,10 @@ var react_1 = require("react");
5
5
  var router_1 = require("next/router");
6
6
  var react_2 = require("next-auth/react");
7
7
  var utils_1 = require("@koine/utils");
8
- var i18n_1 = require("../i18n");
8
+ var useT_1 = require("../useT");
9
9
  var helpers_1 = require("./helpers");
10
10
  function useLogout() {
11
- var t = (0, i18n_1.useT)();
11
+ var t = (0, useT_1.useT)();
12
12
  var push = (0, router_1.useRouter)().push;
13
13
  var _a = (0, react_1.useState)(false), loading = _a[0], setLoading = _a[1];
14
14
  var _b = (0, react_1.useState)(false), ok = _b[0], setOk = _b[1];
@@ -54,3 +54,4 @@ function useLogout() {
54
54
  };
55
55
  }
56
56
  exports.useLogout = useLogout;
57
+ exports.default = useLogout;
@@ -58,9 +58,25 @@ function encodePathname(pathname) {
58
58
  }
59
59
  exports.encodePathname = encodePathname;
60
60
  /**
61
- * It replaces `/[dynamic-slug]/` with the given replacer.
61
+ * It replaces `/{{ slug }}/` with the given replacer.
62
62
  */
63
63
  function transformRoutePathname(rawPathname, replacer) {
64
+ var pathNameParts = rawPathname.split("/").filter(function (part) { return !!part; });
65
+ return pathNameParts
66
+ .map(function (part, _idx) {
67
+ var isDynamic = part.startsWith("{{") && part.endsWith("}}");
68
+ part = isDynamic ? replacer : part;
69
+ // if (isDynamic && _idx === pathNameParts.length - 1) {
70
+ // part += "*";
71
+ // }
72
+ return isDynamic ? part : encodeURIComponent(part);
73
+ })
74
+ .join("/");
75
+ }
76
+ /**
77
+ * It replaces `/[slug]/` with the given replacer.
78
+ */
79
+ function transformRouteTemplate(rawPathname, replacer) {
64
80
  var pathNameParts = rawPathname.split("/").filter(function (part) { return !!part; });
65
81
  return pathNameParts
66
82
  .map(function (part, _idx) {
@@ -97,7 +113,7 @@ function getRoutesMap(map, routes, pathnameBuffer, templateBuffer) {
97
113
  */
98
114
  function getPathRewrite(pathname, template) {
99
115
  pathname = transformRoutePathname(pathname, ":path");
100
- template = transformRoutePathname(template, ":path");
116
+ template = transformRouteTemplate(template, ":path");
101
117
  var source = "/".concat(normaliseUrlPathname(pathname));
102
118
  var destination = "/".concat(normaliseUrlPathname(template));
103
119
  // console.log(`rewrite pathname "${source}" to template "${destination}"`);
@@ -112,7 +128,7 @@ exports.getPathRewrite = getPathRewrite;
112
128
  */
113
129
  function getPathRedirect(locale, pathname, template, permanent) {
114
130
  if (locale === void 0) { locale = ""; }
115
- template = transformRoutePathname(template, ":slug");
131
+ template = transformRouteTemplate(template, ":slug");
116
132
  pathname = transformRoutePathname(pathname, ":slug");
117
133
  var source = "/".concat(normaliseUrlPathname((locale ? "/".concat(locale, "/") : "/") + template));
118
134
  var destination = "/".concat(normaliseUrlPathname(pathname));
@@ -200,16 +216,10 @@ function withKoine(_a) {
200
216
  // @see https://nextjs.org/docs/advanced-features/compiler#modularize-imports
201
217
  modularizeImports: tslib_1.__assign(tslib_1.__assign({}, (((_b = custom === null || custom === void 0 ? void 0 : custom["experimental"]) === null || _b === void 0 ? void 0 : _b.modularizeImports) || {})), {
202
218
  // FIXME: make these work with the right file/folder structure?
203
- // "@koine/next/?(((\\w*)?/?)*)": {
204
- // transform: "@koine/next/{{ matches.[1] }}/{{member}}",
205
- // },
206
219
  // "@koine/react/?(((\\w*)?/?)*)": {
207
220
  // transform: "@koine/react/{{ matches.[1] }}/{{member}}",
208
221
  // },
209
- // "@koine/utils/?(((\\w*)?/?)*)": {
210
- // transform: "@koine/utils/{{ matches.[1] }}/{{member}}",
211
- // },
212
- "@koine/utils": { transform: "@koine/utils/{{member}}" } }) }),
222
+ "@koine/next": { transform: "@koine/next/{{member}}" }, "@koine/utils": { transform: "@koine/utils/{{member}}" } }) }),
213
223
  // @see https://github.com/vercel/next.js/issues/7322#issuecomment-887330111
214
224
  reactStrictMode: true }, custom);
215
225
  if (svg) {
@@ -11,3 +11,4 @@ function createEmotionCache() {
11
11
  return (0, cache_1.default)({ key: "css", prepend: true });
12
12
  }
13
13
  exports.createEmotionCache = createEmotionCache;
14
+ exports.default = createEmotionCache;
@@ -6,7 +6,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
6
6
  var document_1 = tslib_1.__importStar(require("next/document"));
7
7
  var react_1 = require("@koine/react");
8
8
  var create_instance_1 = tslib_1.__importDefault(require("@emotion/server/create-instance"));
9
- var emotion_cache_1 = require("../../utils/emotion-cache");
9
+ var createEmotionCache_1 = require("../../createEmotionCache");
10
10
  /**
11
11
  * Next Document wrapper for `emotion` based projects
12
12
  *
@@ -37,7 +37,7 @@ Document.getInitialProps = function (ctx) { return tslib_1.__awaiter(void 0, voi
37
37
  switch (_a.label) {
38
38
  case 0:
39
39
  originalRenderPage = ctx.renderPage;
40
- cache = (0, emotion_cache_1.createEmotionCache)();
40
+ cache = (0, createEmotionCache_1.createEmotionCache)();
41
41
  extractCriticalToChunks = (0, create_instance_1.default)(cache).extractCriticalToChunks;
42
42
  ctx.renderPage = function () {
43
43
  return originalRenderPage({
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSiteUrl = void 0;
4
+ var utils_1 = require("@koine/utils");
5
+ /**
6
+ * Get site absolute url with the given path
7
+ *
8
+ * - It uses the `NEXT_PUBLIC_APP_URL` env variable
9
+ * - It removes the trailing slashes
10
+ */
11
+ function getSiteUrl(path) {
12
+ if (path === void 0) { path = ""; }
13
+ return (0, utils_1.normaliseUrl)("".concat(process.env["NEXT_PUBLIC_APP_URL"], "/").concat(path));
14
+ }
15
+ exports.getSiteUrl = getSiteUrl;
16
+ exports.default = getSiteUrl;
@@ -10,3 +10,4 @@ var getT_1 = tslib_1.__importDefault(require("next-translate/getT"));
10
10
  * in your `tsconfig.json` file.
11
11
  */
12
12
  exports.getT = getT_1.default;
13
+ exports.default = exports.getT;
package/node/index.js CHANGED
@@ -1,15 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Analytics"), exports);
5
- tslib_1.__exportStar(require("./Auth"), exports);
4
+ tslib_1.__exportStar(require("./AnalyticsGoogle"), exports);
5
+ // export * from "./createEmotionCache";
6
+ tslib_1.__exportStar(require("./DynamicNamespaces"), exports);
6
7
  tslib_1.__exportStar(require("./Favicon"), exports);
7
- tslib_1.__exportStar(require("./Forms"), exports);
8
+ tslib_1.__exportStar(require("./getSiteUrl"), exports);
9
+ tslib_1.__exportStar(require("./getT"), exports);
8
10
  tslib_1.__exportStar(require("./Head"), exports);
9
- tslib_1.__exportStar(require("./i18n"), exports);
10
- tslib_1.__exportStar(require("./Img"), exports);
11
11
  tslib_1.__exportStar(require("./Link"), exports);
12
+ tslib_1.__exportStar(require("./load"), exports);
13
+ tslib_1.__exportStar(require("./NextImg"), exports);
14
+ tslib_1.__exportStar(require("./NextImgSmart"), exports);
12
15
  tslib_1.__exportStar(require("./NextProgress"), exports);
16
+ tslib_1.__exportStar(require("./revalidate"), exports);
13
17
  tslib_1.__exportStar(require("./Seo"), exports);
14
- tslib_1.__exportStar(require("./Theme"), exports);
15
- tslib_1.__exportStar(require("./utils"), exports);
18
+ // export * from "./seoBuildTags";
19
+ tslib_1.__exportStar(require("./SeoDefaults"), exports);
20
+ tslib_1.__exportStar(require("./T"), exports);
21
+ tslib_1.__exportStar(require("./to"), exports);
22
+ tslib_1.__exportStar(require("./translationAsOptions"), exports);
23
+ tslib_1.__exportStar(require("./types-i18n"), exports);
24
+ tslib_1.__exportStar(require("./types-seo"), exports);
25
+ tslib_1.__exportStar(require("./useBackUrl"), exports);
26
+ tslib_1.__exportStar(require("./useDateFormat"), exports);
27
+ tslib_1.__exportStar(require("./useForm"), exports);
28
+ tslib_1.__exportStar(require("./useLocale"), exports);
29
+ tslib_1.__exportStar(require("./useT"), exports);
30
+ tslib_1.__exportStar(require("./useTheme"), exports);
31
+ tslib_1.__exportStar(require("./useTo"), exports);
@@ -1,20 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.load = exports.getSiteUrl = exports.ONE_DAY = exports.ONE_HOUR = void 0;
4
- var utils_1 = require("@koine/utils");
5
- exports.ONE_HOUR = 3600;
6
- exports.ONE_DAY = 84000;
7
- /**
8
- * Get site absolute url with the given path
9
- *
10
- * - It uses the `NEXT_PUBLIC_APP_URL` env variable
11
- * - It removes the trailing slashes
12
- */
13
- function getSiteUrl(path) {
14
- if (path === void 0) { path = ""; }
15
- return (0, utils_1.normaliseUrl)("".concat(process.env["NEXT_PUBLIC_APP_URL"], "/").concat(path));
16
- }
17
- exports.getSiteUrl = getSiteUrl;
3
+ exports.load = void 0;
18
4
  /**
19
5
  * Utility to load a component with an optional pre-determined delay.
20
6
  *
@@ -29,3 +15,4 @@ function load(component, milliseconds) {
29
15
  });
30
16
  }
31
17
  exports.load = load;
18
+ exports.default = load;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.revalidate = void 0;
4
+ exports.revalidate = {
5
+ oneHour: 3600,
6
+ onDay: 84000,
7
+ };
8
+ exports.default = exports.revalidate;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildTags = void 0;
3
+ exports.seoBuildTags = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var jsx_runtime_1 = require("react/jsx-runtime");
6
6
  var utils_1 = require("@koine/utils");
@@ -8,12 +8,13 @@ var defaults = {
8
8
  tplTitle: "",
9
9
  };
10
10
  /**
11
- * We do a couple of things in addition while many other are removed.
11
+ * Comparing to `next-seo` we do a couple of things in addition while many
12
+ * others are removed.
12
13
  *
13
14
  * - Add `seo` meta object coming from a CMS probably
14
15
  * - Add `ogimage` and `openGraph.image` as single image source
15
16
  * - Add `og` alias to define `openGraph`
16
- * - Add check for `title` equale to `templateTitle` to avoid meta titles like
17
+ * - Add check for `title` equal to `templateTitle` to avoid meta titles like
17
18
  * "My site | My site" often happening in homepages
18
19
  * - Remove the open graph videos and images
19
20
  *
@@ -21,7 +22,7 @@ var defaults = {
21
22
  *
22
23
  * @returns
23
24
  */
24
- var buildTags = function (_a) {
25
+ var seoBuildTags = function (_a) {
25
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;
26
27
  var render = [];
27
28
  var $names = {};
@@ -116,4 +117,5 @@ var buildTags = function (_a) {
116
117
  // <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
117
118
  return render;
118
119
  };
119
- exports.buildTags = buildTags;
120
+ exports.seoBuildTags = seoBuildTags;
121
+ exports.default = exports.seoBuildTags;
package/node/to.js ADDED
@@ -0,0 +1,29 @@
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() {
12
+ var args = [];
13
+ for (var _i = 0; _i < arguments.length; _i++) {
14
+ args[_i] = arguments[_i];
15
+ }
16
+ var relative = "";
17
+ var t = args[0];
18
+ if (args.length === 3) {
19
+ if (args[2]) {
20
+ relative = t(args[1], args[2]);
21
+ }
22
+ }
23
+ else if (args.length === 2) {
24
+ relative = t(args[1]);
25
+ }
26
+ return relative;
27
+ }
28
+ exports.to = to;
29
+ exports.default = to;
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });