diff --git a/package.json b/package.json index f45904d..3b7598e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@onsetsoftware/automerge-svelte", "description": "A svelte store and utilities for automerge", - "version": "0.11.1", + "version": "0.11.2", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/src/automerge-derived-store.ts b/src/automerge-derived-store.ts index 8981c90..ef2d832 100644 --- a/src/automerge-derived-store.ts +++ b/src/automerge-derived-store.ts @@ -6,10 +6,10 @@ import { type Writable, writable, } from "svelte/store"; -import type { AutomergeSvelteStore as AutomergeSvelteStoreType } from "./automerge-svelte-store.type"; +import type { AutomergeSvelteStoreInterface } from "./automerge-svelte-store.type"; export class AutomergeDerivedStore - implements Readable, AutomergeSvelteStoreType + implements Readable, AutomergeSvelteStoreInterface { #rootStore: AutomergeSvelteStore; #state: Writable; @@ -35,9 +35,12 @@ export class AutomergeDerivedStore } public change = (callback: ChangeFn, options: ChangeOptions = {}) => { - const changed = this.#rootStore.change((doc) => { - callback(this.#discriminator(doc as U)); - }, options as unknown as ChangeOptions); + const changed = this.#rootStore.change( + (doc) => { + callback(this.#discriminator(doc as U)); + }, + options as unknown as ChangeOptions, + ); return this.#discriminator(changed); }; diff --git a/src/automerge-svelte-store.ts b/src/automerge-svelte-store.ts index e357e89..9838b7c 100644 --- a/src/automerge-svelte-store.ts +++ b/src/automerge-svelte-store.ts @@ -13,10 +13,10 @@ import { type Writable, readable, } from "svelte/store"; -import type { AutomergeSvelteStore as AutomergeSvelteStoreType } from "./automerge-svelte-store.type"; +import type { AutomergeSvelteStoreInterface } from "./automerge-svelte-store.type"; export class AutomergeSvelteStore - implements Readable, AutomergeSvelteStoreType + implements Readable, AutomergeSvelteStoreInterface { #store: AutomergeStore | null; #state: Writable; @@ -24,7 +24,7 @@ export class AutomergeSvelteStore ready: Readable = derived(this.#storeReady, (ready) => ready); #subscribers: number = 0; - #unSubscriber: () => void = () => { }; + #unSubscriber: () => void = () => {}; #unSubscribe: () => void = () => { this.#unSubscriber(); @@ -60,7 +60,7 @@ export class AutomergeSvelteStore const unsubscribe = this.#store?.subscribe((_, patchData) => { set(patchData); - }) || (() => { }); + }) || (() => {}); return () => { unsubscribe(); @@ -87,7 +87,7 @@ export class AutomergeSvelteStore this.#subscribers--; subscription(); }; - }) as AutomergeSvelteStoreType["subscribe"]; + }) as AutomergeSvelteStoreInterface["subscribe"]; } swapStore(store: AutomergeStore) { @@ -111,7 +111,7 @@ export class AutomergeSvelteStore this.#unSubscriber = this.#store?.subscribe((doc: Doc) => { this.#state.set(doc); - }) ?? (() => { }); + }) ?? (() => {}); } private setStoreReady() { diff --git a/src/automerge-svelte-store.type.ts b/src/automerge-svelte-store.type.ts index ea13240..e6408b0 100644 --- a/src/automerge-svelte-store.type.ts +++ b/src/automerge-svelte-store.type.ts @@ -1,7 +1,7 @@ import type { ChangeFn, ChangeOptions, Doc } from "@automerge/automerge"; import type { Readable, Updater } from "svelte/store"; -export interface AutomergeSvelteStore { +export interface AutomergeSvelteStoreInterface { subscribe: Readable["subscribe"]; change(callback: ChangeFn, options?: ChangeOptions): Doc; diff --git a/src/index.ts b/src/index.ts index 718b5cf..52cf8ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,4 +20,6 @@ export { AutomergeDerivedStore } from "./automerge-derived-store"; export { AutomergeEntityStore } from "./automerge-entity-store"; export { AutomergeSvelteStore } from "./automerge-svelte-store"; +export type { AutomergeSvelteStoreInterface } from "./automerge-svelte-store.type"; + export type { EntityTitles } from "./automerge-entity-store";