@koine/next 1.0.11 → 1.0.14

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 (91) hide show
  1. package/Analytics/AnalyticsGoogle.js +12 -16
  2. package/Auth/helpers.js +6 -5
  3. package/Auth/useLogin.js +17 -18
  4. package/Auth/useLoginUrl.js +5 -5
  5. package/Auth/useLogout.js +19 -19
  6. package/Favicon/Favicon.js +2 -1
  7. package/Forms/useForm.js +10 -12
  8. package/Forms/useSubmit.js +23 -18
  9. package/I18n/I18n.js +35 -14
  10. package/Img/Img.js +22 -20
  11. package/Link/Link.js +4 -2
  12. package/NextProgress/NextProgress.js +12 -9
  13. package/Seo/Seo.js +2 -2
  14. package/Seo/SeoDefaults.js +2 -2
  15. package/Seo/helpers.js +34 -30
  16. package/Theme/Theme.js +98 -88
  17. package/app/AppHead.js +1 -1
  18. package/app/css/AppMain.js +4 -2
  19. package/app/css/AppTheme.js +4 -2
  20. package/app/css/auth/index.js +3 -2
  21. package/app/css/index.js +3 -2
  22. package/app/em/AppMain.js +9 -7
  23. package/app/em/AppTheme.js +6 -5
  24. package/app/em/auth/index.js +3 -2
  25. package/app/em/index.js +3 -2
  26. package/app/sc/AppMain.js +9 -7
  27. package/app/sc/AppTheme.js +4 -2
  28. package/app/sc/auth/index.js +3 -2
  29. package/app/sc/index.js +3 -2
  30. package/config/index.d.ts +13 -0
  31. package/config/index.js +87 -71
  32. package/document/Document.js +12 -5
  33. package/document/css/index.js +26 -12
  34. package/document/em/index.js +39 -48
  35. package/document/sc/index.js +44 -23
  36. package/package.json +13 -11
  37. package/utils/api.js +40 -31
  38. package/utils/index.js +7 -6
  39. package/node/Analytics/AnalyticsGoogle.js +0 -42
  40. package/node/Analytics/index.js +0 -4
  41. package/node/Auth/helpers.js +0 -26
  42. package/node/Auth/index.js +0 -7
  43. package/node/Auth/useLogin.js +0 -54
  44. package/node/Auth/useLoginUrl.js +0 -15
  45. package/node/Auth/useLogout.js +0 -56
  46. package/node/Favicon/Favicon.js +0 -9
  47. package/node/Favicon/index.js +0 -4
  48. package/node/Forms/index.js +0 -5
  49. package/node/Forms/useForm.js +0 -41
  50. package/node/Forms/useSubmit.js +0 -27
  51. package/node/Head/Head.js +0 -8
  52. package/node/Head/index.js +0 -4
  53. package/node/I18n/I18n.js +0 -82
  54. package/node/I18n/index.js +0 -4
  55. package/node/Img/Img.js +0 -34
  56. package/node/Img/index.js +0 -4
  57. package/node/Link/Link.js +0 -13
  58. package/node/Link/index.js +0 -4
  59. package/node/NextProgress/NextProgress.js +0 -41
  60. package/node/NextProgress/index.js +0 -5
  61. package/node/Seo/Seo.js +0 -12
  62. package/node/Seo/SeoDefaults.js +0 -16
  63. package/node/Seo/helpers.js +0 -115
  64. package/node/Seo/index.js +0 -15
  65. package/node/Theme/Theme.js +0 -241
  66. package/node/Theme/index.js +0 -4
  67. package/node/app/AppHead.js +0 -10
  68. package/node/app/AppMain.js +0 -2
  69. package/node/app/css/AppMain.js +0 -16
  70. package/node/app/css/AppTheme.js +0 -16
  71. package/node/app/css/auth/index.js +0 -18
  72. package/node/app/css/index.js +0 -62
  73. package/node/app/em/AppMain.js +0 -26
  74. package/node/app/em/AppTheme.js +0 -22
  75. package/node/app/em/auth/index.js +0 -18
  76. package/node/app/em/index.js +0 -17
  77. package/node/app/index.js +0 -5
  78. package/node/app/sc/AppMain.js +0 -26
  79. package/node/app/sc/AppTheme.js +0 -13
  80. package/node/app/sc/auth/index.js +0 -18
  81. package/node/app/sc/index.js +0 -64
  82. package/node/config/index.js +0 -184
  83. package/node/document/Document.js +0 -24
  84. package/node/document/css/index.js +0 -35
  85. package/node/document/em/index.js +0 -73
  86. package/node/document/index.js +0 -7
  87. package/node/document/sc/index.js +0 -49
  88. package/node/index.js +0 -15
  89. package/node/utils/api.js +0 -38
  90. package/node/utils/emotion-cache.js +0 -13
  91. package/node/utils/index.js +0 -32
@@ -1,24 +1,26 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { useState, useEffect } from "react";
3
4
  import { useRouter } from "next/router";
4
5
  import Script from "next/script";
5
6
  import { pageview } from "@koine/utils";
6
- export const AnalyticsGoogle = ({ id }) => {
7
- const uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
8
- const { events, asPath, query } = useRouter();
9
- const [ready, setReady] = useState(false);
10
- const [routed, setRouted] = useState(false);
7
+ export var AnalyticsGoogle = function (_a) {
8
+ var id = _a.id;
9
+ var uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
10
+ var _b = useRouter(), events = _b.events, asPath = _b.asPath, query = _b.query;
11
+ var _c = useState(false), ready = _c[0], setReady = _c[1];
12
+ var _d = useState(false), routed = _d[0], setRouted = _d[1];
11
13
  // const [url, setUrl] = useState("");
12
- useEffect(() => {
13
- const handleRouteChange = () => {
14
+ useEffect(function () {
15
+ var handleRouteChange = function () {
14
16
  setRouted(true);
15
17
  };
16
18
  events.on("routeChangeComplete", handleRouteChange);
17
- return () => {
19
+ return function () {
18
20
  events.off("routeChangeComplete", handleRouteChange);
19
21
  };
20
22
  }, [events]);
21
- useEffect(() => {
23
+ useEffect(function () {
22
24
  if (routed && ready && asPath) {
23
25
  // const search = query;
24
26
  pageview(asPath);
@@ -27,11 +29,5 @@ export const AnalyticsGoogle = ({ id }) => {
27
29
  if (!uid) {
28
30
  return null;
29
31
  }
30
- return (_jsxs(_Fragment, { children: [_jsx(Script, { id: "google-tagmanager", src: `https://www.googletagmanager.com/gtag/js?id=${id}`, strategy: "afterInteractive", onLoad: () => setReady(true) }), _jsx(Script, { id: "google-analytics", strategy: "afterInteractive", children: `
31
- window.dataLayer = window.dataLayer || [];
32
- function gtag(){window.dataLayer.push(arguments);}
33
- gtag('js', new Date());
34
-
35
- gtag('config', '${id}', { 'send_page_view': false });
36
- ` })] }));
32
+ return (_jsxs(_Fragment, { children: [_jsx(Script, { id: "google-tagmanager", src: "https://www.googletagmanager.com/gtag/js?id=".concat(id), strategy: "afterInteractive", onLoad: function () { return setReady(true); } }), _jsx(Script, __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 ") }))] }));
37
33
  };
package/Auth/helpers.js CHANGED
@@ -1,21 +1,22 @@
1
1
  import { isString } from "@koine/utils";
2
- export const AUTH_ROUTES = {
2
+ export var AUTH_ROUTES = {
3
3
  login: process.env["AUTH_ROUTE_LOGIN"],
4
4
  profile: process.env["AUTH_ROUTE_PROFILE"],
5
5
  register: process.env["AUTH_ROUTE_REGISTER"],
6
6
  secured: JSON.parse(process.env["AUTH_ROUTES_SECURED"] || "[]"),
7
7
  };
8
8
  export function getAuthRoutes(t) {
9
- return Object.keys(AUTH_ROUTES).reduce((map, name) => {
10
- const routePage = AUTH_ROUTES[name];
9
+ return Object.keys(AUTH_ROUTES).reduce(function (map, name) {
10
+ var routePage = AUTH_ROUTES[name];
11
11
  // @ts-expect-error cannot remember
12
- map[name] = isString(routePage) ? t(`~:${AUTH_ROUTES[name]}`) : routePage;
12
+ map[name] = isString(routePage) ? t("~:".concat(AUTH_ROUTES[name])) : routePage;
13
13
  return map;
14
14
  }, {});
15
15
  }
16
16
  /**
17
17
  * @param url e.g. "http://localhost:3000/signin?callbackUrl=http://localhost:3000/profile"
18
18
  */
19
- export function getCallbackUrl(url = window.location.href) {
19
+ export function getCallbackUrl(url) {
20
+ if (url === void 0) { url = window.location.href; }
20
21
  return url.split("callbackUrl=")[1] || "";
21
22
  }
package/Auth/useLogin.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { useState, useCallback } from "react";
2
3
  import { useRouter } from "next/router";
3
4
  import { signIn } from "next-auth/react";
@@ -5,27 +6,25 @@ import { parseURL } from "@koine/utils";
5
6
  import { useT } from "../I18n";
6
7
  import { getAuthRoutes, getCallbackUrl } from "./helpers";
7
8
  export function useLogin() {
8
- const t = useT();
9
- const { push } = useRouter();
10
- const [loading, setLoading] = useState(false);
11
- const [ok, setOk] = useState(false);
12
- const [fail, setFail] = useState(false);
13
- const submit = useCallback((data) => {
9
+ var t = useT();
10
+ var push = useRouter().push;
11
+ var _a = useState(false), loading = _a[0], setLoading = _a[1];
12
+ var _b = useState(false), ok = _b[0], setOk = _b[1];
13
+ var _c = useState(false), fail = _c[0], setFail = _c[1];
14
+ var submit = useCallback(function (data) {
14
15
  setLoading(true);
15
- signIn("credentials", {
16
- ...data,
17
- redirect: false,
18
- })
16
+ signIn("credentials", __assign(__assign({}, data), { redirect: false }))
19
17
  // @ts-expect-error FIXME: at some point...
20
- .then(({ ok }) => {
18
+ .then(function (_a) {
19
+ var ok = _a.ok;
21
20
  setLoading(false);
22
21
  setOk(ok);
23
22
  setFail(!ok);
24
23
  if (ok) {
25
- const redirectUrl = parseURL(getCallbackUrl());
26
- const { login, register, profile } = getAuthRoutes(t);
24
+ var redirectUrl = parseURL(getCallbackUrl());
25
+ var _b = getAuthRoutes(t), login = _b.login, register = _b.register, profile = _b.profile;
27
26
  if (redirectUrl) {
28
- const redirectPath = redirectUrl.pathname;
27
+ var redirectPath = redirectUrl.pathname;
29
28
  if (profile &&
30
29
  (redirectPath === login || redirectPath === register)) {
31
30
  push(profile);
@@ -42,9 +41,9 @@ export function useLogin() {
42
41
  }, [t, push]);
43
42
  // TODO: useMemo ?
44
43
  return {
45
- submit,
46
- loading,
47
- ok,
48
- fail,
44
+ submit: submit,
45
+ loading: loading,
46
+ ok: ok,
47
+ fail: fail,
49
48
  };
50
49
  }
@@ -2,10 +2,10 @@ import { useEffect, useState } from "react";
2
2
  import { useT } from "../I18n";
3
3
  import { getAuthRoutes } from "./helpers";
4
4
  export function useLoginUrl() {
5
- const [currentUrl, setCurrentUrl] = useState("");
6
- const t = useT();
7
- useEffect(() => {
8
- setCurrentUrl(`?callbackUrl=${window.location.href}`);
5
+ var _a = useState(""), currentUrl = _a[0], setCurrentUrl = _a[1];
6
+ var t = useT();
7
+ useEffect(function () {
8
+ setCurrentUrl("?callbackUrl=".concat(window.location.href));
9
9
  }, []);
10
- return `${getAuthRoutes(t).login}${currentUrl}`;
10
+ return "".concat(getAuthRoutes(t).login).concat(currentUrl);
11
11
  }
package/Auth/useLogout.js CHANGED
@@ -5,31 +5,31 @@ import { parseURL } from "@koine/utils";
5
5
  import { useT } from "../I18n";
6
6
  import { getAuthRoutes, getCallbackUrl } from "./helpers";
7
7
  export function useLogout() {
8
- const t = useT();
9
- const { push } = useRouter();
10
- const [loading, setLoading] = useState(false);
11
- const [ok, setOk] = useState(false);
12
- const [fail] = useState(false);
13
- const submit = useCallback((event) => {
8
+ var t = useT();
9
+ var push = useRouter().push;
10
+ var _a = useState(false), loading = _a[0], setLoading = _a[1];
11
+ var _b = useState(false), ok = _b[0], setOk = _b[1];
12
+ var fail = useState(false)[0];
13
+ var submit = useCallback(function (event) {
14
14
  event.preventDefault();
15
15
  event.stopPropagation();
16
16
  setLoading(true);
17
- signOut({ redirect: false }).then(() => {
17
+ signOut({ redirect: false }).then(function () {
18
18
  setLoading(false);
19
19
  setOk(true);
20
- const redirectUrl = parseURL(getCallbackUrl());
21
- const currentUrl = parseURL(window.location.href);
22
- const { secured } = getAuthRoutes(t);
23
- const signin = t("~:/signin");
24
- const profile = t("~:/profile");
25
- const targetUrl = redirectUrl || currentUrl;
26
- let redirect = "";
20
+ var redirectUrl = parseURL(getCallbackUrl());
21
+ var currentUrl = parseURL(window.location.href);
22
+ var secured = getAuthRoutes(t).secured;
23
+ var signin = t("~:/signin");
24
+ var profile = t("~:/profile");
25
+ var targetUrl = redirectUrl || currentUrl;
26
+ var redirect = "";
27
27
  if (targetUrl) {
28
28
  if (targetUrl.pathname === profile) {
29
29
  redirect = signin;
30
30
  }
31
31
  else if (secured) {
32
- for (let i = 0; i < secured.length; i++) {
32
+ for (var i = 0; i < secured.length; i++) {
33
33
  if (targetUrl.pathname.match(secured[i])) {
34
34
  redirect = signin;
35
35
  break;
@@ -44,9 +44,9 @@ export function useLogout() {
44
44
  }, [t, push]);
45
45
  // TODO: useMemo ?
46
46
  return {
47
- submit,
48
- loading,
49
- ok,
50
- fail,
47
+ submit: submit,
48
+ loading: loading,
49
+ ok: ok,
50
+ fail: fail,
51
51
  };
52
52
  }
@@ -1,4 +1,5 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import Head from "next/head";
3
4
  import { FaviconTags } from "@koine/react";
4
- export const Favicon = (props) => (_jsx(Head, { children: _jsx(FaviconTags, { ...props }) }));
5
+ export var Favicon = function (props) { return (_jsx(Head, { children: _jsx(FaviconTags, __assign({}, props)) })); };
package/Forms/useForm.js CHANGED
@@ -1,19 +1,17 @@
1
+ import { __assign } from "tslib";
1
2
  import { useMemo } from "react";
2
3
  import { useForm as _useForm } from "react-hook-form";
3
4
  import { yupResolver as resolver } from "@hookform/resolvers/yup";
4
5
  import { useT } from "../I18n";
5
6
  export function useForm(
6
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- schema, i18nNamespace, formProps = {}, debug) {
8
- const t = useT(i18nNamespace);
8
+ schema, i18nNamespace, formProps, debug) {
9
+ if (formProps === void 0) { formProps = {}; }
10
+ var t = useT(i18nNamespace);
9
11
  // const form = _useForm<InferType<ObjectSchema<T, object>>>({
10
- const form = _useForm({
12
+ var form = _useForm(__assign({
11
13
  // @ts-expect-error FIXME:
12
- resolver: resolver(schema),
13
- // make the form behave more closer as native:
14
- // shouldUnregister: true,
15
- ...formProps,
16
- });
14
+ resolver: resolver(schema) }, formProps));
17
15
  // const { control, register, setValue } = form;
18
16
  // const field = { control, register, setValue, t };
19
17
  // if (process.env["NODE_ENV"] !== "production") {
@@ -29,9 +27,9 @@ schema, i18nNamespace, formProps = {}, debug) {
29
27
  // if (formProps.mode === "onChange") {
30
28
  // return { field, ...form };
31
29
  // }
32
- return useMemo(() => {
33
- const { control, register, setValue } = form;
34
- const field = { control, register, setValue, t };
35
- return { field, ...form };
30
+ return useMemo(function () {
31
+ var control = form.control, register = form.register, setValue = form.setValue;
32
+ var field = { control: control, register: register, setValue: setValue, t: t };
33
+ return __assign({ field: field }, form);
36
34
  }, [t, form]);
37
35
  }
@@ -1,23 +1,28 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { useAsyncFn } from "@koine/react";
2
3
  import { api } from "../utils/api";
3
4
  export function useSubmit(url, transformData) {
4
- const [state, submit] = useAsyncFn(async (json) => {
5
- if (transformData)
6
- json = transformData(json);
7
- const response = await api.post(url, {
8
- json,
5
+ var _this = this;
6
+ var _a = useAsyncFn(function (json) { return __awaiter(_this, void 0, void 0, function () {
7
+ var response;
8
+ return __generator(this, function (_a) {
9
+ switch (_a.label) {
10
+ case 0:
11
+ if (transformData)
12
+ json = transformData(json);
13
+ return [4 /*yield*/, api.post(url, {
14
+ json: json,
15
+ })];
16
+ case 1:
17
+ response = _a.sent();
18
+ if (process.env["NODE_ENV"] !== "production") {
19
+ console.log("[@koine/next] useSubmit response", response);
20
+ }
21
+ return [2 /*return*/, response];
22
+ }
9
23
  });
10
- if (process.env["NODE_ENV"] !== "production") {
11
- console.log("[@koine/next] useSubmit response", response);
12
- }
13
- return response;
14
- }, [url, transformData]);
15
- const { loading, error, value } = state;
16
- const fail = !loading && (!!error || value?.fail);
17
- return {
18
- submit,
19
- loading,
20
- ...(value || {}),
21
- fail,
22
- };
24
+ }); }, [url, transformData]), state = _a[0], submit = _a[1];
25
+ var loading = state.loading, error = state.error, value = state.value;
26
+ var fail = !loading && (!!error || (value === null || value === void 0 ? void 0 : value.fail));
27
+ return __assign(__assign({ submit: submit, loading: loading }, (value || {})), { fail: fail });
23
28
  }
package/I18n/I18n.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="@koine/next/typings" />
2
+ import { __assign } from "tslib";
2
3
  /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
3
4
  /**
4
5
  * @file
@@ -19,7 +20,7 @@ export { default as T } from "next-translate/Trans";
19
20
  * @see https://github.com/vinissimus/next-translate/issues/513#issuecomment-779826418
20
21
  */
21
22
  export function useT(namespace) {
22
- const t = useTranslation().t;
23
+ var t = useTranslation().t;
23
24
  // const typedT = <
24
25
  // // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
25
26
  // R extends unknown = string,
@@ -41,33 +42,53 @@ export function useT(namespace) {
41
42
  // // ) as R extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : R;
42
43
  // ) as R;
43
44
  // return typedT;
44
- const tMemoized = useMemo(() => (s, q, o) => t(namespace ? `${namespace}:${s}` : s, q === "obj" ? null : q, q === "obj" || o === "obj" ? { returnObjects: true } : o
45
- // ) as R extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : R;
46
- ), [t, namespace]);
45
+ var tMemoized = useMemo(function () {
46
+ return function (s, q, o) {
47
+ return t(namespace ? "".concat(namespace, ":").concat(s) : s, q === "obj" ? null : q, q === "obj" || o === "obj" ? { returnObjects: true } : o
48
+ // ) as R extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : R;
49
+ );
50
+ };
51
+ }, [t, namespace]);
47
52
  // return tMemoized as Translate<N>;
48
53
  return tMemoized;
49
54
  }
50
55
  export function translationAsOptions(t, i18nKey) {
51
- const dictionary = t(i18nKey, undefined, {
56
+ var dictionary = t(i18nKey, undefined, {
52
57
  returnObjects: true,
53
58
  });
54
- return Object.keys(dictionary).map((key) => ({
59
+ return Object.keys(dictionary).map(function (key) { return ({
55
60
  value: key,
56
61
  label: dictionary[key],
57
- }));
62
+ }); });
58
63
  }
59
64
  /**
60
65
  * Automatically returns the `date-fns/format` function with the right locale
61
66
  * passed as option (grabbed from next router value).
62
67
  */
63
- export const useDateFormat = () => {
64
- const [formatter, setFormatter] = useState(() => (...args) => format(...args));
65
- const router = useRouter();
66
- const locale = useDateLocale(router.locale);
67
- useEffect(() => {
68
+ export var useDateFormat = function () {
69
+ var _a = useState(function () {
70
+ return function () {
71
+ var args = [];
72
+ for (var _i = 0; _i < arguments.length; _i++) {
73
+ args[_i] = arguments[_i];
74
+ }
75
+ return format.apply(void 0, args);
76
+ };
77
+ }), formatter = _a[0], setFormatter = _a[1];
78
+ var router = useRouter();
79
+ var locale = useDateLocale(router.locale);
80
+ useEffect(function () {
68
81
  if (locale) {
69
- const newFormatter = (date, _format, options) => format(date, _format, { ...(options || {}), locale });
70
- setFormatter(() => (...args) => newFormatter(...args));
82
+ var newFormatter_1 = function (date, _format, options) { return format(date, _format, __assign(__assign({}, (options || {})), { locale: locale })); };
83
+ setFormatter(function () {
84
+ return function () {
85
+ var args = [];
86
+ for (var _i = 0; _i < arguments.length; _i++) {
87
+ args[_i] = arguments[_i];
88
+ }
89
+ return newFormatter_1.apply(void 0, args);
90
+ };
91
+ });
71
92
  }
72
93
  }, [locale]);
73
94
  return formatter;
package/Img/Img.js CHANGED
@@ -1,28 +1,30 @@
1
+ import { __assign, __rest } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { useState } from "react";
3
4
  import NextImage from "next/image";
4
- export const NextImg = NextImage;
5
- export const NextImgSmart = (props) => {
6
- const [$loaded, setLoaded] = useState(false);
7
- const [$error, setError] = useState(false);
8
- const { nextImgProps, restProps } = getNextImgProps(props);
9
- const { Wrap } = restProps;
10
- return nextImgProps.priority ? (_jsx(NextImage, { ...nextImgProps })) : (_jsx(Wrap, { ...restProps, "$loaded": $loaded, "$error": $error, children: _jsx(NextImage, { ...nextImgProps, onLoadingComplete: () => setLoaded(true), onError: () => setError(true) }) }));
5
+ export var NextImg = NextImage;
6
+ export var NextImgSmart = function (props) {
7
+ var _a = useState(false), $loaded = _a[0], setLoaded = _a[1];
8
+ var _b = useState(false), $error = _b[0], setError = _b[1];
9
+ var _c = getNextImgProps(props), nextImgProps = _c.nextImgProps, restProps = _c.restProps;
10
+ var Wrap = restProps.Wrap;
11
+ return nextImgProps.priority ? (_jsx(NextImage, __assign({}, nextImgProps))) : (_jsx(Wrap, __assign({}, restProps, { "$loaded": $loaded, "$error": $error }, { children: _jsx(NextImage, __assign({}, nextImgProps, { onLoadingComplete: function () { return setLoaded(true); }, onError: function () { return setError(true); } })) })));
11
12
  };
12
- export function getNextImgProps({ src, alt, layout, blurDataURL, width, height, priority, objectFit, objectPosition, ...restProps }) {
13
- const nextImgProps = {
14
- src,
15
- alt,
16
- layout,
17
- blurDataURL,
18
- width,
19
- height,
20
- priority,
21
- objectFit,
22
- objectPosition,
13
+ export function getNextImgProps(_a) {
14
+ 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 = __rest(_a, ["src", "alt", "layout", "blurDataURL", "width", "height", "priority", "objectFit", "objectPosition"]);
15
+ var nextImgProps = {
16
+ src: src,
17
+ alt: alt,
18
+ layout: layout,
19
+ blurDataURL: blurDataURL,
20
+ width: width,
21
+ height: height,
22
+ priority: priority,
23
+ objectFit: objectFit,
24
+ objectPosition: objectPosition,
23
25
  };
24
26
  return {
25
- nextImgProps,
26
- restProps,
27
+ nextImgProps: nextImgProps,
28
+ restProps: restProps,
27
29
  };
28
30
  }
package/Link/Link.js CHANGED
@@ -1,9 +1,11 @@
1
+ import { __assign, __rest } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { forwardRef } from "react";
3
4
  import NextLink from "next/link";
4
5
  /**
5
6
  * @see https://next.js.org/docs/api-reference/next/link
6
7
  */
7
- export const Link = forwardRef(function Link({ href, prefetch, replace, scroll, shallow, locale, Link = "span", ...props }, ref) {
8
- return (_jsx(NextLink, { href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true, children: _jsx(Link, { ref: ref, ...props }) }));
8
+ export var Link = forwardRef(function Link(_a, ref) {
9
+ 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 = __rest(_a, ["href", "prefetch", "replace", "scroll", "shallow", "locale", "Link"]);
10
+ return (_jsx(NextLink, __assign({ href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true }, { children: _jsx(Link, __assign({ ref: ref }, props)) })));
9
11
  });
@@ -1,33 +1,36 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { useRouter } from "next/router";
4
- export const NextProgress = ({ startAt = 0.3, showOnShallow = true, stopDelayMs = 200, Overlay = "div", }) => {
5
- const { events } = useRouter();
4
+ export var NextProgress = function (_a) {
5
+ var _b = _a.startAt, startAt = _b === void 0 ? 0.3 : _b, _c = _a.showOnShallow, showOnShallow = _c === void 0 ? true : _c, _d = _a.stopDelayMs, stopDelayMs = _d === void 0 ? 200 : _d, _e = _a.Overlay, Overlay = _e === void 0 ? "div" : _e;
6
+ var events = useRouter().events;
6
7
  // const [progress, setProgress] = useState(0);
7
- const [running, setRunning] = useState(false);
8
- const timer = useRef(null);
9
- const routeChangeStart = useCallback((_, { shallow }) => {
8
+ var _f = useState(false), running = _f[0], setRunning = _f[1];
9
+ var timer = useRef(null);
10
+ var routeChangeStart = useCallback(function (_, _a) {
11
+ var shallow = _a.shallow;
10
12
  if (!shallow || showOnShallow) {
11
13
  // setProgress(startAt);
12
14
  setRunning(true);
13
15
  }
14
16
  }, [showOnShallow]);
15
- const routeChangeEnd = useCallback((_, { shallow }) => {
17
+ var routeChangeEnd = useCallback(function (_, _a) {
18
+ var shallow = _a.shallow;
16
19
  if (!shallow || showOnShallow) {
17
20
  if (timer.current) {
18
21
  clearTimeout(timer.current);
19
22
  }
20
- timer.current = setTimeout(() => {
23
+ timer.current = setTimeout(function () {
21
24
  // setProgress(100);
22
25
  setRunning(false);
23
26
  }, stopDelayMs);
24
27
  }
25
28
  }, [showOnShallow, stopDelayMs, timer]);
26
- useEffect(() => {
29
+ useEffect(function () {
27
30
  events.on("routeChangeStart", routeChangeStart);
28
31
  events.on("routeChangeComplete", routeChangeEnd);
29
32
  events.on("routeChangeError", routeChangeEnd);
30
- return () => {
33
+ return function () {
31
34
  events.off("routeChangeStart", routeChangeStart);
32
35
  events.off("routeChangeComplete", routeChangeEnd);
33
36
  events.off("routeChangeError", routeChangeEnd);
package/Seo/Seo.js CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from "react";
3
3
  import Head from "next/head";
4
4
  import { buildTags } from "./helpers";
5
- const _Seo = (props) => {
5
+ var _Seo = function (props) {
6
6
  return _jsx(Head, { children: buildTags(props) });
7
7
  };
8
- export const Seo = memo(_Seo);
8
+ export var Seo = memo(_Seo);
@@ -4,9 +4,9 @@ import Head from "next/head";
4
4
  // import { useRouter } from "next/router";
5
5
  // import { getSiteUrl } from "../utils";
6
6
  import { buildTags } from "./helpers";
7
- const _SeoDefaults = (props) => {
7
+ var _SeoDefaults = function (props) {
8
8
  // const router = useRouter();
9
9
  // props.openGraph.url = getSiteUrl(router.asPath);
10
10
  return _jsx(Head, { children: buildTags(props) });
11
11
  };
12
- export const SeoDefaults = memo(_SeoDefaults);
12
+ export var SeoDefaults = memo(_SeoDefaults);