-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(live-codeblock): migrate theme to TS (#6583)
* refactor(live-codeblock): migrate theme to TS * Don't make it visible
- Loading branch information
Showing
11 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/docusaurus-theme-live-codeblock/src/theme-live-codeblock.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
declare module '@docusaurus/theme-live-codeblock' { | ||
export type ThemeConfig = { | ||
liveCodeBlock: { | ||
playgroundPosition: 'top' | 'bottom'; | ||
}; | ||
}; | ||
} | ||
|
||
declare module '@theme/Playground' { | ||
import type {LiveProviderProps} from 'react-live'; | ||
|
||
export interface Props extends LiveProviderProps { | ||
children: string; | ||
} | ||
export default function Playground(props: LiveProviderProps): JSX.Element; | ||
} | ||
|
||
declare module '@theme/ReactLiveScope' { | ||
interface Scope { | ||
[key: string]: unknown; | ||
} | ||
|
||
const ReactLiveScope: Scope; | ||
export default ReactLiveScope; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* 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="@docusaurus/theme-classic" /> | ||
|
||
declare module '@theme-init/CodeBlock' { | ||
import type CodeBlock, {Props as BaseProps} from '@theme/CodeBlock'; | ||
|
||
export interface Props extends BaseProps { | ||
live?: boolean; | ||
} | ||
const CodeBlockComp: typeof CodeBlock; | ||
export default CodeBlockComp; | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/docusaurus-theme-live-codeblock/tsconfig.client.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "esnext", | ||
"jsx": "react-native" | ||
}, | ||
"include": ["src/theme/", "src/*.d.ts", "src/custom-buble.ts"] | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/docusaurus-theme-live-codeblock/tsconfig.server.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src/*.ts"], | ||
"exclude": ["src/custom-buble.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.