← All packages

API reference

@searsuite/sear-plugin-find-replace

Sparse, typed Sheet find and replace.

28 exportsderived from source

classSheetFindReplaceErrorsource ↗
class SheetFindReplaceError extends SearError

Diagnostic error surfaced to hosts by find and replace commands or queries.

constructorconstructor
SheetFindReplaceError(code: SheetFindReplaceErrorCode, message: string, details?: SearErrorDetails): SheetFindReplaceError
code: SheetFindReplaceErrorCode
message: string
details: SearErrorDetails
propertycode
readonly code: SheetFindReplaceErrorCode

Stable error category.

Inherited members 9

Inherited from SearError.

classSheetFindReplacePluginsource ↗
class SheetFindReplacePlugin extends Plugin<unknown, CellProperties, null>

Stateless Sheet feature; matches always read the current staged data owner.

constructorconstructor
SheetFindReplacePlugin(data: SheetDataPlugin, codecs: CellClipboardCodecRegistry, commits: CellCommitStrategyRegistry, projection?: Pick<SheetFindSource, "readValue" | "forEachProjectedValueInRange">): SheetFindReplacePlugin
data: SheetDataPlugin
codecs: CellClipboardCodecRegistry
commits: CellCommitStrategyRegistry
projection: Pick<SheetFindSource, "readValue" | "forEachProjectedValueInRange">
propertywarnOnDuplicateDepth
readonly warnOnDuplicateDepth: false

Whether PluginManager should warn when another ordered plugin shares this depth.

propertypluginKeystatic
readonly pluginKey: PluginKey
propertysymbolstatic
readonly symbol: typeof symbol
methodapply
apply(_state: null, _transaction: Transaction): null

Applies a transaction to plugin-owned state and returns the next state.

_state: null
_transaction: Transaction
methodgetPluginConfig
getPluginConfig(): null

Returns this plugin's runtime configuration view for the current core.

methodonTransactionCommitted
onTransactionCommitted(transaction: Transaction): void

Runs only after every step in the enclosing pipeline has succeeded and all staged plugin state has been committed. Use it for derived caches, notifications, persistence, and transport; never perform those effects in apply, because a later pipeline step may still fail.

transaction: Transaction

A committed transaction from the completed pipeline.

methodregisterCommands
registerCommands(commands: SheetCommandBus): void
commands: SheetCommandBus
methodregisterQueries
registerQueries(queries: SheetQueryRegistry): void
queries: SheetQueryRegistry
methodregisterState
registerState(): { key: PluginKey; state: null }

Registers one or more plugin-owned state records with the host manager.

methodrender
render(): []

Produces scene nodes owned by this plugin for the current core state.

Inherited members 28

Inherited from Plugin.

interfaceSheetFindInputsource ↗
interface SheetFindInput

Query options shared by navigation and replacement.

propertycontent
readonly content?: SheetFindContent

Whether to read displayed values or formula source.

propertyentireCell
readonly entireCell?: boolean

Requires the search text to equal the entire cell text.

propertymatchCase
readonly matchCase?: boolean

Enables case-sensitive matching.

propertyorder
readonly order?: SheetFindOrder

Cell traversal order.

propertyrange
readonly range?: SheetFindRange

Limits search to an inclusive rectangular cell range.

propertytext
readonly text: string

Literal text to search for; an empty string produces no matches.

interfaceSheetFindMatchsource ↗
interface SheetFindMatch

One occurrence, with UTF-16 offsets within the cell's searched text.

propertycolumn
readonly column: number

Zero-based column coordinate.

propertyend
readonly end: number

Exclusive UTF-16 offset.

propertyrow
readonly row: number

Zero-based row coordinate.

propertystart
readonly start: number

Inclusive UTF-16 offset.

propertytext
readonly text: string

Searched cell text at query time.

interfaceSheetFindPagesource ↗
interface SheetFindPage

Match window and its position in the complete result set.

propertymatches
readonly matches: readonly SheetFindMatch[]
propertyrevision
readonly revision: number
propertystartIndex
readonly startIndex: number
propertytotal
readonly total: number
interfaceSheetFindPageInputsource ↗
interface SheetFindPageInput extends SheetFindInput

A bounded window of matches in the requested traversal order.

propertybackward
readonly backward?: boolean

Reads the matches preceding the cursor when set.

propertycursor
readonly cursor?: Pick<SheetFindMatch, "start" | "row" | "column">

Exclusive position from which to continue.

propertyexpectedRevision
readonly expectedRevision?: number

Rejects a cursor created before the Sheet data changed.

propertylimit
readonly limit: number

Maximum number of matches returned.

Inherited members 6

Inherited from SheetFindInput.

interfaceSheetFindRangesource ↗
interface SheetFindRange

Inclusive cell bounds for a Sheet search.

propertyend
readonly end: readonly [number, number]

Last row and column.

propertystart
readonly start: readonly [number, number]

First row and column.

interfaceSheetFindReplaceSourcesource ↗
interface SheetFindReplaceSource extends SheetFindSource

Search source plus the cell commit policy used for replacements.

propertycommitStrategies
readonly commitStrategies: Pick<CellCommitStrategyRegistry, "commit">
Inherited members 5

Inherited from SheetFindSource.

interfaceSheetFindSourcesource ↗
interface SheetFindSource

Sparse cells and optional projected values visible to a Sheet search.

propertycodecs
readonly codecs: Pick<CellClipboardCodecRegistry, "toPlainText">
propertyforEachProjectedValueInRange
readonly forEachProjectedValueInRange?: (startRow: number, startColumn: number, endRow: number, endColumn: number, visit: (row: number, column: number): void): void
propertygetRevision
readonly getRevision?: (): number
propertymatrix
readonly matrix: CSRMatrix<CellMatrixElement>
propertyreadValue
readonly readValue?: (row: number, column: number, cell: CellMatrixElement | null): unknown
interfaceSheetReplaceInputsource ↗
interface SheetReplaceInput extends SheetFindInput

Replacement options shared by single and bulk commands.

propertyreplacement
readonly replacement: string

Literal text inserted for each matching occurrence.

Inherited members 6

Inherited from SheetFindInput.

interfaceSheetReplaceOneInputsource ↗
interface SheetReplaceOneInput extends SheetReplaceInput

Replaces one match returned by the find query.

propertymatch
readonly match: SheetFindMatch

Selected occurrence, including the cell text observed by the find query.

Inherited members 7

Inherited from SheetReplaceInput.

typeSheetFindContentsource ↗
type SheetFindContent = typeof SheetFindContent[keyof typeof SheetFindContent]

Supported cell content projections for search.

typeSheetFindOrdersource ↗
type SheetFindOrder = typeof SheetFindOrder[keyof typeof SheetFindOrder]

Supported match traversal orders.

typeSheetFindReplaceErrorCodesource ↗
type SheetFindReplaceErrorCode = typeof SheetFindReplaceErrorCode[keyof typeof SheetFindReplaceErrorCode]

Public code union for diagnostic find/replace failures.

variableFindSheetMatchesQuerysource ↗
FindSheetMatchesQuery: SheetQueryDefinition<SheetFindInput, readonly SheetFindMatch[]>

Reads matching occurrences from current Sheet state.

variableFindSheetMatchPageQuerysource ↗
FindSheetMatchPageQuery: SheetQueryDefinition<SheetFindPageInput, SheetFindPage>

Reads a bounded window and total count without retaining all matches.

variableMAX_SHEET_FIND_PAGE_SIZEsource ↗
MAX_SHEET_FIND_PAGE_SIZE: 200

Bounds the memory used by a single Sheet search page.

variableReadSheetFindRevisionQuerysource ↗
ReadSheetFindRevisionQuery: SheetQueryDefinition<void, number>

Reads the revision used to invalidate cached result windows.

variableReplaceAllSheetMatchesCommandsource ↗
ReplaceAllSheetMatchesCommand: SheetCommandDefinition<SheetReplaceInput, SheetCommandResult>

Replaces all matching occurrences in one Sheet transaction.

variableReplaceSheetMatchCommandsource ↗
ReplaceSheetMatchCommand: SheetCommandDefinition<SheetReplaceOneInput, SheetCommandResult>

Replaces one selected occurrence in a Sheet transaction.

variableSheetFindContentsource ↗
SheetFindContent: { Formula: "formula"; Value: "value" }

The source searched in a cell.

variableSheetFindOrdersource ↗
SheetFindOrder: { Columns: "columns"; Rows: "rows" }

Row-major or column-major traversal of matching cells.

variableSheetFindReplaceErrorCodesource ↗
SheetFindReplaceErrorCode: { CrossBlockReplacement: "SHEET_FIND_CROSS_BLOCK_REPLACEMENT"; InvalidPage: "SHEET_FIND_INVALID_PAGE"; InvalidRange: "SHEET_FIND_INVALID_RANGE"; InvalidRichText: "SHEET_FIND_INVALID_RICH_TEXT"; StaleResults: "SHEET_FIND_STALE_RESULTS" }

Stable failure categories for Sheet find and replace.

functionfindSheetMatchessource ↗
findSheetMatches(input: SheetFindInput, source: SheetFindSource): SheetFindMatch[]

Collects all occurrences for callers that need the complete result.

input: SheetFindInput
source: SheetFindSource
functionfindSheetMatchPagesource ↗
findSheetMatchPage(input: SheetFindPageInput, source: SheetFindSource): SheetFindPage

Finds a bounded window while still reporting the complete match count.

input: SheetFindPageInput
source: SheetFindSource
functionregisterSheetFindReplaceCommandssource ↗
registerSheetFindReplaceCommands(commands: SheetCommandBus, source: SheetFindReplaceSource): void

Publishes single and bulk replace commands for a Sheet plugin.

commands: SheetCommandBus
source: SheetFindReplaceSource
functionregisterSheetFindReplaceQueriessource ↗
registerSheetFindReplaceQueries(queries: SheetQueryRegistry, source: SheetFindReplaceSource): void

Publishes the typed find query for a Sheet plugin.

queries: SheetQueryRegistry
source: SheetFindReplaceSource
functionreplaceSheetMatchessource ↗
replaceSheetMatches(input: SheetReplaceInput | SheetReplaceOneInput, source: SheetFindReplaceSource, one: boolean): UpdateCellOTOperation<CellMatrixElement | null>[]

Builds one operation per changed cell for a single undoable transaction.

input: SheetReplaceInput | SheetReplaceOneInput
source: SheetFindReplaceSource
one: boolean