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