@koine/next 1.0.10 → 1.0.13
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/Analytics/AnalyticsGoogle.d.ts +5 -0
- package/Analytics/AnalyticsGoogle.js +33 -0
- package/Analytics/index.d.ts +1 -0
- package/Analytics/index.js +1 -0
- package/Analytics/package.json +6 -0
- package/Auth/helpers.d.ts +17 -0
- package/Auth/helpers.js +22 -0
- package/Auth/index.d.ts +4 -0
- package/Auth/index.js +4 -0
- package/Auth/package.json +6 -0
- package/Auth/useLogin.d.ts +7 -0
- package/Auth/useLogin.js +49 -0
- package/Auth/useLoginUrl.d.ts +1 -0
- package/Auth/useLoginUrl.js +11 -0
- package/Auth/useLogout.d.ts +6 -0
- package/Auth/useLogout.js +52 -0
- package/Favicon/Favicon.d.ts +3 -0
- package/Favicon/Favicon.js +5 -0
- package/Favicon/index.d.ts +1 -0
- package/Favicon/index.js +1 -0
- package/Favicon/package.json +6 -0
- package/Forms/index.d.ts +2 -0
- package/Forms/index.js +2 -0
- package/Forms/package.json +6 -0
- package/Forms/useForm.d.ts +32 -0
- package/Forms/useForm.js +35 -0
- package/Forms/useSubmit.d.ts +24 -0
- package/Forms/useSubmit.js +28 -0
- package/Head/Head.d.ts +1 -0
- package/Head/Head.js +1 -0
- package/Head/index.d.ts +1 -0
- package/Head/index.js +1 -0
- package/Head/package.json +6 -0
- package/I18n/I18n.d.ts +44 -0
- package/I18n/I18n.js +95 -0
- package/I18n/index.d.ts +1 -0
- package/I18n/index.js +1 -0
- package/I18n/package.json +6 -0
- package/Img/Img.d.ts +21 -0
- package/Img/Img.js +30 -0
- package/Img/index.d.ts +1 -0
- package/Img/index.js +1 -0
- package/Img/package.json +6 -0
- package/Link/Link.d.ts +9 -0
- package/Link/Link.js +11 -0
- package/Link/index.d.ts +1 -0
- package/Link/index.js +1 -0
- package/Link/package.json +6 -0
- package/NextProgress/NextProgress.d.ts +24 -0
- package/NextProgress/NextProgress.js +40 -0
- package/NextProgress/index.d.ts +2 -0
- package/NextProgress/index.js +1 -0
- package/NextProgress/package.json +6 -0
- package/Seo/Seo.d.ts +3 -0
- package/Seo/Seo.js +8 -0
- package/Seo/SeoDefaults.d.ts +3 -0
- package/Seo/SeoDefaults.js +12 -0
- package/Seo/helpers.d.ts +48 -0
- package/Seo/helpers.js +115 -0
- package/Seo/index.d.ts +12 -0
- package/Seo/index.js +12 -0
- package/Seo/package.json +6 -0
- package/Theme/Theme.d.ts +46 -0
- package/Theme/Theme.js +245 -0
- package/Theme/index.d.ts +1 -0
- package/Theme/index.js +1 -0
- package/Theme/package.json +6 -0
- package/app/AppHead.d.ts +2 -0
- package/app/AppHead.js +5 -0
- package/app/AppMain.d.ts +35 -0
- package/app/AppMain.js +1 -0
- package/app/css/AppMain.d.ts +8 -0
- package/app/css/AppMain.js +13 -0
- package/app/css/AppTheme.d.ts +10 -0
- package/app/css/AppTheme.js +14 -0
- package/app/css/auth/index.d.ts +9 -0
- package/app/css/auth/index.js +14 -0
- package/app/css/auth/package.json +6 -0
- package/app/css/index.d.ts +54 -0
- package/app/css/index.js +58 -0
- package/app/css/package.json +6 -0
- package/app/em/AppMain.d.ts +10 -0
- package/app/em/AppMain.js +24 -0
- package/app/em/AppTheme.d.ts +15 -0
- package/app/em/AppTheme.js +18 -0
- package/app/em/auth/index.d.ts +9 -0
- package/app/em/auth/index.js +14 -0
- package/app/em/auth/package.json +6 -0
- package/app/em/index.d.ts +9 -0
- package/app/em/index.js +13 -0
- package/app/em/package.json +6 -0
- package/app/index.d.ts +2 -0
- package/app/index.js +2 -0
- package/app/package.json +6 -0
- package/app/sc/AppMain.d.ts +10 -0
- package/app/sc/AppMain.js +24 -0
- package/app/sc/AppTheme.d.ts +13 -0
- package/app/sc/AppTheme.js +11 -0
- package/app/sc/auth/index.d.ts +9 -0
- package/app/sc/auth/index.js +14 -0
- package/app/sc/auth/package.json +6 -0
- package/app/sc/index.d.ts +56 -0
- package/app/sc/index.js +60 -0
- package/app/sc/package.json +6 -0
- package/config/index.d.ts +84 -0
- package/config/index.js +190 -0
- package/config/package.json +6 -0
- package/document/Document.d.ts +15 -0
- package/document/Document.js +26 -0
- package/document/css/index.d.ts +22 -0
- package/document/css/index.js +44 -0
- package/document/css/package.json +6 -0
- package/document/em/index.d.ts +16 -0
- package/document/em/index.js +59 -0
- package/document/em/package.json +6 -0
- package/document/index.d.ts +2 -0
- package/document/index.js +2 -0
- package/document/package.json +6 -0
- package/document/sc/index.d.ts +20 -0
- package/document/sc/index.js +65 -0
- package/document/sc/package.json +6 -0
- package/index.d.ts +12 -0
- package/index.js +12 -0
- package/package.json +11 -13
- package/utils/api.d.ts +55 -0
- package/utils/api.js +44 -0
- package/utils/emotion-cache.d.ts +5 -0
- package/utils/emotion-cache.js +8 -0
- package/utils/index.d.ts +19 -0
- package/utils/index.js +27 -0
- package/utils/package.json +6 -0
package/Img/Img.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import NextImage from "next/image";
|
|
5
|
+
export var NextImg = NextImage;
|
|
6
|
+
export var NextImgSmart = function (props) {
|
|
7
|
+
var _a = useState(false), $loaded = _a[0], setLoaded = _a[1];
|
|
8
|
+
var _b = useState(false), $error = _b[0], setError = _b[1];
|
|
9
|
+
var _c = getNextImgProps(props), nextImgProps = _c.nextImgProps, restProps = _c.restProps;
|
|
10
|
+
var Wrap = restProps.Wrap;
|
|
11
|
+
return nextImgProps.priority ? (_jsx(NextImage, __assign({}, nextImgProps))) : (_jsx(Wrap, __assign({}, restProps, { "$loaded": $loaded, "$error": $error }, { children: _jsx(NextImage, __assign({}, nextImgProps, { onLoadingComplete: function () { return setLoaded(true); }, onError: function () { return setError(true); } })) })));
|
|
12
|
+
};
|
|
13
|
+
export function getNextImgProps(_a) {
|
|
14
|
+
var src = _a.src, alt = _a.alt, layout = _a.layout, blurDataURL = _a.blurDataURL, width = _a.width, height = _a.height, priority = _a.priority, objectFit = _a.objectFit, objectPosition = _a.objectPosition, restProps = __rest(_a, ["src", "alt", "layout", "blurDataURL", "width", "height", "priority", "objectFit", "objectPosition"]);
|
|
15
|
+
var nextImgProps = {
|
|
16
|
+
src: src,
|
|
17
|
+
alt: alt,
|
|
18
|
+
layout: layout,
|
|
19
|
+
blurDataURL: blurDataURL,
|
|
20
|
+
width: width,
|
|
21
|
+
height: height,
|
|
22
|
+
priority: priority,
|
|
23
|
+
objectFit: objectFit,
|
|
24
|
+
objectPosition: objectPosition,
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
nextImgProps: nextImgProps,
|
|
28
|
+
restProps: restProps,
|
|
29
|
+
};
|
|
30
|
+
}
|
package/Img/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Img";
|
package/Img/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Img";
|
package/Img/package.json
ADDED
package/Link/Link.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LinkProps as NextLinkProps } from "next/link";
|
|
3
|
+
export declare type LinkProps = Omit<React.ComponentPropsWithRef<"a">, "href"> & Omit<NextLinkProps, "as" | "passHref" | "children"> & {
|
|
4
|
+
Link?: React.ComponentType<any>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @see https://next.js.org/docs/api-reference/next/link
|
|
8
|
+
*/
|
|
9
|
+
export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "key" | "title" | "hidden" | "type" | "locale" | "replace" | "slot" | "style" | "children" | "rel" | "href" | "hrefLang" | "property" | "id" | "prefetch" | "onLoad" | "color" | "onBlur" | "onChange" | "onSubmit" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "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" | "download" | "media" | "ping" | "target" | "scroll" | "shallow" | "legacyBehavior" | "Link"> & React.RefAttributes<HTMLAnchorElement>>;
|
package/Link/Link.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import NextLink from "next/link";
|
|
5
|
+
/**
|
|
6
|
+
* @see https://next.js.org/docs/api-reference/next/link
|
|
7
|
+
*/
|
|
8
|
+
export var Link = forwardRef(function Link(_a, ref) {
|
|
9
|
+
var href = _a.href, prefetch = _a.prefetch, replace = _a.replace, scroll = _a.scroll, shallow = _a.shallow, locale = _a.locale, _b = _a.Link, Link = _b === void 0 ? "span" : _b, props = __rest(_a, ["href", "prefetch", "replace", "scroll", "shallow", "locale", "Link"]);
|
|
10
|
+
return (_jsx(NextLink, __assign({ href: href, replace: replace, scroll: scroll, shallow: shallow, locale: locale, passHref: true }, { children: _jsx(Link, __assign({ ref: ref }, props)) })));
|
|
11
|
+
});
|
package/Link/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Link";
|
package/Link/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Link";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WithComponents, Simplify } from "@koine/react";
|
|
2
|
+
declare type OwnProps = {
|
|
3
|
+
/** @default 0.3 */
|
|
4
|
+
startAt?: number;
|
|
5
|
+
/** @default true */
|
|
6
|
+
showOnShallow?: boolean;
|
|
7
|
+
/** @default 200 */
|
|
8
|
+
stopDelayMs?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare type Components = {
|
|
11
|
+
Overlay: {
|
|
12
|
+
type: "div";
|
|
13
|
+
props: {
|
|
14
|
+
running?: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare type ComponentsProps = {
|
|
19
|
+
[Name in keyof Components]: Components[Name]["props"];
|
|
20
|
+
};
|
|
21
|
+
declare type Props = Simplify<WithComponents<OwnProps, Components>>;
|
|
22
|
+
export declare type NextProgressProps = Props;
|
|
23
|
+
export declare const NextProgress: ({ startAt, showOnShallow, stopDelayMs, Overlay, }: NextProgressProps) => JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useRouter } from "next/router";
|
|
4
|
+
export var NextProgress = function (_a) {
|
|
5
|
+
var _b = _a.startAt, startAt = _b === void 0 ? 0.3 : _b, _c = _a.showOnShallow, showOnShallow = _c === void 0 ? true : _c, _d = _a.stopDelayMs, stopDelayMs = _d === void 0 ? 200 : _d, _e = _a.Overlay, Overlay = _e === void 0 ? "div" : _e;
|
|
6
|
+
var events = useRouter().events;
|
|
7
|
+
// const [progress, setProgress] = useState(0);
|
|
8
|
+
var _f = useState(false), running = _f[0], setRunning = _f[1];
|
|
9
|
+
var timer = useRef(null);
|
|
10
|
+
var routeChangeStart = useCallback(function (_, _a) {
|
|
11
|
+
var shallow = _a.shallow;
|
|
12
|
+
if (!shallow || showOnShallow) {
|
|
13
|
+
// setProgress(startAt);
|
|
14
|
+
setRunning(true);
|
|
15
|
+
}
|
|
16
|
+
}, [showOnShallow]);
|
|
17
|
+
var routeChangeEnd = useCallback(function (_, _a) {
|
|
18
|
+
var shallow = _a.shallow;
|
|
19
|
+
if (!shallow || showOnShallow) {
|
|
20
|
+
if (timer.current) {
|
|
21
|
+
clearTimeout(timer.current);
|
|
22
|
+
}
|
|
23
|
+
timer.current = setTimeout(function () {
|
|
24
|
+
// setProgress(100);
|
|
25
|
+
setRunning(false);
|
|
26
|
+
}, stopDelayMs);
|
|
27
|
+
}
|
|
28
|
+
}, [showOnShallow, stopDelayMs, timer]);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
events.on("routeChangeStart", routeChangeStart);
|
|
31
|
+
events.on("routeChangeComplete", routeChangeEnd);
|
|
32
|
+
events.on("routeChangeError", routeChangeEnd);
|
|
33
|
+
return function () {
|
|
34
|
+
events.off("routeChangeStart", routeChangeStart);
|
|
35
|
+
events.off("routeChangeComplete", routeChangeEnd);
|
|
36
|
+
events.off("routeChangeError", routeChangeEnd);
|
|
37
|
+
};
|
|
38
|
+
}, [events, routeChangeStart, routeChangeEnd]);
|
|
39
|
+
return _jsx(Overlay, { running: running });
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NextProgress } from "./NextProgress";
|
package/Seo/Seo.d.ts
ADDED
package/Seo/Seo.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import Head from "next/head";
|
|
4
|
+
import { buildTags } from "./helpers";
|
|
5
|
+
var _Seo = function (props) {
|
|
6
|
+
return _jsx(Head, { children: buildTags(props) });
|
|
7
|
+
};
|
|
8
|
+
export var Seo = memo(_Seo);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import Head from "next/head";
|
|
4
|
+
// import { useRouter } from "next/router";
|
|
5
|
+
// import { getSiteUrl } from "../utils";
|
|
6
|
+
import { buildTags } from "./helpers";
|
|
7
|
+
var _SeoDefaults = function (props) {
|
|
8
|
+
// const router = useRouter();
|
|
9
|
+
// props.openGraph.url = getSiteUrl(router.asPath);
|
|
10
|
+
return _jsx(Head, { children: buildTags(props) });
|
|
11
|
+
};
|
|
12
|
+
export var SeoDefaults = memo(_SeoDefaults);
|
package/Seo/helpers.d.ts
ADDED
|
@@ -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/helpers.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { isArray } from "@koine/utils";
|
|
4
|
+
var defaults = {
|
|
5
|
+
tplTitle: "",
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* We do a couple of things in addition while many other 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` equale 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
|
+
*/
|
|
21
|
+
export var buildTags = function (_a) {
|
|
22
|
+
var _b = _a === void 0 ? {} : _a, seo = _b.seo, hidden = _b.hidden, keywords = _b.keywords, _c = _b.title, title = _c === void 0 ? "" : _c, titleTemplate = _b.titleTemplate, defaultTitle = _b.defaultTitle, noindex = _b.noindex, nofollow = _b.nofollow, description = _b.description, _d = _b.languageAlternates, languageAlternates = _d === void 0 ? [] : _d, twitter = _b.twitter, facebook = _b.facebook, openGraph = _b.openGraph, ogAlias = _b.og, canonical = _b.canonical, metaTags = _b.metaTags, linkTags = _b.linkTags;
|
|
23
|
+
var render = [];
|
|
24
|
+
var $names = {};
|
|
25
|
+
var $properties = {};
|
|
26
|
+
if (titleTemplate) {
|
|
27
|
+
defaults.tplTitle = titleTemplate;
|
|
28
|
+
}
|
|
29
|
+
title = title || (seo === null || seo === void 0 ? void 0 : seo.title) || "";
|
|
30
|
+
if (title) {
|
|
31
|
+
if (defaults.tplTitle && defaults.tplTitle !== title) {
|
|
32
|
+
title = defaults.tplTitle.replace(/%s/g, title);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (defaultTitle) {
|
|
36
|
+
title = defaultTitle;
|
|
37
|
+
}
|
|
38
|
+
if (title) {
|
|
39
|
+
render.push(_jsx("title", { children: title }, "title"));
|
|
40
|
+
$properties["og:title"] = title; // overridden later...
|
|
41
|
+
}
|
|
42
|
+
$names["robots"] = "".concat(noindex || hidden ? "noindex" : "index", ",").concat(nofollow || hidden ? "nofollow" : "follow");
|
|
43
|
+
description = description || (seo === null || seo === void 0 ? void 0 : seo.description);
|
|
44
|
+
if (description) {
|
|
45
|
+
$names["description"] = description;
|
|
46
|
+
$properties["og:description"] = description; // overridden later...
|
|
47
|
+
}
|
|
48
|
+
keywords = keywords || (seo === null || seo === void 0 ? void 0 : seo.keywords);
|
|
49
|
+
if (keywords) {
|
|
50
|
+
$names["keywords"] = isArray(keywords) ? keywords.join(", ") : keywords;
|
|
51
|
+
}
|
|
52
|
+
if ((languageAlternates === null || languageAlternates === void 0 ? void 0 : languageAlternates.length) > 0) {
|
|
53
|
+
languageAlternates.forEach(function (languageAlternate) {
|
|
54
|
+
render.push(_jsx("link", { rel: "alternate", hrefLang: languageAlternate.hrefLang, href: languageAlternate.href }, "languageAlternate-".concat(languageAlternate.hrefLang)));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (canonical) {
|
|
58
|
+
render.push(_jsx("link", { rel: "canonical", href: canonical }, "canonical"));
|
|
59
|
+
$properties["og:url"] = canonical;
|
|
60
|
+
}
|
|
61
|
+
if (facebook === null || facebook === void 0 ? void 0 : facebook.appId)
|
|
62
|
+
$properties["fb:app_id"] = facebook.appId;
|
|
63
|
+
if (twitter) {
|
|
64
|
+
if (twitter.cardType)
|
|
65
|
+
$names["twitter:card"] = twitter.cardType;
|
|
66
|
+
if (twitter.site)
|
|
67
|
+
$names["twitter:site"] = twitter.site;
|
|
68
|
+
if (twitter.handle)
|
|
69
|
+
$names["twitter:creator"] = twitter.handle;
|
|
70
|
+
}
|
|
71
|
+
var og = ogAlias || openGraph;
|
|
72
|
+
if (og === null || og === void 0 ? void 0 : og.title)
|
|
73
|
+
$properties["og:title"] = og === null || og === void 0 ? void 0 : og.title;
|
|
74
|
+
if (og === null || og === void 0 ? void 0 : og.description)
|
|
75
|
+
$properties["og:description"] = og === null || og === void 0 ? void 0 : og.description;
|
|
76
|
+
if (og === null || og === void 0 ? void 0 : og.url)
|
|
77
|
+
$properties["og:url"] = og.url;
|
|
78
|
+
if (og === null || og === void 0 ? void 0 : og.type)
|
|
79
|
+
$properties["og:type"] = og.type.toLowerCase();
|
|
80
|
+
if (og === null || og === void 0 ? void 0 : og.locale)
|
|
81
|
+
$properties["og:locale"] = og.locale;
|
|
82
|
+
if (og === null || og === void 0 ? void 0 : og.site_name)
|
|
83
|
+
$properties["og:site_name"] = og.site_name;
|
|
84
|
+
var ogimage = (og === null || og === void 0 ? void 0 : og.image) || (seo === null || seo === void 0 ? void 0 : seo.ogimage);
|
|
85
|
+
if (ogimage)
|
|
86
|
+
$properties["og:image"] = ogimage;
|
|
87
|
+
Object.keys($names).forEach(function (key) {
|
|
88
|
+
render.push(_jsx("meta", { name: key, content: $names[key] }, key));
|
|
89
|
+
});
|
|
90
|
+
Object.keys($properties).forEach(function (key) {
|
|
91
|
+
render.push(_jsx("meta", { property: key, content: $properties[key] }, key));
|
|
92
|
+
});
|
|
93
|
+
if (metaTags && metaTags.length > 0) {
|
|
94
|
+
metaTags.forEach(function (tag) {
|
|
95
|
+
var _a, _b, _c;
|
|
96
|
+
render.push(_jsx("meta", __assign({}, tag), "meta:".concat((_c = (_b = (_a = tag.keyOverride) !== null && _a !== void 0 ? _a : tag.name) !== null && _b !== void 0 ? _b : tag.property) !== null && _c !== void 0 ? _c : tag.httpEquiv)));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (linkTags === null || linkTags === void 0 ? void 0 : linkTags.length) {
|
|
100
|
+
linkTags.forEach(function (tag) {
|
|
101
|
+
var _a;
|
|
102
|
+
render.push(_jsx("link", __assign({}, tag), "link".concat((_a = tag.keyOverride) !== null && _a !== void 0 ? _a : tag.href).concat(tag.rel)));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// TODO: alternates and canonical
|
|
106
|
+
// canonical = 'https://www.domain.com/';
|
|
107
|
+
// languageAlternates={[{
|
|
108
|
+
// hrefLang: 'en',
|
|
109
|
+
// href: 'https://www.domain.com/en',
|
|
110
|
+
// }]}
|
|
111
|
+
// <link rel="alternate" hreflang="x-default" href="https://www.domain.com/nl/">
|
|
112
|
+
// <link rel="alternate" hreflang="nl" href="https://www.domain.com/nl/">
|
|
113
|
+
// <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
|
|
114
|
+
return render;
|
|
115
|
+
};
|
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";
|
package/Seo/index.js
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";
|
package/Seo/package.json
ADDED
package/Theme/Theme.d.ts
ADDED
|
@@ -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 = React.PropsWithChildren<{
|
|
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: ({ forcedTheme, disableTransitionOnChange, enableSystem, enableColorScheme, themes, defaultTheme, attribute, value, children, nonce, }: ThemeProviderProps) => JSX.Element;
|
|
46
|
+
export {};
|