@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/src/atoms/index.ts
DELETED
|
@@ -1,600 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compile-Time Atom Stubs — markers for the compiler to recognize.
|
|
3
|
-
*
|
|
4
|
-
* These are NOT runtime components — they are compile-time type stubs that
|
|
5
|
-
* the @mindmatrix/react-compiler recognizes in JSX and maps to IRExperienceNode
|
|
6
|
-
* entries. At runtime, the frontend's ComponentTreeRenderer resolves the
|
|
7
|
-
* component name string to the actual registered React component.
|
|
8
|
-
*
|
|
9
|
-
* Usage in .workflow.tsx files:
|
|
10
|
-
* import { Stack, Row, Text, Button, TextInput } from '@mindmatrix/react/atoms';
|
|
11
|
-
*
|
|
12
|
-
* return (
|
|
13
|
-
* <Stack gap={4}>
|
|
14
|
-
* <Text variant="h2">Hello</Text>
|
|
15
|
-
* <Row>
|
|
16
|
-
* <TextInput bind="message" placeholder="Type..." />
|
|
17
|
-
* <Button onClick={send}>Send</Button>
|
|
18
|
-
* </Row>
|
|
19
|
-
* </Stack>
|
|
20
|
-
* );
|
|
21
|
-
*
|
|
22
|
-
* The compiler extracts this JSX into an IRExperienceNode tree.
|
|
23
|
-
* The CTR (ComponentTreeRenderer) renders it at runtime.
|
|
24
|
-
*
|
|
25
|
-
* ALL core atoms + sub-experience components are stubbed here,
|
|
26
|
-
* matching the frontend's component-registry.ts exactly.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import type { FC, ReactNode } from 'react';
|
|
30
|
-
|
|
31
|
-
// =============================================================================
|
|
32
|
-
// Base Props (shared across all atoms)
|
|
33
|
-
// =============================================================================
|
|
34
|
-
|
|
35
|
-
interface BaseAtomProps {
|
|
36
|
-
children?: ReactNode;
|
|
37
|
-
visible_when?: string;
|
|
38
|
-
'data-slot'?: string;
|
|
39
|
-
className?: string;
|
|
40
|
-
/** Style object — maps to CSS properties at runtime. */
|
|
41
|
-
sx?: Record<string, unknown>;
|
|
42
|
-
/** Common layout shortcuts — passed through to the CTR renderer. */
|
|
43
|
-
flex?: number | string;
|
|
44
|
-
width?: number | string;
|
|
45
|
-
height?: number | string;
|
|
46
|
-
minWidth?: number | string;
|
|
47
|
-
minHeight?: number | string;
|
|
48
|
-
maxWidth?: number | string;
|
|
49
|
-
maxHeight?: number | string;
|
|
50
|
-
margin?: number | string;
|
|
51
|
-
marginTop?: number | string;
|
|
52
|
-
marginBottom?: number | string;
|
|
53
|
-
marginLeft?: number | string;
|
|
54
|
-
marginRight?: number | string;
|
|
55
|
-
padding?: number | string;
|
|
56
|
-
paddingTop?: number | string;
|
|
57
|
-
paddingBottom?: number | string;
|
|
58
|
-
paddingLeft?: number | string;
|
|
59
|
-
paddingRight?: number | string;
|
|
60
|
-
overflow?: string;
|
|
61
|
-
border?: string;
|
|
62
|
-
borderTop?: string;
|
|
63
|
-
borderBottom?: string;
|
|
64
|
-
borderLeft?: string;
|
|
65
|
-
borderRight?: string;
|
|
66
|
-
borderRadius?: number | string;
|
|
67
|
-
background?: string;
|
|
68
|
-
position?: string;
|
|
69
|
-
display?: string;
|
|
70
|
-
opacity?: number;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// =============================================================================
|
|
74
|
-
// Layout Atoms
|
|
75
|
-
// =============================================================================
|
|
76
|
-
|
|
77
|
-
interface StackProps extends BaseAtomProps {
|
|
78
|
-
gap?: number | string;
|
|
79
|
-
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
80
|
-
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'space-between' | 'space-around';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
interface RowProps extends BaseAtomProps {
|
|
84
|
-
gap?: number | string;
|
|
85
|
-
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
86
|
-
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'space-between' | 'space-around';
|
|
87
|
-
wrap?: boolean;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface GridProps extends BaseAtomProps {
|
|
91
|
-
columns?: number | string;
|
|
92
|
-
gap?: number | string;
|
|
93
|
-
minChildWidth?: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
interface DividerProps extends BaseAtomProps {
|
|
97
|
-
orientation?: 'horizontal' | 'vertical';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
interface SpacerProps extends BaseAtomProps {
|
|
101
|
-
size?: number | string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// =============================================================================
|
|
105
|
-
// Content Atoms
|
|
106
|
-
// =============================================================================
|
|
107
|
-
|
|
108
|
-
interface TextProps extends BaseAtomProps {
|
|
109
|
-
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'body' | 'caption' | 'code' | 'label' | 'muted';
|
|
110
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
111
|
-
weight?: 'normal' | 'medium' | 'semibold' | 'bold' | string;
|
|
112
|
-
value?: string;
|
|
113
|
-
bind?: string;
|
|
114
|
-
color?: string;
|
|
115
|
-
align?: 'left' | 'center' | 'right';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
interface HeadingProps extends BaseAtomProps {
|
|
119
|
-
level?: 1 | 2 | 3 | 4;
|
|
120
|
-
value?: string;
|
|
121
|
-
weight?: 'normal' | 'medium' | 'semibold' | 'bold' | string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface FieldProps extends BaseAtomProps {
|
|
125
|
-
name?: string;
|
|
126
|
-
bind?: string;
|
|
127
|
-
label?: string;
|
|
128
|
-
editable?: boolean;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
interface ImageProps extends BaseAtomProps {
|
|
132
|
-
src?: string;
|
|
133
|
-
alt?: string;
|
|
134
|
-
width?: number | string;
|
|
135
|
-
height?: number | string;
|
|
136
|
-
bind?: string;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface BadgeProps extends BaseAtomProps {
|
|
140
|
-
value?: string;
|
|
141
|
-
variant?: 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
142
|
-
bind?: string;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// =============================================================================
|
|
146
|
-
// Action Atoms
|
|
147
|
-
// =============================================================================
|
|
148
|
-
|
|
149
|
-
interface ButtonProps extends BaseAtomProps {
|
|
150
|
-
variant?: 'default' | 'primary' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link';
|
|
151
|
-
size?: 'sm' | 'md' | 'lg' | 'icon';
|
|
152
|
-
disabled?: boolean;
|
|
153
|
-
loading?: boolean;
|
|
154
|
-
onClick?: (() => void) | string;
|
|
155
|
-
onPress?: (() => void) | string;
|
|
156
|
-
label?: string;
|
|
157
|
-
icon?: string;
|
|
158
|
-
fullWidth?: boolean;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface LinkProps extends BaseAtomProps {
|
|
162
|
-
href?: string;
|
|
163
|
-
to?: string;
|
|
164
|
-
target?: '_blank' | '_self';
|
|
165
|
-
bind?: string;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// =============================================================================
|
|
169
|
-
// Control Flow Atoms
|
|
170
|
-
// =============================================================================
|
|
171
|
-
|
|
172
|
-
interface ShowProps extends BaseAtomProps {
|
|
173
|
-
when?: unknown;
|
|
174
|
-
fallback?: ReactNode;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
interface EachProps<T = unknown> extends BaseAtomProps {
|
|
178
|
-
items?: T[];
|
|
179
|
-
as?: string;
|
|
180
|
-
bind?: string;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// =============================================================================
|
|
184
|
-
// Grouping Atoms
|
|
185
|
-
// =============================================================================
|
|
186
|
-
|
|
187
|
-
interface CardProps extends BaseAtomProps {
|
|
188
|
-
title?: string;
|
|
189
|
-
collapsible?: boolean;
|
|
190
|
-
defaultCollapsed?: boolean;
|
|
191
|
-
onClick?: (() => void) | string;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
interface TabsProps extends BaseAtomProps {
|
|
195
|
-
defaultTab?: string;
|
|
196
|
-
tabs?: Array<{ id: string; label: string }>;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
interface AccordionProps extends BaseAtomProps {
|
|
200
|
-
type?: 'single' | 'multiple';
|
|
201
|
-
defaultValue?: string;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
interface SectionProps extends BaseAtomProps {
|
|
205
|
-
title?: string;
|
|
206
|
-
description?: string;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
interface ModalProps extends BaseAtomProps {
|
|
210
|
-
title?: string;
|
|
211
|
-
open?: boolean;
|
|
212
|
-
onClose?: (() => void) | string;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// =============================================================================
|
|
216
|
-
// Input Atoms
|
|
217
|
-
// =============================================================================
|
|
218
|
-
|
|
219
|
-
interface TextInputProps extends BaseAtomProps {
|
|
220
|
-
bind?: string;
|
|
221
|
-
value?: string;
|
|
222
|
-
onChange?: ((value: string) => void) | string;
|
|
223
|
-
placeholder?: string;
|
|
224
|
-
label?: string;
|
|
225
|
-
multiline?: boolean;
|
|
226
|
-
rows?: number;
|
|
227
|
-
maxLength?: number;
|
|
228
|
-
submitOnEnter?: boolean;
|
|
229
|
-
onSubmit?: (() => void) | string;
|
|
230
|
-
disabled?: boolean;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
interface SelectProps extends BaseAtomProps {
|
|
234
|
-
bind?: string;
|
|
235
|
-
value?: string;
|
|
236
|
-
onChange?: ((value: string) => void) | string;
|
|
237
|
-
options?: Array<{ value: string; label: string }> | string[];
|
|
238
|
-
placeholder?: string;
|
|
239
|
-
label?: string;
|
|
240
|
-
disabled?: boolean;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
interface MarkdownProps extends BaseAtomProps {
|
|
244
|
-
content?: string;
|
|
245
|
-
bind?: string;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
interface ScrollAreaProps extends BaseAtomProps {
|
|
249
|
-
maxHeight?: number | string;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// =============================================================================
|
|
253
|
-
// Creative/Visualization Atoms
|
|
254
|
-
// =============================================================================
|
|
255
|
-
|
|
256
|
-
interface Canvas3DProps extends BaseAtomProps {
|
|
257
|
-
shape?: 'cube' | 'sphere' | 'torus' | 'torusKnot';
|
|
258
|
-
color?: string;
|
|
259
|
-
wireframe?: boolean;
|
|
260
|
-
autoRotate?: boolean;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
interface DataGridProps extends BaseAtomProps {
|
|
264
|
-
bind?: string;
|
|
265
|
-
/** Model definition or slug to query data from. */
|
|
266
|
-
source?: unknown;
|
|
267
|
-
columns?: Array<{ field: string; header: string; editable?: boolean }>;
|
|
268
|
-
/** Filter params for the data query. */
|
|
269
|
-
filters?: Record<string, unknown>;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
interface AnimatedBoxProps extends BaseAtomProps {
|
|
273
|
-
animation?: 'pulse' | 'bounce' | 'spin' | 'slide-in' | 'fade-in' | 'scale-up' | 'glow' | 'shake' | 'flip' | 'morph';
|
|
274
|
-
duration?: number;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
interface ServerGridProps extends BaseAtomProps {
|
|
278
|
-
bind?: string;
|
|
279
|
-
endpoint?: string;
|
|
280
|
-
columns?: Array<{ field: string; header: string; sortable?: boolean }>;
|
|
281
|
-
pageSize?: number;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
interface ChartProps extends BaseAtomProps {
|
|
285
|
-
type?: 'bar' | 'line' | 'area' | 'pie' | 'sparkline';
|
|
286
|
-
bind?: string;
|
|
287
|
-
data?: unknown[];
|
|
288
|
-
xField?: string;
|
|
289
|
-
yField?: string;
|
|
290
|
-
color?: string;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
interface MetricCardProps extends BaseAtomProps {
|
|
294
|
-
value?: number | string;
|
|
295
|
-
label?: string;
|
|
296
|
-
format?: 'currency' | 'number' | 'percentage';
|
|
297
|
-
trend?: 'up' | 'down' | 'flat';
|
|
298
|
-
sparkline?: boolean;
|
|
299
|
-
bind?: string;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// =============================================================================
|
|
303
|
-
// Slot Atom (for blueprint contributions)
|
|
304
|
-
// =============================================================================
|
|
305
|
-
|
|
306
|
-
interface SlotProps extends BaseAtomProps {
|
|
307
|
-
name: string;
|
|
308
|
-
fallback?: ReactNode;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// =============================================================================
|
|
312
|
-
// Module Composition Atoms
|
|
313
|
-
// =============================================================================
|
|
314
|
-
|
|
315
|
-
interface ModuleOutletProps extends BaseAtomProps {
|
|
316
|
-
/** Module slug to render views from. */
|
|
317
|
-
module: string;
|
|
318
|
-
/** Base path for the module's routes within this outlet. */
|
|
319
|
-
basePath?: string;
|
|
320
|
-
/** Fallback content when no module route matches. */
|
|
321
|
-
fallback?: ReactNode;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// =============================================================================
|
|
325
|
-
// Sub-Experience Components
|
|
326
|
-
// =============================================================================
|
|
327
|
-
|
|
328
|
-
interface MetricsGridProps extends BaseAtomProps {
|
|
329
|
-
bind?: string;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
interface AdaptiveCardGridProps extends BaseAtomProps {
|
|
333
|
-
bind?: string;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
interface AdaptiveFiltersProps extends BaseAtomProps {
|
|
337
|
-
bind?: string;
|
|
338
|
-
fields?: string[];
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
interface PaginationProps extends BaseAtomProps {
|
|
342
|
-
bind?: string;
|
|
343
|
-
pageSize?: number;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
interface EntityHeaderProps extends BaseAtomProps {
|
|
347
|
-
bind?: string;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
interface ProgressTrackerProps extends BaseAtomProps {
|
|
351
|
-
bind?: string;
|
|
352
|
-
steps?: string[];
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
interface RatingWidgetProps extends BaseAtomProps {
|
|
356
|
-
bind?: string;
|
|
357
|
-
max?: number;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
interface FieldSectionProps extends BaseAtomProps {
|
|
361
|
-
title?: string;
|
|
362
|
-
fields?: string[];
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
interface TransitionActionsProps extends BaseAtomProps {
|
|
366
|
-
bind?: string;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
interface ChildInstanceListProps extends BaseAtomProps {
|
|
370
|
-
bind?: string;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
interface BreakdownChartsProps extends BaseAtomProps {
|
|
374
|
-
bind?: string;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
interface TabbedLayoutProps extends BaseAtomProps {
|
|
378
|
-
tabs?: Array<{ id: string; label: string }>;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
interface HierarchyBreadcrumbProps extends BaseAtomProps {
|
|
382
|
-
bind?: string;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
interface SearchInputProps extends BaseAtomProps {
|
|
386
|
-
bind?: string;
|
|
387
|
-
placeholder?: string;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
interface SortControlProps extends BaseAtomProps {
|
|
391
|
-
bind?: string;
|
|
392
|
-
fields?: string[];
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
interface AggregateStatsProps extends BaseAtomProps {
|
|
396
|
-
bind?: string;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// =============================================================================
|
|
400
|
-
// Stub factory — creates a compile-time-only component.
|
|
401
|
-
// At runtime these throw; the CTR resolves components by name, not by import.
|
|
402
|
-
// =============================================================================
|
|
403
|
-
|
|
404
|
-
function stub<P>(displayName: string): FC<P> {
|
|
405
|
-
const Component: FC<P> = () => {
|
|
406
|
-
throw new Error(
|
|
407
|
-
`<${displayName}> is a compile-time stub from @mindmatrix/react/atoms. ` +
|
|
408
|
-
`It should only appear in .workflow.tsx files processed by the compiler. ` +
|
|
409
|
-
`At runtime, use the ComponentTreeRenderer which resolves "${displayName}" from the component registry.`
|
|
410
|
-
);
|
|
411
|
-
};
|
|
412
|
-
Component.displayName = displayName;
|
|
413
|
-
return Component;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// =============================================================================
|
|
417
|
-
// Layout
|
|
418
|
-
// =============================================================================
|
|
419
|
-
export const Stack = stub<StackProps>('Stack');
|
|
420
|
-
export const Row = stub<RowProps>('Row');
|
|
421
|
-
export const Column = stub<RowProps>('Column');
|
|
422
|
-
export const Grid = stub<GridProps>('Grid');
|
|
423
|
-
export const Divider = stub<DividerProps>('Divider');
|
|
424
|
-
export const Spacer = stub<SpacerProps>('Spacer');
|
|
425
|
-
|
|
426
|
-
// =============================================================================
|
|
427
|
-
// Content
|
|
428
|
-
// =============================================================================
|
|
429
|
-
export const Text = stub<TextProps>('Text');
|
|
430
|
-
export const Heading = stub<HeadingProps>('Heading');
|
|
431
|
-
export const Field = stub<FieldProps>('Field');
|
|
432
|
-
export const Image = stub<ImageProps>('Image');
|
|
433
|
-
export const Badge = stub<BadgeProps>('Badge');
|
|
434
|
-
export const Icon = stub<BaseAtomProps & { name?: string; size?: number | string; color?: string }>('Icon');
|
|
435
|
-
|
|
436
|
-
// =============================================================================
|
|
437
|
-
// Actions
|
|
438
|
-
// =============================================================================
|
|
439
|
-
export const Button = stub<ButtonProps>('Button');
|
|
440
|
-
export const Link = stub<LinkProps>('Link');
|
|
441
|
-
|
|
442
|
-
// =============================================================================
|
|
443
|
-
// Control Flow
|
|
444
|
-
// =============================================================================
|
|
445
|
-
export const Show = stub<ShowProps>('Show');
|
|
446
|
-
export const Each = stub<EachProps>('Each');
|
|
447
|
-
|
|
448
|
-
// =============================================================================
|
|
449
|
-
// Grouping
|
|
450
|
-
// =============================================================================
|
|
451
|
-
export const Card = stub<CardProps>('Card');
|
|
452
|
-
export const Tabs = stub<TabsProps>('Tabs');
|
|
453
|
-
export const Accordion = stub<AccordionProps>('Accordion');
|
|
454
|
-
export const Section = stub<SectionProps>('Section');
|
|
455
|
-
export const Modal = stub<ModalProps>('Modal');
|
|
456
|
-
|
|
457
|
-
// =============================================================================
|
|
458
|
-
// Input
|
|
459
|
-
// =============================================================================
|
|
460
|
-
export const TextInput = stub<TextInputProps>('TextInput');
|
|
461
|
-
export const Select = stub<SelectProps>('Select');
|
|
462
|
-
export const Markdown = stub<MarkdownProps>('Markdown');
|
|
463
|
-
export const ScrollArea = stub<ScrollAreaProps>('ScrollArea');
|
|
464
|
-
|
|
465
|
-
// =============================================================================
|
|
466
|
-
// Creative/Visualization
|
|
467
|
-
// =============================================================================
|
|
468
|
-
export const Canvas3D = stub<Canvas3DProps>('Canvas3D');
|
|
469
|
-
export const DataGrid = stub<DataGridProps>('DataGrid');
|
|
470
|
-
export const AnimatedBox = stub<AnimatedBoxProps>('AnimatedBox');
|
|
471
|
-
export const ServerGrid = stub<ServerGridProps>('ServerGrid');
|
|
472
|
-
export const Chart = stub<ChartProps>('Chart');
|
|
473
|
-
export const MetricCard = stub<MetricCardProps>('MetricCard');
|
|
474
|
-
|
|
475
|
-
// =============================================================================
|
|
476
|
-
// Slot
|
|
477
|
-
// =============================================================================
|
|
478
|
-
export const Slot = stub<SlotProps>('Slot');
|
|
479
|
-
|
|
480
|
-
// =============================================================================
|
|
481
|
-
// Module Composition
|
|
482
|
-
// =============================================================================
|
|
483
|
-
export const ModuleOutlet = stub<ModuleOutletProps>('ModuleOutlet');
|
|
484
|
-
|
|
485
|
-
// =============================================================================
|
|
486
|
-
// Sub-Experience Components
|
|
487
|
-
// =============================================================================
|
|
488
|
-
export const MetricsGrid = stub<MetricsGridProps>('MetricsGrid');
|
|
489
|
-
export const AdaptiveCardGrid = stub<AdaptiveCardGridProps>('AdaptiveCardGrid');
|
|
490
|
-
export const AdaptiveFilters = stub<AdaptiveFiltersProps>('AdaptiveFilters');
|
|
491
|
-
export const Pagination = stub<PaginationProps>('Pagination');
|
|
492
|
-
export const EntityHeader = stub<EntityHeaderProps>('EntityHeader');
|
|
493
|
-
export const ProgressTracker = stub<ProgressTrackerProps>('ProgressTracker');
|
|
494
|
-
export const RatingWidget = stub<RatingWidgetProps>('RatingWidget');
|
|
495
|
-
export const FieldSection = stub<FieldSectionProps>('FieldSection');
|
|
496
|
-
export const TransitionActions = stub<TransitionActionsProps>('TransitionActions');
|
|
497
|
-
export const ChildInstanceList = stub<ChildInstanceListProps>('ChildInstanceList');
|
|
498
|
-
export const BreakdownCharts = stub<BreakdownChartsProps>('BreakdownCharts');
|
|
499
|
-
export const TabbedLayout = stub<TabbedLayoutProps>('TabbedLayout');
|
|
500
|
-
export const HierarchyBreadcrumb = stub<HierarchyBreadcrumbProps>('HierarchyBreadcrumb');
|
|
501
|
-
export const SearchInput = stub<SearchInputProps>('SearchInput');
|
|
502
|
-
export const SortControl = stub<SortControlProps>('SortControl');
|
|
503
|
-
export const AggregateStats = stub<AggregateStatsProps>('AggregateStats');
|
|
504
|
-
|
|
505
|
-
// =============================================================================
|
|
506
|
-
// Routing Atoms
|
|
507
|
-
// =============================================================================
|
|
508
|
-
|
|
509
|
-
interface RouterProps extends BaseAtomProps {
|
|
510
|
-
/** Base path prefix for all child routes. */
|
|
511
|
-
basePath?: string;
|
|
512
|
-
/** Default/initial route path. */
|
|
513
|
-
defaultRoute?: string;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
interface RouteProps extends BaseAtomProps {
|
|
517
|
-
/** Route path pattern (e.g., '/rides/:id'). */
|
|
518
|
-
path: string;
|
|
519
|
-
/** Route guard — expression that must be truthy for route to render. */
|
|
520
|
-
guard?: string;
|
|
521
|
-
/** Redirect path if guard fails. */
|
|
522
|
-
redirect?: string;
|
|
523
|
-
/** Route metadata. */
|
|
524
|
-
meta?: Record<string, unknown>;
|
|
525
|
-
/** Whether this is a catch-all/fallback route. */
|
|
526
|
-
fallback?: boolean;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
interface NavLinkProps extends BaseAtomProps {
|
|
530
|
-
/** Target route path. */
|
|
531
|
-
to: string;
|
|
532
|
-
/** Link label text. */
|
|
533
|
-
label?: string;
|
|
534
|
-
/** Icon name (lucide icon). */
|
|
535
|
-
icon?: string;
|
|
536
|
-
/** Visual variant. */
|
|
537
|
-
variant?: 'default' | 'tab' | 'pill' | string;
|
|
538
|
-
/** Route guard expression. */
|
|
539
|
-
guard?: string;
|
|
540
|
-
/** Active class name override. */
|
|
541
|
-
activeClassName?: string;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
interface RoleGuardProps extends BaseAtomProps {
|
|
545
|
-
/** Role name required to render children. */
|
|
546
|
-
role: string;
|
|
547
|
-
/** Role hierarchy for comparison (highest to lowest). */
|
|
548
|
-
hierarchy?: string[];
|
|
549
|
-
/** Whether to include higher roles (default: true). */
|
|
550
|
-
includeHigher?: boolean;
|
|
551
|
-
/** Fallback content when role check fails. */
|
|
552
|
-
fallback?: ReactNode;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
export const Router = stub<RouterProps>('Router');
|
|
556
|
-
export const Route = stub<RouteProps>('Route');
|
|
557
|
-
export const NavLink = stub<NavLinkProps>('NavLink');
|
|
558
|
-
export const RoleGuard = stub<RoleGuardProps>('RoleGuard');
|
|
559
|
-
|
|
560
|
-
// =============================================================================
|
|
561
|
-
// Type Re-exports (for .workflow.tsx authoring)
|
|
562
|
-
// =============================================================================
|
|
563
|
-
export type {
|
|
564
|
-
BaseAtomProps,
|
|
565
|
-
StackProps,
|
|
566
|
-
RowProps,
|
|
567
|
-
GridProps,
|
|
568
|
-
DividerProps,
|
|
569
|
-
SpacerProps,
|
|
570
|
-
TextProps,
|
|
571
|
-
HeadingProps,
|
|
572
|
-
FieldProps,
|
|
573
|
-
ImageProps,
|
|
574
|
-
BadgeProps,
|
|
575
|
-
ButtonProps,
|
|
576
|
-
LinkProps,
|
|
577
|
-
ShowProps,
|
|
578
|
-
EachProps,
|
|
579
|
-
CardProps,
|
|
580
|
-
TabsProps,
|
|
581
|
-
AccordionProps,
|
|
582
|
-
SectionProps,
|
|
583
|
-
ModalProps,
|
|
584
|
-
TextInputProps,
|
|
585
|
-
SelectProps,
|
|
586
|
-
MarkdownProps,
|
|
587
|
-
ScrollAreaProps,
|
|
588
|
-
Canvas3DProps,
|
|
589
|
-
DataGridProps,
|
|
590
|
-
AnimatedBoxProps,
|
|
591
|
-
ServerGridProps,
|
|
592
|
-
ChartProps,
|
|
593
|
-
MetricCardProps,
|
|
594
|
-
SlotProps,
|
|
595
|
-
ModuleOutletProps,
|
|
596
|
-
RouterProps,
|
|
597
|
-
RouteProps,
|
|
598
|
-
NavLinkProps,
|
|
599
|
-
RoleGuardProps,
|
|
600
|
-
};
|
package/src/authoring.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authoring-time API — compile-time declarations for the @mindmatrix/react
|
|
3
|
-
* workflow DSL.
|
|
4
|
-
*
|
|
5
|
-
* These functions are used when writing .workflow.tsx files. The Babel plugin
|
|
6
|
-
* (@mindmatrix/react-compiler) transforms them at compile time into IR.
|
|
7
|
-
* They are NOT called at runtime — the compiler replaces them with runtime
|
|
8
|
-
* equivalents (useExperienceState, useTransition with 1 arg, etc.).
|
|
9
|
-
*
|
|
10
|
-
* Exporting them here allows TypeScript to type-check authored workflow files
|
|
11
|
-
* without errors, and IDEs to provide autocompletion.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import type { TransitionHandle } from './hooks/useTransition';
|
|
15
|
-
|
|
16
|
-
// =============================================================================
|
|
17
|
-
// useState — field binding (NOT React.useState)
|
|
18
|
-
// =============================================================================
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Declare a workflow field with a default value.
|
|
22
|
-
* The Babel plugin extracts this into the IR's `fields` array.
|
|
23
|
-
*
|
|
24
|
-
* @param defaultValue - The field's default value (also determines its type).
|
|
25
|
-
* @returns A [value, setter] tuple (like React.useState).
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* const [email, setEmail] = useState<string>("");
|
|
30
|
-
* const [count, setCount] = useState<number>(0);
|
|
31
|
-
* const [active, setActive] = useState<boolean>(true);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export function useState<T = unknown>(defaultValue: T): [T, (value: T) => void];
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Declare a workflow field bound to a named field key.
|
|
38
|
-
* Used when the field name differs from the variable name.
|
|
39
|
-
*
|
|
40
|
-
* @param fieldKey - The field key in the workflow definition.
|
|
41
|
-
* @returns A [value, setter] tuple.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* const [ride, setRide] = useState("rideData");
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export function useState<T = unknown>(fieldKey: string): [T, (value: T) => void];
|
|
49
|
-
|
|
50
|
-
// Implementation signature (not visible to consumers)
|
|
51
|
-
export function useState<T = unknown>(_defaultOrKey?: T | string): [T, (value: T) => void] {
|
|
52
|
-
// This function is never actually called — the Babel plugin replaces it.
|
|
53
|
-
// Return a dummy tuple for runtime safety if somehow invoked.
|
|
54
|
-
return [undefined as T, () => {}];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// =============================================================================
|
|
58
|
-
// useTransition — authoring overload (2-arg form)
|
|
59
|
-
// =============================================================================
|
|
60
|
-
|
|
61
|
-
export interface TransitionConfig {
|
|
62
|
-
from: string;
|
|
63
|
-
to: string;
|
|
64
|
-
requiredFields?: string[];
|
|
65
|
-
conditions?: string[];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Declare a workflow transition with from/to states.
|
|
70
|
-
* The Babel plugin extracts this into the IR's `transitions` array.
|
|
71
|
-
*
|
|
72
|
-
* @param name - Transition name.
|
|
73
|
-
* @param config - Transition configuration (from, to, requiredFields).
|
|
74
|
-
* @returns A TransitionHandle with `.fire()` method.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```tsx
|
|
78
|
-
* const login = useTransition("login", {
|
|
79
|
-
* from: "unauthenticated",
|
|
80
|
-
* to: "authenticating",
|
|
81
|
-
* requiredFields: ["email", "password"],
|
|
82
|
-
* });
|
|
83
|
-
* // In JSX: onClick={() => login.fire()}
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export function useTransitionAuthoring(
|
|
87
|
-
_name: string,
|
|
88
|
-
_config: TransitionConfig,
|
|
89
|
-
): TransitionHandle {
|
|
90
|
-
// Compile-time only — never called at runtime.
|
|
91
|
-
return { fire: async () => ({ success: true } as any), available: true, pending: false };
|
|
92
|
-
}
|