forked from facebook/lexical
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add converted TypeScript definitions (facebook#1378)
- Loading branch information
Showing
37 changed files
with
1,458 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export default function LexicalAutoFormatterPlugin(): React.ReactNode; |
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,20 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
type ChangeHandler = (url: string | null, prevUrl: string | null) => void; | ||
type LinkMatcherResult = { | ||
text: string; | ||
url: string; | ||
length: number; | ||
index: number; | ||
}; | ||
export type LinkMatcher = (text: string) => LinkMatcherResult | null; | ||
export default function LexicalAutoLinkPlugin(props: { | ||
matchers: Array<LinkMatcher>; | ||
onChange?: ChangeHandler; | ||
}): React.ReactNode; |
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,11 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export default function LexicalCharacterLimitPlugin(props: { | ||
charset: 'UTF-8' | 'UTF-16'; | ||
}): React.ReactNode; |
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,14 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict | ||
*/ | ||
|
||
import {$ReadOnly} from 'utility-types'; | ||
type Props = $ReadOnly<{ | ||
onClear?: () => void; | ||
}>; | ||
export default function LexicalClearEditorPlugin(arg0: Props): React.ReactNode; |
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,49 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {Doc, RelativePosition} from 'yjs'; | ||
export type UserState = { | ||
anchorPos: null | RelativePosition; | ||
focusPos: null | RelativePosition; | ||
name: string; | ||
color: string; | ||
focusing: boolean; | ||
}; | ||
export type ProviderAwareness = { | ||
getLocalState: () => UserState; | ||
setLocalState: (arg0: UserState) => void; | ||
getStates: () => Array<UserState>; | ||
on: (type: 'update', cb: () => void) => void; | ||
off: (type: 'update', cb: () => void) => void; | ||
}; | ||
export interface Provider { | ||
connect(): void | Promise<void>; | ||
disconnect(): void; | ||
awareness: ProviderAwareness; | ||
on(type: 'sync', cb: (isSynced: boolean) => void): void; | ||
on(type: 'status', cb: (arg0: {status: string}) => void): void; | ||
// $FlowFixMe: temp | ||
on(type: 'update', cb: (arg0: any) => void): void; | ||
off(type: 'sync', cb: (isSynced: boolean) => void): void; | ||
// $FlowFixMe: temp | ||
off(type: 'update', cb: (arg0: any) => void): void; | ||
off(type: 'status', cb: (arg0: {status: string}) => void): void; | ||
} | ||
type CollaborationContextType = { | ||
clientID: number; | ||
color: string; | ||
name: string; | ||
yjsDocMap: Map<string, Doc>; | ||
}; | ||
export function CollaborationPlugin(arg0: { | ||
id: string; | ||
providerFactory: (id: string, yjsDocMap: Map<string, Doc>) => Provider; | ||
shouldBootstrap: boolean; | ||
}): React.ReactNode; | ||
export declare var CollaborationContext: React.Context<CollaborationContextType>; | ||
export function useCollaborationContext(): CollaborationContextType; |
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,22 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import {Class} from 'utility-types'; | ||
import type {EditorThemeClasses, LexicalEditor, LexicalNode} from 'lexical'; | ||
type Props = { | ||
initialConfig?: { | ||
editor?: LexicalEditor | null; | ||
isReadOnly?: boolean; | ||
namespace?: string; | ||
nodes?: Array<Class<LexicalNode>>; | ||
theme?: EditorThemeClasses; | ||
onError?: (arg0: Error) => void; | ||
}; | ||
children: React.ReactNode; | ||
}; | ||
export default function LexicalComposer(arg0: Props): React.ReactNode; |
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,24 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {EditorThemeClasses, LexicalEditor} from 'lexical'; | ||
export type LexicalComposerContextType = { | ||
getTheme: () => EditorThemeClasses | null | undefined; | ||
}; | ||
export type LexicalComposerContextWithEditor = [ | ||
LexicalEditor, | ||
LexicalComposerContextType, | ||
]; | ||
export declare var LexicalComposerContext: React.Context< | ||
LexicalComposerContextWithEditor | null | undefined | ||
>; | ||
export function createLexicalComposerContext( | ||
parent: LexicalComposerContextWithEditor | null | undefined, | ||
theme: EditorThemeClasses | null | undefined, | ||
): LexicalComposerContextType; | ||
export function useLexicalComposerContext(): LexicalComposerContextWithEditor; |
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) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import {$ReadOnly} from 'utility-types'; | ||
export type Props = $ReadOnly<{ | ||
ariaActiveDescendantID?: string; | ||
ariaAutoComplete?: string; | ||
ariaControls?: string; | ||
ariaDescribedBy?: string; | ||
ariaExpanded?: boolean; | ||
ariaLabel?: string; | ||
ariaLabelledBy?: string; | ||
ariaMultiline?: boolean; | ||
ariaOwneeID?: string; | ||
ariaRequired?: string; | ||
autoCapitalize?: boolean; | ||
autoComplete?: boolean; | ||
autoCorrect?: boolean; | ||
className?: string; | ||
readOnly?: boolean; | ||
role?: string; | ||
style?: StyleSheetList; | ||
spellCheck?: boolean; | ||
tabIndex?: number; | ||
testid?: string; | ||
}>; | ||
export default function LexicalContentEditable(props: Props): React.ReactNode; |
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,9 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export default function LexicalHashtagPlugin(): React.ReactNode; |
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,29 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 { | ||
EditorState, | ||
GridSelection, | ||
LexicalEditor, | ||
NodeSelection, | ||
RangeSelection, | ||
} from 'lexical'; | ||
export type HistoryStateEntry = { | ||
editor: LexicalEditor; | ||
editorState: EditorState; | ||
undoSelection?: RangeSelection | NodeSelection | GridSelection | null; | ||
}; | ||
export type HistoryState = { | ||
current: null | HistoryStateEntry; | ||
redoStack: Array<HistoryStateEntry>; | ||
undoStack: Array<HistoryStateEntry>; | ||
}; | ||
export function HistoryPlugin(arg0: { | ||
externalHistoryState?: HistoryState; | ||
}): React.ReactNode; | ||
export function createEmptyHistoryState(): HistoryState; |
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,23 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {LexicalNode} from 'lexical'; | ||
import {DecoratorNode} from 'lexical'; | ||
export declare class HorizontalRuleNode extends DecoratorNode<React.ReactNode> { | ||
getType(): string; | ||
clone(node: HorizontalRuleNode): HorizontalRuleNode; | ||
createDOM(): HTMLElement; | ||
getTextContent(): '\n'; | ||
isTopLevel(): true; | ||
updateDOM(): false; | ||
decorate(): React.ReactNode; | ||
} | ||
export function $createHorizontalRuleNode(): HorizontalRuleNode; | ||
export function $isHorizontalRuleNode( | ||
node: LexicalNode | null | undefined, | ||
): boolean; |
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,9 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export default function LexicalLinkPlugin(): null; |
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,9 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export default function ListPlugin(): null; |
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,20 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import {Class} from 'utility-types'; | ||
import type {DecoratorEditor, EditorThemeClasses, LexicalNode} from 'lexical'; | ||
export default function LexicalNestedComposer(arg0: { | ||
initialConfig?: { | ||
namespace?: string; | ||
decoratorEditor: DecoratorEditor; | ||
nodes?: Array<Class<LexicalNode>>; | ||
theme?: EditorThemeClasses; | ||
onError?: (arg0: Error) => void; | ||
}; | ||
children?: React.ReactNode; | ||
}): React.ReactNode; |
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,12 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {EditorState, LexicalEditor} from 'lexical'; | ||
export default function OnChangePlugin(arg0: { | ||
onChange: (editorState: EditorState, editor: LexicalEditor) => void; | ||
}): null; |
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,15 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {EditorState} from 'lexical'; | ||
type InitialEditorStateType = null | string | EditorState | (() => void); | ||
export default function PlainTextPlugin(arg0: { | ||
contentEditable: React.ReactNode; | ||
initialEditorState?: InitialEditorStateType; | ||
placeholder: React.ReactNode; | ||
}): React.ReactNode; |
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,15 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {EditorState} from 'lexical'; | ||
type InitialEditorStateType = null | string | EditorState | (() => void); | ||
export default function RichTextPlugin(arg0: { | ||
contentEditable: React.ReactNode; | ||
initialEditorState?: InitialEditorStateType; | ||
placeholder: React.ReactNode; | ||
}): React.ReactNode; |
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,9 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export default function LexicalTablePlugin(): null; |
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,17 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 {LexicalEditor} from 'lexical'; | ||
export default function TreeView(props: { | ||
timeTravelPanelClassName: string; | ||
timeTravelPanelSliderClassName: string; | ||
timeTravelPanelButtonClassName: string; | ||
timeTravelButtonClassName: string; | ||
viewClassName: string; | ||
editor: LexicalEditor; | ||
}): React.ReactNode; |
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
Oops, something went wrong.