@daltonr/pathwrite-solid 0.11.0 → 0.12.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/README.md +65 -8
- package/dist/index.css +25 -0
- package/dist/index.d.ts +33 -12
- package/dist/index.js +34 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +82 -25
package/README.md
CHANGED
|
@@ -10,6 +10,21 @@ npm install @daltonr/pathwrite-core @daltonr/pathwrite-solid
|
|
|
10
10
|
|
|
11
11
|
Peer dependencies: `solid-js >= 1.8.0`
|
|
12
12
|
|
|
13
|
+
### `tsconfig.json` — required `jsxImportSource`
|
|
14
|
+
|
|
15
|
+
Solid JSX requires `"jsxImportSource": "solid-js"` in your `tsconfig.json`. Using the wrong value (a common mistake is `"solid-js/h"`) produces a cryptic TypeScript error that does not mention Solid or JSX at all.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
"jsx": "preserve",
|
|
21
|
+
"jsxImportSource": "solid-js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If you see a type error about JSX elements being `Element | null | undefined` when they should be `JSX.Element`, check this value first.
|
|
27
|
+
|
|
13
28
|
---
|
|
14
29
|
|
|
15
30
|
## Quick start
|
|
@@ -82,7 +97,7 @@ Step components call `usePathContext()` to access engine state. `<PathShell>` pr
|
|
|
82
97
|
|
|
83
98
|
| Return value | Type | Description |
|
|
84
99
|
|---|---|---|
|
|
85
|
-
| `snapshot` | `Accessor<PathSnapshot \| null>` | Current snapshot. Call `snapshot()` to read. `null` when no path is active. Tracked reactively when read inside JSX or effects. |
|
|
100
|
+
| `snapshot` | `Accessor<PathSnapshot \| null>` | Current snapshot. Call `snapshot()` to read. `null` when no path is active or when `completionBehaviour: "dismiss"` is used. With the default `"stayOnFinal"`, the accessor returns a snapshot with `status === "completed"` after the path finishes. Tracked reactively when read inside JSX or effects. |
|
|
86
101
|
| `start(definition, data?)` | function | Start or re-start a path. |
|
|
87
102
|
| `next()` | function | Advance one step. Completes the path on the last step. |
|
|
88
103
|
| `previous()` | function | Go back one step. No-op on the first step of a top-level path. |
|
|
@@ -121,14 +136,16 @@ Step components call `usePathContext()` to access engine state. `<PathShell>` pr
|
|
|
121
136
|
| `engine` | `PathEngine` | — | An externally-managed engine. When provided, `PathShell` skips its own `start()`. |
|
|
122
137
|
| `autoStart` | `boolean` | `true` | Start the path automatically on mount. Ignored when `engine` is provided. |
|
|
123
138
|
| `validationDisplay` | `"summary" \| "inline" \| "both"` | `"summary"` | Where `fieldErrors` are rendered. Use `"inline"` to suppress the summary and handle errors inside step components. |
|
|
124
|
-
| `
|
|
139
|
+
| `layout` | `"wizard" \| "form" \| "auto" \| "tabs"` | `"auto"` | `"wizard"`: Back on left, Cancel+Submit on right. `"form"`: Cancel on left, Submit on right, no Back. `"tabs"`: No progress header or footer — for tabbed interfaces. `"auto"` picks `"form"` for single-step paths. |
|
|
125
140
|
| `hideProgress` | `boolean` | `false` | Hide the progress indicator. Also hidden automatically for single-step top-level paths. |
|
|
126
141
|
| `hideFooter` | `boolean` | `false` | Hide the footer entirely. The error panel is still shown on async failure. |
|
|
127
142
|
| `hideCancel` | `boolean` | `false` | Hide the Cancel button. |
|
|
128
143
|
| `validateWhen` | `boolean` | `false` | When it becomes `true`, calls `validate()` on the engine. Bind to the outer shell's `hasAttemptedNext` for nested shells. |
|
|
129
144
|
| `services` | `object \| null` | `null` | Services object passed through context to all step components. |
|
|
145
|
+
| `restoreKey` | `string` | — | When set, the shell automatically saves its full state (data + active step) into the nearest outer `PathShell`'s data under this key on every change, and restores from it on remount. No-op on a top-level shell. |
|
|
130
146
|
| `renderHeader` | `(snapshot) => JSX.Element` | — | Replace the default progress header. |
|
|
131
147
|
| `renderFooter` | `(snapshot, actions) => JSX.Element` | — | Replace the default navigation buttons. |
|
|
148
|
+
| `completionContent` | `(snapshot: PathSnapshot) => JSX.Element` | — | Custom content rendered when `snapshot().status === "completed"` (`completionBehaviour: "stayOnFinal"`). Receives the completed snapshot. If omitted, a default "All done." panel is shown. |
|
|
132
149
|
| `onComplete` | `(data: PathData) => void` | — | Called when the path completes. |
|
|
133
150
|
| `onCancel` | `(data: PathData) => void` | — | Called when the path is cancelled. |
|
|
134
151
|
| `onEvent` | `(event: PathEvent) => void` | — | Called for every engine event. |
|
|
@@ -156,6 +173,38 @@ function DetailsStep() {
|
|
|
156
173
|
}
|
|
157
174
|
```
|
|
158
175
|
|
|
176
|
+
### Avoid repeated `snapshot()` calls — use `createMemo`
|
|
177
|
+
|
|
178
|
+
Each call to `snapshot()` is a separate signal read. In a step component with several fields, calling it inline six times creates six subscriptions and six potential re-renders per update.
|
|
179
|
+
|
|
180
|
+
Wrap it in a `createMemo` to read the signal once and share the result:
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
import { createMemo } from "solid-js";
|
|
184
|
+
import { usePathContext } from "@daltonr/pathwrite-solid";
|
|
185
|
+
|
|
186
|
+
function DetailsStep() {
|
|
187
|
+
const { snapshot, setData } = usePathContext<ApplicationData>();
|
|
188
|
+
const data = createMemo(() => snapshot()?.data as ApplicationData | undefined);
|
|
189
|
+
const errors = createMemo(() => snapshot()?.fieldErrors);
|
|
190
|
+
const attempted = createMemo(() => snapshot()?.hasAttemptedNext ?? false);
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<div>
|
|
194
|
+
<input
|
|
195
|
+
value={data()?.name ?? ""}
|
|
196
|
+
onInput={(e) => setData("name", e.currentTarget.value)}
|
|
197
|
+
/>
|
|
198
|
+
<Show when={attempted() && errors()?.name}>
|
|
199
|
+
<p class="error">{errors()?.name}</p>
|
|
200
|
+
</Show>
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`createMemo` caches the derived value and only recomputes when the underlying signal changes, so all reads within the component share one subscription.
|
|
207
|
+
|
|
159
208
|
---
|
|
160
209
|
|
|
161
210
|
## Complete example
|
|
@@ -202,21 +251,25 @@ export const applicationPath: PathDefinition<ApplicationData> = {
|
|
|
202
251
|
|
|
203
252
|
```tsx
|
|
204
253
|
// DetailsStep.tsx
|
|
254
|
+
import { createMemo } from "solid-js";
|
|
205
255
|
import { usePathContext } from "@daltonr/pathwrite-solid";
|
|
206
256
|
import type { ApplicationData } from "./application-path";
|
|
207
257
|
|
|
208
258
|
export function DetailsStep() {
|
|
209
259
|
const { snapshot, setData } = usePathContext<ApplicationData>();
|
|
260
|
+
const data = createMemo(() => snapshot()?.data as ApplicationData | undefined);
|
|
261
|
+
const errors = createMemo(() => snapshot()?.fieldErrors);
|
|
262
|
+
const attempted = createMemo(() => snapshot()?.hasAttemptedNext ?? false);
|
|
210
263
|
|
|
211
264
|
return (
|
|
212
265
|
<div>
|
|
213
266
|
<label>First name</label>
|
|
214
267
|
<input
|
|
215
|
-
value={
|
|
268
|
+
value={data()?.firstName ?? ""}
|
|
216
269
|
onInput={(e) => setData("firstName", e.currentTarget.value)}
|
|
217
270
|
/>
|
|
218
|
-
<Show when={
|
|
219
|
-
<p class="error">{
|
|
271
|
+
<Show when={attempted() && errors()?.firstName}>
|
|
272
|
+
<p class="error">{errors()?.firstName}</p>
|
|
220
273
|
</Show>
|
|
221
274
|
</div>
|
|
222
275
|
);
|
|
@@ -225,23 +278,27 @@ export function DetailsStep() {
|
|
|
225
278
|
|
|
226
279
|
```tsx
|
|
227
280
|
// CoverNoteStep.tsx
|
|
281
|
+
import { createMemo } from "solid-js";
|
|
228
282
|
import { usePathContext } from "@daltonr/pathwrite-solid";
|
|
229
283
|
import type { ApplicationData } from "./application-path";
|
|
230
284
|
|
|
231
285
|
export function CoverNoteStep() {
|
|
232
286
|
const { snapshot, setData } = usePathContext<ApplicationData>();
|
|
287
|
+
const data = createMemo(() => snapshot()?.data as ApplicationData | undefined);
|
|
288
|
+
const errors = createMemo(() => snapshot()?.fieldErrors);
|
|
289
|
+
const attempted = createMemo(() => snapshot()?.hasAttemptedNext ?? false);
|
|
233
290
|
|
|
234
291
|
return (
|
|
235
292
|
<div>
|
|
236
293
|
<label>Cover note</label>
|
|
237
294
|
<textarea
|
|
238
|
-
value={
|
|
295
|
+
value={data()?.coverNote ?? ""}
|
|
239
296
|
onInput={(e) => setData("coverNote", e.currentTarget.value)}
|
|
240
297
|
rows="6"
|
|
241
298
|
placeholder="Tell us why you're a great fit..."
|
|
242
299
|
/>
|
|
243
|
-
<Show when={
|
|
244
|
-
<p class="error">{
|
|
300
|
+
<Show when={attempted() && errors()?.coverNote}>
|
|
301
|
+
<p class="error">{errors()?.coverNote}</p>
|
|
245
302
|
</Show>
|
|
246
303
|
</div>
|
|
247
304
|
);
|
package/dist/index.css
CHANGED
|
@@ -77,6 +77,31 @@
|
|
|
77
77
|
font-size: 14px;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
/* ------------------------------------------------------------------ */
|
|
81
|
+
/* Completion panel */
|
|
82
|
+
/* ------------------------------------------------------------------ */
|
|
83
|
+
.pw-shell__completion {
|
|
84
|
+
text-align: center;
|
|
85
|
+
padding: 40px 16px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pw-shell__completion-message {
|
|
89
|
+
font-size: 18px;
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
color: var(--pw-color-text);
|
|
92
|
+
margin: 0 0 20px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.pw-shell__completion-restart {
|
|
96
|
+
border: 1px solid var(--pw-color-btn-border);
|
|
97
|
+
background: var(--pw-color-btn-bg);
|
|
98
|
+
color: var(--pw-color-text);
|
|
99
|
+
padding: var(--pw-btn-padding);
|
|
100
|
+
border-radius: var(--pw-btn-radius);
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
font-size: 14px;
|
|
103
|
+
}
|
|
104
|
+
|
|
80
105
|
/* ------------------------------------------------------------------ */
|
|
81
106
|
/* Root progress — persistent top-level bar visible during sub-paths */
|
|
82
107
|
/* ------------------------------------------------------------------ */
|
package/dist/index.d.ts
CHANGED
|
@@ -31,10 +31,14 @@ export interface UsePathReturn<TData extends PathData = PathData> {
|
|
|
31
31
|
previous: () => Promise<void>;
|
|
32
32
|
/** Cancel the active path (or sub-path). */
|
|
33
33
|
cancel: () => Promise<void>;
|
|
34
|
-
/** Jump directly to a step by ID. Calls onLeave / onEnter but bypasses guards and shouldSkip. */
|
|
35
|
-
goToStep: (stepId: string
|
|
34
|
+
/** Jump directly to a step by ID. Calls onLeave / onEnter but bypasses guards and shouldSkip. Pass `{ validateOnLeave: true }` to mark the departing step as attempted before navigating. */
|
|
35
|
+
goToStep: (stepId: string, options?: {
|
|
36
|
+
validateOnLeave?: boolean;
|
|
37
|
+
}) => Promise<void>;
|
|
36
38
|
/** Jump directly to a step by ID, checking the current step's canMoveNext (forward) or canMovePrevious (backward) guard first. Navigation is blocked if the guard returns false. */
|
|
37
|
-
goToStepChecked: (stepId: string
|
|
39
|
+
goToStepChecked: (stepId: string, options?: {
|
|
40
|
+
validateOnLeave?: boolean;
|
|
41
|
+
}) => Promise<void>;
|
|
38
42
|
/** Update a single data value; triggers re-renders via stateChanged. When `TData` is specified, `key` and `value` are type-checked against your data shape. */
|
|
39
43
|
setData: <K extends string & keyof TData>(key: K, value: TData[K]) => Promise<void>;
|
|
40
44
|
/** Reset the current step's data to what it was when the step was entered. Useful for "Clear" or "Reset" buttons. */
|
|
@@ -69,8 +73,12 @@ export interface PathShellActions {
|
|
|
69
73
|
next: () => Promise<void>;
|
|
70
74
|
previous: () => Promise<void>;
|
|
71
75
|
cancel: () => Promise<void>;
|
|
72
|
-
goToStep: (stepId: string
|
|
73
|
-
|
|
76
|
+
goToStep: (stepId: string, options?: {
|
|
77
|
+
validateOnLeave?: boolean;
|
|
78
|
+
}) => Promise<void>;
|
|
79
|
+
goToStepChecked: (stepId: string, options?: {
|
|
80
|
+
validateOnLeave?: boolean;
|
|
81
|
+
}) => Promise<void>;
|
|
74
82
|
setData: (key: string, value: unknown) => Promise<void>;
|
|
75
83
|
restart: () => Promise<void>;
|
|
76
84
|
retry: () => Promise<void>;
|
|
@@ -85,6 +93,12 @@ export interface PathShellProps {
|
|
|
85
93
|
*/
|
|
86
94
|
engine?: PathEngine;
|
|
87
95
|
initialData?: PathData;
|
|
96
|
+
/**
|
|
97
|
+
* When set, this shell automatically saves its state into the nearest outer `PathShell`'s
|
|
98
|
+
* data under this key on every change, and restores from that stored state on remount.
|
|
99
|
+
* No-op when used on a top-level shell with no outer `PathShell` ancestor.
|
|
100
|
+
*/
|
|
101
|
+
restoreKey?: string;
|
|
88
102
|
autoStart?: boolean;
|
|
89
103
|
/**
|
|
90
104
|
* Step render functions keyed by step ID (or `formId` for StepChoice steps).
|
|
@@ -92,12 +106,12 @@ export interface PathShellProps {
|
|
|
92
106
|
* <PathShell steps={{ details: (snap) => <DetailsStep snapshot={snap} />, review: (snap) => <ReviewStep snapshot={snap} /> }} />
|
|
93
107
|
* ```
|
|
94
108
|
*/
|
|
95
|
-
steps?: Record<string, (snapshot: PathSnapshot) =>
|
|
109
|
+
steps?: Record<string, (snapshot: PathSnapshot) => ReturnType<Component>>;
|
|
96
110
|
onComplete?: (data: PathData) => void;
|
|
97
111
|
onCancel?: (data: PathData) => void;
|
|
98
112
|
onEvent?: (event: PathEvent) => void;
|
|
99
|
-
renderHeader?: (snapshot: PathSnapshot) =>
|
|
100
|
-
renderFooter?: (snapshot: PathSnapshot, actions: PathShellActions) =>
|
|
113
|
+
renderHeader?: (snapshot: PathSnapshot) => ReturnType<Component>;
|
|
114
|
+
renderFooter?: (snapshot: PathSnapshot, actions: PathShellActions) => ReturnType<Component>;
|
|
101
115
|
backLabel?: string;
|
|
102
116
|
nextLabel?: string;
|
|
103
117
|
completeLabel?: string;
|
|
@@ -108,12 +122,13 @@ export interface PathShellProps {
|
|
|
108
122
|
/** If true, hide the footer (navigation buttons). The error panel is still shown on async failure regardless of this prop. */
|
|
109
123
|
hideFooter?: boolean;
|
|
110
124
|
/**
|
|
111
|
-
*
|
|
125
|
+
* Shell layout mode:
|
|
112
126
|
* - `"auto"` (default): Uses "form" for single-step top-level paths, "wizard" otherwise.
|
|
113
|
-
* - `"wizard"`: Back button on left, Cancel and Submit together on right.
|
|
114
|
-
* - `"form"`: Cancel on left, Submit alone on right. Back button never shown.
|
|
127
|
+
* - `"wizard"`: Progress header + Back button on left, Cancel and Submit together on right.
|
|
128
|
+
* - `"form"`: Progress header + Cancel on left, Submit alone on right. Back button never shown.
|
|
129
|
+
* - `"tabs"`: No progress header, no footer. Use for tabbed interfaces with a custom tab bar inside the step body.
|
|
115
130
|
*/
|
|
116
|
-
|
|
131
|
+
layout?: "wizard" | "form" | "auto" | "tabs";
|
|
117
132
|
/**
|
|
118
133
|
* Controls whether the shell renders its auto-generated field-error summary box.
|
|
119
134
|
* - `"summary"` (default): Shell renders the labeled error list below the step body.
|
|
@@ -137,6 +152,12 @@ export interface PathShellProps {
|
|
|
137
152
|
/** When true, calls `validate()` on the engine so all steps show inline errors simultaneously. Useful when this shell is nested inside a step of an outer shell: bind to the outer snapshot's `hasAttemptedNext`. */
|
|
138
153
|
validateWhen?: boolean;
|
|
139
154
|
class?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Content rendered when `snapshot.status === "completed"` (i.e. after the path
|
|
157
|
+
* finishes with `completionBehaviour: "stayOnFinal"`). Defaults to a simple
|
|
158
|
+
* "All done." panel with a Restart button.
|
|
159
|
+
*/
|
|
160
|
+
completionContent?: (snapshot: PathSnapshot) => JSX.Element;
|
|
140
161
|
}
|
|
141
162
|
export declare const PathShell: Component<PathShellProps>;
|
|
142
163
|
export type { PathData, FieldErrors, PathDefinition, PathEvent, PathSnapshot, PathStep, PathStepContext, ProgressLayout, RootProgress, SerializedPathState, } from "@daltonr/pathwrite-core";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export function usePath(options) {
|
|
|
14
14
|
setSnapshot(event.snapshot);
|
|
15
15
|
}
|
|
16
16
|
else if (event.type === "completed" || event.type === "cancelled") {
|
|
17
|
-
setSnapshot(
|
|
17
|
+
setSnapshot(engine.snapshot());
|
|
18
18
|
}
|
|
19
19
|
options?.onEvent?.(event);
|
|
20
20
|
});
|
|
@@ -24,8 +24,8 @@ export function usePath(options) {
|
|
|
24
24
|
const next = () => engine.next();
|
|
25
25
|
const previous = () => engine.previous();
|
|
26
26
|
const cancel = () => engine.cancel();
|
|
27
|
-
const goToStep = (stepId) => engine.goToStep(stepId);
|
|
28
|
-
const goToStepChecked = (stepId) => engine.goToStepChecked(stepId);
|
|
27
|
+
const goToStep = (stepId, options) => engine.goToStep(stepId, options);
|
|
28
|
+
const goToStepChecked = (stepId, options) => engine.goToStepChecked(stepId, options);
|
|
29
29
|
const setData = ((key, value) => engine.setData(key, value));
|
|
30
30
|
const resetStep = () => engine.resetStep();
|
|
31
31
|
const restart = () => engine.restart();
|
|
@@ -54,6 +54,8 @@ export function usePathContext() {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
export const PathShell = (props) => {
|
|
57
|
+
// Read outer PathShell context BEFORE providing our own.
|
|
58
|
+
const outerCtx = useContext(PathContext);
|
|
57
59
|
const pathReturn = usePath({
|
|
58
60
|
engine: props.engine,
|
|
59
61
|
onEvent(event) {
|
|
@@ -62,12 +64,28 @@ export const PathShell = (props) => {
|
|
|
62
64
|
props.onComplete?.(event.data);
|
|
63
65
|
if (event.type === "cancelled")
|
|
64
66
|
props.onCancel?.(event.data);
|
|
67
|
+
if (props.restoreKey && outerCtx && event.type === "stateChanged") {
|
|
68
|
+
outerCtx.path.setData(props.restoreKey, event.snapshot);
|
|
69
|
+
}
|
|
65
70
|
},
|
|
66
71
|
});
|
|
67
72
|
const { snapshot, start, next, previous, cancel, goToStep, goToStepChecked, setData, restart, retry, suspend, validate } = pathReturn;
|
|
68
73
|
onMount(() => {
|
|
69
74
|
if (props.autoStart !== false && !props.engine) {
|
|
70
|
-
|
|
75
|
+
let startData = props.initialData ?? {};
|
|
76
|
+
let restoreStepId;
|
|
77
|
+
if (props.restoreKey && outerCtx) {
|
|
78
|
+
const stored = outerCtx.path.snapshot()?.data[props.restoreKey];
|
|
79
|
+
if (stored != null && typeof stored === "object" && "stepId" in stored) {
|
|
80
|
+
startData = stored.data;
|
|
81
|
+
if (stored.stepIndex > 0)
|
|
82
|
+
restoreStepId = stored.stepId;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const p = start(props.path, startData);
|
|
86
|
+
if (restoreStepId) {
|
|
87
|
+
p.then(() => goToStep(restoreStepId));
|
|
88
|
+
}
|
|
71
89
|
}
|
|
72
90
|
});
|
|
73
91
|
createEffect(() => {
|
|
@@ -90,8 +108,10 @@ export const PathShell = (props) => {
|
|
|
90
108
|
const mod = layout && layout !== "merged" ? ` pw-shell--progress-${layout}` : "";
|
|
91
109
|
return props.class ? `${base}${mod} ${props.class}` : `${base}${mod}`;
|
|
92
110
|
};
|
|
93
|
-
const
|
|
94
|
-
const
|
|
111
|
+
const effectiveHideProgress = () => props.hideProgress || props.layout === "tabs";
|
|
112
|
+
const effectiveHideFooter = () => props.hideFooter || props.layout === "tabs";
|
|
113
|
+
const showRoot = () => !effectiveHideProgress() && !!snap().rootProgress && props.progressLayout !== "activeOnly";
|
|
114
|
+
const showActive = () => !effectiveHideProgress() && (snap().stepCount > 1 || snap().nestingLevel > 0) && props.progressLayout !== "rootOnly";
|
|
95
115
|
const stepContent = () => {
|
|
96
116
|
const s = snap();
|
|
97
117
|
const key = s.formId ?? s.stepId;
|
|
@@ -107,16 +127,18 @@ export const PathShell = (props) => {
|
|
|
107
127
|
(snap().hasAttemptedNext || snap().hasValidated) &&
|
|
108
128
|
!!snap().blockingError;
|
|
109
129
|
const resolvedFooterLayout = () => {
|
|
110
|
-
const fl = props.
|
|
111
|
-
if (fl !== "auto")
|
|
130
|
+
const fl = props.layout ?? "auto";
|
|
131
|
+
if (fl !== "auto" && fl !== "tabs")
|
|
112
132
|
return fl;
|
|
113
133
|
return snap().stepCount === 1 && snap().nestingLevel === 0 ? "form" : "wizard";
|
|
114
134
|
};
|
|
115
135
|
return (_jsx(PathContext.Provider, { value: contextValue, children: _jsx(Show, { when: snapshot(), fallback: _jsx("div", { class: "pw-shell", children: _jsxs("div", { class: "pw-shell__empty", children: [_jsx("p", { children: "No active path." }), _jsx(Show, { when: props.autoStart === false, children: _jsx("button", { type: "button", class: "pw-shell__start-btn", onClick: () => start(props.path, props.initialData ?? {}), children: "Start" }) })] }) }), children: _jsxs("div", { class: shellClass(), children: [_jsx(Show, { when: showRoot(), children: _jsx(SolidRootProgress, { root: snap().rootProgress }) }), _jsx(Show, { when: showActive(), children: props.renderHeader
|
|
116
136
|
? props.renderHeader(snap())
|
|
117
|
-
: _jsx(SolidHeader, { snapshot: snap() }) }), _jsx(
|
|
118
|
-
? props.
|
|
119
|
-
: _jsx(
|
|
137
|
+
: _jsx(SolidHeader, { snapshot: snap() }) }), _jsx(Show, { when: snap().status === "completed", children: _jsx("div", { class: "pw-shell__body", children: props.completionContent
|
|
138
|
+
? props.completionContent(snap())
|
|
139
|
+
: (_jsxs("div", { class: "pw-shell__completion", children: [_jsx("p", { class: "pw-shell__completion-message", children: "All done." }), _jsx("button", { type: "button", class: "pw-shell__completion-restart", onClick: () => restart(), children: "Start over" })] })) }) }), _jsxs(Show, { when: snap().status !== "completed", children: [_jsx("div", { class: "pw-shell__body", children: stepContent() }), _jsx(Show, { when: showValidation(), children: _jsx("ul", { class: "pw-shell__validation", children: _jsx(For, { each: Object.entries(snap().fieldErrors), children: ([key, msg]) => (_jsxs("li", { class: "pw-shell__validation-item", children: [_jsx(Show, { when: key !== "_", children: _jsx("span", { class: "pw-shell__validation-label", children: formatFieldKey(key) }) }), msg] })) }) }) }), _jsx(Show, { when: showWarnings(), children: _jsx("ul", { class: "pw-shell__warnings", children: _jsx(For, { each: Object.entries(snap().fieldWarnings), children: ([key, msg]) => (_jsxs("li", { class: "pw-shell__warnings-item", children: [_jsx(Show, { when: key !== "_", children: _jsx("span", { class: "pw-shell__warnings-label", children: formatFieldKey(key) }) }), msg] })) }) }) }), _jsx(Show, { when: showBlockingError(), children: _jsx("p", { class: "pw-shell__blocking-error", children: snap().blockingError }) }), _jsx(Show, { when: snap().status === "error" && snap().error, fallback: _jsx(Show, { when: !effectiveHideFooter(), children: props.renderFooter
|
|
140
|
+
? props.renderFooter(snap(), actions)
|
|
141
|
+
: _jsx(SolidFooter, { snapshot: snap(), actions: actions, backLabel: props.backLabel ?? "Previous", nextLabel: props.nextLabel ?? "Next", completeLabel: props.completeLabel ?? "Complete", loadingLabel: props.loadingLabel, cancelLabel: props.cancelLabel ?? "Cancel", hideCancel: props.hideCancel ?? false, layout: resolvedFooterLayout() }) }), children: _jsx(SolidErrorPanel, { snapshot: snap(), actions: actions }) })] })] }) }) }));
|
|
120
142
|
};
|
|
121
143
|
// ---------------------------------------------------------------------------
|
|
122
144
|
// Root progress
|
|
@@ -144,7 +166,7 @@ function SolidErrorPanel(props) {
|
|
|
144
166
|
// Default footer (navigation buttons)
|
|
145
167
|
// ---------------------------------------------------------------------------
|
|
146
168
|
function SolidFooter(props) {
|
|
147
|
-
const isFormMode = () => props.
|
|
169
|
+
const isFormMode = () => props.layout === "form";
|
|
148
170
|
const isLoading = () => props.snapshot.status !== "idle";
|
|
149
171
|
const submitLabel = () => isLoading() && props.loadingLabel
|
|
150
172
|
? props.loadingLabel
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,YAAY,EACZ,GAAG,EACH,IAAI,GAIL,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,UAAU,EAKV,cAAc,EACd,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AA4DjC,8EAA8E;AAC9E,qBAAqB;AAC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AQ,EACb,KAAK,EAAC,mCAAmC,EACzC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,EACxD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,YAE9B,KAAK,CAAC,SAAS,GACT,GACJ,IACH,EACN,eAAK,KAAK,EAAC,wBAAwB,aAEjC,KAAC,IAAI,IAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,YAC5C,iBACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,qCAAqC,EAC3C,QAAQ,EAAE,SAAS,EAAE,EACrB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,YAE5B,KAAK,CAAC,WAAW,GACX,GACJ,EAEP,iBACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,oCAAoC,SAAS,EAAE,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,EACzF,QAAQ,EAAE,SAAS,EAAE,EACrB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,YAE1B,WAAW,EAAE,GACP,IACL,IACF,CACP,CAAC;AACJ,CAAC;AAmBD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daltonr/pathwrite-solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "SolidJS adapter for @daltonr/pathwrite-core — reactive usePath() composable and optional PathShell component.",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"solid-js": ">=1.8.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@daltonr/pathwrite-core": "^0.
|
|
50
|
+
"@daltonr/pathwrite-core": "^0.12.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"solid-js": "^1.9.0"
|
package/src/index.tsx
CHANGED
|
@@ -59,10 +59,10 @@ export interface UsePathReturn<TData extends PathData = PathData> {
|
|
|
59
59
|
previous: () => Promise<void>;
|
|
60
60
|
/** Cancel the active path (or sub-path). */
|
|
61
61
|
cancel: () => Promise<void>;
|
|
62
|
-
/** Jump directly to a step by ID. Calls onLeave / onEnter but bypasses guards and shouldSkip. */
|
|
63
|
-
goToStep: (stepId: string) => Promise<void>;
|
|
62
|
+
/** Jump directly to a step by ID. Calls onLeave / onEnter but bypasses guards and shouldSkip. Pass `{ validateOnLeave: true }` to mark the departing step as attempted before navigating. */
|
|
63
|
+
goToStep: (stepId: string, options?: { validateOnLeave?: boolean }) => Promise<void>;
|
|
64
64
|
/** Jump directly to a step by ID, checking the current step's canMoveNext (forward) or canMovePrevious (backward) guard first. Navigation is blocked if the guard returns false. */
|
|
65
|
-
goToStepChecked: (stepId: string) => Promise<void>;
|
|
65
|
+
goToStepChecked: (stepId: string, options?: { validateOnLeave?: boolean }) => Promise<void>;
|
|
66
66
|
/** Update a single data value; triggers re-renders via stateChanged. When `TData` is specified, `key` and `value` are type-checked against your data shape. */
|
|
67
67
|
setData: <K extends string & keyof TData>(key: K, value: TData[K]) => Promise<void>;
|
|
68
68
|
/** Reset the current step's data to what it was when the step was entered. Useful for "Clear" or "Reset" buttons. */
|
|
@@ -98,7 +98,7 @@ export function usePath<TData extends PathData = PathData>(options?: UsePathOpti
|
|
|
98
98
|
if (event.type === "stateChanged" || event.type === "resumed") {
|
|
99
99
|
setSnapshot(event.snapshot as PathSnapshot<TData>);
|
|
100
100
|
} else if (event.type === "completed" || event.type === "cancelled") {
|
|
101
|
-
setSnapshot(null);
|
|
101
|
+
setSnapshot(engine.snapshot() as PathSnapshot<TData> | null);
|
|
102
102
|
}
|
|
103
103
|
options?.onEvent?.(event);
|
|
104
104
|
});
|
|
@@ -114,8 +114,8 @@ export function usePath<TData extends PathData = PathData>(options?: UsePathOpti
|
|
|
114
114
|
const next = (): Promise<void> => engine.next();
|
|
115
115
|
const previous = (): Promise<void> => engine.previous();
|
|
116
116
|
const cancel = (): Promise<void> => engine.cancel();
|
|
117
|
-
const goToStep = (stepId: string): Promise<void> => engine.goToStep(stepId);
|
|
118
|
-
const goToStepChecked = (stepId: string): Promise<void> => engine.goToStepChecked(stepId);
|
|
117
|
+
const goToStep = (stepId: string, options?: { validateOnLeave?: boolean }): Promise<void> => engine.goToStep(stepId, options);
|
|
118
|
+
const goToStepChecked = (stepId: string, options?: { validateOnLeave?: boolean }): Promise<void> => engine.goToStepChecked(stepId, options);
|
|
119
119
|
|
|
120
120
|
const setData = (<K extends string & keyof TData>(key: K, value: TData[K]): Promise<void> =>
|
|
121
121
|
engine.setData(key, value as unknown)) as UsePathReturn<TData>["setData"];
|
|
@@ -167,8 +167,8 @@ export interface PathShellActions {
|
|
|
167
167
|
next: () => Promise<void>;
|
|
168
168
|
previous: () => Promise<void>;
|
|
169
169
|
cancel: () => Promise<void>;
|
|
170
|
-
goToStep: (stepId: string) => Promise<void>;
|
|
171
|
-
goToStepChecked: (stepId: string) => Promise<void>;
|
|
170
|
+
goToStep: (stepId: string, options?: { validateOnLeave?: boolean }) => Promise<void>;
|
|
171
|
+
goToStepChecked: (stepId: string, options?: { validateOnLeave?: boolean }) => Promise<void>;
|
|
172
172
|
setData: (key: string, value: unknown) => Promise<void>;
|
|
173
173
|
restart: () => Promise<void>;
|
|
174
174
|
retry: () => Promise<void>;
|
|
@@ -184,6 +184,12 @@ export interface PathShellProps {
|
|
|
184
184
|
*/
|
|
185
185
|
engine?: PathEngine;
|
|
186
186
|
initialData?: PathData;
|
|
187
|
+
/**
|
|
188
|
+
* When set, this shell automatically saves its state into the nearest outer `PathShell`'s
|
|
189
|
+
* data under this key on every change, and restores from that stored state on remount.
|
|
190
|
+
* No-op when used on a top-level shell with no outer `PathShell` ancestor.
|
|
191
|
+
*/
|
|
192
|
+
restoreKey?: string;
|
|
187
193
|
autoStart?: boolean;
|
|
188
194
|
/**
|
|
189
195
|
* Step render functions keyed by step ID (or `formId` for StepChoice steps).
|
|
@@ -191,12 +197,12 @@ export interface PathShellProps {
|
|
|
191
197
|
* <PathShell steps={{ details: (snap) => <DetailsStep snapshot={snap} />, review: (snap) => <ReviewStep snapshot={snap} /> }} />
|
|
192
198
|
* ```
|
|
193
199
|
*/
|
|
194
|
-
steps?: Record<string, (snapshot: PathSnapshot) =>
|
|
200
|
+
steps?: Record<string, (snapshot: PathSnapshot) => ReturnType<Component>>;
|
|
195
201
|
onComplete?: (data: PathData) => void;
|
|
196
202
|
onCancel?: (data: PathData) => void;
|
|
197
203
|
onEvent?: (event: PathEvent) => void;
|
|
198
|
-
renderHeader?: (snapshot: PathSnapshot) =>
|
|
199
|
-
renderFooter?: (snapshot: PathSnapshot, actions: PathShellActions) =>
|
|
204
|
+
renderHeader?: (snapshot: PathSnapshot) => ReturnType<Component>;
|
|
205
|
+
renderFooter?: (snapshot: PathSnapshot, actions: PathShellActions) => ReturnType<Component>;
|
|
200
206
|
backLabel?: string;
|
|
201
207
|
nextLabel?: string;
|
|
202
208
|
completeLabel?: string;
|
|
@@ -207,12 +213,13 @@ export interface PathShellProps {
|
|
|
207
213
|
/** If true, hide the footer (navigation buttons). The error panel is still shown on async failure regardless of this prop. */
|
|
208
214
|
hideFooter?: boolean;
|
|
209
215
|
/**
|
|
210
|
-
*
|
|
216
|
+
* Shell layout mode:
|
|
211
217
|
* - `"auto"` (default): Uses "form" for single-step top-level paths, "wizard" otherwise.
|
|
212
|
-
* - `"wizard"`: Back button on left, Cancel and Submit together on right.
|
|
213
|
-
* - `"form"`: Cancel on left, Submit alone on right. Back button never shown.
|
|
218
|
+
* - `"wizard"`: Progress header + Back button on left, Cancel and Submit together on right.
|
|
219
|
+
* - `"form"`: Progress header + Cancel on left, Submit alone on right. Back button never shown.
|
|
220
|
+
* - `"tabs"`: No progress header, no footer. Use for tabbed interfaces with a custom tab bar inside the step body.
|
|
214
221
|
*/
|
|
215
|
-
|
|
222
|
+
layout?: "wizard" | "form" | "auto" | "tabs";
|
|
216
223
|
/**
|
|
217
224
|
* Controls whether the shell renders its auto-generated field-error summary box.
|
|
218
225
|
* - `"summary"` (default): Shell renders the labeled error list below the step body.
|
|
@@ -236,15 +243,29 @@ export interface PathShellProps {
|
|
|
236
243
|
/** When true, calls `validate()` on the engine so all steps show inline errors simultaneously. Useful when this shell is nested inside a step of an outer shell: bind to the outer snapshot's `hasAttemptedNext`. */
|
|
237
244
|
validateWhen?: boolean;
|
|
238
245
|
class?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Content rendered when `snapshot.status === "completed"` (i.e. after the path
|
|
248
|
+
* finishes with `completionBehaviour: "stayOnFinal"`). Defaults to a simple
|
|
249
|
+
* "All done." panel with a Restart button.
|
|
250
|
+
*/
|
|
251
|
+
completionContent?: (snapshot: PathSnapshot) => JSX.Element;
|
|
239
252
|
}
|
|
240
253
|
|
|
241
254
|
export const PathShell: Component<PathShellProps> = (props) => {
|
|
255
|
+
// Read outer PathShell context BEFORE providing our own.
|
|
256
|
+
const outerCtx = useContext(PathContext);
|
|
257
|
+
|
|
242
258
|
const pathReturn = usePath({
|
|
243
259
|
engine: props.engine,
|
|
244
260
|
onEvent(event) {
|
|
245
261
|
props.onEvent?.(event);
|
|
246
262
|
if (event.type === "completed") props.onComplete?.(event.data as PathData);
|
|
247
263
|
if (event.type === "cancelled") props.onCancel?.(event.data as PathData);
|
|
264
|
+
if (props.restoreKey && outerCtx && event.type === "stateChanged") {
|
|
265
|
+
(outerCtx.path.setData as unknown as (key: string, value: unknown) => void)(
|
|
266
|
+
props.restoreKey, event.snapshot
|
|
267
|
+
);
|
|
268
|
+
}
|
|
248
269
|
},
|
|
249
270
|
});
|
|
250
271
|
|
|
@@ -252,7 +273,19 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
252
273
|
|
|
253
274
|
onMount(() => {
|
|
254
275
|
if (props.autoStart !== false && !props.engine) {
|
|
255
|
-
|
|
276
|
+
let startData: PathData = props.initialData ?? {};
|
|
277
|
+
let restoreStepId: string | undefined;
|
|
278
|
+
if (props.restoreKey && outerCtx) {
|
|
279
|
+
const stored = outerCtx.path.snapshot()?.data[props.restoreKey] as PathSnapshot | undefined;
|
|
280
|
+
if (stored != null && typeof stored === "object" && "stepId" in stored) {
|
|
281
|
+
startData = stored.data as PathData;
|
|
282
|
+
if (stored.stepIndex > 0) restoreStepId = stored.stepId as string;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const p = start(props.path, startData);
|
|
286
|
+
if (restoreStepId) {
|
|
287
|
+
p.then(() => goToStep(restoreStepId!));
|
|
288
|
+
}
|
|
256
289
|
}
|
|
257
290
|
});
|
|
258
291
|
|
|
@@ -280,8 +313,10 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
280
313
|
return props.class ? `${base}${mod} ${props.class}` : `${base}${mod}`;
|
|
281
314
|
};
|
|
282
315
|
|
|
283
|
-
const
|
|
284
|
-
const
|
|
316
|
+
const effectiveHideProgress = () => props.hideProgress || props.layout === "tabs";
|
|
317
|
+
const effectiveHideFooter = () => props.hideFooter || props.layout === "tabs";
|
|
318
|
+
const showRoot = () => !effectiveHideProgress() && !!snap().rootProgress && props.progressLayout !== "activeOnly";
|
|
319
|
+
const showActive = () => !effectiveHideProgress() && (snap().stepCount > 1 || snap().nestingLevel > 0) && props.progressLayout !== "rootOnly";
|
|
285
320
|
|
|
286
321
|
const stepContent = () => {
|
|
287
322
|
const s = snap();
|
|
@@ -305,8 +340,8 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
305
340
|
!!snap().blockingError;
|
|
306
341
|
|
|
307
342
|
const resolvedFooterLayout = () => {
|
|
308
|
-
const fl = props.
|
|
309
|
-
if (fl !== "auto") return fl;
|
|
343
|
+
const fl = props.layout ?? "auto";
|
|
344
|
+
if (fl !== "auto" && fl !== "tabs") return fl;
|
|
310
345
|
return snap().stepCount === 1 && snap().nestingLevel === 0 ? "form" : "wizard";
|
|
311
346
|
};
|
|
312
347
|
|
|
@@ -342,7 +377,28 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
342
377
|
? props.renderHeader(snap())
|
|
343
378
|
: <SolidHeader snapshot={snap()} />}
|
|
344
379
|
</Show>
|
|
345
|
-
{/*
|
|
380
|
+
{/* Completion panel — shown when path finishes with stayOnFinal */}
|
|
381
|
+
<Show when={snap().status === "completed"}>
|
|
382
|
+
<div class="pw-shell__body">
|
|
383
|
+
{props.completionContent
|
|
384
|
+
? props.completionContent(snap())
|
|
385
|
+
: (
|
|
386
|
+
<div class="pw-shell__completion">
|
|
387
|
+
<p class="pw-shell__completion-message">All done.</p>
|
|
388
|
+
<button
|
|
389
|
+
type="button"
|
|
390
|
+
class="pw-shell__completion-restart"
|
|
391
|
+
onClick={() => restart()}
|
|
392
|
+
>
|
|
393
|
+
Start over
|
|
394
|
+
</button>
|
|
395
|
+
</div>
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
</div>
|
|
399
|
+
</Show>
|
|
400
|
+
{/* Body — step content (hidden when completed) */}
|
|
401
|
+
<Show when={snap().status !== "completed"}>
|
|
346
402
|
<div class="pw-shell__body">{stepContent()}</div>
|
|
347
403
|
{/* Validation messages */}
|
|
348
404
|
<Show when={showValidation()}>
|
|
@@ -382,7 +438,7 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
382
438
|
<Show
|
|
383
439
|
when={snap().status === "error" && snap().error}
|
|
384
440
|
fallback={
|
|
385
|
-
<Show when={!
|
|
441
|
+
<Show when={!effectiveHideFooter()}>
|
|
386
442
|
{props.renderFooter
|
|
387
443
|
? props.renderFooter(snap(), actions)
|
|
388
444
|
: <SolidFooter
|
|
@@ -394,7 +450,7 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
394
450
|
loadingLabel={props.loadingLabel}
|
|
395
451
|
cancelLabel={props.cancelLabel ?? "Cancel"}
|
|
396
452
|
hideCancel={props.hideCancel ?? false}
|
|
397
|
-
|
|
453
|
+
layout={resolvedFooterLayout()}
|
|
398
454
|
/>
|
|
399
455
|
}
|
|
400
456
|
</Show>
|
|
@@ -402,6 +458,7 @@ export const PathShell: Component<PathShellProps> = (props) => {
|
|
|
402
458
|
>
|
|
403
459
|
<SolidErrorPanel snapshot={snap()} actions={actions} />
|
|
404
460
|
</Show>
|
|
461
|
+
</Show>{/* end status !== completed */}
|
|
405
462
|
</div>
|
|
406
463
|
</Show>
|
|
407
464
|
</PathContext.Provider>
|
|
@@ -514,9 +571,9 @@ function SolidFooter(props: {
|
|
|
514
571
|
loadingLabel?: string;
|
|
515
572
|
cancelLabel: string;
|
|
516
573
|
hideCancel: boolean;
|
|
517
|
-
|
|
574
|
+
layout: "wizard" | "form";
|
|
518
575
|
}) {
|
|
519
|
-
const isFormMode = () => props.
|
|
576
|
+
const isFormMode = () => props.layout === "form";
|
|
520
577
|
const isLoading = () => props.snapshot.status !== "idle";
|
|
521
578
|
const submitLabel = () =>
|
|
522
579
|
isLoading() && props.loadingLabel
|