@koine/next 1.0.9 → 1.0.10
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.
- package/package.json +30 -2
- package/Analytics/AnalyticsGoogle.d.ts +0 -5
- package/Analytics/AnalyticsGoogle.js +0 -37
- package/Analytics/index.d.ts +0 -1
- package/Analytics/index.js +0 -1
- package/Analytics/package.json +0 -6
- package/Auth/helpers.d.ts +0 -17
- package/Auth/helpers.js +0 -21
- package/Auth/index.d.ts +0 -4
- package/Auth/index.js +0 -4
- package/Auth/package.json +0 -6
- package/Auth/useLogin.d.ts +0 -7
- package/Auth/useLogin.js +0 -50
- package/Auth/useLoginUrl.d.ts +0 -1
- package/Auth/useLoginUrl.js +0 -11
- package/Auth/useLogout.d.ts +0 -6
- package/Auth/useLogout.js +0 -52
- package/Favicon/Favicon.d.ts +0 -3
- package/Favicon/Favicon.js +0 -4
- package/Favicon/index.d.ts +0 -1
- package/Favicon/index.js +0 -1
- package/Favicon/package.json +0 -6
- package/Forms/index.d.ts +0 -2
- package/Forms/index.js +0 -2
- package/Forms/package.json +0 -6
- package/Forms/useForm.d.ts +0 -32
- package/Forms/useForm.js +0 -37
- package/Forms/useSubmit.d.ts +0 -24
- package/Forms/useSubmit.js +0 -23
- package/Head/Head.d.ts +0 -1
- package/Head/Head.js +0 -1
- package/Head/index.d.ts +0 -1
- package/Head/index.js +0 -1
- package/Head/package.json +0 -6
- package/I18n/I18n.d.ts +0 -44
- package/I18n/I18n.js +0 -74
- package/I18n/index.d.ts +0 -1
- package/I18n/index.js +0 -1
- package/I18n/package.json +0 -6
- package/Img/Img.d.ts +0 -21
- package/Img/Img.js +0 -28
- package/Img/index.d.ts +0 -1
- package/Img/index.js +0 -1
- package/Img/package.json +0 -6
- package/Link/Link.d.ts +0 -9
- package/Link/Link.js +0 -9
- package/Link/index.d.ts +0 -1
- package/Link/index.js +0 -1
- package/Link/package.json +0 -6
- package/NextProgress/NextProgress.d.ts +0 -24
- package/NextProgress/NextProgress.js +0 -37
- package/NextProgress/index.d.ts +0 -2
- package/NextProgress/index.js +0 -1
- package/NextProgress/package.json +0 -6
- package/Seo/Seo.d.ts +0 -3
- package/Seo/Seo.js +0 -8
- package/Seo/SeoDefaults.d.ts +0 -3
- package/Seo/SeoDefaults.js +0 -12
- package/Seo/helpers.d.ts +0 -48
- package/Seo/helpers.js +0 -111
- package/Seo/index.d.ts +0 -12
- package/Seo/index.js +0 -12
- package/Seo/package.json +0 -6
- package/Theme/Theme.d.ts +0 -46
- package/Theme/Theme.js +0 -235
- package/Theme/index.d.ts +0 -1
- package/Theme/index.js +0 -1
- package/Theme/package.json +0 -6
- package/app/AppHead.d.ts +0 -2
- package/app/AppHead.js +0 -5
- package/app/AppMain.d.ts +0 -35
- package/app/AppMain.js +0 -1
- package/app/css/AppMain.d.ts +0 -8
- package/app/css/AppMain.js +0 -11
- package/app/css/AppTheme.d.ts +0 -10
- package/app/css/AppTheme.js +0 -12
- package/app/css/auth/index.d.ts +0 -9
- package/app/css/auth/index.js +0 -13
- package/app/css/auth/package.json +0 -6
- package/app/css/index.d.ts +0 -54
- package/app/css/index.js +0 -57
- package/app/css/package.json +0 -6
- package/app/em/AppMain.d.ts +0 -10
- package/app/em/AppMain.js +0 -22
- package/app/em/AppTheme.d.ts +0 -15
- package/app/em/AppTheme.js +0 -17
- package/app/em/auth/index.d.ts +0 -9
- package/app/em/auth/index.js +0 -13
- package/app/em/auth/package.json +0 -6
- package/app/em/index.d.ts +0 -9
- package/app/em/index.js +0 -12
- package/app/em/package.json +0 -6
- package/app/index.d.ts +0 -2
- package/app/index.js +0 -2
- package/app/package.json +0 -6
- package/app/sc/AppMain.d.ts +0 -10
- package/app/sc/AppMain.js +0 -22
- package/app/sc/AppTheme.d.ts +0 -13
- package/app/sc/AppTheme.js +0 -9
- package/app/sc/auth/index.d.ts +0 -9
- package/app/sc/auth/index.js +0 -13
- package/app/sc/auth/package.json +0 -6
- package/app/sc/index.d.ts +0 -56
- package/app/sc/index.js +0 -59
- package/app/sc/package.json +0 -6
- package/config/index.d.ts +0 -71
- package/config/index.js +0 -174
- package/config/package.json +0 -6
- package/document/Document.d.ts +0 -15
- package/document/Document.js +0 -19
- package/document/css/index.d.ts +0 -22
- package/document/css/index.js +0 -30
- package/document/css/package.json +0 -6
- package/document/em/index.d.ts +0 -16
- package/document/em/index.js +0 -68
- package/document/em/package.json +0 -6
- package/document/index.d.ts +0 -2
- package/document/index.js +0 -2
- package/document/package.json +0 -6
- package/document/sc/index.d.ts +0 -20
- package/document/sc/index.js +0 -44
- package/document/sc/package.json +0 -6
- package/index.d.ts +0 -12
- package/index.js +0 -12
- package/node/Analytics/AnalyticsGoogle.js +0 -42
- package/node/Analytics/index.js +0 -4
- package/node/Auth/helpers.js +0 -26
- package/node/Auth/index.js +0 -7
- package/node/Auth/useLogin.js +0 -54
- package/node/Auth/useLoginUrl.js +0 -15
- package/node/Auth/useLogout.js +0 -56
- package/node/Favicon/Favicon.js +0 -9
- package/node/Favicon/index.js +0 -4
- package/node/Forms/index.js +0 -5
- package/node/Forms/useForm.js +0 -41
- package/node/Forms/useSubmit.js +0 -27
- package/node/Head/Head.js +0 -8
- package/node/Head/index.js +0 -4
- package/node/I18n/I18n.js +0 -82
- package/node/I18n/index.js +0 -4
- package/node/Img/Img.js +0 -34
- package/node/Img/index.js +0 -4
- package/node/Link/Link.js +0 -13
- package/node/Link/index.js +0 -4
- package/node/NextProgress/NextProgress.js +0 -41
- package/node/NextProgress/index.js +0 -5
- package/node/Seo/Seo.js +0 -12
- package/node/Seo/SeoDefaults.js +0 -16
- package/node/Seo/helpers.js +0 -115
- package/node/Seo/index.js +0 -15
- package/node/Theme/Theme.js +0 -241
- package/node/Theme/index.js +0 -4
- package/node/app/AppHead.js +0 -10
- package/node/app/AppMain.js +0 -2
- package/node/app/css/AppMain.js +0 -16
- package/node/app/css/AppTheme.js +0 -16
- package/node/app/css/auth/index.js +0 -18
- package/node/app/css/index.js +0 -62
- package/node/app/em/AppMain.js +0 -26
- package/node/app/em/AppTheme.js +0 -22
- package/node/app/em/auth/index.js +0 -18
- package/node/app/em/index.js +0 -17
- package/node/app/index.js +0 -5
- package/node/app/sc/AppMain.js +0 -26
- package/node/app/sc/AppTheme.js +0 -13
- package/node/app/sc/auth/index.js +0 -18
- package/node/app/sc/index.js +0 -64
- package/node/config/index.js +0 -184
- package/node/document/Document.js +0 -24
- package/node/document/css/index.js +0 -35
- package/node/document/em/index.js +0 -73
- package/node/document/index.js +0 -7
- package/node/document/sc/index.js +0 -49
- package/node/index.js +0 -15
- package/node/utils/api.js +0 -38
- package/node/utils/emotion-cache.js +0 -13
- package/node/utils/index.js +0 -32
- package/utils/api.d.ts +0 -55
- package/utils/api.js +0 -35
- package/utils/emotion-cache.d.ts +0 -5
- package/utils/emotion-cache.js +0 -8
- package/utils/index.d.ts +0 -19
- package/utils/index.js +0 -26
- package/utils/package.json +0 -6
package/Theme/Theme.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
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 || !resolved)
|
|
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
|
-
: "";
|
|
51
|
-
const colorScheme = colorSchemes.includes(resolved)
|
|
52
|
-
? resolved
|
|
53
|
-
: fallback;
|
|
54
|
-
d.style.colorScheme = colorScheme;
|
|
55
|
-
}
|
|
56
|
-
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 ?? theme);
|
|
107
|
-
}, [applyTheme, forcedTheme, theme]);
|
|
108
|
-
return (_jsxs(ThemeContext.Provider, { 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, { ...{
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Theme";
|
package/Theme/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Theme";
|
package/Theme/package.json
DELETED
package/app/AppHead.d.ts
DELETED
package/app/AppHead.js
DELETED
package/app/AppMain.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/app/css/AppMain.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
package/app/css/AppMain.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { SeoDefaults } from "../../Seo";
|
|
4
|
-
/**
|
|
5
|
-
* App main
|
|
6
|
-
*
|
|
7
|
-
* It does not imply any specific styling or animation solution
|
|
8
|
-
*/
|
|
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
|
-
};
|
package/app/css/AppTheme.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
package/app/css/AppTheme.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react";
|
|
3
|
-
import { ThemeProvider } from "../../Theme";
|
|
4
|
-
/**
|
|
5
|
-
* App theme with vanilla class based theme (good for `tailwindcss`)
|
|
6
|
-
*/
|
|
7
|
-
export const AppTheme = ({ theme, children }) => {
|
|
8
|
-
// return (
|
|
9
|
-
// <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
|
|
10
|
-
// );
|
|
11
|
-
return (_jsx(ThemeProvider, { defaultTheme: theme, attribute: "class", children: children }));
|
|
12
|
-
};
|
package/app/css/auth/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
package/app/css/auth/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
package/app/css/index.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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;
|
package/app/css/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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;
|
package/app/css/package.json
DELETED
package/app/em/AppMain.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
package/app/em/AppMain.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
};
|
package/app/em/AppTheme.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
package/app/em/AppTheme.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ThemeProvider } from "@mui/material/styles";
|
|
3
|
-
import { CacheProvider } from "@emotion/react";
|
|
4
|
-
import CssBaseline from "@mui/material/CssBaseline";
|
|
5
|
-
import { Global, css } from "@emotion/react";
|
|
6
|
-
import { stylesGlobal } from "@koine/react/sc";
|
|
7
|
-
import { createEmotionCache } from "../../utils/emotion-cache";
|
|
8
|
-
// client-side cache, shared for the whole session of the user in the browser.
|
|
9
|
-
const clientSideEmotionCache = createEmotionCache();
|
|
10
|
-
/**
|
|
11
|
-
* App theme with `emotion` (good for `@mui`)s
|
|
12
|
-
*/
|
|
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
|
-
${stylesGlobal}
|
|
16
|
-
` }), children] }) }));
|
|
17
|
-
};
|
package/app/em/auth/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
package/app/em/auth/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
package/app/em/auth/package.json
DELETED
package/app/em/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
package/app/em/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
package/app/em/package.json
DELETED
package/app/index.d.ts
DELETED
package/app/index.js
DELETED