@koine/next 2.0.0-beta.14 → 2.0.0-beta.15

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 (134) hide show
  1. package/12/AnalyticsGoogle.d.ts +0 -1
  2. package/12/AnalyticsGoogle.js +32 -0
  3. package/12/DisableErrorOverlay.d.ts +0 -5
  4. package/12/DisableErrorOverlay.js +8 -0
  5. package/12/DynamicNamespaces.d.ts +1 -6
  6. package/12/DynamicNamespaces.js +4 -0
  7. package/12/Favicon.js +6 -0
  8. package/12/Link.d.ts +0 -3
  9. package/12/Link.js +9 -0
  10. package/12/NextProgress.d.ts +0 -3
  11. package/12/{NextProgress.mjs → NextProgress.js} +16 -28
  12. package/12/Seo.d.ts +2 -26
  13. package/12/Seo.js +7 -0
  14. package/12/SeoDefaults.d.ts +1 -4
  15. package/12/SeoDefaults.js +7 -0
  16. package/12/T.d.ts +1 -7
  17. package/12/T.js +8 -0
  18. package/12/{TransText.mjs → TransText.js} +1 -1
  19. package/12/app/AppHead.js +6 -0
  20. package/12/app/AppMain.d.ts +2 -20
  21. package/12/app/AppMain.js +1 -0
  22. package/12/app/css/AppMain.d.ts +1 -6
  23. package/12/app/css/AppMain.js +9 -0
  24. package/12/app/css/AppTheme.d.ts +1 -4
  25. package/12/app/css/AppTheme.js +7 -0
  26. package/12/app/css/auth/index.d.ts +2 -5
  27. package/12/app/css/auth/index.js +10 -0
  28. package/12/app/css/index.d.ts +2 -50
  29. package/12/app/css/index.js +9 -0
  30. package/12/app/index.d.ts +2 -2
  31. package/12/app/index.js +2 -0
  32. package/12/app/sc/AppMain.d.ts +1 -8
  33. package/12/app/sc/AppMain.js +18 -0
  34. package/12/app/sc/AppTheme.d.ts +0 -6
  35. package/12/app/sc/AppTheme.js +8 -0
  36. package/12/app/sc/auth/index.d.ts +2 -5
  37. package/12/app/sc/auth/index.js +10 -0
  38. package/12/app/sc/index.d.ts +2 -52
  39. package/12/app/sc/index.js +9 -0
  40. package/12/document/Document.d.ts +0 -10
  41. package/12/document/Document.js +18 -0
  42. package/12/document/css/index.d.ts +0 -12
  43. package/12/document/css/index.js +18 -0
  44. package/12/document/index.d.ts +2 -2
  45. package/12/document/index.js +2 -0
  46. package/12/document/sc/index.d.ts +0 -13
  47. package/12/document/sc/index.js +50 -0
  48. package/12/getT.d.ts +1 -6
  49. package/12/getT.js +4 -0
  50. package/12/index.d.ts +3 -24
  51. package/12/index.js +3 -0
  52. package/12/seoBuildTags.d.ts +2 -17
  53. package/12/seoBuildTags.js +93 -0
  54. package/12/to.d.ts +1 -11
  55. package/12/to.js +18 -0
  56. package/12/translationAsOptions.d.ts +2 -1
  57. package/12/translationAsOptions.js +10 -0
  58. package/12/types-i18n.d.ts +0 -87
  59. package/12/types-i18n.js +1 -0
  60. package/12/types-seo.js +1 -0
  61. package/12/types.d.ts +7 -0
  62. package/12/types.js +2 -0
  63. package/12/useBackUrl.js +23 -0
  64. package/12/useDateFormat.d.ts +0 -4
  65. package/12/useDateFormat.js +35 -0
  66. package/12/useForm.d.ts +1 -1
  67. package/12/useForm.js +15 -0
  68. package/12/useT.d.ts +1 -1
  69. package/12/useT.js +17 -0
  70. package/12/useTo.d.ts +1 -1
  71. package/12/useTo.js +15 -0
  72. package/ThemeContext.d.ts +11 -0
  73. package/ThemeContext.js +6 -0
  74. package/ThemeProvider.d.ts +17 -0
  75. package/ThemeProvider.js +204 -0
  76. package/config.d.ts +37 -0
  77. package/config.js +246 -0
  78. package/getSiteUrl.d.ts +0 -6
  79. package/getSiteUrl.js +6 -0
  80. package/index.d.ts +5 -2
  81. package/index.js +5 -0
  82. package/load.d.ts +0 -8
  83. package/load.js +6 -0
  84. package/package.json +155 -36
  85. package/useTheme.d.ts +4 -0
  86. package/useTheme.js +5 -0
  87. package/12/AnalyticsGoogle.mjs +0 -60
  88. package/12/DisableErrorOverlay.mjs +0 -16
  89. package/12/DynamicNamespaces.mjs +0 -8
  90. package/12/Favicon.mjs +0 -10
  91. package/12/Link.mjs +0 -20
  92. package/12/Seo.mjs +0 -30
  93. package/12/SeoDefaults.mjs +0 -14
  94. package/12/T.mjs +0 -27
  95. package/12/ThemeContext.d.ts +0 -17
  96. package/12/ThemeContext.mjs +0 -7
  97. package/12/ThemeProvider.d.ts +0 -35
  98. package/12/ThemeProvider.mjs +0 -245
  99. package/12/app/AppHead.mjs +0 -12
  100. package/12/app/AppMain.mjs +0 -1
  101. package/12/app/css/AppMain.mjs +0 -24
  102. package/12/app/css/AppTheme.mjs +0 -17
  103. package/12/app/css/auth/index.mjs +0 -24
  104. package/12/app/css/index.mjs +0 -65
  105. package/12/app/index.mjs +0 -2
  106. package/12/app/sc/AppMain.mjs +0 -58
  107. package/12/app/sc/AppTheme.mjs +0 -16
  108. package/12/app/sc/auth/index.mjs +0 -24
  109. package/12/app/sc/index.mjs +0 -67
  110. package/12/document/Document.mjs +0 -38
  111. package/12/document/css/index.mjs +0 -53
  112. package/12/document/index.mjs +0 -2
  113. package/12/document/sc/index.mjs +0 -65
  114. package/12/getT.mjs +0 -8
  115. package/12/index.mjs +0 -27
  116. package/12/seoBuildTags.mjs +0 -121
  117. package/12/to.mjs +0 -19
  118. package/12/translationAsOptions.mjs +0 -9
  119. package/12/types-i18n.mjs +0 -12
  120. package/12/types-seo.mjs +0 -1
  121. package/12/useBackUrl.mjs +0 -28
  122. package/12/useDateFormat.mjs +0 -26
  123. package/12/useForm.mjs +0 -47
  124. package/12/useT.mjs +0 -39
  125. package/12/useTheme.d.ts +0 -7
  126. package/12/useTheme.mjs +0 -7
  127. package/12/useTo.mjs +0 -8
  128. package/README.md +0 -13
  129. package/config/index.d.ts +0 -160
  130. package/config/index.mjs +0 -315
  131. package/getSiteUrl.mjs +0 -10
  132. package/index.mjs +0 -2
  133. package/load.mjs +0 -13
  134. /package/12/{useLocale.mjs → useLocale.js} +0 -0
@@ -1,5 +1,4 @@
1
1
  export type AnalyticsGoogleProps = {
2
- /** Falls back to `.env` variable `NEXT_PUBLIC_GTM_ID` */
3
2
  id?: string;
4
3
  };
5
4
  export declare const AnalyticsGoogle: ({ id }: AnalyticsGoogleProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRouter } from "next/router";
4
+ import Script from "next/script";
5
+ import { useEffect, useState } from "react";
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];
13
+ useEffect(function () {
14
+ var handleRouteChange = function () {
15
+ setRouted(true);
16
+ };
17
+ events.on("routeChangeComplete", handleRouteChange);
18
+ return function () {
19
+ events.off("routeChangeComplete", handleRouteChange);
20
+ };
21
+ }, [events]);
22
+ useEffect(function () {
23
+ if (routed && ready && asPath) {
24
+ gtagPageview(asPath);
25
+ }
26
+ }, [asPath, query, routed, ready]);
27
+ if (!uid) {
28
+ return null;
29
+ }
30
+ 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 ") })] }));
31
+ };
32
+ export default AnalyticsGoogle;
@@ -1,7 +1,2 @@
1
- /**
2
- * Disable error overlay during `dev`
3
- *
4
- * @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
5
- */
6
1
  export declare const DisableErrorOverlay: () => import("react/jsx-runtime").JSX.Element;
7
2
  export default DisableErrorOverlay;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Head from "next/head";
3
+ export var DisableErrorOverlay = function () {
4
+ return (_jsx(Head, { children: process.env["NODE_ENV"] !== "production" && (_jsx("script", { dangerouslySetInnerHTML: {
5
+ __html: "window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});",
6
+ } })) }));
7
+ };
8
+ export default DisableErrorOverlay;
@@ -1,13 +1,8 @@
1
1
  import type { DynamicNamespacesProps as BaseDynamicNamespacesProps } from "next-translate";
2
2
  import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
3
- import type { TranslateNamespace } from "./types-i18n";
3
+ import type { TranslateNamespace } from "./types-i18n.js";
4
4
  export type DynamicNamespacesProps = Omit<BaseDynamicNamespacesProps, "namespaces"> & {
5
5
  namespaces: TranslateNamespace[];
6
6
  };
7
- /**
8
- * **NOTE**: To make typescript work nicely here make sure to enable
9
- * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
10
- * in your `tsconfig.json` file.
11
- */
12
7
  export declare const DynamicNamespaces: (props: DynamicNamespacesProps) => ReturnType<typeof BaseDynamicNamespaces>;
13
8
  export default DynamicNamespaces;
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import BaseDynamicNamespaces from "next-translate/DynamicNamespaces";
3
+ export var DynamicNamespaces = BaseDynamicNamespaces;
4
+ export default DynamicNamespaces;
package/12/Favicon.js ADDED
@@ -0,0 +1,6 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import Head from "next/head";
4
+ import FaviconTags from "@koine/react/FaviconTags";
5
+ export var Favicon = function (props) { return (_jsx(Head, { children: _jsx(FaviconTags, __assign({}, props)) })); };
6
+ export default Favicon;
package/12/Link.d.ts CHANGED
@@ -3,8 +3,5 @@ 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
  };
6
- /**
7
- * @see https://next.js.org/docs/api-reference/next/link
8
- */
9
6
  export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
10
7
  export default Link;
package/12/Link.js ADDED
@@ -0,0 +1,9 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import NextLink from "next/link";
4
+ import { forwardRef } from "react";
5
+ export var Link = forwardRef(function Link(_a, ref) {
6
+ 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"]);
7
+ return (_jsx(NextLink, { href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true, children: _jsx(Link, __assign({ ref: ref }, props)) }));
8
+ });
9
+ export default Link;
@@ -1,11 +1,8 @@
1
1
  import type { Simplify } from "@koine/utils";
2
2
  import type { WithComponents } from "@koine/react/helpers";
3
3
  type OwnProps = {
4
- /** @default 0.3 */
5
4
  startAt?: number;
6
- /** @default true */
7
5
  showOnShallow?: boolean;
8
- /** @default 200 */
9
6
  stopDelayMs?: number;
10
7
  };
11
8
  export type Components = {
@@ -2,50 +2,38 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useRouter } from "next/router";
4
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();
7
- // const [progress, setProgress] = useState(0);
8
- const [running, setRunning] = useState(false);
9
- const timer = useRef(null);
10
- const routeChangeStart = useCallback((_, { shallow })=>{
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;
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;
11
12
  if (!shallow || showOnShallow) {
12
- // setProgress(startAt);
13
13
  setRunning(true);
14
14
  }
15
- }, [
16
- showOnShallow
17
- ]);
18
- const routeChangeEnd = useCallback((_, { shallow })=>{
15
+ }, [showOnShallow]);
16
+ var routeChangeEnd = useCallback(function (_, _a) {
17
+ var shallow = _a.shallow;
19
18
  if (!shallow || showOnShallow) {
20
19
  if (timer.current) {
21
20
  clearTimeout(timer.current);
22
21
  }
23
- timer.current = setTimeout(()=>{
24
- // setProgress(100);
22
+ timer.current = setTimeout(function () {
25
23
  setRunning(false);
26
24
  }, stopDelayMs);
27
25
  }
28
- }, [
29
- showOnShallow,
30
- stopDelayMs,
31
- timer
32
- ]);
33
- useEffect(()=>{
26
+ }, [showOnShallow, stopDelayMs, timer]);
27
+ useEffect(function () {
34
28
  events.on("routeChangeStart", routeChangeStart);
35
29
  events.on("routeChangeComplete", routeChangeEnd);
36
30
  events.on("routeChangeError", routeChangeEnd);
37
- return ()=>{
31
+ return function () {
38
32
  events.off("routeChangeStart", routeChangeStart);
39
33
  events.off("routeChangeComplete", routeChangeEnd);
40
34
  events.off("routeChangeError", routeChangeEnd);
41
35
  };
42
- }, [
43
- events,
44
- routeChangeStart,
45
- routeChangeEnd
46
- ]);
47
- return /*#__PURE__*/ _jsx(Overlay, {
48
- running: running
49
- });
36
+ }, [events, routeChangeStart, routeChangeEnd]);
37
+ return _jsx(Overlay, { running: running });
50
38
  };
51
39
  export default NextProgress;
package/12/Seo.d.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  import type { NextSeoProps } from "next-seo/lib/types";
2
- import { type LinkTag, type MetaTag } from "./seoBuildTags";
3
- import type { SeoData } from "./types-seo";
2
+ import { type LinkTag, type MetaTag } from "./seoBuildTags.js";
3
+ import type { SeoData } from "./types-seo.js";
4
4
  type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
5
5
  image?: string;
6
6
  };
7
- /**
8
- * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L395
9
- */
10
7
  export type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLinkTags" | "mobileAlternate" | "robotsProps"> & {
11
8
  metaTags?: ReadonlyArray<MetaTag>;
12
9
  linkTags?: ReadonlyArray<LinkTag>;
@@ -16,26 +13,5 @@ export type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLink
16
13
  openGraph?: SeoPropsOpenGraph;
17
14
  og?: SeoPropsOpenGraph;
18
15
  };
19
- /**
20
- * Adapted from [garmeeh/next-seo](https://github.com/garmeeh/next-seo)
21
- *
22
- * See also:
23
- * - https://github.com/catnose99/next-head-seo
24
- * - https://nextjs.org/docs/api-reference/next/head
25
- *
26
- * NB: on the homepage you usually want to customize the `titleTemplate` to avoid
27
- * doubled app name. Assuming your default seo configuration is something like:
28
- *
29
- * ```js
30
- * {
31
- * titleTemplate: "%s | MyApp"
32
- * }
33
- * ```
34
- *
35
- * On the homepage you migh want to override it, e.g.:
36
- * ```js
37
- * <Seo title="MyApp | Some description" titleTemplate="%s" />
38
- * ```
39
- */
40
16
  export declare const Seo: (props: SeoProps) => import("react/jsx-runtime").JSX.Element;
41
17
  export default Seo;
package/12/Seo.js ADDED
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Head from "next/head";
3
+ import { seoBuildTags } from "./seoBuildTags.js";
4
+ export var Seo = function (props) {
5
+ return _jsx(Head, { children: seoBuildTags(props) });
6
+ };
7
+ export default Seo;
@@ -1,8 +1,5 @@
1
1
  import type { DefaultSeoProps } from "next-seo/lib/types";
2
- import { type LinkTag, type MetaTag } from "./seoBuildTags";
3
- /**
4
- * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
5
- */
2
+ import { type LinkTag, type MetaTag } from "./seoBuildTags.js";
6
3
  export type SeoDefaultsProps = Omit<DefaultSeoProps, "additionalMetaTags" | "additionalLinkTags" | "dangerouslySetAllPagesToNoIndex" | "dangerouslySetAllPagesToNoFollow" | "defaultOpenGraphImageWidth" | "defaultOpenGraphImageHeight" | "defaultOpenGraphVideoWidth" | "defaultOpenGraphVideoHeight" | "mobileAlternate" | "robotsProps"> & {
7
4
  metaTags?: ReadonlyArray<MetaTag>;
8
5
  linkTags?: ReadonlyArray<LinkTag>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Head from "next/head";
3
+ import { seoBuildTags } from "./seoBuildTags.js";
4
+ export var SeoDefaults = function (props) {
5
+ return _jsx(Head, { children: seoBuildTags(props) });
6
+ };
7
+ export default SeoDefaults;
package/12/T.d.ts CHANGED
@@ -1,16 +1,10 @@
1
- /// <reference types="react" />
2
1
  import type { TransProps } from "next-translate";
3
- import type { TranslateNamespace, TranslationsAllPaths, TranslationsPaths } from "./types-i18n";
2
+ import type { TranslateNamespace, TranslationsAllPaths, TranslationsPaths } from "./types-i18n.js";
4
3
  export type TProps<TNamespace extends TranslateNamespace | undefined = undefined> = (Omit<TransProps, "i18nKey" | "ns"> & {
5
4
  i18nKey: TranslationsAllPaths;
6
5
  }) | (Omit<TransProps, "i18nKey" | "ns"> & {
7
6
  ns: TNamespace;
8
7
  i18nKey: TranslationsPaths<TNamespace>;
9
8
  });
10
- /**
11
- * **NOTE**: To make typescript work nicely here make sure to enable
12
- * [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
13
- * in your `tsconfig.json` file.
14
- */
15
9
  export declare const T: <TNamespace extends "~" | undefined = undefined>(props: TProps<TNamespace>) => import("react").ReactElement<TProps<TNamespace>, string | import("react").JSXElementConstructor<any>>;
16
10
  export default T;
package/12/T.js ADDED
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { __assign } from "tslib";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import Trans from "next-translate/Trans";
5
+ export var T = function (props) {
6
+ return (_jsx(Trans, __assign({}, props)));
7
+ };
8
+ export default T;
@@ -1,4 +1,4 @@
1
1
  "use client";
2
2
  import _TransText from "next-translate/TransText";
3
- export const TransText = _TransText;
3
+ export var TransText = _TransText;
4
4
  export default TransText;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Head from "next/head";
3
+ export var AppHead = function () {
4
+ return (_jsx(Head, { children: _jsx("meta", { name: "viewport", content: "width=device-width" }) }));
5
+ };
6
+ export default AppHead;
@@ -2,34 +2,16 @@ import type { HTMLMotionProps } from "framer-motion";
2
2
  import type { AppProps as NextAppProps } from "next/app";
3
3
  import React from "react";
4
4
  import type { MotionProviderFeatures } from "@koine/react/m";
5
- import type { NextProgressProps } from "../NextProgress";
6
- import type { SeoDefaultsProps } from "../SeoDefaults";
5
+ import type { NextProgressProps } from "../NextProgress.js";
6
+ import type { SeoDefaultsProps } from "../SeoDefaults.js";
7
7
  export type AppMainBaseProps = NextAppProps & {
8
- /**
9
- * A wrapping layout component
10
- */
11
8
  Layout: React.FC<Record<string, unknown>>;
12
- /**
13
- * A Progress' Overlay component
14
- */
15
9
  ProgressOverlay?: NextProgressProps["Overlay"];
16
- /**
17
- * Seo site wide default configuration
18
- */
19
10
  seo?: SeoDefaultsProps;
20
- /**
21
- * JSX to render just after SEO
22
- */
23
11
  pre?: React.ReactNode;
24
- /**
25
- * JSX to render just at the end of the markup
26
- */
27
12
  post?: React.ReactNode;
28
13
  };
29
14
  export type AppMainFramerProps = {
30
15
  motion: MotionProviderFeatures;
31
- /**
32
- * Default layout transition, by default it is a simple fade in/out
33
- */
34
16
  transition?: Omit<HTMLMotionProps<"div">, "key">;
35
17
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,4 @@
1
- import type { AppMainBaseProps } from "../AppMain";
1
+ import type { AppMainBaseProps } from "../AppMain.js";
2
2
  export type AppMainProps = Omit<AppMainBaseProps, "ProgressOverlay">;
3
- /**
4
- * App main
5
- *
6
- * It does not imply any specific styling or animation solution
7
- */
8
3
  export declare const AppMain: ({ Component, pageProps, Layout, seo, pre, post, }: AppMainProps) => import("react/jsx-runtime").JSX.Element;
9
4
  export default AppMain;
@@ -0,0 +1,9 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { SeoDefaults } from "../../SeoDefaults.js";
5
+ export var AppMain = function (_a) {
6
+ var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, seo = _a.seo, pre = _a.pre, post = _a.post;
7
+ return (_jsxs(React.Fragment, { children: [_jsx(SeoDefaults, __assign({}, seo)), pre, _jsx(Layout, { children: _jsx(Component, __assign({}, pageProps)) }), post] }));
8
+ };
9
+ export default AppMain;
@@ -1,11 +1,8 @@
1
1
  import { type AppProps as NextAppProps } from "next/app";
2
2
  import React from "react";
3
- import { type ThemeProviderProps } from "../../ThemeProvider";
3
+ import { type ThemeProviderProps } from "../../../ThemeProvider.js";
4
4
  export type AppThemeProps = React.PropsWithChildren<NextAppProps & {
5
5
  theme: ThemeProviderProps["defaultTheme"];
6
6
  }>;
7
- /**
8
- * App theme with vanilla class based theme (good for `tailwindcss`)
9
- */
10
7
  export declare const AppTheme: ({ theme, children }: AppThemeProps) => import("react/jsx-runtime").JSX.Element;
11
8
  export default AppTheme;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ThemeProvider } from "../../../ThemeProvider.js";
3
+ export var AppTheme = function (_a) {
4
+ var theme = _a.theme, children = _a.children;
5
+ return (_jsx(ThemeProvider, { defaultTheme: theme, attribute: "class", children: children }));
6
+ };
7
+ export default AppTheme;
@@ -1,11 +1,8 @@
1
1
  import type { AppProps } from "next/app";
2
- import { type AppMainProps } from "../AppMain";
3
- import { type AppThemeProps } from "../AppTheme";
2
+ import { type AppMainProps } from "../AppMain.js";
3
+ import { type AppThemeProps } from "../AppTheme.js";
4
4
  export type NextAppProps = AppProps<{
5
5
  session: any;
6
6
  }> & AppThemeProps & AppMainProps;
7
- /**
8
- * App with authentication provided by `next-auth`
9
- */
10
7
  export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
11
8
  export default NextApp;
@@ -0,0 +1,10 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { SessionProvider } from "next-auth/react";
4
+ import { AppHead } from "../../AppHead.js";
5
+ import { AppMain } from "../AppMain.js";
6
+ import { AppTheme } from "../AppTheme.js";
7
+ export var NextApp = function (props) {
8
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) })) })] }));
9
+ };
10
+ export default NextApp;
@@ -1,54 +1,6 @@
1
1
  import { AppProps } from "next/app";
2
- import { type AppMainProps } from "./AppMain";
3
- import { type AppThemeProps } from "./AppTheme";
2
+ import { type AppMainProps } from "./AppMain.js";
3
+ import { type AppThemeProps } from "./AppTheme.js";
4
4
  export type NextAppProps = AppProps & AppThemeProps & AppMainProps;
5
- /**
6
- * App
7
- *
8
- * @example
9
- *
10
- * ```tsx
11
- * import { NextApp, NextAppProps } from "@koine/next/app/css/auth";
12
- * import { Favicon, AnalyticsGoogle } from "@koine/next";
13
- * import { theme } from "src/helpers/theme";
14
- * import { Layout } from "src/components/Layout";
15
- * // import "@fontsource/myfont/800.css";
16
- * // import "src/helpers/theme.css";
17
- *
18
- * const motion = () => import("@koine/react/m/max").then((m) => m.default);
19
- *
20
- * export default function App(props: NextAppProps) {
21
- * return (
22
- * <NextApp
23
- * {...props}
24
- * Layout={Layout}
25
- * theme={theme}
26
- * seo={{
27
- * titleTemplate: "%s | MyApp",
28
- * defaultTitle: "MyApp",
29
- * openGraph: {
30
- * type: "website",
31
- * locale: "en_US",
32
- * url: "https://myapp.com/",
33
- * site_name: "MyApp",
34
- * },
35
- * twitter: {
36
- * handle: "@MklrNl",
37
- * site: "@MyApp",
38
- * cardType: "summary_large_image",
39
- * },
40
- * }}
41
- * pre={
42
- * <>
43
- * <AnalyticsGoogle id="UA-xxxxxxxx-x" />
44
- * <Favicon name="MyApp" color="#000000" />
45
- * </>
46
- * }
47
- * />
48
- * );
49
- * }
50
- *
51
- * ```
52
- */
53
5
  export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
54
6
  export default NextApp;
@@ -0,0 +1,9 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AppHead } from "../AppHead.js";
4
+ import { AppMain } from "./AppMain.js";
5
+ import { AppTheme } from "./AppTheme.js";
6
+ export var NextApp = function (props) {
7
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
8
+ };
9
+ export default NextApp;
package/12/app/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./AppHead";
2
- export * from "./AppMain";
1
+ export * from "./AppHead.js";
2
+ export * from "./AppMain.js";
@@ -0,0 +1,2 @@
1
+ export * from "./AppHead.js";
2
+ export * from "./AppMain.js";
@@ -1,11 +1,4 @@
1
- import type { AppMainBaseProps, AppMainFramerProps } from "../AppMain";
1
+ import type { AppMainBaseProps, AppMainFramerProps } from "../AppMain.js";
2
2
  export type AppMainProps = AppMainBaseProps & AppMainFramerProps;
3
- /**
4
- * App main
5
- *
6
- * It implies a setup for `styled-components` and `framer-motion` libraries.
7
- *
8
- * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
9
- */
10
3
  export declare const AppMain: ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition, pre, post, }: AppMainProps) => import("react/jsx-runtime").JSX.Element;
11
4
  export default AppMain;
@@ -0,0 +1,18 @@
1
+ import { __assign } from "tslib";
2
+ import { createElement as _createElement } from "react";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { AnimatePresence, m } from "framer-motion";
5
+ import { useRouter } from "next/router";
6
+ import { MotionProvider } from "@koine/react/m";
7
+ import { NextProgress } from "../../NextProgress.js";
8
+ import { SeoDefaults } from "../../SeoDefaults.js";
9
+ export var AppMain = function (_a) {
10
+ var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, ProgressOverlay = _a.ProgressOverlay, seo = _a.seo, motion = _a.motion, _b = _a.transition, transition = _b === void 0 ? {
11
+ initial: { opacity: 0 },
12
+ animate: { opacity: 1 },
13
+ exit: { opacity: 0 },
14
+ } : _b, pre = _a.pre, post = _a.post;
15
+ var pathname = useRouter().pathname;
16
+ return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, __assign({}, seo)), pre, _jsxs(MotionProvider, { features: motion, children: [ProgressOverlay && _jsx(NextProgress, { Overlay: ProgressOverlay }), _jsx(Layout, { children: _jsx(AnimatePresence, { exitBeforeEnter: true, initial: false, children: _jsx(m.div, __assign({}, transition, { children: _createElement(Component, __assign({}, pageProps, { key: pathname })) }), pathname) }) })] }), post] }));
17
+ };
18
+ export default AppMain;
@@ -2,13 +2,7 @@ import { type AppProps as NextAppProps } from "next/app";
2
2
  import React from "react";
3
3
  import { Theme } from "@koine/react/sc";
4
4
  export type AppThemeProps = React.PropsWithChildren<NextAppProps & {
5
- /**
6
- * A theme object
7
- */
8
5
  theme: Theme;
9
6
  }>;
10
- /**
11
- * App theme with `styled-components`
12
- */
13
7
  export declare const AppTheme: ({ theme, children }: AppThemeProps) => import("react/jsx-runtime").JSX.Element;
14
8
  export default AppTheme;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ThemeProvider } from "styled-components";
3
+ import { StylesGlobal } from "@koine/react/sc";
4
+ export var AppTheme = function (_a) {
5
+ var theme = _a.theme, children = _a.children;
6
+ return (_jsxs(ThemeProvider, { theme: theme, children: [_jsx(StylesGlobal, {}), children] }));
7
+ };
8
+ export default AppTheme;
@@ -1,11 +1,8 @@
1
1
  import type { AppProps } from "next/app";
2
- import { type AppMainProps } from "../AppMain";
3
- import { type AppThemeProps } from "../AppTheme";
2
+ import { type AppMainProps } from "../AppMain.js";
3
+ import { type AppThemeProps } from "../AppTheme.js";
4
4
  export type NextAppProps = AppProps<{
5
5
  session: any;
6
6
  }> & AppThemeProps & AppMainProps;
7
- /**
8
- * App with authentication provided by `next-auth`
9
- */
10
7
  export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
11
8
  export default NextApp;
@@ -0,0 +1,10 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { SessionProvider } from "next-auth/react";
4
+ import { AppHead } from "../../AppHead.js";
5
+ import { AppMain } from "../AppMain.js";
6
+ import { AppTheme } from "../AppTheme.js";
7
+ export var NextApp = function (props) {
8
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) })) })] }));
9
+ };
10
+ export default NextApp;
@@ -1,56 +1,6 @@
1
1
  import type { AppProps } from "next/app";
2
- import { type AppMainProps } from "./AppMain";
3
- import { type AppThemeProps } from "./AppTheme";
2
+ import { type AppMainProps } from "./AppMain.js";
3
+ import { type AppThemeProps } from "./AppTheme.js";
4
4
  export type NextAppProps = AppProps & AppThemeProps & AppMainProps;
5
- /**
6
- * App
7
- *
8
- * @example
9
- *
10
- * ```tsx
11
- * import { NextApp, NextAppProps } from "@koine/next/app/sc/auth";
12
- * import { Favicon, AnalyticsGoogle } from "@koine/next";
13
- * import { theme } from "src/helpers/theme";
14
- * import { Layout, ProgressOverlay } from "src/components/Layout";
15
- * // import "@fontsource/myfont/800.css";
16
- * // import "src/helpers/theme.css";
17
- *
18
- * const motion = () => import("@koine/react/m/max").then((m) => m.default);
19
- *
20
- * export default function App(props: NextAppProps) {
21
- * return (
22
- * <NextApp
23
- * {...props}
24
- * Layout={Layout}
25
- * ProgressOverlay={ProgressOverlay}
26
- * theme={theme}
27
- * motion={motion}
28
- * seo={{
29
- * titleTemplate: "%s | MyApp",
30
- * defaultTitle: "MyApp",
31
- * openGraph: {
32
- * type: "website",
33
- * locale: "en_US",
34
- * url: "https://myapp.com/",
35
- * site_name: "MyApp",
36
- * },
37
- * twitter: {
38
- * handle: "@MklrNl",
39
- * site: "@MyApp",
40
- * cardType: "summary_large_image",
41
- * },
42
- * }}
43
- * pre={
44
- * <>
45
- * <AnalyticsGoogle id="UA-xxxxxxxx-x" />
46
- * <Favicon name="MyApp" color="#000000" />
47
- * </>
48
- * }
49
- * />
50
- * );
51
- * }
52
- *
53
- * ```
54
- */
55
5
  export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
56
6
  export default NextApp;