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