@ionic/angular 7.5.4 → 7.5.5-dev.11699655013.1a2cb3ad

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.
Files changed (53) hide show
  1. package/common/index.d.ts +1 -6
  2. package/common/utils/overlay.d.ts +1 -2
  3. package/esm2020/common/index.mjs +2 -7
  4. package/esm2020/common/utils/overlay.mjs +1 -1
  5. package/esm2020/index.mjs +8 -2
  6. package/esm2020/ionic-module.mjs +4 -2
  7. package/esm2020/providers/action-sheet-controller.mjs +18 -0
  8. package/esm2020/providers/animation-controller.mjs +37 -0
  9. package/esm2020/providers/gesture-controller.mjs +31 -0
  10. package/esm2020/providers/modal-controller.mjs +24 -0
  11. package/esm2020/providers/popover-controller.mjs +18 -0
  12. package/esm2020/providers/toast-controller.mjs +18 -0
  13. package/esm2020/standalone/index.mjs +8 -2
  14. package/esm2020/standalone/providers/action-sheet-controller.mjs +18 -0
  15. package/esm2020/standalone/providers/animation-controller.mjs +37 -0
  16. package/esm2020/standalone/providers/gesture-controller.mjs +31 -0
  17. package/esm2020/standalone/providers/ionic-angular.mjs +4 -2
  18. package/esm2020/standalone/providers/modal-controller.mjs +24 -0
  19. package/esm2020/standalone/providers/popover-controller.mjs +18 -0
  20. package/esm2020/standalone/providers/toast-controller.mjs +18 -0
  21. package/fesm2015/ionic-angular-common.mjs +194 -318
  22. package/fesm2015/ionic-angular-common.mjs.map +1 -1
  23. package/fesm2015/ionic-angular-standalone.mjs +124 -5
  24. package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
  25. package/fesm2015/ionic-angular.mjs +124 -5
  26. package/fesm2015/ionic-angular.mjs.map +1 -1
  27. package/fesm2020/ionic-angular-common.mjs +196 -326
  28. package/fesm2020/ionic-angular-common.mjs.map +1 -1
  29. package/fesm2020/ionic-angular-standalone.mjs +130 -5
  30. package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
  31. package/fesm2020/ionic-angular.mjs +130 -5
  32. package/fesm2020/ionic-angular.mjs.map +1 -1
  33. package/index.d.ts +7 -1
  34. package/package.json +2 -2
  35. package/providers/action-sheet-controller.d.ts +8 -0
  36. package/{common/providers → providers}/animation-controller.d.ts +1 -1
  37. package/providers/gesture-controller.d.ts +13 -0
  38. package/providers/modal-controller.d.ts +12 -0
  39. package/providers/popover-controller.d.ts +9 -0
  40. package/providers/toast-controller.d.ts +8 -0
  41. package/standalone/index.d.ts +7 -1
  42. package/{common → standalone}/providers/action-sheet-controller.d.ts +1 -1
  43. package/standalone/providers/animation-controller.d.ts +25 -0
  44. package/{common → standalone}/providers/modal-controller.d.ts +1 -1
  45. package/{common → standalone}/providers/popover-controller.d.ts +1 -4
  46. package/{common → standalone}/providers/toast-controller.d.ts +1 -1
  47. package/esm2020/common/providers/action-sheet-controller.mjs +0 -18
  48. package/esm2020/common/providers/animation-controller.mjs +0 -37
  49. package/esm2020/common/providers/gesture-controller.mjs +0 -31
  50. package/esm2020/common/providers/modal-controller.mjs +0 -25
  51. package/esm2020/common/providers/popover-controller.mjs +0 -25
  52. package/esm2020/common/providers/toast-controller.mjs +0 -18
  53. /package/{common → standalone}/providers/gesture-controller.d.ts +0 -0
@@ -0,0 +1,18 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { OverlayBaseController } from '@ionic/angular/common';
3
+ import { toastController } from '@ionic/core/components';
4
+ import * as i0 from "@angular/core";
5
+ export class ToastController extends OverlayBaseController {
6
+ constructor() {
7
+ super(toastController);
8
+ }
9
+ }
10
+ /** @nocollapse */ ToastController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11
+ /** @nocollapse */ ToastController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, providedIn: 'root' });
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, decorators: [{
13
+ type: Injectable,
14
+ args: [{
15
+ providedIn: 'root',
16
+ }]
17
+ }], ctorParameters: function () { return []; } });
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9hc3QtY29udHJvbGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3N0YW5kYWxvbmUvc3JjL3Byb3ZpZGVycy90b2FzdC1jb250cm9sbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFOUQsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHdCQUF3QixDQUFDOztBQUt6RCxNQUFNLE9BQU8sZUFBZ0IsU0FBUSxxQkFBd0Q7SUFDM0Y7UUFDRSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUM7SUFDekIsQ0FBQzs7Z0lBSFUsZUFBZTtvSUFBZixlQUFlLGNBRmQsTUFBTTs0RkFFUCxlQUFlO2tCQUgzQixVQUFVO21CQUFDO29CQUNWLFVBQVUsRUFBRSxNQUFNO2lCQUNuQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEluamVjdGFibGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IE92ZXJsYXlCYXNlQ29udHJvbGxlciB9IGZyb20gJ0Bpb25pYy9hbmd1bGFyL2NvbW1vbic7XG5pbXBvcnQgdHlwZSB7IFRvYXN0T3B0aW9ucyB9IGZyb20gJ0Bpb25pYy9jb3JlL2NvbXBvbmVudHMnO1xuaW1wb3J0IHsgdG9hc3RDb250cm9sbGVyIH0gZnJvbSAnQGlvbmljL2NvcmUvY29tcG9uZW50cyc7XG5cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnLFxufSlcbmV4cG9ydCBjbGFzcyBUb2FzdENvbnRyb2xsZXIgZXh0ZW5kcyBPdmVybGF5QmFzZUNvbnRyb2xsZXI8VG9hc3RPcHRpb25zLCBIVE1MSW9uVG9hc3RFbGVtZW50PiB7XG4gIGNvbnN0cnVjdG9yKCkge1xuICAgIHN1cGVyKHRvYXN0Q29udHJvbGxlcik7XG4gIH1cbn1cbiJdfQ==
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, NgZone, ApplicationRef, Injector, createComponent, InjectionToken, EnvironmentInjector, Inject, Optional, TemplateRef, Directive, ContentChild, EventEmitter, ViewContainerRef, Attribute, SkipSelf, Input, Output, reflectComponentType, HostListener, ElementRef, ViewChild } from '@angular/core';
3
- import { actionSheetController, alertController, loadingController, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER, LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_UNLOAD, modalController, pickerController, popoverController, toastController, createAnimation, getTimeGivenProgression, createGesture, isPlatform, getPlatforms, componentOnReady } from '@ionic/core/components';
2
+ import { Injectable, Inject, Optional, InjectionToken, inject, NgZone, ApplicationRef, Injector, createComponent, TemplateRef, Directive, ContentChild, EventEmitter, ViewContainerRef, EnvironmentInjector, Attribute, SkipSelf, Input, Output, reflectComponentType, HostListener, ElementRef, ViewChild } from '@angular/core';
3
+ import { alertController, loadingController, pickerController, isPlatform, getPlatforms, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER, LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_UNLOAD, componentOnReady } from '@ionic/core/components';
4
4
  import { __awaiter, __decorate } from 'tslib';
5
5
  import * as i3 from '@angular/router';
6
6
  import { NavigationStart, PRIMARY_OUTLET, ChildrenOutletContexts, ActivatedRoute, Router } from '@angular/router';
@@ -35,20 +35,6 @@ class OverlayBaseController {
35
35
  }
36
36
  }
37
37
 
38
- class ActionSheetController extends OverlayBaseController {
39
- constructor() {
40
- super(actionSheetController);
41
- }
42
- }
43
- /** @nocollapse */ ActionSheetController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ActionSheetController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
44
- /** @nocollapse */ ActionSheetController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ActionSheetController, providedIn: 'root' });
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ActionSheetController, decorators: [{
46
- type: Injectable,
47
- args: [{
48
- providedIn: 'root',
49
- }]
50
- }], ctorParameters: function () { return []; } });
51
-
52
38
  class AlertController extends OverlayBaseController {
53
39
  constructor() {
54
40
  super(alertController);
@@ -169,214 +155,6 @@ class MenuController {
169
155
  }
170
156
  }
171
157
 
172
- /**
173
- * @description
174
- * NavParams are an object that exists on a page and can contain data for that particular view.
175
- * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
176
- * option with a simple `get` method.
177
- *
178
- * @usage
179
- * ```ts
180
- * import { NavParams } from '@ionic/angular';
181
- *
182
- * export class MyClass{
183
- *
184
- * constructor(navParams: NavParams){
185
- * // userParams is an object we have in our nav-parameters
186
- * navParams.get('userParams');
187
- * }
188
- *
189
- * }
190
- * ```
191
- */
192
- class NavParams {
193
- constructor(data = {}) {
194
- this.data = data;
195
- }
196
- /**
197
- * Get the value of a nav-parameter for the current view
198
- *
199
- * ```ts
200
- * import { NavParams } from 'ionic-angular';
201
- *
202
- * export class MyClass{
203
- * constructor(public navParams: NavParams){
204
- * // userParams is an object we have in our nav-parameters
205
- * this.navParams.get('userParams');
206
- * }
207
- * }
208
- * ```
209
- *
210
- * @param param Which param you want to look up
211
- */
212
- get(param) {
213
- return this.data[param];
214
- }
215
- }
216
-
217
- // TODO(FW-2827): types
218
- class AngularDelegate {
219
- constructor() {
220
- this.zone = inject(NgZone);
221
- this.applicationRef = inject(ApplicationRef);
222
- }
223
- create(environmentInjector, injector, elementReferenceKey) {
224
- return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
225
- }
226
- }
227
- /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
228
- /** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
229
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
230
- type: Injectable
231
- }] });
232
- class AngularFrameworkDelegate {
233
- constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
234
- this.environmentInjector = environmentInjector;
235
- this.injector = injector;
236
- this.applicationRef = applicationRef;
237
- this.zone = zone;
238
- this.elementReferenceKey = elementReferenceKey;
239
- this.elRefMap = new WeakMap();
240
- this.elEventsMap = new WeakMap();
241
- }
242
- attachViewToDom(container, component, params, cssClasses) {
243
- return this.zone.run(() => {
244
- return new Promise((resolve) => {
245
- const componentProps = Object.assign({}, params);
246
- /**
247
- * Ionic Angular passes a reference to a modal
248
- * or popover that can be accessed using a
249
- * variable in the overlay component. If
250
- * elementReferenceKey is defined, then we should
251
- * pass a reference to the component using
252
- * elementReferenceKey as the key.
253
- */
254
- if (this.elementReferenceKey !== undefined) {
255
- componentProps[this.elementReferenceKey] = container;
256
- }
257
- const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
258
- resolve(el);
259
- });
260
- });
261
- }
262
- removeViewFromDom(_container, component) {
263
- return this.zone.run(() => {
264
- return new Promise((resolve) => {
265
- const componentRef = this.elRefMap.get(component);
266
- if (componentRef) {
267
- componentRef.destroy();
268
- this.elRefMap.delete(component);
269
- const unbindEvents = this.elEventsMap.get(component);
270
- if (unbindEvents) {
271
- unbindEvents();
272
- this.elEventsMap.delete(component);
273
- }
274
- }
275
- resolve();
276
- });
277
- });
278
- }
279
- }
280
- const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
281
- /**
282
- * Wraps the injector with a custom injector that
283
- * provides NavParams to the component.
284
- *
285
- * NavParams is a legacy feature from Ionic v3 that allows
286
- * Angular developers to provide data to a component
287
- * and access it by providing NavParams as a dependency
288
- * in the constructor.
289
- *
290
- * The modern approach is to access the data directly
291
- * from the component's class instance.
292
- */
293
- const childInjector = Injector.create({
294
- providers: getProviders(params),
295
- parent: injector,
296
- });
297
- const componentRef = createComponent(component, {
298
- environmentInjector,
299
- elementInjector: childInjector,
300
- });
301
- const instance = componentRef.instance;
302
- const hostElement = componentRef.location.nativeElement;
303
- if (params) {
304
- /**
305
- * For modals and popovers, a reference to the component is
306
- * added to `params` during the call to attachViewToDom. If
307
- * a reference using this name is already set, this means
308
- * the app is trying to use the name as a component prop,
309
- * which will cause collisions.
310
- */
311
- if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
312
- console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
313
- }
314
- Object.assign(instance, params);
315
- }
316
- if (cssClasses) {
317
- for (const cssClass of cssClasses) {
318
- hostElement.classList.add(cssClass);
319
- }
320
- }
321
- const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
322
- container.appendChild(hostElement);
323
- applicationRef.attachView(componentRef.hostView);
324
- elRefMap.set(hostElement, componentRef);
325
- elEventsMap.set(hostElement, unbindEvents);
326
- return hostElement;
327
- };
328
- const LIFECYCLES = [
329
- LIFECYCLE_WILL_ENTER,
330
- LIFECYCLE_DID_ENTER,
331
- LIFECYCLE_WILL_LEAVE,
332
- LIFECYCLE_DID_LEAVE,
333
- LIFECYCLE_WILL_UNLOAD,
334
- ];
335
- const bindLifecycleEvents = (zone, instance, element) => {
336
- return zone.run(() => {
337
- const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
338
- const handler = (ev) => instance[eventName](ev.detail);
339
- element.addEventListener(eventName, handler);
340
- return () => element.removeEventListener(eventName, handler);
341
- });
342
- return () => unregisters.forEach((fn) => fn());
343
- });
344
- };
345
- const NavParamsToken = new InjectionToken('NavParamsToken');
346
- const getProviders = (params) => {
347
- return [
348
- {
349
- provide: NavParamsToken,
350
- useValue: params,
351
- },
352
- {
353
- provide: NavParams,
354
- useFactory: provideNavParamsInjectable,
355
- deps: [NavParamsToken],
356
- },
357
- ];
358
- };
359
- const provideNavParamsInjectable = (params) => {
360
- return new NavParams(params);
361
- };
362
-
363
- class ModalController extends OverlayBaseController {
364
- constructor() {
365
- super(modalController);
366
- this.angularDelegate = inject(AngularDelegate);
367
- this.injector = inject(Injector);
368
- this.environmentInjector = inject(EnvironmentInjector);
369
- }
370
- create(opts) {
371
- return super.create(Object.assign(Object.assign({}, opts), { delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'modal') }));
372
- }
373
- }
374
- /** @nocollapse */ ModalController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
375
- /** @nocollapse */ ModalController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController });
376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, decorators: [{
377
- type: Injectable
378
- }], ctorParameters: function () { return []; } });
379
-
380
158
  class PickerController extends OverlayBaseController {
381
159
  constructor() {
382
160
  super(pickerController);
@@ -391,99 +169,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
391
169
  }]
392
170
  }], ctorParameters: function () { return []; } });
393
171
 
394
- class PopoverController extends OverlayBaseController {
395
- constructor() {
396
- super(popoverController);
397
- this.angularDelegate = inject(AngularDelegate);
398
- this.injector = inject(Injector);
399
- this.environmentInjector = inject(EnvironmentInjector);
400
- }
401
- create(opts) {
402
- return super.create(Object.assign(Object.assign({}, opts), { delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'popover') }));
403
- }
404
- }
405
- /** @nocollapse */ PopoverController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: PopoverController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
406
- /** @nocollapse */ PopoverController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: PopoverController });
407
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: PopoverController, decorators: [{
408
- type: Injectable
409
- }], ctorParameters: function () { return []; } });
410
-
411
- class ToastController extends OverlayBaseController {
412
- constructor() {
413
- super(toastController);
414
- }
415
- }
416
- /** @nocollapse */ ToastController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
417
- /** @nocollapse */ ToastController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, providedIn: 'root' });
418
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, decorators: [{
419
- type: Injectable,
420
- args: [{
421
- providedIn: 'root',
422
- }]
423
- }], ctorParameters: function () { return []; } });
424
-
425
- class AnimationController {
426
- /**
427
- * Create a new animation
428
- */
429
- create(animationId) {
430
- return createAnimation(animationId);
431
- }
432
- /**
433
- * EXPERIMENTAL
434
- *
435
- * Given a progression and a cubic bezier function,
436
- * this utility returns the time value(s) at which the
437
- * cubic bezier reaches the given time progression.
438
- *
439
- * If the cubic bezier never reaches the progression
440
- * the result will be an empty array.
441
- *
442
- * This is most useful for switching between easing curves
443
- * when doing a gesture animation (i.e. going from linear easing
444
- * during a drag, to another easing when `progressEnd` is called)
445
- */
446
- easingTime(p0, p1, p2, p3, progression) {
447
- return getTimeGivenProgression(p0, p1, p2, p3, progression);
448
- }
449
- }
450
- /** @nocollapse */ AnimationController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AnimationController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
451
- /** @nocollapse */ AnimationController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AnimationController, providedIn: 'root' });
452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AnimationController, decorators: [{
453
- type: Injectable,
454
- args: [{
455
- providedIn: 'root',
456
- }]
457
- }] });
458
-
459
- class GestureController {
460
- constructor(zone) {
461
- this.zone = zone;
462
- }
463
- /**
464
- * Create a new gesture
465
- */
466
- create(opts, runInsideAngularZone = false) {
467
- if (runInsideAngularZone) {
468
- Object.getOwnPropertyNames(opts).forEach((key) => {
469
- if (typeof opts[key] === 'function') {
470
- const fn = opts[key];
471
- opts[key] = (...props) => this.zone.run(() => fn(...props));
472
- }
473
- });
474
- }
475
- return createGesture(opts);
476
- }
477
- }
478
- /** @nocollapse */ GestureController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GestureController, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
479
- /** @nocollapse */ GestureController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GestureController, providedIn: 'root' });
480
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GestureController, decorators: [{
481
- type: Injectable,
482
- args: [{
483
- providedIn: 'root',
484
- }]
485
- }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
486
-
487
172
  class DomController {
488
173
  /**
489
174
  * Schedules a task to run during the READ phase of the next frame.
@@ -1040,6 +725,197 @@ const getConfig = () => {
1040
725
  return null;
1041
726
  };
1042
727
 
728
+ /**
729
+ * @description
730
+ * NavParams are an object that exists on a page and can contain data for that particular view.
731
+ * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
732
+ * option with a simple `get` method.
733
+ *
734
+ * @usage
735
+ * ```ts
736
+ * import { NavParams } from '@ionic/angular';
737
+ *
738
+ * export class MyClass{
739
+ *
740
+ * constructor(navParams: NavParams){
741
+ * // userParams is an object we have in our nav-parameters
742
+ * navParams.get('userParams');
743
+ * }
744
+ *
745
+ * }
746
+ * ```
747
+ */
748
+ class NavParams {
749
+ constructor(data = {}) {
750
+ this.data = data;
751
+ }
752
+ /**
753
+ * Get the value of a nav-parameter for the current view
754
+ *
755
+ * ```ts
756
+ * import { NavParams } from 'ionic-angular';
757
+ *
758
+ * export class MyClass{
759
+ * constructor(public navParams: NavParams){
760
+ * // userParams is an object we have in our nav-parameters
761
+ * this.navParams.get('userParams');
762
+ * }
763
+ * }
764
+ * ```
765
+ *
766
+ * @param param Which param you want to look up
767
+ */
768
+ get(param) {
769
+ return this.data[param];
770
+ }
771
+ }
772
+
773
+ // TODO(FW-2827): types
774
+ class AngularDelegate {
775
+ constructor() {
776
+ this.zone = inject(NgZone);
777
+ this.applicationRef = inject(ApplicationRef);
778
+ }
779
+ create(environmentInjector, injector, elementReferenceKey) {
780
+ return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
781
+ }
782
+ }
783
+ /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
784
+ /** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
785
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
786
+ type: Injectable
787
+ }] });
788
+ class AngularFrameworkDelegate {
789
+ constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
790
+ this.environmentInjector = environmentInjector;
791
+ this.injector = injector;
792
+ this.applicationRef = applicationRef;
793
+ this.zone = zone;
794
+ this.elementReferenceKey = elementReferenceKey;
795
+ this.elRefMap = new WeakMap();
796
+ this.elEventsMap = new WeakMap();
797
+ }
798
+ attachViewToDom(container, component, params, cssClasses) {
799
+ return this.zone.run(() => {
800
+ return new Promise((resolve) => {
801
+ const componentProps = Object.assign({}, params);
802
+ /**
803
+ * Ionic Angular passes a reference to a modal
804
+ * or popover that can be accessed using a
805
+ * variable in the overlay component. If
806
+ * elementReferenceKey is defined, then we should
807
+ * pass a reference to the component using
808
+ * elementReferenceKey as the key.
809
+ */
810
+ if (this.elementReferenceKey !== undefined) {
811
+ componentProps[this.elementReferenceKey] = container;
812
+ }
813
+ const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
814
+ resolve(el);
815
+ });
816
+ });
817
+ }
818
+ removeViewFromDom(_container, component) {
819
+ return this.zone.run(() => {
820
+ return new Promise((resolve) => {
821
+ const componentRef = this.elRefMap.get(component);
822
+ if (componentRef) {
823
+ componentRef.destroy();
824
+ this.elRefMap.delete(component);
825
+ const unbindEvents = this.elEventsMap.get(component);
826
+ if (unbindEvents) {
827
+ unbindEvents();
828
+ this.elEventsMap.delete(component);
829
+ }
830
+ }
831
+ resolve();
832
+ });
833
+ });
834
+ }
835
+ }
836
+ const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
837
+ /**
838
+ * Wraps the injector with a custom injector that
839
+ * provides NavParams to the component.
840
+ *
841
+ * NavParams is a legacy feature from Ionic v3 that allows
842
+ * Angular developers to provide data to a component
843
+ * and access it by providing NavParams as a dependency
844
+ * in the constructor.
845
+ *
846
+ * The modern approach is to access the data directly
847
+ * from the component's class instance.
848
+ */
849
+ const childInjector = Injector.create({
850
+ providers: getProviders(params),
851
+ parent: injector,
852
+ });
853
+ const componentRef = createComponent(component, {
854
+ environmentInjector,
855
+ elementInjector: childInjector,
856
+ });
857
+ const instance = componentRef.instance;
858
+ const hostElement = componentRef.location.nativeElement;
859
+ if (params) {
860
+ /**
861
+ * For modals and popovers, a reference to the component is
862
+ * added to `params` during the call to attachViewToDom. If
863
+ * a reference using this name is already set, this means
864
+ * the app is trying to use the name as a component prop,
865
+ * which will cause collisions.
866
+ */
867
+ if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
868
+ console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
869
+ }
870
+ Object.assign(instance, params);
871
+ }
872
+ if (cssClasses) {
873
+ for (const cssClass of cssClasses) {
874
+ hostElement.classList.add(cssClass);
875
+ }
876
+ }
877
+ const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
878
+ container.appendChild(hostElement);
879
+ applicationRef.attachView(componentRef.hostView);
880
+ elRefMap.set(hostElement, componentRef);
881
+ elEventsMap.set(hostElement, unbindEvents);
882
+ return hostElement;
883
+ };
884
+ const LIFECYCLES = [
885
+ LIFECYCLE_WILL_ENTER,
886
+ LIFECYCLE_DID_ENTER,
887
+ LIFECYCLE_WILL_LEAVE,
888
+ LIFECYCLE_DID_LEAVE,
889
+ LIFECYCLE_WILL_UNLOAD,
890
+ ];
891
+ const bindLifecycleEvents = (zone, instance, element) => {
892
+ return zone.run(() => {
893
+ const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
894
+ const handler = (ev) => instance[eventName](ev.detail);
895
+ element.addEventListener(eventName, handler);
896
+ return () => element.removeEventListener(eventName, handler);
897
+ });
898
+ return () => unregisters.forEach((fn) => fn());
899
+ });
900
+ };
901
+ const NavParamsToken = new InjectionToken('NavParamsToken');
902
+ const getProviders = (params) => {
903
+ return [
904
+ {
905
+ provide: NavParamsToken,
906
+ useValue: params,
907
+ },
908
+ {
909
+ provide: NavParams,
910
+ useFactory: provideNavParamsInjectable,
911
+ deps: [NavParamsToken],
912
+ },
913
+ ];
914
+ };
915
+ const provideNavParamsInjectable = (params) => {
916
+ return new NavParams(params);
917
+ };
918
+
1043
919
  // TODO: Is there a way we can grab this from angular-component-lib instead?
1044
920
  const proxyInputs = (Cmp, inputs) => {
1045
921
  const Prototype = Cmp.prototype;
@@ -2619,5 +2495,5 @@ class IonicRouteStrategy {
2619
2495
  * Generated bundle index. Do not edit.
2620
2496
  */
2621
2497
 
2622
- export { ActionSheetController, AlertController, AngularDelegate, AnimationController, Config, ConfigToken, DomController, GestureController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, LoadingController, MenuController, ModalController, NavController, NavParams, PickerController, Platform, PopoverController, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ToastController, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2498
+ export { AlertController, AngularDelegate, Config, ConfigToken, DomController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, LoadingController, MenuController, NavController, NavParams, OverlayBaseController, PickerController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2623
2499
  //# sourceMappingURL=ionic-angular-common.mjs.map