mobx-solid 0.0.1
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/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/enable-observable-tracking.d.ts +9 -0
- package/dist/enable-observable-tracking.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/obs.d.ts +8 -0
- package/dist/obs.d.ts.map +1 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sergey Volkov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# mobx-solid
|
|
2
|
+
|
|
3
|
+
MobX bindings for [SolidJS](https://www.solidjs.com/) — reactive state management with fine-grained UI updates.
|
|
4
|
+
|
|
5
|
+
# [Read docs →](https://js2me.github.io/mobx-solid)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install mobx-solid mobx solid-js
|
|
11
|
+
# or
|
|
12
|
+
pnpm add mobx-solid mobx solid-js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { enableObservableTracking } from "mobx-solid";
|
|
19
|
+
import { observable } from "mobx";
|
|
20
|
+
import { render } from "solid-js/web";
|
|
21
|
+
|
|
22
|
+
enableObservableTracking();
|
|
23
|
+
|
|
24
|
+
const store = observable({
|
|
25
|
+
count: 0,
|
|
26
|
+
get double() {
|
|
27
|
+
return this.count * 2;
|
|
28
|
+
},
|
|
29
|
+
increment() {
|
|
30
|
+
this.count++;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
function Counter() {
|
|
35
|
+
return (
|
|
36
|
+
<div>
|
|
37
|
+
<p>
|
|
38
|
+
{store.count} × 2 = {store.double}
|
|
39
|
+
</p>
|
|
40
|
+
<button onClick={() => store.increment()}>+</button>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
render(() => <Counter />, document.getElementById("app")!);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enables MobX observable tracking inside SolidJS reactive computations.
|
|
3
|
+
*
|
|
4
|
+
* [**Documentation**](https://js2me.github.io/mobx-solid/api/enable-observable-tracking)
|
|
5
|
+
*/
|
|
6
|
+
export declare function enableObservableTracking(): void;
|
|
7
|
+
/** @internal Whether `enableObservableTracking()` has already been called. */
|
|
8
|
+
export declare function isObservableTrackingEnabled(): boolean;
|
|
9
|
+
//# sourceMappingURL=enable-observable-tracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable-observable-tracking.d.ts","sourceRoot":"","sources":["../src/enable-observable-tracking.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAuB/C;AAED,8EAA8E;AAC9E,wBAAgB,2BAA2B,IAAI,OAAO,CAErD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Reaction as s, untracked as l, autorun as u } from "mobx";
|
|
2
|
+
import { enableExternalSource as i, createSignal as c, onCleanup as b } from "solid-js";
|
|
3
|
+
let a = !1;
|
|
4
|
+
function p() {
|
|
5
|
+
a || (a = !0, i(
|
|
6
|
+
(e, t) => {
|
|
7
|
+
const r = new s("mobx-solid", t);
|
|
8
|
+
return {
|
|
9
|
+
track: (n) => {
|
|
10
|
+
let o;
|
|
11
|
+
return r.track(() => {
|
|
12
|
+
o = e(n);
|
|
13
|
+
}), o;
|
|
14
|
+
},
|
|
15
|
+
dispose: () => {
|
|
16
|
+
r.dispose();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
(e) => l(e)
|
|
21
|
+
));
|
|
22
|
+
}
|
|
23
|
+
function k(e) {
|
|
24
|
+
const [t, r] = c(void 0, {
|
|
25
|
+
equals: !1
|
|
26
|
+
}), n = u(() => {
|
|
27
|
+
r(e);
|
|
28
|
+
});
|
|
29
|
+
return b(n), t;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
p as enableObservableTracking,
|
|
33
|
+
k as obs
|
|
34
|
+
};
|
package/dist/obs.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a MobX observable expression into a SolidJS signal accessor.
|
|
4
|
+
*
|
|
5
|
+
* [**Documentation**](https://js2me.github.io/mobx-solid/api/obs)
|
|
6
|
+
*/
|
|
7
|
+
export declare function obs<T>(getter: () => T): Accessor<T>;
|
|
8
|
+
//# sourceMappingURL=obs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"obs.d.ts","sourceRoot":"","sources":["../src/obs.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAYnD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mobx-solid",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "MobX bindings for SolidJS — reactive state management with fine-grained UI updates",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"mobx": "^6.0.0",
|
|
25
|
+
"solid-js": "^1.6.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@changesets/changelog-github": "^0.7.0",
|
|
29
|
+
"@changesets/cli": "^2.31.1",
|
|
30
|
+
"@solidjs/testing-library": "^0.8.10",
|
|
31
|
+
"@testing-library/dom": "^10.4.1",
|
|
32
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
33
|
+
"docusite": "^0.1.6",
|
|
34
|
+
"jsdom": "^26.1.0",
|
|
35
|
+
"mobx": "^6.16.0",
|
|
36
|
+
"solid-js": "^1.9.0",
|
|
37
|
+
"typescript": "^5.8.0",
|
|
38
|
+
"vite": "^6.3.0",
|
|
39
|
+
"vite-plugin-dts": "^4.5.0",
|
|
40
|
+
"vite-plugin-solid": "^2.11.0",
|
|
41
|
+
"vitest": "^3.2.0"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"mobx",
|
|
45
|
+
"solid",
|
|
46
|
+
"solidjs",
|
|
47
|
+
"reactive",
|
|
48
|
+
"state-management",
|
|
49
|
+
"observer",
|
|
50
|
+
"fine-grained"
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"homepage": "https://js2me.github.io/mobx-solid",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://github.com/js2me/mobx-solid"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"dev": "vitest watch",
|
|
60
|
+
"playground:csr-only": "vite --config playgrounds/csr-only/vite.config.ts",
|
|
61
|
+
"playground:with-ssr": "vite --config playgrounds/with-ssr/vite.config.ts",
|
|
62
|
+
"build": "vite build",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"test:watch": "vitest watch",
|
|
65
|
+
"test:coverage": "vitest run --coverage",
|
|
66
|
+
"ts:check": "tsc --noEmit -p tsconfig.build.json",
|
|
67
|
+
"check": "pnpm run ts:check && pnpm run test",
|
|
68
|
+
"docs:dev": "docusite dev",
|
|
69
|
+
"docs:build": "docusite build",
|
|
70
|
+
"docs:preview": "docusite preview",
|
|
71
|
+
"changeset:version": "bash scripts/changeset-version.sh",
|
|
72
|
+
"pub": "pnpm build && changeset publish"
|
|
73
|
+
}
|
|
74
|
+
}
|