@gears-frontx/react 0.2.0-alpha.5 → 0.2.0-alpha.7
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/CLAUDE.md +30 -2
- package/dist/index.cjs +19 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -17
- package/dist/index.d.ts +79 -17
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/llms.txt +21 -1
- package/package.json +18 -12
package/llms.txt
CHANGED
|
@@ -26,7 +26,7 @@ Part of the FrontX React Layer (L3) - depends on @gears-frontx/framework. Peer d
|
|
|
26
26
|
| Hook | Purpose |
|
|
27
27
|
|------|---------|
|
|
28
28
|
| `useMfeBridge()` | Access MFE bridge (child MFEs) |
|
|
29
|
-
| `useSharedProperty()` | Subscribe to shared property changes |
|
|
29
|
+
| `useSharedProperty()` | Subscribe to shared property changes, via `MfeContext` or an explicit `bridge` option |
|
|
30
30
|
| `useHostAction()` | Invoke actions on host application |
|
|
31
31
|
| `useDomainExtensions()` | Subscribe to extensions in a domain |
|
|
32
32
|
|
|
@@ -97,6 +97,26 @@ function MyExtension() {
|
|
|
97
97
|
}
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
### Shared Properties Without MfeProvider
|
|
101
|
+
|
|
102
|
+
`useSharedProperty(propertyTypeId, options)` takes an explicit `bridge` for components that never mount `MfeProvider`, plus a `fallback` returned until the host publishes the property (only `undefined` is substituted; a published `null` is a value). With `fallback` set the result type is `T`. There is no consumer-side validation option: the host validates published values against the property's schema before delivery, so `T` is the caller's declaration of that schema.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { useSharedProperty } from '@gears-frontx/react';
|
|
106
|
+
import type { ChildMfeBridge } from '@gears-frontx/framework';
|
|
107
|
+
|
|
108
|
+
function StandaloneComponent({ bridge }: { bridge: ChildMfeBridge }) {
|
|
109
|
+
const label = useSharedProperty<string>(LABEL_PROPERTY_ID, {
|
|
110
|
+
bridge,
|
|
111
|
+
fallback: 'Untitled',
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return <span>{label}</span>;
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Omitting `bridge` falls back to `MfeContext`; the hook still throws when neither is available. Changing `bridge` or `propertyTypeId` moves the subscription and the value follows on the same render.
|
|
119
|
+
|
|
100
120
|
### Subscribing to Domain Extensions
|
|
101
121
|
|
|
102
122
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gears-frontx/react",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.7",
|
|
4
4
|
"description": "React bindings and hooks for FrontX framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -37,25 +37,28 @@
|
|
|
37
37
|
"test:unit:watch": "vitest --watch"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@reduxjs/toolkit": "
|
|
41
|
-
"@tanstack/react-query": "
|
|
40
|
+
"@reduxjs/toolkit": "2.12.0",
|
|
41
|
+
"@tanstack/react-query": "5.101.4",
|
|
42
42
|
"@testing-library/react": "16.3.2",
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/react
|
|
43
|
+
"@types/node": "^24.0.0",
|
|
44
|
+
"@types/react": "19.2.18",
|
|
45
|
+
"@types/react-redux": "7.1.34",
|
|
45
46
|
"@vitejs/plugin-react": "4.3.4",
|
|
46
47
|
"@vitest/coverage-v8": "4.1.4",
|
|
47
48
|
"jsdom": "26.1.0",
|
|
48
|
-
"react": "
|
|
49
|
-
"react-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
49
|
+
"react": "19.2.4",
|
|
50
|
+
"react-dom": "19.2.4",
|
|
51
|
+
"react-redux": "9.3.0",
|
|
52
|
+
"tsup": "8.5.1",
|
|
53
|
+
"typescript": "5.9.3",
|
|
52
54
|
"vitest": "4.1.4"
|
|
53
55
|
},
|
|
54
56
|
"peerDependencies": {
|
|
55
57
|
"@gears-frontx/framework": "*",
|
|
56
|
-
"@tanstack/react-query": "
|
|
57
|
-
"react": "
|
|
58
|
-
"react-
|
|
58
|
+
"@tanstack/react-query": "5.101.4",
|
|
59
|
+
"react": "19.2.4",
|
|
60
|
+
"react-dom": "19.2.4",
|
|
61
|
+
"react-redux": "9.3.0"
|
|
59
62
|
},
|
|
60
63
|
"peerDependenciesMeta": {
|
|
61
64
|
"@gears-frontx/framework": {
|
|
@@ -64,6 +67,9 @@
|
|
|
64
67
|
"react": {
|
|
65
68
|
"optional": false
|
|
66
69
|
},
|
|
70
|
+
"react-dom": {
|
|
71
|
+
"optional": false
|
|
72
|
+
},
|
|
67
73
|
"react-redux": {
|
|
68
74
|
"optional": false
|
|
69
75
|
},
|