Skip to main content

@lexical/extension

Interfaces​

ReadonlySignal​

Defined in: @preact/signals-core/dist/signals-core.d.ts:76

An interface for read-only signals.

Type Parameters​

T​

T = any

Properties​

brand​

brand: typeof BRAND_SYMBOL

Defined in: @preact/signals-core/dist/signals-core.d.ts:83

value​

readonly value: T

Defined in: @preact/signals-core/dist/signals-core.d.ts:77

Methods​

peek()​

peek(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:78

Returns​

T

subscribe()​

subscribe(fn): () => void

Defined in: @preact/signals-core/dist/signals-core.d.ts:79

Parameters​
fn​

(value) => void

Returns​

() => void

toJSON()​

toJSON(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:82

Returns​

T

toString()​

toString(): string

Defined in: @preact/signals-core/dist/signals-core.d.ts:81

Returns​

string

valueOf()​

valueOf(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:80

Returns​

T


Signal​

Defined in: @preact/signals-core/dist/signals-core.d.ts:36

The base class for plain and computed signals.

Type Parameters​

T​

T = any

Properties​

brand​

brand: typeof BRAND_SYMBOL

Defined in: @preact/signals-core/dist/signals-core.d.ts:44

name?​

optional name?: string

Defined in: @preact/signals-core/dist/signals-core.d.ts:39

Accessors​

value​
Get Signature​

get value(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:45

Returns​

T

Set Signature​

set value(value): void

Defined in: @preact/signals-core/dist/signals-core.d.ts:46

Parameters​
value​

T

Returns​

void

Methods​

peek()​

peek(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:43

Returns​

T

subscribe()​

subscribe(fn): () => void

Defined in: @preact/signals-core/dist/signals-core.d.ts:38

Parameters​
fn​

(value) => void

Returns​

() => void

toJSON()​

toJSON(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:42

Returns​

T

toString()​

toString(): string

Defined in: @preact/signals-core/dist/signals-core.d.ts:41

Returns​

string

valueOf()​

valueOf(): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:40

Returns​

T


SignalOptions​

Defined in: @preact/signals-core/dist/signals-core.d.ts:48

Type Parameters​

T​

T = any

Properties​

name?​

optional name?: string

Defined in: @preact/signals-core/dist/signals-core.d.ts:51

unwatched?​

optional unwatched?: (this) => void

Defined in: @preact/signals-core/dist/signals-core.d.ts:50

Parameters​
this​

Signal<T>

Returns​

void

watched?​

optional watched?: (this) => void

Defined in: @preact/signals-core/dist/signals-core.d.ts:49

Parameters​
this​

Signal<T>

Returns​

void

Functions​

batch()​

batch<T>(fn): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:24

Combine multiple value updates into one "commit" at the end of the provided callback.

Batches can be nested and changes are only flushed once the outermost batch callback completes.

Accessing a signal that has been modified within a batch will reflect its updated value.

Type Parameters​

T​

T

Parameters​

fn​

() => T

The callback function.

Returns​

T

The value returned by the callback.


computed()​

computed<T>(fn, options?): ReadonlySignal<T>

Defined in: @preact/signals-core/dist/signals-core.d.ts:94

Create a new signal that is computed based on the values of other signals.

The returned computed signal is read-only, and its value is automatically updated when any signals accessed from within the callback function change.

Type Parameters​

T​

T

Parameters​

fn​

() => T

The effect callback.

options?​

SignalOptions<T>

Returns​

ReadonlySignal<T>

A new read-only signal.


effect()​

effect(fn, options?): DisposeFn

Defined in: @preact/signals-core/dist/signals-core.d.ts:139

Create an effect to run arbitrary code in response to signal changes.

An effect tracks which signals are accessed within the given callback function fn, and re-runs the callback when those signals change.

The callback may return a cleanup function. The cleanup function gets run once, either when the callback is next called or when the effect gets disposed, whichever happens first.

Parameters​

fn​

EffectFn

The effect callback.

options?​

EffectOptions

Returns​

DisposeFn

A function for disposing the effect.


signal()​

Call Signature​

signal<T>(value, options?): Signal<T>

Defined in: @preact/signals-core/dist/signals-core.d.ts:59

Create a new plain signal.

Type Parameters​
T​

T

Parameters​
value​

T

The initial value for the signal.

options?​

SignalOptions<T>

Returns​

Signal<T>

A new signal.

Call Signature​

signal<T>(): Signal<T | undefined>

Defined in: @preact/signals-core/dist/signals-core.d.ts:60

Create a new plain signal.

Type Parameters​
T​

T = undefined

Returns​

Signal<T | undefined>

A new signal.


untracked()​

untracked<T>(fn): T

Defined in: @preact/signals-core/dist/signals-core.d.ts:32

Run a callback function that can access signal values without subscribing to the signal updates.

Type Parameters​

T​

T

Parameters​

fn​

() => T

The callback function.

Returns​

T

The value returned by the callback.

References​

$applyFormatToDom​

Re-exports $applyFormatToDom


$createHorizontalRuleNode​

Re-exports $createHorizontalRuleNode


$defaultShouldInsertAfter​

Re-exports $defaultShouldInsertAfter


$getExtensionDependency​

Re-exports $getExtensionDependency


$getExtensionOutput​

Re-exports $getExtensionOutput


$getPeerDependency​

Re-exports $getPeerDependency


$isDecoratorTextNode​

Re-exports $isDecoratorTextNode


$isHorizontalRuleNode​

Re-exports $isHorizontalRuleNode


AnyLexicalExtension​

Re-exports AnyLexicalExtension


AnyLexicalExtensionArgument​

Re-exports AnyLexicalExtensionArgument


applyFormatFromStyle​

Re-exports applyFormatFromStyle


applyFormatToDom​

Re-exports applyFormatToDom


AutoFocusConfig​

Re-exports AutoFocusConfig


AutoFocusExtension​

Re-exports AutoFocusExtension


buildEditorFromExtensions​

Re-exports buildEditorFromExtensions


CanIndentPredicate​

Re-exports CanIndentPredicate


ClearEditorConfig​

Re-exports ClearEditorConfig


ClearEditorExtension​

Re-exports ClearEditorExtension


ClickAfterLastBlockConfig​

Re-exports ClickAfterLastBlockConfig


ClickAfterLastBlockExtension​

Re-exports ClickAfterLastBlockExtension


ClickAfterLastBlockOutput​

Re-exports ClickAfterLastBlockOutput


configExtension​

Re-exports configExtension


CONTROL_OR_ALT​

Re-exports CONTROL_OR_ALT


CONTROL_OR_META​

Re-exports CONTROL_OR_META


declarePeerDependency​

Re-exports declarePeerDependency


DecoratorTextExtension​

Re-exports DecoratorTextExtension


DecoratorTextNode​

Re-exports DecoratorTextNode


defineExtension​

Re-exports defineExtension


EditorStateExtension​

Re-exports EditorStateExtension


ExtensionConfigBase​

Re-exports ExtensionConfigBase


ExtensionRegisterState​

Re-exports ExtensionRegisterState


formatKeyboardShortcut​

Re-exports formatKeyboardShortcut


FormatKeyboardShortcutOptions​

Re-exports FormatKeyboardShortcutOptions


getExtensionDependencyFromEditor​

Re-exports getExtensionDependencyFromEditor


getKnownTypesAndNodes​

Re-exports getKnownTypesAndNodes


getPeerDependencyFromEditor​

Re-exports getPeerDependencyFromEditor


getPeerDependencyFromEditorOrThrow​

Re-exports getPeerDependencyFromEditorOrThrow


HMRConfig​

Re-exports HMRConfig


HMRExtension​

Re-exports HMRExtension


HMROutput​

Re-exports HMROutput


HorizontalRuleExtension​

Re-exports HorizontalRuleExtension


HorizontalRuleNode​

Re-exports HorizontalRuleNode


HotContext​

Re-exports HotContext


IMEExtension​

Re-exports IMEExtension


InitialEditorStateType​

Re-exports InitialEditorStateType


InitialStateConfig​

Re-exports InitialStateConfig


InitialStateExtension​

Re-exports InitialStateExtension


INSERT_HORIZONTAL_RULE_COMMAND​

Re-exports INSERT_HORIZONTAL_RULE_COMMAND


KeyboardShortcut​

Re-exports KeyboardShortcut


KeyboardShortcutMatch​

Re-exports KeyboardShortcutMatch


KeyboardShortcutsConfig​

Re-exports KeyboardShortcutsConfig


KeyboardShortcutsExtension​

Re-exports KeyboardShortcutsExtension


KnownTypesAndNodes​

Re-exports KnownTypesAndNodes


LexicalEditorWithDispose​

Re-exports LexicalEditorWithDispose


LexicalExtension​

Re-exports LexicalExtension


LexicalExtensionArgument​

Re-exports LexicalExtensionArgument


LexicalExtensionConfig​

Re-exports LexicalExtensionConfig


LexicalExtensionDependency​

Re-exports LexicalExtensionDependency


LexicalExtensionInit​

Re-exports LexicalExtensionInit


LexicalExtensionName​

Re-exports LexicalExtensionName


LexicalExtensionOutput​

Re-exports LexicalExtensionOutput


NamedKeyboardShortcuts​

Re-exports NamedKeyboardShortcuts


namedSignals​

Re-exports namedSignals


NamedSignalsOptions​

Re-exports NamedSignalsOptions


NamedSignalsOutput​

Re-exports NamedSignalsOutput


NestedEditorExtension​

Re-exports NestedEditorExtension


NodeSelectionDataSelectedConfig​

Re-exports NodeSelectionDataSelectedConfig


NodeSelectionDataSelectedExtension​

Re-exports NodeSelectionDataSelectedExtension


NodeSelectionExtension​

Re-exports NodeSelectionExtension


NormalizedLexicalExtensionArgument​

Re-exports NormalizedLexicalExtensionArgument


NormalizedPeerDependency​

Re-exports NormalizedPeerDependency


NormalizeInlineElementsConfig​

Re-exports NormalizeInlineElementsConfig


NormalizeInlineElementsExtension​

Re-exports NormalizeInlineElementsExtension


NormalizeTripleClickSelectionConfig​

Re-exports NormalizeTripleClickSelectionConfig


NormalizeTripleClickSelectionExtension​

Re-exports NormalizeTripleClickSelectionExtension


NormalizeTripleClickSelectionOutput​

Re-exports NormalizeTripleClickSelectionOutput


OutputComponentExtension​

Re-exports OutputComponentExtension


PreventSelectAllConfig​

Re-exports PreventSelectAllConfig


PreventSelectAllExtension​

Re-exports PreventSelectAllExtension


registerClearEditor​

Re-exports registerClearEditor


registerTabIndentation​

Re-exports registerTabIndentation


RootElementExtension​

Re-exports RootElementExtension


safeCast​

Re-exports safeCast


SelectBlockConfig​

Re-exports SelectBlockConfig


SelectBlockExtension​

Re-exports SelectBlockExtension


SelectionAlwaysOnDisplayExtension​

Re-exports SelectionAlwaysOnDisplayExtension


SerializedDecoratorTextNode​

Re-exports SerializedDecoratorTextNode


SerializedHorizontalRuleNode​

Re-exports SerializedHorizontalRuleNode


shallowMergeConfig​

Re-exports shallowMergeConfig


TabIndentationConfig​

Re-exports TabIndentationConfig


TabIndentationExtension​

Re-exports TabIndentationExtension


WatchEditableExtension​

Re-exports WatchEditableExtension


watchedSignal​

Re-exports watchedSignal