@koine/next 1.0.3 → 1.0.8

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 (118) hide show
  1. package/Analytics/AnalyticsGoogle.d.ts +5 -6
  2. package/Analytics/AnalyticsGoogle.js +37 -0
  3. package/Analytics/index.d.ts +1 -1
  4. package/Analytics/index.js +1 -0
  5. package/Auth/helpers.d.ts +17 -17
  6. package/Auth/helpers.js +21 -0
  7. package/Auth/index.d.ts +4 -4
  8. package/Auth/index.js +4 -0
  9. package/Auth/useLogin.d.ts +7 -7
  10. package/Auth/useLogin.js +47 -0
  11. package/Auth/useLoginUrl.d.ts +1 -1
  12. package/Auth/useLoginUrl.js +11 -0
  13. package/Auth/useLogout.d.ts +6 -6
  14. package/Auth/useLogout.js +52 -0
  15. package/Favicon/Favicon.d.ts +3 -4
  16. package/Favicon/Favicon.js +4 -0
  17. package/Favicon/index.d.ts +1 -1
  18. package/Favicon/index.js +1 -0
  19. package/Forms/index.d.ts +2 -2
  20. package/Forms/index.js +2 -0
  21. package/Forms/useForm.d.ts +32 -32
  22. package/Forms/useForm.js +33 -0
  23. package/Forms/useSubmit.d.ts +24 -24
  24. package/Forms/useSubmit.js +20 -0
  25. package/Head/Head.d.ts +1 -1
  26. package/Head/Head.js +1 -0
  27. package/Head/index.d.ts +1 -1
  28. package/Head/index.js +1 -0
  29. package/I18n/I18n.d.ts +48 -48
  30. package/I18n/I18n.js +86 -0
  31. package/I18n/index.d.ts +1 -1
  32. package/I18n/index.js +1 -0
  33. package/Img/Img.d.ts +21 -21
  34. package/Img/Img.js +30 -0
  35. package/Img/index.d.ts +1 -1
  36. package/Img/index.js +1 -0
  37. package/Link/Link.d.ts +8 -8
  38. package/Link/Link.js +12 -0
  39. package/Link/index.d.ts +1 -1
  40. package/Link/index.js +1 -0
  41. package/NextProgress/NextProgress.d.ts +13 -14
  42. package/NextProgress/NextProgress.js +38 -0
  43. package/NextProgress/index.d.ts +1 -1
  44. package/NextProgress/index.js +1 -0
  45. package/Seo/Seo.d.ts +3 -3
  46. package/Seo/Seo.js +8 -0
  47. package/Seo/SeoDefaults.d.ts +3 -3
  48. package/Seo/SeoDefaults.js +12 -0
  49. package/Seo/helpers.d.ts +48 -48
  50. package/Seo/helpers.js +113 -0
  51. package/Seo/index.d.ts +12 -12
  52. package/Seo/index.js +12 -0
  53. package/Theme/Theme.d.ts +46 -46
  54. package/Theme/Theme.js +235 -0
  55. package/Theme/index.d.ts +1 -1
  56. package/Theme/index.js +1 -0
  57. package/app/App--emotion.d.ts +10 -10
  58. package/app/App--emotion.js +11 -0
  59. package/app/App--sc.d.ts +10 -10
  60. package/app/App--sc.js +11 -0
  61. package/app/App--vanilla.d.ts +10 -10
  62. package/app/App--vanilla.js +11 -0
  63. package/app/AppAuth--emotion.d.ts +10 -10
  64. package/app/AppAuth--emotion.js +12 -0
  65. package/app/AppAuth--sc.d.ts +10 -10
  66. package/app/AppAuth--sc.js +12 -0
  67. package/app/AppHead.d.ts +3 -3
  68. package/app/AppHead.js +5 -0
  69. package/app/{AppMain.d.ts → AppMain--emotion.d.ts} +34 -34
  70. package/app/AppMain--emotion.js +27 -0
  71. package/app/AppMain--sc.d.ts +34 -0
  72. package/app/AppMain--sc.js +27 -0
  73. package/app/AppMain--vanilla.d.ts +27 -27
  74. package/app/AppMain--vanilla.js +11 -0
  75. package/app/AppTheme--emotion.d.ts +15 -15
  76. package/app/AppTheme--emotion.js +17 -0
  77. package/app/AppTheme--sc.d.ts +13 -13
  78. package/app/AppTheme--sc.js +9 -0
  79. package/app/AppTheme--vanilla.d.ts +10 -10
  80. package/app/AppTheme--vanilla.js +12 -0
  81. package/app/index.d.ts +11 -11
  82. package/app/index.js +11 -0
  83. package/app/motion-features.d.ts +2 -2
  84. package/app/motion-features.js +2 -0
  85. package/config/index.d.ts +58 -58
  86. package/config/index.js +144 -0
  87. package/document/Document--emotion.d.ts +5 -5
  88. package/document/Document--emotion.js +55 -0
  89. package/document/Document--sc.d.ts +11 -11
  90. package/document/Document--sc.js +33 -0
  91. package/document/Document--vanilla.d.ts +11 -11
  92. package/document/Document--vanilla.js +20 -0
  93. package/document/Document.d.ts +10 -10
  94. package/document/Document.js +14 -0
  95. package/document/index.d.ts +4 -4
  96. package/document/index.js +4 -0
  97. package/index.d.ts +15 -12
  98. package/index.js +15 -743
  99. package/index.umd.js +2061 -78
  100. package/package.json +27 -21
  101. package/{types.d.ts → typings.d.ts} +0 -0
  102. package/utils/api.d.ts +55 -55
  103. package/utils/api.js +33 -0
  104. package/{document/emotion.d.ts → utils/emotion-cache.d.ts} +5 -5
  105. package/utils/emotion-cache.js +8 -0
  106. package/utils/index.d.ts +20 -19
  107. package/utils/index.js +27 -0
  108. package/Theme.js +0 -1905
  109. package/_tslib.js +0 -41
  110. package/app.js +0 -250
  111. package/config.js +0 -183
  112. package/document.js +0 -207
  113. package/emotion.js +0 -1329
  114. package/es.object.assign.js +0 -1074
  115. package/es.string.replace.js +0 -785
  116. package/es.string.split.js +0 -201
  117. package/index.esm.js +0 -4600
  118. package/motion-features.js +0 -10
package/Theme/Theme.d.ts CHANGED
@@ -1,46 +1,46 @@
1
- /**
2
- * @file
3
- *
4
- * Adapted from [next-themes](https://github.com/pacocoursey/next-themes)
5
- */
6
- import React from "react";
7
- declare type ValueObject = {
8
- [themeName: string]: string;
9
- };
10
- export declare type UseThemeProps = {
11
- /** List of all available theme names */
12
- themes: string[];
13
- /** Forced theme name for the current page */
14
- forcedTheme?: string;
15
- /** Update the theme */
16
- setTheme: (theme: string) => void;
17
- /** Active theme name */
18
- theme?: string;
19
- /** If `enableSystem` is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to `theme` */
20
- resolvedTheme?: string;
21
- /** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
22
- systemTheme?: "dark" | "light";
23
- };
24
- export declare type ThemeProviderProps = {
25
- /** List of all available theme names */
26
- themes?: string[];
27
- /** Forced theme name for the current page */
28
- forcedTheme?: string;
29
- /** Whether to switch between dark and light themes based on prefers-color-scheme */
30
- enableSystem?: boolean;
31
- /** Disable all CSS transitions when switching themes */
32
- disableTransitionOnChange?: boolean;
33
- /** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
34
- enableColorScheme?: boolean;
35
- /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
36
- defaultTheme?: string;
37
- /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
38
- attribute?: string | "class";
39
- /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
40
- value?: ValueObject;
41
- /** Nonce string to pass to the inline script for CSP headers */
42
- nonce?: string;
43
- };
44
- export declare const useTheme: () => UseThemeProps;
45
- export declare const ThemeProvider: React.FC<ThemeProviderProps>;
46
- export {};
1
+ /**
2
+ * @file
3
+ *
4
+ * Adapted from [next-themes](https://github.com/pacocoursey/next-themes)
5
+ */
6
+ import React from "react";
7
+ declare type ValueObject = {
8
+ [themeName: string]: string;
9
+ };
10
+ export declare type UseThemeProps = {
11
+ /** List of all available theme names */
12
+ themes: string[];
13
+ /** Forced theme name for the current page */
14
+ forcedTheme?: string;
15
+ /** Update the theme */
16
+ setTheme: (theme: string) => void;
17
+ /** Active theme name */
18
+ theme?: string;
19
+ /** If `enableSystem` is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to `theme` */
20
+ resolvedTheme?: string;
21
+ /** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
22
+ systemTheme?: "dark" | "light";
23
+ };
24
+ export declare type ThemeProviderProps = {
25
+ /** List of all available theme names */
26
+ themes?: string[];
27
+ /** Forced theme name for the current page */
28
+ forcedTheme?: string;
29
+ /** Whether to switch between dark and light themes based on prefers-color-scheme */
30
+ enableSystem?: boolean;
31
+ /** Disable all CSS transitions when switching themes */
32
+ disableTransitionOnChange?: boolean;
33
+ /** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
34
+ enableColorScheme?: boolean;
35
+ /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
36
+ defaultTheme?: string;
37
+ /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
38
+ attribute?: string | "class";
39
+ /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
40
+ value?: ValueObject;
41
+ /** Nonce string to pass to the inline script for CSP headers */
42
+ nonce?: string;
43
+ };
44
+ export declare const useTheme: () => UseThemeProps;
45
+ export declare const ThemeProvider: React.FC<ThemeProviderProps>;
46
+ export {};
package/Theme/Theme.js ADDED
@@ -0,0 +1,235 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @file
4
+ *
5
+ * Adapted from [next-themes](https://github.com/pacocoursey/next-themes)
6
+ */
7
+ import { createContext, useCallback, useContext, useEffect, useState, memo, } from "react";
8
+ import NextScript from "next/script";
9
+ import { isServer } from "@koine/utils";
10
+ const THEME_STORAGE_KEY = "theme";
11
+ const colorSchemes = ["light", "dark"];
12
+ const MEDIA = "(prefers-color-scheme: dark)";
13
+ const ThemeContext = createContext({
14
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
15
+ setTheme: (_) => { },
16
+ themes: [],
17
+ });
18
+ export const useTheme = () => useContext(ThemeContext);
19
+ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme = true, themes = ["light", "dark"], defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce, }) => {
20
+ const [theme, setThemeState] = useState(() => getTheme(THEME_STORAGE_KEY, defaultTheme));
21
+ const [resolvedTheme, setResolvedTheme] = useState(() => getTheme(THEME_STORAGE_KEY));
22
+ const attrs = !value ? themes : Object.values(value);
23
+ const applyTheme = useCallback((theme) => {
24
+ let resolved = theme;
25
+ if (isServer)
26
+ return;
27
+ // If theme is system, resolve it before setting theme
28
+ if (theme === "system" && enableSystem) {
29
+ resolved = getSystemTheme();
30
+ }
31
+ const name = value ? value[resolved] : resolved;
32
+ const enable = disableTransitionOnChange ? disableAnimation() : null;
33
+ const d = document.documentElement;
34
+ if (attribute === "class") {
35
+ d.classList.remove(...attrs);
36
+ if (name)
37
+ d.classList.add(name);
38
+ }
39
+ else {
40
+ if (name) {
41
+ d.setAttribute(attribute, name);
42
+ }
43
+ else {
44
+ d.removeAttribute(attribute);
45
+ }
46
+ }
47
+ if (enableColorScheme) {
48
+ const fallback = colorSchemes.includes(defaultTheme)
49
+ ? defaultTheme
50
+ : null;
51
+ const colorScheme = colorSchemes.includes(resolved)
52
+ ? resolved
53
+ : fallback;
54
+ d.style.colorScheme = colorScheme;
55
+ }
56
+ enable === null || enable === void 0 ? void 0 : enable();
57
+ }, [
58
+ attribute,
59
+ attrs,
60
+ defaultTheme,
61
+ disableTransitionOnChange,
62
+ enableColorScheme,
63
+ enableSystem,
64
+ value,
65
+ ]);
66
+ const setTheme = useCallback((theme) => {
67
+ setThemeState(theme);
68
+ // Save to storage
69
+ try {
70
+ localStorage.setItem(THEME_STORAGE_KEY, theme);
71
+ }
72
+ catch (e) {
73
+ // Unsupported
74
+ }
75
+ }, []);
76
+ const handleMediaQuery = useCallback((e) => {
77
+ const resolved = getSystemTheme(e);
78
+ setResolvedTheme(resolved);
79
+ if (theme === "system" && enableSystem && !forcedTheme) {
80
+ applyTheme("system");
81
+ }
82
+ }, [theme, enableSystem, forcedTheme, applyTheme]);
83
+ // Always listen to System preference
84
+ useEffect(() => {
85
+ const media = window.matchMedia(MEDIA);
86
+ // Intentionally use deprecated listener methods to support iOS & old browsers
87
+ media.addListener(handleMediaQuery);
88
+ handleMediaQuery(media);
89
+ return () => media.removeListener(handleMediaQuery);
90
+ }, [handleMediaQuery]);
91
+ // localStorage event handling
92
+ useEffect(() => {
93
+ const handleStorage = (e) => {
94
+ if (e.key !== THEME_STORAGE_KEY) {
95
+ return;
96
+ }
97
+ // If default theme set, use it if localstorage === null (happens on local storage manual deletion)
98
+ const theme = e.newValue || defaultTheme;
99
+ setTheme(theme);
100
+ };
101
+ window.addEventListener("storage", handleStorage);
102
+ return () => window.removeEventListener("storage", handleStorage);
103
+ }, [defaultTheme, setTheme]);
104
+ // Whenever theme or forcedTheme changes, apply it
105
+ useEffect(() => {
106
+ applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
107
+ }, [applyTheme, forcedTheme, theme]);
108
+ return (_jsxs(ThemeContext.Provider, Object.assign({ value: {
109
+ theme,
110
+ setTheme,
111
+ forcedTheme,
112
+ resolvedTheme: theme === "system" ? resolvedTheme : theme,
113
+ themes: enableSystem ? [...themes, "system"] : themes,
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] })));
128
+ };
129
+ const ThemeScript = memo(({ forcedTheme, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce, }) => {
130
+ const defaultSystem = defaultTheme === "system";
131
+ // Code-golfing the amount of characters in the script
132
+ const optimization = (() => {
133
+ const removeClasses = `d.remove(${attrs
134
+ .map((t) => `'${t}'`)
135
+ .join(",")})`;
136
+ return `var d=document.documentElement.classList;${removeClasses};`;
137
+ })();
138
+ const fallbackColorScheme = (() => {
139
+ if (!enableColorScheme) {
140
+ return "";
141
+ }
142
+ const fallback = colorSchemes.includes(defaultTheme)
143
+ ? defaultTheme
144
+ : null;
145
+ if (fallback) {
146
+ return `if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${defaultTheme}'`;
147
+ }
148
+ else {
149
+ return `if(e==='light'||e==='dark')d.style.colorScheme=e`;
150
+ }
151
+ })();
152
+ const updateDOM = (name, literal = false, setColorScheme = true) => {
153
+ const resolvedName = value ? value[name] : name;
154
+ const val = literal ? name + `|| ''` : `'${resolvedName}'`;
155
+ let text = "";
156
+ // MUCH faster to set colorScheme alongside HTML attribute/class
157
+ // as it only incurs 1 style recalculation rather than 2
158
+ // This can save over 250ms of work for pages with big DOM
159
+ if (enableColorScheme &&
160
+ setColorScheme &&
161
+ !literal &&
162
+ colorSchemes.includes(name)) {
163
+ text += `d.style.colorScheme = '${name}';`;
164
+ }
165
+ if (attribute === "class") {
166
+ if (literal || resolvedName) {
167
+ text += `d.add(${val})`;
168
+ }
169
+ else {
170
+ text += `null`;
171
+ }
172
+ }
173
+ else {
174
+ if (resolvedName) {
175
+ text += `d[s](n, ${val})`;
176
+ }
177
+ }
178
+ return text;
179
+ };
180
+ const scriptSrc = (() => {
181
+ if (forcedTheme) {
182
+ return `!function(){${optimization}${updateDOM(forcedTheme)}}()`;
183
+ }
184
+ if (enableSystem) {
185
+ return `!function(){try {${optimization}var e=localStorage.getItem('${THEME_STORAGE_KEY}');if("system"===e||(!e&&${defaultSystem})){var t="${MEDIA}",m=window.matchMedia(t);if(m.media!==t||m.matches){${updateDOM("dark")}}else{${updateDOM("light")}}}else if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}${!defaultSystem
186
+ ? `else{` + updateDOM(defaultTheme, false, false) + "}"
187
+ : ""}${fallbackColorScheme}}catch(e){}}()`;
188
+ }
189
+ return `!function(){try{${optimization}var e=localStorage.getItem("${THEME_STORAGE_KEY}");if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}else{${updateDOM(defaultTheme, false, false)};}${fallbackColorScheme}}catch(t){}}();`;
190
+ })();
191
+ // We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
192
+ // However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
193
+ // But our script cannot be external because it changes at runtime based on React props
194
+ // so we trick next/script by passing `src` as a base64 JS script
195
+ const encodedScript = `data:text/javascript;base64,${encodeBase64(scriptSrc)}`;
196
+ return (_jsx(NextScript, { id: "next-theme-script", strategy: "beforeInteractive", src: encodedScript, nonce: nonce }));
197
+ },
198
+ // Never re-render this component
199
+ () => true);
200
+ // Helpers
201
+ const getTheme = (key, fallback) => {
202
+ if (isServer)
203
+ return undefined;
204
+ let theme;
205
+ try {
206
+ theme = localStorage.getItem(key) || undefined;
207
+ }
208
+ catch (e) {
209
+ // Unsupported
210
+ }
211
+ return theme || fallback;
212
+ };
213
+ const disableAnimation = () => {
214
+ const css = document.createElement("style");
215
+ css.appendChild(document.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
216
+ document.head.appendChild(css);
217
+ return () => {
218
+ // Force restyle
219
+ (() => window.getComputedStyle(document.body))();
220
+ // Wait for next tick before removing
221
+ setTimeout(() => {
222
+ document.head.removeChild(css);
223
+ }, 1);
224
+ };
225
+ };
226
+ const getSystemTheme = (e) => {
227
+ if (!e)
228
+ e = window.matchMedia(MEDIA);
229
+ const isDark = e.matches;
230
+ const systemTheme = isDark ? "dark" : "light";
231
+ return systemTheme;
232
+ };
233
+ const encodeBase64 = (str) => {
234
+ return isServer ? Buffer.from(str).toString("base64") : btoa(str);
235
+ };
package/Theme/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Theme";
1
+ export * from "./Theme";
package/Theme/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Theme";
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { AppProps as NextAppProps } from "next/app";
3
- import { AppThemeEmotionProps } from "./AppTheme--emotion";
4
- import { AppMainProps } from "./AppMain";
5
- export declare type AppEmotionProps = NextAppProps & AppThemeEmotionProps & AppMainProps;
6
- /**
7
- * App
8
- */
9
- export declare const AppEmotion: React.FC<AppEmotionProps>;
10
- export default AppEmotion;
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { AppThemeEmotionProps } from "./AppTheme--emotion";
4
+ import { AppMainEmotionProps } from "./AppMain--emotion";
5
+ export declare type AppEmotionProps = NextAppProps & AppThemeEmotionProps & AppMainEmotionProps;
6
+ /**
7
+ * App
8
+ */
9
+ export declare const AppEmotion: React.FC<AppEmotionProps>;
10
+ export default AppEmotion;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AppHead } from "./AppHead";
3
+ import { AppThemeEmotion } from "./AppTheme--emotion";
4
+ import { AppMainEmotion } from "./AppMain--emotion";
5
+ /**
6
+ * App
7
+ */
8
+ export const AppEmotion = (props) => {
9
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(AppThemeEmotion, Object.assign({}, props, { children: _jsx(AppMainEmotion, Object.assign({}, props)) }))] }));
10
+ };
11
+ export default AppEmotion;
package/app/App--sc.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { AppProps as NextAppProps } from "next/app";
3
- import { AppThemeScProps } from "./AppTheme--sc";
4
- import { AppMainProps } from "./AppMain";
5
- export declare type AppBaseProps = NextAppProps & AppThemeScProps & AppMainProps;
6
- /**
7
- * App
8
- */
9
- export declare const AppBase: React.FC<AppBaseProps>;
10
- export default AppBase;
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { AppThemeScProps } from "./AppTheme--sc";
4
+ import { AppMainScProps } from "./AppMain--sc";
5
+ export declare type AppScProps = NextAppProps & AppThemeScProps & AppMainScProps;
6
+ /**
7
+ * App
8
+ */
9
+ export declare const AppSc: React.FC<AppScProps>;
10
+ export default AppSc;
package/app/App--sc.js ADDED
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AppHead } from "./AppHead";
3
+ import { AppThemeSc } from "./AppTheme--sc";
4
+ import { AppMainSc } from "./AppMain--sc";
5
+ /**
6
+ * App
7
+ */
8
+ export const AppSc = (props) => {
9
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(AppThemeSc, Object.assign({}, props, { children: _jsx(AppMainSc, Object.assign({}, props)) }))] }));
10
+ };
11
+ export default AppSc;
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { AppProps as NextAppProps } from "next/app";
3
- import { AppThemeVanillaProps } from "./AppTheme--vanilla";
4
- import { AppMainVanillaProps } from "./AppMain--vanilla";
5
- export declare type AppVanillaProps = NextAppProps & AppThemeVanillaProps & AppMainVanillaProps;
6
- /**
7
- * App
8
- */
9
- export declare const AppVanilla: React.FC<AppVanillaProps>;
10
- export default AppVanilla;
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { AppThemeVanillaProps } from "./AppTheme--vanilla";
4
+ import { AppMainVanillaProps } from "./AppMain--vanilla";
5
+ export declare type AppVanillaProps = NextAppProps & AppThemeVanillaProps & AppMainVanillaProps;
6
+ /**
7
+ * App
8
+ */
9
+ export declare const AppVanilla: React.FC<AppVanillaProps>;
10
+ export default AppVanilla;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AppHead } from "./AppHead";
3
+ import { AppThemeVanilla } from "./AppTheme--vanilla";
4
+ import { AppMainVanilla } from "./AppMain--vanilla";
5
+ /**
6
+ * App
7
+ */
8
+ export const AppVanilla = (props) => {
9
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(AppThemeVanilla, Object.assign({}, props, { children: _jsx(AppMainVanilla, Object.assign({}, props)) }))] }));
10
+ };
11
+ export default AppVanilla;
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { AppProps as NextAppProps } from "next/app";
3
- import { AppThemeEmotionProps } from "./AppTheme--emotion";
4
- import { AppMainProps } from "./AppMain";
5
- export declare type AppAuthEmotionProps = NextAppProps & AppThemeEmotionProps & AppMainProps;
6
- /**
7
- * App with authentication provided by `next-auth`
8
- */
9
- export declare const AppAuthEmotion: React.FC<AppAuthEmotionProps>;
10
- export default AppAuthEmotion;
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { AppThemeEmotionProps } from "./AppTheme--emotion";
4
+ import { AppMainEmotionProps } from "./AppMain--emotion";
5
+ export declare type AppAuthEmotionProps = NextAppProps & AppThemeEmotionProps & AppMainEmotionProps;
6
+ /**
7
+ * App with authentication provided by `next-auth`
8
+ */
9
+ export declare const AppAuthEmotion: React.FC<AppAuthEmotionProps>;
10
+ export default AppAuthEmotion;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SessionProvider } from "next-auth/react";
3
+ import { AppHead } from "./AppHead";
4
+ import { AppThemeEmotion } from "./AppTheme--emotion";
5
+ import { AppMainEmotion } from "./AppMain--emotion";
6
+ /**
7
+ * App with authentication provided by `next-auth`
8
+ */
9
+ export const AppAuthEmotion = (props) => {
10
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, Object.assign({ session: props.pageProps.session }, { children: _jsx(AppThemeEmotion, Object.assign({}, props, { children: _jsx(AppMainEmotion, Object.assign({}, props)) })) }))] }));
11
+ };
12
+ export default AppAuthEmotion;
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { AppProps as NextAppProps } from "next/app";
3
- import { AppThemeScProps } from "./AppTheme--sc";
4
- import { AppMainProps } from "./AppMain";
5
- export declare type AppAuthScProps = NextAppProps & AppThemeScProps & AppMainProps;
6
- /**
7
- * App with authentication provided by `next-auth`
8
- */
9
- export declare const AppAuthSc: React.FC<AppAuthScProps>;
10
- export default AppAuthSc;
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { AppThemeScProps } from "./AppTheme--sc";
4
+ import { AppMainScProps } from "./AppMain--sc";
5
+ export declare type AppAuthScProps = NextAppProps & AppThemeScProps & AppMainScProps;
6
+ /**
7
+ * App with authentication provided by `next-auth`
8
+ */
9
+ export declare const AppAuthSc: React.FC<AppAuthScProps>;
10
+ export default AppAuthSc;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SessionProvider } from "next-auth/react";
3
+ import { AppHead } from "./AppHead";
4
+ import { AppThemeSc } from "./AppTheme--sc";
5
+ import { AppMainSc } from "./AppMain--sc";
6
+ /**
7
+ * App with authentication provided by `next-auth`
8
+ */
9
+ export const AppAuthSc = (props) => {
10
+ return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, Object.assign({ session: props.pageProps.session }, { children: _jsx(AppThemeSc, Object.assign({}, props, { children: _jsx(AppMainSc, Object.assign({}, props)) })) }))] }));
11
+ };
12
+ export default AppAuthSc;
package/app/AppHead.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import React from "react";
2
- export declare type AppHeadProps = unknown;
3
- export declare const AppHead: React.FC<AppHeadProps>;
1
+ import React from "react";
2
+ export declare type AppHeadProps = unknown;
3
+ export declare const AppHead: React.FC<AppHeadProps>;
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 const AppHead = (props) => {
4
+ return (_jsx(Head, Object.assign({}, props, { children: _jsx("meta", { name: "viewport", content: "width=device-width" }) })));
5
+ };
@@ -1,34 +1,34 @@
1
- import React from "react";
2
- import { AppProps as NextAppProps } from "next/app";
3
- import { HTMLMotionProps } from "framer-motion";
4
- import { SeoDefaultsProps } from "../Seo";
5
- export declare type AppMainProps = NextAppProps & {
6
- /**
7
- * A wrapping layout component
8
- */
9
- Layout: React.FC<Record<string, unknown>>;
10
- /**
11
- * Seo site wide default configuration
12
- */
13
- seo?: SeoDefaultsProps;
14
- /**
15
- * It defaults to fade in/out
16
- */
17
- transition?: Omit<HTMLMotionProps<"div">, "key">;
18
- /**
19
- * JSX to render just after SEO
20
- */
21
- pre?: React.ReactNode;
22
- /**
23
- * JSX to render just at the end of the markup
24
- */
25
- post?: React.ReactNode;
26
- };
27
- /**
28
- * App main
29
- *
30
- * It implies a setup for `styled-components` and `framer-motion` libraries.
31
- *
32
- * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
33
- */
34
- export declare const AppMain: React.FC<AppMainProps>;
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { HTMLMotionProps } from "framer-motion";
4
+ import { SeoDefaultsProps } from "../Seo";
5
+ export declare type AppMainEmotionProps = NextAppProps & {
6
+ /**
7
+ * A wrapping layout component
8
+ */
9
+ Layout: React.FC<Record<string, unknown>>;
10
+ /**
11
+ * Seo site wide default configuration
12
+ */
13
+ seo?: SeoDefaultsProps;
14
+ /**
15
+ * It defaults to fade in/out
16
+ */
17
+ transition?: Omit<HTMLMotionProps<"div">, "key">;
18
+ /**
19
+ * JSX to render just after SEO
20
+ */
21
+ pre?: React.ReactNode;
22
+ /**
23
+ * JSX to render just at the end of the markup
24
+ */
25
+ post?: React.ReactNode;
26
+ };
27
+ /**
28
+ * App main
29
+ *
30
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
31
+ *
32
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
33
+ */
34
+ export declare const AppMainEmotion: React.FC<AppMainEmotionProps>;
@@ -0,0 +1,27 @@
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, LazyMotion, m } from "framer-motion";
5
+ import { SeoDefaults } from "../Seo";
6
+ import { NextProgress } from "../NextProgress";
7
+ /**
8
+ * @see https://www.framer.com/docs/guide-reduce-bundle-size/
9
+ */
10
+ const loadMotionFeatures = () => import("./motion-features").then((m) => m.default);
11
+ /**
12
+ * App main
13
+ *
14
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
15
+ *
16
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
17
+ */
18
+ export const AppMainEmotion = ({ Component, pageProps, Layout,
19
+ // theme,
20
+ seo, transition = {
21
+ initial: { opacity: 0 },
22
+ animate: { opacity: 1 },
23
+ exit: { opacity: 0 },
24
+ }, pre, post, }) => {
25
+ const { pathname } = useRouter();
26
+ return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, Object.assign({}, seo)), pre, _jsxs(LazyMotion, Object.assign({ features: loadMotionFeatures }, { children: [_jsx(NextProgress, {}), _jsx(Layout, { children: _jsx(AnimatePresence, Object.assign({ exitBeforeEnter: true, initial: false }, { children: _jsx(m.div, Object.assign({}, transition, { children: _createElement(Component, Object.assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
27
+ };
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { AppProps as NextAppProps } from "next/app";
3
+ import { HTMLMotionProps } from "framer-motion";
4
+ import { SeoDefaultsProps } from "../Seo";
5
+ export declare type AppMainScProps = NextAppProps & {
6
+ /**
7
+ * A wrapping layout component
8
+ */
9
+ Layout: React.FC<Record<string, unknown>>;
10
+ /**
11
+ * Seo site wide default configuration
12
+ */
13
+ seo?: SeoDefaultsProps;
14
+ /**
15
+ * It defaults to fade in/out
16
+ */
17
+ transition?: Omit<HTMLMotionProps<"div">, "key">;
18
+ /**
19
+ * JSX to render just after SEO
20
+ */
21
+ pre?: React.ReactNode;
22
+ /**
23
+ * JSX to render just at the end of the markup
24
+ */
25
+ post?: React.ReactNode;
26
+ };
27
+ /**
28
+ * App main
29
+ *
30
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
31
+ *
32
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
33
+ */
34
+ export declare const AppMainSc: React.FC<AppMainScProps>;