@koine/next 1.0.0 → 1.0.3

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 (67) hide show
  1. package/Analytics/AnalyticsGoogle.d.ts +6 -0
  2. package/Analytics/index.d.ts +1 -0
  3. package/Auth/helpers.d.ts +17 -0
  4. package/Auth/index.d.ts +4 -0
  5. package/Auth/useLogin.d.ts +7 -0
  6. package/Auth/useLoginUrl.d.ts +1 -0
  7. package/Auth/useLogout.d.ts +6 -0
  8. package/Favicon/Favicon.d.ts +4 -0
  9. package/Favicon/index.d.ts +1 -0
  10. package/Forms/index.d.ts +2 -0
  11. package/Forms/useForm.d.ts +32 -0
  12. package/Forms/useSubmit.d.ts +24 -0
  13. package/Head/Head.d.ts +1 -0
  14. package/Head/index.d.ts +1 -0
  15. package/I18n/I18n.d.ts +48 -0
  16. package/I18n/index.d.ts +1 -0
  17. package/Img/Img.d.ts +21 -0
  18. package/Img/index.d.ts +1 -0
  19. package/Link/Link.d.ts +8 -0
  20. package/Link/index.d.ts +1 -0
  21. package/NextProgress/NextProgress.d.ts +14 -0
  22. package/NextProgress/index.d.ts +1 -0
  23. package/Seo/Seo.d.ts +3 -0
  24. package/Seo/SeoDefaults.d.ts +3 -0
  25. package/Seo/helpers.d.ts +48 -0
  26. package/Seo/index.d.ts +12 -0
  27. package/Theme/Theme.d.ts +46 -0
  28. package/Theme/index.d.ts +1 -0
  29. package/Theme.js +1905 -0
  30. package/_tslib.js +41 -0
  31. package/app/App--emotion.d.ts +10 -0
  32. package/app/App--sc.d.ts +10 -0
  33. package/app/App--vanilla.d.ts +10 -0
  34. package/app/AppAuth--emotion.d.ts +10 -0
  35. package/app/AppAuth--sc.d.ts +10 -0
  36. package/app/AppHead.d.ts +3 -0
  37. package/app/AppMain--vanilla.d.ts +27 -0
  38. package/app/AppMain.d.ts +34 -0
  39. package/app/AppTheme--emotion.d.ts +15 -0
  40. package/app/AppTheme--sc.d.ts +13 -0
  41. package/app/AppTheme--vanilla.d.ts +10 -0
  42. package/app/index.d.ts +11 -0
  43. package/app/motion-features.d.ts +2 -0
  44. package/app.js +250 -0
  45. package/config/index.d.ts +58 -0
  46. package/config.js +183 -0
  47. package/document/Document--emotion.d.ts +5 -0
  48. package/document/Document--sc.d.ts +11 -0
  49. package/document/Document--vanilla.d.ts +11 -0
  50. package/document/Document.d.ts +10 -0
  51. package/document/emotion.d.ts +5 -0
  52. package/document/index.d.ts +4 -0
  53. package/document.js +207 -0
  54. package/emotion.js +1329 -0
  55. package/es.object.assign.js +1074 -0
  56. package/es.string.replace.js +785 -0
  57. package/es.string.split.js +201 -0
  58. package/index.d.ts +12 -0
  59. package/index.esm.js +4437 -4406
  60. package/index.js +743 -0
  61. package/index.umd.js +4635 -4623
  62. package/motion-features.js +10 -0
  63. package/package.json +17 -10
  64. package/types.d.ts +91 -0
  65. package/utils/api.d.ts +55 -0
  66. package/utils/index.d.ts +19 -0
  67. package/motion-features.esm.js +0 -2
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare type AnalyticsGoogleProps = {
3
+ /** Falls back to `.env` variable `NEXT_PUBLIC_GTM_ID` */
4
+ id?: string;
5
+ };
6
+ export declare const AnalyticsGoogle: ({ id }: AnalyticsGoogleProps) => JSX.Element | null;
@@ -0,0 +1 @@
1
+ export * from "./AnalyticsGoogle";
@@ -0,0 +1,17 @@
1
+ import type { Translate } from "../I18n";
2
+ /**
3
+ * @see next/auth `pages` mapping: https://next-auth.js.org/configuration/pages`
4
+ */
5
+ export declare type AuthRoutesMap = {
6
+ login?: string;
7
+ profile?: string;
8
+ register?: string;
9
+ /** Array of regexes to match pathnames of protected routes */
10
+ secured?: RegExp[];
11
+ };
12
+ export declare const AUTH_ROUTES: AuthRoutesMap;
13
+ export declare function getAuthRoutes(t: Translate): AuthRoutesMap;
14
+ /**
15
+ * @param url e.g. "http://localhost:3000/signin?callbackUrl=http://localhost:3000/profile"
16
+ */
17
+ export declare function getCallbackUrl(url?: string): string;
@@ -0,0 +1,4 @@
1
+ export * from "./helpers";
2
+ export * from "./useLogin";
3
+ export * from "./useLoginUrl";
4
+ export * from "./useLogout";
@@ -0,0 +1,7 @@
1
+ import { SubmitHandler } from "react-hook-form";
2
+ export declare function useLogin<LoginForm = {}>(): {
3
+ submit: SubmitHandler<LoginForm>;
4
+ loading: boolean;
5
+ ok: boolean;
6
+ fail: boolean;
7
+ };
@@ -0,0 +1 @@
1
+ export declare function useLoginUrl(): string;
@@ -0,0 +1,6 @@
1
+ export declare function useLogout(): {
2
+ submit: (event: React.SyntheticEvent<HTMLFormElement>) => void;
3
+ loading: boolean;
4
+ ok: boolean;
5
+ fail: boolean;
6
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { FaviconTagsProps } from "@koine/react";
3
+ export declare type FaviconProps = FaviconTagsProps;
4
+ export declare const Favicon: (props: FaviconTagsProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./Favicon";
@@ -0,0 +1,2 @@
1
+ export * from "./useForm";
2
+ export * from "./useSubmit";
@@ -0,0 +1,32 @@
1
+ import type { UseFormProps, FieldValues } from "react-hook-form";
2
+ import type { ObjectSchema } from "yup";
3
+ import { TranslateNamespace } from "../I18n";
4
+ export declare function useForm<T extends FieldValues>(schema: ObjectSchema<any>, i18nNamespace: TranslateNamespace, formProps?: UseFormProps, debug?: boolean): {
5
+ watch: import("react-hook-form").UseFormWatch<T>;
6
+ getValues: import("react-hook-form").UseFormGetValues<T>;
7
+ getFieldState: import("react-hook-form").UseFormGetFieldState<T>;
8
+ setError: import("react-hook-form").UseFormSetError<T>;
9
+ clearErrors: import("react-hook-form").UseFormClearErrors<T>;
10
+ setValue: import("react-hook-form").UseFormSetValue<T>;
11
+ trigger: import("react-hook-form").UseFormTrigger<T>;
12
+ formState: import("react-hook-form").FormState<T>;
13
+ resetField: import("react-hook-form").UseFormResetField<T>;
14
+ reset: import("react-hook-form").UseFormReset<T>;
15
+ handleSubmit: import("react-hook-form").UseFormHandleSubmit<T>;
16
+ unregister: import("react-hook-form").UseFormUnregister<T>;
17
+ control: import("react-hook-form").Control<T, any>;
18
+ register: import("react-hook-form").UseFormRegister<T>;
19
+ setFocus: import("react-hook-form").UseFormSetFocus<T>;
20
+ field: {
21
+ control: import("react-hook-form").Control<T, any>;
22
+ register: import("react-hook-form").UseFormRegister<T>;
23
+ setValue: import("react-hook-form").UseFormSetValue<T>;
24
+ t: <R extends unknown = string>(s: string, q?: "obj" | {
25
+ [key: string]: string | number | boolean;
26
+ } | null | undefined, o?: "obj" | {
27
+ returnObjects?: boolean | undefined;
28
+ fallback?: string | string[] | undefined;
29
+ default?: string | undefined;
30
+ } | undefined) => R;
31
+ };
32
+ };
@@ -0,0 +1,24 @@
1
+ import type { UnpackNestedValue } from "react-hook-form";
2
+ import { KoineApi } from "../utils/api";
3
+ export declare function useSubmit<RequestBody extends {}, ResponseSuccesfull extends KoineApi.ResponseSuccesfull = {}, ResponseFailed extends KoineApi.ResponseFailed = Record<keyof RequestBody, string | string[]>>(url: string, transformData?: (json: UnpackNestedValue<RequestBody>) => any): {
4
+ submit: (json: any) => Promise<KoineApi.Response<ResponseSuccesfull, ResponseFailed>>;
5
+ loading: boolean;
6
+ } & {
7
+ status: number;
8
+ msg: string;
9
+ } & ({
10
+ ok?: boolean | undefined;
11
+ fail?: boolean | undefined;
12
+ loading: true;
13
+ data?: undefined;
14
+ } | {
15
+ ok: true;
16
+ fail?: false | undefined;
17
+ loading?: false | undefined;
18
+ data: ResponseSuccesfull;
19
+ } | {
20
+ ok?: false | undefined;
21
+ fail: true;
22
+ loading?: false | undefined;
23
+ data: ResponseFailed;
24
+ });
package/Head/Head.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as Head } from "next/head";
@@ -0,0 +1 @@
1
+ export * from "./Head";
package/I18n/I18n.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import format from "date-fns/format";
2
+ import { Option } from "@koine/react";
3
+ export { default as T } from "next-translate/Trans";
4
+ declare type Join<S1, S2> = S1 extends string ? S2 extends string ? `${S1}.${S2}` : never : never;
5
+ declare type Paths<T> = {
6
+ [K in keyof T]: T[K] extends Record<string, unknown> ? Join<K, Paths<T[K]>> : K;
7
+ }[keyof T];
8
+ export declare type AllPaths = {
9
+ [N in keyof Koine.NextTranslations]: {
10
+ [K in keyof Koine.NextTranslations[N]]: Koine.NextTranslations[N][K] extends Array<Record<string, unknown>> ? Join<K extends string ? `${N}:${K}` : `${N}:`, Paths<Koine.NextTranslations[N][K]>> : Koine.NextTranslations[N][K] extends Record<string, unknown> ? Join<K extends string ? `${N}:${K}` : `${N}:`, Paths<Koine.NextTranslations[N][K]>> : Koine.NextTranslations[N][K] extends Array<string | number | boolean> ? Join<K extends string ? `${N}:${K}` : `${N}`, Paths<Koine.NextTranslations[N][K]>> : Koine.NextTranslations[N][K] extends string | number | boolean ? K extends string ? `${N}:${K}` : `${N}:` : ``;
11
+ }[keyof Koine.NextTranslations[N]];
12
+ }[keyof Koine.NextTranslations];
13
+ declare type TranslateReturn<Q extends TranslationQuery, O extends TranslationOptions> = string;
14
+ /**
15
+ * Passing just `obj` is a shortcut for `{ returnObjects: true }`
16
+ */
17
+ declare type TranslationQuery = undefined | null | "obj" | {
18
+ [key: string]: string | number | boolean;
19
+ };
20
+ /**
21
+ * Passing just `obj` is a shortcut for `{ returnObjects: true }`
22
+ */
23
+ declare type TranslationOptions = undefined | "obj" | {
24
+ returnObjects?: boolean;
25
+ fallback?: string | string[];
26
+ default?: string;
27
+ };
28
+ export declare type TranslateNamespace = keyof Koine.NextTranslations;
29
+ export declare type TranslateKey = AllPaths;
30
+ export declare type Translate<R extends unknown = string, N extends undefined | keyof Koine.NextTranslations = undefined, Q extends TranslationQuery = undefined, O extends TranslationOptions = undefined> = (s: N extends keyof Koine.NextTranslations ? Paths<Koine.NextTranslations[N]> | AllPaths : AllPaths, q?: Q, o?: O) => R extends undefined | unknown ? TranslateReturn<Q, O> : R;
31
+ export declare type TranslateLoose = (s: any, q?: any, o?: any) => string;
32
+ /**
33
+ * FIXME: the use of `useMemo` is a hopefully-temporary solution to fix the FOUC
34
+ * problem of untranslated text during page transitions
35
+ *
36
+ * @see https://github.com/vinissimus/next-translate/issues/513#issuecomment-779826418
37
+ */
38
+ export declare function useT<N extends TranslateNamespace | undefined>(namespace?: N): <R extends unknown = string>(s: N extends TranslateNamespace ? Paths<Koine.NextTranslations[N]> | AllPaths : AllPaths, q?: TranslationQuery, o?: TranslationOptions) => R;
39
+ /**
40
+ * @deprecated Not sure whether this will ever be useful
41
+ */
42
+ export declare function useLooseT(namespace?: string): import("next-translate").Translate;
43
+ export declare function translationAsOptions(t: TranslateLoose, i18nKey: string): Option[];
44
+ /**
45
+ * Automatically returns the `date-fns/format` function with the right locale
46
+ * passed as option (grabbed from next router value).
47
+ */
48
+ export declare const useDateFormat: () => typeof format;
@@ -0,0 +1 @@
1
+ export * from "./I18n";
package/Img/Img.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import NextImage, { ImageProps as NextImageProps, StaticImageData } from "next/image";
3
+ import { KoineImgSmartProps, KoineImgSmartWrapProps } from "@koine/react";
4
+ interface StaticRequire {
5
+ default: StaticImageData;
6
+ }
7
+ declare type StaticImport = StaticRequire | StaticImageData;
8
+ export declare type NextImgProps = Omit<React.ComponentPropsWithoutRef<"img">, "src"> & Omit<NextImageProps, "src"> & {
9
+ src: string | StaticImport;
10
+ };
11
+ export declare const NextImg: typeof NextImage;
12
+ export declare type NextImgSmartWrapProps = KoineImgSmartWrapProps;
13
+ export declare type NextImgSmartProps = KoineImgSmartProps & NextImgProps;
14
+ export declare const NextImgSmart: (props: NextImgSmartProps) => JSX.Element;
15
+ export declare function getNextImgProps<T>({ src, alt, layout, blurDataURL, width, height, priority, objectFit, objectPosition, ...restProps }: T & NextImgProps): {
16
+ nextImgProps: NextImgProps;
17
+ restProps: Omit<T & Omit<Pick<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "key" | keyof React.ImgHTMLAttributes<HTMLImageElement>>, "src"> & Omit<NextImageProps, "src"> & {
18
+ src: string | StaticImport;
19
+ }, "alt" | "height" | "src" | "width" | "layout" | "priority" | "blurDataURL" | "objectFit" | "objectPosition">;
20
+ };
21
+ export {};
package/Img/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./Img";
package/Link/Link.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { LinkProps as NextLinkProps } from "next/link";
3
+ import { KoineLinkProps } from "@koine/react";
4
+ export declare type LinkProps = Omit<KoineLinkProps, "href"> & Omit<NextLinkProps, "as" | "passHref" | "children">;
5
+ /**
6
+ * @see https://next.js.org/docs/api-reference/next/link
7
+ */
8
+ export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "slot" | "style" | "title" | "key" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "replace" | "scroll" | "shallow" | "prefetch" | "locale"> & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1 @@
1
+ export * from "./Link";
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export declare type NextProgressProps = {
3
+ /** @default 0.3 */
4
+ startAt: number;
5
+ /** @default true */
6
+ showOnShallow: boolean;
7
+ /** @default 200 */
8
+ stopDelayMs: number;
9
+ };
10
+ export declare const NextProgress: ({ startAt, showOnShallow, stopDelayMs, }: {
11
+ startAt?: number | undefined;
12
+ showOnShallow?: boolean | undefined;
13
+ stopDelayMs?: number | undefined;
14
+ }) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./NextProgress";
package/Seo/Seo.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { SeoProps } from "./helpers";
3
+ export declare const Seo: React.MemoExoticComponent<(props: SeoProps) => JSX.Element>;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { SeoDefaultsProps } from "./helpers";
3
+ export declare const SeoDefaults: React.MemoExoticComponent<(props: SeoDefaultsProps) => JSX.Element>;
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import type { NextSeoProps, DefaultSeoProps } from "next-seo/lib/types";
3
+ export declare type SeoData = {
4
+ hidden?: boolean;
5
+ title?: string;
6
+ description?: string;
7
+ keywords?: string | string[];
8
+ ogimage?: string;
9
+ };
10
+ declare type SeoPropsOpenGraph = NextSeoProps["openGraph"] & {
11
+ image?: string;
12
+ };
13
+ /**
14
+ * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L395
15
+ */
16
+ export declare type SeoProps = Omit<NextSeoProps, "additionalMetaTags" | "additionalLinkTags" | "mobileAlternate" | "robotsProps"> & {
17
+ metaTags?: NextSeoProps["additionalMetaTags"];
18
+ linkTags?: NextSeoProps["additionalLinkTags"];
19
+ seo?: SeoData;
20
+ hidden?: SeoData["hidden"];
21
+ keywords?: SeoData["keywords"];
22
+ openGraph?: SeoPropsOpenGraph;
23
+ og?: SeoPropsOpenGraph;
24
+ };
25
+ /**
26
+ * @see https://github.com/garmeeh/next-seo/blob/master/src/types.ts#L413
27
+ */
28
+ export declare type SeoDefaultsProps = Omit<DefaultSeoProps, "additionalMetaTags" | "additionalLinkTags" | "dangerouslySetAllPagesToNoIndex" | "dangerouslySetAllPagesToNoFollow" | "defaultOpenGraphImageWidth" | "defaultOpenGraphImageHeight" | "defaultOpenGraphVideoWidth" | "defaultOpenGraphVideoHeight" | "mobileAlternate" | "robotsProps"> & {
29
+ metaTags?: DefaultSeoProps["additionalMetaTags"];
30
+ linkTags?: DefaultSeoProps["additionalLinkTags"];
31
+ };
32
+ declare type BuildTagsParams = SeoProps & SeoDefaultsProps;
33
+ /**
34
+ * We do a couple of things in addition while many other are removed.
35
+ *
36
+ * - Add `seo` meta object coming from a CMS probably
37
+ * - Add `ogimage` and `openGraph.image` as single image source
38
+ * - Add `og` alias to define `openGraph`
39
+ * - Add check for `title` equale to `templateTitle` to avoid meta titles like
40
+ * "My site | My site" often happening in homepages
41
+ * - Remove the open graph videos and images
42
+ *
43
+ * - Shorter code
44
+ *
45
+ * @returns
46
+ */
47
+ export declare const buildTags: ({ seo, hidden, keywords, title, titleTemplate, defaultTitle, noindex, nofollow, description, languageAlternates, twitter, facebook, openGraph, og: ogAlias, canonical, metaTags, linkTags, }?: BuildTagsParams) => React.ReactNode[];
48
+ export {};
package/Seo/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file
3
+ *
4
+ * Adapted from https://github.com/garmeeh/next-seo
5
+ *
6
+ * See also:
7
+ * - https://github.com/catnose99/next-head-seo
8
+ * - https://nextjs.org/docs/api-reference/next/head
9
+ */
10
+ export * from "./helpers";
11
+ export * from "./Seo";
12
+ export * from "./SeoDefaults";
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @file
3
+ *
4
+ * Adapted from [next-themes](https://github.com/pacocoursey/next-themes)
5
+ */
6
+ import React from "react";
7
+ declare type ValueObject = {
8
+ [themeName: string]: string;
9
+ };
10
+ export declare type UseThemeProps = {
11
+ /** List of all available theme names */
12
+ themes: string[];
13
+ /** Forced theme name for the current page */
14
+ forcedTheme?: string;
15
+ /** Update the theme */
16
+ setTheme: (theme: string) => void;
17
+ /** Active theme name */
18
+ theme?: string;
19
+ /** 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` */
20
+ resolvedTheme?: string;
21
+ /** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
22
+ systemTheme?: "dark" | "light";
23
+ };
24
+ export declare type ThemeProviderProps = {
25
+ /** List of all available theme names */
26
+ themes?: string[];
27
+ /** Forced theme name for the current page */
28
+ forcedTheme?: string;
29
+ /** Whether to switch between dark and light themes based on prefers-color-scheme */
30
+ enableSystem?: boolean;
31
+ /** Disable all CSS transitions when switching themes */
32
+ disableTransitionOnChange?: boolean;
33
+ /** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
34
+ enableColorScheme?: boolean;
35
+ /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
36
+ defaultTheme?: string;
37
+ /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
38
+ attribute?: string | "class";
39
+ /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
40
+ value?: ValueObject;
41
+ /** Nonce string to pass to the inline script for CSP headers */
42
+ nonce?: string;
43
+ };
44
+ export declare const useTheme: () => UseThemeProps;
45
+ export declare const ThemeProvider: React.FC<ThemeProviderProps>;
46
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Theme";