@docusaurus/theme-classic 0.0.0-4866 → 0.0.0-4871
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/admonitions.css +4 -0
- package/lib/theme-classic.d.ts +65 -3
- package/lib/validateThemeConfig.js +12 -0
- package/lib-next/theme/CodeBlock/Container/index.js +29 -0
- package/lib-next/theme/CodeBlock/Container/styles.module.css +14 -0
- package/lib-next/theme/CodeBlock/Content/Element.js +23 -0
- package/lib-next/theme/CodeBlock/Content/String.js +87 -0
- package/lib-next/theme/CodeBlock/{styles.module.css → Content/styles.module.css} +0 -36
- package/lib-next/theme/CodeBlock/Line/index.js +55 -0
- package/lib-next/theme/CodeBlock/Line/styles.module.css +34 -0
- package/lib-next/theme/CodeBlock/index.js +27 -157
- package/lib-next/theme/NavbarItem/HtmlNavbarItem.js +30 -0
- package/lib-next/theme/NavbarItem/index.js +2 -0
- package/package.json +13 -13
- package/src/admonitions.css +4 -0
- package/src/theme/CodeBlock/Container/index.tsx +35 -0
- package/src/theme/CodeBlock/Container/styles.module.css +14 -0
- package/src/theme/CodeBlock/Content/Element.tsx +30 -0
- package/src/theme/CodeBlock/Content/String.tsx +94 -0
- package/src/theme/CodeBlock/{styles.module.css → Content/styles.module.css} +0 -36
- package/src/theme/CodeBlock/Line/index.tsx +51 -0
- package/src/theme/CodeBlock/Line/styles.module.css +34 -0
- package/src/theme/CodeBlock/index.tsx +29 -160
- package/src/theme/NavbarItem/HtmlNavbarItem.tsx +32 -0
- package/src/theme/NavbarItem/index.tsx +2 -0
- package/src/theme-classic.d.ts +65 -3
- package/src/validateThemeConfig.ts +14 -0
package/src/theme-classic.d.ts
CHANGED
|
@@ -148,10 +148,10 @@ declare module '@theme/BlogLayout' {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
declare module '@theme/CodeBlock' {
|
|
151
|
-
import type {
|
|
151
|
+
import type {ReactNode} from 'react';
|
|
152
152
|
|
|
153
153
|
export interface Props {
|
|
154
|
-
readonly children:
|
|
154
|
+
readonly children: ReactNode;
|
|
155
155
|
readonly className?: string;
|
|
156
156
|
readonly metastring?: string;
|
|
157
157
|
readonly title?: string;
|
|
@@ -170,6 +170,56 @@ declare module '@theme/CodeBlock/CopyButton' {
|
|
|
170
170
|
export default function CopyButton(props: Props): JSX.Element;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
declare module '@theme/CodeBlock/Container' {
|
|
174
|
+
import type {ComponentProps} from 'react';
|
|
175
|
+
|
|
176
|
+
export default function CodeBlockContainer<T extends 'div' | 'pre'>({
|
|
177
|
+
as: As,
|
|
178
|
+
...props
|
|
179
|
+
}: {as: T} & ComponentProps<T>): JSX.Element;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare module '@theme/CodeBlock/Content/Element' {
|
|
183
|
+
import type {Props} from '@theme/CodeBlock';
|
|
184
|
+
|
|
185
|
+
export type {Props};
|
|
186
|
+
|
|
187
|
+
export default function CodeBlockElementContent(props: Props): JSX.Element;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare module '@theme/CodeBlock/Content/String' {
|
|
191
|
+
import type {Props as CodeBlockProps} from '@theme/CodeBlock';
|
|
192
|
+
|
|
193
|
+
export interface Props extends Omit<CodeBlockProps, 'children'> {
|
|
194
|
+
readonly children: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export default function CodeBlockStringContent(props: Props): JSX.Element;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare module '@theme/CodeBlock/Line' {
|
|
201
|
+
import type {ComponentProps} from 'react';
|
|
202
|
+
import type Highlight from 'prism-react-renderer';
|
|
203
|
+
|
|
204
|
+
// Lib does not make this easy
|
|
205
|
+
type RenderProps = Parameters<
|
|
206
|
+
ComponentProps<typeof Highlight>['children']
|
|
207
|
+
>[0];
|
|
208
|
+
type GetLineProps = RenderProps['getLineProps'];
|
|
209
|
+
type GetTokenProps = RenderProps['getTokenProps'];
|
|
210
|
+
type Token = RenderProps['tokens'][number][number];
|
|
211
|
+
|
|
212
|
+
export interface Props {
|
|
213
|
+
readonly line: Token[];
|
|
214
|
+
readonly highlight: boolean;
|
|
215
|
+
readonly showLineNumbers: boolean;
|
|
216
|
+
readonly getLineProps: GetLineProps;
|
|
217
|
+
readonly getTokenProps: GetTokenProps;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export default function CodeBlockLine(props: Props): JSX.Element;
|
|
221
|
+
}
|
|
222
|
+
|
|
173
223
|
declare module '@theme/DocCard' {
|
|
174
224
|
import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
|
|
175
225
|
|
|
@@ -822,6 +872,16 @@ declare module '@theme/NavbarItem/DocSidebarNavbarItem' {
|
|
|
822
872
|
export default function DocSidebarNavbarItem(props: Props): JSX.Element;
|
|
823
873
|
}
|
|
824
874
|
|
|
875
|
+
declare module '@theme/NavbarItem/HtmlNavbarItem' {
|
|
876
|
+
import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
|
|
877
|
+
|
|
878
|
+
export interface Props extends DefaultNavbarItemProps {
|
|
879
|
+
readonly value: string;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
export default function HtmlNavbarItem(props: Props): JSX.Element;
|
|
883
|
+
}
|
|
884
|
+
|
|
825
885
|
declare module '@theme/NavbarItem' {
|
|
826
886
|
import type {ComponentProps} from 'react';
|
|
827
887
|
import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
|
|
@@ -832,12 +892,14 @@ declare module '@theme/NavbarItem' {
|
|
|
832
892
|
import type {Props as DocsVersionDropdownNavbarItemProps} from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
|
|
833
893
|
import type {Props as LocaleDropdownNavbarItemProps} from '@theme/NavbarItem/LocaleDropdownNavbarItem';
|
|
834
894
|
import type {Props as SearchNavbarItemProps} from '@theme/NavbarItem/SearchNavbarItem';
|
|
895
|
+
import type {Props as HtmlNavbarItemProps} from '@theme/NavbarItem/HtmlNavbarItem';
|
|
835
896
|
|
|
836
897
|
export type LinkLikeNavbarItemProps =
|
|
837
898
|
| ({readonly type?: 'default'} & DefaultNavbarItemProps)
|
|
838
899
|
| ({readonly type: 'doc'} & DocNavbarItemProps)
|
|
839
900
|
| ({readonly type: 'docsVersion'} & DocsVersionNavbarItemProps)
|
|
840
|
-
| ({readonly type: 'docSidebar'} & DocSidebarNavbarItemProps)
|
|
901
|
+
| ({readonly type: 'docSidebar'} & DocSidebarNavbarItemProps)
|
|
902
|
+
| ({readonly type: 'html'} & HtmlNavbarItemProps);
|
|
841
903
|
|
|
842
904
|
export type Props = ComponentProps<'a'> & {
|
|
843
905
|
readonly position?: 'left' | 'right';
|
|
@@ -93,6 +93,12 @@ const DocSidebarItemSchema = NavbarItemBaseSchema.append({
|
|
|
93
93
|
docsPluginId: Joi.string(),
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
const HtmlNavbarItemSchema = Joi.object({
|
|
97
|
+
className: Joi.string(),
|
|
98
|
+
type: Joi.string().equal('html').required(),
|
|
99
|
+
value: Joi.string().required(),
|
|
100
|
+
});
|
|
101
|
+
|
|
96
102
|
const itemWithType = (type: string | undefined) => {
|
|
97
103
|
// because equal(undefined) is not supported :/
|
|
98
104
|
const typeSchema = type
|
|
@@ -125,6 +131,10 @@ const DropdownSubitemSchema = Joi.object({
|
|
|
125
131
|
is: itemWithType(undefined),
|
|
126
132
|
then: DefaultNavbarItemSchema,
|
|
127
133
|
},
|
|
134
|
+
{
|
|
135
|
+
is: itemWithType('html'),
|
|
136
|
+
then: HtmlNavbarItemSchema,
|
|
137
|
+
},
|
|
128
138
|
{
|
|
129
139
|
is: Joi.alternatives().try(
|
|
130
140
|
itemWithType('dropdown'),
|
|
@@ -196,6 +206,10 @@ const NavbarItemSchema = Joi.object({
|
|
|
196
206
|
is: itemWithType('search'),
|
|
197
207
|
then: SearchItemSchema,
|
|
198
208
|
},
|
|
209
|
+
{
|
|
210
|
+
is: itemWithType('html'),
|
|
211
|
+
then: HtmlNavbarItemSchema,
|
|
212
|
+
},
|
|
199
213
|
{
|
|
200
214
|
is: itemWithType(undefined),
|
|
201
215
|
then: Joi.object().when('.', {
|