@daltonr/pathwrite-angular 0.3.0 → 0.4.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 +332 -1
- package/dist/index.css +10 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/shell.d.ts +2 -0
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +22 -0
- package/src/shell.ts +3 -0
package/README.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Angular `@Injectable` facade over `@daltonr/pathwrite-core`. Exposes path state and events as RxJS observables that work seamlessly with Angular signals, the `async` pipe, and `takeUntilDestroyed`.
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @daltonr/pathwrite-core @daltonr/pathwrite-angular
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exported Types
|
|
12
|
+
|
|
13
|
+
For convenience, this package re-exports core types so you don't need to import from `@daltonr/pathwrite-core`:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import {
|
|
17
|
+
PathFacade, // Angular-specific
|
|
18
|
+
PathData, // Re-exported from core
|
|
19
|
+
PathDefinition, // Re-exported from core
|
|
20
|
+
PathEvent, // Re-exported from core
|
|
21
|
+
PathSnapshot, // Re-exported from core
|
|
22
|
+
PathStep, // Re-exported from core
|
|
23
|
+
PathStepContext, // Re-exported from core
|
|
24
|
+
SerializedPathState // Re-exported from core
|
|
25
|
+
} from "@daltonr/pathwrite-angular";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
5
30
|
## Setup
|
|
6
31
|
|
|
7
32
|
Provide `PathFacade` at the component level so each component gets its own isolated path instance, and Angular handles cleanup automatically via `ngOnDestroy`.
|
|
@@ -41,6 +66,7 @@ export class MyComponent {
|
|
|
41
66
|
| Method | Description |
|
|
42
67
|
|--------|-------------|
|
|
43
68
|
| `start(definition, data?)` | Start or re-start a path. |
|
|
69
|
+
| `restart(definition, data?)` | Tear down any active path (without firing hooks) and start the given path fresh. Safe to call at any time. Use for "Start over" / retry flows. |
|
|
44
70
|
| `startSubPath(definition, data?, meta?)` | Push a sub-path. Requires an active path. `meta` is returned unchanged to `onSubPathComplete` / `onSubPathCancel`. |
|
|
45
71
|
| `next()` | Advance one step. Completes the path on the last step. |
|
|
46
72
|
| `previous()` | Go back one step. No-op when already on the first step of a top-level path. |
|
|
@@ -330,12 +356,284 @@ export class MyComponent { ... }
|
|
|
330
356
|
export class MyComponent { ... }
|
|
331
357
|
```
|
|
332
358
|
|
|
333
|
-
`actions` (`PathShellActions`) contains: `next`, `previous`, `cancel`, `goToStep`, `goToStepChecked`, `setData`. All return `Promise<void>`.
|
|
359
|
+
`actions` (`PathShellActions`) contains: `next`, `previous`, `cancel`, `goToStep`, `goToStepChecked`, `setData`, `restart`. All return `Promise<void>`.
|
|
360
|
+
|
|
361
|
+
`restart()` restarts the shell's own `[path]` input with its own `[initialData]` input — useful for a "Start over" button in a custom footer.
|
|
334
362
|
|
|
335
363
|
Both directives can be combined. Only the sections you override are replaced — a custom header still shows the default footer, and vice versa.
|
|
336
364
|
|
|
337
365
|
---
|
|
338
366
|
|
|
367
|
+
## Sub-Paths
|
|
368
|
+
|
|
369
|
+
Sub-paths allow you to nest multi-step workflows. Common use cases include:
|
|
370
|
+
- Running a child workflow per collection item (e.g., approve each document)
|
|
371
|
+
- Conditional drill-down flows (e.g., "Add payment method" modal)
|
|
372
|
+
- Reusable wizard components
|
|
373
|
+
|
|
374
|
+
### Basic Sub-Path Flow
|
|
375
|
+
|
|
376
|
+
When a sub-path is active:
|
|
377
|
+
- The shell switches to show the sub-path's steps
|
|
378
|
+
- The progress bar displays sub-path steps (not main path steps)
|
|
379
|
+
- Pressing Back on the first sub-path step **cancels** the sub-path and returns to the parent
|
|
380
|
+
- The `PathFacade` (and thus `state$`, `stateSignal`) reflects the **sub-path** snapshot, not the parent's
|
|
381
|
+
|
|
382
|
+
### Complete Example: Approver Collection
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
import { PathData, PathDefinition, PathFacade } from "@daltonr/pathwrite-angular";
|
|
386
|
+
|
|
387
|
+
// Sub-path data shape
|
|
388
|
+
interface ApproverReviewData extends PathData {
|
|
389
|
+
decision: "approve" | "reject" | "";
|
|
390
|
+
comments: string;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Main path data shape
|
|
394
|
+
interface ApprovalWorkflowData extends PathData {
|
|
395
|
+
documentTitle: string;
|
|
396
|
+
approvers: string[];
|
|
397
|
+
approvals: Array<{ approver: string; decision: string; comments: string }>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// Define the sub-path (approver review wizard)
|
|
401
|
+
const approverReviewPath: PathDefinition<ApproverReviewData> = {
|
|
402
|
+
id: "approver-review",
|
|
403
|
+
steps: [
|
|
404
|
+
{ id: "review", title: "Review Document" },
|
|
405
|
+
{
|
|
406
|
+
id: "decision",
|
|
407
|
+
title: "Make Decision",
|
|
408
|
+
canMoveNext: ({ data }) =>
|
|
409
|
+
data.decision === "approve" || data.decision === "reject",
|
|
410
|
+
validationMessages: ({ data }) =>
|
|
411
|
+
!data.decision ? ["Please select Approve or Reject"] : []
|
|
412
|
+
},
|
|
413
|
+
{ id: "comments", title: "Add Comments" }
|
|
414
|
+
]
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// Define the main path
|
|
418
|
+
const approvalWorkflowPath: PathDefinition<ApprovalWorkflowData> = {
|
|
419
|
+
id: "approval-workflow",
|
|
420
|
+
steps: [
|
|
421
|
+
{
|
|
422
|
+
id: "setup",
|
|
423
|
+
title: "Setup Approval",
|
|
424
|
+
canMoveNext: ({ data }) =>
|
|
425
|
+
(data.documentTitle ?? "").trim().length > 0 &&
|
|
426
|
+
data.approvers.length > 0
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
id: "run-approvals",
|
|
430
|
+
title: "Collect Approvals",
|
|
431
|
+
// Block "Next" until all approvers have completed their reviews
|
|
432
|
+
canMoveNext: ({ data }) =>
|
|
433
|
+
data.approvals.length === data.approvers.length,
|
|
434
|
+
validationMessages: ({ data }) => {
|
|
435
|
+
const remaining = data.approvers.length - data.approvals.length;
|
|
436
|
+
return remaining > 0
|
|
437
|
+
? [`${remaining} approver(s) pending review`]
|
|
438
|
+
: [];
|
|
439
|
+
},
|
|
440
|
+
// When an approver finishes their sub-path, record the result
|
|
441
|
+
onSubPathComplete(subPathId, subPathData, ctx, meta) {
|
|
442
|
+
const approverName = meta?.approverName as string;
|
|
443
|
+
const result = subPathData as ApproverReviewData;
|
|
444
|
+
return {
|
|
445
|
+
approvals: [
|
|
446
|
+
...ctx.data.approvals,
|
|
447
|
+
{
|
|
448
|
+
approver: approverName,
|
|
449
|
+
decision: result.decision,
|
|
450
|
+
comments: result.comments
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
};
|
|
454
|
+
},
|
|
455
|
+
// If an approver cancels (presses Back on first step), you can track it
|
|
456
|
+
onSubPathCancel(subPathId, subPathData, ctx, meta) {
|
|
457
|
+
console.log(`${meta?.approverName} cancelled their review`);
|
|
458
|
+
// Optionally return data changes, or just log
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
{ id: "summary", title: "Summary" }
|
|
462
|
+
]
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// Component
|
|
466
|
+
@Component({
|
|
467
|
+
selector: 'app-approval-workflow',
|
|
468
|
+
standalone: true,
|
|
469
|
+
imports: [PathShellComponent, PathStepDirective],
|
|
470
|
+
providers: [PathFacade],
|
|
471
|
+
template: `
|
|
472
|
+
<pw-shell [path]="approvalWorkflowPath" [initialData]="initialData">
|
|
473
|
+
<!-- Main path steps -->
|
|
474
|
+
<ng-template pwStep="setup">
|
|
475
|
+
<input [(ngModel)]="facade.snapshot()!.data.documentTitle" placeholder="Document title" />
|
|
476
|
+
<!-- approver selection UI here -->
|
|
477
|
+
</ng-template>
|
|
478
|
+
|
|
479
|
+
<ng-template pwStep="run-approvals">
|
|
480
|
+
<h3>Approvers</h3>
|
|
481
|
+
<ul>
|
|
482
|
+
@for (approver of facade.snapshot()!.data.approvers; track $index) {
|
|
483
|
+
<li>
|
|
484
|
+
{{ approver }}
|
|
485
|
+
@if (!hasApproval(approver)) {
|
|
486
|
+
<button (click)="launchReviewForApprover(approver, $index)">
|
|
487
|
+
Start Review
|
|
488
|
+
</button>
|
|
489
|
+
} @else {
|
|
490
|
+
<span>✓ {{ getApproval(approver)?.decision }}</span>
|
|
491
|
+
}
|
|
492
|
+
</li>
|
|
493
|
+
}
|
|
494
|
+
</ul>
|
|
495
|
+
</ng-template>
|
|
496
|
+
|
|
497
|
+
<ng-template pwStep="summary">
|
|
498
|
+
<h3>All Approvals Collected</h3>
|
|
499
|
+
<ul>
|
|
500
|
+
@for (approval of facade.snapshot()!.data.approvals; track approval.approver) {
|
|
501
|
+
<li>{{ approval.approver }}: {{ approval.decision }}</li>
|
|
502
|
+
}
|
|
503
|
+
</ul>
|
|
504
|
+
</ng-template>
|
|
505
|
+
|
|
506
|
+
<!-- Sub-path steps (must be co-located in the same pw-shell) -->
|
|
507
|
+
<ng-template pwStep="review">
|
|
508
|
+
<p>Review the document: "{{ facade.snapshot()!.data.documentTitle }}"</p>
|
|
509
|
+
</ng-template>
|
|
510
|
+
|
|
511
|
+
<ng-template pwStep="decision">
|
|
512
|
+
<label><input type="radio" value="approve" [(ngModel)]="facade.snapshot()!.data.decision" /> Approve</label>
|
|
513
|
+
<label><input type="radio" value="reject" [(ngModel)]="facade.snapshot()!.data.decision" /> Reject</label>
|
|
514
|
+
</ng-template>
|
|
515
|
+
|
|
516
|
+
<ng-template pwStep="comments">
|
|
517
|
+
<textarea [(ngModel)]="facade.snapshot()!.data.comments" placeholder="Optional comments"></textarea>
|
|
518
|
+
</ng-template>
|
|
519
|
+
</pw-shell>
|
|
520
|
+
`
|
|
521
|
+
})
|
|
522
|
+
export class ApprovalWorkflowComponent {
|
|
523
|
+
protected readonly facade = inject(PathFacade) as PathFacade<ApprovalWorkflowData>;
|
|
524
|
+
protected readonly approvalWorkflowPath = approvalWorkflowPath;
|
|
525
|
+
protected readonly initialData = { documentTitle: '', approvers: [], approvals: [] };
|
|
526
|
+
|
|
527
|
+
protected launchReviewForApprover(approverName: string, index: number): void {
|
|
528
|
+
// Pass correlation data via `meta` — it's echoed back to onSubPathComplete
|
|
529
|
+
void this.facade.startSubPath(
|
|
530
|
+
approverReviewPath,
|
|
531
|
+
{ decision: "", comments: "" },
|
|
532
|
+
{ approverName, approverIndex: index }
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
protected hasApproval(approver: string): boolean {
|
|
537
|
+
return this.facade.snapshot()!.data.approvals.some(a => a.approver === approver);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
protected getApproval(approver: string) {
|
|
541
|
+
return this.facade.snapshot()!.data.approvals.find(a => a.approver === approver);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Key Notes
|
|
547
|
+
|
|
548
|
+
**1. Sub-path steps must be co-located with main path steps**
|
|
549
|
+
All `pwStep` templates (main path + sub-path steps) live in the same `<pw-shell>`. When a sub-path is active, the shell renders the sub-path's step templates. This means:
|
|
550
|
+
- Parent and sub-path step IDs **must not collide** (e.g., don't use `summary` in both)
|
|
551
|
+
- The shell matches step IDs from the current path only (main or sub), but all templates are registered globally
|
|
552
|
+
|
|
553
|
+
**2. The `meta` correlation field**
|
|
554
|
+
`startSubPath` accepts an optional third argument (`meta`) that is returned unchanged to `onSubPathComplete` and `onSubPathCancel`. Use it to correlate which collection item triggered the sub-path:
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
facade.startSubPath(subPath, initialData, { itemIndex: 3, itemId: "abc" });
|
|
558
|
+
|
|
559
|
+
// In the parent step:
|
|
560
|
+
onSubPathComplete(subPathId, subPathData, ctx, meta) {
|
|
561
|
+
const itemIndex = meta?.itemIndex; // 3
|
|
562
|
+
}
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**3. Progress bar switches during sub-paths**
|
|
566
|
+
When `snapshot.nestingLevel > 0`, you're in a sub-path. The `steps` array in the snapshot contains the sub-path's steps, not the main path's. The default PathShell progress bar shows sub-path progress. You can check `nestingLevel` to show a breadcrumb or "back to main flow" indicator.
|
|
567
|
+
|
|
568
|
+
**4. Accessing parent path data from sub-path components**
|
|
569
|
+
There is currently no way to inject a "parent facade" in sub-path step components. If a sub-path step needs parent data (e.g., the document title), pass it via `initialData` when calling `startSubPath`:
|
|
570
|
+
|
|
571
|
+
```typescript
|
|
572
|
+
facade.startSubPath(approverReviewPath, {
|
|
573
|
+
decision: "",
|
|
574
|
+
comments: "",
|
|
575
|
+
documentTitle: facade.snapshot()!.data.documentTitle // copy from parent
|
|
576
|
+
});
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## Guards and Lifecycle Hooks
|
|
582
|
+
|
|
583
|
+
### Defensive Guards (Important!)
|
|
584
|
+
|
|
585
|
+
**Guards and `validationMessages` are evaluated *before* `onEnter` runs on first entry.**
|
|
586
|
+
|
|
587
|
+
If you access fields in a guard that `onEnter` is supposed to initialize, the guard will throw a `TypeError` on startup. Write guards defensively using nullish coalescing:
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
// ✗ Unsafe — crashes if data.name is undefined
|
|
591
|
+
canMoveNext: ({ data }) => data.name.trim().length > 0
|
|
592
|
+
|
|
593
|
+
// ✓ Safe — handles undefined gracefully
|
|
594
|
+
canMoveNext: ({ data }) => (data.name ?? "").trim().length > 0
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Alternatively, pass `initialData` to `start()` / `<pw-shell>` so all fields are present from the first snapshot:
|
|
598
|
+
|
|
599
|
+
```typescript
|
|
600
|
+
<pw-shell [path]="myPath" [initialData]="{ name: '', age: 0 }" />
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
If a guard throws, the engine catches it, logs a warning, and returns `true` (allow navigation) as a safe default.
|
|
604
|
+
|
|
605
|
+
### Async Guards and Validation Messages
|
|
606
|
+
|
|
607
|
+
Guards and `validationMessages` must be **synchronous** for inclusion in snapshots. Async functions are detected and warned about:
|
|
608
|
+
- Async `canMoveNext` / `canMovePrevious` default to `true` (optimistic)
|
|
609
|
+
- Async `validationMessages` default to `[]`
|
|
610
|
+
|
|
611
|
+
The async version is still enforced during actual navigation (when you call `next()` / `previous()`), but the snapshot won't reflect the pending state. If you need async validation, perform it in the guard and store the result in `data` so the guard can read it synchronously.
|
|
612
|
+
|
|
613
|
+
### `isFirstEntry` Flag
|
|
614
|
+
|
|
615
|
+
The `PathStepContext` passed to all hooks includes an `isFirstEntry: boolean` flag. It's `true` the first time a step is visited, `false` on re-entry (e.g., after navigating back then forward again).
|
|
616
|
+
|
|
617
|
+
Use it to distinguish initialization from re-entry:
|
|
618
|
+
|
|
619
|
+
```typescript
|
|
620
|
+
{
|
|
621
|
+
id: "details",
|
|
622
|
+
onEnter: ({ isFirstEntry, data }) => {
|
|
623
|
+
if (isFirstEntry) {
|
|
624
|
+
// Only pre-fill on first visit, not when returning via Back
|
|
625
|
+
return { name: "Default Name" };
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
**Important:** `onEnter` fires every time you enter the step. If you want "initialize once" behavior, either:
|
|
632
|
+
1. Use `isFirstEntry` to conditionally return data
|
|
633
|
+
2. Provide `initialData` to `start()` instead of using `onEnter`
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
339
637
|
## Styling
|
|
340
638
|
|
|
341
639
|
Import the optional stylesheet for sensible default styles. All visual values are CSS custom properties (`--pw-*`) so you can theme without overriding selectors.
|
|
@@ -365,3 +663,36 @@ Override any `--pw-*` variable to customise the appearance:
|
|
|
365
663
|
--pw-shell-radius: 12px;
|
|
366
664
|
}
|
|
367
665
|
```
|
|
666
|
+
|
|
667
|
+
### Available CSS Custom Properties
|
|
668
|
+
|
|
669
|
+
**Layout:**
|
|
670
|
+
- `--pw-shell-max-width` — Maximum width of the shell (default: `720px`)
|
|
671
|
+
- `--pw-shell-padding` — Internal padding (default: `24px`)
|
|
672
|
+
- `--pw-shell-gap` — Gap between header, body, footer (default: `20px`)
|
|
673
|
+
- `--pw-shell-radius` — Border radius for cards (default: `10px`)
|
|
674
|
+
|
|
675
|
+
**Colors:**
|
|
676
|
+
- `--pw-color-bg` — Background color (default: `#ffffff`)
|
|
677
|
+
- `--pw-color-border` — Border color (default: `#dbe4f0`)
|
|
678
|
+
- `--pw-color-text` — Primary text color (default: `#1f2937`)
|
|
679
|
+
- `--pw-color-muted` — Muted text color (default: `#5b677a`)
|
|
680
|
+
- `--pw-color-primary` — Primary/accent color (default: `#2563eb`)
|
|
681
|
+
- `--pw-color-primary-light` — Light primary for backgrounds (default: `rgba(37, 99, 235, 0.12)`)
|
|
682
|
+
- `--pw-color-btn-bg` — Button background (default: `#f8fbff`)
|
|
683
|
+
- `--pw-color-btn-border` — Button border (default: `#c2d0e5`)
|
|
684
|
+
|
|
685
|
+
**Validation:**
|
|
686
|
+
- `--pw-color-error` — Error text color (default: `#dc2626`)
|
|
687
|
+
- `--pw-color-error-bg` — Error background (default: `#fef2f2`)
|
|
688
|
+
- `--pw-color-error-border` — Error border (default: `#fecaca`)
|
|
689
|
+
|
|
690
|
+
**Progress Indicator:**
|
|
691
|
+
- `--pw-dot-size` — Step dot size (default: `32px`)
|
|
692
|
+
- `--pw-dot-font-size` — Font size inside dots (default: `13px`)
|
|
693
|
+
- `--pw-track-height` — Progress track height (default: `4px`)
|
|
694
|
+
|
|
695
|
+
**Buttons:**
|
|
696
|
+
- `--pw-btn-padding` — Button padding (default: `8px 16px`)
|
|
697
|
+
- `--pw-btn-radius` — Button border radius (default: `6px`)
|
|
698
|
+
|
package/dist/index.css
CHANGED
|
@@ -250,6 +250,16 @@
|
|
|
250
250
|
border-color: #1d4ed8;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
.pw-shell__btn--back {
|
|
254
|
+
background: transparent;
|
|
255
|
+
border-color: var(--pw-color-primary);
|
|
256
|
+
color: var(--pw-color-primary);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.pw-shell__btn--back:hover:not(:disabled) {
|
|
260
|
+
background: var(--pw-color-primary-light);
|
|
261
|
+
}
|
|
262
|
+
|
|
253
263
|
.pw-shell__btn--cancel {
|
|
254
264
|
color: var(--pw-color-muted);
|
|
255
265
|
border-color: transparent;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,13 @@ export declare class PathFacade<TData extends PathData = PathData> implements On
|
|
|
29
29
|
constructor();
|
|
30
30
|
ngOnDestroy(): void;
|
|
31
31
|
start(path: PathDefinition<any>, initialData?: PathData): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Tears down any active path (without firing lifecycle hooks) and immediately
|
|
34
|
+
* starts the given path fresh. Safe to call whether or not a path is running.
|
|
35
|
+
* Use for "Start over" / retry flows without destroying and re-creating the
|
|
36
|
+
* component that provides this facade.
|
|
37
|
+
*/
|
|
38
|
+
restart(path: PathDefinition<any>, initialData?: PathData): Promise<void>;
|
|
32
39
|
startSubPath(path: PathDefinition<any>, initialData?: PathData, meta?: Record<string, unknown>): Promise<void>;
|
|
33
40
|
next(): Promise<void>;
|
|
34
41
|
previous(): Promise<void>;
|
|
@@ -84,3 +91,4 @@ export interface FormGroupLike {
|
|
|
84
91
|
* ```
|
|
85
92
|
*/
|
|
86
93
|
export declare function syncFormGroup<TData extends PathData = PathData>(facade: PathFacade<TData>, formGroup: FormGroupLike, destroyRef?: DestroyRef): () => void;
|
|
94
|
+
export type { PathData, PathDefinition, PathEvent, PathSnapshot, PathStep, PathStepContext, SerializedPathState } from "@daltonr/pathwrite-core";
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,15 @@ export class PathFacade {
|
|
|
46
46
|
start(path, initialData = {}) {
|
|
47
47
|
return this.engine.start(path, initialData);
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Tears down any active path (without firing lifecycle hooks) and immediately
|
|
51
|
+
* starts the given path fresh. Safe to call whether or not a path is running.
|
|
52
|
+
* Use for "Start over" / retry flows without destroying and re-creating the
|
|
53
|
+
* component that provides this facade.
|
|
54
|
+
*/
|
|
55
|
+
restart(path, initialData = {}) {
|
|
56
|
+
return this.engine.restart(path, initialData);
|
|
57
|
+
}
|
|
49
58
|
startSubPath(path, initialData = {}, meta) {
|
|
50
59
|
return this.engine.startSubPath(path, initialData, meta);
|
|
51
60
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,EAAU,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,eAAe,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAGL,UAAU,EAGX,MAAM,yBAAyB,CAAC;;AAEjC;;;;;;;;;;;;;GAaG;AAEH,MAAM,OAAO,UAAU;IAYrB;QAXiB,WAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC1B,YAAO,GAAG,IAAI,eAAe,CAA6B,IAAI,CAAC,CAAC;QAChE,aAAQ,GAAG,IAAI,OAAO,EAAa,CAAC;QAEpC,iBAAY,GAAG,MAAM,CAA6B,IAAI,CAAC,CAAC;QAEzD,WAAM,GAA2C,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7E,YAAO,GAA0B,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;QAC9E,0FAA0F;QAC1E,gBAAW,GAAuC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;QAG/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AAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,yEAAyE;IACzE,WAAW,EAAE,CAAC;IAEd,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAE3E,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACjD,UAAU,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/shell.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface PathShellActions {
|
|
|
14
14
|
goToStep: (stepId: string) => Promise<void>;
|
|
15
15
|
goToStepChecked: (stepId: string) => Promise<void>;
|
|
16
16
|
setData: (key: string, value: unknown) => Promise<void>;
|
|
17
|
+
/** Restart the shell's current path with its current `initialData`. */
|
|
18
|
+
restart: () => Promise<void>;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Structural directive that associates a template with a step ID.
|
package/dist/shell.js
CHANGED
|
@@ -137,6 +137,7 @@ export class PathShellComponent {
|
|
|
137
137
|
goToStep: (id) => this.facade.goToStep(id),
|
|
138
138
|
goToStepChecked: (id) => this.facade.goToStepChecked(id),
|
|
139
139
|
setData: (key, value) => this.facade.setData(key, value),
|
|
140
|
+
restart: () => this.facade.restart(this.path, this.initialData),
|
|
140
141
|
};
|
|
141
142
|
this.destroy$ = new Subject();
|
|
142
143
|
}
|
package/dist/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../src/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EAET,KAAK,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,eAAe,EAIf,MAAM,EACN,QAAQ,EACR,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAA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AAY;sBAAnD,YAAY;uBAAC,wBAAwB;gBACE,YAAY;sBAAnD,YAAY;uBAAC,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daltonr/pathwrite-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Angular adapter for @daltonr/pathwrite-core — RxJS observables, signal-friendly, with optional <pw-shell> default UI.",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@angular/compiler-cli": "^17.0.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@daltonr/pathwrite-core": "^0.
|
|
63
|
+
"@daltonr/pathwrite-core": "^0.4.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -58,6 +58,16 @@ export class PathFacade<TData extends PathData = PathData> implements OnDestroy
|
|
|
58
58
|
return this.engine.start(path, initialData);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Tears down any active path (without firing lifecycle hooks) and immediately
|
|
63
|
+
* starts the given path fresh. Safe to call whether or not a path is running.
|
|
64
|
+
* Use for "Start over" / retry flows without destroying and re-creating the
|
|
65
|
+
* component that provides this facade.
|
|
66
|
+
*/
|
|
67
|
+
public restart(path: PathDefinition<any>, initialData: PathData = {}): Promise<void> {
|
|
68
|
+
return this.engine.restart(path, initialData);
|
|
69
|
+
}
|
|
70
|
+
|
|
61
71
|
public startSubPath(path: PathDefinition<any>, initialData: PathData = {}, meta?: Record<string, unknown>): Promise<void> {
|
|
62
72
|
return this.engine.startSubPath(path, initialData, meta);
|
|
63
73
|
}
|
|
@@ -162,3 +172,15 @@ export function syncFormGroup<TData extends PathData = PathData>(
|
|
|
162
172
|
destroyRef?.onDestroy(cleanup);
|
|
163
173
|
return cleanup;
|
|
164
174
|
}
|
|
175
|
+
|
|
176
|
+
// Re-export core types for convenience (users don't need to import from @daltonr/pathwrite-core)
|
|
177
|
+
export type {
|
|
178
|
+
PathData,
|
|
179
|
+
PathDefinition,
|
|
180
|
+
PathEvent,
|
|
181
|
+
PathSnapshot,
|
|
182
|
+
PathStep,
|
|
183
|
+
PathStepContext,
|
|
184
|
+
SerializedPathState
|
|
185
|
+
} from "@daltonr/pathwrite-core";
|
|
186
|
+
|
package/src/shell.ts
CHANGED
|
@@ -41,6 +41,8 @@ export interface PathShellActions {
|
|
|
41
41
|
goToStep: (stepId: string) => Promise<void>;
|
|
42
42
|
goToStepChecked: (stepId: string) => Promise<void>;
|
|
43
43
|
setData: (key: string, value: unknown) => Promise<void>;
|
|
44
|
+
/** Restart the shell's current path with its current `initialData`. */
|
|
45
|
+
restart: () => Promise<void>;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
// ---------------------------------------------------------------------------
|
|
@@ -259,6 +261,7 @@ export class PathShellComponent implements OnInit, OnDestroy {
|
|
|
259
261
|
goToStep: (id) => this.facade.goToStep(id),
|
|
260
262
|
goToStepChecked: (id) => this.facade.goToStepChecked(id),
|
|
261
263
|
setData: (key, value) => this.facade.setData(key, value as never),
|
|
264
|
+
restart: () => this.facade.restart(this.path, this.initialData),
|
|
262
265
|
};
|
|
263
266
|
|
|
264
267
|
private readonly destroy$ = new Subject<void>();
|