@hai3/framework 0.2.0-alpha.1 → 0.2.0-alpha.2
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 +31 -2
- package/commands/hai3-quick-ref.md +1 -3
- package/dist/index.cjs +300 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -83
- package/dist/index.d.ts +160 -83
- package/dist/index.js +289 -175
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +31 -15
- package/dist/types.d.ts +31 -15
- package/package.json +4 -1
package/CLAUDE.md
CHANGED
|
@@ -57,6 +57,35 @@ const headlessApp = createHAI3()
|
|
|
57
57
|
| `routing()` | routeRegistry, URL sync | screensets |
|
|
58
58
|
| `i18n()` | i18nRegistry, setLanguage action | - |
|
|
59
59
|
| `effects()` | Core effect coordination | - |
|
|
60
|
+
| `mock()` | mockSlice, toggleMockMode action | effects |
|
|
61
|
+
|
|
62
|
+
### Mock Mode Control
|
|
63
|
+
|
|
64
|
+
The `mock()` plugin provides centralized mock mode control. It's included in the `full()` preset by default, so apps don't need manual setup:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { createHAI3App } from '@hai3/framework';
|
|
68
|
+
|
|
69
|
+
// Full preset includes mock plugin automatically
|
|
70
|
+
const app = createHAI3App();
|
|
71
|
+
|
|
72
|
+
// Toggle mock mode via actions (used by HAI3 Studio ApiModeToggle)
|
|
73
|
+
app.actions.toggleMockMode(true); // Activates all registered mock plugins
|
|
74
|
+
app.actions.toggleMockMode(false); // Deactivates all registered mock plugins
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For custom plugin compositions:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { createHAI3, effects, mock } from '@hai3/framework';
|
|
81
|
+
|
|
82
|
+
const app = createHAI3()
|
|
83
|
+
.use(effects()) // Required dependency
|
|
84
|
+
.use(mock()) // Automatic mock mode control
|
|
85
|
+
.build();
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Services register mock plugins using `registerPlugin()` in their constructor. The framework automatically manages plugin activation based on mock mode state.
|
|
60
89
|
|
|
61
90
|
### Built Application
|
|
62
91
|
|
|
@@ -125,7 +154,7 @@ For convenience, this package re-exports from SDK packages:
|
|
|
125
154
|
|
|
126
155
|
- From @hai3/state: `eventBus`, `createStore`, `getStore`, `registerSlice`, `hasSlice`, `createSlice`
|
|
127
156
|
- From @hai3/screensets: `LayoutDomain`, `ScreensetCategory`, `screensetRegistry`, contracts/types
|
|
128
|
-
- From @hai3/api: `apiRegistry`, `BaseApiService`, `RestProtocol`, `
|
|
157
|
+
- From @hai3/api: `apiRegistry`, `BaseApiService`, `RestProtocol`, `RestMockPlugin`, `SseMockPlugin`, `MOCK_PLUGIN`, `isMockPlugin`
|
|
129
158
|
- From @hai3/i18n: `i18nRegistry`, `Language`, `SUPPORTED_LANGUAGES`, `getLanguageMetadata`
|
|
130
159
|
|
|
131
160
|
**Layout Slices (owned by @hai3/framework):**
|
|
@@ -149,7 +178,7 @@ const menu = useAppSelector((state: RootStateWithLayout) => state.layout.menu);
|
|
|
149
178
|
- `presets` - Available presets (full, minimal, headless)
|
|
150
179
|
|
|
151
180
|
### Plugins
|
|
152
|
-
- `screensets`, `themes`, `layout`, `navigation`, `routing`, `i18n`, `effects`
|
|
181
|
+
- `screensets`, `themes`, `layout`, `navigation`, `routing`, `i18n`, `effects`, `mock`
|
|
153
182
|
|
|
154
183
|
### Registries
|
|
155
184
|
- `createScreensetRegistry`, `createThemeRegistry`, `createRouteRegistry`
|
|
@@ -27,10 +27,8 @@
|
|
|
27
27
|
- REQUIRED: Screen files orchestrate components only.
|
|
28
28
|
|
|
29
29
|
## Registry
|
|
30
|
-
- REQUIRED: export const MY_DOMAIN = 'my-domain'.
|
|
31
30
|
- REQUIRED: class MyService extends BaseApiService.
|
|
32
|
-
- REQUIRED:
|
|
33
|
-
- REQUIRED: apiRegistry.register(MY_DOMAIN, MyService).
|
|
31
|
+
- REQUIRED: apiRegistry.register(MyService).
|
|
34
32
|
|
|
35
33
|
## Styling
|
|
36
34
|
- Inline styles ONLY in screensets/*/uikit/base/ (rare local primitives).
|