This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
export default function DebugMetadata(): JSX.Element;

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import DebugLayout from '@theme/DebugLayout';
import DebugJsonView from '@theme/DebugJsonView';
export default function DebugMetadata() {
const {siteConfig} = useDocusaurusContext();
return (
<DebugLayout>
<h2>Site config</h2>
<DebugJsonView src={siteConfig} collapseDepth={3} />
</DebugLayout>
);
}

View File

@@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
import type { Props } from '@theme/DebugContent';
export default function DebugContent({ allContent }: Props): JSX.Element;

View File

@@ -0,0 +1,59 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import DebugLayout from '@theme/DebugLayout';
import DebugJsonView from '@theme/DebugJsonView';
function PluginInstanceContent({pluginId, pluginInstanceContent}) {
return (
<section style={{marginBottom: 30}}>
<code>{pluginId}</code>
<DebugJsonView src={pluginInstanceContent} collapseDepth={2} />
</section>
);
}
function PluginContent({pluginName, pluginContent}) {
return (
<section style={{marginBottom: 60}}>
<h3>{pluginName}</h3>
<div>
{Object.entries(pluginContent)
// Filter plugin instances with no content
.filter(([, pluginInstanceContent]) => !!pluginInstanceContent)
.map(([pluginId, pluginInstanceContent]) => (
<PluginInstanceContent
key={pluginId}
pluginId={pluginId}
pluginInstanceContent={pluginInstanceContent}
/>
))}
</div>
</section>
);
}
export default function DebugContent({allContent}) {
return (
<DebugLayout>
<h2>Plugin content</h2>
<div>
{Object.entries(allContent)
// Filter plugins with no content
.filter(([, pluginContent]) =>
Object.values(pluginContent).some(
(instanceContent) => !!instanceContent,
),
)
.map(([pluginName, pluginContent]) => (
<PluginContent
key={pluginName}
pluginName={pluginName}
pluginContent={pluginContent}
/>
))}
</div>
</DebugLayout>
);
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
export default function DebugMetadata(): JSX.Element;

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import useGlobalData from '@docusaurus/useGlobalData';
import DebugLayout from '@theme/DebugLayout';
import DebugJsonView from '@theme/DebugJsonView';
export default function DebugMetadata() {
const globalData = useGlobalData();
return (
<DebugLayout>
<h2>Global data</h2>
<DebugJsonView src={globalData} collapseDepth={3} />
</DebugLayout>
);
}

View File

@@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
import type { Props } from '@theme/DebugJsonView';
export default function DebugJsonView({ src, collapseDepth, }: Props): JSX.Element;

View File

@@ -0,0 +1,38 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import {JsonView} from 'react-json-view-lite';
import styles from './styles.module.css';
const paraisoStyles = {
container: styles.containerParaiso,
basicChildStyle: styles.basicElementParaiso,
label: styles.labelParaiso,
nullValue: styles.nullValueParaiso,
undefinedValue: styles.undefinedValueParaiso,
stringValue: styles.stringValueParaiso,
booleanValue: styles.booleanValueParaiso,
numberValue: styles.numberValueParaiso,
otherValue: styles.otherValueParaiso,
punctuation: styles.punctuationParaiso,
collapseIcon: styles.collapseIconParaiso,
expandIcon: styles.expandIconParaiso,
collapsedContent: styles.collapseContentParaiso,
};
export default function DebugJsonView({src, collapseDepth}) {
return (
<JsonView
data={src}
shouldExpandNode={(idx, value) => {
if (Array.isArray(value)) {
return value.length < 5;
}
return collapseDepth !== undefined && idx < collapseDepth;
}}
style={paraisoStyles}
/>
);
}

View File

@@ -0,0 +1,101 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.containerParaiso {
font-family: monospace;
cursor: default;
background-color: rgb(41 42 43);
position: relative;
margin-top: 10px;
padding: 10px;
border-radius: 4px;
font-size: 13px;
}
.basicElementParaiso {
color: white;
padding: 3px 5px 3px 20px;
border-left: 1px solid rgb(79 66 76);
}
.labelParaiso {
color: rgb(231 233 219);
letter-spacing: 0.5px;
margin-right: 3px;
}
.nullValueParaiso {
display: inline-block;
color: rgb(254 196 24);
font-size: 11px;
font-weight: bold;
background-color: rgb(79 66 76);
padding: 1px 2px;
border-radius: 3px;
text-transform: uppercase;
}
.undefinedValueParaiso {
color: rgb(141 134 135);
}
.stringValueParaiso {
color: rgb(249 155 21);
}
.booleanValueParaiso {
color: rgb(129 91 164);
}
.numberValueParaiso {
color: rgb(233 107 168);
}
.otherValueParaiso {
color: white;
}
.punctuationParaiso {
color: white;
}
.expandIconParaiso {
display: inline-block;
color: rgb(129 91 164);
font-size: 22px;
vertical-align: baseline;
margin-right: 3px;
line-height: 10px;
}
.collapseIconParaiso::after {
content: '\25BE';
}
.collapseIconParaiso {
display: inline-block;
color: rgb(6 182 239);
font-size: 22px;
vertical-align: baseline;
margin-right: 3px;
line-height: 10px;
}
.expandIconParaiso::after {
content: '\25B8';
}
.collapseContentParaiso {
color: rgb(249 155 21);
font-size: 18px;
line-height: 10px;
cursor: pointer;
}
.collapseContentParaiso::after {
content: '...';
}

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
export default function DebugLayout({ children, }: {
children: ReactNode;
}): JSX.Element;

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Head from '@docusaurus/Head';
import Link from '@docusaurus/Link';
import styles from './styles.module.css';
function DebugNavLink({to, children}) {
return (
<Link
className={styles.navlink}
isNavLink
to={to}
exact
activeStyle={{
backgroundColor: '#363739',
}}>
{children}
</Link>
);
}
export default function DebugLayout({children}) {
return (
<>
<Head>
<html lang="en" />
<title>Docusaurus debug panel</title>
<meta name="robots" content="noindex" />
</Head>
<div>
<nav className={styles.nav}>
<DebugNavLink to="/__docusaurus/debug">Config</DebugNavLink>
<DebugNavLink to="/__docusaurus/debug/metadata">
Metadata
</DebugNavLink>
<DebugNavLink to="/__docusaurus/debug/registry">
Registry
</DebugNavLink>
<DebugNavLink to="/__docusaurus/debug/routes">Routes</DebugNavLink>
<DebugNavLink to="/__docusaurus/debug/content">Content</DebugNavLink>
<DebugNavLink to="/__docusaurus/debug/globalData">
Global data
</DebugNavLink>
</nav>
<main className={styles.container}>{children}</main>
</div>
</>
);
}

View File

@@ -0,0 +1,75 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.container {
padding: 20px;
padding-top: 80px;
overflow-x: hidden;
background-color: #18191a;
color: white;
min-height: 100vh;
}
.container code {
color: white;
background-color: #444950;
}
.nav {
position: fixed;
display: flex;
justify-content: space-evenly;
align-items: center;
height: 3.75rem;
background-color: #242526;
width: 100%;
z-index: 1;
}
.navlink {
color: white;
font-weight: 500;
font-size: clamp(12px, 4vw, 16px);
text-align: center;
border-radius: 4px;
padding: 6px;
}
.navlink:hover {
text-decoration: none;
background-color: #292a2b;
}
.active {
background-color: #363739;
}
@media screen and (min-width: 800px) {
.nav {
flex-direction: column;
justify-content: flex-start;
align-items: center;
height: 100vh;
width: 200px;
float: left;
background-color: #18191a;
border-right: 1px solid #606770;
padding-top: 20px;
}
.navlink {
width: 80%;
margin-top: 20px;
text-align: left;
}
.container {
padding-top: 40px;
float: right;
width: calc(100% - 200px);
}
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
export default function DebugRegistry(): JSX.Element;

View File

@@ -0,0 +1,29 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import registry from '@generated/registry';
import DebugLayout from '@theme/DebugLayout';
import styles from './styles.module.css';
export default function DebugRegistry() {
return (
<DebugLayout>
<h2>Registry</h2>
<ul className="clean-list">
{Object.values(registry).map(([, aliasedPath, resolved]) => (
<li key={aliasedPath} className={styles.listItem}>
<div style={{marginBottom: '10px'}}>
Aliased Path: <code>{aliasedPath}</code>
</div>
<div>
Resolved Path: <code>{resolved}</code>
</div>
</li>
))}
</ul>
</DebugLayout>
);
}

View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.listItem {
background-color: #242526;
padding: 10px;
border-radius: 4px;
margin-bottom: 20px;
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
export default function DebugRoutes(): JSX.Element;

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import routes from '@generated/routes';
import DebugLayout from '@theme/DebugLayout';
import DebugJsonView from '@theme/DebugJsonView';
import styles from './styles.module.css';
export default function DebugRoutes() {
return (
<DebugLayout>
<h2>Routes</h2>
<ul className="clean-list">
{routes.map(({path, exact, routes: childRoutes}) => (
<li key={path} className={styles.listItem}>
<div className={styles.route}>
<code className={styles.routeName}>{path}</code>
</div>
<div>
Is exact: <code>{String(Boolean(exact))}</code>
</div>
{childRoutes && (
<div>
Child Routes:
<DebugJsonView src={childRoutes} />
</div>
)}
</li>
))}
</ul>
</DebugLayout>
);
}

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.listItem {
background-color: #242526;
padding: 10px;
border-radius: 4px;
margin-bottom: 20px;
}
.route {
margin-bottom: 10px;
}
.routeName {
color: #e06b6b;
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="react" />
export default function DebugMetadata(): JSX.Element;

View File

@@ -0,0 +1,42 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import DebugLayout from '@theme/DebugLayout';
import styles from './styles.module.css';
export default function DebugMetadata() {
const {siteMetadata} = useDocusaurusContext();
return (
<DebugLayout>
<h2>Site Metadata</h2>
<div>
Docusaurus Version: <code>{siteMetadata.docusaurusVersion}</code>
</div>
<div>
Site Version:{' '}
<code>{siteMetadata.siteVersion ?? 'No version specified'}</code>
</div>
<h3 className={styles.sectionTitle}>Plugins and themes</h3>
<ul className="clean-list">
{Object.entries(siteMetadata.pluginVersions).map(
([name, versionInformation]) => (
<li key={name} className={styles.listItem}>
{versionInformation.type === 'package' &&
versionInformation.version && (
<div className={styles.version}>
<code>{versionInformation.version}</code>
</div>
)}
<div className={styles.name}>{name}</div>
<div>Type: {versionInformation.type}</div>
</li>
),
)}
</ul>
</DebugLayout>
);
}

View File

@@ -0,0 +1,26 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.sectionTitle {
margin-top: 20px;
}
.listItem {
background-color: #242526;
padding: 10px;
border-radius: 4px;
margin-bottom: 20px;
}
.version {
float: right;
}
.name {
font-weight: 800;
color: #e06b6b;
}