@koine/next 1.0.10 → 1.0.13

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 (131) hide show
  1. package/Analytics/AnalyticsGoogle.d.ts +5 -0
  2. package/Analytics/AnalyticsGoogle.js +33 -0
  3. package/Analytics/index.d.ts +1 -0
  4. package/Analytics/index.js +1 -0
  5. package/Analytics/package.json +6 -0
  6. package/Auth/helpers.d.ts +17 -0
  7. package/Auth/helpers.js +22 -0
  8. package/Auth/index.d.ts +4 -0
  9. package/Auth/index.js +4 -0
  10. package/Auth/package.json +6 -0
  11. package/Auth/useLogin.d.ts +7 -0
  12. package/Auth/useLogin.js +49 -0
  13. package/Auth/useLoginUrl.d.ts +1 -0
  14. package/Auth/useLoginUrl.js +11 -0
  15. package/Auth/useLogout.d.ts +6 -0
  16. package/Auth/useLogout.js +52 -0
  17. package/Favicon/Favicon.d.ts +3 -0
  18. package/Favicon/Favicon.js +5 -0
  19. package/Favicon/index.d.ts +1 -0
  20. package/Favicon/index.js +1 -0
  21. package/Favicon/package.json +6 -0
  22. package/Forms/index.d.ts +2 -0
  23. package/Forms/index.js +2 -0
  24. package/Forms/package.json +6 -0
  25. package/Forms/useForm.d.ts +32 -0
  26. package/Forms/useForm.js +35 -0
  27. package/Forms/useSubmit.d.ts +24 -0
  28. package/Forms/useSubmit.js +28 -0
  29. package/Head/Head.d.ts +1 -0
  30. package/Head/Head.js +1 -0
  31. package/Head/index.d.ts +1 -0
  32. package/Head/index.js +1 -0
  33. package/Head/package.json +6 -0
  34. package/I18n/I18n.d.ts +44 -0
  35. package/I18n/I18n.js +95 -0
  36. package/I18n/index.d.ts +1 -0
  37. package/I18n/index.js +1 -0
  38. package/I18n/package.json +6 -0
  39. package/Img/Img.d.ts +21 -0
  40. package/Img/Img.js +30 -0
  41. package/Img/index.d.ts +1 -0
  42. package/Img/index.js +1 -0
  43. package/Img/package.json +6 -0
  44. package/Link/Link.d.ts +9 -0
  45. package/Link/Link.js +11 -0
  46. package/Link/index.d.ts +1 -0
  47. package/Link/index.js +1 -0
  48. package/Link/package.json +6 -0
  49. package/NextProgress/NextProgress.d.ts +24 -0
  50. package/NextProgress/NextProgress.js +40 -0
  51. package/NextProgress/index.d.ts +2 -0
  52. package/NextProgress/index.js +1 -0
  53. package/NextProgress/package.json +6 -0
  54. package/Seo/Seo.d.ts +3 -0
  55. package/Seo/Seo.js +8 -0
  56. package/Seo/SeoDefaults.d.ts +3 -0
  57. package/Seo/SeoDefaults.js +12 -0
  58. package/Seo/helpers.d.ts +48 -0
  59. package/Seo/helpers.js +115 -0
  60. package/Seo/index.d.ts +12 -0
  61. package/Seo/index.js +12 -0
  62. package/Seo/package.json +6 -0
  63. package/Theme/Theme.d.ts +46 -0
  64. package/Theme/Theme.js +245 -0
  65. package/Theme/index.d.ts +1 -0
  66. package/Theme/index.js +1 -0
  67. package/Theme/package.json +6 -0
  68. package/app/AppHead.d.ts +2 -0
  69. package/app/AppHead.js +5 -0
  70. package/app/AppMain.d.ts +35 -0
  71. package/app/AppMain.js +1 -0
  72. package/app/css/AppMain.d.ts +8 -0
  73. package/app/css/AppMain.js +13 -0
  74. package/app/css/AppTheme.d.ts +10 -0
  75. package/app/css/AppTheme.js +14 -0
  76. package/app/css/auth/index.d.ts +9 -0
  77. package/app/css/auth/index.js +14 -0
  78. package/app/css/auth/package.json +6 -0
  79. package/app/css/index.d.ts +54 -0
  80. package/app/css/index.js +58 -0
  81. package/app/css/package.json +6 -0
  82. package/app/em/AppMain.d.ts +10 -0
  83. package/app/em/AppMain.js +24 -0
  84. package/app/em/AppTheme.d.ts +15 -0
  85. package/app/em/AppTheme.js +18 -0
  86. package/app/em/auth/index.d.ts +9 -0
  87. package/app/em/auth/index.js +14 -0
  88. package/app/em/auth/package.json +6 -0
  89. package/app/em/index.d.ts +9 -0
  90. package/app/em/index.js +13 -0
  91. package/app/em/package.json +6 -0
  92. package/app/index.d.ts +2 -0
  93. package/app/index.js +2 -0
  94. package/app/package.json +6 -0
  95. package/app/sc/AppMain.d.ts +10 -0
  96. package/app/sc/AppMain.js +24 -0
  97. package/app/sc/AppTheme.d.ts +13 -0
  98. package/app/sc/AppTheme.js +11 -0
  99. package/app/sc/auth/index.d.ts +9 -0
  100. package/app/sc/auth/index.js +14 -0
  101. package/app/sc/auth/package.json +6 -0
  102. package/app/sc/index.d.ts +56 -0
  103. package/app/sc/index.js +60 -0
  104. package/app/sc/package.json +6 -0
  105. package/config/index.d.ts +84 -0
  106. package/config/index.js +190 -0
  107. package/config/package.json +6 -0
  108. package/document/Document.d.ts +15 -0
  109. package/document/Document.js +26 -0
  110. package/document/css/index.d.ts +22 -0
  111. package/document/css/index.js +44 -0
  112. package/document/css/package.json +6 -0
  113. package/document/em/index.d.ts +16 -0
  114. package/document/em/index.js +59 -0
  115. package/document/em/package.json +6 -0
  116. package/document/index.d.ts +2 -0
  117. package/document/index.js +2 -0
  118. package/document/package.json +6 -0
  119. package/document/sc/index.d.ts +20 -0
  120. package/document/sc/index.js +65 -0
  121. package/document/sc/package.json +6 -0
  122. package/index.d.ts +12 -0
  123. package/index.js +12 -0
  124. package/package.json +11 -13
  125. package/utils/api.d.ts +55 -0
  126. package/utils/api.js +44 -0
  127. package/utils/emotion-cache.d.ts +5 -0
  128. package/utils/emotion-cache.js +8 -0
  129. package/utils/index.d.ts +19 -0
  130. package/utils/index.js +27 -0
  131. package/utils/package.json +6 -0
package/Theme/Theme.js ADDED
@@ -0,0 +1,245 @@
1
+ import { __assign, __spreadArray } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * @file
5
+ *
6
+ * Adapted from [next-themes](https://github.com/pacocoursey/next-themes)
7
+ */
8
+ import { createContext, useCallback, useContext, useEffect, useState, memo, } from "react";
9
+ import NextScript from "next/script";
10
+ import { isServer } from "@koine/utils";
11
+ var THEME_STORAGE_KEY = "theme";
12
+ var colorSchemes = ["light", "dark"];
13
+ var MEDIA = "(prefers-color-scheme: dark)";
14
+ var ThemeContext = createContext({
15
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
16
+ setTheme: function (_) { },
17
+ themes: [],
18
+ });
19
+ export var useTheme = function () { return useContext(ThemeContext); };
20
+ export var ThemeProvider = function (_a) {
21
+ var forcedTheme = _a.forcedTheme, _b = _a.disableTransitionOnChange, disableTransitionOnChange = _b === void 0 ? false : _b, _c = _a.enableSystem, enableSystem = _c === void 0 ? true : _c, _d = _a.enableColorScheme, enableColorScheme = _d === void 0 ? true : _d, _e = _a.themes, themes = _e === void 0 ? ["light", "dark"] : _e, _f = _a.defaultTheme, defaultTheme = _f === void 0 ? enableSystem ? "system" : "light" : _f, _g = _a.attribute, attribute = _g === void 0 ? "data-theme" : _g, value = _a.value, children = _a.children, nonce = _a.nonce;
22
+ var _h = useState(function () {
23
+ return getTheme(THEME_STORAGE_KEY, defaultTheme);
24
+ }), theme = _h[0], setThemeState = _h[1];
25
+ var _j = useState(function () {
26
+ return getTheme(THEME_STORAGE_KEY);
27
+ }), resolvedTheme = _j[0], setResolvedTheme = _j[1];
28
+ var attrs = !value ? themes : Object.values(value);
29
+ var applyTheme = useCallback(function (theme) {
30
+ var _a;
31
+ var resolved = theme;
32
+ if (isServer || !resolved)
33
+ return;
34
+ // If theme is system, resolve it before setting theme
35
+ if (theme === "system" && enableSystem) {
36
+ resolved = getSystemTheme();
37
+ }
38
+ var name = value ? value[resolved] : resolved;
39
+ var enable = disableTransitionOnChange ? disableAnimation() : null;
40
+ var d = document.documentElement;
41
+ if (attribute === "class") {
42
+ (_a = d.classList).remove.apply(_a, attrs);
43
+ if (name)
44
+ d.classList.add(name);
45
+ }
46
+ else {
47
+ if (name) {
48
+ d.setAttribute(attribute, name);
49
+ }
50
+ else {
51
+ d.removeAttribute(attribute);
52
+ }
53
+ }
54
+ if (enableColorScheme) {
55
+ var fallback = colorSchemes.includes(defaultTheme)
56
+ ? defaultTheme
57
+ : "";
58
+ var colorScheme = colorSchemes.includes(resolved)
59
+ ? resolved
60
+ : fallback;
61
+ d.style.colorScheme = colorScheme;
62
+ }
63
+ enable === null || enable === void 0 ? void 0 : enable();
64
+ }, [
65
+ attribute,
66
+ attrs,
67
+ defaultTheme,
68
+ disableTransitionOnChange,
69
+ enableColorScheme,
70
+ enableSystem,
71
+ value,
72
+ ]);
73
+ var setTheme = useCallback(function (theme) {
74
+ setThemeState(theme);
75
+ // Save to storage
76
+ try {
77
+ localStorage.setItem(THEME_STORAGE_KEY, theme);
78
+ }
79
+ catch (e) {
80
+ // Unsupported
81
+ }
82
+ }, []);
83
+ var handleMediaQuery = useCallback(function (e) {
84
+ var resolved = getSystemTheme(e);
85
+ setResolvedTheme(resolved);
86
+ if (theme === "system" && enableSystem && !forcedTheme) {
87
+ applyTheme("system");
88
+ }
89
+ }, [theme, enableSystem, forcedTheme, applyTheme]);
90
+ // Always listen to System preference
91
+ useEffect(function () {
92
+ var media = window.matchMedia(MEDIA);
93
+ // Intentionally use deprecated listener methods to support iOS & old browsers
94
+ media.addListener(handleMediaQuery);
95
+ handleMediaQuery(media);
96
+ return function () { return media.removeListener(handleMediaQuery); };
97
+ }, [handleMediaQuery]);
98
+ // localStorage event handling
99
+ useEffect(function () {
100
+ var handleStorage = function (e) {
101
+ if (e.key !== THEME_STORAGE_KEY) {
102
+ return;
103
+ }
104
+ // If default theme set, use it if localstorage === null (happens on local storage manual deletion)
105
+ var theme = e.newValue || defaultTheme;
106
+ setTheme(theme);
107
+ };
108
+ window.addEventListener("storage", handleStorage);
109
+ return function () { return window.removeEventListener("storage", handleStorage); };
110
+ }, [defaultTheme, setTheme]);
111
+ // Whenever theme or forcedTheme changes, apply it
112
+ useEffect(function () {
113
+ applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
114
+ }, [applyTheme, forcedTheme, theme]);
115
+ return (_jsxs(ThemeContext.Provider, __assign({ value: {
116
+ theme: theme,
117
+ setTheme: setTheme,
118
+ forcedTheme: forcedTheme,
119
+ resolvedTheme: theme === "system" ? resolvedTheme : theme,
120
+ themes: enableSystem ? __spreadArray(__spreadArray([], themes, true), ["system"], false) : themes,
121
+ systemTheme: (enableSystem ? resolvedTheme : undefined),
122
+ } }, { children: [_jsx(ThemeScript, __assign({}, {
123
+ forcedTheme: forcedTheme,
124
+ disableTransitionOnChange: disableTransitionOnChange,
125
+ enableSystem: enableSystem,
126
+ enableColorScheme: enableColorScheme,
127
+ themes: themes,
128
+ defaultTheme: defaultTheme,
129
+ attribute: attribute,
130
+ value: value,
131
+ children: children,
132
+ attrs: attrs,
133
+ nonce: nonce,
134
+ })), children] })));
135
+ };
136
+ var ThemeScript = memo(function (_a) {
137
+ var forcedTheme = _a.forcedTheme, attribute = _a.attribute, enableSystem = _a.enableSystem, enableColorScheme = _a.enableColorScheme, defaultTheme = _a.defaultTheme, value = _a.value, attrs = _a.attrs, nonce = _a.nonce;
138
+ var defaultSystem = defaultTheme === "system";
139
+ // Code-golfing the amount of characters in the script
140
+ var optimization = (function () {
141
+ var removeClasses = "d.remove(".concat(attrs
142
+ .map(function (t) { return "'".concat(t, "'"); })
143
+ .join(","), ")");
144
+ return "var d=document.documentElement.classList;".concat(removeClasses, ";");
145
+ })();
146
+ var fallbackColorScheme = (function () {
147
+ if (!enableColorScheme) {
148
+ return "";
149
+ }
150
+ var fallback = colorSchemes.includes(defaultTheme)
151
+ ? defaultTheme
152
+ : null;
153
+ if (fallback) {
154
+ return "if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'".concat(defaultTheme, "'");
155
+ }
156
+ else {
157
+ return "if(e==='light'||e==='dark')d.style.colorScheme=e";
158
+ }
159
+ })();
160
+ var updateDOM = function (name, literal, setColorScheme) {
161
+ if (literal === void 0) { literal = false; }
162
+ if (setColorScheme === void 0) { setColorScheme = true; }
163
+ var resolvedName = value ? value[name] : name;
164
+ var val = literal ? name + "|| ''" : "'".concat(resolvedName, "'");
165
+ var text = "";
166
+ // MUCH faster to set colorScheme alongside HTML attribute/class
167
+ // as it only incurs 1 style recalculation rather than 2
168
+ // This can save over 250ms of work for pages with big DOM
169
+ if (enableColorScheme &&
170
+ setColorScheme &&
171
+ !literal &&
172
+ colorSchemes.includes(name)) {
173
+ text += "d.style.colorScheme = '".concat(name, "';");
174
+ }
175
+ if (attribute === "class") {
176
+ if (literal || resolvedName) {
177
+ text += "d.add(".concat(val, ")");
178
+ }
179
+ else {
180
+ text += "null";
181
+ }
182
+ }
183
+ else {
184
+ if (resolvedName) {
185
+ text += "d[s](n, ".concat(val, ")");
186
+ }
187
+ }
188
+ return text;
189
+ };
190
+ var scriptSrc = (function () {
191
+ if (forcedTheme) {
192
+ return "!function(){".concat(optimization).concat(updateDOM(forcedTheme), "}()");
193
+ }
194
+ if (enableSystem) {
195
+ return "!function(){try {".concat(optimization, "var e=localStorage.getItem('").concat(THEME_STORAGE_KEY, "');if(\"system\"===e||(!e&&").concat(defaultSystem, ")){var t=\"").concat(MEDIA, "\",m=window.matchMedia(t);if(m.media!==t||m.matches){").concat(updateDOM("dark"), "}else{").concat(updateDOM("light"), "}}else if(e){").concat(value ? "var x=".concat(JSON.stringify(value), ";") : "").concat(updateDOM(value ? "x[e]" : "e", true), "}").concat(!defaultSystem
196
+ ? "else{" + updateDOM(defaultTheme, false, false) + "}"
197
+ : "").concat(fallbackColorScheme, "}catch(e){}}()");
198
+ }
199
+ return "!function(){try{".concat(optimization, "var e=localStorage.getItem(\"").concat(THEME_STORAGE_KEY, "\");if(e){").concat(value ? "var x=".concat(JSON.stringify(value), ";") : "").concat(updateDOM(value ? "x[e]" : "e", true), "}else{").concat(updateDOM(defaultTheme, false, false), ";}").concat(fallbackColorScheme, "}catch(t){}}();");
200
+ })();
201
+ // We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
202
+ // However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
203
+ // But our script cannot be external because it changes at runtime based on React props
204
+ // so we trick next/script by passing `src` as a base64 JS script
205
+ var encodedScript = "data:text/javascript;base64,".concat(encodeBase64(scriptSrc));
206
+ return (_jsx(NextScript, { id: "next-theme-script", strategy: "beforeInteractive", src: encodedScript, nonce: nonce }));
207
+ },
208
+ // Never re-render this component
209
+ function () { return true; });
210
+ // Helpers
211
+ var getTheme = function (key, fallback) {
212
+ if (isServer)
213
+ return undefined;
214
+ var theme;
215
+ try {
216
+ theme = localStorage.getItem(key) || undefined;
217
+ }
218
+ catch (e) {
219
+ // Unsupported
220
+ }
221
+ return theme || fallback;
222
+ };
223
+ var disableAnimation = function () {
224
+ var css = document.createElement("style");
225
+ css.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"));
226
+ document.head.appendChild(css);
227
+ return function () {
228
+ // Force restyle
229
+ (function () { return window.getComputedStyle(document.body); })();
230
+ // Wait for next tick before removing
231
+ setTimeout(function () {
232
+ document.head.removeChild(css);
233
+ }, 1);
234
+ };
235
+ };
236
+ var getSystemTheme = function (e) {
237
+ if (!e)
238
+ e = window.matchMedia(MEDIA);
239
+ var isDark = e.matches;
240
+ var systemTheme = isDark ? "dark" : "light";
241
+ return systemTheme;
242
+ };
243
+ var encodeBase64 = function (str) {
244
+ return isServer ? Buffer.from(str).toString("base64") : btoa(str);
245
+ };
@@ -0,0 +1 @@
1
+ export * from "./Theme";
package/Theme/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Theme";
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/Theme/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,2 @@
1
+ export declare type AppHeadProps = unknown;
2
+ export declare const AppHead: () => JSX.Element;
package/app/AppHead.js ADDED
@@ -0,0 +1,5 @@
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
+ };
@@ -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;
@@ -0,0 +1,13 @@
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 "../../Seo";
5
+ /**
6
+ * App main
7
+ *
8
+ * It does not imply any specific styling or animation solution
9
+ */
10
+ export var AppMain = function (_a) {
11
+ var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, seo = _a.seo, pre = _a.pre, post = _a.post;
12
+ return (_jsxs(React.Fragment, { children: [_jsx(SeoDefaults, __assign({}, seo)), pre, _jsx(Layout, { children: _jsx(Component, __assign({}, pageProps)) }), post] }));
13
+ };
@@ -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;
@@ -0,0 +1,14 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ // import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react";
4
+ import { ThemeProvider } from "../../Theme";
5
+ /**
6
+ * App theme with vanilla class based theme (good for `tailwindcss`)
7
+ */
8
+ export var AppTheme = function (_a) {
9
+ var theme = _a.theme, children = _a.children;
10
+ // return (
11
+ // <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
12
+ // );
13
+ return (_jsx(ThemeProvider, __assign({ defaultTheme: theme, attribute: "class" }, { children: children })));
14
+ };
@@ -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,14 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { SessionProvider } from "next-auth/react";
5
+ import { AppHead } from "../../AppHead";
6
+ import { AppTheme } from "../AppTheme";
7
+ import { AppMain } from "../AppMain";
8
+ /**
9
+ * App with authentication provided by `next-auth`
10
+ */
11
+ export var NextApp = function (props) {
12
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, __assign({ session: props.pageProps.session }, { children: _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) })) }))] }));
13
+ };
14
+ 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,58 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { AppHead } from "../AppHead";
5
+ import { AppTheme } from "./AppTheme";
6
+ import { AppMain } from "./AppMain";
7
+ /**
8
+ * App
9
+ *
10
+ * @example
11
+ *
12
+ * ```tsx
13
+ * import { NextApp, NextAppProps } from "@koine/next/app/css/auth";
14
+ * import { Favicon, AnalyticsGoogle } from "@koine/next";
15
+ * import { theme } from "src/helpers/theme";
16
+ * import { Layout } from "src/components/Layout";
17
+ * // import "@fontsource/myfont/800.css";
18
+ * // import "src/helpers/theme.css";
19
+ *
20
+ * const motion = () => import("@koine/react/m/max").then((m) => m.default);
21
+ *
22
+ * export default function App(props: NextAppProps) {
23
+ * return (
24
+ * <NextApp
25
+ * {...props}
26
+ * Layout={Layout}
27
+ * theme={theme}
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
+ export var NextApp = function (props) {
56
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
57
+ };
58
+ 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,24 @@
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 { useRouter } from "next/router";
5
+ import { AnimatePresence, m } from "framer-motion";
6
+ import { MotionProvider } from "@koine/react/m";
7
+ import { SeoDefaults } from "../../Seo";
8
+ import { NextProgress } from "../../NextProgress";
9
+ /**
10
+ * App main
11
+ *
12
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
13
+ *
14
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
15
+ */
16
+ export var AppMain = function (_a) {
17
+ 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 ? {
18
+ initial: { opacity: 0 },
19
+ animate: { opacity: 1 },
20
+ exit: { opacity: 0 },
21
+ } : _b, pre = _a.pre, post = _a.post;
22
+ var pathname = useRouter().pathname;
23
+ return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, __assign({}, seo)), pre, _jsxs(MotionProvider, __assign({ features: motion }, { children: [ProgressOverlay && _jsx(NextProgress, { Overlay: ProgressOverlay }), _jsx(Layout, { children: _jsx(AnimatePresence, __assign({ exitBeforeEnter: true, initial: false }, { children: _jsx(m.div, __assign({}, transition, { children: _createElement(Component, __assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
24
+ };
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { Theme } from "@mui/material/styles";
4
+ import { EmotionCache } from "@emotion/react";
5
+ export declare type AppThemeProps = React.PropsWithChildren<NextAppProps & {
6
+ emotionCache?: EmotionCache;
7
+ /**
8
+ * A theme object
9
+ */
10
+ theme: Theme;
11
+ }>;
12
+ /**
13
+ * App theme with `emotion` (good for `@mui`)s
14
+ */
15
+ export declare const AppTheme: ({ emotionCache, theme, children, }: AppThemeProps) => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { __assign, __makeTemplateObject } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ThemeProvider } from "@mui/material/styles";
4
+ import { CacheProvider } from "@emotion/react";
5
+ import CssBaseline from "@mui/material/CssBaseline";
6
+ import { Global, css } from "@emotion/react";
7
+ import { stylesGlobal } from "@koine/react/sc";
8
+ import { createEmotionCache } from "../../utils/emotion-cache";
9
+ // client-side cache, shared for the whole session of the user in the browser.
10
+ var clientSideEmotionCache = createEmotionCache();
11
+ /**
12
+ * App theme with `emotion` (good for `@mui`)s
13
+ */
14
+ export var AppTheme = function (_a) {
15
+ var _b = _a.emotionCache, emotionCache = _b === void 0 ? clientSideEmotionCache : _b, theme = _a.theme, children = _a.children;
16
+ return (_jsx(CacheProvider, __assign({ value: emotionCache }, { children: _jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(CssBaseline, {}), _jsx(Global, { styles: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), stylesGlobal) }), children] })) })));
17
+ };
18
+ var templateObject_1;
@@ -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,14 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { SessionProvider } from "next-auth/react";
5
+ import { AppHead } from "../../AppHead";
6
+ import { AppTheme } from "../AppTheme";
7
+ import { AppMain } from "../AppMain";
8
+ /**
9
+ * App with authentication provided by `next-auth`
10
+ */
11
+ export var NextApp = function (props) {
12
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, __assign({ session: props.pageProps.session }, { children: _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) })) }))] }));
13
+ };
14
+ 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,13 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { AppHead } from "../AppHead";
5
+ import { AppTheme } from "./AppTheme";
6
+ import { AppMain } from "./AppMain";
7
+ /**
8
+ * App
9
+ */
10
+ export var NextApp = function (props) {
11
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
12
+ };
13
+ 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
+ }