@signaldb/svelte 1.1.1 → 2.0.0-beta.2
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.
- package/dist/index.svelte.d.ts +7 -3
- package/dist/index.svelte.js +30 -28
- package/package.json +4 -4
package/dist/index.svelte.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
declare
|
|
1
|
+
export declare class SvelteDependency {
|
|
2
|
+
#private;
|
|
3
|
+
constructor();
|
|
2
4
|
depend(): void;
|
|
3
5
|
notify(): void;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
onDispose(callback: () => void): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
}
|
|
9
|
+
declare const svelteReactivityAdapter: import("@signaldb/core").ReactivityAdapter<SvelteDependency>;
|
|
6
10
|
export default svelteReactivityAdapter;
|
package/dist/index.svelte.js
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
import { createSubscriber } from 'svelte/reactivity';
|
|
2
2
|
import { createReactivityAdapter } from '@signaldb/core';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
stop();
|
|
13
|
-
};
|
|
3
|
+
export class SvelteDependency {
|
|
4
|
+
#subscribe;
|
|
5
|
+
#update;
|
|
6
|
+
#onDisposeCallbacks;
|
|
7
|
+
constructor() {
|
|
8
|
+
this.#onDisposeCallbacks = [];
|
|
9
|
+
this.#subscribe = createSubscriber((update) => {
|
|
10
|
+
this.#update = update;
|
|
11
|
+
return () => this.dispose();
|
|
14
12
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
}
|
|
14
|
+
depend() {
|
|
15
|
+
this.#subscribe();
|
|
16
|
+
}
|
|
17
|
+
notify() {
|
|
18
|
+
// The #update can potentially be undefined because it only becomes
|
|
19
|
+
// available after #subscribe is called for the first time within a scope.
|
|
20
|
+
this.#update?.();
|
|
21
|
+
}
|
|
22
|
+
onDispose(callback) {
|
|
23
|
+
this.#onDisposeCallbacks.push(callback);
|
|
24
|
+
}
|
|
25
|
+
dispose() {
|
|
26
|
+
this.#onDisposeCallbacks.forEach(callback => callback());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const svelteReactivityAdapter = createReactivityAdapter({
|
|
30
|
+
create: () => new SvelteDependency(),
|
|
31
|
+
isInScope: () => $effect.tracking(),
|
|
32
|
+
onDispose(callback, svelteDependency) {
|
|
33
|
+
svelteDependency.onDispose(callback);
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
export default svelteReactivityAdapter;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaldb/svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-beta.2",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -d --noEmit false",
|
|
7
7
|
"analyze-bundle": "bundle-analyzer ./dist --upload-token=$BUNDLE_ANALYZER_UPLOAD_TOKEN --bundle-name=@signaldb/svelte",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"description": "",
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@signaldb/core": "1.x",
|
|
44
|
+
"@signaldb/core": "1.x || ^2.0.0-0",
|
|
45
45
|
"svelte": "^5.7.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@sveltejs/vite-plugin-svelte": "
|
|
49
|
-
"svelte": "
|
|
48
|
+
"@sveltejs/vite-plugin-svelte": "6.2.4",
|
|
49
|
+
"svelte": "5.46.1"
|
|
50
50
|
}
|
|
51
51
|
}
|