import type { SerializedBlock } from '@revesuite/blocks'; import { Slot } from '@revesuite/global/utils'; import * as Y from 'yjs'; import type { AwarenessStore } from '../awareness.js'; import { BaseBlockModel } from '../base.js'; import { Space } from '../space.js'; import { Text } from '../text-adapter.js'; import type { IdGenerator } from '../utils/id-generator.js'; import type { BlockSuiteDoc } from '../yjs/index.js'; import type { PageMeta } from './meta.js'; import type { Workspace } from './workspace.js'; export type YBlock = Y.Map; export type YBlocks = Y.Map; /** JSON-serializable properties of a block */ export type BlockProps = { id: string; flavour: string; text?: Text; children?: BaseBlockModel[]; [index: string]: any; }; export type PrefixedBlockProps = Record & { 'sys:id': string; 'sys:flavour': string; }; type FlatBlockMap = { [key: string]: YBlock; }; type PageOptions = { id: string; workspace: Workspace; doc: BlockSuiteDoc; awarenessStore: AwarenessStore; idGenerator?: IdGenerator; }; export declare class Page extends Space { private readonly _workspace; private readonly _idGenerator; private _history; private _root; private _blockMap; private _synced; private _shouldTransact; private _ignoredKeys; readonly slots: { historyUpdated: Slot; rootAdded: Slot>; rootDeleted: Slot; textUpdated: Slot; yUpdated: Slot; onYEvent: Slot<{ event: Y.YEvent>; }>; blockUpdated: Slot<{ type: 'add' | 'delete' | 'update'; id: string; }>; copied: Slot; pasted: Slot; linkClicked: Slot; }; constructor({ id, workspace, doc, awarenessStore, idGenerator, }: PageOptions); get readonly(): boolean; get history(): Y.UndoManager; get workspace(): Workspace; get schema(): import("./schema.js").Schema; get meta(): PageMeta; get blobs(): import("../index.js").BlobManager; /** key-value store of blocks */ private get _yBlocks(); get root(): BaseBlockModel | null; getYBlockById(id: string): YBlock | undefined; get isEmpty(): boolean; get canUndo(): boolean; get canRedo(): boolean; get YText(): typeof Y.Text; get YMap(): typeof Y.Map; get Text(): typeof Text; withoutTransact(callback: () => void): void; transact(fn: () => void, shouldTransact?: boolean): void; undo(): void; redo(): void; /** Capture current operations to undo stack synchronously. */ captureSync(): void; resetHistory(): void; generateId(): string; getBlockById(id: string): BaseBlockModel | null; getBlockByFlavour(blockFlavour: string): BaseBlockModel[]; hasFlavour(flavour: string): boolean; getParent(target: BaseBlockModel | string): BaseBlockModel | null; getPreviousSibling(block: BaseBlockModel): BaseBlockModel | null; getPreviousSiblings(block: BaseBlockModel): BaseBlockModel[]; getNextSibling(block: BaseBlockModel): BaseBlockModel | null; getNextSiblings(block: BaseBlockModel): BaseBlockModel[]; getSchemaByFlavour(flavour: string): { model: { flavour: string; role: "content" | "root" | "hub"; tag: { _$litStatic$: string; r: symbol; }; parent?: string[] | undefined; children?: string[] | undefined; props?: ((args_0: import("../base.js").InternalPrimitives, ...args_1: unknown[]) => Record) | undefined; toModel?: ((...args: unknown[]) => BaseBlockModel) | undefined; }; version: number; } | undefined; getInitialPropsByFlavour(flavour: string): Record; addBlocks(blocks: Array<{ flavour: string; blockProps?: Partial>; }>, parent?: BaseBlockModel | string | null, parentIndex?: number): string[]; addBlock(flavour: string, blockProps?: Partial>, parent?: BaseBlockModel | string | null, parentIndex?: number): string; private _populateParentChildrenMap; private _repositionBlocks; moveBlocks(blocksToMove: BaseBlockModel[], newParent: BaseBlockModel, targetSibling?: BaseBlockModel | null, shouldInsertBeforeSibling?: boolean): void; updateBlock>(model: BaseBlockModel, props: T): void; addSiblingBlocks(targetModel: BaseBlockModel, props: Array>, place?: 'after' | 'before'): string[]; deleteBlock(model: BaseBlockModel, options?: { bringChildrenTo: 'parent' | BaseBlockModel | false; }): void; trySyncFromExistingDoc(): void; dispose(): void; private _initYBlocks; private _getYBlock; private _historyAddObserver; private _historyPopObserver; private _historyObserver; private _createBlockModel; private _handleYBlockAdd; private _handleYBlockDelete; private _handleYBlockUpdate; private _handleYEvent; private _handleYEvents; private _handleVersion; } export {}; //# sourceMappingURL=page.d.ts.map