@koine/next 2.0.0-beta.12 → 2.0.0-beta.120
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/12/AnalyticsGoogle.d.ts +1 -2
- package/12/DisableErrorOverlay.d.ts +1 -6
- package/12/Seo.d.ts +8 -26
- package/12/SeoDefaults.d.ts +3 -4
- package/12/seoBuildTags.d.ts +2 -17
- package/12/types.d.ts +2 -0
- package/12.cjs.d.ts +1 -0
- package/12.cjs.default.js +1 -0
- package/12.cjs.js +27 -0
- package/12.cjs.mjs +2 -0
- package/12.d.ts +3 -0
- package/12.esm.d.ts +1 -0
- package/12.esm.js +24 -0
- package/README.md +0 -12
- package/ThemeContext.cjs.d.ts +2 -0
- package/ThemeContext.cjs.default.js +1 -0
- package/ThemeContext.cjs.js +11 -0
- package/ThemeContext.cjs.mjs +2 -0
- package/ThemeContext.d.ts +11 -0
- package/ThemeContext.esm.d.ts +2 -0
- package/ThemeContext.esm.js +6 -0
- package/ThemeProvider.cjs.d.ts +2 -0
- package/ThemeProvider.cjs.default.js +1 -0
- package/ThemeProvider.cjs.js +43 -0
- package/ThemeProvider.cjs.mjs +2 -0
- package/ThemeProvider.d.ts +17 -0
- package/ThemeProvider.esm.d.ts +2 -0
- package/ThemeProvider.esm.js +38 -0
- package/config.cjs.d.ts +1 -0
- package/config.cjs.default.js +1 -0
- package/config.cjs.js +27 -0
- package/config.cjs.mjs +2 -0
- package/config.d.ts +8 -0
- package/config.esm.d.ts +1 -0
- package/config.esm.js +25 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +17 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +3 -1
- package/index.esm.d.ts +1 -0
- package/index.esm.js +8 -0
- package/load.cjs.d.ts +2 -0
- package/load.cjs.default.js +1 -0
- package/load.cjs.js +15 -0
- package/load.cjs.mjs +2 -0
- package/load.d.ts +0 -8
- package/load.esm.d.ts +2 -0
- package/{load.mjs → load.esm.js} +3 -6
- package/package.json +49 -89
- package/typings.d.ts +39 -50
- package/useTheme.cjs.d.ts +2 -0
- package/useTheme.cjs.default.js +1 -0
- package/useTheme.cjs.js +13 -0
- package/useTheme.cjs.mjs +2 -0
- package/useTheme.d.ts +4 -0
- package/useTheme.esm.d.ts +2 -0
- package/useTheme.esm.js +8 -0
- package/12/AnalyticsGoogle.mjs +0 -60
- package/12/DisableErrorOverlay.mjs +0 -16
- package/12/DynamicNamespaces.d.ts +0 -13
- package/12/DynamicNamespaces.mjs +0 -8
- package/12/Favicon.d.ts +0 -4
- package/12/Favicon.mjs +0 -10
- package/12/Link.d.ts +0 -10
- package/12/Link.mjs +0 -20
- package/12/NextProgress.d.ts +0 -25
- package/12/NextProgress.mjs +0 -51
- package/12/Seo.mjs +0 -30
- package/12/SeoDefaults.mjs +0 -14
- package/12/T.d.ts +0 -16
- package/12/T.mjs +0 -27
- package/12/ThemeContext.d.ts +0 -17
- package/12/ThemeContext.mjs +0 -7
- package/12/ThemeProvider.d.ts +0 -35
- package/12/ThemeProvider.mjs +0 -245
- package/12/TransText.d.ts +0 -3
- package/12/TransText.mjs +0 -4
- package/12/app/AppHead.d.ts +0 -3
- package/12/app/AppHead.mjs +0 -12
- package/12/app/AppMain.d.ts +0 -35
- package/12/app/AppMain.mjs +0 -1
- package/12/app/css/AppMain.d.ts +0 -9
- package/12/app/css/AppMain.mjs +0 -24
- package/12/app/css/AppTheme.d.ts +0 -11
- package/12/app/css/AppTheme.mjs +0 -17
- package/12/app/css/auth/index.d.ts +0 -11
- package/12/app/css/auth/index.mjs +0 -24
- package/12/app/css/index.d.ts +0 -54
- package/12/app/css/index.mjs +0 -65
- package/12/app/index.d.ts +0 -2
- package/12/app/index.mjs +0 -2
- package/12/app/sc/AppMain.d.ts +0 -11
- package/12/app/sc/AppMain.mjs +0 -58
- package/12/app/sc/AppTheme.d.ts +0 -14
- package/12/app/sc/AppTheme.mjs +0 -16
- package/12/app/sc/auth/index.d.ts +0 -11
- package/12/app/sc/auth/index.mjs +0 -24
- package/12/app/sc/index.d.ts +0 -56
- package/12/app/sc/index.mjs +0 -67
- package/12/document/Document.d.ts +0 -15
- package/12/document/Document.mjs +0 -38
- package/12/document/css/index.d.ts +0 -17
- package/12/document/css/index.mjs +0 -53
- package/12/document/index.d.ts +0 -2
- package/12/document/index.mjs +0 -2
- package/12/document/sc/index.d.ts +0 -19
- package/12/document/sc/index.mjs +0 -65
- package/12/getT.d.ts +0 -9
- package/12/getT.mjs +0 -8
- package/12/index.d.ts +0 -24
- package/12/index.mjs +0 -27
- package/12/seoBuildTags.mjs +0 -121
- package/12/to.d.ts +0 -24
- package/12/to.mjs +0 -19
- package/12/translationAsOptions.d.ts +0 -3
- package/12/translationAsOptions.mjs +0 -9
- package/12/types-i18n.d.ts +0 -118
- package/12/types-i18n.mjs +0 -12
- package/12/types-seo.d.ts +0 -7
- package/12/types-seo.mjs +0 -1
- package/12/useBackUrl.d.ts +0 -2
- package/12/useBackUrl.mjs +0 -28
- package/12/useDateFormat.d.ts +0 -7
- package/12/useDateFormat.mjs +0 -26
- package/12/useForm.d.ts +0 -27
- package/12/useForm.mjs +0 -47
- package/12/useLocale.d.ts +0 -2
- package/12/useLocale.mjs +0 -6
- package/12/useT.d.ts +0 -4
- package/12/useT.mjs +0 -39
- package/12/useTheme.d.ts +0 -7
- package/12/useTheme.mjs +0 -7
- package/12/useTo.d.ts +0 -3
- package/12/useTo.mjs +0 -8
- package/config/index.d.ts +0 -160
- package/config/index.mjs +0 -315
- package/getSiteUrl.d.ts +0 -8
- package/getSiteUrl.mjs +0 -10
- package/index.mjs +0 -2
package/12/ThemeProvider.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type ValueObject = {
|
|
3
|
-
[themeName: string]: string;
|
|
4
|
-
};
|
|
5
|
-
export type ThemeProviderProps = React.PropsWithChildren<{
|
|
6
|
-
/** List of all available theme names */
|
|
7
|
-
themes?: string[];
|
|
8
|
-
/** Forced theme name for the current page */
|
|
9
|
-
forcedTheme?: string;
|
|
10
|
-
/** Whether to switch between dark and light themes based on prefers-color-scheme */
|
|
11
|
-
enableSystem?: boolean;
|
|
12
|
-
/** Disable all CSS transitions when switching themes */
|
|
13
|
-
disableTransitionOnChange?: boolean;
|
|
14
|
-
/** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
|
|
15
|
-
enableColorScheme?: boolean;
|
|
16
|
-
/** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
|
|
17
|
-
defaultTheme?: string;
|
|
18
|
-
/** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
|
|
19
|
-
attribute?: string | "class";
|
|
20
|
-
/** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
|
|
21
|
-
value?: ValueObject;
|
|
22
|
-
/** Nonce string to pass to the inline script for CSP headers */
|
|
23
|
-
nonce?: string;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
27
|
-
*
|
|
28
|
-
* Differences:
|
|
29
|
-
*
|
|
30
|
-
* - enableColorScheme: `false` by default (instead of `true`), this plays more
|
|
31
|
-
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
32
|
-
* controlled by tailwind modifiers
|
|
33
|
-
*/
|
|
34
|
-
export declare const ThemeProvider: ({ forcedTheme, disableTransitionOnChange, enableSystem, enableColorScheme, themes, defaultTheme, attribute, value, children, nonce, }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
export default ThemeProvider;
|
package/12/ThemeProvider.mjs
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import NextScript from "next/script";
|
|
4
|
-
import { memo, useCallback, useEffect, useState } from "react";
|
|
5
|
-
import isServer from "@koine/utils/isServer";
|
|
6
|
-
import { ThemeContext } from "./ThemeContext";
|
|
7
|
-
const colorSchemes = [
|
|
8
|
-
"light",
|
|
9
|
-
"dark"
|
|
10
|
-
];
|
|
11
|
-
const MEDIA = "(prefers-color-scheme: dark)";
|
|
12
|
-
const THEME_STORAGE_KEY = "theme";
|
|
13
|
-
/**
|
|
14
|
-
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
15
|
-
*
|
|
16
|
-
* Differences:
|
|
17
|
-
*
|
|
18
|
-
* - enableColorScheme: `false` by default (instead of `true`), this plays more
|
|
19
|
-
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
20
|
-
* controlled by tailwind modifiers
|
|
21
|
-
*/ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme, themes = [
|
|
22
|
-
"light",
|
|
23
|
-
"dark"
|
|
24
|
-
], defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce })=>{
|
|
25
|
-
const [theme, setThemeState] = useState(()=>getTheme(THEME_STORAGE_KEY, defaultTheme));
|
|
26
|
-
const [resolvedTheme, setResolvedTheme] = useState(()=>getTheme(THEME_STORAGE_KEY));
|
|
27
|
-
const attrs = !value ? themes : Object.values(value);
|
|
28
|
-
const applyTheme = useCallback((theme)=>{
|
|
29
|
-
let resolved = theme;
|
|
30
|
-
if (isServer || !resolved) return;
|
|
31
|
-
// If theme is system, resolve it before setting theme
|
|
32
|
-
if (theme === "system" && enableSystem) {
|
|
33
|
-
resolved = getSystemTheme();
|
|
34
|
-
}
|
|
35
|
-
const name = value ? value[resolved] : resolved;
|
|
36
|
-
const enable = disableTransitionOnChange ? disableAnimation() : null;
|
|
37
|
-
const d = document.documentElement;
|
|
38
|
-
if (attribute === "class") {
|
|
39
|
-
d.classList.remove(...attrs);
|
|
40
|
-
if (name) d.classList.add(name);
|
|
41
|
-
} else {
|
|
42
|
-
if (name) {
|
|
43
|
-
d.setAttribute(attribute, name);
|
|
44
|
-
} else {
|
|
45
|
-
d.removeAttribute(attribute);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (enableColorScheme) {
|
|
49
|
-
const fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : "";
|
|
50
|
-
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
|
|
51
|
-
d.style.colorScheme = colorScheme;
|
|
52
|
-
}
|
|
53
|
-
enable?.();
|
|
54
|
-
}, [
|
|
55
|
-
attribute,
|
|
56
|
-
attrs,
|
|
57
|
-
defaultTheme,
|
|
58
|
-
disableTransitionOnChange,
|
|
59
|
-
enableColorScheme,
|
|
60
|
-
enableSystem,
|
|
61
|
-
value
|
|
62
|
-
]);
|
|
63
|
-
const setTheme = useCallback((theme)=>{
|
|
64
|
-
setThemeState(theme);
|
|
65
|
-
// Save to storage
|
|
66
|
-
try {
|
|
67
|
-
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
68
|
-
} catch (e) {
|
|
69
|
-
// Unsupported
|
|
70
|
-
}
|
|
71
|
-
}, []);
|
|
72
|
-
const handleMediaQuery = useCallback((e)=>{
|
|
73
|
-
const resolved = getSystemTheme(e);
|
|
74
|
-
setResolvedTheme(resolved);
|
|
75
|
-
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
76
|
-
applyTheme("system");
|
|
77
|
-
}
|
|
78
|
-
}, [
|
|
79
|
-
theme,
|
|
80
|
-
enableSystem,
|
|
81
|
-
forcedTheme,
|
|
82
|
-
applyTheme
|
|
83
|
-
]);
|
|
84
|
-
// Always listen to System preference
|
|
85
|
-
useEffect(()=>{
|
|
86
|
-
const media = window.matchMedia(MEDIA);
|
|
87
|
-
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
88
|
-
media.addListener(handleMediaQuery);
|
|
89
|
-
handleMediaQuery(media);
|
|
90
|
-
return ()=>media.removeListener(handleMediaQuery);
|
|
91
|
-
}, [
|
|
92
|
-
handleMediaQuery
|
|
93
|
-
]);
|
|
94
|
-
// localStorage event handling
|
|
95
|
-
useEffect(()=>{
|
|
96
|
-
const handleStorage = (e)=>{
|
|
97
|
-
if (e.key !== THEME_STORAGE_KEY) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
101
|
-
const theme = e.newValue || defaultTheme;
|
|
102
|
-
setTheme(theme);
|
|
103
|
-
};
|
|
104
|
-
window.addEventListener("storage", handleStorage);
|
|
105
|
-
return ()=>window.removeEventListener("storage", handleStorage);
|
|
106
|
-
}, [
|
|
107
|
-
defaultTheme,
|
|
108
|
-
setTheme
|
|
109
|
-
]);
|
|
110
|
-
// Whenever theme or forcedTheme changes, apply it
|
|
111
|
-
useEffect(()=>{
|
|
112
|
-
applyTheme(forcedTheme ?? theme);
|
|
113
|
-
}, [
|
|
114
|
-
applyTheme,
|
|
115
|
-
forcedTheme,
|
|
116
|
-
theme
|
|
117
|
-
]);
|
|
118
|
-
return /*#__PURE__*/ _jsxs(ThemeContext.Provider, {
|
|
119
|
-
value: {
|
|
120
|
-
theme,
|
|
121
|
-
setTheme,
|
|
122
|
-
forcedTheme,
|
|
123
|
-
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
124
|
-
themes: enableSystem ? [
|
|
125
|
-
...themes,
|
|
126
|
-
"system"
|
|
127
|
-
] : themes,
|
|
128
|
-
systemTheme: enableSystem ? resolvedTheme : undefined
|
|
129
|
-
},
|
|
130
|
-
children: [
|
|
131
|
-
/*#__PURE__*/ _jsx(ThemeScript, {
|
|
132
|
-
forcedTheme,
|
|
133
|
-
disableTransitionOnChange,
|
|
134
|
-
enableSystem,
|
|
135
|
-
enableColorScheme,
|
|
136
|
-
themes,
|
|
137
|
-
defaultTheme,
|
|
138
|
-
attribute,
|
|
139
|
-
value,
|
|
140
|
-
children,
|
|
141
|
-
attrs,
|
|
142
|
-
nonce
|
|
143
|
-
}),
|
|
144
|
-
children
|
|
145
|
-
]
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
const ThemeScript = /*#__PURE__*/ memo(({ forcedTheme, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce })=>{
|
|
149
|
-
const defaultSystem = defaultTheme === "system";
|
|
150
|
-
// Code-golfing the amount of characters in the script
|
|
151
|
-
const optimization = (()=>{
|
|
152
|
-
const removeClasses = `d.remove(${attrs.map((t)=>`'${t}'`).join(",")})`;
|
|
153
|
-
return `var d=document.documentElement.classList;${removeClasses};`;
|
|
154
|
-
})();
|
|
155
|
-
const fallbackColorScheme = (()=>{
|
|
156
|
-
if (!enableColorScheme) {
|
|
157
|
-
return "";
|
|
158
|
-
}
|
|
159
|
-
const fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : null;
|
|
160
|
-
if (fallback) {
|
|
161
|
-
return `if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${defaultTheme}'`;
|
|
162
|
-
} else {
|
|
163
|
-
return `if(e==='light'||e==='dark')d.style.colorScheme=e`;
|
|
164
|
-
}
|
|
165
|
-
})();
|
|
166
|
-
const updateDOM = (name, literal = false, setColorScheme = true)=>{
|
|
167
|
-
const resolvedName = value ? value[name] : name;
|
|
168
|
-
const val = literal ? name + `|| ''` : `'${resolvedName}'`;
|
|
169
|
-
let text = "";
|
|
170
|
-
// MUCH faster to set colorScheme alongside HTML attribute/class
|
|
171
|
-
// as it only incurs 1 style recalculation rather than 2
|
|
172
|
-
// This can save over 250ms of work for pages with big DOM
|
|
173
|
-
if (enableColorScheme && setColorScheme && !literal && colorSchemes.includes(name)) {
|
|
174
|
-
text += `d.style.colorScheme = '${name}';`;
|
|
175
|
-
}
|
|
176
|
-
if (attribute === "class") {
|
|
177
|
-
if (literal || resolvedName) {
|
|
178
|
-
text += `d.add(${val})`;
|
|
179
|
-
} else {
|
|
180
|
-
text += `null`;
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
if (resolvedName) {
|
|
184
|
-
text += `d[s](n, ${val})`;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return text;
|
|
188
|
-
};
|
|
189
|
-
const scriptSrc = (()=>{
|
|
190
|
-
if (forcedTheme) {
|
|
191
|
-
return `!function(){${optimization}${updateDOM(forcedTheme)}}()`;
|
|
192
|
-
}
|
|
193
|
-
if (enableSystem) {
|
|
194
|
-
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 ? `else{` + updateDOM(defaultTheme, false, false) + "}" : ""}${fallbackColorScheme}}catch(e){}}()`;
|
|
195
|
-
}
|
|
196
|
-
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){}}();`;
|
|
197
|
-
})();
|
|
198
|
-
// We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
|
|
199
|
-
// However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
|
|
200
|
-
// But our script cannot be external because it changes at runtime based on React props
|
|
201
|
-
// so we trick next/script by passing `src` as a base64 JS script
|
|
202
|
-
const encodedScript = `data:text/javascript;base64,${encodeBase64(scriptSrc)}`;
|
|
203
|
-
return /*#__PURE__*/ _jsx(NextScript, {
|
|
204
|
-
id: "next-theme-script",
|
|
205
|
-
strategy: "beforeInteractive",
|
|
206
|
-
src: encodedScript,
|
|
207
|
-
nonce: nonce
|
|
208
|
-
});
|
|
209
|
-
}, // Never re-render this component
|
|
210
|
-
()=>true);
|
|
211
|
-
// Helpers
|
|
212
|
-
const getTheme = (key, fallback)=>{
|
|
213
|
-
if (isServer) return undefined;
|
|
214
|
-
let theme;
|
|
215
|
-
try {
|
|
216
|
-
theme = localStorage.getItem(key) || undefined;
|
|
217
|
-
} catch (e) {
|
|
218
|
-
// Unsupported
|
|
219
|
-
}
|
|
220
|
-
return theme || fallback;
|
|
221
|
-
};
|
|
222
|
-
const disableAnimation = ()=>{
|
|
223
|
-
const d = document;
|
|
224
|
-
const css = d.createElement("style");
|
|
225
|
-
css.appendChild(d.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
|
|
226
|
-
d.head.appendChild(css);
|
|
227
|
-
return ()=>{
|
|
228
|
-
// Force restyle
|
|
229
|
-
(()=>window.getComputedStyle(d.body))();
|
|
230
|
-
// Wait for next tick before removing
|
|
231
|
-
setTimeout(()=>{
|
|
232
|
-
d.head.removeChild(css);
|
|
233
|
-
}, 1);
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
const getSystemTheme = (e)=>{
|
|
237
|
-
if (!e) e = window.matchMedia(MEDIA);
|
|
238
|
-
const isDark = e.matches;
|
|
239
|
-
const systemTheme = isDark ? "dark" : "light";
|
|
240
|
-
return systemTheme;
|
|
241
|
-
};
|
|
242
|
-
const encodeBase64 = (str)=>{
|
|
243
|
-
return isServer ? Buffer.from(str).toString("base64") : btoa(str);
|
|
244
|
-
};
|
|
245
|
-
export default ThemeProvider;
|
package/12/TransText.d.ts
DELETED
package/12/TransText.mjs
DELETED
package/12/app/AppHead.d.ts
DELETED
package/12/app/AppHead.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Head from "next/head";
|
|
3
|
-
import React from "react";
|
|
4
|
-
export const AppHead = ()=>{
|
|
5
|
-
return /*#__PURE__*/ _jsx(Head, {
|
|
6
|
-
children: /*#__PURE__*/ _jsx("meta", {
|
|
7
|
-
name: "viewport",
|
|
8
|
-
content: "width=device-width"
|
|
9
|
-
})
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export default AppHead;
|
package/12/app/AppMain.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { HTMLMotionProps } from "framer-motion";
|
|
2
|
-
import type { AppProps as NextAppProps } from "next/app";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import type { MotionProviderFeatures } from "@koine/react/m";
|
|
5
|
-
import type { NextProgressProps } from "../NextProgress";
|
|
6
|
-
import type { SeoDefaultsProps } from "../SeoDefaults";
|
|
7
|
-
export 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 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/12/app/AppMain.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
package/12/app/css/AppMain.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AppMainBaseProps } from "../AppMain";
|
|
2
|
-
export type AppMainProps = Omit<AppMainBaseProps, "ProgressOverlay">;
|
|
3
|
-
/**
|
|
4
|
-
* App main
|
|
5
|
-
*
|
|
6
|
-
* It does not imply any specific styling or animation solution
|
|
7
|
-
*/
|
|
8
|
-
export declare const AppMain: ({ Component, pageProps, Layout, seo, pre, post, }: AppMainProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export default AppMain;
|
package/12/app/css/AppMain.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { SeoDefaults } from "../../SeoDefaults";
|
|
4
|
-
/**
|
|
5
|
-
* App main
|
|
6
|
-
*
|
|
7
|
-
* It does not imply any specific styling or animation solution
|
|
8
|
-
*/ export const AppMain = ({ Component, pageProps, Layout, seo, pre, post })=>{
|
|
9
|
-
return /*#__PURE__*/ _jsxs(React.Fragment, {
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ _jsx(SeoDefaults, {
|
|
12
|
-
...seo
|
|
13
|
-
}),
|
|
14
|
-
pre,
|
|
15
|
-
/*#__PURE__*/ _jsx(Layout, {
|
|
16
|
-
children: /*#__PURE__*/ _jsx(Component, {
|
|
17
|
-
...pageProps
|
|
18
|
-
})
|
|
19
|
-
}),
|
|
20
|
-
post
|
|
21
|
-
]
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
export default AppMain;
|
package/12/app/css/AppTheme.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type AppProps as NextAppProps } from "next/app";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { type ThemeProviderProps } from "../../ThemeProvider";
|
|
4
|
-
export 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) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default AppTheme;
|
package/12/app/css/AppTheme.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
// import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react/styles";
|
|
4
|
-
import { ThemeProvider } from "../../ThemeProvider";
|
|
5
|
-
/**
|
|
6
|
-
* App theme with vanilla class based theme (good for `tailwindcss`)
|
|
7
|
-
*/ export const AppTheme = ({ theme, children })=>{
|
|
8
|
-
// return (
|
|
9
|
-
// <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
|
|
10
|
-
// );
|
|
11
|
-
return /*#__PURE__*/ _jsx(ThemeProvider, {
|
|
12
|
-
defaultTheme: theme,
|
|
13
|
-
attribute: "class",
|
|
14
|
-
children: children
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
export default AppTheme;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AppProps } from "next/app";
|
|
2
|
-
import { type AppMainProps } from "../AppMain";
|
|
3
|
-
import { type AppThemeProps } from "../AppTheme";
|
|
4
|
-
export type NextAppProps = AppProps<{
|
|
5
|
-
session: any;
|
|
6
|
-
}> & AppThemeProps & AppMainProps;
|
|
7
|
-
/**
|
|
8
|
-
* App with authentication provided by `next-auth`
|
|
9
|
-
*/
|
|
10
|
-
export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default NextApp;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SessionProvider } from "next-auth/react";
|
|
3
|
-
import { AppHead } from "../../AppHead";
|
|
4
|
-
import { AppMain } from "../AppMain";
|
|
5
|
-
import { AppTheme } from "../AppTheme";
|
|
6
|
-
/**
|
|
7
|
-
* App with authentication provided by `next-auth`
|
|
8
|
-
*/ export const NextApp = (props)=>{
|
|
9
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ _jsx(AppHead, {}),
|
|
12
|
-
/*#__PURE__*/ _jsx(SessionProvider, {
|
|
13
|
-
session: props.pageProps.session,
|
|
14
|
-
children: /*#__PURE__*/ _jsx(AppTheme, {
|
|
15
|
-
...props,
|
|
16
|
-
children: /*#__PURE__*/ _jsx(AppMain, {
|
|
17
|
-
...props
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
]
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
export default NextApp;
|
package/12/app/css/index.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AppProps } from "next/app";
|
|
2
|
-
import { type AppMainProps } from "./AppMain";
|
|
3
|
-
import { type AppThemeProps } from "./AppTheme";
|
|
4
|
-
export type NextAppProps = AppProps & AppThemeProps & AppMainProps;
|
|
5
|
-
/**
|
|
6
|
-
* App
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
*
|
|
10
|
-
* ```tsx
|
|
11
|
-
* import { NextApp, NextAppProps } from "@koine/next/app/css/auth";
|
|
12
|
-
* import { Favicon, AnalyticsGoogle } from "@koine/next";
|
|
13
|
-
* import { theme } from "src/helpers/theme";
|
|
14
|
-
* import { Layout } from "src/components/Layout";
|
|
15
|
-
* // import "@fontsource/myfont/800.css";
|
|
16
|
-
* // import "src/helpers/theme.css";
|
|
17
|
-
*
|
|
18
|
-
* const motion = () => import("@koine/react/m/max").then((m) => m.default);
|
|
19
|
-
*
|
|
20
|
-
* export default function App(props: NextAppProps) {
|
|
21
|
-
* return (
|
|
22
|
-
* <NextApp
|
|
23
|
-
* {...props}
|
|
24
|
-
* Layout={Layout}
|
|
25
|
-
* theme={theme}
|
|
26
|
-
* seo={{
|
|
27
|
-
* titleTemplate: "%s | MyApp",
|
|
28
|
-
* defaultTitle: "MyApp",
|
|
29
|
-
* openGraph: {
|
|
30
|
-
* type: "website",
|
|
31
|
-
* locale: "en_US",
|
|
32
|
-
* url: "https://myapp.com/",
|
|
33
|
-
* site_name: "MyApp",
|
|
34
|
-
* },
|
|
35
|
-
* twitter: {
|
|
36
|
-
* handle: "@MklrNl",
|
|
37
|
-
* site: "@MyApp",
|
|
38
|
-
* cardType: "summary_large_image",
|
|
39
|
-
* },
|
|
40
|
-
* }}
|
|
41
|
-
* pre={
|
|
42
|
-
* <>
|
|
43
|
-
* <AnalyticsGoogle id="UA-xxxxxxxx-x" />
|
|
44
|
-
* <Favicon name="MyApp" color="#000000" />
|
|
45
|
-
* </>
|
|
46
|
-
* }
|
|
47
|
-
* />
|
|
48
|
-
* );
|
|
49
|
-
* }
|
|
50
|
-
*
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare const NextApp: (props: NextAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
54
|
-
export default NextApp;
|
package/12/app/css/index.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { AppHead } from "../AppHead";
|
|
3
|
-
import { AppMain } from "./AppMain";
|
|
4
|
-
import { AppTheme } from "./AppTheme";
|
|
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
|
-
*/ export const NextApp = (props)=>{
|
|
53
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
54
|
-
children: [
|
|
55
|
-
/*#__PURE__*/ _jsx(AppHead, {}),
|
|
56
|
-
/*#__PURE__*/ _jsx(AppTheme, {
|
|
57
|
-
...props,
|
|
58
|
-
children: /*#__PURE__*/ _jsx(AppMain, {
|
|
59
|
-
...props
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
]
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
export default NextApp;
|
package/12/app/index.d.ts
DELETED
package/12/app/index.mjs
DELETED
package/12/app/sc/AppMain.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AppMainBaseProps, AppMainFramerProps } from "../AppMain";
|
|
2
|
-
export type AppMainProps = AppMainBaseProps & AppMainFramerProps;
|
|
3
|
-
/**
|
|
4
|
-
* App main
|
|
5
|
-
*
|
|
6
|
-
* It implies a setup for `styled-components` and `framer-motion` libraries.
|
|
7
|
-
*
|
|
8
|
-
* About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
|
|
9
|
-
*/
|
|
10
|
-
export declare const AppMain: ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition, pre, post, }: AppMainProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default AppMain;
|
package/12/app/sc/AppMain.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import { AnimatePresence, m } from "framer-motion";
|
|
4
|
-
import { useRouter } from "next/router";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { MotionProvider } from "@koine/react/m";
|
|
7
|
-
import { NextProgress } from "../../NextProgress";
|
|
8
|
-
import { SeoDefaults } from "../../SeoDefaults";
|
|
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
|
-
*/ export const AppMain = ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition = {
|
|
16
|
-
initial: {
|
|
17
|
-
opacity: 0
|
|
18
|
-
},
|
|
19
|
-
animate: {
|
|
20
|
-
opacity: 1
|
|
21
|
-
},
|
|
22
|
-
exit: {
|
|
23
|
-
opacity: 0
|
|
24
|
-
}
|
|
25
|
-
}, pre, post })=>{
|
|
26
|
-
const { pathname } = useRouter();
|
|
27
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
28
|
-
children: [
|
|
29
|
-
/*#__PURE__*/ _jsx(SeoDefaults, {
|
|
30
|
-
...seo
|
|
31
|
-
}),
|
|
32
|
-
pre,
|
|
33
|
-
/*#__PURE__*/ _jsxs(MotionProvider, {
|
|
34
|
-
features: motion,
|
|
35
|
-
children: [
|
|
36
|
-
ProgressOverlay && /*#__PURE__*/ _jsx(NextProgress, {
|
|
37
|
-
Overlay: ProgressOverlay
|
|
38
|
-
}),
|
|
39
|
-
/*#__PURE__*/ _jsx(Layout, {
|
|
40
|
-
children: /*#__PURE__*/ _jsx(AnimatePresence, {
|
|
41
|
-
exitBeforeEnter: true,
|
|
42
|
-
initial: false,
|
|
43
|
-
children: /*#__PURE__*/ _jsx(m.div, {
|
|
44
|
-
...transition,
|
|
45
|
-
children: /*#__PURE__*/ _createElement(Component, {
|
|
46
|
-
...pageProps,
|
|
47
|
-
key: pathname
|
|
48
|
-
})
|
|
49
|
-
}, pathname)
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
]
|
|
53
|
-
}),
|
|
54
|
-
post
|
|
55
|
-
]
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
export default AppMain;
|
package/12/app/sc/AppTheme.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type AppProps as NextAppProps } from "next/app";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Theme } from "@koine/react/sc";
|
|
4
|
-
export type AppThemeProps = React.PropsWithChildren<NextAppProps & {
|
|
5
|
-
/**
|
|
6
|
-
* A theme object
|
|
7
|
-
*/
|
|
8
|
-
theme: Theme;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* App theme with `styled-components`
|
|
12
|
-
*/
|
|
13
|
-
export declare const AppTheme: ({ theme, children }: AppThemeProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export default AppTheme;
|