@koine/next 1.1.9 → 1.1.11
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 +19 -15
- package/AnalyticsGoogle.mjs +34 -0
- package/DisableErrorOverlay.js +10 -5
- package/DisableErrorOverlay.mjs +13 -0
- package/DynamicNamespaces.js +7 -3
- package/DynamicNamespaces.mjs +8 -0
- package/Favicon.js +10 -6
- package/Favicon.mjs +6 -0
- package/Head.js +7 -3
- package/Head.mjs +3 -0
- package/Link.js +11 -8
- package/Link.mjs +12 -0
- package/NextProgress.js +16 -12
- package/{node/NextProgress.js → NextProgress.mjs} +12 -16
- package/Seo.js +11 -6
- package/{node/Seo.js → Seo.mjs} +6 -11
- package/SeoDefaults.js +11 -6
- package/SeoDefaults.mjs +12 -0
- package/T.js +9 -5
- package/T.mjs +10 -0
- package/ThemeContext.js +6 -3
- package/ThemeContext.mjs +7 -0
- package/ThemeProvider.js +28 -24
- package/{node/ThemeProvider.js → ThemeProvider.mjs} +24 -28
- package/TransText.js +7 -3
- package/TransText.mjs +3 -0
- package/app/AppHead.js +10 -5
- package/app/AppHead.mjs +6 -0
- package/app/AppMain.js +2 -1
- package/app/AppMain.mjs +1 -0
- package/app/css/AppMain.js +11 -7
- package/app/css/AppMain.mjs +14 -0
- package/app/css/AppTheme.js +10 -6
- package/app/css/AppTheme.mjs +15 -0
- package/app/css/auth/index.js +13 -9
- package/app/css/auth/index.mjs +13 -0
- package/app/css/auth/package.json +2 -2
- package/app/css/index.d.ts +2 -2
- package/app/css/index.js +12 -8
- package/{node/app/css/index.js → app/css/index.mjs} +8 -12
- package/app/css/package.json +2 -2
- package/app/em/AppMain.js +16 -12
- package/app/em/AppMain.mjs +25 -0
- package/app/em/AppTheme.js +16 -12
- package/app/em/AppTheme.mjs +19 -0
- package/app/em/auth/index.js +13 -9
- package/app/em/auth/index.mjs +13 -0
- package/app/em/auth/package.json +2 -2
- package/app/em/index.js +12 -8
- package/app/em/index.mjs +12 -0
- package/app/em/package.json +2 -2
- package/app/index.js +5 -2
- package/app/index.mjs +2 -0
- package/app/package.json +2 -2
- package/app/sc/AppMain.js +16 -12
- package/app/sc/AppMain.mjs +25 -0
- package/app/sc/AppTheme.js +11 -7
- package/app/sc/AppTheme.mjs +12 -0
- package/app/sc/auth/index.js +13 -9
- package/app/sc/auth/index.mjs +13 -0
- package/app/sc/auth/package.json +2 -2
- package/app/sc/index.js +12 -8
- package/{node/app/sc/index.js → app/sc/index.mjs} +8 -12
- package/app/sc/package.json +2 -2
- package/auth/helpers.js +13 -7
- package/auth/helpers.mjs +22 -0
- package/auth/index.js +7 -4
- package/auth/index.mjs +4 -0
- package/auth/package.json +2 -2
- package/auth/useLogin.d.ts +1 -1
- package/auth/useLogin.js +22 -18
- package/auth/useLogin.mjs +50 -0
- package/auth/useLoginUrl.js +13 -9
- package/auth/useLoginUrl.mjs +12 -0
- package/auth/useLogout.js +23 -18
- package/auth/useLogout.mjs +53 -0
- package/config/index.js +36 -25
- package/{node/config/index.js → config/index.mjs} +25 -36
- package/config/package.json +2 -2
- package/createEmotionCache.js +9 -4
- package/createEmotionCache.mjs +9 -0
- package/document/Document.js +13 -10
- package/document/Document.mjs +28 -0
- package/document/css/index.js +18 -15
- package/document/css/index.mjs +45 -0
- package/document/css/package.json +2 -2
- package/document/em/index.js +22 -19
- package/document/em/index.mjs +60 -0
- package/document/em/package.json +2 -2
- package/document/index.js +7 -2
- package/document/index.mjs +2 -0
- package/document/package.json +2 -2
- package/document/sc/index.js +21 -18
- package/document/sc/index.mjs +64 -0
- package/document/sc/package.json +2 -2
- package/getSiteUrl.js +9 -4
- package/getSiteUrl.mjs +12 -0
- package/getT.js +7 -3
- package/{node/getT.js → getT.mjs} +3 -7
- package/index.js +31 -28
- package/index.mjs +30 -0
- package/load.js +6 -2
- package/{node/load.js → load.mjs} +2 -6
- package/package.json +8 -9
- package/revalidate.js +5 -2
- package/revalidate.mjs +5 -0
- package/seoBuildTags.js +17 -13
- package/{node/seoBuildTags.js → seoBuildTags.mjs} +13 -17
- package/to.js +6 -2
- package/{node/to.js → to.mjs} +2 -6
- package/translationAsOptions.js +5 -1
- package/{node/translationAsOptions.js → translationAsOptions.mjs} +1 -5
- package/types-i18n.js +2 -1
- package/{node/types-i18n.js → types-i18n.mjs} +1 -2
- package/types-seo.js +2 -1
- package/types-seo.mjs +1 -0
- package/useBackUrl.js +15 -10
- package/{node/useBackUrl.js → useBackUrl.mjs} +10 -14
- package/useDateFormat.js +17 -13
- package/{node/useDateFormat.js → useDateFormat.mjs} +13 -17
- package/useForm.js +14 -10
- package/{node/useForm.js → useForm.mjs} +10 -14
- package/useLocale.js +9 -4
- package/useLocale.mjs +5 -0
- package/useT.js +11 -6
- package/{node/useT.js → useT.mjs} +6 -11
- package/useTheme.js +8 -4
- package/useTheme.mjs +7 -0
- package/useTo.js +11 -7
- package/useTo.mjs +14 -0
- package/NextImg.d.ts +0 -16
- package/NextImg.js +0 -20
- package/NextImgSmart.d.ts +0 -6
- package/NextImgSmart.js +0 -13
- package/node/AnalyticsGoogle.js +0 -38
- package/node/DisableErrorOverlay.js +0 -18
- package/node/DynamicNamespaces.js +0 -12
- package/node/Favicon.js +0 -10
- package/node/Head.js +0 -7
- package/node/Link.js +0 -15
- package/node/SeoDefaults.js +0 -17
- package/node/T.js +0 -14
- package/node/ThemeContext.js +0 -10
- package/node/TransText.js +0 -7
- package/node/app/AppHead.js +0 -11
- package/node/app/AppMain.js +0 -2
- package/node/app/css/AppMain.js +0 -18
- package/node/app/css/AppTheme.js +0 -19
- package/node/app/css/auth/index.js +0 -17
- package/node/app/em/AppMain.js +0 -29
- package/node/app/em/AppTheme.js +0 -23
- package/node/app/em/auth/index.js +0 -17
- package/node/app/em/index.js +0 -16
- package/node/app/index.js +0 -5
- package/node/app/sc/AppMain.js +0 -29
- package/node/app/sc/AppTheme.js +0 -16
- package/node/app/sc/auth/index.js +0 -17
- package/node/auth/helpers.js +0 -27
- package/node/auth/index.js +0 -7
- package/node/auth/useLogin.js +0 -54
- package/node/auth/useLoginUrl.js +0 -16
- package/node/auth/useLogout.js +0 -57
- package/node/createEmotionCache.js +0 -14
- package/node/document/Document.js +0 -31
- package/node/document/css/index.js +0 -48
- package/node/document/em/index.js +0 -63
- package/node/document/index.js +0 -7
- package/node/document/sc/index.js +0 -67
- package/node/getSiteUrl.js +0 -16
- package/node/index.js +0 -33
- package/node/revalidate.js +0 -8
- package/node/types-seo.js +0 -2
- package/node/useLocale.js +0 -10
- package/node/useTheme.js +0 -11
- package/node/useTo.js +0 -18
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var script_1 = tslib_1.__importDefault(require("next/script"));
|
|
8
|
-
var utils_1 = require("@koine/utils");
|
|
9
|
-
var ThemeContext_1 = require("./ThemeContext");
|
|
1
|
+
import { __assign, __spreadArray } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useState, memo } from "react";
|
|
4
|
+
import NextScript from "next/script";
|
|
5
|
+
import isServer from "@koine/utils/isServer";
|
|
6
|
+
import { ThemeContext } from "./ThemeContext";
|
|
10
7
|
var colorSchemes = ["light", "dark"];
|
|
11
8
|
var MEDIA = "(prefers-color-scheme: dark)";
|
|
12
9
|
var THEME_STORAGE_KEY = "theme";
|
|
@@ -19,19 +16,19 @@ var THEME_STORAGE_KEY = "theme";
|
|
|
19
16
|
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
20
17
|
* controlled by tailwind modifiers
|
|
21
18
|
*/
|
|
22
|
-
var ThemeProvider = function (_a) {
|
|
19
|
+
export var ThemeProvider = function (_a) {
|
|
23
20
|
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;
|
|
24
|
-
var _g =
|
|
21
|
+
var _g = useState(function () {
|
|
25
22
|
return getTheme(THEME_STORAGE_KEY, defaultTheme);
|
|
26
23
|
}), theme = _g[0], setThemeState = _g[1];
|
|
27
|
-
var _h =
|
|
24
|
+
var _h = useState(function () {
|
|
28
25
|
return getTheme(THEME_STORAGE_KEY);
|
|
29
26
|
}), resolvedTheme = _h[0], setResolvedTheme = _h[1];
|
|
30
27
|
var attrs = !value ? themes : Object.values(value);
|
|
31
|
-
var applyTheme =
|
|
28
|
+
var applyTheme = useCallback(function (theme) {
|
|
32
29
|
var _a;
|
|
33
30
|
var resolved = theme;
|
|
34
|
-
if (
|
|
31
|
+
if (isServer || !resolved)
|
|
35
32
|
return;
|
|
36
33
|
// If theme is system, resolve it before setting theme
|
|
37
34
|
if (theme === "system" && enableSystem) {
|
|
@@ -72,7 +69,7 @@ var ThemeProvider = function (_a) {
|
|
|
72
69
|
enableSystem,
|
|
73
70
|
value,
|
|
74
71
|
]);
|
|
75
|
-
var setTheme =
|
|
72
|
+
var setTheme = useCallback(function (theme) {
|
|
76
73
|
setThemeState(theme);
|
|
77
74
|
// Save to storage
|
|
78
75
|
try {
|
|
@@ -82,7 +79,7 @@ var ThemeProvider = function (_a) {
|
|
|
82
79
|
// Unsupported
|
|
83
80
|
}
|
|
84
81
|
}, []);
|
|
85
|
-
var handleMediaQuery =
|
|
82
|
+
var handleMediaQuery = useCallback(function (e) {
|
|
86
83
|
var resolved = getSystemTheme(e);
|
|
87
84
|
setResolvedTheme(resolved);
|
|
88
85
|
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
@@ -90,7 +87,7 @@ var ThemeProvider = function (_a) {
|
|
|
90
87
|
}
|
|
91
88
|
}, [theme, enableSystem, forcedTheme, applyTheme]);
|
|
92
89
|
// Always listen to System preference
|
|
93
|
-
|
|
90
|
+
useEffect(function () {
|
|
94
91
|
var media = window.matchMedia(MEDIA);
|
|
95
92
|
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
96
93
|
media.addListener(handleMediaQuery);
|
|
@@ -98,7 +95,7 @@ var ThemeProvider = function (_a) {
|
|
|
98
95
|
return function () { return media.removeListener(handleMediaQuery); };
|
|
99
96
|
}, [handleMediaQuery]);
|
|
100
97
|
// localStorage event handling
|
|
101
|
-
|
|
98
|
+
useEffect(function () {
|
|
102
99
|
var handleStorage = function (e) {
|
|
103
100
|
if (e.key !== THEME_STORAGE_KEY) {
|
|
104
101
|
return;
|
|
@@ -111,17 +108,17 @@ var ThemeProvider = function (_a) {
|
|
|
111
108
|
return function () { return window.removeEventListener("storage", handleStorage); };
|
|
112
109
|
}, [defaultTheme, setTheme]);
|
|
113
110
|
// Whenever theme or forcedTheme changes, apply it
|
|
114
|
-
|
|
111
|
+
useEffect(function () {
|
|
115
112
|
applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
|
|
116
113
|
}, [applyTheme, forcedTheme, theme]);
|
|
117
|
-
return ((
|
|
114
|
+
return (_jsxs(ThemeContext.Provider, __assign({ value: {
|
|
118
115
|
theme: theme,
|
|
119
116
|
setTheme: setTheme,
|
|
120
117
|
forcedTheme: forcedTheme,
|
|
121
118
|
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
122
|
-
themes: enableSystem ?
|
|
119
|
+
themes: enableSystem ? __spreadArray(__spreadArray([], themes, true), ["system"], false) : themes,
|
|
123
120
|
systemTheme: (enableSystem ? resolvedTheme : undefined),
|
|
124
|
-
} }, { children: [(
|
|
121
|
+
} }, { children: [_jsx(ThemeScript, __assign({}, {
|
|
125
122
|
forcedTheme: forcedTheme,
|
|
126
123
|
disableTransitionOnChange: disableTransitionOnChange,
|
|
127
124
|
enableSystem: enableSystem,
|
|
@@ -135,8 +132,7 @@ var ThemeProvider = function (_a) {
|
|
|
135
132
|
nonce: nonce,
|
|
136
133
|
})), children] })));
|
|
137
134
|
};
|
|
138
|
-
|
|
139
|
-
var ThemeScript = (0, react_1.memo)(function (_a) {
|
|
135
|
+
var ThemeScript = memo(function (_a) {
|
|
140
136
|
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;
|
|
141
137
|
var defaultSystem = defaultTheme === "system";
|
|
142
138
|
// Code-golfing the amount of characters in the script
|
|
@@ -206,13 +202,13 @@ var ThemeScript = (0, react_1.memo)(function (_a) {
|
|
|
206
202
|
// But our script cannot be external because it changes at runtime based on React props
|
|
207
203
|
// so we trick next/script by passing `src` as a base64 JS script
|
|
208
204
|
var encodedScript = "data:text/javascript;base64,".concat(encodeBase64(scriptSrc));
|
|
209
|
-
return ((
|
|
205
|
+
return (_jsx(NextScript, { id: "next-theme-script", strategy: "beforeInteractive", src: encodedScript, nonce: nonce }));
|
|
210
206
|
},
|
|
211
207
|
// Never re-render this component
|
|
212
208
|
function () { return true; });
|
|
213
209
|
// Helpers
|
|
214
210
|
var getTheme = function (key, fallback) {
|
|
215
|
-
if (
|
|
211
|
+
if (isServer)
|
|
216
212
|
return undefined;
|
|
217
213
|
var theme;
|
|
218
214
|
try {
|
|
@@ -245,6 +241,6 @@ var getSystemTheme = function (e) {
|
|
|
245
241
|
return systemTheme;
|
|
246
242
|
};
|
|
247
243
|
var encodeBase64 = function (str) {
|
|
248
|
-
return
|
|
244
|
+
return isServer ? Buffer.from(str).toString("base64") : btoa(str);
|
|
249
245
|
};
|
|
250
|
-
|
|
246
|
+
export default ThemeProvider;
|
package/TransText.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransText = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var TransText_1 = tslib_1.__importDefault(require("next-translate/TransText"));
|
|
6
|
+
exports.TransText = TransText_1.default;
|
|
7
|
+
exports.default = exports.TransText;
|
package/TransText.mjs
ADDED
package/app/AppHead.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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" }) }));
|
|
5
9
|
};
|
|
6
|
-
|
|
10
|
+
exports.AppHead = AppHead;
|
|
11
|
+
exports.default = exports.AppHead;
|
package/app/AppHead.mjs
ADDED
package/app/AppMain.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/app/AppMain.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/app/css/AppMain.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
5
8
|
/**
|
|
6
9
|
* App main
|
|
7
10
|
*
|
|
8
11
|
* It does not imply any specific styling or animation solution
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
var AppMain = function (_a) {
|
|
11
14
|
var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, seo = _a.seo, pre = _a.pre, post = _a.post;
|
|
12
|
-
return (
|
|
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] }));
|
|
13
16
|
};
|
|
14
|
-
|
|
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;
|
package/app/css/AppTheme.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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");
|
|
3
6
|
// import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react/styles";
|
|
4
|
-
|
|
7
|
+
var ThemeProvider_1 = require("../../ThemeProvider");
|
|
5
8
|
/**
|
|
6
9
|
* App theme with vanilla class based theme (good for `tailwindcss`)
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
var AppTheme = function (_a) {
|
|
9
12
|
var theme = _a.theme, children = _a.children;
|
|
10
13
|
// return (
|
|
11
14
|
// <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
|
|
12
15
|
// );
|
|
13
|
-
return (
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(ThemeProvider_1.ThemeProvider, tslib_1.__assign({ defaultTheme: theme, attribute: "class" }, { children: children })));
|
|
14
17
|
};
|
|
15
|
-
|
|
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;
|
package/app/css/auth/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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");
|
|
7
10
|
/**
|
|
8
11
|
* App with authentication provided by `next-auth`
|
|
9
12
|
*/
|
|
10
|
-
|
|
11
|
-
return (
|
|
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)) })) }))] }));
|
|
12
15
|
};
|
|
13
|
-
|
|
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;
|
package/app/css/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppProps } from "next/app";
|
|
2
|
-
import { AppThemeProps } from "./AppTheme";
|
|
3
|
-
import { AppMainProps } from "./AppMain";
|
|
2
|
+
import { type AppThemeProps } from "./AppTheme";
|
|
3
|
+
import { type AppMainProps } from "./AppMain";
|
|
4
4
|
export type NextAppProps = AppProps & AppThemeProps & AppMainProps;
|
|
5
5
|
/**
|
|
6
6
|
* App
|
package/app/css/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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");
|
|
6
9
|
/**
|
|
7
10
|
* App
|
|
8
11
|
*
|
|
@@ -51,7 +54,8 @@ import { AppMain } from "./AppMain";
|
|
|
51
54
|
*
|
|
52
55
|
* ```
|
|
53
56
|
*/
|
|
54
|
-
|
|
55
|
-
return (
|
|
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)) }))] }));
|
|
56
59
|
};
|
|
57
|
-
|
|
60
|
+
exports.NextApp = NextApp;
|
|
61
|
+
exports.default = exports.NextApp;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var AppHead_1 = require("../AppHead");
|
|
7
|
-
var AppTheme_1 = require("./AppTheme");
|
|
8
|
-
var AppMain_1 = require("./AppMain");
|
|
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";
|
|
9
6
|
/**
|
|
10
7
|
* App
|
|
11
8
|
*
|
|
@@ -54,8 +51,7 @@ var AppMain_1 = require("./AppMain");
|
|
|
54
51
|
*
|
|
55
52
|
* ```
|
|
56
53
|
*/
|
|
57
|
-
var NextApp = function (props) {
|
|
58
|
-
return ((
|
|
54
|
+
export var NextApp = function (props) {
|
|
55
|
+
return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
|
|
59
56
|
};
|
|
60
|
-
|
|
61
|
-
exports.default = exports.NextApp;
|
|
57
|
+
export default NextApp;
|
package/app/css/package.json
CHANGED
package/app/em/AppMain.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppMain = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
var router_1 = require("next/router");
|
|
8
|
+
var framer_motion_1 = require("framer-motion");
|
|
9
|
+
var MotionProvider_1 = tslib_1.__importDefault(require("@koine/react/m/MotionProvider"));
|
|
10
|
+
var SeoDefaults_1 = require("../../SeoDefaults");
|
|
11
|
+
var NextProgress_1 = require("../../NextProgress");
|
|
9
12
|
/**
|
|
10
13
|
* App main
|
|
11
14
|
*
|
|
@@ -13,13 +16,14 @@ import { NextProgress } from "../../NextProgress";
|
|
|
13
16
|
*
|
|
14
17
|
* About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
|
|
15
18
|
*/
|
|
16
|
-
|
|
19
|
+
var AppMain = function (_a) {
|
|
17
20
|
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
21
|
initial: { opacity: 0 },
|
|
19
22
|
animate: { opacity: 1 },
|
|
20
23
|
exit: { opacity: 0 },
|
|
21
24
|
} : _b, pre = _a.pre, post = _a.post;
|
|
22
|
-
var pathname = useRouter().pathname;
|
|
23
|
-
return (
|
|
25
|
+
var pathname = (0, router_1.useRouter)().pathname;
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SeoDefaults_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(MotionProvider_1.default, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
|
|
24
27
|
};
|
|
25
|
-
|
|
28
|
+
exports.AppMain = AppMain;
|
|
29
|
+
exports.default = exports.AppMain;
|
|
@@ -0,0 +1,25 @@
|
|
|
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/MotionProvider";
|
|
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, __assign({ features: motion }, { children: [ProgressOverlay && _jsx(NextProgress, { Overlay: ProgressOverlay }), _jsx(Layout, { children: _jsx(AnimatePresence, __assign({ 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/app/em/AppTheme.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
var styles_1 = require("@mui/material/styles");
|
|
7
|
+
var react_1 = require("@emotion/react");
|
|
8
|
+
var CssBaseline_1 = tslib_1.__importDefault(require("@mui/material/CssBaseline"));
|
|
9
|
+
var react_2 = require("@emotion/react");
|
|
10
|
+
var sc_1 = require("@koine/react/sc");
|
|
11
|
+
var createEmotionCache_1 = require("../../createEmotionCache");
|
|
9
12
|
// client-side cache, shared for the whole session of the user in the browser.
|
|
10
|
-
var clientSideEmotionCache = createEmotionCache();
|
|
13
|
+
var clientSideEmotionCache = (0, createEmotionCache_1.createEmotionCache)();
|
|
11
14
|
/**
|
|
12
15
|
* App theme with `emotion` (good for `@mui`)s
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
var AppTheme = function (_a) {
|
|
15
18
|
var _b = _a.emotionCache, emotionCache = _b === void 0 ? clientSideEmotionCache : _b, theme = _a.theme, children = _a.children;
|
|
16
|
-
return (
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(react_1.CacheProvider, tslib_1.__assign({ value: emotionCache }, { children: (0, jsx_runtime_1.jsxs)(styles_1.ThemeProvider, tslib_1.__assign({ theme: theme }, { children: [(0, jsx_runtime_1.jsx)(CssBaseline_1.default, {}), (0, jsx_runtime_1.jsx)(react_2.Global, { styles: (0, react_2.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), sc_1.stylesGlobal) }), children] })) })));
|
|
17
20
|
};
|
|
18
|
-
|
|
21
|
+
exports.AppTheme = AppTheme;
|
|
22
|
+
exports.default = exports.AppTheme;
|
|
19
23
|
var templateObject_1;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ThemeProvider } from "@mui/material/styles";
|
|
4
|
+
import { CacheProvider } from "@emotion/react";
|
|
5
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
6
|
+
import { Global, css } from "@emotion/react";
|
|
7
|
+
import { stylesGlobal } from "@koine/react/sc";
|
|
8
|
+
import { createEmotionCache } from "../../createEmotionCache";
|
|
9
|
+
// client-side cache, shared for the whole session of the user in the browser.
|
|
10
|
+
var clientSideEmotionCache = createEmotionCache();
|
|
11
|
+
/**
|
|
12
|
+
* App theme with `emotion` (good for `@mui`)s
|
|
13
|
+
*/
|
|
14
|
+
export var AppTheme = function (_a) {
|
|
15
|
+
var _b = _a.emotionCache, emotionCache = _b === void 0 ? clientSideEmotionCache : _b, theme = _a.theme, children = _a.children;
|
|
16
|
+
return (_jsx(CacheProvider, __assign({ value: emotionCache }, { children: _jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(CssBaseline, {}), _jsx(Global, { styles: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), stylesGlobal) }), children] })) })));
|
|
17
|
+
};
|
|
18
|
+
export default AppTheme;
|
|
19
|
+
var templateObject_1;
|
package/app/em/auth/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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");
|
|
7
10
|
/**
|
|
8
11
|
* App with authentication provided by `next-auth`
|
|
9
12
|
*/
|
|
10
|
-
|
|
11
|
-
return (
|
|
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)) })) }))] }));
|
|
12
15
|
};
|
|
13
|
-
|
|
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;
|
package/app/em/auth/package.json
CHANGED
package/app/em/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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");
|
|
6
9
|
/**
|
|
7
10
|
* App
|
|
8
11
|
*/
|
|
9
|
-
|
|
10
|
-
return (
|
|
12
|
+
var NextApp = function (props) {
|
|
13
|
+
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)) }))] }));
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
exports.NextApp = NextApp;
|
|
16
|
+
exports.default = exports.NextApp;
|