@koine/next 2.0.0-beta.9 → 2.0.0-beta.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/12/AnalyticsGoogle.d.ts +1 -2
- package/12/DisableErrorOverlay.d.ts +1 -6
- package/12/Seo.d.ts +8 -26
- package/12/SeoDefaults.d.ts +3 -4
- package/12/seoBuildTags.d.ts +2 -17
- package/12/types.d.ts +2 -0
- package/12.cjs.d.ts +1 -0
- package/12.cjs.default.js +1 -0
- package/12.cjs.js +34 -0
- package/12.cjs.mjs +2 -0
- package/12.d.ts +3 -0
- package/12.esm.js +24 -0
- package/README.md +0 -12
- package/ThemeContext.cjs.d.ts +2 -0
- package/ThemeContext.cjs.default.js +1 -0
- package/ThemeContext.cjs.js +11 -0
- package/ThemeContext.cjs.mjs +2 -0
- package/ThemeContext.d.ts +11 -0
- package/ThemeContext.esm.js +6 -0
- package/ThemeProvider.cjs.d.ts +2 -0
- package/ThemeProvider.cjs.default.js +1 -0
- package/ThemeProvider.cjs.js +47 -0
- package/ThemeProvider.cjs.mjs +2 -0
- package/ThemeProvider.d.ts +17 -0
- package/ThemeProvider.esm.js +38 -0
- package/config.cjs.d.ts +1 -0
- package/config.cjs.default.js +1 -0
- package/config.cjs.js +29 -0
- package/config.cjs.mjs +2 -0
- package/config.d.ts +8 -0
- package/config.esm.js +25 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +19 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +3 -1
- package/index.esm.js +8 -0
- package/load.cjs.d.ts +2 -0
- package/load.cjs.default.js +1 -0
- package/load.cjs.js +15 -0
- package/load.cjs.mjs +2 -0
- package/load.d.ts +0 -8
- package/{load.mjs → load.esm.js} +3 -6
- package/package.json +49 -89
- package/typings.d.ts +39 -50
- package/useTheme.cjs.d.ts +2 -0
- package/useTheme.cjs.default.js +1 -0
- package/useTheme.cjs.js +13 -0
- package/useTheme.cjs.mjs +2 -0
- package/useTheme.d.ts +4 -0
- package/useTheme.esm.js +8 -0
- package/12/AnalyticsGoogle.js +0 -79
- package/12/AnalyticsGoogle.mjs +0 -60
- package/12/DisableErrorOverlay.js +0 -31
- package/12/DisableErrorOverlay.mjs +0 -16
- package/12/DynamicNamespaces.d.ts +0 -13
- package/12/DynamicNamespaces.js +0 -23
- package/12/DynamicNamespaces.mjs +0 -8
- package/12/Favicon.d.ts +0 -4
- package/12/Favicon.js +0 -29
- package/12/Favicon.mjs +0 -10
- package/12/Link.d.ts +0 -10
- package/12/Link.js +0 -38
- package/12/Link.mjs +0 -20
- package/12/NextProgress.d.ts +0 -25
- package/12/NextProgress.js +0 -69
- package/12/NextProgress.mjs +0 -51
- package/12/Seo.js +0 -29
- package/12/Seo.mjs +0 -30
- package/12/SeoDefaults.js +0 -31
- package/12/SeoDefaults.mjs +0 -14
- package/12/T.d.ts +0 -16
- package/12/T.js +0 -43
- package/12/T.mjs +0 -27
- package/12/ThemeContext.d.ts +0 -17
- package/12/ThemeContext.js +0 -25
- package/12/ThemeContext.mjs +0 -7
- package/12/ThemeProvider.d.ts +0 -35
- package/12/ThemeProvider.js +0 -256
- package/12/ThemeProvider.mjs +0 -245
- package/12/TransText.d.ts +0 -3
- package/12/TransText.js +0 -23
- package/12/TransText.mjs +0 -4
- package/12/app/AppHead.d.ts +0 -3
- package/12/app/AppHead.js +0 -31
- package/12/app/AppHead.mjs +0 -12
- package/12/app/AppMain.d.ts +0 -35
- package/12/app/AppMain.js +0 -6
- package/12/app/AppMain.mjs +0 -1
- package/12/app/css/AppMain.d.ts +0 -9
- package/12/app/css/AppMain.js +0 -39
- package/12/app/css/AppMain.mjs +0 -24
- package/12/app/css/AppTheme.d.ts +0 -11
- package/12/app/css/AppTheme.js +0 -33
- package/12/app/css/AppTheme.mjs +0 -17
- package/12/app/css/auth/index.d.ts +0 -11
- package/12/app/css/auth/index.js +0 -40
- package/12/app/css/auth/index.mjs +0 -24
- package/12/app/css/index.d.ts +0 -54
- package/12/app/css/index.js +0 -36
- package/12/app/css/index.mjs +0 -65
- package/12/app/index.d.ts +0 -2
- package/12/app/index.js +0 -7
- package/12/app/index.mjs +0 -2
- package/12/app/sc/AppMain.d.ts +0 -11
- package/12/app/sc/AppMain.js +0 -70
- package/12/app/sc/AppMain.mjs +0 -58
- package/12/app/sc/AppTheme.d.ts +0 -14
- package/12/app/sc/AppTheme.js +0 -33
- package/12/app/sc/AppTheme.mjs +0 -16
- package/12/app/sc/auth/index.d.ts +0 -11
- package/12/app/sc/auth/index.js +0 -40
- package/12/app/sc/auth/index.mjs +0 -24
- package/12/app/sc/index.d.ts +0 -56
- package/12/app/sc/index.js +0 -36
- package/12/app/sc/index.mjs +0 -67
- package/12/document/Document.d.ts +0 -15
- package/12/document/Document.js +0 -49
- package/12/document/Document.mjs +0 -38
- package/12/document/css/index.d.ts +0 -17
- package/12/document/css/index.js +0 -60
- package/12/document/css/index.mjs +0 -53
- package/12/document/index.d.ts +0 -2
- package/12/document/index.js +0 -19
- package/12/document/index.mjs +0 -2
- package/12/document/sc/index.d.ts +0 -19
- package/12/document/sc/index.js +0 -73
- package/12/document/sc/index.mjs +0 -65
- package/12/getT.d.ts +0 -9
- package/12/getT.js +0 -23
- package/12/getT.mjs +0 -8
- package/12/index.d.ts +0 -24
- package/12/index.js +0 -100
- package/12/index.mjs +0 -27
- package/12/seoBuildTags.js +0 -126
- package/12/seoBuildTags.mjs +0 -121
- package/12/to.d.ts +0 -24
- package/12/to.js +0 -31
- package/12/to.mjs +0 -19
- package/12/translationAsOptions.d.ts +0 -3
- package/12/translationAsOptions.js +0 -19
- package/12/translationAsOptions.mjs +0 -9
- package/12/types-i18n.d.ts +0 -118
- package/12/types-i18n.js +0 -15
- package/12/types-i18n.mjs +0 -12
- package/12/types-seo.d.ts +0 -7
- package/12/types-seo.js +0 -4
- package/12/types-seo.mjs +0 -1
- package/12/useBackUrl.d.ts +0 -2
- package/12/useBackUrl.js +0 -47
- package/12/useBackUrl.mjs +0 -28
- package/12/useDateFormat.d.ts +0 -7
- package/12/useDateFormat.js +0 -42
- package/12/useDateFormat.mjs +0 -26
- package/12/useForm.d.ts +0 -27
- package/12/useForm.js +0 -65
- package/12/useForm.mjs +0 -47
- package/12/useLocale.d.ts +0 -2
- package/12/useLocale.js +0 -25
- package/12/useLocale.mjs +0 -6
- package/12/useT.d.ts +0 -4
- package/12/useT.js +0 -58
- package/12/useT.mjs +0 -39
- package/12/useTheme.d.ts +0 -7
- package/12/useTheme.js +0 -23
- package/12/useTheme.mjs +0 -7
- package/12/useTo.d.ts +0 -3
- package/12/useTo.js +0 -26
- package/12/useTo.mjs +0 -8
- package/config/index.d.ts +0 -160
- package/config/index.js +0 -317
- package/config/index.mjs +0 -315
- package/getSiteUrl.d.ts +0 -8
- package/getSiteUrl.js +0 -24
- package/getSiteUrl.mjs +0 -10
- package/index.js +0 -20
- package/index.mjs +0 -2
- package/load.js +0 -31
package/12/AnalyticsGoogle.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type AnalyticsGoogleProps = {
|
|
2
|
-
/** Falls back to `.env` variable `NEXT_PUBLIC_GTM_ID` */
|
|
3
2
|
id?: string;
|
|
4
3
|
};
|
|
5
|
-
export declare
|
|
4
|
+
export declare let AnalyticsGoogle: ({ id }: AnalyticsGoogleProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
5
|
export default AnalyticsGoogle;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Disable error overlay during `dev`
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
|
|
5
|
-
*/
|
|
6
|
-
export declare const DisableErrorOverlay: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare let DisableErrorOverlay: () => import("react/jsx-runtime").JSX.Element;
|
|
7
2
|
export default DisableErrorOverlay;
|
package/12/Seo.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { NextSeoProps } from "next-seo/lib/types";
|
|
2
2
|
import { type LinkTag, type MetaTag } from "./seoBuildTags";
|
|
3
|
-
|
|
3
|
+
export type SeoData = {
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
keywords?: string | string[];
|
|
8
|
+
ogimage?: string;
|
|
9
|
+
};
|
|
4
10
|
type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
|
|
5
11
|
image?: string;
|
|
6
12
|
};
|
|
7
|
-
/**
|
|
8
|
-
* @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L395
|
|
9
|
-
*/
|
|
10
13
|
export type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLinkTags" | "mobileAlternate" | "robotsProps"> & {
|
|
11
14
|
metaTags?: ReadonlyArray<MetaTag>;
|
|
12
15
|
linkTags?: ReadonlyArray<LinkTag>;
|
|
@@ -16,26 +19,5 @@ export type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLink
|
|
|
16
19
|
openGraph?: SeoPropsOpenGraph;
|
|
17
20
|
og?: SeoPropsOpenGraph;
|
|
18
21
|
};
|
|
19
|
-
|
|
20
|
-
* Adapted from [garmeeh/next-seo](https://github.com/garmeeh/next-seo)
|
|
21
|
-
*
|
|
22
|
-
* See also:
|
|
23
|
-
* - https://github.com/catnose99/next-head-seo
|
|
24
|
-
* - https://nextjs.org/docs/api-reference/next/head
|
|
25
|
-
*
|
|
26
|
-
* NB: on the homepage you usually want to customize the `titleTemplate` to avoid
|
|
27
|
-
* doubled app name. Assuming your default seo configuration is something like:
|
|
28
|
-
*
|
|
29
|
-
* ```js
|
|
30
|
-
* {
|
|
31
|
-
* titleTemplate: "%s | MyApp"
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* On the homepage you migh want to override it, e.g.:
|
|
36
|
-
* ```js
|
|
37
|
-
* <Seo title="MyApp | Some description" titleTemplate="%s" />
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare const Seo: (props: SeoProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare let Seo: (props: SeoProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
23
|
export default Seo;
|
package/12/SeoDefaults.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { DefaultSeoProps } from "next-seo/lib/types";
|
|
2
|
+
import type { JsonObject } from "@koine/utils";
|
|
2
3
|
import { type LinkTag, type MetaTag } from "./seoBuildTags";
|
|
3
|
-
/**
|
|
4
|
-
* @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
|
|
5
|
-
*/
|
|
6
4
|
export type SeoDefaultsProps = Omit<DefaultSeoProps, "additionalMetaTags" | "additionalLinkTags" | "dangerouslySetAllPagesToNoIndex" | "dangerouslySetAllPagesToNoFollow" | "defaultOpenGraphImageWidth" | "defaultOpenGraphImageHeight" | "defaultOpenGraphVideoWidth" | "defaultOpenGraphVideoHeight" | "mobileAlternate" | "robotsProps"> & {
|
|
7
5
|
metaTags?: ReadonlyArray<MetaTag>;
|
|
8
6
|
linkTags?: ReadonlyArray<LinkTag>;
|
|
7
|
+
schema?: JsonObject;
|
|
9
8
|
};
|
|
10
|
-
export declare
|
|
9
|
+
export declare let SeoDefaults: (props: SeoDefaultsProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default SeoDefaults;
|
package/12/seoBuildTags.d.ts
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { SeoProps } from "./Seo";
|
|
3
3
|
import type { SeoDefaultsProps } from "./SeoDefaults";
|
|
4
4
|
export type MetaTag = React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
|
|
5
5
|
export type LinkTag = React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
|
|
6
6
|
type BuildTagsParams = SeoProps & SeoDefaultsProps;
|
|
7
|
-
|
|
8
|
-
* Comparing to `next-seo` we do a couple of things in addition while many
|
|
9
|
-
* others are removed.
|
|
10
|
-
*
|
|
11
|
-
* - Add `seo` meta object coming from a CMS probably
|
|
12
|
-
* - Add `ogimage` and `openGraph.image` as single image source
|
|
13
|
-
* - Add `og` alias to define `openGraph`
|
|
14
|
-
* - Add check for `title` equal to `templateTitle` to avoid meta titles like
|
|
15
|
-
* "My site | My site" often happening in homepages
|
|
16
|
-
* - Remove the open graph videos and images
|
|
17
|
-
*
|
|
18
|
-
* - Shorter code
|
|
19
|
-
*
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
export declare const seoBuildTags: ({ seo, hidden, keywords, title, titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates, twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags, }?: BuildTagsParams) => React.ReactNode[];
|
|
7
|
+
export declare const seoBuildTags: ({ seo, hidden, keywords, title, titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates, twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags, schema, }?: BuildTagsParams) => import("react").ReactNode[];
|
|
23
8
|
export default seoBuildTags;
|
package/12/types.d.ts
ADDED
package/12.cjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./12";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./12.cjs.js').default;
|
package/12.cjs.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var router = require('next/router');
|
|
7
|
+
var o = require('next/script');
|
|
8
|
+
var react = require('react');
|
|
9
|
+
var browser = require('@koine/browser');
|
|
10
|
+
var r = require('next/head');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var o__default = /*#__PURE__*/_interopDefaultLegacy(o);
|
|
15
|
+
var r__default = /*#__PURE__*/_interopDefaultLegacy(r);
|
|
16
|
+
|
|
17
|
+
/** Falls back to `.env` variable `NEXT_PUBLIC_GTM_ID` */let AnalyticsGoogle=({id:s})=>{let l=s||process.env.NEXT_PUBLIC_GTM_ID,{events:m,asPath:c,query:d}=router.useRouter(),[p,f]=react.useState(!1),[w,u]=react.useState(!1);return (// const [url, setUrl] = useState("");
|
|
18
|
+
react.useEffect(()=>{let e=()=>{u(!0);};return m.on("routeChangeComplete",e),()=>{m.off("routeChangeComplete",e);}},[m]),react.useEffect(()=>{w&&p&&c&&// const search = query;
|
|
19
|
+
browser.gtagPageview(c);},[c,d,w,p]),l)?/*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[/*#__PURE__*/jsxRuntime.jsx(o__default["default"],{id:"google-tagmanager",src:`https://www.googletagmanager.com/gtag/js?id=${s}`,strategy:"afterInteractive",onLoad:()=>f(!0)}),/*#__PURE__*/jsxRuntime.jsx(o__default["default"],{id:"google-analytics",strategy:"afterInteractive",children:`
|
|
20
|
+
window.dataLayer = window.dataLayer || [];
|
|
21
|
+
function gtag(){window.dataLayer.push(arguments);}
|
|
22
|
+
gtag('js', new Date());
|
|
23
|
+
|
|
24
|
+
gtag('config', '${s}', { 'send_page_view': false });
|
|
25
|
+
`})]}):null};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Disable error overlay during `dev`
|
|
29
|
+
*
|
|
30
|
+
* @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
|
|
31
|
+
*/let DisableErrorOverlay=()=>/*#__PURE__*/jsxRuntime.jsx(r__default["default"],{children:"development"===process.env.NODE_ENV&&/*#__PURE__*/jsxRuntime.jsx("script",{dangerouslySetInnerHTML:{__html:"window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});"}})});
|
|
32
|
+
|
|
33
|
+
exports.AnalyticsGoogle = AnalyticsGoogle;
|
|
34
|
+
exports.DisableErrorOverlay = DisableErrorOverlay;
|
package/12.cjs.mjs
ADDED
package/12.d.ts
ADDED
package/12.esm.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRouter } from 'next/router';
|
|
3
|
+
import o from 'next/script';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
import { gtagPageview } from '@koine/browser';
|
|
6
|
+
import r from 'next/head';
|
|
7
|
+
|
|
8
|
+
/** Falls back to `.env` variable `NEXT_PUBLIC_GTM_ID` */let AnalyticsGoogle=({id:s})=>{let l=s||process.env.NEXT_PUBLIC_GTM_ID,{events:m,asPath:c,query:d}=useRouter(),[p,f]=useState(!1),[w,u]=useState(!1);return (// const [url, setUrl] = useState("");
|
|
9
|
+
useEffect(()=>{let e=()=>{u(!0);};return m.on("routeChangeComplete",e),()=>{m.off("routeChangeComplete",e);}},[m]),useEffect(()=>{w&&p&&c&&// const search = query;
|
|
10
|
+
gtagPageview(c);},[c,d,w,p]),l)?/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx(o,{id:"google-tagmanager",src:`https://www.googletagmanager.com/gtag/js?id=${s}`,strategy:"afterInteractive",onLoad:()=>f(!0)}),/*#__PURE__*/jsx(o,{id:"google-analytics",strategy:"afterInteractive",children:`
|
|
11
|
+
window.dataLayer = window.dataLayer || [];
|
|
12
|
+
function gtag(){window.dataLayer.push(arguments);}
|
|
13
|
+
gtag('js', new Date());
|
|
14
|
+
|
|
15
|
+
gtag('config', '${s}', { 'send_page_view': false });
|
|
16
|
+
`})]}):null};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Disable error overlay during `dev`
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
|
|
22
|
+
*/let DisableErrorOverlay=()=>/*#__PURE__*/jsx(r,{children:"development"===process.env.NODE_ENV&&/*#__PURE__*/jsx("script",{dangerouslySetInnerHTML:{__html:"window.addEventListener('error',event =>{event.stopImmediatePropagation()});window.addEventListener('unhandledrejection',event =>{event.stopImmediatePropagation()});"}})});
|
|
23
|
+
|
|
24
|
+
export { AnalyticsGoogle, DisableErrorOverlay };
|
package/README.md
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
1
|
# @koine/next
|
|
2
|
-
|
|
3
|
-
## i18n
|
|
4
|
-
|
|
5
|
-
To make typescript work nicely with `useT`, `getT` and `T` make sure to enable [`resolveJsonModule`](https://www.typescriptlang.org/tsconfig#resolveJsonModule) in your `tsconfig.json` file:
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"compilerOptions": {
|
|
10
|
-
"resolveJsonModule": true
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./ThemeContext.cjs.js').default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
/** List of all available theme names *//** Forced theme name for the current page *//** Update the theme *//** Active theme name *//** If `enableSystem` is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to `theme` *//** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */const ThemeContext=/*#__PURE__*/react.createContext({// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8
|
+
setTheme:e=>{},themes:[]});
|
|
9
|
+
|
|
10
|
+
exports.ThemeContext = ThemeContext;
|
|
11
|
+
exports["default"] = ThemeContext;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type ThemeContextProps = {
|
|
3
|
+
themes: string[];
|
|
4
|
+
forcedTheme?: string;
|
|
5
|
+
setTheme: (theme: string) => void;
|
|
6
|
+
theme?: string;
|
|
7
|
+
resolvedTheme?: string;
|
|
8
|
+
systemTheme?: "dark" | "light";
|
|
9
|
+
};
|
|
10
|
+
export declare const ThemeContext: import("react").Context<ThemeContextProps>;
|
|
11
|
+
export default ThemeContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
/** List of all available theme names *//** Forced theme name for the current page *//** Update the theme *//** Active theme name *//** If `enableSystem` is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to `theme` *//** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */const ThemeContext=/*#__PURE__*/createContext({// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
4
|
+
setTheme:e=>{},themes:[]});
|
|
5
|
+
|
|
6
|
+
export { ThemeContext, ThemeContext as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./ThemeProvider.cjs.js').default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var o = require('next/script');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var utils = require('@koine/utils');
|
|
9
|
+
var ThemeContext = require('./ThemeContext.cjs.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var o__default = /*#__PURE__*/_interopDefaultLegacy(o);
|
|
14
|
+
|
|
15
|
+
let l=["light","dark"],d="(prefers-color-scheme: dark)",c="theme";/** List of all available theme names *//** Forced theme name for the current page *//** Whether to switch between dark and light themes based on prefers-color-scheme *//** Disable all CSS transitions when switching themes *//** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons *//** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light *//** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) *//** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value *//** Nonce string to pass to the inline script for CSP headers *//**
|
|
16
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
17
|
+
*
|
|
18
|
+
* Differences:
|
|
19
|
+
*
|
|
20
|
+
* - enableColorScheme: `false` by default (instead of `true`), this plays more
|
|
21
|
+
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
22
|
+
* controlled by tailwind modifiers
|
|
23
|
+
*/const ThemeProvider=({forcedTheme:r,disableTransitionOnChange:o=!1,enableSystem:v=!0,enableColorScheme:y,themes:p=["light","dark"],defaultTheme:g=v?"system":"light",attribute:w="data-theme",value:x,children:S,nonce:k})=>{let[b,L]=react.useState(()=>u(c,g)),[T,j]=react.useState(()=>u(c)),C=x?Object.values(x):p,E=react.useCallback(e=>{let t=e;if(utils.isServer||!t)return;"system"===// If theme is system, resolve it before setting theme
|
|
24
|
+
e&&v&&(t=f());let r=x?x[t]:t,i=o?$():null,n=document.documentElement;if("class"===w?(n.classList.remove(...C),r&&n.classList.add(r)):r?n.setAttribute(w,r):n.removeAttribute(w),y){let e=l.includes(g)?g:"",r=l.includes(t)?t:e;n.style.colorScheme=r;}i?.();},[w,C,g,o,y,v,x]),I=react.useCallback(e=>{L(e);// Save to storage
|
|
25
|
+
try{localStorage.setItem(c,e);}catch(e){}},// Unsupported
|
|
26
|
+
[]),M=react.useCallback(e=>{j(f(e)),"system"===b&&v&&!r&&E("system");},[b,v,r,E]);return(// Always listen to System preference
|
|
27
|
+
react.useEffect(()=>{let e=window.matchMedia(d);return(// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
28
|
+
e.addListener(M),M(e),()=>e.removeListener(M))},[M]),// localStorage event handling
|
|
29
|
+
react.useEffect(()=>{let e=e=>{e.key===c&&I(// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
30
|
+
e.newValue||g);};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[g,I]),// Whenever theme or forcedTheme changes, apply it
|
|
31
|
+
react.useEffect(()=>{E(r??b);},[E,r,b]),/*#__PURE__*/jsxRuntime.jsxs(ThemeContext.ThemeContext.Provider,{value:{theme:b,setTheme:I,forcedTheme:r,resolvedTheme:"system"===b?T:b,themes:v?[...p,"system"]:p,systemTheme:v?T:void 0},children:[/*#__PURE__*/jsxRuntime.jsx(h,{forcedTheme:r,disableTransitionOnChange:o,enableSystem:v,enableColorScheme:y,themes:p,defaultTheme:g,attribute:w,value:x,children:S,attrs:C,nonce:k}),S]}))};let h=/*#__PURE__*/react.memo(({forcedTheme:t,attribute:o,enableSystem:i,enableColorScheme:n,defaultTheme:s,value:a,attrs:m,nonce:h})=>{let u="system"===s,// Code-golfing the amount of characters in the script
|
|
32
|
+
$=(()=>{let e=`d.remove(${m.map(e=>`'${e}'`).join(",")})`;return `var d=document.documentElement.classList;${e};`})(),f=n?(l.includes(s)?s:null)?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",y=(e,t=!1,r=!0)=>{let i=a?a[e]:e,s=t?e+"|| ''":`'${i}'`,m="";return(// MUCH faster to set colorScheme alongside HTML attribute/class
|
|
33
|
+
// as it only incurs 1 style recalculation rather than 2
|
|
34
|
+
// This can save over 250ms of work for pages with big DOM
|
|
35
|
+
n&&r&&!t&&l.includes(e)&&(m+=`d.style.colorScheme = '${e}';`),"class"===o?t||i?m+=`d.add(${s})`:m+="null":i&&(m+=`d[s](n, ${s})`),m)},p=t?`!function(){${$}${y(t)}}()`:i?`!function(){try {${$}var e=localStorage.getItem('${c}');if("system"===e||(!e&&${u})){var t="${d}",m=window.matchMedia(t);if(m.media!==t||m.matches){${y("dark")}}else{${y("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${y(a?"x[e]":"e",!0)}}${u?"":"else{"+y(s,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${$}var e=localStorage.getItem("${c}");if(e){${a?`var x=${JSON.stringify(a)};`:""}${y(a?"x[e]":"e",!0)}}else{${y(s,!1,!1)};}${f}}catch(t){}}();`;return /*#__PURE__*/jsxRuntime.jsx(o__default["default"],{id:"next-theme-script",strategy:"beforeInteractive",src:// We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
|
|
36
|
+
// However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
|
|
37
|
+
// But our script cannot be external because it changes at runtime based on React props
|
|
38
|
+
// so we trick next/script by passing `src` as a base64 JS script
|
|
39
|
+
`data:text/javascript;base64,${v(p)}`,nonce:h})},// Never re-render this component
|
|
40
|
+
()=>!0),// Helpers
|
|
41
|
+
u=(e,t)=>{let r;if(!utils.isServer){try{r=localStorage.getItem(e)||void 0;}catch(e){}// Unsupported
|
|
42
|
+
return r||t}},$=()=>{let e=document,t=e.createElement("style");return t.appendChild(e.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),e.head.appendChild(t),()=>{// Force restyle
|
|
43
|
+
window.getComputedStyle(e.body),// Wait for next tick before removing
|
|
44
|
+
setTimeout(()=>{e.head.removeChild(t);},1);}},f=e=>(e||(e=window.matchMedia(d)),e.matches?"dark":"light"),v=e=>utils.isServer?Buffer.from(e).toString("base64"):btoa(e);
|
|
45
|
+
|
|
46
|
+
exports.ThemeProvider = ThemeProvider;
|
|
47
|
+
exports["default"] = ThemeProvider;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ValueObject = {
|
|
3
|
+
[themeName: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export type ThemeProviderProps = React.PropsWithChildren<{
|
|
6
|
+
themes?: string[];
|
|
7
|
+
forcedTheme?: string;
|
|
8
|
+
enableSystem?: boolean;
|
|
9
|
+
disableTransitionOnChange?: boolean;
|
|
10
|
+
enableColorScheme?: boolean;
|
|
11
|
+
defaultTheme?: string;
|
|
12
|
+
attribute?: string | "class";
|
|
13
|
+
value?: ValueObject;
|
|
14
|
+
nonce?: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const ThemeProvider: ({ forcedTheme, disableTransitionOnChange, enableSystem, enableColorScheme, themes, defaultTheme, attribute, value, children, nonce, }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default ThemeProvider;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import o from 'next/script';
|
|
3
|
+
import { useState, useCallback, useEffect, memo } from 'react';
|
|
4
|
+
import { isServer } from '@koine/utils';
|
|
5
|
+
import { ThemeContext } from './ThemeContext.esm.js';
|
|
6
|
+
|
|
7
|
+
let l=["light","dark"],d="(prefers-color-scheme: dark)",c="theme";/** List of all available theme names *//** Forced theme name for the current page *//** Whether to switch between dark and light themes based on prefers-color-scheme *//** Disable all CSS transitions when switching themes *//** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons *//** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light *//** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) *//** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value *//** Nonce string to pass to the inline script for CSP headers *//**
|
|
8
|
+
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
9
|
+
*
|
|
10
|
+
* Differences:
|
|
11
|
+
*
|
|
12
|
+
* - enableColorScheme: `false` by default (instead of `true`), this plays more
|
|
13
|
+
* nicely with tailwind `dark` class mode as dark theme is supposed to be only
|
|
14
|
+
* controlled by tailwind modifiers
|
|
15
|
+
*/const ThemeProvider=({forcedTheme:r,disableTransitionOnChange:o=!1,enableSystem:v=!0,enableColorScheme:y,themes:p=["light","dark"],defaultTheme:g=v?"system":"light",attribute:w="data-theme",value:x,children:S,nonce:k})=>{let[b,L]=useState(()=>u(c,g)),[T,j]=useState(()=>u(c)),C=x?Object.values(x):p,E=useCallback(e=>{let t=e;if(isServer||!t)return;"system"===// If theme is system, resolve it before setting theme
|
|
16
|
+
e&&v&&(t=f());let r=x?x[t]:t,i=o?$():null,n=document.documentElement;if("class"===w?(n.classList.remove(...C),r&&n.classList.add(r)):r?n.setAttribute(w,r):n.removeAttribute(w),y){let e=l.includes(g)?g:"",r=l.includes(t)?t:e;n.style.colorScheme=r;}i?.();},[w,C,g,o,y,v,x]),I=useCallback(e=>{L(e);// Save to storage
|
|
17
|
+
try{localStorage.setItem(c,e);}catch(e){}},// Unsupported
|
|
18
|
+
[]),M=useCallback(e=>{j(f(e)),"system"===b&&v&&!r&&E("system");},[b,v,r,E]);return(// Always listen to System preference
|
|
19
|
+
useEffect(()=>{let e=window.matchMedia(d);return(// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
20
|
+
e.addListener(M),M(e),()=>e.removeListener(M))},[M]),// localStorage event handling
|
|
21
|
+
useEffect(()=>{let e=e=>{e.key===c&&I(// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
22
|
+
e.newValue||g);};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[g,I]),// Whenever theme or forcedTheme changes, apply it
|
|
23
|
+
useEffect(()=>{E(r??b);},[E,r,b]),/*#__PURE__*/jsxs(ThemeContext.Provider,{value:{theme:b,setTheme:I,forcedTheme:r,resolvedTheme:"system"===b?T:b,themes:v?[...p,"system"]:p,systemTheme:v?T:void 0},children:[/*#__PURE__*/jsx(h,{forcedTheme:r,disableTransitionOnChange:o,enableSystem:v,enableColorScheme:y,themes:p,defaultTheme:g,attribute:w,value:x,children:S,attrs:C,nonce:k}),S]}))};let h=/*#__PURE__*/memo(({forcedTheme:t,attribute:o$1,enableSystem:i,enableColorScheme:n,defaultTheme:s,value:a,attrs:m,nonce:h})=>{let u="system"===s,// Code-golfing the amount of characters in the script
|
|
24
|
+
$=(()=>{let e=`d.remove(${m.map(e=>`'${e}'`).join(",")})`;return `var d=document.documentElement.classList;${e};`})(),f=n?(l.includes(s)?s:null)?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",y=(e,t=!1,r=!0)=>{let i=a?a[e]:e,s=t?e+"|| ''":`'${i}'`,m="";return(// MUCH faster to set colorScheme alongside HTML attribute/class
|
|
25
|
+
// as it only incurs 1 style recalculation rather than 2
|
|
26
|
+
// This can save over 250ms of work for pages with big DOM
|
|
27
|
+
n&&r&&!t&&l.includes(e)&&(m+=`d.style.colorScheme = '${e}';`),"class"===o$1?t||i?m+=`d.add(${s})`:m+="null":i&&(m+=`d[s](n, ${s})`),m)},p=t?`!function(){${$}${y(t)}}()`:i?`!function(){try {${$}var e=localStorage.getItem('${c}');if("system"===e||(!e&&${u})){var t="${d}",m=window.matchMedia(t);if(m.media!==t||m.matches){${y("dark")}}else{${y("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${y(a?"x[e]":"e",!0)}}${u?"":"else{"+y(s,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${$}var e=localStorage.getItem("${c}");if(e){${a?`var x=${JSON.stringify(a)};`:""}${y(a?"x[e]":"e",!0)}}else{${y(s,!1,!1)};}${f}}catch(t){}}();`;return /*#__PURE__*/jsx(o,{id:"next-theme-script",strategy:"beforeInteractive",src:// We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
|
|
28
|
+
// However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
|
|
29
|
+
// But our script cannot be external because it changes at runtime based on React props
|
|
30
|
+
// so we trick next/script by passing `src` as a base64 JS script
|
|
31
|
+
`data:text/javascript;base64,${v(p)}`,nonce:h})},// Never re-render this component
|
|
32
|
+
()=>!0),// Helpers
|
|
33
|
+
u=(e,t)=>{let r;if(!isServer){try{r=localStorage.getItem(e)||void 0;}catch(e){}// Unsupported
|
|
34
|
+
return r||t}},$=()=>{let e=document,t=e.createElement("style");return t.appendChild(e.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),e.head.appendChild(t),()=>{// Force restyle
|
|
35
|
+
window.getComputedStyle(e.body),// Wait for next tick before removing
|
|
36
|
+
setTimeout(()=>{e.head.removeChild(t);},1);}},f=e=>(e||(e=window.matchMedia(d)),e.matches?"dark":"light"),v=e=>isServer?Buffer.from(e).toString("base64"):btoa(e);
|
|
37
|
+
|
|
38
|
+
export { ThemeProvider, ThemeProvider as default };
|
package/config.cjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./config";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./config.cjs.js').default;
|
package/config.cjs.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var next = require('@koine/i18n/next');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @legacy
|
|
9
|
+
*//**
|
|
10
|
+
* Get Next.js config with some basic opinionated defaults
|
|
11
|
+
*
|
|
12
|
+
* @param {object} options
|
|
13
|
+
* @property {boolean} [options.nx=false] Nx monorepo setup
|
|
14
|
+
* @property {boolean} [options.svg=false] SVG to react components
|
|
15
|
+
*/let withKoine=(n={})=>{let{nx:i,svg:t,i18nRoutes:m,i18nCompiler:s,...a}=n,k={// @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
|
|
16
|
+
eslint:{ignoreDuringBuilds:!0},// we have this strict check on each commit
|
|
17
|
+
typescript:{ignoreBuildErrors:!0},// we have this strict check on each commit
|
|
18
|
+
poweredByHeader:!1,experimental:{// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
19
|
+
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
20
|
+
// optimizeCss: true,
|
|
21
|
+
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
22
|
+
scrollRestoration:!0,...a.experimental||{}},modularizeImports:{...a.modularizeImports||{},// @see https://www.zhoulujun.net/nextjs/advanced-features/compiler.html#modularize-imports
|
|
23
|
+
"@koine/api":{transform:"@koine/api/{{member}}"},"@koine/browser":{transform:"@koine/browser/{{member}}"},"@koine/dom":{transform:"@koine/dom/{{member}}"},"@koine/node":{transform:"@koine/node/{{member}}"},"@koine/i18n/?(((\\w*)?/?)*)":{transform:"@koine/i18n/{{ matches.[1] }}/{{member}}"},"@koine/react/?(((\\w*)?/?)*)":{transform:"@koine/react/{{ matches.[1] }}/{{member}}"},"@koine/next/?(((\\w*)?/?)*)":{transform:"@koine/next/{{ matches.[1] }}/{{member}}"},"@koine/utils":{transform:"@koine/utils/{{member}}"}},...a};return (t&&(i?// @see https://github.com/gregberge/svgr
|
|
24
|
+
k.nx={svgr:!0}:(// if falsy just remove the key
|
|
25
|
+
delete k.nx,k.webpack=(e,r)=>// ...[_config, options]: Parameters<NonNullable<NextConfig['webpack']>>
|
|
26
|
+
{let o="function"==typeof k.webpack?k.webpack(e,r):e;return(// @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
27
|
+
o.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),o)})),m)?next.withI18nLegacy({...k,i18nRoutes:m}):s?i?next.withI18nAsync({...k,i18nCompiler:s}):next.withI18n({...k,i18nCompiler:s}):k};
|
|
28
|
+
|
|
29
|
+
exports.withKoine = withKoine;
|
package/config.cjs.mjs
ADDED
package/config.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
import { type WithI18nAsyncOptions, type WithI18nLegacyOptions } from "@koine/i18n/next";
|
|
3
|
+
export type Routes = NonNullable<WithI18nLegacyOptions["i18nRoutes"]>["routes"];
|
|
4
|
+
export type WithKoineOptions = NextConfig & {
|
|
5
|
+
nx?: boolean;
|
|
6
|
+
svg?: boolean;
|
|
7
|
+
} & WithI18nLegacyOptions & WithI18nAsyncOptions;
|
|
8
|
+
export declare let withKoine: (options?: WithKoineOptions) => NextConfig;
|
package/config.esm.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { withI18nLegacy, withI18nAsync, withI18n } from '@koine/i18n/next';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @legacy
|
|
5
|
+
*//**
|
|
6
|
+
* Get Next.js config with some basic opinionated defaults
|
|
7
|
+
*
|
|
8
|
+
* @param {object} options
|
|
9
|
+
* @property {boolean} [options.nx=false] Nx monorepo setup
|
|
10
|
+
* @property {boolean} [options.svg=false] SVG to react components
|
|
11
|
+
*/let withKoine=(n={})=>{let{nx:i,svg:t,i18nRoutes:m,i18nCompiler:s,...a}=n,k={// @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
|
|
12
|
+
eslint:{ignoreDuringBuilds:!0},// we have this strict check on each commit
|
|
13
|
+
typescript:{ignoreBuildErrors:!0},// we have this strict check on each commit
|
|
14
|
+
poweredByHeader:!1,experimental:{// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
15
|
+
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
16
|
+
// optimizeCss: true,
|
|
17
|
+
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
18
|
+
scrollRestoration:!0,...a.experimental||{}},modularizeImports:{...a.modularizeImports||{},// @see https://www.zhoulujun.net/nextjs/advanced-features/compiler.html#modularize-imports
|
|
19
|
+
"@koine/api":{transform:"@koine/api/{{member}}"},"@koine/browser":{transform:"@koine/browser/{{member}}"},"@koine/dom":{transform:"@koine/dom/{{member}}"},"@koine/node":{transform:"@koine/node/{{member}}"},"@koine/i18n/?(((\\w*)?/?)*)":{transform:"@koine/i18n/{{ matches.[1] }}/{{member}}"},"@koine/react/?(((\\w*)?/?)*)":{transform:"@koine/react/{{ matches.[1] }}/{{member}}"},"@koine/next/?(((\\w*)?/?)*)":{transform:"@koine/next/{{ matches.[1] }}/{{member}}"},"@koine/utils":{transform:"@koine/utils/{{member}}"}},...a};return (t&&(i?// @see https://github.com/gregberge/svgr
|
|
20
|
+
k.nx={svgr:!0}:(// if falsy just remove the key
|
|
21
|
+
delete k.nx,k.webpack=(e,r)=>// ...[_config, options]: Parameters<NonNullable<NextConfig['webpack']>>
|
|
22
|
+
{let o="function"==typeof k.webpack?k.webpack(e,r):e;return(// @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
23
|
+
o.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),o)})),m)?withI18nLegacy({...k,i18nRoutes:m}):s?i?withI18nAsync({...k,i18nCompiler:s}):withI18n({...k,i18nCompiler:s}):k};
|
|
24
|
+
|
|
25
|
+
export { withKoine };
|
package/index.cjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./index.cjs.js').default;
|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var load = require('./load.cjs.js');
|
|
6
|
+
var ThemeContext = require('./ThemeContext.cjs.js');
|
|
7
|
+
var ThemeProvider = require('./ThemeProvider.cjs.js');
|
|
8
|
+
var useTheme = require('./useTheme.cjs.js');
|
|
9
|
+
require('react');
|
|
10
|
+
require('react/jsx-runtime');
|
|
11
|
+
require('next/script');
|
|
12
|
+
require('@koine/utils');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.load = load.load;
|
|
17
|
+
exports.ThemeContext = ThemeContext.ThemeContext;
|
|
18
|
+
exports.ThemeProvider = ThemeProvider.ThemeProvider;
|
|
19
|
+
exports.useTheme = useTheme.useTheme;
|
package/index.cjs.mjs
ADDED
package/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export { getSiteUrl } from "./getSiteUrl";
|
|
2
1
|
export { load } from "./load";
|
|
2
|
+
export { ThemeContext, type ThemeContextProps } from "./ThemeContext";
|
|
3
|
+
export { ThemeProvider, type ThemeProviderProps } from "./ThemeProvider";
|
|
4
|
+
export { useTheme, type UseThemeProps } from "./useTheme";
|
package/index.esm.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { load } from './load.esm.js';
|
|
2
|
+
export { ThemeContext } from './ThemeContext.esm.js';
|
|
3
|
+
export { ThemeProvider } from './ThemeProvider.esm.js';
|
|
4
|
+
export { useTheme } from './useTheme.esm.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import 'next/script';
|
|
8
|
+
import '@koine/utils';
|
package/load.cjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./load.cjs.js').default;
|
package/load.cjs.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Utility to load a component with an optional pre-determined delay.
|
|
7
|
+
*
|
|
8
|
+
* This was designed to improve anti spam with async form loading.
|
|
9
|
+
*
|
|
10
|
+
* @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
|
|
11
|
+
* @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
|
|
12
|
+
*/function load(e,o){return new Promise(t=>{setTimeout(()=>t(e),o);})}
|
|
13
|
+
|
|
14
|
+
exports["default"] = load;
|
|
15
|
+
exports.load = load;
|
package/load.cjs.mjs
ADDED
package/load.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility to load a component with an optional pre-determined delay.
|
|
3
|
-
*
|
|
4
|
-
* This was designed to improve anti spam with async form loading.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
|
|
7
|
-
* @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
|
|
8
|
-
*/
|
|
9
1
|
export declare function load<T>(component: T, milliseconds: number): Promise<T>;
|
|
10
2
|
export default load;
|
package/{load.mjs → load.esm.js}
RENAMED
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
|
|
7
7
|
* @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
export default load;
|
|
8
|
+
*/function load(e,o){return new Promise(t=>{setTimeout(()=>t(e),o);})}
|
|
9
|
+
|
|
10
|
+
export { load as default, load };
|