@koine/next 2.0.0-beta.131 → 2.0.0-beta.133

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.
@@ -1,4 +1,5 @@
1
1
  export type AnalyticsGoogleProps = {
2
+ /** Falls back to `.env` variable `NEXT_PUBLIC_GTM_ID` */
2
3
  id?: string;
3
4
  };
4
5
  export declare let AnalyticsGoogle: ({ id }: AnalyticsGoogleProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,7 @@
1
+ /**
2
+ * Disable error overlay during `dev`
3
+ *
4
+ * @see https://github.com/vercel/next.js/discussions/13387#discussioncomment-101564
5
+ */
1
6
  export declare let DisableErrorOverlay: () => import("react/jsx-runtime").JSX.Element;
2
7
  export default DisableErrorOverlay;
package/12/Seo.d.ts CHANGED
@@ -10,6 +10,9 @@ export type SeoData = {
10
10
  type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
11
11
  image?: string;
12
12
  };
13
+ /**
14
+ * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L395
15
+ */
13
16
  export type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLinkTags" | "mobileAlternate" | "robotsProps"> & {
14
17
  metaTags?: ReadonlyArray<MetaTag>;
15
18
  linkTags?: ReadonlyArray<LinkTag>;
@@ -19,5 +22,28 @@ export type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLink
19
22
  openGraph?: SeoPropsOpenGraph;
20
23
  og?: SeoPropsOpenGraph;
21
24
  };
25
+ /**
26
+ * Adapted from [garmeeh/next-seo](https://github.com/garmeeh/next-seo)
27
+ *
28
+ * See also:
29
+ * - https://github.com/catnose99/next-head-seo
30
+ * - https://nextjs.org/docs/api-reference/next/head
31
+ *
32
+ * NB: on the homepage you usually want to customize the `titleTemplate` to avoid
33
+ * doubled app name. Assuming your default seo configuration is something like:
34
+ *
35
+ * ```js
36
+ * {
37
+ * titleTemplate: "%s | MyApp"
38
+ * }
39
+ * ```
40
+ *
41
+ * On the homepage you migh want to override it, e.g.:
42
+ * ```js
43
+ * <Seo title="MyApp | Some description" titleTemplate="%s" />
44
+ * ```
45
+ *
46
+ * @deprecated
47
+ */
22
48
  export declare let Seo: (props: SeoProps) => import("react/jsx-runtime").JSX.Element;
23
49
  export default Seo;
@@ -1,10 +1,16 @@
1
1
  import type { DefaultSeoProps } from "next-seo/lib/types";
2
2
  import type { JsonObject } from "@koine/utils";
3
3
  import { type LinkTag, type MetaTag } from "./seoBuildTags";
4
+ /**
5
+ * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
6
+ */
4
7
  export type SeoDefaultsProps = Omit<DefaultSeoProps, "additionalMetaTags" | "additionalLinkTags" | "dangerouslySetAllPagesToNoIndex" | "dangerouslySetAllPagesToNoFollow" | "defaultOpenGraphImageWidth" | "defaultOpenGraphImageHeight" | "defaultOpenGraphVideoWidth" | "defaultOpenGraphVideoHeight" | "mobileAlternate" | "robotsProps"> & {
5
8
  metaTags?: ReadonlyArray<MetaTag>;
6
9
  linkTags?: ReadonlyArray<LinkTag>;
7
10
  schema?: JsonObject;
8
11
  };
12
+ /**
13
+ * @deprecated
14
+ */
9
15
  export declare let SeoDefaults: (props: SeoDefaultsProps) => import("react/jsx-runtime").JSX.Element;
10
16
  export default SeoDefaults;
@@ -3,5 +3,20 @@ import type { SeoDefaultsProps } from "./SeoDefaults";
3
3
  export type MetaTag = React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
4
4
  export type LinkTag = React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
5
5
  type BuildTagsParams = SeoProps & SeoDefaultsProps;
6
+ /**
7
+ * Comparing to `next-seo` we do a couple of things in addition while many
8
+ * others are removed.
9
+ *
10
+ * - Add `seo` meta object coming from a CMS probably
11
+ * - Add `ogimage` and `openGraph.image` as single image source
12
+ * - Add `og` alias to define `openGraph`
13
+ * - Add check for `title` equal to `templateTitle` to avoid meta titles like
14
+ * "My site | My site" often happening in homepages
15
+ * - Remove the open graph videos and images
16
+ *
17
+ * - Shorter code
18
+ *
19
+ * @returns
20
+ */
6
21
  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[];
7
22
  export default seoBuildTags;
package/12/types.d.ts CHANGED
@@ -1,2 +1,5 @@
1
+ /**
2
+ * @file Export all types separately to ease imports
3
+ */
1
4
  export type { SeoData } from "./Seo";
2
5
  export type { SeoDefaultsProps } from "./SeoDefaults";
package/ThemeContext.d.ts CHANGED
@@ -1,9 +1,15 @@
1
1
  export type ThemeContextProps = {
2
+ /** List of all available theme names */
2
3
  themes: string[];
4
+ /** Forced theme name for the current page */
3
5
  forcedTheme?: string;
6
+ /** Update the theme */
4
7
  setTheme: (theme: string) => void;
8
+ /** Active theme name */
5
9
  theme?: string;
10
+ /** 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` */
6
11
  resolvedTheme?: string;
12
+ /** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
7
13
  systemTheme?: "dark" | "light";
8
14
  };
9
15
  export declare const ThemeContext: import("react").Context<ThemeContextProps>;
@@ -2,15 +2,33 @@ type ValueObject = {
2
2
  [themeName: string]: string;
3
3
  };
4
4
  export type ThemeProviderProps = React.PropsWithChildren<{
5
+ /** List of all available theme names */
5
6
  themes?: string[];
7
+ /** Forced theme name for the current page */
6
8
  forcedTheme?: string;
9
+ /** Whether to switch between dark and light themes based on prefers-color-scheme */
7
10
  enableSystem?: boolean;
11
+ /** Disable all CSS transitions when switching themes */
8
12
  disableTransitionOnChange?: boolean;
13
+ /** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
9
14
  enableColorScheme?: boolean;
15
+ /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
10
16
  defaultTheme?: string;
17
+ /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
11
18
  attribute?: string | "class";
19
+ /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
12
20
  value?: ValueObject;
21
+ /** Nonce string to pass to the inline script for CSP headers */
13
22
  nonce?: string;
14
23
  }>;
24
+ /**
25
+ * @borrows [next-themes](https://github.com/pacocoursey/next-themes)
26
+ *
27
+ * Differences:
28
+ *
29
+ * - enableColorScheme: `false` by default (instead of `true`), this plays more
30
+ * nicely with tailwind `dark` class mode as dark theme is supposed to be only
31
+ * controlled by tailwind modifiers
32
+ */
15
33
  export declare const ThemeProvider: ({ forcedTheme, disableTransitionOnChange, enableSystem, enableColorScheme, themes, defaultTheme, attribute, value, children, nonce, }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
16
34
  export default ThemeProvider;
package/config.d.ts CHANGED
@@ -1,14 +1,38 @@
1
1
  import type { NextConfig } from "next";
2
2
  import { type WithI18nAsyncOptions, type WithI18nLegacyOptions } from "@koine/i18n/next";
3
+ /**
4
+ * @legacy
5
+ */
3
6
  export type Routes = NonNullable<WithI18nLegacyOptions["i18nRoutes"]>["routes"];
4
7
  type ModularizeShortcut = {
8
+ /**
9
+ * A list of the packages to modularize, if a `scope` is given that will be
10
+ * automatically prepended before a slash e.g. `{scope}/@{lib}`.
11
+ * @example ["components", "utils"]
12
+ */
5
13
  libs: string[];
14
+ /**
15
+ * The scope of the packages to modularize, if given a slash is automatically
16
+ * appended between the scope and the lib name
17
+ * @example "@"
18
+ */
6
19
  scope?: string;
7
20
  };
8
21
  export type WithKoineOptions = NextConfig & {
9
22
  nx?: boolean;
10
23
  svg?: boolean;
24
+ /**
25
+ * Shortcut option to automatically create swc transforms to feed into
26
+ * _Next.js_' `modularizeImports`
27
+ */
11
28
  modularize?: ModularizeShortcut[] | ModularizeShortcut;
12
29
  } & WithI18nLegacyOptions & WithI18nAsyncOptions;
30
+ /**
31
+ * Get Next.js config with some basic opinionated defaults
32
+ *
33
+ * @param {object} options
34
+ * @property {boolean} [options.nx=false] Nx monorepo setup
35
+ * @property {boolean} [options.svg=false] SVG to react components
36
+ */
13
37
  export declare let withKoine: (options?: WithKoineOptions) => NextConfig;
14
38
  export {};
package/load.d.ts CHANGED
@@ -1,2 +1,10 @@
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
+ */
1
9
  export declare function load<T>(component: T, milliseconds: number): Promise<T>;
2
10
  export default load;
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@koine/next",
3
3
  "sideEffects": false,
4
4
  "dependencies": {
5
- "@koine/browser": "2.0.0-beta.131",
6
- "@koine/utils": "2.0.0-beta.131",
7
- "@koine/i18n": "2.0.0-beta.131"
5
+ "@koine/browser": "2.0.0-beta.133",
6
+ "@koine/utils": "2.0.0-beta.133",
7
+ "@koine/i18n": "2.0.0-beta.133"
8
8
  },
9
9
  "peerDependencies": {
10
10
  "next": "^14.0.4",
@@ -64,5 +64,5 @@
64
64
  "module": "./index.esm.js",
65
65
  "main": "./index.cjs.js",
66
66
  "types": "./index.esm.d.ts",
67
- "version": "2.0.0-beta.131"
67
+ "version": "2.0.0-beta.133"
68
68
  }
package/useTheme.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import { type ThemeContextProps } from "./ThemeContext";
2
2
  export type UseThemeProps = ThemeContextProps;
3
+ /**
4
+ * @borrows [next-themes](https://github.com/pacocoursey/next-themes)
5
+ */
3
6
  export declare const useTheme: () => ThemeContextProps;
4
7
  export default useTheme;