@rdlabo/ionic-angular-kit 0.0.5 → 0.0.6
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
CHANGED
|
@@ -147,6 +147,12 @@ presentModal<O>(
|
|
|
147
147
|
options?: KitModalPresentOptions, // Omit<ModalOptions, 'component'|'componentProps'> + watchKeyboard?
|
|
148
148
|
): Promise<O | undefined>
|
|
149
149
|
|
|
150
|
+
presentPopover<O>(
|
|
151
|
+
component: PopoverOptions['component'],
|
|
152
|
+
componentProps?: PopoverOptions['componentProps'],
|
|
153
|
+
options?: Omit<PopoverOptions, 'component'|'componentProps'>, // e.g. { event } to anchor it
|
|
154
|
+
): Promise<O | undefined>
|
|
155
|
+
|
|
150
156
|
presentToast(options: ToastOptions): Promise<HTMLIonToastElement>
|
|
151
157
|
// kit defaults: position='top', duration=2000, swipeGesture='vertical'
|
|
152
158
|
// caller options spread over the defaults — any field can be overridden
|
|
@@ -163,6 +169,16 @@ alertConfirm(options: {
|
|
|
163
169
|
|
|
164
170
|
`watchKeyboard: true` (on `presentModal` options) expands a bottom sheet to full height when the native keyboard appears (iOS/Android only; no-op on web).
|
|
165
171
|
|
|
172
|
+
**Best practice — the modal launcher pattern.** Never call `modalController.create(...)` inline in a component. Instead, each modal/popover page exports a typed launcher next to itself and every call site goes through `KitOverlayController`:
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// detail.page.ts
|
|
176
|
+
export const launchDetailPage = (overlay: KitOverlayController, props: DetailProps): Promise<DetailResult | undefined> =>
|
|
177
|
+
overlay.presentModal<DetailResult>(DetailPage, props, { backdropDismiss: false });
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
This centralizes presentation options, keeps component props and dismiss data type-safe, and makes every modal discoverable. A well-disciplined app has **zero** inline `controller.create()` calls.
|
|
181
|
+
|
|
166
182
|
---
|
|
167
183
|
|
|
168
184
|
### Auth guards + provideKitAuth
|
|
@@ -359,6 +375,58 @@ The directive is a no-op on non-iOS platforms.
|
|
|
359
375
|
|
|
360
376
|
---
|
|
361
377
|
|
|
378
|
+
### KitKeyboardController
|
|
379
|
+
|
|
380
|
+
Registers native keyboard show/hide listeners that reposition an element when the soft keyboard appears — useful for a footer input bar that must stay above the keyboard. A no-op on web (`init` returns `[]`); on native it handles the iOS/Android differences. Three adjustment strategies:
|
|
381
|
+
|
|
382
|
+
- `transform` — `translateY(-keyboardHeight + safeAreaBottom)` (smooth iOS animation; typical for `ion-footer`)
|
|
383
|
+
- `offset` — sets the `--offset-bottom` custom property
|
|
384
|
+
- `keyboard-offset` — sets the `--padding-bottom` custom property
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
import { KitKeyboardController } from '@rdlabo/ionic-angular-kit';
|
|
388
|
+
|
|
389
|
+
export class ComposePage {
|
|
390
|
+
readonly #keyboard = inject(KitKeyboardController);
|
|
391
|
+
readonly #footer = viewChild.required<ElementRef>('footer');
|
|
392
|
+
#handles: PluginListenerHandle[] = [];
|
|
393
|
+
|
|
394
|
+
async ngAfterViewInit() {
|
|
395
|
+
this.#handles = await this.#keyboard.init(this.#footer(), 'transform');
|
|
396
|
+
}
|
|
397
|
+
ngOnDestroy() {
|
|
398
|
+
this.#handles.forEach((h) => h.remove()); // caller owns the handles
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
### Utilities
|
|
406
|
+
|
|
407
|
+
Framework-agnostic helpers (no DI required unless noted):
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
import { kitImpact, arrayConcatById, objectEqual, disableHandler } from '@rdlabo/ionic-angular-kit';
|
|
411
|
+
|
|
412
|
+
// Native light haptic (no-op on web).
|
|
413
|
+
await kitImpact();
|
|
414
|
+
|
|
415
|
+
// Merge a paginated page into an existing list by numeric id, sorted; new items win on duplicates.
|
|
416
|
+
// Optional 5th arg `secondaryKey` drops old items sharing that secondary field with any new item.
|
|
417
|
+
const merged = arrayConcatById(loaded, nextPage, 'id', 'DESC', 'parentId');
|
|
418
|
+
|
|
419
|
+
// Order-independent deep equality (sorted-entries JSON) for cheap "did this state change?" checks.
|
|
420
|
+
if (!objectEqual(prev, next)) { /* changed */ }
|
|
421
|
+
|
|
422
|
+
// Disable the clicked button while an async op runs, re-enabling it after (even on error).
|
|
423
|
+
async onSubmit(event: Event) {
|
|
424
|
+
await disableHandler(event, this.save());
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
362
430
|
## Consumer Vitest setup notes
|
|
363
431
|
|
|
364
432
|
When testing a consumer app that declares `@rdlabo/ionic-angular-kit` as a `file:` symlink dependency, add the following to your `vitest.config.ts`:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, InjectionToken, makeEnvironmentProviders, ElementRef, Directive } from '@angular/core';
|
|
2
|
+
import { inject, Injectable, InjectionToken, makeEnvironmentProviders, ElementRef, Directive, DOCUMENT } from '@angular/core';
|
|
3
3
|
import { Storage } from '@ionic/storage-angular';
|
|
4
|
-
import { ModalController, ToastController, AlertController, NavController } from '@ionic/angular/standalone';
|
|
4
|
+
import { ModalController, PopoverController, ToastController, AlertController, Platform, NavController } from '@ionic/angular/standalone';
|
|
5
5
|
import { Capacitor } from '@capacitor/core';
|
|
6
6
|
import { Keyboard } from '@capacitor/keyboard';
|
|
7
7
|
import { ImpactStyle, Haptics } from '@capacitor/haptics';
|
|
@@ -189,6 +189,7 @@ const watchModalKeyboard = async (modal) => {
|
|
|
189
189
|
*/
|
|
190
190
|
class KitOverlayController {
|
|
191
191
|
#modalCtrl = inject(ModalController);
|
|
192
|
+
#popoverCtrl = inject(PopoverController);
|
|
192
193
|
#toastCtrl = inject(ToastController);
|
|
193
194
|
#alertCtrl = inject(AlertController);
|
|
194
195
|
#labels = inject(KIT_OVERLAY_CONFIG).labels;
|
|
@@ -214,6 +215,25 @@ class KitOverlayController {
|
|
|
214
215
|
await handle?.remove();
|
|
215
216
|
return data;
|
|
216
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Present a popover and resolve with the data passed to its dismissal.
|
|
220
|
+
*
|
|
221
|
+
* @typeParam O - type of the data returned when the popover is dismissed
|
|
222
|
+
* @param component - the component to render inside the popover
|
|
223
|
+
* @param componentProps - props to pass to the popover component
|
|
224
|
+
* @param options - additional popover options (for example `event` to anchor it, or `cssClass`)
|
|
225
|
+
* @returns the dismiss data, or `undefined` when the popover is dismissed without data
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* const choice = await overlay.presentPopover<MenuChoice>(MenuPopover, { items }, { event });
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
async presentPopover(component, componentProps, options = {}) {
|
|
232
|
+
const popover = await this.#popoverCtrl.create({ component, componentProps, ...options });
|
|
233
|
+
await popover.present();
|
|
234
|
+
const { data } = await popover.onDidDismiss();
|
|
235
|
+
return data;
|
|
236
|
+
}
|
|
217
237
|
/**
|
|
218
238
|
* Present a toast using kit defaults that the caller may override.
|
|
219
239
|
*
|
|
@@ -508,6 +528,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
508
528
|
}]
|
|
509
529
|
}], ctorParameters: () => [] });
|
|
510
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Registers native keyboard listeners that reposition an element when the keyboard shows/hides.
|
|
533
|
+
*
|
|
534
|
+
* @remarks
|
|
535
|
+
* A no-op on non-hybrid (web) platforms — `init` returns an empty handle list. On native it handles
|
|
536
|
+
* iOS and Android differences (Android only toggles the `footer-toolbar-padding` class on an
|
|
537
|
+
* `ion-footer` for the `transform` mode, working around an Ionic footer bug). The caller owns the
|
|
538
|
+
* returned handles and must `remove()` them when the view is destroyed.
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```ts
|
|
542
|
+
* export class ComposePage {
|
|
543
|
+
* readonly #keyboard = inject(KitKeyboardController);
|
|
544
|
+
* readonly #footer = viewChild.required<ElementRef>('footer');
|
|
545
|
+
* #handles: PluginListenerHandle[] = [];
|
|
546
|
+
*
|
|
547
|
+
* async ngAfterViewInit() {
|
|
548
|
+
* this.#handles = await this.#keyboard.init(this.#footer(), 'transform');
|
|
549
|
+
* }
|
|
550
|
+
* ngOnDestroy() {
|
|
551
|
+
* this.#handles.forEach((h) => h.remove());
|
|
552
|
+
* }
|
|
553
|
+
* }
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
class KitKeyboardController {
|
|
557
|
+
#platform = inject(Platform);
|
|
558
|
+
#document = inject(DOCUMENT);
|
|
559
|
+
/**
|
|
560
|
+
* Attach keyboard show/hide listeners that adjust `elementRef` per `type`.
|
|
561
|
+
*
|
|
562
|
+
* @param elementRef - The element to reposition (e.g. an `ion-footer`).
|
|
563
|
+
* @param type - The adjustment strategy; see {@link KitKeyboardAdjust}.
|
|
564
|
+
* @returns The registered listener handles (empty on non-native platforms).
|
|
565
|
+
*/
|
|
566
|
+
async init(elementRef, type) {
|
|
567
|
+
if (!this.#platform.is('hybrid')) {
|
|
568
|
+
return [];
|
|
569
|
+
}
|
|
570
|
+
return [
|
|
571
|
+
await this.#keyboardWillShow(elementRef, type),
|
|
572
|
+
await this.#keyboardWillHide(elementRef, type),
|
|
573
|
+
await this.#keyboardDidShow(elementRef),
|
|
574
|
+
await this.#keyboardDidHide(elementRef),
|
|
575
|
+
];
|
|
576
|
+
}
|
|
577
|
+
#keyboardWillShow(elementRef, type) {
|
|
578
|
+
return Keyboard.addListener('keyboardWillShow', (info) => {
|
|
579
|
+
if (this.#platform.is('android')) {
|
|
580
|
+
if (elementRef.nativeElement.tagName === 'ION-FOOTER' && type === 'transform') {
|
|
581
|
+
// https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/footer/footer.tsx
|
|
582
|
+
elementRef.nativeElement.classList.remove('footer-toolbar-padding');
|
|
583
|
+
}
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
elementRef.nativeElement.classList.add('show-keyboard');
|
|
587
|
+
const bodyStyleDeclaration = window.getComputedStyle(this.#document.querySelector('body'));
|
|
588
|
+
const safeArea = parseInt(bodyStyleDeclaration.getPropertyValue('--ion-safe-area-bottom'), 10);
|
|
589
|
+
if (type === 'transform') {
|
|
590
|
+
elementRef.nativeElement.style.transition = 'transform 420ms';
|
|
591
|
+
elementRef.nativeElement.style.willChange = 'transform';
|
|
592
|
+
requestAnimationFrame(() => (elementRef.nativeElement.style.transform = `translateY(${info.keyboardHeight * -1 + safeArea}px)`));
|
|
593
|
+
}
|
|
594
|
+
else if (type === 'offset') {
|
|
595
|
+
requestAnimationFrame(() => {
|
|
596
|
+
const keyboardOffset = elementRef.nativeElement.style.getPropertyValue('--keyboard-offset');
|
|
597
|
+
if (!keyboardOffset || parseInt(keyboardOffset, 10) === 0) {
|
|
598
|
+
elementRef.nativeElement.style.setProperty('--offset-bottom', `${info.keyboardHeight * -1}px`);
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
requestAnimationFrame(() => {
|
|
604
|
+
const keyboardOffset = elementRef.nativeElement.style.getPropertyValue('--keyboard-offset');
|
|
605
|
+
if (!keyboardOffset || parseInt(keyboardOffset, 10) === 0) {
|
|
606
|
+
elementRef.nativeElement.style.setProperty('--padding-bottom', `${info.keyboardHeight}px`);
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
#keyboardWillHide(elementRef, type) {
|
|
613
|
+
return Keyboard.addListener('keyboardWillHide', () => {
|
|
614
|
+
if (this.#platform.is('android')) {
|
|
615
|
+
if (elementRef.nativeElement.tagName === 'ION-FOOTER' && type === 'transform') {
|
|
616
|
+
elementRef.nativeElement.classList.add('footer-toolbar-padding');
|
|
617
|
+
}
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
elementRef.nativeElement.classList.remove('show-keyboard');
|
|
621
|
+
if (type === 'transform') {
|
|
622
|
+
elementRef.nativeElement.style.transition = 'transform 0ms';
|
|
623
|
+
elementRef.nativeElement.style.transform = `translateY(0px)`;
|
|
624
|
+
elementRef.nativeElement.style.willChange = 'transform';
|
|
625
|
+
}
|
|
626
|
+
else if (type === 'offset') {
|
|
627
|
+
elementRef.nativeElement.style.setProperty('--offset-bottom', '0px');
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
elementRef.nativeElement.style.setProperty('--padding-bottom', '0px');
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
#keyboardDidShow(elementRef) {
|
|
635
|
+
return Keyboard.addListener('keyboardDidShow', () => {
|
|
636
|
+
elementRef.nativeElement.style.willChange = 'auto';
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
#keyboardDidHide(elementRef) {
|
|
640
|
+
return Keyboard.addListener('keyboardDidHide', () => {
|
|
641
|
+
elementRef.nativeElement.style.willChange = 'auto';
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: KitKeyboardController, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
645
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: KitKeyboardController, providedIn: 'root' }); }
|
|
646
|
+
}
|
|
647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: KitKeyboardController, decorators: [{
|
|
648
|
+
type: Injectable,
|
|
649
|
+
args: [{
|
|
650
|
+
providedIn: 'root',
|
|
651
|
+
}]
|
|
652
|
+
}] });
|
|
653
|
+
|
|
511
654
|
/**
|
|
512
655
|
* Injection token that carries the {@link KitAuthConfig} to the authentication guards.
|
|
513
656
|
*/
|
|
@@ -786,6 +929,10 @@ const kitAuthInterceptor = (request, next) => {
|
|
|
786
929
|
* items replace, and its items take precedence on duplicates.
|
|
787
930
|
* @param key - The property of `T` used as the unique, numeric id for matching, range filtering, and sorting.
|
|
788
931
|
* @param order - Sort direction by `key`: `'ASC'` for ascending or `'DESC'` for descending. Defaults to `'DESC'`.
|
|
932
|
+
* @param secondaryKey - Optional second property for extra de-duplication. When provided, any
|
|
933
|
+
* surviving old item whose `secondaryKey` value matches that of *any* new item is dropped before
|
|
934
|
+
* the `key` merge. Useful when a record keeps a stable `key` but its secondary identity changes
|
|
935
|
+
* between pages (e.g. items keyed by `id` but also grouped by `parentId`). Omit to skip this step.
|
|
789
936
|
* @returns A new array containing `arrayNew` merged with the out-of-window, non-duplicate old items, sorted by `key`.
|
|
790
937
|
* @example
|
|
791
938
|
* ```ts
|
|
@@ -810,7 +957,7 @@ const kitAuthInterceptor = (request, next) => {
|
|
|
810
957
|
* // => [{ id: 30, title: 'c' }, { id: 20, title: 'b (updated)' }, { id: 15, title: 'a.5' }, { id: 10, title: 'a' }]
|
|
811
958
|
* ```
|
|
812
959
|
*/
|
|
813
|
-
const arrayConcatById = (arrayOld, arrayNew, key, order = 'DESC') => {
|
|
960
|
+
const arrayConcatById = (arrayOld, arrayNew, key, order = 'DESC', secondaryKey) => {
|
|
814
961
|
if (!arrayNew.length && !arrayOld.length) {
|
|
815
962
|
return [];
|
|
816
963
|
}
|
|
@@ -820,7 +967,10 @@ const arrayConcatById = (arrayOld, arrayNew, key, order = 'DESC') => {
|
|
|
820
967
|
const value = vol[key];
|
|
821
968
|
return (lead > last && (value >= lead || value <= last)) || (lead < last && (value <= lead || value >= last)) || lead === last;
|
|
822
969
|
});
|
|
823
|
-
const
|
|
970
|
+
const secondaryFilteredOld = secondaryKey
|
|
971
|
+
? filteredOld.filter((vol) => !arrayNew.some((element) => element[secondaryKey] === vol[secondaryKey]))
|
|
972
|
+
: filteredOld;
|
|
973
|
+
const oldData = secondaryFilteredOld.filter((vol) => !arrayNew.some((element) => element[key] === vol[key]));
|
|
824
974
|
const data = arrayNew.concat(oldData);
|
|
825
975
|
const direction = order === 'ASC' ? 1 : -1;
|
|
826
976
|
return data.sort((a, b) => {
|
|
@@ -836,6 +986,68 @@ const arrayConcatById = (arrayOld, arrayNew, key, order = 'DESC') => {
|
|
|
836
986
|
});
|
|
837
987
|
};
|
|
838
988
|
|
|
989
|
+
/**
|
|
990
|
+
* Order-independent deep equality check.
|
|
991
|
+
*
|
|
992
|
+
* @remarks
|
|
993
|
+
* Returns `true` when `a` and `b` serialize to the same value after their (nested) object entries are
|
|
994
|
+
* sorted by key, so property order does not affect the result. Intended for cheap "did this state
|
|
995
|
+
* object change?" comparisons.
|
|
996
|
+
*
|
|
997
|
+
* Caveats of the JSON-serialization approach: values that JSON drops or coerces (`undefined`,
|
|
998
|
+
* functions, `NaN`, `Date`, `Map`/`Set`) are compared by their serialized form, and array element
|
|
999
|
+
* order is treated as significant (arrays are not reordered in a meaningful way). Use a structural
|
|
1000
|
+
* deep-equal library when those cases matter.
|
|
1001
|
+
*
|
|
1002
|
+
* @param a - First object.
|
|
1003
|
+
* @param b - Second object.
|
|
1004
|
+
* @returns `true` when the two objects are deeply equal ignoring key order.
|
|
1005
|
+
* @example
|
|
1006
|
+
* ```ts
|
|
1007
|
+
* objectEqual({ a: 1, b: 2 }, { b: 2, a: 1 }); // => true
|
|
1008
|
+
* objectEqual({ a: 1 }, { a: 2 }); // => false
|
|
1009
|
+
* ```
|
|
1010
|
+
*/
|
|
1011
|
+
const objectEqual = (a, b) => {
|
|
1012
|
+
if (Object.is(a, b)) {
|
|
1013
|
+
return true;
|
|
1014
|
+
}
|
|
1015
|
+
const sortDeep = (obj) => {
|
|
1016
|
+
if (typeof obj !== 'object' || !obj) {
|
|
1017
|
+
return undefined;
|
|
1018
|
+
}
|
|
1019
|
+
return Object.entries(obj)
|
|
1020
|
+
.sort()
|
|
1021
|
+
.map(([entryKey, value]) => [entryKey, typeof value === 'object' ? sortDeep(value) : value]);
|
|
1022
|
+
};
|
|
1023
|
+
return JSON.stringify(sortDeep(a)) === JSON.stringify(sortDeep(b));
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Disable the button that triggered an event while an async operation runs, re-enabling it after.
|
|
1028
|
+
*
|
|
1029
|
+
* @remarks
|
|
1030
|
+
* Prevents the common double-submit / double-tap bug: the `event.target` button is disabled, the
|
|
1031
|
+
* work is awaited, and the button is re-enabled — even if the work rejects (the rejection is
|
|
1032
|
+
* swallowed here so the button always recovers; handle errors inside `work` if you need to react).
|
|
1033
|
+
*
|
|
1034
|
+
* @param event - The DOM event whose `target` is the button to disable (e.g. a click event).
|
|
1035
|
+
* @param work - The async operation to run while the button is disabled.
|
|
1036
|
+
* @returns A Promise that resolves once the work has settled and the button has been re-enabled.
|
|
1037
|
+
* @example
|
|
1038
|
+
* ```ts
|
|
1039
|
+
* async submit(event: Event): Promise<void> {
|
|
1040
|
+
* await disableHandler(event, this.save());
|
|
1041
|
+
* }
|
|
1042
|
+
* ```
|
|
1043
|
+
*/
|
|
1044
|
+
const disableHandler = async (event, work) => {
|
|
1045
|
+
const target = event.target;
|
|
1046
|
+
target.disabled = true;
|
|
1047
|
+
await work.catch(() => undefined);
|
|
1048
|
+
target.disabled = false;
|
|
1049
|
+
};
|
|
1050
|
+
|
|
839
1051
|
/*
|
|
840
1052
|
* Public API Surface of @rdlabo/ionic-angular-kit
|
|
841
1053
|
*/
|
|
@@ -845,5 +1057,5 @@ const arrayConcatById = (arrayOld, arrayNew, key, order = 'DESC') => {
|
|
|
845
1057
|
* Generated bundle index. Do not edit.
|
|
846
1058
|
*/
|
|
847
1059
|
|
|
848
|
-
export { KIT_AUTH_CONFIG, KIT_HTTP_CONFIG, KIT_OVERLAY_CONFIG, KitAutofillDirective, KitOverlayController, KitReloadAlertController, KitStorageService, arrayConcatById, kitAuthInterceptor, kitImpact, kitPresentAuthFailedAlert, kitRequireAuthorizedGuard, kitRequireConfirmingGuard, kitRequiredUnauthorizedGuard, provideKitAuth, provideKitHttp, provideKitOverlay };
|
|
1060
|
+
export { KIT_AUTH_CONFIG, KIT_HTTP_CONFIG, KIT_OVERLAY_CONFIG, KitAutofillDirective, KitKeyboardController, KitOverlayController, KitReloadAlertController, KitStorageService, arrayConcatById, disableHandler, kitAuthInterceptor, kitImpact, kitPresentAuthFailedAlert, kitRequireAuthorizedGuard, kitRequireConfirmingGuard, kitRequiredUnauthorizedGuard, objectEqual, provideKitAuth, provideKitHttp, provideKitOverlay };
|
|
849
1061
|
//# sourceMappingURL=rdlabo-ionic-angular-kit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdlabo-ionic-angular-kit.mjs","sources":["../../../projects/kit/src/lib/storage/kit-storage.service.ts","../../../projects/kit/src/lib/overlay/overlay-config.ts","../../../projects/kit/src/lib/utils/haptics.ts","../../../projects/kit/src/lib/overlay/kit-overlay.controller.ts","../../../projects/kit/src/lib/overlay/kit-reload-alert.controller.ts","../../../projects/kit/src/lib/overlay/kit-auth-failed-alert.ts","../../../projects/kit/src/lib/directives/autofill.directive.ts","../../../projects/kit/src/lib/auth/auth-guards.ts","../../../projects/kit/src/lib/http/kit-http.interceptor.ts","../../../projects/kit/src/lib/utils/array.ts","../../../projects/kit/src/public-api.ts","../../../projects/kit/src/rdlabo-ionic-angular-kit.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { Storage } from '@ionic/storage-angular';\n\n/**\n * Thin, typed wrapper around `@ionic/storage-angular`.\n *\n * Starts `create()` exactly once and stores the resulting ready Promise. Every operation awaits\n * that Promise before touching the underlying store, so calls made before initialization completes\n * are queued rather than dropped.\n *\n * @remarks\n * A naive wrapper that reads the store synchronously would silently no-op (or throw) when invoked\n * before `create()` resolves, losing early writes. Awaiting the one-time ready Promise on every\n * operation removes that race without forcing callers to coordinate initialization themselves.\n *\n * @example\n * ```ts\n * constructor(private readonly storage: KitStorageService) {}\n *\n * async ngOnInit(): Promise<void> {\n * await this.storage.set('token', 'abc123');\n * const token = await this.storage.get<string>('token');\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitStorageService {\n /** One-time `create()` ready Promise; awaited before every operation so early calls are not lost. */\n readonly #ready: Promise<Storage> = inject(Storage).create();\n\n /**\n * Persist a value under the given key.\n *\n * @typeParam T - type of the value being stored\n * @param key - key to store the value under\n * @param value - value to persist; overwrites any existing value for the key\n * @returns a Promise that resolves once the value has been written\n * @example\n * ```ts\n * await storage.set('user', { id: 1, name: 'Ada' });\n * ```\n */\n async set<T>(key: string, value: T): Promise<void> {\n await (await this.#ready).set(key, value);\n }\n\n /**\n * Read the value stored under the given key.\n *\n * @typeParam T - expected type of the stored value\n * @param key - key to read\n * @returns the stored value, or `null` when the key is absent\n * @example\n * ```ts\n * const user = await storage.get<{ id: number }>('user');\n * ```\n */\n async get<T>(key: string): Promise<T | null> {\n return (await (await this.#ready).get(key)) ?? null;\n }\n\n /**\n * Remove the value stored under the given key.\n *\n * @param key - key to remove; a no-op when the key is absent\n * @returns a Promise that resolves once the key has been removed\n */\n async remove(key: string): Promise<void> {\n await (await this.#ready).remove(key);\n }\n\n /**\n * Remove every key/value pair from the store.\n *\n * @returns a Promise that resolves once the store has been emptied\n */\n async clear(): Promise<void> {\n await (await this.#ready).clear();\n }\n\n /**\n * List every key currently present in the store.\n *\n * @returns an array of all stored keys\n */\n async keys(): Promise<string[]> {\n return (await this.#ready).keys();\n }\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport { InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\n/**\n * User-visible button labels consumed by `KitOverlayController`.\n *\n * @remarks\n * The kit deliberately ships no i18n strings of its own and has no hard dependency on\n * `@angular/localize`. The consuming application always provides these labels: multilingual apps\n * pass `$localize`-resolved strings, single-language apps pass plain literals.\n */\nexport interface KitLabels {\n /** Text for the \"close\" button used by alerts and toasts. */\n readonly close: string;\n /** Text for the \"cancel\" button used by confirmation alerts. */\n readonly cancel: string;\n}\n\n/**\n * Overlay configuration injected via `provideKitOverlay()`.\n *\n * @remarks\n * All fields are required; the consuming application must supply a complete configuration.\n */\nexport interface KitOverlayConfig {\n /** Button labels used across the overlays presented by `KitOverlayController`. */\n readonly labels: KitLabels;\n}\n\n/**\n * Injection token carrying the {@link KitOverlayConfig} for `KitOverlayController`.\n *\n * @remarks\n * Provide it through {@link provideKitOverlay} rather than registering it directly.\n */\nexport const KIT_OVERLAY_CONFIG = new InjectionToken<KitOverlayConfig>('@rdlabo/ionic-angular-kit:overlay');\n\n/**\n * Wire `KitOverlayController` into the application by providing its button labels.\n *\n * @param config - overlay configuration, including the button labels to inject\n * @returns environment providers to add to the application's provider list\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideKitOverlay({ labels: { close: $localize`Close`, cancel: $localize`Cancel` } }),\n * ],\n * });\n * ```\n */\nexport const provideKitOverlay = (config: KitOverlayConfig): EnvironmentProviders =>\n makeEnvironmentProviders([{ provide: KIT_OVERLAY_CONFIG, useValue: config }]);\n","import { Capacitor } from '@capacitor/core';\nimport { Haptics, ImpactStyle } from '@capacitor/haptics';\n\n/**\n * Trigger native haptic impact feedback.\n *\n * Delegates to `@capacitor/haptics` `Haptics.impact()` when running on a native platform. On the\n * web (or any non-native platform) it is a no-op and resolves without doing anything.\n *\n * @remarks\n * This haptic side effect was previously bundled implicitly into toast/modal presentation. It has\n * been decoupled into this explicit function so callers opt in to the feedback deliberately, rather\n * than receiving it as a hidden side effect of presenting UI.\n *\n * @param style - The impact intensity to play. Defaults to {@link ImpactStyle.Light}.\n * @returns A promise that resolves once the feedback has been requested (immediately on the web).\n * @example\n * ```ts\n * import { ImpactStyle } from '@capacitor/haptics';\n *\n * // Light tap (default)\n * await kitImpact();\n *\n * // Stronger feedback, e.g. on a confirming action\n * await kitImpact(ImpactStyle.Heavy);\n * ```\n */\nexport const kitImpact = async (style: ImpactStyle = ImpactStyle.Light): Promise<void> => {\n if (Capacitor.isNativePlatform()) {\n await Haptics.impact({ style });\n }\n};\n","import { inject, Injectable } from '@angular/core';\nimport type { ModalOptions, ToastOptions } from '@ionic/angular/standalone';\nimport { AlertController, ModalController, ToastController } from '@ionic/angular/standalone';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { Capacitor } from '@capacitor/core';\nimport { Keyboard } from '@capacitor/keyboard';\nimport { KIT_OVERLAY_CONFIG } from './overlay-config';\nimport { kitImpact } from '../utils/haptics';\n\n/**\n * Options for {@link KitOverlayController.presentModal}.\n *\n * @remarks\n * Extends Ionic's `ModalOptions` but omits `component` and `componentProps`, which are passed as\n * dedicated arguments instead.\n */\nexport interface KitModalPresentOptions extends Omit<ModalOptions, 'component' | 'componentProps'> {\n /**\n * When `true`, expand the sheet to its maximum breakpoint while the native keyboard is shown.\n *\n * @remarks\n * Only has an effect on native platforms; ignored on the web.\n */\n watchKeyboard?: boolean;\n}\n\n/**\n * Options for {@link KitOverlayController.alertClose}.\n */\nexport interface KitAlertCloseOptions {\n /** Alert header text. */\n header: string;\n /** Alert body message. */\n message: string;\n /** Optional alert sub-header text shown beneath the header. */\n subHeader?: string;\n}\n\n/**\n * Options for {@link KitOverlayController.alertConfirm}.\n *\n * @remarks\n * Extends {@link KitAlertCloseOptions} with the confirm-button text.\n */\nexport interface KitAlertConfirmOptions extends KitAlertCloseOptions {\n /**\n * Text for the OK (confirm) button.\n *\n * @remarks\n * Action-specific, so it is supplied by the caller rather than taken from the shared labels.\n */\n okText: string;\n}\n\n/**\n * Attach a native keyboard listener that grows the modal to its maximum breakpoint when the\n * keyboard appears.\n *\n * @param modal - the presented modal element to resize\n * @returns a listener handle; on non-native platforms a no-op handle whose `remove()` does nothing\n * @internal\n */\nconst watchModalKeyboard = async (modal: HTMLIonModalElement): Promise<PluginListenerHandle> => {\n if (!Capacitor.isNativePlatform()) {\n return { remove: async () => undefined };\n }\n return Keyboard.addListener('keyboardDidShow', () => modal.setCurrentBreakpoint(1));\n};\n\n/**\n * Ergonomic wrapper that consolidates Ionic's overlay controllers (Modal / Toast / Alert).\n *\n * @remarks\n * Folds the repetitive create → present → onDidDismiss sequence into single calls and returns the\n * relevant result directly. It holds no application-specific policy such as navigation; compose\n * those concerns on the consuming side.\n *\n * @example\n * ```ts\n * constructor(private readonly overlay: KitOverlayController) {}\n *\n * async edit(): Promise<void> {\n * const result = await this.overlay.presentModal<EditResult>(EditPage, { id: 1 });\n * if (result) {\n * await this.overlay.presentToast({ message: 'Saved' });\n * }\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitOverlayController {\n readonly #modalCtrl = inject(ModalController);\n readonly #toastCtrl = inject(ToastController);\n readonly #alertCtrl = inject(AlertController);\n readonly #labels = inject(KIT_OVERLAY_CONFIG).labels;\n\n /**\n * Present a modal and resolve with the data passed to its dismissal.\n *\n * @typeParam O - type of the data returned when the modal is dismissed\n * @param component - the component to render inside the modal\n * @param componentProps - props to pass to the modal component\n * @param options - additional modal options, including {@link KitModalPresentOptions.watchKeyboard}\n * @returns the dismiss data, or `undefined` when the modal is dismissed without data\n * @example\n * ```ts\n * const data = await overlay.presentModal<{ saved: boolean }>(EditPage, { id: 1 }, { watchKeyboard: true });\n * ```\n */\n async presentModal<O = unknown>(\n component: ModalOptions['component'],\n componentProps?: ModalOptions['componentProps'],\n options: KitModalPresentOptions = {},\n ): Promise<O | undefined> {\n const { watchKeyboard, ...modalOptions } = options;\n const modal = await this.#modalCtrl.create({ component, componentProps, ...modalOptions });\n await modal.present();\n const handle = watchKeyboard ? await watchModalKeyboard(modal) : null;\n const { data } = await modal.onDidDismiss<O>();\n await handle?.remove();\n return data;\n }\n\n /**\n * Present a toast using kit defaults that the caller may override.\n *\n * @remarks\n * Defaults to a top position, a 2000ms duration, a vertical swipe gesture, and a close button\n * from the configured labels; any of these can be overridden via `options`. Presenting a toast\n * also triggers light native haptic feedback as an intentional kit UX choice.\n *\n * @param options - Ionic toast options that override the kit defaults\n * @returns the presented toast element\n * @example\n * ```ts\n * await overlay.presentToast({ message: 'Copied to clipboard' });\n * ```\n */\n async presentToast(options: ToastOptions): Promise<HTMLIonToastElement> {\n void kitImpact();\n const toast = await this.#toastCtrl.create({\n position: 'top',\n duration: 2000,\n buttons: [this.#labels.close],\n swipeGesture: 'vertical',\n ...options,\n });\n await toast.present();\n return toast;\n }\n\n /**\n * Present a notification alert with a single \"close\" button and wait for it to be dismissed.\n *\n * @param options - alert content (header, message, optional sub-header)\n * @returns a Promise that resolves once the alert has been dismissed\n * @example\n * ```ts\n * await overlay.alertClose({ header: 'Done', message: 'Your changes were saved.' });\n * ```\n */\n async alertClose(options: KitAlertCloseOptions): Promise<void> {\n const alert = await this.#alertCtrl.create({\n header: options.header,\n subHeader: options.subHeader,\n message: options.message,\n buttons: [this.#labels.close],\n });\n await alert.present();\n await alert.onWillDismiss();\n }\n\n /**\n * Present a confirmation alert with cancel and OK buttons.\n *\n * @param options - alert content plus the OK button text via {@link KitAlertConfirmOptions.okText}\n * @returns `true` when the user presses OK, `false` otherwise (cancel or backdrop dismissal)\n * @example\n * ```ts\n * const ok = await overlay.alertConfirm({\n * header: 'Delete item?',\n * message: 'This cannot be undone.',\n * okText: 'Delete',\n * });\n * if (ok) {\n * await remove();\n * }\n * ```\n */\n async alertConfirm(options: KitAlertConfirmOptions): Promise<boolean> {\n const alert = await this.#alertCtrl.create({\n header: options.header,\n subHeader: options.subHeader,\n message: options.message,\n buttons: [\n { text: this.#labels.cancel, role: 'cancel' },\n { text: options.okText, role: 'confirm' },\n ],\n });\n await alert.present();\n const { role } = await alert.onWillDismiss();\n return role === 'confirm';\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { AlertController } from '@ionic/angular/standalone';\nimport { KIT_OVERLAY_CONFIG } from './overlay-config';\n\n/**\n * Content for {@link KitReloadAlertController.present}.\n */\nexport interface KitReloadAlertOptions {\n /** Alert header text. */\n header: string;\n /** Alert body message. */\n message: string;\n /**\n * Text for the reload (confirm) button, e.g. \"リフレッシュ\".\n *\n * @remarks\n * Action-specific, so it is supplied by the caller rather than taken from the shared labels.\n * The cancel button uses the configured {@link KitLabels.cancel}.\n */\n okText: string;\n}\n\n/**\n * The fleet's canonical \"network error → offer to reload\" alert, as a stateful controller.\n *\n * @remarks\n * Consolidates the good-UX variant that had drifted across the fleet into one behavior:\n *\n * - **De-dup** — never stacks; a second {@link present} while an alert is already shown is a no-op.\n * - **Backdrop lock** — `backdropDismiss: false`, so a critical network error can't be dismissed by\n * an accidental backdrop tap; the user consciously chooses cancel or reload.\n * - **Auto-dismiss on reconnect** — the presented alert is tracked, so {@link dismiss} (called from a\n * later successful response) clears a now-stale error alert instead of leaving it on screen.\n * - **Reload on confirm** — the confirm button calls `location.reload()`.\n *\n * All user-facing text is supplied by the caller so the kit stays free of any hardcoded i18n; the\n * cancel button reuses {@link KitOverlayConfig.labels}. Because it performs navigation\n * (`location.reload()`) and holds state, it is a dedicated controller rather than part of\n * {@link KitOverlayController}, which stays free of navigation policy.\n *\n * @example\n * ```ts\n * // In an HTTP interceptor:\n * const reload = inject(KitReloadAlertController);\n * // ...on a network-class error while connected:\n * await reload.present({ header: 'ネットワークエラー', message: `…(${status})`, okText: 'リフレッシュ' });\n * // ...on any later successful response:\n * await reload.dismiss();\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitReloadAlertController {\n readonly #alertCtrl = inject(AlertController);\n readonly #labels = inject(KIT_OVERLAY_CONFIG).labels;\n #alert: HTMLIonAlertElement | null = null;\n\n /**\n * Present the reload alert, unless one is already on screen.\n *\n * @param options - alert content plus the reload-button text\n * @returns a Promise that resolves once the alert has been presented (or immediately if suppressed)\n */\n async present(options: KitReloadAlertOptions): Promise<void> {\n // この controller 経由でも直書き ion-alert でも、多重表示しない。\n if (this.#alert || document.querySelector('ion-alert')) {\n return;\n }\n const alert = await this.#alertCtrl.create({\n header: options.header,\n message: options.message,\n backdropDismiss: false,\n buttons: [\n { text: this.#labels.cancel, role: 'cancel' },\n {\n text: options.okText,\n handler: () => {\n location.reload();\n },\n },\n ],\n });\n this.#alert = alert;\n void alert.onDidDismiss().then(() => {\n // 別の present で置き換わっていない限り、追跡を解除する。\n if (this.#alert === alert) {\n this.#alert = null;\n }\n });\n await alert.present();\n }\n\n /**\n * Dismiss the tracked reload alert if one is showing.\n *\n * @remarks\n * Typically called from a later successful response so a stale \"network error\" alert clears once\n * connectivity is restored. A no-op when nothing is showing.\n *\n * @returns a Promise that resolves once the alert has been dismissed (or immediately if none)\n */\n async dismiss(): Promise<void> {\n const alert = this.#alert;\n this.#alert = null;\n await alert?.dismiss();\n }\n}\n","import type { AlertController } from '@ionic/angular/standalone';\n\n/**\n * Content for {@link kitPresentAuthFailedAlert}.\n */\nexport interface KitAuthFailedAlertOptions {\n /** Alert header, e.g. \"ログインできませんでした\". */\n header: string;\n /** Optional sub-header; typically the short server error code/name. */\n subHeader?: string;\n /** Alert body message; typically the server-provided detail. */\n message: string;\n /** Text for the single close button, e.g. \"閉じる\". */\n closeText: string;\n}\n\n/**\n * Present the fleet's canonical \"sign-in / token exchange failed\" alert.\n *\n * @remarks\n * Folds together the alert every token-exchange app duplicated verbatim when a startup re-login\n * fails: an informative alert (header + optional server error as sub-header + detail message) with a\n * single close button that reloads the app (`location.reload()`) so the user restarts cleanly. The\n * caller is still responsible for signing the user out around this call.\n *\n * All user-facing text is supplied by the caller so the kit stays free of any hardcoded i18n. Kept\n * as a standalone helper (taking the `AlertController`) rather than a method on\n * {@link KitOverlayController}, which holds no navigation policy such as `location.reload()`.\n *\n * @param alertCtrl - Ionic's `AlertController`\n * @param options - alert content plus the close-button text\n * @returns a Promise that resolves once the alert has been presented\n * @example\n * ```ts\n * onAuthorized: async () => {\n * const logged = await auth.tokenLogin().catch(async (e) => {\n * await kitPresentAuthFailedAlert(alertCtrl, {\n * header: 'ログインできませんでした',\n * subHeader: e.error.error,\n * message: e.error.detail,\n * closeText: '閉じる',\n * });\n * await auth.signOut();\n * return undefined;\n * });\n * // ...\n * };\n * ```\n */\nexport const kitPresentAuthFailedAlert = async (\n alertCtrl: AlertController,\n options: KitAuthFailedAlertOptions,\n): Promise<void> => {\n const alert = await alertCtrl.create({\n header: options.header,\n subHeader: options.subHeader,\n message: options.message,\n buttons: [\n {\n text: options.closeText,\n role: 'cancel',\n handler: () => {\n location.reload();\n },\n },\n ],\n });\n await alert.present();\n};\n","import type { OnInit } from '@angular/core';\nimport { Directive, ElementRef, inject } from '@angular/core';\nimport { Capacitor } from '@capacitor/core';\n\n/**\n * Work around iOS `ion-input` autofill values not propagating to the Angular form model.\n *\n * On iOS, when the browser autofills an `ion-input` (for example a saved password), the value\n * is written to the underlying native `<input>` element but the corresponding `change` event is\n * not forwarded to the host `ion-input`, so the Angular form control (and `ngModel`) never sees\n * the autofilled value. This directive listens for the first `change` event on the inner input\n * element and mirrors its value back onto the host element, restoring two-way binding.\n *\n * Apply it to any `ion-input` that participates in a form and may be autofilled by attaching the\n * `rdlaboAutofill` attribute.\n *\n * @remarks\n * The directive is a no-op on every platform other than iOS, where the value already propagates\n * correctly. A short timeout is used because `ion-input` creates its inner `<input>` element\n * asynchronously after the host element is initialized.\n *\n * @example\n * ```html\n * <ion-input rdlaboAutofill type=\"password\" [(ngModel)]=\"password\"></ion-input>\n * ```\n */\n@Directive({\n selector: '[rdlaboAutofill]',\n standalone: true,\n})\nexport class KitAutofillDirective implements OnInit {\n readonly #el = inject(ElementRef);\n\n constructor() {}\n\n /**\n * Register the iOS autofill workaround once the directive is initialized.\n *\n * Returns immediately on non-iOS platforms. On iOS, after a short delay it attaches a one-shot,\n * passive `change` listener to the inner `<input>` element that `ion-input` renders, copying the\n * autofilled value back onto the host element so the Angular form model stays in sync. Any error\n * while locating the inner input (for example if the element is not yet present) is swallowed.\n *\n * @returns Nothing.\n */\n ngOnInit(): void {\n if (Capacitor.getPlatform() !== 'ios') {\n return;\n }\n setTimeout(() => {\n try {\n this.#el.nativeElement.children[0].addEventListener(\n 'change',\n (e: Event) => {\n this.#el.nativeElement.value = (e.target as HTMLInputElement).value;\n },\n {\n capture: false,\n once: true,\n passive: true,\n },\n );\n } catch {\n /* empty */\n }\n }, 100); // Need some time for the ion-input to create the input element\n }\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport { inject, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { CanActivateFn, RouterStateSnapshot, UrlTree } from '@angular/router';\nimport { Router } from '@angular/router';\nimport { NavController } from '@ionic/angular/standalone';\nimport type { Observable } from 'rxjs';\nimport { map, mergeMap } from 'rxjs/operators';\n\n/**\n * Discriminated set of authentication states the guards react to.\n *\n * @remarks\n * The application is responsible for emitting these values through {@link KitAuthConfig.authState}.\n * An application that does not use a value (for example email confirmation) simply never emits it.\n *\n * - `user` — fully authenticated and verified.\n * - `confirm` — awaiting email confirmation.\n * - `required` — not authenticated.\n * - `anonymous` — signed in anonymously; the user can still be guided toward full registration.\n */\nexport type KitAuthState = 'user' | 'confirm' | 'required' | 'anonymous';\n\n/**\n * Redirect targets (route paths) used by the guards when access is denied.\n *\n * @remarks\n * Every field is required and must be provided per application, because the guards have no\n * knowledge of the host application's route layout.\n */\nexport interface KitAuthRedirects {\n /** Used by {@link kitRequiredUnauthorizedGuard}: where to navigate when the user is already authenticated (`user`). */\n readonly whenAuthorized: string;\n /** Used by {@link kitRequiredUnauthorizedGuard}: where to navigate when the user is awaiting email confirmation (`confirm`). */\n readonly whenConfirming: string;\n /** Used by {@link kitRequireConfirmingGuard}: where to navigate when the state is not `confirm`. */\n readonly whenNotConfirming: string;\n /** Used by {@link kitRequireAuthorizedGuard}: where to navigate when the state is not `user` and the fallback is not allowed. */\n readonly whenUnauthorized: string;\n}\n\n/**\n * Configuration consumed by the authentication guards, injected through {@link provideKitAuth}.\n *\n * @remarks\n * `authState` and `redirects` are required. The `onAuthorized` / `onUnauthenticated` hooks are\n * optional and default to allowing the authenticated user through (`true`) and falling through to\n * the default redirect (`false`) respectively, so an app only supplies the ones with real logic.\n */\nexport interface KitAuthConfig {\n /**\n * Source of the current authentication state.\n *\n * @remarks\n * Typically backed by the application's own auth service (for example `AuthService.isAuth()`).\n *\n * @returns A stream of {@link KitAuthState} values.\n */\n authState(): Observable<KitAuthState>;\n /**\n * Application-specific work that runs in {@link kitRequireAuthorizedGuard} after the state is confirmed to be `user`.\n *\n * @remarks\n * Typical responsibilities include token login, permission checks, terms-of-service acceptance,\n * or restoring a previously requested redirect. Optional; defaults to `true` (allow activation).\n *\n * @param state - The router state snapshot of the route being activated.\n * @returns `true` to allow activation, or a `UrlTree` to perform a custom redirect.\n */\n onAuthorized?(state: RouterStateSnapshot): Promise<boolean | UrlTree>;\n /**\n * Fallback that runs in {@link kitRequireAuthorizedGuard} when the state is `required` (not authenticated).\n *\n * @remarks\n * For example, attempt an anonymous sign-in and allow the route. Optional; defaults to `false`\n * (fall through to the default `whenUnauthorized` redirect).\n *\n * @param state - The router state snapshot of the route being activated.\n * @returns `true` to allow activation, a `UrlTree` for a custom redirect, or `false` to use the default redirect.\n */\n onUnauthenticated?(state: RouterStateSnapshot): Promise<boolean | UrlTree>;\n /** Redirect targets used by the guards. */\n redirects: KitAuthRedirects;\n}\n\n/**\n * Injection token that carries the {@link KitAuthConfig} to the authentication guards.\n */\nexport const KIT_AUTH_CONFIG = new InjectionToken<KitAuthConfig>('@rdlabo/ionic-angular-kit:auth');\n\n/**\n * Wire the authentication guard configuration into the application's dependency injection.\n *\n * @remarks\n * The factory runs inside an injection context, so it may call `inject()` (for example\n * `inject(AuthService)`) to build the configuration.\n *\n * @param configFactory - Factory that returns the {@link KitAuthConfig} for the application.\n * @returns Environment providers to add to the application bootstrap.\n *\n * @example\n * ```ts\n * provideKitAuth(() => {\n * const auth = inject(AuthService);\n * return {\n * // onAuthorized / onUnauthenticated are optional (default: allow / fall through to redirect).\n * authState: () => auth.isAuth(),\n * redirects: {\n * whenAuthorized: '/',\n * whenConfirming: '/auth/confirm',\n * whenNotConfirming: '/auth/signin',\n * whenUnauthorized: 'auth',\n * },\n * };\n * });\n * ```\n */\nexport const provideKitAuth = (configFactory: () => KitAuthConfig): EnvironmentProviders =>\n makeEnvironmentProviders([{ provide: KIT_AUTH_CONFIG, useFactory: configFactory }]);\n\n/**\n * Guard that requires the user to be unauthenticated (for example sign-in or sign-up pages).\n *\n * @remarks\n * Allows the `required` and `anonymous` states (an anonymous user is permitted to proceed to a\n * registration page). An authenticated user (`user`) is sent to `whenAuthorized`, and a user\n * awaiting confirmation (`confirm`) is sent to `whenConfirming`.\n *\n * @returns A stream emitting `true` to allow activation, or `false` after triggering a redirect.\n *\n * @example\n * ```ts\n * const routes: Routes = [{ path: 'signin', component: SigninPage, canActivate: [kitRequiredUnauthorizedGuard] }];\n * ```\n */\nexport const kitRequiredUnauthorizedGuard: CanActivateFn = () => {\n const { authState, redirects } = inject(KIT_AUTH_CONFIG);\n const router = inject(Router);\n const navCtrl = inject(NavController);\n\n return authState().pipe(\n map((data) => {\n if (data === 'user') {\n navCtrl.setDirection('root');\n router.navigate([redirects.whenAuthorized]);\n return false;\n } else if (data === 'confirm') {\n router.navigate([redirects.whenConfirming]);\n return false;\n }\n // 'required' | 'anonymous'\n return true;\n }),\n );\n};\n\n/**\n * Guard that requires the user to be awaiting email confirmation (`confirm`).\n *\n * @remarks\n * Any other state triggers a redirect: an `anonymous` user is sent to the authenticated area\n * (`whenAuthorized`), and every remaining state is sent to `whenNotConfirming`.\n *\n * @returns A stream emitting `true` to allow activation, or `false` after triggering a redirect.\n *\n * @example\n * ```ts\n * const routes: Routes = [{ path: 'confirm', component: ConfirmPage, canActivate: [kitRequireConfirmingGuard] }];\n * ```\n */\nexport const kitRequireConfirmingGuard: CanActivateFn = () => {\n const { authState, redirects } = inject(KIT_AUTH_CONFIG);\n const router = inject(Router);\n const navCtrl = inject(NavController);\n\n return authState().pipe(\n map((data) => {\n if (data === 'confirm') {\n return true;\n }\n navCtrl.setDirection('root');\n router.navigate([data === 'anonymous' ? redirects.whenAuthorized : redirects.whenNotConfirming]);\n return false;\n }),\n );\n};\n\n/**\n * Guard that requires the user to be fully authenticated (`user`).\n *\n * @remarks\n * - `user` — runs {@link KitAuthConfig.onAuthorized} (token login, permission checks, and so on).\n * - `anonymous` — allowed as-is, for applications that permit anonymous browsing.\n * - `required` / `confirm` — runs {@link KitAuthConfig.onUnauthenticated}; if it resolves to `false`,\n * the user is redirected to `whenUnauthorized`.\n *\n * @param _route - The activated route snapshot (unused).\n * @param state - The router state snapshot, forwarded to the configuration hooks.\n * @returns A stream emitting the activation result: `true`, a `UrlTree`, or `false` after a redirect.\n *\n * @example\n * ```ts\n * const routes: Routes = [{ path: 'home', component: HomePage, canActivate: [kitRequireAuthorizedGuard] }];\n * ```\n */\nexport const kitRequireAuthorizedGuard: CanActivateFn = (_route, state) => {\n const { authState, onAuthorized, onUnauthenticated, redirects } = inject(KIT_AUTH_CONFIG);\n const router = inject(Router);\n const navCtrl = inject(NavController);\n\n return authState().pipe(\n mergeMap(async (data) => {\n if (data === 'user') {\n // 既定は「許可」。tokenLogin / 権限確認等が必要なアプリだけ onAuthorized を渡す。\n return onAuthorized ? onAuthorized(state) : true;\n }\n if (data === 'anonymous') {\n return true;\n }\n // 既定は false(whenUnauthorized へ)。匿名ログイン等のフォールバックが要るアプリだけ渡す。\n const fallback = onUnauthenticated ? await onUnauthenticated(state) : false;\n if (fallback !== false) {\n return fallback;\n }\n navCtrl.setDirection('root');\n router.navigate([redirects.whenUnauthorized]);\n return false;\n }),\n );\n};\n","import type { EnvironmentProviders } from '@angular/core';\nimport { inject, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { HttpErrorResponse, HttpEvent, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { HttpResponse } from '@angular/common/http';\nimport { Network } from '@capacitor/network';\nimport type { Observable } from 'rxjs';\nimport { from, retry, throwError, timer } from 'rxjs';\nimport { catchError, mergeMap, tap } from 'rxjs/operators';\n\n/**\n * HTTP status codes that must never be retried. `401` is handled separately and thrown immediately.\n *\n * @internal\n */\nconst NON_RETRYABLE_STATUSES = [400, 403, 404, 418, 500, 502];\n\n/**\n * Configuration that customizes the behavior of {@link kitAuthInterceptor}, injected through {@link provideKitHttp}.\n *\n * @remarks\n * The interceptor fixes the retry policy (up to 2 retries with a linearly increasing backoff, plus immediate\n * throw on `401` and on every {@link NON_RETRYABLE_STATUSES | non-retryable status}) and the overall\n * control flow. Only the hooks below are application-specific.\n *\n * Only {@link KitHttpConfig.getAuthHeaders} is required — it has no safe default. Every other hook is\n * optional and defaults to a no-op (or `{}` / `false` / `null` as appropriate), so an app configures\n * only the behavior that actually differs from the canonical baseline.\n */\nexport interface KitHttpConfig {\n /**\n * Produce authentication and metadata headers for the outgoing request.\n *\n * @param request - The outgoing request about to be sent.\n * @returns A map of header names to values, resolved asynchronously.\n */\n getAuthHeaders(request: HttpRequest<unknown>): Promise<Record<string, string>>;\n /**\n * Produce additional headers for the outgoing request.\n *\n * @remarks\n * Optional; defaults to adding no extra headers.\n *\n * @param request - The outgoing request about to be sent.\n * @returns A map of header names to values; return `{}` when none are needed.\n */\n buildExtraHeaders?(request: HttpRequest<unknown>): Record<string, string>;\n /**\n * Called for every successful response that completed an actual network round trip.\n *\n * @remarks\n * Responses synthesized by {@link KitHttpConfig.offlineFallback} are produced after `catchError`\n * and therefore never reach this hook, so it observes genuine successes only. A typical use is to\n * reset an \"offline\" flag once connectivity is restored. Optional; defaults to a no-op.\n *\n * @param event - The successful `HttpResponse`.\n */\n onResponse?(event: HttpResponse<unknown>): void;\n /**\n * Decide whether to pass the request straight through, skipping auth, retry, and error handling.\n *\n * @remarks\n * Useful for external URLs such as S3 or a CDN. Optional; defaults to `false` (never bypass).\n *\n * @param request - The outgoing request.\n * @returns `true` to bypass the interceptor pipeline.\n */\n bypass?(request: HttpRequest<unknown>): boolean;\n /**\n * Provide an offline short-circuit when a request fails.\n *\n * @remarks\n * Returning a non-null observable replaces the error with that response (for example a queued\n * offline result). Optional; defaults to `null` (no fallback, normal error handling proceeds).\n *\n * @param request - The request that failed (after headers were applied).\n * @param error - The error response that triggered the fallback.\n * @returns A replacement event stream, or `null` for no fallback.\n */\n offlineFallback?(request: HttpRequest<unknown>, error: HttpErrorResponse): Observable<HttpEvent<unknown>> | null;\n /**\n * Side effect to run on a `401` response (for example an expired token).\n *\n * @remarks\n * Optional; defaults to a no-op.\n *\n * @param request - The request that received the `401`.\n */\n onUnauthorized?(request: HttpRequest<unknown>): void;\n /**\n * Side effect to run on a `403` response (a permission error).\n *\n * @remarks\n * Optional; defaults to a no-op.\n *\n * @param request - The request that received the `403`.\n */\n onForbidden?(request: HttpRequest<unknown>): void;\n /**\n * UX hook for network-originated errors while the device is connected.\n *\n * @remarks\n * Optional; defaults to a no-op. The kit ships {@link KitReloadAlertController} as the fleet's\n * canonical implementation of this hook (with auto-dismiss on reconnect via `onResponse`).\n *\n * @param status - The HTTP status code, or a string descriptor for non-HTTP failures.\n * @returns Optionally a promise to await before continuing.\n */\n onNetworkError?(status: number | string): Promise<void> | void;\n /**\n * UX hook for `400` / `500` responses that carry a server-provided message.\n *\n * @remarks\n * Optional; defaults to a no-op.\n *\n * @param message - The message extracted from the error body.\n */\n onServerError?(message: string): void;\n}\n\n/**\n * Injection token that carries the {@link KitHttpConfig} to {@link kitAuthInterceptor}.\n */\nexport const KIT_HTTP_CONFIG = new InjectionToken<KitHttpConfig>('@rdlabo/ionic-angular-kit:http');\n\n/**\n * Wire the {@link kitAuthInterceptor} configuration into the application's dependency injection.\n *\n * @remarks\n * Register the interceptor itself separately via `provideHttpClient(withInterceptors([kitAuthInterceptor]))`.\n * The factory runs inside an injection context, so it may call `inject()`.\n *\n * @param configFactory - Factory that returns the {@link KitHttpConfig} for the application.\n * @returns Environment providers to add to the application bootstrap.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideHttpClient(withInterceptors([kitAuthInterceptor])),\n * provideKitHttp(() => {\n * const auth = inject(AuthService);\n * const reload = inject(KitReloadAlertController);\n * return {\n * // Only getAuthHeaders is required; every other hook is optional and defaults to a no-op.\n * getAuthHeaders: async () => ({ Authorization: `Bearer ${await auth.token()}` }),\n * onUnauthorized: () => auth.signOut(),\n * onNetworkError: (status) =>\n * reload.present({ header: 'Network error', message: `Reload? (${status})`, okText: 'Reload' }),\n * onResponse: () => void reload.dismiss(),\n * };\n * }),\n * ],\n * });\n * ```\n */\nexport const provideKitHttp = (configFactory: () => KitHttpConfig): EnvironmentProviders =>\n makeEnvironmentProviders([{ provide: KIT_HTTP_CONFIG, useFactory: configFactory }]);\n\n/**\n * Canonical functional HTTP interceptor that applies authentication, retries, and error handling.\n *\n * @remarks\n * Behavior, driven by the injected {@link KitHttpConfig}:\n *\n * 1. Requests for which `bypass` returns `true` are forwarded untouched.\n * 2. Otherwise the headers from `getAuthHeaders` and `buildExtraHeaders` are merged onto a cloned request.\n * 3. Failed requests are retried up to 2 times with a linearly increasing backoff of `500ms * (retryCount + 5)`,\n * except that `401` and any {@link NON_RETRYABLE_STATUSES | non-retryable status}\n * (`400`, `403`, `404`, `418`, `500`, `502`) are thrown immediately without retrying.\n * 4. On error, `offlineFallback` is consulted first; otherwise `401` calls `onUnauthorized`, `403`\n * calls `onForbidden`, network-class failures (anything other than `400`/`500`) call\n * `onNetworkError` when the device is connected, and `400`/`500` responses carrying a body\n * message call `onServerError`.\n *\n * @param request - The outgoing request.\n * @param next - The next handler in the interceptor chain.\n * @returns A stream of HTTP events for the (possibly modified, retried, or replaced) request.\n *\n * @example\n * ```ts\n * provideHttpClient(withInterceptors([kitAuthInterceptor]));\n * ```\n */\nexport const kitAuthInterceptor: HttpInterceptorFn = (request, next) => {\n const config = inject(KIT_HTTP_CONFIG);\n\n if (config.bypass?.(request)) {\n return next(request);\n }\n\n return from(config.getAuthHeaders(request)).pipe(\n mergeMap((authHeaders) => {\n const req = request.clone({ setHeaders: { ...authHeaders, ...config.buildExtraHeaders?.(request) } });\n\n return next(req).pipe(\n retry({\n count: 2,\n delay: (e: HttpErrorResponse, retryCount) => {\n if (e.status === 401) {\n return throwError(() => e);\n }\n if (NON_RETRYABLE_STATUSES.includes(e.status)) {\n return throwError(() => e);\n }\n return timer((retryCount + 5) * 500);\n },\n }),\n tap((event) => {\n if (event instanceof HttpResponse) {\n config.onResponse?.(event);\n }\n }),\n catchError((e: HttpErrorResponse) => {\n const fallback = config.offlineFallback?.(req, e);\n if (fallback) {\n return fallback;\n }\n if (e.status === 401) {\n config.onUnauthorized?.(req);\n } else if (e.status === 403) {\n config.onForbidden?.(req);\n } else if (![400, 500].includes(e.status)) {\n void Network.getStatus().then((status) => {\n if (status.connected) {\n config.onNetworkError?.(e.status);\n }\n });\n } else if (e.error?.message) {\n config.onServerError?.(e.error.message);\n }\n return throwError(() => e);\n }),\n );\n }),\n );\n};\n","/**\n * Merge a newly fetched page of items into an existing list by id, keeping the result sorted.\n *\n * Items are merged by the numeric `key` field. On a duplicate `key` the item from `arrayNew` wins\n * and replaces the one in `arrayOld`. Old items whose `key` falls *inside* the window spanned by\n * `arrayNew` (between its first and last `key`) are dropped, since the freshly fetched page is the\n * authoritative copy of that window; old items *outside* the window are kept. The merged items are\n * finally sorted by `key`, ascending or descending according to `order`.\n *\n * The algorithm is:\n * 1. If both inputs are empty, return an empty array.\n * 2. Read the first (`lead`) and last (`last`) `key` values of `arrayNew` as the bounds of the\n * page's window. Keep the old items whose `key` lies *outside* that window (at or beyond the\n * extremes) and drop those strictly inside it, handling both a high-to-low page (`lead > last`)\n * and a low-to-high page (`lead < last`). A single-value page (`lead === last`) keeps all old items.\n * 3. Remove old items whose `key` already exists in `arrayNew` (new wins on duplicates).\n * 4. Concatenate `arrayNew` with the surviving old items and sort by `key` in the requested\n * direction.\n *\n * @remarks\n * Designed for infinite-scroll / paginated list merging, where each fetched page may overlap the\n * previously held items and the server returns a contiguous, ordered window of records. The `key`\n * field is treated as a number for range comparison and sorting.\n *\n * @typeParam T - Element type of both arrays. Its `key` property must be a numeric value.\n * @param arrayOld - The previously accumulated list. May be empty or nullish-safe (empty when falsy).\n * @param arrayNew - The newly fetched page of items; its `key` range defines the window that its own\n * items replace, and its items take precedence on duplicates.\n * @param key - The property of `T` used as the unique, numeric id for matching, range filtering, and sorting.\n * @param order - Sort direction by `key`: `'ASC'` for ascending or `'DESC'` for descending. Defaults to `'DESC'`.\n * @returns A new array containing `arrayNew` merged with the out-of-window, non-duplicate old items, sorted by `key`.\n * @example\n * ```ts\n * interface Post {\n * id: number;\n * title: string;\n * }\n *\n * const loaded: Post[] = [\n * { id: 30, title: 'c' },\n * { id: 20, title: 'b' },\n * { id: 10, title: 'a' },\n * ];\n * const nextPage: Post[] = [\n * { id: 20, title: 'b (updated)' },\n * { id: 15, title: 'a.5' },\n * ];\n *\n * // Descending merge: id 30 lies above the new page's [15, 20] window so it is kept; id 20 is\n * // inside the window and is replaced by the new value; id 10 lies below the window and is kept.\n * const merged = arrayConcatById(loaded, nextPage, 'id', 'DESC');\n * // => [{ id: 30, title: 'c' }, { id: 20, title: 'b (updated)' }, { id: 15, title: 'a.5' }, { id: 10, title: 'a' }]\n * ```\n */\nexport const arrayConcatById = <T>(arrayOld: T[], arrayNew: T[], key: keyof T, order: 'ASC' | 'DESC' = 'DESC'): T[] => {\n if (!arrayNew.length && !arrayOld.length) {\n return [];\n }\n const lead = arrayNew[0][key] as number;\n const last = arrayNew[arrayNew.length - 1][key] as number;\n\n const filteredOld = (arrayOld || []).filter((vol) => {\n const value = vol[key] as number;\n return (lead > last && (value >= lead || value <= last)) || (lead < last && (value <= lead || value >= last)) || lead === last;\n });\n\n const oldData = filteredOld.filter((vol) => !arrayNew.some((element) => element[key] === vol[key]));\n const data = arrayNew.concat(oldData);\n\n const direction = order === 'ASC' ? 1 : -1;\n return data.sort((a, b) => {\n const x = a[key] as number;\n const y = b[key] as number;\n if (x > y) {\n return direction;\n }\n if (x < y) {\n return direction * -1;\n }\n return 0;\n });\n};\n","/*\n * Public API Surface of @rdlabo/ionic-angular-kit\n */\n\n// Storage: typed wrapper around the platform key/value store.\nexport * from './lib/storage/kit-storage.service';\n\n// Overlay: wrapper around the Ionic Modal / Toast / Alert controllers.\nexport * from './lib/overlay/overlay-config';\nexport * from './lib/overlay/kit-overlay.controller';\nexport * from './lib/overlay/kit-reload-alert.controller';\nexport * from './lib/overlay/kit-auth-failed-alert';\n\n// Directives.\nexport * from './lib/directives/autofill.directive';\n\n// Auth: functional route guards.\nexport * from './lib/auth/auth-guards';\n\n// HTTP: functional interceptor.\nexport * from './lib/http/kit-http.interceptor';\n\n// Utils: framework-agnostic pure helpers.\nexport * from './lib/utils/haptics';\nexport * from './lib/utils/array';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;AAqBG;MAIU,iBAAiB,CAAA;;IAEnB,MAAM,GAAqB,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;AAE5D;;;;;;;;;;;AAWG;AACH,IAAA,MAAM,GAAG,CAAI,GAAW,EAAE,KAAQ,EAAA;AAChC,QAAA,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;IAC3C;AAEA;;;;;;;;;;AAUG;IACH,MAAM,GAAG,CAAI,GAAW,EAAA;AACtB,QAAA,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI;IACrD;AAEA;;;;;AAKG;IACH,MAAM,MAAM,CAAC,GAAW,EAAA;QACtB,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;IACvC;AAEA;;;;AAIG;AACH,IAAA,MAAM,KAAK,GAAA;QACT,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE;IACnC;AAEA;;;;AAIG;AACH,IAAA,MAAM,IAAI,GAAA;QACR,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,IAA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C;AACV,IAAA,CAAC,CAAC;AACJ;;ACjFA;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rdlabo-ionic-angular-kit.mjs","sources":["../../../projects/kit/src/lib/storage/kit-storage.service.ts","../../../projects/kit/src/lib/overlay/overlay-config.ts","../../../projects/kit/src/lib/utils/haptics.ts","../../../projects/kit/src/lib/overlay/kit-overlay.controller.ts","../../../projects/kit/src/lib/overlay/kit-reload-alert.controller.ts","../../../projects/kit/src/lib/overlay/kit-auth-failed-alert.ts","../../../projects/kit/src/lib/directives/autofill.directive.ts","../../../projects/kit/src/lib/keyboard/kit-keyboard.controller.ts","../../../projects/kit/src/lib/auth/auth-guards.ts","../../../projects/kit/src/lib/http/kit-http.interceptor.ts","../../../projects/kit/src/lib/utils/array.ts","../../../projects/kit/src/lib/utils/object.ts","../../../projects/kit/src/lib/utils/dom.ts","../../../projects/kit/src/public-api.ts","../../../projects/kit/src/rdlabo-ionic-angular-kit.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { Storage } from '@ionic/storage-angular';\n\n/**\n * Thin, typed wrapper around `@ionic/storage-angular`.\n *\n * Starts `create()` exactly once and stores the resulting ready Promise. Every operation awaits\n * that Promise before touching the underlying store, so calls made before initialization completes\n * are queued rather than dropped.\n *\n * @remarks\n * A naive wrapper that reads the store synchronously would silently no-op (or throw) when invoked\n * before `create()` resolves, losing early writes. Awaiting the one-time ready Promise on every\n * operation removes that race without forcing callers to coordinate initialization themselves.\n *\n * @example\n * ```ts\n * constructor(private readonly storage: KitStorageService) {}\n *\n * async ngOnInit(): Promise<void> {\n * await this.storage.set('token', 'abc123');\n * const token = await this.storage.get<string>('token');\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitStorageService {\n /** One-time `create()` ready Promise; awaited before every operation so early calls are not lost. */\n readonly #ready: Promise<Storage> = inject(Storage).create();\n\n /**\n * Persist a value under the given key.\n *\n * @typeParam T - type of the value being stored\n * @param key - key to store the value under\n * @param value - value to persist; overwrites any existing value for the key\n * @returns a Promise that resolves once the value has been written\n * @example\n * ```ts\n * await storage.set('user', { id: 1, name: 'Ada' });\n * ```\n */\n async set<T>(key: string, value: T): Promise<void> {\n await (await this.#ready).set(key, value);\n }\n\n /**\n * Read the value stored under the given key.\n *\n * @typeParam T - expected type of the stored value\n * @param key - key to read\n * @returns the stored value, or `null` when the key is absent\n * @example\n * ```ts\n * const user = await storage.get<{ id: number }>('user');\n * ```\n */\n async get<T>(key: string): Promise<T | null> {\n return (await (await this.#ready).get(key)) ?? null;\n }\n\n /**\n * Remove the value stored under the given key.\n *\n * @param key - key to remove; a no-op when the key is absent\n * @returns a Promise that resolves once the key has been removed\n */\n async remove(key: string): Promise<void> {\n await (await this.#ready).remove(key);\n }\n\n /**\n * Remove every key/value pair from the store.\n *\n * @returns a Promise that resolves once the store has been emptied\n */\n async clear(): Promise<void> {\n await (await this.#ready).clear();\n }\n\n /**\n * List every key currently present in the store.\n *\n * @returns an array of all stored keys\n */\n async keys(): Promise<string[]> {\n return (await this.#ready).keys();\n }\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport { InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\n/**\n * User-visible button labels consumed by `KitOverlayController`.\n *\n * @remarks\n * The kit deliberately ships no i18n strings of its own and has no hard dependency on\n * `@angular/localize`. The consuming application always provides these labels: multilingual apps\n * pass `$localize`-resolved strings, single-language apps pass plain literals.\n */\nexport interface KitLabels {\n /** Text for the \"close\" button used by alerts and toasts. */\n readonly close: string;\n /** Text for the \"cancel\" button used by confirmation alerts. */\n readonly cancel: string;\n}\n\n/**\n * Overlay configuration injected via `provideKitOverlay()`.\n *\n * @remarks\n * All fields are required; the consuming application must supply a complete configuration.\n */\nexport interface KitOverlayConfig {\n /** Button labels used across the overlays presented by `KitOverlayController`. */\n readonly labels: KitLabels;\n}\n\n/**\n * Injection token carrying the {@link KitOverlayConfig} for `KitOverlayController`.\n *\n * @remarks\n * Provide it through {@link provideKitOverlay} rather than registering it directly.\n */\nexport const KIT_OVERLAY_CONFIG = new InjectionToken<KitOverlayConfig>('@rdlabo/ionic-angular-kit:overlay');\n\n/**\n * Wire `KitOverlayController` into the application by providing its button labels.\n *\n * @param config - overlay configuration, including the button labels to inject\n * @returns environment providers to add to the application's provider list\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideKitOverlay({ labels: { close: $localize`Close`, cancel: $localize`Cancel` } }),\n * ],\n * });\n * ```\n */\nexport const provideKitOverlay = (config: KitOverlayConfig): EnvironmentProviders =>\n makeEnvironmentProviders([{ provide: KIT_OVERLAY_CONFIG, useValue: config }]);\n","import { Capacitor } from '@capacitor/core';\nimport { Haptics, ImpactStyle } from '@capacitor/haptics';\n\n/**\n * Trigger native haptic impact feedback.\n *\n * Delegates to `@capacitor/haptics` `Haptics.impact()` when running on a native platform. On the\n * web (or any non-native platform) it is a no-op and resolves without doing anything.\n *\n * @remarks\n * This haptic side effect was previously bundled implicitly into toast/modal presentation. It has\n * been decoupled into this explicit function so callers opt in to the feedback deliberately, rather\n * than receiving it as a hidden side effect of presenting UI.\n *\n * @param style - The impact intensity to play. Defaults to {@link ImpactStyle.Light}.\n * @returns A promise that resolves once the feedback has been requested (immediately on the web).\n * @example\n * ```ts\n * import { ImpactStyle } from '@capacitor/haptics';\n *\n * // Light tap (default)\n * await kitImpact();\n *\n * // Stronger feedback, e.g. on a confirming action\n * await kitImpact(ImpactStyle.Heavy);\n * ```\n */\nexport const kitImpact = async (style: ImpactStyle = ImpactStyle.Light): Promise<void> => {\n if (Capacitor.isNativePlatform()) {\n await Haptics.impact({ style });\n }\n};\n","import { inject, Injectable } from '@angular/core';\nimport type { ModalOptions, PopoverOptions, ToastOptions } from '@ionic/angular/standalone';\nimport { AlertController, ModalController, PopoverController, ToastController } from '@ionic/angular/standalone';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { Capacitor } from '@capacitor/core';\nimport { Keyboard } from '@capacitor/keyboard';\nimport { KIT_OVERLAY_CONFIG } from './overlay-config';\nimport { kitImpact } from '../utils/haptics';\n\n/**\n * Options for {@link KitOverlayController.presentModal}.\n *\n * @remarks\n * Extends Ionic's `ModalOptions` but omits `component` and `componentProps`, which are passed as\n * dedicated arguments instead.\n */\nexport interface KitModalPresentOptions extends Omit<ModalOptions, 'component' | 'componentProps'> {\n /**\n * When `true`, expand the sheet to its maximum breakpoint while the native keyboard is shown.\n *\n * @remarks\n * Only has an effect on native platforms; ignored on the web.\n */\n watchKeyboard?: boolean;\n}\n\n/**\n * Options for {@link KitOverlayController.alertClose}.\n */\nexport interface KitAlertCloseOptions {\n /** Alert header text. */\n header: string;\n /** Alert body message. */\n message: string;\n /** Optional alert sub-header text shown beneath the header. */\n subHeader?: string;\n}\n\n/**\n * Options for {@link KitOverlayController.alertConfirm}.\n *\n * @remarks\n * Extends {@link KitAlertCloseOptions} with the confirm-button text.\n */\nexport interface KitAlertConfirmOptions extends KitAlertCloseOptions {\n /**\n * Text for the OK (confirm) button.\n *\n * @remarks\n * Action-specific, so it is supplied by the caller rather than taken from the shared labels.\n */\n okText: string;\n}\n\n/**\n * Attach a native keyboard listener that grows the modal to its maximum breakpoint when the\n * keyboard appears.\n *\n * @param modal - the presented modal element to resize\n * @returns a listener handle; on non-native platforms a no-op handle whose `remove()` does nothing\n * @internal\n */\nconst watchModalKeyboard = async (modal: HTMLIonModalElement): Promise<PluginListenerHandle> => {\n if (!Capacitor.isNativePlatform()) {\n return { remove: async () => undefined };\n }\n return Keyboard.addListener('keyboardDidShow', () => modal.setCurrentBreakpoint(1));\n};\n\n/**\n * Ergonomic wrapper that consolidates Ionic's overlay controllers (Modal / Toast / Alert).\n *\n * @remarks\n * Folds the repetitive create → present → onDidDismiss sequence into single calls and returns the\n * relevant result directly. It holds no application-specific policy such as navigation; compose\n * those concerns on the consuming side.\n *\n * @example\n * ```ts\n * constructor(private readonly overlay: KitOverlayController) {}\n *\n * async edit(): Promise<void> {\n * const result = await this.overlay.presentModal<EditResult>(EditPage, { id: 1 });\n * if (result) {\n * await this.overlay.presentToast({ message: 'Saved' });\n * }\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitOverlayController {\n readonly #modalCtrl = inject(ModalController);\n readonly #popoverCtrl = inject(PopoverController);\n readonly #toastCtrl = inject(ToastController);\n readonly #alertCtrl = inject(AlertController);\n readonly #labels = inject(KIT_OVERLAY_CONFIG).labels;\n\n /**\n * Present a modal and resolve with the data passed to its dismissal.\n *\n * @typeParam O - type of the data returned when the modal is dismissed\n * @param component - the component to render inside the modal\n * @param componentProps - props to pass to the modal component\n * @param options - additional modal options, including {@link KitModalPresentOptions.watchKeyboard}\n * @returns the dismiss data, or `undefined` when the modal is dismissed without data\n * @example\n * ```ts\n * const data = await overlay.presentModal<{ saved: boolean }>(EditPage, { id: 1 }, { watchKeyboard: true });\n * ```\n */\n async presentModal<O = unknown>(\n component: ModalOptions['component'],\n componentProps?: ModalOptions['componentProps'],\n options: KitModalPresentOptions = {},\n ): Promise<O | undefined> {\n const { watchKeyboard, ...modalOptions } = options;\n const modal = await this.#modalCtrl.create({ component, componentProps, ...modalOptions });\n await modal.present();\n const handle = watchKeyboard ? await watchModalKeyboard(modal) : null;\n const { data } = await modal.onDidDismiss<O>();\n await handle?.remove();\n return data;\n }\n\n /**\n * Present a popover and resolve with the data passed to its dismissal.\n *\n * @typeParam O - type of the data returned when the popover is dismissed\n * @param component - the component to render inside the popover\n * @param componentProps - props to pass to the popover component\n * @param options - additional popover options (for example `event` to anchor it, or `cssClass`)\n * @returns the dismiss data, or `undefined` when the popover is dismissed without data\n * @example\n * ```ts\n * const choice = await overlay.presentPopover<MenuChoice>(MenuPopover, { items }, { event });\n * ```\n */\n async presentPopover<O = unknown>(\n component: PopoverOptions['component'],\n componentProps?: PopoverOptions['componentProps'],\n options: Omit<PopoverOptions, 'component' | 'componentProps'> = {},\n ): Promise<O | undefined> {\n const popover = await this.#popoverCtrl.create({ component, componentProps, ...options });\n await popover.present();\n const { data } = await popover.onDidDismiss<O>();\n return data;\n }\n\n /**\n * Present a toast using kit defaults that the caller may override.\n *\n * @remarks\n * Defaults to a top position, a 2000ms duration, a vertical swipe gesture, and a close button\n * from the configured labels; any of these can be overridden via `options`. Presenting a toast\n * also triggers light native haptic feedback as an intentional kit UX choice.\n *\n * @param options - Ionic toast options that override the kit defaults\n * @returns the presented toast element\n * @example\n * ```ts\n * await overlay.presentToast({ message: 'Copied to clipboard' });\n * ```\n */\n async presentToast(options: ToastOptions): Promise<HTMLIonToastElement> {\n void kitImpact();\n const toast = await this.#toastCtrl.create({\n position: 'top',\n duration: 2000,\n buttons: [this.#labels.close],\n swipeGesture: 'vertical',\n ...options,\n });\n await toast.present();\n return toast;\n }\n\n /**\n * Present a notification alert with a single \"close\" button and wait for it to be dismissed.\n *\n * @param options - alert content (header, message, optional sub-header)\n * @returns a Promise that resolves once the alert has been dismissed\n * @example\n * ```ts\n * await overlay.alertClose({ header: 'Done', message: 'Your changes were saved.' });\n * ```\n */\n async alertClose(options: KitAlertCloseOptions): Promise<void> {\n const alert = await this.#alertCtrl.create({\n header: options.header,\n subHeader: options.subHeader,\n message: options.message,\n buttons: [this.#labels.close],\n });\n await alert.present();\n await alert.onWillDismiss();\n }\n\n /**\n * Present a confirmation alert with cancel and OK buttons.\n *\n * @param options - alert content plus the OK button text via {@link KitAlertConfirmOptions.okText}\n * @returns `true` when the user presses OK, `false` otherwise (cancel or backdrop dismissal)\n * @example\n * ```ts\n * const ok = await overlay.alertConfirm({\n * header: 'Delete item?',\n * message: 'This cannot be undone.',\n * okText: 'Delete',\n * });\n * if (ok) {\n * await remove();\n * }\n * ```\n */\n async alertConfirm(options: KitAlertConfirmOptions): Promise<boolean> {\n const alert = await this.#alertCtrl.create({\n header: options.header,\n subHeader: options.subHeader,\n message: options.message,\n buttons: [\n { text: this.#labels.cancel, role: 'cancel' },\n { text: options.okText, role: 'confirm' },\n ],\n });\n await alert.present();\n const { role } = await alert.onWillDismiss();\n return role === 'confirm';\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { AlertController } from '@ionic/angular/standalone';\nimport { KIT_OVERLAY_CONFIG } from './overlay-config';\n\n/**\n * Content for {@link KitReloadAlertController.present}.\n */\nexport interface KitReloadAlertOptions {\n /** Alert header text. */\n header: string;\n /** Alert body message. */\n message: string;\n /**\n * Text for the reload (confirm) button, e.g. \"リフレッシュ\".\n *\n * @remarks\n * Action-specific, so it is supplied by the caller rather than taken from the shared labels.\n * The cancel button uses the configured {@link KitLabels.cancel}.\n */\n okText: string;\n}\n\n/**\n * The fleet's canonical \"network error → offer to reload\" alert, as a stateful controller.\n *\n * @remarks\n * Consolidates the good-UX variant that had drifted across the fleet into one behavior:\n *\n * - **De-dup** — never stacks; a second {@link present} while an alert is already shown is a no-op.\n * - **Backdrop lock** — `backdropDismiss: false`, so a critical network error can't be dismissed by\n * an accidental backdrop tap; the user consciously chooses cancel or reload.\n * - **Auto-dismiss on reconnect** — the presented alert is tracked, so {@link dismiss} (called from a\n * later successful response) clears a now-stale error alert instead of leaving it on screen.\n * - **Reload on confirm** — the confirm button calls `location.reload()`.\n *\n * All user-facing text is supplied by the caller so the kit stays free of any hardcoded i18n; the\n * cancel button reuses {@link KitOverlayConfig.labels}. Because it performs navigation\n * (`location.reload()`) and holds state, it is a dedicated controller rather than part of\n * {@link KitOverlayController}, which stays free of navigation policy.\n *\n * @example\n * ```ts\n * // In an HTTP interceptor:\n * const reload = inject(KitReloadAlertController);\n * // ...on a network-class error while connected:\n * await reload.present({ header: 'ネットワークエラー', message: `…(${status})`, okText: 'リフレッシュ' });\n * // ...on any later successful response:\n * await reload.dismiss();\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitReloadAlertController {\n readonly #alertCtrl = inject(AlertController);\n readonly #labels = inject(KIT_OVERLAY_CONFIG).labels;\n #alert: HTMLIonAlertElement | null = null;\n\n /**\n * Present the reload alert, unless one is already on screen.\n *\n * @param options - alert content plus the reload-button text\n * @returns a Promise that resolves once the alert has been presented (or immediately if suppressed)\n */\n async present(options: KitReloadAlertOptions): Promise<void> {\n // この controller 経由でも直書き ion-alert でも、多重表示しない。\n if (this.#alert || document.querySelector('ion-alert')) {\n return;\n }\n const alert = await this.#alertCtrl.create({\n header: options.header,\n message: options.message,\n backdropDismiss: false,\n buttons: [\n { text: this.#labels.cancel, role: 'cancel' },\n {\n text: options.okText,\n handler: () => {\n location.reload();\n },\n },\n ],\n });\n this.#alert = alert;\n void alert.onDidDismiss().then(() => {\n // 別の present で置き換わっていない限り、追跡を解除する。\n if (this.#alert === alert) {\n this.#alert = null;\n }\n });\n await alert.present();\n }\n\n /**\n * Dismiss the tracked reload alert if one is showing.\n *\n * @remarks\n * Typically called from a later successful response so a stale \"network error\" alert clears once\n * connectivity is restored. A no-op when nothing is showing.\n *\n * @returns a Promise that resolves once the alert has been dismissed (or immediately if none)\n */\n async dismiss(): Promise<void> {\n const alert = this.#alert;\n this.#alert = null;\n await alert?.dismiss();\n }\n}\n","import type { AlertController } from '@ionic/angular/standalone';\n\n/**\n * Content for {@link kitPresentAuthFailedAlert}.\n */\nexport interface KitAuthFailedAlertOptions {\n /** Alert header, e.g. \"ログインできませんでした\". */\n header: string;\n /** Optional sub-header; typically the short server error code/name. */\n subHeader?: string;\n /** Alert body message; typically the server-provided detail. */\n message: string;\n /** Text for the single close button, e.g. \"閉じる\". */\n closeText: string;\n}\n\n/**\n * Present the fleet's canonical \"sign-in / token exchange failed\" alert.\n *\n * @remarks\n * Folds together the alert every token-exchange app duplicated verbatim when a startup re-login\n * fails: an informative alert (header + optional server error as sub-header + detail message) with a\n * single close button that reloads the app (`location.reload()`) so the user restarts cleanly. The\n * caller is still responsible for signing the user out around this call.\n *\n * All user-facing text is supplied by the caller so the kit stays free of any hardcoded i18n. Kept\n * as a standalone helper (taking the `AlertController`) rather than a method on\n * {@link KitOverlayController}, which holds no navigation policy such as `location.reload()`.\n *\n * @param alertCtrl - Ionic's `AlertController`\n * @param options - alert content plus the close-button text\n * @returns a Promise that resolves once the alert has been presented\n * @example\n * ```ts\n * onAuthorized: async () => {\n * const logged = await auth.tokenLogin().catch(async (e) => {\n * await kitPresentAuthFailedAlert(alertCtrl, {\n * header: 'ログインできませんでした',\n * subHeader: e.error.error,\n * message: e.error.detail,\n * closeText: '閉じる',\n * });\n * await auth.signOut();\n * return undefined;\n * });\n * // ...\n * };\n * ```\n */\nexport const kitPresentAuthFailedAlert = async (\n alertCtrl: AlertController,\n options: KitAuthFailedAlertOptions,\n): Promise<void> => {\n const alert = await alertCtrl.create({\n header: options.header,\n subHeader: options.subHeader,\n message: options.message,\n buttons: [\n {\n text: options.closeText,\n role: 'cancel',\n handler: () => {\n location.reload();\n },\n },\n ],\n });\n await alert.present();\n};\n","import type { OnInit } from '@angular/core';\nimport { Directive, ElementRef, inject } from '@angular/core';\nimport { Capacitor } from '@capacitor/core';\n\n/**\n * Work around iOS `ion-input` autofill values not propagating to the Angular form model.\n *\n * On iOS, when the browser autofills an `ion-input` (for example a saved password), the value\n * is written to the underlying native `<input>` element but the corresponding `change` event is\n * not forwarded to the host `ion-input`, so the Angular form control (and `ngModel`) never sees\n * the autofilled value. This directive listens for the first `change` event on the inner input\n * element and mirrors its value back onto the host element, restoring two-way binding.\n *\n * Apply it to any `ion-input` that participates in a form and may be autofilled by attaching the\n * `rdlaboAutofill` attribute.\n *\n * @remarks\n * The directive is a no-op on every platform other than iOS, where the value already propagates\n * correctly. A short timeout is used because `ion-input` creates its inner `<input>` element\n * asynchronously after the host element is initialized.\n *\n * @example\n * ```html\n * <ion-input rdlaboAutofill type=\"password\" [(ngModel)]=\"password\"></ion-input>\n * ```\n */\n@Directive({\n selector: '[rdlaboAutofill]',\n standalone: true,\n})\nexport class KitAutofillDirective implements OnInit {\n readonly #el = inject(ElementRef);\n\n constructor() {}\n\n /**\n * Register the iOS autofill workaround once the directive is initialized.\n *\n * Returns immediately on non-iOS platforms. On iOS, after a short delay it attaches a one-shot,\n * passive `change` listener to the inner `<input>` element that `ion-input` renders, copying the\n * autofilled value back onto the host element so the Angular form model stays in sync. Any error\n * while locating the inner input (for example if the element is not yet present) is swallowed.\n *\n * @returns Nothing.\n */\n ngOnInit(): void {\n if (Capacitor.getPlatform() !== 'ios') {\n return;\n }\n setTimeout(() => {\n try {\n this.#el.nativeElement.children[0].addEventListener(\n 'change',\n (e: Event) => {\n this.#el.nativeElement.value = (e.target as HTMLInputElement).value;\n },\n {\n capture: false,\n once: true,\n passive: true,\n },\n );\n } catch {\n /* empty */\n }\n }, 100); // Need some time for the ion-input to create the input element\n }\n}\n","import type { ElementRef } from '@angular/core';\nimport { DOCUMENT, inject, Injectable } from '@angular/core';\nimport { Platform } from '@ionic/angular/standalone';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { Keyboard } from '@capacitor/keyboard';\n\n/**\n * How {@link KitKeyboardController.init} adjusts the target element when the native keyboard appears.\n *\n * - `transform` — CSS `translateY(-keyboardHeight + safeAreaBottom)` for a smooth iOS animation\n * (typical for an `ion-footer`).\n * - `offset` — set the `--offset-bottom` custom property to the negative keyboard height.\n * - `keyboard-offset` — set the `--padding-bottom` custom property to the keyboard height.\n */\nexport type KitKeyboardAdjust = 'transform' | 'offset' | 'keyboard-offset';\n\n/**\n * Registers native keyboard listeners that reposition an element when the keyboard shows/hides.\n *\n * @remarks\n * A no-op on non-hybrid (web) platforms — `init` returns an empty handle list. On native it handles\n * iOS and Android differences (Android only toggles the `footer-toolbar-padding` class on an\n * `ion-footer` for the `transform` mode, working around an Ionic footer bug). The caller owns the\n * returned handles and must `remove()` them when the view is destroyed.\n *\n * @example\n * ```ts\n * export class ComposePage {\n * readonly #keyboard = inject(KitKeyboardController);\n * readonly #footer = viewChild.required<ElementRef>('footer');\n * #handles: PluginListenerHandle[] = [];\n *\n * async ngAfterViewInit() {\n * this.#handles = await this.#keyboard.init(this.#footer(), 'transform');\n * }\n * ngOnDestroy() {\n * this.#handles.forEach((h) => h.remove());\n * }\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class KitKeyboardController {\n readonly #platform = inject(Platform);\n readonly #document = inject(DOCUMENT);\n\n /**\n * Attach keyboard show/hide listeners that adjust `elementRef` per `type`.\n *\n * @param elementRef - The element to reposition (e.g. an `ion-footer`).\n * @param type - The adjustment strategy; see {@link KitKeyboardAdjust}.\n * @returns The registered listener handles (empty on non-native platforms).\n */\n async init(elementRef: ElementRef, type: KitKeyboardAdjust): Promise<PluginListenerHandle[]> {\n if (!this.#platform.is('hybrid')) {\n return [];\n }\n return [\n await this.#keyboardWillShow(elementRef, type),\n await this.#keyboardWillHide(elementRef, type),\n await this.#keyboardDidShow(elementRef),\n await this.#keyboardDidHide(elementRef),\n ];\n }\n\n #keyboardWillShow(elementRef: ElementRef, type: KitKeyboardAdjust): Promise<PluginListenerHandle> {\n return Keyboard.addListener('keyboardWillShow', (info) => {\n if (this.#platform.is('android')) {\n if (elementRef.nativeElement.tagName === 'ION-FOOTER' && type === 'transform') {\n // https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/footer/footer.tsx\n elementRef.nativeElement.classList.remove('footer-toolbar-padding');\n }\n return;\n }\n\n elementRef.nativeElement.classList.add('show-keyboard');\n const bodyStyleDeclaration = window.getComputedStyle(this.#document.querySelector('body') as Element);\n const safeArea = parseInt(bodyStyleDeclaration.getPropertyValue('--ion-safe-area-bottom'), 10);\n\n if (type === 'transform') {\n elementRef.nativeElement.style.transition = 'transform 420ms';\n elementRef.nativeElement.style.willChange = 'transform';\n requestAnimationFrame(\n () => (elementRef.nativeElement.style.transform = `translateY(${info.keyboardHeight * -1 + safeArea}px)`),\n );\n } else if (type === 'offset') {\n requestAnimationFrame(() => {\n const keyboardOffset = elementRef.nativeElement.style.getPropertyValue('--keyboard-offset');\n if (!keyboardOffset || parseInt(keyboardOffset, 10) === 0) {\n elementRef.nativeElement.style.setProperty('--offset-bottom', `${info.keyboardHeight * -1}px`);\n }\n });\n } else {\n requestAnimationFrame(() => {\n const keyboardOffset = elementRef.nativeElement.style.getPropertyValue('--keyboard-offset');\n if (!keyboardOffset || parseInt(keyboardOffset, 10) === 0) {\n elementRef.nativeElement.style.setProperty('--padding-bottom', `${info.keyboardHeight}px`);\n }\n });\n }\n });\n }\n\n #keyboardWillHide(elementRef: ElementRef, type: KitKeyboardAdjust): Promise<PluginListenerHandle> {\n return Keyboard.addListener('keyboardWillHide', () => {\n if (this.#platform.is('android')) {\n if (elementRef.nativeElement.tagName === 'ION-FOOTER' && type === 'transform') {\n elementRef.nativeElement.classList.add('footer-toolbar-padding');\n }\n return;\n }\n\n elementRef.nativeElement.classList.remove('show-keyboard');\n\n if (type === 'transform') {\n elementRef.nativeElement.style.transition = 'transform 0ms';\n elementRef.nativeElement.style.transform = `translateY(0px)`;\n elementRef.nativeElement.style.willChange = 'transform';\n } else if (type === 'offset') {\n elementRef.nativeElement.style.setProperty('--offset-bottom', '0px');\n } else {\n elementRef.nativeElement.style.setProperty('--padding-bottom', '0px');\n }\n });\n }\n\n #keyboardDidShow(elementRef: ElementRef): Promise<PluginListenerHandle> {\n return Keyboard.addListener('keyboardDidShow', () => {\n elementRef.nativeElement.style.willChange = 'auto';\n });\n }\n\n #keyboardDidHide(elementRef: ElementRef): Promise<PluginListenerHandle> {\n return Keyboard.addListener('keyboardDidHide', () => {\n elementRef.nativeElement.style.willChange = 'auto';\n });\n }\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport { inject, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { CanActivateFn, RouterStateSnapshot, UrlTree } from '@angular/router';\nimport { Router } from '@angular/router';\nimport { NavController } from '@ionic/angular/standalone';\nimport type { Observable } from 'rxjs';\nimport { map, mergeMap } from 'rxjs/operators';\n\n/**\n * Discriminated set of authentication states the guards react to.\n *\n * @remarks\n * The application is responsible for emitting these values through {@link KitAuthConfig.authState}.\n * An application that does not use a value (for example email confirmation) simply never emits it.\n *\n * - `user` — fully authenticated and verified.\n * - `confirm` — awaiting email confirmation.\n * - `required` — not authenticated.\n * - `anonymous` — signed in anonymously; the user can still be guided toward full registration.\n */\nexport type KitAuthState = 'user' | 'confirm' | 'required' | 'anonymous';\n\n/**\n * Redirect targets (route paths) used by the guards when access is denied.\n *\n * @remarks\n * Every field is required and must be provided per application, because the guards have no\n * knowledge of the host application's route layout.\n */\nexport interface KitAuthRedirects {\n /** Used by {@link kitRequiredUnauthorizedGuard}: where to navigate when the user is already authenticated (`user`). */\n readonly whenAuthorized: string;\n /** Used by {@link kitRequiredUnauthorizedGuard}: where to navigate when the user is awaiting email confirmation (`confirm`). */\n readonly whenConfirming: string;\n /** Used by {@link kitRequireConfirmingGuard}: where to navigate when the state is not `confirm`. */\n readonly whenNotConfirming: string;\n /** Used by {@link kitRequireAuthorizedGuard}: where to navigate when the state is not `user` and the fallback is not allowed. */\n readonly whenUnauthorized: string;\n}\n\n/**\n * Configuration consumed by the authentication guards, injected through {@link provideKitAuth}.\n *\n * @remarks\n * `authState` and `redirects` are required. The `onAuthorized` / `onUnauthenticated` hooks are\n * optional and default to allowing the authenticated user through (`true`) and falling through to\n * the default redirect (`false`) respectively, so an app only supplies the ones with real logic.\n */\nexport interface KitAuthConfig {\n /**\n * Source of the current authentication state.\n *\n * @remarks\n * Typically backed by the application's own auth service (for example `AuthService.isAuth()`).\n *\n * @returns A stream of {@link KitAuthState} values.\n */\n authState(): Observable<KitAuthState>;\n /**\n * Application-specific work that runs in {@link kitRequireAuthorizedGuard} after the state is confirmed to be `user`.\n *\n * @remarks\n * Typical responsibilities include token login, permission checks, terms-of-service acceptance,\n * or restoring a previously requested redirect. Optional; defaults to `true` (allow activation).\n *\n * @param state - The router state snapshot of the route being activated.\n * @returns `true` to allow activation, or a `UrlTree` to perform a custom redirect.\n */\n onAuthorized?(state: RouterStateSnapshot): Promise<boolean | UrlTree>;\n /**\n * Fallback that runs in {@link kitRequireAuthorizedGuard} when the state is `required` (not authenticated).\n *\n * @remarks\n * For example, attempt an anonymous sign-in and allow the route. Optional; defaults to `false`\n * (fall through to the default `whenUnauthorized` redirect).\n *\n * @param state - The router state snapshot of the route being activated.\n * @returns `true` to allow activation, a `UrlTree` for a custom redirect, or `false` to use the default redirect.\n */\n onUnauthenticated?(state: RouterStateSnapshot): Promise<boolean | UrlTree>;\n /** Redirect targets used by the guards. */\n redirects: KitAuthRedirects;\n}\n\n/**\n * Injection token that carries the {@link KitAuthConfig} to the authentication guards.\n */\nexport const KIT_AUTH_CONFIG = new InjectionToken<KitAuthConfig>('@rdlabo/ionic-angular-kit:auth');\n\n/**\n * Wire the authentication guard configuration into the application's dependency injection.\n *\n * @remarks\n * The factory runs inside an injection context, so it may call `inject()` (for example\n * `inject(AuthService)`) to build the configuration.\n *\n * @param configFactory - Factory that returns the {@link KitAuthConfig} for the application.\n * @returns Environment providers to add to the application bootstrap.\n *\n * @example\n * ```ts\n * provideKitAuth(() => {\n * const auth = inject(AuthService);\n * return {\n * // onAuthorized / onUnauthenticated are optional (default: allow / fall through to redirect).\n * authState: () => auth.isAuth(),\n * redirects: {\n * whenAuthorized: '/',\n * whenConfirming: '/auth/confirm',\n * whenNotConfirming: '/auth/signin',\n * whenUnauthorized: 'auth',\n * },\n * };\n * });\n * ```\n */\nexport const provideKitAuth = (configFactory: () => KitAuthConfig): EnvironmentProviders =>\n makeEnvironmentProviders([{ provide: KIT_AUTH_CONFIG, useFactory: configFactory }]);\n\n/**\n * Guard that requires the user to be unauthenticated (for example sign-in or sign-up pages).\n *\n * @remarks\n * Allows the `required` and `anonymous` states (an anonymous user is permitted to proceed to a\n * registration page). An authenticated user (`user`) is sent to `whenAuthorized`, and a user\n * awaiting confirmation (`confirm`) is sent to `whenConfirming`.\n *\n * @returns A stream emitting `true` to allow activation, or `false` after triggering a redirect.\n *\n * @example\n * ```ts\n * const routes: Routes = [{ path: 'signin', component: SigninPage, canActivate: [kitRequiredUnauthorizedGuard] }];\n * ```\n */\nexport const kitRequiredUnauthorizedGuard: CanActivateFn = () => {\n const { authState, redirects } = inject(KIT_AUTH_CONFIG);\n const router = inject(Router);\n const navCtrl = inject(NavController);\n\n return authState().pipe(\n map((data) => {\n if (data === 'user') {\n navCtrl.setDirection('root');\n router.navigate([redirects.whenAuthorized]);\n return false;\n } else if (data === 'confirm') {\n router.navigate([redirects.whenConfirming]);\n return false;\n }\n // 'required' | 'anonymous'\n return true;\n }),\n );\n};\n\n/**\n * Guard that requires the user to be awaiting email confirmation (`confirm`).\n *\n * @remarks\n * Any other state triggers a redirect: an `anonymous` user is sent to the authenticated area\n * (`whenAuthorized`), and every remaining state is sent to `whenNotConfirming`.\n *\n * @returns A stream emitting `true` to allow activation, or `false` after triggering a redirect.\n *\n * @example\n * ```ts\n * const routes: Routes = [{ path: 'confirm', component: ConfirmPage, canActivate: [kitRequireConfirmingGuard] }];\n * ```\n */\nexport const kitRequireConfirmingGuard: CanActivateFn = () => {\n const { authState, redirects } = inject(KIT_AUTH_CONFIG);\n const router = inject(Router);\n const navCtrl = inject(NavController);\n\n return authState().pipe(\n map((data) => {\n if (data === 'confirm') {\n return true;\n }\n navCtrl.setDirection('root');\n router.navigate([data === 'anonymous' ? redirects.whenAuthorized : redirects.whenNotConfirming]);\n return false;\n }),\n );\n};\n\n/**\n * Guard that requires the user to be fully authenticated (`user`).\n *\n * @remarks\n * - `user` — runs {@link KitAuthConfig.onAuthorized} (token login, permission checks, and so on).\n * - `anonymous` — allowed as-is, for applications that permit anonymous browsing.\n * - `required` / `confirm` — runs {@link KitAuthConfig.onUnauthenticated}; if it resolves to `false`,\n * the user is redirected to `whenUnauthorized`.\n *\n * @param _route - The activated route snapshot (unused).\n * @param state - The router state snapshot, forwarded to the configuration hooks.\n * @returns A stream emitting the activation result: `true`, a `UrlTree`, or `false` after a redirect.\n *\n * @example\n * ```ts\n * const routes: Routes = [{ path: 'home', component: HomePage, canActivate: [kitRequireAuthorizedGuard] }];\n * ```\n */\nexport const kitRequireAuthorizedGuard: CanActivateFn = (_route, state) => {\n const { authState, onAuthorized, onUnauthenticated, redirects } = inject(KIT_AUTH_CONFIG);\n const router = inject(Router);\n const navCtrl = inject(NavController);\n\n return authState().pipe(\n mergeMap(async (data) => {\n if (data === 'user') {\n // 既定は「許可」。tokenLogin / 権限確認等が必要なアプリだけ onAuthorized を渡す。\n return onAuthorized ? onAuthorized(state) : true;\n }\n if (data === 'anonymous') {\n return true;\n }\n // 既定は false(whenUnauthorized へ)。匿名ログイン等のフォールバックが要るアプリだけ渡す。\n const fallback = onUnauthenticated ? await onUnauthenticated(state) : false;\n if (fallback !== false) {\n return fallback;\n }\n navCtrl.setDirection('root');\n router.navigate([redirects.whenUnauthorized]);\n return false;\n }),\n );\n};\n","import type { EnvironmentProviders } from '@angular/core';\nimport { inject, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { HttpErrorResponse, HttpEvent, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { HttpResponse } from '@angular/common/http';\nimport { Network } from '@capacitor/network';\nimport type { Observable } from 'rxjs';\nimport { from, retry, throwError, timer } from 'rxjs';\nimport { catchError, mergeMap, tap } from 'rxjs/operators';\n\n/**\n * HTTP status codes that must never be retried. `401` is handled separately and thrown immediately.\n *\n * @internal\n */\nconst NON_RETRYABLE_STATUSES = [400, 403, 404, 418, 500, 502];\n\n/**\n * Configuration that customizes the behavior of {@link kitAuthInterceptor}, injected through {@link provideKitHttp}.\n *\n * @remarks\n * The interceptor fixes the retry policy (up to 2 retries with a linearly increasing backoff, plus immediate\n * throw on `401` and on every {@link NON_RETRYABLE_STATUSES | non-retryable status}) and the overall\n * control flow. Only the hooks below are application-specific.\n *\n * Only {@link KitHttpConfig.getAuthHeaders} is required — it has no safe default. Every other hook is\n * optional and defaults to a no-op (or `{}` / `false` / `null` as appropriate), so an app configures\n * only the behavior that actually differs from the canonical baseline.\n */\nexport interface KitHttpConfig {\n /**\n * Produce authentication and metadata headers for the outgoing request.\n *\n * @param request - The outgoing request about to be sent.\n * @returns A map of header names to values, resolved asynchronously.\n */\n getAuthHeaders(request: HttpRequest<unknown>): Promise<Record<string, string>>;\n /**\n * Produce additional headers for the outgoing request.\n *\n * @remarks\n * Optional; defaults to adding no extra headers.\n *\n * @param request - The outgoing request about to be sent.\n * @returns A map of header names to values; return `{}` when none are needed.\n */\n buildExtraHeaders?(request: HttpRequest<unknown>): Record<string, string>;\n /**\n * Called for every successful response that completed an actual network round trip.\n *\n * @remarks\n * Responses synthesized by {@link KitHttpConfig.offlineFallback} are produced after `catchError`\n * and therefore never reach this hook, so it observes genuine successes only. A typical use is to\n * reset an \"offline\" flag once connectivity is restored. Optional; defaults to a no-op.\n *\n * @param event - The successful `HttpResponse`.\n */\n onResponse?(event: HttpResponse<unknown>): void;\n /**\n * Decide whether to pass the request straight through, skipping auth, retry, and error handling.\n *\n * @remarks\n * Useful for external URLs such as S3 or a CDN. Optional; defaults to `false` (never bypass).\n *\n * @param request - The outgoing request.\n * @returns `true` to bypass the interceptor pipeline.\n */\n bypass?(request: HttpRequest<unknown>): boolean;\n /**\n * Provide an offline short-circuit when a request fails.\n *\n * @remarks\n * Returning a non-null observable replaces the error with that response (for example a queued\n * offline result). Optional; defaults to `null` (no fallback, normal error handling proceeds).\n *\n * @param request - The request that failed (after headers were applied).\n * @param error - The error response that triggered the fallback.\n * @returns A replacement event stream, or `null` for no fallback.\n */\n offlineFallback?(request: HttpRequest<unknown>, error: HttpErrorResponse): Observable<HttpEvent<unknown>> | null;\n /**\n * Side effect to run on a `401` response (for example an expired token).\n *\n * @remarks\n * Optional; defaults to a no-op.\n *\n * @param request - The request that received the `401`.\n */\n onUnauthorized?(request: HttpRequest<unknown>): void;\n /**\n * Side effect to run on a `403` response (a permission error).\n *\n * @remarks\n * Optional; defaults to a no-op.\n *\n * @param request - The request that received the `403`.\n */\n onForbidden?(request: HttpRequest<unknown>): void;\n /**\n * UX hook for network-originated errors while the device is connected.\n *\n * @remarks\n * Optional; defaults to a no-op. The kit ships {@link KitReloadAlertController} as the fleet's\n * canonical implementation of this hook (with auto-dismiss on reconnect via `onResponse`).\n *\n * @param status - The HTTP status code, or a string descriptor for non-HTTP failures.\n * @returns Optionally a promise to await before continuing.\n */\n onNetworkError?(status: number | string): Promise<void> | void;\n /**\n * UX hook for `400` / `500` responses that carry a server-provided message.\n *\n * @remarks\n * Optional; defaults to a no-op.\n *\n * @param message - The message extracted from the error body.\n */\n onServerError?(message: string): void;\n}\n\n/**\n * Injection token that carries the {@link KitHttpConfig} to {@link kitAuthInterceptor}.\n */\nexport const KIT_HTTP_CONFIG = new InjectionToken<KitHttpConfig>('@rdlabo/ionic-angular-kit:http');\n\n/**\n * Wire the {@link kitAuthInterceptor} configuration into the application's dependency injection.\n *\n * @remarks\n * Register the interceptor itself separately via `provideHttpClient(withInterceptors([kitAuthInterceptor]))`.\n * The factory runs inside an injection context, so it may call `inject()`.\n *\n * @param configFactory - Factory that returns the {@link KitHttpConfig} for the application.\n * @returns Environment providers to add to the application bootstrap.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideHttpClient(withInterceptors([kitAuthInterceptor])),\n * provideKitHttp(() => {\n * const auth = inject(AuthService);\n * const reload = inject(KitReloadAlertController);\n * return {\n * // Only getAuthHeaders is required; every other hook is optional and defaults to a no-op.\n * getAuthHeaders: async () => ({ Authorization: `Bearer ${await auth.token()}` }),\n * onUnauthorized: () => auth.signOut(),\n * onNetworkError: (status) =>\n * reload.present({ header: 'Network error', message: `Reload? (${status})`, okText: 'Reload' }),\n * onResponse: () => void reload.dismiss(),\n * };\n * }),\n * ],\n * });\n * ```\n */\nexport const provideKitHttp = (configFactory: () => KitHttpConfig): EnvironmentProviders =>\n makeEnvironmentProviders([{ provide: KIT_HTTP_CONFIG, useFactory: configFactory }]);\n\n/**\n * Canonical functional HTTP interceptor that applies authentication, retries, and error handling.\n *\n * @remarks\n * Behavior, driven by the injected {@link KitHttpConfig}:\n *\n * 1. Requests for which `bypass` returns `true` are forwarded untouched.\n * 2. Otherwise the headers from `getAuthHeaders` and `buildExtraHeaders` are merged onto a cloned request.\n * 3. Failed requests are retried up to 2 times with a linearly increasing backoff of `500ms * (retryCount + 5)`,\n * except that `401` and any {@link NON_RETRYABLE_STATUSES | non-retryable status}\n * (`400`, `403`, `404`, `418`, `500`, `502`) are thrown immediately without retrying.\n * 4. On error, `offlineFallback` is consulted first; otherwise `401` calls `onUnauthorized`, `403`\n * calls `onForbidden`, network-class failures (anything other than `400`/`500`) call\n * `onNetworkError` when the device is connected, and `400`/`500` responses carrying a body\n * message call `onServerError`.\n *\n * @param request - The outgoing request.\n * @param next - The next handler in the interceptor chain.\n * @returns A stream of HTTP events for the (possibly modified, retried, or replaced) request.\n *\n * @example\n * ```ts\n * provideHttpClient(withInterceptors([kitAuthInterceptor]));\n * ```\n */\nexport const kitAuthInterceptor: HttpInterceptorFn = (request, next) => {\n const config = inject(KIT_HTTP_CONFIG);\n\n if (config.bypass?.(request)) {\n return next(request);\n }\n\n return from(config.getAuthHeaders(request)).pipe(\n mergeMap((authHeaders) => {\n const req = request.clone({ setHeaders: { ...authHeaders, ...config.buildExtraHeaders?.(request) } });\n\n return next(req).pipe(\n retry({\n count: 2,\n delay: (e: HttpErrorResponse, retryCount) => {\n if (e.status === 401) {\n return throwError(() => e);\n }\n if (NON_RETRYABLE_STATUSES.includes(e.status)) {\n return throwError(() => e);\n }\n return timer((retryCount + 5) * 500);\n },\n }),\n tap((event) => {\n if (event instanceof HttpResponse) {\n config.onResponse?.(event);\n }\n }),\n catchError((e: HttpErrorResponse) => {\n const fallback = config.offlineFallback?.(req, e);\n if (fallback) {\n return fallback;\n }\n if (e.status === 401) {\n config.onUnauthorized?.(req);\n } else if (e.status === 403) {\n config.onForbidden?.(req);\n } else if (![400, 500].includes(e.status)) {\n void Network.getStatus().then((status) => {\n if (status.connected) {\n config.onNetworkError?.(e.status);\n }\n });\n } else if (e.error?.message) {\n config.onServerError?.(e.error.message);\n }\n return throwError(() => e);\n }),\n );\n }),\n );\n};\n","/**\n * Merge a newly fetched page of items into an existing list by id, keeping the result sorted.\n *\n * Items are merged by the numeric `key` field. On a duplicate `key` the item from `arrayNew` wins\n * and replaces the one in `arrayOld`. Old items whose `key` falls *inside* the window spanned by\n * `arrayNew` (between its first and last `key`) are dropped, since the freshly fetched page is the\n * authoritative copy of that window; old items *outside* the window are kept. The merged items are\n * finally sorted by `key`, ascending or descending according to `order`.\n *\n * The algorithm is:\n * 1. If both inputs are empty, return an empty array.\n * 2. Read the first (`lead`) and last (`last`) `key` values of `arrayNew` as the bounds of the\n * page's window. Keep the old items whose `key` lies *outside* that window (at or beyond the\n * extremes) and drop those strictly inside it, handling both a high-to-low page (`lead > last`)\n * and a low-to-high page (`lead < last`). A single-value page (`lead === last`) keeps all old items.\n * 3. Remove old items whose `key` already exists in `arrayNew` (new wins on duplicates).\n * 4. Concatenate `arrayNew` with the surviving old items and sort by `key` in the requested\n * direction.\n *\n * @remarks\n * Designed for infinite-scroll / paginated list merging, where each fetched page may overlap the\n * previously held items and the server returns a contiguous, ordered window of records. The `key`\n * field is treated as a number for range comparison and sorting.\n *\n * @typeParam T - Element type of both arrays. Its `key` property must be a numeric value.\n * @param arrayOld - The previously accumulated list. May be empty or nullish-safe (empty when falsy).\n * @param arrayNew - The newly fetched page of items; its `key` range defines the window that its own\n * items replace, and its items take precedence on duplicates.\n * @param key - The property of `T` used as the unique, numeric id for matching, range filtering, and sorting.\n * @param order - Sort direction by `key`: `'ASC'` for ascending or `'DESC'` for descending. Defaults to `'DESC'`.\n * @param secondaryKey - Optional second property for extra de-duplication. When provided, any\n * surviving old item whose `secondaryKey` value matches that of *any* new item is dropped before\n * the `key` merge. Useful when a record keeps a stable `key` but its secondary identity changes\n * between pages (e.g. items keyed by `id` but also grouped by `parentId`). Omit to skip this step.\n * @returns A new array containing `arrayNew` merged with the out-of-window, non-duplicate old items, sorted by `key`.\n * @example\n * ```ts\n * interface Post {\n * id: number;\n * title: string;\n * }\n *\n * const loaded: Post[] = [\n * { id: 30, title: 'c' },\n * { id: 20, title: 'b' },\n * { id: 10, title: 'a' },\n * ];\n * const nextPage: Post[] = [\n * { id: 20, title: 'b (updated)' },\n * { id: 15, title: 'a.5' },\n * ];\n *\n * // Descending merge: id 30 lies above the new page's [15, 20] window so it is kept; id 20 is\n * // inside the window and is replaced by the new value; id 10 lies below the window and is kept.\n * const merged = arrayConcatById(loaded, nextPage, 'id', 'DESC');\n * // => [{ id: 30, title: 'c' }, { id: 20, title: 'b (updated)' }, { id: 15, title: 'a.5' }, { id: 10, title: 'a' }]\n * ```\n */\nexport const arrayConcatById = <T>(\n arrayOld: T[],\n arrayNew: T[],\n key: keyof T,\n order: 'ASC' | 'DESC' = 'DESC',\n secondaryKey?: keyof T,\n): T[] => {\n if (!arrayNew.length && !arrayOld.length) {\n return [];\n }\n const lead = arrayNew[0][key] as number;\n const last = arrayNew[arrayNew.length - 1][key] as number;\n\n const filteredOld = (arrayOld || []).filter((vol) => {\n const value = vol[key] as number;\n return (lead > last && (value >= lead || value <= last)) || (lead < last && (value <= lead || value >= last)) || lead === last;\n });\n\n const secondaryFilteredOld = secondaryKey\n ? filteredOld.filter((vol) => !arrayNew.some((element) => element[secondaryKey] === vol[secondaryKey]))\n : filteredOld;\n\n const oldData = secondaryFilteredOld.filter((vol) => !arrayNew.some((element) => element[key] === vol[key]));\n const data = arrayNew.concat(oldData);\n\n const direction = order === 'ASC' ? 1 : -1;\n return data.sort((a, b) => {\n const x = a[key] as number;\n const y = b[key] as number;\n if (x > y) {\n return direction;\n }\n if (x < y) {\n return direction * -1;\n }\n return 0;\n });\n};\n","/**\n * Order-independent deep equality check.\n *\n * @remarks\n * Returns `true` when `a` and `b` serialize to the same value after their (nested) object entries are\n * sorted by key, so property order does not affect the result. Intended for cheap \"did this state\n * object change?\" comparisons.\n *\n * Caveats of the JSON-serialization approach: values that JSON drops or coerces (`undefined`,\n * functions, `NaN`, `Date`, `Map`/`Set`) are compared by their serialized form, and array element\n * order is treated as significant (arrays are not reordered in a meaningful way). Use a structural\n * deep-equal library when those cases matter.\n *\n * @param a - First object.\n * @param b - Second object.\n * @returns `true` when the two objects are deeply equal ignoring key order.\n * @example\n * ```ts\n * objectEqual({ a: 1, b: 2 }, { b: 2, a: 1 }); // => true\n * objectEqual({ a: 1 }, { a: 2 }); // => false\n * ```\n */\nexport const objectEqual = (a: object, b: object): boolean => {\n if (Object.is(a, b)) {\n return true;\n }\n const sortDeep = (obj: unknown): unknown => {\n if (typeof obj !== 'object' || !obj) {\n return undefined;\n }\n return Object.entries(obj)\n .sort()\n .map(([entryKey, value]) => [entryKey, typeof value === 'object' ? sortDeep(value) : value]);\n };\n return JSON.stringify(sortDeep(a)) === JSON.stringify(sortDeep(b));\n};\n","/**\n * Disable the button that triggered an event while an async operation runs, re-enabling it after.\n *\n * @remarks\n * Prevents the common double-submit / double-tap bug: the `event.target` button is disabled, the\n * work is awaited, and the button is re-enabled — even if the work rejects (the rejection is\n * swallowed here so the button always recovers; handle errors inside `work` if you need to react).\n *\n * @param event - The DOM event whose `target` is the button to disable (e.g. a click event).\n * @param work - The async operation to run while the button is disabled.\n * @returns A Promise that resolves once the work has settled and the button has been re-enabled.\n * @example\n * ```ts\n * async submit(event: Event): Promise<void> {\n * await disableHandler(event, this.save());\n * }\n * ```\n */\nexport const disableHandler = async (event: Event, work: Promise<void | boolean>): Promise<void> => {\n const target = event.target as HTMLButtonElement;\n target.disabled = true;\n await work.catch((): undefined => undefined);\n target.disabled = false;\n};\n","/*\n * Public API Surface of @rdlabo/ionic-angular-kit\n */\n\n// Storage: typed wrapper around the platform key/value store.\nexport * from './lib/storage/kit-storage.service';\n\n// Overlay: wrapper around the Ionic Modal / Toast / Alert controllers.\nexport * from './lib/overlay/overlay-config';\nexport * from './lib/overlay/kit-overlay.controller';\nexport * from './lib/overlay/kit-reload-alert.controller';\nexport * from './lib/overlay/kit-auth-failed-alert';\n\n// Directives.\nexport * from './lib/directives/autofill.directive';\n\n// Keyboard: native keyboard reposition listeners.\nexport * from './lib/keyboard/kit-keyboard.controller';\n\n// Auth: functional route guards.\nexport * from './lib/auth/auth-guards';\n\n// HTTP: functional interceptor.\nexport * from './lib/http/kit-http.interceptor';\n\n// Utils: framework-agnostic pure helpers.\nexport * from './lib/utils/haptics';\nexport * from './lib/utils/array';\nexport * from './lib/utils/object';\nexport * from './lib/utils/dom';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;AAqBG;MAIU,iBAAiB,CAAA;;IAEnB,MAAM,GAAqB,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;AAE5D;;;;;;;;;;;AAWG;AACH,IAAA,MAAM,GAAG,CAAI,GAAW,EAAE,KAAQ,EAAA;AAChC,QAAA,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;IAC3C;AAEA;;;;;;;;;;AAUG;IACH,MAAM,GAAG,CAAI,GAAW,EAAA;AACtB,QAAA,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI;IACrD;AAEA;;;;;AAKG;IACH,MAAM,MAAM,CAAC,GAAW,EAAA;QACtB,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;IACvC;AAEA;;;;AAIG;AACH,IAAA,MAAM,KAAK,GAAA;QACT,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE;IACnC;AAEA;;;;AAIG;AACH,IAAA,MAAM,IAAI,GAAA;QACR,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE;IACnC;+GA7DW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,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C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE;AACnC,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG;AACtB,aAAA,IAAI;AACJ,aAAA,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,KAAK,KAAK,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAChG,IAAA,CAAC;AACD,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACpE;;ACnCA;;;;;;;;;;;;;;;;;AAiBG;AACI,MAAM,cAAc,GAAG,OAAO,KAAY,EAAE,IAA6B,KAAmB;AACjG,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAA2B;AAChD,IAAA,MAAM,CAAC,QAAQ,GAAG,IAAI;IACtB,MAAM,IAAI,CAAC,KAAK,CAAC,MAAiB,SAAS,CAAC;AAC5C,IAAA,MAAM,CAAC,QAAQ,GAAG,KAAK;AACzB;;ACvBA;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, EnvironmentProviders, OnInit } from '@angular/core';
|
|
3
|
-
import { ModalOptions, ToastOptions, AlertController } from '@ionic/angular/standalone';
|
|
2
|
+
import { InjectionToken, EnvironmentProviders, OnInit, ElementRef } from '@angular/core';
|
|
3
|
+
import { ModalOptions, PopoverOptions, ToastOptions, AlertController } from '@ionic/angular/standalone';
|
|
4
|
+
import { PluginListenerHandle } from '@capacitor/core';
|
|
4
5
|
import { RouterStateSnapshot, UrlTree, CanActivateFn } from '@angular/router';
|
|
5
6
|
import { Observable } from 'rxjs';
|
|
6
7
|
import { HttpRequest, HttpResponse, HttpErrorResponse, HttpEvent, HttpInterceptorFn } from '@angular/common/http';
|
|
@@ -203,6 +204,20 @@ declare class KitOverlayController {
|
|
|
203
204
|
* ```
|
|
204
205
|
*/
|
|
205
206
|
presentModal<O = unknown>(component: ModalOptions['component'], componentProps?: ModalOptions['componentProps'], options?: KitModalPresentOptions): Promise<O | undefined>;
|
|
207
|
+
/**
|
|
208
|
+
* Present a popover and resolve with the data passed to its dismissal.
|
|
209
|
+
*
|
|
210
|
+
* @typeParam O - type of the data returned when the popover is dismissed
|
|
211
|
+
* @param component - the component to render inside the popover
|
|
212
|
+
* @param componentProps - props to pass to the popover component
|
|
213
|
+
* @param options - additional popover options (for example `event` to anchor it, or `cssClass`)
|
|
214
|
+
* @returns the dismiss data, or `undefined` when the popover is dismissed without data
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const choice = await overlay.presentPopover<MenuChoice>(MenuPopover, { items }, { event });
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
presentPopover<O = unknown>(component: PopoverOptions['component'], componentProps?: PopoverOptions['componentProps'], options?: Omit<PopoverOptions, 'component' | 'componentProps'>): Promise<O | undefined>;
|
|
206
221
|
/**
|
|
207
222
|
* Present a toast using kit defaults that the caller may override.
|
|
208
223
|
*
|
|
@@ -408,6 +423,54 @@ declare class KitAutofillDirective implements OnInit {
|
|
|
408
423
|
static ɵdir: i0.ɵɵDirectiveDeclaration<KitAutofillDirective, "[rdlaboAutofill]", never, {}, {}, never, never, true, never>;
|
|
409
424
|
}
|
|
410
425
|
|
|
426
|
+
/**
|
|
427
|
+
* How {@link KitKeyboardController.init} adjusts the target element when the native keyboard appears.
|
|
428
|
+
*
|
|
429
|
+
* - `transform` — CSS `translateY(-keyboardHeight + safeAreaBottom)` for a smooth iOS animation
|
|
430
|
+
* (typical for an `ion-footer`).
|
|
431
|
+
* - `offset` — set the `--offset-bottom` custom property to the negative keyboard height.
|
|
432
|
+
* - `keyboard-offset` — set the `--padding-bottom` custom property to the keyboard height.
|
|
433
|
+
*/
|
|
434
|
+
type KitKeyboardAdjust = 'transform' | 'offset' | 'keyboard-offset';
|
|
435
|
+
/**
|
|
436
|
+
* Registers native keyboard listeners that reposition an element when the keyboard shows/hides.
|
|
437
|
+
*
|
|
438
|
+
* @remarks
|
|
439
|
+
* A no-op on non-hybrid (web) platforms — `init` returns an empty handle list. On native it handles
|
|
440
|
+
* iOS and Android differences (Android only toggles the `footer-toolbar-padding` class on an
|
|
441
|
+
* `ion-footer` for the `transform` mode, working around an Ionic footer bug). The caller owns the
|
|
442
|
+
* returned handles and must `remove()` them when the view is destroyed.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* export class ComposePage {
|
|
447
|
+
* readonly #keyboard = inject(KitKeyboardController);
|
|
448
|
+
* readonly #footer = viewChild.required<ElementRef>('footer');
|
|
449
|
+
* #handles: PluginListenerHandle[] = [];
|
|
450
|
+
*
|
|
451
|
+
* async ngAfterViewInit() {
|
|
452
|
+
* this.#handles = await this.#keyboard.init(this.#footer(), 'transform');
|
|
453
|
+
* }
|
|
454
|
+
* ngOnDestroy() {
|
|
455
|
+
* this.#handles.forEach((h) => h.remove());
|
|
456
|
+
* }
|
|
457
|
+
* }
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
declare class KitKeyboardController {
|
|
461
|
+
#private;
|
|
462
|
+
/**
|
|
463
|
+
* Attach keyboard show/hide listeners that adjust `elementRef` per `type`.
|
|
464
|
+
*
|
|
465
|
+
* @param elementRef - The element to reposition (e.g. an `ion-footer`).
|
|
466
|
+
* @param type - The adjustment strategy; see {@link KitKeyboardAdjust}.
|
|
467
|
+
* @returns The registered listener handles (empty on non-native platforms).
|
|
468
|
+
*/
|
|
469
|
+
init(elementRef: ElementRef, type: KitKeyboardAdjust): Promise<PluginListenerHandle[]>;
|
|
470
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KitKeyboardController, never>;
|
|
471
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<KitKeyboardController>;
|
|
472
|
+
}
|
|
473
|
+
|
|
411
474
|
/**
|
|
412
475
|
* Discriminated set of authentication states the guards react to.
|
|
413
476
|
*
|
|
@@ -785,6 +848,10 @@ declare const kitImpact: (style?: ImpactStyle) => Promise<void>;
|
|
|
785
848
|
* items replace, and its items take precedence on duplicates.
|
|
786
849
|
* @param key - The property of `T` used as the unique, numeric id for matching, range filtering, and sorting.
|
|
787
850
|
* @param order - Sort direction by `key`: `'ASC'` for ascending or `'DESC'` for descending. Defaults to `'DESC'`.
|
|
851
|
+
* @param secondaryKey - Optional second property for extra de-duplication. When provided, any
|
|
852
|
+
* surviving old item whose `secondaryKey` value matches that of *any* new item is dropped before
|
|
853
|
+
* the `key` merge. Useful when a record keeps a stable `key` but its secondary identity changes
|
|
854
|
+
* between pages (e.g. items keyed by `id` but also grouped by `parentId`). Omit to skip this step.
|
|
788
855
|
* @returns A new array containing `arrayNew` merged with the out-of-window, non-duplicate old items, sorted by `key`.
|
|
789
856
|
* @example
|
|
790
857
|
* ```ts
|
|
@@ -809,7 +876,51 @@ declare const kitImpact: (style?: ImpactStyle) => Promise<void>;
|
|
|
809
876
|
* // => [{ id: 30, title: 'c' }, { id: 20, title: 'b (updated)' }, { id: 15, title: 'a.5' }, { id: 10, title: 'a' }]
|
|
810
877
|
* ```
|
|
811
878
|
*/
|
|
812
|
-
declare const arrayConcatById: <T>(arrayOld: T[], arrayNew: T[], key: keyof T, order?: "ASC" | "DESC") => T[];
|
|
879
|
+
declare const arrayConcatById: <T>(arrayOld: T[], arrayNew: T[], key: keyof T, order?: "ASC" | "DESC", secondaryKey?: keyof T) => T[];
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Order-independent deep equality check.
|
|
883
|
+
*
|
|
884
|
+
* @remarks
|
|
885
|
+
* Returns `true` when `a` and `b` serialize to the same value after their (nested) object entries are
|
|
886
|
+
* sorted by key, so property order does not affect the result. Intended for cheap "did this state
|
|
887
|
+
* object change?" comparisons.
|
|
888
|
+
*
|
|
889
|
+
* Caveats of the JSON-serialization approach: values that JSON drops or coerces (`undefined`,
|
|
890
|
+
* functions, `NaN`, `Date`, `Map`/`Set`) are compared by their serialized form, and array element
|
|
891
|
+
* order is treated as significant (arrays are not reordered in a meaningful way). Use a structural
|
|
892
|
+
* deep-equal library when those cases matter.
|
|
893
|
+
*
|
|
894
|
+
* @param a - First object.
|
|
895
|
+
* @param b - Second object.
|
|
896
|
+
* @returns `true` when the two objects are deeply equal ignoring key order.
|
|
897
|
+
* @example
|
|
898
|
+
* ```ts
|
|
899
|
+
* objectEqual({ a: 1, b: 2 }, { b: 2, a: 1 }); // => true
|
|
900
|
+
* objectEqual({ a: 1 }, { a: 2 }); // => false
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
declare const objectEqual: (a: object, b: object) => boolean;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Disable the button that triggered an event while an async operation runs, re-enabling it after.
|
|
907
|
+
*
|
|
908
|
+
* @remarks
|
|
909
|
+
* Prevents the common double-submit / double-tap bug: the `event.target` button is disabled, the
|
|
910
|
+
* work is awaited, and the button is re-enabled — even if the work rejects (the rejection is
|
|
911
|
+
* swallowed here so the button always recovers; handle errors inside `work` if you need to react).
|
|
912
|
+
*
|
|
913
|
+
* @param event - The DOM event whose `target` is the button to disable (e.g. a click event).
|
|
914
|
+
* @param work - The async operation to run while the button is disabled.
|
|
915
|
+
* @returns A Promise that resolves once the work has settled and the button has been re-enabled.
|
|
916
|
+
* @example
|
|
917
|
+
* ```ts
|
|
918
|
+
* async submit(event: Event): Promise<void> {
|
|
919
|
+
* await disableHandler(event, this.save());
|
|
920
|
+
* }
|
|
921
|
+
* ```
|
|
922
|
+
*/
|
|
923
|
+
declare const disableHandler: (event: Event, work: Promise<void | boolean>) => Promise<void>;
|
|
813
924
|
|
|
814
|
-
export { KIT_AUTH_CONFIG, KIT_HTTP_CONFIG, KIT_OVERLAY_CONFIG, KitAutofillDirective, KitOverlayController, KitReloadAlertController, KitStorageService, arrayConcatById, kitAuthInterceptor, kitImpact, kitPresentAuthFailedAlert, kitRequireAuthorizedGuard, kitRequireConfirmingGuard, kitRequiredUnauthorizedGuard, provideKitAuth, provideKitHttp, provideKitOverlay };
|
|
815
|
-
export type { KitAlertCloseOptions, KitAlertConfirmOptions, KitAuthConfig, KitAuthFailedAlertOptions, KitAuthRedirects, KitAuthState, KitHttpConfig, KitLabels, KitModalPresentOptions, KitOverlayConfig, KitReloadAlertOptions };
|
|
925
|
+
export { KIT_AUTH_CONFIG, KIT_HTTP_CONFIG, KIT_OVERLAY_CONFIG, KitAutofillDirective, KitKeyboardController, KitOverlayController, KitReloadAlertController, KitStorageService, arrayConcatById, disableHandler, kitAuthInterceptor, kitImpact, kitPresentAuthFailedAlert, kitRequireAuthorizedGuard, kitRequireConfirmingGuard, kitRequiredUnauthorizedGuard, objectEqual, provideKitAuth, provideKitHttp, provideKitOverlay };
|
|
926
|
+
export type { KitAlertCloseOptions, KitAlertConfirmOptions, KitAuthConfig, KitAuthFailedAlertOptions, KitAuthRedirects, KitAuthState, KitHttpConfig, KitKeyboardAdjust, KitLabels, KitModalPresentOptions, KitOverlayConfig, KitReloadAlertOptions };
|