mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
refactor(all): updating to newest stencil apis (#18578)
* chore(): update ionicons * refactor(all): updating to newest stencil apis * fix lint issues * more changes * moreee * fix treeshaking * fix config * fix checkbox * fix stuff * chore(): update ionicons * fix linting errors
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
import { Build, Component, Element, Event, EventEmitter, Method, Prop, QueueApi, Watch, h } from '@stencil/core';
|
||||
import { Build, Component, Element, Event, EventEmitter, Method, Prop, Watch, h } from '@stencil/core';
|
||||
|
||||
import { config } from '../../global/config';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { Animation, AnimationBuilder, ComponentProps, Config, FrameworkDelegate, Gesture, NavComponent, NavOptions, NavOutlet, NavResult, RouteID, RouteWrite, RouterDirection, TransitionDoneFn, TransitionInstruction, ViewController } from '../../interface';
|
||||
import { Animation, AnimationBuilder, ComponentProps, FrameworkDelegate, Gesture, NavComponent, NavOptions, NavOutlet, NavResult, RouteID, RouteWrite, RouterDirection, TransitionDoneFn, TransitionInstruction, ViewController } from '../../interface';
|
||||
import { assert } from '../../utils/helpers';
|
||||
import { TransitionOptions, lifecycle, setPageHidden, transition } from '../../utils/transition';
|
||||
|
||||
@ -25,10 +26,6 @@ export class Nav implements NavOutlet {
|
||||
|
||||
@Element() el!: HTMLElement;
|
||||
|
||||
@Prop({ context: 'queue' }) queue!: QueueApi;
|
||||
@Prop({ context: 'config' }) config!: Config;
|
||||
@Prop({ context: 'window' }) win!: Window;
|
||||
|
||||
/** @internal */
|
||||
@Prop() delegate?: FrameworkDelegate;
|
||||
|
||||
@ -94,12 +91,12 @@ export class Nav implements NavOutlet {
|
||||
|
||||
componentWillLoad() {
|
||||
this.useRouter =
|
||||
!!this.win.document.querySelector('ion-router') &&
|
||||
!!document.querySelector('ion-router') &&
|
||||
!this.el.closest('[no-router]');
|
||||
|
||||
if (this.swipeGesture === undefined) {
|
||||
const mode = getIonMode(this);
|
||||
this.swipeGesture = this.config.getBoolean(
|
||||
this.swipeGesture = config.getBoolean(
|
||||
'swipeBackEnabled',
|
||||
mode === 'ios'
|
||||
);
|
||||
@ -251,18 +248,18 @@ export class Nav implements NavOutlet {
|
||||
opts?: NavOptions | null,
|
||||
done?: TransitionDoneFn
|
||||
): Promise<boolean> {
|
||||
const config: TransitionInstruction = {
|
||||
const tiConfig: TransitionInstruction = {
|
||||
removeStart: -1,
|
||||
removeCount: -1,
|
||||
opts
|
||||
};
|
||||
if (typeof indexOrViewCtrl === 'object' && (indexOrViewCtrl as ViewController).component) {
|
||||
config.removeView = indexOrViewCtrl;
|
||||
config.removeStart = 1;
|
||||
tiConfig.removeView = indexOrViewCtrl;
|
||||
tiConfig.removeStart = 1;
|
||||
} else if (typeof indexOrViewCtrl === 'number') {
|
||||
config.removeStart = indexOrViewCtrl + 1;
|
||||
tiConfig.removeStart = indexOrViewCtrl + 1;
|
||||
}
|
||||
return this.queueTrns(config, done);
|
||||
return this.queueTrns(tiConfig, done);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -555,7 +552,7 @@ export class Nav implements NavOutlet {
|
||||
ti.resolve!(result.hasCompleted);
|
||||
|
||||
if (ti.opts!.updateURL !== false && this.useRouter) {
|
||||
const router = this.win.document.querySelector('ion-router');
|
||||
const router = document.querySelector('ion-router');
|
||||
if (router) {
|
||||
const direction = result.direction === 'back' ? 'back' : 'forward';
|
||||
router.navChanged(direction);
|
||||
@ -834,11 +831,10 @@ export class Nav implements NavOutlet {
|
||||
const animationOpts: TransitionOptions = {
|
||||
mode,
|
||||
showGoBack: this.canGoBackSync(enteringView),
|
||||
window: this.win,
|
||||
baseEl: this.el,
|
||||
animationBuilder: this.animation || opts.animationBuilder || this.config.get('navAnimation'),
|
||||
animationBuilder: this.animation || opts.animationBuilder || config.get('navAnimation'),
|
||||
progressCallback,
|
||||
animated: this.animated && this.config.getBoolean('animated', true),
|
||||
animated: this.animated && config.getBoolean('animated', true),
|
||||
|
||||
enteringEl,
|
||||
leavingEl,
|
||||
|
||||
Reference in New Issue
Block a user