@alauda/doom 0.6.14 → 0.7.2
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/lib/runtime/components/ExternalSite.d.ts +1 -1
- package/lib/runtime/components/ExternalSite.js +8 -12
- package/lib/runtime/components/ExternalSiteLink.d.ts +7 -0
- package/lib/runtime/components/ExternalSiteLink.js +23 -0
- package/lib/runtime/components/K8sCrd.js +1 -1
- package/lib/runtime/components/index.d.ts +2 -0
- package/lib/runtime/components/index.js +2 -0
- package/lib/shared/types.d.ts +4 -3
- package/package.json +1 -1
- package/styles/link.module.scss +25 -0
|
@@ -3,7 +3,7 @@ export interface ExternalSiteProps {
|
|
|
3
3
|
}
|
|
4
4
|
export interface ExternalSiteNoteProps {
|
|
5
5
|
name: string;
|
|
6
|
-
|
|
6
|
+
displayName: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const ExternalSite: ({ name }: ExternalSiteProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default ExternalSite;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLang, usePageData } from '@rspress/core/runtime';
|
|
3
|
-
import { addTrailingSlash } from '@rspress/shared';
|
|
4
3
|
import { useMemo } from 'react';
|
|
5
|
-
import { normalizeVersion } from '../../shared/index.js';
|
|
6
4
|
import { handleCJKWhitespaces } from '../utils.js';
|
|
7
|
-
import { Directive } from './
|
|
5
|
+
import { Directive } from './Directive.js';
|
|
6
|
+
import { ExternalSiteLink } from './ExternalSiteLink.js';
|
|
8
7
|
const Notes = {
|
|
9
|
-
en({ name,
|
|
10
|
-
return (_jsxs(_Fragment, { children: ["Because ",
|
|
8
|
+
en({ name, displayName }) {
|
|
9
|
+
return (_jsxs(_Fragment, { children: ["Because ", displayName, " releases on a different cadence from Alauda Container Platform, the ", displayName, " documentation is now available as a separate documentation set at", ' ', _jsx(ExternalSiteLink, { name: name, children: displayName }), "."] }));
|
|
11
10
|
},
|
|
12
|
-
zh({ name,
|
|
13
|
-
const
|
|
14
|
-
return (_jsxs(_Fragment, { children: ["\u56E0\u4E3A",
|
|
11
|
+
zh({ name, displayName }) {
|
|
12
|
+
const displayName_ = handleCJKWhitespaces(displayName);
|
|
13
|
+
return (_jsxs(_Fragment, { children: ["\u56E0\u4E3A", displayName_, "\u7684\u53D1\u7248\u5468\u671F\u4E0E\u7075\u96C0\u4E91\u5BB9\u5668\u5E73\u53F0\u4E0D\u540C\uFF0C\u6240\u4EE5", displayName_, "\u7684\u6587\u6863\u73B0\u5728\u4F5C\u4E3A\u72EC\u7ACB\u7684\u6587\u6863\u7AD9\u70B9\u6258\u7BA1\u5728", displayName_.startsWith(' ') ? ' ' : '', _jsx(ExternalSiteLink, { name: name, children: displayName }), "\u3002"] }));
|
|
15
14
|
},
|
|
16
15
|
};
|
|
17
16
|
export const ExternalSite = ({ name }) => {
|
|
@@ -24,9 +23,6 @@ export const ExternalSite = ({ name }) => {
|
|
|
24
23
|
return (_jsxs(Directive, { type: "danger", children: ["No site with name `", name, "` found, please ensure it's already defined at `sites.yaml`"] }));
|
|
25
24
|
}
|
|
26
25
|
const Note = Notes[lang] || Notes[fallbackLang] || Notes.en;
|
|
27
|
-
|
|
28
|
-
return (_jsx(Directive, { title: "Note", children: _jsx(Note, { name: displayName, href: page.v
|
|
29
|
-
? addTrailingSlash(siteBase + normalizeVersion(site.defaultVersion))
|
|
30
|
-
: siteBase }) }));
|
|
26
|
+
return (_jsx(Directive, { title: "Note", children: _jsx(Note, { name: name, displayName: displayName }) }));
|
|
31
27
|
};
|
|
32
28
|
export default ExternalSite;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ExternalSiteLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
|
+
name: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const ExternalSiteLink: ({ name, href, className, ...props }: ExternalSiteLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ExternalSiteLink;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { usePageData } from '@rspress/core/runtime';
|
|
3
|
+
import { addTrailingSlash, isExternalUrl, removeLeadingSlash, } from '@rspress/shared';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { normalizeVersion } from '../../shared/index.js';
|
|
7
|
+
import { Directive } from './Directive.js';
|
|
8
|
+
import classes from '../../../styles/link.module.scss';
|
|
9
|
+
export const ExternalSiteLink = ({ name, href = '', className, ...props }) => {
|
|
10
|
+
const { page } = usePageData();
|
|
11
|
+
const site = useMemo(() => page.sites?.find((s) => s.name === name), []);
|
|
12
|
+
if (!site) {
|
|
13
|
+
return (_jsxs(Directive, { type: "danger", children: ["No site with name `", name, "` found, please ensure it's already defined at `sites.yaml`"] }));
|
|
14
|
+
}
|
|
15
|
+
if (isExternalUrl(href)) {
|
|
16
|
+
return _jsxs(Directive, { type: "danger", children: ["Invalid href `", href, "` found"] });
|
|
17
|
+
}
|
|
18
|
+
const siteBase = addTrailingSlash(site.base);
|
|
19
|
+
return (_jsx("a", { href: (page.v
|
|
20
|
+
? addTrailingSlash(siteBase + normalizeVersion(site.version))
|
|
21
|
+
: siteBase) + removeLeadingSlash(href), target: "_blank", rel: "noopener noreferrer", className: clsx(classes.link, 'cursor-pointer', className), ...props }));
|
|
22
|
+
};
|
|
23
|
+
export default ExternalSiteLink;
|
|
@@ -6,7 +6,7 @@ import { usePageData } from '@rspress/core/runtime';
|
|
|
6
6
|
import { Badge, Button, getCustomMDXComponent } from '@rspress/core/theme';
|
|
7
7
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { useTranslation } from '../hooks/index.js';
|
|
9
|
-
import { Directive } from './
|
|
9
|
+
import { Directive } from './Directive.js';
|
|
10
10
|
import { Markdown } from './_Markdown.js';
|
|
11
11
|
const X = getCustomMDXComponent();
|
|
12
12
|
export const K8sCrdSchemaPart = ({ name, parent, schema: property, openAll, }) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './Badge.js';
|
|
2
2
|
export * from './Callouts.js';
|
|
3
3
|
export * from './Card.js';
|
|
4
|
+
export * from './Directive.js';
|
|
4
5
|
export * from './ExternalSite.js';
|
|
6
|
+
export * from './ExternalSiteLink.js';
|
|
5
7
|
export * from './JsonViewer.js';
|
|
6
8
|
export * from './K8sCrd.js';
|
|
7
9
|
export * from './LinkCard.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './Badge.js';
|
|
2
2
|
export * from './Callouts.js';
|
|
3
3
|
export * from './Card.js';
|
|
4
|
+
export * from './Directive.js';
|
|
4
5
|
export * from './ExternalSite.js';
|
|
6
|
+
export * from './ExternalSiteLink.js';
|
|
5
7
|
export * from './JsonViewer.js';
|
|
6
8
|
export * from './K8sCrd.js';
|
|
7
9
|
export * from './LinkCard.js';
|
package/lib/shared/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.link {
|
|
2
|
+
font-weight: 500;
|
|
3
|
+
transition: opacity 0.2s;
|
|
4
|
+
|
|
5
|
+
&:hover {
|
|
6
|
+
opacity: 0.85;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&:active {
|
|
10
|
+
opacity: 0.7;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.link,
|
|
15
|
+
:global(summary) .link {
|
|
16
|
+
&:not(:global(.header-anchor)) {
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: var(--rp-c-link);
|
|
19
|
+
transition: color 0.25s;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
border-bottom: 1px solid var(--rp-c-brand);
|
|
24
|
+
}
|
|
25
|
+
}
|