@phreshos/react 0.1.19 → 0.1.20
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 +35 -48
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Runtime-neutral React adapters for PhreshOS contracts.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
[Documentation](https://docs.phreshos.com/sdks/react) ·
|
|
6
|
+
[Runtime model](https://docs.phreshos.com/runtime) ·
|
|
7
|
+
[Source](https://github.com/PhreshOS/react)
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
|
|
11
|
+
The React SDK adapts explicitly supplied Core contracts and live sources to
|
|
12
|
+
React providers and hooks. It does not initialize a transport, import the
|
|
13
|
+
Client SDK, access the browser, define domain state, or render visual language.
|
|
14
|
+
|
|
15
|
+
`SystemProvider`, `ContextProvider`, and `DesktopProvider` preserve the
|
|
16
|
+
separation between the global System, current Client Context, and containing
|
|
17
|
+
Desktop. State and subscription hooks preserve unresolved state and own only
|
|
18
|
+
their React lifecycle.
|
|
8
19
|
|
|
9
20
|
## Installation
|
|
10
21
|
|
|
@@ -17,54 +28,22 @@ domain state.
|
|
|
17
28
|
|
|
18
29
|
`@phreshos/core` and React are peer dependencies.
|
|
19
30
|
|
|
20
|
-
## Providers
|
|
21
|
-
|
|
22
31
|
```tsx
|
|
23
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
ContextProvider,
|
|
34
|
+
DesktopProvider,
|
|
35
|
+
SystemProvider,
|
|
36
|
+
} from "@phreshos/react"
|
|
24
37
|
|
|
25
38
|
<SystemProvider system={system}>
|
|
26
39
|
<DesktopProvider desktop={desktop}>
|
|
27
|
-
<ContextProvider context={context}>
|
|
28
|
-
{children}
|
|
29
|
-
</ContextProvider>
|
|
40
|
+
<ContextProvider context={context}>{children}</ContextProvider>
|
|
30
41
|
</DesktopProvider>
|
|
31
42
|
</SystemProvider>
|
|
32
43
|
```
|
|
33
44
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Hooks
|
|
38
|
-
|
|
39
|
-
Context hooks expose the supplied handles:
|
|
40
|
-
|
|
41
|
-
- `useContext()`
|
|
42
|
-
- `useProgram()`
|
|
43
|
-
- `useProcess()`
|
|
44
|
-
- `useParent()`
|
|
45
|
-
|
|
46
|
-
System hooks expose the System and its live Appearance:
|
|
47
|
-
|
|
48
|
-
- `useSystem()`
|
|
49
|
-
- `useSystemAppearance()`
|
|
50
|
-
|
|
51
|
-
Desktop hooks expose the Desktop and its live state:
|
|
52
|
-
|
|
53
|
-
- `useDesktop()`
|
|
54
|
-
- `useDesktopSurface()`
|
|
55
|
-
- `useDesktopPreferences()`
|
|
56
|
-
|
|
57
|
-
State hooks compose one explicit read with future events:
|
|
58
|
-
|
|
59
|
-
- `useProgramState()`
|
|
60
|
-
- `useProcessState()`
|
|
61
|
-
- `useEndpointState()`
|
|
62
|
-
- `useServiceState()`
|
|
63
|
-
- `useWindowState()`
|
|
64
|
-
|
|
65
|
-
`useSubscribe()`, `useSubscribeAsks()`, and `useSubscribeAnswers()` own
|
|
66
|
-
their mounted registrations and clean them up on unmount. Unresolved initial
|
|
67
|
-
reads remain `undefined`; the adapters do not invent fallback domain state.
|
|
45
|
+
See [React SDK](https://docs.phreshos.com/sdks/react) for providers, state
|
|
46
|
+
hooks, and subscription hooks.
|
|
68
47
|
|
|
69
48
|
## Development
|
|
70
49
|
|
|
@@ -73,13 +52,21 @@ bun install --frozen-lockfile
|
|
|
73
52
|
bun run verify
|
|
74
53
|
```
|
|
75
54
|
|
|
76
|
-
`verify` checks the contracts, tests the adapters
|
|
77
|
-
|
|
55
|
+
`verify` checks the contracts, tests the adapters, builds the package, and
|
|
56
|
+
validates its published shape.
|
|
57
|
+
|
|
58
|
+
## Related repositories
|
|
78
59
|
|
|
79
|
-
|
|
60
|
+
- [`@phreshos/core`](https://github.com/PhreshOS/core) owns every contract
|
|
61
|
+
accepted by these adapters.
|
|
62
|
+
- [`@phreshos/client`](https://github.com/PhreshOS/client) supplies Client
|
|
63
|
+
runtime values without becoming a dependency of this package.
|
|
64
|
+
- [`@phreshos/react-ui`](https://github.com/PhreshOS/react-ui) owns reusable
|
|
65
|
+
visual components and Appearance interpretation.
|
|
66
|
+
- [PhreshOS System](https://github.com/PhreshOS/system) composes these adapters
|
|
67
|
+
in the Desktop.
|
|
80
68
|
|
|
81
|
-
|
|
82
|
-
runtime SDKs provide the sources, and React UI owns visual components.
|
|
69
|
+
## Contributing
|
|
83
70
|
|
|
84
71
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for the repository workflow and
|
|
85
72
|
[SECURITY.md](SECURITY.md) for private vulnerability reporting.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Runtime-neutral React adapters for PhreshOS contracts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"prepack": "node --run test && node --run build"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@phreshos/core": "^0.1.
|
|
50
|
+
"@phreshos/core": "^0.1.41",
|
|
51
51
|
"react": "^19.2.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@phreshos/core": "^0.1.
|
|
54
|
+
"@phreshos/core": "^0.1.41",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
56
56
|
"@types/react": "^19.2.18",
|
|
57
57
|
"@types/react-dom": "^19.2.4",
|