@soverius-ai/browser-models-react 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +8 -2
- package/index.d.ts +6 -0
- package/index.js +1 -0
- package/lib/use-model-store.d.ts +14 -0
- package/package.json +29 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 soverius-ai contributors
|
|
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
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @soverius-ai/browser-models-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React package for [@soverius-ai/browser-models](https://www.npmjs.com/package/@soverius-ai/browser-models): `useModelStore()`, `useDevtools()`.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @soverius-ai/browser-models @soverius-ai/browser-models-react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
[React docs](https://browser-models.soverius.ai/docs/react) · [Playground](https://browser-models.soverius.ai/playground?platform=react) · by [Soverius AI](https://soverius.ai) · MIT
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as t,useSyncExternalStore as r}from"react";function s(e){return r(e.subscribe,e.getState,e.getState)}function u(e,o=!0){t(()=>o?e.connectDevtools():void 0,[e,o])}export{u as useDevtools,s as useModelStore};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ModelState, ModelStore } from '@soverius-ai/browser-models';
|
|
2
|
+
import type { BrowserModelsAgent } from '@soverius-ai/browser-models-agui';
|
|
3
|
+
/**
|
|
4
|
+
* The state of a model store as React state. The component re-renders on every change.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const models = new ModelStore(agent); // once, outside components
|
|
8
|
+
* const { availability, progress } = useModelStore(models);
|
|
9
|
+
* <button onClick={() => models.download()}>Download</button>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function useModelStore(store: ModelStore): ModelState;
|
|
13
|
+
/** Sends the agent's events to the soverius debugger while the component is mounted. */
|
|
14
|
+
export declare function useDevtools(agent: Pick<BrowserModelsAgent, 'connectDevtools'>, enabled?: boolean): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soverius-ai/browser-models-react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"types": "./index.d.ts",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"import": "./index.js",
|
|
9
|
+
"default": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://browser-models.soverius.ai",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"description": "React hooks for @soverius-ai/browser-models-agui: model state and debugger wiring.",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": "^19.0.0",
|
|
20
|
+
"@soverius-ai/browser-models": "0.2.0",
|
|
21
|
+
"@soverius-ai/browser-models-agui": "0.2.0"
|
|
22
|
+
},
|
|
23
|
+
"module": "./index.js",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/Soverius-AI/browser-models.git",
|
|
27
|
+
"directory": "libs/frameworks/react"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
}
|
|
6
32
|
}
|