@koine/next 2.0.0-beta.14 → 2.0.0-beta.141

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