@automerge/automerge-repo-svelte-store 0.1.2 → 0.1.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGzD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAyB,MAAM,2BAA2B,CAAA;AAInF,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,QAExC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU;;iBAWjC,SAAS,CAAC,CAAC;EAI3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGzD,OAAO,EACL,IAAI,EACJ,UAAU,EAEX,MAAM,2BAA2B,CAAA;AAIlC,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,QAExC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU;;iBAWjC,SAAS,CAAC,CAAC;EAI3B"}
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ export function document(documentId) {
11
11
  const repo = getContextRepo();
12
12
  const handle = repo.find(documentId);
13
13
  const { set, subscribe } = writable(null, () => {
14
- const onPatch = (h) => set(h.after);
14
+ const onPatch = (h) => set(h.patchInfo.after);
15
15
  handle.addListener("patch", onPatch);
16
16
  return () => handle.removeListener("patch", onPatch);
17
17
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automerge/automerge-repo-svelte-store",
3
- "version": "0.1.2",
3
+ "version": "0.1.3-alpha.0",
4
4
  "description": "A Svelte store containing your automerge documentsj",
5
5
  "repository": "https://github.com/automerge/automerge-repo",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  "watch": "npm-watch"
13
13
  },
14
14
  "dependencies": {
15
- "@automerge/automerge-repo": "^0.1.2",
15
+ "@automerge/automerge-repo": "^0.1.3-alpha.0",
16
16
  "svelte": "^3.0.0"
17
17
  },
18
18
  "watch": {
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "a6313d0e6de2951c98ecffd4a6f01b82c46613e3"
29
+ "gitHead": "5b1959b8a7c1834e5dbbddbce9681f6208024377"
30
30
  }
package/src/index.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import type { Doc, ChangeFn } from "@automerge/automerge"
2
2
  import { setContext, getContext } from "svelte"
3
3
  import { writable } from "svelte/store"
4
- import { Repo, DocumentId, DocHandlePatchPayload } from "@automerge/automerge-repo"
4
+ import {
5
+ Repo,
6
+ DocumentId,
7
+ DocHandlePatchPayload,
8
+ } from "@automerge/automerge-repo"
5
9
 
6
10
  const ContextRepoKey = Symbol("svelte-context-automerge-repo")
7
11
 
@@ -17,7 +21,7 @@ export function document<T>(documentId: DocumentId) {
17
21
  const repo = getContextRepo()
18
22
  const handle = repo.find<T>(documentId)
19
23
  const { set, subscribe } = writable<Doc<T>>(null, () => {
20
- const onPatch = (h: DocHandlePatchPayload<T>) => set(h.after)
24
+ const onPatch = (h: DocHandlePatchPayload<T>) => set(h.patchInfo.after)
21
25
  handle.addListener("patch", onPatch)
22
26
  return () => handle.removeListener("patch", onPatch)
23
27
  })