@koine/next 1.0.11 → 1.0.14

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 (91) hide show
  1. package/Analytics/AnalyticsGoogle.js +12 -16
  2. package/Auth/helpers.js +6 -5
  3. package/Auth/useLogin.js +17 -18
  4. package/Auth/useLoginUrl.js +5 -5
  5. package/Auth/useLogout.js +19 -19
  6. package/Favicon/Favicon.js +2 -1
  7. package/Forms/useForm.js +10 -12
  8. package/Forms/useSubmit.js +23 -18
  9. package/I18n/I18n.js +35 -14
  10. package/Img/Img.js +22 -20
  11. package/Link/Link.js +4 -2
  12. package/NextProgress/NextProgress.js +12 -9
  13. package/Seo/Seo.js +2 -2
  14. package/Seo/SeoDefaults.js +2 -2
  15. package/Seo/helpers.js +34 -30
  16. package/Theme/Theme.js +98 -88
  17. package/app/AppHead.js +1 -1
  18. package/app/css/AppMain.js +4 -2
  19. package/app/css/AppTheme.js +4 -2
  20. package/app/css/auth/index.js +3 -2
  21. package/app/css/index.js +3 -2
  22. package/app/em/AppMain.js +9 -7
  23. package/app/em/AppTheme.js +6 -5
  24. package/app/em/auth/index.js +3 -2
  25. package/app/em/index.js +3 -2
  26. package/app/sc/AppMain.js +9 -7
  27. package/app/sc/AppTheme.js +4 -2
  28. package/app/sc/auth/index.js +3 -2
  29. package/app/sc/index.js +3 -2
  30. package/config/index.d.ts +13 -0
  31. package/config/index.js +87 -71
  32. package/document/Document.js +12 -5
  33. package/document/css/index.js +26 -12
  34. package/document/em/index.js +39 -48
  35. package/document/sc/index.js +44 -23
  36. package/package.json +13 -11
  37. package/utils/api.js +40 -31
  38. package/utils/index.js +7 -6
  39. package/node/Analytics/AnalyticsGoogle.js +0 -42
  40. package/node/Analytics/index.js +0 -4
  41. package/node/Auth/helpers.js +0 -26
  42. package/node/Auth/index.js +0 -7
  43. package/node/Auth/useLogin.js +0 -54
  44. package/node/Auth/useLoginUrl.js +0 -15
  45. package/node/Auth/useLogout.js +0 -56
  46. package/node/Favicon/Favicon.js +0 -9
  47. package/node/Favicon/index.js +0 -4
  48. package/node/Forms/index.js +0 -5
  49. package/node/Forms/useForm.js +0 -41
  50. package/node/Forms/useSubmit.js +0 -27
  51. package/node/Head/Head.js +0 -8
  52. package/node/Head/index.js +0 -4
  53. package/node/I18n/I18n.js +0 -82
  54. package/node/I18n/index.js +0 -4
  55. package/node/Img/Img.js +0 -34
  56. package/node/Img/index.js +0 -4
  57. package/node/Link/Link.js +0 -13
  58. package/node/Link/index.js +0 -4
  59. package/node/NextProgress/NextProgress.js +0 -41
  60. package/node/NextProgress/index.js +0 -5
  61. package/node/Seo/Seo.js +0 -12
  62. package/node/Seo/SeoDefaults.js +0 -16
  63. package/node/Seo/helpers.js +0 -115
  64. package/node/Seo/index.js +0 -15
  65. package/node/Theme/Theme.js +0 -241
  66. package/node/Theme/index.js +0 -4
  67. package/node/app/AppHead.js +0 -10
  68. package/node/app/AppMain.js +0 -2
  69. package/node/app/css/AppMain.js +0 -16
  70. package/node/app/css/AppTheme.js +0 -16
  71. package/node/app/css/auth/index.js +0 -18
  72. package/node/app/css/index.js +0 -62
  73. package/node/app/em/AppMain.js +0 -26
  74. package/node/app/em/AppTheme.js +0 -22
  75. package/node/app/em/auth/index.js +0 -18
  76. package/node/app/em/index.js +0 -17
  77. package/node/app/index.js +0 -5
  78. package/node/app/sc/AppMain.js +0 -26
  79. package/node/app/sc/AppTheme.js +0 -13
  80. package/node/app/sc/auth/index.js +0 -18
  81. package/node/app/sc/index.js +0 -64
  82. package/node/config/index.js +0 -184
  83. package/node/document/Document.js +0 -24
  84. package/node/document/css/index.js +0 -35
  85. package/node/document/em/index.js +0 -73
  86. package/node/document/index.js +0 -7
  87. package/node/document/sc/index.js +0 -49
  88. package/node/index.js +0 -15
  89. package/node/utils/api.js +0 -38
  90. package/node/utils/emotion-cache.js +0 -13
  91. package/node/utils/index.js +0 -32
package/Seo/helpers.js CHANGED
@@ -1,6 +1,7 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { isArray } from "@koine/utils";
3
- const defaults = {
4
+ var defaults = {
4
5
  tplTitle: "",
5
6
  };
6
7
  /**
@@ -17,14 +18,15 @@ const defaults = {
17
18
  *
18
19
  * @returns
19
20
  */
20
- export const buildTags = ({ seo, hidden, keywords, title = "", titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates = [], twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags, } = {}) => {
21
- const render = [];
22
- const $names = {};
23
- const $properties = {};
21
+ export var buildTags = function (_a) {
22
+ var _b = _a === void 0 ? {} : _a, seo = _b.seo, hidden = _b.hidden, keywords = _b.keywords, _c = _b.title, title = _c === void 0 ? "" : _c, titleTemplate = _b.titleTemplate, defaultTitle = _b.defaultTitle, noindex = _b.noindex, nofollow = _b.nofollow, description = _b.description, _d = _b.languageAlternates, languageAlternates = _d === void 0 ? [] : _d, twitter = _b.twitter, facebook = _b.facebook, openGraph = _b.openGraph, ogAlias = _b.og, canonical = _b.canonical, metaTags = _b.metaTags, linkTags = _b.linkTags;
23
+ var render = [];
24
+ var $names = {};
25
+ var $properties = {};
24
26
  if (titleTemplate) {
25
27
  defaults.tplTitle = titleTemplate;
26
28
  }
27
- title = title || seo?.title || "";
29
+ title = title || (seo === null || seo === void 0 ? void 0 : seo.title) || "";
28
30
  if (title) {
29
31
  if (defaults.tplTitle && defaults.tplTitle !== title) {
30
32
  title = defaults.tplTitle.replace(/%s/g, title);
@@ -37,26 +39,26 @@ export const buildTags = ({ seo, hidden, keywords, title = "", titleTemplate, de
37
39
  render.push(_jsx("title", { children: title }, "title"));
38
40
  $properties["og:title"] = title; // overridden later...
39
41
  }
40
- $names["robots"] = `${noindex || hidden ? "noindex" : "index"},${nofollow || hidden ? "nofollow" : "follow"}`;
41
- description = description || seo?.description;
42
+ $names["robots"] = "".concat(noindex || hidden ? "noindex" : "index", ",").concat(nofollow || hidden ? "nofollow" : "follow");
43
+ description = description || (seo === null || seo === void 0 ? void 0 : seo.description);
42
44
  if (description) {
43
45
  $names["description"] = description;
44
46
  $properties["og:description"] = description; // overridden later...
45
47
  }
46
- keywords = keywords || seo?.keywords;
48
+ keywords = keywords || (seo === null || seo === void 0 ? void 0 : seo.keywords);
47
49
  if (keywords) {
48
50
  $names["keywords"] = isArray(keywords) ? keywords.join(", ") : keywords;
49
51
  }
50
- if (languageAlternates?.length > 0) {
51
- languageAlternates.forEach((languageAlternate) => {
52
- render.push(_jsx("link", { rel: "alternate", hrefLang: languageAlternate.hrefLang, href: languageAlternate.href }, `languageAlternate-${languageAlternate.hrefLang}`));
52
+ if ((languageAlternates === null || languageAlternates === void 0 ? void 0 : languageAlternates.length) > 0) {
53
+ languageAlternates.forEach(function (languageAlternate) {
54
+ render.push(_jsx("link", { rel: "alternate", hrefLang: languageAlternate.hrefLang, href: languageAlternate.href }, "languageAlternate-".concat(languageAlternate.hrefLang)));
53
55
  });
54
56
  }
55
57
  if (canonical) {
56
58
  render.push(_jsx("link", { rel: "canonical", href: canonical }, "canonical"));
57
59
  $properties["og:url"] = canonical;
58
60
  }
59
- if (facebook?.appId)
61
+ if (facebook === null || facebook === void 0 ? void 0 : facebook.appId)
60
62
  $properties["fb:app_id"] = facebook.appId;
61
63
  if (twitter) {
62
64
  if (twitter.cardType)
@@ -66,36 +68,38 @@ export const buildTags = ({ seo, hidden, keywords, title = "", titleTemplate, de
66
68
  if (twitter.handle)
67
69
  $names["twitter:creator"] = twitter.handle;
68
70
  }
69
- const og = ogAlias || openGraph;
70
- if (og?.title)
71
- $properties["og:title"] = og?.title;
72
- if (og?.description)
73
- $properties["og:description"] = og?.description;
74
- if (og?.url)
71
+ var og = ogAlias || openGraph;
72
+ if (og === null || og === void 0 ? void 0 : og.title)
73
+ $properties["og:title"] = og === null || og === void 0 ? void 0 : og.title;
74
+ if (og === null || og === void 0 ? void 0 : og.description)
75
+ $properties["og:description"] = og === null || og === void 0 ? void 0 : og.description;
76
+ if (og === null || og === void 0 ? void 0 : og.url)
75
77
  $properties["og:url"] = og.url;
76
- if (og?.type)
78
+ if (og === null || og === void 0 ? void 0 : og.type)
77
79
  $properties["og:type"] = og.type.toLowerCase();
78
- if (og?.locale)
80
+ if (og === null || og === void 0 ? void 0 : og.locale)
79
81
  $properties["og:locale"] = og.locale;
80
- if (og?.site_name)
82
+ if (og === null || og === void 0 ? void 0 : og.site_name)
81
83
  $properties["og:site_name"] = og.site_name;
82
- const ogimage = og?.image || seo?.ogimage;
84
+ var ogimage = (og === null || og === void 0 ? void 0 : og.image) || (seo === null || seo === void 0 ? void 0 : seo.ogimage);
83
85
  if (ogimage)
84
86
  $properties["og:image"] = ogimage;
85
- Object.keys($names).forEach((key) => {
87
+ Object.keys($names).forEach(function (key) {
86
88
  render.push(_jsx("meta", { name: key, content: $names[key] }, key));
87
89
  });
88
- Object.keys($properties).forEach((key) => {
90
+ Object.keys($properties).forEach(function (key) {
89
91
  render.push(_jsx("meta", { property: key, content: $properties[key] }, key));
90
92
  });
91
93
  if (metaTags && metaTags.length > 0) {
92
- metaTags.forEach((tag) => {
93
- render.push(_jsx("meta", { ...tag }, `meta:${tag.keyOverride ?? tag.name ?? tag.property ?? tag.httpEquiv}`));
94
+ metaTags.forEach(function (tag) {
95
+ var _a, _b, _c;
96
+ render.push(_jsx("meta", __assign({}, tag), "meta:".concat((_c = (_b = (_a = tag.keyOverride) !== null && _a !== void 0 ? _a : tag.name) !== null && _b !== void 0 ? _b : tag.property) !== null && _c !== void 0 ? _c : tag.httpEquiv)));
94
97
  });
95
98
  }
96
- if (linkTags?.length) {
97
- linkTags.forEach((tag) => {
98
- render.push(_jsx("link", { ...tag }, `link${tag.keyOverride ?? tag.href}${tag.rel}`));
99
+ if (linkTags === null || linkTags === void 0 ? void 0 : linkTags.length) {
100
+ linkTags.forEach(function (tag) {
101
+ var _a;
102
+ render.push(_jsx("link", __assign({}, tag), "link".concat((_a = tag.keyOverride) !== null && _a !== void 0 ? _a : tag.href).concat(tag.rel)));
99
103
  });
100
104
  }
101
105
  // TODO: alternates and canonical
package/Theme/Theme.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign, __spreadArray } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /**
3
4
  * @file
@@ -7,32 +8,38 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
8
  import { createContext, useCallback, useContext, useEffect, useState, memo, } from "react";
8
9
  import NextScript from "next/script";
9
10
  import { isServer } from "@koine/utils";
10
- const THEME_STORAGE_KEY = "theme";
11
- const colorSchemes = ["light", "dark"];
12
- const MEDIA = "(prefers-color-scheme: dark)";
13
- const ThemeContext = createContext({
11
+ var THEME_STORAGE_KEY = "theme";
12
+ var colorSchemes = ["light", "dark"];
13
+ var MEDIA = "(prefers-color-scheme: dark)";
14
+ var ThemeContext = createContext({
14
15
  // eslint-disable-next-line @typescript-eslint/no-empty-function
15
- setTheme: (_) => { },
16
+ setTheme: function (_) { },
16
17
  themes: [],
17
18
  });
18
- export const useTheme = () => useContext(ThemeContext);
19
- export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme = true, themes = ["light", "dark"], defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce, }) => {
20
- const [theme, setThemeState] = useState(() => getTheme(THEME_STORAGE_KEY, defaultTheme));
21
- const [resolvedTheme, setResolvedTheme] = useState(() => getTheme(THEME_STORAGE_KEY));
22
- const attrs = !value ? themes : Object.values(value);
23
- const applyTheme = useCallback((theme) => {
24
- let resolved = theme;
19
+ export var useTheme = function () { return useContext(ThemeContext); };
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, _d = _a.enableColorScheme, enableColorScheme = _d === void 0 ? true : _d, _e = _a.themes, themes = _e === void 0 ? ["light", "dark"] : _e, _f = _a.defaultTheme, defaultTheme = _f === void 0 ? enableSystem ? "system" : "light" : _f, _g = _a.attribute, attribute = _g === void 0 ? "data-theme" : _g, value = _a.value, children = _a.children, nonce = _a.nonce;
22
+ var _h = useState(function () {
23
+ return getTheme(THEME_STORAGE_KEY, defaultTheme);
24
+ }), theme = _h[0], setThemeState = _h[1];
25
+ var _j = useState(function () {
26
+ return getTheme(THEME_STORAGE_KEY);
27
+ }), resolvedTheme = _j[0], setResolvedTheme = _j[1];
28
+ var attrs = !value ? themes : Object.values(value);
29
+ var applyTheme = useCallback(function (theme) {
30
+ var _a;
31
+ var resolved = theme;
25
32
  if (isServer || !resolved)
26
33
  return;
27
34
  // If theme is system, resolve it before setting theme
28
35
  if (theme === "system" && enableSystem) {
29
36
  resolved = getSystemTheme();
30
37
  }
31
- const name = value ? value[resolved] : resolved;
32
- const enable = disableTransitionOnChange ? disableAnimation() : null;
33
- const d = document.documentElement;
38
+ var name = value ? value[resolved] : resolved;
39
+ var enable = disableTransitionOnChange ? disableAnimation() : null;
40
+ var d = document.documentElement;
34
41
  if (attribute === "class") {
35
- d.classList.remove(...attrs);
42
+ (_a = d.classList).remove.apply(_a, attrs);
36
43
  if (name)
37
44
  d.classList.add(name);
38
45
  }
@@ -45,15 +52,15 @@ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false,
45
52
  }
46
53
  }
47
54
  if (enableColorScheme) {
48
- const fallback = colorSchemes.includes(defaultTheme)
55
+ var fallback = colorSchemes.includes(defaultTheme)
49
56
  ? defaultTheme
50
57
  : "";
51
- const colorScheme = colorSchemes.includes(resolved)
58
+ var colorScheme = colorSchemes.includes(resolved)
52
59
  ? resolved
53
60
  : fallback;
54
61
  d.style.colorScheme = colorScheme;
55
62
  }
56
- enable?.();
63
+ enable === null || enable === void 0 ? void 0 : enable();
57
64
  }, [
58
65
  attribute,
59
66
  attrs,
@@ -63,7 +70,7 @@ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false,
63
70
  enableSystem,
64
71
  value,
65
72
  ]);
66
- const setTheme = useCallback((theme) => {
73
+ var setTheme = useCallback(function (theme) {
67
74
  setThemeState(theme);
68
75
  // Save to storage
69
76
  try {
@@ -73,86 +80,89 @@ export const ThemeProvider = ({ forcedTheme, disableTransitionOnChange = false,
73
80
  // Unsupported
74
81
  }
75
82
  }, []);
76
- const handleMediaQuery = useCallback((e) => {
77
- const resolved = getSystemTheme(e);
83
+ var handleMediaQuery = useCallback(function (e) {
84
+ var resolved = getSystemTheme(e);
78
85
  setResolvedTheme(resolved);
79
86
  if (theme === "system" && enableSystem && !forcedTheme) {
80
87
  applyTheme("system");
81
88
  }
82
89
  }, [theme, enableSystem, forcedTheme, applyTheme]);
83
90
  // Always listen to System preference
84
- useEffect(() => {
85
- const media = window.matchMedia(MEDIA);
91
+ useEffect(function () {
92
+ var media = window.matchMedia(MEDIA);
86
93
  // Intentionally use deprecated listener methods to support iOS & old browsers
87
94
  media.addListener(handleMediaQuery);
88
95
  handleMediaQuery(media);
89
- return () => media.removeListener(handleMediaQuery);
96
+ return function () { return media.removeListener(handleMediaQuery); };
90
97
  }, [handleMediaQuery]);
91
98
  // localStorage event handling
92
- useEffect(() => {
93
- const handleStorage = (e) => {
99
+ useEffect(function () {
100
+ var handleStorage = function (e) {
94
101
  if (e.key !== THEME_STORAGE_KEY) {
95
102
  return;
96
103
  }
97
104
  // If default theme set, use it if localstorage === null (happens on local storage manual deletion)
98
- const theme = e.newValue || defaultTheme;
105
+ var theme = e.newValue || defaultTheme;
99
106
  setTheme(theme);
100
107
  };
101
108
  window.addEventListener("storage", handleStorage);
102
- return () => window.removeEventListener("storage", handleStorage);
109
+ return function () { return window.removeEventListener("storage", handleStorage); };
103
110
  }, [defaultTheme, setTheme]);
104
111
  // Whenever theme or forcedTheme changes, apply it
105
- useEffect(() => {
106
- applyTheme(forcedTheme ?? theme);
112
+ useEffect(function () {
113
+ applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
107
114
  }, [applyTheme, forcedTheme, theme]);
108
- return (_jsxs(ThemeContext.Provider, { value: {
109
- theme,
110
- setTheme,
111
- forcedTheme,
115
+ return (_jsxs(ThemeContext.Provider, __assign({ value: {
116
+ theme: theme,
117
+ setTheme: setTheme,
118
+ forcedTheme: forcedTheme,
112
119
  resolvedTheme: theme === "system" ? resolvedTheme : theme,
113
- themes: enableSystem ? [...themes, "system"] : themes,
120
+ themes: enableSystem ? __spreadArray(__spreadArray([], themes, true), ["system"], false) : themes,
114
121
  systemTheme: (enableSystem ? resolvedTheme : undefined),
115
- }, children: [_jsx(ThemeScript, { ...{
116
- forcedTheme,
117
- disableTransitionOnChange,
118
- enableSystem,
119
- enableColorScheme,
120
- themes,
121
- defaultTheme,
122
- attribute,
123
- value,
124
- children,
125
- attrs,
126
- nonce,
127
- } }), children] }));
122
+ } }, { children: [_jsx(ThemeScript, __assign({}, {
123
+ forcedTheme: forcedTheme,
124
+ disableTransitionOnChange: disableTransitionOnChange,
125
+ enableSystem: enableSystem,
126
+ enableColorScheme: enableColorScheme,
127
+ themes: themes,
128
+ defaultTheme: defaultTheme,
129
+ attribute: attribute,
130
+ value: value,
131
+ children: children,
132
+ attrs: attrs,
133
+ nonce: nonce,
134
+ })), children] })));
128
135
  };
129
- const ThemeScript = memo(({ forcedTheme, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce, }) => {
130
- const defaultSystem = defaultTheme === "system";
136
+ var ThemeScript = memo(function (_a) {
137
+ var forcedTheme = _a.forcedTheme, attribute = _a.attribute, enableSystem = _a.enableSystem, enableColorScheme = _a.enableColorScheme, defaultTheme = _a.defaultTheme, value = _a.value, attrs = _a.attrs, nonce = _a.nonce;
138
+ var defaultSystem = defaultTheme === "system";
131
139
  // Code-golfing the amount of characters in the script
132
- const optimization = (() => {
133
- const removeClasses = `d.remove(${attrs
134
- .map((t) => `'${t}'`)
135
- .join(",")})`;
136
- return `var d=document.documentElement.classList;${removeClasses};`;
140
+ var optimization = (function () {
141
+ var removeClasses = "d.remove(".concat(attrs
142
+ .map(function (t) { return "'".concat(t, "'"); })
143
+ .join(","), ")");
144
+ return "var d=document.documentElement.classList;".concat(removeClasses, ";");
137
145
  })();
138
- const fallbackColorScheme = (() => {
146
+ var fallbackColorScheme = (function () {
139
147
  if (!enableColorScheme) {
140
148
  return "";
141
149
  }
142
- const fallback = colorSchemes.includes(defaultTheme)
150
+ var fallback = colorSchemes.includes(defaultTheme)
143
151
  ? defaultTheme
144
152
  : null;
145
153
  if (fallback) {
146
- return `if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${defaultTheme}'`;
154
+ return "if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'".concat(defaultTheme, "'");
147
155
  }
148
156
  else {
149
- return `if(e==='light'||e==='dark')d.style.colorScheme=e`;
157
+ return "if(e==='light'||e==='dark')d.style.colorScheme=e";
150
158
  }
151
159
  })();
152
- const updateDOM = (name, literal = false, setColorScheme = true) => {
153
- const resolvedName = value ? value[name] : name;
154
- const val = literal ? name + `|| ''` : `'${resolvedName}'`;
155
- let text = "";
160
+ var updateDOM = function (name, literal, setColorScheme) {
161
+ if (literal === void 0) { literal = false; }
162
+ if (setColorScheme === void 0) { setColorScheme = true; }
163
+ var resolvedName = value ? value[name] : name;
164
+ var val = literal ? name + "|| ''" : "'".concat(resolvedName, "'");
165
+ var text = "";
156
166
  // MUCH faster to set colorScheme alongside HTML attribute/class
157
167
  // as it only incurs 1 style recalculation rather than 2
158
168
  // This can save over 250ms of work for pages with big DOM
@@ -160,48 +170,48 @@ const ThemeScript = memo(({ forcedTheme, attribute, enableSystem, enableColorSch
160
170
  setColorScheme &&
161
171
  !literal &&
162
172
  colorSchemes.includes(name)) {
163
- text += `d.style.colorScheme = '${name}';`;
173
+ text += "d.style.colorScheme = '".concat(name, "';");
164
174
  }
165
175
  if (attribute === "class") {
166
176
  if (literal || resolvedName) {
167
- text += `d.add(${val})`;
177
+ text += "d.add(".concat(val, ")");
168
178
  }
169
179
  else {
170
- text += `null`;
180
+ text += "null";
171
181
  }
172
182
  }
173
183
  else {
174
184
  if (resolvedName) {
175
- text += `d[s](n, ${val})`;
185
+ text += "d[s](n, ".concat(val, ")");
176
186
  }
177
187
  }
178
188
  return text;
179
189
  };
180
- const scriptSrc = (() => {
190
+ var scriptSrc = (function () {
181
191
  if (forcedTheme) {
182
- return `!function(){${optimization}${updateDOM(forcedTheme)}}()`;
192
+ return "!function(){".concat(optimization).concat(updateDOM(forcedTheme), "}()");
183
193
  }
184
194
  if (enableSystem) {
185
- 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
186
- ? `else{` + updateDOM(defaultTheme, false, false) + "}"
187
- : ""}${fallbackColorScheme}}catch(e){}}()`;
195
+ return "!function(){try {".concat(optimization, "var e=localStorage.getItem('").concat(THEME_STORAGE_KEY, "');if(\"system\"===e||(!e&&").concat(defaultSystem, ")){var t=\"").concat(MEDIA, "\",m=window.matchMedia(t);if(m.media!==t||m.matches){").concat(updateDOM("dark"), "}else{").concat(updateDOM("light"), "}}else if(e){").concat(value ? "var x=".concat(JSON.stringify(value), ";") : "").concat(updateDOM(value ? "x[e]" : "e", true), "}").concat(!defaultSystem
196
+ ? "else{" + updateDOM(defaultTheme, false, false) + "}"
197
+ : "").concat(fallbackColorScheme, "}catch(e){}}()");
188
198
  }
189
- 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){}}();`;
199
+ return "!function(){try{".concat(optimization, "var e=localStorage.getItem(\"").concat(THEME_STORAGE_KEY, "\");if(e){").concat(value ? "var x=".concat(JSON.stringify(value), ";") : "").concat(updateDOM(value ? "x[e]" : "e", true), "}else{").concat(updateDOM(defaultTheme, false, false), ";}").concat(fallbackColorScheme, "}catch(t){}}();");
190
200
  })();
191
201
  // We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
192
202
  // However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
193
203
  // But our script cannot be external because it changes at runtime based on React props
194
204
  // so we trick next/script by passing `src` as a base64 JS script
195
- const encodedScript = `data:text/javascript;base64,${encodeBase64(scriptSrc)}`;
205
+ var encodedScript = "data:text/javascript;base64,".concat(encodeBase64(scriptSrc));
196
206
  return (_jsx(NextScript, { id: "next-theme-script", strategy: "beforeInteractive", src: encodedScript, nonce: nonce }));
197
207
  },
198
208
  // Never re-render this component
199
- () => true);
209
+ function () { return true; });
200
210
  // Helpers
201
- const getTheme = (key, fallback) => {
211
+ var getTheme = function (key, fallback) {
202
212
  if (isServer)
203
213
  return undefined;
204
- let theme;
214
+ var theme;
205
215
  try {
206
216
  theme = localStorage.getItem(key) || undefined;
207
217
  }
@@ -210,26 +220,26 @@ const getTheme = (key, fallback) => {
210
220
  }
211
221
  return theme || fallback;
212
222
  };
213
- const disableAnimation = () => {
214
- const css = document.createElement("style");
215
- css.appendChild(document.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
223
+ var disableAnimation = function () {
224
+ var css = document.createElement("style");
225
+ css.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"));
216
226
  document.head.appendChild(css);
217
- return () => {
227
+ return function () {
218
228
  // Force restyle
219
- (() => window.getComputedStyle(document.body))();
229
+ (function () { return window.getComputedStyle(document.body); })();
220
230
  // Wait for next tick before removing
221
- setTimeout(() => {
231
+ setTimeout(function () {
222
232
  document.head.removeChild(css);
223
233
  }, 1);
224
234
  };
225
235
  };
226
- const getSystemTheme = (e) => {
236
+ var getSystemTheme = function (e) {
227
237
  if (!e)
228
238
  e = window.matchMedia(MEDIA);
229
- const isDark = e.matches;
230
- const systemTheme = isDark ? "dark" : "light";
239
+ var isDark = e.matches;
240
+ var systemTheme = isDark ? "dark" : "light";
231
241
  return systemTheme;
232
242
  };
233
- const encodeBase64 = (str) => {
243
+ var encodeBase64 = function (str) {
234
244
  return isServer ? Buffer.from(str).toString("base64") : btoa(str);
235
245
  };
package/app/AppHead.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Head from "next/head";
3
- export const AppHead = () => {
3
+ export var AppHead = function () {
4
4
  return (_jsx(Head, { children: _jsx("meta", { name: "viewport", content: "width=device-width" }) }));
5
5
  };
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from "react";
3
4
  import { SeoDefaults } from "../../Seo";
@@ -6,6 +7,7 @@ import { SeoDefaults } from "../../Seo";
6
7
  *
7
8
  * It does not imply any specific styling or animation solution
8
9
  */
9
- export const AppMain = ({ Component, pageProps, Layout, seo, pre, post, }) => {
10
- return (_jsxs(React.Fragment, { children: [_jsx(SeoDefaults, { ...seo }), pre, _jsx(Layout, { children: _jsx(Component, { ...pageProps }) }), post] }));
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] }));
11
13
  };
@@ -1,12 +1,14 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  // import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react";
3
4
  import { ThemeProvider } from "../../Theme";
4
5
  /**
5
6
  * App theme with vanilla class based theme (good for `tailwindcss`)
6
7
  */
7
- export const AppTheme = ({ theme, children }) => {
8
+ export var AppTheme = function (_a) {
9
+ var theme = _a.theme, children = _a.children;
8
10
  // return (
9
11
  // <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
10
12
  // );
11
- return (_jsx(ThemeProvider, { defaultTheme: theme, attribute: "class", children: children }));
13
+ return (_jsx(ThemeProvider, __assign({ defaultTheme: theme, attribute: "class" }, { children: children })));
12
14
  };
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from "react";
3
4
  import { SessionProvider } from "next-auth/react";
@@ -7,7 +8,7 @@ import { AppMain } from "../AppMain";
7
8
  /**
8
9
  * App with authentication provided by `next-auth`
9
10
  */
10
- export const NextApp = (props) => {
11
- return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) }) })] }));
11
+ export var NextApp = function (props) {
12
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, __assign({ session: props.pageProps.session }, { children: _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) })) }))] }));
12
13
  };
13
14
  export default NextApp;
package/app/css/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from "react";
3
4
  import { AppHead } from "../AppHead";
@@ -51,7 +52,7 @@ import { AppMain } from "./AppMain";
51
52
  *
52
53
  * ```
53
54
  */
54
- export const NextApp = (props) => {
55
- return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) })] }));
55
+ export var NextApp = function (props) {
56
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
56
57
  };
57
58
  export default NextApp;
package/app/em/AppMain.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { createElement as _createElement } from "react";
2
3
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
4
  import { useRouter } from "next/router";
@@ -12,11 +13,12 @@ import { NextProgress } from "../../NextProgress";
12
13
  *
13
14
  * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
14
15
  */
15
- export const AppMain = ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition = {
16
- initial: { opacity: 0 },
17
- animate: { opacity: 1 },
18
- exit: { opacity: 0 },
19
- }, pre, post, }) => {
20
- const { pathname } = useRouter();
21
- return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, { ...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, { ...transition, children: _createElement(Component, { ...pageProps, key: pathname }) }, pathname) }) })] }), post] }));
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] }));
22
24
  };
@@ -1,3 +1,4 @@
1
+ import { __assign, __makeTemplateObject } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { ThemeProvider } from "@mui/material/styles";
3
4
  import { CacheProvider } from "@emotion/react";
@@ -6,12 +7,12 @@ import { Global, css } from "@emotion/react";
6
7
  import { stylesGlobal } from "@koine/react/sc";
7
8
  import { createEmotionCache } from "../../utils/emotion-cache";
8
9
  // client-side cache, shared for the whole session of the user in the browser.
9
- const clientSideEmotionCache = createEmotionCache();
10
+ var clientSideEmotionCache = createEmotionCache();
10
11
  /**
11
12
  * App theme with `emotion` (good for `@mui`)s
12
13
  */
13
- export const AppTheme = ({ emotionCache = clientSideEmotionCache, theme, children, }) => {
14
- return (_jsx(CacheProvider, { value: emotionCache, children: _jsxs(ThemeProvider, { theme: theme, children: [_jsx(CssBaseline, {}), _jsx(Global, { styles: css `
15
- ${stylesGlobal}
16
- ` }), children] }) }));
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
17
  };
18
+ var templateObject_1;
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from "react";
3
4
  import { SessionProvider } from "next-auth/react";
@@ -7,7 +8,7 @@ import { AppMain } from "../AppMain";
7
8
  /**
8
9
  * App with authentication provided by `next-auth`
9
10
  */
10
- export const NextApp = (props) => {
11
- return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, { session: props.pageProps.session, children: _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) }) })] }));
11
+ export var NextApp = function (props) {
12
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(SessionProvider, __assign({ session: props.pageProps.session }, { children: _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) })) }))] }));
12
13
  };
13
14
  export default NextApp;
package/app/em/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from "react";
3
4
  import { AppHead } from "../AppHead";
@@ -6,7 +7,7 @@ import { AppMain } from "./AppMain";
6
7
  /**
7
8
  * App
8
9
  */
9
- export const NextApp = (props) => {
10
- return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, { ...props, children: _jsx(AppMain, { ...props }) })] }));
10
+ export var NextApp = function (props) {
11
+ return (_jsxs(React.StrictMode, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
11
12
  };
12
13
  export default NextApp;
package/app/sc/AppMain.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { createElement as _createElement } from "react";
2
3
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
4
  import { useRouter } from "next/router";
@@ -12,11 +13,12 @@ import { NextProgress } from "../../NextProgress";
12
13
  *
13
14
  * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
14
15
  */
15
- export const AppMain = ({ Component, pageProps, Layout, ProgressOverlay, seo, motion, transition = {
16
- initial: { opacity: 0 },
17
- animate: { opacity: 1 },
18
- exit: { opacity: 0 },
19
- }, pre, post, }) => {
20
- const { pathname } = useRouter();
21
- return (_jsxs(_Fragment, { children: [_jsx(SeoDefaults, { ...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, { ...transition, children: _createElement(Component, { ...pageProps, key: pathname }) }, pathname) }) })] }), post] }));
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] }));
22
24
  };