@signaldb/mobx 1.0.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.
- package/README.md +5 -0
- package/dist/.vite/manifest.json +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @signaldb/mobx
|
|
2
|
+
|
|
3
|
+
This is the [MobX](https://mobx.js.org/README.html) plugin for [SignalDB](https://github.com/maxnowack/signaldb). SignalDB is a local-first JavaScript database with real-time sync, enabling optimistic UI with signal-based reactivity across multiple frameworks.
|
|
4
|
+
|
|
5
|
+
See https://signaldb.js.org/reference/mobx/ for more information.
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { observable as t, runInAction as n, onBecomeUnobserved as r } from "mobx";
|
|
2
|
+
import { createReactivityAdapter as c } from "@signaldb/core";
|
|
3
|
+
const p = c({
|
|
4
|
+
create: () => {
|
|
5
|
+
const e = t({ count: 0 });
|
|
6
|
+
return {
|
|
7
|
+
depend: () => {
|
|
8
|
+
e.count;
|
|
9
|
+
},
|
|
10
|
+
notify: () => {
|
|
11
|
+
n(() => {
|
|
12
|
+
e.count += 1;
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
raw: e
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
isInScope: void 0,
|
|
19
|
+
onDispose(e, { raw: o }) {
|
|
20
|
+
r(o, "count", e);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
p as default
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { observable, runInAction, onBecomeUnobserved, } from 'mobx';\nimport { createReactivityAdapter } from '@signaldb/core';\nconst mobxReactivityAdapter = createReactivityAdapter({\n create: () => {\n const dep = observable({ count: 0 });\n return {\n depend: () => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n dep.count;\n },\n notify: () => {\n runInAction(() => {\n dep.count += 1;\n });\n },\n raw: dep,\n };\n },\n isInScope: undefined,\n onDispose(callback, { raw: dep }) {\n onBecomeUnobserved(dep, 'count', callback);\n },\n});\nexport default mobxReactivityAdapter;\n"],"names":["mobxReactivityAdapter","createReactivityAdapter","dep","observable","runInAction","callback","onBecomeUnobserved"],"mappings":";;AAEA,MAAMA,IAAwBC,EAAwB;AAAA,EAClD,QAAQ,MAAM;AACV,UAAMC,IAAMC,EAAW,EAAE,OAAO,GAAG;AAC5B,WAAA;AAAA,MACH,QAAQ,MAAM;AAEN,QAAAD,EAAA;AAAA,MACR;AAAA,MACA,QAAQ,MAAM;AACV,QAAAE,EAAY,MAAM;AACd,UAAAF,EAAI,SAAS;AAAA,QAAA,CAChB;AAAA,MACL;AAAA,MACA,KAAKA;AAAA,IACT;AAAA,EACJ;AAAA,EACA,WAAW;AAAA,EACX,UAAUG,GAAU,EAAE,KAAKH,KAAO;AACX,IAAAI,EAAAJ,GAAK,SAASG,CAAQ;AAAA,EAAA;AAEjD,CAAC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("mobx"),require("@signaldb/core")):typeof define=="function"&&define.amd?define(["mobx","@signaldb/core"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.SignalDB=n(e.mobx,e.core))})(this,function(e,n){"use strict";return n.createReactivityAdapter({create:()=>{const t=e.observable({count:0});return{depend:()=>{t.count},notify:()=>{e.runInAction(()=>{t.count+=1})},raw:t}},isInScope:void 0,onDispose(t,{raw:o}){e.onBecomeUnobserved(o,"count",t)}})});
|
|
2
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["import { observable, runInAction, onBecomeUnobserved, } from 'mobx';\nimport { createReactivityAdapter } from '@signaldb/core';\nconst mobxReactivityAdapter = createReactivityAdapter({\n create: () => {\n const dep = observable({ count: 0 });\n return {\n depend: () => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n dep.count;\n },\n notify: () => {\n runInAction(() => {\n dep.count += 1;\n });\n },\n raw: dep,\n };\n },\n isInScope: undefined,\n onDispose(callback, { raw: dep }) {\n onBecomeUnobserved(dep, 'count', callback);\n },\n});\nexport default mobxReactivityAdapter;\n"],"names":["createReactivityAdapter","dep","observable","runInAction","callback","onBecomeUnobserved"],"mappings":"mTAE8BA,EAAAA,wBAAwB,CAClD,OAAQ,IAAM,CACV,MAAMC,EAAMC,EAAA,WAAW,CAAE,MAAO,EAAG,EAC5B,MAAA,CACH,OAAQ,IAAM,CAEND,EAAA,KACR,EACA,OAAQ,IAAM,CACVE,EAAAA,YAAY,IAAM,CACdF,EAAI,OAAS,CAAA,CAChB,CACL,EACA,IAAKA,CACT,CACJ,EACA,UAAW,OACX,UAAUG,EAAU,CAAE,IAAKH,GAAO,CACXI,qBAAAJ,EAAK,QAASG,CAAQ,CAAA,CAEjD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@signaldb/mobx",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "rimraf dist && vite build"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/maxnowack/signaldb.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://signaldb.js.org",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"client-database",
|
|
15
|
+
"client",
|
|
16
|
+
"database",
|
|
17
|
+
"local-database",
|
|
18
|
+
"mobx",
|
|
19
|
+
"offline-first",
|
|
20
|
+
"optimistic-ui",
|
|
21
|
+
"reactive",
|
|
22
|
+
"reactivity",
|
|
23
|
+
"plugin",
|
|
24
|
+
"synchronization",
|
|
25
|
+
"typescript"
|
|
26
|
+
],
|
|
27
|
+
"author": "Max Nowack <max.nowack@gmail.com>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.mjs",
|
|
34
|
+
"require": "./dist/index.umd.js",
|
|
35
|
+
"default": "./dist/index.umd.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.umd.js",
|
|
39
|
+
"module": "./dist/index.mjs",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"typesVersions": {
|
|
42
|
+
"*": {
|
|
43
|
+
"*": [
|
|
44
|
+
"./dist/*",
|
|
45
|
+
"./dist/index.d.ts"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist"
|
|
51
|
+
],
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@signaldb/core": "1.x",
|
|
54
|
+
"mobx": "6.x.x"
|
|
55
|
+
}
|
|
56
|
+
}
|