@daltonr/pathwrite-solid 0.13.1 → 0.14.1
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 +22 -0
- package/dist/index.css +12 -4
- package/dist/index.d.ts +10 -9
- package/dist/index.js +553 -240
- package/dist/index.js.map +1 -1
- package/dist/server.js +441 -0
- package/dist/server.js.map +1 -0
- package/package.json +7 -4
- package/src/index.tsx +182 -122
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Devjoy Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/dist/index.css
CHANGED
|
@@ -53,7 +53,12 @@
|
|
|
53
53
|
flex-direction: column;
|
|
54
54
|
gap: var(--pw-shell-gap);
|
|
55
55
|
padding: var(--pw-shell-padding);
|
|
56
|
-
font-family:
|
|
56
|
+
font-family:
|
|
57
|
+
system-ui,
|
|
58
|
+
-apple-system,
|
|
59
|
+
"Segoe UI",
|
|
60
|
+
Roboto,
|
|
61
|
+
sans-serif;
|
|
57
62
|
color: var(--pw-color-text);
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -397,7 +402,9 @@
|
|
|
397
402
|
border-radius: var(--pw-btn-radius);
|
|
398
403
|
cursor: pointer;
|
|
399
404
|
font-size: 14px;
|
|
400
|
-
transition:
|
|
405
|
+
transition:
|
|
406
|
+
background 0.15s ease,
|
|
407
|
+
border-color 0.15s ease;
|
|
401
408
|
}
|
|
402
409
|
|
|
403
410
|
.pw-shell__btn:hover:not(:disabled) {
|
|
@@ -422,7 +429,9 @@
|
|
|
422
429
|
}
|
|
423
430
|
|
|
424
431
|
@keyframes pw-spin {
|
|
425
|
-
to {
|
|
432
|
+
to {
|
|
433
|
+
transform: rotate(360deg);
|
|
434
|
+
}
|
|
426
435
|
}
|
|
427
436
|
|
|
428
437
|
.pw-shell__btn--next.pw-shell__btn--loading {
|
|
@@ -515,4 +524,3 @@
|
|
|
515
524
|
.pw-shell__btn--suspend:hover:not(:disabled) {
|
|
516
525
|
background: var(--pw-color-primary-light);
|
|
517
526
|
}
|
|
518
|
-
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Component, type JSX, type Accessor } from "solid-js";
|
|
2
2
|
import { PathData, PathDefinition, PathEngine, PathEvent, PathSnapshot, ProgressLayout } from "@daltonr/pathwrite-core";
|
|
3
|
-
export interface UsePathOptions {
|
|
3
|
+
export interface UsePathOptions<TData extends PathData = PathData> {
|
|
4
4
|
/**
|
|
5
5
|
* An externally-managed `PathEngine` to subscribe to — for example, the engine
|
|
6
6
|
* returned by `restoreOrStart()` from `@daltonr/pathwrite-store`.
|
|
@@ -17,9 +17,9 @@ export interface UsePathOptions {
|
|
|
17
17
|
* async `restoreOrStart()`) or is swapped is adopted — the hook
|
|
18
18
|
* re-subscribes and re-seeds its snapshot from the new engine.
|
|
19
19
|
*/
|
|
20
|
-
engine?: PathEngine | Accessor<PathEngine | undefined>;
|
|
20
|
+
engine?: PathEngine<TData> | Accessor<PathEngine<TData> | undefined>;
|
|
21
21
|
/** Called for every engine event (stateChanged, completed, cancelled, resumed). */
|
|
22
|
-
onEvent?: (event: PathEvent) => void;
|
|
22
|
+
onEvent?: (event: PathEvent<TData>) => void;
|
|
23
23
|
}
|
|
24
24
|
export interface UsePathReturn<TData extends PathData = PathData> {
|
|
25
25
|
/**
|
|
@@ -28,9 +28,9 @@ export interface UsePathReturn<TData extends PathData = PathData> {
|
|
|
28
28
|
*/
|
|
29
29
|
snapshot: Accessor<PathSnapshot<TData> | null>;
|
|
30
30
|
/** Start (or restart) a path. */
|
|
31
|
-
start: (path: PathDefinition<
|
|
32
|
-
/** Push a sub-path onto the stack. Requires an active path. Pass an optional `meta` object for correlation — it is returned unchanged to the parent step's `onSubPathComplete` / `onSubPathCancel` hooks. */
|
|
33
|
-
startSubPath: (path: PathDefinition
|
|
31
|
+
start: (path: PathDefinition<TData>, initialData?: Partial<TData>) => Promise<void>;
|
|
32
|
+
/** Push a sub-path onto the stack. Requires an active path. A sub-path has its own data, so any definition is accepted. Pass an optional `meta` object for correlation — it is returned unchanged to the parent step's `onSubPathComplete` / `onSubPathCancel` hooks. */
|
|
33
|
+
startSubPath: (path: PathDefinition, initialData?: PathData, meta?: Record<string, unknown>) => Promise<void>;
|
|
34
34
|
/** Advance one step. Completes the path on the last step. */
|
|
35
35
|
next: () => Promise<void>;
|
|
36
36
|
/** Go back one step. No-op when already on the first step of a top-level path. Pops back to the parent path when on the first step of a sub-path. */
|
|
@@ -63,7 +63,7 @@ export interface UsePathReturn<TData extends PathData = PathData> {
|
|
|
63
63
|
/** Trigger inline validation on all steps without navigating. Sets `snapshot().hasValidated`. */
|
|
64
64
|
validate: () => void;
|
|
65
65
|
}
|
|
66
|
-
export declare function usePath<TData extends PathData = PathData>(options?: UsePathOptions): UsePathReturn<TData>;
|
|
66
|
+
export declare function usePath<TData extends PathData = PathData>(options?: UsePathOptions<TData>): UsePathReturn<TData>;
|
|
67
67
|
/**
|
|
68
68
|
* Access the nearest `PathShell`'s path instance and optional services object.
|
|
69
69
|
* Throws if used outside of a PathShell component.
|
|
@@ -92,7 +92,8 @@ export interface PathShellActions {
|
|
|
92
92
|
suspend: () => Promise<void>;
|
|
93
93
|
}
|
|
94
94
|
export interface PathShellProps {
|
|
95
|
-
path
|
|
95
|
+
/** The path to run. The shell is not typed over the path's data, so a definition of any data type is accepted. */
|
|
96
|
+
path: PathDefinition;
|
|
96
97
|
/**
|
|
97
98
|
* An externally-managed engine — for example, the engine returned by
|
|
98
99
|
* `restoreOrStart()` from `@daltonr/pathwrite-store`. When supplied, `PathShell` will skip its own
|
|
@@ -175,5 +176,5 @@ export interface PathShellProps {
|
|
|
175
176
|
completionContent?: (snapshot: PathSnapshot) => JSX.Element;
|
|
176
177
|
}
|
|
177
178
|
export declare const PathShell: Component<PathShellProps>;
|
|
178
|
-
export type { PathData, FieldErrors, PathDefinition, PathEvent, PathSnapshot, PathStep, PathStepContext, ProgressLayout, RootProgress, SerializedPathState, } from "@daltonr/pathwrite-core";
|
|
179
|
+
export type { PathData, FieldErrors, PathDefinition, PathEvent, PathSnapshot, StepStatus, PathStep, PathStepContext, ProgressLayout, RootProgress, SerializedPathState, } from "@daltonr/pathwrite-core";
|
|
179
180
|
export { PathEngine } from "@daltonr/pathwrite-core";
|