@mmapp/react 0.1.0-alpha.1 → 0.1.0-alpha.4
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 +112 -0
- package/dist/index.d.mts +1378 -94
- package/dist/index.d.ts +1378 -94
- package/dist/index.js +1094 -1309
- package/dist/index.mjs +1038 -1296
- package/package.json +4 -3
- package/package.json.backup +0 -41
- package/src/Blueprint.ts +0 -216
- package/src/__tests__/Blueprint.test.ts +0 -106
- package/src/__tests__/action-context.test.ts +0 -166
- package/src/__tests__/actionCreators.test.ts +0 -179
- package/src/__tests__/builders.test.ts +0 -336
- package/src/__tests__/defineBlueprint-composition.test.ts +0 -106
- package/src/__tests__/factories.test.ts +0 -229
- package/src/__tests__/loader.test.ts +0 -159
- package/src/__tests__/logger.test.ts +0 -70
- package/src/__tests__/type-inference.test.ts +0 -160
- package/src/__tests__/typed-transitions.test.ts +0 -126
- package/src/__tests__/useModuleConfig.test.ts +0 -61
- package/src/actionCreators.ts +0 -132
- package/src/actions.ts +0 -547
- package/src/atoms/index.ts +0 -600
- package/src/authoring.ts +0 -92
- package/src/browser-player.ts +0 -783
- package/src/builders.ts +0 -1342
- package/src/components/ExperienceWorkflowBridge.tsx +0 -123
- package/src/components/PlayerProvider.tsx +0 -43
- package/src/components/atoms/index.tsx +0 -269
- package/src/components/index.ts +0 -36
- package/src/conditions.ts +0 -692
- package/src/config/defineBlueprint.ts +0 -329
- package/src/config/defineModel.ts +0 -753
- package/src/config/defineWorkspace.ts +0 -24
- package/src/core/WorkflowRuntime.ts +0 -153
- package/src/factories.ts +0 -425
- package/src/grammar/index.ts +0 -173
- package/src/hooks/index.ts +0 -106
- package/src/hooks/useAuth.ts +0 -288
- package/src/hooks/useChannel.ts +0 -304
- package/src/hooks/useComputed.ts +0 -154
- package/src/hooks/useDomainSubscription.ts +0 -110
- package/src/hooks/useDuringAction.ts +0 -99
- package/src/hooks/useExperienceState.ts +0 -59
- package/src/hooks/useExpressionLibrary.ts +0 -129
- package/src/hooks/useForm.ts +0 -352
- package/src/hooks/useGeolocation.ts +0 -207
- package/src/hooks/useMapView.ts +0 -259
- package/src/hooks/useMiddleware.ts +0 -291
- package/src/hooks/useModel.ts +0 -363
- package/src/hooks/useModule.ts +0 -59
- package/src/hooks/useModuleConfig.ts +0 -61
- package/src/hooks/useMutation.ts +0 -237
- package/src/hooks/useNotification.ts +0 -151
- package/src/hooks/useOnChange.ts +0 -30
- package/src/hooks/useOnEnter.ts +0 -59
- package/src/hooks/useOnEvent.ts +0 -37
- package/src/hooks/useOnExit.ts +0 -27
- package/src/hooks/useOnTransition.ts +0 -30
- package/src/hooks/usePackage.ts +0 -128
- package/src/hooks/useParams.ts +0 -33
- package/src/hooks/usePlayer.ts +0 -308
- package/src/hooks/useQuery.ts +0 -184
- package/src/hooks/useRealtimeQuery.ts +0 -222
- package/src/hooks/useRole.ts +0 -191
- package/src/hooks/useRouteParams.ts +0 -100
- package/src/hooks/useRouter.ts +0 -347
- package/src/hooks/useServerAction.ts +0 -178
- package/src/hooks/useServerState.ts +0 -284
- package/src/hooks/useToast.ts +0 -164
- package/src/hooks/useTransition.ts +0 -39
- package/src/hooks/useView.ts +0 -102
- package/src/hooks/useWhileIn.ts +0 -48
- package/src/hooks/useWorkflow.ts +0 -63
- package/src/index.ts +0 -465
- package/src/loader/experience-workflow-loader.ts +0 -192
- package/src/loader/index.ts +0 -6
- package/src/local/LocalEngine.ts +0 -388
- package/src/local/LocalEngineAdapter.ts +0 -175
- package/src/local/LocalEngineContext.ts +0 -30
- package/src/logger.ts +0 -37
- package/src/mixins.ts +0 -1160
- package/src/providers/RuntimeContext.ts +0 -20
- package/src/providers/WorkflowProvider.tsx +0 -28
- package/src/routing/instance-key.ts +0 -107
- package/src/server/transition-context.ts +0 -172
- package/src/testing/index.ts +0 -9
- package/src/testing/useBlueprintTestRunner.ts +0 -91
- package/src/testing/useGraphAnalysis.ts +0 -18
- package/src/testing/useTestRunner.ts +0 -77
- package/src/testing.ts +0 -995
- package/src/types/workflow-inference.ts +0 -158
- package/src/types.ts +0 -114
- package/tsconfig.json +0 -27
- package/vitest.config.ts +0 -8
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# @mmapp/react
|
|
2
|
+
|
|
3
|
+
React hooks, components, and runtime bridge for building MindMatrix workflow applications.
|
|
4
|
+
|
|
5
|
+
Published on npm as `@mmapp/react` (internal workspace name: `@mindmatrix/react`).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @mmapp/react @mmapp/player-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Hooks
|
|
14
|
+
|
|
15
|
+
| Hook | Purpose |
|
|
16
|
+
|------|---------|
|
|
17
|
+
| `useQuery(slug)` | Fetch workflow instances by slug |
|
|
18
|
+
| `useMutation(slug)` | Create, update, transition workflow instances |
|
|
19
|
+
| `usePlayer(definition)` | Run a state machine in the browser |
|
|
20
|
+
| `useRouter()` | Blueprint-aware navigation |
|
|
21
|
+
| `useAuth()` | Authentication state |
|
|
22
|
+
| `useToast()` | Toast notifications |
|
|
23
|
+
| `useForm(fields)` | Form state management with validation |
|
|
24
|
+
| `useChannel(name)` | Real-time WebSocket channels |
|
|
25
|
+
| `useRole(slug)` | Role-based access control |
|
|
26
|
+
| `useComputed(expr)` | Computed field evaluation |
|
|
27
|
+
| `useModel(definition)` | Type-safe model access |
|
|
28
|
+
| `useModule(slug)` | Module configuration |
|
|
29
|
+
| `useServerAction(name)` | Server-side action execution |
|
|
30
|
+
| `useServerState(slug)` | Server-synced state |
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
### defineBlueprint
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { defineBlueprint } from '@mmapp/react';
|
|
38
|
+
|
|
39
|
+
export default defineBlueprint({
|
|
40
|
+
slug: 'my-app',
|
|
41
|
+
name: 'My App',
|
|
42
|
+
version: '1.0.0',
|
|
43
|
+
models: [employeeModel, departmentModel],
|
|
44
|
+
views: {
|
|
45
|
+
'/': HomePage,
|
|
46
|
+
'/employees': EmployeeList,
|
|
47
|
+
'/employees/:id': EmployeeDetail,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### defineModel
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { defineModel } from '@mmapp/react';
|
|
56
|
+
|
|
57
|
+
export default defineModel({
|
|
58
|
+
slug: 'employee',
|
|
59
|
+
fields: {
|
|
60
|
+
name: { type: 'string', required: true },
|
|
61
|
+
salary: { type: 'number', default: 0 },
|
|
62
|
+
department: { type: 'string' },
|
|
63
|
+
},
|
|
64
|
+
states: {
|
|
65
|
+
active: { type: 'initial' },
|
|
66
|
+
terminated: { type: 'terminal' },
|
|
67
|
+
},
|
|
68
|
+
transitions: {
|
|
69
|
+
terminate: { from: ['active'], to: 'terminated' },
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Atoms
|
|
75
|
+
|
|
76
|
+
Pre-built UI components available via `@mmapp/react/atoms`:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { Box, Text, Button, Input, Select, Modal, Card } from '@mmapp/react/atoms';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## npm Publishing
|
|
83
|
+
|
|
84
|
+
This package is published to npm under the `@mmapp` scope.
|
|
85
|
+
|
|
86
|
+
| npm name | workspace name | current version |
|
|
87
|
+
|----------|---------------|-----------------|
|
|
88
|
+
| `@mmapp/react` | `@mindmatrix/react` | 0.1.0-alpha.1 |
|
|
89
|
+
|
|
90
|
+
### Publishing a new version
|
|
91
|
+
|
|
92
|
+
Use the publish script from the monorepo root:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Publish all 3 packages (player-core, react, react-compiler)
|
|
96
|
+
./scripts/publish-npm.sh patch # 0.1.0-alpha.1 → 0.1.0-alpha.2
|
|
97
|
+
./scripts/publish-npm.sh minor # 0.1.0-alpha.1 → 0.2.0-alpha.1
|
|
98
|
+
./scripts/publish-npm.sh 0.2.0-beta.1 # explicit version
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or publish just this package:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cd packages/react
|
|
105
|
+
pnpm run publish:alpha # auto-increments alpha version
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Version strategy
|
|
109
|
+
|
|
110
|
+
- `0.1.0-alpha.X` — internal development (current)
|
|
111
|
+
- `0.1.0-beta.X` — user testing
|
|
112
|
+
- `1.0.0` — production launch
|