@okam/directus-next-component 1.2.0 → 1.3.0
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/components/DirectusFile/config.d.ts +4 -0
- package/components/DirectusFile/config.js +8 -0
- package/components/DirectusFile/config.mjs +9 -0
- package/components/DirectusFile/index.d.ts +3 -0
- package/components/DirectusFile/index.js +13 -0
- package/components/DirectusFile/index.mjs +14 -0
- package/components/DirectusFile/interface.d.ts +11 -0
- package/components/DirectusImg/index.d.ts +3 -0
- package/components/DirectusImg/index.js +25 -0
- package/components/DirectusImg/index.mjs +26 -0
- package/components/DirectusImg/interface.d.ts +4 -0
- package/components/DirectusLink/index.js +4 -4
- package/components/DirectusLink/index.mjs +4 -4
- package/components/DirectusLink/interface.d.ts +7 -3
- package/components/DirectusVideo/index.d.ts +3 -0
- package/components/DirectusVideo/index.js +12 -0
- package/components/DirectusVideo/index.mjs +13 -0
- package/components/DirectusVideo/interface.d.ts +5 -0
- package/hooks/directus-file.d.ts +22 -1
- package/hooks/directus-file.js +25 -10
- package/hooks/directus-file.mjs +25 -10
- package/hooks/directus-link.d.ts +2 -2
- package/hooks/directus-link.js +61 -26
- package/hooks/directus-link.mjs +61 -26
- package/hooks/navigation-items.d.ts +1 -0
- package/hooks/navigation-items.js +25 -11
- package/hooks/navigation-items.mjs +25 -11
- package/index.d.ts +4 -1
- package/index.js +6 -0
- package/index.mjs +12 -6
- package/package.json +1 -1
- package/server.d.ts +3 -1
- package/server.js +6 -2
- package/server.mjs +12 -8
- package/types/files.d.ts +15 -9
- package/types/links.d.ts +0 -2
- package/types/navigation-items.d.ts +8 -4
- package/lib/hello-server.d.ts +0 -1
- package/lib/hello-server.js +0 -7
- package/lib/hello-server.mjs +0 -7
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const config = require("./config.js");
|
|
4
|
+
const DirectusFile = (props) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const { type, ...rest } = props;
|
|
7
|
+
const fileType = (_a = type == null ? void 0 : type.split("/")) == null ? void 0 : _a[0];
|
|
8
|
+
const configComponent = config[fileType ?? ""];
|
|
9
|
+
const { as: Component = configComponent } = props;
|
|
10
|
+
if (!Component) return null;
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest });
|
|
12
|
+
};
|
|
13
|
+
module.exports = DirectusFile;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import directusFileConfig from "./config.mjs";
|
|
3
|
+
const DirectusFile = (props) => {
|
|
4
|
+
var _a;
|
|
5
|
+
const { type, ...rest } = props;
|
|
6
|
+
const fileType = (_a = type == null ? void 0 : type.split("/")) == null ? void 0 : _a[0];
|
|
7
|
+
const configComponent = directusFileConfig[fileType ?? ""];
|
|
8
|
+
const { as: Component = configComponent } = props;
|
|
9
|
+
if (!Component) return null;
|
|
10
|
+
return /* @__PURE__ */ jsx(Component, { ...rest });
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
DirectusFile as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TDefaultComponent } from '@okam/stack-ui';
|
|
2
|
+
import type { TFiles } from '../../types/files';
|
|
3
|
+
export interface TDirectusFileProps extends TFiles, TDefaultComponent {
|
|
4
|
+
/**
|
|
5
|
+
* Serves to fall back to different parts of the URLs. Some properties have default values:
|
|
6
|
+
* - hostname: `NEXT_PUBLIC_IMG_DOMAIN`
|
|
7
|
+
* - port: `NEXT_PUBLIC_IMG_PORT`
|
|
8
|
+
* - protocol: `NEXT_PUBLIC_IMG_PROTOCOL`
|
|
9
|
+
*/
|
|
10
|
+
baseUrl?: URL;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const nextComponent = require("@okam/next-component");
|
|
4
|
+
const thumbhash = require("unlazy/thumbhash");
|
|
5
|
+
const directusFile = require("../../hooks/directus-file.js");
|
|
6
|
+
const DirectusImg = (props) => {
|
|
7
|
+
const { fit, baseUrl, focal_point_x: focalPointX, focal_point_y: focalPointY, thumbhash: thumbhash$1, width, height } = props;
|
|
8
|
+
const fileProps = directusFile(props, baseUrl, { fit });
|
|
9
|
+
if (!fileProps) return null;
|
|
10
|
+
const hasFocalPoint = !!focalPointX && !!focalPointY && !!width && !!height;
|
|
11
|
+
const style = hasFocalPoint ? {
|
|
12
|
+
objectFit: "cover",
|
|
13
|
+
objectPosition: `${focalPointX / width * 100}% ${focalPointY / height * 100}%`
|
|
14
|
+
} : void 0;
|
|
15
|
+
if (!fileProps) return null;
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
|
+
nextComponent.Img,
|
|
18
|
+
{
|
|
19
|
+
style,
|
|
20
|
+
...thumbhash$1 ? { blurDataURL: thumbhash.createPngDataUri(thumbhash$1), placeholder: "blur" } : {},
|
|
21
|
+
...fileProps
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
module.exports = DirectusImg;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Img } from "@okam/next-component";
|
|
3
|
+
import { createPngDataUri } from "unlazy/thumbhash";
|
|
4
|
+
import useDirectusFile from "../../hooks/directus-file.mjs";
|
|
5
|
+
const DirectusImg = (props) => {
|
|
6
|
+
const { fit, baseUrl, focal_point_x: focalPointX, focal_point_y: focalPointY, thumbhash, width, height } = props;
|
|
7
|
+
const fileProps = useDirectusFile(props, baseUrl, { fit });
|
|
8
|
+
if (!fileProps) return null;
|
|
9
|
+
const hasFocalPoint = !!focalPointX && !!focalPointY && !!width && !!height;
|
|
10
|
+
const style = hasFocalPoint ? {
|
|
11
|
+
objectFit: "cover",
|
|
12
|
+
objectPosition: `${focalPointX / width * 100}% ${focalPointY / height * 100}%`
|
|
13
|
+
} : void 0;
|
|
14
|
+
if (!fileProps) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Img,
|
|
17
|
+
{
|
|
18
|
+
style,
|
|
19
|
+
...thumbhash ? { blurDataURL: createPngDataUri(thumbhash), placeholder: "blur" } : {},
|
|
20
|
+
...fileProps
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
DirectusImg as default
|
|
26
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const stackUi = require("@okam/stack-ui");
|
|
4
|
-
const Link = require("next/link.js");
|
|
5
4
|
const directusLink = require("../../hooks/directus-link.js");
|
|
6
5
|
const DirectusLink = (props) => {
|
|
7
6
|
const { type, componentsConfig } = props;
|
|
8
7
|
const linkProps = directusLink(props);
|
|
9
|
-
if (!type
|
|
8
|
+
if (!type) return null;
|
|
10
9
|
const LinkComponent = componentsConfig == null ? void 0 : componentsConfig[type];
|
|
11
|
-
if (
|
|
12
|
-
|
|
10
|
+
if (LinkComponent) return /* @__PURE__ */ jsxRuntime.jsx(LinkComponent, { ...props });
|
|
11
|
+
if (!linkProps.href) return null;
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(stackUi.Anchor, { ...linkProps });
|
|
13
13
|
};
|
|
14
14
|
module.exports = DirectusLink;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Anchor } from "@okam/stack-ui";
|
|
3
|
-
import Link from "next/link.js";
|
|
4
3
|
import useDirectusLink from "../../hooks/directus-link.mjs";
|
|
5
4
|
const DirectusLink = (props) => {
|
|
6
5
|
const { type, componentsConfig } = props;
|
|
7
6
|
const linkProps = useDirectusLink(props);
|
|
8
|
-
if (!type
|
|
7
|
+
if (!type) return null;
|
|
9
8
|
const LinkComponent = componentsConfig == null ? void 0 : componentsConfig[type];
|
|
10
|
-
if (
|
|
11
|
-
|
|
9
|
+
if (LinkComponent) return /* @__PURE__ */ jsx(LinkComponent, { ...props });
|
|
10
|
+
if (!linkProps.href) return null;
|
|
11
|
+
return /* @__PURE__ */ jsx(Anchor, { ...linkProps });
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
14
|
DirectusLink as default
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { TDefaultComponent, TAnchorProps } from '@okam/stack-ui';
|
|
2
|
-
import type { ComponentType } from 'react';
|
|
2
|
+
import type { AriaAttributes, ComponentType } from 'react';
|
|
3
3
|
import type { TLinks } from '../../types/links';
|
|
4
|
-
export
|
|
4
|
+
export type TDirectusLink = Omit<TDefaultComponent, 'children'> & Omit<Partial<TLinks>, 'tokens'> & AriaAttributes;
|
|
5
|
+
export interface TUseDirectusLink extends TDirectusLink {
|
|
6
|
+
propsConfig?: TDirectusLinkPropsConfig;
|
|
7
|
+
}
|
|
8
|
+
export interface TDirectusLinkProps extends TDirectusLink {
|
|
5
9
|
componentsConfig?: TDirectusLinkComponentsConfig;
|
|
6
10
|
propsConfig?: TDirectusLinkPropsConfig;
|
|
7
11
|
}
|
|
8
12
|
export type TDirectusLinkComponentsConfig = Record<string, ComponentType<TDirectusLinkProps>>;
|
|
9
|
-
export type TDirectusLinkPropsConfig<ReturnProps extends TAnchorProps = TAnchorProps> = Record<string, (props:
|
|
13
|
+
export type TDirectusLinkPropsConfig<ReturnProps extends TAnchorProps = TAnchorProps> = Record<string, (props: TUseDirectusLink) => ReturnProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const stackUi = require("@okam/stack-ui");
|
|
4
|
+
const directusFile = require("../../hooks/directus-file.js");
|
|
5
|
+
const DirectusVideo = (props) => {
|
|
6
|
+
const { baseUrl } = props;
|
|
7
|
+
const fileProps = directusFile(props, baseUrl);
|
|
8
|
+
if (!fileProps) return null;
|
|
9
|
+
const { type } = fileProps;
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsx(stackUi.Video, { ...fileProps, type: type ?? void 0 });
|
|
11
|
+
};
|
|
12
|
+
module.exports = DirectusVideo;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Video } from "@okam/stack-ui";
|
|
3
|
+
import useDirectusFile from "../../hooks/directus-file.mjs";
|
|
4
|
+
const DirectusVideo = (props) => {
|
|
5
|
+
const { baseUrl } = props;
|
|
6
|
+
const fileProps = useDirectusFile(props, baseUrl);
|
|
7
|
+
if (!fileProps) return null;
|
|
8
|
+
const { type } = fileProps;
|
|
9
|
+
return /* @__PURE__ */ jsx(Video, { ...fileProps, type: type ?? void 0 });
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
DirectusVideo as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VideoHTMLAttributes } from 'react';
|
|
2
|
+
import type { TDirectusFileProps } from '../DirectusFile/interface';
|
|
3
|
+
type TDirectusVideoAttributes = Omit<VideoHTMLAttributes<HTMLVideoElement>, 'height' | 'id' | 'title' | 'width'>;
|
|
4
|
+
export type TDirectusVideoProps = TDirectusVideoAttributes & TDirectusFileProps;
|
|
5
|
+
export {};
|
package/hooks/directus-file.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
import type { Nullable } from '@okam/stack-ui';
|
|
2
2
|
import type { TFiles } from '../types/files';
|
|
3
|
-
export default function useDirectusFile(file: Nullable<TFiles>, baseUrl?: URL):
|
|
3
|
+
export default function useDirectusFile(file: Nullable<TFiles>, baseUrl?: URL, searchParams?: Record<string, Nullable<string>>): {
|
|
4
|
+
tags?: any;
|
|
5
|
+
location?: string | null | undefined;
|
|
6
|
+
storage?: string | null | undefined;
|
|
7
|
+
focal_point_divider?: string | null | undefined;
|
|
8
|
+
focal_point_x?: number | null | undefined;
|
|
9
|
+
focal_point_y?: number | null | undefined;
|
|
10
|
+
filename_disk?: string | null | undefined;
|
|
11
|
+
filename_download?: string | null | undefined;
|
|
12
|
+
type?: string | null | undefined;
|
|
13
|
+
duration?: number | null | undefined;
|
|
14
|
+
embed?: string | null | undefined;
|
|
15
|
+
caption?: string | null | undefined;
|
|
16
|
+
thumbhash?: string | null | undefined;
|
|
17
|
+
filenameDownload?: string | null | undefined;
|
|
18
|
+
src: string;
|
|
19
|
+
alt: string;
|
|
20
|
+
width: number | undefined;
|
|
21
|
+
height: number | undefined;
|
|
22
|
+
title: string | undefined;
|
|
23
|
+
id: string;
|
|
24
|
+
} | null;
|
package/hooks/directus-file.js
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const IMG_DOMAIN = process.env.NEXT_PUBLIC_IMG_DOMAIN;
|
|
3
3
|
const IMG_PORT = process.env.NEXT_PUBLIC_IMG_PORT;
|
|
4
|
-
const IMG_PROTOCOL = process.env.NEXT_PUBLIC_IMG_PROTOCOL;
|
|
5
|
-
function
|
|
4
|
+
const IMG_PROTOCOL = process.env.NEXT_PUBLIC_IMG_PROTOCOL ?? "https";
|
|
5
|
+
function setSearchParams(url, searchParams) {
|
|
6
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
7
|
+
if (!value) return;
|
|
8
|
+
url.searchParams.set(key, value);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function getDirectusUrl(file, baseUrl, searchParams) {
|
|
6
12
|
const { id, filename_download, filenameDownload } = file ?? {};
|
|
7
13
|
const { protocol = IMG_PROTOCOL, port = IMG_PORT, hostname = IMG_DOMAIN } = baseUrl ?? {};
|
|
8
14
|
if (!hostname || !id) return null;
|
|
9
15
|
try {
|
|
10
|
-
const url = new URL(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
16
|
+
const url = new URL(`/assets/${id}/${filename_download ?? filenameDownload ?? ""}`, `${protocol}://${hostname}`);
|
|
17
|
+
if (port) url.port = port;
|
|
18
|
+
if (searchParams) setSearchParams(url, searchParams);
|
|
14
19
|
return url;
|
|
15
20
|
} catch (error) {
|
|
16
21
|
console.warn(error);
|
|
17
22
|
return null;
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
|
-
function useDirectusFile(file, baseUrl) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
function useDirectusFile(file, baseUrl, searchParams) {
|
|
26
|
+
const { description, width, height, title, id, ...rest } = file ?? {};
|
|
27
|
+
if (!file || !id) return null;
|
|
28
|
+
const url = getDirectusUrl(file, baseUrl, searchParams);
|
|
29
|
+
if (!url) return null;
|
|
30
|
+
return {
|
|
31
|
+
src: url.href,
|
|
32
|
+
alt: description ?? "",
|
|
33
|
+
width: width ?? void 0,
|
|
34
|
+
height: height ?? void 0,
|
|
35
|
+
title: title ?? void 0,
|
|
36
|
+
id,
|
|
37
|
+
...rest
|
|
38
|
+
};
|
|
24
39
|
}
|
|
25
40
|
module.exports = useDirectusFile;
|
package/hooks/directus-file.mjs
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
const IMG_DOMAIN = process.env.NEXT_PUBLIC_IMG_DOMAIN;
|
|
2
2
|
const IMG_PORT = process.env.NEXT_PUBLIC_IMG_PORT;
|
|
3
|
-
const IMG_PROTOCOL = process.env.NEXT_PUBLIC_IMG_PROTOCOL;
|
|
4
|
-
function
|
|
3
|
+
const IMG_PROTOCOL = process.env.NEXT_PUBLIC_IMG_PROTOCOL ?? "https";
|
|
4
|
+
function setSearchParams(url, searchParams) {
|
|
5
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
6
|
+
if (!value) return;
|
|
7
|
+
url.searchParams.set(key, value);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function getDirectusUrl(file, baseUrl, searchParams) {
|
|
5
11
|
const { id, filename_download, filenameDownload } = file ?? {};
|
|
6
12
|
const { protocol = IMG_PROTOCOL, port = IMG_PORT, hostname = IMG_DOMAIN } = baseUrl ?? {};
|
|
7
13
|
if (!hostname || !id) return null;
|
|
8
14
|
try {
|
|
9
|
-
const url = new URL(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
15
|
+
const url = new URL(`/assets/${id}/${filename_download ?? filenameDownload ?? ""}`, `${protocol}://${hostname}`);
|
|
16
|
+
if (port) url.port = port;
|
|
17
|
+
if (searchParams) setSearchParams(url, searchParams);
|
|
13
18
|
return url;
|
|
14
19
|
} catch (error) {
|
|
15
20
|
console.warn(error);
|
|
16
21
|
return null;
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
|
-
function useDirectusFile(file, baseUrl) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
function useDirectusFile(file, baseUrl, searchParams) {
|
|
25
|
+
const { description, width, height, title, id, ...rest } = file ?? {};
|
|
26
|
+
if (!file || !id) return null;
|
|
27
|
+
const url = getDirectusUrl(file, baseUrl, searchParams);
|
|
28
|
+
if (!url) return null;
|
|
29
|
+
return {
|
|
30
|
+
src: url.href,
|
|
31
|
+
alt: description ?? "",
|
|
32
|
+
width: width ?? void 0,
|
|
33
|
+
height: height ?? void 0,
|
|
34
|
+
title: title ?? void 0,
|
|
35
|
+
id,
|
|
36
|
+
...rest
|
|
37
|
+
};
|
|
23
38
|
}
|
|
24
39
|
export {
|
|
25
40
|
useDirectusFile as default
|
package/hooks/directus-link.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TAnchorProps } from '@okam/stack-ui';
|
|
2
|
-
import type {
|
|
3
|
-
export default function useDirectusLink(props:
|
|
2
|
+
import type { TUseDirectusLink } from '../components/DirectusLink/interface';
|
|
3
|
+
export default function useDirectusLink(props: TUseDirectusLink): TAnchorProps;
|
package/hooks/directus-link.js
CHANGED
|
@@ -1,38 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const Link = require("next/link.js");
|
|
2
3
|
const directusFile = require("./directus-file.js");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
function useFile(props) {
|
|
5
|
+
const { file } = props;
|
|
6
|
+
const { filename_download: filenameDownload } = file ?? {};
|
|
7
|
+
const href = directusFile(file);
|
|
8
|
+
return {
|
|
9
|
+
href: (href == null ? void 0 : href.toString()) ?? void 0,
|
|
10
|
+
download: filenameDownload ?? true
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function useCollection(props) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { collection, target } = props;
|
|
16
|
+
return {
|
|
17
|
+
href: ((_b = (_a = collection == null ? void 0 : collection.translations) == null ? void 0 : _a[0]) == null ? void 0 : _b.path) ?? void 0,
|
|
18
|
+
target: target ?? void 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function useExternalLink(props) {
|
|
22
|
+
const { external_link: externalLink, target } = props;
|
|
23
|
+
return {
|
|
13
24
|
href: externalLink ?? void 0,
|
|
14
25
|
target: target ?? void 0
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function useAnchor(props) {
|
|
29
|
+
const { anchor } = props;
|
|
30
|
+
return { href: anchor ?? void 0 };
|
|
31
|
+
}
|
|
32
|
+
const defaultPropsConfig = {
|
|
33
|
+
collection: useCollection,
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
|
+
"external-link": useExternalLink,
|
|
36
|
+
file: useFile,
|
|
37
|
+
anchor: useAnchor
|
|
25
38
|
};
|
|
26
39
|
function useDirectusLink(props) {
|
|
27
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
const {
|
|
42
|
+
type,
|
|
43
|
+
label,
|
|
44
|
+
prefetch,
|
|
45
|
+
replace,
|
|
46
|
+
scroll,
|
|
47
|
+
tokens,
|
|
48
|
+
themeName,
|
|
49
|
+
customTheme,
|
|
50
|
+
propsConfig,
|
|
51
|
+
as = Link,
|
|
52
|
+
target,
|
|
53
|
+
anchor,
|
|
54
|
+
collection,
|
|
55
|
+
external_link: externalLink,
|
|
56
|
+
file,
|
|
57
|
+
id,
|
|
58
|
+
...rest
|
|
59
|
+
} = props;
|
|
28
60
|
if (!type) return {};
|
|
29
61
|
const finalConfig = { ...defaultPropsConfig, ...propsConfig ?? {} };
|
|
30
|
-
const
|
|
62
|
+
const linkProps = ((_a = finalConfig[type]) == null ? void 0 : _a.call(finalConfig, props)) ?? {};
|
|
63
|
+
const { href, ...restOfLinkProps } = linkProps;
|
|
31
64
|
if (!href) return {};
|
|
32
65
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
...rest,
|
|
67
|
+
as,
|
|
68
|
+
...themeName ? { themeName } : {},
|
|
69
|
+
...customTheme ? { customTheme } : {},
|
|
70
|
+
...tokens ? { tokens } : {},
|
|
36
71
|
nextLinkProps: {
|
|
37
72
|
href,
|
|
38
73
|
prefetch: prefetch ?? void 0,
|
|
@@ -41,7 +76,7 @@ function useDirectusLink(props) {
|
|
|
41
76
|
},
|
|
42
77
|
href,
|
|
43
78
|
children: label,
|
|
44
|
-
...
|
|
79
|
+
...restOfLinkProps
|
|
45
80
|
};
|
|
46
81
|
}
|
|
47
82
|
module.exports = useDirectusLink;
|
package/hooks/directus-link.mjs
CHANGED
|
@@ -1,37 +1,72 @@
|
|
|
1
|
+
import Link from "next/link.js";
|
|
1
2
|
import useDirectusFile from "./directus-file.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
function useFile(props) {
|
|
4
|
+
const { file } = props;
|
|
5
|
+
const { filename_download: filenameDownload } = file ?? {};
|
|
6
|
+
const href = useDirectusFile(file);
|
|
7
|
+
return {
|
|
8
|
+
href: (href == null ? void 0 : href.toString()) ?? void 0,
|
|
9
|
+
download: filenameDownload ?? true
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function useCollection(props) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const { collection, target } = props;
|
|
15
|
+
return {
|
|
16
|
+
href: ((_b = (_a = collection == null ? void 0 : collection.translations) == null ? void 0 : _a[0]) == null ? void 0 : _b.path) ?? void 0,
|
|
17
|
+
target: target ?? void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function useExternalLink(props) {
|
|
21
|
+
const { external_link: externalLink, target } = props;
|
|
22
|
+
return {
|
|
12
23
|
href: externalLink ?? void 0,
|
|
13
24
|
target: target ?? void 0
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function useAnchor(props) {
|
|
28
|
+
const { anchor } = props;
|
|
29
|
+
return { href: anchor ?? void 0 };
|
|
30
|
+
}
|
|
31
|
+
const defaultPropsConfig = {
|
|
32
|
+
collection: useCollection,
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
34
|
+
"external-link": useExternalLink,
|
|
35
|
+
file: useFile,
|
|
36
|
+
anchor: useAnchor
|
|
24
37
|
};
|
|
25
38
|
function useDirectusLink(props) {
|
|
26
|
-
|
|
39
|
+
var _a;
|
|
40
|
+
const {
|
|
41
|
+
type,
|
|
42
|
+
label,
|
|
43
|
+
prefetch,
|
|
44
|
+
replace,
|
|
45
|
+
scroll,
|
|
46
|
+
tokens,
|
|
47
|
+
themeName,
|
|
48
|
+
customTheme,
|
|
49
|
+
propsConfig,
|
|
50
|
+
as = Link,
|
|
51
|
+
target,
|
|
52
|
+
anchor,
|
|
53
|
+
collection,
|
|
54
|
+
external_link: externalLink,
|
|
55
|
+
file,
|
|
56
|
+
id,
|
|
57
|
+
...rest
|
|
58
|
+
} = props;
|
|
27
59
|
if (!type) return {};
|
|
28
60
|
const finalConfig = { ...defaultPropsConfig, ...propsConfig ?? {} };
|
|
29
|
-
const
|
|
61
|
+
const linkProps = ((_a = finalConfig[type]) == null ? void 0 : _a.call(finalConfig, props)) ?? {};
|
|
62
|
+
const { href, ...restOfLinkProps } = linkProps;
|
|
30
63
|
if (!href) return {};
|
|
31
64
|
return {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
65
|
+
...rest,
|
|
66
|
+
as,
|
|
67
|
+
...themeName ? { themeName } : {},
|
|
68
|
+
...customTheme ? { customTheme } : {},
|
|
69
|
+
...tokens ? { tokens } : {},
|
|
35
70
|
nextLinkProps: {
|
|
36
71
|
href,
|
|
37
72
|
prefetch: prefetch ?? void 0,
|
|
@@ -40,7 +75,7 @@ function useDirectusLink(props) {
|
|
|
40
75
|
},
|
|
41
76
|
href,
|
|
42
77
|
children: label,
|
|
43
|
-
...
|
|
78
|
+
...restOfLinkProps
|
|
44
79
|
};
|
|
45
80
|
}
|
|
46
81
|
export {
|
|
@@ -4,6 +4,7 @@ import type { TNavigationItems, TNavigationItemsTree } from '../types/navigation
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @param navigationItems A tree of navigation items, with parents and children
|
|
7
|
+
* @param onNavigationItem Called when a navigation item is about to be added to the tree
|
|
7
8
|
* @returns A tree of navigation items with ready-to-use DirectusLink components
|
|
8
9
|
*/
|
|
9
10
|
export default function useNavigationItems<Depth extends number, Link, NavigationItems extends TNavigationItems<NavigationItems, Link, Depth> = TNavigationItems<unknown, Link, Depth>>(items: Nullable<Nullable<TNavigationItems<NavigationItems, Link, Depth>>[]>, onNavigationItem: (item: Nullable<TNavigationItems<NavigationItems, Link, Depth>>) => Nullable<TDirectusLinkProps>): Nullable<Nullable<TNavigationItemsTree>[]>;
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const index = require("../components/DirectusLink/index.js");
|
|
4
|
+
function createLinkProps(item, onNavigationItem) {
|
|
5
|
+
const { tokens, variant } = item ?? {};
|
|
6
|
+
const link = onNavigationItem(item);
|
|
7
|
+
const linkTokens = {
|
|
8
|
+
...tokens,
|
|
9
|
+
...link == null ? void 0 : link.tokens,
|
|
10
|
+
type: variant
|
|
11
|
+
};
|
|
12
|
+
const linkProps = {
|
|
13
|
+
...link,
|
|
14
|
+
tokens: linkTokens
|
|
15
|
+
};
|
|
16
|
+
return linkProps;
|
|
17
|
+
}
|
|
4
18
|
function createParentTree(item, onNavigationItem, depth = -1) {
|
|
5
19
|
const { parent } = item ?? {};
|
|
6
|
-
const
|
|
7
|
-
const { id } =
|
|
20
|
+
const linkProps = createLinkProps(item, onNavigationItem);
|
|
21
|
+
const { id } = linkProps ?? {};
|
|
8
22
|
if (!id) return null;
|
|
9
23
|
return {
|
|
10
|
-
link: /* @__PURE__ */ jsxRuntime.jsx(index, { ...
|
|
11
|
-
linkProps
|
|
24
|
+
link: /* @__PURE__ */ jsxRuntime.jsx(index, { ...linkProps }),
|
|
25
|
+
linkProps,
|
|
12
26
|
parent: createParentTree(parent, onNavigationItem, depth - 1),
|
|
13
27
|
depth
|
|
14
28
|
};
|
|
15
29
|
}
|
|
16
30
|
function createChildrenTree(item, onNavigationItem, depth = 1) {
|
|
17
31
|
const { children } = item ?? {};
|
|
18
|
-
const
|
|
19
|
-
const { id } =
|
|
32
|
+
const linkProps = createLinkProps(item, onNavigationItem);
|
|
33
|
+
const { id } = linkProps ?? {};
|
|
20
34
|
if (!id) return null;
|
|
21
35
|
return {
|
|
22
|
-
link: /* @__PURE__ */ jsxRuntime.jsx(index, { ...
|
|
23
|
-
linkProps
|
|
36
|
+
link: /* @__PURE__ */ jsxRuntime.jsx(index, { ...linkProps }),
|
|
37
|
+
linkProps,
|
|
24
38
|
children: children == null ? void 0 : children.map((child) => createChildrenTree(child, onNavigationItem, depth + 1)),
|
|
25
39
|
depth
|
|
26
40
|
};
|
|
@@ -28,15 +42,15 @@ function createChildrenTree(item, onNavigationItem, depth = 1) {
|
|
|
28
42
|
function useNavigationItems(items, onNavigationItem) {
|
|
29
43
|
const tree = items == null ? void 0 : items.map((item) => {
|
|
30
44
|
const { children, parent } = item ?? {};
|
|
31
|
-
const
|
|
45
|
+
const linkProps = createLinkProps(item, onNavigationItem);
|
|
32
46
|
const parentTree = createParentTree(parent, onNavigationItem);
|
|
33
47
|
const childrenTree = children == null ? void 0 : children.map((child) => createChildrenTree(child, onNavigationItem));
|
|
34
48
|
return {
|
|
35
49
|
depth: 0,
|
|
36
50
|
parent: parentTree,
|
|
37
51
|
children: childrenTree,
|
|
38
|
-
link: /* @__PURE__ */ jsxRuntime.jsx(index, { ...
|
|
39
|
-
linkProps
|
|
52
|
+
link: /* @__PURE__ */ jsxRuntime.jsx(index, { ...linkProps }),
|
|
53
|
+
linkProps
|
|
40
54
|
};
|
|
41
55
|
});
|
|
42
56
|
return tree;
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import DirectusLink from "../components/DirectusLink/index.mjs";
|
|
3
|
+
function createLinkProps(item, onNavigationItem) {
|
|
4
|
+
const { tokens, variant } = item ?? {};
|
|
5
|
+
const link = onNavigationItem(item);
|
|
6
|
+
const linkTokens = {
|
|
7
|
+
...tokens,
|
|
8
|
+
...link == null ? void 0 : link.tokens,
|
|
9
|
+
type: variant
|
|
10
|
+
};
|
|
11
|
+
const linkProps = {
|
|
12
|
+
...link,
|
|
13
|
+
tokens: linkTokens
|
|
14
|
+
};
|
|
15
|
+
return linkProps;
|
|
16
|
+
}
|
|
3
17
|
function createParentTree(item, onNavigationItem, depth = -1) {
|
|
4
18
|
const { parent } = item ?? {};
|
|
5
|
-
const
|
|
6
|
-
const { id } =
|
|
19
|
+
const linkProps = createLinkProps(item, onNavigationItem);
|
|
20
|
+
const { id } = linkProps ?? {};
|
|
7
21
|
if (!id) return null;
|
|
8
22
|
return {
|
|
9
|
-
link: /* @__PURE__ */ jsx(DirectusLink, { ...
|
|
10
|
-
linkProps
|
|
23
|
+
link: /* @__PURE__ */ jsx(DirectusLink, { ...linkProps }),
|
|
24
|
+
linkProps,
|
|
11
25
|
parent: createParentTree(parent, onNavigationItem, depth - 1),
|
|
12
26
|
depth
|
|
13
27
|
};
|
|
14
28
|
}
|
|
15
29
|
function createChildrenTree(item, onNavigationItem, depth = 1) {
|
|
16
30
|
const { children } = item ?? {};
|
|
17
|
-
const
|
|
18
|
-
const { id } =
|
|
31
|
+
const linkProps = createLinkProps(item, onNavigationItem);
|
|
32
|
+
const { id } = linkProps ?? {};
|
|
19
33
|
if (!id) return null;
|
|
20
34
|
return {
|
|
21
|
-
link: /* @__PURE__ */ jsx(DirectusLink, { ...
|
|
22
|
-
linkProps
|
|
35
|
+
link: /* @__PURE__ */ jsx(DirectusLink, { ...linkProps }),
|
|
36
|
+
linkProps,
|
|
23
37
|
children: children == null ? void 0 : children.map((child) => createChildrenTree(child, onNavigationItem, depth + 1)),
|
|
24
38
|
depth
|
|
25
39
|
};
|
|
@@ -27,15 +41,15 @@ function createChildrenTree(item, onNavigationItem, depth = 1) {
|
|
|
27
41
|
function useNavigationItems(items, onNavigationItem) {
|
|
28
42
|
const tree = items == null ? void 0 : items.map((item) => {
|
|
29
43
|
const { children, parent } = item ?? {};
|
|
30
|
-
const
|
|
44
|
+
const linkProps = createLinkProps(item, onNavigationItem);
|
|
31
45
|
const parentTree = createParentTree(parent, onNavigationItem);
|
|
32
46
|
const childrenTree = children == null ? void 0 : children.map((child) => createChildrenTree(child, onNavigationItem));
|
|
33
47
|
return {
|
|
34
48
|
depth: 0,
|
|
35
49
|
parent: parentTree,
|
|
36
50
|
children: childrenTree,
|
|
37
|
-
link: /* @__PURE__ */ jsx(DirectusLink, { ...
|
|
38
|
-
linkProps
|
|
51
|
+
link: /* @__PURE__ */ jsx(DirectusLink, { ...linkProps }),
|
|
52
|
+
linkProps
|
|
39
53
|
};
|
|
40
54
|
});
|
|
41
55
|
return tree;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { default as DirectusLink } from './components/DirectusLink';
|
|
2
|
+
export { default as DirectusImg } from './components/DirectusImg';
|
|
3
|
+
export { default as DirectusVideo } from './components/DirectusVideo';
|
|
4
|
+
export { default as DirectusFile } from './components/DirectusFile';
|
|
2
5
|
export { default as useDirectusFile } from './hooks/directus-file';
|
|
3
6
|
export { default as useDirectusLink } from './hooks/directus-link';
|
|
4
7
|
export { default as useNavigationItems } from './hooks/navigation-items';
|
|
@@ -6,4 +9,4 @@ export type { TFiles } from './types/files';
|
|
|
6
9
|
export type { TPageSettings } from './types/page-settings';
|
|
7
10
|
export type { TNavigationItems, TNavigationItemsTree } from './types/navigation-items';
|
|
8
11
|
export type { TLinks } from './types/links';
|
|
9
|
-
export type { TDirectusLinkProps } from './components/DirectusLink/interface';
|
|
12
|
+
export type { TDirectusLinkProps, TUseDirectusLink, TDirectusLink, TDirectusLinkPropsConfig, TDirectusLinkComponentsConfig, } from './components/DirectusLink/interface';
|
package/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const index = require("./components/DirectusLink/index.js");
|
|
4
|
+
const index$1 = require("./components/DirectusImg/index.js");
|
|
5
|
+
const index$2 = require("./components/DirectusVideo/index.js");
|
|
6
|
+
const index$3 = require("./components/DirectusFile/index.js");
|
|
4
7
|
const directusFile = require("./hooks/directus-file.js");
|
|
5
8
|
const directusLink = require("./hooks/directus-link.js");
|
|
6
9
|
const navigationItems = require("./hooks/navigation-items.js");
|
|
7
10
|
exports.DirectusLink = index;
|
|
11
|
+
exports.DirectusImg = index$1;
|
|
12
|
+
exports.DirectusVideo = index$2;
|
|
13
|
+
exports.DirectusFile = index$3;
|
|
8
14
|
exports.useDirectusFile = directusFile;
|
|
9
15
|
exports.useDirectusLink = directusLink;
|
|
10
16
|
exports.useNavigationItems = navigationItems;
|
package/index.mjs
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { default as default2 } from "./components/DirectusLink/index.mjs";
|
|
2
|
-
import { default as default3 } from "./
|
|
3
|
-
import { default as default4 } from "./
|
|
4
|
-
import { default as default5 } from "./
|
|
2
|
+
import { default as default3 } from "./components/DirectusImg/index.mjs";
|
|
3
|
+
import { default as default4 } from "./components/DirectusVideo/index.mjs";
|
|
4
|
+
import { default as default5 } from "./components/DirectusFile/index.mjs";
|
|
5
|
+
import { default as default6 } from "./hooks/directus-file.mjs";
|
|
6
|
+
import { default as default7 } from "./hooks/directus-link.mjs";
|
|
7
|
+
import { default as default8 } from "./hooks/navigation-items.mjs";
|
|
5
8
|
export {
|
|
9
|
+
default5 as DirectusFile,
|
|
10
|
+
default3 as DirectusImg,
|
|
6
11
|
default2 as DirectusLink,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
default4 as DirectusVideo,
|
|
13
|
+
default6 as useDirectusFile,
|
|
14
|
+
default7 as useDirectusLink,
|
|
15
|
+
default8 as useNavigationItems
|
|
10
16
|
};
|
package/package.json
CHANGED
package/server.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export * from './lib/hello-server';
|
|
2
1
|
export { default as withDirectus } from './lib/withDirectus';
|
|
3
2
|
export * from './lib/directus-next-rewrite';
|
|
4
3
|
export { default as DirectusLink } from './components/DirectusLink';
|
|
4
|
+
export { default as DirectusImg } from './components/DirectusImg';
|
|
5
|
+
export { default as DirectusVideo } from './components/DirectusVideo';
|
|
6
|
+
export { default as DirectusFile } from './components/DirectusFile';
|
|
5
7
|
export { default as useDirectusFile } from './hooks/directus-file';
|
|
6
8
|
export { default as useDirectusLink } from './hooks/directus-link';
|
|
7
9
|
export { default as useNavigationItems } from './hooks/navigation-items';
|
package/server.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const helloServer = require("./lib/hello-server.js");
|
|
4
3
|
const withDirectus = require("./lib/withDirectus.js");
|
|
5
4
|
const directusNextRewrite = require("./lib/directus-next-rewrite.js");
|
|
6
5
|
const index = require("./components/DirectusLink/index.js");
|
|
6
|
+
const index$1 = require("./components/DirectusImg/index.js");
|
|
7
|
+
const index$2 = require("./components/DirectusVideo/index.js");
|
|
8
|
+
const index$3 = require("./components/DirectusFile/index.js");
|
|
7
9
|
const directusFile = require("./hooks/directus-file.js");
|
|
8
10
|
const directusLink = require("./hooks/directus-link.js");
|
|
9
11
|
const navigationItems = require("./hooks/navigation-items.js");
|
|
10
|
-
exports.HelloServer = helloServer.HelloServer;
|
|
11
12
|
exports.withDirectus = withDirectus;
|
|
12
13
|
exports.config = directusNextRewrite.config;
|
|
13
14
|
exports.directusRouteMiddleware = directusNextRewrite.directusRouteMiddleware;
|
|
14
15
|
exports.fetchPageSettings = directusNextRewrite.fetchPageSettings;
|
|
15
16
|
exports.DirectusLink = index;
|
|
17
|
+
exports.DirectusImg = index$1;
|
|
18
|
+
exports.DirectusVideo = index$2;
|
|
19
|
+
exports.DirectusFile = index$3;
|
|
16
20
|
exports.useDirectusFile = directusFile;
|
|
17
21
|
exports.useDirectusLink = directusLink;
|
|
18
22
|
exports.useNavigationItems = navigationItems;
|
package/server.mjs
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { HelloServer } from "./lib/hello-server.mjs";
|
|
2
1
|
import { default as default2 } from "./lib/withDirectus.mjs";
|
|
3
2
|
import { config, directusRouteMiddleware, fetchPageSettings } from "./lib/directus-next-rewrite.mjs";
|
|
4
3
|
import { default as default3 } from "./components/DirectusLink/index.mjs";
|
|
5
|
-
import { default as default4 } from "./
|
|
6
|
-
import { default as default5 } from "./
|
|
7
|
-
import { default as default6 } from "./
|
|
4
|
+
import { default as default4 } from "./components/DirectusImg/index.mjs";
|
|
5
|
+
import { default as default5 } from "./components/DirectusVideo/index.mjs";
|
|
6
|
+
import { default as default6 } from "./components/DirectusFile/index.mjs";
|
|
7
|
+
import { default as default7 } from "./hooks/directus-file.mjs";
|
|
8
|
+
import { default as default8 } from "./hooks/directus-link.mjs";
|
|
9
|
+
import { default as default9 } from "./hooks/navigation-items.mjs";
|
|
8
10
|
export {
|
|
11
|
+
default6 as DirectusFile,
|
|
12
|
+
default4 as DirectusImg,
|
|
9
13
|
default3 as DirectusLink,
|
|
10
|
-
|
|
14
|
+
default5 as DirectusVideo,
|
|
11
15
|
config,
|
|
12
16
|
directusRouteMiddleware,
|
|
13
17
|
fetchPageSettings,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
default7 as useDirectusFile,
|
|
19
|
+
default8 as useDirectusLink,
|
|
20
|
+
default9 as useNavigationItems,
|
|
17
21
|
default2 as withDirectus
|
|
18
22
|
};
|
package/types/files.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
export type TFiles = {
|
|
2
|
-
id
|
|
2
|
+
id?: string | null;
|
|
3
|
+
title?: string | null;
|
|
4
|
+
description?: string | null;
|
|
5
|
+
tags?: any | null;
|
|
6
|
+
location?: string | null;
|
|
7
|
+
storage?: string | null;
|
|
8
|
+
focal_point_divider?: string | null;
|
|
9
|
+
focal_point_x?: number | null;
|
|
10
|
+
focal_point_y?: number | null;
|
|
3
11
|
filename_disk?: string | null;
|
|
4
12
|
filename_download?: string | null;
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
8
|
-
filenameDownload?: string | null;
|
|
9
|
-
title?: string | null;
|
|
10
13
|
type?: string | null;
|
|
11
14
|
width?: number | null;
|
|
12
15
|
height?: number | null;
|
|
13
16
|
duration?: number | null;
|
|
14
17
|
embed?: string | null;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
caption?: string | null;
|
|
19
|
+
thumbhash?: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `filename_download` instead
|
|
22
|
+
*/
|
|
23
|
+
filenameDownload?: string | null;
|
|
18
24
|
};
|
package/types/links.d.ts
CHANGED
|
@@ -17,11 +17,15 @@ export type TNavigationItemsTree = {
|
|
|
17
17
|
depth: number;
|
|
18
18
|
};
|
|
19
19
|
type DepthLimit = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
20
|
-
export type
|
|
21
|
-
|
|
20
|
+
export type TNavigationItemsBase<Link> = {
|
|
21
|
+
tokens?: any | null;
|
|
22
|
+
variant?: string | null;
|
|
22
23
|
} & Link;
|
|
23
|
-
export type
|
|
24
|
+
export type TNavigationItemsParents<NavigationItems, Link, Depth extends number> = Depth extends never ? TNavigationItemsBase<Link> : {
|
|
25
|
+
parent?: Nullable<TNavigationItemsParents<NavigationItems, Link, Depth>>;
|
|
26
|
+
} & TNavigationItemsBase<Link>;
|
|
27
|
+
export type TNavigationItemsChildren<NavigationItems, Link, Depth extends number> = Depth extends never ? TNavigationItemsBase<Link> : {
|
|
24
28
|
children?: Nullable<Nullable<TNavigationItemsChildren<NavigationItems, Link, DepthLimit[Depth]>>[]>;
|
|
25
|
-
} & Link
|
|
29
|
+
} & TNavigationItemsBase<Link>;
|
|
26
30
|
export type TNavigationItems<NavigationItems, Link, Depth extends number> = TNavigationItemsChildren<NavigationItems, Link, Depth> & TNavigationItemsParents<NavigationItems, Link, Depth>;
|
|
27
31
|
export {};
|
package/lib/hello-server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function HelloServer(): Promise<import("react/jsx-runtime").JSX.Element>;
|
package/lib/hello-server.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
async function HelloServer() {
|
|
5
|
-
return /* @__PURE__ */ jsxRuntime.jsx("h1", { children: "Hello Server" });
|
|
6
|
-
}
|
|
7
|
-
exports.HelloServer = HelloServer;
|