← All packages

@searsuite/sear-plugin-find-replace

Find matches

Find queries return matching cells or a page of matches. Use the page query when the result set can be large.

interfaceSheetFindInput

Query options shared by navigation and replacement.

propertyreadonly content?: SheetFindContent

Whether to read displayed values or formula source.

propertyreadonly entireCell?: boolean

Requires the search text to equal the entire cell text.

propertyreadonly matchCase?: boolean

Enables case-sensitive matching.

propertyreadonly order?: SheetFindOrder

Cell traversal order.

propertyreadonly range?: SheetFindRange

Limits search to an inclusive rectangular cell range.

propertyreadonly text: string

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

interfaceSheetFindMatch

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

propertyreadonly column: number

Zero-based column coordinate.

propertyreadonly end: number

Exclusive UTF-16 offset.

propertyreadonly row: number

Zero-based row coordinate.

propertyreadonly start: number

Inclusive UTF-16 offset.

propertyreadonly text: string

Searched cell text at query time.

interfaceSheetFindPage

Match window and its position in the complete result set.

interfaceSheetFindPageInput
interface SheetFindPageInput extends SheetFindInput

A bounded window of matches in the requested traversal order.

propertyreadonly backward?: boolean

Reads the matches preceding the cursor when set.

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

Exclusive position from which to continue.

propertyreadonly expectedRevision?: number

Rejects a cursor created before the Sheet data changed.

propertyreadonly limit: number

Maximum number of matches returned.

Inherited members 6

Inherited from SheetFindInput.

interfaceSheetFindRange

Inclusive cell bounds for a Sheet search.

propertyreadonly end: readonly [number, number]

Last row and column.

propertyreadonly start: readonly [number, number]

First row and column.

typeSheetFindContent
type SheetFindContent = typeof SheetFindContent[keyof typeof SheetFindContent] SheetFindContent: { Formula: "formula"; Value: "value" }

Supported cell content projections for search.

typeSheetFindOrder
type SheetFindOrder = typeof SheetFindOrder[keyof typeof SheetFindOrder] SheetFindOrder: { Columns: "columns"; Rows: "rows" }

Supported match traversal orders.

variableFindSheetMatchesQuery
FindSheetMatchesQuery: SheetQueryDefinition<SheetFindInput, readonly SheetFindMatch[]>

Reads matching occurrences from current Sheet state.

variableFindSheetMatchPageQuery
FindSheetMatchPageQuery: SheetQueryDefinition<SheetFindPageInput, SheetFindPage>

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

variableMAX_SHEET_FIND_PAGE_SIZE
MAX_SHEET_FIND_PAGE_SIZE: 200

Bounds the memory used by a single Sheet search page.

variableReadSheetFindRevisionQuery
ReadSheetFindRevisionQuery: SheetQueryDefinition<void, number>

Reads the revision used to invalidate cached result windows.

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

Collects all occurrences for callers that need the complete result.

functionfindSheetMatchPage
findSheetMatchPage(input: SheetFindPageInput, source: SheetFindSource): SheetFindPage

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

Replace matches

classSheetFindReplaceError
class SheetFindReplaceError extends SearError

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

Inherited members 9

Inherited from SearError.

classSheetFindReplacePlugin
class SheetFindReplacePlugin extends Plugin<unknown, CellProperties, null>

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

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

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

propertyreadonly pluginKey: PluginKeystatic
propertyreadonly symbol: typeof symbolstatic
methodapply(_state: null, _transaction: Transaction): null

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

methodgetPluginConfig(): null

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

methodonTransactionCommitted(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

A committed transaction from the completed pipeline.

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

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

methodrender(): []

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

Inherited members 27

Inherited from Plugin.

interfaceSheetFindReplaceSource
interface SheetFindReplaceSource extends SheetFindSource

Search source plus the cell commit policy used for replacements.

Inherited members 5

Inherited from SheetFindSource.

interfaceSheetReplaceInput
interface SheetReplaceInput extends SheetFindInput

Replacement options shared by single and bulk commands.

propertyreadonly replacement: string

Literal text inserted for each matching occurrence.

Inherited members 6

Inherited from SheetFindInput.

interfaceSheetReplaceOneInput
interface SheetReplaceOneInput extends SheetReplaceInput

Replaces one match returned by the find query.

propertyreadonly match: SheetFindMatch

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

Inherited members 7

Inherited from SheetReplaceInput.

typeSheetFindReplaceErrorCode
type SheetFindReplaceErrorCode = typeof SheetFindReplaceErrorCode[keyof typeof SheetFindReplaceErrorCode] 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" }

Public code union for diagnostic find/replace failures.

variableReplaceAllSheetMatchesCommand
ReplaceAllSheetMatchesCommand: SheetCommandDefinition<SheetReplaceInput, SheetCommandResult>

Replaces all matching occurrences in one Sheet transaction.

variableReplaceSheetMatchCommand
ReplaceSheetMatchCommand: SheetCommandDefinition<SheetReplaceOneInput, SheetCommandResult>

Replaces one selected occurrence in a Sheet transaction.

functionregisterSheetFindReplaceCommands
registerSheetFindReplaceCommands(commands: SheetCommandBus, source: SheetFindReplaceSource): void

Publishes single and bulk replace commands for a Sheet plugin.

functionregisterSheetFindReplaceQueries
registerSheetFindReplaceQueries(queries: SheetQueryRegistry, source: SheetFindReplaceSource): void

Publishes the typed find query for a Sheet plugin.

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

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