Skip to content

Commit f060db5

Browse files
merge release-4.6.1
2 parents 292cc86 + 908f36f commit f060db5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+588
-269
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## [4.6.1](https://github.com/ionic-team/ionic/compare/v4.6.0...v4.6.1) (2019-07-09)
2+
3+
4+
### Bug Fixes
5+
6+
* **app:** add hydrated to hide white screen with multiple ionic dependencies ([#18649](https://github.com/ionic-team/ionic/issues/18649))
7+
* **datetime:** datetime no longer reports having a value if none is set ([#18541](https://github.com/ionic-team/ionic/issues/18541)) ([92e0f98](https://github.com/ionic-team/ionic/commit/92e0f98)), closes [#17979](https://github.com/ionic-team/ionic/issues/17979) [#18540](https://github.com/ionic-team/ionic/issues/18540)
8+
* **fab-button:** set opacity on disabled fab button ([#18685](https://github.com/ionic-team/ionic/issues/18685)) ([6042b39](https://github.com/ionic-team/ionic/commit/6042b39)), closes [#18682](https://github.com/ionic-team/ionic/issues/18682)
9+
* **icon:** load icons properly with baseHref ([#18650](https://github.com/ionic-team/ionic/issues/18650)), ([#18637](https://github.com/ionic-team/ionic/issues/18637))
10+
* **icon:** bind icon name properly ([#18707](https://github.com/ionic-team/ionic/issues/18707))
11+
* **infinite-scroll:** fix scroll listener ([0d58101](https://github.com/ionic-team/ionic/commit/0d58101))
12+
* **item:** do not disable entire item if there are multiple inputs ([#18696](https://github.com/ionic-team/ionic/issues/18696)) ([dfa2b13](https://github.com/ionic-team/ionic/commit/dfa2b13)), closes [#18655](https://github.com/ionic-team/ionic/issues/18655) [#18670](https://github.com/ionic-team/ionic/issues/18670)
13+
* **router-link:** add missing target prop ([#18659](https://github.com/ionic-team/ionic/issues/18659)) ([1f51ab2](https://github.com/ionic-team/ionic/commit/1f51ab2)), closes [#18655](https://github.com/ionic-team/ionic/issues/18655)
14+
* **router-outlet:** fix swipe to go back ([b69fb69](https://github.com/ionic-team/ionic/commit/b69fb69))
15+
* **scss:** copy all scss files ([36a58df](https://github.com/ionic-team/ionic/commit/36a58df))
16+
* **searchbar:** proper styling after navigating ([#18642](https://github.com/ionic-team/ionic/issues/18642))
17+
* **slides:** use correct order for pushing slides dynamically ([#18633](https://github.com/ionic-team/ionic/issues/18633))
18+
* **tabs:** select proper tab by default and do not emit tab change if selectedTab is undefined ([03c834c](https://github.com/ionic-team/ionic/commit/03c834c))
19+
* **overlay:** make create opts optional ([44c88ad](https://github.com/ionic-team/ionic/commit/44c88ad))
20+
21+
22+
### Performance Improvements
23+
24+
* **angular:** skip zone ([e059fc8](https://github.com/ionic-team/ionic/commit/e059fc8))
25+
26+
27+
128
# [4.6.0 Carbon](https://github.com/ionic-team/ionic/compare/v4.5.0...v4.6.0) (2019-06-26)
229

330

angular/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ionic/angular",
3-
"version": "4.6.0",
3+
"version": "4.6.1",
44
"description": "Angular specific wrappers for @ionic/core",
55
"keywords": [
66
"ionic",
@@ -45,7 +45,7 @@
4545
"css/"
4646
],
4747
"dependencies": {
48-
"@ionic/core": "4.6.0",
48+
"@ionic/core": "4.6.1",
4949
"tslib": "^1.9.3"
5050
},
5151
"peerDependencies": {
@@ -73,12 +73,12 @@
7373
"@angular/platform-browser": "^7.2.1",
7474
"@angular/platform-browser-dynamic": "^7.2.1",
7575
"@angular/router": "^7.2.1",
76-
"@types/node": "~10.12.0",
76+
"@types/node": "~12.0.12",
7777
"fs-extra": "^7.0.0",
7878
"glob": "^7.1.3",
7979
"rollup": "^1.1.2",
8080
"rollup-plugin-node-resolve": "^4.0.0",
81-
"rxjs": "^6.2.0",
81+
"rxjs": "^6.5.2",
8282
"tsickle": "^0.34.0",
8383
"tslint": "^5.12.1",
8484
"tslint-ionic-rules": "0.0.21",

angular/src/app-initialize.ts

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,42 @@
1+
import { NgZone } from '@angular/core';
12
import { applyPolyfills, defineCustomElements } from '@ionic/core/loader';
23

34
import { Config } from './providers/config';
45
import { IonicWindow } from './types/interfaces';
56

6-
export function appInitialize(config: Config, doc: Document) {
7+
export function appInitialize(config: Config, doc: Document, zone: NgZone) {
78
return (): any => {
89
const win: IonicWindow | undefined = doc.defaultView as any;
910
if (win) {
1011
const Ionic = win.Ionic = win.Ionic || {};
1112

12-
Ionic.config = config;
13+
Ionic.config = {
14+
...config,
15+
_zoneGate: (h: any) => zone.run(h)
16+
};
17+
18+
const aelFn = '__zone_symbol__addEventListener' in (document.body as any)
19+
? '__zone_symbol__addEventListener'
20+
: 'addEventListener';
1321

1422
return applyPolyfills().then(() => {
1523
return defineCustomElements(win, {
1624
exclude: ['ion-tabs', 'ion-tab'],
1725
syncQueue: true,
18-
raf: h => (win.__zone_symbol__requestAnimationFrame) ? win.__zone_symbol__requestAnimationFrame(h) : requestAnimationFrame(h),
26+
jmp: (h: any) => zone.runOutsideAngular(h),
27+
raf: h => {
28+
return zone.runOutsideAngular(() => {
29+
return (win.__zone_symbol__requestAnimationFrame) ? win.__zone_symbol__requestAnimationFrame(h) : requestAnimationFrame(h);
30+
});
31+
},
1932
ael(elm, eventName, cb, opts) {
20-
if ((elm as any).__zone_symbol__addEventListener && skipZone(eventName)) {
21-
(elm as any).__zone_symbol__addEventListener(eventName, cb, opts);
22-
} else {
23-
elm.addEventListener(eventName, cb, opts);
24-
}
33+
(elm as any)[aelFn](eventName, cb, opts);
2534
},
2635
rel(elm, eventName, cb, opts) {
27-
if ((elm as any).__zone_symbol__removeEventListener && skipZone(eventName)) {
28-
(elm as any).__zone_symbol__removeEventListener(eventName, cb, opts);
29-
} else {
30-
elm.removeEventListener(eventName, cb, opts);
31-
}
36+
elm.removeEventListener(eventName, cb, opts);
3237
}
3338
});
3439
});
3540
}
3641
};
3742
}
38-
39-
const SKIP_ZONE = [
40-
'scroll',
41-
'resize',
42-
43-
'touchstart',
44-
'touchmove',
45-
'touchend',
46-
47-
'mousedown',
48-
'mousemove',
49-
'mouseup',
50-
51-
'ionStyle',
52-
];
53-
54-
function skipZone(eventName: string) {
55-
return SKIP_ZONE.indexOf(eventName) >= 0;
56-
}

angular/src/directives/control-value-accessors/value-accessor.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ export class ValueAccessor implements ControlValueAccessor {
4242
}
4343

4444
export function setIonicClasses(element: ElementRef) {
45-
requestAnimationFrame(() => {
46-
const input = element.nativeElement as HTMLElement;
47-
const classes = getClasses(input);
48-
setClasses(input, classes);
45+
const input = element.nativeElement as HTMLElement;
46+
const classes = getClasses(input);
47+
setClasses(input, classes);
4948

50-
const item = input.closest('ion-item');
51-
if (item) {
52-
setClasses(item, classes);
53-
}
54-
});
49+
const item = input.closest('ion-item');
50+
if (item) {
51+
setClasses(item, classes);
52+
}
5553
}
5654

5755
function getClasses(element: HTMLElement) {

angular/src/directives/navigation/ion-router-outlet.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Location } from '@angular/common';
2-
import { Attribute, ChangeDetectorRef, ComponentFactoryResolver, ComponentRef, Directive, ElementRef, EventEmitter, Injector, NgZone, OnDestroy, OnInit, Optional, Output, SkipSelf, ViewContainerRef } from '@angular/core';
2+
import { Attribute, ComponentFactoryResolver, ComponentRef, Directive, ElementRef, EventEmitter, Injector, NgZone, OnDestroy, OnInit, Optional, Output, SkipSelf, ViewContainerRef } from '@angular/core';
33
import { ActivatedRoute, ChildrenOutletContexts, OutletContext, PRIMARY_OUTLET, Router } from '@angular/router';
44
import { BehaviorSubject, Observable } from 'rxjs';
55
import { distinctUntilChanged, filter, switchMap } from 'rxjs/operators';
@@ -57,7 +57,6 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
5757
private resolver: ComponentFactoryResolver,
5858
@Attribute('name') name: string,
5959
@Optional() @Attribute('tabs') tabs: string,
60-
private changeDetector: ChangeDetectorRef,
6160
private config: Config,
6261
private navCtrl: NavController,
6362
commonLocation: Location,
@@ -206,12 +205,11 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
206205
// Calling `markForCheck` to make sure we will run the change detection when the
207206
// `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
208207
enteringView = this.stackCtrl.createView(this.activated, activatedRoute);
208+
enteringView.ref.changeDetectorRef.detectChanges();
209209

210210
// Store references to the proxy by component
211211
this.proxyMap.set(cmpRef.instance, activatedRouteProxy);
212212
this.currentActivatedRoute$.next({ component: cmpRef.instance, activatedRoute });
213-
214-
this.changeDetector.markForCheck();
215213
}
216214

217215
this.activatedView = enteringView;

angular/src/directives/navigation/stack-controller.ts

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ export class StackController {
4444

4545
getExistingView(activatedRoute: ActivatedRoute): RouteView | undefined {
4646
const activatedUrlKey = getUrl(this.router, activatedRoute);
47-
const view = this.views.find(vw => vw.url === activatedUrlKey);
48-
if (view) {
49-
view.ref.changeDetectorRef.reattach();
50-
}
51-
return view;
47+
return this.views.find(vw => vw.url === activatedUrlKey);
5248
}
5349

5450
setActive(enteringView: RouteView): Promise<StackEvent> {
@@ -95,15 +91,15 @@ export class StackController {
9591
}
9692

9793
const views = this.insertView(enteringView, direction);
98-
return this.wait(async () => {
99-
await this.transition(enteringView, leavingView, animation, this.canGoBack(1), false);
100-
await cleanupAsync(enteringView, views, viewsSnapshot, this.location);
101-
return {
102-
enteringView,
103-
direction,
104-
animation,
105-
tabSwitch
106-
};
94+
return this.wait(() => {
95+
return this.transition(enteringView, leavingView, animation, this.canGoBack(1), false)
96+
.then(() => cleanupAsync(enteringView, views, viewsSnapshot, this.location))
97+
.then(() => ({
98+
enteringView,
99+
direction,
100+
animation,
101+
tabSwitch
102+
}));
107103
});
108104
}
109105

@@ -138,13 +134,12 @@ export class StackController {
138134
});
139135
}
140136

141-
async startBackTransition() {
137+
startBackTransition() {
142138
const leavingView = this.activeView;
143139
if (leavingView) {
144140
const views = this.getStack(leavingView.stackId);
145141
const enteringView = views[views.length - 2];
146-
enteringView.ref.changeDetectorRef.reattach();
147-
await this.wait(() => {
142+
return this.wait(() => {
148143
return this.transition(
149144
enteringView, // entering view
150145
leavingView, // leaving view
@@ -154,6 +149,7 @@ export class StackController {
154149
);
155150
});
156151
}
152+
return Promise.resolve();
157153
}
158154

159155
endBackTransition(shouldComplete: boolean) {
@@ -189,7 +185,7 @@ export class StackController {
189185
return this.views.slice();
190186
}
191187

192-
private async transition(
188+
private transition(
193189
enteringView: RouteView | undefined,
194190
leavingView: RouteView | undefined,
195191
direction: 'forward' | 'back' | undefined,
@@ -198,8 +194,16 @@ export class StackController {
198194
) {
199195
if (this.skipTransition) {
200196
this.skipTransition = false;
201-
return;
197+
return Promise.resolve(false);
202198
}
199+
if (enteringView) {
200+
enteringView.ref.changeDetectorRef.reattach();
201+
}
202+
// TODO: disconnect leaving page from change detection to
203+
// reduce jank during the page transition
204+
// if (leavingView) {
205+
// leavingView.ref.changeDetectorRef.detach();
206+
// }
203207
const enteringEl = enteringView ? enteringView.element : undefined;
204208
const leavingEl = leavingView ? leavingView.element : undefined;
205209
const containerEl = this.containerEl;
@@ -209,15 +213,15 @@ export class StackController {
209213
containerEl.appendChild(enteringEl);
210214
}
211215

212-
await containerEl.componentOnReady();
213-
await containerEl.commit(enteringEl, leavingEl, {
216+
return this.zone.runOutsideAngular(() => containerEl.commit(enteringEl, leavingEl, {
214217
deepWait: true,
215218
duration: direction === undefined ? 0 : undefined,
216219
direction,
217220
showGoBack,
218221
progressAnimation
219-
});
222+
}));
220223
}
224+
return Promise.resolve(false);
221225
}
222226

223227
private async wait<T>(task: () => Promise<T>): Promise<T> {
@@ -245,7 +249,6 @@ function cleanup(activeRoute: RouteView, views: RouteView[], viewsSnapshot: Rout
245249
.forEach(destroyView);
246250

247251
views.forEach(view => {
248-
249252
/**
250253
* In the event that a user navigated multiple
251254
* times in rapid succession, we want to make sure

angular/src/directives/proxies-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ export function proxyInputs(Cmp: any, inputs: string[]) {
66
inputs.forEach(item => {
77
Object.defineProperty(Prototype, item, {
88
get() { return this.el[item]; },
9-
set(val: any) { this.el[item] = val; },
9+
set(val: any) {
10+
this.z.runOutsideAngular(() => this.el[item] = val);
11+
},
1012
});
1113
});
1214
}
@@ -16,7 +18,7 @@ export function proxyMethods(Cmp: any, methods: string[]) {
1618
methods.forEach(methodName => {
1719
Prototype[methodName] = function() {
1820
const args = arguments;
19-
return this.el.componentOnReady().then((el: any) => el[methodName].apply(el, args));
21+
return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
2022
};
2123
});
2224
}

0 commit comments

Comments
 (0)