@koine/next 2.0.0-beta.2 → 2.0.0-beta.4

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 (112) hide show
  1. package/12/AnalyticsGoogle.js +65 -25
  2. package/12/AnalyticsGoogle.mjs +41 -15
  3. package/12/DisableErrorOverlay.js +29 -16
  4. package/12/DisableErrorOverlay.mjs +8 -5
  5. package/12/DynamicNamespaces.d.ts +1 -1
  6. package/12/DynamicNamespaces.js +22 -12
  7. package/12/DynamicNamespaces.mjs +1 -2
  8. package/12/Favicon.js +28 -9
  9. package/12/Favicon.mjs +6 -2
  10. package/12/Link.d.ts +1 -1
  11. package/12/Link.js +36 -13
  12. package/12/Link.mjs +14 -6
  13. package/12/NextProgress.js +47 -24
  14. package/12/NextProgress.mjs +26 -17
  15. package/12/Seo.d.ts +1 -1
  16. package/12/Seo.js +27 -32
  17. package/12/Seo.mjs +5 -4
  18. package/12/SeoDefaults.d.ts +1 -1
  19. package/12/SeoDefaults.js +27 -13
  20. package/12/SeoDefaults.mjs +5 -3
  21. package/12/T.d.ts +1 -1
  22. package/12/T.js +42 -16
  23. package/12/T.mjs +20 -6
  24. package/12/ThemeContext.js +22 -7
  25. package/12/ThemeContext.mjs +3 -3
  26. package/12/ThemeProvider.js +164 -147
  27. package/12/ThemeProvider.mjs +139 -129
  28. package/12/TransText.js +22 -7
  29. package/12/TransText.mjs +1 -1
  30. package/12/app/AppHead.js +29 -9
  31. package/12/app/AppHead.mjs +8 -2
  32. package/12/app/AppMain.d.ts +4 -4
  33. package/12/app/AppMain.js +5 -1
  34. package/12/app/AppMain.mjs +1 -1
  35. package/12/app/css/AppMain.js +37 -16
  36. package/12/app/css/AppMain.mjs +15 -5
  37. package/12/app/css/AppTheme.d.ts +1 -1
  38. package/12/app/css/AppTheme.js +28 -13
  39. package/12/app/css/AppTheme.mjs +7 -4
  40. package/12/app/css/auth/index.d.ts +1 -1
  41. package/12/app/css/auth/index.js +38 -15
  42. package/12/app/css/auth/index.mjs +17 -6
  43. package/12/app/css/index.d.ts +1 -1
  44. package/12/app/css/index.js +34 -59
  45. package/12/app/css/index.mjs +14 -6
  46. package/12/app/index.js +6 -4
  47. package/12/app/sc/AppMain.js +68 -27
  48. package/12/app/sc/AppMain.mjs +46 -13
  49. package/12/app/sc/AppTheme.d.ts +1 -1
  50. package/12/app/sc/AppTheme.js +31 -13
  51. package/12/app/sc/AppTheme.mjs +9 -4
  52. package/12/app/sc/auth/index.d.ts +1 -1
  53. package/12/app/sc/auth/index.js +38 -15
  54. package/12/app/sc/auth/index.mjs +17 -6
  55. package/12/app/sc/index.d.ts +1 -1
  56. package/12/app/sc/index.js +34 -61
  57. package/12/app/sc/index.mjs +14 -6
  58. package/12/document/Document.js +47 -29
  59. package/12/document/Document.mjs +24 -14
  60. package/12/document/css/index.js +47 -32
  61. package/12/document/css/index.mjs +26 -18
  62. package/12/document/index.js +18 -6
  63. package/12/document/sc/index.js +71 -65
  64. package/12/document/sc/index.mjs +46 -45
  65. package/12/getT.js +22 -13
  66. package/12/getT.mjs +2 -4
  67. package/12/index.js +99 -51
  68. package/12/index.mjs +2 -2
  69. package/12/seoBuildTags.js +81 -76
  70. package/12/seoBuildTags.mjs +59 -55
  71. package/12/to.js +21 -19
  72. package/12/to.mjs +4 -10
  73. package/12/translationAsOptions.js +15 -9
  74. package/12/translationAsOptions.mjs +6 -6
  75. package/12/types-i18n.js +4 -3
  76. package/12/types-i18n.mjs +1 -2
  77. package/12/types-seo.js +3 -1
  78. package/12/types-seo.mjs +1 -1
  79. package/12/useBackUrl.js +30 -16
  80. package/12/useBackUrl.mjs +8 -8
  81. package/12/useDateFormat.js +37 -38
  82. package/12/useDateFormat.mjs +15 -28
  83. package/12/useForm.d.ts +1 -1
  84. package/12/useForm.js +46 -20
  85. package/12/useForm.mjs +25 -13
  86. package/12/useLocale.js +22 -8
  87. package/12/useT.d.ts +1 -1
  88. package/12/useT.js +53 -39
  89. package/12/useT.mjs +32 -14
  90. package/12/useTheme.js +22 -11
  91. package/12/useTheme.mjs +1 -2
  92. package/12/useTo.js +23 -16
  93. package/12/useTo.mjs +3 -10
  94. package/README.md +1 -1
  95. package/config/index.js +225 -251
  96. package/config/index.mjs +187 -204
  97. package/getSiteUrl.js +22 -15
  98. package/getSiteUrl.mjs +2 -4
  99. package/index.js +19 -6
  100. package/load.js +21 -8
  101. package/load.mjs +3 -4
  102. package/package.json +19 -17
  103. package/12/app/css/auth/package.json +0 -6
  104. package/12/app/css/package.json +0 -6
  105. package/12/app/package.json +0 -6
  106. package/12/app/sc/auth/package.json +0 -6
  107. package/12/app/sc/package.json +0 -6
  108. package/12/document/css/package.json +0 -6
  109. package/12/document/package.json +0 -6
  110. package/12/document/sc/package.json +0 -6
  111. package/12/package.json +0 -6
  112. package/config/package.json +0 -6
@@ -1,63 +1,36 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NextApp = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var AppHead_1 = require("../AppHead");
7
- var AppTheme_1 = require("./AppTheme");
8
- var AppMain_1 = require("./AppMain");
9
- /**
10
- * App
11
- *
12
- * @example
13
- *
14
- * ```tsx
15
- * import { NextApp, NextAppProps } from "@koine/next/app/sc/auth";
16
- * import { Favicon, AnalyticsGoogle } from "@koine/next";
17
- * import { theme } from "src/helpers/theme";
18
- * import { Layout, ProgressOverlay } from "src/components/Layout";
19
- * // import "@fontsource/myfont/800.css";
20
- * // import "src/helpers/theme.css";
21
- *
22
- * const motion = () => import("@koine/react/m/max").then((m) => m.default);
23
- *
24
- * export default function App(props: NextAppProps) {
25
- * return (
26
- * <NextApp
27
- * {...props}
28
- * Layout={Layout}
29
- * ProgressOverlay={ProgressOverlay}
30
- * theme={theme}
31
- * motion={motion}
32
- * seo={{
33
- * titleTemplate: "%s | MyApp",
34
- * defaultTitle: "MyApp",
35
- * openGraph: {
36
- * type: "website",
37
- * locale: "en_US",
38
- * url: "https://myapp.com/",
39
- * site_name: "MyApp",
40
- * },
41
- * twitter: {
42
- * handle: "@MklrNl",
43
- * site: "@MyApp",
44
- * cardType: "summary_large_image",
45
- * },
46
- * }}
47
- * pre={
48
- * <>
49
- * <AnalyticsGoogle id="UA-xxxxxxxx-x" />
50
- * <Favicon name="MyApp" color="#000000" />
51
- * </>
52
- * }
53
- * />
54
- * );
55
- * }
56
- *
57
- * ```
58
- */
59
- var NextApp = function (props) {
60
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, tslib_1.__assign({}, props, { children: (0, jsx_runtime_1.jsx)(AppMain_1.AppMain, tslib_1.__assign({}, props)) }))] }));
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ NextApp: function() {
13
+ return NextApp;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _jsxruntime = require("react/jsx-runtime");
20
+ const _AppHead = require("../AppHead");
21
+ const _AppMain = require("./AppMain");
22
+ const _AppTheme = require("./AppTheme");
23
+ const NextApp = (props)=>{
24
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
25
+ children: [
26
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_AppHead.AppHead, {}),
27
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_AppTheme.AppTheme, {
28
+ ...props,
29
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_AppMain.AppMain, {
30
+ ...props
31
+ })
32
+ })
33
+ ]
34
+ });
61
35
  };
62
- exports.NextApp = NextApp;
63
- exports.default = exports.NextApp;
36
+ const _default = NextApp;
@@ -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
  *
@@ -52,8 +51,17 @@ import { AppMain } from "./AppMain";
52
51
  * }
53
52
  *
54
53
  * ```
55
- */
56
- export var NextApp = function (props) {
57
- return (_jsxs(_Fragment, { children: [_jsx(AppHead, {}), _jsx(AppTheme, __assign({}, props, { children: _jsx(AppMain, __assign({}, props)) }))] }));
54
+ */ export const NextApp = (props)=>{
55
+ return /*#__PURE__*/ _jsxs(_Fragment, {
56
+ children: [
57
+ /*#__PURE__*/ _jsx(AppHead, {}),
58
+ /*#__PURE__*/ _jsx(AppTheme, {
59
+ ...props,
60
+ children: /*#__PURE__*/ _jsx(AppMain, {
61
+ ...props
62
+ })
63
+ })
64
+ ]
65
+ });
58
66
  };
59
67
  export default NextApp;
@@ -1,31 +1,49 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Document = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var document_1 = tslib_1.__importStar(require("next/document"));
7
- var Meta_1 = tslib_1.__importDefault(require("@koine/react/Meta"));
8
- var NoJs_1 = tslib_1.__importDefault(require("@koine/react/NoJs"));
9
- /**
10
- * Next Document wrapper for bare projects
11
- *
12
- * @example
13
- *
14
- * in your `myapp/pages/_document.tsx`:
15
- * ```tsx
16
- * export { Document as default } from "@koine/next/document";
17
- * ```
18
- */
19
- var Document = /** @class */ (function (_super) {
20
- tslib_1.__extends(Document, _super);
21
- function Document() {
22
- return _super !== null && _super.apply(this, arguments) || this;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Document: function() {
13
+ return Document;
14
+ },
15
+ default: function() {
16
+ return _default;
23
17
  }
24
- Document.prototype.render = function () {
25
- var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
26
- return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale || defaultLocale, className: "no-js", children: [(0, jsx_runtime_1.jsxs)(document_1.Head, { children: [(0, jsx_runtime_1.jsx)(Meta_1.default, {}), (0, jsx_runtime_1.jsx)(NoJs_1.default, {})] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
27
- };
28
- return Document;
29
- }(document_1.default));
30
- exports.Document = Document;
31
- exports.default = Document;
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
+ const _jsxruntime = require("react/jsx-runtime");
22
+ const _document = /*#__PURE__*/ _interop_require_wildcard._(require("next/document"));
23
+ const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
24
+ const _Meta = /*#__PURE__*/ _interop_require_default._(require("@koine/react/Meta"));
25
+ const _NoJs = /*#__PURE__*/ _interop_require_default._(require("@koine/react/NoJs"));
26
+ let Document = class Document extends _document.default {
27
+ render() {
28
+ const { locale, defaultLocale } = this.props.__NEXT_DATA__;
29
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_document.Html, {
30
+ lang: locale || defaultLocale,
31
+ className: "no-js",
32
+ children: [
33
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_document.Head, {
34
+ children: [
35
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Meta.default, {}),
36
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_NoJs.default, {})
37
+ ]
38
+ }),
39
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("body", {
40
+ children: [
41
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_document.Main, {}),
42
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_document.NextScript, {})
43
+ ]
44
+ })
45
+ ]
46
+ });
47
+ }
48
+ };
49
+ const _default = Document;
@@ -1,6 +1,6 @@
1
- import { __extends } from "tslib";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import NextDocument, { Html, Head, Main, NextScript } from "next/document";
2
+ import NextDocument, { Head, Html, Main, NextScript } from "next/document";
3
+ import React from "react";
4
4
  import Meta from "@koine/react/Meta";
5
5
  import NoJs from "@koine/react/NoJs";
6
6
  /**
@@ -12,17 +12,27 @@ import NoJs from "@koine/react/NoJs";
12
12
  * ```tsx
13
13
  * export { Document as default } from "@koine/next/document";
14
14
  * ```
15
- */
16
- var Document = /** @class */ (function (_super) {
17
- __extends(Document, _super);
18
- function Document() {
19
- return _super !== null && _super.apply(this, arguments) || this;
15
+ */ export class Document extends NextDocument {
16
+ render() {
17
+ const { locale, defaultLocale } = this.props.__NEXT_DATA__;
18
+ return /*#__PURE__*/ _jsxs(Html, {
19
+ lang: locale || defaultLocale,
20
+ className: "no-js",
21
+ children: [
22
+ /*#__PURE__*/ _jsxs(Head, {
23
+ children: [
24
+ /*#__PURE__*/ _jsx(Meta, {}),
25
+ /*#__PURE__*/ _jsx(NoJs, {})
26
+ ]
27
+ }),
28
+ /*#__PURE__*/ _jsxs("body", {
29
+ children: [
30
+ /*#__PURE__*/ _jsx(Main, {}),
31
+ /*#__PURE__*/ _jsx(NextScript, {})
32
+ ]
33
+ })
34
+ ]
35
+ });
20
36
  }
21
- Document.prototype.render = function () {
22
- var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
23
- return (_jsxs(Html, { lang: locale || defaultLocale, className: "no-js", children: [_jsxs(Head, { children: [_jsx(Meta, {}), _jsx(NoJs, {})] }), _jsxs("body", { children: [_jsx(Main, {}), _jsx(NextScript, {})] })] }));
24
- };
25
- return Document;
26
- }(NextDocument));
27
- export { Document };
37
+ }
28
38
  export default Document;
@@ -1,29 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Document = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var document_1 = tslib_1.__importStar(require("next/document"));
7
- var Meta_1 = tslib_1.__importDefault(require("@koine/react/Meta"));
8
- var NoJs_1 = tslib_1.__importDefault(require("@koine/react/NoJs"));
9
- // import { getInitialThemeFromRequest, ThemeVanillaValue } from "@koine/react/sc"; // FIXME: this should be imported from another entrypoint
10
- /**
11
- * Next Document wrapper for `css/tailwind` based projects
12
- *
13
- * Uses cookie to manage the current theme
14
- *
15
- * @example
16
- *
17
- * in your `myapp/pages/_document.tsx`:
18
- * ```tsx
19
- * export { Document as default } from "@koine/next/document/css";
20
- * ```
21
- */
22
- var Document = /** @class */ (function (_super) {
23
- tslib_1.__extends(Document, _super);
24
- function Document() {
25
- return _super !== null && _super.apply(this, arguments) || this;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Document: function() {
13
+ return Document;
14
+ },
15
+ default: function() {
16
+ return _default;
26
17
  }
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
+ const _jsxruntime = require("react/jsx-runtime");
22
+ const _document = /*#__PURE__*/ _interop_require_wildcard._(require("next/document"));
23
+ const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
24
+ const _Meta = /*#__PURE__*/ _interop_require_default._(require("@koine/react/Meta"));
25
+ const _NoJs = /*#__PURE__*/ _interop_require_default._(require("@koine/react/NoJs"));
26
+ let Document = class Document extends _document.default {
27
27
  // static override async getInitialProps(
28
28
  // ctx: DocumentContext
29
29
  // ): Promise<DocumentInitialProps & { theme: ThemeVanillaValue }> {
@@ -35,11 +35,26 @@ var Document = /** @class */ (function (_super) {
35
35
  // ),
36
36
  // };
37
37
  // }
38
- Document.prototype.render = function () {
39
- var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
40
- return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale || defaultLocale, className: "no-js", children: [(0, jsx_runtime_1.jsxs)(document_1.Head, { children: [(0, jsx_runtime_1.jsx)(Meta_1.default, {}), (0, jsx_runtime_1.jsx)(NoJs_1.default, {})] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
41
- };
42
- return Document;
43
- }(document_1.default));
44
- exports.Document = Document;
45
- exports.default = Document;
38
+ render() {
39
+ const { locale, defaultLocale } = this.props.__NEXT_DATA__;
40
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_document.Html, {
41
+ lang: locale || defaultLocale,
42
+ className: "no-js",
43
+ children: [
44
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_document.Head, {
45
+ children: [
46
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Meta.default, {}),
47
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_NoJs.default, {})
48
+ ]
49
+ }),
50
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("body", {
51
+ children: [
52
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_document.Main, {}),
53
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_document.NextScript, {})
54
+ ]
55
+ })
56
+ ]
57
+ });
58
+ }
59
+ };
60
+ const _default = Document;
@@ -1,9 +1,7 @@
1
- import { __extends } from "tslib";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import NextDocument, {
4
- // DocumentContext,
5
- // type DocumentInitialProps,
6
- Html, Head, Main, NextScript, } from "next/document";
2
+ import NextDocument, { Head, // type DocumentInitialProps,
3
+ Html, Main, NextScript } from "next/document";
4
+ import React from "react";
7
5
  import Meta from "@koine/react/Meta";
8
6
  import NoJs from "@koine/react/NoJs";
9
7
  // import { getInitialThemeFromRequest, ThemeVanillaValue } from "@koine/react/sc"; // FIXME: this should be imported from another entrypoint
@@ -18,12 +16,7 @@ import NoJs from "@koine/react/NoJs";
18
16
  * ```tsx
19
17
  * export { Document as default } from "@koine/next/document/css";
20
18
  * ```
21
- */
22
- var Document = /** @class */ (function (_super) {
23
- __extends(Document, _super);
24
- function Document() {
25
- return _super !== null && _super.apply(this, arguments) || this;
26
- }
19
+ */ export class Document extends NextDocument {
27
20
  // static override async getInitialProps(
28
21
  // ctx: DocumentContext
29
22
  // ): Promise<DocumentInitialProps & { theme: ThemeVanillaValue }> {
@@ -35,11 +28,26 @@ var Document = /** @class */ (function (_super) {
35
28
  // ),
36
29
  // };
37
30
  // }
38
- Document.prototype.render = function () {
39
- var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
40
- return (_jsxs(Html, { lang: locale || defaultLocale, className: "no-js", children: [_jsxs(Head, { children: [_jsx(Meta, {}), _jsx(NoJs, {})] }), _jsxs("body", { children: [_jsx(Main, {}), _jsx(NextScript, {})] })] }));
41
- };
42
- return Document;
43
- }(NextDocument));
44
- export { Document };
31
+ render() {
32
+ const { locale, defaultLocale } = this.props.__NEXT_DATA__;
33
+ return /*#__PURE__*/ _jsxs(Html, {
34
+ lang: locale || defaultLocale,
35
+ className: "no-js",
36
+ children: [
37
+ /*#__PURE__*/ _jsxs(Head, {
38
+ children: [
39
+ /*#__PURE__*/ _jsx(Meta, {}),
40
+ /*#__PURE__*/ _jsx(NoJs, {})
41
+ ]
42
+ }),
43
+ /*#__PURE__*/ _jsxs("body", {
44
+ children: [
45
+ /*#__PURE__*/ _jsx(Main, {}),
46
+ /*#__PURE__*/ _jsx(NextScript, {})
47
+ ]
48
+ })
49
+ ]
50
+ });
51
+ }
52
+ }
45
53
  export default Document;
@@ -1,7 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = exports.Document = void 0;
4
- var Document_1 = require("./Document");
5
- Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return Document_1.Document; } });
6
- var Document_2 = require("./Document");
7
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return Document_2.Document; } });
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Document: function() {
13
+ return _Document.Document;
14
+ },
15
+ default: function() {
16
+ return _Document.Document;
17
+ }
18
+ });
19
+ const _Document = require("./Document");
@@ -1,67 +1,73 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Document = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var react_1 = tslib_1.__importDefault(require("react"));
7
- /* ? eslint-disable @next/next/no-document-import-in-page */
8
- var document_1 = tslib_1.__importStar(require("next/document"));
9
- var styled_components_1 = require("styled-components");
10
- var Meta_1 = tslib_1.__importDefault(require("@koine/react/Meta"));
11
- var NoJs_1 = tslib_1.__importDefault(require("@koine/react/NoJs"));
12
- /**
13
- * Next Document wrapper for `styled-components` based projects
14
- *
15
- * For typescript safety of this component
16
- * @see https://bit.ly/3ceuF8m
17
- *
18
- * @example
19
- *
20
- * in your `myapp/pages/_document.tsx`:
21
- * ```tsx
22
- * export { Document as default } from "@koine/next/document/sc";
23
- * ```
24
- */
25
- var Document = /** @class */ (function (_super) {
26
- tslib_1.__extends(Document, _super);
27
- function Document() {
28
- return _super !== null && _super.apply(this, arguments) || this;
1
+ /* ? eslint-disable @next/next/no-document-import-in-page */ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Document: function() {
13
+ return Document;
14
+ },
15
+ default: function() {
16
+ return _default;
29
17
  }
30
- Document.getInitialProps = function (ctx) {
31
- return tslib_1.__awaiter(this, void 0, void 0, function () {
32
- var sheet, originalRenderPage, initialProps;
33
- return tslib_1.__generator(this, function (_a) {
34
- switch (_a.label) {
35
- case 0:
36
- sheet = new styled_components_1.ServerStyleSheet();
37
- originalRenderPage = ctx.renderPage;
38
- _a.label = 1;
39
- case 1:
40
- _a.trys.push([1, , 3, 4]);
41
- ctx.renderPage = function () {
42
- return originalRenderPage({
43
- enhanceApp: function (App) { return function (props) {
44
- return sheet.collectStyles((0, jsx_runtime_1.jsx)(App, tslib_1.__assign({}, props)));
45
- }; },
46
- });
47
- };
48
- return [4 /*yield*/, document_1.default.getInitialProps(ctx)];
49
- case 2:
50
- initialProps = _a.sent();
51
- return [2 /*return*/, tslib_1.__assign(tslib_1.__assign({}, initialProps), { styles: ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [initialProps.styles, sheet.getStyleElement()] })) })];
52
- case 3:
53
- sheet.seal();
54
- return [7 /*endfinally*/];
55
- case 4: return [2 /*return*/];
56
- }
57
- });
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
+ const _jsxruntime = require("react/jsx-runtime");
22
+ const _document = /*#__PURE__*/ _interop_require_wildcard._(require("next/document"));
23
+ const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
24
+ const _styledcomponents = require("styled-components");
25
+ const _Meta = /*#__PURE__*/ _interop_require_default._(require("@koine/react/Meta"));
26
+ const _NoJs = /*#__PURE__*/ _interop_require_default._(require("@koine/react/NoJs"));
27
+ let Document = class Document extends _document.default {
28
+ static async getInitialProps(ctx) {
29
+ const sheet = new _styledcomponents.ServerStyleSheet();
30
+ const originalRenderPage = ctx.renderPage;
31
+ try {
32
+ ctx.renderPage = ()=>originalRenderPage({
33
+ enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, _jsxruntime.jsx)(App, {
34
+ ...props
35
+ }))
36
+ });
37
+ const initialProps = await _document.default.getInitialProps(ctx);
38
+ return {
39
+ ...initialProps,
40
+ styles: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.default.Fragment, {
41
+ children: [
42
+ initialProps.styles,
43
+ sheet.getStyleElement()
44
+ ]
45
+ })
46
+ };
47
+ } finally{
48
+ sheet.seal();
49
+ }
50
+ }
51
+ render() {
52
+ const { locale, defaultLocale } = this.props.__NEXT_DATA__;
53
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_document.Html, {
54
+ lang: locale || defaultLocale,
55
+ className: "no-js",
56
+ children: [
57
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_document.Head, {
58
+ children: [
59
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Meta.default, {}),
60
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_NoJs.default, {})
61
+ ]
62
+ }),
63
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("body", {
64
+ children: [
65
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_document.Main, {}),
66
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_document.NextScript, {})
67
+ ]
68
+ })
69
+ ]
58
70
  });
59
- };
60
- Document.prototype.render = function () {
61
- var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
62
- return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale || defaultLocale, className: "no-js", children: [(0, jsx_runtime_1.jsxs)(document_1.Head, { children: [(0, jsx_runtime_1.jsx)(Meta_1.default, {}), (0, jsx_runtime_1.jsx)(NoJs_1.default, {})] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
63
- };
64
- return Document;
65
- }(document_1.default));
66
- exports.Document = Document;
67
- exports.default = Document;
71
+ }
72
+ };
73
+ const _default = Document;