tldraw/packages/tlsync-client/api-report.md
David Sheldrick 356a0d1e73
[chore] refactor user preferences (#1435)
- Remove TLUser, TLUserPresence
- Add first-class support for user preferences that persists across
rooms and tabs

### Change Type

<!-- 💡 Indicate the type of change your pull request is. -->
<!-- 🤷‍♀️ If you're not sure, don't select anything -->
<!-- ✂️ Feel free to delete unselected options -->

<!-- To select one, put an x in the box: [x] -->

- [ ] `patch` — Bug Fix
- [ ] `minor` — New Feature
- [x] `major` — Breaking Change
- [ ] `dependencies` — Dependency Update (publishes a `patch` release,
for devDependencies use `internal`)
- [ ] `documentation` — Changes to the documentation only (will not
publish a new version)
- [ ] `tests` — Changes to any testing-related code only (will not
publish a new version)
- [ ] `internal` — Any other changes that don't affect the published
package (will not publish a new version)

### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [ ] Unit Tests
- [ ] Webdriver tests

### Release Notes

- Add a brief release note for your PR here.
2023-05-25 09:54:29 +00:00

3 KiB

API Report File for "@tldraw/tlsync-client"

Do not edit this file. It is a report generated by API Extractor.


import { RecordsDiff } from '@tldraw/tlstore';
import { SerializedSchema } from '@tldraw/tlstore';
import { StoreSnapshot } from '@tldraw/tlstore';
import { SyncedStore } from '@tldraw/editor';
import { TldrawEditorConfig } from '@tldraw/editor';
import { TLInstanceId } from '@tldraw/editor';
import { TLRecord } from '@tldraw/editor';
import { TLStore } from '@tldraw/editor';
import { TLStoreSchema } from '@tldraw/editor';

// @public (undocumented)
export function addDbName(name: string): void;

// @public (undocumented)
export class BroadcastChannelMock {
    constructor(_name: string);
    // (undocumented)
    close(): void;
    // (undocumented)
    onmessage?: (e: MessageEvent) => void;
    // (undocumented)
    postMessage(_msg: Message): void;
}

// @public (undocumented)
export function clearDb(universalPersistenceKey: string): void;

// @public (undocumented)
export const DEFAULT_DOCUMENT_NAME: any;

// @public (undocumented)
export function getAllIndexDbNames(): string[];

// @public (undocumented)
export function hardReset({ shouldReload }?: {
    shouldReload?: boolean | undefined;
}): Promise<void>;

// @public (undocumented)
export function loadDataFromStore(universalPersistenceKey: string, opts?: {
    didCancel?: () => boolean;
}): Promise<{
    records: TLRecord[];
    schema?: SerializedSchema;
} | undefined>;

// @public (undocumented)
export const STORE_PREFIX = "TLDRAW_DOCUMENT_v2";

// @public (undocumented)
export function storeChangesInIndexedDb(universalPersistenceKey: string, schema: TLStoreSchema, changes: RecordsDiff<any>, opts?: {
    didCancel?: () => boolean;
}): Promise<void>;

// @public (undocumented)
export function storeSnapshotInIndexedDb(universalPersistenceKey: string, schema: TLStoreSchema, snapshot: StoreSnapshot<any>, opts?: {
    didCancel?: () => boolean;
}): Promise<void>;

// @public (undocumented)
export const TAB_ID: TLInstanceId;

// @public (undocumented)
export class TLLocalSyncClient {
    constructor(store: TLStore, { universalPersistenceKey, onLoad, onLoadError, }: {
        universalPersistenceKey: string;
        onLoad: (self: TLLocalSyncClient) => void;
        onLoadError: (error: Error) => void;
    }, channel?: BroadcastChannel | BroadcastChannelMock);
    // (undocumented)
    readonly channel: BroadcastChannel | BroadcastChannelMock;
    // (undocumented)
    close(): void;
    // (undocumented)
    initTime: number;
    // (undocumented)
    readonly serializedSchema: SerializedSchema;
    // (undocumented)
    readonly store: TLStore;
    // (undocumented)
    readonly universalPersistenceKey: string;
}

// @public
export function useLocalSyncClient({ universalPersistenceKey, instanceId, config, }: {
    universalPersistenceKey: string;
    instanceId: TLInstanceId;
    config: TldrawEditorConfig;
}): SyncedStore;

// (No @packageDocumentation comment for this package)