@wizzard-packages/core 0.1.0 → 0.3.0
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/LICENSE +1 -1
- package/README.md +67 -0
- package/package.json +4 -2
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @wizzard-packages/core
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Framework-agnostic wizard engine: state, actions, and types. Use this package to build your own UI layer or plug it into another framework.
|
|
8
|
+
|
|
9
|
+
## Why core
|
|
10
|
+
|
|
11
|
+
- Headless state store and typed actions
|
|
12
|
+
- Works in any UI (React, Vue, custom, CLI)
|
|
13
|
+
- Small surface area with predictable behavior
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @wizzard-packages/core
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quickstart
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { WizardStore, type IWizardConfig } from '@wizzard-packages/core';
|
|
25
|
+
|
|
26
|
+
type Data = { name: string };
|
|
27
|
+
|
|
28
|
+
type StepId = 'name' | 'review';
|
|
29
|
+
|
|
30
|
+
const config: IWizardConfig<Data, StepId> = {
|
|
31
|
+
steps: [
|
|
32
|
+
{ id: 'name', label: 'Name', component: null },
|
|
33
|
+
{ id: 'review', label: 'Review', component: null },
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const store = new WizardStore<Data, StepId>({ name: '' });
|
|
38
|
+
|
|
39
|
+
store.dispatch({
|
|
40
|
+
type: 'INIT',
|
|
41
|
+
payload: { data: { name: '' }, config },
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Utilities
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { getByPath, setByPath } from '@wizzard-packages/core';
|
|
49
|
+
|
|
50
|
+
const data = { user: { name: 'Ada' } };
|
|
51
|
+
const name = getByPath(data, 'user.name');
|
|
52
|
+
const next = setByPath(data, 'user.name', 'Grace');
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Related packages
|
|
56
|
+
|
|
57
|
+
- @wizzard-packages/react - React provider + hooks on top of core
|
|
58
|
+
- @wizzard-packages/persistence - save/load wizard state
|
|
59
|
+
- @wizzard-packages/middleware - logger and devtools middleware
|
|
60
|
+
- @wizzard-packages/adapter-zod - validation with Zod
|
|
61
|
+
- @wizzard-packages/adapter-yup - validation with Yup
|
|
62
|
+
- @wizzard-packages/devtools - DevTools UI (React)
|
|
63
|
+
|
|
64
|
+
## Links
|
|
65
|
+
|
|
66
|
+
- Repo: https://github.com/ZizzX/wizzard-packages
|
|
67
|
+
- Docs UI: https://zizzx.github.io/wizzard-packages/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wizzard-packages/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Core logic for Wizzard Stepper - framework agnostic store and utilities.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
"wizard",
|
|
29
29
|
"stepper",
|
|
30
30
|
"state-management",
|
|
31
|
-
"headless"
|
|
31
|
+
"headless",
|
|
32
|
+
"workflow",
|
|
33
|
+
"state-machine"
|
|
32
34
|
],
|
|
33
35
|
"author": "ZizzX",
|
|
34
36
|
"license": "MIT",
|