@koine/next 2.0.0-beta.1 → 2.0.0-beta.11

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 (113) hide show
  1. package/12/AnalyticsGoogle.mjs +41 -15
  2. package/12/DisableErrorOverlay.mjs +8 -5
  3. package/12/DynamicNamespaces.d.ts +1 -1
  4. package/12/DynamicNamespaces.mjs +1 -2
  5. package/12/Favicon.mjs +6 -2
  6. package/12/Link.d.ts +1 -1
  7. package/12/Link.mjs +14 -6
  8. package/12/NextProgress.mjs +26 -17
  9. package/12/Seo.d.ts +1 -1
  10. package/12/Seo.mjs +5 -4
  11. package/12/SeoDefaults.d.ts +1 -1
  12. package/12/SeoDefaults.mjs +5 -3
  13. package/12/T.d.ts +1 -1
  14. package/12/T.mjs +20 -6
  15. package/12/ThemeContext.mjs +3 -3
  16. package/12/ThemeProvider.mjs +139 -129
  17. package/12/TransText.mjs +1 -1
  18. package/12/app/AppHead.mjs +8 -2
  19. package/12/app/AppMain.d.ts +4 -4
  20. package/12/app/AppMain.mjs +1 -1
  21. package/12/app/css/AppMain.mjs +15 -5
  22. package/12/app/css/AppTheme.d.ts +1 -1
  23. package/12/app/css/AppTheme.mjs +7 -4
  24. package/12/app/css/auth/index.d.ts +1 -1
  25. package/12/app/css/auth/index.mjs +17 -6
  26. package/12/app/css/index.d.ts +1 -1
  27. package/12/app/css/index.mjs +14 -6
  28. package/12/app/sc/AppMain.mjs +46 -13
  29. package/12/app/sc/AppTheme.d.ts +1 -1
  30. package/12/app/sc/AppTheme.mjs +9 -4
  31. package/12/app/sc/auth/index.d.ts +1 -1
  32. package/12/app/sc/auth/index.mjs +17 -6
  33. package/12/app/sc/index.d.ts +1 -1
  34. package/12/app/sc/index.mjs +14 -6
  35. package/12/document/Document.mjs +24 -14
  36. package/12/document/css/index.mjs +26 -18
  37. package/12/document/sc/index.mjs +46 -45
  38. package/12/getT.mjs +2 -4
  39. package/12/index.mjs +2 -2
  40. package/12/seoBuildTags.mjs +59 -55
  41. package/12/to.mjs +4 -10
  42. package/12/translationAsOptions.mjs +6 -6
  43. package/12/types-i18n.mjs +1 -2
  44. package/12/types-seo.mjs +1 -1
  45. package/12/useBackUrl.mjs +8 -8
  46. package/12/useDateFormat.mjs +15 -28
  47. package/12/useForm.d.ts +1 -1
  48. package/12/useForm.mjs +25 -13
  49. package/12/useT.d.ts +1 -1
  50. package/12/useT.mjs +32 -14
  51. package/12/useTheme.mjs +1 -2
  52. package/12/useTo.mjs +3 -10
  53. package/README.md +1 -1
  54. package/config/index.mjs +187 -204
  55. package/getSiteUrl.mjs +2 -4
  56. package/load.mjs +3 -4
  57. package/package.json +25 -18
  58. package/typings.d.ts +60 -0
  59. package/12/AnalyticsGoogle.js +0 -39
  60. package/12/DisableErrorOverlay.js +0 -18
  61. package/12/DynamicNamespaces.js +0 -13
  62. package/12/Favicon.js +0 -10
  63. package/12/Link.js +0 -15
  64. package/12/NextProgress.js +0 -46
  65. package/12/Seo.js +0 -34
  66. package/12/SeoDefaults.js +0 -17
  67. package/12/T.js +0 -17
  68. package/12/ThemeContext.js +0 -10
  69. package/12/ThemeProvider.js +0 -239
  70. package/12/TransText.js +0 -8
  71. package/12/app/AppHead.js +0 -11
  72. package/12/app/AppMain.js +0 -2
  73. package/12/app/css/AppMain.js +0 -18
  74. package/12/app/css/AppTheme.js +0 -18
  75. package/12/app/css/auth/index.js +0 -17
  76. package/12/app/css/auth/package.json +0 -6
  77. package/12/app/css/index.js +0 -61
  78. package/12/app/css/package.json +0 -6
  79. package/12/app/index.js +0 -5
  80. package/12/app/package.json +0 -6
  81. package/12/app/sc/AppMain.js +0 -29
  82. package/12/app/sc/AppTheme.js +0 -15
  83. package/12/app/sc/auth/index.js +0 -17
  84. package/12/app/sc/auth/package.json +0 -6
  85. package/12/app/sc/index.js +0 -63
  86. package/12/app/sc/package.json +0 -6
  87. package/12/document/Document.js +0 -31
  88. package/12/document/css/index.js +0 -45
  89. package/12/document/css/package.json +0 -6
  90. package/12/document/index.js +0 -7
  91. package/12/document/package.json +0 -6
  92. package/12/document/sc/index.js +0 -67
  93. package/12/document/sc/package.json +0 -6
  94. package/12/getT.js +0 -14
  95. package/12/index.js +0 -52
  96. package/12/package.json +0 -6
  97. package/12/seoBuildTags.js +0 -121
  98. package/12/to.js +0 -29
  99. package/12/translationAsOptions.js +0 -13
  100. package/12/types-i18n.js +0 -14
  101. package/12/types-seo.js +0 -2
  102. package/12/useBackUrl.js +0 -33
  103. package/12/useDateFormat.js +0 -43
  104. package/12/useForm.js +0 -39
  105. package/12/useLocale.js +0 -11
  106. package/12/useT.js +0 -44
  107. package/12/useTheme.js +0 -12
  108. package/12/useTo.js +0 -19
  109. package/config/index.js +0 -343
  110. package/config/package.json +0 -6
  111. package/getSiteUrl.js +0 -17
  112. package/index.js +0 -7
  113. package/load.js +0 -18
@@ -1,34 +1,60 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
3
  import { useRouter } from "next/router";
5
4
  import Script from "next/script";
5
+ import { useEffect, useState } from "react";
6
6
  import gtagPageview from "@koine/browser/gtagPageview";
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];
7
+ export const AnalyticsGoogle = ({ id })=>{
8
+ const uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
9
+ const { events, asPath, query } = useRouter();
10
+ const [ready, setReady] = useState(false);
11
+ const [routed, setRouted] = useState(false);
13
12
  // const [url, setUrl] = useState("");
14
- useEffect(function () {
15
- var handleRouteChange = function () {
13
+ useEffect(()=>{
14
+ const handleRouteChange = ()=>{
16
15
  setRouted(true);
17
16
  };
18
17
  events.on("routeChangeComplete", handleRouteChange);
19
- return function () {
18
+ return ()=>{
20
19
  events.off("routeChangeComplete", handleRouteChange);
21
20
  };
22
- }, [events]);
23
- useEffect(function () {
21
+ }, [
22
+ events
23
+ ]);
24
+ useEffect(()=>{
24
25
  if (routed && ready && asPath) {
25
26
  // const search = query;
26
27
  gtagPageview(asPath);
27
28
  }
28
- }, [asPath, query, routed, ready]);
29
+ }, [
30
+ asPath,
31
+ query,
32
+ routed,
33
+ ready
34
+ ]);
29
35
  if (!uid) {
30
36
  return null;
31
37
  }
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, { 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 ") })] }));
38
+ return /*#__PURE__*/ _jsxs(_Fragment, {
39
+ children: [
40
+ /*#__PURE__*/ _jsx(Script, {
41
+ id: "google-tagmanager",
42
+ src: `https://www.googletagmanager.com/gtag/js?id=${id}`,
43
+ strategy: "afterInteractive",
44
+ onLoad: ()=>setReady(true)
45
+ }),
46
+ /*#__PURE__*/ _jsx(Script, {
47
+ id: "google-analytics",
48
+ strategy: "afterInteractive",
49
+ children: `
50
+ window.dataLayer = window.dataLayer || [];
51
+ function gtag(){window.dataLayer.push(arguments);}
52
+ gtag('js', new Date());
53
+
54
+ gtag('config', '${id}', { 'send_page_view': false });
55
+ `
56
+ })
57
+ ]
58
+ });
33
59
  };
34
60
  export default AnalyticsGoogle;
@@ -4,10 +4,13 @@ import Head from "next/head";
4
4
  * Disable error overlay during `dev`
5
5
  *
6
6
  * @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
7
- */
8
- export var DisableErrorOverlay = function () {
9
- return (_jsx(Head, { children: process.env["NODE_ENV"] !== "production" && (_jsx("script", { dangerouslySetInnerHTML: {
10
- __html: "window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});",
11
- } })) }));
7
+ */ export const DisableErrorOverlay = ()=>{
8
+ return /*#__PURE__*/ _jsx(Head, {
9
+ children: process.env["NODE_ENV"] !== "production" && /*#__PURE__*/ _jsx("script", {
10
+ dangerouslySetInnerHTML: {
11
+ __html: `window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});`
12
+ }
13
+ })
14
+ });
12
15
  };
13
16
  export default DisableErrorOverlay;
@@ -1,5 +1,5 @@
1
- import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
2
1
  import type { DynamicNamespacesProps as BaseDynamicNamespacesProps } from "next-translate";
2
+ import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
3
3
  import type { TranslateNamespace } from "./types-i18n";
4
4
  export type DynamicNamespacesProps = Omit<BaseDynamicNamespacesProps, "namespaces"> & {
5
5
  namespaces: TranslateNamespace[];
@@ -4,6 +4,5 @@ import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
4
4
  * **NOTE**: To make typescript work nicely here make sure to enable
5
5
  * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
6
6
  * in your `tsconfig.json` file.
7
- */
8
- export var DynamicNamespaces = BaseDynamicNamespaces;
7
+ */ export const DynamicNamespaces = BaseDynamicNamespaces;
9
8
  export default DynamicNamespaces;
package/12/Favicon.mjs CHANGED
@@ -1,6 +1,10 @@
1
- import { __assign } from "tslib";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import Head from "next/head";
3
+ import React from "react";
4
4
  import FaviconTags from "@koine/react/FaviconTags";
5
- export var Favicon = function (props) { return (_jsx(Head, { children: _jsx(FaviconTags, __assign({}, props)) })); };
5
+ export const Favicon = (props)=>/*#__PURE__*/ _jsx(Head, {
6
+ children: /*#__PURE__*/ _jsx(FaviconTags, {
7
+ ...props
8
+ })
9
+ });
6
10
  export default Favicon;
package/12/Link.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React from "react";
2
1
  import { LinkProps as NextLinkProps } from "next/link";
2
+ import React from "react";
3
3
  export type LinkProps = Omit<React.ComponentPropsWithRef<"a">, "href"> & Omit<NextLinkProps, "as" | "passHref" | "children"> & {
4
4
  Link?: React.ComponentType<any>;
5
5
  };
package/12/Link.mjs CHANGED
@@ -1,12 +1,20 @@
1
- import { __assign, __rest } from "tslib";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef } from "react";
4
2
  import NextLink from "next/link";
3
+ import React, { forwardRef } from "react";
5
4
  /**
6
5
  * @see https://next.js.org/docs/api-reference/next/link
7
- */
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, { href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true, children: _jsx(Link, __assign({ ref: ref }, props)) }));
6
+ */ export const Link = /*#__PURE__*/ forwardRef(function Link({ href, prefetch, replace, scroll, shallow, locale, Link = "span", ...props }, ref) {
7
+ return /*#__PURE__*/ _jsx(NextLink, {
8
+ href: href,
9
+ replace: replace,
10
+ scroll: scroll,
11
+ shallow: shallow,
12
+ locale: locale,
13
+ passHref: true,
14
+ children: /*#__PURE__*/ _jsx(Link, {
15
+ ref: ref,
16
+ ...props
17
+ })
18
+ });
11
19
  });
12
20
  export default Link;
@@ -1,42 +1,51 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useRef, useState } from "react";
4
3
  import { useRouter } from "next/router";
5
- export var NextProgress = function (_a) {
6
- 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;
7
- var events = useRouter().events;
4
+ import { useCallback, useEffect, useRef, useState } from "react";
5
+ export const NextProgress = ({ startAt = 0.3, showOnShallow = true, stopDelayMs = 200, Overlay = "div" })=>{
6
+ const { events } = useRouter();
8
7
  // const [progress, setProgress] = useState(0);
9
- var _f = useState(false), running = _f[0], setRunning = _f[1];
10
- var timer = useRef(null);
11
- var routeChangeStart = useCallback(function (_, _a) {
12
- var shallow = _a.shallow;
8
+ const [running, setRunning] = useState(false);
9
+ const timer = useRef(null);
10
+ const routeChangeStart = useCallback((_, { shallow })=>{
13
11
  if (!shallow || showOnShallow) {
14
12
  // setProgress(startAt);
15
13
  setRunning(true);
16
14
  }
17
- }, [showOnShallow]);
18
- var routeChangeEnd = useCallback(function (_, _a) {
19
- var shallow = _a.shallow;
15
+ }, [
16
+ showOnShallow
17
+ ]);
18
+ const routeChangeEnd = useCallback((_, { shallow })=>{
20
19
  if (!shallow || showOnShallow) {
21
20
  if (timer.current) {
22
21
  clearTimeout(timer.current);
23
22
  }
24
- timer.current = setTimeout(function () {
23
+ timer.current = setTimeout(()=>{
25
24
  // setProgress(100);
26
25
  setRunning(false);
27
26
  }, stopDelayMs);
28
27
  }
29
- }, [showOnShallow, stopDelayMs, timer]);
30
- useEffect(function () {
28
+ }, [
29
+ showOnShallow,
30
+ stopDelayMs,
31
+ timer
32
+ ]);
33
+ useEffect(()=>{
31
34
  events.on("routeChangeStart", routeChangeStart);
32
35
  events.on("routeChangeComplete", routeChangeEnd);
33
36
  events.on("routeChangeError", routeChangeEnd);
34
- return function () {
37
+ return ()=>{
35
38
  events.off("routeChangeStart", routeChangeStart);
36
39
  events.off("routeChangeComplete", routeChangeEnd);
37
40
  events.off("routeChangeError", routeChangeEnd);
38
41
  };
39
- }, [events, routeChangeStart, routeChangeEnd]);
40
- return _jsx(Overlay, { running: running });
42
+ }, [
43
+ events,
44
+ routeChangeStart,
45
+ routeChangeEnd
46
+ ]);
47
+ return /*#__PURE__*/ _jsx(Overlay, {
48
+ running: running
49
+ });
41
50
  };
42
51
  export default NextProgress;
package/12/Seo.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { NextSeoProps } from "next-seo/lib/types";
2
+ import { type LinkTag, type MetaTag } from "./seoBuildTags";
2
3
  import type { SeoData } from "./types-seo";
3
- import { type MetaTag, type LinkTag } from "./seoBuildTags";
4
4
  type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
5
5
  image?: string;
6
6
  };
package/12/Seo.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  // import { memo } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import Head from "next/head";
4
4
  import { seoBuildTags } from "./seoBuildTags";
5
5
  /**
@@ -22,8 +22,9 @@ import { seoBuildTags } from "./seoBuildTags";
22
22
  * ```js
23
23
  * <Seo title="MyApp | Some description" titleTemplate="%s" />
24
24
  * ```
25
- */
26
- export var Seo = function (props) {
27
- return _jsx(Head, { children: seoBuildTags(props) });
25
+ */ export const Seo = (props)=>{
26
+ return /*#__PURE__*/ _jsx(Head, {
27
+ children: seoBuildTags(props)
28
+ });
28
29
  };
29
30
  export default Seo;
@@ -1,5 +1,5 @@
1
1
  import type { DefaultSeoProps } from "next-seo/lib/types";
2
- import { type MetaTag, type LinkTag } from "./seoBuildTags";
2
+ import { type LinkTag, type MetaTag } from "./seoBuildTags";
3
3
  /**
4
4
  * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
5
5
  */
@@ -1,12 +1,14 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  // import { memo } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import Head from "next/head";
4
4
  // import { useRouter } from "next/router";
5
5
  // import { getSiteUrl } from "../utils";
6
6
  import { seoBuildTags } from "./seoBuildTags";
7
- export var SeoDefaults = function (props) {
7
+ export const SeoDefaults = (props)=>{
8
8
  // const router = useRouter();
9
9
  // props.openGraph.url = getSiteUrl(router.asPath);
10
- return _jsx(Head, { children: seoBuildTags(props) });
10
+ return /*#__PURE__*/ _jsx(Head, {
11
+ children: seoBuildTags(props)
12
+ });
11
13
  };
12
14
  export default SeoDefaults;
package/12/T.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { TransProps } from "next-translate";
3
- import type { TranslateNamespace, TranslationsPaths, TranslationsAllPaths } from "./types-i18n";
3
+ import type { TranslateNamespace, TranslationsAllPaths, TranslationsPaths } from "./types-i18n";
4
4
  export type TProps<TNamespace extends TranslateNamespace | undefined = undefined> = (Omit<TransProps, "i18nKey" | "ns"> & {
5
5
  i18nKey: TranslationsAllPaths;
6
6
  }) | (Omit<TransProps, "i18nKey" | "ns"> & {
package/12/T.mjs CHANGED
@@ -1,13 +1,27 @@
1
1
  "use client";
2
- import { __assign } from "tslib";
3
2
  import { jsx as _jsx } from "react/jsx-runtime";
4
3
  import Trans from "next-translate/Trans";
5
4
  /**
6
5
  * **NOTE**: To make typescript work nicely here make sure to enable
7
6
  * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
8
7
  * in your `tsconfig.json` file.
9
- */
10
- export var T = function (props) {
11
- return (_jsx(Trans, __assign({}, props)));
12
- };
13
- export default T;
8
+ */ export const T = (props)=>/*#__PURE__*/ _jsx(Trans, {
9
+ ...props
10
+ });
11
+ export default T; // export type TProps = Omit<TransProps, "i18nKey" | "ns"> & {
12
+ // i18nKey: TranslationsAllPaths;
13
+ // };
14
+ // export type TPropsNamespaced<
15
+ // TNamespace extends TranslateNamespace
16
+ // > = Omit<TransProps, "i18nKey" | "ns"> & {
17
+ // i18nKey: TranslationsPaths<Translations[TNamespace]>;
18
+ // ns?: TNamespace;
19
+ // };
20
+ // export function T(props: TProps): JSX.Element;
21
+ // export function T<TNamespace extends TranslateNamespace>(props: TPropsNamespaced<TNamespace>): JSX.Element;
22
+ // export function T<TNamespace extends TranslateNamespace>(
23
+ // props: TProps<TNamespace>
24
+ // ) {
25
+ // return <Trans {...props} />;
26
+ // }
27
+ // export { default as T } from "next-translate/Trans";
@@ -1,7 +1,7 @@
1
1
  import { createContext } from "react";
2
- export var ThemeContext = createContext({
2
+ export const ThemeContext = /*#__PURE__*/ createContext({
3
3
  // eslint-disable-next-line @typescript-eslint/no-empty-function
4
- setTheme: function (_) { },
5
- themes: [],
4
+ setTheme: (_)=>{},
5
+ themes: []
6
6
  });
7
7
  export default ThemeContext;