mn-angular-lib 2.0.56 → 2.0.58

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.
@@ -378,6 +378,36 @@ export declare class MnWizardBodyComponent implements OnInit, AfterViewInit, OnD
378
378
  isCurrentStepValid: boolean;
379
379
  isCompleting: boolean;
380
380
  wizardErrors: Record<string, string>;
381
+ /**
382
+ * Browser-history entries this wizard has below and including the current one,
383
+ * so Back steps the wizard instead of leaving the host page (em8TA5ZU).
384
+ * Always the current entry's position + 1; cleaned up on destroy / dismiss.
385
+ */
386
+ private historyDepth;
387
+ /** Set while our own history.back() is in flight, so its popstate is consumed. */
388
+ private ignorePopstate;
389
+ /** Settles a pending {@link unwindWizardHistory} once its popstate arrives. */
390
+ private resolveUnwind?;
391
+ /** How long Complete waits for the unwind's popstate before running anyway. */
392
+ private static readonly UNWIND_FALLBACK_MS;
393
+ /** history.state key holding the step id of a wizard entry. */
394
+ private static readonly HISTORY_STATE_KEY;
395
+ /**
396
+ * history.state key holding a wizard entry's position (0 = first). It tells
397
+ * Back from Forward: popstate has no direction, and in a free-flow wizard the
398
+ * trail of visited steps is not the visible step order.
399
+ */
400
+ private static readonly HISTORY_POS_KEY;
401
+ /**
402
+ * history.state key holding the id of the wizard that pushed the entry. An
403
+ * entry another wizard left behind (one that closed without unwinding) is
404
+ * then never mistaken for one of ours.
405
+ */
406
+ private static readonly HISTORY_ID_KEY;
407
+ /** Source of {@link historyId}; one per wizard opened in this page. */
408
+ private static nextHistoryId;
409
+ /** This wizard's id in its history entries. */
410
+ private readonly historyId;
381
411
  /**
382
412
  * Min-height (px) for the step container, sized to the tallest step so the
383
413
  * modal does not jump when navigating between steps. Monotonic — only grows.
@@ -405,6 +435,37 @@ export declare class MnWizardBodyComponent implements OnInit, AfterViewInit, OnD
405
435
  private statusSubscription?;
406
436
  private formBodiesSubscription?;
407
437
  ngOnInit(): void;
438
+ /** Builds the history.state for a wizard entry at `pos` showing the current step. */
439
+ private wizardHistoryState;
440
+ /** Whether the current history entry is one this wizard pushed. */
441
+ private isOwnHistoryEntry;
442
+ /** Push a history entry for the current step so browser Back stays inside the wizard. */
443
+ private pushWizardHistory;
444
+ /**
445
+ * Re-points the current wizard entry at the step on screen. The UI Back button
446
+ * goes to the previous *visible* step, which after a free-flow jump is not the
447
+ * step the entry underneath was pushed for.
448
+ */
449
+ private syncWizardHistoryEntry;
450
+ /**
451
+ * Browser Back / Forward (em8TA5ZU): show the step the entry was pushed for.
452
+ * The entry's position, compared to {@link historyDepth}, says which way the
453
+ * browser moved; leaving the first entry closes the wizard.
454
+ */
455
+ onBrowserBack(): void;
456
+ /**
457
+ * Apply a browser Forward. History has already advanced, so a step that may
458
+ * not be left (invalid form, guard, validator) sends the browser back again.
459
+ * @param stepId The step the restored entry was pushed for.
460
+ * @param fromDepth {@link historyDepth} before the Forward, restored on refusal.
461
+ */
462
+ private applyHistoryForward;
463
+ /**
464
+ * Apply a browser Back without touching history (history already moved).
465
+ * @param stepId The step the restored entry was pushed for.
466
+ */
467
+ private applyHistoryBack;
468
+ private dismissFromBrowserBack;
408
469
  ngAfterViewInit(): void;
409
470
  isTextBody(step: WizardStepConfig): boolean;
410
471
  /**
@@ -416,6 +477,22 @@ export declare class MnWizardBodyComponent implements OnInit, AfterViewInit, OnD
416
477
  private buildStepBodyConfig;
417
478
  goToStep(step: WizardStepConfig): Promise<void>;
418
479
  ngOnDestroy(): void;
480
+ /**
481
+ * Removes every entry this wizard pushed and waits until the browser is back
482
+ * on the host entry. Complete runs it *before* the completion handler, so a
483
+ * handler that navigates pushes its page right after the host entry instead
484
+ * of on top of the wizard's entries, which would leave dead Back presses.
485
+ * Resolves on the resulting popstate, or after a short fallback when none
486
+ * arrives (no history API, or a test stub).
487
+ */
488
+ private unwindWizardHistory;
489
+ /**
490
+ * Gives browser Back an entry to step on again after Complete unwound history
491
+ * but the wizard stays open (the handler returned `false` or threw).
492
+ */
493
+ private restoreWizardHistoryEntry;
494
+ /** Remove history entries we pushed when the wizard closes via Complete / X / Cancel. */
495
+ private dropWizardHistory;
419
496
  /**
420
497
  * Measures every step's natural height and records the tallest as
421
498
  * {@link measuredMinHeight}. Monotonic: the value only ever grows, so a
@@ -450,11 +527,29 @@ export declare class MnWizardBodyComponent implements OnInit, AfterViewInit, OnD
450
527
  get currentProgressIndex(): number;
451
528
  get isFreeFlow(): boolean;
452
529
  canNavigateToStep(step: WizardStepConfig): boolean;
530
+ /**
531
+ * Whether the current step may be left going forward: its form is valid
532
+ * (touching every field when not), its exit guard allows it and its
533
+ * validators pass. Shared by Next and browser Forward.
534
+ */
535
+ private canLeaveCurrentStep;
536
+ /**
537
+ * Whether `step`'s enter guard lets the user in.
538
+ * @param step The step about to become current.
539
+ */
540
+ private canEnterStep;
453
541
  next(): Promise<void>;
454
542
  /** Find the MnFormBodyComponent for the current step */
455
543
  private getCurrentFormBody;
456
544
  private trackCurrentStepValidity;
457
545
  back(): Promise<void>;
546
+ /**
547
+ * Keeps history in step with the UI Back button. Pops one entry (ignoring the
548
+ * resulting popstate, which then re-points the exposed entry at this step),
549
+ * but never the first one: after a free-flow jump the wizard can still go back
550
+ * while only one entry is ours, so that entry is re-pointed instead.
551
+ */
552
+ private popWizardHistoryEntry;
458
553
  /**
459
554
  * Activates a step and mirrors its title into {@link currentStepTitle} so the
460
555
  * shell can reflect the step name in the modal title on small screens.
@@ -86,147 +86,7 @@ export declare const mnSegmentedVariants: import("tailwind-variants").TVReturnTy
86
86
  }, {
87
87
  root: string;
88
88
  segment: string;
89
- }, undefined, {
90
- /**
91
- * Corner rounding of the track. The segments are rounded one step tighter
92
- * (see `SEGMENT_RADIUS` on the component) so a filled segment nests inside
93
- * the track's own corner instead of poking out of it. Token names match
94
- * mn-button's; `full` makes a pill, where track and segment share the same
95
- * fully-rounded ends.
96
- */
97
- borderRadius: {
98
- none: {
99
- root: string;
100
- };
101
- xs: {
102
- root: string;
103
- };
104
- sm: {
105
- root: string;
106
- };
107
- md: {
108
- root: string;
109
- };
110
- lg: {
111
- root: string;
112
- };
113
- xl: {
114
- root: string;
115
- };
116
- two_xl: {
117
- root: string;
118
- };
119
- three_xl: {
120
- root: string;
121
- };
122
- four_xl: {
123
- root: string;
124
- };
125
- full: {
126
- root: string;
127
- };
128
- };
129
- /**
130
- * Stretch the track and share its width evenly between the segments.
131
- *
132
- * The segments grow from a zero basis but keep their automatic minimum, so a
133
- * justified control inside an auto-width parent still asks for the room its
134
- * labels need. Letting them shrink below their content (`min-w-0`) made the
135
- * parent resolve to a narrower box and truncated the labels instead.
136
- */
137
- justified: {
138
- true: {
139
- root: string;
140
- segment: string;
141
- };
142
- false: {};
143
- };
144
- /**
145
- * Whether the segment is the picked one. The colours come from the button
146
- * itself (a filled primary button when active, a ghost one otherwise); this
147
- * only keeps an inactive segment's box the same size as an active one, whose
148
- * fill variant carries a real border.
149
- */
150
- active: {
151
- true: {};
152
- false: {
153
- segment: string;
154
- };
155
- };
156
- }, {
157
- root: string;
158
- segment: string;
159
- }, import("tailwind-variants").TVReturnTypeLike<{
160
- /**
161
- * Corner rounding of the track. The segments are rounded one step tighter
162
- * (see `SEGMENT_RADIUS` on the component) so a filled segment nests inside
163
- * the track's own corner instead of poking out of it. Token names match
164
- * mn-button's; `full` makes a pill, where track and segment share the same
165
- * fully-rounded ends.
166
- */
167
- borderRadius: {
168
- none: {
169
- root: string;
170
- };
171
- xs: {
172
- root: string;
173
- };
174
- sm: {
175
- root: string;
176
- };
177
- md: {
178
- root: string;
179
- };
180
- lg: {
181
- root: string;
182
- };
183
- xl: {
184
- root: string;
185
- };
186
- two_xl: {
187
- root: string;
188
- };
189
- three_xl: {
190
- root: string;
191
- };
192
- four_xl: {
193
- root: string;
194
- };
195
- full: {
196
- root: string;
197
- };
198
- };
199
- /**
200
- * Stretch the track and share its width evenly between the segments.
201
- *
202
- * The segments grow from a zero basis but keep their automatic minimum, so a
203
- * justified control inside an auto-width parent still asks for the room its
204
- * labels need. Letting them shrink below their content (`min-w-0`) made the
205
- * parent resolve to a narrower box and truncated the labels instead.
206
- */
207
- justified: {
208
- true: {
209
- root: string;
210
- segment: string;
211
- };
212
- false: {};
213
- };
214
- /**
215
- * Whether the segment is the picked one. The colours come from the button
216
- * itself (a filled primary button when active, a ghost one otherwise); this
217
- * only keeps an inactive segment's box the same size as an active one, whose
218
- * fill variant carries a real border.
219
- */
220
- active: {
221
- true: {};
222
- false: {
223
- segment: string;
224
- };
225
- };
226
- }, {
227
- root: string;
228
- segment: string;
229
- }>>;
89
+ }, undefined, undefined, undefined, undefined>;
230
90
  export type MnSegmentedVariants = VariantProps<typeof mnSegmentedVariants>;
231
91
  /**
232
92
  * One choice in a {@link MnSegmented} control.
@@ -318,33 +178,45 @@ export declare class MnSegmented {
318
178
  private readonly lang;
319
179
  /** Resolved slot classes for the current rounding and layout. */
320
180
  get styles(): {
321
- root: (slotProps?: ({
181
+ root: (slotProps?: {
182
+ borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "two_xl" | "three_xl" | "four_xl" | "full" | undefined;
183
+ justified?: boolean | undefined;
184
+ active?: boolean | undefined;
185
+ class?: import("tailwind-variants").ClassNameValue;
186
+ className?: never | undefined;
187
+ } | {
322
188
  borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "two_xl" | "three_xl" | "four_xl" | "full" | undefined;
323
189
  justified?: boolean | undefined;
324
190
  active?: boolean | undefined;
325
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
326
- segment: (slotProps?: ({
191
+ class?: never | undefined;
192
+ className?: import("tailwind-variants").ClassNameValue;
193
+ } | undefined) => string;
194
+ segment: (slotProps?: {
327
195
  borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "two_xl" | "three_xl" | "four_xl" | "full" | undefined;
328
196
  justified?: boolean | undefined;
329
197
  active?: boolean | undefined;
330
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
331
- } & {
332
- root: (slotProps?: ({
198
+ class?: import("tailwind-variants").ClassNameValue;
199
+ className?: never | undefined;
200
+ } | {
333
201
  borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "two_xl" | "three_xl" | "four_xl" | "full" | undefined;
334
202
  justified?: boolean | undefined;
335
203
  active?: boolean | undefined;
336
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
337
- segment: (slotProps?: ({
204
+ class?: never | undefined;
205
+ className?: import("tailwind-variants").ClassNameValue;
206
+ } | undefined) => string;
207
+ base: (slotProps?: {
338
208
  borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "two_xl" | "three_xl" | "four_xl" | "full" | undefined;
339
209
  justified?: boolean | undefined;
340
210
  active?: boolean | undefined;
341
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
342
- } & {
343
- base: (slotProps?: ({
211
+ class?: import("tailwind-variants").ClassNameValue;
212
+ className?: never | undefined;
213
+ } | {
344
214
  borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "two_xl" | "three_xl" | "four_xl" | "full" | undefined;
345
215
  justified?: boolean | undefined;
346
216
  active?: boolean | undefined;
347
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
217
+ class?: never | undefined;
218
+ className?: import("tailwind-variants").ClassNameValue;
219
+ } | undefined) => string;
348
220
  };
349
221
  /** Icon edge length matching the control's text size. */
350
222
  get iconSize(): number;