API reference
@searsuite/sear-render-cursor
Portable cursor policies with Web and headless host adapters.
15 exportsderived from source
- classCursorEnginesource ↗
-
class CursorEngineAbstract cursor presentation layer.
Responsibilities: translate a logical CursorToken into a concrete presentation (CSS cursor, Canvas sprite, Electron native cursor, test stub, …). Fully decoupled from the Plugin system and the rule system.
Contract:
- mount() called once during plugin initialization, receives the render target.
- apply() called on every cursor change; implementations must be idempotent.
- unmount() called during plugin destruction; must clean up all side-effects.
constructorconstructor CursorEngine(): CursorEnginepropertysymbolstatic readonly symbol: symbolDI token for resolving CursorEngine.
methodapply apply(token: CursorToken): voidApplies a transaction to CursorEngine state.
token: CursorToken
methodmount mount(target: unknown): voidAttaches this adapter to its host surface.
target: unknown
methodoverride override(token: CursorToken | null): voidLock the cursor to a fixed token (e.g. during cell editing). Pass null to release.
token: CursorToken | null
methodunmount unmount(): voidDetaches this adapter from its host surface.
- classCursorRegistrysource ↗
-
class CursorRegistryStores cursor rules and resolves the correct CursorToken for a given CellProperties.
Resolution priority (highest → lowest):
- Matching PositionCursorRule at the greatest layer — last registered wins
- PredicateCursorRule { priority: 'high' } — last registered wins
- RegionCursorRule — exact region match
- TypeCursorRule — exact type match
- PredicateCursorRule { priority: 'low' } — last registered wins
- Fallback: 'default'
constructorconstructor CursorRegistry(platform?: Platform): CursorRegistryCreates a registry and optionally enables position-rule conflict diagnostics.
platform: Platform
propertysymbolstatic readonly symbol: symbolDI token for resolving CursorRegistry.
methodregister register(rule: CursorRule): (): voidRegisters a cursor rule and returns an idempotent disposer that restores the previous rule for the same key when applicable.
rule: CursorRule
methodregisterPosition registerPosition(rule: Omit<PositionCursorRule, "kind">): (): voidRegisters a coordinate-aware cursor rule without requiring callers to repeat the position-rule discriminator.
ReturnsAn idempotent disposer that restores the previous rule for its key.
rule: Omit<PositionCursorRule, "kind">Position rule fields excluding the fixed
kinddiscriminator.
methodresolve resolve(properties: CellProperties | null, position?: CursorPosition): CursorTokenResolves a logical cursor token without exposing presentation details.
properties: CellProperties | nullHit-tested cell properties, if any.
position: CursorPositionPointer context used by registered coordinate rules.
- classHeadlessCursorEnginesource ↗
-
class HeadlessCursorEngine extends CursorEngineCursor adapter for environments that have no visible pointer.
constructorconstructor HeadlessCursorEngine(): HeadlessCursorEnginepropertysymbolstatic readonly symbol: symbolDI token for resolving HeadlessCursorEngine.
methodapply apply(_token: CursorToken): voidApplies a transaction to HeadlessCursorEngine state.
_token: CursorToken
methodmount mount(_target: unknown): voidAttaches this adapter to its host surface.
_target: unknown
methodoverride override(_token: CursorToken | null): voidApplies a temporary host cursor override.
_token: CursorToken | null
methodunmount unmount(): voidDetaches this adapter from its host surface.
- classSheetCursorPluginsource ↗
-
class SheetCursorPlugin extends Plugin<SearCoreSheet, CellProperties, ISheetCursorState>Projects Sheet interaction state into host cursor behavior.
constructorconstructor SheetCursorPlugin(cursorRegistry: CursorRegistry, cursorEngine: CursorEngine, coordinates: CoordinateEngine, renderContext: RenderContext): SheetCursorPluginCreates a SheetCursorPlugin instance.
cursorRegistry: CursorRegistrycursorEngine: CursorEnginecoordinates: CoordinateEnginerenderContext: RenderContext
propertysymbolstatic readonly symbol: symbolDI token for resolving SheetCursorPlugin.
methodapply apply(_state: ISheetCursorState, _tx: Transaction): ISheetCursorState | nullApplies a transaction to SheetCursorPlugin state.
_state: ISheetCursorState_tx: Transaction
methodgetPluginConfig getPluginConfig(): { }Returns the plugin config.
methodonMouseMove onMouseMove(_searCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): voidReturns void (not false) so the event continues to propagate to downstream plugins (selection, editor, etc.). See Guide.md §8: returning false blocks subsequent plugins.
_searCore: SearCoreSheetevent: EventWithOffsetAndTarget<CellProperties>
methodregisterState registerState(): { key: PluginKey; state: { } }Registers the state.
methodrender render(): nullReturns null: this plugin produces no scene nodes. Nothing is written to SceneGraph → DirtyTree, StickyRenderStrategy, and Hit Canvas are completely unaffected (Rule.md §1.4, §1.5).
Inherited members 29
Inherited from Plugin.
- depth
- documentState
- interestedIn
- pluginKey
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- classWebCursorEnginesource ↗
-
class WebCursorEngine extends CursorEngineBrowser CSS cursor implementation. Maps CursorToken to CSS cursor values (including SVG data URI custom cursors).
constructorconstructor WebCursorEngine(): WebCursorEnginemethodapply apply(token: CursorToken): voidApplies a transaction to WebCursorEngine state.
token: CursorToken
methodmount mount(target: unknown): voidAttaches this adapter to its host surface.
target: unknown
methodoverride override(token: CursorToken | null): voidApplies a temporary host cursor override.
token: CursorToken | null
methodregisterToken registerToken(token: string, cssCursor: string): voidAllow third parties to extend or override Token → CSS mapping.
token: stringcssCursor: string
methodunmount unmount(): voidDetaches this adapter from its host surface.
- interfaceCursorPositionsource ↗
-
interface CursorPositionPointer coordinates supplied to a position cursor rule for one pointer event.
propertycore core: SearCoreSheetSheet core whose current data and interaction state may inform the cursor decision.
propertyorigin origin: EventWithOffsetOriginal host pointer event.
propertytarget target: CellProperties | nullHit-tested cell properties, or null when the pointer is not over a scene node.
propertyview view: { x: number; y: number }Pointer location relative to the rendered viewport.
propertyworld world: { x: number; y: number }Pointer location in scrollable sheet-world coordinates.
- interfacePositionCursorRulesource ↗
-
interface PositionCursorRuleCursor rule evaluated from the pointer location rather than a hit node. Higher layers win over lower layers and all structural cursor rules. When multiple matching rules share the highest layer, the last registered rule wins and CursorRegistry reports the ambiguous registration once.
propertycursor cursor: CursorTokenLogical cursor presented while this rule owns the pointer.
propertykey key: string | symbolStable owner key used for replacement, removal, and conflict diagnostics.
propertykind kind: "position"propertylayer layer: numberPrecedence among position rules; larger values take precedence.
propertytest test: (position: CursorPosition): booleanReturns whether this rule owns the supplied pointer location.
- interfacePredicateCursorRulesource ↗
-
interface PredicateCursorRuleFully custom predicate rule.
priority: 'high' → evaluated before region/type rules (e.g., isEdit override). priority: 'low' → evaluated after region/type rules as a fallback (default).
- interfaceRegionCursorRulesource ↗
-
interface RegionCursorRuleExact region-match rule (highest priority among structural rules).
- interfaceTypeCursorRulesource ↗
-
interface TypeCursorRuleType-field match rule (secondary match).
- typeCursorRulesource ↗
-
type CursorRule = RegionCursorRule | TypeCursorRule | PredicateCursorRule | PositionCursorRuleType contract for CursorRule.
- typeCursorTokensource ↗
-
type CursorToken = typeof CursorToken[keyof typeof CursorToken] | string & { }Built-in tokens plus an extension point for third-party plugins.
- variableCursorRuleKindsource ↗
-
CursorRuleKind: { Position: "position"; Predicate: "predicate"; Region: "region"; Type: "type" } - variableCursorRulePrioritysource ↗
-
CursorRulePriority: { High: "high"; Low: "low" } - variableCursorTokensource ↗
-
CursorToken: { Cell: "cell"; ColumnResize: "col-resize"; ColumnSelect: "col-select"; Copy: "copy"; Default: "default"; Grab: "grab"; Grabbing: "grabbing"; Move: "move"; … }Built-in logical cursor names, unbound to any rendering technology.
No public exports match that search.