@koine/next 1.0.8 → 1.0.9

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 (211) hide show
  1. package/Analytics/AnalyticsGoogle.d.ts +0 -0
  2. package/Analytics/AnalyticsGoogle.js +2 -2
  3. package/Analytics/index.d.ts +0 -0
  4. package/Analytics/index.js +0 -0
  5. package/Analytics/package.json +6 -0
  6. package/Auth/helpers.d.ts +0 -0
  7. package/Auth/helpers.js +0 -0
  8. package/Auth/index.d.ts +0 -0
  9. package/Auth/index.js +0 -0
  10. package/Auth/package.json +6 -0
  11. package/Auth/useLogin.d.ts +1 -1
  12. package/Auth/useLogin.js +4 -1
  13. package/Auth/useLoginUrl.d.ts +0 -0
  14. package/Auth/useLoginUrl.js +0 -0
  15. package/Auth/useLogout.d.ts +0 -0
  16. package/Auth/useLogout.js +0 -0
  17. package/Favicon/Favicon.d.ts +0 -0
  18. package/Favicon/Favicon.js +1 -1
  19. package/Favicon/index.d.ts +0 -0
  20. package/Favicon/index.js +0 -0
  21. package/Favicon/package.json +6 -0
  22. package/Forms/index.d.ts +0 -0
  23. package/Forms/index.js +0 -0
  24. package/Forms/package.json +6 -0
  25. package/Forms/useForm.d.ts +0 -0
  26. package/Forms/useForm.js +7 -3
  27. package/Forms/useSubmit.d.ts +0 -0
  28. package/Forms/useSubmit.js +10 -7
  29. package/Head/Head.d.ts +0 -0
  30. package/Head/Head.js +0 -0
  31. package/Head/index.d.ts +0 -0
  32. package/Head/index.js +0 -0
  33. package/Head/package.json +6 -0
  34. package/I18n/I18n.d.ts +3 -7
  35. package/I18n/I18n.js +2 -14
  36. package/I18n/index.d.ts +0 -0
  37. package/I18n/index.js +0 -0
  38. package/I18n/package.json +6 -0
  39. package/Img/Img.d.ts +4 -4
  40. package/Img/Img.js +2 -4
  41. package/Img/index.d.ts +0 -0
  42. package/Img/index.js +0 -0
  43. package/Img/package.json +6 -0
  44. package/Link/Link.d.ts +4 -3
  45. package/Link/Link.js +2 -5
  46. package/Link/index.d.ts +0 -0
  47. package/Link/index.js +0 -0
  48. package/Link/package.json +6 -0
  49. package/NextProgress/NextProgress.d.ts +20 -9
  50. package/NextProgress/NextProgress.js +2 -3
  51. package/NextProgress/index.d.ts +2 -1
  52. package/NextProgress/index.js +1 -1
  53. package/NextProgress/package.json +6 -0
  54. package/README.md +0 -0
  55. package/Seo/Seo.d.ts +0 -0
  56. package/Seo/Seo.js +0 -0
  57. package/Seo/SeoDefaults.d.ts +0 -0
  58. package/Seo/SeoDefaults.js +0 -0
  59. package/Seo/helpers.d.ts +0 -0
  60. package/Seo/helpers.js +17 -19
  61. package/Seo/index.d.ts +0 -0
  62. package/Seo/index.js +0 -0
  63. package/Seo/package.json +6 -0
  64. package/Theme/Theme.d.ts +3 -3
  65. package/Theme/Theme.js +18 -18
  66. package/Theme/index.d.ts +0 -0
  67. package/Theme/index.js +0 -0
  68. package/Theme/package.json +6 -0
  69. package/app/AppHead.d.ts +1 -2
  70. package/app/AppHead.js +2 -2
  71. package/app/AppMain.d.ts +35 -0
  72. package/app/AppMain.js +1 -0
  73. package/app/css/AppMain.d.ts +8 -0
  74. package/app/{AppMain--vanilla.js → css/AppMain.js} +3 -3
  75. package/app/css/AppTheme.d.ts +10 -0
  76. package/app/{AppTheme--vanilla.js → css/AppTheme.js} +3 -3
  77. package/app/css/auth/index.d.ts +9 -0
  78. package/app/css/auth/index.js +13 -0
  79. package/app/css/auth/package.json +6 -0
  80. package/app/css/index.d.ts +54 -0
  81. package/app/css/index.js +57 -0
  82. package/app/css/package.json +6 -0
  83. package/app/em/AppMain.d.ts +10 -0
  84. package/app/em/AppMain.js +22 -0
  85. package/app/{AppTheme--emotion.d.ts → em/AppTheme.d.ts} +3 -3
  86. package/app/{AppTheme--emotion.js → em/AppTheme.js} +5 -5
  87. package/app/em/auth/index.d.ts +9 -0
  88. package/app/em/auth/index.js +13 -0
  89. package/app/em/auth/package.json +6 -0
  90. package/app/em/index.d.ts +9 -0
  91. package/app/em/index.js +12 -0
  92. package/app/em/package.json +6 -0
  93. package/app/index.d.ts +1 -10
  94. package/app/index.js +1 -10
  95. package/app/package.json +6 -0
  96. package/app/sc/AppMain.d.ts +10 -0
  97. package/app/sc/AppMain.js +22 -0
  98. package/app/sc/AppTheme.d.ts +13 -0
  99. package/app/sc/AppTheme.js +9 -0
  100. package/app/sc/auth/index.d.ts +9 -0
  101. package/app/sc/auth/index.js +13 -0
  102. package/app/sc/auth/package.json +6 -0
  103. package/app/sc/index.d.ts +56 -0
  104. package/app/sc/index.js +59 -0
  105. package/app/sc/package.json +6 -0
  106. package/config/index.d.ts +14 -1
  107. package/config/index.js +68 -38
  108. package/config/package.json +6 -0
  109. package/document/Document.d.ts +7 -2
  110. package/document/Document.js +8 -3
  111. package/document/css/index.d.ts +22 -0
  112. package/document/css/index.js +30 -0
  113. package/document/css/package.json +6 -0
  114. package/document/em/index.d.ts +16 -0
  115. package/document/{Document--emotion.js → em/index.js} +24 -11
  116. package/document/em/package.json +6 -0
  117. package/document/index.d.ts +2 -4
  118. package/document/index.js +2 -4
  119. package/document/package.json +6 -0
  120. package/document/{Document--sc.d.ts → sc/index.d.ts} +11 -2
  121. package/document/sc/index.js +44 -0
  122. package/document/sc/package.json +6 -0
  123. package/index.d.ts +0 -3
  124. package/index.js +0 -3
  125. package/node/Analytics/AnalyticsGoogle.js +42 -0
  126. package/node/Analytics/index.js +4 -0
  127. package/node/Auth/helpers.js +26 -0
  128. package/node/Auth/index.js +7 -0
  129. package/node/Auth/useLogin.js +54 -0
  130. package/node/Auth/useLoginUrl.js +15 -0
  131. package/node/Auth/useLogout.js +56 -0
  132. package/node/Favicon/Favicon.js +9 -0
  133. package/node/Favicon/index.js +4 -0
  134. package/node/Forms/index.js +5 -0
  135. package/node/Forms/useForm.js +41 -0
  136. package/node/Forms/useSubmit.js +27 -0
  137. package/node/Head/Head.js +8 -0
  138. package/node/Head/index.js +4 -0
  139. package/node/I18n/I18n.js +82 -0
  140. package/node/I18n/index.js +4 -0
  141. package/node/Img/Img.js +34 -0
  142. package/node/Img/index.js +4 -0
  143. package/node/Link/Link.js +13 -0
  144. package/node/Link/index.js +4 -0
  145. package/node/NextProgress/NextProgress.js +41 -0
  146. package/node/NextProgress/index.js +5 -0
  147. package/node/Seo/Seo.js +12 -0
  148. package/node/Seo/SeoDefaults.js +16 -0
  149. package/node/Seo/helpers.js +115 -0
  150. package/node/Seo/index.js +15 -0
  151. package/node/Theme/Theme.js +241 -0
  152. package/node/Theme/index.js +4 -0
  153. package/node/app/AppHead.js +10 -0
  154. package/node/app/AppMain.js +2 -0
  155. package/node/app/css/AppMain.js +16 -0
  156. package/node/app/css/AppTheme.js +16 -0
  157. package/node/app/css/auth/index.js +18 -0
  158. package/node/app/css/index.js +62 -0
  159. package/node/app/em/AppMain.js +26 -0
  160. package/node/app/em/AppTheme.js +22 -0
  161. package/node/app/em/auth/index.js +18 -0
  162. package/node/app/em/index.js +17 -0
  163. package/node/app/index.js +5 -0
  164. package/node/app/sc/AppMain.js +26 -0
  165. package/node/app/sc/AppTheme.js +13 -0
  166. package/node/app/sc/auth/index.js +18 -0
  167. package/node/app/sc/index.js +64 -0
  168. package/node/config/index.js +184 -0
  169. package/node/document/Document.js +24 -0
  170. package/node/document/css/index.js +35 -0
  171. package/node/document/em/index.js +73 -0
  172. package/node/document/index.js +7 -0
  173. package/node/document/sc/index.js +49 -0
  174. package/node/index.js +15 -0
  175. package/node/utils/api.js +38 -0
  176. package/node/utils/emotion-cache.js +13 -0
  177. package/node/utils/index.js +32 -0
  178. package/package.json +2 -35
  179. package/typings.d.ts +10 -7
  180. package/utils/api.d.ts +0 -0
  181. package/utils/api.js +8 -6
  182. package/utils/emotion-cache.d.ts +0 -0
  183. package/utils/emotion-cache.js +0 -0
  184. package/utils/index.d.ts +0 -1
  185. package/utils/index.js +0 -1
  186. package/utils/package.json +6 -0
  187. package/app/App--emotion.d.ts +0 -10
  188. package/app/App--emotion.js +0 -11
  189. package/app/App--sc.d.ts +0 -10
  190. package/app/App--sc.js +0 -11
  191. package/app/App--vanilla.d.ts +0 -10
  192. package/app/App--vanilla.js +0 -11
  193. package/app/AppAuth--emotion.d.ts +0 -10
  194. package/app/AppAuth--emotion.js +0 -12
  195. package/app/AppAuth--sc.d.ts +0 -10
  196. package/app/AppAuth--sc.js +0 -12
  197. package/app/AppMain--emotion.d.ts +0 -34
  198. package/app/AppMain--emotion.js +0 -27
  199. package/app/AppMain--sc.d.ts +0 -34
  200. package/app/AppMain--sc.js +0 -27
  201. package/app/AppMain--vanilla.d.ts +0 -27
  202. package/app/AppTheme--sc.d.ts +0 -13
  203. package/app/AppTheme--sc.js +0 -9
  204. package/app/AppTheme--vanilla.d.ts +0 -10
  205. package/app/motion-features.d.ts +0 -2
  206. package/app/motion-features.js +0 -2
  207. package/document/Document--emotion.d.ts +0 -5
  208. package/document/Document--sc.js +0 -33
  209. package/document/Document--vanilla.d.ts +0 -11
  210. package/document/Document--vanilla.js +0 -20
  211. package/index.umd.js +0 -6621
package/Theme/Theme.d.ts CHANGED
@@ -21,7 +21,7 @@ export declare type UseThemeProps = {
21
21
  /** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
22
22
  systemTheme?: "dark" | "light";
23
23
  };
24
- export declare type ThemeProviderProps = {
24
+ export declare type ThemeProviderProps = React.PropsWithChildren<{
25
25
  /** List of all available theme names */
26
26
  themes?: string[];
27
27
  /** Forced theme name for the current page */
@@ -40,7 +40,7 @@ export declare type ThemeProviderProps = {
40
40
  value?: ValueObject;
41
41
  /** Nonce string to pass to the inline script for CSP headers */
42
42
  nonce?: string;
43
- };
43
+ }>;
44
44
  export declare const useTheme: () => UseThemeProps;
45
- export declare const ThemeProvider: React.FC<ThemeProviderProps>;
45
+ export declare const ThemeProvider: ({ forcedTheme, disableTransitionOnChange, enableSystem, enableColorScheme, themes, defaultTheme, attribute, value, children, nonce, }: ThemeProviderProps) => JSX.Element;
46
46
  export {};
package/Theme/Theme.js CHANGED
@@ -22,7 +22,7 @@ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false,
22
22
  const attrs = !value ? themes : Object.values(value);
23
23
  const applyTheme = useCallback((theme) => {
24
24
  let resolved = theme;
25
- if (isServer)
25
+ if (isServer || !resolved)
26
26
  return;
27
27
  // If theme is system, resolve it before setting theme
28
28
  if (theme === "system" && enableSystem) {
@@ -47,13 +47,13 @@ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false,
47
47
  if (enableColorScheme) {
48
48
  const fallback = colorSchemes.includes(defaultTheme)
49
49
  ? defaultTheme
50
- : null;
50
+ : "";
51
51
  const colorScheme = colorSchemes.includes(resolved)
52
52
  ? resolved
53
53
  : fallback;
54
54
  d.style.colorScheme = colorScheme;
55
55
  }
56
- enable === null || enable === void 0 ? void 0 : enable();
56
+ enable?.();
57
57
  }, [
58
58
  attribute,
59
59
  attrs,
@@ -103,28 +103,28 @@ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false,
103
103
  }, [defaultTheme, setTheme]);
104
104
  // Whenever theme or forcedTheme changes, apply it
105
105
  useEffect(() => {
106
- applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
106
+ applyTheme(forcedTheme ?? theme);
107
107
  }, [applyTheme, forcedTheme, theme]);
108
- return (_jsxs(ThemeContext.Provider, Object.assign({ value: {
108
+ return (_jsxs(ThemeContext.Provider, { value: {
109
109
  theme,
110
110
  setTheme,
111
111
  forcedTheme,
112
112
  resolvedTheme: theme === "system" ? resolvedTheme : theme,
113
113
  themes: enableSystem ? [...themes, "system"] : themes,
114
114
  systemTheme: (enableSystem ? resolvedTheme : undefined),
115
- } }, { children: [_jsx(ThemeScript, Object.assign({}, {
116
- forcedTheme,
117
- disableTransitionOnChange,
118
- enableSystem,
119
- enableColorScheme,
120
- themes,
121
- defaultTheme,
122
- attribute,
123
- value,
124
- children,
125
- attrs,
126
- nonce,
127
- })), children] })));
115
+ }, children: [_jsx(ThemeScript, { ...{
116
+ forcedTheme,
117
+ disableTransitionOnChange,
118
+ enableSystem,
119
+ enableColorScheme,
120
+ themes,
121
+ defaultTheme,
122
+ attribute,
123
+ value,
124
+ children,
125
+ attrs,
126
+ nonce,
127
+ } }), children] }));
128
128
  };
129
129
  const ThemeScript = memo(({ forcedTheme, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce, }) => {
130
130
  const defaultSystem = defaultTheme === "system";
package/Theme/index.d.ts CHANGED
File without changes
package/Theme/index.js CHANGED
File without changes
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/Theme/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/app/AppHead.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import React from "react";
2
1
  export declare type AppHeadProps = unknown;
3
- export declare const AppHead: React.FC<AppHeadProps>;
2
+ export declare const AppHead: () => JSX.Element;
package/app/AppHead.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Head from "next/head";
3
- export const AppHead = (props) => {
4
- return (_jsx(Head, Object.assign({}, props, { children: _jsx("meta", { name: "viewport", content: "width=device-width" }) })));
3
+ export const AppHead = () => {
4
+ return (_jsx(Head, { children: _jsx("meta", { name: "viewport", content: "width=device-width" }) }));
5
5
  };
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import type { AppProps as NextAppProps } from "next/app";
3
+ import type { HTMLMotionProps } from "framer-motion";
4
+ import type { SeoDefaultsProps } from "../Seo";
5
+ import type { NextProgressProps } from "../NextProgress";
6
+ import type { MotionProviderFeatures } from "@koine/react/m";
7
+ export declare type AppMainBaseProps = NextAppProps & {
8
+ /**
9
+ * A wrapping layout component
10
+ */
11
+ Layout: React.FC<Record<string, unknown>>;
12
+ /**
13
+ * A Progress' Overlay component
14
+ */
15
+ ProgressOverlay?: NextProgressProps["Overlay"];
16
+ /**
17
+ * Seo site wide default configuration
18
+ */
19
+ seo?: SeoDefaultsProps;
20
+ /**
21
+ * JSX to render just after SEO
22
+ */
23
+ pre?: React.ReactNode;
24
+ /**
25
+ * JSX to render just at the end of the markup
26
+ */
27
+ post?: React.ReactNode;
28
+ };
29
+ export declare type AppMainFramerProps = {
30
+ motion: MotionProviderFeatures;
31
+ /**
32
+ * Default layout transition, by default it is a simple fade in/out
33
+ */
34
+ transition?: Omit<HTMLMotionProps<"div">, "key">;
35
+ };
package/app/AppMain.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { AppMainBaseProps } from "../AppMain";
2
+ export declare type AppMainProps = Omit<AppMainBaseProps, "ProgressOverlay">;
3
+ /**
4
+ * App main
5
+ *
6
+ * It does not imply any specific styling or animation solution
7
+ */
8
+ export declare const AppMain: ({ Component, pageProps, Layout, seo, pre, post, }: AppMainProps) => JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { SeoDefaults } from "../Seo";
3
+ import { SeoDefaults } from "../../Seo";
4
4
  /**
5
5
  * App main
6
6
  *
7
7
  * It does not imply any specific styling or animation solution
8
8
  */
9
- export const AppMainVanilla = ({ Component, pageProps, Layout, seo, pre, post, }) => {
10
- return (_jsxs(React.Fragment, { children: [_jsx(SeoDefaults, Object.assign({}, seo)), pre, _jsx(Layout, { children: _jsx(Component, Object.assign({}, pageProps)) }), post] }));
9
+ export const AppMain = ({ Component, pageProps, Layout, seo, pre, post, }) => {
10
+ return (_jsxs(React.Fragment, { children: [_jsx(SeoDefaults, { ...seo }), pre, _jsx(Layout, { children: _jsx(Component, { ...pageProps }) }), post] }));
11
11
  };
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { ThemeProviderProps } from "../../Theme";
4
+ export declare type AppThemeProps = React.PropsWithChildren<NextAppProps & {
5
+ theme: ThemeProviderProps["defaultTheme"];
6
+ }>;
7
+ /**
8
+ * App theme with vanilla class based theme (good for `tailwindcss`)
9
+ */
10
+ export declare const AppTheme: ({ theme, children }: AppThemeProps) => JSX.Element;
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react";
3
- import { ThemeProvider } from "../Theme";
3
+ import { ThemeProvider } from "../../Theme";
4
4
  /**
5
5
  * App theme with vanilla class based theme (good for `tailwindcss`)
6
6
  */
7
- export const AppThemeVanilla = ({ theme, children, }) => {
7
+ export const AppTheme = ({ theme, children }) => {
8
8
  // return (
9
9
  // <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
10
10
  // );
11
- return (_jsx(ThemeProvider, Object.assign({ defaultTheme: theme, attribute: "class" }, { children: children })));
11
+ return (_jsx(ThemeProvider, { defaultTheme: theme, attribute: "class", children: children }));
12
12
  };
@@ -0,0 +1,9 @@
1
+ import { AppProps } from "next/app";
2
+ import { AppThemeProps } from "../AppTheme";
3
+ import { AppMainProps } from "../AppMain";
4
+ export declare type NextAppProps = AppProps & AppThemeProps & AppMainProps;
5
+ /**
6
+ * App with authentication provided by `next-auth`
7
+ */
8
+ export declare const NextApp: (props: NextAppProps) => JSX.Element;
9
+ export default NextApp;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { SessionProvider } from "next-auth/react";
4
+ import { AppHead } from "../../AppHead";
5
+ import { AppTheme } from "../AppTheme";
6
+ import { AppMain } from "../AppMain";
7
+ /**
8
+ * App with authentication provided by `next-auth`
9
+ */
10
+ export const NextApp = (props) => {
11
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) }) })] }));
12
+ };
13
+ export default NextApp;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../../../node/app/css/auth/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,54 @@
1
+ import { AppProps } from "next/app";
2
+ import { AppThemeProps } from "./AppTheme";
3
+ import { AppMainProps } from "./AppMain";
4
+ export declare 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
+ export declare const NextApp: (props: NextAppProps) => JSX.Element;
54
+ export default NextApp;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { AppHead } from "../AppHead";
4
+ import { AppTheme } from "./AppTheme";
5
+ import { AppMain } from "./AppMain";
6
+ /**
7
+ * App
8
+ *
9
+ * @example
10
+ *
11
+ * ```tsx
12
+ * import { NextApp, NextAppProps } from "@koine/next/app/css/auth";
13
+ * import { Favicon, AnalyticsGoogle } from "@koine/next";
14
+ * import { theme } from "src/helpers/theme";
15
+ * import { Layout } from "src/components/Layout";
16
+ * // import "@fontsource/myfont/800.css";
17
+ * // import "src/helpers/theme.css";
18
+ *
19
+ * const motion = () => import("@koine/react/m/max").then((m) => m.default);
20
+ *
21
+ * export default function App(props: NextAppProps) {
22
+ * return (
23
+ * <NextApp
24
+ * {...props}
25
+ * Layout={Layout}
26
+ * theme={theme}
27
+ * seo={{
28
+ * titleTemplate: "%s | MyApp",
29
+ * defaultTitle: "MyApp",
30
+ * openGraph: {
31
+ * type: "website",
32
+ * locale: "en_US",
33
+ * url: "https://myapp.com/",
34
+ * site_name: "MyApp",
35
+ * },
36
+ * twitter: {
37
+ * handle: "@MklrNl",
38
+ * site: "@MyApp",
39
+ * cardType: "summary_large_image",
40
+ * },
41
+ * }}
42
+ * pre={
43
+ * <>
44
+ * <AnalyticsGoogle id="UA-xxxxxxxx-x" />
45
+ * <Favicon name="MyApp" color="#000000" />
46
+ * </>
47
+ * }
48
+ * />
49
+ * );
50
+ * }
51
+ *
52
+ * ```
53
+ */
54
+ export const NextApp = (props) => {
55
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) })] }));
56
+ };
57
+ export default NextApp;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../../node/app/css/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,10 @@
1
+ import type { AppMainBaseProps, AppMainFramerProps } from "../AppMain";
2
+ export declare 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
+ export declare const AppMain: ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition, pre, post, }: AppMainProps) => JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useRouter } from "next/router";
4
+ import { AnimatePresence, m } from "framer-motion";
5
+ import { MotionProvider } from "@koine/react/m";
6
+ import { SeoDefaults } from "../../Seo";
7
+ import { NextProgress } from "../../NextProgress";
8
+ /**
9
+ * App main
10
+ *
11
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
12
+ *
13
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
14
+ */
15
+ export const AppMain = ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition = {
16
+ initial: { opacity: 0 },
17
+ animate: { opacity: 1 },
18
+ exit: { opacity: 0 },
19
+ }, pre, post, }) => {
20
+ const { pathname } = useRouter();
21
+ return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, { ...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, { ...transition, children: _createElement(Component, { ...pageProps, key: pathname }) }, pathname) }) })] }), post] }));
22
+ };
@@ -2,14 +2,14 @@ import React from "react";
2
2
  import { AppProps as NextAppProps } from "next/app";
3
3
  import { Theme } from "@mui/material/styles";
4
4
  import { EmotionCache } from "@emotion/react";
5
- export declare type AppThemeEmotionProps = NextAppProps & {
5
+ export declare type AppThemeProps = React.PropsWithChildren<NextAppProps & {
6
6
  emotionCache?: EmotionCache;
7
7
  /**
8
8
  * A theme object
9
9
  */
10
10
  theme: Theme;
11
- };
11
+ }>;
12
12
  /**
13
13
  * App theme with `emotion` (good for `@mui`)s
14
14
  */
15
- export declare const AppThemeEmotion: React.FC<AppThemeEmotionProps>;
15
+ export declare const AppTheme: ({ emotionCache, theme, children, }: AppThemeProps) => JSX.Element;
@@ -3,15 +3,15 @@ import { ThemeProvider } from "@mui/material/styles";
3
3
  import { CacheProvider } from "@emotion/react";
4
4
  import CssBaseline from "@mui/material/CssBaseline";
5
5
  import { Global, css } from "@emotion/react";
6
- import { stylesGlobal } from "@koine/react";
7
- import { createEmotionCache } from "../utils/emotion-cache";
6
+ import { stylesGlobal } from "@koine/react/sc";
7
+ import { createEmotionCache } from "../../utils/emotion-cache";
8
8
  // client-side cache, shared for the whole session of the user in the browser.
9
9
  const clientSideEmotionCache = createEmotionCache();
10
10
  /**
11
11
  * App theme with `emotion` (good for `@mui`)s
12
12
  */
13
- export const AppThemeEmotion = ({ emotionCache = clientSideEmotionCache, theme, children, }) => {
14
- return (_jsx(CacheProvider, Object.assign({ value: emotionCache }, { children: _jsxs(ThemeProvider, Object.assign({ theme: theme }, { children: [_jsx(CssBaseline, {}), _jsx(Global, { styles: css `
13
+ export const AppTheme = ({ emotionCache = clientSideEmotionCache, theme, children, }) => {
14
+ return (_jsx(CacheProvider, { value: emotionCache, children: _jsxs(ThemeProvider, { theme: theme, children: [_jsx(CssBaseline, {}), _jsx(Global, { styles: css `
15
15
  ${stylesGlobal}
16
- ` }), children] })) })));
16
+ ` }), children] }) }));
17
17
  };
@@ -0,0 +1,9 @@
1
+ import { AppProps } from "next/app";
2
+ import { AppThemeProps } from "../AppTheme";
3
+ import { AppMainProps } from "../AppMain";
4
+ export declare type NextAppProps = AppProps & AppThemeProps & AppMainProps;
5
+ /**
6
+ * App with authentication provided by `next-auth`
7
+ */
8
+ export declare const NextApp: (props: NextAppProps) => JSX.Element;
9
+ export default NextApp;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { SessionProvider } from "next-auth/react";
4
+ import { AppHead } from "../../AppHead";
5
+ import { AppTheme } from "../AppTheme";
6
+ import { AppMain } from "../AppMain";
7
+ /**
8
+ * App with authentication provided by `next-auth`
9
+ */
10
+ export const NextApp = (props) => {
11
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) }) })] }));
12
+ };
13
+ export default NextApp;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../../../node/app/em/auth/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,9 @@
1
+ import { AppProps } from "next/app";
2
+ import { AppThemeProps } from "./AppTheme";
3
+ import { AppMainProps } from "./AppMain";
4
+ export declare type NextAppProps = AppProps & AppThemeProps & AppMainProps;
5
+ /**
6
+ * App
7
+ */
8
+ export declare const NextApp: (props: NextAppProps) => JSX.Element;
9
+ export default NextApp;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { AppHead } from "../AppHead";
4
+ import { AppTheme } from "./AppTheme";
5
+ import { AppMain } from "./AppMain";
6
+ /**
7
+ * App
8
+ */
9
+ export const NextApp = (props) => {
10
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) })] }));
11
+ };
12
+ export default NextApp;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../../node/app/em/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/app/index.d.ts CHANGED
@@ -1,11 +1,2 @@
1
- export * from "./App--emotion";
2
- export * from "./App--sc";
3
- export * from "./App--vanilla";
4
- export * from "./AppAuth--emotion";
5
- export * from "./AppAuth--sc";
6
1
  export * from "./AppHead";
7
- export * from "./AppMain--sc";
8
- export * from "./AppMain--vanilla";
9
- export * from "./AppTheme--emotion";
10
- export * from "./AppTheme--sc";
11
- export * from "./AppTheme--vanilla";
2
+ export * from "./AppMain";
package/app/index.js CHANGED
@@ -1,11 +1,2 @@
1
- export * from "./App--emotion";
2
- export * from "./App--sc";
3
- export * from "./App--vanilla";
4
- export * from "./AppAuth--emotion";
5
- export * from "./AppAuth--sc";
6
1
  export * from "./AppHead";
7
- export * from "./AppMain--sc";
8
- export * from "./AppMain--vanilla";
9
- export * from "./AppTheme--emotion";
10
- export * from "./AppTheme--sc";
11
- export * from "./AppTheme--vanilla";
2
+ export * from "./AppMain";
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/app/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,10 @@
1
+ import type { AppMainBaseProps, AppMainFramerProps } from "../AppMain";
2
+ export declare 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
+ export declare const AppMain: ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition, pre, post, }: AppMainProps) => JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useRouter } from "next/router";
4
+ import { AnimatePresence, m } from "framer-motion";
5
+ import { MotionProvider } from "@koine/react/m";
6
+ import { SeoDefaults } from "../../Seo";
7
+ import { NextProgress } from "../../NextProgress";
8
+ /**
9
+ * App main
10
+ *
11
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
12
+ *
13
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
14
+ */
15
+ export const AppMain = ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition = {
16
+ initial: { opacity: 0 },
17
+ animate: { opacity: 1 },
18
+ exit: { opacity: 0 },
19
+ }, pre, post, }) => {
20
+ const { pathname } = useRouter();
21
+ return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, { ...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, { ...transition, children: _createElement(Component, { ...pageProps, key: pathname }) }, pathname) }) })] }), post] }));
22
+ };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { Theme } from "@koine/react/sc";
4
+ export declare type AppThemeProps = React.PropsWithChildren<NextAppProps & {
5
+ /**
6
+ * A theme object
7
+ */
8
+ theme: Theme;
9
+ }>;
10
+ /**
11
+ * App theme with `styled-components`
12
+ */
13
+ export declare const AppTheme: ({ theme, children }: AppThemeProps) => JSX.Element;
@@ -0,0 +1,9 @@
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
+ /**
5
+ * App theme with `styled-components`
6
+ */
7
+ export const AppTheme = ({ theme, children }) => {
8
+ return (_jsxs(ThemeProvider, { theme: theme, children: [_jsx(StylesGlobal, {}), children] }));
9
+ };
@@ -0,0 +1,9 @@
1
+ import { AppProps } from "next/app";
2
+ import { AppThemeProps } from "../AppTheme";
3
+ import { AppMainProps } from "../AppMain";
4
+ export declare type NextAppProps = AppProps & AppThemeProps & AppMainProps;
5
+ /**
6
+ * App with authentication provided by `next-auth`
7
+ */
8
+ export declare const NextApp: (props: NextAppProps) => JSX.Element;
9
+ export default NextApp;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { SessionProvider } from "next-auth/react";
4
+ import { AppHead } from "../../AppHead";
5
+ import { AppTheme } from "../AppTheme";
6
+ import { AppMain } from "../AppMain";
7
+ /**
8
+ * App with authentication provided by `next-auth`
9
+ */
10
+ export const NextApp = (props) => {
11
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) }) })] }));
12
+ };
13
+ export default NextApp;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../../../node/app/sc/auth/index.js",
5
+ "types": "./index.d.ts"
6
+ }