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