@quantajs/react 2.0.0-beta.1 → 2.0.0-beta.11

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/package.json CHANGED
@@ -1,61 +1,63 @@
1
1
  {
2
- "name": "@quantajs/react",
3
- "private": false,
4
- "author": {
5
- "name": "Jeel Gajera",
6
- "url": "https://github.com/JeelGajera"
7
- },
8
- "description": "React integration for QuantaJS - A compact, scalable, and developer-friendly state management library for React applications.",
9
- "keywords": [
10
- "quantajs",
11
- "quanta",
12
- "state-management",
13
- "reactivity",
14
- "react",
15
- "hooks"
16
- ],
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/quanta-js/quanta.git"
20
- },
21
- "bugs": {
22
- "url": "https://github.com/quanta-js/quanta/issues"
23
- },
24
- "homepage": "https://quantajs.com",
25
- "version": "2.0.0-beta.1",
26
- "type": "module",
27
- "license": "MIT",
28
- "main": "./dist/index.js",
29
- "module": "./dist/index.js",
30
- "types": "./dist/index.d.ts",
31
- "exports": {
32
- ".": {
33
- "types": "./dist/index.d.ts",
34
- "import": "./dist/index.js",
35
- "require": "./dist/index.cjs"
2
+ "name": "@quantajs/react",
3
+ "private": false,
4
+ "author": {
5
+ "name": "Jeel Gajera",
6
+ "url": "https://github.com/JeelGajera"
7
+ },
8
+ "description": "React integration for QuantaJS - A compact, scalable, and developer-friendly state management library for React applications.",
9
+ "keywords": [
10
+ "quantajs",
11
+ "quanta",
12
+ "state-management",
13
+ "reactivity",
14
+ "react",
15
+ "hooks"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/quanta-js/quanta.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/quanta-js/quanta/issues"
23
+ },
24
+ "homepage": "https://quantajs.com",
25
+ "version": "2.0.0-beta.11",
26
+ "type": "module",
27
+ "license": "MIT",
28
+ "scripts": {
29
+ "test:types": "tsc --noEmit",
30
+ "dev": "npm run format && npm run lint:fix && npm run build",
31
+ "build": "npm run clean && vite build",
32
+ "preview": "vite preview",
33
+ "clean": "rimraf dist",
34
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
35
+ "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
36
+ "format": "prettier --write \"src/**/*.{ts,tsx}\""
37
+ },
38
+ "main": "./dist/index.js",
39
+ "module": "./dist/index.js",
40
+ "types": "./dist/index.d.ts",
41
+ "exports": {
42
+ ".": {
43
+ "types": "./dist/index.d.ts",
44
+ "import": "./dist/index.js",
45
+ "require": "./dist/index.cjs"
46
+ }
47
+ },
48
+ "files": [
49
+ "dist"
50
+ ],
51
+ "sideEffects": false,
52
+ "peerDependencies": {
53
+ "react": ">=16.8.0"
54
+ },
55
+ "dependencies": {
56
+ "@quantajs/core": "workspace:*",
57
+ "@quantajs/devtools": "workspace:*"
58
+ },
59
+ "devDependencies": {
60
+ "@types/react": "^19.2.14",
61
+ "react": "^19.2.4"
36
62
  }
37
- },
38
- "files": [
39
- "dist"
40
- ],
41
- "sideEffects": false,
42
- "peerDependencies": {
43
- "react": ">=16.8.0"
44
- },
45
- "dependencies": {
46
- "@quantajs/core": "2.0.0-beta.1"
47
- },
48
- "devDependencies": {
49
- "@types/react": "^18.3.12",
50
- "react": "^18.3.1"
51
- },
52
- "scripts": {
53
- "dev": "npm run format && npm run lint:fix && npm run build",
54
- "build": "npm run clean && vite build",
55
- "preview": "vite preview",
56
- "clean": "rimraf dist",
57
- "lint": "eslint \"src/**/*.{ts,tsx}\"",
58
- "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
59
- "format": "prettier --write \"src/**/*.{ts,tsx}\""
60
- }
61
63
  }
package/readme.md CHANGED
@@ -1,133 +1,142 @@
1
- # @quantajs/react
2
-
3
- ![Logo](https://raw.githubusercontent.com/quanta-js/quanta/master/assets/quantajs_banner.png)
4
-
5
- React integration for QuantaJS - A compact, scalable, and developer-friendly state management library for React applications.
6
-
7
- ## 🚀 Features
8
-
9
- **React Optimized** – Built specifically for React applications
10
- ✅ **Performance First** – Uses `useSyncExternalStore` for efficient updates
11
- ✅ **Type-Safe** – Full TypeScript support with proper inference
12
- ✅ **Flexible** – Multiple usage patterns (Provider, Direct, Selectors)
13
- ✅ **QuantaJS Core** – Direct access to reactive, computed, and watch
14
-
15
- ## 📦 Installation
16
-
17
- ```sh
18
- npm install @quantajs/react @quantajs/core
19
- # or
20
- yarn add @quantajs/react @quantajs/core
21
- # or
22
- pnpm add @quantajs/react @quantajs/core
23
- ```
24
-
25
- ## ⚡ Quick Start
26
-
27
- ### Basic Counter Example
28
-
29
- ```tsx
30
- import React from 'react';
31
- import { createStore, QuantaProvider, useStore } from '@quantajs/react';
32
-
33
- // Create store
34
- const counterStore = createStore('counter', {
35
- state: () => ({ count: 0 }),
36
- getters: {
37
- doubleCount: (state) => state.count * 2
38
- },
39
- actions: {
40
- increment() { this.count++; },
41
- decrement() { this.count--; }
42
- }
43
- });
44
-
45
- // Component
46
- function Counter() {
47
- const store = useStore();
48
-
49
- return (
50
- <div>
51
- <p>Count: {store.count}</p>
52
- <p>Double: {store.doubleCount}</p>
53
- <button onClick={() => store.increment()}>+</button>
54
- <button onClick={() => store.decrement()}>-</button>
55
- </div>
56
- );
57
- }
58
-
59
- // App
60
- function App() {
61
- return (
62
- <QuantaProvider store={counterStore}>
63
- <Counter />
64
- </QuantaProvider>
65
- );
66
- }
67
- ```
68
-
69
- ### With Selectors (Performance)
70
-
71
- ```tsx
72
- import { useQuantaStore } from '@quantajs/react';
73
-
74
- function CounterDisplay() {
75
- // Only re-render when count changes
76
- const count = useQuantaStore(counterStore, store => store.count);
77
-
78
- return <p>Count: {count}</p>;
79
- }
80
- ```
81
-
82
- ### Component-Scoped Store
83
-
84
- ```tsx
85
- import { useCreateStore } from '@quantajs/react';
86
-
87
- function TodoComponent() {
88
- const todoStore = useCreateStore(
89
- 'todos',
90
- () => ({ todos: [] }),
91
- undefined,
92
- {
93
- addTodo(text: string) {
94
- this.todos.push({ id: Date.now(), text, done: false });
95
- }
96
- }
97
- );
98
-
99
- return (
100
- <div>
101
- <button onClick={() => todoStore.addTodo('New task')}>
102
- Add Todo
103
- </button>
104
- <p>Todos: {todoStore.todos.length}</p>
105
- </div>
106
- );
107
- }
108
- ```
109
-
110
- ## 🔧 API
111
-
112
- ### Hooks
113
- - `useQuantaStore(store, selector?)` - Subscribe to store with optional selector
114
- - `useStore(selector?)` - Access store from QuantaProvider context
115
- - `useCreateStore(name, state, getters?, actions?)` - Create component-scoped store
116
-
117
- ### Components
118
- - `<QuantaProvider store={store}>` - Provide store to child components
119
-
120
- ### Core Features
121
- - `createStore`, `reactive`, `computed`, `watch` - Re-exported from @quantajs/core
122
-
123
- ## 📜 License
124
-
125
- This project is licensed under the MIT [License](https://github.com/quanta-js/quanta/blob/main/LICENSE) - see the LICENSE file for details.
126
-
127
- ## 💬 Contributing
128
-
129
- We welcome contributions! Feel free to open issues, submit PRs, or suggest improvements.
130
-
131
- ## ⭐ Support
132
-
133
- If you find this library useful, consider giving it a ⭐ star on [GitHub](https://github.com/quanta-js/quanta)!
1
+ # @quantajs/react
2
+
3
+ ![Logo](https://raw.githubusercontent.com/quanta-js/quanta/master/assets/quantajs_banner.png)
4
+
5
+ [![CI](https://github.com/quanta-js/quanta/actions/workflows/ci.yml/badge.svg)](https://github.com/quanta-js/quanta/actions/workflows/ci.yml)
6
+
7
+ React integration for QuantaJS - A compact, scalable, and developer-friendly state management library for React applications.
8
+
9
+ ## 🚀 Features
10
+
11
+ ✅ **React Optimized** – Built specifically for React applications
12
+ ✅ **Performance First** – Uses `useSyncExternalStore` for efficient updates
13
+ ✅ **Type-Safe** – Full TypeScript support with proper inference
14
+ ✅ **Flexible** – Multiple usage patterns (Provider, Direct, Selectors)
15
+ **QuantaJS Core** – Direct access to reactive, computed, and watch
16
+
17
+ ## 📦 Installation
18
+
19
+ ```sh
20
+ npm install @quantajs/react @quantajs/core
21
+ # or
22
+ yarn add @quantajs/react @quantajs/core
23
+ # or
24
+ pnpm add @quantajs/react @quantajs/core
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ### Basic Counter Example
30
+
31
+ ```tsx
32
+ import React from 'react';
33
+ import { createStore, QuantaProvider, useStore } from '@quantajs/react';
34
+
35
+ // Create store
36
+ const counterStore = createStore('counter', {
37
+ state: () => ({ count: 0 }),
38
+ getters: {
39
+ doubleCount: (state) => state.count * 2,
40
+ },
41
+ actions: {
42
+ increment() {
43
+ this.count++;
44
+ },
45
+ decrement() {
46
+ this.count--;
47
+ },
48
+ },
49
+ });
50
+
51
+ // Component
52
+ function Counter() {
53
+ const store = useStore();
54
+
55
+ return (
56
+ <div>
57
+ <p>Count: {store.count}</p>
58
+ <p>Double: {store.doubleCount}</p>
59
+ <button onClick={() => store.increment()}>+</button>
60
+ <button onClick={() => store.decrement()}>-</button>
61
+ </div>
62
+ );
63
+ }
64
+
65
+ // App
66
+ function App() {
67
+ return (
68
+ <QuantaProvider store={counterStore}>
69
+ <Counter />
70
+ </QuantaProvider>
71
+ );
72
+ }
73
+ ```
74
+
75
+ ### With Selectors (Performance)
76
+
77
+ ```tsx
78
+ import { useQuantaStore } from '@quantajs/react';
79
+
80
+ function CounterDisplay() {
81
+ // Only re-render when count changes
82
+ const count = useQuantaStore(counterStore, (store) => store.count);
83
+
84
+ return <p>Count: {count}</p>;
85
+ }
86
+ ```
87
+
88
+ ### Component-Scoped Store
89
+
90
+ ```tsx
91
+ import { useCreateStore } from '@quantajs/react';
92
+
93
+ function TodoComponent() {
94
+ const todoStore = useCreateStore(
95
+ 'todos',
96
+ () => ({ todos: [] }),
97
+ undefined,
98
+ {
99
+ addTodo(text: string) {
100
+ this.todos.push({ id: Date.now(), text, done: false });
101
+ },
102
+ },
103
+ );
104
+
105
+ return (
106
+ <div>
107
+ <button onClick={() => todoStore.addTodo('New task')}>
108
+ Add Todo
109
+ </button>
110
+ <p>Todos: {todoStore.todos.length}</p>
111
+ </div>
112
+ );
113
+ }
114
+ ```
115
+
116
+ ## 🔧 API
117
+
118
+ ### Hooks
119
+
120
+ - `useQuantaStore(store, selector?)` - Subscribe to store with optional selector
121
+ - `useStore(selector?)` - Access store from QuantaProvider context
122
+ - `useCreateStore(name, state, getters?, actions?)` - Create component-scoped store
123
+
124
+ ### Components
125
+
126
+ - `<QuantaProvider store={store}>` - Provide store to child components
127
+
128
+ ### Core Features
129
+
130
+ - `createStore`, `reactive`, `computed`, `watch` - Re-exported from @quantajs/core
131
+
132
+ ## 📜 License
133
+
134
+ This project is licensed under the MIT [License](https://github.com/quanta-js/quanta/blob/main/LICENSE) - see the LICENSE file for details.
135
+
136
+ ## 💬 Contributing
137
+
138
+ We welcome contributions! Feel free to open issues, submit PRs, or suggest improvements.
139
+
140
+ ## ⭐ Support
141
+
142
+ If you find this library useful, consider giving it a ⭐ star on [GitHub](https://github.com/quanta-js/quanta)!
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 QuantaJS
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.